mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-28 18:00:09 +00:00
some cleanup + testing + doc...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
7c623d7c76
commit
7e7cc8a168
@ -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')
|
||||
|
||||
|
||||
@ -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: $('<div>')
|
||||
.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
|
||||
})],
|
||||
|
||||
|
||||
|
||||
@ -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...
|
||||
|
||||
@ -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')
|
||||
|
||||
|
||||
|
||||
|
||||
@ -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)){
|
||||
|
||||
@ -317,6 +317,7 @@ function(elem, state_accessor, states, callback_a, callback_b){
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
func.__proto__ = Toggler.prototype
|
||||
func.constructor = Toggler
|
||||
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user