Remove user interface for DPI preference. b=326329 r=neil sr=jag

This commit is contained in:
dbaron%dbaron.org 2006-02-26 10:43:33 +00:00
Родитель dcc10543a7
Коммит 16a416d9fa
5 изменённых файлов: 1 добавлений и 291 удалений

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

@ -47,7 +47,6 @@ comm.jar:
content/communicator/pref/pref-debug2.xul (prefwindow/resources/content/pref-debug2.xul)
content/communicator/pref/pref-fonts.js (prefwindow/resources/content/pref-fonts.js)
content/communicator/pref/pref-fonts.xul (prefwindow/resources/content/pref-fonts.xul)
content/communicator/pref/pref-calibrate-screen.xul (prefwindow/resources/content/pref-calibrate-screen.xul)
content/communicator/pref/pref-history.xul (prefwindow/resources/content/pref-history.xul)
content/communicator/pref/pref-http.xul (prefwindow/resources/content/pref-http.xul)
content/communicator/pref/pref-http.js (prefwindow/resources/content/pref-http.js)

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

@ -1,77 +0,0 @@
<?xml version="1.0"?>
<!-- ***** BEGIN LICENSE BLOCK *****
Version: MPL 1.1/GPL 2.0/LGPL 2.1
The contents of this file are subject to the Mozilla Public License Version
1.1 (the "License"); you may not use this file except in compliance with
the License. You may obtain a copy of the License at
http://www.mozilla.org/MPL/
Software distributed under the License is distributed on an "AS IS" basis,
WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
for the specific language governing rights and limitations under the
License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is
Netscape Communications Corporation.
Portions created by the Initial Developer are Copyright (C) 1998-2000
the Initial Developer. All Rights Reserved.
Contributor(s):
Stefan Borggraefe <Stefan.Borggraefe@gmx.de>
Alternatively, the contents of this file may be used under the terms of
either of the GNU General Public License Version 2 or later (the "GPL"),
or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
in which case the provisions of the GPL or the LGPL are applicable instead
of those above. If you wish to allow use of your version of this file only
under the terms of either the GPL or the LGPL, and not to allow others to
use your version of this file under the terms of the MPL, indicate your
decision by deleting the provisions above and replace them with the notice
and other provisions required by the GPL or the LGPL. If you do not delete
the provisions above, a recipient may use your version of this file under
the terms of any one of the MPL, the GPL or the LGPL.
***** END LICENSE BLOCK ***** -->
<?xml-stylesheet href="chrome://navigator/skin/" type="text/css"?>
<!DOCTYPE dialog SYSTEM "chrome://communicator/locale/pref/pref-fonts.dtd" >
<dialog id="calibrateScreen"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
title="&calibrateDialog.title;"
buttons="accept,cancel"
ondialogaccept="return onOK();"
persist="screenX screenY">
<script type="application/x-javascript"
src="chrome://communicator/content/pref/pref-fonts.js"/>
<vbox align="center">
<vbox id="horizRuler" width="300" height="30" style="margin: 10px; margin-bottom: 0px">
<hbox height="10" style="border-bottom: 1px solid; border-left: 1px solid; border-right: 1px solid;"/>
<hbox height="10" style="border-top: 1px solid; border-left: 1px solid; border-right: 1px solid;"/>
</vbox>
<hbox align="center">
<label value="&calibrate.instructions;"/>
</hbox>
<hbox align="center">
<textbox id="horizSize" size="5"/>
<menulist id="units" persist="value">
<menupopup>
<menuitem value="centimetres" label="&units.centimetres;"/>
<menuitem value="inches" label="&units.inches;"/>
</menupopup>
</menulist>
</hbox>
</vbox>
</dialog>

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

