diff --git a/ui (gen4)/features/core.js b/ui (gen4)/features/core.js index 7cb24d06..09834974 100755 --- a/ui (gen4)/features/core.js +++ b/ui (gen4)/features/core.js @@ -362,6 +362,7 @@ module.makeWorkspaceConfigWriter = function(keys, callback){ // XXX should this delete a prop if it's not in the loading workspace??? // XXX only replace a prop if it has changed??? +// XXX handle defaults -- when a workspace was just created... var makeWorkspaceConfigLoader = module.makeWorkspaceConfigLoader = function(keys, callback){ return function(workspace){ @@ -390,6 +391,7 @@ module.makeWorkspaceConfigLoader = function(keys, callback){ // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +// XXX need a way to handle defaults... var WorkspaceActions = actions.Actions({ config: { 'load-workspace': 'default', diff --git a/ui (gen4)/features/ui-single-image.js b/ui (gen4)/features/ui-single-image.js index 97b30ea4..6930b5d5 100755 --- a/ui (gen4)/features/ui-single-image.js +++ b/ui (gen4)/features/ui-single-image.js @@ -104,10 +104,13 @@ 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', + // Config defaults to set on first init of single image mode... + // + // NOTE: the keys set here will be handled by the 'single-image' + // workspace... + 'single-image-config-defaults': { + 'ribbon-focus-mode': 'order', + }, }, updateImageProportions: ['- Interface/', @@ -243,6 +246,14 @@ var SingleImageActions = actions.Actions({ if(this.workspaces['single-image'] == null){ this.loadWorkspace('ui-chrome-hidden') + + // setup defaults... + var that = this + var defaults = this.config['single-image-config-defaults'] || {} + Object.keys(defaults) + .forEach(function(key){ + that.config[key] = JSON.parse(JSON.stringify(defaults[key])) }) + this.saveWorkspace('single-image') } @@ -424,20 +435,17 @@ module.SingleImageView = core.ImageGridFeatures.Feature({ // Workspace... // ...set ribbon focus mode to order (default) in single image mode... ['saveWorkspace', - core.makeWorkspaceConfigWriter(['ribbon-focus-mode'])], + core.makeWorkspaceConfigWriter( + Object.keys(SingleImageActions.config['single-image-config-defaults']))], ['loadWorkspace', core.makeWorkspaceConfigLoader( - ['ribbon-focus-mode'], + Object.keys(SingleImageActions.config['single-image-config-defaults']), + // NOTE: considering that 'ribbon-focus-mode' is handled + // by a toggler that can have things bound to it, + // active is the way to go here... 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']) - } + 'ribbon-focus-mode' in workspace + && this.toggleRibbonFocusMode(workspace['ribbon-focus-mode']) })], ], })