Diff for /chimera/BrowserWindowController.mm between versions 1.26 and 1.39

version 1.26, 2002/02/11 03:43:12 version 1.39, 2002/02/25 08:44:17
Line 5 Line 5
 #import "BrowserWindowController.h"  #import "BrowserWindowController.h"
 #import "MyBrowserView.h"  #import "MyBrowserView.h"
   
   #include "nsIWebNavigation.h"
   
 static NSString *BrowserToolbarIdentifier       = @"Browser Window Toolbar";  static NSString *BrowserToolbarIdentifier       = @"Browser Window Toolbar";
 static NSString *BackToolbarItemIdentifier      = @"Back Toolbar Item";  static NSString *BackToolbarItemIdentifier      = @"Back Toolbar Item";
 static NSString *ForwardToolbarItemIdentifier   = @"Forward Toolbar Item";  static NSString *ForwardToolbarItemIdentifier   = @"Forward Toolbar Item";
Line 21  static NSString *PrintToolbarItemIdentif Line 23  static NSString *PrintToolbarItemIdentif
   
 @implementation BrowserWindowController  @implementation BrowserWindowController
   
   -(void)enterModalSession
   {
       mModalSession = [NSApp beginModalSessionForWindow: [self window]];
       [NSApp runModalSession: mModalSession];
       [NSApp endModalSession: mModalSession];
       mModalSession = nil;
   }
   
   -(void)mouseMoved:(NSEvent*)aEvent
   {
       if (mMoveReentrant)
           return;
           
       mMoveReentrant = YES;
       NSView* view = [[[self window] contentView] hitTest: [aEvent locationInWindow]];
       [view mouseMoved: aEvent];
       [super mouseMoved: aEvent];
       mMoveReentrant = NO;
   }
   
 - (id)init   - (id)init 
 {  {
     mInitialized = NO;      mInitialized = NO;
       mMoveReentrant = NO;
     return [super init];      return [super init];
 }  }
   
