From c252552a7a8dafc0bbc4469ab3309b4397055459 Mon Sep 17 00:00:00 2001 From: piro Date: Wed, 17 Oct 2007 18:36:39 +0000 Subject: [PATCH] =?UTF-8?q?=E3=82=BF=E3=83=96=E3=82=92=E3=82=B5=E3=83=96?= =?UTF-8?q?=E3=83=84=E3=83=AA=E3=83=BC=E5=8D=98=E4=BD=8D=E3=81=A7=E7=A7=BB?= =?UTF-8?q?=E5=8B=95=E3=81=A7=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AB?= =?UTF-8?q?=E3=81=97=E3=81=9F?= 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@1222 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletab.js | 31 ++++++++++++++++++++++----- content/treestyletab/treestyletab.xul | 3 --- 2 files changed, 26 insertions(+), 8 deletions(-) diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index 0db388c5..4f8026fd 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -406,7 +406,7 @@ var TreeStyleTabService = { var adoption = this.getPref('extensions.treestyletab.adoptChildrenToGrandParentOnRemoveTab'); var processTab = !adoption ? function(aTab) { self.repudiateTab(aTab); - b.moveTabTo(aTab, b.mTabContainer.lastChild._tPos); + self.moveTabSubTreeTo(aTab, b.mTabContainer.lastChild._tPos); } : parentTab ? function(aTab) { self.adoptTabTo(aTab, parentTab, tab); @@ -612,13 +612,21 @@ var TreeStyleTabService = { return lastChild; }, - getChildTabsOf : function(aTab) + getDescendantTabsOf : function(aTab) + { + var tabs = []; + this.getChildTabsOf(aTab, tabs); + return tabs; + }, + + getChildTabsOf : function(aTab, aAllTabsArray) { var tabs = []; - var id = aTab.getAttribute(this.kID); var children = aTab.getAttribute(this.kCHILDREN); if (!children) return tabs; + if (aAllTabsArray) tabs = aAllTabsArray; + var list = children.split('|'); var b = this.getTabBrowserFromChildren(aTab); var tab; @@ -629,6 +637,8 @@ var TreeStyleTabService = { tab = this.getTabById(list[i], b) if (tab) { tabs.push(tab); + if (aAllTabsArray) + this.getChildTabsOf(tab, tabs); } else { children = children.replace('|'+list[i], ''); @@ -642,7 +652,6 @@ var TreeStyleTabService = { getFirstChildTabOf : function(aTab) { - var id = aTab.getAttribute(this.kID); var b = this.getTabBrowserFromChildren(aTab); var children = aTab.getAttribute(this.kCHILDREN); var firstChild = null; @@ -664,7 +673,6 @@ var TreeStyleTabService = { getLastChildTabOf : function(aTab) { - var id = aTab.getAttribute(this.kID); var b = this.getTabBrowserFromChildren(aTab); var children = aTab.getAttribute(this.kCHILDREN); var lastChild = null; @@ -750,6 +758,19 @@ var TreeStyleTabService = { this.updateTabsIndent(this.getChildTabsOf(aTabs[i]), aLevel+1); } }, + + moveTabSubTreeTo : function(aTab, aIndex) + { + var tabs = this.getDescendantTabsOf(aTab); + + var b = this.getTabBrowserFromChildren(aTab); + b.moveTabTo(aTab, aIndex); + + for (var i = 0, maxi = tabs.length; i < maxi; i++) + { + b.moveTabTo(tabs[i], aTab._tPos+i+1); + } + }, /* Pref Listener */ diff --git a/content/treestyletab/treestyletab.xul b/content/treestyletab/treestyletab.xul index 0509ad9c..b429b744 100644 --- a/content/treestyletab/treestyletab.xul +++ b/content/treestyletab/treestyletab.xul @@ -1,10 +1,7 @@ - - -