From 6670c55dc25e7d50c98383af8e71f8a9632542a2 Mon Sep 17 00:00:00 2001 From: piro Date: Sat, 26 Dec 2009 03:26:40 +0000 Subject: [PATCH] =?UTF-8?q?Multiple=20Tab=20Handler=E3=81=AB=E3=82=88?= =?UTF-8?q?=E3=81=A3=E3=81=A6=E3=81=BE=E3=81=A8=E3=82=81=E3=81=A6=E9=96=89?= =?UTF-8?q?=E3=81=98=E3=82=89=E3=82=8C=E3=81=9F=E3=82=BF=E3=83=96=E3=81=AB?= =?UTF-8?q?=E5=AF=BE=E3=81=97=E3=81=A6=E3=82=82=E3=80=81=E3=83=84=E3=83=AA?= =?UTF-8?q?=E3=83=BC=E5=8D=98=E4=BD=8D=E3=81=A7=E3=81=AE=E5=BE=A9=E5=85=83?= =?UTF-8?q?=E3=82=92=E6=9C=89=E5=8A=B9=E3=81=AB?= 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@5643 599a83e7-65a4-db11-8015-0010dcdd6dc2 --- content/treestyletab/treestyletab.js | 4 +-- content/treestyletab/treestyletabbrowser.js | 33 +++++++++++++++++---- 2 files changed, 30 insertions(+), 7 deletions(-) diff --git a/content/treestyletab/treestyletab.js b/content/treestyletab/treestyletab.js index 9c600ba6..e7a21d0f 100644 --- a/content/treestyletab/treestyletab.js +++ b/content/treestyletab/treestyletab.js @@ -1282,11 +1282,11 @@ catch(e) { if (!this.warnAboutClosingTabs(tabs.length)) return; - var id = this.makeNewClosedSetId() + '::' + tabs.length; + this.markAsClosedSet(tabs); + var b = this.getTabBrowserFromChild(tabs[0]); for (var i = tabs.length-1; i > -1; i--) { - this.setTabValue(tabs[i], this.kCLOSED_SET_ID, id); b.removeTab(tabs[i]); } }, diff --git a/content/treestyletab/treestyletabbrowser.js b/content/treestyletab/treestyletabbrowser.js index 7757ef28..e60cc3b5 100644 --- a/content/treestyletab/treestyletabbrowser.js +++ b/content/treestyletab/treestyletabbrowser.js @@ -175,6 +175,8 @@ TreeStyleTabBrowser.prototype = { b.mPanelContainer.addEventListener('dragover', this, false); b.mPanelContainer.addEventListener('dragdrop', this, false); + b.addEventListener('MultipleTabHandlerTabsClosing', this, false); + /* Closing collapsed last tree breaks selected tab. To solve this problem, I override the setter to @@ -1107,6 +1109,8 @@ TreeStyleTabBrowser.prototype = { b.mPanelContainer.removeEventListener('dragover', this, false); b.mPanelContainer.removeEventListener('dragdrop', this, false); + b.removeEventListener('MultipleTabHandlerTabsClosing', this, false); + this.tabbarDNDObserver.destroy(); delete this._tabbarDNDObserver; this.panelDNDObserver.destroy(); @@ -1406,6 +1410,11 @@ TreeStyleTabBrowser.prototype = { case 'underflow': this.onTabbarOverflow(aEvent); return; + + + case 'MultipleTabHandlerTabsClosing': + this.onTabsRemoved(aEvent.tabs); + return; } }, lastScrollX : -1, @@ -1546,13 +1555,9 @@ TreeStyleTabBrowser.prototype = { let tabs = this.getDescendantTabs(tab); - let id = this.makeNewClosedSetId(); - id += '::' + (tabs.length+1); - - this.setTabValue(tab, this.kCLOSED_SET_ID, id); + this.markAsClosedSet([tab].concat(tabs)); tabs.reverse().forEach(function(aTab) { - this.setTabValue(aTab, this.kCLOSED_SET_ID, id); b.removeTab(aTab); }, this); @@ -1739,6 +1744,24 @@ TreeStyleTabBrowser.prototype = { this.getPreviousVisibleTab(aTab); }, + onTabsRemoved : function TSTBrowser_onTabsRemoved(aTabs) + { + var group = []; + this.cleanUpTabsArray(aTabs) + .forEach(function(aTab) { + var parent = this.getParentTab(aTab); + if (group.indexOf(parent) < 0) { + this.markAsClosedSet(group); + group = [aTab]; + } + else { + group.push(aTab); + } + }, this); + + this.markAsClosedSet(group); + }, + onTabMove : function TSTBrowser_onTabMove(aEvent) { var tab = aEvent.originalTarget;