@ -57,7 +57,6 @@ function GetFields()
dataObject.dataEls[ "selectLangs" ] = [];
dataObject.dataEls[ "selectLangs" ].value = document.getElementById( "selectLangs" ).value;
dataObject.fontDPI = document.getElementById( "screenResolution" ).value;
dataObject.useDocFonts = document.getElementById( "browserUseDocumentFonts" ).checked ? 1 : 0;
// save current state for language dependent fields and store
@ -89,28 +88,6 @@ function SetFields( aDataObject )
}
}
var screenResolution = document.getElementById( "screenResolution" );
var resolution;
if( "fontDPI" in aDataObject )
{
resolution = aDataObject.fontDPI;
}
else
{
prefvalue = parent.hPrefWindow.getPref( "int", "browser.display.screen_resolution" );
if( prefvalue != "!/!ERROR_UNDEFINED_PREF!/!" )
resolution = prefvalue;
else
resolution = 96; // If it all goes horribly wrong, fall back on 96.
}
setResolution( resolution );
if ( parent.hPrefWindow.getPrefIsLocked( "browser.display.screen_resolution" ) ) {
screenResolution.disabled = true;
}
var useDocFontsCheckbox = document.getElementById( "browserUseDocumentFonts" );
if( "useDocFonts" in aDataObject && aDataObject.useDocFonts != undefined )
useDocFontsCheckbox.checked = aDataObject.useDocFonts ? true : false;
@ -141,54 +118,6 @@ function Startup()
// eventually we should detect the default language and select it by default
selectLanguage();
// Allow user to ask the OS for a DPI if we are under X or OS/2
if ((navigator.appVersion.indexOf("X11") != -1) || (navigator.appVersion.indexOf("OS/2") != -1))
{
document.getElementById( "systemResolution" ).removeAttribute( "hidden" );
}
// Set up the labels for the standard issue resolutions
var resolution;
resolution = document.getElementById( "screenResolution" );
// Set an attribute on the selected resolution item so we can fall back on
// it if an invalid selection is made (select "Other...", hit Cancel)
resolution.selectedItem.setAttribute("current", "true");
var defaultResolution;
var otherResolution;
// On OS/2, 120 is the default system resolution.
// 96 is valid, but used only for for 640x480.
if (navigator.appVersion.indexOf("OS/2") != -1)
{
defaultResolution = "120";
otherResolution = "96";
document.getElementById( "arbitraryResolution" ).setAttribute( "hidden", "true" );
document.getElementById( "resolutionSeparator" ).setAttribute( "hidden", "true" );
} else {
defaultResolution = "96";
otherResolution = "72";
}
var dpi = resolution.getAttribute( "dpi" );
resolution = document.getElementById( "defaultResolution" );
resolution.setAttribute( "value", defaultResolution );
resolution.setAttribute( "label", dpi.replace(/\$val/, defaultResolution ) );
resolution = document.getElementById( "otherResolution" );
resolution.setAttribute( "value", otherResolution );
resolution.setAttribute( "label", dpi.replace(/\$val/, otherResolution ) );
// Get the pref and set up the dialog appropriately. Startup is called
// after SetFields so we can't rely on that call to do the business.
var prefvalue = parent.hPrefWindow.getPref( "int", "browser.display.screen_resolution" );
if( prefvalue != "!/!ERROR_UNDEFINED_PREF!/!" )
resolution = prefvalue;
else
resolution = 96; // If it all goes horribly wrong, fall back on 96.
setResolution( resolution );
// This prefstring is a contrived pref whose sole purpose is to lock some
// elements in this panel. The value of the pref is not used and does not matter.
if ( parent.hPrefWindow.getPrefIsLocked( "browser.display.languageList" ) ) {
@ -451,20 +380,16 @@ function saveFontPrefs()
}
// font scaling
var fontDPI = parseInt( dataObject.fontDPI );
var documentFonts = dataObject.useDocFonts;
var defaultFont = dataObject.defaultFont;
try
{
var currDPI = pref.getIntPref( "browser.display.screen_resolution" );
var currFonts = pref.getIntPref( "browser.display.use_document_fonts" );
}
catch(e)
{
}
if( currDPI != fontDPI )
pref.setIntPref( "browser.display.screen_resolution", fontDPI );
if( currFonts != documentFonts )
pref.setIntPref( "browser.display.use_document_fonts", documentFonts );
}
@ -560,101 +485,7 @@ function selectLanguage()
currentLanguage = languageList.value;
}
function changeScreenResolution()
{
var screenResolution = document.getElementById("screenResolution");
var userResolution = document.getElementById("userResolution");
var previousSelection = screenResolution.getElementsByAttribute("current", "true")[0];
if (screenResolution.value == "other")
{
// If the user selects "Other..." we bring up the calibrate screen dialog
var rv = { newdpi : -1 };
var calscreen = window.openDialog("chrome://communicator/content/pref/pref-calibrate-screen.xul",
"_blank",
"modal,chrome,centerscreen,resizable=no,titlebar",
rv);
if (rv.newdpi != -1)
{
// They have entered values, and we have a DPI value back
var dpi = screenResolution.getAttribute( "dpi" );
setResolution ( rv.newdpi );
previousSelection.removeAttribute("current");
screenResolution.selectedItem.setAttribute("current", "true");
}
else
{
// They've cancelled. We can't leave "Other..." selected, so...
// we re-select the previously selected item.
screenResolution.selectedItem = previousSelection;
}
}
else if (!(screenResolution.value == userResolution.value))
{
// User has selected one of the hard-coded resolutions
userResolution.setAttribute("hidden", "true");
previousSelection.removeAttribute("current");
screenResolution.selectedItem.setAttribute("current", "true");
}
}
function setResolution( resolution )
{
// Given a number, if it's equal to a hard-coded resolution we use that,
// otherwise we set the userResolution field.
var screenResolution = document.getElementById( "screenResolution" );
var userResolution = document.getElementById( "userResolution" );
var items = screenResolution.getElementsByAttribute( "value", resolution );
if (items.item(0))
{
// If it's one of the hard-coded values, we'll select it directly
screenResolution.selectedItem = items[0];
userResolution.setAttribute( "hidden", "true" );
}
else
{
// Otherwise we need to set up the userResolution field
var dpi = screenResolution.getAttribute( "dpi" );
userResolution.setAttribute( "value", resolution );
userResolution.setAttribute( "label", dpi.replace(/\$val/, resolution) );
userResolution.removeAttribute( "hidden" );
screenResolution.selectedItem = userResolution;
}
}
// "Calibrate screen" dialog code
function onOK()
{
// Get value from the dialog to work out dpi
var horizSize = parseFloat(document.getElementById("horizSize").value);
// We can't calculate anything without a proper value
if (!horizSize || horizSize < 0)
return true;
// Convert centimetres to inches.
// The magic number is allowed because it's a fundamental constant :-)
if (document.getElementById("units").value === "centimetres")
horizSize /= 2.54;
// These shouldn't change, but you can't be too careful.
var horizBarLengthPx = document.getElementById("horizRuler").boxObject.width;
var horizDPI = parseInt(horizBarLengthPx) / horizSize;
// Average the two <shrug>.
window.arguments[0].newdpi = Math.round(horizDPI);
return true;
}
// disable font items, but not the browserUseDocumentFonts checkbox nor the resolution
// menulist
// disable font items, but not the browserUseDocumentFonts checkbox
function disableAllFontElements()
{
var doc_ids = [ "selectLangs", "proportionalFont",

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

@ -293,31 +293,4 @@
accesskey="&useDocumentFonts.accesskey;"/>
</hbox>
<separator class="thin"/>
<hbox align="center">
<label value="&resolution.label;"
accesskey="&resolution.accesskey;"
control="screenResolution"/>
<menulist id="screenResolution"
oncommand="changeScreenResolution()"
dpi="&resolution.dpival;">
<menupopup>
<menuitem value=""
label="&resolution.dpival;"
id="otherResolution"/>
<menuitem value=""
label="&resolution.dpival;"
id="defaultResolution"/>
<menuitem value="0"
label="&resolution.system.label;"
id="systemResolution"
hidden="true"/>
<menuseparator id="resolutionSeparator"/>
<menuitem id="userResolution" hidden="true"/>
<menuitem id="arbitraryResolution" value="other" label="&resolution.other;"/>
</menupopup>
</menulist>
</hbox>
</page>

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

@ -78,19 +78,3 @@
<!-- LOCALIZATION NOTE (useDocFontDynamic): Translate 'Dynamic Fonts' according to Netscape Glossary -->
<!ENTITY useDocFontDynamic.label "Use all the fonts chosen by the page">
<!ENTITY useDocFontDynamic.accesskey "a">
<!-- font scaling -->
<!ENTITY resolution.label "Display resolution:">
<!ENTITY resolution.accesskey "r">
<!-- LOCALIZATION NOTE (resolution.dpi): dpi stands for "dots per inch" -->
<!ENTITY resolution.dpi "dpi">
<!-- LOCALIZATION NOTE (resolution.dpi): $val will be replaced by a numeric dpi value. -->
<!ENTITY resolution.dpival "$val &resolution.dpi;">
<!ENTITY resolution.system.label "System setting">
<!ENTITY resolution.other "Other...">
<!-- screen calibration dialog -->
<!ENTITY calibrateDialog.title "Calibrate Resolution">
<!ENTITY calibrate.instructions "The length of the line above is:">
<!ENTITY units.inches "inches">
<!ENTITY units.centimetres "centimeters">