00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #ifndef WINCE_RESOURCE
00026
00027 #define SLIDER_HEIGHT 50
00028 #define SLIDER_MAX_POS 10000
00029 #define MENU_HEIGHT 26
00030
00031 #define FILE_ACCESS 1
00032 #define NET_ACCESS 2
00033
00034 #define OPEN_NORMAL 0
00035 #define OPEN_STREAM 1
00036
00037 #if defined( UNDER_CE ) && defined(__MINGW32__)
00038
00039 # define _off_t long
00040 #endif
00041
00042 #include "vlc_keys.h"
00043
00044 #include <stdio.h>
00045 #include <string>
00046 #include <vector>
00047 using namespace std;
00048
00049 class CBaseWindow;
00050 class MenuItemExt;
00051 class VideoWindow;
00052
00053
00054
00055
00056 struct intf_sys_t
00057 {
00058
00059 CBaseWindow *p_window;
00060
00061
00062 vlc_bool_t b_playing;
00063
00064
00065 input_thread_t * p_input;
00066
00067
00068 int i_slider_pos;
00069 int i_slider_oldpos;
00070 vlc_bool_t b_slider_free;
00071
00072
00073 msg_subscription_t* p_sub;
00074
00075
00076 int i_playing;
00077
00078
00079 void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
00080 intf_dialog_args_t *p_arg );
00081
00082
00083 vector<MenuItemExt*> *p_audio_menu;
00084 vector<MenuItemExt*> *p_video_menu;
00085 vector<MenuItemExt*> *p_navig_menu;
00086 vector<MenuItemExt*> *p_settings_menu;
00087
00088 VideoWindow *p_video_window;
00089 };
00090
00091
00092
00093
00094
00095 class CBaseWindow
00096 {
00097 public:
00098 CBaseWindow( intf_thread_t *_p_intf = 0, CBaseWindow *_p_parent = 0,
00099 HINSTANCE _hInst = 0 )
00100 : hWnd(0), hInst(_hInst), p_parent(_p_parent), p_intf(_p_intf) {};
00101 virtual ~CBaseWindow() {};
00102
00103 HWND hWnd;
00104
00105 static LRESULT CALLBACK BaseWndProc( HWND, UINT, WPARAM, LPARAM );
00106 static int CreateDialogBox( HWND, CBaseWindow * );
00107
00108 HWND GetHandle() { return hWnd; }
00109 BOOL Show( BOOL b_show ) { return (hWnd && ShowWindow(hWnd, b_show)); }
00110 BOOL IsShown( void ) { return (hWnd && IsWindowVisible(hWnd)); }
00111
00112 protected:
00113
00114 HINSTANCE hInst;
00115 HWND hwndCB;
00116
00117 HINSTANCE GetInstance () const { return hInst; }
00118 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM ) { return 0; };
00119
00120 CBaseWindow *p_parent;
00121 intf_thread_t *p_intf;
00122 };
00123
00124 class FileInfo;
00125 class Messages;
00126 class Playlist;
00127 class Timer;
00128 class OpenDialog;
00129 class PrefsDialog;
00130
00131 CBaseWindow *CreateDialogsProvider( intf_thread_t *, CBaseWindow *, HINSTANCE);
00132 CBaseWindow *CreateVideoWindow( intf_thread_t *, HWND );
00133 void PopupMenu( intf_thread_t *, HWND, POINT );
00134
00135
00136 class Interface : public CBaseWindow
00137 {
00138 public:
00139
00140 Interface( intf_thread_t *, CBaseWindow *, HINSTANCE );
00141 ~Interface();
00142
00143 BOOL InitInstance();
00144
00145 HWND CreateMenuBar( HWND, HINSTANCE );
00146 void TogglePlayButton( int i_playing_status );
00147 void Update();
00148
00149 HWND hwndMain;
00150
00151 HWND hwndCB;
00152 HWND hwndTB;
00153 HWND hwndSlider;
00154 HWND hwndLabel;
00155 HWND hwndVol;
00156 HWND hwndSB;
00157 HMENU hPopUpMenu;
00158 HMENU hMenu;
00159
00160 Timer *timer;
00161 CBaseWindow *video;
00162
00163 protected:
00164
00165 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
00166
00167 void OnShowDialog( int );
00168
00169 void OnPlayStream( void );
00170 void OnStopStream( void );
00171 void OnPrevStream( void );
00172 void OnNextStream( void );
00173 void OnSlowStream( void );
00174 void OnFastStream( void );
00175
00176 void OnVideoOnTop( void );
00177 void OnSliderUpdate( int wp );
00178 void OnChange( int wp );
00179 void VolumeChange( int i_volume );
00180 void VolumeUpdate( void );
00181
00182 int i_old_playing_status;
00183
00184 private:
00185 HMENU menu_settings;
00186 HMENU menu_video;
00187 HMENU menu_audio;
00188 HMENU menu_navigation;
00189
00190 vlc_bool_t b_volume_hold;
00191 };
00192
00193
00194 class FileInfo : public CBaseWindow
00195 {
00196 public:
00197
00198 FileInfo( intf_thread_t *, CBaseWindow *, HINSTANCE );
00199 virtual ~FileInfo(){};
00200
00201 void UpdateFileInfo(void);
00202
00203 protected:
00204
00205 HWND hwnd_fileinfo;
00206 HWND hwndTV;
00207
00208 TCHAR szFileInfoClassName[100];
00209 TCHAR szFileInfoTitle[100];
00210
00211 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
00212 BOOL CreateTreeView( HWND );
00213 };
00214
00215
00216 class Messages : public CBaseWindow
00217 {
00218 public:
00219
00220 Messages( intf_thread_t *, CBaseWindow *, HINSTANCE );
00221 virtual ~Messages(){};
00222
00223 void UpdateLog(void);
00224
00225 protected:
00226
00227 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
00228
00229 HWND hListView;
00230 vlc_bool_t b_verbose;
00231 };
00232
00233
00234 class ItemInfoDialog : public CBaseWindow
00235 {
00236 public:
00237
00238 ItemInfoDialog( intf_thread_t *, CBaseWindow *,
00239 HINSTANCE, playlist_item_t * );
00240 virtual ~ItemInfoDialog(){};
00241
00242 protected:
00243
00244 intf_thread_t *p_intf;
00245 HWND hwndCB;
00246
00247 playlist_item_t *p_item;
00248
00249
00250 void OnOk();
00251 void UpdateInfo();
00252
00253 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
00254
00255
00256 HWND uri_label;
00257 HWND uri_text;
00258
00259 HWND name_label;
00260 HWND name_text;
00261
00262 HWND checkbox_label;
00263 HWND enabled_checkbox;
00264
00265 HWND info_tree;
00266 };
00267
00268
00269 class SubsFileDialog;
00270 class OpenDialog : public CBaseWindow
00271 {
00272 public:
00273
00274 OpenDialog( intf_thread_t *, CBaseWindow *, HINSTANCE, int, int );
00275 virtual ~OpenDialog(){};
00276
00277 void UpdateMRL();
00278 void UpdateMRL( int i_access_method );
00279
00280 HWND file_combo;
00281
00282 protected:
00283
00284 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
00285
00286 HWND mrl_box;
00287 HWND mrl_label;
00288 HWND mrl_combo;
00289 HWND label;
00290
00291 HWND notebook;
00292
00293 HWND browse_button;
00294 HWND subsfile_checkbox;
00295 HWND subsfile_label;
00296 HWND subsfile_button;
00297 SubsFileDialog *subsfile_dialog;
00298
00299 HWND net_radios[4];
00300 HWND net_label[4];
00301
00302 HWND net_port_label[4];
00303 HWND net_ports[4];
00304 HWND hUpdown[4];
00305 int i_net_ports[4];
00306
00307 HWND net_addrs_label[4];
00308 HWND net_addrs[4];
00309
00310 int i_open_arg;
00311 int i_access;
00312 int i_net_type;
00313
00314 void FilePanel( HWND hwnd );
00315 void NetPanel( HWND hwnd );
00316
00317 void OnSubsFileEnable();
00318 void OnSubsFileSettings( HWND hwnd );
00319
00320 void OnPageChange();
00321
00322 void OnFilePanelChange();
00323 void OnFileBrowse();
00324 void OnNetPanelChange( int event );
00325 void OnNetTypeChange( int event );
00326 void DisableNETCtrl();
00327
00328 void OnOk();
00329
00330 vector<string> mrl;
00331 vector<string> subsfile_mrl;
00332 };
00333
00334
00335 class SubsFileDialog: public CBaseWindow
00336 {
00337 public:
00338
00339 SubsFileDialog( intf_thread_t *, CBaseWindow *, HINSTANCE );
00340 virtual ~SubsFileDialog(){};
00341
00342 vector<string> subsfile_mrl;
00343 HWND file_combo;
00344
00345 protected:
00346 friend class OpenDialog;
00347
00348 HWND file_box;
00349 HWND browse_button;
00350
00351 HWND enc_box;
00352 HWND enc_label;
00353 HWND encoding_combo;
00354
00355 HWND misc_box;
00356 HWND delay_label;
00357 HWND delay_edit;
00358 HWND delay_spinctrl;
00359 HWND fps_label;
00360 HWND fps_edit;
00361 HWND fps_spinctrl;
00362
00363 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
00364
00365
00366 void OnFileBrowse();
00367 };
00368
00369
00370 class Playlist : public CBaseWindow
00371 {
00372 public:
00373
00374 Playlist( intf_thread_t *, CBaseWindow *, HINSTANCE );
00375 virtual ~Playlist(){};
00376
00377 void UpdatePlaylist();
00378 void ShowPlaylist( bool );
00379
00380 protected:
00381
00382 bool b_need_update;
00383 vlc_mutex_t lock;
00384
00385 int i_title_sorted;
00386 int i_author_sorted;
00387
00388 HWND hwndCB;
00389 HWND hwndTB;
00390 HWND hListView;
00391
00392 void Rebuild();
00393 void UpdateItem( int );
00394 LRESULT ProcessCustomDraw( LPARAM lParam );
00395 void HandlePopupMenu( HWND hwnd, POINT point);
00396
00397 void DeleteItem( int item );
00398
00399 void OnOpen();
00400 void OnSave();
00401
00402 void OnDeleteSelection();
00403 void OnInvertSelection();
00404 void OnEnableSelection();
00405 void OnDisableSelection();
00406 void OnSelectAll();
00407 void OnActivateItem( int i_item );
00408 void ShowInfos( HWND hwnd, int i_item );
00409
00410 void OnUp();
00411 void OnDown();
00412
00413 void OnRandom();
00414 void OnLoop();
00415 void OnRepeat();
00416
00417 void OnSort( UINT event );
00418 void OnColSelect( int iSubItem );
00419
00420 void OnPopupPlay();
00421 void OnPopupDel();
00422 void OnPopupEna();
00423 void OnPopupInfo( HWND hwnd );
00424
00425 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
00426 };
00427
00428
00429 class Timer
00430 {
00431 public:
00432
00433 Timer( intf_thread_t *p_intf, HWND hwnd, Interface *_p_main_interface );
00434 virtual ~Timer();
00435 void Notify( void );
00436
00437 private:
00438 intf_thread_t *p_intf;
00439 Interface *p_main_interface;
00440
00441 int i_old_playing_status;
00442 int i_old_rate;
00443 };
00444
00445
00446 void RefreshSettingsMenu( intf_thread_t *_p_intf, HMENU hMenu );
00447 void RefreshAudioMenu( intf_thread_t *_p_intf, HMENU hMenu );
00448 void RefreshVideoMenu( intf_thread_t *_p_intf, HMENU hMenu );
00449 void RefreshNavigMenu( intf_thread_t *_p_intf, HMENU hMenu );
00450 void RefreshMenu( intf_thread_t *, vector<MenuItemExt*> *, HMENU, int,
00451 char **, int *, int );
00452 int wce_GetMenuItemCount( HMENU );
00453 void CreateMenuItem( intf_thread_t *, vector<MenuItemExt*> *, HMENU, char *,
00454 vlc_object_t *, int * );
00455 HMENU CreateChoicesMenu( intf_thread_t *, vector<MenuItemExt*> *, char *,
00456 vlc_object_t *, int * );
00457 void OnMenuEvent( intf_thread_t *, int );
00458
00459
00460
00461
00462
00463 class MenuItemExt
00464 {
00465 public:
00466
00467 MenuItemExt( intf_thread_t *_p_intf, int _id, char *_psz_var,
00468 int _i_object_id, vlc_value_t _val, int _i_val_type );
00469
00470 virtual ~MenuItemExt();
00471
00472 static void ClearList( vector<MenuItemExt*> * );
00473
00474 int id;
00475 intf_thread_t *p_intf;
00476 char *psz_var;
00477 int i_val_type;
00478 int i_object_id;
00479 vlc_value_t val;
00480
00481 private:
00482
00483 };
00484
00485
00486
00487
00488 class PrefsTreeCtrl;
00489 class PrefsDialog: public CBaseWindow
00490 {
00491 public:
00492
00493 PrefsDialog( intf_thread_t *, CBaseWindow *, HINSTANCE );
00494 virtual ~PrefsDialog(){};
00495
00496 protected:
00497
00498
00499 void OnOk( void );
00500
00501
00502
00503
00504
00505 HWND save_button;
00506 HWND reset_button;
00507 HWND advanced_checkbox;
00508 HWND advanced_label;
00509
00510 PrefsTreeCtrl *prefs_tree;
00511
00512 virtual LRESULT WndProc( HWND, UINT, WPARAM, LPARAM );
00513 };
00514
00515
00516
00517
00518 #ifdef UNICODE
00519 extern wchar_t pwsz_mbtow_wince[2048];
00520 extern char psz_wtomb_wince[2048];
00521 static inline wchar_t *_FROMMB( const char *psz_in )
00522 {
00523 mbstowcs( pwsz_mbtow_wince, psz_in, 2048 );
00524 pwsz_mbtow_wince[2048-1] = 0;
00525 return pwsz_mbtow_wince;
00526 }
00527 static inline char *_TOMB( const wchar_t *pwsz_in )
00528 {
00529 wcstombs( psz_wtomb_wince, pwsz_in, 2048 );
00530 psz_wtomb_wince[2048-1] = 0;
00531 return psz_wtomb_wince;
00532 }
00533 #else
00534 # define _FROMMB(a) a
00535 # define _TOMB(a) a
00536 #endif
00537
00538
00539
00540
00541 #define _WIN32_IE 0x0500
00542
00543 #define SHFS_SHOWSIPBUTTON 0x0004
00544 #define SHFS_HIDESIPBUTTON 0x0008
00545 #define SHIDIM_FLAGS 0x0001
00546 #define SHIDIF_DONEBUTTON 0x0001
00547 #define SHIDIF_SIPDOWN 0x0008
00548 #define SHIDIF_FULLSCREENNOMENUBAR 0x0010
00549 #define SHCMBF_HMENU 0x0010
00550 #define SHCMBF_EMPTYBAR 0x0001
00551 #define GN_CONTEXTMENU 1000
00552 #define SHRG_RETURNCMD 0x0001
00553 #define SHRG_NOTIFYPARENT 0x0002
00554 #define SHCMBM_GETSUBMENU (WM_USER + 401)
00555 #define SHCMBM_GETMENU (WM_USER + 402)
00556 #ifndef TBSTYLE_NO_DROPDOWN_ARROW
00557 #define TBSTYLE_NO_DROPDOWN_ARROW 0x0080
00558 #endif
00559 #define lstrlenW wcslen
00560 #define SHGetMenu(hwnd) \
00561 (HMENU)SendMessage((hwnd), SHCMBM_GETMENU, (WPARAM)0, (LPARAM)0)
00562 #define TrackPopupMenu(hm,u,x,y,r,hw,p) \
00563 TrackPopupMenuEx((hm),(u),(x),(y),(hw),0)
00564
00565 extern "C" {
00566 typedef struct tagSHMENUBARINFO
00567 {
00568 DWORD cbSize;
00569 HWND hwndParent;
00570 DWORD dwFlags;
00571 UINT nToolBarId;
00572 HINSTANCE hInstRes;
00573 int nBmpId;
00574 int cBmpImages;
00575 HWND hwndMB;
00576 COLORREF clrBk;
00577 } SHMENUBARINFO, *PSHMENUBARINFO;
00578
00579 BOOL SHCreateMenuBar( SHMENUBARINFO *pmbi );
00580 BOOL SHFullScreen(HWND hwndRequester, DWORD dwState);
00581
00582 typedef struct tagSHINITDLGINFO
00583 {
00584 DWORD dwMask;
00585 HWND hDlg;
00586 DWORD dwFlags;
00587 } SHINITDLGINFO, *PSHINITDLGINFO;
00588
00589 BOOL SHInitDialog(PSHINITDLGINFO pshidi);
00590
00591 typedef struct tagNMRGINFO
00592 {
00593 NMHDR hdr;
00594 POINT ptAction;
00595 DWORD dwItemSpec;
00596 } NMRGINFO, *PNMRGINFO;
00597
00598 BOOL WINAPI CommandBar_InsertMenubarEx(HWND, HINSTANCE, LPTSTR, WORD);
00599
00600 typedef struct tagSHRGI
00601 {
00602 DWORD cbSize;
00603 HWND hwndClient;
00604 POINT ptDown;
00605 DWORD dwFlags;
00606 } SHRGINFO, *PSHRGINFO;
00607
00608 DWORD SHRecognizeGesture(SHRGINFO *shrg);
00609
00610 typedef enum tagSIPSTATE
00611 {
00612 SIP_UP = 0,
00613 SIP_DOWN,
00614 SIP_FORCEDOWN,
00615 SIP_UNCHANGED,
00616 SIP_INPUTDIALOG,
00617 } SIPSTATE;
00618
00619 BOOL SHSipPreference(HWND, SIPSTATE);
00620
00621 BOOL SHSipInfo(UINT, UINT, PVOID, UINT);
00622
00623 typedef struct
00624 {
00625 DWORD cbSize;
00626 DWORD fdwFlags;
00627 RECT rcVisibleDesktop;
00628 RECT rcSipRect;
00629 DWORD dwImDataSize;
00630 VOID *pvImData;
00631 } SIPINFO;
00632 }
00633
00634 #if defined( WIN32 ) && !defined( UNDER_CE )
00635 # define SHFullScreen(a,b)
00636 # define SHInitDialog(a)
00637 # define SHCreateMenuBar(a) 1
00638 # define SHRecognizeGesture(a) 0
00639 # define SHSipPreference(a,b)
00640
00641 # define SHSipInfo(a,b,c,d) 0
00642 #endif
00643
00644 #endif //WINCE_RESOURCE
00645
00646 #define IDD_ABOUT 101
00647 #define IDI_ICON1 102
00648 #define IDB_BITMAP1 103
00649 #define IDB_BITMAP2 111
00650 #define IDR_MENUBAR1 113
00651 #define IDD_FILEINFO 118
00652 #define IDD_DUMMY 118
00653 #define IDD_MESSAGES 119
00654 #define IDR_MENUBAR 120
00655 #define IDR_MENUBAR2 121
00656 #define IDD_PLAYLIST 122
00657 #define IDB_BITMAP3 123
00658 #define IDD_ITEMINFO 124
00659 #define IDCLEAR 1001
00660 #define IDSAVEAS 1002
00661 #define ID_FILE 40028
00662 #define ID_VIEW 40030
00663 #define ID_SETTINGS 40032
00664 #define ID_AUDIO 40034
00665 #define ID_EMPTY 40034
00666 #define ID_VIDEO 40036
00667 #define ID_NAVIGATION 40038
00668 #define IDM_FILE 40042
00669 #define IDM_VIEW 40044
00670 #define IDM_SETTINGS 40046
00671 #define IDM_AUDIO 40048
00672 #define IDM_VIDEO 40050
00673 #define IDM_NAVIGATION 40053
00674 #define ID_FILE_QUICKOPEN 40057
00675 #define ID_FILE_OPENFILE 40058
00676 #define ID_FILE_OPENDIR 40059
00677 #define ID_FILE_OPENNET 40060
00678 #define ID_FILE_EXIT 40061
00679 #define ID_VIEW_PLAYLIST 40063
00680 #define ID_VIEW_MESSAGES 40064
00681 #define ID_VIEW_MEDIAINFO 40065
00682 #define ID_VIEW_STREAMINFO 40066
00683 #define ID_PREFERENCES 40071
00684 #define ID_FILE_ABOUT 40069
00685 #define IDM_MANAGE 40087
00686 #define IDM_SORT 40088
00687 #define IDM_SEL 40089
00688 #define ID_SORT_AUTHOR 40091
00689 #define ID_SORT_RAUTHOR 40092
00690 #define ID_SORT_SHUFFLE 40095
00691 #define ID_SEL_INVERT 40096
00692 #define ID_SEL_DELETE 40097
00693 #define ID_SEL_SELECTALL 40098
00694 #define ID_SEL_ENABLE 40100
00695 #define ID_SEL_DISABLE 40101
00696 #define ID_SORT_TITLE 40102
00697 #define ID_SORT_RTITLE 40103
00698 #define ID_MANAGE_ADDFILE 40104
00699 #define ID_MANAGE_ADDDIRECTORY 40105
00700 #define ID_MANAGE_ADDMRL 40106
00701 #define ID_MANAGE_OPENPL 40107
00702 #define ID_MANAGE_SAVEPL 40108
00703 #define StopStream_Event 57601
00704 #define PlayStream_Event 57602
00705 #define PrevStream_Event 57603
00706 #define NextStream_Event 57604
00707 #define SlowStream_Event 57605
00708 #define FastStream_Event 57606