diff --git a/ui (gen4)/features/cli.js b/ui (gen4)/features/cli.js index 0933addb..a78df793 100755 --- a/ui (gen4)/features/cli.js +++ b/ui (gen4)/features/cli.js @@ -50,6 +50,9 @@ var CLIActions = actions.Actions({ function(path){ var that = this + // XXX is this correct??? + path = path || this.location.path + return this.loadImages(path) .then(function(){ return that.makePreviews('all') }) .then(function(){ return that.sortImages() }) diff --git a/ui (gen4)/features/core.js b/ui (gen4)/features/core.js index d5211ef1..15e536be 100755 --- a/ui (gen4)/features/core.js +++ b/ui (gen4)/features/core.js @@ -11,6 +11,7 @@ define(function(require){ var module = {} // XXX var DEBUG = typeof(DEBUG) != 'undefined' ? DEBUG : true +var object = require('lib/object') var actions = require('lib/actions') var features = require('lib/features') var toggler = require('lib/toggler') @@ -57,10 +58,19 @@ function(attr, states, a, b){ /*********************************************************************/ -// Root ImageGrid.viewer object... +// Root ImageGrid.viewer object constructor... // +var ImageGrid = object.makeConstructor('ImageGrid', actions.MetaActions) + +// Root ImageGrid feature set.... var ImageGridFeatures = -module.ImageGridFeatures = Object.create(features.FeatureSet) +module.ImageGridFeatures = new features.FeatureSet() + +// setup base instance constructor... +ImageGridFeatures.__actions__ = function(){ + return actions.Actions(ImageGrid()) +} + //--------------------------------------------------------------------- diff --git a/ui (gen4)/lib/actions.js b/ui (gen4)/lib/actions.js index 32f2722d..8d9b6eba 100755 --- a/ui (gen4)/lib/actions.js +++ b/ui (gen4)/lib/actions.js @@ -1202,10 +1202,15 @@ module.MetaActions = { if(this.__proto__.config && !Object.hasOwnProperty(this, 'config')){ this.config = Object.create(this.__proto__.config) } - } + }, } +var ActionSet = +module.ActionSet = +object.makeConstructor('ActionSet', MetaActions) + + // An action set... // @@ -1249,13 +1254,12 @@ module.MetaActions = { // // XXX add doc, ldoc, tags and save them to each action... // XXX is .config processing correct here??? -// XXX should this be a full fledged object??? var Actions = module.Actions = function Actions(a, b){ var obj = b == null ? a : b - var proto = b == null ? MetaActions : a - obj = obj || {} + var proto = b == null ? b : a + obj = obj || new ActionSet() // NOTE: this is intentionally done only for own attributes... Object.keys(obj).forEach(function(k){ diff --git a/ui (gen4)/lib/features.js b/ui (gen4)/lib/features.js index 90f5d19f..4cece301 100755 --- a/ui (gen4)/lib/features.js +++ b/ui (gen4)/lib/features.js @@ -11,6 +11,7 @@ define(function(require){ var module = {} var args2array = require('lib/util').args2array var actions = require('lib/actions') +var object = require('lib/object') @@ -231,9 +232,9 @@ Feature.prototype = FeatureProto Feature.prototype.constructor = Feature -var FeatureSet = -module.FeatureSet = { +var FeatureSetProto = { __feature__: Feature, + __actions__: actions.Actions, // if true, .setup(..) will report things it's doing... __verbose__: null, @@ -582,7 +583,8 @@ module.FeatureSet = { obj = null } - obj = obj || actions.Actions() + obj = obj || (this.__actions__ || actions.Actions)() + lst = lst.constructor !== Array ? [lst] : lst var features = this.buildFeatureList(obj, lst) lst = features.features @@ -658,10 +660,15 @@ module.FeatureSet = { } +var FeatureSet = +module.FeatureSet = object.makeConstructor('FeatureSet', FeatureSetProto) + + //--------------------------------------------------------------------- var Features = -module.Features = Object.create(FeatureSet) +module.Features = new FeatureSet() +