items : [
{
xtype: Gtk.Button,
+ listeners : {
+ clicked : function (self) {
+ this.get('/Editor.RightEditor').save();
+ }
+ },
+ id : "save_button",
label : "Save"
}
]
id : "RightEditor",
pack : "add",
save : function() {
+ var str = this.get('/Editor.buffer').toString();
this.get('/LeftPanel.model').changed( str , false);
this.get('/Editor').dirty = false;
+ this.get('/Editor.save_button').el.sensitive = false;
},
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;
}
},
buf.move_mark(cursor, iter);
this.get('/Editor').dirty = false;
this.el.grab_focus();
+ this.get('/Editor.save_button').el.sensitive = false;
},
save : function() {
- var str = this.get('buffer').toString();
- print("SAVE" + str);
- this.get('/LeftPanel.model').changed( str , false);
+
+ this.get('/Editor.RightEditor').save();
},
show_line_numbers : true,
items : [
listeners : {
changed : function (self) {
- this.checkSyntax();
+ if(this.checkSyntax()) {
+ this.get('/Editor.save_button').el.sensitive = true;
+ }
// print("EDITOR CHANGED");
this.get('/Editor').dirty = true;
+
// this.get('/LeftPanel.model').changed( str , false);
return false;
}