From 0e34d92a4db2ff92c47c95a6cb27d43fb1d4231c Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sat, 12 Mar 2016 06:24:35 +0300 Subject: [PATCH] started work on slideshow feature -- ui still in design... Signed-off-by: Alex A. Naanou --- ui (gen4)/features/all.js | 1 + ui (gen4)/features/meta.js | 3 + ui (gen4)/features/ui-slideshow.js | 90 ++++++++++++++++++++++++++++++ ui (gen4)/features/ui-widgets.js | 18 +++--- 4 files changed, 105 insertions(+), 7 deletions(-) create mode 100755 ui (gen4)/features/ui-slideshow.js diff --git a/ui (gen4)/features/all.js b/ui (gen4)/features/all.js index f8085eb4..12e6de76 100755 --- a/ui (gen4)/features/all.js +++ b/ui (gen4)/features/all.js @@ -18,6 +18,7 @@ var ui = require('features/ui') var status = require('features/ui-status') var marks = require('features/ui-marks') var widgets = require('features/ui-widgets') +var slideshow = require('features/ui-slideshow') var exteditor = require('features/external-editor') var metadata = require('features/metadata') var meta = require('features/meta') diff --git a/ui (gen4)/features/meta.js b/ui (gen4)/features/meta.js index 494559b8..a7236f5e 100755 --- a/ui (gen4)/features/meta.js +++ b/ui (gen4)/features/meta.js @@ -111,6 +111,9 @@ core.ImageGridFeatures.Feature('viewer-testing', [ 'ui-context-action-menu', 'ui-widget-test', + // slideshow... + 'ui-slideshow', + // ui control... 'ui-clickable', //'ui-autohide-cursor', diff --git a/ui (gen4)/features/ui-slideshow.js b/ui (gen4)/features/ui-slideshow.js new file mode 100755 index 00000000..289d4f4b --- /dev/null +++ b/ui (gen4)/features/ui-slideshow.js @@ -0,0 +1,90 @@ +/********************************************************************** +* +* +* +**********************************************************************/ + +define(function(require){ var module = {} + +//var DEBUG = DEBUG != null ? DEBUG : true + +var toggler = require('lib/toggler') +var actions = require('lib/actions') +var features = require('lib/features') + +var core = require('features/core') +var base = require('features/base') + + + +/*********************************************************************/ + +// XXX stub... +var SlideshowActions = actions.Actions({ + config: { + }, + + // XXX + // /Slideshow/ + // Interval (3)/ -- not a toggler + // 0.2 + // 1 + // 3* + // 5 + // Custom... -- click to edit + // Direction (forward)/ + // forward* + // revrse + // Looping (on)/ + // on* + // off + // Start + // XXX need to set the default value in title... + // XXX might be a good idea to make this with an editable value... + // i.e. + // Interval: 3s / -- 3s is editable... + // 0.2 x -- a history of values that can be + // selected w/o closing the dialog + // or can be removed... + // 1 x + // 3 x + // Custom... -- editable/placeholder... 'enter' + // selects value and adds it to + // history... + selectSlideshowInterval: ['Slideshow/Interval/*', + // XXX make this a custom menu rather than a lister... (???) + function(path, make){ + make('0.2') + make('1') + make('3') + make('Custom...') + }], + toggleSlideshowDirection: ['Slideshow/Direction', + function(){}], + toggleSlideshowLooping: ['Slideshow/Looping', + function(){}], + toggleSlideshow: ['Slideshow/Start', + function(){}], +}) + + +var Slideshow = +module.Slideshow = core.ImageGridFeatures.Feature({ + title: '', + doc: '', + + tag: 'ui-slideshow', + depends: [ + 'ui', + ], + + actions: SlideshowActions, +}) + + + + + +/********************************************************************** +* vim:set ts=4 sw=4 : */ +return module }) diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index cd18e542..3f9ea86b 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -40,7 +40,7 @@ var makeActionLister = function(list, filter, pre_order){ return function(path, inline_state){ inline_state = inline_state == null ? - that.config['actions-list-show-toggler-state-inline'] + this.config['actions-list-show-toggler-state-inline'] : inline_state var that = this @@ -62,6 +62,13 @@ var makeActionLister = function(list, filter, pre_order){ var n = paths[k][0] var k = filter ? filter(k, n) : k + // prepare for toggler stuff... + var isToggler = that.isToggler && that.isToggler(n) || false + if(isToggler){ + var cur_state = that[n]('?') + k = k +(inline_state ? (' ('+ cur_state +')') : '') + } + // XXX this expects that .client will trigger an open event... var waitFor = function(child){ // we got a widget, wait for it to close... @@ -85,19 +92,16 @@ var makeActionLister = function(list, filter, pre_order){ } // toggler -- add state list... - if(that.isToggler && that.isToggler(n)){ + if(isToggler){ var states = that[n]('??') - var cur = that[n]('?') // bool toggler... - if(cur == 'on' || cur == 'off'){ + if(cur_state == 'on' || cur_state == 'off'){ states = ['off', 'on'] } states.forEach(function(state){ - //actions[k +'/'+ state + (cur == state ? ' *': '')] = - actions[k +(inline_state ? (' ('+ cur +')') : '') - +'/'+ state + (cur == state ? ' *': '')] = + actions[k +'/'+ state + (cur_state == state ? ' *': '')] = function(){ that[n](state) }