Annotation of chimera/BrowserWindowController.mm, revision 1.46

1.44      hyatt       1: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
                      2: /* ***** BEGIN LICENSE BLOCK *****
                      3:  * Version: NPL 1.1/GPL 2.0/LGPL 2.1
                      4:  *
                      5:  * The contents of this file are subject to the Netscape Public License
                      6:  * Version 1.1 (the "License"); you may not use this file except in
                      7:  * compliance with the License. You may obtain a copy of the License at
                      8:  * http://www.mozilla.org/NPL/
                      9:  *
                     10:  * Software distributed under the License is distributed on an "AS IS" basis,
                     11:  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
                     12:  * for the specific language governing rights and limitations under the
                     13:  * License.
                     14:  *
                     15:  * The Original Code is mozilla.org code.
                     16:  *
                     17:  * The Initial Developer of the Original Code is 
                     18:  * Netscape Communications Corporation.
                     19:  * Portions created by the Initial Developer are Copyright (C) 2002
                     20:  * the Initial Developer. All Rights Reserved.
                     21:  *
                     22:  * Contributor(s):
                     23:  *
                     24:  * Alternatively, the contents of this file may be used under the terms of
                     25:  * either the GNU General Public License Version 2 or later (the "GPL"), or 
                     26:  * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
                     27:  * in which case the provisions of the GPL or the LGPL are applicable instead
                     28:  * of those above. If you wish to allow use of your version of this file only
                     29:  * under the terms of either the GPL or the LGPL, and not to allow others to
                     30:  * use your version of this file under the terms of the NPL, indicate your
                     31:  * decision by deleting the provisions above and replace them with the notice
                     32:  * and other provisions required by the GPL or the LGPL. If you do not delete
                     33:  * the provisions above, a recipient may use your version of this file under
                     34:  * the terms of any one of the NPL, the GPL or the LGPL.
                     35:  *
                     36:  * ***** END LICENSE BLOCK ***** */
1.1       hyatt      37: 
                     38: #import "BrowserWindowController.h"
                     39: #import "MyBrowserView.h"
                     40: 
1.37      hyatt      41: #include "nsIWebNavigation.h"
                     42: 
1.1       hyatt      43: static NSString *BrowserToolbarIdentifier  = @"Browser Window Toolbar";
                     44: static NSString *BackToolbarItemIdentifier = @"Back Toolbar Item";
                     45: static NSString *ForwardToolbarItemIdentifier  = @"Forward Toolbar Item";
                     46: static NSString *ReloadToolbarItemIdentifier = @"Reload Toolbar Item";
                     47: static NSString *StopToolbarItemIdentifier = @"Stop Toolbar Item";
                     48: static NSString *HomeToolbarItemIdentifier = @"Home Toolbar Item";
                     49: static NSString *LocationToolbarItemIdentifier = @"Location Toolbar Item";
                     50: static NSString *SidebarToolbarItemIdentifier  = @"Sidebar Toolbar Item";
1.11      macserv    51: static NSString *PrintToolbarItemIdentifier  = @"Print Toolbar Item";
1.1       hyatt      52: 
                     53: @interface BrowserWindowController(Private)
                     54: - (void)setupToolbar;
                     55: @end
                     56: 
                     57: @implementation BrowserWindowController
                     58: 
1.39      hyatt      59: -(void)enterModalSession
                     60: {
                     61:     mModalSession = [NSApp beginModalSessionForWindow: [self window]];
                     62:     [NSApp runModalSession: mModalSession];
                     63:     [NSApp endModalSession: mModalSession];
                     64:     mModalSession = nil;
                     65: }
                     66: 
1.35      hyatt      67: -(void)mouseMoved:(NSEvent*)aEvent
                     68: {
                     69:     if (mMoveReentrant)
                     70:         return;
                     71:         
                     72:     mMoveReentrant = YES;
                     73:     NSView* view = [[[self window] contentView] hitTest: [aEvent locationInWindow]];
                     74:     [view mouseMoved: aEvent];
                     75:     [super mouseMoved: aEvent];
                     76:     mMoveReentrant = NO;
                     77: }
                     78: 
1.41      macserv    79: - (id)initWithWindowNibName:(NSString *)windowNibName
1.4       hyatt      80: {
1.41      macserv    81:     if ( (self = [super initWithWindowNibName:(NSString *)windowNibName]) ) {
                     82:         mInitialized = NO;
                     83:         mMoveReentrant = NO;
                     84:     }
                     85:     return self;
1.4       hyatt      86: }
                     87: 
