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

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

View File

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

View File

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