ColorfulTabsを導入している場合、子供のタブは親のタブの色を継承するようにした

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@1951 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2008-02-28 07:45:39 +00:00
parent ccf7687592
commit f88984a12e
3 changed files with 39 additions and 4 deletions

View File

@ -495,4 +495,20 @@ TreeStyleTabService.overrideExtensionsOnInitAfter = function() {
);
}
// ColorfulTab
if ('clrtabsInit' in window) {
this.registerAttachTabPostProcess(function(aChild, aParent, aService) {
if (aChild && aParent) {
setColor(aChild, aService.SessionStore.getTabValue(aParent, 'tabClr'));
}
else if (aChild) {
aService.SessionStore.setTabValue(aChild, 'tabClr', '')
calcTabClr({
target : aChild,
originalTarget : aChild,
});
}
});
}
};

View File

@ -1439,6 +1439,12 @@ catch(e) {
);
},
registerAttachTabPostProcess : function(aProcess)
{
this._attachTabPostProcesses.push(aProcess);
},
_attachTabPostProcesses : [],
/* Pref Listener */
domain : 'extensions.treestyletab',

View File

@ -1992,8 +1992,10 @@ TreeStyleTabBrowser.prototype = {
!aParent ||
aChild == aParent ||
this.getParentTab(aChild) == aParent
)
) {
this.attachTabPostProcess(aChild, aParent);
return;
}
if (!aInfo) aInfo = {};
@ -2072,6 +2074,15 @@ TreeStyleTabBrowser.prototype = {
this.updateTabsIndent([aChild]);
this.checkTabsIndentOverflow();
}
this.attachTabPostProcess(aChild, aParent);
},
attachTabPostProcess : function(aChild, aParent)
{
var self = this;
this._attachTabPostProcesses.forEach(function(aProcess) {
aProcess(aChild, aParent, self);
});
},
partTab : function(aChild, aDontUpdateIndent)
@ -2093,6 +2104,8 @@ TreeStyleTabBrowser.prototype = {
this.updateTabsIndent([aChild]);
this.checkTabsIndentOverflow();
}
this.attachTabPostProcess(aChild, null);
},
updateTabsIndent : function(aTabs, aLevel, aProp)