Diff for /chimera/FindDlgController.mm between versions 1.3 and 1.7

version 1.3, 2002/04/08 22:30:20 version 1.7, 2002/04/12 19:45:37
Line 36 Line 36
  * ***** END LICENSE BLOCK ***** */   * ***** END LICENSE BLOCK ***** */
   
 #import "FindDlgController.h"  #import "FindDlgController.h"
   #import "BrowserWindowController.h"
   #import "Find.h"
 #include "nsCOMPtr.h"  #include "nsCOMPtr.h"
   
 @implementation FindDlgController  @implementation FindDlgController
   
 - (void)windowDidLoad  - (void)windowDidLoad
 {  {
     mWebFind = nsnull;  
 }  }
   
   
 - (void)dealloc  
 {  
     NS_IF_RELEASE(mWebFind);  
     [super dealloc];  
 }  
   
-(void)setFind: (nsIWebBrowserFind*)aFind//
 // -find
 //
 // User clicked the find button, send the action to the window controller of the
 // frontmost browser window. If we found something, hide the window. If not, beep.
 //
 -(IBAction) find: (id)aSender
 {  {
    mWebFind = aFind;  NSWindowController* controller = [[NSApp mainWindow] windowController];
    NS_IF_ADDREF(mWebFind);  if ( [controller conformsToProtocol:@protocol(Find)] ) {
     id<Find> browserController = controller;
     mSearchText = [mSearchField stringValue];
     BOOL found = [browserController findInPage:mSearchText];
     if ( found ) 
       [self close];
     else
       NSBeep();
   }
   else
     NSBeep();
 }  }
   
   
 //  //
// -find// -findAgain
 //  //
// User clicked the find button, send the action to the window controller of the// Someone hit "find again" in the edit menu, send the action to the window controller of the
// frontmost browser window// frontmost browser window. Beep if we didn't find something.
 //  //
-(IBAction) find: (id)aSender-(IBAction) findAgain: (id)aSender
 {  {
  NSEnumerator* windowList = [[NSApp windows] objectEnumerator];  NSWindowController* controller = [[NSApp mainWindow] windowController];
  NSWindow* wind = [windowList nextObject];  if ( [controller conformsToProtocol:@protocol(Find)] ) {
  while ( wind ) {    id<Find> browserController = controller;
    if ( [[wind windowController] respondsToSelector:@selector(findInPage:)] )    BOOL found = [browserController findInPage:mSearchText];
      break;    if ( !found )
    wind = [windowList nextObject];      NSBeep();
   }    }
  if ( wind )  else
    [[wind windowController] findInPage:[mSearchField stringValue]];    NSBeep();
 }  }
   
   
   //
   // controlTextDidChange
   //
   // Check if there is anything in the text field, and if not, disable the find button
   //
   - (void)controlTextDidChange:(NSNotification *)aNotification
   {
     if ( [[mSearchField stringValue] length] )
       [mFindButton setEnabled:PR_TRUE];
     else
       [mFindButton setEnabled:PR_FALSE];    
   }
   
 @end  @end

Removed from v.1.3  
changed lines
  Added in v.1.7


FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>