セッション復元時に現在のタブの前後のタブの並びが崩れる問題について改善

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@5033 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-09-02 02:52:16 +00:00
parent b2b49e2970
commit 9d98d8e1ce
3 changed files with 37 additions and 5 deletions

View File

@ -35,7 +35,8 @@ TreeStyleTabService.overrideExtensionsPreInit = function() {
prefix+this.kCHILDREN,
prefix+this.kPARENT,
prefix+this.kANCESTOR,
prefix+this.kINSERT_BEFORE
prefix+this.kINSERT_BEFORE,
prefix+this.kINSERT_AFTER
];
eval('SessionData.getTabProperties = '+
SessionData.getTabProperties.toSource().replace(

View File

@ -6,6 +6,7 @@ var TreeStyleTabService = {
kANCESTOR : 'treestyletab-ancestors',
kNEST : 'treestyletab-nest',
kINSERT_BEFORE : 'treestyletab-insert-before',
kINSERT_AFTER : 'treestyletab-insert-after',
kSUBTREE_COLLAPSED : 'treestyletab-subtree-collapsed',
kCOLLAPSED : 'treestyletab-collapsed',

View File

@ -1466,6 +1466,10 @@ TreeStyleTabBrowser.prototype = {
if (prev)
this.setTabValue(prev, this.kINSERT_BEFORE, tab.getAttribute(this.kID));
var next = this.getNextSiblingTab(tab);
if (next)
this.setTabValue(next, this.kINSERT_AFTER, tab.getAttribute(this.kID));
this.showTabbarForFeedback();
},
@ -1498,17 +1502,24 @@ TreeStyleTabBrowser.prototype = {
var parentTab = this.getParentTab(tab);
var nextFocusedTab = null;
var next = this.getNextSiblingTab(tab);
if (next)
this.setTabValue(tab, this.kINSERT_BEFORE, next.getAttribute(this.kID));
var prev = this.getPreviousSiblingTab(tab);
var next = this.getNextSiblingTab(tab);
if (prev) {
this.setTabValue(tab, this.kINSERT_AFTER, prev.getAttribute(this.kID));
if (next)
this.setTabValue(prev, this.kINSERT_BEFORE, next.getAttribute(this.kID));
else
this.deleteTabValue(prev, this.kINSERT_BEFORE);
}
if (next) {
this.setTabValue(tab, this.kINSERT_BEFORE, next.getAttribute(this.kID));
if (prev)
this.setTabValue(next, this.kINSERT_AFTER, prev.getAttribute(this.kID));
else
this.deleteTabValue(next, this.kINSERT_AFTER);
}
var backupAttributes = {};
var indentModifiedTabs = [];
@ -1666,6 +1677,12 @@ TreeStyleTabBrowser.prototype = {
this.updateTabsCount(tab, true);
var prev = this.getPreviousSiblingTab(tab);
if (prev)
this.setTabValue(tab, this.kINSERT_AFTER, prev.getAttribute(this.kID));
else
this.deleteTabValue(tab, this.kINSERT_AFTER);
var next = this.getNextSiblingTab(tab);
if (next)
this.setTabValue(tab, this.kINSERT_BEFORE, next.getAttribute(this.kID));
@ -1675,6 +1692,13 @@ TreeStyleTabBrowser.prototype = {
var old = aEvent.detail;
if (old > tab._tPos) old--;
old = this.getTabs(b).snapshotItem(old);
prev = this.getPreviousSiblingTab(old);
if (prev)
this.setTabValue(old, this.kINSERT_AFTER, prev.getAttribute(this.kID));
else
this.deleteTabValue(old, this.kINSERT_AFTER);
next = this.getNextSiblingTab(old);
if (next)
this.setTabValue(old, this.kINSERT_BEFORE, next.getAttribute(this.kID));
@ -1839,6 +1863,12 @@ TreeStyleTabBrowser.prototype = {
if (nextTab && maybeDuplicated) nextTab = this.redirectId(nextTab);
nextTab = this.getTabById(nextTab);
if (!nextTab) {
var prevTab = this.getTabValue(tab, this.kINSERT_AFTER);
if (prevTab && maybeDuplicated) prevTab = this.redirectId(prevTab);
nextTab = this.getNextSiblingTab(this.getTabById(prevTab));
}
var ancestors = (this.getTabValue(tab, this.kANCESTOR) || this.getTabValue(tab, this.kPARENT)).split('|');
var parent = null;
for (var i in ancestors)