Line 40  static NSString *PrintToolbarItemIdentif Line 63  static NSString *PrintToolbarItemIdentif
     [mBrowserView windowClosed];      [mBrowserView windowClosed];
     [mSidebarBrowserView windowClosed];      [mSidebarBrowserView windowClosed];
           
       [mProgress release];
       
     [super dealloc];      [super dealloc];
 }  }
   
 - (void)windowDidLoad  - (void)windowDidLoad
 {  {
       [super windowDidLoad];
       
       if (mModalSession)
         [NSApp stopModal: mModalSession];
         
     mInitialized = YES;      mInitialized = YES;
       
       // Retain with a single extra refcount.  This allows the MyBrowserViews
       // to remove the progress meter from its superview without having to 
       // worry about retaining and releasing it.
       [mProgress retain];
       
       [[self window] setAcceptsMouseMovedEvents: YES];
       
     [self setupToolbar];      [self setupToolbar];
   
       // Our initial view is our primary view.  Connect it up.
       NSTabViewItem* tab = [mTabBrowser tabViewItemAtIndex: 0];
       NSView* view = [tab view];
       
       MyBrowserView* newView = [[[MyBrowserView alloc] initWithFrame: [view frame]] autorelease];
       [tab setView: newView];
       mBrowserView = newView;
           
     if (mURL) {      if (mURL) {
       [self loadURL: mURL];        [self loadURL: mURL];
Line 55  static NSString *PrintToolbarItemIdentif Line 101  static NSString *PrintToolbarItemIdentif
           
     [mSidebarDrawer setDelegate: self];      [mSidebarDrawer setDelegate: self];
           
     // Our initial view is our primary view.  Connect it up.  
     NSTabViewItem* tab = [mTabBrowser tabViewItemAtIndex: 0];  
     [mBrowserView makePrimaryBrowserView: tab urlbar: mURLBar status: mStatus      [mBrowserView makePrimaryBrowserView: tab urlbar: mURLBar status: mStatus
         progress: mProgress windowController: self];          progress: mProgress windowController: self];
 }  }
Line 253  static NSString *PrintToolbarItemIdentif Line 297  static NSString *PrintToolbarItemIdentif
     [mLocationSheetWindow orderOut:self];      [mLocationSheetWindow orderOut:self];
     [NSApp endSheet:mLocationSheetWindow returnCode:1];      [NSApp endSheet:mLocationSheetWindow returnCode:1];
     [self loadURL:[NSURL URLWithString:[mLocationSheetURLField stringValue]]];      [self loadURL:[NSURL URLWithString:[mLocationSheetURLField stringValue]]];
       
       // Focus and activate our content area.
       [[mBrowserView getBrowserView] setActive: YES];
 }  }
   
 - (IBAction)goToLocationFromToolbarURLField:(id)sender  - (IBAction)goToLocationFromToolbarURLField:(id)sender
 {  {
     [self loadURL:[NSURL URLWithString:[sender stringValue]]];      [self loadURL:[NSURL URLWithString:[sender stringValue]]];
       
       // Focus and activate our content area.
       [[mBrowserView getBrowserView] setActive: YES];
 }  }
   
 - (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList  - (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList
Line 310  static NSString *PrintToolbarItemIdentif Line 360  static NSString *PrintToolbarItemIdentif
   
 - (IBAction)stop:(id)aSender  - (IBAction)stop:(id)aSender
 {  {
  [[mBrowserView getBrowserView] stop: 0];  [[mBrowserView getBrowserView] stop: nsIWebNavigation::STOP_ALL];
 }  }
   
 - (IBAction)home:(id)aSender  - (IBAction)home:(id)aSender
Line 320  static NSString *PrintToolbarItemIdentif Line 370  static NSString *PrintToolbarItemIdentif
   
 - (IBAction)toggleSidebar:(id)aSender  - (IBAction)toggleSidebar:(id)aSender
 {  {
    if ( ([mSidebarDrawer state] == NSDrawerClosedState) || ([mSidebarDrawer state] == NSDrawerClosingState) ) {    NSResponder* resp = [[self window] firstResponder];
     [[self window] makeFirstResponder: nil];
     
     if ( ([mSidebarDrawer state] == NSDrawerClosedState) || ([mSidebarDrawer state] == NSDrawerClosingState) )  {
         // XXXHack to bypass sidebar crashes.
         [mSidebarDrawer open];          [mSidebarDrawer open];
     } else {      } else {
         [mSidebarDrawer close];          [mSidebarDrawer close];
     }      }
       
       [[self window] makeFirstResponder: resp];
 }  }
   
 -(void)loadURL:(NSURL*)aURL  -(void)loadURL:(NSURL*)aURL
 {  {
    if (mInitialized)    if (mInitialized) {
         [[mBrowserView getBrowserView] loadURI:aURL flags:NSLoadFlagsNone];          [[mBrowserView getBrowserView] loadURI:aURL flags:NSLoadFlagsNone];
       }
     else {      else {
         mURL = aURL;          mURL = aURL;
         [mURL retain];          [mURL retain];
Line 355  static NSString *PrintToolbarItemIdentif Line 412  static NSString *PrintToolbarItemIdentif
     [[self window] update];      [[self window] update];
     [[self window] display];      [[self window] display];
 }  }
   
   -(void)newTab
   {
       NSTabViewItem* newTab = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease];
       [mTabBrowser addTabViewItem: newTab];
       
       MyBrowserView* newView = [[[MyBrowserView alloc] initWithFrame: [mBrowserView frame]] autorelease];
       [newTab setView: newView];
       [newTab setLabel: @"Untitled"];
       
       [[newView getBrowserView] loadURI:[NSURL URLWithString:@"about:blank"] flags:NSLoadFlagsNone];
       
       [mTabBrowser selectLastTabViewItem: self];
       
       if ( [[[self window] toolbar] isVisible] ) {
           if ( ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconAndLabel) ||
                ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconOnly) ) {
               [self focusURLBar];
           } 
       }
       
       //XXXdwh Do this if we ever support auto-hide.
       //if ([mTabBrowser numberOfTabViewItems] == 2)
       //    [mTabBrowser setTabViewType: NSTopTabsBezelBorder];
   }
   
   - (void)tabView:(NSTabView *)aTabView didSelectTabViewItem:(NSTabViewItem *)aTabViewItem
   {
       // Disconnect the old view.
       [mBrowserView disconnectView];
       
       // Connect up the new view
       mBrowserView = [aTabViewItem view];
          
       // Make the new view the primary content area.
       [mBrowserView makePrimaryBrowserView: aTabViewItem urlbar: mURLBar status: mStatus
           progress: mProgress windowController: self];
   }
   
   -(MyBrowserView*)getMyBrowserView
   {
       return mBrowserView;
   }
 @end  @end
   

Removed from v.1.26  
changed lines
  Added in v.1.39


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