From dd24e9f9c39a9f29781b9d9d7746e1db1f7b6cf4 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 23 Jul 2017 16:38:03 +0300 Subject: [PATCH] revised some marks browse ui stuff + added several new marks-related actions + fixes... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/base.js | 14 +++++++++++--- ui (gen4)/features/marks.js | 32 +++++++++++++++++++++++++++++--- ui (gen4)/features/ui-ribbons.js | 2 +- ui (gen4)/features/ui-widgets.js | 2 +- 4 files changed, 42 insertions(+), 8 deletions(-) diff --git a/ui (gen4)/features/base.js b/ui (gen4)/features/base.js index 08892390..da0ee49c 100755 --- a/ui (gen4)/features/base.js +++ b/ui (gen4)/features/base.js @@ -722,7 +722,7 @@ actions.Actions({ // XXX undo... shiftImageTo: ['- Edit|Sort|Image/', {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', core.doc`Shift image up... @@ -1366,9 +1366,17 @@ module.ImageEditGroupActions = actions.Actions({ function(target){ this.groupTo(target, 'next') }], // NOTE: this will only group loaded images... + // XXX should this be someplace in marks-depended feature??? groupMarked: ['Group|Mark/Group loaded marked images', - {journal: true}, - function(){ this.group(this.data.getImages(this.data.getTaggedByAny('marked'))) }], + {journal: true, + // 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 = diff --git a/ui (gen4)/features/marks.js b/ui (gen4)/features/marks.js index 7b8383c2..766582a9 100755 --- a/ui (gen4)/features/marks.js +++ b/ui (gen4)/features/marks.js @@ -228,8 +228,12 @@ var ImageMarkActions = actions.Actions({ }], 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) }], 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) }], cropMarked: ['Mark|Crop/Crop $marked images', @@ -319,6 +323,10 @@ var ImageMarkEditActions = actions.Actions({ return this.toggleMark(block, state ? 'off' : 'on') }], + unmarkAll: ['Mark/$Unmark all', + {browseMode: 'cropMarked'}, + function(){ this.toggleMark(this.marked) }], + markTagged: ['- Mark/Mark images by tags', function(tags, mode){ var selector = mode == 'any' ? 'getTaggedByAny' : 'getTaggedByAll' @@ -330,11 +338,24 @@ var ImageMarkEditActions = actions.Actions({ }], shiftMarkedUp: ['Mark|Ribbon/Shift marked $up', - {undo: undoShift('shiftMarkedDown')}, + {undo: undoShift('shiftMarkedDown'), + browseMode: 'cropMarked'}, shiftMarked('up')], shiftMarkedDown: ['Mark|Ribbon/Shift marked $down', - {undo: undoShift('shiftMarkedUp')}, + {undo: undoShift('shiftMarkedUp'), + browseMode: 'cropMarked'}, 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 = @@ -410,8 +431,12 @@ var ImageBookmarkActions = actions.Actions({ }, 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) }], 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) }], cropBookmarked: ['Bookmark|Crop/Crop $bookmarked images', @@ -451,7 +476,8 @@ var ImageBookmarkEditActions = actions.Actions({ // 'on' - toggle all on // 'off' - toggle all off // '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){ return this.toggleBookmark(this.data.getTaggedByAny('selected'), action) }], diff --git a/ui (gen4)/features/ui-ribbons.js b/ui (gen4)/features/ui-ribbons.js index 97e65451..7107037c 100755 --- a/ui (gen4)/features/ui-ribbons.js +++ b/ui (gen4)/features/ui-ribbons.js @@ -55,7 +55,7 @@ function updateImagePosition(actions, target){ // XXX hack??? if(target instanceof Array){ - actions.reload() + actions.reload(true) return end() } diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index 3453936d..d2d8fa36 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -1575,7 +1575,7 @@ var BrowseActionsActions = actions.Actions({ this.showDoc = function(){ var action = this.select('!').attr('action') action - && this.showDoc(action) + && actions.showDoc(action) } this.keyboard.handler('General', '?', 'showDoc') })