mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 10:20:08 +00:00
added export dialog...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
ef6b88f64f
commit
e4897d5c31
@ -27,6 +27,8 @@ var features = require('lib/features')
|
|||||||
|
|
||||||
var core = require('features/core')
|
var core = require('features/core')
|
||||||
|
|
||||||
|
var widgets = require('features/ui-widgets')
|
||||||
|
|
||||||
var overlay = require('lib/widget/overlay')
|
var overlay = require('lib/widget/overlay')
|
||||||
var browse = require('lib/widget/browse')
|
var browse = require('lib/widget/browse')
|
||||||
var browseWalk = require('lib/widget/browse-walk')
|
var browseWalk = require('lib/widget/browse-walk')
|
||||||
@ -566,6 +568,37 @@ module.FileSystemLoaderURLHistoryUI = core.ImageGridFeatures.Feature({
|
|||||||
var FileSystemWriterActions = actions.Actions({
|
var FileSystemWriterActions = actions.Actions({
|
||||||
config: {
|
config: {
|
||||||
//'index-filename-template': '${DATE}-${KEYWORD}.${EXT}',
|
//'index-filename-template': '${DATE}-${KEYWORD}.${EXT}',
|
||||||
|
|
||||||
|
'export-path': null,
|
||||||
|
'export-paths': [],
|
||||||
|
|
||||||
|
'export-preview-name-pattern': '%f',
|
||||||
|
'export-preview-name-patterns': [
|
||||||
|
'%f',
|
||||||
|
'%n%(-bookmarked)b%e',
|
||||||
|
'%n%(-marked)m%e',
|
||||||
|
],
|
||||||
|
|
||||||
|
'export-level-directory-name': 'fav',
|
||||||
|
'export-level-directory-names': [
|
||||||
|
'fav',
|
||||||
|
'select',
|
||||||
|
],
|
||||||
|
|
||||||
|
'export-preview-size': 1000,
|
||||||
|
// XXX add options to indicate:
|
||||||
|
// - long side
|
||||||
|
// - short side
|
||||||
|
// - vertical
|
||||||
|
// - horizontal
|
||||||
|
// - ...
|
||||||
|
'export-preview-sizes': [
|
||||||
|
500,
|
||||||
|
900,
|
||||||
|
1000,
|
||||||
|
1280,
|
||||||
|
1920,
|
||||||
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
// This can be:
|
// This can be:
|
||||||
@ -778,7 +811,7 @@ var FileSystemWriterActions = actions.Actions({
|
|||||||
// XXX add a ui...
|
// XXX add a ui...
|
||||||
// - select path
|
// - select path
|
||||||
// - select preview size
|
// - select preview size
|
||||||
exportCollection: ['File/Export as collection',
|
exportIndex: ['- File/Export index',
|
||||||
function(path, logger){
|
function(path, logger){
|
||||||
logger = logger || this.logger
|
logger = logger || this.logger
|
||||||
|
|
||||||
@ -1104,6 +1137,87 @@ var FileSystemWriterUIActions = actions.Actions({
|
|||||||
browseSaveIndex: ['File/Save index to...',
|
browseSaveIndex: ['File/Save index to...',
|
||||||
makeBrowseProxy('saveIndex', function(){
|
makeBrowseProxy('saveIndex', function(){
|
||||||
this.location.method = 'loadIndex' })],
|
this.location.method = 'loadIndex' })],
|
||||||
|
|
||||||
|
// XXX need to be able to make dirs...
|
||||||
|
browseExportIndex: ['File/Export/Index to...',
|
||||||
|
makeBrowseProxy('exportIndex')],
|
||||||
|
// XXX need to be able to make dirs...
|
||||||
|
// XXX STUB
|
||||||
|
browseExportDirs: ['File/Export/Images to...',
|
||||||
|
makeBrowseProxy('exportDirs')],
|
||||||
|
|
||||||
|
// XXX make this a multi format export dialog...
|
||||||
|
// - index
|
||||||
|
// - dirs
|
||||||
|
// - ...
|
||||||
|
// XXX indicate export state: index, crop, image...
|
||||||
|
exportDirsDialog: ['File/Export/Images...',
|
||||||
|
function(){
|
||||||
|
var that = this
|
||||||
|
|
||||||
|
var o = overlay.Overlay(this.ribbons.viewer,
|
||||||
|
browse.makeLister(null, function(path, make){
|
||||||
|
make(['Filename pattern: ',
|
||||||
|
function(){ return that.config['export-preview-name-pattern'] || '%f' }])
|
||||||
|
.on('open',
|
||||||
|
widgets.makeNestedConfigListEditor(that, o,
|
||||||
|
'export-preview-name-patterns',
|
||||||
|
'export-preview-name-pattern'))
|
||||||
|
|
||||||
|
make(['Level directory: ',
|
||||||
|
function(){ return that.config['export-level-directory-name'] || 'fav' }])
|
||||||
|
.on('open',
|
||||||
|
widgets.makeNestedConfigListEditor(that, o,
|
||||||
|
'export-level-directory-names',
|
||||||
|
'export-level-directory-name'))
|
||||||
|
|
||||||
|
make(['Target image: ',
|
||||||
|
function(){ return that.config['export-preview-size'] || 1000 }])
|
||||||
|
// XXX add validation???
|
||||||
|
.on('open',
|
||||||
|
widgets.makeNestedConfigListEditor(that, o,
|
||||||
|
'export-preview-sizes',
|
||||||
|
'export-preview-size'))
|
||||||
|
|
||||||
|
make(['To: ',
|
||||||
|
function(){ return that.config['export-path'] || './' }],
|
||||||
|
{ buttons: [
|
||||||
|
['browse', function(){
|
||||||
|
var path = $(this).find('.text').last().text()
|
||||||
|
|
||||||
|
// XXX add new dir global button...
|
||||||
|
return that.browsePath(path,
|
||||||
|
function(path){
|
||||||
|
that.config['export-path'] = path
|
||||||
|
that.config['export-paths'].splice(0, 0, path)
|
||||||
|
|
||||||
|
// XXX ugly...
|
||||||
|
o.focus()
|
||||||
|
})
|
||||||
|
}]
|
||||||
|
]})
|
||||||
|
.on('open',
|
||||||
|
widgets.makeNestedConfigListEditor(that, o,
|
||||||
|
'export-paths',
|
||||||
|
'export-path'))
|
||||||
|
|
||||||
|
// Start/stop...
|
||||||
|
make([function(){
|
||||||
|
// XXX indicate export state: index, crop, image...
|
||||||
|
return 'Export'}])
|
||||||
|
.on('open', function(){
|
||||||
|
// XXX is this correct???
|
||||||
|
// XXX handle relative paths!!!
|
||||||
|
that.exportDirs(that.config['export-path'] || that.location.path)
|
||||||
|
o.close()
|
||||||
|
})
|
||||||
|
}))
|
||||||
|
|
||||||
|
o.client.dom.addClass('metadata-view tail-action')
|
||||||
|
o.client.select(-1)
|
||||||
|
|
||||||
|
return o
|
||||||
|
}],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@ -46,6 +46,7 @@ var SlideshowActions = actions.Actions({
|
|||||||
],
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// XXX use widgets.makeNestedConfigListEditor(...)???
|
||||||
slideshowIntervalDialog: ['Slideshow/Slideshow interval',
|
slideshowIntervalDialog: ['Slideshow/Slideshow interval',
|
||||||
function(){
|
function(){
|
||||||
var that = this
|
var that = this
|
||||||
@ -75,22 +76,6 @@ var SlideshowActions = actions.Actions({
|
|||||||
suspended_timer || that.resetSlideshowTimer()
|
suspended_timer || that.resetSlideshowTimer()
|
||||||
})
|
})
|
||||||
|
|
||||||
o.client
|
|
||||||
.open(function(evt, time){
|
|
||||||
// we clicked the 'New' button -- select it...
|
|
||||||
if(!Date.str2ms(time)){
|
|
||||||
o.client.select(button_text)
|
|
||||||
|
|
||||||
// set value and exit...
|
|
||||||
} else {
|
|
||||||
that.config['slideshow-interval'] = time
|
|
||||||
|
|
||||||
// XXX this is ugly...
|
|
||||||
o.close()
|
|
||||||
}
|
|
||||||
})
|
|
||||||
|
|
||||||
o.client.dom.addClass('tail-action')
|
|
||||||
o.client.select(that.config['slideshow-interval'])
|
o.client.select(that.config['slideshow-interval'])
|
||||||
|
|
||||||
return o
|
return o
|
||||||
|
|||||||
@ -99,6 +99,8 @@ function(actions, list_key, options){
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// save the new version...
|
||||||
|
actions.config[list_key] = actions.config[list_key].slice()
|
||||||
// add new value and sort list...
|
// add new value and sort list...
|
||||||
actions.config[list_key]
|
actions.config[list_key]
|
||||||
.push(txt)
|
.push(txt)
|
||||||
@ -133,8 +135,7 @@ function(actions, list_key, options){
|
|||||||
var to_remove = []
|
var to_remove = []
|
||||||
|
|
||||||
var list = browse.makeList( null,
|
var list = browse.makeList( null,
|
||||||
actions.config[list_key]
|
actions.config[list_key].concat(new_button ? [ new_button ] : []),
|
||||||
.concat(new_button ? [ new_button ] : []),
|
|
||||||
{itemButtons: [
|
{itemButtons: [
|
||||||
// mark for removal...
|
// mark for removal...
|
||||||
['×',
|
['×',
|
||||||
@ -161,6 +162,15 @@ function(actions, list_key, options){
|
|||||||
_makeEditable(elem)
|
_makeEditable(elem)
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
.open(function(evt, path){
|
||||||
|
// we clicked the 'New' button -- select it...
|
||||||
|
if(new_button && (path == new_button || path == '')){
|
||||||
|
list.select(new_button)
|
||||||
|
|
||||||
|
} else {
|
||||||
|
options.callback && options.callback.call(list, path)
|
||||||
|
}
|
||||||
|
})
|
||||||
|
|
||||||
var o = overlay.Overlay(actions.ribbons.viewer, list)
|
var o = overlay.Overlay(actions.ribbons.viewer, list)
|
||||||
.close(function(){
|
.close(function(){
|
||||||
@ -172,7 +182,7 @@ function(actions, list_key, options){
|
|||||||
actions.config[list_key] = lst
|
actions.config[list_key] = lst
|
||||||
})
|
})
|
||||||
|
|
||||||
// sort the times...
|
// sort...
|
||||||
if(options.sort){
|
if(options.sort){
|
||||||
actions.config[list_key] = actions.config[list_key]
|
actions.config[list_key] = actions.config[list_key]
|
||||||
.sort(options.sort !== true ? options.sort : undefined)
|
.sort(options.sort !== true ? options.sort : undefined)
|
||||||
@ -185,6 +195,45 @@ function(actions, list_key, options){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// XXX should this be more generic...
|
||||||
|
var makeNestedConfigListEditor =
|
||||||
|
module.makeNestedConfigListEditor =
|
||||||
|
function(actions, parent, list_name, value_name, options){
|
||||||
|
return function(){
|
||||||
|
var txt = $(this).find('.text').first().text()
|
||||||
|
|
||||||
|
options = options || {}
|
||||||
|
var dfl_options = {
|
||||||
|
new_button: 'New...',
|
||||||
|
length_limit: 10,
|
||||||
|
// NOTE: this is called when adding a new value and
|
||||||
|
// list maximum length is reached...
|
||||||
|
callback: function(value){
|
||||||
|
actions.config[value_name] = value
|
||||||
|
|
||||||
|
o.close()
|
||||||
|
},
|
||||||
|
}
|
||||||
|
options.__proto__ = dfl_options
|
||||||
|
|
||||||
|
var o = makeConfigListEditor(actions, list_name, options)
|
||||||
|
|
||||||
|
// update slideshow menu...
|
||||||
|
o.client.open(function(){
|
||||||
|
parent.client.update()
|
||||||
|
parent.client.select(txt)
|
||||||
|
})
|
||||||
|
|
||||||
|
o.close(function(){
|
||||||
|
// XXX this is ugly...
|
||||||
|
parent.focus()
|
||||||
|
})
|
||||||
|
|
||||||
|
o.client.select(actions.config[value_name])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user