Tab Mix Plusでタブバーを複数行表示している時はインデントの方法を変えるようにした

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1816 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2008-02-22 07:44:06 +00:00
parent 3bc824a0cb
commit 2ae7043475
2 changed files with 31 additions and 8 deletions

View File

@ -393,6 +393,10 @@ TreeStyleTabService.overrideExtensionsAfterInit = function() {
'tabBarScrollStatus(); $&' 'tabBarScrollStatus(); $&'
) )
); );
TreeStyleTabBrowser.prototype.isMultiRow = function()
{
return window.tabscroll == 2;
};
window.setTimeout(function() { window.setTimeout(function() {
// correct broken appearance of the first tab // correct broken appearance of the first tab

View File

@ -39,9 +39,9 @@ TreeStyleTabBrowser.prototype = {
_container : null, _container : null,
/* utils */ /* utils */
/* get tab contents */
/* get tab contents */
getTabLabel : function(aTab) getTabLabel : function(aTab)
{ {
var label = document.getAnonymousElementByAttribute(aTab, 'class', 'tab-text-container') || // Tab Mix Plus var label = document.getAnonymousElementByAttribute(aTab, 'class', 'tab-text-container') || // Tab Mix Plus
@ -57,7 +57,7 @@ TreeStyleTabBrowser.prototype = {
}, },
/* status */ /* status */
get isVertical() get isVertical()
{ {
var b = this.mTabBrowser; var b = this.mTabBrowser;
@ -76,7 +76,12 @@ TreeStyleTabBrowser.prototype = {
tabBox.screenY >= barBox.screenY && tabBox.screenY >= barBox.screenY &&
tabBox.screenY + tabBox.height <= barBox.screenY + barBox.height); tabBox.screenY + tabBox.height <= barBox.screenY + barBox.height);
}, },
isMultiRow : function()
{
return false;
},
/* initialize */ /* initialize */
init : function() init : function()
@ -693,7 +698,7 @@ TreeStyleTabBrowser.prototype = {
}, },
/* nsIObserver */ /* nsIObserver */
domain : 'extensions.treestyletab', domain : 'extensions.treestyletab',
observe : function(aSubject, aTopic, aData) observe : function(aSubject, aTopic, aData)
@ -1471,14 +1476,14 @@ TreeStyleTabBrowser.prototype = {
}, },
/* drag and drop */ /* drag and drop */
isPlatformNotSupported : navigator.platform.indexOf('Mac') != -1, // see bug 136524 isPlatformNotSupported : navigator.platform.indexOf('Mac') != -1, // see bug 136524
isTimerSupported : navigator.platform.indexOf('Win') == -1, // see bug 232795. isTimerSupported : navigator.platform.indexOf('Win') == -1, // see bug 232795.
autoExpandTimer : null, autoExpandTimer : null,
autoExpandTarget : null, autoExpandTarget : null,
autoExpandedTabs : [], autoExpandedTabs : [],
onDragEnter : function(aEvent, aDragSession) onDragEnter : function(aEvent, aDragSession)
{ {
var tab = aEvent.target; var tab = aEvent.target;
if (tab.localName != 'tab' || if (tab.localName != 'tab' ||
@ -1905,9 +1910,23 @@ TreeStyleTabBrowser.prototype = {
var margin = this.levelMargin < 0 ? this.baseLebelMargin : this.levelMargin ; var margin = this.levelMargin < 0 ? this.baseLebelMargin : this.levelMargin ;
var indent = margin * aLevel; var indent = margin * aLevel;
var multirow = this.isMultiRow();
var topBottom = this.levelMarginProp.match(/top|bottom/);
var innerBoxes, j;
for (var i = 0, maxi = aTabs.length; i < maxi; i++) for (var i = 0, maxi = aTabs.length; i < maxi; i++)
{ {
aTabs[i].setAttribute('style', aTabs[i].getAttribute('style').replace(/margin(-[^:]+):[^;]+;?/g, '')+'; '+aProp+':'+indent+'px !important;'); if (multirow) {
innerBoxes = document.getAnonymousNodes(aTabs[i]);
for (j = 0, maxj = innerBoxes.length; j < maxj; j++)
{
if (innerBoxes[j].nodeType != Node.ELEMENT_NODE) continue;
innerBoxes[j].setAttribute('style', innerBoxes[j].getAttribute('style').replace(/border-(top|bottom).*:[^;]+;?/g, '')+'; border-'+topBottom+': solid transparent '+(aLevel * 4)+'px !important;');
}
}
else {
aTabs[i].setAttribute('style', aTabs[i].getAttribute('style').replace(/margin(-[^:]+):[^;]+;?/g, '')+'; '+aProp+':'+indent+'px !important;');
}
aTabs[i].setAttribute(this.kNEST, aLevel); aTabs[i].setAttribute(this.kNEST, aLevel);
this.updateTabsIndent(this.getChildTabs(aTabs[i]), aLevel+1, aProp); this.updateTabsIndent(this.getChildTabs(aTabs[i]), aLevel+1, aProp);
} }