Changed to use command nodes in XUL, with lots of XUL tidy-up (detabbing etc).

This commit is contained in:
sfraser%netscape.com 1999-08-26 03:27:56 +00:00
Родитель 75cdab50bc
Коммит 26bdb82961
3 изменённых файлов: 666 добавлений и 603 удалений

Разница между файлами не показана из-за своего большого размера Загрузить разницу

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

@ -83,13 +83,104 @@ function EditorStartup(editorType)
dump("EditorAppCore windows have been set.\n");
SetupToolbarElements();
// Set focus to the edit window
// This still doesn't work!
// It works after using a toolbar button, however!
contentWindow.focus();
}
function TestMenuCreation()
{
var menubar = document.getElementById("MainMenuBar");
var fileMenu = menubar.firstChild;
var filePopup = fileMenu.firstChild;
dump("File menu "+ fileMenu + "\n");
var newChild = document.createElement("menuitem");
newChild.setAttribute("value", "testing");
newChild.setAttribute("id", "testItem");
dump(newChild);
filePopup.appendChild(newChild);
// now try and find it
var someItem = document.getElementById("testItem");
if (!someItem)
dump("Failed to find new menu item\n");
}
function GenerateFormatToolbar()
{
var toolbarButtons = [
// bold button
{
"id" : "boldButton",
"value" : "B",
"onclick" : "EditorToggleStyle('bold')"
},
// italics button
{
"id" : "italicButton",
"value" : "I"
},
// underline button
{
"id" : "underlineButton",
"value" : "U"
},
// ul button
{
"id" : "ulButton",
"src" : "chrome://editor/skin/images/ED_Bullets.gif",
"align" : "bottom"
},
// ol button
{
"id" : "olButton",
"src" : "chrome://editor/skin/images/ED_Numbers.gif",
"align" : "bottom"
},
];
var toolbar = document.getElementById("FormatToolbar");
for (i = 0; i < toolbarButtons.length; i ++)
{
var newChild = document.createElement("titledbutton");
var thisButton = toolbarButtons[i];
for (prop in thisButton)
{
var theValue = thisButton[prop];
newChild.setAttribute(prop, theValue);
}
toolbar.appendChild(newChild);
}
// append a spring
var theSpring = document.createElement("spring");
theSpring.setAttribute("flex", "100%");
toolbar.appendChild(theSpring);
// testing
var boldButton = document.getElementById("boldButton");
if (!boldButton)
dump("Failed to find button\n");
}
function SetupToolbarElements()
{
// Create an object to store controls for easy access
@ -102,6 +193,11 @@ function SetupToolbarElements()
toolbar.IsBold = document.getElementById("Editor:Style:IsBold");
}
function _EditorNotImplemented()
{
dump("Function not implemented\n");
}
function EditorShutdown()
{
dump("In EditorShutdown..\n");
@ -353,7 +449,7 @@ function EditorToggleStyle(styleName)
// see if the style is already set by looking at the observer node,
// which is the appropriate button
var theButton = document.getElementById(styleName + "Button");
dump("Toggling style " + styleName + "\n");
if (theButton)
{
var isOn = theButton.getAttribute(styleName);
@ -366,7 +462,7 @@ function EditorToggleStyle(styleName)
}
else
{
dump("No button found for the " + styleName + " style");
dump("No button found for the " + styleName + " style\n");
}
}

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

@ -14,7 +14,7 @@
<!ENTITY printSetupCmd.label ".Print Setup...">
<!ENTITY printPreviewCmd.label "Print Preview">
<!ENTITY printCmd.label "Print...">
<!ENTITY quitCmd.label "Quit">
<!ENTITY exitCmd.label "Quit">
<!-- Edit menu items -->
<!ENTITY editMenu.label "Edit">
@ -267,7 +267,7 @@
<!ENTITY fileprintpreview.accesskey "r">
<!ENTITY fileprint.accesskey "p">
<!ENTITY fileclose.accesskey "c">
<!ENTITY filequit.accesskey "q">
<!ENTITY fileexit.accesskey "q">
<!ENTITY editmenu.accesskey "e">
<!ENTITY editundo.accesskey "u">
<!ENTITY editredo.accesskey "r">