diff --git a/ui (gen4)/features/core.js b/ui (gen4)/features/core.js index ca8ac155..7cb24d06 100755 --- a/ui (gen4)/features/core.js +++ b/ui (gen4)/features/core.js @@ -44,20 +44,19 @@ module.makeConfigToggler = function(attr, states, a, b){ var pre = a - var post = b || function(action){ action != null && this.focusImage() } + // XXX is this a good default??? + //var post = b || function(action){ action != null && this.focusImage() } + var post = b return toggler.Toggler(null, function(_, action){ var lst = states.constructor === Array ? states : states.call(this) - //console.log('action', action) - if(action == null){ return this.config[attr] || lst[lst.indexOf('none')] || lst[0] } else { this.config[attr] = action - //this.focusImage() } }, states, pre, post) diff --git a/ui (gen4)/features/ui-single-image.js b/ui (gen4)/features/ui-single-image.js index 1ac79919..97b30ea4 100755 --- a/ui (gen4)/features/ui-single-image.js +++ b/ui (gen4)/features/ui-single-image.js @@ -103,6 +103,11 @@ var SingleImageActions = actions.Actions({ // // NOTE: setting this to null or to -1 will disable the feature... 'single-image-proportions-threshold': 2, + + // Sets ribbon align mode in single image mode... + // + // NOTE: if this is null use the workspace value. + 'single-image-ribbon-focus-mode': 'order', }, updateImageProportions: ['- Interface/', @@ -415,6 +420,25 @@ module.SingleImageView = core.ImageGridFeatures.Feature({ } } }], + + // Workspace... + // ...set ribbon focus mode to order (default) in single image mode... + ['saveWorkspace', + core.makeWorkspaceConfigWriter(['ribbon-focus-mode'])], + ['loadWorkspace', + core.makeWorkspaceConfigLoader( + ['ribbon-focus-mode'], + function(workspace){ + if(this.workspace == 'single-image'){ + var mode = this.config['single-image-ribbon-focus-mode'] + || workspace['ribbon-focus-mode'] + || 'order' + this.toggleRibbonFocusMode(mode) + + } else if('ribbon-focus-mode' in workspace) { + this.toggleRibbonFocusMode(workspace['ribbon-focus-mode']) + } + })], ], }) diff --git a/ui (gen4)/lib/toggler.js b/ui (gen4)/lib/toggler.js index 4ceb6ded..fdfc004c 100755 --- a/ui (gen4)/lib/toggler.js +++ b/ui (gen4)/lib/toggler.js @@ -130,6 +130,8 @@ // later is enough, but as strict mode is not stable enough (sometimes // works and sometimes does not), we can not reliably pass the element // via 'this'. +// XXX add .toString(..) to resulting function to print the source of all +// the handlers... var Toggler = module.Toggler = function(elem, state_accessor, states, callback_a, callback_b){