bug 399031 - Convert xpfe prefpane to toolkit version (DOMi), p=aqualon@aquachan.de r=sdwilsh sr=Neil

This commit is contained in:
Robert Kaiser 2008-06-17 14:48:25 +02:00
parent b49c63f993
commit 31d9e4f2ed
7 changed files with 199 additions and 84 deletions

View File

@ -3,7 +3,7 @@ inspector.jar:
% overlay chrome://inspector/content/inspector.xul chrome://communicator/content/utilityOverlay.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
% overlay chrome://inspector/content/inspector.xul chrome://communicator/content/tasksOverlay.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
% overlay chrome://communicator/content/tasksOverlay.xul chrome://inspector/content/tasksOverlay.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
% overlay chrome://communicator/content/pref/preftree.xul chrome://inspector/content/prefs/prefsOverlay.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
% overlay chrome://communicator/content/pref/preferences.xul chrome://inspector/content/prefs/prefsOverlay.xul application={92650c4d-4b8e-4d2a-b7eb-24ecf4f6b63a}
% overlay chrome://browser/content/browser.xul chrome://inspector/content/tasksOverlay-ff.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
% overlay chrome://browser/content/macBrowserOverlay.xul chrome://inspector/content/tasksOverlay-ff.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
% overlay chrome://inspector/content/inspector.xul chrome://browser/content/baseMenuOverlay.xul application={ec8030f7-c20a-464f-9b0e-13a3a9e97384}
@ -61,6 +61,7 @@ inspector.jar:
content/inspector/jsutil/xul/inBaseTreeView.js (resources/content/jsutil/xul/inBaseTreeView.js)
content/inspector/jsutil/events/ObserverManager.js (resources/content/jsutil/events/ObserverManager.js)
content/inspector/prefs/pref-inspector.xul (resources/content/prefs/pref-inspector.xul)
content/inspector/prefs/pref-inspector.js (resources/content/prefs/pref-inspector.js)
content/inspector/prefs/prefsOverlay.xul (resources/content/prefs/prefsOverlay.xul)
content/inspector/prefs/pref-sidebar.js (resources/content/prefs/pref-sidebar.js)
content/inspector/tests/allskin.xul (resources/content/tests/allskin.xul)

View File

@ -45,10 +45,7 @@ VPATH=@srcdir@
include $(DEPTH)/config/autoconf.mk
ALL_LOCALES = \
de \
en-US \
fr \
sk \
$(NULL)
include $(topsrcdir)/config/config.mk

View File

@ -0,0 +1,77 @@
/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*-
* vim: ts=2 sw=2 sts=2
* ***** 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.org Code.
*
* Contributor(s):
* Bruno Escherl <aqualon@aquachan.de>
*
* Alternatively, the contents of this file may be used under the terms of
* either 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 ***** */
function Startup()
{
SidebarPrefs_initialize();
enableBlinkPrefs(document.getElementById("inspector.blink.on").value);
}
function enableBlinkPrefs(aTruth)
{
/*
* define the pair of label and control used in the prefpane to allow
* disabling of both elements, if a pref is locked.
*/
let els = {
lbElBorderColor: "cprElBorderColor",
lbElBorderWidth: "txfElBorderWidth",
lbElDuration: "txfElDuration",
lbElSpeed: "txfElSpeed",
"": "cbElInvert"
};
for (let [label, control] in Iterator(els)) {
let controlElem = document.getElementById(control);
// only remove disabled attribute, if pref isn't locked
if (aTruth && !isPrefLocked(controlElem)) {
controlElem.removeAttribute("disabled");
if (label)
document.getElementById(label).removeAttribute("disabled");
} else {
controlElem.setAttribute("disabled", true);
if (label)
document.getElementById(label).setAttribute("disabled", true);
}
}
}
function isPrefLocked(elem)
{
if (!elem.hasAttribute("preference"))
return false;
return document.getElementById(elem.getAttribute("preference")).locked;
}

View File

