]> git.sesse.net Git - vlc/commitdiff
Implemented correct scaling and used new window size variables.
authorTony Castley <tcastley@videolan.org>
Fri, 22 Mar 2002 13:16:35 +0000 (13:16 +0000)
committerTony Castley <tcastley@videolan.org>
Fri, 22 Mar 2002 13:16:35 +0000 (13:16 +0000)
Beta always on top for the interface window.  New cursor handling.

plugins/beos/InterfaceWindow.cpp
plugins/beos/InterfaceWindow.h
plugins/beos/MsgVals.h
plugins/beos/VideoWindow.h
plugins/beos/vout_beos.cpp

index bf4d064f0bdaa1f08a2d88bcac6568ccd0a295d3..43dc765c48e451fba215c9b7d6a9c274e7150d60 100644 (file)
@@ -2,7 +2,7 @@
  * InterfaceWindow.cpp: beos interface
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: InterfaceWindow.cpp,v 1.12 2002/02/08 15:57:29 sam Exp $
+ * $Id: InterfaceWindow.cpp,v 1.13 2002/03/22 13:16:35 tcastley Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -84,6 +84,7 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
     BMenu *mAudio;
     CDMenu *cd_menu;
     BMenu *mNavigation;
+    BMenu *mConfig;
     
     /* Add the file Menu */
     BMenuItem *mItem;
