Fix #8025 - move css to resources
[roobuilder] / src / Builder4 / Editor.bjs
index 51641c3..de4f6cb 100644 (file)
        "* ctor" : "new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL,6, 30, 1)",
        "* init" : [
         "{",
-        "\tthis.el.set_range(6,30);",
-        "\tthis.el.set_value(8);",
+        "\t//this.el.set_range(6,30);",
+        " \tthis.el.set_value ( BuilderApplication.settings.editor_font_size);",
+        " \tBuilderApplication.settings.editor_font_size_updated.connect(",
+        " \t\t() => {",
+        " \t\t\tBuilderApplication.settings.editor_font_size_inchange = true;",
+        " \t\t\tGLib.debug(\"update range\");",
+        " \t\t \tthis.el.set_value (BuilderApplication.settings.editor_font_size);",
+        " \t\t \tBuilderApplication.settings.editor_font_size_inchange = false;",
+        " \t\t}",
+        "\t);",
+        "\t",
+        " ",
         "}",
         ""
        ],
        "listeners" : {
         "change_value" : [
          "(st, val ) => {",
-         "\t ",
-         "\t   ",
-         "\t  _this.view.css.load_from_string(",
-         "\t  \t\t\"#editor-view { font: %dpx monospace; }\".printf((int)val)",
-         "\t   );",
-         "     ",
+         "\tif (BuilderApplication.settings.editor_font_size_inchange) {",
+         "\t\treturn false;",
+         "\t}",
+         "  \tBuilderApplication.settings.editor_font_size = val;",
          " \treturn false;",
          "}"
         ]
        "$ xns" : "GtkSource",
        "* init" : [
         "",
-        "",
-        "this.css = new Gtk.CssProvider();",
-        "",
-        "this.css.load_from_string(",
-        "\t\"#editor-view { font:  12px monospace;}\"",
-        ");",
         " ",
-        "Gtk.StyleContext.add_provider_for_display(",
-        "\tthis.el.get_display(),",
-        "\tthis.css,",
-        "\tGtk.STYLE_PROVIDER_PRIORITY_APPLICATION",
-        ");",
         "\t",
         " ",
         " ",
        "bool vexpand" : true,
        "boolean show_line_marks" : true,
        "boolean show_line_numbers" : true,
+       "css_classes" : "{ \"code-editor\" }",
        "gboolean highlight_current_line" : true,
        "id" : "view",
        "indent_width" : 4,