From 9d98d8e1ce06c2c8e7f984a4eadb95d37e89648c Mon Sep 17 00:00:00 2001 From: piro Date: Wed, 2 Sep 2009 02:52:16 +0000 Subject: [PATCH] =?UTF-8?q?=E3=82=BB=E3=83=83=E3=82=B7=E3=83=A7=E3=83=B3?= =?UTF-8?q?=E5=BE=A9=E5=85=83=E6=99=82=E3=81=AB=E7=8F=BE=E5=9C=A8=E3=81=AE?= =?UTF-8?q?=E3=82=BF=E3=83=96=E3=81=AE=E5=89=8D=E5=BE=8C=E3=81=AE=E3=82=BF?= =?UTF-8?q?=E3=83=96=E3=81=AE=E4=B8=A6=E3=81=B3=E3=81=8C=E5=B4=A9=E3=82=8C?= =?UTF-8?q?=E3=82=8B=E5=95=8F=E9=A1=8C=E3=81=AB=E3=81=A4=E3=81=84=E3=81=A6?= =?UTF-8?q?=E6=94=B9=E5=96=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@5033 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/hacks.js | 3 +- content/treestyletab/treestyletab.js | 1 + content/treestyletab/treestyletabbrowser.js | 38 ++++++++++++++++++--- 3 files changed, 37 insertions(+), 5 deletions(-) diff --git a/content/treestyletab/hacks.js b/content/treestyletab/hacks.js index e412d8f4..9c1585d1 100644 --- a/content/treestyletab/hacks.js +++ b/content/treestyletab/hacks.js @@ -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( diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index a313ae35..436d7121 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -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', diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 37b9a1b0..81792b8d 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -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)