diff --git a/Viewer/features/filesystem.js b/Viewer/features/filesystem.js index 8d8346ca..edd92bc5 100755 --- a/Viewer/features/filesystem.js +++ b/Viewer/features/filesystem.js @@ -2787,7 +2787,11 @@ var FileSystemWriterUIActions = actions.Actions({ var res = make(['Filename $pattern: ', pattern], { open: widgets.makeNestedConfigListEditor(actions, parent, 'export-preview-name-patterns', - 'export-settings.preview-name-pattern', { + function(value){ + return arguments.length == 0 ? + settings['preview-name-pattern'] + : (settings['preview-name-pattern'] = value) }, + { length_limit: 10, events: { menu: function(_, p){ showExaples(p) }, @@ -2825,7 +2829,11 @@ var FileSystemWriterUIActions = actions.Actions({ .on('open', widgets.makeNestedConfigListEditor(actions, parent, 'export-level-directory-names', - 'export-settings.level-directory-name', { + function(value){ + return arguments.length == 0 ? + settings['level-directory-name'] + : (settings['level-directory-name'] = value) }, + { length_limit: 10, })) }, // XXX should we merge this with 'size_limit'???? @@ -2838,7 +2846,10 @@ var FileSystemWriterUIActions = actions.Actions({ .on('open', widgets.makeNestedConfigListEditor(actions, parent, 'export-preview-sizes', - 'export-settings.preview-size', + function(value){ + return arguments.length == 0 ? + settings['preview-size'] + : (settings['preview-size'] = value) }, { length_limit: 10, sort: function(a, b){ return parseInt(a) - parseInt(b) }, @@ -2859,7 +2870,10 @@ var FileSystemWriterUIActions = actions.Actions({ .on('open', widgets.makeNestedConfigListEditor(actions, parent, 'export-preview-size-limits', - 'export-settings.preview-size-limit', + function(value){ + return arguments.length == 0 ? + settings['preview-size-limit'] + : (settings['preview-size-limit'] = value) }, { length_limit: 10, // sort ascending + keep 'no limit' at top... @@ -2903,7 +2917,6 @@ var FileSystemWriterUIActions = actions.Actions({ function(path){ settings['path'] = path actions.config['export-paths'].splice(0, 0, path) - parent.update() parent.select(txt) }) @@ -2911,7 +2924,10 @@ var FileSystemWriterUIActions = actions.Actions({ // XXX BUG: closing this breaks on parant.focus()... ['history', widgets.makeNestedConfigListEditor(actions, parent, 'export-paths', - 'export-settings.path', + function(value){ + return arguments.length == 0 ? + settings.path + : (settings.path = value) }, { length_limit: 10, new_item: false, @@ -3042,7 +3058,10 @@ var FileSystemWriterUIActions = actions.Actions({ //widgets.makeNestedConfigListEditor(that, o, open: widgets.makeNestedConfigListEditor(that, make.dialog, 'export-dialog-modes', - 'export-settings.mode', + function(value){ + return arguments.length == 0 ? + settings.mode + : (settings.mode = value) }, { length_limit: 10, new_item: false, @@ -3105,12 +3124,6 @@ var FileSystemWriterUIActions = actions.Actions({ 'exportDialog: "images"'], - // XXX BUG: changing values from history (button) changes the default - // and not the current preset... - // ...bug in exportDialog(..) - // XXX ASAP BUG: running a preset from the editor will use the default - // settings and not the loaded preset... - // ...can't reproduce... (revise) // XXX UI: // - element format: // TITLE diff --git a/Viewer/features/ui-widgets.js b/Viewer/features/ui-widgets.js index 9ff4d38b..ffeb119a 100755 --- a/Viewer/features/ui-widgets.js +++ b/Viewer/features/ui-widgets.js @@ -246,66 +246,56 @@ function(actions, path, value_path, options, setup){ var stateValue = function(value){ var path = value_path instanceof Function ? - value_path(value) + value_path(...arguments) : value_path.split('.') - var key = path.pop() + if(value_path instanceof Function + && !(path instanceof Array)){ + return path } + var key = path.pop() var target = actions.config path.forEach(function(p){ - target = target[p] = target[p] || {} - }) + target = target[p] = target[p] || {} }) + // set... if(value){ target[key] = value + // get... } else { - return target[key] - } - } + return target[key] } } var save = function(value){ stateValue(value) - dialog.close() - } + dialog.close() } if(value_path && (options.overflow == null || options.overflow == 'save')){ - options.overflow = save - } + options.overflow = save } // set the path... if(value_path && !options.path){ - options.path = stateValue() - } + options.path = stateValue() } var dialog = browse.makeListEditor(function(lst){ var target = actions.config path.forEach(function(p){ target = target[p] = target[p] || {} }) - // get... if(lst === undefined){ return target[key] // set... } else { - target[key] = lst - } - }, options) - + target[key] = lst } }, options) value_path - && dialog.open(function(){ - save(dialog.selected) - }) - + && dialog.open(function(){ save(dialog.selected) }) setup && setup.call(dialog, dialog) - - return dialog -} + return dialog } // Wrapper around makeListEditor(..) enabling it to be used as an event