Sample/Window.bjs
[app.Builder.js] / Sample / Window.js
index c754013..5a90887 100644 (file)
@@ -480,7 +480,7 @@ Window=new XObject({
                                                                                 var res = {}; 
                                                                                 this.get('/LeftTree.view').el.get_path_at_pos(ev.button.x,ev.button.y, res);
                                                                                 
-                                                                                if (!this.get('/LeftTreeMenu').el)  this.get('/LeftTreeMenu').init();
+                                                                                if (!this.get('/LeftTreeMenu').el)  { this.get('/LeftTreeMenu').init(); }
                                                                                 
                                                                                 this.get('/LeftTreeMenu').el.set_screen(Gdk.Screen.get_default());
                                                                                 this.get('/LeftTreeMenu').el.show_all();
@@ -1972,6 +1972,16 @@ Window=new XObject({
                                                                         
                                                                      //   this.activePath = false;
                                                                        // stop editing!!!!
+                                                                        if (this.get('/Editor').dirty) {
+                                                                            //if (!this.get('/Editor.buffer').checkSyntax()) {
+                                                                            //   this.get('/StandardErrorDialog').show("Fix errors in code and save.."); 
+                                                                            //   return true;
+                                                                            //    // error Dialog
+                                                                            //}
+                                                                            if (!this.get('/Editor.view').save()) {
+                                                                                return true;
+                                                                            }
+                                                                        }   
                                                                         this.get('/LeftPanel').editableColumn.items[0].el.stop_editing();
                                                                         this.get('/LeftPanel').editing = false;
                                                                     
@@ -2187,8 +2197,15 @@ Window=new XObject({
                                                                                                 ]);
                                                                     },
                                                                     load : function(ar) {
+                                                                    // might casue problesm..
+                                                                        // this.get('/Editor.RightEditor').save();
+                                                                    
+                                                                           this.get('/Editor').el.hide();
+                                                                         this.get('/Editor').activePath = false;
+                                                                    
+                                                                    
                                                                       this.el.clear();
-                                                                                            
+                                                                                  
                                                                         //this.get('/RightEditor').el.hide();
                                                                         if (ar === false) {
                                                                             return ;
@@ -2241,7 +2258,8 @@ Window=new XObject({
                                                                         return ret;
                                                                     },
                                                                     startEditing : function(path,col) {
-                                                                    // alled by menu 'edit' currently..
+                                                                        
+                                                                        // alled by menu 'edit' currently..
                                                                         /**
                                                                         * start editing path (or selected if not set..)
                                                                         * @param {String|false} path  (optional) treepath to edit - selected tree gets
@@ -2278,7 +2296,9 @@ Window=new XObject({
                                                                         // make sure the pulldown is set correctly..
                                                                         // not really needed for second col...
                                                                         var showEditor = false;
-                                                                        
+                                                                        this.get('/Editor').activePath = false;
+                                                                        this.get('/Editor').el.hide();
+                                                                         
                                                                         if (col) {
                                                                             var provider = this.get('/LeftTree').getPaleteProvider();
                                                                             var type = this.get('/LeftPanel.model').getType(path);
@@ -2308,23 +2328,25 @@ Window=new XObject({
                                                                         }
                                                                         var _this = this;    
                                                                         // end editing..
-                                                                        this.get('/BottomPane').el.hide();
+                                                                       // this.get('/BottomPane').el.hide();
                                                                         //this.get('/RightEditor').el.hide();
-                                                                         this.get('/Editor').el.hide();
+                                                                         
                                                                         
                                                                         if (showEditor) {
                                                                     
                                                                             this.activePath = false;
+                                                                            
+                                                                            _this.get('/Editor').el.show_all();
                                                                             GLib.timeout_add(0, 1, function() {
                                                                     
                                                                                 //_this.get('/BottomPane').el.show();
                                                                                  //_this.get('/RightEditor').el.show();
+                                                                                
                                                                                 _this.get('/Editor.RightEditor.view').load( _this.getValue(path, 1) );
                                                                                 
-                                                                                //e.editing_done();
-                                                                                //e.remove_widget();
+                                                                                _this.get('/Editor').activePath = path;
                                                                                 _this.activePath = path ;
-                                                                                 this.get('/Editor').el.show_all();
+                                                                              
                                                                                 return false;
                                                                             });
                                                                             return;
@@ -2460,9 +2482,9 @@ Window=new XObject({
                                                                                    
                                                                                 }
                                                                             },
+                                                                            editable : false,
                                                                             pack : "pack_start",
                                                                             text_column : 0,
-                                                                            editable : true,
                                                                             has_entry : true,
                                                                             init : function() {
                                                                                 XObject.prototype.init.call(this);
@@ -2825,11 +2847,26 @@ Window=new XObject({
                                                                                         console_message : function (self, object, p0, p1) {
                                                                                             print(object);
                                                                                            //  console.log(object);
+                                                                                           
+                                                                                        
+                                                                                            if (object.match(/variable/) && object.match(/Builder/)) {
+                                                                                                print("got builder missing message");
+                                                                                                this.refreshRequired = true;
+                                                                                                this.lastRedraw = 0;
+                                                                                                this.runRefresh();
+                                                                                                return true;
+                                                                                            }
+                                                                                            
+                                                                                           
                                                                                                 if (!object.match(/^\{/)) {
                                                                                                 
                                                                                                     //this.get('/Terminal').feed(object);
                                                                                                     return true; // do not handle!!! -> later maybe in console..
                                                                                                 }
+                                                                                                
+                                                                                                
+                                                                                                
+                                                                                                
                                                                                                // console.log(object);
                                                                                                 var val =  JSON.parse(object);
                                                                                         
@@ -2966,9 +3003,9 @@ Window=new XObject({
                                                                                            return null; //new WebKit.WebView();
                                                                                         }
                                                                                     },
-                                                                                    redraws : 0,
                                                                                     id : "view",
                                                                                     pack : "add",
+                                                                                    redraws : 0,
                                                                                     init : function() {
                                                                                         XObject.prototype.init.call(this);
                                                                                         // this may not work!?