fix bugs in find dialog and make it use the dialog overlay. make it not resizeable, fixed style rules on the windows and buttons. r=sfraser

git-svn-id: svn://10.0.0.236/trunk@49808 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
pavlov%netscape.com 1999-10-05 05:20:29 +00:00
parent 0899d7c171
commit 489535b9e0
3 changed files with 78 additions and 62 deletions

View File

@ -24,8 +24,8 @@
dialog.caseSensitive = document.getElementById("dialog.caseSensitive");
dialog.wrap = document.getElementById("dialog.wrap");
dialog.searchBackwards = document.getElementById("dialog.searchBackwards");
dialog.find = document.getElementById("dialog.find");
dialog.cancel = document.getElementById("dialog.cancel");
dialog.find = document.getElementById("ok");
dialog.cancel = document.getElementById("cancel");
dialog.enabled = false;
}
@ -83,6 +83,12 @@
return;
}
// change OK to find
dialog.find.setAttribute("value", document.getElementById("fBLT").getAttribute("value"));
// setup the dialogOverlay.xul button handlers
doSetOKCancel(onOK, onCancel);
// Save search context.
data = window.arguments[0];
@ -108,26 +114,26 @@
data.findDialog = null;
}
function find()
function onOK()
{
// Transfer dialog contents to data elements.
loadData();
// Search.
finder.FindNext( data );
// don't close the window
return false;
}
function cancel()
function onCancel()
{
// Close the window.
window.close();
return true;
}
function onTyping( key )
{
if ( key == 13 && dialog.enabled ) {
find();
} else {
if ( dialog.enabled ) {
// Disable OK if they delete all the text.
if ( dialog.findKey.value == "" ) {
@ -141,5 +147,4 @@
dialog.find.removeAttribute( "disabled" );
}
}
}
}

View File

@ -1,57 +1,68 @@
<?xml version="1.0"?>
<?xml version="1.0"?> <!-- -*- Mode: HTML -*- -->
<!--
The contents of this file are subject to the Netscape Public
License Version 1.1 (the "License"); you may not use this file
except in compliance with the License. You may obtain a copy of
the License at http://www.mozilla.org/NPL/
Software distributed under the License is distributed on an "AS
IS" basis, WITHOUT WARRANTY OF ANY KIND, either express or
implied. See the License for the specific language governing
rights and limitations under the License.
The Original Code is Mozilla Communicator client code, released
March 31, 1998.
The Initial Developer of the Original Code is Netscape
Communications Corporation. Portions created by Netscape are
Copyright (C) 1998-1999 Netscape Communications Corporation. All
Rights Reserved.
Contributor(s): Stuart Parmenter <pavlov@netscape.com>
Simon Fraser <sfraser@netscape.com>
Bill Law <law@netscape.com>
-->
<?xul-overlay href="chrome://global/content/dialogOverlay.xul"?>
<!DOCTYPE window SYSTEM "chrome://global/locale/finddialog.dtd">
<xul:window xmlns="http://www.w3.org/TR/REC-html40"
xmlns.xul="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="onLoad()"
onunload="onUnload()"
style="padding:5px;"
title="&findDialog.title;">
<script language="JavaScript" src="chrome://global/content/finddialog.js"/>
<window xmlns:html="http://www.w3.org/TR/REC-html40"
xmlns="http://www.mozilla.org/keymaster/gatekeeper/there.is.only.xul"
onload="onLoad();"
onunload="onUnload();"
title="&findDialog.title;"
align="vertical"
style="padding:5px;">
<table border="0" style="width:100%;">
<tr>
<td class="fieldlabel">
&findField.label;
</td>
<td align="left">
<input id="dialog.findKey" style="width:300px;" onkeyup="onTyping(event.which)"/>
</td>
</tr>
<html:script language="JavaScript" src="chrome://global/content/finddialog.js"/>
<box align="horizontal">
<html:label style="padding-top:5px; padding-right:5px;">&findField.label;</html:label>
<box align="vertical" style="padding:0px;">
<html:input id="dialog.findKey" type="text" size="30" onkeyup="onTyping(event.which)"/>
<html:div>
<html:input type="checkbox" id="dialog.caseSensitive"/>
<html:label class="disabled" for="dialog.caseSensitive">&caseSensitiveCheckbox.label;</html:label>
</html:div>
<tr class="checkboxrow">
<td align="right">
</td>
<td class="buttonlabel">
<input type="checkbox" id="dialog.caseSensitive"/>
<label class="disabled" for="dialog.caseSensitive">&caseSensitiveCheckbox.label;</label>
</td>
</tr>
<tr>
<td align="right">
</td>
<td class="buttonlabel" align="left">
<input type="checkbox" id="dialog.wrap"/>
<label class="disabled" for="dialog.wrap">&wrapCheckbox.label;</label>
</td>
</tr>
<tr>
<td align="right">
</td>
<td class="buttonlabel" align="left">
<input type="checkbox" id="dialog.searchBackwards"/>
<label class="disabled" for="dialog.searchBackwards">&backwardsCheckbox.label;</label>
</td>
</tr>
<tr>
<td align="right" colspan="2">
<button class="cancelbutton" id="dialog.cancel" onclick="cancel()">&cancelButton.label;</button>
<button class="defaultbutton" id="dialog.find" onclick="find()">&findButton.label;</button>
</td>
</tr>
</table>
</xul:window>
<html:div>
<html:input type="checkbox" id="dialog.wrap"/>
<html:label class="disabled" for="dialog.wrap">&wrapCheckbox.label;</html:label>
</html:div>
<html:div>
<html:input type="checkbox" id="dialog.searchBackwards"/>
<html:label class="disabled" for="dialog.searchBackwards">&backwardsCheckbox.label;</html:label>
</html:div>
</box>
</box>
<!-- used to store the find text -->
<foo style="display:none;" id="fBLT" value="&findButton.label;"/>
<box id="okCancelButtons"/>
</window>

View File

@ -796,7 +796,7 @@ static nsresult OpenDialogWithArg( nsIDOMWindow *parent,
"svs%ip",
url,
JSVAL_NULL,
"chrome",
"chrome,resizable=no",
(const nsIID*)(&nsISearchContext::GetIID()),
(nsISupports*)arg );
if ( argv ) {