]> git.sesse.net Git - vlc/blobdiff - modules/gui/wince/subtitles.cpp
Removes trailing spaces. Removes tabs.
[vlc] / modules / gui / wince / subtitles.cpp
index 5013f008fc114136e558fd516e367c58e7a54617..7a38c56b2d8ae31e7064945bfe652151e71a81a0 100644 (file)
@@ -1,7 +1,7 @@
 /*****************************************************************************
  * subtitles.cpp : WinCE gui plugin for VLC
  *****************************************************************************
- * Copyright (C) 2000-2001 VideoLAN
+ * Copyright (C) 2000-2001 the VideoLAN team
  * $Id$
  *
  * Authors: Marodon Cedric <cedric_marodon@yahoo.fr>
  *
  * You should have received a copy of the GNU General Public License
  * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston MA 02110-1301, USA.
  *****************************************************************************/
 
 /*****************************************************************************
  * Preamble
  *****************************************************************************/
-#include <stdlib.h>                                      /* malloc(), free() */
-#include <string.h>                                            /* strerror() */
-#include <stdio.h>
 #include <vlc/vlc.h>
-#include <vlc/intf.h>
+#include <vlc_interface.h>
 
 #include "wince.h"
 
 /*****************************************************************************
  * Constructor.
  *****************************************************************************/
-SubsFileDialog::SubsFileDialog( intf_thread_t *_p_intf, HINSTANCE _hInst )
+SubsFileDialog::SubsFileDialog( intf_thread_t *p_intf, CBaseWindow *p_parent,
+                                HINSTANCE h_inst )
+  :  CBaseWindow( p_intf, p_parent, h_inst )
 {
-    /* Initializations */
-    p_intf = _p_intf;
-    hInst = _hInst;
 }
 
 /***********************************************************************
 
-FUNCTION: 
+FUNCTION:
   WndProc
 
-PURPOSE: 
+PURPOSE:
   Processes messages sent to the main window.
-  
 ***********************************************************************/
 LRESULT SubsFileDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
 {
@@ -223,6 +219,10 @@ LRESULT SubsFileDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
         EndDialog( hwnd, LOWORD( wp ) );
         break;
 
+    case WM_SETFOCUS:
+        SHFullScreen( hwnd, SHFS_SHOWSIPBUTTON );
+        break;
+
     case WM_COMMAND:
         if ( LOWORD(wp) == IDOK )
         {
@@ -260,7 +260,7 @@ LRESULT SubsFileDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
             {
                 SHFullScreen( GetForegroundWindow(), SHFS_HIDESIPBUTTON );
                 OnFileBrowse();
-            } 
+            }
         }
         break;
 
@@ -278,38 +278,30 @@ LRESULT SubsFileDialog::WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp )
 /*****************************************************************************
  * Events methods.
  *****************************************************************************/
-void SubsFileDialog::OnFileBrowse()
+static void OnOpenCB( intf_dialog_args_t *p_arg )
 {
-    OPENFILENAME ofn;
-    TCHAR DateiName[80+1] = _T("\0");
-    static TCHAR szFilter[] = _T("All (*.*)\0*.*\0");
-
-    memset(&ofn, 0, sizeof(OPENFILENAME));
-    ofn.lStructSize = sizeof (OPENFILENAME);
-    ofn.hwndOwner = NULL;
-    ofn.hInstance = hInst;
-    ofn.lpstrFilter = szFilter;
-    ofn.lpstrCustomFilter = NULL;
-    ofn.nMaxCustFilter = 0;
-    ofn.nFilterIndex = 1;
-    ofn.lpstrFile = (LPTSTR) DateiName;
-    ofn.nMaxFile = 80;
-    ofn.lpstrFileTitle = NULL;
-    ofn.nMaxFileTitle = 40;
-    ofn.lpstrInitialDir = NULL;
-    ofn.lpstrTitle = _T("Open File");
-    ofn.Flags = 0;
-    ofn.nFileOffset = 0;
-    ofn.nFileExtension = 0;
-    ofn.lpstrDefExt = NULL;
-    ofn.lCustData = 0L;
-    ofn.lpfnHook = NULL;
-    ofn.lpTemplateName = NULL;
-    if( GetOpenFileName((LPOPENFILENAME) &ofn) )
+    SubsFileDialog *p_this = (SubsFileDialog *)p_arg->p_arg;
+
+    if( p_arg->i_results && p_arg->psz_results[0] )
     {
-        SetWindowText( file_combo, ofn.lpstrFile );
-        ComboBox_AddString( file_combo, ofn.lpstrFile );
-        if( ComboBox_GetCount( file_combo ) > 10 )
-            ComboBox_DeleteString( file_combo, 0 );
+        SetWindowText( p_this->file_combo, _FROMMB(p_arg->psz_results[0]) );
+        ComboBox_AddString( p_this->file_combo,
+                            _FROMMB(p_arg->psz_results[0]) );
+        if( ComboBox_GetCount( p_this->file_combo ) > 10 )
+            ComboBox_DeleteString( p_this->file_combo, 0 );
     }
 }
+
+void SubsFileDialog::OnFileBrowse()
+{
+    intf_dialog_args_t *p_arg =
+        (intf_dialog_args_t *)malloc( sizeof(intf_dialog_args_t) );
+    memset( p_arg, 0, sizeof(intf_dialog_args_t) );
+
+    p_arg->psz_title = strdup( "Open file" );
+    p_arg->psz_extensions = strdup( "All|*.*" );
+    p_arg->p_arg = this;
+    p_arg->pf_callback = OnOpenCB;
+
+    p_intf->p_sys->pf_show_dialog( p_intf, INTF_DIALOG_FILE_GENERIC, 0, p_arg);
+}