]> git.sesse.net Git - vlc/commitdiff
fixed the incorrect window size limits for the interface window
authorStephan Assmus <stippi@videolan.org>
Thu, 15 Apr 2004 10:46:11 +0000 (10:46 +0000)
committerStephan Assmus <stippi@videolan.org>
Thu, 15 Apr 2004 10:46:11 +0000 (10:46 +0000)
modules/gui/beos/InterfaceWindow.cpp
modules/gui/beos/MediaControlView.cpp

index 7963152fbeae0b6c6f72796493b2d1ed316cf43d..cc1250e54a7a0d368f78fcda9e3282c43d16c823 100644 (file)
@@ -8,7 +8,7 @@
  *          Samuel Hocevar <sam@zoy.org>
  *          Tony Castley <tony@castley.net>
  *          Richard Shepherd <richard@rshepherd.demon.co.uk>
- *          Stephan Aßmus <stippi@yellowbites.com>
+ *          Stephan Aßmus <superstippi@gmx.de>
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -156,7 +156,7 @@ collect_folder_contents( BDirectory& dir, BList& list, bool& deep, bool& asked,
                                // ask user if we should parse sub-folders as well
                                BAlert* alert = new BAlert( "sub-folders?",
                                                                                        _("Open files from all sub-folders as well?"),
-                                                                                       _("No"), _("Yes"), NULL, B_WIDTH_AS_USUAL,
+                                                                                       _("Cancel"), _("Open"), NULL, B_WIDTH_AS_USUAL,
                                                                                        B_IDEA_ALERT );
                                int32 buttonIndex = alert->Go();
                                deep = buttonIndex == 1;
@@ -232,7 +232,6 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char* name,
 
     p_mediaControl->MoveTo( fMenuBar->Bounds().LeftBottom() + BPoint(0.0, 1.0) );
     AddChild( fMenuBar );
-    AddChild( p_mediaControl );
 
     // Add the file Menu
     BMenu* fileMenu = new BMenu( _("File") );
@@ -309,6 +308,11 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char* name,
                                        new BMessage( OPEN_PREFERENCES ), 'S' ) );
     fMenuBar->AddItem( fShowMenu );
 
+       // add the media control view after the menubar is complete
+       // because it will set the window size limits in AttachedToWindow()
+       // and the menubar needs to report the correct PreferredSize()
+    AddChild( p_mediaControl );
+
     /* Prepare fow showing */
     _SetMenusEnabled( false );
     p_mediaControl->SetEnabled( false );
index 481c59b5ac432770fe638f8602390f6d4df99785..faf901389360e8515fda38b0dfc1fb5800cfe937 100644 (file)
@@ -2,7 +2,7 @@
  * MediaControlView.cpp: beos interface
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: MediaControlView.cpp,v 1.21 2003/12/28 01:49:12 titer Exp $
+ * $Id$
  *
  * Authors: Tony Castley <tony@castley.net>
  *          Stephan Aßmus <stippi@yellowbites.com>
@@ -203,8 +203,18 @@ MediaControlView::AttachedToWindow()
        fVolumeSlider->SetTarget(Window());
 
        BRect r(_MinFrame());
-       if (BMenuBar* menuBar = Window()->KeyMenuBar())
-               r.bottom += menuBar->Bounds().Height();
+       if (BMenuBar* menuBar = Window()->KeyMenuBar()) {
+               float width, height;
+               menuBar->GetPreferredSize(&width, &height);
+//             r.bottom += menuBar->Bounds().Height();
+               r.bottom += height;
+               // see that our calculated minimal width is not smaller than what
+               // the menubar can be
+printf("preferred: width: %f, height: %f - width: %f\n", width, height, r.Width());
+               width -= r.Width();
+               if (width > 0.0)
+                       r.right += width;
+       }
 
        Window()->SetSizeLimits(r.Width(), r.Width() * 1.8, r.Height(), r.Height() * 1.3);
        if (!Window()->Bounds().Contains(r))