]
},
{
+ "# bool is_control" : false,
"$ xns" : "Gtk",
+ "id" : "keystate",
"listeners" : {
+ "key_pressed" : [
+ "(keyval, keycode, state) => {",
+ "",
+ " \tif (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
+ " \t\tthis.is_control = true;",
+ "\t}",
+ "\treturn false;",
+ "}",
+ ""
+ ],
"key_released" : [
"(keyval, keycode, state) => {",
"",
- " ",
+ " \t if (keyval == Gdk.Key.Control_L || keyval == Gdk.Key.Control_R) {",
+ " \t\tthis.is_control = false;",
+ "\t}",
" if (keyval == Gdk.Key.s && (state & Gdk.ModifierType.CONTROL_MASK ) > 0 ) {",
" GLib.debug(\"SAVE: ctrl-S pressed\");",
" _this.saveContents();",
]
},
"xtype" : "EventControllerKey"
+ },
+ {
+ "# double distance" : "0.0f",
+ "$ xns" : "Gtk",
+ "Gtk.EventControllerScrollFlags flags" : "Gtk.EventControllerScrollFlags.VERTICAL",
+ "listeners" : {
+ "scroll" : [
+ "(dx, dy) => {",
+ "\tif (!_this.keystate.is_control) {",
+ "\t\treturn false;",
+ "\t}",
+ "\t//GLib.debug(\"scroll %f\", dy);",
+ "\t",
+ "\tthis.distance += dy;",
+ "\tif (this.distance < 1) {",
+ "\t\tBuilderApplication.settings.editor_font_size ++;",
+ "\t\tthis.distance = 0;",
+ "\t}",
+ "\tif (this.distance > -1) {",
+ "\t\tBuilderApplication.settings.editor_font_size --;",
+ "\t\tthis.distance = 0;",
+ "\t}",
+ "",
+ "\treturn true;",
+ "}",
+ ""
+ ]
+ },
+ "xtype" : "EventControllerScroll"
}
],
"listeners" : {