diff --git a/ui/data.js b/ui/data.js index 00e6fb4f..276c4cd1 100755 --- a/ui/data.js +++ b/ui/data.js @@ -124,13 +124,14 @@ var CONFIG = { zoom_step_scale: 1.2, // ribbon scaling limits and defaults (pixels)... + // XXX need to make these depend on dpi... // ~10 images per screen @ 1024x768 min_image_size: 100, // ~4 images per screen @ 1024x768 default_image_size: 250, - single_image_scale_2: 1.125, - single_image_scale_3: 3, + single_image_view_scale_2: 1.125, + single_image_view_scale_3: 3, // localStorage prefix... data_attr: 'DATA', diff --git a/ui/keybindings.js b/ui/keybindings.js index 03a46c0e..c6a88fd3 100755 --- a/ui/keybindings.js +++ b/ui/keybindings.js @@ -9,6 +9,7 @@ var _STEPS_LEFT_TO_CHANGE_DIRECTION = CONFIG.steps_to_change_direction var DIRECTION = 'next' +var ACTIONS = {} /*********************************************************************/ @@ -35,6 +36,19 @@ function directionImage(reverse){ } +// XXX this is experimental... +// ...not sure yet how to go about this... +function Action(text, func){ + func = func == null ? function(){return true}: func + func.doc = text + + ACTIONS[text.split('\n')[0].trim()] = func + + return func +} + +doc = Action + /*********************************************************************/ @@ -87,8 +101,6 @@ var KEYBOARD_CONFIG = { }, - // info overlay... - // // NOTE: this is here to prevent selecting images while trying to // select info text... 'Info overlay': { @@ -117,8 +129,6 @@ var KEYBOARD_CONFIG = { }, - // dialogs... - // // NOTE: editor effects are not documented, but should be obvious... // XXX is this the case? 'Dialog': { @@ -177,8 +187,6 @@ var KEYBOARD_CONFIG = { }, - // help view... - // // NOTE: need to keep all info modes before the rest so as to give // their bindings priority... 'Drawer views': { @@ -197,8 +205,6 @@ var KEYBOARD_CONFIG = { }, - // slideshow view... - // 'Slideshow view': { doc: 'To enter this view press S.', pattern: '.slideshow-mode', @@ -230,8 +236,6 @@ var KEYBOARD_CONFIG = { }, - // single image view... - // 'Single image view': { doc: 'To toggle between this and ribbon view press Enter.', pattern: '.single-image-mode', @@ -245,8 +249,6 @@ var KEYBOARD_CONFIG = { }, - // crop views... - // 'Cropped ribbon views': { doc: 'To crop marked images press shift-F2 for '+ 'single ribbon crop view press F3 and to open the crop '+ @@ -289,8 +291,7 @@ var KEYBOARD_CONFIG = { */ - // ribbon view only... - // + // NOTE: these bindings apply ONLY to ribbon view... // XXX this breaks getKeyHandlers(...) when modes argument is given... 'Ribbon view': { pattern: '.viewer:not(.overlay):not(.single-image-mode)', @@ -415,7 +416,7 @@ var KEYBOARD_CONFIG = { }, - // general setup... + // general bindings... // 'Viewer': { doc: 'These key bindings work in most other viewer views.'+ @@ -597,21 +598,27 @@ var KEYBOARD_CONFIG = { }), }, V: doc('Flip image vertically', - function(){ - var o = getImage().attr('orientation') - // need to rotate relative to user, not relative to image... - if(o == 90 || o == 270){ - flipHorizontal() - } else { - flipVertical() - } - }), + function(){ + var o = getImage().attr('orientation') + // need to rotate relative to user, not relative to image... + if(o == 90 || o == 270){ + flipHorizontal() + } else { + flipVertical() + } + }), // zooming... '#1': doc('Fit image to screen', function(){ fitNImages(1) }), - '#2': doc('Show big image', function(){ fitNImages(CONFIG.single_image_scale_2) }), - '#3': doc('Show small image', function(){ fitNImages(CONFIG.single_image_scale_3) }), + '#2': doc('Show big image', + function(){ + fitNImages(CONFIG.single_image_view_scale_2) + }), + '#3': doc('Show small image', + function(){ + fitNImages(CONFIG.single_image_view_scale_3) + }), '-': doc('Zoom in', function(){ zoomOut() }), '=': doc('Zoom out', function(){ zoomIn() }), diff --git a/ui/ui.js b/ui/ui.js index c83347f8..442df3e5 100755 --- a/ui/ui.js +++ b/ui/ui.js @@ -1104,29 +1104,23 @@ function exportPreviewsDialog(state, dfl){ // keys become unreadable with JS syntax preventing us from // splitting the key into several lines... var cfg = {} + var img_pattern = 'Image name pattern | '+ + '%f - full filename (same as %n%e)\n'+ + '%n - filename\n'+ + '%e - extension (with leading dot)\n'+ + '%(abc)m - if marked insert "abc"\n'+ + '%(abc)b - if bookmarked insert "abc"\n'+ + '%gid - long gid\n'+ + '%g - short gid\n' // multiple images... if(state != 'current image'){ - cfg['Image name pattern | '+ - '%f - full filename\n'+ - '%n - filename\n'+ - '%e - extension (with leading dot)\n'+ - '%(abc)m - if marked insert "abc"\n'+ - '%(abc)b - if bookmarked insert "abc"\n'+ - '%gid - log gid\n'+ - '%g - short gid\n'+ + cfg[img_pattern + '%I - global order\n'+ '%i - current selection order'] = '%f' cfg['Level directory name'] = 'fav' // single image... } else { - cfg['Image name pattern | '+ - '%f - full filename\n'+ - '%n - filename\n'+ - '%e - extension (with leading dot)\n'+ - '%(abc)m - if marked insert "abc"\n'+ - '%(abc)b - if bookmarked insert "abc"\n'+ - '%gid - log gid\n'+ - '%g - short gid\n'+ + cfg[img_pattern + '\n'+ 'NOTE: %i and %I are not supported for single\n'+ 'image exporting.'] = '%f'