Fixed busted error message dialog and command handling in Composer ColorPicker, b=86697, r=brade, sr=kin, a=roc+moz

This commit is contained in:
cmanske%netscape.com 2001-08-29 14:04:40 +00:00
Родитель df0bf4898e
Коммит 72f2994089
2 изменённых файлов: 20 добавлений и 17 удалений

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

@ -142,7 +142,7 @@ function Startup()
// Set method to detect clicking on OK button
// so we don't get fooled by changing "default" behavior
dialog.Ok.setAttribute("onclick", "onOKClick()");
dialog.Ok.setAttribute("onclick", "SetDefaultToOk()");
// Make the "Last-picked" the default button
// until the user selects a color
@ -173,11 +173,8 @@ function ChangePalette(palette)
function SelectColor()
{
var color = dialog.ColorPicker.color;
if (color.length > 0)
{
if (color)
SetCurrentColor(color);
SetDefaultToOk();
}
}
function RemoveColor()
@ -187,6 +184,15 @@ function RemoveColor()
SetDefaultToOk();
}
function SelectColorByKeypress(aEvent)
{
if (aEvent.charCode == aEvent.DOM_VK_SPACE)
{
SelectColor();
SetDefaultToOk();
}
}
function SelectLastPickedColor()
{
SetCurrentColor(LastPickedColor);
@ -198,7 +204,10 @@ function SetCurrentColor(color)
{
// TODO: Validate color?
if(!color) color = "";
dialog.ColorInput.value = color.trimString().toLowerCase();
color = color.trimString().toLowerCase();
if (color == "mixed")
color = "";
dialog.ColorInput.value = color;
SetColorSwatch();
}
@ -225,15 +234,6 @@ function SetDefaultToOk()
LastPickedIsDefault = false;
}
function onOKClick()
{
// Clicking on OK should not use LastPickedColor automatically
// as using Enter ("default") key does
LastPickedIsDefault = false;
if ( onOK() )
window.close();
}
function ValidateData()
{
if (LastPickedIsDefault)

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

@ -53,6 +53,9 @@
</hbox>
<colorpicker id="ColorPicker" palettename="standard"
persist="palettename"
onclick="SetDefaultToOk();"
ondblclick="if (onOK()) window.close();"
onkeypress="SelectColorByKeypress(event);"
onselect="SelectColor();"/>
<!-- Web palette is not implemented???
<hbox valign="middle" autostretch="never">
@ -66,7 +69,7 @@
<stack valign="middle" autostretch="never">
<button id="LastPickedButton" class="dialog" label="&lastPickedColor.label;"
style="margin-left:0px; margin-right: 0px;"
onclick="SelectLastPickedColor();"/>
oncommand="SelectLastPickedColor();"/>
<hbox style="margin-left: 5px" mousethrough="always">
<vbox autostretch="never">
<spring flex="1"/>
@ -92,5 +95,5 @@
</vbox>
<separator class="groove"/>
<!-- from global dialogOverlay -->
<hbox id="okCancelButtons"/>
<hbox id="okCancelButtonsRight"/>
</window>