Multiple Tab Handlerによってまとめて閉じられたタブに対しても、ツリー単位での復元を有効に
git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@5643 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
parent
d4cea77f22
commit
6670c55dc2
@ -1282,11 +1282,11 @@ catch(e) {
|
|||||||
if (!this.warnAboutClosingTabs(tabs.length))
|
if (!this.warnAboutClosingTabs(tabs.length))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
var id = this.makeNewClosedSetId() + '::' + tabs.length;
|
this.markAsClosedSet(tabs);
|
||||||
|
|
||||||
var b = this.getTabBrowserFromChild(tabs[0]);
|
var b = this.getTabBrowserFromChild(tabs[0]);
|
||||||
for (var i = tabs.length-1; i > -1; i--)
|
for (var i = tabs.length-1; i > -1; i--)
|
||||||
{
|
{
|
||||||
this.setTabValue(tabs[i], this.kCLOSED_SET_ID, id);
|
|
||||||
b.removeTab(tabs[i]);
|
b.removeTab(tabs[i]);
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
@ -175,6 +175,8 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
b.mPanelContainer.addEventListener('dragover', this, false);
|
b.mPanelContainer.addEventListener('dragover', this, false);
|
||||||
b.mPanelContainer.addEventListener('dragdrop', this, false);
|
b.mPanelContainer.addEventListener('dragdrop', this, false);
|
||||||
|
|
||||||
|
b.addEventListener('MultipleTabHandlerTabsClosing', this, false);
|
||||||
|
|
||||||
|
|
||||||
/* Closing collapsed last tree breaks selected tab.
|
/* Closing collapsed last tree breaks selected tab.
|
||||||
To solve this problem, I override the setter to
|
To solve this problem, I override the setter to
|
||||||
@ -1107,6 +1109,8 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
b.mPanelContainer.removeEventListener('dragover', this, false);
|
b.mPanelContainer.removeEventListener('dragover', this, false);
|
||||||
b.mPanelContainer.removeEventListener('dragdrop', this, false);
|
b.mPanelContainer.removeEventListener('dragdrop', this, false);
|
||||||
|
|
||||||
|
b.removeEventListener('MultipleTabHandlerTabsClosing', this, false);
|
||||||
|
|
||||||
this.tabbarDNDObserver.destroy();
|
this.tabbarDNDObserver.destroy();
|
||||||
delete this._tabbarDNDObserver;
|
delete this._tabbarDNDObserver;
|
||||||
this.panelDNDObserver.destroy();
|
this.panelDNDObserver.destroy();
|
||||||
@ -1406,6 +1410,11 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
case 'underflow':
|
case 'underflow':
|
||||||
this.onTabbarOverflow(aEvent);
|
this.onTabbarOverflow(aEvent);
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
|
||||||
|
case 'MultipleTabHandlerTabsClosing':
|
||||||
|
this.onTabsRemoved(aEvent.tabs);
|
||||||
|
return;
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
lastScrollX : -1,
|
lastScrollX : -1,
|
||||||
@ -1546,13 +1555,9 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
|
|
||||||
let tabs = this.getDescendantTabs(tab);
|
let tabs = this.getDescendantTabs(tab);
|
||||||
|
|
||||||
let id = this.makeNewClosedSetId();
|
this.markAsClosedSet([tab].concat(tabs));
|
||||||
id += '::' + (tabs.length+1);
|
|
||||||
|
|
||||||
this.setTabValue(tab, this.kCLOSED_SET_ID, id);
|
|
||||||
|
|
||||||
tabs.reverse().forEach(function(aTab) {
|
tabs.reverse().forEach(function(aTab) {
|
||||||
this.setTabValue(aTab, this.kCLOSED_SET_ID, id);
|
|
||||||
b.removeTab(aTab);
|
b.removeTab(aTab);
|
||||||
}, this);
|
}, this);
|
||||||
|
|
||||||
@ -1739,6 +1744,24 @@ TreeStyleTabBrowser.prototype = {
|
|||||||
this.getPreviousVisibleTab(aTab);
|
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)
|
onTabMove : function TSTBrowser_onTabMove(aEvent)
|
||||||
{
|
{
|
||||||
var tab = aEvent.originalTarget;
|
var tab = aEvent.originalTarget;
|
||||||
|
Loading…
Reference in New Issue
Block a user