sync
[app.Builder.js] / src / Builder4 / WindowLeftTree.vala
index 9256fad..9e501e3 100644 (file)
@@ -20,7 +20,7 @@ public class Xcls_WindowLeftTree : Object
         // my vars (def)
     public signal bool before_node_change (JsRender.Node? node);
     public signal void changed ();
-    public signal void node_selected (JsRender.Node? node);
+    public signal void node_selected (JsRender.Node? node, string source);
     public Xcls_MainWindow main_window;
 
     // ctor
@@ -80,6 +80,7 @@ public class Xcls_WindowLeftTree : Object
         public string[] dropList;
         public int drag_x;
         public int drag_y;
+        public string lastEventSource;
         public bool drag_in_motion;
         public bool blockChanges;
 
@@ -91,9 +92,11 @@ public class Xcls_WindowLeftTree : Object
             this.el = new Gtk.TreeView();
 
             // my vars (dec)
+            this.lastEventSource = "";
             this.blockChanges = false;
 
             // set gobject values
+            this.el.expand = true;
             this.el.tooltip_column = 1;
             this.el.enable_tree_lines = true;
             this.el.headers_visible = false;
@@ -148,7 +151,9 @@ public class Xcls_WindowLeftTree : Object
             //listeners
             this.el.button_press_event.connect( ( ev) => {
                 //console.log("button press?");
+                this.lastEventSource = "tree";
                 if (! _this.before_node_change(null) ) {
+                
                    return true;
                 }
             
@@ -203,7 +208,7 @@ public class Xcls_WindowLeftTree : Object
             
                             print("selected rows < 1\n");
                             //??this.model.load( false);
-                            _this.node_selected(null);
+                            _this.node_selected(null, this.lastEventSource);
                             
                             return false ;
                         }
@@ -221,7 +226,7 @@ public class Xcls_WindowLeftTree : Object
                         _this.model.activePath = mod.get_path(iter).to_string();
                         
                         var node = (JsRender.Node)value.dup_object();
-                        _this.node_selected(node);
+                        _this.node_selected(node, this.lastEventSource);
                         while (Gtk.events_pending()) {
                             Gtk.main_iteration();
                        }
@@ -824,7 +829,13 @@ public class Xcls_WindowLeftTree : Object
                  }
                      
         }
-        public           void selectNode (string treepath_str) {
+        public void setCursor (string treepath, string sourceEvent)   {
+               this.lastEventSource = sourceEvent;
+            this.el.set_cursor(new Gtk.TreePath.from_string(treepath), null, false); 
+                   
+        }
+        public           void selectNode (string treepath_str, string source) {
+               this.lastEventSource = source;
             //this.selection.select_path(new  Gtk.TreePath.from_string( treepath_str));
              var tp = new Gtk.TreePath.from_string(treepath_str);
              
@@ -1567,7 +1578,7 @@ public class Xcls_WindowLeftTree : Object
                     _this.model.el.remove(ref citer);
                 }
                 _this.changed();
-                _this.node_selected(node);
+                _this.node_selected(node, "tree");
                  
                 
             });