From adc727c75def79b9a4c53369d630ca86812bb15f Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Sun, 14 May 2017 00:06:55 +0300 Subject: [PATCH] some refactoring and cleanup... Signed-off-by: Alex A. Naanou --- ui (gen4)/css/experimenting.css | 4 +-- ui (gen4)/features/external-editor.js | 2 +- ui (gen4)/features/filesystem.js | 2 +- ui (gen4)/features/keyboard.js | 4 +-- ui (gen4)/features/metadata.js | 2 +- ui (gen4)/features/ui-partial-ribbons-vdom.js | 6 ++-- ui (gen4)/features/ui-slideshow.js | 2 +- ui (gen4)/features/ui-widgets.js | 36 +++++++++++++++++-- ui (gen4)/ig.js | 3 ++ ui (gen4)/package.json | 1 + ui (gen4)/ui.js | 11 +++--- 11 files changed, 53 insertions(+), 20 deletions(-) diff --git a/ui (gen4)/css/experimenting.css b/ui (gen4)/css/experimenting.css index 3954b5da..88e75f4b 100755 --- a/ui (gen4)/css/experimenting.css +++ b/ui (gen4)/css/experimenting.css @@ -231,12 +231,12 @@ body { /* Metadata viewer */ .item-value-view .text:first-child, -.browse-widget.metadata-view .list .item .text:first-child { +.browse-widget.table-view .list .item .text:first-child { width: 50%; font-weight: bold; } .item-value-view .text:nth-child(2), -.browse-widget.metadata-view .list .item .text:nth-child(2) { +.browse-widget.table-view .list .item .text:nth-child(2) { font-style: italic; -moz-user-select: auto; diff --git a/ui (gen4)/features/external-editor.js b/ui (gen4)/features/external-editor.js index 1222d5eb..a3f6c1c3 100755 --- a/ui (gen4)/features/external-editor.js +++ b/ui (gen4)/features/external-editor.js @@ -254,7 +254,7 @@ var ExternalEditorUIActions = actions.Actions({ }) }) - dialog.dom.addClass('metadata-view tail-action') + dialog.dom.addClass('table-view tail-action') return dialog })], diff --git a/ui (gen4)/features/filesystem.js b/ui (gen4)/features/filesystem.js index e31c5642..0c48a1ba 100755 --- a/ui (gen4)/features/filesystem.js +++ b/ui (gen4)/features/filesystem.js @@ -2404,7 +2404,7 @@ var FileSystemWriterUIActions = actions.Actions({ make.done() }) - o.dom.addClass('metadata-view tail-action') + o.dom.addClass('table-view tail-action') return o })], diff --git a/ui (gen4)/features/keyboard.js b/ui (gen4)/features/keyboard.js index 8b0701b8..f99d9fdf 100755 --- a/ui (gen4)/features/keyboard.js +++ b/ui (gen4)/features/keyboard.js @@ -1333,7 +1333,7 @@ var KeyboardUIActions = actions.Actions({ }) }, { - cls: 'metadata-view', + cls: 'table-view', }) // save the keys... // XXX for some reason when Esc this is called twice... @@ -1439,7 +1439,7 @@ var KeyboardUIActions = actions.Actions({ }) }, { - cls: 'metadata-view', + cls: 'table-view', }) .on('close', function(){ if(abort){ diff --git a/ui (gen4)/features/metadata.js b/ui (gen4)/features/metadata.js index 3ad78fb5..93770d4c 100755 --- a/ui (gen4)/features/metadata.js +++ b/ui (gen4)/features/metadata.js @@ -517,7 +517,7 @@ var MetadataUIActions = actions.Actions({ // XXX }) - o.dom.addClass('metadata-view') + o.dom.addClass('table-view') o.updateMetadata = function(metadata){ metadata = metadata || that.getMetadata() diff --git a/ui (gen4)/features/ui-partial-ribbons-vdom.js b/ui (gen4)/features/ui-partial-ribbons-vdom.js index ef7c36e4..8a7dc996 100755 --- a/ui (gen4)/features/ui-partial-ribbons-vdom.js +++ b/ui (gen4)/features/ui-partial-ribbons-vdom.js @@ -486,15 +486,15 @@ object.makeConstructor('VirtualDOMRibbons', /*********************************************************************/ // XXX TODO: -// - image update (try and avoid external edits and do it in .virtualdom) -// - image size/proportions (single image view)... -// - preview update... // - shifting images/ribbons // - use .virtualdom.sync() + shadow animation instead of .ribbons.* // ...the added marker div messes up virtual-dom... // - would be nice to make this an alternative feature... // ...split out ribbon editing into a feature and do two // implementations, the original and virtualdom... +// - image update (try and avoid external edits and do it in .virtualdom) +// - image size/proportions (single image view)... +// - preview update... // - make marks more modular... // - ranges // diff --git a/ui (gen4)/features/ui-slideshow.js b/ui (gen4)/features/ui-slideshow.js index 15e58f0f..3215988d 100755 --- a/ui (gen4)/features/ui-slideshow.js +++ b/ui (gen4)/features/ui-slideshow.js @@ -127,7 +127,7 @@ var SlideshowActions = actions.Actions({ }, { path: that.toggleSlideshow('?') == 'on' ? 'Stop' : 'Start', - cls: 'metadata-view tail-action', + cls: 'table-view tail-action', }) .on('close', function(){ // reset the timer if it was not suspended outside... diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index 84a5ffe1..312babc0 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -792,9 +792,13 @@ module.Dialogs = core.ImageGridFeatures.Feature({ if(res instanceof widget.Widget){ var elem = res.dom - !elem.attr('keep-dialog-title') - && !this.getActionAttr(action, 'keepDialogTitle') - && elem.attr('dialog-title', this.getDocTitle(action)) + var title = this.getActionAttr(action, 'dialogTitle') + + title ? + elem.attr('dialog-title', title) + : !elem.attr('keep-dialog-title') + && !this.getActionAttr(action, 'keepDialogTitle') + && elem.attr('dialog-title', this.getDocTitle(action)) } }], ], @@ -1316,6 +1320,32 @@ var BrowseActionsActions = actions.Actions({ this.modal.client.dom.hasClass('browse-actions') && this.modal.client.dom[state == 'on' ? 'addClass' : 'removeClass']('show-keys') })], + + // XXX is this the right way to go??? + about: ['Help/About...', + {'dialogTitle': 'ImageGrid.Viewer'}, + makeUIDialog(function(path, options){ + return browse.makeList( + null, + [ + // XXX get this from package.json... + ['Version:', '4.0.0a'], + + // XXX build date... + + '---', + + ['License:', 'Pre Release'], + + // XXX include other lib list and license info... + // XXX + + // XXX include nw credits.html... + // XXX + ], { + cls: 'table-view' + }) + })], }) var BrowseActions = diff --git a/ui (gen4)/ig.js b/ui (gen4)/ig.js index f8982892..82d0d4f8 100644 --- a/ui (gen4)/ig.js +++ b/ui (gen4)/ig.js @@ -17,6 +17,9 @@ requirejs.config({ //urlArgs: 'bust='+Date.now(), paths: { + //text: 'node_modules/requirejs-plugins/lib/text', + //json: 'node_modules/requirejs-plugins/src/json', + 'lib/object': 'node_modules/ig-object/object', 'lib/actions': 'node_modules/ig-actions/actions', 'lib/features': 'node_modules/ig-features/features', diff --git a/ui (gen4)/package.json b/ui (gen4)/package.json index b1c00caa..decac9b3 100755 --- a/ui (gen4)/package.json +++ b/ui (gen4)/package.json @@ -27,6 +27,7 @@ "ig-object": "^1.0.1", "openseadragon": "^2.1.0", "requirejs": "^2.1.23", + "requirejs-plugins": "^1.0.2", "sharp": "^0.17.0", "wildglob": "^0.1.1" }, diff --git a/ui (gen4)/ui.js b/ui (gen4)/ui.js index 8c665167..5e7d8f61 100755 --- a/ui (gen4)/ui.js +++ b/ui (gen4)/ui.js @@ -24,6 +24,9 @@ if((typeof(process) != 'undefined' ? process : {}).__nwjs){ // a way of organizing things without so much manual hoop jumping... var requirejs_cfg = { paths: { + //text: 'node_modules/requirejs-plugins/lib/text', + //json: 'node_modules/requirejs-plugins/src/json', + // XXX one approach to avoid at least this section is to copy the // modules to lib/*, this way we'll need the map section below // only... (without automation this also sounds bad) @@ -114,12 +117,6 @@ $(function(){ //'-commandline', //'-ui-partial-ribbons', - - // XXX BUG: disabling features on this level does not - // work, yet works deeper down... - // Example: - // '-ui' // will throw an error: - // // Feature "-ui" not loaded... ]) @@ -144,6 +141,8 @@ $(function(){ ig.features.features.length, ig.features.features) + + // setup logger... // XXX STUB... ig.logger = ig.logger || { root: true,