]> git.sesse.net Git - vlc/blobdiff - modules/gui/wxwindows/wxwindows.cpp
expand info categories by default
[vlc] / modules / gui / wxwindows / wxwindows.cpp
index ec94bc8310223d2877d1592db7c60f411e8547da..a6a5bcf4c46a6f32a6ff0696f12f85ad96c0ca12 100644 (file)
@@ -2,7 +2,7 @@
  * wxwindows.cpp : wxWindows plugin for vlc
  *****************************************************************************
  * Copyright (C) 2000-2001 VideoLAN
- * $Id: wxwindows.cpp,v 1.3 2002/11/20 15:58:15 gbazin Exp $
+ * $Id: wxwindows.cpp,v 1.14 2003/03/30 13:23:28 gbazin Exp $
  *
  * Authors: Gildas Bazin <gbazin@netcourrier.com>
  *
@@ -10,7 +10,7 @@
  * it under the terms of the GNU General Public License as published by
  * the Free Software Foundation; either version 2 of the License, or
  * (at your option) any later version.
- * 
+ *
  * This program is distributed in the hope that it will be useful,
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 #include <stdio.h>
 
 #include <vlc/vlc.h>
-#include <vlc/intf.h>
-
-/* Let wxWindows take care of the i18n stuff */
-#undef _
 
 #ifdef WIN32                                                 /* mingw32 hack */
 #undef Yield
 #undef CreateDialog
 #endif
 
+/* Let vlc take care of the i18n stuff */
+#define WXINTL_NO_GETTEXT_MACRO
+
 #include <wx/wxprec.h>
 #include <wx/wx.h>
-#include <wx/imagpng.h>
+
+#include <vlc/intf.h>
 
 #include "wxwindows.h"
 
+/* Temporary hack */
+#ifdef __DARWIN__
+int wxEntry( int argc, char *argv[] , bool enterLoop = TRUE );
+#endif
+
 /*****************************************************************************
  * Local prototypes.
  *****************************************************************************/
@@ -67,16 +72,19 @@ public:
 
 private:
     intf_thread_t *p_intf;
+    wxLocale locale;                                /* locale we'll be using */
 };
 
 /*****************************************************************************
  * Module descriptor
  *****************************************************************************/
 vlc_module_begin();
-    add_category_hint( N_("wxWindows"), NULL );
     set_description( (char *) _("wxWindows interface module") );
     set_capability( "interface", 50 );
     set_callbacks( Open, Close );
+    add_shortcut( "wxwindows" );
+    add_shortcut( "wxwin" );
+    add_shortcut( "wx" );
     set_program( "wxvlc" );
 vlc_module_end();
 
@@ -110,7 +118,7 @@ static int Open( vlc_object_t *p_this )
     p_intf->p_sys->b_slider_free = 1;
     p_intf->p_sys->i_slider_pos = p_intf->p_sys->i_slider_oldpos = 0;
 
-    p_intf->p_sys->i_part = -1;
+    p_intf->p_sys->i_part = 0;
 
     return VLC_SUCCESS;
 }
@@ -136,15 +144,31 @@ static void Close( vlc_object_t *p_this )
 /*****************************************************************************
  * Run: wxWindows thread
  *****************************************************************************/
+#if !defined(__BUILTIN__) && defined( WIN32 )
+HINSTANCE hInstance = 0;
+extern "C" BOOL WINAPI
+DllMain (HANDLE hModule, DWORD fdwReason, LPVOID lpReserved)
+{
+    hInstance = (HINSTANCE)hModule;
+    return TRUE;
+}
+#endif
+
 static void Run( intf_thread_t *p_intf )
 {
+#if !defined( WIN32 )
     static char  *p_args[] = { "" };
+#endif
 
     /* Hack to pass the p_intf pointer to the new wxWindow Instance object */
     wxTheApp = new Instance( p_intf );
 
 #if defined( WIN32 )
+#if !defined(__BUILTIN__)
+    wxEntry( hInstance/*GetModuleHandle(NULL)*/, NULL, NULL, SW_SHOW, TRUE );
+#else
     wxEntry( GetModuleHandle(NULL), NULL, NULL, SW_SHOW, TRUE );
+#endif
 #else
     wxEntry( 1, p_args );
 #endif
@@ -175,15 +199,26 @@ IMPLEMENT_APP_NO_MAIN(Instance)
  *****************************************************************************/
 bool Instance::OnInit()
 {
+    /* Initialization of i18n stuff.
+     * Usefull for things we don't have any control over, like wxWindows
+     * provided facilities (eg. open file dialog) */
+    locale.Init( wxLANGUAGE_DEFAULT );
+
     /* Make an instance of your derived frame. Passing NULL (the default value
      * of Frame's constructor is NULL) as the frame doesn't have a frame
      * since it is the first window */
     Interface *MainInterface = new Interface( p_intf );
 
+    /* Create the playlist window */
+    p_intf->p_sys->p_playlist_window = new Playlist( p_intf, MainInterface );
+
+    /* Create the log window */
+    p_intf->p_sys->p_messages_window = new Messages( p_intf, MainInterface );
+
     /* Show the interface */
-    MainInterface->Show(TRUE);
+    MainInterface->Show( TRUE );
 
-    SetTopWindow(MainInterface);
+    SetTopWindow( MainInterface );
 
     /* Start timer */
     new Timer( p_intf, MainInterface );