Attribute changed old-javascript
authorAlan Knowles <alan@akbkhome.com>
Sun, 1 Feb 2015 13:32:29 +0000 (21:32 +0800)
committerAlan Knowles <alan@akbkhome.com>
Sun, 1 Feb 2015 13:32:29 +0000 (21:32 +0800)
128 files changed:
old-javascript/Builder3/About.bjs [new file with mode: 0644]
old-javascript/Builder3/About.js [new file with mode: 0644]
old-javascript/Builder3/DialogConfirm.bjs [new file with mode: 0644]
old-javascript/Builder3/DialogConfirm.js [new file with mode: 0644]
old-javascript/Builder3/DialogNewComponent.bjs [new file with mode: 0644]
old-javascript/Builder3/DialogNewComponent.js [new file with mode: 0644]
old-javascript/Builder3/DialogSaveTemplate.bjs [new file with mode: 0644]
old-javascript/Builder3/DialogSaveTemplate.js [new file with mode: 0644]
old-javascript/Builder3/DialogTemplateSelect.bjs [new file with mode: 0644]
old-javascript/Builder3/DialogTemplateSelect.js [new file with mode: 0644]
old-javascript/Builder3/EditProject.bjs [new file with mode: 0644]
old-javascript/Builder3/EditProject.js [new file with mode: 0644]
old-javascript/Builder3/Editor.bjs [new file with mode: 0644]
old-javascript/Builder3/Editor.js [new file with mode: 0644]
old-javascript/Builder3/Globals.js [new file with mode: 0644]
old-javascript/Builder3/Main.js [new file with mode: 0644]
old-javascript/Builder3/RooProjectProperties.bjs [new file with mode: 0644]
old-javascript/Builder3/RooProjectProperties.js [new file with mode: 0644]
old-javascript/Builder3/StandardErrorDialog.bjs [new file with mode: 0644]
old-javascript/Builder3/StandardErrorDialog.js [new file with mode: 0644]
old-javascript/Builder3/Window.bjs [new file with mode: 0644]
old-javascript/Builder3/Window.js [new file with mode: 0644]
old-javascript/Builder4/About.bjs [new file with mode: 0644]
old-javascript/Builder4/About.vala [new file with mode: 0644]
old-javascript/Builder4/Application.vala [new file with mode: 0644]
old-javascript/Builder4/ClutterFiles.bjs [new file with mode: 0644]
old-javascript/Builder4/ClutterFiles.vala [new file with mode: 0644]
old-javascript/Builder4/DialogConfirm.bjs [new file with mode: 0644]
old-javascript/Builder4/DialogConfirm.vala [new file with mode: 0644]
old-javascript/Builder4/DialogNewComponent.bjs [new file with mode: 0644]
old-javascript/Builder4/DialogNewComponent.vala [new file with mode: 0644]
old-javascript/Builder4/DialogSaveModule.bjs [new file with mode: 0644]
old-javascript/Builder4/DialogSaveModule.vala [new file with mode: 0644]
old-javascript/Builder4/DialogSaveTemplate.bjs [new file with mode: 0644]
old-javascript/Builder4/DialogSaveTemplate.vala [new file with mode: 0644]
old-javascript/Builder4/DialogTemplateSelect.bjs [new file with mode: 0644]
old-javascript/Builder4/DialogTemplateSelect.vala [new file with mode: 0644]
old-javascript/Builder4/EditProject.bjs [new file with mode: 0644]
old-javascript/Builder4/EditProject.vala [new file with mode: 0644]
old-javascript/Builder4/Editor.bjs [new file with mode: 0644]
old-javascript/Builder4/Editor.vala [new file with mode: 0644]
old-javascript/Builder4/GladeExtras.vala [new file with mode: 0644]
old-javascript/Builder4/GladeView.bjs [new file with mode: 0644]
old-javascript/Builder4/GladeView.vala [new file with mode: 0644]
old-javascript/Builder4/GtkView.bjs [new file with mode: 0644]
old-javascript/Builder4/GtkView.vala [new file with mode: 0644]
old-javascript/Builder4/Main.vala [new file with mode: 0644]
old-javascript/Builder4/MainWindow.bjs [new file with mode: 0644]
old-javascript/Builder4/MainWindow.vala [new file with mode: 0644]
old-javascript/Builder4/ProjectSettings.bjs [new file with mode: 0644]
old-javascript/Builder4/ProjectSettings.vala [new file with mode: 0644]
old-javascript/Builder4/RooProjectProperties.bjs [new file with mode: 0644]
old-javascript/Builder4/RooProjectProperties.vala [new file with mode: 0644]
old-javascript/Builder4/StandardErrorDialog.bjs [new file with mode: 0644]
old-javascript/Builder4/StandardErrorDialog.vala [new file with mode: 0644]
old-javascript/Builder4/ValaProjectSettings.bjs [new file with mode: 0644]
old-javascript/Builder4/ValaProjectSettings.vala [new file with mode: 0644]
old-javascript/Builder4/WindowAddProp.bjs [new file with mode: 0644]
old-javascript/Builder4/WindowAddProp.vala [new file with mode: 0644]
old-javascript/Builder4/WindowLeftProjects.bjs [new file with mode: 0644]
old-javascript/Builder4/WindowLeftProjects.vala [new file with mode: 0644]
old-javascript/Builder4/WindowLeftProps.bjs [new file with mode: 0644]
old-javascript/Builder4/WindowLeftProps.vala [new file with mode: 0644]
old-javascript/Builder4/WindowLeftTree.bjs [new file with mode: 0644]
old-javascript/Builder4/WindowLeftTree.vala [new file with mode: 0644]
old-javascript/Builder4/WindowRightPalete.bjs [new file with mode: 0644]
old-javascript/Builder4/WindowRightPalete.vala [new file with mode: 0644]
old-javascript/Builder4/WindowRooView.bjs [new file with mode: 0644]
old-javascript/Builder4/WindowRooView.vala [new file with mode: 0644]
old-javascript/Builder4/config1.builder [new file with mode: 0644]
old-javascript/JSDOC/Collapse.js [new file with mode: 0644]
old-javascript/JSDOC/Identifier.js [new file with mode: 0644]
old-javascript/JSDOC/Lang.js [new file with mode: 0644]
old-javascript/JSDOC/TextStream.js [new file with mode: 0644]
old-javascript/JSDOC/Token.js [new file with mode: 0644]
old-javascript/JSDOC/TokenReader.js [new file with mode: 0644]
old-javascript/JSDOC/TokenStream.js [new file with mode: 0644]
old-javascript/JsRender/Base.js [new file with mode: 0644]
old-javascript/JsRender/Gtk.js [new file with mode: 0644]
old-javascript/JsRender/Gtk.vala [new file with mode: 0644]
old-javascript/JsRender/JsRender.vala [new file with mode: 0644]
old-javascript/JsRender/Lang.js [new file with mode: 0644]
old-javascript/JsRender/Lang.vala [new file with mode: 0644]
old-javascript/JsRender/Node.vala [new file with mode: 0644]
old-javascript/JsRender/NodeToGlade.vala [new file with mode: 0644]
old-javascript/JsRender/NodeToGtk.vala [new file with mode: 0644]
old-javascript/JsRender/NodeToJs.vala [new file with mode: 0644]
old-javascript/JsRender/NodeToVala.vala [new file with mode: 0644]
old-javascript/JsRender/Roo.js [new file with mode: 0644]
old-javascript/JsRender/Roo.vala [new file with mode: 0644]
old-javascript/JsRender/webkit_extension.c [new file with mode: 0644]
old-javascript/Palete/Base.js [new file with mode: 0644]
old-javascript/Palete/Gir.vala [new file with mode: 0644]
old-javascript/Palete/Gtk.js [new file with mode: 0644]
old-javascript/Palete/Gtk.vala [new file with mode: 0644]
old-javascript/Palete/GtkUsage.txt [new file with mode: 0644]
old-javascript/Palete/Javascript.vala [new file with mode: 0644]
old-javascript/Palete/Palete.vala [new file with mode: 0644]
old-javascript/Palete/Roo.js [new file with mode: 0755]
old-javascript/Palete/Roo.vala [new file with mode: 0644]
old-javascript/Palete/RooUsage.txt [new file with mode: 0644]
old-javascript/Palete/ValaSource.vala [new file with mode: 0644]
old-javascript/Palete/rooprops.json [new symlink]
old-javascript/Project/Base.js [new file with mode: 0644]
old-javascript/Project/Gtk.js [new file with mode: 0755]
old-javascript/Project/Gtk.vala [new file with mode: 0644]
old-javascript/Project/Project.vala [new file with mode: 0644]
old-javascript/Project/Roo.js [new file with mode: 0755]
old-javascript/Project/Roo.vala [new file with mode: 0644]
old-javascript/XObjectBase/GdkDockBar.js [new file with mode: 0644]
old-javascript/XObjectBase/GdlDock.js [new file with mode: 0644]
old-javascript/XObjectBase/GdlDockItem.js [new file with mode: 0644]
old-javascript/XObjectBase/GtkCellRendererText.js [new file with mode: 0644]
old-javascript/XObjectBase/GtkCellRendererToggle.js [new file with mode: 0644]
old-javascript/XObjectBase/GtkClutterActor.js [new file with mode: 0644]
old-javascript/XObjectBase/GtkClutterEmbed.js [new file with mode: 0644]
old-javascript/XObjectBase/GtkExpander.js [new file with mode: 0644]
old-javascript/XObjectBase/GtkListStore.js [new file with mode: 0644]
old-javascript/XObjectBase/GtkNotebook.js [new file with mode: 0644]
old-javascript/XObjectBase/GtkScrolledWindow.js [new file with mode: 0644]
old-javascript/XObjectBase/GtkTable.js [new file with mode: 0644]
old-javascript/XObjectBase/GtkTreeModelFilter.js [new file with mode: 0644]
old-javascript/XObjectBase/GtkTreeSelection.js [new file with mode: 0644]
old-javascript/XObjectBase/GtkTreeStore.js [new file with mode: 0644]
old-javascript/XObjectBase/GtkTreeView.js [new file with mode: 0644]
old-javascript/XObjectBase/GtkTreeViewColumn.js [new file with mode: 0644]
old-javascript/XObjectBase/WebKitWebView.js [new file with mode: 0644]
old-javascript/builder.sh [new file with mode: 0755]

diff --git a/old-javascript/Builder3/About.bjs b/old-javascript/Builder3/About.bjs
new file mode 100644 (file)
index 0000000..a304008
--- /dev/null
@@ -0,0 +1,24 @@
+{
+    "id": "file-gtk-8",
+    "name": "About",
+    "parent": "",
+    "title": false,
+    "path": "/home/alan/gitlive/app.Builder.js/Sample/About.bjs",
+    "items": [
+        {
+            "listeners": {
+                "response": "function (self, response_id) {\n    this.el.hide();\n}",
+                "delete_event": "function (self, event) {\n    this.el.hide();\n    return true;\n}"
+            },
+            "authors": "Alan Knowles",
+            "copyright": "LGPL",
+            "license": "LGPL",
+            "program_name": "app.Builder.js",
+            "website": "http://www.akbkhome.com/blog.php",
+            "xtype": "AboutDialog",
+            "|modal": true,
+            "|xns": "Gtk"
+        }
+    ],
+    "permname": ""
+}
\ No newline at end of file
diff --git a/old-javascript/Builder3/About.js b/old-javascript/Builder3/About.js
new file mode 100644 (file)
index 0000000..122b621
--- /dev/null
@@ -0,0 +1,31 @@
+Gtk = imports.gi.Gtk;
+Gdk = imports.gi.Gdk;
+Pango = imports.gi.Pango;
+GLib = imports.gi.GLib;
+Gio = imports.gi.Gio;
+GObject = imports.gi.GObject;
+GtkSource = imports.gi.GtkSource;
+WebKit = imports.gi.WebKit;
+Vte = imports.gi.Vte;
+ console = imports.console;
+XObject = imports.XObject.XObject;
+About=new XObject({
+    xtype: Gtk.AboutDialog,
+    listeners : {
+        response : function (self, response_id) {
+            this.el.hide();
+        },
+        delete_event : function (self, event) {
+            this.el.hide();
+            return true;
+        }
+    },
+    authors : "Alan Knowles",
+    copyright : "LGPL",
+    license : "LGPL",
+    program_name : "app.Builder.js",
+    website : "http://www.akbkhome.com/blog.php",
+    modal : true
+});
+About.init();
+XObject.cache['/About'] = About;
diff --git a/old-javascript/Builder3/DialogConfirm.bjs b/old-javascript/Builder3/DialogConfirm.bjs
new file mode 100644 (file)
index 0000000..9652e90
--- /dev/null
@@ -0,0 +1 @@
+{"id":"file-gtk-9","name":"DialogConfirm","parent":"","title":false,"path":"/home/alan/gitlive/app.Builder.js/Sample/DialogConfirm.bjs","items":[{"|xns":"Gtk","xtype":"MessageDialog","|show":"function(msg, success) {\n     if (!this.el) {\n            this.init();\n        }\n     this.success = success;\n        this.el.text =  msg;\n        this.el.show_all();\n\n}\n","|buttons":"Gtk.ButtonsType.YES_NO","title":"Please Confirm","|message_type":"Gtk.MessageType.QUESTION","|use_markup":true,"text":"-","|modal":true,"listeners":{"response":"function (self, response_id) {\n   this.el.hide();\nprint(\"RESPOSE: \" + response_id);\n    if (response_id == -8) { //yes!\n   print(\"CALL SUCCES?\")\n      this.success();\n    }\n}","delete_event":"function (self, event) {\n    this.el.hide();\n    return true;\n}"}}]}
\ No newline at end of file
diff --git a/old-javascript/Builder3/DialogConfirm.js b/old-javascript/Builder3/DialogConfirm.js
new file mode 100644 (file)
index 0000000..70703ac
--- /dev/null
@@ -0,0 +1,45 @@
+Gtk = imports.gi.Gtk;
+Gdk = imports.gi.Gdk;
+Pango = imports.gi.Pango;
+GLib = imports.gi.GLib;
+Gio = imports.gi.Gio;
+GObject = imports.gi.GObject;
+GtkSource = imports.gi.GtkSource;
+WebKit = imports.gi.WebKit;
+Vte = imports.gi.Vte;
+console = imports.console;
+XObject = imports.XObject.XObject;
+DialogConfirm=new XObject({
+    xtype: Gtk.MessageDialog,
+    show : function(msg, success) {
+         if (!this.el) {
+                this.init();
+            }
+         this.success = success;
+            this.el.text =  msg;
+            this.el.show_all();
+    
+    },
+    buttons : Gtk.ButtonsType.YES_NO,
+    title : "Please Confirm",
+    message_type : Gtk.MessageType.QUESTION,
+    use_markup : true,
+    text : "-",
+    modal : true,
+    listeners : {
+        response : function (self, response_id) {
+           this.el.hide();
+        print("RESPOSE: " + response_id);
+            if (response_id == -8) { //yes!
+           print("CALL SUCCES?")
+              this.success();
+            }
+        },
+        delete_event : function (self, event) {
+            this.el.hide();
+            return true;
+        }
+    }
+});
+DialogConfirm.init();
+XObject.cache['/DialogConfirm'] = DialogConfirm;
diff --git a/old-javascript/Builder3/DialogNewComponent.bjs b/old-javascript/Builder3/DialogNewComponent.bjs
new file mode 100644 (file)
index 0000000..f0be17b
--- /dev/null
@@ -0,0 +1,158 @@
+{
+    "id": "file-gtk-2",
+    "name": "DialogNewComponent",
+    "parent": "",
+    "title": false,
+    "path": "/home/alan/gitlive/app.Builder.js/Sample/DialogNewComponent.bjs",
+    "items": [
+        {
+            "listeners": {
+                "delete_event": "function (self, event) {\n    this.el.hide();\n    return true;\n}",
+                "response": "function (self, response_id) {\n\tif (response_id < 1) { // cancel!\n            this.el.hide();\n            return;\n        }\n\n        if (!this.get('name').el.get_text().length ) {\n            this.get('/StandardErrorDialog').show(\n                \"You have to set Project name \"\n            );\n             \n            return;\n        }\n        var isNew = this.file.name.length ? false : true;\n        \n        if (this.file.name.length && this.file.name != this.get('name').el.get_text()) {\n            this.get('/StandardErrorDialog').show(\n                \"Sorry changing names does not work yet. \"\n            );\n             \n            return;\n        }\n        for (var i in this.def) {\n            this.file[i] =  this.get(i).el.get_text();\n        }\n       \n        if (!isNew) {\n            this.file.save();\n            this.el.hide();\n            return;\n        }\n       \n    \n\tvar dir ='';\n        for (var i in this.project.paths) {\n \t\tdir = i;\n\t\tbreak;\n\t}\n\n \n        \n        // what about .js ?\n         if (GLib.file_test (GLib.dir + '/' + this.file.name + '.bjs', GLib.FileTest.EXISTS)) {\n            StandardErrorDialog.show(\n                \"That file already exists\"\n            ); \n            return;\n        }\n        this.el.hide();\n        \n        \n        //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());\n        \n        var _this = this;\n        var nf = _this.project.create(dir + '/' + this.file.name + '.bjs');\n        for (var i in this.file) {\n            nf[i] = this.file[i];\n        }\n        if (this.get('/DialogNewComponent').success) {\n            this.get('/DialogNewComponent').success(_this.project, nf);\n        }\n}",
+                "show": "function (self) {\n  this.el.show_all();\n}"
+            },
+            "default_height": 200,
+            "default_width": 500,
+            "id": "DialogNewComponent",
+            "title": "New Component",
+            "xtype": "Dialog",
+            "|deletable": false,
+            "|modal": true,
+            "|show": "function (c) \n{\n    this.project = c.project;\n    if (!this.el) {\n        this.init();\n    }\n    this.def =  { \n        name : '' , \n        title : '' ,\n        region : '' ,\n        parent: '',\n      //  disable: '',\n        modOrder : '0',\n        permname : ''\n    };\n    for (var i in this.def) {\n        c[i] = c[i] || this.def[i];\n        this.get(i).el.set_text(c[i]);\n    }\n    if (c.name) {\n        this.el.set_title(\"Edit File Details - \" + c.name);\n    } else {\n        this.el.set_title(\"Create New File\");\n    }\n     \n    this.file = c;\n    console.log('show all');\n    this.el.show_all();\n    this.success = c.success;\n    \n    \n}",
+            "|xns": "Gtk",
+            "items": [
+                {
+                    "|xns": "Gtk",
+                    "xtype": "VBox",
+                    "|pack": "function(p,e) {\n                    p.el.get_content_area().add(e.el)\n                }\n",
+                    "items": [
+                        {
+                            "n_columns": 2,
+                            "n_rows": 3,
+                            "pack": "pack_start,false,false,0",
+                            "xtype": "Table",
+                            "|homogeneous": false,
+                            "|xns": "Gtk",
+                            "items": [
+                                {
+                                    "label": "Component Name",
+                                    "pack": "add",
+                                    "x_options": 4,
+                                    "xalign": 0.9,
+                                    "xtype": "Label",
+                                    "|justify": "Gtk.Justification.RIGHT",
+                                    "|xns": "Gtk"
+                                },
+                                {
+                                    "id": "name",
+                                    "pack": "add",
+                                    "xtype": "Entry",
+                                    "|visible": true,
+                                    "|xns": "Gtk"
+                                },
+                                {
+                                    "label": "Title",
+                                    "pack": "add",
+                                    "x_options": 4,
+                                    "xalign": 0.9,
+                                    "xtype": "Label",
+                                    "|justify": "Gtk.Justification.RIGHT",
+                                    "|visible": true,
+                                    "|xns": "Gtk"
+                                },
+                                {
+                                    "id": "title",
+                                    "pack": "add",
+                                    "xtype": "Entry",
+                                    "|visible": true,
+                                    "|xns": "Gtk"
+                                },
+                                {
+                                    "label": "Region",
+                                    "pack": "add",
+                                    "tooltip_text": "center, north, south, east, west",
+                                    "x_options": 4,
+                                    "xalign": 0.9,
+                                    "xtype": "Label",
+                                    "|justify": "Gtk.Justification.RIGHT",
+                                    "|visible": true,
+                                    "|xns": "Gtk"
+                                },
+                                {
+                                    "id": "region",
+                                    "pack": "add",
+                                    "xtype": "Entry",
+                                    "|visible": true,
+                                    "|xns": "Gtk"
+                                },
+                                {
+                                    "label": "Parent Name",
+                                    "pack": "add",
+                                    "x_options": 4,
+                                    "xalign": 0.9,
+                                    "xtype": "Label",
+                                    "|justify": "Gtk.Justification.RIGHT",
+                                    "|visible": true,
+                                    "|xns": "Gtk"
+                                },
+                                {
+                                    "id": "parent",
+                                    "pack": "add",
+                                    "xtype": "Entry",
+                                    "|visible": true,
+                                    "|xns": "Gtk"
+                                },
+                                {
+                                    "label": "Permission Name",
+                                    "pack": "add",
+                                    "x_options": 4,
+                                    "xalign": 0.9,
+                                    "xtype": "Label",
+                                    "|justify": "Gtk.Justification.RIGHT",
+                                    "|visible": true,
+                                    "|xns": "Gtk"
+                                },
+                                {
+                                    "id": "permname",
+                                    "pack": "add",
+                                    "xtype": "Entry",
+                                    "|visible": true,
+                                    "|xns": "Gtk"
+                                },
+                                {
+                                    "label": "Order (for tabs)",
+                                    "pack": "add",
+                                    "x_options": 4,
+                                    "xalign": 0.9,
+                                    "xtype": "Label",
+                                    "|justify": "Gtk.Justification.RIGHT",
+                                    "|visible": true,
+                                    "|xns": "Gtk"
+                                },
+                                {
+                                    "id": "modOrder",
+                                    "pack": "add",
+                                    "xtype": "Entry",
+                                    "|visible": true,
+                                    "|xns": "Gtk"
+                                }
+                            ]
+                        }
+                    ]
+                },
+                {
+                    "|xns": "Gtk",
+                    "xtype": "Button",
+                    "pack": "add_action_widget,0",
+                    "label": "Cancel"
+                },
+                {
+                    "|xns": "Gtk",
+                    "xtype": "Button",
+                    "pack": "add_action_widget,1",
+                    "label": "OK"
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder3/DialogNewComponent.js b/old-javascript/Builder3/DialogNewComponent.js
new file mode 100644 (file)
index 0000000..ed0375c
--- /dev/null
@@ -0,0 +1,244 @@
+Gtk = imports.gi.Gtk;
+Gdk = imports.gi.Gdk;
+Pango = imports.gi.Pango;
+GLib = imports.gi.GLib;
+Gio = imports.gi.Gio;
+GObject = imports.gi.GObject;
+GtkSource = imports.gi.GtkSource;
+WebKit = imports.gi.WebKit;
+Vte = imports.gi.Vte;
+console = imports.console;
+XObject = imports.XObject.XObject;
+DialogNewComponent=new XObject({
+    xtype: Gtk.Dialog,
+    listeners : {
+        delete_event : function (self, event) {
+            this.el.hide();
+            return true;
+        },
+        response : function (self, response_id) {
+               if (response_id < 1) { // cancel!
+                    this.el.hide();
+                    return;
+                }
+        
+                if (!this.get('name').el.get_text().length ) {
+                    this.get('/StandardErrorDialog').show(
+                        "You have to set Project name "
+                    );
+                     
+                    return;
+                }
+                var isNew = this.file.name.length ? false : true;
+                
+                if (this.file.name.length && this.file.name != this.get('name').el.get_text()) {
+                    this.get('/StandardErrorDialog').show(
+                        "Sorry changing names does not work yet. "
+                    );
+                     
+                    return;
+                }
+                for (var i in this.def) {
+                    this.file[i] =  this.get(i).el.get_text();
+                }
+               
+                if (!isNew) {
+                    this.file.save();
+                    this.el.hide();
+                    return;
+                }
+               
+            
+               var dir ='';
+                for (var i in this.project.paths) {
+                       dir = i;
+                       break;
+               }
+        
+         
+                
+                // what about .js ?
+                 if (GLib.file_test (GLib.dir + '/' + this.file.name + '.bjs', GLib.FileTest.EXISTS)) {
+                    StandardErrorDialog.show(
+                        "That file already exists"
+                    ); 
+                    return;
+                }
+                this.el.hide();
+                
+                
+                //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());
+                
+                var _this = this;
+                var nf = _this.project.create(dir + '/' + this.file.name + '.bjs');
+                for (var i in this.file) {
+                    nf[i] = this.file[i];
+                }
+                if (this.get('/DialogNewComponent').success) {
+                    this.get('/DialogNewComponent').success(_this.project, nf);
+                }
+        },
+        show : function (self) {
+          this.el.show_all();
+        }
+    },
+    default_height : 200,
+    default_width : 500,
+    id : "DialogNewComponent",
+    title : "New Component",
+    deletable : false,
+    modal : true,
+    show : function (c) 
+    {
+        this.project = c.project;
+        if (!this.el) {
+            this.init();
+        }
+        this.def =  { 
+            name : '' , 
+            title : '' ,
+            region : '' ,
+            parent: '',
+          //  disable: '',
+            modOrder : '0',
+            permname : ''
+        };
+        for (var i in this.def) {
+            c[i] = c[i] || this.def[i];
+            this.get(i).el.set_text(c[i]);
+        }
+        if (c.name) {
+            this.el.set_title("Edit File Details - " + c.name);
+        } else {
+            this.el.set_title("Create New File");
+        }
+         
+        this.file = c;
+        console.log('show all');
+        this.el.show_all();
+        this.success = c.success;
+        
+        
+    },
+    items : [
+        {
+            xtype: Gtk.VBox,
+            pack : function(p,e) {
+                                p.el.get_content_area().add(e.el)
+                            },
+            items : [
+                {
+                    xtype: Gtk.Table,
+                    n_columns : 2,
+                    n_rows : 3,
+                    pack : "pack_start,false,false,0",
+                    homogeneous : false,
+                    items : [
+                        {
+                            xtype: Gtk.Label,
+                            label : "Component Name",
+                            pack : "add",
+                            x_options : 4,
+                            xalign : 0.9,
+                            justify : Gtk.Justification.RIGHT
+                        },
+                        {
+                            xtype: Gtk.Entry,
+                            id : "name",
+                            pack : "add",
+                            visible : true
+                        },
+                        {
+                            xtype: Gtk.Label,
+                            label : "Title",
+                            pack : "add",
+                            x_options : 4,
+                            xalign : 0.9,
+                            justify : Gtk.Justification.RIGHT,
+                            visible : true
+                        },
+                        {
+                            xtype: Gtk.Entry,
+                            id : "title",
+                            pack : "add",
+                            visible : true
+                        },
+                        {
+                            xtype: Gtk.Label,
+                            label : "Region",
+                            pack : "add",
+                            tooltip_text : "center, north, south, east, west",
+                            x_options : 4,
+                            xalign : 0.9,
+                            justify : Gtk.Justification.RIGHT,
+                            visible : true
+                        },
+                        {
+                            xtype: Gtk.Entry,
+                            id : "region",
+                            pack : "add",
+                            visible : true
+                        },
+                        {
+                            xtype: Gtk.Label,
+                            label : "Parent Name",
+                            pack : "add",
+                            x_options : 4,
+                            xalign : 0.9,
+                            justify : Gtk.Justification.RIGHT,
+                            visible : true
+                        },
+                        {
+                            xtype: Gtk.Entry,
+                            id : "parent",
+                            pack : "add",
+                            visible : true
+                        },
+                        {
+                            xtype: Gtk.Label,
+                            label : "Permission Name",
+                            pack : "add",
+                            x_options : 4,
+                            xalign : 0.9,
+                            justify : Gtk.Justification.RIGHT,
+                            visible : true
+                        },
+                        {
+                            xtype: Gtk.Entry,
+                            id : "permname",
+                            pack : "add",
+                            visible : true
+                        },
+                        {
+                            xtype: Gtk.Label,
+                            label : "Order (for tabs)",
+                            pack : "add",
+                            x_options : 4,
+                            xalign : 0.9,
+                            justify : Gtk.Justification.RIGHT,
+                            visible : true
+                        },
+                        {
+                            xtype: Gtk.Entry,
+                            id : "modOrder",
+                            pack : "add",
+                            visible : true
+                        }
+                    ]
+                }
+            ]
+        },
+        {
+            xtype: Gtk.Button,
+            pack : "add_action_widget,0",
+            label : "Cancel"
+        },
+        {
+            xtype: Gtk.Button,
+            pack : "add_action_widget,1",
+            label : "OK"
+        }
+    ]
+});
+DialogNewComponent.init();
+XObject.cache['/DialogNewComponent'] = DialogNewComponent;
diff --git a/old-javascript/Builder3/DialogSaveTemplate.bjs b/old-javascript/Builder3/DialogSaveTemplate.bjs
new file mode 100644 (file)
index 0000000..d4a4882
--- /dev/null
@@ -0,0 +1 @@
+{"id":"file-gtk-8","name":"DialogSaveTemplate","parent":"","title":false,"path":"/home/alan/gitlive/app.Builder.js/Sample/DialogSaveTemplate.bjs","items":[{"listeners":{"delete_event":"function (self, event) {\n    this.el.hide();\n    return true;\n}","response":"function (self, response_id) {\n\n    if (!response_id) {\n        this.el.hide();\n         return;\n    }\n    var name = this.get('name').el.get_text();\n    if (!name.length) {\n        this.get('/StandardErrorDialog').show(\n            \"You must give the template a name. \"\n        );\n        return;\n    }\n    \n   if (!name.match(/^[A-Z ]+$/i) || !name.match(/[A-Z]/i)) {\n        this.get('/StandardErrorDialog').show(\n            \"Template Nane must contain only letters and spaces. \"\n        );\n         return;\n    }\n    this.get('/Window.LeftTree').getPaleteProvider().saveTemplate(name, this.data);\n    // now we save it..\n        this.el.hide();\n    \n}"},"default_height":200,"default_width":400,"xtype":"Dialog","|modal":true,"|show":"function(data) {\n    this.data = data;\n    this.get('name').el.set_text('');\n    this.el.show_all();\n}\n","|xns":"Gtk","items":[{"xtype":"HBox","|pack":"function(p,e) {\n                    p.el.get_content_area().add(e.el)\n                }\n","|xns":"Gtk","items":[{"label":"Name","pack":"add","xtype":"Label","|xns":"Gtk","listeners":{}},{"id":"name","pack":"add","xtype":"Entry","|xns":"Gtk"}]},{"label":"Cancel","pack":"add_action_widget,0","xtype":"Button","|xns":"Gtk"},{"label":"OK","pack":"add_action_widget,1","xtype":"Button","|xns":"Gtk"}]}],"project":"{\"name\":\"Sample\",\"xtype\":\"Gtk\",\"paths\":{\"/home/alan/gitlive/app.Builder.js/Sample\":\"dir\"},\"id\":\"project-gtk-1\",\"fn\":\"329624934046af6e88a65a3f36971958\",\"file\":false,\"runhtml\":\"\"}"}
\ No newline at end of file
diff --git a/old-javascript/Builder3/DialogSaveTemplate.js b/old-javascript/Builder3/DialogSaveTemplate.js
new file mode 100644 (file)
index 0000000..c82c49d
--- /dev/null
@@ -0,0 +1,85 @@
+Gtk = imports.gi.Gtk;
+Gdk = imports.gi.Gdk;
+Pango = imports.gi.Pango;
+GLib = imports.gi.GLib;
+Gio = imports.gi.Gio;
+GObject = imports.gi.GObject;
+GtkSource = imports.gi.GtkSource;
+WebKit = imports.gi.WebKit;
+Vte = imports.gi.Vte;
+console = imports.console;
+XObject = imports.XObject.XObject;
+DialogSaveTemplate=new XObject({
+    xtype: Gtk.Dialog,
+    listeners : {
+        delete_event : function (self, event) {
+            this.el.hide();
+            return true;
+        },
+        response : function (self, response_id) {
+        
+            if (!response_id) {
+                this.el.hide();
+                 return;
+            }
+            var name = this.get('name').el.get_text();
+            if (!name.length) {
+                this.get('/StandardErrorDialog').show(
+                    "You must give the template a name. "
+                );
+                return;
+            }
+            
+           if (!name.match(/^[A-Z ]+$/i) || !name.match(/[A-Z]/i)) {
+                this.get('/StandardErrorDialog').show(
+                    "Template Nane must contain only letters and spaces. "
+                );
+                 return;
+            }
+            this.get('/Window.LeftTree').getPaleteProvider().saveTemplate(name, this.data);
+            // now we save it..
+                this.el.hide();
+            
+        }
+    },
+    default_height : 200,
+    default_width : 400,
+    modal : true,
+    show : function(data) {
+        this.data = data;
+        this.get('name').el.set_text('');
+        this.el.show_all();
+    },
+    items : [
+        {
+            xtype: Gtk.HBox,
+            pack : function(p,e) {
+                                p.el.get_content_area().add(e.el)
+                            },
+            items : [
+                {
+                    xtype: Gtk.Label,
+                    label : "Name",
+                    pack : "add"
+                },
+                {
+                    xtype: Gtk.Entry,
+                    id : "name",
+                    pack : "add"
+                }
+            ]
+        },
+        {
+            xtype: Gtk.Button,
+            label : "Cancel",
+            pack : "add_action_widget,0"
+        },
+        {
+            xtype: Gtk.Button,
+            label : "OK",
+            pack : "add_action_widget,1"
+        }
+    ]
+});
+DialogSaveTemplate.init();
+XObject.cache['/DialogSaveTemplate'] = DialogSaveTemplate;
diff --git a/old-javascript/Builder3/DialogTemplateSelect.bjs b/old-javascript/Builder3/DialogTemplateSelect.bjs
new file mode 100644 (file)
index 0000000..bd33682
--- /dev/null
@@ -0,0 +1 @@
+{"id":"file-gtk-9","name":"DialogTemplateSelect","parent":"","title":false,"path":"/home/alan/gitlive/app.Builder.js/Sample/DialogTemplateSelect.bjs","items":[{"listeners":{"delete_event":"function (self, event) {\n    this.el.hide();\n    return true;\n}"},"default_height":200,"default_width":400,"xtype":"Dialog","|modal":true,"|show":"function(node) {\n    \n    var pal = this.get('/Window.LeftTree').getPaleteProvider();\n    var opts = pal.listTemplates(node);\n    if (!opts.length) {\n        return node;\n    }\n  \n    opts.unshift({ path: '' , name :'Just add Element' });\n    this.get('combo.model').loadData(opts);\n     this.get('combo').el.set_active(0);\n     \n    this.el.show_all();\n    this.el.run();\n    this.el.hide();\n    var ix = this.get('combo').el.get_active();\n    if (ix < 1 ) {\n        return node;\n    }\n    \n\n    return pal.loadTemplate(opts[ix].path)\n\n}\n","|xns":"Gtk","items":[{"xtype":"VBox","|pack":"function(p,e) {\n                    p.el.get_content_area().add(e.el)\n                }\n","|xns":"Gtk","items":[{"pack":"pack_start,false,false,0","xtype":"HBox","|xns":"Gtk","listeners":{},"items":[{"label":"Select Template : ","pack":"pack_start,false,false","xtype":"Label","|xns":"Gtk"},{"id":"combo","pack":"add","xtype":"ComboBox","|init":"function() {\n    XObject.prototype.init.call(this);\n     this.el.add_attribute(this.items[0].el , 'markup', 1 );\n}\n","|xns":"Gtk","items":[{"pack":"pack_start","xtype":"CellRendererText","|xns":"Gtk"},{"id":"model","pack":"set_model","xtype":"ListStore","|init":"function() {\n    XObject.prototype.init.call(this);\n            this.el.set_column_types ( 2, [\n            GObject.TYPE_STRING,  // real key\n            GObject.TYPE_STRING // real type\n            \n            \n        ] );\n}\n","|loadData":"function (data) {\n    this.el.clear();                                    \n    var iter = new Gtk.TreeIter();\n    var el = this.el;\n    data.forEach(function(p) {\n\n        el.append(iter);\n        \n         \n        el.set_value(iter, 0, ''+ p.path);\n        el.set_value(iter, 1, ''+ p.name);\n        \n    });\n              \n                                     \n}\n","|xns":"Gtk"}]}]}]},{"label":"OK","pack":"add_action_widget,0","xtype":"Button","|xns":"Gtk"}]}],"project":"{\"name\":\"Sample\",\"xtype\":\"Gtk\",\"paths\":{\"/home/alan/gitlive/app.Builder.js/Sample\":\"dir\"},\"id\":\"project-gtk-1\",\"fn\":\"329624934046af6e88a65a3f36971958\",\"file\":false,\"runhtml\":\"\"}"}
\ No newline at end of file
diff --git a/old-javascript/Builder3/DialogTemplateSelect.js b/old-javascript/Builder3/DialogTemplateSelect.js
new file mode 100644 (file)
index 0000000..c561c45
--- /dev/null
@@ -0,0 +1,156 @@
+Gtk = imports.gi.Gtk;
+Gdk = imports.gi.Gdk;
+Pango = imports.gi.Pango;
+GLib = imports.gi.GLib;
+Gio = imports.gi.Gio;
+GObject = imports.gi.GObject;
+GtkSource = imports.gi.GtkSource;
+WebKit = imports.gi.WebKit;
+Vte = imports.gi.Vte;
+console = imports.console;
+XObject = imports.XObject.XObject;
+DialogTemplateSelect=new XObject({
+    xtype: Gtk.Dialog,
+    listeners : {
+        delete_event : function (self, event) {
+            this.el.hide();
+            return true;
+        }
+    },
+    default_height : 200,
+    default_width : 400,
+    modal : true,
+    show : function(node) {
+        
+        var pal = this.get('/Window.LeftTree').getPaleteProvider();
+        var opts = pal.listTemplates(node);
+        if (!opts.length) {
+            return node;
+        }
+      
+      
+        var dopts = [];
+      
+      
+        dopts.push({ path: '' , name :'Just add Element' });
+        
+        
+        
+         
+        var project = this.get('/Window.LeftTree').getActiveFile().project;
+        var m = project.dbcon ? project.dbcon + '_' : false;
+        
+      
+                        //print (project.fn);
+        
+        opts.forEach(function(p) {
+            // if we have a dbname - ignore _ named.
+            if (m  && p.name.match(/_/) && 
+                p.name.substring(0, m.length) != m) {
+                return;
+                
+            }
+            dopts.push(p);
+        });
+            
+        
+        this.get('combo.model').loadData(dopts);
+         this.get('combo').el.set_active(0);
+         
+        this.el.show_all();
+        this.el.run();
+        this.el.hide();
+        var ix = this.get('combo').el.get_active();
+        if (ix < 1 ) {
+            return node;
+        }
+         
+        return pal.loadTemplate(dopts[ix].path)
+    
+    },
+    items : [
+        {
+            xtype: Gtk.VBox,
+            pack : function(p,e) {
+                                p.el.get_content_area().add(e.el)
+                            },
+            items : [
+                {
+                    xtype: Gtk.HBox,
+                    pack : "pack_start,false,false,0",
+                    items : [
+                        {
+                            xtype: Gtk.Label,
+                            label : "Select Template : ",
+                            pack : "pack_start,false,false"
+                        },
+                        {
+                            xtype: Gtk.ComboBox,
+                            id : "combo",
+                            pack : "add",
+                            init : function() {
+                                XObject.prototype.init.call(this);
+                                 this.el.add_attribute(this.items[0].el , 'markup', 1 );
+                            },
+                            items : [
+                                {
+                                    xtype: Gtk.CellRendererText,
+                                    pack : "pack_start"
+                                },
+                                {
+                                    xtype: Gtk.ListStore,
+                                    id : "model",
+                                    pack : "set_model",
+                                    init : function() {
+                                        XObject.prototype.init.call(this);
+                                                this.el.set_column_types ( 2, [
+                                                GObject.TYPE_STRING,  // real key
+                                                GObject.TYPE_STRING // real type
+                                                
+                                                
+                                            ] );
+                                    },
+                                    loadData : function (data) {
+                                        this.el.clear();                                    
+                                         
+                                        var project = this.get('/Window.LeftTree').getActiveFile().project;
+                                        var m = project.dbcon ? project.dbcon + '_' : false;
+                                        
+                                      
+                                                        //print (project.fn);
+                                        var el = this.el;
+                                        data.forEach(function(p) {
+                                            // if we have a dbname - ignore _ named.
+                                            if (m  && p.name.match(/_/) && 
+                                                p.name.substring(0, m.length) != m) {
+                                                return;
+                                                
+                                            }
+                                            
+                                            var iret = {};
+                                            el.append(iret);
+                                            
+                                             
+                                            el.set_value(iret.iter, 0, ''+ p.path);
+                                            el.set_value(iret.iter, 1, ''+ p.name);
+                                            
+                                        });
+                                                  
+                                                                         
+                                    }
+                                }
+                            ]
+                        }
+                    ]
+                }  
+            ]
+        },
+        {
+            xtype: Gtk.Button,
+            label : "OK",
+            pack : "add_action_widget,0"
+        }
+    ]
+});
+DialogTemplateSelect.init();
+XObject.cache['/DialogTemplateSelect'] = DialogTemplateSelect;
diff --git a/old-javascript/Builder3/EditProject.bjs b/old-javascript/Builder3/EditProject.bjs
new file mode 100644 (file)
index 0000000..fca92ef
--- /dev/null
@@ -0,0 +1 @@
+{"id":"file-gtk-12","name":"EditProject","parent":"","title":false,"path":"/home/alan/gitlive/app.Builder.js/Sample/EditProject.bjs","items":[{"|xns":"Gtk","xtype":"Dialog","default_height":500,"default_width":600,"|deletable":true,"|modal":true,"border_width":3,"title":"Project Properties","|show":"function(c) {\n       c = c || { name : '' , xtype : '' };\n    this.project  = c;\n    if (!this.el) {\n        this.init();\n    }\n    var _this = this;\n    [ 'xtype'  ].forEach(function(k) {\n        _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);\n    });\n\t// shouild set path..\n    \n    this.el.show_all();\n    this.success = c.success;\n}\n","listeners":{"destroy_event":"function (self, event) {\n     this.el.hide();\n                return false;\n}","response":"function (self, id) {\n if (id < 1) {\n            this.el.hide();\n            return;\n        }\n        if (!this.get('xtype').getValue().length) {\n            this.get('/StandardErrorDialog').show(\"You have to set Project type\");             \n            return;\n        }\n        if (!this.get('dir').el.get_filename().length) {\n            this.get('/StandardErrorDialog').show(\"You have to select a folder\");             \n            return;\n        }\n\n        this.el.hide();\n        \n        \n        var fn = this.get('dir').el.get_filename();\n        \n        this.project.name  = GLib.basename(fn);\n        this.project.xtype  = this.get('xtype').getValue();\n        this.project.paths = {};\n        this.project.paths[fn] =  'dir' ;\n        \n        var pr = imports.Builder.Provider.ProjectManager.ProjectManager.update(this.project);\n        \n        this.success(pr);\n        Seed.print(id);\n}"},"items":[{"|xns":"Gtk","xtype":"VBox","|pack":" function(p,e) {\n            p.el.get_content_area().add(e.el)\n        }\n","items":[{"|xns":"Gtk","xtype":"HBox","pack":"pack_start,false,true,3","items":[{"|xns":"Gtk","xtype":"Label","pack":"pack_start,false,true,3","label":"Project type :"},{"|xns":"Gtk","xtype":"ComboBox","pack":"pack_end,true,true,3","id":"xtype","|setValue":"function(v)\n                {\n                    var el = this.el;\n                    el.set_active(-1);\n                    this.get('model').data.forEach(function(n, ix) {\n                        if (v == n.xtype) {\n                            el.set_active(ix);\n                            return false;\n                        }\n                    });\n                }","|getValue":"function() {\n     var ix = this.el.get_active();\n            if (ix < 0 ) {\n                return '';\n            }\n            return this.get('model').data[ix].xtype;\n}\n","|init":"function() {\n    XObject.prototype.init.call(this);\n  this.el.add_attribute(this.items[0].el , 'markup', 1 );  \n}\n","items":[{"|xns":"Gtk","xtype":"CellRendererText","pack":"pack_start"},{"|xns":"Gtk","xtype":"ListStore","pack":"set_model","|init":"function() {\n    XObject.prototype.init.call(this);\n\n                            this.el.set_column_types ( 2, [\n                                GObject.TYPE_STRING,  // real key\n                                GObject.TYPE_STRING // real type\n                                \n                                \n                            ] );\n                            \n                            this.data = [\n                                { xtype: 'Roo', desc : \"Roo Project\" },\n                                { xtype: 'Gtk', desc : \"Gtk Project\" },    \n                                //{ xtype: 'JS', desc : \"Javascript Class\" }\n                            ]\n                            \n                            this.loadData(this.data);\n                                \n}\n","|loadData":"function (data) {\n                                            \n            var iter = new Gtk.TreeIter();\n            var el = this.el;\n            data.forEach(function(p) {\n                \n                el.append(iter);\n                \n                 \n                el.set_value(iter, 0, p.xtype);\n                el.set_value(iter, 1, p.desc);\n                \n            });\n              \n                                     \n}\n","id":"model"}]}]},{"|xns":"Gtk","xtype":"FileChooserWidget","pack":"pack_end,true,true,5","|action":"Gtk.FileChooserAction.SELECT_FOLDER","id":"dir","|select_multiple":false}]},{"|xns":"Gtk","xtype":"Button","pack":"add_action_widget,1","label":"OK"},{"|xns":"Gtk","xtype":"Button","pack":"add_action_widget,0","label":"Cancel"}]}]}
\ No newline at end of file
diff --git a/old-javascript/Builder3/EditProject.js b/old-javascript/Builder3/EditProject.js
new file mode 100644 (file)
index 0000000..28a8da0
--- /dev/null
@@ -0,0 +1,184 @@
+Gtk = imports.gi.Gtk;
+Gdk = imports.gi.Gdk;
+Pango = imports.gi.Pango;
+GLib = imports.gi.GLib;
+Gio = imports.gi.Gio;
+GObject = imports.gi.GObject;
+GtkSource = imports.gi.GtkSource;
+WebKit = imports.gi.WebKit;
+Vte = imports.gi.Vte;
+console = imports.console;
+XObject = imports.XObject.XObject;
+EditProject=new XObject({
+    xtype: Gtk.Dialog,
+    default_height : 500,
+    default_width : 600,
+    deletable : true,
+    modal : true,
+    border_width : 3,
+    title : "Project Properties",
+    show : function(c) {
+           c = c || { name : '' , xtype : '' };
+        this.project  = c;
+        if (!this.el) {
+            this.init();
+        }
+        var _this = this;
+        [ 'xtype'  ].forEach(function(k) {
+            _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);
+        });
+       // shouild set path..
+        
+        this.el.show_all();
+        this.success = c.success;
+    },
+    listeners : {
+        destroy_event : function (self, event) {
+             this.el.hide();
+                        return false;
+        },
+        response : function (self, id) {
+         if (id < 1) {
+                    this.el.hide();
+                    return;
+                }
+                if (!this.get('xtype').getValue().length) {
+                    this.get('/StandardErrorDialog').show("You have to set Project type");             
+                    return;
+                }
+                if (!this.get('dir').el.get_filename().length) {
+                    this.get('/StandardErrorDialog').show("You have to select a folder");             
+                    return;
+                }
+        
+                this.el.hide();
+                
+                
+                var fn = this.get('dir').el.get_filename();
+                
+                this.project.name  = GLib.basename(fn);
+                this.project.xtype  = this.get('xtype').getValue();
+                this.project.paths = {};
+                this.project.paths[fn] =  'dir' ;
+                
+                var pr = imports.ProjectManager.ProjectManager.update(this.project);
+                
+                this.success(pr);
+                Seed.print(id);
+        }
+    },
+    items : [
+        {
+            xtype: Gtk.VBox,
+            pack : function(p,e) {
+                    p.el.get_content_area().pack_start(e.el,true,true,3);
+                },
+            items : [
+                {
+                    xtype: Gtk.HBox,
+                    pack : "pack_start,false,true,3",
+                    items : [
+                        {
+                            xtype: Gtk.Label,
+                            pack : "pack_start,false,true,3",
+                            label : "Project type :"
+                        },
+                        {
+                            xtype: Gtk.ComboBox,
+                            pack : "pack_end,true,true,3",
+                            id : "xtype",
+                            setValue : function(v)
+                                            {
+                                                var el = this.el;
+                                                el.set_active(-1);
+                                                this.get('model').data.forEach(function(n, ix) {
+                                                    if (v == n.xtype) {
+                                                        el.set_active(ix);
+                                                        return false;
+                                                    }
+                                                    return true;
+                                                });
+                                            },
+                            getValue : function() {
+                                 var ix = this.el.get_active();
+                                        if (ix < 0 ) {
+                                            return '';
+                                        }
+                                        return this.get('model').data[ix].xtype;
+                            },
+                            init : function() {
+                                XObject.prototype.init.call(this);
+                              this.el.add_attribute(this.items[0].el , 'markup', 1 );  
+                            },
+                            items : [
+                                {
+                                    xtype: Gtk.CellRendererText,
+                                    pack : "pack_start"
+                                },
+                                {
+                                    xtype: Gtk.ListStore,
+                                    pack : "set_model",
+                                    init : function() {
+                                        XObject.prototype.init.call(this);
+                                    
+                                                                this.el.set_column_types ( 2, [
+                                                                    GObject.TYPE_STRING,  // real key
+                                                                    GObject.TYPE_STRING // real type
+                                                                    
+                                                                    
+                                                                ] );
+                                                                
+                                                                this.data = [
+                                                                    { xtype: 'Roo', desc : "Roo Project" },
+                                                                    { xtype: 'Gtk', desc : "Gtk Project" },    
+                                                                    //{ xtype: 'JS', desc : "Javascript Class" }
+                                                                ]
+                                                                
+                                                                this.loadData(this.data);
+                                                                    
+                                    },
+                                    loadData : function (data) {
+                                                                                
+                                                 var el = this.el;
+                                                data.forEach(function(p) {
+                                                    var ret = {};
+                                                    el.append(ret);
+                                                    
+                                                     
+                                                    el.set_value(ret.iter, 0, p.xtype);
+                                                    el.set_value(ret.iter, 1, p.desc);
+                                                    
+                                                });
+                                                  
+                                                                         
+                                    },
+                                    id : "model"
+                                }
+                            ]
+                        }
+                    ]
+                },
+                
+                {
+                    xtype: Gtk.FileChooserWidget,
+                    pack : "pack_end,true,true,5",
+                    action : Gtk.FileChooserAction.SELECT_FOLDER,
+                    id : "dir",
+                    select_multiple : false
+                }
+            ]
+        },
+        {
+            xtype: Gtk.Button,
+            pack : "add_action_widget,1",
+            label : "OK"
+        },
+        {
+            xtype: Gtk.Button,
+            pack : "add_action_widget,0",
+            label : "Cancel"
+        }
+    ]
+});
+EditProject.init();
+XObject.cache['/EditProject'] = EditProject;
diff --git a/old-javascript/Builder3/Editor.bjs b/old-javascript/Builder3/Editor.bjs
new file mode 100644 (file)
index 0000000..28a6784
--- /dev/null
@@ -0,0 +1,89 @@
+{
+    "id": "file-gtk-10",
+    "name": "Editor",
+    "parent": "",
+    "title": false,
+    "path": "/home/alan/gitlive/app.Builder.js/Sample/Editor.bjs",
+    "items": [
+        {
+            "listeners": {
+                "delete_event": "function (self, event) {\n    if (!this.get('/Editor.RightEditor').save()) {\n        // no hiding with errors.\n        return true;\n    }\n    this.el.hide();\n    this.get('/Editor').activePath = false;\n    return true;\n}",
+                "configure_event": "function (self, object) {\n    this.pos = this.el.get_position();\n\n\n    return false;\n}",
+                "show": "function (self) {\n    if (this.pos) {\n        this.el.set_uposition(this.pos.root_x,this.pos.root_y);\n    }\n}"
+            },
+            "height_request": 300,
+            "id": "EditorWindow",
+            "title": "Application Builder - Editor",
+            "width_request": 500,
+            "xtype": "Window",
+            "|save": "function (self, event) {\n    if (!this.get('/Editor.RightEditor').save()) {\n        // no hiding with errors.\n        return true;\n    }\n    this.get('/Editor').activePath = false;\n    this.el.hide();\n    return true;\n}",
+            "|init": "function() {\n    XObject.prototype.init.call(this);\n   // this.show_all();\n}\n",
+            "|xns": "Gtk",
+            "items": [
+                {
+                    "pack": "add",
+                    "xtype": "VBox",
+                    "|xns": "Gtk",
+                    "items": [
+                        {
+                            "pack": "pack_start,false,true",
+                            "xtype": "Toolbar",
+                            "|xns": "Gtk",
+                            "items": [
+                                {
+                                    "listeners": {
+                                        "clicked": "function (self) {\n\n  this.get('/Editor.RightEditor').save();\n}"
+                                    },
+                                    "id": "save_button",
+                                    "label": "Save",
+                                    "xtype": "Button",
+                                    "|xns": "Gtk"
+                                }
+                            ]
+                        },
+                        {
+                            "id": "RightEditor",
+                            "pack": "add",
+                            "xtype": "ScrolledWindow",
+                            "|save": "function() {\n    // make sure we have an active path..\n     if (!this.get('/Editor').activePath) {\n        return true;\n     }\n     \n     var str = this.get('/Editor.buffer').toString();\n     if (!this.get('/Editor.buffer').checkSyntax()) {\n         this.get('/StandardErrorDialog').show(\"Fix errors in code and save..\"); \n         return false;\n     }\n     \n     this.get('/LeftPanel.model').changed(  str , false);\n     this.get('/Editor').dirty = false;\n     this.get('/Editor.save_button').el.sensitive = false;\n     return true;\n}\n",
+                            "|xns": "Gtk",
+                            "items": [
+                                {
+                                    "listeners": {
+                                        "key_release_event": "function (self, event) {\n    \n    if (event.key.keyval == 115 && (event.key.state & Gdk.ModifierType.CONTROL_MASK ) ) {\n        print(\"SAVE: ctrl-S  pressed\");\n        this.save();\n        return false;\n    }\n   // print(event.key.keyval)\n    \n    return false;\n}"
+                                    },
+                                    "id": "view",
+                                    "indent_width": 4,
+                                    "pack": "add",
+                                    "xtype": "View",
+                                    "|auto_indent": true,
+                                    "|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",
+                                    "|insert_spaces_instead_of_tabs": true,
+                                    "|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    this.get('/Editor').dirty = false;\n    this.el.grab_focus();\n     this.get('/Editor.save_button').el.sensitive = false;\n}",
+                                    "|save": "function() {\n    \n    return this.get('/Editor.RightEditor').save();\n}\n",
+                                    "|show_line_numbers": true,
+                                    "|xns": "GtkSource",
+                                    "items": [
+                                        {
+                                            "listeners": {
+                                                "changed": "function (self) {\n\n    if(this.checkSyntax()) {\n        this.get('/Editor.save_button').el.sensitive = true;\n    }\n   // print(\"EDITOR CHANGED\");\n    this.get('/Editor').dirty = true;\n\n    // this.get('/LeftPanel.model').changed(  str , false);\n    return false;\n}"
+                                            },
+                                            "id": "buffer",
+                                            "pack": "set_buffer",
+                                            "xtype": "Buffer",
+                                            "|checkSyntax": "function() {\n    var str = this.toString();\n    var res = '';\n    try {\n      //  print('var res = ' + str);\n        Seed.check_syntax('var res = ' + str);\n        \n       \n    } catch (e) {\n        \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        // print(str);\n        //console.dump(e);\n        return false;\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    return true;\n}\n",
+                                            "|toString": "function() {\n    \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 ret = this.el.get_text(s,e,true);\n    //print(\"TO STRING? \" + ret);\n    return ret;\n}\n",
+                                            "|xns": "GtkSource"
+                                        }
+                                    ]
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ]
+        }
+    ],
+    "permname": "",
+    "modOrder": ""
+}
\ No newline at end of file
diff --git a/old-javascript/Builder3/Editor.js b/old-javascript/Builder3/Editor.js
new file mode 100644 (file)
index 0000000..261450f
--- /dev/null
@@ -0,0 +1,230 @@
+Gtk = imports.gi.Gtk;
+Gdk = imports.gi.Gdk;
+Pango = imports.gi.Pango;
+GLib = imports.gi.GLib;
+Gio = imports.gi.Gio;
+GObject = imports.gi.GObject;
+GtkSource = imports.gi.GtkSource;
+WebKit = imports.gi.WebKit;
+Vte = imports.gi.Vte;
+ console = imports.console;
+XObject = imports.XObject.XObject;
+Editor=new XObject({
+    
+    xtype: Gtk.Window,
+    listeners : {
+        delete_event : function (self, event) {
+            if (!this.get('/Editor.RightEditor').save()) {
+                // no hiding with errors.
+                return true;
+            }
+            this.el.hide();
+            this.get('/Editor').activePath = false;
+            return true;
+        },
+        configure_event : function (self, object) {
+            this.pos = this.el.get_position();
+        
+        
+            return false;
+        },
+        show : function (self) {
+            if (this.pos) {
+                this.el.set_uposition(this.pos.root_x,this.pos.root_y);
+            }
+        }
+    },
+    height_request : 300,
+    id : "EditorWindow",
+    title : "Application Builder - Editor",
+    width_request : 500,
+    save : function (self, event) {
+        if (!this.get('/Editor.RightEditor').save()) {
+            // no hiding with errors.
+            return true;
+        }
+        this.get('/Editor').activePath = false;
+        this.el.hide();
+        return true;
+    },
+    init : function() {
+        XObject.prototype.init.call(this);
+       // this.show_all();
+    },
+    items : [
+        {
+            xtype: Gtk.VBox,
+            pack : "add",
+            items : [
+                {
+                    xtype: Gtk.MenuBar,
+                    pack : "pack_start,false,true",
+                    items : [
+                        {
+                            xtype: Gtk.MenuItem,
+                             
+                            listeners : {
+                                activate : function (self) {
+                                
+                                  this.get('/Editor.RightEditor').save();
+                                }
+                            },
+                            id : "save_button",
+                            label : "Save"
+                        }
+                    ]
+                },
+                {
+                    xtype: Gtk.ScrolledWindow,
+                    id : "RightEditor",
+                    pack : "add",
+                    save : function() {
+                        // make sure we have an active path..
+                         if (!this.get('/Editor').activePath) {
+                            return true;
+                         }
+                         
+                         var str = this.get('/Editor.buffer').toString();
+                         if (!this.get('/Editor.buffer').checkSyntax()) {
+                             this.get('/StandardErrorDialog').show("Fix errors in code and save.."); 
+                             return false;
+                         }
+                         
+                         this.get('/LeftPanel.model').changed(  str , false);
+                         this.get('/Editor').dirty = false;
+                         this.get('/Editor.save_button').el.sensitive = false;
+                         return true;
+                    },
+                    items : [
+                        {
+                            xtype: GtkSource.View,
+                            listeners : {
+                                key_release_event : function (self, event) {
+                                    
+                                    if (event.key.keyval == 115 && (event.key.state & Gdk.ModifierType.CONTROL_MASK ) ) {
+                                        print("SAVE: ctrl-S  pressed");
+                                        this.save();
+                                        return false;
+                                    }
+                                   // print(event.key.keyval)
+                                    
+                                    return false;
+                                }
+                            },
+                            id : "view",
+                            indent_width : 4,
+                            pack : "add",
+                            auto_indent : true,
+                            init : function() {
+                                XObject.prototype.init.call(this);
+                                 var description = Pango.font_description_from_string("monospace")
+                                description.set_size(8000);
+                                this.el.modify_font(description);
+                            
+                            },
+                            insert_spaces_instead_of_tabs : true,
+                            load : function(str, providertype) {
+                            
+                            // show the help page for the active node..
+                               //this.get('/Help').show();
+                                Editor.providertype = providertype;
+                            
+                              // this.get('/BottomPane').el.set_current_page(0);
+                                this.el.get_buffer().set_text(str, str.length);
+                                var lm = GtkSource.LanguageManager.get_default();
+                                
+                                this.el.get_buffer().set_language(lm.get_language('js'));
+                                var buf = this.el.get_buffer();
+                                var cursor = buf.get_mark("insert");
+                                var ret = {};
+                                buf.get_iter_at_mark(ret, cursor);
+                                ret.iter.set_line(1);
+                                ret.iter.set_line_offset(4);
+                                buf.move_mark(cursor, ret.iter);
+                                
+                                
+                                cursor = buf.get_mark("selection_bound");
+                                ret = {}; 
+                                buf.get_iter_at_mark(ret, cursor);
+                                ret.iter.set_line(1);
+                                ret.iter.set_line_offset(4);
+                                buf.move_mark(cursor, ret.iter);
+                                this.get('/Editor').dirty = false;
+                                this.el.grab_focus();
+                                 this.get('/Editor.save_button').el.sensitive = false;
+                            },
+                            save : function() {
+                                
+                                return this.get('/Editor.RightEditor').save();
+                            },
+                            show_line_numbers : true,
+                            items : [
+                                {
+                                    xtype: GtkSource.Buffer,
+                                    listeners : {
+                                        changed : function (self) {
+                                        
+                                            if(this.checkSyntax()) {
+                                                this.get('/Editor.save_button').el.sensitive = true;
+                                            }
+                                           // print("EDITOR CHANGED");
+                                            this.get('/Editor').dirty = true;
+                                        
+                                            // this.get('/LeftPanel.model').changed(  str , false);
+                                            return false;
+                                        }
+                                    },
+                                    id : "buffer",
+                                    pack : "set_buffer",
+                                    checkSyntax : function() {
+                                        
+                                        if (Editor.providertype == 'Gtk') {
+                                            return true;
+                                        }
+                                        
+                                        var str = this.toString();
+                                        var res = '';
+                                        try {
+                                          //  print('var res = ' + str);
+                                            Seed.check_syntax('var res = ' + str);
+                                            
+                                           
+                                        } catch (e) {
+                                            
+                                            this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
+                                                red: 0xFFFF, green: 0xCCCC , blue : 0xCCCC
+                                               }));
+                                            print("SYNTAX ERROR IN EDITOR");   
+                                            print(e);
+                                            // print(str);
+                                            //console.dump(e);
+                                            return false;
+                                        }
+                                         this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
+                                            red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF
+                                           }));
+                                        
+                                        return true;
+                                    },
+                                    toString : function() {
+                                        var s = {};
+                                        var e = {};
+                                         
+                                        this.el.get_start_iter(s).value;
+                                        this.el.get_end_iter(e).value;
+                                        
+                                        var ret = this.el.get_text(s.iter,e.iter,true);
+                                        //print("TO STRING? " + ret);
+                                        return ret;
+                                    }
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+});
+Editor.init();
+XObject.cache['/Editor'] = Editor;
diff --git a/old-javascript/Builder3/Globals.js b/old-javascript/Builder3/Globals.js
new file mode 100644 (file)
index 0000000..5b4cad1
--- /dev/null
@@ -0,0 +1,20 @@
+Gtk = imports.gi.Gtk;
+Gdk = imports.gi.Gdk;
+
+
+atoms = {
+               "STRING" : Gdk.atom_intern("STRING")
+       };
+targetList = new Gtk.TargetList();
+targetList.add(  atoms["STRING"], 0, 0);
+
+
+
+Gtk.rc_parse_string(
+            "style \"gtkcombobox-style\" {\n" + 
+            "    GtkComboBox::appears-as-list = 1\n" +
+            "}\n"+
+            "class \"GtkComboBox\" style \"gtkcombobox-style\"\n");
+
+
+//imports.Window.Window.el.show_all();
diff --git a/old-javascript/Builder3/Main.js b/old-javascript/Builder3/Main.js
new file mode 100644 (file)
index 0000000..c098538
--- /dev/null
@@ -0,0 +1,46 @@
+Gtk = imports.gi.Gtk;
+Gdk = imports.gi.Gdk;
+
+Window = imports.Builder3.Window.Window;
+
+JSON.xstringify = function (o) {
+         var seen = [];
+         return JSON.stringify(o, function(_, value) {
+                 if (typeof value === 'object' && value !== null) {
+                         if (seen.indexOf(value) !== -1) return null;
+                         else seen.push(value);
+                 }
+                 return value;
+         }, 4);
+}
+
+/*
+atoms = {
+               "STRING" : Gdk.atom_intern("STRING")
+       };
+targetList = new Gtk.TargetList();
+targetList.add(  atoms["STRING"], 0, 0);
+
+
+
+Gtk.rc_parse_string(
+            "style \"gtkcombobox-style\" {\n" + 
+            "    GtkComboBox::appears-as-list = 1\n" +
+            "}\n"+
+            "class \"GtkComboBox\" style \"gtkcombobox-style\"\n");
+
+*/
+Window.el.show_all();
+
+
+// this ties two elements together...
+// it used to hapen in the init() code for the element, it should be moved to a 'global init for a whole module'
+var pm = imports.ProjectManager.ProjectManager;
+
+var combomodel =  Window.get('/LeftProjectTree.combomodel');
+pm.on('changed', function() {
+      print("caught changed hook on project manager - reloading data");
+     combomodel.loadData(pm.projects);
+
+});
\ No newline at end of file
diff --git a/old-javascript/Builder3/RooProjectProperties.bjs b/old-javascript/Builder3/RooProjectProperties.bjs
new file mode 100644 (file)
index 0000000..4c4d013
--- /dev/null
@@ -0,0 +1 @@
+{"id":"file-gtk-9","name":"RooProjectProperties","parent":"","title":false,"path":"/home/alan/gitlive/app.Builder.js/Sample/RooProjectProperties.bjs","items":[{"|xns":"Gtk","xtype":"Dialog","|modal":true,"|show":"function() {\n    // get the active project.\n    var file = this.get('/Window.LeftTree').getActiveFile();\n    if (!file) {\n        this.get('/StandardErrorDialog').show(\"No file is currently active\");\n        return;\n    }\n    var project = this.get('/Window.LeftTree').getActiveFile().project;\n    //print (project.fn);\n    project.runhtml = project.runhtml || '';\n    this.get('view').el.get_buffer().set_text(project.runhtml, project.runhtml.length);\n    \n    this.el.show_all();\n}\n","default_width":500,"listeners":{"delete_event":"function (self, event) {\n    this.el.hide()\n    return true;\n}","response":"function (self, response_id) {\n   print(response_id);\n   if (!response_id) {\n      this.el.hide();\n    \n      return;\n   }\n   var buf =    this.get('view').el.get_buffer()\n   var s = new Gtk.TextIter();\n    var e = new Gtk.TextIter();\n    buf.get_start_iter(s);\n    buf.get_end_iter(e);\n    var str = buf.get_text(s,e,true);\n    // ideally we should syntax check it.. but it's html!?\n    \n   var project = this.get('/Window.LeftTree').getActiveFile().project;\n   \n   \n   project.runhtml = str;\n   \n   imports.Builder.Provider.ProjectManager.ProjectManager.saveConfig();\n//   print (str);\n   //    this.get('view').el.get_buffer().get_text(project.runjs, project.runjs.length);\n   // ok pressed..\n   this.el.hide();\n}"},"items":[{"|xns":"Gtk","xtype":"VBox","|pack":" function(p,e) {\n            p.el.get_content_area().add(e.el);\n            e.border_width  =5;\n        }\n","items":[{"|xns":"Gtk","xtype":"Label","pack":"pack_start,false,false,0","label":"HTML To insert at end of <HEAD>"},{"|xns":"Gtk","xtype":"ScrolledWindow","pack":"pack_end,true,true,0","items":[{"|xns":"GtkSource","xtype":"View","pack":"add","id":"view"}]}]},{"|xns":"Gtk","xtype":"Button","pack":"add_action_widget,1","label":"OK"},{"|xns":"Gtk","xtype":"Button","pack":"add_action_widget,0","label":"Cancel"}]}]}
\ No newline at end of file
diff --git a/old-javascript/Builder3/RooProjectProperties.js b/old-javascript/Builder3/RooProjectProperties.js
new file mode 100644 (file)
index 0000000..3f90768
--- /dev/null
@@ -0,0 +1,137 @@
+Gtk = imports.gi.Gtk;
+Gdk = imports.gi.Gdk;
+Pango = imports.gi.Pango;
+GLib = imports.gi.GLib;
+Gio = imports.gi.Gio;
+GObject = imports.gi.GObject;
+GtkSource = imports.gi.GtkSource;
+WebKit = imports.gi.WebKit;
+Vte = imports.gi.Vte;
+console = imports.console;
+XObject = imports.XObject.XObject;
+RooProjectProperties=new XObject({
+    xtype: Gtk.Dialog,
+    modal : true,
+    show : function() {
+        // get the active project.
+        var file = this.get('/Window.LeftTree').getActiveFile();
+        if (!file) {
+            this.get('/StandardErrorDialog').show("No file is currently active");
+            return;
+        }
+        var project = this.get('/Window.LeftTree').getActiveFile().project;
+        //print (project.fn);
+        project.runhtml = project.runhtml || '';
+        this.get('view').el.get_buffer().set_text(project.runhtml, project.runhtml.length);
+        this.get('dbcon').el.set_text(project.dbcon || '');
+        print("project db: " + project.dbcon);
+        this.el.show_all();
+    },
+    default_width : 500,
+    listeners : {
+        delete_event : function (self, event) {
+            this.el.hide()
+            return true;
+        },
+        response : function (self, response_id) {
+           print(response_id);
+           if (!response_id) {
+              this.el.hide();
+            
+              return;
+           }
+           var buf =    this.get('view').el.get_buffer()
+           
+            var e = {};
+            var s = {};                             
+            buf.get_start_iter(s);
+            buf.get_end_iter(e);
+            
+            var str = buf.get_text(s.iter,e.iter,false);
+            //print(str);
+            // ideally we should syntax check it.. but it's html!?
+            
+           var project = this.get('/Window.LeftTree').getActiveFile().project;
+           
+           
+           project.runhtml = str;
+           
+           project.dbcon = this.get('dbcon').el.get_text();
+           
+           
+           imports.ProjectManager.ProjectManager.saveConfig();
+        //   print (str);
+           //    this.get('view').el.get_buffer().get_text(project.runjs, project.runjs.length);
+           // ok pressed..
+           this.el.hide();
+        }
+    },
+    items : [
+        {
+            xtype: Gtk.VBox,
+            pack : function(p,e) {
+                        p.el.get_content_area().add(e.el);
+                        e.border_width  =5;
+                    },
+            items : [
+                {
+                    xtype: Gtk.HBox,
+                    pack : "pack_start,false,true,3",
+                    items : [
+                                
+                        
+                       {
+                           xtype: Gtk.Label,
+                           pack : "pack_start,false,false,0",
+                           label : "Database Name"
+                       },
+                       {
+                            xtype: Gtk.Entry,
+                            id : "dbcon",
+                            pack : "add",
+                            visible : true
+                        },
+                    ]
+                },
+        
+               {
+                   xtype: Gtk.Label,
+                   pack : "pack_start,false,false,0",
+                   label : "HTML To insert at end of <HEAD>"
+               },
+               {
+                   xtype: Gtk.ScrolledWindow,
+                   pack : "pack_end,true,true,0",
+                   items : [
+                       {
+                           xtype: GtkSource.View,
+                           pack : "add",
+                           id : "view"
+                       }
+                   ]
+               }
+                 
+                
+                
+                
+                
+            ]
+        },
+        
+        
+       
+        
+        {
+            xtype: Gtk.Button,
+            pack : "add_action_widget,1",
+            label : "OK"
+        },
+        {
+            xtype: Gtk.Button,
+            pack : "add_action_widget,0",
+            label : "Cancel"
+        }
+    ]
+});
+RooProjectProperties.init();
+XObject.cache['/RooProjectProperties'] = RooProjectProperties;
diff --git a/old-javascript/Builder3/StandardErrorDialog.bjs b/old-javascript/Builder3/StandardErrorDialog.bjs
new file mode 100644 (file)
index 0000000..201e518
--- /dev/null
@@ -0,0 +1 @@
+{"id":"file-gtk-17","name":"StandardErrorDialog","parent":"","title":false,"path":"/home/alan/gitlive/app.Builder.js/Sample/StandardErrorDialog.bjs","items":[{"|xns":"Gtk","xtype":"MessageDialog","|buttons":"Gtk.ButtonsType.OK","|modal":true,"|message_type":"Gtk.MessageType.ERROR","text":"fixme","|use_markup":true,"|show":"function(msg) {\n     if (!this.el) {\n            this.init();\n        }\n        this.el.text =  msg;\n        this.el.show_all();\n}\n","listeners":{"delete_event":"function (self, event) {\n    this.el.hide();\n    return true;\n}","response":"function (self, response_id) {\n   this.el.hide();\n}"}}]}
\ No newline at end of file
diff --git a/old-javascript/Builder3/StandardErrorDialog.js b/old-javascript/Builder3/StandardErrorDialog.js
new file mode 100644 (file)
index 0000000..a12c6d5
--- /dev/null
@@ -0,0 +1,37 @@
+Gtk = imports.gi.Gtk;
+Gdk = imports.gi.Gdk;
+Pango = imports.gi.Pango;
+GLib = imports.gi.GLib;
+Gio = imports.gi.Gio;
+GObject = imports.gi.GObject;
+GtkSource = imports.gi.GtkSource;
+WebKit = imports.gi.WebKit;
+Vte = imports.gi.Vte;
+console = imports.console;
+XObject = imports.XObject.XObject;
+StandardErrorDialog=new XObject({
+    xtype: Gtk.MessageDialog,
+    buttons : Gtk.ButtonsType.OK,
+    modal : true,
+    message_type : Gtk.MessageType.ERROR,
+    text : "fixme",
+    use_markup : true,
+    show : function(msg) {
+         if (!this.el) {
+                this.init();
+            }
+            this.el.text =  msg;
+            this.el.show_all();
+    },
+    listeners : {
+        delete_event : function (self, event) {
+            this.el.hide();
+            return true;
+        },
+        response : function (self, response_id) {
+           this.el.hide();
+        }
+    }
+});
+StandardErrorDialog.init();
+XObject.cache['/StandardErrorDialog'] = StandardErrorDialog;
diff --git a/old-javascript/Builder3/Window.bjs b/old-javascript/Builder3/Window.bjs
new file mode 100644 (file)
index 0000000..cb877e8
--- /dev/null
@@ -0,0 +1,1186 @@
+{
+    "id": "file-gtk-1",
+    "name": "Window",
+    "parent": "",
+    "title": false,
+    "path": "/home/alan/gitlive/app.Builder.js/Sample/Window.bjs",
+    "items": [
+        {
+            "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    //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",
+                    "xtype": "VBox",
+                    "id": "w-vbox",
+                    "items": [
+                        {
+                            "|xns": "Gtk",
+                            "xtype": "MenuBar",
+                            "pack": "pack_start,false,false",
+                            "items": [
+                                {
+                                    "|xns": "Gtk",
+                                    "xtype": "MenuItem",
+                                    "|use_underline": true,
+                                    "label": "_File",
+                                    "items": [
+                                        {
+                                            "|xns": "Gtk",
+                                            "xtype": "Menu",
+                                            "pack": "set_submenu",
+                                            "items": [
+                                                {
+                                                    "|xns": "Gtk",
+                                                    "xtype": "MenuItem",
+                                                    "|use_underline": true,
+                                                    "label": "New _Project",
+                                                    "listeners": {
+                                                        "activate": "function (self) {\n         var _this = this;\n\tthis.get('/EditProject').show({\n\t    success : function(pr) {\n\t\t     _this.get('/LeftProjectTree').get('combo').setValue(pr.fn);\n\t    }\n\t});\n}"
+                                                    }
+                                                },
+                                                {
+                                                    "|xns": "Gtk",
+                                                    "xtype": "MenuItem",
+                                                    "label": "_New File",
+                                                    "|use_underline": true,
+                                                    "listeners": {
+                                                        "activate": "function (self) {\n \tvar fn = this.get('/LeftProjectTree.combo').getValue();\n        if (!fn) {\n            this.get('/LeftProjectTree').showNoProjectSelected();\n            return true;\n        }\n        var pm = imports.Builder.Provider.ProjectManager.ProjectManager;\n        this.get('/DialogNewComponent').show({\n            project : pm.getByFn(fn)\n        });\n}"
+                                                    }
+                                                },
+                                                {
+                                                    "|xns": "Gtk",
+                                                    "xtype": "SeparatorMenuItem",
+                                                    "pack": "add"
+                                                },
+                                                {
+                                                    "|xns": "Gtk",
+                                                    "xtype": "MenuItem",
+                                                    "|use_underline": true,
+                                                    "pack": "add",
+                                                    "label": "D_elete Project",
+                                                    "listeners": {
+                                                        "activate": "function (self) {\n\n\tvar fn =  this.get('/LeftProjectTree').get('combo').getValue();\n\tif (!fn.length) {\n\t\tthis.get('/StandardErrorDialog').show(\"Select a project\")\n\t\treturn;\n        }\n\tvar pm = imports.Builder.Provider.ProjectManager.ProjectManager;\n\tvar pr  = pm.getByFn(fn);\n\n\t// confirm..\n\tthis.get('/DialogConfirm').show(\"Are you sure you want to delete project '\" + pr.name + \"'\", function() {\n\t\tpm.deleteProject(fn);\n\t\tprint(\"DELETE?\");\n\t});\n\n}"
+                                                    }
+                                                },
+                                                {
+                                                    "|xns": "Gtk",
+                                                    "xtype": "SeparatorMenuItem",
+                                                    "pack": "add"
+                                                },
+                                                {
+                                                    "|xns": "Gtk",
+                                                    "xtype": "MenuItem",
+                                                    "pack": "add",
+                                                    "label": "_Quit",
+                                                    "|use_underline": true,
+                                                    "listeners": {
+                                                        "activate": "function (self) {\n   Gtk.main_quit();\n} "
+                                                    }
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                },
+                                {
+                                    "label": "_Edit",
+                                    "xtype": "MenuItem",
+                                    "|use_underline": true,
+                                    "|xns": "Gtk",
+                                    "pack": "add",
+                                    "items": [
+                                        {
+                                            "|xns": "Gtk",
+                                            "xtype": "Menu",
+                                            "pack": "set_submenu",
+                                            "listeners": {},
+                                            "items": [
+                                                {
+                                                    "listeners": {
+                                                        "activate": "function (self) {\n \tvar fn = this.get('/LeftTree').getActiveFile();\n        if (!fn) {\n            this.get('/StandardErrorDialog').show(\"No File active\");\n            return true;\n        }\n \n        this.get('/DialogNewComponent').show(fn);\n        return true;\n}"
+                                                    },
+                                                    "label": "File _Properties",
+                                                    "pack": "add",
+                                                    "xtype": "MenuItem",
+                                                    "|use_underline": true,
+                                                    "|xns": "Gtk"
+                                                },
+                                                {
+                                                    "listeners": {
+                                                        "activate": "function (self, event) {\n    this.get('/RooProjectProperties').show();\n    return false;\n}"
+                                                    },
+                                                    "label": "Modify Project HTML ",
+                                                    "pack": "add",
+                                                    "xtype": "MenuItem",
+                                                    "|use_underline": true,
+                                                    "|xns": "Gtk"
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                },
+                                {
+                                    "label": "_View",
+                                    "xtype": "MenuItem",
+                                    "|use_underline": true,
+                                    "|xns": "Gtk",
+                                    "items": [
+                                        {
+                                            "|xns": "Gtk",
+                                            "xtype": "Menu",
+                                            "pack": "set_submenu",
+                                            "listeners": {},
+                                            "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], true);\n    } \n    return false;\n}"
+                                                    },
+                                                    "label": "_Redraw (Roo)",
+                                                    "pack": "add",
+                                                    "xtype": "MenuItem",
+                                                    "|use_underline": true,
+                                                    "|xns": "Gtk"
+                                                },
+                                                {
+                                                    "listeners": {
+                                                        "activate": "function (self, event) \n{\n        /* Firefox testing for debugging..\n          - we can create a /tmp directory, and put.\n            builder.html, builder.html.js, link roojs1 \n            add at the end of builder.html Roo.onload(function() {\n\t  */\n\t if (!this.get('/Window.LeftTree').getActiveFile()) {\n            return;\n        }\n        \n        var js = this.get('/LeftTree.model').toJS();\n         if (!js ||  !js[0]) {\n            return;\n        }\n        var project = this.get('/Window.LeftTree').getActiveFile().project;\n        //print (project.fn);\n        \n        project.runhtml  = project.runhtml || '';\n\n\n\tvar File = imports.File.File;\n\t\n\tvar target = \"/tmp/firetest\"; // fixme..\n\tif (!File.isDirectory(target)) {\n\t    File.mkdir(target);\n        }\n\tFile.copy(__script_path__ + '/../builder.html.js', target+ '/builder.html.js', Gio.FileCopyFlags.OVERWRITE);\n\tif (!File.exists( target+ '/roojs1')) {\n            File.link( target+ '/roojs1', __script_path__ + '/../roojs1');\n    \t}\n        \n        \n        \n        var html = imports.File.File.read(__script_path__ + '/../builder.html');\n        html = html.replace('</head>', project.runhtml + '</head>');\n        \n       \n        var     jsstr = JSON.stringify(js[0], null, 4);\n       \n        var runbuilder = '<script type=\"text/javascript\">' + \"\\n\" + \n            \" Builder.render(\" + jsstr + \");\\n\" +\n            '</script>';\n        \n        html = html.replace('</body>', runbuilder + '</body>');\n\n\tFile.write( target+ '/builder.html', html);\n\t\n        this.get('/Terminal').feed(\"RUN DIR:\" + target);\n    \n    this.get('/Terminal').el.fork_command( null , [], [], target\n\t, false,false,false); \n    var cmd = \"firefox file://\" + target + \"/builder.html  \\n\";\n    this.get('/Terminal').el.feed_child(cmd, cmd.length);\n     return false;\n}"
+                                                    },
+                                                    "label": "_Test in Firefox (Roo)",
+                                                    "pack": "add",
+                                                    "xtype": "MenuItem",
+                                                    "|use_underline": true,
+                                                    "|xns": "Gtk"
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                },
+                                {
+                                    "|xns": "Gtk",
+                                    "xtype": "MenuItem",
+                                    "label": "_Help",
+                                    "|use_underline": true,
+                                    "listeners": {},
+                                    "pack": "add",
+                                    "items": [
+                                        {
+                                            "|xns": "Gtk",
+                                            "xtype": "Menu",
+                                            "pack": "set_submenu",
+                                            "listeners": {},
+                                            "items": [
+                                                {
+                                                    "|xns": "Gtk",
+                                                    "xtype": "MenuItem",
+                                                    "pack": "add",
+                                                    "label": "_About",
+                                                    "|use_underline": true,
+                                                    "listeners": {
+                                                        "activate": "function (self) {\n    this.get('/About').el.run();\n}"
+                                                    }
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                }
+                            ]
+                        },
+                        {
+                            "|xns": "Gtk",
+                            "xtype": "HPaned",
+                            "id": "left",
+                            "position": 400,
+                            "items": [
+                                {
+                                    "|xns": "Gtk",
+                                    "xtype": "HBox",
+                                    "items": [
+                                        {
+                                            "|xns": "Gtk",
+                                            "xtype": "VPaned",
+                                            "position": 300,
+                                            "id": "leftvpaned",
+                                            "items": [
+                                                {
+                                                    "|xns": "Gtk",
+                                                    "xtype": "VBox",
+                                                    "id": "LeftTopPanel",
+                                                    "items": [
+                                                        {
+                                                            "listeners": {
+                                                                "activate": "function (self) {\n    // this does not actually expand it..\n    // that is done by GTK..\n    \n    \n \tif (!this.get('/Editor').save()) {\n \t    // popup!! - click handled.. \n \t    return true;\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",
+                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n   this.el.add_events (Gdk.EventMask.BUTTON_MOTION_MASK );\n}\n",
+                                                            "|onCollapse": "function() {\n    \n    var nb = this.get('/LeftTopPanel.notebook');\n    nb.el.set_current_page(0);\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"
+                                                        },
+                                                        {
+                                                            "id": "notebook",
+                                                            "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",
+                                                                    "pack": "add",
+                                                                    "xtype": "ScrolledWindow",
+                                                                    "|getActiveElement": "function() { // return path to actie node.\n\n     var path = this.getActivePath();\n     if (!path) {\n        return false;\n     }\n     var iter = new Gtk.TreeIter();\n     this.get('model').el.get_iter_from_string(iter, path);\n     \n     var value = new GObject.Value('');\n     this.get('model').el.get_value(iter, 2, value);\n        \n     return JSON.parse(value.value);\n}\n",
+                                                                    "|getActiveFile": "function() {\n    return this.get('model').file;\n}\n",
+                                                                    "|getActivePath": "function() {\n    var model = this.get('model');\n    var view = this.get('view');\n    if (view.selection.count_selected_rows() < 1) {\n        return false;\n    }\n    var iter = new Gtk.TreeIter();\n\n    view.selection.get_selected(model.el, iter);\n    return model.el.get_path(iter).to_string();\n}\n",
+                                                                    "|getPaleteProvider": "function() {\n    var model = this.get('model');\n    var pm = imports.Builder.Provider.ProjectManager.ProjectManager;\n    return pm.getPalete(model.file.getType());\n}\n",
+                                                                    "|getRenderer": "function() {\n\n\tswitch( this.getActiveFile().getType()) {\n\t\tcase 'Roo':\n\t\t    return this.get('/RightBrowser.view');\n\t\tcase 'Gtk':\n\t\t    return this.get('/RightGtkView');\n\t}\n\n}\n",
+                                                                    "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)\n}\n",
+                                                                    "|renderView": "function() {\n    var render = this.getRenderer();\n    var model = this.get('model');\n    if (render) {\n        render.renderJS(model.toJS(false,true)[0]);\n    } else {\n        print(\"NO RENDER JS METHOD?\");\n    }\n}\n",
+                                                                    "|shadow_type": "Gtk.ShadowType.IN",
+                                                                    "|xns": "Gtk",
+                                                                    "items": [
+                                                                        {
+                                                                            "listeners": {
+                                                                                "button_press_event": "function (self, ev) {\n \tconsole.log(\"button press?\");\n \t\n \tif (!this.get('/Editor').save()) {\n \t    // popup!! - click handled.. \n \t    return true;\n        }\n \t\n        if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button.button != 3) {\n            print(\"click\" + ev.type);\n            return false;\n        }\n      \n    \n        var res = {}; \n        this.get('/LeftTree.view').el.get_path_at_pos(ev.button.x,ev.button.y, res);\n        \n        if (!this.get('/LeftTreeMenu').el)  { this.get('/LeftTreeMenu').init(); }\n        \n        this.get('/LeftTreeMenu').el.set_screen(Gdk.Screen.get_default());\n        this.get('/LeftTreeMenu').el.show_all();\n        this.get('/LeftTreeMenu').el.popup(null, null, null, null, 3, ev.button.time);\n        print(\"click:\" + res.path.to_string());\n        return false;\n}",
+                                                                                "drag_begin": "function (self, drag_context) {\n\tprint('SOURCE: drag-begin');\n         this.targetData = false;\n        // find what is selected in our tree...\n        var iter = new Gtk.TreeIter();\n        var s = this.selection;\n        s.get_selected(this.get('/LeftTree.model').el, iter);\n\n        // set some properties of the tree for use by the dropped element.\n        var value = new GObject.Value('');\n        this.get('/LeftTree.model').el.get_value(iter, 2, value);\n        var data = JSON.parse(value.value);\n        var xname = this.get('/LeftTree.model').file.guessName(data);\n        \n        this.el.dragData = xname;\n        this.el.dropList = this.get('/LeftTree').getPaleteProvider().getDropList(xname);\n        \n\n        // make the drag icon a picture of the node that was selected\n        var path = this.get('/LeftTree.model').el.get_path(iter);\n        this.el.treepath = path.to_string();\n        \n        var pix = this.el.create_row_drag_icon ( path);\n        \n        Gtk.drag_set_icon_pixmap (ctx,\n            pix.get_colormap(),\n            pix,\n            null,\n            -10,\n            -10);\n        \n        return true;\n}",
+                                                                                "drag_end": "function (self, drag_context) {\n\tSeed.print('LEFT-TREE: drag-end');\n        this.el.dragData = false;\n        this.el.dropList = false;\n        this.targetData = false;\n        this.get('/LeftTree.view').highlight(false);\n        return true;\n}",
+                                                                                "drag_motion": "function (self, ctx, x, y, time) {\n    console.log(\"LEFT-TREE: drag-motion\");\n                var src = Gtk.drag_get_source_widget(ctx);\n\n                // a drag from  elsewhere...- prevent drop..\n                if (!src.dragData) {\n                    print(\"no drag data!\");\n                    Gdk.drag_status(ctx, 0, time);\n                    this.targetData = false;\n                    return true;\n                }\n                var action = Gdk.DragAction.COPY;\n                if (src == this.el) {\n                    // unless we are copying!!! ctl button..\n                    action = ctx.actions & Gdk.DragAction.MOVE ? Gdk.DragAction.MOVE : Gdk.DragAction.COPY ;\n                }\n                var data = {};\n\n\t\tif (!this.get('/LeftTree.model').el.iter_n_children(null)) {\n\t\t\t// no children.. -- asume it's ok..\n\t\t\tthis.targetData =  [ '' , Gtk.TreeViewDropPosition.INTO_OR_AFTER , ''];\n\t\t\tGdk.drag_status(ctx, action ,time);\n\t\t\treturn true;\n\t\t}\n\n                print(\"GETTING POS\");\n                var isOver = this.get('/LeftTree.view').el.get_dest_row_at_pos(x,y, data);\n                print(\"ISOVER? \" + isOver);\n                if (!isOver) {\n                    Gdk.drag_status(ctx, 0 ,time);\n                    return false; // not over apoint!?!\n                }\n                // drag node is parent of child..\n                console.log(\"SRC TREEPATH: \" + src.treepath);\n                console.log(\"TARGET TREEPATH: \" + data.path.to_string());\n                \n                // nned to check a  few here..\n                //Gtk.TreeViewDropPosition.INTO_OR_AFTER\n                //Gtk.TreeViewDropPosition.INTO_OR_BEFORE\n                //Gtk.TreeViewDropPosition.AFTER\n                //Gtk.TreeViewDropPosition.BEFORE\n                \n                if (typeof(src.treepath) != 'undefined'  && \n                    src.treepath == data.path.to_string().substring(0,src.treepath.length)) {\n                    print(\"subpath drag\");\n                     Gdk.drag_status(ctx, 0 ,time);\n                    return false;\n                }\n                \n                // check that \n                //print(\"DUMPING DATA\");\n                //console.dump(data);\n                // path, pos\n                \n                print(data.path.to_string() +' => '+  data.pos);\n                var tg = this.get('/LeftTree.model').findDropNodeByPath(\n                    data.path.to_string(), src.dropList, data.pos);\n                    \n                this.get('/LeftTree.view').highlight(tg);\n                if (!tg.length) {\n                    print(\"Can not find drop node path\");\n                    this.targetData = false;\n                    Gdk.drag_status(ctx, 0, time);\n                    return true;\n                }\n                //console.dump(tg);\n                this.targetData = tg;    \n                \n                \n                Gdk.drag_status(ctx, action ,time);\n                 \n                return true;\n}",
+                                                                                "drag_drop": "function (w, ctx, x, y, time) {\n      Seed.print(\"TARGET: drag-drop\");\n                       \n                        Gtk.drag_get_data\n                        (\n                                w,         /* will receive 'drag-data-received' signal */\n                                ctx,        /* represents the current state of the DnD */\n                                this.get('/Window').atoms[\"STRING\"],    /* the target type we want */\n                                time            /* time stamp */\n                        );\n                        \n                         \n                        /* No target offered by source => error */\n                       \n\n                        return  true;\n}",
+                                                                                "drag_data_received": "function (self, ctx, x, y, sel_data, info, time) {\n\t print(\"Tree: drag-data-received\");\n\n              var   delete_selection_data = false;\n               var  dnd_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                    \n                    var source = Gtk.drag_get_source_widget(ctx);\n\n                    if (this.targetData) {\n                        if (source != this.el) {\n                            this.get('/LeftTree.model').dropNode(this.targetData,  source.dragData);\n                        } else {\n                            // drag around.. - reorder..\n                             this.get('/LeftTree.model').moveNode(this.targetData, ctx.action);\n                            \n                            \n                        }\n                        //Seed.print(this.targetData);\n                      \n                    }\n                    \n                    \n                    \n                    // we can send stuff to souce here...\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}",
+                                                                                "cursor_changed": "function (self) {\n     if (this.blockChanges) { // probably not needed.. \n       return true;\n     }\n     var render = this.get('/LeftTree').getRenderer();                \n   \n    \n    if (this.selection.count_selected_rows() < 1) {\n        this.get('/LeftPanel.model').load( false);\n        this.get('/MidPropTree').activeElement =  false;\n        this.get('/MidPropTree').hideWin();\n\n        var pm = this.get('/RightPalete.model');\n        if (!this.get('/LeftTree').getPaleteProvider()) {\n            // it may not be loaded yet..\n            return  true;\n        }\n        pm.load( this.get('/LeftTree').getPaleteProvider().gatherList(\n            this.get('/LeftTree.model').listAllTypes()));\n        if (render && render.redraw) {\n            render.redraw();\n        }\n        return true;\n    }\n            \n            //console.log('changed');\n        var s = this.selection;\n          var iter = new Gtk.TreeIter();\n        s.get_selected(this.get('/LeftTree.model').el, iter);\n        \n        \n        // var val = \"\";\n        var value = new GObject.Value('');\n        this.get('/LeftTree.model').el.get_value(iter, 2, value);\n        this.get('/LeftTree.model').activePath = this.get('/LeftTree.model').el.get_path(iter).to_string();\n        \n        var data = JSON.parse(value.value);\n        this.get('/MidPropTree').activeElement =  data;\n        this.get('/MidPropTree').hideWin();\n        this.get('/LeftPanel.model').load( data);\n        \n        console.log(value.value);\n       // _g.button.set_label(''+value.get_string());\n\n        var pm =this.get('/RightPalete.model');\n        pm.load(  this.get('/LeftTree').getPaleteProvider().gatherList(\n             this.get('/LeftTree.model').listAllTypes()));\n       \n        \n           if (render && render.redraw) {\n            render.redraw();\n        }\n           \n            //Seed.print( value.get_string());\n            return true;\n                \n}"
+                                                                            },
+                                                                            "id": "view",
+                                                                            "pack": "add",
+                                                                            "tooltip_column": 1,
+                                                                            "xtype": "TreeView",
+                                                                            "|enable_tree_lines": true,
+                                                                            "|headers_visible": false,
+                                                                            "|highlight": "function(treepath_ar) {\n\n        // highlighting for drag/drop\n        if (treepath_ar.length && treepath_ar[0].length ) {\n            this.el.set_drag_dest_row( \n                    new  Gtk.TreePath.from_string( treepath_ar[0] ),  treepath_ar[1]);\n            } else {\n                this.el.set_drag_dest_row(null, Gtk.TreeViewDropPosition.INTO_OR_AFTER);\n            }\n             \n        }",
+                                                                            "|init": "function() {\n    \tXObject.prototype.init.call(this);\n\tvar description = new Pango.FontDescription.c_new();\n\tdescription.set_size(8000);\n\tthis.el.modify_font(description);\n\n\tthis.selection = this.el.get_selection();\n\tthis.selection.set_mode( Gtk.SelectionMode.SINGLE);\n\tvar _this = this;\n\n\t// is this really needed??\n\tthis.selection.signal['changed'].connect(function() {\n\t\t_this.get('/LeftTree.view').listeners.cursor_changed.apply(\n\t\t    _this.get('/LeftTree.view'), [ _this.get('/LeftTree.view'), '']\n\t\t);\n\t});\n\n\tGtk.drag_source_set (\n\t\tthis.el,            /* widget will be drag-able */\n\t\tGdk.ModifierType.BUTTON1_MASK,       /* modifier that will start a drag */\n\t\tnull,            /* lists of target to support */\n\t\t0,              /* size of list */\n\t\tGdk.DragAction.COPY   | Gdk.DragAction.MOVE           /* what to do with data after dropped */\n\t);\n\n\tGtk.drag_source_set_target_list(this.el, this.get('/Window').targetList);\n\n\tGtk.drag_source_add_text_targets(this.el); \n\tGtk.drag_dest_set\n\t(\n\t    this.el,              /* widget that will accept a drop */\n\t    Gtk.DestDefaults.MOTION  | Gtk.DestDefaults.HIGHLIGHT,\n\t    null,            /* lists of target to support */\n\t    0,              /* size of list */\n\t    Gdk.DragAction.COPY   | Gdk.DragAction.MOVE       /* what to do with data after dropped */\n\t);\n\n\tGtk.drag_dest_set_target_list(this.el, this.get('/Window').targetList);\n\tGtk.drag_dest_add_text_targets(this.el);\n}\n",
+                                                                            "|selectNode": "function(treepath_str) {\n    //this.selection.select_path(new  Gtk.TreePath.from_string( treepath_str));\n var tp = new Gtk.TreePath.from_string(treepath_str);\n          this.el.set_cursor(tp, null, false);  \n      this.el.scroll_to_cell(tp, null, false, 0,0);\n}\n",
+                                                                            "|xns": "Gtk",
+                                                                            "items": [
+                                                                                {
+                                                                                    "activePath": false,
+                                                                                    "currentTree": false,
+                                                                                    "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        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",
+                                                                                    "|findDropNodeByPath": "function(treepath_str, targets, pref) {\n    var path = treepath_str + ''; // dupe it..\n    pref = typeof(pref) == 'undefined' ?  Gtk.TreeViewDropPosition.INTO_OR_AFTER : pref;\n    var last = false;\n    //console.dump(this.treemap);\n    while (path.length) {\n        print(\"LOOKING FOR PATH: \" + path);\n        var node_data = this.singleNodeToJS(path);\n        if (node_data === false) {\n            print(\"node not found\");\n            return [];\n        }\n        \n        var xname = this.get('/LeftTree.model').file.guessName(node_data);\n        var match = false;\n        var prop = '';\n        targets.forEach(function(tg) {\n            if (match) {\n                return;;\n            }\n            if ((tg == xname)  ) {\n                match = tg;\n            }\n            if (tg.indexOf(xname +':') === 0) {\n                match = tg;\n                prop = tg.split(':').pop();\n            }\n        });\n        \n        if (match) {\n            if (last) { // pref is after/before..\n                // then it's after last\n                if (pref > 1) {\n                    return []; // do not allow..\n                }\n                return [ last, pref , prop];\n                \n            }\n            return [ path , Gtk.TreeViewDropPosition.INTO_OR_AFTER , prop];\n        }\n        var par = path.split(':');\n        last = path;\n        par.pop();\n        path = par.join(':');\n    }\n    \n    return [];\n            \n}\n",
+                                                                                    "|getIterValue": " function (iter, col) {\n    var gval = new GObject.Value('');\n    this.el.get_value(iter, col ,gval);\n    return  gval.value;\n    \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            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",
+                                                                                    "|nodeToJS": "function (treepath, with_id) \n{\n    \n    var iter = treepath;  // API used to be iter here..\n    if (typeof(iter) == 'string') {\n        iter = new Gtk.TreeIter(); \n        if (!this.el.get_iter(iter, new Gtk.TreePath.from_string(treepath))) {\n            return false;\n        }\n    } \n    var par = new Gtk.TreeIter(); \n    var iv = this.getIterValue(iter, 2);\n   // print(\"IV\" + iv);\n    var k = JSON.parse(iv);\n    if (k.json && !this.el.iter_parent( par, iter  )) {\n        delete k.json;\n    }\n    \n    if (with_id) {\n        var treepath_str = this.el.get_path(iter).to_string();\n        // not sure how we can handle mixed id stuff..\n        if (typeof(k.id) == 'undefined')  {\n            k.id =  'builder-'+ treepath_str ;\n        }\n        \n        // needed??\n        this.treemap[  treepath_str ] = k;\n        k.xtreepath = treepath_str ;\n        \n    }\n    if (this.el.iter_has_child(iter)) {\n        citer = new Gtk.TreeIter();\n        this.el.iter_children(citer, iter);\n        k.items = this.toJS(citer,with_id);\n    }\n    return k;\n}\n",
+                                                                                    "|nodeToJSON": "function(c) {\n    var o  = {}\n    for (var i in c) {\n        if (i == 'items') {\n             continue;\n        }\n        o[i] = c[i];\n    }\n    return JSON.stringify(o);\n}\n",
+                                                                                    "|singleNodeToJS": "function (treepath) \n        {\n            var iter = new Gtk.TreeIter(); \n            if (!this.el.get_iter(iter, new Gtk.TreePath.from_string(treepath))) {\n                return false;\n            }\n            \n            var iv = this.getIterValue(iter, 2);\n           \n            return JSON.parse(iv);\n            \n        }",
+                                                                                    "|toJS": "function(treepath, with_id)\n{\n    //Seed.print(\"WITHID: \"+ with_id);\n    var iter = treepath;  // API used to be iter here..\n    if (typeof(iter) == 'string') {\n        iter = new Gtk.TreeIter(); \n        if (!this.el.get_iter(iter, new Gtk.TreePath.from_string(treepath))) {\n            return false;\n        }\n    } \n    var first = false;\n    if (!iter) {\n        \n        this.treemap = { }; \n        \n        iter = new Gtk.TreeIter();\n        if (!this.el.get_iter_first(iter)) {\n            return [];\n        }\n        first = true;\n    } \n    \n    var ar = [];\n       \n    while (true) {\n        \n        var k = this.nodeToJS(iter, with_id); \n        ar.push(k);\n        \n        \n        if (!this.el.iter_next(iter)) {\n            break;\n        }\n    }\n    \n    if (treepath === false) {\n        //dupe!!!\n        return JSON.parse(JSON.stringify(ar));\n    }\n    \n    return ar;\n    // convert the list into a json string..\n\n    \n}",
+                                                                                    "|xns": "Gtk"
+                                                                                },
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "TreeViewColumn",
+                                                                                    "pack": "append_column",
+                                                                                    "|init": "function() {\n    XObject.prototype.init.call(this);\n   this.el.add_attribute(this.items[0].el , 'markup', 0 );\n}\n",
+                                                                                    "items": [
+                                                                                        {
+                                                                                            "|xns": "Gtk",
+                                                                                            "xtype": "CellRendererText",
+                                                                                            "pack": "pack_start"
+                                                                                        }
+                                                                                    ]
+                                                                                }
+                                                                            ]
+                                                                        },
+                                                                        {
+                                                                            "|xns": "Gtk",
+                                                                            "xtype": "Menu",
+                                                                            "pack": false,
+                                                                            "id": "LeftTreeMenu",
+                                                                            "items": [
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "MenuItem",
+                                                                                    "pack": "add",
+                                                                                    "label": "Delete Element",
+                                                                                    "listeners": {
+                                                                                        "activate": "function (self) {\n\n     this.get('/LeftTree.model').deleteSelected();\n}"
+                                                                                    }
+                                                                                },
+                                                                                {
+                                                                                    "listeners": {
+                                                                                        "activate": "function (self) {\n\n     var tree = this.get('/LeftTree');\n      var model = this.get('/LeftTree.model');\n     var el = tree.getActivePath();\n     print(el);\n     var js = model.toJS(el, false);\n    // print(JSON.stringify(js[0], null,4));\n     this.get('/DialogSaveTemplate').show(JSON.stringify(js[0], null,4));\n     \n    \n}"
+                                                                                    },
+                                                                                    "label": "Save as Template",
+                                                                                    "pack": "add",
+                                                                                    "xtype": "MenuItem",
+                                                                                    "|xns": "Gtk"
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                },
+                                                                {
+                                                                    "|xns": "Gtk",
+                                                                    "xtype": "VBox",
+                                                                    "pack": "add",
+                                                                    "id": "LeftProjectTree",
+                                                                    "|showNoProjectSelected": "function() {\n   this.get('/StandardErrorDialog').show(\"Select a Project first.\"); \n}\n",
+                                                                    "|getActiveProject": "function() {\n     return this.project;\n}\n",
+                                                                    "listeners": {
+                                                                        "leave_notify_event": "function (self, event) {\n    return false;\n}"
+                                                                    },
+                                                                    "items": [
+                                                                        {
+                                                                            "|xns": "Gtk",
+                                                                            "xtype": "HBox",
+                                                                            "pack": "pack_start,false,false",
+                                                                            "items": [
+                                                                                {
+                                                                                    "listeners": {
+                                                                                        "changed": "function (self) {\n\tvar fn = this.getValue();\n\tvar pm  = imports.Builder.Provider.ProjectManager.ProjectManager;\n\tthis.get('/LeftProjectTree.model').loadProject(pm.getByFn(fn))\n}"
+                                                                                    },
+                                                                                    "id": "combo",
+                                                                                    "xtype": "ComboBox",
+                                                                                    "|getValue": "function() {\n    var ix = this.el.get_active();\n    if (ix < 0 ) {\n        return false;\n    }\n    var data = imports.Builder.Provider.ProjectManager.ProjectManager.projects;\n    if (typeof(data[ix]) == 'undefined') {\n \treturn false; \n    }\n    return data[ix].fn;\n}",
+                                                                                    "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.get('render').el , 'markup', 1 );  \n}\n",
+                                                                                    "|setValue": "function(fn)\n{\n    var el = this.el;\n    el.set_active(-1);\n    var data = imports.Builder.Provider.ProjectManager.ProjectManager.projects;\n    data.forEach(function(n, ix) {\n        if (fn == n.fn) {\n            el.set_active(ix);\n            return false;\n        }\n    });\n}\n",
+                                                                                    "|xns": "Gtk",
+                                                                                    "items": [
+                                                                                        {
+                                                                                            "|xns": "Gtk",
+                                                                                            "xtype": "CellRendererText",
+                                                                                            "pack": "pack_start,true",
+                                                                                            "id": "render"
+                                                                                        },
+                                                                                        {
+                                                                                            "id": "combomodel",
+                                                                                            "pack": "set_model",
+                                                                                            "xtype": "ListStore",
+                                                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n  this.el.set_column_types ( 2, [\n        GObject.TYPE_STRING,  // real key\n        GObject.TYPE_STRING // real type\n        \n        \n    ] );\n   // this.el.set_sort_column_id(1,Gtk.SortType.ASCENDING);\n   var pm = imports.Builder.Provider.ProjectManager.ProjectManager;\n   var _this = this;\n   pm.on('changed', function() {\n       print(\"caught changed hook on project manager - reloading data\");\n\t_this.loadData(pm.projects);\n\n   });\n}\n",
+                                                                                            "|loadData": "function(data) {\n     var ov = this.get('/LeftProjectTree.combo').getValue();\n    this.el.clear();\n    var iter = new Gtk.TreeIter();\n    var el = this.el;\n    data.forEach(function(p) {\n        \n        el.append(iter);\n        \n         \n        el.set_value(iter, 0, p.fn);\n        el.set_value(iter, 1, p.name);\n        \n    });\n    \n    this.get('/LeftProjectTree.combo').setValue(ov);\n}\n",
+                                                                                            "|xns": "Gtk"
+                                                                                        }
+                                                                                    ]
+                                                                                }
+                                                                            ]
+                                                                        },
+                                                                        {
+                                                                            "|xns": "Gtk",
+                                                                            "xtype": "ScrolledWindow",
+                                                                            "pack": "add",
+                                                                            "|shadow_type": "Gtk.ShadowType.IN",
+                                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_policy  (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC );\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.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,
+                                                                                    "xtype": "TreeView",
+                                                                                    "|enable_tree_lines": true,
+                                                                                    "|headers_visible": false,
+                                                                                    "|init": "function() {\n    XObject.prototype.init.call(this);\nvar description = new Pango.FontDescription.c_new();\n                            description.set_size(8000);\n                            this.el.modify_font(description);\n                            \n                            this.selection = this.el.get_selection();\n                            this.selection.set_mode( Gtk.SelectionMode.SINGLE);\n}\n",
+                                                                                    "|xns": "Gtk",
+                                                                                    "items": [
+                                                                                        {
+                                                                                            "|xns": "Gtk",
+                                                                                            "xtype": "TreeStore",
+                                                                                            "pack": "set_model",
+                                                                                            "id": "model",
+                                                                                            "|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 // id..\n                    ] );\n   \n}\n",
+                                                                                            "|loadProject": "function(pr) {\nprint(\"LOAD PROJECT\");\n           this.el.clear();\n            if (!pr) {\n                return;\n            }\n            \n            this.get('/LeftProjectTree').project = pr;\n            this.load(pr.toTree());\n            this.get('/LeftProjectTree.view').el.expand_all();\n}\n",
+                                                                                            "|load": "function(tr,iter) {\n  //  console.dump(tr);\n            console.log('Project tree load: ' + tr.length);\n            var citer = new Gtk.TreeIter();\n            //this.insert(citer,iter,0);\n            \n            var _this = this;\n            tr.forEach(function (r) {\n                if (!iter) {\n                    _this.el.append(citer);   \n                } else {\n                    _this.el.insert(citer,iter,-1);\n                }\n                _this.el.set_value(citer, 0,  '' + r.getTitle() ); // title \n                _this.el.set_value(citer, 1, '' + r.getTitleTip()); // tip\n                _this.el.set_value(citer, 2, '' + r.id ); //id\n                if (r.cn && r.cn.length) {\n                    _this.load(r.cn, citer);\n                }\n                \n            });\n}\n",
+                                                                                            "|getValue": "function(iter, col) {\n    var gval = new GObject.Value('');\n    this.el.get_value(iter, col ,gval);\n    return  '' + gval.value;\n}\n"
+                                                                                        },
+                                                                                        {
+                                                                                            "|xns": "Gtk",
+                                                                                            "xtype": "TreeViewColumn",
+                                                                                            "pack": "append_column",
+                                                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.items[0].el , 'markup', 0 );\n}\n",
+                                                                                            "items": [
+                                                                                                {
+                                                                                                    "|xns": "Gtk",
+                                                                                                    "xtype": "CellRendererText",
+                                                                                                    "pack": "pack_start"
+                                                                                                }
+                                                                                            ]
+                                                                                        }
+                                                                                    ]
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                },
+                                                {
+                                                    "|xns": "Gtk",
+                                                    "xtype": "VBox",
+                                                    "listeners": {},
+                                                    "items": [
+                                                        {
+                                                            "|xns": "Gtk",
+                                                            "xtype": "HBox",
+                                                            "pack": "pack_start,false,true,0",
+                                                            "id": "LeftProps",
+                                                            "items": [
+                                                                {
+                                                                    "|xns": "Gtk",
+                                                                    "xtype": "Button",
+                                                                    "pack": "add",
+                                                                    "listeners": {
+                                                                        "button_press_event": "function (self, event) {\n    this.get('/MidPropTree.model').showData('props');\n    return false;\n}"
+                                                                    },
+                                                                    "items": [
+                                                                        {
+                                                                            "|xns": "Gtk",
+                                                                            "xtype": "HBox",
+                                                                            "pack": "add",
+                                                                            "items": [
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "Image",
+                                                                                    "pack": "add",
+                                                                                    "|stock": "Gtk.STOCK_ADD",
+                                                                                    "|icon_size": "Gtk.IconSize.MENU"
+                                                                                },
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "Label",
+                                                                                    "pack": "add",
+                                                                                    "label": "Property"
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                },
+                                                                {
+                                                                    "listeners": {
+                                                                        "button_press_event": "function (self, event) {\n    \n \tif (!this.get('/Editor').save()) {\n \t    // popup!! - click handled.. \n \t    return true;\n        }\n        this.get('/MidPropTree.model').showData('events');\n    return false;\n}"
+                                                                    },
+                                                                    "pack": "add",
+                                                                    "xtype": "Button",
+                                                                    "|xns": "Gtk",
+                                                                    "items": [
+                                                                        {
+                                                                            "|xns": "Gtk",
+                                                                            "xtype": "HBox",
+                                                                            "pack": "add",
+                                                                            "items": [
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "Image",
+                                                                                    "pack": "add",
+                                                                                    "|stock": "Gtk.STOCK_ADD",
+                                                                                    "|icon_size": "Gtk.IconSize.MENU"
+                                                                                },
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "Label",
+                                                                                    "pack": "add",
+                                                                                    "label": "Handler"
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                },
+                                                                {
+                                                                    "listeners": {
+                                                                        "button_press_event": "function (self, ev) {\n\n \tif (!this.get('/Editor').save()) {\n \t    // popup!! - click handled.. \n \t    return true;\n        }\n        \n\tvar p = this.get('/AddPropertyPopup');\n\tif (!p.el) {\n\t\tp.init();\n\t}\n \tp.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    return true;\n}"
+                                                                    },
+                                                                    "pack": "add",
+                                                                    "xtype": "Button",
+                                                                    "|xns": "Gtk",
+                                                                    "items": [
+                                                                        {
+                                                                            "|xns": "Gtk",
+                                                                            "xtype": "HBox",
+                                                                            "pack": "add",
+                                                                            "items": [
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "Image",
+                                                                                    "pack": "add",
+                                                                                    "|stock": "Gtk.STOCK_ADD",
+                                                                                    "|icon_size": "Gtk.IconSize.MENU"
+                                                                                },
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "Label",
+                                                                                    "pack": "add",
+                                                                                    "label": "Other"
+                                                                                }
+                                                                            ]
+                                                                        },
+                                                                        {
+                                                                            "|xns": "Gtk",
+                                                                            "xtype": "Menu",
+                                                                            "pack": false,
+                                                                            "id": "AddPropertyPopup",
+                                                                            "items": [
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "MenuItem",
+                                                                                    "pack": "append",
+                                                                                    "tooltip_markup": "Using this.get('*someid') will find any id in an application.",
+                                                                                    "label": "ID",
+                                                                                    "listeners": {
+                                                                                        "activate": "function (self) {\n\n    this.get('/LeftPanel.model').add( {\n        key : 'id', \n        type : 'string',\n        val : '',\n        //skel  : skel,\n        etype : 'props'\n    });\n}"
+                                                                                    }
+                                                                                },
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "MenuItem",
+                                                                                    "pack": "append",
+                                                                                    "tooltip_markup": "Add what type of packing is to be used",
+                                                                                    "label": "PACK",
+                                                                                    "listeners": {
+                                                                                        "activate": "function (self) {\n\n    this.get('/LeftPanel.model').add( {\n    \t key : 'pack', \n       \t type : 'string',\n       \t val : 'add',\n          etype : 'props'\n    });\n}"
+                                                                                    }
+                                                                                },
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "MenuItem",
+                                                                                    "pack": "append",
+                                                                                    "tooltip_markup": "Override the init method",
+                                                                                    "label": "INIT",
+                                                                                    "listeners": {
+                                                                                        "activate": "function (self) {\n\n    this.get('/LeftPanel.model').add( {\n       key : '|init', \n        type : 'function',\n        val  : \"function() {\\n    XObject.prototype.init.call(this);\\n}\\n\",\n        etype : 'props'\n    });\n}"
+                                                                                    }
+                                                                                },
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "SeparatorMenuItem",
+                                                                                    "pack": "add"
+                                                                                },
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "MenuItem",
+                                                                                    "pack": "append",
+                                                                                    "tooltip_markup": "Add a user defined string property",
+                                                                                    "label": "String",
+                                                                                    "listeners": {
+                                                                                        "activate": "function (self) {\n\n    this.get('/LeftPanel.model').add( {\n  \t\t  key : '', \n                type : 'string',\n                val  : \"\",\n                etype : 'props'\n    });\n}"
+                                                                                    }
+                                                                                },
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "MenuItem",
+                                                                                    "pack": "append",
+                                                                                    "tooltip_markup": "Add a user defined number property",
+                                                                                    "label": "Number",
+                                                                                    "listeners": {
+                                                                                        "activate": "function (self) {\n\n    this.get('/LeftPanel.model').add( {\n  \t\t  key : '', \n                type : 'number',\n                val  : 0,\n                etype : 'props'\n    });\n}"
+                                                                                    }
+                                                                                },
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "MenuItem",
+                                                                                    "pack": "append",
+                                                                                    "tooltip_markup": "Add a user defined boolean property",
+                                                                                    "label": "Boolean",
+                                                                                    "listeners": {
+                                                                                        "activate": "function (self) {\n\n    this.get('/LeftPanel.model').add( {\n  \t\t  key : '', \n                type : 'boolean',\n                val  : false,\n                etype : 'props'\n    });\n}"
+                                                                                    }
+                                                                                },
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "SeparatorMenuItem",
+                                                                                    "pack": "add"
+                                                                                },
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "MenuItem",
+                                                                                    "pack": "append",
+                                                                                    "tooltip_markup": "Add a user function boolean property",
+                                                                                    "label": "Function",
+                                                                                    "listeners": {
+                                                                                        "activate": "function (self) {\n\n    this.get('/LeftPanel.model').add( {\n  \t    key : '|', \n                        type : 'function',\n                        val  : \"function() {\\n    \\n}\\n\",\n                        etype : 'props'\n    });\n}"
+                                                                                    }
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            "editing": false,
+                                                            "id": "LeftPanel",
+                                                            "pack": "add",
+                                                            "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": [
+                                                                {
+                                                                    "listeners": {
+                                                                        "button_press_event": "function (self, ev) {\n\n    \n    if (!this.get('/Editor').save()) {\n        // popup!! - click handled.. \n        return true;\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,
+                                                                    "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",
+                                                                    "|xns": "Gtk",
+                                                                    "items": [
+                                                                        {
+                                                                            "activePath": false,
+                                                                            "id": "model",
+                                                                            "pack": "set_model",
+                                                                            "xtype": "TreeStore",
+                                                                            "|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",
+                                                                            "|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{\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// might casue problesm..\n    // this.get('/Editor.RightEditor').save();\n\n       this.get('/Editor').el.hide();\n     this.get('/Editor').activePath = false;\n\n\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    this.get('/Editor').activePath = false;\n    this.get('/Editor').el.hide();\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     \n    \n    if (showEditor) {\n\n        this.activePath = false;\n        \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            _this.get('/Editor').activePath = path;\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\n    this.el.add_attribute(this.items[0].el , 'markup', 2 );\n    this.get('/LeftPanel').propertyColumn = this;\n}\n",
+                                                                            "title": "key",
+                                                                            "items": [
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "CellRendererText",
+                                                                                    "pack": "pack_start",
+                                                                                    "listeners": {
+                                                                                        "editing_started": "function (self, editable, path) {\n\n        this.get('/LeftPanel.model').activePath  = path;\n\n}",
+                                                                                        "edited": "function (self, object, p0) {\n\tvar model = this.get('/LeftPanel.model');\n        var path = model.activePath;\n        var iter = new Gtk.TreeIter();\n        model.el.get_iter(iter, new Gtk.TreePath.from_string(path));\n        model.el.set_value(iter, 0, p0);\n        model.el.set_value(iter, 2, p0);\n        \n\tmodel.activePath = false;\n\n\tthis.get('/LeftTree.model').changed(model.toJS(), true); \n        this.el.editable = false;\n}"
+                                                                                    }
+                                                                                }
+                                                                            ]
+                                                                        },
+                                                                        {
+                                                                            "pack": "append_column",
+                                                                            "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": [
+                                                                                {
+                                                                                    "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",
+                                                                                    "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",
+                                                                                    "|xns": "Gtk"
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                },
+                                                                {
+                                                                    "|xns": "Gtk",
+                                                                    "xtype": "Menu",
+                                                                    "pack": false,
+                                                                    "id": "LeftPanelPopup",
+                                                                    "items": [
+                                                                        {
+                                                                            "|xns": "Gtk",
+                                                                            "xtype": "MenuItem",
+                                                                            "pack": "append",
+                                                                            "label": "Delete",
+                                                                            "listeners": {
+                                                                                "activate": "function (self) {\n\tthis.get('/LeftPanel.model').deleteSelected();\n}"
+                                                                            }
+                                                                        },
+                                                                        {
+                                                                            "|xns": "Gtk",
+                                                                            "xtype": "MenuItem",
+                                                                            "pack": "append",
+                                                                            "label": "Edit",
+                                                                            "listeners": {
+                                                                                "activate": "function (self) {\n\tthis.get('/LeftPanel.model').startEditing(false, 0);\n}"
+                                                                            }
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            "|xns": "Gtk",
+                                            "xtype": "ScrolledWindow",
+                                            "pack": "pack_end,false,true,0",
+                                            "id": "MidPropTree",
+                                            "|shadow_type": "Gtk.ShadowType.IN",
+                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n       XObject.prototype.init.call(this); \n    this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)\n    this.el.set_size_request ( 150, -1 );\n    this.shown = true;\n}\n",
+                                            "activeElement": false,
+                                            "|hideWin": "function() {\n     \n    if (!this.shown) {\n        return;\n    }\n    \n    \n    if (this.get('/Window.left').el.position < 160) {\n        return;\n    }\n    this.get('/Window.left').el.position = this.get('/Window.left').el.position  - 150;\n        \n    this.el.hide();\n    this.shown = false;\n}\n",
+                                            "items": [
+                                                {
+                                                    "listeners": {
+                                                        "cursor_changed": "function (self) {\n       var iter = new Gtk.TreeIter();\n                        \n                        //console.log('changed');\n        var m = this.get('model');\n\tif (!this.selection){\n\t\tthis.selection = this.el.get_selection();\n\t}\n\n        var s = this.selection;\n        if (!s.get_selected(m.el, iter)) {\n\t\treturn; \n\t}\n        var tp = m.el.get_path(iter).to_string();\n        \n        \n        // var val = \"\";\n        \n        var key = m.getValue(tp, 0);\n        \n        var type = m.getValue(tp, 1);\n        var skel = m.getValue(tp, 3);\n        var etype = m.getValue(tp, 5);\n        \n        \n        this.get('/MidPropTree').hideWin();\n\n        if (type.toLowerCase() == 'function') {\n            \n            if (etype != 'events') {\n                key = '|' + key;\n            }\n            \n            this.get('/LeftPanel.model').add({\n                key :  key, \n                type : type,\n                val  : skel,\n                etype : etype\n            })  \n            return;\n        }\n        // has dot in name, and is boolean???? this does not make sense..\n        //if (type.indexOf('.') > -1 ||  type.toLowerCase() == 'boolean') {\n        //     key = '|' + key;\n       // }\n        \n        this.get('/LeftPanel.model').add( {\n            key : key, \n            type : type,\n            //skel  : skel,\n            etype : etype\n           }) //, \n}"
+                                                    },
+                                                    "pack": "add",
+                                                    "tooltip_column": 2,
+                                                    "xtype": "TreeView",
+                                                    "|enable_tree_lines": true,
+                                                    "|headers_visible": false,
+                                                    "|init": "function() {\n\tXObject.prototype.init.call(this); \n                    \n       var description = new Pango.FontDescription.c_new();\n     description.set_size(8000);\n    this.el.modify_font(description);     \n                    \n    //this.selection = this.el.get_selection();\n    // this.selection.set_mode( Gtk.SelectionMode.SINGLE);\n \n\n    \n  \n    \n}\n",
+                                                    "|xns": "Gtk",
+                                                    "items": [
+                                                        {
+                                                            "id": "model",
+                                                            "pack": "set_model",
+                                                            "xtype": "ListStore",
+                                                            "|getValue": "function(treepath, col)\n{\n    var tp = new Gtk.TreePath.from_string (treepath);\n    var iter = new Gtk.TreeIter();\n    this.el.get_iter (iter, tp);\n    var value = new GObject.Value('');\n    this.el.get_value(iter, col, value);\n    return value.value;\n    \n}",
+                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n   this.el.set_column_types ( 6, [\n        GObject.TYPE_STRING,  // real key\n         GObject.TYPE_STRING, // real type\n         GObject.TYPE_STRING, // docs ?\n         GObject.TYPE_STRING, // visable desc\n         GObject.TYPE_STRING, // function desc\n         GObject.TYPE_STRING // element type (event|prop)\n        \n    ] );\n}\n",
+                                                            "|showData": "function(type) {\n    this.el.clear();\n            if (!this.get('/MidPropTree').activeElement || !type) {\n                return; // no active element\n            }\n\n            var fullpath = this.get('/LeftTree.model').file.guessName(this.get('/MidPropTree').activeElement);\n            var palete = this.get('/LeftTree').getPaleteProvider();\n            \n             \n            \n            Seed.print('Showing right?');\n            if (!this.get('/MidPropTree').shown) {\n\n                this.get('/Window.left').el.position = this.get('/Window.left').el.position  + 150;\n                this.get('/MidPropTree').el.show();\n                this.get('/MidPropTree').shown = true;\n            }\n            \n            var elementList = palete.getPropertiesFor(fullpath, type).sort(function(a,b) { \n                return a.name >  b.name ? 1 : -1;\n            });\n            print (\"GOT \" + elementList.length + \" items for \" + fullpath + \"|\" + type);\n           // console.dump(elementList);\n           \n            \n            var iter = new Gtk.TreeIter();\n            for(var i =0 ; i < elementList.length; i++) {\n                var p=elementList[i];\n                this.el.append(iter);\n              //  console.log( '<b>' + p.name +'</b> ['+p.type+']');\n                    //GObject.TYPE_STRING,  // real key\n                    // GObject.TYPE_STRING, // real type\n                    // GObject.TYPE_STRING, // docs ?this.el.set_value(iter, 0, p.name);et_value(iter, 0, p.name);\n                    // GObject.TYPE_STRING // func def?\n                    \n                \n                this.el.set_value(iter, 0, p.name);\n                this.el.set_value(iter, 1, p.type);\n                this.el.set_value(iter, 2, '<span size=\"small\"><b>' + p.name +'</b> ['+p.type+']</span>' + \"\\n\" + p.desc);\n                this.el.set_value(iter, 3, p.sig ? p.sig  : '');\n                this.el.set_value(iter, 4, '<span size=\"small\"><b>' + p.name +'</b> ['+p.type+']</span>');\n                this.el.set_value(iter, 5, type);\n                \n            }\n                             \n}\n",
+                                                            "|xns": "Gtk"
+                                                        },
+                                                        {
+                                                            "pack": false,
+                                                            "xtype": "TreeViewColumn",
+                                                            "|init": "function() {\n    this.el = new Gtk.TreeViewColumn();\n    this.parent.el.append_column(this.el);\n    \n    XObject.prototype.init.call(this);\n    this.el.add_attribute(this.items[0].el , 'markup', 4  );\n}\n",
+                                                            "|xns": "Gtk",
+                                                            "items": [
+                                                                {
+                                                                    "|xns": "Gtk",
+                                                                    "xtype": "CellRendererText",
+                                                                    "pack": "pack_start,true"
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                },
+                                {
+                                    "|xns": "Gtk",
+                                    "xtype": "HBox",
+                                    "pack": "add",
+                                    "items": [
+                                        {
+                                            "|xns": "Gtk",
+                                            "xtype": "VPaned",
+                                            "pack": "add",
+                                            "position": 300,
+                                            "items": [
+                                                {
+                                                    "|xns": "Gtk",
+                                                    "xtype": "VBox",
+                                                    "pack": "add",
+                                                    "items": [
+                                                        {
+                                                            "|xns": "Gtk",
+                                                            "xtype": "Notebook",
+                                                            "pack": "pack_start,true,true",
+                                                            "id": "view-help-nb",
+                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n   this.el.set_tab_label(this.items[0].el, new Gtk.Label({ label : \"Preview\" }));\n    this.el.set_tab_label(this.items[1].el, new Gtk.Label({ label : \"Help\" }));\n}\n",
+                                                            "items": [
+                                                                {
+                                                                    "id": "view-notebook",
+                                                                    "pack": "add",
+                                                                    "tab_border": 0,
+                                                                    "xtype": "Notebook",
+                                                                    "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_current_page(0);\n    //print(\"SET LABEL?\")\n    this.el.set_tab_label(this.items[0].el, new Gtk.Label({ label : \"Roo View\" }));\n    this.el.set_tab_label(this.items[1].el, new Gtk.Label({ label : \"Gtk View\" }));\n}\n",
+                                                                    "|show_tabs": false,
+                                                                    "|xns": "Gtk",
+                                                                    "items": [
+                                                                        {
+                                                                            "id": "RightBrowser",
+                                                                            "pack": "add",
+                                                                            "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"
+                                                                                        },
+                                                                                        {
+                                                                                            "listeners": {
+                                                                                                "clicked": "function (self) {\n  this.get('/RightBrowser.view').redraws = 99;\n  this.get('/RightBrowser.view').renderJS(null,true);\n}"
+                                                                                            },
+                                                                                            "label": "Full Redraw",
+                                                                                            "pack": "pack_start,false,false,0",
+                                                                                            "xtype": "Button",
+                                                                                            "|xns": "Gtk"
+                                                                                        }
+                                                                                    ]
+                                                                                },
+                                                                                {
+                                                                                    "pack": "add",
+                                                                                    "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": [
+                                                                                        {
+                                                                                            "listeners": {
+                                                                                                "load_finished": "function (self, object) {\n    print(\"load finished\");\n//    print(\"load_finished\"); return;\n\t// if (this.ready) { // dont do it twice!\n\t //   return; \n\t//}\n\tif (!this.inspectorShown) {\n           this.el.get_inspector().show();\n           this.inspectorShown = true;\n\t}\n\n\tthis.ready = true;\n\t\n        if (this.pendingRedraw) {\n            this.pendingRedraw = false;\n            this.refreshRequired  = true;\n        }\n        //var js = this.get('/LeftTree.model').toJS();\n        //if (js && js[0]) {\n    \t//    this.renderJS(js[0]);\n    \t//}\n\n}",
+                                                                                                "script_alert": "function (self, object, p0) {\n    // \tprint(p0);\n        return false;\n        return true; // do not display anything...\n}",
+                                                                                                "console_message": "function (self, object, p0, p1) {\n    print(object);\n   //  console.log(object);\n   \n\n    if (object.match(/variable/) && object.match(/Builder/)) {\n        print(\"got builder missing message\");\n        this.refreshRequired = true;\n        this.lastRedraw = 0;\n        this.runRefresh();\n        return true;\n    }\n    \n   \n        if (!object.match(/^\\{/)) {\n        \n            //this.get('/Terminal').feed(object);\n            return true; // do not handle!!! -> later maybe in console..\n        }\n        \n        \n        \n        \n       // console.log(object);\n        var val =  JSON.parse(object);\n\n        if (typeof(val['hover-node']) != 'undefined') {\n            this.activeNode = val['hover-node'];\n            console.log('active node: ' + this.activeNode);\n            return true;\n        }\n\n         var ret = false;\n         if (typeof(val['id']) != 'undefined') {\n           // this.activeNode = val['id'];\n            var tg = this.get('/LeftTree.model').findDropNode(val['id'], true); \n            if (!tg || typeof(tg[0]) == 'undefined') {\n                return false;\n            }\n            print(\"SELECT node \" + tg[0]);\n            \n            this.get('/LeftTree.view').selectNode(tg[0]);\n            ret  = true;\n            \n        } \n        if (ret && typeof(val['set']) != 'undefined') {\n           this.get('/LeftPanel.model').add({\n                key : val['set'],\n                val : val['value']\n            });\n            //console.log('active node: ' + this.activeNode);\n            \n        }\n        //Seed.print('a:'+a);\n        //Seed.print('b:'+b);\n        //Seed.print('c:'+c);\n        return ret;\n}",
+                                                                                                "drag_motion": "function (w, ctx,  x,   y,   time, ud) {\n   // console.log('DRAG MOTION'); \n        // status:\n        // if lastCurrentNode == this.currentNode.. -- don't change anything..\n        this.targetData = [];\n        this.el.execute_script(\"Builder.overPos(\" + x +','+ y + \");\");\n        \n        // A) find out from drag all the places that node could be dropped.\n        var src = Gtk.drag_get_source_widget(ctx);\n        if (!src.dropList) {\n            Gdk.drag_status(ctx, 0, time);\n            return true;\n        }\n        // b) get what we are over.. (from activeNode)\n        // tree is empty.. - list should be correct..\n        if (!this.get('/LeftTree.model').currentTree) {\n            Gdk.drag_status(ctx, Gdk.DragAction.COPY,time);\n            return true;\n            \n        }\n        // c) ask tree where it should be dropped... - eg. parent.. (after node ontop)\n        \n        var tg = this.get('/LeftTree.model').findDropNode(this.activeNode, src.dropList);\n        console.dump(tg);\n        if (!tg.length) {\n            Gdk.drag_status(ctx, 0,time);\n            this.get('/LeftTree.view').highlight(false);\n            return true;\n        }\n         \n        // if we have a target..\n        // -> highlight it! (in browser)\n        // -> highlight it! (in tree)\n        \n        Gdk.drag_status(ctx, Gdk.DragAction.COPY,time);\n        this.get('/LeftTree.view').highlight(tg);\n        this.targetData = tg;\n        // for tree we should handle this...\n        return true;\n}",
+                                                                                                "drag_drop": "function (w, ctx, x, y,time, ud) {\n\tprint(\"TARGET: drag-drop\");\n        var is_valid_drop_site = true;\n        \n         \n        Gtk.drag_get_data\n        (\n                w,         /* will receive 'drag-data-received' signal */\n                ctx,        /* represents the current state of the DnD */\n                this.get('/Window').atoms[\"STRING\"],    /* the target type we want */\n                time            /* time stamp */\n        );\n                        \n                        \n                        /* No target offered by source => error */\n                       \n\n\treturn  is_valid_drop_site;\n}",
+                                                                                                "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}"
+                                                                                            },
+                                                                                            "id": "view",
+                                                                                            "pack": "add",
+                                                                                            "redraws": 0,
+                                                                                            "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, 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": "RightGtkView",
+                                                                            "pack": "add",
+                                                                            "xtype": "VBox",
+                                                                            "|redraw": "function() {\n   this.highlightWidget = false;\n    print(\"REDRAW CALLED\");\n    this.activePath = this.get('/LeftTree').getActivePath();\n    if (this.renderedEl) {\n      print(\"QUEUE DRAW CALLING\");\n      this.renderedEl.queue_draw();\n   }\n}\n",
+                                                                            "|renderJS": "function(data, withDebug)\n{\n      this.highlightWidget = false;\n   \n    this.withDebug = false;\n    while (this.get('view').el.get_children().length) {\n        var c = this.get('view').el.get_children()[0];\n        this.get('view').el.remove(c);        \n        c.destroy();\n    }\n     if (!data) {\n         return; \n    }\n    \n    var tree =  this.get('/LeftTree.model').toJS(false,true)[0];\n    // in theory tree is actually window..  \n   try {\n  \n        this.renderedEl = this.viewAdd(tree.items[0], this.get('view').el);\n      \n  } catch (e) {\n     print(e.message);\n    return;\n  }\n    this.get('view').el.set_size_request(\n        tree.default_width * 1 || 400, tree.default_height * 1 || 400\n    ) ;\n    if (this.renderedEl) {\n        this.renderedEl.set_size_request(\n            tree.default_width || 600,\n            tree.default_height || 400\n        );\n    }\n    this.get('view').el.show_all();\n    \n    \n    \n}",
+                                                                            "|showInWindow": "function() {\n  print(\"GET PROEJCT\");\n\tvar pr = this.get('/LeftProjectTree').getActiveProject();\n  \n\tconsole.log(pr.paths);\n    return;\n/*\n     var src= this.buildJS(\n\t\tthis.get('/LeftTree.model').toJS()[0], \n\t\ttrue);\n      // show term?? \n\n\n    //var x = new imports.sandbox.Context();\n    //x.add_globals();\n    //print(src);\n    try {\n        Seed.check_syntax('var e = ' + src);\n        //x.eval(src);\n    } catch( e) {\n        this.get('/Terminal').feed(e.message || e.toString() + \"\\n\");\n        this.get('/Terminal').feed(console._dump(e)+\"\\n\");\n        if (e.line) {\n            var lines = src.split(\"\\n\");\n            var start = Math.max(0, e.line - 10);\n            var end = Math.min(lines.length, e.line + 10);\n            for (var i =start ; i < end; i++) {\n                if (i == e.line) {\n                    this.get('/Terminal').feed(\">>>>>\" + lines[i] + \"\\n\");\n                    continue;\n                }\n                this.get('/Terminal').feed(lines[i] + \"\\n\");\n            }\n            \n        }\n        \n        return;\n    }\n     this.get('/BottomPane').el.set_current_page(1);\n    this.get('/Terminal').el.fork_command( null , [], [], \"/tmp\", false,false,false); \n    var cmd = \"/usr/bin/seed /tmp/BuilderGtkView.js\\n\";\n    this.get('/Terminal').el.feed_child(cmd, cmd.length);\n     /*\n    var _top = x.get_global_object()._top;\n    \n    _top.el.set_screen(Gdk.Screen.get_default()); // just in case..\n    _top.el.show_all();\n    if (_top.el.popup) {\n        _top.el.popup(null, null, null, null, 3, null);\n    }\n*/\n}\n",
+                                                                            "|viewAdd": "function(item, par)\n{\n\n    // does something similar to xobject..\n    //item.pack = (typeof(item.pack) == 'undefined') ?  'add' : item.pack;\n    \n    // pack is forced to 'false'\n    if (item.pack===false || item.pack === 'false') {  // no ;\n        return;\n    }\n    \n    print(\"CREATE: \" + item['|xns'] + '.' + item['xtype']);\n    \n    \n    var type = item['|xns'] + '.' + item['xtype'];\n    \n    if (item['|xns'] == 'GtkClutter') { // we can not add this yet!\n        return false;\n    }\n    \n    var ns = imports.gi[item['|xns']];\n    var ctr = ns[item['xtype']]; // why are we using array here..?\n    \n\n    \n    var ctr_args = { };\n    for(var k in item) {\n        var kv = item[k];\n        if (typeof(kv) == 'object' || typeof(kv) == 'function') {\n            continue;\n        }\n        if ( \n            k == 'pack' ||\n            k == 'items' ||\n            k == 'id' ||\n            k == 'xtype' ||\n            k == 'xdebug' ||\n            k == 'xns' ||\n            k == '|xns'\n        ) {\n            continue;\n        }\n        // value is a function..\n\tif (k[0] == '|' && typeof(kv) == 'string') {\n\n\t\tif (kv.match(new RegExp('function'))) {\n\t\t\tcontinue;\n                }\n\t\tprint(\"WASL \" + k + '=' + kv);\n\t\ttry {\n\t\t\teval( 'kv = ' + kv);\n\t\t} catch(e) {    continue; }\n                \n\t\tk = k.substring(1);\n             // print(k + '=' + kv);\n\t}\n        if (k[0] == '|') { // should be boolean or number..\n\t\tk = k.substring(1);\n\t\t//print(k + '=' + kv);\n        }\n         \n\tif (k == 'show_tabs') { // force tab showing for notebooks.\n           kv = true;\n        }\n        print(k + '=' + typeof(kv) + \" : \" + kv);\n        ctr_args[k] = kv;\n        \n    } \n    var altctr =  XObject.baseXObject({ xtype:  ctr} );\n    var pack_m  = false;\n    if (!item.pack && altctr) {\n        // try XObject.\n        print(\"SETTING PACK TO XObjectBase method\");\n        pack_m = altctr.prototype.pack;\n        \n        \n    }\n    \n    var el = new ctr(ctr_args);\n    item.el = el;\n    print(\"PACK\" + item.pack);\n    //console.dump(item.pack);\n    \n    \n    \n    \n    var args = [];\n    if (!pack_m) {\n        item.pack = (typeof(item.pack) == 'undefined') ?  'add' : item.pack;\n        if (typeof(item.pack) == 'string') {\n             \n            item.pack.split(',').forEach(function(e, i) {\n                \n                if (e == 'false') { args.push( false); return; }\n                if (e == 'true') {  args.push( true);  return; }\n                if (!isNaN(parseInt(e))) { args.push( parseInt(e)); return; }\n                args.push(e);\n            });\n            //print(args.join(\",\"));\n            \n            pack_m = args.shift();\n        } else {\n            pack_m = item.pack.shift();\n            args = item.pack;\n        }\n    }\n    // handle error.\n    if (typeof(pack_m) == 'string' && typeof(par[pack_m]) == 'undefined') {\n        throw {\n                name: \"ArgumentError\", \n                message : 'pack method not available : ' + par.id + \" : \" + par + '.' +  pack_m +\n                        \"ADDING : \" + item.id + \" \" +  el\n                    \n\t    };\n\n        return;\n    }\n    \n    console.dump(args);\n    args.unshift(el);\n    //if (XObject.debug) print(pack_m + '[' + args.join(',') +']');\n    //Seed.print('args: ' + args.length);\n    if (typeof(pack_m) == 'string') {\n        par[pack_m].apply(par, args);\n    } else if (pack_m) {\n        pack_m.call(item, par, item);\n    }\n    \n    var _this = this;\n    item.items = item.items || [];\n    item.items.forEach(function(ch,n) {\n\n         print (\"type:\" + type);\n          \n         print (\"ch.pack:\" + ch.pack);\n           \n           \n         if (type == 'Gtk.Table' && ch.pack == 'add') {\n            var c = n % item.n_columns;\n            var r = Math.floor(n/item.n_columns);\n            ch.pack = [ 'attach', c, c+1, r, r+1, \n                     typeof(ch.x_options) == 'undefined' ?  5 : ch.x_options,\n                        typeof(ch.y_options) == 'undefined' ?  5 : ch.y_options,\n                        typeof(ch.x_padding) == 'undefined' ?  0 : ch.x_padding,\n                        typeof(ch.x_padding) == 'undefined' ?  0 : ch.x_padding\n            ].join(',');\n        }\n    \n        _this.viewAdd(ch, el);\n    });\n    \n    \n    \n    // add the signal handlers.\n    // is it a widget!?!!?\n   \n    \n    try {\n         \n        \n        el.signal.expose_event.connect(XObject.createDelegate(this.widgetExposeEvent, this, [ item  ], true));\n        el.signal.drag_motion.connect(XObject.createDelegate(this.widgetDragMotionEvent, this,[ item  ], true));\n        el.signal.drag_drop.connect(XObject.createDelegate(this.widgetDragDropEvent, this, [ item  ], true));\n        el.signal.button_press_event.connect(XObject.createDelegate(this.widgetPressEvent, this, [ item  ], true ));\n        el.signal.button_release_event.connect(XObject.createDelegate(this.widgetReleaseEvent, this, [ item  ], true ));\n    } catch(e) {\n        // ignore!\n       }\n    \n    \n    \n    return el;\n    \n}",
+                                                                            "|widgetDragDropEvent": "function() {\n      print(\"WIDGET DRAGDROP\"); \n            return true;\n}\n",
+                                                                            "|widgetDragMotionEvent": "function() {\n     print(\"WIDGET DRAGMOTION\"); \n            return true;\n}\n",
+                                                                            "|widgetExposeEvent": "function(w, evt, ud, item) {\n    var widget = w;\n     if (this.inRender) {\n         return false;\n     }\n     \n     if ( this.highlightWidget) {\n          this.inRender = true;\n          if (item.xtreepath.substring(0, this.activePath.length) == this.activePath) {\n                 Gdk.draw_rectangle(this.highlightWidget.window, this.gc, false, this.box.x , this.box.y, this.box.w, this.box.h);\n            }\n           this.inRender = false;\n           return false;\n     }\n     \n     \n     if (this.activePath != item.xtreepath) {\n        return false;\n     }\n     \n   //  print(\"HIGHLIGHT: \" + item.xtreepath ); // draw highlight??\n     // work out the coords of the window..\n     if (!this.gc) {\n      var dr = widget.window;\n      this.gc = (new Gdk.GC.c_new(dr));\n      this.gc.set_rgb_fg_color(new Gdk.Color({ red: 0xFFFF, green: 0, blue : 0 }));\n      this.gc.set_line_attributes(4,  Gdk.LineStyle.SOLID, Gdk.CapStyle.ROUND , Gdk.JoinStyle.ROUND);\n    }\n\n    \n     var r  = evt.expose.area;\n     // console.dump([r.x, r.y, r.width, r.height ] );\n     //return false;\n//     print(widget.get_parent().toString().match(/GtkScrolledWindow/);\n     if (widget.get_parent().toString().match(/GtkScrolledWindow/)) { // eak\n         // happens with gtkscrollview embedded stuff..\n         var np =this.activePath.split(':');\n         np.pop();\n         this.activePath = np.join(':');\n         this.renderedEl.queue_draw();\n         return true;\n\n        \n     }\n\n       \n     \n     \n      this.box = {\n        x : r.x - 2,\n        y : r.y - 2,\n        w: r.width + 4,\n        h: r.height + 4\n      }; \n      // let's draw it..\n      this.inRender = true;\n\n      \n      this.highlightWidget = widget;\n    \n    \n \n\n    //  print(\"DRAW BOX\");\n       //console.dump(this.box);\n      Gdk.draw_rectangle(widget.window, this.gc, false, this.box.x , this.box.y, this.box.w,this.box.h);\n            this.inRender = false;\n            return false;\n}\n",
+                                                                            "|widgetPressEvent": "function(w,e,u,d) {\n     if (this.get('view').pressed) {\n        return false;\n     }\nthis.get('view').pressed = true;\n      print(\"WIDGET PRESS \" + d.xtreepath );       \n          this.get('/LeftTree.view').selectNode(   d.xtreepath );        \n            return false;\n}\n",
+                                                                            "|widgetReleaseEvent": "function() {\n    this.get('view').pressed = false;\n   return false;\n}\n",
+                                                                            "|xns": "Gtk",
+                                                                            "items": [
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "HBox",
+                                                                                    "pack": "pack_start,false,true,0",
+                                                                                    "items": [
+                                                                                        {
+                                                                                            "|xns": "Gtk",
+                                                                                            "xtype": "Button",
+                                                                                            "pack": "pack_start,false,false,0",
+                                                                                            "label": "Run The Application",
+                                                                                            "listeners": {
+                                                                                                "button_press_event": "function (self, event) {\n    // call render on left tree - with special option!?!\n \n    //print(\"GET PROEJCT\");\n    var pr = this.get('/LeftProjectTree').getActiveProject();\n  \n    var dir = '';\n    for (var i in pr.paths) { \n        dir = i;\n        break;\n    }\n    var runner = GLib.path_get_dirname (__script_path__) + '/gtkrun.js'; \n    this.get('/Terminal').feed(\"RUN DIR:\" + dir);\n    \n    this.get('/Terminal').el.fork_command( null , [], [], GLib.path_get_dirname (__script_path__) \n\t, false,false,false); \n    var cmd = \"/usr/bin/seed \" + runner + \" \" + dir + \"\\n\";\n    this.get('/Terminal').el.feed_child(cmd, cmd.length);\n    return false;\n  \n\n}"
+                                                                                            }
+                                                                                        }
+                                                                                    ]
+                                                                                },
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "ScrolledWindow",
+                                                                                    "pack": "add",
+                                                                                    "id": "view-sw",
+                                                                                    "|shadow_type": "Gtk.ShadowType.IN",
+                                                                                    "|init": "function() {\n    XObject.prototype.init.call(this);\n this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n}\n",
+                                                                                    "items": [
+                                                                                        {
+                                                                                            "|xns": "Gtk",
+                                                                                            "xtype": "EventBox",
+                                                                                            "pack": "add_with_viewport",
+                                                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\nthis.el.modify_bg(Gtk.StateType.NORMAL, new Gdk.Color({\n            red: 0x9F00, green: 0xB800 , blue : 0xA800\n           }));\n} \n",
+                                                                                            "items": [
+                                                                                                {
+                                                                                                    "|xns": "Gtk",
+                                                                                                    "xtype": "Fixed",
+                                                                                                    "pack": "add",
+                                                                                                    "|init": "function() {\n\tXObject.prototype.init.call(this);\n\t//this.el.set_hadjustment(this.parent.el.get_hadjustment());\n\t//this.el.set_vadjustment(this.parent.el.get_vadjustment());\n \n}\n",
+                                                                                                    "items": [
+                                                                                                        {
+                                                                                                            "|xns": "Gtk",
+                                                                                                            "xtype": "EventBox",
+                                                                                                            "pack": "put,10,10",
+                                                                                                            "|init": "function() {\n\t//this.el =     new Gtk.Image.from_stock (Gtk.STOCK_HOME,  Gtk.IconSize.MENU);\n\tXObject.prototype.init.call(this);\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",
+                                                                                                            "ready": false,
+                                                                                                            "|getActiveNode": "function(x,y)\n{\n   // workout what node is here..\n    return '0'; // top..\n}",
+                                                                                                            "id": "view",
+                                                                                                            "listeners": {
+                                                                                                                "drag_motion": "function (self, ctx, x, y, time) {\n    \n                // A) find out from drag all the places that node could be dropped.\n                var src = Gtk.drag_get_source_widget(ctx);\n                if (!src.dropList) {\n                    Gdk.drag_status(ctx, 0, time);\n                    return true;\n                }\n                // b) get what we are over.. (from activeNode)\n                // tree is empty.. - list should be correct..\n                if (!this.get('/LeftTree.model').currentTree) {\n                    Gdk.drag_status(ctx, Gdk.DragAction.COPY,time);\n                    return true;\n                    \n                }\n                // c) ask tree where it should be dropped... - eg. parent.. (after node ontop)\n                var activeNode = this.getActiveNode(x, y);\n                \n                \n                var tg = this.get('/LeftTree.model').findDropNode(activeNode, src.dropList);\n                console.dump(tg);\n                if (!tg.length) {\n                    Gdk.drag_status(ctx, 0,time);\n                    this.get('/LeftTree.view').highlight(false);\n                    return true;\n                }\n                 \n                // if we have a target..\n                // -> highlight it! (in browser)\n                // -> highlight it! (in tree)\n                \n                Gdk.drag_status(ctx, Gdk.DragAction.COPY,time);\n                this.get('/LeftTree.view').highlight(tg);\n                this.targetData = tg;\n                // for tree we should handle this...\n                return true;\n}",
+                                                                                                                "drag_drop": "function (self,ctx, x, y, time) {\n\tSeed.print(\"TARGET: drag-drop\");\n        var is_valid_drop_site = true;\n        \n         \n        Gtk.drag_get_data\n        (\n                self,         /* will receive 'drag-data-received' signal */\n                ctx,        /* represents the current state of the this.gDnD */\n                this.get('/Window').atoms[\"STRING\"],    /* the target type we want */\n                time            /* time stamp */\n        );\n        \n        \n        /* No target offered by source => error */\n       \n\n        return  is_valid_drop_site;\n  \n}",
+                                                                                                                "drag_data_received": "function (w, ctx,  x,  y, sel_data,  target_type,  time, ud) \n    {\n        Seed.print(\"GtkView: drag-data-received\");\n        var delete_selection_data = false;\n        var dnd_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            Seed.print(\"Browser: source.DRAGDATA? \" + source.dragData);\n            if (this.targetData) {\n                Seed.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    }",
+                                                                                                                "button_press_event": "function (self, event) {\n  this.pressed = false;\n    return false;\n}"
+                                                                                                            }
+                                                                                                        }
+                                                                                                    ]
+                                                                                                }
+                                                                                            ]
+                                                                                        }
+                                                                                    ]
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                },
+                                                                {
+                                                                    "id": "Help",
+                                                                    "pack": "add",
+                                                                    "xtype": "ScrolledWindow",
+                                                                    "|show": "function() {\n    \n    var file = this.get('/LeftTree').getActiveFile();\n    if (!file) {\n        return;\n    }\n    var activeEl = this.get('/LeftTree').getActiveElement();\n    var xtype = file.guessName( activeEl )\n    if (!xtype || !xtype.length) {\n        return;\n    }\n    //this.get('/Window.view-help-nb').el.set_current_page(1);\n    \n    // get the active element being edited.\n    var helpurl = file.getHelpUrl(xtype);       \n    \n    // now load the help info in the page..\n    this.get('help-view').el.open(helpurl);\n}\n",
+                                                                    "|xns": "Gtk",
+                                                                    "items": [
+                                                                        {
+                                                                            "|xns": "WebKit",
+                                                                            "xtype": "WebView",
+                                                                            "pack": "add",
+                                                                            "id": "help-view",
+                                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n   this.get('/Window.help-view').el.open(\n     \"http://devel.akbkhome.com/seed/\");\n\n}\n",
+                                                                            "zoom_level": 0.8
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                },
+                                                {
+                                                    "id": "BottomPane",
+                                                    "pack": "add",
+                                                    "xtype": "Notebook",
+                                                    "|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",
+                                                            "items": [
+                                                                {
+                                                                    "|xns": "Vte",
+                                                                    "xtype": "Terminal",
+                                                                    "pack": "add",
+                                                                    "id": "Terminal",
+                                                                    "|feed": "function(istr) {\n    var str = istr.replace(/\\n/g, \"\\r\\n\") + \"\\r\\n\";\n    // we should make ourselves visable!!!\n    this.get('/BottomPane').el.show();\n    this.get('/BottomPane').el.set_current_page(1);\n\n    this.el.feed(str ,str.length);\n}\n",
+                                                                    "|scroll_on_output": true,
+                                                                    "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.set_size (80, 1000);\n}\n",
+                                                                    "scrollback_lines": 1000
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            "xtype": "ScrolledWindow",
+                                                            "|xns": "Gtk",
+                                                            "pack": "add",
+                                                            "listeners": {},
+                                                            "items": [
+                                                                {
+                                                                    "id": "inspector",
+                                                                    "pack": "add",
+                                                                    "xtype": "WebView",
+                                                                    "|xns": "WebKit"
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            "|xns": "Gtk",
+                                            "xtype": "VBox",
+                                            "pack": "pack_start,false,false",
+                                            "id": "RightPalete",
+                                            "|hide": "function() {\n    \n      this.get('buttonbar').el.show();\n       this.get('viewbox').el.hide();\n    print(\"TRIED TO HIDE\");\n}\n",
+                                            "|show": "function() {\n    this.get('buttonbar').el.hide();\n    this.get('viewbox').el.show();\n   // this.get('model').expanded();\n            \n}\n",
+                                            "provider": false,
+                                            "items": [
+                                                {
+                                                    "|xns": "Gtk",
+                                                    "xtype": "VBox",
+                                                    "pack": "add",
+                                                    "id": "buttonbar",
+                                                    "items": [
+                                                        {
+                                                            "|xns": "Gtk",
+                                                            "xtype": "Button",
+                                                            "pack": "pack_start,false,true",
+                                                            "listeners": {
+                                                                "clicked": "function (self) {\n\tthis.get('/RightPalete').show();\n}"
+                                                            },
+                                                            "items": [
+                                                                {
+                                                                    "|xns": "Gtk",
+                                                                    "xtype": "Image",
+                                                                    "pack": "add",
+                                                                    "|stock": "Gtk.STOCK_GOTO_FIRST",
+                                                                    "|icon_size": "Gtk.IconSize.MENU"
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            "|xns": "Gtk",
+                                                            "xtype": "Label",
+                                                            "pack": "add",
+                                                            "label": "Palete",
+                                                            "angle": 270,
+                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n    this.el.add_events ( Gdk.EventMask.BUTTON_MOTION_MASK );\n}\n",
+                                                            "listeners": {
+                                                                "enter_notify_event": "function (self, event) {\n    this.get('/RightPalete').show();\n    return false;\n}"
+                                                            }
+                                                        }
+                                                    ]
+                                                },
+                                                {
+                                                    "|xns": "Gtk",
+                                                    "xtype": "VBox",
+                                                    "pack": "add",
+                                                    "id": "viewbox",
+                                                    "items": [
+                                                        {
+                                                            "|xns": "Gtk",
+                                                            "xtype": "HBox",
+                                                            "pack": "pack_start,false,true",
+                                                            "items": [
+                                                                {
+                                                                    "|xns": "Gtk",
+                                                                    "xtype": "Label",
+                                                                    "pack": "add",
+                                                                    "label": "Palete"
+                                                                },
+                                                                {
+                                                                    "|xns": "Gtk",
+                                                                    "xtype": "Button",
+                                                                    "pack": "pack_start,false,true",
+                                                                    "listeners": {
+                                                                        "clicked": "function (self) {\n\tthis.get('/RightPalete').hide();\n}"
+                                                                    },
+                                                                    "items": [
+                                                                        {
+                                                                            "|xns": "Gtk",
+                                                                            "xtype": "Image",
+                                                                            "pack": "add",
+                                                                            "|stock": "Gtk.STOCK_GOTO_LAST",
+                                                                            "|icon_size": "Gtk.IconSize.MENU"
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            "|xns": "Gtk",
+                                                            "xtype": "ScrolledWindow",
+                                                            "pack": "add",
+                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n\tthis.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n    this.el.set_size_request(-1,200);\n}\n",
+                                                            "|shadow_type": "Gtk.ShadowType.IN",
+                                                            "items": [
+                                                                {
+                                                                    "listeners": {
+                                                                        "drag_begin": "function (self, ctx) {\n    // we could fill this in now...\n        Seed.print('SOURCE: drag-begin');\n        \n        \n        \n        var iter = new Gtk.TreeIter();\n        var s = this.selection;\n        s.get_selected(this.get('/RightPalete.model').el, iter);\n        var path = this.get('/RightPalete.model').el.get_path(iter);\n        \n        var pix = this.el.create_row_drag_icon ( path);\n            \n                \n        Gtk.drag_set_icon_pixmap (ctx,\n            pix.get_colormap(),\n            pix,\n            null,\n            -10,\n            -10);\n        \n        var value = new GObject.Value('');\n        this.get('/RightPalete.model').el.get_value(iter, 0, value);\n        if (!this.get('/RightPalete').provider) {\n            return false;\n        }\n        this.el.dropList = this.get('/RightPalete').provider.getDropList(value.value);\n        this.el.dragData = value.value;\n        \n        \n        \n        \n        return true;\n}",
+                                                                        "drag_data_get": "function (self, drag_context, selection_data, info, time) {\n \t//Seed.print('Palete: drag-data-get: ' + target_type);\n        if (this.el.dragData && this.el.dragData.length ) {\n            selection_data.set_text(this.el.dragData ,this.el.dragData.length);\n        }\n        \n        \n        //this.el.dragData = \"TEST from source widget\";\n        \n        \n}",
+                                                                        "drag_end": "function (self, drag_context) {\n \tSeed.print('SOURCE: drag-end');\n\tthis.el.dragData = false;\n\tthis.el.dropList = false;\n\tthis.get('/LeftTree.view').highlight(false);\n\treturn true;\n}",
+                                                                        "button_press_event": "function (self, event) {\n\n \tif (!this.get('/Editor').save()) {\n \t    // popup!! - click handled.. \n \t    return true;\n        }\n    return false;\n}"
+                                                                    },
+                                                                    "pack": "add",
+                                                                    "xtype": "TreeView",
+                                                                    "|enable_tree_lines": true,
+                                                                    "|headers_visible": false,
+                                                                    "|init": "function() {\n    XObject.prototype.init.call(this);\n  this.el.set_size_request(150,-1);\n                          //  set_reorderable: [1]\n                                  \n            var description = new Pango.FontDescription.c_new();\n    description.set_size(8000);\n    this.el.modify_font(description);\n    \n    this.selection = this.el.get_selection();\n    this.selection.set_mode( Gtk.SelectionMode.SINGLE);\n   // this.selection.signal['changed'].connect(function() {\n    //    _view.listeners['cursor-changed'].apply(_view, [ _view, '']);\n    //});\n    // see: http://live.gnome.org/GnomeLove/DragNDropTutorial\n     \n    Gtk.drag_source_set (\n            this.el,            /* widget will be drag-able */\n            Gdk.ModifierType.BUTTON1_MASK,       /* modifier that will start a drag */\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    //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);\n   \n    Gtk.drag_source_set_target_list(this.el, this.get('/Window').targetList);\n    Gtk.drag_source_add_text_targets(this.el); \n    /*\n    print(\"RP: TARGET:\" + LeftTree.atoms[\"STRING\"]);\n    targets = new Gtk.TargetList();\n    targets.add( LeftTree.atoms[\"STRING\"], 0, 0);\n    targets.add_text_targets( 1 );\n    Gtk.drag_dest_set_target_list(this.el, LeftTree.targetList);\n    \n    //if you want to allow text to be output elsewhere..\n    //Gtk.drag_source_add_text_targets(this.el);\n    */\n    return true; \n}\n",
+                                                                    "|xns": "Gtk",
+                                                                    "items": [
+                                                                        {
+                                                                            "|xns": "Gtk",
+                                                                            "xtype": "ListStore",
+                                                                            "pack": "set_model",
+                                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\nthis.el.set_column_types ( 2, [\n                            GObject.TYPE_STRING, // title \n                            GObject.TYPE_STRING // tip\n                            \n                            ] );\n}\n",
+                                                                            "id": "model",
+                                                                            "|load": "function(tr,iter)\n{\n    if (!iter) {\n        this.el.clear();\n    }\n    //console.log('Project tree load: ' + tr.length);\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            \n            this.el.append(citer);   \n        } else {\n            this.el.insert(citer,iter,-1);\n        }\n        \n        var r = tr[i];\n        //Seed.print(r);\n        this.el.set_value(citer, 0,  '' +  r ); // title \n        \n        //this.el.set_value(citer, 1,  new GObject.Value( r)); //id\n        //if (r.cn && r.cn.length) {\n        //    this.load(r.cn, citer);\n        //}\n    }\n    \n    \n}",
+                                                                            "|getValue": "function (iter, col) {\n    var gval = new GObject.Value('');\n     this.el.get_value(iter, col ,gval);\n    return  gval.value;\n    \n    \n}"
+                                                                        },
+                                                                        {
+                                                                            "|xns": "Gtk",
+                                                                            "xtype": "TreeViewColumn",
+                                                                            "pack": "append_column",
+                                                                            "|init": "function() {\n    XObject.prototype.init.call(this);\n\tthis.el.add_attribute(this.items[0].el , 'markup', 0 );\n}\n",
+                                                                            "items": [
+                                                                                {
+                                                                                    "|xns": "Gtk",
+                                                                                    "xtype": "CellRendererText",
+                                                                                    "pack": "pack_start"
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ]
+        }
+    ],
+    "permname": "",
+    "modOrder": ""
+}
\ No newline at end of file
diff --git a/old-javascript/Builder3/Window.js b/old-javascript/Builder3/Window.js
new file mode 100644 (file)
index 0000000..0427440
--- /dev/null
@@ -0,0 +1,4340 @@
+       Gtk = imports.gi.Gtk;
+Gdk = imports.gi.Gdk;
+Pango = imports.gi.Pango;
+GLib = imports.gi.GLib;
+Gio = imports.gi.Gio;
+GObject = imports.gi.GObject;
+GtkSource = imports.gi.GtkSource;
+WebKit = imports.gi.WebKit;
+Vte = imports.gi.Vte;
+console = imports.console;
+XObject = imports.XObject.XObject;
+
+
+Window=new XObject({
+    xtype: Gtk.Window,
+    listeners : {
+        delete_event : function (self, event) {
+            return false;
+        },
+        destroy : function (self) {
+           Gtk.main_quit();
+        },
+        show : function (self) {
+                       
+                 imports.ProjectManager.ProjectManager.loadConfig();
+                       
+                 print("HIDEWIN - calling MidPropTree hidewin")
+                         this.get('/MidPropTree').hideWin();
+                         this.get('/RightPalete').hide();
+                         this.get('/BottomPane').el.hide();
+                         //this.get('/Editor').el.show_all();
+                 
+        }
+    },
+    border_width : 0,
+    default_height : 500,
+    default_width : 800,
+    id : "Window",
+    title : "Application Builder",
+    setTitle : function(str) {
+        this.el.set_title(this.title + ' - ' + str);
+    },
+    type : Gtk.WindowType.TOPLEVEL,
+    items : [
+        {
+            xtype: Gtk.VBox,
+            id : "w-vbox",
+            items : [
+                {
+                    xtype: Gtk.MenuBar,
+                    pack : "pack_start,false,false",
+                    items : [
+                        {
+                            xtype: Gtk.MenuItem,
+                            use_underline : true,
+                            label : "_File",
+                            items : [
+                                {
+                                    xtype: Gtk.Menu,
+                                    pack : "set_submenu",
+                                    items : [
+                                        {
+                                            xtype: Gtk.MenuItem,
+                                            use_underline : true,
+                                            label : "New _Project",
+                                            listeners : {
+                                                activate : function (self) {
+                                                         var _this = this;
+                                                       this.get('/EditProject').show({
+                                                           success : function(pr) {
+                                                                    _this.get('/LeftProjectTree').get('combo').setValue(pr.fn);
+                                                           }
+                                                       });
+                                                }
+                                            }
+                                        },
+                                        {
+                                            xtype: Gtk.MenuItem,
+                                            label : "_New File",
+                                            use_underline : true,
+                                            listeners : {
+                                                activate : function (self) {
+                                                       var fn = this.get('/LeftProjectTree.combo').getValue();
+                                                        if (!fn) {
+                                                            this.get('/LeftProjectTree').showNoProjectSelected();
+                                                            return true;
+                                                        }
+                                                        var pm = imports.ProjectManager.ProjectManager;
+                                                        this.get('/DialogNewComponent').show({
+                                                            project : pm.getByFn(fn)
+                                                        });
+                                                }
+                                            }
+                                        },
+                                        {
+                                            xtype: Gtk.SeparatorMenuItem,
+                                            pack : "add"
+                                        },
+                                        {
+                                            xtype: Gtk.MenuItem,
+                                            use_underline : true,
+                                            pack : "add",
+                                            label : "D_elete Project",
+                                            listeners : {
+                                                activate : function (self) {
+                                                
+                                                       var fn =  this.get('/LeftProjectTree').get('combo').getValue();
+                                                       if (!fn.length) {
+                                                               this.get('/StandardErrorDialog').show("Select a project")
+                                                               return;
+                                                        }
+                                                       var pm = imports.ProjectManager.ProjectManager;
+                                                       var pr  = pm.getByFn(fn);
+                                                
+                                                       // confirm..
+                                                       this.get('/DialogConfirm').show("Are you sure you want to delete project '" + pr.name + "'", function() {
+                                                               pm.deleteProject(fn);
+                                                               print("DELETE?");
+                                                       });
+                                                
+                                                }
+                                            }
+                                        },
+                                        {
+                                            xtype: Gtk.SeparatorMenuItem,
+                                            pack : "add"
+                                        },
+                                        {
+                                            xtype: Gtk.MenuItem,
+                                            pack : "add",
+                                            label : "_Quit",
+                                            use_underline : true,
+                                            listeners : {
+                                                activate : function (self) {
+                                                   Gtk.main_quit();
+                                                }
+                                            }
+                                        }
+                                    ]
+                                }
+                            ]
+                        },
+                        {
+                            xtype: Gtk.MenuItem,
+                            label : "_Edit",
+                            use_underline : true,
+                            pack : "add",
+                            items : [
+                                {
+                                    xtype: Gtk.Menu,
+                                    pack : "set_submenu",
+                                    items : [
+                                        {
+                                            xtype: Gtk.MenuItem,
+                                            listeners : {
+                                                activate : function (self) {
+                                                       var fn = this.get('/LeftTree').getActiveFile();
+                                                        if (!fn) {
+                                                            this.get('/StandardErrorDialog').show("No File active");
+                                                            return true;
+                                                        }
+                                                 
+                                                        this.get('/DialogNewComponent').show(fn);
+                                                        return true;
+                                                }
+                                            },
+                                            label : "File _Properties",
+                                            pack : "add",
+                                            use_underline : true
+                                        },
+                                        {
+                                            xtype: Gtk.MenuItem,
+                                            listeners : {
+                                                activate : function (self, event) {
+                                                    this.get('/RooProjectProperties').show();
+                                                    return false;
+                                                }
+                                            },
+                                            label : "Modify Project HTML ",
+                                            pack : "add",
+                                            use_underline : true
+                                        }
+                                    ]
+                                }
+                            ]
+                        },
+                        {
+                            xtype: Gtk.MenuItem,
+                            label : "_View",
+                            use_underline : true,
+                            items : [
+                                {
+                                    xtype: Gtk.Menu,
+                                    pack : "set_submenu",
+                                    items : [
+                                        {
+                                            xtype: Gtk.MenuItem,
+                                            listeners : {
+                                                activate : function (self, event) {
+                                                      var js = this.get('/LeftTree.model').toJS();
+                                                    if (js && js[0]) {
+                                                        this.get('/RightBrowser.view').renderJS(js[0], true);
+                                                    } 
+                                                    return false;
+                                                }
+                                            },
+                                            label : "_Redraw (Roo)",
+                                            pack : "add",
+                                            use_underline : true
+                                        },
+                                        {
+                                            xtype: Gtk.MenuItem,
+                                            listeners : {
+                                                activate : function (self, event) 
+                                                {
+                                                        /* Firefox testing for debugging..
+                                                          - we can create a /tmp directory, and put.
+                                                            builder.html, builder.html.js, link roojs1 
+                                                            add at the end of builder.html Roo.onload(function() {
+                                                         */
+                                                        if (!this.get('/Window.LeftTree').getActiveFile()) {
+                                                            return;
+                                                        }
+                                                        
+                                                        var js = this.get('/LeftTree.model').toJS();
+                                                         if (!js ||  !js[0]) {
+                                                            return;
+                                                        }
+                                                        var project = this.get('/Window.LeftTree').getActiveFile().project;
+                                                        //print (project.fn);
+                                                        
+                                                        project.runhtml  = project.runhtml || '';
+                                                
+                                                
+                                                       var File = imports.File.File;
+                                                       
+                                                       var target = "/tmp/firetest"; // fixme..
+                                                       if (!File.isDirectory(target)) {
+                                                           File.mkdir(target);
+                                                        }
+                                                       File.copy(__script_path__ + '/../builder.html.js', target+ '/builder.html.js', Gio.FileCopyFlags.OVERWRITE);
+                                                       if (!File.exists( target+ '/roojs1')) {
+                                                            File.link( target+ '/roojs1', __script_path__ + '/../roojs1');
+                                                       }
+                                                        
+                                                        
+                                                        
+                                                        var html = imports.File.File.read(__script_path__ + '/../builder.html');
+                                                        html = html.replace('</head>', project.runhtml + '</head>');
+                                                        
+                                                       
+                                                        var     jsstr = JSON.stringify(js[0], null, 4);
+                                                       
+                                                        var runbuilder = '<script type="text/javascript">' + "\n" + 
+                                                            " Builder.render(" + jsstr + ");\n" +
+                                                            '</script>';
+                                                        
+                                                        html = html.replace('</body>', runbuilder + '</body>');
+                                                
+                                                       File.write( target+ '/builder.html', html);
+                                                       
+                                                        this.get('/Terminal').feed("RUN DIR:" + target);
+                                                    var out = {};
+                                                    this.get('/Terminal').el.fork_command_full(
+                                                                Vte.PtyFlags.DEFAULT,
+                                                                target ,
+                                                                [], //argv
+                                                                [], // env
+                                                                0, //spawn flags
+                                                                null, // user func
+                                                                null, // child setupdata
+                                                                out
+                                                        ); 
+                                                    var cmd = "firefox file://" + target + "/builder.html  \n";
+                                                    this.get('/Terminal').el.feed_child(cmd, cmd.length);
+                                                     return false;
+                                                }
+                                            },
+                                            label : "_Test in Firefox (Roo)",
+                                            pack : "add",
+                                            use_underline : true
+                                        }
+                                    ]
+                                }
+                            ]
+                        },
+                        {
+                            xtype: Gtk.MenuItem,
+                            label : "_Help",
+                            use_underline : true,
+                            pack : "add",
+                            items : [
+                                {
+                                    xtype: Gtk.Menu,
+                                    pack : "set_submenu",
+                                    items : [
+                                        {
+                                            xtype: Gtk.MenuItem,
+                                            pack : "add",
+                                            label : "_About",
+                                            use_underline : true,
+                                            listeners : {
+                                                activate : function (self) {
+                                                    this.get('/About').el.run();
+                                                }
+                                            }
+                                        }
+                                    ]
+                                }
+                            ]
+                        }
+                    ]
+                },
+                {
+                    xtype: Gtk.HPaned,
+                    id : "left",
+                    position : 400,
+                    items : [
+                        {
+                            xtype: Gtk.HBox,
+                            items : [
+                                {
+                                    xtype: Gtk.VPaned,
+                                    position : 300,
+                                    id : "leftvpaned",
+                                    items : [
+                                        {
+                                            xtype: Gtk.VBox,
+                                            id : "LeftTopPanel",
+                                            items : [
+                                                {
+                                                    xtype: Gtk.Expander,
+                                                                                                       events : [
+                                                                                                               Gdk.EventMask.BUTTON_MOTION_MASK 
+                                                                                                       ],
+                                                                                                        
+                                                    listeners : {
+                                                        activate : function (self) {
+                                                            // this does not actually expand it..
+                                                            // that is done by GTK..
+                                                            
+                                                            
+                                                               if (!this.get('/Editor').save()) {
+                                                                   // popup!! - click handled.. 
+                                                                   return true;
+                                                            }
+                                                        
+                                                            if (!this.el.expanded) {
+                                                                this.onExpand();
+                                                            } else {
+                                                                this.onCollapse();
+                                                            }
+                                                            return true;
+                                                                 
+                                                        } /*,
+                                                        enter_notify_event : function (self, event) {
+                                                            return true;
+                                                             this.el.expanded = !this.el.expanded;
+                                                        //if (this.el.expanded ) {
+                                                            this.listeners.activate.call(this);
+                                                        //   }
+                                                        
+                                                        return true;
+                                                        }
+                                                        */
+                                                    },
+                                                    id : "expander",
+                                                    label : "Select Project or File",
+                                                    pack : "pack_start,false,true",
+                                                  
+                                                    onCollapse : function() {
+                                                        
+                                                        var nb = this.get('/LeftTopPanel.notebook');
+                                                        nb.el.set_current_page(0);
+                                                    },
+                                                    onExpand : function() {
+                                                        var nb = this.get('/LeftTopPanel.notebook');            
+                                                        var pm  = imports.ProjectManager.ProjectManager;
+                                                        
+                                                       
+                                                        var model = this.get('/LeftProjectTree.combomodel');
+                                                        //  print ("loading Projects?")
+                                                                                                               //print(JSON.stringify(pm.projects, null,4));Seed.quit();
+                                                        //console.dump(pm.projects);
+                                                        model.loadData(pm.projects);
+                                                         
+                                                        
+                                                        nb.el.set_current_page(1);
+                                                        //pm.on('changed', function() {
+                                                       //console.log("CAUGHT project manager change");
+                                                        //    _combo.model.loadData(pm.projects);
+                                                        //}
+                                                        return;
+                                                    }
+                                                },
+                                                {
+                                                    xtype: Gtk.Notebook,
+                                                    id : "notebook",
+                                                    pack : "pack_start,true,true",
+                                                                                                       current_page : 0,
+                                                     
+                                                    show_border : false,
+                                                    show_tabs : false,
+                                                    items : [
+                                                        {
+                                                            xtype: Gtk.ScrolledWindow,
+                                                            id : "LeftTree",
+                                                            pack : "add",
+                                                            getActiveElement : function() { // return path to actie node.
+                                                            
+                                                                 var path = this.getActivePath();
+                                                                 if (!path) {
+                                                                    return false;
+                                                                 }
+                                                                 var ret ={} ;
+                                                                 this.get('model').el.get_iter_from_string(ret, path);
+                                                                 
+                                                                 var value =  ''+ this.get('model').el.get_value(ret.iter, 2).value.get_string();
+                                                                    
+                                                                 return JSON.parse(value);
+                                                            },
+                                                            getActiveFile : function() {
+                                                                return this.get('model').file;
+                                                            },
+                                                            getActivePath : function() {
+                                                                var model = this.get('model');
+                                                                var view = this.get('view');
+                                                                if (view.selection.count_selected_rows() < 1) {
+                                                                    return false;
+                                                                }
+                                                                var ret = {};
+                                                                view.selection.get_selected(ret);
+                                                                return ret.model.get_path(ret.iter).to_string();
+                                                            },
+                                                            getPaleteProvider : function() {
+                                                                var model = this.get('model');
+                                                                var pm = imports.ProjectManager.ProjectManager;
+                                                                return pm.getPalete(model.file.getType());
+                                                            },
+                                                            getRenderer : function() {
+                                                            
+                                                               switch( this.getActiveFile().getType()) {
+                                                                       case 'Roo':
+                                                                           return this.get('/RightBrowser.view');
+                                                                       case 'Gtk':
+                                                                           return this.get('/RightGtkView');
+                                                               }
+                                                                                                                               return false;
+                                                            
+                                                            },
+                                                            
+                                                            renderView : function() {
+                                                                var render = this.getRenderer();
+                                                                var model = this.get('model');
+                                                                if (render) {
+                                                                    render.renderJS(model.toJS(false,true)[0]);
+                                                                } else {
+                                                                    print("NO RENDER JS METHOD?");
+                                                                }
+                                                            },
+                                                            shadow_type : Gtk.ShadowType.IN,
+                                                            items : [
+                                                                {
+                                                                    xtype: Gtk.TreeView,
+                                                                    listeners : {
+                                                                        button_press_event : function (self, ev) {
+                                                                               console.log("button press?");
+                                                                               
+                                                                               if (!this.get('/Editor').save()) {
+                                                                                   // popup!! - click handled.. 
+                                                                                   return true;
+                                                                                }
+                                                                               
+                                                                                if (ev.button.button != 3) {
+                                                                                    print("click" + ev.button.button);
+                                                                                    return false;
+                                                                                }
+                                                                              
+                                                                            
+                                                                                var res = {}; 
+                                                                                this.get('/LeftTree.view').el.get_path_at_pos(ev.button.x,ev.button.y, res);
+                                                                                
+                                                                                if (!this.get('/LeftTreeMenu').el)  {
+                                                                                                                                                                       this.get('/LeftTreeMenu').init();
+                                                                                                                                                               }
+                                                                                
+                                                                                this.get('/LeftTreeMenu').el.set_screen(Gdk.Screen.get_default());
+                                                                                this.get('/LeftTreeMenu').el.show_all();
+                                                                                this.get('/LeftTreeMenu').el.popup(null, null, null, null, 3, ev.button.time);
+                                                                                print("click:" + res.path.to_string());
+                                                                                return false;
+                                                                        },
+                                                                        drag_begin : function (self, ctx) {
+                                                                               print('SOURCE: drag-begin');
+                                                                                 this.targetData = false;
+                                                                                // find what is selected in our tree...
+                                                                                var ret ={};
+                                                                                this.selection.get_selected(ret);
+                                                                        
+                                                                                // set some properties of the tree for use by the dropped element.
+                                                                                var value = ''+ ret.model.get_value(ret.iter, 2).value.get_string();
+                                                                                var data = JSON.parse(value);
+                                                                                var xname = this.get('/LeftTree.model').file.guessName(data);
+                                                                                
+                                                                                this.el.dragData = xname;
+                                                                                this.el.dropList = this.get('/LeftTree').getPaleteProvider().getDropList(xname);
+                                                                                
+                                                                        
+                                                                                // make the drag icon a picture of the node that was selected
+                                                                                var path = ret.model.get_path(ret.iter);
+                                                                                this.el.treepath = path.to_string();
+                                                                                
+                                                                                // returns a cairo surface
+                                                                                var pix = this.el.create_row_drag_icon ( path);
+                                                                                
+                                                                                if (Gtk.drag_set_icon_surface) {
+                                                                                   Gtk.drag_set_icon_surface( ctx,   pix  );
+                                                                                } else {
+                                                                                    Gtk.drag_set_icon_pixmap (ctx,
+                                                                                        pix.get_colormap(),   pix,   null, -10, -10);
+                                                                                }
+                                                                                
+                                                                                return true;
+                                                                        },
+                                                                        drag_end : function (self, drag_context) {
+                                                                               Seed.print('LEFT-TREE: drag-end');
+                                                                                this.el.dragData = false;
+                                                                                this.el.dropList = false;
+                                                                                this.targetData = false;
+                                                                                this.get('/LeftTree.view').highlight(false);
+                                                                                return true;
+                                                                        },
+                                                                        drag_data_get : function(self, ctx, sel_data, info, time)
+                                                                        {
+                                                                            
+                                                                            sel_data.set_text( 
+                                                                                      "HELOLW" 
+                                                                                    
+                                                                            );
+                                                                            
+                                                                        },
+                                                                        
+                                                                        drag_motion : function (self, ctx, x, y, time) {
+                                                                            console.log("LEFT-TREE: drag-motion");
+                                                                            var src = Gtk.drag_get_source_widget( ctx);
+                                                            
+                                                                            // a drag from  elsewhere...- prevent drop..
+                                                                            if (!src.dragData) {
+                                                                                print("no drag data!");
+                                                                                Gdk.drag_status(ctx, 0, time);
+                                                                                this.targetData = false;
+                                                                                return true;
+                                                                            }
+                                                                            var action = Gdk.DragAction.COPY;
+                                                                            if (src == this.el) {
+                                                                                // unless we are copying!!! ctl button..
+                                                                                action = ctx.get_actions() & Gdk.DragAction.MOVE ? Gdk.DragAction.MOVE : Gdk.DragAction.COPY ;
+                                                                            }
+                                                                            var data = {};
+                                                            
+                                                                            if (!this.get('/LeftTree.model').el.iter_n_children(null)) {
+                                                                                    // no children.. -- asume it's ok..
+                                                                                    this.targetData =  [ '' , Gtk.TreeViewDropPosition.INTO_OR_AFTER , ''];
+                                                                                    Gdk.drag_status(ctx, action ,time);
+                                                                                    return true;
+                                                                            }
+                                                            
+                                                                            print("GETTING POS");
+                                                                            var isOver = this.get('/LeftTree.view').el.get_dest_row_at_pos(x,y, data);
+                                                                            print("ISOVER? " + isOver);
+                                                                            if (!isOver) {
+                                                                                Gdk.drag_status(ctx, 0 ,time);
+                                                                                return false; // not over apoint!?!
+                                                                            }
+                                                                            // drag node is parent of child..
+                                                                            console.log("SRC TREEPATH: " + src.treepath);
+                                                                            console.log("TARGET TREEPATH: " + data.path.to_string());
+                                                                            
+                                                                            // nned to check a  few here..
+                                                                            //Gtk.TreeViewDropPosition.INTO_OR_AFTER
+                                                                            //Gtk.TreeViewDropPosition.INTO_OR_BEFORE
+                                                                            //Gtk.TreeViewDropPosition.AFTER
+                                                                            //Gtk.TreeViewDropPosition.BEFORE
+                                                                            
+                                                                            if (typeof(src.treepath) != 'undefined'  && 
+                                                                                src.treepath == data.path.to_string().substring(0,src.treepath.length)) {
+                                                                                print("subpath drag");
+                                                                                Gdk.drag_status( ctx, 0 ,time);
+                                                                                return false;
+                                                                            }
+                                                                            
+                                                                            // check that 
+                                                                            //print("DUMPING DATA");
+                                                                            //console.dump(data);
+                                                                            // path, pos
+                                                                            
+                                                                            print(data.path.to_string() +' => '+  data.pos);
+                                                                            var tg = this.get('/LeftTree.model').findDropNodeByPath(
+                                                                                data.path.to_string(), src.dropList, data.pos);
+                                                                                
+                                                                            this.get('/LeftTree.view').highlight(tg);
+                                                                            if (!tg.length) {
+                                                                                print("Can not find drop node path");
+                                                                                this.targetData = false;
+                                                                                Gdk.drag_status(ctx, 0, time);
+                                                                                return true;
+                                                                            }
+                                                                            //  print(JSON.stringify(tg,null,4));
+                                                                            //console.dump(tg);
+                                                                            this.targetData = tg;    
+                                                                            
+                                                                            
+                                                                            Gdk.drag_status(ctx, action ,time);
+                                                                             
+                                                                            return true;
+                                                                        },
+                                                                        drag_drop : function (w, ctx, x, y, time) {
+                                                                              Seed.print("TARGET: drag-drop");
+                                                                                //print(JSON.stringify(w.drag_dest_get_target_list(),null,4));
+                                                                                w.drag_get_data
+                                                                                (          /* will receive 'drag-data-received' signal */
+                                                                                        ctx,        /* represents the current state of the DnD */
+                                                                                        imports.Builder3.Globals.atoms["STRING"],    /* the target type we want */
+                                                                                        time            /* time stamp */
+                                                                                );
+                                                                                
+                                                                                 
+                                                                                /* No target offered by source => error */
+                                                                               
+                                                        
+                                                                                return  true;
+                                                                        },
+                                                                        drag_data_received : function (self, ctx, x, y, sel_data, info, time) {
+                                                                                 print("Tree: drag-data-received");
+                                                                        
+                                                                                      var   delete_selection_data = false;
+                                                                                       var  dnd_success = false;
+                                                                                       //print(JSON.stringify(sel_data, null,4));
+                                                                                        /* Deal with what we are given from source */
+                                                                                        
+                                                                                        // simce I can not be bothered to sort out
+                                                                                        // drag drop = let's assume it worked...
+                                                                                        
+                                                                                        if( true || (sel_data && sel_data.length )) {
+                                                                                            
+                                                                                            if (ctx.action == Gdk.DragAction.ASK)  {
+                                                                                                /* Ask the user to move or copy, then set the ctx action. */
+                                                                                            }
+                                                                        
+                                                                                            if (ctx.action == Gdk.DragAction.MOVE) {
+                                                                                                //delete_selection_data = true;
+                                                                                            }
+                                                                                            
+                                                                                            var source = Gtk.drag_get_source_widget( ctx );
+                                                                        
+                                                                                            if (this.targetData) {
+                                                                                                if (source != this.el) {
+                                                                                                    print("DRAG FROM ANOTHER WIDGET");
+                                                                                                    this.get('/LeftTree.model').dropNode(this.targetData,  source.dragData);
+                                                                                                } else {
+                                                                                                    // drag around.. - reorder..
+                                                                                                     print("DRAG FROM SELF");
+                                                                                                     this.get('/LeftTree.model').moveNode(this.targetData, ctx.action);
+                                                                                                    
+                                                                                                    
+                                                                                                }
+                                                                                                //Seed.print(this.targetData);
+                                                                                              
+                                                                                            }
+                                                                                            
+                                                                                            
+                                                                                            
+                                                                                            // we can send stuff to souce here...
+                                                                        
+                                                                                            dnd_success = true;
+                                                                        
+                                                                                        }
+                                                                        
+                                                                                        if (dnd_success == false)
+                                                                                        {
+                                                                                                Seed.print ("DnD data transfer failed!\n");
+                                                                                        }
+                                                                        
+                                                                                        Gtk.drag_finish (  ctx, dnd_success, delete_selection_data, time);
+                                                                                        return true;
+                                                                        },
+                                                                        cursor_changed : function (self) {
+                                                                             if (this.blockChanges) { // probably not needed.. 
+                                                                               return true;
+                                                                             }
+                                                                             var render = this.get('/LeftTree').getRenderer();                
+                                                                           
+                                                                            
+                                                                            if (this.selection.count_selected_rows() < 1) {
+                                                                                this.get('/LeftPanel.model').load( false);
+                                                                                this.get('/MidPropTree').activeElement =  false;
+                                                                                this.get('/MidPropTree').hideWin();
+                                                                        
+                                                                                var pm = this.get('/RightPalete.model');
+                                                                                if (!this.get('/LeftTree').getPaleteProvider()) {
+                                                                                    // it may not be loaded yet..
+                                                                                    return  true;
+                                                                                }
+                                                                                pm.load(
+                                                                                        this.get('/LeftTree').getPaleteProvider().gatherList(
+                                                                                            this.get('/LeftTree.model').listAllTypes()
+                                                                                        )
+                                                                                    );
+                                                                                if (render && render.redraw) {
+                                                                                    render.redraw();
+                                                                                }
+                                                                                return true;
+                                                                            }
+                                                                                    
+                                                                                //console.log('changed');
+                                                                            var s = this.selection;
+                                                                            var ret = {};
+                                                                            s.get_selected(ret);
+                                                                            
+                                                                             // var val = "";
+                                                                            var value = ''+ret.model.get_value(ret.iter, 2).value.get_string();
+                                                                            this.get('/LeftPanel.model').activePath = ret.model.get_path(ret.iter).to_string();
+                                                                            
+                                                                            print("----------START EDITING: " + this.get('/LeftTree').getActivePath() );
+                                                                            
+                                                                            
+                                                                            var data = JSON.parse(value);
+                                                                            this.get('/MidPropTree').activeElement =  data;
+                                                                            this.get('/MidPropTree').hideWin();
+                                                                            this.get('/LeftPanel.model').load( data);
+                                                                            
+                                                                            console.log(value);
+                                                                           // _g.button.set_label(''+value.get_string());
+                                                                    
+                                                                            var pm =this.get('/RightPalete.model');
+                                                                            pm.load(  this.get('/LeftTree').getPaleteProvider().gatherList(
+                                                                                 this.get('/LeftTree.model').listAllTypes()));
+                                                                           
+                                                                            
+                                                                            if (render && render.redraw) {
+                                                                                render.redraw();
+                                                                            }
+                                                                               
+                                                                                //Seed.print( value.get_string());
+                                                                            return true;
+                                                                                        
+                                                                        }
+                                                                    },
+                                                                    id : "view",
+                                                                    pack : "add",
+                                                                    tooltip_column : 1,
+                                                                    enable_tree_lines : true,
+                                                                    headers_visible : false,
+                                                                    highlight : function(treepath_ar) {
+                                                                    
+                                                                            // highlighting for drag/drop
+                                                                            if (treepath_ar.length && treepath_ar[0].length ) {
+                                                                                this.el.set_drag_dest_row( 
+                                                                                        new  Gtk.TreePath.from_string( treepath_ar[0] ),  treepath_ar[1]);
+                                                                                } else {
+                                                                                    this.el.set_drag_dest_row(null, Gtk.TreeViewDropPosition.INTO_OR_AFTER);
+                                                                                }
+                                                                                 
+                                                                            },
+                                                                            
+                                                                    init : function() {
+                                                                        XObject.prototype.init.call(this);
+                                                                       var description = new Pango.FontDescription.c_new();
+                                                                       description.set_size(8000);
+                                                                       this.el.modify_font(description);
+                                                                    
+                                                                       this.selection = this.el.get_selection();
+                                                                       this.selection.set_mode( Gtk.SelectionMode.SINGLE);
+                                                                       var _this = this;
+                                                                    
+                                                                       // is this really needed??
+                                                                       this.selection.signal['changed'].connect(function() {
+                                                                               _this.get('/LeftTree.view').listeners.cursor_changed.apply(
+                                                                                   _this.get('/LeftTree.view'), [ _this.get('/LeftTree.view'), '']
+                                                                               );
+                                                                       });
+                                                                        
+                                                                       this.el.drag_source_set(             /* widget will be drag-able */
+                                                                               Gdk.ModifierType.BUTTON1_MASK,       /* modifier that will start a drag */
+                                                                               null,            /* lists of target to support */
+                                                                               0,              /* size of list */
+                                                                               Gdk.DragAction.COPY   | Gdk.DragAction.MOVE           /* what to do with data after dropped */
+                                                                       );
+                                                                     
+                                                                       this.el.drag_source_set_target_list(imports.Builder3.Globals.targetList);
+                                                                    
+                                                                       this.el.drag_source_add_text_targets(); 
+                                                                       this.el.drag_dest_set
+                                                                       ( 
+                                                                           Gtk.DestDefaults.MOTION  | Gtk.DestDefaults.HIGHLIGHT,
+                                                                           null,            /* lists of target to support */
+                                                                           0,              /* size of list */
+                                                                           Gdk.DragAction.COPY   | Gdk.DragAction.MOVE       /* what to do with data after dropped */
+                                                                       );
+                                                                    
+                                                                       this.el.drag_dest_set_target_list(  imports.Builder3.Globals.targetList);
+                                                                       this.el.drag_dest_add_text_targets( );
+                                                                    },
+                                                                    selectNode : function(treepath_str) {
+                                                                        //this.selection.select_path(new  Gtk.TreePath.from_string( treepath_str));
+                                                                     var tp = new Gtk.TreePath.from_string(treepath_str);
+                                                                              this.el.set_cursor(tp, null, false);  
+                                                                          this.el.scroll_to_cell(tp, null, false, 0,0);
+                                                                    },
+                                                                    items : [
+                                                                        {
+                                                                            xtype: Gtk.TreeStore,
+                                                                            activePath : false,
+                                                                            currentTree : false,
+                                                                            id : "model",
+                                                                            pack : "set_model",
+                                                                            
+                                                                            setFromNode : function(tp, n)
+                                                                            {
+                                                                                if (tp === false) {
+                                                                                    tp = this.get('/LeftTree').getActivePath();
+                                                                                }
+                                                                                var ret= {}
+                                                                                this.el.get_iter(ret, new  Gtk.TreePath.from_string( tp ) );
+                                                                                this.el.set_value(ret.iter, 0, '' +  this.nodeTitle(n));
+                                                                                this.el.set_value(ret.iter, 1, '' + this.nodeTitle(n));
+                                                                                this.el.set_value(ret.iter, 2, '' + this.nodeToJSON(n));
+                                                                                
+                                                                            },
+                                                                            
+                                                                            changed : function(  refresh) {
+                                                                                
+                                                                                    
+                                                                                
+                                                                                   print("-------MODEL CHANGED CALLED"  );
+                                                                                    
+                                                                                        //this.currentTree = this.toJS(false, true)[0];
+                                                                                    var d = new Date();
+                                                                                    this.file.items = this.toJS(false, false);
+                                                                                    print ("TO JS in " + ((new Date()) - d) + "ms");
+                                                                                  //  print("AFTER CHANGED");
+                                                                                    //console.dump(this.file.items);
+                                                                                    this.file.save();
+                                                                                    if (typeof(this.file.valaCompileCmd) !== 'undefined') {
+                                                                                            var cmd = this.file.valaCompileCmd();
+                                                                                            print(cmd.join(" "));
+                                                                                            try {
+                                                                                            
+                                                                                            var Spawn = imports.Spawn;
+                                                                                             var output = Spawn.run({
+                                                                                                 cwd : '/tmp',
+                                                                                                 args : cmd,
+                                                                                                 env : [] // optional
+                                                                                               
+                                                                                                });
+                                                                                                print(output);
+                                                                                             } catch(e) {
+                                                                                                print(e.message);
+                                                                                                print(e.toString());
+                                                                                            }
+                                                                                            /*
+                                                                                            print(cmd.join(' '));
+                                                                                            var out = {};
+                                                                                            this.get('/Terminal').el.fork_command_full(
+                                                                                                Vte.PtyFlags.DEFAULT,
+                                                                                                '/tmp',
+                                                                                                cmd, //argv
+                                                                                                [], // env
+                                                                                                0, //spawn flags
+                                                                                                null, // user func
+                                                                                                null, // child setupdata
+                                                                                                out
+                                                                                           ); 
+                                                                                           */
+                                                                                            //var cmd = "/usr/bin/seed " + runner + " " + dir + "\n";
+                                                                                            //this.get('/Terminal').el.feed_child(cmd, cmd.length);
+                                                                                            
+                                                                                        
+                                                                                        
+                                                                                    }
+                                                                                    
+                                                                                    this.currentTree = this.file.items[0];
+                                                                                    //console.log(this.file.toSource());
+                                                                                    
+                                                                                    if (refresh) {
+                                                                                        print("REDNER BROWSER?!");
+                                                                                        this.get('/LeftTree').renderView();
+                                                                            
+                                                                                        var pm = this.get('/RightPalete.model');
+                                                                                        if (!this.get('/RightPalete').provider) {
+                                                                                            pm.load([]);
+                                                                                            return;
+                                                                                        }
+                                                                                        
+                                                                                        
+                                                                                        pm.load( this.get('/RightPalete').provider.gatherList(this.listAllTypes()));
+                                                                                        //imports['Builder/RightBrowser.js'].renderJS(this.toJS());
+                                                                                    }
+                                                                                         
+                                                                            },
+                                                                            deleteSelected : function() {
+                                                                                this.get('/LeftTree.view').blockChanges = true;
+                                                                                var oret = {};
+                                                                                var s = this.get('/LeftTree.view').selection;
+                                                                                s.get_selected(oret);
+                                                                                var path = this.el.get_path(oret.iter).to_string();
+                                                                                
+                                                                                this.activePath= false;      
+                                                                                s.unselect_all();
+                                                                            
+                                                                                this.activePath= false;      
+                                                                                 var ret = {};
+                                                                                this.el.get_iter_from_string(ret, path);
+                                                                                this.el.remove(ret.iter);
+                                                                                
+                                                                                // rebuild treemap. -- depreciated.!!
+                                                                                this.map = {};
+                                                                                this.treemap = { };
+                                                                                //this.toJS(null, true) // does not do anything?
+                                                                                this.activePath= false;      
+                                                                                this.changed(true);
+                                                                                this.get('/LeftTree.view').blockChanges = false;
+                                                                            },
+                                                                            dropNode : function(target_data, node) {
+                                                                                     print("drop Node");
+                                                                                 // console.dump(node);
+                                                                                    //print(JSON.Stringify(target_data, null, 4));
+                                                                                    var tp = target_data[0].length ? new  Gtk.TreePath.from_string( target_data[0] ) : false;
+                                                                                    
+                                                                                    print("add " + tp + "@" + target_data[1]  );
+                                                                                    var parent = tp;
+                                                                                    var after = false;
+                                                                                    if (tp && target_data[1]  < 2) { // before or after..
+                                                                                        var ar = target_data[0].split(':');
+                                                                                        ar.pop();
+                                                                                        parent  = new  Gtk.TreePath.from_string( ar.join(':') );
+                                                                                        after = tp;
+                                                                                    }
+                                                                                    var nret = {};
+                                                                                    var pret = {}
+                                                                                    var aret = after ? {} : false;
+                                                                                    
+                                                                                    
+                                                                                    
+                                                                                    if (parent !== false) {
+                                                                                        this.el.get_iter(pret, parent);
+                                                                                    } else {
+                                                                                        pret.iter = null;
+                                                                                    }
+                                                                                    
+                                                                                    
+                                                                                    if (tp && after) {
+                                                                                        print(target_data[1]  > 0 ? 'insert_after' : 'insert_before');
+                                                                                        this.el.get_iter(aret, after);
+                                                                                        this.el[ target_data[1]  > 0 ? 'insert_after' : 'insert_before'](
+                                                                                                nret, pret.iter, aret.iter);
+                                                                                        
+                                                                                    } else {
+                                                                                        this.el.append(nret, pret.iter);
+                                                                                        
+                                                                                    }
+                                                                                    var new_path = this.el.get_path(nret.iter).to_string();
+                                                                                    print("new path = " + new_path)
+                                                                                    if (typeof(node) == 'string') {
+                                                                                        var ar = node.split('.');
+                                                                                        var xtype = ar.pop();
+                                                                                        
+                                                                                        node = {
+                                                                                            '|xns' : ar.join('.'),
+                                                                                            'xtype' : xtype
+                                                                                        };
+                                                                                        if (target_data.length == 3 && target_data[2].length) {
+                                                                                            node['*prop'] = target_data[2];
+                                                                                        }
+                                                                                        node = this.get('/DialogTemplateSelect').show(node);
+                                                                                        
+                                                                                    }
+                                                                                    // work out what kind of packing to use..
+                                                                                    if (typeof(node.pack) == 'undefined'  && parent !== false) {
+                                                                                        var pal = this.get('/LeftTree').getPaleteProvider();
+                                                                                        if (pal.name == 'Gtk') {
+                                                                                            var pname = pal.guessName(this.singleNodeToJS(parent.to_string()));
+                                                                                            var cname = pal.guessName(node);
+                                                                                            node.pack = pal.getDefaultPack(pname, cname);
+                                                                                        }
+                                                                                        
+                                                                                    }
+                                                                                    
+                                                                                    
+                                                                                    var xitems = [];
+                                                                                    if (node.items) {
+                                                                                        xitems = node.items;
+                                                                                        delete node.items;
+                                                                                    }
+                                                                                    // load children - if it has any..
+                                                                            
+                                                                                    if (xitems) {
+                                                                                        this.load(xitems, nret.iter);
+                                                                                        this.get('/LeftTree.view').el.expand_row(this.el.get_path(nret.iter), true);
+                                                                                    }
+                                                                                    if (tp && (xitems || after)) {
+                                                                                        this.get('/LeftTree.view').el.expand_row(this.el.get_path(pret.iter), true);
+                                                                                    }
+                                                                                    // wee need to get the empty proptypes from somewhere..
+                                                                                    
+                                                                                    //var olditer = this.activeIter;
+                                                                                    //this.activePath = new_path;
+                                                                                    print("calling changed with node data")
+                                                                              // changed actually set's the node data..
+                                                                                    this.setFromNode(new_path,node);
+                                                                                    this.changed(true);
+                                                                                    
+                                                                                    
+                                                                                    
+                                                                                    this.get('/LeftTree.view').el.set_cursor(this.el.get_path(nret.iter), null, false);
+                                                                                    
+                                                                                    //Builder.MidPropTree._model.load(node);
+                                                                                    //Builder.MidPropTree._win.hideWin();
+                                                                                    //Builder.LeftPanel._model.load( node);
+                                                                                    
+                                                                                        
+                                                                            },
+                                                                            findDropNode : function(treepath_str, targets) {
+                                                                            
+                                                                            // this is used by the dragdrop code in the roo version AFAIR..
+                                                                            
+                                                                                               var path = treepath_str.replace(/^builder-/, '');
+                                                                                        // treemap is depreciated... - should really check if model has any entries..
+                                                                            
+                                                                                        if (!this.el.iter_n_children(null)) {
+                                                                                            print("NO KEYS");
+                                                                                            return [ '',  Gtk.TreeViewDropPosition.INTO_OR_AFTER];
+                                                                                        }
+                                                                                        print("FIND treepath: " + path);
+                                                                                        //console.dump(this.treemap);
+                                                                                        
+                                                                                        if (!treepath_str.match(/^builder-/)) {
+                                                                                            return []; // nothing!
+                                                                                        }
+                                                                                        if (targets === true) {
+                                                                                            return [ path ];
+                                                                                        }
+                                                                                        return this.findDropNodeByPath(path,targets) 
+                                                                            },
+                                                                            findDropNodeByPath : function(treepath_str, targets, pref) {
+                                                                                var path = treepath_str + ''; // dupe it..
+                                                                                pref = typeof(pref) == 'undefined' ?  Gtk.TreeViewDropPosition.INTO_OR_AFTER : pref;
+                                                                                var last = false;
+                                                                                //console.dump(this.treemap);
+                                                                                while (path.length) {
+                                                                                    print("LOOKING FOR PATH: " + path);
+                                                                                    var node_data = this.singleNodeToJS(path);
+                                                                                    if (node_data === false) {
+                                                                                        print("node not found");
+                                                                                        return [];
+                                                                                    }
+                                                                                    
+                                                                                    var xname = this.get('/LeftTree.model').file.guessName(node_data);
+                                                                                    var match = false;
+                                                                                    var prop = '';
+                                                                                    targets.forEach(function(tg) {
+                                                                                        if (match) {
+                                                                                            return;;
+                                                                                        }
+                                                                                        if ((tg == xname)  ) {
+                                                                                            match = tg;
+                                                                                        }
+                                                                                        if (tg.indexOf(xname +':') === 0) {
+                                                                                            match = tg;
+                                                                                            prop = tg.split(':').pop();
+                                                                                        }
+                                                                                    });
+                                                                                    
+                                                                                    if (match) {
+                                                                                        if (last) { // pref is after/before..
+                                                                                            // then it's after last
+                                                                                            if (pref > 1) {
+                                                                                                return []; // do not allow..
+                                                                                            }
+                                                                                            return [ last, pref , prop];
+                                                                                            
+                                                                                        }
+                                                                                        return [ path , Gtk.TreeViewDropPosition.INTO_OR_AFTER , prop];
+                                                                                    }
+                                                                                    var par = path.split(':');
+                                                                                    last = path;
+                                                                                    par.pop();
+                                                                                    path = par.join(':');
+                                                                                }
+                                                                                
+                                                                                return [];
+                                                                                        
+                                                                            },
+                                                                            getIterValue : function (iter, col) {
+                                                                                
+                                                                                var gval = ''+this.el.get_value(iter, col).value.get_string();
+                                                                                return  gval;
+                                                                                
+                                                                                
+                                                                            },
+                                                                           columns : [
+                                                                                        GObject.TYPE_STRING, // title 
+                                                                                        GObject.TYPE_STRING, // tip
+                                                                                        GObject.TYPE_STRING // source..
+                                                                             ] ,
+                                                                                                                                                       
+                                                                                                                                                       
+                                                                           
+                                                                            listAllTypes : function() {
+                                                                                var s = this.get('/LeftTree.view').selection;
+                                                                                print ("LIST ALL TYPES: " + s.count_selected_rows() );
+                                                                                
+                                                                                if (s.count_selected_rows() > 0) {
+                                                                                    var ret = {}
+                                                                                    s.get_selected(ret);
+                                                                            
+                                                                                    // set some properties of the tree for use by the dropped element.
+                                                                                    var value = ''+ this.el.get_value(ret.iter, 2).value.get_string();
+                                                                                    var data = JSON.parse(value);
+                                                                                    
+                                                                                    
+                                                                                    var xname = this.get('/LeftTree.model').file.guessName(data);
+                                                                                    console.log('selected:' + xname);
+                                                                                    if (xname.length) {
+                                                                                        return [ xname ];
+                                                                                    }
+                                                                                    return []; // could not find it..
+                                                                                }
+                                                                                
+                                                                                var ret = [ ];
+                                                                                
+                                                                               var _this = this;
+                                                                                function addall(li)
+                                                                                {
+                                                                                    var el;
+                                                                                    for (var i =0 ; i < li.length; i++ ) { 
+                                                                                        el = li[i];
+                                                                                    
+                                                                                        // this is specific to roo!!!?
+                                                                                        if (!el) { // skip empty?
+                                                                                            return;
+                                                                                        }
+                                                                                        var fullpath =  _this.file.guessName(el);
+                                                                                        if (fullpath.length && ret.indexOf(fullpath) < 0) {
+                                                                                            ret.push(fullpath);
+                                                                                        }
+                                                                                        
+                                                                                        
+                                                                                        if (el.items && el.items.length) {
+                                                                                            addall(el.items);
+                                                                                        }
+                                                                                        
+                                                                                    };
+                                                                                    
+                                                                                    
+                                                                                }
+                                                                                
+                                                                                addall([this.currentTree]);
+                                                                                
+                                                                                // only if we have nothing, should we add '*top'
+                                                                                if (!ret.length) {
+                                                                                    ret = [ '*top' ];
+                                                                                }
+                                                                                //console.log('all types in tree');
+                                                                                //console.dump(ret);
+                                                                                
+                                                                                return ret;
+                                                                                                        
+                                                                            },
+                                                                            load : function(tr,iter)
+                                                                                    {
+                                                                                         //this.insert(citer,iter,0);
+                                                                                         
+                                                                                        for(var i =0 ; i < tr.length; i++) {
+                                                                                            var ret = {  };
+                                                                                            if (iter) {
+                                                                                                this.el.insert(ret ,iter,-1);
+                                                                                            } else {
+                                                                                                this.el.append(ret);
+                                                                                            }
+                                                                                            //print(JSON.stringify(ret,null,4));
+                                                                                            //print('call nodeToJSON: ' + tr[i]);
+                                                                                            var body = this.nodeToJSON(tr[i]);
+                                                                                            //print(body);
+                                                                                            //this.el.set_value(ret.iter, 0, '' _ [GObject.TYPE_STRING, this.nodeTitle(tr[i]) ]);
+                                                                                            //this.el.set_value(ret.iter, 1, [GObject.TYPE_STRING, this.nodeTip(tr[i]) ]);
+                                                                                            //this.el.set_value(ret.iter, 2, [GObject.TYPE_STRING, body ]);
+                                                                                            this.el.set_value(ret.iter, 0, ''  +  this.nodeTitle(tr[i]) );
+                                                                                            this.el.set_value(ret.iter, 1, '' + this.nodeTip(tr[i]) );
+                                                                                            this.el.set_value(ret.iter, 2, '' +  body );
+                                                                                            if (tr[i].items && tr[i].items.length) {
+                                                                                                this.load(tr[i].items, ret.iter);
+                                                                                            }
+                                                                                        }     
+                                                                                    },
+                                                                            loadFile : function(f) {
+                                                                                //console.dump(f);
+                                                                                  print("LOADFILE");
+                                                                                        this.el.clear();
+                                                                                        this.file = f;
+                                                                                        
+                                                                                        if (!f) {
+                                                                                            console.log('missing file');
+                                                                                            return;
+                                                                                        }
+                                                                                        
+                                                                                        // load the file if not loaded..
+                                                                                        if (f.items === false) {
+                                                                                            var _this = this;
+                                                                                            f.loadItems(function() {
+                                                                                                _this.loadFile(f);
+                                                                                            });
+                                                                                            return;
+                                                                                            
+                                                                                        }
+                                                                                        this.get('/Window').setTitle(f.project.getName() + ' - ' + f.name);
+                                                                                        
+                                                                                        if (f.items.length && typeof(f.items[0]) == 'string') {
+                                                                                        
+                                                                                            //this.get('/RightEditor').el.show();
+                                                                                            //this.get('/RightEditor.view').load( f.items[0]);
+                                                                                            return;
+                                                                                        }
+                                                                                        print("LOAD");
+                                                                                        //print(JSON.stringify(f.items, null,4));
+                                                                                        //console.dump(f.items);
+                                                                                        this.load(f.items);
+                                                                                        this.get('/LeftTree.view').el.expand_all();
+                                                                            
+                                                                                        if (!f.items.length) {
+                                                                                            // single item..
+                                                                                            
+                                                                                            this.get('/Window.leftvpaned').el.set_position(80);
+                                                                                            // select first...
+                                                                                            this.get('/LeftTree.view').el.set_cursor( 
+                                                                                                new  Gtk.TreePath.from_string('0'), null, false);
+                                                                                            
+                                                                                            
+                                                                                        } else {
+                                                                                              this.get('/Window.leftvpaned').el.set_position(200);
+                                                                                        }
+                                                                                        
+                        //return; -- debuggin
+                                                                                        //print("hide right editior");
+                                                                                        //this.get('/RightEditor').el.hide();
+                                                                                        this.get('/Editor').el.hide();
+                                                                                        print("set current tree");
+                                                                                        
+                                                                                        this.currentTree = this.toJS(false, false)[0];
+                                                                                        
+                                                                                        
+                                                                                        //console.dump(this.currentTree);
+                                                                                        this.currentTree = this.currentTree || { items: [] };
+                                                                                        this.get('/LeftTree').renderView();
+                                                                                       // console.dump(this.map);
+                                                                                        //var RightPalete     = imports.Builder.RightPalete.RightPalete;
+                                                                                        var pm = this.get('/RightPalete.model');
+                                                                                        // set up provider..
+                                                                                        
+                                                                                        this.get('/RightPalete').provider = this.get('/LeftTree').getPaleteProvider();
+                                                                                        
+                                                                                        if (!this.get('/RightPalete').provider) {
+                                                                                            print ("********* PALETE PROVIDER MISSING?!!");
+                                                                                        }
+                                                                                        this.get('/LeftTree').renderView();
+                                                                                        
+                                                                                        pm.load( this.get('/LeftTree').getPaleteProvider().gatherList(this.listAllTypes()));
+                                                                                        
+                                                                                        
+                                                                                                
+                                                                                        this.get('/Window.view-notebook').el.set_current_page(
+                                                                                            this.get('/LeftTree.model').file.getType()== 'Roo' ? 0 : -1);
+                                                                                                
+                                                                            },
+                                                                            moveNode : function(target_data, action) {
+                                                                                 //print("MOVE NODE");
+                                                                                       // console.dump(target_data);
+                                                                                var oret = {};
+                                                                                var s = this.get('/LeftTree.view').selection;
+                                                                                s.get_selected( oret);
+                                                                                var node = this.nodeToJS(oret.iter,false);
+                                                                                    //console.dump(node);
+                                                                                //print(JSON.stringify(node, null,4)); 
+                                                                                    
+                                                                                    // needs to drop first, otherwise the target_data 
+                                                                                        // treepath will be invalid.
+                                                                                        
+                                                                                this.dropNode(target_data, node);
+                                                                                if (action & Gdk.DragAction.MOVE) {
+                                                                                                  //          print("REMOVING OLD NODE");
+                                                                                    this.el.remove(oret.iter);
+                                                                                                    
+                                                                                }
+                                                                                        
+                                                                                this.activePath= false;
+                                                                                this.changed(true);
+                                                                            },
+                                                                            nodeTip : function(c) {
+                                                                                var ret = this.nodeTitle(c,true);
+                                                                                var funcs = '';
+                                                                            
+                                                                                
+                                                                                for( var i in c) {
+                                                                            
+                                                                                    if (!i.length || i[0] != '|') {
+                                                                                        continue;
+                                                                                    }
+                                                                                    if (i == '|init') { 
+                                                                                        continue;
+                                                                                    }
+                                                                                    if (typeof(c[i]) != 'string') {
+                                                                                       continue;
+                                                                                    }
+                                                                                    //print("prop : " + i + ':' + c[i]);
+                                                                                    if (!c[i].match(new RegExp('function'))) {
+                                                                                        continue;
+                                                                                    }
+                                                                                    funcs += "\n<b>" + i.substring(1) + '</b> : ' + c[i].split(/\n/).shift();
+                                                                                        
+                                                                                }
+                                                                                if (funcs.length) {
+                                                                                    ret+="\n\nMethods:" + funcs;
+                                                                                }
+                                                                                return ret;
+                                                                                
+                                                                            },
+                                                                            nodeTitle : function(c, renderfull) {
+                                                                                  var txt = [];
+                                                                                c = c || {};
+                                                                                var sr = (typeof(c['+buildershow']) != 'undefined') &&  !c['+buildershow'] ? true : false;
+                                                                                if (sr) txt.push('<s>');
+                                                                                if (typeof(c['*prop']) != 'undefined')   { txt.push(c['*prop']+ ':'); }
+                                                                                
+                                                                                if (renderfull && c['|xns']) {
+                                                                                    txt.push(c['|xns']);
+                                                                                }
+                                                                                
+                                                                                if (c.xtype)      { txt.push(c.xtype); }
+                                                                                if (c.id)      { txt.push('<b>[id=' + c.id + ']</b>'); }
+                                                                                if (c.fieldLabel) { txt.push('[' + c.fieldLabel + ']'); }
+                                                                                if (c.boxLabel)   { txt.push('[' + c.boxLabel + ']'); }
+                                                                                
+                                                                                
+                                                                                if (c.layout)     { txt.push('<i>' + c.layout + '</i>'); }
+                                                                                if (c.title)      { txt.push('<b>' + c.title + '</b>'); }
+                                                                                if (c.label)      { txt.push('<b>' + c.label+ '</b>'); }
+                                                                                if (c.header)    { txt.push('<b>' + c.header + '</b>'); }
+                                                                                if (c.legend)      { txt.push('<b>' + c.legend + '</b>'); }
+                                                                                if (c.text)       { txt.push('<b>' + c.text + '</b>'); }
+                                                                                if (c.name)       { txt.push('<b>' + c.name+ '</b>'); }
+                                                                                if (c.region)     { txt.push('<i>(' + c.region + ')</i>'); }
+                                                                                if (c.dataIndex) { txt.push('[' + c.dataIndex+ ']'); }
+                                                                                
+                                                                                // for flat classes...
+                                                                                if (typeof(c['*class']) != 'undefined')  { txt.push('<b>' +  c['*class']+  '</b>'); }
+                                                                                if (typeof(c['*extends']) != 'undefined')  { txt.push(': <i>' +  c['*extends']+  '</i>'); }
+                                                                                
+                                                                                
+                                                                                if (sr) txt.push('</s>');
+                                                                                return (txt.length == 0 ? "Element" : txt.join(" "));
+                                                                            },
+                                                                            nodeToJS : function (treepath, with_id) 
+                                                                            {
+                                                                                //print("nodeToJS : WITHID: "+ with_id);
+                                                                                var iter = treepath;  // API used to be iter here..
+                                                                                if (typeof(iter) == 'string') {
+                                                                                    var ret = {};
+                                                                                    if (!this.el.get_iter(ret,
+                                                                                                new Gtk.TreePath.from_string(treepath))) {
+                                                                                        return false;
+                                                                                    }
+                                                                                    iter = ret.iter;
+                                                                                } 
+                                                                                var pret = {};
+                                                                                var iv = this.getIterValue(iter, 2);
+                                                                               // print("IV" + iv);
+                                                                                var k = JSON.parse(iv);
+                                                                                if (k && k.json && !this.el.iter_parent( pret, iter  )) {
+                                                                                    delete k.json;
+                                                                                }
+                                                                                
+                                                                                if (with_id) {
+                                                                                    var treepath_str = this.el.get_path(iter).to_string();
+                                                                                    // not sure how we can handle mixed id stuff..
+                                                                                    if (typeof(k.id) == 'undefined')  {
+                                                                                        k.id =  'builder-'+ treepath_str ;
+                                                                                    }
+                                                                                    
+                                                                                    // needed??
+                                                                                    this.treemap[  treepath_str ] = k;
+                                                                                    k.xtreepath = treepath_str ;
+                                                                                    
+                                                                                }
+                                                                                if (this.el.iter_has_child(iter)) {
+                                                                                    var cret = {};
+                                                                                    this.el.iter_children(cret, iter);
+                                                                                    k.items = this.toJS(cret.iter,with_id);
+                                                                                }
+                                                                                return k;
+                                                                            },
+                                                                            nodeToJSON : function(c) {
+                                                                                var o  = {}
+                                                                                for (var i in c) {
+                                                                                    if (i == 'items') {
+                                                                                         continue;
+                                                                                    }
+                                                                                    o[i] = c[i];
+                                                                                }
+                                                                                return JSON.stringify(o);
+                                                                            },
+                                                                            singleNodeToJS : function (treepath) 
+                                                                                    {
+                                                                                        var ret = {};
+                                                                                        if (!this.el.get_iter(ret, new Gtk.TreePath.from_string(treepath))) {
+                                                                                            return false;
+                                                                                        }
+                                                                                        
+                                                                                        var iv = this.getIterValue(ret.iter, 2);
+                                                                                       
+                                                                                        return JSON.parse(iv);
+                                                                                        
+                                                                                    },
+                                                                            toJS : function(treepath, with_id)
+                                                                            {
+                                                                                //print("toJS : WITHID: "+ with_id);
+                                                                                
+                                                                                var iter = treepath;  // API used to be iter here..
+                                                                                
+                                                                                if (typeof(iter) == 'string') {
+                                                                                    var ret = {};
+                                                                                     if (!this.el.get_iter(ret, new Gtk.TreePath.from_string(treepath))) {
+                                                                                        return false;
+                                                                                    }
+                                                                                    iter = ret.iter;
+                                                                                }
+                                                                                
+                                                                                var first = false;
+                                                                                
+                                                                                if (!iter) {
+                                                                                    
+                                                                                    this.treemap = { }; 
+                                                                                     var ret = {};
+                                                                                     if (!this.el.get_iter_first(ret)) {
+                                                                                        return [];
+                                                                                    }
+                                                                                    iter = ret.iter;
+                                                                                    first = true;
+                                                                                } 
+                                                                                
+                                                                                var ar = [];
+                                                                                   
+                                                                                while (true) {
+                                                                                    
+                                                                                    var k = this.nodeToJS(iter, with_id); 
+                                                                                    ar.push(k);
+                                                                                    
+                                                                                    
+                                                                                    if (!this.el.iter_next(iter)) {
+                                                                                        break;
+                                                                                    }
+                                                                                }
+                                                                                
+                                                                                if (treepath === false) {
+                                                                                    //dupe!!!
+                                                                                    return JSON.parse(JSON.stringify(ar));
+                                                                                }
+                                                                                
+                                                                                return ar;
+                                                                                // convert the list into a json string..
+                                                                            
+                                                                                
+                                                                            }
+                                                                        },
+                                                                        {
+                                                                            xtype: Gtk.TreeViewColumn,
+                                                                            pack : "append_column",
+                                                                            init : function() {
+                                                                                XObject.prototype.init.call(this);
+                                                                               this.el.add_attribute(this.items[0].el , 'markup', 0 );
+                                                                            },
+                                                                            items : [
+                                                                                {
+                                                                                    xtype: Gtk.CellRendererText,
+                                                                                    pack : "pack_start"
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                },
+                                                                {
+                                                                    xtype: Gtk.Menu,
+                                                                    pack : false,
+                                                                    id : "LeftTreeMenu",
+                                                                    items : [
+                                                                        {
+                                                                            xtype: Gtk.MenuItem,
+                                                                            pack : "add",
+                                                                            label : "Delete Element",
+                                                                            listeners : {
+                                                                                activate : function (self) {
+                                                                                
+                                                                                     this.get('/LeftTree.model').deleteSelected();
+                                                                                }
+                                                                            }
+                                                                        },
+                                                                        {
+                                                                            xtype: Gtk.MenuItem,
+                                                                            listeners : {
+                                                                                activate : function (self) {
+                                                                                
+                                                                                    var tree = this.get('/LeftTree');
+                                                                                    var model = this.get('/LeftTree.model');
+                                                                                    var el = tree.getActivePath();
+                                                                                    print(el);
+                                                                                    var js = model.toJS(el, false);
+                                                                                    // print(JSON.stringify(js[0], null,4));
+                                                                                    this.get('/DialogSaveTemplate').show(JSON.stringify(js[0], null,4));
+                                                                                     
+                                                                                    
+                                                                                }
+                                                                            },
+                                                                            label : "Save as Template",
+                                                                            pack : "add"
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            xtype: Gtk.VBox,
+                                                            pack : "add",
+                                                            id : "LeftProjectTree",
+                                                            showNoProjectSelected : function() {
+                                                               this.get('/StandardErrorDialog').show("Select a Project first."); 
+                                                            },
+                                                            getActiveProject : function() {
+                                                                 return this.project;
+                                                            },
+                                                            listeners : {
+                                                                leave_notify_event : function (self, event) {
+                                                                    return false;
+                                                                }
+                                                            },
+                                                            items : [
+                                                                {
+                                                                    xtype: Gtk.HBox,
+                                                                    pack : "pack_start,false,false",
+                                                                    items : [
+                                                                        {
+                                                                            xtype: Gtk.ComboBox,
+                                                                            listeners : {
+                                                                                changed : function (self) {
+                                                                                       var fn = this.getValue();
+                                                                                       var pm  = imports.ProjectManager.ProjectManager;
+                                                                                       this.get('/LeftProjectTree.model').loadProject(pm.getByFn(fn))
+                                                                                }
+                                                                            },
+                                                                            id : "combo",
+                                                                            getValue : function() {
+                                                                                var ix = this.el.get_active();
+                                                                                if (ix < 0 ) {
+                                                                                    return false;
+                                                                                }
+                                                                                var data = imports.ProjectManager.ProjectManager.projects;
+                                                                                if (typeof(data[ix]) == 'undefined') {
+                                                                               return false; 
+                                                                                }
+                                                                                return data[ix].fn;
+                                                                            },
+                                                                            init : function() {
+                                                                                XObject.prototype.init.call(this);
+                                                                                this.el.add_attribute(this.get('render').el , 'markup', 1 );  
+                                                                            },
+                                                                            setValue : function(fn)
+                                                                            {
+                                                                                var el = this.el;
+                                                                                el.set_active(-1);
+                                                                                var data = imports.ProjectManager.ProjectManager.projects;
+                                                                                data.forEach(function(n, ix) {
+                                                                                    if (fn == n.fn) {
+                                                                                        el.set_active(ix);
+                                                                                        return false;
+                                                                                    }
+                                                                                });
+                                                                            },
+                                                                            items : [
+                                                                                {
+                                                                                    xtype: Gtk.CellRendererText,
+                                                                                    pack : "pack_start,true",
+                                                                                    id : "render"
+                                                                                },
+                                                                                {
+                                                                                    xtype: Gtk.ListStore,
+                                                                                    id : "combomodel",
+                                                                                    pack : "set_model",
+                                                                                                                                                                       
+                                                                                                                                                                       columns : [
+                                                                                                                                                                               GObject.TYPE_STRING,   
+                                                                                        GObject.TYPE_STRING
+                                                                                                                                                                       ],
+                                                                                                                                                                       
+                                                                                                                                                                       
+                                                                                    
+                                                                                    loadData : function(data) {
+                                                                                                                                                                               //print("load data called");Seed.quit();
+                                                                                                                                                                               //print(data);Seed.quit();
+                                                                                                                                                                               
+                                                                                        var ov = this.get('/LeftProjectTree.combo').getValue();
+                                                                                        this.el.clear();
+                                                                                        var el = this.el;
+                                                                                        var na = {};
+                                                                                        
+                                                                                                                                                                               
+                                                                                                                                                                               data.forEach(function(p) {
+                                                                                            
+                                                                                            el.append(na);
+                                                                                            //print(JSON.stringify(XObject.keys(na)));
+                                                                                            //print(typeof(na.iter));
+                                                                                            //print(JSON.stringify(iter))
+                                                                                            el.set_value(na.iter, 0, p.fn);
+                                                                                            el.set_value(na.iter, 1, p.name);
+                                                                                            
+                                                                                        });
+                                                                                        
+                                                                                        this.get('/LeftProjectTree.combo').setValue(ov);
+                                                                                    }
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                },
+                                                                {
+                                                                    xtype: Gtk.ScrolledWindow,
+                                                                    pack : "add",
+                                                                    shadow_type : Gtk.ShadowType.IN,
+                                                                  
+                                                                    items : [
+                                                                        {
+                                                                            xtype: Gtk.TreeView,
+                                                                           
+                                                                            listeners : {
+                                                                                cursor_changed : function (self) {
+                                                                                    
+                                                                                    var model = this.get('/LeftProjectTree.model');
+                                                                                    
+
+                                                                                    
+                                                                                    if (model.loading) {
+                                                                                        
+                                                                                         
+                                                                                        return;
+                                                                                    }
+                                                                                    print("LOADING IS FALSE");
+                                                                                    var ret = {};        
+                                                                                    if (this.selection.count_selected_rows() < 1) {
+                                                                                        //XN.get('Builder.LeftTree.model').
+                                                                                        this.get('/LeftTree.model').load( false);
+                                                                                        
+                                                                                        return;
+                                                                                    }
+                                                                                     //console.log('changed');
+                                                                                    var s = this.selection;
+                                                                                    s.get_selected(ret);
+                                                                                    var value = ''+ ret.model.get_value(ret.iter, 2).value.get_string();
+                                                                                    //console.log(JSON.stringify(value,null,4));// id..
+                                                                                    console.log("OUT?" + value);// id..
+                                                                                    var file = this.get('/LeftProjectTree').project.getById(value);
+                                                                                    
+                                                                                    file.items = false;
+                                                                                    console.log(file);
+                                                                                    
+                                                                            
+                                                                            
+                                                                                    var nb = this.get('/LeftTopPanel.expander');
+                                                                                    nb.el.expanded = false;
+                                                                                    nb.onCollapse();
+                                                                                    //nb.listeners.activate.call(nb);
+                                                                                    //_expander.el.set_expanded(false);
+                                                                            
+                                                                                    var ltm = this.get('/LeftTree.model');
+                                                                                    ltm.loadFile(file);
+                                                                                    
+                                                                                    return true;
+                                                                                }
+                                                                            },
+                                                                            id : "view",
+                                                                            tooltip_column : 1,
+                                                                            enable_tree_lines : true,
+                                                                            headers_visible : false,
+                                                                            init : function() {
+                                                                                XObject.prototype.init.call(this);
+                                                                            var description = new Pango.FontDescription.c_new();
+                                                                                                        description.set_size(8000);
+                                                                                                        this.el.modify_font(description);
+                                                                                                        
+                                                                                                        this.selection = this.el.get_selection();
+                                                                                                        this.selection.set_mode( Gtk.SelectionMode.SINGLE);
+                                                                            },
+                                                                            items : [
+                                                                                {
+                                                                                    xtype: Gtk.TreeStore,
+                                                                                    pack : "set_model",
+                                                                                    id : "model",
+                                                                                    loading : false,
+                                                                                                                                                                       columns :  [
+                                                                                                        GObject.TYPE_STRING, // title 
+                                                                                                        GObject.TYPE_STRING, // tip
+                                                                                                        GObject.TYPE_STRING // id..
+                                                                                                        ] ,
+                                                                                                                                                                        
+                                                                                    
+                                                                                    loadProject : function(pr) {
+                                                                                         print("LOAD PROJECT");
+                                                                                          var model = this.get('/LeftProjectTree.model');
+                                                                                         model.loading = true;
+                                                                                          
+                                                                                        this.el.clear();
+                                                                                         if (!pr) {
+                                                                                             return;
+                                                                                         }
+                                                                                      
+                                                                                         this.get('/LeftProjectTree').project = pr;
+                                                                                       
+                                                                                         this.load(pr.toTree());
+                                                                                    
+                                                                                         this.get('/LeftProjectTree.view').el.expand_all();
+                                                                                         model.loading = false;
+                                                                                         
+                                                                                    },
+                                                                                    load : function(tr,iter) {
+                                                                                      //  console.dump(tr);
+                                                                                        
+                                                                                       
+                                                                                        console.log('Project tree load: ' + tr.length);
+                                                                                        var cret = {};
+                                                                                        //this.insert(citer,iter,0);
+                                                                                        
+                                                                                        var _this = this;
+                                                                                        // recursive...
+                                                                                        tr.forEach(function (r) {
+                                                                                            if (!iter) {
+                                                                                                _this.el.append(cret);   
+                                                                                            } else {
+                                                                                                _this.el.insert(cret,iter,-1);
+                                                                                            }
+                                                                                            _this.el.set_value(cret.iter, 0,  '' + r.getTitle() ); // title 
+                                                                                            _this.el.set_value(cret.iter, 1, '' + r.getTitleTip()); // tip
+                                                                                            _this.el.set_value(cret.iter, 2, '' + r.id ); //id
+                                                                                            if (r.cn && r.cn.length) {
+                                                                                                _this.load(r.cn, cret.iter);
+                                                                                            }
+                                                                                            
+                                                                                        });
+                                                                                         
+                                                                                    },
+                                                                                    getValue : function(iter, col) {
+                                                                                        var gval = ''+ this.el.get_value(iter, col).value.get_string();
+                                                                                        return  gval;
+                                                                                    }
+                                                                                },
+                                                                                {
+                                                                                    xtype: Gtk.TreeViewColumn,
+                                                                                    pack : "append_column",
+                                                                                    init : function() {
+                                                                                        XObject.prototype.init.call(this);
+                                                                                        this.el.add_attribute(this.items[0].el , 'markup', 0 );
+                                                                                    },
+                                                                                    items : [
+                                                                                        {
+                                                                                            xtype: Gtk.CellRendererText,
+                                                                                            pack : "pack_start"
+                                                                                        }
+                                                                                    ]
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            xtype: Gtk.VBox,
+                                            items : [
+                                                {
+                                                    xtype: Gtk.HBox,
+                                                    pack : "pack_start,false,true,0",
+                                                    id : "LeftProps",
+                                                    items : [
+                                                        {
+                                                            xtype: Gtk.Button,
+                                                            pack : "add",
+                                                            listeners : {
+                                                                button_press_event : function (self, event) {
+                                                                    this.get('/MidPropTree.model').showData('props');
+                                                                    return false;
+                                                                }
+                                                            },
+                                                            items : [
+                                                                {
+                                                                    xtype: Gtk.HBox,
+                                                                    pack : "add",
+                                                                    items : [
+                                                                        {
+                                                                            xtype: Gtk.Image,
+                                                                            pack : "add",
+                                                                            stock : Gtk.STOCK_ADD,
+                                                                            icon_size : Gtk.IconSize.MENU
+                                                                        },
+                                                                        {
+                                                                            xtype: Gtk.Label,
+                                                                            pack : "add",
+                                                                            label : "Property"
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            xtype: Gtk.Button,
+                                                            listeners : {
+                                                                button_press_event : function (self, event) {
+                                                                    
+                                                                       if (!this.get('/Editor').save()) {
+                                                                           // popup!! - click handled.. 
+                                                                           return true;
+                                                                        }
+                                                                        this.get('/MidPropTree.model').showData('events');
+                                                                    return false;
+                                                                }
+                                                            },
+                                                            pack : "add",
+                                                            items : [
+                                                                {
+                                                                    xtype: Gtk.HBox,
+                                                                    pack : "add",
+                                                                    items : [
+                                                                        {
+                                                                            xtype: Gtk.Image,
+                                                                            pack : "add",
+                                                                            stock : Gtk.STOCK_ADD,
+                                                                            icon_size : Gtk.IconSize.MENU
+                                                                        },
+                                                                        {
+                                                                            xtype: Gtk.Label,
+                                                                            pack : "add",
+                                                                            label : "Handler"
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            xtype: Gtk.Button,
+                                                            listeners : {
+                                                                button_press_event : function (self, ev) {
+                                                                
+                                                                       if (!this.get('/Editor').save()) {
+                                                                           // popup!! - click handled.. 
+                                                                           return true;
+                                                                        }
+                                                                        
+                                                                       var p = this.get('/AddPropertyPopup');
+                                                                       if (!p.el) {
+                                                                               p.init();
+                                                                       }
+                                                                       p.el.set_screen(Gdk.Screen.get_default());
+                                                                        p.el.show_all();
+                                                                         p.el.popup(null, null, null, null, 3, ev.button.time);
+                                                                    return true;
+                                                                }
+                                                            },
+                                                            pack : "add",
+                                                            items : [
+                                                                {
+                                                                    xtype: Gtk.HBox,
+                                                                    pack : "add",
+                                                                    items : [
+                                                                        {
+                                                                            xtype: Gtk.Image,
+                                                                            pack : "add",
+                                                                            stock : Gtk.STOCK_ADD,
+                                                                            icon_size : Gtk.IconSize.MENU
+                                                                        },
+                                                                        {
+                                                                            xtype: Gtk.Label,
+                                                                            pack : "add",
+                                                                            label : "Other"
+                                                                        }
+                                                                    ]
+                                                                },
+                                                                {
+                                                                    xtype: Gtk.Menu,
+                                                                    pack : false,
+                                                                    id : "AddPropertyPopup",
+                                                                    items : [
+                                                                        {
+                                                                            xtype: Gtk.MenuItem,
+                                                                            pack : "append",
+                                                                            tooltip_markup : "Using this.get('*someid') will find any id in an application.",
+                                                                            label : "ID",
+                                                                            listeners : {
+                                                                                activate : function (self) {
+                                                                                    
+                                                                                    this.get('/LeftPanel.model').add( {
+                                                                                        key : 'id', 
+                                                                                        type : 'string',
+                                                                                        val : '',
+                                                                                        //skel  : skel,
+                                                                                        etype : 'props'
+                                                                                    });
+                                                                                }
+                                                                            }
+                                                                        },
+                                                                        {
+                                                                            xtype: Gtk.MenuItem,
+                                                                            pack : "append",
+                                                                            tooltip_markup : "Add what type of packing is to be used",
+                                                                            label : "PACK",
+                                                                            listeners : {
+                                                                                activate : function (self) {
+                                                                                
+                                                                                    this.get('/LeftPanel.model').add( {
+                                                                                        key : 'pack', 
+                                                                                                type : 'string',
+                                                                                                val : 'add',
+                                                                                          etype : 'props'
+                                                                                    });
+                                                                                }
+                                                                            }
+                                                                        },
+                                                                        {
+                                                                            xtype: Gtk.MenuItem,
+                                                                            pack : "append",
+                                                                            tooltip_markup : "Override the init method",
+                                                                            label : "INIT",
+                                                                            listeners : {
+                                                                                activate : function (self) {
+                                                                                
+                                                                                    this.get('/LeftPanel.model').add( {
+                                                                                       key : '|init', 
+                                                                                        type : 'function',
+                                                                                        val  : "function() {\n    XObject.prototype.init.call(this);\n}\n",
+                                                                                        etype : 'props'
+                                                                                    });
+                                                                                }
+                                                                            }
+                                                                        },
+                                                                        {
+                                                                            xtype: Gtk.SeparatorMenuItem,
+                                                                            pack : "add"
+                                                                        },
+                                                                        {
+                                                                            xtype: Gtk.MenuItem,
+                                                                            pack : "append",
+                                                                            tooltip_markup : "Add a user defined string property",
+                                                                            label : "String",
+                                                                            listeners : {
+                                                                                activate : function (self) {
+                                                                                
+                                                                                    this.get('/LeftPanel.model').add( {
+                                                                                                 key : '', 
+                                                                                                type : 'string',
+                                                                                                val  : "",
+                                                                                                etype : 'props'
+                                                                                    });
+                                                                                }
+                                                                            }
+                                                                        },
+                                                                        {
+                                                                            xtype: Gtk.MenuItem,
+                                                                            pack : "append",
+                                                                            tooltip_markup : "Add a user defined number property",
+                                                                            label : "Number",
+                                                                            listeners : {
+                                                                                activate : function (self) {
+                                                                                
+                                                                                    this.get('/LeftPanel.model').add( {
+                                                                                                 key : '', 
+                                                                                                type : 'number',
+                                                                                                val  : 0,
+                                                                                                etype : 'props'
+                                                                                    });
+                                                                                }
+                                                                            }
+                                                                        },
+                                                                        {
+                                                                            xtype: Gtk.MenuItem,
+                                                                            pack : "append",
+                                                                            tooltip_markup : "Add a user defined boolean property",
+                                                                            label : "Boolean",
+                                                                            listeners : {
+                                                                                activate : function (self) {
+                                                                                
+                                                                                    this.get('/LeftPanel.model').add( {
+                                                                                                 key : '', 
+                                                                                                type : 'boolean',
+                                                                                                val  : false,
+                                                                                                etype : 'props'
+                                                                                    });
+                                                                                }
+                                                                            }
+                                                                        },
+                                                                        {
+                                                                            xtype: Gtk.SeparatorMenuItem,
+                                                                            pack : "add"
+                                                                        },
+                                                                        {
+                                                                            xtype: Gtk.MenuItem,
+                                                                            pack : "append",
+                                                                            tooltip_markup : "Add a user function boolean property",
+                                                                            label : "Function",
+                                                                            listeners : {
+                                                                                activate : function (self) {
+                                                                                
+                                                                                    this.get('/LeftPanel.model').add( {
+                                                                                           key : '|', 
+                                                                                                        type : 'function',
+                                                                                                        val  : "function() {\n    \n}\n",
+                                                                                                        etype : 'props'
+                                                                                    });
+                                                                                }
+                                                                            }
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                },
+                                                {
+                                                    xtype: Gtk.ScrolledWindow,
+                                                    editing : false,
+                                                    id : "LeftPanel",
+                                                    pack : "add",
+                                                    
+                                                    shadow_type : Gtk.ShadowType.IN,
+                                                    items : [
+                                                        {
+                                                            xtype: Gtk.TreeView,
+                                                            listeners : {
+                                                                button_press_event : function (self, ev) {
+                                                                
+                                                                    
+                                                                    if (!this.get('/Editor').save()) {
+                                                                        // popup!! - click handled.. 
+                                                                        return true;
+                                                                    }
+                                                                    var res = { }; 
+                                                                    
+                                                                    if (!this.el.get_path_at_pos(ev.button.x,ev.button.y, res)) {
+                                                                        return false; //not on a element.
+                                                                    }
+                                                                    
+                                                                     // right click.
+                                                                     if (ev.button.button == 3) {    
+                                                                        // show popup!.   
+                                                                        if (res.column.title == 'value' && this.get('/LeftPanel').editing) {
+                                                                            return false;
+                                                                        }
+                                                                        //if (! this.get('/LeftPanelPopup')LeftPanelPopup.el) LeftPanelPopup.init();
+                                                                        var p = this.get('/LeftPanelPopup');
+                                                                        if (!p.el) {
+                                                                            p.init();
+                                                                        }
+                                                                
+                                                                        p.el.set_screen(Gdk.Screen.get_default());
+                                                                        p.el.show_all();
+                                                                        p.el.popup(null, null, null, null, 3, ev.button.time);
+                                                                        //Seed.print("click:" + res.column.title);
+                                                                        
+                                                                        
+                                                                        return false;
+                                                                    }
+                                                                    
+                                                                     
+                                                                    if (res.column.title != 'value') {
+                                                                          //  XObject.error("column is not value?");
+                                                                        return false; // ignore.. - key click.. ??? should we do this??
+                                                                    }
+                                                                    
+                                                                    // currently editing???
+                                                                //    if (  this.activePath) {
+                                                                        
+                                                                     //   this.activePath = false;
+                                                                       // stop editing!!!!
+                                                                        if (this.get('/Editor').dirty) {
+                                                                            //if (!this.get('/Editor.buffer').checkSyntax()) {
+                                                                            //   this.get('/StandardErrorDialog').show("Fix errors in code and save.."); 
+                                                                            //   return true;
+                                                                            //    // error Dialog
+                                                                            //}
+                                                                            if (!this.get('/Editor.view').save()) {
+                                                                                return true;
+                                                                            }
+                                                                        }   
+                                                                        this.get('/LeftPanel').editableColumn.items[0].el.stop_editing();
+                                                                        this.get('/LeftPanel').editing = false;
+                                                                    
+                                                                    //    XObject.error("Currently editing?");
+                                                                     //   return false;
+                                                                   // }
+                                                                    
+                                                                    var renderer = this.get('/LeftPanel').editableColumn.items[0].el; // set has_entry..
+                                                                    
+                                                                    var type = this.get('/LeftPanel.model').getType(res.path.to_string());
+                                                                        
+                                                                    // get options for this type -- this is to support option lists etc..
+                                                                    var provider = this.get('/LeftTree').getPaleteProvider();
+                                                                    var opts = provider.findOptions(type);
+                                                                    
+                                                                    if (opts === false) {
+                                                                        // it's text etnry
+                                                                         this.get('/LeftPanel').editableColumn.setOptions([]);
+                                                                        renderer.has_entry = true;
+                                                                    } else {
+                                                                         this.get('/LeftPanel').editableColumn.setOptions(opts);
+                                                                        renderer.has_entry = false;
+                                                                    }
+                                                                    this.get('/LeftPanel.model').startEditing(res.path.to_string(), 1);
+                                                                        
+                                                                   //Seed.print("click" + ev.type);
+                                                                    //console.dump(res);
+                                                                    return false;
+                                                                
+                                                                              
+                                                                   
+                                                                }
+                                                            },
+                                                            id : "view",
+                                                            tooltip_column : 5,
+                                                            enable_tree_lines : true,
+                                                            headers_visible : false,
+                                                            init : function() {
+                                                                 XObject.prototype.init.call(this); 
+                                                                                   
+                                                                                this.selection = this.el.get_selection();
+                                                                                this.selection.set_mode( Gtk.SelectionMode.SINGLE);
+                                                                             
+                                                                                
+                                                                                var description = new Pango.FontDescription.c_new();
+                                                                                description.set_size(8000);
+                                                                                this.el.modify_font(description);
+                                                            },
+                                                            items : [
+                                                                {
+                                                                    xtype: Gtk.TreeStore,
+                                                                    activePath : false,
+                                                                    id : "model",
+                                                                    pack : "set_model",
+                                                                    add : function(info) {
+                                                                          // info includes key, val, skel, etype..
+                                                                                  console.dump(info);
+                                                                                type = info.type.toLowerCase();
+                                                                                var data = this.toJS();
+                                                                                
+                                                                                if (info.etype == 'events') {
+                                                                                    data.listeners = data.listeners || { };
+                                                                                    if (typeof(data.listeners[info.key]) != 'undefined') {
+                                                                                        return; //already set!
+                                                                                    }
+                                                                                } else {
+                                                                                    if (typeof(data[info.key]) != 'undefined') {
+                                                                                        return;
+                                                                                    }
+                                                                                }
+                                                                                
+                                                                                if (typeof(info.val) == 'undefined') {
+                                                                                        
+                                                                                    info.val = '';
+                                                                                    if (info.type.toLowerCase() == 'boolean') {
+                                                                                        info.val = true;
+                                                                                    }
+                                                                                    if (type == 'number') {
+                                                                                        info.val = 0;
+                                                                                    }
+                                                                                    // utf8 == string..
+                                                                                    
+                                                                                    
+                                                                                }
+                                                                                var k = info.key;
+                                                                                if (info.etype == 'events') {
+                                                                                 
+                                                                                    data.listeners[info.key] = info.val;
+                                                                                    k = '!' + info.key;
+                                                                                } else {
+                                                                                    data[info.key] = info.val;
+                                                                                }
+                                                                                
+                                                                                
+                                                                                var map = this.load(data);
+                                                                                
+                                                                                // flag it as changed to the interface..
+                                                                                this.get('/LeftTree.model').setFromNode(false,data);
+                                                                                this.get('/LeftTree.model').changed(true); 
+                                                                                
+                                                                                
+                                                                                this.startEditing(map[k]);
+                                                                                 
+                                                                                /*
+                                                                                LeftPanel.get('view').el.row_activated(
+                                                                                    new Gtk.TreePath.from_string(map[k]), 
+                                                                                    LeftPanel.editableColumn.el
+                                                                                );
+                                                                                */
+                                                                    },
+                                                                    changed : function(str, doRefresh) {
+                                                                        if (!this.activePath) {
+                                                                            print("NO active path when changed")
+                                                                            return;
+                                                                        }
+                                                                        var ret = {};
+                                                                        this.el.get_iter(ret, new Gtk.TreePath.from_string(this.activePath));
+                                                                        
+                                                                        this.el.set_value(ret.iter, 1, '' +str);
+                                                                        this.el.set_value(ret.iter, 3, '' + this.toShort(str));
+                                                                        var type = this.getIterValue(ret.iter, 4);
+                                                                    
+                                                                        this.el.set_value(ret.iter, 5, type + ' : ' + str);
+                                                                        // update the tree...  
+                                                                        //print("new data: "  + JSON.stringify(this.toJS() , null,4));
+                                                                        this.get('/LeftTree.model').setFromNode(false,this.toJS());
+                                                                        this.get('/LeftTree.model').changed(doRefresh); 
+                                                                                 
+                                                                    },
+                                                                    deleteSelected : function() {
+                                                                         var data = this.toJS();
+                                                                        var ret ={};
+                                                                        var s = this.get('/LeftPanel.view').selection;
+                                                                        s.get_selected( ret);
+                                                                             
+                                                                           
+                                                                        var val = this.get('/LeftPanel.model').el.get_value(ret.iter, 0).value.get_string();
+                                                                        
+                                                                        if (val[0] == '!') {
+                                                                            // listener..
+                                                                            if (!data.listeners || typeof(data.listeners[  val.substring(1)]) == 'undefined') {
+                                                                                return;
+                                                                            }
+                                                                            delete data.listeners[  val.substring(1)];
+                                                                            if (!XObject.keys(data.listeners).length) {
+                                                                                delete data.listeners;
+                                                                            }
+                                                                            
+                                                                        } else {
+                                                                            if (typeof(data[val]) == 'undefined') {
+                                                                                return;
+                                                                            }
+                                                                            delete data[val];
+                                                                        }
+                                                                        
+                                                                        
+                                                                        this.load(data);
+                                                                        
+                                                                        
+                                                                        this.get('/LeftTree.model').setFromNode(false,this.toJS());
+                                                                        this.get('/LeftTree.model').changed(true); 
+                                                                        
+                                                                        
+                                                                    },
+                                                                    getIterValue : function(iter, col) {
+                                                                        var gval = '' + this.get('/LeftPanel.model').el.get_value(iter, col).value.get_string();
+                                                                        return gval;
+                                                                    },
+                                                                    getType : function(treepath) {
+                                                                         return this.getValue(treepath, 4);
+                                                                    },
+                                                                    getValue : function(treepath_str, col) 
+                                                                    {
+                                                                       // get's the  value in a row.. - keys - returns string, values - formats it..
+                                                                        var ret = {};
+                                                                        this.el.get_iter(ret, new Gtk.TreePath.from_string(treepath_str));
+                                                                        
+                                                                        var val = '' + this.get('/LeftPanel.model').el.get_value(ret.iter, col).value.get_string();
+                                                                        
+                                                                        if (col != 1) {
+                                                                            return val;
+                                                                        }
+                                                                        var type = this.getType(this.el.get_path(ret.iter).to_string());
+                                                                        //print("TYPE: " +type + " -  val:" + val);
+                                                                        switch(type.toLowerCase()) {
+                                                                            case 'number':
+                                                                            case 'uint':
+                                                                            case 'int':
+                                                                                return parseFloat(val); // Nan ?? invalid!!?        
+                                                                            case 'float':
+                                                                            case 'gfloat':
+                                                                                return 1.0 * parseFloat(val); // Nan ?? invalid!!?
+                                                                            case 'boolean':
+                                                                                return val == 'true' ? true : false;
+                                                                            default: 
+                                                                                var nv = parseFloat(val);
+                                                                                if (!isNaN(nv) && (val == ''+nv)) {
+                                                                                    return nv;
+                                                                                }
+                                                                                return val;
+                                                                        }
+                                                                                                
+                                                                    },
+                                                                                                                                       columns :  [
+                                                                                                    GObject.TYPE_STRING,  // 0 real key
+                                                                                                    GObject.TYPE_STRING, // 1 real value 
+                                                                                                     GObject.TYPE_STRING,  // 2 visable key
+                                                                                                     GObject.TYPE_STRING, // 3 visable value
+                                                                                                     GObject.TYPE_STRING, // 4 need to store type of!!!
+                                                                                                      GObject.TYPE_STRING // 5 tooltip
+                                                                                                  
+                                                                                                ],
+                                                                                                                                       
+                                                                     load : function(ar) {
+                                                                    // might casue problesm..
+                                                                        // this.get('/Editor.RightEditor').save();
+                                                                    
+                                                                           this.get('/Editor').el.hide();
+                                                                         this.get('/Editor').activePath = false;
+                                                                    
+                                                                    
+                                                                      this.el.clear();
+                                                                                  
+                                                                        //this.get('/RightEditor').el.hide();
+                                                                        if (ar === false) {
+                                                                            return false;
+                                                                        }
+                                                                        var ret = {}; 
+                                                                        
+                                                                    
+                                                                        var provider = this.get('/LeftTree').getPaleteProvider();
+                                                                        
+                                                                         
+                                                                        // sort!!!?
+                                                                        var keys  = XObject.keys(ar);
+                                                                        keys.sort();
+                                                                        ar.listeners = ar.listeners || {};
+                                                                        
+                                                                        for (var i in ar.listeners ) {
+                                                                             var iret ={};
+                                                                            this.el.append(iret);
+                                                                            var p = this.el.get_path(iret.iter).to_string();
+                                                                            ret['!' + i] = p;
+                                                                            
+                                                                            this.el.set_value(iret.iter, 0, '!'+  i  );
+                                                                            this.el.set_value(iret.iter, 1, '' + ar.listeners[i]);
+                                                                            this.el.set_value(iret.iter, 2, '<b>'+ i + '</b>');
+                                                                            
+                                                                            this.el.set_value(iret.iter, 3, '' + this.toShort(ar.listeners[i]));
+                                                                            this.el.set_value(iret.iter, 4, 'function');
+                                                                            this.el.set_value(iret.iter, 5, i + ' : ' + ar.listeners[i]);
+                                                                        }
+                                                                        
+                                                                        
+                                                                       
+                                                                        var _this = this;
+                                                                        keys.forEach(function(i) {
+                                                                            if (typeof(ar[i]) == 'object') {
+                                                                                return;
+                                                                            }
+                                                                            
+                                                                            var type = provider.findType(ar, i, ar[i]);
+                                                                            var iret = {};
+                                                                            _this.el.append(iret);
+                                                                            var p = _this.el.get_path(iret.iter).to_string();
+                                                                            ret[i] = p;
+                                                                            _this.el.set_value(iret.iter, 0, ''+i);
+                                                                            _this.el.set_value(iret.iter, 1, '' + ar[i]);  
+                                                                            _this.el.set_value(iret.iter, 2, ''+i);
+                                                                            _this.el.set_value(iret.iter, 3, ''+ _this.toShort(ar[i]));
+                                                                            _this.el.set_value(iret.iter, 4, ''+type);
+                                                                            _this.el.set_value(iret.iter, 5, type + ' : ' + ar[i]);
+                                                                        });
+                                                                        return ret;
+                                                                    },
+                                                                    startEditing : function(path,col) {
+                                                                        
+                                                                        // alled by menu 'edit' currently..
+                                                                        /**
+                                                                        * start editing path (or selected if not set..)
+                                                                        * @param {String|false} path  (optional) treepath to edit - selected tree gets
+                                                                        *     edited by default.
+                                                                        * @param {Number} 0 or 1 (optional)- column to edit. 
+                                                                        */
+                                                                        // fix tp to be the 'treepath' string (eg. 0/1/2...)
+                                                                        var tp;
+                                                                        if (typeof(path) == 'string') {
+                                                                            tp = new Gtk.TreePath.from_string(path);
+                                                                        } else {
+                                                                            var itr = {};
+                                                                            var s = this.get('/LeftPanel.view').selection;
+                                                                            s.get_selected( itr);
+                                                                            tp = this.el.get_path(itr.iter);
+                                                                            path = tp.to_string();
+                                                                        }
+                                                                        
+                                                                       
+                                                                        // which colum is to be edited..
+                                                                        var colObj = false;
+                                                                        
+                                                                        // not sure what this does..
+                                                                        
+                                                                        if (typeof(col) == 'undefined') {
+                                                                            var k = this.getValue(path, 0);
+                                                                            col = 1;
+                                                                            colObj = (!k.length || k == '|') ? 
+                                                                                this.get('/LeftPanel').propertyColumn : this.get('/LeftPanel').editableColumn;
+                                                                        } else {
+                                                                            colObj = col ? this.get('/LeftPanel').editableColumn : this.get('/LeftPanel').propertyColumn;
+                                                                        }
+                                                                        
+                                                                        // make sure the pulldown is set correctly..
+                                                                        // not really needed for second col...
+                                                                        var showEditor = false;
+                                                                        this.get('/Editor').activePath = false;
+                                                                        this.get('/Editor').el.hide();
+                                                                        var provider = this.get('/LeftTree').getPaleteProvider();
+                                                                        if (col) {
+                                                                            var provider = this.get('/LeftTree').getPaleteProvider();
+                                                                            var type = this.get('/LeftPanel.model').getType(path);
+                                                                            var opts = provider.findOptions(type);
+                                                                            var renderer = this.get('/LeftPanel').editableColumn.items[0].el;
+                                                                            
+                                                                            if (opts === false) {
+                                                                                this.get('/LeftPanel').editableColumn.setOptions([]);
+                                                                                renderer.has_entry = true; 
+                                                                            } else {
+                                                                                this.get('/LeftPanel').editableColumn.setOptions(opts);
+                                                                                renderer.has_entry = false;/// - pulldowns do not have entries
+                                                                            }
+                                                                            // determine if we should use the Text editor...
+                                                                            var keyname = this.getValue(path, 0);
+                                                                            var data_value = this.getValue(path, 1);
+                                                                        
+                                                                            if ((keyname[0] == '|') || 
+                                                                                (   
+                                                                                    (typeof(data_value) == 'string' ) && 
+                                                                                    ( data_value.match(/function/g) || data_value.match(/\n/g)) // || (data_value.length > 20))
+                                                                                )) {
+                                                                                showEditor = true;
+                                                                            }
+                                                                            print("SHOW EDITOR" + showEditor ? 'YES' :'no');
+                                                                            
+                                                                        }
+                                                                        var _this = this;    
+                                                                        // end editing..
+                                                                       // this.get('/BottomPane').el.hide();
+                                                                        //this.get('/RightEditor').el.hide();
+                                                                         
+                                                                        
+                                                                        if (showEditor) {
+                                                                    
+                                                                            this.activePath = false;
+                                                                            
+                                                                            _this.get('/Editor').el.show_all();
+                                                                            GLib.timeout_add(0, 1, function() {
+                                                                    
+                                                                                //_this.get('/BottomPane').el.show();
+                                                                                 //_this.get('/RightEditor').el.show();
+                                                                                
+                                                                                _this.get('/Editor.RightEditor.view').load( _this.getValue(path, 1), provider.name );
+                                                                                
+                                                                                _this.get('/Editor').activePath = path;
+                                                                                _this.activePath = path ;
+                                                                              
+                                                                                return false;
+                                                                            });
+                                                                            return;
+                                                                        }
+                                                                          
+                                                                        
+                                                                        
+                                                                    
+                                                                        // iter now has row...
+                                                                        GLib.timeout_add(0, 100, function() {
+                                                                            _this.activePath = path;
+                                                                            colObj.items[0].el.editable = true; // esp. need for col 0..
+                                                                            _this.get('/LeftPanel.view').el.set_cursor_on_cell(
+                                                                                tp,
+                                                                                colObj.el,
+                                                                                colObj.items[0].el,
+                                                                                true
+                                                                            );
+                                                                        });
+                                                                        
+                                                                    },
+                                                                    toJS : function() {
+                                                                        var iret = {};
+                                                                         this.get('/LeftPanel.model').el.get_iter_first(iret);
+                                                                         
+                                                                        var ar = {};
+                                                                           
+                                                                        while (true) {
+                                                                            
+                                                                            var k = this.getValue(this.el.get_path(iret.iter).to_string(), 0);
+                                                                           // Seed.print(k);
+                                                                            if (k[0] == '!') {
+                                                                                ar.listeners = ar.listeners || {};
+                                                                                ar.listeners[  k.substring(1)] = this.getValue(this.el.get_path(iret.iter).to_string(), 1);
+                                                                                
+                                                                            } else {
+                                                                                ar[ k ] = this.getValue(this.el.get_path(iret.iter).to_string(), 1);
+                                                                            }
+                                                                            
+                                                                            if (! this.get('/LeftPanel.model').el.iter_next(iret.iter)) {
+                                                                                break;
+                                                                            }
+                                                                        }
+                                                                        
+                                                                        
+                                                                        //print(JSON.stringify(ar));
+                                                                        return ar;
+                                                                        // convert the l
+                                                                    },
+                                                                    toShort : function(str) {
+                                                                        var a = typeof(str) == 'string' ? str.split("\n") : [];
+                                                                            return a.length > 1 ? a[0] + '....' : '' + str;
+                                                                    }
+                                                                },
+                                                                {
+                                                                    xtype: Gtk.TreeViewColumn,
+                                                                    pack : "append_column",
+                                                                    init : function() {
+                                                                        XObject.prototype.init.call(this);
+                                                                    
+                                                                        this.el.add_attribute(this.items[0].el , 'text', 2 );
+                                                                        this.get('/LeftPanel').propertyColumn = this;
+                                                                    },
+                                                                    title : "key",
+                                                                    items : [
+                                                                        {
+                                                                            xtype: Gtk.CellRendererText,
+                                                                            pack : "pack_start",
+                                                                            listeners : {
+                                                                                editing_started : function (self, editable, path) {
+                                                                                
+                                                                                        this.get('/LeftPanel.model').activePath  = path;
+                                                                                
+                                                                                },
+                                                                                edited : function (self, object, p0) {
+                                                                                    
+                                                                                    //print("CHANGED VALUE:" + JSON.stringify(p0, null,4));
+                                                                                    //    return;
+                                                                                       var model = this.get('/LeftPanel.model');
+                                                                                    var path = model.activePath;
+                                                                                    var iret = {};
+                                                                                    model.el.get_iter(iret, new Gtk.TreePath.from_string(path));
+                                                                                    model.el.set_value(iret.iter, 0, p0);
+                                                                                    model.el.set_value(iret.iter, 2, p0);
+                                                                                        
+                                                                                       model.activePath = false;
+                                                                                    this.get('/LeftTree.model').setFromNode(false,model.toJS());
+                                                                                    this.get('/LeftTree.model').changed(true); 
+                                                                        
+                                                                                    this.el.editable = false;
+                                                                                }
+                                                                            }
+                                                                        }
+                                                                    ]
+                                                                },
+                                                                {
+                                                                    xtype: Gtk.TreeViewColumn,
+                                                                    pack : "append_column",
+                                                                    title : "value",
+                                                                    init : function() {
+                                                                        XObject.prototype.init.call(this);
+                                                                       this.el.add_attribute(this.items[0].el , 'text', 3 );
+                                                                       //this.el.add_attribute(this.items[0].el , 'sensitive', 3 );
+                                                                       //this.el.add_attribute(this.items[0].el , 'editable', 3 );
+                                                                              // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);
+                                                                    
+                                                                       this.get('/LeftPanel').editableColumn= this;
+                                                                    },
+                                                                    setOptions : function(ar) {
+                                                                           var m = this.items[0].el.model;
+                                                                                m.clear();
+                                                                                
+                                                                                ar.forEach(function(i) {
+                                                                                       // sort!!!?
+                                                                                    var iret  = {};
+                                                                                    m.append(iret);
+                                                                                    m.set_value(iret.iter, 0, i);
+                                                                                });
+                                                                                
+                                                                    },
+                                                                    items : [
+                                                                        {
+                                                                            xtype: Gtk.CellRendererCombo,
+                                                                            listeners : {
+                                                                                edited : function (self, object, p0) {
+                                                                                    
+                                                                                       this.get('/LeftPanel').editing = false;
+                                                                                       var ap = this.get('/LeftPanel.model').activePath
+                                                                                       print("EDITED? "  + ap + " - p:" + p0 + " t:" + p0);
+                                                                                        this.get('/LeftPanel.model').changed(p0, true);
+                                                                                        this.get('/LeftPanel.model').activePath = false;
+                                                                                        this.el.editable = false;
+                                                                                },
+                                                                                editing_started : function (self, editable, path) {
+                                                                                   this.get('/LeftPanel').editing  = true;
+                                                                                       //  console.log('editing started');
+                                                                                       // r.has_entry = false;
+                                                                                
+                                                                                    this.el.editable = false; // make sure it's not editor...
+                                                                                   
+                                                                                }
+                                                                            },
+                                                                            editable : false,
+                                                                            pack : "pack_start",
+                                                                            text_column : 0,
+                                                                            has_entry : true,
+                                                                            init : function() {
+                                                                                XObject.prototype.init.call(this);
+                                                                               this.el.model = new Gtk.ListStore();
+                                                                                this.el.model.set_column_types ( 1, [
+                                                                                    GObject.TYPE_STRING  // 0 real key
+                                                                                  ]);
+                                                                            }
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            xtype: Gtk.Menu,
+                                                            pack : false,
+                                                            id : "LeftPanelPopup",
+                                                            items : [
+                                                                {
+                                                                    xtype: Gtk.MenuItem,
+                                                                    pack : "append",
+                                                                    label : "Delete",
+                                                                    listeners : {
+                                                                        activate : function (self) {
+                                                                               this.get('/LeftPanel.model').deleteSelected();
+                                                                        }
+                                                                    }
+                                                                },
+                                                                {
+                                                                    xtype: Gtk.MenuItem,
+                                                                    pack : "append",
+                                                                    label : "Edit",
+                                                                    listeners : {
+                                                                        activate : function (self) {
+                                                                               this.get('/LeftPanel.model').startEditing(false, 0);
+                                                                        }
+                                                                    }
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                },
+                                {
+                                    xtype: Gtk.ScrolledWindow,
+                                    pack : "pack_end,false,true,0",
+                                    id : "MidPropTree",
+                                    shown : true,
+                                    shadow_type : Gtk.ShadowType.IN,
+                                    init : function() {
+                                        XObject.prototype.init.call(this);
+                                           XObject.prototype.init.call(this); 
+                                        this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC)
+                                        this.el.set_size_request ( 150, -1 );
+                                        this.shown = true;
+                                    },
+                                    activeElement : false,
+                                    hideWin : function() {
+                                         
+                                        if (!this.shown) {
+                                            print("HIDEWIN - currently not shown")
+                                            return;
+                                        }
+                                        
+                                        
+                                        if (this.get('/Window.left').el.position < 160) {
+                                            print("HIDEWIN - small already.")
+                                            
+                                            return;
+                                        }
+                                        this.get('/Window.left').el.position = this.get('/Window.left').el.position  - 150;
+                                        print("HIDEWIN attempting to hide.")
+
+                                        this.el.hide();
+                                        this.shown = false;
+                                    },
+                                    items : [
+                                        {
+                                            xtype: Gtk.TreeView,
+                                            listeners : {
+                                                cursor_changed : function (self) {
+                                                        // this is getting fired when we are loading elements..
+                                                        if (this.get('/MidPropTree.model').loading) {
+                                                            return;
+                                                        }
+                                                        
+                                                       var iret = {};
+                                                                        
+                                                        //console.log('changed');
+                                                        var m = this.get('model');
+                                                        if (!this.selection){
+                                                           this.selection = this.el.get_selection();
+                                                        }
+                                                   
+                                                        var s = this.selection;
+                                                        if (!s.get_selected(iret)) {
+                                                            return; 
+                                                        }
+                                                        var tp = m.el.get_path(iret.iter).to_string();
+                                                        
+                                                        
+                                                        // var val = "";
+                                                        
+                                                        var key = m.getValue(tp, 0);
+                                                        
+                                                        var type = m.getValue(tp, 1);
+                                                        var skel = m.getValue(tp, 3);
+                                                        var etype = m.getValue(tp, 5);
+                                                        
+                                                        
+                                                        this.get('/MidPropTree').hideWin();
+                                                
+                                                        if (type.toLowerCase() == 'function') {
+                                                            
+                                                            if (etype != 'events') {
+                                                                key = '|' + key;
+                                                            }
+                                                            print("cursor_changed: ADDding to left panel model");
+                                                            this.get('/LeftPanel.model').add({
+                                                                key :  key, 
+                                                                type : type,
+                                                                val  : skel,
+                                                                etype : etype
+                                                            })  
+                                                            return;
+                                                        }
+                                                        // has dot in name, and is boolean???? this does not make sense..
+                                                        //if (type.indexOf('.') > -1 ||  type.toLowerCase() == 'boolean') {
+                                                        //     key = '|' + key;
+                                                       // }
+                                                        print("cursor_changed: ADDding to left panel model");
+                                                        this.get('/LeftPanel.model').add( {
+                                                            key : key, 
+                                                            type : type,
+                                                            //skel  : skel,
+                                                            etype : etype
+                                                           }) //, 
+                                                }
+                                            },
+                                            pack : "add",
+                                            tooltip_column : 2,
+                                            enable_tree_lines : true,
+                                            headers_visible : false,
+                                            init : function() {
+                                               XObject.prototype.init.call(this); 
+                                                                
+                                                   var description = new Pango.FontDescription.c_new();
+                                                 description.set_size(8000);
+                                                this.el.modify_font(description);     
+                                                                
+                                                //this.selection = this.el.get_selection();
+                                                // this.selection.set_mode( Gtk.SelectionMode.SINGLE);
+                                             
+                                            
+                                                
+                                              
+                                                
+                                            },
+                                            items : [
+                                                {
+                                                    xtype: Gtk.ListStore,
+                                                    id : "model",
+                                                    pack : "set_model",
+                                                    loading : false,
+                                                    getValue : function(treepath, col)
+                                                    {
+                                                        var tp = new Gtk.TreePath.from_string (treepath);
+                                                        var iret = {};
+                                                        this.el.get_iter (iret, tp);
+                                                        var value = this.el.get_value(iret.iter, col);
+                                                        return ''+ value.value.get_string();
+                                                        
+                                                    },
+                                                    init : function() {
+                                                        XObject.prototype.init.call(this);
+                                                       this.el.set_column_types ( 6, [
+                                                            GObject.TYPE_STRING,  // real key
+                                                             GObject.TYPE_STRING, // real type
+                                                             GObject.TYPE_STRING, // docs ?
+                                                             GObject.TYPE_STRING, // visable desc
+                                                             GObject.TYPE_STRING, // function desc
+                                                             GObject.TYPE_STRING // element type (event|prop)
+                                                            
+                                                        ] );
+                                                    },
+                                                    showData : function(type) {
+                                                                
+                                                                
+                                                                this.loading = true;
+                                                                this.el.clear();
+                                                                if (!this.get('/MidPropTree').activeElement || !type) {
+                                                                    this.loading = false;
+                                                                    return; // no active element
+                                                                }
+                                                    
+                                                                var fullpath = this.get('/LeftTree.model').file.guessName(
+                                                                        this.get('/MidPropTree').activeElement);
+                                                                var palete = this.get('/LeftTree').getPaleteProvider();
+                                                                
+                                                                 
+                                                                
+                                                                Seed.print('Showing right?');
+                                                                if (!this.get('/MidPropTree').shown) {
+                                                    
+                                                                    this.get('/Window.left').el.position = this.get('/Window.left').el.position  + 150;
+                                                                    this.get('/MidPropTree').el.show();
+                                                                    this.get('/MidPropTree').shown = true;
+                                                                }
+                                                                
+                                                                var elementList = palete.getPropertiesFor(fullpath, type).sort(function(a,b) { 
+                                                                    return a.name >  b.name ? 1 : -1;
+                                                                });
+                                                                print ("GOT " + elementList.length + " items for " + fullpath + "|" + type);
+                                                               // console.dump(elementList);
+                                                               
+                                                                // scope of this is off..??
+                                                                
+                                                                
+                                                                for(var i =0 ; i < elementList.length; i++) {
+                                                                    var iret = {};
+                                                                    var p=elementList[i];
+                                                                    this.el.append(iret);
+                                                                  //  console.log( '<b>' + p.name +'</b> ['+p.type+']');
+                                                                        //GObject.TYPE_STRING,  // real key
+                                                                        // GObject.TYPE_STRING, // real type
+                                                                        // GObject.TYPE_STRING, // docs ?this.el.set_value(iter, 0, p.name);et_value(iter, 0, p.name);
+                                                                        // GObject.TYPE_STRING // func def?
+                                                                        
+                                                                    
+                                                                    this.el.set_value(iret.iter, 0, p.name);
+                                                                    this.el.set_value(iret.iter, 1, p.type);
+                                                                    this.el.set_value(iret.iter, 2, '<span size="small"><b>' + p.name +'</b> ['+p.type+']</span>' + "\n" + p.desc);
+                                                                    this.el.set_value(iret.iter, 3, p.sig ? p.sig  : '');
+                                                                    this.el.set_value(iret.iter, 4, '<span size="small"><b>' + p.name +'</b> ['+p.type+']</span>');
+                                                                    this.el.set_value(iret.iter, 5, type);
+                                                                    
+                                                                }
+                                                                this.loading = false;              
+                                                    }
+                                                },
+                                                {
+                                                    xtype: Gtk.TreeViewColumn,
+                                                    pack : false,
+                                                    init : function() {
+                                                        this.el = new Gtk.TreeViewColumn();
+                                                        this.parent.el.append_column(this.el);
+                                                        
+                                                        XObject.prototype.init.call(this);
+                                                        this.el.add_attribute(this.items[0].el , 'markup', 4  );
+                                                    },
+                                                    items : [
+                                                        {
+                                                            xtype: Gtk.CellRendererText,
+                                                            pack : "pack_start,true"
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                }
+                            ]
+                        },
+                        {
+                            xtype: Gtk.HPaned,
+                            pack : "add",
+                            id : 'centereast',
+                            position : 500,
+
+                            items : [
+                                {
+                                    xtype: Gtk.VPaned,
+                                    pack : "add",
+                                    position : 300,
+                                    items : [
+                                        {
+                                            xtype: Gtk.VBox,
+                                            pack : "add",
+                                            items : [
+                                                {
+                                                    xtype: Gtk.Notebook,
+                                                    pack : "pack_start,true,true",
+                                                    id : "view-help-nb",
+                                                    init : function() {
+                                                        XObject.prototype.init.call(this);
+                                                       this.el.set_tab_label(this.items[0].el, new Gtk.Label({ label : "Preview" }));
+                                                        this.el.set_tab_label(this.items[1].el, new Gtk.Label({ label : "Help" }));
+                                                    },
+                                                    items : [
+                                                        {
+                                                            xtype: Gtk.Notebook,
+                                                            id : "view-notebook",
+                                                            pack : "add",
+                                                            tab_border : 0,
+                                                            init : function() {
+                                                                XObject.prototype.init.call(this);
+                                                                this.el.set_current_page(0);
+                                                                //print("SET LABEL?")
+                                                                this.el.set_tab_label(this.items[0].el, new Gtk.Label({ label : "Roo View" }));
+                                                                this.el.set_tab_label(this.items[1].el, new Gtk.Label({ label : "Gtk View" }));
+                                                            },
+                                                            show_tabs : false,
+                                                            items : [
+                                                                {
+                                                                    xtype: Gtk.VBox,
+                                                                    id : "RightBrowser",
+                                                                    pack : "add",
+                                                                    items : [
+                                                                        {
+                                                                            xtype: Gtk.HBox,
+                                                                            pack : "pack_start,false,true,0",
+                                                                            items : [
+                                                                                {
+                                                                                    xtype: Gtk.Button,
+                                                                                    listeners : {
+                                                                                        clicked : function (self) {
+                                                                                          this.get('/RightBrowser.view').renderJS(null,true);
+                                                                                        }
+                                                                                    },
+                                                                                    label : "Redraw",
+                                                                                    pack : "pack_start,false,false,0"
+                                                                                },
+                                                                                {
+                                                                                    xtype: Gtk.CheckButton,
+                                                                                    listeners : {
+                                                                                        toggled : function (self, state) {
+                                                                                            this.el.set_label(this.el.active  ? "Auto Redraw On" : "Auto Redraw Off");
+                                                                                        }
+                                                                                    },
+                                                                                    active : true,
+                                                                                    id : "AutoRedraw",
+                                                                                    label : "Auto Redraw On",
+                                                                                    pack : "pack_start,false,false,0"
+                                                                                },
+                                                                                {
+                                                                                    xtype: Gtk.Button,
+                                                                                    listeners : {
+                                                                                        clicked : function (self) {
+                                                                                          
+                                                                                                                                                                                   var view = this.get('/RightBrowser.view');
+                                                                                                                                                                                 //this.get('/RightBrowser.view').redraws = 99;
+                                                                                                                                                                                       view.refreshRequired = true;
+                                                                                                                                                                                       view.lastRedraw = false;
+                                                                                                                                                                                       view.renderedData = false;
+                                                                                                                                                                                       view.renderJS(null,true);
+                                                                                                                                                                                 
+                                                                                                                                                                               }
+                                                                                    },
+                                                                                    label : "Full Redraw",
+                                                                                    pack : "pack_start,false,false,0"
+                                                                                }
+                                                                            ]
+                                                                        },
+                                                                        {
+                                                                            xtype: Gtk.ScrolledWindow,
+                                                                            pack : "add",
+                                                                            init : function() {
+                                                                                XObject.prototype.init.call(this);
+                                                                                this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+                                                                            },
+                                                                            shadow_type : Gtk.ShadowType.IN,
+                                                                            items : [
+                                                                                {
+                                                                                    xtype: WebKit.WebView,
+                                                                                    listeners : {
+                                                                                        load_finished : function (self, object) {
+                                                                                            print("load finished");
+                                                                                            var file = this.get('/LeftTree.model').file;
+                                                                                            file.saveHTML(object);
+                                                                                        //    print("load_finished"); return;
+                                                                                               // if (this.ready) { // dont do it twice!
+                                                                                                //   return; 
+                                                                                               //}
+                                                                                               if (!this.inspectorShown) {
+                                                                                                   this.el.get_inspector().show();
+                                                                                                   this.inspectorShown = true;
+                                                                                               }
+                                                                                        
+                                                                                               this.ready = true;
+                                                                                               
+                                                                                                //if (this.pendingRedraw) {
+                                                                                                //    this.pendingRedraw = false;
+                                                                                                //    this.refreshRequired  = true;
+                                                                                                //}
+                                                                                                //var js = this.get('/LeftTree.model').toJS();
+                                                                                                //if (js && js[0]) {
+                                                                                               //    this.renderJS(js[0]);
+                                                                                               //}
+                                                                                        
+                                                                                        },
+                                                                                        script_alert : function (self, object, p0) {
+                                                                                            //         print(p0);
+                                                                                                return false;
+                                                                                                return true; // do not display anything...
+                                                                                        },
+                                                                                        console_message : function (self, object, p0, p1) {
+                                                                                                print(object);
+                                                                                             //  console.log(object);
+                                                                                           
+                                                                                            
+                                                                                                if (object.match(/variable/) && object.match(/Builder/)) {
+                                                                                                    print("got builder missing message");
+                                                                                                    this.refreshRequired = true;
+                                                                                                    this.lastRedraw = 0;
+                                                                                                    this.runRefresh();
+                                                                                                    return true;
+                                                                                                }
+                                                                                            
+                                                                                           
+                                                                                                if (!object.match(/^\{/)) {
+                                                                                                
+                                                                                                    //this.get('/Terminal').feed(object);
+                                                                                                    return true; // do not handle!!! -> later maybe in console..
+                                                                                                }
+                                                                                                
+                                                                                                
+                                                                                                
+                                                                                                
+                                                                                               // console.log(object);
+                                                                                                var val =  JSON.parse(object);
+                                                                                        
+                                                                                                if (typeof(val['hover-node']) != 'undefined') {
+                                                                                                    this.activeNode = val['hover-node'];
+                                                                                                    console.log('active node: ' + this.activeNode);
+                                                                                                    return true;
+                                                                                                }
+                                                                                        
+                                                                                                 var ret = false;
+                                                                                                 if (typeof(val['id']) != 'undefined') {
+                                                                                                   // this.activeNode = val['id'];
+                                                                                                    var tg = this.get('/LeftTree.model').findDropNode(val['id'], true); 
+                                                                                                    if (!tg || typeof(tg[0]) == 'undefined') {
+                                                                                                        return false;
+                                                                                                    }
+                                                                                                    print("SELECT node " + tg[0]);
+                                                                                                    
+                                                                                                    this.get('/LeftTree.view').selectNode(tg[0]);
+                                                                                                    ret  = true;
+                                                                                                    
+                                                                                                }
+                                                                                                
+                                                                                                if (ret && typeof(val['set']) != 'undefined') {
+                                                                                                    print("console messages: ADDding to left panel model");
+                                                                                                    //
+                                                                                                   //this.get('/LeftPanel.model').add({
+                                                                                                   //     key : val['set'],
+                                                                                                   //     val : val['value']
+                                                                                                   // });
+                                                                                                    //console.log('active node: ' + this.activeNode);
+                                                                                                    
+                                                                                                }
+                                                                                                //Seed.print('a:'+a);
+                                                                                                //Seed.print('b:'+b);
+                                                                                                //Seed.print('c:'+c);
+                                                                                                return ret;
+                                                                                        },
+                                                                                        drag_motion : function (w, ctx,  x,   y,   time, ud) {
+                                                                                           // console.log('DRAG MOTION'); 
+                                                                                                // status:
+                                                                                                // if lastCurrentNode == this.currentNode.. -- don't change anything..
+                                                                                                this.targetData = [];
+                                                                                                this.el.execute_script("Builder.overPos(" + x +','+ y + ");");
+                                                                                                
+                                                                                                // A) find out from drag all the places that node could be dropped.
+                                                                                                var src = Gtk.drag_get_source_widget(ctx);
+                                                                                                if (!src.dropList) {
+                                                                                                    Gdk.drag_status(ctx,0, time);
+                                                                                                    return true;
+                                                                                                }
+                                                                                                // b) get what we are over.. (from activeNode)
+                                                                                                // tree is empty.. - list should be correct..
+                                                                                                if (!this.get('/LeftTree.model').currentTree) {
+                                                                                                    Gdk.drag_status(ctx, Gdk.DragAction.COPY,time);
+                                                                                                    return true;
+                                                                                                    
+                                                                                                }
+                                                                                                // c) ask tree where it should be dropped... - eg. parent.. (after node ontop)
+                                                                                                
+                                                                                                var tg = this.get('/LeftTree.model').findDropNode(this.activeNode, src.dropList);
+                                                                                                console.dump(tg);
+                                                                                                if (!tg.length) {
+                                                                                                    Gdk.drag_status(ctx, 0,time);
+                                                                                                    this.get('/LeftTree.view').highlight(false);
+                                                                                                    return true;
+                                                                                                }
+                                                                                                 
+                                                                                                // if we have a target..
+                                                                                                // -> highlight it! (in browser)
+                                                                                                // -> highlight it! (in tree)
+                                                                                                
+                                                                                                Gdk.drag_status(ctx, Gdk.DragAction.COPY,time);
+                                                                                                this.get('/LeftTree.view').highlight(tg);
+                                                                                                this.targetData = tg;
+                                                                                                // for tree we should handle this...
+                                                                                                return true;
+                                                                                        },
+                                                                                        drag_drop : function (w, ctx, x, y,time, ud) {
+                                                                                               print("TARGET: drag-drop");
+                                                                                                var is_valid_drop_site = true;
+                                                                                                
+                                                                                                 
+                                                                                                w.drag_get_data
+                                                                                                (          /* will receive 'drag-data-received' signal */
+                                                                                                        ctx,        /* represents the current state of the DnD */
+                                                                                                        imports.Builder3.Globals.atoms["STRING"],    /* the target type we want */
+                                                                                                        time            /* time stamp */
+                                                                                                );
+                                                                                                                
+                                                                                                                
+                                                                                                                /* No target offered by source => error */
+                                                                                                               
+                                                                                        
+                                                                                               return  is_valid_drop_site;
+                                                                                        },
+                                                                                        drag_data_received : function (w, ctx,  x,  y, sel_data,  target_type,  time, ud) 
+                                                                                            {
+                                                                                                print("Browser: drag-data-received");
+                                                                                                var delete_selection_data = false;
+                                                                                                vardnd_success = false;
+                                                                                                /* Deal with what we are given from source */
+                                                                                                if( sel_data && sel_data.length ) {
+                                                                                                    
+                                                                                                    if (ctx.action == Gdk.DragAction.ASK)  {
+                                                                                                        /* Ask the user to move or copy, then set the ctx action. */
+                                                                                                    }
+                                                                                        
+                                                                                                    if (ctx.action == Gdk.DragAction.MOVE) {
+                                                                                                        delete_selection_data = true;
+                                                                                                    }
+                                                                                                    var source = Gtk.drag_get_source_widget(ctx);
+                                                                                        
+                                                                                                    print("Browser: source.DRAGDATA? " + source.dragData);
+                                                                                                    if (this.targetData) {
+                                                                                                        print(this.targetData);
+                                                                                                        this.get('/LeftTree.model').dropNode(this.targetData,  source.dragData);
+                                                                                                    }
+                                                                                                    
+                                                                                                    
+                                                                                                    
+                                                                                                    dnd_success = true;
+                                                                                        
+                                                                                                }
+                                                                                        
+                                                                                                if (dnd_success == false)
+                                                                                                {
+                                                                                                        Seed.print ("DnD data transfer failed!\n");
+                                                                                                }
+                                                                                                
+                                                                                                Gtk.drag_finish (ctx, dnd_success, delete_selection_data, time);
+                                                                                                return true;
+                                                                                            },
+                                                                                        create_web_view : function (self, object) {
+                                                                                          print("CREATE WEB VIEW");
+                                                                                           return null; //new WebKit.WebView();
+                                                                                        }
+                                                                                    },
+                                                                                    id : "view",
+                                                                                    pack : "add",
+                                                                                    redraws : 0,
+                                                                                    init : function() {
+                                                                                        XObject.prototype.init.call(this);
+                                                                                        // this may not work!?
+                                                                                        var settings =  this.el.get_settings();
+                                                                                        settings.enable_developer_extras = true;
+                                                                                        
+                                                                                        // this was an attempt to change the url perms.. did not work..
+                                                                                        // settings.enable_file_access_from_file_uris = true;
+                                                                                        // settings.enable_offline_web_application_cache - true;
+                                                                                        // settings.enable_universal_access_from_file_uris = true;
+                                                                                        var _this = this;
+                                                                                         
+                                                                                         // init inspector..
+                                                                                        this.el.get_inspector().signal.inspect_web_view.connect(function(wi, pg) {
+                                                                                             _this.get('/BottomPane.inspector').el.show();
+                                                                                             return _this.get('/BottomPane.inspector').el;
+                                                                                        
+                                                                                        });
+                                                                                         
+                                                                                         // FIXME - base url of script..
+                                                                                         // we need it so some of the database features work.
+                                                                                        this.el.load_html_string( "Render not ready" , 
+                                                                                                //fixme - should be a config option!
+                                                                                                // or should we catch stuff and fix it up..
+                                                                                                'http://localhost/app.Builder/'
+                                                                                        );
+                                                                                            
+                                                                                            
+                                                                                       //this.el.open('file:///' + __script_path__ + '/../builder.html');
+                                                                                                              
+                                                                                        this.el.drag_dest_set
+                                                                                        (          /* widget that will accept a drop */
+                                                                                                Gtk.DestDefaults.MOTION  | Gtk.DestDefaults.HIGHLIGHT,
+                                                                                                null,            /* lists of target to support */
+                                                                                                0,              /* size of list */
+                                                                                                Gdk.DragAction.COPY         /* what to do with data after dropped */
+                                                                                        );
+                                                                                                                
+                                                                                       // print("RB: TARGETS : " + LeftTree.atoms["STRING"]);
+                                                                                        this.el.drag_dest_set_target_list(  imports.Builder3.Globals.targetList);
+                                                                                        
+                                                                                        GLib.timeout_add_seconds(0, 1, function() {
+                                                                                            //    print("run refresh?");
+                                                                                             _this.runRefresh(); 
+                                                                                             return true;
+                                                                                         });
+                                                                                        
+                                                                                        
+                                                                                    },
+                                                                                    renderJS : function(data, force) {
+                                                                                    
+                                                                                        // this is the public redraw call..
+                                                                                        // we refresh in a loop privately..
+                                                                                        var autodraw = this.get('/RightBrowser.AutoRedraw').el.active;
+                                                                                        if (!autodraw && !force) {
+                                                                                            print("Skipping redraw - no force, and autodraw off");
+                                                                                            return;
+                                                                                        }
+                                                                                        this.refreshRequired  = true;
+                                                                                    },
+                                                                                    runRefresh : function() 
+                                                                                    {
+                                                                                        // this is run every 2 seconds from the init..
+                                                                                    
+                                                                                      
+                                                                                        
+                                                                                        if (!this.refreshRequired) {
+                                                                                            // print("no refresh required");
+                                                                                            return;
+                                                                                        }
+                                                                                    
+                                                                                        if (this.lastRedraw) {
+                                                                                           // do not redraw if last redraw was less that 5 seconds ago.
+                                                                                           if (((new Date()) -  this.lastRedraw) < 5000) {
+                                                                                                return;
+                                                                                            }
+                                                                                        }
+                                                                                        
+                                                                                        
+                                                                                        
+                                                                                        
+                                                                                         if (!this.get('/Window.LeftTree').getActiveFile()) {
+                                                                                            return;
+                                                                                         }
+                                                                                         this.refreshRequired = false;
+                                                                                       //  print("HTML RENDERING");
+                                                                                         
+                                                                                         this.get('/BottomPane').el.show();
+                                                                                         this.get('/BottomPane').el.set_current_page(2);// webkit inspector
+                                                                                    
+                                                                                                                                                                               // before
+                                                                                        
+                                                                                                                                                                               
+                                                                                                                                                                               
+                                                                                                                                                                               
+                                                                                        var js = this.get('/LeftTree.model').toJS();
+                                                                                        if (!js || !js.length) {
+                                                                                            print("no data");
+                                                                                            return;
+                                                                                        }
+                                                                                        var  data = js[0];
+                                                                                                                                                                                           
+                                                                                                                                                                               
+                                                                                        this.redraws++;
+                                                                                        
+                                                                                         var project = this.get('/Window.LeftTree').getActiveFile().project;
+                                                                                         //print (project.fn);
+                                                                                         // set it to non-empty.
+                                                                                         project.runhtml  =     project.runhtml  || '';
+                                                                                         project.runhtml  = project.runhtml.length ?  project.runhtml : '<script type="text/javascript"></script>'; 
+                                                                                        
+                                                                                    
+                                                                                         this.runhtml  = this.runhtml || '';
+                                                                                        
+                                                                                                                                                                               var file = this.get('/LeftTree.model').file;
+                                                                                                                                                                               var items = file.items;
+                                                                                        file.items = this.get('/LeftTree.model').toJS(false, false);
+                                                                                                                                                                               //file.items[0].background = false;
+                                                                                                                                                                               //var p = file.parent;
+                                                                                                                                                                               //file.parent = false;
+                                                                                                                                                                                
+                                                                                        var js_src = file.toSourcePreview();
+                                                                                                                                                                               if (this.renderedData && js_src == this.renderedData && project.runhtml == this.runhtml) {
+                                                                                                                                                                                       // unless it' sforced..
+                                                                                                                                                                                       
+                                                                                                                                                                                       return;
+                                                                                                                                                                               }
+                                                                                                                                                                               
+                                                                                                                                                                               this.renderedData = js_src;
+                                                                                                                                                                               // restore stuff..
+                                                                                                                                                                               //file.parent = p;
+                                                                                                                                                                               //file.items = items;
+                                                                                                                                                                               //print("send source as " + js_src);
+                                                                                                                                                                               
+                                                                                                                                                                               js_src += "\n" +
+                                                                                                                                                                                               "Roo.onReady(function() {\n" +
+                                                                                                                                                                                               "if (" + file.name +".show) " +  file.name +".show({});\n" +
+                                                                                                                                                                                               "Roo.XComponent.build();\n" +
+                                                                                                
+                                                                                                                                                                                               "});\n";
+                                                                                                                                                                                               
+                                                                                                                                                                               
+                                                                                                                                                                               
+                                                                                                                                                                               
+                                                                                                                                                                               
+                                                                                         //if ((project.runhtml != this.runhtml) || (this.redraws > 10)) {
+                                                                                            // then we need to reload the browser using
+                                                                                            // load_html_string..
+                                                                                            
+                                                                                            // then trigger a redraw once it's loaded..
+                                                                                            this.pendingRedraw = true;
+                                                                                            var runhtml = '<script type="text/javascript">' + "\n" ;
+                                                                                            runhtml +=imports.File.File.read(__script_path__ + '/../builder.html.js') + "\n";
+                                                                                            runhtml += '</script>'+ "\n" ;
+                                                                                            
+                                                                                            this.runhtml = project.runhtml;
+                                                                                            // need to modify paths
+                                                                                            
+                                                                                            
+                                                                                            this.lastRedraw= new Date();
+                                                                                            var html = imports.File.File.read(__script_path__ + '/../builder.html');
+                                                                                            html = html.replace('</head>',
+                                                                                                                                                                                                               runhtml +
+                                                                                                                                                                                                               this.runhtml +
+                                                                                                                                                                                                               '<script type="text/javascript">' + "\n" +
+                                                                                                                                                                                                               js_src + "\n" + 
+                                                                                                                                                                                                               '</script>' + 
+                                                                                                                                                                                                               
+                                                                                                                                                                                                               '</head>');
+                                                                                            //print("LOAD HTML " + html);
+                                                                                            this.el.load_html_string( html , 
+                                                                                                //fixme - should be a config option!
+                                                                                                'http://localhost/app.Builder/'
+                                                                                            );
+                                                                                            this.redraws = 0;
+                                                                                            // should trigger load_finished! - which in truns shoudl set refresh Required;
+                                                                                            return;
+                                                                                        
+                                                                                        
+                                                                                                                                                                               // not used.
+                                                                                        //this.renderedData = data;
+                                                                                        //var str = JSON.stringify(data) ;
+                                                                                        
+                                                                                        if (!this.ready) {
+                                                                                            console.log('not loaded yet');
+                                                                                        }
+                                                                                        this.lastRedraw = new Date();
+                                                                                        
+                                                                                        this.el.execute_script("Builder.render(" +
+                                                                                                                                                                                                               JSON.stringify(js_src) +
+                                                                                                                                                                                                               "," +
+                                                                                                                                                                                                               JSON.stringify(file.name) + 
+                                                                                                                                                                                                               ");");
+                                                                                                                                                                               
+                                                                                        print( "before render" +    this.lastRedraw);
+                                                                                        print( "after render" +    (new Date()));
+                                                                                        
+                                                                                    }
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                },
+                                                                {
+                                                                    xtype: Gtk.VBox,
+                                                                    id : "RightGtkView",
+                                                                    pack : "add",
+                                                                    redraw : function() {
+                                                                       this.highlightWidget = false;
+                                                                        print("REDRAW CALLED");
+                                                                        this.activePath = this.get('/LeftTree').getActivePath();
+                                                                        if (this.renderedEl) {
+                                                                          print("QUEUE DRAW CALLING");
+                                                                          this.renderedEl.queue_draw();
+                                                                       }
+                                                                    },
+                                                                    renderJS : function(data, withDebug)
+                                                                    {
+                                                                          this.highlightWidget = false;
+                                                                       
+                                                                        this.withDebug = false;
+                                                                        while (this.get('view').el.get_children().length) {
+                                                                            var c = this.get('view').el.get_children()[0];
+                                                                            this.get('view').el.remove(c);        
+                                                                            c.destroy();
+                                                                        }
+                                                                         if (!data) {
+                                                                             return; 
+                                                                        }
+                                                                        
+                                                                        var tree =  this.get('/LeftTree.model').toJS(false,true)[0];
+                                                                        // in theory tree is actually window..  
+                                                                       try {
+                                                                      
+                                                                            this.renderedEl = this.viewAdd(tree.items[0], this.get('view').el);
+                                                                          
+                                                                      } catch (e) {
+                                                                         print(e.message);
+                                                                        return;
+                                                                      }
+                                                                        this.get('view').el.set_size_request(
+                                                                            tree.default_width * 1 || 400, tree.default_height * 1 || 400
+                                                                        ) ;
+                                                                        if (this.renderedEl) {
+                                                                            this.renderedEl.set_size_request(
+                                                                                tree.default_width || 600,
+                                                                                tree.default_height || 400
+                                                                            );
+                                                                        }
+                                                                        this.get('view').el.show_all();
+                                                                        
+                                                                        
+                                                                        
+                                                                    },
+                                                                    showInWindow : function() {
+                                                                      print("GET PROEJCT");
+                                                                       var pr = this.get('/LeftProjectTree').getActiveProject();
+                                                                      
+                                                                       console.log(pr.paths);
+                                                                        return;
+                                                                    /*
+                                                                         var src= this.buildJS(
+                                                                               this.get('/LeftTree.model').toJS()[0], 
+                                                                               true);
+                                                                          // show term?? 
+                                                                    
+                                                                    
+                                                                        //var x = new imports.sandbox.Context();
+                                                                        //x.add_globals();
+                                                                        //print(src);
+                                                                        try {
+                                                                            Seed.check_syntax('var e = ' + src);
+                                                                            //x.eval(src);
+                                                                        } catch( e) {
+                                                                            this.get('/Terminal').feed(e.message || e.toString() + "\n");
+                                                                            this.get('/Terminal').feed(console._dump(e)+"\n");
+                                                                            if (e.line) {
+                                                                                var lines = src.split("\n");
+                                                                                var start = Math.max(0, e.line - 10);
+                                                                                var end = Math.min(lines.length, e.line + 10);
+                                                                                for (var i =start ; i < end; i++) {
+                                                                                    if (i == e.line) {
+                                                                                        this.get('/Terminal').feed(">>>>>" + lines[i] + "\n");
+                                                                                        continue;
+                                                                                    }
+                                                                                    this.get('/Terminal').feed(lines[i] + "\n");
+                                                                                }
+                                                                                
+                                                                            }
+                                                                            
+                                                                            return;
+                                                                        }
+                                                                         this.get('/BottomPane').el.set_current_page(1);
+                                                                        this.get('/Terminal').el.fork_command( null , [], [], "/tmp", false,false,false); 
+                                                                        var cmd = "/usr/bin/seed /tmp/BuilderGtkView.js\n";
+                                                                        this.get('/Terminal').el.feed_child(cmd, cmd.length);
+                                                                         /*
+                                                                        var _top = x.get_global_object()._top;
+                                                                        
+                                                                        _top.el.set_screen(Gdk.Screen.get_default()); // just in case..
+                                                                        _top.el.show_all();
+                                                                        if (_top.el.popup) {
+                                                                            _top.el.popup(null, null, null, null, 3, null);
+                                                                        }
+                                                                    */
+                                                                    },
+                                                                    viewAdd : function(item, par)
+                                                                    {
+                                                                    
+                                                                        // does something similar to xobject..
+                                                                        //item.pack = (typeof(item.pack) == 'undefined') ?  'add' : item.pack;
+                                                                        
+                                                                        // pack is forced to 'false'
+                                                                        if (item.pack===false || item.pack === 'false') {  // no ;
+                                                                            return;
+                                                                        }
+                                                                        
+                                                                        print("CREATE: " + item['|xns'] + '.' + item['xtype']);
+                                                                        
+                                                                        
+                                                                        var type = item['|xns'] + '.' + item['xtype'];
+                                                                        
+                                                                        if (item['|xns'] == 'GtkClutter') { // we can not add this yet!
+                                                                            return false;
+                                                                        }
+                                                                        
+                                                                        var ns = imports.gi[item['|xns']];
+                                                                        var ctr = ns[item['xtype']]; // why are we using array here..?
+                                                                        
+                                                                    
+                                                                        
+                                                                        var ctr_args = { };
+                                                                        for(var k in item) {
+                                                                            var kv = item[k];
+                                                                            if (typeof(kv) == 'object' || typeof(kv) == 'function') {
+                                                                                continue;
+                                                                            }
+                                                                            if ( 
+                                                                                k == 'pack' ||
+                                                                                k == 'items' ||
+                                                                                k == 'id' ||
+                                                                                k == 'xtype' ||
+                                                                                k == 'xdebug' ||
+                                                                                k == 'xns' ||
+                                                                                k == '|xns'
+                                                                            ) {
+                                                                                continue;
+                                                                            }
+                                                                            // value is a function..
+                                                                       if (k[0] == '|' && typeof(kv) == 'string') {
+                                                                    
+                                                                               if (kv.match(new RegExp('function'))) {
+                                                                                       continue;
+                                                                                    }
+                                                                               print("WASL " + k + '=' + kv);
+                                                                               try {
+                                                                                       eval( 'kv = ' + kv);
+                                                                               } catch(e) {    continue; }
+                                                                                    
+                                                                               k = k.substring(1);
+                                                                                 // print(k + '=' + kv);
+                                                                       }
+                                                                            if (k[0] == '|') { // should be boolean or number..
+                                                                               k = k.substring(1);
+                                                                               //print(k + '=' + kv);
+                                                                            }
+                                                                             
+                                                                       if (k == 'show_tabs') { // force tab showing for notebooks.
+                                                                               kv = true;
+                                                                            }
+                                                                            print(k + '=' + typeof(kv) + " : " + kv);
+                                                                            ctr_args[k] = kv;
+                                                                            
+                                                                        } 
+                                                                        var altctr =  XObject.baseXObject({ xtype:  ctr} );
+                                                                        var pack_m  = false;
+                                                                        if (!item.pack && altctr) {
+                                                                            // try XObject.
+                                                                            print("SETTING PACK TO XObjectBase method");
+                                                                            pack_m = altctr.prototype.pack;
+                                                                            
+                                                                            
+                                                                        }
+                                                                        
+                                                                        var el = new ctr(ctr_args);
+                                                                        item.el = el;
+                                                                        print("PACK" + item.pack);
+                                                                        //console.dump(item.pack);
+                                                                        
+                                                                        
+                                                                        
+                                                                        
+                                                                        var args = [];
+                                                                        if (!pack_m) {
+                                                                            item.pack = (typeof(item.pack) == 'undefined') ?  'add' : item.pack;
+                                                                            if (typeof(item.pack) == 'string') {
+                                                                                 
+                                                                                item.pack.split(',').forEach(function(e, i) {
+                                                                                    
+                                                                                    if (e == 'false') { args.push( false); return; }
+                                                                                    if (e == 'true') {  args.push( true);  return; }
+                                                                                    if (!isNaN(parseInt(e))) { args.push( parseInt(e)); return; }
+                                                                                    args.push(e);
+                                                                                });
+                                                                                //print(args.join(","));
+                                                                                
+                                                                                pack_m = args.shift();
+                                                                            } else {
+                                                                                pack_m = item.pack.shift();
+                                                                                args = item.pack;
+                                                                            }
+                                                                        }
+                                                                        // handle error.
+                                                                        if (typeof(pack_m) == 'string' && typeof(par[pack_m]) == 'undefined') {
+                                                                            throw {
+                                                                                    name: "ArgumentError", 
+                                                                                    message : 'pack method not available : ' + par.id + " : " + par + '.' +  pack_m +
+                                                                                            "ADDING : " + item.id + " " +  el
+                                                                                        
+                                                                           };
+                                                                    
+                                                                            return;
+                                                                        }
+                                                                        
+                                                                        //console.dump(args);
+                                                                        args.unshift(el);
+                                                                        //if (XObject.debug) print(pack_m + '[' + args.join(',') +']');
+                                                                        //Seed.print('args: ' + args.length);
+                                                                        if (typeof(pack_m) == 'string') {
+                                                                            par[pack_m].apply(par, args);
+                                                                        } else if (pack_m) {
+                                                                            pack_m.call(item, par, item);
+                                                                        }
+                                                                        
+                                                                        var _this = this;
+                                                                        item.items = item.items || [];
+                                                                        item.items.forEach(function(ch,n) {
+                                                                    
+                                                                             print ("type:" + type);
+                                                                              
+                                                                             print ("ch.pack:" + ch.pack);
+                                                                               
+                                                                               
+                                                                             if (type == 'Gtk.Table' && ch.pack == 'add') {
+                                                                                var c = n % item.n_columns;
+                                                                                var r = Math.floor(n/item.n_columns);
+                                                                                ch.pack = [ 'attach', c, c+1, r, r+1, 
+                                                                                         typeof(ch.x_options) == 'undefined' ?  5 : ch.x_options,
+                                                                                            typeof(ch.y_options) == 'undefined' ?  5 : ch.y_options,
+                                                                                            typeof(ch.x_padding) == 'undefined' ?  0 : ch.x_padding,
+                                                                                            typeof(ch.x_padding) == 'undefined' ?  0 : ch.x_padding
+                                                                                ].join(',');
+                                                                            }
+                                                                        
+                                                                            _this.viewAdd(ch, el);
+                                                                        });
+                                                                        
+                                                                        
+                                                                        
+                                                                        // add the signal handlers.
+                                                                        // is it a widget!?!!?
+                                                                       
+                                                                        
+                                                                        try {
+                                                                             
+                                                                            
+                                                                            el.signal.expose_event.connect(XObject.createDelegate(this.widgetExposeEvent, this, [ item  ], true));
+                                                                            el.signal.drag_motion.connect(XObject.createDelegate(this.widgetDragMotionEvent, this,[ item  ], true));
+                                                                            el.signal.drag_drop.connect(XObject.createDelegate(this.widgetDragDropEvent, this, [ item  ], true));
+                                                                            el.signal.button_press_event.connect(XObject.createDelegate(this.widgetPressEvent, this, [ item  ], true ));
+                                                                            el.signal.button_release_event.connect(XObject.createDelegate(this.widgetReleaseEvent, this, [ item  ], true ));
+                                                                        } catch(e) {
+                                                                            // ignore!
+                                                                           }
+                                                                        
+                                                                        
+                                                                        
+                                                                        return el;
+                                                                        
+                                                                    },
+                                                                    widgetDragDropEvent : function() {
+                                                                          print("WIDGET DRAGDROP"); 
+                                                                                return true;
+                                                                    },
+                                                                    widgetDragMotionEvent : function() {
+                                                                         print("WIDGET DRAGMOTION"); 
+                                                                                return true;
+                                                                    },
+                                                                    widgetExposeEvent : function(w, evt, ud, item) {
+                                                                        var widget = w;
+                                                                         if (this.inRender) {
+                                                                             return false;
+                                                                         }
+                                                                         
+                                                                         if ( this.highlightWidget) {
+                                                                              this.inRender = true;
+                                                                              if (item.xtreepath.substring(0, this.activePath.length) == this.activePath) {
+                                                                                     Gdk.draw_rectangle(this.highlightWidget.window, this.gc, false, this.box.x , this.box.y, this.box.w, this.box.h);
+                                                                                }
+                                                                               this.inRender = false;
+                                                                               return false;
+                                                                         }
+                                                                         
+                                                                         
+                                                                         if (this.activePath != item.xtreepath) {
+                                                                            return false;
+                                                                         }
+                                                                         
+                                                                       //  print("HIGHLIGHT: " + item.xtreepath ); // draw highlight??
+                                                                         // work out the coords of the window..
+                                                                         if (!this.gc) {
+                                                                          var dr = widget.window;
+                                                                          this.gc = (new Gdk.GC.c_new(dr));
+                                                                          this.gc.set_rgb_fg_color(new Gdk.Color({ red: 0xFFFF, green: 0, blue : 0 }));
+                                                                          this.gc.set_line_attributes(4,  Gdk.LineStyle.SOLID, Gdk.CapStyle.ROUND , Gdk.JoinStyle.ROUND);
+                                                                        }
+                                                                    
+                                                                        
+                                                                         var r  = evt.expose.area;
+                                                                         // console.dump([r.x, r.y, r.width, r.height ] );
+                                                                         //return false;
+                                                                    //     print(widget.get_parent().toString().match(/GtkScrolledWindow/);
+                                                                         if (widget.get_parent().toString().match(/GtkScrolledWindow/)) { // eak
+                                                                             // happens with gtkscrollview embedded stuff..
+                                                                             var np =this.activePath.split(':');
+                                                                             np.pop();
+                                                                             this.activePath = np.join(':');
+                                                                             this.renderedEl.queue_draw();
+                                                                             return true;
+                                                                    
+                                                                            
+                                                                         }
+                                                                    
+                                                                           
+                                                                         
+                                                                         
+                                                                          this.box = {
+                                                                            x : r.x - 2,
+                                                                            y : r.y - 2,
+                                                                            w: r.width + 4,
+                                                                            h: r.height + 4
+                                                                          }; 
+                                                                          // let's draw it..
+                                                                          this.inRender = true;
+                                                                    
+                                                                          
+                                                                          this.highlightWidget = widget;
+                                                                        
+                                                                        
+                                                                     
+                                                                    
+                                                                        //  print("DRAW BOX");
+                                                                           //console.dump(this.box);
+                                                                          Gdk.draw_rectangle(widget.window, this.gc, false, this.box.x , this.box.y, this.box.w,this.box.h);
+                                                                                this.inRender = false;
+                                                                                return false;
+                                                                    },
+                                                                    widgetPressEvent : function(w,e,u,d) {
+                                                                         if (this.get('view').pressed) {
+                                                                            return false;
+                                                                         }
+                                                                    this.get('view').pressed = true;
+                                                                          print("WIDGET PRESS " + d.xtreepath );       
+                                                                              this.get('/LeftTree.view').selectNode(   d.xtreepath );        
+                                                                                return false;
+                                                                    },
+                                                                    widgetReleaseEvent : function() {
+                                                                        this.get('view').pressed = false;
+                                                                       return false;
+                                                                    },
+                                                                    items : [
+                                                                        {
+                                                                            xtype: Gtk.HBox,
+                                                                            pack : "pack_start,false,true,0",
+                                                                            items : [
+                                                                                {
+                                                                                    xtype: Gtk.Button,
+                                                                                    pack : "pack_start,false,false,0",
+                                                                                    label : "Run The Application",
+                                                                                    listeners : {
+                                                                                        button_press_event : function (self, event) {
+                                                                                            // call render on left tree - with special option!?!
+                                                                                         
+                                                                                            //print("GET PROEJCT");
+                                                                                            var pr = this.get('/LeftProjectTree').getActiveProject();
+                                                                                          
+                                                                                            var dir = '';
+                                                                                            for (var i in pr.paths) { 
+                                                                                                dir = i;
+                                                                                                break;
+                                                                                            }
+                                                                                            var runner = GLib.path_get_dirname (__script_path__) + '/gtkrun.js'; 
+                                                                                            this.get('/Terminal').feed("RUN DIR:" + dir);
+                                                                                            var out = {};
+                                                                                             
+                                                                                           this.get('/Terminal').el.fork_command_full(
+                                                                                                Vte.PtyFlags.DEFAULT,
+                                                                                                GLib.path_get_dirname (__script_path__) ,
+                                                                                                [ 'echo' , "hello"], //argv
+                                                                                                [], // env
+                                                                                                0, //spawn flags
+                                                                                                null, // user func
+                                                                                                null, // child setupdata
+                                                                                                out
+                                                                                        ); 
+                                                                                           
+                                                                                            var cmd = "/usr/bin/seed " + runner + " " + dir + "\n";
+                                                                                            this.get('/Terminal').el.feed_child(cmd, cmd.length);
+                                                                                            return false;
+                                                                                          
+                                                                                        
+                                                                                        }
+                                                                                    }
+                                                                                }
+                                                                            ]
+                                                                        },
+                                                                        {
+                                                                            xtype: Gtk.ScrolledWindow,
+                                                                            pack : "add",
+                                                                            id : "view-sw",
+                                                                            shadow_type : Gtk.ShadowType.IN,
+                                                                            init : function() {
+                                                                                XObject.prototype.init.call(this);
+                                                                             this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+                                                                            },
+                                                                            items : [
+                                                                                {
+                                                                                    xtype: Gtk.EventBox,
+                                                                                    pack : "add_with_viewport",
+                                                                                    init : function() {
+                                                                                        XObject.prototype.init.call(this);
+                                                                                    this.el.modify_bg(Gtk.StateType.NORMAL, new Gdk.Color({
+                                                                                                red: 0x9F00, green: 0xB800 , blue : 0xA800
+                                                                                               }));
+                                                                                    },
+                                                                                    items : [
+                                                                                        {
+                                                                                            xtype: Gtk.Fixed,
+                                                                                            pack : "add",
+                                                                                            init : function() {
+                                                                                               XObject.prototype.init.call(this);
+                                                                                               //this.el.set_hadjustment(this.parent.el.get_hadjustment());
+                                                                                               //this.el.set_vadjustment(this.parent.el.get_vadjustment());
+                                                                                             
+                                                                                            },
+                                                                                            items : [
+                                                                                                {
+                                                                                                    xtype: Gtk.EventBox,
+                                                                                                    pack : "put,10,10",
+                                                                                                    init : function() {
+                                                                                                       //this.el =     new Gtk.Image.from_stock (Gtk.STOCK_HOME,  Gtk.IconSize.MENU);
+                                                                                                       XObject.prototype.init.call(this);
+                                                                                                    
+                                                                                                                 this.el.drag_dest_set
+                                                                                                                (               /* widget that will accept a drop */
+                                                                                                                        Gtk.DestDefaults.MOTION  | Gtk.DestDefaults.HIGHLIGHT,
+                                                                                                                        null,            /* lists of target to support */
+                                                                                                                        0,              /* size of list */
+                                                                                                                        Gdk.DragAction.COPY         /* what to do with data after dropped */
+                                                                                                                );
+                                                                                                                
+                                                                                                               // print("RB: TARGETS : " + LeftTree.atoms["STRING"]);
+                                                                                                                this.el.drag_dest_set_target_list( imports.Builder3.Globals.targetList);
+                                                                                                    },
+                                                                                                    ready : false,
+                                                                                                    getActiveNode : function(x,y)
+                                                                                                    {
+                                                                                                       // workout what node is here..
+                                                                                                        return '0'; // top..
+                                                                                                    },
+                                                                                                    id : "view",
+                                                                                                    listeners : {
+                                                                                                        drag_motion : function (self, ctx, x, y, time) {
+                                                                                                            
+                                                                                                                        // A) find out from drag all the places that node could be dropped.
+                                                                                                                        var src = Gtk.drag_get_source_widget(ctx);
+                                                                                                                        if (!src.dropList) {
+                                                                                                                            Gdk.drag_status(ctx, 0, time);
+                                                                                                                            return true;
+                                                                                                                        }
+                                                                                                                        // b) get what we are over.. (from activeNode)
+                                                                                                                        // tree is empty.. - list should be correct..
+                                                                                                                        if (!this.get('/LeftTree.model').currentTree) {
+                                                                                                                            Gdk.drag_status(ctx, Gdk.DragAction.COPY,time);
+                                                                                                                            return true;
+                                                                                                                            
+                                                                                                                        }
+                                                                                                                        // c) ask tree where it should be dropped... - eg. parent.. (after node ontop)
+                                                                                                                        var activeNode = this.getActiveNode(x, y);
+                                                                                                                        
+                                                                                                                        
+                                                                                                                        var tg = this.get('/LeftTree.model').findDropNode(activeNode, src.dropList);
+                                                                                                                        console.dump(tg);
+                                                                                                                        if (!tg.length) {
+                                                                                                                            Gdk.drag_status(ctx, 0,time);
+                                                                                                                            this.get('/LeftTree.view').highlight(false);
+                                                                                                                            return true;
+                                                                                                                        }
+                                                                                                                         
+                                                                                                                        // if we have a target..
+                                                                                                                        // -> highlight it! (in browser)
+                                                                                                                        // -> highlight it! (in tree)
+                                                                                                                        
+                                                                                                                        Gdk.drag_status(ctx, Gdk.DragAction.COPY,time);
+                                                                                                                        this.get('/LeftTree.view').highlight(tg);
+                                                                                                                        this.targetData = tg;
+                                                                                                                        // for tree we should handle this...
+                                                                                                                        return true;
+                                                                                                        },
+                                                                                                        drag_drop : function (self,ctx, x, y, time) {
+                                                                                                               Seed.print("TARGET: drag-drop");
+                                                                                                                var is_valid_drop_site = true;
+                                                                                                                
+                                                                                                                 
+                                                                                                                self.drag_get_data
+                                                                                                                (  /* will receive 'drag-data-received' signal */
+                                                                                                                        ctx,        /* represents the current state of the this.gDnD */
+                                                                                                                        imports.Builder3.Globals.atoms["STRING"],    /* the target type we want */
+                                                                                                                        time            /* time stamp */
+                                                                                                                );
+                                                                                                                
+                                                                                                                
+                                                                                                                /* No target offered by source => error */
+                                                                                                               
+                                                                                                        
+                                                                                                                return  is_valid_drop_site;
+                                                                                                          
+                                                                                                        },
+                                                                                                        drag_data_received : function (w, ctx,  x,  y, sel_data,  target_type,  time, ud) 
+                                                                                                            {
+                                                                                                                Seed.print("GtkView: drag-data-received");
+                                                                                                                var delete_selection_data = false;
+                                                                                                                var dnd_success = false;
+                                                                                                                /* Deal with what we are given from source */
+                                                                                                                if( sel_data && sel_data.length ) {
+                                                                                                                    
+                                                                                                                    if (ctx.action == Gdk.DragAction.ASK)  {
+                                                                                                                        /* Ask the user to move or copy, then set the ctx action. */
+                                                                                                                    }
+                                                                                                        
+                                                                                                                    if (ctx.action == Gdk.DragAction.MOVE) {
+                                                                                                                        delete_selection_data = true;
+                                                                                                                    }
+                                                                                                                    var source = Gtk.drag_get_source_widget( ctx );
+                                                                                                        
+                                                                                                                    Seed.print("Browser: source.DRAGDATA? " + source.dragData);
+                                                                                                                    if (this.targetData) {
+                                                                                                                        Seed.print(this.targetData);
+                                                                                                                        this.get('/LeftTree.model').dropNode(this.targetData,  source.dragData);
+                                                                                                                    }
+                                                                                                                    
+                                                                                                                    
+                                                                                                                    
+                                                                                                                    dnd_success = true;
+                                                                                                        
+                                                                                                                }
+                                                                                                        
+                                                                                                                if (dnd_success == false)
+                                                                                                                {
+                                                                                                                        Seed.print ("DnD data transfer failed!\n");
+                                                                                                                }
+                                                                                                                
+                                                                                                                Gtk.drag_finish (  ctx, dnd_success, delete_selection_data, time);
+                                                                                                                return true;
+                                                                                                            },
+                                                                                                        button_press_event : function (self, event) {
+                                                                                                          this.pressed = false;
+                                                                                                            return false;
+                                                                                                        }
+                                                                                                    }
+                                                                                                }
+                                                                                            ]
+                                                                                        }
+                                                                                    ]
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            xtype: Gtk.ScrolledWindow,
+                                                            id : "Help",
+                                                            pack : "add",
+                                                            show : function() {
+                                                                
+                                                                var file = this.get('/LeftTree').getActiveFile();
+                                                                if (!file) {
+                                                                    return;
+                                                                }
+                                                                var activeEl = this.get('/LeftTree').getActiveElement();
+                                                                var xtype = file.guessName( activeEl )
+                                                                if (!xtype || !xtype.length) {
+                                                                    return;
+                                                                }
+                                                                //this.get('/Window.view-help-nb').el.set_current_page(1);
+                                                                
+                                                                // get the active element being edited.
+                                                                var helpurl = file.getHelpUrl(xtype);       
+                                                                
+                                                                // now load the help info in the page..
+                                                                this.get('help-view').el.open(helpurl);
+                                                            },
+                                                            items : [
+                                                                {
+                                                                    xtype: WebKit.WebView,
+                                                                    pack : "add",
+                                                                    id : "help-view",
+                                                                    init : function() {
+                                                                        XObject.prototype.init.call(this);
+                                                                       this.get('/Window.help-view').el.open(
+                                                                         "http://devel.akbkhome.com/seed/");
+                                                                    
+                                                                    },
+                                                                    zoom_level : 0.8
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            xtype: Gtk.Notebook,
+                                            id : "BottomPane",
+                                            pack : "add",
+                                            init : function() {
+                                                XObject.prototype.init.call(this);
+                                               //this.el.set_tab_label(this.items[0].el, new Gtk.Label({ label : "Code Editor" }));
+                                                       this.el.set_tab_label(this.items[0].el, new Gtk.Label({ label : "Console" }));
+                                                       this.el.set_tab_label(this.items[1].el, new Gtk.Label({ label : "Inspector" }));
+                                            },
+                                            items : [
+                                                {
+                                                    xtype: Gtk.ScrolledWindow,
+                                                    pack : "add",
+                                                    items : [
+                                                        {
+                                                            xtype: Vte.Terminal,
+                                                            pack : "add",
+                                                            id : "Terminal",
+                                                            feed : function(istr) {
+                                                                var str = istr.replace(/\n/g, "\r\n") + "\r\n";
+                                                                // we should make ourselves visable!!!
+                                                                this.get('/BottomPane').el.show();
+                                                                this.get('/BottomPane').el.set_current_page(1);
+                                                            
+                                                                this.el.feed(str ,str.length);
+                                                            },
+                                                            scroll_on_output : true,
+                                                            init : function() {
+                                                                XObject.prototype.init.call(this);
+                                                                this.el.set_size (80, 1000);
+                                                            },
+                                                            scrollback_lines : 1000
+                                                        }
+                                                    ]
+                                                },
+                                                {
+                                                    xtype: Gtk.ScrolledWindow,
+                                                    pack : "add",
+                                                    items : [
+                                                        {
+                                                            xtype: WebKit.WebView,
+                                                            id : "inspector",
+                                                            pack : "add"
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                },
+                                {
+                                    xtype: Gtk.VBox,
+                                    pack : "add",
+                                    id : "RightPalete",
+                                    hide : function() {
+                                        
+                                          this.get('buttonbar').el.show();
+                                           this.get('viewbox').el.hide();
+                                           var ce = this.get('/Window.centereast').el;
+                                           
+                                           ce.set_position(ce.get_allocated_width() - 30);
+                                             
+                                           print("TRIED TO HIDE");
+                                    },
+                                    show : function() {
+                                        this.get('buttonbar').el.hide();
+                                        this.get('viewbox').el.show();
+                                        var ce = this.get('/Window.centereast').el;
+                                        //print(JSON.stringify(XObject.keys(ce) ,null,4));
+                                        ce.set_position(ce.get_allocated_width() - 150);
+                                           
+                                       // this.get('model').expanded();
+                                                
+                                    },
+                                    provider : false,
+                                    items : [
+                                        {
+                                            xtype: Gtk.VBox,
+                                            pack : "add",
+                                            id : "buttonbar",
+                                            items : [
+                                                {
+                                                    xtype: Gtk.Button,
+                                                    pack : "pack_start,false,true",
+                                                    listeners : {
+                                                        clicked : function (self) {
+                                                               this.get('/RightPalete').show();
+                                                        }
+                                                    },
+                                                    items : [
+                                                        {
+                                                            xtype: Gtk.Image,
+                                                            pack : "add",
+                                                            stock : Gtk.STOCK_GOTO_FIRST,
+                                                            icon_size : Gtk.IconSize.MENU
+                                                        }
+                                                    ]
+                                                },
+                                                {
+                                                    xtype: Gtk.Label,
+                                                    pack : "add",
+                                                    label : "Palete",
+                                                    angle : 270,
+                                                    init : function() {
+                                                        XObject.prototype.init.call(this);
+                                                        this.el.add_events ( Gdk.EventMask.BUTTON_MOTION_MASK );
+                                                    },
+                                                    listeners : {
+                                                        enter_notify_event : function (self, event) {
+                                                            this.get('/RightPalete').show();
+                                                            return false;
+                                                        }
+                                                    }
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            xtype: Gtk.VBox,
+                                            pack : "add",
+                                            id : "viewbox",
+                                            items : [
+                                                {
+                                                    xtype: Gtk.HBox,
+                                                    pack : "pack_start,false,true",
+                                                    items : [
+                                                        {
+                                                            xtype: Gtk.Label,
+                                                            pack : "add",
+                                                            label : "Palete"
+                                                        },
+                                                        {
+                                                            xtype: Gtk.Button,
+                                                            pack : "pack_start,false,true",
+                                                            listeners : {
+                                                                clicked : function (self) {
+                                                                       this.get('/RightPalete').hide();
+                                                                }
+                                                            },
+                                                            items : [
+                                                                {
+                                                                    xtype: Gtk.Image,
+                                                                    pack : "add",
+                                                                    stock : Gtk.STOCK_GOTO_LAST,
+                                                                    icon_size : Gtk.IconSize.MENU
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                },
+                                                {
+                                                    xtype: Gtk.ScrolledWindow,
+                                                    pack : "add",
+                                                    init : function() {
+                                                        XObject.prototype.init.call(this);
+                                                       this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+                                                        this.el.set_size_request(-1,200);
+                                                    },
+                                                    shadow_type : Gtk.ShadowType.IN,
+                                                    items : [
+                                                        {
+                                                            xtype: Gtk.TreeView,
+                                                            listeners : {
+                                                                drag_begin : function (self, ctx) {
+                                                                    // we could fill this in now...
+                                                                        Seed.print('SOURCE: drag-begin');
+                                                                        
+                                                                        
+                                                                       
+                                                                       var  iret = {};
+                                                                        var s = this.selection;
+                                                                        s.get_selected(iret);
+                                                                        var path = this.get('/RightPalete.model').el.get_path(iret.iter);
+                                                                        
+                                                                        var pix = this.el.create_row_drag_icon ( path);
+                                                                            
+                                                                        print(pix);       
+                                                                        if (Gtk.drag_set_icon_surface) {
+                                                                                Gtk.drag_set_icon_surface( ctx,   pix  );
+                                                                        } else {
+                                                                            Gtk.drag_set_icon_pixmap (ctx,
+                                                                                pix.get_colormap(),   pix,   null, -10, -10);
+                                                                        }
+                                                                        
+                                                                        var value = ''+ this.get('/RightPalete.model').el.get_value(iret.iter, 0).value.get_string();
+                                                                        if (!this.get('/RightPalete').provider) {
+                                                                            return false;
+                                                                        }
+                                                                        this.el.dropList = this.get('/RightPalete').provider.getDropList(value);
+                                                                        this.el.dragData = value;
+                                                                        
+                                                                        
+                                                                        
+                                                                        
+                                                                        return true;
+                                                                },
+                                                                drag_data_get : function (self, drag_context, selection_data, info, time) {
+                                                                       //Seed.print('Palete: drag-data-get: ' + target_type);
+                                                                        if (this.el.dragData && this.el.dragData.length ) {
+                                                                            selection_data.set_text(this.el.dragData ,this.el.dragData.length);
+                                                                        }
+                                                                        
+                                                                        
+                                                                        //this.el.dragData = "TEST from source widget";
+                                                                        
+                                                                        
+                                                                },
+                                                                drag_end : function (self, drag_context) {
+                                                                       Seed.print('SOURCE: drag-end');
+                                                                       this.el.dragData = false;
+                                                                       this.el.dropList = false;
+                                                                       this.get('/LeftTree.view').highlight(false);
+                                                                       return true;
+                                                                },
+                                                                button_press_event : function (self, event) {
+                                                                
+                                                                       if (!this.get('/Editor').save()) {
+                                                                           // popup!! - click handled.. 
+                                                                           return true;
+                                                                        }
+                                                                    return false;
+                                                                }
+                                                            },
+                                                            pack : "add",
+                                                            enable_tree_lines : true,
+                                                            headers_visible : false,
+                                                            init : function() {
+                                                                XObject.prototype.init.call(this);
+                                                              this.el.set_size_request(150,-1);
+                                                                                      //  set_reorderable: [1]
+                                                                                              
+                                                                        var description = new Pango.FontDescription.c_new();
+                                                                description.set_size(8000);
+                                                                this.el.modify_font(description);
+                                                                
+                                                                this.selection = this.el.get_selection();
+                                                                this.selection.set_mode( Gtk.SelectionMode.SINGLE);
+                                                               // this.selection.signal['changed'].connect(function() {
+                                                                //    _view.listeners['cursor-changed'].apply(_view, [ _view, '']);
+                                                                //});
+                                                                // see: http://live.gnome.org/GnomeLove/DragNDropTutorial
+                                                                 
+                                                                this.el.drag_source_set (            /* widget will be drag-able */
+                                                                        Gdk.ModifierType.BUTTON1_MASK,       /* modifier that will start a drag */
+                                                                        null,            /* lists of target to support */
+                                                                        0,              /* size of list */
+                                                                        Gdk.DragAction.COPY         /* what to do with data after dropped */
+                                                                );
+                                                                //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);
+                                                               
+                                                                this.el.drag_source_set_target_list( imports.Builder3.Globals.targetList);
+                                                                this.el.drag_source_add_text_targets( ); 
+                                                                /*
+                                                                print("RP: TARGET:" + LeftTree.atoms["STRING"]);
+                                                                targets = new Gtk.TargetList();
+                                                                targets.add( LeftTree.atoms["STRING"], 0, 0);
+                                                                targets.add_text_targets( 1 );
+                                                                Gtk.drag_dest_set_target_list(this.el, LeftTree.targetList);
+                                                                
+                                                                //if you want to allow text to be output elsewhere..
+                                                                //Gtk.drag_source_add_text_targets(this.el);
+                                                                */
+                                                                return true; 
+                                                            },
+                                                            items : [
+                                                                {
+                                                                    xtype: Gtk.ListStore,
+                                                                    pack : "set_model",
+                                                                    init : function() {
+                                                                        XObject.prototype.init.call(this);
+                                                                    this.el.set_column_types ( 2, [
+                                                                                                GObject.TYPE_STRING, // title 
+                                                                                                GObject.TYPE_STRING // tip
+                                                                                                
+                                                                                                ] );
+                                                                    },
+                                                                    id : "model",
+                                                                    load : function(tr,iter)
+                                                                    {
+                                                                        if (!iter) {
+                                                                            this.el.clear();
+                                                                        }
+                                                                        //console.log('Project tree load: ' + tr.length);
+                                                                        var cret ={};
+                                                                        //this.insert(citer,iter,0);
+                                                                        for(var i =0 ; i < tr.length; i++) {
+                                                                            if (!iter) {
+                                                                                
+                                                                                this.el.append(cret);   
+                                                                            } else {
+                                                                                this.el.insert(cret,iter,-1);
+                                                                            }
+                                                                            
+                                                                            var r = tr[i];
+                                                                            //Seed.print(r);
+                                                                            this.el.set_value(cret.iter, 0,  '' +  r ); // title 
+                                                                            
+                                                                            //this.el.set_value(citer, 1,  new GObject.Value( r)); //id
+                                                                            //if (r.cn && r.cn.length) {
+                                                                            //    this.load(r.cn, citer);
+                                                                            //}
+                                                                        }
+                                                                        
+                                                                        
+                                                                    },
+                                                                    getValue : function (iter, col) {
+                                                                        return  this.el.get_value(iter, col).value.get_string();
+                                                                        
+                                                                        
+                                                                        
+                                                                    }
+                                                                },
+                                                                {
+                                                                    xtype: Gtk.TreeViewColumn,
+                                                                    pack : "append_column",
+                                                                    init : function() {
+                                                                        XObject.prototype.init.call(this);
+                                                                       this.el.add_attribute(this.items[0].el , 'markup', 0 );
+                                                                    },
+                                                                    items : [
+                                                                        {
+                                                                            xtype: Gtk.CellRendererText,
+                                                                            pack : "pack_start"
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+});
+Window.init();
+XObject.cache['/Window'] = Window;
diff --git a/old-javascript/Builder4/About.bjs b/old-javascript/Builder4/About.bjs
new file mode 100644 (file)
index 0000000..bbc8d21
--- /dev/null
@@ -0,0 +1,25 @@
+{
+    "name" : "About",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/About.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "items" : [
+        {
+            "listeners" : {
+                "delete_event" : "(self, event) => {\n    this.el.hide();\n    return true;\n\n}\n ",
+                "response" : "(rid) => {\n    this.el.hide();\n}\n"
+            },
+            "|    void show_all" : "() {\n    this.el.show_all();\n}\n ",
+            "copyright" : "LGPL",
+            "xtype" : "AboutDialog",
+            "program_name" : "app.Builder.js",
+            "$ modal" : true,
+            "$ authors" : "{ \"Alan Knowles\" }",
+            "$ xns" : "Gtk",
+            "website" : "http://www.akbkhome.com/blog.php",
+            "license" : "LGPL"
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/About.vala b/old-javascript/Builder4/About.vala
new file mode 100644 (file)
index 0000000..d6f49ed
--- /dev/null
@@ -0,0 +1,49 @@
+static About  _About;
+
+public class About : Object 
+{
+    public Gtk.AboutDialog el;
+    private About  _this;
+
+    public static About singleton()
+    {
+        if (_About == null) {
+            _About= new About();
+        }
+        return _About;
+    }
+
+        // my vars (def)
+
+    // ctor 
+    public About()
+    {
+        _this = this;
+        this.el = new Gtk.AboutDialog();
+
+        // my vars (dec)
+
+        // set gobject values
+        this.el.program_name = "app.Builder.js";
+        this.el.license = "LGPL";
+        this.el.authors = { "Alan Knowles" };
+        this.el.website = "http://www.akbkhome.com/blog.php";
+        this.el.modal = true;
+        this.el.copyright = "LGPL";
+
+        // listeners 
+        this.el.delete_event.connect( (self, event) => {
+            this.el.hide();
+            return true;
+        
+        });
+        this.el.response.connect( (rid) => {
+            this.el.hide();
+        });
+    }
+
+    // user defined functions 
+    public    void show_all () {
+        this.el.show_all();
+    }
+}
diff --git a/old-javascript/Builder4/Application.vala b/old-javascript/Builder4/Application.vala
new file mode 100644 (file)
index 0000000..61d2cc4
--- /dev/null
@@ -0,0 +1,187 @@
+
+
+namespace Builder4
+{
+
+       public class AppSettings : Object
+       {
+
+               // what are we going to have as settings?
+               public string roo_html_dir { get; set; }
+
+               public AppSettings()
+               {
+                       this.notify.connect(() => {
+                               this.save();
+                       });
+               }
+
+               public static AppSettings factory()
+               {
+                        
+                       var setting_file = Application.configDirectory() + "/builder.settings";
+                       
+                       if (!FileUtils.test(setting_file, FileTest.EXISTS)) {
+                                return new AppSettings();
+                       }
+                       string data; 
+                       FileUtils.get_contents(setting_file, out data);
+                       return Json.gobject_from_data (typeof (AppSettings), data) as AppSettings;
+               }
+               public void save()
+               {
+                       var dirname = GLib.Environment.get_home_dir() + "/.Builder";
+                       var setting_file = dirname + "/builder.settings";
+                       string data = Json.gobject_to_data (this, null);
+                       print("saving application settings\n");
+                       FileUtils.set_contents(setting_file,   data);
+               }
+
+               
+       }
+       
+       
+       public static Application application = null;
+       
+       public class Application : Gtk.Application
+       {
+               enum Target {
+                   INT32,
+                   STRING,
+                   ROOTWIN
+               }
+
+
+               public const Gtk.TargetEntry[] targetList = {
+                   { "INTEGER",    0, Target.INT32 },
+                   { "STRING",     0, Target.STRING },
+                   { "application/json",     0, Target.STRING },                       
+                   { "text/plain", 0, Target.STRING },
+                   { "application/x-rootwindow-drop", 0, Target.ROOTWIN }
+               };
+               public AppSettings settings = null;
+
+       
+               public Application ()
+               {
+                       Object(
+                              application_id: "org.roojs.app-builder",
+                               flags: ApplicationFlags.FLAGS_NONE
+                       );
+                                        
+                       configDirectory();
+                       this.settings = AppSettings.factory();  
+
+                       this.initResources(true); 
+               
+
+               }
+
+
+               
+               public static Application  singleton()
+               {
+                       if (application==null) {
+                               application = new Application();
+                       
+                       }
+                       return application;
+               }
+
+               
+               public static string configDirectory()
+               {
+                       var dirname = GLib.Environment.get_home_dir() + "/.Builder";
+               
+                       if (!FileUtils.test(dirname,FileTest.IS_DIR)) {
+                               var dir = File.new_for_path(dirname);
+                               dir.make_directory();    
+                       }
+                       if (!FileUtils.test(dirname + "/resources",FileTest.IS_DIR)) {
+                               var dir = File.new_for_path(dirname + "/resources");
+                               dir.make_directory();    
+                       }
+
+               
+                       return dirname;
+               }
+       
+
+               public void initResources(bool force = false)
+               {
+                       // files to fetch from resources.
+                       string[] res = { 
+                               "bootstrap.builder.html",
+                               "roo.builder.html",
+                               "roo.builder.js",
+                               "Gir.overides"
+                       };
+                       for (var i = 0; i < res.length; i++ ) { 
+                               this.fetchResource(res[i], force);
+                       }
+                       this.fetchResourceFrom (
+                               "http://git.roojs.org/?p=app.Builder.js;a=blob_plain;f=Palete/RooUsage.txt",
+                               "RooUsage.txt",
+                               force
+                        );
+                       this.fetchResourceFrom (
+                               "http://git.roojs.org/?p=app.Builder.js;a=blob_plain;f=Palete/GtkUsage.txt",
+                               "GtkUsage.txt",
+                               force
+                        );
+                       this.fetchResourceFrom (
+                               "http://git.roojs.org/?p=roojs1;a=blob_plain;f=docs/json/roodata.json",
+                               "roodata.json",
+                               force
+                        );
+                       
+
+               }
+               public void fetchResource(string res, bool force) {
+                       if (!force && FileUtils.test(configDirectory() + "/resources/" + res, FileTest.EXISTS)) {
+                               return;
+                       }
+                       this.fetchResourceFrom(
+                              "http://git.roojs.org/?p=app.Builder.js;a=blob_plain;f=resources/" + res,
+                              res,
+                              force
+                       );
+                       
+
+               }
+
+               public void fetchResourceFrom(string src, string res, bool force) {
+                       if (!force && FileUtils.test(configDirectory() + "/resources/" + res, FileTest.EXISTS)) {
+                               return;
+                       }
+                       // fetch...
+                       print("downloading %s \nto : %s\n", src,res);
+                       var session = new Soup.Session ();
+                       session.user_agent = "App Builder ";
+                       var message = new Soup.Message ("GET", 
+                               src
+                        );
+
+                           // send the HTTP request and wait for response
+                        session.send_message (message);
+
+                           // output the XML result to stdout
+                       FileUtils.set_contents(
+                              configDirectory() + "/resources/" + res,
+                             (string) message.response_body.data
+                        );
+
+
+               }
+               
+       } 
+
+
+       
+       
+
+
+               
+       
+}
diff --git a/old-javascript/Builder4/ClutterFiles.bjs b/old-javascript/Builder4/ClutterFiles.bjs
new file mode 100644 (file)
index 0000000..3efe855
--- /dev/null
@@ -0,0 +1,112 @@
+{
+    "name" : "ClutterFiles",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/ClutterFiles.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "items" : [
+        {
+            "listeners" : {
+                "scroll_event" : "( event) => {\n   //Sprint(\"scroll event\");\n            var y = this.filelayout.el.y;\n            var dir = event.direction;\n            switch (dir) {\n                case Clutter.ScrollDirection.UP:\n                    y += event.y /2;\n                    break;\n                case Clutter.ScrollDirection.DOWN:\n                    y -= event.y /2 ;\n                    break;\n                default:\n                    return false;\n            }\n            // range of scroll -- can go up -- eg.. -ve value.\n            \n            y = float.min(0, y);\n            \n            // to work out the max -ve number\n            // height of filelayout\n            // height of scrollactor..\n            \n            var last_child_bottom = this.filelayout.el.last_child.y +  this.filelayout.el.last_child.height;\n             if ( (-1 * (y+200)) > (  last_child_bottom - this.el.height)) {\n                return  false;\n            }\n        \n        \n            \n            \n        //    print(\"\\nlast child - this height = %f  ==== new y %f\\n \".printf( \n          //          last_child_bottom - this.el.height,\n           //         y));    \n           // y = float.min(0, y);    //??\n           // print(\"scroll event of %f  - new y = %f \".printf(event.y, y));\n            this.filelayout.el.y = y;\n            return true;\n          \n}"
+            },
+            "# Gee.ArrayList<Xcls_fileitem> fileitems" : "",
+            "id" : "ClutterFiles",
+            "|  void clearFiles" : "() {\n    \n    this.filelayout.el.remove_all_children();\n    // we need to unref all the chidren that we loaded though...\n    \n}\n",
+            "scroll_mode" : "Clutter.ScrollMode.VERTICALLY",
+            "* init" : "this.fileitems = new Gee.ArrayList<Xcls_fileitem>();\n",
+            "xtype" : "ScrollActor",
+            "$ reactive" : true,
+            "|  void loadProject" : "(Project.Project pr) {\n    // list all the files, and create new Xcls_fileitem for each one.\n    \n    // LEAK --- we should unref all the chilren...\n    this.filelayout.el.y = 0;\n    this.clearFiles();\n    \n    print(\"clutter files - load project: \" + pr.name +\"\\n\");\n    // should unref.. them hopefully.\n    this.fileitems = new Gee.ArrayList<Xcls_fileitem>();\n\n    \n\n    var fiter = pr.sortedFiles().list_iterator();\n    while (fiter.next()) {\n        var a = new Xcls_fileitem(this,fiter.get());\n        this.fileitems.add(a);\n\n//        a.ref();\n        print(\"add to clutter file view: \" + fiter.get().name + \"\\n\");\n        this.filelayout.el.add_child(a.el);\n    }\n    \n   \n    \n    this.el.show_all();\n}\n",
+            "# Gdk.Pixbuf missing_thumb_pixbuf" : "null",
+            "@ void open" : "(JsRender.JsRender file)",
+            "$ xns" : "Clutter",
+            "|  void set_size" : "(float w, float h) \n{\n     if (this.el == null) {\n        print(\"object not ready yet?\");\n        return;\n    }\n   _this.filelayout_manager.el.max_column_width = w - 150;\n   this.el.set_size(this.el.get_stage().width-150,\n                        this.el.get_stage().height);\n            this.el.set_position(100,50);\n}\n",
+            "items" : [
+                {
+                    "id" : "filelayout",
+                    "* init" : "\nthis.el.add_constraint(\n    new Clutter.BindConstraint(_this.el,Clutter.BindCoordinate.SIZE, 0.0f)\n);\n\n",
+                    "xtype" : "Actor",
+                    "* pack" : "add_child",
+                    "$ reactive" : true,
+                    "$ xns" : "Clutter",
+                    "items" : [
+                        {
+                            "id" : "filelayout_manager",
+                            "$ orientation" : "Clutter.FlowOrientation.HORIZONTAL",
+                            "xtype" : "FlowLayout",
+                            "$ xns" : "Clutter",
+                            "row_spacing" : 20,
+                            "* prop" : "layout_manager",
+                            "column_spacing" : 20,
+                            "$ homogeneous" : true
+                        },
+                        {
+                            "listeners" : {
+                                "button_press_event" : "  (  event) => {\n    _this.open(this.file);\n    return false;\n}",
+                                "enter_event" : "(  event)  => {\n    this.el.background_color = new Clutter.Color.from_string(\"#333\");\n        return false;\n}",
+                                "leave_event" : "(  event)  => {\n    this.el.background_color = new Clutter.Color.from_string(\"#000\");\n    return false;\n}"
+                            },
+                            "id" : "*fileitem",
+                            "* args" : "JsRender.JsRender file",
+                            "* init" : "this.file = file;\nthis.el.set_size(100,100);",
+                            "* pack" : true,
+                            "xtype" : "Actor",
+                            "# JsRender.JsRender file" : "",
+                            "$ reactive" : true,
+                            "$ xns" : "Clutter",
+                            "items" : [
+                                {
+                                    "$ orientation" : "Clutter.Orientation.VERTICAL",
+                                    "spacing" : 4,
+                                    "xtype" : "BoxLayout",
+                                    "$ xns" : "Clutter",
+                                    "* prop" : "layout_manager"
+                                },
+                                {
+                                    "$ margin_right" : 5,
+                                    "$ margin_top" : 5,
+                                    "id" : "+image",
+                                    "* args" : "JsRender.JsRender file",
+                                    "* init" : "{\n    Gdk.Pixbuf pixbuf;\n    var fname = file.getIconFileName(false);\n\n    if (FileUtils.test(fname, FileTest.EXISTS)) {\n        pixbuf = new Gdk.Pixbuf.from_file(fname);\n    } else {\n        if (_this.missing_thumb_pixbuf == null) {\n                var     icon_theme = Gtk.IconTheme.get_default ();\n                _this.missing_thumb_pixbuf = icon_theme.load_icon (\"package-x-generic\", 92, 0);\n                _this.missing_thumb_pixbuf.ref();\n            }\n            pixbuf = _this.missing_thumb_pixbuf;\n\n    }\n\n    var img = new Clutter.Image();\n    img.set_data(pixbuf.get_pixels(),   \n                        pixbuf.has_alpha \n                          ? Cogl.PixelFormat.RGBA_8888\n                          : Cogl.PixelFormat.RGB_888,\n                        pixbuf.get_width (),\n            pixbuf.get_height (),\n                        pixbuf.get_rowstride ()\n    );\n    this.el.set_content(img);\n     // should probably do smarter scaling...\n    \n    \n    this.el.set_size(90, 70);\n}\n",
+                                    "$ x_expand" : true,
+                                    "* pack" : "add_child",
+                                    "xtype" : "Actor",
+                                    "$ y_align" : "Clutter.ActorAlign.START",
+                                    "$ margin_left" : 5,
+                                    "$ xns" : "Clutter",
+                                    "$ y_expand" : true,
+                                    "$ x_align" : "Clutter.ActorAlign.START"
+                                },
+                                {
+                                    "* ctor" : "new Clutter.Text.full(\"Sans 10px\", file.nickType(),new Clutter.Color.from_string(\"#fff\"))",
+                                    "id" : "+typetitle",
+                                    "* args" : "JsRender.JsRender file",
+                                    "$ x_expand" : true,
+                                    "* pack" : "add_child",
+                                    "xtype" : "Text",
+                                    "$ y_align" : "Clutter.ActorAlign.START",
+                                    "$ xns" : "Clutter",
+                                    "$ y_expand" : true,
+                                    "$ x_align" : "Clutter.ActorAlign.START"
+                                },
+                                {
+                                    "* ctor" : "new Clutter.Text.full(\"Sans 10px\", file.nickName(),new Clutter.Color.from_string(\"#fff\"))",
+                                    "id" : "+title",
+                                    "* args" : "JsRender.JsRender file",
+                                    "$ x_expand" : true,
+                                    "* pack" : "add_child",
+                                    "xtype" : "Text",
+                                    "$ y_align" : "Clutter.ActorAlign.START",
+                                    "$ xns" : "Clutter",
+                                    "$ y_expand" : true,
+                                    "$ x_align" : "Clutter.ActorAlign.START"
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/ClutterFiles.vala b/old-javascript/Builder4/ClutterFiles.vala
new file mode 100644 (file)
index 0000000..aa1a69f
--- /dev/null
@@ -0,0 +1,378 @@
+static Xcls_ClutterFiles  _ClutterFiles;
+
+public class Xcls_ClutterFiles : Object 
+{
+    public Clutter.ScrollActor el;
+    private Xcls_ClutterFiles  _this;
+
+    public static Xcls_ClutterFiles singleton()
+    {
+        if (_ClutterFiles == null) {
+            _ClutterFiles= new Xcls_ClutterFiles();
+        }
+        return _ClutterFiles;
+    }
+    public Xcls_filelayout filelayout;
+    public Xcls_filelayout_manager filelayout_manager;
+
+        // my vars (def)
+    public Gee.ArrayList<Xcls_fileitem> fileitems;
+    public Gdk.Pixbuf missing_thumb_pixbuf;
+    public signal void open (JsRender.JsRender file);
+
+    // ctor 
+    public Xcls_ClutterFiles()
+    {
+        _this = this;
+        this.el = new Clutter.ScrollActor();
+
+        // my vars (dec)
+        this.missing_thumb_pixbuf = null;
+
+        // set gobject values
+        this.el.scroll_mode = Clutter.ScrollMode.VERTICALLY;
+        this.el.reactive = true;
+        var child_0 = new Xcls_filelayout( _this );
+        child_0.ref();
+        this.el.add_child (  child_0.el  );
+
+        // init method 
+
+        this.fileitems = new Gee.ArrayList<Xcls_fileitem>();
+        // listeners 
+        this.el.scroll_event.connect( ( event) => {
+           //Sprint("scroll event");
+                    var y = this.filelayout.el.y;
+                    var dir = event.direction;
+                    switch (dir) {
+                        case Clutter.ScrollDirection.UP:
+                            y += event.y /2;
+                            break;
+                        case Clutter.ScrollDirection.DOWN:
+                            y -= event.y /2 ;
+                            break;
+                        default:
+                            return false;
+                    }
+                    // range of scroll -- can go up -- eg.. -ve value.
+                    
+                    y = float.min(0, y);
+                    
+                    // to work out the max -ve number
+                    // height of filelayout
+                    // height of scrollactor..
+                    
+                    var last_child_bottom = this.filelayout.el.last_child.y +  this.filelayout.el.last_child.height;
+                     if ( (-1 * (y+200)) > (  last_child_bottom - this.el.height)) {
+                        return  false;
+                    }
+                
+                
+                    
+                    
+                //    print("\nlast child - this height = %f  ==== new y %f\n ".printf( 
+                  //          last_child_bottom - this.el.height,
+                   //         y));    
+                   // y = float.min(0, y);    //??
+                   // print("scroll event of %f  - new y = %f ".printf(event.y, y));
+                    this.filelayout.el.y = y;
+                    return true;
+                  
+        });
+    }
+
+    // user defined functions 
+    public  void clearFiles () {
+        
+        this.filelayout.el.remove_all_children();
+        // we need to unref all the chidren that we loaded though...
+        
+    }
+    public  void loadProject (Project.Project pr) {
+        // list all the files, and create new Xcls_fileitem for each one.
+        
+        // LEAK --- we should unref all the chilren...
+        this.filelayout.el.y = 0;
+        this.clearFiles();
+        
+        print("clutter files - load project: " + pr.name +"\n");
+        // should unref.. them hopefully.
+        this.fileitems = new Gee.ArrayList<Xcls_fileitem>();
+    
+        
+    
+        var fiter = pr.sortedFiles().list_iterator();
+        while (fiter.next()) {
+            var a = new Xcls_fileitem(this,fiter.get());
+            this.fileitems.add(a);
+    
+    //        a.ref();
+            print("add to clutter file view: " + fiter.get().name + "\n");
+            this.filelayout.el.add_child(a.el);
+        }
+        
+       
+        
+        this.el.show_all();
+    }
+    public  void set_size (float w, float h) 
+    {
+         if (this.el == null) {
+            print("object not ready yet?");
+            return;
+        }
+       _this.filelayout_manager.el.max_column_width = w - 150;
+       this.el.set_size(this.el.get_stage().width-150,
+                            this.el.get_stage().height);
+                this.el.set_position(100,50);
+    }
+    public class Xcls_filelayout : Object 
+    {
+        public Clutter.Actor el;
+        private Xcls_ClutterFiles  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_filelayout(Xcls_ClutterFiles _owner )
+        {
+            _this = _owner;
+            _this.filelayout = this;
+            this.el = new Clutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.reactive = true;
+            var child_0 = new Xcls_filelayout_manager( _this );
+            child_0.ref();
+            this.el.layout_manager = child_0.el;
+
+            // init method 
+
+            this.el.add_constraint(
+                new Clutter.BindConstraint(_this.el,Clutter.BindCoordinate.SIZE, 0.0f)
+            );        }
+
+        // user defined functions 
+    }
+    public class Xcls_filelayout_manager : Object 
+    {
+        public Clutter.FlowLayout el;
+        private Xcls_ClutterFiles  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_filelayout_manager(Xcls_ClutterFiles _owner )
+        {
+            _this = _owner;
+            _this.filelayout_manager = this;
+            this.el = new Clutter.FlowLayout( Clutter.FlowOrientation.HORIZONTAL );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.homogeneous = true;
+            this.el.row_spacing = 20f;
+            this.el.column_spacing = 20f;
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_fileitem : Object 
+    {
+        public Clutter.Actor el;
+        private Xcls_ClutterFiles  _this;
+
+
+            // my vars (def)
+        public JsRender.JsRender file;
+        public Xcls_image image;
+        public Xcls_typetitle typetitle;
+        public Xcls_title title;
+
+        // ctor 
+        public Xcls_fileitem(Xcls_ClutterFiles _owner , JsRender.JsRender file)
+        {
+            _this = _owner;
+            this.el = new Clutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.reactive = true;
+            var child_0 = new Xcls_BoxLayout5( _this );
+            child_0.ref();
+            this.el.layout_manager = child_0.el;
+            var child_1 = new Xcls_image( _this ,file);
+            child_1.ref();
+            this.el.add_child (  child_1.el  );
+            this.image =  child_1;
+            var child_2 = new Xcls_typetitle( _this ,file);
+            child_2.ref();
+            this.el.add_child (  child_2.el  );
+            this.typetitle =  child_2;
+            var child_3 = new Xcls_title( _this ,file);
+            child_3.ref();
+            this.el.add_child (  child_3.el  );
+            this.title =  child_3;
+
+            // init method 
+
+            this.file = file;
+            this.el.set_size(100,100);
+            // listeners 
+            this.el.button_press_event.connect( (  event) => {
+                _this.open(this.file);
+                return false;
+            });
+            this.el.enter_event.connect( (  event)  => {
+                this.el.background_color = new Clutter.Color.from_string("#333");
+                    return false;
+            });
+            this.el.leave_event.connect( (  event)  => {
+                this.el.background_color = new Clutter.Color.from_string("#000");
+                return false;
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_BoxLayout5 : Object 
+    {
+        public Clutter.BoxLayout el;
+        private Xcls_ClutterFiles  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_BoxLayout5(Xcls_ClutterFiles _owner )
+        {
+            _this = _owner;
+            this.el = new Clutter.BoxLayout();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.spacing = 4;
+            this.el.orientation = Clutter.Orientation.VERTICAL;
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_image : Object 
+    {
+        public Clutter.Actor el;
+        private Xcls_ClutterFiles  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_image(Xcls_ClutterFiles _owner , JsRender.JsRender file)
+        {
+            _this = _owner;
+            this.el = new Clutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.margin_right = 5f;
+            this.el.margin_left = 5f;
+            this.el.x_align = Clutter.ActorAlign.START;
+            this.el.x_expand = true;
+            this.el.y_align = Clutter.ActorAlign.START;
+            this.el.margin_top = 5f;
+            this.el.y_expand = true;
+
+            // init method 
+
+            {
+                Gdk.Pixbuf pixbuf;
+                var fname = file.getIconFileName(false);
+            
+                if (FileUtils.test(fname, FileTest.EXISTS)) {
+                    pixbuf = new Gdk.Pixbuf.from_file(fname);
+                } else {
+                    if (_this.missing_thumb_pixbuf == null) {
+                            var     icon_theme = Gtk.IconTheme.get_default ();
+                            _this.missing_thumb_pixbuf = icon_theme.load_icon ("package-x-generic", 92, 0);
+                            _this.missing_thumb_pixbuf.ref();
+                        }
+                        pixbuf = _this.missing_thumb_pixbuf;
+            
+                }
+            
+                var img = new Clutter.Image();
+                img.set_data(pixbuf.get_pixels(),   
+                                    pixbuf.has_alpha 
+                                      ? Cogl.PixelFormat.RGBA_8888
+                                      : Cogl.PixelFormat.RGB_888,
+                                    pixbuf.get_width (),
+                        pixbuf.get_height (),
+                                    pixbuf.get_rowstride ()
+                );
+                this.el.set_content(img);
+                 // should probably do smarter scaling...
+                
+                
+                this.el.set_size(90, 70);
+            }        }
+
+        // user defined functions 
+    }
+    public class Xcls_typetitle : Object 
+    {
+        public Clutter.Text el;
+        private Xcls_ClutterFiles  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_typetitle(Xcls_ClutterFiles _owner , JsRender.JsRender file)
+        {
+            _this = _owner;
+            this.el = new Clutter.Text.full("Sans 10px", file.nickType(),new Clutter.Color.from_string("#fff"));
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.y_align = Clutter.ActorAlign.START;
+            this.el.x_align = Clutter.ActorAlign.START;
+            this.el.x_expand = true;
+            this.el.y_expand = true;
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_title : Object 
+    {
+        public Clutter.Text el;
+        private Xcls_ClutterFiles  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_title(Xcls_ClutterFiles _owner , JsRender.JsRender file)
+        {
+            _this = _owner;
+            this.el = new Clutter.Text.full("Sans 10px", file.nickName(),new Clutter.Color.from_string("#fff"));
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.y_align = Clutter.ActorAlign.START;
+            this.el.x_align = Clutter.ActorAlign.START;
+            this.el.x_expand = true;
+            this.el.y_expand = true;
+        }
+
+        // user defined functions 
+    }
+}
diff --git a/old-javascript/Builder4/DialogConfirm.bjs b/old-javascript/Builder4/DialogConfirm.bjs
new file mode 100644 (file)
index 0000000..e240812
--- /dev/null
@@ -0,0 +1,26 @@
+{
+    "name" : "DialogConfirm",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/DialogConfirm.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "items" : [
+        {
+            "listeners" : {
+                "delete_event" : " (event) => {\n    this.el.response(Gtk.ResponseType.CANCEL);\n    this.el.hide();\n    return true;\n    \n}\n \n\n\n"
+            },
+            "$ message_type" : "Gtk.MessageType.QUESTION",
+            "text" : "Tests",
+            "title" : "Please Confirm d",
+            "xtype" : "MessageDialog",
+            "$ modal" : true,
+            "|   int show" : "  (string title, string msg) {\n     //if (!this.el) { this.init(); } \n     //this.success = success;\n     this.el.title = title;\n    this.el.text =  msg;\n    this.el.show_all();\n    var ret =   this.el.run();\n    //print(\"ret got %d\", ret);\n    this.el.hide();\n    return ret;\n    \n\n}\n \n\n\n\n",
+            "$ buttons" : "Gtk.ButtonsType.YES_NO",
+            "$ xns" : "Gtk",
+            "flags" : "Gtk.DialogFlags.MODAL",
+            "$ use_markup" : true,
+            "name" : "DialogConfirm"
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/DialogConfirm.vala b/old-javascript/Builder4/DialogConfirm.vala
new file mode 100644 (file)
index 0000000..8b940e0
--- /dev/null
@@ -0,0 +1,55 @@
+static DialogConfirm  _DialogConfirm;
+
+public class DialogConfirm : Object 
+{
+    public Gtk.MessageDialog el;
+    private DialogConfirm  _this;
+
+    public static DialogConfirm singleton()
+    {
+        if (_DialogConfirm == null) {
+            _DialogConfirm= new DialogConfirm();
+        }
+        return _DialogConfirm;
+    }
+
+        // my vars (def)
+
+    // ctor 
+    public DialogConfirm()
+    {
+        _this = this;
+        this.el = new Gtk.MessageDialog( null, Gtk.DialogFlags.MODAL, Gtk.MessageType.QUESTION, Gtk.ButtonsType.YES_NO, "Tests", null );
+
+        // my vars (dec)
+
+        // set gobject values
+        this.el.title = "Please Confirm d";
+        this.el.name = "DialogConfirm";
+        this.el.modal = true;
+        this.el.use_markup = true;
+
+        // listeners 
+        this.el.delete_event.connect( (event) => {
+            this.el.response(Gtk.ResponseType.CANCEL);
+            this.el.hide();
+            return true;
+            
+        });
+    }
+
+    // user defined functions 
+    public   int show (string title, string msg) {
+         //if (!this.el) { this.init(); } 
+         //this.success = success;
+         this.el.title = title;
+        this.el.text =  msg;
+        this.el.show_all();
+        var ret =   this.el.run();
+        //print("ret got %d", ret);
+        this.el.hide();
+        return ret;
+        
+    
+    }
+}
diff --git a/old-javascript/Builder4/DialogNewComponent.bjs b/old-javascript/Builder4/DialogNewComponent.bjs
new file mode 100644 (file)
index 0000000..3b0fd97
--- /dev/null
@@ -0,0 +1,163 @@
+{
+    "name" : "DialogNewComponent",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/DialogNewComponent.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "items" : [
+        {
+            "listeners" : {
+                "delete_event" : "(self, event) => {\n    this.el.hide();\n    return true; \n    //test  \n}\n ",
+                "response" : " (self, response_id) =>  { \n  \n\tif (response_id < 1) { // cancel!\n            this.el.hide();\n            return;\n        }\n\n\n\n        if (_this.name.el.get_text().length  < 1) {\n            StandardErrorDialog.show(\n                this.el,\n                \"You have to set Component name \"\n            );\n             \n            return;\n        }\n        // what does this do?\n        \n        var isNew = _this.file.name.length  > 0 ? false : true;\n        /*\n        if (!isNew && this.file.name != _this.name.el.get_text()) {\n            Xcls_StandardErrorDialog.singleton().show(\n                this.el,\n                \"Sorry changing names does not work yet. \"\n            );\n             \n            return;\n        }\n        */\n         \n        \n      \n        // FIXME - this may be more complicated...\n        //for (var i in this.def) {\n        //    this.file[i] =  this.get(i).el.get_text();\n        //}\n\n        if (!isNew) {\n            try {\n                 this.updateFileFromEntry();\n             } catch( JsRender.Error.RENAME_FILE_EXISTS er) {\n                  Xcls_StandardErrorDialog.singleton().show(\n                    this.el,\n                    \"The name you used already exists \"\n                );\n                return;\n                 \n             }\n                                                        \n        \n            _this.file.save();\n            this.el.hide();\n            return;\n        }\n        var fn = this.name.el.get_text();\n        var dir = _this.project.firstPath();\n       \n        if (GLib.FileUtils.test(dir + \"/\" + fn + \".bjs\", GLib.FileTest.EXISTS)) {\n            Xcls_StandardErrorDialog.singleton().show(\n                this.el,\n                \"That file already exists\"\n            ); \n            return;\n        }\n       \n       var f =  JsRender.JsRender.factory(\n                _this.file.project.xtype,  \n                _this.file.project, \n                dir + \"/\" + fn + \".bjs\");\n\n        _this.file = f;\n        \n\n        \n        this.updateFileFromEntry();\n        _this.file.save();\n        _this.file.project.addFile(_this.file);\n        \n\t \n        // what about .js ?\n       \n        this.el.hide();\n        \n        \n        //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());\n         \n        //var nf = _this.project.create(dir + \"/\" + _this.file.name + \".bjs\");\n        //for (var i in this.file) {\n        //    nf[i] = this.file[i];\n        //}\n        _this.success(_this.project, _this.file);\n        /*\n\n        -- fixme -- needs to be a signal..\n        if (DialogNewComponent.success != null) {\n            DialogNewComponent.success(_this.project, nf);\n        }\n        */\n}",
+                "show" : "(self)  => {\n  this.el.show_all();\n  //test\n}"
+            },
+            "|   void updateFileFromEntry" : "() {\n\n        _this.file.title = _this.title.el.get_text();\n        _this.file.region = _this.region.el.get_text();            \n        _this.file.parent = _this.parent.el.get_text();                        \n        _this.file.permname = _this.permname.el.get_text();                                    \n        _this.file.modOrder = _this.modOrder.el.get_text();\n        \n        if (_this.file.name.length  > 0 && _this.file.name != _this.name.el.get_text()) {\n            _this.file.renameTo(_this.name.el.get_text());\n        }\n                                                    \n}    ",
+            "@ void success" : "(Project.Project pr, JsRender.JsRender file)",
+            "id" : "DialogNewComponent",
+            "default_width" : 500,
+            "$ deletable" : true,
+            "# Project.Project project" : "",
+            "title" : "New Component",
+            "xtype" : "Dialog",
+            "|   void show" : "(JsRender.JsRender c) \n{\n    this.project = c.project;\n    \n    //if (!this.el) {\n        //this.init();\n     //}\n    \n    _this.name.el.set_text(c.name);\n    _this.title.el.set_text(c.title);\n    _this.parent.el.set_text(c.parent);    \n    _this.region.el.set_text(c.region);\n    _this.modOrder.el.set_text(c.modOrder);\n     _this.permname.el.set_text(c.permname);\n    \n    if (c.path.length > 0) {\n        this.el.set_title(\"Edit File Details - \" + c.name);\n    } else {\n        this.el.set_title(\"Create New File\");\n    }\n     \n    _this.file = c;\n    //console.log('show all');\n    this.el.show_all();\n    \n    //this.success = c.success;\n    \n    \n}",
+            "# JsRender.JsRender file" : "null",
+            "default_height" : 200,
+            "$ modal" : true,
+            "$ xns" : "Gtk",
+            "items" : [
+                {
+                    "xtype" : "VBox",
+                    "$ pack" : "get_content_area().add",
+                    "$ xns" : "Gtk",
+                    "items" : [
+                        {
+                            "* pack" : "pack_start,false,false,0",
+                            "xtype" : "Table",
+                            "n_columns" : 2,
+                            "$ xns" : "Gtk",
+                            "n_rows" : 3,
+                            "$ homogeneous" : true,
+                            "items" : [
+                                {
+                                    "label" : "Component Name",
+                                    "xalign" : 0.90000000000000002,
+                                    "* pack" : "attach_defaults,0,1,0,1",
+                                    "xtype" : "Label",
+                                    "$ justify" : "Gtk.Justification.RIGHT",
+                                    "x_options" : 4,
+                                    "$ xns" : "Gtk"
+                                },
+                                {
+                                    "id" : "name",
+                                    "$ visible" : true,
+                                    "xtype" : "Entry",
+                                    "* pack" : "attach_defaults,1,2,0,1",
+                                    "$ xns" : "Gtk"
+                                },
+                                {
+                                    "label" : "Title",
+                                    "$ visible" : true,
+                                    "xalign" : 0.90000000000000002,
+                                    "* pack" : "attach_defaults,0,1,1,2",
+                                    "xtype" : "Label",
+                                    "$ justify" : "Gtk.Justification.RIGHT",
+                                    "x_options" : 4,
+                                    "$ xns" : "Gtk"
+                                },
+                                {
+                                    "id" : "title",
+                                    "$ visible" : true,
+                                    "xtype" : "Entry",
+                                    "* pack" : "attach_defaults,1,2,1,2",
+                                    "$ xns" : "Gtk"
+                                },
+                                {
+                                    "label" : "Region",
+                                    "tooltip_text" : "center, north, south, east, west",
+                                    "$ visible" : true,
+                                    "xalign" : 0.90000000000000002,
+                                    "* pack" : "attach_defaults,0,1,2,3",
+                                    "xtype" : "Label",
+                                    "$ justify" : "Gtk.Justification.RIGHT",
+                                    "x_options" : 4,
+                                    "$ xns" : "Gtk"
+                                },
+                                {
+                                    "id" : "region",
+                                    "$ visible" : true,
+                                    "xtype" : "Entry",
+                                    "* pack" : "attach_defaults,1,2,2,3",
+                                    "$ xns" : "Gtk"
+                                },
+                                {
+                                    "label" : "Parent Name",
+                                    "$ visible" : true,
+                                    "xalign" : 0.90000000000000002,
+                                    "* pack" : "attach_defaults,0,1,3,4",
+                                    "xtype" : "Label",
+                                    "$ justify" : "Gtk.Justification.RIGHT",
+                                    "x_options" : 4,
+                                    "$ xns" : "Gtk"
+                                },
+                                {
+                                    "id" : "parent",
+                                    "$ visible" : true,
+                                    "xtype" : "Entry",
+                                    "* pack" : "attach_defaults,1,2,3,4",
+                                    "$ xns" : "Gtk"
+                                },
+                                {
+                                    "label" : "Permission Name",
+                                    "$ visible" : true,
+                                    "xalign" : 0.90000000000000002,
+                                    "* pack" : "attach_defaults,0,1,4,5",
+                                    "xtype" : "Label",
+                                    "$ justify" : "Gtk.Justification.RIGHT",
+                                    "x_options" : 4,
+                                    "$ xns" : "Gtk"
+                                },
+                                {
+                                    "id" : "permname",
+                                    "$ visible" : true,
+                                    "xtype" : "Entry",
+                                    "* pack" : "attach_defaults,1,2,4,5",
+                                    "$ xns" : "Gtk"
+                                },
+                                {
+                                    "label" : "Order (for tabs)",
+                                    "$ visible" : true,
+                                    "xalign" : 0.90000000000000002,
+                                    "* pack" : "attach_defaults,0,1,5,6",
+                                    "xtype" : "Label",
+                                    "$ justify" : "Gtk.Justification.RIGHT",
+                                    "x_options" : 4,
+                                    "$ xns" : "Gtk"
+                                },
+                                {
+                                    "id" : "modOrder",
+                                    "$ visible" : true,
+                                    "xtype" : "Entry",
+                                    "* pack" : "attach_defaults,1,2,5,6",
+                                    "$ xns" : "Gtk"
+                                }
+                            ]
+                        }
+                    ]
+                },
+                {
+                    "label" : "Cancel",
+                    "* pack" : "add_action_widget,0",
+                    "xtype" : "Button",
+                    "$ xns" : "Gtk"
+                },
+                {
+                    "label" : "OK",
+                    "* pack" : "add_action_widget,1",
+                    "xtype" : "Button",
+                    "$ xns" : "Gtk"
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/DialogNewComponent.vala b/old-javascript/Builder4/DialogNewComponent.vala
new file mode 100644 (file)
index 0000000..bca2056
--- /dev/null
@@ -0,0 +1,614 @@
+static Xcls_DialogNewComponent  _DialogNewComponent;
+
+public class Xcls_DialogNewComponent : Object 
+{
+    public Gtk.Dialog el;
+    private Xcls_DialogNewComponent  _this;
+
+    public static Xcls_DialogNewComponent singleton()
+    {
+        if (_DialogNewComponent == null) {
+            _DialogNewComponent= new Xcls_DialogNewComponent();
+        }
+        return _DialogNewComponent;
+    }
+    public Xcls_name name;
+    public Xcls_title title;
+    public Xcls_region region;
+    public Xcls_parent parent;
+    public Xcls_permname permname;
+    public Xcls_modOrder modOrder;
+
+        // my vars (def)
+    public signal void success (Project.Project pr, JsRender.JsRender file);
+    public Project.Project project;
+    public JsRender.JsRender file;
+
+    // ctor 
+    public Xcls_DialogNewComponent()
+    {
+        _this = this;
+        this.el = new Gtk.Dialog();
+
+        // my vars (dec)
+        this.file = null;
+
+        // set gobject values
+        this.el.title = "New Component";
+        this.el.default_height = 200;
+        this.el.default_width = 500;
+        this.el.deletable = true;
+        this.el.modal = true;
+        var child_0 = new Xcls_VBox2( _this );
+        child_0.ref();
+        this.el.get_content_area().add (  child_0.el  );
+        var child_1 = new Xcls_Button16( _this );
+        child_1.ref();
+        this.el.add_action_widget (  child_1.el , 0 );
+        var child_2 = new Xcls_Button17( _this );
+        child_2.ref();
+        this.el.add_action_widget (  child_2.el , 1 );
+
+        // listeners 
+        this.el.delete_event.connect( (self, event) => {
+            this.el.hide();
+            return true; 
+            //test  
+        });
+        this.el.response.connect( (self, response_id) =>  { 
+          
+               if (response_id < 1) { // cancel!
+                    this.el.hide();
+                    return;
+                }
+        
+        
+        
+                if (_this.name.el.get_text().length  < 1) {
+                    StandardErrorDialog.show(
+                        this.el,
+                        "You have to set Component name "
+                    );
+                     
+                    return;
+                }
+                // what does this do?
+                
+                var isNew = _this.file.name.length  > 0 ? false : true;
+                /*
+                if (!isNew && this.file.name != _this.name.el.get_text()) {
+                    Xcls_StandardErrorDialog.singleton().show(
+                        this.el,
+                        "Sorry changing names does not work yet. "
+                    );
+                     
+                    return;
+                }
+                */
+                 
+                
+              
+                // FIXME - this may be more complicated...
+                //for (var i in this.def) {
+                //    this.file[i] =  this.get(i).el.get_text();
+                //}
+        
+                if (!isNew) {
+                    try {
+                         this.updateFileFromEntry();
+                     } catch( JsRender.Error.RENAME_FILE_EXISTS er) {
+                          Xcls_StandardErrorDialog.singleton().show(
+                            this.el,
+                            "The name you used already exists "
+                        );
+                        return;
+                         
+                     }
+                                                                
+                
+                    _this.file.save();
+                    this.el.hide();
+                    return;
+                }
+                var fn = this.name.el.get_text();
+                var dir = _this.project.firstPath();
+               
+                if (GLib.FileUtils.test(dir + "/" + fn + ".bjs", GLib.FileTest.EXISTS)) {
+                    Xcls_StandardErrorDialog.singleton().show(
+                        this.el,
+                        "That file already exists"
+                    ); 
+                    return;
+                }
+               
+               var f =  JsRender.JsRender.factory(
+                        _this.file.project.xtype,  
+                        _this.file.project, 
+                        dir + "/" + fn + ".bjs");
+        
+                _this.file = f;
+                
+        
+                
+                this.updateFileFromEntry();
+                _this.file.save();
+                _this.file.project.addFile(_this.file);
+                
+                
+                // what about .js ?
+               
+                this.el.hide();
+                
+                
+                //var tmpl = this.project.loadFileOnly(DialogNewComponent.get('template').getValue());
+                 
+                //var nf = _this.project.create(dir + "/" + _this.file.name + ".bjs");
+                //for (var i in this.file) {
+                //    nf[i] = this.file[i];
+                //}
+                _this.success(_this.project, _this.file);
+                /*
+        
+                -- fixme -- needs to be a signal..
+                if (DialogNewComponent.success != null) {
+                    DialogNewComponent.success(_this.project, nf);
+                }
+                */
+        });
+        this.el.show.connect( (self)  => {
+          this.el.show_all();
+          //test
+        });
+    }
+
+    // user defined functions 
+    public   void updateFileFromEntry () {
+    
+            _this.file.title = _this.title.el.get_text();
+            _this.file.region = _this.region.el.get_text();            
+            _this.file.parent = _this.parent.el.get_text();                        
+            _this.file.permname = _this.permname.el.get_text();                                    
+            _this.file.modOrder = _this.modOrder.el.get_text();
+            
+            if (_this.file.name.length  > 0 && _this.file.name != _this.name.el.get_text()) {
+                _this.file.renameTo(_this.name.el.get_text());
+            }
+                                                        
+    }
+    public   void show (JsRender.JsRender c) 
+    {
+        this.project = c.project;
+        
+        //if (!this.el) {
+            //this.init();
+         //}
+        
+        _this.name.el.set_text(c.name);
+        _this.title.el.set_text(c.title);
+        _this.parent.el.set_text(c.parent);    
+        _this.region.el.set_text(c.region);
+        _this.modOrder.el.set_text(c.modOrder);
+         _this.permname.el.set_text(c.permname);
+        
+        if (c.path.length > 0) {
+            this.el.set_title("Edit File Details - " + c.name);
+        } else {
+            this.el.set_title("Create New File");
+        }
+         
+        _this.file = c;
+        //console.log('show all');
+        this.el.show_all();
+        
+        //this.success = c.success;
+        
+        
+    }
+    public class Xcls_VBox2 : Object 
+    {
+        public Gtk.VBox el;
+        private Xcls_DialogNewComponent  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_VBox2(Xcls_DialogNewComponent _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.VBox( true, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Table3( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false,false,0 );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Table3 : Object 
+    {
+        public Gtk.Table el;
+        private Xcls_DialogNewComponent  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Table3(Xcls_DialogNewComponent _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Table( 3, 2, true );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Label4( _this );
+            child_0.ref();
+            this.el.attach_defaults (  child_0.el , 0,1,0,1 );
+            var child_1 = new Xcls_name( _this );
+            child_1.ref();
+            this.el.attach_defaults (  child_1.el , 1,2,0,1 );
+            var child_2 = new Xcls_Label6( _this );
+            child_2.ref();
+            this.el.attach_defaults (  child_2.el , 0,1,1,2 );
+            var child_3 = new Xcls_title( _this );
+            child_3.ref();
+            this.el.attach_defaults (  child_3.el , 1,2,1,2 );
+            var child_4 = new Xcls_Label8( _this );
+            child_4.ref();
+            this.el.attach_defaults (  child_4.el , 0,1,2,3 );
+            var child_5 = new Xcls_region( _this );
+            child_5.ref();
+            this.el.attach_defaults (  child_5.el , 1,2,2,3 );
+            var child_6 = new Xcls_Label10( _this );
+            child_6.ref();
+            this.el.attach_defaults (  child_6.el , 0,1,3,4 );
+            var child_7 = new Xcls_parent( _this );
+            child_7.ref();
+            this.el.attach_defaults (  child_7.el , 1,2,3,4 );
+            var child_8 = new Xcls_Label12( _this );
+            child_8.ref();
+            this.el.attach_defaults (  child_8.el , 0,1,4,5 );
+            var child_9 = new Xcls_permname( _this );
+            child_9.ref();
+            this.el.attach_defaults (  child_9.el , 1,2,4,5 );
+            var child_10 = new Xcls_Label14( _this );
+            child_10.ref();
+            this.el.attach_defaults (  child_10.el , 0,1,5,6 );
+            var child_11 = new Xcls_modOrder( _this );
+            child_11.ref();
+            this.el.attach_defaults (  child_11.el , 1,2,5,6 );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label4 : Object 
+    {
+        public Gtk.Label el;
+        private Xcls_DialogNewComponent  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label4(Xcls_DialogNewComponent _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "Component Name" );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.justify = Gtk.Justification.RIGHT;
+            this.el.xalign = 0.900000f;
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_name : Object 
+    {
+        public Gtk.Entry el;
+        private Xcls_DialogNewComponent  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_name(Xcls_DialogNewComponent _owner )
+        {
+            _this = _owner;
+            _this.name = this;
+            this.el = new Gtk.Entry();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.visible = true;
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label6 : Object 
+    {
+        public Gtk.Label el;
+        private Xcls_DialogNewComponent  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label6(Xcls_DialogNewComponent _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "Title" );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.justify = Gtk.Justification.RIGHT;
+            this.el.xalign = 0.900000f;
+            this.el.visible = true;
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_title : Object 
+    {
+        public Gtk.Entry el;
+        private Xcls_DialogNewComponent  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_title(Xcls_DialogNewComponent _owner )
+        {
+            _this = _owner;
+            _this.title = this;
+            this.el = new Gtk.Entry();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.visible = true;
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label8 : Object 
+    {
+        public Gtk.Label el;
+        private Xcls_DialogNewComponent  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label8(Xcls_DialogNewComponent _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "Region" );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.justify = Gtk.Justification.RIGHT;
+            this.el.xalign = 0.900000f;
+            this.el.tooltip_text = "center, north, south, east, west";
+            this.el.visible = true;
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_region : Object 
+    {
+        public Gtk.Entry el;
+        private Xcls_DialogNewComponent  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_region(Xcls_DialogNewComponent _owner )
+        {
+            _this = _owner;
+            _this.region = this;
+            this.el = new Gtk.Entry();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.visible = true;
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label10 : Object 
+    {
+        public Gtk.Label el;
+        private Xcls_DialogNewComponent  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label10(Xcls_DialogNewComponent _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "Parent Name" );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.justify = Gtk.Justification.RIGHT;
+            this.el.xalign = 0.900000f;
+            this.el.visible = true;
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_parent : Object 
+    {
+        public Gtk.Entry el;
+        private Xcls_DialogNewComponent  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_parent(Xcls_DialogNewComponent _owner )
+        {
+            _this = _owner;
+            _this.parent = this;
+            this.el = new Gtk.Entry();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.visible = true;
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label12 : Object 
+    {
+        public Gtk.Label el;
+        private Xcls_DialogNewComponent  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label12(Xcls_DialogNewComponent _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "Permission Name" );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.justify = Gtk.Justification.RIGHT;
+            this.el.xalign = 0.900000f;
+            this.el.visible = true;
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_permname : Object 
+    {
+        public Gtk.Entry el;
+        private Xcls_DialogNewComponent  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_permname(Xcls_DialogNewComponent _owner )
+        {
+            _this = _owner;
+            _this.permname = this;
+            this.el = new Gtk.Entry();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.visible = true;
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label14 : Object 
+    {
+        public Gtk.Label el;
+        private Xcls_DialogNewComponent  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label14(Xcls_DialogNewComponent _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "Order (for tabs)" );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.justify = Gtk.Justification.RIGHT;
+            this.el.xalign = 0.900000f;
+            this.el.visible = true;
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_modOrder : Object 
+    {
+        public Gtk.Entry el;
+        private Xcls_DialogNewComponent  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_modOrder(Xcls_DialogNewComponent _owner )
+        {
+            _this = _owner;
+            _this.modOrder = this;
+            this.el = new Gtk.Entry();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.visible = true;
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button16 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_DialogNewComponent  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button16(Xcls_DialogNewComponent _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Cancel";
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button17 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_DialogNewComponent  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button17(Xcls_DialogNewComponent _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "OK";
+        }
+
+        // user defined functions 
+    }
+}
diff --git a/old-javascript/Builder4/DialogSaveModule.bjs b/old-javascript/Builder4/DialogSaveModule.bjs
new file mode 100644 (file)
index 0000000..4a32f13
--- /dev/null
@@ -0,0 +1,56 @@
+{
+    "name" : "DialogSaveModule",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/DialogSaveModule.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "items" : [
+        {
+            "listeners" : {
+                "delete_event" : " (self, event) => {\n    this.el.response(Gtk.ResponseType.CANCEL);\n    return true;\n}"
+            },
+            "default_width" : 400,
+            "# Project.Project project" : "",
+            "xtype" : "Dialog",
+            "default_height" : 200,
+            "$ modal" : true,
+            "# JsRender.Node data" : "",
+            "|   string show" : " (Gtk.Window parent, Project.Project project, JsRender.Node data) {\n \n     \n    this.el.set_transient_for(parent);\n    this.el.modal = true;\n    \n    this.data = data;\n    this.project = project;\n    this.name.el.set_text(\"\");\n    this.el.show_all();\n     var   name = \"\";\n    while (true) {\n        var response_id = this.el.run();\n        if (response_id < 1) {\n            this.el.hide();\n             return \"\";\n        }\n        \n        name = _this.name.el.get_text();\n        if (name.length < 1) {\n            StandardErrorDialog.singleton().show(\n                 _this.el,\n                \"You must give the template a name. \"\n            );\n            continue;\n        }\n        if (!Regex.match_simple (\"^[A-Za-z][A-Za-z0-9.]+$\", name) )\n        {\n            StandardErrorDialog.singleton().show(\n                 _this.el,\n                \"Template Name must contain only letters dots\"\n            );\n            continue;\n        }\n        break;\n    }\n    var f = project.newFile(name);\n    f.tree =  _this.data.deepClone();\n    f.save();\n    \n    // now we save it..\n    this.el.hide();\n    \n    return name;\n    \n    \n    \n}\n",
+            "$ xns" : "Gtk",
+            "items" : [
+                {
+                    "xtype" : "HBox",
+                    "$ pack" : " get_content_area().add\n\n",
+                    "$ xns" : "Gtk",
+                    "items" : [
+                        {
+                            "label" : "Name",
+                            "xtype" : "Label",
+                            "* pack" : "add",
+                            "$ xns" : "Gtk"
+                        },
+                        {
+                            "id" : "name",
+                            "xtype" : "Entry",
+                            "* pack" : "add",
+                            "$ xns" : "Gtk"
+                        }
+                    ]
+                },
+                {
+                    "label" : "Cancel",
+                    "xtype" : "Button",
+                    "* pack" : "add_action_widget,0",
+                    "$ xns" : "Gtk"
+                },
+                {
+                    "label" : "OK",
+                    "xtype" : "Button",
+                    "* pack" : "add_action_widget,1",
+                    "$ xns" : "Gtk"
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/DialogSaveModule.vala b/old-javascript/Builder4/DialogSaveModule.vala
new file mode 100644 (file)
index 0000000..f1daeea
--- /dev/null
@@ -0,0 +1,213 @@
+static DialogSaveModule  _DialogSaveModule;
+
+public class DialogSaveModule : Object 
+{
+    public Gtk.Dialog el;
+    private DialogSaveModule  _this;
+
+    public static DialogSaveModule singleton()
+    {
+        if (_DialogSaveModule == null) {
+            _DialogSaveModule= new DialogSaveModule();
+        }
+        return _DialogSaveModule;
+    }
+    public Xcls_name name;
+
+        // my vars (def)
+    public Project.Project project;
+    public JsRender.Node data;
+
+    // ctor 
+    public DialogSaveModule()
+    {
+        _this = this;
+        this.el = new Gtk.Dialog();
+
+        // my vars (dec)
+
+        // set gobject values
+        this.el.default_height = 200;
+        this.el.default_width = 400;
+        this.el.modal = true;
+        var child_0 = new Xcls_HBox2( _this );
+        child_0.ref();
+        this.el.get_content_area().add (  child_0.el  );
+        var child_1 = new Xcls_Button5( _this );
+        child_1.ref();
+        this.el.add_action_widget (  child_1.el , 0 );
+        var child_2 = new Xcls_Button6( _this );
+        child_2.ref();
+        this.el.add_action_widget (  child_2.el , 1 );
+
+        // listeners 
+        this.el.delete_event.connect( (self, event) => {
+            this.el.response(Gtk.ResponseType.CANCEL);
+            return true;
+        });
+    }
+
+    // user defined functions 
+    public   string show (Gtk.Window parent, Project.Project project, JsRender.Node data) {
+     
+         
+        this.el.set_transient_for(parent);
+        this.el.modal = true;
+        
+        this.data = data;
+        this.project = project;
+        this.name.el.set_text("");
+        this.el.show_all();
+         var   name = "";
+        while (true) {
+            var response_id = this.el.run();
+            if (response_id < 1) {
+                this.el.hide();
+                 return "";
+            }
+            
+            name = _this.name.el.get_text();
+            if (name.length < 1) {
+                StandardErrorDialog.singleton().show(
+                     _this.el,
+                    "You must give the template a name. "
+                );
+                continue;
+            }
+            if (!Regex.match_simple ("^[A-Za-z][A-Za-z0-9.]+$", name) )
+            {
+                StandardErrorDialog.singleton().show(
+                     _this.el,
+                    "Template Name must contain only letters dots"
+                );
+                continue;
+            }
+            break;
+        }
+        var f = project.newFile(name);
+        f.tree =  _this.data.deepClone();
+        f.save();
+        
+        // now we save it..
+        this.el.hide();
+        
+        return name;
+        
+        
+        
+    }
+    public class Xcls_HBox2 : Object 
+    {
+        public Gtk.HBox el;
+        private DialogSaveModule  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_HBox2(DialogSaveModule _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.HBox( true, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Label3( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+            var child_1 = new Xcls_name( _this );
+            child_1.ref();
+            this.el.add (  child_1.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label3 : Object 
+    {
+        public Gtk.Label el;
+        private DialogSaveModule  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label3(DialogSaveModule _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "Name" );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_name : Object 
+    {
+        public Gtk.Entry el;
+        private DialogSaveModule  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_name(DialogSaveModule _owner )
+        {
+            _this = _owner;
+            _this.name = this;
+            this.el = new Gtk.Entry();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button5 : Object 
+    {
+        public Gtk.Button el;
+        private DialogSaveModule  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button5(DialogSaveModule _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Cancel";
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button6 : Object 
+    {
+        public Gtk.Button el;
+        private DialogSaveModule  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button6(DialogSaveModule _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "OK";
+        }
+
+        // user defined functions 
+    }
+}
diff --git a/old-javascript/Builder4/DialogSaveTemplate.bjs b/old-javascript/Builder4/DialogSaveTemplate.bjs
new file mode 100644 (file)
index 0000000..c8fbe2e
--- /dev/null
@@ -0,0 +1,56 @@
+{
+    "name" : "DialogSaveTemplate",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/DialogSaveTemplate.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "items" : [
+        {
+            "listeners" : {
+                "delete_event" : " (self, event) => {\n   this.el.response(Gtk.ResponseType.CANCEL);\n    return true;\n    \n}"
+            },
+            "default_width" : 400,
+            "|    void show" : " (Gtk.Window parent, Palete.Palete palete, JsRender.Node data) {\n \n    \n        this.el.set_transient_for(parent);\n        this.el.modal = true;\n        \n          this.name.el.set_text(\"\");\n        this.el.show_all();\n         var   name = \"\";\n        while (true) {\n            var response_id = this.el.run();\n            if (response_id < 1) {\n                this.el.hide();\n                 return;\n            }\n            \n            name = _this.name.el.get_text();\n            if (name.length < 1) {\n                StandardErrorDialog.singleton().show(\n                     _this.el,\n                    \"You must give the template a name. \"\n                );\n                continue;\n            }\n            if (!Regex.match_simple (\"^[A-Za-z][A-Za-z0-9. ]+$\", name) )\n            {\n                StandardErrorDialog.singleton().show(\n                     _this.el,\n                    \"Template Name must contain only letters dots\"\n                );\n                continue;\n            }\n            break;\n        }\n        palete.saveTemplate(name, data);\n        \n        // now we save it..\n        this.el.hide();\n        \n        \n  \n   \n}\n",
+            "xtype" : "Dialog",
+            "default_height" : 200,
+            "# Palete.Palete palete" : "",
+            "$ modal" : true,
+            "# JsRender.Node data" : "",
+            "$ xns" : "Gtk",
+            "items" : [
+                {
+                    "xtype" : "HBox",
+                    "$ pack" : " get_content_area().add\n\n",
+                    "$ xns" : "Gtk",
+                    "items" : [
+                        {
+                            "label" : "Name",
+                            "xtype" : "Label",
+                            "* pack" : "add",
+                            "$ xns" : "Gtk"
+                        },
+                        {
+                            "id" : "name",
+                            "xtype" : "Entry",
+                            "* pack" : "add",
+                            "$ xns" : "Gtk"
+                        }
+                    ]
+                },
+                {
+                    "label" : "Cancel",
+                    "xtype" : "Button",
+                    "* pack" : "add_action_widget,0",
+                    "$ xns" : "Gtk"
+                },
+                {
+                    "label" : "OK",
+                    "xtype" : "Button",
+                    "* pack" : "add_action_widget,1",
+                    "$ xns" : "Gtk"
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/DialogSaveTemplate.vala b/old-javascript/Builder4/DialogSaveTemplate.vala
new file mode 100644 (file)
index 0000000..732527b
--- /dev/null
@@ -0,0 +1,209 @@
+static DialogSaveTemplate  _DialogSaveTemplate;
+
+public class DialogSaveTemplate : Object 
+{
+    public Gtk.Dialog el;
+    private DialogSaveTemplate  _this;
+
+    public static DialogSaveTemplate singleton()
+    {
+        if (_DialogSaveTemplate == null) {
+            _DialogSaveTemplate= new DialogSaveTemplate();
+        }
+        return _DialogSaveTemplate;
+    }
+    public Xcls_name name;
+
+        // my vars (def)
+    public Palete.Palete palete;
+    public JsRender.Node data;
+
+    // ctor 
+    public DialogSaveTemplate()
+    {
+        _this = this;
+        this.el = new Gtk.Dialog();
+
+        // my vars (dec)
+
+        // set gobject values
+        this.el.default_height = 200;
+        this.el.default_width = 400;
+        this.el.modal = true;
+        var child_0 = new Xcls_HBox2( _this );
+        child_0.ref();
+        this.el.get_content_area().add (  child_0.el  );
+        var child_1 = new Xcls_Button5( _this );
+        child_1.ref();
+        this.el.add_action_widget (  child_1.el , 0 );
+        var child_2 = new Xcls_Button6( _this );
+        child_2.ref();
+        this.el.add_action_widget (  child_2.el , 1 );
+
+        // listeners 
+        this.el.delete_event.connect( (self, event) => {
+           this.el.response(Gtk.ResponseType.CANCEL);
+            return true;
+            
+        });
+    }
+
+    // user defined functions 
+    public    void show (Gtk.Window parent, Palete.Palete palete, JsRender.Node data) {
+     
+        
+            this.el.set_transient_for(parent);
+            this.el.modal = true;
+            
+              this.name.el.set_text("");
+            this.el.show_all();
+             var   name = "";
+            while (true) {
+                var response_id = this.el.run();
+                if (response_id < 1) {
+                    this.el.hide();
+                     return;
+                }
+                
+                name = _this.name.el.get_text();
+                if (name.length < 1) {
+                    StandardErrorDialog.singleton().show(
+                         _this.el,
+                        "You must give the template a name. "
+                    );
+                    continue;
+                }
+                if (!Regex.match_simple ("^[A-Za-z][A-Za-z0-9. ]+$", name) )
+                {
+                    StandardErrorDialog.singleton().show(
+                         _this.el,
+                        "Template Name must contain only letters dots"
+                    );
+                    continue;
+                }
+                break;
+            }
+            palete.saveTemplate(name, data);
+            
+            // now we save it..
+            this.el.hide();
+            
+            
+      
+       
+    }
+    public class Xcls_HBox2 : Object 
+    {
+        public Gtk.HBox el;
+        private DialogSaveTemplate  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_HBox2(DialogSaveTemplate _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.HBox( true, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Label3( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+            var child_1 = new Xcls_name( _this );
+            child_1.ref();
+            this.el.add (  child_1.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label3 : Object 
+    {
+        public Gtk.Label el;
+        private DialogSaveTemplate  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label3(DialogSaveTemplate _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "Name" );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_name : Object 
+    {
+        public Gtk.Entry el;
+        private DialogSaveTemplate  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_name(DialogSaveTemplate _owner )
+        {
+            _this = _owner;
+            _this.name = this;
+            this.el = new Gtk.Entry();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button5 : Object 
+    {
+        public Gtk.Button el;
+        private DialogSaveTemplate  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button5(DialogSaveTemplate _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Cancel";
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button6 : Object 
+    {
+        public Gtk.Button el;
+        private DialogSaveTemplate  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button6(DialogSaveTemplate _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "OK";
+        }
+
+        // user defined functions 
+    }
+}
diff --git a/old-javascript/Builder4/DialogTemplateSelect.bjs b/old-javascript/Builder4/DialogTemplateSelect.bjs
new file mode 100644 (file)
index 0000000..d0189ab
--- /dev/null
@@ -0,0 +1,74 @@
+{
+    "name" : "DialogTemplateSelect",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/DialogTemplateSelect.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "items" : [
+        {
+            "listeners" : {
+                "delete_event" : "  (self, event)  =>{\n    this.el.hide();\n    return true;\n}"
+            },
+            "default_width" : 400,
+            "title" : "Add an Object",
+            "xtype" : "Dialog",
+            "default_height" : 200,
+            "$ modal" : true,
+            "$ xns" : "Gtk",
+            "| JsRender.Node? show" : " (Gtk.Window pwindow, Palete.Palete pal, JsRender.Node node) {\n    \n    this.el.show_all();\n    var opts = pal.listTemplates(node);\n    if (opts.length() < 1) {\n        this.el.hide();\n        return node;\n    }\n    this.el.set_attached_to( pwindow);\n     this.el.set_transient_for( pwindow);\n    \n    //opts.unshift({ path: '' , name :'Just add Element' });\n     _this.model.loadData(opts);\n     _this.combo.el.set_active(0);\n     \n   \n    this.el.run();\n    this.el.hide();    \n    //var ix = _this.combo.el.get_active();\n    //if (ix < 1 ) {\n    //    return node;\n   // }\n   Gtk.TreeIter iter;\n    _this.combo.el.get_active_iter (out iter);\n    Value vfname;\n    this.model.el.get_value (iter, 0, out vfname);\n    \n    if (((string)vfname).length < 1) {\n        return node;\n    }\n    return pal.loadTemplate((string)vfname);\n\n}\n",
+            "items" : [
+                {
+                    "xtype" : "VBox",
+                    "$ pack" : "get_content_area().add ",
+                    "$ xns" : "Gtk",
+                    "items" : [
+                        {
+                            "* pack" : "pack_start,false,false,0",
+                            "xtype" : "HBox",
+                            "$ xns" : "Gtk",
+                            "items" : [
+                                {
+                                    "label" : "Select Template : ",
+                                    "xtype" : "Label",
+                                    "* pack" : "pack_start,false,false",
+                                    "$ xns" : "Gtk"
+                                },
+                                {
+                                    "id" : "combo",
+                                    "* init" : "this.el.add_attribute(_this.cellrenderer.el , \"markup\", 1 );",
+                                    "xtype" : "ComboBox",
+                                    "* pack" : "add",
+                                    "$ xns" : "Gtk",
+                                    "items" : [
+                                        {
+                                            "id" : "cellrenderer",
+                                            "xtype" : "CellRendererText",
+                                            "* pack" : "pack_start,true",
+                                            "$ xns" : "Gtk"
+                                        },
+                                        {
+                                            "id" : "model",
+                                            "* pack" : "set_model",
+                                            "xtype" : "ListStore",
+                                            "$ columns" : "typeof(string),typeof(string)",
+                                            "n_columns" : 2,
+                                            "$ xns" : "Gtk",
+                                            "| void loadData" : "  (GLib.List<string> data) {\n    this.el.clear();                                    \n    Gtk.TreeIter iter;\n    var el = this.el;\n    \n    el.append(out iter);\n    \n     \n    el.set_value(iter, 0, \"\");\n    el.set_value(iter, 1, \"Just add Element\");\n    \n    for (var i = 0; i < data.length();i++) {\n    \n\n        el.append(out iter);\n        var str = data.nth_data(i);\n        var fn = Path.get_basename (str);\n        fn.replace(\".json\", \"\");\n        \n        el.set_value(iter, 0, str);\n        el.set_value(iter, 1, fn);\n        \n    }\n    this.el.set_sort_column_id(1, Gtk.SortType.ASCENDING);          \n                                     \n}\n"
+                                        }
+                                    ]
+                                }
+                            ]
+                        }
+                    ]
+                },
+                {
+                    "label" : "OK",
+                    "xtype" : "Button",
+                    "* pack" : "add_action_widget,0",
+                    "$ xns" : "Gtk"
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/DialogTemplateSelect.vala b/old-javascript/Builder4/DialogTemplateSelect.vala
new file mode 100644 (file)
index 0000000..b84791f
--- /dev/null
@@ -0,0 +1,277 @@
+static DialogTemplateSelect  _DialogTemplateSelect;
+
+public class DialogTemplateSelect : Object 
+{
+    public Gtk.Dialog el;
+    private DialogTemplateSelect  _this;
+
+    public static DialogTemplateSelect singleton()
+    {
+        if (_DialogTemplateSelect == null) {
+            _DialogTemplateSelect= new DialogTemplateSelect();
+        }
+        return _DialogTemplateSelect;
+    }
+    public Xcls_combo combo;
+    public Xcls_cellrenderer cellrenderer;
+    public Xcls_model model;
+
+        // my vars (def)
+
+    // ctor 
+    public DialogTemplateSelect()
+    {
+        _this = this;
+        this.el = new Gtk.Dialog();
+
+        // my vars (dec)
+
+        // set gobject values
+        this.el.title = "Add an Object";
+        this.el.default_height = 200;
+        this.el.default_width = 400;
+        this.el.modal = true;
+        var child_0 = new Xcls_VBox2( _this );
+        child_0.ref();
+        this.el.get_content_area().add (  child_0.el  );
+        var child_1 = new Xcls_Button8( _this );
+        child_1.ref();
+        this.el.add_action_widget (  child_1.el , 0 );
+
+        // listeners 
+        this.el.delete_event.connect( (self, event)  =>{
+            this.el.hide();
+            return true;
+        });
+    }
+
+    // user defined functions 
+    public JsRender.Node? show (Gtk.Window pwindow, Palete.Palete pal, JsRender.Node node) {
+        
+        this.el.show_all();
+        var opts = pal.listTemplates(node);
+        if (opts.length() < 1) {
+            this.el.hide();
+            return node;
+        }
+        this.el.set_attached_to( pwindow);
+         this.el.set_transient_for( pwindow);
+        
+        //opts.unshift({ path: '' , name :'Just add Element' });
+         _this.model.loadData(opts);
+         _this.combo.el.set_active(0);
+         
+       
+        this.el.run();
+        this.el.hide();    
+        //var ix = _this.combo.el.get_active();
+        //if (ix < 1 ) {
+        //    return node;
+       // }
+       Gtk.TreeIter iter;
+        _this.combo.el.get_active_iter (out iter);
+        Value vfname;
+        this.model.el.get_value (iter, 0, out vfname);
+        
+        if (((string)vfname).length < 1) {
+            return node;
+        }
+        return pal.loadTemplate((string)vfname);
+    
+    }
+    public class Xcls_VBox2 : Object 
+    {
+        public Gtk.VBox el;
+        private DialogTemplateSelect  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_VBox2(DialogTemplateSelect _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.VBox( true, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_HBox3( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false,false,0 );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_HBox3 : Object 
+    {
+        public Gtk.HBox el;
+        private DialogTemplateSelect  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_HBox3(DialogTemplateSelect _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.HBox( true, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Label4( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false,false );
+            var child_1 = new Xcls_combo( _this );
+            child_1.ref();
+            this.el.add (  child_1.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label4 : Object 
+    {
+        public Gtk.Label el;
+        private DialogTemplateSelect  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label4(DialogTemplateSelect _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "Select Template : " );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_combo : Object 
+    {
+        public Gtk.ComboBox el;
+        private DialogTemplateSelect  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_combo(DialogTemplateSelect _owner )
+        {
+            _this = _owner;
+            _this.combo = this;
+            this.el = new Gtk.ComboBox();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_cellrenderer( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , true );
+            var child_1 = new Xcls_model( _this );
+            child_1.ref();
+            this.el.set_model (  child_1.el  );
+
+            // init method 
+
+            this.el.add_attribute(_this.cellrenderer.el , "markup", 1 );        }
+
+        // user defined functions 
+    }
+    public class Xcls_cellrenderer : Object 
+    {
+        public Gtk.CellRendererText el;
+        private DialogTemplateSelect  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_cellrenderer(DialogTemplateSelect _owner )
+        {
+            _this = _owner;
+            _this.cellrenderer = this;
+            this.el = new Gtk.CellRendererText();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_model : Object 
+    {
+        public Gtk.ListStore el;
+        private DialogTemplateSelect  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_model(DialogTemplateSelect _owner )
+        {
+            _this = _owner;
+            _this.model = this;
+            this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+        public void loadData (GLib.List<string> data) {
+            this.el.clear();                                    
+            Gtk.TreeIter iter;
+            var el = this.el;
+            
+            el.append(out iter);
+            
+             
+            el.set_value(iter, 0, "");
+            el.set_value(iter, 1, "Just add Element");
+            
+            for (var i = 0; i < data.length();i++) {
+            
+        
+                el.append(out iter);
+                var str = data.nth_data(i);
+                var fn = Path.get_basename (str);
+                fn.replace(".json", "");
+                
+                el.set_value(iter, 0, str);
+                el.set_value(iter, 1, fn);
+                
+            }
+            this.el.set_sort_column_id(1, Gtk.SortType.ASCENDING);          
+                                             
+        }
+    }
+    public class Xcls_Button8 : Object 
+    {
+        public Gtk.Button el;
+        private DialogTemplateSelect  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button8(DialogTemplateSelect _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "OK";
+        }
+
+        // user defined functions 
+    }
+}
diff --git a/old-javascript/Builder4/EditProject.bjs b/old-javascript/Builder4/EditProject.bjs
new file mode 100644 (file)
index 0000000..d8c9ac5
--- /dev/null
@@ -0,0 +1,97 @@
+{
+    "id": "file-gtk-8",
+    "name": "EditProject",
+    "parent": "",
+    "title": false,
+    "path": "/home/alan/gitlive/app.Builder.js/Builder4/EditProject.bjs",
+    "items": [
+        {
+            "listeners": {
+                "destroy_event": " (self, event) => {\n  this.el.response(0);\n//     this.el.hide();\n    return false;\n}"
+            },
+            "border_width": 3,
+            "default_height": 500,
+            "default_width": 600,
+            "name": "EditProject",
+            "title": "Project Properties",
+            "xtype": "Dialog",
+            "|Project.Project?:show": "() {\n      \n\n    //[ 'xtype'  ].forEach(function(k) {\n    //    _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);\n    //});\n\t// shouild set path..\n    _this.model.loadData();\n    this.el.show_all();\n    \n    var err_dialog = StandardErrorDialog.singleton();\n\n    var id = -1;\n    while (id < 0) {\n         id =  this.el.run();\n         if (id < 1) {\n                this.el.hide();\n                return null;\n        }\n\n         \n          if (_this.xtype.getValue().length < 1) {\n               \n                err_dialog.show(_this.el,\"You have to set Project type\");             \n                id = -1;\n                continue;\n            }\n            if (_this.dir.el.get_filename().length < 1) {\n \n                err_dialog.show(_this.el,\"You have to select a folder\");             \n                id = -1;\n                continue;\n            }\n           \n    }\n    \n    this.el.hide();\n    \n    \n    \n \n    var fn = _this.dir.el.get_filename();\n    print(\"add %s\\n\" , fn);\n    \n    var project = Project.Project.factory(_this.xtype.getValue(), fn);\n    project.save();\n    Project.projects.set(project.name,project);\n    \n    //var pr = imports.Builder.Provider.ProjectManager.ProjectManager.update(this.project);\n    \n    return project;\n\n    \n    //this.success = c.success;\n}\n",
+            "|deletable": "true",
+            "|modal": "true",
+            "|xns": "Gtk",
+            "items": [
+                {
+                    "|homogeneous": "false",
+                    "xtype": "VBox",
+                    "|pack": " get_content_area().add \n \n",
+                    "|xns": "Gtk",
+                    "items": [
+                        {
+                            "|homogeneous": "false",
+                            "pack": "pack_start,false,true,3",
+                            "xtype": "HBox",
+                            "|xns": "Gtk",
+                            "items": [
+                                {
+                                    "|xns": "Gtk",
+                                    "xtype": "Label",
+                                    "pack": "pack_start,false,true,3",
+                                    "label": "Project type :"
+                                },
+                                {
+                                    "id": "xtype",
+                                    "pack": "pack_end,true,true,3",
+                                    "xtype": "ComboBox",
+                                    "|init": " this.el.add_attribute(_this.cellrender.el , \"markup\", 1 );  \n \n",
+                                    "|setValue": " (v)    {\n        var el = this.el;\n        el.set_active(-1);\n        \n        for (var i =0;i < this.data.length; i++ ) {\n            if (v == this.data.nth_datA(i)) {\n                el.set_active(ix);\n                return false;\n            }\n        }\n    }",
+                                    "|string:getValue": " () {\n     var ix = this.el.get_active();\n        if (ix < 0 ) {\n            return \"\";\n        }\n        switch(ix) {\n            case 0:\n                return \"Roo\";\n            case 1:\n                return \"Gtk\";\n        }\n        return \"\";\n}\n",
+                                    "|xns": "Gtk",
+                                    "items": [
+                                        {
+                                            "id": "cellrender",
+                                            "pack": "pack_start,true",
+                                            "xtype": "CellRendererText",
+                                            "|xns": "Gtk"
+                                        },
+                                        {
+                                            "|columns": "typeof(string),typeof(string)",
+                                            "id": "model",
+                                            "n_columns": 2,
+                                            "pack": "set_model",
+                                            "xtype": "ListStore",
+                                            "|void:loadData": "  ( ) {\n        this.el.clear();\n                      \n        Gtk.TreeIter iter;\n                \n        el.append(out iter);\n        \n        el.set_value(iter, 0, \"Roo\");\n        el.set_value(iter, 1, \"Roo Project\");\n         el.append(out iter);\n        \n        el.set_value(iter, 0, \"Gtk\");\n        el.set_value(iter, 1, \"Gtk Project\");\n         \n              \n                                     \n}\n",
+                                            "|xns": "Gtk"
+                                        }
+                                    ]
+                                }
+                            ]
+                        },
+                        {
+                            "|create_folders": "false",
+                            "id": "dir",
+                            "pack": "pack_end,true,true,5",
+                            "xtype": "FileChooserWidget",
+                            "|action": "Gtk.FileChooserAction.SELECT_FOLDER",
+                            "|select_multiple": "false",
+                            "|xns": "Gtk"
+                        }
+                    ]
+                },
+                {
+                    "label": "OK",
+                    "pack": "add_action_widget,1",
+                    "xtype": "Button",
+                    "|xns": "Gtk"
+                },
+                {
+                    "|xns": "Gtk",
+                    "xtype": "Button",
+                    "pack": "add_action_widget,0",
+                    "label": "Cancel"
+                }
+            ]
+        }
+    ],
+    "permname": "",
+    "modOrder": ""
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/EditProject.vala b/old-javascript/Builder4/EditProject.vala
new file mode 100644 (file)
index 0000000..0203eec
--- /dev/null
@@ -0,0 +1,402 @@
+/* -- to compile
+valac  --pkg gio-2.0  --pkg posix  --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0  --pkg  libwnck-3.0 \
+    /tmp/EditProject.vala  -o /tmp/EditProject
+*/
+
+
+/* -- to test class
+static int main (string[] args) {
+    Gtk.init (ref args);
+    new Xcls_EditProject();
+    EditProject.show_all();
+     Gtk.main ();
+    return 0;
+}
+*/
+
+
+public static Xcls_EditProject  EditProject;
+
+public class Xcls_EditProject : Object 
+{
+    public Gtk.Dialog el;
+    private Xcls_EditProject  _this;
+
+    public static Xcls_EditProject singleton()
+    {
+        if (EditProject == null) {
+            EditProject= new Xcls_EditProject();
+        }
+        return EditProject;
+    }
+    public Xcls_xtype xtype;
+    public Xcls_cellrender cellrender;
+    public Xcls_model model;
+    public Xcls_dir dir;
+
+        // my vars
+
+        // ctor 
+    public Xcls_EditProject()
+    {
+        _this = this;
+        this.el = new Gtk.Dialog();
+
+        // my vars
+
+        // set gobject values
+        this.el.border_width = 3;
+        this.el.default_height = 500;
+        this.el.default_width = 600;
+        this.el.deletable = true;
+        this.el.modal = true;
+        this.el.name = "EditProject";
+        this.el.title = "Project Properties";
+        var child_0 = new Xcls_VBox2( _this );
+        child_0.ref();
+        this.el. get_content_area().add 
+ (  child_0.el  );
+        var child_1 = new Xcls_Button9( _this );
+        child_1.ref();
+        this.el.add_action_widget (  child_1.el , 1 );
+        var child_2 = new Xcls_Button10( _this );
+        child_2.ref();
+        this.el.add_action_widget (  child_2.el , 0 );
+
+        // listeners 
+        this.el.destroy_event.connect(  (self, event) => {
+          this.el.response(0);
+        //     this.el.hide();
+            return false;
+        } );
+    }
+
+    // userdefined functions 
+    public Project.Project? show() {
+              
+        
+            //[ 'xtype'  ].forEach(function(k) {
+            //    _this.get(k).setValue(typeof(c[k]) == 'undefined' ? '' : c[k]);
+            //});
+               // shouild set path..
+            _this.model.loadData();
+            this.el.show_all();
+            
+            var err_dialog = StandardErrorDialog.singleton();
+        
+            var id = -1;
+            while (id < 0) {
+                 id =  this.el.run();
+                 if (id < 1) {
+                        this.el.hide();
+                        return null;
+                }
+        
+                 
+                  if (_this.xtype.getValue().length < 1) {
+                       
+                        err_dialog.show(_this.el,"You have to set Project type");             
+                        id = -1;
+                        continue;
+                    }
+                    if (_this.dir.el.get_filename().length < 1) {
+         
+                        err_dialog.show(_this.el,"You have to select a folder");             
+                        id = -1;
+                        continue;
+                    }
+                   
+            }
+            
+            this.el.hide();
+            
+            
+            
+         
+            var fn = _this.dir.el.get_filename();
+            print("add %s\n" , fn);
+            
+            var project = Project.Project.factory(_this.xtype.getValue(), fn);
+            project.save();
+            Project.projects.set(project.name,project);
+            
+            //var pr = imports.Builder.Provider.ProjectManager.ProjectManager.update(this.project);
+            
+            return project;
+        
+            
+            //this.success = c.success;
+        }
+
+    // skip |xns - no return type
+    public class Xcls_VBox2 : Object 
+    {
+        public Gtk.VBox el;
+        private Xcls_EditProject  _this;
+
+
+            // my vars
+
+            // ctor 
+        public Xcls_VBox2(Xcls_EditProject _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.VBox( false, 0 );
+
+            // my vars
+
+            // set gobject values
+            var child_0 = new Xcls_HBox3( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false,true,3 );
+            var child_1 = new Xcls_dir( _this );
+            child_1.ref();
+            this.el.pack_end (  child_1.el , true,true,5 );
+        }
+
+        // userdefined functions 
+
+        // skip |xns - no return type
+    }
+    public class Xcls_HBox3 : Object 
+    {
+        public Gtk.HBox el;
+        private Xcls_EditProject  _this;
+
+
+            // my vars
+
+            // ctor 
+        public Xcls_HBox3(Xcls_EditProject _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.HBox( false, 0 );
+
+            // my vars
+
+            // set gobject values
+            var child_0 = new Xcls_Label4( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false,true,3 );
+            var child_1 = new Xcls_xtype( _this );
+            child_1.ref();
+            this.el.pack_end (  child_1.el , true,true,3 );
+        }
+
+        // userdefined functions 
+
+        // skip |xns - no return type
+    }
+    public class Xcls_Label4 : Object 
+    {
+        public Gtk.Label el;
+        private Xcls_EditProject  _this;
+
+
+            // my vars
+
+            // ctor 
+        public Xcls_Label4(Xcls_EditProject _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "Project type :" );
+
+            // my vars
+
+            // set gobject values
+        }
+
+        // userdefined functions 
+
+        // skip |xns - no return type
+    }
+    public class Xcls_xtype : Object 
+    {
+        public Gtk.ComboBox el;
+        private Xcls_EditProject  _this;
+
+
+            // my vars
+
+            // ctor 
+        public Xcls_xtype(Xcls_EditProject _owner )
+        {
+            _this = _owner;
+            _this.xtype = this;
+            this.el = new Gtk.ComboBox();
+
+            // my vars
+
+            // set gobject values
+            var child_0 = new Xcls_cellrender( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , true );
+            var child_1 = new Xcls_model( _this );
+            child_1.ref();
+            this.el.set_model (  child_1.el  );
+
+            // init method 
+             this.el.add_attribute(_this.cellrender.el , "markup", 1 );  
+             
+        }
+
+        // userdefined functions 
+
+        // skip |setValue - no return type
+        public string getValue () {
+                 var ix = this.el.get_active();
+                    if (ix < 0 ) {
+                        return "";
+                    }
+                    switch(ix) {
+                        case 0:
+                            return "Roo";
+                        case 1:
+                            return "Gtk";
+                    }
+                    return "";
+            }
+
+        // skip |xns - no return type
+    }
+    public class Xcls_cellrender : Object 
+    {
+        public Gtk.CellRendererText el;
+        private Xcls_EditProject  _this;
+
+
+            // my vars
+
+            // ctor 
+        public Xcls_cellrender(Xcls_EditProject _owner )
+        {
+            _this = _owner;
+            _this.cellrender = this;
+            this.el = new Gtk.CellRendererText();
+
+            // my vars
+
+            // set gobject values
+        }
+
+        // userdefined functions 
+
+        // skip |xns - no return type
+    }
+    public class Xcls_model : Object 
+    {
+        public Gtk.ListStore el;
+        private Xcls_EditProject  _this;
+
+
+            // my vars
+
+            // ctor 
+        public Xcls_model(Xcls_EditProject _owner )
+        {
+            _this = _owner;
+            _this.model = this;
+            this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
+
+            // my vars
+
+            // set gobject values
+        }
+
+        // userdefined functions 
+        public void loadData  ( ) {
+                    this.el.clear();
+                                  
+                    Gtk.TreeIter iter;
+                            
+                    el.append(out iter);
+                    
+                    el.set_value(iter, 0, "Roo");
+                    el.set_value(iter, 1, "Roo Project");
+                     el.append(out iter);
+                    
+                    el.set_value(iter, 0, "Gtk");
+                    el.set_value(iter, 1, "Gtk Project");
+                     
+                          
+                                                 
+            }
+
+        // skip |xns - no return type
+    }
+    public class Xcls_dir : Object 
+    {
+        public Gtk.FileChooserWidget el;
+        private Xcls_EditProject  _this;
+
+
+            // my vars
+
+            // ctor 
+        public Xcls_dir(Xcls_EditProject _owner )
+        {
+            _this = _owner;
+            _this.dir = this;
+            this.el = new Gtk.FileChooserWidget( Gtk.FileChooserAction.SELECT_FOLDER );
+
+            // my vars
+
+            // set gobject values
+            this.el.create_folders = false;
+            this.el.select_multiple = false;
+        }
+
+        // userdefined functions 
+
+        // skip |xns - no return type
+    }
+    public class Xcls_Button9 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_EditProject  _this;
+
+
+            // my vars
+
+            // ctor 
+        public Xcls_Button9(Xcls_EditProject _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars
+
+            // set gobject values
+            this.el.label = "OK";
+        }
+
+        // userdefined functions 
+
+        // skip |xns - no return type
+    }
+    public class Xcls_Button10 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_EditProject  _this;
+
+
+            // my vars
+
+            // ctor 
+        public Xcls_Button10(Xcls_EditProject _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars
+
+            // set gobject values
+            this.el.label = "Cancel";
+        }
+
+        // userdefined functions 
+
+        // skip |xns - no return type
+    }
+}
diff --git a/old-javascript/Builder4/Editor.bjs b/old-javascript/Builder4/Editor.bjs
new file mode 100644 (file)
index 0000000..9c3d7e9
--- /dev/null
@@ -0,0 +1,95 @@
+{
+    "name" : "Editor",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/Editor.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "items" : [
+        {
+            "# string activeEditor" : "\"\"",
+            "|   bool saveContents" : "  ()  {\n    \n    \n    \n    \n    \n    \n    \n   \n     \n     var str = _this.buffer.toString();\n     \n     if (!_this.buffer.checkSyntax()) {\n         print(\"check syntax failed\");\n         //this.get('/StandardErrorDialog').show(\"Fix errors in code and save..\"); \n         return false;\n     }\n     \n     // LeftPanel.model.changed(  str , false);\n     _this.dirty = false;\n     _this.save_button.el.sensitive = false;\n     \n     \n        \n     \n    // find the text for the node..\n    if (ptype == \"listener\") {\n        this.node.listeners.set(key,str);\n    \n    } else {\n         this.node.props.set(key,str);\n    }\n\n     \n    \n    // call the signal..\n    this.save();\n    \n    return true;\n\n} ",
+            "# int pos_root_x" : "",
+            "# int pos_root_y" : "",
+            "# string ptype" : "\"\"",
+            "# string key" : "\"\"",
+            "* pack" : "add",
+            "xtype" : "VBox",
+            "|   void show" : "(JsRender.JsRender file, JsRender.Node node, string ptype, string key)\n{\n    this.ptype = ptype;\n    this.key  = key;\n    this.node = node;\n    this.file = file;\n    \n   string val = \"\";\n    // find the text for the node..\n    if (ptype == \"listener\") {\n        val = node.listeners.get(key);\n    \n    } else {\n        val = node.props.get(key);\n    }\n    this.view.load(val);\n    this.key_edit.el.text = key;    \n\n}",
+            "# JsRender.JsRender file" : "null",
+            "# bool pos" : false,
+            "string id" : "Editor",
+            "# bool dirty" : false,
+            "$ xns" : "Gtk",
+            "@ void save" : "()",
+            "$ homogeneous" : false,
+            "# JsRender.Node node" : "null",
+            "items" : [
+                {
+                    "* pack" : "pack_start,false,true",
+                    "xtype" : "HBox",
+                    "$ xns" : "Gtk",
+                    "$ homogeneous" : false,
+                    "items" : [
+                        {
+                            "listeners" : {
+                                "clicked" : " () => { \n    _this.saveContents();\n}\n \n"
+                            },
+                            "label" : "Save",
+                            "id" : "save_button",
+                            "* pack" : "pack_start,false,false",
+                            "xtype" : "Button",
+                            "$ xns" : "Gtk"
+                        },
+                        {
+                            "id" : "key_edit",
+                            "xtype" : "Entry",
+                            "* pack" : "pack_end,true,true",
+                            "$ xns" : "Gtk"
+                        }
+                    ]
+                },
+                {
+                    "id" : "RightEditor",
+                    "* init" : "this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);",
+                    "xtype" : "ScrolledWindow",
+                    "* pack" : "add",
+                    "$ xns" : "Gtk",
+                    "items" : [
+                        {
+                            "listeners" : {
+                                "key_release_event" : " (event) => {\n    \n    if (event.keyval == 115 && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {\n        print(\"SAVE: ctrl-S  pressed\");\n        _this.saveContents();\n        return false;\n    }\n   // print(event.key.keyval)\n    \n    return false;\n\n} \n\n"
+                            },
+                            "gboolean show_line_marks" : true,
+                            "id" : "view",
+                            "* init" : " \n    var description =   Pango.FontDescription.from_string(\"monospace\");\n    description.set_size(8000);\n    this.el.override_font(description);\n\n    var attrs = new Gtk.SourceMarkAttributes();\n    var  pink = new Gdk.RGBA();\n    pink.parse ( \"pink\");\n    attrs.set_background ( pink);\n    attrs.set_icon_name ( \"process-stop\");    \n    attrs.query_tooltip_text.connect(( mark) => {\n        print(\"tooltip query? %s\\n\", mark.name);\n        return mark.name;\n    });\n    \n    this.el.set_mark_attributes (\"error\", attrs, 1);\n    \n    ",
+                            "$ insert_spaces_instead_of_tabs" : true,
+                            "* pack" : "add",
+                            "xtype" : "View",
+                            "gboolean highlight_current_line" : true,
+                            "$ gboolean auto_indent" : true,
+                            "$ xns" : "GtkSource",
+                            "|   void load" : " (string 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 = Gtk.SourceLanguageManager.get_default();\n    \n    var lang = _this.file.language;\n    //?? is javascript going to work as js?\n    \n    ((Gtk.SourceBuffer)(this.el.get_buffer())) .set_language(lm.get_language(lang));\n    var buf = this.el.get_buffer();\n    \n    /* -- what does all this do? */\n    /*\n    var cursor = buf.get_mark(\"insert\");\n    Gtk.TextIter iter;\n    buf.get_iter_at_mark(out 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(out iter, cursor);\n    iter.set_line(1);\n    iter.set_line_offset(4);\n    buf.move_mark(cursor, iter);\n    \n    */\n    \n    _this.dirty = false;\n    this.el.grab_focus();\n    _this.save_button.el.sensitive = false;\n}",
+                            "indent_width" : 4,
+                            "$ show_line_numbers" : true,
+                            "items" : [
+                                {
+                                    "listeners" : {
+                                        "changed" : " () => {\n    // check syntax??\n        if(this.checkSyntax()) {\n        _this.save_button.el.sensitive = true;\n    }\n   // print(\"EDITOR CHANGED\");\n    _this.dirty = true;\n\n    // this.get('/LeftPanel.model').changed(  str , false);\n    return ;\n}\n\n \n"
+                                    },
+                                    "id" : "buffer",
+                                    "int error_line" : "-1",
+                                    "|   string toString" : "  () {\n    \n    Gtk.TextIter s;\n    Gtk.TextIter e;\n    this.el.get_start_iter(out s);\n    this.el.get_end_iter(out e);\n    var ret = this.el.get_text(s,e,true);\n    //print(\"TO STRING? \" + ret);\n    return ret;\n}\n ",
+                                    "|   bool checkSyntax" : " () {\n \n    var p = Palete.factory(_this.file.xtype);   \n    \n    var str = this.toString();\n    \n    string res = \"\";\n    \n    if (this.error_line > 0) {\n         Gtk.TextIter start;\n         Gtk.TextIter end;     \n        this.el.get_bounds (out start, out end);\n\n        this.el.remove_source_marks (start, end, null);\n    }\n    \n    \n    var validate_res =  p.validateCode(\n        str, \n         _this.key, \n        _this.ptype,\n        _this.file,\n        _this.node\n        \n    );\n     \n    this.error_line = validate_res.size;\n\n    if (this.error_line < 1) {\n          return true;\n    }\n    var tlines = this.el.get_line_count ();\n    Gtk.TextIter iter;\n    var valiter = validate_res.map_iterator();\n    while (valiter.next()) {\n    \n//        print(\"get inter\\n\");\n        var eline = valiter.get_key();\n        if (eline > tlines) {\n            continue;\n        }\n        this.el.get_iter_at_line( out iter, eline);\n        //print(\"mark line\\n\");\n        this.el.create_source_mark(valiter.get_value(), \"error\", iter);\n    }   \n    \n    //print(\"done mark line\\n\");\n     \n    return true; // at present allow saving - even if it's invalid..\n}\n",
+                                    "* pack" : "set_buffer",
+                                    "xtype" : "Buffer",
+                                    "$ xns" : "GtkSource"
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/Editor.vala b/old-javascript/Builder4/Editor.vala
new file mode 100644 (file)
index 0000000..454d717
--- /dev/null
@@ -0,0 +1,421 @@
+static Editor  _Editor;
+
+public class Editor : Object 
+{
+    public Gtk.VBox el;
+    private Editor  _this;
+
+    public static Editor singleton()
+    {
+        if (_Editor == null) {
+            _Editor= new Editor();
+        }
+        return _Editor;
+    }
+    public Xcls_save_button save_button;
+    public Xcls_key_edit key_edit;
+    public Xcls_RightEditor RightEditor;
+    public Xcls_view view;
+    public Xcls_buffer buffer;
+
+        // my vars (def)
+    public string activeEditor;
+    public int pos_root_x;
+    public int pos_root_y;
+    public string ptype;
+    public string key;
+    public JsRender.JsRender file;
+    public bool pos;
+    public bool dirty;
+    public signal void save ();
+    public JsRender.Node node;
+
+    // ctor 
+    public Editor()
+    {
+        _this = this;
+        this.el = new Gtk.VBox( false, 0 );
+
+        // my vars (dec)
+        this.activeEditor = "";
+        this.ptype = "";
+        this.key = "";
+        this.file = null;
+        this.pos = false;
+        this.dirty = false;
+        this.node = null;
+
+        // set gobject values
+        var child_0 = new Xcls_HBox2( _this );
+        child_0.ref();
+        this.el.pack_start (  child_0.el , false,true );
+        var child_1 = new Xcls_RightEditor( _this );
+        child_1.ref();
+        this.el.add (  child_1.el  );
+    }
+
+    // user defined functions 
+    public   bool saveContents ()  {
+        
+        
+        
+        
+        
+        
+        
+       
+         
+         var str = _this.buffer.toString();
+         
+         if (!_this.buffer.checkSyntax()) {
+             print("check syntax failed");
+             //this.get('/StandardErrorDialog').show("Fix errors in code and save.."); 
+             return false;
+         }
+         
+         // LeftPanel.model.changed(  str , false);
+         _this.dirty = false;
+         _this.save_button.el.sensitive = false;
+         
+         
+            
+         
+        // find the text for the node..
+        if (ptype == "listener") {
+            this.node.listeners.set(key,str);
+        
+        } else {
+             this.node.props.set(key,str);
+        }
+    
+         
+        
+        // call the signal..
+        this.save();
+        
+        return true;
+    
+    }
+    public   void show (JsRender.JsRender file, JsRender.Node node, string ptype, string key)
+    {
+        this.ptype = ptype;
+        this.key  = key;
+        this.node = node;
+        this.file = file;
+        
+       string val = "";
+        // find the text for the node..
+        if (ptype == "listener") {
+            val = node.listeners.get(key);
+        
+        } else {
+            val = node.props.get(key);
+        }
+        this.view.load(val);
+        this.key_edit.el.text = key;    
+    
+    }
+    public class Xcls_HBox2 : Object 
+    {
+        public Gtk.HBox el;
+        private Editor  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_HBox2(Editor _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.HBox( false, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_save_button( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false,false );
+            var child_1 = new Xcls_key_edit( _this );
+            child_1.ref();
+            this.el.pack_end (  child_1.el , true,true );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_save_button : Object 
+    {
+        public Gtk.Button el;
+        private Editor  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_save_button(Editor _owner )
+        {
+            _this = _owner;
+            _this.save_button = this;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Save";
+
+            // listeners 
+            this.el.clicked.connect( () => { 
+                _this.saveContents();
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_key_edit : Object 
+    {
+        public Gtk.Entry el;
+        private Editor  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_key_edit(Editor _owner )
+        {
+            _this = _owner;
+            _this.key_edit = this;
+            this.el = new Gtk.Entry();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_RightEditor : Object 
+    {
+        public Gtk.ScrolledWindow el;
+        private Editor  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_RightEditor(Editor _owner )
+        {
+            _this = _owner;
+            _this.RightEditor = this;
+            this.el = new Gtk.ScrolledWindow( null, null );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_view( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+
+            // init method 
+
+            this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);        }
+
+        // user defined functions 
+    }
+    public class Xcls_view : Object 
+    {
+        public Gtk.SourceView el;
+        private Editor  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_view(Editor _owner )
+        {
+            _this = _owner;
+            _this.view = this;
+            this.el = new Gtk.SourceView();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.auto_indent = true;
+            this.el.indent_width = 4;
+            this.el.show_line_marks = true;
+            this.el.insert_spaces_instead_of_tabs = true;
+            this.el.show_line_numbers = true;
+            this.el.highlight_current_line = true;
+            var child_0 = new Xcls_buffer( _this );
+            child_0.ref();
+            this.el.set_buffer (  child_0.el  );
+
+            // init method 
+
+            var description =   Pango.FontDescription.from_string("monospace");
+                description.set_size(8000);
+                this.el.override_font(description);
+            
+                var attrs = new Gtk.SourceMarkAttributes();
+                var  pink = new Gdk.RGBA();
+                pink.parse ( "pink");
+                attrs.set_background ( pink);
+                attrs.set_icon_name ( "process-stop");    
+                attrs.query_tooltip_text.connect(( mark) => {
+                    print("tooltip query? %s\n", mark.name);
+                    return mark.name;
+                });
+                
+                this.el.set_mark_attributes ("error", attrs, 1);
+            // listeners 
+            this.el.key_release_event.connect( (event) => {
+                
+                if (event.keyval == 115 && (event.state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {
+                    print("SAVE: ctrl-S  pressed");
+                    _this.saveContents();
+                    return false;
+                }
+               // print(event.key.keyval)
+                
+                return false;
+            
+            });
+        }
+
+        // user defined functions 
+        public   void load (string str) {
+        
+        // show the help page for the active node..
+           //this.get('/Help').show();
+        
+        
+          // this.get('/BottomPane').el.set_current_page(0);
+            this.el.get_buffer().set_text(str, str.length);
+            var lm = Gtk.SourceLanguageManager.get_default();
+            
+            var lang = _this.file.language;
+            //?? is javascript going to work as js?
+            
+            ((Gtk.SourceBuffer)(this.el.get_buffer())) .set_language(lm.get_language(lang));
+            var buf = this.el.get_buffer();
+            
+            /* -- what does all this do? */
+            /*
+            var cursor = buf.get_mark("insert");
+            Gtk.TextIter iter;
+            buf.get_iter_at_mark(out iter, cursor);
+            iter.set_line(1);
+            iter.set_line_offset(4);
+            buf.move_mark(cursor, iter);
+            
+            
+            cursor = buf.get_mark("selection_bound");
+            //iter= new Gtk.TextIter;
+            buf.get_iter_at_mark(out iter, cursor);
+            iter.set_line(1);
+            iter.set_line_offset(4);
+            buf.move_mark(cursor, iter);
+            
+            */
+            
+            _this.dirty = false;
+            this.el.grab_focus();
+            _this.save_button.el.sensitive = false;
+        }
+    }
+    public class Xcls_buffer : Object 
+    {
+        public Gtk.SourceBuffer el;
+        private Editor  _this;
+
+
+            // my vars (def)
+        public int error_line;
+
+        // ctor 
+        public Xcls_buffer(Editor _owner )
+        {
+            _this = _owner;
+            _this.buffer = this;
+            this.el = new Gtk.SourceBuffer( null );
+
+            // my vars (dec)
+            this.error_line = -1;
+
+            // set gobject values
+
+            // listeners 
+            this.el.changed.connect( () => {
+                // check syntax??
+                    if(this.checkSyntax()) {
+                    _this.save_button.el.sensitive = true;
+                }
+               // print("EDITOR CHANGED");
+                _this.dirty = true;
+            
+                // this.get('/LeftPanel.model').changed(  str , false);
+                return ;
+            });
+        }
+
+        // user defined functions 
+        public   string toString () {
+            
+            Gtk.TextIter s;
+            Gtk.TextIter e;
+            this.el.get_start_iter(out s);
+            this.el.get_end_iter(out e);
+            var ret = this.el.get_text(s,e,true);
+            //print("TO STRING? " + ret);
+            return ret;
+        }
+        public   bool checkSyntax () {
+         
+            var p = Palete.factory(_this.file.xtype);   
+            
+            var str = this.toString();
+            
+            string res = "";
+            
+            if (this.error_line > 0) {
+                 Gtk.TextIter start;
+                 Gtk.TextIter end;     
+                this.el.get_bounds (out start, out end);
+        
+                this.el.remove_source_marks (start, end, null);
+            }
+            
+            
+            var validate_res =  p.validateCode(
+                str, 
+                 _this.key, 
+                _this.ptype,
+                _this.file,
+                _this.node
+                
+            );
+             
+            this.error_line = validate_res.size;
+        
+            if (this.error_line < 1) {
+                  return true;
+            }
+            var tlines = this.el.get_line_count ();
+            Gtk.TextIter iter;
+            var valiter = validate_res.map_iterator();
+            while (valiter.next()) {
+            
+        //        print("get inter\n");
+                var eline = valiter.get_key();
+                if (eline > tlines) {
+                    continue;
+                }
+                this.el.get_iter_at_line( out iter, eline);
+                //print("mark line\n");
+                this.el.create_source_mark(valiter.get_value(), "error", iter);
+            }   
+            
+            //print("done mark line\n");
+             
+            return true; // at present allow saving - even if it's invalid..
+        }
+    }
+}
diff --git a/old-javascript/Builder4/GladeExtras.vala b/old-javascript/Builder4/GladeExtras.vala
new file mode 100644 (file)
index 0000000..ce8c8fd
--- /dev/null
@@ -0,0 +1,12 @@
+
+
+
+public class GladeExtras : Object 
+{
+    
+       static void init()
+       {
+
+
+       }
\ No newline at end of file
diff --git a/old-javascript/Builder4/GladeView.bjs b/old-javascript/Builder4/GladeView.bjs
new file mode 100644 (file)
index 0000000..c59b8e4
--- /dev/null
@@ -0,0 +1,19 @@
+{
+    "name" : "GladeView",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/GladeView.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "items" : [
+        {
+            "* ctor" : "new Glade.DesignView(new Glade.Project())",
+            "id" : "GladeView",
+            "| void createThumb" : "() {\n    \n    \n    if (this.file == null) {\n        return;\n    }\n    var filename = this.file.getIconFileName(false);\n    \n    var  win = this.el.get_parent_window();\n    var width = win.get_width();\n    var height = win.get_height();\n\n    Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height); // this.el.position?\n\n    screenshot.save(filename,\"png\");\n    return;\n    \n    \n    \n    \n    \n     \n    \n    // should we hold until it's printed...\n    \n      \n\n    \n    \n\n\n    \n     \n}\n",
+            "| void loadFile" : "(JsRender.JsRender file)\n{\n    \n\n    this.file = file;\n    \n\n        // clear existing elements from project?\n        \n        var  p = this.el.get_project();\n        var    li = p.get_objects().copy();\n        // should remove all..\n        for (var i =0;    i < li.length(); i++) {   \n            p.remove_object(li.nth_data(i)); \n        }\n\n        if (file.tree == null) {\n            return;\n        }\n\n//        print(\"%s\\n\",tf.tree.toJsonString());\n\tvar x = new JsRender.NodeToGlade(file.tree,  \"\");\n\n\t \n\tFileIOStream iostream;\n\tvar  f = File.new_tmp (\"tpl-XXXXXX.glade\", out iostream);\n\tvar ostream = iostream.output_stream;\n\tvar dostream = new DataOutputStream (ostream);\n\tdostream.put_string (x.munge());\n\tthis.el.show();\n\t print(\"LOADING %s\\n\",f.get_path ());\n        p.load_from_file(f.get_path ());\n        \n \n\n}",
+            "xtype" : "DesignView",
+            "# JsRender.JsRender file" : "null",
+            "$ xns" : "Glade"
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/GladeView.vala b/old-javascript/Builder4/GladeView.vala
new file mode 100644 (file)
index 0000000..921ac96
--- /dev/null
@@ -0,0 +1,102 @@
+static Xcls_GladeView  _GladeView;
+
+public class Xcls_GladeView : Object 
+{
+    public Glade.DesignView el;
+    private Xcls_GladeView  _this;
+
+    public static Xcls_GladeView singleton()
+    {
+        if (_GladeView == null) {
+            _GladeView= new Xcls_GladeView();
+        }
+        return _GladeView;
+    }
+
+        // my vars (def)
+    public JsRender.JsRender file;
+
+    // ctor 
+    public Xcls_GladeView()
+    {
+        _this = this;
+        this.el = new Glade.DesignView(new Glade.Project());
+
+        // my vars (dec)
+        this.file = null;
+
+        // set gobject values
+    }
+
+    // user defined functions 
+    public void createThumb () {
+        
+        
+        if (this.file == null) {
+            return;
+        }
+        var filename = this.file.getIconFileName(false);
+        
+        var  win = this.el.get_parent_window();
+        var width = win.get_width();
+        var height = win.get_height();
+    
+        Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height); // this.el.position?
+    
+        screenshot.save(filename,"png");
+        return;
+        
+        
+        
+        
+        
+         
+        
+        // should we hold until it's printed...
+        
+          
+    
+        
+        
+    
+    
+        
+         
+    }
+    public void loadFile (JsRender.JsRender file)
+    {
+        
+    
+        this.file = file;
+        
+    
+            // clear existing elements from project?
+            
+            var  p = this.el.get_project();
+            var    li = p.get_objects().copy();
+            // should remove all..
+            for (var i =0;    i < li.length(); i++) {   
+                p.remove_object(li.nth_data(i)); 
+            }
+    
+            if (file.tree == null) {
+                return;
+            }
+    
+    //        print("%s\n",tf.tree.toJsonString());
+       var x = new JsRender.NodeToGlade(file.tree,  "");
+    
+        
+       FileIOStream iostream;
+       var  f = File.new_tmp ("tpl-XXXXXX.glade", out iostream);
+       var ostream = iostream.output_stream;
+       var dostream = new DataOutputStream (ostream);
+       dostream.put_string (x.munge());
+       this.el.show();
+        print("LOADING %s\n",f.get_path ());
+            p.load_from_file(f.get_path ());
+            
+     
+    
+    }
+}
diff --git a/old-javascript/Builder4/GtkView.bjs b/old-javascript/Builder4/GtkView.bjs
new file mode 100644 (file)
index 0000000..01d2f48
--- /dev/null
@@ -0,0 +1,105 @@
+{
+    "name" : "GtkView",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/GtkView.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "items" : [
+        {
+            "id" : "GtkView",
+            "# Gtk.Widget lastObj" : "null",
+            "| void createThumb" : "() {\n    \n    \n    if (this.file == null) {\n        return;\n    }\n    var filename = this.file.getIconFileName(false);\n    \n    var  win = this.el.get_parent_window();\n    var width = win.get_width();\n    var height = win.get_height();\n\n    Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height); // this.el.position?\n\n    screenshot.save(filename,\"png\");\n    return;\n    \n    \n    \n    \n    \n     \n    \n    // should we hold until it's printed...\n    \n      \n\n    \n    \n\n\n    \n     \n}\n",
+            "| void loadFile" : "(JsRender.JsRender file) \n{\n    \n        this.el.set_position((int)(this.el.max_position * 0.7));\n        this.file = null;\n        \n        if (file.tree == null) {\n            return;\n        }\n        this.file = file;\n        if (this.lastObj != null) {\n            this.container.el.remove(this.lastObj);\n        }\n \n\tvar x = new JsRender.NodeToGtk(file.tree);\n        var obj = x.munge() as Gtk.Widget;\n        this.lastObj = null;\n\tif (obj == null) {\n        \treturn;\n\t}\n\tthis.lastObj = obj;\n        \n        this.container.el.add(obj);\n        obj.show_all();\n}\n ",
+            "xtype" : "VPaned",
+            "# JsRender.JsRender file" : "null",
+            "$ xns" : "Gtk",
+            "items" : [
+                {
+                    "* pack" : "pack1,true,true",
+                    "xtype" : "Viewport",
+                    "$ xns" : "Gtk",
+                    "items" : [
+                        {
+                            "id" : "container",
+                            "* pack" : "add",
+                            "xtype" : "HBox",
+                            "$ xns" : "Gtk"
+                        }
+                    ]
+                },
+                {
+                    "* pack" : "pack2,true,true",
+                    "xtype" : "VBox",
+                    "gboolean homogeneous" : false,
+                    "$ xns" : "Gtk",
+                    "items" : [
+                        {
+                            "* pack" : "pack_start,false,false,0",
+                            "xtype" : "HBox",
+                            "$ xns" : "Gtk",
+                            "items" : [
+                                {
+                                    "* pack" : "pack_start,true,true,0",
+                                    "xtype" : "Button",
+                                    "$ xns" : "Gtk",
+                                    "utf8 label" : "Full Compile"
+                                }
+                            ]
+                        },
+                        {
+                            "* pack" : "pack_start,true,true,0",
+                            "xtype" : "HBox",
+                            "gboolean homogeneous" : true,
+                            "$ xns" : "Gtk",
+                            "items" : [
+                                {
+                                    "* pack" : "add",
+                                    "xtype" : "TreeView",
+                                    "$ xns" : "Gtk",
+                                    "items" : [
+                                        {
+                                            "gint n_columns" : 1,
+                                            "columns" : "  typeof(string)",
+                                            "* pack" : "set_model",
+                                            "xtype" : "ListStore",
+                                            "$ xns" : "Gtk"
+                                        },
+                                        {
+                                            "utf8 title" : "Compile output",
+                                            "xtype" : "TreeViewColumn",
+                                            "string id" : "column",
+                                            "$ xns" : "Gtk",
+                                            "items" : [
+                                                {
+                                                    "* pack" : "pack_start,false",
+                                                    "xtype" : "CellRendererText",
+                                                    "$ xns" : "Gtk"
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                },
+                                {
+                                    "* pack" : "pack_start,true,true,0",
+                                    "xtype" : "ScrolledWindow",
+                                    "$ xns" : "Gtk",
+                                    "items" : [
+                                        {
+                                            "gboolean show_line_marks" : true,
+                                            "* pack" : "add",
+                                            "xtype" : "View",
+                                            "$ xns" : "GtkSource",
+                                            "gboolean show_line_numbers" : true,
+                                            "gboolean editable" : false
+                                        }
+                                    ]
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/GtkView.vala b/old-javascript/Builder4/GtkView.vala
new file mode 100644 (file)
index 0000000..4d764a3
--- /dev/null
@@ -0,0 +1,387 @@
+static Xcls_GtkView  _GtkView;
+
+public class Xcls_GtkView : Object 
+{
+    public Gtk.VPaned el;
+    private Xcls_GtkView  _this;
+
+    public static Xcls_GtkView singleton()
+    {
+        if (_GtkView == null) {
+            _GtkView= new Xcls_GtkView();
+        }
+        return _GtkView;
+    }
+    public Xcls_container container;
+
+        // my vars (def)
+    public Gtk.Widget lastObj;
+    public JsRender.JsRender file;
+
+    // ctor 
+    public Xcls_GtkView()
+    {
+        _this = this;
+        this.el = new Gtk.VPaned();
+
+        // my vars (dec)
+        this.lastObj = null;
+        this.file = null;
+
+        // set gobject values
+        var child_0 = new Xcls_Viewport2( _this );
+        child_0.ref();
+        this.el.pack1 (  child_0.el , true,true );
+        var child_1 = new Xcls_VBox4( _this );
+        child_1.ref();
+        this.el.pack2 (  child_1.el , true,true );
+    }
+
+    // user defined functions 
+    public void createThumb () {
+        
+        
+        if (this.file == null) {
+            return;
+        }
+        var filename = this.file.getIconFileName(false);
+        
+        var  win = this.el.get_parent_window();
+        var width = win.get_width();
+        var height = win.get_height();
+    
+        Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, height); // this.el.position?
+    
+        screenshot.save(filename,"png");
+        return;
+        
+        
+        
+        
+        
+         
+        
+        // should we hold until it's printed...
+        
+          
+    
+        
+        
+    
+    
+        
+         
+    }
+    public void loadFile (JsRender.JsRender file) 
+    {
+        
+            this.el.set_position((int)(this.el.max_position * 0.7));
+            this.file = null;
+            
+            if (file.tree == null) {
+                return;
+            }
+            this.file = file;
+            if (this.lastObj != null) {
+                this.container.el.remove(this.lastObj);
+            }
+     
+       var x = new JsRender.NodeToGtk(file.tree);
+            var obj = x.munge() as Gtk.Widget;
+            this.lastObj = null;
+       if (obj == null) {
+               return;
+       }
+       this.lastObj = obj;
+            
+            this.container.el.add(obj);
+            obj.show_all();
+    }
+    public class Xcls_Viewport2 : Object 
+    {
+        public Gtk.Viewport el;
+        private Xcls_GtkView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Viewport2(Xcls_GtkView _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Viewport( null, null );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_container( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_container : Object 
+    {
+        public Gtk.HBox el;
+        private Xcls_GtkView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_container(Xcls_GtkView _owner )
+        {
+            _this = _owner;
+            _this.container = this;
+            this.el = new Gtk.HBox( true, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_VBox4 : Object 
+    {
+        public Gtk.VBox el;
+        private Xcls_GtkView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_VBox4(Xcls_GtkView _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.VBox( false, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_HBox5( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false,false,0 );
+            var child_1 = new Xcls_HBox7( _this );
+            child_1.ref();
+            this.el.pack_start (  child_1.el , true,true,0 );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_HBox5 : Object 
+    {
+        public Gtk.HBox el;
+        private Xcls_GtkView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_HBox5(Xcls_GtkView _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.HBox( true, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Button6( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , true,true,0 );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button6 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_GtkView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button6(Xcls_GtkView _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Full Compile";
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_HBox7 : Object 
+    {
+        public Gtk.HBox el;
+        private Xcls_GtkView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_HBox7(Xcls_GtkView _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.HBox( true, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_TreeView8( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+            var child_1 = new Xcls_ScrolledWindow12( _this );
+            child_1.ref();
+            this.el.pack_start (  child_1.el , true,true,0 );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_TreeView8 : Object 
+    {
+        public Gtk.TreeView el;
+        private Xcls_GtkView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_TreeView8(Xcls_GtkView _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.TreeView();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_ListStore9( _this );
+            child_0.ref();
+            this.el.set_model (  child_0.el  );
+            var child_1 = new Xcls_column( _this );
+            child_1.ref();
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_ListStore9 : Object 
+    {
+        public Gtk.ListStore el;
+        private Xcls_GtkView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_ListStore9(Xcls_GtkView _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.ListStore( 1,   typeof(string) );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_column : Object 
+    {
+        public Gtk.TreeViewColumn el;
+        private Xcls_GtkView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_column(Xcls_GtkView _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.TreeViewColumn();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.title = "Compile output";
+            var child_0 = new Xcls_CellRendererText11( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_CellRendererText11 : Object 
+    {
+        public Gtk.CellRendererText el;
+        private Xcls_GtkView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_CellRendererText11(Xcls_GtkView _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.CellRendererText();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_ScrolledWindow12 : Object 
+    {
+        public Gtk.ScrolledWindow el;
+        private Xcls_GtkView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_ScrolledWindow12(Xcls_GtkView _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.ScrolledWindow( null, null );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_View13( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_View13 : Object 
+    {
+        public Gtk.SourceView el;
+        private Xcls_GtkView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_View13(Xcls_GtkView _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.SourceView();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.editable = false;
+            this.el.show_line_marks = true;
+            this.el.show_line_numbers = true;
+        }
+
+        // user defined functions 
+    }
+}
diff --git a/old-javascript/Builder4/Main.vala b/old-javascript/Builder4/Main.vala
new file mode 100644 (file)
index 0000000..5ba0d7b
--- /dev/null
@@ -0,0 +1,35 @@
+/**
+ * Test the writer code...
+
+
+*/
+int main (string[] args) {
+    Gtk.init (ref args);
+
+       var app =  Builder4.Application.singleton();
+       GtkClutter.init (ref args);
+       new JsRender.Lang_Class();
+       GLib.Log.set_always_fatal(LogLevelFlags.LEVEL_ERROR | LogLevelFlags.LEVEL_CRITICAL); 
+       Project.Project.loadAll();
+       /*var proj = Project.Project.getProject("Pman.Core");
+       if (proj == null) {
+               print("could not load test project Pman.Core");
+               return 0;
+       }
+       proj.scanDirs();
+       */
+
+       var w = Xcls_MainWindow.singleton();
+       //w.ref();
+       //w.project = proj;
+       
+       w.el.show_all();
+       // it looks like showall after children causes segfault on ubuntu 14.4
+       w.initChildren();
+       w.hideViewEditing();
+       Gtk.main();
+    
+       
+       return 0;
+}
diff --git a/old-javascript/Builder4/MainWindow.bjs b/old-javascript/Builder4/MainWindow.bjs
new file mode 100644 (file)
index 0000000..ff1de13
--- /dev/null
@@ -0,0 +1,578 @@
+{
+    "name" : "MainWindow",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/MainWindow.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "items" : [
+        {
+            "listeners" : {
+                "delete_event" : "  (   event) => {\n    return false;\n}",
+                "destroy" : "() =>  {\n Xcls_MainWindow.singleton().no_windows--;\n \n if (Xcls_MainWindow.singleton().no_windows < 1) {\n\n     Gtk.main_quit();\n }\n}",
+                "show" : "  ( ) => {\n    // hide the file editing..\n   \n    //this.hideViewEditing();\n}"
+            },
+            "|             void hideAddListener" : "() {\n      _this.backbutton.el.hide();\n     _this.projectbutton.el.show(); \n          _this.projecteditbutton.el.show();\n         _this.editfilebutton.el.show();   \n     _this.addpropsview.el.save_easing_state();\n    var el = _this.rooview.el;\n    el.save_easing_state();\n\n    \n    el.set_scale(1.0f,1.0f);\n    _this.addpropsview.el.set_scale(0.0f,0.0f);\n    _this.state = \"edit\";\n\n \n    //_this.clutterfiles.loadProject(_this.project);\n\n    el.restore_easing_state();\n     _this.addpropsview.el.restore_easing_state();  \n  }",
+            "|        void initChildren" : " () {\n    // this needs putting in a better place..\n    \n    print(\"init children\");\n    this.left_tree = new Xcls_WindowLeftTree();\n    this.left_tree.ref();\n    this.left_tree.main_window = _this;\n    this.tree.el.pack_start(this.left_tree.el,true, true,0);\n    this.left_tree.el.show_all();\n   \n    this.left_tree.before_node_change.connect(() => {\n        if (this.state != \"codeedit\") {\n            this.left_props.finish_editing();\n            return true;\n        }\n        if (!this.code_editor.saveContents()) {\n            return false;\n        }\n        return false;\n    \n    });\n    \n    this.left_tree.node_selected.connect((sel) => {\n        \n        print(\"node_selected called %s\\n\", (sel == null) ? \"NULL\" : \"a value\");\n        \n        if (sel == null) {\n            this.left_props.el.hide();\n        } \n        this.left_props.el.show();\n        this.left_props.load(this.left_tree.getActiveFile(), sel);\n        switch (this.state) {\n            case \"object\": \n                  \n                 if (sel == null) {\n                    this.rightpalete.clear();\n                    break;\n                }\n                this.rightpalete.load(_this.left_tree.getActiveFile().palete(), sel.fqn());\n                break;\n                 \n                \n           case \"addprop\":\n                if (sel == null) {\n                    this.add_props.clear();\n                    break;\n                }\n                this.add_props.show(_this.left_tree.getActiveFile().palete(), \"props\", sel.fqn());\n                break;\n                \n           case \"addlistener\":\n                if (sel == null) {\n                    this.add_props.clear();\n                    break;\n                }\n                this.add_props.show(_this.left_tree.getActiveFile().palete(), \"signals\", sel.fqn());\n                break;\n\n           case \"codeedit\":\n               \n                this.hideCodeEdit();\n                break;\n               \n                                \n        }\n        return  ;\n          \n    });\n    \n     this.left_tree.changed.connect(() => {\n       this.window_rooview.requestRedraw();\n       this.left_tree.model.file.save();\n    });\n     \n    \n\n    // left properties\n\n    this.left_props =new Xcls_LeftProps();\n    this.left_props.ref();\n    this.left_props.main_window = _this;\n    this.props.el.pack_start(this.left_props.el,true, true,0);\n    this.left_props.el.show_all();\n    \n    this.left_props.show_editor.connect( (file, node, type,  key) => {\n        this.showCodeEdit(file, node, type,  key);\n    });\n    this.left_props.stop_editor.connect( () => {\n        if (this.state != \"codeedit\") {\n            return true;\n        }\n    \n        var ret =  this.code_editor.saveContents();\n        if (!ret) {\n            return false;\n        }\n        this.hideCodeEdit();\n        return ret;\n    });\n     this.left_props.changed.connect(() => {\n          if (this.left_tree.getActiveFile().xtype == \"Roo\" ) {\n               this.window_rooview.requestRedraw();\n               \n           } else {\n              this.window_gladeview.loadFile(this.left_tree.getActiveFile());\n          }\n          this.left_tree.model.updateSelected();\n          this.left_tree.model.file.save();\n    });\n    \n\n\n\n    // left projects..\n     this.left_projects = new Xcls_WindowLeftProjects();\n     this.left_projects.ref();\n     this.leftpane.el.pack_start(this.left_projects.el,true, true,0);\n     this.left_projects.el.show_all();\n     this.left_projects.project_selected.connect((proj) => {\n        proj.scanDirs();\n        _this.clutterfiles.loadProject(proj);\n    \n     });\n    \n   \n    // project edit..\n    this.projectsettings  =new Xcls_ProjectSettings();\n    this.projectsettings.ref();  /// really?\n    \n    this.vala_projectsettings  =new ValaProjectSettings();\n    this.vala_projectsettings.ref();\n    this.vala_projectsettings.window = this;\n    \n    ((Gtk.Container)(this.projecteditview.el.get_widget())).add(this.projectsettings.el);\n    //this.projectsettings.el.show_all();\n\n    var stage = _this.projecteditview.el.get_stage();\n    stage.set_background_color(  Clutter.Color.from_string(\"#000\"));\n    \n     this.projectsettings.buttonPressed.connect((btn) => {\n         if (this.left_tree.getActiveFile().xtype == \"Roo\" ) {\n         \n            if (btn == \"save\") {\n                 _this.window_rooview.view.renderJS(true);\n            }\n            if (btn == \"apply\") {\n                _this.window_rooview.view.renderJS(true);\n                return;\n            }\n        } else {\n            // do nothing for gtk..\n        }\n        if (btn == \"save\" || btn == \"apply\") {\n            _this.project.save();\n \n        }\n        \n        this.hideProjectEdit();\n         \n     });\n    \n    \n    // objects (palate..)\n    this.rightpalete  = new Xcls_RightPalete();\n    this.rightpalete.ref();  /// really?\n    ((Gtk.Container)(this.objectview.el.get_widget())).add(this.rightpalete.el);\n    //this.projectsettings.el.show_all();\n\n    stage = _this.objectview.el.get_stage();\n    stage.set_background_color(  Clutter.Color.from_string(\"#000\"));\n    \n    /*this.projectsettings.buttonPressed.connect((btn) => {\n        if (btn == \"save\") {\n             _this.window_rooview.view.renderJS(true);\n        }\n        if (btn == \"apply\") {\n            _this.window_rooview.view.renderJS(true);\n            return;\n        }\n        this.hideProjectEdit();\n         \n     });\n    */\n    \n    \n      \n    // Add properties\n    this.add_props  = new Xcls_WindowAddProp();\n    this.add_props.ref();  /// really?\n    ((Gtk.Container)(this.addpropsview.el.get_widget())).add(this.add_props.el);\n    //this.projectsettings.el.show_all();\n\n    stage = _this.addpropsview.el.get_stage();\n    stage.set_background_color(  Clutter.Color.from_string(\"#000\"));\n    \n    \n    _this.add_props.select.connect( (key,type,skel, etype) => {\n        this.left_props.addProp(etype, key, skel, type);\n    });\n    \n    // editor\n    \n    \n    this.code_editor  = new  Editor();\n    this.code_editor.ref();  /// really?\n    ((Gtk.Container)(this.codeeditview.el.get_widget())).add(this.code_editor.el);\n    //this.projectsettings.el.show_all();\n\n    stage = _this.codeeditview.el.get_stage();\n    stage.set_background_color(  Clutter.Color.from_string(\"#000\"));\n    // editor.save...\n\n    _this.code_editor.save.connect( () => {\n        this.left_tree.model.file.save();\n         this.left_tree.model.updateSelected();\n    });\n    \n     \n    \n    \n    //  roo view\n    \n     this.window_rooview  =new Xcls_WindowRooView();\n    this.window_rooview.ref();\n    ((Gtk.Container)(this.rooview.el.get_widget())).add(this.window_rooview.el);\n    this.window_rooview.el.show_all();\n\n    stage = _this.rooview.el.get_stage();\n    stage.set_background_color(  Clutter.Color.from_string(\"#000\"));\n    \n      \n    //  glade view\n    \n    this.window_gladeview  =new Xcls_GtkView();\n    this.window_gladeview.ref();\n\n    //((Gtk.Container)(this.rooview.el.get_widget())).add(this.window_gladeview.el);\n    ///this.window_gladeview.el.hide();\n\n   \n    \n    // clutter files\n    \n    \n    this.clutterfiles = new Xcls_ClutterFiles();\n    this.clutterfiles.ref();\n    stage.add_child(this.clutterfiles.el);\n    this.clutterfiles.el.show_all();\n\n\n    this.clutterfiles.open.connect((file) => { \n        _this.project = file.project;\n        _this.showViewEditing();\n        this.left_tree.model.loadFile(file);\n        var ctr= ((Gtk.Container)(this.rooview.el.get_widget()));\n        var ctr_p= ((Gtk.Container)(this.projecteditview.el.get_widget()));\n        if (file.xtype == \"Roo\" ) { \n            ctr.foreach( (w) => { ctr.remove(w); });\n            ctr_p.foreach( (w) => { ctr_p.remove(w); });\n            ctr.add(this.window_rooview.el);\n            ctr_p.add(this.projectsettings.el);            \n            this.window_rooview.loadFile(file);\n            this.window_rooview.el.show_all();\n            this.projectsettings.el.show_all();            \n            \n        } else {\n            ctr.foreach( (w) => { ctr.remove(w); });\n            ctr_p.foreach( (w) => { ctr_p.remove(w); });            \n            ctr.add(this.window_gladeview.el);\n            ctr_p.add(this.vala_projectsettings.el);\n            this.window_gladeview.loadFile(file);\n            this.window_gladeview.el.show_all();\n            this.vala_projectsettings.el.show_all();\n        }\n        print(\"OPEN : \" + file.name);\n        _this.editpane.el.set_position(_this.editpane.el.max_position);\n         \n\n    });\n\n    // new file dialog\n    this.new_file_dialog = new Xcls_DialogNewComponent();\n    // force it modal to the main window..\n    this.new_file_dialog.el.set_transient_for(this.el);\n    this.new_file_dialog.el.set_modal(true);\n    \n    this.new_file_dialog.success.connect((project,file) =>\n    {\n        _this.project = project;\n        _this.showViewEditing();\n        this.left_tree.model.loadFile(file);\n        var ctr= ((Gtk.Container)(this.rooview.el.get_widget()));\n        var ctr_p= ((Gtk.Container)(this.projecteditview.el.get_widget()));\n        if (file.xtype == \"Roo\" ) { \n            ctr.foreach( (w) => { ctr.remove(w); });\n            ctr_p.foreach( (w) => { ctr_p.remove(w); });\n            ctr.add(this.window_rooview.el);\n            ctr_p.add(this.projectsettings.el);            \n            this.window_rooview.loadFile(file);\n            this.window_rooview.el.show_all();\n            this.projectsettings.el.show_all();  \n            \n            \n        } else {\n            ctr.foreach( (w) => { ctr.remove(w); });\n            ctr_p.foreach( (w) => { ctr_p.remove(w); });            \n            ctr.add(this.window_gladeview.el);\n            ctr_p.add(this.vala_projectsettings.el);\n            this.window_gladeview.loadFile(file);\n            this.window_gladeview.el.show_all();\n            this.vala_projectsettings.el.show_all();\n        }\n    \n    });\n    \n     \n\n    //w.el.show_all();\n    var tl = new Clutter.Timeline(6000);\n    tl.set_repeat_count(-1);\n    tl.start();\n    tl.ref();\n\n    this.children_loaded = true;\n\n\n\n\n}\n",
+            "# int no_windows" : 1,
+            "# Project.Project project" : "null",
+            "# bool children_loaded" : false,
+            "|             void hideCodeEdit" : "() {\n    //this.code_editor.saveContents();\n     _this.backbutton.el.hide();\n      _this.projectbutton.el.show(); \n       _this.projecteditbutton.el.show();\n       _this.editfilebutton.el.show();   \n     _this.codeeditview.el.save_easing_state();\n    var el = _this.rooview.el;\n    el.save_easing_state();\n\n    \n    el.set_scale(1.0f,1.0f);\n    _this.codeeditview.el.set_scale(0.0f,0.0f);\n    _this.state = \"edit\";\n\n \n    //_this.clutterfiles.loadProject(_this.project);\n\n    el.restore_easing_state();\n     _this.codeeditview.el.restore_easing_state();  \n }",
+            "|             void showAddProp" : "() {\n\n     \n     var ae =      this.left_tree.getActiveElement();\n    if (ae == null) {\n        return;\n    }\n     _this.backbutton.el.show();\n       _this.projectbutton.el.hide();\n    _this.editfilebutton.el.hide();\n    _this.projecteditbutton.el.hide();    \n    \n     \n     \n    //this.rooview.el.hide();\n    this.add_props.el.show_all();\n    this.add_props.show(\n        Palete.factory(this.project.xtype), \n        \"props\",\n        ae.fqn()\n    );\n\n    _this.addpropsview.el.save_easing_state();\n        \n    var el = _this.rooview.el;\n    el.save_easing_state();\n    _this.clutterembed.setSizesAlloc(\"addprop\");\n     \n     \n\n    _this.addpropsview.el.set_scale(1.0f,1.0f);\n   \n   \n \n    //_this.clutterfiles.loadProject(_this.project);\n\n    el.restore_easing_state();\n    _this.addpropsview.el.restore_easing_state();\n    this.state = \"addprop\";\n}",
+            "|             void showViewEditing" : "  ( )  {\n     this.editpane.el.show();\n  //   this.rooview.el.show();\n     this.left_projects.el.hide();\n    \n    _this.addprojectbutton.el.hide();   \n    _this.delprojectbutton.el.hide();\n    _this.addfilebutton.el.hide();       \n    _this.backbutton.el.hide();\n   _this.new_window.el.hide();      \n        \n        \n      _this.projectbutton.el.show();         \n    _this.editfilebutton.el.show();   \n   _this.projecteditbutton.el.show();\n  _this.objectshowbutton.el.show();\n  _this.addpropbutton.el.show();      \n  _this.addlistenerbutton.el.show();   \n\n      \n    var el = _this.rooview.el;\n        el.save_easing_state();\n  \n    \n        el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 0.0f);\n        el.set_scale(1.0f,1.0f);\n        _this.state = \"edit\";\n       // _this.mainpane.el.set_position(_this.leftpane.lastWidth);\n        _this.clutterfiles.el.hide();\n    \n    el.restore_easing_state();\n        \n    print(\"show view editing\");\n}",
+            "border_width" : 0,
+            "|             void hideProjectEdit" : " () {\n    // return to editing state..\n       \n      _this.projectbutton.el.show();\n     _this.projecteditbutton.el.show();\n      _this.backbutton.el.hide();\n         _this.editfilebutton.el.show();   \n\n     \n       if (this.project.xtype == \"Roo\") {\n        \n        //this.projectsettings.show(this.project);\n    } else {\n\n        this.vala_projectsettings.project.writeConfig();\n    }\n    _this.projecteditview.el.save_easing_state();\n    var el = _this.rooview.el;\n    el.save_easing_state();\n\n    \n    el.set_scale(1.0f,1.0f);\n       _this.projecteditview.el.set_scale(1.0f,0.0f);\n    _this.state = \"edit\";\n\n \n    //_this.clutterfiles.loadProject(_this.project);\n\n    el.restore_easing_state();\n      _this.projecteditview.el.restore_easing_state();  \n  \n}\n",
+            "default_height" : 500,
+            "# Xcls_WindowLeftProjects left_projects" : "null",
+            "id" : "MainWindow",
+            "|             void showProjectEdit" : " () {\n    // make the browser smaller, and show the edit dialog\n    \n    \n     _this.projectbutton.el.hide();\n     _this.projecteditbutton.el.hide();\n     _this.editfilebutton.el.hide();\n     \n    _this.backbutton.el.show();\n     \n    //this.rooview.el.hide();\n    \n    \n    if (this.project.xtype == \"Roo\") {\n        this.projectsettings.el.show_all();\n        this.projectsettings.show(this.project);\n    } else {\n        this.vala_projectsettings.el.show_all();\n        this.vala_projectsettings.show((Project.Gtk)this.project);\n    }\n    _this.projecteditview.el.save_easing_state();\n        \n    var el = _this.rooview.el;\n    el.save_easing_state();\n   \n    \n    el.set_scale(0.5f,0.5f);\n\n    _this.projecteditview.el.set_scale(1.0f,1.0f);\n   \n    _this.state = \"projectedit\";\n     \n \n    //_this.clutterfiles.loadProject(_this.project);\n\n    el.restore_easing_state();\n    _this.projecteditview.el.restore_easing_state();\n  //  print(\"show view browsing\");\n    \n}\n",
+            "# Xcls_WindowRooView window_rooview" : "null",
+            "|             void showAddListener" : "() {\n\n     \n     \n    var ae =      this.left_tree.getActiveElement();\n    if (ae == null) {\n        return;\n    }\n     \n   _this.backbutton.el.show();\n    _this.projectbutton.el.hide();\n    _this.editfilebutton.el.hide();\n    _this.projecteditbutton.el.hide();    \n    \n    \n    //this.rooview.el.hide();\n    this.add_props.el.show_all();\n    this.add_props.show(\n        Palete.factory(this.project.xtype), \n        \"signals\",\n        ae.fqn()\n    );\n    //this.rightpalete.show(this.project);\n\n    _this.addpropsview.el.save_easing_state();\n        \n    var el = _this.rooview.el;\n    el.save_easing_state();\n   \n      _this.clutterembed.setSizesAlloc(\"addlistener\");\n\n    \n  \n\n    _this.addpropsview.el.set_scale(1.0f,1.0f);\n   \n   \n \n    //_this.clutterfiles.loadProject(_this.project);\n\n    el.restore_easing_state();\n    _this.addpropsview.el.restore_easing_state();\n    this.state = \"addlistener\";\n}",
+            "default_width" : 800,
+            "xtype" : "Window",
+            "$ type" : "Gtk.WindowType.TOPLEVEL",
+            "|             void hideAddProp" : "() {\n      _this.backbutton.el.hide();\n     _this.projectbutton.el.show(); \n          _this.projecteditbutton.el.show();\n         _this.editfilebutton.el.show();   \n     _this.addpropsview.el.save_easing_state();\n     \n    var el = _this.rooview.el;\n    el.save_easing_state();\n\n    \n    el.set_scale(1.0f,1.0f);\n    _this.addpropsview.el.set_scale(0.0f,0.0f);\n    _this.state = \"edit\";\n\n \n    //_this.clutterfiles.loadProject(_this.project);\n\n    el.restore_easing_state();\n     _this.addpropsview.el.restore_easing_state();  \n }",
+            "# Xcls_WindowLeftTree left_tree" : "null",
+            "# Editor code_editor" : "null",
+            "|             void showCodeEdit" : "(JsRender.JsRender file, JsRender.Node node, string ptype, string key)\n{\n    // this is a bit different,\n    // it's not called via a button - but triggered by the prop edit class signal.\n    // so it has to hide any other state..\n    \n    switch(this.state) {\n        case \"object\":\n            this.hideObject();\n            break;\n        case \"addprop\":\n            this.hideAddProp();\n            break;\n        case \"addlistener\":\n            this.hideAddListener();\n            break;\n    }\n \n   _this.backbutton.el.show();\n   \n    _this.projectbutton.el.hide();\n    _this.editfilebutton.el.hide();\n    _this.projecteditbutton.el.hide();    \n   // more?? \n     \n    //this.rooview.el.hide();\n    this.code_editor.el.show_all();\n    this.code_editor.show(\n        file,\n        node,\n        ptype,\n        key\n    );\n\n    _this.codeeditview.el.save_easing_state();\n        \n    var el = _this.rooview.el;\n    el.save_easing_state();\n    _this.clutterembed.setSizesAlloc(\"codedit\");\n   \n    _this.codeeditview.el.set_scale(1.0f,1.0f);\n   \n   \n \n    //_this.clutterfiles.loadProject(_this.project);\n\n    el.restore_easing_state();\n    _this.codeeditview.el.restore_easing_state();\n    this.state = \"codeedit\";\n}\n",
+            "# Xcls_DialogNewComponent new_file_dialog" : "null",
+            "# Xcls_ProjectSettings projectsettings" : "null",
+            "|             void setTitle" : " (string str) {\n    this.el.set_title(this.title + \" - \" + str);\n}\n",
+            "|             void show" : "() {\n    this.left_tree =new Xcls_WindowLeftTree();\n    _this.vbox.el.pack_start(this.left_tree.el,true, true,0);\n    this.el.show_all();\n\n}",
+            "$ xns" : "Gtk",
+            "# Xcls_ClutterFiles clutterfiles" : "null",
+            "# Xcls_LeftProps left_props" : "null",
+            "# string state" : "",
+            "|             void hideViewEditing" : "  ( )   {\n\n// show the file navigation...\n  \n    if (this.left_tree.getActiveFile() != null) {\n         if (this.left_tree.getActiveFile().xtype == \"Roo\" ) {\n             this.window_rooview.createThumb();\n         } else {\n              this.window_gladeview.createThumb();\n          }\n      }\n      \n    _this.addprojectbutton.el.show();   \n    _this.addfilebutton.el.show();       \n      _this.backbutton.el.show();\n    _this.delprojectbutton.el.show();\n      _this.new_window.el.show();  \n          \n      _this.editfilebutton.el.hide();   \n      _this.projectbutton.el.hide();         \n      _this.projecteditbutton.el.hide();\n      _this.objectshowbutton.el.hide();\n      _this.addpropbutton.el.hide();      \n      _this.addlistenerbutton.el.hide();  \n\n\n\n\n          \n    // show the add file button..\n    \n          \n      \n     this.editpane.el.hide();\n    //this.rooview.el.hide();\n     this.left_projects.el.show();\n    \n    var el = _this.rooview.el;\n    el.save_easing_state();\n      el.set_easing_duration(1000);\n    // show project / file view..\n    //_this.mainpane.lastWidth = _this.leftpane.el.get_position();\n    //_this.mainpane.el.set_position(0);\n    // rotate y 180..\n    el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 360.0f);\n    el.set_scale(0.0f,0.0f);\n   \n        _this.state = \"files\";\n    if (_this.project != null) {\n        _this.left_projects.selectProject(_this.project);\n        }\n    //_this.clutterfiles.loadProject(_this.project);\n\n    el.restore_easing_state();\n        \n    print(\"show view browsing\");\n}",
+            "# Xcls_RightPalete rightpalete" : "null",
+            "# string title" : "\"Application Builder\"",
+            "# ValaProjectSettings vala_projectsettings" : "null",
+            "# Xcls_WindowAddProp add_props" : "null",
+            "|             void showObject" : "() {\n\n     \n    // what's the active node on the left hand side..\n    \n    var n = _this.left_tree.getActiveElement();\n\n    if (_this.left_tree.model.file == null) {\n        return;\n    }\n    \n    if (n == null && _this.left_tree.model.file.tree != null) {\n        return;\n    }\n    \n     _this.backbutton.el.show();\n       _this.projectbutton.el.hide();\n    _this.editfilebutton.el.hide();\n    _this.projecteditbutton.el.hide();    \n    \n     \n    //this.rooview.el.hide();\n    this.rightpalete.el.show_all();\n    this.rightpalete.load(_this.left_tree.getActiveFile().palete(), n == null ? \"*top\" : n.fqn());\n\n    \n    //this.rightpalete.show(this.project);\n\n    _this.objectview.el.save_easing_state();\n        \n    var el = _this.rooview.el;\n    el.save_easing_state();\n   \n     _this.clutterembed.setSizesAlloc(\"object\");\n    \n\n    _this.objectview.el.set_scale(1.0f,1.0f);\n   \n   \n \n    //_this.clutterfiles.loadProject(_this.project);\n\n    el.restore_easing_state();\n    _this.objectview.el.restore_easing_state();\n    this.state = \"object\";\n}",
+            "* init" : " this.state = \"files\";\n\t  \n    //this.el.show_all();\n    \n    ",
+            "|             void hideObject" : "() {\n      // return to editing state..\n       \n          _this.projecteditbutton.el.show();\n      _this.backbutton.el.hide();\n     _this.projectbutton.el.show(); \n         _this.editfilebutton.el.show();   \n     _this.objectview.el.save_easing_state();\n    var el = _this.rooview.el;\n    el.save_easing_state();\n\n    \n    el.set_scale(1.0f,1.0f);\n    _this.objectview.el.set_scale(0.0f,0.0f);\n    _this.state = \"edit\";\n\n \n    //_this.clutterfiles.loadProject(_this.project);\n\n    el.restore_easing_state();\n     _this.objectview.el.restore_easing_state();  \n \n\n}",
+            "# Xcls_GtkView window_gladeview" : "null",
+            "items" : [
+                {
+                    "id" : "vbox",
+                    "* pack" : "add",
+                    "xtype" : "VBox",
+                    "$ xns" : "Gtk",
+                    "$ homogeneous" : false,
+                    "items" : [
+                        {
+                            "id" : "mainpane",
+                            "position" : 400,
+                            "* pack" : "pack_end,true,true,0",
+                            "# int lastWidth" : 0,
+                            "xtype" : "HPaned",
+                            "$ xns" : "Gtk",
+                            "items" : [
+                                {
+                                    "id" : "leftpane",
+                                    "xtype" : "VBox",
+                                    "* pack" : "add1",
+                                    "$ xns" : "Gtk",
+                                    "items" : [
+                                        {
+                                            "id" : "editpane",
+                                            "xtype" : "VPaned",
+                                            "* pack" : "pack_start,false,true,0",
+                                            "$ xns" : "Gtk",
+                                            "items" : [
+                                                {
+                                                    "id" : "tree",
+                                                    "xtype" : "VBox",
+                                                    "* pack" : "add1",
+                                                    "$ xns" : "Gtk"
+                                                },
+                                                {
+                                                    "id" : "props",
+                                                    "xtype" : "VBox",
+                                                    "* pack" : "add2",
+                                                    "$ xns" : "Gtk"
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                },
+                                {
+                                    "* pack" : "add2",
+                                    "xtype" : "VBox",
+                                    "$ xns" : "Gtk",
+                                    "items" : [
+                                        {
+                                            "listeners" : {
+                                                "size_allocate" : "  (  alloc) => {\n    this.setSizes(alloc, _this.state); \n        \n}"
+                                            },
+                                            "id" : "clutterembed",
+                                            "* init" : "    var stage = this.el.get_stage();\n    stage.set_background_color(  Clutter.Color.from_string(\"#000\"));\n    \n    \n",
+                                            "xtype" : "Embed",
+                                            "* pack" : "pack_start,true,true,0",
+                                            "|           void setSizes" : "  (  Gtk.Allocation alloc, string state) {\n    if (!_this.children_loaded) {  return; }\n     \n    _this.clutterfiles.set_size(alloc.width-50, alloc.height);\n    \n    // project view appears at top...\n    \n    _this.projecteditview.el.set_size(alloc.width-50, alloc.height / 2.0f);\n           \n           \n    \n    var avail = alloc.width < 50.0f ? 0 :  alloc.width - 50.0f;\n \n    \n    var palsize = avail < 300.0f ? avail : 300.0f;\n    print(\"set palsize size %f\\n\", palsize);\n   // palate / props : fixed 300 pix\n            \n    _this.objectview.el.set_size(palsize, alloc.height);    \n    _this.addpropsview.el.set_size(palsize, alloc.height);\n    \n     \n    \n    // code edit min 600\n    \n    var codesize = avail < 800.0f ? avail : 800.0f;\n    print(\"set code size %f\\n\", codesize);\n\n    _this.codeeditview.el.set_size(codesize, alloc.height);\n    _this.rooview.el.set_size(alloc.width-50, alloc.height);    \n   \n    switch ( state) {\n        case \"codeedit\": \n\n\tvar scale = avail > 0.0f ? (avail - codesize -10 ) / avail : 0.0f;\n\t\n\t\n           _this.rooview.el.set_scale(scale,scale);\n           break;\n        case \"addprop\":\n        case \"addlistener\":        \n          case \"object\":   \n\tvar scale = avail > 0.0f ? (avail - palsize -10 ) / avail : 0.0f;\n           _this.rooview.el.set_scale(scale,scale);\n           break;\n    }\n        \n}",
+                                            "$ xns" : "GtkClutter",
+                                            "|           void setSizesAlloc" : "(string state) {\n\n    Gtk.Allocation alloc;\n    this.el.get_allocation(out alloc);\n    this.setSizes(alloc, state);\n}\n",
+                                            "items" : [
+                                                {
+                                                    "id" : "rooview",
+                                                    "* init" : "{\n   \n   \n    this.el.add_constraint(\n        new Clutter.AlignConstraint(\n            _this.clutterembed.el.get_stage(), \n            Clutter.AlignAxis.X_AXIS,\n            1.0f\n        )\n    );\n        \n    //this.el.set_position(100,100);\n    this.el.set_pivot_point(1.0f,1.0f);\n    \n    this.el.set_size(_this.clutterembed.el.get_stage().width-50,\n            _this.clutterembed.el.get_stage().height);\n            \n}",
+                                                    "xtype" : "Actor",
+                                                    "* pack" : "get_stage().add_child",
+                                                    "$ xns" : "GtkClutter"
+                                                },
+                                                {
+                                                    "id" : "objectview",
+                                                    "* init" : "{\n   \n   /*\n    this.el.add_constraint(\n        new Clutter.AlignConstraint(\n            _this.clutterembed.el.get_stage(), \n            Clutter.AlignAxis.X_AXIS,\n            0.0f\n        )\n    );\n    */\n    this.el.fixed_x = 50.0f;\n    this.el.fixed_y = 0.0f;\n    //this.el.set_position(100,100);\n    this.el.set_pivot_point(0.0f,0.0f);\n    this.el.set_scale(0.0f,1.0f);\n    this.el.set_size((_this.clutterembed.el.get_stage().width-50)/2,\n            _this.clutterembed.el.get_stage().height);\n            \n}",
+                                                    "xtype" : "Actor",
+                                                    "* pack" : "get_stage().add_child",
+                                                    "$ xns" : "GtkClutter"
+                                                },
+                                                {
+                                                    "id" : "codeeditview",
+                                                    "* init" : "{\n   \n   /*\n    this.el.add_constraint(\n        new Clutter.AlignConstraint(\n            _this.clutterembed.el.get_stage(), \n            Clutter.AlignAxis.X_AXIS,\n            0.0f\n        )\n    );\n    */\n    this.el.fixed_x = 50.0f;\n    this.el.fixed_y = 0.0f;\n    //this.el.set_position(100,100);\n    this.el.set_pivot_point(0.0f,0.0f);\n    this.el.set_scale(0.0f,1.0f);\n    this.el.set_size((_this.clutterembed.el.get_stage().width-50)/2,\n            _this.clutterembed.el.get_stage().height);\n            \n}",
+                                                    "xtype" : "Actor",
+                                                    "* pack" : "get_stage().add_child",
+                                                    "$ xns" : "GtkClutter"
+                                                },
+                                                {
+                                                    "id" : "addpropsview",
+                                                    "* init" : "{\n   \n   /*\n    this.el.add_constraint(\n        new Clutter.AlignConstraint(\n            _this.clutterembed.el.get_stage(), \n            Clutter.AlignAxis.X_AXIS,\n            0.0f\n        )\n    );\n    */\n    this.el.fixed_x = 50.0f;\n    this.el.fixed_y = 0.0f;\n    //this.el.set_position(100,100);\n    this.el.set_pivot_point(0.0f,0.0f);\n    this.el.set_scale(0.0f,1.0f);\n    this.el.set_size((_this.clutterembed.el.get_stage().width-50)/2,\n            _this.clutterembed.el.get_stage().height);\n            \n}",
+                                                    "xtype" : "Actor",
+                                                    "* pack" : "get_stage().add_child",
+                                                    "$ xns" : "GtkClutter"
+                                                },
+                                                {
+                                                    "id" : "projecteditview",
+                                                    "* init" : "{\n   \n   \n    this.el.add_constraint(\n        new Clutter.AlignConstraint(\n            _this.clutterembed.el.get_stage(), \n            Clutter.AlignAxis.X_AXIS,\n            1.0f\n        )\n    );\n        \n    //this.el.set_position(100,100);\n    this.el.set_pivot_point(0.0f,0.0f);\n    this.el.set_scale(1.0f,0.0f);\n    this.el.set_size(_this.clutterembed.el.get_stage().width-50,\n            _this.clutterembed.el.get_stage().height /2);\n            \n}",
+                                                    "xtype" : "Actor",
+                                                    "* pack" : "get_stage().add_child",
+                                                    "$ xns" : "GtkClutter"
+                                                },
+                                                {
+                                                    "id" : "buttonlayout",
+                                                    "* init" : "{\n    \n    this.el.add_constraint(\n        new Clutter.AlignConstraint(\n            _this.clutterembed.el.get_stage(), \n            Clutter.AlignAxis.X_AXIS,\n            0.0f\n        )\n    );\n     \n    \n    //this.el.set_position(100,100);\n    this.el.set_pivot_point(0.5f,0.5f);\n     this.el.set_size(50,\n           _this.clutterembed.el.get_stage().height);\n     \n}",
+                                                    "xtype" : "Actor",
+                                                    "* pack" : "get_stage().add_child",
+                                                    "$ xns" : "Clutter",
+                                                    "items" : [
+                                                        {
+                                                            "$ orientation" : "Clutter.Orientation.VERTICAL",
+                                                            "xtype" : "BoxLayout",
+                                                            "$ xns" : "Clutter",
+                                                            "* prop" : "layout_manager"
+                                                        },
+                                                        {
+                                                            "id" : "backbutton",
+                                                            "* init" : "this.el.set_size(50,50);",
+                                                            "xtype" : "Actor",
+                                                            "* pack" : "add_child",
+                                                            "$ xns" : "Clutter",
+                                                            "items" : [
+                                                                {
+                                                                    "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
+                                                                    "xtype" : "Actor",
+                                                                    "* pack" : "add_child",
+                                                                    "$ xns" : "GtkClutter",
+                                                                    "items" : [
+                                                                        {
+                                                                            "listeners" : {
+                                                                                "clicked" : "  ( ) => {\n    switch (_this.state) {\n        case \"edit\":\n        \n            _this.hideViewEditing();\n            break;  \n        case \"files\":\n            // should only occur if there is an active file..\n            _this.showViewEditing();\n            break; \n            \n          case \"addprop\":\n            _this.hideAddProp();\n\n            break;\n        case \"addlistener\":\n            _this.hideAddListener();\n\n            break;\n             \n         case \"object\":\n            _this.hideObject();\n            break;    \n         \n         case \"codeedit\":\n            \n            _this.hideCodeEdit();  \n            break;\n            \n         case  \"projectedit\":\n         // save?\n            _this.hideProjectEdit();\n            break;\n            \n        default:\n            break;\n    }\n    return  ;    \n\n}"
+                                                                            },
+                                                                            "utf8 tooltip_text" : "Back",
+                                                                            "* pack" : false,
+                                                                            "xtype" : "Button",
+                                                                            "width_request" : 50,
+                                                                            "$ xns" : "Gtk",
+                                                                            "height_request" : 50,
+                                                                            "items" : [
+                                                                                {
+                                                                                    "xtype" : "Image",
+                                                                                    "utf8 icon_name" : "go-previous",
+                                                                                    "* pack" : "set_image",
+                                                                                    "$ xns" : "Gtk"
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            "id" : "projectbutton",
+                                                            "* init" : "this.el.set_size(50,50);",
+                                                            "xtype" : "Actor",
+                                                            "* pack" : "add_child",
+                                                            "$ xns" : "Clutter",
+                                                            "items" : [
+                                                                {
+                                                                    "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
+                                                                    "* pack" : "add_child",
+                                                                    "xtype" : "Actor",
+                                                                    "$ xns" : "GtkClutter",
+                                                                    "items" : [
+                                                                        {
+                                                                            "listeners" : {
+                                                                                "clicked" : "  ( ) => {\n    switch (_this.state) {\n        case \"edit\":\n        \n            _this.hideViewEditing();\n            break;  \n        case \"files\":\n            _this.showViewEditing();\n            break; \n            \n          case \"addprop\":\n            _this.hideAddProp();\n            _this.hideViewEditing();\n            break;\n        case \"addlistener\":\n            _this.hideAddListener();\n            _this.hideViewEditing();\n            break;\n             \n         case \"object\":\n            _this.hideObject();\n            _this.hideViewEditing();\n            break;    \n            \n        default:\n            break;\n    }\n    return  ;    \n\n}"
+                                                                            },
+                                                                            "* pack" : false,
+                                                                            "xtype" : "Button",
+                                                                            "width_request" : 50,
+                                                                            "$ xns" : "Gtk",
+                                                                            "height_request" : 50,
+                                                                            "$ tooltop_text" : "\"Open File\"",
+                                                                            "items" : [
+                                                                                {
+                                                                                    "* pack" : "set_image",
+                                                                                    "xtype" : "Image",
+                                                                                    "utf8 icon_name" : "document-open",
+                                                                                    "$ xns" : "Gtk"
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            "id" : "editfilebutton",
+                                                            "* init" : "this.el.set_size(50.0f,50.0f);",
+                                                            "xtype" : "Actor",
+                                                            "* pack" : "add_child",
+                                                            "$ xns" : "Clutter",
+                                                            "items" : [
+                                                                {
+                                                                    "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
+                                                                    "* pack" : "add_child",
+                                                                    "xtype" : "Actor",
+                                                                    "$ xns" : "GtkClutter",
+                                                                    "items" : [
+                                                                        {
+                                                                            "listeners" : {
+                                                                                "clicked" : "  ( ) => {\n  \n    // create a new file in project..\n    if (_this.project == null || _this.left_tree.model.file == null) {\n        return  ;\n    }\n     \n    _this.new_file_dialog.show(_this.left_tree.model.file);\n    \n    return  ;    \n\n\n}"
+                                                                            },
+                                                                            "* pack" : false,
+                                                                            "xtype" : "Button",
+                                                                            "width_request" : 50,
+                                                                            "$ xns" : "Gtk",
+                                                                            "$ tooltip_text" : "\"File Details\"",
+                                                                            "height_request" : 50,
+                                                                            "items" : [
+                                                                                {
+                                                                                    "utf8 icon_name" : "document-properties",
+                                                                                    "* pack" : "set_image",
+                                                                                    "xtype" : "Image",
+                                                                                    "$ xns" : "Gtk"
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            "id" : "projecteditbutton",
+                                                            "* init" : "this.el.set_size(50,50);",
+                                                            "xtype" : "Actor",
+                                                            "* pack" : "add_child",
+                                                            "$ xns" : "Clutter",
+                                                            "items" : [
+                                                                {
+                                                                    "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
+                                                                    "* pack" : "add_child",
+                                                                    "xtype" : "Actor",
+                                                                    "$ xns" : "GtkClutter",
+                                                                    "items" : [
+                                                                        {
+                                                                            "listeners" : {
+                                                                                "clicked" : "  ( ) => {\n    switch (_this.state) {\n        case \"edit\":\n            _this.showProjectEdit();\n            break;  \n        case \"files\":\n            // _this.showViewEditing();\n            break; \n        case \"projectedit\":\n            _this.hideProjectEdit();\n            break;\n            \n            \n              \n        case \"addprop\":\n            _this.hideAddProp();\n            _this.showProjectEdit();\n            break;\n        case \"addlistener\":\n            _this.hideAddListener();\n            _this.showProjectEdit();\n            break;\n             \n         case \"object\":\n            _this.hideObject();\n            _this.showProjectEdit();    \n            break;\n        default:\n            break;\n    }\n    return  ;    \n\n\n}"
+                                                                            },
+                                                                            "* pack" : false,
+                                                                            "xtype" : "Button",
+                                                                            "width_request" : 50,
+                                                                            "$ xns" : "Gtk",
+                                                                            "$ tooltip_text" : "\"Project Details\"",
+                                                                            "height_request" : 50,
+                                                                            "items" : [
+                                                                                {
+                                                                                    "xtype" : "Image",
+                                                                                    "utf8 icon_name" : "emblem-system",
+                                                                                    "* pack" : "set_image",
+                                                                                    "$ xns" : "Gtk"
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            "listeners" : {
+                                                                "button_press_event" : "  ( ) => {\n    \n    \n    \n    switch (_this.state) {\n\n \n        case \"addprop\":\n            _this.hideAddProp();\n            _this.showObject();\n            break;\n    case \"addlistener\":\n            _this.hideAddListener();\n            _this.showObject();\n            break;\n\n// show            \n        case \"edit\":\n            _this.showObject();\n            break;\n            \n// hide            \n        case \"object\":\n            _this.hideObject();\n            break;\n            break;\n                        \n        default:\n            print(\"unhandled add objects from %s\\n\",_this.state);\n            break;\n    }\n    return false;    \n\n\n}",
+                                                                "enter_event" : "(  event)  => {\n    this.el.background_color = new Clutter.Color.from_string(\"#333\");\n        return false;\n}",
+                                                                "leave_event" : "(  event)  => {\n    this.el.background_color = new Clutter.Color.from_string(\"#000\");\n    return false;\n}"
+                                                            },
+                                                            "id" : "objectshowbutton",
+                                                            "* init" : "this.el.set_size(50,50);",
+                                                            "xtype" : "Actor",
+                                                            "* pack" : "add_child",
+                                                            "$ xns" : "Clutter",
+                                                            "items" : [
+                                                                {
+                                                                    "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
+                                                                    "* pack" : "add_child",
+                                                                    "xtype" : "Actor",
+                                                                    "$ xns" : "GtkClutter",
+                                                                    "items" : [
+                                                                        {
+                                                                            "listeners" : {
+                                                                                "clicked" : "  ( ) => {\n    \n    \n    \n    switch (_this.state) {\n\n \n        case \"addprop\":\n            _this.hideAddProp();\n            _this.showObject();\n            break;\n    case \"addlistener\":\n            _this.hideAddListener();\n            _this.showObject();\n            break;\n\n// show            \n        case \"edit\":\n            _this.showObject();\n            break;\n            \n// hide            \n        case \"object\":\n            _this.hideObject();\n            break;\n            break;\n                        \n        default:\n            print(\"unhandled add objects from %s\\n\",_this.state);\n            break;\n    }\n    return  ;    \n\n\n}"
+                                                                            },
+                                                                            "* pack" : false,
+                                                                            "xtype" : "Button",
+                                                                            "width_request" : 50,
+                                                                            "$ xns" : "Gtk",
+                                                                            "$ tooltip_text" : "\"Add Child Element\"",
+                                                                            "height_request" : 50,
+                                                                            "items" : [
+                                                                                {
+                                                                                    "* pack" : "set_image",
+                                                                                    "xtype" : "Image",
+                                                                                    "utf8 icon_name" : "list-add",
+                                                                                    "$ xns" : "Gtk"
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            "id" : "addpropbutton",
+                                                            "* init" : "this.el.set_size(50,50);",
+                                                            "xtype" : "Actor",
+                                                            "* pack" : "add_child",
+                                                            "$ xns" : "Clutter",
+                                                            "items" : [
+                                                                {
+                                                                    "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
+                                                                    "* pack" : "add_child",
+                                                                    "xtype" : "Actor",
+                                                                    "$ xns" : "GtkClutter",
+                                                                    "items" : [
+                                                                        {
+                                                                            "listeners" : {
+                                                                                "clicked" : "  ( ) => {\n    \n    \n    \n    switch (_this.state) {\n        case \"edit\":\n            _this.showAddProp();\n            break;\n            \n        case \"object\":\n            _this.hideObject();\n            _this.showAddProp();\n            break;\n       \n        case \"addlistener\":\n            _this.hideAddListener();\n            _this.showAddProp();            \n            break;\n            \n            \n        case \"addprop\":\n            _this.hideAddProp();\n            break;\n            \n        default:\n            print(\"unhandled add property from %s\\n\",_this.state);\n            break;\n            \n    }\n    return  ;    \n\n\n}"
+                                                                            },
+                                                                            "* pack" : false,
+                                                                            "xtype" : "Button",
+                                                                            "width_request" : 50,
+                                                                            "$ xns" : "Gtk",
+                                                                            "$ tooltip_text" : "\"Add Property\"",
+                                                                            "height_request" : 50,
+                                                                            "items" : [
+                                                                                {
+                                                                                    "utf8 icon_name" : "format-justify-left",
+                                                                                    "* pack" : "set_image",
+                                                                                    "xtype" : "Image",
+                                                                                    "$ xns" : "Gtk"
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            "id" : "addlistenerbutton",
+                                                            "* init" : "this.el.set_size(50,50);",
+                                                            "xtype" : "Actor",
+                                                            "* pack" : "add_child",
+                                                            "$ xns" : "Clutter",
+                                                            "items" : [
+                                                                {
+                                                                    "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
+                                                                    "* pack" : "add_child",
+                                                                    "xtype" : "Actor",
+                                                                    "$ xns" : "GtkClutter",
+                                                                    "items" : [
+                                                                        {
+                                                                            "listeners" : {
+                                                                                "clicked" : "  ( ) => {\n    \n    \n    \n    switch (_this.state) {\n        case \"edit\":\n            _this.showAddListener();\n            break;\n            \n       \n        case \"addlistener\":\n            _this.hideAddListener();\n            break;\n\n            \n        case \"addprop\":\n            _this.hideAddProp();\n            _this.showAddListener();\n            break;\n         case \"object\":\n            _this.hideObject();\n            _this.showAddListener();\n            break;\n    \n          default:\n            print(\"unhandled add listener from %s\\n\",_this.state);\n\n            break;\n            \n    }\n    return  ;    \n\n\n}"
+                                                                            },
+                                                                            "* pack" : false,
+                                                                            "xtype" : "Button",
+                                                                            "width_request" : 50,
+                                                                            "$ xns" : "Gtk",
+                                                                            "$ tooltip_text" : "\"Add Event Code\"",
+                                                                            "height_request" : 50,
+                                                                            "items" : [
+                                                                                {
+                                                                                    "xtype" : "Image",
+                                                                                    "utf8 icon_name" : "appointment-new",
+                                                                                    "* pack" : "set_image",
+                                                                                    "$ xns" : "Gtk"
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            "id" : "addprojectbutton",
+                                                            "* init" : "this.el.set_size(50.0f,50.0f);",
+                                                            "xtype" : "Actor",
+                                                            "* pack" : "add_child",
+                                                            "$ xns" : "Clutter",
+                                                            "items" : [
+                                                                {
+                                                                    "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
+                                                                    "* pack" : "add_child",
+                                                                    "xtype" : "Actor",
+                                                                    "$ xns" : "GtkClutter",
+                                                                    "items" : [
+                                                                        {
+                                                                            "listeners" : {
+                                                                                "clicked" : "  ( ) => {\n  \n    // create a new file in project..\n    //Xcls_DialogNewComponent.singleton().show(\n   var  pe =     Xcls_EditProject.singleton();\n    pe.el.set_transient_for(_this.el);\n    pe.el.set_modal(true);   \n   \n    var p  = pe.show();\n\n    if (p == null) {\n        return;\n    }\n    _this.left_projects.is_loaded = false;    \n    _this.left_projects.load();\n    _this.left_projects.selectProject(p);\n    return  ;    \n\n\n}"
+                                                                            },
+                                                                            "* pack" : false,
+                                                                            "xtype" : "Button",
+                                                                            "width_request" : 50,
+                                                                            "$ xns" : "Gtk",
+                                                                            "$ tooltip_text" : "\"New\\nProj.\"",
+                                                                            "height_request" : 50,
+                                                                            "items" : [
+                                                                                {
+                                                                                    "utf8 icon_name" : "folder-new",
+                                                                                    "* pack" : "set_image",
+                                                                                    "xtype" : "Image",
+                                                                                    "$ xns" : "Gtk"
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            "id" : "addfilebutton",
+                                                            "* init" : "this.el.set_size(50.0f,50.0f);",
+                                                            "xtype" : "Actor",
+                                                            "* pack" : "add_child",
+                                                            "$ xns" : "Clutter",
+                                                            "items" : [
+                                                                {
+                                                                    "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
+                                                                    "* pack" : "add_child",
+                                                                    "xtype" : "Actor",
+                                                                    "$ xns" : "GtkClutter",
+                                                                    "items" : [
+                                                                        {
+                                                                            "listeners" : {
+                                                                                "clicked" : " () => {\n    // create a new file in project..\n    \n    // what's the currently selected project...\n    var proj = _this.left_projects.getSelectedProject();\n    \n    if (proj == null) {\n        return  ;\n    }\n    \n    \n    \n    var f = JsRender.JsRender.factory(proj.xtype,  proj, \"\");\n    _this.project = proj;\n    _this.new_file_dialog.show(f);\n    \n    return  ;    \n}"
+                                                                            },
+                                                                            "* pack" : false,
+                                                                            "xtype" : "Button",
+                                                                            "width_request" : 50,
+                                                                            "$ xns" : "Gtk",
+                                                                            "$ tooltip_text" : "\"Add File\"",
+                                                                            "height_request" : 50,
+                                                                            "items" : [
+                                                                                {
+                                                                                    "* pack" : "set_image",
+                                                                                    "xtype" : "Image",
+                                                                                    "utf8 icon_name" : "document-new",
+                                                                                    "$ xns" : "Gtk"
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            "id" : "delprojectbutton",
+                                                            "* init" : "this.el.set_size(50,50);",
+                                                            "xtype" : "Actor",
+                                                            "* pack" : "add_child",
+                                                            "$ xns" : "Clutter",
+                                                            "items" : [
+                                                                {
+                                                                    "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
+                                                                    "* pack" : "add_child",
+                                                                    "xtype" : "Actor",
+                                                                    "$ xns" : "GtkClutter",
+                                                                    "items" : [
+                                                                        {
+                                                                            "listeners" : {
+                                                                                "clicked" : "  ( ) => {\n     \n     var cd = DialogConfirm.singleton();\n     cd.el.set_transient_for(_this.el);\n    cd.el.set_modal(true);\n\n     var project =   _this.left_projects.getSelectedProject();\n    if (project == null) {\n        print(\"SKIP - no project\\n\");\n        return;\n    }\n    \n        \n     if (Gtk.ResponseType.YES != cd.show(\"Confirm\", \n        \"Are you sure you want to delete project %s\".printf(project.name))) {\n        return;\n    }\n     \n\n    // confirm?\n    Project.Project.remove(project);\n    _this.project = null;\n    \n    _this.left_projects.is_loaded =  false;\n    _this.left_projects.load();\n    _this.clutterfiles.clearFiles();\n\n}"
+                                                                            },
+                                                                            "* pack" : false,
+                                                                            "xtype" : "Button",
+                                                                            "width_request" : 50,
+                                                                            "$ xns" : "Gtk",
+                                                                            "$ tooltip_text" : "\"Delelte Project\"",
+                                                                            "height_request" : 50,
+                                                                            "items" : [
+                                                                                {
+                                                                                    "utf8 icon_name" : "user-trash",
+                                                                                    "* pack" : "set_image",
+                                                                                    "xtype" : "Image",
+                                                                                    "$ xns" : "Gtk"
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            "id" : "new_window",
+                                                            "* init" : "this.el.set_size(50,50);",
+                                                            "xtype" : "Actor",
+                                                            "* pack" : "add_child",
+                                                            "$ xns" : "Clutter",
+                                                            "items" : [
+                                                                {
+                                                                    "* init" : "((Gtk.Container)(this.el.get_widget())).add ( child_0.el);",
+                                                                    "* pack" : "add_child",
+                                                                    "xtype" : "Actor",
+                                                                    "$ xns" : "GtkClutter",
+                                                                    "items" : [
+                                                                        {
+                                                                            "listeners" : {
+                                                                                "clicked" : "  ( ) => {\n        Xcls_MainWindow.singleton().no_windows++;\n        var w = new Xcls_MainWindow();\n        w.ref();\n\n        w.el.show_all();\n        w.initChildren();\n        w.hideViewEditing();\n}"
+                                                                            },
+                                                                            "utf8 tooltip_text" : "Open New Window",
+                                                                            "* pack" : false,
+                                                                            "xtype" : "Button",
+                                                                            "width_request" : 50,
+                                                                            "$ xns" : "Gtk",
+                                                                            "height_request" : 50,
+                                                                            "items" : [
+                                                                                {
+                                                                                    "utf8 icon_name" : "window-new",
+                                                                                    "* pack" : "set_image",
+                                                                                    "xtype" : "Image",
+                                                                                    "$ xns" : "Gtk"
+                                                                                }
+                                                                            ]
+                                                                        }
+                                                                    ]
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/MainWindow.vala b/old-javascript/Builder4/MainWindow.vala
new file mode 100644 (file)
index 0000000..d08f76d
--- /dev/null
@@ -0,0 +1,2972 @@
+static Xcls_MainWindow  _MainWindow;
+
+public class Xcls_MainWindow : Object 
+{
+    public Gtk.Window el;
+    private Xcls_MainWindow  _this;
+
+    public static Xcls_MainWindow singleton()
+    {
+        if (_MainWindow == null) {
+            _MainWindow= new Xcls_MainWindow();
+        }
+        return _MainWindow;
+    }
+    public Xcls_vbox vbox;
+    public Xcls_mainpane mainpane;
+    public Xcls_leftpane leftpane;
+    public Xcls_editpane editpane;
+    public Xcls_tree tree;
+    public Xcls_props props;
+    public Xcls_clutterembed clutterembed;
+    public Xcls_rooview rooview;
+    public Xcls_objectview objectview;
+    public Xcls_codeeditview codeeditview;
+    public Xcls_addpropsview addpropsview;
+    public Xcls_projecteditview projecteditview;
+    public Xcls_buttonlayout buttonlayout;
+    public Xcls_backbutton backbutton;
+    public Xcls_projectbutton projectbutton;
+    public Xcls_editfilebutton editfilebutton;
+    public Xcls_projecteditbutton projecteditbutton;
+    public Xcls_objectshowbutton objectshowbutton;
+    public Xcls_addpropbutton addpropbutton;
+    public Xcls_addlistenerbutton addlistenerbutton;
+    public Xcls_addprojectbutton addprojectbutton;
+    public Xcls_addfilebutton addfilebutton;
+    public Xcls_delprojectbutton delprojectbutton;
+    public Xcls_new_window new_window;
+
+        // my vars (def)
+    public int no_windows;
+    public Project.Project project;
+    public bool children_loaded;
+    public Xcls_WindowLeftProjects left_projects;
+    public Xcls_WindowRooView window_rooview;
+    public Xcls_WindowLeftTree left_tree;
+    public Editor code_editor;
+    public Xcls_DialogNewComponent new_file_dialog;
+    public Xcls_ProjectSettings projectsettings;
+    public Xcls_ClutterFiles clutterfiles;
+    public Xcls_LeftProps left_props;
+    public string state;
+    public Xcls_RightPalete rightpalete;
+    public string title;
+    public ValaProjectSettings vala_projectsettings;
+    public Xcls_WindowAddProp add_props;
+    public Xcls_GtkView window_gladeview;
+
+    // ctor 
+    public Xcls_MainWindow()
+    {
+        _this = this;
+        this.el = new Gtk.Window( Gtk.WindowType.TOPLEVEL );
+
+        // my vars (dec)
+        this.no_windows = 1;
+        this.project = null;
+        this.children_loaded = false;
+        this.left_projects = null;
+        this.window_rooview = null;
+        this.left_tree = null;
+        this.code_editor = null;
+        this.new_file_dialog = null;
+        this.projectsettings = null;
+        this.clutterfiles = null;
+        this.left_props = null;
+        this.rightpalete = null;
+        this.title = "Application Builder";
+        this.vala_projectsettings = null;
+        this.add_props = null;
+        this.window_gladeview = null;
+
+        // set gobject values
+        this.el.border_width = 0;
+        this.el.default_height = 500;
+        this.el.default_width = 800;
+        var child_0 = new Xcls_vbox( _this );
+        child_0.ref();
+        this.el.add (  child_0.el  );
+
+        // init method 
+
+        this.state = "files";
+                 
+            //this.el.show_all();
+        // listeners 
+        this.el.delete_event.connect( (   event) => {
+            return false;
+        });
+        this.el.destroy.connect( () =>  {
+         Xcls_MainWindow.singleton().no_windows--;
+         
+         if (Xcls_MainWindow.singleton().no_windows < 1) {
+        
+             Gtk.main_quit();
+         }
+        });
+        this.el.show.connect( ( ) => {
+            // hide the file editing..
+           
+            //this.hideViewEditing();
+        });
+    }
+
+    // user defined functions 
+    public             void hideAddListener () {
+          _this.backbutton.el.hide();
+         _this.projectbutton.el.show(); 
+              _this.projecteditbutton.el.show();
+             _this.editfilebutton.el.show();   
+         _this.addpropsview.el.save_easing_state();
+        var el = _this.rooview.el;
+        el.save_easing_state();
+    
+        
+        el.set_scale(1.0f,1.0f);
+        _this.addpropsview.el.set_scale(0.0f,0.0f);
+        _this.state = "edit";
+    
+     
+        //_this.clutterfiles.loadProject(_this.project);
+    
+        el.restore_easing_state();
+         _this.addpropsview.el.restore_easing_state();  
+      }
+    public        void initChildren () {
+        // this needs putting in a better place..
+        
+        print("init children");
+        this.left_tree = new Xcls_WindowLeftTree();
+        this.left_tree.ref();
+        this.left_tree.main_window = _this;
+        this.tree.el.pack_start(this.left_tree.el,true, true,0);
+        this.left_tree.el.show_all();
+       
+        this.left_tree.before_node_change.connect(() => {
+            if (this.state != "codeedit") {
+                this.left_props.finish_editing();
+                return true;
+            }
+            if (!this.code_editor.saveContents()) {
+                return false;
+            }
+            return false;
+        
+        });
+        
+        this.left_tree.node_selected.connect((sel) => {
+            
+            print("node_selected called %s\n", (sel == null) ? "NULL" : "a value");
+            
+            if (sel == null) {
+                this.left_props.el.hide();
+            } 
+            this.left_props.el.show();
+            this.left_props.load(this.left_tree.getActiveFile(), sel);
+            switch (this.state) {
+                case "object": 
+                      
+                     if (sel == null) {
+                        this.rightpalete.clear();
+                        break;
+                    }
+                    this.rightpalete.load(_this.left_tree.getActiveFile().palete(), sel.fqn());
+                    break;
+                     
+                    
+               case "addprop":
+                    if (sel == null) {
+                        this.add_props.clear();
+                        break;
+                    }
+                    this.add_props.show(_this.left_tree.getActiveFile().palete(), "props", sel.fqn());
+                    break;
+                    
+               case "addlistener":
+                    if (sel == null) {
+                        this.add_props.clear();
+                        break;
+                    }
+                    this.add_props.show(_this.left_tree.getActiveFile().palete(), "signals", sel.fqn());
+                    break;
+    
+               case "codeedit":
+                   
+                    this.hideCodeEdit();
+                    break;
+                   
+                                    
+            }
+            return  ;
+              
+        });
+        
+         this.left_tree.changed.connect(() => {
+           this.window_rooview.requestRedraw();
+           this.left_tree.model.file.save();
+        });
+         
+        
+    
+        // left properties
+    
+        this.left_props =new Xcls_LeftProps();
+        this.left_props.ref();
+        this.left_props.main_window = _this;
+        this.props.el.pack_start(this.left_props.el,true, true,0);
+        this.left_props.el.show_all();
+        
+        this.left_props.show_editor.connect( (file, node, type,  key) => {
+            this.showCodeEdit(file, node, type,  key);
+        });
+        this.left_props.stop_editor.connect( () => {
+            if (this.state != "codeedit") {
+                return true;
+            }
+        
+            var ret =  this.code_editor.saveContents();
+            if (!ret) {
+                return false;
+            }
+            this.hideCodeEdit();
+            return ret;
+        });
+         this.left_props.changed.connect(() => {
+              if (this.left_tree.getActiveFile().xtype == "Roo" ) {
+                   this.window_rooview.requestRedraw();
+                   
+               } else {
+                  this.window_gladeview.loadFile(this.left_tree.getActiveFile());
+              }
+              this.left_tree.model.updateSelected();
+              this.left_tree.model.file.save();
+        });
+        
+    
+    
+    
+        // left projects..
+         this.left_projects = new Xcls_WindowLeftProjects();
+         this.left_projects.ref();
+         this.leftpane.el.pack_start(this.left_projects.el,true, true,0);
+         this.left_projects.el.show_all();
+         this.left_projects.project_selected.connect((proj) => {
+            proj.scanDirs();
+            _this.clutterfiles.loadProject(proj);
+        
+         });
+        
+       
+        // project edit..
+        this.projectsettings  =new Xcls_ProjectSettings();
+        this.projectsettings.ref();  /// really?
+        
+        this.vala_projectsettings  =new ValaProjectSettings();
+        this.vala_projectsettings.ref();
+        this.vala_projectsettings.window = this;
+        
+        ((Gtk.Container)(this.projecteditview.el.get_widget())).add(this.projectsettings.el);
+        //this.projectsettings.el.show_all();
+    
+        var stage = _this.projecteditview.el.get_stage();
+        stage.set_background_color(  Clutter.Color.from_string("#000"));
+        
+         this.projectsettings.buttonPressed.connect((btn) => {
+             if (this.left_tree.getActiveFile().xtype == "Roo" ) {
+             
+                if (btn == "save") {
+                     _this.window_rooview.view.renderJS(true);
+                }
+                if (btn == "apply") {
+                    _this.window_rooview.view.renderJS(true);
+                    return;
+                }
+            } else {
+                // do nothing for gtk..
+            }
+            if (btn == "save" || btn == "apply") {
+                _this.project.save();
+     
+            }
+            
+            this.hideProjectEdit();
+             
+         });
+        
+        
+        // objects (palate..)
+        this.rightpalete  = new Xcls_RightPalete();
+        this.rightpalete.ref();  /// really?
+        ((Gtk.Container)(this.objectview.el.get_widget())).add(this.rightpalete.el);
+        //this.projectsettings.el.show_all();
+    
+        stage = _this.objectview.el.get_stage();
+        stage.set_background_color(  Clutter.Color.from_string("#000"));
+        
+        /*this.projectsettings.buttonPressed.connect((btn) => {
+            if (btn == "save") {
+                 _this.window_rooview.view.renderJS(true);
+            }
+            if (btn == "apply") {
+                _this.window_rooview.view.renderJS(true);
+                return;
+            }
+            this.hideProjectEdit();
+             
+         });
+        */
+        
+        
+          
+        // Add properties
+        this.add_props  = new Xcls_WindowAddProp();
+        this.add_props.ref();  /// really?
+        ((Gtk.Container)(this.addpropsview.el.get_widget())).add(this.add_props.el);
+        //this.projectsettings.el.show_all();
+    
+        stage = _this.addpropsview.el.get_stage();
+        stage.set_background_color(  Clutter.Color.from_string("#000"));
+        
+        
+        _this.add_props.select.connect( (key,type,skel, etype) => {
+            this.left_props.addProp(etype, key, skel, type);
+        });
+        
+        // editor
+        
+        
+        this.code_editor  = new  Editor();
+        this.code_editor.ref();  /// really?
+        ((Gtk.Container)(this.codeeditview.el.get_widget())).add(this.code_editor.el);
+        //this.projectsettings.el.show_all();
+    
+        stage = _this.codeeditview.el.get_stage();
+        stage.set_background_color(  Clutter.Color.from_string("#000"));
+        // editor.save...
+    
+        _this.code_editor.save.connect( () => {
+            this.left_tree.model.file.save();
+             this.left_tree.model.updateSelected();
+        });
+        
+         
+        
+        
+        //  roo view
+        
+         this.window_rooview  =new Xcls_WindowRooView();
+        this.window_rooview.ref();
+        ((Gtk.Container)(this.rooview.el.get_widget())).add(this.window_rooview.el);
+        this.window_rooview.el.show_all();
+    
+        stage = _this.rooview.el.get_stage();
+        stage.set_background_color(  Clutter.Color.from_string("#000"));
+        
+          
+        //  glade view
+        
+        this.window_gladeview  =new Xcls_GtkView();
+        this.window_gladeview.ref();
+    
+        //((Gtk.Container)(this.rooview.el.get_widget())).add(this.window_gladeview.el);
+        ///this.window_gladeview.el.hide();
+    
+       
+        
+        // clutter files
+        
+        
+        this.clutterfiles = new Xcls_ClutterFiles();
+        this.clutterfiles.ref();
+        stage.add_child(this.clutterfiles.el);
+        this.clutterfiles.el.show_all();
+    
+    
+        this.clutterfiles.open.connect((file) => { 
+            _this.project = file.project;
+            _this.showViewEditing();
+            this.left_tree.model.loadFile(file);
+            var ctr= ((Gtk.Container)(this.rooview.el.get_widget()));
+            var ctr_p= ((Gtk.Container)(this.projecteditview.el.get_widget()));
+            if (file.xtype == "Roo" ) { 
+                ctr.foreach( (w) => { ctr.remove(w); });
+                ctr_p.foreach( (w) => { ctr_p.remove(w); });
+                ctr.add(this.window_rooview.el);
+                ctr_p.add(this.projectsettings.el);            
+                this.window_rooview.loadFile(file);
+                this.window_rooview.el.show_all();
+                this.projectsettings.el.show_all();            
+                
+            } else {
+                ctr.foreach( (w) => { ctr.remove(w); });
+                ctr_p.foreach( (w) => { ctr_p.remove(w); });            
+                ctr.add(this.window_gladeview.el);
+                ctr_p.add(this.vala_projectsettings.el);
+                this.window_gladeview.loadFile(file);
+                this.window_gladeview.el.show_all();
+                this.vala_projectsettings.el.show_all();
+            }
+            print("OPEN : " + file.name);
+            _this.editpane.el.set_position(_this.editpane.el.max_position);
+             
+    
+        });
+    
+        // new file dialog
+        this.new_file_dialog = new Xcls_DialogNewComponent();
+        // force it modal to the main window..
+        this.new_file_dialog.el.set_transient_for(this.el);
+        this.new_file_dialog.el.set_modal(true);
+        
+        this.new_file_dialog.success.connect((project,file) =>
+        {
+            _this.project = project;
+            _this.showViewEditing();
+            this.left_tree.model.loadFile(file);
+            var ctr= ((Gtk.Container)(this.rooview.el.get_widget()));
+            var ctr_p= ((Gtk.Container)(this.projecteditview.el.get_widget()));
+            if (file.xtype == "Roo" ) { 
+                ctr.foreach( (w) => { ctr.remove(w); });
+                ctr_p.foreach( (w) => { ctr_p.remove(w); });
+                ctr.add(this.window_rooview.el);
+                ctr_p.add(this.projectsettings.el);            
+                this.window_rooview.loadFile(file);
+                this.window_rooview.el.show_all();
+                this.projectsettings.el.show_all();  
+                
+                
+            } else {
+                ctr.foreach( (w) => { ctr.remove(w); });
+                ctr_p.foreach( (w) => { ctr_p.remove(w); });            
+                ctr.add(this.window_gladeview.el);
+                ctr_p.add(this.vala_projectsettings.el);
+                this.window_gladeview.loadFile(file);
+                this.window_gladeview.el.show_all();
+                this.vala_projectsettings.el.show_all();
+            }
+        
+        });
+        
+         
+    
+        //w.el.show_all();
+        var tl = new Clutter.Timeline(6000);
+        tl.set_repeat_count(-1);
+        tl.start();
+        tl.ref();
+    
+        this.children_loaded = true;
+    
+    
+    
+    
+    }
+    public             void hideCodeEdit () {
+        //this.code_editor.saveContents();
+         _this.backbutton.el.hide();
+          _this.projectbutton.el.show(); 
+           _this.projecteditbutton.el.show();
+           _this.editfilebutton.el.show();   
+         _this.codeeditview.el.save_easing_state();
+        var el = _this.rooview.el;
+        el.save_easing_state();
+    
+        
+        el.set_scale(1.0f,1.0f);
+        _this.codeeditview.el.set_scale(0.0f,0.0f);
+        _this.state = "edit";
+    
+     
+        //_this.clutterfiles.loadProject(_this.project);
+    
+        el.restore_easing_state();
+         _this.codeeditview.el.restore_easing_state();  
+     }
+    public             void showAddProp () {
+    
+         
+         var ae =      this.left_tree.getActiveElement();
+        if (ae == null) {
+            return;
+        }
+         _this.backbutton.el.show();
+           _this.projectbutton.el.hide();
+        _this.editfilebutton.el.hide();
+        _this.projecteditbutton.el.hide();    
+        
+         
+         
+        //this.rooview.el.hide();
+        this.add_props.el.show_all();
+        this.add_props.show(
+            Palete.factory(this.project.xtype), 
+            "props",
+            ae.fqn()
+        );
+    
+        _this.addpropsview.el.save_easing_state();
+            
+        var el = _this.rooview.el;
+        el.save_easing_state();
+        _this.clutterembed.setSizesAlloc("addprop");
+         
+         
+    
+        _this.addpropsview.el.set_scale(1.0f,1.0f);
+       
+       
+     
+        //_this.clutterfiles.loadProject(_this.project);
+    
+        el.restore_easing_state();
+        _this.addpropsview.el.restore_easing_state();
+        this.state = "addprop";
+    }
+    public             void showViewEditing ( )  {
+         this.editpane.el.show();
+      //   this.rooview.el.show();
+         this.left_projects.el.hide();
+        
+        _this.addprojectbutton.el.hide();   
+        _this.delprojectbutton.el.hide();
+        _this.addfilebutton.el.hide();       
+        _this.backbutton.el.hide();
+       _this.new_window.el.hide();      
+            
+            
+          _this.projectbutton.el.show();         
+        _this.editfilebutton.el.show();   
+       _this.projecteditbutton.el.show();
+      _this.objectshowbutton.el.show();
+      _this.addpropbutton.el.show();      
+      _this.addlistenerbutton.el.show();   
+    
+          
+        var el = _this.rooview.el;
+            el.save_easing_state();
+      
+        
+            el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 0.0f);
+            el.set_scale(1.0f,1.0f);
+            _this.state = "edit";
+           // _this.mainpane.el.set_position(_this.leftpane.lastWidth);
+            _this.clutterfiles.el.hide();
+        
+        el.restore_easing_state();
+            
+        print("show view editing");
+    }
+    public             void hideProjectEdit () {
+        // return to editing state..
+           
+          _this.projectbutton.el.show();
+         _this.projecteditbutton.el.show();
+          _this.backbutton.el.hide();
+             _this.editfilebutton.el.show();   
+    
+         
+           if (this.project.xtype == "Roo") {
+            
+            //this.projectsettings.show(this.project);
+        } else {
+    
+            this.vala_projectsettings.project.writeConfig();
+        }
+        _this.projecteditview.el.save_easing_state();
+        var el = _this.rooview.el;
+        el.save_easing_state();
+    
+        
+        el.set_scale(1.0f,1.0f);
+           _this.projecteditview.el.set_scale(1.0f,0.0f);
+        _this.state = "edit";
+    
+     
+        //_this.clutterfiles.loadProject(_this.project);
+    
+        el.restore_easing_state();
+          _this.projecteditview.el.restore_easing_state();  
+      
+    }
+    public             void showProjectEdit () {
+        // make the browser smaller, and show the edit dialog
+        
+        
+         _this.projectbutton.el.hide();
+         _this.projecteditbutton.el.hide();
+         _this.editfilebutton.el.hide();
+         
+        _this.backbutton.el.show();
+         
+        //this.rooview.el.hide();
+        
+        
+        if (this.project.xtype == "Roo") {
+            this.projectsettings.el.show_all();
+            this.projectsettings.show(this.project);
+        } else {
+            this.vala_projectsettings.el.show_all();
+            this.vala_projectsettings.show((Project.Gtk)this.project);
+        }
+        _this.projecteditview.el.save_easing_state();
+            
+        var el = _this.rooview.el;
+        el.save_easing_state();
+       
+        
+        el.set_scale(0.5f,0.5f);
+    
+        _this.projecteditview.el.set_scale(1.0f,1.0f);
+       
+        _this.state = "projectedit";
+         
+     
+        //_this.clutterfiles.loadProject(_this.project);
+    
+        el.restore_easing_state();
+        _this.projecteditview.el.restore_easing_state();
+      //  print("show view browsing");
+        
+    }
+    public             void showAddListener () {
+    
+         
+         
+        var ae =      this.left_tree.getActiveElement();
+        if (ae == null) {
+            return;
+        }
+         
+       _this.backbutton.el.show();
+        _this.projectbutton.el.hide();
+        _this.editfilebutton.el.hide();
+        _this.projecteditbutton.el.hide();    
+        
+        
+        //this.rooview.el.hide();
+        this.add_props.el.show_all();
+        this.add_props.show(
+            Palete.factory(this.project.xtype), 
+            "signals",
+            ae.fqn()
+        );
+        //this.rightpalete.show(this.project);
+    
+        _this.addpropsview.el.save_easing_state();
+            
+        var el = _this.rooview.el;
+        el.save_easing_state();
+       
+          _this.clutterembed.setSizesAlloc("addlistener");
+    
+        
+      
+    
+        _this.addpropsview.el.set_scale(1.0f,1.0f);
+       
+       
+     
+        //_this.clutterfiles.loadProject(_this.project);
+    
+        el.restore_easing_state();
+        _this.addpropsview.el.restore_easing_state();
+        this.state = "addlistener";
+    }
+    public             void hideAddProp () {
+          _this.backbutton.el.hide();
+         _this.projectbutton.el.show(); 
+              _this.projecteditbutton.el.show();
+             _this.editfilebutton.el.show();   
+         _this.addpropsview.el.save_easing_state();
+         
+        var el = _this.rooview.el;
+        el.save_easing_state();
+    
+        
+        el.set_scale(1.0f,1.0f);
+        _this.addpropsview.el.set_scale(0.0f,0.0f);
+        _this.state = "edit";
+    
+     
+        //_this.clutterfiles.loadProject(_this.project);
+    
+        el.restore_easing_state();
+         _this.addpropsview.el.restore_easing_state();  
+     }
+    public             void showCodeEdit (JsRender.JsRender file, JsRender.Node node, string ptype, string key)
+    {
+        // this is a bit different,
+        // it's not called via a button - but triggered by the prop edit class signal.
+        // so it has to hide any other state..
+        
+        switch(this.state) {
+            case "object":
+                this.hideObject();
+                break;
+            case "addprop":
+                this.hideAddProp();
+                break;
+            case "addlistener":
+                this.hideAddListener();
+                break;
+        }
+     
+       _this.backbutton.el.show();
+       
+        _this.projectbutton.el.hide();
+        _this.editfilebutton.el.hide();
+        _this.projecteditbutton.el.hide();    
+       // more?? 
+         
+        //this.rooview.el.hide();
+        this.code_editor.el.show_all();
+        this.code_editor.show(
+            file,
+            node,
+            ptype,
+            key
+        );
+    
+        _this.codeeditview.el.save_easing_state();
+            
+        var el = _this.rooview.el;
+        el.save_easing_state();
+        _this.clutterembed.setSizesAlloc("codedit");
+       
+        _this.codeeditview.el.set_scale(1.0f,1.0f);
+       
+       
+     
+        //_this.clutterfiles.loadProject(_this.project);
+    
+        el.restore_easing_state();
+        _this.codeeditview.el.restore_easing_state();
+        this.state = "codeedit";
+    }
+    public             void setTitle (string str) {
+        this.el.set_title(this.title + " - " + str);
+    }
+    public             void show () {
+        this.left_tree =new Xcls_WindowLeftTree();
+        _this.vbox.el.pack_start(this.left_tree.el,true, true,0);
+        this.el.show_all();
+    
+    }
+    public             void hideViewEditing ( )   {
+    
+    // show the file navigation...
+      
+        if (this.left_tree.getActiveFile() != null) {
+             if (this.left_tree.getActiveFile().xtype == "Roo" ) {
+                 this.window_rooview.createThumb();
+             } else {
+                  this.window_gladeview.createThumb();
+              }
+          }
+          
+        _this.addprojectbutton.el.show();   
+        _this.addfilebutton.el.show();       
+          _this.backbutton.el.show();
+        _this.delprojectbutton.el.show();
+          _this.new_window.el.show();  
+              
+          _this.editfilebutton.el.hide();   
+          _this.projectbutton.el.hide();         
+          _this.projecteditbutton.el.hide();
+          _this.objectshowbutton.el.hide();
+          _this.addpropbutton.el.hide();      
+          _this.addlistenerbutton.el.hide();  
+    
+    
+    
+    
+              
+        // show the add file button..
+        
+              
+          
+         this.editpane.el.hide();
+        //this.rooview.el.hide();
+         this.left_projects.el.show();
+        
+        var el = _this.rooview.el;
+        el.save_easing_state();
+          el.set_easing_duration(1000);
+        // show project / file view..
+        //_this.mainpane.lastWidth = _this.leftpane.el.get_position();
+        //_this.mainpane.el.set_position(0);
+        // rotate y 180..
+        el.set_rotation_angle(Clutter.RotateAxis.Y_AXIS, 360.0f);
+        el.set_scale(0.0f,0.0f);
+       
+            _this.state = "files";
+        if (_this.project != null) {
+            _this.left_projects.selectProject(_this.project);
+            }
+        //_this.clutterfiles.loadProject(_this.project);
+    
+        el.restore_easing_state();
+            
+        print("show view browsing");
+    }
+    public             void showObject () {
+    
+         
+        // what's the active node on the left hand side..
+        
+        var n = _this.left_tree.getActiveElement();
+    
+        if (_this.left_tree.model.file == null) {
+            return;
+        }
+        
+        if (n == null && _this.left_tree.model.file.tree != null) {
+            return;
+        }
+        
+         _this.backbutton.el.show();
+           _this.projectbutton.el.hide();
+        _this.editfilebutton.el.hide();
+        _this.projecteditbutton.el.hide();    
+        
+         
+        //this.rooview.el.hide();
+        this.rightpalete.el.show_all();
+        this.rightpalete.load(_this.left_tree.getActiveFile().palete(), n == null ? "*top" : n.fqn());
+    
+        
+        //this.rightpalete.show(this.project);
+    
+        _this.objectview.el.save_easing_state();
+            
+        var el = _this.rooview.el;
+        el.save_easing_state();
+       
+         _this.clutterembed.setSizesAlloc("object");
+        
+    
+        _this.objectview.el.set_scale(1.0f,1.0f);
+       
+       
+     
+        //_this.clutterfiles.loadProject(_this.project);
+    
+        el.restore_easing_state();
+        _this.objectview.el.restore_easing_state();
+        this.state = "object";
+    }
+    public             void hideObject () {
+          // return to editing state..
+           
+              _this.projecteditbutton.el.show();
+          _this.backbutton.el.hide();
+         _this.projectbutton.el.show(); 
+             _this.editfilebutton.el.show();   
+         _this.objectview.el.save_easing_state();
+        var el = _this.rooview.el;
+        el.save_easing_state();
+    
+        
+        el.set_scale(1.0f,1.0f);
+        _this.objectview.el.set_scale(0.0f,0.0f);
+        _this.state = "edit";
+    
+     
+        //_this.clutterfiles.loadProject(_this.project);
+    
+        el.restore_easing_state();
+         _this.objectview.el.restore_easing_state();  
+     
+    
+    }
+    public class Xcls_vbox : Object 
+    {
+        public Gtk.VBox el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_vbox(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.vbox = this;
+            this.el = new Gtk.VBox( false, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_mainpane( _this );
+            child_0.ref();
+            this.el.pack_end (  child_0.el , true,true,0 );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_mainpane : Object 
+    {
+        public Gtk.HPaned el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+        public int lastWidth;
+
+        // ctor 
+        public Xcls_mainpane(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.mainpane = this;
+            this.el = new Gtk.HPaned();
+
+            // my vars (dec)
+            this.lastWidth = 0;
+
+            // set gobject values
+            this.el.position = 400;
+            var child_0 = new Xcls_leftpane( _this );
+            child_0.ref();
+            this.el.add1 (  child_0.el  );
+            var child_1 = new Xcls_VBox8( _this );
+            child_1.ref();
+            this.el.add2 (  child_1.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_leftpane : Object 
+    {
+        public Gtk.VBox el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_leftpane(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.leftpane = this;
+            this.el = new Gtk.VBox( true, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_editpane( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false,true,0 );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_editpane : Object 
+    {
+        public Gtk.VPaned el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_editpane(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.editpane = this;
+            this.el = new Gtk.VPaned();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_tree( _this );
+            child_0.ref();
+            this.el.add1 (  child_0.el  );
+            var child_1 = new Xcls_props( _this );
+            child_1.ref();
+            this.el.add2 (  child_1.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_tree : Object 
+    {
+        public Gtk.VBox el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_tree(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.tree = this;
+            this.el = new Gtk.VBox( true, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_props : Object 
+    {
+        public Gtk.VBox el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_props(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.props = this;
+            this.el = new Gtk.VBox( true, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_VBox8 : Object 
+    {
+        public Gtk.VBox el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_VBox8(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.VBox( true, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_clutterembed( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , true,true,0 );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_clutterembed : Object 
+    {
+        public GtkClutter.Embed el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_clutterembed(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.clutterembed = this;
+            this.el = new GtkClutter.Embed();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_rooview( _this );
+            child_0.ref();
+            this.el.get_stage().add_child (  child_0.el  );
+            var child_1 = new Xcls_objectview( _this );
+            child_1.ref();
+            this.el.get_stage().add_child (  child_1.el  );
+            var child_2 = new Xcls_codeeditview( _this );
+            child_2.ref();
+            this.el.get_stage().add_child (  child_2.el  );
+            var child_3 = new Xcls_addpropsview( _this );
+            child_3.ref();
+            this.el.get_stage().add_child (  child_3.el  );
+            var child_4 = new Xcls_projecteditview( _this );
+            child_4.ref();
+            this.el.get_stage().add_child (  child_4.el  );
+            var child_5 = new Xcls_buttonlayout( _this );
+            child_5.ref();
+            this.el.get_stage().add_child (  child_5.el  );
+
+            // init method 
+
+            var stage = this.el.get_stage();
+                stage.set_background_color(  Clutter.Color.from_string("#000"));
+            // listeners 
+            this.el.size_allocate.connect( (  alloc) => {
+                this.setSizes(alloc, _this.state); 
+                    
+            });
+        }
+
+        // user defined functions 
+        public           void setSizes (  Gtk.Allocation alloc, string state) {
+            if (!_this.children_loaded) {  return; }
+             
+            _this.clutterfiles.set_size(alloc.width-50, alloc.height);
+            
+            // project view appears at top...
+            
+            _this.projecteditview.el.set_size(alloc.width-50, alloc.height / 2.0f);
+                   
+                   
+            
+            var avail = alloc.width < 50.0f ? 0 :  alloc.width - 50.0f;
+         
+            
+            var palsize = avail < 300.0f ? avail : 300.0f;
+            print("set palsize size %f\n", palsize);
+           // palate / props : fixed 300 pix
+                    
+            _this.objectview.el.set_size(palsize, alloc.height);    
+            _this.addpropsview.el.set_size(palsize, alloc.height);
+            
+             
+            
+            // code edit min 600
+            
+            var codesize = avail < 800.0f ? avail : 800.0f;
+            print("set code size %f\n", codesize);
+        
+            _this.codeeditview.el.set_size(codesize, alloc.height);
+            _this.rooview.el.set_size(alloc.width-50, alloc.height);    
+           
+            switch ( state) {
+                case "codeedit": 
+        
+               var scale = avail > 0.0f ? (avail - codesize -10 ) / avail : 0.0f;
+               
+               
+                   _this.rooview.el.set_scale(scale,scale);
+                   break;
+                case "addprop":
+                case "addlistener":        
+                  case "object":   
+               var scale = avail > 0.0f ? (avail - palsize -10 ) / avail : 0.0f;
+                   _this.rooview.el.set_scale(scale,scale);
+                   break;
+            }
+                
+        }
+        public           void setSizesAlloc (string state) {
+        
+            Gtk.Allocation alloc;
+            this.el.get_allocation(out alloc);
+            this.setSizes(alloc, state);
+        }
+    }
+    public class Xcls_rooview : Object 
+    {
+        public GtkClutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_rooview(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.rooview = this;
+            this.el = new GtkClutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+
+            // init method 
+
+            {
+               
+               
+                this.el.add_constraint(
+                    new Clutter.AlignConstraint(
+                        _this.clutterembed.el.get_stage(), 
+                        Clutter.AlignAxis.X_AXIS,
+                        1.0f
+                    )
+                );
+                    
+                //this.el.set_position(100,100);
+                this.el.set_pivot_point(1.0f,1.0f);
+                
+                this.el.set_size(_this.clutterembed.el.get_stage().width-50,
+                        _this.clutterembed.el.get_stage().height);
+                        
+            }        }
+
+        // user defined functions 
+    }
+    public class Xcls_objectview : Object 
+    {
+        public GtkClutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_objectview(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.objectview = this;
+            this.el = new GtkClutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+
+            // init method 
+
+            {
+               
+               /*
+                this.el.add_constraint(
+                    new Clutter.AlignConstraint(
+                        _this.clutterembed.el.get_stage(), 
+                        Clutter.AlignAxis.X_AXIS,
+                        0.0f
+                    )
+                );
+                */
+                this.el.fixed_x = 50.0f;
+                this.el.fixed_y = 0.0f;
+                //this.el.set_position(100,100);
+                this.el.set_pivot_point(0.0f,0.0f);
+                this.el.set_scale(0.0f,1.0f);
+                this.el.set_size((_this.clutterembed.el.get_stage().width-50)/2,
+                        _this.clutterembed.el.get_stage().height);
+                        
+            }        }
+
+        // user defined functions 
+    }
+    public class Xcls_codeeditview : Object 
+    {
+        public GtkClutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_codeeditview(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.codeeditview = this;
+            this.el = new GtkClutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+
+            // init method 
+
+            {
+               
+               /*
+                this.el.add_constraint(
+                    new Clutter.AlignConstraint(
+                        _this.clutterembed.el.get_stage(), 
+                        Clutter.AlignAxis.X_AXIS,
+                        0.0f
+                    )
+                );
+                */
+                this.el.fixed_x = 50.0f;
+                this.el.fixed_y = 0.0f;
+                //this.el.set_position(100,100);
+                this.el.set_pivot_point(0.0f,0.0f);
+                this.el.set_scale(0.0f,1.0f);
+                this.el.set_size((_this.clutterembed.el.get_stage().width-50)/2,
+                        _this.clutterembed.el.get_stage().height);
+                        
+            }        }
+
+        // user defined functions 
+    }
+    public class Xcls_addpropsview : Object 
+    {
+        public GtkClutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_addpropsview(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.addpropsview = this;
+            this.el = new GtkClutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+
+            // init method 
+
+            {
+               
+               /*
+                this.el.add_constraint(
+                    new Clutter.AlignConstraint(
+                        _this.clutterembed.el.get_stage(), 
+                        Clutter.AlignAxis.X_AXIS,
+                        0.0f
+                    )
+                );
+                */
+                this.el.fixed_x = 50.0f;
+                this.el.fixed_y = 0.0f;
+                //this.el.set_position(100,100);
+                this.el.set_pivot_point(0.0f,0.0f);
+                this.el.set_scale(0.0f,1.0f);
+                this.el.set_size((_this.clutterembed.el.get_stage().width-50)/2,
+                        _this.clutterembed.el.get_stage().height);
+                        
+            }        }
+
+        // user defined functions 
+    }
+    public class Xcls_projecteditview : Object 
+    {
+        public GtkClutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_projecteditview(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.projecteditview = this;
+            this.el = new GtkClutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+
+            // init method 
+
+            {
+               
+               
+                this.el.add_constraint(
+                    new Clutter.AlignConstraint(
+                        _this.clutterembed.el.get_stage(), 
+                        Clutter.AlignAxis.X_AXIS,
+                        1.0f
+                    )
+                );
+                    
+                //this.el.set_position(100,100);
+                this.el.set_pivot_point(0.0f,0.0f);
+                this.el.set_scale(1.0f,0.0f);
+                this.el.set_size(_this.clutterembed.el.get_stage().width-50,
+                        _this.clutterembed.el.get_stage().height /2);
+                        
+            }        }
+
+        // user defined functions 
+    }
+    public class Xcls_buttonlayout : Object 
+    {
+        public Clutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_buttonlayout(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.buttonlayout = this;
+            this.el = new Clutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_BoxLayout16( _this );
+            child_0.ref();
+            this.el.layout_manager = child_0.el;
+            var child_1 = new Xcls_backbutton( _this );
+            child_1.ref();
+            this.el.add_child (  child_1.el  );
+            var child_2 = new Xcls_projectbutton( _this );
+            child_2.ref();
+            this.el.add_child (  child_2.el  );
+            var child_3 = new Xcls_editfilebutton( _this );
+            child_3.ref();
+            this.el.add_child (  child_3.el  );
+            var child_4 = new Xcls_projecteditbutton( _this );
+            child_4.ref();
+            this.el.add_child (  child_4.el  );
+            var child_5 = new Xcls_objectshowbutton( _this );
+            child_5.ref();
+            this.el.add_child (  child_5.el  );
+            var child_6 = new Xcls_addpropbutton( _this );
+            child_6.ref();
+            this.el.add_child (  child_6.el  );
+            var child_7 = new Xcls_addlistenerbutton( _this );
+            child_7.ref();
+            this.el.add_child (  child_7.el  );
+            var child_8 = new Xcls_addprojectbutton( _this );
+            child_8.ref();
+            this.el.add_child (  child_8.el  );
+            var child_9 = new Xcls_addfilebutton( _this );
+            child_9.ref();
+            this.el.add_child (  child_9.el  );
+            var child_10 = new Xcls_delprojectbutton( _this );
+            child_10.ref();
+            this.el.add_child (  child_10.el  );
+            var child_11 = new Xcls_new_window( _this );
+            child_11.ref();
+            this.el.add_child (  child_11.el  );
+
+            // init method 
+
+            {
+                
+                this.el.add_constraint(
+                    new Clutter.AlignConstraint(
+                        _this.clutterembed.el.get_stage(), 
+                        Clutter.AlignAxis.X_AXIS,
+                        0.0f
+                    )
+                );
+                 
+                
+                //this.el.set_position(100,100);
+                this.el.set_pivot_point(0.5f,0.5f);
+                 this.el.set_size(50,
+                       _this.clutterembed.el.get_stage().height);
+                 
+            }        }
+
+        // user defined functions 
+    }
+    public class Xcls_BoxLayout16 : Object 
+    {
+        public Clutter.BoxLayout el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_BoxLayout16(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Clutter.BoxLayout();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.orientation = Clutter.Orientation.VERTICAL;
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_backbutton : Object 
+    {
+        public Clutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_backbutton(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.backbutton = this;
+            this.el = new Clutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Actor18( _this );
+            child_0.ref();
+            this.el.add_child (  child_0.el  );
+
+            // init method 
+
+            this.el.set_size(50,50);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Actor18 : Object 
+    {
+        public GtkClutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Actor18(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new GtkClutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Button19( _this );
+            child_0.ref();
+
+            // init method 
+
+            ((Gtk.Container)(this.el.get_widget())).add ( child_0.el);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button19 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button19(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.width_request = 50;
+            this.el.height_request = 50;
+            this.el.tooltip_text = "Back";
+            var child_0 = new Xcls_Image20( _this );
+            child_0.ref();
+            this.el.set_image (  child_0.el  );
+
+            // listeners 
+            this.el.clicked.connect( ( ) => {
+                switch (_this.state) {
+                    case "edit":
+                    
+                        _this.hideViewEditing();
+                        break;  
+                    case "files":
+                        // should only occur if there is an active file..
+                        _this.showViewEditing();
+                        break; 
+                        
+                      case "addprop":
+                        _this.hideAddProp();
+            
+                        break;
+                    case "addlistener":
+                        _this.hideAddListener();
+            
+                        break;
+                         
+                     case "object":
+                        _this.hideObject();
+                        break;    
+                     
+                     case "codeedit":
+                        
+                        _this.hideCodeEdit();  
+                        break;
+                        
+                     case  "projectedit":
+                     // save?
+                        _this.hideProjectEdit();
+                        break;
+                        
+                    default:
+                        break;
+                }
+                return  ;    
+            
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Image20 : Object 
+    {
+        public Gtk.Image el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Image20(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Image();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.icon_name = "go-previous";
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_projectbutton : Object 
+    {
+        public Clutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_projectbutton(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.projectbutton = this;
+            this.el = new Clutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Actor22( _this );
+            child_0.ref();
+            this.el.add_child (  child_0.el  );
+
+            // init method 
+
+            this.el.set_size(50,50);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Actor22 : Object 
+    {
+        public GtkClutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Actor22(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new GtkClutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Button23( _this );
+            child_0.ref();
+
+            // init method 
+
+            ((Gtk.Container)(this.el.get_widget())).add ( child_0.el);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button23 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button23(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.width_request = 50;
+            this.el.height_request = 50;
+            var child_0 = new Xcls_Image24( _this );
+            child_0.ref();
+            this.el.set_image (  child_0.el  );
+
+            // listeners 
+            this.el.clicked.connect( ( ) => {
+                switch (_this.state) {
+                    case "edit":
+                    
+                        _this.hideViewEditing();
+                        break;  
+                    case "files":
+                        _this.showViewEditing();
+                        break; 
+                        
+                      case "addprop":
+                        _this.hideAddProp();
+                        _this.hideViewEditing();
+                        break;
+                    case "addlistener":
+                        _this.hideAddListener();
+                        _this.hideViewEditing();
+                        break;
+                         
+                     case "object":
+                        _this.hideObject();
+                        _this.hideViewEditing();
+                        break;    
+                        
+                    default:
+                        break;
+                }
+                return  ;    
+            
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Image24 : Object 
+    {
+        public Gtk.Image el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Image24(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Image();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.icon_name = "document-open";
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_editfilebutton : Object 
+    {
+        public Clutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_editfilebutton(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.editfilebutton = this;
+            this.el = new Clutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Actor26( _this );
+            child_0.ref();
+            this.el.add_child (  child_0.el  );
+
+            // init method 
+
+            this.el.set_size(50.0f,50.0f);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Actor26 : Object 
+    {
+        public GtkClutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Actor26(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new GtkClutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Button27( _this );
+            child_0.ref();
+
+            // init method 
+
+            ((Gtk.Container)(this.el.get_widget())).add ( child_0.el);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button27 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button27(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.width_request = 50;
+            this.el.height_request = 50;
+            this.el.tooltip_text = "File Details";
+            var child_0 = new Xcls_Image28( _this );
+            child_0.ref();
+            this.el.set_image (  child_0.el  );
+
+            // listeners 
+            this.el.clicked.connect( ( ) => {
+              
+                // create a new file in project..
+                if (_this.project == null || _this.left_tree.model.file == null) {
+                    return  ;
+                }
+                 
+                _this.new_file_dialog.show(_this.left_tree.model.file);
+                
+                return  ;    
+            
+            
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Image28 : Object 
+    {
+        public Gtk.Image el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Image28(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Image();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.icon_name = "document-properties";
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_projecteditbutton : Object 
+    {
+        public Clutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_projecteditbutton(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.projecteditbutton = this;
+            this.el = new Clutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Actor30( _this );
+            child_0.ref();
+            this.el.add_child (  child_0.el  );
+
+            // init method 
+
+            this.el.set_size(50,50);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Actor30 : Object 
+    {
+        public GtkClutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Actor30(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new GtkClutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Button31( _this );
+            child_0.ref();
+
+            // init method 
+
+            ((Gtk.Container)(this.el.get_widget())).add ( child_0.el);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button31 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button31(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.width_request = 50;
+            this.el.height_request = 50;
+            this.el.tooltip_text = "Project Details";
+            var child_0 = new Xcls_Image32( _this );
+            child_0.ref();
+            this.el.set_image (  child_0.el  );
+
+            // listeners 
+            this.el.clicked.connect( ( ) => {
+                switch (_this.state) {
+                    case "edit":
+                        _this.showProjectEdit();
+                        break;  
+                    case "files":
+                        // _this.showViewEditing();
+                        break; 
+                    case "projectedit":
+                        _this.hideProjectEdit();
+                        break;
+                        
+                        
+                          
+                    case "addprop":
+                        _this.hideAddProp();
+                        _this.showProjectEdit();
+                        break;
+                    case "addlistener":
+                        _this.hideAddListener();
+                        _this.showProjectEdit();
+                        break;
+                         
+                     case "object":
+                        _this.hideObject();
+                        _this.showProjectEdit();    
+                        break;
+                    default:
+                        break;
+                }
+                return  ;    
+            
+            
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Image32 : Object 
+    {
+        public Gtk.Image el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Image32(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Image();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.icon_name = "emblem-system";
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_objectshowbutton : Object 
+    {
+        public Clutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_objectshowbutton(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.objectshowbutton = this;
+            this.el = new Clutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Actor34( _this );
+            child_0.ref();
+            this.el.add_child (  child_0.el  );
+
+            // init method 
+
+            this.el.set_size(50,50);
+            // listeners 
+            this.el.button_press_event.connect( ( ) => {
+                
+                
+                
+                switch (_this.state) {
+            
+             
+                    case "addprop":
+                        _this.hideAddProp();
+                        _this.showObject();
+                        break;
+                case "addlistener":
+                        _this.hideAddListener();
+                        _this.showObject();
+                        break;
+            
+            // show            
+                    case "edit":
+                        _this.showObject();
+                        break;
+                        
+            // hide            
+                    case "object":
+                        _this.hideObject();
+                        break;
+                        break;
+                                    
+                    default:
+                        print("unhandled add objects from %s\n",_this.state);
+                        break;
+                }
+                return false;    
+            
+            
+            });
+            this.el.enter_event.connect( (  event)  => {
+                this.el.background_color = new Clutter.Color.from_string("#333");
+                    return false;
+            });
+            this.el.leave_event.connect( (  event)  => {
+                this.el.background_color = new Clutter.Color.from_string("#000");
+                return false;
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Actor34 : Object 
+    {
+        public GtkClutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Actor34(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new GtkClutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Button35( _this );
+            child_0.ref();
+
+            // init method 
+
+            ((Gtk.Container)(this.el.get_widget())).add ( child_0.el);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button35 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button35(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.width_request = 50;
+            this.el.height_request = 50;
+            this.el.tooltip_text = "Add Child Element";
+            var child_0 = new Xcls_Image36( _this );
+            child_0.ref();
+            this.el.set_image (  child_0.el  );
+
+            // listeners 
+            this.el.clicked.connect( ( ) => {
+                
+                
+                
+                switch (_this.state) {
+            
+             
+                    case "addprop":
+                        _this.hideAddProp();
+                        _this.showObject();
+                        break;
+                case "addlistener":
+                        _this.hideAddListener();
+                        _this.showObject();
+                        break;
+            
+            // show            
+                    case "edit":
+                        _this.showObject();
+                        break;
+                        
+            // hide            
+                    case "object":
+                        _this.hideObject();
+                        break;
+                        break;
+                                    
+                    default:
+                        print("unhandled add objects from %s\n",_this.state);
+                        break;
+                }
+                return  ;    
+            
+            
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Image36 : Object 
+    {
+        public Gtk.Image el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Image36(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Image();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.icon_name = "list-add";
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_addpropbutton : Object 
+    {
+        public Clutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_addpropbutton(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.addpropbutton = this;
+            this.el = new Clutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Actor38( _this );
+            child_0.ref();
+            this.el.add_child (  child_0.el  );
+
+            // init method 
+
+            this.el.set_size(50,50);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Actor38 : Object 
+    {
+        public GtkClutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Actor38(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new GtkClutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Button39( _this );
+            child_0.ref();
+
+            // init method 
+
+            ((Gtk.Container)(this.el.get_widget())).add ( child_0.el);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button39 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button39(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.width_request = 50;
+            this.el.height_request = 50;
+            this.el.tooltip_text = "Add Property";
+            var child_0 = new Xcls_Image40( _this );
+            child_0.ref();
+            this.el.set_image (  child_0.el  );
+
+            // listeners 
+            this.el.clicked.connect( ( ) => {
+                
+                
+                
+                switch (_this.state) {
+                    case "edit":
+                        _this.showAddProp();
+                        break;
+                        
+                    case "object":
+                        _this.hideObject();
+                        _this.showAddProp();
+                        break;
+                   
+                    case "addlistener":
+                        _this.hideAddListener();
+                        _this.showAddProp();            
+                        break;
+                        
+                        
+                    case "addprop":
+                        _this.hideAddProp();
+                        break;
+                        
+                    default:
+                        print("unhandled add property from %s\n",_this.state);
+                        break;
+                        
+                }
+                return  ;    
+            
+            
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Image40 : Object 
+    {
+        public Gtk.Image el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Image40(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Image();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.icon_name = "format-justify-left";
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_addlistenerbutton : Object 
+    {
+        public Clutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_addlistenerbutton(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.addlistenerbutton = this;
+            this.el = new Clutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Actor42( _this );
+            child_0.ref();
+            this.el.add_child (  child_0.el  );
+
+            // init method 
+
+            this.el.set_size(50,50);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Actor42 : Object 
+    {
+        public GtkClutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Actor42(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new GtkClutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Button43( _this );
+            child_0.ref();
+
+            // init method 
+
+            ((Gtk.Container)(this.el.get_widget())).add ( child_0.el);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button43 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button43(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.width_request = 50;
+            this.el.height_request = 50;
+            this.el.tooltip_text = "Add Event Code";
+            var child_0 = new Xcls_Image44( _this );
+            child_0.ref();
+            this.el.set_image (  child_0.el  );
+
+            // listeners 
+            this.el.clicked.connect( ( ) => {
+                
+                
+                
+                switch (_this.state) {
+                    case "edit":
+                        _this.showAddListener();
+                        break;
+                        
+                   
+                    case "addlistener":
+                        _this.hideAddListener();
+                        break;
+            
+                        
+                    case "addprop":
+                        _this.hideAddProp();
+                        _this.showAddListener();
+                        break;
+                     case "object":
+                        _this.hideObject();
+                        _this.showAddListener();
+                        break;
+                
+                      default:
+                        print("unhandled add listener from %s\n",_this.state);
+            
+                        break;
+                        
+                }
+                return  ;    
+            
+            
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Image44 : Object 
+    {
+        public Gtk.Image el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Image44(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Image();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.icon_name = "appointment-new";
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_addprojectbutton : Object 
+    {
+        public Clutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_addprojectbutton(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.addprojectbutton = this;
+            this.el = new Clutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Actor46( _this );
+            child_0.ref();
+            this.el.add_child (  child_0.el  );
+
+            // init method 
+
+            this.el.set_size(50.0f,50.0f);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Actor46 : Object 
+    {
+        public GtkClutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Actor46(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new GtkClutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Button47( _this );
+            child_0.ref();
+
+            // init method 
+
+            ((Gtk.Container)(this.el.get_widget())).add ( child_0.el);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button47 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button47(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.width_request = 50;
+            this.el.height_request = 50;
+            this.el.tooltip_text = "New\nProj.";
+            var child_0 = new Xcls_Image48( _this );
+            child_0.ref();
+            this.el.set_image (  child_0.el  );
+
+            // listeners 
+            this.el.clicked.connect( ( ) => {
+              
+                // create a new file in project..
+                //Xcls_DialogNewComponent.singleton().show(
+               var  pe =     Xcls_EditProject.singleton();
+                pe.el.set_transient_for(_this.el);
+                pe.el.set_modal(true);   
+               
+                var p  = pe.show();
+            
+                if (p == null) {
+                    return;
+                }
+                _this.left_projects.is_loaded = false;    
+                _this.left_projects.load();
+                _this.left_projects.selectProject(p);
+                return  ;    
+            
+            
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Image48 : Object 
+    {
+        public Gtk.Image el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Image48(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Image();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.icon_name = "folder-new";
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_addfilebutton : Object 
+    {
+        public Clutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_addfilebutton(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.addfilebutton = this;
+            this.el = new Clutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Actor50( _this );
+            child_0.ref();
+            this.el.add_child (  child_0.el  );
+
+            // init method 
+
+            this.el.set_size(50.0f,50.0f);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Actor50 : Object 
+    {
+        public GtkClutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Actor50(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new GtkClutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Button51( _this );
+            child_0.ref();
+
+            // init method 
+
+            ((Gtk.Container)(this.el.get_widget())).add ( child_0.el);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button51 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button51(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.width_request = 50;
+            this.el.height_request = 50;
+            this.el.tooltip_text = "Add File";
+            var child_0 = new Xcls_Image52( _this );
+            child_0.ref();
+            this.el.set_image (  child_0.el  );
+
+            // listeners 
+            this.el.clicked.connect( () => {
+                // create a new file in project..
+                
+                // what's the currently selected project...
+                var proj = _this.left_projects.getSelectedProject();
+                
+                if (proj == null) {
+                    return  ;
+                }
+                
+                
+                
+                var f = JsRender.JsRender.factory(proj.xtype,  proj, "");
+                _this.project = proj;
+                _this.new_file_dialog.show(f);
+                
+                return  ;    
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Image52 : Object 
+    {
+        public Gtk.Image el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Image52(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Image();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.icon_name = "document-new";
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_delprojectbutton : Object 
+    {
+        public Clutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_delprojectbutton(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.delprojectbutton = this;
+            this.el = new Clutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Actor54( _this );
+            child_0.ref();
+            this.el.add_child (  child_0.el  );
+
+            // init method 
+
+            this.el.set_size(50,50);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Actor54 : Object 
+    {
+        public GtkClutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Actor54(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new GtkClutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Button55( _this );
+            child_0.ref();
+
+            // init method 
+
+            ((Gtk.Container)(this.el.get_widget())).add ( child_0.el);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button55 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button55(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.width_request = 50;
+            this.el.height_request = 50;
+            this.el.tooltip_text = "Delelte Project";
+            var child_0 = new Xcls_Image56( _this );
+            child_0.ref();
+            this.el.set_image (  child_0.el  );
+
+            // listeners 
+            this.el.clicked.connect( ( ) => {
+                 
+                 var cd = DialogConfirm.singleton();
+                 cd.el.set_transient_for(_this.el);
+                cd.el.set_modal(true);
+            
+                 var project =   _this.left_projects.getSelectedProject();
+                if (project == null) {
+                    print("SKIP - no project\n");
+                    return;
+                }
+                
+                    
+                 if (Gtk.ResponseType.YES != cd.show("Confirm", 
+                    "Are you sure you want to delete project %s".printf(project.name))) {
+                    return;
+                }
+                 
+            
+                // confirm?
+                Project.Project.remove(project);
+                _this.project = null;
+                
+                _this.left_projects.is_loaded =  false;
+                _this.left_projects.load();
+                _this.clutterfiles.clearFiles();
+            
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Image56 : Object 
+    {
+        public Gtk.Image el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Image56(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Image();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.icon_name = "user-trash";
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_new_window : Object 
+    {
+        public Clutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_new_window(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            _this.new_window = this;
+            this.el = new Clutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Actor58( _this );
+            child_0.ref();
+            this.el.add_child (  child_0.el  );
+
+            // init method 
+
+            this.el.set_size(50,50);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Actor58 : Object 
+    {
+        public GtkClutter.Actor el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Actor58(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new GtkClutter.Actor();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Button59( _this );
+            child_0.ref();
+
+            // init method 
+
+            ((Gtk.Container)(this.el.get_widget())).add ( child_0.el);        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button59 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button59(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.width_request = 50;
+            this.el.height_request = 50;
+            this.el.tooltip_text = "Open New Window";
+            var child_0 = new Xcls_Image60( _this );
+            child_0.ref();
+            this.el.set_image (  child_0.el  );
+
+            // listeners 
+            this.el.clicked.connect( ( ) => {
+                    Xcls_MainWindow.singleton().no_windows++;
+                    var w = new Xcls_MainWindow();
+                    w.ref();
+            
+                    w.el.show_all();
+                    w.initChildren();
+                    w.hideViewEditing();
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Image60 : Object 
+    {
+        public Gtk.Image el;
+        private Xcls_MainWindow  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Image60(Xcls_MainWindow _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Image();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.icon_name = "window-new";
+        }
+
+        // user defined functions 
+    }
+}
diff --git a/old-javascript/Builder4/ProjectSettings.bjs b/old-javascript/Builder4/ProjectSettings.bjs
new file mode 100644 (file)
index 0000000..05172da
--- /dev/null
@@ -0,0 +1,124 @@
+{
+    "name" : "ProjectSettings",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/ProjectSettings.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "items" : [
+        {
+            "@ void buttonPressed" : "(string btn)",
+            "id" : "ProjectSettings",
+            "| void show" : " (Project.Project project) {\n    _this.project = project;\n    _this.path.el.label = project.firstPath();\n    // get the active project.\n     var lm = Gtk.SourceLanguageManager.get_default();\n                \n    ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(\n    \n        lm.get_language(\"html\"));\n  \n    //print (project.fn);\n    //project.runhtml = project.runhtml || '';\n    _this.view.el.get_buffer().set_text(project.runhtml);\n    \n       \n    _this.rootURL.el.set_text( _this.project.rootURL );\n    _this.base_template.el.set_text(_this.project.base_template);    \n   \n    \n    //this.el.show_all();\n}\n",
+            "# Project.Project project" : "",
+            "xtype" : "VBox",
+            "| void save" : "()\n{\n   var buf =    _this.view.el.get_buffer();\n   Gtk.TextIter s;\n     Gtk.TextIter e;\n    buf.get_start_iter(out s);\n    buf.get_end_iter(out e);\n      _this.project.runhtml = buf.get_text(s,e,true);\n      \n    _this.project.rootURL = _this.rootURL.el.get_text();\n    _this.project.base_template = _this.base_template.el.get_text();    \n    \n    \n}",
+            "$ xns" : "Gtk",
+            "border_width" : 5,
+            "$ homogeneous" : false,
+            "items" : [
+                {
+                    "* pack" : "pack_start,false,false,0",
+                    "xtype" : "HBox",
+                    "gboolean expand" : false,
+                    "$ xns" : "Gtk",
+                    "$ homogeneous" : true,
+                    "gboolean vexpand" : false,
+                    "items" : [
+                        {
+                            "listeners" : {
+                                "button_press_event" : "() => {\n    _this.save();\n          \n    _this.buttonPressed(\"apply\");\n        return false;\n}"
+                            },
+                            "label" : "Apply",
+                            "* pack" : "add",
+                            "xtype" : "Button",
+                            "$ xns" : "Gtk"
+                        },
+                        {
+                            "listeners" : {
+                                "button_press_event" : "() => {\n       _this.save();\n          \n    _this.buttonPressed(\"save\");\n        return false;\n}"
+                            },
+                            "label" : "Save",
+                            "* pack" : "add",
+                            "xtype" : "Button",
+                            "$ xns" : "Gtk"
+                        }
+                    ]
+                },
+                {
+                    "label" : "filename",
+                    "id" : "path",
+                    "xalign" : 0,
+                    "* pack" : "pack_start,false,false,0",
+                    "xtype" : "Label",
+                    "$ xns" : "Gtk"
+                },
+                {
+                    "label" : "HTML To insert at end of <HEAD>",
+                    "xtype" : "Label",
+                    "* pack" : "pack_start,false,false,0",
+                    "$ xns" : "Gtk"
+                },
+                {
+                    "* pack" : "pack_start,false,false,0",
+                    "xtype" : "HBox",
+                    "gboolean expand" : false,
+                    "$ xns" : "Gtk",
+                    "$ homogeneous" : false,
+                    "items" : [
+                        {
+                            "label" : "HTML template file",
+                            "* pack" : "pack_start,false,false,0",
+                            "xtype" : "Label",
+                            "$ xns" : "Gtk"
+                        },
+                        {
+                            "id" : "base_template",
+                            "* pack" : "add",
+                            "xtype" : "Entry",
+                            "$ xns" : "Gtk"
+                        }
+                    ]
+                },
+                {
+                    "* pack" : "pack_start,false,false,0",
+                    "xtype" : "HBox",
+                    "gboolean expand" : false,
+                    "$ xns" : "Gtk",
+                    "$ homogeneous" : false,
+                    "items" : [
+                        {
+                            "label" : "root URL",
+                            "* pack" : "pack_start,false,false,0",
+                            "xtype" : "Label",
+                            "$ xns" : "Gtk"
+                        },
+                        {
+                            "id" : "rootURL",
+                            "* pack" : "add",
+                            "xtype" : "Entry",
+                            "$ xns" : "Gtk"
+                        }
+                    ]
+                },
+                {
+                    "* pack" : "pack_start,true,true,0",
+                    "xtype" : "ScrolledWindow",
+                    "$ xns" : "Gtk",
+                    "items" : [
+                        {
+                            "listeners" : {
+                                "key_release_event" : " ( event) =>{\n    if (event.keyval != 115) {\n        return false;\n         \n    }\n    if   ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {\n        return false;\n    }\n     var buf =    this.el.get_buffer();\n    Gtk.TextIter s;\n    Gtk.TextIter e;\n    buf.get_start_iter(out s);\n    buf.get_end_iter(out e);\n    _this.project.runhtml = buf.get_text(s,e,true);\n    \n          \n    _this.buttonPressed(\"save\");\n     \n    return false;\n         \n}"
+                            },
+                            "id" : "view",
+                            "* init" : " \n    var description =   Pango.FontDescription.from_string(\"monospace\");\n    description.set_size(9000);\n    this.el.override_font(description);",
+                            "xtype" : "View",
+                            "* pack" : "add",
+                            "$ xns" : "GtkSource"
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/ProjectSettings.vala b/old-javascript/Builder4/ProjectSettings.vala
new file mode 100644 (file)
index 0000000..584d5ae
--- /dev/null
@@ -0,0 +1,439 @@
+static Xcls_ProjectSettings  _ProjectSettings;
+
+public class Xcls_ProjectSettings : Object 
+{
+    public Gtk.VBox el;
+    private Xcls_ProjectSettings  _this;
+
+    public static Xcls_ProjectSettings singleton()
+    {
+        if (_ProjectSettings == null) {
+            _ProjectSettings= new Xcls_ProjectSettings();
+        }
+        return _ProjectSettings;
+    }
+    public Xcls_path path;
+    public Xcls_base_template base_template;
+    public Xcls_rootURL rootURL;
+    public Xcls_view view;
+
+        // my vars (def)
+    public signal void buttonPressed (string btn);
+    public Project.Project project;
+
+    // ctor 
+    public Xcls_ProjectSettings()
+    {
+        _this = this;
+        this.el = new Gtk.VBox( false, 0 );
+
+        // my vars (dec)
+
+        // set gobject values
+        this.el.border_width = 5;
+        var child_0 = new Xcls_HBox2( _this );
+        child_0.ref();
+        this.el.pack_start (  child_0.el , false,false,0 );
+        var child_1 = new Xcls_path( _this );
+        child_1.ref();
+        this.el.pack_start (  child_1.el , false,false,0 );
+        var child_2 = new Xcls_Label6( _this );
+        child_2.ref();
+        this.el.pack_start (  child_2.el , false,false,0 );
+        var child_3 = new Xcls_HBox7( _this );
+        child_3.ref();
+        this.el.pack_start (  child_3.el , false,false,0 );
+        var child_4 = new Xcls_HBox10( _this );
+        child_4.ref();
+        this.el.pack_start (  child_4.el , false,false,0 );
+        var child_5 = new Xcls_ScrolledWindow13( _this );
+        child_5.ref();
+        this.el.pack_start (  child_5.el , true,true,0 );
+    }
+
+    // user defined functions 
+    public void show (Project.Project project) {
+        _this.project = project;
+        _this.path.el.label = project.firstPath();
+        // get the active project.
+         var lm = Gtk.SourceLanguageManager.get_default();
+                    
+        ((Gtk.SourceBuffer)(_this.view.el.get_buffer())) .set_language(
+        
+            lm.get_language("html"));
+      
+        //print (project.fn);
+        //project.runhtml = project.runhtml || '';
+        _this.view.el.get_buffer().set_text(project.runhtml);
+        
+           
+        _this.rootURL.el.set_text( _this.project.rootURL );
+        _this.base_template.el.set_text(_this.project.base_template);    
+       
+        
+        //this.el.show_all();
+    }
+    public void save ()
+    {
+       var buf =    _this.view.el.get_buffer();
+       Gtk.TextIter s;
+         Gtk.TextIter e;
+        buf.get_start_iter(out s);
+        buf.get_end_iter(out e);
+          _this.project.runhtml = buf.get_text(s,e,true);
+          
+        _this.project.rootURL = _this.rootURL.el.get_text();
+        _this.project.base_template = _this.base_template.el.get_text();    
+        
+        
+    }
+    public class Xcls_HBox2 : Object 
+    {
+        public Gtk.HBox el;
+        private Xcls_ProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_HBox2(Xcls_ProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.HBox( true, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.expand = false;
+            this.el.vexpand = false;
+            var child_0 = new Xcls_Button3( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+            var child_1 = new Xcls_Button4( _this );
+            child_1.ref();
+            this.el.add (  child_1.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button3 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_ProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button3(Xcls_ProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Apply";
+
+            // listeners 
+            this.el.button_press_event.connect( () => {
+                _this.save();
+                      
+                _this.buttonPressed("apply");
+                    return false;
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button4 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_ProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button4(Xcls_ProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Save";
+
+            // listeners 
+            this.el.button_press_event.connect( () => {
+                   _this.save();
+                      
+                _this.buttonPressed("save");
+                    return false;
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_path : Object 
+    {
+        public Gtk.Label el;
+        private Xcls_ProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_path(Xcls_ProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.path = this;
+            this.el = new Gtk.Label( "filename" );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.xalign = 0f;
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label6 : Object 
+    {
+        public Gtk.Label el;
+        private Xcls_ProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label6(Xcls_ProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "HTML To insert at end of <HEAD>" );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_HBox7 : Object 
+    {
+        public Gtk.HBox el;
+        private Xcls_ProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_HBox7(Xcls_ProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.HBox( false, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.expand = false;
+            var child_0 = new Xcls_Label8( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false,false,0 );
+            var child_1 = new Xcls_base_template( _this );
+            child_1.ref();
+            this.el.add (  child_1.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label8 : Object 
+    {
+        public Gtk.Label el;
+        private Xcls_ProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label8(Xcls_ProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "HTML template file" );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_base_template : Object 
+    {
+        public Gtk.Entry el;
+        private Xcls_ProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_base_template(Xcls_ProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.base_template = this;
+            this.el = new Gtk.Entry();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_HBox10 : Object 
+    {
+        public Gtk.HBox el;
+        private Xcls_ProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_HBox10(Xcls_ProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.HBox( false, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.expand = false;
+            var child_0 = new Xcls_Label11( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false,false,0 );
+            var child_1 = new Xcls_rootURL( _this );
+            child_1.ref();
+            this.el.add (  child_1.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label11 : Object 
+    {
+        public Gtk.Label el;
+        private Xcls_ProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label11(Xcls_ProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "root URL" );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_rootURL : Object 
+    {
+        public Gtk.Entry el;
+        private Xcls_ProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_rootURL(Xcls_ProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.rootURL = this;
+            this.el = new Gtk.Entry();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_ScrolledWindow13 : Object 
+    {
+        public Gtk.ScrolledWindow el;
+        private Xcls_ProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_ScrolledWindow13(Xcls_ProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.ScrolledWindow( null, null );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_view( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_view : Object 
+    {
+        public Gtk.SourceView el;
+        private Xcls_ProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_view(Xcls_ProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.view = this;
+            this.el = new Gtk.SourceView();
+
+            // my vars (dec)
+
+            // set gobject values
+
+            // init method 
+
+            var description =   Pango.FontDescription.from_string("monospace");
+                description.set_size(9000);
+                this.el.override_font(description);
+            // listeners 
+            this.el.key_release_event.connect( ( event) =>{
+                if (event.keyval != 115) {
+                    return false;
+                     
+                }
+                if   ( (event.state & Gdk.ModifierType.CONTROL_MASK ) < 1 ) {
+                    return false;
+                }
+                 var buf =    this.el.get_buffer();
+                Gtk.TextIter s;
+                Gtk.TextIter e;
+                buf.get_start_iter(out s);
+                buf.get_end_iter(out e);
+                _this.project.runhtml = buf.get_text(s,e,true);
+                
+                      
+                _this.buttonPressed("save");
+                 
+                return false;
+                     
+            });
+        }
+
+        // user defined functions 
+    }
+}
diff --git a/old-javascript/Builder4/RooProjectProperties.bjs b/old-javascript/Builder4/RooProjectProperties.bjs
new file mode 100644 (file)
index 0000000..0f89141
--- /dev/null
@@ -0,0 +1,64 @@
+{
+    "id": "file-gtk-8",
+    "name": "RooProjectProperties",
+    "parent": "",
+    "title": false,
+    "path": "/home/alan/gitlive/app.Builder.js/Builder4/RooProjectProperties.bjs",
+    "items": [
+        {
+            "listeners": {
+                "delete_event": "  (self, event) => {\n    this.el.hide();\n     return true;\n}",
+                "response": "  (self, response_id)  => {\n   //print(response_id);\n   if (response_id< 1 ) {\n      this.el.hide();\n    \n      return;\n   }\n   \n   var buf =    view.el.get_buffer();\n   Gtk.TextIter s;\n     Gtk.TextIter e;\n    buf.get_start_iter(out s);\n    buf.get_end_iter(out e);\n    var str = buf.get_text(s,e,true);\n    // ideally we should syntax check it.. but it's html!?\n    \n   //var project = this.get('/Window.LeftTree').getActiveFile().project;\n   \n   \n   _this.project.runhtml = str;\n   _this.project.save();\n   \n  // imports.Builder.Provider.ProjectManager.ProjectManager.saveConfig();\n//   print (str);\n   //    this.get('view').el.get_buffer().get_text(project.runjs, project.runjs.length);\n   // ok pressed..\n   this.el.hide();\n}"
+            },
+            ".Project.Project:project": "",
+            "default_width": 500,
+            "xtype": "Dialog",
+            "|modal": "true",
+            "|void:show": " (Project.Project project) {\n    _this.project = project;\n    // get the active project.\n    \n    //print (project.fn);\n    //project.runhtml = project.runhtml || '';\n    _this.view.el.get_buffer().set_text(project.runhtml);\n    \n    this.el.show_all();\n}\n",
+            "|xns": "Gtk",
+            "items": [
+                {
+                    "border_width": 5,
+                    "xtype": "VBox",
+                    "|pack": " get_content_area().add\n",
+                    "|xns": "Gtk",
+                    "items": [
+                        {
+                            "|xns": "Gtk",
+                            "xtype": "Label",
+                            "pack": "pack_start,false,false,0",
+                            "label": "HTML To insert at end of <HEAD>"
+                        },
+                        {
+                            "|xns": "Gtk",
+                            "xtype": "ScrolledWindow",
+                            "pack": "pack_end,true,true,0",
+                            "items": [
+                                {
+                                    "|xns": "GtkSource",
+                                    "xtype": "View",
+                                    "pack": "add",
+                                    "id": "view"
+                                }
+                            ]
+                        }
+                    ]
+                },
+                {
+                    "|xns": "Gtk",
+                    "xtype": "Button",
+                    "pack": "add_action_widget,1",
+                    "label": "OK"
+                },
+                {
+                    "|xns": "Gtk",
+                    "xtype": "Button",
+                    "pack": "add_action_widget,0",
+                    "label": "Cancel"
+                }
+            ]
+        }
+    ],
+    "permname": "",
+    "modOrder": ""
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/RooProjectProperties.vala b/old-javascript/Builder4/RooProjectProperties.vala
new file mode 100644 (file)
index 0000000..11f0155
--- /dev/null
@@ -0,0 +1,322 @@
+/* -- to compile
+valac  --pkg gio-2.0  --pkg posix  --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0  --pkg  libwnck-3.0 \
+    /tmp/RooProjectProperties.vala  -o /tmp/RooProjectProperties
+*/
+
+
+/* -- to test class
+static int main (string[] args) {
+    Gtk.init (ref args);
+    new Xcls_RooProjectProperties();
+    RooProjectProperties.show_all();
+     Gtk.main ();
+    return 0;
+}
+*/
+
+
+public static Xcls_RooProjectProperties  RooProjectProperties;
+
+public class Xcls_RooProjectProperties
+{
+    public Gtk.Dialog el;
+    private static Xcls_RooProjectProperties  _this;
+
+    public Xcls_view view;
+
+        // my vars
+    public Project.Project project;
+
+        // ctor 
+    public Xcls_RooProjectProperties()
+    {
+        this.el = new Gtk.Dialog();
+        _this = this;
+        RooProjectProperties = this;
+
+        // my vars
+
+        // set gobject values
+        this.el.default_width = 500;
+        this.el.modal = true;
+        var child_0 = new Xcls_VBox2();
+        this.el. get_content_area().add
+ (  child_0.el  );
+        var child_1 = new Xcls_Button6();
+        this.el.add_action_widget (  child_1.el , 1 );
+        var child_2 = new Xcls_Button7();
+        this.el.add_action_widget (  child_2.el , 0 );
+
+        // listeners 
+        this.el.delete_event.connect(   (self, event) => {
+            this.el.hide();
+             return true;
+        } );
+        this.el.response.connect(   (self, response_id)  => {
+           //print(response_id);
+           if (response_id< 1 ) {
+              this.el.hide();
+            
+              return;
+           }
+           
+           var buf =    view.el.get_buffer();
+           Gtk.TextIter s;
+             Gtk.TextIter e;
+            buf.get_start_iter(out s);
+            buf.get_end_iter(out e);
+            var str = buf.get_text(s,e,true);
+            // ideally we should syntax check it.. but it's html!?
+            
+           //var project = this.get('/Window.LeftTree').getActiveFile().project;
+           
+           
+           _this.project.runhtml = str;
+           _this.project.save();
+           
+          // imports.Builder.Provider.ProjectManager.ProjectManager.saveConfig();
+        //   print (str);
+           //    this.get('view').el.get_buffer().get_text(project.runjs, project.runjs.length);
+           // ok pressed..
+           this.el.hide();
+        } );
+    }
+
+    // userdefined functions 
+
+    // skip listeners - not pipe 
+
+    // skip .Project.Project:project - already used 
+
+    // skip default_width - already used 
+
+    // skip xtype - not pipe 
+
+    // skip |modal - already used 
+    public void show (Project.Project project) {
+            _this.project = project;
+            // get the active project.
+            
+            //print (project.fn);
+            //project.runhtml = project.runhtml || '';
+            _this.view.el.get_buffer().set_text(project.runhtml);
+            
+            this.el.show_all();
+        }
+
+    // skip |xns - no return type
+
+    // skip items - not pipe 
+
+    // skip id - not pipe 
+
+    // skip xvala_cls - not pipe 
+
+    // skip xvala_xcls - not pipe 
+
+    // skip xvala_id - not pipe 
+    public class Xcls_VBox2
+    {
+        public Gtk.VBox el;
+
+            // my vars
+
+            // ctor 
+        public Xcls_VBox2()
+        {
+            this.el = new Gtk.VBox( true, 0 );
+
+            // my vars
+
+            // set gobject values
+            this.el.border_width = 5;
+            var child_0 = new Xcls_Label3();
+            this.el.pack_start (  child_0.el , false,false,0 );
+            var child_1 = new Xcls_ScrolledWindow4();
+            this.el.pack_end (  child_1.el , true,true,0 );
+        }
+
+        // userdefined functions 
+
+        // skip border_width - already used 
+
+        // skip xtype - not pipe 
+
+        // skip |pack - already used 
+
+        // skip |xns - no return type
+
+        // skip items - not pipe 
+
+        // skip xvala_cls - not pipe 
+
+        // skip xvala_xcls - not pipe 
+
+        // skip xvala_id - not pipe 
+    }
+    public class Xcls_Label3
+    {
+        public Gtk.Label el;
+
+            // my vars
+
+            // ctor 
+        public Xcls_Label3()
+        {
+            this.el = new Gtk.Label( "HTML To insert at end of <HEAD>" );
+
+            // my vars
+
+            // set gobject values
+        }
+
+        // userdefined functions 
+
+        // skip |xns - no return type
+
+        // skip xtype - not pipe 
+
+        // skip pack - not pipe 
+
+        // skip label - already used 
+
+        // skip xvala_cls - not pipe 
+
+        // skip xvala_xcls - not pipe 
+
+        // skip xvala_id - not pipe 
+    }
+    public class Xcls_ScrolledWindow4
+    {
+        public Gtk.ScrolledWindow el;
+
+            // my vars
+
+            // ctor 
+        public Xcls_ScrolledWindow4()
+        {
+            this.el = new Gtk.ScrolledWindow( null, null );
+
+            // my vars
+
+            // set gobject values
+            var child_0 = new Xcls_view();
+            this.el.add (  child_0.el  );
+        }
+
+        // userdefined functions 
+
+        // skip |xns - no return type
+
+        // skip xtype - not pipe 
+
+        // skip pack - not pipe 
+
+        // skip items - not pipe 
+
+        // skip xvala_cls - not pipe 
+
+        // skip xvala_xcls - not pipe 
+
+        // skip xvala_id - not pipe 
+    }
+    public class Xcls_view
+    {
+        public Gtk.SourceView el;
+
+            // my vars
+
+            // ctor 
+        public Xcls_view()
+        {
+            this.el = new Gtk.SourceView();
+            _this.view = this;
+
+            // my vars
+
+            // set gobject values
+        }
+
+        // userdefined functions 
+
+        // skip |xns - no return type
+
+        // skip xtype - not pipe 
+
+        // skip pack - not pipe 
+
+        // skip id - not pipe 
+
+        // skip xvala_cls - not pipe 
+
+        // skip xvala_xcls - not pipe 
+
+        // skip xvala_id - not pipe 
+    }
+    public class Xcls_Button6
+    {
+        public Gtk.Button el;
+
+            // my vars
+
+            // ctor 
+        public Xcls_Button6()
+        {
+            this.el = new Gtk.Button();
+
+            // my vars
+
+            // set gobject values
+            this.el.label = "OK";
+        }
+
+        // userdefined functions 
+
+        // skip |xns - no return type
+
+        // skip xtype - not pipe 
+
+        // skip pack - not pipe 
+
+        // skip label - already used 
+
+        // skip xvala_cls - not pipe 
+
+        // skip xvala_xcls - not pipe 
+
+        // skip xvala_id - not pipe 
+    }
+    public class Xcls_Button7
+    {
+        public Gtk.Button el;
+
+            // my vars
+
+            // ctor 
+        public Xcls_Button7()
+        {
+            this.el = new Gtk.Button();
+
+            // my vars
+
+            // set gobject values
+            this.el.label = "Cancel";
+        }
+
+        // userdefined functions 
+
+        // skip |xns - no return type
+
+        // skip xtype - not pipe 
+
+        // skip pack - not pipe 
+
+        // skip label - already used 
+
+        // skip xvala_cls - not pipe 
+
+        // skip xvala_xcls - not pipe 
+
+        // skip xvala_id - not pipe 
+    }
+}
diff --git a/old-javascript/Builder4/StandardErrorDialog.bjs b/old-javascript/Builder4/StandardErrorDialog.bjs
new file mode 100644 (file)
index 0000000..b9c35ea
--- /dev/null
@@ -0,0 +1,25 @@
+{
+    "id": "file-gtk-14",
+    "name": "StandardErrorDialog",
+    "parent": "",
+    "title": false,
+    "path": "/home/alan/gitlive/app.Builder.js/Builder4/StandardErrorDialog.bjs",
+    "items": [
+        {
+            "listeners": {
+                "delete_event": "  (self, event)  => {\n    this.el.hide();\n    return true;\n    \n} \n",
+                "response": "  (self, response_id) => {\n   this.el.hide();\n}"
+            },
+            "text": "fixme",
+            "xtype": "MessageDialog",
+            "|buttons": "Gtk.ButtonsType.OK",
+            "|message_type": "Gtk.MessageType.ERROR",
+            "|modal": "true",
+            "|use_markup": "true",
+            "|void:show": " (Gtk.Window win, string msg) {\n\n    this.el.set_transient_for(win);\n    this.el.modal = true;\n    this.el.text =  msg;\n    this.el.show_all();\n}\n",
+            "|xns": "Gtk"
+        }
+    ],
+    "permname": "",
+    "modOrder": ""
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/StandardErrorDialog.vala b/old-javascript/Builder4/StandardErrorDialog.vala
new file mode 100644 (file)
index 0000000..ec34380
--- /dev/null
@@ -0,0 +1,69 @@
+/* -- to compile
+valac  --pkg gio-2.0  --pkg posix  --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0  --pkg  libwnck-3.0 \
+    /tmp/StandardErrorDialog.vala  -o /tmp/StandardErrorDialog
+*/
+
+
+/* -- to test class
+static int main (string[] args) {
+    Gtk.init (ref args);
+    new Xcls_StandardErrorDialog();
+    StandardErrorDialog.show_all();
+     Gtk.main ();
+    return 0;
+}
+*/
+
+
+public static Xcls_StandardErrorDialog  StandardErrorDialog;
+
+public class Xcls_StandardErrorDialog : Object 
+{
+    public Gtk.MessageDialog el;
+    private Xcls_StandardErrorDialog  _this;
+
+    public static Xcls_StandardErrorDialog singleton()
+    {
+        if (StandardErrorDialog == null) {
+            StandardErrorDialog= new Xcls_StandardErrorDialog();
+        }
+        return StandardErrorDialog;
+    }
+
+        // my vars
+
+        // ctor 
+    public Xcls_StandardErrorDialog()
+    {
+        _this = this;
+        this.el = new Gtk.MessageDialog( null, Gtk.DialogFlags.MODAL, Gtk.MessageType.ERROR, Gtk.ButtonsType.OK, "fixme" );
+
+        // my vars
+
+        // set gobject values
+        this.el.modal = true;
+        this.el.use_markup = true;
+
+        // listeners 
+        this.el.delete_event.connect(   (self, event)  => {
+            this.el.hide();
+            return true;
+            
+        } 
+         );
+        this.el.response.connect(   (self, response_id) => {
+           this.el.hide();
+        } );
+    }
+
+    // userdefined functions 
+    public void show (Gtk.Window win, string msg) {
+        
+            this.el.set_transient_for(win);
+            this.el.modal = true;
+            this.el.text =  msg;
+            this.el.show_all();
+        }
+
+    // skip |xns - no return type
+}
diff --git a/old-javascript/Builder4/ValaProjectSettings.bjs b/old-javascript/Builder4/ValaProjectSettings.bjs
new file mode 100644 (file)
index 0000000..918088f
--- /dev/null
@@ -0,0 +1,413 @@
+{
+    "name" : "ValaProjectSettings",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/ValaProjectSettings.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "items" : [
+        {
+            "# Project.Gtk project" : "null",
+            "# Xcls_MainWindow window" : "null",
+            "| void show" : "(Project.Gtk project) {\n    \n    \n    print(\"ValaProjectSettings show\\n\");\n    \n    this.project=  project;\n\n    this.compile_flags.el.text = \"\";\n    \n    this.default_directory_tree_store.load();    \n    this.default_packages_tree_store.load();            \n    this.targets_tree_store.load();\n    this.files_tree_store.load();\n\n}\n",
+            "xtype" : "VBox",
+            "string id" : "ValaProjectSettings",
+            "$ xns" : "Gtk",
+            "items" : [
+                {
+                    "* pack" : "pack_start,true,true,0",
+                    "xtype" : "Notebook",
+                    "$ xns" : "Gtk",
+                    "items" : [
+                        {
+                            "id" : "label_global",
+                            "xtype" : "Label",
+                            "* pack" : false,
+                            "$ xns" : "Gtk",
+                            "utf8 label" : "Global"
+                        },
+                        {
+                            "id" : "label_targets",
+                            "* pack" : false,
+                            "xtype" : "Label",
+                            "$ xns" : "Gtk",
+                            "utf8 label" : "Targets"
+                        },
+                        {
+                            "xtype" : "VBox",
+                            "* pack" : "append_page,_this.label_global.el",
+                            "gboolean homogeneous" : false,
+                            "$ xns" : "Gtk",
+                            "items" : [
+                                {
+                                    "xtype" : "Label",
+                                    "* pack" : "pack_start,false,false,0",
+                                    "$ xns" : "Gtk",
+                                    "utf8 label" : "compile flags"
+                                },
+                                {
+                                    "id" : "compile_flags",
+                                    "xtype" : "Entry",
+                                    "* pack" : "pack_start,false,false,0",
+                                    "$ xns" : "Gtk"
+                                },
+                                {
+                                    "xtype" : "Label",
+                                    "* pack" : "pack_start,false,false,0",
+                                    "$ xns" : "Gtk",
+                                    "utf8 label" : "packages"
+                                },
+                                {
+                                    "* pack" : "pack_start,true,true,0",
+                                    "xtype" : "ScrolledWindow",
+                                    "$ xns" : "Gtk",
+                                    "items" : [
+                                        {
+                                            "gboolean headers_visible" : false,
+                                            "* pack" : "add",
+                                            "xtype" : "TreeView",
+                                            "string id" : "default_packages_tree",
+                                            "$ xns" : "Gtk",
+                                            "items" : [
+                                                {
+                                                    "id" : "default_packages_tree_store",
+                                                    "* pack" : "set_model",
+                                                    "xtype" : "ListStore",
+                                                    "$ n_columns" : 2,
+                                                    "| void load" : "() {\n \n    var def = _this.project.compilegroups.get(\"_default_\");\n     var items  = def.packages;\n    \n    this.el.clear();\n    var pal = (Palete.Gtk) Palete.factory(\"Gtk\");\n    var pkgs = pal.packages();\n    print(\"ValaProjectSettings:packages load %d\\n\", pkgs.size);\n\n    Gtk.TreeIter citer;\n\n    for(var i =0 ; i < pkgs.size; i++) {\n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   pkgs.get(i) ); // title \n        this.el.set_value(citer, 1,   items.contains(pkgs.get(i)) );\n    }\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    \n}\n",
+                                                    "$ columns" : "    typeof(string),  // 0 key type\n      typeof(bool)",
+                                                    "$ xns" : "Gtk"
+                                                },
+                                                {
+                                                    "utf8 title" : "name",
+                                                    "* init" : " \n this.el.add_attribute(_this.packages_render.el , \"text\", 0 );\n  ",
+                                                    "* pack" : "append_column",
+                                                    "xtype" : "TreeViewColumn",
+                                                    "gboolean resizable" : true,
+                                                    "gboolean expand" : true,
+                                                    "$ xns" : "Gtk",
+                                                    "items" : [
+                                                        {
+                                                            "id" : "packages_render",
+                                                            "* pack" : "pack_start,false",
+                                                            "xtype" : "CellRendererText",
+                                                            "$ xns" : "Gtk"
+                                                        }
+                                                    ]
+                                                },
+                                                {
+                                                    "utf8 title" : "use",
+                                                    "* init" : "{\n this.el.add_attribute(_this.packages_render_use.el , \"active\", 1 );\n }",
+                                                    "* pack" : "append_column",
+                                                    "xtype" : "TreeViewColumn",
+                                                    "gboolean resizable" : false,
+                                                    "$ xns" : "Gtk",
+                                                    "gint fixed_width" : 50,
+                                                    "items" : [
+                                                        {
+                                                            "listeners" : {
+                                                                "toggled" : "(  path_string) =>  { \n    var m = _this.default_packages_tree_store.el;\n   Gtk.TreeIter iter;\n   Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);\n   m.get_iter (out iter, path);\n   GLib.Value val;\n   m.get_value(iter, 1, out val);\n   m.set_value(iter, 1,  ((bool) val) ? false :true); \n     GLib.Value fval;  \n   m.get_value(iter, 0, out fval);\n   var fn = (string)fval;\n    \n    var def = _this.project.compilegroups.get(\"_default_\");\n    var items  = def.packages;\n    if ((bool)val) {\n        // renive\n        items.remove(fn);\n    } else {\n        items.add(fn);\n    }\n    \n}"
+                                                            },
+                                                            "id" : "packages_render_use",
+                                                            "xtype" : "CellRendererToggle",
+                                                            "* pack" : "pack_start,false",
+                                                            "$ xns" : "Gtk",
+                                                            "gboolean activatable" : true
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                },
+                                {
+                                    "xtype" : "Label",
+                                    "* pack" : "pack_start,false,false,0",
+                                    "$ xns" : "Gtk",
+                                    "utf8 label" : "Available Directories"
+                                },
+                                {
+                                    "* pack" : "pack_start,true,true,0",
+                                    "xtype" : "ScrolledWindow",
+                                    "$ xns" : "Gtk",
+                                    "items" : [
+                                        {
+                                            "listeners" : {
+                                                "button_press_event" : " ( ev) => {\n    //console.log(\"button press?\");\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.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.default_directory_menu.el.set_screen(Gdk.Screen.get_default());\n     _this.default_directory_menu.el.show_all();\n      _this.default_directory_menu.el.popup(null, null, null,  3, ev.time);\n     //   print(\"click:\" + res.path.to_string());\n      return true;\n}"
+                                            },
+                                            "gboolean headers_visible" : false,
+                                            "id" : "default_directory_tree",
+                                            "* pack" : "add",
+                                            "xtype" : "TreeView",
+                                            "$ xns" : "Gtk",
+                                            "items" : [
+                                                {
+                                                    "id" : "default_directory_tree_store",
+                                                    "* pack" : "set_model",
+                                                    "xtype" : "ListStore",
+                                                    "$ n_columns" : 1,
+                                                    "| void load" : "() {\n \n  this.el.clear();\n  \n    \n     var def = _this.project.compilegroups.get(\"_default_\");\n     var items  = def.sources;\n     \n \n    Gtk.TreeIter citer;\n\n    for(var i =0 ; i < items.size; i++) {\n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   items.get(i) ); // title \n        //this.el.set_value(citer, 1,   items.get(i) );\n    }\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    \n}\n",
+                                                    "$ columns" : "    typeof(string)\n     ",
+                                                    "$ xns" : "Gtk"
+                                                },
+                                                {
+                                                    "utf8 title" : "name",
+                                                    "* init" : "\n this.el.add_attribute(_this.directory_render.el , \"text\", 0 );\n  ",
+                                                    "* pack" : "append_column",
+                                                    "xtype" : "TreeViewColumn",
+                                                    "gboolean resizable" : true,
+                                                    "$ xns" : "Gtk",
+                                                    "items" : [
+                                                        {
+                                                            "id" : "directory_render",
+                                                            "* pack" : "pack_start,false",
+                                                            "xtype" : "CellRendererText",
+                                                            "$ xns" : "Gtk"
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            "id" : "default_directory_menu",
+                                            "xtype" : "Menu",
+                                            "$ xns" : "Gtk",
+                                            "items" : [
+                                                {
+                                                    "listeners" : {
+                                                        "activate" : "()  => {\n    \n    var  chooser = new Gtk.FileChooserDialog (\n\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.SELECT_FOLDER ,\n\t\"_Cancel\",\n\tGtk.ResponseType.CANCEL,\n\t\"_Add\",\n\tGtk.ResponseType.ACCEPT);\n    if (chooser.run () != Gtk.ResponseType.ACCEPT) {\n        chooser.close ();\n           return;\n       }\n       chooser.close ();\n       // add the directory..\n       var fn = _this.project.relPath(chooser.get_filename());\n       _this.project.compilegroups.get(\"_default_\").sources.add(fn);\n       _this.default_directory_tree_store.load();\n}"
+                                                    },
+                                                    "* pack" : "add",
+                                                    "xtype" : "MenuItem",
+                                                    "$ xns" : "Gtk",
+                                                    "utf8 label" : "Add Directory"
+                                                },
+                                                {
+                                                    "listeners" : {
+                                                        "activate" : "()  => {\n    \n    var  chooser = new Gtk.FileChooserDialog (\n\t\"Add a directory\", _this.window.el, Gtk.FileChooserAction.OPEN ,\n\t\"_Cancel\",\n\tGtk.ResponseType.CANCEL,\n\t\"_Add\",\n\tGtk.ResponseType.ACCEPT);\n    if (chooser.run () != Gtk.ResponseType.ACCEPT) {\n        chooser.close ();\n           return;\n       }\n       chooser.close ();\n       // add the directory..\n       var fn = _this.project.relPath(chooser.get_filename());\n       _this.project.compilegroups.get(\"_default_\").sources.add(fn);\n       _this.default_directory_tree_store.load();\n}"
+                                                    },
+                                                    "* pack" : "add",
+                                                    "xtype" : "MenuItem",
+                                                    "$ xns" : "Gtk",
+                                                    "utf8 label" : "Add File"
+                                                },
+                                                {
+                                                    "* pack" : "add",
+                                                    "xtype" : "SeparatorMenuItem",
+                                                    "$ xns" : "Gtk"
+                                                },
+                                                {
+                                                    "listeners" : {
+                                                        "activate" : "()  => {\n    \n     //\n        Gtk.TreeModel mod;\n        Gtk.TreeIter iter;\n        if (!_this.default_directory_tree.el.get_selection().get_selected(out mod, out iter)) {\n               print(\"nothing selected\\n\");\n            return;\n        }\n\n            \n       // add the directory..\n       \n       \n       GLib.Value val;\n        mod.get_value(iter,0, out val);\n       var fn =  (string) val;\n       \n       print(\"remove: %s\\n\", fn);\n       if (!_this.project.compilegroups.get(\"_default_\").sources.remove(fn)) {\n                  print(\"remove failed\");\n              }\n       _this.default_directory_tree_store.load();\n}"
+                                                    },
+                                                    "* pack" : "add",
+                                                    "xtype" : "MenuItem",
+                                                    "$ xns" : "Gtk",
+                                                    "utf8 label" : "Remove File/Directory"
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                }
+                            ]
+                        },
+                        {
+                            "gint position" : 300,
+                            "xtype" : "HPaned",
+                            "* pack" : "append_page,_this.label_targets.el",
+                            "$ xns" : "Gtk",
+                            "items" : [
+                                {
+                                    "* init" : "{  \nthis.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n\n}\n",
+                                    "xtype" : "ScrolledWindow",
+                                    "* pack" : "add1",
+                                    "$ xns" : "Gtk",
+                                    "items" : [
+                                        {
+                                            "id" : "targets_tree_menu",
+                                            "* pack" : "add",
+                                            "xtype" : "Menu",
+                                            "$ xns" : "Gtk",
+                                            "items" : [
+                                                {
+                                                    "listeners" : {
+                                                        "activate" : "()  => {\n    \n       if (_this.project.compilegroups.has_key(\"NEW GROUP\")) {\n        return;\n    }\n      \n       // add the directory..\n       \n       _this.project.compilegroups.set(\"NEW GROUP\", new Project.GtkValaSettings(\"NEW GROUP\"));\n       _this.targets_tree_store.load();\n}"
+                                                    },
+                                                    "* pack" : "add",
+                                                    "xtype" : "MenuItem",
+                                                    "$ xns" : "Gtk",
+                                                    "utf8 label" : "Add Compile Target"
+                                                },
+                                                {
+                                                    "* pack" : "add",
+                                                    "xtype" : "SeparatorMenuItem",
+                                                    "$ xns" : "Gtk"
+                                                },
+                                                {
+                                                    "listeners" : {
+                                                        "activate" : "()  => {\n    \n     //\n        Gtk.TreeModel mod;\n        Gtk.TreeIter iter;\n        if (!_this.targets_tree.el.get_selection().get_selected(out mod, out iter)) {\n               print(\"nothing selected\\n\");\n            return;\n        }\n\n            \n       // add the directory..\n       \n       \n       GLib.Value val;\n        mod.get_value(iter,0, out val);\n       var fn =  (string) val;\n       \n       print(\"remove: %s\\n\", fn);\n       if (!_this.project.compilegroups.unset(fn)) {\n                  print(\"remove failed\");\n      }\n       _this.targets_tree_store.load();\n}"
+                                                    },
+                                                    "* pack" : "add",
+                                                    "xtype" : "MenuItem",
+                                                    "$ xns" : "Gtk",
+                                                    "utf8 label" : "Remove Target"
+                                                }
+                                            ]
+                                        },
+                                        {
+                                            "listeners" : {
+                                                "button_press_event" : " ( ev) => {\n    //console.log(\"button press?\");\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.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.targets_tree_menu.el.set_screen(Gdk.Screen.get_default());\n     _this.targets_tree_menu.el.show_all();\n      _this.targets_tree_menu.el.popup(null, null, null,  3, ev.time);\n     //   print(\"click:\" + res.path.to_string());\n      return true;\n}",
+                                                "cursor_changed" : " ( ) => {\n\n    if (this.cursor != \"\") {\n         // save the values..\n     }\n     \n     // load the new values.\n     \n\n         Gtk.TreeModel mod;\n        Gtk.TreeIter iter;\n        if (!this.el.get_selection().get_selected(out mod, out iter)) {\n               print(\"nothing selected\\n\");\n            return;\n        }\n\n            \n       // add the directory..\n       \n       \n       GLib.Value val;\n        mod.get_value(iter,0, out val);\n       var fn =  (string) val;\n       \n       this.cursor = fn;\n       var cg = _this.project.compilegroups.get(fn);\n       _this.build_pack_target.el.set_text(cg.target_bin);\n       _this.build_compile_flags.el.set_text(cg.compile_flags);\n       // load the srouces\n\n\n  }"
+                                            },
+                                            "id" : "targets_tree",
+                                            "# string cursor" : "",
+                                            "* pack" : "add",
+                                            "xtype" : "TreeView",
+                                            "$ xns" : "Gtk",
+                                            "items" : [
+                                                {
+                                                    "id" : "targets_tree_store",
+                                                    "xtype" : "ListStore",
+                                                    "* pack" : "set_model",
+                                                    "$ n_columns" : 2,
+                                                    "| void load" : "() {\n \n  this.el.clear();\n  \n    \n     var cg = _this.project.compilegroups;\n     \n   _this.targets_tree.cursor = \"\";\n    Gtk.TreeIter citer;\n    var iter = cg.map_iterator();\n   while(iter.next()) {\n        var key = iter.get_key();\n        if (key == \"_default_\") {\n            continue;\n        }\n    \n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   key ); // title \n        //this.el.set_value(citer, 1,   items.get(i) );\n    };\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    \n}\n",
+                                                    "$ columns" : "    typeof(string),  // 0 key type\n     typeof(string) // ??\n     ",
+                                                    "$ xns" : "Gtk"
+                                                },
+                                                {
+                                                    "utf8 title" : "name",
+                                                    "* init" : " {\n     this.el.add_attribute(_this.targets_render.el , \"text\", 0 );\n }",
+                                                    "* pack" : "append_column",
+                                                    "xtype" : "TreeViewColumn",
+                                                    "gboolean resizable" : true,
+                                                    "$ xns" : "Gtk",
+                                                    "items" : [
+                                                        {
+                                                            "listeners" : {
+                                                                "edited" : "  (path, newtext) => {\n     \n     Gtk.TreeIter  iter;\n        _this.targets_tree_store.el.get_iter(out iter, new Gtk.TreePath.from_string(path));\n       GLib.Value gval;\n        _this.targets_tree_store.el.get_value(iter,0, out gval);\n        var oldval = (string)gval;\n       if (oldval == newtext) {\n          return;\n        }\n         var cg = _this.project.compilegroups.get(oldval);\n        cg.name = newtext;\n        _this.project.compilegroups.unset(oldval);\n        _this.project.compilegroups.set(newtext, cg);\n    _this.targets_tree_store.load();\n  }"
+                                                            },
+                                                            "id" : "targets_render",
+                                                            "xtype" : "CellRendererText",
+                                                            "* pack" : "pack_start,false",
+                                                            "$ xns" : "Gtk",
+                                                            "gboolean editable" : true
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                },
+                                {
+                                    "xtype" : "VBox",
+                                    "* pack" : "add2",
+                                    "string id" : "set_vbox",
+                                    "gboolean homogeneous" : false,
+                                    "$ xns" : "Gtk",
+                                    "items" : [
+                                        {
+                                            "xtype" : "Label",
+                                            "* pack" : "pack_start,false,false,0",
+                                            "$ xns" : "Gtk",
+                                            "utf8 label" : "target filename"
+                                        },
+                                        {
+                                            "listeners" : {
+                                                "changed" : "()  => {\n        if (_this.targets_tree.cursor.length < 1) {\n        return;\n    }\n    _this.project.compilegroups.get(_this.targets_tree.cursor).target_bin = this.el.text;\n}"
+                                            },
+                                            "id" : "build_pack_target",
+                                            "xtype" : "Entry",
+                                            "* pack" : "pack_start,false,false,0",
+                                            "$ xns" : "Gtk"
+                                        },
+                                        {
+                                            "xtype" : "Label",
+                                            "* pack" : "pack_start,false,false,0",
+                                            "$ xns" : "Gtk",
+                                            "utf8 label" : "compile flags"
+                                        },
+                                        {
+                                            "listeners" : {
+                                                "changed" : "() => {\n    if (_this.targets_tree.cursor.length < 1) {\n        return;\n    }\n    _this.project.compilegroups.get(_this.targets_tree.cursor).compile_flags = this.el.text;\n}"
+                                            },
+                                            "id" : "build_compile_flags",
+                                            "xtype" : "Entry",
+                                            "* pack" : "pack_start,false,false,0",
+                                            "$ xns" : "Gtk"
+                                        },
+                                        {
+                                            "xtype" : "Label",
+                                            "* pack" : "pack_start,false,false,0",
+                                            "$ xns" : "Gtk",
+                                            "utf8 label" : "Files to compile"
+                                        },
+                                        {
+                                            "* pack" : "pack_start,true,true,0",
+                                            "xtype" : "ScrolledWindow",
+                                            "$ xns" : "Gtk",
+                                            "items" : [
+                                                {
+                                                    "xtype" : "TreeView",
+                                                    "string id" : "files_tree",
+                                                    "$ xns" : "Gtk",
+                                                    "items" : [
+                                                        {
+                                                            "id" : "files_tree_store",
+                                                            "xtype" : "ListStore",
+                                                            "* pack" : "set_model",
+                                                            "$ n_columns" : 2,
+                                                            "| void load" : "() {\n \n  this.el.clear();\n  \n    \n     var def = _this.project.compilegroups.get(\"_default_\");\n     var items  = def.sources;\n     \n \n    Gtk.TreeIter citer;\n\n    for(var i =0 ; i < items.size; i++) {\n         this.el.append(out citer);   \n         \n        this.el.set_value(citer, 0,   items.get(i) ); // title \n        this.el.set_value(citer, 1,   \"dir\"); // type         \n        this.el.set_value(citer, 2,   false ); // checked \n        /*\n        var files = def.files(items.get(i));\n        \n         for(var j =0 ; j < files.size; j++) {\n            this.el.append(out citer);   \n         \n            this.el.set_value(citer, 0,   files.get(j) ); // title \n            this.el.set_value(citer, 1,   \"file\"); // type         \n            this.el.set_value(citer, 2,   false ); // checked \n\n        }\n        */\n        \n        //this.el.set_value(citer, 1,   items.get(i) );\n    }\n    this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    \n}\n ",
+                                                            "$ columns" : "    typeof(string),  // 0 file name\n     typeof(string), // type (dir orfile)\n     typeof(bool)  // is checked.\n     ",
+                                                            "$ xns" : "Gtk"
+                                                        },
+                                                        {
+                                                            "utf8 title" : "name",
+                                                            "* init" : "/* this.el.add_attribute(_this.files_render.el , \"markup\", 2 );\n// this.el.add_attribute(_this.files_render.el , \"text\", 1 ); */\n \n",
+                                                            "* pack" : "append_column",
+                                                            "xtype" : "TreeViewColumn",
+                                                            "gboolean resizable" : true,
+                                                            "$ xns" : "Gtk",
+                                                            "items" : [
+                                                                {
+                                                                    "id" : "files_render",
+                                                                    "* pack" : "pack_start,false",
+                                                                    "xtype" : "CellRendererText",
+                                                                    "$ xns" : "Gtk"
+                                                                }
+                                                            ]
+                                                        },
+                                                        {
+                                                            "utf8 title" : "use",
+                                                            "* init" : "/*\n\n this.el.add_attribute(_this.packages_render_use.el , \"active\", 1 );\n \n */\n ",
+                                                            "* pack" : "append_column",
+                                                            "xtype" : "TreeViewColumn",
+                                                            "gboolean resizable" : false,
+                                                            "$ xns" : "Gtk",
+                                                            "gint fixed_width" : 50,
+                                                            "items" : [
+                                                                {
+                                                                    "listeners" : {
+                                                                        "toggled" : "(  path_string) =>  { \n    var m = _this.default_packages_tree_store.el;\n   Gtk.TreeIter iter;\n   Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);\n   m.get_iter (out iter, path);\n   GLib.Value val;\n   m.get_value(iter, 1, out val);\n   m.set_value(iter, 1,  ((bool) val) ? false :true); \n     GLib.Value fval;  \n   m.get_value(iter, 0, out fval);\n   var fn = (string)fval;\n    \n    var def = _this.project.compilegroups.get(\"_default_\");\n    var items  = def.packages;\n    if ((bool)val) {\n        // renive\n        items.remove(fn);\n    } else {\n        items.add(fn);\n    }\n    \n}"
+                                                                    },
+                                                                    "id" : "files_render_use",
+                                                                    "xtype" : "CellRendererToggle",
+                                                                    "* pack" : "pack_start,false",
+                                                                    "$ xns" : "Gtk",
+                                                                    "gboolean activatable" : true
+                                                                }
+                                                            ]
+                                                        }
+                                                    ]
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/ValaProjectSettings.vala b/old-javascript/Builder4/ValaProjectSettings.vala
new file mode 100644 (file)
index 0000000..79cc26e
--- /dev/null
@@ -0,0 +1,1675 @@
+static ValaProjectSettings  _ValaProjectSettings;
+
+public class ValaProjectSettings : Object 
+{
+    public Gtk.VBox el;
+    private ValaProjectSettings  _this;
+
+    public static ValaProjectSettings singleton()
+    {
+        if (_ValaProjectSettings == null) {
+            _ValaProjectSettings= new ValaProjectSettings();
+        }
+        return _ValaProjectSettings;
+    }
+    public Xcls_label_global label_global;
+    public Xcls_label_targets label_targets;
+    public Xcls_compile_flags compile_flags;
+    public Xcls_default_packages_tree_store default_packages_tree_store;
+    public Xcls_packages_render packages_render;
+    public Xcls_packages_render_use packages_render_use;
+    public Xcls_default_directory_tree default_directory_tree;
+    public Xcls_default_directory_tree_store default_directory_tree_store;
+    public Xcls_directory_render directory_render;
+    public Xcls_default_directory_menu default_directory_menu;
+    public Xcls_targets_tree_menu targets_tree_menu;
+    public Xcls_targets_tree targets_tree;
+    public Xcls_targets_tree_store targets_tree_store;
+    public Xcls_targets_render targets_render;
+    public Xcls_build_pack_target build_pack_target;
+    public Xcls_build_compile_flags build_compile_flags;
+    public Xcls_files_tree_store files_tree_store;
+    public Xcls_files_render files_render;
+    public Xcls_files_render_use files_render_use;
+
+        // my vars (def)
+    public Project.Gtk project;
+    public Xcls_MainWindow window;
+
+    // ctor 
+    public ValaProjectSettings()
+    {
+        _this = this;
+        this.el = new Gtk.VBox( true, 0 );
+
+        // my vars (dec)
+        this.project = null;
+        this.window = null;
+
+        // set gobject values
+        var child_0 = new Xcls_Notebook2( _this );
+        child_0.ref();
+        this.el.pack_start (  child_0.el , true,true,0 );
+    }
+
+    // user defined functions 
+    public void show (Project.Gtk project) {
+        
+        
+        print("ValaProjectSettings show\n");
+        
+        this.project=  project;
+    
+        this.compile_flags.el.text = "";
+        
+        this.default_directory_tree_store.load();    
+        this.default_packages_tree_store.load();            
+        this.targets_tree_store.load();
+        this.files_tree_store.load();
+    
+    }
+    public class Xcls_Notebook2 : Object 
+    {
+        public Gtk.Notebook el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Notebook2(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Notebook();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_label_global( _this );
+            child_0.ref();
+            var child_1 = new Xcls_label_targets( _this );
+            child_1.ref();
+            var child_2 = new Xcls_VBox5( _this );
+            child_2.ref();
+            this.el.append_page (  child_2.el , _this.label_global.el );
+            var child_3 = new Xcls_HPaned27( _this );
+            child_3.ref();
+            this.el.append_page (  child_3.el , _this.label_targets.el );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_label_global : Object 
+    {
+        public Gtk.Label el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_label_global(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.label_global = this;
+            this.el = new Gtk.Label( "Global" );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_label_targets : Object 
+    {
+        public Gtk.Label el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_label_targets(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.label_targets = this;
+            this.el = new Gtk.Label( "Targets" );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_VBox5 : Object 
+    {
+        public Gtk.VBox el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_VBox5(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.VBox( false, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Label6( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false,false,0 );
+            var child_1 = new Xcls_compile_flags( _this );
+            child_1.ref();
+            this.el.pack_start (  child_1.el , false,false,0 );
+            var child_2 = new Xcls_Label8( _this );
+            child_2.ref();
+            this.el.pack_start (  child_2.el , false,false,0 );
+            var child_3 = new Xcls_ScrolledWindow9( _this );
+            child_3.ref();
+            this.el.pack_start (  child_3.el , true,true,0 );
+            var child_4 = new Xcls_Label16( _this );
+            child_4.ref();
+            this.el.pack_start (  child_4.el , false,false,0 );
+            var child_5 = new Xcls_ScrolledWindow17( _this );
+            child_5.ref();
+            this.el.pack_start (  child_5.el , true,true,0 );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label6 : Object 
+    {
+        public Gtk.Label el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label6(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "compile flags" );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_compile_flags : Object 
+    {
+        public Gtk.Entry el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_compile_flags(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.compile_flags = this;
+            this.el = new Gtk.Entry();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label8 : Object 
+    {
+        public Gtk.Label el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label8(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "packages" );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_ScrolledWindow9 : Object 
+    {
+        public Gtk.ScrolledWindow el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_ScrolledWindow9(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.ScrolledWindow( null, null );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_default_packages_tree( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_default_packages_tree : Object 
+    {
+        public Gtk.TreeView el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_default_packages_tree(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.TreeView();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.headers_visible = false;
+            var child_0 = new Xcls_default_packages_tree_store( _this );
+            child_0.ref();
+            this.el.set_model (  child_0.el  );
+            var child_1 = new Xcls_TreeViewColumn12( _this );
+            child_1.ref();
+            this.el.append_column (  child_1.el  );
+            var child_2 = new Xcls_TreeViewColumn14( _this );
+            child_2.ref();
+            this.el.append_column (  child_2.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_default_packages_tree_store : Object 
+    {
+        public Gtk.ListStore el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_default_packages_tree_store(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.default_packages_tree_store = this;
+            this.el = new Gtk.ListStore( 2,     typeof(string),  // 0 key type
+      typeof(bool) );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+        public void load () {
+         
+            var def = _this.project.compilegroups.get("_default_");
+             var items  = def.packages;
+            
+            this.el.clear();
+            var pal = (Palete.Gtk) Palete.factory("Gtk");
+            var pkgs = pal.packages();
+            print("ValaProjectSettings:packages load %d\n", pkgs.size);
+        
+            Gtk.TreeIter citer;
+        
+            for(var i =0 ; i < pkgs.size; i++) {
+                 this.el.append(out citer);   
+                 
+                this.el.set_value(citer, 0,   pkgs.get(i) ); // title 
+                this.el.set_value(citer, 1,   items.contains(pkgs.get(i)) );
+            }
+            this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
+            
+        }
+    }
+    public class Xcls_TreeViewColumn12 : Object 
+    {
+        public Gtk.TreeViewColumn el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_TreeViewColumn12(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.TreeViewColumn();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.title = "name";
+            this.el.expand = true;
+            this.el.resizable = true;
+            var child_0 = new Xcls_packages_render( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false );
+
+            // init method 
+
+            this.el.add_attribute(_this.packages_render.el , "text", 0 );        }
+
+        // user defined functions 
+    }
+    public class Xcls_packages_render : Object 
+    {
+        public Gtk.CellRendererText el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_packages_render(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.packages_render = this;
+            this.el = new Gtk.CellRendererText();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_TreeViewColumn14 : Object 
+    {
+        public Gtk.TreeViewColumn el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_TreeViewColumn14(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.TreeViewColumn();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.title = "use";
+            this.el.resizable = false;
+            this.el.fixed_width = 50;
+            var child_0 = new Xcls_packages_render_use( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false );
+
+            // init method 
+
+            {
+             this.el.add_attribute(_this.packages_render_use.el , "active", 1 );
+             }        }
+
+        // user defined functions 
+    }
+    public class Xcls_packages_render_use : Object 
+    {
+        public Gtk.CellRendererToggle el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_packages_render_use(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.packages_render_use = this;
+            this.el = new Gtk.CellRendererToggle();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.activatable = true;
+
+            // listeners 
+            this.el.toggled.connect( (  path_string) =>  { 
+                var m = _this.default_packages_tree_store.el;
+               Gtk.TreeIter iter;
+               Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);
+               m.get_iter (out iter, path);
+               GLib.Value val;
+               m.get_value(iter, 1, out val);
+               m.set_value(iter, 1,  ((bool) val) ? false :true); 
+                 GLib.Value fval;  
+               m.get_value(iter, 0, out fval);
+               var fn = (string)fval;
+                
+                var def = _this.project.compilegroups.get("_default_");
+                var items  = def.packages;
+                if ((bool)val) {
+                    // renive
+                    items.remove(fn);
+                } else {
+                    items.add(fn);
+                }
+                
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label16 : Object 
+    {
+        public Gtk.Label el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label16(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "Available Directories" );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_ScrolledWindow17 : Object 
+    {
+        public Gtk.ScrolledWindow el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_ScrolledWindow17(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.ScrolledWindow( null, null );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_default_directory_tree( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+            var child_1 = new Xcls_default_directory_menu( _this );
+            child_1.ref();
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_default_directory_tree : Object 
+    {
+        public Gtk.TreeView el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_default_directory_tree(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.default_directory_tree = this;
+            this.el = new Gtk.TreeView();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.headers_visible = false;
+            var child_0 = new Xcls_default_directory_tree_store( _this );
+            child_0.ref();
+            this.el.set_model (  child_0.el  );
+            var child_1 = new Xcls_TreeViewColumn20( _this );
+            child_1.ref();
+            this.el.append_column (  child_1.el  );
+
+            // listeners 
+            this.el.button_press_event.connect( ( ev) => {
+                //console.log("button press?");
+               
+                
+                if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {
+                    //print("click" + ev.type);
+                    return false;
+                }
+                //Gtk.TreePath res;
+                //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {
+                //    return true;
+                //}
+                 
+              //  this.el.get_selection().select_path(res);
+                 
+                  //if (!this.get('/LeftTreeMenu').el)  { 
+                  //      this.get('/LeftTreeMenu').init(); 
+                  //  }
+                    
+                 _this.default_directory_menu.el.set_screen(Gdk.Screen.get_default());
+                 _this.default_directory_menu.el.show_all();
+                  _this.default_directory_menu.el.popup(null, null, null,  3, ev.time);
+                 //   print("click:" + res.path.to_string());
+                  return true;
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_default_directory_tree_store : Object 
+    {
+        public Gtk.ListStore el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_default_directory_tree_store(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.default_directory_tree_store = this;
+            this.el = new Gtk.ListStore( 1,     typeof(string)
+      );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+        public void load () {
+         
+          this.el.clear();
+          
+            
+             var def = _this.project.compilegroups.get("_default_");
+             var items  = def.sources;
+             
+         
+            Gtk.TreeIter citer;
+        
+            for(var i =0 ; i < items.size; i++) {
+                 this.el.append(out citer);   
+                 
+                this.el.set_value(citer, 0,   items.get(i) ); // title 
+                //this.el.set_value(citer, 1,   items.get(i) );
+            }
+            this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
+            
+        }
+    }
+    public class Xcls_TreeViewColumn20 : Object 
+    {
+        public Gtk.TreeViewColumn el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_TreeViewColumn20(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.TreeViewColumn();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.title = "name";
+            this.el.resizable = true;
+            var child_0 = new Xcls_directory_render( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false );
+
+            // init method 
+
+            this.el.add_attribute(_this.directory_render.el , "text", 0 );        }
+
+        // user defined functions 
+    }
+    public class Xcls_directory_render : Object 
+    {
+        public Gtk.CellRendererText el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_directory_render(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.directory_render = this;
+            this.el = new Gtk.CellRendererText();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_default_directory_menu : Object 
+    {
+        public Gtk.Menu el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_default_directory_menu(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.default_directory_menu = this;
+            this.el = new Gtk.Menu();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_MenuItem23( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+            var child_1 = new Xcls_MenuItem24( _this );
+            child_1.ref();
+            this.el.add (  child_1.el  );
+            var child_2 = new Xcls_SeparatorMenuItem25( _this );
+            child_2.ref();
+            this.el.add (  child_2.el  );
+            var child_3 = new Xcls_MenuItem26( _this );
+            child_3.ref();
+            this.el.add (  child_3.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem23 : Object 
+    {
+        public Gtk.MenuItem el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem23(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Add Directory";
+
+            // listeners 
+            this.el.activate.connect( ()  => {
+                
+                var  chooser = new Gtk.FileChooserDialog (
+               "Add a directory", _this.window.el, Gtk.FileChooserAction.SELECT_FOLDER ,
+               "_Cancel",
+               Gtk.ResponseType.CANCEL,
+               "_Add",
+               Gtk.ResponseType.ACCEPT);
+                if (chooser.run () != Gtk.ResponseType.ACCEPT) {
+                    chooser.close ();
+                       return;
+                   }
+                   chooser.close ();
+                   // add the directory..
+                   var fn = _this.project.relPath(chooser.get_filename());
+                   _this.project.compilegroups.get("_default_").sources.add(fn);
+                   _this.default_directory_tree_store.load();
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem24 : Object 
+    {
+        public Gtk.MenuItem el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem24(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Add File";
+
+            // listeners 
+            this.el.activate.connect( ()  => {
+                
+                var  chooser = new Gtk.FileChooserDialog (
+               "Add a directory", _this.window.el, Gtk.FileChooserAction.OPEN ,
+               "_Cancel",
+               Gtk.ResponseType.CANCEL,
+               "_Add",
+               Gtk.ResponseType.ACCEPT);
+                if (chooser.run () != Gtk.ResponseType.ACCEPT) {
+                    chooser.close ();
+                       return;
+                   }
+                   chooser.close ();
+                   // add the directory..
+                   var fn = _this.project.relPath(chooser.get_filename());
+                   _this.project.compilegroups.get("_default_").sources.add(fn);
+                   _this.default_directory_tree_store.load();
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_SeparatorMenuItem25 : Object 
+    {
+        public Gtk.SeparatorMenuItem el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_SeparatorMenuItem25(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.SeparatorMenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem26 : Object 
+    {
+        public Gtk.MenuItem el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem26(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Remove File/Directory";
+
+            // listeners 
+            this.el.activate.connect( ()  => {
+                
+                 //
+                    Gtk.TreeModel mod;
+                    Gtk.TreeIter iter;
+                    if (!_this.default_directory_tree.el.get_selection().get_selected(out mod, out iter)) {
+                           print("nothing selected\n");
+                        return;
+                    }
+            
+                        
+                   // add the directory..
+                   
+                   
+                   GLib.Value val;
+                    mod.get_value(iter,0, out val);
+                   var fn =  (string) val;
+                   
+                   print("remove: %s\n", fn);
+                   if (!_this.project.compilegroups.get("_default_").sources.remove(fn)) {
+                              print("remove failed");
+                          }
+                   _this.default_directory_tree_store.load();
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_HPaned27 : Object 
+    {
+        public Gtk.HPaned el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_HPaned27(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.HPaned();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.position = 300;
+            var child_0 = new Xcls_ScrolledWindow28( _this );
+            child_0.ref();
+            this.el.add1 (  child_0.el  );
+            var child_1 = new Xcls_set_vbox( _this );
+            child_1.ref();
+            this.el.add2 (  child_1.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_ScrolledWindow28 : Object 
+    {
+        public Gtk.ScrolledWindow el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_ScrolledWindow28(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.ScrolledWindow( null, null );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_targets_tree_menu( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+            var child_1 = new Xcls_targets_tree( _this );
+            child_1.ref();
+            this.el.add (  child_1.el  );
+
+            // init method 
+
+            {  
+            this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+            
+            }        }
+
+        // user defined functions 
+    }
+    public class Xcls_targets_tree_menu : Object 
+    {
+        public Gtk.Menu el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_targets_tree_menu(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.targets_tree_menu = this;
+            this.el = new Gtk.Menu();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_MenuItem30( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+            var child_1 = new Xcls_SeparatorMenuItem31( _this );
+            child_1.ref();
+            this.el.add (  child_1.el  );
+            var child_2 = new Xcls_MenuItem32( _this );
+            child_2.ref();
+            this.el.add (  child_2.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem30 : Object 
+    {
+        public Gtk.MenuItem el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem30(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Add Compile Target";
+
+            // listeners 
+            this.el.activate.connect( ()  => {
+                
+                   if (_this.project.compilegroups.has_key("NEW GROUP")) {
+                    return;
+                }
+                  
+                   // add the directory..
+                   
+                   _this.project.compilegroups.set("NEW GROUP", new Project.GtkValaSettings("NEW GROUP"));
+                   _this.targets_tree_store.load();
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_SeparatorMenuItem31 : Object 
+    {
+        public Gtk.SeparatorMenuItem el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_SeparatorMenuItem31(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.SeparatorMenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem32 : Object 
+    {
+        public Gtk.MenuItem el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem32(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Remove Target";
+
+            // listeners 
+            this.el.activate.connect( ()  => {
+                
+                 //
+                    Gtk.TreeModel mod;
+                    Gtk.TreeIter iter;
+                    if (!_this.targets_tree.el.get_selection().get_selected(out mod, out iter)) {
+                           print("nothing selected\n");
+                        return;
+                    }
+            
+                        
+                   // add the directory..
+                   
+                   
+                   GLib.Value val;
+                    mod.get_value(iter,0, out val);
+                   var fn =  (string) val;
+                   
+                   print("remove: %s\n", fn);
+                   if (!_this.project.compilegroups.unset(fn)) {
+                              print("remove failed");
+                  }
+                   _this.targets_tree_store.load();
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_targets_tree : Object 
+    {
+        public Gtk.TreeView el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+        public string cursor;
+
+        // ctor 
+        public Xcls_targets_tree(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.targets_tree = this;
+            this.el = new Gtk.TreeView();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_targets_tree_store( _this );
+            child_0.ref();
+            this.el.set_model (  child_0.el  );
+            var child_1 = new Xcls_TreeViewColumn35( _this );
+            child_1.ref();
+            this.el.append_column (  child_1.el  );
+
+            // listeners 
+            this.el.button_press_event.connect( ( ev) => {
+                //console.log("button press?");
+               
+                
+                if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {
+                    //print("click" + ev.type);
+                    return false;
+                }
+                //Gtk.TreePath res;
+                //if (!this.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {
+                //    return true;
+                //}
+                 
+              //  this.el.get_selection().select_path(res);
+                 
+                  //if (!this.get('/LeftTreeMenu').el)  { 
+                  //      this.get('/LeftTreeMenu').init(); 
+                  //  }
+                    
+                 _this.targets_tree_menu.el.set_screen(Gdk.Screen.get_default());
+                 _this.targets_tree_menu.el.show_all();
+                  _this.targets_tree_menu.el.popup(null, null, null,  3, ev.time);
+                 //   print("click:" + res.path.to_string());
+                  return true;
+            });
+            this.el.cursor_changed.connect( ( ) => {
+            
+                if (this.cursor != "") {
+                     // save the values..
+                 }
+                 
+                 // load the new values.
+                 
+            
+                     Gtk.TreeModel mod;
+                    Gtk.TreeIter iter;
+                    if (!this.el.get_selection().get_selected(out mod, out iter)) {
+                           print("nothing selected\n");
+                        return;
+                    }
+            
+                        
+                   // add the directory..
+                   
+                   
+                   GLib.Value val;
+                    mod.get_value(iter,0, out val);
+                   var fn =  (string) val;
+                   
+                   this.cursor = fn;
+                   var cg = _this.project.compilegroups.get(fn);
+                   _this.build_pack_target.el.set_text(cg.target_bin);
+                   _this.build_compile_flags.el.set_text(cg.compile_flags);
+                   // load the srouces
+            
+            
+              });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_targets_tree_store : Object 
+    {
+        public Gtk.ListStore el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_targets_tree_store(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.targets_tree_store = this;
+            this.el = new Gtk.ListStore( 2,     typeof(string),  // 0 key type
+     typeof(string) // ??
+      );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+        public void load () {
+         
+          this.el.clear();
+          
+            
+             var cg = _this.project.compilegroups;
+             
+           _this.targets_tree.cursor = "";
+            Gtk.TreeIter citer;
+            var iter = cg.map_iterator();
+           while(iter.next()) {
+                var key = iter.get_key();
+                if (key == "_default_") {
+                    continue;
+                }
+            
+                 this.el.append(out citer);   
+                 
+                this.el.set_value(citer, 0,   key ); // title 
+                //this.el.set_value(citer, 1,   items.get(i) );
+            };
+            this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
+            
+        }
+    }
+    public class Xcls_TreeViewColumn35 : Object 
+    {
+        public Gtk.TreeViewColumn el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_TreeViewColumn35(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.TreeViewColumn();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.title = "name";
+            this.el.resizable = true;
+            var child_0 = new Xcls_targets_render( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false );
+
+            // init method 
+
+            {
+                 this.el.add_attribute(_this.targets_render.el , "text", 0 );
+             }        }
+
+        // user defined functions 
+    }
+    public class Xcls_targets_render : Object 
+    {
+        public Gtk.CellRendererText el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_targets_render(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.targets_render = this;
+            this.el = new Gtk.CellRendererText();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.editable = true;
+
+            // listeners 
+            this.el.edited.connect( (path, newtext) => {
+                 
+                 Gtk.TreeIter  iter;
+                    _this.targets_tree_store.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
+                   GLib.Value gval;
+                    _this.targets_tree_store.el.get_value(iter,0, out gval);
+                    var oldval = (string)gval;
+                   if (oldval == newtext) {
+                      return;
+                    }
+                     var cg = _this.project.compilegroups.get(oldval);
+                    cg.name = newtext;
+                    _this.project.compilegroups.unset(oldval);
+                    _this.project.compilegroups.set(newtext, cg);
+                _this.targets_tree_store.load();
+              });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_set_vbox : Object 
+    {
+        public Gtk.VBox el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_set_vbox(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.VBox( false, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Label38( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false,false,0 );
+            var child_1 = new Xcls_build_pack_target( _this );
+            child_1.ref();
+            this.el.pack_start (  child_1.el , false,false,0 );
+            var child_2 = new Xcls_Label40( _this );
+            child_2.ref();
+            this.el.pack_start (  child_2.el , false,false,0 );
+            var child_3 = new Xcls_build_compile_flags( _this );
+            child_3.ref();
+            this.el.pack_start (  child_3.el , false,false,0 );
+            var child_4 = new Xcls_Label42( _this );
+            child_4.ref();
+            this.el.pack_start (  child_4.el , false,false,0 );
+            var child_5 = new Xcls_ScrolledWindow43( _this );
+            child_5.ref();
+            this.el.pack_start (  child_5.el , true,true,0 );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label38 : Object 
+    {
+        public Gtk.Label el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label38(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "target filename" );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_build_pack_target : Object 
+    {
+        public Gtk.Entry el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_build_pack_target(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.build_pack_target = this;
+            this.el = new Gtk.Entry();
+
+            // my vars (dec)
+
+            // set gobject values
+
+            // listeners 
+            this.el.changed.connect( ()  => {
+                    if (_this.targets_tree.cursor.length < 1) {
+                    return;
+                }
+                _this.project.compilegroups.get(_this.targets_tree.cursor).target_bin = this.el.text;
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label40 : Object 
+    {
+        public Gtk.Label el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label40(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "compile flags" );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_build_compile_flags : Object 
+    {
+        public Gtk.Entry el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_build_compile_flags(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.build_compile_flags = this;
+            this.el = new Gtk.Entry();
+
+            // my vars (dec)
+
+            // set gobject values
+
+            // listeners 
+            this.el.changed.connect( () => {
+                if (_this.targets_tree.cursor.length < 1) {
+                    return;
+                }
+                _this.project.compilegroups.get(_this.targets_tree.cursor).compile_flags = this.el.text;
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label42 : Object 
+    {
+        public Gtk.Label el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label42(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "Files to compile" );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_ScrolledWindow43 : Object 
+    {
+        public Gtk.ScrolledWindow el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_ScrolledWindow43(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.ScrolledWindow( null, null );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_files_tree( _this );
+            child_0.ref();
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_files_tree : Object 
+    {
+        public Gtk.TreeView el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_files_tree(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.TreeView();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_files_tree_store( _this );
+            child_0.ref();
+            this.el.set_model (  child_0.el  );
+            var child_1 = new Xcls_TreeViewColumn46( _this );
+            child_1.ref();
+            this.el.append_column (  child_1.el  );
+            var child_2 = new Xcls_TreeViewColumn48( _this );
+            child_2.ref();
+            this.el.append_column (  child_2.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_files_tree_store : Object 
+    {
+        public Gtk.ListStore el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_files_tree_store(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.files_tree_store = this;
+            this.el = new Gtk.ListStore( 2,     typeof(string),  // 0 file name
+     typeof(string), // type (dir orfile)
+     typeof(bool)  // is checked.
+      );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+        public void load () {
+         
+          this.el.clear();
+          
+            
+             var def = _this.project.compilegroups.get("_default_");
+             var items  = def.sources;
+             
+         
+            Gtk.TreeIter citer;
+        
+            for(var i =0 ; i < items.size; i++) {
+                 this.el.append(out citer);   
+                 
+                this.el.set_value(citer, 0,   items.get(i) ); // title 
+                this.el.set_value(citer, 1,   "dir"); // type         
+                this.el.set_value(citer, 2,   false ); // checked 
+                /*
+                var files = def.files(items.get(i));
+                
+                 for(var j =0 ; j < files.size; j++) {
+                    this.el.append(out citer);   
+                 
+                    this.el.set_value(citer, 0,   files.get(j) ); // title 
+                    this.el.set_value(citer, 1,   "file"); // type         
+                    this.el.set_value(citer, 2,   false ); // checked 
+        
+                }
+                */
+                
+                //this.el.set_value(citer, 1,   items.get(i) );
+            }
+            this.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
+            
+        }
+    }
+    public class Xcls_TreeViewColumn46 : Object 
+    {
+        public Gtk.TreeViewColumn el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_TreeViewColumn46(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.TreeViewColumn();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.title = "name";
+            this.el.resizable = true;
+            var child_0 = new Xcls_files_render( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false );
+
+            // init method 
+
+            /* this.el.add_attribute(_this.files_render.el , "markup", 2 );
+            // this.el.add_attribute(_this.files_render.el , "text", 1 ); */        }
+
+        // user defined functions 
+    }
+    public class Xcls_files_render : Object 
+    {
+        public Gtk.CellRendererText el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_files_render(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.files_render = this;
+            this.el = new Gtk.CellRendererText();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_TreeViewColumn48 : Object 
+    {
+        public Gtk.TreeViewColumn el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_TreeViewColumn48(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.TreeViewColumn();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.title = "use";
+            this.el.resizable = false;
+            this.el.fixed_width = 50;
+            var child_0 = new Xcls_files_render_use( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false );
+
+            // init method 
+
+            /*
+            
+             this.el.add_attribute(_this.packages_render_use.el , "active", 1 );
+             
+             */        }
+
+        // user defined functions 
+    }
+    public class Xcls_files_render_use : Object 
+    {
+        public Gtk.CellRendererToggle el;
+        private ValaProjectSettings  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_files_render_use(ValaProjectSettings _owner )
+        {
+            _this = _owner;
+            _this.files_render_use = this;
+            this.el = new Gtk.CellRendererToggle();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.activatable = true;
+
+            // listeners 
+            this.el.toggled.connect( (  path_string) =>  { 
+                var m = _this.default_packages_tree_store.el;
+               Gtk.TreeIter iter;
+               Gtk.TreePath path = new Gtk.TreePath.from_string (path_string);
+               m.get_iter (out iter, path);
+               GLib.Value val;
+               m.get_value(iter, 1, out val);
+               m.set_value(iter, 1,  ((bool) val) ? false :true); 
+                 GLib.Value fval;  
+               m.get_value(iter, 0, out fval);
+               var fn = (string)fval;
+                
+                var def = _this.project.compilegroups.get("_default_");
+                var items  = def.packages;
+                if ((bool)val) {
+                    // renive
+                    items.remove(fn);
+                } else {
+                    items.add(fn);
+                }
+                
+            });
+        }
+
+        // user defined functions 
+    }
+}
diff --git a/old-javascript/Builder4/WindowAddProp.bjs b/old-javascript/Builder4/WindowAddProp.bjs
new file mode 100644 (file)
index 0000000..6e33494
--- /dev/null
@@ -0,0 +1,61 @@
+{
+    "id": "file-gtk-14",
+    "name": "WindowAddProp",
+    "parent": "",
+    "title": false,
+    "path": "/home/alan/gitlive/app.Builder.js/Builder4/WindowAddProp.bjs",
+    "items": [
+        {
+            "|void:clear": "() {\n    this.model.el.clear();\n\n}",
+            ".signal:void:select": "(string key, string type, string skel, string etype)",
+            "id": "WindowAddProp",
+            "xtype": "ScrolledWindow",
+            "|init": "    this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n ",
+            "|shadow_type": "Gtk.ShadowType.IN",
+            "|void:show": "(Palete.Palete pal, string etype, string xtype) {\n    this.model.el.clear();\n\n    Gtk.TreeIter iter;\n    var elementList = pal.getPropertiesFor( xtype,etype);\n    \n    \n    //print (\"GOT \" + elementList.length + \" items for \" + fullpath + \"|\" + type);\n           // console.dump(elementList);\n           \n    var miter = elementList.map_iterator();\n    while (miter.next()) {\n       var p = miter.get_value();\n        \n        this.model.el.append(out iter);\n\n        this.model.el.set(iter,\n                0,  p.name, \n                1, p.type,\n                2, \"<b>\" + p.name +\"</b> <i>\"+p.type+\"</i>\\n\" + \n                        GLib.Markup.escape_text(p.doctxt),\n                3, p.sig,\n                4, \"<b>\" + p.name +\"</b> <span size=\\\"small\\\"><i>\"+p.type+\"</i></span>\",\n                5, etype,\n                -1\n        );\n    }\n    this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n                             \n}\n",
+            "|xns": "Gtk",
+            "items": [
+                {
+                    "listeners": {
+                        "row_activated": "(path, column)  => {\n\n        Gtk.TreeIter iter;\n\n\n        var m = _this.model;\n        \n        m.el.get_iter(out iter,path);\n        \n        \n        // var val = \"\";\n        \n        \n        var key = m.getValue(iter, 0);\n        \n        var type = m.getValue(iter, 1);\n        var skel = m.getValue(iter, 3);\n        var etype = m.getValue(iter, 5);\n        \n        \n        _this.select(key,etype == \"signals\" ? \"\" : type,skel, etype);\n        \n}\n"
+                    },
+                    "pack": "add",
+                    "tooltip_column": 2,
+                    "xtype": "TreeView",
+                    "|enable_tree_lines": "true",
+                    "|headers_visible": "false",
+                    "|init": "{  \n       var description = new Pango.FontDescription();\n     description.set_size(8000);\n    this.el.modify_font(description);     \n                    \n    this.el.get_selection().set_mode( Gtk.SelectionMode.SINGLE);\n \n\n    \n  \n    \n}\n",
+                    "|xns": "Gtk",
+                    "items": [
+                        {
+                            "id": "model",
+                            "n_columns": 6,
+                            "pack": "set_model",
+                            "xtype": "ListStore",
+                            "|columns": "typeof(string),  // 0 real key\ntypeof(string), // 1 real type\ntypeof(string), // 2 docs ?\ntypeof(string), // 3 visable desc\ntypeof(string), // 4 function desc\ntypeof(string) // 5 element type (event|prop)\n        ",
+                            "|string:getValue": "(Gtk.TreeIter iter, int col)\n{\n\n    GLib.Value value;\n    this.el.get_value(iter, col, out value);\n\n    return (string)value;\n    \n}",
+                            "|xns": "Gtk"
+                        },
+                        {
+                            "id": "namecol",
+                            "pack": "append_column",
+                            "xtype": "TreeViewColumn",
+                            "|init": "  this.el.add_attribute(_this.namerender.el , \"markup\", 4  );\n \n",
+                            "|xns": "Gtk",
+                            "items": [
+                                {
+                                    "id": "namerender",
+                                    "pack": "pack_start,true",
+                                    "xtype": "CellRendererText",
+                                    "|xns": "Gtk"
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ]
+        }
+    ],
+    "permname": "",
+    "modOrder": ""
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/WindowAddProp.vala b/old-javascript/Builder4/WindowAddProp.vala
new file mode 100644 (file)
index 0000000..8eba9ee
--- /dev/null
@@ -0,0 +1,255 @@
+/* -- to compile
+valac  --pkg gio-2.0  --pkg posix  --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0  --pkg  libwnck-3.0 \
+    /tmp/WindowAddProp.vala  -o /tmp/WindowAddProp
+*/
+
+
+/* -- to test class
+static int main (string[] args) {
+    Gtk.init (ref args);
+    new Xcls_WindowAddProp();
+    WindowAddProp.show_all();
+     Gtk.main ();
+    return 0;
+}
+*/
+
+
+public static Xcls_WindowAddProp  WindowAddProp;
+
+public class Xcls_WindowAddProp : Object 
+{
+    public Gtk.ScrolledWindow el;
+    private Xcls_WindowAddProp  _this;
+
+    public Xcls_model model;
+    public Xcls_namecol namecol;
+    public Xcls_namerender namerender;
+
+        // my vars
+    public signal void select(string key, string type, string skel, string etype);
+
+        // ctor 
+    public Xcls_WindowAddProp()
+    {
+        _this = this;
+        WindowAddProp = this;
+        this.el = new Gtk.ScrolledWindow( null, null );
+
+        // my vars
+
+        // set gobject values
+        this.el.shadow_type = Gtk.ShadowType.IN;
+        var child_0 = new Xcls_TreeView2( _this );
+        child_0.ref();
+        this.el.add (  child_0.el  );
+
+        // init method 
+            this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+         
+    }
+
+    // userdefined functions 
+    public void clear() {
+            this.model.el.clear();
+        
+        }
+    public void show(Palete.Palete pal, string etype, string xtype) {
+            this.model.el.clear();
+        
+            Gtk.TreeIter iter;
+            var elementList = pal.getPropertiesFor( xtype,etype);
+            
+            
+            //print ("GOT " + elementList.length + " items for " + fullpath + "|" + type);
+                   // console.dump(elementList);
+                   
+            var miter = elementList.map_iterator();
+            while (miter.next()) {
+               var p = miter.get_value();
+                
+                this.model.el.append(out iter);
+        
+                this.model.el.set(iter,
+                        0,  p.name, 
+                        1, p.type,
+                        2, "<b>" + p.name +"</b> <i>"+p.type+"</i>\n" + 
+                                GLib.Markup.escape_text(p.doctxt),
+                        3, p.sig,
+                        4, "<b>" + p.name +"</b> <span size=\"small\"><i>"+p.type+"</i></span>",
+                        5, etype,
+                        -1
+                );
+            }
+            this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
+                                     
+        }
+
+    // skip |xns - no return type
+    public class Xcls_TreeView2 : Object 
+    {
+        public Gtk.TreeView el;
+        private Xcls_WindowAddProp  _this;
+
+
+            // my vars
+
+            // ctor 
+        public Xcls_TreeView2(Xcls_WindowAddProp _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.TreeView();
+
+            // my vars
+
+            // set gobject values
+            this.el.enable_tree_lines = true;
+            this.el.headers_visible = false;
+            this.el.tooltip_column = 2;
+            var child_0 = new Xcls_model( _this );
+            child_0.ref();
+            this.el.set_model (  child_0.el  );
+            var child_1 = new Xcls_namecol( _this );
+            child_1.ref();
+            this.el.append_column (  child_1.el  );
+
+            // init method 
+            {  
+                   var description = new Pango.FontDescription();
+                 description.set_size(8000);
+                this.el.modify_font(description);     
+                                
+                this.el.get_selection().set_mode( Gtk.SelectionMode.SINGLE);
+             
+            
+                
+              
+                
+            }
+
+            // listeners 
+            this.el.row_activated.connect( (path, column)  => {
+            
+                    Gtk.TreeIter iter;
+            
+            
+                    var m = _this.model;
+                    
+                    m.el.get_iter(out iter,path);
+                    
+                    
+                    // var val = "";
+                    
+                    
+                    var key = m.getValue(iter, 0);
+                    
+                    var type = m.getValue(iter, 1);
+                    var skel = m.getValue(iter, 3);
+                    var etype = m.getValue(iter, 5);
+                    
+                    
+                    _this.select(key,etype == "signals" ? "" : type,skel, etype);
+                    
+            }
+             );
+        }
+
+        // userdefined functions 
+
+        // skip |xns - no return type
+    }
+    public class Xcls_model : Object 
+    {
+        public Gtk.ListStore el;
+        private Xcls_WindowAddProp  _this;
+
+
+            // my vars
+
+            // ctor 
+        public Xcls_model(Xcls_WindowAddProp _owner )
+        {
+            _this = _owner;
+            _this.model = this;
+            this.el = new Gtk.ListStore( 6, typeof(string),  // 0 real key
+typeof(string), // 1 real type
+typeof(string), // 2 docs ?
+typeof(string), // 3 visable desc
+typeof(string), // 4 function desc
+typeof(string) // 5 element type (event|prop)
+         );
+
+            // my vars
+
+            // set gobject values
+        }
+
+        // userdefined functions 
+        public string getValue(Gtk.TreeIter iter, int col)
+            {
+            
+                GLib.Value value;
+                this.el.get_value(iter, col, out value);
+            
+                return (string)value;
+                
+            }
+
+        // skip |xns - no return type
+    }
+    public class Xcls_namecol : Object 
+    {
+        public Gtk.TreeViewColumn el;
+        private Xcls_WindowAddProp  _this;
+
+
+            // my vars
+
+            // ctor 
+        public Xcls_namecol(Xcls_WindowAddProp _owner )
+        {
+            _this = _owner;
+            _this.namecol = this;
+            this.el = new Gtk.TreeViewColumn();
+
+            // my vars
+
+            // set gobject values
+            var child_0 = new Xcls_namerender( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , true );
+
+            // init method 
+              this.el.add_attribute(_this.namerender.el , "markup", 4  );
+             
+        }
+
+        // userdefined functions 
+
+        // skip |xns - no return type
+    }
+    public class Xcls_namerender : Object 
+    {
+        public Gtk.CellRendererText el;
+        private Xcls_WindowAddProp  _this;
+
+
+            // my vars
+
+            // ctor 
+        public Xcls_namerender(Xcls_WindowAddProp _owner )
+        {
+            _this = _owner;
+            _this.namerender = this;
+            this.el = new Gtk.CellRendererText();
+
+            // my vars
+
+            // set gobject values
+        }
+
+        // userdefined functions 
+
+        // skip |xns - no return type
+    }
+}
diff --git a/old-javascript/Builder4/WindowLeftProjects.bjs b/old-javascript/Builder4/WindowLeftProjects.bjs
new file mode 100644 (file)
index 0000000..61f0c25
--- /dev/null
@@ -0,0 +1,75 @@
+{
+    "name" : "WindowLeftProjects",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/WindowLeftProjects.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "items" : [
+        {
+            "listeners" : {
+                "show" : "  ( ) => {\n    this.load();\n}"
+            },
+            "@ void project_selected" : "(Project.Project project)",
+            "id" : "WindowLeftProjects",
+            "|  void load" : "() {\n     // clear list...\n    \n     if (_this.is_loaded) {\n         return;\n     }\n     _this.is_loading = true;\n        \n     _this.is_loaded = true;\n     \n     Project.Project.loadAll();\n     var projects = Project.Project.allProjectsByName();\n     \n     Gtk.TreeIter iter;\n     var m = this.model.el;\n     m.clear();\n          \n     for (var i = 0; i < projects.size; i++) {\n        m.append(out iter);\n        m.set(iter,   0,projects.get(i).name );\n        \n        var o = new GLib.Value(typeof(Object));\n        o.set_object((Object)projects.get(i));\n                   \n        m.set_value(iter, 1, o);\n     \n     }\n     m.set_sort_column_id(0, Gtk.SortType.ASCENDING);\n     _this.is_loading = false;     \n}\n",
+            "# bool is_loaded" : false,
+            "* pack" : "add",
+            "xtype" : "VBox",
+            "|  Project.Project? getSelectedProject" : "() {    \n    Gtk.TreeIter iter;\n    Gtk.TreeModel mod;\n            \n    var s = this.view.el.get_selection();\n    if (!s.get_selected(out mod, out iter)) {\n        return null;\n    }\n    \n    GLib.Value gval;\n\n    mod.get_value(iter, 1 , out gval);\n    var project = (Project.Project)gval.get_object();\n    \n    return project;\n}",
+            "|  void selectProject" : "(Project.Project project) {\n    \n    var sel = _this.view.el.get_selection();\n    \n    sel.unselect_all();\n    \n    var found = false;\n    _this.model.el.foreach((mod, path, iter) => {\n        GLib.Value val;\n    \n        mod.get_value(iter, 1, out val);\n        if ( ( (Project.Project)val.get_object()).fn != project.fn) {\n            print(\"SKIP %s != %s\\n\", ((Project.Project)val.get_object()).name , project.name);\n            return false;//continue\n        }\n        sel.select_iter(iter);\n        this.project_selected(project);\n        found = true;\n        return true;\n        \n    \n    });\n     if (!found) {\n\t    print(\"tried to select %s, could not find it\", project.name);\n    }\n}\n",
+            "# bool is_loading" : false,
+            "$ xns" : "Gtk",
+            "$ homogeneous" : false,
+            "@ void show_new_project" : "()",
+            "items" : [
+                {
+                    "* init" : "  this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n",
+                    "$ shadow_type" : "Gtk.ShadowType.IN",
+                    "* pack" : "pack_end,true,true,0",
+                    "xtype" : "ScrolledWindow",
+                    "$ xns" : "Gtk",
+                    "items" : [
+                        {
+                            "listeners" : {
+                                "cursor_changed" : " () => {\n    if (_this.is_loading) {\n        return;\n    }\n    \n    Gtk.TreeIter iter;\n    Gtk.TreeModel mod;\n            \n    var s = this.el.get_selection();\n    if (!s.get_selected(out mod, out iter)) {\n        return;\n    }\n    \n    GLib.Value gval;\n\n    mod.get_value(iter, 1 , out gval);\n    var project = (Project.Project)gval.get_object();\n    \n    _this.project_selected(project);\n    \n}"
+                            },
+                            "id" : "view",
+                            "* init" : "  var description = new Pango.FontDescription();\n     description.set_size(8000);\n    this.el.modify_font(description);     \n                    \n    var selection = this.el.get_selection();\n    selection.set_mode( Gtk.SelectionMode.SINGLE);\n \n\n    \n  \n",
+                            "xtype" : "TreeView",
+                            "* pack" : "add",
+                            "$ enable_tree_lines" : true,
+                            "$ headers_visible" : false,
+                            "$ xns" : "Gtk",
+                            "items" : [
+                                {
+                                    "id" : "model",
+                                    "* init" : "{\n   this.el.set_sort_func(0, (mod,a,b) => {\n       GLib.Value ga, gb;\n       mod.get_value(a,0, out ga);\n       mod.get_value(b,0, out gb);\n        \n        if ((string)ga == (string)gb) {\n            return 0;\n        }\n        return (string)ga > (string)gb ? 1 : -1;\n   }); \n\n\n}\n",
+                                    "* pack" : "set_model",
+                                    "xtype" : "ListStore",
+                                    "$ columns" : "typeof(string), typeof(Object)",
+                                    "n_columns" : 2,
+                                    "$ xns" : "Gtk"
+                                },
+                                {
+                                    "* init" : "\n    this.el.add_attribute(_this.namecol.el , \"markup\", 0  );\n ",
+                                    "xtype" : "TreeViewColumn",
+                                    "* pack" : "append_column",
+                                    "$ xns" : "Gtk",
+                                    "items" : [
+                                        {
+                                            "id" : "namecol",
+                                            "* pack" : "pack_start,true",
+                                            "xtype" : "CellRendererText",
+                                            "$ xns" : "Gtk"
+                                        }
+                                    ]
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/WindowLeftProjects.vala b/old-javascript/Builder4/WindowLeftProjects.vala
new file mode 100644 (file)
index 0000000..4c45eda
--- /dev/null
@@ -0,0 +1,295 @@
+static Xcls_WindowLeftProjects  _WindowLeftProjects;
+
+public class Xcls_WindowLeftProjects : Object 
+{
+    public Gtk.VBox el;
+    private Xcls_WindowLeftProjects  _this;
+
+    public static Xcls_WindowLeftProjects singleton()
+    {
+        if (_WindowLeftProjects == null) {
+            _WindowLeftProjects= new Xcls_WindowLeftProjects();
+        }
+        return _WindowLeftProjects;
+    }
+    public Xcls_view view;
+    public Xcls_model model;
+    public Xcls_namecol namecol;
+
+        // my vars (def)
+    public signal void project_selected (Project.Project project);
+    public bool is_loaded;
+    public bool is_loading;
+    public signal void show_new_project ();
+
+    // ctor 
+    public Xcls_WindowLeftProjects()
+    {
+        _this = this;
+        this.el = new Gtk.VBox( false, 0 );
+
+        // my vars (dec)
+        this.is_loaded = false;
+        this.is_loading = false;
+
+        // set gobject values
+        var child_0 = new Xcls_ScrolledWindow2( _this );
+        child_0.ref();
+        this.el.pack_end (  child_0.el , true,true,0 );
+
+        // listeners 
+        this.el.show.connect( ( ) => {
+            this.load();
+        });
+    }
+
+    // user defined functions 
+    public  void load () {
+         // clear list...
+        
+         if (_this.is_loaded) {
+             return;
+         }
+         _this.is_loading = true;
+            
+         _this.is_loaded = true;
+         
+         Project.Project.loadAll();
+         var projects = Project.Project.allProjectsByName();
+         
+         Gtk.TreeIter iter;
+         var m = this.model.el;
+         m.clear();
+              
+         for (var i = 0; i < projects.size; i++) {
+            m.append(out iter);
+            m.set(iter,   0,projects.get(i).name );
+            
+            var o = new GLib.Value(typeof(Object));
+            o.set_object((Object)projects.get(i));
+                       
+            m.set_value(iter, 1, o);
+         
+         }
+         m.set_sort_column_id(0, Gtk.SortType.ASCENDING);
+         _this.is_loading = false;     
+    }
+    public  Project.Project? getSelectedProject () {    
+        Gtk.TreeIter iter;
+        Gtk.TreeModel mod;
+                
+        var s = this.view.el.get_selection();
+        if (!s.get_selected(out mod, out iter)) {
+            return null;
+        }
+        
+        GLib.Value gval;
+    
+        mod.get_value(iter, 1 , out gval);
+        var project = (Project.Project)gval.get_object();
+        
+        return project;
+    }
+    public  void selectProject (Project.Project project) {
+        
+        var sel = _this.view.el.get_selection();
+        
+        sel.unselect_all();
+        
+        var found = false;
+        _this.model.el.foreach((mod, path, iter) => {
+            GLib.Value val;
+        
+            mod.get_value(iter, 1, out val);
+            if ( ( (Project.Project)val.get_object()).fn != project.fn) {
+                print("SKIP %s != %s\n", ((Project.Project)val.get_object()).name , project.name);
+                return false;//continue
+            }
+            sel.select_iter(iter);
+            this.project_selected(project);
+            found = true;
+            return true;
+            
+        
+        });
+         if (!found) {
+           print("tried to select %s, could not find it", project.name);
+        }
+    }
+    public class Xcls_ScrolledWindow2 : Object 
+    {
+        public Gtk.ScrolledWindow el;
+        private Xcls_WindowLeftProjects  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_ScrolledWindow2(Xcls_WindowLeftProjects _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.ScrolledWindow( null, null );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.shadow_type = Gtk.ShadowType.IN;
+            var child_0 = new Xcls_view( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+
+            // init method 
+
+            this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);        }
+
+        // user defined functions 
+    }
+    public class Xcls_view : Object 
+    {
+        public Gtk.TreeView el;
+        private Xcls_WindowLeftProjects  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_view(Xcls_WindowLeftProjects _owner )
+        {
+            _this = _owner;
+            _this.view = this;
+            this.el = new Gtk.TreeView();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.enable_tree_lines = true;
+            this.el.headers_visible = false;
+            var child_0 = new Xcls_model( _this );
+            child_0.ref();
+            this.el.set_model (  child_0.el  );
+            var child_1 = new Xcls_TreeViewColumn5( _this );
+            child_1.ref();
+            this.el.append_column (  child_1.el  );
+
+            // init method 
+
+            var description = new Pango.FontDescription();
+                 description.set_size(8000);
+                this.el.modify_font(description);     
+                                
+                var selection = this.el.get_selection();
+                selection.set_mode( Gtk.SelectionMode.SINGLE);
+            // listeners 
+            this.el.cursor_changed.connect( () => {
+                if (_this.is_loading) {
+                    return;
+                }
+                
+                Gtk.TreeIter iter;
+                Gtk.TreeModel mod;
+                        
+                var s = this.el.get_selection();
+                if (!s.get_selected(out mod, out iter)) {
+                    return;
+                }
+                
+                GLib.Value gval;
+            
+                mod.get_value(iter, 1 , out gval);
+                var project = (Project.Project)gval.get_object();
+                
+                _this.project_selected(project);
+                
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_model : Object 
+    {
+        public Gtk.ListStore el;
+        private Xcls_WindowLeftProjects  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_model(Xcls_WindowLeftProjects _owner )
+        {
+            _this = _owner;
+            _this.model = this;
+            this.el = new Gtk.ListStore( 2, typeof(string), typeof(Object) );
+
+            // my vars (dec)
+
+            // set gobject values
+
+            // init method 
+
+            {
+               this.el.set_sort_func(0, (mod,a,b) => {
+                   GLib.Value ga, gb;
+                   mod.get_value(a,0, out ga);
+                   mod.get_value(b,0, out gb);
+                    
+                    if ((string)ga == (string)gb) {
+                        return 0;
+                    }
+                    return (string)ga > (string)gb ? 1 : -1;
+               }); 
+            
+            
+            }        }
+
+        // user defined functions 
+    }
+    public class Xcls_TreeViewColumn5 : Object 
+    {
+        public Gtk.TreeViewColumn el;
+        private Xcls_WindowLeftProjects  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_TreeViewColumn5(Xcls_WindowLeftProjects _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.TreeViewColumn();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_namecol( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , true );
+
+            // init method 
+
+            this.el.add_attribute(_this.namecol.el , "markup", 0  );        }
+
+        // user defined functions 
+    }
+    public class Xcls_namecol : Object 
+    {
+        public Gtk.CellRendererText el;
+        private Xcls_WindowLeftProjects  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_namecol(Xcls_WindowLeftProjects _owner )
+        {
+            _this = _owner;
+            _this.namecol = this;
+            this.el = new Gtk.CellRendererText();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+}
diff --git a/old-javascript/Builder4/WindowLeftProps.bjs b/old-javascript/Builder4/WindowLeftProps.bjs
new file mode 100644 (file)
index 0000000..d9176bf
--- /dev/null
@@ -0,0 +1,305 @@
+{
+    "name" : "WindowLeftProps",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/WindowLeftProps.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "items" : [
+        {
+            "# bool allow_edit" : false,
+            "|              void before_edit" : "()\n{\n\n    print(\"before edit - stop editing\\n\");\n    \n  // these do not appear to trigger save...\n    _this.keyrender.el.stop_editing(false);\n    _this.keyrender.el.editable  =false;\n\n    _this.valrender.el.stop_editing(false);\n    _this.valrender.el.editable  =false;    \n    \n    \n// technicall stop the popup editor..\n\n}\n",
+            "id" : "LeftProps",
+            "|              string keySortFormat" : "(string key) {\n    // listeners first - with 0\n    // specials\n    if (key[0] == '*') {\n        return \"1 \" + key;\n    }\n    // functions\n    \n    var bits = key.split(\" \");\n    \n    if (key[0] == '|') {\n        return \"2 \" + bits[bits.length -1];\n    }\n    // signals\n    if (key[0] == '@') {\n        return \"3 \" + bits[bits.length -1];\n    }\n        \n    // props\n    if (key[0] == '#') {\n        return \"4 \" + bits[bits.length -1];\n    }\n    // the rest..\n    return \"5 \" + bits[bits.length -1];    \n\n\n\n}",
+            "|              void finish_editing" : "() {\n     // \n    this.before_edit();\n}",
+            "|              bool startEditingValue" : "( Gtk.TreePath path) {\n\n    // ONLY return true if editing is allowed - eg. combo..\n    \n            print(\"start editing?\\n\");\n            if (!this.stop_editor()) {\n                print(\"stop editor failed\\n\");\n                return false;\n            }\n            \n            Gtk.TreeIter iter;\n\n            var mod = this.model.el;\n            mod.get_iter (out iter, path);\n             \n            /*\n                m.set(iter, \n                        0, \"listener\",\n                        1, miter.get_key(),\n                        2, \"<b>\" + miter.get_key() + \"</b>\",\n                        3, miter.get_value()\n                    ); \n             \n            */\n            GLib.Value gval;\n            mod.get_value(iter, 3 , out gval);\n            var val = (string)gval;\n        \n            mod.get_value(iter, 1 , out gval);\n            var key = (string)gval;\n            var type_ar = key.split(\" \");\n            \n            \n            \n            mod.get_value(iter, 0 , out gval);\n            var type = (string)gval;\n            \n           \n            \n            var use_textarea = false;\n\n            //------------ things that require the text editor...\n            \n            if (type == \"listener\") {\n                use_textarea = true;\n            }\n            if (key.length > 0 && key[0] == '|') { // user defined method\n                use_textarea = true;\n            }\n            if (key.length > 0 && key[0] == '$') { // raw string\n                use_textarea = true;\n            }\n            if (key.length > 0 && key == \"* init\") {\n                use_textarea = true;\n            }\n            if (val.length > 40) { // long value...\n                use_textarea = true;\n            }\n            \n            \n            \n            if (use_textarea) {\n                print(\"Call show editor\\n\");\n                GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n                    this.view.el.get_selection().select_path(path);\n                    \n                    this.show_editor(file, node, type, key);\n                    \n                    return false;\n                });\n               \n                \n                return false;\n            }\n            // others... - fill in options for true/false?\n           print(\"turn on editing %s \\n\" , mod.get_path(iter).to_string());\n           \n               print (type_ar[0].up());\n                if (type_ar.length > 1 && (\n                        type_ar[0].up() == \"BOOLEAN\"\n                        ||\n                        type_ar[0].up() == \"BOOL\"                        \n                    )) {\n                        print(\"start editing try/false)???\");\n                        this.valrender.el.has_entry = false;\n                        string[] opts =  { \"true\", \"false\" };\n                        this.valrender.setOptions(opts);\n                        \n                        this.valrender.el.has_entry = false;\n                        this.valrender.el.editable = true;\n                         this.allow_edit  = true;\n                         GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {\n                             this.view.el.set_cursor_on_cell(\n                                path,\n                                this.valcol.el,\n                                this.valrender.el,\n                                true\n                            );\n                            return false;\n                        });\n                        return true;\n                }\n                                      \n                \n           \n             string[] opts =  {  };\n            this.valrender.setOptions(opts);\n           \n           GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n                \n                // at this point - work out the type...\n                // if its' a combo... then show the options..\n                this.valrender.el.has_entry = true;\n                \n                this.valrender.el.editable = true;            \n            \n                \n                this.allow_edit  = true;\n                \n                \n                \n                \n\n                this.view.el.set_cursor_on_cell(\n                    path,\n                    this.valcol.el,\n                    this.valrender.el,\n                    true\n                );\n                return false;\n            });\n            return false;\n        }\n",
+            "|              void load" : "(JsRender.JsRender file, JsRender.Node? node) \n{\n    print(\"load leftprops\\n\");\n    this.before_edit();\n    this.node = node;\n    this.file = file;\n    \n \n    this.model.el.clear();\n              \n    //this.get('/RightEditor').el.hide();\n    if (node ==null) {\n        return ;\n    }\n     \n    \n\n    //var provider = this.get('/LeftTree').getPaleteProvider();\n    Gtk.TreeIter iter;\n    \n    //typeof(string),  // 0 key type\n     //typeof(string),  // 1 key\n     //typeof(string),  // 2 key (display)\n     //typeof(string),  // 3 value\n     //typeof(string),  // 4 value (display)\n     //typeof(string),  // 5 both (tooltip)\n    \n    \n    \n    \n    // really need a way to sort the hashmap...\n    var m = this.model.el;\n    \n    var miter = node.listeners.map_iterator();\n    var i = 0;\n    \n    while(miter.next()) {\n        i++;\n        m.append(out iter,null);\n        \n        this.updateIter(iter,  \"listener\", miter.get_key(), miter.get_value());\n        \n         \n     }\n     \n      \n    miter = node.props.map_iterator();\n    \n    \n   while(miter.next()) {\n           i++;\n        m.append(out iter,null);\n         this.updateIter(iter,  \"prop\", miter.get_key(), miter.get_value());\n         \n   }\n   print(\"clear selection\\n\");\n   // clear selection?\n   this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..\n   \n   this.view.el.get_selection().unselect_all();\n   \n       var pane = _this.main_window.editpane.el;\n    var try_size = (i * 25) + 60; // est. 20px per line + 40px header\n    \n    // max 80%...\n    pane.set_position( \n         ((try_size * 1.0f) /  (pane.max_position * 1.0f))  > 0.8f  ? \n        (int) (pane.max_position * 0.2f) :\n        pane.max_position-try_size);\n    \n   \n}\n",
+            "xtype" : "VBox",
+            "|              string keyFormat" : "(string val, string type) {\n    \n    // Glib.markup_escape_text(val);\n\n    if (type == \"listener\") {\n        return \"<span font_weight=\\\"bold\\\" color=\\\"#660000\\\">\" + \n            GLib.Markup.escape_text(val) +\n             \"</span>\";\n    }\n    // property..\n    if (val.length < 1) {\n        return \"<span  color=\\\"#FF0000\\\">--empty--</span>\";\n    }\n    \n    //@ = signal\n    //$ = property with \n    //# - object properties\n    //* = special\n    // all of these... - display value is last element..\n    var ar = val.strip().split(\" \");\n    \n    \n    var dval = GLib.Markup.escape_text(ar[ar.length-1]);\n    \n    \n    \n    \n    switch(val[0]) {\n        case '@': // signal // just bold balck?\n            if (dval[0] == '@') {\n                dval = dval.substring(1);\n            }\n        \n            return @\"<span  font_weight=\\\"bold\\\">@ $dval</span>\";        \n        case '#': // object properties?\n            if (dval[0] == '#') {\n                dval = dval.substring(1);\n            }\n            return @\"<span  font_weight=\\\"bold\\\">$dval</span>\";\n        case '*': // special\n            if (dval[0] == '*') {\n                dval = dval.substring(1);\n            }\n            return @\"<span   color=\\\"#0000CC\\\" font_weight=\\\"bold\\\">$dval</span>\";            \n        case '$':\n            if (dval[0] == '$') {\n                dval = dval.substring(1);\n            }\n            return @\"<span   style=\\\"italic\\\">$dval</span>\";\n       case '|': // user defined methods\n            if (dval[0] == '|') {\n                dval = dval.substring(1);\n            }\n            return @\"<span color=\\\"#008000\\\" font_weight=\\\"bold\\\">$dval</span>\";\n            \n              \n            \n        default:\n            return dval;\n    }\n      \n    \n\n}",
+            "# JsRender.JsRender file" : "",
+            "@ bool stop_editor" : "()",
+            "@ void show_editor" : "(JsRender.JsRender file, JsRender.Node node, string type, string key)",
+            "@ void changed" : "()",
+            "|              void deleteSelected" : " () {\n    \n        Gtk.TreeIter iter;\n        Gtk.TreeModel mod;\n        \n        var s = this.view.el.get_selection();\n        s.get_selected(out mod, out iter);\n             \n              \n        GLib.Value gval;\n        mod.get_value(iter, 0 , out gval);\n        var type = (string)gval;\n        \n        mod.get_value(iter, 1 , out gval);\n        var key = (string)gval;\n        \n        switch(type) {\n            case \"listener\":\n                this.node.listeners.remove(key);\n                break;\n                \n            case \"props\":\n                this.node.props.remove(key);\n                break;\n        }\n        this.load(this.file, this.node);\n        \n        _this.changed();\n}",
+            "$ xns" : "Gtk",
+            "|              void startEditingKey" : "( Gtk.TreePath path) {\n    \n     if (!this.stop_editor()) {\n        return;\n     }\n  \n    // others... - fill in options for true/false?\n    \n       \n    GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n        this.allow_edit  = true;\n        this.keyrender.el.editable = true;\n     \n        this.view.el.set_cursor_on_cell(\n            path,\n            this.keycol.el,\n            this.keyrender.el,\n            true\n        );\n               \n        return false;\n    });\n      \n    \n}\n",
+            "@ void show_add_props" : "(string type)",
+            "$ homogeneous" : "false   ",
+            "# Xcls_MainWindow main_window" : "null",
+            "|              void addProp" : " (string in_type, string key, string value, string value_type) {\n      // info includes key, val, skel, etype..\n      //console.dump(info);\n        //type = info.type.toLowerCase();\n        //var data = this.toJS();\n          \n    var type = in_type == \"signals\" ? \"listener\" : in_type;\n      \n    var fkey = (value_type.length > 0 ? value_type + \" \" : \"\") + key;\n              \n    if (type == \"listener\") {\n        if (this.node.listeners.has_key(key)) {\n            return;\n        }\n        this.node.listeners.set(key,value);\n    } else  {\n    \n        if (this.node.props.has_key(fkey)) {\n            return;\n        }\n        this.node.props.set(fkey,value);\n    }\n           \n      \n    // add a row???\n    this.load(this.file, this.node);\n    \n    \n    \n    /// need to find the row which I've just added..\n    \n    \n    var s = this.view.el.get_selection();\n    s.unselect_all();\n    \n    print(\"trying to find new iter\");\n  \n    this.model.el.foreach((model, path, iter) => {\n        GLib.Value gval;\n    \n        this.model.el.get_value(iter, 0 , out gval);\n        if ((string)gval != type) {\n            print(\"not type: %s = %s\\n\", (string)gval , type);\n            return false;\n        }\n        this.model.el.get_value(iter, 1 , out gval);\n        if ((string)gval != fkey) {\n            print(\"not key: %s = %s\\n\", (string)gval , fkey);\n            return false;\n        }\n        // delay this?\n        GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {\n        \n            this.startEditingValue(this.model.el.get_path(iter));\n            return false;\n        });\n        //s.select_iter(iter);\n        return true; \n    });\n    \n    \n    \n              \n}\n",
+            "|              void updateIter" : "(Gtk.TreeIter iter,  string type, string key, string value) {\n\n    print(\"update Iter %s, %s\\n\", key,value);\n    //typeof(string),  // 0 key type\n     //typeof(string),  // 1 key\n     //typeof(string),  // 2 key (display)\n     //typeof(string),  // 3 value\n     //typeof(string),  // 4 value (display)\n     //typeof(string),  // 5 both (tooltip)\n     //typeof(string),  // 6 key (sort)\n    \n    var dl = value.strip().split(\"\\n\");\n\n    var dis_val = dl.length > 1 ? (dl[0].strip()+ \"...\") : dl[0];\n    \n    if (type == \"listener\") {\n     \n       \n        \n        this.model.el.set(iter, \n                0, type,\n            1, key,\n            2, this.keyFormat(key ,type),\n            3, value,\n            4, dis_val,\n            5, \"<tt>\" +  GLib.Markup.escape_text(key + \" \" +value) + \"</tt>\",\n            6,  \"0 \" + key\n        ); \n        return;\n    }\n    \n\n\n    this.model.el.set(iter, \n            0, \"props\",\n            1, key,\n            2,  this.keyFormat(key , \"prop\"),\n            3, value,\n            4, dis_val,\n             5, \"<tt>\" + GLib.Markup.escape_text(key + \" \" + value) + \"</tt>\",\n             6,  this.keySortFormat(key)\n        ); \n}",
+            "# JsRender.Node node" : "",
+            "items" : [
+                {
+                    "* pack" : "pack_start,false,true,0",
+                    "xtype" : "HBox",
+                    "$ xns" : "Gtk",
+                    "items" : [
+                        {
+                            "listeners" : {
+                                "button_press_event" : "  (self, ev) => {\n    _this.before_edit();\n    \n        \n    var p = _this.AddPropertyPopup;\n    p.el.set_screen(Gdk.Screen.get_default());\n    p.el.show_all();\n     p.el.popup(null, null, null, ev.button, ev.time);\n     return true;\n}"
+                            },
+                            "* pack" : "add",
+                            "xtype" : "Button",
+                            "$ xns" : "Gtk",
+                            "items" : [
+                                {
+                                    "* pack" : "add",
+                                    "xtype" : "HBox",
+                                    "$ xns" : "Gtk",
+                                    "items" : [
+                                        {
+                                            "xtype" : "Image",
+                                            "$ stock" : "Gtk.STOCK_ADD",
+                                            "* pack" : "add",
+                                            "$ xns" : "Gtk",
+                                            "$ icon_size" : "Gtk.IconSize.MENU"
+                                        },
+                                        {
+                                            "label" : "Other",
+                                            "* pack" : "add",
+                                            "xtype" : "Label",
+                                            "$ xns" : "Gtk"
+                                        }
+                                    ]
+                                },
+                                {
+                                    "id" : "AddPropertyPopup",
+                                    "* pack" : false,
+                                    "xtype" : "Menu",
+                                    "$ xns" : "Gtk",
+                                    "items" : [
+                                        {
+                                            "listeners" : {
+                                                "activate" : " ()  => {\n    _this.addProp( \"prop\", \"id\", \"\", \"\");\n}"
+                                            },
+                                            "label" : "id: _this.{ID} (Vala)",
+                                            "* pack" : "append",
+                                            "xtype" : "MenuItem",
+                                            "tooltip_markup" : "Using _this.{ID} will map to this element",
+                                            "$ xns" : "Gtk"
+                                        },
+                                        {
+                                            "listeners" : {
+                                                "activate" : "  ( ) => {\n\n    _this.addProp( \"prop\", \"pack\",\"add\", \"*\");\n}"
+                                            },
+                                            "label" : "pack: Pack method (Vala)",
+                                            "xtype" : "MenuItem",
+                                            "* pack" : "append",
+                                            "tooltip_markup" : "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element",
+                                            "$ xns" : "Gtk"
+                                        },
+                                        {
+                                            "listeners" : {
+                                                "activate" : "  ( ) => {\n\n    _this.addProp( \"prop\", \"ctor\",\"\", \"*\");\n}"
+                                            },
+                                            "label" : "ctor: Alterative to default contructor",
+                                            "* pack" : "append",
+                                            "xtype" : "MenuItem",
+                                            "tooltip_markup" : "eg. \n\nnew Clutter.Image.from_file(.....)",
+                                            "$ xns" : "Gtk"
+                                        },
+                                        {
+                                            "listeners" : {
+                                                "activate" : "  ( ) => {\n\n    _this.addProp( \"prop\",  \"init\", \"{\\n\\n}\\n\", \"*\" );\n}"
+                                            },
+                                            "label" : "init: initialziation code (vala)",
+                                            "* pack" : "append",
+                                            "xtype" : "MenuItem",
+                                            "tooltip_markup" : "This code is called after the ctor",
+                                            "$ xns" : "Gtk"
+                                        },
+                                        {
+                                            "* pack" : "add",
+                                            "xtype" : "SeparatorMenuItem",
+                                            "$ xns" : "Gtk"
+                                        },
+                                        {
+                                            "listeners" : {
+                                                "activate" : "  (self) => {\n\n    _this.addProp( \"prop\", \"XXXX\", \"\",\"string\");\n\n}"
+                                            },
+                                            "label" : "String",
+                                            "* pack" : "append",
+                                            "xtype" : "MenuItem",
+                                            "tooltip_markup" : "Add a user defined string property",
+                                            "$ xns" : "Gtk"
+                                        },
+                                        {
+                                            "listeners" : {
+                                                "activate" : "  ( ) =>{\n\n    _this.addProp(\"prop\",  \"XXX\", \"0\", \"int\");\n}"
+                                            },
+                                            "label" : "Number",
+                                            "* pack" : "append",
+                                            "xtype" : "MenuItem",
+                                            "tooltip_markup" : "Add a user defined number property",
+                                            "$ xns" : "Gtk"
+                                        },
+                                        {
+                                            "listeners" : {
+                                                "activate" : "  ( ) =>{\n\n    _this.addProp( \"prop\", \"XXX\", \"true\", \"bool\");\n}"
+                                            },
+                                            "label" : "Boolean",
+                                            "* pack" : "append",
+                                            "xtype" : "MenuItem",
+                                            "tooltip_markup" : "Add a user defined boolean property",
+                                            "$ xns" : "Gtk"
+                                        },
+                                        {
+                                            "* pack" : "add",
+                                            "xtype" : "SeparatorMenuItem",
+                                            "$ xns" : "Gtk"
+                                        },
+                                        {
+                                            "listeners" : {
+                                                "activate" : "  ( ) =>{\n\n    _this.addProp(\"prop\",  \"XXXX\", \"function() { }\", \"| function\");\n}"
+                                            },
+                                            "label" : "Javascript Function",
+                                            "* pack" : "append",
+                                            "xtype" : "MenuItem",
+                                            "tooltip_markup" : "Add a user function boolean property",
+                                            "$ xns" : "Gtk"
+                                        },
+                                        {
+                                            "listeners" : {
+                                                "activate" : "  ( ) =>{\n\n    _this.addProp( \"prop\", \"XXXX\", \"() {\\n\\n}\\n\", \"| return_type\");\n}"
+                                            },
+                                            "label" : "Vala Method",
+                                            "* pack" : "append",
+                                            "xtype" : "MenuItem",
+                                            "tooltip_markup" : "Add a user function boolean property",
+                                            "$ xns" : "Gtk"
+                                        }
+                                    ]
+                                }
+                            ]
+                        }
+                    ]
+                },
+                {
+                    "# bool editing" : false,
+                    "id" : "EditProps",
+                    "* init" : "  {\n  \n   this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n}\n",
+                    "$ shadow_type" : "Gtk.ShadowType.IN",
+                    "* pack" : "pack_end,true,true,0",
+                    "xtype" : "ScrolledWindow",
+                    "$ xns" : "Gtk",
+                    "items" : [
+                        {
+                            "listeners" : {
+                                "button_press_event" : "  ( ev)  => {\n \n    Gtk.TreeViewColumn col;\n    int cell_x;\n    int cell_y;\n    Gtk.TreePath path;\n    if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {\n        print(\"nothing selected on click\");\n        GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n            this.el.get_selection().unselect_all();\n\n            return false;\n        });\n         _this.before_edit();\n        return false; //not on a element.\n    }\n    \n    \n     // right click.\n     if (ev.type == Gdk.EventType.2BUTTON_PRESS  && ev.button == 1 && col.title == \"Name\") {    \n        // show popup!.   \n        \n \n         _this.before_edit();\n         \n         _this.keyrender.el.stop_editing(false);\n         _this.keyrender.el.editable  =false;\n    \n         _this.valrender.el.stop_editing(false);\n         _this.valrender.el.editable  =false;\n           \n          _this.startEditingKey(path); \n         \n        return false;\n    }\n    \n    \n    \n    \n     // right click.\n     if (ev.type == Gdk.EventType.BUTTON_PRESS  && ev.button == 3) {    \n        // show popup!.   \n        //if (col.title == \"Value\") {\n         //     _this.before_edit();\n         //    return false;\n         //}\n\n        var p = _this.ContextMenu;\n\n        p.el.set_screen(Gdk.Screen.get_default());\n        p.el.show_all();\n        p.el.popup(null, null, null,  ev.button, ev.time);\n        //Seed.print(\"click:\" + res.column.title);\n        // select the \n        GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n  \n            this.el.get_selection().select_path(path);\n            return false;\n        });\n         _this.before_edit();\n        return false;\n    }\n    \n     \n    if (col.title != \"Value\") {\n        print(\"col title != Value\");\n        \n        GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {\n            this.el.get_selection().select_path(path);\n            return false;\n        });\n        \n        _this.before_edit();\n          //  XObject.error(\"column is not value?\");\n        return false; // ignore.. - key click.. ??? should we do this??\n    }\n    \n    \n    // if the cell can be edited with a pulldown\n    // then we should return true... - and let the start_editing handle it?\n    \n    \n    \n    \n    \n      \n   //             _this.before_edit(); <<< we really need to stop the other editor..\n     _this.keyrender.el.stop_editing(false);\n    _this.keyrender.el.editable  =false;\n    \n           \n    return _this.startEditingValue(path); // assumes selected row..\n        \n   \n\n              \n   \n}"
+                            },
+                            "id" : "view",
+                            "* init" : "{\n    var selection = this.el.get_selection();\n    selection.set_mode( Gtk.SelectionMode.SINGLE);\n\n\n    var description = new Pango.FontDescription();\n    description.set_size(8000);\n    this.el.modify_font(description);\n}\n",
+                            "tooltip_column" : 5,
+                            "xtype" : "TreeView",
+                            "$ enable_tree_lines" : true,
+                            "$ headers_visible" : true,
+                            "* pack" : "add",
+                            "$ xns" : "Gtk",
+                            "items" : [
+                                {
+                                    "id" : "model",
+                                    "$ 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",
+                                    "* pack" : "set_model",
+                                    "xtype" : "TreeStore",
+                                    "$ columns" : "     typeof(string),  // 0 key type\n     typeof(string),  // 1 key\n     typeof(string),  // 2 key (display)\n     typeof(string),  // 3 value\n     typeof(string),   // 4 value (display)\n     typeof(string),   // 5 both (tooltip)     \n     typeof(string)   // 6 key (for sorting)\n",
+                                    "n_columns" : 7,
+                                    "$ xns" : "Gtk",
+                                    "$ toShort" : "function(str) {\n    var a = typeof(str) == 'string' ? str.split(\"\\n\") : [];\n        return a.length > 1 ? a[0] + '....' : '' + str;\n}\n"
+                                },
+                                {
+                                    "id" : "keycol",
+                                    "* init" : " this.el.add_attribute(_this.keyrender.el , \"markup\", 2 );\n this.el.add_attribute(_this.keyrender.el , \"text\", 1 );\n  ",
+                                    "title" : "Name",
+                                    "* pack" : "append_column",
+                                    "xtype" : "TreeViewColumn",
+                                    "$ resizable" : true,
+                                    "$ xns" : "Gtk",
+                                    "items" : [
+                                        {
+                                            "listeners" : {
+                                                "editing_started" : "(  editable, path) => {\n\n     Gtk.TreeIter  iter;\n    _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));\n    GLib.Value gval;\n                  \n\n\n     //   this.get('/LeftPanel.model').activePath  = path;\n    _this.model.el.get_value(iter,1, out gval);\n        var val = (string)gval;\n                 \n        ((Gtk.Entry)editable).set_text(val);                 \n}",
+                                                "edited" : "  (path, newtext) => {\n        print(\"Keyrender  - signal:edited\\n\");\n    \n    this.el.editable = false;\n  \n \n\n        Gtk.TreeIter  iter;\n        _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));\n        GLib.Value gval;\n        \n         _this.model.el.get_value(iter,1, out gval);\n        var oldval = (string)gval;\n        \n         _this.model.el.get_value(iter,0, out gval);\n        var ktype = (string)gval;\n       \n        _this.model.el.set_value(iter, 1, newtext);\n        \n        if (oldval == newtext) {\n            return;\n        }\n        \n        \n        print(\"ktype: %s\\n\",ktype);\n        switch(ktype) {\n            case \"listener\":\n                var ov = _this.node.listeners.get(oldval);\n                _this.node.listeners.set(newtext, ov);\n                _this.node.listeners.remove(oldval);\n                \n                _this.updateIter(iter,  ktype, newtext, ov);\n                \n                break;\n            case \"props\":\n                var ov = _this.node.props.get(oldval);\n                _this.node.props.set(newtext, ov);\n                _this.node.props.remove(oldval);\n                _this.updateIter(iter,  ktype, newtext, ov);\n                break;\n         }\n         _this.changed();\n          \n}"
+                                            },
+                                            "id" : "keyrender",
+                                            "xtype" : "CellRendererText",
+                                            "* pack" : "pack_start,false",
+                                            "$ xns" : "Gtk"
+                                        }
+                                    ]
+                                },
+                                {
+                                    "id" : "valcol",
+                                    "* init" : "{\n\t\n\t//     typeof(string),  // 0 key type\n    // typeof(string),  // 1 key\n    // typeof(string),  // 2 key (display)\n    // typeof(string),  // 3 value\n    // typeof(string)   // 4 value (display)\n\n\t\n\tthis.el.add_attribute(_this.valrender.el , \"text\", 4 );\n\t//this.el.add_attribute(_this.valrender.el , \"sensitive\", 4 );\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",
+                                    "* pack" : "append_column",
+                                    "title" : "Value",
+                                    "xtype" : "TreeViewColumn",
+                                    "$ resizable" : true,
+                                    "$ xns" : "Gtk",
+                                    "items" : [
+                                        {
+                                            "listeners" : {
+                                                "editing_started" : "( editable, path) => {\n    //_this.editing = true;\n    print(\"editing started called\\n\");\n    if (!_this.allow_edit) {\n       \n         print(\"val - editing_Started\\n\");\n        this.el.editable = false; // make sure it's not editor...\n   \n         \n        return;\n    }\n     _this.allow_edit =false;\n    \n   \n     if (       this.el.has_entry ) {\n   \n         Gtk.TreeIter  iter;\n        _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));\n        GLib.Value gval;\n                      \n\n      \n         //   this.get('/LeftPanel.model').activePath  = path;\n       _this.model.el.get_value(iter,3, out gval);\n    \n\n        var val = (string)gval;\n        var combo =        (Gtk.ComboBox)editable;\n\n       var entry =  (Gtk.Entry) combo.get_child();        \n    entry.set_text(val);\n    }\n   \n}",
+                                                "edited" : "  (path, newtext) => {\n    print(\"Valrender  - signal:edited\\n\");\n  \n        this.el.editable = false;\n/*  \n m.set(iter, \n                0, \"listener\",\n                1, miter.get_key(),\n                2, \"<b>\" + miter.get_key() + \"</b>\",\n                3, miter.get_value(),\n                4, display_value(short);\n            ); \n\n  */      \n\n        Gtk.TreeIter  iter;\n        _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));\n        GLib.Value gval;\n        \n         _this.model.el.get_value(iter,0, out gval);\n        var ktype = (string)gval;\n        \n        \n         _this.model.el.get_value(iter,3, out gval);\n        var oldval = (string)gval;\n        \n         _this.model.el.get_value(iter,1, out gval);\n        var key = (string)gval;\n        \n         \n        \n        switch(ktype) {\n            case \"listener\":\n                _this.node.listeners.set(key, newtext);\n                _this.updateIter(iter,ktype,key,newtext);\n                break;\n            case \"props\":\n                _this.node.props.set(key,newtext);\n                _this.updateIter(iter,ktype, key,newtext);                \n                break;\n         }\n//         _this.load(_this.file,_this.node);\n         _this.changed();\n          \n}"
+                                            },
+                                            "id" : "valrender",
+                                            "* pack" : "pack_start,true",
+                                            "xtype" : "CellRendererCombo",
+                                            "$ editable" : false,
+                                            "$ has_entry" : true,
+                                            "$ xns" : "Gtk",
+                                            "|              void setOptions" : "(string[] ar) {\n      var m = _this.valrendermodel.el;\n        m.clear();\n     Gtk.TreeIter iret;\n    for (var i =0; i < ar.length; i++) {\n            m.append(out iret);\n            m.set_value(iret, 0, ar[i]);\n    }\n\n}",
+                                            "text_column" : 0,
+                                            "items" : [
+                                                {
+                                                    "id" : "valrendermodel",
+                                                    "* pack" : false,
+                                                    "xtype" : "ListStore",
+                                                    "$ columns" : "typeof(string)",
+                                                    "n_columns" : 1,
+                                                    "$ xns" : "Gtk",
+                                                    "* prop" : "model"
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                },
+                                {
+                                    "id" : "ContextMenu",
+                                    "xtype" : "Menu",
+                                    "* pack" : false,
+                                    "$ xns" : "Gtk",
+                                    "items" : [
+                                        {
+                                            "listeners" : {
+                                                "activate" : "  ( )  =>{\n  \n    var s = _this.view.el.get_selection();\n    Gtk.TreeIter iter;\n    Gtk.TreeModel model;\n    s.get_selected (out  model, out  iter);\n    _this.startEditingKey(model.get_path(iter));\n}"
+                                            },
+                                            "label" : "Edit",
+                                            "xtype" : "MenuItem",
+                                            "* pack" : "append",
+                                            "$ xns" : "Gtk"
+                                        },
+                                        {
+                                            "* pack" : "append",
+                                            "xtype" : "SeparatorMenuItem",
+                                            "$ xns" : "Gtk"
+                                        },
+                                        {
+                                            "listeners" : {
+                                                "activate" : "  ( )  =>{\n\t_this.deleteSelected();\n}"
+                                            },
+                                            "label" : "Delete",
+                                            "xtype" : "MenuItem",
+                                            "* pack" : "append",
+                                            "$ xns" : "Gtk"
+                                        }
+                                    ]
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/WindowLeftProps.vala b/old-javascript/Builder4/WindowLeftProps.vala
new file mode 100644 (file)
index 0000000..de5ecaa
--- /dev/null
@@ -0,0 +1,1645 @@
+static Xcls_LeftProps  _LeftProps;
+
+public class Xcls_LeftProps : Object 
+{
+    public Gtk.VBox el;
+    private Xcls_LeftProps  _this;
+
+    public static Xcls_LeftProps singleton()
+    {
+        if (_LeftProps == null) {
+            _LeftProps= new Xcls_LeftProps();
+        }
+        return _LeftProps;
+    }
+    public Xcls_AddPropertyPopup AddPropertyPopup;
+    public Xcls_EditProps EditProps;
+    public Xcls_view view;
+    public Xcls_model model;
+    public Xcls_keycol keycol;
+    public Xcls_keyrender keyrender;
+    public Xcls_valcol valcol;
+    public Xcls_valrender valrender;
+    public Xcls_valrendermodel valrendermodel;
+    public Xcls_ContextMenu ContextMenu;
+
+        // my vars (def)
+    public bool allow_edit;
+    public JsRender.JsRender file;
+    public signal bool stop_editor ();
+    public signal void show_editor (JsRender.JsRender file, JsRender.Node node, string type, string key);
+    public signal void changed ();
+    public signal void show_add_props (string type);
+    public Xcls_MainWindow main_window;
+    public JsRender.Node node;
+
+    // ctor 
+    public Xcls_LeftProps()
+    {
+        _this = this;
+        this.el = new Gtk.VBox( false   , 0 );
+
+        // my vars (dec)
+        this.allow_edit = false;
+        this.main_window = null;
+
+        // set gobject values
+        var child_0 = new Xcls_HBox2( _this );
+        child_0.ref();
+        this.el.pack_start (  child_0.el , false,true,0 );
+        var child_1 = new Xcls_EditProps( _this );
+        child_1.ref();
+        this.el.pack_end (  child_1.el , true,true,0 );
+    }
+
+    // user defined functions 
+    public              void before_edit ()
+    {
+    
+        print("before edit - stop editing\n");
+        
+      // these do not appear to trigger save...
+        _this.keyrender.el.stop_editing(false);
+        _this.keyrender.el.editable  =false;
+    
+        _this.valrender.el.stop_editing(false);
+        _this.valrender.el.editable  =false;    
+        
+        
+    // technicall stop the popup editor..
+    
+    }
+    public              string keySortFormat (string key) {
+        // listeners first - with 0
+        // specials
+        if (key[0] == '*') {
+            return "1 " + key;
+        }
+        // functions
+        
+        var bits = key.split(" ");
+        
+        if (key[0] == '|') {
+            return "2 " + bits[bits.length -1];
+        }
+        // signals
+        if (key[0] == '@') {
+            return "3 " + bits[bits.length -1];
+        }
+            
+        // props
+        if (key[0] == '#') {
+            return "4 " + bits[bits.length -1];
+        }
+        // the rest..
+        return "5 " + bits[bits.length -1];    
+    
+    
+    
+    }
+    public              void finish_editing () {
+         // 
+        this.before_edit();
+    }
+    public              bool startEditingValue ( Gtk.TreePath path) {
+    
+        // ONLY return true if editing is allowed - eg. combo..
+        
+                print("start editing?\n");
+                if (!this.stop_editor()) {
+                    print("stop editor failed\n");
+                    return false;
+                }
+                
+                Gtk.TreeIter iter;
+    
+                var mod = this.model.el;
+                mod.get_iter (out iter, path);
+                 
+                /*
+                    m.set(iter, 
+                            0, "listener",
+                            1, miter.get_key(),
+                            2, "<b>" + miter.get_key() + "</b>",
+                            3, miter.get_value()
+                        ); 
+                 
+                */
+                GLib.Value gval;
+                mod.get_value(iter, 3 , out gval);
+                var val = (string)gval;
+            
+                mod.get_value(iter, 1 , out gval);
+                var key = (string)gval;
+                var type_ar = key.split(" ");
+                
+                
+                
+                mod.get_value(iter, 0 , out gval);
+                var type = (string)gval;
+                
+               
+                
+                var use_textarea = false;
+    
+                //------------ things that require the text editor...
+                
+                if (type == "listener") {
+                    use_textarea = true;
+                }
+                if (key.length > 0 && key[0] == '|') { // user defined method
+                    use_textarea = true;
+                }
+                if (key.length > 0 && key[0] == '$') { // raw string
+                    use_textarea = true;
+                }
+                if (key.length > 0 && key == "* init") {
+                    use_textarea = true;
+                }
+                if (val.length > 40) { // long value...
+                    use_textarea = true;
+                }
+                
+                
+                
+                if (use_textarea) {
+                    print("Call show editor\n");
+                    GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
+                        this.view.el.get_selection().select_path(path);
+                        
+                        this.show_editor(file, node, type, key);
+                        
+                        return false;
+                    });
+                   
+                    
+                    return false;
+                }
+                // others... - fill in options for true/false?
+               print("turn on editing %s \n" , mod.get_path(iter).to_string());
+               
+                   print (type_ar[0].up());
+                    if (type_ar.length > 1 && (
+                            type_ar[0].up() == "BOOLEAN"
+                            ||
+                            type_ar[0].up() == "BOOL"                        
+                        )) {
+                            print("start editing try/false)???");
+                            this.valrender.el.has_entry = false;
+                            string[] opts =  { "true", "false" };
+                            this.valrender.setOptions(opts);
+                            
+                            this.valrender.el.has_entry = false;
+                            this.valrender.el.editable = true;
+                             this.allow_edit  = true;
+                             GLib.Timeout.add_full(GLib.Priority.DEFAULT,100 , () => {
+                                 this.view.el.set_cursor_on_cell(
+                                    path,
+                                    this.valcol.el,
+                                    this.valrender.el,
+                                    true
+                                );
+                                return false;
+                            });
+                            return true;
+                    }
+                                          
+                    
+               
+                 string[] opts =  {  };
+                this.valrender.setOptions(opts);
+               
+               GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
+                    
+                    // at this point - work out the type...
+                    // if its' a combo... then show the options..
+                    this.valrender.el.has_entry = true;
+                    
+                    this.valrender.el.editable = true;            
+                
+                    
+                    this.allow_edit  = true;
+                    
+                    
+                    
+                    
+    
+                    this.view.el.set_cursor_on_cell(
+                        path,
+                        this.valcol.el,
+                        this.valrender.el,
+                        true
+                    );
+                    return false;
+                });
+                return false;
+            }
+    public              void load (JsRender.JsRender file, JsRender.Node? node) 
+    {
+        print("load leftprops\n");
+        this.before_edit();
+        this.node = node;
+        this.file = file;
+        
+     
+        this.model.el.clear();
+                  
+        //this.get('/RightEditor').el.hide();
+        if (node ==null) {
+            return ;
+        }
+         
+        
+    
+        //var provider = this.get('/LeftTree').getPaleteProvider();
+        Gtk.TreeIter iter;
+        
+        //typeof(string),  // 0 key type
+         //typeof(string),  // 1 key
+         //typeof(string),  // 2 key (display)
+         //typeof(string),  // 3 value
+         //typeof(string),  // 4 value (display)
+         //typeof(string),  // 5 both (tooltip)
+        
+        
+        
+        
+        // really need a way to sort the hashmap...
+        var m = this.model.el;
+        
+        var miter = node.listeners.map_iterator();
+        var i = 0;
+        
+        while(miter.next()) {
+            i++;
+            m.append(out iter,null);
+            
+            this.updateIter(iter,  "listener", miter.get_key(), miter.get_value());
+            
+             
+         }
+         
+          
+        miter = node.props.map_iterator();
+        
+        
+       while(miter.next()) {
+               i++;
+            m.append(out iter,null);
+             this.updateIter(iter,  "prop", miter.get_key(), miter.get_value());
+             
+       }
+       print("clear selection\n");
+       // clear selection?
+       this.model.el.set_sort_column_id(6,Gtk.SortType.ASCENDING); // sort by real key..
+       
+       this.view.el.get_selection().unselect_all();
+       
+           var pane = _this.main_window.editpane.el;
+        var try_size = (i * 25) + 60; // est. 20px per line + 40px header
+        
+        // max 80%...
+        pane.set_position( 
+             ((try_size * 1.0f) /  (pane.max_position * 1.0f))  > 0.8f  ? 
+            (int) (pane.max_position * 0.2f) :
+            pane.max_position-try_size);
+        
+       
+    }
+    public              string keyFormat (string val, string type) {
+        
+        // Glib.markup_escape_text(val);
+    
+        if (type == "listener") {
+            return "<span font_weight=\"bold\" color=\"#660000\">" + 
+                GLib.Markup.escape_text(val) +
+                 "</span>";
+        }
+        // property..
+        if (val.length < 1) {
+            return "<span  color=\"#FF0000\">--empty--</span>";
+        }
+        
+        //@ = signal
+        //$ = property with 
+        //# - object properties
+        //* = special
+        // all of these... - display value is last element..
+        var ar = val.strip().split(" ");
+        
+        
+        var dval = GLib.Markup.escape_text(ar[ar.length-1]);
+        
+        
+        
+        
+        switch(val[0]) {
+            case '@': // signal // just bold balck?
+                if (dval[0] == '@') {
+                    dval = dval.substring(1);
+                }
+            
+                return @"<span  font_weight=\"bold\">@ $dval</span>";        
+            case '#': // object properties?
+                if (dval[0] == '#') {
+                    dval = dval.substring(1);
+                }
+                return @"<span  font_weight=\"bold\">$dval</span>";
+            case '*': // special
+                if (dval[0] == '*') {
+                    dval = dval.substring(1);
+                }
+                return @"<span   color=\"#0000CC\" font_weight=\"bold\">$dval</span>";            
+            case '$':
+                if (dval[0] == '$') {
+                    dval = dval.substring(1);
+                }
+                return @"<span   style=\"italic\">$dval</span>";
+           case '|': // user defined methods
+                if (dval[0] == '|') {
+                    dval = dval.substring(1);
+                }
+                return @"<span color=\"#008000\" font_weight=\"bold\">$dval</span>";
+                
+                  
+                
+            default:
+                return dval;
+        }
+          
+        
+    
+    }
+    public              void deleteSelected () {
+        
+            Gtk.TreeIter iter;
+            Gtk.TreeModel mod;
+            
+            var s = this.view.el.get_selection();
+            s.get_selected(out mod, out iter);
+                 
+                  
+            GLib.Value gval;
+            mod.get_value(iter, 0 , out gval);
+            var type = (string)gval;
+            
+            mod.get_value(iter, 1 , out gval);
+            var key = (string)gval;
+            
+            switch(type) {
+                case "listener":
+                    this.node.listeners.remove(key);
+                    break;
+                    
+                case "props":
+                    this.node.props.remove(key);
+                    break;
+            }
+            this.load(this.file, this.node);
+            
+            _this.changed();
+    }
+    public              void startEditingKey ( Gtk.TreePath path) {
+        
+         if (!this.stop_editor()) {
+            return;
+         }
+      
+        // others... - fill in options for true/false?
+        
+           
+        GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
+            this.allow_edit  = true;
+            this.keyrender.el.editable = true;
+         
+            this.view.el.set_cursor_on_cell(
+                path,
+                this.keycol.el,
+                this.keyrender.el,
+                true
+            );
+                   
+            return false;
+        });
+          
+        
+    }
+    public              void addProp (string in_type, string key, string value, string value_type) {
+          // info includes key, val, skel, etype..
+          //console.dump(info);
+            //type = info.type.toLowerCase();
+            //var data = this.toJS();
+              
+        var type = in_type == "signals" ? "listener" : in_type;
+          
+        var fkey = (value_type.length > 0 ? value_type + " " : "") + key;
+                  
+        if (type == "listener") {
+            if (this.node.listeners.has_key(key)) {
+                return;
+            }
+            this.node.listeners.set(key,value);
+        } else  {
+        
+            if (this.node.props.has_key(fkey)) {
+                return;
+            }
+            this.node.props.set(fkey,value);
+        }
+               
+          
+        // add a row???
+        this.load(this.file, this.node);
+        
+        
+        
+        /// need to find the row which I've just added..
+        
+        
+        var s = this.view.el.get_selection();
+        s.unselect_all();
+        
+        print("trying to find new iter");
+      
+        this.model.el.foreach((model, path, iter) => {
+            GLib.Value gval;
+        
+            this.model.el.get_value(iter, 0 , out gval);
+            if ((string)gval != type) {
+                print("not type: %s = %s\n", (string)gval , type);
+                return false;
+            }
+            this.model.el.get_value(iter, 1 , out gval);
+            if ((string)gval != fkey) {
+                print("not key: %s = %s\n", (string)gval , fkey);
+                return false;
+            }
+            // delay this?
+            GLib.Timeout.add_full(GLib.Priority.DEFAULT,40 , () => {
+            
+                this.startEditingValue(this.model.el.get_path(iter));
+                return false;
+            });
+            //s.select_iter(iter);
+            return true; 
+        });
+        
+        
+        
+                  
+    }
+    public              void updateIter (Gtk.TreeIter iter,  string type, string key, string value) {
+    
+        print("update Iter %s, %s\n", key,value);
+        //typeof(string),  // 0 key type
+         //typeof(string),  // 1 key
+         //typeof(string),  // 2 key (display)
+         //typeof(string),  // 3 value
+         //typeof(string),  // 4 value (display)
+         //typeof(string),  // 5 both (tooltip)
+         //typeof(string),  // 6 key (sort)
+        
+        var dl = value.strip().split("\n");
+    
+        var dis_val = dl.length > 1 ? (dl[0].strip()+ "...") : dl[0];
+        
+        if (type == "listener") {
+         
+           
+            
+            this.model.el.set(iter, 
+                    0, type,
+                1, key,
+                2, this.keyFormat(key ,type),
+                3, value,
+                4, dis_val,
+                5, "<tt>" +  GLib.Markup.escape_text(key + " " +value) + "</tt>",
+                6,  "0 " + key
+            ); 
+            return;
+        }
+        
+    
+    
+        this.model.el.set(iter, 
+                0, "props",
+                1, key,
+                2,  this.keyFormat(key , "prop"),
+                3, value,
+                4, dis_val,
+                 5, "<tt>" + GLib.Markup.escape_text(key + " " + value) + "</tt>",
+                 6,  this.keySortFormat(key)
+            ); 
+    }
+    public class Xcls_HBox2 : Object 
+    {
+        public Gtk.HBox el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_HBox2(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.HBox( true, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Button3( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button3 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button3(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_HBox4( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+            var child_1 = new Xcls_AddPropertyPopup( _this );
+            child_1.ref();
+
+            // listeners 
+            this.el.button_press_event.connect( (self, ev) => {
+                _this.before_edit();
+                
+                    
+                var p = _this.AddPropertyPopup;
+                p.el.set_screen(Gdk.Screen.get_default());
+                p.el.show_all();
+                 p.el.popup(null, null, null, ev.button, ev.time);
+                 return true;
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_HBox4 : Object 
+    {
+        public Gtk.HBox el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_HBox4(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.HBox( true, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_Image5( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+            var child_1 = new Xcls_Label6( _this );
+            child_1.ref();
+            this.el.add (  child_1.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Image5 : Object 
+    {
+        public Gtk.Image el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Image5(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Image();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.stock = Gtk.STOCK_ADD;
+            this.el.icon_size = Gtk.IconSize.MENU;
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Label6 : Object 
+    {
+        public Gtk.Label el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Label6(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Label( "Other" );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_AddPropertyPopup : Object 
+    {
+        public Gtk.Menu el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_AddPropertyPopup(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            _this.AddPropertyPopup = this;
+            this.el = new Gtk.Menu();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_MenuItem8( _this );
+            child_0.ref();
+            this.el.append (  child_0.el  );
+            var child_1 = new Xcls_MenuItem9( _this );
+            child_1.ref();
+            this.el.append (  child_1.el  );
+            var child_2 = new Xcls_MenuItem10( _this );
+            child_2.ref();
+            this.el.append (  child_2.el  );
+            var child_3 = new Xcls_MenuItem11( _this );
+            child_3.ref();
+            this.el.append (  child_3.el  );
+            var child_4 = new Xcls_SeparatorMenuItem12( _this );
+            child_4.ref();
+            this.el.add (  child_4.el  );
+            var child_5 = new Xcls_MenuItem13( _this );
+            child_5.ref();
+            this.el.append (  child_5.el  );
+            var child_6 = new Xcls_MenuItem14( _this );
+            child_6.ref();
+            this.el.append (  child_6.el  );
+            var child_7 = new Xcls_MenuItem15( _this );
+            child_7.ref();
+            this.el.append (  child_7.el  );
+            var child_8 = new Xcls_SeparatorMenuItem16( _this );
+            child_8.ref();
+            this.el.add (  child_8.el  );
+            var child_9 = new Xcls_MenuItem17( _this );
+            child_9.ref();
+            this.el.append (  child_9.el  );
+            var child_10 = new Xcls_MenuItem18( _this );
+            child_10.ref();
+            this.el.append (  child_10.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem8 : Object 
+    {
+        public Gtk.MenuItem el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem8(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.tooltip_markup = "Using _this.{ID} will map to this element";
+            this.el.label = "id: _this.{ID} (Vala)";
+
+            // listeners 
+            this.el.activate.connect( ()  => {
+                _this.addProp( "prop", "id", "", "");
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem9 : Object 
+    {
+        public Gtk.MenuItem el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem9(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.tooltip_markup = "how to pack this element onto parent, (method, 2nd arg, 3rd arg) .. the 1st argument is filled by the element";
+            this.el.label = "pack: Pack method (Vala)";
+
+            // listeners 
+            this.el.activate.connect( ( ) => {
+            
+                _this.addProp( "prop", "pack","add", "*");
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem10 : Object 
+    {
+        public Gtk.MenuItem el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem10(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.tooltip_markup = "eg. \n\nnew Clutter.Image.from_file(.....)";
+            this.el.label = "ctor: Alterative to default contructor";
+
+            // listeners 
+            this.el.activate.connect( ( ) => {
+            
+                _this.addProp( "prop", "ctor","", "*");
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem11 : Object 
+    {
+        public Gtk.MenuItem el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem11(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.tooltip_markup = "This code is called after the ctor";
+            this.el.label = "init: initialziation code (vala)";
+
+            // listeners 
+            this.el.activate.connect( ( ) => {
+            
+                _this.addProp( "prop",  "init", "{\n\n}\n", "*" );
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_SeparatorMenuItem12 : Object 
+    {
+        public Gtk.SeparatorMenuItem el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_SeparatorMenuItem12(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.SeparatorMenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem13 : Object 
+    {
+        public Gtk.MenuItem el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem13(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.tooltip_markup = "Add a user defined string property";
+            this.el.label = "String";
+
+            // listeners 
+            this.el.activate.connect( (self) => {
+            
+                _this.addProp( "prop", "XXXX", "","string");
+            
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem14 : Object 
+    {
+        public Gtk.MenuItem el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem14(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.tooltip_markup = "Add a user defined number property";
+            this.el.label = "Number";
+
+            // listeners 
+            this.el.activate.connect( ( ) =>{
+            
+                _this.addProp("prop",  "XXX", "0", "int");
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem15 : Object 
+    {
+        public Gtk.MenuItem el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem15(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.tooltip_markup = "Add a user defined boolean property";
+            this.el.label = "Boolean";
+
+            // listeners 
+            this.el.activate.connect( ( ) =>{
+            
+                _this.addProp( "prop", "XXX", "true", "bool");
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_SeparatorMenuItem16 : Object 
+    {
+        public Gtk.SeparatorMenuItem el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_SeparatorMenuItem16(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.SeparatorMenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem17 : Object 
+    {
+        public Gtk.MenuItem el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem17(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.tooltip_markup = "Add a user function boolean property";
+            this.el.label = "Javascript Function";
+
+            // listeners 
+            this.el.activate.connect( ( ) =>{
+            
+                _this.addProp("prop",  "XXXX", "function() { }", "| function");
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem18 : Object 
+    {
+        public Gtk.MenuItem el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem18(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.tooltip_markup = "Add a user function boolean property";
+            this.el.label = "Vala Method";
+
+            // listeners 
+            this.el.activate.connect( ( ) =>{
+            
+                _this.addProp( "prop", "XXXX", "() {\n\n}\n", "| return_type");
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_EditProps : Object 
+    {
+        public Gtk.ScrolledWindow el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+        public bool editing;
+
+        // ctor 
+        public Xcls_EditProps(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            _this.EditProps = this;
+            this.el = new Gtk.ScrolledWindow( null, null );
+
+            // my vars (dec)
+            this.editing = false;
+
+            // set gobject values
+            this.el.shadow_type = Gtk.ShadowType.IN;
+            var child_0 = new Xcls_view( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+
+            // init method 
+
+            {
+              
+               this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+            }        }
+
+        // user defined functions 
+    }
+    public class Xcls_view : Object 
+    {
+        public Gtk.TreeView el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_view(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            _this.view = this;
+            this.el = new Gtk.TreeView();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.tooltip_column = 5;
+            this.el.enable_tree_lines = true;
+            this.el.headers_visible = true;
+            var child_0 = new Xcls_model( _this );
+            child_0.ref();
+            this.el.set_model (  child_0.el  );
+            var child_1 = new Xcls_keycol( _this );
+            child_1.ref();
+            this.el.append_column (  child_1.el  );
+            var child_2 = new Xcls_valcol( _this );
+            child_2.ref();
+            this.el.append_column (  child_2.el  );
+            var child_3 = new Xcls_ContextMenu( _this );
+            child_3.ref();
+
+            // init method 
+
+            {
+                var selection = this.el.get_selection();
+                selection.set_mode( Gtk.SelectionMode.SINGLE);
+            
+            
+                var description = new Pango.FontDescription();
+                description.set_size(8000);
+                this.el.modify_font(description);
+            }
+            // listeners 
+            this.el.button_press_event.connect( ( ev)  => {
+             
+                Gtk.TreeViewColumn col;
+                int cell_x;
+                int cell_y;
+                Gtk.TreePath path;
+                if (!this.el.get_path_at_pos((int)ev.x, (int) ev.y, out path, out col, out cell_x, out cell_y )) {
+                    print("nothing selected on click");
+                    GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
+                        this.el.get_selection().unselect_all();
+            
+                        return false;
+                    });
+                     _this.before_edit();
+                    return false; //not on a element.
+                }
+                
+                
+                 // right click.
+                 if (ev.type == Gdk.EventType.2BUTTON_PRESS  && ev.button == 1 && col.title == "Name") {    
+                    // show popup!.   
+                    
+             
+                     _this.before_edit();
+                     
+                     _this.keyrender.el.stop_editing(false);
+                     _this.keyrender.el.editable  =false;
+                
+                     _this.valrender.el.stop_editing(false);
+                     _this.valrender.el.editable  =false;
+                       
+                      _this.startEditingKey(path); 
+                     
+                    return false;
+                }
+                
+                
+                
+                
+                 // right click.
+                 if (ev.type == Gdk.EventType.BUTTON_PRESS  && ev.button == 3) {    
+                    // show popup!.   
+                    //if (col.title == "Value") {
+                     //     _this.before_edit();
+                     //    return false;
+                     //}
+            
+                    var p = _this.ContextMenu;
+            
+                    p.el.set_screen(Gdk.Screen.get_default());
+                    p.el.show_all();
+                    p.el.popup(null, null, null,  ev.button, ev.time);
+                    //Seed.print("click:" + res.column.title);
+                    // select the 
+                    GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
+              
+                        this.el.get_selection().select_path(path);
+                        return false;
+                    });
+                     _this.before_edit();
+                    return false;
+                }
+                
+                 
+                if (col.title != "Value") {
+                    print("col title != Value");
+                    
+                    GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
+                        this.el.get_selection().select_path(path);
+                        return false;
+                    });
+                    
+                    _this.before_edit();
+                      //  XObject.error("column is not value?");
+                    return false; // ignore.. - key click.. ??? should we do this??
+                }
+                
+                
+                // if the cell can be edited with a pulldown
+                // then we should return true... - and let the start_editing handle it?
+                
+                
+                
+                
+                
+                  
+               //             _this.before_edit(); <<< we really need to stop the other editor..
+                 _this.keyrender.el.stop_editing(false);
+                _this.keyrender.el.editable  =false;
+                
+                       
+                return _this.startEditingValue(path); // assumes selected row..
+                    
+               
+            
+                          
+               
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_model : Object 
+    {
+        public Gtk.TreeStore el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_model(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            _this.model = this;
+            this.el = new Gtk.TreeStore( 7,      typeof(string),  // 0 key type
+     typeof(string),  // 1 key
+     typeof(string),  // 2 key (display)
+     typeof(string),  // 3 value
+     typeof(string),   // 4 value (display)
+     typeof(string),   // 5 both (tooltip)     
+     typeof(string)   // 6 key (for sorting)
+ );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_keycol : Object 
+    {
+        public Gtk.TreeViewColumn el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_keycol(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            _this.keycol = this;
+            this.el = new Gtk.TreeViewColumn();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.title = "Name";
+            this.el.resizable = true;
+            var child_0 = new Xcls_keyrender( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false );
+
+            // init method 
+
+            this.el.add_attribute(_this.keyrender.el , "markup", 2 );
+             this.el.add_attribute(_this.keyrender.el , "text", 1 );        }
+
+        // user defined functions 
+    }
+    public class Xcls_keyrender : Object 
+    {
+        public Gtk.CellRendererText el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_keyrender(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            _this.keyrender = this;
+            this.el = new Gtk.CellRendererText();
+
+            // my vars (dec)
+
+            // set gobject values
+
+            // listeners 
+            this.el.editing_started.connect( (  editable, path) => {
+            
+                 Gtk.TreeIter  iter;
+                _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
+                GLib.Value gval;
+                              
+            
+            
+                 //   this.get('/LeftPanel.model').activePath  = path;
+                _this.model.el.get_value(iter,1, out gval);
+                    var val = (string)gval;
+                             
+                    ((Gtk.Entry)editable).set_text(val);                 
+            });
+            this.el.edited.connect( (path, newtext) => {
+                    print("Keyrender  - signal:edited\n");
+                
+                this.el.editable = false;
+              
+             
+            
+                    Gtk.TreeIter  iter;
+                    _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
+                    GLib.Value gval;
+                    
+                     _this.model.el.get_value(iter,1, out gval);
+                    var oldval = (string)gval;
+                    
+                     _this.model.el.get_value(iter,0, out gval);
+                    var ktype = (string)gval;
+                   
+                    _this.model.el.set_value(iter, 1, newtext);
+                    
+                    if (oldval == newtext) {
+                        return;
+                    }
+                    
+                    
+                    print("ktype: %s\n",ktype);
+                    switch(ktype) {
+                        case "listener":
+                            var ov = _this.node.listeners.get(oldval);
+                            _this.node.listeners.set(newtext, ov);
+                            _this.node.listeners.remove(oldval);
+                            
+                            _this.updateIter(iter,  ktype, newtext, ov);
+                            
+                            break;
+                        case "props":
+                            var ov = _this.node.props.get(oldval);
+                            _this.node.props.set(newtext, ov);
+                            _this.node.props.remove(oldval);
+                            _this.updateIter(iter,  ktype, newtext, ov);
+                            break;
+                     }
+                     _this.changed();
+                      
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_valcol : Object 
+    {
+        public Gtk.TreeViewColumn el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_valcol(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            _this.valcol = this;
+            this.el = new Gtk.TreeViewColumn();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.title = "Value";
+            this.el.resizable = true;
+            var child_0 = new Xcls_valrender( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , true );
+
+            // init method 
+
+            {
+               
+               //     typeof(string),  // 0 key type
+                // typeof(string),  // 1 key
+                // typeof(string),  // 2 key (display)
+                // typeof(string),  // 3 value
+                // typeof(string)   // 4 value (display)
+            
+               
+               this.el.add_attribute(_this.valrender.el , "text", 4 );
+               //this.el.add_attribute(_this.valrender.el , "sensitive", 4 );
+               //this.el.add_attribute(this.items[0].el , 'editable', 3 );
+                      // this.el.set_cell_data_func(cell, age_cell_data_func, NULL, NULL);
+            
+             //        this.get('/LeftPanel').editableColumn= this;
+            }        }
+
+        // user defined functions 
+    }
+    public class Xcls_valrender : Object 
+    {
+        public Gtk.CellRendererCombo el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_valrender(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            _this.valrender = this;
+            this.el = new Gtk.CellRendererCombo();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.editable = false;
+            this.el.text_column = 0;
+            this.el.has_entry = true;
+            var child_0 = new Xcls_valrendermodel( _this );
+            child_0.ref();
+            this.el.model = child_0.el;
+
+            // listeners 
+            this.el.editing_started.connect( ( editable, path) => {
+                //_this.editing = true;
+                print("editing started called\n");
+                if (!_this.allow_edit) {
+                   
+                     print("val - editing_Started\n");
+                    this.el.editable = false; // make sure it's not editor...
+               
+                     
+                    return;
+                }
+                 _this.allow_edit =false;
+                
+               
+                 if (       this.el.has_entry ) {
+               
+                     Gtk.TreeIter  iter;
+                    _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
+                    GLib.Value gval;
+                                  
+            
+                  
+                     //   this.get('/LeftPanel.model').activePath  = path;
+                   _this.model.el.get_value(iter,3, out gval);
+                
+            
+                    var val = (string)gval;
+                    var combo =        (Gtk.ComboBox)editable;
+            
+                   var entry =  (Gtk.Entry) combo.get_child();        
+                entry.set_text(val);
+                }
+               
+            });
+            this.el.edited.connect( (path, newtext) => {
+                print("Valrender  - signal:edited\n");
+              
+                    this.el.editable = false;
+            /*  
+             m.set(iter, 
+                            0, "listener",
+                            1, miter.get_key(),
+                            2, "<b>" + miter.get_key() + "</b>",
+                            3, miter.get_value(),
+                            4, display_value(short);
+                        ); 
+            
+              */      
+            
+                    Gtk.TreeIter  iter;
+                    _this.model.el.get_iter(out iter, new Gtk.TreePath.from_string(path));
+                    GLib.Value gval;
+                    
+                     _this.model.el.get_value(iter,0, out gval);
+                    var ktype = (string)gval;
+                    
+                    
+                     _this.model.el.get_value(iter,3, out gval);
+                    var oldval = (string)gval;
+                    
+                     _this.model.el.get_value(iter,1, out gval);
+                    var key = (string)gval;
+                    
+                     
+                    
+                    switch(ktype) {
+                        case "listener":
+                            _this.node.listeners.set(key, newtext);
+                            _this.updateIter(iter,ktype,key,newtext);
+                            break;
+                        case "props":
+                            _this.node.props.set(key,newtext);
+                            _this.updateIter(iter,ktype, key,newtext);                
+                            break;
+                     }
+            //         _this.load(_this.file,_this.node);
+                     _this.changed();
+                      
+            });
+        }
+
+        // user defined functions 
+        public              void setOptions (string[] ar) {
+              var m = _this.valrendermodel.el;
+                m.clear();
+             Gtk.TreeIter iret;
+            for (var i =0; i < ar.length; i++) {
+                    m.append(out iret);
+                    m.set_value(iret, 0, ar[i]);
+            }
+        
+        }
+    }
+    public class Xcls_valrendermodel : Object 
+    {
+        public Gtk.ListStore el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_valrendermodel(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            _this.valrendermodel = this;
+            this.el = new Gtk.ListStore( 1, typeof(string) );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_ContextMenu : Object 
+    {
+        public Gtk.Menu el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_ContextMenu(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            _this.ContextMenu = this;
+            this.el = new Gtk.Menu();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_MenuItem28( _this );
+            child_0.ref();
+            this.el.append (  child_0.el  );
+            var child_1 = new Xcls_SeparatorMenuItem29( _this );
+            child_1.ref();
+            this.el.append (  child_1.el  );
+            var child_2 = new Xcls_MenuItem30( _this );
+            child_2.ref();
+            this.el.append (  child_2.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem28 : Object 
+    {
+        public Gtk.MenuItem el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem28(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Edit";
+
+            // listeners 
+            this.el.activate.connect( ( )  =>{
+              
+                var s = _this.view.el.get_selection();
+                Gtk.TreeIter iter;
+                Gtk.TreeModel model;
+                s.get_selected (out  model, out  iter);
+                _this.startEditingKey(model.get_path(iter));
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_SeparatorMenuItem29 : Object 
+    {
+        public Gtk.SeparatorMenuItem el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_SeparatorMenuItem29(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.SeparatorMenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem30 : Object 
+    {
+        public Gtk.MenuItem el;
+        private Xcls_LeftProps  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem30(Xcls_LeftProps _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Delete";
+
+            // listeners 
+            this.el.activate.connect( ( )  =>{
+               _this.deleteSelected();
+            });
+        }
+
+        // user defined functions 
+    }
+}
diff --git a/old-javascript/Builder4/WindowLeftTree.bjs b/old-javascript/Builder4/WindowLeftTree.bjs
new file mode 100644 (file)
index 0000000..77fb761
--- /dev/null
@@ -0,0 +1,132 @@
+{
+    "name" : "WindowLeftTree",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/WindowLeftTree.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "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",
+            "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",
+            "* pack" : "add",
+            "xtype" : "ScrolledWindow",
+            "@ void changed" : "()",
+            "$ xns" : "Gtk",
+            "@ void node_selected" : "(JsRender.Node? node)",
+            "# Xcls_MainWindow main_window" : "null",
+            "|           string getActivePath" : " () {\n    var model = this.model;\n    var view = this.view.el;\n    if (view.get_selection().count_selected_rows() < 1) {\n        return \"\";\n    }\n    Gtk.TreeIter iter;\n    Gtk.TreeModel mod;\n    view.get_selection().get_selected(out mod, out iter);\n    return mod.get_path(iter).to_string();\n}\n",
+            "items" : [
+                {
+                    "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}",
+                        "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 tp = mod.get_path(iter).to_string();\n        var data = (JsRender.Node)(value.dup_object());\n        var xname = data.fqn();\n        print (\"XNAME  IS \" + xname+ \"\\n\");\n        this.dragData = tp;\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    \n        \n    // by default returns the path..\n       var path = _this.model.el.get_path(iter);\n\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   print(\"got drag motion\\n\");\n    var src = Gtk.drag_get_source_widget(ctx);\n   this.drag_x = x;\n   this.drag_y = y;     \n\n   if (src != this.el) {\n   \n \n \n    // the point of this is to detect where an item could be dropped..\n        print(\"requesting drag data\\n\");\n       this.drag_in_motion = true;\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\n\n  print(\"action: %d\\n\", ctx.get_actions());\n //print(\"GETTING POS\");\n    var  targetData = \"\";\n\n    Gtk.TreePath path;\n    Gtk.TreeViewDropPosition pos;\n    var isOver = _this.view.el.get_dest_row_at_pos(this.drag_x,this.drag_y, out path, out pos);\n\n    // if there are not items in the tree.. the we have to set isOver to true for anything..\n    var isEmpty = false;\n    if (_this.model.el.iter_n_children(null) < 1) {\n        print(\"got NO children?\\n\");\n        isOver = true; //??? \n        isEmpty = true;\n        pos = Gtk.TreeViewDropPosition.INTO_OR_AFTER;\n    }\n\n\n    // ------------- a drag from self..\n\n\n    //var action = Gdk.DragAction.COPY;\n        // unless we are copying!!! ctl button..\n    \n    var action = (ctx.get_actions() & Gdk.DragAction.MOVE) > 0 ?\n                 Gdk.DragAction.COPY  : Gdk.DragAction.MOVE ;\n                // Gdk.DragAction.MOVE : Gdk.DragAction.COPY ;\n\n\n    if (_this.model.el.iter_n_children(null) < 1) {\n        // no children.. -- asume it's ok..\n        \n        targetData = \"|%d|\".printf((int)Gtk.TreeViewDropPosition.INTO_OR_AFTER);\n           \n        this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);        \n        Gdk.drag_status(ctx, action ,time);\n        return true;\n        \n        // continue through to allow drop...\n\n    } \n        \n        \n\n    \n    \n    //print(\"ISOVER? \" + isOver);\n    if (!isOver) {\n  \n        Gdk.drag_status(ctx, 0 ,time);\n         this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);                    \n         return false;\n\n    }\n            \n    // drag node is parent of child..\n    //console.log(\"SRC TREEPATH: \" + src.treepath);\n    //console.log(\"TARGET TREEPATH: \" + data.path.to_string());\n    \n    // nned to check a  few here..\n    //Gtk.TreeViewDropPosition.INTO_OR_AFTER\n    //Gtk.TreeViewDropPosition.INTO_OR_BEFORE\n    //Gtk.TreeViewDropPosition.AFTER\n    //Gtk.TreeViewDropPosition.BEFORE\n    \n    // locally dragged items to not really use the \n    var selection_text = this.dragData;\n    \n            \n            \n    if (selection_text == null || selection_text.length < 1) {\n                //print(\"Error  - drag selection text returned NULL\");\n             Gdk.drag_status(ctx, 0 ,time);\n            this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);\n             return false;\n     }\n                       \n            \n            // see if we are dragging into ourself?\n    var target_path = path.to_string();            \n    print (\"Drag  %s onto %s--%d\\n \", selection_text, target_path, pos);\n    \n    // pos : 3 = ontop - 0 = after, 1 = before\n    //print(\"target_path=\"+target_path);\n\n    // \n    if (selection_text  == target_path) {\n        print(\"self drag ?? == we should perhaps allow copy onto self..\\n\");\n                \n         Gdk.drag_status(ctx, 0 ,time);\n          this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);\n          return false;\n//                 -- fixme -- this is not really correct..\n\n    }\n            \n    // check that \n    //print(\"DUMPING DATA\");\n    //console.dump(data);\n    // path, pos\n    \n    //print(data.path.to_string() +' => '+  data.pos);\n    \n    // dropList is a list of xtypes that this node could be dropped on.\n    // it is set up when we start to drag..\n    \n    \n    targetData = _this.model.findDropNodeByPath( path.to_string(), this.dropList, pos);\n        \n    print(\"targetDAta: \" + targetData +\"\\n\");\n    \n    if (targetData.length < 1) {\n        //print(\"Can not find drop node path\");\n       \n        Gdk.drag_status(ctx, 0, time);\n        this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);\n        return false;\n    }\n    \n    var td_ar = targetData.split(\"|\");\n      \n    \n\n    Gdk.drag_status(ctx, action ,time);\n    this.highlightDropPath(td_ar[0], (Gtk.TreeViewDropPosition)int.parse(td_ar[1]));\n    return true;\n       \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                \n                 GLib.Value value;\n                 _this.model.el.get_value(iter, 2, out value);\n                 var ndata = (JsRender.Node)(value.dup_object());\n                 var xname = ndata.fqn();\n                \n                \n                var tp = mod.get_path(iter).to_string();\n                // by default returns the path..\n                \n               if ( info != Gdk.Atom.intern(\"STRING\",true) ) {\n                    tp = ndata.toJsonString();\n               }   \n               \n               //data.set_text(tp,tp.length);   \n                \n                data.set (data.get_target (), 8, (uchar[]) tp.to_utf8 ());\n            \n                \n               //  print(\"return \" + tp);\n            }",
+                        "drag_data_received" : "  (ctx, x, y, sel, info, time)  => {\n  \n        // THIS CODE ONLY RELATES TO drag  or drop of \"NEW\" elements or \"FROM another tree..\"\n  \n  \n        //  print(\"Tree: drag-data-received\\n\");\n        var selection_text = (string)sel.get_data();\n        //print(\"selection_text= %s\\n\",selection_text);\n\n        var is_drag = this.drag_in_motion;\n    \n        \n\n        print(\"Is Drag %s\\n\", is_drag ? \"Y\": \"N\");\n        var  targetData = \"\";\n        \n        Gtk.TreePath path;\n        Gtk.TreeViewDropPosition pos;\n        var isOver = _this.view.el.get_dest_row_at_pos(this.drag_x,this.drag_y, out path, out pos);\n        \n        // if there are not items in the tree.. the we have to set isOver to true for anything..\n        var isEmpty = false;\n        if (_this.model.el.iter_n_children(null) < 1) {\n            print(\"got NO children?\\n\");\n            isOver = true; //??? \n            isEmpty = true;\n            pos = Gtk.TreeViewDropPosition.INTO_OR_AFTER;\n        }\n        \n     \n        //console.log(\"LEFT-TREE: drag-motion\");\n        var src = Gtk.drag_get_source_widget(ctx);\n        \n        // a drag from self - this should be handled by drop and motion.\n        if (src == this.el) {\n            print(\"Source == this element should not happen.. ? \\n\");\n            return;\n        }\n        //print(\"drag_data_recieved from another element\");\n        \n         \n        \n        \n        if (selection_text == null || selection_text.length < 1 || !isOver) {\n            // nothing valid foudn to drop...\n               print(\"empty sel text or not over\");\n            if (is_drag) {\n                Gdk.drag_status(ctx, 0, time);\n                this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);\n                return;\n            }\n            Gtk.drag_finish (ctx, false, false, time);        // drop failed..\n            // no drop action...\n            return;            \n        \n        }\n        var dropNode = new JsRender.Node(); \n        \n        var dropNodeType  = selection_text;\n        var show_templates = true;\n        // for drop\n        if (dropNodeType[0] == '{') {\n            var pa = new Json.Parser();\n            pa.load_from_data(dropNodeType);\n             \n            dropNode.loadFromJson( pa.get_root().get_object(), 2);\n            dropNodeType = dropNode.fqn();\n            show_templates = false;\n            \n            \n        } else {\n\n            dropNode.setFqn(selection_text);\n        }\n\n         \n        // dropList --- need to gather this ... \n        print(\"get dropList for : %s\\n\",dropNodeType);            \n        var dropList = _this.model.file.palete().getDropList(dropNodeType);\n        \n        print(\"dropList: %s\\n\", string.joinv(\" , \", dropList));\n        \n        // if drag action is link ... then we can drop it anywahere...\n         if ((ctx.get_actions() & Gdk.DragAction.LINK) > 0) {\n                 targetData = path.to_string() + \"|%d\".printf((int)pos);\n         } else {\n        \n        \n            targetData = _this.model.findDropNodeByPath( isEmpty ? \"\" : path.to_string(), dropList, pos);\n        }\n        \n        \n            \n        print(\"targetDAta: \" + targetData +\"\\n\");\n        \n        if (targetData.length < 1) {\n         \n            // invalid drop path..\n            if (this.drag_in_motion) {\n                Gdk.drag_status(ctx, 0, time);\n                this.highlightDropPath(\"\", (Gtk.TreeViewDropPosition)0);\n                return;\n            }\n            Gtk.drag_finish (ctx, false, false, time);        // drop failed..\n            // no drop action...\n            return;\n        }\n        // valid drop path..\n        \n          var td_ar = targetData.split(\"|\");\n          \n        \n        if (this.drag_in_motion) { \n            Gdk.drag_status(ctx, Gdk.DragAction.COPY ,time);\n\n            this.highlightDropPath(  td_ar[0]  , (Gtk.TreeViewDropPosition)int.parse(td_ar[1]));\n            return;\n        }\n        // continue on to allow drop..\n    \n\n        // at this point, drag is not in motion... -- as checked above... - so it's a real drop event..\n        \n\n        _this.model.dropNode(targetData, dropNode, show_templates);\n        print(\"ADD new node!!!\\n\");\n            \n        ///Xcls_DialogTemplateSelect.singleton().show( _this.model.file.palete(), node);\n        \n        Gtk.drag_finish (ctx, false, false,time);\n        \n        \n            \n            \n      \n}",
+                        "drag_drop" : " (  ctx, x, y, time)  => {\n      //Seed.print(\"TARGET: drag-drop\");\n   \n   \n    var src = Gtk.drag_get_source_widget(ctx);\n     \n   if (src != this.el) {\n   \n    \n       \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(\"application/json\",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     }\n     \n     // handle drop around self..\n     \n                  \n            \n    //print(\"GETTING POS\");\n    var  targetData = \"\";\n    \n    Gtk.TreePath path;\n    Gtk.TreeViewDropPosition pos;\n    var isOver = _this.view.el.get_dest_row_at_pos(this.drag_x,this.drag_y, out path, out pos);\n    \n    // if there are not items in the tree.. the we have to set isOver to true for anything..\n    var isEmpty = false;\n    if (_this.model.el.iter_n_children(null) < 1) {\n        print(\"got NO children?\\n\");\n        isOver = true; //??? \n        isEmpty = true;\n        pos = Gtk.TreeViewDropPosition.INTO_OR_AFTER;\n    }\n    \n     \n     \n    //var action = Gdk.DragAction.COPY;\n        // unless we are copying!!! ctl button..\n    \n    var action = (ctx.get_actions() & Gdk.DragAction.MOVE) > 0 ?\n                 Gdk.DragAction.COPY  : Gdk.DragAction.MOVE ;\n                // Gdk.DragAction.MOVE : Gdk.DragAction.COPY ;\n\n      \n    if (_this.model.el.iter_n_children(null) < 1) {\n        // no children.. -- asume it's ok..\n        \n        targetData = \"|%d|\".printf((int)Gtk.TreeViewDropPosition.INTO_OR_AFTER);\n         \n        // continue through to allow drop...\n\n    } else {\n                \n                \n    \n                \n                \n                //print(\"ISOVER? \" + isOver);\n        if (!isOver) {\n            \n            Gtk.drag_finish (ctx, false, false, time);        // drop failed..\n            return true; // not over apoint!?! - no action on drop or motion..\n        }\n                \n        // drag node is parent of child..\n        //console.log(\"SRC TREEPATH: \" + src.treepath);\n        //console.log(\"TARGET TREEPATH: \" + data.path.to_string());\n        \n        // nned to check a  few here..\n        //Gtk.TreeViewDropPosition.INTO_OR_AFTER\n        //Gtk.TreeViewDropPosition.INTO_OR_BEFORE\n        //Gtk.TreeViewDropPosition.AFTER\n        //Gtk.TreeViewDropPosition.BEFORE\n        \n        // locally dragged items to not really use the \n        var selection_text = this.dragData;\n        \n        \n        \n        if (selection_text == null || selection_text.length < 1) {\n            //print(\"Error  - drag selection text returned NULL\");\n          \n             Gtk.drag_finish (ctx, false, false, time);        // drop failed..\n             return true; /// -- fixme -- this is not really correct..\n        }                \n                \n                // see if we are dragging into ourself?\n                print (\"got selection text of  \" + selection_text);\n        \n        var target_path = path.to_string();\n        //print(\"target_path=\"+target_path);\n\n        // \n        if (selection_text  == target_path) {\n            print(\"self drag ?? == we should perhaps allow copy onto self..\\n\");\n            \n             Gtk.drag_finish (ctx, false, false, time);        // drop failed..\n\n             return true; /// -- fixme -- this is not really correct..\n\n        }\n                \n        // check that \n        //print(\"DUMPING DATA\");\n        //console.dump(data);\n        // path, pos\n        \n        //print(data.path.to_string() +' => '+  data.pos);\n        \n        // dropList is a list of xtypes that this node could be dropped on.\n        // it is set up when we start to drag..\n        \n        \n        targetData = _this.model.findDropNodeByPath( path.to_string(), this.dropList, pos);\n            \n        print(\"targetDAta: \" + targetData +\"\\n\");\n        \n        if (targetData.length < 1) {\n            //print(\"Can not find drop node path\");\n             \n            Gtk.drag_finish (ctx, false, false, time);        // drop failed..\n            return true;\n        }\n        \n        var td_ar = targetData.split(\"|\");\n                  \n                \n                \n                // continue on to allow drop..\n  }\n        // at this point, drag is not in motion... -- as checked above... - so it's a real drop event..\n\n\n     var delete_selection_data = false;\n        \n    if (action == Gdk.DragAction.ASK)  {\n        /* Ask the user to move or copy, then set the ctx action. */\n    }\n\n    if (action == Gdk.DragAction.MOVE) {\n        delete_selection_data = true;\n    }\n      \n                // drag around.. - reorder..\n    _this.model.moveNode(targetData, action);\n        \n       \n        \n        \n        \n        // we can send stuff to souce here...\n\n\n// do we always say failure, so we handle the reall drop?\n    Gtk.drag_finish (ctx, false, false,time); //delete_selection_data, time);\n\n    return true;\n \n \n \n \n \n \n}"
+                    },
+                    "# string dragData" : "",
+                    "# int drag_x" : "",
+                    "# string[] dropList" : "",
+                    "id" : "view",
+                    "gboolean headers_visible" : true,
+                    "# int drag_y" : "",
+                    "* init" : "{\n    var description = new Pango.FontDescription();\n    description.set_size(8000);\n    this.el.modify_font(description);\n\n    var selection = this.el.get_selection();\n    selection.set_mode( Gtk.SelectionMode.SINGLE);\n\n\n    // is this really needed??\n    /*\n    this.selection.signal['changed'].connect(function() {\n\t    _this.get('/LeftTree.view').listeners.cursor_changed.apply(\n\t        _this.get('/LeftTree.view'), [ _this.get('/LeftTree.view'), '']\n\t    );\n    });\n    */\n    Gtk.drag_source_set (\n\t    this.el,            /* widget will be drag-able */\n\t    Gdk.ModifierType.BUTTON1_MASK,       /* modifier that will start a drag */\n\t    Builder4.Application.targetList,            /* lists of target to support */\n\t    Gdk.DragAction.COPY   | Gdk.DragAction.MOVE    |  Gdk.DragAction.LINK           /* what to do with data after dropped */\n    );\n\n    // ?? needed??\n    //Gtk.drag_source_add_text_targets(this.el); \n\n    Gtk.drag_dest_set\n    (\n        this.el,              /* widget that will accept a drop */\n        Gtk.DestDefaults.MOTION  | Gtk.DestDefaults.HIGHLIGHT,\n        Builder4.Application.targetList,            /* lists of target to support */\n        Gdk.DragAction.COPY   | Gdk.DragAction.MOVE   | Gdk.DragAction.LINK     /* what to do with data after dropped */\n    );\n\n    //Gtk.drag_dest_set_target_list(this.el, Builder.Application.targetList);\n    //Gtk.drag_dest_add_text_targets(this.el);\n}\n",
+                    "tooltip_column" : 1,
+                    "* pack" : "add",
+                    "xtype" : "TreeView",
+                    "$ enable_tree_lines" : true,
+                    "$ headers_visible" : false,
+                    "|           void highlightDropPath" : " ( string treepath, Gtk.TreeViewDropPosition pos) {\n\n        // highlighting for drag/drop\n        if (treepath.length > 0) {\n            this.el.set_drag_dest_row(  new  Gtk.TreePath.from_string( treepath ), pos);\n          } else {\n            this.el.set_drag_dest_row(null, Gtk.TreeViewDropPosition.INTO_OR_AFTER);\n         }\n             \n}",
+                    "# bool drag_in_motion" : "",
+                    "# bool blockChanges" : false,
+                    "$ xns" : "Gtk",
+                    "|           void selectNode" : "(string treepath_str) {\n    //this.selection.select_path(new  Gtk.TreePath.from_string( treepath_str));\n     var tp = new Gtk.TreePath.from_string(treepath_str);\n     \n     this.el.set_cursor(tp, null, false);  \n     this.el.scroll_to_cell(tp, null, false, 0,0);\n}\n",
+                    "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",
+                            "currentTree" : false,
+                            "id" : "model",
+                            "# DialogTemplateSelect template_select" : "null",
+                            "* 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",
+                            "|    void updateSelected" : "() {\n  \n   \n    var s = _this.view.el.get_selection();\n    \n     Gtk.TreeIter iter;\n    Gtk.TreeModel mod;\n    \n    \n    \n    if (!s.get_selected(out mod, out iter)) {\n        return; // nothing seleted..\n    }\n  \n  GLib.Value value;\n    this.el.get_value(iter, 2, out value);\n    var node = (JsRender.Node)(value.get_object());\n    \n      this.el.set(iter, 0, node.nodeTitle(),\n                1, node.nodeTip(), -1\n        );\n}\n",
+                            "* pack" : "set_model",
+                            "xtype" : "TreeStore",
+                            "|           string findDropNodeByPath" : " (string treepath_str, string[] targets, int in_pref = -1) {\n\n    var path = treepath_str; // dupe it..\n    \n    \n    // pref : 3 = ontop - 0 = after, 1 = before\n    int pref = in_pref < 0  ?  Gtk.TreeViewDropPosition.INTO_OR_AFTER : in_pref;\n    \n    var last = \"\";\n    \n    //console.dump(this.treemap);\n    \n    print(\"findDropNodeByPath : got path length %d / %s\\n\", path.length, path);\n    \n    if (path.length == 0) {\n        // top drop. // just return empty..\n        return \"|%d\".printf((int)pref) ;\n        \n    }\n    \n    \n    while (path.length > 0) {\n    \n        if (path.length == treepath_str.length && pref != Gtk.TreeViewDropPosition.INTO_OR_AFTER) {\n            if (path.last_index_of(\":\") < 0 ) {\n                return \"\";\n            }\n            path = path.substring(0, path.last_index_of(\":\"));\n            last = treepath_str;\n            print(\"DROP  before or after : using %s\\n\",path);\n            continue;\n        }\n    \n        //print(\"LOOKING FOR PATH: \" + path);\n        var node_data = this.pathToNode(path);\n        \n        if (node_data == null) {\n            print(\"node not found\");\n            return \"\";\n        }\n        \n        var xname = node_data.fqn();\n        var match = \"\";\n        var prop = \"\";\n        \n        for (var i =0; i < targets.length; i++)  {\n            var tg = targets[i];\n            if ((tg == xname)  ) {\n                match = tg;\n                break;\n            }\n            // if target is \"xxxx:name\"\n            if (tg.contains(xname +\":\")) {\n                match = tg;\n                var ar = tg.split(\":\");\n                prop = ar[1];\n                break;\n            }\n        }\n        \n        if (match.length > 0) {\n            if (last.length > 0) { // pref is after/before..\n                // then it's after last\n                //if (pref > 1) {\n                //    return \"\";\n                //}\n                return last + \"|%d\".printf((int)pref) + \"|\" + prop;\n\n                \n            }\n            return path + \"|%d\".printf( (int) Gtk.TreeViewDropPosition.INTO_OR_AFTER);// + \"|\" + prop;\n        }\n        /*\n        last = \"\" + path;\n        var par = path.split(\":\");\n        string [] ppar = {};\n        for (var i = 0; i < par.length-1; i++) {\n            ppar += par[i];\n        }\n        \n        path = string.joinv(\":\", ppar);\n        */\n        break;\n\n    }\n    \n    return \"\";\n            \n}\n",
+                            "|           void moveNode" : "(string target_data, Gdk.DragAction action) \n{\n   \n   /// target_data = \"path|pos\");\n   \n   \n    //print(\"MOVE NODE\");\n    // console.dump(target_data);\n    Gtk.TreeIter old_iter;\n    Gtk.TreeModel mod;\n    \n    var s = _this.view.el.get_selection();\n    s.get_selected(out mod , out old_iter);\n    mod.get_path(old_iter);\n    \n    var node = this.pathToNode(mod.get_path(old_iter).to_string());\n    //console.dump(node);\n    if (node == null) {\n        print(\"moveNode: ERROR - node is null?\");\n    }\n    \n    \n\n    // needs to drop first, otherwise the target_data \n    // treepath will be invalid.\n\n    \n    if ((action & Gdk.DragAction.MOVE) > 0) {\n            print(\"REMOVING OLD NODE : \" + target_data + \"\\n\");\n            node.remove();\n            this.dropNode(target_data, node, false);\n            this.el.remove(ref old_iter);\n            \n            \n                         \n    } else {\n        print(\"DROPPING NODE // copy: \" + target_data + \"\\n\");\n        node = node.deepClone();\n        this.dropNode(target_data, node, false);\n    }\n    _this.changed();\n    this.activePath= \"\";\n    //this.updateNode(false,true);\n}\n",
+                            "# string activePath" : "\"\"",
+                            "$ columns" : "typeof(string),typeof(string),typeof(Object)",
+                            "|           void load" : "(Gee.ArrayList<JsRender.Node> tr, Gtk.TreeIter? iter) \n{\n    Gtk.TreeIter citer;\n    //this.insert(citer,iter,0);\n    for(var i =0 ; i < tr.size; i++) {\n        if (iter != null) {\n            this.el.insert(out citer,iter,-1); // why not append?\n        } else {\n            this.el.append(out citer,null);\n        }\n        \n        this.el.set(citer, 0, tr.get(i).nodeTitle(),\n                1, tr.get(i).nodeTip(), -1\n        );\n        var o = new GLib.Value(typeof(Object));\n        o.set_object((Object)tr.get(i));\n        \n        this.el.set_value(citer, 2, o);\n        \n        if (tr.get(i).items.size > 0) {\n            this.load(tr.get(i).items, citer);\n        }\n     \n    }\n\n    \n}",
+                            "|           void deleteSelected" : "() {\n    \n    print(\"DELETE SELECTED?\");\n    //_this.view.blockChanges = true;\n    print(\"GET SELECTION?\");\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      \n\n\n    this.activePath= \"\";      \n    print(\"GET  vnode value?\");\n\n    GLib.Value value;\n    this.el.get_value(iter, 2, out value);\n    var data = (JsRender.Node)(value.get_object());\n    print(\"removing node from Render\\n\");\n    if (data.parent == null) {\n        this.file.tree = null;\n    } else {\n        data.remove();\n    }\n    print(\"removing node from Tree\\n\");    \n    s.unselect_all();\n    this.el.remove(ref iter);\n\n    \n    \n    \n    // \n    \n    \n\n\n    this.activePath= \"\"; // again!?!?      \n    //this.changed(null,true);\n    \n    _this.changed();\n    \n    _this.view.blockChanges = false;\n}\n",
+                            "# Project.Project? project" : "null",
+                            "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         \n            if (this.template_select == null) {\n                this.template_select = new DialogTemplateSelect();\n             }\n         \n             var new_node = this.template_select.show(\n                  (Gtk.Window) _this.el.get_toplevel (),\n                      this.file.palete(),\n                   node);\n                   \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"
+                        },
+                        {
+                            "utf8 title" : "test",
+                            "* init" : "  this.el.add_attribute(_this.renderer.el , \"markup\", 0 );\n ",
+                            "xtype" : "TreeViewColumn",
+                            "* pack" : "append_column",
+                            "$ xns" : "Gtk",
+                            "items" : [
+                                {
+                                    "id" : "renderer",
+                                    "xtype" : "CellRendererText",
+                                    "* pack" : "pack_start,true",
+                                    "$ xns" : "Gtk"
+                                }
+                            ]
+                        }
+                    ]
+                },
+                {
+                    "id" : "LeftTreeMenu",
+                    "xtype" : "Menu",
+                    "* pack" : false,
+                    "$ xns" : "Gtk",
+                    "items" : [
+                        {
+                            "listeners" : {
+                                "activate" : "  ( ) => {\n    \n    print(\"ACTIVATE?\");\n    \n  \n     _this.model.deleteSelected();\n}"
+                            },
+                            "label" : "Delete Element",
+                            "xtype" : "MenuItem",
+                            "* pack" : "add",
+                            "$ xns" : "Gtk"
+                        },
+                        {
+                            "listeners" : {
+                                "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",
+                            "xtype" : "MenuItem",
+                            "* pack" : "add",
+                            "$ xns" : "Gtk"
+                        },
+                        {
+                            "listeners" : {
+                                "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",
+                            "xtype" : "MenuItem",
+                            "* pack" : "add",
+                            "$ xns" : "Gtk"
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/WindowLeftTree.vala b/old-javascript/Builder4/WindowLeftTree.vala
new file mode 100644 (file)
index 0000000..8018e8e
--- /dev/null
@@ -0,0 +1,1566 @@
+static Xcls_WindowLeftTree  _WindowLeftTree;
+
+public class Xcls_WindowLeftTree : Object 
+{
+    public Gtk.ScrolledWindow el;
+    private Xcls_WindowLeftTree  _this;
+
+    public static Xcls_WindowLeftTree singleton()
+    {
+        if (_WindowLeftTree == null) {
+            _WindowLeftTree= new Xcls_WindowLeftTree();
+        }
+        return _WindowLeftTree;
+    }
+    public Xcls_view view;
+    public Xcls_model model;
+    public Xcls_renderer renderer;
+    public Xcls_LeftTreeMenu LeftTreeMenu;
+
+        // my vars (def)
+    public signal bool before_node_change (JsRender.Node? node);
+    public signal void changed ();
+    public signal void node_selected (JsRender.Node? node);
+    public Xcls_MainWindow main_window;
+
+    // ctor 
+    public Xcls_WindowLeftTree()
+    {
+        _this = this;
+        this.el = new Gtk.ScrolledWindow( null, null );
+
+        // my vars (dec)
+        this.main_window = null;
+
+        // set gobject values
+        this.el.shadow_type = Gtk.ShadowType.IN;
+        var child_0 = new Xcls_view( _this );
+        child_0.ref();
+        this.el.add (  child_0.el  );
+        var child_1 = new Xcls_LeftTreeMenu( _this );
+        child_1.ref();
+
+        // init method 
+
+        this.el.set_policy (Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);    }
+
+    // user defined functions 
+    public           JsRender.Node? getActiveElement () { // return path to actie node.
+    
+         var path = this.getActivePath();
+         if (path.length < 1) {
+            return null;
+         }
+         return _this.model.pathToNode(path);
+         
+    }
+    public           JsRender.JsRender getActiveFile () {
+        return this.model.file;
+    }
+    public           string getActivePath () {
+        var model = this.model;
+        var view = this.view.el;
+        if (view.get_selection().count_selected_rows() < 1) {
+            return "";
+        }
+        Gtk.TreeIter iter;
+        Gtk.TreeModel mod;
+        view.get_selection().get_selected(out mod, out iter);
+        return mod.get_path(iter).to_string();
+    }
+    public class Xcls_view : Object 
+    {
+        public Gtk.TreeView el;
+        private Xcls_WindowLeftTree  _this;
+
+
+            // my vars (def)
+        public string dragData;
+        public int drag_x;
+        public string[] dropList;
+        public int drag_y;
+        public bool drag_in_motion;
+        public bool blockChanges;
+
+        // ctor 
+        public Xcls_view(Xcls_WindowLeftTree _owner )
+        {
+            _this = _owner;
+            _this.view = this;
+            this.el = new Gtk.TreeView();
+
+            // my vars (dec)
+            this.blockChanges = false;
+
+            // set gobject values
+            this.el.tooltip_column = 1;
+            this.el.enable_tree_lines = true;
+            this.el.headers_visible = false;
+            var child_0 = new Xcls_model( _this );
+            child_0.ref();
+            this.el.set_model (  child_0.el  );
+            var child_1 = new Xcls_TreeViewColumn4( _this );
+            child_1.ref();
+            this.el.append_column (  child_1.el  );
+
+            // init method 
+
+            {
+                var description = new Pango.FontDescription();
+                description.set_size(8000);
+                this.el.modify_font(description);
+            
+                var selection = this.el.get_selection();
+                selection.set_mode( Gtk.SelectionMode.SINGLE);
+            
+            
+                // is this really needed??
+                /*
+                this.selection.signal['changed'].connect(function() {
+                   _this.get('/LeftTree.view').listeners.cursor_changed.apply(
+                       _this.get('/LeftTree.view'), [ _this.get('/LeftTree.view'), '']
+                   );
+                });
+                */
+                Gtk.drag_source_set (
+                   this.el,            /* widget will be drag-able */
+                   Gdk.ModifierType.BUTTON1_MASK,       /* modifier that will start a drag */
+                   Builder4.Application.targetList,            /* lists of target to support */
+                   Gdk.DragAction.COPY   | Gdk.DragAction.MOVE    |  Gdk.DragAction.LINK           /* what to do with data after dropped */
+                );
+            
+                // ?? needed??
+                //Gtk.drag_source_add_text_targets(this.el); 
+            
+                Gtk.drag_dest_set
+                (
+                    this.el,              /* widget that will accept a drop */
+                    Gtk.DestDefaults.MOTION  | Gtk.DestDefaults.HIGHLIGHT,
+                    Builder4.Application.targetList,            /* lists of target to support */
+                    Gdk.DragAction.COPY   | Gdk.DragAction.MOVE   | Gdk.DragAction.LINK     /* what to do with data after dropped */
+                );
+            
+                //Gtk.drag_dest_set_target_list(this.el, Builder.Application.targetList);
+                //Gtk.drag_dest_add_text_targets(this.el);
+            }
+            // listeners 
+            this.el.button_press_event.connect( ( ev) => {
+                //console.log("button press?");
+                if (! _this.before_node_change(null) ) {
+                   return true;
+                }
+            
+                
+                if (ev.type != Gdk.EventType.BUTTON_PRESS  || ev.button != 3) {
+                    //print("click" + ev.type);
+                    return false;
+                }
+                Gtk.TreePath res;
+                if (!_this.view.el.get_path_at_pos((int)ev.x,(int)ev.y, out res, null, null, null) ) {
+                    return true;
+                }
+                 
+                this.el.get_selection().select_path(res);
+                 
+                  //if (!this.get('/LeftTreeMenu').el)  { 
+                  //      this.get('/LeftTreeMenu').init(); 
+                  //  }
+                    
+                 _this.LeftTreeMenu.el.set_screen(Gdk.Screen.get_default());
+                 _this.LeftTreeMenu.el.show_all();
+                  _this.LeftTreeMenu.el.popup(null, null, null,  3, ev.time);
+                 //   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 tp = mod.get_path(iter).to_string();
+                    var data = (JsRender.Node)(value.dup_object());
+                    var xname = data.fqn();
+                    print ("XNAME  IS " + xname+ "\n");
+                    this.dragData = tp;
+                    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
+                
+                    
+                // by default returns the path..
+                   var path = _this.model.el.get_path(iter);
+            
+                     
+                    var pix = this.el.create_row_drag_icon ( path);
+                    
+                    Gtk.drag_set_icon_surface (ctx, pix) ;
+                    
+                    return;
+            });
+            this.el.cursor_changed.connect( ( ) => {
+            
+            
+                 if (this.blockChanges) { // probably not needed.. 
+                   return  ;
+                 }
+                  if (!_this.before_node_change(null) ) {
+                    this.blockChanges = true;
+                    this.el.get_selection().unselect_all();
+                    this.blockChanges = false;
+                    return;
+                 }
+                 if (_this.model.file == null) {
+                     return;
+                 } 
+                 
+                 //var render = this.get('/LeftTree').getRenderer();                
+                print("LEFT TREE -> view -> selection changed called\n");
+                
+                
+                // -- it appears that the selection is not updated.
+                
+                GLib.Timeout.add_full(GLib.Priority.DEFAULT,10 , () => {
+                     
+            
+                        if (this.el.get_selection().count_selected_rows() < 1) {
+            
+                            print("selected rows < 1\n");
+                            //??this.model.load( false);
+                            _this.node_selected(null);
+                            
+                            return false ;
+                        }
+                            
+                            //console.log('changed');
+                        var s = this.el.get_selection();
+                         Gtk.TreeIter iter;
+                         Gtk.TreeModel mod;
+                        s.get_selected(out mod, out iter);
+                        
+                        
+                        // var val = "";
+                        GLib.Value value;
+                        _this.model.el.get_value(iter, 2, out value);
+                        _this.model.activePath = mod.get_path(iter).to_string();
+                        
+                        var node = (JsRender.Node)value.dup_object();
+                        _this.node_selected(node);
+                        return false;
+                  });  
+                //_this.after_node_change(node);
+            
+            //        _this.model.file.changed(node, "tree");
+               
+                //Seed.print( value.get_string());
+                return  ;
+                            
+            });
+            this.el.drag_end.connect( (drag_context) => {
+               //Seed.print('LEFT-TREE: drag-end');
+                    this.dragData = "";
+                    this.dropList = null;
+            //        this.targetData = "";
+                    this.highlightDropPath("",0);
+            //        return true;
+            });
+            this.el.drag_motion.connect( ( ctx, x, y, time)  => {
+               print("got drag motion\n");
+                var src = Gtk.drag_get_source_widget(ctx);
+               this.drag_x = x;
+               this.drag_y = y;     
+            
+               if (src != this.el) {
+               
+             
+             
+                // the point of this is to detect where an item could be dropped..
+                    print("requesting drag data\n");
+                   this.drag_in_motion = true;
+                   
+                        // request data that will be recieved by the recieve...              
+                    Gtk.drag_get_data
+                    (
+                            this.el,         // will receive 'drag-data-received' signal 
+                            ctx,        // represents the current state of the DnD 
+                            Gdk.Atom.intern("STRING",true),    // the target type we want 
+                            time            // time stamp 
+                    );
+                    return true;
+              }    
+            
+            
+              print("action: %d\n", ctx.get_actions());
+             //print("GETTING POS");
+                var  targetData = "";
+            
+                Gtk.TreePath path;
+                Gtk.TreeViewDropPosition pos;
+                var isOver = _this.view.el.get_dest_row_at_pos(this.drag_x,this.drag_y, out path, out pos);
+            
+                // if there are not items in the tree.. the we have to set isOver to true for anything..
+                var isEmpty = false;
+                if (_this.model.el.iter_n_children(null) < 1) {
+                    print("got NO children?\n");
+                    isOver = true; //??? 
+                    isEmpty = true;
+                    pos = Gtk.TreeViewDropPosition.INTO_OR_AFTER;
+                }
+            
+            
+                // ------------- a drag from self..
+            
+            
+                //var action = Gdk.DragAction.COPY;
+                    // unless we are copying!!! ctl button..
+                
+                var action = (ctx.get_actions() & Gdk.DragAction.MOVE) > 0 ?
+                             Gdk.DragAction.COPY  : Gdk.DragAction.MOVE ;
+                            // Gdk.DragAction.MOVE : Gdk.DragAction.COPY ;
+            
+            
+                if (_this.model.el.iter_n_children(null) < 1) {
+                    // no children.. -- asume it's ok..
+                    
+                    targetData = "|%d|".printf((int)Gtk.TreeViewDropPosition.INTO_OR_AFTER);
+                       
+                    this.highlightDropPath("", (Gtk.TreeViewDropPosition)0);        
+                    Gdk.drag_status(ctx, action ,time);
+                    return true;
+                    
+                    // continue through to allow drop...
+            
+                } 
+                    
+                    
+            
+                
+                
+                //print("ISOVER? " + isOver);
+                if (!isOver) {
+              
+                    Gdk.drag_status(ctx, 0 ,time);
+                     this.highlightDropPath("", (Gtk.TreeViewDropPosition)0);                    
+                     return false;
+            
+                }
+                        
+                // drag node is parent of child..
+                //console.log("SRC TREEPATH: " + src.treepath);
+                //console.log("TARGET TREEPATH: " + data.path.to_string());
+                
+                // nned to check a  few here..
+                //Gtk.TreeViewDropPosition.INTO_OR_AFTER
+                //Gtk.TreeViewDropPosition.INTO_OR_BEFORE
+                //Gtk.TreeViewDropPosition.AFTER
+                //Gtk.TreeViewDropPosition.BEFORE
+                
+                // locally dragged items to not really use the 
+                var selection_text = this.dragData;
+                
+                        
+                        
+                if (selection_text == null || selection_text.length < 1) {
+                            //print("Error  - drag selection text returned NULL");
+                         Gdk.drag_status(ctx, 0 ,time);
+                        this.highlightDropPath("", (Gtk.TreeViewDropPosition)0);
+                         return false;
+                 }
+                                   
+                        
+                        // see if we are dragging into ourself?
+                var target_path = path.to_string();            
+                print ("Drag  %s onto %s--%d\n ", selection_text, target_path, pos);
+                
+                // pos : 3 = ontop - 0 = after, 1 = before
+                //print("target_path="+target_path);
+            
+                // 
+                if (selection_text  == target_path) {
+                    print("self drag ?? == we should perhaps allow copy onto self..\n");
+                            
+                     Gdk.drag_status(ctx, 0 ,time);
+                      this.highlightDropPath("", (Gtk.TreeViewDropPosition)0);
+                      return false;
+            //                 -- fixme -- this is not really correct..
+            
+                }
+                        
+                // check that 
+                //print("DUMPING DATA");
+                //console.dump(data);
+                // path, pos
+                
+                //print(data.path.to_string() +' => '+  data.pos);
+                
+                // dropList is a list of xtypes that this node could be dropped on.
+                // it is set up when we start to drag..
+                
+                
+                targetData = _this.model.findDropNodeByPath( path.to_string(), this.dropList, pos);
+                    
+                print("targetDAta: " + targetData +"\n");
+                
+                if (targetData.length < 1) {
+                    //print("Can not find drop node path");
+                   
+                    Gdk.drag_status(ctx, 0, time);
+                    this.highlightDropPath("", (Gtk.TreeViewDropPosition)0);
+                    return false;
+                }
+                
+                var td_ar = targetData.split("|");
+                  
+                
+            
+                Gdk.drag_status(ctx, action ,time);
+                this.highlightDropPath(td_ar[0], (Gtk.TreeViewDropPosition)int.parse(td_ar[1]));
+                return true;
+                   
+                   
+            });
+            this.el.drag_data_get.connect( ( drag_context, data, info, time) => {
+                        
+                        
+                             //print("drag-data-get");
+                             var s = this.el.get_selection();
+                             if (s.count_selected_rows() < 1) {
+                                    data.set_text("",0);     
+                                     print("return empty string - no selection..");
+                                    return;
+                                }
+                             
+                             Gtk.TreeIter iter;
+                             Gtk.TreeModel mod;
+                             
+                             s.get_selected(out mod, out iter);
+                             
+                            
+                            
+                             GLib.Value value;
+                             _this.model.el.get_value(iter, 2, out value);
+                             var ndata = (JsRender.Node)(value.dup_object());
+                             var xname = ndata.fqn();
+                            
+                            
+                            var tp = mod.get_path(iter).to_string();
+                            // by default returns the path..
+                            
+                           if ( info != Gdk.Atom.intern("STRING",true) ) {
+                                tp = ndata.toJsonString();
+                           }   
+                           
+                           //data.set_text(tp,tp.length);   
+                            
+                            data.set (data.get_target (), 8, (uchar[]) tp.to_utf8 ());
+                        
+                            
+                           //  print("return " + tp);
+                        });
+            this.el.drag_data_received.connect( (ctx, x, y, sel, info, time)  => {
+              
+                    // THIS CODE ONLY RELATES TO drag  or drop of "NEW" elements or "FROM another tree.."
+              
+              
+                    //  print("Tree: drag-data-received\n");
+                    var selection_text = (string)sel.get_data();
+                    //print("selection_text= %s\n",selection_text);
+            
+                    var is_drag = this.drag_in_motion;
+                
+                    
+            
+                    print("Is Drag %s\n", is_drag ? "Y": "N");
+                    var  targetData = "";
+                    
+                    Gtk.TreePath path;
+                    Gtk.TreeViewDropPosition pos;
+                    var isOver = _this.view.el.get_dest_row_at_pos(this.drag_x,this.drag_y, out path, out pos);
+                    
+                    // if there are not items in the tree.. the we have to set isOver to true for anything..
+                    var isEmpty = false;
+                    if (_this.model.el.iter_n_children(null) < 1) {
+                        print("got NO children?\n");
+                        isOver = true; //??? 
+                        isEmpty = true;
+                        pos = Gtk.TreeViewDropPosition.INTO_OR_AFTER;
+                    }
+                    
+                 
+                    //console.log("LEFT-TREE: drag-motion");
+                    var src = Gtk.drag_get_source_widget(ctx);
+                    
+                    // a drag from self - this should be handled by drop and motion.
+                    if (src == this.el) {
+                        print("Source == this element should not happen.. ? \n");
+                        return;
+                    }
+                    //print("drag_data_recieved from another element");
+                    
+                     
+                    
+                    
+                    if (selection_text == null || selection_text.length < 1 || !isOver) {
+                        // nothing valid foudn to drop...
+                           print("empty sel text or not over");
+                        if (is_drag) {
+                            Gdk.drag_status(ctx, 0, time);
+                            this.highlightDropPath("", (Gtk.TreeViewDropPosition)0);
+                            return;
+                        }
+                        Gtk.drag_finish (ctx, false, false, time);        // drop failed..
+                        // no drop action...
+                        return;            
+                    
+                    }
+                    var dropNode = new JsRender.Node(); 
+                    
+                    var dropNodeType  = selection_text;
+                    var show_templates = true;
+                    // for drop
+                    if (dropNodeType[0] == '{') {
+                        var pa = new Json.Parser();
+                        pa.load_from_data(dropNodeType);
+                         
+                        dropNode.loadFromJson( pa.get_root().get_object(), 2);
+                        dropNodeType = dropNode.fqn();
+                        show_templates = false;
+                        
+                        
+                    } else {
+            
+                        dropNode.setFqn(selection_text);
+                    }
+            
+                     
+                    // dropList --- need to gather this ... 
+                    print("get dropList for : %s\n",dropNodeType);            
+                    var dropList = _this.model.file.palete().getDropList(dropNodeType);
+                    
+                    print("dropList: %s\n", string.joinv(" , ", dropList));
+                    
+                    // if drag action is link ... then we can drop it anywahere...
+                     if ((ctx.get_actions() & Gdk.DragAction.LINK) > 0) {
+                             targetData = path.to_string() + "|%d".printf((int)pos);
+                     } else {
+                    
+                    
+                        targetData = _this.model.findDropNodeByPath( isEmpty ? "" : path.to_string(), dropList, pos);
+                    }
+                    
+                    
+                        
+                    print("targetDAta: " + targetData +"\n");
+                    
+                    if (targetData.length < 1) {
+                     
+                        // invalid drop path..
+                        if (this.drag_in_motion) {
+                            Gdk.drag_status(ctx, 0, time);
+                            this.highlightDropPath("", (Gtk.TreeViewDropPosition)0);
+                            return;
+                        }
+                        Gtk.drag_finish (ctx, false, false, time);        // drop failed..
+                        // no drop action...
+                        return;
+                    }
+                    // valid drop path..
+                    
+                      var td_ar = targetData.split("|");
+                      
+                    
+                    if (this.drag_in_motion) { 
+                        Gdk.drag_status(ctx, Gdk.DragAction.COPY ,time);
+            
+                        this.highlightDropPath(  td_ar[0]  , (Gtk.TreeViewDropPosition)int.parse(td_ar[1]));
+                        return;
+                    }
+                    // continue on to allow drop..
+                
+            
+                    // at this point, drag is not in motion... -- as checked above... - so it's a real drop event..
+                    
+            
+                    _this.model.dropNode(targetData, dropNode, show_templates);
+                    print("ADD new node!!!\n");
+                        
+                    ///Xcls_DialogTemplateSelect.singleton().show( _this.model.file.palete(), node);
+                    
+                    Gtk.drag_finish (ctx, false, false,time);
+                    
+                    
+                        
+                        
+                  
+            });
+            this.el.drag_drop.connect( (  ctx, x, y, time)  => {
+                  //Seed.print("TARGET: drag-drop");
+               
+               
+                var src = Gtk.drag_get_source_widget(ctx);
+                 
+               if (src != this.el) {
+               
+                
+                   
+                   this.drag_in_motion = false;   
+                        // request data that will be recieved by the recieve...              
+                    Gtk.drag_get_data
+                    (
+                            this.el,         // will receive 'drag-data-received' signal 
+                            ctx,        // represents the current state of the DnD 
+                            Gdk.Atom.intern("application/json",true),    // the target type we want 
+                            time            // time stamp 
+                    );
+            
+                     
+                    // No target offered by source => error
+               
+            
+                     return  false;
+                 }
+                 
+                 // handle drop around self..
+                 
+                              
+                        
+                //print("GETTING POS");
+                var  targetData = "";
+                
+                Gtk.TreePath path;
+                Gtk.TreeViewDropPosition pos;
+                var isOver = _this.view.el.get_dest_row_at_pos(this.drag_x,this.drag_y, out path, out pos);
+                
+                // if there are not items in the tree.. the we have to set isOver to true for anything..
+                var isEmpty = false;
+                if (_this.model.el.iter_n_children(null) < 1) {
+                    print("got NO children?\n");
+                    isOver = true; //??? 
+                    isEmpty = true;
+                    pos = Gtk.TreeViewDropPosition.INTO_OR_AFTER;
+                }
+                
+                 
+                 
+                //var action = Gdk.DragAction.COPY;
+                    // unless we are copying!!! ctl button..
+                
+                var action = (ctx.get_actions() & Gdk.DragAction.MOVE) > 0 ?
+                             Gdk.DragAction.COPY  : Gdk.DragAction.MOVE ;
+                            // Gdk.DragAction.MOVE : Gdk.DragAction.COPY ;
+            
+                  
+                if (_this.model.el.iter_n_children(null) < 1) {
+                    // no children.. -- asume it's ok..
+                    
+                    targetData = "|%d|".printf((int)Gtk.TreeViewDropPosition.INTO_OR_AFTER);
+                     
+                    // continue through to allow drop...
+            
+                } else {
+                            
+                            
+                
+                            
+                            
+                            //print("ISOVER? " + isOver);
+                    if (!isOver) {
+                        
+                        Gtk.drag_finish (ctx, false, false, time);        // drop failed..
+                        return true; // not over apoint!?! - no action on drop or motion..
+                    }
+                            
+                    // drag node is parent of child..
+                    //console.log("SRC TREEPATH: " + src.treepath);
+                    //console.log("TARGET TREEPATH: " + data.path.to_string());
+                    
+                    // nned to check a  few here..
+                    //Gtk.TreeViewDropPosition.INTO_OR_AFTER
+                    //Gtk.TreeViewDropPosition.INTO_OR_BEFORE
+                    //Gtk.TreeViewDropPosition.AFTER
+                    //Gtk.TreeViewDropPosition.BEFORE
+                    
+                    // locally dragged items to not really use the 
+                    var selection_text = this.dragData;
+                    
+                    
+                    
+                    if (selection_text == null || selection_text.length < 1) {
+                        //print("Error  - drag selection text returned NULL");
+                      
+                         Gtk.drag_finish (ctx, false, false, time);        // drop failed..
+                         return true; /// -- fixme -- this is not really correct..
+                    }                
+                            
+                            // see if we are dragging into ourself?
+                            print ("got selection text of  " + selection_text);
+                    
+                    var target_path = path.to_string();
+                    //print("target_path="+target_path);
+            
+                    // 
+                    if (selection_text  == target_path) {
+                        print("self drag ?? == we should perhaps allow copy onto self..\n");
+                        
+                         Gtk.drag_finish (ctx, false, false, time);        // drop failed..
+            
+                         return true; /// -- fixme -- this is not really correct..
+            
+                    }
+                            
+                    // check that 
+                    //print("DUMPING DATA");
+                    //console.dump(data);
+                    // path, pos
+                    
+                    //print(data.path.to_string() +' => '+  data.pos);
+                    
+                    // dropList is a list of xtypes that this node could be dropped on.
+                    // it is set up when we start to drag..
+                    
+                    
+                    targetData = _this.model.findDropNodeByPath( path.to_string(), this.dropList, pos);
+                        
+                    print("targetDAta: " + targetData +"\n");
+                    
+                    if (targetData.length < 1) {
+                        //print("Can not find drop node path");
+                         
+                        Gtk.drag_finish (ctx, false, false, time);        // drop failed..
+                        return true;
+                    }
+                    
+                    var td_ar = targetData.split("|");
+                              
+                            
+                            
+                            // continue on to allow drop..
+              }
+                    // at this point, drag is not in motion... -- as checked above... - so it's a real drop event..
+            
+            
+                 var delete_selection_data = false;
+                    
+                if (action == Gdk.DragAction.ASK)  {
+                    /* Ask the user to move or copy, then set the ctx action. */
+                }
+            
+                if (action == Gdk.DragAction.MOVE) {
+                    delete_selection_data = true;
+                }
+                  
+                            // drag around.. - reorder..
+                _this.model.moveNode(targetData, action);
+                    
+                   
+                    
+                    
+                    
+                    // we can send stuff to souce here...
+            
+            
+            // do we always say failure, so we handle the reall drop?
+                Gtk.drag_finish (ctx, false, false,time); //delete_selection_data, time);
+            
+                return true;
+             
+             
+             
+             
+             
+             
+            });
+        }
+
+        // user defined functions 
+        public           void highlightDropPath ( string treepath, Gtk.TreeViewDropPosition pos) {
+        
+                // highlighting for drag/drop
+                if (treepath.length > 0) {
+                    this.el.set_drag_dest_row(  new  Gtk.TreePath.from_string( treepath ), pos);
+                  } else {
+                    this.el.set_drag_dest_row(null, Gtk.TreeViewDropPosition.INTO_OR_AFTER);
+                 }
+                     
+        }
+        public           void selectNode (string treepath_str) {
+            //this.selection.select_path(new  Gtk.TreePath.from_string( treepath_str));
+             var tp = new Gtk.TreePath.from_string(treepath_str);
+             
+             this.el.set_cursor(tp, null, false);  
+             this.el.scroll_to_cell(tp, null, false, 0,0);
+        }
+    }
+    public class Xcls_model : Object 
+    {
+        public Gtk.TreeStore el;
+        private Xcls_WindowLeftTree  _this;
+
+
+            // my vars (def)
+        public DialogTemplateSelect template_select;
+        public JsRender.JsRender? file;
+        public string activePath;
+        public Project.Project? project;
+
+        // ctor 
+        public Xcls_model(Xcls_WindowLeftTree _owner )
+        {
+            _this = _owner;
+            _this.model = this;
+            this.el = new Gtk.TreeStore( 3, typeof(string),typeof(string),typeof(Object) );
+
+            // my vars (dec)
+            this.template_select = null;
+            this.file = null;
+            this.activePath = "";
+            this.project = null;
+
+            // set gobject values
+
+            // init method 
+
+            print("model initialized");        }
+
+        // user defined functions 
+        public           string findDropNode (string treepath_str, string[] targets) {
+        
+            // this is used by the dragdrop code in the roo version AFAIR..
+        
+            //var path = treepath_str.replace(/^builder-/, '');
+            // treemap is depreciated... - should really check if model has any entries..
+        
+            if (this.el.iter_n_children(null) < 1) {
+                //print("NO KEYS");
+                return "|%d".printf((int)Gtk.TreeViewDropPosition.INTO_OR_AFTER);
+            }
+            //print("FIND treepath: " + path);
+            //console.dump(this.treemap);
+            
+            //if (!treepath_str.match(/^builder-/)) {
+            //    return []; // nothing!
+            //}
+            if (targets.length > 0 && targets[0] == "*") {
+                return  treepath_str;
+            }
+            return this.findDropNodeByPath(treepath_str,targets, -1);
+        }
+        public           void loadFile (JsRender.JsRender f) {
+            //console.dump(f);
+            this.el.clear();
+            this.file = f;
+            
+            
+        //    if (!f) {
+        //        console.log('missing file');
+        //        return;
+        //    }
+            
+            // load the file if not loaded..
+            if (f.tree == null) {
+                f.loadItems( );
+            }
+            // if it's still null?
+            if (f.tree == null) {
+                return;
+            }
+            
+            /// this.get('/Window').setTitle(f.project.getName() + ' - ' + f.name);
+            
+            //if (f.items.length && typeof(f.items[0]) == 'string') {
+            
+                //this.get('/RightEditor').el.show();
+                //this.get('/RightEditor.view').load( f.items[0]);
+            //    return;
+            //}
+            //print("LOAD");
+            //print(JSON.stringify(f.items, null,4));
+            //console.dump(f.items);
+            var o = new Gee.ArrayList<JsRender.Node>();
+            o.add(f.tree);
+            this.load(o,null);
+            
+            _this.view.el.expand_all();
+        
+            if (f.tree.items.size < 1) {
+                // single item..
+                
+                //this.get('/Window.leftvpaned').el.set_position(80);
+                // select first...
+                _this.view.el.set_cursor( 
+                    new  Gtk.TreePath.from_string("0"), null, false);
+                
+                
+            } else {
+                  //this.get('/Window.leftvpaned').el.set_position(200);
+            }
+            
+            return;
+            /*    
+            
+            //print("hide right editior");
+            //this.get('/RightEditor').el.hide();
+            //this.get('/Editor').el.hide();
+            //print("set current tree");
+            //this.currentTree = this.toJS(false, false)[0];
+            //console.dump(this.currentTree);
+            //this.currentTree = this.currentTree || { items: [] };
+            //_this.renderView();
+            //console.dump(this.map);
+            //var RightPalete     = imports.Builder.RightPalete.RightPalete;
+            
+            
+            var pm = this.get('/RightPalete.model');
+            // set up provider..
+            
+            this.get('/RightPalete').provider = this.get('/LeftTree').getPaleteProvider();
+            
+            if (!this.get('/RightPalete').provider) {
+                print ("********* PALETE PROVIDER MISSING?!!");
+            }
+            this.get('/LeftTree').renderView();
+            
+            pm.load( this.get('/LeftTree').getPaleteProvider().gatherList(this.listAllTypes()));
+            
+            
+                    
+            this.get('/Window.view-notebook').el.set_current_page(
+                this.get('/LeftTree.model').file.getType()== 'Roo' ? 0 : -1);
+                */
+                    
+        }
+        public    void updateSelected () {
+          
+           
+            var s = _this.view.el.get_selection();
+            
+             Gtk.TreeIter iter;
+            Gtk.TreeModel mod;
+            
+            
+            
+            if (!s.get_selected(out mod, out iter)) {
+                return; // nothing seleted..
+            }
+          
+          GLib.Value value;
+            this.el.get_value(iter, 2, out value);
+            var node = (JsRender.Node)(value.get_object());
+            
+              this.el.set(iter, 0, node.nodeTitle(),
+                        1, node.nodeTip(), -1
+                );
+        }
+        public           string findDropNodeByPath (string treepath_str, string[] targets, int in_pref = -1) {
+        
+            var path = treepath_str; // dupe it..
+            
+            
+            // pref : 3 = ontop - 0 = after, 1 = before
+            int pref = in_pref < 0  ?  Gtk.TreeViewDropPosition.INTO_OR_AFTER : in_pref;
+            
+            var last = "";
+            
+            //console.dump(this.treemap);
+            
+            print("findDropNodeByPath : got path length %d / %s\n", path.length, path);
+            
+            if (path.length == 0) {
+                // top drop. // just return empty..
+                return "|%d".printf((int)pref) ;
+                
+            }
+            
+            
+            while (path.length > 0) {
+            
+                if (path.length == treepath_str.length && pref != Gtk.TreeViewDropPosition.INTO_OR_AFTER) {
+                    if (path.last_index_of(":") < 0 ) {
+                        return "";
+                    }
+                    path = path.substring(0, path.last_index_of(":"));
+                    last = treepath_str;
+                    print("DROP  before or after : using %s\n",path);
+                    continue;
+                }
+            
+                //print("LOOKING FOR PATH: " + path);
+                var node_data = this.pathToNode(path);
+                
+                if (node_data == null) {
+                    print("node not found");
+                    return "";
+                }
+                
+                var xname = node_data.fqn();
+                var match = "";
+                var prop = "";
+                
+                for (var i =0; i < targets.length; i++)  {
+                    var tg = targets[i];
+                    if ((tg == xname)  ) {
+                        match = tg;
+                        break;
+                    }
+                    // if target is "xxxx:name"
+                    if (tg.contains(xname +":")) {
+                        match = tg;
+                        var ar = tg.split(":");
+                        prop = ar[1];
+                        break;
+                    }
+                }
+                
+                if (match.length > 0) {
+                    if (last.length > 0) { // pref is after/before..
+                        // then it's after last
+                        //if (pref > 1) {
+                        //    return "";
+                        //}
+                        return last + "|%d".printf((int)pref) + "|" + prop;
+        
+                        
+                    }
+                    return path + "|%d".printf( (int) Gtk.TreeViewDropPosition.INTO_OR_AFTER);// + "|" + prop;
+                }
+                /*
+                last = "" + path;
+                var par = path.split(":");
+                string [] ppar = {};
+                for (var i = 0; i < par.length-1; i++) {
+                    ppar += par[i];
+                }
+                
+                path = string.joinv(":", ppar);
+                */
+                break;
+        
+            }
+            
+            return "";
+                    
+        }
+        public           void moveNode (string target_data, Gdk.DragAction action) 
+        {
+           
+           /// target_data = "path|pos");
+           
+           
+            //print("MOVE NODE");
+            // console.dump(target_data);
+            Gtk.TreeIter old_iter;
+            Gtk.TreeModel mod;
+            
+            var s = _this.view.el.get_selection();
+            s.get_selected(out mod , out old_iter);
+            mod.get_path(old_iter);
+            
+            var node = this.pathToNode(mod.get_path(old_iter).to_string());
+            //console.dump(node);
+            if (node == null) {
+                print("moveNode: ERROR - node is null?");
+            }
+            
+            
+        
+            // needs to drop first, otherwise the target_data 
+            // treepath will be invalid.
+        
+            
+            if ((action & Gdk.DragAction.MOVE) > 0) {
+                    print("REMOVING OLD NODE : " + target_data + "\n");
+                    node.remove();
+                    this.dropNode(target_data, node, false);
+                    this.el.remove(ref old_iter);
+                    
+                    
+                                 
+            } else {
+                print("DROPPING NODE // copy: " + target_data + "\n");
+                node = node.deepClone();
+                this.dropNode(target_data, node, false);
+            }
+            _this.changed();
+            this.activePath= "";
+            //this.updateNode(false,true);
+        }
+        public           void load (Gee.ArrayList<JsRender.Node> tr, Gtk.TreeIter? iter) 
+        {
+            Gtk.TreeIter citer;
+            //this.insert(citer,iter,0);
+            for(var i =0 ; i < tr.size; i++) {
+                if (iter != null) {
+                    this.el.insert(out citer,iter,-1); // why not append?
+                } else {
+                    this.el.append(out citer,null);
+                }
+                
+                this.el.set(citer, 0, tr.get(i).nodeTitle(),
+                        1, tr.get(i).nodeTip(), -1
+                );
+                var o = new GLib.Value(typeof(Object));
+                o.set_object((Object)tr.get(i));
+                
+                this.el.set_value(citer, 2, o);
+                
+                if (tr.get(i).items.size > 0) {
+                    this.load(tr.get(i).items, citer);
+                }
+             
+            }
+        
+            
+        }
+        public           void deleteSelected () {
+            
+            print("DELETE SELECTED?");
+            //_this.view.blockChanges = true;
+            print("GET SELECTION?");
+        
+            var s = _this.view.el.get_selection();
+            
+            print("GET  SELECTED?");
+           Gtk.TreeIter iter;
+            Gtk.TreeModel mod;
+        
+            
+            if (!s.get_selected(out mod, out iter)) {
+                return; // nothing seleted..
+            }
+              
+        
+        
+            this.activePath= "";      
+            print("GET  vnode value?");
+        
+            GLib.Value value;
+            this.el.get_value(iter, 2, out value);
+            var data = (JsRender.Node)(value.get_object());
+            print("removing node from Render\n");
+            if (data.parent == null) {
+                this.file.tree = null;
+            } else {
+                data.remove();
+            }
+            print("removing node from Tree\n");    
+            s.unselect_all();
+            this.el.remove(ref iter);
+        
+            
+            
+            
+            // 
+            
+            
+        
+        
+            this.activePath= ""; // again!?!?      
+            //this.changed(null,true);
+            
+            _this.changed();
+            
+            _this.view.blockChanges = false;
+        }
+        public           JsRender.Node pathToNode (string path) {
+         
+             
+             Gtk.TreeIter   iter;
+             _this.model.el.get_iter_from_string(out iter, path);
+             
+             GLib.Value value;
+             _this.model.el.get_value(iter, 2, out value);
+             
+             return (JsRender.Node)value.dup_object();
+        
+        }
+        public           void dropNode (string target_data_str, JsRender.Node node, bool show_templates) {
+        //         print("drop Node");
+             // console.dump(node);
+          //    console.dump(target_data);
+          
+          
+                // 0 = before , 1=after 2/3 onto
+          
+          
+                var target_data= target_data_str.split("|");
+          
+                var parent_str = target_data[0].length > 0 ? target_data[0] : "";
+                var pos = target_data.length > 1 ? int.parse(target_data[1]) : 2; // ontop..
+          
+          
+                Gtk.TreePath tree_path  =   parent_str.length > 0 ? new  Gtk.TreePath.from_string( parent_str ) : null;
+                
+                
+                
+                //print("add " + tp + "@" + target_data[1]  );
+                
+                JsRender.Node parentNode = null;
+                
+                Gtk.TreeIter iter_after;
+                Gtk.TreeIter iter_par ;
+                
+               
+                 if (target_data.length == 3 && target_data[2].length > 0) {
+                    node.props.set("* prop", target_data[2]);
+                }
+        
+                Gtk.TreePath expand_parent = null;
+                
+                // we only need to show the template if it's come from else where?
+                 if (show_templates) {
+                 
+                    if (this.template_select == null) {
+                        this.template_select = new DialogTemplateSelect();
+                     }
+                 
+                     var new_node = this.template_select.show(
+                          (Gtk.Window) _this.el.get_toplevel (),
+                              this.file.palete(),
+                           node);
+                           
+                     if (new_node != null) {
+                         node = new_node;
+                     }
+                }        
+                
+                 //print("pos is %d  \n".printf(pos));
+                
+                 Gtk.TreeIter n_iter; 
+                 
+                 if ( parent_str.length < 1) {
+                      this.el.append(out n_iter, null); // drop at top level..
+                      node.parent = null;
+                      this.file.tree = node;
+                      
+                      
+                } else   if (pos  < 2) {
+                    //print(target_data[1]  > 0 ? 'insert_after' : 'insert_before');
+                    
+                    this.el.get_iter(out iter_after, tree_path );            
+                    this.el.iter_parent(out iter_par, iter_after);
+                    expand_parent = this.el.get_path(iter_par);
+                    
+                    GLib.Value value;
+                    this.el.get_value( iter_par, 2, out value);
+                    parentNode =  (JsRender.Node)value.dup_object();
+                    
+                    
+                    this.el.get_value( iter_after, 2, out value);
+                    var relNode =  (JsRender.Node)value.dup_object();
+                    
+                    if ( pos  > 0 ) {
+                     
+                        this.el.insert_after(out n_iter,    iter_par  , iter_after);
+                        var ix = parentNode.items.index_of(relNode);
+                        parentNode.items.insert(ix+1, node);
+                        
+                    } else {
+                        this.el.insert_before(out n_iter,  iter_par  , iter_after);
+                        var ix = parentNode.items.index_of(relNode);
+                        parentNode.items.insert(ix, node);
+         
+                    }
+                    node.parent = parentNode;
+                    
+                    
+                    
+                } else {
+                   //  print("appending to  " + parent_str);
+                    this.el.get_iter(out iter_par, tree_path);
+                    this.el.append(out n_iter,   iter_par );
+                    expand_parent = this.el.get_path(iter_par);
+                    
+                    GLib.Value value;
+                    this.el.get_value( iter_par, 2, out value);
+                    parentNode =  (JsRender.Node)value.dup_object();
+                    node.parent = parentNode;
+                    parentNode.items.add(node);
+                }
+                
+                // reparent node in tree...
+               
+                
+                // why only on no parent???
+                
+                //if (node.parent = null) {
+                     
+                   
+                    
+                //}
+                
+                
+                // work out what kind of packing to use.. -- should be in 
+                if (!node.has("pack")   && parent_str.length > 1) {
+                    
+                    this.file.palete().fillPack(node,parentNode);
+                    
+                    
+                }
+                
+                // add the node...
+                
+                this.el.set(n_iter, 0, node.nodeTitle(), 1, node.nodeTip(), -1  );
+                var o = new GLib.Value(typeof(Object));
+                o.set_object((Object)node);
+                
+                this.el.set_value(n_iter, 2, o);
+                
+                
+                
+                
+        // load children - if it has any..
+              
+                if (node.items.size > 0) {
+                    this.load(node.items, n_iter);
+                    _this.view.el.expand_row(this.el.get_path(n_iter), true);
+                } else if (expand_parent != null && !_this.view.el.is_row_expanded(expand_parent)) {
+                   _this.view.el.expand_row(expand_parent,true);
+                }
+        
+                //if (tp != null && (node.items.length() > 0 || pos > 1)) {
+                //    _this.view.el.expand_row(this.el.get_path(iter_par), true);
+               // }
+                // wee need to get the empty proptypes from somewhere..
+                
+                //var olditer = this.activeIter;
+                this.activePath = this.el.get_path(n_iter).to_string();
+        
+        
+                
+                
+                _this.view.el.set_cursor(this.el.get_path(n_iter), null, false);
+                _this.changed();
+             
+                
+                    
+        }
+    }
+    public class Xcls_TreeViewColumn4 : Object 
+    {
+        public Gtk.TreeViewColumn el;
+        private Xcls_WindowLeftTree  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_TreeViewColumn4(Xcls_WindowLeftTree _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.TreeViewColumn();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.title = "test";
+            var child_0 = new Xcls_renderer( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , true );
+
+            // init method 
+
+            this.el.add_attribute(_this.renderer.el , "markup", 0 );        }
+
+        // user defined functions 
+    }
+    public class Xcls_renderer : Object 
+    {
+        public Gtk.CellRendererText el;
+        private Xcls_WindowLeftTree  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_renderer(Xcls_WindowLeftTree _owner )
+        {
+            _this = _owner;
+            _this.renderer = this;
+            this.el = new Gtk.CellRendererText();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_LeftTreeMenu : Object 
+    {
+        public Gtk.Menu el;
+        private Xcls_WindowLeftTree  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_LeftTreeMenu(Xcls_WindowLeftTree _owner )
+        {
+            _this = _owner;
+            _this.LeftTreeMenu = this;
+            this.el = new Gtk.Menu();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_MenuItem7( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+            var child_1 = new Xcls_MenuItem8( _this );
+            child_1.ref();
+            this.el.add (  child_1.el  );
+            var child_2 = new Xcls_MenuItem9( _this );
+            child_2.ref();
+            this.el.add (  child_2.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem7 : Object 
+    {
+        public Gtk.MenuItem el;
+        private Xcls_WindowLeftTree  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem7(Xcls_WindowLeftTree _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Delete Element";
+
+            // listeners 
+            this.el.activate.connect( ( ) => {
+                
+                print("ACTIVATE?");
+                
+              
+                 _this.model.deleteSelected();
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem8 : Object 
+    {
+        public Gtk.MenuItem el;
+        private Xcls_WindowLeftTree  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem8(Xcls_WindowLeftTree _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Save as Template";
+
+            // listeners 
+            this.el.activate.connect( () => {
+            
+                 DialogSaveTemplate.singleton().show(
+                        (Gtk.Window) _this.el.get_toplevel (), 
+                        _this.model.file.palete(), 
+                        _this.getActiveElement()
+                );
+                 
+                
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_MenuItem9 : Object 
+    {
+        public Gtk.MenuItem el;
+        private Xcls_WindowLeftTree  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_MenuItem9(Xcls_WindowLeftTree _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.MenuItem();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Save as Module";
+
+            // listeners 
+            this.el.activate.connect( () => {
+                var node = _this.getActiveElement();
+                 var name = DialogSaveModule.singleton().show(
+                        (Gtk.Window) _this.el.get_toplevel (), 
+                        _this.model.file.project, 
+                        node
+                 );
+                 if (name.length < 1) {
+                        return;
+              
+                 }
+                 node.props.set("* xinclude", name);
+                 node.items.clear();
+            
+            
+                var s = _this.view.el.get_selection();
+                
+                print("GET  SELECTED?");
+                Gtk.TreeIter iter;
+                Gtk.TreeModel mod;
+            
+                
+                if (!s.get_selected(out mod, out iter)) {
+                    return; // nothing seleted..
+                }
+                Gtk.TreeIter citer;
+                var n_cn = mod.iter_n_children(iter) -1;
+                for (var i = n_cn; i > -1; i--) {
+                    mod.iter_nth_child(out citer, iter, i);
+                    
+            
+                    print("removing node from Tree\n");    
+                
+                    _this.model.el.remove(ref citer);
+                }
+                _this.changed();
+                _this.node_selected(node);
+                 
+                
+            });
+        }
+
+        // user defined functions 
+    }
+}
diff --git a/old-javascript/Builder4/WindowRightPalete.bjs b/old-javascript/Builder4/WindowRightPalete.bjs
new file mode 100644 (file)
index 0000000..dadd559
--- /dev/null
@@ -0,0 +1,80 @@
+{
+    "name" : "WindowRightPalete",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/WindowRightPalete.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "items" : [
+        {
+            "id" : "RightPalete",
+            "@ void after_node_change(JsRender.Node? node)" : "",
+            "* pack" : "add",
+            "xtype" : "VBox",
+            "@ void before_node_change(JsRender.Node? node)" : "",
+            "| void load" : " (Palete.Palete pal, string cls ) {\n   \n   // this.get('model').expanded();\n    \n    var tr = pal.getChildList(cls);\n    this.model.el.clear();\n\n\n    Gtk.TreeIter citer;\n\n    for(var i =0 ; i < tr.length; i++) {\n         this.model.el.append(out citer);   \n         \n        this.model.el.set_value(citer, 0,   tr[i] ); // title \n        \n    }\n    this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);\n    \n} \n\n",
+            "@ void drag_end()" : "",
+            "$ xns" : "Gtk",
+            "| void clear" : "() {\n   this.model.el.clear();\n}",
+            "items" : [
+                {
+                    "id" : "viewbox",
+                    "* pack" : "add",
+                    "xtype" : "VBox",
+                    "$ xns" : "Gtk",
+                    "items" : [
+                        {
+                            "* init" : "  this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n   this.el.set_size_request(-1,200);\n \n",
+                            "$ shadow_type" : "Gtk.ShadowType.IN",
+                            "* pack" : "add",
+                            "xtype" : "ScrolledWindow",
+                            "$ xns" : "Gtk",
+                            "items" : [
+                                {
+                                    "listeners" : {
+                                        "button_press_event" : " ( event) => {\n\n //\tif (!this.get('/Editor').save()) {\n //\t    // popup!! - click handled.. \n// \t    return true;\n//        }\n    return false;\n}",
+                                        "drag_begin" : "  ( ctx) => {\n    // we could fill this in now...\n//        Seed.print('SOURCE: drag-begin');\n        \n        \n        \n        Gtk.TreeIter iter;\n        var s = this.el.get_selection();\n        \n        Gtk.TreeModel mod;\n        s.get_selected(out mod, out iter);\n        var path = mod.get_path(iter);\n        \n        /// pix is a surface..\n        var pix = this.el.create_row_drag_icon ( path);\n            \n                \n        Gtk.drag_set_icon_surface (ctx, pix);\n        GLib.Value value;\n        \n\n        _this.model.el.get_value(iter, 0, out value);\n        \n        this.dragData = (string) value;\n         \n        \n        return;\n}",
+                                        "drag_end" : "( drag_context)  => {\n \t print(\"SOURCE: drag-end\\n\");\n\t\n\tthis.dragData = \"\";\n\t//this.dropList = null;\n\t_this.drag_end(); // call signal..\n\t//this.get('/LeftTree.view').highlight(false);\n\t \n}",
+                                        "drag_data_get" : "(drag_context, selection_data, info, time) => {\n \t//Seed.print('Palete: drag-data-get: ' + target_type);\n    if (this.dragData.length < 1 ) {\n        return; \n    }\n    \n    print(\"setting drag data to %s\\n\", this.dragData);\n   // selection_data.set_text(this.dragData ,this.dragData.length);\n   selection_data.set (selection_data.get_target (), 8, (uchar[]) this.dragData.to_utf8 ());\n\n        //this.el.dragData = \"TEST from source widget\";\n        \n        \n}"
+                                    },
+                                    "# string dragData" : "",
+                                    "* init" : " {\n    this.el.set_size_request(150,-1);\n                          //  set_reorderable: [1]\n                                  \n    var description = new Pango.FontDescription();\n    description.set_size(8000);\n    this.el.modify_font(description);\n    \n    var selection = this.el.get_selection();\n    selection.set_mode( Gtk.SelectionMode.SINGLE);\n   // this.selection.signal['changed'].connect(function() {\n    //    _view.listeners['cursor-changed'].apply(_view, [ _view, '']);\n    //});\n    // see: http://live.gnome.org/GnomeLove/DragNDropTutorial\n     \n    Gtk.drag_source_set (\n            this.el,            /* widget will be drag-able */\n            Gdk.ModifierType.BUTTON1_MASK,       /* modifier that will start a drag */\n            Builder4.Application.targetList,            /* lists of target to support */\n            Gdk.DragAction.COPY         /* what to do with data after dropped */\n    );\n    //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);\n   \n   // Gtk.drag_source_set_target_list(this.el, Application.targetList);\n   // Gtk.drag_source_add_text_targets(this.el); \n \n}\n",
+                                    "xtype" : "TreeView",
+                                    "* pack" : "add",
+                                    "$ enable_tree_lines" : true,
+                                    "$ headers_visible" : false,
+                                    "$ xns" : "Gtk",
+                                    "items" : [
+                                        {
+                                            "| string getValue" : " (Gtk.TreeIter iter, int col)  {\n    GLib.Value gval;\n     this.el.get_value(iter, col , out gval);\n    return  (string)gval;\n    \n    \n}",
+                                            "id" : "model",
+                                            "* pack" : "set_model",
+                                            "xtype" : "ListStore",
+                                            "$ columns" : "typeof(string),typeof(string)",
+                                            "n_columns" : 2,
+                                            "$ xns" : "Gtk"
+                                        },
+                                        {
+                                            "* init" : " this.el.add_attribute(_this.txtrender.el , \"markup\", 0 );\n \n",
+                                            "* pack" : "append_column",
+                                            "xtype" : "TreeViewColumn",
+                                            "$ xns" : "Gtk",
+                                            "items" : [
+                                                {
+                                                    "id" : "txtrender",
+                                                    "xtype" : "CellRendererText",
+                                                    "* pack" : "pack_start,true",
+                                                    "$ xns" : "Gtk"
+                                                }
+                                            ]
+                                        }
+                                    ]
+                                }
+                            ]
+                        }
+                    ]
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/WindowRightPalete.vala b/old-javascript/Builder4/WindowRightPalete.vala
new file mode 100644 (file)
index 0000000..6868f74
--- /dev/null
@@ -0,0 +1,313 @@
+static Xcls_RightPalete  _RightPalete;
+
+public class Xcls_RightPalete : Object 
+{
+    public Gtk.VBox el;
+    private Xcls_RightPalete  _this;
+
+    public static Xcls_RightPalete singleton()
+    {
+        if (_RightPalete == null) {
+            _RightPalete= new Xcls_RightPalete();
+        }
+        return _RightPalete;
+    }
+    public Xcls_viewbox viewbox;
+    public Xcls_model model;
+    public Xcls_txtrender txtrender;
+
+        // my vars (def)
+    public signal void after_node_change(JsRender.Node? node) ;
+    public signal void before_node_change(JsRender.Node? node) ;
+    public signal void drag_end() ;
+
+    // ctor 
+    public Xcls_RightPalete()
+    {
+        _this = this;
+        this.el = new Gtk.VBox( true, 0 );
+
+        // my vars (dec)
+
+        // set gobject values
+        var child_0 = new Xcls_viewbox( _this );
+        child_0.ref();
+        this.el.add (  child_0.el  );
+    }
+
+    // user defined functions 
+    public void load (Palete.Palete pal, string cls ) {
+       
+       // this.get('model').expanded();
+        
+        var tr = pal.getChildList(cls);
+        this.model.el.clear();
+    
+    
+        Gtk.TreeIter citer;
+    
+        for(var i =0 ; i < tr.length; i++) {
+             this.model.el.append(out citer);   
+             
+            this.model.el.set_value(citer, 0,   tr[i] ); // title 
+            
+        }
+        this.model.el.set_sort_column_id(0,Gtk.SortType.ASCENDING);
+        
+    }
+    public void clear () {
+       this.model.el.clear();
+    }
+    public class Xcls_viewbox : Object 
+    {
+        public Gtk.VBox el;
+        private Xcls_RightPalete  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_viewbox(Xcls_RightPalete _owner )
+        {
+            _this = _owner;
+            _this.viewbox = this;
+            this.el = new Gtk.VBox( true, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_ScrolledWindow3( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_ScrolledWindow3 : Object 
+    {
+        public Gtk.ScrolledWindow el;
+        private Xcls_RightPalete  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_ScrolledWindow3(Xcls_RightPalete _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.ScrolledWindow( null, null );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.shadow_type = Gtk.ShadowType.IN;
+            var child_0 = new Xcls_TreeView4( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+
+            // init method 
+
+            this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+               this.el.set_size_request(-1,200);        }
+
+        // user defined functions 
+    }
+    public class Xcls_TreeView4 : Object 
+    {
+        public Gtk.TreeView el;
+        private Xcls_RightPalete  _this;
+
+
+            // my vars (def)
+        public string dragData;
+
+        // ctor 
+        public Xcls_TreeView4(Xcls_RightPalete _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.TreeView();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.enable_tree_lines = true;
+            this.el.headers_visible = false;
+            var child_0 = new Xcls_model( _this );
+            child_0.ref();
+            this.el.set_model (  child_0.el  );
+            var child_1 = new Xcls_TreeViewColumn6( _this );
+            child_1.ref();
+            this.el.append_column (  child_1.el  );
+
+            // init method 
+
+            {
+                this.el.set_size_request(150,-1);
+                                      //  set_reorderable: [1]
+                                              
+                var description = new Pango.FontDescription();
+                description.set_size(8000);
+                this.el.modify_font(description);
+                
+                var selection = this.el.get_selection();
+                selection.set_mode( Gtk.SelectionMode.SINGLE);
+               // this.selection.signal['changed'].connect(function() {
+                //    _view.listeners['cursor-changed'].apply(_view, [ _view, '']);
+                //});
+                // see: http://live.gnome.org/GnomeLove/DragNDropTutorial
+                 
+                Gtk.drag_source_set (
+                        this.el,            /* widget will be drag-able */
+                        Gdk.ModifierType.BUTTON1_MASK,       /* modifier that will start a drag */
+                        Builder4.Application.targetList,            /* lists of target to support */
+                        Gdk.DragAction.COPY         /* what to do with data after dropped */
+                );
+                //Gtk.drag_source_set_target_list(this.el, LeftTree.targetList);
+               
+               // Gtk.drag_source_set_target_list(this.el, Application.targetList);
+               // Gtk.drag_source_add_text_targets(this.el); 
+             
+            }
+            // listeners 
+            this.el.button_press_event.connect( ( event) => {
+            
+             //        if (!this.get('/Editor').save()) {
+             //            // popup!! - click handled.. 
+            //             return true;
+            //        }
+                return false;
+            });
+            this.el.drag_begin.connect( ( ctx) => {
+                // we could fill this in now...
+            //        Seed.print('SOURCE: drag-begin');
+                    
+                    
+                    
+                    Gtk.TreeIter iter;
+                    var s = this.el.get_selection();
+                    
+                    Gtk.TreeModel mod;
+                    s.get_selected(out mod, out iter);
+                    var path = mod.get_path(iter);
+                    
+                    /// pix is a surface..
+                    var pix = this.el.create_row_drag_icon ( path);
+                        
+                            
+                    Gtk.drag_set_icon_surface (ctx, pix);
+                    GLib.Value value;
+                    
+            
+                    _this.model.el.get_value(iter, 0, out value);
+                    
+                    this.dragData = (string) value;
+                     
+                    
+                    return;
+            });
+            this.el.drag_end.connect( ( drag_context)  => {
+                print("SOURCE: drag-end\n");
+               
+               this.dragData = "";
+               //this.dropList = null;
+               _this.drag_end(); // call signal..
+               //this.get('/LeftTree.view').highlight(false);
+                
+            });
+            this.el.drag_data_get.connect( (drag_context, selection_data, info, time) => {
+               //Seed.print('Palete: drag-data-get: ' + target_type);
+                if (this.dragData.length < 1 ) {
+                    return; 
+                }
+                
+                print("setting drag data to %s\n", this.dragData);
+               // selection_data.set_text(this.dragData ,this.dragData.length);
+               selection_data.set (selection_data.get_target (), 8, (uchar[]) this.dragData.to_utf8 ());
+            
+                    //this.el.dragData = "TEST from source widget";
+                    
+                    
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_model : Object 
+    {
+        public Gtk.ListStore el;
+        private Xcls_RightPalete  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_model(Xcls_RightPalete _owner )
+        {
+            _this = _owner;
+            _this.model = this;
+            this.el = new Gtk.ListStore( 2, typeof(string),typeof(string) );
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+        public string getValue (Gtk.TreeIter iter, int col)  {
+            GLib.Value gval;
+             this.el.get_value(iter, col , out gval);
+            return  (string)gval;
+            
+            
+        }
+    }
+    public class Xcls_TreeViewColumn6 : Object 
+    {
+        public Gtk.TreeViewColumn el;
+        private Xcls_RightPalete  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_TreeViewColumn6(Xcls_RightPalete _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.TreeViewColumn();
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_txtrender( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , true );
+
+            // init method 
+
+            this.el.add_attribute(_this.txtrender.el , "markup", 0 );        }
+
+        // user defined functions 
+    }
+    public class Xcls_txtrender : Object 
+    {
+        public Gtk.CellRendererText el;
+        private Xcls_RightPalete  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_txtrender(Xcls_RightPalete _owner )
+        {
+            _this = _owner;
+            _this.txtrender = this;
+            this.el = new Gtk.CellRendererText();
+
+            // my vars (dec)
+
+            // set gobject values
+        }
+
+        // user defined functions 
+    }
+}
diff --git a/old-javascript/Builder4/WindowRooView.bjs b/old-javascript/Builder4/WindowRooView.bjs
new file mode 100644 (file)
index 0000000..5324a6f
--- /dev/null
@@ -0,0 +1,111 @@
+{
+    "name" : "WindowRooView",
+    "parent" : "",
+    "title" : "",
+    "path" : "/home/alan/gitlive/app.Builder.js/Builder4/WindowRooView.bjs",
+    "permname" : "",
+    "modOrder" : "",
+    "items" : [
+        {
+            "id" : "WindowRooView",
+            "| void createThumb" : "() {\n    \n    \n    if (this.file == null) {\n        return;\n    }\n    var filename = this.file.getIconFileName(false);\n    \n    var  win = this.el.get_parent_window();\n    var width = win.get_width();\n    var height = win.get_height();\n\n    Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, this.el.position);\n\n    screenshot.save(filename,\"png\");\n    return;\n    \n    \n    \n    \n    \n    \n    \n    var p = new WebKit.PrintOperation(_this.view.el);\n     \n    var ps = new Gtk.PrintSettings();\n    ps.set_printer(\"Print to File\");\n    ps.set(\"output-file-format\", \"pdf\");\n    ps.set(\"output-uri\", \"file://\" + filename + \".pdf\");\n\n    // find the printer...\n    \n    /*\n    var ar = Gtk.PaperSize.get_paper_sizes(false);\n    var psetup = new Gtk.PageSetup();\n    for(var i = 0; i < ar.length(); i++) {\n        if (ar.nth_data(i).get_name() ==\"iso_a4\") {\n            psetup.set_paper_size(ar.nth_data(i));\n        }\n    }\n    psetup.set_orientation(Gtk.PageOrientation.LANDSCAPE);\n    \n     \n    p.set_page_setup(psetup);\n    */\n    p.set_print_settings(ps);\n    \n    p.finished.connect(() => {\n        print(\"creating thumbnail for \" + filename + \".pdf\\n\"); \n        var s = new Cairo.PdfSurface(filename + \".pdf\", 400,400);\n    \n        s.write_to_png (filename);\n        \n       // var f = GLib.File.new_for_path (filename + \".pdf\");\n       // f.delete();\n    });\n    \n    \n    p.print();\n    \n    // should we hold until it's printed...\n    \n      \n\n    \n    \n\n\n    \n     \n}\n",
+            "| void loadFile" : "(JsRender.JsRender file)\n{\n    this.file = file;\n    this.view.renderJS(true);\n}",
+            "* pack" : "add",
+            "xtype" : "VPaned",
+            "# JsRender.JsRender file" : "",
+            "| void requestRedraw" : "() {\n    this.view.renderJS(false);\n}",
+            "$ xns" : "Gtk",
+            "items" : [
+                {
+                    "id" : "viewbox",
+                    "* pack" : "pack1,true,true",
+                    "xtype" : "VBox",
+                    "$ xns" : "Gtk",
+                    "$ homogeneous" : false,
+                    "items" : [
+                        {
+                            "$ vexpand" : false,
+                            "$ height_request" : 20,
+                            "* pack" : "pack_start,false,true,0",
+                            "xtype" : "HBox",
+                            "$ xns" : "Gtk",
+                            "$ homogeneous" : true,
+                            "items" : [
+                                {
+                                    "listeners" : {
+                                        "clicked" : "( ) => {\n    _this.view.renderJS(  true);\n}"
+                                    },
+                                    "label" : "Redraw",
+                                    "xtype" : "Button",
+                                    "* pack" : "pack_start,false,false,0",
+                                    "$ xns" : "Gtk"
+                                },
+                                {
+                                    "listeners" : {
+                                        "toggled" : " (state) => {\n    this.el.set_label(this.el.active  ? \"Auto Redraw On\" : \"Auto Redraw Off\");\n}"
+                                    },
+                                    "label" : "Auto Redraw On",
+                                    "id" : "AutoRedraw",
+                                    "$ active" : true,
+                                    "* pack" : "pack_start,false,false,0",
+                                    "xtype" : "CheckButton",
+                                    "$ xns" : "Gtk"
+                                },
+                                {
+                                    "listeners" : {
+                                        "clicked" : " () => {\n  _this.view.redraws = 99;\n    _this.view.el.web_context.clear_cache();  \n  _this.view.renderJS(true);\n\n}"
+                                    },
+                                    "label" : "Full Redraw",
+                                    "xtype" : "Button",
+                                    "* pack" : "pack_start,false,false,0",
+                                    "$ xns" : "Gtk"
+                                }
+                            ]
+                        },
+                        {
+                            "id" : "viewcontainer",
+                            "* init" : "  this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n",
+                            "$ shadow_type" : "Gtk.ShadowType.IN",
+                            "* pack" : "pack_end,true,true,0",
+                            "xtype" : "ScrolledWindow",
+                            "$ xns" : "Gtk",
+                            "items" : [
+                                {
+                                    "listeners" : {
+                                        "script_dialog" : " (dialog) => {\n    if (this.el == null) {\n        return true;\n    }\n    \n     var msg = dialog.get_message();\n     if (msg.length < 4) {\n        return false;\n     }\n     if (msg.substring(0,4) != \"IPC:\") {\n         return false;\n     }\n     var ar = msg.split(\":\", 3);\n    if (ar.length < 3) {\n        return false;\n    }\n    switch(ar[1]) {\n        case \"SAVEHTML\":\n            _this.file.saveHTML(ar[2]);\n            return true;\n        default:\n            return false;\n    }\n    \n}",
+                                        "show" : "  ( ) => {\n    this.initInspector();;\n}",
+                                        "drag_drop" : "  ( ctx, x, y,time, ud) => {\n    return false;\n    /*\n\tprint(\"TARGET: drag-drop\");\n        var is_valid_drop_site = true;\n        \n         \n        Gtk.drag_get_data\n        (\n                w,         // will receive 'drag-data-received' signal \n                ctx,        /* represents the current state of the DnD \n                this.get('/Window').atoms[\"STRING\"],    /* the target type we want \n                time            /* time stamp \n        );\n                        \n                        \n                        /* No target offered by source => error \n                       \n\n\treturn  is_valid_drop_site;\n\t*/\n}"
+                                    },
+                                    "# string renderedData" : "\"\"",
+                                    "id" : "view",
+                                    "# bool refreshRequired" : false,
+                                    "* init" : " {\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   \n     \n    \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( \"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,              //\n            Gtk.DestDefaults.MOTION  | Gtk.DestDefaults.HIGHLIGHT,\n            null,            // list of targets\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(1,  ()  =>{\n         //print(\"run refresh?\");\n         if (this.el == null) {\n            return false;\n         }\n         this.runRefresh(); \n         return true;\n     });\n    \n    \n}\n",
+                                    "* pack" : "add",
+                                    "redraws" : 0,
+                                    "xtype" : "WebView",
+                                    "# WebKit.WebInspector inspector" : "",
+                                    "# int redraws" : 0,
+                                    "| void runRefresh" : " () \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 != null) {\n       // do not redraw if last redraw was less that 5 seconds ago.\n       if ((int64)(new DateTime.now_local()).difference(this.lastRedraw) < 5000 ) {\n            return;\n        }\n    }\n    \n    if (_this.file == null) {\n        return;\n    }\n    \n    \n     this.refreshRequired = false;\n   //  print(\"HTML RENDERING\");\n     \n     \n     //this.get('/BottomPane').el.show();\n     //this.get('/BottomPane').el.set_current_page(2);// webkit inspector\n    _this.file.webkit_page_id  = this.el.get_page_id();\n    \n    var js = _this.file.toSourcePreview();\n\n    if (js.length < 1) {\n        print(\"no data\");\n        return;\n    }\n//    var  data = js[0];\n    this.redraws++;\n  \n    var project = _this.file.project;  \n\n     //print (project.fn);\n     // set it to non-empty.\n     \n//     runhtml = runhtml.length ?  runhtml : '<script type=\"text/javascript\"></script>'; \n\n\n//   this.runhtml  = this.runhtml || '';\n \n \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\n    var runhtml = \"<script type=\\\"text/javascript\\\">\\n\" ;\n    string builderhtml;\n    \n    \n    GLib.FileUtils.get_contents(Builder4.Application.configDirectory() + \"/resources/roo.builder.js\", out builderhtml);\n\n    runhtml += builderhtml + \"\\n\";\n    runhtml += \"</script>\\n\" ;\n\n    // fix to make sure they are the same..\n    this.runhtml = project.runhtml;\n    // need to modify paths\n\n    string inhtml;\n    var base_template = _this.file.project.base_template;\n    \n    if (base_template.length > 0 && !FileUtils.test(\n        Builder4.Application.configDirectory() + \"/resources/\" +  base_template, FileTest.EXISTS)  \n        ) {\n           print(\"invalid base_template name - using default:  %s\\n\", base_template);\n           base_template = \"\";\n    \n    }\n    \n    GLib.FileUtils.get_contents(\n        Builder4.Application.configDirectory() + \"/resources/\" + \n            (base_template.length > 0 ? base_template :  \"roo.builder.html\")\n            , out inhtml);\n    \n    \n    this.renderedData = js;\n\n\n    string js_src = js + \"\\n\" +\n\t\"Roo.onReady(function() {\\n\" +\n\t\"if (\" + _this.file.name +\".show) \" +  _this.file.name +\".show({});\\n\" +\n\t\"Roo.XComponent.build();\\n\" +\n\t\"});\\n\";\n\t\n   // print(\"render js: \" + js);\n    //if (!this.ready) {\n  //      console.log('not loaded yet');\n    //}\n    this.lastRedraw = new DateTime.now_local();\n\n        var html = inhtml.replace(\"</head>\", runhtml + this.runhtml + \n        \n                \"<script type=\\\"text/javascript\\\">\\n\" +\n                js_src + \"\\n\" + \n                \"</script>\" + \n                        \n        \"</head>\");\n        //print(\"LOAD HTML \" + html);\n        \n         var rootURL = _this.file.project.rootURL;\n   \n        \n        \n        this.el.load_html( html , \n            //fixme - should be a config option!\n            (rootURL.length > 0 ? rootURL : \"http://localhost/app.Builder/\")\n        );\n        \n    // force the inspector...        \n          this.initInspector();\n        \n        // - no need for this, the builder javascript will call it when build is complete\n        //GLib.Timeout.add_seconds(1, () => {\n        //    this.el.run_javascript(\"Builder.saveHTML()\",null);\n        //    return false;\n        //});\n//     print( \"before render\" +    this.lastRedraw);\n//    print( \"after render\" +    (new Date()));\n    \n}\n",
+                                    "$ xns" : "WebKit",
+                                    "| void initInspector" : "() {\n    \n    if (this.inspector == this.el.get_inspector()) {\n        this.inspector.show();\n        this.inspector.open_window();        \n        print(\"init inspecter called, and inspector is the same as existing\\n\");\n        return;\n    }\n    print(\"new inspector?\\n\");\n\n    this.inspector = this.el.get_inspector();\n    this.inspector.ref();\n    \n    // got a new inspector...\n        \n    this.inspector.open_window.connect(() => {\n         this.inspector = this.el.get_inspector();\n        print(\"inspector attach\\n\");\n        var wv = this.inspector.get_web_view();\n        if (wv != null) {\n            print(\"got inspector web view\\n\");\n            _this.inspectorcontainer.el.add(wv);\n            wv.show();\n        } else {\n            //this.inspector.close();\n            \n            //this.inspector = null;\n           \n \n        }\n        return true;\n       \n    });\n    this.inspector.closed.connect(() => {\n         print(\"inspector closed?!?\");\n         // if this happens destroy the webkit..\n         // recreate it..\n         this.el.stop_loading();\n         \n         if (_this.viewbox.el.get_parent() == null) {\n            return;\n         }\n         \n         \n        _this.viewbox.el.remove(_this.viewcontainer.el);\n        _this.el.remove(_this.inspectorcontainer.el);        \n         \n         // destory seems to cause problems.\n         //this.el.destroy();\n        //_this.viewcontainer.el.destroy();\n         //_this.inspectorcontainer.el.destroy();\n\n         this.el = null;         \n         var nv =new Xcls_viewcontainer(_this);\n         nv.ref();\n         _this.viewbox.el.pack_end(nv.el,true,true,0);\n         \n          var  inv =new Xcls_inspectorcontainer(_this);\n          inv.ref();\n          _this.el.pack2(inv.el,true,true);\n         \n         inv.el.show_all();\n         nv.el.show_all();\n         //while(Gtk.events_pending ()) Gtk.main_iteration ();\n         //_this.view.renderJS(true); \n         _this.view.refreshRequired  = true;\n       \n    }); \n    \n    this.inspector.show();\n}\n",
+                                    "# GLib.DateTime lastRedraw" : "null",
+                                    "# string runhtml" : "\"\"",
+                                    "# bool pendingRedraw" : false,
+                                    "| void renderJS" : "(bool force) {\n\n    // this is the public redraw call..\n    // we refresh in a loop privately..\n    var autodraw = _this.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"
+                                }
+                            ]
+                        }
+                    ]
+                },
+                {
+                    "id" : "inspectorcontainer",
+                    "* init" : "  this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);\n \n",
+                    "$ shadow_type" : "Gtk.ShadowType.IN",
+                    "xtype" : "ScrolledWindow",
+                    "* pack" : "pack2,true,true",
+                    "$ xns" : "Gtk"
+                }
+            ]
+        }
+    ]
+}
\ No newline at end of file
diff --git a/old-javascript/Builder4/WindowRooView.vala b/old-javascript/Builder4/WindowRooView.vala
new file mode 100644 (file)
index 0000000..b1ecb77
--- /dev/null
@@ -0,0 +1,673 @@
+static Xcls_WindowRooView  _WindowRooView;
+
+public class Xcls_WindowRooView : Object 
+{
+    public Gtk.VPaned el;
+    private Xcls_WindowRooView  _this;
+
+    public static Xcls_WindowRooView singleton()
+    {
+        if (_WindowRooView == null) {
+            _WindowRooView= new Xcls_WindowRooView();
+        }
+        return _WindowRooView;
+    }
+    public Xcls_viewbox viewbox;
+    public Xcls_AutoRedraw AutoRedraw;
+    public Xcls_viewcontainer viewcontainer;
+    public Xcls_view view;
+    public Xcls_inspectorcontainer inspectorcontainer;
+
+        // my vars (def)
+    public JsRender.JsRender file;
+
+    // ctor 
+    public Xcls_WindowRooView()
+    {
+        _this = this;
+        this.el = new Gtk.VPaned();
+
+        // my vars (dec)
+
+        // set gobject values
+        var child_0 = new Xcls_viewbox( _this );
+        child_0.ref();
+        this.el.pack1 (  child_0.el , true,true );
+        var child_1 = new Xcls_inspectorcontainer( _this );
+        child_1.ref();
+        this.el.pack2 (  child_1.el , true,true );
+    }
+
+    // user defined functions 
+    public void createThumb () {
+        
+        
+        if (this.file == null) {
+            return;
+        }
+        var filename = this.file.getIconFileName(false);
+        
+        var  win = this.el.get_parent_window();
+        var width = win.get_width();
+        var height = win.get_height();
+    
+        Gdk.Pixbuf screenshot = Gdk.pixbuf_get_from_window(win, 0, 0, width, this.el.position);
+    
+        screenshot.save(filename,"png");
+        return;
+        
+        
+        
+        
+        
+        
+        
+        var p = new WebKit.PrintOperation(_this.view.el);
+         
+        var ps = new Gtk.PrintSettings();
+        ps.set_printer("Print to File");
+        ps.set("output-file-format", "pdf");
+        ps.set("output-uri", "file://" + filename + ".pdf");
+    
+        // find the printer...
+        
+        /*
+        var ar = Gtk.PaperSize.get_paper_sizes(false);
+        var psetup = new Gtk.PageSetup();
+        for(var i = 0; i < ar.length(); i++) {
+            if (ar.nth_data(i).get_name() =="iso_a4") {
+                psetup.set_paper_size(ar.nth_data(i));
+            }
+        }
+        psetup.set_orientation(Gtk.PageOrientation.LANDSCAPE);
+        
+         
+        p.set_page_setup(psetup);
+        */
+        p.set_print_settings(ps);
+        
+        p.finished.connect(() => {
+            print("creating thumbnail for " + filename + ".pdf\n"); 
+            var s = new Cairo.PdfSurface(filename + ".pdf", 400,400);
+        
+            s.write_to_png (filename);
+            
+           // var f = GLib.File.new_for_path (filename + ".pdf");
+           // f.delete();
+        });
+        
+        
+        p.print();
+        
+        // should we hold until it's printed...
+        
+          
+    
+        
+        
+    
+    
+        
+         
+    }
+    public void loadFile (JsRender.JsRender file)
+    {
+        this.file = file;
+        this.view.renderJS(true);
+    }
+    public void requestRedraw () {
+        this.view.renderJS(false);
+    }
+    public class Xcls_viewbox : Object 
+    {
+        public Gtk.VBox el;
+        private Xcls_WindowRooView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_viewbox(Xcls_WindowRooView _owner )
+        {
+            _this = _owner;
+            _this.viewbox = this;
+            this.el = new Gtk.VBox( false, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            var child_0 = new Xcls_HBox3( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false,true,0 );
+            var child_1 = new Xcls_viewcontainer( _this );
+            child_1.ref();
+            this.el.pack_end (  child_1.el , true,true,0 );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_HBox3 : Object 
+    {
+        public Gtk.HBox el;
+        private Xcls_WindowRooView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_HBox3(Xcls_WindowRooView _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.HBox( true, 0 );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.height_request = 20;
+            this.el.vexpand = false;
+            var child_0 = new Xcls_Button4( _this );
+            child_0.ref();
+            this.el.pack_start (  child_0.el , false,false,0 );
+            var child_1 = new Xcls_AutoRedraw( _this );
+            child_1.ref();
+            this.el.pack_start (  child_1.el , false,false,0 );
+            var child_2 = new Xcls_Button6( _this );
+            child_2.ref();
+            this.el.pack_start (  child_2.el , false,false,0 );
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button4 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_WindowRooView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button4(Xcls_WindowRooView _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Redraw";
+
+            // listeners 
+            this.el.clicked.connect( ( ) => {
+                _this.view.renderJS(  true);
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_AutoRedraw : Object 
+    {
+        public Gtk.CheckButton el;
+        private Xcls_WindowRooView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_AutoRedraw(Xcls_WindowRooView _owner )
+        {
+            _this = _owner;
+            _this.AutoRedraw = this;
+            this.el = new Gtk.CheckButton();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.active = true;
+            this.el.label = "Auto Redraw On";
+
+            // listeners 
+            this.el.toggled.connect( (state) => {
+                this.el.set_label(this.el.active  ? "Auto Redraw On" : "Auto Redraw Off");
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_Button6 : Object 
+    {
+        public Gtk.Button el;
+        private Xcls_WindowRooView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_Button6(Xcls_WindowRooView _owner )
+        {
+            _this = _owner;
+            this.el = new Gtk.Button();
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.label = "Full Redraw";
+
+            // listeners 
+            this.el.clicked.connect( () => {
+              _this.view.redraws = 99;
+                _this.view.el.web_context.clear_cache();  
+              _this.view.renderJS(true);
+            
+            });
+        }
+
+        // user defined functions 
+    }
+    public class Xcls_viewcontainer : Object 
+    {
+        public Gtk.ScrolledWindow el;
+        private Xcls_WindowRooView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_viewcontainer(Xcls_WindowRooView _owner )
+        {
+            _this = _owner;
+            _this.viewcontainer = this;
+            this.el = new Gtk.ScrolledWindow( null, null );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.shadow_type = Gtk.ShadowType.IN;
+            var child_0 = new Xcls_view( _this );
+            child_0.ref();
+            this.el.add (  child_0.el  );
+
+            // init method 
+
+            this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);        }
+
+        // user defined functions 
+    }
+    public class Xcls_view : Object 
+    {
+        public WebKit.WebView el;
+        private Xcls_WindowRooView  _this;
+
+
+            // my vars (def)
+        public string renderedData;
+        public bool refreshRequired;
+        public WebKit.WebInspector inspector;
+        public int redraws;
+        public GLib.DateTime lastRedraw;
+        public string runhtml;
+        public bool pendingRedraw;
+
+        // ctor 
+        public Xcls_view(Xcls_WindowRooView _owner )
+        {
+            _this = _owner;
+            _this.view = this;
+            this.el = new WebKit.WebView();
+
+            // my vars (dec)
+            this.renderedData = "";
+            this.refreshRequired = false;
+            this.redraws = 0;
+            this.lastRedraw = null;
+            this.runhtml = "";
+            this.pendingRedraw = false;
+
+            // set gobject values
+
+            // init method 
+
+            {
+                // this may not work!?
+                var settings =  this.el.get_settings();
+                settings.enable_developer_extras = true;
+                
+                // this was an attempt to change the url perms.. did not work..
+                // settings.enable_file_access_from_file_uris = true;
+                // settings.enable_offline_web_application_cache - true;
+                // settings.enable_universal_access_from_file_uris = true;
+               
+                 
+                
+                
+                
+            
+                 // FIXME - base url of script..
+                 // we need it so some of the database features work.
+                this.el.load_html( "Render not ready" , 
+                        //fixme - should be a config option!
+                        // or should we catch stuff and fix it up..
+                        "http://localhost/app.Builder/"
+                );
+                    
+                    
+               //this.el.open('file:///' + __script_path__ + '/../builder.html');
+                /*
+                Gtk.drag_dest_set
+                (
+                        this.el,              //
+                        Gtk.DestDefaults.MOTION  | Gtk.DestDefaults.HIGHLIGHT,
+                        null,            // list of targets
+                        Gdk.DragAction.COPY         // what to do with data after dropped 
+                );
+                                        
+               // print("RB: TARGETS : " + LeftTree.atoms["STRING"]);
+                Gtk.drag_dest_set_target_list(this.el, this.get('/Window').targetList);
+                */
+                GLib.Timeout.add_seconds(1,  ()  =>{
+                     //print("run refresh?");
+                     if (this.el == null) {
+                        return false;
+                     }
+                     this.runRefresh(); 
+                     return true;
+                 });
+                
+                
+            }
+            // listeners 
+            this.el.script_dialog.connect( (dialog) => {
+                if (this.el == null) {
+                    return true;
+                }
+                
+                 var msg = dialog.get_message();
+                 if (msg.length < 4) {
+                    return false;
+                 }
+                 if (msg.substring(0,4) != "IPC:") {
+                     return false;
+                 }
+                 var ar = msg.split(":", 3);
+                if (ar.length < 3) {
+                    return false;
+                }
+                switch(ar[1]) {
+                    case "SAVEHTML":
+                        _this.file.saveHTML(ar[2]);
+                        return true;
+                    default:
+                        return false;
+                }
+                
+            });
+            this.el.show.connect( ( ) => {
+                this.initInspector();;
+            });
+            this.el.drag_drop.connect( ( ctx, x, y,time, ud) => {
+                return false;
+                /*
+               print("TARGET: drag-drop");
+                    var is_valid_drop_site = true;
+                    
+                     
+                    Gtk.drag_get_data
+                    (
+                            w,         // will receive 'drag-data-received' signal 
+                            ctx,        /* represents the current state of the DnD 
+                            this.get('/Window').atoms["STRING"],    /* the target type we want 
+                            time            /* time stamp 
+                    );
+                                    
+                                    
+                                    /* No target offered by source => error 
+                                   
+            
+               return  is_valid_drop_site;
+               */
+            });
+        }
+
+        // user defined functions 
+        public void runRefresh () 
+        {
+            // this is run every 2 seconds from the init..
+        
+          
+            
+            if (!this.refreshRequired) {
+               // print("no refresh required");
+                return;
+            }
+        
+            if (this.lastRedraw != null) {
+               // do not redraw if last redraw was less that 5 seconds ago.
+               if ((int64)(new DateTime.now_local()).difference(this.lastRedraw) < 5000 ) {
+                    return;
+                }
+            }
+            
+            if (_this.file == null) {
+                return;
+            }
+            
+            
+             this.refreshRequired = false;
+           //  print("HTML RENDERING");
+             
+             
+             //this.get('/BottomPane').el.show();
+             //this.get('/BottomPane').el.set_current_page(2);// webkit inspector
+            _this.file.webkit_page_id  = this.el.get_page_id();
+            
+            var js = _this.file.toSourcePreview();
+        
+            if (js.length < 1) {
+                print("no data");
+                return;
+            }
+        //    var  data = js[0];
+            this.redraws++;
+          
+            var project = _this.file.project;  
+        
+             //print (project.fn);
+             // set it to non-empty.
+             
+        //     runhtml = runhtml.length ?  runhtml : '<script type="text/javascript"></script>'; 
+        
+        
+        //   this.runhtml  = this.runhtml || '';
+         
+         
+            // then we need to reload the browser using
+            // load_html_string..
+        
+            // then trigger a redraw once it's loaded..
+            this.pendingRedraw = true;
+        
+            var runhtml = "<script type=\"text/javascript\">\n" ;
+            string builderhtml;
+            
+            
+            GLib.FileUtils.get_contents(Builder4.Application.configDirectory() + "/resources/roo.builder.js", out builderhtml);
+        
+            runhtml += builderhtml + "\n";
+            runhtml += "</script>\n" ;
+        
+            // fix to make sure they are the same..
+            this.runhtml = project.runhtml;
+            // need to modify paths
+        
+            string inhtml;
+            var base_template = _this.file.project.base_template;
+            
+            if (base_template.length > 0 && !FileUtils.test(
+                Builder4.Application.configDirectory() + "/resources/" +  base_template, FileTest.EXISTS)  
+                ) {
+                   print("invalid base_template name - using default:  %s\n", base_template);
+                   base_template = "";
+            
+            }
+            
+            GLib.FileUtils.get_contents(
+                Builder4.Application.configDirectory() + "/resources/" + 
+                    (base_template.length > 0 ? base_template :  "roo.builder.html")
+                    , out inhtml);
+            
+            
+            this.renderedData = js;
+        
+        
+            string js_src = js + "\n" +
+               "Roo.onReady(function() {\n" +
+               "if (" + _this.file.name +".show) " +  _this.file.name +".show({});\n" +
+               "Roo.XComponent.build();\n" +
+               "});\n";
+               
+           // print("render js: " + js);
+            //if (!this.ready) {
+          //      console.log('not loaded yet');
+            //}
+            this.lastRedraw = new DateTime.now_local();
+        
+                var html = inhtml.replace("</head>", runhtml + this.runhtml + 
+                
+                        "<script type=\"text/javascript\">\n" +
+                        js_src + "\n" + 
+                        "</script>" + 
+                                
+                "</head>");
+                //print("LOAD HTML " + html);
+                
+                 var rootURL = _this.file.project.rootURL;
+           
+                
+                
+                this.el.load_html( html , 
+                    //fixme - should be a config option!
+                    (rootURL.length > 0 ? rootURL : "http://localhost/app.Builder/")
+                );
+                
+            // force the inspector...        
+                  this.initInspector();
+                
+                // - no need for this, the builder javascript will call it when build is complete
+                //GLib.Timeout.add_seconds(1, () => {
+                //    this.el.run_javascript("Builder.saveHTML()",null);
+                //    return false;
+                //});
+        //     print( "before render" +    this.lastRedraw);
+        //    print( "after render" +    (new Date()));
+            
+        }
+        public void initInspector () {
+            
+            if (this.inspector == this.el.get_inspector()) {
+                this.inspector.show();
+                this.inspector.open_window();        
+                print("init inspecter called, and inspector is the same as existing\n");
+                return;
+            }
+            print("new inspector?\n");
+        
+            this.inspector = this.el.get_inspector();
+            this.inspector.ref();
+            
+            // got a new inspector...
+                
+            this.inspector.open_window.connect(() => {
+                 this.inspector = this.el.get_inspector();
+                print("inspector attach\n");
+                var wv = this.inspector.get_web_view();
+                if (wv != null) {
+                    print("got inspector web view\n");
+                    _this.inspectorcontainer.el.add(wv);
+                    wv.show();
+                } else {
+                    //this.inspector.close();
+                    
+                    //this.inspector = null;
+                   
+         
+                }
+                return true;
+               
+            });
+            this.inspector.closed.connect(() => {
+                 print("inspector closed?!?");
+                 // if this happens destroy the webkit..
+                 // recreate it..
+                 this.el.stop_loading();
+                 
+                 if (_this.viewbox.el.get_parent() == null) {
+                    return;
+                 }
+                 
+                 
+                _this.viewbox.el.remove(_this.viewcontainer.el);
+                _this.el.remove(_this.inspectorcontainer.el);        
+                 
+                 // destory seems to cause problems.
+                 //this.el.destroy();
+                //_this.viewcontainer.el.destroy();
+                 //_this.inspectorcontainer.el.destroy();
+        
+                 this.el = null;         
+                 var nv =new Xcls_viewcontainer(_this);
+                 nv.ref();
+                 _this.viewbox.el.pack_end(nv.el,true,true,0);
+                 
+                  var  inv =new Xcls_inspectorcontainer(_this);
+                  inv.ref();
+                  _this.el.pack2(inv.el,true,true);
+                 
+                 inv.el.show_all();
+                 nv.el.show_all();
+                 //while(Gtk.events_pending ()) Gtk.main_iteration ();
+                 //_this.view.renderJS(true); 
+                 _this.view.refreshRequired  = true;
+               
+            }); 
+            
+            this.inspector.show();
+        }
+        public void renderJS (bool force) {
+        
+            // this is the public redraw call..
+            // we refresh in a loop privately..
+            var autodraw = _this.AutoRedraw.el.active;
+            if (!autodraw && !force) {
+                print("Skipping redraw - no force, and autodraw off");
+                return;
+            }
+            this.refreshRequired  = true;
+        }
+    }
+    public class Xcls_inspectorcontainer : Object 
+    {
+        public Gtk.ScrolledWindow el;
+        private Xcls_WindowRooView  _this;
+
+
+            // my vars (def)
+
+        // ctor 
+        public Xcls_inspectorcontainer(Xcls_WindowRooView _owner )
+        {
+            _this = _owner;
+            _this.inspectorcontainer = this;
+            this.el = new Gtk.ScrolledWindow( null, null );
+
+            // my vars (dec)
+
+            // set gobject values
+            this.el.shadow_type = Gtk.ShadowType.IN;
+
+            // init method 
+
+            this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);        }
+
+        // user defined functions 
+    }
+}
diff --git a/old-javascript/Builder4/config1.builder b/old-javascript/Builder4/config1.builder
new file mode 100644 (file)
index 0000000..55aa9ce
--- /dev/null
@@ -0,0 +1,34 @@
+[
+    {
+        "name" : "Builder4",
+        "compile_flags" : "-g",
+        "target_bin" : "/tmp/Builder5",
+        "sources" : [
+        ],
+        "packages" : [
+        ]
+    },
+    {
+        "name" : "_default_",
+        "compile_flags" : "",
+        "target_bin" : "",
+        "sources" : [
+            "../Builder4",
+            "../Palete",
+            "../Project",
+            "../JsRender"
+        ],
+        "packages" : [
+            "clutter-gtk-1.0",
+            "gdk-3.0",
+            "gtk+-3.0",
+            "gtksourceview-3.0",
+            "libxml-2.0",
+            "json-glib-1.0",
+            "gobject-introspection-1.0",
+            "libsoup-2.4",
+            "posix",
+            "libvala-0.26"
+        ]
+    }
+]
\ No newline at end of file
diff --git a/old-javascript/JSDOC/Collapse.js b/old-javascript/JSDOC/Collapse.js
new file mode 100644 (file)
index 0000000..71a89fd
--- /dev/null
@@ -0,0 +1,260 @@
+//<script type="text/javscript">
+XObject = imports.XObject.XObject;
+
+console     = imports.console.console; 
+
+// make sure parent is loaded..
+TokenStream = imports.TokenStream.TokenStream;
+/**
+ * 
+ * base class for parsing segments of token array..
+ * 
+ * 
+ * We want to make parsing the whole thing easy..
+ * 
+ * so we do various tricks:
+ * 
+ * 
+ * a) white space collased
+ *    wsPrefix 
+ * b)  toks
+ *     { } - collapse into first element.
+       ( ) - collapse into first element.
+       [ ] - collapse into first element.
+ * c) items = , seperation within the above..
+ * 
+ * usage: x = new Collapse(token_array)
+ * 
+ * 
+ * 
+ * 
+ */ 
+Collapse = XObject.define(
+    function (ar)
+    {
+         
+        Collapse.superclass.constructor.call(this, ar);
+        
+        this.spaces();
+        var ar = this.collapse(this.tokens);
+        
+        this.tokens = ar;
+        
+       // console.dump(ar);
+        
+    }, 
+    TokenStream, 
+    {
+    
+        spaces : function () {
+            var ar = [];
+            var pref = [];
+            
+            var tok;
+            
+            for (var i = 0; i < this.tokens.length; i ++) {
+                tok = this.tokens[i];
+                if (tok.is("COMM") || tok.is("WHIT")) {
+                    pref.push(tok);
+                    continue;
+                }
+                tok.prefix = '';
+                if (pref.length) {
+                    pref.forEach( function(e) {
+                        if (!e) {
+                            return;
+                        }
+                        tok.prefix += e.data;
+                    })
+                }
+                
+                ar.push(tok);
+                pref=  [];
+                
+            }
+            this.tokens = ar;
+            
+        },
+        collapse : function(ar) {
+            
+            var st = new  TokenStream(ar);
+            var ret = [];
+            
+            while (true) {
+                var  tok = st.look(1,true);
+                if (!tok || !tok.is) {
+                  //  Seed.print(TokenStream.toString(ret));
+                    return ret;
+                }
+                // console.log(tok.data);
+                switch(tok.type) {
+                    case "VOID": 
+                        return ret; //EOF
+                        
+                        
+                    case "KEYW": 
+                    case "TOKN":
+                    case "NAME":
+                    case "STRN":
+                    case "NUMB":
+                    case "REGX":
+                        ret.push(st.next(1));
+                        continue;
+                        
+                    case "PUNC":
+                        switch (tok.data) {
+                            case "[":
+                            case "{":
+                            case "(":
+                                
+                                var start = st.cursor;
+                                st.next(1);
+                                var add = st.balance(tok.data);
+                                if (!add) {
+                                    console.dump(tok);
+                                    console.dump(start + '...' + st.cursor);
+                                    console.dump(st.tokens);
+                                 
+                                }
+                                if (add) {
+                                    add.shift();
+                                }
+                                //Seed.print("ADD");
+                                //Seed.print(JSON.stringify(add, null,4));
+                                
+                                
+                                
+                                var toks = add ? this.collapse(add) : [];
+                                tok.items = false;
+                                tok.props = false;
+                                
+                                
+                                
+                                if (tok.data != '{') {
+                                    // paramters or array elements..
+                                    tok.items = this.toItems(toks, [',']);
+                                } else {
+                                    // check for types.. it could be a list of statements.. or object
+                                    
+                                    var ost = new  TokenStream(toks);
+                                    //console.dump(ost.look(2,true) );
+                                    if (ost.look(2,true) && ost.look(2,true).data == ":") {
+                                        tok.props = this.toProps(toks);
+                                    } else {
+                                        // list of statemetns..
+                                        tok.items = this.toItems(toks,[ ';', '{'] );;
+                                    }
+                                    
+                                    
+                                }
+                                 
+                                
+                                
+                                
+                                
+                                
+                                
+                                //Seed.print(" ADD : " + add.length  +  " ITEMS: " + tok.items.length);
+                                
+                                ret.push(tok);
+                                
+                                continue;
+                   
+                            default:
+                                ret.push(st.next(1));
+                                continue;
+                        }
+                        Seed.print("OOPS");
+                        continue;
+                    default : 
+                        Seed.print("OOPS" + tok.type);
+                        continue;
+                }
+            }
+                
+                
+            
+            
+            
+            
+            
+            
+            
+            
+        },
+        toItems : function(ar,sep)
+        {
+            var ret = [];
+            var g = [];
+              
+            for (var i = 0; i < ar.length; i ++) {
+                if (sep.indexOf(ar[i].data) < 0) {
+                    g.push(ar[i]);
+                    continue;
+                }
+                // var a=..., b =...
+                if ((ar[i].data != ';') && g.length && (g[0].name == "VAR")) {;
+                    g.push(ar[i]);
+                    continue;
+                }
+                
+                g.push(ar[i]);
+                ret.push(g);
+                g = [];
+                
+            }
+            // last..
+            if (g.length) {
+                ret.push(g);
+            }
+            return ret;
+            
+        },
+        toProps : function(ar)
+        {
+            
+            var ret = { }
+               
+            var g = { key : '', val: [] }
+               
+            
+            var k = '';
+            var state = 0;
+            for (var i = 0; i < ar.length; i ++) {
+                
+                switch(state) {
+                    case 0:
+                        k = ar[i].data;
+                        g.key = ar[i];
+                        state = 1;
+                        continue;
+                    case 1:
+                        state =2; // should be ':'
+                        continue;
+                    case 2:
+                        g.val.push(ar[i]);
+                        if (ar[i].data != ',') {
+                            continue;
+                        }
+                        ret[k] = g;
+                        g = { key : '', val: [] }
+                        state = 0;
+                        continue;
+                   
+                }
+            }
+             // last.. - if g.val.length is 0 then it's a trailing ','...
+             // we should really throw a syntax error in that case..
+            if (k.length && g.val.length) {
+                ret[k] = g;
+            }
+            return ret;
+            
+            
+        }
+
+    
+    
+});
\ No newline at end of file
diff --git a/old-javascript/JSDOC/Identifier.js b/old-javascript/JSDOC/Identifier.js
new file mode 100644 (file)
index 0000000..7cc82bd
--- /dev/null
@@ -0,0 +1,25 @@
+//<Script type="text/javascript">
+
+/**
+ * @class  Identifier
+ * holds details about identifiers and their replacement values
+ * used by the packer..
+ * 
+ */
+
+
+function Identifier(name, scope) {
+   // print("NEW IDENT: " + name);
+    this.name = name;
+    this.scope = scope;
+    this.identifiers = {};
+    
+}
+Identifier.prototype = {
+    name: '',
+    refcount: 1,
+    mungedValue : '', // should be at least 1?!?!
+    scope : false,  // script of fn scope..
+    toMunge : true
+};
diff --git a/old-javascript/JSDOC/Lang.js b/old-javascript/JSDOC/Lang.js
new file mode 100644 (file)
index 0000000..ef21c06
--- /dev/null
@@ -0,0 +1,158 @@
+//<script type="text/javscript">
+
+/**
+       @namespace
+*/
+Lang = {
+    
+    
+    isBuiltin : function(name) {
+        return (this.coreObjects.indexOf(name) > -1);
+    }, 
+    coreObjects : ['_global_', 'Array', 'Boolean', 'Date', 'Error', 
+        'Function', 'Math', 'Number', 'Object', 'RegExp', 'String'],
+        
+
+    whitespace : function(ch) {
+        return this.whitespaceNames[ch];
+    },
+    
+    whitespaceNames : {
+        " ":      "SPACE",
+        "\f":     "FORMFEED",
+        "\t":     "TAB",
+        "\u0009": "UNICODE_TAB",
+        "\u000A": "UNICODE_NBR",
+        "\u0008": "VERTICAL_TAB"
+    },
+
+    newline : function(ch) {
+        return this.newlineNames[ch];
+    },
+    newlineNames : {
+        "\n":     "NEWLINE",
+        "\r":     "RETURN",
+        "\u000A": "UNICODE_LF",
+        "\u000D": "UNICODE_CR",
+        "\u2029": "UNICODE_PS",
+        "\u2028": "UNICODE_LS"
+    },
+
+    keyword : function(word) {
+        return this.keywordNames["="+word];
+    },
+    isKeyword: function(word) {
+        return typeof(this.keywordNames["="+word]) == 'undefined' ? false : true;
+    },
+
+    keywordNames : {
+        "=break":      "BREAK",
+        "=case":       "CASE",
+        "=catch":      "CATCH",
+        "=const":      "VAR",
+        "=continue":   "CONTINUE",
+        "=default":    "DEFAULT",
+        "=delete":     "DELETE",
+        "=do":         "DO",
+        "=else":       "ELSE",
+        "=eval":       "EVAL",
+        "=false":      "FALSE",
+        "=finally":    "FINALLY",
+        "=for":        "FOR",
+        "=function":   "FUNCTION",
+        "=if":         "IF",
+        "=in":         "IN",
+        "=instanceof": "INSTANCEOF",
+        "=new":        "NEW",
+        "=null":       "NULL",
+        "=return":     "RETURN",
+        "=switch":     "SWITCH",
+        "=this":       "THIS",
+        "=throw":      "THROW",
+        "=true":       "TRUE",
+        "=try":        "TRY",
+        "=typeof":     "TYPEOF",
+        "=void":       "VOID",
+        "=while":      "WHILE",
+        "=with":       "WITH",
+        "=var":        "VAR"
+    },
+
+    punc : function(ch) {
+        return this.puncNames[ch];
+    },
+    puncNames : {
+        ";":   "SEMICOLON",
+        ",":   "COMMA",
+        "?":   "HOOK",
+        ":":   "COLON",
+        "||":  "OR", 
+        "&&":  "AND",
+        "|":   "BITWISE_OR",
+        "^":   "BITWISE_XOR",
+        "&":   "BITWISE_AND",
+        "===": "STRICT_EQ", 
+        "==":  "EQ",
+        "=":   "ASSIGN",
+        "!==": "STRICT_NE",
+        "!=":  "NE",
+        "<<":  "LSH",
+        "<=":  "LE", 
+        "<":   "LT",
+        ">>>": "URSH",
+        ">>":  "RSH",
+        ">=":  "GE",
+        ">":   "GT", 
+        "++":  "INCREMENT",
+        "--":  "DECREMENT",
+        "+":   "PLUS",
+        "-":   "MINUS",
+        "*":   "MUL",
+        "/":   "DIV", 
+        "%":   "MOD",
+        "!":   "NOT",
+        "~":   "BITWISE_NOT",
+        ".":   "DOT",
+        "[":   "LEFT_BRACE",
+        "]":   "RIGHT_BRACE",
+        "{":   "LEFT_CURLY",
+        "}":   "RIGHT_CURLY",
+        "(":   "LEFT_PAREN",
+        ")":   "RIGHT_PAREN"
+    },
+
+    matching : function(name) {
+        name = typeof(this.puncNames[name]) == 'undefined' ? name : this.puncNames[name];
+        
+        return this.matchingNames[name];
+    },
+    matchingNames : {
+        "LEFT_PAREN": "RIGHT_PAREN",
+        "RIGHT_PAREN": "LEFT_PAREN",
+        "LEFT_CURLY": "RIGHT_CURLY",
+        "RIGHT_CURLY": "LEFT_CURLY",
+        "LEFT_BRACE": "RIGHT_BRACE",
+        "RIGHT_BRACE": "LEFT_BRACE"
+    },
+
+    isNumber : function(str) {
+        return /^(\.[0-9]|[0-9]+\.|[0-9])[0-9]*([eE][+-][0-9]+)?$/i.test(str);
+    },
+
+    isHexDec : function(str) {
+        return /^0x[0-9A-F]+$/i.test(str);
+    },
+
+    isWordChar : function(str) {
+        return /^[a-zA-Z0-9$_.]+$/.test(str);
+    },
+
+    isSpace : function(str) {
+        return (typeof this.whitespace(str) != "undefined");
+    },
+
+    isNewline : function(str) {
+        return (typeof this.newline(str) != "undefined");
+    }
+    
+};
\ No newline at end of file
diff --git a/old-javascript/JSDOC/TextStream.js b/old-javascript/JSDOC/TextStream.js
new file mode 100644 (file)
index 0000000..a916386
--- /dev/null
@@ -0,0 +1,49 @@
+//<script type="text/javscript">
+
+XObject = imports.XObject.XObject;
+
+
+/**
+       @constructor
+*/
+TextStream = XObject.define(
+    function(text) {
+        if (typeof(text) == "undefined") text = "";
+        text = ""+text;
+        this.text = text;
+        this.cursor = 0;
+    },
+    Object, 
+    { 
+        
+        look : function(n) {
+            if (typeof n == "undefined") n = 0;
+            
+            if (this.cursor+n < 0 || this.cursor+n >= this.text.length) {
+                var result = new String("");
+                result.eof = true;
+                return result;
+            }
+            return this.text.charAt(this.cursor+n);
+        },
+
+        next : function(n) {
+            if (typeof n == "undefined") n = 1;
+            if (n < 1) return null;
+            
+            var pulled = "";
+            for (var i = 0; i < n; i++) {
+                if (this.cursor+i < this.text.length) {
+                    pulled += this.text.charAt(this.cursor+i);
+                }
+                else {
+                    var result = new String("");
+                    result.eof = true;
+                    return result;
+                }
+            }
+
+            this.cursor += n;
+            return pulled;
+        }
+});
\ No newline at end of file
diff --git a/old-javascript/JSDOC/Token.js b/old-javascript/JSDOC/Token.js
new file mode 100644 (file)
index 0000000..7c15b20
--- /dev/null
@@ -0,0 +1,111 @@
+//<Script type="text/javascript">
+
+XObject = imports.XObject.XObject;
+console = imports.console.console;
+/**
+ *     @class Token
+ * 
+ *  @prop data {String} raw value of token
+ *  @prop type {String} type of token
+ *     TOKN  (unknown)          - name is UNKNOWN_TOKEN
+ * 
+ *     KEYW  (keyword)          - name is upper case version of keyword
+ *     NAME  (name/identifier)  - name is NAME
+ *     COMM  (comment)          - name is MULTI_LINE_COMM, JSDOC, SINGLE_LINE_COMM
+ *     PUNC  (puctuation)       - name is String description of punctionan (eg LEFTPARAM)
+ *     WHIT  (white space)      - name is SPACE,NEWLINE
+ *     STRN  (string)           - name is DOBULE_QUOTE, SINGLE_QUOTE
+ *     NUMB  (number)           - name is OCTAL,DECIMAL,HEC_DEC
+ *     REGX   (reg.expression)  - name is REGX
+ *  @prop name {String} see type details above
+ *  @prop identifier {Identifier} identifier class if relivant
+ * 
+ * 
+ * 
+ * old mappings:
+ * 
+ * Script.TOKidentifier  - type == 'NAME'
+ * Script.TOKassign  = data == '='
+ * Script.TOKsemicolon data == '';
+ * 
+ * 
+ * 
+*/
+
+Token = XObject.define(
+    function(data, type, name, line) {
+        this.data = data;
+        this.type = type;
+        this.name = name;
+        this.line = line;
+        this.prefix = '';    
+        this.outData = false; // used by packer/scopeparser
+        this.identifier = false; // used by scope
+        this.id = Token.id++;
+    }, 
+    Object, 
+    {
+         toString: function()
+        {
+            return 'line:' + this.line + ', type:' + this.type + 
+                ', name:' + this.name + ', data:' + this.data + 
+                ((this.outData === false) ? '' : ( 'outData : ' + this.outData));
+        },
+        
+        
+        toRaw : function(lvl)
+        {
+            lvl = lvl || 0;
+            
+            var ret =  this.data ;
+            
+            
+            if (this.items) {
+                var ar = [];
+                this.items.forEach(  function(ai) {
+                    
+                    var str = '';
+                    ai.forEach(  function(it) {
+                        str += it.toRaw(lvl + 1);
+                    })
+                    ar.push(str);
+                    
+                })
+                ret +=   ar.join('');
+                
+            }
+            if (this.props) {
+                for (var i in this.props) {
+                    ret += this.props[i].key.toRaw(lvl+1) + ' : ';
+                    this.props[i].val.forEach( function(e) {
+                        ret+=e.toRaw(lvl+1);
+                    })
+                    
+                }
+            }
+            
+            
+            
+            return this.prefix +   ret;
+             
+        },
+
+        toJS : function() {
+            
+            try {
+                var _tmp = '';
+                eval( "_tmp = " + this.data);
+                return _tmp;
+            } catch( e) {
+                return "ERROR unparsable" + this.data;
+            }
+        },
+         
+                        
+
+        is : function(what) {
+            return this.name === what || this.type === what;
+        }
+});
+Token.id = 0;     
\ No newline at end of file
diff --git a/old-javascript/JSDOC/TokenReader.js b/old-javascript/JSDOC/TokenReader.js
new file mode 100644 (file)
index 0000000..c38e13b
--- /dev/null
@@ -0,0 +1,489 @@
+//<script type="text/javascript">
+
+XObject = imports.XObject.XObject;
+console = imports.console.console;
+
+
+Token   = imports.Token.Token;
+Lang    = imports.Lang.Lang;
+
+/**
+       @class Search a {@link JSDOC.TextStream} for language tokens.
+*/
+TokenReader = XObject.define(
+    function(o) {
+        
+        XObject.extend(this, o || {});
+        
+    },
+    Object,
+    {
+        /** @cfg {Boolean} collapseWhite merge multiple whitespace/comments into a single token **/
+        collapseWhite : false, // only reduces white space...
+        /** @cfg {Boolean} keepDocs keep JSDOC comments **/
+        keepDocs : true,
+        /** @cfg {Boolean} keepWhite keep White space **/
+        keepWhite : false,
+        /** @cfg {Boolean} keepComments  keep all comments **/
+        keepComments : false,
+        /** @cfg {Boolean} sepIdents seperate identifiers (eg. a.b.c into ['a', '.', 'b', '.', 'c'] ) **/
+        sepIdents : false,
+        /** @cfg {String} filename name of file being parsed. **/
+        filename : '',
+        /** @config {Boolean} ignoreBadGrammer do not throw errors if we find stuff that might break compression **/
+        ignoreBadGrammer : false,
+        /**
+         * tokenize a stream
+         * @return {Array} of tokens
+         * 
+         * ts = new TextStream(File.read(str));
+         * tr = TokenReader({ keepComments : true, keepWhite : true });
+         * tr.tokenize(ts)
+         * 
+         */
+        tokenize : function(/**JSDOC.TextStream*/stream) {
+            this.line =1;
+            var tokens = [];
+            /**@ignore*/ 
+            tokens.last    = function() { return tokens[tokens.length-1]; }
+            /**@ignore*/ 
+            tokens.lastSym = function() {
+                for (var i = tokens.length-1; i >= 0; i--) {
+                    if (!(tokens[i].is("WHIT") || tokens[i].is("COMM"))) return tokens[i];
+                }
+            }
+
+            while (!stream.look().eof) {
+                if (this.read_mlcomment(stream, tokens)) continue;
+                if (this.read_slcomment(stream, tokens)) continue;
+                if (this.read_dbquote(stream, tokens))   continue;
+                if (this.read_snquote(stream, tokens))   continue;
+                if (this.read_regx(stream, tokens))      continue;
+                if (this.read_numb(stream, tokens))      continue;
+                if (this.read_punc(stream, tokens))      continue;
+                if (this.read_newline(stream, tokens))   continue;
+                if (this.read_space(stream, tokens))     continue;
+                if (this.read_word(stream, tokens))      continue;
+                
+                // if execution reaches here then an error has happened
+                tokens.push(new Token(stream.next(), "TOKN", "UNKNOWN_TOKEN", this.line));
+            }
+            
+            
+            
+            return tokens;
+        },
+
+        /**
+         * findPuncToken - find the id of a token (previous to current)
+         * need to back check syntax..
+         * 
+         * @arg {Array} tokens the array of tokens.
+         * @arg {String} token data (eg. '(')
+         * @arg {Number} offset where to start reading from
+         * @return {Number} position of token
+         */
+        findPuncToken : function(tokens, data, n) {
+            n = n || tokens.length -1;
+            var stack = 0;
+            while (n > -1) {
+                
+                if (!stack && tokens[n].data == data) {
+                    return n;
+                }
+                
+                if (tokens[n].data  == ')' || tokens[n].data  == '}') {
+                    stack++;
+                    n--;
+                    continue;
+                }
+                if (stack && (tokens[n].data  == '{' || tokens[n].data  == '(')) {
+                    stack--;
+                    n--;
+                    continue;
+                }
+                
+                
+                n--;
+            }
+            return -1;
+        },
+        /**
+         * lastSym - find the last token symbol
+         * need to back check syntax..
+         * 
+         * @arg {Array} tokens the array of tokens.
+         * @arg {Number} offset where to start..
+         * @return {Token} the token
+         */
+        lastSym : function(tokens, n) {
+            for (var i = n-1; i >= 0; i--) {
+                if (!(tokens[i].is("WHIT") || tokens[i].is("COMM"))) return tokens[i];
+            }
+            return null;
+        },
+        
+         
+        
+        /**
+            @returns {Boolean} Was the token found?
+         */
+        read_word : function(/**JSDOC.TokenStream*/stream, tokens) {
+            var found = "";
+            while (!stream.look().eof && Lang.isWordChar(stream.look())) {
+                found += stream.next();
+            }
+            
+            if (found === "") {
+                return false;
+            }
+            
+            var name;
+            if ((name = Lang.keyword(found))) {
+                if (found == 'return' && tokens.lastSym().data == ')') {
+                    //Seed.print('@' + tokens.length);
+                    var n = this.findPuncToken(tokens, ')');
+                    //Seed.print(')@' + n);
+                    n = this.findPuncToken(tokens, '(', n-1);
+                    //Seed.print('(@' + n);
+                    
+                    var lt = this.lastSym(tokens, n);
+                   Seed.print(JSON.stringify(lt));
+                    if (lt.type != 'KEYW' || ['IF', 'WHILE'].indexOf(lt.name) < -1) {
+                        if (!this.ignoreBadGrammer) {
+                            throw {
+                                name : "ArgumentError", 
+                                message: "\n" + this.filename + ':' + this.line + " Error - return found after )"
+                            }
+                        }
+                    }
+                    
+                    
+                    
+                }
+                
+                tokens.push(new Token(found, "KEYW", name, this.line));
+                return true;
+            }
+            if (!this.sepIdents || found.indexOf('.') < 0 ) {
+                tokens.push(new Token(found, "NAME", "NAME", this.line));
+                return true;
+            }
+            var n = found.split('.');
+            var p = false;
+            var _this = this;
+            n.forEach(function(nm) {
+                if (p) {
+                    tokens.push(new Token('.', "PUNC", "DOT", _this.line));
+                }
+                p=true;
+                tokens.push(new Token(nm, "NAME", "NAME", _this.line));
+            });
+            return true;
+                
+
+        },
+
+        /**
+            @returns {Boolean} Was the token found?
+         */
+        read_punc : function(/**JSDOC.TokenStream*/stream, tokens) {
+            var found = "";
+            var name;
+            while (!stream.look().eof && Lang.punc(found+stream.look())) {
+                found += stream.next();
+            }
+            
+            
+            if (found === "") {
+                return false;
+            }
+            
+            if ((found == '}' || found == ']') && tokens.lastSym().data == ',') {
+                //print("Error - comma found before " + found);
+                //print(JSON.stringify(tokens.lastSym(), null,4));
+                if (this.ignoreBadGrammer) {
+                    print("\n" + this.filename + ':' + this.line + " Error - comma found before " + found);
+                } else {
+                    
+                    throw {
+                        name : "ArgumentError", 
+                        message: "\n" + this.filename + ':' + this.line + " Error - comma found before " + found
+                    }
+                }
+            }
+            
+            tokens.push(new Token(found, "PUNC", Lang.punc(found), this.line));
+            return true;
+            
+        },
+
+        /**
+            @returns {Boolean} Was the token found?
+         */
+        read_space : function(/**JSDOC.TokenStream*/stream, tokens) {
+            var found = "";
+            
+            while (!stream.look().eof && Lang.isSpace(stream.look()) && !Lang.isNewline(stream.look())) {
+                found += stream.next();
+            }
+            
+            if (found === "") {
+                return false;
+            }
+            //print("WHITE = " + JSON.stringify(found)); 
+            if (this.collapseWhite) found = " ";
+            if (this.keepWhite) tokens.push(new Token(found, "WHIT", "SPACE", this.line));
+            return true;
+        
+        },
+
+        /**
+            @returns {Boolean} Was the token found?
+         */
+        read_newline : function(/**JSDOC.TokenStream*/stream, tokens) {
+            var found = "";
+            var line = this.line;
+            while (!stream.look().eof && Lang.isNewline(stream.look())) {
+                this.line++;
+                found += stream.next();
+            }
+            
+            if (found === "") {
+                return false;
+            }
+            //this.line++;
+            if (this.collapseWhite) {
+                found = "\n";
+            }
+            if (this.keepWhite) {
+                var last = tokens.pop();
+                if (last && last.name != "WHIT") {
+                    tokens.push(last);
+                }
+                
+                tokens.push(new Token(found, "WHIT", "NEWLINE", line));
+            }
+            return true;
+        },
+
+        /**
+            @returns {Boolean} Was the token found?
+         */
+        read_mlcomment : function(/**JSDOC.TokenStream*/stream, tokens) {
+            if (stream.look() == "/" && stream.look(1) == "*") {
+                var found = stream.next(2);
+                var c = '';
+                var line = this.line;
+                while (!stream.look().eof && !(stream.look(-1) == "/" && stream.look(-2) == "*")) {
+                    c = stream.next();
+                    if (c == "\n") this.line++;
+                    found += c;
+                }
+                
+                // to start doclet we allow /** or /*** but not /**/ or /****
+                if (/^\/\*\*([^\/]|\*[^*])/.test(found) && this.keepDocs) tokens.push(new Token(found, "COMM", "JSDOC", this.line));
+                else if (this.keepComments) tokens.push(new Token(found, "COMM", "MULTI_LINE_COMM", line));
+                return true;
+            }
+            return false;
+        },
+
+        /**
+            @returns {Boolean} Was the token found?
+         */
+        read_slcomment : function(/**JSDOC.TokenStream*/stream, tokens) {
+            var found;
+            if (
+                (stream.look() == "/" && stream.look(1) == "/" && (found=stream.next(2)))
+                || 
+                (stream.look() == "<" && stream.look(1) == "!" && stream.look(2) == "-" && stream.look(3) == "-" && (found=stream.next(4)))
+            ) {
+                var line = this.line;
+                while (!stream.look().eof && !Lang.isNewline(stream.look())) {
+                    found += stream.next();
+                }
+                if (!stream.look().eof) {
+                    found += stream.next();
+                }
+                if (this.keepComments) {
+                    tokens.push(new Token(found, "COMM", "SINGLE_LINE_COMM", line));
+                }
+                this.line++;
+                return true;
+            }
+            return false;
+        },
+
+        /**
+            @returns {Boolean} Was the token found?
+         */
+        read_dbquote : function(/**JSDOC.TokenStream*/stream, tokens) {
+            if (stream.look() == "\"") {
+                // find terminator
+                var string = stream.next();
+                
+                while (!stream.look().eof) {
+                    if (stream.look() == "\\") {
+                        if (Lang.isNewline(stream.look(1))) {
+                            do {
+                                stream.next();
+                            } while (!stream.look().eof && Lang.isNewline(stream.look()));
+                            string += "\\\n";
+                        }
+                        else {
+                            string += stream.next(2);
+                        }
+                    }
+                    else if (stream.look() == "\"") {
+                        string += stream.next();
+                        tokens.push(new Token(string, "STRN", "DOUBLE_QUOTE", this.line));
+                        return true;
+                    }
+                    else {
+                        string += stream.next();
+                    }
+                }
+            }
+            return false; // error! unterminated string
+        },
+
+        /**
+            @returns {Boolean} Was the token found?
+         */
+        read_snquote : function(/**JSDOC.TokenStream*/stream, tokens) {
+            if (stream.look() == "'") {
+                // find terminator
+                var string = stream.next();
+                
+                while (!stream.look().eof) {
+                    if (stream.look() == "\\") { // escape sequence
+                        string += stream.next(2);
+                    }
+                    else if (stream.look() == "'") {
+                        string += stream.next();
+                        tokens.push(new Token(string, "STRN", "SINGLE_QUOTE", this.line));
+                        return true;
+                    }
+                    else {
+                        string += stream.next();
+                    }
+                }
+            }
+            return false; // error! unterminated string
+        },
+
+        /**
+            @returns {Boolean} Was the token found?
+         */
+        read_numb : function(/**JSDOC.TokenStream*/stream, tokens) {
+            if (stream.look() === "0" && stream.look(1) == "x") {
+                return this.read_hex(stream, tokens);
+            }
+            
+            var found = "";
+            
+            while (!stream.look().eof && Lang.isNumber(found+stream.look())){
+                found += stream.next();
+            }
+            
+            if (found === "") {
+                return false;
+            }
+            else {
+                if (/^0[0-7]/.test(found)) tokens.push(new Token(found, "NUMB", "OCTAL", this.line));
+                else tokens.push(new Token(found, "NUMB", "DECIMAL", this.line));
+                return true;
+            }
+        },
+        /*t:
+            requires("../lib/JSDOC/TextStream.js");
+            requires("../lib/JSDOC/Token.js");
+            requires("../lib/JSDOC/Lang.js");
+            
+            plan(3, "testing read_numb");
+            
+            //// setup
+            var src = "function foo(num){while (num+8.0 >= 0x20 && num < 0777){}}";
+            var tr = new TokenReader();
+            var tokens = tr.tokenize(new TextStream(src));
+            
+            var hexToken, octToken, decToken;
+            for (var i = 0; i < tokens.length; i++) {
+                if (tokens[i].name == "HEX_DEC") hexToken = tokens[i];
+                if (tokens[i].name == "OCTAL") octToken = tokens[i];
+                if (tokens[i].name == "DECIMAL") decToken = tokens[i];
+            }
+            ////
+            
+            is(decToken.data, "8.0", "decimal number is found in source.");
+            is(hexToken.data, "0x20", "hexdec number is found in source (issue #99).");
+            is(octToken.data, "0777", "octal number is found in source.");
+        */
+
+        /**
+            @returns {Boolean} Was the token found?
+         */
+        read_hex : function(/**JSDOC.TokenStream*/stream, tokens) {
+            var found = stream.next(2);
+            
+            while (!stream.look().eof) {
+                if (Lang.isHexDec(found) && !Lang.isHexDec(found+stream.look())) { // done
+                    tokens.push(new Token(found, "NUMB", "HEX_DEC", this.line));
+                    return true;
+                }
+                else {
+                    found += stream.next();
+                }
+            }
+            return false;
+        },
+
+        /**
+            @returns {Boolean} Was the token found?
+         */
+        read_regx : function(/**JSDOC.TokenStream*/stream, tokens) {
+            var last;
+            if (
+                stream.look() == "/"
+                && 
+                (
+                    
+                    (
+                        !(last = tokens.lastSym()) // there is no last, the regex is the first symbol
+                        || 
+                        (
+                               !last.is("NUMB")
+                            && !last.is("NAME")
+                            && !last.is("RIGHT_PAREN")
+                            && !last.is("RIGHT_BRACKET")
+                        )
+                    )
+                )
+            ) {
+                var regex = stream.next();
+                
+                while (!stream.look().eof) {
+                    if (stream.look() == "\\") { // escape sequence
+                        regex += stream.next(2);
+                    }
+                    else if (stream.look() == "/") {
+                        regex += stream.next();
+                        
+                        while (/[gmi]/.test(stream.look())) {
+                            regex += stream.next();
+                        }
+                        
+                        tokens.push(new Token(regex, "REGX", "REGX", this.line));
+                        return true;
+                    }
+                    else {
+                        regex += stream.next();
+                    }
+                }
+                // error: unterminated regex
+            }
+            return false;
+        }
+});
\ No newline at end of file
diff --git a/old-javascript/JSDOC/TokenStream.js b/old-javascript/JSDOC/TokenStream.js
new file mode 100644 (file)
index 0000000..aee0b5a
--- /dev/null
@@ -0,0 +1,281 @@
+//<script type="text/javscript">
+
+
+XObject = imports.XObject.XObject;
+
+
+console = imports.console.console;
+Token   = imports.Token.Token;
+Lang    = imports.Lang.Lang;
+
+
+/**
+ * @class TokenStream
+ * 
+ * BC notes:
+ * 
+ * nextT => nextTok
+ * lookT => lookTok
+ * 
+ */
+       
+TokenStream = XObject.define(
+
+    /**
+     * @constructor
+     * 
+     * 
+     */
+
+    function(tokens) {
+     
+        
+        this.tokens = (tokens || []);
+       // Seed.print(this.tokens.length);
+        this.rewind();
+    },
+    Object,
+    {
+        cursor : -1, // where are we in the stream.
+        
+        rewind : function() {
+            this.cursor = -1;
+        },
+
+        /**
+            @type JSDOC.Token
+        */
+        look : function(/**Number*/n, /**Boolean*/considerWhitespace) {
+            if (typeof n == "undefined") n = 0;
+
+            if (considerWhitespace == true) {
+                if (this.cursor+n < 0 || this.cursor+n > (this.tokens.length -1)) {
+                    return new Token("", "VOID", "START_OF_STREAM");
+                }
+                return this.tokens[this.cursor+n];
+            }
+            else {
+                var count = 0;
+                var i = this.cursor;
+
+                while (true) {
+                    if (i < 0) return new Token("", "VOID", "START_OF_STREAM");
+                    else if (i > this.tokens.length) return new Token("", "VOID", "END_OF_STREAM");
+
+                    if (i != this.cursor && (this.tokens[i] === undefined || this.tokens[i].is("WHIT"))) {
+                        if (n < 0) i--; else i++;
+                        continue;
+                    }
+                    
+                    if (count == Math.abs(n)) {
+                        return this.tokens[i];
+                    }
+                    count++;
+                    (n < 0)? i-- : i++;
+                }
+
+                return new Token("", "VOID", "STREAM_ERROR"); // because null isn't an object and caller always expects an object
+            }
+        },
+
+        lookFor : function (data)
+        {
+            // non tree version..
+            var i = this.cursor < 0 ? 0 : this.cursor ;
+            
+            while (true) {
+                if (i >= this.tokens.length) return -1;
+                if (this.tokens[i].data == data) {
+                    return i;
+                }
+                i++;
+                
+            }
+            // should not get here!
+            return -1;
+
+        },
+
+
+        /**
+         * look ahead (or back) x number of tokens (which are not comment or whitespace)
+         * ?? used any more?
+         */
+        lookTok : function(/**Number*/n) {
+            if (typeof n == "undefined") n = 1;
+
+            
+            var count = 0;
+            var i = this.cursor;
+
+            while (true) {
+               // print(i);
+                if (i < 0) {
+                    if (n > -1) {
+                        i = 0; 
+                        count++;
+                        continue;
+                        
+                    }
+                    return   new Token("", "VOID", "END_OF_STREAM");
+                }
+                else if (i > this.tokens.length) return  new Token("", "VOID", "END_OF_STREAM");
+
+                if (i != this.cursor && (this.tokens[i] === undefined || this.tokens[i].is("WHIT") || this.tokens[i].is("COMM"))) {
+                    if (n < 0) i--; else i++;
+                    continue;
+                }
+                
+                if (count == Math.abs(n)) {
+                    return this.tokens[i];
+                }
+                count++;
+                (n < 0)? i-- : i++;
+            }
+        // should never get here..
+            return false; // because null isn't an object and caller always expects an object;
+            
+        },
+
+        /**
+         *  @return {Token|null}
+         * next token (with white space)
+         */
+            
+           
+        next : function(/**Number*/howMany) {
+            if (typeof howMany == "undefined") howMany = 1;
+            if (howMany < 1) return null;
+            var got = [];
+
+            for (var i = 1; i <= howMany; i++) {
+                if (this.cursor+i >= this.tokens.length) {
+                    return null;
+                }
+                got.push(this.tokens[this.cursor+i]);
+            }
+            this.cursor += howMany;
+
+            if (howMany == 1) {
+                return got[0];
+            }
+            else return got;
+        },
+        // what about comments after 'function'...
+        // is this used ???
+        nextTok  : function() {
+            return this.nextNonSpace();
+        },
+        nextNonSpace : function ()
+        {
+            
+            while (true) {
+                tok = this.next(1);
+                if (!tok) {
+                    return false;
+                }
+                if (tok.is('WHIT') ||  tok.is('COMM')) {
+                    continue;
+                }
+                return tok;
+            }
+        },
+        /**
+         *    @type JSDOC.Token[]
+         * @param start {String}  token name or data (eg. '{'
+         * @param stop {String} (Optional) token name or data (eg. '}'
+         */
+        balance : function(/**String*/start, /**String*/stop) {
+            
+            
+            start = typeof(Lang.punc(start)) == 'undefined' ? start : Lang.punc(start);
+            
+            if (!stop) stop = Lang.matching(start);
+            
+            var depth = 0;
+            var got = [];
+            var started = false;
+            //Seed.print("START:" + start);
+            //Seed.print("STOP:" + stop);
+            while ((token = this.look())) {
+                if (token.is(start)) {
+              //      Seed.print("balance: START : " + depth + " " + token.data);
+                    depth++;
+                    started = true;
+                }
+                
+                if (started) {
+                    got.push(token);
+                }
+                
+                if (token.is(stop)) {
+                    depth--;
+                //    Seed.print("balance: STOP: "  + depth + " " + token.data);
+                    if (depth < 1) return got;
+                }
+                if (!this.next()) break;
+            }
+        },
+
+        getMatchingToken : function(/**String*/start, /**String*/stop) {
+            var depth = 0;
+            var cursor = this.cursor;
+            
+            if (!start) {
+                start = Lang.matching(stop);
+                depth = 1;
+            }
+            if (!stop) stop = Lang.matching(start);
+            
+            while ((token = this.tokens[cursor])) {
+                if (token.is(start)) {
+                    depth++;
+                }
+                
+                if (token.is(stop) && cursor) {
+                    depth--;
+                    if (depth == 0) return this.tokens[cursor];
+                }
+                cursor++;
+            }
+        },
+
+        insertAhead : function(/**JSDOC.Token*/token) {
+            this.tokens.splice(this.cursor+1, 0, token);
+        },
+         
+        remaining : function() {
+            var ret = [];
+            while (true) {
+                var tok = this.look(1,true);
+                if (!tok || !tok.is || tok.is('VOID')) {
+                    return ret;
+                }
+                ret.push(this.next(1));
+            }
+        },
+         
+
+        arrayToString : function(ar) {
+            console.log(typeof(ar));
+            var ret = [];
+            ar.forEach(function(e) {
+                ret.push(e.data);
+            })
+            return ret.join('');
+        },
+        dump: function(start, end)
+        {
+            start = Math.max(start || 0, 0);
+            end = Math.min(end || this.tokens.length, this.tokens.length);
+            var out='';
+            for (var i =start;i < end; i++) {
+                
+                out += (this.tokens[i].outData == false) ? this.tokens[i].data : this.tokens[i].outData;
+            };
+            print(out);
+        }
+});
+    
\ No newline at end of file
diff --git a/old-javascript/JsRender/Base.js b/old-javascript/JsRender/Base.js
new file mode 100644 (file)
index 0000000..8faa39e
--- /dev/null
@@ -0,0 +1,413 @@
+//<Script type="text/javascript">
+
+
+var XObject     = imports.XObject.XObject;
+
+
+var Lang        = imports.JsRender.Lang.Lang;
+
+
+var JsParser    = imports.JsParser.JsParser;
+var TokenReader = imports.JSDOC.TokenReader.TokenReader;
+var TextStream  = imports.JSDOC.TextStream.TextStream;
+
+var File = imports.File.File;
+// File Provider..
+
+Base = XObject.define(
+    
+    function(cfg) {
+        
+        XObject.extend(this, cfg);
+        
+    },
+    Object,
+    {
+        /**
+         * @cfg {Array} doubleStringProps list of properties that can be double quoted.
+         */
+        doubleStringProps : false,
+        
+        id : false,
+        name : false,   // is the JS name of the file.
+        path : '',      // is the full path to the file.
+        parent : false, // JS parent.
+        
+        title : false,  // a title.. ?? nickname.. ??? - 
+        project: false, // name...
+        //Project : false, // link to container project!
+        
+        items : false, // the tree of nodes.
+        
+        cn : false, // array used by project tree.
+        
+        
+        save : function()
+        {
+            var write = { }; 
+            var _this = this;
+            var write = this.toJsonArray()
+            print("WRITE: " + this.path);// + "\n" + JSON.stringify(write));
+            File.write(this.path, JSON.stringify(write, null, 4));
+        },
+        
+        saveHTML : function()
+        {
+            // NOOP
+        },
+        
+        /**
+         *
+         * load from a javascript file.. rather than bjs..
+         * 
+         *
+         */
+         
+        _loadItems : function(cb)
+        {
+            // already loaded..
+            if (this.items !== false) {
+                return false;
+            }
+              
+            
+            
+            var tr = new  TokenReader(  { 
+                keepDocs :true, 
+                keepWhite : true,  
+                keepComments : true, 
+                sepIdents : false,
+                collapseWhite : false,
+                filename : args[0],
+                ignoreBadGrammer: true
+            });
+            
+            var str = File.read(this.path);
+            var toks = tr.tokenize(new TextStream(str));  
+            var rf = new JsParser(toks);
+            rf.parse();
+            var cfg = rf.cfg;
+            
+            this.modOrder = cfg.modOrder || '001';
+            this.name = cfg.name.replace(/\.bjs/, ''); // BC!
+            this.parent =  cfg.parent;
+            this.permname =  cfg.permname || '';
+            this.title =  cfg.title || cfg.name;;
+            this.items = cfg.items || []; 
+            //???
+            //this.fixItems(_this, false);
+            cb();
+            return true;    
+                
+        },
+        
+        /**
+         * accepts:
+         * { success : , failure : , scope : }
+         * 
+         * 
+         * 
+         */
+         
+        getTree : function( o ) {
+            print("File.getTree tree called on base object?!?!");
+        },
+        toJsonArray : function()
+        {
+            var ret = { }; 
+            var _this = this;
+            ['id', 'name', 'parent', 'title', 'path', 'items' , 'permname', 'modOrder' ].forEach( function(k) {
+                ret[k] = typeof(_this[k]) == 'undefined' ? '' : _this[k];
+            });
+            return ret;
+        },
+        getTitle : function()
+        {
+            if (this.title) {
+                return this.title;
+            }
+            return this.path.split('/').pop();
+            
+        },
+        getTitleTip: function()
+        {
+            if (this.title) {
+                return '<b>' + this.title + '</b> ' + this.path;
+            }
+            return this.path;
+        },
+        sortCn: function()
+        {
+            this.cn.sort(function(a,b) {
+                return a.path > b.path;// ? 1 : -1;
+            });
+        },
+        // should be in palete provider really..
+        
+        guessName : function(ar) // turns the object into full name.
+        {
+             // eg. xns: Roo, xtype: XXX -> Roo.xxx
+            if (typeof( ar['|xns'] ) == 'undefined' || typeof( ar['xtype'] ) == 'undefined') {
+                return '';
+               }
+             
+            return ar['|xns'] +'.' + ar['xtype'];
+                            
+                                 
+        },
+        
+        
+        
+        copyTo: function(path, cb)
+        {
+            var _this = this;
+            this.loadItems(function() {
+                
+                _this.path = path;
+                cb();
+            });
+            
+        },
+        
+        /**
+         * 
+         * munge JSON tree into Javascript code.
+         * 
+         * FIXME: + or / prefixes to properties hide it from renderer.
+         * FIXME: '*props' - not supported by this.. ?? - upto rendering code..
+         * FIXME: needs to understand what properties might be translatable (eg. double quotes)
+         * 
+         * @arg {object} obj the object or array to munge..
+         * @arg {boolean} isListener - is the array being sent a listener..
+         * @arg {string} pad - the padding to indent with. 
+         */
+        
+        
+        mungeToString:  function(obj, isListener, pad)
+        {
+            
+             
+            pad = pad || '    ';
+            var keys = [];
+            var isArray = false;
+            isListener = isListener || false;
+
+            if (!obj) {
+                print("missing obj?");
+                return;
+            }            
+
+            // am I munging a object or array...
+            if (obj.constructor && obj.constructor.toString() === Array.toString()) {
+                for (var i= 0; i < obj.length; i++) {
+                    keys.push(i);
+                }
+                isArray = true;
+            } else {
+                for (var i in obj) {
+                    keys.push(i);
+                }
+            }
+            
+            
+            var els = []; 
+            var skip = [];
+            if (!isArray && 
+                    typeof(obj['|xns']) != 'undefined' &&
+                    typeof(obj['xtype']) != 'undefined'
+                ) {
+                    this.mungeXtype(obj['|xns'] + '.' + obj['xtype'], els);
+                    //els.push('xtype: '+ obj['|xns'] + '.' + obj['xtype']);
+                     
+                    skip.push('|xns','xtype');
+                    
+                }
+            
+            
+            if (!isArray && obj.items && obj.items.length) {
+                // look for props..
+                var newitems = [];
+                for (var ii =0; ii< obj.items.length; ii++) {
+                    var pl = obj.items[ii];
+                    
+                    if (typeof(pl['*prop']) == 'undefined') {
+                        newitems.push(pl);
+                        continue;
+                    }
+                    
+                    //print(JSON.stringify(pl,null,4));
+                    // we have a prop...
+                    var prop = pl['*prop'] + '';
+                    delete pl['*prop'];
+                    if (!prop.match(/\[\]$/)) {
+                        // it's a standard prop..
+                        
+                        // munge property..??
+                        
+                        obj[prop] = pl;
+                        
+                        keys.push(prop);
+                        continue;
+                    }
+                    prop  = prop.substring(0, prop.length -2); //strip []
+                    // it's an array type..
+                    obj[prop] = obj[prop]  || [];
+                    obj[prop].push(pl);
+                  //  print("ADDNG PROP:" + prop + ' ' + keys.indexOf(prop) );
+                    if (keys.indexOf(prop) < 0) {
+                        keys.push(prop);
+                    }
+                    
+                    
+                    
+                }
+                
+                obj.items = newitems;
+                if (!obj.items.length) {
+                    delete obj.items;
+                }
+                
+            }
+            
+             
+            
+            //if (isArray) { print(JSON.stringify(keys, null,4)); }
+            // keys is just the real keys of the object.
+            var _this = this;
+            
+            var left =  '';
+            
+            for (var ii =0; ii< keys.length; ii++) {
+            
+                var i = keys[ii];
+              
+                if (typeof(obj[i]) == 'undefined') { // empty or removed.
+                    continue;
+                }
+                var el = obj[i];
+                if (!isArray && skip.indexOf(i) > -1) { // things we do not write..
+                    continue;
+                }
+                if (!isArray) {
+                    // set the key to be quoted with singel quotes..
+                    var leftv = i[0] == '|' ? i.substring(1) : i;
+                    // skip builder stuff. prefixed with  '.' .. just like unix fs..
+                    if (leftv[0] == '.') {
+                        continue;
+                    }
+                    if (Lang.isKeyword(leftv) || Lang.isBuiltin(leftv)) {
+                        left = "'" + leftv + "'";
+                    } else if (leftv.match(/[^A-Z_]+/i)) { // not plain a-z... - quoted.
+                        var val = JSON.stringify(leftv);
+                        left = "'" + val.substring(1, val.length-1).replace(/'/g, "\\'") + "'";
+                    } else {
+                        left = '' + leftv;
+                    }
+                    left += ' : ';
+                    
+                }
+                
+                
+                if (isListener) {
+                    // change the lines...
+                    var str= ('' + obj[i]).replace(/^\s+|\s+$/g,""); // remove bar.
+                    var lines = str.split("\n");
+                    if (lines.length > 1) {
+                        str = lines.join("\n" + pad);
+                    }
+                    
+                    els.push(left  + str);
+                    continue;
+                }
+                 
+                
+                
+                //var left = isArray ? '' : (JSON.stringify(i) + " : " )
+                
+                if (i[0] == '|') {
+                    // does not hapepnd with arrays..
+                    if (typeof(el) == 'string' && !obj[i].length) { //skip empty.
+                        continue;
+                    }
+                    // this needs to go...
+                    //if (typeof(el) == 'string'  && obj[i].match(new RegExp("Gtk.main" + "_quit"))) { // we can not handle this very well..
+                    //    continue;;
+                    //}
+                    
+                    var str= ('' + obj[i]).replace(/^\s+|\s+$/g,"");;
+                    var lines = str.split("\n");
+                    if (lines.length > 1) {
+                        str = lines.join("\n" + pad);
+                    }
+                    
+                    els.push(left + str);
+                    continue;
+                }
+                
+                
+                
+                
+                if (typeof(el) == 'object') {
+                    
+                    // we can skip empty items lists and empty listeners..
+                    //if (!isArray && i == 'items' && !el.length) {
+                    //    return; 
+                    //}
+                   // 
+                    var right = _this.mungeToString(el, i == 'listeners', pad + '    ');
+                    
+                    //if (!left.length && isArray) print(right);
+                    
+                    if ((typeof(right) != 'undefined') && right.length){
+                        els.push(left + right);
+                    }
+                
+                    continue;
+                }
+                // standard. .
+                if (typeof(obj[i]) != 'string') {
+                    els.push(left + JSON.stringify(obj[i]));
+                    continue;
+                }
+                // strings..
+                if (!_this.doubleStringProps) {
+                    els.push(left + JSON.stringify(obj[i]));
+                    continue;
+                }
+                if (_this.doubleStringProps.indexOf(i) > -1) {
+                    els.push(left + JSON.stringify(obj[i]));
+                    continue;
+                }
+                // single quote..
+                els.push(left + "'" + obj[i].replace(/'/g, "\\'") + "'");
+                
+
+            }
+            
+            if (!isArray && !els.length) {
+                return '';
+            }
+            //output the thing.
+            var spad = pad.substring(0, pad.length-4);
+            return (isArray ? '[' : '{') + "\n" +
+                pad  + els.join(",\n" + pad ) + 
+                "\n" + spad + (isArray ? ']' : '}');
+               
+            
+            
+        } 
+        
+         
+        
+    }
+    
+     
+    
+);
+
+
+
+
+
+
diff --git a/old-javascript/JsRender/Gtk.js b/old-javascript/JsRender/Gtk.js
new file mode 100644 (file)
index 0000000..5e9476f
--- /dev/null
@@ -0,0 +1,745 @@
+//<Script type="text/javascript">
+Gio = imports.gi.Gio;
+GLib = imports.gi.GLib;
+
+XObject = imports.XObject.XObject;
+File = imports.File.File;
+  
+//----------------------- our roo verison
+Base = imports.JsRender.Base.Base;
+
+var gid = 1;
+
+// ctors needed for Constructing vala?? - 
+
+var ctors = {
+    "Gtk.Label": [ "label" ],
+    "Gtk.Box": [ "orientation", "spacing:0" ],
+    "Gtk.MessageDialog" : [ "parent:null", "flags:Gtk.DialogFlags.MODAL", "message_type",  "buttons", "text" ],
+    "Gtk.ScrolledWindow": [ "hadjustment:null", "vadjustment:null" ],
+    "Gtk.SourceBuffer": [ "table:null" ],
+    "Gtk.Table": [ "n_rows", "n_columns" , "homogeneous" ],
+    "Gtk.ToolButton": [ "icon_widget:null", "label:null" ],
+    "Gtk.HBox": [ "homogeneous:true", "spacing:0" ],
+    "Gtk.VBox": [ "homogeneous:true", "spacing:0" ],
+    "Gtk.ListStore": [ "n_columns", "columns" ],
+    "Gtk.TreeStore": [ "n_columns", "columns" ],
+    "Gtk.FileChooserWidget" : [ "action"],
+    "Gtk.Window" : [ "type"],
+    "Clutter.FlowLayout" : [ "orientation"],
+    //"Gtk.Entry": [  ],
+};
+
+
+
+Gtk = XObject.define( 
+    
+    
+    function(cfg) {
+        
+        // id ,
+        //"name":"Edit Module Details",
+        // items : 
+        //"btype":"FORM", // was to be components...
+        //"app":"Builder",
+        //"module":"Pman.Tab.BuilderTop2"
+        //console.dump(cfg);
+        cfg.parent = cfg.parent || '';
+        if (!cfg.name || !cfg.fullname ) {
+            
+            // name is in theory filename without .bjs (or .js eventually...)
+            cfg.name = cfg.path.split('/').pop().replace(/\.(bjs|js)$/, '');
+            
+            cfg.fullname = (cfg.parent.length ? (cfg.parent + '.') : '' ) + cfg.name;
+        }
+        
+        
+        this.items = false;
+        if (cfg.json) {
+            var jstr =  JSON.parse(cfg.json);
+            this.items = [ jstr ];
+            //console.log(cfg.items.length);
+            delete cfg.json; // not needed!
+        }
+        this.cn = [];
+         /*
+        var p = cfg.items && cfg.items.length && cfg.items[0].parent ? cfg.items[0].parent : false;
+        
+        // ensure real data is set...
+        Roo.apply(this, {
+            name : cfg.module,
+            parent : p,
+            title : cfg.name,
+            project : cfg.app
+            
+        });
+        
+        this.cn = [];
+        */
+        Gtk.superclass.constructor.call(this, cfg);
+
+        
+        // super?!?!
+        this.id = 'file-gtk-' + gid++;
+        //console.dump(this);
+        // various loader methods..
+       
+    },
+    Base,   
+    {
+        xtype : 'Gtk',
+        setNSID : function(id)
+        {
+            
+            this.items[0]['*class'] = id;
+            
+            
+        },
+        getType: function() {
+            return 'Gtk';
+        },
+        
+        loadItems : function(cb)
+        {
+          
+            print("load Items!");
+            if (this.items !== false) {
+                return false;
+            }
+            if (!cb) {  
+                throw {
+                    name: "ArgumentError", 
+                    message : "no callback for loadItems"
+                };
+            }
+            Seed.print("load: " + this.path);
+            
+            
+
+            
+            var _this = this;     
+            var src = File.read(this.path);
+            
+            var cfg = JSON.parse(src);
+            print("loaded data");
+            //console.dump(cfg);
+            
+            //_this.name = cfg.name; -- this should not happen - name should always match filename!!
+            _this.parent =  cfg.parent;
+            _this.title =  cfg.title;
+            _this.items = cfg.items || []; 
+           
+             cb();
+             
+             
+            
+            
+            
+        },
+        /**
+         * convert xtype for munged output..
+         * 
+         */
+        mungeXtype : function(xtype, els)
+        {
+            els.push('xtype: '+ xtype);
+        },
+        
+        toSource : function()
+        {
+            
+            if (!this.items[0]) {
+                return false;
+            }
+            var data = JSON.parse(JSON.stringify(this.items[0]));
+            // we should base this on the objects in the tree really..
+            var i = [ 'Gtk', 'Gdk', 'Pango', 'GLib', 'Gio', 'GObject', 
+                'GtkSource', 'WebKit', 'Vte' ]; //, 'GtkClutter' , 'Gdl'];
+            var src = "";
+            i.forEach(function(e) {
+                src += e+" = imports.gi." + e +";\n";
+            });
+            
+            src += "console = imports.console;\n"; // path?!!?
+            src += "XObject = imports.XObject.XObject;\n"; // path?!!?
+            
+            
+            src += this.name + '=new XObject('+ this.mungeToString(data) + ");\n";
+            src += this.name + '.init();\n';
+            // register it in the cache
+            src += "XObject.cache['/" + this.name + "'] = " + this.name + ";\n";
+            
+            
+            return src;
+            
+            
+        },
+        save : function() {
+            Base.prototype.save.call(this);
+            this.saveJS();
+            this.saveVala();
+        },
+        
+        /** 
+         *  saveJS
+         * 
+         * save as a javascript file.
+         * why is this not save...???
+         * 
+         * 
+         */
+        saveJS: function()
+        {
+             
+            var fn = GLib.path_get_dirname(this.path) + '/' + this.name + '.js';
+            print("WRITE : " + fn);
+            File.write(fn, this.toSource());
+            
+            return fn;
+        },
+        
+        saveVala: function()
+        {
+             
+            var fn = GLib.path_get_dirname(this.path) + '/' + this.name + '.vala';
+            print("WRITE : " + fn);
+            File.write(fn, this.toVala());
+            
+            return fn;
+        },
+        valaCompileCmd : function()
+        {
+            
+            var fn = '/tmp/' + this.name + '.vala';
+            print("WRITE : " + fn);
+            File.write(fn, this.toVala(true));
+            
+            
+            
+            return ["valac",
+                   "--pkg",  "gio-2.0",
+                   "--pkg" , "posix" ,
+                   "--pkg" , "gtk+-3.0",
+                   "--pkg",  "libnotify",
+                   "--pkg",  "gtksourceview-3.0",
+                   "--pkg", "libwnck-3.0",
+                   fn ,   "-o", "/tmp/" + this.name];
+            
+           
+             
+            
+        },
+        
+        
+        /*
+        getTree : function( o ) {
+            
+            
+            
+        }
+        */
+        getHelpUrl : function(cls)
+        {
+            return 'http://devel.akbkhome.com/seed/' + cls + '.html';
+        },
+        
+        vcnt : false,
+        
+        toVala: function(testcompile)
+        {
+            var ret = '';
+            testcompile = testcompile || false;
+            
+            this.vcnt = 0;
+            //print(JSON.stringify(this.items[0],null,4));
+            //print(JSON.stringify(this.items[0],null,4));Seed.quit();
+
+            var item=  XObject.xclone(this.items[0]);
+            if (!item.id) {
+                item.id = this.name;
+                
+            }
+            
+            print(JSON.stringify(item,null,4));
+            
+            this.palete  = new imports.Palete.Gtk.Gtk({});
+            
+            this.vitems = [];
+            this.toValaName(item);
+           // print(JSON.stringify(item,null,4));Seed.quit();
+            
+            ret += "/* -- to compile\n";
+            ret += "valac  --pkg gio-2.0  --pkg posix  --pkg gtk+-3.0 --pkg libnotify --pkg gtksourceview-3.0  --pkg  libwnck-3.0 \\\n";
+            //ret += "    " + item.xvala_id + ".vala  -o /tmp/" + item.xvala_id +"\n";
+            ret += "    /tmp/" + this.name + ".vala  -o /tmp/" + this.name +"\n";
+            ret += "*/\n";
+            ret += "\n\n";
+            if (!testcompile) {
+                ret += "/* -- to test class\n";  
+            }
+            //
+            ret += "static int main (string[] args) {\n";
+            ret += "    Gtk.init (ref args);\n";
+            ret += "    new " + item.xvala_xcls +"();\n";
+            ret += "    " + this.name +".show_all();\n";
+            ret += "     Gtk.main ();\n";
+            ret += "    return 0;\n";
+            ret += "}\n";
+            if (!testcompile) {
+                ret += "*/\n";
+            }
+            ret += "\n\n";
+            
+            
+            // print(JSON.stringify(item,null,4));
+            this.toValaItem(item,0, function(s) {
+                ret+= s;
+            });
+            
+            return ret;
+            
+        },
+        
+        toValaNS : function(item)
+        {
+            var ns = item['|xns'] ;
+            if (ns == 'GtkSource') {
+                return 'Gtk.Source'
+               
+            }
+            return ns + '.';
+        },
+        
+        toValaName : function(item) {
+            this.vcnt++;
+            var cls = this.toValaNS(item) + item.xtype;  // eg. Gtk.Window
+            var id = item.id ? item.id : (item.xtype + this.vcnt);
+            var props = this.palete.getPropertiesFor(cls, 'props');
+            
+            var id_clsname = id;
+            if (id[0] == '+' || id[0] == '*') {
+                id_clsname = id_clsname.substring(1);
+            }
+            
+            item.xvala_cls = cls;
+            item.xvala_xcls = 'Xcls_' + id_clsname;
+            item.xvala_id = item.id ? item.id : false;
+            this.vitems.push(item);  
+            // loop children..
+            if (typeof(item.items) == 'undefined') {
+                return;
+            }
+            for(var i =0;i<item.items.length;i++) {
+                this.toValaName(item.items[i]);
+            }
+          
+        },
+        
+        
+        toValaItem : function(item, depth, strbuilder)
+        {
+        // print(JSON.stringify(item,null,4));
+            
+            var inpad = new Array( depth +1 ).join("    ");
+            
+            var pad = new Array( depth +2 ).join("    ");
+            var ipad = new Array( depth +3 ).join("    ");
+            
+            var cls = item.xvala_cls;
+            
+            var xcls = item.xvala_xcls;
+            
+            var citems = {};
+            
+            if (!depth) {
+                // Global Vars..
+                strbuilder(inpad + "public static " + xcls + "  " + this.name + ";\n\n");
+                 
+                
+            }
+            
+            // class header..
+            // class xxx {   WrappedGtk  el; }
+            strbuilder(inpad + "public class " + xcls + " : Object \n" + inpad + "{\n");
+            strbuilder(pad + "public " + cls + " el;\n");
+            if (!depth) {
+                               this.top_xcls = xcls;
+                       }
+            strbuilder(pad + "private " + this.top_xcls + "  _this;\n\n");
+            //}
+            
+            
+            // singleton
+            
+            if (!depth) {
+                strbuilder(pad + "public static " + xcls + " singleton()\n");
+                strbuilder(pad + "{\n");
+                strbuilder(ipad + "if (" + this.name + " == null) {\n");
+                strbuilder(ipad + "    " + this.name + "= new "+ xcls + "();\n"); // what about args?
+                strbuilder(ipad + "}\n");
+                strbuilder(ipad + "return " + this.name +";\n");
+                strbuilder(pad + "}\n");
+                
+            }
+            
+            
+            // properties - global..??
+                
+                //public bool paused = false;
+                //public static StatusIconA statusicon;
+            if (!depth) {
+                //strbuilder(pad + "public static " + xcls + "  _this;\n");
+                for(var i=1;i < this.vitems.length; i++) {
+                    if (this.vitems[i].xvala_id  === false) {
+                        continue;
+                        
+                    }
+                    if (this.vitems[i].xvala_id[0] == '*') {
+                        continue;
+                    }
+                    if (this.vitems[i].xvala_id[0] == '+') {
+                        continue;
+                    }
+                    strbuilder(pad + "public " + this.vitems[i].xvala_xcls + " " + this.vitems[i].xvala_id + ";\n");
+                }
+                
+            }
+            
+            strbuilder("\n" + ipad + "// my vars\n");
+            
+            
+            // Key = TYPE:name
+            for (var k in item) {
+                
+                
+                if (k[0] != '.') {
+                   
+                    continue;
+                }
+                if (k == '.ctor') {
+                    continue; 
+                }
+                
+                var kk = k.substring(1);
+                
+                var vv = kk.split(':');
+                if (vv[0] == 'signal') {
+                    strbuilder(pad + "public " + vv[0] + " " + vv[1] + " " + vv[2] + item[k] + ";\n");
+                } else {
+                
+                    strbuilder(pad + "public " + vv[0] + " " + vv[1] + ";\n");
+                }
+                citems[k] = true; 
+                
+            }
+            // if id of child is '+' then it's a property of this..
+            
+            if (typeof(item.items) != 'undefined') {
+                for(var i =0;i<item.items.length;i++) {
+                    var ci = item.items[i];
+                    if (ci.xvala_id[0] != '+') {
+                        continue; // skip generation of children?
+                        
+                    }
+                    strbuilder(pad + "public " + ci.xvala_xcls + " " + ci.xvala_id.substring(1) + ";\n");
+                               
+                    
+                }
+            }
+            
+            
+            
+            // .vala props.. 
+            
+            var cargs = []; 
+            var cargs_str = '';
+            // ctor..
+            strbuilder("\n" + ipad + "// ctor \n");
+            if (typeof(item['*args']) != 'undefined') {
+                cargs_str = ", " + item['*args']
+                var ar = item['*args'].split(",");
+                for (var ari =0; ari < ar.length; ari++) {
+                    cargs.push(ar[ari].trim().split(" ").pop());
+                }
+                    
+            }
+            
+                       if (!depth) {
+                       strbuilder(pad + "public " + xcls + "(" + cargs_str.substring(1) +")\n" + pad + "{\n");
+                       } else {
+                
+                    //code 
+                
+                               strbuilder(pad + "public " + xcls + "(" + this.top_xcls + " _owner " + cargs_str + ")\n" + pad + "{\n");
+                       }
+            
+            
+            
+            // public static?
+            if (!depth) {
+                strbuilder(ipad + "_this = this;\n");
+                //strbuilder(ipad + this.name  + " = this;\n");
+            } else {
+                strbuilder(ipad + "_this = _owner;\n");
+                if (item.xvala_id !== false && item.xvala_id[0] != '*' && item.xvala_id[0] != '+' ) {
+                    strbuilder(ipad + "_this." + item.xvala_id  + " = this;\n");
+                   
+                }
+                
+                
+            }
+            
+            // wrapped ctor..
+            // this may need to look up properties to fill in the arguments..
+            // introspection does not workk..... - as things like gtkmessagedialog
+            /*
+            if (cls == 'Gtk.Table') {
+                
+                var methods = this.palete.getPropertiesFor(cls, 'methods');
+                
+                print(JSON.stringify(this.palete.proplist[cls], null,4));
+                Seed.quit();
+            }
+            */
+            if (typeof(item['.ctor']) != 'undefined') {
+                strbuilder(ipad + "this.el = " + item['.ctor']+ ";\n" );
+            } else if (typeof(ctors[cls]) !== 'undefined') {
+                var args = [];
+                for(var i =0;i< ctors[cls].length;i++) {
+                    
+                    var nv = ctors[cls][i].split(':');
+                    
+                    if (typeof(item[nv[0]]) != 'undefined' && typeof(item[nv[0]]) != 'object' ) {
+                        citems[nv[0]] = true;
+                        args.push(JSON.stringify(item[nv[0]]));
+                        continue;
+                    }
+                    if (typeof(item['|' + nv[0]]) != 'undefined' && typeof(item['|' + nv[0]]) != 'object' ) {
+                        citems[nv[0]] = true;
+                        citems['|' + nv[0]] = true;
+                        args.push(item['|' + nv[0]]);
+                        continue;
+                    }
+                    args.push(nv.length > 1 ? nv[1] : 'null'); 
+                    
+                }
+                strbuilder(ipad + "this.el = new " + cls + "( "+ args.join(", ") + " );\n" );
+
+            } else {
+                strbuilder(ipad + "this.el = new " + cls + "();\n" );
+
+            }
+            //var meths = this.palete.getPropertiesFor(item['|xns'] + '.' + item.xtype, 'methods');
+            //print(JSON.stringify(meths,null,4));Seed.quit();
+            
+             
+            
+            // initialize.. my vars..
+            strbuilder("\n" + ipad + "// my vars\n");
+            for (var k in item) {
+                if (k[0] != '.') {
+                    continue;
+                }
+                if (k == '.ctor') {
+                    continue; 
+                }
+                
+                var kk = k.substring(1);
+                var v = item[k];
+                var vv = kk.split(':');
+                if (v.length < 1 || vv[0] == "signal") {
+                    continue;
+                }
+                strbuilder(ipad + "this." + vv[1] + " = " +   v +";\n");
+                
+            }
+           
+           
+            // what are the properties of this class???
+            strbuilder("\n" + ipad + "// set gobject values\n");
+            var props = this.palete.getPropertiesFor(item['|xns'] + '.' + item.xtype, 'props');
+            
+            
+            
+            props.forEach(function(p) {
+               
+                if (typeof(citems[p.name]) != 'undefined') {
+                    return;
+                }
+                     
+                if (typeof(item[p.name]) != 'undefined' && typeof(item[p.name]) != 'object' ) {
+                    citems[p.name] = true;
+                    
+                    var val = JSON.stringify(item[p.name]);
+                    if (['xalign','yalign'].indexOf(p.name) > -1) {
+                        val +='f';
+                    }
+                    strbuilder(ipad + "this.el." + p.name + " = " + val + ";\n");
+                    return;
+                }
+                if (typeof(item['|' + p.name]) != 'undefined' && typeof(item['|' + p.name]) != 'object' ) {
+                    citems['|' + p.name] = true;
+                    //if (p.ctor_only ) {
+                    //    strbuilder(ipad + "Object(" + p.name + " : " +  item['|' + p.name] + ");\n");
+                    //} else {
+                        strbuilder(ipad + "this.el." + p.name + " = " +  item['|' + p.name] + ";\n");
+                    //}
+                    return;
+                }
+               // got a property..
+               
+               
+            });
+                //code
+            // add all the child items.. 
+            if (typeof(item.items) != 'undefined') {
+                for(var i =0;i<item.items.length;i++) {
+                    var ci = item.items[i];
+                    if (ci.xvala_id[0] == '*') {
+                        continue; // skip generation of children?
+                    }
+                    
+                    var xargs = "";
+                    if (typeof(ci['*args']) != 'undefined') {
+                        
+                        var ar = ci['*args'].split(',');
+                        for (var ari = 0 ; ari < ar.length; ari++ ) {
+                            xargs += "," + ar[ari].trim().split(" ").pop();
+                        }
+                    }
+                    
+                    strbuilder(ipad + "var child_" + i + " = new " + ci.xvala_xcls + "( _this " + xargs + ");\n" );
+                    strbuilder(ipad + "child_" + i +".ref();\n" ); // we need to reference increase unnamed children...
+                    
+                    if (typeof(ci['*prop']) != 'undefined') {
+                        strbuilder(ipad + "this.el." + ci['*prop'] + " = child_" + i + ".el;\n" );
+                        continue
+                    }
+                    
+                    if (ci.pack === false || ci.pack == "false") {
+                        continue;
+                    }
+                    
+                    var packing = ci.pack ? ci.pack.split(',') : [ 'add' ];
+                    if (typeof(ci['|pack']) != 'undefined') {
+                        packing =ci['|pack'].split(',');
+                    }
+                    var pack = packing.shift();
+                    
+                    
+                    strbuilder(ipad + "this.el." + pack + " (  child_" + i + ".el " +
+                               (packing.length ? ", " + packing.join(",") : "") + " );\n"
+                            );
+                              
+                    if (ci.xvala_id[0] != '+') {
+                        continue; // skip generation of children?
+                        
+                    }
+                    strbuilder(ipad + "this." + ci.xvala_id.substring(1) + " =  child_" + i +  ";\n");
+                          
+                }
+            }
+            if (typeof(item['|init']) != 'undefined') {
+                
+                
+                    var v = item['|init']
+                    if (v.length > 1) {
+                        strbuilder("\n" + ipad + "// init method \n");            
+                         var vv = v;
+                         //print(JSON.stringify(vv));Seed.quit();
+                         vv = vv.replace(/^\n+/,'');
+                         vv = vv.replace(/\n+$/,'');
+                         vv = vv.replace(/\n/g,"\n" + ipad);
+                         strbuilder(ipad + vv  + "\n");
+                    }
+            }
+            
+            citems['|pack'] = true;
+            citems['|items'] = true;
+            citems['|init'] = true;
+            
+            if (item.listeners) {
+            //    print(JSON.stringify(item.listeners));Seed.quit();
+            
+                strbuilder("\n" + ipad + "// listeners \n");  
+                // add all the signal handlers..
+                for (var k in item.listeners) {
+                    
+                    
+                    var v = item.listeners[k] ;
+                    
+                    var vv = v.replace(/\n/g,"\n" + ipad);
+                        
+                        
+                    
+                    strbuilder(ipad + "this.el." + k + ".connect( " + vv  + " );\n");
+                    
+                }
+            }    
+                
+            
+            
+            
+            // end ctor..
+            strbuilder(pad + "}\n");
+            
+            
+            strbuilder("\n" + pad + "// userdefined functions \n");  
+            
+            // user defined functions...
+            
+            for (var k in item) {
+                if (typeof(citems[k]) != 'undefined') {
+                    //strbuilder("\n" + pad + "// skip " + k + " - already used \n"); 
+                    continue;
+                }
+                if (k[0] != '|') {
+                     //strbuilder("\n" + pad + "// skip " + k + " - not pipe \n"); 
+                    continue;
+                }
+                // function in the format of {type} (args) { .... }
+                 
+                var vv = item[k];
+                //print(JSON.stringify(vv));Seed.quit();
+                vv = vv.replace(/^\n+/,'');
+                vv = vv.replace(/\n+$/,'');
+                vv = vv.replace(/\n/g,"\n" + ipad);
+                
+                var vva = k.split(':');
+                if (vva.length  < 2) {
+                    strbuilder("\n" + pad + "// skip " + k + " - no return type\n"); 
+                    continue;
+                }
+                var rtype = vva.shift().substring(1);
+                var body = vv;
+                var fname = vva.shift() || '???';
+                
+                strbuilder(pad + "public " + rtype + " " + fname + body + "\n");
+                
+                
+                
+            }
+            
+            
+            
+            if (depth > 0) {
+                strbuilder(inpad + "}\n");
+            }
+            
+            
+            // next loop throug children..
+            if (typeof(item.items) != 'undefined') {
+                for(var i =0;i<item.items.length;i++) {
+                    this.toValaItem(item.items[i], 1, strbuilder);
+                }
+            }
+            if (depth < 1) {
+                strbuilder(inpad + "}\n");
+            }
+            
+        }
+        
+        
+        
+    });
\ No newline at end of file
diff --git a/old-javascript/JsRender/Gtk.vala b/old-javascript/JsRender/Gtk.vala
new file mode 100644 (file)
index 0000000..d9711ed
--- /dev/null
@@ -0,0 +1,241 @@
+
+
+namespace JsRender {
+
+
+    int gid = 1;
+
+  
+    public  class Gtk : JsRender
+    {
+       
+
+        public Gtk(Project.Project project, string path) {
+        
+            base( project, path);
+            this.xtype = "Gtk";
+            this.language = "vala";
+            
+            
+            //this.items = false;
+            //if (cfg.json) {
+            //    var jstr =  JSON.parse(cfg.json);
+            //    this.items = [ jstr ];
+            //    //console.log(cfg.items.length);
+            //    delete cfg.json; // not needed!
+            // }
+             
+            
+            
+            // super?!?!
+            this.id = "file-gtk-%d".printf(gid++);
+            //console.dump(this);
+            // various loader methods..
+
+            // Class = list of arguments ... and which property to use as a value.
+       
+
+            
+            
+        }
+          
+
+        /*
+        setNSID : function(id)
+        {
+            
+            this.items[0]['*class'] = id;
+            
+            
+        },
+        getType: function() {
+            return 'Gtk';
+        },
+        */
+
+       public   override void   removeFiles() {
+               var js = GLib.Path.get_dirname(this.path) +"/" +  name + ".js";
+               if (FileUtils.test(js, FileTest.EXISTS)) {
+                       GLib.FileUtils.remove(js);
+               }
+               var vala = GLib.Path.get_dirname(this.path) +"/" + name + ".vala";
+               if (FileUtils.test(vala, FileTest.EXISTS)) {
+                       GLib.FileUtils.remove(vala);
+               }
+       }
+        
+         public   override void  loadItems() throws GLib.Error // : function(cb, sync) == original was async.
+        {
+          
+            print("load Items!");
+            if (this.tree != null) {
+                return;
+            }
+            
+            print("load: " + this.path);
+
+
+            var pa = new Json.Parser();
+            pa.load_from_file(this.path);
+            var node = pa.get_root();
+            
+            if (node.get_node_type () != Json.NodeType.OBJECT) {
+                       throw new Error.INVALID_FORMAT ("Unexpected element type %s", node.type_name ());
+               }
+            var obj = node.get_object ();
+            //this.modOrder = obj.get_string_member("modOrder");
+            this.name = obj.get_string_member("name");
+            this.parent = obj.get_string_member("parent");
+            //this.permname = obj.get_string_member("permname");
+            this.title = obj.get_string_member("title");
+            //this.modOrder = obj.get_string_member("modOrder");
+             
+            // load items[0] ??? into tree...
+           var bjs_version_str = this.jsonHasOrEmpty(obj, "bjs-version");
+           bjs_version_str = bjs_version_str == "" ? "1" : bjs_version_str;
+
+           if (obj.has_member("items") 
+                       && 
+                       obj.get_member("items").get_node_type() == Json.NodeType.ARRAY
+                       &&
+                       obj.get_array_member("items").get_length() > 0
+               ) {
+                   var ar = obj.get_array_member("items");
+                   var tree_base = ar.get_object_element(0);
+                   this.tree = new Node();
+                   this.tree.loadFromJson(tree_base, int.parse(bjs_version_str));
+
+           }
+            
+            
+        }
+         
+         // convert xtype for munged output..
+         
+         /*
+        mungeXtype : function(xtype, els)
+        {
+            els.push('xtype: '+ xtype);
+        },
+        */
+               
+        public override string toSourcePreview()
+        {
+                       return "";
+               }
+      
+        public override string toSource()
+        {
+        
+            
+            if (this.tree == null) {
+                return "";
+            }
+            
+            // var data = JSON.parse(JSON.stringify(this.items[0]));
+            // we should base this on the objects in the tree really..
+            string[]  inc = { "Gtk", "Gdk", "Pango", "GLib", "Gio", "GObject", 
+                "GtkSource", "WebKit", "Vte" }; //, "GtkClutter" , "Gdl"];
+            var src = "";
+                        
+            for (var i=0; i< inc.length; i++) {
+                               var e = inc[i];
+                src += e+" = imports.gi." + e +";\n";
+            }
+            
+            src += "console = imports.console;\n"; // path?!!?
+            src += "XObject = imports.XObject.XObject;\n"; // path?!!?
+            
+            
+            src += this.name + "=new XObject("+ this.mungeToString("    ") + ");\n";
+            src += this.name + ".init();\n";
+            // register it in the cache
+            src += "XObject.cache['/" + this.name + "'] = " + this.name + ";\n";
+            
+            
+            return src;
+            
+            
+        }
+               
+        public override void save() {
+            this.saveBJS();
+            // this.saveJS(); - disabled at present.. project settings will probably enable this later..
+               
+            this.saveVala();
+        }
+           // ignore these calls.
+        public override void saveHTML ( string html ) {}
+           
+                   
+        /** 
+         *  saveJS
+         * 
+         * save as a javascript file.
+         * why is this not save...???
+         * 
+         */ 
+          
+        void saveJS()
+        {
+             
+            var fn = GLib.Path.get_dirname(this.path) + "/" + this.name + ".js";
+            print("WRITE :%s\n " , fn);
+            this.writeFile(fn, this.toSource());
+            
+        }
+        
+       void  saveVala()
+        {
+               if (this.tree == null) {
+                       return;
+               }
+               var fn = GLib.Path.get_dirname(this.path) + "/" + this.name + ".vala";
+               print("WRITE :%s\n " , fn);
+               this.writeFile(fn,  NodeToVala.mungeFile(this));
+            
+            
+        }
+               /*
+        valaCompileCmd : function()
+        {
+            
+            var fn = '/tmp/' + this.name + '.vala';
+            print("WRITE : " + fn);
+            File.write(fn, this.toVala(true));
+            
+            
+            
+            return ["valac",
+                   "--pkg",  "gio-2.0",
+                   "--pkg" , "posix" ,
+                   "--pkg" , "gtk+-3.0",
+                   "--pkg",  "libnotify",
+                   "--pkg",  "gtksourceview-3.0",
+                   "--pkg", "libwnck-3.0",
+                   fn ,   "-o", "/tmp/" + this.name];
+            
+           
+             
+            
+        },
+        */
+        
+   
+        string getHelpUrl(string cls)
+        {
+            return "http://devel.akbkhome.com/seed/" + cls + ".html";
+        }
+        
+       
+        
+         
+
+               
+
+       }
+}
+
+
+
diff --git a/old-javascript/JsRender/JsRender.vala b/old-javascript/JsRender/JsRender.vala
new file mode 100644 (file)
index 0000000..5cae000
--- /dev/null
@@ -0,0 +1,388 @@
+//<Script type="text/javascript">
+
+namespace JsRender {
+
+
+       public errordomain Error {
+               INVALID_FORMAT,
+               RENAME_FILE_EXISTS
+       }
+               
+       public abstract class JsRender  : Object {
+               /**
+                * @cfg {Array} doubleStringProps list of properties that can be double quoted.
+                */
+               public Gee.ArrayList<string> doubleStringProps;
+               
+               public string id;
+               public string name;   // is the JS name of the file.
+               public string fullname;
+               public string path;  // is the full path to the file.
+               public string parent;  // JS parent.
+               public string region;  // RooJS - insert region.
+        
+               public string title;  // a title.. ?? nickname.. ??? -
+
+               public string permname;
+               public string language;
+               public string modOrder;
+               public string xtype;
+               public uint64 webkit_page_id; // set by webkit view - used to extract extension/etc..
+                   
+               public Project.Project project;
+               //Project : false, // link to container project!
+               
+               public Node tree; // the tree of nodes.
+               
+               public GLib.List<JsRender> cn; // child files.. (used by project ... should move code here..)
+
+               public bool hasParent; 
+
+               public signal void changed (Node? node, string source); 
+
+               /**
+                * UI componenets
+                * 
+                */
+               //public Xcls_Editor editor;
+               
+               
+               
+               public JsRender(Project.Project project, string path) {
+                   
+                       this.cn = new GLib.List<JsRender>();
+                       this.path = path;
+                       this.project = project;
+                       this.hasParent = false;
+                       this.parent = "";
+                       this.tree = null;
+                       this.title = "";
+                       this.region = "";
+                       this.permname = "";
+                       this.modOrder = "";
+                       this.language = "";
+
+                       
+                       // should use basename reallly...
+                       
+                       var ar = this.path.split("/");
+                       // name is in theory filename without .bjs (or .js eventually...)
+                       try {
+                               Regex regex = new Regex ("\\.(bjs|js)$");
+
+                               this.name = ar.length > 0 ? regex.replace(ar[ar.length-1],ar[ar.length-1].length, 0 , "") : "";
+                       } catch (Error e) {
+                               this.name = "???";
+                       }
+                       this.fullname = (this.parent.length > 0 ? (this.parent + ".") : "" ) + this.name;
+
+                       this.doubleStringProps = new Gee.ArrayList<string>();
+
+               }
+               
+               public void renameTo(string name) 
+               {
+                       
+                       var bjs = GLib.Path.get_dirname(this.path) +"/" +  name + ".bjs";
+                       if (FileUtils.test(bjs, FileTest.EXISTS)) {
+                               throw new Error.RENAME_FILE_EXISTS("File exists %s\n",name);
+                       }
+                       GLib.FileUtils.remove(this.path);
+                       this.removeFiles();
+                       // remove other files?
+                       
+                       this.name = name;
+                       this.path = bjs;
+                       
+               }
+               
+
+               
+               // not sure why xt is needed... -> project contains xtype..
+               
+               public static JsRender factory(string xt, Project.Project project, string path)
+               {
+        
+                       switch (xt) {
+                               case "Gtk":
+                                       return new Gtk(project, path);
+                               case "Roo":
+                                       return new Roo(project, path);
+                       }
+                       throw new Error.INVALID_FORMAT("JsRender Factory called with xtype=%s", xt);
+                       return null;    
+               }
+
+               public string toJsonString()
+               {
+                       var generator = new Json.Generator ();
+                       generator.indent = 4;
+                       generator.pretty = true;
+                       var node = new Json.Node(Json.NodeType.OBJECT);
+                       node.set_object(this.toJsonObject());
+                       generator.set_root(node);
+                       return generator.to_data(null);
+               }
+       
+               public string nickType()
+               {
+                       var ar = this.name.split(".");
+                       string[] ret = {};
+                       for (var i =0; i < ar.length -1; i++) {
+                               ret += ar[i];
+                       }
+                       return string.joinv(".", ret);
+                       
+               }
+               public string nickName()
+               {
+                       var ar = this.name.split(".");
+                       return ar[ar.length-1];
+                       
+               }
+
+               
+               public string getIconFileName(bool return_default)
+               {
+                        
+                       var m5 = GLib.Checksum.compute_for_string(GLib.ChecksumType.MD5,this.path); 
+
+                       var dir = GLib.Environment.get_home_dir() + "/.Builder/icons";
+                       if (!FileUtils.test(dir, FileTest.IS_DIR)) {
+                                File.new_for_path(dir).make_directory();
+                       }
+                       var fname = dir + "/" + m5 + ".png";
+                       
+                       if (!return_default) {
+                               print("getIconFileName return %s\n", fname);
+                               return fname;
+                       }
+                       
+                       if (FileUtils.test(fname, FileTest.EXISTS)) {
+                               print("getIconFileName return %s\n", fname);
+                               return fname;
+                       }
+                       // we need to create this somehow...
+                       print("getIconFileName return %s\n", GLib.Environment.get_home_dir() + "/.Builder/test.jpg");
+                       return  GLib.Environment.get_home_dir() + "/.Builder/test.jpg";
+
+               }
+               
+
+               public void saveBJS()
+               {
+                    
+                   var generator = new Json.Generator ();
+                   generator.indent = 4;
+                   generator.pretty = true;
+                   var node = new Json.Node(Json.NodeType.OBJECT);
+                   node.set_object(this.toJsonObject());
+                   generator.set_root(node);
+                   
+                   print("WRITE :%s\n " , this.path);// + "\n" + JSON.stringify(write));
+                   try {
+                       this.writeFile(this.path, generator.to_data(null));
+                       //generator.to_file(this.path);
+                   } catch(Error e) {
+                       print("Save failed");
+                   }
+               }
+                
+                
+
+               public abstract void loadItems() throws GLib.Error;
+               
+               /**
+                *
+                * load from a javascript file.. rather than bjs..
+                * 
+                *
+                */
+                /*
+               _loadItems : function(cb)
+               {
+                   // already loaded..
+                   if (this.items !== false) {
+                       return false;
+                   }
+                     
+                   
+                   
+                   var tr = new  TokenReader(  { 
+                       keepDocs :true, 
+                       keepWhite : true,  
+                       keepComments : true, 
+                       sepIdents : false,
+                       collapseWhite : false,
+                       filename : args[0],
+                       ignoreBadGrammer: true
+                   });
+                   
+                   var str = File.read(this.path);
+                   var toks = tr.tokenize(new TextStream(str));  
+                   var rf = new JsParser(toks);
+                   rf.parse();
+                   var cfg = rf.cfg;
+                   
+                   this.modOrder = cfg.modOrder || '001';
+                   this.name = cfg.name.replace(/\.bjs/, ''); // BC!
+                   this.parent =  cfg.parent;
+                   this.permname =  cfg.permname || '';
+                   this.title =  cfg.title || cfg.name;;
+                   this.items = cfg.items || []; 
+                   //???
+                   //this.fixItems(_this, false);
+                   cb();
+                   return true;    
+                       
+               },
+               */
+                   /**
+                    * accepts:
+                    * { success : , failure : , scope : }
+                    * 
+                    * 
+                    * 
+                    */
+               /*     
+               void getTree ( o ) {
+                   print("File.getTree tree called on base object?!?!");
+               }
+       */
+               public string jsonHasOrEmpty(Json.Object obj, string key) {
+                       return obj.has_member(key) ? 
+                                               obj.get_string_member(key) : "";
+               }
+
+               
+               public Json.Object toJsonObject ()
+               {
+                   
+                   
+                       var ret = new Json.Object();
+                       //ret.set_string_member("id", this.id); // not relivant..
+                       ret.set_string_member("name", this.name);
+                       ret.set_string_member("parent", this.parent == null ? "" : this.parent);
+                       ret.set_string_member("title", this.title == null ? "" : this.title);
+                       ret.set_string_member("path", this.path);
+                       //ret.set_string_member("items", this.items);
+                       ret.set_string_member("permname", this.permname  == null ? "" : this.permname);
+                       ret.set_string_member("modOrder", this.modOrder  == null ? "" : this.modOrder);
+                       var ar = new Json.Array();
+                       // empty files do not have a tree.
+                       if (this.tree != null) {
+                               ar.add_object_element(this.tree.toJsonObject());
+                       }
+                       ret.set_array_member("items", ar);
+               
+                   return ret;
+               }
+               
+               
+
+               public string getTitle ()
+               {
+                   if (this.title.length > 0) {
+                       return this.title;
+                   }
+                   var a = this.path.split("/");
+                   return a[a.length-1];
+               }
+               public string getTitleTip()
+               {
+                   if (this.title.length > 0) {
+                       return "<b>" + this.title + "</b> " + this.path;
+                   }
+                   return this.path;
+               }
+               /*
+                   sortCn: function()
+                   {
+                       this.cn.sort(function(a,b) {
+                           return a.path > b.path;// ? 1 : -1;
+                       });
+                   },
+               */
+                   // should be in palete provider really..
+
+
+               public Palete.Palete palete()
+               {
+                       return Palete.factory(this.xtype);
+
+               }
+               
+               public string guessName(Node ar) // turns the object into full name.
+               {
+                    // eg. xns: Roo, xtype: XXX -> Roo.xxx
+                   if (!ar.hasXnsType()) {
+                      return "";
+                   }
+                   
+                   return ar.get("* xns") + "." + ar.get("* xtype");
+                                     
+                                       
+               }
+               /**
+                *  non-atomic write (replacement for put contents, as it creates temporary files.
+                */
+               public void writeFile(string path, string contents) throws GLib.IOError, GLib.Error
+               {
+
+                                
+                       var f = GLib.File.new_for_path(path);
+                       var data_out = new GLib.DataOutputStream(
+                                          f.replace(null, false, GLib.FileCreateFlags.NONE, null)
+                      );
+                       data_out.put_string(contents, null);
+                       data_out.close(null);
+               }
+               /*
+               copyTo: function(path, cb)
+               {
+                   var _this = this;
+                   this.loadItems(function() {
+                       
+                       _this.path = path;
+                       cb();
+                   });
+                   
+               },
+               */
+               
+               /**
+                * 
+                * munge JSON tree into Javascript code.
+                *
+                * NOTE - needs a deep copy of original tree, before starting..
+                *     - so that it does not modify current..
+                * 
+                * FIXME: + or / prefixes to properties hide it from renderer.
+                * FIXME: '*props' - not supported by this.. ?? - upto rendering code..
+                * FIXME: needs to understand what properties might be translatable (eg. double quotes)
+                * 
+                * @arg {object} obj the object or array to munge..
+                * @arg {boolean} isListener - is the array being sent a listener..
+                * @arg {string} pad - the padding to indent with. 
+                */
+               
+               public string mungeToString(string pad)
+               {
+                       if (this.tree == null) {
+                               return "";
+                       }
+                       var x = new NodeToJs(this.tree, this.doubleStringProps, pad);
+                       return x.munge();
+                       
+                   
+               }
+               public abstract void save();
+               public abstract void saveHTML(string html);
+               public abstract string toSource() ;
+               public abstract string toSourcePreview() ;
+               public abstract void removeFiles() ;
+                 
+       } 
+
+}
diff --git a/old-javascript/JsRender/Lang.js b/old-javascript/JsRender/Lang.js
new file mode 100644 (file)
index 0000000..51f9ad5
--- /dev/null
@@ -0,0 +1,155 @@
+//<script type="text/javscript">
+
+/**
+       @namespace
+*/
+Lang = {
+    
+    
+    isBuiltin : function(name) {
+        return (this.coreObjects.indexOf(name) > -1);
+    }, 
+    coreObjects : ['_global_', 'Array', 'Boolean', 'Date', 'Error', 
+        'Function', 'Math', 'Number', 'Object', 'RegExp', 'String'],
+        
+
+    whitespace : function(ch) {
+        return this.whitespaceNames[ch];
+    },
+    
+    whitespaceNames : {
+        " ":      "SPACE",
+        "\f":     "FORMFEED",
+        "\t":     "TAB",
+        "\u0009": "UNICODE_TAB",
+        "\u000A": "UNICODE_NBR",
+        "\u0008": "VERTICAL_TAB"
+    },
+
+    newline : function(ch) {
+        return this.newlineNames[ch];
+    },
+    newlineNames : {
+        "\n":     "NEWLINE",
+        "\r":     "RETURN",
+        "\u000A": "UNICODE_LF",
+        "\u000D": "UNICODE_CR",
+        "\u2029": "UNICODE_PS",
+        "\u2028": "UNICODE_LS"
+    },
+
+    keyword : function(word) {
+        return this.keywordNames["="+word];
+    },
+    isKeyword: function(word) {
+        return typeof(this.keywordNames["="+word]) == 'undefined' ? false : true;
+    },
+
+    keywordNames : {
+        "=break":      "BREAK",
+        "=case":       "CASE",
+        "=catch":      "CATCH",
+        "=const":      "VAR",
+        "=continue":   "CONTINUE",
+        "=default":    "DEFAULT",
+        "=delete":     "DELETE",
+        "=do":         "DO",
+        "=else":       "ELSE",
+        "=false":      "FALSE",
+        "=finally":    "FINALLY",
+        "=for":        "FOR",
+        "=function":   "FUNCTION",
+        "=if":         "IF",
+        "=in":         "IN",
+        "=instanceof": "INSTANCEOF",
+        "=new":        "NEW",
+        "=null":       "NULL",
+        "=return":     "RETURN",
+        "=switch":     "SWITCH",
+        "=this":       "THIS",
+        "=throw":      "THROW",
+        "=true":       "TRUE",
+        "=try":        "TRY",
+        "=typeof":     "TYPEOF",
+        "=void":       "VOID",
+        "=while":      "WHILE",
+        "=with":       "WITH",
+        "=var":        "VAR"
+    },
+
+    punc : function(ch) {
+        return this.puncNames[ch];
+    },
+    puncNames : {
+        ";":   "SEMICOLON",
+        ",":   "COMMA",
+        "?":   "HOOK",
+        ":":   "COLON",
+        "||":  "OR", 
+        "&&":  "AND",
+        "|":   "BITWISE_OR",
+        "^":   "BITWISE_XOR",
+        "&":   "BITWISE_AND",
+        "===": "STRICT_EQ", 
+        "==":  "EQ",
+        "=":   "ASSIGN",
+        "!==": "STRICT_NE",
+        "!=":  "NE",
+        "<<":  "LSH",
+        "<=":  "LE", 
+        "<":   "LT",
+        ">>>": "URSH",
+        ">>":  "RSH",
+        ">=":  "GE",
+        ">":   "GT", 
+        "++":  "INCREMENT",
+        "--":  "DECREMENT",
+        "+":   "PLUS",
+        "-":   "MINUS",
+        "*":   "MUL",
+        "/":   "DIV", 
+        "%":   "MOD",
+        "!":   "NOT",
+        "~":   "BITWISE_NOT",
+        ".":   "DOT",
+        "[":   "LEFT_BRACE",
+        "]":   "RIGHT_BRACE",
+        "{":   "LEFT_CURLY",
+        "}":   "RIGHT_CURLY",
+        "(":   "LEFT_PAREN",
+        ")":   "RIGHT_PAREN"
+    },
+
+    matching : function(name) {
+        return this.matchingNames[name];
+    },
+    matchingNames : {
+        "LEFT_PAREN": "RIGHT_PAREN",
+        "RIGHT_PAREN": "LEFT_PAREN",
+        "LEFT_CURLY": "RIGHT_CURLY",
+        "RIGHT_CURLY": "LEFT_CURLY",
+        "LEFT_BRACE": "RIGHT_BRACE",
+        "RIGHT_BRACE": "LEFT_BRACE"
+    },
+
+    isNumber : function(str) {
+        return /^(\.[0-9]|[0-9]+\.|[0-9])[0-9]*([eE][+-][0-9]+)?$/i.test(str);
+    },
+
+    isHexDec : function(str) {
+        return /^0x[0-9A-F]+$/i.test(str);
+    },
+
+    isWordChar : function(str) {
+        return /^[a-zA-Z0-9$_.]+$/.test(str);
+    },
+
+    isSpace : function(str) {
+        return (typeof this.whitespace(str) != "undefined");
+    },
+
+    isNewline : function(str) {
+        return (typeof this.newline(str) != "undefined");
+    }
+    
+};
\ No newline at end of file
diff --git a/old-javascript/JsRender/Lang.vala b/old-javascript/JsRender/Lang.vala
new file mode 100644 (file)
index 0000000..14099bb
--- /dev/null
@@ -0,0 +1,230 @@
+//<script type="text/javscript">
+
+/**
+       @namespace
+*/
+// test
+// valac gitlive/app.Builder.js/JsRender/Lang.vala --pkg gee-1.0 -o /tmp/Lang ;/tmp/Lang
+
+/*
+void main () {
+     new JsRender.Lang_Class();
+    print(JsRender.Lang.keyword("delete") + "\n");
+}
+*/
+namespace JsRender { 
+    public Lang_Class Lang = null;
+    
+    public class Lang_Class : Object {
+        
+        GLib.List<string> coreObjects;
+        Gee.HashMap<string,string> whitespaceNames;
+        Gee.HashMap<string,string> newlineNames;
+        Gee.HashMap<string,string> keywordNames;
+        Gee.HashMap<string,string> puncNames;
+        Gee.HashMap<string,string> matchingNames;
+        public Lang_Class ()
+        {
+            if (Lang != null) {
+                //print("lang not null\n");
+                return;
+            }
+            //print("init\n");
+            this.init();
+            //print("init Lang");
+            Lang = this;
+            
+        }
+        
+        
+        public bool isBuiltin(string  name) {
+            return (this.coreObjects.index(name) > -1);
+        }
+        
+        public string whitespace (string ch) {
+            return this.whitespaceNames.get(ch);
+        }
+        public string  newline (string ch) {
+            return this.newlineNames.get(ch);
+        }
+        public string keyword(string word) {
+            return this.keywordNames.get("="+word);
+        }
+        
+        public string matching(string name) {
+            return this.matchingNames.get(name);
+        }
+        
+        public bool isKeyword(string word) {
+            return this.keywordNames.get("=" + word) != null;
+            
+        }
+        public string punc (string ch) {
+            return this.puncNames[ch];
+        }
+        
+        public bool isNumber (string str) {
+            return Regex.match_simple("^(\\.[0-9]|[0-9]+\\.|[0-9])[0-9]*([eE][+-][0-9]+)?$",str);
+        }
+    
+        public bool  isHexDec (string str) {
+            return Regex.match_simple("^0x[0-9A-F]+$",str);
+        }
+    
+        public bool isWordChar (string str) {
+            return Regex.match_simple("^[a-zA-Z0-9$_.]+$", str);
+        }
+    
+        public bool isSpace (string str) {
+            return this.whitespaceNames.get(str) != null;
+        }
+    
+        public bool isNewline (string str) {
+            return this.newlineNames.get(str) != null;
+        }
+         public bool isBoolean (string str) {
+               var ss = str.down();
+            return ss == "false" || ss == "true";
+        }
+        
+        
+        void init() {
+            
+            this.coreObjects = new GLib.List<string>();
+            
+            this.whitespaceNames = new Gee.HashMap<string,string>();
+            this.newlineNames = new Gee.HashMap<string,string>();
+            this.keywordNames = new Gee.HashMap<string,string>();
+            this.puncNames = new Gee.HashMap<string,string>();
+            this.matchingNames = new Gee.HashMap<string,string>();
+            
+            
+            
+            string[] co = { "_global_", "Array", "Boolean", "Date", "Error", 
+                "Function", "Math", "Number", "Object", "RegExp", "String" };
+            for(var i =0; i< co.length;i++ ) {
+                this.coreObjects.append(co[i]);
+            }
+            string[] ws =  {
+                " :SPACE",
+                "\f:FORMFEED",
+                "\t:TAB" //,
+              //  "\u0009:UNICODE_TAB",
+              //  "\u000A:UNICODE_NBR",
+              //  "\u0008:VERTICAL_TAB"
+            };
+            for(var i =0; i< ws.length;i++ ) {
+                var x = ws[i].split(":");
+                this.whitespaceNames.set(x[0],x[1]);
+            }
+            
+            ws = {
+                "\n:NEWLINE",
+                "\r:RETURN" //,
+    //            "\u000A:UNICODE_LF",
+      //          "\u000D:UNICODE_CR",
+        //        "\u2029:UNICODE_PS",
+          //      "\u2028:UNICODE_LS"
+            };
+            for(var i =0; i< ws.length;i++ ) {
+                var x = ws[i].split(":");
+                this.newlineNames.set(x[0],x[1]);
+            }
+            ws = {
+                "=break:BREAK",
+                "=case:CASE",
+                "=catch:CATCH",
+                "=const:VAR",
+                "=continue:CONTINUE",
+                "=default:DEFAULT",
+                "=delete:DELETE",
+                "=do:DO",
+                "=else:ELSE",
+                "=false:FALSE",
+                "=finally:FINALLY",
+                "=for:FOR",
+                "=function:FUNCTION",
+                "=if:IF",
+                "=in:IN",
+                "=instanceof:INSTANCEOF",
+                "=new:NEW",
+                "=null:NULL",
+                "=return:RETURN",
+                "=switch:SWITCH",
+                "=this:THIS",
+                "=throw:THROW",
+                "=true:TRUE",
+                "=try:TRY",
+                "=typeof:TYPEOF",
+                "=void:VOID",
+                "=while:WHILE",
+                "=with:WITH",
+                "=var:VAR"
+             };
+            for(var i =0; i< ws.length;i++ ) {
+                var x = ws[i].split(":");
+                this.keywordNames.set(x[0],x[1]);
+            }
+        
+      
+            ws={
+                "; SEMICOLON",
+                ", COMMA",
+                "? HOOK",
+                ": COLON",
+                "|| OR", 
+                "&& AND",
+                "| BITWISE_OR",
+                "^ BITWISE_XOR",
+                "& BITWISE_AND",
+                "=== STRICT_EQ", 
+                "== EQ",
+                "= ASSIGN",
+                "!== STRICT_NE",
+                "!= NE",
+                "<< LSH",
+                "<= LE", 
+                "< LT",
+                ">>> URSH",
+                ">> RSH",
+                ">= GE",
+                "> GT", 
+                "++ INCREMENT",
+                "-- DECREMENT",
+                "+ PLUS",
+                "- MINUS",
+                "* MUL",
+                "/ DIV", 
+                "% MOD",
+                "! NOT",
+                "~ BITWISE_NOT",
+                ". DOT",
+                "[ LEFT_BRACE",
+                "] RIGHT_BRACE",
+                "{ LEFT_CURLY",
+                "} RIGHT_CURLY",
+                "( LEFT_PAREN",
+                ") RIGHT_PAREN"
+            };
+            for(var i =0; i< ws.length;i++ ) {
+                var x = ws[i].split(" ");
+                this.puncNames.set(x[0],x[1]);
+            }
+        
+           ws = {
+               "LEFT_PAREN:RIGHT_PAREN",
+               "RIGHT_PAREN:LEFT_PAREN",
+               "LEFT_CURLY:RIGHT_CURLY",
+               "RIGHT_CURLY:LEFT_CURLY",
+               "LEFT_BRACE:RIGHT_BRACE",
+               "RIGHT_BRACE:LEFT_BRACE"
+           };
+           for(var i =0; i< ws.length;i++ ) {
+               var x = ws[i].split(":");
+               this.matchingNames.set(x[0],x[1]);
+           }
+        }
+        
+        
+    }
+}
\ No newline at end of file
diff --git a/old-javascript/JsRender/Node.vala b/old-javascript/JsRender/Node.vala
new file mode 100644 (file)
index 0000000..5328abb
--- /dev/null
@@ -0,0 +1,527 @@
+
+// test..
+// valac gitlive/app.Builder.js/JsRender/Lang.vala gitlive/app.Builder.js/JsRender/Node.vala --pkg gee-1.0 --pkg=json-glib-1.0 -o /tmp/Lang ;/tmp/Lang
+
+
+/*
+ * 
+ * props:
+ * 
+ * key value view of properties.
+ * 
+ * Old standard..
+ * XXXXX : YYYYY  -- standard - should be rendered as XXXX : "YYYY" usually.
+ * |XXXXX : YYYYY  -- standard - should be rendered as XXXX : YYYY usually.
+ * |init  -- the initialization...
+ * *prop : a property which is actually an object definition... 
+ * *args : contructor args
+ * .ctor : Full contruct line...  
+ * 
+ * Newer code
+ * ".Gee.ArrayList<Xcls_fileitem>:fileitems" ==> # type  name 
+ * ".signal:void:open": "(JsRender.JsRender file)" ==> @ type name
+ *  "|void:clearFiles": "() .... some code...."  | type name
+ *
+ * 
+ * 
+ * 
+ * 
+ * Standardize this crap...
+ * 
+ * standard properties (use to set)
+ *          If they are long values show the dialog..
+ * 
+ * bool is_xxx  :: can show a pulldown.. (true/false)
+ * string html  
+ * $ string html  = string with value interpolated eg. baseURL + ".." 
+ *  Clutter.ActorAlign x_align  (typed)  -- shows pulldowns if type is ENUM? 
+ * $ untypedvalue = javascript untyped value... 
+ * 
+ * object properties (not part of the GOjbect being wrapped?
+ * # Gee.ArrayList<Xcls_fileitem> fileitems
+ * 
+ * signals
+ * @ void open 
+ * 
+ * methods -- always text editor..
+ * | void clearFiles
+ * | someJSmethod
+ * 
+ * specials
+ * * prop -- string
+ * * args  -- string
+ * * ctor -- string
+ * * init -- big string?
+ * 
+ * event handlers (listeners)
+ *   just shown 
+ * 
+ * -----------------
+ * special ID values
+ *  +XXXX -- indicates it's a instance property / not glob...
+ *  *XXXX -- skip writing glob property (used as classes that can be created...)
+ * 
+ * 
+ * 
+ *  FORMATING?
+.method {
+        color : green;
+        font-weight: bold;      
+}
+.prop {
+       color : #333;
+}
+.prop-code {
+    font-style: italic;
+ }
+.listener {
+    color: #600;
+    font-weight: bold;  
+}
+.special { 
+  color : #00c;    font-weight: bold;   
+
+
+*/
+
+
+
+
+
+
+public class JsRender.Node : Object {
+       
+
+       public static int uid_count = 0;
+       
+       public Node parent;
+       public Gee.ArrayList<Node> items; // child items..
+       
+       public Gee.HashMap<string,string> props; // the properties..
+       public Gee.HashMap<string,string> listeners; // the listeners..
+       public string  xvala_cls;
+       public string xvala_xcls; // 'Xcls_' + id;
+       public string xvala_id; // item id or ""
+               
+
+
+       public Node()
+       {
+               this.items = new Gee.ArrayList<Node>();
+               this.props = new Gee.HashMap<string,string>();
+               this.listeners = new Gee.HashMap<string,string>();
+               this.xvala_cls = "";
+               this.xvala_xcls = "";
+               this.xvala_id = "";
+               this.parent = null;
+       }
+
+       
+       public string uid()
+       {
+               if (this.props.get("id") == null) {
+                       uid_count++;
+                       return "uid-%d".printf(uid_count);
+               }
+               return this.props.get("id");
+       }
+       
+       
+       public bool hasChildren()
+       {
+               return this.items.size > 0;
+       }
+       public bool hasXnsType()
+       {
+               if (this.props.get("$ xns") != null && this.props.get("xtype") != null) {
+                       return true;
+                       
+               }
+               return false;
+       }
+       public string fqn()
+       {
+               if (!this.hasXnsType ()) {
+                       return "";
+               }
+               return this.props.get("$ xns") + "." + this.props.get("xtype"); 
+
+       }
+       public void setFqn(string name)
+       {
+               var ar = name.split(".");
+               this.props.set("xtype", ar[ar.length-1]);
+               var l = name.length - (ar[ar.length-1].length +1);
+               this.props.set("$ xns", name.substring(0, l));
+               print("setFQN %s to %s\n", name , this.fqn());
+                              
+
+       }
+       // wrapper around get props that returns empty string if not found.
+       public string get(string key)
+       {
+               var k = this.props.get(key);
+               if (k != null) {
+                       return k;
+               }
+               
+               k = this.props.get("$ " + key);
+               if (k != null) {
+                       return k;
+               }
+               
+               var iter = this.props.map_iterator();
+               while (iter.next()) {
+                       var kk = iter.get_key().split(" ");
+                       if (kk[kk.length-1] == key) {
+                               return iter.get_value();
+                       }
+               }
+               
+               
+               return "";
+               
+       }
+       
+       public string get_key(string key)
+       {
+               var k = this.props.get(key);
+               if (k != null) {
+                       return key;
+               }
+               
+               k = this.props.get("$ " + key);
+               if (k != null) {
+                       return "$ " + key;
+               }
+               
+               var iter = this.props.map_iterator();
+               while (iter.next()) {
+                       var kk = iter.get_key().split(" ");
+                       if (kk[kk.length-1] == key) {
+                               return iter.get_key();
+                       }
+               }
+               
+               
+               return "";
+               
+       }
+       
+       public void set(string key, string value) {
+               this.props.set(key,value);
+       }
+        public bool has(string key)
+       {
+               var k = this.props.get(key);
+               if (k != null) {
+                       return true;
+               }
+               var iter = this.props.map_iterator();
+               while (iter.next()) {
+                       var kk = iter.get_key().strip().split(" ");
+                       if (kk[kk.length-1] == key) {
+                               return true;
+                       }
+               }
+               
+               return false;
+               
+       }
+
+       public void  remove()
+       {
+               if (this.parent == null) {
+                       
+                       
+                       return;
+               }
+               var nlist = new Gee.ArrayList<Node>();
+               for (var i =0;i < this.parent.items.size; i++) {
+                       if (this.parent.items.get(i) == this) {
+                               continue;
+                       }
+                       nlist.add(this.parent.items.get(i));
+               }
+               this.parent.items = nlist;
+               this.parent = null;
+
+       }
+        
+       /* creates javascript based on the rules */
+       public Node? findProp(string n) {
+               for(var i=0;i< this.items.size;i++) {
+                       var p = this.items.get(i).get("* prop");
+                       if (this.items.get(i).get("* prop").length < 1) {
+                               continue;
+                       }
+                       if (p == n) {
+                               return this.items.get(i);
+                       }
+               }
+               return null;
+
+       }
+
+       
+       
+        
+       static Json.Generator gen = null;
+       
+       public string quoteString(string str)
+       {
+               if (Node.gen == null) {
+                       Node.gen = new Json.Generator();
+               }
+                var n = new Json.Node(Json.NodeType.VALUE);
+               n.set_string(str);
+               Node.gen.set_root (n);
+               return  Node.gen.to_data (null);   
+       }
+
+       public void loadFromJson(Json.Object obj, int version) {
+               obj.foreach_member((o , key, value) => {
+                       //print(key+"\n");
+                       if (key == "items") {
+                               var ar = value.get_array();
+                               ar.foreach_element( (are, ix, el) => {
+                                       var node = new Node();
+                                       node.parent = this;
+                                       node.loadFromJson(el.get_object(), version);
+                                       this.items.add(node);
+                               });
+                               return;
+                       }
+                       if (key == "listeners") {
+                               var li = value.get_object();
+                               li.foreach_member((lio , li_key, li_value) => {
+                                       this.listeners.set(li_key, li_value.get_string());
+
+                               });
+                               return;
+                       }
+                       var v = value.get_value();
+                       var sv =  Value (typeof (string));
+                       v.transform(ref sv);
+
+                       var rkey = key;
+                       if (version == 1) {
+                               rkey = this.upgradeKey(key, (string)sv);
+                       }
+
+                       
+                       this.props.set(rkey,  (string)sv);
+               });
+               
+
+
+
+       }
+
+       public string upgradeKey(string key, string val)
+       {
+               // convert V1 to V2
+               if (key.length < 1) {
+                       return key;
+               }
+               switch(key) {
+                       case "*prop":
+                       case "*args":
+                       case ".ctor":
+                       case "|init":
+                               return "* " + key.substring(1);
+                               
+                       case "pack":
+                               return "* " + key;
+               }
+               if (key[0] == '.') { // v2 does not start with '.' ?
+                       var bits = key.substring(1).split(":");
+                       if (bits[0] == "signal") {
+                               return "@" + string.joinv(" ", bits).substring(bits[0].length);
+                       }
+                       return "# " + string.joinv(" ", bits);                  
+               }
+               if (key[0] != '|' || key[1] == ' ') { // might be a v2 file..
+                       return key;
+               }
+               var bits = key.substring(1).split(":");
+               // two types '$' or '|' << for methods..
+               // javascript 
+               if  (Regex.match_simple ("^function\\s*(", val.strip())) {
+                       return "| " + key.substring(1);
+               }
+               // vala function..
+               
+               if  (Regex.match_simple ("^\\(", val.strip())) {
+               
+                       return "| " + string.joinv(" ", bits);
+               }
+               
+               // guessing it's a property..
+               return "$ " + string.joinv(" ", bits);
+               
+               
+
+       }
+
+
+
+
+
+       
+       public Node  deepClone()
+       {
+               var n = new Node();
+               n.loadFromJson(this.toJsonObject(), 2);
+               return n;
+
+       }
+       public string toJsonString()
+       {
+               if (Node.gen == null) {
+                       Node.gen = new Json.Generator();
+                       gen.pretty =  true;
+                       gen.indent = 4;
+               }
+               var n = new Json.Node(Json.NodeType.OBJECT);
+               n.set_object(this.toJsonObject () );
+               Node.gen.set_root (n);
+               return  Node.gen.to_data (null);   
+       }
+       
+       public Json.Object toJsonObject()
+       {
+               var ret = new Json.Object();
+
+               // listeners...
+               if (this.listeners.size > 0) {
+                       var li = new Json.Object();
+                       ret.set_object_member("listeners", li);
+                       var liter = this.listeners.map_iterator();
+                       while (liter.next()) {
+                               li.set_string_member(liter.get_key(), liter.get_value());
+                       }
+               }
+               //props
+               if (this.props.size > 0 ) {
+                       var iter = this.props.map_iterator();
+                       while (iter.next()) {
+                               this.jsonObjectsetMember(ret, iter.get_key(), iter.get_value());
+                       }
+               }
+               if (this.items.size > 0) {
+                       var ar = new Json.Array();
+                       ret.set_array_member("items", ar);
+               
+                       // children..
+                       for(var i =0;i < this.items.size;i++) {
+                               ar.add_object_element(this.items.get(i).toJsonObject());
+                       }
+               }
+               return ret;
+               
+       }
+        
+       public void jsonObjectsetMember(Json.Object o, string key, string val) {
+               if (Lang.isBoolean(val)) {
+                       o.set_boolean_member(key, val.down() == "false" ? false : true);
+                       return;
+               }
+               
+               
+               if (Lang.isNumber(val)) {
+                       if (val.contains(".")) {
+                               //print( "ADD " + key + "=" + val + " as a double?\n");
+                               o.set_double_member(key, double.parse (val));
+                               return;
+
+                       }
+                       //print( "ADD " + key + "=" + val + " as a int?\n")  ;
+                       o.set_int_member(key,long.parse(val));
+                       return;
+               }
+               ///print( "ADD " + key + "=" + val + " as a string?\n");
+               o.set_string_member(key,val);
+               
+       }
+       public string nodeTip()
+       {
+               var ret = this.nodeTitle(true);
+               var funcs = "";
+               var iter = this.props.map_iterator();
+               while (iter.next()) {
+                       var i =  iter.get_key();
+                       //, iter.get_value());
+                       if ( i[0] != '|') {
+                               continue;
+                       }
+               
+                       //if (i == "* init") { 
+                       //      continue;
+                       //}
+                       var val = iter.get_value();
+                       if (Regex.match_simple("^\\s*function", val)) { 
+                               funcs += "\n<b>" + 
+                                       GLib.Markup.escape_text(i.substring(1)) +"</b> : " + 
+                                       GLib.Markup.escape_text(val.split("\n")[0]);
+                               continue;
+                       }
+                       if (Regex.match_simple("^\\s*\\(", val)) {
+                               funcs += "\n<b>" + GLib.Markup.escape_text(i.substring(1)) +
+                                       "</b> : " + 
+                                       GLib.Markup.escape_text(val.split("\n")[0]);
+                               continue;
+                       }
+                       
+               }
+               if (funcs.length > 0) {
+                       ret+="\n\nMethods:" + funcs;
+               } 
+               return ret;
+
+       }
+       public string nodeTitle(bool for_tip = false) {
+               string[] txt = {};
+
+               //var sr = (typeof(c['+buildershow']) != 'undefined') &&  !c['+buildershow'] ? true : false;
+               //if (sr) txt.push('<s>');
+
+               if (this.has("* prop"))   { txt += (GLib.Markup.escape_text(this.get("* prop")) + ":"); }
+               
+               //if (renderfull && c['|xns']) {
+               var fqn = this.fqn();
+               var fqn_ar = fqn.split(".");
+               txt += for_tip || fqn.length < 1 ? fqn : fqn_ar[fqn_ar.length -1];
+                       
+               //}
+               
+               //if (c.xtype)    { txt.push(c.xtype); }
+                       
+               if (this.has("id"))      { txt += ("<b>[id=" + GLib.Markup.escape_text(this.get("id")) + "]</b>"); }
+               if (this.has("fieldLabel")){ txt += ("[" + GLib.Markup.escape_text(this.get("fieldLabel")) + "]"); }
+               if (this.has("boxLabel"))  { txt += ("[" + GLib.Markup.escape_text(this.get("boxLabel"))+ "]"); }
+               
+               
+               if (this.has("layout")) { txt += ("<i>" + GLib.Markup.escape_text(this.get("layout")) + "</i>"); }
+               if (this.has("title"))   { txt += ("<b>" + GLib.Markup.escape_text(this.get("title")) + "</b>"); }
+               if (this.has("html"))    { txt += ("<b>" + GLib.Markup.escape_text(this.get("html")) + "</b>"); }
+               if (this.has("label"))   { txt += ("<b>" + GLib.Markup.escape_text(this.get("label"))+ "</b>"); }
+               if (this.has("header"))   { txt += ("<b>" + GLib.Markup.escape_text(this.get("header")) + "</b>"); }
+               if (this.has("legend"))  { txt += ("<b>" + GLib.Markup.escape_text(this.get("legend")) + "</b>"); }
+               if (this.has("text"))     { txt += ("<b>" + GLib.Markup.escape_text(this.get("text")) + "</b>"); }
+               if (this.has("name"))     { txt += ("<b>" + GLib.Markup.escape_text(this.get("name"))+ "</b>"); }
+               if (this.has("region")) { txt += ("<i>(" + GLib.Markup.escape_text(this.get("region")) + ")</i>"); }
+               if (this.has("dataIndex")){ txt += ("[" + GLib.Markup.escape_text(this.get("dataIndex")) + "]"); }
+               
+               // for flat classes...
+               //if (typeof(c["*class"]"))!= "undefined")  { txt += ("<b>" +  c["*class"]+  "</b>"); }
+               //if (typeof(c["*extends"]"))!= "undefined")  { txt += (": <i>" +  c["*extends"]+  "</i>"); }
+               
+               
+               //if (sr) txt.push('</s>');
+               return (txt.length == 0) ? "Element" : string.joinv(" ", txt);
+       }
+
+}
diff --git a/old-javascript/JsRender/NodeToGlade.vala b/old-javascript/JsRender/NodeToGlade.vala
new file mode 100644 (file)
index 0000000..1f2daaa
--- /dev/null
@@ -0,0 +1,410 @@
+/*
+
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.18.3 -->
+<interface>
+  <requires lib="gtk+" version="3.12"/>
+  <object class="GtkBox" id="box1">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="orientation">vertical</property>
+    <child>
+      <object class="GtkButton" id="button1">
+        <property name="label" translatable="yes">button</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">True</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">0</property>
+      </packing>
+    </child>
+    <child>
+      <placeholder/>
+    </child>
+    <child>
+      <object class="GtkToggleButton" id="togglebutton1">
+        <property name="label" translatable="yes">togglebutton</property>
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">True</property>
+      </object>
+      <packing>
+        <property name="expand">False</property>
+        <property name="fill">True</property>
+        <property name="position">2</property>
+      </packing>
+    </child>
+  </object>
+</interface>
+*/
+public class JsRender.NodeToGlade : Object {
+
+       Node node;
+       string pad;
+       Gee.ArrayList<string> els;
+        //Gee.ArrayList<string> skip;
+       Gee.HashMap<string,string> ar_props;
+       public static int vcnt = 0; 
+
+       public NodeToGlade( Node node,   string pad) 
+       {
+               this.node = node;
+               this.pad = pad;
+               this.els = new Gee.ArrayList<string>(); 
+               //this.skip = new Gee.ArrayList<string>();
+               this.ar_props = new Gee.HashMap<string,string>();
+
+       }
+       
+       public string munge ( )
+       {
+
+                
+               this.pad += "    ";
+
+               var cls = this.node.fqn().replace(".", "");
+               string res = "";
+               switch(cls) {
+                       // things we can not do yet...
+                       case "GtkDialog": // top level.. - named and referenced
+                       case "GtkAboutDialog":
+                       case "GtkMessageDialog":
+                       case "GtkWindow": // top level.. - named and referenced
+                               res =  this.mungeOuter(true);
+                               break;
+                       default:
+                               res = this.mungeOuter(false);
+                               break;
+               }
+                               
+               
+               if (res.length < 1) {
+                       return "";
+               }
+               return  "<?xml version=\"1.0\" encoding=\"UTF-8\"?> 
+                       <!-- Generated with appBuilder 4.1 -->
+                       <interface> 
+                               <requires lib=\"gtk+\" version=\"3.12\"/>
+                               <!-- <requires lib=\"gtksourceview\" version=\"3.0\"/> -->
+                       " +
+                       res +
+                       "</interface>\n";
+          
+                    
+       }
+       public string mungeChild(string pad ,  Node cnode, bool with_packing = false)
+       {
+               var x = new  NodeToGlade(cnode,  pad);
+               return x.mungeNode(with_packing);
+       }
+       
+       public string mungeNode(bool with_packing)
+       {
+               var pad = this.pad;
+               var cls = this.node.fqn().replace(".", "");
+               
+               var b = new global::Gtk.Builder();
+
+               var gtype = b.get_type_from_name(cls);
+               print("Type: %s ?= %s\n", this.node.fqn(), gtype.name());
+
+               
+               
+               var ns = this.node.fqn().split(".")[0];
+               if (ns == "Clutter") {
+                       return "";
+               }
+               //if (ns == "GtkClutter") {
+               //      return "";
+               //}
+               if (ns == "WebKit") {
+                       return "";
+               }
+               switch(cls) {
+                       // things we can not do yet...
+                       /*case "GtkDialog": // top level.. - named and referenced
+                       case "GtkAboutDialog":
+                       case "GtkWindow": // top level.. - named and referenced
+                               return this.mungeWindow();
+                               
+                                       
+                               if (this.node.items.size > 0) {
+                                       return this.mungeChild(pad + "        " , this.node.items.get(0), false );
+                               }
+                               return "";
+                       */
+                       //case "GtkView": // SourceView?
+                       case "GtkTreeStore": // top level.. - named and referenced
+                       case "GtkListStore": // top level.. - named and referenced
+                       case "GtkTreeViewColumn": // part of liststore?!?!
+                       case "GtkMenu": // top level..
+                       case "GtkCellRendererText":
+                       case "GtkSourceBuffer":                         
+                       case "GtkClutterActor"://fixme..
+                       ///case "GtkClutterEmbed"://fixme..
+                               return "";
+               }
+
+               
+               var id = this.node.uid();
+               var ret = @"$pad<object class=\"$cls\" id=\"$id\">\n";
+               // properties..
+               var props = Palete.Gir.factoryFqn(this.node.fqn()).props;
+               //var props =  Palete.factory("Gtk").getPropertiesFor(this.node.fqn(), "props");
+              
+               var pviter = props.map_iterator();
+               while (pviter.next()) {
+                       
+                               // print("Check: " +cls + "::(" + pviter.get_value().propertyof + ")" + pviter.get_key() + " " );
+                               
+                       // skip items we have already handled..
+                       if  (!this.node.has(pviter.get_key())) {
+                               continue;
+                       }
+                       var k = pviter.get_key();
+                       var val = GLib.Markup.escape_text(this.node.get(pviter.get_key()).strip());
+                       ret += @"$pad    <property name=\"$k\">$val</property>\n"; // es
+
+                }
+               // packing???
+
+               var pack = "";
+               
+               if (with_packing   ) {
+                       pack = this.packString();
+                       
+
+               }       
+               // children..
+
+               if (this.node.items.size < 1) {
+                       return ret + @"$pad</object>\n" + pack;
+               }
+               
+               for (var i = 0; i < this.node.items.size; i++ ) {
+
+                       var add = this.mungeChild(pad + "        " , this.node.items.get(i) , true);
+                       if (add.length < 1) {
+                               continue;
+                       }
+                       
+                       ret += @"$pad    <child>\n";
+                       ret += add;
+                       ret += @"$pad    </child>\n";
+               }
+               
+               return ret + @"$pad</object>\n" + pack;
+               
+
+                
+
+       }
+        
+        
+       public string packString()
+       {
+               
+               
+               
+               
+               // pack is part of the parent element..
+               var p = node.parent;
+               string[]  pk= { "add" };
+               var pfqn = "Gtk.Box";
+               if (p != null) {
+                       pfqn  = p.fqn();
+                       if (this.node.props.get("* pack") == null) {
+                               return "";
+                       }
+                       pk = this.node.get("* pack").split(",");
+               } else {
+                       if (this.node.props.get("* pack") != null) {
+                               pk = this.node.get("* pack").split(",");
+                       }
+                       
+               }
+               
+               if (pfqn == null) {
+                       return "";
+               }
+               if (pfqn == "Gtk.ScrolledWindow") {
+                       return "";
+               }
+               var p_parts =pfqn.split(".");
+
+
+               
+               var ns = p_parts[0];
+               var gir =  Palete.Gir.factory(ns);
+               var cls = gir.classes.get(p_parts[1]);
+               var mdef = cls.methods.get(pk[0]);
+               if (mdef == null) {
+                       print("could not find method : %s\n", pk[0]);
+                       return "";
+               }
+               /*
+               var generator = new Json.Generator ();
+               var n = new Json.Node(Json.NodeType.OBJECT);
+               n.set_object(mdef.toJSON());
+               generator.set_root(n);
+               generator.indent = 4;
+               generator.pretty = true;
+                   
+               print(generator.to_data(null));
+               */
+               string[]  pbody  = {};
+               switch(pk[0]) {
+
+                       case "pack_start":
+                               pbody += @"$pad    <property name=\"pack_type\">start</property>\n";
+                               break;
+                       
+                       case "pack_end":
+                               pbody += @"$pad    <property name=\"pack_type\">start</property>\n";
+                               break;
+                               
+                       case "add":
+                               //pbody += @"$pad    <property name=\"pack_type\">start</property>\n";
+                                pbody += @"$pad    <property name=\"expand\">True</property>\n";
+                               pbody += @"$pad    <property name=\"fill\">True</property>\n";
+                               //pbody += @"$pad    <property name=\"position\">1</property>\n";
+                               var pack = @"$pad<packing>\n" +
+                                       string.joinv("", pbody) + 
+                                               @"$pad</packing>\n";
+                               return pack;
+                
+                       case "set_model":
+                               print ("set_model not handled yet..");
+                               return "";
+                       
+                       default:
+                               print ("unknown pack type: %s", pk[0]);
+                               return "";
+                               
+               }
+                       
+               var pad = this.pad;
+                
+               for (var i = 2; i < mdef.paramset.params.size; i++) {
+                       var poff = i - 1;
+                       if (poff > (pk.length-1)) {
+                               break;
+                       }
+                       
+                       var key = mdef.paramset.params.get(i).name;
+                       var val = pk[poff];
+                       pbody += @"$pad    <property name=\"$key\">$val</property>\n";
+               
+               }
+            
+               if (pbody.length < 1) {
+                       /*var generator = new Json.Generator ();
+                       var n = new Json.Node(Json.NodeType.OBJECT);
+                       n.set_object(mdef.toJSON());
+                       generator.set_root(n);
+                       generator.indent = 4;
+                       generator.pretty = true;
+                           
+                       print(generator.to_data(null));
+                       */
+                       print("skip - packing - no arguments (" + pk[0] + ")\n");
+                       return "";
+               }
+               
+               var pack = @"$pad<packing>\n" +
+                               string.joinv("", pbody) + 
+                               @"$pad</packing>\n";
+               return pack;
+
+       }
+       public string  mungeOuter(bool with_window)
+       {
+               var label = this.node.fqn() + ": " + 
+                       (this.node.has("title") ? this.node.get("title") : "No-title");
+               
+               var ret = "";
+               ret+= "
+<object class=\"GtkBox\" id=\"fake-window1\">
+       <property name=\"visible\">True</property>
+       <property name=\"can_focus\">False</property>
+       <property name=\"orientation\">vertical</property>
+";
+               if (with_window) {              
+                       ret+="
+       <child>
+               <object class=\"GtkLabel\" id=\"fake-window-label-1\">
+                       <property name=\"visible\">True</property>
+                       <property name=\"can_focus\">False</property>
+                       <property name=\"label\" translatable=\"yes\">" + label + "</property>
+               </object>
+               <packing>
+                       <property name=\"expand\">False</property>
+                       <property name=\"fill\">True</property>
+                       <property name=\"position\">0</property>
+               </packing>
+       </child>
+       ";
+               }
+               
+               ret+=" 
+               <child>
+               ";
+               if (with_window) {
+                       var children = "";
+                       if (this.node.items.size > 0) {
+                       
+                               children =  this.mungeChild(pad + "        " , this.node.items.get(0), false);
+                         
+
+                       } 
+                       children += (children.length > 0) ? "<packing>
+                               <property name=\"expand\">True</property>
+                               <property name=\"fill\">True</property>
+                               <property name=\"position\">1</property>
+                     </packing>" : "";
+                       
+                       ret+= (children.length < 1 ) ? "<placeholder/>" : children;
+                       
+                       
+                       
+
+               } else {
+                       ret+= this.mungeNode (true);
+               }
+
+               ret+="
+                   </child>
+           ";
+       if (with_window) {
+               ret+="
+                   <child>
+                     <object class=\"GtkBox\" id=\"fake-footer\">
+                       <property name=\"visible\">True</property>
+                       <property name=\"can_focus\">False</property>
+                       <child>
+                         <placeholder/>
+                       </child>
+                       <child>
+                         <placeholder/>
+                       </child>
+                     </object>
+                     <packing>
+                       <property name=\"expand\">False</property>
+                       <property name=\"fill\">True</property>
+                       <property name=\"position\">2</property>
+                     </packing>
+                   </child>
+           ";
+       }
+               ret +="
+       </object>"; 
+
+       return ret;
+       }
+
+               
+}
\ No newline at end of file
diff --git a/old-javascript/JsRender/NodeToGtk.vala b/old-javascript/JsRender/NodeToGtk.vala
new file mode 100644 (file)
index 0000000..86eec01
--- /dev/null
@@ -0,0 +1,390 @@
+/*
+
+*/
+public class JsRender.NodeToGtk : Object {
+
+       Node node;
+       Object wrapped_object; 
+       NodeToGtk parentObj;
+       
+       Gee.ArrayList<string> els;
+        //Gee.ArrayList<string> skip;
+       Gee.HashMap<string,string> ar_props;
+       public static int vcnt = 0; 
+
+       public NodeToGtk( Node node) 
+       {
+               this.node = node;
+               this.els = new Gee.ArrayList<string>(); 
+               //this.skip = new Gee.ArrayList<string>();
+               this.ar_props = new Gee.HashMap<string,string>();
+               this.parentObj = null;
+       }
+       
+       public Object? munge ( )
+       {
+
+                return this.mungeNode ();
+                
+                    
+       }
+       public Object? mungeChild(  Node cnode)
+       {
+               var x = new  NodeToGtk(cnode);
+               x.parentObj = this;
+               return x.mungeNode();
+       }
+       
+       public Object? mungeNode()
+       {
+
+               var parent = this.parentObj != null ? this.parentObj.wrapped_object : null;
+               var cls = this.node.fqn().replace(".", "");
+               var ns = this.node.fqn().split(".")[0];
+               var gtkbuilder = new global::Gtk.Builder();
+
+               var cls_gtype = gtkbuilder.get_type_from_name(cls);
+               print("Type: %s ?= %s\n", this.node.fqn(), cls_gtype.name());
+
+               if (cls_gtype == GLib.Type.INVALID) {
+                       print("SKIP - gtype is invalid\n");
+                       return null;
+               }
+               // if it's a window... 
+
+               if (cls_gtype.is_a(typeof(global::Gtk.Window))) {
+                       // what if it has none...
+                       if (this.node.items.size < 1) {
+                               return null;
+                       }
+                       return this.mungeChild(this.node.items.get(0));
+               }
+
+               var ret = Object.new(cls_gtype);
+               ret.ref(); //??? problematic?
+               this.wrapped_object = ret;
+               
+                
+               switch(cls) {
+                       // fixme
+                       //case "GtkTreeStore": // top level.. - named and referenced
+                       case "GtkListStore": // top level.. - named and referenced
+                       //case "GtkTreeViewColumn": // part of liststore?!?!
+                       //case "GtkMenu": // top level..
+                       //case "GtkCellRendererText":
+                       case "GtkSourceBuffer":                         
+                       case "GtkClutterActor"://fixme..
+                       case "GtkClutterEmbed"://fixme.. -- we can not nest embedded.. need to solve..
+                                       
+                               return null;
+               }
+
+               this.packParent();
+               
+
+               // pack paramenters
+
+               
+               if (parent != null && parent.get_type().is_a(typeof(global::Gtk.Container))) {
+                       this.packContainerParams();
+               }
+               
+               var cls_gir =Palete.Gir.factoryFqn(this.node.fqn()); 
+               if (cls_gir == null) {
+                       return null;
+               }
+               //var id = this.node.uid();
+               //var ret = @"$pad<object class=\"$cls\" id=\"$id\">\n";
+               // properties..
+               var props = cls_gir.props;
+               
+              
+               var pviter = props.map_iterator();
+               while (pviter.next()) {
+                       
+                               // print("Check: " +cls + "::(" + pviter.get_value().propertyof + ")" + pviter.get_key() + " " );
+                       var k = pviter.get_key();
+                       // skip items we have already handled..
+                       if  (!this.node.has(k)) {
+                               continue;
+                       }
+                       // find out the type of the property...
+                       var type = pviter.get_value().type;
+                       type = Palete.Gir.fqtypeLookup(type, ns);
+
+                       var val = this.toValue(this.node.get(k).strip(), type);
+                       if (val == null) {
+                               print("skip (failed to transform value %s type = %s from %s\n", 
+                                       cls + "." + k, type,  this.node.get(k).strip());
+                               continue;
+                       }
+                       print ("set_property ( %s , %s / %s)\n", k, this.node.get(k).strip(), val.strdup_contents());
+                       
+                       
+                       ret.set_property(k, val);  
+                       
+
+                }
+               // packing???
+               // for now... - just try the builder style packing
+               
+               
+                
+               if (this.node.items.size < 1) {
+                       return ret;
+               }
+               
+               for (var i = 0; i < this.node.items.size; i++ ) {
+
+                        this.mungeChild(this.node.items.get(i));
+                        
+               }
+               
+               return ret;
+               
+
+                
+
+       }
+       public void packParent() 
+       {
+               var cls = this.node.fqn().replace(".", "");
+               
+               var gtkbuilder = new global::Gtk.Builder();
+               var cls_gtype = gtkbuilder.get_type_from_name(cls);
+
+               if (this.parentObj == null) {
+                       return;
+               }
+                               
+                   
+               var parent = this.parentObj.wrapped_object;
+               
+               var do_pack =true;
+
+               if (parent == null) { // no parent.. can not pack.
+                       return;
+               }
+               // our overrides
+               if (cls == "GtkMenu") {
+                       this.packMenu();
+                       return;
+               }
+
+               if (cls == "GtkTreeStore") { // other stores?
+                       // tree store is buildable??? --- 
+                       this.packTreeStore();
+                       return;
+               }
+               if (cls =="GtkTreeViewColumn") { // other stores?
+                       //?? treeview column is actually buildable -- but we do not use the builder???
+                       this.packTreeViewColumn();
+                       return;
+               }
+               if (cls_gtype.is_a(typeof(global::Gtk.CellRenderer))) { // other stores?
+                       this.packCellRenderer();
+                       return;
+               }
+
+
+               
+               // -- handle buildable add_child..
+               if (    cls_gtype.is_a(typeof(global::Gtk.Buildable))
+                    && 
+                       parent.get_type().is_a(typeof(global::Gtk.Buildable))
+               )
+               {
+                       ((global::Gtk.Buildable)parent).add_child(gtkbuilder, 
+                                                 this.wrapped_object, null);
+                       return;
+               }
+               // other packing?
+
+               
+
+       }
+
+       public void packMenu()
+       {
+
+
+               var parent = this.parentObj.wrapped_object;
+               if (!parent.get_type().is_a(typeof(global::Gtk.Widget))) {
+                       print("skip menu pack - parent is not a widget");
+                       return;
+               }
+               
+               var p = (global::Gtk.Menu)this.wrapped_object;
+               ((global::Gtk.Widget)parent).button_press_event.connect((s, ev) => { 
+                       p.set_screen(Gdk.Screen.get_default());
+                       p.show_all();
+                       p.popup(null, null, null, ev.button, ev.time);
+                       return true;
+               });
+       }
+
+       public void packTreeStore()
+       {
+               var parent = this.parentObj.wrapped_object;
+               if (!parent.get_type().is_a(typeof(global::Gtk.TreeView))) {
+                       print("skip treestore pack - parent is not a treeview");
+                       return;
+               }
+               ((global::Gtk.TreeView)parent).set_model((global::Gtk.TreeModel)this.wrapped_object);
+               
+       }
+       public void packTreeViewColumn()
+       {
+               var parent = this.parentObj.wrapped_object;
+               if (!parent.get_type().is_a(typeof(global::Gtk.TreeView))) {
+                       print("skip packGtkViewColumn pack - parent is not a treeview");
+                       return;
+               }
+               ((global::Gtk.TreeView)parent).append_column((global::Gtk.TreeViewColumn)this.wrapped_object);
+               // init contains the add_attribute for what to render...
+               
+       }       
+
+
+       public void packCellRenderer()
+       {
+               var parent = this.parentObj.wrapped_object;
+               if (!parent.get_type().is_a(typeof(global::Gtk.TreeViewColumn))) {
+                       print("skip packGtkViewColumn pack - parent is not a treeview");
+                       return;
+               }
+               ((global::Gtk.TreeViewColumn)parent).pack_start((global::Gtk.CellRenderer)this.wrapped_object, false);
+               // init contains the add_attribute for what to render...
+               
+       }       
+
+
+       public void packContainerParams()
+       {
+        
+               if (this.parentObj == null) {
+                       return;
+               }
+               // child must be a widget..
+               if (!this.wrapped_object.get_type().is_a(typeof(global::Gtk.Widget))) {
+                       return;
+               }
+               
+               var parent_gir = Palete.Gir.factoryFqn(this.parentObj.node.fqn());
+
+               var parent = this.parentObj.wrapped_object;
+               
+               if (parent_gir == null) {
+                       return;
+               }
+               
+               // let's test just setting expand to false...
+               var cls_methods = parent_gir.methods;
+               if (cls_methods == null) {
+                       return;
+               }
+       
+               if (!this.node.props.has_key("* pack")) {
+                       return;
+               }
+               
+               var ns = this.parentObj.node.fqn().split(".")[0];
+                
+               var pack = this.node.props.get("* pack").split(",");
+
+       
+               if (cls_methods.has_key(pack[0])) {
+                       var mparams = cls_methods.get(pack[0]).paramset.params;
+                       for (var i = 1; i < mparams.size; i++ ) {
+                               if (i > (pack.length -1)) {
+                                       continue;
+                               }
+                       
+                               var k = mparams.get(i).name;
+
+                               Value cur_val;
+                                
+                               var type = mparams.get(i).type;
+                               type = Palete.Gir.fqtypeLookup(type, ns);
+
+                               var val = this.toValue(pack[i].strip(), type);
+                               if (val == null) {
+                                       print("skip (failed to transform value %s type = %s from %s\n", 
+                                               this.parentObj.node.fqn()  + "." + k, type, pack[i].strip());
+                                       continue;
+                               }
+                               print ("pack:set_property ( %s , %s / %s)\n", k, pack[i].strip(), val.strdup_contents());
+       
+                               ((global::Gtk.Container)parent).child_set_property(
+                                       (global::Gtk.Widget)this.wrapped_object , k, val);
+                                
+                       }
+               
+               }
+       
+
+
+                       
+       }
+                  
+
+       public GLib.Value? toValue(string val, string type) {
+
+               var gtkbuilder = new global::Gtk.Builder();
+
+               if (type == "utf8") {
+                       var qret = new GLib.Value(typeof(string));
+                       qret.set_string(val);
+                       return qret;
+               }
+               
+               var prop_gtype = gtkbuilder.get_type_from_name(type);
+               
+
+               if (prop_gtype == GLib.Type.INVALID) {
+                        
+                       return null;
+               }
+               
+               
+               var ret = new GLib.Value(prop_gtype);
+
+
+               switch(type) {
+                       case "gboolean":
+                               ret.set_boolean(val.down() == "false" ? false : true);
+                               return ret;
+                       case "guint":
+                               ret.set_uint(int.parse(val));
+                               return ret;
+                               
+                       case "gint":
+                               ret.set_int(int.parse(val));
+                               return ret;
+
+                       case "gfloat":
+                               ret.set_float(long.parse(val));
+                               return ret;
+                               
+                       case "utf8":
+                               ret.set_string(val);
+                               return ret;
+
+                       default:
+
+                               var sval =new GLib.Value(typeof(string));
+                               sval.set_string(val);
+                       
+                               if (!sval.transform(ref ret)) {
+                               
+                                       return null;
+                               }
+                               return ret;
+               }
+       }
+       
+        
+         
+               
+}
\ No newline at end of file
diff --git a/old-javascript/JsRender/NodeToJs.vala b/old-javascript/JsRender/NodeToJs.vala
new file mode 100644 (file)
index 0000000..9826e3e
--- /dev/null
@@ -0,0 +1,442 @@
+/**
+ * 
+ * Code to convert node tree to Javascript...
+ * 
+ * usage : x = (new JsRender.NodeToJs(node)).munge();
+ * 
+*/
+
+
+
+
+public class JsRender.NodeToJs : Object {
+
+        Node node;
+       Gee.ArrayList<string>  doubleStringProps;
+       string pad;
+       Gee.ArrayList<string> els;
+        //Gee.ArrayList<string> skip;
+       Gee.HashMap<string,string> ar_props;
+
+
+       
+       public NodeToJs( Node node, Gee.ArrayList<string> doubleStringProps, string pad) 
+       {
+               this.node = node;
+               this.doubleStringProps = doubleStringProps;
+               this.pad = pad;
+               this.els = new Gee.ArrayList<string>(); 
+               //this.skip = new Gee.ArrayList<string>();
+               this.ar_props = new Gee.HashMap<string,string>();
+
+       }
+       
+       public string munge ( )
+       {
+               //return this.mungeToString(this.node);
+
+       
+               
+               this.checkChildren();
+               this.readProps();
+               this.readArrayProps();
+               this.readListeners();
+
+               if (!this.node.props.has_key("* xinclude")) {
+                       this.iterChildren();
+               }
+               
+               
+               
+               
+               if (this.els.size < 1) {
+                       return "";
+               }
+               // oprops...    
+                       
+               var spad = pad.substring(0, this.pad.length-4);
+               var str_props = gLibStringListJoin(",\n" + this.pad , this.els) ;
+               //print ("STR PROPS: " + str_props);
+               if (!this.node.props.has_key("* xinclude")) {
+                       return   "{\n" +
+                               this.pad  + str_props + 
+                               "\n" + spad +  "}";
+               }
+               // xinclude...
+
+
+               return "Roo.apply(" + this.node.props.get("* xinclude") + "._tree(), "+
+                        "{\n" +
+                               this.pad  + str_props + 
+                               "\n" + spad +  "})";
+                    
+       } 
+
+       string gLibStringListJoin( string sep, Gee.ArrayList<string> ar) 
+       {
+               var ret = "";
+               for (var i = 0; i < ar.size; i++) {
+                       ret += i>0 ? sep : "";
+                       ret += ar.get(i);
+               }
+               return ret;
+
+       }
+       public string mungeChild(string pad ,  Node cnode)
+       {
+               var x = new  NodeToJs(cnode, this.doubleStringProps, pad);
+               return x.munge();
+       }
+       
+       
+
+       
+       public void checkChildren () 
+       {
+               
+                
+               // look throught he chilren == looking for * prop.. -- fixme might not work..
+               
+               
+               if (!this.node.hasChildren()) {
+                       return;
+               }
+               // look for '*props'
+          
+               for (var ii =0; ii< this.node.items.size; ii++) {
+                       var pl = this.node.items.get(ii);
+                       if (!pl.props.has_key("* prop")) {
+                               //newitems.add(pl);
+                               continue;
+                       }
+                       
+                       //print(JSON.stringify(pl,null,4));
+                       // we have a prop...
+                       //var prop = pl['*prop'] + '';
+                       //delete pl['*prop'];
+                       var prop = pl.get("* prop");
+                       print("got prop "+ prop + "\n");
+                       
+                       // name ends in [];
+                       if (! Regex.match_simple("\\[\\]$", prop)) {
+                               // it's a standard prop..
+                               
+                               // munge property..??
+                               this.els.add( prop  + " : " + this.mungeChild (  this.pad + "    ",  pl));
+                               
+                               
+                               //keys.push(prop);
+                               continue;
+                       }
+
+
+
+                       
+                       var sprop  = prop.replace("[]", "");
+                       print("sprop is : " + sprop + "\n");
+                       
+                       // it's an array type..
+                       var old = "";
+                       if (!this.ar_props.has_key(sprop)) {
+                               
+                               this.ar_props.set(sprop, "");
+                               
+                       } else {
+                               old = this.ar_props.get(sprop);
+                       }
+                       var nstr  = old += old.length > 0 ? ",\n" : "";
+                       nstr += this.mungeChild( this.pad + "           ",   pl);
+                       
+                       this.ar_props.set(sprop, nstr);
+                        
+                       
+               }
+                
+       }
+       /*
+ * Standardize this crap...
+ * 
+ * standard properties (use to set)
+ *          If they are long values show the dialog..
+ *
+ * someprop : ....
+ * bool is_xxx  :: can show a pulldown.. (true/false)
+ * string html  
+ * $ string html  = string with value interpolated eg. baseURL + ".." 
+ *  Clutter.ActorAlign x_align  (typed)  -- shows pulldowns if type is ENUM? 
+ * $ untypedvalue = javascript untyped value...  
+ * _ string html ... = translatable..
+
+ * 
+ * object properties (not part of the GOjbect being wrapped?
+ * # Gee.ArrayList<Xcls_fileitem> fileitems
+ * 
+ * signals
+ * @ void open 
+ * 
+ * methods -- always text editor..
+ * | void clearFiles
+ * | someJSmethod
+ * 
+ * specials
+ * * prop -- string
+ * * args  -- string
+ * * ctor -- string
+ * * init -- big string?
+ * 
+ * event handlers (listeners)
+ *   just shown 
+ * 
+ * -----------------
+ * special ID values
+ *  +XXXX -- indicates it's a instance property / not glob...
+ *  *XXXX -- skip writing glob property (used as classes that can be created...)
+ * 
+ * 
+ */
+       public void readProps()
+       {
+               string left;
+               Regex func_regex ;
+
+               if (this.node.props.has_key("$ xns")) {
+        
+                       this.els.add("'|xns' : '" + this.node.props.get("$ xns") + "'");
+
+               }
+
+               
+               try {
+                       func_regex = new Regex("^\\s+|\\s+$");
+               } catch (Error e) {
+                       print("failed to build regex");
+                       return;
+               }
+               var piter = this.node.props.map_iterator();
+               while (piter.next() ) {
+                       var kk = piter.get_key().split(" ");
+                       var v = piter.get_value();
+                       var k = kk[kk.length-1];
+
+                       
+                       //if (this.skip.contains(k) ) {
+                       //      continue;
+                       //}
+                       if (  Regex.match_simple("\\[\\]$", k)) {
+                               
+                               
+
+                       }
+                       
+                       string leftv = k;
+                       // skip builder stuff. prefixed with  '.' .. just like unix fs..
+                       if (kk[0][0] == '.') { // |. or . -- do not output..
+                               continue;
+                       }
+                        if (kk[0][0] == '*') {
+                               // ignore '*prop';
+                               continue;
+                        }
+                               
+                       
+                       if (Lang.isKeyword(leftv) || Lang.isBuiltin(leftv)) {
+                               left = "'" + leftv + "'";
+                       } else if (Regex.match_simple("[^A-Za-z_]+",leftv)) { // not plain a-z... - quoted.
+                               var val = this.node.quoteString(leftv);
+                               
+                               left = "'" + val.substring(1, val.length-2).replace("'", "\\'") + "'";
+                       } else {
+                               left = leftv;
+                       }
+                       left += " : ";
+                       
+                       
+                        
+                       // next.. is it a function.. or a raw string..
+                       if (
+                               kk[0][0] == '|' 
+                               || 
+                               kk[0][0] == '$' 
+                               || 
+                               kk[0] == "function"
+                              
+                               // ??? any others that are raw output..
+                               ) {
+                               // does not hapepnd with arrays.. 
+                               if (v.length < 1) {  //if (typeof(el) == 'string' && !obj[i].length) { //skip empty.
+                                       continue;
+                               }
+                               /*
+                               print(v);
+                               string str = "";
+                               try {
+                                       str = func_regex.replace(v,v.length, 0, "");
+                               } catch(Error e) {
+                                       print("regex failed");
+                                       return "";
+                               }
+                               */
+                               var str = v.strip();
+                                 
+                               var lines = str.split("\n");
+                               var nstr = "" + str;
+                               if (lines.length > 0) {
+                                       nstr =  string.joinv("\n" + this.pad, lines);
+                               }
+                               //print("==> " +  str + "\n");
+                               this.els.add(left + nstr);
+                               continue;
+                       }
+                       // standard..
+                       
+                       
+                       if (
+                               Lang.isNumber(v) 
+                               || 
+                               Lang.isBoolean(v)
+                               ||
+                               kk[0].down() == "boolean"
+                               || 
+                               kk[0].down() == "bool"
+                               || 
+                               kk[0].down() == "number"
+                               || 
+                               kk[0].down() == "int"
+                           ) { // boolean or number...?
+                               this.els.add(left + v.down() );
+                               continue;
+                       }
+                       
+                       // strings..
+                       if (this.doubleStringProps.size < 1) {
+                               this.els.add(left + this.node.quoteString(v));
+                               continue;
+                       }
+                  
+                       if (this.doubleStringProps.index_of(k) > -1) {
+                               els.add(left + this.node.quoteString(v));
+                               continue;
+                       }
+                       var vv = this.node.quoteString(v);
+                       // single quote.. v.substring(1, v.length-1).replace("'", "\\'") + "'";
+                       this.els.add(left + "'" + vv.substring(1, vv.length-2).replace("'", "\\'") + "'");
+                       
+
+                  
+                  
+                  
+               }
+       }
+       public void readArrayProps()
+       {
+       
+               // handle the childitems  that are arrays.. eg. button[] = {  }...
+               
+               string left;
+               
+               var iter = this.ar_props.map_iterator();
+               while (iter.next()) {
+                       var k = iter.get_key();
+                       var right = iter.get_value();
+                       
+                       string leftv = k[0] == '|' ? k.substring(1) : k;
+                       if (Lang.isKeyword(leftv) || Lang.isBuiltin(leftv)) {
+                               left = "'" + leftv + "'";
+                       } else if (Regex.match_simple("[^A-Za-z_]+",leftv)) { // not plain a-z... - quoted.
+                               var val = this.node.quoteString(leftv);
+                               
+                               left = "'" + val.substring(1, val.length-2).replace("'", "\\'") + "'";
+                       } else {
+                               left = leftv;
+                       }
+                       left += " : ";
+                       
+                        
+                       
+                       
+                       if (right.length > 0){
+                               this.els.add(left + "[\n" +  this.pad + "        " +  right + "\n" + this.pad + "]");
+                       }
+               
+                       
+               }
+
+       }
+       public void readListeners()
+       {
+               
+               if (this.node.listeners.size < 1) {
+                       return;
+               }
+                       // munge the listeners.
+                       //print("ADDING listeners?");
+               
+               var liter = this.node.listeners.map_iterator();
+       
+               var itms = "listeners : {\n";
+               var i =0;
+               while (liter.next()) {
+                       
+                       itms += i >0 ? ",\n" : "";      
+                       // 
+                       var str = liter.get_value().strip();
+                       var lines = str.split("\n");
+                       if (lines.length > 0) {
+                               str = string.joinv("\n" + this.pad + "     ", lines);
+                       }
+                       
+
+                       
+                       itms +=  this.pad + "   "  + liter.get_key().replace("|", "")  + " : " + str;
+
+                       i++;
+               
+                       
+               }
+               itms += "\n" + this.pad + "}";
+               //print ( "ADD " + itms); 
+               this.els.add(itms);
+
+       }
+
+       public void iterChildren()
+       {
+               
+               
+               // finally munge the children...
+               if (this.node.items.size < 1) {
+                       return;
+               }
+               var itms = "items : [\n";
+               var n = 0;
+               for(var i = 0; i < this.node.items.size;i++) {
+                       var ele = this.node.items.get(i);
+                       if (ele.props.has_key("* prop")) {
+                               continue;
+                       }
+                       if (n > 0) {
+                                itms += ",\n";
+                       }
+                       n++;
+                       itms += this.pad + "    "  +
+                               this.mungeChild( this.pad + "        ",  ele);
+                       
+                       
+               }
+               itms +=  "\n"+  this.pad + "]"  + "\n";
+               this.els.add(itms);
+       }
+
+               // finally output listeners...
+               
+       public void xIncludeToString()
+       {
+               
+
+       }
+
+}
+       
+        
+       
+       
diff --git a/old-javascript/JsRender/NodeToVala.vala b/old-javascript/JsRender/NodeToVala.vala
new file mode 100644 (file)
index 0000000..f632a1d
--- /dev/null
@@ -0,0 +1,772 @@
+/**
+ * 
+ * Code to convert node tree to Javascript...
+ * 
+ * usage : x = (new JsRender.NodeToJs(node)).munge();
+ * 
+*/
+
+
+
+
+public class JsRender.NodeToVala : Object {
+
+        Node node;
+
+       int depth;
+       string inpad;
+       string pad;
+       string ipad;
+       string cls;
+       string xcls;
+       
+       string ret;
+
+       Gee.ArrayList<string> ignoreList;
+       Gee.ArrayList<string> ignoreWrappedList; 
+       Gee.ArrayList<string> myvars;
+       Gee.ArrayList<Node> vitems; // top level items
+       NodeToVala top;
+       JsRender file;
+       
+       public NodeToVala( Node node,  int depth, NodeToVala? top) 
+       {
+
+               
+               this.node = node;
+               this.depth = depth;
+               this.inpad = string.nfill(depth > 0 ? 4 : 0, ' ');
+               this.pad = this.inpad + "    ";
+               this.ipad = this.inpad + "        ";
+               this.cls = node.xvala_cls;
+               this.xcls = node.xvala_xcls;
+               this.ret = "";
+               this.top = top == null ? this : top;
+               this.ignoreList = new Gee.ArrayList<string>();
+               this.ignoreWrappedList  = new Gee.ArrayList<string>();
+               this.myvars = new Gee.ArrayList<string>();
+               this.vitems = new Gee.ArrayList<Node>();
+               this.file = null;
+       }
+
+       public int vcnt = 0;
+       string toValaNS(Node item)
+        {
+            var ns = item.get("xns") ;
+            if (ns == "GtkSource") {
+                return "Gtk.Source";
+            }
+            return ns + ".";
+        }
+       public void  toValaName(Node item, int depth =0) 
+       {
+               this.vcnt++;
+
+               var ns =  this.toValaNS(item) ;
+               var cls = ns + item.get("xtype");
+               
+               
+               item.xvala_cls = cls;
+               
+               
+               string id = item.get("id").length > 0 ?
+                       item.get("id") :  "%s%d".printf(item.get("xtype"), this.vcnt);
+
+               
+               
+               
+               if (id[0] == '*' || id[0] == '+') {
+                       item.xvala_xcls = "Xcls_" + id.substring(1);
+               } else {
+                       item.xvala_xcls = "Xcls_" + id;
+               }
+                       
+               
+               item.xvala_id =  id;
+               if (depth > 0) {                        
+                       this.vitems.add(item);
+               } else if (!item.props.has_key("id")) {
+                       // use the file name..
+                       item.xvala_xcls =  this.file.name;
+                       // is id used?
+                       item.xvala_id = this.file.name;
+
+               }
+               // loop children..
+                                                                              
+               if (item.items.size < 1) {
+                       return;
+               }
+               for(var i =0;i<item.items.size;i++) {
+                       this.toValaName(item.items.get(i), depth+1);
+               }
+                                 
+        }
+
+       public static string mungeFile(JsRender file) 
+       {
+               if (file.tree == null) {
+                       return "";
+               }
+
+               var n = new NodeToVala(file.tree, 0, null);
+               n.file = file;
+               n.vcnt = 0;
+               
+               n.toValaName(file.tree);
+               
+               
+               print("top cls %s / xlcs %s\n ",file.tree.xvala_cls,file.tree.xvala_cls); 
+               n.cls = file.tree.xvala_cls;
+               n.xcls = file.tree.xvala_xcls;
+               return n.munge();
+               
+
+       }
+       
+       public string munge ( )
+       {
+               //return this.mungeToString(this.node);
+
+               this.ignore("pack");
+               this.ignore("init");
+               this.ignore("xns");
+               this.ignore("xtype");
+               this.ignore("id");
+               
+               this.globalVars();
+               this.classHeader();
+               this.addSingleton();
+               this.addTopProperties();
+               this.addMyVars();
+               this.addPlusProperties();
+               this.addValaCtor();
+               this.addUnderThis();
+               this.addWrappedCtor();
+
+               this.addInitMyVars();
+               this.addWrappedProperties();
+               this.addChildren();
+               this.addInit();
+               this.addListeners();
+               this.addEndCtor();
+               this.addUserMethods();
+               this.iterChildren();
+               
+               return this.ret;
+                
+                    
+       } 
+       public string mungeChild(  Node cnode)
+       {
+               var x = new  NodeToVala(cnode,  this.depth+1, this.top);
+               return x.munge();
+       }
+
+       public void globalVars()
+       {
+               if (this.depth > 0) {
+                       return;
+               }
+                // Global Vars..
+                //this.ret += this.inpad + "public static " + this.xcls + "  " + this.node.xvala_id+ ";\n\n";
+
+               
+               this.ret += this.inpad + "static " + this.xcls + "  _" + this.node.xvala_id+ ";\n\n";
+                
+                
+       }
+
+       void classHeader()
+       {
+                  
+            // class header..
+            // class xxx {   WrappedGtk  el; }
+            this.ret += inpad + "public class " + this.xcls + " : Object \n" + this.inpad + "{\n";
+           this.ret +=  this.pad + "public " + this.cls + " el;\n";
+
+              
+            this.ret += this.pad + "private " + this.top.xcls + "  _this;\n\n";
+            
+            
+            
+            // singleton
+       }
+       void addSingleton() 
+       {
+            if (depth > 0) {
+                   return;
+           }
+            this.ret += pad + "public static " + xcls + " singleton()\n" + 
+                       this.pad + "{\n" +
+                       this.ipad + "if (_" + this.node.xvala_id  + " == null) {\n" +
+                       this.ipad + "    _" + this.node.xvala_id + "= new "+ this.xcls + "();\n" + // what about args?
+                       this.ipad + "}\n" +
+                       this.ipad + "return _" + this.node.xvala_id +";\n" + 
+                       this.pad + "}\n";
+       }
+            
+
+       void addTopProperties()
+       {
+               if (this.depth > 0) {
+                       return;
+               }
+               // properties - global..??
+
+               var iter = this.vitems.list_iterator();
+               while(iter.next()) {
+                       var n = iter.get();
+
+                        
+                       if (!n.props.has_key("id") || n.xvala_id.length < 0) {
+                               continue;
+                        
+                       }
+                       if (n.xvala_id[0] == '*') {
+                               continue;
+                       }
+                       if (n.xvala_id[0] == '+') {
+                               continue;
+                       }
+                       this.ret += this.pad + "public " + n.xvala_xcls + " " + n.xvala_id + ";\n";
+                }
+                
+       }
+        
+        void addMyVars()
+       {
+               this.ret += "\n" + this.ipad + "// my vars (def)\n";
+            
+
+               var cls = Palete.Gir.factoryFqn(this.node.fqn());
+           
+               if (cls == null) {
+                       return;
+               }
+         
+               
+               // Key = TYPE:name
+               var iter = this.node.props.map_iterator();
+               while (iter.next()) {
+                       var k = iter.get_key();
+                       if (this.shouldIgnore(k)) {
+                               continue;
+                       }
+                       var vv = k.strip().split(" ");
+                       // user defined method
+                       if (vv[0] == "|") {
+                               continue;
+                       }
+                       if (vv[0] == "*") {
+                               continue;
+                       }
+                       
+                       if (vv[0] == "@") {
+                               this.ret += this.pad + "public signal" + k.substring(1)  + " "  + iter.get_value() + ";\n";
+                               this.ignore(k);
+                               continue;
+                       }
+                       var min = (vv[0] == "$" || vv[0] == "#") ? 3 : 2; 
+                       if (vv.length < min) {
+                               // skip 'old js style properties without a type'
+                               continue;
+                       }
+                       
+                       var kname = vv[vv.length-1];
+
+                       if (this.shouldIgnore(kname)) {
+                               continue;
+                       }
+                       
+                       // is it a class property...
+                       if (cls.props.has_key(kname) && vv[0] != "#") {
+                               continue;
+                       }
+                       
+                       this.myvars.add(k);
+
+                           
+                       this.ret += this.pad + "public " + 
+                               (k[0] == '$' || k[0] == '#' ? k.substring(2) : k ) + ";\n";
+                       
+                       this.ignore(k);
+                       
+                       
+               }
+       }
+       
+            // if id of child is '+' then it's a property of this..
+        void addPlusProperties()
+       {
+               if (this.node.items.size < 1) {
+                     return;
+               }
+               var iter = this.node.items.list_iterator();
+               while (iter.next()) {
+                       var ci = iter.get();
+                    
+                       if (ci.xvala_id[0] != '+') {
+                               continue; // skip generation of children?
+                        
+                       }
+                       this.ret += this.pad + "public " + ci.xvala_xcls + " " + ci.xvala_id.substring(1) + ";\n";
+                               
+                    
+                }
+       }
+
+       void addValaCtor()
+       {
+            
+            
+            // .vala props.. 
+            
+               string[] cargs = {};
+               var cargs_str = "";
+               // ctor..
+               this.ret += "\n" + this.pad + "// ctor \n";
+               if (this.node.has("* args")) {
+                       // not sure what this is supposed to be ding..
+                       
+                       cargs_str = ", " + this.node.get("* args");
+                       //var ar = this.node.get("* args");.split(",");
+                       //for (var ari =0; ari < ar.length; ari++) {
+                       //      cargs +=  (ar[ari].trim().split(" ").pop();
+                      // }
+                }
+               
+               if (this.depth < 1) {
+                       this.ret += this.pad + "public " + this.xcls + "(" + 
+                                   cargs_str +")\n" + this.pad + "{\n";
+               } else {
+                
+                    //code 
+                
+                       this.ret+= this.pad + "public " + this.xcls + "(" + 
+                               this.top.xcls + " _owner " + cargs_str + ")\n" + this.pad + "{\n";
+               }
+            
+
+       }
+       void addUnderThis() 
+       {
+            // public static?
+               if (depth < 1) {
+                       this.ret += this.ipad + "_this = this;\n";
+                       return;
+               }
+               this.ret+= this.ipad + "_this = _owner;\n";
+
+               if (this.node.props.has_key("id")
+                   &&
+                   this.node.xvala_id != "" 
+                   && 
+                   this.node.xvala_id[0] != '*' 
+                   && 
+                   this.node.xvala_id[0] != '+' 
+                   ) {
+                       this.ret+= this.ipad + "_this." + node.xvala_id  + " = this;\n";
+           
+               }
+                
+                
+   
+       }
+
+       void addWrappedCtor()
+       {
+               // wrapped ctor..
+               // this may need to look up properties to fill in the arguments..
+               // introspection does not workk..... - as things like gtkmessagedialog
+               /*
+               if (cls == 'Gtk.Table') {
+
+               var methods = this.palete.getPropertiesFor(cls, 'methods');
+
+               print(JSON.stringify(this.palete.proplist[cls], null,4));
+               Seed.quit();
+               }
+               */
+               if (this.node.has("* ctor")) {
+                       
+            
+                       this.ret +=  this.ipad + "this.el = " + this.node.get("* ctor")+ ";\n";
+                       return;
+               }
+               // the ctor arguments...
+
+               // see what the 
+               var default_ctor = Palete.Gir.factoryFqn(this.node.fqn() + ".newv");
+               if (default_ctor == null) {
+                        default_ctor = Palete.Gir.factoryFqn(this.node.fqn() + ".new");
+
+               }
+               if (default_ctor != null && default_ctor.paramset != null && default_ctor.paramset.params.size > 0) {
+                       string[] args  = {};
+                       var iter =default_ctor.paramset.params.list_iterator();
+                       while (iter.next()) {
+                               var n = iter.get().name;
+                               if (!this.node.has(n)) {
+
+                                       if (iter.get().type.contains("int")) {
+                                               args += "0";
+                                               continue;
+                                       }
+                                       if (iter.get().type.contains("float")) {
+                                               args += "0f";
+                                               continue;
+                                       }
+                                       if (iter.get().type.contains("bool")) {
+                                               args += "true"; // always default to true?
+                                               continue;
+                                       }
+                                       // any other types???
+                                       
+                                       args += "null";
+                                       continue;
+                               }
+                               this.ignoreWrapped(n);
+                               this.ignore(n);
+                               
+                               var v = this.node.get(n);
+
+                               if (iter.get().type == "utf8") {
+                                       v = "\"" +  v.escape("") + "\"";
+                               }
+                               if (v == "TRUE" || v == "FALSE") {
+                                       v = v.down();
+                               }
+
+                               
+                               args += v;
+
+                       }
+                       this.ret += this.ipad + "this.el = new " + cls + "( "+ string.joinv(", ",args) + " );\n" ;
+                       return;
+                       
+               }
+               
+               
+                this.ret += this.ipad + "this.el = new " + this.cls + "();\n";
+
+            
+       }
+
+       void addInitMyVars()
+       {
+            //var meths = this.palete.getPropertiesFor(item['|xns'] + '.' + item.xtype, 'methods');
+            //print(JSON.stringify(meths,null,4));Seed.quit();
+            
+               
+            
+            // initialize.. my vars..
+               this.ret += "\n" + this.ipad + "// my vars (dec)\n";
+               
+               var iter = this.myvars.list_iterator();
+               while(iter.next()) {
+                       
+                       var k = iter.get();
+                       
+                       var ar  = k.strip().split(" ");
+                       var kname = ar[ar.length-1];
+                       
+                       var v = this.node.props.get(k);
+                       // ignore signals.. 
+                       if (v.length < 1) {
+                               continue; 
+                       }
+                       if (v == "FALSE" || v == "TRUE") {
+                               v = v.down();
+                       }
+//FIXME -- check for raw string.. "string XXXX"
+                       
+                       // if it's a string...
+                       
+                       this.ret += this.ipad + "this." + kname + " = " +   v +";\n";
+               }
+       }
+
+       
+
+
+       
+       void addWrappedProperties()
+       {
+               var cls = Palete.Gir.factoryFqn(this.node.fqn());
+               if (cls == null) {
+                       return;
+               }
+            // what are the properties of this class???
+               this.ret += "\n" + this.ipad + "// set gobject values\n";
+
+               var iter = cls.props.map_iterator();
+               while (iter.next()) {
+                       var p = iter.get_key();
+                       if (!this.node.has(p)) {
+                               continue;
+                       }
+                       if (this.shouldIgnoreWrapped(p)) {
+                               continue;
+                       }
+                       
+                       this.ignore(p);
+                       var v = this.node.get(p);
+
+                       var nodekey = this.node.get_key(p);
+
+                       // user defined properties.
+                       if (nodekey[0] == '#') {
+                               continue;
+                       }
+                               
+
+                       
+                       var is_raw = nodekey[0] == '$';
+                       
+                       // what's the type.. - if it's a string.. then we quote it..
+                       if (iter.get_value().type == "utf8" && !is_raw) {
+                                v = "\"" +  v.escape("") + "\"";
+                       }
+                       if (v == "TRUE" || v == "FALSE") {
+                               v = v.down();
+                       }
+                       if (iter.get_value().type == "gfloat" && v[v.length-1] != 'f') {
+                               v += "f";
+                       }
+                       
+                       
+                       this.ret += ipad + "this.el." + p  + " = " + v + ";\n";
+                           
+                      // got a property..
+                      
+
+               }
+           
+       }
+
+       void addChildren()
+       {
+                //code
+               if (this.node.items.size < 1) {
+                       return;
+               }
+             
+               var iter = this.node.items.list_iterator();
+               var i = -1;
+               while (iter.next()) {
+                       i++;
+                
+                       var ci = iter.get();
+
+                       if (ci.xvala_id[0] == '*') {
+                               continue; // skip generation of children?
+                       }
+                    
+                       var xargs = "";
+                       if (ci.has("* args")) {
+                        
+                               var ar = ci.get("* args").split(",");
+                               for (var ari = 0 ; ari < ar.length; ari++ ) {
+                                       var arg = ar[ari].split(" ");
+                                       xargs += "," + arg[arg.length -1];
+                               }
+                       }
+                    
+                       this.ret += this.ipad + "var child_" + "%d".printf(i) + " = new " + ci.xvala_xcls +
+                                       "( _this " + xargs + ");\n" ;
+                                   
+                       this.ret+= this.ipad + "child_" + "%d".printf(i) +".ref();\n"; // we need to reference increase unnamed children...
+                    
+                       if (ci.has("* prop")) {
+                               this.ret+= ipad + "this.el." + ci.get("* prop") + " = child_" + "%d".printf(i) + ".el;\n";
+                               continue;
+                       }
+
+                       // not sure why we have 'true' in pack?!?
+                       if (!ci.has("pack") || ci.get("pack").down() == "false" || ci.get("pack").down() == "true") {
+                               continue;
+                       }
+                    
+                       string[]  packing =  { "add" };
+                       if (ci.has("pack")) {
+                               packing = ci.get("pack").split(",");
+                       }
+                       
+                       var pack = packing[0];
+                       this.ret += this.ipad + "this.el." + pack.strip() + " (  child_" + "%d".printf(i) + ".el " +
+                               (packing.length > 1 ? 
+                                       (", " + string.joinv(",", packing).substring(pack.length+1))
+                                       :
+                                       ""
+                                ) + " );\n";
+                       
+                              
+                       if (ci.xvala_id[0] != '+') {
+                               continue; // skip generation of children?
+                                       
+                       }
+                       this.ret+= this.ipad + "this." + ci.xvala_id.substring(1) + " =  child_" + "%d".printf(i) +  ";\n";
+                          
+               }
+       }
+
+       void addInit()
+       {
+
+           
+               if (!this.node.has("init")) {
+                           return;
+               }
+               this.ret+= "\n" + ipad + "// init method \n";
+               
+               this.ret+= "\n" + ipad + this.padMultiline(ipad, this.node.get("init"));
+
+         }
+        void addListeners()
+        {
+               if (this.node.listeners.size < 1) {
+                       return;
+               }
+                           
+            
+            
+                this.ret+= "\n" + ipad + "// listeners \n";
+
+               var iter = this.node.listeners.map_iterator();
+               while (iter.next()) {
+                       var k = iter.get_key();
+                       var v = iter.get_value();
+                       this.ret+= this.ipad + "this.el." + k + ".connect( " + 
+                                       this.padMultiline(this.ipad,v) +");\n"; 
+                    
+                }
+       }    
+        void addEndCtor()
+       {
+            
+            
+            
+               // end ctor..
+               this.ret+= this.pad + "}\n";
+       }
+
+
+       /*
+ * Standardize this crap...
+ * 
+ * standard properties (use to set)
+ *          If they are long values show the dialog..
+ *
+ * someprop : ....
+ * bool is_xxx  :: can show a pulldown.. (true/false)
+ * string html  
+ * $ string html  = string with value interpolated eg. baseURL + ".." 
+ *  Clutter.ActorAlign x_align  (typed)  -- shows pulldowns if type is ENUM? 
+ * $ untypedvalue = javascript untyped value...  
+ * _ string html ... = translatable..
+
+ * 
+ * object properties (not part of the GOjbect being wrapped?
+ * # Gee.ArrayList<Xcls_fileitem> fileitems
+ * 
+ * signals
+ * @ void open 
+ * 
+ * methods -- always text editor..
+ * | void clearFiles
+ * | someJSmethod
+ * 
+ * specials
+ * * prop -- string
+ * * args  -- string
+ * * ctor -- string
+ * * init -- big string?
+ * 
+ * event handlers (listeners)
+ *   just shown 
+ * 
+ * -----------------
+ * special ID values
+ *  +XXXX -- indicates it's a instance property / not glob...
+ *  *XXXX -- skip writing glob property (used as classes that can be created...)
+ * 
+ * 
+ */
+        
+       void addUserMethods()
+       {
+            
+               this.ret+= "\n" + pad + "// user defined functions \n";  
+            
+               // user defined functions...
+               var iter = this.node.props.map_iterator();
+               while(iter.next()) {
+                       var k = iter.get_key();
+                       if (this.shouldIgnore(k)) {
+                               continue;
+                       }
+                       // HOW TO DETERIME if its a method?            
+                       if (k[0] != '|') {
+                               //strbuilder("\n" + pad + "// skip " + k + " - not pipe \n"); 
+                               continue;
+                       }       
+                       // function in the format of {type} (args) { .... }
+                       var kk = k.substring(2);
+                       var vv = iter.get_value();
+                       this.ret += this.pad + "public " + kk + " " + this.padMultiline(this.pad, vv) + "\n";
+                       
+                
+            }
+       }
+
+       void iterChildren()
+       {
+            
+               if (this.depth > 0) {
+                       this.ret+= this.inpad + "}\n";
+               }
+               
+               var iter = this.node.items.list_iterator();
+               var i = -1;
+               while (iter.next()) {
+                       this.ret += this.mungeChild(iter.get());
+               }
+             
+               if (this.depth < 1) {
+                       this.ret+= this.inpad + "}\n";
+               }
+            
+        }
+
+       string padMultiline(string pad, string str)
+       {
+               var ar = str.strip().split("\n");
+               return string.joinv("\n" + pad , ar);
+       }
+       
+       void ignore(string i) {
+               this.ignoreList.add(i);
+               
+       }
+       void ignoreWrapped(string i) {
+               this.ignoreWrappedList.add(i);
+               
+       }
+       bool shouldIgnore(string i)
+       {
+               return ignoreList.contains(i);
+       }
+       bool shouldIgnoreWrapped(string i)
+       {
+               return ignoreWrappedList.contains(i);
+       }
+
+}
+       
+        
+       
+       
+
+
diff --git a/old-javascript/JsRender/Roo.js b/old-javascript/JsRender/Roo.js
new file mode 100644 (file)
index 0000000..332756b
--- /dev/null
@@ -0,0 +1,673 @@
+//<Script type="text/javascript">
+
+Gio = imports.gi.Gio;
+GLib= imports.gi.GLib;
+XObject = imports.XObject.XObject;
+
+  
+//----------------------- our roo verison
+Base = imports.JsRender.Base.Base;
+File = imports.File.File;
+
+
+//----------------------- our roo verison
+
+var rid = 0;
+
+Roo = XObject.define(
+    function(cfg) {
+        
+        // id ,
+        //"name":"Edit Module Details",
+        // items : 
+        //"btype":"FORM", // was to be components...
+        //"app":"Builder",
+        //"module":"Pman.Tab.BuilderTop2"
+        //console.dump(cfg);
+        
+        if (!cfg.name || !cfg.fullname ) {
+            cfg.name = cfg.path.split('/').pop().replace(/\.bjs$/, '').replace(/\.js$/, '');
+            //cfg.fullname = (cfg.parent && cfg.parent.length ? (cfg.parent + '.') : '' ) + cfg.name;
+            cfg.fullname = cfg.name;
+        }
+        
+        
+        this.items = false;
+        if (cfg.json) {
+            var jstr =  JSON.parse(cfg.json);
+            this.items = [ jstr ];
+            //console.log(cfg.items.length);
+            delete cfg.json; // not needed!
+        }
+        this.cn = [];
+        
+        Roo.superclass.constructor.call(this, cfg);
+
+        
+        // super?!?!
+        this.id = 'roo-file-' + (rid++);
+        // various loader methods..
+    },
+    Base,
+    {
+        doubleStringProps : [ 
+            'title',
+            'legend',
+            'loadingText',
+            'emptyText',
+            'qtip',
+            'value',
+            'text',
+            'emptyMsg',
+            'displayMsg'
+        ],
+        path : '', // the file path..
+        modOrder : '001', /// sequence id that this uses.
+        region : 'center',
+        parent : '',
+        title : '', // the title on displayed when loading.
+        disable : '', // use a function to that returns false to disable this..
+        permname: '', /// permission name
+        
+        items: false,
+        
+        setNSID : function(id)
+        {
+            
+            this.items[0]['|module'] = id;
+       
+            
+        },
+        
+        
+        getType: function() {
+            return 'Roo';
+        },
+       
+      
+        loadItems : function(cb, sync)
+        {
+            
+            
+            
+            print("load Items!");
+            if (this.items !== false) {
+                return false;
+            }
+            
+            var _this = this;
+             
+            function loaded(src) {
+                var cfg = JSON.parse(src);
+                print("loaded data");
+                //print(JSON.stringify(cfg, null,4));
+                _this.modOrder = cfg.modOrder || '001';
+                _this.name = cfg.name.replace(/\.bjs/, ''); // BC!
+                _this.parent =  cfg.parent;
+                _this.permname =  cfg.permname || '';
+                _this.title =  cfg.title;
+                _this.items = cfg.items || []; 
+                
+                _this.fixItems(_this, false);
+                
+                
+                
+                cb();
+            }
+            if (sync) {
+                loaded(File.read(this.path));
+                return true;
+            }
+            
+            
+            var file = Gio.file_new_for_path(this.path);
+            
+                             
+            file.read_async(0, null, function(source,result) {
+                var stream = source.read_finish(result)
+                var dstream = new Gio.DataInputStream.c_new(stream);
+                
+                loaded (dstream.read_until(""));
+                
+                
+                 
+                
+            });
+            
+            return true;
+            
+        },
+        /**
+         * old code had broken xtypes and used arrays differently,
+         * this code should try and clean it up..
+         * 
+         * 
+         */
+        fixItems : function(node, fixthis)
+        {
+            if (fixthis) {
+                // fix xtype.
+                var fn = this.guessName(node);
+                //print("guessname got " + fn);
+                if (fn) {
+                    var bits = fn.split('.');
+                    node.xtype = bits.pop();
+                    node['|xns'] = bits.join('.');
+                    
+                }
+                // fix array???
+                 
+                
+            }
+            if (!node.items || !node.items.length) {
+                return;
+            }
+            var _this = this;
+            var aitems = [];
+            var nitems = [];
+            for (var ii = 0; ii < node.items.length;ii++) { 
+                var i = node.items[ii]; 
+                
+                _this.fixItems(i, true);
+                if (i.xtype == 'Array') {
+                    aitems.push(i);
+                    return;
+                }    
+                nitems.push(i);
+            } 
+            node.items = nitems; 
+            
+            if (!aitems.length) {
+                return;
+            }
+            
+            aitems.forEach(function(i) {
+                
+                if (!i.items || !i.items.length) {
+                    return;
+                }
+                var prop = i['*prop'] + '[]';
+                // colModel to cm?
+                i.items.forEach(function(c) {
+                    c['*prop']  = prop;
+                    node.items.push(c);
+                    
+                });
+                
+                
+            });
+            
+            
+            // array handling.. 
+            
+            
+            
+            
+            
+        },
+        
+        save : function()
+        {
+            
+            print("--- JsRender.Roo.save");
+            Base.prototype.save.call(this);
+            // now write the js file..
+            var js = this.path.replace(/\.bjs$/, '.js');
+            var d = new Date();
+            var js_src = this.toSource();            
+            print("TO SOURCE in " + ((new Date()) - d) + "ms");
+            File.write(js, js_src);
+            // for bootstrap - we can write the HTML to the templates directory..
+            
+            var top = this.guessName(this.items[0]);
+            print ("TOP = " + top)
+             
+            
+            
+            
+            
+            
+        },
+        saveHTML : function(frame) {
+            var top = this.guessName(this.items[0]);
+            print ("TOP = " + top)
+            if (top != 'Roo.bootstrap.Body') {
+                return;
+            }
+            print("SAVE HTML -- ");
+            print(frame);
+            var _this = this;
+            // wait a second.
+            
+            GLib.timeout_add_seconds(0, 1, function() {
+                //    print("run refresh?");
+                var html = _this.traversedom(frame);
+                //print(html);
+                
+                //print(_this.path);
+                var dir = File.dirname(_this.path) +  File.SEPARATOR + 'templates';
+                //print(dir);
+                if (!File.isDirectory(dir)) {
+                    print("Skip no template sub-directory");
+                    return false;
+                }
+                var fn = dir + File.SEPARATOR + File.basename(_this.path).replace(/\.bjs$/, '.html');
+                //print(fn);
+                File.write(fn, html);
+                
+                
+                 return false; // only once..
+                
+                
+                
+            });
+            
+            
+            
+            
+        },
+        
+        
+        traversedom :  function(web_frame) {
+            print("TRAVERSE DOM?");
+            
+            var dom = web_frame.get_dom_document().body;
+            print(dom);
+            var ret = '';
+            //Roo.select('body > div',true).each(function(el) {
+            this.traverseDOMTree(function(s) { ret+=s; }, dom, 1);
+            return ret;
+        },
+        
+        
+        traverseDOMTree : function(cb, currentElement, depth) {
+            if (!currentElement) {
+                
+                return;
+            }
+            if (currentElement.class_name.match(/roo-dynamic/)) {
+                return;
+            }
+            
+            //Roo.log(currentElement);
+            var j;
+            var nodeName = currentElement.node_name;
+            var tagName = currentElement.tag_name;
+            
+            if  (nodeName == '#text') {
+                cb(currentElement.node_value);
+                return;
+            
+            }
+             
+            
+            
+            if(nodeName == 'BR'){
+                cb("<BR/>");
+                return;
+            }
+            if (nodeName != 'BODY') {
+                
+            
+            
+                var i = 0;
+              // Prints the node tagName, such as <A>, <IMG>, etc
+                if (tagName) {
+                    var attr = [];
+                    for(i = 0; i < currentElement.attributes.length;i++) {
+                        var aname = currentElement.attributes.item(i).name;
+                        if (aname=='id') {
+                            aname= 'xbuilderid';
+                        }
+                        // skip
+                        if (currentElement.attributes.item(i).value == 'builderel') {
+                            return;
+                        }
+                        attr.push(aname + '="' + currentElement.attributes.item(i).value + '"' );
+                    }
+                    
+                    
+                    cb("<"+currentElement.tag_name+ ( attr.length ? (' ' + attr.join(' ') ) : '') + ">");
+                } 
+                else {
+                  cb("[unknown tag]");
+                }
+            } else {
+                tagName = false;
+            }
+            // Traverse the tree
+            i = 0;
+            var currentElementChild = currentElement.child_nodes.item(i);
+            var allText = true;
+            while (currentElementChild) {
+                // Formatting code (indent the tree so it looks nice on the screen)
+                
+                if  (currentElementChild.node_name == '#text') {
+                    cb(currentElementChild.node_value);
+                    i++;
+                    currentElementChild=currentElement.child_nodes.item(i);
+                    continue;
+                }   
+                allText = false;
+                cb("\n");
+                for (j = 0; j < depth; j++) {
+                  // &#166 is just a vertical line
+                  cb("  ");
+                }               
+                
+                    
+                // Recursively traverse the tree structure of the child node
+                this.traverseDOMTree(cb, currentElementChild, depth+1);
+                i++;
+                currentElementChild=currentElement.child_nodes.item(i);
+            }
+            if (!allText) {
+                    // The remaining code is mostly for formatting the tree
+                cb("\n");
+                for (j = 0; j < depth - 1; j++) {
+                  cb("  ");
+                }     
+            }
+            if (tagName) {
+                cb("</"+tagName+">");
+            }
+            
+        },
+        
+        
+        
+         /**
+         * convert xtype for munged output..
+         * 
+         */
+        mungeXtype : function(xtype, els)
+        {
+            var bits = xtype.split('.');
+            // assume it has lenght!
+            
+            els.push("xtype: '"+ bits.pop()+"'");
+            els.push('xns: '+ bits.join('.'));
+            if (xtype.match(/bootstrap/)) {
+                els.push("'xtype-bootstrap' : '"+ xtype +"'");
+            }
+                //code
+            
+            
+            
+        },
+        
+        
+        toSourcePreview: function()
+        {
+            
+            var top = this.guessName(this.items[0]);
+            print(JSON.stringify(this.items, null,4));
+                       
+            if (!top) {
+                return false;
+            }
+            
+            
+            if (top.match(/Dialog/)) {
+                return this.toSourceDialog(true);
+            }
+            
+            if (top.match(/Modal/)) {
+                return this.toSourceModal(true);
+            }
+            
+            return this.toSourceLayout(true);
+            
+            
+            
+        },
+        
+        /**
+         * This needs to use some options on the project
+         * to determine how the file is output..
+         * 
+         * At present we are hard coding it..
+         * 
+         * 
+         */
+        toSource: function()
+        {
+            // dump the file tree back out to a string.
+            
+            // we have 2 types = dialogs and components
+            // 
+            var top = this.guessName(this.items[0]);
+            if (!top) {
+                return false;
+            }
+            if (top.match(/Dialog/)) {
+                return this.toSourceDialog();
+            }
+            
+            if (top.match(/Modal/)) {
+                return this.toSourceModal(true);
+            }
+            return this.toSourceLayout();
+            
+            /*
+            eventually support 'classes??'
+             return this.toSourceStdClass();
+            */
+              
+        },
+       
+        outputHeader : function()
+        {
+            return [
+                "//<script type=\"text/javascript\">",
+                "",
+                "// Auto generated file - created by app.Builder.js- do not edit directly (at present!)",
+                ""
+            ].join("\n");
+            
+       
+        },
+        // a standard dialog module.
+        // fixme - this could be alot neater..
+        toSourceDialog : function(isPreview) 
+        {
+            
+            isPreview = isPreview || false;
+            var items = JSON.parse(JSON.stringify(this.items[0]));
+            var o = this.mungeToString(items, false, '            ');   
+            return [
+                this.outputHeader(),
+                this.name + " = {",
+                "",
+                "    dialog : false,",
+                "    callback:  false,",
+                "",   
+                "    show : function(data, cb)",
+                "    {",
+                "        if (!this.dialog) {",
+                "            this.create();",
+                "        }",
+                "",
+                "        this.callback = cb;",
+                "        this.data = data;",
+                "        this.dialog.show(this.data._el);",
+                "        if (this.form) {",
+                "           this.form.reset();",
+                "           this.form.setValues(data);",
+                "           this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });",
+                "        }",
+                "",   
+                "    },",
+                "",
+                "    create : function()",
+                "    {",
+                "        var _this = this;",
+                "        this.dialog = Roo.factory(" + o +  ");",
+                "    }",
+                "};",
+                ""
+                
+             ].join("\n");
+             
+             
+             
+        },
+        
+        toSourceModal : function(isPreview) 
+        {
+            
+            isPreview = isPreview || false;
+            var items = JSON.parse(JSON.stringify(this.items[0]));
+            var o = this.mungeToString(items, false, '            ');   
+            return [
+                this.outputHeader(),
+                this.name + " = {",
+                "",
+                "    dialog : false,",
+                "    callback:  false,",
+                "",   
+                "    show : function(data, cb)",
+                "    {",
+                "        if (!this.dialog) {",
+                "            this.create();",
+                "        }",
+                "",
+                "        this.callback = cb;",
+                "        this.data = data;",
+                "        this.dialog.show(this.data._el);",
+                "        if (this.form) {",
+                "           this.form.reset();",
+                "           this.form.setValues(data);",
+                "           this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });",
+                "        }",
+                "",   
+                "    },",
+                "",
+                "    create : function()",
+                "    {",
+                "        var _this = this;",
+                "        this.dialog = Roo.factory(" + o +  ");",
+                "    }",
+                "};",
+                ""
+                
+             ].join("\n");
+             
+             
+             
+        },
+        
+        
+        pathToPart : function()
+        {
+            var dir = File.basename(File.dirname(this.path));
+            var modname = dir.split('.').pop();
+            
+            // now we have the 'module name'..
+            var fbits = File.basename(this.path).split('.');
+            fbits.pop(); // remove extension..
+            var npart = fbits.pop(); // this should be 'AdminProjectManager' for example...
+            if (npart.substring(0, modname.length) == modname) {
+                npart = npart.substring(modname.length);
+            }
+            return [ modname , npart];
+            
+            
+            
+            
+        },
+        
+        // a layout compoent 
+        toSourceLayout : function(isPreview) 
+        {
+            isPreview = isPreview || false;
+            var topItem = JSON.parse(JSON.stringify(this.items[0]));
+            if (isPreview) {
+                topItem.region = 'center';
+                topItem.background = false;
+            }
+            
+            var o = this.mungeToString(topItem, false, '            ');   
+             
+            var modkey = this.modOrder + '-' + this.name.replace(/[^A-Z.]+/ig, '-');
+            
+            var parent =   (this.parent ?  "'" + this.parent + "'" :  'false');
+            if (isPreview) {
+                parent = 'false'
+            }
+            
+          
+            return [
+                this.outputHeader(),
+                
+                this.name  +  " = new Roo.XComponent({",
+                "    part     :  "+ JSON.stringify(this.pathToPart()) + ",",
+                        /// critical used by builder to associate modules/parts/persm
+                "    order    : '" +modkey+"',",
+                "    region   : '" + this.region   +"',",
+                "    parent   : "+ parent + ",",
+                "    name     : " + JSON.stringify(this.title  || "unnamed module") + ",",
+                "    disabled : " + (this.disabled || 'false') +", ",
+                "    permname : '" + (this.permname|| '') +"', ",
+                    
+               // "    tree : function() { return this._tree(); },",   //BC
+                "    _tree : function()",
+                "    {",
+                "        var _this = this;", // bc
+                "        var MODULE = this;", /// this looks like a better name.
+                "        return " + o + ';',
+                "    }",
+                "});",
+                ""
+                 
+             ].join("\n");
+            
+        },
+            
+        guessName : function(ar) // turns the object into full name.
+        {
+             // eg. xns: Roo, xtype: XXX -> Roo.xxx
+            if (!ar) {
+                return false;
+            }
+            var ret = [];
+            ret.push(typeof( ar['|xns'] ) == 'undefined' ? 'Roo' : ar['|xns'] );
+            
+            
+            
+            if (typeof( ar['xtype'] ) == 'undefined' || !ar['xtype'].length) {
+                return false;
+            }
+            var xtype = ar['xtype'] + '';
+            if (xtype[0] == '*') { // prefixes????
+                xtype  = xtype.substring(1);
+            }
+            if (xtype.match(/^Roo/)) {
+                // already starts with roo...
+                ret = [];
+            }
+            ret.push(xtype);
+            var str =  ret.join('.');
+            
+            
+            
+            var pm = imports.ProjectManager.ProjectManager;
+            return pm.getPalete('Roo').guessName(ret.join('.'));
+            
+                            
+                                 
+        },
+        /*
+        getTree : function( o ) {
+            
+            
+            
+        }
+        */
+        getHelpUrl : function(cls)
+        {
+            return 'http://www.akbkhome.com/roojs1/docs/symbols/' + cls + '.html';
+        }
+        
+});
\ No newline at end of file
diff --git a/old-javascript/JsRender/Roo.vala b/old-javascript/JsRender/Roo.vala
new file mode 100644 (file)
index 0000000..c28c22c
--- /dev/null
@@ -0,0 +1,640 @@
+namespace JsRender {
+
+    static int rid = 0; 
+    class Roo : JsRender 
+    {
+       string region;
+        bool disabled;
+        
+        public Roo(Project.Project project, string path) {
+            base( project, path);
+            this.xtype = "Roo";
+             this.language = "js";
+            
+            
+            //this.items = false;
+            //if (cfg.json) {
+            //    var jstr =  JSON.parse(cfg.json);
+            //    this.items = [ jstr ];
+            //    //console.log(cfg.items.length);
+            //    delete cfg.json; // not needed!
+            // }
+            this.modOrder = "001"; /// sequence id that this uses.
+            this.region = "center";
+            this.disabled = false;
+            
+            // super?!?!
+            this.id = "file-roo-%d".printf(rid++);
+            //console.dump(this);
+            // various loader methods..
+
+            string[]  dsp = { "title",
+                "legend",
+                "loadingText",
+                "emptyText",
+                "qtip",
+                "value",
+                "text",
+                "emptyMsg",
+                "displayMsg" };
+            for (var i=0;i<dsp.length;i++) {
+                this.doubleStringProps.add(dsp[i]);
+            }
+
+            
+        }
+    
+    /*    
+        setNSID : function(id)
+        {
+            
+            this.items[0]['|module'] = id;
+       
+            
+        },
+        
+        
+        getType: function() {
+            return 'Roo';
+        },
+
+    */
+               
+       public   override void   removeFiles() {
+               var html = GLib.Path.get_dirname(this.path) +"/templates/" + name + ".html";
+               if (FileUtils.test(html, FileTest.EXISTS)) {
+                       GLib.FileUtils.remove(html);
+               }
+               var js = GLib.Path.get_dirname(this.path) +"/" + name + ".html";
+               if (FileUtils.test(js, FileTest.EXISTS)) {
+                       GLib.FileUtils.remove(js);
+               }
+       }
+               
+        public  override void  loadItems() throws GLib.Error // : function(cb, sync) == original was async.
+        {
+            
+             
+               print("load Items!");
+               if (this.tree != null) {
+                       return;
+               }
+               print("load " + this.path);
+
+               var pa = new Json.Parser();
+               pa.load_from_file(this.path);
+               var node = pa.get_root();
+
+               if (node.get_node_type () != Json.NodeType.OBJECT) {
+                       throw new Error.INVALID_FORMAT ("Unexpected element type %s", node.type_name ());
+               }
+               var obj = node.get_object ();
+       
+       
+               this.modOrder = this.jsonHasOrEmpty(obj, "modOrder");
+               this.name = this.jsonHasOrEmpty(obj, "name");
+               this.parent = this.jsonHasOrEmpty(obj, "parent");
+               this.permname = this.jsonHasOrEmpty(obj, "permname");
+               this.title = this.jsonHasOrEmpty(obj, "title");
+               this.modOrder = this.jsonHasOrEmpty(obj, "modOrder");
+
+               var bjs_version_str = this.jsonHasOrEmpty(obj, "bjs-version");
+               bjs_version_str = bjs_version_str == "" ? "1" : bjs_version_str;
+
+               
+               // load items[0] ??? into tree...
+               if (obj.has_member("items") 
+                       && 
+                       obj.get_member("items").get_node_type() == Json.NodeType.ARRAY
+                       &&
+                       obj.get_array_member("items").get_length() > 0
+               ) {
+                       this.tree = new Node(); 
+                       var ar = obj.get_array_member("items");
+                       var tree_base = ar.get_object_element(0);
+                       this.tree.loadFromJson(tree_base, int.parse(bjs_version_str));
+               }
+
+
+            
+        }
+        /**
+         * old code had broken xtypes and used arrays differently,
+         * this code should try and clean it up..
+         * 
+         * 
+         * /
+        fixItems : function(node, fixthis)
+        {
+            if (fixthis) {
+                // fix xtype.
+                var fn = this.guessName(node);
+                //print("guessname got " + fn);
+                if (fn) {
+                    var bits = fn.split('.');
+                    node.xtype = bits.pop();
+                    node['|xns'] = bits.join('.');
+                    
+                }
+                // fix array???
+                 
+                
+            }
+            if (!node.items || !node.items.length) {
+                return;
+            }
+            var _this = this;
+            var aitems = [];
+            var nitems = [];
+            node.items.forEach(function(i) {
+                
+                
+                
+                _this.fixItems(i, true);
+                if (i.xtype == 'Array') {
+                    aitems.push(i);
+                    return;
+                }    
+                nitems.push(i);
+            });
+            node.items = nitems; 
+            
+            if (!aitems.length) {
+                return;
+            }
+            
+            aitems.forEach(function(i) {
+                
+                if (!i.items || !i.items.length) {
+                    return;
+                }
+                var prop = i['*prop'] + '[]';
+                // colModel to cm?
+                i.items.forEach(function(c) {
+                    c['*prop']  = prop;
+                    node.items.push(c);
+                    
+                });
+                
+                
+            });
+            
+            
+            // array handling.. 
+            
+            
+            
+            
+            
+        },
+    */
+        
+       public  override  void save()
+        {
+            
+               print("--- JsRender.Roo.save");
+               this.saveBJS();
+
+               // no tree..
+               if (this.tree == null) {
+                       return;
+               }
+               // now write the js file..
+               string js;
+               try {
+                       Regex regex = new Regex("\\.(bjs|js)$");
+
+                       js = regex.replace(this.path,this.path.length , 0 , ".js");
+               } catch (RegexError e) {
+                       this.name = "???";
+                       print("count not make filename from path");
+                       return;
+               }
+
+
+               //var d = new Date();
+               var js_src = this.toSource();            
+               //print("TO SOURCE in " + ((new Date()) - d) + "ms");
+               try {
+                       this.writeFile(js, js_src);            
+               } catch (FileError e ) {
+                       print("Save failed\n");
+               }
+               // for bootstrap - we can write the HTML to the templates directory..
+                
+            //var top = this.guessName(this.items[0]);
+            //print ("TOP = " + top)
+             
+            
+            
+            
+        }
+
+        
+
+        
+       public override void saveHTML ( string html )
+       {
+                
+               var top = this.tree.fqn();
+               print ("TOP = " + top + "\n" );
+               if (top.index_of("Roo.bootstrap.") < 0 &&
+                   top.index_of("Roo.mailer.") < 0
+                       ) {
+                       return;
+               }
+               
+               
+// now write the js file..
+               string fn;
+               try {
+                       Regex regex = new Regex("\\.(bjs|js)$");
+
+                       fn = regex.replace(this.path,this.path.length , 0 , ".html");
+               } catch (RegexError e) {
+                       this.name = "???";
+                       print("count not make filename from path");
+                       return;
+               }
+               var bn = GLib.Path.get_basename(fn);
+               var dn = GLib.Path.get_dirname(fn);
+
+               var targetdir = dn + (
+                       top.index_of("Roo.mailer.") < 0 ? "/templates" : "" );
+                             
+               
+               if (!FileUtils.test(targetdir, FileTest.IS_DIR)) {
+                       print("Skip save - templates folder does not exist : %s\n", targetdir);
+                       return;
+               }
+               print("SAVE HTML -- %s\n%s\n",targetdir + "/" +  bn, html);
+               try {
+                       this.writeFile(targetdir + "/" +  bn , html);            
+               } catch (FileError e ) {
+                       print("SaveHtml failed\n");
+               }
+            
+            
+            
+        }
+
+       public Gee.ArrayList<string> findxincludes(Node node,   Gee.ArrayList<string> ret)
+       {
+               
+               if (node.props.has_key("* xinclude")) {
+                       ret.add(node.props.get("* xinclude"));
+               }
+               for (var i =0; i < node.items.size; i++) {
+                       this.findxincludes(node.items.get(i), ret);
+               }
+               return ret;
+                       
+       }
+           
+        /**
+        * javascript used in Webkit preview 
+         */
+        
+        public override string  toSourcePreview()
+        {
+               print("to source preview\n");
+               if (this.tree == null) {
+                       return "";
+               }
+               var top = this.tree.fqn();
+               var xinc = new Gee.ArrayList<string>(); 
+
+               this.findxincludes(this.tree, xinc);
+               print("got %d xincludes\n", xinc.size);
+               var prefix_data = "";
+               if (xinc.size > 0 ) {
+                       for(var i = 0; i < xinc.size; i++) {
+                               print("check xinclude:  %s\n", xinc.get(i));
+                               var sf = this.project.getByName(xinc.get(i));
+                               if (sf == null) {
+                                       print("Failed to find file by name?\n");
+                                       continue;
+                               }
+
+                               sf.loadItems();
+                               var xinc_str = sf.toSource();
+                               
+                               //string xinc_str;
+                               //FileUtils.get_contents(js, out xinc_str);
+                               prefix_data += "\n" + xinc_str + "\n";
+                               
+                       }
+
+               }
+
+               
+               
+               //print(JSON.stringify(this.items, null,4));
+                      
+               if (top == null) {
+                       print ("guessname returned false");
+                       return "";
+               }
+
+
+               if (top.contains("Dialog")) {
+                       return prefix_data + this.toSourceDialog(true);
+               }
+
+               if (top.contains("Modal")) {
+                       return prefix_data + this.toSourceModal(true);
+               }
+
+               return prefix_data + this.toSourceLayout(true);
+            
+            
+            
+        }
+        
+        /**
+         * This needs to use some options on the project
+         * to determine how the file is output..
+         * 
+         * At present we are hard coding it..
+         * 
+         * 
+         */
+        public override string toSource()
+        {
+            // dump the file tree back out to a string.
+            
+            // we have 2 types = dialogs and components
+            // 
+           if (this.tree == null) {
+                   return "";
+           }
+            var top = this.tree.fqn();
+            if (top == null) {
+                return "";
+            }
+            if (top.contains("Dialog")) {
+                return this.toSourceDialog(false);
+            }
+            
+            if (top.contains("Modal")) {
+                return this.toSourceModal(false);
+            }
+            return this.toSourceLayout(false);
+            
+            /*
+            eventually support 'classes??'
+             return this.toSourceStdClass();
+            */
+              
+        }
+       
+        public string outputHeader()
+        {
+               string[] s = {
+                       "//<script type=\"text/javascript\">",
+                       "",
+                       "// Auto generated file - created by app.Builder.js- do not edit directly (at present!)",
+                       ""
+                  
+               };  
+               var ret=  string.joinv("\n",s);
+               var bits = this.name.split(".");
+               if (bits.length > 1) {
+                       ret += "\nRoo.namespace(\'" + 
+                               this.name.substring(0, this.name.length - (bits[bits.length-1].length + 1)) +
+                               "');\n";
+                               
+               }
+               /// genericlly used..
+                 
+               return ret;
+            
+       
+        }
+        // a standard dialog module.
+        // fixme - this could be alot neater..
+        public string toSourceDialog(bool isPreview) 
+        {
+            
+            //var items = JSON.parse(JSON.stringify(this.items[0]));
+            
+            
+            var o = this.mungeToString("            ");   
+
+            string[] adda = { " = {",
+                "",
+                "    dialog : false,",
+                "    callback:  false,",
+                "",   
+                "    show : function(data, cb)",
+                "    {",
+                "        if (!this.dialog) {",
+                "            this.create();",
+                "        }",
+                "",
+                "        this.callback = cb;",
+                "        this.data = data;",
+                "        this.dialog.show(this.data._el);",
+                "        if (this.form) {",
+                "           this.form.reset();",
+                "           this.form.setValues(data);",
+                "           this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });",
+                "        }",
+                "",   
+                "    },",
+                "",
+                "    create : function()",
+                "    {",
+                "        var _this = this;",
+                "        this.dialog = Roo.factory(" 
+            };
+            string[] addb = {  
+                        ");",
+                "    }",
+                "};",
+                ""
+            };
+            return  this.outputHeader() + "\n" +
+                this.name + string.joinv("\n", adda) + o + string.joinv("\n", addb);
+            
+             
+             
+             
+        }
+        
+        public string toSourceModal(bool isPreview) 
+        {
+            
+            
+            //var items = JSON.parse(JSON.stringify(this.items[0]));
+            var o = this.mungeToString("            ");   
+            
+            string[] adda = { " = {",
+                "",
+                "    dialog : false,",
+                "    callback:  false,",
+                "",   
+                "    show : function(data, cb)",
+                "    {",
+                "        if (!this.dialog) {",
+                "            this.create();",
+                "        }",
+                "",
+                "        this.callback = cb;",
+                "        this.data = data;",
+                "        this.dialog.show(this.data._el);",
+                "        if (this.form) {",
+                "           this.form.reset();",
+                "           this.form.setValues(data);",
+                "           this.form.fireEvent('actioncomplete', this.form,  { type: 'setdata', data: data });",
+                "        }",
+                "",   
+                "    },",
+                "",
+                "    create : function()",
+                "    {",
+                "        var _this = this;",
+                "        this.dialog = Roo.factory("
+            };
+            string[] addb =  {
+                ");",
+                "    }",
+                "};",
+                ""
+            };
+            return this.outputHeader() + "\n" + 
+                this.name + string.joinv("\n", adda) + o + string.joinv("\n", addb);
+             
+             
+             
+        }
+        
+        
+        public string   pathToPart()
+        {
+            var dir = Path.get_basename(Path.get_dirname(this.path));
+            var ar = dir.split(".");
+            var modname = ar[ar.length-1];
+            
+            // now we have the 'module name'..
+            var fbits = Path.get_basename(this.path).split(".");
+            
+             
+            var npart = fbits[fbits.length - 2]; // this should be 'AdminProjectManager' for example...
+            if (modname.length < npart.length && npart.substring(0, modname.length) == modname) {
+                npart = npart.substring(modname.length);
+            }
+            return "[" + this.tree.quoteString(modname) + ", " + this.tree.quoteString(npart) + " ]";
+            //return ret;
+            
+            
+            
+            
+        }
+        
+        // a layout compoent 
+        public string toSourceLayout(bool isPreview) 
+        {
+          
+            
+               if (isPreview) {
+                       //       topItem.region = 'center';
+                       //    topItem.background = false;
+               }
+            
+               var o = this.mungeToString("            ");   
+               var reg = new Regex("[^A-Za-z.]+");
+            
+               string modkey = this.modOrder + "-" + reg.replace(this.name, this.name.length, 0 , "-");
+            
+               string  parent =   (this.parent.length > 0 ?  "'" + this.parent + "'" :  "false");
+
+               
+               
+               if (isPreview) {
+                       // set to false to ensure this is the top level..
+                       parent = "false";
+                       var topnode = this.tree.fqn();
+                       print("topnode = %s\n", topnode);
+                       if (GLib.Regex.match_simple("^Roo\\.bootstrap\\.",topnode) &&
+                           topnode != "Roo.bootstrap.Body"
+                       ) {
+                               parent = "\"#bootstrap-body\"";
+                       }
+                         
+               }
+            
+          
+               return 
+                       this.outputHeader() + "\n" +
+                       
+                       this.name  +  " = new Roo.XComponent({\n" +
+                       "    part     :  "+ this.pathToPart() + ",\n" +
+                               /// critical used by builder to associate modules/parts/persm
+                       "    order    : '" +modkey+"',\n" +
+                       "    region   : '" + this.region   +"',\n" +
+                       "    parent   : "+ parent + ",\n" +
+                       "    name     : " + this.tree.quoteString(this.title.length > 0 ? this.title : "unnamed module") + ",\n" +
+                       "    disabled : " + (this.disabled ? "true" : "false") +", \n" +
+                       "    permname : '" + (this.permname.length > 0 ? this.permname : "") +"', \n" +
+                           
+                      // "    tree : function() { return this._tree(); },\n" +   //BC
+                       "    _tree : function()\n" +
+                       "    {\n" +
+                       "        var _this = this;\n" + // bc
+                       "        var MODULE = this;\n" + /// this looks like a better name.
+                       "        return " + o + ";" +
+                       "    }\n" +
+                       "});\n";
+                        
+             
+            
+        }
+            
+        public new string? guessName (Node? ar) // turns the object into full name.
+        {
+             // eg. xns: Roo, xtype: XXX -> Roo.xxx
+            if (ar == null) {
+                return null;
+            }
+            
+            string[] ret = {} ;
+            ret += (ar.get("|xns").length < 1 ? "Roo": ar.get("|xns"));
+             
+            
+            if ( ar.get("xtype").length < 1) {
+                return null;
+            }
+                    
+            var xtype = ar.get("xtype");
+
+            if (xtype[0] == '*') { // prefixes????
+                xtype  = xtype.substring(1);
+            }
+            if (! Regex.match_simple("^Roo", xtype)) {
+                
+                // already starts with roo...
+                ret = {};
+            }
+            ret += xtype;
+            var str =  string.joinv(".", ret);
+            
+            return str;
+           // 
+            //Palete.Palete.factory("Roo").guessName(str);
+            
+                            
+                                 
+        }
+        
+        string getHelpUrl(string cls)
+        {
+            return "http://www.roojs.com/roojs1/docs/symbols/" + cls + ".html";
+        }
+                
+     
+    }
+}
\ No newline at end of file
diff --git a/old-javascript/JsRender/webkit_extension.c b/old-javascript/JsRender/webkit_extension.c
new file mode 100644 (file)
index 0000000..122038a
--- /dev/null
@@ -0,0 +1,20 @@
+
+#include <glib-object.h>
+#include <webkit2/webkit-web-extension.h>
+#include <stdio.h>
+
+
+static WebKitWebExtension *glob_extension;
+
+G_MODULE_EXPORT void
+webkit_web_extension_initialize (WebKitWebExtension *extension)
+{
+
+       printf("%s\n","extension initialized");
+       glob_extension = g_object_ref(extension);
+}
+
+WebKitWebExtension* get_webkit_extension()
+{
+       return glob_extension;
+}
\ No newline at end of file
diff --git a/old-javascript/Palete/Base.js b/old-javascript/Palete/Base.js
new file mode 100644 (file)
index 0000000..13f4e0f
--- /dev/null
@@ -0,0 +1,194 @@
+//<Script type="text/javascript">
+console = imports.console;
+XObject = imports.XObject.XObject;
+GLib = imports.gi.GLib; 
+File = imports.File.File;
+
+// Palete Provider..
+Base = XObject.define(
+    function(cfg) {
+    
+        XObject.extend(this, cfg);
+        // various loader methods..
+   
+    },
+    Object, 
+    {
+        
+        
+        map : false, // array of mappings   left: [] , right : []
+        
+        items : false, // the tree of nodes.
+        
+        
+        guessName : function(ar) // turns the object into full name.
+        {
+             // eg. xns: Roo, xtype: XXX -> Roo.xxx
+            if (typeof( ar['|xns'] ) == 'undefined' || typeof( ar['xtype'] ) == 'undefined') {
+                return '';
+               }
+             
+            return ar['|xns'] +'.' + ar['xtype'];
+                            
+                                 
+        },
+        /**
+         * gather a  list of potentional objects that can be added..
+         * 
+         */
+        gatherList: function (existing) {
+            existing = existing || [];
+           // existing.push('*top'); // always have top
+            var ret  = []; 
+            console.log("GATHER LIST? " + this.map.length);
+            
+            
+            function addRight(right) {
+                right.forEach(function(r) {
+                    if (ret.indexOf(r) > -1) {
+                        return;
+                    }
+                    ret.push(r);
+                });
+            }
+            
+            this.map.forEach(function(m) {
+                var done = false
+                m.left.forEach( function(left) {
+                    if (done) return; 
+                    
+                    var l = left.replace(/:.*$/, '');
+                   // print("chk:" + l + " in " + existing.join(',')); 
+                    if (existing.indexOf(l) > -1) {
+                        addRight(m.right);
+                        done =true;
+                        //return true; // no more needed..
+                    }
+                });
+                
+            });
+            ret.sort();
+            
+           // console.dump(ret);
+            return ret;
+            
+            
+            
+        },
+        
+        getDropList : function(rval)
+        {
+            
+            var ret = [];
+            this.map.forEach( function(m) {
+                if (m.right.indexOf(rval) > -1) {
+                    m.left.forEach(function(l) {
+                        if (ret.indexOf(l) > -1) {
+                            return;
+                        }
+                        ret.push(l)
+                    });
+                }
+                
+            });
+            console.log("DROP LIST:");
+            console.dump(ret);
+            return ret;
+            
+        },
+        /**
+         * basic guess type.. 
+         * 
+         */
+        findType : function (data, prop, value)
+        {
+            if (prop[0] == '|') {
+                return 'function';
+            }
+            return typeof(value);
+        },
+        
+        
+        findOptions : function(ename)
+        {
+            switch(ename.toLowerCase()) {
+                case 'boolean': 
+                    return [ 'true', 'false' ];
+                // everything else does not have options.
+                case 'string': 
+                case 'utf8': 
+                case 'int': 
+                case 'uint': 
+                case 'function': 
+                    return false;
+                default: 
+                    console.log("OOPS: = unknown type: " + ename);
+                    return false;
+            }
+        },
+        confirmCanAdd: function(parent, child) {
+            // confirms that one obj can be added to another.
+            // returns true, for items, or list of properties that can hold it..
+            return true;
+            
+        },
+        getDefaultPack: function(pname, cname) {
+            return 'add';
+        },
+        saveTemplate: function(name, data)
+        {
+            var gn = this.guessName(JSON.parse(data));
+            // store it in user's directory..
+            var appdir = GLib.get_home_dir() + '/.Builder'; 
+            
+            if (!File.isDirectory(appdir+ '/' + gn)) {
+                File.mkdir(appdir+ '/' + gn);
+            }
+            File.write(appdir+ '/' + gn + '/' +  name + '.json', data);
+            
+        },
+        /**
+         * list templates - in home directory (and app dir in future...)
+         * @param {String} name  - eg. Gtk.Window..
+         * @return {Array} list of templates available..
+         */
+        listTemplates : function(name)
+        {
+            
+            var gn = name;
+            if (typeof(gn) != 'string') {
+                gn = this.guessName(gn);
+            }
+            
+            
+            var dir= GLib.get_home_dir() + '/.Builder/' + gn; 
+            if (!File.isDirectory(dir)) {
+                return [];
+            }
+            var ret =  [];
+            File.list(dir).forEach(function(n) {
+                if (!n.match(/\.json$/)) {
+                    return;
+                }
+                
+                ret.push({
+                    path : dir + '/' + n,
+                    name:  n.replace(/\.json$/,'')
+                });
+            });
+            return ret;
+            
+        },
+        loadTemplate : function(path)
+        {
+            return JSON.parse(File.read(path));
+        }
+        
+        
+    }
+);
+
+
+
diff --git a/old-javascript/Palete/Gir.vala b/old-javascript/Palete/Gir.vala
new file mode 100644 (file)
index 0000000..e20a60a
--- /dev/null
@@ -0,0 +1,893 @@
+
+// valac -g  --pkg gee-1.0 --pkg libxml-2.0 --pkg gobject-introspection-1.0 --pkg json-glib-1.0  Palete/Gir.vala -o /tmp/Gir
+/* 
+public static int main (string[] args) {
+    
+    var g = Palete.Gir.factory("Gtk");
+       var test = g.classes.get("ToolButton");
+       
+       
+    var generator = new Json.Generator ();
+    var n = new Json.Node(Json.NodeType.OBJECT);
+    n.set_object(test.toJSON());
+    generator.set_root(n);
+    generator.indent = 4;
+    generator.pretty = true;
+    
+    print(generator.to_data(null));
+    return 0;
+}
+ */
+namespace Palete {
+       public errordomain GirError {
+               INVALID_TYPE,
+               NEED_IMPLEMENTING,
+               MISSING_FILE,
+               INVALID_VALUE,
+               INVALID_FORMAT
+       }
+       public class GirObject: Object {
+               public string name;
+               public string ns;
+               public string propertyof;
+               public string type;
+               public string nodetype;
+               public string  package;
+               
+               public GirObject paramset = null;
+               public GirObject return_value = null;
+                   
+               public bool is_instance;
+               public bool is_array;
+               public bool  is_varargs;
+               public bool  ctor_only; // specially added ctor properties..
+               public  string parent;
+               public  string value;
+               // to be filled in...
+        
+               public  string sig;
+
+               bool is_overlaid;
+
+               public  GirObject gparent;
+               public Gee.ArrayList<GirObject> params;
+               public Gee.ArrayList<string> implements;
+               public Gee.ArrayList<string> inherits; // full list of all classes and interfaces...
+               public Gee.HashMap<string,GirObject> ctors;
+               public Gee.HashMap<string,GirObject> methods;
+               public Gee.HashMap<string,string>    includes;
+               public Gee.HashMap<string,GirObject> classes;
+               public Gee.HashMap<string,GirObject> props;
+               public Gee.HashMap<string,GirObject> consts;
+               public Gee.HashMap<string,GirObject> signals;
+               public string doctxt;
+
+
+               
+               public GirObject(string nodetype, string n)
+               {
+                       this.nodetype = nodetype;
+                       this.name = n;
+                       this.ns = "";
+                       this.parent = "";
+                       this.type = "";
+                       this.propertyof = "";
+                       this.is_array = false;
+                       this.is_instance = false;
+                       this.is_varargs = false;
+                       this.ctor_only  =false;
+                       this.doctxt = "";
+               
+                       this.sig = "";
+
+                       this.gparent = null;
+                       
+                       this.implements = new Gee.ArrayList<string>();
+                       this.inherits  = new Gee.ArrayList<string>(); // list of all ancestors. (interfaces and parents)
+                       this.includes   = new Gee.HashMap<string,string>();
+
+                       this.params = new Gee.ArrayList<GirObject>();
+                       this.ctors      = new Gee.HashMap<string,GirObject>();
+                       this.methods    =new Gee.HashMap<string,GirObject>();
+
+                       this.classes    = new Gee.HashMap<string,GirObject>();
+                       this.props      = new Gee.HashMap<string,GirObject>();
+                       this.consts     = new Gee.HashMap<string,GirObject>();
+                       this.signals    = new Gee.HashMap<string,GirObject>();
+                       this.is_overlaid = false;
+                       this.paramset = null;
+               }
+
+               public string[] inheritsToStringArray()
+               {
+                       string[] ret = {};
+                       for(var i =0;i< this.inherits.size; i++) {
+                               ret += this.inherits.get(i);
+                       }
+                       return ret;
+
+               }
+
+               
+               public void  overlayParent()
+               {
+                       
+                       if (this.parent.length < 1 || this.is_overlaid) {
+                               this.is_overlaid = true;
+                               return;
+                       }
+                       // print("Overlaying " +this.name + " with " + this.parent + "\n");
+
+                       var pcls = this.clsToObject( this.parent);
+                       if (pcls == null) {
+                               throw new GirError.INVALID_VALUE("Could not find class : " + 
+                                       this.parent + " of " + this.name  + " in " + this.ns);
+                       }
+                       
+                       pcls.overlayParent( );
+                       this.copyFrom(pcls,false);
+                       for(var i=0; i < this.implements.size; i++) {
+                               var clsname = this.implements.get(i);
+                               var picls = this.clsToObject(clsname);
+                               this.copyFrom(picls,true);
+                       }
+                       this.is_overlaid = true;
+                       
+               }
+
+               public void overlayCtorProperties() 
+               {
+                       //print("Check overlay Ctor %s\n", this.name);
+                       if (!this.ctors.has_key("new")) {
+                               return;
+                       }
+                       var ctor = this.ctors.get("new");
+                       if (ctor.paramset == null || ctor.paramset.params.size < 1) {
+                               return;
+                       }
+                       //print("Found Ctor\n");
+                       var iter = ctor.paramset.params.list_iterator();
+                       while (iter.next()) {
+                               var n = iter.get().name;
+                               
+                               if (this.props.has_key(n)) {
+                                       continue;
+                               }
+                               if (n == "...") {
+                                       continue;
+                               }
+                               //print("Adding prop %s\n", n);
+                               
+                               // it's a new prop..
+                               var c = new GirObject("Prop",n);
+                               c.gparent = this;
+                               c.ns = this.ns;
+                               c.propertyof = this.name;
+                               c.type = iter.get().type;
+                               c.ctor_only = true;
+                               this.props.set(n, c);
+                       }
+                       
+
+               }
+
+
+               
+               public GirObject clsToObject(string in_pn)
+               {
+                       var pn = in_pn;
+                       var gir = Gir.factory (this.ns);
+                       if (in_pn.contains(".")) {
+                               gir =  Gir.factory(in_pn.split(".")[0]);
+                               pn = in_pn.split(".")[1];
+                       }
+                       
+                       return gir.classes.get(pn);
+
+                       
+               }
+               public string fqn() {
+                       // not sure if fqn really is correct here...
+                       // 
+                       return this.nodetype == "Class" || this.nodetype=="Interface"
+                                       ? this.name : (this.ns + this.name);
+               }
+               
+               public void copyFrom(GirObject pcls, bool is_interface) 
+               {
+
+                       this.inherits.add(pcls.fqn());
+
+                       var liter = pcls.inherits.list_iterator();
+                       while(liter.next()) {
+                       if (this.inherits.contains(liter.get())) {
+                                       continue;
+                               }
+                               this.inherits.add(liter.get()); 
+                       }          
+                       
+                       
+                       var iter = pcls.methods.map_iterator();
+                       while(iter.next()) {
+                       if (null != this.methods.get(iter.get_key())) {
+                                       continue;
+                               }
+                               
+                               this.methods.set(iter.get_key(), iter.get_value());
+                       }
+                       
+                       iter = pcls.props.map_iterator();
+                       while(iter.next()) {
+                                        if (null != this.props.get(iter.get_key())) {
+                                       continue;
+                               }
+                               
+                               this.props.set(iter.get_key(), iter.get_value());
+                       }               
+                       
+                       iter = pcls.signals.map_iterator();
+                       while(iter.next()) {
+                               if (null != this.signals.get(iter.get_key())) {
+                                               continue;
+                               }
+       
+                               this.signals.set(iter.get_key(), iter.get_value());
+                       }       
+               }
+               
+               public Json.Object toJSON()
+               {
+                   var r = new Json.Object();
+                   r.set_string_member("nodetype", this.nodetype);
+                   r.set_string_member("name", this.name);
+                               if (this.propertyof.length > 0) {
+                       r.set_string_member("of", this.propertyof);
+                   }
+                   if (this.type.length > 0) {
+                       r.set_string_member("type", this.type);
+                   }
+                   if (this.parent != null && this.parent.length > 0) {
+                       r.set_string_member("parent", this.parent);
+                   }
+                   if (this.sig.length > 0) {
+                       r.set_string_member("sig", this.sig);
+                   }
+               
+                   // is_arary / is_instance / is_varargs..
+
+               
+                       if (this.inherits.size > 0) {
+                       r.set_array_member("inherits", this.toJSONArrayString(this.inherits));
+                   }
+                   
+                   if (this.implements.size > 0) {
+                       r.set_array_member("implements", this.toJSONArrayString(this.implements));
+                   }
+                   
+                   if (this.params.size > 0) {
+                       r.set_array_member("params", this.toJSONArrayObject(this.params));
+                   }
+                   if (this.ctors.size > 0) {
+                       r.set_object_member("ctors", this.toJSONObject(this.ctors));
+                   }
+                   if (this.methods.size > 0) {
+                       r.set_object_member("methods", this.toJSONObject(this.methods));
+                   }
+                   if (this.includes.size > 0) {
+                       r.set_object_member("includes", this.toJSONObjectString(this.includes));
+                   }
+                   if (this.classes.size > 0) {
+                       r.set_object_member("classes", this.toJSONObject(this.classes));
+                   }
+                   if (this.props.size > 0) {
+                       r.set_object_member("props", this.toJSONObject(this.props));
+                   }
+                   if (this.consts.size > 0) {
+                       r.set_object_member("consts", this.toJSONObject(this.consts));
+                   }
+                   if (this.signals.size > 0) {
+                       r.set_object_member("signals", this.toJSONObject(this.signals));
+                   }
+                   if (this.paramset != null) {
+                       r.set_object_member("paramset", this.paramset.toJSON());
+                   }
+                   if (this.return_value != null) {
+                       r.set_object_member("return_value", this.return_value.toJSON());
+                   }
+                   return r;
+               }
+               public Json.Object toJSONObject(Gee.HashMap<string,GirObject> map)
+               {
+                   var r = new Json.Object();
+                   var iter = map.map_iterator();
+                   while(iter.next()) {
+                       r.set_object_member(iter.get_key(), iter.get_value().toJSON());
+                   }
+                   return r;
+               }
+               public Json.Object  toJSONObjectString(Gee.HashMap<string,string> map)
+               {
+                   var r = new Json.Object();
+                   var iter = map.map_iterator();
+                   while(iter.next()) {
+                       r.set_string_member(iter.get_key(), iter.get_value());
+                   }
+                   return r;
+               }
+               public Json.Array toJSONArrayString(Gee.ArrayList<string> map)
+               {
+                   var r = new Json.Array();
+                   for(var i =0;i< map.size;i++) {
+                   
+                       r.add_string_element(map.get(i));
+                   }
+                   return r;
+               }
+               public Json.Array toJSONArrayObject(Gee.ArrayList<GirObject> map)
+               {
+                   var r = new Json.Array();
+                   for(var i =0;i< map.size;i++) {
+                   
+                       r.add_object_element(map.get(i).toJSON());
+                   }
+                   return r;
+               }
+               public string asJSONString()
+               {
+                       var generator = new Json.Generator ();
+                       generator.indent = 4;
+                       generator.pretty = true;
+                       var n = new Json.Node(Json.NodeType.OBJECT);
+                       n.set_object(this.toJSON());
+                       generator.set_root(n);
+       
+                       return generator.to_data(null);
+               }
+
+               public GirObject fetchByFqn(string fqn) {
+                       //print("Searching (%s)%s for %s\n", this.nodetype, this.name, fqn);
+                       var bits = fqn.split(".");
+                       
+                       var ret = this.classes.get(bits[0]);
+                       if (ret != null) {
+                               if (bits.length < 2) {
+                                       return ret;
+                               }
+                               return ret.fetchByFqn(fqn.substring(bits[0].length+1));
+                       }
+
+                       ret = this.ctors.get(bits[0]);                  
+                       if (ret != null) {
+                               if (bits.length < 2) {
+                                       return ret;
+                               }
+                               return ret.fetchByFqn(fqn.substring(bits[0].length+1));
+                       }
+
+                       ret = this.methods.get(bits[0]);                        
+                       if (ret != null) {
+                               if (bits.length < 2) {
+                                       return ret;
+                               }
+                               return ret.fetchByFqn(fqn.substring(bits[0].length+1));
+                       }
+                       ret = this.props.get(bits[0]);                  
+                       if (ret != null) {
+                               if (bits.length < 2) {
+                                       return ret;
+                               }
+                               return ret.fetchByFqn(fqn.substring(bits[0].length+1));
+                       }
+                       ret = this.consts.get(bits[0]);                 
+                       if (ret != null) {
+                               if (bits.length < 2) {
+                                       return ret;
+                               }
+                               return ret.fetchByFqn(fqn.substring(bits[0].length+1));
+                       }
+
+                       ret = this.signals.get(bits[0]);                        
+                       if (ret != null) {
+                               if (bits.length < 2) {
+                                       return ret;
+                               }
+                               return ret.fetchByFqn(fqn.substring(bits[0].length+1));
+                       }
+                       if (this.paramset == null) {
+                               return null;
+                       }
+                       var iter = this.paramset.params.list_iterator();
+                       while (iter.next()) {
+                               var p = iter.get();
+                               if (p.name != bits[0]) {
+                                       continue;
+                               }
+                               return p;
+                       }
+                                
+                       // fixme - other queires? - enums?
+                       return null;
+               }
+
+               public string fqtype() {
+                       return Gir.fqtypeLookup(this.type, this.ns);
+               }
+       }
+           
+            
+           
+    
+    
+       public class Gir : GirObject {
+    
+               static  Gee.HashMap<string,Gir> cache = null;
+               //Gee.Hashmap<string,what> nodes;
+
+
+               
+               public static Gir?  factory(string ns) {
+                       if (cache == null) {
+                               cache = new Gee.HashMap<string,Gir>();
+                       }
+                       var ret = cache.get(ns);
+                       if (ret == null) {
+
+                               var add = new Gir(ns);
+                               cache.set(ns, add);
+                       
+                               var iter = add.classes.map_iterator();
+                               while(iter.next()) {
+                                       iter.get_value().overlayParent();
+                               }
+                               // loop again and add the ctor properties.
+                                iter = add.classes.map_iterator();
+                               while(iter.next()) {
+                                       iter.get_value().overlayCtorProperties();
+                               }       
+
+                               
+                               ret = cache.get(ns);
+                       }
+                        
+
+                       return ret;
+                       
+               }
+               public static GirObject?  factoryFqn(string fqn)  
+               {       
+                       var bits = fqn.split(".");
+                       if (bits.length < 1) {
+                               return null;
+                       }
+                       
+                       var f = (GirObject)factory(bits[0]);
+
+                       if (bits.length == 1 || f ==null) {
+                               return f;
+                       }
+                       return f.fetchByFqn(fqn.substring(bits[0].length+1)); // since classes are stored in fqn format...?
+                                           
+                       
+               }
+
+                       
+               /**
+                * guess the fqn of a type == eg. gboolean or Widget etc...
+                */
+               public static string fqtypeLookup(string type, string ns) {
+                       var g = factory(ns);
+                       if (g.classes.has_key(type)) {
+                               return ns + "." + type;
+                       }
+                       // enums..
+                       if (g.consts.has_key(type)) {
+                               return ns + "." + type;
+                       }
+                       
+                       
+                       // look at includes..
+                       var iter = g.includes.map_iterator();
+                       while(iter.next()) {
+                               // skip empty namespaces on include..?
+                               if ( iter.get_key() == "") {
+                                       continue;
+                               }
+                               var ret = fqtypeLookup(type, iter.get_key());
+                               if (ret != type) {
+                                       return ret;
+                               }
+               }       
+                       return type;
+               }
+               
+
+
+               
+
+               public static string guessDefaultValueForType(string type) {
+                       //print("guessDefaultValueForType: %s\n", type);
+                       if (type.length < 1 || type.contains(".")) {
+                               return "null";
+                       }
+                       switch(type) {
+                               case "gboolean":
+                                       return "true";
+                               case "guint":
+                                       return "0";
+                               case "utf8":
+                                       return "\"\"";
+                               default:
+                                       return "?"+  type + "?";
+                       }
+
+               }
+
+
+               
+        
+               public Gir (string ns)  
+               {
+                       var xns = ns == "Glade" ? "Gladeui" : ns;
+                       var gi = GI.Repository.get_default();
+                       gi.require(xns, null, 0);
+                       
+                       var ver = gi.get_version(xns);
+                       unowned GLib.SList<string>  pth = GI.Repository.get_search_path ();
+                       var gir_path = pth.nth_data(0).replace("/lib/girepository-1.0", "/share/gir-1.0");
+                       // 64bit...
+                       gir_path = gir_path.replace("/lib/x86_64-linux-gnu/girepository-1.0", "/share/gir-1.0");
+                       
+                       //console.log(fn);
+
+                       
+                       
+                       var file  = gir_path + "/" + xns + "-" + ver + ".gir";
+                       // print("ns: " + ns + "\n");
+                       // print("ver: " + ver + "\n");
+                       // print(file);
+
+
+                       base("Package",ns);
+                       this.ns = ns;
+                       //this.nodes = new Gee.Hashmap<string,what>();
+                    
+                       var doc = Xml.Parser.parse_file (file);
+                       var root = doc->get_root_element();
+                       this.walk( root, (GirObject) this );
+
+                       delete doc;
+               
+               }
+               public void walk(Xml.Node* element, GirObject? parent)
+               {
+                   var n = element->get_prop("name");
+                       // ignore null or c:include...
+                   if (n == null || (element->ns->prefix != null && element->ns->prefix == "c")) {
+                               n = "";
+                   }
+                   //print("%s:%s (%s ==> %s\n", element->ns->prefix , element->name , parent.name , n);
+                   switch (element->name) {
+                       case "repository":
+                           break;
+                       
+                       case "include":
+                           parent.includes.set(n, element->get_prop("version"));
+                           break;
+                       
+                       case "package":
+                           parent.package = n;
+                           break;
+                       
+                       case "c:include":
+                           break;
+                       
+                       case "namespace":
+                           parent.name = n;
+                           break;
+                       
+                       case "alias":
+                           return;
+                           //break; // not handled..
+                       
+                       case "class":
+                               var c = new GirObject("Class", parent.name + "." + n);
+                               parent.classes.set(n, c);
+                               c.ns = this.ns;
+                               c.parent = element->get_prop("parent");
+                               c.gparent = parent;
+                               if (c.parent == null) {
+                                       c.parent = "";
+                               }
+                               parent =  c;
+                               break;
+                       
+                       case "interface":
+                           var c = new GirObject("Interface", parent.name + "." + n);
+                           c.gparent = parent;
+                           parent.classes.set(n, c);
+                                               c.ns = this.ns;
+                                               c.ns = parent.name;
+                           c.parent = element->get_prop("parent");
+                                               if (c.parent == null) {
+                                                       c.parent = "";
+                                               }
+                                               parent =  c;
+                           break;
+                       
+                       
+                       case "doc":
+                           parent.doctxt = element->get_content();
+                           return;
+                       
+                       case "implements":
+                           parent.implements.add(n);
+               
+                           break;
+                       
+                       case "constructor":
+                           var c = new GirObject("Ctor",n);
+                           c.ns = this.ns;
+                           c.gparent = parent;
+                           parent.ctors.set(n,c);
+                           parent  = c;
+                           break;
+                       
+                       case "return-value":
+                           var c = new GirObject("Return", "return-value");
+                           c.gparent = parent;
+                           c.ns = this.ns;
+                           parent.return_value = c;
+                           parent =  c;
+                           break;
+                       
+                       case "virtual-method": // not sure...
+                           return;
+                       /*
+                           var c = new GirObject("Signal",n);
+                           parent.signals.set(n,c);
+                           parent = c;
+                           break;
+                       */
+                       case "signal": // Glib:signal
+                               var c = new GirObject("Signal",n.replace("-", "_"));
+                               c.gparent = parent;
+                               c.ns = this.ns;
+                               parent.signals.set(n.replace("-", "_"),c);
+                               parent = c;
+                               break;
+                           
+                       
+                     
+                       case "callback": // not sure...
+                           return;
+                       
+                       
+                       case "type":
+                           parent.type = n;
+                               
+                                               return; // no children?
+                           //break;
+                       
+                       case "method":
+                               var c = new GirObject("Method",n);
+                               c.gparent = parent;
+                               c.ns = this.ns;
+                               c.propertyof = parent.name;
+                               parent.methods.set(n,c);
+                               parent = c;
+                               break;
+                       
+                       case "parameters":
+                           var c = new GirObject("Paramset",n);
+                           c.gparent = parent;
+                           c.ns = this.ns;
+                           parent.paramset = c;
+                           parent =  c;
+                           break;
+                       
+                       case "instance-parameter":
+                                       break;
+                                       // looks  like this is the C first arg, that is ignored (as it is 
+                                       // treated as 'this' )
+                               var c = new GirObject("Param",n);
+                                       c.gparent = parent;
+                                       c.ns = this.ns;
+                               c.is_instance = true;
+                               parent.params.add(c);
+                               parent = c;
+                               break;
+                       
+                       case "parameter":
+                               var c = new GirObject("Param",n);
+                               c.gparent = parent;
+                               c.ns = this.ns;
+                               parent.params.add(c);
+                               parent = c;
+                               this.checkParamOverride(c);   
+                           break;
+                       
+                       case "property":
+                       case "field":
+                               var c = new GirObject("Prop",n.replace("-", "_"));
+                               c.gparent = parent;
+                               c.ns = this.ns;
+                               c.propertyof = parent.name;
+                               parent.props.set(n.replace("-", "_"),c);
+                               parent = c;
+                               break;
+                       
+                       case "function":
+                           var c = new GirObject("Function",n);
+                           c.gparent = parent;
+                           c.ns = this.ns;
+                           parent.methods.set(n,c);
+                           parent = c;
+                           break;
+                       
+                       case "array":
+                           parent.is_array = true;  
+                           break; // type is added soon..
+                       
+                       case "varargs":
+                           parent.is_varargs= true;  
+                           return;
+                       
+                       case "constant":
+                           var c = new GirObject("Const",n);
+                           c.gparent = parent;
+                           c.value = element->get_prop("value");
+                                               c.ns = this.ns;
+                           parent.consts.set(n,c);
+                           parent = c;
+                           return;
+                           //break;
+                       case "bitfield":
+                       case "enumeration":
+                               var c = new GirObject("Enum",n);
+                               c.gparent = parent;
+                               c.ns = this.ns;
+                               parent.consts.set(n,c);
+                               
+                               parent = c;
+                               break;
+                       
+                       case "member":
+                               var c = new GirObject("EnumMember",n);
+                               c.gparent = parent;
+                               c.ns = this.ns;
+                               c.value = element->get_prop("value");
+                               parent.consts.set(n,c);
+                               return;
+                               break;
+                       
+                       
+                       case "doc-deprecated":
+                           return;
+                       
+                       case "record": // struct?
+                           return;
+                        
+                                           
+                           return;
+                       case "prerequisite": // ignore?
+                           return;
+                                       case "union": // ignore?
+                           return;
+                                       default:
+                           print("UNHANDLED Gir file element: " + element->name +"\n");
+                           return;
+                   }
+                   /*
+                   if (element->name == "signal") {
+                       path += ".signal";
+                   }
+                   
+                   
+                   if (element->name == "return-value") {
+                       path += ".return-value";
+                   }
+                   print(path + ":"  + element->name + "\n");
+                   */
+                   //var d =   getAttribute(element,'doc');
+                   //if (d) {
+                    //   Seed.print(path + ':' + d);
+                   //    ret[path] = d;
+                   //}
+                   for (Xml.Node* iter = element->children; iter != null; iter = iter->next) {
+                       if (iter->type == Xml.ElementType.TEXT_NODE) {
+                           continue;
+                       }
+                       this.walk(iter, parent);
+                   }
+
+               }
+               public string doc(string what)
+               {
+                       var ar = what.split(".");
+                       var cls = this.classes.get(ar[1]);
+                       if (ar.length == 2) {
+                               return cls.doctxt != null ? cls.doctxt : "";
+                       }
+                       // return the property.. by default..
+                       var pr = cls.props.get(ar[2]);
+                       return pr.doctxt != null ? pr.doctxt : "";
+
+               }
+
+
+
+               public void checkParamOverride(GirObject c)
+               {
+                       var parset = c.gparent;
+                       if (parset == null || parset.nodetype != "Paramset") {
+                               return;
+                       }
+                       var method = parset.gparent;
+                       if (method == null || method.nodetype != "Ctor") {
+                               return;
+                       }
+                       var cls = method.gparent;
+                       if (cls == null || cls.nodetype != "Class") {
+                               return;
+                       }
+
+                        
+               
+                       c.name = this.fetchOverride( cls.name, method.name, c.name);
+               }
+               public static bool overrides_loaded = false;
+               public static Gee.HashMap<string,string> overrides;
+       
+               public string fetchOverride(  string cls, string method, string param)
+               {
+                       // overrides should be in a file Gir.overides
+                       // in that "Gtk.Label.new.str" : "label"
+                       this.loadOverrides();
+                       var key = "%s.%s.%s".printf(cls,method,param);
+                       //print("Chekcing for key %s\n", key);
+                       if (!overrides.has_key(key)) {
+                               return param;
+                       }
+                       return overrides.get(key);
+
+
+               }
+               public void loadOverrides()
+               {
+                       if (overrides_loaded) {
+                               return;
+                       }
+               
+                       var pa = new Json.Parser();
+                       pa.load_from_file(Builder4.Application.configDirectory() + "/resources/Gir.overides");
+                       var node = pa.get_root();
+                   
+                       if (node.get_node_type () != Json.NodeType.OBJECT) {
+                               throw new GirError.INVALID_FORMAT ("Error loading gir.overides : Unexpected element type %s", node.type_name ());
+                       }
+                       overrides = new Gee.HashMap<string,string>();
+               
+               
+                       var obj = node.get_object ();
+               
+               
+                       obj.foreach_member((o , key, value) => {
+                               //print(key+"\n");
+                                
+                               var v = obj.get_string_member(key);
+                       
+                       
+                               overrides.set(key, v);
+
+                       });
+       
+                       overrides_loaded = true;
+
+               
+
+               }
+       }       
+
+        
+}
diff --git a/old-javascript/Palete/Gtk.js b/old-javascript/Palete/Gtk.js
new file mode 100644 (file)
index 0000000..b2c68e4
--- /dev/null
@@ -0,0 +1,612 @@
+//<Script type="text/javascript">
+Gio = imports.gi.Gio;
+GIRepository  = imports.gi.GIRepository;
+GObject= imports.gi.GObject;
+xml     = imports.libxml;
+console = imports.console;
+XObject = imports.XObject.XObject;
+
+Base = imports.Palete.Base.Base;
+File = imports.File.File;
+//----------------------- our roo verison
+
+
+
+
+Gtk = XObject.define(
+    function(cfg) {
+        
+       
+        // various loader methods..
+          this.map = [];
+        this.load();
+        this.proplist = {};
+        this.comments = { }; 
+        // no parent...
+        
+       
+    },
+    Base,
+    {
+        name : 'Gtk',
+        
+        load: function () {
+                
+         
+        
+            var data = File.read(__script_path__ +'/GtkUsage.txt');
+          // print(data);
+            data  = data.split(/\n/g);
+            var state = 0;
+            var cfg = [];
+            var left = [];
+            var right = [];
+            
+            data.forEach( function(d) {
+                if (!d.length || d.match(/^\s+$/) || d.match(/^\s*\//)) { //empty
+                    return;
+                }
+                if (d.match(/^left:/)) { 
+                    state = 1;
+                    if (left.length ){
+                        
+                        cfg.push({
+                            left : left,
+                            right: right
+                        });
+                        }
+                    left = [];
+                    right = [];
+                    return;
+                }
+                if (d.match(/^right:/)) { 
+                    state = 2;
+                    return;
+                }
+                if (state == 1) {
+                    left.push(d.replace(/\s+/g, ''));
+                    return;
+                }
+                right.push(d.replace(/\s+/g, ''));
+                //Seed.quit();
+               
+            }); 
+            if (left.length ){
+                        
+                cfg.push({
+                    left : left,
+                    right: right
+                });
+            }
+            this.map = cfg;
+             
+        },
+        
+        
+        commentLoad : function(ns)
+        {
+             
+            if (typeof(this.comments[ns]) != 'undefined') {
+                return;
+            }
+
+            console.log("LOAD DOCS: " + ns);
+            var gi = GIRepository.Repository.get_default();
+            var ver = gi.get_version(ns);
+            if (!ver) {
+                this.comments[ns] = {};
+                return;
+            }
+            var ret = { };
+
+            // no idea why this is broken on my build system.
+            function getAttribute(n, name){
+                var properties = n.properties;
+                while (properties){
+                    if (properties.name == name)
+                         return properties.children.content;
+                     properties = properties.next
+                }
+                return null;
+            }
+                 
+         
+            function walk(element, path) {
+                 
+                 
+                if (!element) {
+                    return;
+                }
+                
+                var n =  getAttribute(element, 'name') ;
+                //console.log("WALK" + n);
+                if (element.name == 'signal') {
+                    path += '.signal';
+                } 
+                if (n) {
+                    path += path.length ? '.' : '';
+                    path += n;
+                }
+                if (element.name == 'return-value') {
+                    path += '.return-value';
+                }
+                
+                
+             
+                var d =   getAttribute(element,'doc');
+                if (d) {
+                 //   Seed.print(path + ':' + d);
+                    ret[path] = d;
+                }
+                
+                var child = element.children;
+
+                while (child){
+                    //console.log(child.tag);
+                    if (child.type == "element"){
+                        walk (child, path);
+                    }
+                    child = child.next;
+                }
+            }
+            
+            var pth = GIRepository.Repository.get_search_path ();
+            
+            
+            var gir_path = pth[0].replace(/lib\/girepository-1.0/, 'share\/gir-1.0');
+           
+            
+            //console.log(fn);
+            var  fn = gir_path + '/'+ ns + '-' + ver + '.gir';
+           // console.log(fn);
+            
+            if (!File.exists(fn)) {
+                console.log('missing docc file ' + fn);
+                this.comments[ns] = {};
+                
+                return;
+            }
+            var doc = xml.parseFile(fn);
+            //console.log("xmldoc?" + doc);
+            walk (doc.root, '');
+            //console.dump(ret);
+            this.comments[ns] = ret;
+            //console.dump(ret);
+
+        },
+       
+        
+        doc : function(what) {
+            var ns = what.split('.').shift();
+            this.commentLoad(ns);
+            return typeof(this.comments[ns][what]) == 'undefined' ?  '' : this.comments[ns][what];
+        },
+  
+        getPropertiesFor: function(ename, type)
+        {
+            //print("Loading for " + ename);
+            
+            if (typeof(this.proplist[ename]) != 'undefined') {
+                //print("using cache");
+                return this.proplist[ename][type];
+            }
+            // use introspection to get lists..
+            var gi = GIRepository.Repository.get_default();
+            var es = ename.split('.');
+            
+            var giname = es[0];
+            giname = giname == 'Glade' ? 'Gladeui' : giname;
+            
+            imports.gi[giname ];
+            var bi = gi.find_by_name(giname , es[1]);
+            
+            if (!bi) {
+                print("COULND NOT FIND BY NAME");
+                return [];
+            }
+            var etype = bi.get_type();;
+            var meth = etype == GIRepository.InfoType.INTERFACE ?
+                [ 
+                    'interface_info_get_n_properties',
+                    'interface_info_get_property',
+                    'interface_info_get_n_signals',
+                    'interface_info_get_signal',
+                    'interface_info_get_n_methods',
+                    'interface_info_get_method'
+                ] : [ 
+                    'object_info_get_n_properties',
+                    'object_info_get_property',
+                    'object_info_get_n_signals',
+                    'object_info_get_signal',
+                    'object_info_get_n_methods',
+                    'object_info_get_method'
+                ]; 
+            
+            
+            this.proplist[ename] = {}
+            this.proplist[ename]['props'] = [];
+            this.proplist[ename]['events'] = [];
+            this.proplist[ename]['methods'] = [];
+            this.proplist[ename]['inherits']= [];
+            
+            var plist = this.proplist[ename]['props'] ;
+            var elist = this.proplist[ename]['events'];
+            var mlist = this.proplist[ename]['methods'];
+            var ilist = this.proplist[ename]['inherits'];
+             /*
+             we need...
+             p.name
+            p.type
+            p.desc
+            p.sig */
+            
+            // properties.. -- and parent ones...!!!
+            for (var i =0;i <  GIRepository[meth[0]](bi); i++) {
+                var prop = GIRepository[meth[1]](bi,i);  
+                var n_original =  prop.get_name();
+                
+                var flags =  GIRepository.property_info_get_flags(prop); // check for readonly..
+                
+                
+                var ty = this.typeToName(GIRepository.property_info_get_type(prop));
+                var flags = GIRepository.property_info_get_flags(prop);
+                print (n_original +":"+ ty);
+                if (ty === false) {
+                    continue;
+                }
+                var add = {
+                     name :  n_original.replace(/\-/g, '_'),
+                     type :  ty,
+                     desc : this.doc(ename + '.' + n_original),
+                     sig : '',
+                     ctor_only : (flags  & GObject.ParamFlags.CONSTRUCT_ONLY) > 0
+                }
+                plist.push(add)
+            }
+           
+           
+           
+           
+           
+            // signals..
+            
+            for (var i =0;i <  GIRepository[meth[2]](bi); i++) {
+                var prop =GIRepository[meth[3]](bi,i);  
+                var n_original =  prop.get_name();
+                // print ('signal: ' + n_original); 
+                var add = {
+                    name :  n_original.replace(/\-/g, '_'),
+                    type : 'function', //???
+                    desc : this.doc(ename + '.signal.' + n_original),
+                    sig  : this.genSkel(prop) // fixme..
+                }
+                elist.push(add);
+            }
+            // methods
+            
+            for (var i =0;i <  GIRepository[meth[4]](bi); i++) {
+                var prop = GIRepository[meth[5]](bi,i);  
+                var n_original =  prop.get_name();
+                print(ename +": ADD method: " + n_original );
+                //var flags = GIRepository.property_info_get_flags(prop);
+                
+                if (n_original.match(/^new/)) {
+                    var add = {
+                        name :  n_original.replace(/\-/g, '_'),
+                        type : 'ctor', //???
+                        desc : '',
+                        //desc : this.doc(ename + "."+ n_original)
+                    };
+                    this.genParams(prop,add);
+                    mlist.push(add);
+                    continue;
+                }
+                continue;
+                // not sure why we need all the other ones...
+                //if (!(flags & GIRepository.FunctionInfoFlags.IS_METHOD)) {
+                //    continue;
+                //}
+                // print ('signal: ' + n_original); 
+                var add = {
+                    name :  n_original.replace(/\-/g, '_'),
+                    type : 'function', //???
+                    desc : '', //this.doc(ename + '.' + n_original)
+                };
+                this.genParams(prop,add);
+                mlist.push(add);
+            }
+            
+            
+            
+            
+            
+            
+            if (etype == GIRepository.InfoType.INTERFACE ) {
+               // print("SKIPPING PARENT - it's an interface?!?!");
+                  return;
+            }
+            
+            // parent!!?!!?
+            var pi = GIRepository.object_info_get_parent(bi);
+            
+            if (pi) {
+                
+                   
+                var pname = pi.get_namespace() + '.' + pi.get_name();
+                this.getPropertiesFor(pname, 'props');
+                
+                
+                elist.push.apply(elist,this.proplist[pname]['events']);
+                plist.push.apply(plist,this.proplist[pname]['props']);
+                ilist.push(pname);
+                ilist.push.apply(ilist,this.proplist[pname]['inherits']);
+                
+                this.overrides(mlist, this.proplist[pname]['methods']);
+                
+                
+            } else {
+                print("NO PARENT FOUND?");
+            }
+            
+            // implements needs to be more carefull as it could add dupes..
+            // use the parent implements list to ensure no dupes..
+            for(var i =0; i < GIRepository.object_info_get_n_interfaces(bi); i++) {
+                 
+                var prop = GIRepository.object_info_get_interface(bi,i);
+                var iface = prop.get_namespace() +'.'+ prop.get_name();
+                if ( ilist.indexOf(iface) > -1) {
+                    continue;
+                }
+                this.getPropertiesFor(iface, 'props'); // just load one of them..
+                ilist.push(iface);
+                
+                elist.push.apply(elist,this.proplist[iface]['events']);
+                plist.push.apply(plist,this.proplist[iface]['props']);
+                this.overrides(mlist, this.proplist[pname]['methods']);
+            }
+            function sfunc(a,b) {
+                if (a.name == b.name) return 0;
+                return a.name > b.name ? 1 : -1
+            }
+            plist.sort(sfunc);
+            elist.sort(sfunc);
+            mlist.sort(sfunc);
+            
+            return this.proplist[ename][type];
+            
+        },
+        genParams: function(sig, meth)
+        {
+            var args = ['self'];
+            var ret = "\n";
+            meth.ret_type = this.typeToName(GIRepository.callable_info_get_return_type(sig));
+            // might be a numbeR??
+            meth.params = [];
+            for(var a_i  =0; a_i   < GIRepository.callable_info_get_n_args(sig); a_i++) {
+                var arg = GIRepository.callable_info_get_arg(sig, a_i);
+                print(arg.get_name());
+                print(arg.get_type());
+                meth.params.push({
+                    name  : arg.get_name(),
+                    type : this.typeToName(arg.get_type(), true)
+                });
+            }
+            
+                
+            
+            
+        },
+        genSkel: function(sig) // should really use genParams...
+        {
+            var args = ['self'];
+            var ret = "\n";
+            var ret_type = this.typeToName(GIRepository.callable_info_get_return_type(sig));
+            // might be a numbeR??
+            if (ret_type == 'boolean') {
+                ret = "    return false;\n";
+            }
+            for(var a_i  =0; a_i   < GIRepository.callable_info_get_n_args(sig); a_i++) {
+                var arg = GIRepository.callable_info_get_arg(sig, a_i);
+                
+                args.push(arg.get_name());
+            }
+            return 'function (' + args.join(', ') + ") {\n" + ret + "}"; 
+                
+            
+            
+        },
+        typeToName  : function (type_info, allow_iface) // find type for properties or arguments.
+        {
+            print(type_info);
+            if (type_info == 17) {
+                return 'integer';
+            }
+             
+            var x = GIRepository.type_info_get_tag(type_info);
+            print(x);
+            var ty = GIRepository.type_tag_to_string( GIRepository.type_info_get_tag(type_info));
+            print(ty);
+           
+            if ((ty == 'void') && GIRepository.type_info_is_pointer(type_info)) {
+                return false;
+            }
+            if (ty == 'array') {
+                return false; // unspported   
+            }
+            if (ty != 'interface') {
+                return ty;
+            }
+            // we can accept enum types here..
+            var interface_info = GIRepository.type_info_get_interface(type_info);
+            var interface_type = interface_info.get_type();
+            
+            if (!allow_iface && interface_type != GIRepository.InfoType.ENUM) {
+                return false;
+            }
+            return interface_info.get_namespace() + '.' + interface_info.get_name();
+            
+        },
+        /**
+         * merge two proprety arrays' ignoring what's overrriden.
+         * 
+         */
+        
+        
+        overrides : function (top, bottom)
+        {
+            function inTop(b)
+            {
+                return !top.every(function(t) {
+                    if (t.name == b.name) {
+                        return false;
+                    }
+                    return true;
+                });
+            }
+            bottom.forEach(function(e) {
+                if (!inTop(e)) {
+                    top.push(e);
+                }
+            });
+            
+        },
+        
+        /**
+         * guess type..
+         * 
+         */
+        findType : function (data, prop, value)
+        {
+            // specials??
+            if ((prop == '|xns') || (prop == 'xtype'))  {
+                return 'string';
+            }
+            
+            var qname = this.guessName(data);
+            if (prop[0] == '|') {
+                prop= prop.substring(1);
+            }
+            
+            var prs = this.getPropertiesFor(qname, 'props');
+            var ret = false;
+            prs.forEach(function(e) {
+                if (ret !== false) {
+                    return; // got it.
+                }
+                if (e.name == prop) {
+                    ret = e;
+                }
+                
+            });
+            if (!ret) {
+                return Base.prototype.findType(data, prop,value);
+            }
+             
+            // got the type
+            return ret.type;
+        },
+        
+        findOptions : function(ename)
+        {
+            
+            var es = ename.split('.');
+            if (es.length !=2) {
+                return Base.prototype.findOptions(ename);
+            }
+            var gi = GIRepository.Repository.get_default();
+            var bi = gi.find_by_name(es[0], es[1]);
+            var etype 
+            try {
+                etype = GIRepository.object_info_get_type(bi);    
+            } catch(e) {
+                return false;
+            }
+            
+            if (etype != GIRepository.InfoType.ENUM) {
+                console.log("Options not handled yet!!!");
+                return false;
+            }
+            var ret = [];
+            // got an enum.. let's return the values..
+            for(var i =0; i < bi.get_n_values(); i++) {
+                 
+                  var prop = bi.get_value(i);
+                   
+                
+                  ret.push( ename + '.' + prop.get_name().toUpperCase() ) 
+            }
+            return ret;
+        },
+        /**
+         * determine the packing types..
+         */
+        getDefaultPack: function(pname, cname) {
+            var list = this.getPackingList(pname,cname);
+           // console.dump(list);
+            
+            
+            if (!list.every(function(e) { return e.name != 'add'; })) {
+                return 'add'; // add is in our list..?? what about args..?!?
+            }
+            function toRet(e) {
+                var ret = [e.name];
+                e.params.forEach(function(p,i) {
+                    if (ret === false) { return; } // skip broken..
+                    if (i==0) { return; } // skip first..
+                    if (p.type == 'boolean') {
+                        ret.push('false');
+                        return;
+                    }
+                    if (p.type == 'number') {
+                        ret.push('0');
+                        return;
+                    }
+                    if (p.type == 'uint') {
+                        ret.push('0');
+                        return;
+                    }
+                    ret = false; // invalid!
+                });
+                return ret === false ? false : ret.join(',');
+            };
+            var packret = false;
+            list.every(function(e) {
+                
+                packret = toRet(e);
+                //print("DEFAULT PACK TEST : " + e.name + " : " +packret);
+                if (packret !== false) {
+                    return false;
+                }
+                return true; // continue
+            });
+            //print("DEFAULT PACK: " + packret);
+            // should we do best match..?
+            return packret;
+        },
+        /**
+         * get packing list..
+         */
+        getPackingList :function (pname, cname)
+        {
+            var funcs = this.getPropertiesFor(pname,'methods');
+            //print("getPackingList : ALL FUNCS");
+            //console.dump(funcs);
+            var ret = [];
+            var _this = this;
+            // let's assume top down...
+            var inherits = [ cname ];
+            inherits.push.apply(inherits, this.getPropertiesFor(cname,'inherits'));
+            funcs.forEach(function(m) {
+                if (m.params.length && (typeof(m.params[0].type) == 'string') &&
+                    inherits.indexOf(m.params[0].type) > -1) {
+                    ret.push(m);
+                }
+            });
+            return ret; 
+        }
+        
+        
+    }
+);
diff --git a/old-javascript/Palete/Gtk.vala b/old-javascript/Palete/Gtk.vala
new file mode 100644 (file)
index 0000000..5d3e8ee
--- /dev/null
@@ -0,0 +1,243 @@
+namespace Palete {
+
+       
+       
+       
+       
+       public class Introspect.El : Object
+       {
+               public enum eltype { 
+                           NS,
+                           CLASS,
+                           METHOD,
+                           PROP
+               }
+                
+            
+               public eltype type;
+       }
+
+
+       public class Gtk : Palete {
+               
+               public Gee.ArrayList<string> package_cache;
+               
+               public Gtk()
+               {
+
+
+                   
+                   base();
+                   this.name = "Gtk";
+                   this.loadPackages();         
+                               //this.load();
+                   // various loader methods..
+                     //this.map = [];
+                   //this.load();
+                   //this.proplist = {};
+                   //this.comments = { }; 
+                   // no parent...
+               }
+             
+               public override void  load () {
+
+                       this.loadUsageFile(Builder4.Application.configDirectory() + "/resources/GtkUsage.txt");
+        
+                    
+               }
+               
+               public string doc(string what) {
+                       var ns = what.split(".")[0];
+                       var gir =  Gir.factory(ns);
+                       return   gir.doc(what);
+                       
+                   //return typeof(this.comments[ns][what]) == 'undefined' ?  '' : this.comments[ns][what];
+               }
+
+                       // does not handle implements...
+               public override GirObject? getClass(string ename)
+               {
+
+                       var es = ename.split(".");
+                       var gir = Gir.factory(es[0]);
+               
+                       return gir.classes.get(es[1]);
+               
+               }
+
+               public override Gee.HashMap<string,GirObject> getPropertiesFor(string ename, string type)
+               {
+                       //print("Loading for " + ename);
+                   
+
+
+                               // if (typeof(this.proplist[ename]) != 'undefined') {
+                       //print("using cache");
+                       //   return this.proplist[ename][type];
+                       //}
+                       // use introspection to get lists..
+        
+                       var es = ename.split(".");
+                       var gir = Gir.factory(es[0]);
+               
+                       var cls = gir.classes.get(es[1]);
+                       if (cls == null) {
+                               var ret = new Gee.HashMap<string,GirObject>();
+                               return ret;
+                               //throw new Error.INVALID_VALUE( "Could not find class: " + ename);
+                       
+                       }
+
+                       //cls.parseProps();
+                       //cls.parseSignals(); // ?? needed for add handler..
+                       //cls.parseMethods(); // ?? needed for ??..
+                       //cls.parseConstructors(); // ?? needed for ??..
+
+                       cls.overlayParent();
+
+                       switch  (type) {
+                               case "props":
+                                       return cls.props;
+                               case "signals":
+                                       return cls.signals;
+                               case "methods":
+                                       return cls.methods;
+                               case "ctors":
+                                       return cls.ctors;
+                               default:
+                                       throw new Error.INVALID_VALUE( "getPropertiesFor called with: " + type);
+                                       //var ret = new Gee.HashMap<string,GirObject>();
+                                       //return ret;
+                               
+                       }
+                               
+                       
+                       //cls.overlayInterfaces(gir);
+                   
+                   
+                    
+               }
+               public string[] getInheritsFor(string ename)
+               {
+                       string[] ret = {};
+                        
+                       var cls = Gir.factoryFqn(ename);
+                        
+                       if (cls == null || cls.nodetype != "Class") {
+                               print("getInheritsFor:could not find cls: %s\n", ename);
+                               return ret;
+                       }
+                       
+                       return cls.inheritsToStringArray();
+                       
+
+               }
+         
+               public override void fillPack(JsRender.Node node,JsRender.Node parent)
+               {   
+                       
+                       string inherits =  string.joinv(" ", 
+                                      this.getInheritsFor (node.fqn())) + " ";
+                       inherits += node.fqn() + " ";
+                       //print ("fillPack:Inherits : %s\n", inherits);
+                       // parent.fqn() method ( node.fqn()
+                       var methods = this.getPropertiesFor (parent.fqn(), "methods");
+                       
+                       var res = new Gee.HashMap<string,string>();
+                       var map = methods.map_iterator();
+                       while (map.next()) {
+                               
+                               var n = map.get_key();
+                               //print ("fillPack:checking method %s\n", n);
+                               
+                               var meth = map.get_value();
+                               if (meth.paramset == null || meth.paramset.params.size < 1) {
+                                       print ("fillPack:c -- no params\n");
+                               
+                                       continue;
+                               }
+                               var fp = meth.paramset.params.get(0);
+                               
+                               var type = Gir.fqtypeLookup(fp.type, meth.ns);
+                               print ("fillPack:first param type is %s\n", type);
+
+                               
+                               if (!inherits.contains(" " + type + " ")) {
+                                       continue;
+                               }
+                               
+                               
+                               var pack = meth.name;
+                               for(var i =1; i < meth.paramset.params.size; i++) {
+                                       var ty = Gir.fqtypeLookup(meth.paramset.params.get(i).type, meth.ns);
+                                       pack += "," + Gir.guessDefaultValueForType(ty);
+                               }
+
+                               print ("fillPack:add pack:  --          %s\n",pack );
+
+                               res.set(meth.name, pack);
+                               
+                               
+
+                       }
+                       if (res.size < 1) {
+                               return ;
+                       }
+                       if (res.has_key("pack_start")) {
+                               node.props.set("* pack", res.get("pack_start"));
+                               return;
+                       }
+                       if (res.has_key("add")) {
+                               node.props.set("* pack", res.get("add"));
+                               return;
+                       }
+                       var riter = res.map_iterator();
+                       while(riter.next()) {
+                               node.props.set("* pack", riter.get_value());
+                               return;
+                       }
+                       
+                       
+               }
+               public Gee.ArrayList<string> packages()
+               {
+                       return this.package_cache;
+               }
+               
+               public void  loadPackages()
+               {
+
+                        
+                       this.package_cache = new Gee.ArrayList<string>();
+                       var context = new Vala.CodeContext ();
+                       var dirname =  Path.get_dirname (context.get_vapi_path("glib-2.0"));
+                        
+                       var dir = File.new_for_path(dirname);
+                       try {
+                               var file_enum = dir.enumerate_children(
+                                       GLib.FileAttribute.STANDARD_DISPLAY_NAME, 
+                                       GLib.FileQueryInfoFlags.NONE, 
+                                       null
+                               );
+                       
+                        
+                               FileInfo next_file; 
+                               while ((next_file = file_enum.next_file(null)) != null) {
+                                       var fn = next_file.get_display_name();
+                                       if (!Regex.match_simple("\\.vapi$", fn)) {
+                                               continue;
+                                       }
+                                       this.package_cache.add(Path.get_basename(fn).replace(".vapi", ""));
+                               }       
+                       } catch(Error e) {
+                               print("oops - something went wrong scanning the packages\n");
+                       }
+                        
+                       
+                        
+               }
+       
+    }
+}
diff --git a/old-javascript/Palete/GtkUsage.txt b/old-javascript/Palete/GtkUsage.txt
new file mode 100644 (file)
index 0000000..4895e1f
--- /dev/null
@@ -0,0 +1,290 @@
+
+// what can be added where...
+
+left:
+ *top
+right:
+       Gtk.Window 
+       Gtk.Dialog
+       Gtk.MessageDialog
+       Gtk.AboutDialog
+       Gtk.Dialog
+       Gtk.FontSelectionDialog 
+       Gtk.InputDialog 
+       Gtk.ColorSelectionDialog 
+       Gtk.FileChooserDialog
+       Gtk.Menu
+       GtkClutter.Window
+       Gtk.OffScreenWindow
+       
+    Clutter.ScrollActor
+    Clutter.Actor    
+// these should really be based on heirachy..
+left: 
+       Gtk.Window
+       Gtk.Dialog
+       Gtk.MessageDialog
+       Gtk.AboutDialog
+       Gtk.Dialog
+       Gtk.OffScreenWindow
+       
+       Gtk.Alignment 
+       Gtk.AspectFrame 
+       Gtk.HBox 
+       Gtk.VBox 
+       Gtk.HButtonBox 
+       Gtk.VButtonBox 
+       Gtk.HPaned 
+       Gtk.VPaned 
+       Gtk.Table
+       Gtk.Layout 
+       Gtk.Notebook
+       //Gtk.Table 
+       //Gtk.Fixed 
+       Gtk.Expander 
+       Gtk.Frame
+       Gtk.ScrolledWindow
+       Gtk.ToolItem
+       Gtk.Viewport
+       Gtk.Button
+       GtkClutter.Actor
+       
+right:  
+       Gtk.Alignment 
+       Gtk.AspectFrame 
+       Gtk.HBox 
+       Gtk.VBox 
+       Gtk.HButtonBox 
+       Gtk.VButtonBox 
+       Gtk.Fixed 
+       Gtk.HPaned 
+       Gtk.VPaned 
+       Gtk.Layout 
+       Gtk.Notebook 
+       Gtk.Table 
+       Gtk.Expander 
+       Gtk.Frame
+       
+       Gtk.ScrolledWindow
+       Gtk.AccelLabel 
+       Gtk.Image 
+       Gtk.Label 
+       Gtk.ProgressBar
+       Gtk.Statusbar
+       Gtk.InfoBar 
+       Gtk.StatusIcon
+       Gtk.Spinner 
+       Gtk.Button
+       Gtk.CheckButton 
+       Gtk.RadioButton 
+       Gtk.ToggleButton
+       Gtk.LinkButton
+       Gtk.ScaleButton 
+       Gtk.VolumeButton 
+       Gtk.Entry 
+       Gtk.HScale 
+       Gtk.VScale 
+       Gtk.SpinButton 
+       Gtk.TreeView
+        Gtk.TextView
+        Gtk.ComboBox 
+       Gtk.ComboBoxEntry 
+       Gtk.Menu 
+       Gtk.MenuBar 
+       Gtk.Toolbar 
+       Gtk.ToolPalette
+       Gtk.ColorButton 
+       Gtk.ColorSelection
+       Gtk.HSV
+       Gtk.FileChooserButton 
+       Gtk.FileChooserWidget
+       Gtk.FontButton 
+       GtkSource.View
+       WebKit.WebView
+    Gtk.Viewport
+       Vte.Terminal
+       GtkClutter.Embed
+       Gdl.Dock
+       Gdl.DockBar
+
+left:  
+       Gdl.Dock
+right:
+       Gdl.DockItem
+
+       
+       
+       
+left:  
+       Gdl.DockItem
+right:
+       Gdl.DockItem
+       
+       Gtk.Alignment 
+       Gtk.AspectFrame 
+       Gtk.HBox 
+       Gtk.VBox 
+       Gtk.HButtonBox 
+       Gtk.VButtonBox 
+       Gtk.Fixed 
+       Gtk.HPaned 
+       Gtk.VPaned 
+       Gtk.Layout 
+       Gtk.Notebook 
+       Gtk.Table 
+       Gtk.Expander 
+       Gtk.Frame
+       
+       Gtk.ScrolledWindow
+       Gtk.AccelLabel 
+       Gtk.Image 
+       Gtk.Label 
+       Gtk.ProgressBar
+       Gtk.Statusbar
+       Gtk.InfoBar 
+       Gtk.StatusIcon
+       Gtk.Spinner 
+       Gtk.Button
+       Gtk.CheckButton 
+       Gtk.RadioButton 
+       Gtk.ToggleButton
+       Gtk.LinkButton
+       Gtk.ScaleButton 
+       Gtk.VolumeButton 
+       Gtk.Entry 
+       Gtk.HScale 
+       Gtk.VScale 
+       Gtk.SpinButton 
+       Gtk.TreeView
+        Gtk.ComboBox 
+       Gtk.ComboBoxEntry 
+       Gtk.Menu 
+       Gtk.MenuBar 
+       Gtk.Toolbar 
+       Gtk.ToolPalette
+       Gtk.ColorButton 
+       Gtk.ColorSelection
+       Gtk.HSV
+       Gtk.FileChooserButton 
+       Gtk.FileChooserWidget
+       Gtk.FontButton 
+       GtkSource.View
+       WebKit.WebView
+       Vte.Terminal
+       GtkClutter.Embed
+       
+       
+       
+       
+left:
+       Gtk.MenuBar
+       Gtk.Menu
+right:
+       Gtk.MenuItem 
+       Gtk.ImageMenuItem 
+       Gtk.RadioMenuItem 
+       Gtk.CheckMenuItem 
+       Gtk.SeparatorMenuItem 
+       Gtk.TearoffMenuItem 
+left:
+       Gtk.MenuItem:submenu
+right: 
+       Gtk.Menu
+       
+left:       
+       Gtk.Toolbar
+right:
+       Gtk.ToolButton
+       Gtk.ToolItem
+       Gtk.MenuToolButton 
+       Gtk.ToggleToolButton
+       Gtk.RadioToolButton 
+       Gtk.ToolItemGroup 
+       Gtk.SeparatorToolItem 
+
+       
+left:
+       Gtk.TreeView
+right:
+       Gtk.TreeStore
+       Gtk.ListStore
+       Gtk.TreeModelFilter
+       Gtk.TreeViewColumn
+
+left: 
+       Gtk.TreeModelFilter
+right:
+       Gtk.TreeStore
+       Gtk.ListStore
+       
+left:  
+       Gtk.TreeViewColumn      
+right:
+       Gtk.CellRendererText
+       Gtk.CellRendererCombo
+       Gtk.CellRendererToggle
+       
+left: 
+       Gtk.CellRendererCombo:model
+       Gtk.ComboBox
+right:
+       Gtk.ListStore
+
+       
+left: 
+       Gtk.ComboBox
+right: 
+       Gtk.CellRendererText
+
+       
+       
+left:
+       Gtk.ScrolledWindow
+right: 
+       Gtk.Viewport
+
+       
+       
+left: 
+       GtkSource.View
+right: 
+       GtkSource.Buffer
+       
+       
+       
+left:
+       GtkClutter.Window
+       GtkClutter.Embed
+       
+right:
+       GtkClutter.Actor
+       
+left:
+       Gdl.Dock
+right:
+       Gdl.DockItem
+    
+
+left:
+    Clutter.ScrollActor:layout_manager
+    Clutter.Actor:layout_manager
+right:
+    Clutter.GridLayout
+    Clutter.FlowLayout
+    Clutter.FixedLayout
+    Clutter.TableLayout
+    Clutter.BinLayout
+    Clutter.BoxLayout
+
+left:
+    Clutter.ScrollActor
+    Clutter.Actor
+right:
+    Clutter.Actor
+    Clutter.ScrollActor
+    Clutter.Texture
+    Clutter.Text
+    Clutter.Rectangle
+    
+    
\ No newline at end of file
diff --git a/old-javascript/Palete/Javascript.vala b/old-javascript/Palete/Javascript.vala
new file mode 100644 (file)
index 0000000..dd3ea6e
--- /dev/null
@@ -0,0 +1,114 @@
+
+
+namespace Palete {
+
+       Javascript instance = null;
+       
+       public class Javascript {
+
+
+               public static JSCore.Object class_constructor(
+                               JSCore.Context ctx, 
+                               JSCore.Object constructor,  
+                               JSCore.Value[] arguments, 
+                              out JSCore.Value exception) 
+               {
+                       var c = new JSCore.Class (class_definition);
+                       var o = new JSCore.Object (ctx, c, null);
+                       exception = null;
+                       return o;
+               }
+               static const JSCore.StaticFunction[] class_functions = {
+                        { null, null, 0 }
+               };
+               static const JSCore.ClassDefinition class_definition = {
+                   0,
+                   JSCore.ClassAttribute.None,
+                   "App",
+                   null,
+
+                   null,
+                   class_functions,
+
+                   null,
+                   null,
+
+                   null,
+                   null,
+                   null,
+                   null,
+
+                   null,
+                   null,
+                   class_constructor,
+                   null,
+                   null
+               };
+
+               
+               public JSCore.GlobalContext js_global_context =  null;
+
+               public static Javascript singleton()
+               {
+                       if (instance == null) {
+                               instance = new Javascript();
+                       }
+                       return instance;
+               }
+               public Javascript()
+               {
+                       var goc = new JSCore.Class(  class_definition ); 
+                       this.js_global_context = new JSCore.GlobalContext(goc);
+                       
+
+               }
+               public int validate(string code, out string res)
+               {
+                       JSCore.Value ex;
+                       unowned   JSCore.GlobalContext ctx = this.js_global_context;
+                       var ret = this.js_global_context.check_script_syntax(
+                                  new JSCore.String.with_utf8_c_string(code),
+                                  null,
+                                  0,
+                                  out ex
+                       );
+                       res = ""; 
+                       if (ex.is_null(ctx)) {
+                               return -1;
+                       }
+
+                       
+                       var exo = ex.to_object(ctx, null);
+                       unowned JSCore.PropertyNameArray property_names = exo.copy_property_names (ctx);
+
+                       
+                       
+                        
+                       var js_string = new JSCore.String.with_utf8_c_string("line");
+                       var line = exo.get_property(ctx, js_string, null).to_number(ctx,null);
+                       
+                       
+
+                       // see if we can convert exception string
+                       char *c_string = new char[1024];
+                       var err_string = ex.to_string_copy (ctx, null);
+                       err_string.get_utf8_c_string (c_string, 1023);
+                       res = (string)c_string;
+                       //print ("Error on line %d\n%s\n", (int)line, res); 
+                       
+                       var rline = (int) line;
+                       
+                       return rline > 0 ? rline -1 : 0;
+               
+                       
+               }
+               
+
+       }
+
+       
+
+
+}
diff --git a/old-javascript/Palete/Palete.vala b/old-javascript/Palete/Palete.vala
new file mode 100644 (file)
index 0000000..46ef73c
--- /dev/null
@@ -0,0 +1,462 @@
+
+namespace Palete 
+{
+
+
+       public errordomain Error {
+               INVALID_TYPE,
+               NEED_IMPLEMENTING,
+               MISSING_FILE,
+               INVALID_VALUE
+       }
+
+       public class Usage : Object 
+       {
+               public Gee.ArrayList<string> left;
+               public Gee.ArrayList<string> right;
+               public Usage(Gee.ArrayList<string> ileft, Gee.ArrayList<string> iright)
+               {
+                       this.left = ileft;
+                       this.right=  iright;
+               }
+               public bool leftHas(string s)
+               {
+                       for(var i = 0 ; i < this.left.size; i++) {
+                               var m = this.left.get(i);
+                               if (s == m) {
+                                       return true;
+                               }
+                               if (!m.contains(":")) {
+                                       continue;
+                               }
+                               var ar = m.split(":");
+                               if (ar[0] == s) {
+                                       return true;
+                               }
+                       }
+                       return false;
+                               
+               }
+
+               
+       }
+
+       
+
+    static Gee.HashMap<string,Palete>? cache = null;
+    
+    public static Palete factory(string xtype)
+    {
+        if (cache == null) {
+            cache = new Gee.HashMap<string,Palete>();
+        }
+        if (cache.get(xtype) != null) {
+            return cache.get(xtype);
+        }
+        switch(xtype) {
+            case "Gtk":
+                cache.set(xtype, new Gtk());
+                break;
+            case "Roo":
+                cache.set(xtype, new Roo());
+                break;
+            default:
+                throw new Error.INVALID_TYPE("invalid argument to Palete factory");
+        }
+        return cache.get(xtype);
+    }
+       
+
+    public abstract class Palete : Object 
+    {
+        
+       
+        public string name;
+
+       public Gee.ArrayList<Usage> map;
+               
+        public Palete()
+        {
+            // nothing?
+               this.map = null;
+        }
+        
+        
+        //map : false, // array of mappings   left: [] , right : []
+        
+        //items : false, // the tree of nodes.
+        
+        
+
+
+        string  guessName(JsRender.Node ar) throws Error // turns the object into full name.
+        {
+            throw new Error.NEED_IMPLEMENTING("xxx. guessName needs implimenting");
+        }
+            
+
+            
+        /**
+         * gather a  list of potentional objects that can be added..
+         * 
+         */
+        /*
+        listChildren: function (existing) {
+            existing = existing || [];
+           // existing.push('*top'); // always have top
+            var ret  = []; 
+            console.log("GATHER LIST? " + this.map.length);
+            
+            
+            function addRight(right) {
+                right.forEach(function(r) {
+                    if (ret.indexOf(r) > -1) {
+                        return;
+                    }
+                    ret.push(r);
+                });
+            }
+            
+            this.map.forEach(function(m) {
+                var done = false
+                m.left.forEach( function(left) {
+                    if (done) return; 
+                    
+                    var l = left.replace(/:.*$/, '');
+                   // print("chk:" + l + " in " + existing.join(',')); 
+                    if (existing.indexOf(l) > -1) {
+                        addRight(m.right);
+                        done =true;
+                        //return true; // no more needed..
+                    }
+                });
+                
+            });
+            ret.sort();
+            
+           // console.dump(ret);
+            return ret;
+            
+            
+            
+        },
+        */
+       
+
+           
+       public string[] getChildList(string in_rval)
+        {
+
+               if (this.map == null) {
+                       this.load();
+               }
+               // empty == *top
+               
+               var rval = in_rval == "" ? "*top" : in_rval; 
+                               
+                               // should be a bit more than this..
+                       // -> it should look for all elements that inherit 
+               string[] ret = {};
+               var rt = new Gee.ArrayList<string>();
+               for (var i = 0; i < this.map.size; i++) {
+                       var m = this.map.get(i);
+                               
+                       if (!m.leftHas(rval)) {
+                               continue;
+                       }
+                       print("found LEFT, adding right\n");
+               
+                       for(var ii =0; ii < m.right.size; ii++) {
+                               var l = m.right.get(ii);
+                                       
+                               if (rt.index_of(l) > -1) {
+                                   continue;
+                               }
+                               //print("ADD " + string.joinv(", ", ret) + "\n");
+                               ret += l;
+                               rt.add(l);
+                       }
+                               
+                
+               }
+               print ("drop list for %s is:\n%s\n", rval, string.joinv("\n", ret));
+               //console.log("DROP LIST:");
+               //console.dump(ret);
+               return ret;
+            
+        }
+
+           
+        public string[] getDropList(string rval)
+        {
+
+               if (this.map == null) {
+                       this.load();
+               }
+
+                               
+                               // should be a bit more than this..
+                       // -> it should look for all elements that inherit 
+               string[] ret = {};
+               var rt = new Gee.ArrayList<string>();
+               for (var i = 0; i < this.map.size; i++) {
+                       var m = this.map.get(i);
+                               
+                       if (m.right.index_of(rval) < 0) {
+                               continue;
+                       }
+                       //print("found RIGHT, adding left\n");
+               
+                       for(var ii =0; ii < m.left.size; ii++) {
+                               var l = m.left.get(ii);
+                                       
+                               if (rt.index_of(l) > -1) {
+                                   continue;
+                               }
+                               //print("ADD " + string.joinv(", ", ret) + "\n");
+                               ret += l;
+                               rt.add(l);
+                       }
+                               
+                
+               }
+                print ("drop list for %s is:\n%s\n", rval, string.joinv("\n", ret));
+               //console.log("DROP LIST:");
+               //console.dump(ret);
+               return ret;
+            
+        }
+        /**
+         * basic guess type.. 
+         * 
+         * /
+        findType : function (data, prop, value)
+        {
+            if (prop[0] == '|') {
+                return 'function';
+            }
+            return typeof(value);
+        },
+        
+        
+        findOptions : function(ename)
+        {
+            switch(ename.toLowerCase()) {
+                case 'boolean': 
+                    return [ 'true', 'false' ];
+                // everything else does not have options.
+                case 'string': 
+                case 'utf8': 
+                case 'int': 
+                case 'uint': 
+                case 'function': 
+                    return false;
+                default: 
+                    console.log("OOPS: = unknown type: " + ename);
+                    return false;
+            }
+        },
+        confirmCanAdd: function(parent, child) {
+            // confirms that one obj can be added to another.
+            // returns true, for items, or list of properties that can hold it..
+            return true;
+            
+        },
+        getDefaultPack: function(pname, cname) {
+            return 'add';
+        },
+       */
+        public void saveTemplate (string name, JsRender.Node data)
+        {
+
+                       var gn = data.fqn();
+            // store it in user's directory..
+            var appdir =  GLib.Environment.get_home_dir() + "/.Builder"; 
+
+                       
+            if (!GLib.FileUtils.test(appdir+ "/" + gn, GLib.FileTest.IS_DIR)) {
+                               GLib.File.new_for_path (appdir+ "/" + gn).make_directory ();
+                               
+            }
+            GLib.FileUtils.set_contents(appdir+ "/" + gn + "/" +  name + ".json", data.toJsonString());
+            
+        }
+       
+        /**
+         * list templates - in home directory (and app dir in future...)
+         * @param {String} name  - eg. Gtk.Window..
+         * @return {Array} list of templates available..
+         */
+         
+        public  GLib.List<string> listTemplates (JsRender.Node node)
+        {
+            
+               var gn = node.fqn();
+            
+               var ret = new GLib.List<string>();
+               var dir= GLib.Environment.get_home_dir() + "/.Builder/" + gn;
+               if (!GLib.FileUtils.test(dir, GLib.FileTest.IS_DIR)) {
+                       return ret;
+               }
+                       
+
+
+                                   
+               var f = File.new_for_path(dir);
+        
+            var file_enum = f.enumerate_children(GLib.FileAttribute.STANDARD_DISPLAY_NAME, GLib.FileQueryInfoFlags.NONE, null);
+             
+            FileInfo next_file; 
+            while ((next_file = file_enum.next_file(null)) != null) {
+                var n = next_file.get_display_name();
+                       if (!Regex.match_simple ("\\.json$", n)) {
+                                       continue;
+                               }
+                               ret.append( dir + "/" + n);
+            }
+            return ret;
+            
+        }
+        public JsRender.Node? loadTemplate(string path)
+        {
+
+               var pa = new Json.Parser();
+               pa.load_from_file(path);
+               var node = pa.get_root();
+
+               if (node.get_node_type () != Json.NodeType.OBJECT) {
+                       return null;
+               }
+               var obj = node.get_object ();
+
+               var ret = new JsRender.Node();
+
+
+               ret.loadFromJson(obj, 1);
+               ret.ref(); // not sure if needed -- but we had a case where ret became uninitialized?
+               
+               return ret;
+        }
+          public   void  loadUsageFile (string fname) {
+
+
+
+                       
+               print("Palete Load called\n");
+               string raw;
+               if (!FileUtils.test (fname, FileTest.EXISTS)) {
+                       throw new Error.MISSING_FILE(fname + " not found");
+               }
+       
+               FileUtils.get_contents(fname, out raw);
+             // print(data);
+               var data  = raw.split("\n");
+               var state = 0;
+               var cfg = new Gee.ArrayList<Usage>();
+               var left = new Gee.ArrayList<string>();
+               var right = new Gee.ArrayList<string>();
+       
+               for (var i = 0; i < data.length; i++) {
+                       var d = data[i].strip();
+                       //print("READ " + d + "\n");
+                       if (
+                               d.length < 1
+                           ||
+                            Regex.match_simple ("^\\s+$", d)
+                           ||
+                               Regex.match_simple ("^\\s*/", d)
+                    ){
+                           continue;
+                       }
+                               
+                       if (Regex.match_simple ("^left:", d)) { 
+                           state = 1;
+                           if (left.size > 0 ){
+                               cfg.add(new Usage( left, right));
+                                               }
+                           left = new Gee.ArrayList<string>();
+                                       right = new Gee.ArrayList<string>();
+                           continue;
+                       }
+                        if (Regex.match_simple ("^right:", d)) { 
+                           state = 2;
+                           continue;
+                       }
+                       if (state == 1) {
+                                               //print("add left: " + d + "\n");
+                           left.add(d);
+                           continue;
+                       }
+                                       //print("add Right: " + d + "\n");
+                       right.add(d);
+                       //Seed.quit();
+                      
+               }
+               if (left.size > 0 ){
+                       cfg.add(new Usage( left, right));
+               }
+               this.map = cfg;
+
+        }
+
+       
+         
+       public Gee.HashMap<int,string>  validateCode(
+                       string code, 
+                       string property, 
+                       string ptype,
+                        JsRender.JsRender file,
+                       JsRender.Node node
+                     ) 
+       {   
+
+               //print("validate code (%s) %s\n", file.language, code);
+                
+               
+               if (file.language == "js" && (ptype == "listener" || property[0] == '|')) {
+                       var ret = new Gee.HashMap<int,string>();
+                       
+                       //var cd = new JSCore.ClassDefinitionEmpty();
+                       string errmsg;
+                       var line = Javascript.singleton().validate(
+                                  "var __aaa___ = " + code, out errmsg);
+
+                       if (line < 0) {
+                               return ret;
+                       }
+                       ret.set(line, errmsg);
+                       return ret;
+               }
+               if (file.language == "vala" ) { // not sure if we need to validate property
+                       
+                       var vs = new ValaSource(file);
+                       //var cd = new JSCore.ClassDefinitionEmpty();
+                       var ret = vs.checkFileWithNodePropChange(
+                               node, 
+                               property, 
+                               ptype,
+                                       code
+                         );
+                       return ret;
+               }
+               var ret = new Gee.HashMap<int,string>();
+
+               //print ("not javascript\n");
+               return ret;
+
+       }
+
+           
+          
+        public abstract void fillPack(JsRender.Node node,JsRender.Node parent);
+       public abstract void load();
+       public abstract Gee.HashMap<string,GirObject> getPropertiesFor(string ename, string type);
+       public abstract GirObject? getClass(string ename);
+    }
+
+
+}
+
+
+
diff --git a/old-javascript/Palete/Roo.js b/old-javascript/Palete/Roo.js
new file mode 100755 (executable)
index 0000000..9b6be06
--- /dev/null
@@ -0,0 +1,138 @@
+//<Script type="text/javascript">
+Gio       = imports.gi.Gio;
+
+console   = imports.console;
+XObject   = imports.XObject.XObject;
+
+Base      = imports.Palete.Base.Base;
+File      = imports.File.File;
+//----------------------- our roo verison
+
+
+// single instance controlled by projectmanager.
+
+Roo = XObject.define(
+    function(cfg) {
+        
+       
+        // various loader methods..
+         this.map = [];
+        this.load();
+       
+        // no parent...
+        
+       
+    },
+    Base,
+    {
+    
+        name : 'Roo',
+        
+        load: function ( o ) {
+            
+             
+            var data = File.read(__script_path__ +'/RooUsage.txt');
+            //print(data);
+            data  = data.split(/\n/g);
+            var state = 0;
+            var cfg = [];
+            var left = [];
+            var right = [];
+            
+            data.forEach( function(d) {
+                if (!d.length || d.match(/^\s+$/) || d.match(/^\//)) { //empty
+                    return;
+                }
+                if (d.match(/^left:/)) { 
+                    state = 1;
+                    if (left.length ){
+                        
+                        cfg.push({
+                            left : left,
+                            right: right
+                        });
+                        }
+                    left = [];
+                    right = [];
+                    return;
+                }
+                if (d.match(/^right:/)) { 
+                    state = 2;
+                    return;
+                }
+                if (state == 1) {
+                    left.push(d.replace(/\s+/g, ''));
+                    return;
+                }
+                right.push(d.replace(/\s+/g, ''));
+                //Seed.quit();
+               
+            }); 
+            if (left.length ){
+                        
+                cfg.push({
+                    left : left,
+                    right: right
+                });
+            }
+            this.map = cfg;
+            
+        },
+        loadProps: function()
+        {
+             
+
+            if (this.proplist) {
+                return;
+            }
+            
+           
+            
+            var data =  File.read(__script_path__ +'/rooprops.json');
+            this.proplist = JSON.parse(data).data;
+        },
+        getPropertiesFor: function(ename, type)
+        {
+            this.loadProps();
+            if (typeof(this.proplist[ename]) == 'undefined' || 
+                typeof(this.proplist[ename][type]) == 'undefined' ) {
+                    return [];
+            }
+            return this.proplist[ename][type];
+        },
+        guessName: function(ar)
+        {
+            var name = ar;
+            if (typeof(name) !== 'string') {
+                name = Base.prototype.guessName(ar);
+            }
+            
+            this.loadProps();
+            if (typeof(this.proplist[name]) != 'undefined') {
+                return name;
+            }
+            // roo toolbar is not in our DB!
+            if (name.match(/^Roo\.Toolbar\..*/)) {
+                return name;
+            }
+            
+            var match = name.split('.').pop();
+            for (var i in this.proplist) {
+                var last = i.split('.').pop();
+                if (last == match) {
+                    return i;
+                }
+                
+            }
+            return name;
+            
+            
+        }
+        
+        
+        
+    }
+);
+
+   
diff --git a/old-javascript/Palete/Roo.vala b/old-javascript/Palete/Roo.vala
new file mode 100644 (file)
index 0000000..e7845da
--- /dev/null
@@ -0,0 +1,183 @@
+namespace Palete {
+
+       
+/*     
+       
+       
+    public class Introspect.El : Object
+    {
+        public enum eltype { 
+            NS,
+            CLASS,
+            METHOD,
+            PROP
+        }
+                
+            
+        public eltype type;
+    }
+
+*/
+    public class Roo : Palete {
+               
+               
+        public Roo()
+        {
+
+
+            
+            base();
+            this.name = "Roo";
+                         
+        }
+
+       Gee.HashMap<string,GirObject> propsFromJSONArray(string type, Json.Array ar)
+       {
+
+               var ret = new Gee.HashMap<string,GirObject>();
+               
+               for (var i =0 ; i < ar.get_length(); i++) {
+                       var o = ar.get_object_element(i);
+                       var name = o.get_string_member("name"); 
+                       var prop = new GirObject(type, name );  
+                    
+                       prop.type        = o.get_string_member("type");
+                       prop.doctxt  = o.get_string_member("desc");
+                       prop.propertyof = o.has_member("memberOf") ? o.get_string_member("memberOf") : "";
+                       prop.sig = o.has_member("sig") ? o.get_string_member("sig") : "";
+                       //print(type + ":" + name +"\n");
+                       ret.set(name,prop);
+               }
+               return ret;
+       }
+        Gee.HashMap<string,GirObject> classes; 
+        public override void  load () {
+
+               if (this.classes != null) {
+                       return;
+               }
+               this.loadUsageFile(Builder4.Application.configDirectory() + "/resources/RooUsage.txt");
+               this.classes = new Gee.HashMap<string,GirObject>();
+
+            
+               var pa = new Json.Parser();
+               pa.load_from_file(Builder4.Application.configDirectory() + "/resources/roodata.json");
+               var node = pa.get_root();
+
+               var clist =  node.get_object().get_object_member("data");
+               clist.foreach_member((o , key, value) => {
+                       //print("cls:" + key+"\n");
+                
+                       var cls = new GirObject("class", key);  
+                       cls.props = this.propsFromJSONArray("prop", value.get_object().get_array_member("props"));
+                       cls.signals = this.propsFromJSONArray("signal", value.get_object().get_array_member("events"));
+                       this.classes.set(key, cls);
+               });
+                       
+               
+               
+             
+        }
+         
+        
+        public string doc(string what) {
+               return "";
+               /*var ns = what.split(".")[0];
+
+
+               
+               
+            var gir =  Gir.factory(ns);
+                       return   gir.doc(what);
+                       */
+                       
+            //return typeof(this.comments[ns][what]) == 'undefined' ?  '' : this.comments[ns][what];
+        }
+
+               // does not handle implements...
+       public override GirObject? getClass(string ename)
+       {
+               this.load();
+               return this.classes.get(ename);
+               
+       }
+           
+        public override Gee.HashMap<string,GirObject> getPropertiesFor(string ename, string type)
+        {
+                   //print("Loading for " + ename);
+                   
+
+               this.load();
+                               // if (typeof(this.proplist[ename]) != 'undefined') {
+                       //print("using cache");
+                    //   return this.proplist[ename][type];
+                   //}
+                   // use introspection to get lists..
+        
+               
+               var cls = this.classes.get(ename);
+               var ret = new Gee.HashMap<string,GirObject>();
+               if (cls == null) {
+                       print("could not find class: %s\n", ename);
+                       return ret;
+                       //throw new Error.INVALID_VALUE( "Could not find class: " + ename);
+       
+               }
+
+               //cls.parseProps();
+               //cls.parseSignals(); // ?? needed for add handler..
+               //cls.parseMethods(); // ?? needed for ??..
+               //cls.parseConstructors(); // ?? needed for ??..
+
+               //cls.overlayParent();
+
+               switch  (type) {
+                       
+                       
+                       case "props":
+                               return cls.props;
+                       case "signals":
+                               return cls.signals;
+                       case "methods":
+                               return ret;
+                       case "ctors":
+                               return ret;
+                       default:
+                               throw new Error.INVALID_VALUE( "getPropertiesFor called with: " + type);
+                               //var ret = new Gee.HashMap<string,GirObject>();
+                               //return ret;
+               
+               }
+               
+       
+               //cls.overlayInterfaces(gir);
+
+
+             
+        }
+       public string[] getInheritsFor(string ename)
+       {
+               string[] ret = {};
+               var es = ename.split(".");
+               var gir = Gir.factory(es[0]);
+               
+               var cls = gir.classes.get(es[1]);
+               if (cls == null) {
+                       return ret;
+               }
+               return cls.inheritsToStringArray();
+               
+
+       }
+
+
+       public override void fillPack(JsRender.Node node,JsRender.Node parent)
+       {   
+
+                return;
+       }
+       
+    }
+}
diff --git a/old-javascript/Palete/RooUsage.txt b/old-javascript/Palete/RooUsage.txt
new file mode 100644 (file)
index 0000000..d156db4
--- /dev/null
@@ -0,0 +1,552 @@
+
+// what can be added where...
+
+left:
+ *top
+right:
+ Roo.LayoutDialog         
+ Roo.NestedLayoutPanel
+ Roo.ContentPanel         
+ Roo.GridPanel         
+ Roo.TreePanel
+ Roo.bootstrap.Body
+ Roo.bootstrap.Modal
+ Roo.bootstrap.Container
+ Roo.mailer.Body
+  
+// added with a property..  (*prop)
+left: 
+ Roo.LayoutDialog:center
+ Roo.LayoutDialog:east          
+ Roo.LayoutDialog:west          
+ Roo.LayoutDialog:south          
+ Roo.LayoutDialog:north          
+ Roo.BorderLayout:center          
+ Roo.BorderLayout:east          
+ Roo.BorderLayout:west          
+ Roo.BorderLayout:south          
+ Roo.BorderLayout:north          
+right:
+ Roo.LayoutRegion
+
+// add with region? region= 
+left:
+  Roo.LayoutDialog
+  Roo.BorderLayout
+right:
+  Roo.ContentPanel         
+  Roo.NestedLayoutPanel
+  Roo.GridPanel
+  Roo.TreePanel
+  
+// should probably look like this
+//  Roo.ContentPanel:region=center         
+//  Roo.NestedLayoutPanel:region=center
+// Roo.GridPanel:region=center
+// Roo.TreePanel:region=center
+
+           
+left:
+  Roo.NestedLayoutPanel:layout 
+right: 
+  Roo.BorderLayout         
+           
+           
+left: 
+  Roo.ContentPanel 
+right: 
+  Roo.form.Form         
+  Roo.JsonView  
+  Roo.View
+     
+// some popup menus..     
+left:
+  Roo.ContentPanel:menu
+  Roo.NestedLayoutPanel:menu
+  Roo.GridPanel:menu
+  Roo.TreePanel:menu
+right:
+  Roo.menu.Menu
+           
+           
+// Parent items         
+left: 
+ Roo.form.Form
+ Roo.form.FieldSet 
+ Roo.form.Column 
+ Roo.form.Row
+
+right: 
+  Roo.form.Column         
+  Roo.form.FieldSet         
+  Roo.form.Row         
+  Roo.form.Hidden         
+  Roo.form.TextField         
+  Roo.form.GridField
+  Roo.form.DateField         
+  Roo.form.NumberField         
+  Roo.form.Checkbox         
+  Roo.form.Radio         
+  Roo.form.ComboBox
+  Roo.form.ComboBoxArray         
+  Roo.form.TextArea         
+  Roo.form.HtmlEditor         
+  Roo.form.FCKeditor         
+  Roo.Button         
+
+left: 
+  Roo.form.HtmlEditor:toolbars[]
+right:
+  Roo.form.HtmlEditor.ToolbarStandard
+  Roo.form.HtmlEditor.ToolbarContext
+
+left: 
+  Roo.form.HtmlEditor.ToolbarStandard:btns[]
+  Roo.form.HtmlEditor.ToolbarContext:btns[]
+right:
+  Roo.form.TextField         
+  Roo.form.DateField         
+  Roo.form.NumberField         
+  Roo.form.Checkbox         
+  Roo.form.Radio         
+  Roo.form.ComboBox         
+  Roo.form.TextArea
+  Roo.Toolbar.Button         
+  Roo.Toolbar.Fill         
+  Roo.Toolbar.Separator         
+  Roo.Toolbar.Spacer         
+  Roo.Toolbar.SplitButton         
+  Roo.Toolbar.TextItem
+
+left: 
+  Roo.grid.GridEditor:field
+right:
+  Roo.form.TextField         
+  Roo.form.DateField         
+  Roo.form.NumberField         
+  Roo.form.Checkbox         
+  Roo.form.Radio         
+  Roo.form.ComboBox         
+  Roo.form.TextArea         
+           
+           
+left:
+ Roo.LayoutDialog:buttons[]
+ Roo.form.Form:buttons[] 
+right:
+ Roo.Button         
+           
+           
+           
+           
+           
+//Toolbar           
+left: 
+ Roo.Toolbar 
+ Roo.PagingToolbar 
+right: 
+  Roo.Toolbar.Button         
+  Roo.Toolbar.Fill         
+  Roo.Toolbar.Separator         
+  Roo.Toolbar.Spacer         
+  Roo.Toolbar.SplitButton         
+  Roo.Toolbar.TextItem        
+  Roo.form.ComboBox
+  Roo.form.DateField
+  Roo.form.TextField
+
+           
+left:            
+ Roo.Toolbar.Button:menu 
+ Roo.Toolbar.SplitButton:menu
+ Roo.menu.Item:menu 
+right: 
+ Roo.menu.Menu         
+           
+           
+           
+           
+//Menu           
+left:
+ Roo.menu.Menu
+right:
+  Roo.menu.CheckItem         
+  Roo.menu.ColorItem         
+  Roo.menu.DateItem         
+  Roo.menu.DateMenu         
+  Roo.menu.Separator         
+  Roo.menu.TextItem         
+  Roo.menu.Item         
+           
+
+          
+
+//Grids           
+left: 
+       Roo.GridPanel:grid
+right:
+       Roo.grid.Grid         
+       Roo.grid.EditorGrid         
+       Roo.grid.PropertyGrid
+
+           
+left:
+  Roo.grid.Grid:sm
+  Roo.grid.EditorGrid:sm
+right:  
+ Roo.grid.CellSelectionModel         
+ Roo.grid.RowSelectionModel         
+           
+left:
+ Roo.grid.Grid:view
+right:
+ Roo.grid.EditorGrid:view          
+ Roo.grid.GridView                 
+
+left:   
+ Roo.grid.Grid:cm[] 
+ Roo.grid.EditorGrid:cm[]          
+right:
+ Roo.grid.ColumnModel
+
+left:           
+    Roo.grid.ColumnModel:editor
+right:
+    Roo.grid.GridEditor         
+        
+       
+left: 
+       Roo.grid.EditorGrid:footer
+       Roo.grid.Grid:footer
+       Roo.Grid:footer
+right:
+       Roo.PagingToolbar
+       
+       
+left: 
+       Roo.grid.EditorGrid:toolbar
+       Roo.grid.Grid:toolbar
+       Roo.Grid:toolbar
+       Roo.ContentPanel:toolbar
+       Roo.TreePanel:toolbar
+right:
+       Roo.Toolbar
+               
+       
+       
+       
+//Tree           
+left:
+ Roo.TreePanel:tree
+right:
+ Roo.tree.TreePanel         
+
+left:     
+ Roo.tree.TreePanel:root
+right:
+ Roo.tree.AsyncTreeNode         
+  Roo.tree.TreeNode         
+
+left:     
+  Roo.tree.TreePanel:editor
+right:
+  Roo.tree.TreeEditor
+
+left:     
+  Roo.tree.TreeEditor:field
+right:
+  Roo.form.TextField
+  
+
+
+left:           
+ Roo.tree.TreePanel:loader 
+right:
+ Roo.tree.TreeLoader         
+left:
+       Roo.tree.TreePanel:sm
+right:
+       Roo.tree.DefaultSelectionModel         
+       Roo.tree.MultiSelectionModel         
+
+  
+// combos
+
+left: 
+  Roo.grid.EditorGrid:ds
+  Roo.grid.Grid:ds
+  Roo.form.ComboBox:store
+  Roo.View:store
+  Roo.JsonView:store
+  Roo.bootstrap.ComboBox:store
+  Roo.bootstrap.Calendar:store
+  Roo.bootstrap.Table:store
+right: 
+  Roo.data.Store
+  Roo.data.SimpleStore
+
+left:
+    Roo.form.ComboBoxArray:combo
+right:
+    Roo.form.ComboBox
+
+left:
+  Roo.data.Store:proxy
+right:
+  Roo.data.HttpProxy
+  Roo.data.MemoryProxy
+
+left:
+  Roo.data.Store:reader
+right:
+  Roo.data.JsonReader
+  Roo.data.ArrayReader
+  Roo.data.XmlReader
+
+left:
+  Roo.View:tpl
+  Roo.JsonView:tpl
+right: 
+  Roo.Template
+
+  
+  //drag drop..
+left: 
+   Roo.grid.Grid:dragTarget
+right:
+   Roo.dd.DropTarget
+  
+  
+  
+  
+// bootstrap?
+
+left:
+    Roo.bootstrap.Body
+    Roo.bootstrap.Container
+    Roo.bootstrap.Modal
+    Roo.bootstrap.Column
+    Roo.bootstrap.Row
+    Roo.bootstrap.TabPanel
+    Roo.bootstrap.Element
+right:
+    Roo.bootstrap.Container
+    Roo.bootstrap.Button
+    Roo.bootstrap.ButtonGroup
+    Roo.bootstrap.Column
+    Roo.bootstrap.Form
+    Roo.bootstrap.Navbar
+    Roo.bootstrap.NavGroup
+    Roo.bootstrap.NavSimplebar
+    Roo.bootstrap.NavHeaderbar
+    Roo.bootstrap.NavSidebar
+    Roo.bootstrap.Row
+    Roo.bootstrap.Header
+    Roo.bootstrap.Img
+    Roo.bootstrap.Link
+    Roo.bootstrap.Calendar  
+    Roo.bootstrap.Popover
+    Roo.bootstrap.Input
+    Roo.bootstrap.TextArea
+    Roo.bootstrap.Table
+    Roo.bootstrap.Pagination
+    Roo.bootstrap.Progress
+    Roo.bootstrap.TabPanel
+    Roo.bootstrap.DateField
+    Roo.bootstrap.TimeField
+    Roo.bootstrap.CheckBox
+    Roo.bootstrap.Radio
+    Roo.bootstrap.ComboBox
+    Roo.bootstrap.Element
+    Roo.bootstrap.HtmlEditor
+    Roo.bootstrap.MessageBar
+    Roo.bootstrap.dash.NumberBox
+    Roo.bootstrap.Graph
+    Roo.bootstrap.dash.TabBox
+    Roo.bootstrap.menu.Menu
+
+left:
+    Roo.bootstrap.Progress
+right:
+    Roo.bootstrap.ProgressBar
+
+left:
+    Roo.bootstrap.Table
+right:
+    Roo.bootstrap.TableRow
+    Roo.bootstrap.TableCell
+    Roo.bootstrap.TableBody
+
+left:   
+    Roo.bootstrap.Table:cm[]          
+right:
+    Roo.grid.ColumnModel
+
+
+#-??? it this correct?
+left:
+    Roo.bootstrap.Table:sm
+right:  
+    Roo.bootstrap.Table.RowSelectionModel    
+
+
+left:
+    Roo.bootstrap.Table:footer
+right:  
+    Roo.bootstrap.PagingToolbar
+
+left:
+    Roo.bootstrap.PagingToolbar:buttons[]
+right:  
+    Roo.bootstrap.Button
+
+left:
+    Roo.bootstrap.TableBody
+right:
+    Roo.bootstrap.TableRow
+    Roo.bootstrap.TableCell
+
+left:
+    Roo.bootstrap.TableRow
+right:
+    Roo.bootstrap.TableCell
+
+left:
+    Roo.bootstrap.TableCell
+right:
+    Roo.bootstrap.Button
+
+left:
+    Roo.bootstrap.ButtonGroup
+right:
+    Roo.bootstrap.Button
+    Roo.bootstrap.Form
+
+left:
+    Roo.bootstrap.Button:menu
+    Roo.bootstrap.NavItem:menu
+    Roo.bootstrap.NavSidebarItem:menu
+right:
+    Roo.bootstrap.Menu
+
+left:
+    Roo.bootstrap.Menu
+right:
+    Roo.bootstrap.MenuItem
+    
+left:
+    Roo.bootstrap.Navbar
+    Roo.bootstrap.NavSimplebar
+    Roo.bootstrap.NavHeaderbar
+    Roo.bootstrap.NavSidebar
+right:    
+    Roo.bootstrap.NavGroup
+    Roo.bootstrap.Form
+    Roo.bootstrap.Row
+    Roo.bootstrap.Column
+    Roo.bootstrap.Container
+    Roo.bootstrap.Link
+
+left:
+    Roo.bootstrap.NavGroup
+right:
+    Roo.bootstrap.NavItem
+    Roo.bootstrap.NavSidebarItem
+    
+    
+left:
+    Roo.bootstrap.Form
+    Roo.bootstrap.Container
+right:
+    Roo.bootstrap.Input
+    Roo.bootstrap.TextArea
+    Roo.bootstrap.Button
+    Roo.bootstrap.ComboBox
+    Roo.bootstrap.Container
+    Roo.bootstrap.Row
+    Roo.bootstrap.TabPanel
+//    Roo.bootstrap.Fieldset
+        
+left:
+    Roo.bootstrap.Body
+right:
+    Roo.bootstrap.Modal
+
+left:    
+    Roo.bootstrap.Modal:buttons[]
+right:
+    Roo.bootstrap.Button
+
+left:    
+    Roo.bootstrap.Header
+right:
+    Roo.bootstrap.Container
+
+left:    
+    Roo.bootstrap.NavItem
+    Roo.bootstrap.NavSidebarItem
+right:
+    Roo.bootstrap.Container
+
+left:    
+    Roo.bootstrap.Pagination
+right:
+    Roo.bootstrap.PaginationItem
+
+left:
+    Roo.bootstrap.Input:before
+    Roo.bootstrap.Input:after
+right:
+    Roo.bootstrap.Button
+
+left:
+    Roo.mailer.Body
+right:
+    Roo.mailer.BodyContainer
+
+left:
+    Roo.mailer.BodyContainer    
+right:
+    Roo.mailer.Block
+    
+left:
+    Roo.mailer.Block
+right:
+    Roo.mailer.Column
+    
+left:
+    Roo.mailer.Column
+    Roo.mailer.Block
+right:
+    Roo.bootstrap.Header
+    Roo.bootstrap.Container
+    Roo.bootstrap.Image
+    Roo.bootstrap.Link
+left:
+    Roo.bootstrap.dash.TabBox
+right:
+    Roo.bootstrap.dash.TabPane
+
+left:
+    Roo.bootstrap.dash.TabPane
+right:
+    Roo.bootstrap.Graph
+    Roo.bootstrap.Column
+
+
+left:
+    Roo.bootstrap.menu.Menu
+right:
+    Roo.bootstrap.menu.Item
+    Roo.bootstrap.menu.Separator
+
+left:
+    Roo.bootstrap.menu.Item
+right:
+    Roo.bootstrap.menu.Menu
\ No newline at end of file
diff --git a/old-javascript/Palete/ValaSource.vala b/old-javascript/Palete/ValaSource.vala
new file mode 100644 (file)
index 0000000..89d14a0
--- /dev/null
@@ -0,0 +1,199 @@
+
+// valac TreeBuilder.vala --pkg libvala-0.24 --pkg posix -o /tmp/treebuilder
+
+namespace Palete {
+       
+       public class ValaSourceReport  : Vala.Report {
+
+
+               
+
+               public Gee.HashMap<int,string> line_errors;
+
+               public ValaSourceReport()
+               {
+                       base();
+                       this.line_errors = new Gee.HashMap<int,string> ();
+               }
+               
+               public override void err (Vala.SourceReference? source, string message) {
+                       errors++;
+                       if (source == null) {
+                               return;
+                               //stderr.printf ("My error: %s\n", message);
+                       }
+                       if (source.file.filename != "~~~~~testfile.vala") {
+                               return;
+                       }
+                       var pre = "";
+                       if (line_errors.has_key(source.begin.line)) {
+                               pre = line_errors.get(source.begin.line) + "\n";
+                               
+                       }
+                       line_errors.set(source.begin.line, pre +  message);
+               }
+               public void dump()
+               {
+                       var iter = this.line_errors.map_iterator();
+                       while (iter.next()) {
+                               print ("%d : %s\n\n", iter.get_key(), iter.get_value());
+                       }
+               }
+
+       }
+
+       public class ValaSource : Vala.CodeVisitor {
+
+               Vala.CodeContext context;
+               ValaSourceReport report;
+               JsRender.JsRender file; 
+               public ValaSource(JsRender.JsRender file) {
+                       base();
+                       this.file = file;
+                       
+
+               }
+               public void dumpCode(string str) {
+                       var ls = str.split("\n");
+                       for (var i=0;i < ls.length; i++) {
+                               print("%d : %s\n", i+1, ls[i]);
+                       }
+               }
+               
+               public Gee.HashMap<int,string> checkFile()
+               {
+                       return this.checkString(JsRender.NodeToVala.mungeFile(this.file));
+               }
+
+               public Gee.HashMap<int,string> checkFileWithNodePropChange(
+                          JsRender.Node node, 
+                           string prop,
+                           string ptype,
+                           string val)
+               {
+
+                       var hash = ptype == "listener" ? node.listeners : node.props;
+                       var old = hash.get(prop);
+                       var newval = "/*--VALACHECK-START--*/ " + val ;
+                       
+                       hash.set(prop, newval);
+                       var tmpstring = JsRender.NodeToVala.mungeFile(this.file);
+                       var bits = tmpstring.split("/*--VALACHECK-START--*/");
+                       var offset =0;
+                       if (bits.length > 0) {
+                               offset = bits[0].split("\n").length +1;
+                       }
+                       //this.dumpCode(tmpstring);
+                       //print("offset %d\n", offset);
+                       this.checkString(tmpstring);
+                       hash.set(prop, old);
+                       // modify report
+                       Gee.HashMap<int,string> ret = new Gee.HashMap<int,string> ();
+                       var iter = this.report.line_errors.map_iterator();
+                       while (iter.next()) {
+                               // print("%d : %s\n",iter.get_key() - offset, iter.get_value());
+                               // we have to prefix the error with the fake line number 
+                               // so that it's a unique mark..
+                                ret.set(iter.get_key() - offset, 
+                                      "%d : %s".printf(iter.get_key() - offset,iter.get_value()));
+                       }
+                       return ret;
+                       
+               }
+               
+       public Gee.HashMap<int,string> checkString(string contents)
+       {
+                       // init context:
+
+                       context = new Vala.CodeContext ();
+                       Vala.CodeContext.push (context);
+               
+                       context.experimental = false;
+                       context.experimental_non_null = false;
+
+
+                       // or context.get_vapi_path("glib-2.0"); // should return path..
+                       context.vapi_directories = { "/usr/share/vala-0.24/vapi" };
+                       context.report.enable_warnings = true;
+                       context.metadata_directories = { };
+                       context.gir_directories = {};
+                       this.report = new ValaSourceReport();;
+                       context.report = this.report;
+               
+                       context.basedir = Posix.realpath (".");
+               
+                       context.directory = context.basedir;
+               
+
+                       // add default packages:
+                       //if (settings.profile == "gobject-2.0" || settings.profile == "gobject" || settings.profile == null) {
+                               context.profile = Vala.Profile.GOBJECT;
+                       //      context.add_define ("GOBJECT");
+                       //}
+                       //add_depencies (context, settings.packages);
+                       //if (reporter.errors > 0) {
+                       //      return context;
+                       //}
+
+                       var source_file = new Vala.SourceFile (
+                               context, 
+                               Vala.SourceFileType.SOURCE, 
+                                "~~~~~testfile.vala",
+                              contents
+                       );
+                        //Vala.Config.PACKAGE_SUFFIX.substring (1)
+                       
+                       context.add_external_package ("glib-2.0");
+                       context.add_external_package ("gobject-2.0");
+                       context.add_external_package ("libvala-0.24");
+                       var ns_ref = new Vala.UsingDirective (new Vala.UnresolvedSymbol (null, "GLib", null));
+                       source_file.add_using_directive (ns_ref);
+                       context.root.add_using_directive (ns_ref);
+                       context.add_source_file (source_file);
+
+               
+                       //add_documented_files (context, settings.source_files);
+               
+                       Vala.Parser parser = new Vala.Parser ();
+                       parser.parse (context);
+                       //gir_parser.parse (context);
+                       if (context.report.get_errors () > 0) {
+                               print("parse got errors");
+                               ((ValaSourceReport)context.report).dump();
+                               Vala.CodeContext.pop ();
+                               return this.report.line_errors;
+                       }
+
+
+                       /*
+                       // check context:
+                       context.check ();
+                       if (context.report.get_errors () > 0) {
+                               print("check got errors");
+                               ((ValaSourceReport)context.report).dump();
+                               Vala.CodeContext.pop ();
+                               return this.report.line_errors;
+                               
+                       }
+                       */
+                       Vala.CodeContext.pop ();
+                       
+                       print("ALL OK?\n");
+                       return this.report.line_errors;
+               }
+       //
+               // startpoint:
+               //
+        
+       }
+}
+/*
+int main (string[] args) {
+
+       var a = new ValaSource(file);
+       a.create_valac_tree();
+       return 0;
+}
+*/
+
+
diff --git a/old-javascript/Palete/rooprops.json b/old-javascript/Palete/rooprops.json
new file mode 120000 (symlink)
index 0000000..14df81e
--- /dev/null
@@ -0,0 +1 @@
+../roojs1/docs/json/roodata.json
\ No newline at end of file
diff --git a/old-javascript/Project/Base.js b/old-javascript/Project/Base.js
new file mode 100644 (file)
index 0000000..bafc81b
--- /dev/null
@@ -0,0 +1,359 @@
+//<Script type="text/javascript">
+
+/**
+ * Project Object
+ * 
+ * Projects can only contain one directory... - it can import other projects..(later)
+ * 
+ * we need to sort out that - paths is currently a key/value array..
+ * 
+ * 
+ * 
+ */
+
+Gio = imports.gi.Gio;
+GLib = imports.gi.GLib; 
+
+
+console = imports.console;
+XObject = imports.XObject.XObject;
+File = imports.File.File;
+
+ProjectManager = imports.ProjectManager.ProjectManager;
+Observable = imports.Observable.Observable;
+
+Base = XObject.define( 
+    function(cfg) {
+        
+        
+        this.addEvents({ 'changed'  : true });
+        var _this = this;
+        this.on('changed' , function() {
+            Seed.print("Project.Base: Calling PM - changed");
+            
+            ProjectManager.fireEvent('changed');
+        });
+        XObject.extend(this, cfg);
+        this.files = { }; 
+        /*
+        if (this.files ){
+            for (var f in this.files) {
+                var xt = this.xtype;
+                var cls = imports.Builder.Provider.File[xt][xt];
+                this.files[f] = cls(this.files[f]);
+            }
+        }
+        */
+        
+        
+        this.scanDirs();
+        
+    },
+    Observable, 
+    {
+        id : false,
+        fn:  false, // the md5 sum for this one..
+        paths : false,
+        files : false,
+        tree : false,
+        xtype : false,
+        
+        load : function (o)  // is this used??
+        {
+            if (!this.fetchTree) {
+                console.log("Project.getTree tree called on base object?!?!");
+                return false;
+            }
+            
+            if (this.files) {
+                return o.success.apply(o.scope || this, [this]);
+            }
+            return this.fetchTree(o);
+            
+        },
+        getPalete : function()
+        {
+            print("Project.Base: GET PROVIDER FOR " + this.xtype);
+            return  ProjectManager.getPalete(this.xtype);
+        },
+        toJSON : function()
+        {
+            var ret = { };
+            var _this = this;
+            for (var k in _this) {
+                
+                if (['files', 'tree'].indexOf(k) > -1) {
+                    continue;
+                }
+                if (k != 'paths') {
+                    if ((typeof(_this[k]) == 'object') ||(typeof(_this[k]) == 'function')) {
+                        continue;
+                    }
+                }
+                print("Project.Base: Storing " + k);
+                ret[k] = _this[k];
+                
+            }
+            
+            
+            // deal with files..
+            //for (var f in this.files) {
+            //    print(f);
+            //    ret.files[f] = this.files[f].toJsonArray();
+           // }
+            
+            
+            return JSON.stringify(ret);
+          
+          
+        },
+        getName :function()
+        {
+            //returns the basename of the first path..
+            for (var i in this.paths) {
+                return GLib.basename(i);
+            }
+            return false;
+        },
+        
+        toTree : function()
+        {
+            
+            
+            // normally this will build tree's based on info in the file stuff..
+            // but for the time being, we just return an array of all the files.
+            
+            
+            
+            //if (this.tree) {
+             //   return this.tree;
+            //}
+            
+            this.tree = [];
+            /*
+            for (var f in this.files) {
+                this.tree.push(this.files[f]);
+            }
+            return this.tree;
+            */
+            print(JSON.stringify(this.files,null,4));
+            
+            // have parents -> add them to parent...
+            var files = {};
+            var parents = {};
+            for (var k in this.files) {
+                
+                var f = this.files[k];
+                if (!f) {
+                    continue;
+                   }
+                ///console.dump(f);
+                f.hasParent = false;
+                f.cn = [];
+                //console.log(f.name);
+                if (f.fullname) {
+                    files[f.fullname] = f;
+                }
+            };
+            
+            // add Parent pointer..
+            for (var k in this.files) {
+                var f = this.files[k];
+                console.log(f.parent + ":" + f.name);
+                if (f.parent && typeof(files[f.parent]) != 'undefined') {
+                    // add it to parent;
+                    
+                    files[f.parent].cn.push(f);
+                    f.hasParent = true;
+                    
+                }
+                
+                
+            };
+            
+              
+            
+            var ret = [];
+            for (var k in this.files) {
+                var f = this.files[k];
+                
+                f.sortCn();
+                if (f.hasParent) {
+                    continue;
+                }
+                if (typeof(files[f.fullname]) != 'undefined') {
+                    ret.push(f);
+                }
+                
+            };
+            
+            
+            ret.sort(function(a,b) {
+                return a.path > b.path ? 1 : -1;
+            });
+            
+            print(JSON.stringify(ret,null,4));
+            
+            
+            this.tree = ret;
+            return this.tree;
+             
+            
+        },
+        getById : function(id)
+        {
+            var ret = false;
+            for (var k in this.files) {
+                var f = this.files[k];
+                
+                console.log(f.id + '?=' + id);
+                if (f.id == id) {
+                    return f;
+                }
+            };
+            return ret;
+        },
+        
+        loadFileOnly : function(path)
+        {
+            
+            var xt = this.xtype;
+            var cls = imports.JsRender[xt][xt];
+            return  new cls({
+                path : path,
+                parent : '',
+                project : this
+            });
+        },
+        create : function(filename)
+        {
+            var ret = this.loadFileOnly(filename);
+            ret.save();
+            this.addFile(ret);
+            return ret;
+            
+        },
+        
+         
+        addFile: function(pfile) { // add a single file, and trigger changed.
+            this.files[pfile.path] = pfile
+            this.fireEvent('changed', this);
+        },
+        
+        add: function(path, type)
+        {
+            this.paths = this.paths || { };
+            this.paths[path] = type;
+            //Seed.print(" type is '" + type + "'");
+            if (type == 'dir') {
+                this.scanDir(path);
+            //    console.dump(this.files);
+            }
+            if (type == 'file' ) {
+                
+                this.files[path] = this.loadFileOnly( path );
+            }
+            
+            // console.dump(this.files);
+            this.fireEvent('changed', this);
+            
+        },
+        
+        scanDirs: function()
+        {
+            this.files = this.files  || { };
+            for (var d in this.paths) {
+                if (this.paths[d] == 'dir') {
+                    this.scanDir(d);
+                }
+                // otherwise add a file..
+            }
+            //console.dump(this.files);
+            
+        },
+        
+        
+        // list files.
+        scanDir : function(dir, dp) 
+        {
+            dp = dp || 0;
+            Seed.print("Project.Base: Running scandir on " + dir);
+            if (dp > 5) { // no more than 5 deep?
+                return;
+            }
+            // this should be done async -- but since we are getting the proto up ...
+            var dirs = File.list(dir);
+            
+            ///print(dirs); Seed.exit();
+            
+            var subs = [];
+            var _this = this;
+            dirs.forEach(function( fn ){ 
+                 
+                //console.log('trying ' + dir + '/' + fn);
+                if (!fn) {
+                    subs.forEach( function(s) {
+                        _this.scanDir(s, dp+1);
+                    });
+                    return;
+                }
+                if (fn[0] == '.') { // skip hidden
+                    return;
+                }
+                
+                if (GLib.file_test(dir  + '/' + fn, GLib.FileTest.IS_DIR)) {
+                    subs.push(dir  + '/' + fn);
+                    return;
+                }
+                
+                if (!fn.match(/\.bjs$/)) {
+                    return;
+                }
+                var parent = '';
+                //if (dp > 0 ) {
+                var sp = dir.split('/');
+                sp = sp.splice(sp.length - (dp +1), (dp +1));
+                parent = sp.join('.');
+                
+                
+                if (typeof(_this.files[dir  + '/' + fn]) != 'undefined') {
+                    // we already have it..
+                    _this.files[dir  + '/' + fn].parent = parent;
+                    return;
+                }
+                var xt = _this.xtype;
+                var cls = imports.JsRender[xt][xt];
+                
+                //Seed.print("Adding file " + dir  + '/' + fn);
+                _this.files[dir  + '/' + fn] = new cls({
+                    path : dir  + '/' + fn,
+                    parent : parent,
+                    project : _this
+                });
+                //console.log(this.files[dir  + '/' + fn] );
+                /*
+                var f = Gio.file_new_for_path(dir + '/' + fn);
+                var inf = f.query_info('standard::*');
+                var tv = new GLib.TimeVal();
+                inf.get_modification_time(tv);
+                
+                // should it do something about this information..
+                // fixme... time data is busted..
+                this.files[dir  + '/' + fn] = '' + tv.tv_sec + '.' + tv.tv_usec;
+                */
+            });
+             
+            
+        }
+        
+        
+        
+        
+        
+
+    }
+); 
+
+
+     
\ No newline at end of file
diff --git a/old-javascript/Project/Gtk.js b/old-javascript/Project/Gtk.js
new file mode 100755 (executable)
index 0000000..338626d
--- /dev/null
@@ -0,0 +1,30 @@
+//<Script type="text/javascript">
+
+console = imports.console;
+XObject = imports.XObject.XObject;
+
+Base = imports.Project.Base.Base;
+
+
+id = 1;
+
+Gtk = XObject.define(
+    function(cfg) {
+        
+        
+        Gtk.superclass.constructor.call(this, cfg);
+
+       
+        // various loader methods..
+        this.id = 'project-gtk-' + (id++);
+    }, 
+    Base,
+    {
+         
+        file : false
+    
+    }
+);
\ No newline at end of file
diff --git a/old-javascript/Project/Gtk.vala b/old-javascript/Project/Gtk.vala
new file mode 100644 (file)
index 0000000..4a00239
--- /dev/null
@@ -0,0 +1,318 @@
+//<Script type="text/javascript">
+/**
+ * Gtk projects - normally vala based now..
+ * 
+ * should have a few extra features..
+ * 
+ * like:
+ *   compile flags etc..
+ *   different versions (eg. different files can compile different versions - eg. for testing.
+ *   
+ * If we model this like adjuta - then we would need a 'project' file that is actually in 
+ * the directory somewhere... - and is revision controlled etc..
+ * 
+ * builder.config ??
+ * 
+ * 
+ * 
+ * 
+ */
+
+namespace Project {
+       static int gtk_id = 1;
+
+       public class Gtk : Project
+       {
+         
+               public Gtk(string path) {
+                 
+                 
+                       base(path);
+                       this.xtype = "Gtk";
+                       var gid = "project-gtk-%d".printf(gtk_id++);
+                       this.id = gid;
+                       this.loadConfig();
+               
+               }
+               public Gee.HashMap<string,GtkValaSettings> compilegroups;
+               
+               public void loadConfig() throws GLib.Error 
+               {
+                       // load a builder.config JSON file.
+                       // 
+                       this.compilegroups = new  Gee.HashMap<string,GtkValaSettings>();
+                       
+                       
+                       var fn = this.firstPath() + "/config1.builder";
+                       print("load: " + fn );
+                       
+                       if (!FileUtils.test(fn, FileTest.EXISTS)) {
+                               this.compilegroups.set("_default_", new GtkValaSettings("_default_") );
+                               return;
+                       }
+
+                       var pa = new Json.Parser();
+                       pa.load_from_file(fn);
+                       var node = pa.get_root();
+
+                       // should be an array really.
+                       if (node.get_node_type () != Json.NodeType.ARRAY) {
+                               throw new Error.INVALID_FORMAT ("Unexpected element type %s", node.type_name ());
+                       }
+                       
+                       var obj = node.get_array ();
+                       for(var i= 0;i<obj.get_length();i++) {
+                               var el = obj.get_object_element(i);
+                               var vs = new GtkValaSettings.from_json(el);
+                               if (vs.name != "_default_") {
+                                       vs.parent = this.compilegroups.get("_default_");
+                               }
+                               this.compilegroups.set(vs.name,vs);
+                       }
+                       print("%s\n",this.configToString ());
+                       
+               }
+               public string configToString()
+               {
+                       var ar = new Json.Array();
+                       var iter = this.compilegroups.map_iterator();
+                       while(iter.next()) {
+                                
+                               ar.add_object_element(iter.get_value().toJson());
+                       }
+
+                       var generator = new Json.Generator ();
+                       generator.indent = 4;
+                       generator.pretty = true;
+                       var node = new Json.Node(Json.NodeType.ARRAY);
+                       node.set_array(ar);
+                       generator.set_root(node);
+                       return generator.to_data(null);
+               }
+               
+               public void writeConfig()
+               {
+                       var fn = this.firstPath() + "/config1.builder";
+                       print("write: " + fn );
+
+                       
+
+                        
+
+                       var f = GLib.File.new_for_path(fn);
+                       var data_out = new GLib.DataOutputStream(
+                                          f.replace(null, false, GLib.FileCreateFlags.NONE, null)
+                       );
+                       data_out.put_string(this.configToString(), null);
+                       data_out.close(null);
+                       
+                       return ;
+                       
+                       
+
+               }
+               public string relPath(string target)
+               {
+                       var basename = this.firstPath();
+                       // eg. base = /home/xxx/fred/blogs
+                       // target = /home/xxx/fred/jones
+                       var bb = basename;
+                       var prefix = "";
+                       while (true) {
+                               if (    bb.length < target.length &&
+                                       target.substring(0, bb.length) == bb) {
+                                       return prefix + target.substring(bb.length +1);
+                               }
+                               if (bb.length < 1) {
+                                       throw new Error.INVALID_FORMAT ("Could not work out relative path %s to %s",
+                                                                       basename, target);
+                               }
+                               bb = GLib.Path.get_dirname(bb);
+                               prefix += "../";
+                               
+                       }
+       
+       
+               }
+               public Gee.ArrayList<string> files(string in_path)
+               {
+                       var ret = new Gee.ArrayList<string>(); 
+                       var dirname = this.resolve_path(
+                               this.resolve_path_combine_path(this.firstPath(),in_path));
+                               // scan the directory for files -- ending with vala || c
+                       
+
+                       var dir = File.new_for_path(dirname);
+                       if (!dir.query_exists()) {
+                               return ret;
+                       }
+         
+          
+                       try {
+                               var file_enum = dir.enumerate_children(
+                                       GLib.FileAttribute.STANDARD_DISPLAY_NAME, 
+                                       GLib.FileQueryInfoFlags.NONE, 
+                                       null
+                               );
+               
+                
+                               FileInfo next_file; 
+                               while ((next_file = file_enum.next_file(null)) != null) {
+                                       var fn = next_file.get_display_name();
+                                       if (Regex.match_simple("\\.vala$", fn)) {
+                                               ret.add(dirname + "/" + fn);
+                                               continue;
+                                       }
+                                       if (Regex.match_simple("\\.c$", fn)) {
+                                               ret.add(dirname + "/" + fn);
+                                               continue;
+                                       }
+                                       // any other valid types???
+                               
+                               }       
+                       } catch(Error e) {
+                               print("oops - something went wrong scanning the projects\n");
+                       }
+
+                        
+                       return ret;
+                       
+
+               }
+
+               public   string  resolve_path_combine_path(string first, string second)
+               {
+                       string ret = first;
+                       if (first.length > 0 && second.length > 0 && !first.has_suffix("/") && !second.has_prefix("/"))
+                       {
+                               ret += "/";
+                       }
+                       return ret + second;
+               }
+               public   string  resolve_path_times(string part, int times, string? clue = null)
+               {
+                       string ret = "";
+                       for (int i = 0; i < times; i++)
+                       {
+                               if (clue != null && i > 0)
+                               {
+                                       ret += clue;
+                               }
+                               ret += part;
+                       }
+                       return ret;
+               }
+               public   string resolve_path(string _path, string? relative = null)
+               {
+                       string path = _path;
+                       if (relative != null)
+                       {
+                               path = this.resolve_path_combine_path(path, relative);
+                       }
+                       string[] parts = path.split("/");
+                       string[] ret = {};
+                       int relative_parts = 0;
+                                       
+                       foreach (var part in parts)
+                       {
+                               if (part.length < 1 || part == ".")
+                               {
+                                       continue;
+                               }
+                               
+                               if (part == "..")
+                               {
+                                       if (ret.length > 0)
+                                       {
+                                               ret = ret[0: ret.length -1];
+                                       }
+                                       else
+                                       {
+                                               relative_parts++;
+                                       }
+                                       continue;
+                               }
+                               
+                               ret += part;
+                       }
+                       
+                       path =  this.resolve_path_combine_path(this.resolve_path_times("..", relative_parts, "/"), string.joinv("/", ret));
+                       if (_path.has_prefix("/"))
+                       {
+                               path = "/" + path;
+                       }
+                       return path;
+               }
+               
+               
+                       
+
+       }
+       // an object describing a build config (or generic ...)
+       public class GtkValaSettings : Object {
+               public string name;
+               public GtkValaSettings? parent;
+               
+               public string compile_flags; // generic to all.
+               public Gee.ArrayList<string> packages; // list of packages?? some might be genericly named?
+               public Gee.ArrayList<string> sources; // list of files+dirs (relative to project)
+               public string target_bin;
+
+
+               public GtkValaSettings(string name) 
+               {
+                       this.name = name;
+                       this.compile_flags = "";
+                       this.target_bin = "";
+                       this.packages = new Gee.ArrayList<string>();
+                       this.sources = new Gee.ArrayList<string>();
+                               
+               }
+               
+               
+               public GtkValaSettings.from_json(Json.Object el) {
+
+                       
+                       this.name = el.get_string_member("name");
+                       this.compile_flags = el.get_string_member("compile_flags");
+                       this.target_bin = el.get_string_member("target_bin");
+                       // sources and packages.
+                       this.sources = this.readArray(el.get_array_member("sources"));
+                       this.packages = this.readArray(el.get_array_member("packages"));
+                       
+               }
+               public Gee.ArrayList<string> readArray(Json.Array ar) 
+               {
+                       var ret = new Gee.ArrayList<string>();
+                       for(var i =0; i< ar.get_length(); i++) {
+                               ret.add(ar.get_string_element(i));
+                       }
+                       return ret;
+               }
+               
+               public Json.Object toJson()
+               {
+                       var ret = new Json.Object();
+                       ret.set_string_member("name", this.name);
+                       ret.set_string_member("compile_flags", this.compile_flags);
+                       ret.set_string_member("target_bin", this.target_bin);
+                       ret.set_array_member("sources", this.writeArray(this.sources));
+                       ret.set_array_member("packages", this.writeArray(this.packages));
+                       return ret;
+               }
+               public Json.Array writeArray(Gee.ArrayList<string> ar) {
+                       var ret = new Json.Array();
+                       for(var i =0; i< ar.size; i++) {
+                               ret.add_string_element(ar.get(i));
+                       }
+                       return ret;
+               }
+               
+               
+       }
+   
+}
diff --git a/old-javascript/Project/Project.vala b/old-javascript/Project/Project.vala
new file mode 100644 (file)
index 0000000..3972c81
--- /dev/null
@@ -0,0 +1,538 @@
+//<Script type="text/javascript">
+
+/**
+ * Project Object
+ * 
+ * Projects can only contain one directory... - it can import other projects..(later)
+ * 
+ * we need to sort out that - paths is currently a key/value array..
+ * 
+ * 
+ * 
+ */
+namespace Project {
+        public errordomain Error {
+               INVALID_TYPE,
+               NEED_IMPLEMENTING,
+               MISSING_FILE,
+               INVALID_VALUE,
+               INVALID_FORMAT
+       }
+
+       // static array of all projects.
+       public Gee.HashMap<string,Project>  projects;
+
+       
+       public bool  projects_loaded = false;
+
+       
+       public class Project : Object {
+               
+               public signal void on_changed (); 
+       
+               public string id;
+               public string fn = ""; // just a md5...
+               public string name = "";
+               public string runhtml = "";
+               public string base_template = "";
+               public string rootURL = "";
+               public Gee.HashMap<string,string> paths;
+               public Gee.HashMap<string,JsRender.JsRender> files ;
+               //tree : false,
+               public  string xtype;
+                
+               bool is_scanned; 
+          
+               
+               public Project (string path) {
+                   
+                       this.name = GLib.Path.get_basename(path); // default..
+
+                       this.is_scanned = false;
+                       this.paths = new Gee.HashMap<string,string>();
+                       this.files = new Gee.HashMap<string,JsRender.JsRender>();
+                       //XObject.extend(this, cfg);
+                       //this.files = { }; 
+                       if (path.length > 0) {
+                               this.paths.set(path, "dir");
+                       }
+                       
+                   
+                   
+               }
+
+        
+        
+        
+               
+               public static void loadAll(bool force = false)
+               {
+                       if (projects_loaded && !force) {
+                               return;
+                       }
+
+                       var dirname = GLib.Environment.get_home_dir() + "/.Builder";
+                       var dir = File.new_for_path(dirname);
+                       if (!dir.query_exists()) {
+                               dir.make_directory();
+                               return;
+                       }
+                       projects = new  Gee.HashMap<string,Project>();
+                         
+                  
+                       try {
+                               var file_enum = dir.enumerate_children(
+                                       GLib.FileAttribute.STANDARD_DISPLAY_NAME, 
+                                       GLib.FileQueryInfoFlags.NONE, 
+                                       null
+                               );
+                       
+                        
+                               FileInfo next_file; 
+                               while ((next_file = file_enum.next_file(null)) != null) {
+                                       var fn = next_file.get_display_name();
+                                       if (!Regex.match_simple("\\.json$", fn)) {
+                                               continue;
+                                       }
+                                       factoryFromFile(dirname + "/" + fn);
+                               }       
+                       } catch(Error e) {
+                               print("oops - something went wrong scanning the projects\n");
+                       }
+                   
+
+               }
+
+               public static Gee.ArrayList<Project> allProjectsByName()
+               {
+                   var ret = new Gee.ArrayList<Project>();
+                   var iter = projects.map_iterator();
+                           while (iter.next()) {
+                               ret.add(iter.get_value());
+                           }
+                   // fixme -- sort...
+                   return ret;
+               
+               }
+                
+               // load project data from project file.
+               public static void   factoryFromFile(string jsonfile)
+               {
+                        
+                       print("parse %s\n", jsonfile);
+
+                       var pa = new Json.Parser();
+                       pa.load_from_file(jsonfile);
+                       var node = pa.get_root();
+
+                       
+                       if (node == null || node.get_node_type () != Json.NodeType.OBJECT) {
+                               print("SKIP " + jsonfile + " - invalid format?\n");
+                               return;
+                       }
+                       
+                       var obj = node.get_object ();
+                       var xtype =  obj.get_string_member("xtype");
+
+
+                       var paths = obj.get_object_member("paths");
+                       var i = 0;
+                       var fpath = "";
+                       paths.foreach_member((sobj, key, val) => {
+                               if (i ==0 ) {
+                                       fpath = key;
+                               }
+                                       
+                       });
+
+                       
+                       var proj = factory(xtype, fpath);
+
+                       proj.fn =  Path.get_basename(jsonfile).split(".")[0];
+
+                       // might not exist?
+
+                       if (obj.has_member("runhtml")) {
+                               proj.runhtml  = obj.get_string_member("runhtml"); 
+                       }
+                       // might not exist?
+                       if (obj.has_member("base_template")) {
+                               proj.base_template  = obj.get_string_member("base_template"); 
+                       }
+                       // might not exist?
+                       if (obj.has_member("rootURL")) {
+                               proj.rootURL  = obj.get_string_member("rootURL"); 
+                       }
+                       
+                       proj.name = obj.get_string_member("name");
+
+                        
+                       paths.foreach_member((sobj, key, val) => {
+                               proj.paths.set(key, "dir");
+                       });
+                       projects.set(proj.id,proj);
+               }
+               
+               
+               public static Project factory(string xtype, string path)
+               {
+
+                       // check to see if it's already loaded..
+
+                        
+                       var iter = projects.map_iterator();
+                       while (iter.next()) {
+                               if (iter.get_value().hasPath( path)) {
+                                       return iter.get_value();
+                                }
+                       }
+
+
+                       switch(xtype) {
+                               case "Gtk":
+                                       return new Gtk(path);
+                               case "Roo":
+                                       return new Roo(path);
+                       }
+                       throw new Error.INVALID_TYPE("invalid project type");
+                               
+               }
+                public static void  remove(Project project)
+               {
+                       // delete the file..
+                       var dirname = GLib.Environment.get_home_dir() + "/.Builder";
+                        
+                       FileUtils.unlink(dirname + "/" + project.fn + ".json");
+                       projects.unset(project.id,null);
+                       
+
+               }
+                
+
+               public void save()
+               {
+                               // fixme..
+            
+                       if (this.fn.length < 1) {
+                               // make the filename..
+                               //var t = new DateTime.now_local ();
+                               //TimeVal tv;
+                               //t.to_timeval(out tv);
+                               //var str = "%l:%l".printf(tv.tv_sec,tv.tv_usec);
+                               var str = this.firstPath();
+                               
+                               this.fn = GLib.Checksum.compute_for_string(GLib.ChecksumType.MD5, str, str.length);
+                       }
+
+                       var dirname = GLib.Environment.get_home_dir() + "/.Builder";
+                       var  s =  this.toJSON(false);
+                       FileUtils.set_contents(dirname + "/" + this.fn + ".json", s, s.length);  
+                       
+                       
+               }
+
+               
+               
+               public string toJSON(bool show_all)
+               {
+                   
+                       var builder = new Json.Builder ();
+
+                       builder.begin_object ();
+
+                       builder.set_member_name ("name");
+                       builder.add_string_value (this.name);
+
+
+                       builder.set_member_name ("fn");
+                       builder.add_string_value (this.fn);
+
+                       builder.set_member_name ("xtype");
+                       builder.add_string_value (this.xtype);
+
+                       builder.set_member_name ("runhtml");
+                       builder.add_string_value (this.runhtml);
+
+
+                       builder.set_member_name ("rootURL");
+                       builder.add_string_value (this.rootURL);
+                       
+                       builder.set_member_name ("base_template");
+                       builder.add_string_value (this.base_template);                  
+                       // file ??? try/false?
+                       builder.set_member_name ("paths");
+
+
+                       builder.begin_object ();
+
+
+                       var iter = this.paths.map_iterator();
+                       while (iter.next()) {
+                               builder.set_member_name (iter.get_key());
+                               builder.add_string_value("path");
+                       }
+                       builder.end_object ();
+                       
+                       if (show_all) {
+                               builder.set_member_name ("files");
+                               builder.begin_array ();
+                               var fiter = this.files.map_iterator();
+                               while (fiter.next()) {
+                                   builder.add_string_value (fiter.get_key());
+                               }
+                               
+                               
+                               builder.end_array ();
+                       }
+
+               
+                       builder.end_object ();
+
+                       var  generator = new Json.Generator ();
+                       var  root = builder.get_root ();
+                       generator.set_root (root);
+                       if (show_all) {
+                               generator.pretty = true;
+                               generator.indent = 4;
+                       }
+
+                       return  generator.to_data (null);
+                         
+                     
+               }
+               public string firstPath()
+               {
+                   var iter = this.paths.map_iterator();
+                   while (iter.next()) {
+                       return iter.get_key();
+                   }
+                 
+                   return "";
+               }
+
+               public bool hasPath(string path)
+               {
+                   var iter = this.paths.map_iterator();
+                   while (iter.next()) {
+                       if (iter.get_key() == path) {
+                               return true;
+                       }
+                   }
+                 
+                   return false;
+               }
+
+               
+               // returns the first path
+               public string getName()
+               {
+                   var iter = this.paths.map_iterator();
+                   while (iter.next()) {
+                       return GLib.Path.get_basename(iter.get_key());
+                   }
+                 
+                   return "";
+               }
+
+               public Gee.ArrayList<JsRender.JsRender> sortedFiles()
+               {
+                       var files = new Gee.ArrayList<JsRender.JsRender>();
+
+                       var fiter = this.files.map_iterator();
+                       while(fiter.next()) {
+                               files.add(fiter.get_value());
+                       }
+                       files.sort((fa,fb) => {
+                               return ((JsRender.JsRender)fa).name.collate(((JsRender.JsRender)fb).name);
+
+                       });
+                       return files;
+
+               }
+               
+        
+               public JsRender.JsRender? getByName(string name)
+               {
+                   
+                       var fiter = files.map_iterator();
+                   while(fiter.next()) {
+                    
+                       var f = fiter.get_value();
+                       
+                       
+                       print ("Project.getByName: %s ?= %s\n" ,f.name , name);
+                       if (f.name == name) {
+                           return f;
+                       }
+                   };
+                   return null;
+               }
+               
+               public JsRender.JsRender? getById(string id)
+               {
+                   
+                       var fiter = files.map_iterator();
+                       while(fiter.next()) {
+                    
+                               var f = fiter.get_value();
+                               
+                               
+                               //console.log(f.id + '?=' + id);
+                               if (f.id == id) {
+                                   return f;
+                               }
+                           };
+                       return null;
+               }
+
+               public JsRender.JsRender newFile (string name)
+               {
+                       var ret =  JsRender.JsRender.factory(this.xtype, 
+                                                        this, 
+                                                        this.firstPath() + "/" + name + ".bjs");
+                       this.addFile(ret);
+                       return ret;
+               }
+               
+               public JsRender.JsRender loadFileOnly (string path)
+               {
+                   var xt = this.xtype;
+                   return JsRender.JsRender.factory(xt, this, path);
+                   
+               }
+               
+               public JsRender.JsRender create(string filename)
+               {
+                   var ret = this.loadFileOnly(filename);
+                   ret.save();
+                   this.addFile(ret);
+                   return ret;
+                   
+               }
+                   
+                    
+               public void addFile(JsRender.JsRender pfile) { // add a single file, and trigger changed.
+               
+               
+                   this.files.set(pfile.path, pfile); // duplicate check?
+                   this.on_changed();
+               }
+               
+               public void add(string path, string type)
+               {
+                   this.paths.set(path,type);
+                   //Seed.print(" type is '" + type + "'");
+                   if (type == "dir") {
+                       this.scanDir(path);
+                   //    console.dump(this.files);
+                   }
+                   if (type == "file" ) {
+                       
+                       this.files.set(path,this.loadFileOnly( path ));
+                   }
+                   this.on_changed();
+                   
+               }
+               public void  scanDirs() // cached version
+               {
+                   if (this.is_scanned) {
+                               return;
+                       }
+                       this.scanDirsForce();
+                   //console.dump(this.files);
+                   
+               }
+               
+               public void  scanDirsForce()
+               {
+                       this.is_scanned = true;  
+                       var iter = this.paths.map_iterator();
+                   while (iter.next()) {
+                               //print("path: " + iter.get_key() + " : " + iter.get_value() +"\n");
+                       if (iter.get_value() != "dir") {
+                           continue;
+                       }
+                       this.scanDir(iter.get_key());
+                   }
+                   //console.dump(this.files);
+                   
+               }
+                   // list files.
+               public void scanDir(string dir, int dp =0 ) 
+               {
+                   //dp = dp || 0;
+                   //print("Project.Base: Running scandir on " + dir +"\n");
+                   if (dp > 5) { // no more than 5 deep?
+                       return;
+                   }
+                   // this should be done async -- but since we are getting the proto up ...
+                   
+                   var subs = new GLib.List<string>();;            
+                   var f = File.new_for_path(dir);
+                   try {
+                       var file_enum = f.enumerate_children(GLib.FileAttribute.STANDARD_DISPLAY_NAME, GLib.FileQueryInfoFlags.NONE, null);
+                       
+                        
+                       FileInfo next_file; 
+                       while ((next_file = file_enum.next_file(null)) != null) {
+                           var fn = next_file.get_display_name();
+                   
+                            
+                           //print("trying"  + dir + "/" + fn +"\n");
+                           
+                           if (fn[0] == '.') { // skip hidden
+                               continue;
+                           }
+                           
+                           if (FileUtils.test(dir  + "/" + fn, GLib.FileTest.IS_DIR)) {
+                               subs.append(dir  + "/" + fn);
+                               continue;
+                           }
+                           
+                           if (!Regex.match_simple("\\.bjs$", fn)) {
+                                               //print("no a bjs\n");
+                               continue;
+                           }
+                           /*
+                           var parent = "";
+                           //if (dp > 0 ) {
+                           
+                           var sp = dir.split("/");
+                           var parent = "";
+                           for (var i = 0; i < sp.length; i++) {
+                               
+                           }
+                           
+                           /*
+                           sp = sp.splice(sp.length - (dp +1), (dp +1));
+                           parent = sp.join('.');
+                           
+                           
+                           if (typeof(_this.files[dir  + '/' + fn]) != 'undefined') {
+                               // we already have it..
+                               _this.files[dir  + '/' + fn].parent = parent;
+                               return;
+                           }
+                           */
+                           var xt = this.xtype;
+                                       var el = JsRender.JsRender.factory(xt,this, dir + "/" + fn);
+                           this.files.set( dir + "/" + fn, el);
+                           // parent ?? 
+                           
+                            
+                       }
+                   } catch (Error e) {
+                       print("Project::scanDirs failed : " + e.message + "\n");
+                   } catch (GLib.Error e) {
+                               print("Project::scanDirs failed : " + e.message + "\n");
+                       }
+                       for (var i = 0; i < subs.length(); i++) {
+                       
+                        this.scanDir(subs.nth_data(i), dp+1);
+                   }
+                   
+               }
+                 
+       }
+}
\ No newline at end of file
diff --git a/old-javascript/Project/Roo.js b/old-javascript/Project/Roo.js
new file mode 100755 (executable)
index 0000000..3cf0027
--- /dev/null
@@ -0,0 +1,28 @@
+//<Script type="text/javascript">
+
+console = imports.console;
+XObject = imports.XObject.XObject;
+
+Base = imports.Project.Base.Base;
+
+id = 1;
+
+Roo = XObject.define(
+    function(cfg) {
+        
+        
+        Roo.superclass.constructor.call(this, cfg);
+
+       
+        // various loader methods..
+        this.id = 'project-gti-' + (id++);
+    }, 
+    Base,
+    {
+         
+        file : false
+    }
+);
\ No newline at end of file
diff --git a/old-javascript/Project/Roo.vala b/old-javascript/Project/Roo.vala
new file mode 100644 (file)
index 0000000..0ddbd59
--- /dev/null
@@ -0,0 +1,20 @@
+
+static int rid = 1;
+
+public class Project.Roo : Project {
+
+        
+
+    public Roo(string path) {
+
+               
+        base(path);
+        this.xtype = "Roo";
+        // various loader methods..
+        this.id = "project-roo-%d".printf(rid++);
+        
+    }
+}
\ No newline at end of file
diff --git a/old-javascript/XObjectBase/GdkDockBar.js b/old-javascript/XObjectBase/GdkDockBar.js
new file mode 100644 (file)
index 0000000..ed4b3a4
--- /dev/null
@@ -0,0 +1,25 @@
+
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+Gdl     = imports.gi.Gdl;
+// Cell render text..
+
+GdlDockBar = XObject.define(
+    function(cfg) {
+        XObject.call(this, cfg);
+    }, 
+    XObject,
+    {
+        pack : 'add', // default.. can be pack_start...
+        init : function()
+        {
+            
+            // dock for the current window exists. - use it..
+            var dock = this.get('^').dock || new Gdl.Dock ();
+            this.get('^').dock =  docl
+            this.el  = new Gdl.DockBar.c_new (dock);
+            XObject.prototype.init.call(this);
+        }
+    }
+}; 
\ No newline at end of file
diff --git a/old-javascript/XObjectBase/GdlDock.js b/old-javascript/XObjectBase/GdlDock.js
new file mode 100644 (file)
index 0000000..50228ee
--- /dev/null
@@ -0,0 +1,25 @@
+
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+Gdl     = imports.gi.Gdl;
+// Cell render text..
+
+GdlDock = XObject.define(
+    function(cfg) {
+        XObject.call(this, cfg);
+    }, 
+    XObject,
+    {
+        pack : 'add', // default.. can be pack_start...
+        init : function()
+        {
+            
+            // dock for the current window exists. - use it..
+            this.el = this.get('^').dock || new Gdl.Dock ();
+            this.get('^').dock =  this.el ;
+            this.get('^').layout = new Gdl.DockLayout.c_new (this.el);
+            XObject.prototype.init.call(this);
+        }
+    }
+}; 
\ No newline at end of file
diff --git a/old-javascript/XObjectBase/GdlDockItem.js b/old-javascript/XObjectBase/GdlDockItem.js
new file mode 100644 (file)
index 0000000..4e18f33
--- /dev/null
@@ -0,0 +1,51 @@
+
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+Gdl     = imports.gi.Gdl;
+// Cell render text..
+
+GdlDockItem = XObject.define(
+    function(cfg) {
+        XObject.call(this, cfg);
+    }, 
+    XObject,
+    {
+        
+        placement :  Gdl.DockPlacement.TOP,
+        behaviour : 0,
+        // name / long name...
+        
+        pack : function(parent, item) 
+        {
+            if (XObject.type(parent.el) == 'GdlDock') {
+                parent.el.add_item (this.el, this.placement || Gdl.DockPlacement.TOP);
+                return;
+            }
+            // otherwise 
+            parent.el.dock_to (this.el, this.placement || Gdl.DockPlacement.TOP, -1);
+            //     dock.add_item (item2, Gdl.DockPlacement.RIGHT);
+            
+            
+        },
+        init : function()
+        {
+            GdlDockItem.id = GdlDockItem.id ? GdlDockItem.id + 1 : 1;
+            
+            //new Gdl.DockItem.with_stock  ("item3",
+            //             "Item #3 has accented characters ( )",
+            //             Gtk.STOCK_CONVERT,
+            //             Gdl.DockItemBehavior.NORMAL | Gdl.DockItemBehavior.CANT_CLOSE);
+            
+            
+            this.el = new Gdl.GdlDockItem.c_new (
+                this.name       || 'Dock' + GdlDockItem.id, 
+                this.long_name  || 'Dock' + GdlDockItem.id, 
+                this.behaviour  || 0 //Gdl.DockItemBehavior.LOCKED
+            );
+            
+            
+            XObject.prototype.init.call(this);
+        }
+    }
+}; 
\ No newline at end of file
diff --git a/old-javascript/XObjectBase/GtkCellRendererText.js b/old-javascript/XObjectBase/GtkCellRendererText.js
new file mode 100644 (file)
index 0000000..00330a3
--- /dev/null
@@ -0,0 +1,16 @@
+
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+// Cell render text..
+
+GtkCellRendererText = XObject.define(
+    function(cfg) {
+        XObject.call(this, cfg);
+    }, 
+    XObject,
+    {
+        pack : 'pack_start'
+    }
+); 
\ No newline at end of file
diff --git a/old-javascript/XObjectBase/GtkCellRendererToggle.js b/old-javascript/XObjectBase/GtkCellRendererToggle.js
new file mode 100644 (file)
index 0000000..597fd18
--- /dev/null
@@ -0,0 +1,16 @@
+
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+// Cell render text..
+
+GtkCellRendererToggle = XObject.define(
+    function(cfg) {
+        XObject.call(this, cfg);
+    }, 
+    XObject,
+    {
+        pack : 'pack_start'
+    }
+); 
\ No newline at end of file
diff --git a/old-javascript/XObjectBase/GtkClutterActor.js b/old-javascript/XObjectBase/GtkClutterActor.js
new file mode 100644 (file)
index 0000000..3698558
--- /dev/null
@@ -0,0 +1,61 @@
+
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+GtkClutter = imports.gi.GtkClutter;
+
+//GtkClutter.Embed..
+// children are not added at init / but at show stage..
+// listener is added on show..
+// we should really add a hock to destroy it..
+
+
+GtkClutterActor = XObject.define(
+    function(cfg) {
+        XObject.call(this, cfg);
+        if (!this.items.length) {
+            XObject.fatal("Actor does not have any children");
+            return;
+        }
+        
+        this.items[0].pack = false;
+    }, 
+    XObject,
+    {
+    
+        pack : function(parent, item)
+        {
+            
+            if (XObject.type(parent.xtype) == 'GtkClutterWindow') {
+                var st = parent.el.get_stage();
+                st.add_actor(this.el);
+                return;
+            }
+            XObject.fatal("do not know how to pack actor into " +  XObject.type(parent.xtype));
+            
+        },
+        
+       
+        
+        init : function() {
+            print ("Actor init");
+            if (!this.items.length) {
+                print ("Actor does not have any children");
+                return;
+            }
+            var child = this.items[0];
+            child.init();
+            child.pack = false;
+            child.parent = this;
+            //var contents = new Gtk.Button({ label: 'test' }); 
+            
+           // print(JSON.stringify(this.items));
+            child.el.show();
+            
+            this.el = new GtkClutter.Actor.with_contents (  child.el) ;
+            
+            XObject.prototype.init.call(this);
+            this.el.show_all();
+        }
+    }
+); 
\ No newline at end of file
diff --git a/old-javascript/XObjectBase/GtkClutterEmbed.js b/old-javascript/XObjectBase/GtkClutterEmbed.js
new file mode 100644 (file)
index 0000000..9566180
--- /dev/null
@@ -0,0 +1,41 @@
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+GtkClutter = imports.gi.GtkClutter;
+
+//GtkClutter.Embed..
+// children are not added at init / but at show stage..
+// listener is added on show..
+// we should really add a hock to destroy it..
+GtkClutterEmbed = XObject.define(
+    function(cfg) {
+        XObject.call(this, cfg);
+        this.items.forEach( function(i) {
+            i.pack = false;
+        });
+    }, 
+    XObject,
+    {
+        
+        
+        init : function() {
+            // add the event listener..
+            
+            XObject.prototype.init.call(this);
+            
+            print("----------Embed init");
+            this.addListener('show', function () {
+                print("-------EMBED - show");
+                var stage = this.el.get_stage(); 
+                //print(this.items.length);
+                this.items.forEach( function(e) { 
+                      //print(e.xtype);
+                    stage.add_actor(e.el);
+                });
+            });
+           
+           
+        }
+    }
+
+);
\ No newline at end of file
diff --git a/old-javascript/XObjectBase/GtkExpander.js b/old-javascript/XObjectBase/GtkExpander.js
new file mode 100644 (file)
index 0000000..2d3679c
--- /dev/null
@@ -0,0 +1,36 @@
+
+XObject = imports.XObject.XObject
+
+GtkExpander = XObject.define(
+    function(cfg) {
+        
+        
+        this.events = cfg.events = cfg.events || [];
+        delete cfg.events;
+        XObject.call(this, cfg);
+        
+   
+    }, 
+    XObject,
+    {
+        events : false,
+        init : function()
+        {
+            // is this a common feature??? of widgets ...?
+            XObject.prototype.init.call(this);
+            for (var i = 0 ; i < this.events.length ; i++ ) { 
+                this.el.add_events (this.events[i] );
+            }
+            
+        }
+    }
+);
+GtkExpander.config = {
+   
+    events         : {
+        type : 'Array',
+        array_of : 'Gdk.EventMask'
+    }
+}
\ No newline at end of file
diff --git a/old-javascript/XObjectBase/GtkListStore.js b/old-javascript/XObjectBase/GtkListStore.js
new file mode 100644 (file)
index 0000000..21f66d5
--- /dev/null
@@ -0,0 +1,105 @@
+
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+GObject = imports.gi.GObject;
+//GtkClutter.Embed..
+Gtk= imports.gi.Gtk;
+
+// children are not added at init / but at show stage..
+// listener is added on show..
+// we should really add a hock to destroy it..
+GtkListStore = XObject.define(
+    function(cfg) {
+        
+        this.columns = cfg.columns = cfg.columns || false;
+        delete cfg.columns;
+        XObject.call(this, cfg);
+        // this is an example...
+       
+    }, 
+    XObject,
+    {
+        pack : 'set_model',
+        init : function() 
+        {
+            XObject.prototype.init.call(this);
+            
+            if (!this.columns) { 
+                
+                this.el.set_column_types ( 6, [
+                    GObject.TYPE_STRING, 
+                    GObject.TYPE_STRING, 
+                    GObject.TYPE_STRING, 
+                    GObject.TYPE_STRING, 
+                    GObject.TYPE_STRING, 
+                    GObject.TYPE_STRING 
+                ] );
+            } else {
+                 this.el.set_column_types ( this.columns.length, this.columns);
+                  
+                
+            }
+        },
+        append : function( values ) {
+            var iter = new Gtk.TreeIter();
+            this.el.append(iter);
+            for (var i = 0; i < values.length; i++) {
+                this.el.set_value(iter,i,values[i]);
+            }
+            
+        },
+        nextPath : function(path)
+        {
+            if (path === false) {
+                var iter = new Gtk.TreeIter();
+                this.el.get_iter_first(iter);
+                return this.el.get_path(iter);    
+            }
+            var tpath = path;
+            if (typeof(path) == 'string' ) {
+                tpath = new Gtk.TreePath.from_string(path);     
+            }
+            var iter = new Gtk.TreeIter();
+            
+            this.el.get_iter (iter, tpath) ;
+            
+            if (!this.el.iter_next(iter)) {
+                return false;
+            };
+            return this.el.get_path(iter);
+        },
+        
+        getValue  : function ( path, col)
+        {
+            // not very type safe...
+            var tpath = path;
+            if (typeof(path) == 'string' ) {
+                tpath = new Gtk.TreePath.from_string(path);
+                 
+            }
+            
+            var iter = new Gtk.TreeIter();
+            
+            this.el.get_iter (iter, tpath) ;
+             
+            var gval = new GObject.Value(  [this.el.get_column_type(col), null ]);
+            this.el.get_value( iter, col, gval);
+            print("GET VALUE RETURNED: " + gval.value);
+            return gval.value;
+        },
+        setValue  : function ( path, col, val)
+        {
+            var tpath = path;
+            if (typeof(path) == 'string' ) {
+                tpath = new Gtk.TreePath.from_string(path);
+            }
+            var iter = new Gtk.TreeIter();
+            this.el.get_iter (iter, tpath) ;
+            this.el.set_value(iter,col,val);
+        }
+                
+        
+    }
+); 
diff --git a/old-javascript/XObjectBase/GtkNotebook.js b/old-javascript/XObjectBase/GtkNotebook.js
new file mode 100644 (file)
index 0000000..42f3112
--- /dev/null
@@ -0,0 +1,38 @@
+
+XObject = imports.XObject.XObject
+
+GtkNotebook= XObject.define(
+    function(cfg) {
+        
+        
+        this.current_page = cfg.current_page = cfg.current_page || false;
+        delete cfg.current_page;
+        XObject.call(this, cfg);
+        
+   
+    }, 
+    XObject,
+    {
+        current_page : false,
+        init : function()
+        {
+            // is this a common feature??? of widgets ...?
+            XObject.prototype.init.call(this);
+            
+            if (this.current_page !== false)
+            {
+                this.el.set_current_page(this.current_page);
+            }
+                                                    
+            
+        }
+    }
+);
+GtkNotebook.config = {
+   
+    current_page         : {
+        type : 'Integer'
+    }
+}
\ No newline at end of file
diff --git a/old-javascript/XObjectBase/GtkScrolledWindow.js b/old-javascript/XObjectBase/GtkScrolledWindow.js
new file mode 100644 (file)
index 0000000..074f163
--- /dev/null
@@ -0,0 +1,31 @@
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+
+Gtk = imports.gi.Gtk;
+//GtkClutter.Embed..
+// children are not added at init / but at show stage..
+// listener is added on show..
+// we should really add a hock to destroy it..
+
+GtkScrolledWindow = XObject.define(
+    function(cfg) {
+        
+        XObject.call(this, cfg);
+    }, 
+    XObject,
+    {
+        
+        // should we always add??
+        pack : 'add',
+        
+        init : function() 
+        {
+            // aways set policy like this?
+            XObject.prototype.init.call(this);
+            this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+        }
+
+         
+
+});
\ No newline at end of file
diff --git a/old-javascript/XObjectBase/GtkTable.js b/old-javascript/XObjectBase/GtkTable.js
new file mode 100644 (file)
index 0000000..1f04240
--- /dev/null
@@ -0,0 +1,32 @@
+
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+//GtkClutter.Embed..
+// children are not added at init / but at show stage..
+// listener is added on show..
+// we should really add a hock to destroy it..
+
+GtkTable = XObject.define(
+    function(cfg) {
+        XObject.call(this, cfg);
+        var _this = this;
+        
+        this.items.forEach(function(i,n) {
+            var c = n % _this.config.n_columns;
+            var r = Math.floor(n/_this.config.n_columns);
+            i.pack = [ 'attach', c, c+1, r, r+1, 
+                    typeof(i.x_options) == 'undefined' ?  5 : i.x_options,
+                    typeof(i.y_options) == 'undefined' ?  5 : i.y_options,
+                    typeof(i.x_padding) == 'undefined' ?  0 : i.x_padding,
+                    typeof(i.x_padding) == 'undefined' ?  0 : i.x_padding
+                   
+            ]
+        });
+    }, 
+    XObject,
+    {
+    }
+); 
\ No newline at end of file
diff --git a/old-javascript/XObjectBase/GtkTreeModelFilter.js b/old-javascript/XObjectBase/GtkTreeModelFilter.js
new file mode 100644 (file)
index 0000000..e98e0b1
--- /dev/null
@@ -0,0 +1,71 @@
+
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+GObject = imports.gi.GObject;
+//GtkClutter.Embed..
+Gtk= imports.gi.Gtk;
+
+// children are not added at init / but at show stage..
+// listener is added on show..
+// we should really add a hock to destroy it..
+GtkTreeModelFilter = XObject.define(
+    function(cfg) {
+        XObject.call(this, cfg);
+        // this is an example...
+       
+    }, 
+    XObject,
+    {
+        pack :  'set_model',
+        init : function() 
+        {
+            // 
+            this.items[0].pack = false;
+            this.items[0].init();
+            this.list = this.items[0];
+            this.el = new Gtk.TreeModelFilter.c_new(this.items[0].el, null);
+            XObject.prototype.init.call(this);
+          
+        },
+        append : function( values ) {
+            this.list.append(values);
+        },
+          getValue  : function ( path, col)
+        {
+            // not very type safe...
+            var tpath = path;
+            if (typeof(path) == 'string' ) {
+                tpath = new Gtk.TreePath.from_string(path);
+                 
+            }
+            
+            var iter = new Gtk.TreeIter();
+            
+            this.el.get_iter (iter, tpath) ;
+            var citer = new Gtk.TreeIter();
+            this.el.convert_iter_to_child_iter(citer, iter);
+             
+            var gval = new GObject.Value(  [this.list.el.get_column_type(col), null ]);
+            this.list.el.get_value( citer, col, gval);
+            print("GET VALUE RETURNED: " + gval.value);
+            return gval.value;
+        },
+        setValue  : function ( path, col, val)
+        {
+            var tpath = path;
+            if (typeof(path) == 'string' ) {
+                tpath = new Gtk.TreePath.from_string(path);
+            }
+            var iter = new Gtk.TreeIter();
+             var citer = new Gtk.TreeIter();
+             this.el.get_iter (iter, tpath) ;
+            this.el.convert_iter_to_child_iter(citer, iter);
+            
+            this.list.el.set_value(citer,col,val);
+        }
+                
+        
+    }
+); 
diff --git a/old-javascript/XObjectBase/GtkTreeSelection.js b/old-javascript/XObjectBase/GtkTreeSelection.js
new file mode 100644 (file)
index 0000000..bdaadf8
--- /dev/null
@@ -0,0 +1,58 @@
+
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+GObject = imports.gi.GObject;
+
+// tree view column.. should really have a better way to determin stuff..
+
+GtkTreeSelection = XObject.define(
+    function(cfg)
+    {
+        // child only get's a listener...
+        XObject.call(this, cfg);
+        
+        // you can not actually ctor this..
+         
+        
+        
+    }, 
+    XObject,
+    {
+        pack: function(parent, item)
+        {
+            // do nothing... init has already made 'el'
+            
+        },
+        
+        
+        init : function(parent) 
+        {
+            
+            this.el = parent.el.get_selection();
+            
+            parent.selection = this; 
+             
+            if (typeof(this.config.mode) == 'undefined') {
+                this.el.set_mode(this.config.mode );
+            }
+        }       
+             
+         
+    }
+); 
+/// make available configuration so builder know how to handle it..
+
+
+GtkTreeSelection.config = {
+    mode   : {
+        type : 'Gtk.SelectionMode'
+    },
+    parents : [
+        'Gtk.TreeView'
+    ]
+};
+
+
diff --git a/old-javascript/XObjectBase/GtkTreeStore.js b/old-javascript/XObjectBase/GtkTreeStore.js
new file mode 100644 (file)
index 0000000..0543462
--- /dev/null
@@ -0,0 +1,42 @@
+
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+GObject = imports.gi.GObject;
+GtkTreeStore = XObject.define(
+    function(cfg) {
+        this.columns = cfg.columns = cfg.columns || false;
+        delete cfg.columns;
+        XObject.call(this, cfg);
+       
+       
+    }, 
+    XObject,
+    {
+        pack : 'set_model',
+        init : function() 
+        {
+            XObject.prototype.init.call(this);
+            
+            if (!this.columns) { 
+                
+                this.el.set_column_types ( 6, [
+                    GObject.TYPE_STRING, 
+                    GObject.TYPE_STRING, 
+                    GObject.TYPE_STRING, 
+                    GObject.TYPE_STRING, 
+                    GObject.TYPE_STRING, 
+                    GObject.TYPE_STRING 
+                ] );
+            } else {
+                 this.el.set_column_types ( this.columns.length, this.columns);
+                  
+                
+            }
+            
+            
+        }
+    }
+); 
diff --git a/old-javascript/XObjectBase/GtkTreeView.js b/old-javascript/XObjectBase/GtkTreeView.js
new file mode 100644 (file)
index 0000000..1f77cd1
--- /dev/null
@@ -0,0 +1,121 @@
+
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+GObject = imports.gi.GObject;
+
+// tree view column.. should really have a better way to determin stuff..
+
+GtkTreeView = XObject.define(
+    function(cfg)
+    {
+        
+        
+        var clean_cfg = XObject.extend({
+            font         :  false,
+            drag_source : false,
+            drag_dest   : false //,
+       //     selection : false,
+        }, cfg);
+        
+        delete clean_cfg.font;
+        delete clean_cfg.selection;
+        delete clean_cfg.drag_source;
+        delete clean_cfg.drag_dest;
+         
+        
+        XObject.call(this, clean_cfg);
+        
+        this.config = cfg;
+        
+        // this is an example...
+        
+        
+    }, 
+    XObject,
+    {
+        selection : false,
+        
+        init : function() 
+        {
+            
+            XObject.prototype.init.call(this);
+            
+            
+            
+            
+             
+            if (this.config.font) {
+                var description = new Pango.FontDescription.c_new();
+                description.set_size(this.config.font.size);
+                this.el.modify_font(description);
+            }
+            
+          
+             
+            if (this.config.drag_source) {
+                var ds = this.config.drag_source;
+                
+                this.el.drag_source_set(             // widget will be drag-able 
+                    ds.modifier, //Gdk.ModifierType.BUTTON1_MASK,       // modifier that will start a drag 
+                    null,            // lists of target to support 
+                    0,              // size of list 
+                    ds.action   ////Gdk.DragAction.COPY   | Gdk.DragAction.MOVE
+                                // what to do with data after dropped 
+                );
+                
+                this.el.drag_source_set_target_list(
+                        ds.targetList // probably imports.Window.targetList;
+                        //this.get('/Window').targetList
+                );
+                this.el.drag_source_add_text_targets();
+            }
+            
+            if (this.config.drag_dest) {
+                
+                var ds = this.config.drag_dest;
+                
+                this.el.drag_dest_set
+                (
+                    ds.modifier, // Gtk.DestDefaults.MOTION  | Gtk.DestDefaults.HIGHLIGHT,
+                    null,            // lists of target to support 
+                    0,              // size of list 
+                    ds.action //Gdk.DragAction.COPY   | Gdk.DragAction.MOVE       // what to do with data after dropped 
+                );
+                
+                this.el.drag_source_add_text_targets();
+                this.el.drag_dest_set_target_list(
+                    ds.targetList
+                            //this.get('/Window').targetList
+                );
+                this.el.drag_dest_add_text_targets();
+            }
+             
+        }
+                                                                                  
+             
+         
+    }
+); 
+
+GtkTreeView.config = {
+    //selection   : { << just need to add a treeselection..
+    //    type : 'Gtk.TreeSelection'
+    //},
+    font         : {
+        type : 'Pango.FontDescription'
+    },
+    drag_source : {
+        type : 'Gtk.TreeDragSource' // these are realy interfaces...
+    },
+    
+    drag_dest   : {
+        type : 'Gtk.TreeDragDest'
+    }
+    
+    
+};
+
+
diff --git a/old-javascript/XObjectBase/GtkTreeViewColumn.js b/old-javascript/XObjectBase/GtkTreeViewColumn.js
new file mode 100644 (file)
index 0000000..6884635
--- /dev/null
@@ -0,0 +1,74 @@
+
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject
+GObject = imports.gi.GObject;
+
+// tree view column.. should really have a better way to determin stuff..
+
+GtkTreeViewColumn = XObject.define(
+    function(cfg) {
+        XObject.call(this, cfg);
+        // this is an example...
+        GtkTreeViewColumn.ids++;
+        this.col_id = GtkTreeViewColumn.ids;
+        
+    }, 
+    XObject,
+    {
+        list : false, // list goes here, 
+        pack : function(parent, item) {
+             
+            
+            parent.el.append_column(this.el);
+            var n = 0;
+            var _t = this;
+            var col = 0;
+            var found = false; 
+             
+            parent.items.forEach(function(e){
+                if ([ 'GtkListStore', 'GtkTreeStore', 'GtkTreeModelFilter' ].indexOf( XObject.type(e.xtype) ) > -1 ) {
+                    _t.list = e;
+                    return;
+                }
+                
+                
+                if (found) {
+                    return true;
+                }
+                 
+                if (e.col_id == _t.col_id) {
+                    col = n;
+                    found = true;
+                    return;
+                }
+                if (XObject.type(e.xtype) == 'GtkTreeViewColumn') {
+                    n++;
+                }
+            });
+            
+            
+            if (this.items.length) {
+                print("child : " + XObject.type(this.items[0].xtype));
+                this.items[0].list = this.list;
+                switch (XObject.type(this.items[0].xtype)) {
+                    case "GtkCellRendererText":
+                        this.el.add_attribute(this.items[0].el , 'markup', col );
+                        break;
+                    case "GtkCellRendererToggle":
+                        print("toggle col : " + col);
+                        this.el.add_attribute (this.items[0].el , 'active', col ); // boolean???
+                        break;    
+                        
+                }
+                
+                
+            }
+            
+            
+        }
+         
+    }
+); 
+GtkTreeViewColumn.ids = 0;
\ No newline at end of file
diff --git a/old-javascript/XObjectBase/WebKitWebView.js b/old-javascript/XObjectBase/WebKitWebView.js
new file mode 100644 (file)
index 0000000..0adb51e
--- /dev/null
@@ -0,0 +1,31 @@
+//<Script type="Text/javascript">
+
+XObject = imports.XObject.XObject 
+
+//GtkClutter.Embed..
+// children are not added at init / but at show stage..
+// listener is added on show..
+// we should really add a hock to destroy it..
+
+
+WebKitWebView = XObject.define(
+    function(cfg) {
+        XObject.call(this, cfg);
+     
+    }, 
+    XObject,
+    {
+        pack : function(parent, item)
+        {
+            
+            if (XObject.type(parent.xtype) == 'GtkScrolledWindow') {
+                parent.el.add(this.el);
+                return;
+            }
+            XObject.fatal("do not know how to pack webview to" +  XObject.type(parent.xtype));
+            
+        } 
+    }
+); 
+  
\ No newline at end of file
diff --git a/old-javascript/builder.sh b/old-javascript/builder.sh
new file mode 100755 (executable)
index 0000000..f6cf820
--- /dev/null
@@ -0,0 +1,9 @@
+#!/bin/sh
+# use our overridden typelibs.
+export GI_TYPELIB_PATH=~/.Builder/girepository-1.2
+cd $(dirname $0)
+
+# run theapplication.
+seed ./gtkrun.js Builder3 
+