@ -1,63 +1,89 @@
<?xml version="1.0"?>
<!DOCTYPE page SYSTEM "chrome://inspector/locale/prefs.dtd">
<!-- ***** 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-1999
- the Initial Developer. All Rights Reserved.
-
- Contributor(s):
- Bruno Escherl <aqualon@aquachan.de>
-
- Alternatively, the contents of this file may be used under the terms of
- either 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 LGPL or the GPL. 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 ***** -->
<!DOCTYPE overlay SYSTEM "chrome://inspector/locale/prefs.dtd">
<?xml-stylesheet href="chrome://inspector/skin/"?>
<page id="winPref"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
headertitle="&Inspector.label;">
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<prefpane id="inspector_pane"
label="&Inspector.label;"
script="chrome://inspector/content/extensions/wsm-colorpicker.js
chrome://inspector/content/prefs/pref-inspector.js
chrome://inspector/content/prefs/pref-sidebar.js
chrome://inspector/content/jsutil/xpcom/XPCU.js
chrome://inspector/content/jsutil/rdf/RDFU.js">
<stringbundle id="inspector-bundle" src="chrome://inspector/locale/inspector.properties"/>
<stringbundle id="inspector-bundle" src="chrome://inspector/locale/inspector.properties"/>
<script type="application/x-javascript" src="chrome://inspector/content/extensions/wsm-colorpicker.js"/>
<script type="application/x-javascript" src="chrome://inspector/content/prefs/pref-sidebar.js"/>
<script type="application/x-javascript" src="chrome://inspector/content/jsutil/xpcom/XPCU.js"/>
<script type="application/x-javascript" src="chrome://inspector/content/jsutil/rdf/RDFU.js"/>
<preferences id="inspector_preferences">
<preference id="inspector.blink.on"
name="inspector.blink.on"
type="bool"
onchange="enableBlinkPrefs(this.value);"/>
<preference id="inspector.blink.border-color"
name="inspector.blink.border-color"
type="string"/>
<preference id="inspector.blink.border-width"
name="inspector.blink.border-width"
type="int"/>
<preference id="inspector.blink.duration"
name="inspector.blink.duration"
type="int"/>
<preference id="inspector.blink.speed"
name="inspector.blink.speed"
type="int"/>
<preference id="inspector.blink.invert"
name="inspector.blink.invert"
type="bool"/>
<!-- preference id="inspector.hooks.navigator"
name="inspector.hooks.navigator"
type="bool"/ -->
</preferences>
<script type="application/x-javascript"><![CDATA[
var _elementIDs = [
"cprElBorderColor",
"txfElBorderWidth",
"txfElDuration",
"txfElSpeed",
"cbElInvert",
"cbElOn"
];
function initFunction()
{
parent.initPanel("chrome://inspector/content/prefs/pref-inspector.xul");
enableBlinkPrefs(document.getElementById("cbElOn").checked);
}
AddColorPicker(initFunction);
function enableBlinkPrefs(aTruth)
{
var els = [
"lbElBorderColor", "cprElBorderColor",
"lbElBorderWidth", "txfElBorderWidth",
"lbElDuration", "txfElDuration",
"lbElSpeed", "txfElSpeed",
"cbElInvert"];
for (var i = 0; i < els.length; ++i) {
if (aTruth)
document.getElementById(els[i]).removeAttribute("disabled");
else
document.getElementById(els[i]).setAttribute("disabled", true);
}
}
]]></script>
<vbox id="bxGeneralPrefs">
<groupbox id="tbxBlink" flex="1">
<groupbox id="tbxBlink">
<caption label="&elementBlinking.label;"/>
<vbox>
<checkbox id="cbElOn" label="&blinkSelectedElement.label;" oncommand="enableBlinkPrefs(this.checked)"
preftype="bool" prefstring="inspector.blink.on" prefattribute="checked"/>
<checkbox id="cbElOn" label="&blinkSelectedElement.label;"
preference="inspector.blink.on"
accesskey="&blinkSelectedElement.accesskey;"/>
<grid>
<columns>
<column/>
@ -65,62 +91,75 @@
</columns>
<rows>
<row align="center">
<label id="lbElBorderColor" value="&borderColor.label;"/>
<label id="lbElBorderColor" control="cprElBorderColor"
value="&borderColor.label;"
accesskey="&borderColor.accesskey;"/>
<hbox align="center">
<colorpicker id="cprElBorderColor" type="button"
preftype="color" prefstring="inspector.blink.border-color" prefattribute="color"/>
preference="inspector.blink.border-color"/>
</hbox>
</row>
<row align="center">
<label id="lbElBorderWidth" value="&borderWidth.label;" control="txfElBorderWidth"/>
<label id="lbElBorderWidth" control="txfElBorderWidth"
value="&borderWidth.label;"
accesskey="&borderWidth.accesskey;"/>
<hbox align="center">
<textbox id="txfElBorderWidth" style="width: 4em"
preftype="int" prefstring="inspector.blink.border-width" prefattribute="value"/>
preference="inspector.blink.border-width"/>
<label value="&px.label;"/>
</hbox>
</row>
<row align="center">
<label id="lbElDuration" value="&blinkDuration.label;" control="txfElDuration"/>
<label id="lbElDuration" control="txfElDuration"
value="&blinkDuration.label;"
accesskey="&blinkDuration.accesskey;"/>
<hbox align="center">
<textbox id="txfElDuration" style="width: 4em"
preftype="int" prefstring="inspector.blink.duration" prefattribute="value"/>
preference="inspector.blink.duration"/>
<label value="&ms.label;"/>
</hbox>
</row>
<row align="center">
<label id="lbElSpeed" value="&blinkSpeed.label;" control="txfElSpeed"/>
<label id="lbElSpeed" control="txfElSpeed"
value="&blinkSpeed.label;"
accesskey="&blinkSpeed.accesskey;"/>
<hbox align="center">
<textbox id="txfElSpeed" style="width: 4em"
preftype="int" prefstring="inspector.blink.speed" prefattribute="value"/>
<label value="&ms.label;"/>
</hbox>
preference="inspector.blink.speed"/>
<label value="&ms.label;"/>
</hbox>
</row>
</rows>
</grid>
<vbox align="start">
<checkbox id="cbElInvert" label="&invertColors.label;"
preftype="bool" prefstring="inspector.blink.invert" prefattribute="checked"/>
preference="inspector.blink.invert"
accesskey="&invertColors.accesskey;"/>
</vbox>
</vbox>
</groupbox>
<groupbox id="tbxSidebar" flex="1">
<groupbox id="tbxSidebar">
<caption label="&Sidebar.label;"/>
<vbox flex="1">
<vbox id="bxSidebarInstall" flex="1">
<hbox>
<description id="txSidebarMsg" flex="1">&installHowTo.label;</description>
</hbox>
<button id="btnSidebarInstall" label="&install.label;" oncommand="sidebarPref.installSidebar()"/>
<button id="btnSidebarInstall" label="&install.label;"
oncommand="sidebarPref.installSidebar()"
accesskey="&install.accesskey;"/>
</vbox>
</vbox>
</groupbox>
<!--
<vbox>
<checkbox id="cbxNavIntegration" label="&addNavigatorHooks.label;"
preftype="bool" prefstring="inspector.hooks.navigator" prefattribute="checked"/>
preference="inspector.hooks.navigator"
accesskey="&addNavigatorHooks.accesskey;"/>
</vbox>
-->
</vbox>
</page>
</prefpane>
</overlay>

