]> git.sesse.net Git - vlc/commitdiff
* modules/gui/wince: bunch of fixes.
authorGildas Bazin <gbazin@videolan.org>
Wed, 6 Apr 2005 08:27:13 +0000 (08:27 +0000)
committerGildas Bazin <gbazin@videolan.org>
Wed, 6 Apr 2005 08:27:13 +0000 (08:27 +0000)
modules/gui/wince/dialogs.cpp
modules/gui/wince/interface.cpp
modules/gui/wince/menus.cpp
modules/gui/wince/timer.cpp
modules/gui/wince/wince.cpp
modules/gui/wince/wince.h

index f8215b2a861bab1594dd7939f9c89f42915a368f..5c49287d066e3939653766231289c875e81692bb 100644 (file)
@@ -55,6 +55,7 @@ private:
     void OnMessages( void );
     void OnFileInfo( void );
     void OnPreferences( void );
+    void OnPopupMenu( void );
 
     void OnOpen( int, int );
     void OnOpenFileSimple( int );
@@ -137,6 +138,7 @@ LRESULT DialogsProvider::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
     case WM_APP + INTF_DIALOG_MESSAGES: OnMessages(); return TRUE;
     case WM_APP + INTF_DIALOG_FILEINFO: OnFileInfo(); return TRUE;
     case WM_APP + INTF_DIALOG_PREFS: OnPreferences(); return TRUE;
+    case WM_APP + INTF_DIALOG_POPUPMENU: OnPopupMenu(); return TRUE;
     }
 
     return DefWindowProc( hwnd, msg, wp, lp );
@@ -154,6 +156,12 @@ void DialogsProvider::OnIdle( void )
     if( p_fileinfo_dialog ) p_fileinfo_dialog->UpdateFileInfo();
 }
 
+void DialogsProvider::OnPopupMenu( void )
+{
+    POINT point = {0};
+    PopupMenu( p_intf, hWnd, point );
+}
+
 void DialogsProvider::OnPlaylist( void )
 {
 #if 1
index 1ac446b28c3d1c66648081cf5a185dcb7045f217..7fffb61ff30ad7ad88ac7901bc74936b84bfbf0e 100644 (file)
@@ -102,8 +102,10 @@ TCHAR * szToolTips[] =
 /*****************************************************************************
  * Constructor.
  *****************************************************************************/
-Interface::Interface()
-  : hwndMain(0), hwndCB(0), hwndTB(0), hwndSlider(0), hwndLabel(0),
+Interface::Interface( intf_thread_t *p_intf, CBaseWindow *p_parent,
+                      HINSTANCE h_inst )
+  : CBaseWindow( p_intf, p_parent, h_inst ),
+    hwndMain(0), hwndCB(0), hwndTB(0), hwndSlider(0), hwndLabel(0),
     hwndVol(0), hwndSB(0), timer(0), video(0), b_volume_hold(0)
 {
 }
@@ -114,14 +116,11 @@ Interface::~Interface()
     if( video ) delete video;
 }
 
-BOOL Interface::InitInstance( HINSTANCE hInstance, intf_thread_t *_p_intf )
+BOOL Interface::InitInstance()
 {
     /* Initializations */
-    p_intf = _p_intf;
     i_old_playing_status = PAUSE_S;
 
-    hInst = hInstance; // Store instance handle in our global variable
-
     int i_style = WS_VISIBLE;
 
 #ifndef UNDER_CE
@@ -132,7 +131,7 @@ BOOL Interface::InitInstance( HINSTANCE hInstance, intf_thread_t *_p_intf )
     hwndMain =
         CreateWindow( _T("VLC WinCE"), _T("VLC media player"), i_style,
                       0, MENU_HEIGHT, CW_USEDEFAULT, CW_USEDEFAULT,
-                      NULL, NULL, hInstance, (void *)this );
+                      NULL, NULL, GetInstance(), (void *)this );
 
     if( !hwndMain ) return FALSE;
 
index bf35516489142653cad4bd82665a68f734413225..1fb33f4549d412861bf017f1eb3817d63b9adcd5 100644 (file)
@@ -724,6 +724,7 @@ void OnMenuEvent( intf_thread_t *p_intf, int id )
     MenuItemExt *p_menuitemext = NULL;
     vector<MenuItemExt*>::iterator iter;
 
+    if( p_intf->p_sys->p_settings_menu )
     for( iter = p_intf->p_sys->p_settings_menu->begin();
          iter != p_intf->p_sys->p_settings_menu->end(); iter++ )
         if( (*iter)->id == id )
