| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | /********************************************************************** | 
					
						
							|  |  |  | *  | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | * | 
					
						
							|  |  |  | **********************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | //var DEBUG = DEBUG != null ? DEBUG : true
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | var STEPS_TO_CHANGE_DIRECTION = 2 | 
					
						
							|  |  |  | var _STEPS_LEFT_TO_CHANGE_DIRECTION = STEPS_TO_CHANGE_DIRECTION | 
					
						
							|  |  |  | var DIRECTION = 'next' | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-02 20:28:42 +04:00
										 |  |  | /*********************************************************************/ | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | function updateDirection(direction){ | 
					
						
							|  |  |  | 	if(DIRECTION != direction){ | 
					
						
							|  |  |  | 		_STEPS_LEFT_TO_CHANGE_DIRECTION-- | 
					
						
							|  |  |  | 		if(_STEPS_LEFT_TO_CHANGE_DIRECTION == 0){ | 
					
						
							|  |  |  | 			DIRECTION = direction | 
					
						
							|  |  |  | 			_STEPS_LEFT_TO_CHANGE_DIRECTION = 2 | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 			_STEPS_LEFT_TO_CHANGE_DIRECTION = 2 | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-03 04:40:55 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-02 20:28:42 +04:00
										 |  |  | function directionImage(reverse){ | 
					
						
							|  |  |  | 	if(DIRECTION == (reverse ? 'prev' : 'next')){ | 
					
						
							|  |  |  | 		nextImage() | 
					
						
							|  |  |  | 	} else { | 
					
						
							|  |  |  | 		prevImage() | 
					
						
							|  |  |  | 	} | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-10 18:31:32 +04:00
										 |  |  | /*********************************************************************/ | 
					
						
							| 
									
										
										
										
											2012-08-28 02:45:32 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | var KEYBOARD_CONFIG = { | 
					
						
							| 
									
										
										
										
											2013-05-30 19:15:38 +04:00
										 |  |  | 	// info overlay...
 | 
					
						
							|  |  |  | 	//
 | 
					
						
							|  |  |  | 	// NOTE: this is here to prevent selecting images while trying to 
 | 
					
						
							|  |  |  | 	// 		select info text...
 | 
					
						
							|  |  |  | 	'.overlay-info:hover': { | 
					
						
							|  |  |  | 		title: 'Info overlay', | 
					
						
							| 
									
										
										
										
											2013-06-01 21:06:10 +04:00
										 |  |  | 		doc: 'Displayed on bottom of the screen if enabled (toggle with '+ | 
					
						
							| 
									
										
										
										
											2013-06-05 01:19:19 +04:00
										 |  |  | 			'<b>I</b>) and/or inline, at bottom of an image when cursor '+ | 
					
						
							| 
									
										
										
										
											2013-06-03 21:10:42 +04:00
										 |  |  | 			'is over it (only in ribbon mode, toggle with <b>alt-I</b>)'+ | 
					
						
							| 
									
										
										
										
											2013-06-01 21:06:10 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 			'<p>NOTE: when the cursor is over the info overlay one can use '+ | 
					
						
							| 
									
										
										
										
											2013-05-30 19:15:38 +04:00
										 |  |  | 			'Ctrl-A and Ctrl-D for info text selection, without affecting '+ | 
					
						
							|  |  |  | 			'image selection/marks.', | 
					
						
							| 
									
										
										
										
											2013-06-01 21:06:10 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-30 19:15:38 +04:00
										 |  |  | 		ignore: [ 'A' ], | 
					
						
							| 
									
										
										
										
											2013-06-01 21:06:10 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-30 19:15:38 +04:00
										 |  |  | 		A: { | 
					
						
							|  |  |  | 			// NOTE: this is here only for documentation...
 | 
					
						
							|  |  |  | 			ctrl: doc('Select all'), | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		D: { | 
					
						
							|  |  |  | 			ctrl: doc('Clear selection',  | 
					
						
							|  |  |  | 				function(){ | 
					
						
							|  |  |  | 					document.getSelection().empty() | 
					
						
							|  |  |  | 					return false | 
					
						
							|  |  |  | 				}) | 
					
						
							|  |  |  | 		} | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-30 03:26:49 +04:00
										 |  |  | 	// help mode...
 | 
					
						
							| 
									
										
										
										
											2013-05-30 19:15:38 +04:00
										 |  |  | 	//
 | 
					
						
							| 
									
										
										
										
											2013-05-30 03:26:49 +04:00
										 |  |  | 	// NOTE: need to keep all info modes before the rest so as to give 
 | 
					
						
							|  |  |  | 	// 		their bindings priority...
 | 
					
						
							| 
									
										
										
										
											2013-06-02 02:54:52 +04:00
										 |  |  | 	'.drawer-mode': { | 
					
						
							|  |  |  | 		title: 'Drawer modes', | 
					
						
							|  |  |  | 		doc: 'NOTE: In this mode all other key bindings are disabled, '+ | 
					
						
							| 
									
										
										
										
											2013-06-05 01:19:19 +04:00
										 |  |  | 			'except app defaults and the ones explicitly defined here.', | 
					
						
							| 
									
										
										
										
											2013-06-01 21:06:10 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-30 03:26:49 +04:00
										 |  |  | 		ignore: '*', | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-02 02:54:52 +04:00
										 |  |  | 		Esc: doc('Close drawer', | 
					
						
							| 
									
										
										
										
											2013-05-30 03:26:49 +04:00
										 |  |  | 			function(){  | 
					
						
							|  |  |  | 				toggleKeyboardHelp('off')  | 
					
						
							|  |  |  | 				return false | 
					
						
							|  |  |  | 			}), | 
					
						
							|  |  |  | 		Q: 'Esc', | 
					
						
							| 
									
										
										
										
											2013-05-31 00:13:49 +04:00
										 |  |  | 		'?': 'Esc', | 
					
						
							| 
									
										
										
										
											2013-05-30 03:26:49 +04:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-01 19:54:46 +04:00
										 |  |  | 	// slideshow mode...
 | 
					
						
							|  |  |  | 	//
 | 
					
						
							|  |  |  | 	'.slideshow-mode': { | 
					
						
							|  |  |  | 		title: 'Slideshow mode', | 
					
						
							| 
									
										
										
										
											2013-06-01 20:16:45 +04:00
										 |  |  | 		doc: 'To enter this mode press <b>S</b>.', | 
					
						
							| 
									
										
										
										
											2013-06-01 19:54:46 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-01 20:16:45 +04:00
										 |  |  | 		// XXX think about what else to disable here...
 | 
					
						
							| 
									
										
										
										
											2013-06-01 19:54:46 +04:00
										 |  |  | 		ignore: [ | 
					
						
							| 
									
										
										
										
											2013-06-01 20:16:45 +04:00
										 |  |  | 			'Up', 'Down', 'Enter', 'R', 'L', | 
					
						
							| 
									
										
										
										
											2013-06-01 19:54:46 +04:00
										 |  |  | 			], | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-01 20:16:45 +04:00
										 |  |  | 		L: doc('Toggle slideshow looping', | 
					
						
							| 
									
										
										
										
											2013-06-01 21:06:10 +04:00
										 |  |  | 			function(){ | 
					
						
							|  |  |  | 				SLIDESHOW_LOOP = SLIDESHOW_LOOP ? false : true | 
					
						
							|  |  |  | 				showStatus('Slideshow: looping', SLIDESHOW_LOOP ? 'enabled...' : 'disabled...') | 
					
						
							|  |  |  | 				return false | 
					
						
							|  |  |  | 			}), | 
					
						
							|  |  |  | 		R: doc('Reverse slideshow direction', | 
					
						
							|  |  |  | 			function(){ | 
					
						
							|  |  |  | 				SLIDESHOW_DIRECTION = SLIDESHOW_DIRECTION == 'next' ? 'prev' : 'next' | 
					
						
							|  |  |  | 				showStatus('Slideshow: direction:', SLIDESHOW_DIRECTION + '...') | 
					
						
							|  |  |  | 				return false | 
					
						
							|  |  |  | 			}), | 
					
						
							| 
									
										
										
										
											2013-06-01 19:54:46 +04:00
										 |  |  | 		Esc: doc('Exit/stop slideshow',  | 
					
						
							| 
									
										
										
										
											2013-06-01 21:06:10 +04:00
										 |  |  | 			function(){  | 
					
						
							|  |  |  | 				toggleSlideShowMode('off')  | 
					
						
							|  |  |  | 				return false | 
					
						
							|  |  |  | 			}), | 
					
						
							| 
									
										
										
										
											2013-06-01 19:54:46 +04:00
										 |  |  | 		S: 'Esc', | 
					
						
							|  |  |  | 		Q: 'Esc', | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-31 00:23:45 +04:00
										 |  |  | 	// single image mode...
 | 
					
						
							| 
									
										
										
										
											2013-05-30 19:15:38 +04:00
										 |  |  | 	//
 | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 	'.single-image-mode': { | 
					
						
							|  |  |  | 		title: 'Single image mode', | 
					
						
							| 
									
										
										
										
											2013-06-01 20:16:45 +04:00
										 |  |  | 		doc: 'To toggle between this and ribbon modes press <b>Enter</b>.', | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 		F: doc('Toggle view proportions',  | 
					
						
							|  |  |  | 			function(){  | 
					
						
							| 
									
										
										
										
											2013-06-01 21:06:10 +04:00
										 |  |  | 				var mode = toggleImageProportions()  | 
					
						
							|  |  |  | 				showStatus('Fitting image to:', mode + '...') | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 				centerRibbons() | 
					
						
							|  |  |  | 			}), | 
					
						
							|  |  |  | 		Esc: doc('Exit single image mode',  | 
					
						
							| 
									
										
										
										
											2013-05-30 03:26:49 +04:00
										 |  |  | 				function(){  | 
					
						
							|  |  |  | 					toggleSingleImageMode('off')  | 
					
						
							|  |  |  | 					return false | 
					
						
							|  |  |  | 				}), | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 		Q: 'Esc', | 
					
						
							| 
									
										
										
										
											2012-09-10 04:23:48 +04:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-30 03:26:49 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-31 00:23:45 +04:00
										 |  |  | 	// marked only ribbon mode...
 | 
					
						
							| 
									
										
										
										
											2013-05-30 19:15:38 +04:00
										 |  |  | 	//
 | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 	'.marked-only-view:not(.single-image-mode)': { | 
					
						
							|  |  |  | 		title: 'Marked only view', | 
					
						
							| 
									
										
										
										
											2013-06-01 20:16:45 +04:00
										 |  |  | 		doc: 'To toggle this mode press <b>shift-F2</b>.', | 
					
						
							| 
									
										
										
										
											2012-09-10 04:23:48 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 		Esc: doc('Exit marked only view',  | 
					
						
							| 
									
										
										
										
											2013-05-30 03:26:49 +04:00
										 |  |  | 				function(){  | 
					
						
							|  |  |  | 					toggleMarkedOnlyView('off')  | 
					
						
							|  |  |  | 					return false | 
					
						
							| 
									
										
										
										
											2013-05-30 07:29:07 +04:00
										 |  |  | 				}), | 
					
						
							|  |  |  | 		Q: 'Esc', | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-05 15:39:18 +04:00
										 |  |  | 	// visible marks...
 | 
					
						
							|  |  |  | 	//
 | 
					
						
							|  |  |  | 	'.marks-visible': { | 
					
						
							|  |  |  | 		title: 'Visible marks', | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		Esc: doc('Hide marks',  | 
					
						
							|  |  |  | 				function(){  | 
					
						
							|  |  |  | 					toggleMarkesView('off') | 
					
						
							|  |  |  | 					return false | 
					
						
							|  |  |  | 				}), | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-03 23:36:40 +04:00
										 |  |  | 	// ribbon mode only...
 | 
					
						
							|  |  |  | 	//
 | 
					
						
							| 
									
										
										
										
											2013-06-04 01:33:06 +04:00
										 |  |  | 	// XXX this breaks getKeyHandlers(...) when modes argument is given...
 | 
					
						
							| 
									
										
										
										
											2013-06-03 23:36:40 +04:00
										 |  |  | 	'.viewer:not(.overlay):not(.single-image-mode)': { | 
					
						
							|  |  |  | 		title: 'Ribbon mode', | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		Left: { | 
					
						
							|  |  |  | 				alt: doc('Shift image left',  | 
					
						
							|  |  |  | 					function(){  | 
					
						
							|  |  |  | 						event.preventDefault() | 
					
						
							|  |  |  | 						shiftImageLeft()  | 
					
						
							|  |  |  | 						centerView(null, 'css') | 
					
						
							|  |  |  | 						// XXX for some odd reason centerRibbons does 
 | 
					
						
							|  |  |  | 						// 		something really odd here...
 | 
					
						
							|  |  |  | 						//centerRibbons()
 | 
					
						
							|  |  |  | 						// XXX HACK...
 | 
					
						
							|  |  |  | 						// XXX this still gets misaligned sometimes but this
 | 
					
						
							|  |  |  | 						// 		is likely due to one of the align bugs 
 | 
					
						
							|  |  |  | 						if(window._center_ribbon_delay != null){ | 
					
						
							|  |  |  | 							clearTimeout(_center_ribbon_delay) | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 						_center_ribbon_delay = setTimeout( | 
					
						
							|  |  |  | 							function(){  | 
					
						
							|  |  |  | 								centerRibbons()  | 
					
						
							|  |  |  | 							}, 300) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 						return false | 
					
						
							|  |  |  | 					}), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		Right: { | 
					
						
							|  |  |  | 				alt: doc('Shift image right',  | 
					
						
							|  |  |  | 					function(){  | 
					
						
							|  |  |  | 						event.preventDefault() | 
					
						
							|  |  |  | 						shiftImageRight()  | 
					
						
							|  |  |  | 						centerView(null, 'css') | 
					
						
							|  |  |  | 						// XXX for some odd reason centerRibbons does 
 | 
					
						
							|  |  |  | 						// 		something really odd here...
 | 
					
						
							|  |  |  | 						//centerRibbons()
 | 
					
						
							|  |  |  | 						// XXX HACK...
 | 
					
						
							|  |  |  | 						// XXX this still gets misaligned sometimes but this
 | 
					
						
							|  |  |  | 						// 		is likely due to one of the align bugs 
 | 
					
						
							|  |  |  | 						// 		(see: TODO.otl)
 | 
					
						
							|  |  |  | 						if(window._center_ribbon_delay != null){ | 
					
						
							|  |  |  | 							clearTimeout(_center_ribbon_delay) | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 						_center_ribbon_delay = setTimeout( | 
					
						
							|  |  |  | 							function(){  | 
					
						
							|  |  |  | 								centerRibbons()  | 
					
						
							|  |  |  | 							}, 300) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 						return false | 
					
						
							|  |  |  | 					}), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 	}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 	// general setup...
 | 
					
						
							| 
									
										
										
										
											2013-05-30 19:15:38 +04:00
										 |  |  | 	//
 | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 	'.viewer:not(.overlay)': { | 
					
						
							|  |  |  | 		title: 'Global', | 
					
						
							| 
									
										
										
										
											2013-06-02 23:07:18 +04:00
										 |  |  | 		doc: 'These key bindings work in most other modes.'+ | 
					
						
							| 
									
										
										
										
											2013-06-03 21:10:42 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-05 01:19:19 +04:00
										 |  |  | 			'<p>NOTE: shifting all marked images from different ribbons will '+ | 
					
						
							| 
									
										
										
										
											2013-06-02 23:07:18 +04:00
										 |  |  | 			'perform the operations on ALL marked images but relative '+ | 
					
						
							| 
									
										
										
										
											2013-06-05 01:19:19 +04:00
										 |  |  | 			'the the current ribbon. i.e. some images might get promoted, '+ | 
					
						
							|  |  |  | 			'others demoted while some will not change position. ', | 
					
						
							| 
									
										
										
										
											2013-06-02 20:28:42 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-02 18:29:56 +04:00
										 |  |  | 		// Basics...
 | 
					
						
							|  |  |  | 		// XXX STUB: use a real path browser...
 | 
					
						
							|  |  |  | 		O: doc('Open a directory path', | 
					
						
							|  |  |  | 			function(){ | 
					
						
							|  |  |  | 				var path = prompt('Path to open', BASE_URL) | 
					
						
							|  |  |  | 				if(path == null){ | 
					
						
							|  |  |  | 					return | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 				path = path.trim() | 
					
						
							| 
									
										
										
										
											2013-06-06 23:26:45 +04:00
										 |  |  | 				statusNotify(loadDir(path)) | 
					
						
							| 
									
										
										
										
											2013-06-02 18:29:56 +04:00
										 |  |  | 			}), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 		// Navigation...
 | 
					
						
							|  |  |  | 		// XXX need to cancel the animation of the prev action...
 | 
					
						
							|  |  |  | 		Left: { | 
					
						
							|  |  |  | 				default: doc('Previous image', | 
					
						
							|  |  |  | 					function(){  | 
					
						
							|  |  |  | 						event.preventDefault() | 
					
						
							|  |  |  | 						// update direction...
 | 
					
						
							| 
									
										
										
										
											2013-06-02 20:28:42 +04:00
										 |  |  | 						updateDirection('prev') | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 						prevImage()  | 
					
						
							|  |  |  | 						centerRibbons() | 
					
						
							|  |  |  | 					}), | 
					
						
							| 
									
										
										
										
											2013-06-02 01:48:09 +04:00
										 |  |  | 				ctrl: 'prev-screen', | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 		Right: { | 
					
						
							|  |  |  | 				default: doc('Next image', | 
					
						
							|  |  |  | 					function(){  | 
					
						
							|  |  |  | 						event.preventDefault() | 
					
						
							|  |  |  | 						// update direction...
 | 
					
						
							| 
									
										
										
										
											2013-06-02 20:28:42 +04:00
										 |  |  | 						updateDirection('next') | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 						nextImage()  | 
					
						
							|  |  |  | 						centerRibbons() | 
					
						
							|  |  |  | 					}), | 
					
						
							| 
									
										
										
										
											2013-06-02 01:48:09 +04:00
										 |  |  | 				ctrl: 'next-screen', | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2013-06-02 23:07:18 +04:00
										 |  |  | 		'prev-screen': doc('Previous screen', | 
					
						
							|  |  |  | 				function(){  | 
					
						
							|  |  |  | 					event.preventDefault() | 
					
						
							|  |  |  | 					prevScreenImages() | 
					
						
							|  |  |  | 					centerRibbons() | 
					
						
							|  |  |  | 				}), | 
					
						
							|  |  |  | 		'next-screen': doc('Next screen', | 
					
						
							|  |  |  | 				function(){  | 
					
						
							|  |  |  | 					event.preventDefault() | 
					
						
							|  |  |  | 					nextScreenImages() | 
					
						
							|  |  |  | 					centerRibbons() | 
					
						
							|  |  |  | 				}), | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 		Space: { | 
					
						
							|  |  |  | 				default: 'Right', | 
					
						
							|  |  |  | 				shift: 'Left', | 
					
						
							|  |  |  | 				// screen-oriented movement...
 | 
					
						
							|  |  |  | 				ctrl: 'Right', | 
					
						
							| 
									
										
										
										
											2013-06-02 01:48:09 +04:00
										 |  |  | 				'ctrl+shift': 'prev-screen', | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 		Backspace: { | 
					
						
							|  |  |  | 				default: 'Left', | 
					
						
							|  |  |  | 				shift: 'Right', | 
					
						
							| 
									
										
										
										
											2013-06-01 21:06:10 +04:00
										 |  |  | 				// screen-oriented movement...
 | 
					
						
							|  |  |  | 				ctrl: 'Left', | 
					
						
							| 
									
										
										
										
											2013-06-02 01:48:09 +04:00
										 |  |  | 				'ctrl+shift': 'next-screen', | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 		Home: doc('First image',  | 
					
						
							|  |  |  | 			function(){ | 
					
						
							|  |  |  | 				event.preventDefault() | 
					
						
							|  |  |  | 				firstImage() | 
					
						
							|  |  |  | 				centerRibbons() | 
					
						
							|  |  |  | 			}), | 
					
						
							|  |  |  | 		End: doc('Last image', | 
					
						
							|  |  |  | 			function(){ | 
					
						
							|  |  |  | 				event.preventDefault() | 
					
						
							|  |  |  | 				lastImage() | 
					
						
							|  |  |  | 				centerRibbons() | 
					
						
							|  |  |  | 			}), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// combined navigation and editor actions...
 | 
					
						
							|  |  |  | 		Up: { | 
					
						
							|  |  |  | 				default: doc('Go to ribbon above',  | 
					
						
							|  |  |  | 					function(){  | 
					
						
							|  |  |  | 						event.preventDefault() | 
					
						
							|  |  |  | 						prevRibbon()  | 
					
						
							|  |  |  | 						centerRibbons() | 
					
						
							|  |  |  | 					}), | 
					
						
							|  |  |  | 				shift: doc('Shift image up', | 
					
						
							|  |  |  | 					function(){  | 
					
						
							|  |  |  | 						event.preventDefault() | 
					
						
							|  |  |  | 						shiftImageUp(null, DIRECTION)  | 
					
						
							|  |  |  | 						centerRibbons() | 
					
						
							|  |  |  | 					}), | 
					
						
							|  |  |  | 				'ctrl+shift': doc('Shift image up to empty ribbon', | 
					
						
							|  |  |  | 					function(){ | 
					
						
							|  |  |  | 						event.preventDefault() | 
					
						
							|  |  |  | 						shiftImageUpNewRibbon(null, DIRECTION)  | 
					
						
							|  |  |  | 						centerRibbons() | 
					
						
							|  |  |  | 					}), | 
					
						
							| 
									
										
										
										
											2013-06-02 23:07:18 +04:00
										 |  |  | 				alt: doc('Shift marked images up', | 
					
						
							|  |  |  | 					function(){ | 
					
						
							| 
									
										
										
										
											2013-06-02 23:57:30 +04:00
										 |  |  | 						toggleMarkesView('on') | 
					
						
							|  |  |  | 						shiftMarkedImagesUp() | 
					
						
							| 
									
										
										
										
											2013-06-02 23:07:18 +04:00
										 |  |  | 					}), | 
					
						
							|  |  |  | 				'alt+shift': doc('Shift marked images up to empty ribbon', | 
					
						
							|  |  |  | 					function(){ | 
					
						
							|  |  |  | 						// XXX
 | 
					
						
							|  |  |  | 					}), | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 		Down: { | 
					
						
							|  |  |  | 				default: doc('Go to ribbon below',  | 
					
						
							|  |  |  | 					function(){ | 
					
						
							|  |  |  | 						event.preventDefault() | 
					
						
							|  |  |  | 						nextRibbon()  | 
					
						
							|  |  |  | 						centerRibbons() | 
					
						
							|  |  |  | 					}), | 
					
						
							|  |  |  | 				shift: doc('Shift image down', | 
					
						
							|  |  |  | 					function(){  | 
					
						
							|  |  |  | 						event.preventDefault() | 
					
						
							|  |  |  | 						shiftImageDown(null, DIRECTION)  | 
					
						
							|  |  |  | 						centerRibbons() | 
					
						
							|  |  |  | 					}), | 
					
						
							|  |  |  | 				'ctrl+shift': doc('Shift image down to empty ribbon', | 
					
						
							|  |  |  | 					function(){ | 
					
						
							|  |  |  | 						event.preventDefault() | 
					
						
							|  |  |  | 						shiftImageDownNewRibbon(null, DIRECTION)  | 
					
						
							|  |  |  | 						centerRibbons() | 
					
						
							|  |  |  | 					}), | 
					
						
							| 
									
										
										
										
											2013-06-02 23:07:18 +04:00
										 |  |  | 				alt: doc('Shift marked images down', | 
					
						
							|  |  |  | 					function(){ | 
					
						
							| 
									
										
										
										
											2013-06-02 23:57:30 +04:00
										 |  |  | 						toggleMarkesView('on') | 
					
						
							|  |  |  | 						shiftMarkedImagesDown() | 
					
						
							| 
									
										
										
										
											2013-06-02 23:07:18 +04:00
										 |  |  | 					}), | 
					
						
							|  |  |  | 				'alt+shift': doc('Shift marked images down to empty ribbon', | 
					
						
							|  |  |  | 					function(){ | 
					
						
							|  |  |  | 						// XXX
 | 
					
						
							|  |  |  | 					}), | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		L: doc('Rotate image left', function(){ rotateLeft() }), | 
					
						
							| 
									
										
										
										
											2013-06-01 23:12:32 +04:00
										 |  |  | 		R: { | 
					
						
							|  |  |  | 				default: doc('Rotate image right',  | 
					
						
							|  |  |  | 					function(){ rotateRight() }), | 
					
						
							|  |  |  | 				ctrl: doc('Reverse image order',  | 
					
						
							| 
									
										
										
										
											2013-06-02 20:14:39 +04:00
										 |  |  | 					function(){  | 
					
						
							|  |  |  | 						event.preventDefault() | 
					
						
							|  |  |  | 						reverseImageOrder()  | 
					
						
							|  |  |  | 					}), | 
					
						
							| 
									
										
										
										
											2013-06-01 23:12:32 +04:00
										 |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2013-06-04 21:45:36 +04:00
										 |  |  | 		H: doc('Flip image horizontally',  | 
					
						
							|  |  |  | 			function(){  | 
					
						
							|  |  |  | 				var o = getImage().attr('orientation') | 
					
						
							|  |  |  | 				// need to rotate relative to user, not relative to image...
 | 
					
						
							|  |  |  | 				if(o == 90 || o == 270){ | 
					
						
							|  |  |  | 				   flipVertical()  | 
					
						
							|  |  |  | 				} else { | 
					
						
							|  |  |  | 					flipHorizontal()  | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			}), | 
					
						
							|  |  |  | 		V: doc('Flip image vertically',  | 
					
						
							|  |  |  | 			function(){  | 
					
						
							|  |  |  | 				var o = getImage().attr('orientation') | 
					
						
							|  |  |  | 				// need to rotate relative to user, not relative to image...
 | 
					
						
							|  |  |  | 				if(o == 90 || o == 270){ | 
					
						
							|  |  |  | 					flipHorizontal()  | 
					
						
							|  |  |  | 				} else { | 
					
						
							|  |  |  | 					flipVertical()  | 
					
						
							|  |  |  | 				} | 
					
						
							|  |  |  | 			}), | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-10 04:23:48 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-09-10 03:02:34 +04:00
										 |  |  | 		// zooming...
 | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 		'#1': doc('Fit one image', function(){ fitNImages(1) }), | 
					
						
							|  |  |  | 		'#2': doc('Fit two images', function(){ fitNImages(2) }), | 
					
						
							|  |  |  | 		'#3': doc('Fit three images', function(){ fitNImages(3) }), | 
					
						
							|  |  |  | 		'#4': doc('Fit four images', function(){ fitNImages(4) }), | 
					
						
							|  |  |  | 		'#5': doc('Fit five images', function(){ fitNImages(5) }), | 
					
						
							|  |  |  | 		'#6': doc('Fit six images', function(){ fitNImages(6) }), | 
					
						
							|  |  |  | 		'#7': doc('Fit seven images', function(){ fitNImages(7) }), | 
					
						
							|  |  |  | 		'#8': doc('Fit eight images', function(){ fitNImages(8) }), | 
					
						
							|  |  |  | 		'#9': doc('Fit nine images', function(){ fitNImages(9) }), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		'-': doc('Zoom in', function(){ zoomOut() }), | 
					
						
							|  |  |  | 		'=': doc('Zoom out', function(){ zoomIn() }), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		Enter: doc('Toggle single image view',  | 
					
						
							|  |  |  | 				function(){ toggleSingleImageMode() }), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		B: doc('Toggle theme', function(){ toggleTheme() }), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		S: { | 
					
						
							| 
									
										
										
										
											2013-06-01 19:54:46 +04:00
										 |  |  | 				default: doc('Start slideshow',  | 
					
						
							|  |  |  | 					function(){ toggleSlideShowMode('on') }), | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 				ctrl: doc('Save current state',  | 
					
						
							|  |  |  | 					function(){ | 
					
						
							|  |  |  | 						event.preventDefault() | 
					
						
							|  |  |  | 						//saveLocalStorage()
 | 
					
						
							|  |  |  | 						saveLocalStorageData() | 
					
						
							|  |  |  | 						saveLocalStorageMarks() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 						saveLocalStorageSettings() | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 						saveFileState() | 
					
						
							|  |  |  | 					}) | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		Z: { | 
					
						
							|  |  |  | 				ctrl: doc('Restore to last saved state',  | 
					
						
							|  |  |  | 					function(){ | 
					
						
							|  |  |  | 						loadLocalStorage() | 
					
						
							|  |  |  | 						loadLocalStorageMarks() | 
					
						
							|  |  |  | 					}) | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// marking...
 | 
					
						
							|  |  |  | 		// XXX not final, think of a better way to do this...
 | 
					
						
							|  |  |  | 		// XXX need mark navigation...
 | 
					
						
							|  |  |  | 		// XXX need marked image shift up/down actions...
 | 
					
						
							|  |  |  | 		// XXX unmarking an image in marked-only mode results in nothing
 | 
					
						
							|  |  |  | 		// 		visible focused if we unmark the first or last image in 
 | 
					
						
							|  |  |  | 		// 		the ribbon...
 | 
					
						
							|  |  |  | 		M: { | 
					
						
							|  |  |  | 				// NOTE: marking moves in the same direction as the last
 | 
					
						
							|  |  |  | 				//		move...
 | 
					
						
							|  |  |  | 				//		i.e. marking can change direction depending on where
 | 
					
						
							|  |  |  | 				//		we moved last...
 | 
					
						
							|  |  |  | 				// NOTE: marking does not change move direction...
 | 
					
						
							|  |  |  | 				default: doc('Mark current image and advance', | 
					
						
							|  |  |  | 					function(){  | 
					
						
							|  |  |  | 						toggleImageMark() | 
					
						
							| 
									
										
										
										
											2013-06-02 20:28:42 +04:00
										 |  |  | 						directionImage() | 
					
						
							| 
									
										
										
										
											2013-05-28 21:59:38 +04:00
										 |  |  | 						if(getImage().filter(':visible').length == 0){ | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 							centerView(focusImage(getImageBefore())) | 
					
						
							|  |  |  | 						} | 
					
						
							|  |  |  | 						centerRibbons() | 
					
						
							|  |  |  | 					}), | 
					
						
							|  |  |  | 				// same as default but in reverse direction...
 | 
					
						
							|  |  |  | 				shift: doc('Mark current image and return', | 
					
						
							|  |  |  | 					function(){ | 
					
						
							|  |  |  | 						toggleImageMark() | 
					
						
							| 
									
										
										
										
											2013-06-02 20:28:42 +04:00
										 |  |  | 						directionImage(true) | 
					
						
							| 
									
										
										
										
											2013-05-28 21:59:38 +04:00
										 |  |  | 						if(getImage().filter(':visible').length == 0){ | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 							centerView(focusImage(getImageBefore())) | 
					
						
							|  |  |  | 						}  | 
					
						
							|  |  |  | 						centerRibbons() | 
					
						
							|  |  |  | 					}), | 
					
						
							| 
									
										
										
										
											2013-06-02 20:14:39 +04:00
										 |  |  | 				ctrl: 'Ins', | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2013-06-02 20:14:39 +04:00
										 |  |  | 		Ins: doc('Mark current image', function(){ toggleImageMark() }), | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 		I: { | 
					
						
							| 
									
										
										
										
											2013-05-30 19:15:38 +04:00
										 |  |  | 				default: doc('Toggle image info display', | 
					
						
							| 
									
										
										
										
											2013-05-30 07:29:07 +04:00
										 |  |  | 					function(){ toggleImageInfo() }), | 
					
						
							|  |  |  | 				shift: doc('Show current image info', | 
					
						
							| 
									
										
										
										
											2013-06-02 05:33:27 +04:00
										 |  |  | 					function(){ toggleImageInfoDrawer() }), | 
					
						
							| 
									
										
										
										
											2013-05-30 19:15:38 +04:00
										 |  |  | 				alt: doc('Toggle inline image info display', | 
					
						
							|  |  |  | 					function(){ | 
					
						
							|  |  |  | 						toggleInlineImageInfo() | 
					
						
							|  |  |  | 					}), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 				// marking...
 | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 				ctrl: doc('Invert image marks',  | 
					
						
							|  |  |  | 					function(){ invertImageMarks() }), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		A: { | 
					
						
							| 
									
										
										
										
											2013-05-30 19:15:38 +04:00
										 |  |  | 			  	// XXX does not yet work with DATA (???)
 | 
					
						
							|  |  |  | 				//shift: doc('Toggle marks in current contagious block', 
 | 
					
						
							|  |  |  | 				//	function(){ toggleImageMarkBlock() }),
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 				ctrl: doc('Mark current ribbon',  | 
					
						
							|  |  |  | 					function(){ markAll('ribbon') }), | 
					
						
							| 
									
										
										
										
											2013-05-30 19:15:38 +04:00
										 |  |  | 				'ctrl+shift': doc('Mark all images',  | 
					
						
							|  |  |  | 					function(){ markAll('all') }), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		D: { | 
					
						
							|  |  |  | 				ctrl: doc('Unmark current ribbon',  | 
					
						
							|  |  |  | 					function(){ removeImageMarks('ribbon') }), | 
					
						
							|  |  |  | 				'ctrl+shift': doc('Unmark all images',  | 
					
						
							|  |  |  | 					function(){ removeImageMarks('all') }), | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 			}, | 
					
						
							|  |  |  | 		U: { | 
					
						
							|  |  |  | 				ctrl: doc('Unmark current ribbon',  | 
					
						
							|  |  |  | 					function(){ removeImageMarks('ribbon') }), | 
					
						
							|  |  |  | 				shift: doc('Unamrk all',  | 
					
						
							|  |  |  | 					function(){ removeImageMarks('all') }), | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 		F2: { | 
					
						
							|  |  |  | 				default: doc('Toggle mark visibility',  | 
					
						
							|  |  |  | 					function(){ toggleMarkesView() }), | 
					
						
							|  |  |  | 				shift: doc('Toggle marked only images view',  | 
					
						
							|  |  |  | 					function(){ | 
					
						
							|  |  |  | 						toggleMarkedOnlyView() | 
					
						
							|  |  |  | 					}) | 
					
						
							|  |  |  | 			}, | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-03 18:35:24 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-03 18:31:37 +04:00
										 |  |  | 		E: doc('Open image in external software', openImage), | 
					
						
							|  |  |  | 		F4: { | 
					
						
							|  |  |  | 				default: 'E', | 
					
						
							|  |  |  | 				alt: doc('Close viewer'), | 
					
						
							|  |  |  | 			}, | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-02 18:29:56 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-02 02:54:52 +04:00
										 |  |  | 		P: doc('Show options', | 
					
						
							|  |  |  | 			function(){ toggleOptionsUI() }), | 
					
						
							| 
									
										
										
										
											2013-05-31 00:13:49 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-06-02 23:07:18 +04:00
										 |  |  | 		// NOTE: this is handled by the wrapper at this point, so we do 
 | 
					
						
							|  |  |  | 		// 		not have to do anything here...
 | 
					
						
							|  |  |  | 		F11: doc('Toggle full screen mode'), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		// Help and info...
 | 
					
						
							|  |  |  | 		'?': doc('Show keyboard bindings', | 
					
						
							|  |  |  | 			function(){ toggleKeyboardHelp() }), | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 		F1: doc('Show help', | 
					
						
							|  |  |  | 			function(){ toggleHelp() }), | 
					
						
							| 
									
										
										
										
											2013-06-02 18:29:56 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-31 00:13:49 +04:00
										 |  |  | 		/* testing the shift-key feature... | 
					
						
							|  |  |  | 		'~': { | 
					
						
							|  |  |  | 			default: function(){ alert('~') }, | 
					
						
							|  |  |  | 			// this is inaccessible...
 | 
					
						
							|  |  |  | 			shift: function(){ alert('shift-~') }, | 
					
						
							|  |  |  | 			ctrl: function(){ alert('ctrl-~') }, | 
					
						
							|  |  |  | 			'ctrl+alt': function(){ alert('ctrl-alt-~') }, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		'`': { | 
					
						
							|  |  |  | 			default: function(){ alert('`') }, | 
					
						
							|  |  |  | 			// this is also not accessible as it is shadowed by '''...
 | 
					
						
							|  |  |  | 			shift: function(){ alert('shift-`') }, | 
					
						
							|  |  |  | 			ctrl: function(){ alert('ctrl-`') }, | 
					
						
							|  |  |  | 			'ctrl+alt': function(){ alert('ctrl-alt-`') }, | 
					
						
							|  |  |  | 		}, | 
					
						
							|  |  |  | 		*/ | 
					
						
							| 
									
										
										
										
											2012-09-10 03:02:34 +04:00
										 |  |  | 	} | 
					
						
							| 
									
										
										
										
											2012-08-08 23:19:40 +04:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2012-08-10 18:31:32 +04:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2012-08-08 23:19:40 +04:00
										 |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2013-05-28 15:22:05 +04:00
										 |  |  | /********************************************************************** | 
					
						
							|  |  |  | * vim:set ts=4 sw=4 :                                                */ |