Diff for /chimera/MainController.mm between versions 1.30 and 1.38

version 1.30, 2002/03/10 07:36:38 version 1.38, 2002/04/09 17:17:11
Line 44 Line 44
 #include "nsCocoaBrowserService.h"  #include "nsCocoaBrowserService.h"
 #import "AboutBox.h"  #import "AboutBox.h"
   
   
 static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";  static const char* ioServiceContractID = "@mozilla.org/network/io-service;1";
   
 @implementation MainController  @implementation MainController
Line 51  static const char* ioServiceContractID = Line 52  static const char* ioServiceContractID =
 -(id)init  -(id)init
 {  {
     if ( (self = [super init]) ) {      if ( (self = [super init]) ) {
        mSplashScreen = [[SplashScreenWindow alloc] splash];        mSplashScreen = [[SplashScreenWindow alloc] splashImage:nil withFade:YES withStatusRect:NSMakeRect(0,0,0,0)];
     }      }
       mFindDialog = nil;
       mMenuBookmarks = nil;
     return self;      return self;
 }  }
   
 -(void)dealloc  -(void)dealloc
 {  {
     [super dealloc];      [super dealloc];
       [mFindDialog release];
     printf("Main controller died.\n");      printf("Main controller died.\n");
 }  }
   
 -(void)awakeFromNib  -(void)awakeFromNib
{{    
     [self newWindow: self];      [self newWindow: self];
           
       [mSplashScreen close];
   
     [mBookmarksMenu setAutoenablesItems: NO];      [mBookmarksMenu setAutoenablesItems: NO];
       
     mMenuBookmarks = new BookmarksService(nil);      mMenuBookmarks = new BookmarksService(nil);
     mMenuBookmarks->AddObserver();      mMenuBookmarks->AddObserver();
     mMenuBookmarks->ConstructBookmarksMenu(mBookmarksMenu, nsnull);      mMenuBookmarks->ConstructBookmarksMenu(mBookmarksMenu, nsnull);
Line 87  static const char* ioServiceContractID = Line 92  static const char* ioServiceContractID =
     if (mOffline)      if (mOffline)
         [mOfflineMenuItem setTitle: @"Go Online"];          [mOfflineMenuItem setTitle: @"Go Online"];
   
     [mSplashScreen close];  
 }  }
   
 -(IBAction)newWindow:(id)aSender  -(IBAction)newWindow:(id)aSender
 {  {
    BrowserWindowController* controller = [self openBrowserWindowWithURLString:@"about:blank"];  // If we have a key window, have it autosave its dimensions before
    [controller focusURLBar];  // we open a new window.  That ensures the size ends up matching.
}  NSWindow* keyWindow = [mApplication keyWindow];
   if ( keyWindow && [keyWindow respondsToSelector:@selector(autosaveWindowFrame)] )
     [[keyWindow windowController] autosaveWindowFrame];
 
   // Now open the new window.
   BrowserWindowController* controller = [self openBrowserWindowWithURLString:@"about:blank"];
   [controller focusURLBar];
 }       
   
 -(IBAction)newTab:(id)aSender  -(IBAction)newTab:(id)aSender
 {  {
Line 140  static const char* ioServiceContractID = Line 151  static const char* ioServiceContractID =
         if ([urlArray count] == 0)          if ([urlArray count] == 0)
             return;              return;
         NSURL* url = [urlArray objectAtIndex: 0];          NSURL* url = [urlArray objectAtIndex: 0];
           // ----------------------
           [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:url];
           // ----------------------
         NSWindow* keyWindow = [mApplication keyWindow];          NSWindow* keyWindow = [mApplication keyWindow];
         if (keyWindow)          if (keyWindow)
             return [[keyWindow windowController] loadURL: url];              return [[keyWindow windowController] loadURL: url];
Line 203  static const char* ioServiceContractID = Line 217  static const char* ioServiceContractID =
 }  }
   
 // Edit menu actions.  // Edit menu actions.
   
   
   //
   // -findInPage
   //
   // Called in response to "Find" in edit menu. Opens the find dialog. We only keep
   // one around for the whole app to use, showing/hiding as we see fit.
   //
 -(IBAction) findInPage:(id)aSender  -(IBAction) findInPage:(id)aSender
 {  {
    NSWindow* keyWindow = [mApplication keyWindow];  if ( !mFindDialog )
    if (keyWindow)     mFindDialog = [[FindDlgController alloc] initWithWindowNibName: @"FindDialog"];
      [[keyWindow windowController] findInPage];  [mFindDialog showWindow:self];
 }  }
   
 -(IBAction) findAgain:(id)aSender  -(IBAction) findAgain:(id)aSender
Line 250  static const char* ioServiceContractID = Line 272  static const char* ioServiceContractID =
 -(BrowserWindowController*)openBrowserWindowWithURL: (NSURL*)aURL  -(BrowserWindowController*)openBrowserWindowWithURL: (NSURL*)aURL
 {  {
         BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];          BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
    [browser loadURL: aURL];  [browser loadURL: aURL];
         [browser showWindow: self];          [browser showWindow: self];
    return browser;  return browser;
 }  }
   
 -(void)applicationWillTerminate: (NSNotification*)aNotification  -(void)applicationWillTerminate: (NSNotification*)aNotification
 {  {
     printf("Termination notification.\n");      printf("Termination notification.\n");
   
       // Autosave one of the windows.
       NSWindow* keyWindow = [mApplication keyWindow];
       if (keyWindow)
         [[keyWindow windowController] autosaveWindowFrame];
       
     mMenuBookmarks->RemoveObserver();      mMenuBookmarks->RemoveObserver();
     delete mMenuBookmarks;      delete mMenuBookmarks;
     mMenuBookmarks = nsnull;      mMenuBookmarks = nsnull;
Line 301  static const char* ioServiceContractID = Line 329  static const char* ioServiceContractID =
     [[AboutBox sharedInstance] showPanel:sender];      [[AboutBox sharedInstance] showPanel:sender];
 }  }
   
   - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
   {
       NSWindow* keyWindow = [mApplication keyWindow];
   
       if (keyWindow) {
           [[keyWindow windowController] loadURL:[NSURL fileURLWithPath:filename]];
       } else {
           [self openBrowserWindowWithURL:[NSURL fileURLWithPath:filename]];
       }
       
       return YES;
       
   }
   
   
 @end  @end

Removed from v.1.30  
changed lines
  Added in v.1.38


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