Fixed editor UI to be inline with hyatt's XUL popup window fixes

This commit is contained in:
cmanske%netscape.com 1999-07-01 23:44:59 +00:00
Родитель d5ee472731
Коммит 61ac94bd97
4 изменённых файлов: 52 добавлений и 29 удалений

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

@ -323,11 +323,11 @@
<spring flex="100%"/> <spring flex="100%"/>
</toolbar> </toolbar>
<toolbar id="FormatToolbar"> <toolbar id="FormatToolbar">
<titledbutton id="ParagraphPopup" value="Paragraph" class="popup" align="left" popup="ParagraphMenu"/> <titledbutton id="ParagraphPopup" value="Paragraph" class="popup" align="left" popup="ParagraphMenu" popupanchor="bottomleft"/>
<titledbutton id="FontFacePopup" value="Font" class="popup" align="left" popup="FontFaceWindow"/> <titledbutton id="FontFacePopup" value="Font" class="popup" align="left" popup="FontFaceMenu" popupanchor="bottomleft"/>
<titledbutton id="FontSizePopup" value="Size" class="popup" align="left" popup="FontSizeMenu"/> <titledbutton id="FontSizePopup" value="Size" class="popup" align="left" popup="FontSizeMenu" popupanchor="bottomleft"/>
<titledbutton id="TextColorPopup" src="chrome://editor/skin/images/ED_TextColor.gif" class="popup" popup="TextColorMenu"/> <titledbutton id="TextColorPopup" src="chrome://editor/skin/images/ED_TextColor.gif" class="popup" popup="TextColorMenu" popupanchor="bottomleft"/>
<titledbutton id="BackColorPopup" src="chrome://editor/skin/images/ED_BackColor.gif" class="popup" popup="BackColorMenu"/> <titledbutton id="BackColorPopup" src="chrome://editor/skin/images/ED_BackColor.gif" class="popup" popup="BackColorMenu" popupanchor="bottomleft"/>
<titledbutton id="BoldButton" value="&formatToolbar.boldChar;" onclick="EditorApplyStyle('b')"> <titledbutton id="BoldButton" value="&formatToolbar.boldChar;" onclick="EditorApplyStyle('b')">
<observes element="Editor:Style:IsBold" attribute="bold" onchange="onBoldChange()"/> <observes element="Editor:Style:IsBold" attribute="bold" onchange="onBoldChange()"/>
</titledbutton> </titledbutton>
@ -344,12 +344,12 @@
<titledbutton src="chrome://editor/skin/images/ED_Numbers.gif" align="bottom" onclick="EditorInsertList('ol')"/> <titledbutton src="chrome://editor/skin/images/ED_Numbers.gif" align="bottom" onclick="EditorInsertList('ol')"/>
<titledbutton src="chrome://editor/skin/images/ED_Outdent.gif" align="bottom" onclick="EditorIndent('outdent')"/> <titledbutton src="chrome://editor/skin/images/ED_Outdent.gif" align="bottom" onclick="EditorIndent('outdent')"/>
<titledbutton src="chrome://editor/skin/images/ED_Indent.gif" align="bottom" onclick="EditorIndent('indent')"/> <titledbutton src="chrome://editor/skin/images/ED_Indent.gif" align="bottom" onclick="EditorIndent('indent')"/>
<titledbutton src="chrome://editor/skin/images/ED_Align.gif" align="bottom" class="popup" popup="AlignmentWindow"/> <titledbutton src="chrome://editor/skin/images/ED_Align.gif" align="bottom" class="popup" popup="AlignmentWindow" popupanchor="bottomleft"/>
<spring flex="100%"/> <spring flex="100%"/>
</toolbar> </toolbar>
</toolbox> </toolbox>
<html:iframe type="content" id="content-frame" src="about:blank" flex="100%"/> <html:iframe type="content-primary" id="content-frame" src="about:blank" flex="100%"/>
<!-- Ripped off from navigator.xul; this should be a XUL fragment! --> <!-- Ripped off from navigator.xul; this should be a XUL fragment! -->
<box align="horizontal" id="status-bar"> <box align="horizontal" id="status-bar">
@ -424,7 +424,7 @@
</popup> </popup>
<popup id="TextColorMenu"> <popup id="TextColorMenu">
<menu> <menu class="popup">
<menuitem name="Black" onclick="EditorSetFontColor('black')"/> <menuitem name="Black" onclick="EditorSetFontColor('black')"/>
<menuitem name="Gray" onclick="EditorSetFontColor('gray')"/> <menuitem name="Gray" onclick="EditorSetFontColor('gray')"/>
<menuitem name="Silver" onclick="EditorSetFontColor('silver')"/> <menuitem name="Silver" onclick="EditorSetFontColor('silver')"/>
@ -449,7 +449,7 @@
// Use these afer popup windows are working correctly: // Use these afer popup windows are working correctly:
<popup id="FontFaceWindow"> <popup id="FontFaceWindow">
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" width="40" height="40"> <window class="popup" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" width="40" height="40">
<titledbutton value="Default Variable Width" onclick="opener.EditorSetFontFace(''); window.close();"/><html:br/> <titledbutton value="Default Variable Width" onclick="opener.EditorSetFontFace(''); window.close();"/><html:br/>
<titledbutton value="Default Fixed Width" onclick="opener.EditorSetFontFace('tt'); window.close();"/><html:br/> <titledbutton value="Default Fixed Width" onclick="opener.EditorSetFontFace('tt'); window.close();"/><html:br/>
<titledbutton value="Arial, Helvetica" onclick="opener.EditorSetFontFace('Arial, Helvetica, sans-serif'); window.close();"/><html:br/> <titledbutton value="Arial, Helvetica" onclick="opener.EditorSetFontFace('Arial, Helvetica, sans-serif'); window.close();"/><html:br/>
@ -459,11 +459,13 @@
</popup> </popup>
<popup id="AlignmentWindow" oncreate="OnCreateAlignmentPopup()"> <popup id="AlignmentWindow" oncreate="OnCreateAlignmentPopup()">
<window xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" width="2" height="2"> <window class="popup" xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul" width="75" height="100">
<titledbutton class="AlignButton" id="LeftAlign" value="Left" align="right" onclick="opener.EditorAlign('left'); window.close();"/><html:br/> <!-- <box align="vertical" style="width: 100%; height: 100%"> -->
<titledbutton class="AlignButton" id="LeftAlign" value="Left" align="right" onclick="opener.EditorAlign('left'); window.close();"/><html:br/>
<titledbutton class="AlignButton" id="CenterAlign" value="Center" align="right" onclick="opener.EditorAlign('center'); window.close();"/><html:br/> <titledbutton class="AlignButton" id="CenterAlign" value="Center" align="right" onclick="opener.EditorAlign('center'); window.close();"/><html:br/>
<titledbutton class="AlignButton" id="RightAlign" value="Right" align="right" onclick="opener.EditorAlign('right'); window.close();"/><html:br/> <titledbutton class="AlignButton" id="RightAlign" value="Right" align="right" onclick="opener.EditorAlign('right'); window.close();"/><html:br/>
<titledbutton class="AlignButton" id="JustifyAlign" value="Justify" align="right" onclick="opener.EditorAlign('justify'); window.close();"/><html:br/> <titledbutton class="AlignButton" id="JustifyAlign" value="Justify" align="right" onclick="opener.EditorAlign('justify'); window.close();"/><html:br/>
<!-- </box> -->
</window> </window>
</popup> </popup>

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