1.17      hyatt      88: - (void)windowWillClose:(NSNotification *)notification
                     89: {
1.40      hyatt      90:     printf("Window will close notification.\n");
1.17      hyatt      91:     [self autorelease];
1.21      hyatt      92:     [mSidebarBookmarksDataSource windowClosing];
1.17      hyatt      93: }
                     94: 
1.7       hyatt      95: - (void)dealloc
                     96: {
1.24      hyatt      97:     printf("Browser controller died.\n");
1.40      hyatt      98: 
1.10      hyatt      99:     [mBrowserView windowClosed];
1.25      hyatt     100:     [mSidebarBrowserView windowClosed];
                    101:     
1.38      hyatt     102:     [mProgress release];
1.40      hyatt     103:       
1.7       hyatt     104:     [super dealloc];
                    105: }
                    106: 
1.1       hyatt     107: - (void)windowDidLoad
                    108: {
1.35      hyatt     109:     [super windowDidLoad];
                    110:     
1.39      hyatt     111:     if (mModalSession)
                    112:       [NSApp stopModal: mModalSession];
                    113:       
1.4       hyatt     114:     mInitialized = YES;
1.38      hyatt     115:     
                    116:     // Retain with a single extra refcount.  This allows the MyBrowserViews
                    117:     // to remove the progress meter from its superview without having to 
                    118:     // worry about retaining and releasing it.
                    119:     [mProgress retain];
                    120:     
1.34      hyatt     121:     [[self window] setAcceptsMouseMovedEvents: YES];
                    122:     
1.1       hyatt     123:     [self setupToolbar];
1.30      hyatt     124: 
1.41      macserv   125: //  03/03/2002 mlj Changing strategy a bit here.  The addTab: method was
                    126: // duplicating a lot of the code found here.  I have moved it to that method.
                    127: // We now remove the IB tab, then add one of our own.
                    128: 
                    129:     [mTabBrowser removeTabViewItem:[mTabBrowser tabViewItemAtIndex:0]];
                    130:     [self newTab];
1.4       hyatt     131:     
                    132:     if (mURL) {
                    133:       [self loadURL: mURL];
                    134:       [mURL release];
                    135:     }
1.18      hyatt     136:     
                    137:     [mSidebarDrawer setDelegate: self];
1.32      hyatt     138:     
1.41      macserv   139: //    [mBrowserView makePrimaryBrowserView: tab urlbar: mURLBar status: mStatus
                    140:   //      progress: mProgress windowController: self];
1.18      hyatt     141: }
                    142: 
1.22      hyatt     143: - (void)drawerWillOpen: (NSNotification*)aNotification
                    144: {
                    145:     [mSidebarBookmarksDataSource ensureBookmarks];
                    146: }
                    147: 
1.18      hyatt     148: - (void)drawerDidOpen:(NSNotification *)aNotification
                    149: {
1.23      hyatt     150:     // XXXdwh This is temporary.
                    151:     [[mSidebarBrowserView getBrowserView] loadURI: [NSURL URLWithString: @"http://tinderbox.mozilla.org/SeaMonkey/panel.html"] flags:NSLoadFlagsNone];
1.1       hyatt     152: }
                    153: 
1.19      hyatt     154: - (void)drawerDidClose:(NSNotification *)aNotification
                    155: {
                    156:     // Unload the Gecko web page in "My Panels" to save memory.
                    157:     [[mSidebarBrowserView getBrowserView] loadURI: [NSURL URLWithString: @"about:blank"] flags:NSLoadFlagsNone];
                    158: }
                    159: 
