mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
bugfixes and export filename info...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
f98ebe8b76
commit
acc6d6f60c
@ -1636,10 +1636,11 @@ var FileSystemWriterActions = actions.Actions({
|
|||||||
|
|
||||||
'export-preview-name-pattern': '%f',
|
'export-preview-name-pattern': '%f',
|
||||||
'export-preview-name-patterns': [
|
'export-preview-name-patterns': [
|
||||||
'%f',
|
|
||||||
'%i-%f',
|
'%i-%f',
|
||||||
'%n%(-bookmarked)b%e',
|
'%g-%f',
|
||||||
'%n%(-marked)m%e',
|
'%n%(-bookmarked)b%(-m)m%(-%c)c%e',
|
||||||
|
'%n%(-bookmarked)b%(-%c)c%e',
|
||||||
|
'%f',
|
||||||
],
|
],
|
||||||
|
|
||||||
'export-level-directory-name': 'fav',
|
'export-level-directory-name': 'fav',
|
||||||
@ -2353,15 +2354,66 @@ var FileSystemWriterUIActions = actions.Actions({
|
|||||||
// except for the export path...
|
// except for the export path...
|
||||||
__export_dialog_fields__: {
|
__export_dialog_fields__: {
|
||||||
'pattern': function(actions, make, parent){
|
'pattern': function(actions, make, parent){
|
||||||
return make(['Filename pattern: ',
|
var img = actions.current
|
||||||
function(){
|
var pattern = actions.config['export-preview-name-pattern'] || '%f'
|
||||||
return actions.config['export-preview-name-pattern'] || '%f' }])
|
|
||||||
.on('open',
|
var showExaples = function(pattern, img){
|
||||||
widgets.makeNestedConfigListEditor(actions, parent,
|
img = img || actions.current
|
||||||
'export-preview-name-patterns',
|
return actions.showList([
|
||||||
'export-preview-name-pattern', {
|
// current...
|
||||||
length_limit: 10,
|
['Current:',
|
||||||
}))
|
actions.formatImageName(pattern, img)],
|
||||||
|
['Marked:',
|
||||||
|
actions.formatImageName(pattern,
|
||||||
|
img,
|
||||||
|
{tags: ['selected']})],
|
||||||
|
['Bookmarked:',
|
||||||
|
actions.formatImageName(pattern,
|
||||||
|
img,
|
||||||
|
{tags: ['bookmark']})],
|
||||||
|
['Repeating:',
|
||||||
|
actions.formatImageName(pattern,
|
||||||
|
img,
|
||||||
|
{conflicts: {[actions.current]: ['', actions.current], }} )],
|
||||||
|
['All:',
|
||||||
|
actions.formatImageName(pattern,
|
||||||
|
img,
|
||||||
|
{
|
||||||
|
tags: [
|
||||||
|
'selected',
|
||||||
|
'bookmark',
|
||||||
|
],
|
||||||
|
conflicts: {
|
||||||
|
[img]: ['', img],
|
||||||
|
}
|
||||||
|
} )],
|
||||||
|
], {
|
||||||
|
cls: 'table-view',
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// make this a dialog...
|
||||||
|
var res = make(['Filename pattern: ', pattern], {
|
||||||
|
open: widgets.makeNestedConfigListEditor(actions, parent,
|
||||||
|
'export-preview-name-patterns',
|
||||||
|
'export-preview-name-pattern', {
|
||||||
|
length_limit: 10,
|
||||||
|
events: {
|
||||||
|
menu: function(_, p){ showExaples(p) },
|
||||||
|
},
|
||||||
|
buttons: [
|
||||||
|
['i', function(p){ showExaples(p) }],
|
||||||
|
],
|
||||||
|
}),
|
||||||
|
})
|
||||||
|
|
||||||
|
// show example generated names...
|
||||||
|
make(['Filename:',
|
||||||
|
function(){ return actions.formatImageName(pattern, img) }])
|
||||||
|
.on('open', function(){
|
||||||
|
showExaples(actions.config['export-preview-name-pattern'] || '%f') })
|
||||||
|
|
||||||
|
return res
|
||||||
},
|
},
|
||||||
'level_dir': function(actions, make, parent){
|
'level_dir': function(actions, make, parent){
|
||||||
return make(['Level directory: ',
|
return make(['Level directory: ',
|
||||||
|
|||||||
@ -1651,28 +1651,35 @@ var BrowseActionsActions = actions.Actions({
|
|||||||
// build toggler states...
|
// build toggler states...
|
||||||
states.forEach(function(state){
|
states.forEach(function(state){
|
||||||
make(state, {
|
make(state, {
|
||||||
// NOTE: if something is hidden
|
// NOTE: if something is hidden
|
||||||
// it is also disabled...
|
// it is also disabled...
|
||||||
// ...this is by design.
|
// ...this is by design.
|
||||||
disabled: options.no_disabled ?
|
disabled: options.no_disabled ?
|
||||||
false
|
false
|
||||||
: (mode == 'hidden' || mode == 'disabled'),
|
: (mode == 'hidden' || mode == 'disabled'),
|
||||||
hidden: options.no_hidden ?
|
hidden: options.no_hidden ?
|
||||||
false
|
false
|
||||||
: mode == 'hidden',
|
: mode == 'hidden',
|
||||||
})
|
|
||||||
// XXX need to normalize state -- comments, whitespace, etc...
|
cls: [
|
||||||
.attr('keys', getKeys(action +': "'+ state +'"'))
|
state == cur_state ? 'selected highlighted' : '',
|
||||||
.addClass([
|
mode == 'hidden' ? mode : ''
|
||||||
state == cur_state ? 'selected highlighted' : '',
|
].join(' '),
|
||||||
mode == 'hidden' ? mode : ''
|
|
||||||
].join(' '))
|
attrs: {
|
||||||
.on('open', function(){
|
// XXX need to normalize state -- comments, whitespace, etc...
|
||||||
options.callback ?
|
keys: getKeys(action +': "'+ state +'"'),
|
||||||
options.callback.call(actions, action)
|
},
|
||||||
: actions[action](state)
|
|
||||||
that.pop()
|
events: {
|
||||||
})
|
open: function(){
|
||||||
|
options.callback ?
|
||||||
|
options.callback.call(actions, action)
|
||||||
|
: actions[action](state)
|
||||||
|
that.pop()
|
||||||
|
},
|
||||||
|
},
|
||||||
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
// Level: lister -- hand control to lister...
|
// Level: lister -- hand control to lister...
|
||||||
@ -1726,6 +1733,7 @@ var BrowseActionsActions = actions.Actions({
|
|||||||
// Action: toggler -> add toggle button...
|
// Action: toggler -> add toggle button...
|
||||||
if(actions.isToggler && actions.isToggler(action)){
|
if(actions.isToggler && actions.isToggler(action)){
|
||||||
make(text + '/', {
|
make(text + '/', {
|
||||||
|
cls: mode == 'hidden' ? mode : '',
|
||||||
// NOTE: if something is hidden
|
// NOTE: if something is hidden
|
||||||
// it is also disabled...
|
// it is also disabled...
|
||||||
// ...this is by design.
|
// ...this is by design.
|
||||||
@ -1735,6 +1743,10 @@ var BrowseActionsActions = actions.Actions({
|
|||||||
hidden: options.no_hidden ?
|
hidden: options.no_hidden ?
|
||||||
false
|
false
|
||||||
: mode == 'hidden',
|
: mode == 'hidden',
|
||||||
|
attrs: {
|
||||||
|
keys: getKeys(action),
|
||||||
|
action: action,
|
||||||
|
},
|
||||||
buttons: [
|
buttons: [
|
||||||
[actions[action]('?'),
|
[actions[action]('?'),
|
||||||
function(){
|
function(){
|
||||||
@ -1743,20 +1755,16 @@ var BrowseActionsActions = actions.Actions({
|
|||||||
that.select('"'+ text +'"')
|
that.select('"'+ text +'"')
|
||||||
}],
|
}],
|
||||||
//[getKeys(action)],
|
//[getKeys(action)],
|
||||||
]})
|
],
|
||||||
.attr({
|
open: function(){
|
||||||
keys: getKeys(action),
|
|
||||||
action: action,
|
|
||||||
})
|
|
||||||
.addClass(mode == 'hidden' ? mode : '')
|
|
||||||
.on('open', function(){
|
|
||||||
options.callback ?
|
options.callback ?
|
||||||
options.callback.call(actions, action)
|
options.callback.call(actions, action)
|
||||||
: actions[action]()
|
: actions[action]()
|
||||||
|
|
||||||
that.update()
|
that.update()
|
||||||
that.select('"'+ text +'"')
|
that.select('"'+ text +'"')
|
||||||
})
|
},
|
||||||
|
})
|
||||||
|
|
||||||
// Action: normal...
|
// Action: normal...
|
||||||
} else {
|
} else {
|
||||||
@ -1770,15 +1778,15 @@ var BrowseActionsActions = actions.Actions({
|
|||||||
hidden: options.no_hidden ?
|
hidden: options.no_hidden ?
|
||||||
false
|
false
|
||||||
: mode == 'hidden',
|
: mode == 'hidden',
|
||||||
})
|
attrs: {
|
||||||
.attr({
|
keys: getKeys(action),
|
||||||
keys: getKeys(action),
|
action: action,
|
||||||
action: action,
|
},
|
||||||
})
|
open: function(){
|
||||||
.on('open', function(){
|
options.callback ?
|
||||||
options.callback ?
|
options.callback.call(actions, action)
|
||||||
options.callback.call(actions, action)
|
: waitFor(actions[action]())
|
||||||
: waitFor(actions[action]())
|
},
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1788,13 +1796,15 @@ var BrowseActionsActions = actions.Actions({
|
|||||||
&& Object.keys(cur[key]).length > 0)){
|
&& Object.keys(cur[key]).length > 0)){
|
||||||
var p = '/'+ path.concat([text]).join('/') +'/'
|
var p = '/'+ path.concat([text]).join('/') +'/'
|
||||||
p = MARKER ? p.replace(MARKER, '$1') : p
|
p = MARKER ? p.replace(MARKER, '$1') : p
|
||||||
make(text + '/', { push_on_open: true })
|
make(text + '/', {
|
||||||
.attr({
|
push_on_open: true,
|
||||||
|
attrs: {
|
||||||
keys: [
|
keys: [
|
||||||
getKeys('browseActions: "'+ p +'"'),
|
getKeys('browseActions: "'+ p +'"'),
|
||||||
getKeys('browseActions!: "'+ p +'"'),
|
getKeys('browseActions!: "'+ p +'"'),
|
||||||
].filter(function(e){ return e.trim() != '' }).join(' / '),
|
].filter(function(e){ return e.trim() != '' }).join(' / '),
|
||||||
})
|
},
|
||||||
|
})
|
||||||
|
|
||||||
// item: line...
|
// item: line...
|
||||||
} else if(/---+/.test(text)){
|
} else if(/---+/.test(text)){
|
||||||
|
|||||||
@ -1781,11 +1781,6 @@ var DataPrototype = {
|
|||||||
if(res == null){
|
if(res == null){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// clear empty ribbon...
|
|
||||||
r = r == 0 ? 1 : r
|
|
||||||
if(this.ribbons[this.ribbon_order[r]].len == 0){
|
|
||||||
this.clear(this.ribbon_order[r])
|
|
||||||
}
|
|
||||||
return res
|
return res
|
||||||
},
|
},
|
||||||
shiftImageDown: function(gid){
|
shiftImageDown: function(gid){
|
||||||
@ -1800,10 +1795,6 @@ var DataPrototype = {
|
|||||||
if(res == null){
|
if(res == null){
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
// clear empty ribbon...
|
|
||||||
if(this.ribbons[this.ribbon_order[r]].len == 0){
|
|
||||||
this.clear(this.ribbon_order[r])
|
|
||||||
}
|
|
||||||
return res
|
return res
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@ -1532,6 +1532,12 @@ var BrowserPrototype = {
|
|||||||
//'close',
|
//'close',
|
||||||
],
|
],
|
||||||
|
|
||||||
|
optionsEventShorthands: [
|
||||||
|
'open',
|
||||||
|
'menu',
|
||||||
|
'update',
|
||||||
|
],
|
||||||
|
|
||||||
// Shorthand elements...
|
// Shorthand elements...
|
||||||
//
|
//
|
||||||
// Format:
|
// Format:
|
||||||
@ -1683,9 +1689,9 @@ var BrowserPrototype = {
|
|||||||
'#0': 'push!: "9!"',
|
'#0': 'push!: "9!"',
|
||||||
|
|
||||||
// handlers for standard shortcuts...
|
// handlers for standard shortcuts...
|
||||||
|
Menu: 'menu!',
|
||||||
|
|
||||||
ctrl_C: function(){ console.log('!!!!!') },
|
ctrl_C: function(){ console.log('!!!!!') },
|
||||||
|
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
ItemShortcuts: {
|
ItemShortcuts: {
|
||||||
@ -1756,7 +1762,20 @@ var BrowserPrototype = {
|
|||||||
return this
|
return this
|
||||||
},
|
},
|
||||||
blur: widget.proxyToDom('blur'),
|
blur: widget.proxyToDom('blur'),
|
||||||
menu: widget.proxyToDom('menu'),
|
//menu: widget.proxyToDom('menu'),
|
||||||
|
//* XXX
|
||||||
|
menu: function(){
|
||||||
|
arguments[0] instanceof Function ?
|
||||||
|
this.dom.on('menu', arguments[0])
|
||||||
|
: this.select('!').trigger('menu',
|
||||||
|
//: this.dom.trigger('menu',
|
||||||
|
arguments.length > 0 ?
|
||||||
|
[].slice.call(arguments)
|
||||||
|
: [this.selected])
|
||||||
|
return this
|
||||||
|
},
|
||||||
|
//*/
|
||||||
|
|
||||||
|
|
||||||
// base api...
|
// base api...
|
||||||
|
|
||||||
@ -2063,6 +2082,15 @@ var BrowserPrototype = {
|
|||||||
// // shortcut key to open the item...
|
// // shortcut key to open the item...
|
||||||
// shortcut_key: <key>,
|
// shortcut_key: <key>,
|
||||||
//
|
//
|
||||||
|
// // event handler shorthands...
|
||||||
|
// //
|
||||||
|
// // These are the sugar for commonly used events in the events
|
||||||
|
// // section below...
|
||||||
|
// // NOTE: these are defined in .options.optionsEventShorthands
|
||||||
|
// open: <handler>,
|
||||||
|
// menu: <handler>,
|
||||||
|
// update: <handler>,
|
||||||
|
//
|
||||||
// // event handlers...
|
// // event handlers...
|
||||||
// events: {
|
// events: {
|
||||||
// // item-specific update events...
|
// // item-specific update events...
|
||||||
@ -2449,7 +2477,7 @@ var BrowserPrototype = {
|
|||||||
|
|
||||||
if(debounced){
|
if(debounced){
|
||||||
that.select($(this))
|
that.select($(this))
|
||||||
res.trigger('menu', txt)
|
res.trigger('menu', [txt])
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
// append text elements...
|
// append text elements...
|
||||||
@ -2476,6 +2504,9 @@ var BrowserPrototype = {
|
|||||||
opts.push_on_open
|
opts.push_on_open
|
||||||
&& res.attr('push-on-open', 'on')
|
&& res.attr('push-on-open', 'on')
|
||||||
|
|
||||||
|
opts.attrs
|
||||||
|
&& res.attr(opts.attrs)
|
||||||
|
|
||||||
//--------------------------------------------- buttons ---
|
//--------------------------------------------- buttons ---
|
||||||
// button container...
|
// button container...
|
||||||
var btn = res.find('.button-container')
|
var btn = res.find('.button-container')
|
||||||
@ -2543,6 +2574,10 @@ var BrowserPrototype = {
|
|||||||
|
|
||||||
//--------------------------------- user event handlers ---
|
//--------------------------------- user event handlers ---
|
||||||
res.on('update', function(evt){ evt.stopPropagation() })
|
res.on('update', function(evt){ evt.stopPropagation() })
|
||||||
|
// shorthands...
|
||||||
|
;(that.options.optionsEventShorthands || [])
|
||||||
|
.forEach(function(p){ res.on(p, opts[p]) })
|
||||||
|
// events...
|
||||||
Object.keys(opts.events || {})
|
Object.keys(opts.events || {})
|
||||||
.forEach(function(evt){
|
.forEach(function(evt){
|
||||||
res.on(evt, opts.events[evt]) })
|
res.on(evt, opts.events[evt]) })
|
||||||
|
|||||||
@ -19,11 +19,11 @@ var proxyToDom =
|
|||||||
module.proxyToDom =
|
module.proxyToDom =
|
||||||
function(name){
|
function(name){
|
||||||
return function(){
|
return function(){
|
||||||
// easy handler...
|
// proxy handler...
|
||||||
if(name in this.dom){
|
if(name in this.dom){
|
||||||
this.dom[name].apply(this.dom, arguments)
|
this.dom[name].apply(this.dom, arguments)
|
||||||
|
|
||||||
// trigger...
|
// on/trigger handlers...
|
||||||
} else {
|
} else {
|
||||||
arguments[0] instanceof Function ?
|
arguments[0] instanceof Function ?
|
||||||
this.dom.on(name, arguments[0])
|
this.dom.on(name, arguments[0])
|
||||||
@ -33,6 +33,27 @@ function(name){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var eventToDom =
|
||||||
|
module.eventToDom =
|
||||||
|
function(name, defaults){
|
||||||
|
return function(){
|
||||||
|
// register...
|
||||||
|
if(arguments[0] instanceof Function){
|
||||||
|
this.dom.trigger(name, [].slice.call(arguments))
|
||||||
|
|
||||||
|
// trigger...
|
||||||
|
} else {
|
||||||
|
var args = (arguments.length == 0 && defaults) ?
|
||||||
|
defaults.call(this)
|
||||||
|
: [].slice.call(arguments)
|
||||||
|
args = args instanceof Array ? args : [args]
|
||||||
|
|
||||||
|
this.dom.trigger(name, args)
|
||||||
|
}
|
||||||
|
return this
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// XXX triggering events from here and from jQuery/dom has a
|
// XXX triggering events from here and from jQuery/dom has a
|
||||||
// different effect...
|
// different effect...
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user