revised some marks browse ui stuff + added several new marks-related actions + fixes...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-07-23 16:38:03 +03:00
parent 54dcae7f29
commit dd24e9f9c3
4 changed files with 42 additions and 8 deletions

View File

@ -722,7 +722,7 @@ actions.Actions({
// XXX undo... // XXX undo...
shiftImageTo: ['- Edit|Sort|Image/', shiftImageTo: ['- Edit|Sort|Image/',
{undo: function(a){ this.shiftImageTo(a.args[1], a.args[0]) }}, {undo: function(a){ this.shiftImageTo(a.args[1], a.args[0]) }},
function(target, to){ this.data.shiftImage(target, to) }], function(target, to, mode){ this.data.shiftImage(target, to, mode) }],
shiftImageUp: ['Edit|Image/Shift image up', shiftImageUp: ['Edit|Image/Shift image up',
core.doc`Shift image up... core.doc`Shift image up...
@ -1366,9 +1366,17 @@ module.ImageEditGroupActions = actions.Actions({
function(target){ this.groupTo(target, 'next') }], function(target){ this.groupTo(target, 'next') }],
// NOTE: this will only group loaded images... // NOTE: this will only group loaded images...
// XXX should this be someplace in marks-depended feature???
groupMarked: ['Group|Mark/Group loaded marked images', groupMarked: ['Group|Mark/Group loaded marked images',
{journal: true}, {journal: true,
function(){ this.group(this.data.getImages(this.data.getTaggedByAny('marked'))) }], // XXX should this depend on marks more directly???
browseMode: function(){
return (this.data.tags
&& this.data.tags.selected
&& this.data.tags.selected.length > 0)
|| 'disabled' }},
function(){
this.group(this.data.getImages(this.data.getTaggedByAny('selected'))) }],
}) })
var ImageEditGroup = var ImageEditGroup =

View File

@ -228,8 +228,12 @@ var ImageMarkActions = actions.Actions({
}], }],
prevMarked: ['Mark|Navigate/Previous marked image', prevMarked: ['Mark|Navigate/Previous marked image',
{browseMode: function(target){
return this.data.getImage('current', 'before', this.marked) == null && 'disabled' }},
function(mode){ this.prevTagged('selected', mode) }], function(mode){ this.prevTagged('selected', mode) }],
nextMarked: ['Mark|Navigate/Next marked image', nextMarked: ['Mark|Navigate/Next marked image',
{browseMode: function(target){
return this.data.getImage('current', 'after', this.marked) == null && 'disabled' }},
function(mode){ this.nextTagged('selected', mode) }], function(mode){ this.nextTagged('selected', mode) }],
cropMarked: ['Mark|Crop/Crop $marked images', cropMarked: ['Mark|Crop/Crop $marked images',
@ -319,6 +323,10 @@ var ImageMarkEditActions = actions.Actions({
return this.toggleMark(block, state ? 'off' : 'on') return this.toggleMark(block, state ? 'off' : 'on')
}], }],
unmarkAll: ['Mark/$Unmark all',
{browseMode: 'cropMarked'},
function(){ this.toggleMark(this.marked) }],
markTagged: ['- Mark/Mark images by tags', markTagged: ['- Mark/Mark images by tags',
function(tags, mode){ function(tags, mode){
var selector = mode == 'any' ? 'getTaggedByAny' : 'getTaggedByAll' var selector = mode == 'any' ? 'getTaggedByAny' : 'getTaggedByAll'
@ -330,11 +338,24 @@ var ImageMarkEditActions = actions.Actions({
}], }],
shiftMarkedUp: ['Mark|Ribbon/Shift marked $up', shiftMarkedUp: ['Mark|Ribbon/Shift marked $up',
{undo: undoShift('shiftMarkedDown')}, {undo: undoShift('shiftMarkedDown'),
browseMode: 'cropMarked'},
shiftMarked('up')], shiftMarked('up')],
shiftMarkedDown: ['Mark|Ribbon/Shift marked $down', shiftMarkedDown: ['Mark|Ribbon/Shift marked $down',
{undo: undoShift('shiftMarkedUp')}, {undo: undoShift('shiftMarkedUp'),
browseMode: 'cropMarked'},
shiftMarked('down')], shiftMarked('down')],
// XXX undo...
shiftMarkedAfter: ['Mark|Ribbon/Shift marked after image',
{browseMode: 'cropMarked'},
function(target){
this.shiftMarkedTo(this.marked, target || 'current', 'after') }],
// XXX undo...
shiftMarkedBefore: ['Mark|Ribbon/Shift marked before image',
{browseMode: 'cropMarked'},
function(target){
this.shiftMarkedTo(this.marked, target || 'current', 'before') }],
}) })
var ImageEditMarks = var ImageEditMarks =
@ -410,8 +431,12 @@ var ImageBookmarkActions = actions.Actions({
}, },
prevBookmarked: ['Bookmark|Navigate/Previous bookmarked image', prevBookmarked: ['Bookmark|Navigate/Previous bookmarked image',
{browseMode: function(target){
return this.data.getImage('current', 'before', this.bookmarked) == null && 'disabled' }},
function(mode){ this.prevTagged('bookmark', mode) }], function(mode){ this.prevTagged('bookmark', mode) }],
nextBookmarked: ['Bookmark|Navigate/Next bookmarked image', nextBookmarked: ['Bookmark|Navigate/Next bookmarked image',
{browseMode: function(target){
return this.data.getImage('current', 'after', this.bookmarked) == null && 'disabled' }},
function(mode){ this.nextTagged('bookmark', mode) }], function(mode){ this.nextTagged('bookmark', mode) }],
cropBookmarked: ['Bookmark|Crop/Crop $bookmarked images', cropBookmarked: ['Bookmark|Crop/Crop $bookmarked images',
@ -451,7 +476,8 @@ var ImageBookmarkEditActions = actions.Actions({
// 'on' - toggle all on // 'on' - toggle all on
// 'off' - toggle all off // 'off' - toggle all off
// 'next' - toggle each image to next state // 'next' - toggle each image to next state
toggleBookmarkOnMarked: ['Bookmark|Mark/Bookmark on maked images', toggleBookmarkOnMarked: ['Bookmark|Mark/Toggle bookmark on maked images',
{browseMode: 'cropMarked'},
function(action){ function(action){
return this.toggleBookmark(this.data.getTaggedByAny('selected'), action) return this.toggleBookmark(this.data.getTaggedByAny('selected'), action)
}], }],

View File

@ -55,7 +55,7 @@ function updateImagePosition(actions, target){
// XXX hack??? // XXX hack???
if(target instanceof Array){ if(target instanceof Array){
actions.reload() actions.reload(true)
return end() return end()
} }

View File

@ -1575,7 +1575,7 @@ var BrowseActionsActions = actions.Actions({
this.showDoc = function(){ this.showDoc = function(){
var action = this.select('!').attr('action') var action = this.select('!').attr('action')
action action
&& this.showDoc(action) && actions.showDoc(action)
} }
this.keyboard.handler('General', '?', 'showDoc') this.keyboard.handler('General', '?', 'showDoc')
}) })