1.1       hyatt     160: - (void)setupToolbar
                    161: {
                    162:     NSToolbar *toolbar = [[[NSToolbar alloc] initWithIdentifier:BrowserToolbarIdentifier] autorelease];
                    163:     
                    164:     [toolbar setDisplayMode:NSToolbarDisplayModeDefault];
                    165:     [toolbar setAllowsUserCustomization:YES];
                    166:     [toolbar setAutosavesConfiguration:YES];
                    167:     [toolbar setDelegate:self];
                    168:     [[self window] setToolbar:toolbar];
                    169: }
                    170: 
                    171: 
                    172: - (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar
                    173: {
                    174:     return [NSArray arrayWithObjects:  BackToolbarItemIdentifier,
                    175:                                         ForwardToolbarItemIdentifier,
                    176:                                         ReloadToolbarItemIdentifier,
                    177:                                         StopToolbarItemIdentifier,
                    178:                                         HomeToolbarItemIdentifier,
                    179:                                         LocationToolbarItemIdentifier,
                    180:                                         SidebarToolbarItemIdentifier,
1.11      macserv   181:                                         PrintToolbarItemIdentifier,
1.1       hyatt     182:                                         NSToolbarCustomizeToolbarItemIdentifier,
                    183:                                         NSToolbarFlexibleSpaceItemIdentifier,
                    184:                                         NSToolbarSpaceItemIdentifier,
                    185:                                         NSToolbarSeparatorItemIdentifier,
                    186:                                         nil];
                    187: }
                    188: 
                    189: - (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar
                    190: {
                    191:     return [NSArray arrayWithObjects:  BackToolbarItemIdentifier,
                    192:                                         ForwardToolbarItemIdentifier,
                    193:                                         ReloadToolbarItemIdentifier,
                    194:                                         StopToolbarItemIdentifier,
                    195:                                         HomeToolbarItemIdentifier,
                    196:                                         LocationToolbarItemIdentifier,
                    197:                                         SidebarToolbarItemIdentifier,
                    198:                                         nil];
                    199: }
                    200: 
                    201: - (NSToolbarItem *) toolbar:(NSToolbar *)toolbar
                    202:       itemForItemIdentifier:(NSString *)itemIdent
                    203:   willBeInsertedIntoToolbar:(BOOL)willBeInserted
                    204: {
                    205:     NSToolbarItem *toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier:itemIdent] autorelease];
                    206:     if ( [itemIdent isEqual:BackToolbarItemIdentifier] ) {
                    207:         [toolbarItem setLabel:@"Back"];
                    208:         [toolbarItem setPaletteLabel:@"Go Back"];
                    209:         [toolbarItem setToolTip:@"Go back one page"];
                    210:         [toolbarItem setImage:[NSImage imageNamed:@"back"]];
                    211:         [toolbarItem setTarget:self];
                    212:         [toolbarItem setAction:@selector(back:)];
                    213:     } else if ( [itemIdent isEqual:ForwardToolbarItemIdentifier] ) {
                    214:         [toolbarItem setLabel:@"Forward"];
                    215:         [toolbarItem setPaletteLabel:@"Go Forward"];
                    216:         [toolbarItem setToolTip:@"Go forward one page"];
                    217:         [toolbarItem setImage:[NSImage imageNamed:@"forward"]];
                    218:         [toolbarItem setTarget:self];
                    219:         [toolbarItem setAction:@selector(forward:)];
                    220:     } else if ( [itemIdent isEqual:ReloadToolbarItemIdentifier] ) {
                    221:         [toolbarItem setLabel:@"Reload"];
                    222:         [toolbarItem setPaletteLabel:@"Reload Page"];
                    223:         [toolbarItem setToolTip:@"Reload current page"];
                    224:         [toolbarItem setImage:[NSImage imageNamed:@"reload"]];
                    225:         [toolbarItem setTarget:self];
                    226:         [toolbarItem setAction:@selector(reload:)];
                    227:     } else if ( [itemIdent isEqual:StopToolbarItemIdentifier] ) {
                    228:         [toolbarItem setLabel:@"Stop"];
                    229:         [toolbarItem setPaletteLabel:@"Stop Loading"];
                    230:         [toolbarItem setToolTip:@"Stop loading this page"];
                    231:         [toolbarItem setImage:[NSImage imageNamed:@"stop"]];
                    232:         [toolbarItem setTarget:self];
                    233:         [toolbarItem setAction:@selector(stop:)];
                    234:     } else if ( [itemIdent isEqual:HomeToolbarItemIdentifier] ) {
                    235:         [toolbarItem setLabel:@"Home"];
                    236:         [toolbarItem setPaletteLabel:@"Go Home"];
                    237:         [toolbarItem setToolTip:@"Go to home page"];
                    238:         [toolbarItem setImage:[NSImage imageNamed:@"home"]];
                    239:         [toolbarItem setTarget:self];
                    240:         [toolbarItem setAction:@selector(home:)];
                    241:     } else if ( [itemIdent isEqual:SidebarToolbarItemIdentifier] ) {
                    242:         [toolbarItem setLabel:@"Sidebar"];
                    243:         [toolbarItem setPaletteLabel:@"Toggle Sidebar"];
                    244:         [toolbarItem setToolTip:@"Show or hide the Sidebar"];
                    245:         [toolbarItem setImage:[NSImage imageNamed:@"sidebar"]];
                    246:         [toolbarItem setTarget:self];
                    247:         [toolbarItem setAction:@selector(toggleSidebar:)];
                    248:     } else if ( [itemIdent isEqual:LocationToolbarItemIdentifier] ) {
                    249:         
                    250:         NSMenuItem *menuFormRep = [[[NSMenuItem alloc] init] autorelease];
                    251:         
                    252:         [toolbarItem setLabel:@"Location"];
                    253:         [toolbarItem setPaletteLabel:@"Location"];
                    254:         [toolbarItem setImage:[NSImage imageNamed:@"Enter a web location."]];
                    255:         [toolbarItem setView:mLocationToolbarView];
                    256:         [toolbarItem setMinSize:NSMakeSize(128,32)];
                    257:         [toolbarItem setMaxSize:NSMakeSize(2560,32)];
                    258:         
                    259:         [menuFormRep setTarget:self];
1.5       macserv   260:         [menuFormRep setAction:@selector(performAppropriateLocationAction)];
1.1       hyatt     261:         [menuFormRep setTitle:[toolbarItem label]];
                    262:         
                    263:         [toolbarItem setMenuFormRepresentation:menuFormRep];
1.5       macserv   264:         mLocationToolbarItem = toolbarItem;
1.11      macserv   265: 
                    266:     } else if ( [itemIdent isEqual:PrintToolbarItemIdentifier] ) {
                    267:         [toolbarItem setLabel:@"Print"];
                    268:         [toolbarItem setPaletteLabel:@"Print"];
                    269:         [toolbarItem setToolTip:@"Print this page"];
                    270:         [toolbarItem setImage:[NSImage imageNamed:@"print"]];
                    271:         [toolbarItem setTarget:self];
                    272:         [toolbarItem setAction:@selector(printDocument)];
1.1       hyatt     273:     } else {
                    274:         toolbarItem = nil;
                    275:     }
                    276:         
                    277:     return toolbarItem;
                    278: }
                    279: 
                    280: // This method handles the enabling/disabling of the toolbar buttons.
                    281: - (BOOL)validateToolbarItem:(NSToolbarItem *)theItem
                    282: {
                    283:   // Check the action and see if it matches.
                    284:   SEL action = [theItem action];
                    285:   if (action == @selector(back:))
                    286:     return [[mBrowserView getBrowserView] canGoBack];
                    287:   else if (action == @selector(forward:))
                    288:     return [[mBrowserView getBrowserView] canGoForward];
                    289:   else if (action == @selector(reload:))
                    290:     return [mBrowserView isBusy] == NO;
                    291:   else if (action == @selector(stop:))
                    292:     return [mBrowserView isBusy];
                    293:   else
                    294:     return YES;
                    295: }
                    296:    
