Diff for /chimera/MainController.mm between versions 1.35 and 1.44

version 1.35, 2002/04/05 00:28:47 version 1.44, 2002/04/17 07:38:31
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 53  static const char* ioServiceContractID = Line 54  static const char* ioServiceContractID =
     if ( (self = [super init]) ) {      if ( (self = [super init]) ) {
         mSplashScreen = [[SplashScreenWindow alloc] splashImage:nil withFade:YES withStatusRect:NSMakeRect(0,0,0,0)];          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");
 }  }
   
Line 69  static const char* ioServiceContractID = Line 73  static const char* ioServiceContractID =
     [mSplashScreen close];      [mSplashScreen close];
   
     [mBookmarksMenu setAutoenablesItems: NO];      [mBookmarksMenu setAutoenablesItems: NO];
    mMenuBookmarks = new BookmarksService(nil);    mMenuBookmarks = new BookmarksService((BookmarksDataSource*)nil);
     mMenuBookmarks->AddObserver();      mMenuBookmarks->AddObserver();
     mMenuBookmarks->ConstructBookmarksMenu(mBookmarksMenu, nsnull);      mMenuBookmarks->ConstructBookmarksMenu(mBookmarksMenu, nsnull);
     BookmarksService::gMainController = self;      BookmarksService::gMainController = self;
Line 95  static const char* ioServiceContractID = Line 99  static const char* ioServiceContractID =
   // If we have a key window, have it autosave its dimensions before    // If we have a key window, have it autosave its dimensions before
   // we open a new window.  That ensures the size ends up matching.    // we open a new window.  That ensures the size ends up matching.
   NSWindow* keyWindow = [mApplication keyWindow];    NSWindow* keyWindow = [mApplication keyWindow];
  if (keyWindow)  if ( keyWindow && [keyWindow respondsToSelector:@selector(autosaveWindowFrame)] )
     [[keyWindow windowController] autosaveWindowFrame];      [[keyWindow windowController] autosaveWindowFrame];
   
   // Now open the new window.    // Now open the new window.
Line 151  static const char* ioServiceContractID = Line 155  static const char* ioServiceContractID =
         [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:url];          [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:url];
         // ----------------------          // ----------------------
         NSWindow* keyWindow = [mApplication keyWindow];          NSWindow* keyWindow = [mApplication keyWindow];
        if (keyWindow)        if (keyWindow) {
            return [[keyWindow windowController] loadURL: url];          [[keyWindow windowController] loadURL: url];
           [[[[keyWindow windowController] getMyBrowserView] getBrowserView] setActive: YES];
         }
         else          else
            [self openBrowserWindowWithURL: url];          [self openBrowserWindowWithURL: url];
     }      }
 }  }
   
Line 213  static const char* ioServiceContractID = Line 219  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];
 }  }
   
   
   //
   // -findAgain
   //
   // Called in response to "Find Again" in edit menu. Tells the find controller
   // to find the next occurrance of what's already been found.
   //
 -(IBAction) findAgain:(id)aSender  -(IBAction) findAgain:(id)aSender
 {  {
    NSWindow* keyWindow = [mApplication keyWindow];  if ( mFindDialog )
    if (keyWindow)    [mFindDialog findAgain:aSender];
      [[keyWindow windowController] findAgain];  else
     NSBeep();
 }  }
   
 -(IBAction) goBack:(id)aSender  -(IBAction) goBack:(id)aSender
Line 268  static const char* ioServiceContractID = Line 290  static const char* ioServiceContractID =
 -(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 279  static const char* ioServiceContractID = Line 307  static const char* ioServiceContractID =
 {  {
     NSWindow* keyWindow = [mApplication keyWindow];      NSWindow* keyWindow = [mApplication keyWindow];
     if (keyWindow)      if (keyWindow)
      [[keyWindow windowController] addBookmark];      [[keyWindow windowController] addBookmarkExtended: YES];
 }  }
   
 -(IBAction) openMenuBookmark:(id)aSender  -(IBAction) openMenuBookmark:(id)aSender
Line 293  static const char* ioServiceContractID = Line 321  static const char* ioServiceContractID =
     BookmarksService::OpenMenuBookmark([keyWindow windowController], aSender);      BookmarksService::OpenMenuBookmark([keyWindow windowController], aSender);
 }  }
   
   -(IBAction)manageBookmarks: (id)aSender
   {
     NSWindow* keyWindow = [mApplication keyWindow];
     if (!keyWindow) {
       [self openBrowserWindowWithURLString: @"about:blank"];
       keyWindow = [mApplication keyWindow];
     }
   
     [[keyWindow windowController] manageBookmarks: aSender];
   }
   
 - (MVPreferencesController *)preferencesController  - (MVPreferencesController *)preferencesController
 {  {
     if (!preferencesController) {      if (!preferencesController) {
Line 325  static const char* ioServiceContractID = Line 364  static const char* ioServiceContractID =
           
 }  }
   
   - (IBAction)biggerTextSize:(id)aSender
   {
     NSWindow* keyWindow = [mApplication keyWindow];
     if (keyWindow)
       [[keyWindow windowController] biggerTextSize];
   }
   
   - (IBAction)smallerTextSize:(id)aSender
   {
     NSWindow* keyWindow = [mApplication keyWindow];
     if (keyWindow)
       [[keyWindow windowController] smallerTextSize];
   }
   
   - (IBAction)toggleSmoothText:(id)aSender
   {
     // XXXdwh Grab the prefs service and just set the pref directly.
     
   }
   
   
 @end  @end

Removed from v.1.35  
changed lines
  Added in v.1.44


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