印刷プレビューでタブバーのプレースホルダーが残ってしまっていた

git-svn-id: http://www.cozmixng.org/repos/piro/treestyletab/trunk@6502 599a83e7-65a4-db11-8015-0010dcdd6dc2
This commit is contained in:
piro 2010-03-28 18:22:15 +00:00
parent 042bf2e5e3
commit 1c3c4912a7
8 changed files with 108 additions and 52 deletions

View File

@ -25,7 +25,10 @@
.tabbrowser-strip[treestyletab-tabbar-autohide="hidden"]+splitter,
tabbrowser:not([treestyletab-tabbar-autohide="hidden"]) .treestyletab-tabbar-toggler,
#appcontent[ahFull="true"] .tabbrowser-strip[ahHIDE="true"]+splitter /* AutoHide */,
.tabbrowser-strip[treestyletab-tabbar-fixed="true"]+splitter {
.tabbrowser-strip[treestyletab-tabbar-fixed="true"]+splitter,
.tabbrowser-strip[treestyletab-print-preview="true"],
.tabbrowser-strip[treestyletab-print-preview="true"]+splitter,
#TabsToolbar[treestyletab-print-preview="true"] {
visibility: collapse;
}

View File

@ -685,8 +685,8 @@ catch(e) {
onTabDrop : function TSTService_onTabDrop(aEvent)
{
var b = this.getTabBrowserFromChild(aEvent.currentTarget);
var tabbar = b.mTabContainer;
var b = this.getTabBrowserFromChild(aEvent.currentTarget);
var tabbar = b.mTabContainer;
var sv = b.treeStyleTab;
var dt = aEvent.dataTransfer;
@ -721,7 +721,7 @@ catch(e) {
window.setTimeout(function() {
var newTabs = Array.slice(b.mTabContainer.childNodes).filter(function(aTab) {
return beforeTabs.indexOf(aTab) < 0;
});
});
if (newTabs.length)
sv.attachTabTo(newTabs[0], dropActionInfo.target);
}, 0);
@ -780,8 +780,8 @@ catch(e) {
onTabDragEnd : function TSTService_onTabDragEnd(aEvent)
{
var b = this.getTabBrowserFromChild(aEvent.currentTarget);
var tabbar = b.mTabContainer;
var b = this.getTabBrowserFromChild(aEvent.currentTarget);
var tabbar = b.mTabContainer;
var sv = b.treeStyleTab;
var dt = aEvent.dataTransfer;
@ -1121,6 +1121,17 @@ catch(e) {
)
);
}
if ('PrintUtils' in window) {
eval('PrintUtils.printPreview = '+PrintUtils.printPreview.toSource().replace(
'{',
'{ TreeStyleTabService.onPrintPreviewEnter();'
));
eval('PrintUtils.exitPrintPreview = '+PrintUtils.exitPrintPreview.toSource().replace(
/(\}\)?)$/,
'TreeStyleTabService.onPrintPreviewExit(); $1'
));
}
},
_splitFunctionNames : function TSTService__splitFunctionNames(aString)
{
@ -1844,6 +1855,20 @@ catch(e) {
return false;
},
tearOffSubTreeFromRemote : function() { return this.tearOffSubtreeFromRemote.apply(this, arguments); }, // obsolete, for backward compatibility
onPrintPreviewEnter : function TSTService_onPrintPreviewEnter()
{
var event = document.createEvent('Events');
event.initEvent('TreeStyleTabPrintPreviewEntered', true, false);
document.documentElement.dispatchEvent(event);
},
onPrintPreviewExit : function TSTService_onPrintPreviewExit()
{
var event = document.createEvent('Events');
event.initEvent('TreeStyleTabPrintPreviewExited', true, false);
document.documentElement.dispatchEvent(event);
},
observe : function TSTService_observe(aSubject, aTopic, aData)
{

View File

@ -85,7 +85,7 @@ TreeStyleTabBrowser.prototype = {
{
return this._tabStripPlaceHolder;
},
set tabStripPlaceHolder(value)
set tabStripPlaceHolder(value)
{
return (this._tabStripPlaceHolder = value);
},
@ -234,6 +234,9 @@ TreeStyleTabBrowser.prototype = {
if (this.isFloating)
window.addEventListener('resize', this, true);
window.addEventListener('TreeStyleTabPrintPreviewEntered', this, false);
window.addEventListener('TreeStyleTabPrintPreviewExited', this, false);
b.addEventListener('MultipleTabHandlerTabsClosing', this, false);
@ -894,7 +897,7 @@ TreeStyleTabBrowser.prototype = {
document.getAnonymousElementByAttribute(b.mTabContainer, 'anonid', 'alltabs-button')
);
this.setTabbrowserAttribute(this.kRESIZING, null, b);
this.removeTabbrowserAttribute(this.kRESIZING, b);
this.removeTabStripAttribute('width');
b.mPanelContainer.removeAttribute('width');
@ -935,20 +938,20 @@ TreeStyleTabBrowser.prototype = {
if (toolboxContainer)
toolboxContainer.orient = 'vertical';
this.setTabbrowserAttribute(this.kMODE, 'vertical', b);
this.setTabbrowserAttribute(this.kMODE, 'vertical');
this.setTabStripAttribute('width', this.getTreePref('tabbar.width'));
this.removeTabStripAttribute('height');
b.mPanelContainer.removeAttribute('height');
if (pos == this.kTABBAR_RIGHT) {
this.setTabbrowserAttribute(this.kTABBAR_POSITION, 'right', b);
this.setTabbrowserAttribute(this.kTABBAR_POSITION, 'right');
if (this.getTreePref('tabbar.invertTab')) {
this.setTabbrowserAttribute(this.kTAB_INVERTED, 'true', b);
this.setTabbrowserAttribute(this.kTAB_INVERTED, 'true');
this.indentTarget = 'right';
}
else {
this.setTabbrowserAttribute(this.kTAB_INVERTED, null, b);
this.removeTabbrowserAttribute(this.kTAB_INVERTED);
this.indentTarget = 'left';
}
delayedPostProcess = function(aSelf, aTabBrowser, aSplitter, aToggler) {
@ -965,8 +968,8 @@ TreeStyleTabBrowser.prototype = {
};
}
else {
this.setTabbrowserAttribute(this.kTABBAR_POSITION, 'left', b);
this.setTabbrowserAttribute(this.kTAB_INVERTED, null, b);
this.setTabbrowserAttribute(this.kTABBAR_POSITION, 'left');
this.removeTabbrowserAttribute(this.kTAB_INVERTED);
this.indentTarget = 'left';
delayedPostProcess = function(aSelf, aTabBrowser, aSplitter, aToggler) {
indicator.setAttribute('ordinal', 1);
@ -1009,11 +1012,11 @@ TreeStyleTabBrowser.prototype = {
if (toolboxContainer)
toolboxContainer.orient = 'horizontal';
this.setTabbrowserAttribute(this.kMODE, this.getTreePref('tabbar.multirow') ? 'multirow' : 'horizontal' , b);
this.setTabbrowserAttribute(this.kTAB_INVERTED, null, b);
this.setTabbrowserAttribute(this.kMODE, this.getTreePref('tabbar.multirow') ? 'multirow' : 'horizontal');
this.removeTabbrowserAttribute(this.kTAB_INVERTED);
if (pos == this.kTABBAR_BOTTOM) {
this.setTabbrowserAttribute(this.kTABBAR_POSITION, 'bottom', b);
this.setTabbrowserAttribute(this.kTABBAR_POSITION, 'bottom');
this.indentTarget = 'bottom';
delayedPostProcess = function(aSelf, aTabBrowser, aSplitter, aToggler) {
indicator.setAttribute('ordinal', 1);
@ -1024,7 +1027,7 @@ TreeStyleTabBrowser.prototype = {
};
}
else {
this.setTabbrowserAttribute(this.kTABBAR_POSITION, 'top', b);
this.setTabbrowserAttribute(this.kTABBAR_POSITION, 'top');
this.indentTarget = 'top';
delayedPostProcess = function(aSelf, aTabBrowser, aSplitter, aToggler) {
indicator.setAttribute('ordinal', 1);
@ -1111,19 +1114,19 @@ TreeStyleTabBrowser.prototype = {
var orient;
if (this.isVertical) {
orient = 'vertical';
this.setTabbrowserAttribute(this.kFIXED, this.getTreePref('tabbar.fixed.vertical') ? 'true' : null , b);
this.setTabbrowserAttribute(this.kFIXED, this.getTreePref('tabbar.fixed.vertical') ? 'true' : null);
}
else {
orient = 'horizontal';
if (this.getTreePref('tabbar.fixed.horizontal')) {
this.setTabbrowserAttribute(this.kFIXED, true, b);
this.setTabbrowserAttribute(this.kFIXED, true);
if (!this.isMultiRow()) {
this.removeTabStripAttribute('height');
b.mPanelContainer.removeAttribute('height');
}
}
else {
this.setTabbrowserAttribute(this.kFIXED, null, b);
this.removeTabbrowserAttribute(this.kFIXED, b);
this.setTabStripAttribute('height', this.getTreePref('tabbar.height'));
}
}
@ -1133,9 +1136,9 @@ TreeStyleTabBrowser.prototype = {
aSelf.startRendering();
}, 0, this);
this.setTabbrowserAttribute(this.kINDENTED, this.getTreePref('enableSubtreeIndent.'+orient) ? 'true' : null , b);
this.setTabbrowserAttribute(this.kALLOW_COLLAPSE, this.getTreePref('allowSubtreeCollapseExpand.'+orient) ? 'true' : null , b);
this.setTabbrowserAttribute(this.kHIDE_ALLTABS, this.getTreePref('tabbar.hideAlltabsButton.'+orient) ? 'true' : null , b);
this.setTabbrowserAttribute(this.kINDENTED, this.getTreePref('enableSubtreeIndent.'+orient) ? 'true' : null);
this.setTabbrowserAttribute(this.kALLOW_COLLAPSE, this.getTreePref('allowSubtreeCollapseExpand.'+orient) ? 'true' : null);
this.setTabbrowserAttribute(this.kHIDE_ALLTABS, this.getTreePref('tabbar.hideAlltabsButton.'+orient) ? 'true' : null);
this.updateAllTabsIndent();
},
@ -1292,6 +1295,9 @@ TreeStyleTabBrowser.prototype = {
if (this.isFloating)
window.removeEventListener('resize', this, true);
window.removeEventListener('TreeStyleTabPrintPreviewEntered', this, false);
window.removeEventListener('TreeStyleTabPrintPreviewExited', this, false);
b.removeEventListener('MultipleTabHandlerTabsClosing', this, false);
TreeStyleTabService.destroyTabDNDObserver(b);
@ -1407,14 +1413,14 @@ TreeStyleTabBrowser.prototype = {
}, this);
break;
case 'extensions.treestyletab.tabbar.invertTabContents':
this.setTabbrowserAttribute(this.kTAB_CONTENTS_INVERTED, value , b);
this.setTabbrowserAttribute(this.kTAB_CONTENTS_INVERTED, value);
tabs.forEach(function(aTab) {
this.initTabContents(aTab);
}, this);
break;
case 'extensions.treestyletab.tabbar.invertClosebox':
this.setTabbrowserAttribute(this.kCLOSEBOX_INVERTED, value , b);
this.setTabbrowserAttribute(this.kCLOSEBOX_INVERTED, value);
tabs.forEach(function(aTab) {
this.initTabContents(aTab);
}, this);
@ -1424,10 +1430,10 @@ TreeStyleTabBrowser.prototype = {
if (value) {
if (/^(default|vertigo|mixed)$/.test(value))
value = 'square '+value;
this.setTabbrowserAttribute(this.kSTYLE, value , b);
this.setTabbrowserAttribute(this.kSTYLE, value);
}
else {
this.setTabbrowserAttribute(this.kSTYLE, null , b);
this.removeTabbrowserAttribute(this.kSTYLE);
}
value = this.getTreePref('twisty.style');
if (value != 'auto') {
@ -1449,11 +1455,11 @@ TreeStyleTabBrowser.prototype = {
value = 'modern-black';
}
}
this.setTabbrowserAttribute(this.kTWISTY_STYLE, value, b);
this.setTabbrowserAttribute(this.kTWISTY_STYLE, value);
break;
case 'extensions.treestyletab.showBorderForFirstTab':
this.setTabbrowserAttribute(this.kFIRSTTAB_BORDER, value , b);
this.setTabbrowserAttribute(this.kFIRSTTAB_BORDER, value);
break;
case 'extensions.treestyletab.enableSubtreeIndent.horizontal':
@ -1587,6 +1593,12 @@ TreeStyleTabBrowser.prototype = {
return this.onResize(aEvent);
case 'TreeStyleTabPrintPreviewEntered':
return this.onTreeStyleTabPrintPreviewEntered(aEvent);
case 'TreeStyleTabPrintPreviewExited':
return this.onTreeStyleTabPrintPreviewExited(aEvent);
case 'MultipleTabHandlerTabsClosing':
if (!this.onTabsRemoving(aEvent))
aEvent.preventDefault();
@ -2785,7 +2797,17 @@ TreeStyleTabBrowser.prototype = {
items[i].style.paddingLeft = tabs[i].getAttribute(this.kNEST)+'em';
}
},
onTreeStyleTabPrintPreviewEntered : function TSTBrowser_onTreeStyleTabPrintPreviewEntered(aEvent)
{
this.setTabbrowserAttribute(this.kPRINT_PREVIEW, true);
},
onTreeStyleTabPrintPreviewExited : function TSTBrowser_onTreeStyleTabPrintPreviewExited(aEvent)
{
this.removeTabbrowserAttribute(this.kPRINT_PREVIEW);
},
/* drag and drop */
get tabbarDNDObserver()
@ -3308,11 +3330,11 @@ TreeStyleTabBrowser.prototype = {
if (this._treeViewEnabled) {
let orient = this.isVertical ? 'vertical' : 'horizontal' ;
if (this.getTreePref('allowSubtreeCollapseExpand.'+orient))
this.setTabbrowserAttribute(this.kALLOW_COLLAPSE, true , this.browser);
this.setTabbrowserAttribute(this.kALLOW_COLLAPSE, true);
this.updateTabsIndent(this.rootTabs, undefined, undefined, true);
}
else {
this.setTabbrowserAttribute(this.kALLOW_COLLAPSE, null , this.browser);
this.removeTabbrowserAttribute(this.kALLOW_COLLAPSE);
this.getTabsArray(this.browser).forEach(function(aTab) {
this.updateTabIndent(aTab, 0, this.indentTarget, true);
}, this);

View File

@ -149,9 +149,9 @@ TreeStyleTabBrowserAutoHide.prototype = {
this.updateTransparency();
sv.container.style.margin = 0;
sv.setTabbrowserAttribute(this.kAUTOHIDE, null, sv.mTabBrowser);
sv.setTabbrowserAttribute(this.kSTATE, null, sv.mTabBrowser);
sv.setTabbrowserAttribute(this.kTRANSPARENT, null, sv.mTabBrowser);
sv.removeTabbrowserAttribute(this.kAUTOHIDE);
sv.removeTabbrowserAttribute(this.kSTATE);
sv.removeTabbrowserAttribute(this.kTRANSPARENT);
},
// fullscreen
@ -166,7 +166,7 @@ TreeStyleTabBrowserAutoHide.prototype = {
if (this.mode != this.kMODE_DISABLED) {
this.start();
var sv = this.mOwner;
sv.setTabbrowserAttribute('moz-collapsed', null, sv.mTabBrowser);
sv.removeTabbrowserAttribute('moz-collapsed');
}
},
@ -434,7 +434,7 @@ TreeStyleTabBrowserAutoHide.prototype = {
window.setTimeout(function(aSelf) {
if (aSelf.expanded) {
sv.setTabbrowserAttribute(aSelf.kAUTOHIDE, 'show', sv.mTabBrowser);
sv.setTabbrowserAttribute(aSelf.kAUTOHIDE, 'show');
aSelf.redrawContentArea();
}
b.mTabContainer.adjustTabstrip();
@ -481,7 +481,7 @@ TreeStyleTabBrowserAutoHide.prototype = {
break;
}
sv.setTabbrowserAttribute(this.kSTATE, this.kSTATE_EXPANDED, b);
sv.setTabbrowserAttribute(this.kSTATE, this.kSTATE_EXPANDED);
switch (this.mode)
{
@ -513,14 +513,14 @@ TreeStyleTabBrowserAutoHide.prototype = {
switch (this.mode)
{
case this.kMODE_HIDE:
sv.setTabbrowserAttribute(this.kAUTOHIDE, 'hidden', b);
sv.setTabbrowserAttribute(this.kSTATE, this.kSTATE_HIDDEN, b);
sv.setTabbrowserAttribute(this.kAUTOHIDE, 'hidden');
sv.setTabbrowserAttribute(this.kSTATE, this.kSTATE_HIDDEN);
break;
default:
case this.kMODE_SHRINK:
sv.setTabbrowserAttribute(this.kAUTOHIDE, 'show', b);
sv.setTabbrowserAttribute(this.kSTATE, this.kSTATE_SHRUNKEN, b);
sv.setTabbrowserAttribute(this.kAUTOHIDE, 'show');
sv.setTabbrowserAttribute(this.kSTATE, this.kSTATE_SHRUNKEN);
if (pos == 'left' || pos == 'right') {
sv.setTabStripAttribute('width', this.getTreePref('tabbar.shrunkenWidth'));
sv.updateFloatingTabbar();
@ -766,10 +766,10 @@ TreeStyleTabBrowserAutoHide.prototype = {
if (pos != 'top' &&
this.mode != this.kMODE_DISABLED &&
style != this.kTRANSPARENT_STYLE[this.kTRANSPARENT_NONE]) {
sv.setTabbrowserAttribute(this.kTRANSPARENT, style, b);
sv.setTabbrowserAttribute(this.kTRANSPARENT, style);
}
else {
sv.setTabbrowserAttribute(this.kTRANSPARENT, null, b);
sv.removeTabbrowserAttribute(this.kTRANSPARENT);
}
},
@ -942,7 +942,7 @@ TreeStyleTabBrowserAutoHide.prototype = {
) {
this.isResizing = true;
this.clearBG();
sv.setTabbrowserAttribute(sv.kRESIZING, true, sv.mTabBrowser);
sv.setTabbrowserAttribute(sv.kRESIZING, true);
/* canvas
まだ内部的にcanvasの大きさが残ったままなのでその大きさ以下に
タブバーの幅を縮められなくなる手動でイベントを再送してやると
@ -986,7 +986,7 @@ TreeStyleTabBrowserAutoHide.prototype = {
XPathResult.BOOLEAN_TYPE
).booleanValue) {
this.isResizing = false;
sv.setTabbrowserAttribute(sv.kRESIZING, null, sv.mTabBrowser);
sv.removeTabbrowserAttribute(sv.kRESIZING);
window.setTimeout(function(aSelf) {
if (!aSelf.shouldRedraw) return;
aSelf.redrawContentArea();

View File

@ -147,7 +147,7 @@ TreeStyleTabBrowserTabbarDNDObserver.prototype = {
{
window.setTimeout(function(aSelf) {
aSelf.readyToEndDrag();
aSelf.mOwner.setTabbrowserAttribute(aSelf.mOwner.kDROP_POSITION, null, aSelf.mOwner.mTabBrowser);
aSelf.mOwner.removeTabbrowserAttribute(aSelf.mOwner.kDROP_POSITION);
}, 10, this);
aEvent.stopPropagation();
},

View File

@ -10,7 +10,7 @@ TreeStyleTabBrowserTabpanelDNDObserver.prototype = {
if (!this.canDrop(aEvent, aDragSession)) return;
var sv = this.mOwner;
if (sv.mTabBrowser.hasAttribute(sv.kDROP_POSITION))
sv.setTabbrowserAttribute(sv.kDROP_POSITION, sv.kDROP_POSITION_UNKNOWN, sv.mTabBrowser);
sv.setTabbrowserAttribute(sv.kDROP_POSITION, sv.kDROP_POSITION_UNKNOWN);
},
onDragOver : function TSTTabpanelDND_onDragOver(aEvent, aFlavour, aDragSession)
@ -20,7 +20,7 @@ TreeStyleTabBrowserTabpanelDNDObserver.prototype = {
var position = this.getDropPosition(aEvent);
if (position != 'center' &&
position != sv.mTabBrowser.getAttribute(sv.kTABBAR_POSITION))
sv.setTabbrowserAttribute(sv.kDROP_POSITION, position, sv.mTabBrowser);
sv.setTabbrowserAttribute(sv.kDROP_POSITION, position);
},
onDrop : function TSTTabpanelDND_onDrop(aEvent, aXferData, aDragSession)

View File

@ -5,7 +5,7 @@
<RDF:Description RDF:about="urn:mozilla:install-manifest"
em:id="treestyletab@piro.sakura.ne.jp"
em:name="Tree Style Tab"
em:version="0.10.2010032802"
em:version="0.10.2010032901"
em:creator="SHIMODA Hiroshi"
em:description="Show tabs like a tree."
em:homepageURL="http://piro.sakura.ne.jp/xul/_treestyletab.html.en"

View File

@ -84,6 +84,7 @@ var TreeStyleTabUtils = {
kFIXED : 'treestyletab-tabbar-fixed',
kRESIZING : 'treestyletab-tabbar-resizing',
kINDENTED : 'treestyletab-tabs-indented',
kPRINT_PREVIEW : 'treestyletab-print-preview',
kTAB_INVERTED : 'treestyletab-tab-inverted',
kTAB_CONTENTS_INVERTED : 'treestyletab-tab-contents-inverted',
@ -677,7 +678,7 @@ var TreeStyleTabUtils = {
setTabbrowserAttribute : function TSTUtils_setTabbrowserAttribute(aName, aValue, aTabBrowser)
{
aTabBrowser = aTabBrowser || this.browser;
aTabBrowser = aTabBrowser || this.mTabBrowser || this.browser;
if (aValue) {
aTabBrowser.setAttribute(aName, aValue);
aTabBrowser.mTabContainer.setAttribute(aName, aValue);
@ -690,6 +691,11 @@ var TreeStyleTabUtils = {
}
},
removeTabbrowserAttribute : function TSTUtils_removeTabbrowserAttribute(aName, aTabBrowser)
{
this.setTabbrowserAttribute(aName, null, aTabBrowser);
},
getTabFromChild : function TSTUtils_getTabFromChild(aTab)
{
return this.evaluateXPath(