diff --git a/ui (gen4)/features/filesystem.js b/ui (gen4)/features/filesystem.js index e5971b0d..11c3349c 100755 --- a/ui (gen4)/features/filesystem.js +++ b/ui (gen4)/features/filesystem.js @@ -24,6 +24,7 @@ var util = require('lib/util') var actions = require('lib/actions') var features = require('lib/features') +var keyboard = require('lib/keyboard') var core = require('features/core') diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index eff6f7b7..9035015a 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -470,6 +470,16 @@ var DialogsActions = actions.Actions({ // XXX console.error('Not yet implemented.') })], + + // like panel but drop down from mouse location or specified position + DropDown: ['- Interface/', + makeUIContainer(function(dialog, options){ + // XXX + console.error('Not yet implemented.') + })], + + // XXX STUB -- need a real panel with real docking and closing + // ability... // XXX need to: // - dock panels // - save panel state (position, collapse, dock, ...) @@ -477,7 +487,30 @@ var DialogsActions = actions.Actions({ Panel: ['- Interface/', makeUIContainer(function(dialog, options){ // XXX - console.error('Not yet implemented.') + //console.error('Not yet implemented.') + + var panel = { + client: dialog, + dom: $('
') + .append(dialog.dom || dialog) + .appendTo(this.ribbons.viewer) + .draggable(), + close: function(func){ + if(func){ + this.dom.on('close', func) + } else { + this.dom.trigger('close') + this.dom.remove() + } + return this + }, + } + + dialog.on('blur', function(){ + panel.close() + }) + + return panel })], diff --git a/ui (gen4)/lib/actions.js b/ui (gen4)/lib/actions.js index 5270c8f9..8143dfde 100755 --- a/ui (gen4)/lib/actions.js +++ b/ui (gen4)/lib/actions.js @@ -79,7 +79,7 @@ var object = require('lib/object') // // // -// The action system provides three components: +// The action system provides these components: // // 1) Documentation generation and introspection (MetaActions) // @@ -128,6 +128,61 @@ var object = require('lib/object') // referenced and called from any object and still chain correctly. // // +// 4) A mechanism to chain/wrap actions or an action and a function. +// This enables us to call a callback or another action (inner) between +// the root action's (outer) pre and post stages. +// +// Outer action o-------x o-------x +// v ^ +// Inner action/callback o---|---x +// +// A trivial example: +// +// actionSet.someAction.chainApply(actionsSet, +// function(){ +// // this gets run between someAction's pre and post +// // stages... +// }, +// args) +// +// This is intended to implement protocols where a single action is +// intended to act as a hook point (outer) and multiple different +// implementations (inner) within a single action set can be used as +// entry points. +// +// // Protocol root action (outer) definition... +// protocolAction: [function(){}], +// +// // Implementation actions (inner)... +// implementationAction1: [function(){ +// return this.protocolAction.chainApply(this, function(){ +// // ... +// }, ..) +// }] +// +// implementationAction2: [function(){ +// return this.protocolAction.chainApply(this, function(){ +// // ... +// }, ..) +// }] +// +// Now calling any of the 'implementation' actions will execute code +// in the following order: +// 1) pre phase of protocol action (outer) +// 2) implementation action (inner) +// 3) post phase of protocol action (outer) +// +// NOTE: this will not affect to protocol/signature of the outer action +// in any way. +// NOTE: both the inner and outer actions will get passed the same +// arguments. +// NOTE: another use-case is testing/debugging actions. +// NOTE: this is effectively the inside-out of normal action overloading. +// NOTE: there is intentionally no shorthand for this feature, to avoid +// confusion and to discourage the use of this feature unless +// really necessary. +// +// // /*********************************************************************/ // helpers... diff --git a/ui (gen4)/lib/features.js b/ui (gen4)/lib/features.js index 1c92970c..3b13faf0 100755 --- a/ui (gen4)/lib/features.js +++ b/ui (gen4)/lib/features.js @@ -8,9 +8,9 @@ define(function(require){ var module = {} //var DEBUG = DEBUG != null ? DEBUG : true -args2array = require('lib/util').args2array +var args2array = require('lib/util').args2array -actions = require('lib/actions') +var actions = require('lib/actions') diff --git a/ui (gen4)/lib/object.js b/ui (gen4)/lib/object.js index 69fb2335..19aa2856 100755 --- a/ui (gen4)/lib/object.js +++ b/ui (gen4)/lib/object.js @@ -166,8 +166,12 @@ function makeConstructor(name, a, b){ return obj } - // this is here to make Chrome output more user friendly... - // skip for IE... + Object.defineProperty(_constructor, 'name', { + value: name, + }) + + // just in case the browser refuses to change the name, we'll make it + // a different offer ;) if(_constructor.name == 'Constructor'){ // skip for chrome app... //&& !(window.chrome && chrome.runtime && chrome.runtime.id)){ diff --git a/ui (gen4)/lib/toggler.js b/ui (gen4)/lib/toggler.js index e3b327d3..6749e2b9 100755 --- a/ui (gen4)/lib/toggler.js +++ b/ui (gen4)/lib/toggler.js @@ -317,6 +317,7 @@ function(elem, state_accessor, states, callback_a, callback_b){ } } + func.__proto__ = Toggler.prototype func.constructor = Toggler