mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-30 02:40:08 +00:00
refactoring the dialogs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
8da1eb0fab
commit
5f7e89409c
@ -363,6 +363,8 @@ Roadmap
|
|||||||
[_] remove extra and repetitive actions
|
[_] remove extra and repetitive actions
|
||||||
[_] caching config
|
[_] caching config
|
||||||
[_] side-by side view...
|
[_] side-by side view...
|
||||||
|
[_] Simplify tool-tip structure in dialogs...
|
||||||
|
| might also bee good to unify tool-tips across the app...
|
||||||
[X] URL history...
|
[X] URL history...
|
||||||
[X] BUG: ribbons above and below are still sometimes loaded incorrectly
|
[X] BUG: ribbons above and below are still sometimes loaded incorrectly
|
||||||
| likely due to trying to align
|
| likely due to trying to align
|
||||||
|
|||||||
57
ui/crop.js
57
ui/crop.js
@ -208,6 +208,63 @@ function uncropLastState(){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* Dialogs...
|
||||||
|
*/
|
||||||
|
|
||||||
|
function cropImagesDialog(){
|
||||||
|
|
||||||
|
updateStatus('Crop...').show()
|
||||||
|
|
||||||
|
var alg = 'Crop ribbons: |'+
|
||||||
|
'Use Esc and Shift-Esc to exit crop modes.'+
|
||||||
|
'\n\n'+
|
||||||
|
'NOTE: all crop modes will produce a single ribbon unless\n'+
|
||||||
|
'otherwise stated.'
|
||||||
|
|
||||||
|
cfg = {}
|
||||||
|
cfg[alg] = [
|
||||||
|
'Marked images',
|
||||||
|
'Marked images (keep ribbons)',
|
||||||
|
'Current ribbon',
|
||||||
|
'Current ribbon and above | Will merge the images into a single ribbon.',
|
||||||
|
'Current ribbon and above (keep ribbons)'
|
||||||
|
]
|
||||||
|
|
||||||
|
formDialog(null, '',
|
||||||
|
cfg,
|
||||||
|
'OK',
|
||||||
|
'cropImagesDialog')
|
||||||
|
.done(function(res){
|
||||||
|
res = res[alg]
|
||||||
|
|
||||||
|
// NOTE: these must be in order of least-specific last...
|
||||||
|
if(/Marked.*keep ribbons/i.test(res)){
|
||||||
|
var method = toggleMarkedOnlyWithRibbonsView
|
||||||
|
|
||||||
|
} else if(/Marked/i.test(res)){
|
||||||
|
var method = toggleMarkedOnlyView
|
||||||
|
|
||||||
|
} else if(/Current ribbon and above.*keep ribbons/i.test(res)){
|
||||||
|
var method = toggleCurrenAndAboveRibbonsMode
|
||||||
|
|
||||||
|
} else if(/Current ribbon and above/i.test(res)){
|
||||||
|
var method = toggleCurrenAndAboveRibbonMode
|
||||||
|
|
||||||
|
} else if(/Current ribbon/i.test(res)){
|
||||||
|
var method = toggleSingleRibbonMode
|
||||||
|
}
|
||||||
|
|
||||||
|
showStatusQ('Cropped: '+res+'...')
|
||||||
|
|
||||||
|
method('on')
|
||||||
|
})
|
||||||
|
.fail(function(){
|
||||||
|
showStatusQ('Crop: canceled.')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* vim:set ts=4 sw=4 : */
|
* vim:set ts=4 sw=4 : */
|
||||||
|
|||||||
52
ui/sort.js
52
ui/sort.js
@ -362,6 +362,58 @@ function shiftImageRight(image){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**********************************************************************
|
||||||
|
* Dialogs...
|
||||||
|
*/
|
||||||
|
|
||||||
|
function sortImagesDialog(){
|
||||||
|
|
||||||
|
updateStatus('Sort...').show()
|
||||||
|
|
||||||
|
var alg = 'Sort images by (ascending):'
|
||||||
|
var rev = 'Reverse order'
|
||||||
|
|
||||||
|
cfg = {}
|
||||||
|
cfg[alg] = [
|
||||||
|
'Date',
|
||||||
|
'Sequence number',
|
||||||
|
'Sequence number with overflow',
|
||||||
|
'File name'
|
||||||
|
]
|
||||||
|
cfg[rev] = false
|
||||||
|
|
||||||
|
formDialog(null, '',
|
||||||
|
cfg,
|
||||||
|
'OK',
|
||||||
|
'sortImagesDialog')
|
||||||
|
.done(function(res){
|
||||||
|
var reverse = res[rev]
|
||||||
|
res = res[alg]
|
||||||
|
|
||||||
|
if(/Date/i.test(res)){
|
||||||
|
var method = sortImagesByDate
|
||||||
|
|
||||||
|
} else if(/File name/i.test(res)){
|
||||||
|
var method = sortImagesByFileNameXPStyle
|
||||||
|
|
||||||
|
} else if(/Sequence/i.test(res) && !/with overflow/.test(res)){
|
||||||
|
var method = sortImagesByFileSeqOrName
|
||||||
|
|
||||||
|
} else if(/Sequence/i.test(res) && /with overflow/.test(res)){
|
||||||
|
var method = sortImagesByFileNameSeqWithOverflow
|
||||||
|
|
||||||
|
} else {
|
||||||
|
var method = sortImagesByFileName
|
||||||
|
}
|
||||||
|
|
||||||
|
showStatusQ('Sorting by: '+res+'...')
|
||||||
|
|
||||||
|
method(reverse)
|
||||||
|
})
|
||||||
|
.fail(function(){
|
||||||
|
showStatusQ('Sort: canceled.')
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
144
ui/ui.js
144
ui/ui.js
@ -556,7 +556,10 @@ var FIELD_TYPES = {
|
|||||||
// ['a', 'b', 'c', ...]
|
// ['a', 'b', 'c', ...]
|
||||||
//
|
//
|
||||||
// an item can be of the folowing format:
|
// an item can be of the folowing format:
|
||||||
// <text> ['|' 'default' ]
|
// <text> ['|' 'default' ] [ '|' <tool-tip> ]
|
||||||
|
//
|
||||||
|
// NOTE: only one 'default' item should be present.
|
||||||
|
// NOTE: if no defaults are set, then the first item is checked.
|
||||||
choice: {
|
choice: {
|
||||||
type: 'choice',
|
type: 'choice',
|
||||||
text: null,
|
text: null,
|
||||||
@ -596,8 +599,16 @@ var FIELD_TYPES = {
|
|||||||
val.prop('checked', false)
|
val.prop('checked', false)
|
||||||
}
|
}
|
||||||
|
|
||||||
item.find('.item-text')
|
txt = item.find('.item-text')
|
||||||
.html(txt)
|
.html(txt)
|
||||||
|
|
||||||
|
// tooltip...
|
||||||
|
if(opts.length > 0){
|
||||||
|
$('<span class="tooltip-icon tooltip-right"> *</span>')
|
||||||
|
.attr('tooltip', opts.pop())
|
||||||
|
.appendTo(txt)
|
||||||
|
}
|
||||||
|
|
||||||
item.appendTo(field)
|
item.appendTo(field)
|
||||||
|
|
||||||
item = item.clone()
|
item = item.clone()
|
||||||
@ -728,7 +739,6 @@ var FIELD_TYPES = {
|
|||||||
//
|
//
|
||||||
// XXX add form testing...
|
// XXX add form testing...
|
||||||
// XXX add undefined field handling/reporting...
|
// XXX add undefined field handling/reporting...
|
||||||
// XXX revise...
|
|
||||||
function formDialog(root, message, config, btn, cls){
|
function formDialog(root, message, config, btn, cls){
|
||||||
cls = cls == null ? '' : cls
|
cls = cls == null ? '' : cls
|
||||||
btn = btn == null ? 'OK' : btn
|
btn = btn == null ? 'OK' : btn
|
||||||
@ -755,7 +765,7 @@ function formDialog(root, message, config, btn, cls){
|
|||||||
var tip = t.split(/\s*\|\s*/)
|
var tip = t.split(/\s*\|\s*/)
|
||||||
text = tip[0]
|
text = tip[0]
|
||||||
tip = tip[1]
|
tip = tip[1]
|
||||||
$('<span class="tooltip-icon tooltip-right">?</span>')
|
$('<span class="tooltip-icon tooltip-right"> *</span>')
|
||||||
.attr('tooltip', tip)
|
.attr('tooltip', tip)
|
||||||
.appendTo(html)
|
.appendTo(html)
|
||||||
// cleanup...
|
// cleanup...
|
||||||
@ -820,15 +830,21 @@ function formDialog(root, message, config, btn, cls){
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
setTimeout(function(){
|
// focus an element...
|
||||||
var e = form.find('.field input:checked')
|
// NOTE: if first element is a radio button set, focus the checked
|
||||||
if(e.length > 0){
|
// element, else focus the first input...
|
||||||
e.focus()
|
form.ready(function(){
|
||||||
} else {
|
var elem = form.find('.field input').first()
|
||||||
form.find('.field input').first()
|
if(elem.attr('type') == 'radio'){
|
||||||
|
form.find('.field input:checked')
|
||||||
.focus()
|
.focus()
|
||||||
|
.select()
|
||||||
|
} else {
|
||||||
|
elem
|
||||||
|
.focus()
|
||||||
|
.select()
|
||||||
}
|
}
|
||||||
}, 100)
|
})
|
||||||
|
|
||||||
return res
|
return res
|
||||||
}
|
}
|
||||||
@ -893,9 +909,8 @@ function exportPreviewsDialog(state, dfl){
|
|||||||
// XXX make this more generic...
|
// XXX make this more generic...
|
||||||
// tell the user what state are we exporting...
|
// tell the user what state are we exporting...
|
||||||
if(state == null){
|
if(state == null){
|
||||||
state = toggleMarkedOnlyView('?') == 'on' ? 'marked images' : state
|
|
||||||
state = toggleSingleRibbonMode('?') == 'on' ? 'current ribbon' : state
|
|
||||||
state = toggleSingleImageMode('?') == 'on' ? 'current image' : state
|
state = toggleSingleImageMode('?') == 'on' ? 'current image' : state
|
||||||
|
state = state == null && isViewCropped() ? 'current cropped view' : state
|
||||||
state = state == null ? 'all images' : state
|
state = state == null ? 'all images' : state
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1032,109 +1047,6 @@ function loadDirectoryDialog(dfl){
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
function sortImagesDialog(){
|
|
||||||
|
|
||||||
updateStatus('Sort...').show()
|
|
||||||
|
|
||||||
var alg = 'Sort images by (ascending):'
|
|
||||||
var rev = 'Reverse order'
|
|
||||||
|
|
||||||
cfg = {}
|
|
||||||
cfg[alg] = [
|
|
||||||
'Date',
|
|
||||||
'Sequence number',
|
|
||||||
'Sequence number with overflow',
|
|
||||||
'File name'
|
|
||||||
]
|
|
||||||
cfg[rev] = false
|
|
||||||
|
|
||||||
formDialog(null, '',
|
|
||||||
cfg,
|
|
||||||
'OK',
|
|
||||||
'sortImagesDialog')
|
|
||||||
.done(function(res){
|
|
||||||
var reverse = res[rev]
|
|
||||||
res = res[alg]
|
|
||||||
|
|
||||||
if(/Date/i.test(res)){
|
|
||||||
var method = sortImagesByDate
|
|
||||||
|
|
||||||
} else if(/File name/i.test(res)){
|
|
||||||
var method = sortImagesByFileNameXPStyle
|
|
||||||
|
|
||||||
} else if(/Sequence/i.test(res) && !/with overflow/.test(res)){
|
|
||||||
var method = sortImagesByFileSeqOrName
|
|
||||||
|
|
||||||
} else if(/Sequence/i.test(res) && /with overflow/.test(res)){
|
|
||||||
var method = sortImagesByFileNameSeqWithOverflow
|
|
||||||
|
|
||||||
} else {
|
|
||||||
var method = sortImagesByFileName
|
|
||||||
}
|
|
||||||
|
|
||||||
showStatusQ('Sorting by: '+res+'...')
|
|
||||||
|
|
||||||
method(reverse)
|
|
||||||
})
|
|
||||||
.fail(function(){
|
|
||||||
showStatusQ('Sort: canceled.')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
function cropImagesDialog(){
|
|
||||||
|
|
||||||
updateStatus('Crop...').show()
|
|
||||||
|
|
||||||
var alg = 'Crop: |'+
|
|
||||||
'Use Esc and Shift-Esc to exit crop modes.'+
|
|
||||||
'\n\n'+
|
|
||||||
'NOTE: all crop modes will produce a single ribbon unless\n'+
|
|
||||||
'otherwise stated.'
|
|
||||||
|
|
||||||
cfg = {}
|
|
||||||
cfg[alg] = [
|
|
||||||
'Marked images',
|
|
||||||
'Marked images (keep ribbons)',
|
|
||||||
'Current ribbon',
|
|
||||||
'Current ribbon and above',
|
|
||||||
'Current ribbon and above (keep ribbons)'
|
|
||||||
]
|
|
||||||
|
|
||||||
formDialog(null, '',
|
|
||||||
cfg,
|
|
||||||
'OK',
|
|
||||||
'cropImagesDialog')
|
|
||||||
.done(function(res){
|
|
||||||
res = res[alg]
|
|
||||||
|
|
||||||
// NOTE: these must be in order of least-specific last...
|
|
||||||
if(/Marked.*keep ribbons/i.test(res)){
|
|
||||||
var method = toggleMarkedOnlyWithRibbonsView
|
|
||||||
|
|
||||||
} else if(/Marked/i.test(res)){
|
|
||||||
var method = toggleMarkedOnlyView
|
|
||||||
|
|
||||||
} else if(/Current ribbon and above.*keep ribbons/i.test(res)){
|
|
||||||
var method = toggleCurrenAndAboveRibbonsMode
|
|
||||||
|
|
||||||
} else if(/Current ribbon and above/i.test(res)){
|
|
||||||
var method = toggleCurrenAndAboveRibbonMode
|
|
||||||
|
|
||||||
} else if(/Current ribbon/i.test(res)){
|
|
||||||
var method = toggleSingleRibbonMode
|
|
||||||
}
|
|
||||||
|
|
||||||
showStatusQ('Cropped: '+res+'...')
|
|
||||||
|
|
||||||
method('on')
|
|
||||||
})
|
|
||||||
.fail(function(){
|
|
||||||
showStatusQ('Crop: canceled.')
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// XXX get EXIF, IPTC...
|
// XXX get EXIF, IPTC...
|
||||||
function showImageInfo(){
|
function showImageInfo(){
|
||||||
var gid = getImageGID(getImage())
|
var gid = getImageGID(getImage())
|
||||||
|
|||||||
@ -141,13 +141,17 @@ function recentlyOpenedDialog(){
|
|||||||
|
|
||||||
var cfg = {}
|
var cfg = {}
|
||||||
cfg[title] = BASE_URL_HISTORY.map(function(e){
|
cfg[title] = BASE_URL_HISTORY.map(function(e){
|
||||||
|
// cleanup the urls...
|
||||||
|
var ee = e.replace('file:///', '')
|
||||||
|
|
||||||
|
// mark the current path...
|
||||||
if(e == BASE_URL){
|
if(e == BASE_URL){
|
||||||
var ee = e.italics()
|
ee = ee.italics()
|
||||||
dict[ee] = e
|
dict[ee] = e
|
||||||
return ee + ' | default'
|
return ee + ' | default | Currently loaded data.'
|
||||||
}
|
}
|
||||||
dict[e] = e
|
dict[ee] = e
|
||||||
return e
|
return ee
|
||||||
})
|
})
|
||||||
|
|
||||||
formDialog(null, '',
|
formDialog(null, '',
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user