@@ -124,6 +125,12 @@ InterfaceWindow::InterfaceWindow( BRect frame, const char *name,
     mNavigation->AddItem( new BMenuItem( "Next Chapter",
                                         new BMessage(NEXT_CHAPTER)) );
                                         
+    /* Add the Config menu */
+    menu_bar->AddItem( mConfig = new BMenu( "Config" ) );
+    menu_bar->ResizeToPreferred();
+    mConfig->AddItem( miOnTop = new BMenuItem( "Always on Top",
+                                        new BMessage(TOGGLE_ON_TOP)) );
+    miOnTop->SetMarked(false);                                    
 
     ResizeTo(260,50 + menu_bar->Bounds().IntegerHeight()+1);
     controlRect = Bounds();
@@ -169,6 +176,20 @@ void InterfaceWindow::MessageReceived( BMessage * p_message )
         alert->Go();
         break;
 
+    case TOGGLE_ON_TOP:
+        miOnTop->SetMarked(! miOnTop->IsMarked() );
+        if ( miOnTop->IsMarked() )
+        {
+            SetFeel(B_FLOATING_APP_WINDOW_FEEL);
+            SetWorkspaces(B_CURRENT_WORKSPACE); 
+        }
+        else
+        {
+            SetFeel(B_NORMAL_WINDOW_FEEL);
+            SetWorkspaces(B_CURRENT_WORKSPACE); 
+        }
+        break;
+        
     case OPEN_FILE:
         if( file_panel )
         {
index 9dcba51d68fbabe6f9700be78fbf12558d66a036..d31d3cfa494968fdac1bc4185d7cf2d260a36730 100644 (file)
@@ -2,7 +2,7 @@
  * InterfaceWindow.h: BeOS interface window class prototype
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: InterfaceWindow.h,v 1.11 2001/06/15 09:07:10 tcastley Exp $
+ * $Id: InterfaceWindow.h,v 1.12 2002/03/22 13:16:35 tcastley Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Tony Castley <tcastley@mail.powerup.com.au>
@@ -65,6 +65,7 @@ private:
     intf_thread_t  *p_intf;
     bool            b_empty_playlist;
        BFilePanel *file_panel;
+    BMenuItem      *miOnTop;
        es_descriptor_t *  p_audio_es;
     es_descriptor_t *  p_spu_es;
 
index 46fbdc68fde0bff6f9ac634acc1d02fab8766040..a611a62dfe6203f1859cb1540007bf868e3bdae4 100644 (file)
@@ -2,7 +2,7 @@
  * MsgVals.h
  *****************************************************************************
  * Copyright (C) 2001 VideoLAN
- * $Id: MsgVals.h,v 1.8 2002/01/04 14:01:34 sam Exp $
+ * $Id: MsgVals.h,v 1.9 2002/03/22 13:16:35 tcastley Exp $
  *
  * Authors: Tony Castley <tcastley@mail.powerup.com.au>
  *
@@ -42,3 +42,5 @@ const uint32 PREV_TITLE     = 'PRTI';
 const uint32 NEXT_TITLE     = 'NXTI';
 const uint32 PREV_CHAPTER   = 'PRCH';
 const uint32 NEXT_CHAPTER   = 'NXCH';
+const uint32 TOGGLE_ON_TOP  = 'ONTP';
+
index d26d19570646445e122ffd027205ff319ba7c4f2..7b4fa6395d94aa5694901b864315464e640df75a 100644 (file)
@@ -2,7 +2,7 @@
  * VideoWindow.h: BeOS video window class prototype
  *****************************************************************************
  * Copyright (C) 1999, 2000, 2001 VideoLAN
- * $Id: VideoWindow.h,v 1.12 2002/03/20 10:33:42 tcastley Exp $
+ * $Id: VideoWindow.h,v 1.13 2002/03/22 13:16:35 tcastley Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Tony Castley <tcastley@mail.powerup.com.au>
@@ -42,8 +42,8 @@ class VideoWindow
 {
 public:
     // standard constructor and destructor
-    VideoWindow( int width, int height,
-                 struct vout_thread_s *p_video_output); 
+    VideoWindow( int v_width, int v_height,
+                 int w_width, int w_height); 
     ~VideoWindow();
     
     void               Zoom(BPoint origin, float width, float height);
index beb8d4b00193b5e6b9925b1432a5a7b8d2776860..cf13969aa7e419397945d21b17651e501b284b02 100644 (file)
@@ -2,7 +2,7 @@
  * vout_beos.cpp: beos video output display method
  *****************************************************************************
  * Copyright (C) 2000, 2001 VideoLAN
- * $Id: vout_beos.cpp,v 1.47 2002/03/20 10:33:42 tcastley Exp $
+ * $Id: vout_beos.cpp,v 1.48 2002/03/22 13:16:35 tcastley Exp $
  *
  * Authors: Jean-Marc Dressler <polux@via.ecp.fr>
  *          Samuel Hocevar <sam@zoy.org>
@@ -225,19 +225,20 @@ void directWindow::drawBuffer(int bufferIndex)
 /*****************************************************************************
  * VideoWindow constructor and destructor
  *****************************************************************************/
-VideoWindow::VideoWindow( int width, int height, 
-                          vout_thread_t *p_video_output )
+VideoWindow::VideoWindow( int v_width, int v_height, 
+                          int w_width, int w_height )
 {
+    // need to centre the window on the screeen.
     if ( BDirectWindow::SupportsWindowMode() )
     { 
-        voutWindow = new directWindow( BRect( 80, 50, 
-                                          80 + width, 50 + height ), this );
+        voutWindow = new directWindow( BRect( 20, 50, 
+                                              20 + w_width, 50 + w_height ), this );
         mode = DIRECT;
     }
     else
     {
-        voutWindow = new bitmapWindow( BRect( 80, 50, 
-                                          80 + width, 50 + height ), this );
+        voutWindow = new bitmapWindow( BRect( 20, 50, 
+                                              20 + w_width, 50 + w_height ), this );
         mode = BITMAP;
     }
 
@@ -245,6 +246,7 @@ VideoWindow::VideoWindow( int width, int height,
     teardownwindow = false;
     is_zoomed = false;
     resized = true;
+
     /* call ScreenChanged to set vsync correctly */
     BScreen *screen;
     screen = new BScreen(voutWindow);
@@ -257,23 +259,15 @@ VideoWindow::VideoWindow( int width, int height,
     
     /* Bitmap mode overlay not available, set the system to 32bits
      * and let BeOS do all the work */
-    bitmap[0] = new BBitmap( voutWindow->Bounds(), B_RGB32);
-    bitmap[1] = new BBitmap( voutWindow->Bounds(), B_RGB32);
+    bitmap[0] = new BBitmap( BRect( 0, 0, v_width, v_height ), B_RGB32);
+    bitmap[1] = new BBitmap( BRect( 0, 0, v_width, v_height ), B_RGB32);
     memset(bitmap[0]->Bits(), 0, bitmap[0]->BitsLength());
     memset(bitmap[1]->Bits(), 0, bitmap[1]->BitsLength());
 
-    i_width = bitmap[0]->Bounds().IntegerWidth();
-    i_height = bitmap[0]->Bounds().IntegerHeight();
-    
-    winSize = voutWindow->Frame();
-    out_top = 0;
-    out_left = 0;
-    out_height = winSize.Height();
-    out_width = winSize.Width();
-    width_scale = out_width / i_width;
-    height_scale = out_height / i_height;
-
-
+    // remember current settings
+    i_width = w_width;
+    i_height = w_height;
+    FrameResized(w_width, w_height);
     voutWindow->Show();
 }
 
@@ -333,7 +327,7 @@ void VideoWindow::Zoom(BPoint origin, float width, float height )
         voutWindow->ResizeTo(rect.IntegerWidth(), rect.IntegerHeight());
         width_scale = rect.IntegerWidth() / i_width;
         height_scale = rect.IntegerHeight() / i_height;
-        be_app->HideCursor();
+        be_app->ObscureCursor();
     }
     resized = true;
 }
@@ -495,10 +489,13 @@ int vout_Init( vout_thread_t *p_vout )
     p_vout->p_sys->pp_buffer[0] = (u8*)p_vout->p_sys->p_window->bitmap[0]->Bits();
     p_vout->p_sys->pp_buffer[1] = (u8*)p_vout->p_sys->p_window->bitmap[1]->Bits();
 
-    p_vout->output.i_width  = p_vout->p_sys->i_width;
-    p_vout->output.i_height = p_vout->p_sys->i_height;
+    p_vout->output.i_width  = p_vout->render.i_width;
+    p_vout->output.i_height = p_vout->render.i_height;
+
+    /* Assume we have square pixels */
     p_vout->output.i_aspect = p_vout->p_sys->i_width
                                * VOUT_ASPECT_FACTOR / p_vout->p_sys->i_height;
+
     p_vout->output.i_chroma = FOURCC_RV32;
 
     p_vout->output.i_rmask  = 0x00ff0000;
@@ -606,9 +603,11 @@ void vout_Display( vout_thread_t *p_vout, picture_t *p_pic )
  *****************************************************************************/
 static int BeosOpenDisplay( vout_thread_t *p_vout )
 { 
+
     p_vout->p_sys->p_window = new VideoWindow( p_vout->p_sys->i_width - 1,
                                                p_vout->p_sys->i_height - 1,
-                                               p_vout );
+                                               p_vout->i_window_width,
+                                               p_vout->i_window_height);
 
     if( p_vout->p_sys->p_window == NULL )
     {