tweaaks + docs...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2020-05-31 20:12:58 +03:00
parent 1d649283cf
commit 5c804ff64d
3 changed files with 50 additions and 39 deletions

View File

@ -487,21 +487,46 @@ var IntrospectionActions = actions.Actions({
return !!action.__event__ }),
// XXX revise...
// XXX this is a bit restrictive, need to be able to setup mode
// aliases/handlers, i.e. setting {mode: 'advanced'} and either
// getting the actual value from .config or calling a mode handler...
// ...might also be nice to use a toggler as handler:
// {mode: 'toggleBrowseAdvanced'}
getActionMode: ['- Interface/',
doc`Get action browse mode...
Get and action's .mode(..) method and return its result.
Expected values:
'disabled' - actions is disabled
'hidden' - actions is hidden
Action .mode can be:
<function> - action method.
<action-name> - alias, name of action to get the
method from.
NOTE: other values are ignored.
The action .mode(..) method is called in the context of actions.
Basic example:
someAction: ['Path/To/Some action',
{mode: function(){ ... }},
function(){
...
}],
someOtherAction: ['Path/To/Some action',
// alias
{mode: 'someAction'},
function(){
...
}],
Usage pattern:
// for cases where we need to define an explicit mode...
actionModeX: ['- System/',
{mode: function(){
return this.actionModeX() }},
core.notUserCallable(function(){
return ...
})],
someAction: [
// use the mode...
{mode: 'actionModeX'},
function(){
...
}],
`,
function(action, mode_cache){
var m = action

View File

@ -266,7 +266,7 @@ var ImageMarkActions = actions.Actions({
function(mode){ this.nextTagged('marked', mode) }],
cropMarked: ['Mark|Crop/Crop $marked images',
{mode: function(target){
{mode: function(){
return this.marked.length == 0 && 'disabled' }},
'crop: "marked" ...'],
//function(flatten){ this.cropTagged('marked', flatten) }],
@ -274,7 +274,7 @@ var ImageMarkActions = actions.Actions({
removeMarkedFromCrop: ['Mark|Crop/Remove marked from crop',
{mode: function(target){
return (this.marked.length == 0 || !this.cropped) && 'disabled' }},
return (this.marked.length == 0 || !this.cropped) && 'disabled' }},
'removeFromCrop: marked'],
rotateMarkedCW: ['Mark/Rotate marked clockwise',

View File

@ -2615,34 +2615,20 @@ var BrowseActionsActions = actions.Actions({
Action mode (disabled/hidden) and also be controlled dynamically:
- .mode() action method is called with actions as base.
Example:
someAction: ['Path/To/Some action',
{mode: function(){ ... }},
function(){
...
}],
someOtherAction: ['Path/To/Some action',
// alias
{mode: 'someAction'},
function(){
...
}],
.mode can be:
<function> - action method.
<action-name> - alias, name of action to get the
method from.
Expected modes:
'hidden' - hide the action from dialog
'disabled' - disable the action in dialog
... - other values are ignored
.mode() can return:
'disabled' - item will be disabled.
'hidden' - item will be both hidden and disabled.
NOTE: disabling in path has priority over .mode(), thus
it is possible to hide/disable an enabled item but not
possible to enable a disabled by default path.
NOTE: .mode() can be defined in any action in chain,
though only the last one is called...
For more info see .getActionMode(..)
NOTE: disabling in path has priority over .mode(), thus
it is possible to hide/disable an enabled item but not
possible to enable a disabled by default path.
NOTE: .mode() can be defined in any action in chain,
though only the last one is called...
options format:
@ -2951,7 +2937,7 @@ var BrowseActionsActions = actions.Actions({
// XXX revise...
advancedBrowseModeAction: ['- System/',
core.doc`Placeholder advanced action
core.doc`advanced action (placeholder)
This is mainly used to indicate other actions as advanced mode only.
@ -2965,14 +2951,14 @@ var BrowseActionsActions = actions.Actions({
`,
{mode: function(){
return this.advancedBrowseModeAction() }},
core.notUserCallable(function(){
function(){
// Placeholder action, not for direct use...
//
// See doc for more info:
// .showDoc('advancedBrowseModeAction')
return this.config['browse-advanced-mode'] != 'on'
&& 'hidden'
|| 'visible' })],
|| 'visible' }],
toggleBrowseAdvanced: ['System|Interface/-99: Advanced menu items',
core.doc`Toggle advanced menu items...