From 27cb832249b0707f4bd9e8c998c1fa71a82e5677 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 30 Nov 2013 22:24:56 +0400 Subject: [PATCH] added ImageGrid-specific editor setup...... Signed-off-by: Alex A. Naanou --- ui/editor.js | 49 +++++++++++++++++++++++++++++++++++++++++++++++ ui/index.html | 1 + ui/keybindings.js | 24 ++--------------------- ui/lib/editor.js | 4 +++- 4 files changed, 55 insertions(+), 23 deletions(-) create mode 100755 ui/editor.js diff --git a/ui/editor.js b/ui/editor.js new file mode 100755 index 00000000..95b30019 --- /dev/null +++ b/ui/editor.js @@ -0,0 +1,49 @@ +/********************************************************************** +* +* +* +**********************************************************************/ + +//var DEBUG = DEBUG != null ? DEBUG : true + + +/*********************************************************************/ + +// ImageGrid-specific editor setup... +function setupEditor(){ + // build the editor... + if($('.panel').length == 0){ + $('.viewer') + .append(makeEditorControls('.current.image') + .addClass('noScroll')) + + // setup the event to update the editor... + .on('focusingImage', function(){ + if($('.panel').css('display') != 'none'){ + reloadControls('.current.image') + } + }) + + reloadControls('.current.image') + + // toggle the editor... + // XXX do we need a real mode for this? + } else { + var ed = $('.panel') + + // show... + if(ed.css('display') == 'none'){ + reloadControls('.current.image') + ed.show() + + // hide... + } else { + ed.hide() + } + } +} + + + +/********************************************************************** +* vim:set ts=4 sw=4 : */ diff --git a/ui/index.html b/ui/index.html index 76a13d3d..826900d3 100755 --- a/ui/index.html +++ b/ui/index.html @@ -37,6 +37,7 @@ + diff --git a/ui/keybindings.js b/ui/keybindings.js index 6c81c1c7..ec2a55d9 100755 --- a/ui/keybindings.js +++ b/ui/keybindings.js @@ -702,28 +702,8 @@ var KEYBOARD_CONFIG = { E: { default: doc('Open image in external software', openImage), - ctrl: doc('Open preview editor panel (Experimental)', - function(){ - if($('.panel').length == 0){ - $('.viewer') - .append(makeControls('.current.image') - .addClass('noScroll')) - .on('focusingImage', function(){ - if($('.panel').css('display') != 'none'){ - reloadControls('.current.image') - } - }) - reloadControls('.current.image') - } else { - var ed = $('.panel') - if(ed.css('display') == 'none'){ - reloadControls('.current.image') - ed.show() - } else { - ed.hide() - } - } - }), + // XXX Experimental + ctrl: doc('Open preview editor panel (Experimental)', setupEditor), }, // XXX make F4 a default editor and E a default viewer... F4: 'E', diff --git a/ui/lib/editor.js b/ui/lib/editor.js index ba1db64c..9204a573 100755 --- a/ui/lib/editor.js +++ b/ui/lib/editor.js @@ -4,6 +4,7 @@ **********************************************************************/ var DEFAULT_FILTER_ORDER = [ +// 'gamma', 'brightness', 'contrast', 'saturate', @@ -235,7 +236,7 @@ function makeLogRange(text, filter, target){ } -function makeControls(target){ +function makeEditorControls(target){ // tool panel... var panel = $('
') .addClass('panel') @@ -274,6 +275,7 @@ function makeControls(target){ .append($('Filters')) .append($('
') .append($('
') + //.append(makeLogRange('Gamma:', 'gamma', target)) .append(makeLogRange('Brightness:', 'brightness', target)) .append(makeLogRange('Contrast:', 'contrast', target)) .append(makeLogRange('Saturation:', 'saturate', target))