ライブラリ更新
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@5874 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
4d362738ac
commit
5cead9215e
@ -74,7 +74,7 @@
|
|||||||
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/operationHistory.test.js
|
http://www.cozmixng.org/repos/piro/fx3-compatibility-lib/trunk/operationHistory.test.js
|
||||||
*/
|
*/
|
||||||
(function() {
|
(function() {
|
||||||
const currentRevision = 26;
|
const currentRevision = 27;
|
||||||
|
|
||||||
if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {};
|
if (!('piro.sakura.ne.jp' in window)) window['piro.sakura.ne.jp'] = {};
|
||||||
|
|
||||||
@ -142,7 +142,9 @@
|
|||||||
log('doUndoableTask start ('+options.name+' for '+options.windowId+')', history.inOperationCount);
|
log('doUndoableTask start ('+options.name+' for '+options.windowId+')', history.inOperationCount);
|
||||||
|
|
||||||
var entry = options.entry;
|
var entry = options.entry;
|
||||||
if (!this._doingUndo && entry) {
|
if (entry &&
|
||||||
|
!this._getUndoingState(options.key) &&
|
||||||
|
!this._getRedoingState(options.key)) {
|
||||||
let f = this._getAvailableFunction(entry.onRedo, entry.onredo, entry.redo);
|
let f = this._getAvailableFunction(entry.onRedo, entry.onredo, entry.redo);
|
||||||
if (!f && !entry.onRedo && !entry.onredo && !entry.redo && options.task)
|
if (!f && !entry.onRedo && !entry.onredo && !entry.redo && options.task)
|
||||||
entry.onRedo = options.task;
|
entry.onRedo = options.task;
|
||||||
@ -210,11 +212,12 @@
|
|||||||
{
|
{
|
||||||
var options = this._getOptionsFromArguments(arguments);
|
var options = this._getOptionsFromArguments(arguments);
|
||||||
var history = options.history;
|
var history = options.history;
|
||||||
log('undo start ('+history.index+' / '+history.entries.length+', '+options.name+' for '+options.windowId+', '+this._doingUndo+')');
|
var undoing = this._getUndoingState(options.key);
|
||||||
if (!history.canUndo || this._doingUndo)
|
log('undo start ('+history.index+' / '+history.entries.length+', '+options.name+' for '+options.windowId+', '+undoing+')');
|
||||||
|
if (!history.canUndo || undoing)
|
||||||
return { done : true };
|
return { done : true };
|
||||||
|
|
||||||
this._doingUndo = true;
|
this._setUndoingState(options.key, true);
|
||||||
var processed = false;
|
var processed = false;
|
||||||
var error;
|
var error;
|
||||||
var continuationInfo = new ContinuationInfo();
|
var continuationInfo = new ContinuationInfo();
|
||||||
@ -262,7 +265,7 @@
|
|||||||
while (processed === false && history.canUndo);
|
while (processed === false && history.canUndo);
|
||||||
|
|
||||||
if (continuationInfo.done) {
|
if (continuationInfo.done) {
|
||||||
this._doingUndo = false;
|
this._setUndoingState(options.key, false);
|
||||||
log(' => undo finish');
|
log(' => undo finish');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -280,11 +283,12 @@
|
|||||||
var options = this._getOptionsFromArguments(arguments);
|
var options = this._getOptionsFromArguments(arguments);
|
||||||
var history = options.history;
|
var history = options.history;
|
||||||
var max = history.entries.length;
|
var max = history.entries.length;
|
||||||
log('redo start ('+history.index+' / '+max+', '+options.name+' for '+options.windowId+', '+this._doingUndo+')');
|
var redoing = this._getRedoingState(options.key);
|
||||||
if (!history.canRedo || this._doingUndo)
|
log('redo start ('+history.index+' / '+max+', '+options.name+' for '+options.windowId+', '+redoing+')');
|
||||||
|
if (!history.canRedo || redoing)
|
||||||
return { done : true };
|
return { done : true };
|
||||||
|
|
||||||
this._doingUndo = true;
|
this._setRedoingState(options.key, true);
|
||||||
var processed = false;
|
var processed = false;
|
||||||
var error;
|
var error;
|
||||||
var continuationInfo = new ContinuationInfo();
|
var continuationInfo = new ContinuationInfo();
|
||||||
@ -333,7 +337,7 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (continuationInfo.done) {
|
if (continuationInfo.done) {
|
||||||
this._doingUndo = false;
|
this._setRedoingState(options.key, false);
|
||||||
log(' => redo finish');
|
log(' => redo finish');
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
@ -441,6 +445,17 @@
|
|||||||
return null;
|
return null;
|
||||||
},
|
},
|
||||||
|
|
||||||
|
isUndoing : function()
|
||||||
|
{
|
||||||
|
var options = this._getOptionsFromArguments(arguments);
|
||||||
|
return this._getUndoingState(options.key);
|
||||||
|
},
|
||||||
|
isRedoing : function()
|
||||||
|
{
|
||||||
|
var options = this._getOptionsFromArguments(arguments);
|
||||||
|
return this._getRedoingState(options.key);
|
||||||
|
},
|
||||||
|
|
||||||
|
|
||||||
/* PRIVATE METHODS */
|
/* PRIVATE METHODS */
|
||||||
|
|
||||||
@ -507,8 +522,9 @@
|
|||||||
entry = aArg;
|
entry = aArg;
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var type = w ? 'window' : 'global' ;
|
||||||
if (!name)
|
if (!name)
|
||||||
name = w ? 'window' : 'global' ;
|
name = type;
|
||||||
|
|
||||||
var windowId = w ? this.getWindowId(w) : null ;
|
var windowId = w ? this.getWindowId(w) : null ;
|
||||||
var history = this._getHistoryFor(name, w);
|
var history = this._getHistoryFor(name, w);
|
||||||
@ -517,6 +533,7 @@
|
|||||||
name : name,
|
name : name,
|
||||||
window : w,
|
window : w,
|
||||||
windowId : windowId,
|
windowId : windowId,
|
||||||
|
key : encodeURIComponent(name)+'::'+type,
|
||||||
entry : entry,
|
entry : entry,
|
||||||
history : history,
|
history : history,
|
||||||
task : task,
|
task : task,
|
||||||
@ -543,6 +560,7 @@
|
|||||||
{
|
{
|
||||||
var continuation;
|
var continuation;
|
||||||
var history = aOptions.history;
|
var history = aOptions.history;
|
||||||
|
var key = aOptions.key;
|
||||||
var self = this;
|
var self = this;
|
||||||
switch (aType)
|
switch (aType)
|
||||||
{
|
{
|
||||||
@ -557,6 +575,7 @@
|
|||||||
aInfo.called = true;
|
aInfo.called = true;
|
||||||
log(' => doUndoableTask finish (delayed) / in operation : '+history.inOperationCount+' / '+aInfo.allowed, history.inOperationCount);
|
log(' => doUndoableTask finish (delayed) / in operation : '+history.inOperationCount+' / '+aInfo.allowed, history.inOperationCount);
|
||||||
};
|
};
|
||||||
|
key = null;
|
||||||
self = null;
|
self = null;
|
||||||
aInfo.created = true;
|
aInfo.created = true;
|
||||||
break;
|
break;
|
||||||
@ -564,7 +583,7 @@
|
|||||||
case 'undo':
|
case 'undo':
|
||||||
continuation = function() {
|
continuation = function() {
|
||||||
if (aInfo.allowed)
|
if (aInfo.allowed)
|
||||||
self._doingUndo = false;
|
self._setUndoingState(key, false);
|
||||||
aInfo.called = true;
|
aInfo.called = true;
|
||||||
log(' => undo finish (delayed)');
|
log(' => undo finish (delayed)');
|
||||||
};
|
};
|
||||||
@ -575,7 +594,7 @@
|
|||||||
case 'redo':
|
case 'redo':
|
||||||
continuation = function() {
|
continuation = function() {
|
||||||
if (aInfo.allowed)
|
if (aInfo.allowed)
|
||||||
self._doingUndo = false;
|
self._setRedoingState(key, false);
|
||||||
aInfo.called = true;
|
aInfo.called = true;
|
||||||
log(' => redo finish (delayed)');
|
log(' => redo finish (delayed)');
|
||||||
};
|
};
|
||||||
@ -587,6 +606,7 @@
|
|||||||
continuation = function() {
|
continuation = function() {
|
||||||
};
|
};
|
||||||
history = null;
|
history = null;
|
||||||
|
key = null;
|
||||||
self = null;
|
self = null;
|
||||||
aInfo.created = true;
|
aInfo.created = true;
|
||||||
aInfo = null;
|
aInfo = null;
|
||||||
@ -651,17 +671,34 @@
|
|||||||
return windows;
|
return windows;
|
||||||
},
|
},
|
||||||
|
|
||||||
get _doingUndo()
|
_getUndoingState : function(aKey)
|
||||||
{
|
{
|
||||||
return this._db._doingUndo;
|
return this._db.$undoing && aKey in this._db.$undoing;
|
||||||
},
|
},
|
||||||
set _doingUndo(aValue)
|
_getRedoingState : function(aKey)
|
||||||
{
|
{
|
||||||
if (aValue)
|
return this._db.$redoing && aKey in this._db.$redoing;
|
||||||
this._db._doingUndo = true;
|
},
|
||||||
else
|
|
||||||
delete this._db._doingUndo;
|
_setUndoingState : function(aKey, aState)
|
||||||
return aValue;
|
{
|
||||||
|
if (!('$undoing' in this._db))
|
||||||
|
this._db.$undoing = {};
|
||||||
|
|
||||||
|
if (aState)
|
||||||
|
this._db.$undoing[aKey] = true;
|
||||||
|
else if (aKey in this._db.$undoing)
|
||||||
|
delete this._db.$undoing[aKey];
|
||||||
|
},
|
||||||
|
_setRedoingState : function(aKey, aState)
|
||||||
|
{
|
||||||
|
if (!('$redoing' in this._db))
|
||||||
|
this._db.$redoing = {};
|
||||||
|
|
||||||
|
if (aState)
|
||||||
|
this._db.$redoing[aKey] = true;
|
||||||
|
else if (aKey in this._db.$redoing)
|
||||||
|
delete this._db.$redoing[aKey];
|
||||||
},
|
},
|
||||||
|
|
||||||
get WindowMediator() {
|
get WindowMediator() {
|
||||||
|
Loading…
Reference in New Issue
Block a user