Builder3/Window.js
[app.Builder.js] / Builder / Window.bjs
index 146394d..06ae52d 100644 (file)
@@ -6,21 +6,21 @@
     "path": "/home/alan/gitlive/app.Builder.js/Sample/Window.bjs",
     "items": [
         {
-            "|xns": "Gtk",
-            "xtype": "Window",
-            "|type": "Gtk.WindowType.TOPLEVEL",
-            "title": "Application Builder",
-            "border_width": 0,
-            "|init": "function() {\n     this.atoms = {\n           \"STRING\" : Gdk.atom_intern(\"STRING\")\n\t};\n\tthis.targetList = new Gtk.TargetList();\n\tthis.targetList.add( this.atoms[\"STRING\"], 0, 0);\n\t//imports.Builder.Provider.ProjectManager.ProjectManager.loadConfig();\nGtk.rc_parse_string(\n            \"style \\\"gtkcombobox-style\\\" {\\n\" + \n            \"    GtkComboBox::appears-as-list = 1\\n\" +\n            \"}\\n\"+\n            \"class \\\"GtkComboBox\\\" style \\\"gtkcombobox-style\\\"\\n\");\n    XObject.prototype.init.call(this);\n    this.el.show_all();\n    \n   \n              \n}\n",
-            "default_width": 800,
-            "default_height": 500,
-            "id": "Window",
-            "|setTitle": "function(str) {\n    this.el.set_title(this.title + ' - ' + str);\n}\n",
             "listeners": {
                 "delete_event": "function (self, event) {\n    return false;\n}",
                 "destroy": "function (self) {\n   Gtk.main_quit();\n}",
-                "show": "function (self) {\n  print(\"WINDOW SHOWING - trying to hide\");\nimports.Builder.Provider.ProjectManager.ProjectManager.loadConfig();\n \tthis.get('/MidPropTree').hideWin();\n    this.get('/RightPalete').hide();\n    this.get('/BottomPane').el.hide();\n\n}"
+                "show": "function (self) {\n  print(\"WINDOW SHOWING - trying to hide\");\nimports.Builder.Provider.ProjectManager.ProjectManager.loadConfig();\n \tthis.get('/MidPropTree').hideWin();\n    this.get('/RightPalete').hide();\n    this.get('/BottomPane').el.hide();\n    //this.get('/Editor').el.show_all();\n\n}"
             },
+            "border_width": 0,
+            "default_height": 500,
+            "default_width": 800,
+            "id": "Window",
+            "title": "Application Builder",
+            "xtype": "Window",
+            "|init": "function() {\n     this.atoms = {\n           \"STRING\" : Gdk.atom_intern(\"STRING\")\n\t};\n\tthis.targetList = new Gtk.TargetList();\n\tthis.targetList.add( this.atoms[\"STRING\"], 0, 0);\n\t//imports.Builder.Provider.ProjectManager.ProjectManager.loadConfig();\nGtk.rc_parse_string(\n            \"style \\\"gtkcombobox-style\\\" {\\n\" + \n            \"    GtkComboBox::appears-as-list = 1\\n\" +\n            \"}\\n\"+\n            \"class \\\"GtkComboBox\\\" style \\\"gtkcombobox-style\\\"\\n\");\n    XObject.prototype.init.call(this);\n    this.el.show_all();\n    \n   \n              \n}\n",
+            "|setTitle": "function(str) {\n    this.el.set_title(this.title + ' - ' + str);\n}\n",
+            "|type": "Gtk.WindowType.TOPLEVEL",
+            "|xns": "Gtk",
             "items": [
                 {
                     "|xns": "Gtk",
                                             "items": [
                                                 {
                                                     "listeners": {
-                                                        "activate": "function (self, event) {\n      var js = this.get('/LeftTree.model').toJS();\n    if (js && js[0]) {\n        this.get('/RightBrowser.view').renderJS(js[0]);\n    } \n    return false;\n}"
+                                                        "activate": "function (self, event) {\n      var js = this.get('/LeftTree.model').toJS();\n    if (js && js[0]) {\n        this.get('/RightBrowser.view').renderJS(js[0], true);\n    } \n    return false;\n}"
                                                     },
                                                     "label": "_Redraw (Roo)",
                                                     "pack": "add",
                                                     "items": [
                                                         {
                                                             "listeners": {
-                                                                "activate": "function (self) {\n\tvar nb = this.get('/LeftTopPanel.notebook');\n\tif (this.el.expanded) {\n\t    // now expanded..\n            \n\t    var pm  = imports.Builder.Provider.ProjectManager.ProjectManager;\n\t    \n\t   \n\t    var model = this.get('/LeftProjectTree.combomodel');\n\t  //  print (\"loading Projects?\")\n\t//console.dump(pm.projects);\n\t    model.loadData(pm.projects);\n\t     \n\t    \n\t    nb.el.set_current_page(1);\n\t    //pm.on('changed', function() {\n\t\t//console.log(\"CAUGHT project manager change\");\n\t    //    _combo.model.loadData(pm.projects);\n\t    //}\n\t    return;\n\t}\n\tnb.el.set_current_page(0);\n}",
-                                                                "enter_notify_event": "function (self, event) {\n     this.el.expanded = !this.el.expanded;\n//if (this.el.expanded ) {\n    this.listeners.activate.call(this);\n//   }\n\nreturn true;\n}"
+                                                                "activate": "function (self) {\n    // this does not actually expand it..\n    // that is done by GTK..\n    \n    \n\n    if (!this.el.expanded) {\n        this.onExpand();\n    } else {\n        this.onCollapse();\n    }\n\t  \n}",
+                                                                "enter_notify_event": "function (self, event) {\nreturn;\n     this.el.expanded = !this.el.expanded;\n//if (this.el.expanded ) {\n    this.listeners.activate.call(this);\n//   }\n\nreturn true;\n}"
                                                             },
                                                             "id": "expander",
                                                             "label": "Select Project or File",
                                                             "pack": "pack_start,false,true",
                                                             "xtype": "Expander",
+                                                            "|onCollapse": "function() {\n    \n    var nb = this.get('/LeftTopPanel.notebook');\n    nb.el.set_current_page(0);\n}\n",
                                                             "|init": "function() {\n    XObject.prototype.init.call(this);\n   this.el.add_events (Gdk.EventMask.BUTTON_MOTION_MASK );\n}\n",
+                                                            "|onExpand": "function() {\n    var nb = this.get('/LeftTopPanel.notebook');            \n    var pm  = imports.Builder.Provider.ProjectManager.ProjectManager;\n    \n   \n    var model = this.get('/LeftProjectTree.combomodel');\n    //  print (\"loading Projects?\")\n    //console.dump(pm.projects);\n    model.loadData(pm.projects);\n     \n    \n    nb.el.set_current_page(1);\n    //pm.on('changed', function() {\n\t//console.log(\"CAUGHT project manager change\");\n    //    _combo.model.loadData(pm.projects);\n    //}\n    return;\n}\n",
                                                             "|xns": "Gtk"
                                                         },
                                                         {
-                                                            "|xns": "Gtk",
-                                                            "xtype": "Notebook",
                                                             "id": "notebook",
-                                                            "|show_border": false,
-                                                            "|show_tabs": false,
                                                             "pack": "pack_start,true,true",
+                                                            "xtype": "Notebook",
                                                             "|init": "function() {\n    XObject.prototype.init.call(this);\n\tthis.el.set_current_page(0);\n\n}\n",
+                                                            "|show_border": false,
+                                                            "|show_tabs": false,
+                                                            "|xns": "Gtk",
                                                             "items": [
                                                                 {
                                                                     "id": "LeftTree",
                                                                                     "id": "model",
                                                                                     "pack": "set_model",
                                                                                     "xtype": "TreeStore",
-                                                                                    "|changed": "function(n, refresh) {\n    //     print(\"MODEL CHANGED CALLED\" + this.activePath);\n         if (this.activePath) {\n            var iter = new Gtk.TreeIter();\n            this.el.get_iter(iter, new Gtk.TreePath.from_string(this.activePath))\n            this.el.set_value(iter, 0, [GObject.TYPE_STRING, this.nodeTitle(n)]);\n            this.el.set_value(iter, 1, [GObject.TYPE_STRING, this.nodeTitle(n)]);\n            \n            this.el.set_value(iter, 2, [GObject.TYPE_STRING, this.nodeToJSON(n)]);\n        }\n            //this.currentTree = this.toJS(false, true)[0];\n        this.file.items = this.toJS(false, false);\n      //  print(\"AFTER CHANGED\");\n        //console.dump(this.file.items);\n        this.file.save();\n        this.currentTree = this.file.items[0];\n        //console.log(this.file.toSource());\n        \n        if (refresh) {\n            print(\"REDNER BROWSER?!\");\n            this.get('/LeftTree').renderView();\n\n            var pm = this.get('/RightPalete.model');\n            if (!this.get('/RightPalete').provider) {\n                pm.load([]);\n                return;\n            }\n            \n            \n            pm.load( this.get('/RightPalete').provider.gatherList(this.listAllTypes()));\n            //imports['Builder/RightBrowser.js'].renderJS(this.toJS());\n        }\n\t          \n}\n",
+                                                                                    "|changed": "function(n, refresh) {\n    //     print(\"MODEL CHANGED CALLED\" + this.activePath);\n         if (this.activePath) {\n            var iter = new Gtk.TreeIter();\n            this.el.get_iter(iter, new Gtk.TreePath.from_string(this.activePath))\n            this.el.set_value(iter, 0, [GObject.TYPE_STRING, this.nodeTitle(n)]);\n            this.el.set_value(iter, 1, [GObject.TYPE_STRING, this.nodeTitle(n)]);\n            \n            this.el.set_value(iter, 2, [GObject.TYPE_STRING, this.nodeToJSON(n)]);\n        }\n            //this.currentTree = this.toJS(false, true)[0];\n        var d = new Date();\n        this.file.items = this.toJS(false, false);\n        print (\"TO JS in \" + ((new Date()) - d) + \"ms\");\n      //  print(\"AFTER CHANGED\");\n        //console.dump(this.file.items);\n        this.file.save();\n        this.currentTree = this.file.items[0];\n        //console.log(this.file.toSource());\n        \n        if (refresh) {\n            print(\"REDNER BROWSER?!\");\n            this.get('/LeftTree').renderView();\n\n            var pm = this.get('/RightPalete.model');\n            if (!this.get('/RightPalete').provider) {\n                pm.load([]);\n                return;\n            }\n            \n            \n            pm.load( this.get('/RightPalete').provider.gatherList(this.listAllTypes()));\n            //imports['Builder/RightBrowser.js'].renderJS(this.toJS());\n        }\n\t          \n}\n",
                                                                                     "|deleteSelected": "function() {\n    this.get('/LeftTree.view').blockChanges = true;\n    var old_iter = new Gtk.TreeIter();\n    var s = this.get('/LeftTree.view').selection;\n    s.get_selected(this.el, old_iter);\n    var path = this.el.get_path(old_iter).to_string();\n\n    this.activePath= false;      \n    s.unselect_all();\n\n    this.activePath= false;      \n     var iter = new Gtk.TreeIter();\n    this.el.get_iter_from_string(iter, path);\n    this.el.remove(iter);\n    \n    // rebuild treemap. -- depreciated.!!\n    this.map = {};\n    this.treemap = { };\n    //this.toJS(null, true) // does not do anything?\n    this.activePath= false;      \n    this.changed(false,true);\n    this.get('/LeftTree.view').blockChanges = false;\n}\n",
                                                                                     "|dropNode": "function(target_data, node) {\n         print(\"drop Node\");\n     // console.dump(node);\n  //    console.dump(target_data);\n        var tp = target_data[0].length ? new  Gtk.TreePath.from_string( target_data[0] ) : false;\n        \n        print(\"add \" + tp + \"@\" + target_data[1]  );\n        var parent = tp;\n        var after = false;\n        if (tp && target_data[1]  < 2) { // before or after..\n            var ar = target_data[0].split(':');\n            ar.pop();\n            parent  = new  Gtk.TreePath.from_string( ar.join(':') );\n            after = tp;\n        }\n        var n_iter = new Gtk.TreeIter();\n        var iter_par = new Gtk.TreeIter();\n        var iter_after = after ? new Gtk.TreeIter() : false;\n        \n        \n        \n        if (parent !== false) {\n            this.el.get_iter(iter_par, parent);\n        } else {\n            iter_par = null;\n        }\n        \n        \n        if (tp && after) {\n            print(target_data[1]  > 0 ? 'insert_after' : 'insert_before');\n            this.el.get_iter(iter_after, after);\n            this.el[ target_data[1]  > 0 ? 'insert_after' : 'insert_before'](\n                    n_iter, iter_par, iter_after);\n            \n        } else {\n            this.el.append(n_iter, iter_par);\n            \n        }\n        \n        if (typeof(node) == 'string') {\n            var ar = node.split('.');\n            var xtype = ar.pop();\n            \n            node = {\n                '|xns' : ar.join('.'),\n                'xtype' : xtype\n            };\n            if (target_data.length == 3 && target_data[2].length) {\n                node['*prop'] = target_data[2];\n            }\n            node = this.get('/DialogTemplateSelect').show(node);\n            \n        }\n        // work out what kind of packing to use..\n        if (typeof(node.pack) == 'undefined'  && parent !== false) {\n            var pal = this.get('/LeftTree').getPaleteProvider();\n            if (pal.name == 'Gtk') {\n                var pname = pal.guessName(this.singleNodeToJS(parent.to_string()));\n                var cname = pal.guessName(node);\n                node.pack = pal.getDefaultPack(pname, cname);\n            }\n            \n        }\n        \n        \n        var xitems = [];\n        if (node.items) {\n            xitems = node.items;\n            delete node.items;\n        }\n// load children - if it has any..\n\n        if (xitems) {\n            this.load(xitems, n_iter);\n            this.get('/LeftTree.view').el.expand_row(this.el.get_path(n_iter), true);\n        }\n        if (tp && (xitems || after)) {\n            this.get('/LeftTree.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  // changed actually set's the node data..\n        this.changed(node, true);\n        \n        \n        \n        this.get('/LeftTree.view').el.set_cursor(this.el.get_path(n_iter), null, false);\n        \n        //Builder.MidPropTree._model.load(node);\n        //Builder.MidPropTree._win.hideWin();\n        //Builder.LeftPanel._model.load( node);\n        \n            \n}\n",
                                                                                     "|findDropNode": "function(treepath_str, targets) {\n\n// this is used by the dragdrop code in the roo version AFAIR..\n\n    \t\tvar 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)) {\n                print(\"NO KEYS\");\n                return [ '',  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 === true) {\n                return [ path ];\n            }\n            return this.findDropNodeByPath(path,targets) \n}\n",
                                                                                     "|init": "function() {\n    XObject.prototype.init.call(this);\n this.el.set_column_types ( 3, [\n            GObject.TYPE_STRING, // title \n            GObject.TYPE_STRING, // tip\n            GObject.TYPE_STRING // source..\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",
                                                                                     "|load": "function(tr,iter)\n        {\n            var citer = new Gtk.TreeIter();\n            //this.insert(citer,iter,0);\n            for(var i =0 ; i < tr.length; i++) {\n                if (iter) {\n                    this.el.insert(citer,iter,-1);\n                } else {\n                    this.el.append(citer);\n                }\n                \n                this.el.set_value(citer, 0, [GObject.TYPE_STRING, this.nodeTitle(tr[i]) ]);\n                this.el.set_value(citer, 1, [GObject.TYPE_STRING, this.nodeTip(tr[i]) ]);\n                this.el.set_value(citer, 2, [GObject.TYPE_STRING, this.nodeToJSON(tr[i])]);\n                if (tr[i].items && tr[i].items.length) {\n                    this.load(tr[i].items, citer);\n                }\n            }     \n        }",
-                                                                                    "|loadFile": "function(f) {\n    //console.dump(f);\n            this.el.clear();\n            this.file = f;\n            \n            if (!f) {\n                console.log('missing file');\n                return;\n            }\n            \n            // load the file if not loaded..\n            if (f.items === false) {\n                var _this = this;\n                f.loadItems(function() {\n                    _this.loadFile(f);\n                });\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            this.load(f.items);\n            this.get('/LeftTree.view').el.expand_all();\n\n            if (!f.items.length) {\n                // single item..\n                \n                this.get('/Window.leftvpaned').el.set_position(80);\n                // select first...\n                this.get('/LeftTree.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            \n            //print(\"hide right editior\");\n            this.get('/RightEditor').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.get('/LeftTree').renderView();\n            //console.dump(this.map);\n            //var RightPalete     = imports.Builder.RightPalete.RightPalete;\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",
+                                                                                    "|loadFile": "function(f) {\n    //console.dump(f);\n            this.el.clear();\n            this.file = f;\n            \n            if (!f) {\n                console.log('missing file');\n                return;\n            }\n            \n            // load the file if not loaded..\n            if (f.items === false) {\n                var _this = this;\n                f.loadItems(function() {\n                    _this.loadFile(f);\n                });\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            this.load(f.items);\n            this.get('/LeftTree.view').el.expand_all();\n\n            if (!f.items.length) {\n                // single item..\n                \n                this.get('/Window.leftvpaned').el.set_position(80);\n                // select first...\n                this.get('/LeftTree.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            \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.get('/LeftTree').renderView();\n            //console.dump(this.map);\n            //var RightPalete     = imports.Builder.RightPalete.RightPalete;\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",
                                                                                     "|moveNode": "function(target_data, action) {\n     //print(\"MOVE NODE\");\n           // console.dump(target_data);\n            var old_iter = new Gtk.TreeIter();\n            var s = this.get('/LeftTree.view').selection;\n            s.get_selected(this.el, old_iter);\n            var node = this.nodeToJS(old_iter,false);\n            //console.dump(node);\n            \n            \n            // needs to drop first, otherwise the target_data \n            // treepath will be invalid.\n            \n            this.dropNode(target_data, node);\n\t  if (action & Gdk.DragAction.MOVE) {\n                      //          print(\"REMOVING OLD NODE\");\n                                this.el.remove(old_iter);\n                                \n            }\n            \n            this.activePath= false;\n            this.changed(false,true);\n}\n",
                                                                                     "|nodeTip": "function(c) {\n    var ret = this.nodeTitle(c,true);\n    var funcs = '';\n\n    \n    for( var i in c) {\n\n        if (!i.length || i[0] != '|') {\n            continue;\n        }\n        if (i == '|init') { \n            continue;\n        }\n        if (typeof(c[i]) != 'string') {\n           continue;\n        }\n        //print(\"prop : \" + i + ':' + c[i]);\n        if (!c[i].match(new RegExp('function'))) {\n            continue;\n        }\n        funcs += \"\\n<b>\" + i.substring(1) + '</b> : ' + c[i].split(/\\n/).shift();\n            \n    }\n    if (funcs.length) {\n        ret+=\"\\n\\nMethods:\" + funcs;\n    }\n    return ret;\n    \n}\n",
                                                                                     "|nodeTitle": "function(c, renderfull) {\n      var txt = [];\n    c = c || {};\n    var sr = (typeof(c['+buildershow']) != 'undefined') &&  !c['+buildershow'] ? true : false;\n    if (sr) txt.push('<s>');\n    if (typeof(c['*prop']) != 'undefined')   { txt.push(c['*prop']+ ':'); }\n    \n    if (renderfull && c['|xns']) {\n        txt.push(c['|xns']);\n    }\n    \n    if (c.xtype)      { txt.push(c.xtype); }\n    if (c.id)      { txt.push('<b>[id=' + c.id + ']</b>'); }\n    if (c.fieldLabel) { txt.push('[' + c.fieldLabel + ']'); }\n    if (c.boxLabel)   { txt.push('[' + c.boxLabel + ']'); }\n    \n    \n    if (c.layout)     { txt.push('<i>' + c.layout + '</i>'); }\n    if (c.title)      { txt.push('<b>' + c.title + '</b>'); }\n    if (c.label)      { txt.push('<b>' + c.label+ '</b>'); }\n    if (c.header)    { txt.push('<b>' + c.header + '</b>'); }\n    if (c.legend)      { txt.push('<b>' + c.legend + '</b>'); }\n    if (c.text)       { txt.push('<b>' + c.text + '</b>'); }\n    if (c.name)       { txt.push('<b>' + c.name+ '</b>'); }\n    if (c.region)     { txt.push('<i>(' + c.region + ')</i>'); }\n    if (c.dataIndex) { txt.push('[' + c.dataIndex+ ']'); }\n    \n    // for flat classes...\n    if (typeof(c['*class']) != 'undefined')  { txt.push('<b>' +  c['*class']+  '</b>'); }\n    if (typeof(c['*extends']) != 'undefined')  { txt.push(': <i>' +  c['*extends']+  '</i>'); }\n    \n    \n    if (sr) txt.push('</s>');\n    return (txt.length == 0 ? \"Element\" : txt.join(\" \"));\n}\n",
                                                                             "items": [
                                                                                 {
                                                                                     "listeners": {
-                                                                                        "cursor_changed": "function (self) {\n \tvar iter = new Gtk.TreeIter();\n                                \n        if (this.selection.count_selected_rows() < 1) {\n            //XN.get('Builder.LeftTree.model').\n            this.get('/LeftTree.model').load( false);\n            \n            return;\n        }\n        var model = this.get('/LeftProjectTree.model');\n        //console.log('changed');\n        var s = this.selection;\n        s.get_selected(model, iter);\n        value = new GObject.Value('');\n        model.el.get_value(iter, 2, value);\n        \n        console.log(value.value);// id..\n        \n        var file = this.get('/LeftProjectTree').project.getById(value.value);\n        \n        file.items = false;\n        console.log(file);\n        \n\n\n        var nb = this.get('/LeftTopPanel.expander');\n        nb.el.expanded = false;\n        nb.listeners.activate.call(nb);\n        //_expander.el.set_expanded(false);\n\n        var ltm = this.get('/LeftTree.model');\n        ltm.loadFile(file);\n        \n        return true;\n}"
+                                                                                        "cursor_changed": "function (self) {\n \tvar iter = new Gtk.TreeIter();\n                                \n        if (this.selection.count_selected_rows() < 1) {\n            //XN.get('Builder.LeftTree.model').\n            this.get('/LeftTree.model').load( false);\n            \n            return;\n        }\n        var model = this.get('/LeftProjectTree.model');\n        //console.log('changed');\n        var s = this.selection;\n        s.get_selected(model, iter);\n        value = new GObject.Value('');\n        model.el.get_value(iter, 2, value);\n        \n        console.log(value.value);// id..\n        \n        var file = this.get('/LeftProjectTree').project.getById(value.value);\n        \n        file.items = false;\n        console.log(file);\n        \n\n\n        var nb = this.get('/LeftTopPanel.expander');\n        nb.el.expanded = false;\n        nb.onCollapse();\n        //nb.listeners.activate.call(nb);\n        //_expander.el.set_expanded(false);\n\n        var ltm = this.get('/LeftTree.model');\n        ltm.loadFile(file);\n        \n        return true;\n}"
                                                                                     },
                                                                                     "id": "view",
                                                                                     "tooltip_column": 1,
                                                             ]
                                                         },
                                                         {
-                                                            "|xns": "Gtk",
-                                                            "xtype": "ScrolledWindow",
+                                                            "editing": false,
                                                             "id": "LeftPanel",
                                                             "pack": "add",
-                                                            "|shadow_type": "Gtk.ShadowType.IN",
-                                                            "editing": false,
+                                                            "xtype": "ScrolledWindow",
                                                             "|init": "function() {\n    XObject.prototype.init.call(this);\n   this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n}\n",
+                                                            "|shadow_type": "Gtk.ShadowType.IN",
+                                                            "|xns": "Gtk",
                                                             "items": [
                                                                 {
-                                                                    "|xns": "Gtk",
-                                                                    "xtype": "TreeView",
+                                                                    "listeners": {
+                                                                        "button_press_event": "function (self, ev) {\n\n    \n    var res = { }; \n    \n    if (!this.el.get_path_at_pos(ev.button.x,ev.button.y, res)) {\n        return false; //not on a element.\n    }\n    \n     // right click.\n     if (ev.type == Gdk.EventType.BUTTON_PRESS  && ev.button.button == 3) {    \n        // show popup!.   \n        if (res.column.title == 'value' && this.get('/LeftPanel').editing) {\n            return false;\n        }\n        //if (! this.get('/LeftPanelPopup')LeftPanelPopup.el) LeftPanelPopup.init();\n        var p = this.get('/LeftPanelPopup');\n        if (!p.el) {\n            p.init();\n        }\n\n        p.el.set_screen(Gdk.Screen.get_default());\n        p.el.show_all();\n        p.el.popup(null, null, null, null, 3, ev.button.time);\n        //Seed.print(\"click:\" + res.column.title);\n        \n        \n        return false;\n    }\n    \n     \n    if (res.column.title != 'value') {\n          //  XObject.error(\"column is not value?\");\n        return false; // ignore.. - key click.. ??? should we do this??\n    }\n    \n    // currently editing???\n//    if (  this.activePath) {\n        \n     //   this.activePath = false;\n       // stop editing!!!!\n        if (this.get('/Editor').dirty) {\n            //if (!this.get('/Editor.buffer').checkSyntax()) {\n            //   this.get('/StandardErrorDialog').show(\"Fix errors in code and save..\"); \n            //   return true;\n            //    // error Dialog\n            //}\n            if (!this.get('/Editor.view').save()) {\n                return true;\n            }\n        }   \n        this.get('/LeftPanel').editableColumn.items[0].el.stop_editing();\n        this.get('/LeftPanel').editing = false;\n    \n    //    XObject.error(\"Currently editing?\");\n     //   return false;\n   // }\n    \n    var renderer = this.get('/LeftPanel').editableColumn.items[0].el; // set has_entry..\n    \n    var type = this.get('/LeftPanel.model').getType(res.path.to_string());\n        \n    // get options for this type -- this is to support option lists etc..\n    var provider = this.get('/LeftTree').getPaleteProvider();\n    var opts = provider.findOptions(type);\n    \n    if (opts === false) {\n        // it's text etnry\n         this.get('/LeftPanel').editableColumn.setOptions([]);\n        renderer.has_entry = true;\n    } else {\n         this.get('/LeftPanel').editableColumn.setOptions(opts);\n        renderer.has_entry = false;\n    }\n    this.get('/LeftPanel.model').startEditing(res.path.to_string(), 1);\n        \n   //Seed.print(\"click\" + ev.type);\n    //console.dump(res);\n    return false;\n\n              \n   \n}"
+                                                                    },
                                                                     "id": "view",
                                                                     "tooltip_column": 5,
-                                                                    "|headers_visible": false,
+                                                                    "xtype": "TreeView",
                                                                     "|enable_tree_lines": true,
+                                                                    "|headers_visible": false,
                                                                     "|init": "function() {\n     XObject.prototype.init.call(this); \n                       \n                    this.selection = this.el.get_selection();\n                    this.selection.set_mode( Gtk.SelectionMode.SINGLE);\n                 \n                    \n                    var description = new Pango.FontDescription.c_new();\n                    description.set_size(8000);\n                    this.el.modify_font(description);\n}\n",
-                                                                    "listeners": {
-                                                                        "button_press_event": "function (self, ev) {\n    \n                \n                var res = { }; \n                if (!this.el.get_path_at_pos(ev.button.x,ev.button.y, res)) {\n                    return false; //not on a element.\n                }\n                \n                \n                if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button.button != 3) {\n                    \n                    if (res.column.title != 'value') {\n                        return false; // ignore..\n                    }\n                    if (  this.get('/LeftPanel').editing) {\n                        return false;\n                    }\n                    var renderer = this.get('/LeftPanel').editableColumn.items[0].el; // set has_entry..\n                    this.get('/LeftPanel').editableColumn.items[0].el.stop_editing();\n                    var type = this.get('/LeftPanel.model').getType(res.path.to_string());\n                    \n                     \n\n                    var provider = this.get('/LeftTree').getPaleteProvider();\n                    \n                    var opts = provider.findOptions(type);\n                    \n                    if (opts === false) {\n                         this.get('/LeftPanel').editableColumn.setOptions([]);\n                        renderer.has_entry = true;\n                    } else {\n                        LeftPanel.editableColumn.setOptions(opts);\n                        renderer.has_entry = false;\n                    }\n                    \n                    \n                   //Seed.print(\"click\" + ev.type);\n                    //console.dump(res);\n                    return false;\n                }\n              \n            \n               \n                if (res.column.title == 'value') {\n                    return false;\n                }\n                //if (! this.get('/LeftPanelPopup')LeftPanelPopup.el) LeftPanelPopup.init();\n\t\tvar p = this.get('/LeftPanelPopup');\n\t\tif (!p.el) {\n\t\t\tp.init();\n\t\t}\n\n                p.el.set_screen(Gdk.Screen.get_default());\n                p.el.show_all();\n                p.el.popup(null, null, null, null, 3, ev.button.time);\n                //Seed.print(\"click:\" + res.column.title);\n                \n                \n                return false;\n}"
-                                                                    },
+                                                                    "|xns": "Gtk",
                                                                     "items": [
                                                                         {
                                                                             "activePath": false,
                                                                             "|add": "function(info) {\n      // info includes key, val, skel, etype..\n              console.dump(info);\n            type = info.type.toLowerCase();\n            var data = this.toJS();\n            \n            if (info.etype == 'events') {\n                data.listeners = data.listeners || { };\n                if (typeof(data.listeners[info.key]) != 'undefined') {\n                    return; //already set!\n                }\n            } else {\n                if (typeof(data[info.key]) != 'undefined') {\n                    return;\n                }\n            }\n            \n            if (typeof(info.val) == 'undefined') {\n                    \n                info.val = '';\n                if (info.type.toLowerCase() == 'boolean') {\n                    info.val = true;\n                }\n                if (type == 'number') {\n                    info.val = 0;\n                }\n                // utf8 == string..\n                \n                \n            }\n            var k = info.key;\n            if (info.etype == 'events') {\n             \n                data.listeners[info.key] = info.val;\n                k = '!' + info.key;\n            } else {\n                data[info.key] = info.val;\n            }\n            \n            \n            var map = this.load(data);\n            \n            // flag it as changed to the interface..\n\n            this.get('/LeftTree.model').changed(data, true); \n            \n            \n            this.startEditing(map[k]);\n             \n            /*\n            LeftPanel.get('view').el.row_activated(\n                new Gtk.TreePath.from_string(map[k]), \n                LeftPanel.editableColumn.el\n            );\n            */\n}\n",
                                                                             "|changed": "function(str, doRefresh) {\n    if (!this.activePath) {\n        return;\n    }\n    var iter = new Gtk.TreeIter();\n    this.el.get_iter(iter, new Gtk.TreePath.from_string(this.activePath));\n    \n    this.el.set_value(iter, 1, '' +str);\n    this.el.set_value(iter, 3, '' + this.toShort(str));\n    var type = this.getIterValue(iter, 4);\n\n    this.el.set_value(iter, 5, type + ' : ' + str);\n    // update the tree...  \n\n    this.get('/LeftTree.model').changed(this.toJS(), doRefresh); \n}\n",
                                                                             "|deleteSelected": "function() {\n     var data = this.toJS();\n    var iter = new Gtk.TreeIter();\n    var s = this.get('/LeftPanel.view').selection;\n    s.get_selected(this.el, iter);\n         \n       \n    var gval = new GObject.Value('');\n   this.get('/LeftPanel.model').el.get_value(iter, 0 ,gval);\n    \n    var val = gval.value;\n    if (val[0] == '!') {\n        // listener..\n        if (!data.listeners || typeof(data.listeners[  val.substring(1)]) == 'undefined') {\n            return;\n        }\n        delete data.listeners[  val.substring(1)];\n        if (!XObject.keys(data.listeners).length) {\n            delete data.listeners;\n        }\n        \n    } else {\n        if (typeof(data[val]) == 'undefined') {\n            return;\n        }\n        delete data[val];\n    }\n    \n    \n    this.load(data);\n    this.get('/LeftTree.model').changed(data, true);\n    \n}\n",
-                                                                            "|editSelected": "function(e) {\n    print(\"EDIT SELECTED?\");\n    var iter = new Gtk.TreeIter();\n    var s = this.get('/LeftPanel.view').selection;\n    s.get_selected(this.get('/LeftPanel.model').el, iter);\n    var m = this.get('/LeftPanel.model')\n   \n    var gval = new GObject.Value('');\n    this.el.get_value(iter, 0 ,gval);\n    var val = '' + gval.value;\n    \n    gval = new GObject.Value('');\n    this.el.get_value(iter, 1 ,gval);\n    var rval = gval.value;\n    var activePath = this.el.get_path(iter).to_string(); \n    this.activePath = activePath ;\n    // was activeIter...\n    //  not listener...\n\n    var showEditor = false;\n    \n    if (val[0] == '!') {\n        showEditor = true;\n    }\n    if (val[0] == '|') {\n        if (rval.match(/function/g) || rval.match(/\\n/g) || rval.length > 20) {\n            showEditor = true;\n        }\n    }\n    \n    if (showEditor) {\n        var _this = this;\n        this.activePath = false;\n        GLib.timeout_add(0, 1, function() {\n            //   Gdk.threads_enter();\n            _this.get('/BottomPane').el.show();\n            _this.get('/RightEditor').el.show();\n            _this.get('/RightEditor.view').load( rval );\n            \n            e.editing_done();\n            e.remove_widget();\n            _this.activePath = activePath ;\n            \n     //       Gdk.threads_leave();\n            return false;\n        });\n        return;\n    }\n      this.get('/BottomPane').el.hide();\n    this.get('/RightEditor').el.hide();\n\n        //var type = this.getValue(this.el.get_path(iter).to_string(),4);\n        \n        \n}\n",
                                                                             "|getIterValue": "function(iter, col) {\n     var gval = new GObject.Value('');\n    this.get('/LeftPanel.model').el.get_value(iter, col ,gval);\n    return '' + gval.value;\n}\n",
                                                                             "|getType": "function(treepath) {\n     return this.getValue(treepath, 4);\n}\n",
-                                                                            "|getValue": "function(treepath_str, col) {\n      var iter = new Gtk.TreeIter();\n    this.el.get_iter(iter, new Gtk.TreePath.from_string(treepath_str));\n    \n    var gval = new GObject.Value('');\n    this.get('/LeftPanel.model').el.get_value(iter, col ,gval);\n    var val = '' + gval.value;\n    if (col != 1) {\n        return val;\n    }\n    var type = this.getType(this.el.get_path(iter).to_string());\n    //print(\"TYPE: \" +type + \" -  val:\" + val);\n    switch(type.toLowerCase()) {\n        case 'number':\n        case 'uint':\n        case 'int':\n            return parseFloat(val); // Nan ?? invalid!!?        \n        case 'float':\n        case 'gfloat':\n            return 1.0 * parseFloat(val); // Nan ?? invalid!!?\n        case 'boolean':\n            return val == 'true' ? true : false;\n        default: \n            var nv = parseFloat(val);\n            if (!isNaN(nv) && (val == ''+nv)) {\n                return nv;\n            }\n            return val;\n    }\n                            \n}\n",
+                                                                            "|getValue": "function(treepath_str, col) \n{\n   // get's the  value in a row.. - keys - returns string, values - formats it..\n\n    var iter = new Gtk.TreeIter();\n    this.el.get_iter(iter, new Gtk.TreePath.from_string(treepath_str));\n    \n    var gval = new GObject.Value('');\n    this.get('/LeftPanel.model').el.get_value(iter, col ,gval);\n    var val = '' + gval.value;\n   \n    if (col != 1) {\n        return val;\n    }\n    var type = this.getType(this.el.get_path(iter).to_string());\n    //print(\"TYPE: \" +type + \" -  val:\" + val);\n    switch(type.toLowerCase()) {\n        case 'number':\n        case 'uint':\n        case 'int':\n            return parseFloat(val); // Nan ?? invalid!!?        \n        case 'float':\n        case 'gfloat':\n            return 1.0 * parseFloat(val); // Nan ?? invalid!!?\n        case 'boolean':\n            return val == 'true' ? true : false;\n        default: \n            var nv = parseFloat(val);\n            if (!isNaN(nv) && (val == ''+nv)) {\n                return nv;\n            }\n            return val;\n    }\n                            \n}\n",
                                                                             "|init": "function() {\n    XObject.prototype.init.call(this);\nthis.el.set_column_types ( 6, [\n                                GObject.TYPE_STRING,  // 0 real key\n                                GObject.TYPE_STRING, // 1 real value \n                                 GObject.TYPE_STRING,  // 2 visable key\n                                 GObject.TYPE_STRING, // 3 visable value\n                                 GObject.TYPE_STRING, // 4 need to store type of!!!\n                                  GObject.TYPE_STRING // 5 tooltip\n                              \n                            ]);\n}\n",
-                                                                            "|load": "function(ar) {\n  this.el.clear();\n                        \n    this.get('/RightEditor').el.hide();\n    if (ar === false) {\n        return ;\n    }\n    var ret = {}; \n    \n\n    var provider = this.get('/LeftTree').getPaleteProvider();\n     var iter = new Gtk.TreeIter();\n     \n    // sort!!!?\n    var keys  = XObject.keys(ar);\n    keys.sort();\n    ar.listeners = ar.listeners || {};\n    \n    for (var i in ar.listeners ) {\n        this.el.append(iter);\n        var p = this.el.get_path(iter).to_string();\n        ret['!' + i] = p;\n        \n        this.el.set_value(iter, 0, '!'+  i  );\n        this.el.set_value(iter, 1, '' + ar.listeners[i]);\n        this.el.set_value(iter, 2, '<b>'+ i + '</b>');\n        \n        this.el.set_value(iter, 3, '' + this.toShort(ar.listeners[i]));\n        this.el.set_value(iter, 4, 'function');\n        this.el.set_value(iter, 5, i + ' : ' + ar.listeners[i]);\n    }\n    \n    \n   \n    var _this = this;\n    keys.forEach(function(i) {\n        if (typeof(ar[i]) == 'object') {\n            return;\n        }\n        \n        var type = provider.findType(ar, i, ar[i]);\n        \n        _this.el.append(iter);\n        var p = _this.el.get_path(iter).to_string();\n        ret[i] = p;\n        _this.el.set_value(iter, 0, ''+i);\n        _this.el.set_value(iter, 1, '' + ar[i]);  \n        _this.el.set_value(iter, 2, ''+i);\n        _this.el.set_value(iter, 3, ''+ _this.toShort(ar[i]));\n        _this.el.set_value(iter, 4, ''+type);\n        _this.el.set_value(iter, 5, type + ' : ' + ar[i]);\n    })\n    return ret;\n}\n",
-                                                                            "|startEditing": "function(path,col) {\n    /**\n    * start editing path (or selected if not set..)\n    * @param {String|false} path  (optional) treepath to edit - selected tree gets\n    *     edited by default.\n    * @param {Number} 0 or 1 (optional)- column to edit. \n    */\n     var tp;\n    if (typeof(path) == 'string') {\n        tp = new Gtk.TreePath.from_string(path);\n    } else {\n        var iter = new Gtk.TreeIter();\n        var s = this.get('/LeftPanel.view').selection;\n        s.get_selected(this.el, iter);\n        tp = this.el.get_path(iter);\n        path = tp.to_string();\n    }\n    \n   \n    // which colum is to be edited..\n    var colObj = false;\n    if (typeof(col) == 'undefined') {\n        var k = this.getValue(path, 0);\n        colObj = (!k.length || k == '|') ? \n            this.get('/LeftPanel').propertyColumn : this.get('/LeftPanel').editableColumn;\n    } else {\n        colObj = col ? this.get('/LeftPanel').editableColumn : this.get('/LeftPanel').propertyColumn;\n    }\n    \n    // make sure the pulldown is set correctly..\n    // not really needed for second col...\n\n    var provider = this.get('/LeftTree').getPaleteProvider();\n   \n    var type = this.get('/LeftPanel.model').getType(path);\n    var opts = provider.findOptions(type);\n    var renderer = this.get('/LeftPanel').editableColumn.items[0].el;\n    \n    if (opts === false) {\n        this.get('/LeftPanel').editableColumn.setOptions([]);\n        renderer.has_entry = true; /// probably does not have any effect.\n    } else {\n        this.get('/LeftPanel').editableColumn.setOptions(opts);\n        renderer.has_entry = false;\n    }\n    \n    var _this=this;\n    // iter now has row...\n    GLib.timeout_add(0, 100, function() {\n        \n        colObj.items[0].el.editable = true; // esp. need for col 0..\n        _this.get('/LeftPanel.view').el.set_cursor_on_cell(\n            tp,\n            colObj.el,\n            colObj.items[0].el,\n            true\n        );\n    });\n    \n}\n",
+                                                                            "|load": "function(ar) {\n  this.el.clear();\n                        \n    //this.get('/RightEditor').el.hide();\n    if (ar === false) {\n        return ;\n    }\n    var ret = {}; \n    \n\n    var provider = this.get('/LeftTree').getPaleteProvider();\n     var iter = new Gtk.TreeIter();\n     \n    // sort!!!?\n    var keys  = XObject.keys(ar);\n    keys.sort();\n    ar.listeners = ar.listeners || {};\n    \n    for (var i in ar.listeners ) {\n        this.el.append(iter);\n        var p = this.el.get_path(iter).to_string();\n        ret['!' + i] = p;\n        \n        this.el.set_value(iter, 0, '!'+  i  );\n        this.el.set_value(iter, 1, '' + ar.listeners[i]);\n        this.el.set_value(iter, 2, '<b>'+ i + '</b>');\n        \n        this.el.set_value(iter, 3, '' + this.toShort(ar.listeners[i]));\n        this.el.set_value(iter, 4, 'function');\n        this.el.set_value(iter, 5, i + ' : ' + ar.listeners[i]);\n    }\n    \n    \n   \n    var _this = this;\n    keys.forEach(function(i) {\n        if (typeof(ar[i]) == 'object') {\n            return;\n        }\n        \n        var type = provider.findType(ar, i, ar[i]);\n        \n        _this.el.append(iter);\n        var p = _this.el.get_path(iter).to_string();\n        ret[i] = p;\n        _this.el.set_value(iter, 0, ''+i);\n        _this.el.set_value(iter, 1, '' + ar[i]);  \n        _this.el.set_value(iter, 2, ''+i);\n        _this.el.set_value(iter, 3, ''+ _this.toShort(ar[i]));\n        _this.el.set_value(iter, 4, ''+type);\n        _this.el.set_value(iter, 5, type + ' : ' + ar[i]);\n    })\n    return ret;\n}\n",
+                                                                            "|startEditing": "function(path,col) {\n    \n    // alled by menu 'edit' currently..\n    /**\n    * start editing path (or selected if not set..)\n    * @param {String|false} path  (optional) treepath to edit - selected tree gets\n    *     edited by default.\n    * @param {Number} 0 or 1 (optional)- column to edit. \n    */\n    // fix tp to be the 'treepath' string (eg. 0/1/2...)\n    var tp;\n    if (typeof(path) == 'string') {\n        tp = new Gtk.TreePath.from_string(path);\n    } else {\n        var iter = new Gtk.TreeIter();\n        var s = this.get('/LeftPanel.view').selection;\n        s.get_selected(this.el, iter);\n        tp = this.el.get_path(iter);\n        path = tp.to_string();\n    }\n    \n   \n    // which colum is to be edited..\n    var colObj = false;\n    \n    // not sure what this does..\n    \n    if (typeof(col) == 'undefined') {\n        var k = this.getValue(path, 0);\n        col = 1;\n        colObj = (!k.length || k == '|') ? \n            this.get('/LeftPanel').propertyColumn : this.get('/LeftPanel').editableColumn;\n    } else {\n        colObj = col ? this.get('/LeftPanel').editableColumn : this.get('/LeftPanel').propertyColumn;\n    }\n    \n    // make sure the pulldown is set correctly..\n    // not really needed for second col...\n    var showEditor = false;\n    \n    if (col) {\n        var provider = this.get('/LeftTree').getPaleteProvider();\n        var type = this.get('/LeftPanel.model').getType(path);\n        var opts = provider.findOptions(type);\n        var renderer = this.get('/LeftPanel').editableColumn.items[0].el;\n        \n        if (opts === false) {\n            this.get('/LeftPanel').editableColumn.setOptions([]);\n            renderer.has_entry = true; \n        } else {\n            this.get('/LeftPanel').editableColumn.setOptions(opts);\n            renderer.has_entry = false;/// - pulldowns do not have entries\n        }\n        // determine if we should use the Text editor...\n        var keyname = this.getValue(path, 0);\n        var data_value = this.getValue(path, 1);\n    \n        if ((keyname[0] == '|') || \n            (   \n                (typeof(data_value) == 'string' ) && \n                ( data_value.match(/function/g) || data_value.match(/\\n/g)) // || (data_value.length > 20))\n            )) {\n            showEditor = true;\n        }\n        print(\"SHOW EDITOR\" + showEditor ? 'YES' :'no');\n        \n    }\n    var _this = this;    \n    // end editing..\n    this.get('/BottomPane').el.hide();\n    //this.get('/RightEditor').el.hide();\n     this.get('/Editor').el.hide();\n    \n    if (showEditor) {\n\n        this.activePath = false;\n        _this.get('/Editor').el.show_all();\n        GLib.timeout_add(0, 1, function() {\n\n            //_this.get('/BottomPane').el.show();\n             //_this.get('/RightEditor').el.show();\n            \n            _this.get('/Editor.RightEditor.view').load( _this.getValue(path, 1) );\n            \n            //e.editing_done();\n            //e.remove_widget();\n            _this.activePath = path ;\n          \n            return false;\n        });\n        return;\n    }\n      \n    \n    \n\n    // iter now has row...\n    GLib.timeout_add(0, 100, function() {\n        _this.activePath = path;\n        colObj.items[0].el.editable = true; // esp. need for col 0..\n        _this.get('/LeftPanel.view').el.set_cursor_on_cell(\n            tp,\n            colObj.el,\n            colObj.items[0].el,\n            true\n        );\n    });\n    \n}\n",
                                                                             "|toJS": "function() {\n     var iter = new Gtk.TreeIter();\n    this.get('/LeftPanel.model').el.get_iter_first(iter);\n    var ar = {};\n       \n    while (true) {\n        \n        var k = this.getValue(this.el.get_path(iter).to_string(), 0);\n       // Seed.print(k);\n        if (k[0] == '!') {\n            ar.listeners = ar.listeners || {};\n            ar.listeners[  k.substring(1)] = this.getValue(this.el.get_path(iter).to_string(), 1);\n            \n        } else {\n            ar[ k ] = this.getValue(this.el.get_path(iter).to_string(), 1);\n        }\n        \n        if (! this.get('/LeftPanel.model').el.iter_next(iter)) {\n            break;\n        }\n    }\n    \n    \n    //print(JSON.stringify(ar));\n    return ar;\n    // convert the l\n}\n",
                                                                             "|toShort": "function(str) {\n    var a = typeof(str) == 'string' ? str.split(\"\\n\") : [];\n        return a.length > 1 ? a[0] + '....' : '' + str;\n}\n",
                                                                             "|xns": "Gtk"
                                                                             ]
                                                                         },
                                                                         {
-                                                                            "|xns": "Gtk",
-                                                                            "xtype": "TreeViewColumn",
                                                                             "pack": "append_column",
-                                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n\tthis.el.add_attribute(this.items[0].el , 'text', 3 );\n\tthis.el.add_attribute(this.items[0].el , 'sensitive', 3 );\n\tthis.el.add_attribute(this.items[0].el , 'editable', 3 );\n          // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);\n\n \tthis.get('/LeftPanel').editableColumn= this;\n}\n",
+                                                                            "title": "value",
+                                                                            "xtype": "TreeViewColumn",
+                                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n\tthis.el.add_attribute(this.items[0].el , 'text', 3 );\n\tthis.el.add_attribute(this.items[0].el , 'sensitive', 3 );\n\t//this.el.add_attribute(this.items[0].el , 'editable', 3 );\n          // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);\n\n \tthis.get('/LeftPanel').editableColumn= this;\n}\n",
                                                                             "|setOptions": "function(ar) {\n       var m = this.items[0].el.model;\n            m.clear();\n            var iter = new Gtk.TreeIter();\n            ar.forEach(function(i) {\n                   // sort!!!?\n                m.append(iter);\n                m.set_value(iter, 0, i);\n            });\n            \n}\n",
+                                                                            "|xns": "Gtk",
                                                                             "items": [
                                                                                 {
-                                                                                    "|xns": "Gtk",
-                                                                                    "xtype": "CellRendererCombo",
+                                                                                    "listeners": {
+                                                                                        "edited": "function (self, object, p0) {\n \tthis.get('/LeftPanel').editing = false;\n \tvar ap = this.get('/LeftPanel.model').activePath\n\tprint(\"EDITED? \"  + ap + \" - p:\" + p0 + \" t:\" + p0);\n        this.get('/LeftPanel.model').changed(p0, true);\n        this.get('/LeftPanel.model').activePath = false;\n        this.el.editable = false;\n}",
+                                                                                        "editing_started": "function (self, editable, path) {\n   this.get('/LeftPanel').editing  = true;\n\t//  console.log('editing started');\n       // r.has_entry = false;\n\n    this.el.editable = false; // make sure it's not editor...\n   \n}"
+                                                                                    },
+                                                                                    "editable": false,
                                                                                     "pack": "pack_start",
-                                                                                    "|editable": true,
-                                                                                    "|has_entry": true,
                                                                                     "text_column": 0,
+                                                                                    "xtype": "CellRendererCombo",
+                                                                                    "|has_entry": true,
                                                                                     "|init": "function() {\n    XObject.prototype.init.call(this);\n   this.el.model = new Gtk.ListStore();\n    this.el.model.set_column_types ( 1, [\n        GObject.TYPE_STRING  // 0 real key\n      ]);\n}\n",
-                                                                                    "listeners": {
-                                                                                        "edited": "function (self, object, p0) {\n \tthis.get('/LeftPanel').editing = false;\n\tprint(\"EDITED? p:\" + p0 + \" t:\" + p0);\n        this.get('/LeftPanel.model').changed(p0, true);\n        this.get('/LeftPanel.model').activePath = false;\n}",
-                                                                                        "editing_started": "function (self, editable, path) {\n   this.get('/LeftPanel').editing  = true;\n\t//  console.log('editing started');\n       // r.has_entry = false;\n   this.get('/LeftPanel.model').editSelected(editable);\n}"
-                                                                                    }
+                                                                                    "|xns": "Gtk"
                                                                                 }
                                                                             ]
                                                                         }
                                                                             "xtype": "VBox",
                                                                             "|xns": "Gtk",
                                                                             "items": [
+                                                                                {
+                                                                                    "pack": "pack_start,false,true,0",
+                                                                                    "xtype": "HBox",
+                                                                                    "|xns": "Gtk",
+                                                                                    "items": [
+                                                                                        {
+                                                                                            "listeners": {
+                                                                                                "clicked": "function (self) {\n  this.get('/RightBrowser.view').renderJS(null,true);\n}"
+                                                                                            },
+                                                                                            "label": "Redraw",
+                                                                                            "pack": "pack_start,false,false,0",
+                                                                                            "xtype": "Button",
+                                                                                            "|xns": "Gtk"
+                                                                                        },
+                                                                                        {
+                                                                                            "listeners": {
+                                                                                                "toggled": "function (self, state) {\n    this.el.set_label(this.el.active  ? \"Auto Redraw On\" : \"Auto Redraw Off\");\n}"
+                                                                                            },
+                                                                                            "active": true,
+                                                                                            "id": "AutoRedraw",
+                                                                                            "label": "Auto Redraw On",
+                                                                                            "pack": "pack_start,false,false,0",
+                                                                                            "xtype": "CheckButton",
+                                                                                            "|xns": "Gtk"
+                                                                                        }
+                                                                                    ]
+                                                                                },
                                                                                 {
                                                                                     "pack": "add",
                                                                                     "xtype": "ScrolledWindow",
                                                                                                 "drag_data_received": "function (w, ctx,  x,  y, sel_data,  target_type,  time, ud) \n    {\n        print(\"Browser: drag-data-received\");\n        var delete_selection_data = false;\n        vardnd_success = false;\n        /* Deal with what we are given from source */\n        if( sel_data && sel_data.length ) {\n            \n            if (ctx.action == Gdk.DragAction.ASK)  {\n                /* Ask the user to move or copy, then set the ctx action. */\n            }\n\n            if (ctx.action == Gdk.DragAction.MOVE) {\n                delete_selection_data = true;\n            }\n            var source = Gtk.drag_get_source_widget(ctx);\n\n            print(\"Browser: source.DRAGDATA? \" + source.dragData);\n            if (this.targetData) {\n                print(this.targetData);\n                this.get('/LeftTree.model').dropNode(this.targetData,  source.dragData);\n            }\n            \n            \n            \n            dnd_success = true;\n\n        }\n\n        if (dnd_success == false)\n        {\n                Seed.print (\"DnD data transfer failed!\\n\");\n        }\n        \n        Gtk.drag_finish (ctx, dnd_success, delete_selection_data, time);\n        return true;\n    }",
                                                                                                 "create_web_view": "function (self, object) {\n  print(\"CREATE WEB VIEW\");\n   return null; //new WebKit.WebView();\n}"
                                                                                             },
+                                                                                            "redraws": 0,
                                                                                             "id": "view",
                                                                                             "pack": "add",
                                                                                             "xtype": "WebView",
                                                                                             "|init": "function() {\n    XObject.prototype.init.call(this);\n    // this may not work!?\n    var settings =  this.el.get_settings();\n    settings.enable_developer_extras = true;\n    \n    // this was an attempt to change the url perms.. did not work..\n    // settings.enable_file_access_from_file_uris = true;\n    // settings.enable_offline_web_application_cache - true;\n    // settings.enable_universal_access_from_file_uris = true;\n    var _this = this;\n     \n     // init inspector..\n    this.el.get_inspector().signal.inspect_web_view.connect(function(wi, pg) {\n         _this.get('/BottomPane.inspector').el.show();\n         return _this.get('/BottomPane.inspector').el;\n    \n    });\n     \n     // FIXME - base url of script..\n     // we need it so some of the database features work.\n    this.el.load_html_string( \"Render not ready\" , \n            //fixme - should be a config option!\n            // or should we catch stuff and fix it up..\n            'http://localhost/app.Builder/'\n    );\n        \n        \n   //this.el.open('file:///' + __script_path__ + '/../builder.html');\n                          \n    Gtk.drag_dest_set\n    (\n            this.el,              /* widget that will accept a drop */\n            Gtk.DestDefaults.MOTION  | Gtk.DestDefaults.HIGHLIGHT,\n            null,            /* lists of target to support */\n            0,              /* size of list */\n            Gdk.DragAction.COPY         /* what to do with data after dropped */\n    );\n                            \n   // print(\"RB: TARGETS : \" + LeftTree.atoms[\"STRING\"]);\n    Gtk.drag_dest_set_target_list(this.el, this.get('/Window').targetList);\n    \n    GLib.timeout_add_seconds(0, 1, function() {\n        //    print(\"run refresh?\");\n         _this.runRefresh(); \n         return true;\n     });\n    \n    \n}\n",
-                                                                                            "|renderJS": "function(data) {\n    this.refreshRequired  = true;\n}\n",
-                                                                                            "|runRefresh": "function() \n{\n    // this is run every 2 seconds from the init..\n\n  \n    \n    if (!this.refreshRequired) {\n       // print(\"no refresh required\");\n        return;\n    }\n\n    if (this.lastRedraw) {\n       // do not redraw if last redraw was less that 5 seconds ago.\n       if (((new Date()) -  this.lastRedraw) < 5000) {\n            return;\n        }\n    }\n    \n    \n    \n    \n     if (!this.get('/Window.LeftTree').getActiveFile()) {\n        return;\n     }\n     this.refreshRequired = false;\n   //  print(\"HTML RENDERING\");\n     \n     this.get('/BottomPane').el.show();\n     this.get('/BottomPane').el.set_current_page(2);// webkit inspector\n\n    \n    var js = this.get('/LeftTree.model').toJS();\n    if (!js || !js.length) {\n        print(\"no data\");\n        return;\n    }\n    var  data = js[0];\n    \n    \n     var project = this.get('/Window.LeftTree').getActiveFile().project;\n     //print (project.fn);\n     // set it to non-empty.\n     project.runhtml  =     project.runhtml  || '';\n     project.runhtml  = project.runhtml.length ?  project.runhtml : '<script type=\"text/javascript\"></script>'; \n    \n\n     this.runhtml  = this.runhtml || '';\n    \n     if (project.runhtml != this.runhtml) {\n        // then we need to reload the browser using\n        // load_html_string..\n        \n        // then trigger a redraw once it's loaded..\n        this.pendingRedraw = true;\n         var runhtml = '<script type=\"text/javascript\">' + \"\\n\" ;\n         runhtml +=imports.File.File.read(__script_path__ + '/../builder.html.js') + \"\\n\";\n         runhtml += '</script>'+ \"\\n\" ;\n        \n        this.runhtml = project.runhtml;\n        // need to modify paths\n        \n        \n        \n        var html = imports.File.File.read(__script_path__ + '/../builder.html');\n        html = html.replace('</head>', runhtml + this.runhtml + '</head>');\n        print(\"LOAD HTML \" + html);\n        this.el.load_html_string( html , \n            //fixme - should be a config option!\n            'http://localhost/app.Builder/'\n        );\n        \n        // should trigger load_finished! - which in truns shoudl set refresh Required;\n        return;\n    \n    }\n    \n    \n    this.renderedData = data;\n    var str = JSON.stringify(data) ;\n    \n    if (!this.ready) {\n        console.log('not loaded yet');\n    }\n    this.lastRedraw = new Date();\n\n    this.el.execute_script(\"Builder.render(\" + JSON.stringify(data) + \");\");\n     print( \"before render\" +    this.lastRedraw);\n    print( \"after render\" +    (new Date()));\n    \n}\n",
+                                                                                            "|renderJS": "function(data, force) {\n\n    // this is the public redraw call..\n    // we refresh in a loop privately..\n    var autodraw = this.get('/RightBrowser.AutoRedraw').el.active;\n    if (!autodraw && !force) {\n        print(\"Skipping redraw - no force, and autodraw off\");\n        return;\n    }\n    this.refreshRequired  = true;\n}\n",
+                                                                                            "|runRefresh": "function() \n{\n    // this is run every 2 seconds from the init..\n\n  \n    \n    if (!this.refreshRequired) {\n       // print(\"no refresh required\");\n        return;\n    }\n\n    if (this.lastRedraw) {\n       // do not redraw if last redraw was less that 5 seconds ago.\n       if (((new Date()) -  this.lastRedraw) < 5000) {\n            return;\n        }\n    }\n    \n    \n    \n    \n     if (!this.get('/Window.LeftTree').getActiveFile()) {\n        return;\n     }\n     this.refreshRequired = false;\n   //  print(\"HTML RENDERING\");\n     \n     this.get('/BottomPane').el.show();\n     this.get('/BottomPane').el.set_current_page(2);// webkit inspector\n\n    \n    var js = this.get('/LeftTree.model').toJS();\n    if (!js || !js.length) {\n        print(\"no data\");\n        return;\n    }\n    var  data = js[0];\n    this.redraws++;\n    \n     var project = this.get('/Window.LeftTree').getActiveFile().project;\n     //print (project.fn);\n     // set it to non-empty.\n     project.runhtml  =     project.runhtml  || '';\n     project.runhtml  = project.runhtml.length ?  project.runhtml : '<script type=\"text/javascript\"></script>'; \n    \n\n     this.runhtml  = this.runhtml || '';\n    \n     if ((project.runhtml != this.runhtml) || (this.redraws > 10)) {\n        // then we need to reload the browser using\n        // load_html_string..\n        \n        // then trigger a redraw once it's loaded..\n        this.pendingRedraw = true;\n         var runhtml = '<script type=\"text/javascript\">' + \"\\n\" ;\n         runhtml +=imports.File.File.read(__script_path__ + '/../builder.html.js') + \"\\n\";\n         runhtml += '</script>'+ \"\\n\" ;\n        \n        this.runhtml = project.runhtml;\n        // need to modify paths\n        \n        \n        \n        var html = imports.File.File.read(__script_path__ + '/../builder.html');\n        html = html.replace('</head>', runhtml + this.runhtml + '</head>');\n        print(\"LOAD HTML \" + html);\n        this.el.load_html_string( html , \n            //fixme - should be a config option!\n            'http://localhost/app.Builder/'\n        );\n        this.redraws = 0;\n        // should trigger load_finished! - which in truns shoudl set refresh Required;\n        return;\n    \n    }\n    \n    \n    this.renderedData = data;\n    var str = JSON.stringify(data) ;\n    \n    if (!this.ready) {\n        console.log('not loaded yet');\n    }\n    this.lastRedraw = new Date();\n\n    this.el.execute_script(\"Builder.render(\" + JSON.stringify(data) + \");\");\n     print( \"before render\" +    this.lastRedraw);\n    print( \"after render\" +    (new Date()));\n    \n}\n",
                                                                                             "|xns": "WebKit"
                                                                                         }
                                                                                     ]
                                                     "id": "BottomPane",
                                                     "pack": "add",
                                                     "xtype": "Notebook",
-                                                    "|init": "function() {\n    XObject.prototype.init.call(this);\n\tthis.el.set_tab_label(this.items[0].el, new Gtk.Label({ label : \"Code Editor\" }));\n    \tthis.el.set_tab_label(this.items[1].el, new Gtk.Label({ label : \"Console\" }));\n    \tthis.el.set_tab_label(this.items[2].el, new Gtk.Label({ label : \"Inspector\" }));\n}\n",
+                                                    "|init": "function() {\n    XObject.prototype.init.call(this);\n\t//this.el.set_tab_label(this.items[0].el, new Gtk.Label({ label : \"Code Editor\" }));\n    \tthis.el.set_tab_label(this.items[0].el, new Gtk.Label({ label : \"Console\" }));\n    \tthis.el.set_tab_label(this.items[1].el, new Gtk.Label({ label : \"Inspector\" }));\n}\n",
                                                     "|xns": "Gtk",
                                                     "items": [
-                                                        {
-                                                            "|xns": "Gtk",
-                                                            "xtype": "ScrolledWindow",
-                                                            "pack": "add",
-                                                            "id": "RightEditor",
-                                                            "items": [
-                                                                {
-                                                                    "|xns": "GtkSource",
-                                                                    "xtype": "View",
-                                                                    "pack": "add",
-                                                                    "id": "view",
-                                                                    "|init": "function() {\n    XObject.prototype.init.call(this);\n     var description = Pango.Font.description_from_string(\"monospace\")\n    description.set_size(8000);\n    this.el.modify_font(description);\n\n}\n",
-                                                                    "|load": "function(str) {\n\n// show the help page for the active node..\n   this.get('/Help').show();\n\n\n   this.get('/BottomPane').el.set_current_page(0);\n    this.el.get_buffer().set_text(str, str.length);\n    var lm = GtkSource.LanguageManager.get_default();\n    \n    this.el.get_buffer().set_language(lm.get_language('js'));\n    var buf = this.el.get_buffer();\n    var cursor = buf.get_mark(\"insert\");\n    var iter= new Gtk.TextIter;\n    buf.get_iter_at_mark(iter, cursor);\n    iter.set_line(1);\n    iter.set_line_offset(4);\n    buf.move_mark(cursor, iter);\n    \n    \n    cursor = buf.get_mark(\"selection_bound\");\n    iter= new Gtk.TextIter;\n    buf.get_iter_at_mark(iter, cursor);\n    iter.set_line(1);\n    iter.set_line_offset(4);\n    buf.move_mark(cursor, iter);\n     \n    this.el.grab_focus();\n}",
-                                                                    "|insert_spaces_instead_of_tabs": true,
-                                                                    "indent_width": 4,
-                                                                    "|auto_indent": true,
-                                                                    "|show_line_numbers": true,
-                                                                    "items": [
-                                                                        {
-                                                                            "listeners": {
-                                                                                "changed": "function (self) {\n    var s = new Gtk.TextIter();\n    var e = new Gtk.TextIter();\n    this.el.get_start_iter(s);\n    this.el.get_end_iter(e);\n    var str = this.el.get_text(s,e,true);\n    try {\n        Seed.check_syntax('var e = ' + str);\n    } catch (e) {\n        this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({\n            red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC\n           }));\n        //print(\"SYNTAX ERROR IN EDITOR\");   \n        //print(e);\n        //console.dump(e);\n        return;\n    }\n    this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({\n            red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF\n           }));\n    \n     this.get('/LeftPanel.model').changed(  str , false);\n}"
-                                                                            },
-                                                                            "pack": "set_buffer",
-                                                                            "xtype": "Buffer",
-                                                                            "|xns": "GtkSource"
-                                                                        }
-                                                                    ]
-                                                                }
-                                                            ]
-                                                        },
                                                         {
                                                             "|xns": "Gtk",
                                                             "xtype": "ScrolledWindow",