@@ -731,6 +732,8 @@ void OnMenuEvent( intf_thread_t *p_intf, int id )
             p_menuitemext = *iter;
             break;
         }
+
+    if( p_intf->p_sys->p_audio_menu && !p_menuitemext )
     for( iter = p_intf->p_sys->p_audio_menu->begin();
          iter != p_intf->p_sys->p_audio_menu->end(); iter++ ) 
         if( (*iter)->id == id )
@@ -738,6 +741,8 @@ void OnMenuEvent( intf_thread_t *p_intf, int id )
             p_menuitemext = *iter;
             break;
         }
+
+    if( p_intf->p_sys->p_video_menu && !p_menuitemext )
     for( iter = p_intf->p_sys->p_video_menu->begin();
          iter != p_intf->p_sys->p_video_menu->end(); iter++ )
         if( (*iter)->id == id )
@@ -745,6 +750,8 @@ void OnMenuEvent( intf_thread_t *p_intf, int id )
             p_menuitemext = *iter;
             break;
         }
+
+    if( p_intf->p_sys->p_navig_menu && !p_menuitemext )
     for( iter = p_intf->p_sys->p_navig_menu->begin();
          iter != p_intf->p_sys->p_navig_menu->end(); iter++ )
         if( (*iter)->id == id )
index d7bd859a8aafe1aa637149c2cb92828edbf7442f..39892a26a1d6f0adc9565b780026aa6aee11023f 100644 (file)
@@ -238,9 +238,12 @@ static int PopupMenuCB( vlc_object_t *p_this, const char *psz_variable,
                         vlc_value_t old_val, vlc_value_t new_val, void *param )
 {
     intf_thread_t *p_intf = (intf_thread_t *)param;
-    POINT point = {0};
 
-    PopupMenu( p_intf, p_intf->p_sys->p_main_window->hWnd, point );
+    if( p_intf->p_sys->pf_show_dialog )
+    {
+        p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_POPUPMENU,
+                                       new_val.b_bool, 0 );
+    }
 
     return VLC_SUCCESS;
 }
index 3985211d78337c066c1ea7c2bec91cb638bb52b6..4f8b5cf22be0dd76405d9c44319d2c49ac44585d 100644 (file)
@@ -207,9 +207,8 @@ static void Run( intf_thread_t *p_intf )
 static void MainLoop( intf_thread_t *p_intf )
 {
     MSG msg;
-    Interface intf;
+    Interface *intf = 0;
 
-    p_intf->p_sys->p_main_window = &intf;
     if( !hInstance ) hInstance = GetModuleHandle(NULL);
 
     // Register window class
@@ -234,17 +233,10 @@ static void MainLoop( intf_thread_t *p_intf )
     if( !p_intf->pf_show_dialog )
     {
         /* The module is used in interface mode */
-        p_intf->p_sys->p_window = &intf;
+        p_intf->p_sys->p_window = intf = new Interface( p_intf, 0, hInstance );
 
         /* Create/Show the interface */
-        if( !intf.InitInstance( hInstance, p_intf ) )
-        {
-#ifndef UNDER_CE
-            /* Uninitialize OLE/COM */
-            CoUninitialize();
-#endif
-            return;
-        }
+        if( !intf->InitInstance() ) goto end;
     }
 
     /* Creates the dialogs provider */
@@ -277,6 +269,9 @@ static void MainLoop( intf_thread_t *p_intf )
         DispatchMessage( &msg );
     }
 
+ end:
+    if( intf ) delete intf;
+
 #ifndef UNDER_CE
     /* Uninitialize OLE/COM */
     CoUninitialize();
index f9bef247b3cff38fd2941c11c64fbb46b0206546..b17b2881b585235618b45a377640c986c2053d01 100644 (file)
@@ -79,8 +79,6 @@ struct intf_sys_t
     void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
                              intf_dialog_args_t *p_arg );
 
-    CBaseWindow *p_main_window;
-
     /* Dynamic Menu management */
     vector<MenuItemExt*> *p_audio_menu;
     vector<MenuItemExt*> *p_video_menu;
@@ -139,10 +137,10 @@ class Interface : public CBaseWindow
 {
 public:
     /* Constructor */
-    Interface();
+    Interface( intf_thread_t *, CBaseWindow *, HINSTANCE );
     ~Interface();
 
-    BOOL InitInstance( HINSTANCE, intf_thread_t * );
+    BOOL InitInstance();
 
     HWND CreateMenuBar( HWND, HINSTANCE );
     void TogglePlayButton( int i_playing_status );