explicitly bind key events to prevent defaults

This commit is contained in:
j 2014-09-25 13:32:04 +02:00
parent b5bc56d075
commit b309f9d33f
2 changed files with 33 additions and 16 deletions

View File

@ -704,6 +704,11 @@ oml.ui.infoView = function(identifyData) {
} }
} }
}); });
that.bindEvent({
mousedown: function() {
that.gainFocus();
}
})
return that; return that;

View File

@ -501,15 +501,16 @@ oml.ui.mainMenu = function() {
that[data.value ? 'enableItem' : 'disableItem']('showinfo'); that[data.value ? 'enableItem' : 'disableItem']('showinfo');
}, },
}); });
Ox.Event.bind('key', function(data, event, element) { Ox.Event.bind({
var key = event.replace(/^key\./, ''); key_backtick: function() {
if (key == 'backtick') {
changeFocus(1); changeFocus(1);
} else if (key == 'control_comma') { },
key_control_comma: function() {
if (!oml.hasDialogOrScreen()) { if (!oml.hasDialogOrScreen()) {
oml.UI.set({page: 'preferences'}); oml.UI.set({page: 'preferences'});
} }
} else if (key == 'control_f') { },
key_control_f: function() {
if (!oml.hasDialogOrScreen()) { if (!oml.hasDialogOrScreen()) {
if (ui._findState.key != 'advanced') { if (ui._findState.key != 'advanced') {
setTimeout(function() { setTimeout(function() {
@ -519,38 +520,49 @@ oml.ui.mainMenu = function() {
oml.$ui.filterDialog = oml.ui.filterDialog().open(); oml.$ui.filterDialog = oml.ui.filterDialog().open();
} }
} }
} else if (key == 'control_m') { },
key_control_m: function() {
if (!oml.hasDialogOrScreen() && !that.isSelected()) { if (!oml.hasDialogOrScreen() && !that.isSelected()) {
that.options('menus')[0].element.trigger('click'); that.options('menus')[0].element.trigger('click');
} }
} else if (key == 'control_shift_f') { },
key_control_shift_f: function() {
Ox.print('FIXME: NOT IMPLEMENTED') Ox.print('FIXME: NOT IMPLEMENTED')
} else if (key == 'control_shift_w') { },
key_control_shift_w: function() {
if (!oml.hasDialogOrScreen()) { if (!oml.hasDialogOrScreen()) {
oml.UI.set({ oml.UI.set({
find: oml.config.user.ui.find, find: oml.config.user.ui.find,
item: '' item: ''
}); });
} }
} else if (key == 'control_shift_z') { },
key_control_shift_z: function() {
oml.redoHistory(); oml.redoHistory();
} else if (key == 'control_slash') { },
key_control_slash: function() {
if (!oml.hasDialogOrScreen()) { if (!oml.hasDialogOrScreen()) {
oml.UI.set({page: 'help'}); oml.UI.set({page: 'help'});
} }
} else if (key == 'control_w') { },
key_control_w: function() {
if (!oml.hasDialogOrScreen()) { if (!oml.hasDialogOrScreen()) {
oml.UI.set({item: ''}); oml.UI.set({item: ''});
} }
} else if (key == 'control_z') { },
key_control_z: function() {
oml.undoHistory(); oml.undoHistory();
} else if (key == 'shift_b') { },
key_shift_b: function() {
ui.item && oml.UI.set({showBrowser: !ui.showBrowser}); ui.item && oml.UI.set({showBrowser: !ui.showBrowser});
} else if (key == 'shift_f') { },
key_shift_f: function() {
!ui.item && oml.UI.set({showFilters: !ui.showFilters}); !ui.item && oml.UI.set({showFilters: !ui.showFilters});
} else if (key == 'shift_i') { },
key_shift_i: function() {
ui.showSidebar && oml.UI.set({showInfo: !ui.showInfo}); ui.showSidebar && oml.UI.set({showInfo: !ui.showInfo});
} else if (key == 'shift_s') { },
key_shift_s: function() {
oml.UI.set({showSidebar: !ui.showSidebar}); oml.UI.set({showSidebar: !ui.showSidebar});
} }
}); });