Fix for 41034 - new list submenu, fix for 41351 - object properties not working. Fix for OS2 support for table selection feedback in menu. r=sfraser, a=beppe

This commit is contained in:
cmanske%netscape.com 2000-06-05 20:26:26 +00:00
Родитель 0d7f94d904
Коммит 7ebb2f9065
7 изменённых файлов: 138 добавлений и 99 удалений

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

@ -183,29 +183,12 @@ var nsOpenCommand =
dump("filePicker.chooseInputFile threw an exception\n");
}
/* check for already open window and activate it...
/* This checks for already open window and activates it...
* note that we have to test the native path length
* since fileURL.spec will be "file:///" if no filename picked (Cancel button used)
*/
if (fp.file && fp.file.path.length > 0) {
var found = FindAndSelectEditorWindowWithURL(fp.fileURL.spec);
if (!found)
{
// if the existing window is untouched, just load there
if (PageIsEmptyAndUntouched())
{
window.editorShell.LoadUrl(fp.fileURL.spec);
}
else
{
/* open new window */
window.openDialog("chrome://editor/content",
"_blank",
"chrome,dialog=no,all",
fp.fileURL.spec);
}
}
EditorOpenUrl(fp.fileURL.spec);
}
}
};
@ -223,7 +206,7 @@ var nsSaveAsCharsetCommand =
if(window.openDialog("chrome://editor/content/EditorSaveAsCharset.xul","_blank", "chrome,close,titlebar,modal"))
{
if( window.ok )
return editorShell.saveDocument(true, false);
return window.editorShell.saveDocument(true, false);
}
return false;
}
@ -235,14 +218,14 @@ var nsRevertCommand =
{
return (window.editorShell &&
window.editorShell.documentModified &&
editorShell.editorDocument.location != "about:blank");
window.editorShell.editorDocument.location != "about:blank");
},
doCommand: function(aCommand)
{
if (window.editorShell &&
window.editorShell.documentModified &&
editorShell.editorDocument.location != "about:blank")
window.editorShell.editorDocument.location != "about:blank")
{
// Confirm with the user to abandon current changes
if (commonDialogsService)
@ -250,20 +233,20 @@ var nsRevertCommand =
var result = {value:0};
// Put the page title in the message string
var title = editorShell.editorDocument.title;
var title = window.editorShell.editorDocument.title;
if (!title || title.length == 0)
title = editorShell.GetTitle("untitled");
title = window.editorShell.GetTitle("untitled");
var msg = editorShell.GetString("AbandonChanges").replace(/%title%/,title);
var msg = window.editorShell.GetString("AbandonChanges").replace(/%title%/,title);
commonDialogsService.UniversalDialog(
window,
null,
editorShell.GetString("RevertCaption"),
window.editorShell.GetString("RevertCaption"),
msg,
null,
editorShell.GetString("Revert"),
editorShell.GetString("Cancel"),
window.editorShell.GetString("Revert"),
window.editorShell.GetString("Cancel"),
null,
null,
null,
@ -280,7 +263,7 @@ var nsRevertCommand =
// Reload page if first button (Rever) was pressed
if(result.value == 0)
editorShell.LoadUrl(editorShell.editorDocument.location);
window.editorShell.LoadUrl(editorShell.editorDocument.location);
}
}
}
@ -330,7 +313,7 @@ var nsPreviewCommand =
doCommand: function(aCommand)
{
if (!editorShell.CheckAndSaveDocument(editorShell.GetString("BeforePreview")))
if (!editorShell.CheckAndSaveDocument(window.editorShell.GetString("BeforePreview")))
return;
var fileurl = "";
@ -657,7 +640,7 @@ var nsObjectPropertiesCommand =
element.nodeName == "table" ||
element.nodeName == "td" ||
element.nodeName == "a" ||
editorShell.GetSelectedElement("href")));
window.editorShell.GetSelectedElement("href")));
}
return false;
},
@ -667,7 +650,8 @@ var nsObjectPropertiesCommand =
var element = GetSelectedElementOrParentCell();
if (element)
{
switch (element.nodeName)
var name = element.nodeName.toLowerCase();
switch (name)
{
case 'img':
goDoCommand("cmd_image");
@ -694,7 +678,7 @@ var nsObjectPropertiesCommand =
}
} else {
// We get a partially-selected link if asked for specifically
element = editorShell.GetSelectedElement("href");
element = window.editorShell.GetSelectedElement("href");
if (element)
goDoCommand("cmd_link");
}

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

