mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-11-03 21:00:14 +00:00 
			
		
		
		
	added ImageGrid-specific editor setup......
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									314f53bdfc
								
							
						
					
					
						commit
						27cb832249
					
				
							
								
								
									
										49
									
								
								ui/editor.js
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										49
									
								
								ui/editor.js
									
									
									
									
									
										Executable file
									
								
							@ -0,0 +1,49 @@
 | 
				
			|||||||
 | 
					/**********************************************************************
 | 
				
			||||||
 | 
					* 
 | 
				
			||||||
 | 
					*
 | 
				
			||||||
 | 
					*
 | 
				
			||||||
 | 
					**********************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					//var DEBUG = DEBUG != null ? DEBUG : true
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/*********************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					// ImageGrid-specific editor setup...
 | 
				
			||||||
 | 
					function setupEditor(){
 | 
				
			||||||
 | 
						// build the editor...
 | 
				
			||||||
 | 
						if($('.panel').length == 0){
 | 
				
			||||||
 | 
							$('.viewer')
 | 
				
			||||||
 | 
								.append(makeEditorControls('.current.image')
 | 
				
			||||||
 | 
									.addClass('noScroll'))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
								// setup the event to update the editor...
 | 
				
			||||||
 | 
								.on('focusingImage', function(){
 | 
				
			||||||
 | 
									if($('.panel').css('display') != 'none'){
 | 
				
			||||||
 | 
										reloadControls('.current.image')
 | 
				
			||||||
 | 
									}
 | 
				
			||||||
 | 
								})
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							reloadControls('.current.image')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
						// toggle the editor...
 | 
				
			||||||
 | 
						// XXX do we need a real mode for this?
 | 
				
			||||||
 | 
						} else {
 | 
				
			||||||
 | 
							var ed = $('.panel')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// show...
 | 
				
			||||||
 | 
							if(ed.css('display') == 'none'){
 | 
				
			||||||
 | 
								reloadControls('.current.image')
 | 
				
			||||||
 | 
								ed.show()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
							// hide...
 | 
				
			||||||
 | 
							} else {
 | 
				
			||||||
 | 
								ed.hide()
 | 
				
			||||||
 | 
							}
 | 
				
			||||||
 | 
						}
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					/**********************************************************************
 | 
				
			||||||
 | 
					* vim:set ts=4 sw=4 :                                                */
 | 
				
			||||||
@ -37,6 +37,7 @@
 | 
				
			|||||||
<script src="info.js"></script>
 | 
					<script src="info.js"></script>
 | 
				
			||||||
<script src="ui.js"></script>
 | 
					<script src="ui.js"></script>
 | 
				
			||||||
<script src="setup.js"></script>
 | 
					<script src="setup.js"></script>
 | 
				
			||||||
 | 
					<script src="editor.js"></script>
 | 
				
			||||||
<script src="keybindings.js"></script>
 | 
					<script src="keybindings.js"></script>
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
@ -702,28 +702,8 @@ var KEYBOARD_CONFIG = {
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
		E: {
 | 
							E: {
 | 
				
			||||||
				default: doc('Open image in external software', openImage),
 | 
									default: doc('Open image in external software', openImage),
 | 
				
			||||||
				ctrl: doc('Open preview editor panel (Experimental)',
 | 
									// XXX Experimental
 | 
				
			||||||
					function(){
 | 
									ctrl: doc('Open preview editor panel (Experimental)', setupEditor),
 | 
				
			||||||
						if($('.panel').length == 0){
 | 
					 | 
				
			||||||
							$('.viewer')
 | 
					 | 
				
			||||||
								.append(makeControls('.current.image')
 | 
					 | 
				
			||||||
									.addClass('noScroll'))
 | 
					 | 
				
			||||||
								.on('focusingImage', function(){
 | 
					 | 
				
			||||||
									if($('.panel').css('display') != 'none'){
 | 
					 | 
				
			||||||
										reloadControls('.current.image')
 | 
					 | 
				
			||||||
									}
 | 
					 | 
				
			||||||
								})
 | 
					 | 
				
			||||||
							reloadControls('.current.image')
 | 
					 | 
				
			||||||
						} else {
 | 
					 | 
				
			||||||
							var ed = $('.panel')
 | 
					 | 
				
			||||||
							if(ed.css('display') == 'none'){
 | 
					 | 
				
			||||||
								reloadControls('.current.image')
 | 
					 | 
				
			||||||
								ed.show()
 | 
					 | 
				
			||||||
							} else {
 | 
					 | 
				
			||||||
								ed.hide()
 | 
					 | 
				
			||||||
							}
 | 
					 | 
				
			||||||
						}
 | 
					 | 
				
			||||||
					}),
 | 
					 | 
				
			||||||
			},
 | 
								},
 | 
				
			||||||
		// XXX make F4 a default editor and E a default viewer...
 | 
							// XXX make F4 a default editor and E a default viewer...
 | 
				
			||||||
		F4: 'E',
 | 
							F4: 'E',
 | 
				
			||||||
 | 
				
			|||||||
@ -4,6 +4,7 @@
 | 
				
			|||||||
**********************************************************************/
 | 
					**********************************************************************/
 | 
				
			||||||
 | 
					
 | 
				
			||||||
var DEFAULT_FILTER_ORDER = [
 | 
					var DEFAULT_FILTER_ORDER = [
 | 
				
			||||||
 | 
					//	'gamma',
 | 
				
			||||||
	'brightness',
 | 
						'brightness',
 | 
				
			||||||
	'contrast',
 | 
						'contrast',
 | 
				
			||||||
	'saturate',
 | 
						'saturate',
 | 
				
			||||||
@ -235,7 +236,7 @@ function makeLogRange(text, filter, target){
 | 
				
			|||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function makeControls(target){
 | 
					function makeEditorControls(target){
 | 
				
			||||||
	// tool panel...
 | 
						// tool panel...
 | 
				
			||||||
	var panel = $('<details open/>')
 | 
						var panel = $('<details open/>')
 | 
				
			||||||
		.addClass('panel')
 | 
							.addClass('panel')
 | 
				
			||||||
@ -274,6 +275,7 @@ function makeControls(target){
 | 
				
			|||||||
		.append($('<summary>Filters</summary>'))
 | 
							.append($('<summary>Filters</summary>'))
 | 
				
			||||||
		.append($('<div class="sub-panel-content"/>')
 | 
							.append($('<div class="sub-panel-content"/>')
 | 
				
			||||||
			.append($('<div class="filter-list"/>')
 | 
								.append($('<div class="filter-list"/>')
 | 
				
			||||||
 | 
									//.append(makeLogRange('Gamma:', 'gamma', target))
 | 
				
			||||||
				.append(makeLogRange('Brightness:', 'brightness', target))
 | 
									.append(makeLogRange('Brightness:', 'brightness', target))
 | 
				
			||||||
				.append(makeLogRange('Contrast:', 'contrast', target))
 | 
									.append(makeLogRange('Contrast:', 'contrast', target))
 | 
				
			||||||
				.append(makeLogRange('Saturation:', 'saturate', target))
 | 
									.append(makeLogRange('Saturation:', 'saturate', target))
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user