diff --git a/ui (gen4)/features/base.js b/ui (gen4)/features/base.js index 7cc43f65..35c37e81 100755 --- a/ui (gen4)/features/base.js +++ b/ui (gen4)/features/base.js @@ -1718,22 +1718,52 @@ module.CropActions = actions.Actions({ this.crop(this.data[selector](tags), flatten) }], - // crop edit actions... - // XXX - removeFromCrop: ['- Crop/', + // XXX do we need this??? + removeFromCrop: ['Crop/Remove from crop', + {browseMode: 'uncrop'}, function(gids){ + var that = this if(!this.cropped){ return } + var data = this.data + var current = this.current + var focus = false + gids = arguments.length > 1 ? [].slice.call(arguments) : gids gids = gids || 'current' gids = gids instanceof Array ? gids : [gids] - gids = this.data.normalizeGIDs(gids) + gids + // clear ribbons... + .filter(function(gid){ + if(gid in data.ribbons){ + delete data.ribbons[gid] + data.ribbon_order.splice(data.ribbon_order.indexOf(gid), 1) - // XXX + return false + } + return true + }) + // clear images... + .forEach(function(gid){ + gid = data.getImage(gid) + + delete data.ribbons[data.getRibbon(gid)][data.order.indexOf(gid)] + + if(gid == current){ + focus = true + } + }) + + // the above may result in empty ribbons -> cleanup... + this.data.clear('empty') + + // restore correct focus... + focus + && this.focusImage(this.direction == 'left' ? 'prev' : 'next') }] }) diff --git a/ui (gen4)/features/keyboard.js b/ui (gen4)/features/keyboard.js index 8202800d..bda0f884 100755 --- a/ui (gen4)/features/keyboard.js +++ b/ui (gen4)/features/keyboard.js @@ -134,7 +134,9 @@ module.GLOBAL_KEYBOARD = { W: 'testAction2 -- XXX DEBUG: remove when done...', - // XXX should we add image level manipulation here, like "remove image"??? + // XXX not sure about this... + Del: 'removeFromCrop', + shift_Del: 'removeMarkedFromCrop', }, 'Collection': { @@ -143,6 +145,7 @@ module.GLOBAL_KEYBOARD = { Esc: 'loadCollection: "ALL" -- Load all images', Del: 'uncollect', + shift_Del: 'uncollectMarked', }, 'Range': { diff --git a/ui (gen4)/features/marks.js b/ui (gen4)/features/marks.js index ae427a6b..9d0b1e6f 100755 --- a/ui (gen4)/features/marks.js +++ b/ui (gen4)/features/marks.js @@ -240,6 +240,11 @@ var ImageMarkActions = actions.Actions({ {browseMode: function(target){ return this.marked.length == 0 && 'disabled' }}, function(flatten){ this.cropTagged('selected', 'any', flatten) }], + + removeMarkedFromCrop: ['Mark|Crop/Remove marked from crop', + {browseMode: function(target){ + return (this.marked.length == 0 || !this.cropped) && 'disabled' }}, + function(){ this.removeFromCrop(this.marked) }], }) diff --git a/ui (gen4)/features/ui-ribbons.js b/ui (gen4)/features/ui-ribbons.js index dafdf469..394ef048 100755 --- a/ui (gen4)/features/ui-ribbons.js +++ b/ui (gen4)/features/ui-ribbons.js @@ -561,6 +561,7 @@ core.ImageGridFeatures.Feature({ 'collapseGroup', 'crop', 'uncrop', + 'removeFromCrop', ], function(target){ return this.reload(true) }], [[