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
Родитель ba6630118c
Коммит a4bdd3eb1f
7 изменённых файлов: 138 добавлений и 99 удалений

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

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

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

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

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

@ -115,7 +115,7 @@ var DocumentStateListener =
EditorInitToolbars(); EditorInitToolbars();
// udpate menu items now that we have an editor to play with // 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.content.focus();
window.updateCommands("create"); window.updateCommands("create");
}, },
@ -415,9 +415,9 @@ function EditorViewSource()
function EditorSetDocumentCharacterSet(aCharset) function EditorSetDocumentCharacterSet(aCharset)
{ {
if(window.editorShell && if(editorShell &&
(! window.editorShell.documentModified) && (! editorShell.documentModified) &&
editorShell.editorDocument.locatoin != "about:blank") editorShell.editorDocument.location != "about:blank")
{ {
dump(aCharset); dump(aCharset);
editorShell.SetDocumentCharacterSet(aCharset); editorShell.SetDocumentCharacterSet(aCharset);
@ -934,6 +934,29 @@ function EditorInitEditMenu()
// with multiple paste format types // 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() function InitRecentFilesMenu()
{ {
//Build submenu of //Build submenu of
@ -968,7 +991,8 @@ function EditorInitFormatMenu()
{ {
var objStr = ""; var objStr = "";
menuItem.removeAttribute("disabled"); menuItem.removeAttribute("disabled");
switch (element.nodeName) var name = element.nodeName.toLowerCase();
switch (name)
{ {
case 'img': case 'img':
objStr = GetString("Image"); objStr = GetString("Image");
@ -1029,6 +1053,24 @@ function InitBackColorPopup()
SetBackColorString("BackColorCaption"); 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() function EditorInitToolbars()
{ {
// Nothing to do now, but we might want some state updating here // 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); document.getElementById("menu_tableJoinCells").setAttribute("value",menuText);
// Set platform-specific hints for how to select cells // Set platform-specific hints for how to select cells
if (gIsWin) osKey = "XulKeyWin"; // Mac uses "Cmd", all others use "Ctrl"
if (gIsMac) osKey = "XulKeyMac"; var tableKey = gIsMac ? "XulKeyMac" : "TableSelectKey";
if (gIsUNIX) osKey = "XulKeyUnix"; 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"); var DelStr = GetString(gIsMac ? "Clear" : "Del");
document.getElementById("menu_DeleteCell").setAttribute("acceltext",ClickStr); document.getElementById("menu_DeleteCell").setAttribute("acceltext",ClickStr);

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

@ -170,12 +170,12 @@ END of Deprecated -->
</toolbar> </toolbar>
<toolbar id="FormatToolbar" persist="collapsed"> <toolbar id="FormatToolbar" persist="collapsed">
<!-- We need this else menulists get stretched --> <!-- We need this else menulists get stretched -->
<box autostretch="never" flex="1"> <box autostretch="never">
<!-- from editorOverlay --> <!-- from editorOverlay -->
<menulist id="ParagraphSelect"/> <menulist id="ParagraphSelect"/>
<menulist id="FontFaceSelect"/> <menulist id="FontFaceSelect"/>
<stack id="ColorButtons"/> <stack id="ColorButtons"/>
</box>
<button id="DecreaseFontSizeButton"/> <button id="DecreaseFontSizeButton"/>
<button id="IncreaseFontSizeButton"/> <button id="IncreaseFontSizeButton"/>
@ -193,7 +193,6 @@ END of Deprecated -->
<button id="AlignPopupButton"/> <button id="AlignPopupButton"/>
<menupopup id="AlignmentPopup"/> <menupopup id="AlignmentPopup"/>
</menu> </menu>
</box>
<spring flex="1"/> <spring flex="1"/>
</toolbar> </toolbar>
</toolbox> </toolbox>

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

@ -179,6 +179,8 @@
<command id="cmd_ul" state="false" oncommand="goDoCommand('cmd_ul')"/> <command id="cmd_ul" state="false" oncommand="goDoCommand('cmd_ul')"/>
<command id="cmd_ol" state="false" oncommand="goDoCommand('cmd_ol')"/> <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_indent" oncommand="goDoCommand('cmd_indent')"/>
<command id="cmd_outdent" oncommand="goDoCommand('cmd_outdent')"/> <command id="cmd_outdent" oncommand="goDoCommand('cmd_outdent')"/>
@ -266,9 +268,7 @@
<menuitem accesskey="&fileopen.accesskey;" key="openeditorkb" observes="cmd_open" value="&openFileCmd.label;"/> <menuitem accesskey="&fileopen.accesskey;" key="openeditorkb" observes="cmd_open" value="&openFileCmd.label;"/>
<menu accesskey="&filerecentmenu.accesskey;" value="&fileRecentMenu.label;" oncreate="InitRecentFilesMenu()"> <menu accesskey="&filerecentmenu.accesskey;" value="&fileRecentMenu.label;" oncreate="InitRecentFilesMenu()">
<!-- Items appended at runtime --> <!-- Items appended at runtime -->
<menupopup id="menupopup_RecentFiles"> <menupopup id="menupopup_RecentFiles"/>
<menuitem value="(recent file menu)"/>
</menupopup>
</menu> </menu>
<menuitem accesskey="&filerevert.accesskey;" observes="cmd_revert"/> <menuitem accesskey="&filerevert.accesskey;" observes="cmd_revert"/>
<menuseparator /> <menuseparator />
@ -583,14 +583,25 @@
<menuitem value="&paragraphBlockquoteCmd.label;" accesskey="&paragraphblockquote.accesskey;" data="BLOCKQUOTE"/> <menuitem value="&paragraphBlockquoteCmd.label;" accesskey="&paragraphblockquote.accesskey;" data="BLOCKQUOTE"/>
<menuitem value="&paragraphAddressCmd.label;" accesskey="&paragraphaddress.accesskey;" data="ADDRESS"/> <menuitem value="&paragraphAddressCmd.label;" accesskey="&paragraphaddress.accesskey;" data="ADDRESS"/>
<menuitem value="&paragraphPreformatCmd.label;" accesskey="&paragraphpreformat.accesskey;" data="PRE"/> <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> </menupopup>
</menu> </menu>
<!-- List Style (opens dialog) --> <!-- List Style submenu -->
<menuitem id="listProps" value="&listProps.label;" accesskey="&formatlistmenu.accesskey;" <menu id="listMenu" value="&formatlistMenu.label;"
position="12" observes="cmd_listProperties"/> 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;" <menu id="alignMenu" value="&alignMenu.label;" accesskey="&formatalignmenu.accesskey;"
position="13"> position="13">
<!-- Align submenu --> <!-- Align submenu -->
@ -787,18 +798,16 @@
<observes element="cmd_paragraphState" attribute="state" onbroadcast="onParagraphFormatChange(this.parentNode, 'cmd_paragraphState')"/> <observes element="cmd_paragraphState" attribute="state" onbroadcast="onParagraphFormatChange(this.parentNode, 'cmd_paragraphState')"/>
<menupopup id="ParagraphPopup" oncommand="EditorSetParagraphFormat('cmd_paragraphState', event.target.data)"> <menupopup id="ParagraphPopup" oncommand="EditorSetParagraphFormat('cmd_paragraphState', event.target.data)">
<menuitem value="&normalCmd.label;" data=""/> <menuitem value="&normalCmd.label;" data=""/>
<menuitem value="&paragraphParagraphCmd.label;" data="P"/> <menuitem value="&paragraphParagraphCmd.label;" data="p"/>
<menuitem value="&heading1Cmd.label;" data="H1"/> <menuitem value="&heading1Cmd.label;" data="h1"/>
<menuitem value="&heading2Cmd.label;" data="H2"/> <menuitem value="&heading2Cmd.label;" data="h2"/>
<menuitem value="&heading3Cmd.label;" data="H3"/> <menuitem value="&heading3Cmd.label;" data="h3"/>
<menuitem value="&heading4Cmd.label;" data="H4"/> <menuitem value="&heading4Cmd.label;" data="h4"/>
<menuitem value="&heading5Cmd.label;" data="H5"/> <menuitem value="&heading5Cmd.label;" data="h5"/>
<menuitem value="&heading6Cmd.label;" data="H6"/> <menuitem value="&heading6Cmd.label;" data="h6"/>
<menuitem value="&paragraphBlockquoteCmd.label;" data="BLOCKQUOTE"/> <menuitem value="&paragraphBlockquoteCmd.label;" data="blockquote"/>
<menuitem value="&paragraphAddressCmd.label;" data="ADDRESS"/> <menuitem value="&paragraphAddressCmd.label;" data="address"/>
<menuitem value="&paragraphPreformatCmd.label;" data="PRE"/> <menuitem value="&paragraphPreformatCmd.label;" data="pre"/>
<menuitem value="&paragraphDfnTermCmd.label;" data="DT"/>
<menuitem value="&paragraphDfnDescCmd.label;" data="DD"/>
</menupopup> </menupopup>
</menulist> </menulist>

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

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

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

@ -38,7 +38,7 @@
<!ENTITY fileRecentMenu.label "Recent Pages"> <!ENTITY fileRecentMenu.label "Recent Pages">
<!ENTITY filerecentmenu.accesskey "r"> <!ENTITY filerecentmenu.accesskey "r">
<!ENTITY fileRevert.label "Revert to Last Saved"> <!ENTITY fileRevert.label "Revert to Last Saved">
<!ENTITY filerevert.accesskey "v"> <!ENTITY filerevert.accesskey "d">
<!ENTITY saveCmd.label "Save"> <!ENTITY saveCmd.label "Save">
<!ENTITY filesave.accesskey "s"> <!ENTITY filesave.accesskey "s">
<!ENTITY filesave.keybinding "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 paragraphaddress.accesskey "a">
<!ENTITY paragraphPreformatCmd.label "Preformat"> <!ENTITY paragraphPreformatCmd.label "Preformat">
<!ENTITY paragraphpreformat.accesskey "f"> <!ENTITY paragraphpreformat.accesskey "f">
<!ENTITY paragraphListCmd.label "List item">
<!ENTITY paragraphlist.accesskey "l">
<!ENTITY paragraphDfnTermCmd.label "Term"> <!-- List menu items -->
<!ENTITY paragraphterm.accesskey "t"> <!ENTITY formatlistMenu.label "List">
<!ENTITY paragraphDfnDescCmd.label "Description"> <!ENTITY formatlistmenu.accesskey "l">
<!ENTITY paragraphdesc.accesskey "d"> <!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 --> <!-- Shared by Heading and Paragraph menu, and in toolbar menulist -->
<!ENTITY ParagraphSelect.tooltip "tooltip for Paragraph menu on formatting toolbar"> <!ENTITY ParagraphSelect.tooltip "tooltip for Paragraph menu on formatting toolbar">
<!ENTITY normalCmd.label "Normal"> <!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 BlockquoteAbbr.label "BQ">
<!ENTITY AddressAbbr.label "Addr."> <!ENTITY AddressAbbr.label "Addr.">
<!ENTITY PreformatAbbr.label "Pre."> <!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 --> <!-- Style Sheet submenu NOT IMPLEMENTED -->
<!ENTITY stylesheetMenu.label "Apply Style Sheet"> <!ENTITY stylesheetMenu.label "Apply Style Sheet">