Sample/Editor.bjs
[app.Builder.js] / Sample / Window.js
index 5cb406e..172a887 100644 (file)
@@ -1136,8 +1136,8 @@ Window=new XObject({
                                                                                         
                                                                                         if (f.items.length && typeof(f.items[0]) == 'string') {
                                                                                         
-                                                                                            this.get('/RightEditor').el.show();
-                                                                                            this.get('/RightEditor.view').load( f.items[0]);
+                                                                                            //this.get('/RightEditor').el.show();
+                                                                                            //this.get('/RightEditor.view').load( f.items[0]);
                                                                                             return;
                                                                                         }
                                                                                         print("LOAD");
@@ -1161,7 +1161,8 @@ Window=new XObject({
                                                                                         
                                                                                         
                                                                                         //print("hide right editior");
-                                                                                        this.get('/RightEditor').el.hide();
+                                                                                        //this.get('/RightEditor').el.hide();
+                                                                                        this.get('/Editor').el.hide();
                                                                                         //print("set current tree");
                                                                                         this.currentTree = this.toJS(false, false)[0];
                                                                                         //console.dump(this.currentTree);
@@ -1971,6 +1972,14 @@ 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
+                                                                            }
+                                                                            this.get('/Editor.view').save();
+                                                                        }   
                                                                         this.get('/LeftPanel').editableColumn.items[0].el.stop_editing();
                                                                         this.get('/LeftPanel').editing = false;
                                                                     
@@ -2188,7 +2197,7 @@ Window=new XObject({
                                                                     load : function(ar) {
                                                                       this.el.clear();
                                                                                             
-                                                                        this.get('/RightEditor').el.hide();
+                                                                        //this.get('/RightEditor').el.hide();
                                                                         if (ar === false) {
                                                                             return ;
                                                                         }
@@ -2240,7 +2249,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
@@ -2314,16 +2324,18 @@ Window=new XObject({
                                                                         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.activePath = path ;
-                                                                                 this.get('/Editor').el.show_all();
+                                                                              
                                                                                 return false;
                                                                             });
                                                                             return;
@@ -2459,9 +2471,9 @@ Window=new XObject({
                                                                                    
                                                                                 }
                                                                             },
+                                                                            editable : false,
                                                                             pack : "pack_start",
                                                                             text_column : 0,
-                                                                            editable : true,
                                                                             has_entry : true,
                                                                             init : function() {
                                                                                 XObject.prototype.init.call(this);
@@ -3720,9 +3732,9 @@ Window=new XObject({
                                             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" }));
+                                               //this.el.set_tab_label(this.items[0].el, new Gtk.Label({ label : "Code Editor" }));
+                                                       this.el.set_tab_label(this.items[0].el, new Gtk.Label({ label : "Console" }));
+                                                       this.el.set_tab_label(this.items[1].el, new Gtk.Label({ label : "Inspector" }));
                                             },
                                             items : [
                                                 {