minor changes to lib/keyboard.js and keybindings...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-10-04 01:02:35 +04:00
parent 546f379877
commit 74ea7f5344
2 changed files with 31 additions and 16 deletions

View File

@ -40,6 +40,21 @@ function directionImage(reverse){
/*********************************************************************/ /*********************************************************************/
var KEYBOARD_CONFIG = { var KEYBOARD_CONFIG = {
// Global bindings...
'*': {
title: 'Global bindings',
F4: {
alt: doc('Close viewer',
function(){
closeWindow()
return false
}),
},
F5: doc('Reload viewer', function(){ reload() }),
F12: doc('Show devTools', function(){ showDevTools() }),
},
// info overlay... // info overlay...
// //
// NOTE: this is here to prevent selecting images while trying to // NOTE: this is here to prevent selecting images while trying to
@ -69,6 +84,7 @@ var KEYBOARD_CONFIG = {
} }
}, },
// dialogs... // dialogs...
// //
'.viewer.overlay .overlay-block.dialog': { '.viewer.overlay .overlay-block.dialog': {
@ -109,7 +125,6 @@ var KEYBOARD_CONFIG = {
}, },
// help mode... // help mode...
// //
// NOTE: need to keep all info modes before the rest so as to give // NOTE: need to keep all info modes before the rest so as to give
@ -301,8 +316,8 @@ var KEYBOARD_CONFIG = {
// general setup... // general setup...
// //
'.viewer:not(.overlay)': { '.viewer:not(.overlay)': {
title: 'Global', title: 'Viewer',
doc: 'These key bindings work in most other modes.'+ doc: 'These key bindings work in most other viewer modes.'+
'<p>NOTE: shifting all marked images from different ribbons will '+ '<p>NOTE: shifting all marked images from different ribbons will '+
'perform the operations on ALL marked images but relative '+ 'perform the operations on ALL marked images but relative '+
@ -632,11 +647,7 @@ var KEYBOARD_CONFIG = {
E: doc('Open image in external software', openImage), E: doc('Open image in external software', openImage),
// XXX make F4 a default editor and E a default viewer... // XXX make F4 a default editor and E a default viewer...
F4: { F4: 'E',
default: 'E',
alt: doc('Close viewer', function(){ closeWindow() }),
},
// info... // info...
I: { I: {
@ -681,8 +692,8 @@ var KEYBOARD_CONFIG = {
// XXX DEBUG MODE... // XXX DEBUG MODE...
// ...remove these in production... // ...remove these in production...
F12: doc('Show devTools', function(){ showDevTools() }), //F12: doc('Show devTools', function(){ showDevTools() }),
F5: doc('Reload app', function(){ reload() }), //F5: doc('Reload app', function(){ reload() }),
/* testing the shift-key feature... /* testing the shift-key feature...
'~': { '~': {

View File

@ -186,12 +186,16 @@ function getKeyHandlers(key, modifiers, keybindings, modes, shifted_keys){
for(var mode in keybindings){ for(var mode in keybindings){
// test for mode compatibility... // check if we need to skip this mode...
// XXX this fails for explicitly given mode... if( !(modes == 'all'
if(modes != 'all' // explicit mode match...
&& (modes != 'any' || modes == mode
&& modes != mode // 'any' means we need to check the mode...
|| $(mode).length == 0)){ || (modes == 'any'
// '*' allways matches...
&& mode == '*'
// match the mode...
|| $(mode).length != 0))){
continue continue
} }