added docs to export pattern...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-11-14 00:13:47 +03:00
parent acc6d6f60c
commit f8dfa167c9
3 changed files with 53 additions and 23 deletions

View File

@ -2393,7 +2393,7 @@ var FileSystemWriterUIActions = actions.Actions({
} }
// make this a dialog... // make this a dialog...
var res = make(['Filename pattern: ', pattern], { var res = make(['Filename $pattern: ', pattern], {
open: widgets.makeNestedConfigListEditor(actions, parent, open: widgets.makeNestedConfigListEditor(actions, parent,
'export-preview-name-patterns', 'export-preview-name-patterns',
'export-preview-name-pattern', { 'export-preview-name-pattern', {
@ -2404,19 +2404,32 @@ var FileSystemWriterUIActions = actions.Actions({
buttons: [ buttons: [
['i', function(p){ showExaples(p) }], ['i', function(p){ showExaples(p) }],
], ],
}, function(){
this.showExaples = function(){ showExaples(this.selected) }
this.keyboard.handler('General', 'i', 'showExaples')
this.showDoc = function(){ actions.showDoc('formatImageName') }
this.keyboard.handler('General', '?', 'showDoc')
}), }),
buttons: [
['?', function(){
actions.showDoc('formatImageName')
}],
],
}) })
// show example generated names... // show example generated names...
make(['Filename:', make(['Filename:',
function(){ return actions.formatImageName(pattern, img) }]) function(){ return actions.formatImageName(pattern, img) }],
.on('open', function(){ {
showExaples(actions.config['export-preview-name-pattern'] || '%f') }) open: function(){
showExaples(actions.config['export-preview-name-pattern'] || '%f') },
})
return res return res
}, },
'level_dir': function(actions, make, parent){ 'level_dir': function(actions, make, parent){
return make(['Level directory: ', return make(['$Level directory: ',
function(){ function(){
return actions.config['export-level-directory-name'] || 'fav' }]) return actions.config['export-level-directory-name'] || 'fav' }])
.on('open', .on('open',
@ -2427,7 +2440,7 @@ var FileSystemWriterUIActions = actions.Actions({
})) }))
}, },
'size': function(actions, make, parent){ 'size': function(actions, make, parent){
return make(['Image size: ', return make(['Image $size: ',
function(){ function(){
return actions.config['export-preview-size'] || 1000 }]) return actions.config['export-preview-size'] || 1000 }])
// XXX add validation??? // XXX add validation???
@ -2442,7 +2455,7 @@ var FileSystemWriterUIActions = actions.Actions({
}, },
'size_limit': function(actions, make, parent){ 'size_limit': function(actions, make, parent){
return make(['Limit image size: ', return make(['Limit image $size: ',
function(){ function(){
return actions.config['export-preview-size-limit'] || 'no limit' }], return actions.config['export-preview-size-limit'] || 'no limit' }],
{ buttons: [ { buttons: [
@ -2463,7 +2476,7 @@ var FileSystemWriterUIActions = actions.Actions({
}, },
// XXX BUG: history closing errors -- non-critical... // XXX BUG: history closing errors -- non-critical...
'target_dir': function(actions, make, parent){ 'target_dir': function(actions, make, parent){
var elem = make(['To: ', var elem = make(['$To: ',
function(){ return actions.config['export-path'] || './' }], function(){ return actions.config['export-path'] || './' }],
{ buttons: [ { buttons: [
['browse', function(p){ ['browse', function(p){
@ -2517,7 +2530,7 @@ var FileSystemWriterUIActions = actions.Actions({
}) })
}, },
'comment': function(actions, make, parent){ 'comment': function(actions, make, parent){
var elem = make(['Comment: ', var elem = make(['$Comment: ',
// XXX get staged comment??? // XXX get staged comment???
function(){ return actions.getSaveComment() }]) function(){ return actions.getSaveComment() }])
.on('open', function(){ .on('open', function(){

View File

@ -212,7 +212,7 @@ function(list, elem, callback, options){
// //
var makeConfigListEditor = var makeConfigListEditor =
module.makeConfigListEditor = module.makeConfigListEditor =
function(actions, path, value_path, options){ function(actions, path, value_path, options, setup){
path = path.split('.') path = path.split('.')
var key = path.pop() var key = path.pop()
@ -275,6 +275,9 @@ function(actions, path, value_path, options){
save(dialog.selected) save(dialog.selected)
}) })
setup
&& setup.call(dialog, dialog)
return dialog return dialog
} }
@ -289,7 +292,7 @@ function(actions, path, value_path, options){
// .text element... // .text element...
var makeNestedConfigListEditor = var makeNestedConfigListEditor =
module.makeNestedConfigListEditor = module.makeNestedConfigListEditor =
function(actions, list, list_key, value_key, options){ function(actions, list, list_key, value_key, options, setup){
options = options || {} options = options || {}
return function(){ return function(){
@ -305,7 +308,7 @@ function(actions, list, list_key, value_key, options){
} }
options.__proto__ = dfl_options options.__proto__ = dfl_options
var o = makeConfigListEditor(actions, list_key, value_key, options) var o = makeConfigListEditor(actions, list_key, value_key, options, setup)
// update parent menu... // update parent menu...
.open(function(){ .open(function(){
list list

View File

@ -1532,7 +1532,11 @@ var BrowserPrototype = {
//'close', //'close',
], ],
optionsEventShorthands: [ // List of event handlers that can be set directly from item
// options...
//
// This is a shorthand to using options.events object.
itemOptionsEventShorthands: [
'open', 'open',
'menu', 'menu',
'update', 'update',
@ -1762,19 +1766,29 @@ var BrowserPrototype = {
return this return this
}, },
blur: widget.proxyToDom('blur'), blur: widget.proxyToDom('blur'),
//menu: widget.proxyToDom('menu'),
//* XXX // Trigger/bind to menu event...
//
// Bind handler to menu event...
// .menu(handler)
// -> this
//
// Trigger menu event on current item...
// .menu()
// -> this
//
// Trigger menu event on pattern item...
// .menu(pattern)
// -> this
//
// NOTE: pattern is .select(..) compatible pattern.
menu: function(){ menu: function(){
arguments[0] instanceof Function ? arguments[0] instanceof Function ?
this.dom.on('menu', arguments[0]) this.dom.on('menu', arguments[0])
: this.select('!').trigger('menu', : this.select(arguments[0] || '!')
//: this.dom.trigger('menu', .trigger('menu', [this.selected])
arguments.length > 0 ?
[].slice.call(arguments)
: [this.selected])
return this return this
}, },
//*/
// base api... // base api...
@ -2086,7 +2100,7 @@ var BrowserPrototype = {
// // // //
// // These are the sugar for commonly used events in the events // // These are the sugar for commonly used events in the events
// // section below... // // section below...
// // NOTE: these are defined in .options.optionsEventShorthands // // NOTE: these are defined in .options.itmeOptionsEventShorthands
// open: <handler>, // open: <handler>,
// menu: <handler>, // menu: <handler>,
// update: <handler>, // update: <handler>,
@ -2575,7 +2589,7 @@ var BrowserPrototype = {
//--------------------------------- user event handlers --- //--------------------------------- user event handlers ---
res.on('update', function(evt){ evt.stopPropagation() }) res.on('update', function(evt){ evt.stopPropagation() })
// shorthands... // shorthands...
;(that.options.optionsEventShorthands || []) ;(that.options.itemOptionsEventShorthands || [])
.forEach(function(p){ res.on(p, opts[p]) }) .forEach(function(p){ res.on(p, opts[p]) })
// events... // events...
Object.keys(opts.events || {}) Object.keys(opts.events || {})