Fix #8003 - undo code
authorAlan Knowles <alan@roojs.com>
Fri, 2 Feb 2024 09:35:23 +0000 (17:35 +0800)
committerAlan Knowles <alan@roojs.com>
Fri, 2 Feb 2024 09:35:23 +0000 (17:35 +0800)
25 files changed:
debian/changelog
src/Builder4/Editor.bjs
src/Builder4/Editor.vala
src/Builder4/GtkView.bjs
src/Builder4/GtkView.vala
src/Builder4/MainWindow.bjs
src/Builder4/MainWindow.vala
src/Builder4/ValaCompileErrors.bjs
src/Builder4/ValaCompileErrors.vala
src/Builder4/WindowLeftProps.bjs
src/Builder4/WindowLeftProps.vala
src/Builder4/WindowLeftTree.bjs
src/Builder4/WindowLeftTree.vala
src/Builder4/WindowRooView.bjs
src/Builder4/WindowRooView.vala
src/Builder4/WindowState.vala
src/JsRender/Gtk.vala
src/JsRender/JsRender.vala
src/JsRender/Node.vala
src/JsRender/NodeToJs.vala
src/JsRender/NodeToValaExtended.vala
src/JsRender/NodeToValaWrapped.vala
src/JsRender/NodeWriter.vala
src/Lsp.vala
src/Palete/LanguageClientVala.vala

index fa98ccc..02914ad 100644 (file)
@@ -14,6 +14,8 @@ roobuilder (5.0.2) UNRELEASED; urgency=medium
   * switch window now uses libadwadi panel
   * switch window search shows full file list in panel - so you can jump to file
   * control-o tiggers file open, after file serach up/down arrows select file, and enter / shift enter will open.
+  * undo and redo buttons - now work
+  * improved performance on node generation, and language server call performance (less uneccessary calls)
   
  -- Alan Knowles <alan@touchbox>  Sun, 28 Jan 2024 06:54:56 +0800
 
index 79d63cb..51641c3 100644 (file)
     "\t}",
     "\tvar ar = this.file.getErrors();",
     "\tif (ar.size < 1) {",
-    "\t\tbuf.remove_source_marks (start, end, null);",
+    "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
+    "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
+    "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
     "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
     "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
     "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
     "\t\t}",
     "\t",
     "\t}",
-    "\tbuf.remove_source_marks (start, end, null);",
+    "\tbuf.remove_source_marks (start, end, \"ERR\");",
+    "\tbuf.remove_source_marks (start, end, \"WARN\");",
+    "\tbuf.remove_source_marks (start, end, \"DEPR\");",
     "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
     "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
     "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
index 9d0ed02..2f4a1f2 100644 (file)
@@ -277,7 +277,9 @@ public class Editor : Object
                }
                var ar = this.file.getErrors();
                if (ar.size < 1) {
-                       buf.remove_source_marks (start, end, null);
+                       buf.remove_source_marks (start, end, "ERR");
+                       buf.remove_source_marks (start, end, "WARN");
+                       buf.remove_source_marks (start, end, "DEPR");
                        buf.remove_tag_by_name ("ERR", start, end);
                        buf.remove_tag_by_name ("WARN", start, end);
                        buf.remove_tag_by_name ("DEPR", start, end);
@@ -313,7 +315,9 @@ public class Editor : Object
                        }
                
                }
-               buf.remove_source_marks (start, end, null);
+               buf.remove_source_marks (start, end, "ERR");
+               buf.remove_source_marks (start, end, "WARN");
+               buf.remove_source_marks (start, end, "DEPR");
                buf.remove_tag_by_name ("ERR", start, end);
                buf.remove_tag_by_name ("WARN", start, end);
                buf.remove_tag_by_name ("DEPR", start, end);
index 6dd3dc9..7b17a36 100644 (file)
     "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
     "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
     "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
-    "\t\tbuf.remove_source_marks (start, end, null);",
+    "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
+    "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
+    "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
     "\t\tthis.last_error_counter = file.error_counter ;",
     "\t\tGLib.debug(\"higjlight has no errors\");",
     "\t\treturn;",
     "\t",
     " ",
     "\t ",
-    "\tbuf.remove_source_marks (start, end, null);",
+    "\tbuf.remove_source_marks (start, end, \"ERR\");",
+    "\tbuf.remove_source_marks (start, end, \"WARN\");",
+    "\tbuf.remove_source_marks (start, end, \"DEPR\");",
     "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
     "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
     "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
index 73202c5..015788e 100644 (file)
@@ -348,7 +348,9 @@ public class Xcls_GtkView : Object
                        buf.remove_tag_by_name ("ERR", start, end);
                        buf.remove_tag_by_name ("WARN", start, end);
                        buf.remove_tag_by_name ("DEPR", start, end);
-                       buf.remove_source_marks (start, end, null);
+                       buf.remove_source_marks (start, end, "ERR");
+                       buf.remove_source_marks (start, end, "WARN");
+                       buf.remove_source_marks (start, end, "DEPR");
                        this.last_error_counter = file.error_counter ;
                        GLib.debug("higjlight has no errors");
                        return;
@@ -365,7 +367,9 @@ public class Xcls_GtkView : Object
                
         
                 
-               buf.remove_source_marks (start, end, null);
+               buf.remove_source_marks (start, end, "ERR");
+               buf.remove_source_marks (start, end, "WARN");
+               buf.remove_source_marks (start, end, "DEPR");
                buf.remove_tag_by_name ("ERR", start, end);
                buf.remove_tag_by_name ("WARN", start, end);
                buf.remove_tag_by_name ("DEPR", start, end);
index 2ffff3b..c5d3916 100644 (file)
          },
          "string tooltip_text" : "Manage Windows (Ctrl-O)",
          "xtype" : "Button"
