diff --git a/ui (gen4)/features/ui-slideshow.js b/ui (gen4)/features/ui-slideshow.js index 51f52a10..32078190 100755 --- a/ui (gen4)/features/ui-slideshow.js +++ b/ui (gen4)/features/ui-slideshow.js @@ -36,10 +36,6 @@ var SlideshowActions = actions.Actions({ 'slideshow-looping': 'on', 'slideshow-direction': 'forward', 'slideshow-interval': '3s', - 'slideshow-interval-max-count': 7, - - 'slideshow-pause-on-blur': true, - 'slideshow-intervals': [ '0.2s', '1s', @@ -47,6 +43,10 @@ var SlideshowActions = actions.Actions({ '5s', '7s', ], + 'slideshow-interval-max-count': 7, + + 'slideshow-pause-on-blur': true, + }, toggleSlideshow: ['Slideshow/$Slideshow quick toggle', @@ -133,62 +133,11 @@ var SlideshowActions = actions.Actions({ slideshowDialog: ['Slideshow/Slideshow...', widgets.makeUIDialog(function(){ var that = this - - // suspend the timer if it's not suspended outside... - var suspended_timer = this.__slideshow_timer == 'suspended' - suspended_timer || this.suspendSlideshowTimer() - - // XXX might be a good idea to make this generic... - var _makeToggleHandler = function(o, toggler){ - return function(){ - var txt = $(this).find('.text').first().text() - that[toggler]() - o.update() - .then(function(){ o.select(txt) }) - that.toggleSlideshow('?') == 'on' - && o.close() - } - } - - return browse.makeLister(null, function(path, make){ - make(['$Interval: ', - function(){ return that.config['slideshow-interval'] }]) - .on('open', function(){ - that.slideshowIntervalDialog(make.dialog) }) - - make(['$Direction: ', - function(){ return that.config['slideshow-direction'] }]) - .on('open', _makeToggleHandler(make.dialog, 'toggleSlideshowDirection')) - make(['$Looping: ', - function(){ return that.config['slideshow-looping'] }]) - .on('open', _makeToggleHandler(make.dialog, 'toggleSlideshowLooping')) - - // Start/stop... - make([function(){ - return that.toggleSlideshow('?') == 'on' ? '$Stop' : '$Start' }]) - .on('open', function(){ - that.toggleSlideshow() - make.dialog.close() - }) - }, - { - path: that.toggleSlideshow('?') == 'on' ? 'Stop' : 'Start', - cls: 'table-view tail-action', - }) - .on('close', function(){ - // reset the timer if it was not suspended outside... - suspended_timer - || that.resetSlideshowTimer() - }) - })], - slideshowDialog2: ['Slideshow/Slideshow (new)...', - widgets.makeUIDialog(function(){ - var that = this + var spec // suspend the timer if it's not suspended outside... var suspended_timer = this.__slideshow_timer == 'suspended' suspended_timer || this.suspendSlideshowTimer() - var spec return browse.makeLister(null, function(path, make){ @@ -196,35 +145,22 @@ var SlideshowActions = actions.Actions({ that.makeEditor(make, spec = spec || [ - // XXX move this to the interval editor... { title: '$Interval: ', type: 'configToggle', key: 'slideshow-interval', values_key: 'slideshow-intervals', - /* XXX + nonstrict: true, list: function(cur, set){ - this.slideshowIntervalDialog() - .close(function(){ - // XXX this works only once per dialog instance... - set() }) }, }, - /*/ - values_key: 'slideshow-intervals', - list_editable: true, - list: { - length_limit: that.config['slideshow-interval-max-count'], - check: Date.str2ms, - unique: Date.str2ms, - normalize: function(e){ return e.trim() }, - sort: function(a, b){ - return Date.str2ms(a) - Date.str2ms(b) }, - sortable: false, }, }, - //*/ + this.slideshowIntervalDialog() + .close(function(){ set() }) }, }, { title: '$Direction: ', type: 'toggler', - toggler: 'toggleSlideshowDirection', }, + toggler: 'toggleSlideshowDirection', + live_update: true, }, { title: '$Looping: ', type: 'toggler', - toggler: 'toggleSlideshowLooping', }, ]) + toggler: 'toggleSlideshowLooping', + live_update: true, }, ]) // Start/stop... make([function(){ return that.toggleSlideshow('?') == 'on' ? '$Stop' : '$Start' }], @@ -234,8 +170,8 @@ var SlideshowActions = actions.Actions({ },{ path: that.toggleSlideshow('?') == 'on' ? 'Stop' : 'Start', cls: 'table-view tail-action', + // reset the timer if it was not suspended outside... close: function(){ - // reset the timer if it was not suspended outside... suspended_timer || that.resetSlideshowTimer() }, }) })], @@ -258,7 +194,7 @@ var SlideshowActions = actions.Actions({ // settings... // NOTE: these are disabled as they are repeated in the slideshow dialog... - // XXX do we need both these and the dialog??? + // XXX do we need both this and .slideshowDialog(???)??? slideshowIntervalDialog: ['- Slideshow/Slideshow $interval...', widgets.makeUIDialog(function(parent){ var that = this @@ -290,8 +226,7 @@ var SlideshowActions = actions.Actions({ parent.update() .then(function(){ txt != '' - && parent.select(txt) - }) + && parent.select(txt) }) } }) return dialog @@ -304,6 +239,7 @@ var SlideshowActions = actions.Actions({ toggleSlideshowPauseOnBlur: ['Interface|Slideshow/Slideshow pause on app blur', core.makeConfigToggler('slideshow-pause-on-blur', ['on', 'off'])], + // XXX make these stack-like... resetSlideshowTimer: ['- Slideshow/Reset slideshow timer', function(){ this.__slideshow_timer && this.toggleSlideshow('on') }], @@ -314,6 +250,7 @@ var SlideshowActions = actions.Actions({ this.__slideshow_timer = 'suspended' } }], + toggleSlideshowTimer: ['Slideshow/Pause or resume running slideshow', core.doc` diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index c62668f8..1e64931f 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -972,24 +972,25 @@ var EditorActions = actions.Actions({ // NOTE: we are not supporting aliases here as we need to pass strings // as-is into .makeEditorBlock(..)'s spec to be able to create things // like '---' ->