Diff for /chimera/MainController.mm between versions 1.41 and 1.47

version 1.41, 2002/04/14 08:43:03 version 1.47, 2002/04/19 01:08:30
Line 52  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] splashImage:nil withFade:YES withStatusRect:NSMakeRect(0,0,0,0)];        mSplashScreen = [[SplashScreenWindow alloc] splashImage:nil withStatusRect:NSMakeRect(0,0,0,0)];
     }      }
     mFindDialog = nil;      mFindDialog = nil;
     mMenuBookmarks = nil;      mMenuBookmarks = nil;
Line 73  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 98  static const char* ioServiceContractID = Line 98  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* mainWindow = [mApplication mainWindow];
  if ( keyWindow && [keyWindow respondsToSelector:@selector(autosaveWindowFrame)] )  if ( mainWindow && [[mainWindow windowController] respondsToSelector:@selector(autosaveWindowFrame)] )
    [[keyWindow windowController] autosaveWindowFrame];    [[mainWindow windowController] autosaveWindowFrame];
   
   // Now open the new window.    // Now open the new window.
   BrowserWindowController* controller = [self openBrowserWindowWithURLString:@"about:blank"];    BrowserWindowController* controller = [self openBrowserWindowWithURLString:@"about:blank"];
Line 109  static const char* ioServiceContractID = Line 109  static const char* ioServiceContractID =
   
 -(IBAction)newTab:(id)aSender  -(IBAction)newTab:(id)aSender
 {  {
    NSWindow* keyWindow = [mApplication keyWindow];  [[[mApplication mainWindow] windowController] newTab];
    if (keyWindow) 
        [[keyWindow windowController] newTab]; 
 }  }
   
 -(IBAction)closeTab:(id)aSender  -(IBAction)closeTab:(id)aSender
 {  {
    NSWindow* keyWindow = [mApplication keyWindow];  [[[mApplication mainWindow] windowController] closeTab];
    if (keyWindow) 
        [[keyWindow windowController] closeTab]; 
 }  }
   
 -(IBAction) previousTab:(id)aSender  -(IBAction) previousTab:(id)aSender
 {  {
    NSWindow* keyWindow = [mApplication keyWindow];  [[[mApplication mainWindow] windowController] previousTab];
    if (keyWindow) 
        [[keyWindow windowController] previousTab]; 
 }  }
   
 -(IBAction) nextTab:(id)aSender;  -(IBAction) nextTab:(id)aSender;
 {  {
    NSWindow* keyWindow = [mApplication keyWindow];        [[[mApplication mainWindow] windowController] nextTab];
    if (keyWindow) 
        [[keyWindow windowController] nextTab]; 
 }  }
   
 -(IBAction) openFile:(id)aSender  -(IBAction) openFile:(id)aSender
Line 154  static const char* ioServiceContractID = Line 146  static const char* ioServiceContractID =
         // ----------------------          // ----------------------
         [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:url];          [[NSDocumentController sharedDocumentController] noteNewRecentDocumentURL:url];
         // ----------------------          // ----------------------
        NSWindow* keyWindow = [mApplication keyWindow];        NSWindow* mainWindow = [mApplication mainWindow];
        if (keyWindow) {        if (mainWindow) {
          [[keyWindow windowController] loadURL: url];          [[mainWindow windowController] loadURL: url];
          [[[[keyWindow windowController] getMyBrowserView] getBrowserView] setActive: YES];          [[[[mainWindow windowController] getMyBrowserView] getBrowserView] setActive: YES];
         }          }
         else          else
           [self openBrowserWindowWithURL: url];            [self openBrowserWindowWithURL: url];
Line 166  static const char* ioServiceContractID = Line 158  static const char* ioServiceContractID =
   
 -(IBAction) openLocation:(id)aSender  -(IBAction) openLocation:(id)aSender
 {  {
    NSWindow* keyWindow = [mApplication keyWindow];    NSWindow* mainWindow = [mApplication mainWindow];
    if (!keyWindow) {    if (!mainWindow) {
       [self openBrowserWindowWithURLString: @"about:blank"];        [self openBrowserWindowWithURLString: @"about:blank"];
      keyWindow = [mApplication keyWindow];      mainWindow = [mApplication mainWindow];
     }      }
           
    [[keyWindow windowController] performAppropriateLocationAction];    [[mainWindow windowController] performAppropriateLocationAction];
 }  }
   
 -(IBAction) savePage:(id)aSender  -(IBAction) savePage:(id)aSender
 {  {
    NSWindow* keyWindow = [mApplication keyWindow];  [[[mApplication mainWindow] windowController] saveDocument: mFilterView filterList: mFilterList];
    if (keyWindow) 
      [[keyWindow windowController] saveDocument: mFilterView filterList: mFilterList]; 
 }  }
   
 -(IBAction) printPage:(id)aSender  -(IBAction) printPage:(id)aSender
 {  {
    NSWindow* keyWindow = [mApplication keyWindow];  [[[mApplication mainWindow] windowController] printDocument];
    if (keyWindow) 
      [[keyWindow windowController] printDocument]; 
 }  }
   
 -(IBAction) printPreview:(id)aSender  -(IBAction) printPreview:(id)aSender
 {  {
    NSWindow* keyWindow = [mApplication keyWindow];  [[[mApplication mainWindow] windowController] printPreview];
    if (keyWindow) 
      [[keyWindow windowController] printPreview]; 
 }  }
   
 -(IBAction) toggleOfflineMode:(id)aSender  -(IBAction) toggleOfflineMode:(id)aSender
