Sample/Editor.js
[app.Builder.js] / Sample / Editor.js
index 7846007..d37ff26 100644 (file)
@@ -14,7 +14,7 @@ Editor=new XObject({
     xtype: Gtk.Window,
     listeners : {
         destroy_event : function (self, event) {
-            if (!this.get('/Editor.buffer').checkSyntax) {
+            if (!this.get('/Editor.RightEditor').save()) {
                 // no hiding with errors.
                 return true;
             }
@@ -22,7 +22,11 @@ Editor=new XObject({
             return true;
         },
         delete_event : function (self, event) {
-              this.el.hide();
+            if (!this.get('/Editor.RightEditor').save()) {
+                // no hiding with errors.
+                return true;
+            }
+            this.el.hide();
             return true;
         },
         configure_event : function (self, object) {
@@ -171,11 +175,7 @@ Editor=new XObject({
                                           //  print('var res = ' + str);
                                             Seed.check_syntax('var res = ' + str);
                                             
-                                            this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
-                                                red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF
-                                               }));
-                                            
-                                            return true;
+                                           
                                         } catch (e) {
                                             
                                             this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
@@ -187,6 +187,11 @@ Editor=new XObject({
                                             //console.dump(e);
                                             return false;
                                         }
+                                         this.get('/RightEditor.view').el.modify_base(Gtk.StateType.NORMAL, new Gdk.Color({
+                                            red: 0xFFFF, green: 0xFFFF , blue : 0xFFFF
+                                           }));
+                                        
+                                        return true;
                                     },
                                     toString : function() {