mirror of
https://github.com/flynx/ImageGrid.git
synced 2025-10-29 18:30:09 +00:00
extending undo...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
b4eb5e3101
commit
06d60a9109
@ -2087,7 +2087,7 @@ var JournalActions = actions.Actions({
|
|||||||
[e.action].apply(that, e.args) }) }],
|
[e.action].apply(that, e.args) }) }],
|
||||||
|
|
||||||
// XXX would be a good idea to add arguments this this:
|
// XXX would be a good idea to add arguments this this:
|
||||||
// <count> - number of actions to undo
|
// <count> - number of actions to undo (DONE)
|
||||||
// 'unsaved' - all actions till last save marker
|
// 'unsaved' - all actions till last save marker
|
||||||
// XXX needs very careful revision...
|
// XXX needs very careful revision...
|
||||||
// - should this be thread safe??? (likely not)
|
// - should this be thread safe??? (likely not)
|
||||||
@ -2098,6 +2098,7 @@ var JournalActions = actions.Actions({
|
|||||||
// XXX should we run undo of every action that supports it in the chain???
|
// XXX should we run undo of every action that supports it in the chain???
|
||||||
// ...i.e. multiple extending actions can support undo
|
// ...i.e. multiple extending actions can support undo
|
||||||
// XXX will also need to handle other methods + aliases in chain...
|
// XXX will also need to handle other methods + aliases in chain...
|
||||||
|
// XXX EXPERIMENTAL...
|
||||||
undo: ['Edit/Undo',
|
undo: ['Edit/Undo',
|
||||||
doc`Undo last action from .journal that can be undone
|
doc`Undo last action from .journal that can be undone
|
||||||
|
|
||||||
@ -2112,14 +2113,18 @@ var JournalActions = actions.Actions({
|
|||||||
`,
|
`,
|
||||||
{mode: function(){
|
{mode: function(){
|
||||||
return (this.journal && this.journal.length > 0) || 'disabled' }},
|
return (this.journal && this.journal.length > 0) || 'disabled' }},
|
||||||
function(){
|
function(count=1){
|
||||||
var journal = this.journal.slice() || []
|
var journal = this.journal.slice() || []
|
||||||
|
var rjournal =
|
||||||
var rjournal = this.rjournal =
|
this.rjournal =
|
||||||
(this.hasOwnProperty('rjournal') || this.rjournal) ?
|
(this.hasOwnProperty('rjournal') || this.rjournal) ?
|
||||||
this.rjournal || []
|
this.rjournal || []
|
||||||
: []
|
: []
|
||||||
|
|
||||||
|
// XXX add test for save point...
|
||||||
|
// XXX this counts undoable actions only -- is this correct...
|
||||||
|
while(count-- > 0
|
||||||
|
&& journal.length > 1){
|
||||||
for(var i = journal.length-1; i >= 0; i--){
|
for(var i = journal.length-1; i >= 0; i--){
|
||||||
var a = journal[i]
|
var a = journal[i]
|
||||||
|
|
||||||
@ -2154,7 +2159,7 @@ var JournalActions = actions.Actions({
|
|||||||
this.journal = journal
|
this.journal = journal
|
||||||
this.rjournal = rjournal
|
this.rjournal = rjournal
|
||||||
|
|
||||||
break } } }],
|
break } } } }],
|
||||||
redo: ['Edit/Redo',
|
redo: ['Edit/Redo',
|
||||||
doc`Redo an action from .rjournal
|
doc`Redo an action from .rjournal
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user