From 5e3d6ead54145c457ae9b2ea4545e412428a893e Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 7 Nov 2015 19:44:52 +0300 Subject: [PATCH] now everything is a feature... Signed-off-by: Alex A. Naanou --- ui (gen4)/lib/actions.js | 2 ++ ui (gen4)/lib/features.js | 2 ++ ui (gen4)/ui.js | 9 ++++++--- ui (gen4)/viewer.js | 36 +++++++++++++++++++++++++++++++----- 4 files changed, 41 insertions(+), 8 deletions(-) diff --git a/ui (gen4)/lib/actions.js b/ui (gen4)/lib/actions.js index 143da90b..2eb043d9 100755 --- a/ui (gen4)/lib/actions.js +++ b/ui (gen4)/lib/actions.js @@ -760,11 +760,13 @@ 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 || {} // 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 4338cfbe..8a80b951 100755 --- a/ui (gen4)/lib/features.js +++ b/ui (gen4)/lib/features.js @@ -563,6 +563,8 @@ module.FeatureSet = { setup.call(that[n], obj) } }) + + return obj }, remove: function(obj, lst){ lst = lst.constructor !== Array ? [lst] : lst diff --git a/ui (gen4)/ui.js b/ui (gen4)/ui.js index ae4e5a4b..0f163f07 100755 --- a/ui (gen4)/ui.js +++ b/ui (gen4)/ui.js @@ -37,7 +37,7 @@ var browser = require('browser') var nw = require('nw') // XXX load only the actualy used here modules... -var actions = require('actions') +var actions = require('lib/actions') var data = require('data') var ribbons = require('ribbons') @@ -240,8 +240,8 @@ module.GLOBAL_KEYBOARD = { $(function(){ - // XXX - window.a = testing.setupActions() + // XXX stub action set -- this needs to be auto-generated... + window.a = actions.Actions() // used switch experimental actions on (set to true) or off (unset or false)... //a.experimental = true @@ -283,6 +283,7 @@ $(function(){ // setup base keyboard for devel, in case something breaks... + // This branch does not drop keys... if(module.MAX_KEY_REPEAT_RATE < 0 || module.MAX_KEY_REPEAT_RATE == null){ $(document) .keydown( @@ -293,6 +294,8 @@ $(function(){ }, a)) + // drop keys if repeating to fast... + // NOTE: this is done for smoother animations... } else { $(document) .keydown( diff --git a/ui (gen4)/viewer.js b/ui (gen4)/viewer.js index b0b5ffb8..0c162245 100755 --- a/ui (gen4)/viewer.js +++ b/ui (gen4)/viewer.js @@ -142,6 +142,13 @@ function makeTagWalker(direction, dfl_tag){ +/*********************************************************************/ + +var ImageGridFeatures = +module.ImageGridFeatures = Object.create(features.FeatureSet) + + + /*********************************************************************/ // // XXX Tasks to accomplish here: @@ -152,8 +159,8 @@ function makeTagWalker(direction, dfl_tag){ // // -var Client = -module.Client = +var BaseActions = +module.BaseActions = actions.Actions({ config: { @@ -781,11 +788,19 @@ actions.Actions({ }) +var Base = +module.Base = ImageGridFeatures.Feature({ + title: 'ImageGrid base', -/*********************************************************************/ + tag: 'base', -var ImageGridFeatures = -module.ImageGridFeatures = Object.create(features.FeatureSet) + config: { + // see .direction for details... + 'steps-to-change-direction': 3, + }, + + actions: BaseActions, +}) @@ -1298,6 +1313,8 @@ module.Viewer = ImageGridFeatures.Feature({ tag: 'ui', + depends: ['base'], + config: { // The maximum screen width allowed when zooming... 'max-screen-images': 30, @@ -1342,6 +1359,8 @@ module.Journal = ImageGridFeatures.Feature({ tag: 'system-journal', + depends: ['base'], + actions: actions.Actions({ // XXX might be good to add some kind of metadata to journal... journalPush: ['Journal/Add an item to journal', @@ -2666,6 +2685,8 @@ module.ImageMarks = ImageGridFeatures.Feature({ tag: 'image-marks', + depends: ['base'], + actions: ImageMarkActions, handlers: [ @@ -2728,6 +2749,8 @@ module.ImageBookmarks = ImageGridFeatures.Feature({ tag: 'image-bookmarks', + depends: ['base'], + actions: ImageBookmarkActions, handlers: [ @@ -2818,6 +2841,8 @@ module.FileSystemLoader = ImageGridFeatures.Feature({ // ImageGridFeatures.Feature('viewer-testing', [ + 'base', + 'ui', // features... @@ -2850,6 +2875,7 @@ ImageGridFeatures.Feature('viewer-testing', [ ]) ImageGridFeatures.Feature('viewer-minimal', [ + 'base', 'ui', 'ui-ribbon-align-to-order', 'ui-animation',