зеркало из https://github.com/mozilla/gecko-dev.git
Adding select lists for dynamic font menu
Removing dynamic from the font pane. r=don 24830, 26077, 26176, 24753, 24754
This commit is contained in:
Родитель
e383432741
Коммит
45ee07f94f
|
@ -24,15 +24,15 @@ langs = [
|
|||
];
|
||||
generics = [
|
||||
"serif",
|
||||
"sans-serif",
|
||||
"cursive",
|
||||
"fantasy",
|
||||
// "sans-serif",
|
||||
// "cursive",
|
||||
// "fantasy",
|
||||
"monospace"
|
||||
];
|
||||
|
||||
function startUp()
|
||||
{
|
||||
|
||||
|
||||
selectLangs = document.getElementById("selectLangs");
|
||||
for (i = 0; i < langs.length; i++) {
|
||||
option = document.createElement("html:option");
|
||||
|
@ -40,48 +40,147 @@ function startUp()
|
|||
option.appendChild(text);
|
||||
selectLangs.appendChild(option);
|
||||
option.setAttribute('value' , langs[i]);
|
||||
|
||||
}
|
||||
|
||||
selectLangs.value = "x-western";
|
||||
selectLang();
|
||||
}
|
||||
|
||||
|
||||
|
||||
function get() {
|
||||
dump('\n pref: ' + document.getElementById('serif').getAttribute('pref') + '\n');
|
||||
dump('\n pref: ' + document.getElementById('serif').getAttribute('preftype') + '\n');
|
||||
dump('\n element: ' + document.getElementById('serif').getAttribute('prefstring') + '\n');
|
||||
dump('***');
|
||||
dump('\n Size pref: ' + document.getElementById('size').getAttribute('pref') + '\n');
|
||||
dump('\n Size pref: ' + document.getElementById('size').getAttribute('preftype') + '\n');
|
||||
dump('\n Size element: ' + document.getElementById('size').getAttribute('prefstring') + '\n');
|
||||
dump('\n Value element: ' + document.getElementById('size').value + '\n');
|
||||
}
|
||||
|
||||
|
||||
//Clears select list
|
||||
function ClearList(list)
|
||||
{
|
||||
if (list) {
|
||||
dump(list.length + " \n");
|
||||
list.selectedIndex = -1;
|
||||
for( j=list.length-1; j >= 0; j--) {
|
||||
dump(list + " \n");
|
||||
list.remove(j);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
function AppendStringToListByID(list, stringID)
|
||||
{
|
||||
AppendStringToList(list, editorShell.GetString(stringID));
|
||||
}
|
||||
|
||||
function AppendStringToList(list, string)
|
||||
{
|
||||
// THIS DOESN'T WORK! Result is a XULElement -- namespace problem
|
||||
// optionNode1 = document.createElement("option");
|
||||
// This works - Thanks to Vidur! Params = name, value
|
||||
optionNode = new Option(string, string);
|
||||
|
||||
if (optionNode) {
|
||||
list.add(optionNode, null);
|
||||
} else {
|
||||
dump("Failed to create OPTION node. String content="+string+"\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function selectLang()
|
||||
{
|
||||
//get pref services
|
||||
var pref = null;
|
||||
try
|
||||
{
|
||||
pref = Components.classes["component://netscape/preferences"];
|
||||
if (pref) pref = pref.getService();
|
||||
if (pref) pref = pref.QueryInterface(Components.interfaces.nsIPref);
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
dump("failed to get prefs service!\n");
|
||||
pref = null;
|
||||
}
|
||||
|
||||
|
||||
//Getting variables needed
|
||||
lang = document.getElementById("selectLangs").value;
|
||||
var fontSizePrefint = 'font.size.variable.' + lang;
|
||||
var fontSizePrefFontint = 'font.size.fixed.' + lang;
|
||||
document.getElementById('size').setAttribute('prefstring', fontSizePrefint);
|
||||
document.getElementById('sizeFixed').setAttribute('prefstring', fontSizePrefFontint);
|
||||
//set prefstring of size
|
||||
var fontVarPref = 'font.size.variable.' + lang;
|
||||
var fontfixPref = 'font.size.fixed.' + lang;
|
||||
var sizeVar = document.getElementById('size');
|
||||
var sizeFix = document.getElementById('sizeFixed');
|
||||
sizeVar.setAttribute('prefstring', fontVarPref);
|
||||
sizeFix.setAttribute('prefstring', fontfixPref);
|
||||
|
||||
//Get size from the preferences
|
||||
var fixedFont = null;
|
||||
try
|
||||
{
|
||||
if (pref)
|
||||
{
|
||||
var fontVarInt = pref.GetIntPref(fontVarPref);
|
||||
var fontfixInt = pref.GetIntPref(fontfixPref);
|
||||
}
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
//Default to 16 and 14 if no size is in the pref
|
||||
fixedFont = null;
|
||||
fontVarInt = "16"
|
||||
fontfixInt = "14"
|
||||
}
|
||||
|
||||
dump(fixedFont + "\n");
|
||||
|
||||
|
||||
|
||||
|
||||
for (i = 0; i < generics.length; i++) {
|
||||
var select = document.getElementById(generics[i]);
|
||||
var selectParent = select.parentNode;
|
||||
var selectNew = select.cloneNode(false);
|
||||
//create name of font prefstring
|
||||
var fontPrefstring = 'font.name.' + generics[i] + '.' + lang;
|
||||
selectNew.setAttribute('prefstring', fontPrefstring);
|
||||
// dump('selectNew:' + selectNew.getAttribute('prefstring'));
|
||||
fonts = enumerator.EnumerateFonts(lang, generics[i], fontCount);
|
||||
|
||||
select.setAttribute('prefstring', fontPrefstring);
|
||||
//Clear the select list
|
||||
ClearList(select);
|
||||
|
||||
|
||||
fonts = enumerator.EnumerateFonts(lang, generics[i], fontCount);
|
||||
//Append to the select list. Build the new select list
|
||||
for (j = 0; j < fonts.length; j++) {
|
||||
var option = document.createElement("html:option");
|
||||
var text = document.createTextNode(fonts[j]);
|
||||
option.appendChild(text);
|
||||
option.setAttribute('value' , fonts[j]);
|
||||
selectNew.appendChild(option);
|
||||
// dump(fonts[j] + " || ");
|
||||
|
||||
AppendStringToList(select, fonts[j])
|
||||
}
|
||||
|
||||
//Get the pref value of the font
|
||||
var fixedFont = null;
|
||||
try
|
||||
{
|
||||
if (pref)
|
||||
{
|
||||
var selectVal = pref.CopyCharPref(fontPrefstring);
|
||||
}
|
||||
}
|
||||
catch(ex)
|
||||
{
|
||||
selectVal = fonts[0];
|
||||
}
|
||||
|
||||
selectParent.replaceChild(selectNew , select);
|
||||
//dump('select:' + document.getElementById(generics[i]).getAttribute('prefstring') + '\n');
|
||||
dump(fixedFont + "\n");
|
||||
//select the value of the string
|
||||
select.value = selectVal;
|
||||
dump('select:' + select.getAttribute('prefstring') + "\n");
|
||||
|
||||
}
|
||||
//set the value of the sizes
|
||||
sizeVar.value = fontVarInt;
|
||||
sizeFix.value = fontfixInt;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
Contributor(s):
|
||||
-->
|
||||
<?xml-stylesheet href="chrome://pref/skin/" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://pref/skin/pref.css" type="text/css"?>
|
||||
<?xul-overlay href="chrome://pref/content/fontScalingOverlay.xul"?>
|
||||
|
||||
<!DOCTYPE window SYSTEM "chrome://pref/locale/pref-fonts.dtd" >
|
||||
|
@ -45,12 +46,13 @@
|
|||
<html:tr>
|
||||
<html:td>&fontsFor.select;</html:td>
|
||||
<html:td>
|
||||
<html:select id="selectLangs" onchange = "selectLang();">
|
||||
<html:select class="Font" id="selectLangs" onchange = "selectLang();" width = "10">
|
||||
</html:select>
|
||||
</html:td>
|
||||
<html:td>&varFont.select;</html:td>
|
||||
<html:td>
|
||||
<html:select id="size" pref="true" preftype="int">
|
||||
|
||||
<html:select class="FontSize" id="size" pref="true" preftype="int">
|
||||
<html:option value="&font8.option;" >&font8.option;</html:option>
|
||||
<html:option value="&font9.option;" >&font9.option;</html:option>
|
||||
<html:option value="&font10.option;" >&font10.option;</html:option>
|
||||
|
@ -74,21 +76,21 @@
|
|||
<html:tr>
|
||||
<html:td>&serif.select;</html:td>
|
||||
<html:td>
|
||||
<html:select id="serif" pref="true" preftype="string">
|
||||
<html:select class="Font" id="serif" pref="true" preftype="string">
|
||||
</html:select>
|
||||
</html:td>
|
||||
|
||||
</html:tr>
|
||||
|
||||
<html:tr>
|
||||
<html:td>&sans-serif.select;</html:td>
|
||||
<!-- <html:tr>
|
||||
<html:td>&sans-serif.select;</html:td>
|
||||
<html:td>
|
||||
<html:select id="sans-serif" pref="true" preftype="string" prefstring="">
|
||||
</html:select>
|
||||
</html:td>
|
||||
</html:tr>
|
||||
|
||||
<html:tr>
|
||||
<html:tr>
|
||||
<html:td>&cursive.select;</html:td>
|
||||
<html:td>
|
||||
<html:select id="cursive" pref="true" preftype="string" prefstring="">
|
||||
|
@ -103,17 +105,17 @@
|
|||
</html:select>
|
||||
</html:td>
|
||||
|
||||
</html:tr>
|
||||
</html:tr> -->
|
||||
|
||||
<html:tr>
|
||||
<html:td>&monospace.select;</html:td>
|
||||
<html:td>
|
||||
<html:select id="monospace" pref="true" preftype="string" prefstring="">
|
||||
<html:select class="Font" id="monospace" pref="true" preftype="string" prefstring="">
|
||||
</html:select>
|
||||
</html:td>
|
||||
<html:td>&fixedFont.Select;</html:td>
|
||||
<html:td>
|
||||
<html:select id="sizeFixed" pref="true" preftype="int">
|
||||
<html:select class="FontSize" id="sizeFixed" pref="true" preftype="int">
|
||||
<html:option value="&font8.option;" >&font8.option;</html:option>
|
||||
<html:option value="&font9.option;" >&font9.option;</html:option>
|
||||
<html:option value="&font10.option;" >&font10.option;</html:option>
|
||||
|
@ -134,18 +136,10 @@
|
|||
</html:td>
|
||||
</html:tr>
|
||||
</html:table>
|
||||
</html:fieldset>
|
||||
|
||||
</html:fieldset>
|
||||
<!-- fonts with webpages -->
|
||||
<html:fieldset>
|
||||
<html:legend>&header2;</html:legend>
|
||||
<html:div>
|
||||
<html:input name="fonts" type="radio" id="browserUseDocumentFonts2"
|
||||
pref="true" preftype="int" prefindex="2" prefstring="browser.use_document_fonts"/>
|
||||
<html:label for="browserUseDocumentFonts2" accesskey="t" tabindex="0">
|
||||
&useDocFontDynamic;
|
||||
</html:label>
|
||||
</html:div>
|
||||
<html:div>
|
||||
<html:input name="fonts" type="radio" id="browserUseDocumentFonts1"
|
||||
pref="true" preftype="int" prefindex="1" prefstring="browser.use_document_fonts"/>
|
||||
|
|
|
@ -40,9 +40,9 @@
|
|||
<!ENTITY header2 "When a webpage chooses its own fonts">
|
||||
<!ENTITY useDefaultFont "Use my default fonts, ignoring the fonts the page has chosen">
|
||||
<!-- LOCALIZATION NOTE (useDocFontNonDynamic): Translate 'Dynamic Fonts' according to Netscape Glossary -->
|
||||
<!ENTITY useDocFontNonDynamic "Use the fonts chosen by the page, but ignore Dynamic Fonts">
|
||||
<!ENTITY useDocFontNonDynamic "Use the fonts chosen by the page">
|
||||
<!-- LOCALIZATION NOTE (useDocFontDynamic): Translate 'Dynamic Fonts' according to Netscape Glossary -->
|
||||
<!ENTITY useDocFontDynamic "Use all the fonts chosen by the page, including Dynamic Fonts">
|
||||
<!ENTITY useDocFontDynamic "Use all the fonts chosen by the page">
|
||||
<!-- font scaling -->
|
||||
<!ENTITY fontScaling "Font Scaling">
|
||||
<!ENTITY fontScalingIntro "Choose a resolution at which fonts will be displayed. A larger value can improve text visibility on some computers.">
|
||||
|
|
Загрузка…
Ссылка в новой задаче