Fixed paragraph, heading, and list menus and check state: bug 41735, r=brade

This commit is contained in:
cmanske%netscape.com 2000-06-16 14:22:12 +00:00
Родитель 9af7bfa239
Коммит 79313083a5
24 изменённых файлов: 743 добавлений и 436 удалений

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

@ -200,7 +200,7 @@ function EditorSharedStartup()
gIsUNIX = (navigator.appVersion.indexOf("X11") ||
navigator.appVersion.indexOf("nux")) != -1;
gIsMac = !gIsWin && !gIsUNIX;
dump("IsWin="+gIsWin+", IsUNIX="+gIsUNIX+", IsMac="+gIsMac+"\n");
//dump("IsWin="+gIsWin+", IsUNIX="+gIsUNIX+", IsMac="+gIsMac+"\n");
// hide UI that we don't have components for
HideInapplicableUIElements();
@ -480,6 +480,16 @@ function EditorSetParagraphFormat(commandID, paraFormat)
goDoCommand(commandID);
}
function onChangeColor(colorWell, commandID)
{
// Get the color from the command node state
var commandNode = document.getElementById(commandID);
var color = commandNode.getAttribute("state");
//dump("onChangeColor -- Color is: "+color+"\n");
// Use setAttribute so colorwell can be a XUL element, such as titledbutton
colorWell.setAttribute("style", "background-color: " + color);
}
function onFontFaceChange(fontFaceMenuList, commandID)
{
@ -517,27 +527,6 @@ function EditorSetFontFace(commandID, fontFace)
commandNode.setAttribute("state", fontFace);
window.content.focus(); // needed for command dispatch to work
goDoCommand(commandID);
/*
if (fontFace == "tt")
{
// The old "teletype" attribute
editorShell.SetTextProperty("tt", "", "");
// Clear existing font face
editorShell.RemoveTextProperty("font", "face");
}
else
{
// Remove any existing TT nodes
editorShell.RemoveTextProperty("tt", "", "");
if( fontFace == "" || fontFace == "normal") {
editorShell.RemoveTextProperty("font", "face");
} else {
editorShell.SetTextProperty("font", "face", fontFace);
}
}
window.content.focus();
*/
}
function EditorSelectFontSize()
@ -584,7 +573,6 @@ function EditorSetFontSize(size)
size == "medium" )
{
editorShell.RemoveTextProperty("font", "size");
dump("Removing font size\n");
} else {
dump("Setting font size\n");
// Temp: convert from new CSS size strings to old HTML size strings
@ -609,26 +597,13 @@ function EditorSetFontSize(size)
}
editorShell.SetTextProperty("font", "size", size);
}
/*
BIG BUG! Setting <span> tag is totally horked -- stick with <font size> for beta1
{
// XXX-THIS IS DEFINITELY WRONG!
// We need to parse the style tag to set/remove only the "font-size"
// TODO: We need a general SetInlineStyle(), RemoveInlineStyle() interface
editorShell.RemoveTextProperty("span", "style");
dump("Removing font size\n");
} else {
dump("Setting font size to: "+size+"\n");
editorShell.SetTextProperty("span", "style", "font-size:"+size);
}
*/
gContentWindow.focus();
}
function EditorSelectTextColor(ColorPickerID, ColorWellID)
{
var color = getColorAndSetColorWell(ColorPickerID, ColorWellID);
// dump("EditorSelectTextColor: "+color+"\n");
//dump("EditorSelectTextColor: "+color+"\n");
// Close appropriate menupopup
var menupopup;
@ -659,7 +634,7 @@ function EditorRemoveTextColor(ColorWellID)
function EditorSelectBackColor(ColorPickerID, ColorWellID)
{
var color = getColorAndSetColorWell(ColorPickerID, ColorWellID);
dump("EditorSelectBackColor: "+color+"\n");
//dump("EditorSelectBackColor: "+color+"\n");
// Close appropriate menupopup
var menupopup;
@ -1052,22 +1027,61 @@ function InitBackColorPopup()
SetBackColorString("BackColorCaption");
}
function InitListMenu()
function InitParagraphMenu()
{
SetMenuItemCheckedFromState("menu_ul", "cmd_ul");
SetMenuItemCheckedFromState("menu_ol", "cmd_ol");
SetMenuItemCheckedFromState("menu_dt", "cmd_dt");
SetMenuItemCheckedFromState("menu_dd", "cmd_dd");
var mixedObj = new Object();
var state = editorShell.GetParagraphState(mixedObj);
//dump("InitParagraphMenu: state="+state+"\n");
var IDSuffix = "normal";
// PROBLEM: When we get blockquote, it masks other styles contained by it
// We need a separate method to get blockquote state
if (state.length > 0)
{
if (state.charAt(0) == "h")
{
// We have a heading style - remove any checkmark in this submenu
// by first setting the first item, then removing the check
document.getElementById("menu_normal").setAttribute("checked", "true");
document.getElementById("menu_normal").removeAttribute("checked");
return;
}
IDSuffix = state;
}
document.getElementById("menu_"+IDSuffix).setAttribute("checked", "true");
}
function SetMenuItemCheckedFromState(menuItemID, commandID)
function InitHeadingMenu()
{
var menuItem = document.getElementById(menuItemID);
var commandNode = document.getElementById(commandID);
if (menuItem && commandNode)
var mixedObj = new Object();
var state = editorShell.GetParagraphState(mixedObj);
//dump("InitHeadingMenu: state="+state+"\n");
var IDSuffix = "noHeading";
if (state.length > 0 && state.charAt(0) == "h")
IDSuffix = state;
document.getElementById("menu_"+IDSuffix).setAttribute("checked", "true");
}
function InitListMenu()
{
var mixedObj = new Object();
var state = editorShell.GetListState(mixedObj);
//dump("InitListMenu: state="+state+"\n");
var IDSuffix = "noList";
if (state.length > 0)
{
menuItem.setAttribute("checked", commandNode.getAttribute("state"));
if (state == "dl")
state = editorShell.GetListItemState(mixedObj);
if (state.length > 0)
IDSuffix = state;
}
document.getElementById("menu_"+IDSuffix).setAttribute("checked", "true");
}
function EditorInitToolbars()

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

@ -72,6 +72,7 @@
<commandset id="composerSaveMenuItems"/>
<commandset id="composerStyleMenuItems"/>
<commandset id="composerTableMenuItems"/>
<commandset id="composerListMenuItems"/>
</commands>
<!-- Use this when we abandon the default startup page -->

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

@ -179,8 +179,6 @@
<command id="cmd_ul" state="false" oncommand="goDoCommand('cmd_ul')"/>
<command id="cmd_ol" state="false" oncommand="goDoCommand('cmd_ol')"/>
<command id="cmd_dt" state="false" oncommand="goDoCommand('cmd_dt')"/>
<command id="cmd_dd" state="false" oncommand="goDoCommand('cmd_dd')"/>
<command id="cmd_indent" oncommand="goDoCommand('cmd_indent')"/>
<command id="cmd_outdent" oncommand="goDoCommand('cmd_outdent')"/>
@ -199,8 +197,15 @@
<command id="cmd_removeStyles" oncommand="goDoCommand('cmd_removeStyles')"/>
</commandset>
<!-- commands updated when the table menu gets created -->
<!-- commands updated only when the menu gets created -->
<commandset id="composerListMenuItems" oncommandupdate="goUpdateComposerMenuItems(this)">
<!-- List menu -->
<command id="cmd_dt" oncommand="goDoCommand('cmd_dt')"/>
<command id="cmd_dd" oncommand="goDoCommand('cmd_dd')"/>
<command id="cmd_removeList" oncommand="goDoCommand('cmd_removeList')"/>
</commandset>
<commandset id="composerTableMenuItems" oncommandupdate="goUpdateTableMenuItems(this)">
<!-- Table menu -->
<command id="cmd_SelectTable" oncommand="goDoCommand('cmd_SelectTable')"/>
<command id="cmd_SelectRow" oncommand="goDoCommand('cmd_SelectRow')"/>
<command id="cmd_SelectColumn" oncommand="goDoCommand('cmd_SelectColumn')"/>
@ -224,7 +229,6 @@
<command id="cmd_editTable" oncommand="goDoCommand('cmd_editTable')"/>
</commandset>
<broadcasterset id="broadcasterset">
<!-- Broadcasters/commands with no other home -->
<!-- view menu -->
@ -471,31 +475,36 @@
oncommand="EditorRemoveLinks()" position="8"/>
<menuseparator position="9"/>
<!-- Heading submenu -->
<!-- Note: the 'Init' menu methods for Heading, Paragraph, and List
assume that the id = 'menu_'+tagName (the 'data' value),
except for the first ('none') item
-->
<!-- Heading Style submenu -->
<menu id="headingMenu" value="&headingMenu.label;"
accesskey="&formatheadingmenu.accesskey;"
position="10">
position="10" oncreate="InitHeadingMenu()">
<menupopup oncommand="EditorSetParagraphFormat('cmd_paragraphState', event.target.getAttribute('data'))">
<menuitem type="checkbox" value="&normalCmd.label;" accesskey="&normal.accesskey;" data=""/>
<menuitem type="checkbox" value="&heading1Cmd.label;" accesskey="&heading1.accesskey;" data="H1"/>
<menuitem type="checkbox" value="&heading2Cmd.label;" accesskey="&heading2.accesskey;" data="H2"/>
<menuitem type="checkbox" value="&heading3Cmd.label;" accesskey="&heading3.accesskey;" data="H3"/>
<menuitem type="checkbox" value="&heading4Cmd.label;" accesskey="&heading4.accesskey;" data="H4"/>
<menuitem type="checkbox" value="&heading5Cmd.label;" accesskey="&heading5.accesskey;" data="H5"/>
<menuitem type="checkbox" value="&heading6Cmd.label;" accesskey="&heading6.accesskey;" data="H6"/>
<menuitem id="menu_noHeading" type="radio" value="&noneCmd.label;" accesskey="&none.accesskey;" data=""/>
<menuitem id="menu_h1" type="radio" value="&heading1Cmd.label;" accesskey="&heading1.accesskey;" data="h1"/>
<menuitem id="menu_h2" type="radio" value="&heading2Cmd.label;" accesskey="&heading2.accesskey;" data="h2"/>
<menuitem id="menu_h3" type="radio" value="&heading3Cmd.label;" accesskey="&heading3.accesskey;" data="h3"/>
<menuitem id="menu_h4" type="radio" value="&heading4Cmd.label;" accesskey="&heading4.accesskey;" data="h4"/>
<menuitem id="menu_h5" type="radio" value="&heading5Cmd.label;" accesskey="&heading5.accesskey;" data="h5"/>
<menuitem id="menu_h6" type="radio" value="&heading6Cmd.label;" accesskey="&heading6.accesskey;" data="h6"/>
</menupopup>
</menu>
<!-- Paragraph Style submenu -->
<menu id="paragraphMenu" value="&paragraphMenu.label;"
accesskey="&formatparagraphmenu.accesskey;"
position="11">
position="11" oncreate="InitParagraphMenu()">
<menupopup oncommand="EditorSetParagraphFormat('cmd_paragraphState', event.target.getAttribute('data'))">
<menuitem type="checkbox" value="&normalCmd.label;" accesskey="&normal.accesskey;" data=""/>
<menuitem type="checkbox" value="&paragraphParagraphCmd.label;" accesskey="&paragraphparagraph.accesskey;" data="P"/>
<menuitem type="checkbox" value="&paragraphBlockquoteCmd.label;" accesskey="&paragraphblockquote.accesskey;" data="BLOCKQUOTE"/>
<menuitem type="checkbox" value="&paragraphAddressCmd.label;" accesskey="&paragraphaddress.accesskey;" data="ADDRESS"/>
<menuitem type="checkbox" value="&paragraphPreformatCmd.label;" accesskey="&paragraphpreformat.accesskey;" data="PRE"/>
<menuitem id="menu_normal" type="radio" value="&normalCmd.label;" accesskey="&normal.accesskey;" data=""/>
<menuitem id="menu_p" type="radio" value="&paragraphParagraphCmd.label;" accesskey="&paragraphparagraph.accesskey;" data="p"/>
<menuitem id="menu_address" type="radio" value="&paragraphAddressCmd.label;" accesskey="&paragraphaddress.accesskey;" data="address"/>
<menuitem id="menu_pre" type="radio" value="&paragraphPreformatCmd.label;" accesskey="&paragraphpreformat.accesskey;" data="pre"/>
<menuseparator/>
<menuitem id="menu_blockquote" type="checkbox" value="&paragraphBlockquoteCmd.label;" accesskey="&paragraphblockquote.accesskey;" data="blockquote"/>
</menupopup>
</menu>
@ -504,18 +513,17 @@
accesskey="&formatlistmenu.accesskey;"
position="12" oncreate="InitListMenu()">
<menupopup>
<menuitem id="menu_ul" type="checkbox" value="&listBulletCmd.label;" accesskey="&listbullet.accesskey;" observes="cmd_ul"/>
<menuitem id="menu_ol" type="checkbox" value="&listNumberedCmd.label;" accesskey="&listnumbered.accesskey;" observes="cmd_ol"/>
<menuitem id="menu_noList" type="radio" value="&noneCmd.label;" accesskey="&none.accesskey;" observes="cmd_removeList"/>
<menuitem id="menu_ul" type="radio" value="&listBulletCmd.label;" accesskey="&listbullet.accesskey;" observes="cmd_ul"/>
<menuitem id="menu_ol" type="radio" value="&listNumberedCmd.label;" accesskey="&listnumbered.accesskey;" observes="cmd_ol"/>
<menuitem id="menu_dt" type="radio" value="&listTermCmd.label;" accesskey="&listterm.accesskey;" observes="cmd_dt"/>
<menuitem id="menu_dd" type="radio" value="&listDefinitionCmd.label;" accesskey="&listdefinition.accesskey;" observes="cmd_dd"/>
<menuseparator/>
<menuitem id="menu_dt" type="checkbox" value="&listTermCmd.label;" accesskey="&listterm.accesskey;" observes="cmd_dt"/>
<menuitem id="menu_dd" type="checkbox" value="&listDefinitionCmd.label;" accesskey="&listdefinition.accesskey;" observes="cmd_dd"/>
<menuseparator/>
<menuitem id="listProps" value="&listProps.label;" accesskey="&listprops.accesskey;" observes="cmd_listProperties"/>
<menuitem id="listProps" value="&listProps.label;" accesskey="&listprops.accesskey;" observes="cmd_listProperties"/>
</menupopup>
</menu>
<menu id="alignMenu" value="&alignMenu.label;" accesskey="&formatalignmenu.accesskey;"
<menu id="alignMenu" value="&alignMenu.label;" accesskey="&formatalignmenu.accesskey;"
position="13">
<!-- Align submenu -->
<menupopup oncommand="EditorAlign('cmd_align', event.target.getAttribute('data'))">
@ -718,9 +726,10 @@
<menuitem value="&heading4Cmd.label;" data="h4"/>
<menuitem value="&heading5Cmd.label;" data="h5"/>
<menuitem value="&heading6Cmd.label;" data="h6"/>
<menuitem value="&paragraphBlockquoteCmd.label;" data="blockquote"/>
<menuitem value="&paragraphAddressCmd.label;" data="address"/>
<menuitem value="&paragraphPreformatCmd.label;" data="pre"/>
<menuseparator/>
<menuitem value="&paragraphBlockquoteCmd.label;" data="blockquote"/>
</menupopup>
</menulist>

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

@ -119,4 +119,5 @@ Clear=Clear
#Mouse actions
Click=Click
Drag=Drag
Unknown=Unknown
Unknown=Unknown
Close=Close

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

@ -412,9 +412,9 @@ Menu item text for "[Page|Table|Cell] Background color" is filled from
<!ENTITY formatlistMenu.label "List">
<!ENTITY formatlistmenu.accesskey "l">
<!ENTITY listBulletCmd.label "Bulleted">
<!ENTITY listbullet.accesskey "t">
<!ENTITY listbullet.accesskey "b">
<!ENTITY listNumberedCmd.label "Numbered">
<!ENTITY listnumbered.accesskey "n">
<!ENTITY listnumbered.accesskey "m">
<!ENTITY listTermCmd.label "Term">
<!ENTITY listterm.accesskey "t">
<!ENTITY listDefinitionCmd.label "Definition">
@ -422,10 +422,13 @@ Menu item text for "[Page|Table|Cell] Background color" is filled from
<!ENTITY listProps.label "List Properties...">
<!ENTITY listprops.accesskey "l">
<!-- Shared by Heading and Paragraph menu, and in toolbar menulist -->
<!-- Shared among Heading, Paragraph, and List submenus, and in toolbar menulist -->
<!ENTITY ParagraphSelect.tooltip "Choose a paragraph format from the drop-down list">
<!ENTITY normalCmd.label "Normal">
<!ENTITY normal.accesskey "n">
<!ENTITY noneCmd.label "None">
<!ENTITY none.accesskey "n">
<!-- isn't used in menu now, but may be added in future -->
<!ENTITY advancedPropertiesCmd.label "Advanced Properties...">
<!ENTITY advancedproperties.accesskey "v">

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

@ -36,6 +36,7 @@
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="Startup()"
persist="screenX screenY"
orient="vertical">
<script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>

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

@ -32,7 +32,7 @@
<box flex="1" style="margin-top: 0.2em" autostretch="never">
<!-- This will right-align the button -->
<spring flex="1"/>
<button class="dialog" oncommand="onAdvancedEdit()" value="&AdvancedEditButton.label;"
<button class="dialog" id="AdvancedEditButton1" oncommand="onAdvancedEdit()" value="&AdvancedEditButton.label;"
tooltip="aTooltip" tooltiptext="&AdvancedEditButton.tooltip;"/>
</box>
<separator class="groove"/>

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

@ -28,6 +28,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload = "Startup()"
persist="screenX screenY"
orient="vertical">
<!-- Methods common to all editor dialogs -->

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

@ -45,7 +45,6 @@ function Startup()
window.close();
return;
}
dump("1\n");
// Create dialog object to store controls for easy access
dialog = new Object;
dialog.heightInput = document.getElementById("height");
@ -56,21 +55,17 @@ dump("1\n");
dialog.shading = document.getElementById("3dShading");
dialog.pixelOrPercentMenulist = document.getElementById("pixelOrPercentMenulist");
dump("2\n");
// Make a copy to use for AdvancedEdit and onSaveDefault
globalElement = hLineElement.cloneNode(false);
dump("3 Init called...\n");
// Initialize control values based on existing attributes
InitDialog()
dump("1\n");
// SET FOCUS TO FIRST CONTROL
dialog.widthInput.focus();
// Resize window
window.sizeToContent();
dump("after sizeToContent\n");
}
// Set dialog widgets with attribute data

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

