ResKnife/Cocoa/Plug-Ins/Hex Editor/FindSheetController.m

81 lines
1.8 KiB
Mathematica
Raw Normal View History

#import "FindSheetController.h"
2002-03-21 04:02:26 +00:00
#import "HexWindowController.h"
@implementation FindSheetController
2002-03-21 04:02:26 +00:00
/* FORM DELEGATION METHOD */
- (void)controlTextDidEndEditing:(NSNotification *)notification
2002-03-21 04:02:26 +00:00
{
[self updateStrings];
}
- (void)updateStrings
{
[findString autorelease];
[replaceString autorelease];
2002-11-16 23:03:59 +00:00
findString = [[[findReplaceForm cellAtIndex:0] stringValue] copy];
replaceString = [[[findReplaceForm cellAtIndex:1] stringValue] copy];
2002-03-21 04:02:26 +00:00
}
/* HIDE AND SHOW SHEET */
- (IBAction)showFindSheet:(id)sender
{
// load window so I can play with boxes
[self window];
// enable/disable boxes
[searchSelectionOnlyBox setEnabled:([(NSTextView *)[[sender window] firstResponder] rangeForUserTextChange].length != 0)];
// set inital values
if( ![searchSelectionOnlyBox isEnabled] ) [searchSelectionOnlyBox setIntValue:0];
// show sheet
2002-03-21 04:02:26 +00:00
[NSApp beginSheet:[self window] modalForWindow:[sender window] modalDelegate:self didEndSelector:NULL contextInfo:nil];
}
- (IBAction)hideFindSheet:(id)sender
{
[[self window] orderOut:nil];
[NSApp endSheet:[self window]];
}
- (IBAction)findNext:(id)sender
{
2002-03-21 04:02:26 +00:00
[self updateStrings];
[self hideFindSheet:self];
NSLog( @"Finding next \"%@\"", findString );
}
- (IBAction)findPrevious:(id)sender
{
[self updateStrings];
[self hideFindSheet:self];
NSLog( @"Finding previous \"%@\"", findString );
}
2002-03-21 04:02:26 +00:00
- (IBAction)findWithSelection:(id)sender
{
2002-03-21 04:02:26 +00:00
[findString autorelease];
findString = [[NSString string] retain];
NSLog( @"Finding \"%@\"", findString );
}
- (IBAction)replaceAll:(id)sender
{
2002-03-21 04:02:26 +00:00
[self updateStrings];
[self hideFindSheet:self];
NSLog( @"Replacing all \"%@\" with \"%@\"", findString, replaceString );
}
- (IBAction)replaceFindNext:(id)sender
{
2002-03-21 04:02:26 +00:00
[self updateStrings];
[self hideFindSheet:self];
NSLog( @"Replacing \"%@\" with \"%@\" and finding next", findString, replaceString );
}
@end