xtype: Gtk.Window,
listeners : {
destroy_event : function (self, event) {
+ if (!this.get('/Editor.buffer').checkSyntax) {
+ // no hiding with errors.
+ return true;
+ }
this.el.hide();
return true;
},
{
xtype: Gtk.Button,
listeners : {
- activate : function (self) {
+ clicked : function (self) {
+
this.get('/Editor.RightEditor').save();
}
},
id : "RightEditor",
pack : "add",
save : function() {
- var str = this.get('/LeftPanel.buffer').toString();
+ 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 : [
{
xtype: GtkSource.View,
listeners : {
key_release_event : function (self, event) {
- if (event.key.keyval != 115 || !(Gdk.ModifierType.CONTROL_MASK & 4) ) {
- return;
+
+ if (event.key.keyval == 115 && (event.key.state & Gdk.ModifierType.CONTROL_MASK ) ) {
+ print("SAVE: ctrl-S pressed");
+ this.save();
+ return false;
}
- print(event.key.keyval)
- this.save();
+ // print(event.key.keyval)
+
return false;
}
},
},
save : function() {
- this.get('/Editor.RightEditor').save();
+ return this.get('/Editor.RightEditor').save();
},
show_line_numbers : true,
items : [