水平タブバー・垂直タブバーのそれぞれ別々に、サイズ固定の状態を保存するようにした

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@4659 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2009-07-07 15:34:14 +00:00
parent cce7572897
commit 1d218fa321
4 changed files with 60 additions and 32 deletions

View File

@ -27,9 +27,6 @@
<preference id="extensions.treestyletab.enableSubtreeIndent" <preference id="extensions.treestyletab.enableSubtreeIndent"
name="extensions.treestyletab.enableSubtreeIndent" name="extensions.treestyletab.enableSubtreeIndent"
type="bool"/> type="bool"/>
<preference id="extensions.treestyletab.tabbar.fixed"
name="extensions.treestyletab.tabbar.fixed"
type="bool"/>
<preference id="extensions.treestyletab.allowSubtreeCollapseExpand" <preference id="extensions.treestyletab.allowSubtreeCollapseExpand"
name="extensions.treestyletab.allowSubtreeCollapseExpand" name="extensions.treestyletab.allowSubtreeCollapseExpand"
type="bool"/> type="bool"/>
@ -116,9 +113,6 @@
label="&config.tabbar.invertClosebox.left;" label="&config.tabbar.invertClosebox.left;"
label-left="&config.tabbar.invertClosebox.left;" label-left="&config.tabbar.invertClosebox.left;"
label-right="&config.tabbar.invertClosebox.right;"/> label-right="&config.tabbar.invertClosebox.right;"/>
<checkbox id="extensions.treestyletab.tabbar.fixed-check"
preference="extensions.treestyletab.tabbar.fixed"
label="&context.toggleFixed.label;"/>
</hbox> </hbox>
<checkbox id="extensions.treestyletab.allowSubtreeCollapseExpand-check" <checkbox id="extensions.treestyletab.allowSubtreeCollapseExpand-check"
preference="extensions.treestyletab.allowSubtreeCollapseExpand" preference="extensions.treestyletab.allowSubtreeCollapseExpand"

View File

@ -461,8 +461,11 @@ var TreeStyleTabService = {
toggleFixed : function() toggleFixed : function()
{ {
this.setTreePref('tabbar.fixed', var pos = this.getTreePref('tabbar.position');
!this.getTreePref('tabbar.fixed')); var pref = (pos == 'left' || pos == 'right') ?
'tabbar.fixed.vertical' :
'tabbar.fixed.horizontal' ;
this.setTreePref(pref, !this.getTreePref(pref));
}, },
changeTabbarPosition : function(aNewPosition) /* PUBLIC API */ changeTabbarPosition : function(aNewPosition) /* PUBLIC API */
@ -478,7 +481,6 @@ var TreeStyleTabService = {
var vertical = (aNewPosition == 'left' || aNewPosition == 'right'); var vertical = (aNewPosition == 'left' || aNewPosition == 'right');
this.setTreePref('enableSubtreeIndent', vertical); this.setTreePref('enableSubtreeIndent', vertical);
this.setTreePref('allowSubtreeCollapseExpand', vertical); this.setTreePref('allowSubtreeCollapseExpand', vertical);
this.setTreePref('tabbar.fixed', !vertical);
}, },
/* backward compatibility */ /* backward compatibility */

View File

