とりやめ

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@2644 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2008-06-17 02:06:52 +00:00
parent 56717087cc
commit e09f1ebf1b
3 changed files with 54 additions and 126 deletions

View File

@ -63,12 +63,7 @@ var TreeStyleTabService = {
kTRANSPARENT_NONE : 0, kTRANSPARENT_NONE : 0,
kTRANSPARENT_PART : 1, kTRANSPARENT_PART : 1,
kTRANSPARENT_FULL : 2, kTRANSPARENT_FULL : 2,
kTRANSPARENT_STYLE : ['none', 'part', 'full'], kTRANSPARENT_STYLE : ['none', 'part', 'full'],
kAUTOHIDE_MODE_DISABLED : 0,
kAUTOHIDE_MODE_HIDE : 1,
kAUTOHIDE_MODE_SHRINK : 2,
autoHideMode : 0,
kINSERT_FISRT : 0, kINSERT_FISRT : 0,
kINSERT_LAST : 1, kINSERT_LAST : 1,
@ -475,11 +470,8 @@ var TreeStyleTabService = {
toggleAutoHide : function() toggleAutoHide : function()
{ {
this.setTreePref('tabbar.autoHide.mode', this.setTreePref('tabbar.autoHide.enabled',
this.getTreePref('tabbar.autoHide.mode') == this.kAUTOHIDE_MODE_DISABLED ? !this.getTreePref('tabbar.autoHide.enabled'));
this.getTreePref('tabbar.autoHide.mode.toggle') :
this.kAUTOHIDE_MODE_DISABLED
);
}, },
toggleFixed : function() toggleFixed : function()
@ -823,7 +815,7 @@ var TreeStyleTabService = {
this.overrideExtensionsOnInitAfter(); // hacks.js this.overrideExtensionsOnInitAfter(); // hacks.js
this.observe(null, 'nsPref:changed', 'extensions.treestyletab.levelMargin'); this.observe(null, 'nsPref:changed', 'extensions.treestyletab.levelMargin');
this.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.autoHide.mode'); this.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.autoHide.enabled');
this.observe(null, 'nsPref:changed', 'browser.link.open_newwindow.restriction.override'); this.observe(null, 'nsPref:changed', 'browser.link.open_newwindow.restriction.override');
this.observe(null, 'nsPref:changed', 'browser.tabs.loadFolderAndReplace.override'); this.observe(null, 'nsPref:changed', 'browser.tabs.loadFolderAndReplace.override');
}, },
@ -1384,13 +1376,11 @@ catch(e) {
onTabbarResized : function(aEvent) onTabbarResized : function(aEvent)
{ {
var b = this.getTabBrowserFromChild(aEvent.currentTarget); this.setPref(
if (b.treeStyleTab.tabbarShrunken) { 'extensions.treestyletab.tabbar.width',
this.setTreePref('tabbar.shrunkenWidth', b.mStrip.boxObject.width); TreeStyleTabService.getTabBrowserFromChild(aEvent.currentTarget)
} .mStrip.boxObject.width
else { );
this.setTreePref('tabbar.width', b.mStrip.boxObject.width);
}
}, },
initContextMenu : function() initContextMenu : function()
@ -1640,13 +1630,12 @@ catch(e) {
this.ObserverService.notifyObservers(null, 'TreeStyleTab:levelMarginModified', value); this.ObserverService.notifyObservers(null, 'TreeStyleTab:levelMarginModified', value);
break; break;
case 'extensions.treestyletab.tabbar.autoHide.mode': case 'extensions.treestyletab.tabbar.autoHide.enabled':
case 'extensions.treestyletab.tabbar.autoShow.accelKeyDown': case 'extensions.treestyletab.tabbar.autoShow.accelKeyDown':
case 'extensions.treestyletab.tabbar.autoShow.tabSwitch': case 'extensions.treestyletab.tabbar.autoShow.tabSwitch':
case 'extensions.treestyletab.tabbar.autoShow.feedback': case 'extensions.treestyletab.tabbar.autoShow.feedback':
this.autoHideMode = this.getTreePref('tabbar.autoHide.mode');
if ( if (
this.autoHideMode != this.kAUTOHIDE_MODE_DISABLED && this.getTreePref('tabbar.autoHide.enabled') &&
( (
this.getTreePref('tabbar.autoShow.accelKeyDown') || this.getTreePref('tabbar.autoShow.accelKeyDown') ||
this.getTreePref('tabbar.autoShow.tabSwitch') || this.getTreePref('tabbar.autoShow.tabSwitch') ||

View File

@ -360,7 +360,7 @@ TreeStyleTabBrowser.prototype = {
this.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.fixed'); this.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.fixed');
this.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.transparent.style'); this.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.transparent.style');
window.setTimeout(function() { window.setTimeout(function() {
b.treeStyleTab.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.autoHide.mode'); b.treeStyleTab.observe(null, 'nsPref:changed', 'extensions.treestyletab.tabbar.autoHide.enabled');
}, 0); }, 0);
delete i; delete i;
@ -873,9 +873,9 @@ TreeStyleTabBrowser.prototype = {
b.removeAttribute(this.kALLOW_COLLAPSE); b.removeAttribute(this.kALLOW_COLLAPSE);
break; break;
case 'extensions.treestyletab.tabbar.autoHide.mode': case 'extensions.treestyletab.tabbar.autoHide.enabled':
var pos = b.getAttribute(this.kTABBAR_POSITION); var pos = b.getAttribute(this.kTABBAR_POSITION);
if (value != this.kAUTOHIDE_MODE_DISABLED/* && (pos == 'left' || pos == 'right')*/) if (value/* && (pos == 'left' || pos == 'right')*/)
this.startAutoHide(); this.startAutoHide();
else else
this.endAutoHide(); this.endAutoHide();
@ -1622,7 +1622,7 @@ TreeStyleTabBrowser.prototype = {
if (this.getTreePref('show.'+this.kMENUITEM_AUTOHIDE)/* && if (this.getTreePref('show.'+this.kMENUITEM_AUTOHIDE)/* &&
(pos == 'left' || pos == 'right')*/) { (pos == 'left' || pos == 'right')*/) {
autohide.removeAttribute('hidden'); autohide.removeAttribute('hidden');
if (this.autoHideEnabled) if (this.getTreePref('tabbar.autoHide.enabled'))
autohide.setAttribute('checked', true); autohide.setAttribute('checked', true);
else else
autohide.removeAttribute('checked'); autohide.removeAttribute('checked');
@ -2685,7 +2685,7 @@ TreeStyleTabBrowser.prototype = {
get tabbarWidth() get tabbarWidth()
{ {
if (this.autoHideMode != this.kAUTOHIDE_MODE_HIDE && this.tabbarShown) { if (this.tabbarShown) {
var b = this.mTabBrowser; var b = this.mTabBrowser;
var splitter = document.getAnonymousElementByAttribute(b, 'class', this.kSPLITTER); var splitter = document.getAnonymousElementByAttribute(b, 'class', this.kSPLITTER);
this._tabbarWidth = b.mStrip.boxObject.width + this._tabbarWidth = b.mStrip.boxObject.width +
@ -2719,69 +2719,35 @@ TreeStyleTabBrowser.prototype = {
{ {
fullScreenCanvas.show(); fullScreenCanvas.show();
var b = this.mTabBrowser; var b = this.mTabBrowser;
switch (this.autoHideMode) if (this.tabbarShown) {
{ var splitter = document.getAnonymousElementByAttribute(b, 'class', this.kSPLITTER);
case this.kAUTOHIDE_MODE_HIDE: this.tabbarHeight = b.mStrip.boxObject.height;
if (this.tabbarShown) { this.tabbarWidth = b.mStrip.boxObject.width +
var splitter = document.getAnonymousElementByAttribute(b, 'class', this.kSPLITTER); (splitter ? splitter.boxObject.width : 0 );
this.tabbarHeight = b.mStrip.boxObject.height; this.container.style.margin = 0;
this.tabbarWidth = b.mStrip.boxObject.width + b.setAttribute(this.kAUTOHIDE, 'hidden');
(splitter ? splitter.boxObject.width : 0 ); this.showHideTabbarReason = aReason || this.kSHOWN_BY_UNKNOWN;
this.container.style.margin = 0; this.tabbarShown = false;
b.setAttribute(this.kAUTOHIDE, 'hidden'); }
this.showHideTabbarReason = aReason || this.kSHOWN_BY_UNKNOWN; else {
this.tabbarShown = false; switch (b.getAttribute(this.kTABBAR_POSITION))
} {
else { case 'left':
switch (b.getAttribute(this.kTABBAR_POSITION)) this.container.style.marginRight = '-'+this.tabbarWidth+'px';
{ break;
case 'left': case 'right':
this.container.style.marginRight = '-'+this.tabbarWidth+'px'; this.container.style.marginLeft = '-'+this.tabbarWidth+'px';
break; break;
case 'right': case 'bottom':
this.container.style.marginLeft = '-'+this.tabbarWidth+'px'; this.container.style.marginTop = '-'+this.tabbarHeight+'px';
break; break;
case 'bottom': default:
this.container.style.marginTop = '-'+this.tabbarHeight+'px'; this.container.style.marginBottom = '-'+this.tabbarHeight+'px';
break; break;
default: }
this.container.style.marginBottom = '-'+this.tabbarHeight+'px'; if (this.isGecko18) b.setAttribute(this.kAUTOHIDE, 'show');
break; this.showHideTabbarReason = aReason || this.kSHOWN_BY_UNKNOWN;
} this.tabbarShown = true;
if (this.isGecko18) b.setAttribute(this.kAUTOHIDE, 'show');
this.showHideTabbarReason = aReason || this.kSHOWN_BY_UNKNOWN;
this.tabbarShown = true;
}
break;
case this.kAUTOHIDE_MODE_SHRINK:
if (this.tabbarShown) {
this.tabbarShown = false;
this.tabbarWidth = this.getTreePref('tabbar.shrunken.width');
}
else {
this.tabbarShown = true;
this.tabbarWidth = this.getTreePref('tabbar.width');
}
this.updateTabbarTransparency();
switch (b.getAttribute(this.kTABBAR_POSITION))
{
case 'left':
this.container.style.marginRight = '-'+this.tabbarWidth+'px';
break;
case 'right':
this.container.style.marginLeft = '-'+this.tabbarWidth+'px';
break;
case 'bottom':
this.container.style.marginTop = '-'+this.tabbarHeight+'px';
break;
default:
this.container.style.marginBottom = '-'+this.tabbarHeight+'px';
break;
}
if (this.isGecko18) b.setAttribute(this.kAUTOHIDE, 'show');
this.showHideTabbarReason = aReason || this.kSHOWN_BY_UNKNOWN;
break;
} }
this.redrawContentArea(); this.redrawContentArea();
window.setTimeout(function(aSelf) { window.setTimeout(function(aSelf) {
@ -2828,20 +2794,15 @@ TreeStyleTabBrowser.prototype = {
) )
); );
if (this.mTabBrowser.hasAttribute(this.kTRANSPARENT) && if (this.mTabBrowser.hasAttribute(this.kTRANSPARENT) &&
this.mTabBrowser.getAttribute(this.kTRANSPARENT) != this.kTRANSPARENT_STYLE[this.kTRANSPARENT_NONE]) { this.mTabBrowser.getAttribute(this.kTRANSPARENT) != this.kTRANSPARENT_STYLE[this.kTRANSPARENT_NONE])
this.drawTabbarCanvas(); this.drawTabbarCanvas();
} else
else {
this.clearTabbarCanvas(); this.clearTabbarCanvas();
if (this.autoHideMode == this.kAUTOHIDE_MODE_SHRINK)
this.container.style.margin = 0;
}
} }
else { else {
v.move(window.outerWidth,window.outerHeight); v.move(window.outerWidth,window.outerHeight);
v.move(0,0); v.move(0,0);
if (this.autoHideMode == this.kAUTOHIDE_MODE_HIDE) this.clearTabbarCanvas();
this.clearTabbarCanvas();
} }
} }
catch(e) { catch(e) {
@ -2912,39 +2873,20 @@ TreeStyleTabBrowser.prototype = {
) )
) )
]; ];
if ( if (pos != 'top' &&
pos != 'top' && this.getTreePref('tabbar.autoHide.enabled') &&
style != this.kTRANSPARENT_STYLE[this.kTRANSPARENT_NONE] && style != this.kTRANSPARENT_STYLE[this.kTRANSPARENT_NONE])
(
this.autoHideMode == this.kAUTOHIDE_MODE_HIDE ||
this.autoHideMode == this.kAUTOHIDE_MODE_SHRINK && this.tabbarHidden
)
)
this.mTabBrowser.setAttribute(this.kTRANSPARENT, style); this.mTabBrowser.setAttribute(this.kTRANSPARENT, style);
else else
this.mTabBrowser.removeAttribute(this.kTRANSPARENT); this.mTabBrowser.removeAttribute(this.kTRANSPARENT);
}, },
/* auto hide */ /* auto hide */
autoHideEnabled : false,
// backward compatibility
get autoHideEnabled()
{
return this._autoHideEnabled && this.autoHideMode != this.kAUTOHIDE_MODE_DISABLED;
},
set autoHideEnabled(aValue)
{
this._autoHideEnabled = aValue;
return aValue;
},
_autoHideEnabled : false,
get areaPadding() get areaPadding()
{ {
var area = this.getTreePref('tabbar.autoHide.area'); return this.getTreePref('tabbar.autoHide.area');
if (this.autoHideMode == this.kAUTOHIDE_MODE_SHRINK)
area -= this.getTreePref('autoHide.area.shrunkenOffset');
return area;
}, },
startAutoHide : function() startAutoHide : function()

View File

@ -1,5 +1,4 @@
pref("extensions.treestyletab.tabbar.width", 200); pref("extensions.treestyletab.tabbar.width", 200);
pref("extensions.treestyletab.tabbar.shrunkenWidth", 100);
pref("extensions.treestyletab.tabbar.position", "left"); pref("extensions.treestyletab.tabbar.position", "left");
pref("extensions.treestyletab.tabbar.multirow", false); pref("extensions.treestyletab.tabbar.multirow", false);
pref("extensions.treestyletab.tabbar.invertScrollbar", true); pref("extensions.treestyletab.tabbar.invertScrollbar", true);
@ -8,11 +7,9 @@ pref("extensions.treestyletab.tabbar.hideAlltabsButton", true);
pref("extensions.treestyletab.tabbar.scroll.smooth", true); pref("extensions.treestyletab.tabbar.scroll.smooth", true);
pref("extensions.treestyletab.tabbar.scroll.timeout", 250); pref("extensions.treestyletab.tabbar.scroll.timeout", 250);
pref("extensions.treestyletab.tabbar.style", "mixed"); pref("extensions.treestyletab.tabbar.style", "mixed");
pref("extensions.treestyletab.tabbar.autoHide.mode", 0); pref("extensions.treestyletab.tabbar.autoHide.enabled", false);
pref("extensions.treestyletab.tabbar.autoHide.mode.toggle", 2);
pref("extensions.treestyletab.tabbar.autoHide.delay", 50); pref("extensions.treestyletab.tabbar.autoHide.delay", 50);
pref("extensions.treestyletab.tabbar.autoHide.area", 25); pref("extensions.treestyletab.tabbar.autoHide.area", 25);
pref("extensions.treestyletab.tabbar.autoHide.area.shrunkenOffset", 7);
pref("extensions.treestyletab.tabbar.autoHide.expandArea", false); pref("extensions.treestyletab.tabbar.autoHide.expandArea", false);
// 0 = not transparent, 1 = partial transparent, 2 = completely transparent // 0 = not transparent, 1 = partial transparent, 2 = completely transparent
pref("extensions.treestyletab.tabbar.transparent.style", 1); pref("extensions.treestyletab.tabbar.transparent.style", 1);