mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
export presets mostly feature complete, now for testing...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
2f7348e3a3
commit
1f1a1cae7e
@ -1528,9 +1528,7 @@ var FileSystemSaveHistoryUIActions = actions.Actions({
|
|||||||
|
|
||||||
Object.keys(data).forEach(function(path){
|
Object.keys(data).forEach(function(path){
|
||||||
Object.keys(data[path]).forEach(function(d){
|
Object.keys(data[path]).forEach(function(d){
|
||||||
list.push(d)
|
list.push(d) }) })
|
||||||
})
|
|
||||||
})
|
|
||||||
|
|
||||||
list
|
list
|
||||||
.sort()
|
.sort()
|
||||||
@ -1543,9 +1541,7 @@ var FileSystemSaveHistoryUIActions = actions.Actions({
|
|||||||
make(_makeTitle('Original state (unsaved)', 'current', unsaved))
|
make(_makeTitle('Original state (unsaved)', 'current', unsaved))
|
||||||
.on('open', function(){
|
.on('open', function(){
|
||||||
that.load(unsaved)
|
that.load(unsaved)
|
||||||
|
delete that.unsaved_index })
|
||||||
delete that.unsaved_index
|
|
||||||
})
|
|
||||||
|
|
||||||
// Special case: top save state is the default,
|
// Special case: top save state is the default,
|
||||||
// no need to mark anything for change, but only
|
// no need to mark anything for change, but only
|
||||||
@ -1554,9 +1550,7 @@ var FileSystemSaveHistoryUIActions = actions.Actions({
|
|||||||
var first = list.shift()
|
var first = list.shift()
|
||||||
first && make(_makeTitle(Date.fromTimeStamp(first).toShortDate(), first))
|
first && make(_makeTitle(Date.fromTimeStamp(first).toShortDate(), first))
|
||||||
.on('open', function(){
|
.on('open', function(){
|
||||||
that.loadIndex(that.location.path, first)
|
that.loadIndex(that.location.path, first) }) }
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
list
|
list
|
||||||
.forEach(function(d){
|
.forEach(function(d){
|
||||||
@ -1583,12 +1577,9 @@ var FileSystemSaveHistoryUIActions = actions.Actions({
|
|||||||
// NOTE: the original 'current'
|
// NOTE: the original 'current'
|
||||||
// comment is saved to
|
// comment is saved to
|
||||||
// .unsaved_index
|
// .unsaved_index
|
||||||
delete that.comments.save.current
|
delete that.comments.save.current }) })
|
||||||
})
|
|
||||||
})
|
|
||||||
// mark the current loaded position...
|
// mark the current loaded position...
|
||||||
.addClass(d == from ? 'selected highlighted' : '')
|
.addClass(d == from ? 'selected highlighted' : '') })
|
||||||
})
|
|
||||||
|
|
||||||
make.done()
|
make.done()
|
||||||
|
|
||||||
@ -3112,21 +3103,29 @@ var FileSystemWriterUIActions = actions.Actions({
|
|||||||
'exportDialog: "images"'],
|
'exportDialog: "images"'],
|
||||||
|
|
||||||
|
|
||||||
// XXX format the element into: title (optional) + info
|
|
||||||
// XXX add a 'name' field to the exportDialog(..)???
|
|
||||||
// XXX button icons...
|
|
||||||
// XXX button shortcuts...
|
|
||||||
// XXX handle presets with repeating titles...
|
// XXX handle presets with repeating titles...
|
||||||
// XXX would be nice to mark sections...
|
// XXX UI:
|
||||||
|
// - element format:
|
||||||
|
// TITLE
|
||||||
|
// mode / destination / format
|
||||||
|
// - revise buttons and icons...
|
||||||
|
// - button shortcuts...
|
||||||
|
// XXX add a 'name' field to the exportDialog(..)???
|
||||||
|
// XXX would be nice to mark/title sections -- presets / history... (???)
|
||||||
exportPresets: ['- File/Export presets and history...',
|
exportPresets: ['- File/Export presets and history...',
|
||||||
widgets.makeUIDialog(function(mode){
|
widgets.makeUIDialog(function(mode){
|
||||||
var that = this
|
var that = this
|
||||||
var logger = this.logger && this.logger.push('exportPresets')
|
var logger = this.logger && this.logger.push('exportPresets')
|
||||||
|
|
||||||
// XXX should this show date???
|
|
||||||
var getName = function(preset){
|
var getName = function(preset){
|
||||||
return preset.name
|
var date = preset.date
|
||||||
|| `${ preset.mode }: "${ preset.path }"` }
|
&& Date.fromTimeStamp(preset.date).toShortDate()
|
||||||
|
date = date ?
|
||||||
|
date + ' - '
|
||||||
|
: ''
|
||||||
|
return date
|
||||||
|
+ (preset.name
|
||||||
|
|| `${ preset.mode }: "${ preset.path }"`) }
|
||||||
|
|
||||||
var buildIndex = function(presets){
|
var buildIndex = function(presets){
|
||||||
var index
|
var index
|
||||||
@ -3162,7 +3161,7 @@ var FileSystemWriterUIActions = actions.Actions({
|
|||||||
sortable: true,
|
sortable: true,
|
||||||
update_merge: 'live',
|
update_merge: 'live',
|
||||||
new_item: false,
|
new_item: false,
|
||||||
// NOTE: we use empty to restore the automatic value...
|
// saving an empty string on item edit will clear .name...
|
||||||
allow_empty: true,
|
allow_empty: true,
|
||||||
itemedit: function(evt, from, to){
|
itemedit: function(evt, from, to){
|
||||||
var preset = getPreset(from, presets, index)
|
var preset = getPreset(from, presets, index)
|
||||||
@ -3199,7 +3198,8 @@ var FileSystemWriterUIActions = actions.Actions({
|
|||||||
make.dialog.select(n)
|
make.dialog.select(n)
|
||||||
make.dialog.update() } })}],
|
make.dialog.update() } })}],
|
||||||
// duplicate...
|
// duplicate...
|
||||||
['<span class="show-on-hover">❏</span>',
|
//['<span class="show-on-hover">❏</span>',
|
||||||
|
['<small class="show-on-hover">clone</small>',
|
||||||
function(title){
|
function(title){
|
||||||
var preset = JSON.parse(
|
var preset = JSON.parse(
|
||||||
JSON.stringify(
|
JSON.stringify(
|
||||||
@ -3287,7 +3287,6 @@ var FileSystemWriterUIActions = actions.Actions({
|
|||||||
// keyboard...
|
// keyboard...
|
||||||
.run(function(){
|
.run(function(){
|
||||||
var that = this
|
var that = this
|
||||||
// XXX for some reason this does not work yet...
|
|
||||||
this.keyboard.on('E', function(){
|
this.keyboard.on('E', function(){
|
||||||
console.log('!!!!!!!!!!!!!', that.selected)
|
console.log('!!!!!!!!!!!!!', that.selected)
|
||||||
})
|
})
|
||||||
@ -3312,21 +3311,19 @@ var FileSystemWriterUIActions = actions.Actions({
|
|||||||
function(settings){
|
function(settings){
|
||||||
settings = settings
|
settings = settings
|
||||||
|| this.config['export-settings']
|
|| this.config['export-settings']
|
||||||
// XXX need to check preset uniqueness...
|
// no settings...
|
||||||
settings
|
if(!settings){
|
||||||
&& (this.config['export-presets'] =
|
console.error('.exportPresets(..): no settings to save.')
|
||||||
|
return }
|
||||||
|
// isolate and cleanup...
|
||||||
|
settings = JSON.parse(JSON.stringify(settings))
|
||||||
|
delete settings.date
|
||||||
|
// XXX check preset uniqueness...
|
||||||
|
;(this.config['export-presets'] =
|
||||||
this.config['export-presets']
|
this.config['export-presets']
|
||||||
|| [])
|
|| [])
|
||||||
.push(JSON.parse(JSON.stringify( settings ))) }],
|
.push(settings) }],
|
||||||
|
|
||||||
// XXX need a way to reference a preset...
|
|
||||||
exportPresetDelete: ['- File/',
|
|
||||||
function(){}],
|
|
||||||
exportPresetRun: ['- File/',
|
|
||||||
function(){}],
|
|
||||||
|
|
||||||
// XXX need to check item uniqueness???
|
// XXX need to check item uniqueness???
|
||||||
// XXX add date???
|
|
||||||
exportHistoryPush: ['- File/',
|
exportHistoryPush: ['- File/',
|
||||||
function(settings){
|
function(settings){
|
||||||
settings = settings
|
settings = settings
|
||||||
@ -3345,6 +3342,10 @@ var FileSystemWriterUIActions = actions.Actions({
|
|||||||
// trim the history...
|
// trim the history...
|
||||||
history.length > l
|
history.length > l
|
||||||
&& history.splice(0, history.length - l) }],
|
&& history.splice(0, history.length - l) }],
|
||||||
|
|
||||||
|
clearExportHistory: ['- File/Clear export history',
|
||||||
|
function(){
|
||||||
|
delete this.config['export-history'] }],
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
||||||
@ -3363,6 +3364,7 @@ module.FileSystemWriterUI = core.ImageGridFeatures.Feature({
|
|||||||
actions: FileSystemWriterUIActions,
|
actions: FileSystemWriterUIActions,
|
||||||
|
|
||||||
handlers: [
|
handlers: [
|
||||||
|
// update export history...
|
||||||
[[
|
[[
|
||||||
'exportIndex',
|
'exportIndex',
|
||||||
'exportDirs',
|
'exportDirs',
|
||||||
|
|||||||
@ -1049,13 +1049,14 @@ var KeyboardPrototype = {
|
|||||||
//
|
//
|
||||||
// NOTE: this is an event-like proxy to the .handler(..)
|
// NOTE: this is an event-like proxy to the .handler(..)
|
||||||
//
|
//
|
||||||
// Bind handler key (top section)...
|
// Bind handler key ('General' section)...
|
||||||
// .on(key, handler)
|
// .on(key, handler)
|
||||||
// -> this
|
// -> this
|
||||||
//
|
//
|
||||||
// .on(key, section, handler)
|
// .on(key, section, handler)
|
||||||
// -> this
|
// -> this
|
||||||
//
|
//
|
||||||
|
// NOTE: default mode is 'General'...
|
||||||
on: function(key, handler){
|
on: function(key, handler){
|
||||||
// normalize args...
|
// normalize args...
|
||||||
if(arguments.length == 3){
|
if(arguments.length == 3){
|
||||||
@ -1063,13 +1064,15 @@ var KeyboardPrototype = {
|
|||||||
} else {
|
} else {
|
||||||
var [key, handler] = arguments }
|
var [key, handler] = arguments }
|
||||||
var mode = mode
|
var mode = mode
|
||||||
|| Object.keys(this.keyboard)[0]
|
//|| Object.keys(this.keyboard)[0]
|
||||||
|
|| 'General'
|
||||||
// bind...
|
// bind...
|
||||||
return this.handler(mode, key, handler) },
|
return this.handler(mode, key, handler) },
|
||||||
off: function(key, mode){
|
off: function(key, mode){
|
||||||
// normalize args...
|
// normalize args...
|
||||||
mode = mode
|
mode = mode
|
||||||
|| Object.keys(this.keyboard)[0]
|
//|| Object.keys(this.keyboard)[0]
|
||||||
|
|| 'General'
|
||||||
// unbind...
|
// unbind...
|
||||||
return this.handler(mode, key, null) },
|
return this.handler(mode, key, null) },
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user