@ -509,7 +509,6 @@ TreeStyleTabBrowser.prototype = {
this.onPrefChange('extensions.treestyletab.tabbar.hideNewTabButton'); this.onPrefChange('extensions.treestyletab.tabbar.hideNewTabButton');
this.onPrefChange('extensions.treestyletab.tabbar.hideAlltabsButton'); this.onPrefChange('extensions.treestyletab.tabbar.hideAlltabsButton');
this.onPrefChange('extensions.treestyletab.allowSubtreeCollapseExpand'); this.onPrefChange('extensions.treestyletab.allowSubtreeCollapseExpand');
this.onPrefChange('extensions.treestyletab.tabbar.fixed');
this.onPrefChange('extensions.treestyletab.tabbar.transparent.style'); this.onPrefChange('extensions.treestyletab.tabbar.transparent.style');
this.onPrefChange('extensions.treestyletab.tabbar.autoHide.area'); this.onPrefChange('extensions.treestyletab.tabbar.autoHide.area');
this.onPrefChange('extensions.treestyletab.tabbar.togglerSize'); this.onPrefChange('extensions.treestyletab.tabbar.togglerSize');
@ -842,6 +841,11 @@ TreeStyleTabBrowser.prototype = {
b.mStrip.setAttribute('width', this.getTreePref('tabbar.width')); b.mStrip.setAttribute('width', this.getTreePref('tabbar.width'));
if (this.getTreePref('tabbar.fixed.vertical'))
b.setAttribute(this.kFIXED, true);
else
b.removeAttribute(this.kFIXED);
b.setAttribute(this.kMODE, 'vertical'); b.setAttribute(this.kMODE, 'vertical');
if (pos == this.kTABBAR_RIGHT) { if (pos == this.kTABBAR_RIGHT) {
b.setAttribute(this.kTABBAR_POSITION, 'right'); b.setAttribute(this.kTABBAR_POSITION, 'right');
@ -913,7 +917,16 @@ TreeStyleTabBrowser.prototype = {
if (toolboxContainer) if (toolboxContainer)
toolboxContainer.orient = 'horizontal'; toolboxContainer.orient = 'horizontal';
b.mStrip.setAttribute('height', this.getTreePref('tabbar.height'));
if (this.getTreePref('tabbar.fixed.horizontal')) {
b.setAttribute(this.kFIXED, true);
b.mStrip.removeAttribute('height');
b.mPanelContainer.removeAttribute('height');
}
else {
b.removeAttribute(this.kFIXED);
b.mStrip.setAttribute('height', this.getTreePref('tabbar.height'));
}
b.setAttribute(this.kMODE, this.getTreePref('tabbar.multirow') ? 'multirow' : 'horizontal' ); b.setAttribute(this.kMODE, this.getTreePref('tabbar.multirow') ? 'multirow' : 'horizontal' );
b.removeAttribute(this.kTAB_INVERTED); b.removeAttribute(this.kTAB_INVERTED);
@ -1182,17 +1195,24 @@ TreeStyleTabBrowser.prototype = {
this.endListenMouseMove(); this.endListenMouseMove();
break; break;
case 'extensions.treestyletab.tabbar.fixed': case 'extensions.treestyletab.tabbar.fixed.vertical':
if (value) { if (this.isVertical) {
b.setAttribute(this.kFIXED, true); if (value)
if (!this.isVertical) { b.setAttribute(this.kFIXED, true);
else
b.removeAttribute(this.kFIXED);
}
break;
case 'extensions.treestyletab.tabbar.fixed.horizontal':
if (!this.isVertical) {
if (value) {
b.setAttribute(this.kFIXED, true);
b.mStrip.removeAttribute('height'); b.mStrip.removeAttribute('height');
b.mPanelContainer.removeAttribute('height'); b.mPanelContainer.removeAttribute('height');
} }
} else {
else { b.removeAttribute(this.kFIXED);
b.removeAttribute(this.kFIXED);
if (!this.isVertical) {
b.mStrip.setAttribute('height', this.getTreePref('tabbar.height')); b.mStrip.setAttribute('height', this.getTreePref('tabbar.height'));
} }
} }
@ -2115,8 +2135,8 @@ TreeStyleTabBrowser.prototype = {
aEvent.currentTarget, aEvent.currentTarget,
XPathResult.FIRST_ORDERED_NODE_TYPE XPathResult.FIRST_ORDERED_NODE_TYPE
).singleNodeValue; ).singleNodeValue;
var collapseItem = items[this.kMENUITEM_COLLAPSE]; let collapseItem = items[this.kMENUITEM_COLLAPSE];
var expanndItem = items[this.kMENUITEM_EXPAND]; let expanndItem = items[this.kMENUITEM_EXPAND];
if (this.evaluateXPath( if (this.evaluateXPath(
'child::xul:tab[@'+this.kCHILDREN+']', 'child::xul:tab[@'+this.kCHILDREN+']',
b.mTabContainer b.mTabContainer
@ -2150,26 +2170,33 @@ TreeStyleTabBrowser.prototype = {
} }
// auto hide // auto hide
var autohide = items[this.kMENUITEM_AUTOHIDE]; let autohide = items[this.kMENUITEM_AUTOHIDE];
if (this.autoHideMode != this.kAUTOHIDE_MODE_DISABLED) if (this.autoHideMode != this.kAUTOHIDE_MODE_DISABLED)
autohide.setAttribute('checked', true); autohide.setAttribute('checked', true);
else else
autohide.removeAttribute('checked'); autohide.removeAttribute('checked');
// fix // fix
var fixed = items[this.kMENUITEM_FIXED]; let fixedPref;
if (this.getTreePref('tabbar.fixed')) let fixedLabel;
if (this.isVertical) {
fixedPref = 'tabbar.fixed.vertical';
fixedLabel = 'label-vertical';
}
else {
fixedPref = 'tabbar.fixed.horizontal';
fixedLabel = 'label-horizontal';
}
let fixed = items[this.kMENUITEM_FIXED];
fixed.setAttribute('label', fixed.getAttribute(fixedLabel));
if (this.getTreePref(fixedPref))
fixed.setAttribute('checked', true); fixed.setAttribute('checked', true);
else else
fixed.removeAttribute('checked'); fixed.removeAttribute('checked');
if (this.isVertical)
fixed.setAttribute('label', fixed.getAttribute('label-vertical'));
else
fixed.setAttribute('label', fixed.getAttribute('label-horizontal'));
// position // position
var position = items[this.kMENUITEM_POSITION]; let position = items[this.kMENUITEM_POSITION];
var pos = b.getAttribute(this.kTABBAR_POSITION); let pos = b.getAttribute(this.kTABBAR_POSITION);
position.getElementsByAttribute('value', pos)[0].setAttribute('checked', true); position.getElementsByAttribute('value', pos)[0].setAttribute('checked', true);
sep = this.evaluateXPath( sep = this.evaluateXPath(
@ -3960,7 +3987,11 @@ TreeStyleTabBrowser.prototype = {
}, },
get splitterBorderColor() get splitterBorderColor()
{ {
var borderNode = this.getTreePref('tabbar.fixed') ? var borderNode = this.getTreePref(
this.isVertical ?
'tabbar.fixed.vertical' :
'tabbar.fixed.horizontal'
) ?
this.mTabBrowser.mStrip : this.mTabBrowser.mStrip :
document.getAnonymousElementByAttribute(this.mTabBrowser, 'class', this.kSPLITTER) ; document.getAnonymousElementByAttribute(this.mTabBrowser, 'class', this.kSPLITTER) ;

View File

@ -36,7 +36,8 @@ pref("extensions.treestyletab.tabbar.autoShow.feedback", false);
pref("extensions.treestyletab.tabbar.autoShow.feedback.delay", 3000); pref("extensions.treestyletab.tabbar.autoShow.feedback.delay", 3000);
pref("extensions.treestyletab.tabbar.autoShow.keepShownOnMouseover", true); pref("extensions.treestyletab.tabbar.autoShow.keepShownOnMouseover", true);
pref("extensions.treestyletab.tabbar.togglerSize", 5); pref("extensions.treestyletab.tabbar.togglerSize", 5);
pref("extensions.treestyletab.tabbar.fixed", false); pref("extensions.treestyletab.tabbar.fixed.horizontal", true);
pref("extensions.treestyletab.tabbar.fixed.vertical", false);
pref("extensions.treestyletab.tabbar.syncRelatedPrefsForDynamicPosition", true); pref("extensions.treestyletab.tabbar.syncRelatedPrefsForDynamicPosition", true);
pref("extensions.treestyletab.enableSubtreeIndent", true); pref("extensions.treestyletab.enableSubtreeIndent", true);
pref("extensions.treestyletab.enableSubtreeIndent.allTabsPopup", true); pref("extensions.treestyletab.enableSubtreeIndent.allTabsPopup", true);