зеркало из https://github.com/mozilla/pjs.git
Bug 262287 Mozilla Xprint 2004/Q3 update
Relanding toolkit part of patch following aviary branch landing - previously approved
This commit is contained in:
Родитель
e9d689d528
Коммит
55783de2dd
|
@ -45,6 +45,7 @@ var printOptions = null;
|
|||
var gOriginalNumCopies = 1;
|
||||
|
||||
var paramBlock;
|
||||
var gPrefs = null;
|
||||
var gPrintSettings = null;
|
||||
var gWebBrowserPrint = null;
|
||||
var default_file = "mozilla.ps";
|
||||
|
@ -58,6 +59,7 @@ function initDialog()
|
|||
dialog = new Object;
|
||||
|
||||
dialog.propertiesButton = document.getElementById("properties");
|
||||
dialog.descText = document.getElementById("descText");
|
||||
|
||||
dialog.destGroup = document.getElementById("destGroup");
|
||||
dialog.fileRadio = document.getElementById("fileRadio");
|
||||
|
@ -132,6 +134,20 @@ function doEnablePrintToFile(value)
|
|||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
function getPrinterDescription(printerName)
|
||||
{
|
||||
var s = "";
|
||||
|
||||
try {
|
||||
/* This may not work with non-ASCII test (see bug 235763 comment #16) */
|
||||
s = gPrefs.getCharPref("print.printer_" + printerName + ".printer_description")
|
||||
} catch(e) {
|
||||
}
|
||||
|
||||
return s;
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
function listElement(aListElement)
|
||||
{
|
||||
|
@ -144,13 +160,16 @@ listElement.prototype =
|
|||
function ()
|
||||
{
|
||||
// remove the menupopup node child of the menulist.
|
||||
this.listElement.removeChild(this.listElement.firstChild);
|
||||
var popup = this.listElement.firstChild;
|
||||
if (popup) {
|
||||
this.listElement.removeChild(popup);
|
||||
}
|
||||
},
|
||||
|
||||
appendPrinterNames:
|
||||
function (aDataObject)
|
||||
{
|
||||
var popupNode = document.createElement("menupopup");
|
||||
var list = document.getElementById("printerList");
|
||||
var strDefaultPrinterName = "";
|
||||
var printerName;
|
||||
|
||||
|
@ -161,10 +180,8 @@ listElement.prototype =
|
|||
var printerNameStr = printerName.toString();
|
||||
if (strDefaultPrinterName == "")
|
||||
strDefaultPrinterName = printerNameStr;
|
||||
var itemNode = document.createElement("menuitem");
|
||||
itemNode.setAttribute("value", printerNameStr);
|
||||
itemNode.setAttribute("label", printerNameStr);
|
||||
popupNode.appendChild(itemNode);
|
||||
|
||||
list.appendItem(printerNameStr, printerNameStr, getPrinterDescription(printerNameStr));
|
||||
}
|
||||
if (strDefaultPrinterName != "") {
|
||||
this.listElement.removeAttribute("disabled");
|
||||
|
@ -184,7 +201,6 @@ listElement.prototype =
|
|||
doEnablePrintToFile(false);
|
||||
}
|
||||
|
||||
this.listElement.appendChild(popupNode);
|
||||
return strDefaultPrinterName;
|
||||
}
|
||||
};
|
||||
|
@ -211,6 +227,8 @@ function setPrinterDefaultsForSelectedPrinter()
|
|||
{
|
||||
gPrintSettings.printerName = dialog.printerList.value;
|
||||
|
||||
dialog.descText.value = getPrinterDescription(gPrintSettings.printerName);
|
||||
|
||||
// First get any defaults from the printer
|
||||
printService.initPrintSettingsFromPrinter(gPrintSettings.printerName, gPrintSettings);
|
||||
|
||||
|
@ -265,6 +283,8 @@ function loadDialog()
|
|||
var print_tofile = "";
|
||||
|
||||
try {
|
||||
gPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
printService = Components.classes["@mozilla.org/gfx/printsettings-service;1"];
|
||||
if (printService) {
|
||||
printService = printService.getService();
|
||||
|
@ -385,7 +405,7 @@ function onLoad()
|
|||
function onAccept()
|
||||
{
|
||||
|
||||
if (gPrintSettings) {
|
||||
if (gPrintSettings != null) {
|
||||
var print_howToEnableUI = gPrintSetInterface.kFrameEnableNone;
|
||||
var stringBundle = srGetStrBundle("chrome://global/locale/printing.properties");
|
||||
var promptService = Components.classes["@mozilla.org/embedcomp/prompt-service;1"]
|
||||
|
@ -459,14 +479,23 @@ function onAccept()
|
|||
}
|
||||
}
|
||||
|
||||
if (printService) {
|
||||
var saveToPrefs = false;
|
||||
|
||||
saveToPrefs = gPrefs.getBoolPref("print.save_print_settings");
|
||||
|
||||
if (saveToPrefs && printService != null) {
|
||||
var flags = gPrintSetInterface.kInitSavePaperSizeType |
|
||||
gPrintSetInterface.kInitSavePaperSizeUnit |
|
||||
gPrintSetInterface.kInitSavePaperWidth |
|
||||
gPrintSetInterface.kInitSavePaperHeight |
|
||||
gPrintSetInterface.kInitSavePaperName |
|
||||
gPrintSetInterface.kInitSaveColorSpace |
|
||||
gPrintSetInterface.kInitSaveInColor |
|
||||
gPrintSetInterface.kInitSavePrintCommand;
|
||||
gPrintSetInterface.kInitSaveResolutionName |
|
||||
gPrintSetInterface.kInitSaveDownloadFonts |
|
||||
gPrintSetInterface.kInitSavePrintCommand |
|
||||
gPrintSetInterface.kInitSaveShrinkToFit |
|
||||
gPrintSetInterface.kInitSaveScaling;
|
||||
printService.savePrintSettingsToPrefs(gPrintSettings, true, flags);
|
||||
}
|
||||
|
||||
|
|
|
@ -68,20 +68,15 @@
|
|||
<rows>
|
||||
<row align="center">
|
||||
<hbox align="center" pack="end">
|
||||
<label value="&printTo.label;"/>
|
||||
<label id="descTextLabel" control="descText" value="&descText.label;"/>
|
||||
</hbox>
|
||||
<radiogroup id="destGroup" orient="horizontal">
|
||||
<radio id="printerRadio" label="&printerRadio.label;" oncommand="if (!this.disabled) doEnablePrintToFile(false);"/>
|
||||
<radio id="fileRadio" label="&fileRadio.label;" oncommand="if (!this.disabled) doEnablePrintToFile(true);"/>
|
||||
</radiogroup>
|
||||
<label id="descText" flex="1" value="-" />
|
||||
</row>
|
||||
<row align="center">
|
||||
<hbox align="center" pack="end">
|
||||
<label id="printerLabel" value="&printerInput.label;"/>
|
||||
</hbox>
|
||||
<menulist id="printerList" flex="1" oncommand="setPrinterDefaultsForSelectedPrinter();">
|
||||
<menupopup/>
|
||||
</menulist>
|
||||
<menulist id="printerList" flex="1" type="description" oncommand="setPrinterDefaultsForSelectedPrinter();"/>
|
||||
<button id="properties" label="&propertiesButton.label;" oncommand="displayPropertiesDialog();"/>
|
||||
</row>
|
||||
<row align="center">
|
||||
|
@ -91,6 +86,15 @@
|
|||
<textbox id="fileInput" flex="1" onblur="stripTrailingWhitespace(this)"/>
|
||||
<button id="chooseFile" label="&chooseButton.label;" oncommand="onChooseFile()"/>
|
||||
</row>
|
||||
<row align="center">
|
||||
<hbox align="center" pack="end">
|
||||
<label value="&printTo.label;"/>
|
||||
</hbox>
|
||||
<radiogroup id="destGroup" orient="horizontal">
|
||||
<radio id="printerRadio" label="&printerRadio.label;" oncommand="if (!this.disabled) doEnablePrintToFile(false);"/>
|
||||
<radio id="fileRadio" label="&fileRadio.label;" oncommand="if (!this.disabled) doEnablePrintToFile(true);"/>
|
||||
</radiogroup>
|
||||
</row>
|
||||
</rows>
|
||||
|
||||
</grid>
|
||||
|
|
|
@ -46,6 +46,8 @@ var gStringBundle = null;
|
|||
var gPrintSettingsInterface = Components.interfaces.nsIPrintSettings;
|
||||
var gPaperArray;
|
||||
var gPlexArray;
|
||||
var gResolutionArray;
|
||||
var gColorSpaceArray;
|
||||
var gPrefs;
|
||||
|
||||
var default_command = "lpr";
|
||||
|
@ -101,15 +103,29 @@ function initDialog()
|
|||
|
||||
dialog.plexList = document.getElementById("plexList");
|
||||
dialog.plexGroup = document.getElementById("plexGroup");
|
||||
|
||||
dialog.resolutionList = document.getElementById("resolutionList");
|
||||
dialog.resolutionGroup = document.getElementById("resolutionGroup");
|
||||
|
||||
dialog.jobTitleLabel = document.getElementById("jobTitleLabel");
|
||||
dialog.jobTitleGroup = document.getElementById("jobTitleGroup");
|
||||
dialog.jobTitleInput = document.getElementById("jobTitleInput");
|
||||
|
||||
dialog.cmdLabel = document.getElementById("cmdLabel");
|
||||
dialog.cmdGroup = document.getElementById("cmdGroup");
|
||||
dialog.cmdInput = document.getElementById("cmdInput");
|
||||
|
||||
dialog.colorspaceList = document.getElementById("colorspaceList");
|
||||
dialog.colorspaceGroup = document.getElementById("colorspaceGroup");
|
||||
|
||||
dialog.colorGroup = document.getElementById("colorGroup");
|
||||
dialog.colorRadioGroup = document.getElementById("colorRadioGroup");
|
||||
dialog.colorRadio = document.getElementById("colorRadio");
|
||||
dialog.grayRadio = document.getElementById("grayRadio");
|
||||
|
||||
dialog.fontsGroup = document.getElementById("fontsGroup");
|
||||
dialog.downloadFonts = document.getElementById("downloadFonts");
|
||||
|
||||
dialog.topInput = document.getElementById("topInput");
|
||||
dialog.bottomInput = document.getElementById("bottomInput");
|
||||
dialog.leftInput = document.getElementById("leftInput");
|
||||
|
@ -257,7 +273,7 @@ function createPaperArray()
|
|||
//---------------------------------------------------
|
||||
function createPaperSizeList(selectedInx)
|
||||
{
|
||||
gStringBundle = srGetStrBundle("chrome://global/locale/printjoboptions.properties");
|
||||
gStringBundle = srGetStrBundle("chrome://global/locale/printPageSetup.properties");
|
||||
|
||||
var selectElement = new paperListElement(dialog.paperList);
|
||||
selectElement.clearPaperList();
|
||||
|
@ -368,7 +384,7 @@ function createPlexArray()
|
|||
//---------------------------------------------------
|
||||
function createPlexNameList(selectedInx)
|
||||
{
|
||||
gStringBundle = srGetStrBundle("chrome://global/locale/printjoboptions.properties");
|
||||
gStringBundle = srGetStrBundle("chrome://global/locale/printPageSetup.properties");
|
||||
|
||||
var selectElement = new plexListElement(dialog.plexList);
|
||||
selectElement.clearPlexList();
|
||||
|
@ -382,6 +398,227 @@ function createPlexNameList(selectedInx)
|
|||
//dialog.plexList = selectElement;
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
function resolutionListElement(aResolutionListElement)
|
||||
{
|
||||
this.resolutionListElement = aResolutionListElement;
|
||||
}
|
||||
|
||||
resolutionListElement.prototype =
|
||||
{
|
||||
clearResolutionList:
|
||||
function ()
|
||||
{
|
||||
// remove the menupopup node child of the menulist.
|
||||
this.resolutionListElement.removeChild(this.resolutionListElement.firstChild);
|
||||
},
|
||||
|
||||
appendResolutionNames:
|
||||
function (aDataObject)
|
||||
{
|
||||
var popupNode = document.createElement("menupopup");
|
||||
for (var i=0;i<aDataObject.length;i++) {
|
||||
var resolutionObj = aDataObject[i];
|
||||
var itemNode = document.createElement("menuitem");
|
||||
var label;
|
||||
try {
|
||||
label = gStringBundle.GetStringFromName(resolutionObj.name)
|
||||
}
|
||||
catch (e) {
|
||||
/* No name in string bundle ? Then build one manually (this
|
||||
* usually happens when gResolutionArray was build by createResolutionArrayFromPrinterFeatures() ...) */
|
||||
label = resolutionObj.name;
|
||||
}
|
||||
itemNode.setAttribute("label", label);
|
||||
itemNode.setAttribute("value", i);
|
||||
popupNode.appendChild(itemNode);
|
||||
}
|
||||
this.resolutionListElement.appendChild(popupNode);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------
|
||||
function createResolutionArrayFromDefaults()
|
||||
{
|
||||
var resolutionNames = ["default"];
|
||||
|
||||
gResolutionArray = new Array();
|
||||
|
||||
for (var i=0;i<resolutionNames.length;i++) {
|
||||
var obj = new Object();
|
||||
obj.name = resolutionNames[i];
|
||||
|
||||
gResolutionArray[i] = obj;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
function createResolutionArrayFromPrinterFeatures()
|
||||
{
|
||||
var printername = gPrintSettings.printerName;
|
||||
if (doDebug) {
|
||||
dump("createResolutionArrayFromPrinterFeatures for " + printername + ".\n");
|
||||
}
|
||||
|
||||
gResolutionArray = new Array();
|
||||
|
||||
var numResolutions = gPrefs.getIntPref("print.tmp.printerfeatures." + printername + ".resolution.count");
|
||||
|
||||
if (doDebug) {
|
||||
dump("processing " + numResolutions + " entries...\n");
|
||||
}
|
||||
|
||||
for ( var i=0 ; i < numResolutions ; i++ ) {
|
||||
var obj = new Object();
|
||||
obj.name = gPrefs.getCharPref("print.tmp.printerfeatures." + printername + ".resolution." + i + ".name");
|
||||
|
||||
gResolutionArray[i] = obj;
|
||||
|
||||
if (doDebug) {
|
||||
dump("resolution index=" + i + ", name='" + obj.name + "'.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
function createResolutionArray()
|
||||
{
|
||||
if (isListOfPrinterFeaturesAvailable()) {
|
||||
createResolutionArrayFromPrinterFeatures();
|
||||
}
|
||||
else {
|
||||
createResolutionArrayFromDefaults();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
function createResolutionNameList(selectedInx)
|
||||
{
|
||||
gStringBundle = srGetStrBundle("chrome://global/locale/printPageSetup.properties");
|
||||
|
||||
var selectElement = new resolutionListElement(dialog.resolutionList);
|
||||
selectElement.clearResolutionList();
|
||||
|
||||
selectElement.appendResolutionNames(gResolutionArray);
|
||||
|
||||
if (selectedInx > -1) {
|
||||
selectElement.resolutionListElement.selectedIndex = selectedInx;
|
||||
}
|
||||
|
||||
//dialog.resolutionList = selectElement;
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
function colorspaceListElement(aColorspaceListElement)
|
||||
{
|
||||
this.colorspaceListElement = aColorspaceListElement;
|
||||
}
|
||||
|
||||
colorspaceListElement.prototype =
|
||||
{
|
||||
clearColorspaceList:
|
||||
function ()
|
||||
{
|
||||
// remove the menupopup node child of the menulist.
|
||||
this.colorspaceListElement.removeChild(this.colorspaceListElement.firstChild);
|
||||
},
|
||||
|
||||
appendColorspaceNames:
|
||||
function (aDataObject)
|
||||
{
|
||||
var popupNode = document.createElement("menupopup");
|
||||
for (var i=0;i<aDataObject.length;i++) {
|
||||
var colorspaceObj = aDataObject[i];
|
||||
var itemNode = document.createElement("menuitem");
|
||||
var label;
|
||||
try {
|
||||
label = gStringBundle.GetStringFromName(colorspaceObj.name)
|
||||
}
|
||||
catch (e) {
|
||||
/* No name in string bundle ? Then build one manually (this
|
||||
* usually happens when gColorspaceArray was build by createColorspaceArrayFromPrinterFeatures() ...) */
|
||||
label = colorspaceObj.name;
|
||||
}
|
||||
itemNode.setAttribute("label", label);
|
||||
itemNode.setAttribute("value", i);
|
||||
popupNode.appendChild(itemNode);
|
||||
}
|
||||
this.colorspaceListElement.appendChild(popupNode);
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
//---------------------------------------------------
|
||||
function createColorspaceArrayFromDefaults()
|
||||
{
|
||||
var colorspaceNames = ["default"];
|
||||
|
||||
gColorspaceArray = new Array();
|
||||
|
||||
for (var i=0;i<colorspaceNames.length;i++) {
|
||||
var obj = new Object();
|
||||
obj.name = colorspaceNames[i];
|
||||
|
||||
gColorspaceArray[i] = obj;
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
function createColorspaceArrayFromPrinterFeatures()
|
||||
{
|
||||
var printername = gPrintSettings.printerName;
|
||||
if (doDebug) {
|
||||
dump("createColorspaceArrayFromPrinterFeatures for " + printername + ".\n");
|
||||
}
|
||||
|
||||
gColorspaceArray = new Array();
|
||||
|
||||
var numColorspaces = gPrefs.getIntPref("print.tmp.printerfeatures." + printername + ".colorspace.count");
|
||||
|
||||
if (doDebug) {
|
||||
dump("processing " + numColorspaces + " entries...\n");
|
||||
}
|
||||
|
||||
for ( var i=0 ; i < numColorspaces ; i++ ) {
|
||||
var obj = new Object();
|
||||
obj.name = gPrefs.getCharPref("print.tmp.printerfeatures." + printername + ".colorspace." + i + ".name");
|
||||
|
||||
gColorspaceArray[i] = obj;
|
||||
|
||||
if (doDebug) {
|
||||
dump("colorspace index=" + i + ", name='" + obj.name + "'.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
function createColorspaceArray()
|
||||
{
|
||||
if (isListOfPrinterFeaturesAvailable()) {
|
||||
createColorspaceArrayFromPrinterFeatures();
|
||||
}
|
||||
else {
|
||||
createColorspaceArrayFromDefaults();
|
||||
}
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
function createColorspaceNameList(selectedInx)
|
||||
{
|
||||
gStringBundle = srGetStrBundle("chrome://global/locale/printPageSetup.properties");
|
||||
|
||||
var selectElement = new colorspaceListElement(dialog.colorspaceList);
|
||||
selectElement.clearColorspaceList();
|
||||
|
||||
selectElement.appendColorspaceNames(gColorspaceArray);
|
||||
|
||||
if (selectedInx > -1) {
|
||||
selectElement.colorspaceListElement.selectedIndex = selectedInx;
|
||||
}
|
||||
|
||||
//dialog.colorspaceList = selectElement;
|
||||
}
|
||||
|
||||
//---------------------------------------------------
|
||||
function loadDialog()
|
||||
|
@ -392,31 +629,43 @@ function loadDialog()
|
|||
var print_paper_height = 0.0;
|
||||
var print_paper_name = "";
|
||||
var print_plex_name = "";
|
||||
var print_resolution_name = "";
|
||||
var print_colorspace = "";
|
||||
var print_color = true;
|
||||
var print_downloadfonts = true;
|
||||
var print_command = default_command;
|
||||
var print_jobtitle = "";
|
||||
|
||||
gPrefs = Components.classes["@mozilla.org/preferences-service;1"].getService(Components.interfaces.nsIPrefBranch);
|
||||
|
||||
if (gPrintSettings) {
|
||||
print_paper_type = gPrintSettings.paperSizeType;
|
||||
print_paper_unit = gPrintSettings.paperSizeUnit;
|
||||
print_paper_width = gPrintSettings.paperWidth;
|
||||
print_paper_height = gPrintSettings.paperHeight;
|
||||
print_paper_name = gPrintSettings.paperName;
|
||||
print_plex_name = gPrintSettings.plexName;
|
||||
print_color = gPrintSettings.printInColor;
|
||||
print_command = gPrintSettings.printCommand;
|
||||
print_paper_type = gPrintSettings.paperSizeType;
|
||||
print_paper_unit = gPrintSettings.paperSizeUnit;
|
||||
print_paper_width = gPrintSettings.paperWidth;
|
||||
print_paper_height = gPrintSettings.paperHeight;
|
||||
print_paper_name = gPrintSettings.paperName;
|
||||
print_plex_name = gPrintSettings.plexName;
|
||||
print_resolution_name = gPrintSettings.resolutionName;
|
||||
print_colorspace = gPrintSettings.colorspace;
|
||||
print_color = gPrintSettings.printInColor;
|
||||
print_downloadfonts = gPrintSettings.downloadFonts;
|
||||
print_command = gPrintSettings.printCommand;
|
||||
print_jobtitle = gPrintSettings.title;
|
||||
}
|
||||
|
||||
if (doDebug) {
|
||||
dump("loadDialog******************************\n");
|
||||
dump("paperSizeType "+print_paper_unit+"\n");
|
||||
dump("paperWidth "+print_paper_width+"\n");
|
||||
dump("paperHeight "+print_paper_height+"\n");
|
||||
dump("paperName "+print_paper_name+"\n");
|
||||
dump("plexName "+print_plex_name+"\n");
|
||||
dump("printInColor "+print_color+"\n");
|
||||
dump("printCommand "+print_command+"\n");
|
||||
dump("paperSizeType "+print_paper_unit+"\n");
|
||||
dump("paperWidth "+print_paper_width+"\n");
|
||||
dump("paperHeight "+print_paper_height+"\n");
|
||||
dump("paperName "+print_paper_name+"\n");
|
||||
dump("plexName "+print_plex_name+"\n");
|
||||
dump("resolutionName "+print_resolution_name+"\n");
|
||||
dump("colorspace "+print_colorspace+"\n");
|
||||
dump("print_color "+print_color+"\n");
|
||||
dump("print_downloadfonts "+print_downloadfonts+"\n");
|
||||
dump("print_command "+print_command+"\n");
|
||||
dump("print_jobtitle "+print_jobtitle+"\n");
|
||||
}
|
||||
|
||||
createPaperArray();
|
||||
|
@ -439,7 +688,6 @@ function loadDialog()
|
|||
createPaperSizeList(paperSelectedInx);
|
||||
|
||||
createPlexArray();
|
||||
|
||||
var plexSelectedInx = 0;
|
||||
for (var i=0;i<gPlexArray.length;i++) {
|
||||
if (print_plex_name == gPlexArray[i].name) {
|
||||
|
@ -447,26 +695,69 @@ function loadDialog()
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (doDebug) {
|
||||
if (i == gPlexArray.length)
|
||||
dump("loadDialog: No plex found.\n");
|
||||
else
|
||||
dump("loadDialog: found plex '"+gPlexArray[plexSelectedInx].name+"'.\n");
|
||||
}
|
||||
|
||||
createResolutionArray();
|
||||
var resolutionSelectedInx = 0;
|
||||
for (var i=0;i<gResolutionArray.length;i++) {
|
||||
if (print_resolution_name == gResolutionArray[i].name) {
|
||||
resolutionSelectedInx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (doDebug) {
|
||||
if (i == gResolutionArray.length)
|
||||
dump("loadDialog: No resolution found.\n");
|
||||
else
|
||||
dump("loadDialog: found resolution '"+gResolutionArray[resolutionSelectedInx].name+"'.\n");
|
||||
}
|
||||
|
||||
createColorspaceArray();
|
||||
var colorspaceSelectedInx = 0;
|
||||
for (var i=0;i<gColorspaceArray.length;i++) {
|
||||
if (print_colorspace == gColorspaceArray[i].name) {
|
||||
colorspaceSelectedInx = i;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (doDebug) {
|
||||
if (i == gColorspaceArray.length)
|
||||
dump("loadDialog: No colorspace found.\n");
|
||||
else
|
||||
dump("loadDialog: found colorspace '"+gColorspaceArray[colorspaceSelectedInx].name+"'.\n");
|
||||
}
|
||||
|
||||
createPlexNameList(plexSelectedInx);
|
||||
createResolutionNameList(resolutionSelectedInx);
|
||||
createColorspaceNameList(colorspaceSelectedInx);
|
||||
|
||||
/* Enable/disable and/or hide/unhide widgets based in the information
|
||||
* whether the selected printer and/or print module supports the matching
|
||||
* feature or not */
|
||||
if (isListOfPrinterFeaturesAvailable()) {
|
||||
// job title
|
||||
if (gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".can_change_jobtitle"))
|
||||
dialog.jobTitleInput.removeAttribute("disabled");
|
||||
else
|
||||
dialog.jobTitleInput.setAttribute("disabled","true");
|
||||
if (gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".supports_jobtitle_change"))
|
||||
dialog.jobTitleGroup.removeAttribute("hidden");
|
||||
else
|
||||
dialog.jobTitleGroup.setAttribute("hidden","true");
|
||||
|
||||
// spooler command
|
||||
if (gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".can_change_spoolercommand"))
|
||||
dialog.cmdInput.removeAttribute("disabled");
|
||||
else
|
||||
dialog.cmdInput.setAttribute("disabled","true");
|
||||
|
||||
if (gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".supports_spoolercommand_change"))
|
||||
dialog.cmdGroup.removeAttribute("hidden");
|
||||
else
|
||||
|
@ -477,7 +768,6 @@ function loadDialog()
|
|||
dialog.paperList.removeAttribute("disabled");
|
||||
else
|
||||
dialog.paperList.setAttribute("disabled","true");
|
||||
|
||||
if (gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".supports_paper_size_change"))
|
||||
dialog.paperGroup.removeAttribute("hidden");
|
||||
else
|
||||
|
@ -488,11 +778,50 @@ function loadDialog()
|
|||
dialog.plexList.removeAttribute("disabled");
|
||||
else
|
||||
dialog.plexList.setAttribute("disabled","true");
|
||||
|
||||
if (gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".supports_plex_change"))
|
||||
dialog.plexGroup.removeAttribute("hidden");
|
||||
else
|
||||
dialog.plexGroup.setAttribute("hidden","true");
|
||||
|
||||
// resolution
|
||||
if (gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".can_change_resolution"))
|
||||
dialog.resolutionList.removeAttribute("disabled");
|
||||
else
|
||||
dialog.resolutionList.setAttribute("disabled","true");
|
||||
if (gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".supports_resolution_change"))
|
||||
dialog.resolutionGroup.removeAttribute("hidden");
|
||||
else
|
||||
dialog.resolutionGroup.setAttribute("hidden","true");
|
||||
|
||||
// color/grayscale radio
|
||||
if (gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".can_change_printincolor"))
|
||||
dialog.colorRadioGroup.removeAttribute("disabled");
|
||||
else
|
||||
dialog.colorRadioGroup.setAttribute("disabled","true");
|
||||
if (gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".supports_printincolor_change"))
|
||||
dialog.colorGroup.removeAttribute("hidden");
|
||||
else
|
||||
dialog.colorGroup.setAttribute("hidden","true");
|
||||
|
||||
// colorspace
|
||||
if (gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".can_change_colorspace"))
|
||||
dialog.colorspaceList.removeAttribute("disabled");
|
||||
else
|
||||
dialog.colorspaceList.setAttribute("disabled","true");
|
||||
if (gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".supports_colorspace_change"))
|
||||
dialog.colorspaceGroup.removeAttribute("hidden");
|
||||
else
|
||||
dialog.colorspaceGroup.setAttribute("hidden","true");
|
||||
|
||||
// font download
|
||||
if (gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".can_change_downloadfonts"))
|
||||
dialog.downloadFonts.removeAttribute("disabled");
|
||||
else
|
||||
dialog.downloadFonts.setAttribute("disabled","true");
|
||||
if (gPrefs.getBoolPref("print.tmp.printerfeatures." + gPrintSettings.printerName + ".supports_downloadfonts_change"))
|
||||
dialog.fontsGroup.removeAttribute("hidden");
|
||||
else
|
||||
dialog.fontsGroup.setAttribute("hidden","true");
|
||||
}
|
||||
|
||||
if (print_command == "") {
|
||||
|
@ -500,12 +829,15 @@ function loadDialog()
|
|||
}
|
||||
|
||||
if (print_color) {
|
||||
dialog.colorGroup.selectedItem = dialog.colorRadio;
|
||||
dialog.colorRadioGroup.selectedItem = dialog.colorRadio;
|
||||
} else {
|
||||
dialog.colorGroup.selectedItem = dialog.grayRadio;
|
||||
dialog.colorRadioGroup.selectedItem = dialog.grayRadio;
|
||||
}
|
||||
|
||||
dialog.cmdInput.value = print_command;
|
||||
dialog.downloadFonts.checked = print_downloadfonts;
|
||||
|
||||
dialog.cmdInput.value = print_command;
|
||||
dialog.jobTitleInput.value = print_jobtitle;
|
||||
|
||||
/* First initalize with the hardcoded defaults... */
|
||||
dialog.topInput.value = "0.04";
|
||||
|
@ -552,37 +884,47 @@ function onLoad()
|
|||
//---------------------------------------------------
|
||||
function onAccept()
|
||||
{
|
||||
var print_paper_type = gPrintSettingsInterface.kPaperSizeDefined;
|
||||
var print_paper_unit = gPrintSettingsInterface.kPaperSizeInches;
|
||||
var print_paper_width = 0.0;
|
||||
var print_paper_height = 0.0;
|
||||
var print_paper_name = "";
|
||||
var print_plex_name = "";
|
||||
var print_paper_type = gPrintSettingsInterface.kPaperSizeDefined;
|
||||
var print_paper_unit = gPrintSettingsInterface.kPaperSizeInches;
|
||||
var print_paper_width = 0.0;
|
||||
var print_paper_height = 0.0;
|
||||
var print_paper_name = "";
|
||||
var print_plex_name = "";
|
||||
var print_resolution_name = "";
|
||||
var print_colorspace = "";
|
||||
|
||||
if (gPrintSettings != null) {
|
||||
var paperSelectedInx = dialog.paperList.selectedIndex;
|
||||
var plexSelectedInx = dialog.plexList.selectedIndex;
|
||||
var resolutionSelectedInx = dialog.resolutionList.selectedIndex;
|
||||
var colorspaceSelectedInx = dialog.colorspaceList.selectedIndex;
|
||||
if (gPaperArray[paperSelectedInx].inches) {
|
||||
print_paper_unit = gPrintSettingsInterface.kPaperSizeInches;
|
||||
} else {
|
||||
print_paper_unit = gPrintSettingsInterface.kPaperSizeMillimeters;
|
||||
}
|
||||
print_paper_width = gPaperArray[paperSelectedInx].width;
|
||||
print_paper_height = gPaperArray[paperSelectedInx].height;
|
||||
print_paper_name = gPaperArray[paperSelectedInx].name;
|
||||
print_plex_name = gPlexArray[plexSelectedInx].name;
|
||||
gPrintSettings.paperSize = gPaperArray[paperSelectedInx].paperSize; // deprecated
|
||||
print_paper_width = gPaperArray[paperSelectedInx].width;
|
||||
print_paper_height = gPaperArray[paperSelectedInx].height;
|
||||
print_paper_name = gPaperArray[paperSelectedInx].name;
|
||||
print_plex_name = gPlexArray[plexSelectedInx].name;
|
||||
print_resolution_name = gResolutionArray[resolutionSelectedInx].name;
|
||||
print_colorspace = gColorspaceArray[colorspaceSelectedInx].name;
|
||||
|
||||
gPrintSettings.paperSizeType = print_paper_type;
|
||||
gPrintSettings.paperSizeUnit = print_paper_unit;
|
||||
gPrintSettings.paperWidth = print_paper_width;
|
||||
gPrintSettings.paperHeight = print_paper_height;
|
||||
gPrintSettings.paperName = print_paper_name;
|
||||
gPrintSettings.plexName = print_plex_name;
|
||||
gPrintSettings.paperSize = gPaperArray[paperSelectedInx].paperSize; // deprecated
|
||||
gPrintSettings.paperSizeType = print_paper_type;
|
||||
gPrintSettings.paperSizeUnit = print_paper_unit;
|
||||
gPrintSettings.paperWidth = print_paper_width;
|
||||
gPrintSettings.paperHeight = print_paper_height;
|
||||
gPrintSettings.paperName = print_paper_name;
|
||||
gPrintSettings.plexName = print_plex_name;
|
||||
gPrintSettings.resolutionName = print_resolution_name;
|
||||
gPrintSettings.colorspace = print_colorspace;
|
||||
|
||||
// save these out so they can be picked up by the device spec
|
||||
gPrintSettings.printInColor = dialog.colorRadio.selected;
|
||||
gPrintSettings.printCommand = dialog.cmdInput.value;
|
||||
gPrintSettings.printInColor = dialog.colorRadio.selected;
|
||||
gPrintSettings.downloadFonts = dialog.downloadFonts.checked;
|
||||
gPrintSettings.printCommand = dialog.cmdInput.value;
|
||||
gPrintSettings.title = dialog.jobTitleInput.value;
|
||||
|
||||
//
|
||||
try {
|
||||
|
@ -603,16 +945,19 @@ function onAccept()
|
|||
|
||||
if (doDebug) {
|
||||
dump("onAccept******************************\n");
|
||||
dump("paperSize "+gPrintSettings.paperSize+" (deprecated)\n");
|
||||
dump("paperSizeType "+print_paper_type+" (should be 1)\n");
|
||||
dump("paperSizeUnit "+print_paper_unit+"\n");
|
||||
dump("paperWidth "+print_paper_width+"\n");
|
||||
dump("paperHeight "+print_paper_height+"\n");
|
||||
dump("paperName '"+print_paper_name+"'\n");
|
||||
dump("plexName '"+print_plex_name+"'\n");
|
||||
dump("paperSize "+gPrintSettings.paperSize+" (deprecated)\n");
|
||||
dump("paperSizeType "+print_paper_type+" (should be 1)\n");
|
||||
dump("paperSizeUnit "+print_paper_unit+"\n");
|
||||
dump("paperWidth "+print_paper_width+"\n");
|
||||
dump("paperHeight "+print_paper_height+"\n");
|
||||
dump("paperName '"+print_paper_name+"'\n");
|
||||
dump("plexName '"+print_plex_name+"'\n");
|
||||
dump("resolutionName '"+print_resolution_name+"'\n");
|
||||
dump("colorspace '"+print_colorspace+"'\n");
|
||||
|
||||
dump("printInColor "+gPrintSettings.printInColor+"\n");
|
||||
dump("printCommand '"+gPrintSettings.printCommand+"'\n");
|
||||
dump("printInColor "+gPrintSettings.printInColor+"\n");
|
||||
dump("downloadFonts "+gPrintSettings.downloadFonts+"\n");
|
||||
dump("printCommand '"+gPrintSettings.printCommand+"'\n");
|
||||
}
|
||||
} else {
|
||||
dump("************ onAccept gPrintSettings: "+gPrintSettings+"\n");
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
# the terms of any one of the NPL, the GPL or the LGPL.
|
||||
#
|
||||
# ***** END LICENSE BLOCK *****
|
||||
#
|
||||
|
||||
#ifdef XP_UNIX
|
||||
|
||||
<?xml-stylesheet href="chrome://global/skin/" type="text/css"?>
|
||||
|
@ -55,7 +55,6 @@
|
|||
|
||||
<script type="application/x-javascript" src="chrome://global/content/printjoboptions.js"/>
|
||||
<script type="application/x-javascript" src="chrome://global/content/strres.js"/>
|
||||
|
||||
<grid>
|
||||
<columns>
|
||||
<column/>
|
||||
|
@ -63,6 +62,13 @@
|
|||
</columns>
|
||||
|
||||
<rows>
|
||||
<row id="jobTitleGroup">
|
||||
<hbox align="center" pack="end">
|
||||
<label id="jobTitleLabel" value="&jobTitleInput.label;"/>
|
||||
</hbox>
|
||||
<textbox id="jobTitleInput" flex="1"/>
|
||||
</row>
|
||||
|
||||
<row id="paperGroup">
|
||||
<hbox align="center" pack="end">
|
||||
<label id="paperLabel" value="&paperInput.label;"/>
|
||||
|
@ -80,22 +86,46 @@
|
|||
<menupopup/>
|
||||
</menulist>
|
||||
</row>
|
||||
|
||||
|
||||
<row id="resolutionGroup">
|
||||
<hbox align="center" pack="end">
|
||||
<label id="resolutionLabel" value="&resolutionInput.label;"/>
|
||||
</hbox>
|
||||
<menulist id="resolutionList" flex="1">
|
||||
<menupopup/>
|
||||
</menulist>
|
||||
</row>
|
||||
|
||||
<row id="colorspaceGroup">
|
||||
<hbox align="center" pack="end">
|
||||
<label id="colorspaceLabel" value="&colorspaceInput.label;"/>
|
||||
</hbox>
|
||||
<menulist id="colorspaceList" flex="1">
|
||||
<menupopup/>
|
||||
</menulist>
|
||||
</row>
|
||||
|
||||
<row id="cmdGroup">
|
||||
<label id="cmdLabel" value="&cmdInput.label;"/>
|
||||
<textbox id="cmdInput" flex="1"/>
|
||||
</row>
|
||||
|
||||
<row>
|
||||
<row id="colorGroup">
|
||||
<hbox align="center" pack="end">
|
||||
<label value="&colorGroup.label;"/>
|
||||
</hbox>
|
||||
<radiogroup id="colorGroup" orient="horizontal">
|
||||
<radiogroup id="colorRadioGroup" orient="horizontal">
|
||||
<radio id="grayRadio" label="&grayRadio.label;"/>
|
||||
<radio id="colorRadio" label="&colorRadio.label;"/>
|
||||
</radiogroup>
|
||||
</row>
|
||||
|
||||
<row id="fontsGroup">
|
||||
<hbox align="center" pack="end">
|
||||
<label value="&fontsGroup.label;"/>
|
||||
</hbox>
|
||||
<checkbox id="downloadFonts" label="&downloadFonts.label;" />
|
||||
</row>
|
||||
</rows>
|
||||
</grid>
|
||||
|
||||
|
|
|
@ -11,10 +11,11 @@
|
|||
<!ENTITY fileRadio.label "File">
|
||||
|
||||
<!ENTITY propertiesButton.label "Properties...">
|
||||
<!ENTITY descText.label "Printer Description:">
|
||||
<!ENTITY printer.label "Printer">
|
||||
<!ENTITY printerInput.label "Printer:">
|
||||
<!ENTITY fileInput.label "File:">
|
||||
<!ENTITY chooseButton.label "Choose File...">
|
||||
<!ENTITY printerInput.label "Printer Name:">
|
||||
<!ENTITY fileInput.label "File Name:">
|
||||
<!ENTITY chooseButton.label "Select File...">
|
||||
|
||||
<!ENTITY printrangeGroup.label "Print Range">
|
||||
<!ENTITY allpagesRadio.label "All Pages">
|
||||
|
|
|
@ -1,15 +1,27 @@
|
|||
<!-- extracted from printjoboptions.xul -->
|
||||
|
||||
<!ENTITY printJobOptions.title "Printer Properties">
|
||||
|
||||
<!ENTITY paperInput.label "Paper Size:">
|
||||
|
||||
<!ENTITY plexInput.label "Plex mode:">
|
||||
|
||||
<!ENTITY resolutionInput.label "Resolution/Quality:">
|
||||
|
||||
<!ENTITY cmdInput.label "Print Command:">
|
||||
|
||||
<!ENTITY jobTitleInput.label "Job Title:">
|
||||
|
||||
<!ENTITY colorGroup.label "Color:">
|
||||
<!ENTITY grayRadio.label "GrayScale">
|
||||
<!ENTITY colorRadio.label "Color">
|
||||
|
||||
<!ENTITY edgeMarginInput.label "Gap from edge of paper to Margin (inches)">
|
||||
<!ENTITY colorspaceInput.label "Colorspace:">
|
||||
|
||||
<!ENTITY fontsGroup.label "Fonts:">
|
||||
<!ENTITY downloadFonts.label "Download fonts to printer?">
|
||||
|
||||
<!ENTITY edgeMarginInput.label "Gap from edge of paper to Margin">
|
||||
<!ENTITY topInput.label "Top:">
|
||||
<!ENTITY bottomInput.label "Bottom:">
|
||||
<!ENTITY leftInput.label "Left:">
|
||||
|
|
Загрузка…
Ссылка в новой задаче