From 0a57cb7c3aa80c2a8ce2e6673b966f98b82878f3 Mon Sep 17 00:00:00 2001 From: "Alex A. Naanou" Date: Thu, 5 Jan 2017 23:00:49 +0300 Subject: [PATCH] more tweaking... Signed-off-by: Alex A. Naanou --- ui (gen4)/css/experimenting.css | 22 +++---- ui (gen4)/features/core.js | 2 + ui (gen4)/features/keyboard.js | 102 ++++++++++++++++++++----------- ui (gen4)/features/ui-widgets.js | 27 ++++---- 4 files changed, 90 insertions(+), 63 deletions(-) diff --git a/ui (gen4)/css/experimenting.css b/ui (gen4)/css/experimenting.css index b93669af..50f636bb 100755 --- a/ui (gen4)/css/experimenting.css +++ b/ui (gen4)/css/experimenting.css @@ -321,7 +321,8 @@ body { font-weight: bold; font-style: italic; } -.browse-widget.key-bindings .list>.ignore .text:not(:first-child) { + +.browse-widget.key-bindings .list>div .text:not(:first-child) { display: inline; position: relative; @@ -332,6 +333,14 @@ body { opacity: 0.8; font-style: italic; } +/* NOTE: the last element is a space... */ +.browse-widget.key-bindings.browse .list>div .text:last-child { + margin-right: 0em; +} +.browse-widget.key-bindings.browse .list>.ignored .text:first-child { + font-style: italic; + font-weight: bold; +} .browse-widget.key-bindings .list>div:not(.selected):not(.mode):nth-child(even) { background: rgba(0, 0, 0, 0.03); @@ -339,17 +348,6 @@ body { .browse-widget.key-bindings .list>.key .button { background-color: rgba(0, 0, 0, 0.1); } -.browse-widget.key-bindings .list>.key .text:not(:first-child) { - display: inline; - position: relative; - - float: right; - margin-left: 1em; - margin-right: 1em; - - opacity: 0.8; - font-style: italic; -} .browse-widget.key-bindings .list>.new { font-style: italic; diff --git a/ui (gen4)/features/core.js b/ui (gen4)/features/core.js index de763a0f..1df3075d 100755 --- a/ui (gen4)/features/core.js +++ b/ui (gen4)/features/core.js @@ -368,6 +368,8 @@ var IntrospectionActions = actions.Actions({ isUserCallable: ['- System/', actions.doWithRootAction(function(action){ return action.__not_user_callable__ != true })], + + }) diff --git a/ui (gen4)/features/keyboard.js b/ui (gen4)/features/keyboard.js index b8251b30..a1da2150 100755 --- a/ui (gen4)/features/keyboard.js +++ b/ui (gen4)/features/keyboard.js @@ -608,6 +608,7 @@ var KeyboardActions = actions.Actions({ // * action editor dialog // * mode editor dialog // * add ability to disable key (???) + // * ignore flag/list... // XXX key editor: // // [ mode ] @@ -617,8 +618,8 @@ var KeyboardActions = actions.Actions({ // new // XXX add view mode (read only)... // XXX BUG sections with doc do not show up in title... - browseKeyboardBindings: ['Interface/Keyboard bindings editor (EXPERIMENTAL)...', - widgets.makeUIDialog(function(path){ + browseKeyboardBindings: ['Interface/Keyboard bindings...', + widgets.makeUIDialog(function(path, edit){ var actions = this // Format: @@ -646,6 +647,8 @@ var KeyboardActions = actions.Actions({ function(path, make){ Object.keys(keys) .forEach(function(mode){ + var ignored = actions.keyboard[mode].ignore || [] + // section heading... make(keys[mode].doc ? $('') @@ -662,6 +665,7 @@ var KeyboardActions = actions.Actions({ //.addClass('mode not-searchable') .addClass('mode not-filterd-out') + /* XXX not sure if we need this like this... // unpropagated keys... make(['Unpropagated keys:', // NOTE: this blank is so as to avoid @@ -669,12 +673,14 @@ var KeyboardActions = actions.Actions({ // together in path... ' ', '$BUTTONS', - (actions.keyboard[mode].ignore || []).join(' / ')]) + (ignored).join(' / ')]) .addClass('ignore') + //*/ // bindings... Object.keys(keys[mode]) .forEach(function(action){ + action == 'Ignored' && console.log('!!!!!!!') action != 'doc' // NOTE: wee need the button // spec to be searchable, @@ -682,53 +688,75 @@ var KeyboardActions = actions.Actions({ // the keys attr as in // .browseActions(..) && make([action, ' ', '$BUTTONS'] - .concat(keys[mode][action].join(' / '))) - .addClass('key') + .concat(keys[mode][action] + // mark key if it is in ignored... + .map(function(s){ + s = s.split('+') + var k = s.pop() + s.push(k + + (ignored.indexOf(k) >= 0 ? + '*' + : '')) + return s.join('+') }) + .join(' / '))) + .addClass('key' + + (action == 'Ignored' ? ' ignored' : '')) }) - // add new binding/section... - var elem = make('new', { - buttons: [ - // XXX - ['key', - function(){ - //elem.before( XXX ) - }], - // XXX - ['mode', - function(){ - //elem.after( XXX ) - }], - ]}) - .addClass('new') + // controls... + if(edit){ + var elem = make('new', { + buttons: [ + // XXX + ['key', + function(){ + //elem.before( XXX ) + }], + // XXX + ['mode', + function(){ + //elem.after( XXX ) + }], + ]}) + .addClass('new') + } }) }, { - cls: 'key-bindings no-item-numbers', + cls: [ + 'key-bindings', + 'no-item-numbers', + (edit ? 'edit' : 'browse'), + ].join(' '), - itemButtons: [ - // NOTE: ordering within one section is purely - // aesthetic and has no function... - // XXX do wee actually need ordering??? - // XXX up - //['⏶', function(){}], - // XXX down - //['⏷', function(){}], + itemButtons: edit ? + [ + // NOTE: ordering within one section is purely + // aesthetic and has no function... + // XXX do wee actually need ordering??? + // XXX up + //['⏶', function(){}], + // XXX down + //['⏷', function(){}], - // XXX edit -- launch the editor... - ['⋯', function(){}], - //['edit', function(){}], - //['🖉', function(){}], - ], + // XXX edit -- launch the editor... + ['⋯', function(){}], + //['edit', function(){}], + //['🖉', function(){}], + ] + : [], }) return dialog })], + // XXX place this in /Doc/.. (???) + editKeyboardBindings: ['Interface/Keyboard bindings editor...', + widgets.uiDialog(function(path){ + return this.browseKeyboardBindings(path, true) })], // XXX resetKeyBindings: ['Interface/Restore default key bindings', - function(){ - // XXX - }] + function(){ + this.__keyboard_config = GLOBAL_KEYBOARD }] }) var Keyboard = diff --git a/ui (gen4)/features/ui-widgets.js b/ui (gen4)/features/ui-widgets.js index bc14acf4..95936176 100755 --- a/ui (gen4)/features/ui-widgets.js +++ b/ui (gen4)/features/ui-widgets.js @@ -549,6 +549,13 @@ var DialogsActions = actions.Actions({ }, // introspection... + get uiContainers(){ + return this.actions.filter(this.isUIContainer.bind(this)) }, + get uiDialogs(){ + return this.actions.filter(this.isUIDialog.bind(this)) }, + get uiElements(){ + return this.actions.filter(this.isUIElement.bind(this)) }, + // XXX should these be more like .getDoc(..) and support lists of actions??? getDocPath: ['- Interface/', function(action, clean, join){ @@ -576,14 +583,6 @@ var DialogsActions = actions.Actions({ return this.getDocPath(action, clean, false).pop() }], - // a bit of introspection... - get uiContainers(){ - return this.actions.filter(this.isUIContainer.bind(this)) }, - get uiDialogs(){ - return this.actions.filter(this.isUIDialog.bind(this)) }, - get uiElements(){ - return this.actions.filter(this.isUIElement.bind(this)) }, - // Get modal container... // // Protocol: @@ -627,7 +626,6 @@ var DialogsActions = actions.Actions({ o && o.focus() }) })], - Drawer: ['- Interface/', makeDrawer('bottom')], BottomDrawer: ['- Interface/', @@ -635,7 +633,6 @@ var DialogsActions = actions.Actions({ TopDrawer: ['- Interface/', makeDrawer('top')], - // like panel but drop down from mouse location or specified position DropDown: ['- Interface/', makeUIContainer(function(dialog, options){ @@ -733,11 +730,13 @@ module.Dialogs = core.ImageGridFeatures.Feature({ }], ['__call__', function(res, action){ - if(res instanceof jQuery || (res instanceof widget.Widget)){ - var elem = (res.dom || res) + //if(res instanceof jQuery || res instanceof widget.Widget){ + // var elem = (res.dom || res) + if(res instanceof widget.Widget){ + var elem = res.dom - !elem.attr('dialog-title') - && elem.attr('dialog-title', this.getDocTitle(action)) + !elem.attr('keep-dialog-title') + elem.attr('dialog-title', this.getDocTitle(action)) } }], ],