1.5       macserv   297: - (void)updateToolbarItems
1.1       hyatt     298: {
                    299:   [[[self window] toolbar] validateVisibleItems];
                    300: }
                    301: 
1.5       macserv   302: - (void)performAppropriateLocationAction
                    303: {
                    304:     if ( [[[self window] toolbar] isVisible] ) {
                    305:         if ( ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconAndLabel) ||
                    306:              ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconOnly) ) {
                    307:             [self focusURLBar];
                    308:         } else {
                    309:             [self beginLocationSheet];
                    310:         }
                    311:     } else {
                    312:         [self beginLocationSheet];
                    313:     }
                    314: }
                    315: 
                    316: - (void)focusURLBar
1.3       hyatt     317: {
                    318:     [mURLBar selectText: self];
                    319: }
                    320: 
1.5       macserv   321: - (void)beginLocationSheet
                    322: {
                    323:     [NSApp beginSheet: mLocationSheetWindow
                    324:        modalForWindow: [self window]
                    325:         modalDelegate: nil
                    326:        didEndSelector: nil
                    327:           contextInfo: nil];
                    328: }
                    329: 
                    330: - (IBAction)endLocationSheet:(id)sender
                    331: {
                    332:     [mLocationSheetWindow orderOut:self];
                    333:     [NSApp endSheet:mLocationSheetWindow returnCode:1];
                    334:     [self loadURL:[NSURL URLWithString:[mLocationSheetURLField stringValue]]];
1.32      hyatt     335:     
                    336:     // Focus and activate our content area.
                    337:     [[mBrowserView getBrowserView] setActive: YES];
1.5       macserv   338: }
                    339: 
                    340: - (IBAction)goToLocationFromToolbarURLField:(id)sender
                    341: {
                    342:     [self loadURL:[NSURL URLWithString:[sender stringValue]]];
1.32      hyatt     343:     
                    344:     // Focus and activate our content area.
                    345:     [[mBrowserView getBrowserView] setActive: YES];
1.5       macserv   346: }
                    347: 
