bug 224160: hook up Print Preview to view source.

This commit is contained in:
chanial%noos.fr 2003-10-30 06:02:54 +00:00
Родитель 2ad0cefe4f
Коммит 4a76aee800
7 изменённых файлов: 38 добавлений и 7 удалений

Просмотреть файл

@ -39,6 +39,8 @@
#
# ***** END LICENSE BLOCK ***** */
var XUL_NS = "http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul";
var PrintUtils = {
showPageSetup: function ()
@ -213,8 +215,10 @@ var PrintUtils = {
getBrowser().parentNode.insertBefore(printPreviewTB, getBrowser());
// Tab browser...
this._chromeState.hadTabStrip = getBrowser().getStripVisibility();
getBrowser().setStripVisibilityTo(false);
if ("getStripVisibility" in getBrowser()) {
this._chromeState.hadTabStrip = getBrowser().getStripVisibility();
getBrowser().setStripVisibilityTo(false);
}
// disable chrome shortcuts...
window.addEventListener("keypress", this.onKeyPressPP, true);
@ -230,7 +234,8 @@ var PrintUtils = {
{
window.removeEventListener("keypress", this.onKeyPressPP, true);
getBrowser().setStripVisibilityTo(this._chromeState.hadTabStrip);
if ("getStripVisibility" in getBrowser())
getBrowser().setStripVisibilityTo(this._chromeState.hadTabStrip);
var webBrowserPrint = this.getWebBrowserPrint();
webBrowserPrint.exitPrintPreview();

Просмотреть файл

@ -40,6 +40,7 @@
#***** END LICENSE BLOCK ***** -->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://global/content/viewSource.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
<?xul-overlay href="chrome://global/content/charsetOverlay.xul"?>
@ -73,6 +74,7 @@
<command id="cmd_savePage" disabled="true" oncommand="ViewSourceSavePage();"/>
<command id="cmd_print" oncommand="PrintUtils.print();"/>
<command id="cmd_printpreview" oncommand="PrintUtils.printPreview(onEnterPP, onExitPP);"/>
<command id="cmd_pagesetup" oncommand="PrintUtils.showPageSetup();"/>
<command id="cmd_close" oncommand="window.close();"/>
<commandset id="editMenuCommands"/>
@ -106,6 +108,8 @@
label="&savePageCmd.label;" accesskey="&savePageCmd.accesskey;"/>
<menuitem command="cmd_pagesetup"
label="&pageSetupCmd.label;" accesskey="&pageSetupCmd.accesskey;"/>
<menuitem command="cmd_printpreview"
label="&printPreviewCmd.label;" accesskey="&printPreviewCmd.accesskey;"/>
<menuitem key="key_print" command="cmd_print"
label="&printCmd.label;" accesskey="&printCmd.accesskey;"/>
<menuseparator/>

Просмотреть файл

@ -0,0 +1,3 @@
toolbar[printpreview="true"] {
-moz-binding: url("chrome://global/content/printPreviewBindings.xml#printpreviewtoolbar");
}

Просмотреть файл

@ -233,6 +233,18 @@ function ViewSourceSavePage()
saveURL(window.content.location.href.substring(12), null, "SaveLinkTitle");
}
function onEnterPP()
{
var toolbox = document.getElementById("viewSource-toolbox");
toolbox.hidden = true;
}
function onExitPP()
{
var toolbox = document.getElementById("viewSource-toolbox");
toolbox.hidden = false;
}
function ViewSourceGoToLine()
{
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]

Просмотреть файл

@ -40,6 +40,7 @@
#***** END LICENSE BLOCK ***** -->
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
<?xml-stylesheet href="chrome://global/content/viewSource.css" type="text/css"?>
<?xul-overlay href="chrome://global/content/editMenuOverlay.xul"?>
<?xul-overlay href="chrome://global/content/charsetOverlay.xul"?>
@ -71,9 +72,10 @@
<stringbundle id="findBundle" src="chrome://global/locale/finddialog.properties"/>
<stringbundle id="viewSourceBundle" src="chrome://global/locale/viewSource.properties"/>
<command id="cmd_print" oncommand="PrintUtils.print();"/>
<command id="cmd_pagesetup" oncommand="PrintUtils.showPageSetup();"/>
<command id="cmd_savePage" disabled="true" oncommand="ViewSourceSavePage();"/>
<command id="cmd_print" oncommand="PrintUtils.print();"/>
<command id="cmd_printpreview" oncommand="PrintUtils.printPreview(onEnterPP, onExitPP);"/>
<command id="cmd_pagesetup" oncommand="PrintUtils.showPageSetup();"/>
<command id="cmd_close" oncommand="window.close();"/>
<commandset id="editMenuCommands"/>
<command id="cmd_goToLine" oncommand="ViewSourceGoToLine();" disabled="true"/>
@ -107,6 +109,8 @@
label="&savePageCmd.label;" accesskey="&savePageCmd.accesskey;"/>
<menuitem command="cmd_pagesetup"
label="&pageSetupCmd.label;" accesskey="&pageSetupCmd.accesskey;"/>
<menuitem command="cmd_printpreview"
label="&printPreviewCmd.label;" accesskey="&printPreviewCmd.accesskey;"/>
<menuitem key="key_print" command="cmd_print"
label="&printCmd.label;" accesskey="&printCmd.accesskey;"/>
<menuseparator/>

Просмотреть файл

@ -1,8 +1,9 @@
toolkit.jar:
* content/global/viewSource.xul (content/viewSource.xul)
* content/global/viewSource.css (content/viewSource.css)
* content/global/viewSource.js (content/viewSource.js)
* content/global/viewPartialSource.xul (content/viewPartialSource.xul)
* content/global/viewSource.xul (content/viewSource.xul)
* content/global/viewPartialSource.js (content/viewPartialSource.js)
* content/global/viewPartialSource.xul (content/viewPartialSource.xul)
en-US.jar:
locale/en-US/global/viewSource.dtd (locale/viewSource.dtd)

Просмотреть файл

@ -15,6 +15,8 @@
<!ENTITY savePageCmd.commandkey "S">
<!ENTITY pageSetupCmd.label "Page Setup...">
<!ENTITY pageSetupCmd.accesskey "u">
<!ENTITY printPreviewCmd.label "Print Preview">
<!ENTITY printPreviewCmd.accesskey "v">
<!ENTITY printCmd.label "Print...">
<!ENTITY printCmd.accesskey "P">
<!ENTITY printCmd.commandkey "P">