diff --git a/mozilla/editor/ui/composer/content/ComposerCommands.js b/mozilla/editor/ui/composer/content/ComposerCommands.js index 25347126916..014bb1bf7bf 100644 --- a/mozilla/editor/ui/composer/content/ComposerCommands.js +++ b/mozilla/editor/ui/composer/content/ComposerCommands.js @@ -141,6 +141,7 @@ function SetupComposerWindowCommands() commandManager.registerCommand("cmd_revert", nsRevertCommand); commandManager.registerCommand("cmd_openRemote", nsOpenRemoteCommand); commandManager.registerCommand("cmd_preview", nsPreviewCommand); + commandManager.registerCommand("cmd_editSendPage", nsSendPageCommand); commandManager.registerCommand("cmd_quit", nsQuitCommand); commandManager.registerCommand("cmd_close", nsCloseCommand); commandManager.registerCommand("cmd_preferences", nsPreferencesCommand); @@ -392,9 +393,9 @@ function CloseWindow() { FinishHTMLSource(); - // Close window; check to make sure document is saved - var result = CheckAndSaveDocument(window.editorShell.GetString("BeforeClosing")); - if (result == true) // If they saved the document, or it is unchanged, exit + // Check to make sure document is saved. "true" means allow "Don't Save" button, + // so user can choose to close without saving + if (CheckAndSaveDocument(window.editorShell.GetString("BeforeClosing"), true)) { if (window.InsertCharWindow) SwitchInsertCharToAnotherEditorOrClose(); @@ -441,31 +442,51 @@ var nsPreviewCommand = { isCommandEnabled: function(aCommand, dummy) { - // maybe disable if we haven't saved? - // return (window.editorShell && !window.editorShell.documentModified); - return (window.editorShell != null); + return (window.editorShell != null && (DocumentHasBeenSaved() || window.editorShell.documentModified)); }, doCommand: function(aCommand) { FinishHTMLSource(); + // Don't continue if user canceled during prompt for saving - if (!CheckAndSaveDocument(window.editorShell.GetString("BeforePreview"))) + // DocumentHasBeenSaved will test if we have a URL and suppress "Don't Save" button if not + if (!CheckAndSaveDocument(window.editorShell.GetString("BeforePreview"), DocumentHasBeenSaved())) return; - var fileurl = ""; - try { - fileurl = window._content.location; - } catch (e) { - return; - } + // Check if we saved again just in case? + if (DocumentHasBeenSaved()) + window.openDialog(getBrowserURL(), "EditorPreview", "chrome,all,dialog=no", window._content.location); + } +}; - // CheckAndSave doesn't tell us if the user said "Don't Save", - // so make sure we have a url: - if (fileurl != "" && fileurl != "about:blank") - { - window.openDialog(getBrowserURL(), "EditorPreview", "chrome,all,dialog=no", fileurl); - } +//----------------------------------------------------------------------------------- +var nsSendPageCommand = +{ + isCommandEnabled: function(aCommand, dummy) + { + return (window.editorShell != null && (DocumentHasBeenSaved() || window.editorShell.documentModified)); + }, + + doCommand: function(aCommand) + { + FinishHTMLSource(); + + // Don't continue if user canceled during prompt for saving + // DocumentHasBeenSaved will test if we have a URL and suppress "Don't Save" button if not + if (!CheckAndSaveDocument(window.editorShell.GetString("SendPageReason"), DocumentHasBeenSaved())) + return; + + // Check if we saved again just in case? + if (DocumentHasBeenSaved()) + { + // Lauch Messenger Composer window with current page as contents + var pageTitle = window.editorShell.editorDocument.title; + var pageUrl = window.editorShell.editorDocument.location; + window.openDialog("chrome://messenger/content/messengercompose/messengercompose.xul", "_blank", + "chrome,all,dialog=no", "attachment='" + pageUrl + "',body='" + pageUrl + + "',subject='" + pageTitle + "',bodyislink=true"); + } } }; @@ -765,7 +786,7 @@ var nsPagePropertiesCommand = }, doCommand: function(aCommand) { - window.openDialog("chrome://editor/content/EdPageProps.xul","_blank", "chrome,close,titlebar,modal,resizable", ""); + window.openDialog("chrome://editor/content/EdPageProps.xul","_blank", "chrome,close,titlebar,modal", ""); } }; diff --git a/mozilla/editor/ui/composer/content/editor.js b/mozilla/editor/ui/composer/content/editor.js index 15f2d0407ad..fb03e6487b6 100644 --- a/mozilla/editor/ui/composer/content/editor.js +++ b/mozilla/editor/ui/composer/content/editor.js @@ -342,49 +342,29 @@ function editorSendPage() "chrome,all,dialog=no", "attachment='" + pageUrl + "',body='" + pageUrl + "',subject='" + pageTitle + "',bodyislink=true"); } - else if (CheckAndSaveDocument(GetString("SendPageReason"))) + else if (CheckAndSaveDocument(GetString("SendPageReason")), DocumentHasBeenSaved()) editorSendPage(); window._content.focus(); } -/* -// This is redundant -- use CheckAndSaveDocument instead -function sendPageMustSave() +function DocumentHasBeenSaved() { - var result = {value:0}; - commonDialogsService.UniversalDialog( - window, - null, - window.editorShell.GetString("SendPage"), - window.editorShell.GetString("SendPageCaption"), - null, - window.editorShell.GetString("Yes"), - window.editorShell.GetString("No"), - null, - null, - null, - null, - {value:0}, - {value:0}, - "chrome://global/skin/question-icon.gif", - {value:"false"}, - 2, - 0, - 0, - result - ); - - if (result.value == 0) // They chose "Yes" -- they'd like to save their document now - { - var returned = window.editorShell.saveDocument(false, false); - if (returned) - editorSendPage(); // They saved the page, now we can send page :) + fileurl = ""; + try { + fileurl = window._content.location; + } catch (e) { + return false; } -} -*/ -function CheckAndSaveDocument(reasonToSave) + if (fileurl == "" || fileurl == "about:blank") + return false; + + // We have a file URL already + return true; +} + +function CheckAndSaveDocument(reasonToSave, allowDontSave) { var document = editorShell.editorDocument; if (!editorShell.documentModified) @@ -407,7 +387,7 @@ function CheckAndSaveDocument(reasonToSave) null, window.editorShell.GetString("Save"), // Save Button window.editorShell.GetString("Cancel"), // Cancel Button - window.editorShell.GetString("DontSave"), // Don't Save Button + (allowDontSave ? window.editorShell.GetString("DontSave") : null), // Don't Save Button null, null, null, @@ -415,7 +395,7 @@ function CheckAndSaveDocument(reasonToSave) {value:0}, "chrome://global/skin/question-icon.gif", {value:"false"}, - 3, + (allowDontSave ? 3 : 2), 0, 0, result @@ -462,7 +442,8 @@ function EditorCanClose() // Returns FALSE only if user cancels save action //dump("Calling EditorCanClose\n"); - var canClose = CheckAndSaveDocument(GetString("BeforeClosing")); + // "true" means allow "Don't Save" button + var canClose = CheckAndSaveDocument(GetString("BeforeClosing"), true); // This is our only hook into closing via the "X" in the caption // or "Quit" (or other paths?) @@ -476,34 +457,6 @@ function EditorCanClose() // --------------------------- View menu --------------------------- -function EditorViewSource() -{ - // Temporary hack: save to a file and call up the source view window - // using the local file url. - if (CheckAndSaveDocument(GetString("BeforeViewSource"))) - return; - - fileurl = ""; - try { - fileurl = window._content.location; - } catch (e) { - return; - } - - // CheckAndSave doesn't tell us if the user said "Don't Save", - // so make sure we have a url: - if (fileurl != "" && fileurl != "about:blank") - { - // Use a browser window to view source - window.openDialog( "chrome://navigator/content/viewSource.xul", - "_blank", - "chrome,menubar,status,dialog=no,resizable", - fileurl, - "view-source" ); - } -} - - function EditorSetDocumentCharacterSet(aCharset) { if(editorShell) @@ -822,16 +775,24 @@ function EditorSelectColor(colorType) // Launch the ColorPicker dialog // TODO: Figure out how to position this under the color buttons on the toolbar window.openDialog("chrome://editor/content/EdColorPicker.xul", "_blank", "chrome,close,titlebar,modal", "", gColorObj); + + // User canceled the dialog + if (gColorObj.Cancel) + return; + + var broadcaster; if (colorType == "Text") { if (currentColor != gColorObj.TextColor) window.editorShell.SetTextProperty("font", "color", gColorObj.TextColor); - // Trying to force updating of "state" in command node - // so next caret move updates color button, but not working! - //goUpdateCommand("cmd_fontColor"); - SetTextColorButton(gColorObj.TextColor); + // Update the broadcaster state (this will trigger color button update) + broadcaster = document.getElementById("cmd_fontColor"); + if (broadcaster) + broadcaster.setAttribute("state",gColorObj.TextColor); + + //SetTextColorButton(gColorObj.TextColor); } else if (element) { @@ -853,9 +814,10 @@ function EditorSelectColor(colorType) } else if (currentColor != gColorObj.BackgroundColor) window.editorShell.SetBackgroundColor(gColorObj.BackgroundColor); - -// goUpdateCommand("cmd_backgroundColor"); - SetBackgroundColorButton(gColorObj.BackgroundColor); + + broadcaster = document.getElementById("cmd_backgroundColor"); + if (broadcaster) + broadcaster.setAttribute("state",gColorObj.BackgroundColor); } window._content.focus(); } @@ -909,31 +871,28 @@ function SetEditMode(mode) if (mode == DisplayModeSource) { - // Get the current contents and output into the SourceWindow - if (bodyNode) + // Get the entire document's source string + var source = editorShell.GetContentsAs("text/html", 0); + if (source.length > 0) { - var childCount = bodyNode.childNodes.length; - if( childCount) - { - gSourceContentWindow.setAttribute("value",editorShell.GetContentsAs("text/html", 0)); //gOutputBodyOnly)); - gSourceContentWindow.focus(); - // Note: We can't set the caret location in a multiline textfield - return; - } + // Don't include anything before " 0) + gSourceContentWindow.value = source.slice(headStart); + else + headStart = source; + + gSourceContentWindow.focus(); } - // If we fall through, revert to previous node - SetDisplayMode(PreviousNonSourceDisplayMode); + else + SetDisplayMode(PreviousNonSourceDisplayMode); } else if (previousMode == DisplayModeSource) { // We are comming from edit source mode, // so transfer that back into the document - //TODO: THIS IS NOT WORKING YET! editorShell.RebuildDocumentFromSource(gSourceContentWindow.value); -/* - editorShell.SelectAll(); - editorShell.InsertSource(gSourceContentWindow.value); -*/ + // Clear out the source editor buffer gSourceContentWindow.value = ""; @@ -1040,6 +999,32 @@ function SetDisplayMode(mode) window._content.focus(); } + + // We must set check on menu item since toolbar may have been used + document.getElementById("viewPreviewMode").setAttribute("checked","false"); + document.getElementById("viewNormalMode").setAttribute("checked","false"); + document.getElementById("viewAllTagsMode").setAttribute("checked","false"); + document.getElementById("viewSourceMode").setAttribute("checked","true"); + + var menuID; + switch(mode) + { + case DisplayModePreview: + menuID = "viewPreviewMode"; + break; + case DisplayModeNormal: + menuID = "viewNormalMode"; + break; + case DisplayModeAllTags: + menuID = "viewAllTagsMode"; + break; + case DisplayModeSource: + menuID = "viewSourceMode"; + break; + } + if (menuID.length > 0) + document.getElementById(menuID).setAttribute("checked","true"); + return true; } } @@ -1048,7 +1033,6 @@ function SetDisplayMode(mode) function DisableMenusForHTMLSource(disable) { // Disable toolbar buttons - DisableItem("findButton", disable); DisableItem("spellingButton", disable); DisableItem("imageButton", disable); DisableItem("hlineButton", disable); @@ -1056,6 +1040,10 @@ function DisableMenusForHTMLSource(disable) DisableItem("linkButton", disable); DisableItem("namedAnchorButton", disable); + // Any toolbar can be toggled on/off except the format toolbar + DisableItem("viewFormatToolbar", disable); + + // Top-level menus that we completely hide CollapseItem("insertMenu", disable); CollapseItem("formatMenu", disable); @@ -1073,7 +1061,8 @@ function DisableMenusForHTMLSource(disable) for (var i = 0; i < children.length; i++) { var item = children.item(i); - if (item.id != "viewNormalMode" && + if (item.id != "viewToolbar" && + item.id != "viewNormalMode" && item.id != "viewAllTagsMode" && item.id != "viewSourceMode" && item.id != "viewPreviewMode" && diff --git a/mozilla/editor/ui/composer/content/editorOverlay.xul b/mozilla/editor/ui/composer/content/editorOverlay.xul index ec80989b9b0..46bfce5aca8 100644 --- a/mozilla/editor/ui/composer/content/editorOverlay.xul +++ b/mozilla/editor/ui/composer/content/editorOverlay.xul @@ -148,8 +148,8 @@ - - + + @@ -309,8 +309,9 @@ - - + + + @@ -345,11 +346,10 @@ - - - - - + + + + diff --git a/mozilla/editor/ui/composer/content/pref-composer.xul b/mozilla/editor/ui/composer/content/pref-composer.xul index ffaf05cb52e..0ced6bdb77e 100644 --- a/mozilla/editor/ui/composer/content/pref-composer.xul +++ b/mozilla/editor/ui/composer/content/pref-composer.xul @@ -49,8 +49,7 @@ - <text value="&tableEditing.label;"/> - + <checkbox value = "&maintainTableStructure.label;" id = "maintainTableStructure" @@ -84,7 +83,7 @@ <!-- Recent files menu --> <titledbox orient="vertical"> - <title><text value="&recentFiles.title;"/> + <box align="horizontal" valign="middle"> <text value="&documentsInMenu;"/> <textfield @@ -104,7 +103,7 @@ <!-- Take out Auto-Save; not supported at this time --> <titledbox orient="vertical"> - <title><text value="&saving;"/> + <box align="horizontal" valign="middle"> <checkbox value = "&AutoSaveCheck;" @@ -132,7 +131,7 @@ <!-- HTML formatting on output --> <titledbox orient="vertical"> - <title><text value="&savingFiles.title;"/> + <box align="horizontal" valign="middle"> <checkbox value = "&preserveExistingFormatting;" @@ -148,7 +147,7 @@ <!-- External Editors are not supported at this time <titledbox orient="vertical"> - <title><text value="&exterLegend.label;"/> + <box> <checkbox name = "htmlSourceEditorCheckbox" diff --git a/mozilla/editor/ui/composer/content/pref-editing.xul b/mozilla/editor/ui/composer/content/pref-editing.xul index c37429d077d..363f4993538 100644 --- a/mozilla/editor/ui/composer/content/pref-editing.xul +++ b/mozilla/editor/ui/composer/content/pref-editing.xul @@ -45,14 +45,14 @@ <box class="box-smallheader" title="&lHeader;"/> <titledbox orient="vertical"> - <title><text value="&authorName.label;"/> + <textfield id="editorAuthor" flex="1" pref="true" preftype="string" prefstring="editor.author" prefattribute="value"/> </titledbox> <titledbox orient="vertical"> - <title><text value="&pageColorHeader;"/> + <box> <box orient="vertical"> diff --git a/mozilla/editor/ui/composer/locale/en-US/editor.properties b/mozilla/editor/ui/composer/locale/en-US/editor.properties index 6fa2d1a220f..1a840321672 100644 --- a/mozilla/editor/ui/composer/locale/en-US/editor.properties +++ b/mozilla/editor/ui/composer/locale/en-US/editor.properties @@ -38,14 +38,12 @@ Alert=Alert CantEditFramesetMsg=This editor cannot edit HTML framesets. Try editing the page for each frame separately. CantEditMimeTypeMsg=This type of page can't be edited. CantEditDocumentMsg=This page can't be edited for some reason. - HTMLFiles=HTML Files IMGFiles=Image Files TextFiles=Text Files AllFiles=All Files -BeforeClosing= before closing -BeforeViewSource=in order to view source -BeforePreview=in order to preview +BeforeClosing=before closing +BeforePreview=before previewing in Navigator # LOCALIZATION NOTE (SaveFilePrompt): Don't translate %title% and %reason% (this is the reason for asking user to close, such as "before closing") SaveFilePrompt=Save changes to "%title%" %reason%? SaveFileFailed=Saving file failed! @@ -91,10 +89,15 @@ untitled=untitled NoNamedAnchors=(No named anchors in this page) NoHeadings=(No headings without anchors) TextColor=Text Color -PageBackgroundColor=Page Background Color -TableBackgroundColor=Table Background Color -CellBackgroundColor=Cell Background Color +PageColor=Page Background Color +TableColor=Table Background Color +CellColor=Cell Background Color TableOrCellColor=Table or Cell Color +LinkColor=Link Text Color +ActiveLinkColor=Active Link Color +VisitedLinkColor=Visited Link Color +Color=Color +NoColorError=Click on a color or enter a valid HTML color string Table=Table TableCell=Table Cell HLine=Horizontal Line diff --git a/mozilla/editor/ui/dialogs/content/EdAdvancedEdit.js b/mozilla/editor/ui/dialogs/content/EdAdvancedEdit.js index 1f5c4751cdf..550f914575d 100644 --- a/mozilla/editor/ui/dialogs/content/EdAdvancedEdit.js +++ b/mozilla/editor/ui/dialogs/content/EdAdvancedEdit.js @@ -106,7 +106,6 @@ function Startup() **/ function onOK() { - dump("in onOK\n") UpdateObject(); // call UpdateObject fn to update element in document window.opener.AdvancedEditOK = true; window.opener.globalElement = element; @@ -191,7 +190,7 @@ function doRemoveAttribute( which ) switch ( tree.id ) { case "HTMLATree": HTMLRAttrs[HTMLRAttrs.length] = TrimString(name.getAttribute("value")); - dump("HTMLRAttrs[" + (HTMLRAttrs.length - 1) + "]: " + HTMLRAttrs[HTMLRAttrs.length-1] + "\n"); +// dump("HTMLRAttrs[" + (HTMLRAttrs.length - 1) + "]: " + HTMLRAttrs[HTMLRAttrs.length-1] + "\n"); break; case "CSSATree": CSSRAttrs[CSSRAttrs.length] = TrimString(name.getAttribute("value")); diff --git a/mozilla/editor/ui/dialogs/content/EdAdvancedEdit.xul b/mozilla/editor/ui/dialogs/content/EdAdvancedEdit.xul index 224a11b0022..f3ad0dfd764 100644 --- a/mozilla/editor/ui/dialogs/content/EdAdvancedEdit.xul +++ b/mozilla/editor/ui/dialogs/content/EdAdvancedEdit.xul @@ -102,7 +102,7 @@ <box orient="vertical"> <spring class="spacer"/> <titledbox orient="vertical"> - <title><text value="&AddHTMLAttributeLabel.label;"/> + <box autostretch="never"> <text class="label" for="AddHTMLAttributeNameInput" value="&AttName.label;"/> <textfield flex="1" id="AddHTMLAttributeNameInput" onkeyup="doHTMLEnabling(event.keyCode)" onmouseup="doHTMLEnabling(event.which)"/> @@ -134,7 +134,7 @@ <box orient="vertical"> <spring class="spacer"/> <titledbox orient="vertical"> - <title><text value="&AddCSSAttributeLabel.label;"/> + <box autostretch="never"> <text class="label" for="AddCSSAttributeNameInput" value="&AttName.label;"/> <textfield flex="1" id="AddCSSAttributeNameInput" onkeyup="doCSSEnabling(event.keyCode)" onmouseup="doHTMLEnabling(event.which)"/> @@ -166,7 +166,7 @@ <box orient="vertical"> <spring class="spacer"/> <titledbox orient="vertical"> - <title><text value="&AddJSEAttributeLabel.label;"/> + <box autostretch="never"> <text class="label" for="AddJSEAttributeNameInput" value="&AttName.label;"/> <textfield type="text" flex="1" id="AddJSEAttributeNameInput" onkeyup="doJSEEnabling(event.keyCode)" onmouseup="doHTMLEnabling(event.which)"/> diff --git a/mozilla/editor/ui/dialogs/content/EdColorPicker.js b/mozilla/editor/ui/dialogs/content/EdColorPicker.js index 01a6cc40c68..4ca17cf2cba 100644 --- a/mozilla/editor/ui/dialogs/content/EdColorPicker.js +++ b/mozilla/editor/ui/dialogs/content/EdColorPicker.js @@ -25,11 +25,14 @@ var insertNew = true; var tagname = "TAG NAME" var dialog; +var color = ""; var LastPickedColor = ""; -var ColorType; // = "Text"; +var ColorType = "Text"; +var TextType = false; var TableOrCell = false; var LastPickedIsDefault = true; -var gLocation; +var NoDefault = false; + // dialog initialization code function Startup() @@ -40,6 +43,8 @@ function Startup() return; } + window.arguments[1].Cancel = false; + // Create dialog object to store controls for easy access dialog = new Object; @@ -53,34 +58,40 @@ function Startup() dialog.ColorSwatch = document.getElementById("ColorPickerSwatch"); // The type of color we are setting: - // Text, or background: Page, Table, or Cell - ColorType = window.arguments[1].Type; + // text: Text, Link, ActiveLink, VisitedLink, + // or background: Page, Table, or Cell + if (window.arguments[1].Type) + { + ColorType = window.arguments[1].Type; + // Get string for dialog title from passed-in type + // (note constraint on editor.properties string name) + window.title = GetString(ColorType+"Color"); + } + + if (!window.title) + window.title = GetString("Color"); + dialog.ColorInput.value = ""; - var color = ""; // window.arguments[1] is object to set initial and return color switch (ColorType) { case "Page": - window.title = GetString("PageBackgroundColor"); if (window.arguments[1].PageColor) color = window.arguments[1].PageColor; break; case "Table": - window.title = GetString("TableBackgroundColor"); if (window.arguments[1].TableColor) color = window.arguments[1].TableColor; break; case "Cell": - window.title = GetString("CellBackgroundColor"); if (window.arguments[1].CellColor) color = window.arguments[1].CellColor; break; case "TableOrCell": TableOrCell = true; document.getElementById("TableOrCellGroup").setAttribute("collapsed", "false"); - window.title = GetString("TableOrCellColor"); if (window.arguments[1].TableColor) { color = window.arguments[1].TableColor; @@ -88,14 +99,13 @@ function Startup() } else { - if (window.arguments[1].CellColor) - color = window.arguments[1].CellColor; - + color = window.arguments[1].CellColor; dialog.CellRadio.checked = true; } break; default: - window.title = GetString("TextColor"); + // Any other type will change some kind of text, + TextType = true; if (window.arguments[1].TextColor) color = window.arguments[1].TextColor; break; @@ -103,16 +113,14 @@ function Startup() SetCurrentColor(color) - if (ColorType == "Text") + if (TextType) LastPickedColor = dialog.LastPickedColor.getAttribute("LastTextColor"); else LastPickedColor = dialog.LastPickedColor.getAttribute("LastBackgroundColor"); -dump("LastPickedColor = "+LastPickedColor+"|\n"); - dialog.LastPickedColor.setAttribute("style","background-color: "+LastPickedColor); - doSetOKCancel(onOK, onCancel); + doSetOKCancel(onOK, onCancelColor); // Set method to detect clicking on OK button // so we don't get fooled by changing "default" behavior @@ -120,10 +128,17 @@ dump("LastPickedColor = "+LastPickedColor+"|\n"); // Make the "Last-picked" the default button // until the user selects a color - dialog.Ok.removeAttribute("default"); dialog.LastPickedButton.setAttribute("default","true"); + // Caller can prevent user from submitting an empty, i.e., default color + NoDefault = window.arguments[1].NoDefault; + if (NoDefault) + { + // Hide the "Default button -- user must pick a color + document.getElementById("DefaultColorButton").setAttribute("collapsed","true"); + } + SetTextfieldFocus(dialog.ColorInput); SetWindowLocation(); @@ -162,6 +177,7 @@ function SelectLastPickedColor() function SetCurrentColor(color) { // TODO: Validate color? + if(!color) color = ""; dialog.ColorInput.value = color.trimString().toLowerCase(); SetColorSwatch(); } @@ -198,21 +214,32 @@ function onOKClick() window.close(); } -function onOK() +function ValidateData() { - var color; if (LastPickedIsDefault) color = LastPickedColor; else color = dialog.ColorInput.value; - + color = color.trimString().toLowerCase(); + // TODO: Validate the color string! -dump("ColorPicker onOK: color = "+color+"|\n"); + if (NoDefault && color.length == 0) + { + ShowInputErrorMessage(GetString("NoColorError")); + SetTextfieldFocus(dialog.ColorInput); + return false; + } + return true; +} + +function onOK() +{ + if (!ValidateData()) return; // Set return values and save in persistent color attributes - if (ColorType == "Text") + if (TextType) { window.arguments[1].TextColor = color; if (color.length > 0) @@ -232,3 +259,11 @@ dump("ColorPicker onOK: color = "+color+"|\n"); return true; // do close the window } + +function onCancelColor() +{ + // Tells caller that user canceled + window.arguments[1].Cancel = true; + SaveWindowLocation(); + window.close(); +} \ No newline at end of file diff --git a/mozilla/editor/ui/dialogs/content/EdColorPicker.xul b/mozilla/editor/ui/dialogs/content/EdColorPicker.xul index df7efea45ff..44f80ec926b 100644 --- a/mozilla/editor/ui/dialogs/content/EdColorPicker.xul +++ b/mozilla/editor/ui/dialogs/content/EdColorPicker.xul @@ -84,7 +84,7 @@ <spring flex="1"/> <spring id="ColorPickerSwatch"/> <spring flex="1"/> - <button class="dialog" value="&default.label;" + <button id="DefaultColorButton" class="dialog" value="&default.label;" style="margin-right:0px;" oncommand="RemoveColor()"/> </box> </box> diff --git a/mozilla/editor/ui/dialogs/content/EdColorProps.js b/mozilla/editor/ui/dialogs/content/EdColorProps.js index e5092ae1ee3..82bdc101d90 100644 --- a/mozilla/editor/ui/dialogs/content/EdColorProps.js +++ b/mozilla/editor/ui/dialogs/content/EdColorProps.js @@ -28,31 +28,25 @@ When in "Custom Colors" mode, all colors will be set on body tag, even if they are just default colors, to assure compatable colors in page. User cannot select "use default" for individual colors - When in UseDefaultColors mode, the color buttons can be used, - Instead of disabling using color buttons while in UseDefault mode, - and we switch to UseCustom mode automatically - This let's user start with default palette as starting point for - really setting colors - (2_13 Can't disable color buttons anyway!) */ //Cancel() is in EdDialogCommon.js var BodyElement; var prefs; -var lastSetBackgroundImage; +var backgroundImage; // Initialize in case we can't get them from prefs??? var defaultTextColor="#000000"; var defaultLinkColor="#000099"; -var defaultVisitedLinkColor="#990099"; +var defaultActiveColor="#000099"; +var defaultVisitedColor="#990099"; var defaultBackgroundColor="#FFFFFF"; -// Save var customTextColor; var customLinkColor; -var customVisitedColor; var customActiveColor; +var customVisitedColor; var customBackgroundColor; // Strings we use often @@ -64,6 +58,7 @@ var alinkStr = "alink"; var bgcolorStr = "bgcolor"; var backgroundStr = "background"; var colorStyle = "color: "; +var backColorStyle = "background-color: "; var backImageStyle = " background-image: url("; // dialog initialization code @@ -94,7 +89,6 @@ function Startup() dump("Failed to get BODY element!\n"); window.close(); } - dump(BodyElement+"\n"); // Set element we will edit globalElement = BodyElement.cloneNode(false); @@ -105,14 +99,11 @@ function Startup() var prefs = GetPrefs(); if (prefs) { - dump("Getting browser prefs...\n"); - // This doesn't necessarily match what appears in the page // It is complicated by browser.display.use_document_colors // TODO: WE MUST FORCE WINDOW TO USE DOCUMENT COLORS!!! // How do we do that without changing browser prefs? var useDocumentColors = prefs.GetBoolPref("browser.display.use_document_colors"); - dump("browser.display.use_document_colors = "+ useDocumentColors+"\n"); if (useDocumentColors) { // How do I get current colors as show in page? @@ -122,20 +113,14 @@ function Startup() defaultTextColor = prefs.CopyCharPref("browser.display.foreground_color"); defaultLinkColor = prefs.CopyCharPref("browser.anchor_color"); // Note: Browser doesn't store a value for ActiveLinkColor - defaultVisitedLinkColor = prefs.CopyCharPref("browser.visited_color"); + defaultActiveColor = defaultLinkColor; + defaultVisitedColor = prefs.CopyCharPref("browser.visited_color"); defaultBackgroundColor= prefs.CopyCharPref("browser.display.background_color"); } catch (ex) { dump("Failed getting browser colors from prefs\n"); } } - try { - // Get the last-set background image - lastSetBackgroundImage = prefs.CopyCharPref("editor.default_background_image"); - } - catch (ex) { - dump("Failed getting browser colors from prefs\n"); - } } InitDialog(); @@ -149,159 +134,235 @@ function Startup() function InitDialog() { - SetColor("textCW", globalElement.getAttribute(textStr)); - SetColor("linkCW", globalElement.getAttribute(linkStr)); - SetColor("visitedCW", globalElement.getAttribute(vlinkStr)); - SetColor("activeCW", globalElement.getAttribute(alinkStr)); - SetColor("backgroundCW", globalElement.getAttribute(bgcolorStr)); - - if (dialog.textColor || - dialog.linkColor || - dialog.visitedLinkColor || - dialog.activeLinkColor || - dialog.backgroundColor) + // Get image from document + backgroundImage = globalElement.getAttribute(backgroundStr); + if (backgroundImage.length > 0) { + dialog.BackgroundImageInput.value = backgroundImage; + dialog.ColorPreview.setAttribute(styleStr, backImageStyle+backgroundImage+");"); + } + + customTextColor = globalElement.getAttribute(textStr); + customLinkColor = globalElement.getAttribute(linkStr); + customActiveColor = globalElement.getAttribute(alinkStr); + customVisitedColor = globalElement.getAttribute(vlinkStr); + customBackgroundColor = globalElement.getAttribute(bgcolorStr); + + if (customTextColor || + customLinkColor || + customVisitedColor || + customActiveColor || + customBackgroundColor) + { + // Set default color explicitly for any that are missing + if (!customTextColor) customTextColor = defaultTextColor; + if (!customLinkColor) customLinkColor = defaultLinkColor; + if (!customActiveColor) customActiveColor = defaultActiveColor; + if (!customVisitedColor) customVisitedColor = defaultVisitedColor; + if (!customBackgroundColor) customBackgroundColor = defaultBackgroundColor; + // If any colors are set, then check the "Custom" radio button dialog.CustomColorsRadio.checked = true; - } else { - dialog.DefaultColorsRadio.checked = true; + UseCustomColors(); } - - // Save a copy to use when switching from UseDefault to UseCustom - SaveCustomColors(); - - // Get image from document - dialog.BackgroundImage = globalElement.getAttribute(backgroundStr); - if (dialog.BackgroundImage) + else { - dialog.BackgroundImageInput.value = dialog.BackgroundImage; - dialog.ColorPreview.setAttribute(backgroundStr, dialog.BackgroundImage); + dialog.DefaultColorsRadio.checked = true; + UseDefaultColors(); } } +function GetColorAndUpdate(ColorWellID) +{ + // Only allow selecting when in custom mode + if (!dialog.CustomColorsRadio.checked) return; -function SetColor(ColorWellID, color) + var colorObj = new Object; + var colorWell = document.getElementById(ColorWellID); + if (!colorWell) return; + + // Don't allow a blank color, i.e., using the "default" + colorObj.NoDefault = true; + + switch( ColorWellID ) + { + case "textCW": + colorObj.Type = "Text"; + colorObj.TextColor = customTextColor; + break; + case "linkCW": + colorObj.Type = "Link"; + colorObj.TextColor = customLinkColor; + break; + case "activeCW": + colorObj.Type = "ActiveLink"; + colorObj.TextColor = customActiveColor; + break; + case "visitedCW": + colorObj.Type = "VisitedLink"; + colorObj.TextColor = customVisitedColor; + break; + case "backgroundCW": + colorObj.Type = "Page"; + colorObj.PageColor = customBackgroundColor; + break; + } + + window.openDialog("chrome://editor/content/EdColorPicker.xul", "_blank", "chrome,close,titlebar,modal", "", colorObj); + + // User canceled the dialog + if (colorObj.Cancel) + return; + + color = ""; + switch( ColorWellID ) + { + case "textCW": + color = customTextColor = colorObj.TextColor; + break; + case "linkCW": + color = customLinkColor = colorObj.TextColor; + break; + case "activeCW": + color = customActiveColor = colorObj.TextColor; + break; + case "visitedCW": + color = customVisitedColor = colorObj.TextColor; + break; + case "backgroundCW": + color = customBackgroundColor = colorObj.BackgroundColor; + break; + } + + setColorWell(ColorWellID, color); + SetColorPreview(ColorWellID, color); + + // Setting a color automatically changes into UseCustomColors mode + //dialog.CustomColorsRadio.checked = true; +} + +function SetColorPreview(ColorWellID, color) { switch( ColorWellID ) { case "textCW": - if (!color) color = defaultTextColor; - dialog.textColor = color; dialog.NormalText.setAttribute(styleStr,colorStyle+color); break; case "linkCW": - if (!color) color = defaultLinkColor; - dialog.linkColor = color; dialog.LinkText.setAttribute(styleStr,colorStyle+color); break; case "activeCW": - if (!color) color = defaultLinkColor; - dialog.activeLinkColor = color; dialog.ActiveLinkText.setAttribute(styleStr,colorStyle+color); break; case "visitedCW": - if (!color) color = defaultVisitedLinkColor; - dialog.visitedLinkColor = color; dialog.VisitedLinkText.setAttribute(styleStr,colorStyle+color); break; case "backgroundCW": - if (!color) color = defaultBackgroundColor; - dialog.backgroundColor = color; // Must combine background color and image style values - styleValue = colorStyle+color; - if (dialog.backgroundImage > 0) - styleValue += ";"+backImageStyle+backImageStyle+");"; + styleValue = backColorStyle+color; + if (backgroundImage.length > 0) + styleValue += ";"+backImageStyle+backgroundImage+");"; dialog.ColorPreview.setAttribute(styleStr,styleValue); break; } - setColorWell(ColorWellID, color); -} - -function GetColorAndUpdate(ColorPickerID, ColorWellID, widget) -{ - // Close the colorpicker - widget.parentNode.closePopup(); - SetColor(ColorWellID, getColor(ColorPickerID)); - - // Setting a color automatically changes into UseCustomColors mode - dialog.CustomColorsRadio.checked = true; -} - -function SaveCustomColors() -{ - customTextColor = dialog.textColor; - customLinkColor = dialog.linkColor; - customVisitedColor = dialog.visitedLinkColor; - customActiveColor = dialog.activeLinkColor; - customBackgroundColor = dialog.backgroundColor; } function UseCustomColors() { - // Restore from saved colors - SetColor("textCW", customTextColor); - SetColor("linkCW", customLinkColor); - SetColor("activeCW", customActiveColor); - SetColor("visitedCW", customVisitedColor); - SetColor("backgroundCW", customBackgroundColor); + SetElementEnabledById("TextButton", true); + SetElementEnabledById("LinkButton", true); + SetElementEnabledById("ActiveLinkButton", true); + SetElementEnabledById("VisitedLinkButton", true); + SetElementEnabledById("BackgroundButton", true); + + SetColorPreview("textCW", customTextColor); + SetColorPreview("linkCW", customLinkColor); + SetColorPreview("activeCW", customActiveColor); + SetColorPreview("visitedCW", customVisitedColor); + SetColorPreview("backgroundCW", customBackgroundColor); + + setColorWell("textCW", customTextColor); + setColorWell("linkCW", customLinkColor); + setColorWell("activeCW", customActiveColor); + setColorWell("visitedCW", customVisitedColor); + setColorWell("backgroundCW", customBackgroundColor); } function UseDefaultColors() { - dump("UseDefaultColors\n"); - // Save colors to use when switching back to UseCustomColors - SaveCustomColors(); + SetColorPreview("textCW", defaultTextColor); + SetColorPreview("linkCW", defaultLinkColor); + SetColorPreview("activeCW", defaultActiveColor); + SetColorPreview("visitedCW", defaultVisitedColor); + SetColorPreview("backgroundCW", defaultBackgroundColor); - SetColor("textCW", defaultTextColor); - SetColor("linkCW", defaultLinkColor); - SetColor("activeCW", defaultLinkColor); //Browser doesn't store this separately - SetColor("visitedCW", defaultVisitedLinkColor); - SetColor("backgroundCW", defaultBackgroundColor); + // Setting to blank color will remove color from buttons, + setColorWell("textCW", ""); + setColorWell("linkCW", ""); + setColorWell("activeCW", ""); + setColorWell("visitedCW", ""); + setColorWell("backgroundCW", ""); + + // Disable color buttons + SetElementEnabledById("TextButton", false); + SetElementEnabledById("LinkButton", false); + SetElementEnabledById("ActiveLinkButton", false); + SetElementEnabledById("VisitedLinkButton", false); + SetElementEnabledById("BackgroundButton", false); } function chooseFile() { - // Get a local file, converted into URL format + // Get a local image file, converted into URL format fileName = GetLocalFileURL("img"); if (fileName && fileName != "") { - dialog.BackgroundImage = fileName; - dialog.BackgroundImageInput.value = fileName; - dialog.ColorPreview.setAttribute(backgroundStr, fileName); - // First make a string with just background color - var styleValue = colorStyle+dialog.backgroundColor+";"; - if (ValidateImage()) - { - // Append image style - styleValue += backImageStyle+dialog.BackgroundImage+");"; - } -dump(styleValue+"=style value when setting image\n") - // Set style on preview (removes image if not checked or not valid) - dialog.ColorPreview.setAttribute(styleStr, styleValue); + dialog.BackgroundImageInput = filename; + ValidateAndPreviewImage(true); } - - // Put focus into the input field SetTextfieldFocus(dialog.BackgroundImageInput); } -function ValidateImage() +function ChangeBackgroundImage() { + // Don't show error message for image while user is typing + ValidateAndPreviewImage(false); +} + +function ValidateAndPreviewImage(ShowErrorMessage) +{ + // First make a string with just background color + var styleValue = backColorStyle+dialog.backgroundColor+";"; + var image = dialog.BackgroundImageInput.value.trimString(); - if (image && image != "") + if (image.length > 0) { if (IsValidImage(image)) { - dialog.BackgroundImage = image; - return true; - } else { - dialog.BackgroundImage = null; + backgroundImage = image; + // Append image style + styleValue += backImageStyle+backgroundImage+");"; + } + else + { + backgroundImage = null; + if (ShowErrorMessage) + { + SetTextfieldFocus(dialog.BackgroundImageInput); + // Tell user about bad image + ShowInputErrorMessage(GetString("MissingImageError")); + } + return false; } } - SetTextfieldFocus(dialog.BackgroundImageInput); - ShowInputErrorMessage(GetString("MissingImageError")); + else backgroundImage = null; - return false; + // Set style on preview (removes image if not valid) + dialog.ColorPreview.setAttribute(styleStr, styleValue); + + // Note that an "empty" string is valid + return true; } function ValidateData() @@ -317,21 +378,24 @@ function ValidateData() } else { - globalElement.setAttribute(textStr, dialog.textColor); - globalElement.setAttribute(linkStr, dialog.linkColor); - globalElement.setAttribute(vlinkStr, dialog.visitedLinkColor); - globalElement.setAttribute(alinkStr, dialog.activeLinkColor); - globalElement.setAttribute(bgcolorStr, dialog.backgroundColor); + globalElement.setAttribute(textStr, customTextColor); + globalElement.setAttribute(linkStr, customLinkColor); + globalElement.setAttribute(vlinkStr, customVisitedColor); + globalElement.setAttribute(alinkStr, customActiveColor); + globalElement.setAttribute(bgcolorStr, customBackgroundColor); } - if (ValidateImage()) + if (ValidateAndPreviewImage(true)) { - globalElement.setAttribute(backgroundStr, dialog.BackgroundImage); - } else { - globalElement.removeAttribute(backgroundStr); - return false; - } - + // A valid image may be null for no image + if (backgroundImage) + { + globalElement.setAttribute(backgroundStr, backgroundImage); + } else { + globalElement.removeAttribute(backgroundStr); + return false; + } + } return true; } @@ -339,13 +403,6 @@ function onOK() { if (ValidateData()) { - // Save image for future editing - if (prefs && dialog.BackgroundImage) - { - dump("Saving default background image in prefs\n"); - prefs.SetCharPref("editor.default_background_image", dialog.BackgroundImage); - } - // Copy attributes to element we are changing editorShell.CloneAttributes(BodyElement, globalElement); diff --git a/mozilla/editor/ui/dialogs/content/EdColorProps.xul b/mozilla/editor/ui/dialogs/content/EdColorProps.xul index 8f311987523..7a34630fd29 100644 --- a/mozilla/editor/ui/dialogs/content/EdColorProps.xul +++ b/mozilla/editor/ui/dialogs/content/EdColorProps.xul @@ -46,103 +46,99 @@ <broadcaster id="args" value=""/> <popupset id="aTooltipSet" /> - <titledbox orient="vertical"><title><text class="label" value="&pageColors.label;"/> + <box orient="vertical"> <radiogroup id="pageColorGroup" orient="vertical" autostretch="never"> - <radio group="pageColorGroup" id="DefaultColorsRadio" value="&defaultColorsRadio.label;" oncommand="UseDefaultColors()" + <radio group="pageColorGroup" id="DefaultColorsRadio" value="fuck you" oncommand="UseDefaultColors()" tooltip="aTooltip" tooltiptext="&defaultColorsRadio.tooltip;" /> <radio group="pageColorGroup" id="CustomColorsRadio" value="&customColorsRadio.label;" oncommand="UseCustomColors()" tooltip="aTooltip" tooltiptext="&customColorsRadio.tooltip;" /> </radiogroup> - </box> - <spring class="spacer"/> - <box class="big-left-margin"> - <grid> - <columns><column/><column/></columns> - <rows> - <row> - <text class="label" value="&normalText.label;&colon.character;" /> - <menu class="colorpicker"> - <box> - <spring id="textCW" class="color-well"/> - <image class="popup-trigger"/> - </box> - <menupopup id="normalMenuPopup"> - <colorpicker id="textCP" palettename="standard" onclick="GetColorAndUpdate('textCP','textCW',this);"/> - </menupopup> - </menu> - </row> - <row> - <text class="label" value="&linkText.label;&colon.character;" /> - <menu class="colorpicker"> - <box> - <spring id="linkCW" class="color-well"/> - <image class="popup-trigger"/> - </box> - <menupopup> - <colorpicker id="linkCP" palettename="standard" onclick="GetColorAndUpdate('linkCP','linkCW',this);"/> - </menupopup> - </menu> - </row> - <row> - <text class="label" value="&activeLinkText.label;&colon.character;" /> - <menu class="colorpicker"> - <box> - <spring id="activeCW" class="color-well"/> - <image class="popup-trigger"/> - </box> - <menupopup> - <colorpicker id="activeCP" palettename="standard" onclick="GetColorAndUpdate('activeCP','activeCW',this);"/> - </menupopup> - </menu> - </row> - <row> - <text class="label" value ="&visitedLinkText.label;&colon.character;" /> - <menu class="colorpicker"> - <box> - <spring id="visitedCW" class="color-well"/> - <image class="popup-trigger"/> - </box> - <menupopup> - <colorpicker id="visitedCP" palettename="standard" onclick="GetColorAndUpdate('visitedCP','visitedCW',this);"/> - </menupopup> - </menu> - </row> - <row> - <text class="label" value="&background.label;" /> - <menu class="colorpicker"> - <box> - <spring id="backgroundCW" class="color-well"/> - <image class="popup-trigger"/> - </box> - <menupopup> - <colorpicker id="backgroundCP" palettename="standard" onclick="GetColorAndUpdate('backgroundCP','backgroundCW',this);"/> - </menupopup> - </menu> - </row> - </rows> - </grid> - <box orient="vertical" id="ColorPreview"> - <text class="label" id="NormalText" value="&normalText.label;"/> - <text class="label" id="LinkText" value="&linkText.label;"/> - <text class="label" id="ActiveLinkText" value="&activeLinkText.label;"/> - <text class="label" id="VisitedLinkText" value="&visitedLinkText.label;"/> + <spring class="spacer"/> + <box class="big-left-margin"> + <grid> + <columns><column/><column/></columns> + <rows> + <row> + <text class="label" value="&normalText.label;&colon.character;" /> + <stack> + <box autostretch="never" valign="middle"> + <spring id="textCW" class="color-well"/> + <image class="popup-trigger"/> + </box> + <button id="TextButton" class="dialog color-button" onclick="GetColorAndUpdate('textCW')" flex="1"/> + </stack> + </row> + <row> + <text class="label" value="&linkText.label;&colon.character;" /> + <stack> + <box autostretch="never" valign="middle"> + <spring id="linkCW" class="color-well"/> + <image class="popup-trigger"/> + </box> + <button id="LinkButton" class="dialog color-button" onclick="GetColorAndUpdate('linkCW')" flex="1"/> + </stack> + </row> + <row> + <text class="label" value="&activeLinkText.label;&colon.character;" /> + <stack> + <box autostretch="never" valign="middle"> + <spring id="activeCW" class="color-well"/> + <image class="popup-trigger"/> + </box> + <button id="ActiveLinkButton" class="dialog color-button" onclick="GetColorAndUpdate('activeCW')" flex="1"/> + </stack> + </row> + <row> + <text class="label" value ="&visitedLinkText.label;&colon.character;" /> + <stack> + <box autostretch="never" valign="middle"> + <spring id="visitedCW" class="color-well"/> + <image class="popup-trigger"/> + </box> + <button id="VisitedLinkButton" class="dialog color-button" onclick="GetColorAndUpdate('visitedCW')" flex="1"/> + </stack> + </row> + <row> + <text class="label" value="&background.label;" /> + <stack> + <box autostretch="never" valign="middle"> + <spring id="backgroundCW" class="color-well"/> + <image class="popup-trigger"/> + </box> + <button id="BackgroundButton" class="dialog color-button" onclick="GetColorAndUpdate('backgroundCW')" flex="1"/> + </stack> + </row> + </rows> + </grid> </box> </box> - <spring class="spacer"/> + <box orient="vertical" id="ColorPreview" flex="1"> + <spring flex="1"/> + <text class="label larger" id="NormalText" value="&normalText.label;"/> + <spring flex="1"/> + <text class="label larger" id="LinkText" value="&linkText.label;"/> + <spring flex="1"/> + <text class="label larger" id="ActiveLinkText" value="&activeLinkText.label;"/> + <spring flex="1"/> + <text class="label larger" id="VisitedLinkText" value="&visitedLinkText.label;"/> + <spring flex="1"/> + </box> </titledbox> <spring class="spacer"/> - <text class="label" id="BackgroundImageCheckbox" value="&backgroundImage.label;"/> - <grid> - <columns><column/><column/></columns> + <text class="label" value="&backgroundImage.label;"/> + <grid flex="1"> + <columns><column/><column flex="1"/></columns> <rows> - <row style="margin-bottom: 5px"> - <textfield id="BackgroundImageInput" + <row autostretch="never" valign="middle" style="margin-bottom: 5px"> + <textfield id="BackgroundImageInput" onkeyup="ChangeBackgroundImage()" tooltip="aTooltip" tooltiptext="&backgroundImage.tooltip;" /> - <button class="dialog" id="ChooseFile" flex="1" /> + <!-- from EdDialogOverlay.xul --> + <button class="dialog" id="ChooseFile" flex="1"/> </row> <row autostretch="never" valign="middle"> <spring/> + <!-- from EdDialogOverlay.xul --> <button class="dialog" id="AdvancedEditButton" flex="1"/> </row> </rows> diff --git a/mozilla/editor/ui/dialogs/content/EdDialogCommon.js b/mozilla/editor/ui/dialogs/content/EdDialogCommon.js index 510ecc3798e..fd7e1ba8776 100644 --- a/mozilla/editor/ui/dialogs/content/EdDialogCommon.js +++ b/mozilla/editor/ui/dialogs/content/EdDialogCommon.js @@ -574,14 +574,6 @@ function onAdvancedEdit() if (window.AdvancedEditOK) { // Copy edited attributes to the dialog widgets: InitDialog(); -/* -// Use this if we want to close the parent dialog immediately - if (onOK()) { - // I'm not sure why, but calling onOK() from JS doesn't trigger closing - // automatically as it does when you click on the OK button! - window.close(); - } -*/ } } } diff --git a/mozilla/editor/ui/dialogs/content/EdHLineProps.xul b/mozilla/editor/ui/dialogs/content/EdHLineProps.xul index bdd6f5b9361..81b24bd257c 100644 --- a/mozilla/editor/ui/dialogs/content/EdHLineProps.xul +++ b/mozilla/editor/ui/dialogs/content/EdHLineProps.xul @@ -48,7 +48,7 @@ <keyset id="keyset"/> <popupset id="aTooltipSet" /> - <titledbox orient="vertical"><title><text value="&dimensionsBox.label;"/> + <grid> <columns><column/><column/><column /></columns> <rows> @@ -67,7 +67,7 @@ </grid> <checkbox id="3dShading" value="&threeDShading.label;" /> </titledbox> - <titledbox><title><text align="left" value="&alignmentBox.label;"/> + <radiogroup id="alignmentGroup" orient="horizontal"> <spring class="spacer"/> <radio group="alignmentGroup" id="leftAlign" value="&leftRadio.value;" /> diff --git a/mozilla/editor/ui/dialogs/content/EdImageMapHotSpot.xul b/mozilla/editor/ui/dialogs/content/EdImageMapHotSpot.xul index af3f57dfd90..6d5519651b9 100644 --- a/mozilla/editor/ui/dialogs/content/EdImageMapHotSpot.xul +++ b/mozilla/editor/ui/dialogs/content/EdImageMapHotSpot.xul @@ -46,7 +46,7 @@ <broadcaster id="args" value=""/> <titledbox orient="vertical" flex="1"> - <title><text id="titleInput" value="&link.label;"/> + <grid> <columns><column/><column/><column/></columns> @@ -71,7 +71,7 @@ <titledbox orient="vertical" flex="1"> - <title><text id="targetLabel" value="&targetFieldset.label;"/> + <grid> <columns><column/><column/><column/></columns> <rows> diff --git a/mozilla/editor/ui/dialogs/content/EdImageProps.xul b/mozilla/editor/ui/dialogs/content/EdImageProps.xul index 17be03f9329..7d440624107 100644 --- a/mozilla/editor/ui/dialogs/content/EdImageProps.xul +++ b/mozilla/editor/ui/dialogs/content/EdImageProps.xul @@ -54,7 +54,7 @@ <popupset id="aTooltipSet" /> <titledbox orient="vertical"> - <title><text value="&locationBox.label;"/> + <!--/////// Src URL and ALT Text //////--> <grid> <columns><column/><column/><column/></columns> @@ -88,7 +88,9 @@ </row> </rows> </grid> + <spring class="spacer"/> </titledbox> + <spring class="spacer"/> <box> <button class = "dialog" @@ -108,7 +110,7 @@ <box orient="vertical"> <!-- //////// Image Dimensions //////// --> <titledbox orient="vertical" flex="1"> - <title><text id="dimensionsLabel" value="&dimensionsBox.label;"/> + <radiogroup id="imgSizeGroup" orient="vertical"> <radio group = "imgSizeGroup" @@ -165,7 +167,7 @@ </titledbox> <!--////// IMAGE MAP BUTTONS //////--> <titledbox flex="1"> - <title><text id="imagemapLabel" value="&imagemapBox.label;"/> + <box> <button class = "dialog" @@ -186,7 +188,7 @@ <box orient="vertical" flex="1"> <!--//////// Alignment ////////--> <titledbox flex="1" orient="vertical"> - <title><text class="label" id="alignLabel" value="&alignment.label;"/> + <menulist id = "alignTypeSelect" onchange ="doOverallEnabling()"> <menupopup valign="middle"> <menuitem class="middle"><image id="img-align-top"/> <text class="label" value = "&topPopup.value;"/></menuitem> @@ -200,7 +202,7 @@ <!--//////// Borders and Spacing ////////--> <titledbox flex="1"> - <title><text id="spacingLabel" value="&spacingBox.label;"/> + <grid> <columns><column/><column/><column/></columns> <rows> diff --git a/mozilla/editor/ui/dialogs/content/EdInsertChars.xul b/mozilla/editor/ui/dialogs/content/EdInsertChars.xul index dd404e15e4b..5bcf2b6c4fd 100644 --- a/mozilla/editor/ui/dialogs/content/EdInsertChars.xul +++ b/mozilla/editor/ui/dialogs/content/EdInsertChars.xul @@ -44,7 +44,7 @@ <keyset id="keyset"/> <broadcaster id="args" value=""/> - <titledbox orient="vertical"><title><text value="&category.label;"/> + <radiogroup id="CatGrp" orient="vertical" persist="category letter_index char_index"> <radio group="CatGrp" id="AccentUpper" value="&accentUpper.label;" oncommand="ChangeCategory(this.id)"/> <radio group="CatGrp" id="AccentLower" value="&accentLower.label;" oncommand="ChangeCategory(this.id)"/> diff --git a/mozilla/editor/ui/dialogs/content/EdInsertTable.xul b/mozilla/editor/ui/dialogs/content/EdInsertTable.xul index 0e86106925f..f956d4265f0 100644 --- a/mozilla/editor/ui/dialogs/content/EdInsertTable.xul +++ b/mozilla/editor/ui/dialogs/content/EdInsertTable.xul @@ -48,7 +48,7 @@ <broadcaster id="args" value=""/> <keyset id="keyset"/> <popupset id="aTooltipSet" /> - <titledbox orient="vertical"><title><text value="&size.label;"/> + <grid> <columns><column/><column/><column/></columns> <rows> diff --git a/mozilla/editor/ui/dialogs/content/EdLinkProps.xul b/mozilla/editor/ui/dialogs/content/EdLinkProps.xul index c36dde18aa3..9c8be237e1e 100644 --- a/mozilla/editor/ui/dialogs/content/EdLinkProps.xul +++ b/mozilla/editor/ui/dialogs/content/EdLinkProps.xul @@ -46,12 +46,12 @@ <keyset id="keyset"/> <box orient="vertical" style="min-width: 20em"> - <titledbox orient="vertical"><title><text id="linkTextCaption" align="left"/> + <text class="label" id="linkTextMessage"/> <textfield id="linkTextInput" flex="1" onkeyup="ChangeText()"/> </titledbox> - <titledbox orient="vertical"><title><text class="label" value="&LinkURLBox.label;"/> + <text class="label" value="&LinkURLEditField.label;"/> <box autostretch="never" valign="middle"> <textfield id="hrefInput" flex="1" style="min-width: 18em" onkeyup="ChangeLocation()"/> diff --git a/mozilla/editor/ui/dialogs/content/EdListProps.js b/mozilla/editor/ui/dialogs/content/EdListProps.js index 879f7572937..c3f4b0691e2 100644 --- a/mozilla/editor/ui/dialogs/content/EdListProps.js +++ b/mozilla/editor/ui/dialogs/content/EdListProps.js @@ -157,7 +157,7 @@ dump("List Type: "+ListType+" globalElement: "+globalElement+"\n"); function SelectListType() { -dump(ListTypeList+"ListTypeList\n"); +//dump(ListTypeList+"ListTypeList\n"); switch (ListTypeList.selectedIndex) { case 1: @@ -192,7 +192,40 @@ function SelectBulletStyle() if (ListType == "ul") BulletStyleIndex = BulletStyleList.selectedIndex; else if (ListType == "ol") + { + if (NumberStyleIndex != BulletStyleList.selectedIndex) + StartingNumberInput.value = ""; NumberStyleIndex = BulletStyleList.selectedIndex; + } +} + +function FilterStartNumber() +{ + var stringIn = StartingNumberInput.value.trimString(); + if (stringIn.length > 0) + { + switch (NumberStyleIndex) + { + case 0: + // Allow only integers + stringIn = stringIn.replace(/\D+/g,""); + break; + case 1: // "I"; + stringIn = stringIn.toUpperCase().replace(/[^ICDVXL]+/g,""); + break; + case 2: // "i"; + stringIn = stringIn.toLowerCase().replace(/[^icdvxl]+/g,""); + break; + case 3: // "A"; + stringIn.toUpperCase(); + break; + case 4: // "a"; + stringIn.toLowerCase(); + break; + } + if (!stringIn) stringIn = ""; + StartingNumberInput.value = stringIn; + } } function ValidateData() diff --git a/mozilla/editor/ui/dialogs/content/EdListProps.xul b/mozilla/editor/ui/dialogs/content/EdListProps.xul index d06bea4b28e..c94b1569b5f 100644 --- a/mozilla/editor/ui/dialogs/content/EdListProps.xul +++ b/mozilla/editor/ui/dialogs/content/EdListProps.xul @@ -63,7 +63,7 @@ <box> <text class="label" id="StartingNumberLabel" value="&startingNumber.label;"/> <spring class="spacer"/> - <textfield class="narrow" id="StartingNumber" onkeyup="forceInteger('StartingNumber')"/> + <textfield class="narrow" id="StartingNumber" onkeyup="FilterStartNumber()"/> <spring/> </box> <!-- from EdDialogOverlay --> diff --git a/mozilla/editor/ui/dialogs/content/EdPageProps.xul b/mozilla/editor/ui/dialogs/content/EdPageProps.xul index 7a8c5699eb9..1aa8984fa4d 100644 --- a/mozilla/editor/ui/dialogs/content/EdPageProps.xul +++ b/mozilla/editor/ui/dialogs/content/EdPageProps.xul @@ -45,27 +45,27 @@ <broadcaster id="args" value=""/> <keyset id="keyset"/> <grid> - <columns><column/><column flex="1"/></columns> + <columns><column flex="1"/><column flex="2"/></columns> <rows> <row> - <text class="label" value="&location.label;" flex ="1"/> - <text class="label" value="&locationNewPage.label;" id="PageLocation" flex ="1"/> + <text class="label" value="&location.label;"/> + <text class="label" value="&locationNewPage.label;" id="PageLocation"/> </row> <row> - <text class="label" value="&lastModified.label;" flex ="1" align="left"/> + <text class="label" value="&lastModified.label;" align="left"/> <text class="label" id="PageModDate" align="left"/> </row> <row valign="middle"> <text class="label" value="&titleInput.label;"/> - <textfield id="TitleInput" flex ="1" onkeyup="TextfieldChanged(this.id)"/> + <textfield class="MinWidth20em" id="TitleInput" onkeyup="TextfieldChanged(this.id)"/> </row> <row valign="middle"> <text class="label" value="&authorInput.label;"/> - <textfield id="AuthorInput" flex ="1" onkeyup="TextfieldChanged(this.id)"/> + <textfield class="MinWidth20em" id="AuthorInput" onkeyup="TextfieldChanged(this.id)"/> </row> <row valign="middle"> <text class="label" value="&descriptionInput.label;"/> - <textfield class="MinWidth20em" id="DescriptionInput" flex ="1" onkeyup="TextfieldChanged(this.id)"/> + <textfield class="MinWidth20em" id="DescriptionInput" onkeyup="TextfieldChanged(this.id)"/> </row> </rows> </grid> diff --git a/mozilla/editor/ui/dialogs/content/EdTableProps.xul b/mozilla/editor/ui/dialogs/content/EdTableProps.xul index 059159eec55..05a6d1181b6 100644 --- a/mozilla/editor/ui/dialogs/content/EdTableProps.xul +++ b/mozilla/editor/ui/dialogs/content/EdTableProps.xul @@ -56,7 +56,7 @@ <!-- TABLE PANEL --> <box id="TablePanel" orient="vertical"> - <titledbox><title><text value="&size.label;"/> + <grid> <columns><column/><column/></columns> <rows> @@ -88,7 +88,7 @@ </grid> </titledbox> <box><!-- Border and Alignment --> - <titledbox orient="vertical"><title><text align="left" value="&tableBorderSpacing.label;"/> + <grid> <columns><column/><column/><column/></columns> <rows> @@ -170,7 +170,7 @@ <!-- CELL PANEL --> <box id="CellPanel" orient="vertical"> <titledbox autostretch="never" valign="middle"> - <title><text align="left" value="&cellSelection.label;"/> + <box orient="vertical"> <menulist id="SelectionList" oncommand="ChangeSelection(event.target.data)" flex="1"> <menupopup> @@ -193,7 +193,7 @@ </box> </titledbox> <!-- cell size titledbox --> - <titledbox><title><text align="left" value="&size.label;"/> + <grid> <columns><column/><column/><column/></columns> <rows> @@ -226,7 +226,7 @@ </titledbox> <box><!-- Alignment and style --> <titledbox orient="vertical" flex="1"> - <title><text align="left" value="&cellContentAlignment.label;"/> + <grid> <columns><column/><column/><column/></columns> <rows> diff --git a/mozilla/editor/ui/dialogs/content/EditorSaveAsCharset.xul b/mozilla/editor/ui/dialogs/content/EditorSaveAsCharset.xul index e42fb194b18..c38907dcf4a 100644 --- a/mozilla/editor/ui/dialogs/content/EditorSaveAsCharset.xul +++ b/mozilla/editor/ui/dialogs/content/EditorSaveAsCharset.xul @@ -48,14 +48,14 @@ <keyset id="keyset"/> <box orient="vertical"> - <titledbox orient="vertical"><title><text align="left" value="&documentTitleTitle.label;"/> + <!-- Text labels filled in from editor.properties --> <text id="EnterTitleLabel" class="label"/> <textfield id="TitleInput" flex="1" onkeyup="TitleChanged();"/> <html id="TitleHelp" class="label wrap" style="width:1em" flex="1"/> </titledbox> - <titledbox orient="vertical"><title><text class="label" value="&documentCharsetTitle.label;"/> + <text class="label" value="&documentCharsetDesc.label;"/> <box flex="1"> <tree class="list" id="CharsetTree" rows="10" flex="1" onselect="SelectCharset();"> diff --git a/mozilla/editor/ui/dialogs/locale/en-US/EditorColorProperties.dtd b/mozilla/editor/ui/dialogs/locale/en-US/EditorColorProperties.dtd index d5bbf3bc395..341d3feaab8 100644 --- a/mozilla/editor/ui/dialogs/locale/en-US/EditorColorProperties.dtd +++ b/mozilla/editor/ui/dialogs/locale/en-US/EditorColorProperties.dtd @@ -23,7 +23,8 @@ <!-- Window title --> <!ENTITY windowTitle.label "Page Colors and Background"> <!ENTITY pageColors.label "Page Colors"> -<!ENTITY defaultColorsRadio.label "Reader's default colors (Don't set colors in page)"> +<!ENTITY defaultColorsRadio.label "Reader's default colors"> +<!ENTITY defaultColorsMsg.label "(Don't set colors in page)"> <!ENTITY defaultColorsRadio.tooltip "Use the color settings from the viewer (reader's) browser only"> <!ENTITY customColorsRadio.label "Use custom colors:"> <!ENTITY customColorsRadio.tooltip "These color settings override the viewer's browser settings"> diff --git a/mozilla/editor/ui/dialogs/locale/en-US/EditorPageProperties.dtd b/mozilla/editor/ui/dialogs/locale/en-US/EditorPageProperties.dtd index 8432a657d3d..5c839425069 100644 --- a/mozilla/editor/ui/dialogs/locale/en-US/EditorPageProperties.dtd +++ b/mozilla/editor/ui/dialogs/locale/en-US/EditorPageProperties.dtd @@ -28,4 +28,4 @@ <!ENTITY authorInput.label "Author:"> <!ENTITY descriptionInput.label "Description:"> <!ENTITY locationNewPage.label "[New page, not saved yet]"> -<!ENTITY EditHEADSource.label "Advanced users:<html:br/>To edit contents of the <head> region, use "HTML Source" in the View Menu or Edit Mode Toolbar."> +<!ENTITY EditHEADSource.label "Advanced users:<html:br/>To edit other contents of the <head> region, use "HTML Source" in the View Menu or Edit Mode Toolbar.">