Added support for prefs and string bundles for editor, various bug fixes, preliminary Horizontal Line dialog work
git-svn-id: svn://10.0.0.236/trunk@34343 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
@@ -21,3 +21,9 @@ function AppendStringToList(list, string)
|
||||
dump("Failed to create OPTION node. String content="+string+"\n");
|
||||
}
|
||||
}
|
||||
|
||||
// All dialogs share this simple method
|
||||
function onCancel()
|
||||
{
|
||||
window.close();
|
||||
}
|
||||
|
||||
38
mozilla/editor/ui/dialogs/content/EdHLineProps.js
Normal file
38
mozilla/editor/ui/dialogs/content/EdHLineProps.js
Normal file
@@ -0,0 +1,38 @@
|
||||
var appCore;
|
||||
var toolkitCore;
|
||||
var insertNew = true;
|
||||
|
||||
// dialog initialization code
|
||||
function Startup()
|
||||
{
|
||||
dump("Doing Startup...\n");
|
||||
// New method: parameters passed via window.openDialog, which puts
|
||||
// arguments in the array "arguments"
|
||||
var editorName = window.arguments[0];
|
||||
dump("Got editorAppCore called " + editorName + "\n");
|
||||
|
||||
// NEVER create an appcore here - we must find parent editor's
|
||||
appCore = XPAppCoresManager.Find(editorName);
|
||||
if(!appCore) {
|
||||
dump("EditorAppCore not found!!!\n");
|
||||
window.close();
|
||||
return;
|
||||
}
|
||||
dump("EditorAppCore found for HRule Properties dialog\n");
|
||||
|
||||
// Create dialog object to store controls for easy access
|
||||
dialog = new Object;
|
||||
// GET EACH CONTROL -- E.G.:
|
||||
//dialog.editBox = document.getElementById("editBox");
|
||||
// Can we get at just the edit field?
|
||||
dialog.AltText = document.getElementById("image.AltText");
|
||||
|
||||
//initDialog();
|
||||
|
||||
// SET FOCUS TO FIRST CONTROL
|
||||
//dialog.editBox.focus();
|
||||
}
|
||||
|
||||
function OnOK()
|
||||
{
|
||||
}
|
||||
68
mozilla/editor/ui/dialogs/content/EdHLineProps.xul
Normal file
68
mozilla/editor/ui/dialogs/content/EdHLineProps.xul
Normal file
@@ -0,0 +1,68 @@
|
||||
<?xml version="1.0"?>
|
||||
<?xml-stylesheet href="chrome://global/skin/xul.css" type="text/css"?>
|
||||
<?xml-stylesheet href="chrome://editordlgs/skin/EditorDialog.css" type="text/css"?>
|
||||
<!DOCTYPE window>
|
||||
<!-- dialog containing a control requiring initial setup -->
|
||||
<xul:window width="280" height="305" title="Horizontal Line Properties"
|
||||
xmlns:xul ="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
|
||||
xmlns="http://www.w3.org/TR/REC-html40"
|
||||
onload = "Startup()">
|
||||
|
||||
<!-- Methods common to all editor dialogs -->
|
||||
<script language="JavaScript" src="chrome://editordlgs/content/EdDialogCommon.js">
|
||||
</script>
|
||||
<script language="JavaScript" src="chrome://editordlgs/content/EdHLineProps.js">
|
||||
</script>
|
||||
<table width="95%">
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<fieldset><legend align="left">Dimensions</legend>
|
||||
<table>
|
||||
<tr>
|
||||
<td align="right">
|
||||
Height:
|
||||
</td>
|
||||
<td colspan="2">
|
||||
<input type="text" id="width" size="4" maxlength="4"/>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Width:
|
||||
</td>
|
||||
<td>
|
||||
<input type="text" id="width" size="4" maxlength="4"/>
|
||||
</td>
|
||||
<td>
|
||||
<xul:titledbutton class="push popup" id="PixelOrPercent" value="pixels" align="left" />
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2">
|
||||
<fieldset><legend align="left">Alignment</legend>
|
||||
<label><input type="radio" name="HRuleAlign" id="leftAlign"/>Left</label>
|
||||
<label><input type="radio" name="HRuleAlign" id="centerAlign"/>Center</label>
|
||||
<label><input type="radio" name="HRuleAlign" id="rightAlign"/>Right</label>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<label><input type="checkbox" id="3dShading"/>3-D Shading</label>
|
||||
</td>
|
||||
<td align="right">
|
||||
<button id="SaveDefault">Save settings as default</button>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align="right">
|
||||
<button class="spaced" id="OK" onclick="onOK()">OK</button>
|
||||
<button class="spaced" id="Cancel" onclick="onCancel()" width="50">Cancel</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</xul:window>
|
||||
@@ -1,20 +1,16 @@
|
||||
// OnOK(), Undo(), and Cancel() are in EdDialogCommon.js
|
||||
// applyChanges() must be implemented here
|
||||
|
||||
var appCore;
|
||||
var insertNew = true;
|
||||
var imageWasInserted = false;
|
||||
var undoCount = 0;
|
||||
var imageElement;
|
||||
var tagName = "img"
|
||||
var advanced = false;
|
||||
var advanced = true;
|
||||
|
||||
// dialog initialization code
|
||||
function Startup()
|
||||
{
|
||||
dump("Doing Startup...\n");
|
||||
|
||||
// New metho: parameters passed via window.openDialog, which puts
|
||||
// New method: parameters passed via window.openDialog, which puts
|
||||
// arguments in the array "arguments"
|
||||
var editorName = window.arguments[0];
|
||||
dump("Got editorAppCore called " + editorName + "\n");
|
||||
@@ -37,9 +33,14 @@ function Startup()
|
||||
dialog.AdvancedButton = document.getElementById("AdvancedButton");
|
||||
dialog.AdvancedRow = document.getElementById("AdvancedRow");
|
||||
|
||||
// Start in "basic" mode
|
||||
dialog.AdvancedRow.style.display = "none";
|
||||
|
||||
// Start in the mode initialized in the "advanced" var above
|
||||
// THIS IS NOT WORKING NOW - After switching to "basic" mode,
|
||||
// then back to
|
||||
if (advanced) {
|
||||
dialog.AdvancedRow.style.visibility = "visible";
|
||||
} else {
|
||||
dialog.AdvancedRow.style.visibility = "collapse";
|
||||
}
|
||||
|
||||
if (null == dialog.srcInput ||
|
||||
null == dialog.altTextInput )
|
||||
@@ -91,48 +92,38 @@ function chooseFile()
|
||||
|
||||
function onAdvanced()
|
||||
{
|
||||
if (dialog.AdvancedRow) {
|
||||
dump("AdvancedRow still exists ****\n");
|
||||
}
|
||||
|
||||
if (advanced) {
|
||||
dump("Changing to BASIC mode\n");
|
||||
advanced = false;
|
||||
// BUG: This works to hide the row, but
|
||||
// setting visibility to "show" doesn't bring it back
|
||||
//dialog.AdvancedRow.style.visibility = "collapse";
|
||||
dialog.AdvancedRow.style.display = "none";
|
||||
dialog.AdvancedRow.style.visibility = "collapse";
|
||||
//dialog.AdvancedRow.style.display = "none";
|
||||
} else {
|
||||
dump("Changing to ADVANCED mode\n");
|
||||
advanced = true;
|
||||
dialog.AdvancedRow.style.display = "table-row";
|
||||
//dialog.AdvancedRow.style.display = "table-row";
|
||||
dialog.AdvancedRow.style.visibility = "visible";
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
function onOK() {
|
||||
if (applyChanges()) {
|
||||
if (imageWasInserted) {
|
||||
// We selected the object, undo it by
|
||||
// setting caret to just after the inserted element
|
||||
appCore.setCaretAfterElement(imageElement);
|
||||
}
|
||||
window.close();
|
||||
}
|
||||
function SelectWidthUnits()
|
||||
{
|
||||
list = document.getElementByID("WidthUnits");
|
||||
value = list.options[list.selectedIndex].value;
|
||||
dump("Selected item: "+value+"\n");
|
||||
}
|
||||
|
||||
function onCancel() {
|
||||
// Undo all actions performed within the dialog
|
||||
// TODO: We need to suppress reflow/redraw untill all levels are undone
|
||||
while (undoCount > 0) {
|
||||
onUndo();
|
||||
}
|
||||
window.close();
|
||||
function OnChangeSrc()
|
||||
{
|
||||
dump("*** Changed SRC field\n");
|
||||
}
|
||||
|
||||
function applyChanges()
|
||||
function onOK()
|
||||
{
|
||||
// TODO: BE SURE Src AND AltText are completed!
|
||||
|
||||
imageElement.setAttribute("src",dialog.srcInput.value);
|
||||
// We must convert to "file:///" format else image doesn't load!
|
||||
imageElement.setAttribute("alt",dialog.altTextInput.value);
|
||||
@@ -145,9 +136,10 @@ function applyChanges()
|
||||
// when dialog closes
|
||||
imageWasInserted = true;
|
||||
}
|
||||
// Reinitialize dialog data
|
||||
initDialog();
|
||||
|
||||
// TODO: Return false if any data validation tests fail
|
||||
return true;
|
||||
}
|
||||
if (imageWasInserted) {
|
||||
// We selected the object, undo it by
|
||||
// setting caret to just after the inserted element
|
||||
appCore.setCaretAfterElement(imageElement);
|
||||
}
|
||||
window.close();
|
||||
}
|
||||
|
||||
@@ -22,11 +22,11 @@
|
||||
<td colspan="2">
|
||||
<fieldset><legend align="left">Image Information </legend>
|
||||
<p class="smallmargin">Enter a remote URL or local file: </p>
|
||||
<input type="text" size="20" length="20" id="image.srcInput" />
|
||||
<input type="text" size="20" length="20" id="image.srcInput" onchange="OnChangeSrc()"/>
|
||||
<button class="ChooseFile" id="ChooseFile" onclick="chooseFile()">Choose File...</button>
|
||||
<br/>
|
||||
<p class="smallmargin">Alternative Text</p>
|
||||
<input type="text" size="30" length="30" id="image.altTextInput" />
|
||||
<input type="text" size="30" id="image.altTextInput" />
|
||||
</fieldset>
|
||||
</td>
|
||||
<td/>
|
||||
@@ -40,19 +40,24 @@
|
||||
<tr id="AdvancedRow">
|
||||
<td height="60">
|
||||
<fieldset><legend align="left">Dimensions </legend>
|
||||
Put size controls here
|
||||
<select id="WidthUnits" size="1" onchange="SelectWidthUnits()">
|
||||
<option>pixels</option>
|
||||
<option>percent</option>
|
||||
</select>
|
||||
</fieldset>
|
||||
</td>
|
||||
<td height="60">
|
||||
<fieldset><legend align="left">Spacing </legend>
|
||||
Put spacing controls here
|
||||
Put spacing controls here<br/>
|
||||
<button>Button</button>
|
||||
<input type="radio">Radio button</input>
|
||||
<input type="Checkbox">Checkbox</input>
|
||||
</fieldset>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="2" align = "right">
|
||||
<button class="spaced" id="OK" onclick="onOK()" width="50">OK</button>
|
||||
<button class="spaced" id="Preview" onclick="applyChanges()" width="50">Preview</button>
|
||||
<button class="spaced" id="Cancel" onclick="onCancel()" width="50">Cancel</button>
|
||||
</td>
|
||||
<td/>
|
||||
|
||||
@@ -1,12 +1,8 @@
|
||||
// OnOK(), Undo(), and Cancel() are in EdDialogCommon.js
|
||||
// applyChanges() must be implemented here
|
||||
|
||||
var appCore;
|
||||
var anchorElement = null;
|
||||
var insertNew = true;
|
||||
var needLinkText = false;
|
||||
var selection;
|
||||
var undoCount = 0;
|
||||
var insertLinkAroundSelection = false;
|
||||
|
||||
// NOTE: Use "HREF" instead of "A" to distinguish from Named Anchor
|
||||
@@ -127,23 +123,10 @@ function chooseFile()
|
||||
dialog.hrefInput.focus();
|
||||
}
|
||||
|
||||
function onOK() {
|
||||
if (applyChanges()) {
|
||||
window.close();
|
||||
}
|
||||
}
|
||||
|
||||
function onCancel() {
|
||||
// Undo all actions performed within the dialog
|
||||
// TODO: We need to suppress reflow/redraw untill all levels are undone
|
||||
while (undoCount > 0) {
|
||||
onUndo();
|
||||
}
|
||||
window.close();
|
||||
}
|
||||
|
||||
function applyChanges()
|
||||
function onOK()
|
||||
{
|
||||
// TODO: VALIDATE FIELDS BEFORE COMMITING CHANGES
|
||||
|
||||
// Coalesce into one undo transaction
|
||||
appCore.beginBatchChanges();
|
||||
|
||||
@@ -167,12 +150,8 @@ function applyChanges()
|
||||
dump("Setting link around selected text\n");
|
||||
appCore.insertLinkAroundSelection(anchorElement);
|
||||
}
|
||||
undoCount = undoCount + 1;
|
||||
appCore.endBatchChanges();
|
||||
|
||||
// Reinitialize dialog data
|
||||
initDialog();
|
||||
|
||||
// TODO: Return false if any data validation tests fail
|
||||
return true;
|
||||
window.close();
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,6 @@
|
||||
<tr>
|
||||
<td align = "right">
|
||||
<button class="spaced" id="OK" onclick="onOK()" width="50">OK</button>
|
||||
<button class="spaced" id="Preview" onclick="applyChanges()" width="50">Preview</button>
|
||||
<button class="spaced" id="Cancel" onclick="onCancel()" width="50">Cancel</button>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@@ -152,11 +152,6 @@ function Close()
|
||||
window.close();
|
||||
}
|
||||
|
||||
function Help()
|
||||
{
|
||||
dump("SpellCheck: Help me Rhonda, help, help me Rhonda\n");
|
||||
}
|
||||
|
||||
function FillSuggestedList(firstWord)
|
||||
{
|
||||
list = dialog.suggestedList;
|
||||
|
||||
@@ -83,7 +83,7 @@
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
<td colspan="2">
|
||||
<select class="SpellCheckLanguage" id="LanguageList" size="1" onchange="SelectLanguage()">
|
||||
<option>English
|
||||
</option>
|
||||
@@ -92,9 +92,6 @@
|
||||
<td>
|
||||
<button id="Close" onclick="Close()">Close</button>
|
||||
</td>
|
||||
<td>
|
||||
<button id="Help" onclick="Help()">Help</button>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</xul:window>
|
||||
|
||||
@@ -2,8 +2,8 @@
|
||||
#dialogs:content directory
|
||||
|
||||
EdDialogCommon.js
|
||||
EdCharacterProps.xul
|
||||
EdCharacterProps.js
|
||||
EdHLineProps.xul
|
||||
EdHLineProps.js
|
||||
EdImageProps.xul
|
||||
EdImageProps.js
|
||||
EdLinkProps.js
|
||||
|
||||
@@ -29,11 +29,11 @@ include $(topsrcdir)/config/rules.mk
|
||||
EXPORT_RESOURCE_CONTENT = \
|
||||
$(srcdir)/EdDialogCommon.js \
|
||||
$(srcdir)/EdLinkProps.xul \
|
||||
$(srcdir)/EdImageProps.xul \
|
||||
$(srcdir)/EdCharacterProps.xul \
|
||||
$(srcdir)/EdLinkProps.js \
|
||||
$(srcdir)/EdImageProps.xul \
|
||||
$(srcdir)/EdImageProps.js \
|
||||
$(srcdir)/EdCharacterProps.js \
|
||||
$(srcdir)/EdHLineProps.xul \
|
||||
$(srcdir)/EdHLineProps.js \
|
||||
$(srcdir)/EdSpellCheck.xul \
|
||||
$(srcdir)/EdSpellCheck.js \
|
||||
$(NULL)
|
||||
|
||||
@@ -25,10 +25,10 @@ install::
|
||||
$(MAKE_INSTALL) EdLinkProps.js $(DIST)\bin\chrome\editor\dialogs\content\default
|
||||
$(MAKE_INSTALL) EdImageProps.xul $(DIST)\bin\chrome\editor\dialogs\content\default
|
||||
$(MAKE_INSTALL) EdImageProps.js $(DIST)\bin\chrome\editor\dialogs\content\default
|
||||
$(MAKE_INSTALL) EdCharacterProps.xul $(DIST)\bin\chrome\editor\dialogs\content\default
|
||||
$(MAKE_INSTALL) EdCharacterProps.js $(DIST)\bin\chrome\editor\dialogs\content\default
|
||||
$(MAKE_INSTALL) EdSpellCheck.xul $(DIST)\bin\chrome\editor\dialogs\content\default
|
||||
$(MAKE_INSTALL) EdSpellCheck.js $(DIST)\bin\chrome\editor\dialogs\content\default
|
||||
$(MAKE_INSTALL) EdHLineProps.xul $(DIST)\bin\chrome\editor\dialogs\content\default
|
||||
$(MAKE_INSTALL) EdHLineProps.js $(DIST)\bin\chrome\editor\dialogs\content\default
|
||||
$(MAKE_INSTALL) EdSpellCheck.xul $(DIST)\bin\chrome\editor\dialogs\content\default
|
||||
$(MAKE_INSTALL) EdSpellCheck.js $(DIST)\bin\chrome\editor\dialogs\content\default
|
||||
|
||||
clobber::
|
||||
rm -f $(DIST)\bin\chrome\editor\dialogs\content\default\EdDialogCommon.js
|
||||
@@ -36,7 +36,7 @@ clobber::
|
||||
rm -f $(DIST)\bin\chrome\editor\dialogs\content\default\EdLinkProps.js
|
||||
rm -f $(DIST)\bin\chrome\editor\dialogs\content\default\EdImageProps.xul
|
||||
rm -f $(DIST)\bin\chrome\editor\dialogs\content\default\EdImageProps.js
|
||||
rm -f $(DIST)\bin\chrome\editor\dialogs\content\default\EdCharacterProps.xul
|
||||
rm -f $(DIST)\bin\chrome\editor\dialogs\content\default\EdCharacterProps.js
|
||||
rm -f $(DIST)\bin\chrome\editor\dialogs\content\default\EdHLineProps.xul
|
||||
rm -f $(DIST)\bin\chrome\editor\dialogs\content\default\EdHLineProps.js
|
||||
rm -f $(DIST)\bin\chrome\editor\dialogs\content\default\EdSpellCheck.xul
|
||||
rm -f $(DIST)\bin\chrome\editor\dialogs\content\default\EdSpellCheck.js
|
||||
|
||||
Reference in New Issue
Block a user