1.7       hyatt     348: - (void)saveDocument: (NSView*)aFilterView filterList: (NSPopUpButton*)aFilterList
1.6       hyatt     349: {
1.7       hyatt     350:     [[mBrowserView getBrowserView] saveDocument: aFilterView filterList: aFilterList];
1.6       hyatt     351: }
                    352: 
1.12      hyatt     353: - (void)printDocument
                    354: {
                    355:     [[mBrowserView getBrowserView] printDocument];
                    356: }
                    357: 
1.15      hyatt     358: - (void)printPreview
                    359: {
                    360:     [[mBrowserView getBrowserView] printPreview];
                    361: }
                    362: 
1.16      hyatt     363: - (void)findInPage
                    364: {
                    365:     [[mBrowserView getBrowserView] findInPage];
                    366: }
                    367: 
                    368: - (void)findAgain
                    369: {
                    370:     [[mBrowserView getBrowserView] findAgain];
1.22      hyatt     371: }
                    372: 
                    373: - (void)addBookmark
                    374: {
                    375:     // XXXdwh Hack.  Just go to the sidebar for now until we get our
                    376:     // menu data source going.
                    377:     [mSidebarBookmarksDataSource ensureBookmarks];
                    378:     [mSidebarBookmarksDataSource addBookmark: self];
1.16      hyatt     379: }
                    380: 
1.5       macserv   381: - (IBAction)back:(id)aSender
1.1       hyatt     382: {
                    383:   [[mBrowserView getBrowserView] goBack];
                    384: }
                    385: 
1.5       macserv   386: - (IBAction)forward:(id)aSender
1.1       hyatt     387: {
                    388:   [[mBrowserView getBrowserView] goForward];
                    389: }
                    390: 
1.5       macserv   391: - (IBAction)reload:(id)aSender
1.1       hyatt     392: {
                    393:   [[mBrowserView getBrowserView] reload: 0];
                    394: }
                    395: 
1.5       macserv   396: - (IBAction)stop:(id)aSender
1.1       hyatt     397: {
1.37      hyatt     398:   [[mBrowserView getBrowserView] stop: nsIWebNavigation::STOP_ALL];
1.1       hyatt     399: }
                    400: 
1.5       macserv   401: - (IBAction)home:(id)aSender
1.1       hyatt     402: {
1.5       macserv   403:   [[mBrowserView getBrowserView] loadURI:[NSURL URLWithString:@"about:blank"] flags:NSLoadFlagsNone];
1.1       hyatt     404: }
                    405: 
1.5       macserv   406: - (IBAction)toggleSidebar:(id)aSender
1.1       hyatt     407: {
1.36      hyatt     408:     NSResponder* resp = [[self window] firstResponder];
                    409:     [[self window] makeFirstResponder: nil];
                    410:     
1.31      hyatt     411:     if ( ([mSidebarDrawer state] == NSDrawerClosedState) || ([mSidebarDrawer state] == NSDrawerClosingState) )   {
1.34      hyatt     412:         // XXXHack to bypass sidebar crashes.
1.1       hyatt     413:         [mSidebarDrawer open];
                    414:     } else {
                    415:         [mSidebarDrawer close];
                    416:     }
1.36      hyatt     417:     
                    418:     [[self window] makeFirstResponder: resp];
1.1       hyatt     419: }
                    420: 