@ -312,7 +312,7 @@ function EditorStartLog()
fs = EditorGetScriptFileSpec();
editorShell.StartLogging(fs);
contentWindow.focus();
window.content.focus();
fs = null;
}
@ -320,7 +320,7 @@ function EditorStartLog()
function EditorStopLog()
{
editorShell.StopLogging();
contentWindow.focus();
window.content.focus();
}
function EditorRunLog()
@ -328,7 +328,7 @@ function EditorRunLog()
var fs;
fs = EditorGetScriptFileSpec();
EditorExecuteScript(fs);
contentWindow.focus();
window.content.focus();
}

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

@ -115,7 +115,7 @@ var DocumentStateListener =
EditorInitToolbars();
// udpate menu items now that we have an editor to play with
//dump("Updating 'create' commands\n");
dump("Updating 'create' commands\n");
window.content.focus();
window.updateCommands("create");
},
@ -415,9 +415,9 @@ function EditorViewSource()
function EditorSetDocumentCharacterSet(aCharset)
{
if(window.editorShell &&
(! window.editorShell.documentModified) &&
editorShell.editorDocument.locatoin != "about:blank")
if(editorShell &&
(! editorShell.documentModified) &&
editorShell.editorDocument.location != "about:blank")
{
dump(aCharset);
editorShell.SetDocumentCharacterSet(aCharset);
@ -934,6 +934,29 @@ function EditorInitEditMenu()
// with multiple paste format types
}
function EditorOpenUrl(url)
{
if (!url || url.length == 0)
return;
// if the existing window is untouched, just load there
if (!FindAndSelectEditorWindowWithURL(url))
{
if (PageIsEmptyAndUntouched())
{
window.editorShell.LoadUrl(url);
}
else
{
// open new window
window.openDialog("chrome://editor/content",
"_blank",
"chrome,dialog=no,all",
url);
}
}
}
function InitRecentFilesMenu()
{
//Build submenu of
@ -968,7 +991,8 @@ function EditorInitFormatMenu()
{
var objStr = "";
menuItem.removeAttribute("disabled");
switch (element.nodeName)
var name = element.nodeName.toLowerCase();
switch (name)
{
case 'img':
objStr = GetString("Image");
@ -1029,6 +1053,24 @@ function InitBackColorPopup()
SetBackColorString("BackColorCaption");
}
function InitListMenu()
{
SetMenuItemCheckedFromState("menu_ul", "cmd_ul");
SetMenuItemCheckedFromState("menu_ol", "cmd_ol");
SetMenuItemCheckedFromState("menu_dt", "cmd_dt");
SetMenuItemCheckedFromState("menu_dd", "cmd_dd");
}
function SetMenuItemCheckedFromState(menuItemID, commandID)
{
var menuItem = document.getElementById(menuItemID);
var commandNode = document.getElementById(commandID);
if (menuItem && commandNode)
{
menuItem.setAttribute("checked", commandNode.getAttribute("state"));
}
}
function EditorInitToolbars()
{
// Nothing to do now, but we might want some state updating here
@ -1480,12 +1522,12 @@ function EditorInitTableMenu()
document.getElementById("menu_tableJoinCells").setAttribute("value",menuText);
// Set platform-specific hints for how to select cells
if (gIsWin) osKey = "XulKeyWin";
if (gIsMac) osKey = "XulKeyMac";
if (gIsUNIX) osKey = "XulKeyUnix";
// Mac uses "Cmd", all others use "Ctrl"
var tableKey = gIsMac ? "XulKeyMac" : "TableSelectKey";
tableKey = GetString(tableKey);
var DragStr = tableKey+GetString("Drag");
var ClickStr = tableKey+GetString("Click");
var DragStr = GetString(osKey)+GetString("Drag");
var ClickStr = GetString(osKey)+GetString("Click");
var DelStr = GetString(gIsMac ? "Clear" : "Del");
document.getElementById("menu_DeleteCell").setAttribute("acceltext",ClickStr);

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

@ -170,30 +170,29 @@ END of Deprecated -->
</toolbar>
<toolbar id="FormatToolbar" persist="collapsed">
<!-- We need this else menulists get stretched -->
<box autostretch="never" flex="1">
<box autostretch="never">
<!-- from editorOverlay -->
<menulist id="ParagraphSelect"/>
<menulist id="FontFaceSelect"/>
<stack id="ColorButtons"/>
<button id="DecreaseFontSizeButton"/>
<button id="IncreaseFontSizeButton"/>
<button id="boldButton"/>
<button id="italicButton"/>
<button id="underlineButton"/>
<spring class="separator_small"/>
<button id="ulButton"/>
<button id="olButton"/>
<button id="outdentButton"/>
<button id="indentButton"/>
<spring class="separator_small"/>
<!-- TODO: Change to a menulist? -->
<menu>
<button id="AlignPopupButton"/>
<menupopup id="AlignmentPopup"/>
</menu>
</box>
<button id="DecreaseFontSizeButton"/>
<button id="IncreaseFontSizeButton"/>
<button id="boldButton"/>
<button id="italicButton"/>
<button id="underlineButton"/>
<spring class="separator_small"/>
<button id="ulButton"/>
<button id="olButton"/>
<button id="outdentButton"/>
<button id="indentButton"/>
<spring class="separator_small"/>
<!-- TODO: Change to a menulist? -->
<menu>
<button id="AlignPopupButton"/>
<menupopup id="AlignmentPopup"/>
</menu>
<spring flex="1"/>
</toolbar>
</toolbox>

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

@ -179,6 +179,8 @@
<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')"/>
@ -266,9 +268,7 @@
<menuitem accesskey="&fileopen.accesskey;" key="openeditorkb" observes="cmd_open" value="&openFileCmd.label;"/>
<menu accesskey="&filerecentmenu.accesskey;" value="&fileRecentMenu.label;" oncreate="InitRecentFilesMenu()">
<!-- Items appended at runtime -->
<menupopup id="menupopup_RecentFiles">
<menuitem value="(recent file menu)"/>
</menupopup>
<menupopup id="menupopup_RecentFiles"/>
</menu>
<menuitem accesskey="&filerevert.accesskey;" observes="cmd_revert"/>
<menuseparator />
@ -583,14 +583,25 @@
<menuitem value="&paragraphBlockquoteCmd.label;" accesskey="&paragraphblockquote.accesskey;" data="BLOCKQUOTE"/>
<menuitem value="&paragraphAddressCmd.label;" accesskey="&paragraphaddress.accesskey;" data="ADDRESS"/>
<menuitem value="&paragraphPreformatCmd.label;" accesskey="&paragraphpreformat.accesskey;" data="PRE"/>
<menuitem value="&paragraphDfnTermCmd.label;" accesskey="&paragraphterm.accesskey;" data="DT"/>
<menuitem value="&paragraphDfnDescCmd.label;" accesskey="&paragraphdesc.accesskey;" data="DD"/>
</menupopup>
</menu>
<!-- List Style (opens dialog) -->
<menuitem id="listProps" value="&listProps.label;" accesskey="&formatlistmenu.accesskey;"
position="12" observes="cmd_listProperties"/>
<!-- List Style submenu -->
<menu id="listMenu" value="&formatlistMenu.label;"
accesskey="&formatlistmenu.accesskey;"
position="12" oncreate="InitListMenu()">
<menupopup>
<menuitem id="menu_ul" value="&listBulletCmd.label;" accesskey="&listbullet.accesskey;" observes="cmd_ul"/>
<menuitem id="menu_ol" value="&listNumberedCmd.label;" accesskey="&listnumbered.accesskey;" observes="cmd_ol"/>
<menuseparator/>
<menuitem id="menu_dt" value="&listTermCmd.label;" accesskey="&listterm.accesskey;" observes="cmd_dt"/>
<menuitem id="menu_dd" value="&listDefinitionCmd.label;" accesskey="&listdefinition.accesskey;" observes="cmd_dd"/>
<menuseparator/>
<menuitem id="listProps" value="&listProps.label;" accesskey="&listprops.accesskey;" observes="cmd_listProperties"/>
</menupopup>
</menu>
<menu id="alignMenu" value="&alignMenu.label;" accesskey="&formatalignmenu.accesskey;"
position="13">
<!-- Align submenu -->
@ -787,18 +798,16 @@
<observes element="cmd_paragraphState" attribute="state" onbroadcast="onParagraphFormatChange(this.parentNode, 'cmd_paragraphState')"/>
<menupopup id="ParagraphPopup" oncommand="EditorSetParagraphFormat('cmd_paragraphState', event.target.data)">
<menuitem value="&normalCmd.label;" data=""/>
<menuitem value="&paragraphParagraphCmd.label;" data="P"/>
<menuitem value="&heading1Cmd.label;" data="H1"/>
<menuitem value="&heading2Cmd.label;" data="H2"/>
<menuitem value="&heading3Cmd.label;" data="H3"/>
<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"/>
<menuitem value="&paragraphDfnTermCmd.label;" data="DT"/>
<menuitem value="&paragraphDfnDescCmd.label;" data="DD"/>
<menuitem value="&paragraphParagraphCmd.label;" data="p"/>
<menuitem value="&heading1Cmd.label;" data="h1"/>
<menuitem value="&heading2Cmd.label;" data="h2"/>
<menuitem value="&heading3Cmd.label;" data="h3"/>
<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"/>
</menupopup>
</menulist>

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

@ -109,7 +109,8 @@ ObjectProperties=%obj% Properties...
JoinSelectedCells=Join Selected Cells
JoinCellToRight=Join with Cell to the Right
#The next 5 are keys on keyboard -- I don't know if they are normally translated!
XulKeyWin=Ctrl+
TableSelectKey=Ctrl+
XulKeyDefault=Ctrl+
XulKeyMac=Cmd+
XulKeyUnix=Alt+
Del=Del

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

@ -38,7 +38,7 @@
<!ENTITY fileRecentMenu.label "Recent Pages">
<!ENTITY filerecentmenu.accesskey "r">
<!ENTITY fileRevert.label "Revert to Last Saved">
<!ENTITY filerevert.accesskey "v">
<!ENTITY filerevert.accesskey "d">
<!ENTITY saveCmd.label "Save">
<!ENTITY filesave.accesskey "s">
<!ENTITY filesave.keybinding "s">
@ -406,12 +406,22 @@ Menu item text for "[Page|Table|Cell] Background color" is filled from
<!ENTITY paragraphaddress.accesskey "a">
<!ENTITY paragraphPreformatCmd.label "Preformat">
<!ENTITY paragraphpreformat.accesskey "f">
<!ENTITY paragraphListCmd.label "List item">
<!ENTITY paragraphlist.accesskey "l">
<!ENTITY paragraphDfnTermCmd.label "Term">
<!ENTITY paragraphterm.accesskey "t">
<!ENTITY paragraphDfnDescCmd.label "Description">
<!ENTITY paragraphdesc.accesskey "d">
<!-- List menu items -->
<!ENTITY formatlistMenu.label "List">
<!ENTITY formatlistmenu.accesskey "l">
<!ENTITY listBulletCmd.label "Bulleted">
<!ENTITY listbullet.accesskey "t">
<!ENTITY listNumberedCmd.label "Numbered">
<!ENTITY listnumbered.accesskey "n">
<!ENTITY listTermCmd.label "Term">
<!ENTITY listterm.accesskey "t">
<!ENTITY listDefinitionCmd.label "Definition">
<!ENTITY listdefinition.accesskey "d">
<!ENTITY listProps.label "List Properties...">
<!ENTITY listprops.accesskey "l">
<!-- Shared by Heading and Paragraph menu, and in toolbar menulist -->
<!ENTITY ParagraphSelect.tooltip "tooltip for Paragraph menu on formatting toolbar">
<!ENTITY normalCmd.label "Normal">
@ -430,12 +440,6 @@ Menu item text for "[Page|Table|Cell] Background color" is filled from
<!ENTITY BlockquoteAbbr.label "BQ">
<!ENTITY AddressAbbr.label "Addr.">
<!ENTITY PreformatAbbr.label "Pre.">
<!ENTITY DfnTermAbbr.label "DT">
<!ENTITY DfnDescAbbr.label "DD">
<!-- List menu items -->
<!ENTITY listProps.label "List...">
<!ENTITY formatlistmenu.accesskey "l">
<!-- Style Sheet submenu NOT IMPLEMENTED -->
<!ENTITY stylesheetMenu.label "Apply Style Sheet">