more tweaking...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2017-01-05 23:00:49 +03:00
parent 9ef35d3ea1
commit 0a57cb7c3a
4 changed files with 90 additions and 63 deletions

View File

@ -321,7 +321,8 @@ body {
font-weight: bold; font-weight: bold;
font-style: italic; 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; display: inline;
position: relative; position: relative;
@ -332,6 +333,14 @@ body {
opacity: 0.8; opacity: 0.8;
font-style: italic; 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) { .browse-widget.key-bindings .list>div:not(.selected):not(.mode):nth-child(even) {
background: rgba(0, 0, 0, 0.03); background: rgba(0, 0, 0, 0.03);
@ -339,17 +348,6 @@ body {
.browse-widget.key-bindings .list>.key .button { .browse-widget.key-bindings .list>.key .button {
background-color: rgba(0, 0, 0, 0.1); 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 { .browse-widget.key-bindings .list>.new {
font-style: italic; font-style: italic;

View File

@ -368,6 +368,8 @@ var IntrospectionActions = actions.Actions({
isUserCallable: ['- System/', isUserCallable: ['- System/',
actions.doWithRootAction(function(action){ actions.doWithRootAction(function(action){
return action.__not_user_callable__ != true })], return action.__not_user_callable__ != true })],
}) })

View File

@ -608,6 +608,7 @@ var KeyboardActions = actions.Actions({
// * action editor dialog // * action editor dialog
// * mode editor dialog // * mode editor dialog
// * add ability to disable key (???) // * add ability to disable key (???)
// * ignore flag/list...
// XXX key editor: // XXX key editor:
// //
// [ mode ] // [ mode ]
@ -617,8 +618,8 @@ var KeyboardActions = actions.Actions({
// new // new
// XXX add view mode (read only)... // XXX add view mode (read only)...
// XXX BUG sections with doc do not show up in title... // XXX BUG sections with doc do not show up in title...
browseKeyboardBindings: ['Interface/Keyboard bindings editor (EXPERIMENTAL)...', browseKeyboardBindings: ['Interface/Keyboard bindings...',
widgets.makeUIDialog(function(path){ widgets.makeUIDialog(function(path, edit){
var actions = this var actions = this
// Format: // Format:
@ -646,6 +647,8 @@ var KeyboardActions = actions.Actions({
function(path, make){ function(path, make){
Object.keys(keys) Object.keys(keys)
.forEach(function(mode){ .forEach(function(mode){
var ignored = actions.keyboard[mode].ignore || []
// section heading... // section heading...
make(keys[mode].doc ? make(keys[mode].doc ?
$('<span>') $('<span>')
@ -662,6 +665,7 @@ var KeyboardActions = actions.Actions({
//.addClass('mode not-searchable') //.addClass('mode not-searchable')
.addClass('mode not-filterd-out') .addClass('mode not-filterd-out')
/* XXX not sure if we need this like this...
// unpropagated keys... // unpropagated keys...
make(['Unpropagated keys:', make(['Unpropagated keys:',
// NOTE: this blank is so as to avoid // NOTE: this blank is so as to avoid
@ -669,12 +673,14 @@ var KeyboardActions = actions.Actions({
// together in path... // together in path...
' ', ' ',
'$BUTTONS', '$BUTTONS',
(actions.keyboard[mode].ignore || []).join(' / ')]) (ignored).join(' / ')])
.addClass('ignore') .addClass('ignore')
//*/
// bindings... // bindings...
Object.keys(keys[mode]) Object.keys(keys[mode])
.forEach(function(action){ .forEach(function(action){
action == 'Ignored' && console.log('!!!!!!!')
action != 'doc' action != 'doc'
// NOTE: wee need the button // NOTE: wee need the button
// spec to be searchable, // spec to be searchable,
@ -682,11 +688,23 @@ var KeyboardActions = actions.Actions({
// the keys attr as in // the keys attr as in
// .browseActions(..) // .browseActions(..)
&& make([action, ' ', '$BUTTONS'] && make([action, ' ', '$BUTTONS']
.concat(keys[mode][action].join(' / '))) .concat(keys[mode][action]
.addClass('key') // 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... // controls...
if(edit){
var elem = make('new', { var elem = make('new', {
buttons: [ buttons: [
// XXX // XXX
@ -701,11 +719,17 @@ var KeyboardActions = actions.Actions({
}], }],
]}) ]})
.addClass('new') .addClass('new')
}
}) })
}, { }, {
cls: 'key-bindings no-item-numbers', cls: [
'key-bindings',
'no-item-numbers',
(edit ? 'edit' : 'browse'),
].join(' '),
itemButtons: [ itemButtons: edit ?
[
// NOTE: ordering within one section is purely // NOTE: ordering within one section is purely
// aesthetic and has no function... // aesthetic and has no function...
// XXX do wee actually need ordering??? // XXX do wee actually need ordering???
@ -718,17 +742,21 @@ var KeyboardActions = actions.Actions({
['&ctdot;', function(){}], ['&ctdot;', function(){}],
//['edit', function(){}], //['edit', function(){}],
//['&#128393;', function(){}], //['&#128393;', function(){}],
], ]
: [],
}) })
return dialog return dialog
})], })],
// XXX place this in /Doc/.. (???)
editKeyboardBindings: ['Interface/Keyboard bindings editor...',
widgets.uiDialog(function(path){
return this.browseKeyboardBindings(path, true) })],
// XXX // XXX
resetKeyBindings: ['Interface/Restore default key bindings', resetKeyBindings: ['Interface/Restore default key bindings',
function(){ function(){
// XXX this.__keyboard_config = GLOBAL_KEYBOARD }]
}]
}) })
var Keyboard = var Keyboard =

View File

@ -549,6 +549,13 @@ var DialogsActions = actions.Actions({
}, },
// introspection... // 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??? // XXX should these be more like .getDoc(..) and support lists of actions???
getDocPath: ['- Interface/', getDocPath: ['- Interface/',
function(action, clean, join){ function(action, clean, join){
@ -576,14 +583,6 @@ var DialogsActions = actions.Actions({
return this.getDocPath(action, clean, false).pop() 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... // Get modal container...
// //
// Protocol: // Protocol:
@ -627,7 +626,6 @@ var DialogsActions = actions.Actions({
o && o.focus() o && o.focus()
}) })
})], })],
Drawer: ['- Interface/', Drawer: ['- Interface/',
makeDrawer('bottom')], makeDrawer('bottom')],
BottomDrawer: ['- Interface/', BottomDrawer: ['- Interface/',
@ -635,7 +633,6 @@ var DialogsActions = actions.Actions({
TopDrawer: ['- Interface/', TopDrawer: ['- Interface/',
makeDrawer('top')], makeDrawer('top')],
// like panel but drop down from mouse location or specified position // like panel but drop down from mouse location or specified position
DropDown: ['- Interface/', DropDown: ['- Interface/',
makeUIContainer(function(dialog, options){ makeUIContainer(function(dialog, options){
@ -733,11 +730,13 @@ module.Dialogs = core.ImageGridFeatures.Feature({
}], }],
['__call__', ['__call__',
function(res, action){ function(res, action){
if(res instanceof jQuery || (res instanceof widget.Widget)){ //if(res instanceof jQuery || res instanceof widget.Widget){
var elem = (res.dom || res) // var elem = (res.dom || res)
if(res instanceof widget.Widget){
var elem = res.dom
!elem.attr('dialog-title') !elem.attr('keep-dialog-title')
&& elem.attr('dialog-title', this.getDocTitle(action)) elem.attr('dialog-title', this.getDocTitle(action))
} }
}], }],
], ],