View File

@ -59,8 +59,6 @@ const kSidebarURL = "chrome://inspector/content/sidebar.xul";
//////////////////////////////////////////////////
window.addEventListener("load", SidebarPrefs_initialize, false);
function SidebarPrefs_initialize()
{
sidebarPref = new SidebarPrefs();

View File

@ -2,17 +2,12 @@
<!DOCTYPE overlay SYSTEM "chrome://inspector/locale/prefs.dtd">
<overlay id="ovPrefs"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<overlay xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul">
<treechildren id="advancedChildren">
<treeitem id="inspector">
<treerow>
<treecell class="treecell-indent" url="chrome://inspector/content/prefs/pref-inspector.xul" label="&Inspector.label;"/>
</treerow>
</treeitem>
<treeitem id="inspectorItem" label="&Inspector.label;"
prefpane="inspector_pane" helpTopic="advanced_pref_dom_inspector"
url="chrome://inspector/content/prefs/pref-inspector.xul"/>
</treechildren>
</overlay>

View File

@ -2,13 +2,21 @@
<!ENTITY Sidebar.label "Sidebar">
<!ENTITY elementBlinking.label "Element Blinking">
<!ENTITY blinkSelectedElement.label "Blink Selected Element">
<!ENTITY blinkSelectedElement.accesskey "B">
<!ENTITY borderColor.label "Border Color">
<!ENTITY borderColor.accesskey "C">
<!ENTITY borderWidth.label "Border Width">
<!ENTITY borderWidth.accesskey "W">
<!ENTITY px.label "(px)">
<!ENTITY blinkDuration.label "Blink Duration">
<!ENTITY blinkDuration.accesskey "D">
<!ENTITY ms.label "(ms)">
<!ENTITY blinkSpeed.label "Blink Speed">
<!ENTITY blinkSpeed.accesskey "S">
<!ENTITY invertColors.label "Invert Colors">
<!ENTITY invertColors.accesskey "v">
<!ENTITY installHowTo.label "The DOM Inspector Sidebar is not currently installed. Click the 'Install' button to add it to your Sidebar.">
<!ENTITY install.label "Install">
<!ENTITY install.accesskey "I">
<!ENTITY addNavigatorHooks.label "Add contextual menus to Navigator">
<!ENTITY addNavigatorHooks.accesskey "m">