| 
									
										
										
										
											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>') | 
					
						
							|  |  |  | 		.addClass('state-indicator-container ' + type || '') | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // XXX do we need this???
 | 
					
						
							|  |  |  | var makeStateIndicatorItem = function(container, type, text){ | 
					
						
							|  |  |  | 	var item = $('<div>') | 
					
						
							|  |  |  | 			.addClass('item '+ type || '') | 
					
						
							|  |  |  | 			.attr('text', text) | 
					
						
							|  |  |  | 	this.ribbons.viewer.find('.state-indicator-container.'+container) | 
					
						
							|  |  |  | 		.append(item) | 
					
						
							|  |  |  | 	return item | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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: { | 
					
						
							| 
									
										
										
										
											2016-06-16 04:49:17 +03:00
										 |  |  | 		'status-bar-mode': 'full', | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 		'status-bar-modes': [ | 
					
						
							|  |  |  | 			'none', | 
					
						
							|  |  |  | 			'minimal', | 
					
						
							| 
									
										
										
										
											2016-03-20 17:13:03 +03:00
										 |  |  | 			'full', | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 		], | 
					
						
							| 
									
										
										
										
											2016-06-07 04:03:56 +03:00
										 |  |  | 		// XXX make different configurations for different modes instead 
 | 
					
						
							|  |  |  | 		// 		of hiding some items... (???)
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 		'status-bar-items': [ | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 			'index', | 
					
						
							| 
									
										
										
										
											2016-06-07 04:03:56 +03:00
										 |  |  | 			'ribbon', | 
					
						
							| 
									
										
										
										
											2016-06-09 00:10:11 +03:00
										 |  |  | 			'changes', | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 			'gid', | 
					
						
							| 
									
										
										
										
											2016-04-12 08:06:45 +03:00
										 |  |  | 			'path', | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			// separates left/right aligned elements...
 | 
					
						
							|  |  |  | 			'---', | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			'mark', | 
					
						
							|  |  |  | 			'bookmark', | 
					
						
							|  |  |  | 		], | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 		// XXX not sure about this...
 | 
					
						
							|  |  |  | 		'status-bar-full-only': [ | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 			'gid', | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			'path', | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 		], | 
					
						
							| 
									
										
										
										
											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-06-17 03:50:25 +03:00
										 |  |  | 		'status-bar-changes-text': '*', | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 	__statusbar_elements__: { | 
					
						
							|  |  |  | 		index: function(item, gid, img){ | 
					
						
							| 
									
										
										
										
											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 | 
					
						
							|  |  |  | 				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() | 
					
						
							| 
									
										
										
										
											2016-03-25 00:49:14 +03:00
										 |  |  | 								that.updateStatusBar() | 
					
						
							|  |  |  | 							}) | 
					
						
							|  |  |  | 						// editable...
 | 
					
						
							|  |  |  | 						: $('<span>') | 
					
						
							|  |  |  | 							.addClass('position editable') | 
					
						
							| 
									
										
										
										
											2016-06-09 00:10:11 +03:00
										 |  |  | 							.attr('info', 'Image number (click to edit)') | 
					
						
							| 
									
										
										
										
											2016-06-07 06:03:16 +03:00
										 |  |  | 							.makeEditable() | 
					
						
							| 
									
										
										
										
											2016-06-07 04:28:56 +03:00
										 |  |  | 							// select image when done...
 | 
					
						
							|  |  |  | 							.on('edit-done', function(_, text){ | 
					
						
							|  |  |  | 								var i = parseInt(text) | 
					
						
							| 
									
										
										
										
											2016-03-25 01:04:26 +03:00
										 |  |  | 								i = i >= 1 ? i-1 | 
					
						
							|  |  |  | 									: i == null ? 'current' | 
					
						
							|  |  |  | 									: i | 
					
						
							| 
									
										
										
										
											2016-06-07 04:28:56 +03:00
										 |  |  | 								that.focusImage(i,  | 
					
						
							|  |  |  | 									item.hasClass('global') ? 'global' : undefined) | 
					
						
							| 
									
										
										
										
											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()
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 								if((that.config['status-bar-index'] || {})['live-update-on-edit']){ | 
					
						
							|  |  |  | 									var i = parseInt($(this).text()) | 
					
						
							|  |  |  | 									i = i >= 1 ? i-1 | 
					
						
							|  |  |  | 										: i == null ? 'current' | 
					
						
							|  |  |  | 										: i | 
					
						
							|  |  |  | 									that.focusImage(i, | 
					
						
							| 
									
										
										
										
											2016-03-25 00:49:14 +03:00
										 |  |  | 										item.hasClass('global') ? 'global' : undefined) | 
					
						
							| 
									
										
										
										
											2016-04-14 18:58:27 +03:00
										 |  |  | 								} | 
					
						
							| 
									
										
										
										
											2016-03-25 00:49:14 +03:00
										 |  |  | 							}) | 
					
						
							| 
									
										
										
										
											2016-10-31 02:27:49 +03:00
										 |  |  | 							.on('click focus', function(){ | 
					
						
							| 
									
										
										
										
											2016-04-14 18:41:19 +03:00
										 |  |  | 								$(this).selectText() | 
					
						
							| 
									
										
										
										
											2016-03-25 00:49:14 +03:00
										 |  |  | 							}) | 
					
						
							|  |  |  | 							.blur(function(){ | 
					
						
							|  |  |  | 								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() | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 							that.updateStatusBar() | 
					
						
							| 
									
										
										
										
											2016-02-13 07:59:54 +03:00
										 |  |  | 						})) | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			} else { | 
					
						
							|  |  |  | 				var type = item.attr('type') | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			// update...
 | 
					
						
							| 
									
										
										
										
											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' | 
					
						
							|  |  |  | 			item | 
					
						
							|  |  |  | 				.addClass(cls) | 
					
						
							|  |  |  | 				.removeClass(cls != 'normal' ? 'normal' : 'global') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			// global index...
 | 
					
						
							| 
									
										
										
										
											2016-03-29 07:34:49 +03:00
										 |  |  | 			if(cls == 'global'){ | 
					
						
							| 
									
										
										
										
											2016-03-24 23:14:25 +03:00
										 |  |  | 				item.find('.position:not(:focus)') | 
					
						
							| 
									
										
										
										
											2016-04-02 17:34:25 +03:00
										 |  |  | 					.text(this.data ? this.data.getImageOrder(gid)+1 : 0) | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 				item.find('.length') | 
					
						
							| 
									
										
										
										
											2016-04-02 17:34:25 +03:00
										 |  |  | 					.text('/'+ (this.data ? this.data.length : 0)) | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			// ribbon index...
 | 
					
						
							|  |  |  | 			} else { | 
					
						
							| 
									
										
										
										
											2016-03-24 23:14:25 +03:00
										 |  |  | 				item.find('.position:not(:focus)') | 
					
						
							| 
									
										
										
										
											2016-04-02 17:34:25 +03:00
										 |  |  | 					.text(this.data ? this.data.getImageOrder('ribbon', gid)+1 : 0) | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 				item.find('.length') | 
					
						
							| 
									
										
										
										
											2016-04-02 17:34:25 +03:00
										 |  |  | 					.text('/'+ (this.data ? this.data.getImages(gid).len : 0)) | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			return item | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2016-06-07 04:03:56 +03:00
										 |  |  | 		ribbon: function(item, gid, img){ | 
					
						
							|  |  |  | 			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-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>') | 
					
						
							|  |  |  | 					.addClass('ribbon-number') | 
					
						
							|  |  |  | 					.attr('info', 'Current ribbon (click to edit)') | 
					
						
							| 
									
										
										
										
											2016-06-07 06:03:16 +03:00
										 |  |  | 					.makeEditable() | 
					
						
							| 
									
										
										
										
											2016-06-07 04:28:56 +03:00
										 |  |  | 					.on('edit-done', function(_, text){ | 
					
						
							|  |  |  | 						that.focusRibbon(text == '*' ? that.base : parseInt(text)) | 
					
						
							|  |  |  | 					}) | 
					
						
							| 
									
										
										
										
											2016-10-31 02:27:49 +03:00
										 |  |  | 					.on('click focus', function(){ | 
					
						
							| 
									
										
										
										
											2016-06-07 04:28:56 +03:00
										 |  |  | 						$(this).selectText() | 
					
						
							| 
									
										
										
										
											2016-06-07 04:03:56 +03:00
										 |  |  | 					}) | 
					
						
							|  |  |  | 					.blur(function(){ | 
					
						
							|  |  |  | 						that.updateStatusBar() | 
					
						
							|  |  |  | 					}) | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-09 00:10:11 +03:00
										 |  |  | 			item.html(n)  | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			// 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 { | 
					
						
							|  |  |  | 				item[0].removeAttribute('base') | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			return item | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		changes: function(item, gid, img){ | 
					
						
							| 
									
										
										
										
											2016-06-16 04:49:17 +03:00
										 |  |  | 			if(this.changes === undefined){ | 
					
						
							|  |  |  | 				return $() | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-09 00:10:11 +03:00
										 |  |  | 			if(typeof(item) == typeof('str')){ | 
					
						
							|  |  |  | 				item = $('<span>') | 
					
						
							|  |  |  | 					.addClass('changes') | 
					
						
							|  |  |  | 					.attr('info', 'Unsaved changes') | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-17 03:50:25 +03:00
										 |  |  | 			item.html(this.changes !== false ? this.config['status-bar-changes-text'] || '*' : '') | 
					
						
							| 
									
										
										
										
											2016-06-07 04:03:56 +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){ | 
					
						
							|  |  |  | 			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(){ | 
					
						
							| 
									
										
										
										
											2016-04-14 18:41:19 +03:00
										 |  |  | 							$(this).selectText() | 
					
						
							| 
									
										
										
										
											2016-04-12 19:01:40 +03:00
										 |  |  | 						})) | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			} else { | 
					
						
							|  |  |  | 				var type = item.attr('type') | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											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(/[\\\/]\.[\\\/]/, '/') | 
					
						
							| 
									
										
										
										
											2016-04-23 17:12:38 +03:00
										 |  |  | 				txt = img && ((img.name || '') + (img.ext || '')) || text.split(/[\\\/]/).pop() | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			return item | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 		}, | 
					
						
							|  |  |  | 		path: 'gid', | 
					
						
							| 
									
										
										
										
											2016-03-05 02:15:11 +03:00
										 |  |  | 		// XXX show menu in the appropriate corner...
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 		mark: function(item, gid, img){ | 
					
						
							|  |  |  | 			gid = gid || this.current | 
					
						
							|  |  |  | 			var that = this | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			if(typeof(item) == typeof('str')){ | 
					
						
							|  |  |  | 				var type = item | 
					
						
							|  |  |  | 				item = $('<span>') | 
					
						
							|  |  |  | 					.addClass(type + 'ed') | 
					
						
							|  |  |  | 					.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...
 | 
					
						
							|  |  |  | 					.on('contextmenu', function(){ | 
					
						
							|  |  |  | 						event.preventDefault() | 
					
						
							|  |  |  | 						event.stopPropagation() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 						that.browseActions('/'+ type.capitalize() +'/') | 
					
						
							|  |  |  | 					}) | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			} else { | 
					
						
							|  |  |  | 				var type = item.attr('type') | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 			} | 
					
						
							| 
									
										
										
										
											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) : [] | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			var tag = type == 'mark' ? 'selected' : 'bookmark' | 
					
						
							|  |  |  | 			item[tags.indexOf(tag) < 0 ? | 
					
						
							|  |  |  | 					'removeClass'  | 
					
						
							|  |  |  | 					: 'addClass']('on') | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			return item | 
					
						
							| 
									
										
										
										
											2016-02-16 06:24:58 +03:00
										 |  |  | 		}, | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 		bookmark: 'mark',  | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 	// NOTE: to reset the status bar cycle through 'none' mode to 
 | 
					
						
							|  |  |  | 	// 		reconstruct all the items.
 | 
					
						
							|  |  |  | 	toggleStatusBar: ['Interface/Toggle status bar modes', | 
					
						
							|  |  |  | 		toggler.CSSClassToggler( | 
					
						
							| 
									
										
										
										
											2016-04-02 17:34:25 +03:00
										 |  |  | 			// get/construct status bar...
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 			// XXX change class...
 | 
					
						
							|  |  |  | 			function(){  | 
					
						
							| 
									
										
										
										
											2016-04-02 17:34:25 +03:00
										 |  |  | 				// no viewer yet...
 | 
					
						
							|  |  |  | 				if(!this.ribbons || !this.ribbons.viewer){ | 
					
						
							|  |  |  | 					return $() | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 				var bar = this.ribbons.viewer.find('.state-indicator-container.global-info')  | 
					
						
							|  |  |  | 				if(bar.length == 0){ | 
					
						
							| 
									
										
										
										
											2016-05-07 00:47:52 +03:00
										 |  |  | 					bar = makeStateIndicator('global-info overlay-info statusbar')  | 
					
						
							| 
									
										
										
										
											2016-06-16 04:49:17 +03:00
										 |  |  | 						.addClass(this.config['status-bar-mode']  | 
					
						
							|  |  |  | 							|| this.config['status-bar-modes'][0]  | 
					
						
							|  |  |  | 							|| '') | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 						.on('mouseover', function(){ | 
					
						
							|  |  |  | 							var t = $(event.target) | 
					
						
							|  |  |  | 							 | 
					
						
							|  |  |  | 							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() | 
					
						
							|  |  |  | 						}) | 
					
						
							|  |  |  | 						.appendTo(this.ribbons.viewer) | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 				} | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 				return bar | 
					
						
							|  |  |  | 			},  | 
					
						
							|  |  |  | 			function(){ return this.config['status-bar-modes'] }, | 
					
						
							|  |  |  | 			// 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){ | 
					
						
							|  |  |  | 					return | 
					
						
							|  |  |  | 				} | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 				var that = this | 
					
						
							|  |  |  | 				this.config['status-bar-mode'] = state  | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 				// destroy...
 | 
					
						
							|  |  |  | 				if(state == 'none'){ | 
					
						
							|  |  |  | 					bar.empty() | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 				// build/update...
 | 
					
						
							|  |  |  | 				} else { | 
					
						
							|  |  |  | 					gid = gid || this.current | 
					
						
							|  |  |  | 					var img = this.images && this.images[gid] | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 					var _getHandler = function(key){ | 
					
						
							|  |  |  | 						var elems = that.__statusbar_elements__ || {} | 
					
						
							|  |  |  | 						var base_elems = StatusBarActions.__statusbar_elements__ || {} | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 						var handler = elems[key] || base_elems[key] | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 						if(handler == null){ | 
					
						
							|  |  |  | 							return | 
					
						
							|  |  |  | 						} | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +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 | 
					
						
							|  |  |  | 								break | 
					
						
							|  |  |  | 							} | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 						} | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 						return handler | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 					} | 
					
						
							| 
									
										
										
										
											2016-02-12 07:04:39 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 					// build...
 | 
					
						
							|  |  |  | 					if(bar.children().length <= 0){ | 
					
						
							|  |  |  | 						var items = this.config['status-bar-items'].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>')) | 
					
						
							|  |  |  | 									.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) | 
					
						
							|  |  |  | 						}) | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +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
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 								if(type == null){ | 
					
						
							|  |  |  | 									return | 
					
						
							|  |  |  | 								} | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 								var handler = _getHandler(type) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 								if(handler != null){ | 
					
						
							|  |  |  | 									handler.call(that, item, gid, img)  | 
					
						
							|  |  |  | 								} | 
					
						
							|  |  |  | 							}) | 
					
						
							|  |  |  | 					} | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			})],	 | 
					
						
							| 
									
										
										
										
											2016-04-14 19:35:59 +03:00
										 |  |  | 	updateStatusBar: ['- Interface/Update satus bar', | 
					
						
							| 
									
										
										
										
											2016-03-25 00:49:14 +03:00
										 |  |  | 		function(){ this.toggleStatusBar('!') }], | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 	resetStatusBar: ['Interface/Reset status bar', | 
					
						
							|  |  |  | 		function(){ | 
					
						
							|  |  |  | 			var mode = this.toggleStatusBar('?') | 
					
						
							|  |  |  | 			this.toggleStatusBar('none') | 
					
						
							|  |  |  | 			this.toggleStatusBar(mode) | 
					
						
							|  |  |  | 		}], | 
					
						
							| 
									
										
										
										
											2016-03-29 07:34:49 +03:00
										 |  |  | 
 | 
					
						
							|  |  |  | 	// XXX should these be here???
 | 
					
						
							|  |  |  | 	// XXX should this show a dialog???
 | 
					
						
							|  |  |  | 	editStatusBarIndex: ['- Interface/', | 
					
						
							|  |  |  | 		function(){ | 
					
						
							| 
									
										
										
										
											2016-03-29 07:41:41 +03:00
										 |  |  | 			if((this.config['status-bar-index'] || {} )['editable']){ | 
					
						
							|  |  |  | 				this.toggleStatusBar('?') == 'none' && this.toggleStatusBar() | 
					
						
							| 
									
										
										
										
											2016-03-29 07:34:49 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-29 07:41:41 +03:00
										 |  |  | 				// XXX do this better...
 | 
					
						
							|  |  |  | 				this.ribbons.viewer.find('.global-info .index .position').focus().click() | 
					
						
							|  |  |  | 			} | 
					
						
							| 
									
										
										
										
											2016-03-29 07:34:49 +03:00
										 |  |  | 		}], | 
					
						
							| 
									
										
										
										
											2016-06-07 21:00:16 +03:00
										 |  |  | 	editStatusBarRibbon: ['- Interface/', | 
					
						
							|  |  |  | 		function(){ | 
					
						
							|  |  |  | 			this.toggleStatusBar('?') == 'none' && this.toggleStatusBar() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			// XXX do this better...
 | 
					
						
							|  |  |  | 			this.ribbons.viewer.find('.global-info .ribbon-number').focus().click() | 
					
						
							|  |  |  | 		}], | 
					
						
							| 
									
										
										
										
											2016-03-29 07:34:49 +03:00
										 |  |  | 	toggleStatusBarIndexMode: ['Interface/Status bar index mode', | 
					
						
							|  |  |  | 		toggler.CSSClassToggler( | 
					
						
							|  |  |  | 			function(){ return this.ribbons.viewer.find('.global-info .index') }, | 
					
						
							|  |  |  | 			['normal', 'global'], | 
					
						
							|  |  |  | 			function(state){ | 
					
						
							|  |  |  | 				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 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				this.updateStatusBar() | 
					
						
							|  |  |  | 			})], | 
					
						
							| 
									
										
										
										
											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', | 
					
						
							| 
									
										
										
										
											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(){ | 
					
						
							| 
									
										
										
										
											2016-03-19 18:12:06 +03:00
										 |  |  | 				this.toggleStatusBar(this.config['status-bar-mode']) | 
					
						
							| 
									
										
										
										
											2016-02-11 05:21:49 +03:00
										 |  |  | 			}], | 
					
						
							| 
									
										
										
										
											2016-06-09 00:10:11 +03:00
										 |  |  | 		['focusImage clear markChanged', | 
					
						
							| 
									
										
										
										
											2016-02-16 05:53:33 +03:00
										 |  |  | 			function(){ | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 				this.updateStatusBar() | 
					
						
							| 
									
										
										
										
											2016-02-16 05:53:33 +03:00
										 |  |  | 			}], | 
					
						
							| 
									
										
										
										
											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...
 | 
					
						
							|  |  |  | 				if(gids.constructor === Array  | 
					
						
							|  |  |  | 						&& (gids.indexOf('current') >= 0  | 
					
						
							|  |  |  | 							|| gids.indexOf(this.current) >= 0) | 
					
						
							|  |  |  | 						|| this.data.getImage(gids) == this.current){ | 
					
						
							| 
									
										
										
										
											2016-02-18 04:16:55 +03:00
										 |  |  | 					this.updateStatusBar() | 
					
						
							| 
									
										
										
										
											2016-02-16 05:53:33 +03:00
										 |  |  | 				} | 
					
						
							|  |  |  | 			}], | 
					
						
							| 
									
										
										
										
											2016-03-29 00:31:50 +03:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-05-16 00:56:15 +03:00
										 |  |  | 		['ribbonPanning.post', | 
					
						
							|  |  |  | 			function(_, gid){ | 
					
						
							|  |  |  | 				gid == this.data.getRibbon() && this.updateStatusBar() | 
					
						
							|  |  |  | 			}], | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-03-29 00:31:50 +03:00
										 |  |  | 		// Workspace...
 | 
					
						
							|  |  |  | 		['saveWorkspace', | 
					
						
							|  |  |  | 			core.makeWorkspaceConfigWriter( | 
					
						
							|  |  |  | 				function(){ return Object.keys(StatusBar.config) })], | 
					
						
							|  |  |  | 		['loadWorkspace', | 
					
						
							|  |  |  | 			core.makeWorkspaceConfigLoader( | 
					
						
							| 
									
										
										
										
											2016-06-16 04:49:17 +03:00
										 |  |  | 				function(){  | 
					
						
							|  |  |  | 					return Object.keys(StatusBar.config) }, | 
					
						
							| 
									
										
										
										
											2016-03-29 00:31:50 +03:00
										 |  |  | 				function(workspace){ | 
					
						
							| 
									
										
										
										
											2016-03-30 15:24:01 +03:00
										 |  |  | 					// XXX not sure about this protocol yet...
 | 
					
						
							|  |  |  | 					if(this.workspace == 'ui-chrome-hidden'){ | 
					
						
							|  |  |  | 						this.toggleStatusBar('none') | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2016-06-16 04:49:17 +03:00
										 |  |  | 					} else { | 
					
						
							|  |  |  | 						'status-bar-mode' in workspace ? | 
					
						
							|  |  |  | 							this.toggleStatusBar(workspace['status-bar-mode']) | 
					
						
							|  |  |  | 							: this.toggleStatusBar(this.config['status-bar-mode']) | 
					
						
							|  |  |  | 					} | 
					
						
							| 
									
										
										
										
											2016-03-29 00:31:50 +03:00
										 |  |  | 				})], | 
					
						
							| 
									
										
										
										
											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', | 
					
						
							|  |  |  | 		function(){ | 
					
						
							|  |  |  | 			// XXX use list
 | 
					
						
							|  |  |  | 		}], | 
					
						
							|  |  |  | 	clearStatusLog: ['Interface/Clear status log', | 
					
						
							|  |  |  | 		function(){ | 
					
						
							|  |  |  | 			delete this.__status_log | 
					
						
							|  |  |  | 		}], | 
					
						
							|  |  |  | 	statusMessage: ['- Interface/', | 
					
						
							|  |  |  | 		function(){ | 
					
						
							|  |  |  | 			var msg = args2array(arguments) | 
					
						
							|  |  |  | 			if(msg.len == 0){ | 
					
						
							|  |  |  | 				return | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 			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)){ | 
					
						
							|  |  |  | 				log.splice(0, log.length - (s || 100)) | 
					
						
							|  |  |  | 			} | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 			// 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 }) |