+        },
+        {
+         "$ xns" : "Gtk",
+         "bool has_frame" : false,
+         "listeners" : {
+          "clicked" : [
+           "( ) => {",
+           "\t",
+           "\tGLib.debug(\"undo clicked\");",
+           "\tif (_this.windowstate.file.xtype == \"PlainFile\") {",
+           "\t\t_this.windowstate.code_editor_tab.buffer.el.undo();",
+           "\t}",
+           "\tif (!_this.windowstate.file.undoStep(-1)) {",
+           "\t\treturn;",
+           "\t}",
+           "\t",
+           "\t ",
+           "\t_this.windowstate.switchState (WindowState.State.PREVIEW); ",
+           "\t// this triggers loadItems..",
+           "\t_this.windowstate.left_tree.model.loadFile(",
+           "\t\t_this.windowstate.file);",
+           "\t ",
+           "",
+           "\t",
+           " ",
+           "",
+           "\t// load it everywhere",
+           "}",
+           ""
+          ]
+         },
+         "string icon_name" : "edit-undo",
+         "xtype" : "Button"
+        },
+        {
+         "$ xns" : "Gtk",
+         "bool has_frame" : false,
+         "listeners" : {
+          "clicked" : [
+           "( ) => {",
+           "\t",
+           "\tGLib.debug(\"undo clicked\");",
+           "\tif (_this.windowstate.file.xtype == \"PlainFile\") {",
+           "\t\t_this.windowstate.code_editor_tab.buffer.el.redo();",
+           "\t}",
+           "\tif (!_this.windowstate.file.undoStep(1)) {",
+           "\t\treturn;",
+           "\t}",
+           "\t",
+           "\t ",
+           "\t_this.windowstate.switchState (WindowState.State.PREVIEW); ",
+           "\t// this triggers loadItems..",
+           "\t_this.windowstate.left_tree.model.loadFile(",
+           "\t\t_this.windowstate.file);",
+           "\t ",
+           "",
+           "\t",
+           " ",
+           "",
+           "\t// load it everywhere",
+           "}",
+           ""
+          ]
+         },
+         "string icon_name" : "edit-redo",
+         "xtype" : "Button"
         }
        ],
        "xtype" : "Box"
        "items" : [
         {
          "$ xns" : "Gtk",
-         "* prop" : "child",
          "bool has_tooltip" : true,
          "bool hexpand" : true,
          "id" : "filesearch",
            "listeners" : {
             "clicked" : [
              "  ( ) => {",
+             "  \t_this.splitview.el.show_sidebar = false;",
              "  \t_this.windowstate.showPopoverFiles(this.el, _this.project, false);",
              "}"
             ]
         "\t",
         "\t_this.treeview.el.set_model(_this.treeselmodel.el);",
         "\t",
-        " \t _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;",
+        " \t_this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;",
         "\t",
         " ",
         "}"
index 94d0a0a..fce2b1f 100644 (file)
@@ -212,14 +212,14 @@ public class Xcls_MainWindow : Object
                        this.show_close_button = true;
 
                        // set gobject values
-                       var child_1 = new Xcls_Box3( _this );
+                       var child_1 = new Xcls_Box2( _this );
                        child_1.ref();
                        this.el.pack_start ( child_1.el  );
                }
 
                // user defined functions
        }
-       public class Xcls_Box3 : Object
+       public class Xcls_Box2 : Object
        {
                public Gtk.Box el;
                private Xcls_MainWindow  _this;
@@ -228,7 +228,7 @@ public class Xcls_MainWindow : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Box3(Xcls_MainWindow _owner )
+               public Xcls_Box2(Xcls_MainWindow _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
@@ -236,14 +236,20 @@ public class Xcls_MainWindow : Object
                        // my vars (dec)
 
                        // set gobject values
-                       var child_1 = new Xcls_Button4( _this );
+                       var child_1 = new Xcls_Button3( _this );
                        child_1.ref();
                        this.el.append ( child_1.el  );
+                       var child_2 = new Xcls_Button5( _this );
+                       child_2.ref();
+                       this.el.append( child_2.el );
+                       var child_3 = new Xcls_Button6( _this );
+                       child_3.ref();
+                       this.el.append( child_3.el );
                }
 
                // user defined functions
        }
-       public class Xcls_Button4 : Object
+       public class Xcls_Button3 : Object
        {
                public Gtk.Button el;
                private Xcls_MainWindow  _this;
@@ -252,7 +258,7 @@ public class Xcls_MainWindow : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Button4(Xcls_MainWindow _owner )
+               public Xcls_Button3(Xcls_MainWindow _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Button();
@@ -263,7 +269,7 @@ public class Xcls_MainWindow : Object
                        this.el.has_frame = false;
                        this.el.tooltip_text = "Manage Windows (Ctrl-O)";
                        this.el.has_tooltip = true;
-                       var child_1 = new Xcls_ButtonContent5( _this );
+                       var child_1 = new Xcls_ButtonContent4( _this );
                        this.el.child = child_1.el;
 
                        //listeners
@@ -277,7 +283,7 @@ public class Xcls_MainWindow : Object
 
                // user defined functions
        }
-       public class Xcls_ButtonContent5 : Object
+       public class Xcls_ButtonContent4 : Object
        {
                public Adw.ButtonContent el;
                private Xcls_MainWindow  _this;
@@ -286,7 +292,7 @@ public class Xcls_MainWindow : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_ButtonContent5(Xcls_MainWindow _owner )
+               public Xcls_ButtonContent4(Xcls_MainWindow _owner )
                {
                        _this = _owner;
                        this.el = new Adw.ButtonContent();
@@ -302,6 +308,102 @@ public class Xcls_MainWindow : Object
        }
 
 
+       public class Xcls_Button5 : Object
+       {
+               public Gtk.Button el;
+               private Xcls_MainWindow  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_Button5(Xcls_MainWindow _owner )
+               {
+                       _this = _owner;
+                       this.el = new Gtk.Button();
+
+                       // my vars (dec)
+
+                       // set gobject values
+                       this.el.icon_name = "edit-undo";
+                       this.el.has_frame = false;
+
+                       //listeners
+                       this.el.clicked.connect( ( ) => {
+                               
+                               GLib.debug("undo clicked");
+                               if (_this.windowstate.file.xtype == "PlainFile") {
+                                       _this.windowstate.code_editor_tab.buffer.el.undo();
+                               }
+                               if (!_this.windowstate.file.undoStep(-1)) {
+                                       return;
+                               }
+                               
+                                
+                               _this.windowstate.switchState (WindowState.State.PREVIEW); 
+                               // this triggers loadItems..
+                               _this.windowstate.left_tree.model.loadFile(
+                                       _this.windowstate.file);
+                                
+                       
+                               
+                        
+                       
+                               // load it everywhere
+                       });
+               }
+
+               // user defined functions
+       }
+
+       public class Xcls_Button6 : Object
+       {
+               public Gtk.Button el;
+               private Xcls_MainWindow  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_Button6(Xcls_MainWindow _owner )
+               {
+                       _this = _owner;
+                       this.el = new Gtk.Button();
+
+                       // my vars (dec)
+
+                       // set gobject values
+                       this.el.icon_name = "edit-redo";
+                       this.el.has_frame = false;
+
+                       //listeners
+                       this.el.clicked.connect( ( ) => {
+                               
+                               GLib.debug("undo clicked");
+                               if (_this.windowstate.file.xtype == "PlainFile") {
+                                       _this.windowstate.code_editor_tab.buffer.el.redo();
+                               }
+                               if (!_this.windowstate.file.undoStep(1)) {
+                                       return;
+                               }
+                               
+                                
+                               _this.windowstate.switchState (WindowState.State.PREVIEW); 
+                               // this triggers loadItems..
+                               _this.windowstate.left_tree.model.loadFile(
+                                       _this.windowstate.file);
+                                
+                       
+                               
+                        
+                       
+                               // load it everywhere
+                       });
+               }
+
+               // user defined functions
+       }
+
 
 
        public class Xcls_splitview : Object
@@ -358,7 +460,7 @@ public class Xcls_MainWindow : Object
                        this.el.vexpand = false;
                        new Xcls_mainpane( _this );
                        this.el.append( _this.mainpane.el );
-                       var child_2 = new Xcls_Box16( _this );
+                       var child_2 = new Xcls_Box17( _this );
                        child_2.ref();
                        this.el.append( child_2.el );
                }
@@ -390,7 +492,7 @@ public class Xcls_MainWindow : Object
                        this.el.position = 400;
                        new Xcls_leftpane( _this );
                        this.el.start_child = _this.leftpane.el;
-                       var child_2 = new Xcls_Box13( _this );
+                       var child_2 = new Xcls_Box14( _this );
                        this.el.end_child = child_2.el;
 
                        //listeners
@@ -516,7 +618,7 @@ public class Xcls_MainWindow : Object
 
 
 
-       public class Xcls_Box13 : Object
+       public class Xcls_Box14 : Object
        {
                public Gtk.Box el;
                private Xcls_MainWindow  _this;
@@ -525,7 +627,7 @@ public class Xcls_MainWindow : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Box13(Xcls_MainWindow _owner )
+               public Xcls_Box14(Xcls_MainWindow _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
@@ -595,7 +697,7 @@ public class Xcls_MainWindow : Object
 
 
 
-       public class Xcls_Box16 : Object
+       public class Xcls_Box17 : Object
        {
                public Gtk.Box el;
                private Xcls_MainWindow  _this;
@@ -604,7 +706,7 @@ public class Xcls_MainWindow : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Box16(Xcls_MainWindow _owner )
+               public Xcls_Box17(Xcls_MainWindow _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
@@ -614,21 +716,21 @@ public class Xcls_MainWindow : Object
                        // set gobject values
                        this.el.homogeneous = false;
                        this.el.vexpand = false;
-                       var child_1 = new Xcls_Button17( _this );
+                       var child_1 = new Xcls_Button18( _this );
                        child_1.ref();
                        this.el.append( child_1.el );
-                       var child_2 = new Xcls_Button18( _this );
+                       var child_2 = new Xcls_Button19( _this );
                        child_2.ref();
                        this.el.append( child_2.el );
-                       var child_3 = new Xcls_MenuButton19( _this );
+                       var child_3 = new Xcls_MenuButton20( _this );
                        child_3.ref();
                        this.el.append( child_3.el );
-                       var child_4 = new Xcls_Label24( _this );
+                       var child_4 = new Xcls_Label25( _this );
                        child_4.ref();
                        this.el.append( child_4.el );
                        new Xcls_statusbar( _this );
                        this.el.append( _this.statusbar.el );
-                       var child_6 = new Xcls_Box26( _this );
+                       var child_6 = new Xcls_Box27( _this );
                        child_6.ref();
                        this.el.append( child_6.el );
                        new Xcls_statusbar_compile_spinner( _this );
@@ -639,7 +741,7 @@ public class Xcls_MainWindow : Object
 
                // user defined functions
        }
-       public class Xcls_Button17 : Object
+       public class Xcls_Button18 : Object
        {
                public Gtk.Button el;
                private Xcls_MainWindow  _this;
@@ -649,7 +751,7 @@ public class Xcls_MainWindow : Object
                public bool always_show_image;
 
                // ctor
-               public Xcls_Button17(Xcls_MainWindow _owner )
+               public Xcls_Button18(Xcls_MainWindow _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Button();
@@ -674,7 +776,7 @@ public class Xcls_MainWindow : Object
                // user defined functions
        }
 
-       public class Xcls_Button18 : Object
+       public class Xcls_Button19 : Object
        {
                public Gtk.Button el;
                private Xcls_MainWindow  _this;
@@ -684,7 +786,7 @@ public class Xcls_MainWindow : Object
                public bool always_show_image;
 
                // ctor
-               public Xcls_Button18(Xcls_MainWindow _owner )
+               public Xcls_Button19(Xcls_MainWindow _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Button();
@@ -717,7 +819,7 @@ public class Xcls_MainWindow : Object
                // user defined functions
        }
 
-       public class Xcls_MenuButton19 : Object
+       public class Xcls_MenuButton20 : Object
        {
                public Gtk.MenuButton el;
                private Xcls_MainWindow  _this;
@@ -727,7 +829,7 @@ public class Xcls_MainWindow : Object
                public bool always_show_image;
 
                // ctor
-               public Xcls_MenuButton19(Xcls_MainWindow _owner )
+               public Xcls_MenuButton20(Xcls_MainWindow _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.MenuButton();
@@ -762,7 +864,7 @@ public class Xcls_MainWindow : Object
                        // my vars (dec)
 
                        // set gobject values
-                       var child_1 = new Xcls_Box21( _this );
+                       var child_1 = new Xcls_Box22( _this );
                        child_1.ref();
                        this.el.set_child ( child_1.el  );
 
@@ -775,7 +877,7 @@ public class Xcls_MainWindow : Object
 
                // user defined functions
        }
-       public class Xcls_Box21 : Object
+       public class Xcls_Box22 : Object
        {
                public Gtk.Box el;
                private Xcls_MainWindow  _this;
@@ -784,7 +886,7 @@ public class Xcls_MainWindow : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Box21(Xcls_MainWindow _owner )
+               public Xcls_Box22(Xcls_MainWindow _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
@@ -792,17 +894,17 @@ public class Xcls_MainWindow : Object
                        // my vars (dec)
 
                        // set gobject values
-                       var child_1 = new Xcls_Button22( _this );
+                       var child_1 = new Xcls_Button23( _this );
                        child_1.ref();
                        this.el.append( child_1.el );
-                       var child_2 = new Xcls_Button23( _this );
+                       var child_2 = new Xcls_Button24( _this );
                        child_2.ref();
                        this.el.append( child_2.el );
                }
 
                // user defined functions
        }
-       public class Xcls_Button22 : Object
+       public class Xcls_Button23 : Object
        {
                public Gtk.Button el;
                private Xcls_MainWindow  _this;
@@ -811,7 +913,7 @@ public class Xcls_MainWindow : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Button22(Xcls_MainWindow _owner )
+               public Xcls_Button23(Xcls_MainWindow _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Button();
@@ -830,7 +932,7 @@ public class Xcls_MainWindow : Object
                // user defined functions
        }
 
-       public class Xcls_Button23 : Object
+       public class Xcls_Button24 : Object
        {
                public Gtk.Button el;
                private Xcls_MainWindow  _this;
@@ -839,7 +941,7 @@ public class Xcls_MainWindow : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Button23(Xcls_MainWindow _owner )
+               public Xcls_Button24(Xcls_MainWindow _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Button();
@@ -861,7 +963,7 @@ public class Xcls_MainWindow : Object
 
 
 
-       public class Xcls_Label24 : Object
+       public class Xcls_Label25 : Object
        {
                public Gtk.Label el;
                private Xcls_MainWindow  _this;
@@ -870,7 +972,7 @@ public class Xcls_MainWindow : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Label24(Xcls_MainWindow _owner )
+               public Xcls_Label25(Xcls_MainWindow _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Label( "   " );
@@ -928,7 +1030,7 @@ public class Xcls_MainWindow : Object
                // user defined functions
        }
 
-       public class Xcls_Box26 : Object
+       public class Xcls_Box27 : Object
        {
                public Gtk.Box el;
                private Xcls_MainWindow  _this;
@@ -937,7 +1039,7 @@ public class Xcls_MainWindow : Object
                        // my vars (def)
 
                // ctor
-               public Xcls_Box26(Xcls_MainWindow _owner )
+               public Xcls_Box27(Xcls_MainWindow _owner )
                {
                        _this = _owner;
                        this.el = new Gtk.Box( Gtk.Orientation.HORIZONTAL, 0 );
@@ -1335,9 +1437,8 @@ public class Xcls_MainWindow : Object
                        // my vars (dec)
 
                        // set gobject values
-                       var child_1 = new Xcls_SearchBar35( _this );
-                       child_1.ref();
-                       this.el.append( child_1.el );
+                       new Xcls_filesearch( _this );
+                       this.el.append( _this.filesearch.el );
                        var child_2 = new Xcls_Box38( _this );
                        child_2.ref();
                        this.el.append( child_2.el );
@@ -1366,36 +1467,11 @@ public class Xcls_MainWindow : Object
                        
                        _this.treeview.el.set_model(_this.treeselmodel.el);
                        
-                        _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
+                       _this.treeselmodel.el.selected = Gtk.INVALID_LIST_POSITION;
                        
                 
                }
        }
-       public class Xcls_SearchBar35 : Object
-       {
-               public Gtk.SearchBar el;
-               private Xcls_MainWindow  _this;
-
-
-                       // my vars (def)
-
-               // ctor
-               public Xcls_SearchBar35(Xcls_MainWindow _owner )
-               {
-                       _this = _owner;
-                       this.el = new Gtk.SearchBar();
-
-                       // my vars (dec)
-
-                       // set gobject values
-                       this.el.hexpand = true;
-                       this.el.search_mode_enabled = true;
-                       new Xcls_filesearch( _this );
-                       this.el.child = _this.filesearch.el;
-               }
-
-               // user defined functions
-       }
        public class Xcls_filesearch : Object
        {
                public Gtk.SearchEntry el;
@@ -1514,7 +1590,6 @@ public class Xcls_MainWindow : Object
        }
 
 
-
        public class Xcls_Box38 : Object
        {
                public Gtk.Box el;
@@ -1566,6 +1641,7 @@ public class Xcls_MainWindow : Object
 
                        //listeners
                        this.el.clicked.connect( ( ) => {
+                               _this.splitview.el.show_sidebar = false;
                                _this.windowstate.showPopoverFiles(this.el, _this.project, false);
                        });
                }
index 5e4aeb3..5ec52a2 100644 (file)
     "( GLib.ListStore? ls) {",
     "\tGLib.debug(\"errors  : update\");",
     "    if (ls == null || ls.get_n_items() < 1) {",
-    " \t    GLib.debug(\"errors  : none available\");",
+    " \t//    GLib.debug(\"errors  : none available\");",
     "    \treturn;",
     "\t}",
     "\t",
-    "\tGLib.debug(\"Loading list into tree\");",
+    "\t//GLib.debug(\"Loading list into tree\");",
     "\tthis.tree.el.hide();",
     "\tvar tm = new Gtk.TreeListModel(",
     "\t\tls, //..... << that's our store..",
index baac166..2a9f1d5 100644 (file)
-    static Xcls_ValaCompileErrors  _ValaCompileErrors;
-
-    public class Xcls_ValaCompileErrors : Object
-    {
-        public Gtk.Popover el;
-        private Xcls_ValaCompileErrors  _this;
-
-        public static Xcls_ValaCompileErrors singleton()
-        {
-            if (_ValaCompileErrors == null) {
-                _ValaCompileErrors= new Xcls_ValaCompileErrors();
-            }
-            return _ValaCompileErrors;
-        }
-        public Xcls_compile_view compile_view;
-        public Xcls_tree tree;
-        public Xcls_selmodel selmodel;
-        public Xcls_sortmodel sortmodel;
-        public Xcls_model model;
-
-            // my vars (def)
-        public Xcls_MainWindow window;
-        public bool loaded;
-
-        // ctor
-        public Xcls_ValaCompileErrors()
-        {
-            _this = this;
-            this.el = new Gtk.Popover();
-
-            // my vars (dec)
-            this.loaded = false;
-
-            // set gobject values
-            this.el.width_request = 900;
-            this.el.height_request = 800;
-            this.el.autohide = true;
-            this.el.position = Gtk.PositionType.TOP;
-            new Xcls_compile_view( _this );
-            this.el.set_child ( _this.compile_view.el  );
-        }
-
-        // user defined functions
-        public void updateNotices ( GLib.ListStore? ls) {
-               GLib.debug("errors  : update");
-            if (ls == null || ls.get_n_items() < 1) {
-                   GLib.debug("errors  : none available");
-               return;
-               }
-               
-               GLib.debug("Loading list into tree");
-               this.tree.el.hide();
-               var tm = new Gtk.TreeListModel(
-                       ls, //..... << that's our store..
-                       false, // passthru
-                       false, // autexpand
-                       (item) => {
-                       
-                                return ((Palete.CompileError)item).lines;
-                       
-                       }
-                       
-               );
-         
-               _this.model.el = tm;
-               _this.sortmodel.el.set_model(tm);
-                this.tree.el.show();
-        }
-        public void show (   ) {
-               GLib.debug("errors  : show");
-               
-               if (_this.model.el.get_n_items()  < 1) {
-           
-                   GLib.debug("errors  : none available");
-               return;
-               }
-               //this.el.present();
-            //this.el.popup();
-            
-             //print("looking for %s\n", id);
-            // loop through parent childnre
-              
-            
-             ; //<< very important!!!
-              
-           // store.set_sort_column_id(0,Gtk.SortType.ASCENDING);
-         
-            var win = this.window.el;
-            var  w = win.get_width();
-            var h = win.get_height();
-        
-           
-            // left tree = 250, editor area = 500?
-            
-            // min 450?
-            var new_w = int.min(650, w-100);
-            if (new_w > (w-100)) {
-                new_w = w-100;
-            }
-            GLib.debug("set size");
-            this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
-         
-        
-           // this.el.set_relative_to(onbtn);
-               //Gtk.Allocation rect;
-               //onbtn.get_allocation(out rect);
-            //this.el.set_pointing_to(rect);
-               //this.el.present();
-               
-               GLib.debug("call popup");
-            this.el.popup();
-            // only need to load once.
-               //if (!this.loaded) {
-                        
-                       //this.loaded = true;
-                //}
-                
-               
-           
-               //if (expand != null) {
-            // _this.compile_tree.el.expand_row(   store.get_path(expand) , true);
-        //     }
-            
-         //   this.hpane.el.set_position( 0);
-        }
-        public class Xcls_compile_view : Object
-        {
-            public Gtk.Box el;
-            private Xcls_ValaCompileErrors  _this;
-
-
-                // my vars (def)
-
-            // ctor
-            public Xcls_compile_view(Xcls_ValaCompileErrors _owner )
-            {
-                _this = _owner;
-                _this.compile_view = this;
-                this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
-
-                // my vars (dec)
-
-                // set gobject values
-                this.el.homogeneous = false;
-                this.el.hexpand = false;
-                var child_1 = new Xcls_ScrolledWindow3( _this );
-                child_1.ref();
-                this.el.append( child_1.el );
-            }
-
-            // user defined functions
-        }
-        public class Xcls_ScrolledWindow3 : Object
-        {
-            public Gtk.ScrolledWindow el;
-            private Xcls_ValaCompileErrors  _this;
-
-
-                // my vars (def)
-
-            // ctor
-            public Xcls_ScrolledWindow3(Xcls_ValaCompileErrors _owner )
-            {
-                _this = _owner;
-                this.el = new Gtk.ScrolledWindow();
-
-                // my vars (dec)
-
-                // set gobject values
-                new Xcls_tree( _this );
-                this.el.set_child ( _this.tree.el  );
-
-                // init method
-
-                {
-                 this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
-                 
-                
-                }
-            }
-
-            // user defined functions
-        }
-        public class Xcls_tree : Object
-        {
-            public Gtk.ColumnView el;
-            private Xcls_ValaCompileErrors  _this;
-
-
-                // my vars (def)
-
-            // ctor
-            public Xcls_tree(Xcls_ValaCompileErrors _owner )
-            {
-                _this = _owner;
-                _this.tree = this;
-                new Xcls_selmodel( _this );
-                this.el = new Gtk.ColumnView( _this.selmodel.el );
-
-                // my vars (dec)
-
-                // set gobject values
-                this.el.hexpand = true;
-                this.el.vexpand = true;
-                var child_2 = new Xcls_ColumnViewColumn11( _this );
-                child_2.ref();
-                this.el.append_column ( child_2.el  );
-                var child_3 = new Xcls_GestureClick13( _this );
-                child_3.ref();
-                this.el.add_controller(  child_3.el );
-            }
-
-            // user defined functions
-        }
-        public class Xcls_selmodel : Object
-        {
-            public Gtk.SingleSelection el;
-            private Xcls_ValaCompileErrors  _this;
-
-
-                // my vars (def)
-
-            // ctor
-            public Xcls_selmodel(Xcls_ValaCompileErrors _owner )
-            {
-                _this = _owner;
-                _this.selmodel = this;
-                new Xcls_sortmodel( _this );
-                this.el = new Gtk.SingleSelection( _this.sortmodel.el );
-
-                // my vars (dec)
-
-                // set gobject values
-            }
-
-            // user defined functions
-            public Json.Object getNodeAt (uint row) {
-            
-               var tr = (Gtk.TreeListRow)this.el.get_item(row);
-               
-               var a = tr.get_item();;   
-               GLib.debug("get_item (2) = %s", a.get_type().name());
-                
-               return (Json.Object)tr.get_item();
-                
-            }
-        }
-        public class Xcls_sortmodel : Object
-        {
-            public Gtk.SortListModel el;
-            private Xcls_ValaCompileErrors  _this;
-
-
-                // my vars (def)
-
-            // ctor
-            public Xcls_sortmodel(Xcls_ValaCompileErrors _owner )
-            {
-                _this = _owner;
-                _this.sortmodel = this;
-                new Xcls_model( _this );
-                var child_2 = new Xcls_TreeListRowSorter8( _this );
-                child_2.ref();
-                this.el = new Gtk.SortListModel( _this.model.el, child_2.el );
-
-                // my vars (dec)
-
-                // set gobject values
-            }
-
-            // user defined functions
-            public Json.Object getNodeAt (uint row) {
-            
-               var tr = (Gtk.TreeListRow)this.el.get_item(row);
-               
-              
-              // GLib.debug("get_item (2) = %s", a.get_type().name());
-               
-               
-               return (Json.Object)tr.get_item();
-                
-            }
-        }
-        public class Xcls_model : Object
-        {
-            public Gtk.TreeListModel el;
-            private Xcls_ValaCompileErrors  _this;
-
-
-                // my vars (def)
-
-            // ctor
-            public Xcls_model(Xcls_ValaCompileErrors _owner )
-            {
-                _this = _owner;
-                _this.model = this;
-                this.el = new Gtk.TreeListModel(
+static Xcls_ValaCompileErrors  _ValaCompileErrors;
+
+public class Xcls_ValaCompileErrors : Object
+{
+       public Gtk.Popover el;
+       private Xcls_ValaCompileErrors  _this;
+
+       public static Xcls_ValaCompileErrors singleton()
+       {
+               if (_ValaCompileErrors == null) {
+                   _ValaCompileErrors= new Xcls_ValaCompileErrors();
+               }
+               return _ValaCompileErrors;
+       }
+       public Xcls_compile_view compile_view;
+       public Xcls_tree tree;
+       public Xcls_selmodel selmodel;
+       public Xcls_sortmodel sortmodel;
+       public Xcls_model model;
+
+               // my vars (def)
+       public Xcls_MainWindow window;
+       public bool loaded;
+
+       // ctor
+       public Xcls_ValaCompileErrors()
+       {
+               _this = this;
+               this.el = new Gtk.Popover();
+
+               // my vars (dec)
+               this.loaded = false;
+
+               // set gobject values
+               this.el.width_request = 900;
+               this.el.height_request = 800;
+               this.el.autohide = true;
+               this.el.position = Gtk.PositionType.TOP;
+               new Xcls_compile_view( _this );
+               this.el.set_child ( _this.compile_view.el  );
+       }
+
+       // user defined functions
+       public void updateNotices ( GLib.ListStore? ls) {
+               GLib.debug("errors  : update");
+           if (ls == null || ls.get_n_items() < 1) {
+               //    GLib.debug("errors  : none available");
+               return;
+               }
+               
+               //GLib.debug("Loading list into tree");
+               this.tree.el.hide();
+               var tm = new Gtk.TreeListModel(
+                       ls, //..... << that's our store..
+                       false, // passthru
+                       false, // autexpand
+                       (item) => {
+                       
+                                return ((Palete.CompileError)item).lines;
+                       
+                       }
+                       
+               );
+        
+               _this.model.el = tm;
+               _this.sortmodel.el.set_model(tm);
+                this.tree.el.show();
+       }
+       public void show (   ) {
+               GLib.debug("errors  : show");
+               
+               if (_this.model.el.get_n_items()  < 1) {
+          
+                   GLib.debug("errors  : none available");
+               return;
+               }
+               //this.el.present();
+           //this.el.popup();
+           
+            //print("looking for %s\n", id);
+           // loop through parent childnre
+             
+           
+            ; //<< very important!!!
+             
+          // store.set_sort_column_id(0,Gtk.SortType.ASCENDING);
+        
+           var win = this.window.el;
+           var  w = win.get_width();
+           var h = win.get_height();
+       
+          
+           // left tree = 250, editor area = 500?
+           
+           // min 450?
+           var new_w = int.min(650, w-100);
+           if (new_w > (w-100)) {
+               new_w = w-100;
+           }
+           GLib.debug("set size");
+           this.el.set_size_request( int.max(100, new_w), int.max(100, h-120));
+        
+       
+          // this.el.set_relative_to(onbtn);
+               //Gtk.Allocation rect;
+               //onbtn.get_allocation(out rect);
+           //this.el.set_pointing_to(rect);
+               //this.el.present();
+               
+               GLib.debug("call popup");
+           this.el.popup();
+           // only need to load once.
+               //if (!this.loaded) {
+                        
+                       //this.loaded = true;
+                //}
+                
+              
+          
+               //if (expand != null) {
+           //  _this.compile_tree.el.expand_row(   store.get_path(expand) , true);
+       //      }
+           
+        //   this.hpane.el.set_position( 0);
+       }
+       public class Xcls_compile_view : Object
+       {
+               public Gtk.Box el;
+               private Xcls_ValaCompileErrors  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_compile_view(Xcls_ValaCompileErrors _owner )
+               {
+                       _this = _owner;
+                       _this.compile_view = this;
+                       this.el = new Gtk.Box( Gtk.Orientation.VERTICAL, 0 );
+
+                       // my vars (dec)
+
+                       // set gobject values
+                       this.el.homogeneous = false;
+                       this.el.hexpand = false;
+                       var child_1 = new Xcls_ScrolledWindow3( _this );
+                       child_1.ref();
+                       this.el.append( child_1.el );
+               }
+
+               // user defined functions
+       }
+       public class Xcls_ScrolledWindow3 : Object
+       {
+               public Gtk.ScrolledWindow el;
+               private Xcls_ValaCompileErrors  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_ScrolledWindow3(Xcls_ValaCompileErrors _owner )
+               {
+                       _this = _owner;
+                       this.el = new Gtk.ScrolledWindow();
+
+                       // my vars (dec)
+
+                       // set gobject values
+                       new Xcls_tree( _this );
+                       this.el.set_child ( _this.tree.el  );
+
+                       // init method
+
+                       {
+                        this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+                        
+                       
+                       }
+               }
+
+               // user defined functions
+       }
+       public class Xcls_tree : Object
+       {
+               public Gtk.ColumnView el;
+               private Xcls_ValaCompileErrors  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_tree(Xcls_ValaCompileErrors _owner )
+               {
+                       _this = _owner;
+                       _this.tree = this;
+                       new Xcls_selmodel( _this );
+                       this.el = new Gtk.ColumnView( _this.selmodel.el );
+
+                       // my vars (dec)
+
+                       // set gobject values
+                       this.el.hexpand = true;
+                       this.el.vexpand = true;
+                       var child_2 = new Xcls_ColumnViewColumn11( _this );
+                       child_2.ref();
+                       this.el.append_column ( child_2.el  );
+                       var child_3 = new Xcls_GestureClick13( _this );
+                       child_3.ref();
+                       this.el.add_controller(  child_3.el );
+               }
+
+               // user defined functions
+       }
+       public class Xcls_selmodel : Object
+       {
+               public Gtk.SingleSelection el;
+               private Xcls_ValaCompileErrors  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_selmodel(Xcls_ValaCompileErrors _owner )
+               {
+                       _this = _owner;
+                       _this.selmodel = this;
+                       new Xcls_sortmodel( _this );
+                       this.el = new Gtk.SingleSelection( _this.sortmodel.el );
+
+                       // my vars (dec)
+
+                       // set gobject values
+               }
+
+               // user defined functions
+               public Json.Object getNodeAt (uint row) {
+               
+                  var tr = (Gtk.TreeListRow)this.el.get_item(row);
+                  
+                  var a = tr.get_item();;   
+                  GLib.debug("get_item (2) = %s", a.get_type().name());
+                   
+                  return (Json.Object)tr.get_item();
+                        
+               }
+       }
+       public class Xcls_sortmodel : Object
+       {
+               public Gtk.SortListModel el;
+               private Xcls_ValaCompileErrors  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_sortmodel(Xcls_ValaCompileErrors _owner )
+               {
+                       _this = _owner;
+                       _this.sortmodel = this;
+                       new Xcls_model( _this );
+                       var child_2 = new Xcls_TreeListRowSorter8( _this );
+                       child_2.ref();
+                       this.el = new Gtk.SortListModel( _this.model.el, child_2.el );
+
+                       // my vars (dec)
+
+                       // set gobject values
+               }
+
+               // user defined functions
+               public Json.Object getNodeAt (uint row) {
+               
+                  var tr = (Gtk.TreeListRow)this.el.get_item(row);
+                  
+                 
+                 // GLib.debug("get_item (2) = %s", a.get_type().name());
+                       
+                  
+                  return (Json.Object)tr.get_item();
+                        
+               }
+       }
+       public class Xcls_model : Object
+       {
+               public Gtk.TreeListModel el;
+               private Xcls_ValaCompileErrors  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_model(Xcls_ValaCompileErrors _owner )
+               {
+                       _this = _owner;
+                       _this.model = this;
+                       this.el = new Gtk.TreeListModel(
     new GLib.ListStore(typeof(Palete.CompileError)), //..... << that's our store..
     false, // passthru
     false, // autexpand
     
 );
 
-                // my vars (dec)
+                       // my vars (dec)
 
-                // set gobject values
-            }
+                       // set gobject values
+               }
 
-            // user defined functions
-        }
+               // user defined functions
+       }
 
-        public class Xcls_TreeListRowSorter8 : Object
-        {
-            public Gtk.TreeListRowSorter el;
-            private Xcls_ValaCompileErrors  _this;
+       public class Xcls_TreeListRowSorter8 : Object
+       {
+               public Gtk.TreeListRowSorter el;
+               private Xcls_ValaCompileErrors  _this;
 
 
-                // my vars (def)
+                       // my vars (def)
 
-            // ctor
-            public Xcls_TreeListRowSorter8(Xcls_ValaCompileErrors _owner )
-            {
-                _this = _owner;
-                var child_1 = new Xcls_StringSorter9( _this );
-                child_1.ref();
-                this.el = new Gtk.TreeListRowSorter( child_1.el );
+               // ctor
+               public Xcls_TreeListRowSorter8(Xcls_ValaCompileErrors _owner )
+               {
+                       _this = _owner;
+                       var child_1 = new Xcls_StringSorter9( _this );
+                       child_1.ref();
+                       this.el = new Gtk.TreeListRowSorter( child_1.el );
 
-                // my vars (dec)
+                       // my vars (dec)
 
-                // set gobject values
-            }
+                       // set gobject values
+               }
 
-            // user defined functions
-        }
-        public class Xcls_StringSorter9 : Object
-        {
-            public Gtk.StringSorter el;
-            private Xcls_ValaCompileErrors  _this;
+               // user defined functions
+       }
+       public class Xcls_StringSorter9 : Object
+       {
+               public Gtk.StringSorter el;
+               private Xcls_ValaCompileErrors  _this;
 
 
-                // my vars (def)
+                       // my vars (def)
 
-            // ctor
-            public Xcls_StringSorter9(Xcls_ValaCompileErrors _owner )
-            {
-                _this = _owner;
-                var child_1 = new Xcls_PropertyExpression10( _this );
-                child_1.ref();
-                this.el = new Gtk.StringSorter( child_1.el );
+               // ctor
+               public Xcls_StringSorter9(Xcls_ValaCompileErrors _owner )
+               {
+                       _this = _owner;
+                       var child_1 = new Xcls_PropertyExpression10( _this );
+                       child_1.ref();
+                       this.el = new Gtk.StringSorter( child_1.el );
 
-                // my vars (dec)
+                       // my vars (dec)
 
-                // set gobject values
-            }
+                       // set gobject values
+               }
 
-            // user defined functions
-        }
-        public class Xcls_PropertyExpression10 : Object
-        {
-            public Gtk.PropertyExpression el;
-            private Xcls_ValaCompileErrors  _this;
-
-
-                // my vars (def)
-
-            // ctor
-            public Xcls_PropertyExpression10(Xcls_ValaCompileErrors _owner )
-            {
-                _this = _owner;
-                this.el = new Gtk.PropertyExpression( typeof(Palete.CompileError), null, "linemsg" );
-
-                // my vars (dec)
-
-                // set gobject values
-            }
-
-            // user defined functions
-        }
-
-
-
-
-
-        public class Xcls_ColumnViewColumn11 : Object
-        {
-            public Gtk.ColumnViewColumn el;
-            private Xcls_ValaCompileErrors  _this;
-
-
-                // my vars (def)
-
-            // ctor
-            public Xcls_ColumnViewColumn11(Xcls_ValaCompileErrors _owner )
-            {
-                _this = _owner;
-                var child_1 = new Xcls_SignalListItemFactory12( _this );
-                child_1.ref();
-                this.el = new Gtk.ColumnViewColumn( "Compile Result", child_1.el );
-
-                // my vars (dec)
-
-                // set gobject values
-                this.el.expand = true;
-                this.el.resizable = true;
-            }
-
-            // user defined functions
-        }
-        public class Xcls_SignalListItemFactory12 : Object
-        {
-            public Gtk.SignalListItemFactory el;
-            private Xcls_ValaCompileErrors  _this;
-
-
-                // my vars (def)
-
-            // ctor
-            public Xcls_SignalListItemFactory12(Xcls_ValaCompileErrors _owner )
-            {
-                _this = _owner;
-                this.el = new Gtk.SignalListItemFactory();
-
-                // my vars (dec)
-
-                // set gobject values
-
-                //listeners
-                this.el.setup.connect( (listitem) => {
-                       
-                       var expand = new Gtk.TreeExpander();
-                        
-                       expand.set_indent_for_depth(true);
-                       expand.set_indent_for_icon(true);
-                        
-                       var lbl = new Gtk.Label("");
-                       lbl.use_markup = true;
-                       
-                       
-                       lbl.justify = Gtk.Justification.LEFT;
-                       lbl.xalign = 0;
-                
-                 
-                       expand.set_child(lbl);
-                       ((Gtk.ListItem)listitem).set_child(expand);
-                       ((Gtk.ListItem)listitem).activatable = false;
-                });
-                this.el.bind.connect( (listitem) => {
-                        //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
-                       
-                       
-                       
-                       //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
-                       var expand = (Gtk.TreeExpander)  ((Gtk.ListItem)listitem).get_child();
-                         
-                 
-                       var lbl = (Gtk.Label) expand.child;
-                       
-                        if (lbl.label != "") { // do not update
-                               return;
-                       }
-                       
-                
-                       var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
-                       var np = (Palete.CompileError) lr.get_item();
-                       
-                       
-                       //GLib.debug("change  %s to %s", lbl.label, np.name);
-                       lbl.label = np.linemsg;
-                       //lbl.tooltip_markup = np.to_property_option_tooltip();
-                        
-                    expand.set_hide_expander(  np.lines.n_items < 1);
-                       expand.set_list_row(lr);
-                 
-                       // expand current file.
-                       // this causes problems? - critical errors?
-                       // maybe do it on show
-                       //if (_this.window.windowstate.file.path == np.file.path &&
-                       //      np.line < 0) {
-                       //      lr.expanded = true;
-                       
-                       //}
-                        
-                       // bind image...
-                       
-                });
-            }
-
-            // user defined functions
-        }
-
-
-        public class Xcls_GestureClick13 : Object
-        {
-            public Gtk.GestureClick el;
-            private Xcls_ValaCompileErrors  _this;
-
-
-                // my vars (def)
-
-            // ctor
-            public Xcls_GestureClick13(Xcls_ValaCompileErrors _owner )
-            {
-                _this = _owner;
-                this.el = new Gtk.GestureClick();
-
-                // my vars (dec)
-
-                // set gobject values
-                this.el.button = 0;
-
-                //listeners
-                this.el.pressed.connect( (n_press, x, y) => {
-                       
-                       if (n_press < 2) { /// doubleclick?
-                               return;
-                       }
-                 
-                       
-                       
-                       // use selection?!
-                       var tr = (Gtk.TreeListRow)_this.selmodel.el.selected_item;
-                       //GLib.debug("SELECTED = %s", tr.item.get_type().name());
-                       var ce = (Palete.CompileError) tr.item;
-                
-                       if (ce.line < 0) {
-                               // did not click on a line.
-                               return;
-                       }
-                        
-                        
-                    var fname  = ce.file;
-                       var line = ce.line;  
-                    GLib.debug("open %s @ %d\n", ce.file.path, ce.line);
-                    
-                    
-                   var  bjsf = "";
-                    try {             
-                       var  regex = new Regex("\\.vala$");
-                    
-                     
-                        bjsf = regex.replace(fname.path,fname.path.length , 0 , ".bjs");
-                     } catch (GLib.RegexError e) {
-                        return;
-                    }   
-                    var p = _this.window.project;
-                        
-                        
-                        
-                    var jsr = p.getByPath(bjsf);
-                    if (jsr != null) {
-                        _this.window.windowstate.fileViewOpen(jsr, true, line);
-                        
-                        if (jsr.path == _this.window.windowstate.file.path) {
-                        
-                       }
-                       _this.el.hide();
-                        
-                        return;
-                    
-                    }
-                  
-                       var pf = p.getByPath(fname.path);
-                       _this.el.hide();
-                       _this.window.windowstate.fileViewOpen(pf, true, line);
-                
-                    
-                });
-            }
-
-            // user defined functions
-        }
-
-
-
-
-    }
+               // user defined functions
+       }
+       public class Xcls_PropertyExpression10 : Object
+       {
+               public Gtk.PropertyExpression el;
+               private Xcls_ValaCompileErrors  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_PropertyExpression10(Xcls_ValaCompileErrors _owner )
+               {
+                       _this = _owner;
+                       this.el = new Gtk.PropertyExpression( typeof(Palete.CompileError), null, "linemsg" );
+
+                       // my vars (dec)
+
+                       // set gobject values
+               }
+
+               // user defined functions
+       }
+
+
+
+
+
+       public class Xcls_ColumnViewColumn11 : Object
+       {
+               public Gtk.ColumnViewColumn el;
+               private Xcls_ValaCompileErrors  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_ColumnViewColumn11(Xcls_ValaCompileErrors _owner )
+               {
+                       _this = _owner;
+                       var child_1 = new Xcls_SignalListItemFactory12( _this );
+                       child_1.ref();
+                       this.el = new Gtk.ColumnViewColumn( "Compile Result", child_1.el );
+
+                       // my vars (dec)
+
+                       // set gobject values
+                       this.el.expand = true;
+                       this.el.resizable = true;
+               }
+
+               // user defined functions
+       }
+       public class Xcls_SignalListItemFactory12 : Object
+       {
+               public Gtk.SignalListItemFactory el;
+               private Xcls_ValaCompileErrors  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_SignalListItemFactory12(Xcls_ValaCompileErrors _owner )
+               {
+                       _this = _owner;
+                       this.el = new Gtk.SignalListItemFactory();
+
+                       // my vars (dec)
+
+                       // set gobject values
+
+                       //listeners
+                       this.el.setup.connect( (listitem) => {
+                               
+                               var expand = new Gtk.TreeExpander();
+                                
+                               expand.set_indent_for_depth(true);
+                               expand.set_indent_for_icon(true);
+                                
+                               var lbl = new Gtk.Label("");
+                               lbl.use_markup = true;
+                               
+                               
+                               lbl.justify = Gtk.Justification.LEFT;
+                               lbl.xalign = 0;
+                       
+                        
+                               expand.set_child(lbl);
+                               ((Gtk.ListItem)listitem).set_child(expand);
+                               ((Gtk.ListItem)listitem).activatable = false;
+                       });
+                       this.el.bind.connect( (listitem) => {
+                                //GLib.debug("listitme is is %s", ((Gtk.ListItem)listitem).get_type().name());
+                               
+                               
+                               
+                               //var expand = (Gtk.TreeExpander) ((Gtk.ListItem)listitem).get_child();
+                               var expand = (Gtk.TreeExpander)  ((Gtk.ListItem)listitem).get_child();
+                                 
+                        
+                               var lbl = (Gtk.Label) expand.child;
+                               
+                                if (lbl.label != "") { // do not update
+                                       return;
+                               }
+                               
+                       
+                               var lr = (Gtk.TreeListRow)((Gtk.ListItem)listitem).get_item();
+                               var np = (Palete.CompileError) lr.get_item();
+                               
+                               
+                               //GLib.debug("change  %s to %s", lbl.label, np.name);
+                               lbl.label = np.linemsg;
+                               //lbl.tooltip_markup = np.to_property_option_tooltip();
+                                
+                           expand.set_hide_expander(  np.lines.n_items < 1);
+                               expand.set_list_row(lr);
+                        
+                               // expand current file.
+                               // this causes problems? - critical errors?
+                               // maybe do it on show
+                               //if (_this.window.windowstate.file.path == np.file.path &&
+                               //      np.line < 0) {
+                               //      lr.expanded = true;
+                               
+                               //}
+                                
+                               // bind image...
+                               
+                       });
+               }
+
+               // user defined functions
+       }
+
+
+       public class Xcls_GestureClick13 : Object
+       {
+               public Gtk.GestureClick el;
+               private Xcls_ValaCompileErrors  _this;
+
+
+                       // my vars (def)
+
+               // ctor
+               public Xcls_GestureClick13(Xcls_ValaCompileErrors _owner )
+               {
+                       _this = _owner;
+                       this.el = new Gtk.GestureClick();
+
+                       // my vars (dec)
+
+                       // set gobject values
+                       this.el.button = 0;
+
+                       //listeners
+                       this.el.pressed.connect( (n_press, x, y) => {
+                               
+                               if (n_press < 2) { /// doubleclick?
+                                       return;
+                               }
+                        
+                               
+                               
+                               // use selection?!
+                               var tr = (Gtk.TreeListRow)_this.selmodel.el.selected_item;
+                               //GLib.debug("SELECTED = %s", tr.item.get_type().name());
+                               var ce = (Palete.CompileError) tr.item;
+                       
+                               if (ce.line < 0) {
+                                       // did not click on a line.
+                                       return;
+                               }
+                                
+                                
+                           var fname  = ce.file;
+                               var line = ce.line;  
+                           GLib.debug("open %s @ %d\n", ce.file.path, ce.line);
+                           
+                           
+                          var  bjsf = "";
+                           try {             
+                              var  regex = new Regex("\\.vala$");
+                           
+                            
+                               bjsf = regex.replace(fname.path,fname.path.length , 0 , ".bjs");
+                            } catch (GLib.RegexError e) {
+                               return;
+                           }   
+                           var p = _this.window.project;
+                               
+                               
+                               
+                           var jsr = p.getByPath(bjsf);
+                           if (jsr != null) {
+                               _this.window.windowstate.fileViewOpen(jsr, true, line);
+                               
+                               if (jsr.path == _this.window.windowstate.file.path) {
+                               
+                               }
+                               _this.el.hide();
+                               
+                               return;
+                           
+                           }
+                         
+                               var pf = p.getByPath(fname.path);
+                               _this.el.hide();
+                               _this.window.windowstate.fileViewOpen(pf, true, line);
+                       
+                           
+                       });
+               }
+
+               // user defined functions
+       }
+
+
+
+
+}
index 6e91f28..5cf405d 100644 (file)
     "\t\t ",
     "\t\t\t",
     "\t\t\treading_header = false;",
-    "\t\t\t ",
+    "\t\t\tcontinue;",
     "\t    }",
     "\t    ",
     "\t  \tif (child.has_css_class(\"node-err\")) {",
    "| void updateErrors" : [
     "() {",
     "\tvar file = this.file;",
+    "\tif (file == null) {",
+    "\t\treturn;",
+    "\t}",
     "\tvar ar = file.getErrors();",
-    "\tif (ar.size < 1) {",
+    "\tif (ar == null || ar.size < 1) {",
     "\t\tif (this.last_error_counter != file.error_counter) {",
     "\t\t\tthis.removeErrors();",
     "\t\t}",
index 8cf971b..1941dcd 100644 (file)
@@ -88,8 +88,11 @@ public class Xcls_LeftProps : Object
        }
        public void updateErrors () {
                var file = this.file;
+               if (file == null) {
+                       return;
+               }
                var ar = file.getErrors();
-               if (ar.size < 1) {
+               if (ar == null || ar.size < 1) {
                        if (this.last_error_counter != file.error_counter) {
                                this.removeErrors();
                        }
@@ -261,7 +264,7 @@ public class Xcls_LeftProps : Object
                         
                                
                                reading_header = false;
-                                
+                               continue;
                    }
                    
                        if (child.has_css_class("node-err")) {
index f2ea2be..641f61d 100644 (file)
            "\t\t",
            "\t\t var m = (GLib.ListStore) _this.model.el.model;",
            "     \t_this.main_window.windowstate.file.tree = dropNode;  ",
-           "    ",
+           "    \tdropNode.updated_count++;",
            "   ",
            "\t\tm.append(dropNode);",
            "\t\t_this.model.selectNode(dropNode); \t",
            "\t\t \t\t_this.view.dragNode.remove();",
            "\t \t\t}",
            "\t \t\t\t",
-           "\t \t\t",
+           "\t \t\tdropNode.updated_count++;",
            " \t\t\t_this.model.selectNode(dropNode); ",
            " \t\t\t",
            " \t\t\t_this.changed();\t\t\t\t \t\t",
            "\t\t \t\t_this.model.selectNode(null); \t \t\t",
            "\t\t \t\t_this.view.dragNode.remove();",
            "\t \t\t}",
-           "\t",
+           "\t\t\tdropNode.updated_count++;",
            " \t\t\t_this.model.selectNode(dropNode); \t\t\t",
            " \t\t\t_this.changed();",
            " \t\t\treturn true;",
            "\t",
            " \t\t\t",
            " \t\t\tnode.parent.insertAfter(dropNode, node);",
+           " \t\t\tdropNode.updated_count++;",
            " \t\t\t_this.model.selectNode(dropNode);\t",
            " \t\t\t_this.changed();",
            " \t\t\t// select it",
             "\tfor (var i = 0; i < s.n_items; i++) {",
             "\t\t//GLib.debug(\"check node %s\", s.get_item(i).get_type().name());",
             "\t\tvar lr = s.get_item(i) as Gtk.TreeListRow;",
-            "\t\tGLib.debug(\"check node %s\", lr.get_item().get_type().name());",
+            "\t\t//GLib.debug(\"check node %s\", lr.get_item().get_type().name());",
             "\t\tif ((lr.get_item() as JsRender.Node).oid == node.oid) {",
             "\t\t\treturn i;",
             "\t\t\t",
         "    \tvar reading_header = true;",
         "\t ",
         "    \twhile (child != null) {",
-        "\t\t\tGLib.debug(\"Got %s\", child.get_type().name());",
+        "\t\t\t//GLib.debug(\"Got %s\", child.get_type().name());",
         "    \t   ",
         "    \t   if (reading_header) {",
         "\t\t\t\t",
        ],
        "| int getColAt" : [
         "(double x,  double y) {",
-        "/*",
-        "    \t",
-        "from    \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
-        "    \t  ",
-        "    \t*/",
-        "\t\t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
-        "\t\t//GLib.debug(\"Cehck %d, %d\", x,y);",
-        "        var  child = this.el.get_first_child(); ",
-        "    \t ",
-        "    \tvar col = 0;",
-        "    \tvar offx = 0;",
-        "    \twhile (child != null) {",
-        "\t\t\t",
-        "\t\t\tif (child.get_type().name() == \"GtkColumnViewRowWidget\") {",
-        "\t\t\t\tchild = child.get_first_child();",
-        "\t\t\t\tcontinue;",
-        "\t\t\t}",
+        "\t/*",
         "\t\t\t",
-        "\t\t\t//child.get_allocation(out alloc);",
-        "\t\t\tif (x <  (child.get_width() + offx)) {",
-        "\t\t\t\treturn col;",
-        "\t\t\t}",
-        "\t\t\treturn 1;",
-        "\t\t\t//offx += child.get_width();",
-        "\t\t\t//col++;",
-        "\t\t\t//child = child.get_next_sibling();",
+        "\tfrom    \thttps://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465",
+        "    \t  ",
+        "\t*/",
+        "\t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
+        "\t//GLib.debug(\"Cehck %d, %d\", x,y);",
+        "    var  child = this.el.get_first_child(); ",
+        "\t ",
+        "\tvar col = 0;",
+        "\tvar offx = 0;",
+        "\twhile (child != null) {",
+        "\t\t",
+        "\t\tif (child.get_type().name() == \"GtkColumnViewRowWidget\") {",
+        "\t\t\tchild = child.get_first_child();",
+        "\t\t\tcontinue;",
         "\t\t}",
-        "    \t     ",
-        "\t\t\t  ",
-        "        return -1;",
+        "\t\t",
+        "\t\t//child.get_allocation(out alloc);",
+        "\t\tif (x <  (child.get_width() + offx)) {",
+        "\t\t\treturn col;",
+        "\t\t}",
+        "\t\treturn 1;",
+        "\t\t//offx += child.get_width();",
+        "\t\t//col++;",
+        "\t\t//child = child.get_next_sibling();",
+        "\t}",
+        "\t     ",
+        "\t\t  ",
+        "    return -1;",
         "",
         " }"
        ],
         "    \t*/",
         " \t\t ",
         " \t\t",
-        " \t\t//GLib.debug(\"offset = %d  y = %d\", (int) voff, (int) in_y);",
+        " \t\tGLib.debug(\"get Widget At Row x = %d  y = %d\", (int) x, (int) in_y);",
         "    \tvar y = in_y + _this.viewwin.el.vadjustment.value; ",
         "        var  child = this.el.get_first_child(); ",
         "    \t//Gtk.Allocation alloc = { 0, 0, 0, 0 };",
     "\t\t ",
     "\t\t\t",
     "\t\t\treading_header = false;",
-    "\t\t\t ",
+    "\t\t\t continue;",
     "\t    }",
     "\t    ",
     "\t  \tif (child.has_css_class(\"node-err\")) {",
    "| void updateErrors" : [
     "() {",
     "\tvar file = this.getActiveFile();",
+    "\tif (file == null) {",
+    "\t\treturn;",
+    "\t}",
+    "\t",
     "\tvar ar = file.getErrors();",
-    "\t\tif (ar.size < 1) {",
+    "\tif (ar == null || ar.size < 1) {",
     "\t\tif (this.last_error_counter != file.error_counter) {",
     "\t\t\tthis.removeErrors();",
     "\t\t}",
index 04c747e..e486653 100644 (file)
@@ -51,8 +51,12 @@ public class Xcls_WindowLeftTree : Object
        // user defined functions
        public void updateErrors () {
                var file = this.getActiveFile();
+               if (file == null) {
+                       return;
+               }
+               
                var ar = file.getErrors();
-                       if (ar.size < 1) {
+               if (ar == null || ar.size < 1) {
                        if (this.last_error_counter != file.error_counter) {
                                this.removeErrors();
                        }
@@ -128,7 +132,7 @@ public class Xcls_WindowLeftTree : Object
                         
                                
                                reading_header = false;
-                                
+                                continue;
                    }
                    
                        if (child.has_css_class("node-err")) {
@@ -368,7 +372,7 @@ public class Xcls_WindowLeftTree : Object
                        var reading_header = true;
                         
                        while (child != null) {
-                                       GLib.debug("Got %s", child.get_type().name());
+                                       //GLib.debug("Got %s", child.get_type().name());
                           
                           if (reading_header) {
                                                
@@ -401,36 +405,36 @@ public class Xcls_WindowLeftTree : Object
                
                 }
                public int getColAt (double x,  double y) {
-               /*
-                       
-               from            https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
-                         
-                       */
-                               //Gtk.Allocation alloc = { 0, 0, 0, 0 };
-                               //GLib.debug("Cehck %d, %d", x,y);
-                       var  child = this.el.get_first_child(); 
-                        
-                       var col = 0;
-                       var offx = 0;
-                       while (child != null) {
+                       /*
                                        
-                                       if (child.get_type().name() == "GtkColumnViewRowWidget") {
-                                               child = child.get_first_child();
-                                               continue;
-                                       }
-                                       
-                                       //child.get_allocation(out alloc);
-                                       if (x <  (child.get_width() + offx)) {
-                                               return col;
-                                       }
-                                       return 1;
-                                       //offx += child.get_width();
-                                       //col++;
-                                       //child = child.get_next_sibling();
+                       from            https://discourse.gnome.org/t/gtk4-finding-a-row-data-on-gtkcolumnview/8465
+                         
+                       */
+                       //Gtk.Allocation alloc = { 0, 0, 0, 0 };
+                       //GLib.debug("Cehck %d, %d", x,y);
+                   var  child = this.el.get_first_child(); 
+                        
+                       var col = 0;
+                       var offx = 0;
+                       while (child != null) {
+                               
+                               if (child.get_type().name() == "GtkColumnViewRowWidget") {
+                                       child = child.get_first_child();
+                                       continue;
                                }
-                            
-                                         
-                       return -1;
+                               
+                               //child.get_allocation(out alloc);
+                               if (x <  (child.get_width() + offx)) {
+                                       return col;
+                               }
+                               return 1;
+                               //offx += child.get_width();
+                               //col++;
+                               //child = child.get_next_sibling();
+                       }
+                            
+                                 
+                   return -1;
                
                 }
                public int getRowAt (double x,  double in_y, out string pos) {
@@ -450,7 +454,7 @@ public class Xcls_WindowLeftTree : Object
                        */
                                 
                                
-                               //GLib.debug("offset = %d  y = %d", (int) voff, (int) in_y);
+                               GLib.debug("get Widget At Row x = %d  y = %d", (int) x, (int) in_y);
                        var y = in_y + _this.viewwin.el.vadjustment.value; 
                        var  child = this.el.get_first_child(); 
                        //Gtk.Allocation alloc = { 0, 0, 0, 0 };
@@ -1291,7 +1295,7 @@ public class Xcls_WindowLeftTree : Object
                                        
                                         var m = (GLib.ListStore) _this.model.el.model;
                                _this.main_window.windowstate.file.tree = dropNode;  
-                           
+                               dropNode.updated_count++;
                           
                                        m.append(dropNode);
                                        _this.model.selectNode(dropNode);       
@@ -1351,7 +1355,7 @@ public class Xcls_WindowLeftTree : Object
                                                        _this.view.dragNode.remove();
                                                }
                                                        
-                                               
+                                               dropNode.updated_count++;
                                                _this.model.selectNode(dropNode); 
                                                
                                                _this.changed();                                                
@@ -1365,7 +1369,7 @@ public class Xcls_WindowLeftTree : Object
                                                        _this.model.selectNode(null);                   
                                                        _this.view.dragNode.remove();
                                                }
-                               
+                                               dropNode.updated_count++;
                                                _this.model.selectNode(dropNode);                       
                                                _this.changed();
                                                return true;
@@ -1379,6 +1383,7 @@ public class Xcls_WindowLeftTree : Object
                                
                                                
                                                node.parent.insertAfter(dropNode, node);
+                                               dropNode.updated_count++;
                                                _this.model.selectNode(dropNode);       
                                                _this.changed();
                                                // select it
@@ -1591,7 +1596,7 @@ public class Xcls_WindowLeftTree : Object
                        for (var i = 0; i < s.n_items; i++) {
                                //GLib.debug("check node %s", s.get_item(i).get_type().name());
                                var lr = s.get_item(i) as Gtk.TreeListRow;
-                               GLib.debug("check node %s", lr.get_item().get_type().name());
+                               //GLib.debug("check node %s", lr.get_item().get_type().name());
                                if ((lr.get_item() as JsRender.Node).oid == node.oid) {
                                        return i;
                                        
index 10100d7..6c9452d 100644 (file)
     "\t\tbuf.remove_tag_by_name (\"ERR\", start, end);",
     "\t\tbuf.remove_tag_by_name (\"WARN\", start, end);",
     "\t\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
-    "\t\tbuf.remove_source_marks (start, end, null);",
+    "\t\tbuf.remove_source_marks (start, end, \"ERR\");",
+    "\t\tbuf.remove_source_marks (start, end, \"WARN\");",
+    "\t\tbuf.remove_source_marks (start, end, \"DEPR\");",
     "\t\tthis.last_error_counter = file.error_counter ;",
     "\t\tGLib.debug(\"higjlight has no errors\");",
     "\t\treturn;",
     "\t",
     " ",
     "\t ",
-    "\tbuf.remove_source_marks (start, end, null);",
+    "\tbuf.remove_source_marks (start, end, \"ERR\");",
+    "\tbuf.remove_source_marks (start, end, \"WARN\");",
+    "\tbuf.remove_source_marks (start, end, \"DEPR\");",
     "\tbuf.remove_tag_by_name (\"ERR\", start, end);",
     "\tbuf.remove_tag_by_name (\"WARN\", start, end);",
     "\tbuf.remove_tag_by_name (\"DEPR\", start, end);",
index 7c4f1df..2f018c8 100644 (file)
@@ -274,7 +274,9 @@ public class Xcls_WindowRooView : Object
                        buf.remove_tag_by_name ("ERR", start, end);
                        buf.remove_tag_by_name ("WARN", start, end);
                        buf.remove_tag_by_name ("DEPR", start, end);
-                       buf.remove_source_marks (start, end, null);
+                       buf.remove_source_marks (start, end, "ERR");
+                       buf.remove_source_marks (start, end, "WARN");
+                       buf.remove_source_marks (start, end, "DEPR");
                        this.last_error_counter = file.error_counter ;
                        GLib.debug("higjlight has no errors");
                        return;
@@ -287,7 +289,9 @@ public class Xcls_WindowRooView : Object
                
         
                 
-               buf.remove_source_marks (start, end, null);
+               buf.remove_source_marks (start, end, "ERR");
+               buf.remove_source_marks (start, end, "WARN");
+               buf.remove_source_marks (start, end, "DEPR");
                buf.remove_tag_by_name ("ERR", start, end);
                buf.remove_tag_by_name ("WARN", start, end);
                buf.remove_tag_by_name ("DEPR", start, end);
index 02005d5..4c41e7c 100644 (file)
@@ -28,11 +28,10 @@ public class WindowState : Object
        public Xcls_RooProjectSettings roo_projectsettings_pop;
        public ValaProjectSettingsPopover  vala_projectsettings_pop; 
        public Xcls_PopoverAddObject     rightpalete;
-       //public Xcls_PopoverEditor               code_editor_popover;
-       public Editor                                    code_editor_tab; 
-       public Xcls_WindowRooView   window_rooview;
-       public Xcls_GtkView         window_gladeview;
-       public DialogFiles popover_files;
+       public Editor                                   code_editor_tab; 
+       public Xcls_WindowRooView               window_rooview;
+       public Xcls_GtkView                             window_gladeview;
+       public DialogFiles                              popover_files;
        
        //public Xcls_ClutterFiles     clutterfiles;
        //public Xcls_WindowLeftProjects left_projects; // can not see where this is initialized.. 
@@ -394,6 +393,7 @@ public class WindowState : Object
                        }
                        //this.left_tree.model.updateSelected();
                        this.file.save();
+
                         
                });
         
index 4301fb7..fad040f 100644 (file)
@@ -131,16 +131,17 @@ namespace JsRender {
                        ) {
                                var ar = obj.get_array_member("items");
                                var tree_base = ar.get_object_element(0);
-                               this.tree = new Node();
-                               this.tree.loadFromJson(tree_base, int.parse(bjs_version_str));
-
+                               this.loadTree(tree_base,  int.parse(bjs_version_str));
                        }
                        this.gen_extended ? 
                                NodeToValaExtended.mungeFile(this) :
                                NodeToValaWrapped.mungeFile(this); // force line numbering..?? should we call toSourceCode???
                        this.loaded = true;
+                       this.updateUndo();
                
                }
+               
+               
             
            
        
@@ -163,7 +164,11 @@ namespace JsRender {
                    this.last_source =          this.gen_extended ? 
                                NodeToValaExtended.mungeFile(this) :
                                NodeToValaWrapped.mungeFile(this);
+                               
                    this.last_source_version = this.version;
+                   
+                   
+                   
                    return this.last_source;
                    
            }
@@ -177,12 +182,14 @@ namespace JsRender {
                
            }
        
-           public override void save() {
+           public override void save() 
+           {
                this.saveBJS();
                // this.saveJS(); - disabled at present.. project settings will probably enable this later..
        
                this.saveVala();
 
+                       
                this.getLanguageServer().document_save.begin(this, (obj, res) => {
                        this.getLanguageServer().document_save.end(res);
                });
index ee22927..593d8ff 100644 (file)
@@ -85,11 +85,14 @@ namespace JsRender {
                                return ++this._version; // increased on every call? - bit of a kludge until we do real versioning
                        }
                        private set {
+                               
                                this._version = value;
+                               this.updateUndo();
                        }
                        
                }
 
+
                public string permname;
                public string language;
                public string content_type;
@@ -116,13 +119,16 @@ namespace JsRender {
                
                public Gee.HashMap<string,string> transStrings; // map of md5 -> string.
                public  Gee.HashMap<string,string> namedStrings;
+               
+               public Gee.HashMap<int,string> undo_json;
+               
                //public        Gee.HashMap<string, GLib.ListStore> errorsByType;
                private Gee.ArrayList<Lsp.Diagnostic> errors;
                public int error_counter {
                        get; private set; default = 0;
                }
 
-               public signal void changed (Node? node, string source); 
+               //public signal void changed (Node? node, string source);  (not used?)
                
                 
                public signal void compile_notice(string type, string file, int line, string message);
@@ -147,6 +153,7 @@ namespace JsRender {
                        }
                }
                
+               
                /**
                 * UI componenets
                 * 
@@ -195,7 +202,7 @@ namespace JsRender {
                        this.childfiles = new GLib.ListStore(typeof(JsRender));
                        //this.errorsByType  = new Gee.HashMap<string, GLib.ListStore>();
                        this.errors = new Gee.ArrayList<Lsp.Diagnostic>((a,b) => { return a.equals(b); }); 
-                       
+                       this.undo_json = new Gee.HashMap<int,string>();
 
 
                }
@@ -440,13 +447,48 @@ namespace JsRender {
                        print("Save failed");
                    }
                }
-                
-                
-
-
-                
-                
-                
+               
+               bool in_undo = false;
+               protected void updateUndo()
+               {
+                       if (this.in_undo) {
+                               return;
+                       }
+                       if (this.xtype == "PlainFile") {
+                               // handled by gtk sourceview buffer...
+                               return;
+                       }
+                       //GLib.debug("UNDO store %d", this.version);
+                       this.undo_json.set(this.version, this.tree.toJsonString());
+                       if (this.undo_json.has_key(this.version+1)) {
+                               var n = this.version +1;
+                               while (this.undo_json.has_key(n)) {
+                                       this.undo_json.unset(n++);
+                               }
+                       
+                       }
+                       
+               }
+               
+               public bool undoStep(int step = -1) // undo back/next
+               {
+                       if (!this.undo_json.has_key(this.version + step)) {
+                               //GLib.debug("UNDO step %d failed - no version available", this.version + step);
+                               return false;
+                       }
+                       var new_version = this.version + step;
+                       var pa = new Json.Parser();
+                       //GLib.debug("UNDO RESTORE : %d",  this.version + step);
+                       
+                       pa.load_from_data(this.undo_json.get(new_version));
+                       var node = pa.get_root();
+                       this.in_undo = true;
+                       this.loadTree(node.get_object(),2); 
+                       this.tree.updated_count = new_version;
+                       this.in_undo = false;
+                       return true;
+               }
                  
                public string jsonHasOrEmpty(Json.Object obj, string key) {
                        return obj.has_member(key) ? 
@@ -812,9 +854,24 @@ namespace JsRender {
                        return ret;
                        
                
+               } 
+               
+               public void loadTree(Json.Object obj, int bjs_version = 2)
+               {
+                       if (this.xtype == "PlainFile" ){
+                               return;
+                       }
+                       Node.uid_count = 0;
+                       this.tree = new Node();
+                       this.tree.loadFromJson(obj,bjs_version);
+                       this.tree.version_changed.connect(() => {
+                               this.updateUndo();
+                       });
+               
                }
                
                
+               
                public abstract string language_id();
                public abstract void save();
                public abstract void saveHTML(string html);
@@ -827,7 +884,10 @@ namespace JsRender {
                public abstract string toGlade();
                public abstract string targetName();
                public abstract void loadItems() throws GLib.Error;
+
        } 
+       
+        
 
 }
  
index 229021d..2db715f 100644 (file)
@@ -123,13 +123,24 @@ public class JsRender.Node : GLib.Object {
                        this.nodeTitleProp = ""; // ?? should trigger set?
                        this.iconFilename = "";
                        this._updated_count = value;
+                               
+                       //GLib.debug("Update Node %d p%d - rev %d", this.oid, this.parent != null ? this.parent.oid : -1, value);
                        if (this.parent != null) {
                                this.parent.updated_count++;
+                       }  else {
+                               //GLib.debug("UNDO top node is %d", value);
+                               this.version_changed();
                        }
                }
  
        } // changes to this trigger updates on the tree..
-
+       
+       public string as_source = "";
+       public int as_source_version = -1;
+       
+       public signal void  version_changed();
+       
        public Node()
        {
                this.items = new Gee.ArrayList<Node>();
@@ -442,7 +453,7 @@ public class JsRender.Node : GLib.Object {
                if ( this.parent.childstore.find(this, out pos)) {
                        this.parent.childstore.remove(pos);
                } 
-               
+               this.parent.updated_count++;
                this.parent.items = nlist;
                this.parent = null;
 
index eae9235..a96ad8e 100644 (file)
@@ -89,7 +89,12 @@ public class JsRender.NodeToJs : Object {
        public string munge ( )
        {
                //return this.mungeToString(this.node);
-
+               if (this.node.as_source_version > 0 && 
+                       this.node.as_source_version == this.node.updated_count
+                       && this.node.as_source != ""
+               ) {
+                       return this.node.as_source;
+               }
                
                this.checkChildren();
                this.readProps();
@@ -108,7 +113,11 @@ public class JsRender.NodeToJs : Object {
                //}
 
                this.mungeOut();
+               
+               this.node.as_source_version = this.node.updated_count;
+               this.node.as_source == this.ret;
                return this.ret;
+
                 
        } 
                /**
index 0dcad4b..f0df3e7 100644 (file)
@@ -41,6 +41,13 @@ public class  JsRender.NodeToValaExtended : NodeToVala {
        public override string munge ( )
        {
                //return this.mungeToString(this.node);
+               
+               if (this.node.as_source_version > 0 && 
+                       this.node.as_source_version == this.node.updated_count
+                       && this.node.as_source != ""
+               ) {
+                       return this.node.as_source;
+               }
                this.child_count = 1;
         
                
@@ -68,6 +75,8 @@ public class  JsRender.NodeToValaExtended : NodeToVala {
                this.iterChildren(); // add children class definitions.
                this.namespaceFooter();
                
+               this.node.as_source_version = this.node.updated_count;
+               this.node.as_source == this.ret;
                return this.ret;
                 
                         
index 5ddf32f..a641c69 100644 (file)
@@ -27,8 +27,7 @@
 public class JsRender.NodeToValaWrapped : NodeToVala {
 
 
-       
-
+        
        public NodeToValaWrapped( JsRender file,  Node node,  int depth, NodeToVala? parent) 
        {
                base (file, node, depth, parent);
@@ -56,7 +55,12 @@ public class JsRender.NodeToValaWrapped : NodeToVala {
        public override string munge ( )
        {
                //return this.mungeToString(this.node);
-               
+               if (this.node.as_source_version > 0 && 
+                       this.node.as_source_version == this.node.updated_count
+                       && this.node.as_source != ""
+               ) {
+                       return this.node.as_source;
+               }
        
                
                this.namespaceHeader();
@@ -82,6 +86,9 @@ public class JsRender.NodeToValaWrapped : NodeToVala {
                this.iterChildren();
                this.namespaceFooter();
                
+               
+               this.node.as_source_version = this.node.updated_count;
+               this.node.as_source == this.ret;
                return this.ret;
                 
                         
index 235a046..b15c506 100644 (file)
@@ -41,9 +41,7 @@ namespace JsRender {
                        this.file = file;
                        this.node = node;
                        this.depth = depth;
-                       if (parent == null) {
-                               this.var_name_count = 0;
-                       }
+                        
                        this.top_level_items = new Gee.ArrayList<Node>();
                        this.cur_line = parent == null ? 0 : parent.cur_line;
                        this.top = parent == null ? this : parent.top;
@@ -62,7 +60,7 @@ namespace JsRender {
                        
                }
                
-               int var_name_count = 0; // was vcnt
+               //int var_name_count = 0; // was vcnt
 
                string toValaNS(Node item)
                {
@@ -93,7 +91,7 @@ namespace JsRender {
                
                public void  toValaName(Node item, int depth =0) 
                {
-                       this.var_name_count++;
 
                        var ns =  this.toValaNS(item) ;
                        var cls = ns + item.get("xtype");
@@ -101,7 +99,7 @@ namespace JsRender {
                        item.xvala_cls = cls;
                        
                        string id = item.get("id").length > 0 ?
-                               item.get("id") :  "%s%d".printf(item.get("xtype"), this.var_name_count);
+                               item.get("id") :  "%s%d".printf(item.get("xtype"), item.oid);
 
                        
                        
index d13b916..6bc7166 100644 (file)
@@ -83,7 +83,10 @@ namespace Lsp {
                  (character > other.character ? 1 :
                   (character == other.character ? 0 : -1)) : -1);
         }
-
+        public bool equals(Position o) {
+               return o.line == this.line && o.character == this.character;
+       }
+               
         public string to_string () {
             return @"$line:$character";
         }
@@ -148,7 +151,7 @@ namespace Lsp {
 
         public bool equal_to (Range other) { return this.to_string () == other.to_string (); }
                public bool equals (Range o) {
-                       return this.filename == o.filename && this.start == o.start && this.end == o.end;
+                       return this.filename == o.filename && this.start.equals(o.start) && this.end.equals(o.end);
                }
 
         public int compare_to (Range other) {
@@ -229,7 +232,11 @@ namespace Lsp {
                
         }
         public bool equals(Lsp.Diagnostic o) {
-               return this.range.equals(o.range) && this.severity == o.severity && this.message == o.message;
+                       var ret = this.range.equals(o.range) && this.severity == o.severity && this.message == o.message;
+               //GLib.debug("compare %s  (%s == %s)", ret ? "YES" : "NO", this.to_string(), o.to_string()); 
+               
+               
+               return ret;
         }
         public string to_string()
         {
index b92035e..4c78905 100644 (file)
@@ -43,7 +43,7 @@ namespace Palete {
                {
                        // extend versions will proably call initialize to start and connect to server.
                        base(project);
-                       this.open_files = new   Gee.ArrayList<JsRender.JsRender>();
+
                        this.change_queue_id = GLib.Timeout.add_seconds(1, () => {
                                if (this.change_queue_file == null) {
                                        return true;
@@ -151,6 +151,9 @@ namespace Palete {
                                    out return_value
                                );
                                GLib.debug ("LS replied with %s", Json.to_string (Json.gvariant_serialize (return_value), true));
+                               this.open_files = new Gee.ArrayList<JsRender.JsRender>((a,b) => {
+                                       return a.path == b.path;
+                               });
                                this.initialized = true;
                                return;
                        } catch (GLib.Error e) {
@@ -201,9 +204,7 @@ namespace Palete {
                public async void restartServer()
                {
                        this.startServer();
-                       foreach(var f in this.open_files) {
-                               this.document_open(f);
-                       }
+                        
                }
        
                public bool isReady()
@@ -266,6 +267,7 @@ namespace Palete {
                                //this.project.updateErrorsforFile(null);
                                return;
                        }
+                       //GLib.debug("got Diagnostics for %s", f.path);
                        f.updateErrors( dg.diagnostics );
                         
                        
@@ -276,9 +278,11 @@ namespace Palete {
                        if (!this.isReady()) {
                                return;
                        }
-                       if (!this.open_files.contains(file)) {
-                               this.open_files.add(file);
+                       if (this.open_files.contains(file)) {
+                               return;
                        }
+                       this.open_files.add(file);
+                       
                        
                        GLib.debug ("LS sent open");                     
                        try {
@@ -395,9 +399,11 @@ namespace Palete {
                        if (!this.isReady()) {
                                return;
                        }
-                            
+                  if (!this.open_files.contains(file)) {
+                                this.document_open(file);
+                       }  
                        
-                       GLib.debug ("LS send change");
+                       GLib.debug ("LS send change %s rev %d", file.path, file.version);
                        var ar = new Json.Array();
                        var obj = new Json.Object();
                        obj.set_string_member("text", contents);