')
+ .append($('
'))
+ .append($('
'))
+ .append($('
')
+ .click(function(){ saveSnapshot(target) })
+ .text('Save'))
+ .append($('
')
+ .addClass('remove-state-drop-target')
+ .click(function(){ clearSnapshots() })
+ .text('Clear')
+ .droppable({
+ accept: '.state',
+ activate: function(e, ui){
+ $(this).text('Delete')
+ },
+ deactivate: function(e, ui){
+ $(this).text('Clear')
+ },
+ drop: function(e, ui){
+ ui.helper.remove()
+ }
+
+ }))
+ .children()
}
+/**********************************************************************
+* Panels...
+*/
+
+Panel('Edit: Filters',
+ // build UI...
+ function(){
+ // XXX hardcoded target is not good...
+ return buildFilterUI('.current.image')
+ },
+ // setup...
+ function(panel){
+ var _editorUpdateor = function(){
+ reloadControls('.current.image')
+ }
+ panel
+ .on('panelOpening', function(){
+ // register updater...
+ $('.viewer')
+ .on('focusingImage', _editorUpdateor)
+ // update the editor state in case the target changed...
+ _editorUpdateor()
+ })
+ .on('panelClosing', function(){
+ // unregister updater...
+ $('.viewer')
+ .off('focusingImage', _editorUpdateor)
+ })
+ },
+ true)
+
+
+Panel('Edit: Snapshots',
+ // build UI...
+ function(){
+ // XXX hardcoded target is not good...
+ return buildSnapshotsUI('.current.image')
+ },
+ // setup...
+ function(panel){
+ // XXX
+ },
+ true)
+
+
+
/**********************************************************************
* vim:set sw=4 ts=4 : */
diff --git a/ui/lib/panels.js b/ui/lib/panels.js
index 86a699ca..b488288f 100755
--- a/ui/lib/panels.js
+++ b/ui/lib/panels.js
@@ -23,7 +23,7 @@ var PANEL_HELPER_HIDE_DELAY_NO_ROOT = 100
// ...
// }
//
-// The controller is generated by makePanelController(...) and is called
+// The controller is generated by Panel(...) and is called
// automatically by openPanel(...)
var PANELS = {}
@@ -441,8 +441,10 @@ function makeSubPanel(title, content, parent, open, content_resizable, close_but
// XXX this should take the state into consideration while opening panels
// and open panels in specific parents and locations, maybe even with
// other neighbor panels...
+// XXX currently parent is ignored if panel is already created, is this
+// correct???
// XXX update panel state...
-function openPanel(panel){
+function openPanel(panel, parent, no_blink){
var title = typeof(panel) == typeof('str') ? panel : null
panel = typeof(panel) == typeof('str')
? getPanel(panel)
@@ -454,7 +456,10 @@ function openPanel(panel){
if(panel.length == 0){
if(title in PANELS){
var builder = PANELS[title]
- panel = builder({ open: true })
+ panel = builder({
+ open: true,
+ parent: parent,
+ })
}
// show/open the panel and all it's parents...
@@ -480,10 +485,24 @@ function openPanel(panel){
panel.trigger('panelOpening', panel)
}
- //return panel
- // XXX should we be blinking here???
- // ...is this the right context for this???
- return blinkPanel(panel)
+ return no_blink ? panel : blinkPanel(panel)
+}
+
+
+// open a set of sub-panels in one panel...
+//
+// returns the parent panel.
+//
+// NOTE: this will not re-group already opened panels...
+function openGroupedPanels(panels, parent){
+ panels = typeof(panels) == typeof('str') ? [panels] : panels
+ parent = parent == null ? makePanel() : parent
+
+ panels.forEach(function(title){
+ openPanel(title, parent, true)
+ })
+
+ return parent
}
@@ -549,7 +568,7 @@ function removePanel(panel){
//
// NOTE: this will search an element by title, so if it is not unique
// an existing element will be returned...
-function makePanelController(title, content_builder, panel_setup, content_resizable){
+function Panel(title, content_builder, panel_setup, content_resizable){
var controller = function(state){
state = state == null ? {} : state