1.4       hyatt     421: -(void)loadURL:(NSURL*)aURL
1.1       hyatt     422: {
1.32      hyatt     423:     if (mInitialized) {
1.4       hyatt     424:         [[mBrowserView getBrowserView] loadURI:aURL flags:NSLoadFlagsNone];
1.32      hyatt     425:     }
1.4       hyatt     426:     else {
                    427:         mURL = aURL;
                    428:         [mURL retain];
                    429:     }
1.1       hyatt     430: }
1.5       macserv   431: 
                    432: - (void)updateLocationFields:(NSString *)locationString
                    433: {
                    434: /* //commenting this out because it doesn't work right yet.
                    435:     if ( [locationString length] > 30 ) {
                    436:         [[mLocationToolbarItem menuFormRepresentation] setTitle:
                    437:             [NSString stringWithFormat:@"Location: %@...", [locationString substringToIndex:31]]];
                    438:     } else {
                    439:         [[mLocationToolbarItem menuFormRepresentation] setTitle:
                    440:             [NSString stringWithFormat:@"Location: %@", locationString]];
                    441:     }
                    442: */
                    443: 
                    444:     [mURLBar setStringValue:locationString];
                    445:     [mLocationSheetURLField setStringValue:locationString];
                    446: 
                    447:     [[self window] update];
                    448:     [[self window] display];
1.8       hyatt     449: }
1.27      hyatt     450: 
                    451: -(void)newTab
                    452: {
1.28      hyatt     453:     NSTabViewItem* newTab = [[[NSTabViewItem alloc] initWithIdentifier: nil] autorelease];
1.41      macserv   454:     MyBrowserView* newView = [[[MyBrowserView alloc] initWithFrame: [[newTab view] frame]] autorelease];
                    455: 
                    456:     [newTab setLabel: @"Untitled"];
                    457:     [newTab setView: newView];
                    458: 
1.28      hyatt     459:     [mTabBrowser addTabViewItem: newTab];
1.42      macserv   460: 
1.28      hyatt     461:     [[newView getBrowserView] loadURI:[NSURL URLWithString:@"about:blank"] flags:NSLoadFlagsNone];
1.42      macserv   462: 
1.28      hyatt     463:     [mTabBrowser selectLastTabViewItem: self];
1.42      macserv   464: 
1.29      hyatt     465:     if ( [[[self window] toolbar] isVisible] ) {
                    466:         if ( ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconAndLabel) ||
                    467:              ([[[self window] toolbar] displayMode] == NSToolbarDisplayModeIconOnly) ) {
                    468:             [self focusURLBar];
1.42      macserv   469:         }
1.29      hyatt     470:     }
1.42      macserv   471: }
                    472: 
                    473: -(void)closeTab
                    474: {
                    475:     if ( [mTabBrowser numberOfTabViewItems] > 1 ) {
                    476:         [mTabBrowser removeTabViewItem:[mTabBrowser selectedTabViewItem]];
                    477:     }
                    478: }
                    479: 
                    480: - (void)previousTab
                    481: {
                    482:     [mTabBrowser selectPreviousTabViewItem:self];
                    483: }
                    484: 
                    485: - (void)nextTab
                    486: {
                    487:     [mTabBrowser selectNextTabViewItem:self];
1.28      hyatt     488: }
1.27      hyatt     489: 
1.28      hyatt     490: - (void)tabView:(NSTabView *)aTabView didSelectTabViewItem:(NSTabViewItem *)aTabViewItem
                    491: {
1.41      macserv   492:     // Disconnect the old view, if one has been designated.
                    493:     // If the window has just been opened, none has been.
                    494:     if ( mBrowserView ) {
                    495:         [mBrowserView disconnectView];
                    496:     }
1.28      hyatt     497:     // Connect up the new view
                    498:     mBrowserView = [aTabViewItem view];
1.30      hyatt     499:        
1.28      hyatt     500:     // Make the new view the primary content area.
                    501:     [mBrowserView makePrimaryBrowserView: aTabViewItem urlbar: mURLBar status: mStatus
                    502:         progress: mProgress windowController: self];
1.27      hyatt     503: }
1.28      hyatt     504: 
1.31      hyatt     505: -(MyBrowserView*)getMyBrowserView
                    506: {
                    507:     return mBrowserView;
                    508: }
1.45      hyatt     509: 
                    510: -(void)openNewWindowWithURL: (NSURL*)aURL loadInBackground: (BOOL)aLoadInBG
                    511: {
                    512:     BrowserWindowController* browser = [[BrowserWindowController alloc] initWithWindowNibName: @"BrowserWindow"];
                    513:     [browser loadURL: aURL];
1.46    ! hyatt     514:     if (aLoadInBG)
        !           515:       [[browser window] orderWindow: NSWindowBelow relativeTo: [[self window] windowNumber]];
        !           516:  else
        !           517:       [browser showWindow: self];
1.45      hyatt     518: }
1.1       hyatt     519: @end
                    520: 

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