Fix #8025 - move css to resources
[roobuilder] / src / Builder4 / GtkView.vala
index 015788e..c560f25 100644 (file)
@@ -31,11 +31,10 @@ public class Xcls_GtkView : Object
 
                // my vars (def)
        public Gtk.Widget lastObj;
-       public Gtk.CssProvider css;
        public Xcls_MainWindow main_window;
-       public GtkSource.SearchContext searchcontext;
        public int last_error_counter;
        public int last_search_end;
+       public GtkSource.SearchContext searchcontext;
        public JsRender.JsRender file;
 
        // ctor
@@ -55,25 +54,6 @@ public class Xcls_GtkView : Object
                this.el.vexpand = true;
                new Xcls_notebook( _this );
                this.el.append( _this.notebook.el );
-
-               // init method
-
-               {
-               
-                       this.css = new Gtk.CssProvider();
-                        
-                       this.css.load_from_string(
-                               "#gtkview-view-layout { background-color: #ccc; }"
-                       );
-                        
-                       Gtk.StyleContext.add_provider_for_display(
-                               this.el.get_display(),
-                               this.css,
-                               Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
-                       );
-                               
-                       
-               }
        }
 
        // user defined functions
@@ -449,10 +429,10 @@ public class Xcls_GtkView : Object
                        this.el.overflow = Gtk.Overflow.VISIBLE;
                        new Xcls_label_preview( _this );
                        new Xcls_label_code( _this );
-                       var child_3 = new Xcls_ScrolledWindow5( _this );
+                       var child_3 = new Xcls_ScrolledWindow4( _this );
                        child_3.ref();
                        this.el.append_page ( child_3.el , _this.label_preview.el );
-                       var child_4 = new Xcls_Box8( _this );
+                       var child_4 = new Xcls_Box7( _this );
                        child_4.ref();
                        this.el.append_page ( child_4.el , _this.label_code.el );
                }
@@ -505,7 +485,7 @@ public class Xcls_GtkView : Object
                // user defined functions
        }
 
