Diff for /chimera/BrowserWindowController.mm between versions 1.56 and 1.57

version 1.56, 2002/04/08 23:33:41 version 1.57, 2002/04/09 01:11:32
Line 142  static NSString *PrintToolbarItemIdentif Line 142  static NSString *PrintToolbarItemIdentif
       [NSApp stopModal: mModalSession];        [NSApp stopModal: mModalSession];
               
     mInitialized = YES;      mInitialized = YES;
   
       mDrawerCachedFrame = NO;
           
     // Retain with a single extra refcount.  This allows the MyBrowserViews      // Retain with a single extra refcount.  This allows the MyBrowserViews
     // to remove the progress meter from its superview without having to       // to remove the progress meter from its superview without having to 
Line 171  static NSString *PrintToolbarItemIdentif Line 173  static NSString *PrintToolbarItemIdentif
   
 - (void)drawerWillOpen: (NSNotification*)aNotification  - (void)drawerWillOpen: (NSNotification*)aNotification
 {  {
    [mSidebarBookmarksDataSource ensureBookmarks];  [mSidebarBookmarksDataSource ensureBookmarks];
 
   // Force the window to shrink and move if necessary in order to accommodate the sidebar.
   NSRect screenFrame = [[[self window] screen] frame];
   NSRect windowFrame = [[self window] frame];
   NSSize drawerSize = [mSidebarDrawer contentSize];
   int fudgeFactor = 12; // Not sure how to get the drawer's border info, so we fudge it for now.
   drawerSize.width += fudgeFactor;
   if (windowFrame.origin.x + windowFrame.size.width + drawerSize.width >
       screenFrame.size.width) {
     // We need to adjust the window so that it can fit.
     int shrinkDelta = (windowFrame.size.width + drawerSize.width) - screenFrame.size.width;
     if (shrinkDelta < 0) shrinkDelta = 0;
     int newWidth = (windowFrame.size.width - shrinkDelta);
     int newPosition = screenFrame.size.width - newWidth - drawerSize.width;
     if (newPosition < 0) newPosition = 0;
     mCachedFrameBeforeDrawerOpen = windowFrame;
     windowFrame.origin.x = newPosition;
     windowFrame.size.width = newWidth;
     mCachedFrameAfterDrawerOpen = windowFrame;
     [[self window] setFrame: windowFrame display: YES];
     mDrawerCachedFrame = YES;
   }
 }  }
   
 - (void)drawerDidOpen:(NSNotification *)aNotification  - (void)drawerDidOpen:(NSNotification *)aNotification
 {  {
    // XXXdwh This is temporary.  // XXXdwh This is temporary.
   //  [[mSidebarBrowserView getBrowserView] loadURI: [NSURL URLWithString: @"http://tinderbox.mozilla.org/SeaMonkey/panel.html"] flags:NSLoadFlagsNone];    //  [[mSidebarBrowserView getBrowserView] loadURI: [NSURL URLWithString: @"http://tinderbox.mozilla.org/SeaMonkey/panel.html"] flags:NSLoadFlagsNone];
    [mSidebarToolbarItem setImage:[NSImage imageNamed:@"sidebarOpened"]];
   // Toggle the sidebar icon.
   [mSidebarToolbarItem setImage:[NSImage imageNamed:@"sidebarOpened"]];
 }  }
   
 - (void)drawerDidClose:(NSNotification *)aNotification  - (void)drawerDidClose:(NSNotification *)aNotification
 {  {
    // Unload the Gecko web page in "My Panels" to save memory.  // Unload the Gecko web page in "My Panels" to save memory.
    [mSidebarToolbarItem setImage:[NSImage imageNamed:@"sidebarClosed"]];  [mSidebarToolbarItem setImage:[NSImage imageNamed:@"sidebarClosed"]];
 
   // XXXdwh ignore for now.
   //  [[mSidebarBrowserView getBrowserView] loadURI: [NSURL URLWithString: @"about:blank"] flags:NSLoadFlagsNone];    //  [[mSidebarBrowserView getBrowserView] loadURI: [NSURL URLWithString: @"about:blank"] flags:NSLoadFlagsNone];
   
     if (mDrawerCachedFrame) {
       printf("Got here.\n");
       mDrawerCachedFrame = NO;
       NSRect frame = [[self window] frame];
       if (frame.origin.x == mCachedFrameAfterDrawerOpen.origin.x &&
           frame.origin.y == mCachedFrameAfterDrawerOpen.origin.y &&
           frame.size.width == mCachedFrameAfterDrawerOpen.size.width &&
           frame.size.height == mCachedFrameAfterDrawerOpen.size.height) {
         printf("Got here too.\n");
         printf("Xes are %d %d\n", frame.origin.x, mCachedFrameAfterDrawerOpen.origin.x);
         printf("Widths are %d %d\n", frame.size.width, mCachedFrameAfterDrawerOpen.size.width);
         // Restore the original frame.
         [[self window] setFrame: mCachedFrameBeforeDrawerOpen display: YES];
       }
     }
 }  }
   
 - (void)setupToolbar  - (void)setupToolbar
Line 442  static NSString *PrintToolbarItemIdentif Line 486  static NSString *PrintToolbarItemIdentif
           
     if ( ([mSidebarDrawer state] == NSDrawerClosedState) || ([mSidebarDrawer state] == NSDrawerClosingState) )  {      if ( ([mSidebarDrawer state] == NSDrawerClosedState) || ([mSidebarDrawer state] == NSDrawerClosingState) )  {
         // XXXHack to bypass sidebar crashes.          // XXXHack to bypass sidebar crashes.
        [mSidebarDrawer open];        [mSidebarDrawer openOnEdge: NSMaxXEdge];
     } else {      } else {
         [mSidebarDrawer close];          [mSidebarDrawer close];
     }      }

Removed from v.1.56  
changed lines
  Added in v.1.57


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