diff --git a/buildcache.py b/buildcache.py old mode 100644 new mode 100755 diff --git a/ui (gen4)/client.js b/ui (gen4)/client.js new file mode 100755 index 00000000..add8a7ed --- /dev/null +++ b/ui (gen4)/client.js @@ -0,0 +1,58 @@ +/********************************************************************** +* +* +* +**********************************************************************/ + +//var DEBUG = DEBUG != null ? DEBUG : true + +define(function(require){ var module = {} +console.log('>>> ui') + +doc = require('keyboard').doc + +data = require('data') + + + +/*********************************************************************/ + +var CLIENT_ACTIONS = { + // this expects the folowing attrs: + // + // .data + // + + focusImage: doc('Focus Image', + // XXX do we need to account for event first argument here??? + function(gid){ + this.data.focusImage(gid) + return this + }), + + // target can be: + // - current + // - base + // - before + // - after + // + focusRibbon: doc('Focus ribbon', + function(target){ + var cur = this.data.getRibbonIndex() + var ribbon = this.data.getRibbon(target) + var t = this.data.getRibbonIndex(ribbon) + + // XXX revise this... + var direction = t < cur ? 'before' : 'after' + + return this.focusImage( + this.data.getImage(ribbon, direction)) + }), +} + + + + +/********************************************************************** +* vim:set ts=4 sw=4 : */ +return module }) diff --git a/ui (gen4)/data.js b/ui (gen4)/data.js index c1c7b900..4125b7d3 100755 --- a/ui (gen4)/data.js +++ b/ui (gen4)/data.js @@ -621,6 +621,12 @@ module.DataPrototype = { // .getRibbon('base') // -> base ribbon gid // + // Get ribbon before/after current + // .getRibbon('before') + // .getRibbon('after') + // -> gid + // -> null + // // Get ribbon by target image/ribbon: // .getRibbon(ribbon|order|gid) // -> ribbon gid @@ -642,6 +648,12 @@ module.DataPrototype = { // NOTE: this expects ribbon order and not image order. getRibbon: function(target, offset){ target = target == null ? this.current : target + + if(target == 'before' || target == 'after'){ + target = this.current + offset = target + } + offset = offset == null ? 0 : offset offset = offset == 'before' ? -1 : offset offset = offset == 'after' ? 1 : offset