@ -36,6 +36,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload = "Startup()"
persist="screenX screenY"
orient="vertical">
<!-- Methods common to all editor dialogs -->

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

@ -297,7 +297,6 @@ function onMoreFewerImage()
dialog.doConstrain = dialog.constrainCheckbox.checked;
SetGlobalElementToCurrentDialogSettings();
//dialog.MoreSection.setAttribute("style","display: none");
dialog.MoreSection.setAttribute("collapsed","true");
window.sizeToContent();
dialog.MoreFewerButton.setAttribute("more","0");
@ -310,7 +309,6 @@ function onMoreFewerImage()
}
else
{
//dialog.MoreSection.setAttribute("style","display: inherit");
dialog.MoreSection.removeAttribute("collapsed");
// Hide the "Advanced Edit" next to "More..." Use button at bottom right of dialog
dialog.AdvancedEditButton.setAttribute("style","display: none");

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

@ -34,6 +34,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload = "Startup()"
persist="screenX screenY"
orient="vertical" flex="1">
<!-- Methods common to all editor dialogs -->

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

@ -32,6 +32,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload = "Startup()"
persist="screenX screenY"
orient="vertical">
<!-- Methods common to all editor dialogs -->

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

@ -36,6 +36,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload = "Startup()"
persist="screenX screenY"
align="vertical">
<!-- Methods common to all editor dialogs -->

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

@ -49,7 +49,7 @@ function Startup()
BulletStyleLabel = document.getElementById("BulletStyleLabel");
StartingNumberInput = document.getElementById("StartingNumber");
StartingNumberLabel = document.getElementById("StartingNumberLabel");
AdvancedEditButton = document.getElementById("AdvancedEditButton");
AdvancedEditButton = document.getElementById("AdvancedEditButton1");
// Try to get an existing list

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

@ -32,6 +32,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload = "Startup()"
persist="screenX screenY"
align="vertical">
<!-- Methods common to all editor dialogs -->

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

@ -36,6 +36,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload = "Startup()"
persist="screenX screenY"
orient="vertical">
<!-- Methods common to all editor dialogs -->

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

@ -61,9 +61,15 @@ function Startup()
if (location != "about:blank")
{
dialog.PageLocation.setAttribute("value", editorShell.editorDocument.location);
// Get last-modified file date+time
// TODO: Convert this to local time?
document.getElementById("PageModDate").setAttribute("value",editorShell.editorDocument.lastModified);
var lastmod = editorShell.editorDocument.lastModified; // get string of last modified date
var lastmoddate = Date.parse(lastmod); // convert modified string to date
if(lastmoddate == 0) // unknown date (or January 1, 1970 GMT)
lastmod = GetString("Unknown");
document.getElementById("PageModDate").setAttribute("value",lastmod);
}
authorElement = GetMetaElement("author");

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

@ -34,6 +34,7 @@
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="Startup()"
persist="screenX screenY"
orient="vertical">
<!-- Methods common to all editor dialogs -->

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

@ -31,6 +31,7 @@
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload = "Startup()"
persist="screenX screenY"
orient="vertical">
<script language="JavaScript" src="chrome://editor/content/EdDialogCommon.js"/>

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

@ -25,31 +25,35 @@
var tagname = "table"
var TableElement;
var CellElement;
var TableCaptionElement;
var TabPanel;
var dialog;
var globalCellElement;
var globalTableElement
var captionElement;
var TablePanel = 0;
var CellPanel = 1;
var currentPanel = TablePanel;
var validatePanel;
var defHAlignIndex = 0; // = left, index=0
var charIndex = 4;
var defHAlign = "left";
var centerStr = "center"; //Index=1
var rightStr = "right"; // 2
var justifyStr = "justify"; // 3
var charStr = "char"; // 4
var defVAlignIndex = 1; // = middle
var defVAlign = "middle";
var topStr = "top";
var bottomStr = "bottom";
var bgcolor = "bgcolor";
var CellIsHeader = false;
var rowCount = 1;
var colCount = 1;
var newRowCount;
var newColCount;
var selectedCellCount = 0;
var error = 0;
var ApplyUsed = false;
// What should these be?
var maxRows = 10000;
var maxColumns = 10000;
// dialog initialization code
function Startup()
@ -73,12 +77,23 @@ function Startup()
dialog.BorderWidthInput = document.getElementById("BorderWidthInput");
dialog.SpacingInput = document.getElementById("SpacingInput");
dialog.PaddingInput = document.getElementById("PaddingInput");
dialog.TableAlignSelect = document.getElementById("TableAlignSelect");
dialog.CaptionSelect = document.getElementById("CaptionSelect");
dialog.TableAlignList = document.getElementById("TableAlignList");
dialog.TableCaptionList = document.getElementById("TableCaptionList");
dialog.TableInheritColor = document.getElementById("TableInheritColor");
dialog.TableImageInput = document.getElementById("TableImageInput");
dialog.TableImageButton = document.getElementById("TableImageButton");
// dialog.TableLeaveLocCheck = document.getElementById("TableLeaveLocCheck");
dialog.RowsCheckbox = document.getElementById("RowsCheckbox");
dialog.ColumnsCheckbox = document.getElementById("ColumnsCheckbox");
dialog.TableHeightCheckbox = document.getElementById("TableHeightCheckbox");
dialog.TableWidthCheckbox = document.getElementById("TableWidthCheckbox");
dialog.TableBorderCheckbox = document.getElementById("TableBorderCheckbox");
dialog.CellSpacingCheckbox = document.getElementById("CellSpacingCheckbox");
dialog.CellPaddingCheckbox = document.getElementById("CellPaddingCheckbox");
dialog.TableHAlignCheckbox = document.getElementById("TableHAlignCheckbox");
dialog.TableCaptionCheckbox = document.getElementById("TableCaptionCheckbox");
dialog.TableColorCheckbox = document.getElementById("TableColorCheckbox");
dialog.TableImageCheckbox = document.getElementById("TableImageCheckbox");
// Cell Panel
dialog.SelectionList = document.getElementById("SelectionList");
@ -92,15 +107,24 @@ function Startup()
dialog.CellWidthUnits = document.getElementById("CellWidthUnits");
dialog.RowSpanInput = document.getElementById("RowSpanInput");
dialog.ColSpanInput = document.getElementById("ColSpanInput");
dialog.CellHAlignSelect = document.getElementById("CellHAlignSelect");
dialog.CellHAlignList = document.getElementById("CellHAlignList");
dialog.CellAlignCharInput = document.getElementById("CellAlignCharInput");
dialog.CellVAlignSelect = document.getElementById("CellVAlignSelect");
dialog.HeaderCheck = document.getElementById("HeaderCheck");
dialog.NoWrapCheck = document.getElementById("NoWrapCheck");
dialog.CellVAlignList = document.getElementById("CellVAlignList");
dialog.CellStyleList = document.getElementById("CellStyleList");
dialog.TextWrapList = document.getElementById("TextWrapList");
dialog.CellInheritColor = document.getElementById("CellInheritColor");
dialog.CellImageInput = document.getElementById("CellImageInput");
dialog.CellImageButton = document.getElementById("CellImageButton");
// dialog.CellLeaveLocCheck = document.getElementById("CellLeaveLocCheck");
dialog.CellHeightCheckbox = document.getElementById("CellHeightCheckbox");
dialog.CellWidthCheckbox = document.getElementById("CellWidthCheckbox");
dialog.SpanCheckbox = document.getElementById("SpanCheckbox");
dialog.CellHAlignCheckbox = document.getElementById("CellHAlignCheckbox");
dialog.CellVAlignCheckbox = document.getElementById("CellVAlignCheckbox");
dialog.CellStyleCheckbox = document.getElementById("CellStyleCheckbox");
dialog.TextWrapCheckbox = document.getElementById("TextWrapCheckbox");
dialog.CellColorCheckbox = document.getElementById("CellColorCheckbox");
dialog.CellImageCheckbox = document.getElementById("CellImageCheckbox");
TableElement = editorShell.GetElementOrParentByTagName("table", null);
var tagNameObj = new Object;
@ -123,7 +147,7 @@ dump("Cell is selected or is selection parent. Selected Cell count = "+selectedC
if(!TableElement)
{
dump("Failed to get selected element or create a new one!\n");
dump("Failed to get table element!\n");
window.close();
}
// We allow a missing cell -- see below
@ -182,6 +206,10 @@ dump("Cell is selected or is selection parent. Selected Cell count = "+selectedC
rowCount = editorShell.GetTableRowCount(TableElement);
colCount = editorShell.GetTableColumnCount(TableElement);
// User can change these via textfields
newRowCount = rowCount;
newColCount = colCount;
// This uses values set on global Elements;
InitDialog();
@ -209,23 +237,25 @@ function InitDialog()
//BUG: The align strings are converted: e.g., "center" becomes "Center";
var halign = globalTableElement.align.toLowerCase();
if (halign == centerStr)
dialog.TableAlignSelect.selectedIndex = 1;
dialog.TableAlignList.selectedIndex = 1;
else if (halign == bottomStr)
dialog.TableAlignSelect.selectedIndex = 2;
dialog.TableAlignList.selectedIndex = 2;
else // Default = left
dialog.TableAlignSelect.selectedIndex = 0;
dialog.TableAlignList.selectedIndex = 0;
captionElement = globalTableElement.caption;
dump("Caption Element = "+captionElement+"\n");
TableCaptionElement = globalTableElement.caption;
dump("Caption Element = "+TableCaptionElement+"\n");
var index = 0;
if (captionElement)
if (TableCaptionElement)
{
if(captionElement.vAlign == "top")
index = 1;
else
// Note: Other possible values are "left" and "right",
// but "align" is deprecated, so should we even support "botton"?
if (TableCaptionElement.vAlign == "bottom")
index = 2;
else
index = 1;
}
dialog.CaptionSelect.selectedIndex = index;
dialog.TableCaptionList.selectedIndex = index;
if (globalTableElement.background)
dialog.TableImageInput.value = globalTableElement.background;
@ -261,45 +291,44 @@ dump("RowSpan="+globalCellElement.rowSpan+" ColSpan="+globalCellElement.colSpan+
var valign = globalCellElement.vAlign.toLowerCase();
if (valign == topStr)
dialog.CellVAlignSelect.selectedIndex = 0;
dialog.CellVAlignList.selectedIndex = 0;
else if (valign == bottomStr)
dialog.CellVAlignSelect.selectedIndex = 2;
dialog.CellVAlignList.selectedIndex = 2;
else // Default = middle
dialog.CellVAlignSelect.selectedIndex = 1;
dialog.CellVAlignList.selectedIndex = 1;
var halign = globalCellElement.align.toLowerCase();
switch (halign)
{
case centerStr:
dialog.CellHAlignSelect.selectedIndex = 1;
dialog.CellHAlignList.selectedIndex = 1;
break;
case rightStr:
dialog.CellHAlignSelect.selectedIndex = 2;
dialog.CellHAlignList.selectedIndex = 2;
break;
case justifyStr:
dialog.CellHAlignSelect.selectedIndex = 3;
dialog.CellHAlignList.selectedIndex = 3;
break;
case charStr:
var alignChar = globalCellElement.getAttribute(charStr);
if (alignChar && alignChar.length == 1)
{
dialog.CellAlignCharInput.value = alignChar;
dialog.CellHAlignSelect.selectedIndex = 4;
dialog.CellHAlignList.selectedIndex = 4;
} else {
// "char" align set but no alignment char value
dialog.CellHAlignSelect.selectedIndex = 0;
dialog.CellHAlignList.selectedIndex = 0;
}
break;
default: // left
dialog.CellHAlignSelect.selectedIndex = 0;
dialog.CellHAlignList.selectedIndex = 0;
break;
}
// Show/hide extra message to explain "default" case
SelectCellHAlign();
CellIsHeader = (globalCellElement.nodeName == "TH");
dialog.HeaderCheck.checked = CellIsHeader;
dialog.NoWrapCheck.checked = globalCellElement.noWrap;
dialog.CellStyleList.selectedIndex = (globalCellElement.nodeName == "TH") ? 1 : 0;
dialog.TextWrapList.selectedIndex = globalCellElement.noWrap ? 1 : 0;
SetColor("cellBackgroundCW", globalCellElement.bgColor);
@ -321,13 +350,14 @@ function SelectCellTab()
currentPanel = CellPanel;
}
function SelectCellHAlign()
function SelectCellHAlign(checkboxID)
{
dump("dialog.CellHAlignSelect.selectedIndex ="+dialog.CellHAlignSelect.selectedIndex+"\n");
if (dialog.CellHAlignSelect.selectedIndex == 4)
dialog.CellAlignCharInput.removeAttribute("visibility");
dump("dialog.CellHAlignList.selectedIndex ="+dialog.CellHAlignList.selectedIndex+"\n");
if (dialog.CellHAlignList.selectedIndex == 4)
dialog.CellAlignCharInput.removeAttribute("collapsed");
else
dialog.CellAlignCharInput.setAttribute("visibility","hidden");
dialog.CellAlignCharInput.setAttribute("collapsed","true");
SetCheckbox(checkboxID);
}
function GetColorAndUpdate(ColorPickerID, ColorWellID, widget)
@ -426,7 +456,7 @@ function SwitchPanel(newPanel)
// More weirdness: Can't pass in "inputWidget" -- becomes undefined?!
// Must pass in just ID and use getElementById
function ValidateNumber(inputWidgetID, selectWidget, minVal, maxVal, element, attName)
function ValidateNumber(inputWidgetID, listWidget, minVal, maxVal, element, attName)
{
var inputWidget = document.getElementById(inputWidgetID);
// Global error return value
@ -437,8 +467,8 @@ function ValidateNumber(inputWidgetID, selectWidget, minVal, maxVal, element, at
var numString = inputWidget.value.trimString();
if (numString && numString != "")
{
if (selectWidget)
isPercent = (selectWidget.selectedIndex == 1);
if (listWidget)
isPercent = (listWidget.selectedIndex == 1);
if (isPercent)
maxLimit = 100;
@ -467,13 +497,11 @@ function ValidateNumber(inputWidgetID, selectWidget, minVal, maxVal, element, at
return numString;
}
function SetAlign(selectWidgetID, defaultIndex, element, attName)
function SetAlign(listID, defaultValue, element, attName)
{
selectWidget = document.getElementById(selectWidgetID);
value = selectWidget.value;
var value = document.getElementById(listID).selectedItem.data;
dump("SetAlign value = "+value+"\n");
var index = selectWidget.selectedIndex;
if (index == defaultIndex)
if (value == defaultValue)
element.removeAttribute(attName);
else
element.setAttribute(attName, value);
@ -482,52 +510,76 @@ dump("SetAlign value = "+value+"\n");
function ValidateTableData()
{
validatePanel = TablePanel;
var newRowCount = ValidateNumber("TableRowsInput", null, 1, rowCount, null, null);
if (error) return false;
if (dialog.RowsCheckbox.checked)
{
newRowCount = Number(ValidateNumber("TableRowsInput", null, 1, maxRows, null, null));
if (error) return false;
}
var newColCount = ValidateNumber("TableColumnsInput", null, 1, colCount, null, null);
if (error) return false;
if (dialog.ColumnsCheckbox.checked)
{
newColCount = Number(ValidateNumber("TableColumnsInput", null, 1, maxColumns, null, null));
if (error) return false;
}
// TODO: ADD/DELETE ROWS/COLUMNS
var temp = ValidateNumber("TableHeightInput", dialog.TableHeightUnits,
1, maxPixels, globalTableElement, "height");
if (error) return false;
temp = ValidateNumber("TableWidthInput", dialog.TableWidthUnits,
1, maxPixels, globalTableElement, "width");
if (error) return false;
if (dialog.TableHeightCheckbox.checked)
{
ValidateNumber("TableHeightInput", dialog.TableHeightUnits,
1, maxPixels, globalTableElement, "height");
if (error) return false;
}
var border = ValidateNumber("BorderWidthInput", null, 0, maxPixels, globalTableElement, "border");
// TODO: Deal with "BORDER" without value issue
if (error) return false;
if (dialog.TableWidthCheckbox.checked)
{
ValidateNumber("TableWidthInput", dialog.TableWidthUnits,
1, maxPixels, globalTableElement, "width");
if (error) return false;
}
temp = ValidateNumber("SpacingInput", null, 0, maxPixels, globalTableElement, "cellspacing");
if (error) return false;
if (dialog.TableBorderCheckbox.checked)
{
var border = ValidateNumber("BorderWidthInput", null, 0, maxPixels, globalTableElement, "border");
// TODO: Deal with "BORDER" without value issue
if (error) return false;
}
temp = ValidateNumber("PaddingInput", null, 0, maxPixels, globalTableElement, "cellpadding");
if (error) return false;
if (dialog.CellSpacingCheckbox.checked)
{
ValidateNumber("SpacingInput", null, 0, maxPixels, globalTableElement, "cellspacing");
if (error) return false;
}
SetAlign("TableAlignSelect", defHAlignIndex, globalTableElement, "align");
if (dialog.CellPaddingCheckbox.checked)
{
ValidateNumber("PaddingInput", null, 0, maxPixels, globalTableElement, "cellpadding");
if (error) return false;
}
if (dialog.TableHAlignCheckbox.checked)
SetAlign("TableAlignList", defHAlign, globalTableElement, "align");
// Color is set on globalCellElement immediately
// Background Image
var imageName = dialog.TableImageInput.value.trimString();
if (imageName && imageName != "")
if (dialog.TableImageCheckbox.checked)
{
if (IsValidImage(imageName))
globalTableElement.background = imageName;
else
var imageName = dialog.TableImageInput.value.trimString();
if (imageName && imageName != "")
{
dialog.TableImageInput.focus();
// Switch to appropriate panel for error reporting
SwitchPanel(validatePanel);
ShowInputErrorMessage(GetString("MissingImageError"));
return false;
if (IsValidImage(imageName))
globalTableElement.background = imageName;
else
{
dialog.TableImageInput.focus();
// Switch to appropriate panel for error reporting
SwitchPanel(validatePanel);
ShowInputErrorMessage(GetString("MissingImageError"));
return false;
}
} else {
globalTableElement.removeAttribute("background");
}
} else {
globalTableElement.removeAttribute("background");
}
return true;
}
@ -535,67 +587,89 @@ function ValidateCellData()
{
validatePanel = CellPanel;
var temp;
temp = ValidateNumber("CellHeightInput", dialog.TableHeightUnits,
1, maxPixels, globalCellElement, "height");
if (error) return false;
temp = ValidateNumber("CellWidthInput", dialog.TableWidthUnits,
1, maxPixels, globalCellElement, "width");
if (error) return false;
if (dialog.CellHeightCheckbox.checked)
{
ValidateNumber("CellHeightInput", dialog.TableHeightUnits,
1, maxPixels, globalCellElement, "height");
if (error) return false;
}
if (dialog.CellWidthCheckbox.checked)
{
ValidateNumber("CellWidthInput", dialog.TableWidthUnits,
1, maxPixels, globalCellElement, "width");
if (error) return false;
}
// Vertical alignment is complicated by "char" type
var hAlign = dialog.CellHAlignSelect.value;
if (dialog.SpanCheckbox.checked)
{
ValidateNumber("ColSpanInput", null,
1, colCount, globalCellElement, "colspan");
if (error) return false;
ValidateNumber("RowSpanInput", null,
1, rowCount, globalCellElement, "rowspan");
if (error) return false;
}
if (dialog.CellHAlignCheckbox.checked)
{
// Vertical alignment is complicated by "char" type
var hAlign = dialog.CellHAlignList.selectedItem.data;
dump("Cell hAlign = "+hAlign+"\n");
var index = dialog.CellHAlignSelect.selectedIndex;
dump("HAlign index="+index+"\n");
if (index == defHAlignIndex)
{
globalCellElement.removeAttribute("hAlign");
globalCellElement.removeAttribute(charStr);
}
else
{
if (index == charIndex)
if (hAlign != charStr)
globalCellElement.removeAttribute(charStr);
if (hAlign == "left")
{
var alignChar = dialog.CellAlignCharInput.value.trimString();
globalCellElement.setAttribute(charStr, alignChar);
dump("Alignment char="+alignChar+" Align Value="+dialog.CellHAlignSelect.value+"\n");
globalCellElement.removeAttribute("align");
}
globalCellElement.setAttribute("align",dialog.CellHAlignSelect.value);
}
SetAlign("CellVAlignSelect", defVAlignIndex, globalCellElement, "valign");
var shouldBeHeader = dialog.HeaderCheck.checked;
if (shouldBeHeader != CellIsHeader)
{
//TODO: THIS IS MESSY! Convert exisisting TD to TH or vice versa
}
if (dialog.NoWrapCheck.checked)
globalCellElement.setAttribute("nowrap","true");
else
globalCellElement.removeAttribute("nowrap");
// Background Image
var imageName = dialog.TableImageInput.value.trimString();
if (imageName && imageName != "")
{
if (IsValidImage(imageName))
globalCellElement.background = imageName;
else
{
dialog.CellImageInput.focus();
// Switch to appropriate panel for error reporting
SwitchPanel(validatePanel);
ShowInputErrorMessage(GetString("MissingImageError"));
if (hAlign == charStr)
{
var alignChar = dialog.CellAlignCharInput.value.trimString();
globalCellElement.setAttribute(charStr, alignChar);
dump("Alignment char="+alignChar+"\n");
}
globalCellElement.setAttribute("align", hAlign);
}
} else {
globalCellElement.removeAttribute("background");
}
if (dialog.CellVAlignCheckbox.checked)
SetAlign("CellVAlignList", defVAlign, globalCellElement, "valign");
if (dialog.TextWrapCheckbox.checked)
{
if (dialog.TextWrapList.selectedIndex == 1)
globalCellElement.setAttribute("nowrap","true");
else
globalCellElement.removeAttribute("nowrap");
}
// Background Image
if (dialog.CellImageCheckbox.checked)
{
var imageName = dialog.TableImageInput.value.trimString();
if (imageName && imageName != "")
{
if (IsValidImage(imageName))
globalCellElement.background = imageName;
else
{
dialog.CellImageInput.focus();
// Switch to appropriate panel for error reporting
SwitchPanel(validatePanel);
ShowInputErrorMessage(GetString("MissingImageError"));
}
} else {
globalCellElement.removeAttribute("background");
}
}
return true;
}
@ -629,27 +703,196 @@ function ValidateData()
return true;
}
function onOK()
// Call this when a textfield or menulist is changed
// so the checkbox is automatically set
function SetCheckbox(checkboxID)
{
// Set associated checkbox
document.getElementById(checkboxID).checked = true;
}
function ChangeIntTextfield(textfieldID, checkboxID)
{
// Filter input for just integers
forceInteger(textfieldID);
// Set associated checkbox
SetCheckbox(checkboxID);
}
function CloneAttribute(destElement, srcElement, attr)
{
var value = srcElement.getAttribute(attr);
// Use editorShell methods since we are always
// modifying a table in the document and
// we need transaction system for undo
if (!value || value.length == 0)
editorShell.RemoveAttribute(destElement, attr);
else
editorShell.setAttribute(destElement, attr, value);
}
function ApplyTableAttributes()
{
if (dialog.TableCaptionCheckbox.checked)
{
var newAlign = dialog.TableCaptionList.selectedItem.data;
if (!newAlign) newAlign = "";
if (TableCaptionElement)
{
// Get current alignment
var align = TableCaptionElement.align.toLowerCase();
// This is the default
if (!align) align = "top";
if (newAlign == "")
{
// Remove existing caption
editorShell.DeleteElement(TableCaptionElement);
TableCaptionElement = null;
}
else if( align != newAlign)
{
if (align == "top") // This is default, so don't explicitly set it
editorShell.RemoveAttribute(TableCaptionElement, "align");
else
editorShell.SetAttribute(TableCaptionElement, "align", newAlign);
}
}
else if (newAlign != "")
{
dump("Insert a table caption...\n");
// Create and insert a caption:
TableCaptionElement = editorShell.CreateElementWithDefaults("caption");
if (TableCaptionElement)
{
if (newAlign != "top")
TableCaptionElement.setAttribute("align", newAlign);
// Insert it into the table - caption is always inserted as first child
editorShell.InsertElement(TableCaptionElement, TableElement, 0);
}
}
}
//TODO: DOM manipulation to add/remove table rows/columns
if (dialog.RowsCheckbox.checked && newRowCount != rowCount)
{
}
if (dialog.ColumnsCheckbox.checked && newColCount != colCount)
{
}
if (dialog.TableHeightCheckbox.checked)
CloneAttribute(TableElement, globalTableElement, "height");
if (dialog.TableWidthCheckbox.checked)
CloneAttribute(TableElement, globalTableElement, "width");
if (dialog.TableBorderCheckbox.checked)
CloneAttribute(TableElement, globalTableElement, "border");
if (dialog.CellSpacingCheckbox.checked)
CloneAttribute(TableElement, globalTableElement, "cellspacing");
if (dialog.CellPaddingCheckbox.checked)
CloneAttribute(TableElement, globalTableElement, "cellpadding");
if (dialog.TableHAlignCheckbox.checked)
CloneAttribute(TableElement, globalTableElement, "align");
if (dialog.TableColorCheckbox.checked)
CloneAttribute(TableElement, globalTableElement, "bgcolor");
if (dialog.TableImageCheckbox.checked)
CloneAttribute(TableElement, globalTableElement, "background");
}
function ApplyCellAttributes(destElement)
{
if (dialog.CellHeightCheckbox.checked)
CloneAttribute(destElement, globalCellElement, "height");
if (dialog.CellWidthCheckbox.checked)
CloneAttribute(destElement, globalCellElement, "width");
if (dialog.SpanCheckbox.checked)
{
CloneAttribute(destElement, globalCellElement, "rowspan");
CloneAttribute(destElement, globalCellElement, "colspan");
}
if (dialog.CellHAlignCheckbox.checked)
{
CloneAttribute(destElement, globalCellElement, "align");
CloneAttribute(destElement, globalCellElement, charStr);
}
if (dialog.CellVAlignCheckbox.checked)
CloneAttribute(destElement, globalCellElement, "valign");
if (dialog.CellStyleCheckbox.checked)
{
var newStyleIndex = dialog.CellStyleList.selectedIndex;
var currentStyleIndex = (destElement.nodeName == "TH") ? 1 : 0;
if (newStyleIndex != currentStyleIndex)
{
//TODO: THIS IS MESSY! Convert exisisting TD to TH or vice versa
CurrentStyleIndex = newStyleIndex;
}
}
if (dialog.TextWrapCheckbox.checked)
CloneAttribute(destElement, globalCellElement, "nowrap");
if (dialog.CellColorCheckbox.checked)
CloneAttribute(destElement, globalCellElement, "bgcolor");
if (dialog.CellImageCheckbox.checked)
CloneAttribute(destElement, globalCellElement, "background");
}
function Apply()
{
if (ValidateData())
{
editorShell.BeginBatchChanges();
editorShell.CloneAttributes(TableElement, globalTableElement);
// Apply changes to all selected cells
var selectedCell = editorShell.GetFirstSelectedCell();
while (selectedCell)
// Can't use editorShell.CloneAttributes -- we must change only
// attributes that are checked!
ApplyTableAttributes();
// We may have just a table, so check for cell element
if (globalCellElement)
{
// TODO: We need to change this to set only particular attributes
// Set an "ignore" attribute on the attribute node?
editorShell.CloneAttributes(selectedCell,globalCellElement);
selectedCell = editorShell.GetNextSelectedCell();
}
//TODO: DOM manipulation to add/remove table rows/columns,
// Switch cell type to TH -- involves removing TD and replacing with TD
// Creating and moving CAPTION element
// Apply changes to all selected cells
var selectedCell = editorShell.GetFirstSelectedCell();
while (selectedCell)
{
ApplyCellAttributes(selectedCell);
selectedCell = editorShell.GetNextSelectedCell();
}
}
editorShell.EndBatchChanges();
// Change text on "Cancel" button after Apply is used
if (!ApplyUsed)
{
document.getElementById("cancel").setAttribute("value",GetString("Close"));
ApplyUsed = true;
}
return true;
}
return false;
}
function onOK()
{
// Do same as Apply and close window if ValidateData succeeded
return Apply();
}

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

@ -35,6 +35,7 @@
xmlns:html="http://www.w3.org/1999/xhtml"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="Startup()"
persist="screenX screenY"
orient="vertical">
<!-- Methods common to all editor dialogs -->
@ -51,68 +52,71 @@
<tab id="CellTab" oncommand="SelectCellTab()" value="&cellTab.label;"/>
<spring flex="1"/>
</tabbox>
<tabpanel class="Padding5" orient="vertical" id="TabPanel">
<tabpanel orient="vertical" id="TabPanel">
<!-- TABLE PANEL -->
<box id="TablePanel" orient="vertical">
<titledbox><title><text value="&size.label;"/></title>
<box orient="vertical">
<box valign="baseline" autostretch="never">
<text class="MinWidth50" align="left" for="TableRowsInput" value="&tableRows.label;"/>
<textfield class="narrow" id="TableRowsInput" onkeyup="forceInteger(this.id)" disabled="true"/>
</box>
<spring class="spacer"/>
<box valign="baseline" autostretch="never">
<text class="MinWidth50" align="left" for="TableColumnsInput" value="&tableColumns.label;"/>
<textfield class="narrow" id="TableColumnsInput" onkeyup="forceInteger(this.id)" disabled="true"/>
</box>
</box>
<grid>
<columns><column/><column/></columns>
<rows>
<row valign="middle">
<checkbox id="RowsCheckbox" value="&tableRows.label;"/>
<textfield class="narrow" id="TableRowsInput" onkeyup="ChangeIntTextfield(this.id,'RowsCheckbox');"/>
</row>
<row valign="middle">
<checkbox id="ColumnsCheckbox" value="&tableColumns.label;"/>
<textfield class="narrow" id="TableColumnsInput" onkeyup="ChangeIntTextfield(this.id,'ColumnsCheckbox');"/>
</row>
</rows>
</grid>
<spring class="bigspacer"/>
<spring class="bigspacer"/>
<box orient="vertical">
<box valign="baseline" autostretch="never">
<text class="MinWidth50" align="right" for="TableHeightInput" value="&tableHeight.label;"/>
<textfield class="narrow" id="TableHeightInput" onkeyup="forceInteger(this.id)"/>
<menulist id="TableHeightUnits"/>
</box>
<spring class="spacer"/>
<box valign="baseline" autostretch="never">
<text class="MinWidth50" align="right" for="TableWidthInput" value="&tableWidth.label;"/>
<textfield class="narrow" id="TableWidthInput" onkeyup="forceInteger(this.id)"/>
<menulist id="TableWidthUnits"/>
</box>
</box>
<spring flex="1"/>
<grid>
<columns><column/><column/><column/></columns>
<rows>
<row valign="middle">
<checkbox id="TableHeightCheckbox" value="&tableHeight.label;"/>
<textfield class="narrow" id="TableHeightInput" onkeyup="ChangeIntTextfield(this.id,'TableHeightCheckbox');"/>
<menulist id="TableHeightUnits" oncommand="SetCheckbox('TableHeightCheckbox');"/>
</row>
<row valign="middle">
<checkbox id="TableWidthCheckbox" value="&tableWidth.label;"/>
<textfield class="narrow" id="TableWidthInput" onkeyup="ChangeIntTextfield(this.id,'TableWidthCheckbox');"/>
<menulist id="TableWidthUnits" oncommand="SetCheckbox('TableWidthCheckbox');"/>
</row>
</rows>
</grid>
</titledbox>
<box>
<box><!-- Border and Alignment -->
<titledbox orient="vertical"><title><text align="left" value="&tableBorderSpacing.label;"/></title>
<box valign="baseline" autostretch="never">
<text align="left" for="BorderWidthInput" value="&tableBorderWidth.label;"/>
<spring class="spacer"/>
<textfield class="narrow" id="BorderWidthInput" onkeyup="forceInteger(this.id)"/>
<text align="left" value="&pixels.label;"/>
</box>
<spring class="spacer"/>
<box valign="baseline" autostretch="never">
<text class="MinWidth50" align="left" for="SpacingInput" value="&tableSpacing.label;"/>
<textfield class="narrow" id="SpacingInput" onkeyup="forceInteger(this.id)"/>
<text align="left" value="&tablePxBetwCells.label;"/>
</box>
<spring class="spacer"/>
<box valign="baseline" autostretch="never">
<text class="MinWidth50" align="left" for="PaddingInput" value="&tablePadding.label;"/>
<textfield class="narrow" id="PaddingInput" onkeyup="forceInteger(this.id)"/>
<!-- Use DIV instead of TEXT because label has embeded <br> -->
<html:div>&tablePxBetwBrdrCellContent.label;</html:div>
</box>
<spring flex="1"/>
<grid>
<columns><column/><column/><column/></columns>
<rows>
<row valign="middle">
<checkbox id="TableBorderCheckbox" value="&tableBorderWidth.label;"/>
<textfield class="narrow" id="BorderWidthInput" onkeyup="ChangeIntTextfield(this.id,'TableBorderCheckbox');"/>
<text class="label" align="left" value="&pixels.label;"/>
</row>
<row valign="middle">
<checkbox id="CellSpacingCheckbox" value="&tableSpacing.label;"/>
<textfield class="narrow" id="SpacingInput" onkeyup="ChangeIntTextfield(this.id,'CellSpacingCheckbox');"/>
<text class="label" value="&tablePxBetwCells.label;"/>
</row>
<row valign="middle" autostretch="never">
<checkbox id="CellPaddingCheckbox" value="&tablePadding.label;"/>
<textfield class="narrow" id="PaddingInput" onkeyup="ChangeIntTextfield(this.id,'CellPaddingCheckbox');"/>
<!-- Use HTML instead of TEXT to let it wrap -->
<html flex="1">&tablePxBetwBrdrCellContent.label;</html>
</row>
</rows>
</grid>
</titledbox>
<spring class="spacer"/>
<box orient="vertical" flex="1">
<spring class="bigspacer"/>
<box orient="vertical" flex="1">
<text align="left" for="TableAlignSelect" value="&tableAlignment.label;"/>
<checkbox id="TableHAlignCheckbox" value="&tableAlignment.label;"/>
<spring class="smallspacer"/>
<menulist id="TableAlignSelect">
<menulist id="TableAlignList" oncommand="SetCheckbox('TableHAlignCheckbox');">
<menupopup>
<menuitem value="&AlignLeft.label;" data="left"/>
<menuitem value="&AlignCenter.label;" data="center"/>
@ -120,196 +124,211 @@
</menupopup>
</menulist>
<spring class="bigspacer"/>
<text align="left" for="CaptionSelect" value="&tableCaption.label;"/>
<checkbox id="TableCaptionCheckbox" value="&tableCaption.label;"/>
<spring class="smallspacer"/>
<menulist id="CaptionSelect" disabled="true">
<menulist id="TableCaptionList" oncommand="SetCheckbox('TableCaptionCheckbox');">
<menupopup>
<menuitem value="&tableCaptionNone.label;"/>
<menuitem value="&tableCaptionAbove.label;"/>
<menuitem value="&tableCaptionBelow.label;"/>
<menuitem value="&tableCaptionNone.label;" data=""/>
<menuitem value="&tableCaptionAbove.label;" data="top"/>
<menuitem value="&tableCaptionBelow.label;" data="bottom"/>
</menupopup>
</menulist>
<spring flex="1"/>
</box>
</box>
<spring class="bigspacer"/>
</box>
</box> <!-- Border and alignment -->
<titledbox orient="vertical"><title><text align="left" value="&background.label;"/></title>
<box valign="baseline" autostretch="never">
<text class="MinWidth50" align="left" value="&color.label;"/>
<menu class="colorpicker">
<box>
<spring id="tableBackgroundCW" class="color-well"/>
<image class="popup-trigger"/>
<grid>
<columns><column/><column/></columns>
<rows>
<row valign="middle">
<checkbox id="TableColorCheckbox" value="&color.label;"/>
<box valign="middle">
<menu class="colorpicker">
<box>
<spring id="tableBackgroundCW" class="color-well"/>
<image class="popup-trigger"/>
</box>
<menupopup>
<colorpicker id="tableBackgroundCP" palettename="standard" onclick="GetColorAndUpdate('tableBackgroundCP','tableBackgroundCW',this);"/>
<button class="dialog" value="&defaultColor.label;" oncommand="GetColorAndUpdate('tableBackgroundCP','tableBackgroundCW',this)"/>
</menupopup>
</menu>
<spring class="spacer"/>
<text class="label" id="TableInheritColor" value="&tableInheritColor.label;" hidden="true"/>
</box>
<menupopup>
<colorpicker id="tableBackgroundCP" palettename="standard" onclick="GetColorAndUpdate('tableBackgroundCP','tableBackgroundCW',this);"/>
<button class="dialog" value="&defaultColor.label;" oncommand="GetColorAndUpdate('tableBackgroundCP','tableBackgroundCW',this)"/>
</menupopup>
</menu>
<spring class="spacer"/>
<text id="TableInheritColor" value="&tableInheritColor.label;" hidden="true"/>
</box>
<spring class="spacer"/>
<box valign="baseline" autostretch="never">
<text class="MinWidth50" align="left" for="TableImageInput" value="&image.label;"/>
</row>
<row valign="middle">
<checkbox id="TableImageCheckbox" value="&image.label;"/>
<textfield id="TableImageInput" flex="1"/>
<button class="dialog" value="&ChooseImage.label;" id="TableImageButton" oncommand="ChooseCellImage()"/>
</box>
<!-- Not sure if we will support this
<box valign="baseline" autostretch="never">
<spring class="MinWidth50"/>
<html:input type="checkbox" id="TableLeaveLocCheck"/>
<text align="left" for="TableLeaveLocCheck" value="&LeaveImageAtLocation.label;"/>
</box>
-->
</titledbox>
</row>
</rows>
</grid>
</titledbox><!-- Table Background -->
<spring class="spacer"/>
<box flex="1" autostretch="never">
<spring flex="1"/>
<html class="wrap" flex="1" style="width: 1em">&tableUseCheckboxHelp.label;</html>
<!-- From EdDialogOvlerlay.xul -->
<button class="dialog" id="AdvancedEditButton"/>
</box>
<spring flex="1"/>
</box>
</box><!-- Table Panel -->
<!-- CELL PANEL -->
<box id="CellPanel" orient="vertical">
<titledbox autostretch="never" valign="baseline">
<titledbox autostretch="never" valign="middle">
<title><text align="left" value="&cellSelection.label;"/></title>
<spring class="spacer"/>
<menulist class="MinWidth50" id="SelectionList">
<menupopup>
<menuitem data="1" id="SelectCellItem" value="&cellSelectionCell.label;"/>
<menuitem data="2" id="SelectRowItem" value="&cellSelectionRow.label;"/>
<menuitem data="3" id="SelectColumnItem" value="&cellSelectionColumn.label;"/>
</menupopup>
</menulist>
<spring class="bigspacer"/>
<button class="dialog MinWidth50" value="&cellSelectionPrevious.label;" oncommand="SelectPrevious()" disabled="true"/>
<spring class="bigspacer"/>
<button class="dialog MinWidth50" value="&cellSelectionNext.label;" oncommand="SelectNext()" disabled="true"/>
<grid>
<columns><column flex="1"/><column flex="1"/><column flex="1"/></columns>
<rows>
<row valign="middle" autostretch="never">
<menulist id="SelectionList" oncommand="ChangeSelection('event.target.id');">
<menupopup>
<menuitem id="SelectCellItem" value="&cellSelectionCell.label;"/>
<menuitem id="SelectRowItem" value="&cellSelectionRow.label;"/>
<menuitem id="SelectColumnItem" value="&cellSelectionColumn.label;"/>
</menupopup>
</menulist>
<button class="dialog" value="&cellSelectionPrevious.label;" oncommand="SelectPrevious()"/>
<button class="dialog" value="&cellSelectionNext.label;" oncommand="SelectNext()"/>
</row>
</rows>
</grid>
<spring flex="1"/>
</titledbox>
<!-- cell size titledbox -->
<titledbox><title><text align="left" value="&size.label;"/></title>
<box orient="vertical">
<box valign="baseline" autostretch="never">
<text class="MinWidth50" align="left" for="CellHeightInput" value="&tableHeight.label;"/>
<textfield class="narrow" id="CellHeightInput" onkeyup="forceInteger(this.id)"/>
<menulist id="CellHeightUnits"/>
</box>
<spring class="spacer"/>
<box valign="baseline" autostretch="never">
<text class="MinWidth50" align="left" for="CellWidthInput" value="&tableWidth.label;"/>
<textfield class="narrow" id="CellWidthInput" onkeyup="forceInteger(this.id)"/>
<menulist id="CellWidthUnits"/>
</box>
</box>
<grid>
<columns><column/><column/><column/></columns>
<rows>
<row valign="middle" autostretch="never">
<checkbox id="CellHeightCheckbox" value="&tableHeight.label;"/>
<textfield class="narrow" id="CellHeightInput" onkeyup="ChangeIntTextfield(this.id,'CellHeightCheckbox');"/>
<menulist id="CellHeightUnits" oncommand="SetCheckbox('CellHeightCheckbox');"/>
</row>
<row valign="middle" autostretch="never">
<checkbox id="CellWidthCheckbox" value="&tableWidth.label;"/>
<textfield class="narrow" id="CellWidthInput" onkeyup="ChangeIntTextfield(this.id,'CellWidthCheckbox');"/>
<menulist id="CellWidthUnits" oncommand="SetCheckbox('CellWidthCheckbox');"/>
</row>
</rows>
</grid>
<spring class="bigspacer"/>
<box orient="vertical">
<spring class="spacer"/>
<text for="RowSpanInput" value="&cellSpans.label;"/>
</box>
<box orient="vertical">
<box valign="baseline" autostretch="never">
<textfield class="narrow" id="RowSpanInput" onkeyup="forceInteger(this.id)"/>
<text align="left" value="&cellSpanRows.label;"/>
</box>
<spring class="spacer"/>
<box valign="baseline" autostretch="never">
<textfield class="narrow" id="ColSpanInput" onkeyup="forceInteger(this.id)"/>
<text align="left" value="&cellSpanCols.label;"/>
</box>
</box>
<grid>
<columns><column/><column/><column/></columns>
<rows>
<row valign="middle" autostretch="never">
<checkbox id="SpanCheckbox" value="&cellSpans.label;"/>
<textfield class="narrow" id="RowSpanInput" onkeyup="ChangeIntTextfield(this.id,'SpanCheckbox');"/>
<text align="left" value="&cellSpanRows.label;"/>
</row>
<row valign="middle" autostretch="never">
<spring/>
<textfield class="narrow" id="ColSpanInput" onkeyup="ChangeIntTextfield(this.id,'ColSpanInput');"/>
<text align="left" value="&cellSpanCols.label;"/>
</row>
</rows>
</grid>
</titledbox>
<box>
<box><!-- Alignment and style -->
<titledbox orient="vertical" flex="1">
<title><text align="left" value="&cellContentAlignment.label;"/></title>
<box valign="top" autostretch="never">
<text class="MinWidth70" align="right" for="CellHAlignSelect" value="&cellHorizontal.label;"/>
<menulist class="MinWidth100" id="CellHAlignSelect">
<menupopup oncommand="SelectCellHAlign()">
<menuitem value="&AlignLeft.label;" data="left"/>
<menuitem value="&AlignCenter.label;" data="center"/>
<menuitem value="&AlignRight.label;" data="right"/>
<menuitem value="&cellAlignJustify.label;" data="justify"/>
<menuitem value="&cellAlignAtChar.label;" data="char"/>
</menupopup>
</menulist>
<spring class="spacer"/>
<html:input style="width: 1em" id="CellAlignCharInput" maxlength="2" visibility="hidden"/>
</box>
<spring class="spacer"/>
<box valign="top" autostretch="never">
<text class="MinWidth70" align="right" for="CellVAlignSelect" value="&cellVertical.label;"/>
<menulist class="MinWidth100" id="CellVAlignSelect">
<menupopup>
<menuitem value="&cellAlignTop.label;" data="top"/>
<menuitem value="&cellAlignMiddle.label;" data="middle"/>
<menuitem value="&cellAlignBottom.label;" data="bottom"/>
</menupopup>
</menulist>
</box>
<grid>
<columns><column/><column/><column/></columns>
<rows>
<row valign="middle" autostretch="never">
<checkbox id="CellHAlignCheckbox" value="&cellHorizontal.label;"/>
<menulist id="CellHAlignList" oncommand="SelectCellHAlign('CellHAlignCheckbox')">
<menupopup>
<menuitem value="&AlignLeft.label;" data="left"/>
<menuitem value="&AlignCenter.label;" data="center"/>
<menuitem value="&AlignRight.label;" data="right"/>
<menuitem value="&cellAlignJustify.label;" data="justify"/>
<menuitem value="&cellAlignAtChar.label;" data="char"/>
</menupopup>
</menulist>
<textfield id="CellAlignCharInput" maxlength="2" style="width: 1em" visibility="hidden"/>
</row>
<row valign="middle" autostretch="never">
<checkbox id="CellVAlignCheckbox" value="&cellVertical.label;"/>
<menulist id="CellVAlignList" oncommand="SetCheckbox('CellVAlignCheckbox');">
<menupopup>
<menuitem value="&cellAlignTop.label;" data="top"/>
<menuitem value="&cellAlignMiddle.label;" data="middle"/>
<menuitem value="&cellAlignBottom.label;" data="bottom"/>
</menupopup>
</menulist>
<spring/>
</row>
</rows>
</grid>
</titledbox>
<spring class="spacer"/>
<titledbox orient="vertical">
<title><text align="left" value="&cellTextStyle.label;"/></title>
<box valign="baseline" autostretch="never">
<html:input type="checkbox" id="HeaderCheck"/>
<text align="left" for="HeaderCheck" value="&cellHeader.label;"/>
</box>
<box valign="baseline" autostretch="never">
<html:input type="checkbox" id="NoWrapCheck"/>
<text align="left" for="NoWrapCheck" value="&cellNoWrap.label;"/>
</box>
</titledbox>
</box>
<box orient="vertical">
<checkbox id="CellStyleCheckbox" value="&cellStyle.label;"/>
<menulist id="CellStyleList" >
<menupopup>
<menuitem value="&cellNormal.label;" data="td"/>
<menuitem value="&cellHeader.label;" data="th"/>
</menupopup>
</menulist>
<spring class="spacer"/>
<checkbox id="TextWrapCheckbox" value="&cellTextWrap.label;"/>
<menulist id="TextWrapList" oncommand="SetCheckbox('TextWrapCheckbox');">
<menupopup>
<menuitem value="&cellWrap.label;" data="wrap"/>
<menuitem value="&cellNoWrap.label;" data="nowrap"/>
</menupopup>
</menulist>
</box>
</box><!-- Alignment and Style -->
<titledbox orient="vertical"><title><text align="left" value="&background.label;"/></title>
<box valign="baseline" autostretch="never">
<text class="MinWidth50" align="left" value="&color.label;"/>
<menu class="colorpicker">
<box>
<spring id="cellBackgroundCW" class="color-well"/>
<image class="popup-trigger"/>
<grid>
<columns><column/><column/></columns>
<rows>
<row valign="middle" autostretch="never">
<checkbox id="CellColorCheckbox" value="&color.label;"/>
<box valign="middle">
<menu class="colorpicker">
<box>
<spring id="cellBackgroundCW" class="color-well"/>
<image class="popup-trigger"/>
</box>
<menupopup>
<colorpicker id="cellBackgroundCP" palettename="standard"
onclick="GetColorAndUpdate('cellBackgroundCP','cellBackgroundCW',this)"/>
<button class="dialog" value="&defaultColor.label;"
oncommand="GetColorAndUpdate('cellBackgroundCP','cellBackgroundCW',this)"/>
</menupopup>
</menu>
<spring class="spacer"/>
<text class="label" id="CellInheritColor" value="&cellInheritColor.label;" hidden="true"/>
</box>
<menupopup>
<colorpicker id="cellBackgroundCP" palettename="standard"
onclick="GetColorAndUpdate('cellBackgroundCP','cellBackgroundCW',this)"/>
<button class="dialog" value="&defaultColor.label;"
oncommand="GetColorAndUpdate('cellBackgroundCP','cellBackgroundCW',this)"/>
</menupopup>
</menu>
<spring class="spacer"/>
<text id="CellInheritColor" value="&cellInheritColor.label;" hidden="true"/>
</box>
<spring class="spacer"/>
<box valign="baseline" autostretch="never">
<text class="MinWidth50" align="left" for="CellImageInput" value="&image.label;" />
<textfield id="CellImageInput" flex="1"/>
<button class="dialog" value="&ChooseImage.label;" id="CellImageButton" oncommand="ChooseCellImage()"/>
</box>
<!-- Not sure if we will support this
<box valign="baseline" autostretch="never">
<spring class="MinWidth50"/>
<html:input type="checkbox" id="CellLeaveLocCheck"/>
<text align="left" for="CellLeaveLocCheck" value="&LeaveImageAtLocation.label;"/>
</box>
-->
</titledbox>
</row>
<row valign="middle" autostretch="never">
<checkbox id="CellImageCheckbox" value="&image.label;" />
<textfield id="CellImageInput" flex="1"/>
<button class="dialog" value="&ChooseImage.label;" id="CellImageButton" oncommand="ChooseCellImage()"/>
</row>
</rows>
</grid>
</titledbox><!-- Table Background -->
<spring class="spacer"/>
<box autostretch="never">
<spring flex="1"/>
<html class="wrap" flex="1" style="width: 1em">&cellUseCheckboxHelp.label;</html>
<!-- From EdDialogOvlerlay.xul -->
<button class="dialog" id="AdvancedEditButton2"/>
</box>
</box>
</tabpanel>
<spring class="spacer"/>
<!-- from EdDialogOverlay -->
<box>
<spring flex="1"/>
<button class="dialog" value="Apply"/>
<button class="dialog" value="Apply" oncommand="Apply();"/>
<box id="okCancelButtons"/>
</box>
</tabcontrol>

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

@ -36,6 +36,7 @@
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
xmlns:html="http://www.w3.org/1999/xhtml"
onload = "Startup()"
persist="screenX screenY"
orient="vertical">
<!-- Methods common to all editor dialogs -->

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

@ -28,7 +28,7 @@
<!ENTITY tableHeight.label "Height:">
<!ENTITY tableWidth.label "Width:">
<!ENTITY tableBorderSpacing.label "Borders and Spacing">
<!ENTITY tableBorderWidth.label "Border width:">
<!ENTITY tableBorderWidth.label "Border:">
<!ENTITY tableSpacing.label "Spacing:">
<!ENTITY tablePadding.label "Padding:">
<!ENTITY tablePxBetwCells.label "pixels between cells">
@ -40,6 +40,8 @@
<!ENTITY tableCaptionBelow.label "Below Table">
<!ENTITY tableCaptionNone.label "None">
<!ENTITY tableInheritColor.label "(Let page color show through)">
<!-- Don't translate <html:br/> -->
<!ENTITY tableUseCheckboxHelp.label "Use checkboxes to control which properties<html:br/>are applied to the table">
<!ENTITY cellPercent.label "percent of table">
<!ENTITY cellSelection.label "Selection">
@ -52,9 +54,12 @@
<!ENTITY cellContentAlignment.label "Content Alignment">
<!ENTITY cellHorizontal.label "Horizontal:">
<!ENTITY cellVertical.label "Vertical:">
<!ENTITY cellTextStyle.label "Text Style">
<!ENTITY cellStyle.label "Cell Style:">
<!ENTITY cellNormal.label "Normal">
<!ENTITY cellHeader.label "Header">
<!ENTITY cellNoWrap.label "Don't wrap text">
<!ENTITY cellTextWrap.label "Text Wrap:">
<!ENTITY cellWrap.label "Wrap">
<!ENTITY cellNoWrap.label "Don't wrap">
<!ENTITY cellAlignTop.label "Top">
<!ENTITY cellAlignMiddle.label "Middle">
<!ENTITY cellAlignBottom.label "Bottom">
@ -63,6 +68,8 @@
<!ENTITY cellSpanRows.label "rows">
<!ENTITY cellSpanCols.label "columns">
<!ENTITY cellInheritColor.label "(Let table color show through)">
<!-- Don't translate <html:br/> -->
<!ENTITY cellUseCheckboxHelp.label "Use checkboxes to control which properties<html:br/>are applied to all selected cells">
<!-- Used in both Table and Cell panels -->
<!ENTITY defaultColor.label "Don't specify color">