-       public class Xcls_ScrolledWindow5 : Object
+       public class Xcls_ScrolledWindow4 : Object
        {
                public Gtk.ScrolledWindow el;
                private Xcls_GtkView  _this;
@@ -514,7 +494,7 @@ public class Xcls_GtkView : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_ScrolledWindow5(Xcls_GtkView _owner )
+               public Xcls_ScrolledWindow4(Xcls_GtkView _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.ScrolledWindow();
@@ -578,7 +558,7 @@ public class Xcls_GtkView : Object
 
 
 
-       public class Xcls_Box8 : Object
+       public class Xcls_Box7 : Object
        {
                public Gtk.Box el;
                private Xcls_GtkView  _this;
@@ -587,7 +567,7 @@ public class Xcls_GtkView : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Box8(Xcls_GtkView _owner )
+               public Xcls_Box7(Xcls_GtkView _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
@@ -597,7 +577,7 @@ public class Xcls_GtkView : Object
                        // set gobject values
                        new Xcls_sourceviewscroll( _this );
                        this.el.append( _this.sourceviewscroll.el );
-                       var child_2 = new Xcls_Box13( _this );
+                       var child_2 = new Xcls_Box12( _this );
                        child_2.ref();
                        this.el.append( child_2.el );
                }
@@ -637,9 +617,7 @@ public class Xcls_GtkView : Object
 
                        // my vars (def)
                public bool loading;
-               public bool zallow_node_scroll;
                public string prop_selected;
-               public Gtk.CssProvider css;
                public JsRender.Node? node_selected;
 
                // ctor
@@ -651,7 +629,6 @@ public class Xcls_GtkView : Object
 
                        // my vars (dec)
                        this.loading = false;
-                       this.zallow_node_scroll = true;
                        this.prop_selected = "";
 
                        // set gobject values
@@ -659,10 +636,11 @@ public class Xcls_GtkView : Object
                        this.el.editable = false;
                        this.el.show_line_marks = true;
                        this.el.show_line_numbers = true;
+                       this.el.css_classes = { "code-editor" };
                        this.el.tab_width = 4;
                        new Xcls_buffer( _this );
                        this.el.set_buffer ( _this.buffer.el  );
-                       var child_2 = new Xcls_EventControllerKey12( _this );
+                       var child_2 = new Xcls_EventControllerKey11( _this );
                        child_2.ref();
                        this.el.add_controller(  child_2.el );
 
@@ -670,22 +648,10 @@ public class Xcls_GtkView : Object
 
                        {
                        
-                       
-                               this.css = new Gtk.CssProvider();
-                                
-                               this.css.load_from_string("#gtkview-view { font: 10px monospace ;}");
-                                
-                               Gtk.StyleContext.add_provider_for_display(
-                                       this.el.get_display(),
-                                       this.css,
-                                       Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
-                               );
-                                       
-                                        
+                         
                                this.loading = true;
                        
-                       
-                       
+                        
                                var attrs = new GtkSource.MarkAttributes();
                                 attrs.set_icon_name ( "process-stop");    
                                attrs.query_tooltip_text.connect(( mark) => {
@@ -987,7 +953,7 @@ public class Xcls_GtkView : Object
                // user defined functions
        }
 
-       public class Xcls_EventControllerKey12 : Object
+       public class Xcls_EventControllerKey11 : Object
        {
                public Gtk.EventControllerKey el;
                private Xcls_GtkView  _this;
@@ -996,7 +962,7 @@ public class Xcls_GtkView : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_EventControllerKey12(Xcls_GtkView _owner )
+               public Xcls_EventControllerKey11(Xcls_GtkView _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.EventControllerKey();
@@ -1030,7 +996,7 @@ public class Xcls_GtkView : Object
 
 
 
-       public class Xcls_Box13 : Object
+       public class Xcls_Box12 : Object
        {
                public Gtk.Box el;
                private Xcls_GtkView  _this;
@@ -1039,7 +1005,7 @@ public class Xcls_GtkView : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Box13(Xcls_GtkView _owner )
+               public Xcls_Box12(Xcls_GtkView _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
@@ -1057,7 +1023,7 @@ public class Xcls_GtkView : Object
                        this.el.append( _this.nextBtn.el );
                        new Xcls_backBtn( _this );
                        this.el.append( _this.backBtn.el );
-                       var child_5 = new Xcls_MenuButton19( _this );
+                       var child_5 = new Xcls_MenuButton18( _this );
                        child_5.ref();
                        this.el.append( child_5.el );
                }
@@ -1087,24 +1053,10 @@ public class Xcls_GtkView : Object
                        this.el.hexpand = true;
                        this.el.placeholder_text = "Press enter to search";
                        this.el.search_delay = 3;
-                       var child_1 = new Xcls_EventControllerKey15( _this );
+                       var child_1 = new Xcls_EventControllerKey14( _this );
                        child_1.ref();
                        this.el.add_controller(  child_1.el );
 
-                       // init method
-
-                       this.css = new Gtk.CssProvider();
-                       
-                       this.css.load_from_string("
-                               #gtkview-search-entry { font: 10px monospace ;}"
-                       );
-                       
-                       Gtk.StyleContext.add_provider_for_display(
-                               this.el.get_display(),
-                               this.css,
-                               Gtk.STYLE_PROVIDER_PRIORITY_APPLICATION
-                       );
-
                        //listeners
                        this.el.search_changed.connect( () => {
                                 
@@ -1149,7 +1101,7 @@ public class Xcls_GtkView : Object
                        
                }
        }
-       public class Xcls_EventControllerKey15 : Object
+       public class Xcls_EventControllerKey14 : Object
        {
                public Gtk.EventControllerKey el;
                private Xcls_GtkView  _this;
@@ -1158,7 +1110,7 @@ public class Xcls_GtkView : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_EventControllerKey15(Xcls_GtkView _owner )
+               public Xcls_EventControllerKey14(Xcls_GtkView _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.EventControllerKey();
@@ -1308,7 +1260,7 @@ public class Xcls_GtkView : Object
                // user defined functions
        }
 
-       public class Xcls_MenuButton19 : Object
+       public class Xcls_MenuButton18 : Object
        {
                public Gtk.MenuButton el;
                private Xcls_GtkView  _this;
@@ -1318,7 +1270,7 @@ public class Xcls_GtkView : Object
                public bool always_show_image;
 
                // ctor
-               public Xcls_MenuButton19(Xcls_GtkView _owner )
+               public Xcls_MenuButton18(Xcls_GtkView _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.MenuButton();
@@ -1353,14 +1305,14 @@ public class Xcls_GtkView : Object
                        // my vars (dec)
 
                        // set gobject values
-                       var child_1 = new Xcls_Box21( _this );
+                       var child_1 = new Xcls_Box20( _this );
                        child_1.ref();
                        this.el.set_child ( child_1.el  );
                }
 
                // user defined functions
        }
-       public class Xcls_Box21 : Object
+       public class Xcls_Box20 : Object
        {
                public Gtk.Box el;
                private Xcls_GtkView  _this;
@@ -1369,7 +1321,7 @@ public class Xcls_GtkView : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Box21(Xcls_GtkView _owner )
+               public Xcls_Box20(Xcls_GtkView _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );