mirror of
				https://github.com/flynx/ImageGrid.git
				synced 2025-10-31 03:10:07 +00:00 
			
		
		
		
	fixed several bugs...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
		
							parent
							
								
									ca34894f22
								
							
						
					
					
						commit
						9f5d1d5539
					
				| @ -2787,7 +2787,11 @@ var FileSystemWriterUIActions = actions.Actions({ | |||||||
| 			var res = make(['Filename $pattern: ', pattern], { | 			var res = make(['Filename $pattern: ', pattern], { | ||||||
| 				open: widgets.makeNestedConfigListEditor(actions, parent, | 				open: widgets.makeNestedConfigListEditor(actions, parent, | ||||||
| 					'export-preview-name-patterns', | 					'export-preview-name-patterns', | ||||||
| 					'export-settings.preview-name-pattern', { | 					function(value){ | ||||||
|  | 						return arguments.length == 0 ? | ||||||
|  | 							settings['preview-name-pattern'] | ||||||
|  | 							: (settings['preview-name-pattern'] = value) }, | ||||||
|  | 					{ | ||||||
| 						length_limit: 10, | 						length_limit: 10, | ||||||
| 						events: { | 						events: { | ||||||
| 							menu: function(_, p){ showExaples(p) }, | 							menu: function(_, p){ showExaples(p) }, | ||||||
| @ -2825,7 +2829,11 @@ var FileSystemWriterUIActions = actions.Actions({ | |||||||
| 				.on('open',  | 				.on('open',  | ||||||
| 					widgets.makeNestedConfigListEditor(actions, parent, | 					widgets.makeNestedConfigListEditor(actions, parent, | ||||||
| 						'export-level-directory-names',  | 						'export-level-directory-names',  | ||||||
| 						'export-settings.level-directory-name', { | 						function(value){ | ||||||
|  | 							return arguments.length == 0 ? | ||||||
|  | 								settings['level-directory-name'] | ||||||
|  | 								: (settings['level-directory-name'] = value) }, | ||||||
|  | 						{ | ||||||
| 							length_limit: 10, | 							length_limit: 10, | ||||||
| 						})) }, | 						})) }, | ||||||
| 		// XXX should we merge this with 'size_limit'????
 | 		// XXX should we merge this with 'size_limit'????
 | ||||||
| @ -2838,7 +2846,10 @@ var FileSystemWriterUIActions = actions.Actions({ | |||||||
| 				.on('open',  | 				.on('open',  | ||||||
| 					widgets.makeNestedConfigListEditor(actions, parent, | 					widgets.makeNestedConfigListEditor(actions, parent, | ||||||
| 						'export-preview-sizes', | 						'export-preview-sizes', | ||||||
| 						'export-settings.preview-size', | 						function(value){ | ||||||
|  | 							return arguments.length == 0 ? | ||||||
|  | 								settings['preview-size'] | ||||||
|  | 								: (settings['preview-size'] = value) }, | ||||||
| 						{ | 						{ | ||||||
| 							length_limit: 10, | 							length_limit: 10, | ||||||
| 							sort: function(a, b){ return parseInt(a) - parseInt(b) }, | 							sort: function(a, b){ return parseInt(a) - parseInt(b) }, | ||||||
| @ -2859,7 +2870,10 @@ var FileSystemWriterUIActions = actions.Actions({ | |||||||
| 				.on('open',  | 				.on('open',  | ||||||
| 					widgets.makeNestedConfigListEditor(actions, parent, | 					widgets.makeNestedConfigListEditor(actions, parent, | ||||||
| 						'export-preview-size-limits', | 						'export-preview-size-limits', | ||||||
| 						'export-settings.preview-size-limit', | 						function(value){ | ||||||
|  | 							return arguments.length == 0 ? | ||||||
|  | 								settings['preview-size-limit'] | ||||||
|  | 								: (settings['preview-size-limit'] = value) }, | ||||||
| 						{ | 						{ | ||||||
| 							length_limit: 10, | 							length_limit: 10, | ||||||
| 							// sort ascending + keep 'no limit' at top...
 | 							// sort ascending + keep 'no limit' at top...
 | ||||||
| @ -2903,7 +2917,6 @@ var FileSystemWriterUIActions = actions.Actions({ | |||||||
| 								function(path){  | 								function(path){  | ||||||
| 									settings['path'] = path | 									settings['path'] = path | ||||||
| 									actions.config['export-paths'].splice(0, 0, path) | 									actions.config['export-paths'].splice(0, 0, path) | ||||||
| 
 |  | ||||||
| 									parent.update() | 									parent.update() | ||||||
| 									parent.select(txt) | 									parent.select(txt) | ||||||
| 								}) | 								}) | ||||||
| @ -2911,7 +2924,10 @@ var FileSystemWriterUIActions = actions.Actions({ | |||||||
| 						// XXX BUG: closing this breaks on parant.focus()...
 | 						// XXX BUG: closing this breaks on parant.focus()...
 | ||||||
| 						['history', widgets.makeNestedConfigListEditor(actions, parent, | 						['history', widgets.makeNestedConfigListEditor(actions, parent, | ||||||
| 							'export-paths', | 							'export-paths', | ||||||
| 							'export-settings.path', | 							function(value){ | ||||||
|  | 								return arguments.length == 0 ? | ||||||
|  | 									settings.path | ||||||
|  | 									: (settings.path = value) }, | ||||||
| 							{ | 							{ | ||||||
| 								length_limit: 10, | 								length_limit: 10, | ||||||
| 								new_item: false, | 								new_item: false, | ||||||
| @ -3042,7 +3058,10 @@ var FileSystemWriterUIActions = actions.Actions({ | |||||||
| 							//widgets.makeNestedConfigListEditor(that, o,
 | 							//widgets.makeNestedConfigListEditor(that, o,
 | ||||||
| 							open: widgets.makeNestedConfigListEditor(that, make.dialog, | 							open: widgets.makeNestedConfigListEditor(that, make.dialog, | ||||||
| 								'export-dialog-modes', | 								'export-dialog-modes', | ||||||
| 								'export-settings.mode', | 								function(value){ | ||||||
|  | 									return arguments.length == 0 ? | ||||||
|  | 										settings.mode | ||||||
|  | 										: (settings.mode = value) }, | ||||||
| 								{ | 								{ | ||||||
| 									length_limit: 10, | 									length_limit: 10, | ||||||
| 									new_item: false, | 									new_item: false, | ||||||
| @ -3105,12 +3124,6 @@ var FileSystemWriterUIActions = actions.Actions({ | |||||||
| 		'exportDialog: "images"'], | 		'exportDialog: "images"'], | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| 	// XXX BUG: changing values from history (button) changes the default 
 |  | ||||||
| 	// 		and not the current preset...
 |  | ||||||
| 	// 		...bug in exportDialog(..)
 |  | ||||||
| 	// XXX ASAP BUG: running a preset from the editor will use the default 
 |  | ||||||
| 	// 		settings and not the loaded preset...
 |  | ||||||
| 	// 		...can't reproduce... (revise)
 |  | ||||||
| 	// XXX UI:
 | 	// XXX UI:
 | ||||||
| 	// 		- element format:
 | 	// 		- element format:
 | ||||||
| 	// 			TITLE
 | 	// 			TITLE
 | ||||||
|  | |||||||
| @ -246,66 +246,56 @@ function(actions, path, value_path, options, setup){ | |||||||
| 
 | 
 | ||||||
| 	var stateValue = function(value){ | 	var stateValue = function(value){ | ||||||
| 		var path = value_path instanceof Function ? | 		var path = value_path instanceof Function ? | ||||||
| 			value_path(value) | 			value_path(...arguments) | ||||||
| 			: value_path.split('.') | 			: value_path.split('.') | ||||||
| 
 | 
 | ||||||
| 		var key = path.pop() | 		if(value_path instanceof Function  | ||||||
|  | 				&& !(path instanceof Array)){ | ||||||
|  | 			return path } | ||||||
| 
 | 
 | ||||||
|  | 		var key = path.pop() | ||||||
| 		var target = actions.config | 		var target = actions.config | ||||||
| 		path.forEach(function(p){ | 		path.forEach(function(p){ | ||||||
| 			target = target[p] = target[p] || {} | 			target = target[p] = target[p] || {} }) | ||||||
| 		}) |  | ||||||
| 
 | 
 | ||||||
|  | 		// set...
 | ||||||
| 		if(value){ | 		if(value){ | ||||||
| 			target[key] = value | 			target[key] = value | ||||||
| 
 | 
 | ||||||
|  | 		// get...
 | ||||||
| 		} else { | 		} else { | ||||||
| 			return target[key] | 			return target[key] } } | ||||||
| 		} |  | ||||||
| 	} |  | ||||||
| 	var save = function(value){ | 	var save = function(value){ | ||||||
| 		stateValue(value) | 		stateValue(value) | ||||||
| 		dialog.close() | 		dialog.close() } | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
| 	if(value_path  | 	if(value_path  | ||||||
| 			&& (options.overflow == null  | 			&& (options.overflow == null  | ||||||
| 				|| options.overflow == 'save')){ | 				|| options.overflow == 'save')){ | ||||||
| 		options.overflow = save | 		options.overflow = save } | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
| 	// set the path...
 | 	// set the path...
 | ||||||
| 	if(value_path && !options.path){ | 	if(value_path && !options.path){ | ||||||
| 		options.path = stateValue() | 		options.path = stateValue() } | ||||||
| 	} |  | ||||||
| 
 | 
 | ||||||
| 	var dialog = browse.makeListEditor(function(lst){ | 	var dialog = browse.makeListEditor(function(lst){ | ||||||
| 			var target = actions.config | 			var target = actions.config | ||||||
| 			path.forEach(function(p){ | 			path.forEach(function(p){ | ||||||
| 				target = target[p] = target[p] || {} | 				target = target[p] = target[p] || {} | ||||||
| 			}) | 			}) | ||||||
| 
 |  | ||||||
| 			// get...
 | 			// get...
 | ||||||
| 			if(lst === undefined){ | 			if(lst === undefined){ | ||||||
| 				return target[key] | 				return target[key] | ||||||
| 
 | 
 | ||||||
| 			// set...
 | 			// set...
 | ||||||
| 			} else { | 			} else { | ||||||
| 				target[key] = lst | 				target[key] = lst } }, options) | ||||||
| 			} |  | ||||||
| 		}, options) |  | ||||||
| 
 |  | ||||||
| 
 | 
 | ||||||
| 	value_path | 	value_path | ||||||
| 		&& dialog.open(function(){ | 		&& dialog.open(function(){ save(dialog.selected) }) | ||||||
| 			save(dialog.selected) |  | ||||||
| 		}) |  | ||||||
| 
 |  | ||||||
| 	setup | 	setup | ||||||
| 		&& setup.call(dialog, dialog) | 		&& setup.call(dialog, dialog) | ||||||
| 
 | 	return dialog } | ||||||
| 	return dialog |  | ||||||
| } |  | ||||||
| 
 | 
 | ||||||
| 
 | 
 | ||||||
| // Wrapper around makeListEditor(..) enabling it to be used as an event
 | // Wrapper around makeListEditor(..) enabling it to be used as an event
 | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user