スプリッタのダブルクリックでタブバーの幅・高さを初期値にリセットするようにした

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@6446 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2010-03-25 10:19:29 +00:00
parent 8f8bbda446
commit 4071e166ca

View File

@ -1088,6 +1088,7 @@ TreeStyleTabBrowser.prototype = {
try { try {
splitter.removeEventListener('mouseup', this, false); splitter.removeEventListener('mouseup', this, false);
splitter.removeEventListener('click', this, false); splitter.removeEventListener('click', this, false);
splitter.removeEventListener('dblclick', this, false);
} }
catch(e) { catch(e) {
} }
@ -1108,6 +1109,7 @@ TreeStyleTabBrowser.prototype = {
splitter.addEventListener('mouseup', this, false); splitter.addEventListener('mouseup', this, false);
splitter.addEventListener('click', this, false); splitter.addEventListener('click', this, false);
splitter.addEventListener('dblclick', this, false);
var ref = this.mTabBrowser.mPanelContainer; var ref = this.mTabBrowser.mPanelContainer;
ref.parentNode.insertBefore(splitter, ref); ref.parentNode.insertBefore(splitter, ref);
@ -1203,6 +1205,25 @@ TreeStyleTabBrowser.prototype = {
} }
}, },
resetTabbarSize : function TSTBrowser_resetTabbarSize()
{
if (!this.isVertical) {
this.clearTreePref('tabbar.height');
if (this.placeholder) {
let tabs = this.mTabBrowser.mTabContainer;
tabs.removeAttribute('height');
this.placeholder.height = tabs.boxObject.height;
this.updateFloatingTabbar();
}
}
else {
if (!this.autoHide.expanded)
this.clearTreePref('tabbar.shrunkenWidth');
else
this.clearTreePref('tabbar.width');
}
},
updateTabbarOverflow : function TSTBrowser_updateTabbarOverflow() updateTabbarOverflow : function TSTBrowser_updateTabbarOverflow()
{ {
var b = this.mTabBrowser; var b = this.mTabBrowser;
@ -2555,7 +2576,13 @@ TreeStyleTabBrowser.prototype = {
onDblClick : function TSTBrowser_onDblClick(aEvent) onDblClick : function TSTBrowser_onDblClick(aEvent)
{ {
var tab = this.getTabFromEvent(aEvent); switch (aEvent.currentTarget.localName)
{
case 'splitter':
return this.resetTabbarSize();
default:
let tab = this.getTabFromEvent(aEvent);
if (tab && if (tab &&
this.hasChildTabs(tab) && this.hasChildTabs(tab) &&
this.getTreePref('collapseExpandSubtree.dblclick')) { this.getTreePref('collapseExpandSubtree.dblclick')) {
@ -2563,6 +2590,8 @@ TreeStyleTabBrowser.prototype = {
aEvent.preventDefault(); aEvent.preventDefault();
aEvent.stopPropagation(); aEvent.stopPropagation();
} }
return;
}
}, },
onMouseDown : function TSTBrowser_onMouseDown(aEvent) onMouseDown : function TSTBrowser_onMouseDown(aEvent)