updated xobject , clutter base objects started
[app.Builder.js] / Builder / Window.js
index 1ba0391..9c9d096 100644 (file)
@@ -7,6 +7,7 @@ GObject = imports.gi.GObject;
 GtkSource = imports.gi.GtkSource;
 WebKit = imports.gi.WebKit;
 Vte = imports.gi.Vte;
+GtkClutter = imports.gi.GtkClutter;
 console = imports.console;
 XObject = imports.XObject.XObject;
 Window=new XObject({
@@ -162,9 +163,6 @@ Window=new XObject({
                                 {
                                     xtype: Gtk.Menu,
                                     pack : "set_submenu",
-                                    listeners : {
-                                        
-                                    },
                                     items : [
                                         {
                                             xtype: Gtk.MenuItem,
@@ -208,9 +206,6 @@ Window=new XObject({
                                 {
                                     xtype: Gtk.Menu,
                                     pack : "set_submenu",
-                                    listeners : {
-                                        
-                                    },
                                     items : [
                                         {
                                             xtype: Gtk.MenuItem,
@@ -268,7 +263,7 @@ Window=new XObject({
                                                         html = html.replace('</head>', project.runhtml + '</head>');
                                                         
                                                        
-                                                        var     jsstr = JSON.stringify(js[0]);
+                                                        var     jsstr = JSON.stringify(js[0], null, 4);
                                                        
                                                         var runbuilder = '<script type="text/javascript">' + "\n" + 
                                                             " Builder.render(" + jsstr + ");\n" +
@@ -299,17 +294,11 @@ Window=new XObject({
                             xtype: Gtk.MenuItem,
                             label : "_Help",
                             use_underline : true,
-                            listeners : {
-                                
-                            },
                             pack : "add",
                             items : [
                                 {
                                     xtype: Gtk.Menu,
                                     pack : "set_submenu",
-                                    listeners : {
-                                        
-                                    },
                                     items : [
                                         {
                                             xtype: Gtk.MenuItem,
@@ -464,68 +453,6 @@ Window=new XObject({
                                                             items : [
                                                                 {
                                                                     xtype: Gtk.TreeView,
-                                                                    pack : "add",
-                                                                    id : "view",
-                                                                    headers_visible : false,
-                                                                    enable_tree_lines : true,
-                                                                    tooltip_column : 1,
-                                                                    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'), '']
-                                                                               );
-                                                                       });
-                                                                    
-                                                                       Gtk.drag_source_set (
-                                                                               this.el,            /* 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 */
-                                                                       );
-                                                                    
-                                                                       Gtk.drag_source_set_target_list(this.el, this.get('/Window').targetList);
-                                                                    
-                                                                       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,
-                                                                           null,            /* lists of target to support */
-                                                                           0,              /* size of list */
-                                                                           Gdk.DragAction.COPY   | Gdk.DragAction.MOVE       /* what to do with data after dropped */
-                                                                       );
-                                                                    
-                                                                       Gtk.drag_dest_set_target_list(this.el, this.get('/Window').targetList);
-                                                                       Gtk.drag_dest_add_text_targets(this.el);
-                                                                    },
-                                                                    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);
-                                                                                }
-                                                                                 
-                                                                            },
-                                                                    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);
-                                                                    },
                                                                     listeners : {
                                                                         button_press_event : function (self, ev) {
                                                                                console.log("button press?");
@@ -769,7 +696,7 @@ Window=new XObject({
                                                                                // _g.button.set_label(''+value.get_string());
                                                                         
                                                                                 var pm =this.get('/RightPalete.model');
-                                                                                pm.load( this.get('/RightPalete').provider.gatherList(
+                                                                                pm.load(  this.get('/LeftTree').getPaleteProvider().gatherList(
                                                                                      this.get('/LeftTree.model').listAllTypes()));
                                                                                
                                                                                 
@@ -782,6 +709,68 @@ Window=new XObject({
                                                                                         
                                                                         }
                                                                     },
+                                                                    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'), '']
+                                                                               );
+                                                                       });
+                                                                    
+                                                                       Gtk.drag_source_set (
+                                                                               this.el,            /* 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 */
+                                                                       );
+                                                                    
+                                                                       Gtk.drag_source_set_target_list(this.el, this.get('/Window').targetList);
+                                                                    
+                                                                       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,
+                                                                           null,            /* lists of target to support */
+                                                                           0,              /* size of list */
+                                                                           Gdk.DragAction.COPY   | Gdk.DragAction.MOVE       /* what to do with data after dropped */
+                                                                       );
+                                                                    
+                                                                       Gtk.drag_dest_set_target_list(this.el, this.get('/Window').targetList);
+                                                                       Gtk.drag_dest_add_text_targets(this.el);
+                                                                    },
+                                                                    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,
@@ -790,7 +779,7 @@ Window=new XObject({
                                                                             id : "model",
                                                                             pack : "set_model",
                                                                             changed : function(n, refresh) {
-                                                                                     print("MODEL CHANGED CALLED" + this.activePath);
+                                                                                //     print("MODEL CHANGED CALLED" + this.activePath);
                                                                                      if (this.activePath) {
                                                                                         var iter = new Gtk.TreeIter();
                                                                                         this.el.get_iter(iter, new Gtk.TreePath.from_string(this.activePath))
@@ -801,7 +790,7 @@ Window=new XObject({
                                                                                     }
                                                                                         //this.currentTree = this.toJS(false, true)[0];
                                                                                     this.file.items = this.toJS(false, false);
-                                                                                    print("AFTER CHANGED");
+                                                                                  //  print("AFTER CHANGED");
                                                                                     //console.dump(this.file.items);
                                                                                     this.file.save();
                                                                                     this.currentTree = this.file.items[0];
@@ -1135,6 +1124,7 @@ Window=new XObject({
                                                                                             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();
@@ -1361,6 +1351,11 @@ Window=new XObject({
                                                                                     }
                                                                                 }
                                                                                 
+                                                                                if (treepath === false) {
+                                                                                    //dupe!!!
+                                                                                    return JSON.parse(JSON.stringify(ar));
+                                                                                }
+                                                                                
                                                                                 return ar;
                                                                                 // convert the list into a json string..
                                                                             
@@ -1538,19 +1533,6 @@ Window=new XObject({
                                                                     items : [
                                                                         {
                                                                             xtype: Gtk.TreeView,
-                                                                            headers_visible : false,
-                                                                            enable_tree_lines : true,
-                                                                            tooltip_column : 1,
-                                                                            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);
-                                                                            },
-                                                                            id : "view",
                                                                             listeners : {
                                                                                 cursor_changed : function (self) {
                                                                                        var iter = new Gtk.TreeIter();
@@ -1572,7 +1554,7 @@ Window=new XObject({
                                                                                         
                                                                                         var file = this.get('/LeftProjectTree').project.getById(value.value);
                                                                                         
-                                                                                        
+                                                                                        file.items = false;
                                                                                         console.log(file);
                                                                                         
                                                                                 
@@ -1588,6 +1570,19 @@ Window=new XObject({
                                                                                         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,
@@ -1667,9 +1662,6 @@ Window=new XObject({
                                         },
                                         {
                                             xtype: Gtk.VBox,
-                                            listeners : {
-                                                
-                                            },
                                             items : [
                                                 {
                                                     xtype: Gtk.HBox,
@@ -2002,11 +1994,6 @@ Window=new XObject({
                                                                     activePath : false,
                                                                     id : "model",
                                                                     pack : "set_model",
-                                                                    getIterValue : function(iter, col) {
-                                                                         var gval = new GObject.Value('');
-                                                                        this.get('/LeftPanel.model').el.get_value(iter, col ,gval);
-                                                                        return '' + gval.value;
-                                                                    },
                                                                     add : function(info) {
                                                                           // info includes key, val, skel, etype..
                                                                                   console.dump(info);
@@ -2027,7 +2014,7 @@ Window=new XObject({
                                                                                 if (typeof(info.val) == 'undefined') {
                                                                                         
                                                                                     info.val = '';
-                                                                                    if (info.type == 'boolean') {
+                                                                                    if (info.type.toLowerCase() == 'boolean') {
                                                                                         info.val = true;
                                                                                     }
                                                                                     if (type == 'number') {
@@ -2137,7 +2124,7 @@ Window=new XObject({
                                                                             showEditor = true;
                                                                         }
                                                                         if (val[0] == '|') {
-                                                                            if (rval.match(/function/g) || rval.match(/\n/g)) {
+                                                                            if (rval.match(/function/g) || rval.match(/\n/g) || rval.length > 20) {
                                                                                 showEditor = true;
                                                                             }
                                                                         }
@@ -2149,7 +2136,7 @@ Window=new XObject({
                                                                                 //   Gdk.threads_enter();
                                                                                 _this.get('/BottomPane').el.show();
                                                                                 _this.get('/RightEditor').el.show();
-                                                                       _this.get('/RightEditor.view').load( rval );
+                                                                                _this.get('/RightEditor.view').load( rval );
                                                                                 
                                                                                 e.editing_done();
                                                                                 e.remove_widget();
@@ -2166,6 +2153,11 @@ Window=new XObject({
                                                                             //var type = this.getValue(this.el.get_path(iter).to_string(),4);
                                                                             
                                                                             
+                                                                    },
+                                                                    getIterValue : function(iter, col) {
+                                                                         var gval = new GObject.Value('');
+                                                                        this.get('/LeftPanel.model').el.get_value(iter, col ,gval);
+                                                                        return '' + gval.value;
                                                                     },
                                                                     getType : function(treepath) {
                                                                          return this.getValue(treepath, 4);
@@ -2181,7 +2173,7 @@ Window=new XObject({
                                                                             return val;
                                                                         }
                                                                         var type = this.getType(this.el.get_path(iter).to_string());
-                                                                        print("TYPE: " +type + " -  val:" + val);
+                                                                        //print("TYPE: " +type + " -  val:" + val);
                                                                         switch(type.toLowerCase()) {
                                                                             case 'number':
                                                                             case 'uint':
@@ -2268,64 +2260,64 @@ Window=new XObject({
                                                                         return ret;
                                                                     },
                                                                     startEditing : function(path,col) {
-                                                                    /**
-                                                                    * 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. 
-                                                                    */
+                                                                        /**
+                                                                        * 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. 
+                                                                        */
                                                                          var tp;
-                                                                                if (typeof(path) == 'string') {
-                                                                                    tp = new Gtk.TreePath.from_string(path);
-                                                                                } else {
-                                                                                    var iter = new Gtk.TreeIter();
-                                                                                    var s = this.get('/LeftPanel.view').selection;
-                                                                                    s.get_selected(this.el, iter);
-                                                                                    tp = this.el.get_path(iter);
-                                                                                    path = tp.to_string();
-                                                                                }
-                                                                                
-                                                                               
-                                                                                // which colum is to be edited..
-                                                                                var colObj = false;
-                                                                                if (typeof(col) == 'undefined') {
-                                                                                    var k = this.getValue(path, 0);
-                                                                                    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...
+                                                                        if (typeof(path) == 'string') {
+                                                                            tp = new Gtk.TreePath.from_string(path);
+                                                                        } else {
+                                                                            var iter = new Gtk.TreeIter();
+                                                                            var s = this.get('/LeftPanel.view').selection;
+                                                                            s.get_selected(this.el, iter);
+                                                                            tp = this.el.get_path(iter);
+                                                                            path = tp.to_string();
+                                                                        }
+                                                                        
+                                                                       
+                                                                        // which colum is to be edited..
+                                                                        var colObj = false;
+                                                                        if (typeof(col) == 'undefined') {
+                                                                            var k = this.getValue(path, 0);
+                                                                            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 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; /// probably does not have any effect.
-                                                                                } else {
-                                                                                    this.get('/LeftPanel').editableColumn.setOptions(opts);
-                                                                                    renderer.has_entry = false;
-                                                                                }
-                                                                                
-                                                                                var _this=this;
-                                                                                // iter now has row...
-                                                                                GLib.timeout_add(0, 100, function() {
-                                                                                    
-                                                                                    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
-                                                                                    );
-                                                                                });
-                                                                                
+                                                                        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; /// probably does not have any effect.
+                                                                        } else {
+                                                                            this.get('/LeftPanel').editableColumn.setOptions(opts);
+                                                                            renderer.has_entry = false;
+                                                                        }
+                                                                        
+                                                                        var _this=this;
+                                                                        // iter now has row...
+                                                                        GLib.timeout_add(0, 100, function() {
+                                                                            
+                                                                            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 iter = new Gtk.TreeIter();
@@ -2516,25 +2508,6 @@ Window=new XObject({
                                     items : [
                                         {
                                             xtype: Gtk.TreeView,
-                                            enable_tree_lines : true,
-                                            headers_visible : false,
-                                            tooltip_column : 2,
-                                            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);
-                                             
-                                            
-                                                
-                                              
-                                                
-                                            },
-                                            pack : "add",
                                             listeners : {
                                                 cursor_changed : function (self) {
                                                        var iter = new Gtk.TreeIter();
@@ -2563,7 +2536,7 @@ Window=new XObject({
                                                         
                                                         this.get('/MidPropTree').hideWin();
                                                 
-                                                        if (type == 'function') {
+                                                        if (type.toLowerCase() == 'function') {
                                                             
                                                             if (etype != 'events') {
                                                                 key = '|' + key;
@@ -2577,11 +2550,10 @@ Window=new XObject({
                                                             })  
                                                             return;
                                                         }
-                                                        
-                                                        if (type.indexOf('.') > -1 || 
-                                                                type == 'boolean') {
-                                                             key = '|' + key;
-                                                        }
+                                                        // has dot in name, and is boolean???? this does not make sense..
+                                                        //if (type.indexOf('.') > -1 ||  type.toLowerCase() == 'boolean') {
+                                                        //     key = '|' + key;
+                                                       // }
                                                         
                                                         this.get('/LeftPanel.model').add( {
                                                             key : key, 
@@ -2590,11 +2562,41 @@ Window=new XObject({
                                                             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",
+                                                    getValue : function(treepath, col)
+                                                    {
+                                                        var tp = new Gtk.TreePath.from_string (treepath);
+                                                        var iter = new Gtk.TreeIter();
+                                                        this.el.get_iter (iter, tp);
+                                                        var value = new GObject.Value('');
+                                                        this.el.get_value(iter, col, value);
+                                                        return value.value;
+                                                        
+                                                    },
                                                     init : function() {
                                                         XObject.prototype.init.call(this);
                                                        this.el.set_column_types ( 6, [
@@ -2607,16 +2609,6 @@ Window=new XObject({
                                                             
                                                         ] );
                                                     },
-                                                    getValue : function(treepath, col)
-                                                    {
-                                                        var tp = new Gtk.TreePath.from_string (treepath);
-                                                        var iter = new Gtk.TreeIter();
-                                                        this.el.get_iter (iter, tp);
-                                                        var value = new GObject.Value('');
-                                                        this.el.get_value(iter, col, value);
-                                                        return value.value;
-                                                        
-                                                    },
                                                     showData : function(type) {
                                                         this.el.clear();
                                                                 if (!this.get('/MidPropTree').activeElement || !type) {
@@ -2636,7 +2628,9 @@ Window=new XObject({
                                                                     this.get('/MidPropTree').shown = true;
                                                                 }
                                                                 
-                                                                var elementList = palete.getPropertiesFor(fullpath, type);
+                                                                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);
                                                                
@@ -2661,8 +2655,7 @@ Window=new XObject({
                                                                     
                                                                 }
                                                                                  
-                                                    },
-                                                    id : "model"
+                                                    }
                                                 },
                                                 {
                                                     xtype: Gtk.TreeViewColumn,
@@ -2712,13 +2705,13 @@ Window=new XObject({
                                                     items : [
                                                         {
                                                             xtype: Gtk.Notebook,
-                                                            pack : "add",
                                                             id : "view-notebook",
+                                                            pack : "add",
                                                             tab_border : 0,
                                                             init : function() {
                                                                 XObject.prototype.init.call(this);
                                                                 this.el.set_current_page(0);
-                                                                print("SET LABEL?")
+                                                                //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" }));
                                                             },
@@ -2726,118 +2719,55 @@ Window=new XObject({
                                                             items : [
                                                                 {
                                                                     xtype: Gtk.VBox,
-                                                                    pack : "add",
                                                                     id : "RightBrowser",
-                                                                    listeners : {
-                                                                        
-                                                                    },
+                                                                    pack : "add",
                                                                     items : [
                                                                         {
                                                                             xtype: Gtk.ScrolledWindow,
                                                                             pack : "add",
-                                                                            shadow_type : Gtk.ShadowType.IN,
                                                                             init : function() {
                                                                                 XObject.prototype.init.call(this);
-                                                                              this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
+                                                                                this.el.set_policy(Gtk.PolicyType.AUTOMATIC, Gtk.PolicyType.AUTOMATIC);
                                                                             },
+                                                                            shadow_type : Gtk.ShadowType.IN,
                                                                             items : [
                                                                                 {
                                                                                     xtype: WebKit.WebView,
-                                                                                    pack : "add",
-                                                                                    id : "view",
-                                                                                    init : function() {
-                                                                                        XObject.prototype.init.call(this);
-                                                                                        // this may not work!?
-                                                                                        this.el.open('file:///' + __script_path__ + '/../builder.html');
-                                                                                                              
-                                                                                        Gtk.drag_dest_set
-                                                                                        (
-                                                                                                this.el,              /* 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"]);
-                                                                                        Gtk.drag_dest_set_target_list(this.el, this.get('/Window').targetList);
-                                                                                    },
-                                                                                    renderJS : function(data) {
-                                                                                        print("HTML RENDERING");
-                                                                                        /// prevent looping..
-                                                                                        //if (this.pendingRedraw) {
-                                                                                        //   print("pending redraw active?!");
-                                                                                         //   return;
-                                                                                        //}
-                                                                                        
-                                                                                        
-                                                                                        if (!this.get('/Window.LeftTree').getActiveFile()) {
-                                                                                            return;
-                                                                                        }
-                                                                                        
-                                                                                        var project = this.get('/Window.LeftTree').getActiveFile().project;
-                                                                                        //print (project.fn);
-                                                                                        
-                                                                                        project.runhtml  = project.runhtml || '';
-                                                                                        
-                                                                                    
-                                                                                        this.runhtml  = this.runhtml || '';
-                                                                                        
-                                                                                        if (project.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;
-                                                                                     
-                                                                                            this.runhtml = project.runhtml;
-                                                                                            
-                                                                                            var html = imports.File.File.read(__script_path__ + '/../builder.html');
-                                                                                            html = html.replace('</head>', this.runhtml + '</head>');
-                                                                                            print("LOAD HTML " + html);
-                                                                                            this.el.load_html_string( html , 'file:///' + __script_path__ + '/../builder.html');
-                                                                                            // should trigger load_finished!
-                                                                                            return;
-                                                                                        
-                                                                                        }
-                                                                                        
-                                                                                        this.pendingRedraw = false;    
-                                                                                         
-                                                                                        
-                                                                                        this.renderedData = data;
-                                                                                        var str = JSON.stringify(data) ;
-                                                                                        
-                                                                                        if (!this.ready) {
-                                                                                            console.log('not loaded yet');
-                                                                                        }
-                                                                                        //Seed.print("RENDER:" + str);
-                                                                                        //imports.File.File.write('/tmp/builder.debug.js', "Builder.render(" + JSON.stringify(data) + ");");
-                                                                                     
-                                                                                        this.el.execute_script("Builder.render(" + JSON.stringify(data) + ");");
-                                                                                    },
                                                                                     listeners : {
                                                                                         load_finished : function (self, object) {
+                                                                                            print("load finished");
+                                                                                        //    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;
-                                                                                                this.pendingRedraw = false;
-                                                                                                var js = this.get('/LeftTree.model').toJS();
-                                                                                                if (js && js[0]) {
-                                                                                                       this.renderJS(js[0]);
-                                                                                               }
+                                                                                               
+                                                                                                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);
+                                                                                            //         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(/^\{/)) {
                                                                                                 
-                                                                                                    this.get('/Terminal').feed(object);
+                                                                                                    //this.get('/Terminal').feed(object);
                                                                                                     return true; // do not handle!!! -> later maybe in console..
                                                                                                 }
                                                                                                // console.log(object);
@@ -2853,9 +2783,11 @@ Window=new XObject({
                                                                                                  if (typeof(val['id']) != 'undefined') {
                                                                                                    // this.activeNode = val['id'];
                                                                                                     var tg = this.get('/LeftTree.model').findDropNode(val['id'], true); 
-                                                                                                    if (!tg) {
+                                                                                                    if (!tg || typeof(tg[0]) == 'undefined') {
                                                                                                         return false;
                                                                                                     }
+                                                                                                    print("SELECT node " + tg[0]);
+                                                                                                    
                                                                                                     this.get('/LeftTree.view').selectNode(tg[0]);
                                                                                                     ret  = true;
                                                                                                     
@@ -2968,7 +2900,156 @@ Window=new XObject({
                                                                                                 
                                                                                                 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",
+                                                                                    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');
+                                                                                                              
+                                                                                        Gtk.drag_dest_set
+                                                                                        (
+                                                                                                this.el,              /* 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"]);
+                                                                                        Gtk.drag_dest_set_target_list(this.el, this.get('/Window').targetList);
+                                                                                        
+                                                                                        GLib.timeout_add_seconds(0, 1, function() {
+                                                                                            //    print("run refresh?");
+                                                                                             _this.runRefresh(); 
+                                                                                             return true;
+                                                                                         });
+                                                                                        
+                                                                                        
+                                                                                    },
+                                                                                    renderJS : function(data) {
+                                                                                        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
+                                                                                    
+                                                                                        
+                                                                                        var js = this.get('/LeftTree.model').toJS();
+                                                                                        if (!js || !js.length) {
+                                                                                            print("no data");
+                                                                                            return;
+                                                                                        }
+                                                                                        var  data = js[0];
+                                                                                        
+                                                                                        
+                                                                                         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 || '';
+                                                                                        
+                                                                                         if (project.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" ;
+                                                                                             runhtml +=imports.File.File.read(__script_path__ + '/../builder.html.js') + "\n";
+                                                                                             runhtml += '</script>'+ "\n" ;
+                                                                                            
+                                                                                            this.runhtml = project.runhtml;
+                                                                                            // need to modify paths
+                                                                                            
+                                                                                            
+                                                                                            
+                                                                                            var html = imports.File.File.read(__script_path__ + '/../builder.html');
+                                                                                            html = html.replace('</head>', runhtml + this.runhtml + '</head>');
+                                                                                            print("LOAD HTML " + html);
+                                                                                            this.el.load_html_string( html , 
+                                                                                                //fixme - should be a config option!
+                                                                                                'http://localhost/app.Builder/'
+                                                                                            );
+                                                                                            
+                                                                                            // should trigger load_finished! - which in truns shoudl set refresh Required;
+                                                                                            return;
+                                                                                        
+                                                                                        }
+                                                                                        
+                                                                                        
+                                                                                        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(data) + ");");
+                                                                                         print( "before render" +    this.lastRedraw);
+                                                                                        print( "after render" +    (new Date()));
+                                                                                        
                                                                                     }
                                                                                 }
                                                                             ]
@@ -2993,19 +3074,21 @@ Window=new XObject({
                                                                           this.highlightWidget = false;
                                                                        
                                                                         this.withDebug = false;
-                                                                        
-                                                                        if (this.renderedEl) {
-                                                                            this.get('view').el.remove(this.renderedEl);
-                                                                            this.renderedEl.destroy();
-                                                                            this.renderedEl = 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; 
+                                                                         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);
+                                                                      
+                                                                            this.renderedEl = this.viewAdd(tree.items[0], this.get('view').el);
+                                                                          
                                                                       } catch (e) {
                                                                          print(e.message);
                                                                         return;
@@ -3013,11 +3096,12 @@ Window=new XObject({
                                                                         this.get('view').el.set_size_request(
                                                                             tree.default_width * 1 || 400, tree.default_height * 1 || 400
                                                                         ) ;
-                                                                        
-                                                                        this.renderedEl.set_size_request(
-                                                                            tree.default_width || 600,
-                                                                            tree.default_height || 400
-                                                                        );
+                                                                        if (this.renderedEl) {
+                                                                            this.renderedEl.set_size_request(
+                                                                                tree.default_width || 600,
+                                                                                tree.default_height || 400
+                                                                            );
+                                                                        }
                                                                         this.get('view').el.show_all();
                                                                         
                                                                         
@@ -3085,6 +3169,10 @@ Window=new XObject({
                                                                         }
                                                                         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']];
                                                                         var ctr_args = { };
@@ -3518,8 +3606,8 @@ Window=new XObject({
                                                         },
                                                         {
                                                             xtype: Gtk.ScrolledWindow,
-                                                            pack : "add",
                                                             id : "Help",
+                                                            pack : "add",
                                                             show : function() {
                                                                 
                                                                 var file = this.get('/LeftTree').getActiveFile();
@@ -3531,7 +3619,7 @@ Window=new XObject({
                                                                 if (!xtype || !xtype.length) {
                                                                     return;
                                                                 }
-                                                                this.get('/Window.view-help-nb').el.set_current_page(1);
+                                                                //this.get('/Window.view-help-nb').el.set_current_page(1);
                                                                 
                                                                 // get the active element being edited.
                                                                 var helpurl = file.getHelpUrl(xtype);       
@@ -3560,13 +3648,14 @@ Window=new XObject({
                                         },
                                         {
                                             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[1].el, new Gtk.Label({ label : "Console" }));
+                                                       this.el.set_tab_label(this.items[2].el, new Gtk.Label({ label : "Inspector" }));
                                             },
-                                            id : "BottomPane",
                                             items : [
                                                 {
                                                     xtype: Gtk.ScrolledWindow,
@@ -3620,7 +3709,6 @@ Window=new XObject({
                                                             items : [
                                                                 {
                                                                     xtype: GtkSource.Buffer,
-                                                                    pack : "set_buffer",
                                                                     listeners : {
                                                                         changed : function (self) {
                                                                             var s = new Gtk.TextIter();
@@ -3634,9 +3722,9 @@ Window=new XObject({
                                                                                 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);
-                                                                                console.dump(e);
+                                                                                //print("SYNTAX ERROR IN EDITOR");   
+                                                                                //print(e);
+                                                                                //console.dump(e);
                                                                                 return;
                                                                             }
                                                                             this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
@@ -3645,7 +3733,8 @@ Window=new XObject({
                                                                             
                                                                              this.get('/LeftPanel.model').changed(  str , false);
                                                                         }
-                                                                    }
+                                                                    },
+                                                                    pack : "set_buffer"
                                                                 }
                                                             ]
                                                         }
@@ -3675,6 +3764,17 @@ Window=new XObject({
                                                             scrollback_lines : 1000
                                                         }
                                                     ]
+                                                },
+                                                {
+                                                    xtype: Gtk.ScrolledWindow,
+                                                    pack : "add",
+                                                    items : [
+                                                        {
+                                                            xtype: WebKit.WebView,
+                                                            id : "inspector",
+                                                            pack : "add"
+                                                        }
+                                                    ]
                                                 }
                                             ]
                                         }