| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | /********************************************************************** | 
					
						
							|  |  |  | *  | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | **********************************************************************/ | 
					
						
							| 
									
										
										
										
											2016-08-21 02:19:24 +03:00
										 |  |  | ((typeof define)[0]=='u'?function(f){module.exports=f(require)}:define) | 
					
						
							|  |  |  | (function(require){ var module={} // make module AMD/node compatible...
 | 
					
						
							| 
									
										
										
										
											2016-08-20 22:49:36 +03:00
										 |  |  | /*********************************************************************/ | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | var toggler = require('lib/toggler') | 
					
						
							|  |  |  | var actions = require('lib/actions') | 
					
						
							|  |  |  | var features = require('lib/features') | 
					
						
							| 
									
										
										
										
											2016-03-24 23:14:25 +03:00
										 |  |  | var keyboard = require('lib/keyboard') | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-01 16:12:10 +03:00
										 |  |  | var data = require('imagegrid/data') | 
					
						
							|  |  |  | var images = require('imagegrid/images') | 
					
						
							|  |  |  | var ribbons = require('imagegrid/ribbons') | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | var core = require('features/core') | 
					
						
							|  |  |  | var base = require('features/base') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /*********************************************************************/ | 
					
						
							| 
									
										
										
										
											2016-02-19 04:41:07 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | var makeStateIndicator = function(type){ | 
					
						
							|  |  |  | 	return $('<div>') | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 		.addClass('state-indicator-container ' + type || '') } | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | // XXX do we need this???
 | 
					
						
							|  |  |  | var makeStateIndicatorItem = function(container, type, text){ | 
					
						
							|  |  |  | 	var item = $('<div>') | 
					
						
							|  |  |  | 			.addClass('item '+ type || '') | 
					
						
							|  |  |  | 			.attr('text', text) | 
					
						
							| 
									
										
										
										
											2017-05-16 00:26:37 +03:00
										 |  |  | 	this.dom.find('.state-indicator-container.'+container) | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 		.append(item) | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 	return item } | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:20:10 +03:00
										 |  |  | // XXX revise how/where info is displayed...
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | var StatusBarActions = actions.Actions({ | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 	config: { | 
					
						
							| 
									
										
										
										
											2018-03-20 04:25:22 +03:00
										 |  |  | 		'status-bar': 'full', | 
					
						
							|  |  |  | 		'status-bars': { | 
					
						
							|  |  |  | 			hidden: [ | 
					
						
							|  |  |  | 				'---', | 
					
						
							|  |  |  | 				'mark', | 
					
						
							|  |  |  | 				'bookmark', | 
					
						
							|  |  |  | 			], | 
					
						
							|  |  |  | 			minimal: [ | 
					
						
							|  |  |  | 				'index', | 
					
						
							|  |  |  | 				'ribbon', | 
					
						
							|  |  |  | 				'changes', | 
					
						
							|  |  |  | 				'---', | 
					
						
							|  |  |  | 				'edit-mode', | 
					
						
							|  |  |  | 				'mark', | 
					
						
							|  |  |  | 				'bookmark', | 
					
						
							|  |  |  | 			], | 
					
						
							|  |  |  | 			full: [ | 
					
						
							|  |  |  | 				'index', | 
					
						
							|  |  |  | 				'ribbon', | 
					
						
							|  |  |  | 				'changes', | 
					
						
							|  |  |  | 				'gid', | 
					
						
							|  |  |  | 				'path', | 
					
						
							|  |  |  | 				'---', | 
					
						
							|  |  |  | 				'edit-mode', | 
					
						
							|  |  |  | 				'mark', | 
					
						
							|  |  |  | 				'bookmark', | 
					
						
							|  |  |  | 			], | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2016-03-24 23:14:25 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-25 00:49:14 +03:00
										 |  |  | 		'status-bar-index': { | 
					
						
							| 
									
										
										
										
											2016-03-29 07:34:49 +03:00
										 |  |  | 			'mode': 'normal', | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-25 00:49:14 +03:00
										 |  |  | 			// NOTE: this would need to reconstruct the status bar for 
 | 
					
						
							|  |  |  | 			// 		changes to take effect, i.e. call .resetStatusBar()
 | 
					
						
							|  |  |  | 			// XXX might be a good idea to run an editor on click on
 | 
					
						
							|  |  |  | 			// 		touch devices...
 | 
					
						
							|  |  |  | 			'editable': true, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			'live-update-on-edit': false, | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2016-03-29 07:34:49 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-12-14 02:22:52 +03:00
										 |  |  | 		'status-bar-ribbon-count': true, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-17 03:50:25 +03:00
										 |  |  | 		'status-bar-changes-text': '*', | 
					
						
							| 
									
										
										
										
											2018-02-01 19:51:00 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		'status-bar-edit-mode-indicator-update-interval': 1000, | 
					
						
							| 
									
										
										
										
											2018-03-21 17:34:26 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		// workspace stuff...
 | 
					
						
							|  |  |  | 		'status-bar-workspace-attrs': [ | 
					
						
							|  |  |  | 			'status-bar', | 
					
						
							|  |  |  | 		], | 
					
						
							|  |  |  | 		'status-bar-workspace-defaults': { | 
					
						
							|  |  |  | 			'default': 'full', | 
					
						
							|  |  |  | 			'single-image': 'minimal', | 
					
						
							|  |  |  | 			'slideshow': 'hidden', | 
					
						
							|  |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	get __statusbar_cache(){ | 
					
						
							|  |  |  | 		return this.cache('view-data', 'statusbar',  | 
					
						
							|  |  |  | 			function(data){  | 
					
						
							|  |  |  | 				return data || {}}) }, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 	__statusbar_elements__: { | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 		/* item template... | 
					
						
							|  |  |  | 		item: function(item){ | 
					
						
							|  |  |  | 			// cleanup...
 | 
					
						
							|  |  |  | 			if(item == null){ | 
					
						
							|  |  |  | 				// XXX
 | 
					
						
							|  |  |  | 				return | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			// setup the item DOM...
 | 
					
						
							|  |  |  | 			if(typeof(item) == typeof('str')){ | 
					
						
							|  |  |  | 				var type = item | 
					
						
							|  |  |  | 				item = $('<span>') | 
					
						
							|  |  |  | 					.addClass('item-example') | 
					
						
							|  |  |  | 					.attr('type', item) | 
					
						
							|  |  |  | 					.text('example') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			// get stuff from the item...
 | 
					
						
							|  |  |  | 			} else { | 
					
						
							|  |  |  | 				var type = item.attr('type') | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			// update the item...
 | 
					
						
							|  |  |  | 			// XXX
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			return item | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		*/ | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 		index: function(item, gid, img){ | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 			// cleanup...
 | 
					
						
							|  |  |  | 			if(item == null){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				return } | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-13 07:59:54 +03:00
										 |  |  | 			var that = this | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			gid = gid || this.current | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			// make an element...
 | 
					
						
							|  |  |  | 			if(typeof(item) == typeof('str')){ | 
					
						
							|  |  |  | 				var type = item | 
					
						
							| 
									
										
										
										
											2018-11-16 01:39:29 +03:00
										 |  |  | 				var go = function(i){ | 
					
						
							|  |  |  | 					i = i >= 1 ? i-1 | 
					
						
							|  |  |  | 						: i == null ? 'current' | 
					
						
							|  |  |  | 						: i | 
					
						
							|  |  |  | 					that.focusImage(i, | 
					
						
							|  |  |  | 						item.hasClass('global') ?  | 
					
						
							|  |  |  | 							'global'  | 
					
						
							|  |  |  | 						: item.hasClass('loaded') ?  | 
					
						
							|  |  |  | 							'loaded' | 
					
						
							|  |  |  | 						: undefined) } | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 				item = $('<span>') | 
					
						
							|  |  |  | 					.addClass(type) | 
					
						
							| 
									
										
										
										
											2016-03-25 00:49:14 +03:00
										 |  |  | 					.append(!(this.config['status-bar-index'] || {})['editable'] ? | 
					
						
							|  |  |  | 						// not-editable...
 | 
					
						
							|  |  |  | 						$('<span>') | 
					
						
							|  |  |  | 							.addClass('position') | 
					
						
							| 
									
										
										
										
											2016-06-09 00:10:11 +03:00
										 |  |  | 							.attr('info', 'Image number (click to toggle ribbon/global)') | 
					
						
							| 
									
										
										
										
											2016-03-25 00:49:14 +03:00
										 |  |  | 							// toggle index state...
 | 
					
						
							|  |  |  | 							.click(function(){ | 
					
						
							| 
									
										
										
										
											2016-03-29 07:34:49 +03:00
										 |  |  | 								that.toggleStatusBarIndexMode() | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 								that.updateStatusBar() }) | 
					
						
							| 
									
										
										
										
											2016-03-25 00:49:14 +03:00
										 |  |  | 						// editable...
 | 
					
						
							|  |  |  | 						: $('<span>') | 
					
						
							|  |  |  | 							.addClass('position editable') | 
					
						
							| 
									
										
										
										
											2016-06-09 00:10:11 +03:00
										 |  |  | 							.attr('info', 'Image number (click to edit)') | 
					
						
							| 
									
										
										
										
											2017-01-24 06:14:38 +03:00
										 |  |  | 							.makeEditable({ | 
					
						
							|  |  |  | 								propagate_unhandled_keys: false, | 
					
						
							|  |  |  | 								reset_on_done: false, | 
					
						
							|  |  |  | 							}) | 
					
						
							| 
									
										
										
										
											2016-06-07 04:28:56 +03:00
										 |  |  | 							// select image when done...
 | 
					
						
							| 
									
										
										
										
											2017-01-24 06:14:38 +03:00
										 |  |  | 							.on('edit-commit', function(_, text){ | 
					
						
							| 
									
										
										
										
											2018-11-16 01:39:29 +03:00
										 |  |  | 								go(parseInt(text)) }) | 
					
						
							| 
									
										
										
										
											2016-03-25 00:49:14 +03:00
										 |  |  | 							// update image position...
 | 
					
						
							| 
									
										
										
										
											2016-04-14 18:58:27 +03:00
										 |  |  | 							// XXX this appears to be run in the node context...
 | 
					
						
							| 
									
										
										
										
											2016-03-25 00:49:14 +03:00
										 |  |  | 							.keyup(function(){ | 
					
						
							| 
									
										
										
										
											2016-04-14 18:58:27 +03:00
										 |  |  | 								// XXX KeyboardEvent does not appear to have this...
 | 
					
						
							|  |  |  | 								//event.stopPropagation()
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-16 01:39:29 +03:00
										 |  |  | 								(that.config['status-bar-index'] || {})['live-update-on-edit'] | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 									&& go(parseInt($(this).text())) }) | 
					
						
							| 
									
										
										
										
											2016-10-31 02:34:03 +03:00
										 |  |  | 							.focus(function(){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 								$(this).selectText() }) | 
					
						
							| 
									
										
										
										
											2016-03-25 00:49:14 +03:00
										 |  |  | 							.blur(function(){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 								that.updateStatusBar() })) | 
					
						
							| 
									
										
										
										
											2016-02-13 07:59:54 +03:00
										 |  |  | 					.append($('<span>') | 
					
						
							|  |  |  | 						.addClass('length') | 
					
						
							| 
									
										
										
										
											2016-06-09 00:10:11 +03:00
										 |  |  | 						.attr('info', 'Image count (click to toggle ribbon/global)') | 
					
						
							| 
									
										
										
										
											2016-02-13 07:59:54 +03:00
										 |  |  | 						// toggle index state...
 | 
					
						
							|  |  |  | 						.click(function(){ | 
					
						
							| 
									
										
										
										
											2016-03-29 07:34:49 +03:00
										 |  |  | 							that.toggleStatusBarIndexMode() | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 							that.updateStatusBar() })) | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				var type = item.attr('type') } | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-29 07:34:49 +03:00
										 |  |  | 			// NOTE: using .toggleStatusBarIndexMode(..) here will fall
 | 
					
						
							|  |  |  | 			// 		into an infinite recursion...
 | 
					
						
							|  |  |  | 			var cls = (that.config['status-bar-index'] || {})['mode'] || 'normal' | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 			// get the cached length...
 | 
					
						
							|  |  |  | 			var cache = this.__statusbar_cache.index_total | 
					
						
							|  |  |  | 			cache = cache ?  | 
					
						
							|  |  |  | 				(cache[0] == cls  | 
					
						
							|  |  |  | 					&& cache[1]) | 
					
						
							| 
									
										
										
										
											2020-11-27 19:24:49 +03:00
										 |  |  | 				: null | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			// empty view...
 | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 			if(!this.data){ | 
					
						
							| 
									
										
										
										
											2020-11-27 19:24:49 +03:00
										 |  |  | 				var i = -1 | 
					
						
							|  |  |  | 				var l = 0 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			// global index...
 | 
					
						
							| 
									
										
										
										
											2020-11-27 19:24:49 +03:00
										 |  |  | 			} else if(cls == 'global'){ | 
					
						
							|  |  |  | 				var i = this.data.getImageOrder(gid) | 
					
						
							|  |  |  | 				var l = cache =  | 
					
						
							|  |  |  | 					cache || this.data.length | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-11-16 01:39:29 +03:00
										 |  |  | 			// loaded/crop index...
 | 
					
						
							|  |  |  | 			} else if(cls == 'loaded'){ | 
					
						
							| 
									
										
										
										
											2020-11-27 19:24:49 +03:00
										 |  |  | 				var i = this.data.getImageOrder('loaded', gid) | 
					
						
							|  |  |  | 				var l = cache =  | 
					
						
							|  |  |  | 					cache || this.data.getImages('loaded').len | 
					
						
							| 
									
										
										
										
											2018-11-16 01:39:29 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			// ribbon index...
 | 
					
						
							|  |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2020-11-27 19:24:49 +03:00
										 |  |  | 				var i = this.data.getImageOrder('ribbon', gid) | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				var r = this.current_ribbon | 
					
						
							|  |  |  | 				var l = cache  | 
					
						
							|  |  |  | 					&& cache instanceof Array  | 
					
						
							|  |  |  | 					&& cache[0] == r | 
					
						
							|  |  |  | 					&& cache[1] | 
					
						
							|  |  |  | 				l = l || this.data.getImages(gid).len | 
					
						
							|  |  |  | 				cache = [r, l] } | 
					
						
							| 
									
										
										
										
											2020-11-27 19:24:49 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 			// save cache...
 | 
					
						
							|  |  |  | 			this.__statusbar_cache.index_total = [cls, cache] | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-12-29 23:23:05 +03:00
										 |  |  | 			// update...
 | 
					
						
							|  |  |  | 			item | 
					
						
							|  |  |  | 				.addClass(cls) | 
					
						
							|  |  |  | 				.removeClass(cls != 'normal' ? 'normal' : 'global') | 
					
						
							|  |  |  | 				.find('.position:not(:focus)') | 
					
						
							|  |  |  | 					.text(i >= 0 ? i+1 : '-') | 
					
						
							|  |  |  | 					.end() | 
					
						
							|  |  |  | 				.find('.length') | 
					
						
							|  |  |  | 					.text(l > 0 ? ('/' + l) : '') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 			return item }, | 
					
						
							| 
									
										
										
										
											2016-06-07 04:03:56 +03:00
										 |  |  | 		ribbon: function(item, gid, img){ | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 			// cleanup...
 | 
					
						
							|  |  |  | 			if(item == null){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				return } | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-07 04:03:56 +03:00
										 |  |  | 			var that = this | 
					
						
							| 
									
										
										
										
											2016-06-07 21:00:16 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			// get ribbon number...
 | 
					
						
							|  |  |  | 			var n = (this.data && this.data.ribbon_order.length > 0) ?  | 
					
						
							|  |  |  | 				this.data.getRibbonOrder(gid || this.current)  | 
					
						
							| 
									
										
										
										
											2016-12-29 23:23:05 +03:00
										 |  |  | 				: null | 
					
						
							| 
									
										
										
										
											2016-12-14 02:22:52 +03:00
										 |  |  | 			var t = (this.config['status-bar-ribbon-count'] && this.data) ? | 
					
						
							|  |  |  | 			   	this.data.ribbon_order.length  | 
					
						
							|  |  |  | 				: null | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-07 04:03:56 +03:00
										 |  |  | 			// make an element...
 | 
					
						
							|  |  |  | 			if(typeof(item) == typeof('str')){ | 
					
						
							|  |  |  | 				item = $('<span>') | 
					
						
							| 
									
										
										
										
											2016-12-14 02:06:50 +03:00
										 |  |  | 					.addClass('ribbon-index') | 
					
						
							|  |  |  | 					.append($('<span>') | 
					
						
							|  |  |  | 						.addClass('ribbon-number') | 
					
						
							|  |  |  | 						.attr('info', 'Current ribbon (click to edit)') | 
					
						
							| 
									
										
										
										
											2017-01-24 06:14:38 +03:00
										 |  |  | 						.makeEditable({ | 
					
						
							|  |  |  | 							propagate_unhandled_keys: false, | 
					
						
							|  |  |  | 							reset_on_done: false, | 
					
						
							|  |  |  | 						}) | 
					
						
							|  |  |  | 						.on('edit-commit', function(_, text){ | 
					
						
							| 
									
										
										
										
											2017-01-24 06:21:15 +03:00
										 |  |  | 							var i = parseInt(text) | 
					
						
							|  |  |  | 							i = i >= 1 ? i-1 | 
					
						
							|  |  |  | 								: i == null ? 'current' | 
					
						
							|  |  |  | 								: i | 
					
						
							|  |  |  | 							that.focusRibbon(text == '*' ? that.base : i) | 
					
						
							| 
									
										
										
										
											2016-12-14 02:06:50 +03:00
										 |  |  | 						}) | 
					
						
							|  |  |  | 						.focus(function(){ | 
					
						
							|  |  |  | 							$(this).selectText() | 
					
						
							|  |  |  | 						}) | 
					
						
							|  |  |  | 						.blur(function(){ | 
					
						
							|  |  |  | 							that.updateStatusBar() | 
					
						
							|  |  |  | 						})) | 
					
						
							|  |  |  | 					.append($('<span>') | 
					
						
							|  |  |  | 						.addClass('ribbon-count') | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 						.attr('info', 'Ribbon count')) } | 
					
						
							| 
									
										
										
										
											2016-06-07 04:03:56 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-12-14 02:06:50 +03:00
										 |  |  | 			item | 
					
						
							|  |  |  | 				.find('.ribbon-number') | 
					
						
							| 
									
										
										
										
											2016-12-29 23:23:05 +03:00
										 |  |  | 					.html(n != null ? n+1 : '-')  | 
					
						
							| 
									
										
										
										
											2016-12-14 02:06:50 +03:00
										 |  |  | 					.end() | 
					
						
							|  |  |  | 				.find('.ribbon-count') | 
					
						
							|  |  |  | 					.html(t || '')  | 
					
						
							| 
									
										
										
										
											2016-06-09 00:10:11 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			// flag the base ribbon...
 | 
					
						
							|  |  |  | 			// NOTE: for some reason can't get jQuery .prop(..)/.removeProp(..)
 | 
					
						
							|  |  |  | 			// 		to work here...
 | 
					
						
							|  |  |  | 			if(this.data && this.data.base  | 
					
						
							|  |  |  | 					&& this.data.getRibbon(gid) == this.base){ | 
					
						
							|  |  |  | 				item[0].setAttribute('base', '') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				item[0].removeAttribute('base') } | 
					
						
							| 
									
										
										
										
											2016-06-09 00:10:11 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 			return item }, | 
					
						
							| 
									
										
										
										
											2016-06-09 00:10:11 +03:00
										 |  |  | 		changes: function(item, gid, img){ | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 			// cleanup...
 | 
					
						
							|  |  |  | 			if(item == null){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				return } | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-09 00:10:11 +03:00
										 |  |  | 			if(typeof(item) == typeof('str')){ | 
					
						
							|  |  |  | 				item = $('<span>') | 
					
						
							|  |  |  | 					.addClass('changes') | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 					.attr('info', 'Unsaved changes') } | 
					
						
							| 
									
										
										
										
											2016-06-09 00:10:11 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-14 02:29:47 +03:00
										 |  |  | 			//item.html(this.changes !== false ? 
 | 
					
						
							|  |  |  | 			//	this.config['status-bar-changes-text'] || '*' 
 | 
					
						
							|  |  |  | 			//	: '')
 | 
					
						
							|  |  |  | 			// XXX not yet sure about .hasOwnProperty(..) here...
 | 
					
						
							|  |  |  | 			item.html(this.hasOwnProperty('changes') && this.changes !== false ?  | 
					
						
							|  |  |  | 				this.config['status-bar-changes-text'] || '*'  | 
					
						
							|  |  |  | 				: '') | 
					
						
							| 
									
										
										
										
											2016-06-07 04:03:56 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 			return item }, | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 		// XXX handle path correctly...
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 		gid: function(item, gid, img){ | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 			// cleanup...
 | 
					
						
							|  |  |  | 			if(item == null){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				return } | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			var that = this | 
					
						
							|  |  |  | 			gid = gid || this.current | 
					
						
							|  |  |  | 			img = img || (this.images && gid in this.images && this.images[gid]) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			// make an element...
 | 
					
						
							|  |  |  | 			if(typeof(item) == typeof('str')){ | 
					
						
							|  |  |  | 				var type = item | 
					
						
							|  |  |  | 				item = $('<span>') | 
					
						
							|  |  |  | 					.addClass(type + ' expanding-text ') | 
					
						
							|  |  |  | 					.attr('info', type == 'gid' ? 'Image GID' | 
					
						
							|  |  |  | 							: type == 'path'? 'Image filename/path' | 
					
						
							|  |  |  | 							: '') | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 					.append($('<span class="shown">')) | 
					
						
							| 
									
										
										
										
											2016-04-12 19:01:40 +03:00
										 |  |  | 					.append($('<span class="hidden">') | 
					
						
							|  |  |  | 						// select the text...
 | 
					
						
							|  |  |  | 						// XXX should this also copy???
 | 
					
						
							|  |  |  | 						.click(function(){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 							$(this).selectText() })) | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				var type = item.attr('type') } | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 			// update...
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			var txt = '' | 
					
						
							|  |  |  | 			var text = '' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			// gid..
 | 
					
						
							|  |  |  | 			if(type == 'gid'){ | 
					
						
							|  |  |  | 				txt = gid ? gid.slice(-6) : '-' | 
					
						
							|  |  |  | 				text = gid || '-' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			// path...
 | 
					
						
							| 
									
										
										
										
											2016-04-12 08:06:45 +03:00
										 |  |  | 			// XXX use generic, platform independent path processing...
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			} else if(type == 'path'){ | 
					
						
							| 
									
										
										
										
											2016-06-30 05:23:46 +03:00
										 |  |  | 				// XXX revise this...
 | 
					
						
							|  |  |  | 				text = (img && img.path && ((img.base_path || '') +'/'+ img.path) || '---') | 
					
						
							| 
									
										
										
										
											2016-04-12 08:06:45 +03:00
										 |  |  | 					// remove /./
 | 
					
						
							|  |  |  | 					.replace(/[\\\/]\.[\\\/]/, '/') | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				txt = img  | 
					
						
							|  |  |  | 					&& ((img.name || '') + (img.ext || ''))  | 
					
						
							|  |  |  | 					|| text.split(/[\\\/]/).pop() } | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			item.find('.shown').text(txt) | 
					
						
							|  |  |  | 			item.find('.hidden').text(text) | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 			return item }, | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 		path: 'gid', | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 		'edit-mode': function(item){ | 
					
						
							|  |  |  | 			// cleanup...
 | 
					
						
							|  |  |  | 			if(item == null){ | 
					
						
							|  |  |  | 				this.__edit_mode_indicator_update | 
					
						
							|  |  |  | 					&& this.off('keyPress', this.__edit_mode_indicator_update) | 
					
						
							|  |  |  | 				delete this.__edit_mode_indicator_update | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				return } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			var update = this.__edit_mode_indicator_update =  | 
					
						
							|  |  |  | 				this.__edit_mode_indicator_update  | 
					
						
							|  |  |  | 					|| (function(){ | 
					
						
							|  |  |  | 						var caps = this.keyboard.capslock | 
					
						
							|  |  |  | 						caps = typeof(event) != 'undefined' && event.getModifierState ?  | 
					
						
							|  |  |  | 							event.getModifierState('CapsLock') | 
					
						
							|  |  |  | 							: caps | 
					
						
							|  |  |  | 						item | 
					
						
							|  |  |  | 							.attr('info', 'Edit mode '  | 
					
						
							|  |  |  | 								+ (caps ? 'on' : 'off') | 
					
						
							|  |  |  | 								+ ' (Click to update / Press CapsLock to toggle)') | 
					
						
							|  |  |  | 							[caps ? 'addClass' : 'removeClass']('on') }).bind(this) | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-01 19:51:00 +03:00
										 |  |  | 			// cleanup interval handling...
 | 
					
						
							|  |  |  | 			this.__edit_mode_indicator_update_interval | 
					
						
							|  |  |  | 				&& clearInterval(this.__edit_mode_indicator_update_interval) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			// cleanup...
 | 
					
						
							|  |  |  | 			if(item == null){ | 
					
						
							|  |  |  | 				this.off('keyPress', update) | 
					
						
							|  |  |  | 				this.dom.off('focus', update) | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				return } | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-01 19:51:00 +03:00
										 |  |  | 			// setup...
 | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 			if(typeof(item) == typeof('str')){ | 
					
						
							|  |  |  | 				var type = item | 
					
						
							|  |  |  | 				item = $('<span>') | 
					
						
							|  |  |  | 					.addClass('capslock-state expanding-text') | 
					
						
							|  |  |  | 					.append($('<span class="shown">') | 
					
						
							|  |  |  | 						.text('E')) | 
					
						
							|  |  |  | 					.append($('<span class="hidden">') | 
					
						
							|  |  |  | 						.text('Edit mode')) | 
					
						
							|  |  |  | 					.click(update) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				this.on('keyPress', update) | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				this.dom.focus(update) } | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-02-01 19:51:00 +03:00
										 |  |  | 			// update timer...
 | 
					
						
							|  |  |  | 			// NOTE: this is needed so as to reflect changes to settings...
 | 
					
						
							|  |  |  | 			var t = this.config['status-bar-edit-mode-indicator-update-interval'] | 
					
						
							|  |  |  | 			t = t == null ? 5000 : t | 
					
						
							|  |  |  | 			if(t){ | 
					
						
							|  |  |  | 				this.__edit_mode_indicator_update_interval = setInterval(update, t) } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			// update state...
 | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 			update() | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 			return item }, | 
					
						
							| 
									
										
										
										
											2016-03-05 02:15:11 +03:00
										 |  |  | 		// XXX show menu in the appropriate corner...
 | 
					
						
							| 
									
										
										
										
											2018-03-20 12:46:16 +03:00
										 |  |  | 		// XXX remove the type+ed class...
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 		mark: function(item, gid, img){ | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 			// cleanup...
 | 
					
						
							|  |  |  | 			if(item == null){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				return } | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			gid = gid || this.current | 
					
						
							|  |  |  | 			var that = this | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			if(typeof(item) == typeof('str')){ | 
					
						
							|  |  |  | 				var type = item | 
					
						
							|  |  |  | 				item = $('<span>') | 
					
						
							| 
									
										
										
										
											2018-03-20 17:01:51 +03:00
										 |  |  | 					.addClass(type + 'ed') | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 					.attr('info', 'Image ' | 
					
						
							|  |  |  | 						+(type == 'mark' ? 'selection' : 'bookmark') | 
					
						
							|  |  |  | 						+' status (click to toggle)') | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 					.click(function(){ | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 						that['toggle'+type.capitalize()]() | 
					
						
							| 
									
										
										
										
											2016-02-16 06:24:58 +03:00
										 |  |  | 					}) | 
					
						
							| 
									
										
										
										
											2016-03-05 02:15:11 +03:00
										 |  |  | 					// toggle action menu...
 | 
					
						
							|  |  |  | 					// XXX show this in the appropriate corner...
 | 
					
						
							| 
									
										
										
										
											2018-03-20 04:25:22 +03:00
										 |  |  | 					.on('contextmenu', function(evt){ | 
					
						
							|  |  |  | 						evt = window.event || evt | 
					
						
							|  |  |  | 						evt.preventDefault() | 
					
						
							|  |  |  | 						evt.stopPropagation() | 
					
						
							| 
									
										
										
										
											2016-03-05 02:15:11 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 						that.browseActions('/'+ type.capitalize() +'/') }) | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				var type = item.attr('type') } | 
					
						
							| 
									
										
										
										
											2016-02-16 06:24:58 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			// NOTE: we are not using .toggleMark('?') and friends 
 | 
					
						
							|  |  |  | 			// 		here to avoid recursion as we might be handling 
 | 
					
						
							|  |  |  | 			// 		them here...
 | 
					
						
							|  |  |  | 			// 		...this also simpler than handling '?' and other
 | 
					
						
							|  |  |  | 			// 		special toggler args in the handler...
 | 
					
						
							| 
									
										
										
										
											2016-04-02 17:34:25 +03:00
										 |  |  | 			var tags = this.data ? this.data.getTags(gid) : [] | 
					
						
							| 
									
										
										
										
											2018-11-08 21:10:58 +03:00
										 |  |  | 			var tag = type == 'mark' ? 'marked' : 'bookmark' | 
					
						
							| 
									
										
										
										
											2018-03-20 04:25:22 +03:00
										 |  |  | 			var on = item.hasClass('on') | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			item[tags.indexOf(tag) < 0 ? | 
					
						
							|  |  |  | 					'removeClass'  | 
					
						
							|  |  |  | 					: 'addClass']('on') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 			return item }, | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 		bookmark: 'mark',  | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-01-05 03:06:06 +03:00
										 |  |  | 	toggleStatusBar: ['Interface/Status bar mode', | 
					
						
							| 
									
										
										
										
											2018-03-20 04:25:22 +03:00
										 |  |  | 		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. | 
					
						
							|  |  |  | 		`,
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 		toggler.CSSClassToggler( | 
					
						
							| 
									
										
										
										
											2016-04-02 17:34:25 +03:00
										 |  |  | 			// get/construct status bar...
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			function(){  | 
					
						
							| 
									
										
										
										
											2016-04-02 17:34:25 +03:00
										 |  |  | 				// no viewer yet...
 | 
					
						
							| 
									
										
										
										
											2017-05-16 00:26:37 +03:00
										 |  |  | 				if(!this.ribbons || !this.dom){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 					return $() } | 
					
						
							| 
									
										
										
										
											2016-04-02 17:34:25 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-05-16 00:26:37 +03:00
										 |  |  | 				var bar = this.dom.find('.state-indicator-container.global-info')  | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 				if(bar.length == 0){ | 
					
						
							| 
									
										
										
										
											2016-05-07 00:47:52 +03:00
										 |  |  | 					bar = makeStateIndicator('global-info overlay-info statusbar')  | 
					
						
							| 
									
										
										
										
											2018-03-20 04:25:22 +03:00
										 |  |  | 						.addClass(this.config['status-bar'] | 
					
						
							|  |  |  | 							|| Object.keys(this.config['status-bars'])[0]  | 
					
						
							| 
									
										
										
										
											2016-06-16 04:49:17 +03:00
										 |  |  | 							|| '') | 
					
						
							| 
									
										
										
										
											2018-03-20 04:25:22 +03:00
										 |  |  | 						.on('mouseover', function(evt){ | 
					
						
							|  |  |  | 							evt = window.event || evt | 
					
						
							|  |  |  | 							var t = $(evt.target) | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 							 | 
					
						
							|  |  |  | 							var info = t.attr('info')  | 
					
						
							|  |  |  | 								|| t.parents('.overlay-info, [info]').first().attr('info') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 							if(info){ | 
					
						
							|  |  |  | 								bar.find('.info').text(info) | 
					
						
							|  |  |  | 							} | 
					
						
							|  |  |  | 						}) | 
					
						
							|  |  |  | 						.on('mouseout', function(){ | 
					
						
							|  |  |  | 							bar.find('.info').empty() | 
					
						
							|  |  |  | 						}) | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 						.appendTo(this.dom) } | 
					
						
							|  |  |  | 				return bar },  | 
					
						
							| 
									
										
										
										
											2018-03-20 04:25:22 +03:00
										 |  |  | 			function(){ return Object.keys(this.config['status-bars']).concat(['none']) }, | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			// XXX check if we will be getting gid reliably...
 | 
					
						
							|  |  |  | 			function(state, bar, gid){  | 
					
						
							| 
									
										
										
										
											2016-06-16 04:49:17 +03:00
										 |  |  | 				// do not do anything unless the status bar exists...
 | 
					
						
							|  |  |  | 				if(bar.length == 0){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 					return } | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 				var that = this | 
					
						
							| 
									
										
										
										
											2018-03-20 04:25:22 +03:00
										 |  |  | 				this.config['status-bar'] = state  | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 				var _getHandler = function(key){ | 
					
						
							|  |  |  | 					var elems = that.__statusbar_elements__ || {} | 
					
						
							|  |  |  | 					var base_elems = StatusBarActions.__statusbar_elements__ || {} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 					var handler = elems[key] || base_elems[key] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 					if(handler == null){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 						return } | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 					// handle aliases...
 | 
					
						
							|  |  |  | 					var seen = [] | 
					
						
							|  |  |  | 					while(typeof(handler) == typeof('str')){ | 
					
						
							|  |  |  | 						seen.push(handler) | 
					
						
							|  |  |  | 						var handler = elems[handler] || base_elems[handler] | 
					
						
							|  |  |  | 						// check for loops...
 | 
					
						
							|  |  |  | 						if(seen.indexOf(handler) >= 0){ | 
					
						
							|  |  |  | 							console.error('state indicator alias loop detected at:', key) | 
					
						
							|  |  |  | 							handler = null | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 							break } } | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 					return handler } | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-20 04:25:22 +03:00
										 |  |  | 				// clear...
 | 
					
						
							|  |  |  | 				if(state == 'none' || !bar.hasClass(state)){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 					this.clearStatusBarCache() | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 					// notify items that they are removed...
 | 
					
						
							|  |  |  | 					bar.children() | 
					
						
							|  |  |  | 						.each(function(i, item){ | 
					
						
							|  |  |  | 							item = $(item) | 
					
						
							|  |  |  | 							var type = item.attr('type')  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 							if(type == null){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 								return } | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 							var handler = _getHandler(type) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 							if(handler != null){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 								handler.call(that, null) } | 
					
						
							| 
									
										
										
										
											2017-04-22 06:20:12 +03:00
										 |  |  | 						}) | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 					bar.empty() } | 
					
						
							| 
									
										
										
										
											2018-03-20 04:25:22 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 				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]
 | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 					return } | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 				// build/update...
 | 
					
						
							| 
									
										
										
										
											2018-03-20 04:25:22 +03:00
										 |  |  | 				gid = gid || this.current | 
					
						
							|  |  |  | 				var img = this.images && this.images[gid] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				// build...
 | 
					
						
							|  |  |  | 				if(bar.children().length <= 0){ | 
					
						
							|  |  |  | 					var items = this.config['status-bars'][state].slice() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 					// rearrange the tail section...
 | 
					
						
							|  |  |  | 					// NOTE: this is here as we need to push the floated
 | 
					
						
							|  |  |  | 					// 		right items in reverse order...
 | 
					
						
							|  |  |  | 					var i = items.indexOf('---') | 
					
						
							|  |  |  | 					items = i >= 0 ?  | 
					
						
							|  |  |  | 						items.concat(items.splice(i+1, items.length).reverse()) | 
					
						
							|  |  |  | 						: items | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 					items.forEach(function(item){ | 
					
						
							|  |  |  | 						// spacer...
 | 
					
						
							|  |  |  | 						if(item == '---'){ | 
					
						
							|  |  |  | 							//item = $('<span class="spacer">')
 | 
					
						
							|  |  |  | 							item = $('<span class="spacer info">') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 						// info items...
 | 
					
						
							|  |  |  | 						} else { | 
					
						
							|  |  |  | 							var handler = _getHandler(item) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 							var type = item | 
					
						
							|  |  |  | 							item = (handler ?  | 
					
						
							|  |  |  | 									handler.call(that, item, gid, img)  | 
					
						
							|  |  |  | 									: $('<span>')) | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 								.attr('type', item) } | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 						bar.append(item) }) | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-20 04:25:22 +03:00
										 |  |  | 				// update...
 | 
					
						
							|  |  |  | 				} else { | 
					
						
							|  |  |  | 					var items = bar.children() | 
					
						
							|  |  |  | 						.each(function(i, item){ | 
					
						
							|  |  |  | 							item = $(item) | 
					
						
							|  |  |  | 							var type = item.attr('type')  | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-20 04:25:22 +03:00
										 |  |  | 							if(type == null){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 								return } | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-20 04:25:22 +03:00
										 |  |  | 							var handler = _getHandler(type) | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-20 04:25:22 +03:00
										 |  |  | 							if(handler != null){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 								handler.call(that, item, gid, img) } }) } }, | 
					
						
							| 
									
										
										
										
											2018-03-20 04:25:22 +03:00
										 |  |  | 			null)],	 | 
					
						
							| 
									
										
										
										
											2016-04-14 19:35:59 +03:00
										 |  |  | 	updateStatusBar: ['- Interface/Update satus bar', | 
					
						
							| 
									
										
										
										
											2020-12-03 04:03:20 +03:00
										 |  |  | 		{precall: actions.debounce()}, | 
					
						
							| 
									
										
										
										
											2020-11-27 19:24:49 +03:00
										 |  |  | 		'toggleStatusBar: "!"'], | 
					
						
							| 
									
										
										
										
											2016-03-25 00:49:14 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	resetStatusBar: ['Interface/Reset status bar', | 
					
						
							|  |  |  | 		function(){ | 
					
						
							|  |  |  | 			var mode = this.toggleStatusBar('?') | 
					
						
							|  |  |  | 			this.toggleStatusBar('none') | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 			this.toggleStatusBar(mode) }], | 
					
						
							|  |  |  | 	clearStatusBarCache: ['- Interface/Clear status bar cache', | 
					
						
							|  |  |  | 		'clearCache: "*" "statusbar"'], | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-29 07:34:49 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-20 12:46:16 +03:00
										 |  |  | 	// XXX should this blink the on state only???
 | 
					
						
							|  |  |  | 	statusItemBlink: ['- Interface/', | 
					
						
							|  |  |  | 		core.doc`
 | 
					
						
							|  |  |  | 		 | 
					
						
							|  |  |  | 		NOTE: type is the same as in .__statusbar_elements__`,
 | 
					
						
							|  |  |  | 		function(type){ | 
					
						
							|  |  |  | 			if(type == null){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				return } | 
					
						
							| 
									
										
										
										
											2018-03-20 12:46:16 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			var gid = this.current | 
					
						
							| 
									
										
										
										
											2018-03-20 17:01:51 +03:00
										 |  |  | 			var item = this.dom.find(`.state-indicator-container.global-info [type=${type}]`)  | 
					
						
							| 
									
										
										
										
											2018-03-20 12:46:16 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			// blink the indicator...
 | 
					
						
							|  |  |  | 			item | 
					
						
							|  |  |  | 				.removeClass('blink') | 
					
						
							|  |  |  | 				.addClass('blink') | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				.on('animationend', function(){ item.removeClass('blink') }) }], | 
					
						
							| 
									
										
										
										
											2018-03-20 12:46:16 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-29 07:34:49 +03:00
										 |  |  | 	// XXX should these be here???
 | 
					
						
							|  |  |  | 	// XXX should this show a dialog???
 | 
					
						
							| 
									
										
										
										
											2017-01-11 22:32:16 +03:00
										 |  |  | 	editStatusBarIndex: ['- Interface/Edit image focus position in statusbar', | 
					
						
							| 
									
										
										
										
											2016-03-29 07:34:49 +03:00
										 |  |  | 		function(){ | 
					
						
							| 
									
										
										
										
											2016-03-29 07:41:41 +03:00
										 |  |  | 			if((this.config['status-bar-index'] || {} )['editable']){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				this.toggleStatusBar('?') == 'none'  | 
					
						
							|  |  |  | 					&& this.toggleStatusBar() | 
					
						
							| 
									
										
										
										
											2016-03-29 07:41:41 +03:00
										 |  |  | 				// XXX do this better...
 | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				this.dom.find('.global-info .index .position').focus().click() } }], | 
					
						
							| 
									
										
										
										
											2017-01-11 22:32:16 +03:00
										 |  |  | 	editStatusBarRibbon: ['- Interface/Edit ribbon focus position in statusbar', | 
					
						
							| 
									
										
										
										
											2016-06-07 21:00:16 +03:00
										 |  |  | 		function(){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 			this.toggleStatusBar('?') == 'none'  | 
					
						
							|  |  |  | 				&& this.toggleStatusBar() | 
					
						
							| 
									
										
										
										
											2016-06-07 21:00:16 +03:00
										 |  |  | 			// XXX do this better...
 | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 			this.dom.find('.global-info .ribbon-number').focus().click() }], | 
					
						
							| 
									
										
										
										
											2016-03-29 07:34:49 +03:00
										 |  |  | 	toggleStatusBarIndexMode: ['Interface/Status bar index mode', | 
					
						
							|  |  |  | 		toggler.CSSClassToggler( | 
					
						
							| 
									
										
										
										
											2018-11-16 01:39:29 +03:00
										 |  |  | 			function(){  | 
					
						
							|  |  |  | 				return this.dom.find('.global-info .index') }, | 
					
						
							|  |  |  | 			['normal', 'loaded', 'global'], | 
					
						
							| 
									
										
										
										
											2016-03-29 07:34:49 +03:00
										 |  |  | 			function(state){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				this.toggleStatusBar('?') == 'none'  | 
					
						
							|  |  |  | 					&& this.toggleStatusBar() | 
					
						
							| 
									
										
										
										
											2016-03-29 07:41:41 +03:00
										 |  |  | 				// prepare for saving the config...
 | 
					
						
							| 
									
										
										
										
											2016-03-29 07:34:49 +03:00
										 |  |  | 				this.config['status-bar-index'] =  | 
					
						
							|  |  |  | 					JSON.parse(JSON.stringify(this.config['status-bar-index'])) | 
					
						
							|  |  |  | 				this.config['status-bar-index']['mode'] = state | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				this.updateStatusBar() })], | 
					
						
							| 
									
										
										
										
											2016-11-08 18:57:11 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// XXX revise...
 | 
					
						
							|  |  |  | 	showStatusBarInfo: ['- Interface/', | 
					
						
							| 
									
										
										
										
											2020-05-21 19:05:48 +03:00
										 |  |  | 		core.doc`
 | 
					
						
							|  |  |  | 			Show info... | 
					
						
							|  |  |  | 			.showStatusBarInfo(text) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			Show info for timeout then fadeout... | 
					
						
							|  |  |  | 			.showStatusBarInfo(text, timeout) | 
					
						
							|  |  |  | 			.showStatusBarInfo(text, timeout, fadeout) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			Hide info... | 
					
						
							|  |  |  | 			.showStatusBarInfo() | 
					
						
							|  |  |  | 			.showStatusBarInfo('') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			Fadeout info for timeout... | 
					
						
							|  |  |  | 			.showStatusBarInfo(fadeout) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		`,
 | 
					
						
							|  |  |  | 		function(text, timeout, fadeout){ | 
					
						
							| 
									
										
										
										
											2020-05-21 19:28:28 +03:00
										 |  |  | 			var that = this | 
					
						
							| 
									
										
										
										
											2020-05-21 19:05:48 +03:00
										 |  |  | 			timeout = timeout === true ?  | 
					
						
							|  |  |  | 				1000  | 
					
						
							|  |  |  | 				: timeout | 
					
						
							|  |  |  | 			fadeout = fadeout || 200 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-21 05:19:54 +03:00
										 |  |  | 			// reset clear timeout...
 | 
					
						
							|  |  |  | 			this.__statusbar_info_timeout | 
					
						
							|  |  |  | 				&& clearTimeout(this.__statusbar_info_timeout) | 
					
						
							|  |  |  | 			delete this.__statusbar_info_timeout | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-21 19:28:28 +03:00
										 |  |  | 			var bar = this.dom.find('.state-indicator-container.global-info .info')  | 
					
						
							| 
									
										
										
										
											2016-11-08 18:57:11 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2020-05-21 19:05:48 +03:00
										 |  |  | 			// update the element...
 | 
					
						
							|  |  |  | 			// fadeout...
 | 
					
						
							| 
									
										
										
										
											2020-05-21 19:28:28 +03:00
										 |  |  | 			typeof(text) == typeof(123) ? | 
					
						
							|  |  |  | 				bar.fadeOut(text, function(){ | 
					
						
							|  |  |  | 					that.showStatusBarInfo() }) | 
					
						
							|  |  |  | 			// show/hide...
 | 
					
						
							|  |  |  | 			: bar | 
					
						
							|  |  |  | 				.text(text || '') | 
					
						
							|  |  |  | 				.stop() | 
					
						
							| 
									
										
										
										
											2020-05-21 19:05:48 +03:00
										 |  |  | 				.show() | 
					
						
							| 
									
										
										
										
											2020-05-21 19:28:28 +03:00
										 |  |  | 				.css({opacity: ''}) | 
					
						
							| 
									
										
										
										
											2020-05-21 05:19:54 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			// clear after timeout...
 | 
					
						
							|  |  |  | 			timeout  | 
					
						
							|  |  |  | 				&& text && text.trim() != '' | 
					
						
							|  |  |  | 				&& (this.__statusbar_info_timeout =  | 
					
						
							|  |  |  | 					setTimeout(function(){ | 
					
						
							| 
									
										
										
										
											2020-05-21 19:05:48 +03:00
										 |  |  | 							delete this.__statusbar_info_timeout | 
					
						
							|  |  |  | 							this.showStatusBarInfo(fadeout) }.bind(this),  | 
					
						
							|  |  |  | 						timeout)) }], | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | var StatusBar =  | 
					
						
							|  |  |  | module.StatusBar = core.ImageGridFeatures.Feature({ | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 	title: '', | 
					
						
							|  |  |  | 	doc: '', | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 	tag: 'ui-status-bar', | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 	depends: [ | 
					
						
							|  |  |  | 		'ui', | 
					
						
							| 
									
										
										
										
											2018-01-13 05:19:45 +03:00
										 |  |  | 		//'ui-chrome',
 | 
					
						
							| 
									
										
										
										
											2016-03-05 02:45:02 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-08 18:43:29 +03:00
										 |  |  | 		// XXX this is here to enable context menu 
 | 
					
						
							|  |  |  | 		// 		see: StatusBarActions.__statusbar_elements__.mark(..)
 | 
					
						
							| 
									
										
										
										
											2016-03-05 02:45:02 +03:00
										 |  |  | 		'ui-browse-actions', | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 	], | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 	actions: StatusBarActions, | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	handlers: [ | 
					
						
							|  |  |  | 		['start', | 
					
						
							|  |  |  | 			function(){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				this.toggleStatusBar(this.config['status-bar']) }], | 
					
						
							| 
									
										
										
										
											2018-12-06 00:59:05 +03:00
										 |  |  | 		['focusImage clear markChanged refresh', | 
					
						
							| 
									
										
										
										
											2016-02-16 05:53:33 +03:00
										 |  |  | 			function(){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				this.updateStatusBar() }], | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 		[[ | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 			'tag', | 
					
						
							|  |  |  | 			'untag', | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 		], | 
					
						
							| 
									
										
										
										
											2016-02-16 05:53:33 +03:00
										 |  |  | 			function(res, tags, gids){ | 
					
						
							|  |  |  | 				// trigger only when current image is affected...
 | 
					
						
							| 
									
										
										
										
											2017-09-04 22:53:29 +03:00
										 |  |  | 				if(gids instanceof Array  | 
					
						
							| 
									
										
										
										
											2016-02-16 05:53:33 +03:00
										 |  |  | 						&& (gids.indexOf('current') >= 0  | 
					
						
							|  |  |  | 							|| gids.indexOf(this.current) >= 0) | 
					
						
							|  |  |  | 						|| this.data.getImage(gids) == this.current){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 					this.updateStatusBar() } }], | 
					
						
							| 
									
										
										
										
											2016-03-29 00:31:50 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-16 00:56:15 +03:00
										 |  |  | 		['ribbonPanning.post', | 
					
						
							|  |  |  | 			function(_, gid){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 				gid == this.data.getRibbon()  | 
					
						
							|  |  |  | 					&& this.updateStatusBar() }], | 
					
						
							| 
									
										
										
										
											2016-05-16 00:56:15 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-20 12:46:16 +03:00
										 |  |  | 		// blink status mark indicators on toggle...
 | 
					
						
							|  |  |  | 		['toggleMark', | 
					
						
							|  |  |  | 			function(){ | 
					
						
							|  |  |  | 				this.toggleStatusBar('?') == 'hidden' | 
					
						
							|  |  |  | 					&& this.statusItemBlink('mark') }], | 
					
						
							|  |  |  | 		['toggleBookmark', | 
					
						
							|  |  |  | 			function(){ | 
					
						
							|  |  |  | 				this.toggleStatusBar('?') == 'hidden' | 
					
						
							|  |  |  | 					&& this.statusItemBlink('bookmark') }], | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2018-03-21 17:34:26 +03:00
										 |  |  | 		// Workspaces...
 | 
					
						
							| 
									
										
										
										
											2016-03-29 00:31:50 +03:00
										 |  |  | 		['saveWorkspace', | 
					
						
							|  |  |  | 			core.makeWorkspaceConfigWriter( | 
					
						
							|  |  |  | 				function(){ return Object.keys(StatusBar.config) })], | 
					
						
							| 
									
										
										
										
											2018-03-21 17:34:26 +03:00
										 |  |  | 		// workspace defaults...
 | 
					
						
							|  |  |  | 		[[ | 
					
						
							|  |  |  | 			'loadWorkspace.pre',  | 
					
						
							|  |  |  | 			'saveWorkspace.pre', | 
					
						
							|  |  |  | 		], | 
					
						
							|  |  |  | 			function(workspace){ | 
					
						
							|  |  |  | 				if(!workspace || workspace in this.workspaces){ | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 					return } | 
					
						
							| 
									
										
										
										
											2018-03-21 17:34:26 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 				this.config['status-bar'] =  | 
					
						
							|  |  |  | 					(this.config['status-bar-workspace-defaults'][workspace]  | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 						|| this.config['status-bar']) }], | 
					
						
							| 
									
										
										
										
											2016-03-29 00:31:50 +03:00
										 |  |  | 		['loadWorkspace', | 
					
						
							|  |  |  | 			core.makeWorkspaceConfigLoader( | 
					
						
							| 
									
										
										
										
											2016-06-16 04:49:17 +03:00
										 |  |  | 				function(){  | 
					
						
							| 
									
										
										
										
											2018-03-21 17:34:26 +03:00
										 |  |  | 					return this.config['status-bar-workspace-attrs'] }, | 
					
						
							| 
									
										
										
										
											2016-03-29 00:31:50 +03:00
										 |  |  | 				function(workspace){ | 
					
						
							| 
									
										
										
										
											2016-03-30 15:24:01 +03:00
										 |  |  | 					if(this.workspace == 'ui-chrome-hidden'){ | 
					
						
							| 
									
										
										
										
											2018-03-21 17:34:26 +03:00
										 |  |  | 						this.toggleStatusBar('hidden') | 
					
						
							| 
									
										
										
										
											2016-03-30 15:24:01 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-16 04:49:17 +03:00
										 |  |  | 					} else { | 
					
						
							| 
									
										
										
										
											2018-03-21 17:34:26 +03:00
										 |  |  | 						'status-bar' in workspace ? | 
					
						
							| 
									
										
										
										
											2018-03-20 04:25:22 +03:00
										 |  |  | 							this.toggleStatusBar(workspace['status-bar']) | 
					
						
							| 
									
										
										
										
											2020-11-27 23:11:10 +03:00
										 |  |  | 							: this.toggleStatusBar(this.config['status-bar']) } })], | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 	], | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //---------------------------------------------------------------------
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // XXX
 | 
					
						
							|  |  |  | var GlobalStateIndicator =  | 
					
						
							|  |  |  | module.GlobalStateIndicator = core.ImageGridFeatures.Feature({ | 
					
						
							|  |  |  | 	title: '', | 
					
						
							|  |  |  | 	doc: '', | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	tag: 'ui-global-state-indicator', | 
					
						
							|  |  |  | 	depends: [ | 
					
						
							|  |  |  | 		'ui' | 
					
						
							|  |  |  | 		//'ui-single-image-view',
 | 
					
						
							|  |  |  | 	], | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //---------------------------------------------------------------------
 | 
					
						
							|  |  |  | // XXX
 | 
					
						
							|  |  |  | // XXX might also be a good idea to use the similar mechanism for tips...
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | var StatusLogActions = actions.Actions({ | 
					
						
							|  |  |  | 	config: { | 
					
						
							|  |  |  | 		// NOTE: if this is 0 then do not trim the log...
 | 
					
						
							|  |  |  | 		'ui-status-log-size': 100, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		'ui-status-fade': 1000, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	// XXX should this be here or in a separate feature???
 | 
					
						
							|  |  |  | 	statusLog: ['Interface/Show status log', | 
					
						
							| 
									
										
										
										
											2020-05-31 17:53:14 +03:00
										 |  |  | 		{mode: 'advancedBrowseModeAction'}, | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 		function(){ | 
					
						
							|  |  |  | 			// XXX use list
 | 
					
						
							|  |  |  | 		}], | 
					
						
							|  |  |  | 	clearStatusLog: ['Interface/Clear status log', | 
					
						
							| 
									
										
										
										
											2020-05-31 17:53:14 +03:00
										 |  |  | 		{mode: 'advancedBrowseModeAction'}, | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 		function(){ | 
					
						
							| 
									
										
										
										
											2020-11-28 00:10:37 +03:00
										 |  |  | 			delete this.__status_log }], | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 	statusMessage: ['- Interface/', | 
					
						
							|  |  |  | 		function(){ | 
					
						
							| 
									
										
										
										
											2018-11-12 23:04:00 +03:00
										 |  |  | 			var msg = [...arguments] | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 			if(msg.len == 0){ | 
					
						
							| 
									
										
										
										
											2020-11-28 00:10:37 +03:00
										 |  |  | 				return } | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 			var log = this.__status_log = this.__status_log || [] | 
					
						
							|  |  |  | 			 | 
					
						
							|  |  |  | 			// XXX should we convert here and how???
 | 
					
						
							|  |  |  | 			log.push(msg.join(' ')) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			// truncate the log...
 | 
					
						
							|  |  |  | 			var s = this.config['ui-status-log-size'] | 
					
						
							|  |  |  | 			if(s != 0 && log.length > (s || 100)){ | 
					
						
							| 
									
										
										
										
											2020-11-28 00:10:37 +03:00
										 |  |  | 				log.splice(0, log.length - (s || 100)) } | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			// XXX show the message above the status bar (same style)...
 | 
					
						
							|  |  |  | 			// XXX
 | 
					
						
							|  |  |  | 		}], | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | var StatusLog =  | 
					
						
							|  |  |  | module.StatusLog = core.ImageGridFeatures.Feature({ | 
					
						
							|  |  |  | 	title: '', | 
					
						
							|  |  |  | 	doc: '', | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	tag: 'ui-status-log', | 
					
						
							|  |  |  | 	depends: [ | 
					
						
							|  |  |  | 		'ui' | 
					
						
							|  |  |  | 	], | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	actions: StatusLogActions, | 
					
						
							|  |  |  | }) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /********************************************************************** | 
					
						
							| 
									
										
										
										
											2016-08-20 22:49:36 +03:00
										 |  |  | * vim:set ts=4 sw=4 :                               */ return module }) |