added blinking indicators and hidden statusbar mode...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2018-03-20 04:25:22 +03:00
parent 05fa1d376c
commit 3e1aeb3f7b
4 changed files with 150 additions and 100 deletions

View File

@ -192,6 +192,19 @@
cursor: none !important; cursor: none !important;
} }
.blink{
animation: blink 200ms;
}
@keyframes blink {
from {
opacity: 1;
}
to {
opacity: 0;
}
};
/*********************************************************************/ /*********************************************************************/
@ -1345,12 +1358,19 @@ stretching in width... */
background: red; background: red;
} }
.overlay-info.hidden,
.overlay-info.full, .overlay-info.full,
.overlay-info.minimal { .overlay-info.minimal {
display: block; display: block;
/* XXX is this correct??? */ /* XXX is this correct??? */
z-index: 1000, z-index: 1000,
} }
.overlay-info.hidden {
background: transparent;
}
.overlay-info.hidden>* {
opacity: 0 !important;
}
.overlay-info.minimal { .overlay-info.minimal {
background: transparent; background: transparent;

View File

@ -519,7 +519,13 @@ var KeyboardActions = actions.Actions({
return return
} }
// XXX we should also check if code is a key (i.e. alias)...
var a = keyboard.parseActionCall(code, that) var a = keyboard.parseActionCall(code, that)
// skip aliases that look like actions (namely ':') and bad actions...
if(a.action == ''){
return
}
var doc = a.doc var doc = a.doc
|| (that.getDocTitle && that.getDocTitle(a.action)) || (that.getDocTitle && that.getDocTitle(a.action))
|| null || null

View File

@ -44,33 +44,36 @@ var makeStateIndicatorItem = function(container, type, text){
// XXX revise how/where info is displayed... // XXX revise how/where info is displayed...
var StatusBarActions = actions.Actions({ var StatusBarActions = actions.Actions({
config: { config: {
'status-bar-mode': 'full', 'status-bar': 'full',
'status-bar-modes': [ 'status-bars': {
'none', hidden: [
'minimal', '---',
'full', 'mark',
'bookmark',
], ],
// XXX make different configurations for different modes instead minimal: [
// of hiding some items... (???) 'index',
'status-bar-items': [ 'ribbon',
'changes',
'---',
'edit-mode',
'mark',
'bookmark',
],
full: [
'index', 'index',
'ribbon', 'ribbon',
'changes', 'changes',
'gid', 'gid',
'path', 'path',
// separates left/right aligned elements...
'---', '---',
'edit-mode', 'edit-mode',
'mark', 'mark',
'bookmark', 'bookmark',
], ],
},
// XXX not sure about this... 'status-bar-blink': [
'status-bar-full-only': [ 'hidden',
'gid',
'path',
], ],
'status-bar-index': { 'status-bar-index': {
@ -448,9 +451,10 @@ var StatusBarActions = actions.Actions({
}) })
// toggle action menu... // toggle action menu...
// XXX show this in the appropriate corner... // XXX show this in the appropriate corner...
.on('contextmenu', function(){ .on('contextmenu', function(evt){
event.preventDefault() evt = window.event || evt
event.stopPropagation() evt.preventDefault()
evt.stopPropagation()
that.browseActions('/'+ type.capitalize() +'/') that.browseActions('/'+ type.capitalize() +'/')
}) })
@ -466,21 +470,37 @@ var StatusBarActions = actions.Actions({
// special toggler args in the handler... // special toggler args in the handler...
var tags = this.data ? this.data.getTags(gid) : [] var tags = this.data ? this.data.getTags(gid) : []
var tag = type == 'mark' ? 'selected' : 'bookmark' var tag = type == 'mark' ? 'selected' : 'bookmark'
var on = item.hasClass('on')
item[tags.indexOf(tag) < 0 ? item[tags.indexOf(tag) < 0 ?
'removeClass' 'removeClass'
: 'addClass']('on') : 'addClass']('on')
// blink the indicator on...
// XXX need to do this on change only and not on navigation...
if(!on
&& item.hasClass('on')
&& this.config['status-bar-blink'].indexOf(this.toggleStatusBar('?')) >= 0){
item
.removeClass('blink')
.addClass('blink')
.on('animationend', function(){ item.removeClass('blink') })
}
return item return item
}, },
bookmark: 'mark', bookmark: 'mark',
}, },
// NOTE: to reset the status bar cycle through 'none' mode to
// reconstruct all the items.
toggleStatusBar: ['Interface/Status bar mode', toggleStatusBar: ['Interface/Status bar mode',
core.doc`
NOTE: this will skip 'none' state if it is not present in
.config['status-bars'], but setting this to 'none' will clear
the status bar completely before switching to the top state.
`,
toggler.CSSClassToggler( toggler.CSSClassToggler(
// get/construct status bar... // get/construct status bar...
// XXX change class...
function(){ function(){
// no viewer yet... // no viewer yet...
if(!this.ribbons || !this.dom){ if(!this.ribbons || !this.dom){
@ -490,11 +510,12 @@ var StatusBarActions = actions.Actions({
var bar = this.dom.find('.state-indicator-container.global-info') var bar = this.dom.find('.state-indicator-container.global-info')
if(bar.length == 0){ if(bar.length == 0){
bar = makeStateIndicator('global-info overlay-info statusbar') bar = makeStateIndicator('global-info overlay-info statusbar')
.addClass(this.config['status-bar-mode'] .addClass(this.config['status-bar']
|| this.config['status-bar-modes'][0] || Object.keys(this.config['status-bars'])[0]
|| '') || '')
.on('mouseover', function(){ .on('mouseover', function(evt){
var t = $(event.target) evt = window.event || evt
var t = $(evt.target)
var info = t.attr('info') var info = t.attr('info')
|| t.parents('.overlay-info, [info]').first().attr('info') || t.parents('.overlay-info, [info]').first().attr('info')
@ -510,7 +531,7 @@ var StatusBarActions = actions.Actions({
} }
return bar return bar
}, },
function(){ return this.config['status-bar-modes'] }, function(){ return Object.keys(this.config['status-bars']).concat(['none']) },
// XXX check if we will be getting gid reliably... // XXX check if we will be getting gid reliably...
function(state, bar, gid){ function(state, bar, gid){
// do not do anything unless the status bar exists... // do not do anything unless the status bar exists...
@ -518,7 +539,7 @@ var StatusBarActions = actions.Actions({
return return
} }
var that = this var that = this
this.config['status-bar-mode'] = state this.config['status-bar'] = state
var _getHandler = function(key){ var _getHandler = function(key){
var elems = that.__statusbar_elements__ || {} var elems = that.__statusbar_elements__ || {}
@ -546,8 +567,8 @@ var StatusBarActions = actions.Actions({
return handler return handler
} }
// destroy... // clear...
if(state == 'none'){ if(state == 'none' || !bar.hasClass(state)){
// notify items that they are removed... // notify items that they are removed...
bar.children() bar.children()
.each(function(i, item){ .each(function(i, item){
@ -565,15 +586,23 @@ var StatusBarActions = actions.Actions({
} }
}) })
bar.empty() bar.empty()
}
if(state == 'none'){
!('none' in this.config['status-bars'])
// XXX this feels like a hack...
&& setTimeout(function(){ this.toggleStatusBar(0) }.bind(this), 0)
//return Object.keys(this.config['status-bars'])[0]
return
}
// build/update... // build/update...
} else {
gid = gid || this.current gid = gid || this.current
var img = this.images && this.images[gid] var img = this.images && this.images[gid]
// build... // build...
if(bar.children().length <= 0){ if(bar.children().length <= 0){
var items = this.config['status-bar-items'].slice() var items = this.config['status-bars'][state].slice()
// rearrange the tail section... // rearrange the tail section...
// NOTE: this is here as we need to push the floated // NOTE: this is here as we need to push the floated
@ -598,11 +627,6 @@ var StatusBarActions = actions.Actions({
handler.call(that, item, gid, img) handler.call(that, item, gid, img)
: $('<span>')) : $('<span>'))
.attr('type', item) .attr('type', item)
if('status-bar-full-only' in that.config
&& that.config['status-bar-full-only'].indexOf(type) >= 0){
item.addClass('full-only')
}
} }
bar.append(item) bar.append(item)
@ -626,8 +650,8 @@ var StatusBarActions = actions.Actions({
} }
}) })
} }
} },
})], null)],
updateStatusBar: ['- Interface/Update satus bar', updateStatusBar: ['- Interface/Update satus bar',
function(){ this.toggleStatusBar('!') }], function(){ this.toggleStatusBar('!') }],
@ -705,7 +729,7 @@ module.StatusBar = core.ImageGridFeatures.Feature({
handlers: [ handlers: [
['start', ['start',
function(){ function(){
this.toggleStatusBar(this.config['status-bar-mode']) this.toggleStatusBar(this.config['status-bar'])
}], }],
['focusImage clear markChanged', ['focusImage clear markChanged',
function(){ function(){
@ -745,8 +769,8 @@ module.StatusBar = core.ImageGridFeatures.Feature({
} else { } else {
'status-bar-mode' in workspace ? 'status-bar-mode' in workspace ?
this.toggleStatusBar(workspace['status-bar-mode']) this.toggleStatusBar(workspace['status-bar'])
: this.toggleStatusBar(this.config['status-bar-mode']) : this.toggleStatusBar(this.config['status-bar'])
} }
})], })],
], ],

View File

@ -2219,7 +2219,7 @@ var BrowserPrototype = {
// // // //
// // These are the sugar for commonly used events in the events // // These are the sugar for commonly used events in the events
// // section below... // // section below...
// // NOTE: these are defined in .options.itmeOptionsEventShorthands // // NOTE: these are defined in .options.itemOptionsEventShorthands
// open: <handler>, // open: <handler>,
// menu: <handler>, // menu: <handler>,
// update: <handler>, // update: <handler>,