started adding key bindings for systems w/o function keys...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2013-11-09 15:03:49 +04:00
parent 7c8459c68f
commit 94093098ec
2 changed files with 38 additions and 3 deletions

View File

@ -370,6 +370,7 @@ Array.prototype.linSearch = function(target, cmp, get){
// NOTE: this will return the object by default, to return position set
// return_position to true.
// NOTE: by default this will use cmp as a predicate.
// NOTE: this expects lst to be sorted in a check-compatible way...
function binSearch(target, lst, check, return_position, get){
check = check == null ? lcmp : check
var h = 0
@ -471,6 +472,11 @@ function getGIDRibbonIndex(gid, data){
// Same as getImageBefore(...), but uses gids and searches in DATA...
//
// Return:
// null - no image is before gid
// gid - the image before
//
// NOTE: if gid is present in the searched ribbon this will return it.
// NOTE: this uses it's own predicate...
function getGIDBefore(gid, ribbon, search, data){
gid = gid == null ? getImageGID() : gid
@ -1679,7 +1685,9 @@ function readImagesDatesQ(images){
}
// XXX after running this we need to re-save the images...
// XXX deleting images is not sported, we need to explicitly re-save...
// XXX need to reload the viewer...
// XXX not tested...
function updateImageGID(gid, images, data){
images = images == null ? IMAGES : images
var img = images[gid]
@ -1689,6 +1697,7 @@ function updateImageGID(gid, images, data){
// images...
images[gid] = images[key]
delete images[key]
IMAGES_UPDATED.push(gid)
// data...
if(data != null){

View File

@ -53,8 +53,29 @@ var KEYBOARD_CONFIG = {
return false
}),
},
F5: doc('Reload viewer', function(){ reload() }),
F12: doc('Show devTools', function(){ showDevTools() }),
F5: doc('Reload viewer',
function(){
reload()
return false
}),
F12: doc('Show devTools',
function(){
showDevTools()
return false
}),
// NOTE: these are for systems where F** keys are not available
// or do other stuff...
R: {
'ctrl': doc('Reload viewer',
function(){
reloadViewer()
return false
}),
'ctrl+shift': 'F5',
},
P: {
'ctrl+shift': 'F12',
},
},
// info overlay...
@ -303,6 +324,7 @@ var KEYBOARD_CONFIG = {
'#9': doc('Fit nine images', function(){ fitNImages(9) }),
// cropping...
// XXX add a non FXX key for macs...
F2: {
shift: doc('Crop marked only images',
function(){
@ -313,6 +335,7 @@ var KEYBOARD_CONFIG = {
}),
},
// XXX add a non FXX key for macs...
F3: doc('Crop single ribbon',
function(){
event.preventDefault()
@ -630,6 +653,7 @@ var KEYBOARD_CONFIG = {
},
// XXX add a non FXX key for macs...
F2: doc('Toggle mark visibility',
function(){ toggleMarkesView() }),
// XXX should we be able to toggle crop modes from single image mode???
@ -689,11 +713,13 @@ var KEYBOARD_CONFIG = {
// NOTE: this is handled by the wrapper at this point, so we do
// not have to do anything here...
F11: doc('Toggle full screen view', function(){ toggleFullscreenMode() }),
F: 'F11',
// Help and info...
'?': doc('Show keyboard bindings',
function(){ toggleKeyboardHelp() }),
// XXX add a non FXX key for macs...
F1: doc('Show help',
function(){ toggleHelp() }),