Builder4/WindowLeftTree.bjs.SVQHMX
authorAlan Knowles <alan@roojs.com>
Wed, 17 Sep 2014 05:59:49 +0000 (13:59 +0800)
committerAlan Knowles <alan@roojs.com>
Wed, 17 Sep 2014 05:59:49 +0000 (13:59 +0800)
Builder4/WindowLeftTree.bjs
Builder4/WindowLeftTree.js.4X6HMX
Builder4/WindowLeftTree.js
Builder4/WindowLeftTree.vala.PL3HMX
Builder4/WindowLeftTree.vala

Builder4/WindowLeftTree.bjs
Builder4/WindowLeftTree.js
Builder4/WindowLeftTree.vala

index 77c6836..efe2f06 100644 (file)
@@ -8,8 +8,8 @@
     "items" : [
         {
             "|           JsRender.Node? getActiveElement" : " () { // return path to actie node.\n\n     var path = this.getActivePath();\n     if (path.length < 1) {\n        return null;\n     }\n     return _this.model.pathToNode(path);\n     \n}\n",
-            "@ bool before_node_change" : "(JsRender.Node? node)",
             "id" : "WindowLeftTree",
+            "@ bool before_node_change" : "(JsRender.Node? node)",
             "$ shadow_type" : "Gtk.ShadowType.IN",
             "* init" : " this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n",
             "|           JsRender.JsRender getActiveFile" : "() {\n    return this.model.file;\n}\n",
@@ -24,8 +24,8 @@
                 {
                     "listeners" : {
                         "button_press_event" : "  ( ev) => {\n    //console.log(\"button press?\");\n    if (! _this.before_node_change(null) ) {\n       return true;\n    }\n\n    \n    if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {\n        //print(\"click\" + ev.type);\n        return false;\n    }\n    Gtk.TreePath res;\n    if (!_this.view.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {\n        return true;\n    }\n     \n    this.el.get_selection().select_path(res);\n     \n      //if (!this.get('/LeftTreeMenu').el)  { \n      //      this.get('/LeftTreeMenu').init(); \n      //  }\n        \n     _this.LeftTreeMenu.el.set_screen(Gdk.Screen.get_default());\n     _this.LeftTreeMenu.el.show_all();\n      _this.LeftTreeMenu.el.popup(null, null, null,  3, ev.time);\n     //   print(\"click:\" + res.path.to_string());\n      return true;\n}",
-                        "cursor_changed" : " ( ) => {\n\n\n     if (this.blockChanges) { // probably not needed.. \n       return  ;\n     }\n      if (!_this.before_node_change(null) ) {\n\t     this.blockChanges = true;\n\t     this.el.get_selection().unselect_all();\n\t     this.blockChanges = false;\n\t     return;\n     }\n     if (_this.model.file == null) {\n         return;\n     } \n     \n     //var render = this.get('/LeftTree').getRenderer();                \n    print(\"LEFT TREE -> view -> selection changed called\\n\");\n    \n    \n    // -- it appears that the selection is not updated.\n    \n    GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n         \n\n            if (this.el.get_selection().count_selected_rows() < 1) {\n\n                print(\"selected rows < 1\\n\");\n                //??this.model.load( false);\n                _this.node_selected(null);\n                \n                return false ;\n            }\n                \n                //console.log('changed');\n            var s = this.el.get_selection();\n             Gtk.TreeIter iter;\n             Gtk.TreeModel mod;\n            s.get_selected(out mod, out iter);\n            \n            \n            // var val = \"\";\n            GLib.Value value;\n            _this.model.el.get_value(iter, 2, out value);\n            _this.model.activePath = mod.get_path(iter).to_string();\n            \n            var node = (JsRender.Node)value.dup_object();\n            _this.node_selected(node);\n            return false;\n      });  \n    //_this.after_node_change(node);\n\n//        _this.model.file.changed(node, \"tree\");\n   \n    //Seed.print( value.get_string());\n    return  ;\n                \n}",
                         "drag_begin" : "( ctx)  => {\n\t//print('SOURCE: drag-begin');\n        \n        \n        //this.targetData = \"\";\n        \n        // find what is selected in our tree...\n        \n        var s = _this.view.el.get_selection();\n        if (s.count_selected_rows() < 1) {\n            return;\n        }\n        Gtk.TreeIter iter;\n        Gtk.TreeModel mod;\n        s.get_selected(out mod, out iter);\n\n        \n\n        // set some properties of the tree for use by the dropped element.\n        GLib.Value value;\n        _this.model.el.get_value(iter, 2, out value);\n        var data = (JsRender.Node)(value.dup_object());\n        var xname = data.fqn();\n         print (\"XNAME  IS \" + xname+ \"\\n\");\n        this.dragData = xname;\n        this.dropList = _this.model.file.palete().getDropList(xname);\n        \n        print (\"DROP LIST IS \" + string.joinv(\", \", this.dropList) + \"\\n\");\n        \n\n        // make the drag icon a picture of the node that was selected\n        var path = _this.model.el.get_path(iter);\n\n        //this.treepath = path.to_string();\n        \n        var pix = this.el.create_row_drag_icon ( path);\n        \n        Gtk.drag_set_icon_surface (ctx, pix) ;\n        \n        return;\n}",
+                        "cursor_changed" : " ( ) => {\n\n\n     if (this.blockChanges) { // probably not needed.. \n       return  ;\n     }\n      if (!_this.before_node_change(null) ) {\n\t     this.blockChanges = true;\n\t     this.el.get_selection().unselect_all();\n\t     this.blockChanges = false;\n\t     return;\n     }\n     if (_this.model.file == null) {\n         return;\n     } \n     \n     //var render = this.get('/LeftTree').getRenderer();                \n    print(\"LEFT TREE -> view -> selection changed called\\n\");\n    \n    \n    // -- it appears that the selection is not updated.\n    \n    GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n         \n\n            if (this.el.get_selection().count_selected_rows() < 1) {\n\n                print(\"selected rows < 1\\n\");\n                //??this.model.load( false);\n                _this.node_selected(null);\n                \n                return false ;\n            }\n                \n                //console.log('changed');\n            var s = this.el.get_selection();\n             Gtk.TreeIter iter;\n             Gtk.TreeModel mod;\n            s.get_selected(out mod, out iter);\n            \n            \n            // var val = \"\";\n            GLib.Value value;\n            _this.model.el.get_value(iter, 2, out value);\n            _this.model.activePath = mod.get_path(iter).to_string();\n            \n            var node = (JsRender.Node)value.dup_object();\n            _this.node_selected(node);\n            return false;\n      });  \n    //_this.after_node_change(node);\n\n//        _this.model.file.changed(node, \"tree\");\n   \n    //Seed.print( value.get_string());\n    return  ;\n                \n}",
                         "drag_end" : "  (drag_context) => {\n\t//Seed.print('LEFT-TREE: drag-end');\n        this.dragData = \"\";\n        this.dropList = null;\n//        this.targetData = \"\";\n        this.highlightDropPath(\"\",0);\n//        return true;\n}",
                         "drag_motion" : " ( ctx, x, y, time)  => {\n \n    // the point of this is to detect where an item could be dropped..\n        print(\"got drag motion\");\n       this.drag_in_motion = true;\n       this.drag_x = x;\n       this.drag_y = y;\n       \n            // request data that will be recieved by the recieve...              \n        Gtk.drag_get_data\n        (\n                this.el,         // will receive 'drag-data-received' signal \n                ctx,        // represents the current state of the DnD \n                Gdk.Atom.intern(\"STRING\",true),    // the target type we want \n                time            // time stamp \n        );\n    return true;\n       \n}",
                         "drag_data_get" : " ( drag_context, data, info, time) => {\n\n\n     print(\"drag-data-get\");\n     var s = this.el.get_selection();\n     if (s.count_selected_rows() < 1) {\n            data.set_text(\"\",0);     \n             print(\"return empty string - no selection..\");\n            return;\n        }\n     \n     Gtk.TreeIter iter;\n     Gtk.TreeModel mod;\n     \n     s.get_selected(out mod, out iter);\n     \n    \n    var tp = mod.get_path(iter).to_string();\n    data.set_text(tp,tp.length);\n     print(\"return \" + tp);\n}",
@@ -33,8 +33,8 @@
                         "drag_drop" : " (  ctx, x, y, time)  => {\n      //Seed.print(\"TARGET: drag-drop\");\n       this.drag_in_motion = false;   \n        // request data that will be recieved by the recieve...              \n    Gtk.drag_get_data\n    (\n            this.el,         // will receive 'drag-data-received' signal \n            ctx,        // represents the current state of the DnD \n            Gdk.Atom.intern(\"STRING\",true),    // the target type we want \n            time            // time stamp \n    );\n\n     \n    // No target offered by source => error\n   \n\n    return  false;\n}"
                     },
                     "# string dragData" : "",
-                    "# string[] dropList" : "",
                     "# int drag_x" : "",
+                    "# string[] dropList" : "",
                     "id" : "view",
                     "gboolean headers_visible" : true,
                     "# int drag_y" : "",
@@ -52,8 +52,8 @@
                     "items" : [
                         {
                             "|           string findDropNode" : " (string treepath_str, string[] targets) {\n\n    // this is used by the dragdrop code in the roo version AFAIR..\n\n    //var path = treepath_str.replace(/^builder-/, '');\n    // treemap is depreciated... - should really check if model has any entries..\n\n    if (this.el.iter_n_children(null) < 1) {\n        //print(\"NO KEYS\");\n        return \"|%d\".printf((int)Gtk.TreeViewDropPosition.INTO_OR_AFTER);\n    }\n    //print(\"FIND treepath: \" + path);\n    //console.dump(this.treemap);\n    \n    //if (!treepath_str.match(/^builder-/)) {\n    //    return []; // nothing!\n    //}\n    if (targets.length > 0 && targets[0] == \"*\") {\n        return  treepath_str;\n    }\n    return this.findDropNodeByPath(treepath_str,targets, -1);\n}\n",
-                            "id" : "model",
                             "currentTree" : false,
+                            "id" : "model",
                             "* init" : "print(\"model initialized\");\n\n",
                             "|           void loadFile" : "(JsRender.JsRender f) {\n    //console.dump(f);\n    this.el.clear();\n    this.file = f;\n    \n    \n//    if (!f) {\n//        console.log('missing file');\n//        return;\n//    }\n    \n    // load the file if not loaded..\n    if (f.tree == null) {\n        f.loadItems( );\n    }\n    // if it's still null?\n    if (f.tree == null) {\n        return;\n    }\n    \n    /// this.get('/Window').setTitle(f.project.getName() + ' - ' + f.name);\n    \n    //if (f.items.length && typeof(f.items[0]) == 'string') {\n    \n        //this.get('/RightEditor').el.show();\n        //this.get('/RightEditor.view').load( f.items[0]);\n    //    return;\n    //}\n    //print(\"LOAD\");\n    //print(JSON.stringify(f.items, null,4));\n    //console.dump(f.items);\n    var o = new Gee.ArrayList<JsRender.Node>();\n    o.add(f.tree);\n    this.load(o,null);\n    \n    _this.view.el.expand_all();\n\n    if (f.tree.items.size < 1) {\n        // single item..\n        \n        //this.get('/Window.leftvpaned').el.set_position(80);\n        // select first...\n        _this.view.el.set_cursor( \n            new  Gtk.TreePath.from_string(\"0\"), null, false);\n        \n        \n    } else {\n          //this.get('/Window.leftvpaned').el.set_position(200);\n    }\n    \n    return;\n    /*    \n    \n    //print(\"hide right editior\");\n    //this.get('/RightEditor').el.hide();\n    //this.get('/Editor').el.hide();\n    //print(\"set current tree\");\n    //this.currentTree = this.toJS(false, false)[0];\n    //console.dump(this.currentTree);\n    //this.currentTree = this.currentTree || { items: [] };\n    //_this.renderView();\n    //console.dump(this.map);\n    //var RightPalete     = imports.Builder.RightPalete.RightPalete;\n    \n    \n    var pm = this.get('/RightPalete.model');\n    // set up provider..\n    \n    this.get('/RightPalete').provider = this.get('/LeftTree').getPaleteProvider();\n    \n    if (!this.get('/RightPalete').provider) {\n        print (\"********* PALETE PROVIDER MISSING?!!\");\n    }\n    this.get('/LeftTree').renderView();\n    \n    pm.load( this.get('/LeftTree').getPaleteProvider().gatherList(this.listAllTypes()));\n    \n    \n            \n    this.get('/Window.view-notebook').el.set_current_page(\n        this.get('/LeftTree.model').file.getType()== 'Roo' ? 0 : -1);\n        */\n            \n}\n",
                             "# JsRender.JsRender? file" : "null",
@@ -70,7 +70,7 @@
                             "n_columns" : 3,
                             "$ xns" : "Gtk",
                             "|           JsRender.Node pathToNode" : "(string path) {\n \n     \n     Gtk.TreeIter   iter;\n     _this.model.el.get_iter_from_string(out iter, path);\n     \n     GLib.Value value;\n     _this.model.el.get_value(iter, 2, out value);\n     \n     return (JsRender.Node)value.dup_object();\n\n}",
-                            "|           void dropNode" : "(string target_data_str, JsRender.Node node, bool show_templates) {\n//         print(\"drop Node\");\n     // console.dump(node);\n  //    console.dump(target_data);\n  \n  \n        // 0 = before , 1=after 2/3 onto\n  \n  \n        var target_data= target_data_str.split(\"|\");\n  \n        var parent_str = target_data[0].length > 0 ? target_data[0] : \"\";\n        var pos = target_data.length > 1 ? int.parse(target_data[1]) : 2; // ontop..\n  \n  \n        Gtk.TreePath tree_path  =   parent_str.length > 0 ? new  Gtk.TreePath.from_string( parent_str ) : null;\n        \n        \n        \n        //print(\"add \" + tp + \"@\" + target_data[1]  );\n        \n        JsRender.Node parentNode = null;\n        \n        Gtk.TreeIter iter_after;\n        Gtk.TreeIter iter_par ;\n        \n       \n         if (target_data.length == 3 && target_data[2].length > 0) {\n            node.props.set(\"* prop\", target_data[2]);\n        }\n\n        Gtk.TreePath expand_parent = null;\n        \n        // we only need to show the template if it's come from else where?\n         if (show_templates) {\n             var new_node = Xcls_DialogTemplateSelect.singleton().show( this.file.palete(), node);\n             if (new_node != null) {\n                 node = new_node;\n             }\n        }        \n        \n         //print(\"pos is %d  \\n\".printf(pos));\n        \n         Gtk.TreeIter n_iter; \n         \n         if ( parent_str.length < 1) {\n              this.el.append(out n_iter, null); // drop at top level..\n              node.parent = null;\n              this.file.tree = node;\n              \n              \n        } else   if (pos  < 2) {\n            //print(target_data[1]  > 0 ? 'insert_after' : 'insert_before');\n            \n            this.el.get_iter(out iter_after, tree_path );            \n            this.el.iter_parent(out iter_par, iter_after);\n            expand_parent = this.el.get_path(iter_par);\n            \n            GLib.Value value;\n            this.el.get_value( iter_par, 2, out value);\n            parentNode =  (JsRender.Node)value.dup_object();\n            \n            \n            this.el.get_value( iter_after, 2, out value);\n            var relNode =  (JsRender.Node)value.dup_object();\n            \n            if ( pos  > 0 ) {\n             \n                this.el.insert_after(out n_iter,    iter_par  , iter_after);\n                var ix = parentNode.items.index_of(relNode);\n                parentNode.items.insert(ix+1, node);\n                \n            } else {\n                this.el.insert_before(out n_iter,  iter_par  , iter_after);\n                var ix = parentNode.items.index_of(relNode);\n                parentNode.items.insert(ix, node);\n \n            }\n            node.parent = parentNode;\n            \n            \n            \n        } else {\n           //  print(\"appending to  \" + parent_str);\n            this.el.get_iter(out iter_par, tree_path);\n            this.el.append(out n_iter,   iter_par );\n            expand_parent = this.el.get_path(iter_par);\n            \n            GLib.Value value;\n            this.el.get_value( iter_par, 2, out value);\n            parentNode =  (JsRender.Node)value.dup_object();\n            node.parent = parentNode;\n            parentNode.items.add(node);\n        }\n        \n        // reparent node in tree...\n       \n        \n        // why only on no parent???\n        \n        //if (node.parent = null) {\n             \n           \n            \n        //}\n        \n        \n        // work out what kind of packing to use.. -- should be in \n        if (!node.has(\"pack\")   && parent_str.length > 1) {\n            \n            this.file.palete().fillPack(node,parentNode);\n            \n            \n        }\n        \n        // add the node...\n        \n        this.el.set(n_iter, 0, node.nodeTitle(), 1, node.nodeTip(), -1  );\n        var o = new GLib.Value(typeof(Object));\n        o.set_object((Object)node);\n        \n        this.el.set_value(n_iter, 2, o);\n        \n        \n        \n        \n// load children - if it has any..\n      \n        if (node.items.size > 0) {\n            this.load(node.items, n_iter);\n            _this.view.el.expand_row(this.el.get_path(n_iter), true);\n        } else if (expand_parent != null && !_this.view.el.is_row_expanded(expand_parent)) {\n           _this.view.el.expand_row(expand_parent,true);\n        }\n\n        //if (tp != null && (node.items.length() > 0 || pos > 1)) {\n        //    _this.view.el.expand_row(this.el.get_path(iter_par), true);\n       // }\n        // wee need to get the empty proptypes from somewhere..\n        \n        //var olditer = this.activeIter;\n        this.activePath = this.el.get_path(n_iter).to_string();\n\n\n        \n        \n        _this.view.el.set_cursor(this.el.get_path(n_iter), null, false);\n        _this.changed();\n     \n        \n            \n}\n",
+                            "|           void dropNode" : "(string target_data_str, JsRender.Node node, bool show_templates) {\n//         print(\"drop Node\");\n     // console.dump(node);\n  //    console.dump(target_data);\n  \n  \n        // 0 = before , 1=after 2/3 onto\n  \n  \n        var target_data= target_data_str.split(\"|\");\n  \n        var parent_str = target_data[0].length > 0 ? target_data[0] : \"\";\n        var pos = target_data.length > 1 ? int.parse(target_data[1]) : 2; // ontop..\n  \n  \n        Gtk.TreePath tree_path  =   parent_str.length > 0 ? new  Gtk.TreePath.from_string( parent_str ) : null;\n        \n        \n        \n        //print(\"add \" + tp + \"@\" + target_data[1]  );\n        \n        JsRender.Node parentNode = null;\n        \n        Gtk.TreeIter iter_after;\n        Gtk.TreeIter iter_par ;\n        \n       \n         if (target_data.length == 3 && target_data[2].length > 0) {\n            node.props.set(\"* prop\", target_data[2]);\n        }\n\n        Gtk.TreePath expand_parent = null;\n        \n        // we only need to show the template if it's come from else where?\n         if (show_templates) {\n             var new_node = DialogTemplateSelect.singleton().show( this.file.palete(), node);\n             if (new_node != null) {\n                 node = new_node;\n             }\n        }        \n        \n         //print(\"pos is %d  \\n\".printf(pos));\n        \n         Gtk.TreeIter n_iter; \n         \n         if ( parent_str.length < 1) {\n              this.el.append(out n_iter, null); // drop at top level..\n              node.parent = null;\n              this.file.tree = node;\n              \n              \n        } else   if (pos  < 2) {\n            //print(target_data[1]  > 0 ? 'insert_after' : 'insert_before');\n            \n            this.el.get_iter(out iter_after, tree_path );            \n            this.el.iter_parent(out iter_par, iter_after);\n            expand_parent = this.el.get_path(iter_par);\n            \n            GLib.Value value;\n            this.el.get_value( iter_par, 2, out value);\n            parentNode =  (JsRender.Node)value.dup_object();\n            \n            \n            this.el.get_value( iter_after, 2, out value);\n            var relNode =  (JsRender.Node)value.dup_object();\n            \n            if ( pos  > 0 ) {\n             \n                this.el.insert_after(out n_iter,    iter_par  , iter_after);\n                var ix = parentNode.items.index_of(relNode);\n                parentNode.items.insert(ix+1, node);\n                \n            } else {\n                this.el.insert_before(out n_iter,  iter_par  , iter_after);\n                var ix = parentNode.items.index_of(relNode);\n                parentNode.items.insert(ix, node);\n \n            }\n            node.parent = parentNode;\n            \n            \n            \n        } else {\n           //  print(\"appending to  \" + parent_str);\n            this.el.get_iter(out iter_par, tree_path);\n            this.el.append(out n_iter,   iter_par );\n            expand_parent = this.el.get_path(iter_par);\n            \n            GLib.Value value;\n            this.el.get_value( iter_par, 2, out value);\n            parentNode =  (JsRender.Node)value.dup_object();\n            node.parent = parentNode;\n            parentNode.items.add(node);\n        }\n        \n        // reparent node in tree...\n       \n        \n        // why only on no parent???\n        \n        //if (node.parent = null) {\n             \n           \n            \n        //}\n        \n        \n        // work out what kind of packing to use.. -- should be in \n        if (!node.has(\"pack\")   && parent_str.length > 1) {\n            \n            this.file.palete().fillPack(node,parentNode);\n            \n            \n        }\n        \n        // add the node...\n        \n        this.el.set(n_iter, 0, node.nodeTitle(), 1, node.nodeTip(), -1  );\n        var o = new GLib.Value(typeof(Object));\n        o.set_object((Object)node);\n        \n        this.el.set_value(n_iter, 2, o);\n        \n        \n        \n        \n// load children - if it has any..\n      \n        if (node.items.size > 0) {\n            this.load(node.items, n_iter);\n            _this.view.el.expand_row(this.el.get_path(n_iter), true);\n        } else if (expand_parent != null && !_this.view.el.is_row_expanded(expand_parent)) {\n           _this.view.el.expand_row(expand_parent,true);\n        }\n\n        //if (tp != null && (node.items.length() > 0 || pos > 1)) {\n        //    _this.view.el.expand_row(this.el.get_path(iter_par), true);\n       // }\n        // wee need to get the empty proptypes from somewhere..\n        \n        //var olditer = this.activeIter;\n        this.activePath = this.el.get_path(n_iter).to_string();\n\n\n        \n        \n        _this.view.el.set_cursor(this.el.get_path(n_iter), null, false);\n        _this.changed();\n     \n        \n            \n}\n",
                             "$ listAllTypes" : "function() {\n    var s = this.get('/LeftTree.view').selection;\n    print (\"LIST ALL TYPES: \" + s.count_selected_rows() );\n    \n    if (s.count_selected_rows() > 0) {\n        var iter = new Gtk.TreeIter();    \n        s.get_selected(this.el, iter);\n\n        // set some properties of the tree for use by the dropped element.\n        var value = new GObject.Value('');\n        this.el.get_value(iter, 2, value);\n        var data = JSON.parse(value.value);\n        \n        \n        var xname = this.get('/LeftTree.model').file.guessName(data);\n        console.log('selected:' + xname);\n        if (xname.length) {\n            return [ xname ];\n        }\n        return []; // could not find it..\n    }\n    \n    var ret = [ ];\n    \n   var _this = this;\n    function addall(li)\n    {\n        li.forEach(function(el) {\n            // this is specific to roo!!!?\n            if (!el) { // skip empty?\n                return;\n            }\n            var fullpath =  _this.file.guessName(el);\n            if (fullpath.length && ret.indexOf(fullpath) < 0) {\n                ret.push(fullpath);\n            }\n            \n            \n            if (el.items && el.items.length) {\n                addall(el.items);\n            }\n            \n        });\n        \n        \n    }\n    \n    addall([this.currentTree]);\n    \n    // only if we have nothing, should we add '*top'\n    if (!ret.length) {\n        ret = [ '*top' ];\n    }\n    //console.log('all types in tree');\n    //console.dump(ret);\n    \n    return ret;\n                            \n}\n"
                         },
                         {
@@ -82,8 +82,8 @@
                             "items" : [
                                 {
                                     "id" : "renderer",
-                                    "* pack" : "pack_start,true",
                                     "xtype" : "CellRendererText",
+                                    "* pack" : "pack_start,true",
                                     "$ xns" : "Gtk"
                                 }
                             ]
@@ -92,8 +92,8 @@
                 },
                 {
                     "id" : "LeftTreeMenu",
-                    "* pack" : false,
                     "xtype" : "Menu",
+                    "* pack" : false,
                     "$ xns" : "Gtk",
                     "items" : [
                         {
                                 "activate" : "  ( ) => {\n    \n    print(\"ACTIVATE?\");\n    \n  \n     _this.model.deleteSelected();\n}"
                             },
                             "label" : "Delete Element",
-                            "* pack" : "add",
                             "xtype" : "MenuItem",
+                            "* pack" : "add",
                             "$ xns" : "Gtk"
                         },
                         {
                                 "activate" : "  () => {\n\n     DialogSaveTemplate.singleton().show(\n            (Gtk.Window) _this.el.get_toplevel (), \n            _this.model.file.palete(), \n            _this.getActiveElement()\n    );\n     \n    \n}"
                             },
                             "label" : "Save as Template",
-                            "* pack" : "add",
                             "xtype" : "MenuItem",
+                            "* pack" : "add",
                             "$ xns" : "Gtk"
                         },
                         {
                                 "activate" : "  () => {\n    var node = _this.getActiveElement();\n     var name = DialogSaveModule.singleton().show(\n            (Gtk.Window) _this.el.get_toplevel (), \n            _this.model.file.project, \n            node\n     );\n     if (name.length < 1) {\n            return;\n  \n     }\n     node.props.set(\"* xinclude\", name);\n     node.items.clear();\n\n\n    var s = _this.view.el.get_selection();\n    \n    print(\"GET  SELECTED?\");\n    Gtk.TreeIter iter;\n    Gtk.TreeModel mod;\n\n    \n    if (!s.get_selected(out mod, out iter)) {\n        return; // nothing seleted..\n    }\n    Gtk.TreeIter citer;\n    var n_cn = mod.iter_n_children(iter) -1;\n    for (var i = n_cn; i > -1; i--) {\n        mod.iter_nth_child(out citer, iter, i);\n        \n\n        print(\"removing node from Tree\\n\");    \n    \n        _this.model.el.remove(ref citer);\n    }\n    _this.changed();\n    _this.node_selected(node);\n     \n    \n}"
                             },
                             "label" : "Save as Module",
-                            "* pack" : "add",
                             "xtype" : "MenuItem",
+                            "* pack" : "add",
                             "$ xns" : "Gtk"
                         }
                     ]
index 9ac1ecb..066999f 100644 (file)
@@ -19,8 +19,8 @@ WindowLeftTree=new XObject({
          return _this.model.pathToNode(path);
          
     },
-    before_node_change : "(JsRender.Node? node)",
     id : "WindowLeftTree",
+    before_node_change : "(JsRender.Node? node)",
     shadow_type : Gtk.ShadowType.IN,
     getActiveFile : () {
         return this.model.file;
@@ -44,8 +44,8 @@ WindowLeftTree=new XObject({
     items : [
        {
             dragData : "",
-            dropList : "",
             drag_x : "",
+            dropList : "",
             id : "view",
             headers_visible : true,
             drag_y : "",
@@ -102,6 +102,47 @@ WindowLeftTree=new XObject({
                        //   print("click:" + res.path.to_string());
                         return true;
                   },
+               drag_begin : ( ctx)  => {
+                       //print('SOURCE: drag-begin');
+                          
+                          
+                          //this.targetData = "";
+                          
+                          // find what is selected in our tree...
+                          
+                          var s = _this.view.el.get_selection();
+                          if (s.count_selected_rows() < 1) {
+                              return;
+                          }
+                          Gtk.TreeIter iter;
+                          Gtk.TreeModel mod;
+                          s.get_selected(out mod, out iter);
+                  
+                          
+                  
+                          // set some properties of the tree for use by the dropped element.
+                          GLib.Value value;
+                          _this.model.el.get_value(iter, 2, out value);
+                          var data = (JsRender.Node)(value.dup_object());
+                          var xname = data.fqn();
+                           print ("XNAME  IS " + xname+ "\n");
+                          this.dragData = xname;
+                          this.dropList = _this.model.file.palete().getDropList(xname);
+                          
+                          print ("DROP LIST IS " + string.joinv(", ", this.dropList) + "\n");
+                          
+                  
+                          // make the drag icon a picture of the node that was selected
+                          var path = _this.model.el.get_path(iter);
+                  
+                          //this.treepath = path.to_string();
+                          
+                          var pix = this.el.create_row_drag_icon ( path);
+                          
+                          Gtk.drag_set_icon_surface (ctx, pix) ;
+                          
+                          return;
+                  },
                cursor_changed : ( ) => {
                   
                   
@@ -160,47 +201,6 @@ WindowLeftTree=new XObject({
                       return  ;
                                   
                   },
-               drag_begin : ( ctx)  => {
-                       //print('SOURCE: drag-begin');
-                          
-                          
-                          //this.targetData = "";
-                          
-                          // find what is selected in our tree...
-                          
-                          var s = _this.view.el.get_selection();
-                          if (s.count_selected_rows() < 1) {
-                              return;
-                          }
-                          Gtk.TreeIter iter;
-                          Gtk.TreeModel mod;
-                          s.get_selected(out mod, out iter);
-                  
-                          
-                  
-                          // set some properties of the tree for use by the dropped element.
-                          GLib.Value value;
-                          _this.model.el.get_value(iter, 2, out value);
-                          var data = (JsRender.Node)(value.dup_object());
-                          var xname = data.fqn();
-                           print ("XNAME  IS " + xname+ "\n");
-                          this.dragData = xname;
-                          this.dropList = _this.model.file.palete().getDropList(xname);
-                          
-                          print ("DROP LIST IS " + string.joinv(", ", this.dropList) + "\n");
-                          
-                  
-                          // make the drag icon a picture of the node that was selected
-                          var path = _this.model.el.get_path(iter);
-                  
-                          //this.treepath = path.to_string();
-                          
-                          var pix = this.el.create_row_drag_icon ( path);
-                          
-                          Gtk.drag_set_icon_surface (ctx, pix) ;
-                          
-                          return;
-                  },
                drag_end : (drag_context) => {
                        //Seed.print('LEFT-TREE: drag-end');
                           this.dragData = "";
@@ -535,8 +535,8 @@ WindowLeftTree=new XObject({
                         }
                         return this.findDropNodeByPath(treepath_str,targets, -1);
                     },
-                    id : "model",
                     currentTree : false,
+                    id : "model",
                     loadFile : (JsRender.JsRender f) {
                         //console.dump(f);
                         this.el.clear();
@@ -892,7 +892,7 @@ WindowLeftTree=new XObject({
                             
                             // we only need to show the template if it's come from else where?
                              if (show_templates) {
-                                 var new_node = Xcls_DialogTemplateSelect.singleton().show( this.file.palete(), node);
+                                 var new_node = DialogTemplateSelect.singleton().show( this.file.palete(), node);
                                  if (new_node != null) {
                                      node = new_node;
                                  }
index 33dc14f..dabfd17 100644 (file)
@@ -76,8 +76,8 @@ public class Xcls_WindowLeftTree : Object
 
             // my vars (def)
         public string dragData;
-        public string[] dropList;
         public int drag_x;
+        public string[] dropList;
         public int drag_y;
         public bool drag_in_motion;
         public bool blockChanges;
@@ -172,6 +172,47 @@ public class Xcls_WindowLeftTree : Object
                  //   print("click:" + res.path.to_string());
                   return true;
             });
+            this.el.drag_begin.connect( ( ctx)  => {
+               //print('SOURCE: drag-begin');
+                    
+                    
+                    //this.targetData = "";
+                    
+                    // find what is selected in our tree...
+                    
+                    var s = _this.view.el.get_selection();
+                    if (s.count_selected_rows() < 1) {
+                        return;
+                    }
+                    Gtk.TreeIter iter;
+                    Gtk.TreeModel mod;
+                    s.get_selected(out mod, out iter);
+            
+                    
+            
+                    // set some properties of the tree for use by the dropped element.
+                    GLib.Value value;
+                    _this.model.el.get_value(iter, 2, out value);
+                    var data = (JsRender.Node)(value.dup_object());
+                    var xname = data.fqn();
+                     print ("XNAME  IS " + xname+ "\n");
+                    this.dragData = xname;
+                    this.dropList = _this.model.file.palete().getDropList(xname);
+                    
+                    print ("DROP LIST IS " + string.joinv(", ", this.dropList) + "\n");
+                    
+            
+                    // make the drag icon a picture of the node that was selected
+                    var path = _this.model.el.get_path(iter);
+            
+                    //this.treepath = path.to_string();
+                    
+                    var pix = this.el.create_row_drag_icon ( path);
+                    
+                    Gtk.drag_set_icon_surface (ctx, pix) ;
+                    
+                    return;
+            });
             this.el.cursor_changed.connect( ( ) => {
             
             
@@ -230,47 +271,6 @@ public class Xcls_WindowLeftTree : Object
                 return  ;
                             
             });
-            this.el.drag_begin.connect( ( ctx)  => {
-               //print('SOURCE: drag-begin');
-                    
-                    
-                    //this.targetData = "";
-                    
-                    // find what is selected in our tree...
-                    
-                    var s = _this.view.el.get_selection();
-                    if (s.count_selected_rows() < 1) {
-                        return;
-                    }
-                    Gtk.TreeIter iter;
-                    Gtk.TreeModel mod;
-                    s.get_selected(out mod, out iter);
-            
-                    
-            
-                    // set some properties of the tree for use by the dropped element.
-                    GLib.Value value;
-                    _this.model.el.get_value(iter, 2, out value);
-                    var data = (JsRender.Node)(value.dup_object());
-                    var xname = data.fqn();
-                     print ("XNAME  IS " + xname+ "\n");
-                    this.dragData = xname;
-                    this.dropList = _this.model.file.palete().getDropList(xname);
-                    
-                    print ("DROP LIST IS " + string.joinv(", ", this.dropList) + "\n");
-                    
-            
-                    // make the drag icon a picture of the node that was selected
-                    var path = _this.model.el.get_path(iter);
-            
-                    //this.treepath = path.to_string();
-                    
-                    var pix = this.el.create_row_drag_icon ( path);
-                    
-                    Gtk.drag_set_icon_surface (ctx, pix) ;
-                    
-                    return;
-            });
             this.el.drag_end.connect( (drag_context) => {
                //Seed.print('LEFT-TREE: drag-end');
                     this.dragData = "";
@@ -1001,7 +1001,7 @@ public class Xcls_WindowLeftTree : Object
                 
                 // we only need to show the template if it's come from else where?
                  if (show_templates) {
-                     var new_node = Xcls_DialogTemplateSelect.singleton().show( this.file.palete(), node);
+                     var new_node = DialogTemplateSelect.singleton().show( this.file.palete(), node);
                      if (new_node != null) {
                          node = new_node;
                      }