mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 02:10:08 +00:00
added a sort dialog...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
49bbe27c0c
commit
c1a6f90731
@ -785,18 +785,23 @@ module.SortActions = actions.Actions({
|
|||||||
// XXX should this be a dialog with ability to edit modes???
|
// XXX should this be a dialog with ability to edit modes???
|
||||||
// - toggle reverse sort
|
// - toggle reverse sort
|
||||||
// XXX currently this will not toggle past 'none'
|
// XXX currently this will not toggle past 'none'
|
||||||
toggleImageSort: ['Edit|Sort/Toggle image sort method',
|
toggleImageSort: ['- Edit|Sort/Toggle image sort method',
|
||||||
toggler.Toggler(null,
|
toggler.Toggler(null,
|
||||||
function(){ return this.data.sort_method || 'none' },
|
function(){ return this.data.sort_method || 'none' },
|
||||||
function(){
|
function(){
|
||||||
return Object.keys(this.config['sort-methods'])
|
return Object.keys(this.config['sort-methods'])
|
||||||
.concat(this.data.manual_order ? ['Manual'] : [])},
|
.concat((this.data.manual_order
|
||||||
|
|| this.data.sort_method == 'Manual') ? ['Manual'] : [])},
|
||||||
// prevent setting 'none' as mode...
|
// prevent setting 'none' as mode...
|
||||||
function(mode){
|
function(mode){
|
||||||
return !!this.images
|
return !!this.images
|
||||||
&& (mode != 'none'
|
&& (mode != 'none'
|
||||||
|| (mode == 'Manual' && this.data.manual_order)) },
|
|| (mode == 'Manual' && this.data.manual_order)) },
|
||||||
function(mode){
|
// XXX need to refactor the toggler a bit to make the
|
||||||
|
// signature simpler...
|
||||||
|
function(mode, _, reverse){
|
||||||
|
reverse = reverse == 'reverse' || reverse
|
||||||
|
|
||||||
// save manual order...
|
// save manual order...
|
||||||
if(this.data.sort_method == 'Manual'){
|
if(this.data.sort_method == 'Manual'){
|
||||||
this.data.manual_order = this.data.order.slice()
|
this.data.manual_order = this.data.order.slice()
|
||||||
@ -806,10 +811,10 @@ module.SortActions = actions.Actions({
|
|||||||
// XXX this does not use .sortImages(..) thus this does not update...
|
// XXX this does not use .sortImages(..) thus this does not update...
|
||||||
if(mode == 'Manual'){
|
if(mode == 'Manual'){
|
||||||
this.data.order = this.data.manual_order.slice()
|
this.data.order = this.data.manual_order.slice()
|
||||||
this.sortImages('update')
|
this.sortImages('update' + (reverse ? ' reverse' : ''))
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
this.sortImages(mode)
|
this.sortImages(mode + (reverse ? ' reverse' : ''))
|
||||||
}
|
}
|
||||||
|
|
||||||
this.data.sort_method = mode
|
this.data.sort_method = mode
|
||||||
|
|||||||
@ -24,6 +24,7 @@ var drawer = require('lib/widget/drawer')
|
|||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
|
|
||||||
|
// XXX might be a good idea to be able ignore actions rather than keys...
|
||||||
// XXX add this to the global doc...
|
// XXX add this to the global doc...
|
||||||
var GLOBAL_KEYBOARD =
|
var GLOBAL_KEYBOARD =
|
||||||
module.GLOBAL_KEYBOARD = {
|
module.GLOBAL_KEYBOARD = {
|
||||||
@ -55,6 +56,8 @@ module.GLOBAL_KEYBOARD = {
|
|||||||
L: 'toggleSlideshowLooping',
|
L: 'toggleSlideshowLooping',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// XXX do we need to prevent up/down navigation here, it may get confusing?
|
||||||
|
// XXX do we need to disable fast sorting here???
|
||||||
'Single Image': {
|
'Single Image': {
|
||||||
pattern: '.single-image-mode',
|
pattern: '.single-image-mode',
|
||||||
ignore: [
|
ignore: [
|
||||||
@ -63,9 +66,6 @@ module.GLOBAL_KEYBOARD = {
|
|||||||
// do not crop in single image mode...
|
// do not crop in single image mode...
|
||||||
'C', 'F2',
|
'C', 'F2',
|
||||||
|
|
||||||
// XXX not sure about this...
|
|
||||||
//'Up', 'Down',
|
|
||||||
|
|
||||||
// zooming...
|
// zooming...
|
||||||
'#0', '#1', '#2', '#3', '#4', '#5', '#6', '#7', '#8', '#9',
|
'#0', '#1', '#2', '#3', '#4', '#5', '#6', '#7', '#8', '#9',
|
||||||
],
|
],
|
||||||
@ -79,6 +79,7 @@ module.GLOBAL_KEYBOARD = {
|
|||||||
Esc: 'toggleSingleImage: "off" -- Exit single image view',
|
Esc: 'toggleSingleImage: "off" -- Exit single image view',
|
||||||
|
|
||||||
// ignore sorting and reversing...
|
// ignore sorting and reversing...
|
||||||
|
// XXX not sure about these yet, especially reversing...
|
||||||
R: {
|
R: {
|
||||||
shift: 'IGNORE',
|
shift: 'IGNORE',
|
||||||
},
|
},
|
||||||
@ -284,7 +285,8 @@ module.GLOBAL_KEYBOARD = {
|
|||||||
default: 'slideshowDialog',
|
default: 'slideshowDialog',
|
||||||
//shift: 'sortImages: "Date" -- Sort images by date',
|
//shift: 'sortImages: "Date" -- Sort images by date',
|
||||||
shift: 'sortImages -- Sort images',
|
shift: 'sortImages -- Sort images',
|
||||||
alt: 'browseActions: "/Sort/"',
|
//alt: 'browseActions: "/Sort/"',
|
||||||
|
alt: 'sortDialog',
|
||||||
// XXX need to make this save to base_path if it exists and
|
// XXX need to make this save to base_path if it exists and
|
||||||
// ask the user if it does not... now it always asks.
|
// ask the user if it does not... now it always asks.
|
||||||
ctrl: 'saveIndexHere',
|
ctrl: 'saveIndexHere',
|
||||||
|
|||||||
@ -132,7 +132,9 @@ var SlideshowActions = actions.Actions({
|
|||||||
// update slideshow menu...
|
// update slideshow menu...
|
||||||
oo.client.open(function(){
|
oo.client.open(function(){
|
||||||
o.client.update()
|
o.client.update()
|
||||||
o.client.select(txt)
|
.then(function(){
|
||||||
|
o.client.select(txt)
|
||||||
|
})
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
@ -19,6 +19,9 @@ var ribbons = require('ribbons')
|
|||||||
var core = require('features/core')
|
var core = require('features/core')
|
||||||
var base = require('features/base')
|
var base = require('features/base')
|
||||||
|
|
||||||
|
var overlay = require('lib/widget/overlay')
|
||||||
|
var browse = require('lib/widget/browse')
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
@ -737,6 +740,10 @@ module.Viewer = core.ImageGridFeatures.Feature({
|
|||||||
'base',
|
'base',
|
||||||
'workspace',
|
'workspace',
|
||||||
],
|
],
|
||||||
|
suggested: [
|
||||||
|
'ui-sort',
|
||||||
|
// XXX add base ui features here...
|
||||||
|
],
|
||||||
|
|
||||||
actions: ViewerActions,
|
actions: ViewerActions,
|
||||||
|
|
||||||
@ -797,6 +804,99 @@ module.Viewer = core.ImageGridFeatures.Feature({
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/*********************************************************************/
|
||||||
|
// User interfaces for different base features...
|
||||||
|
|
||||||
|
var SortUIActions = actions.Actions({
|
||||||
|
config: {
|
||||||
|
'default-sort-order': 'default',
|
||||||
|
},
|
||||||
|
|
||||||
|
toggleDefaultSortOrder: ['- Edit|Sort/Default sort order',
|
||||||
|
core.makeConfigToggler('default-sort-order', ['default', 'reverse'])],
|
||||||
|
sortDialog: ['Edit|Sort/Sort images...',
|
||||||
|
function(){
|
||||||
|
var that = this
|
||||||
|
|
||||||
|
// XXX might be a good idea to make this generic...
|
||||||
|
var _makeTogglHandler = function(toggler){
|
||||||
|
return function(){
|
||||||
|
var txt = $(this).find('.text').first().text()
|
||||||
|
that[toggler]()
|
||||||
|
o.client.update()
|
||||||
|
.then(function(){ o.client.select(txt) })
|
||||||
|
that.toggleSlideshow('?') == 'on'
|
||||||
|
&& o.close()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
var o = overlay.Overlay(this.ribbons.viewer,
|
||||||
|
browse.makeLister(null, function(path, make){
|
||||||
|
var cur = that.toggleImageSort('?')
|
||||||
|
|
||||||
|
that.toggleImageSort('??').forEach(function(mode){
|
||||||
|
// skip 'none'...
|
||||||
|
if(mode == 'none'){
|
||||||
|
return
|
||||||
|
}
|
||||||
|
make(mode + (cur == mode ? ' *' : ''))
|
||||||
|
.on('open', function(){
|
||||||
|
that.toggleImageSort(null, mode,
|
||||||
|
that.config['default-sort-order'] == 'reverse')
|
||||||
|
o.close()
|
||||||
|
})
|
||||||
|
})
|
||||||
|
|
||||||
|
// Commands...
|
||||||
|
make('---')
|
||||||
|
|
||||||
|
make('Reverse images')
|
||||||
|
.on('open', function(){
|
||||||
|
that.reverseImages()
|
||||||
|
o.close()
|
||||||
|
})
|
||||||
|
/*
|
||||||
|
make('Reverse ribbons')
|
||||||
|
.on('open', function(){
|
||||||
|
that.reverseRibbons()
|
||||||
|
o.close()
|
||||||
|
})
|
||||||
|
*/
|
||||||
|
|
||||||
|
// Settings...
|
||||||
|
make('---')
|
||||||
|
|
||||||
|
make(['Default order: ', that.config['default-sort-order'] || 'ascending'])
|
||||||
|
.on('open', _makeTogglHandler('toggleDefaultSortOrder'))
|
||||||
|
.addClass('item-value-view')
|
||||||
|
}))
|
||||||
|
|
||||||
|
// select the current order...
|
||||||
|
o.client.select('"' + this.toggleImageSort('?') + ' *"')
|
||||||
|
|
||||||
|
return o
|
||||||
|
}]
|
||||||
|
})
|
||||||
|
|
||||||
|
var SortUI =
|
||||||
|
module.SortUI = core.ImageGridFeatures.Feature({
|
||||||
|
title: '',
|
||||||
|
doc: '',
|
||||||
|
|
||||||
|
tag: 'ui-sort',
|
||||||
|
depends: [
|
||||||
|
'ui',
|
||||||
|
],
|
||||||
|
|
||||||
|
actions: SortUIActions,
|
||||||
|
})
|
||||||
|
|
||||||
|
|
||||||
|
// XXX tag dialogs...
|
||||||
|
// XXX
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*********************************************************************/
|
/*********************************************************************/
|
||||||
// Utilities and Services...
|
// Utilities and Services...
|
||||||
|
|
||||||
|
|||||||
@ -130,10 +130,12 @@ body {
|
|||||||
|
|
||||||
|
|
||||||
/* Metadata viewer */
|
/* Metadata viewer */
|
||||||
|
.item-value-view .text:first-child,
|
||||||
.browse-widget.metadata-view .list>div .text:first-child {
|
.browse-widget.metadata-view .list>div .text:first-child {
|
||||||
width: 50%;
|
width: 50%;
|
||||||
font-weight: bold;
|
font-weight: bold;
|
||||||
}
|
}
|
||||||
|
.item-value-view .text:nth-child(2),
|
||||||
.browse-widget.metadata-view .list>div .text:nth-child(2) {
|
.browse-widget.metadata-view .list>div .text:nth-child(2) {
|
||||||
font-style: italic;
|
font-style: italic;
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user