minor stuff and cleanup...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2016-04-17 05:22:40 +03:00
parent 14f62ace9a
commit 0e87a44b3c
3 changed files with 41 additions and 13 deletions

View File

@ -36,8 +36,29 @@ var browseWalk = require('lib/widget/browse-walk')
var ExternalEditorActions = actions.Actions({
config: {
// XXX do we actually need this????
'external-editor-default': 'System default',
// XXX
// XXX should this be a dict???
// ...a list is simpler for sorting...
'_external-editors': [
{
// NOTE: empty means use app name...
title: 'System default',
// NOTE: empty means system to select editor...
path: '',
// NOTE: empty is the same as '$TARGET'...
arguments: '',
target: '',
},
{
title: 'IrfanView',
path: 'C:/Program Files (x86)/IrfanView/i_view32.exe',
arguments: '',
target: '',
},
],
'external-editors': [
// XXX system default might be different on different systems...
['System default|"$PATH"'],
@ -48,8 +69,8 @@ var ExternalEditorActions = actions.Actions({
],
'external-editor-targets': [
'Original image',
'Best preview',
//'Original image',
// XXX
],
},
@ -130,11 +151,10 @@ var ExternalEditorUIActions = actions.Actions({
// NOTE: empty means use app name...
title: '',
// NOTE: empty means system to select editor...
path: '/',
path: '',
// NOTE: empty is the same as '$TARGET'...
// XXX use $TARGET...
arguments: '',
target: 'Original image',
target: '',
}
var o = overlay.Overlay(this.ribbons.viewer,
@ -142,7 +162,7 @@ var ExternalEditorUIActions = actions.Actions({
make(['Title: ', function(){ return editor.title || '' }])
.on('open', function(){
event.preventDefault()
widgets.makeEditableItem(o.client,
widgets.makeEditableItem(o.client, $(this),
$(this).find('.text').last(),
function(_, text){ editor.title = text }) })
@ -176,26 +196,32 @@ var ExternalEditorUIActions = actions.Actions({
})
.on('open', function(){
event.preventDefault()
widgets.makeEditableItem(o.client,
widgets.makeEditableItem(o.client, $(this),
$(this).find('.text').last(),
function(_, text){ editor.path = text }) })
make(['Arguments: ', function(){ return editor.arguments || '' }])
.on('open', function(){
event.preventDefault()
widgets.makeEditableItem(o.client,
widgets.makeEditableItem(o.client, $(this),
$(this).find('.text').last(),
function(_, text){ editor.arguments = text }) })
make(['Target: ', function(){ return editor.target || 'Original image' }])
make(['Target: ',
function(){
return editor.target
|| that.config['external-editor-targets'][0] }])
.on('open',
widgets.makeNestedConfigListEditor(that, o,
'external-editor-targets',
function(val){
if(val == null){
return editor.target
|| that.config['external-editor-targets'][0]
} else {
editor.target = val
|| that.config['external-editor-targets'][0]
}
},
{
@ -217,6 +243,8 @@ var ExternalEditorUIActions = actions.Actions({
return o
}],
// XXX use .externalEditorDialog(..)
// XXX need to support $TARGET in args...
// ...append if not present...
listExtenalEditors: ['Edit/List external editors',
function(){
var that = this

View File

@ -1299,7 +1299,7 @@ var FileSystemWriterUIActions = actions.Actions({
}
},
// XXX indicate export state: index, crop, image...
exportDialog: ['File/Export/Images...',
exportDialog: ['File/Export/Export optioons...',
function(){
var that = this

View File

@ -36,7 +36,7 @@ var browseWalk = require('lib/widget/browse-walk')
// can be a different elem...
var makeEditableItem =
module.makeEditableItem =
function(list, elem, callback, options){
function(list, item, elem, callback, options){
return elem
.makeEditable({
clear_on_edit: false,
@ -47,7 +47,7 @@ function(list, elem, callback, options){
// XXX make the selector more accurate...
// ...at this point this will select the first elem
// with text which can be a different elem...
.then(function(){ list.select(text) })
.then(function(){ list.select(item.text()) })
})
}