@ -23,7 +23,7 @@ var toolbar;
function EditorStartup(editorType) function EditorStartup(editorType)
{ {
dump("Doing Startup...\n"); dump("Doing Startup...\n");
contentWindow = window.frames[0]; contentWindow = window.content;
dump("Trying to make an editor appcore through the component manager...\n"); dump("Trying to make an editor appcore through the component manager...\n");
@ -57,7 +57,9 @@ function EditorStartup(editorType)
// (A bug currently prevents this from working, // (A bug currently prevents this from working,
// the actual edit window is a child of the webshell window // the actual edit window is a child of the webshell window
// designated as the contentWindow) // designated as the contentWindow)
dump("Setting focus to content window\n");
contentWindow.focus(); contentWindow.focus();
window.frames[0].focus();
} }
function SetupToolbarElements() function SetupToolbarElements()
@ -133,12 +135,14 @@ function EditorSave()
{ {
dump("In EditorSave...\n"); dump("In EditorSave...\n");
window.editorShell.Save(); window.editorShell.Save();
contentWindow.focus();
} }
function EditorSaveAs() function EditorSaveAs()
{ {
dump("In EditorSave...\n"); dump("In EditorSave...\n");
window.editorShell.SaveAs(); window.editorShell.SaveAs();
contentWindow.focus();
} }
@ -146,6 +150,7 @@ function EditorPrint()
{ {
dump("In EditorPrint..\n"); dump("In EditorPrint..\n");
window.editorShell.Print(); window.editorShell.Print();
contentWindow.focus();
} }
function EditorClose() function EditorClose()
@ -160,47 +165,56 @@ function EditorUndo()
{ {
dump("Undoing\n"); dump("Undoing\n");
window.editorShell.Undo(); window.editorShell.Undo();
contentWindow.focus();
} }
function EditorRedo() function EditorRedo()
{ {
dump("Redoing\n"); dump("Redoing\n");
window.editorShell.Redo(); window.editorShell.Redo();
contentWindow.focus();
} }
function EditorCut() function EditorCut()
{ {
window.editorShell.Cut(); window.editorShell.Cut();
contentWindow.focus();
} }
function EditorCopy() function EditorCopy()
{ {
window.editorShell.Copy(); window.editorShell.Copy();
contentWindow.focus();
} }
function EditorPaste() function EditorPaste()
{ {
window.editorShell.Paste(); window.editorShell.Paste();
contentWindow.focus();
} }
function EditorPasteAsQuotation() function EditorPasteAsQuotation()
{ {
window.editorShell.PasteAsQuotation(); window.editorShell.PasteAsQuotation();
contentWindow.focus();
} }
function EditorPasteAsQuotationCited(citeString) function EditorPasteAsQuotationCited(citeString)
{ {
window.editorShell.PasteAsCitedQuotation(CiteString); window.editorShell.PasteAsCitedQuotation(CiteString);
contentWindow.focus();
} }
function EditorSelectAll() function EditorSelectAll()
{ {
window.editorShell.SelectAll(); window.editorShell.SelectAll();
contentWindow.focus();
} }
function EditorFind() function EditorFind()
{ {
window.editorShell.Find(); window.editorShell.Find();
contentWindow.focus();
} }
function EditorFindNext() function EditorFindNext()
@ -211,7 +225,6 @@ function EditorFindNext()
function EditorShowClipboard() function EditorShowClipboard()
{ {
dump("In EditorShowClipboard...\n"); dump("In EditorShowClipboard...\n");
window.editorShell.ShowClipboard();
} }
// --------------------------- View menu --------------------------- // --------------------------- View menu ---------------------------
@ -254,11 +267,14 @@ function EditorSetFontSize(size)
function EditorSetFontFace(fontFace) function EditorSetFontFace(fontFace)
{ {
if( fontFace == "tt") { if( fontFace == "" || fontFace == "normal") {
window.editorShell.RemoveTextProperty("font", "face");
} else if( fontFace == "tt") {
// The old "teletype" attribute // The old "teletype" attribute
window.editorShell.SetTextProperty("tt", "", ""); window.editorShell.SetTextProperty("tt", "", "");
// Clear existing font face // Clear existing font face
fontFace = ""; window.editorShell.RemoveTextProperty("font", "face");
} else {
window.editorShell.SetTextProperty("font", "face", fontFace); window.editorShell.SetTextProperty("font", "face", fontFace);
} }
contentWindow.focus(); contentWindow.focus();
@ -292,6 +308,7 @@ function EditorRemoveStyle(styleName)
function EditorRemoveLinks() function EditorRemoveLinks()
{ {
dump("NOT IMPLEMENTED YET\n"); dump("NOT IMPLEMENTED YET\n");
contentWindow.focus();
} }
// --------------------------- Output --------------------------- // --------------------------- Output ---------------------------
@ -388,25 +405,27 @@ function EditorInsertList(listType)
{ {
dump("Inserting list\n"); dump("Inserting list\n");
window.editorShell.InsertList(listType); window.editorShell.InsertList(listType);
contentWindow.focus();
} }
function EditorInsertImage() function EditorInsertImage()
{ {
if (window.editorShell) { dump("Image Properties Dialog starting.\n");
dump("Image Properties Dialog starting.\n"); window.openDialog("chrome://editordlgs/content/EdImageProps.xul", "dlg", "chrome", "");
window.openDialog("chrome://editordlgs/content/EdImageProps.xul", "dlg", "chrome", ""); contentWindow.focus();
}
} }
function EditorAlign(align) function EditorAlign(align)
{ {
dump("aligning\n"); dump("aligning\n");
window.editorShell.Align(align); window.editorShell.Align(align);
contentWindow.focus();
} }
function EditorPrintPreview() function EditorPrintPreview()
{ {
window.openDialog("resource:/res/samples/printsetup.html", "PrintPreview", "chrome", ""); window.openDialog("resource:/res/samples/printsetup.html", "PrintPreview", "chrome", "");
contentWindow.focus();
} }
function CheckSpelling() function CheckSpelling()
@ -428,7 +447,9 @@ function CheckSpelling()
window.openDialog("chrome://editordlgs/content/EdSpellCheck.xul", "SpellDlg", "chrome", "", firstMisspelledWord); window.openDialog("chrome://editordlgs/content/EdSpellCheck.xul", "SpellDlg", "chrome", "", firstMisspelledWord);
} }
} }
contentWindow.focus();
} }
function OnCreateAlignmentPopup() function OnCreateAlignmentPopup()
{ {
dump("Creating Alignment popup window\n"); dump("Creating Alignment popup window\n");

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

@ -155,11 +155,11 @@
<box id="outer-box" align="vertical"> <box id="outer-box" align="vertical">
<toolbox> <toolbox>
<toolbar> <toolbar>
<titledbutton id="ParagraphPopup" value="Paragraph" class="popup" align="left" popup="ParagraphMenu"/> <titledbutton id="ParagraphPopup" value="Paragraph" class="popup" align="left" popup="ParagraphMenu" popupanchor="bottomleft"/>
<titledbutton id="FontFacePopup" value="Font" class="popup" align="left" popup="FontFaceMenu"/> <titledbutton id="FontFacePopup" value="Font" class="popup" align="left" popup="FontFaceMenu" popupanchor="bottomleft"/>
<titledbutton id="FontSizePopup" value="Size" class="popup" align="left" popup="FontSizeMenu"/> <titledbutton id="FontSizePopup" value="Size" class="popup" align="left" popup="FontSizeMenu" popupanchor="bottomleft"/>
<titledbutton id="TextColorPopup" src="chrome://editor/skin/images/ED_TextColor.gif" class="popup" popup="TextColorMenu"/> <titledbutton id="TextColorPopup" src="chrome://editor/skin/images/ED_TextColor.gif" class="popup" popup="TextColorMenu" popupanchor="bottomleft"/>
<titledbutton id="BackColorPopup" src="chrome://editor/skin/images/ED_BackColor.gif" class="popup" popup="BackColorMenu"/> <titledbutton id="BackColorPopup" src="chrome://editor/skin/images/ED_BackColor.gif" class="popup" popup="BackColorMenu" popupanchor="bottomleft"/>
<titledbutton id="BoldButton" src="chrome://editor/skin/images/ED_Bold.gif" align="bottom" onclick="EditorApplyStyle('b')"> <titledbutton id="BoldButton" src="chrome://editor/skin/images/ED_Bold.gif" align="bottom" onclick="EditorApplyStyle('b')">
<observes element="Editor:Style:IsBold" attribute="bold" onchange="onBoldChange()"/> <observes element="Editor:Style:IsBold" attribute="bold" onchange="onBoldChange()"/>
</titledbutton> </titledbutton>

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

@ -155,11 +155,11 @@
<box id="outer-box" align="vertical"> <box id="outer-box" align="vertical">
<toolbox> <toolbox>
<toolbar> <toolbar>
<titledbutton id="ParagraphPopup" value="Paragraph" class="popup" align="left" popup="ParagraphMenu"/> <titledbutton id="ParagraphPopup" value="Paragraph" class="popup" align="left" popup="ParagraphMenu" popupanchor="bottomleft"/>
<titledbutton id="FontFacePopup" value="Font" class="popup" align="left" popup="FontFaceMenu"/> <titledbutton id="FontFacePopup" value="Font" class="popup" align="left" popup="FontFaceMenu" popupanchor="bottomleft"/>
<titledbutton id="FontSizePopup" value="Size" class="popup" align="left" popup="FontSizeMenu"/> <titledbutton id="FontSizePopup" value="Size" class="popup" align="left" popup="FontSizeMenu" popupanchor="bottomleft"/>
<titledbutton id="TextColorPopup" src="chrome://editor/skin/images/ED_TextColor.gif" class="popup" popup="TextColorMenu"/> <titledbutton id="TextColorPopup" src="chrome://editor/skin/images/ED_TextColor.gif" class="popup" popup="TextColorMenu" popupanchor="bottomleft"/>
<titledbutton id="BackColorPopup" src="chrome://editor/skin/images/ED_BackColor.gif" class="popup" popup="BackColorMenu"/> <titledbutton id="BackColorPopup" src="chrome://editor/skin/images/ED_BackColor.gif" class="popup" popup="BackColorMenu" popupanchor="bottomleft"/>
<titledbutton id="BoldButton" src="chrome://editor/skin/images/ED_Bold.gif" align="bottom" onclick="EditorApplyStyle('b')"> <titledbutton id="BoldButton" src="chrome://editor/skin/images/ED_Bold.gif" align="bottom" onclick="EditorApplyStyle('b')">
<observes element="Editor:Style:IsBold" attribute="bold" onchange="onBoldChange()"/> <observes element="Editor:Style:IsBold" attribute="bold" onchange="onBoldChange()"/>
</titledbutton> </titledbutton>