diff --git a/ui (gen4)/features/base.js b/ui (gen4)/features/base.js index 68d82cdf..adddd9df 100755 --- a/ui (gen4)/features/base.js +++ b/ui (gen4)/features/base.js @@ -1040,7 +1040,7 @@ module.CropActions = actions.Actions({ // XXX not sure if we actually need this... cropFlatten: ['Crop/Flatten', function(list){ this.data.length > 0 && this.crop(list, true) }], - cropRibbon: ['Crop/Crop current ribbon', + cropRibbon: ['Crop/Crop ribbon', function(ribbon, flatten){ if(this.data.length == 0){ return @@ -1052,7 +1052,38 @@ module.CropActions = actions.Actions({ ribbon = ribbon || 'current' this.crop(this.data.getImages(ribbon), flatten) }], - cropRibbonAndAbove: ['Crop/Crop out ribbons bellow', + cropOutRibbon: ['Crop/Crop ribbon out', + function(ribbon, flatten){ + ribbon = ribbon || this.current_ribbon + ribbon = ribbon instanceof Array ? ribbon : [ribbon] + + // build the crop... + var crop = this.data.crop() + + // ribbon order... + crop.ribbon_order = crop.ribbon_order + .filter(function(r){ return ribbon.indexOf(r) }) + + // ribbons... + ribbon.forEach(function(r){ delete crop.ribbons[r] }) + + // focus image... + var cr = this.current_ribbon + if(ribbon.indexOf(cr) >= 0){ + var i = this.data.getRibbonOrder(cr) + var r = this.data.ribbon_order + .slice(i+1) + .concat(this.data.ribbon_order.slice(0, i)) + .filter(function(r){ return crop.ribbons[r] && crop.ribbons[r].len > 0 }) + .shift() + crop.focusImage( + crop.getImage(this.current, 'after', r) + || crop.getImage(this.current, 'before', r)) + } + + this.crop(crop, flatten) + }], + cropOutRibbonsBelow: ['Crop/Crop out ribbons bellow', function(ribbon, flatten){ if(this.data.length == 0){ return diff --git a/ui (gen4)/features/core.js b/ui (gen4)/features/core.js index fba2b656..d3ce8587 100755 --- a/ui (gen4)/features/core.js +++ b/ui (gen4)/features/core.js @@ -14,10 +14,10 @@ * * * Features: +* - introspection * - lifecycle * base life-cycle events (start/stop/..) * - util -* - introspection * - journal * action journaling and undo/redo functionality * XXX needs revision... @@ -400,7 +400,7 @@ var LifeCycleActions = actions.Actions({ // System ready event... // // Not intended for direct use, use .declareReady() to initiate. - this.logger && this.logger.emit('start') + this.logger && this.logger.emit('ready') })], // NOTE: this calls .ready() once per session. declareReady: ['- System/Declare system ready', @@ -418,8 +418,6 @@ var LifeCycleActions = actions.Actions({ function(){ return this.__ready_announce_requested = (this.__ready_announce_requested || 0) + 1 }], - - // unbind events... stop: ['- System/', function(){ // browser & nw... diff --git a/ui (gen4)/features/keyboard.js b/ui (gen4)/features/keyboard.js index 479ebb27..55ee13d2 100755 --- a/ui (gen4)/features/keyboard.js +++ b/ui (gen4)/features/keyboard.js @@ -331,7 +331,8 @@ module.GLOBAL_KEYBOARD = { // cropping... F2: 'cropRibbon', - shift_F2: 'cropRibbonAndAbove', + D: 'cropOutRibbon', + shift_F2: 'cropOutRibbonsBelow', ctrl_F2: 'cropMarked', alt_F2: 'cropBookmarked', C: 'browseActions: "/Crop/" -- Crop menu...', diff --git a/ui (gen4)/imagegrid/data.js b/ui (gen4)/imagegrid/data.js index 475c7b51..3e05ecc9 100755 --- a/ui (gen4)/imagegrid/data.js +++ b/ui (gen4)/imagegrid/data.js @@ -2306,18 +2306,29 @@ var DataPrototype = { // NOTE: this will not crop the .order... crop: function(list, flatten){ var crop = this.clone() - list = crop.makeSparseImages(list) + list = list == null || list == '*' ? + '*' + : crop.makeSparseImages(list) if(!flatten){ + if(list == '*'){ + return crop + } // place images in ribbons... for(var k in crop.ribbons){ - crop.ribbons[k] = crop.makeSparseImages(crop.ribbons[k].filter(function(_, i){ - return list[i] != null - })) + crop.ribbons[k] = crop.makeSparseImages( + crop.ribbons[k] + .filter(function(_, i){ return list[i] != null })) } // flatten the crop... } else { + list = list == '*' ? + crop.makeSparseImages( + crop.ribbon_order + .map(function(r){ return crop.ribbons[r] }) + .reduce(function(a, b){ return a.concat(b) }, [])) + : list crop.ribbons = {} crop.ribbon_order = [] crop.ribbons[crop.newRibbon()] = list