Monday, November 08, 2010 at 12:05 AM.
system.verbs.builtins.search.dialog
on dialog () {
<<Changes:
<<Sat, Apr 28, 2001 at 3:06:39 PM by PBS
<<The Mac OS version uses a slightly tweaked dialog with a different id.
params = @user.prefs.search;
lastitemhit = 0;
on itemhit (item) {
on copyfromdialog () {
params^.searchfor = dialog.getvalue (6);
params^.replacewith = dialog.getvalue (8);
params^.wholewords = dialog.getvalue (9);
params^.casesensitive = not dialog.getvalue (10);
params^.wraparound = dialog.getvalue (11);
<<following assignments restrict functionality for Frontier 2.0
params^.flatsearch = false; <<context is limited to frontmost window's content
params^.closewindows = true}; <<always close windows as search progresses
on checkboxhit (val) {
val^ = not val^;
dialog.setvalue (item, val^)};
lastitemhit = item; <<in case we exit
case item {
-1 { <<initialize values
dialog.setvalue (6, params^.searchfor);
dialog.setvalue (8, params^.replacewith);
dialog.setvalue (9, params^.wholewords);
dialog.setvalue (10, not params^.casesensitive);
dialog.setvalue (11, params^.wraparound);
search.reset ()};
-2 { <<window closed -- accept the settings
copyfromdialog ();
return (false)};
1 { <<user clicked on the Find button
copyfromdialog ();
if not search.findnext () {
speaker.beep ()}};
2 { <<user clicked on the Cancel button
return (false)};
3 { <<user clicked on Replace All
copyfromdialog ();
numreplaced = search.replaceall ();
if numreplaced == 0 {
speaker.beep ()}
else {
dialog.notify (numreplaced + " replacements made.")}};
4 { <<user clicked on Replace button
copyfromdialog ();
search.replace ();
if not search.findNext () {
speaker.beep ()}};
9 { <<user clicked on Whole Words checkbox
checkboxhit (@params^.wholewords)};
10 { <<user clicked on Ignore Case checkbox
params^.casesensitive = not params^.casesensitive;
dialog.setvalue (item, not params^.casesensitive)};
11 { <<user clicked on Wrap Around checkbox
checkboxhit (@params^.wraparound)}};
return (true)}; <<keep dialog around
local (idDialog = 512);
if system.environment.isCarbon { //PBS 04/26/01: slight changes for Aqua
idDialog = 518};
if not dialog.runmodeless (idDialog, 1, @itemhit) { <<the Find button is highlighted
return (false)};
return (lastitemhit != 2)} <<item 2 is the Cancel button
This listing is for code that runs in the OPML Editor environment. I created these listings because I wanted the search engines to index it, so that when I want to look up something in my codebase I don't have to use the much slower search functionality in my object database. Dave Winer.