xtype: Gtk.Window,
listeners : {
destroy_event : function (self, event) {
+ if (!this.get('/Editor.RightEditor').save()) {
+ // no hiding with errors.
+ return true;
+ }
+ this.get('/Editor').activePath = false;
this.el.hide();
return true;
},
delete_event : function (self, event) {
- this.el.hide();
+ if (!this.get('/Editor.RightEditor').save()) {
+ // no hiding with errors.
+ return true;
+ }
+ this.el.hide();
+ this.get('/Editor').activePath = false;
return true;
},
configure_event : function (self, object) {
xtype: Gtk.Button,
listeners : {
clicked : function (self) {
+
this.get('/Editor.RightEditor').save();
}
},
id : "RightEditor",
pack : "add",
save : function() {
- var str = this.get('/Editor.buffer').toString();
+ // make sure we have an active path..
+ if (!this.get('/Editor').activePath) {
+ return true;
+ }
+
+ var str = this.get('/Editor.buffer').toString();
+ if (!this.get('/Editor.buffer').checkSyntax()) {
+ this.get('/StandardErrorDialog').show("Fix errors in code and save..");
+ return false;
+ }
+
this.get('/LeftPanel.model').changed( str , false);
this.get('/Editor').dirty = false;
this.get('/Editor.save_button').el.sensitive = false;
+ return true;
},
items : [
{
listeners : {
key_release_event : function (self, event) {
- if (event.key.keyval == 115 && (Gdk.ModifierType.CONTROL_MASK & 4) ) {
+ if (event.key.keyval == 115 && (event.key.state & Gdk.ModifierType.CONTROL_MASK ) ) {
print("SAVE: ctrl-S pressed");
this.save();
return false;
},
save : function() {
- this.get('/Editor.RightEditor').save();
+ return this.get('/Editor.RightEditor').save();
},
show_line_numbers : true,
items : [
// 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({
//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() {