From 40349ac968ed70798900108c0d62efeeba6ec20e Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 16 Nov 2013 01:54:50 +0400 Subject: [PATCH] added "this and above" crop mode and a crop dialog... Signed-off-by: Alex A. Naanou --- ui/keybindings.js | 2 ++ ui/ui.js | 46 ++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 48 insertions(+) diff --git a/ui/keybindings.js b/ui/keybindings.js index 260e3175..31a67564 100755 --- a/ui/keybindings.js +++ b/ui/keybindings.js @@ -689,6 +689,8 @@ var KEYBOARD_CONFIG = { // XXX make F4 a default editor and E a default viewer... F4: 'E', + C: doc('Show crop dialog', cropImagesDialog), + // info... I: { default: doc('Show current image info', diff --git a/ui/ui.js b/ui/ui.js index 1430774e..16c2bf1d 100755 --- a/ui/ui.js +++ b/ui/ui.js @@ -1050,6 +1050,52 @@ function sortImagesDialog(){ } +function cropImagesDialog(){ + + updateStatus('Crop...').show() + + var alg = 'Crop:|'+ + 'Use Esc and Shift-Esc to exit crop modes.'+ + '\n\n'+ + 'NOTE: currently mixing crop modes is not supported,\n'+ + 'thus, if you are in a particular crop mode, you can\n'+ + 'only use that mode to crop again.\n'+ + '...This restriction will be removed later.' + + cfg = {} + cfg[alg] = [ + 'Marked images', + 'Current ribbon', + 'Current ribbon and above' + ] + + formDialog(null, '', + cfg, + 'OK', + 'cropImagesDialog') + .done(function(res){ + res = res[alg] + + if(/Marked/i.test(res)){ + var method = toggleMarkedOnlyView + + } else if(/Current ribbon/i.test(res)){ + var method = toggleSingleRibbonMode + + } else if(/Current ribbon and above/i.test(res)){ + var method = toggleCurrenAndAboveRibbonsMode + } + + showStatusQ('Cropped: '+res+'...') + + method('on') + }) + .fail(function(){ + showStatusQ('Crop: canceled.') + }) +} + + // XXX get EXIF, IPTC... function showImageInfo(){ var gid = getImageGID(getImage())