Line 251  static const char* ioServiceContractID = Line 237  static const char* ioServiceContractID =
   
 -(IBAction) goBack:(id)aSender  -(IBAction) goBack:(id)aSender
 {  {
    [[[mApplication keyWindow] windowController] back: aSender];     [[[mApplication mainWindow] windowController] back: aSender]; 
 }  }
   
 -(IBAction) goForward:(id)aSender  -(IBAction) goForward:(id)aSender
 {  {
    [[[mApplication keyWindow] windowController] forward: aSender];     [[[mApplication mainWindow] windowController] forward: aSender]; 
 }  }
   
 -(IBAction) doReload:(id)aSender  -(IBAction) doReload:(id)aSender
 {  {
    [(BrowserWindowController*)([[mApplication keyWindow] windowController]) reload: aSender];     [(BrowserWindowController*)([[mApplication mainWindow] windowController]) reload: aSender]; 
 }  }
   
 -(IBAction) doStop:(id)aSender  -(IBAction) doStop:(id)aSender
 {  {
    [(BrowserWindowController*)([[mApplication keyWindow] windowController]) stop: aSender];     [(BrowserWindowController*)([[mApplication mainWindow] windowController]) stop: aSender]; 
 }  }
   
 -(IBAction) goHome:(id)aSender  -(IBAction) goHome:(id)aSender
 {  {
    [[[mApplication keyWindow] windowController] home: aSender];    [[[mApplication mainWindow] windowController] home: aSender];
 }  }
   
 -(BrowserWindowController*)openBrowserWindowWithURLString: (NSString*)aURL  -(BrowserWindowController*)openBrowserWindowWithURLString: (NSString*)aURL
Line 292  static const char* ioServiceContractID = Line 278  static const char* ioServiceContractID =
     printf("Termination notification.\n");      printf("Termination notification.\n");
   
     // Autosave one of the windows.      // Autosave one of the windows.
    NSWindow* keyWindow = [mApplication keyWindow];    [[[mApplication mainWindow] windowController] autosaveWindowFrame];
    if (keyWindow) 
      [[keyWindow windowController] autosaveWindowFrame]; 
           
     mMenuBookmarks->RemoveObserver();      mMenuBookmarks->RemoveObserver();
     delete mMenuBookmarks;      delete mMenuBookmarks;
Line 305  static const char* ioServiceContractID = Line 289  static const char* ioServiceContractID =
 // Bookmarks menu actions.  // Bookmarks menu actions.
 -(IBAction) addBookmark:(id)aSender  -(IBAction) addBookmark:(id)aSender
 {  {
    NSWindow* keyWindow = [mApplication keyWindow];  [[[mApplication mainWindow] windowController] addBookmarkExtended: YES isFolder: NO];
    if (keyWindow)}
      [[keyWindow windowController] addBookmarkExtended: YES];
 -(IBAction) addFolder:(id)aSender
 {
   [[[mApplication mainWindow] windowController] addBookmarkExtended: YES isFolder: YES];
 }
 
 -(IBAction) addSeparator:(id)aSender
 {
 }  }
   
 -(IBAction) openMenuBookmark:(id)aSender  -(IBAction) openMenuBookmark:(id)aSender
 {  {
    NSWindow* keyWindow = [mApplication keyWindow];    NSWindow* mainWind = [mApplication mainWindow];
    if (!keyWindow) {    if (!mainWind) {
         [self openBrowserWindowWithURLString: @"about:blank"];          [self openBrowserWindowWithURLString: @"about:blank"];
        keyWindow = [mApplication keyWindow];        mainWind = [mApplication mainWindow];
     }      }
   
    BookmarksService::OpenMenuBookmark([keyWindow windowController], aSender);    BookmarksService::OpenMenuBookmark([mainWind windowController], aSender);
 }
 
 -(IBAction)manageBookmarks: (id)aSender
 {
   NSWindow* mainWindow = [mApplication mainWindow];
   if (!mainWindow) {
     [self openBrowserWindowWithURLString: @"about:blank"];
     mainWindow = [mApplication mainWindow];
   }
 
   [[mainWindow windowController] manageBookmarks: aSender];
 }  }
   
 - (MVPreferencesController *)preferencesController  - (MVPreferencesController *)preferencesController
Line 341  static const char* ioServiceContractID = Line 343  static const char* ioServiceContractID =
   
 - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename  - (BOOL)application:(NSApplication *)theApplication openFile:(NSString *)filename
 {  {
    NSWindow* keyWindow = [mApplication keyWindow];    NSWindow* mainWindow = [mApplication mainWindow];
   
    if (keyWindow) {    if (mainWindow) {
        [[keyWindow windowController] loadURL:[NSURL fileURLWithPath:filename]];        [[mainWindow windowController] loadURL:[NSURL fileURLWithPath:filename]];
     } else {      } else {
         [self openBrowserWindowWithURL:[NSURL fileURLWithPath:filename]];          [self openBrowserWindowWithURL:[NSURL fileURLWithPath:filename]];
     }      }
Line 353  static const char* ioServiceContractID = Line 355  static const char* ioServiceContractID =
           
 }  }
   
   - (IBAction)biggerTextSize:(id)aSender
   {
     [[[mApplication mainWindow] windowController] biggerTextSize];
   }
   
   - (IBAction)smallerTextSize:(id)aSender
   {
     [[[mApplication mainWindow] windowController] smallerTextSize];
   }
   
   - (IBAction)toggleSmoothText:(id)aSender
   {
     // XXXdwh Grab the prefs service and just set the pref directly.
     
   }
   
   
 @end  @end

Removed from v.1.41  
changed lines
  Added in v.1.47


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