]> git.sesse.net Git - vlc/blob - modules/gui/wince/wince.h
Remove playlist info accessors (as they now belong to input_item) and use vlc_input_i...
[vlc] / modules / gui / wince / wince.h
1 /*****************************************************************************
2  * wince.h: private WinCE interface descriptor
3  *****************************************************************************
4  * Copyright (C) 1999-2004 VideoLAN
5  * $Id$
6  *
7  * Authors: Gildas Bazin <gbazin@videolan.org>
8  *          Marodon Cedric <cedric_marodon@yahoo.fr>
9  *
10  * This program is free software; you can redistribute it and/or modify
11  * it under the terms of the GNU General Public License as published by
12  * the Free Software Foundation; either version 2 of the License, or
13  * (at your option) any later version.
14  *
15  * This program is distributed in the hope that it will be useful,
16  * but WITHOUT ANY WARRANTY; without even the implied warranty of
17  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18  * GNU General Public License for more details.
19  *
20  * You should have received a copy of the GNU General Public License
21  * along with this program; if not, write to the Free Software
22  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111, USA.
23  *****************************************************************************/
24
25 #ifndef WINCE_RESOURCE
26
27 #define MENU_HEIGHT 26
28 #define SLIDER_HEIGHT 50
29
30 #define SLIDER_MAX_POS 10000
31
32 #define FILE_ACCESS 1
33 #define NET_ACCESS 2
34
35 #define OPEN_NORMAL 0
36 #define OPEN_STREAM 1
37
38 #include "vlc_keys.h"
39
40 #include <stdio.h>
41 #include <string>
42 #include <vector>
43 using namespace std; 
44
45 vector<string> SeparateEntries( LPWSTR entries );
46
47 class MenuItemExt;
48 class VideoWindow;
49
50 /*****************************************************************************
51  * intf_sys_t: description and status of wxwindows interface
52  *****************************************************************************/
53 struct intf_sys_t
54 {
55     /* special actions */
56     vlc_bool_t          b_playing;
57
58     /* The input thread */
59     input_thread_t *    p_input;
60
61     /* The slider */
62     int                 i_slider_pos;                     /* slider position */
63     int                 i_slider_oldpos;                /* previous position */
64     vlc_bool_t          b_slider_free;                      /* slider status */
65
66     /* The messages window */
67     msg_subscription_t* p_sub;                  /* message bank subscription */
68
69     /* Playlist management */
70     int                 i_playing;                 /* playlist selected item */
71
72     /* Send an event to show a dialog */
73     void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
74                              intf_dialog_args_t *p_arg );
75
76     /* Dynamic Menu management */
77     vector<MenuItemExt*> *p_audio_menu;
78     vector<MenuItemExt*> *p_video_menu;
79     vector<MenuItemExt*> *p_navig_menu;
80     vector<MenuItemExt*> *p_settings_menu;
81
82     VideoWindow          *p_video_window;
83 };
84
85 /*****************************************************************************
86  * Prototypes
87  *****************************************************************************/
88
89 class CBaseWindow
90 {
91 public:
92    CBaseWindow(){ hInst = 0; }
93    virtual ~CBaseWindow() {};
94
95    HWND hWnd;                // The main window handle
96    BOOL DlgFlag;             // True if object is a dialog window
97
98    static LRESULT CALLBACK BaseWndProc( HWND hwnd, UINT msg,
99                                         WPARAM wParam, LPARAM lParam );
100
101 protected:
102
103    HINSTANCE       hInst;               // The current instance
104    HWND            hwndCB;              // The command bar handle
105
106    HINSTANCE       GetInstance () const { return hInst; }
107    virtual LRESULT WndProc( HWND hwnd, UINT msg,
108                             WPARAM wParam, LPARAM lParam,
109                             PBOOL pbProcessed ){*pbProcessed = FALSE; return 0;}
110 };
111
112 class FileInfo;
113 class Messages;
114 class Playlist;
115 class Timer;
116 class OpenDialog;
117 class PrefsDialog;
118
119 CBaseWindow *CreateVideoWindow( intf_thread_t *, HINSTANCE, HWND );
120
121 /* Main Interface */
122 class Interface : public CBaseWindow
123 {
124 public:
125     /* Constructor */
126     Interface(){}
127     ~Interface(){}
128
129     BOOL InitInstance( HINSTANCE hInstance, intf_thread_t *_pIntf );
130
131     void TogglePlayButton( int i_playing_status );
132
133     HWND hwndMain;      // Handle to the main window.
134
135     HWND hwndCB;        // Handle to the command bar (contains menu)
136     HWND hwndTB;        // Handle to the toolbar.
137     HWND hwndSlider;       // Handle to the Sliderbar.
138     HWND hwndLabel;
139     HWND hwndVol;          // Handle to the volume trackbar.
140     HWND hwndSB;        // Handle to the status bar.
141     HMENU hPopUpMenu;
142     HMENU hMenu;
143     FileInfo *fi; // pas besoin de la plupart de ses attributs
144     Messages *hmsg;
145     PrefsDialog *pref;
146     Playlist *pl;
147     Timer *ti;
148     OpenDialog *open;
149     CBaseWindow *video;
150     HWND hwndVideo;
151
152 protected:
153
154     virtual LRESULT WndProc( HWND hwnd, UINT msg, WPARAM wp, LPARAM lp,
155                              PBOOL pbProcessed );
156
157     HWND WINAPI CreateToolbar( HWND );
158     HWND WINAPI CreateSliderbar( HWND );
159     HWND WINAPI CreateStaticText( HWND );
160     HWND WINAPI CreateVolTrackbar( HWND );
161     HWND WINAPI CreateStatusbar( HWND );
162
163     void OnOpenFileSimple( void );
164     void OnPlayStream( void );
165     void OnVideoOnTop( void );
166
167     void OnSliderUpdate( int wp );
168     void OnChange( int wp );
169     void Change( int i_volume );
170     void OnStopStream( void );
171     void OnPrevStream( void );
172     void OnNextStream( void );
173     void OnSlowStream( void );
174     void OnFastStream( void );
175
176     intf_thread_t *pIntf;
177
178     int i_old_playing_status;
179 };
180
181 /* File Info */
182 class FileInfo : public CBaseWindow
183 {
184 public:
185     /* Constructor */
186     FileInfo( intf_thread_t *_p_intf, HINSTANCE _hInst );
187     virtual ~FileInfo(){};
188
189 protected:
190
191     HWND hwnd_fileinfo;                 // handle to fileinfo window
192     HWND hwndTV;                                // handle to tree-view control 
193     intf_thread_t *p_intf;
194
195     TCHAR szFileInfoClassName[100];     // Main window class name
196     TCHAR szFileInfoTitle[100];         // Main window name
197
198     virtual LRESULT WndProc( HWND hwnd, UINT msg,
199                              WPARAM wParam, LPARAM lParam, PBOOL pbProcessed );
200     void UpdateFileInfo( HWND );
201     BOOL CreateTreeView( HWND );
202 };
203
204 /* Messages */
205 class Messages : public CBaseWindow
206 {
207 public:
208     /* Constructor */
209     Messages( intf_thread_t *_p_intf, HINSTANCE _hInst );
210     virtual ~Messages(){};
211
212 protected:
213
214     intf_thread_t *p_intf;
215
216     virtual LRESULT WndProc( HWND hwnd, UINT msg,
217                              WPARAM wParam, LPARAM lParam,
218                              PBOOL pbProcessed );
219
220     HWND hListView;
221     void UpdateLog(void);
222
223     vlc_bool_t b_verbose;
224 };
225
226 /* ItemInfo Dialog */
227 class ItemInfoDialog : public CBaseWindow
228 {
229 public:
230     /* Constructor */
231     ItemInfoDialog( intf_thread_t *, HINSTANCE, playlist_item_t * );
232     virtual ~ItemInfoDialog(){};
233
234 protected:
235
236     intf_thread_t *p_intf;
237     HWND hwndCB;        // Handle to the command bar (but no menu)
238
239     playlist_item_t *p_item;
240
241     /* Event handlers (these functions should _not_ be virtual) */
242     void OnOk();
243     void UpdateInfo();
244
245     virtual LRESULT WndProc( HWND hwnd, UINT msg,
246                              WPARAM wParam, LPARAM lParam,
247                              PBOOL pbProcessed );
248
249     /* Controls for the iteminfo dialog box */
250     HWND uri_label;
251     HWND uri_text;
252
253     HWND name_label;
254     HWND name_text;
255
256     HWND checkbox_label;
257     HWND enabled_checkbox;
258
259     HWND info_tree;
260 };
261
262 /* Open Dialog */
263 class SubsFileDialog;
264 class OpenDialog : public CBaseWindow
265 {
266 public:
267     /* Constructor */
268     OpenDialog( intf_thread_t *_p_intf, HINSTANCE _hInst,
269                 int _i_access_method, int _i_arg, int _i_method );
270     virtual ~OpenDialog(){};
271
272     void UpdateMRL();
273     void UpdateMRL( int i_access_method );
274
275 protected:
276
277     intf_thread_t *p_intf;
278
279     virtual LRESULT WndProc( HWND hwnd, UINT msg,
280                              WPARAM wParam, LPARAM lParam,
281                              PBOOL pbProcessed );
282
283     HWND mrl_box;
284     HWND mrl_label;
285     HWND mrl_combo;
286     HWND label;
287
288     HWND notebook;
289
290     HWND file_combo;
291     HWND browse_button;
292     HWND subsfile_checkbox;
293     HWND subsfile_label;
294     HWND subsfile_button;
295     SubsFileDialog *subsfile_dialog;
296
297     HWND net_radios[4];
298     HWND net_label[4];
299
300     HWND net_port_label[4];
301     HWND net_ports[4];
302     HWND hUpdown[4];
303     int i_net_ports[4];
304
305     HWND net_addrs_label[4];
306     HWND net_addrs[4];
307         
308     int i_current_access_method;
309     int i_method; /* Normal or for the stream dialog ? */
310     int i_open_arg;
311     int i_net_type;
312         
313     void FilePanel( HWND hwnd );
314     void NetPanel( HWND hwnd );
315
316     void OnSubsFileEnable();
317     void OnSubsFileSettings( HWND hwnd );
318
319     void OnPageChange();
320
321     void OnFilePanelChange();
322     void OnFileBrowse();
323     void OnNetPanelChange( int event );
324     void OnNetTypeChange( int event );
325     void DisableNETCtrl();
326
327     void OnOk();
328
329     vector<string> mrl;
330     vector<string> subsfile_mrl;
331 };
332
333 /* Subtitles File Dialog */
334 class SubsFileDialog: public CBaseWindow
335 {
336 public:
337     /* Constructor */
338     SubsFileDialog( intf_thread_t *_p_intf, HINSTANCE _hInst );
339     virtual ~SubsFileDialog(){};
340
341     vector<string> subsfile_mrl;
342
343 protected:
344     friend class OpenDialog;
345
346     intf_thread_t *p_intf;
347
348     HWND file_box;
349     HWND file_combo;
350     HWND browse_button;
351
352     HWND enc_box;
353     HWND enc_label;
354     HWND encoding_combo;
355
356     HWND misc_box;
357     HWND delay_label;
358     HWND delay_edit;
359     HWND delay_spinctrl;
360     HWND fps_label;
361     HWND fps_edit;
362     HWND fps_spinctrl;
363
364     virtual LRESULT WndProc( HWND hwnd, UINT msg,
365                              WPARAM wParam, LPARAM lParam,
366                              PBOOL pbProcessed );
367
368     /* Event handlers (these functions should _not_ be virtual) */
369     void OnFileBrowse();
370 };
371
372 /* Playlist */
373 class Playlist : public CBaseWindow
374 {
375 public:
376     /* Constructor */
377     Playlist( intf_thread_t *_p_intf, HINSTANCE _hInst );
378     virtual ~Playlist(){};
379
380 protected:
381
382     bool b_need_update;
383     vlc_mutex_t lock;
384
385     int i_title_sorted;
386     int i_author_sorted;
387
388     intf_thread_t *p_intf;
389     HWND hwndCB;        // Handle to the command bar (contains menu)
390     HWND hwndTB;        // Handle to the toolbar.
391     HWND hListView;
392
393     void UpdatePlaylist();
394     void Rebuild();
395     void UpdateItem( int );
396     LRESULT ProcessCustomDraw( LPARAM lParam );
397     void HandlePopupMenu( HWND hwnd, POINT point);
398
399     void DeleteItem( int item );
400
401     void OnOpen();
402     void OnSave();
403     void OnAddFile();
404     void OnAddMRL();
405
406     void OnDeleteSelection();
407     void OnInvertSelection();
408     void OnEnableSelection();
409     void OnDisableSelection();
410     void OnSelectAll();
411     void OnActivateItem( int i_item );
412     void ShowInfos( HWND hwnd, int i_item );
413
414     void OnUp();
415     void OnDown();
416
417     void OnRandom();
418     void OnLoop();
419     void OnRepeat();
420
421     void OnSort( UINT event );
422     void OnColSelect( int iSubItem );
423
424     void OnPopupPlay();
425     void OnPopupDel();
426     void OnPopupEna();
427     void OnPopupInfo( HWND hwnd );
428
429     virtual LRESULT WndProc( HWND hwnd, UINT msg,
430                              WPARAM wParam, LPARAM lParam,
431                              PBOOL pbProcessed );
432 };
433
434 /* Timer */
435 class Timer
436 {
437 public:
438     /* Constructor */
439     Timer( intf_thread_t *p_intf, HWND hwnd, Interface *_p_main_interface);
440     virtual ~Timer();
441     void Notify( void ); 
442
443 private:
444     intf_thread_t *p_intf;
445     Interface *p_main_interface;
446     //Interface *p_main_interface;
447     int i_old_playing_status;
448     int i_old_rate;
449 };
450
451 /* Menus */
452 void RefreshSettingsMenu( intf_thread_t *_p_intf, HMENU hMenu );
453 void RefreshAudioMenu( intf_thread_t *_p_intf, HMENU hMenu );
454 void RefreshVideoMenu( intf_thread_t *_p_intf, HMENU hMenu );
455 void RefreshNavigMenu( intf_thread_t *_p_intf, HMENU hMenu );
456 void RefreshMenu( intf_thread_t *, vector<MenuItemExt*> *, HMENU, int,
457                   char **, int *, int );
458 int wce_GetMenuItemCount( HMENU );
459 void CreateMenuItem( intf_thread_t *, vector<MenuItemExt*> *, HMENU, char *,
460                      vlc_object_t *, int * );
461 HMENU CreateChoicesMenu( intf_thread_t *, vector<MenuItemExt*> *, char *, 
462                          vlc_object_t *, int * );
463 void OnMenuEvent( intf_thread_t *, int );
464
465 /*****************************************************************************
466  * A small helper class which encapsulate wxMenuitem with some other useful
467  * things.
468  *****************************************************************************/
469 class MenuItemExt
470 {
471 public:
472     /* Constructor */
473     MenuItemExt( intf_thread_t *_p_intf, int _id, char *_psz_var,
474                  int _i_object_id, vlc_value_t _val, int _i_val_type );
475
476     virtual ~MenuItemExt();
477
478     int id;
479     intf_thread_t *p_intf;
480     char *psz_var;
481     int  i_val_type;
482     int  i_object_id;
483     vlc_value_t val;
484
485 private:
486
487 };
488
489
490 /* Preferences Dialog */
491 /* Preferences Dialog */
492 class PrefsTreeCtrl;
493 class PrefsDialog: public CBaseWindow
494 {
495 public:
496     /* Constructor */
497     PrefsDialog( intf_thread_t *_p_intf, HINSTANCE _hInst );
498     virtual ~PrefsDialog(){};
499
500 protected:
501
502     intf_thread_t *p_intf;
503
504     /* Event handlers (these functions should _not_ be virtual) */
505     void OnOk( void );
506     /*void OnCancel( UINT event );
507     void OnSave( UINT event );
508     void OnResetAll( UINT event );
509     void OnAdvanced( UINT event );*/
510
511     HWND save_button;
512     HWND reset_button;
513     HWND advanced_checkbox;
514     HWND advanced_label;
515
516     PrefsTreeCtrl *prefs_tree;
517
518     virtual LRESULT WndProc( HWND hwnd, UINT msg,
519                              WPARAM wParam, LPARAM lParam,
520                              PBOOL pbProcessed );
521 };
522
523 /*****************************************************************************
524  * A small helper function for utf8 <-> unicode conversions
525  *****************************************************************************/
526 #ifdef UNICODE
527     static wchar_t pwsz_mbtow[2048];
528     static char psz_wtomb[2048];
529     static inline wchar_t *_FROMMB( const char *psz_in )
530     {
531         mbstowcs( pwsz_mbtow, psz_in, 2048 );
532         pwsz_mbtow[2048] = 0;
533         return pwsz_mbtow;
534     }
535     static inline char *_TOMB( const wchar_t *pwsz_in )
536     {
537         wcstombs( psz_wtomb, pwsz_in, 2048 );
538         psz_wtomb[2048] = 0;
539         return psz_wtomb;
540     }
541 #else
542 #   define _FROMMB(a)
543 #   define _TOMB(a)
544 #endif
545
546 #if defined( ENABLE_NLS ) && defined( ENABLE_UTF8 )
547 #   define ISUTF8 1
548 #else // ENABLE_NLS && ENABLE_UTF8
549 #   define ISUTF8 0
550 #endif
551
552 #endif //WINCE_RESOURCE
553
554 #define IDD_ABOUT                       101
555 #define IDI_ICON1                       102
556 #define IDB_BITMAP1                     103
557 #define IDB_BITMAP2                     111
558 #define IDR_MENUBAR1                    113
559 #define IDR_ACCELERATOR1                116
560 #define IDD_FILEINFO                    118
561 #define IDD_DUMMY                       118
562 #define IDD_MESSAGES                    119
563 #define IDR_MENUBAR                     120
564 #define IDR_MENUBAR2                    121
565 #define IDD_PLAYLIST                    122
566 #define IDB_BITMAP3                     123
567 #define IDD_ITEMINFO                    124
568 #define IDR_DUMMYMENU                   126
569 #define IDCLEAR                         1001
570 #define IDSAVEAS                        1002
571 #define IDC_TEXTCTRL                    1004
572 #define IDC_CUSTOM1                     1012
573 #define IDS_MAIN_MENUITEM1              40001
574 #define IDS_TITLE                       40002
575 #define IDS_CLASSNAME                   40003
576 #define IDS_CAP_QUICKFILEOPEN           40006
577 #define IDS_CAP_VIEW                    40009
578 #define IDS_CAP_SETTINGS                40012
579 #define IDS_CAP_AUDIO                   40015
580 #define IDS_CAP_VIDEO                   40018
581 #define IDS_CAP_HELP                    40021
582 #define IDS_CAP_Navigation              40024
583 #define IDS_CAP_FILE                    40025
584 #define ID_COLOR_OPTIONS                40026
585 #define IDS_DYNAMENU                    40027
586 #define ID_FILE                         40028
587 #define IDS_BLACK                       40028
588 #define IDS_LTGRAY                      40029
589 #define ID_VIEW                         40030
590 #define IDS_DKGRAY                      40030
591 #define IDS_WHITE                       40031
592 #define ID_SETTINGS                     40032
593 #define ID_AUDIO                        40034
594 #define ID_EMPTY                        40034
595 #define ID_VIDEO                        40036
596 #define ID_NAVIGATION                   40038
597 #define IDM_FILE                        40042
598 #define IDM_VIEW                        40044
599 #define IDM_SETTINGS                    40046
600 #define IDM_AUDIO                       40048
601 #define IDM_VIDEO                       40050
602 #define IDM_NAVIGATION                  40053
603 #define ID_FILE_QUICK_OPEN              40056
604 #define ID_FILE_OPENFILE                40057
605 #define ID_FILE_QUICKOPEN               40058
606 #define ID_FILE_OPENNETWORKSTREAM       40059
607 #define ID_FILE_OPENNET                 40060
608 #define ID_FILE_EXIT                    40061
609 #define ID_VIEW_PLAYLIST                40063
610 #define ID_VIEW_MESSAGES                40064
611 #define ID_VIEW_MEDIAINFO               40065
612 #define ID_VIEW_STREAMINFO              40066
613 #define IDS_CAP_NAV                     40067
614 #define ID_FILE_ABOUT                   40069
615 #define ID_SETTINGS_PREF                40071
616 #define ID_SETTINGS_EXTEND              40072
617 #define IDS_CAP_XXX                     40084
618 #define IDM_MANAGE                      40087
619 #define IDM_SORT                        40088
620 #define IDM_SEL                         40089
621 #define ID_SORT_AUTHOR                  40091
622 #define ID_SORT_RAUTHOR                 40092
623 #define ID_SORT_SHUFFLE                 40095
624 #define ID_SEL_INVERT                   40096
625 #define ID_SEL_DELETE                   40097
626 #define ID_SEL_SELECTALL                40098
627 #define ID_SEL_ENABLE                   40100
628 #define ID_SEL_DISABLE                  40101
629 #define ID_SORT_TITLE                   40102
630 #define ID_SORT_RTITLE                  40103
631 #define ID_MANAGE_SIMPLEADD             40104
632 #define ID_MANAGE_OPENPL                40105
633 #define ID_MANAGE_ADDMRL                40106
634 #define ID_MANAGE_SAVEPL                40107
635 #define ID_MENUITEM40108                40108
636 #define IDS_CAP_MENUITEM40109           40110
637 #define IDS_STOP                        57601
638 #define StopStream_Event                57601
639 #define IDS_PLAY                        57602
640 #define PlayStream_Event                57602
641 #define PrevStream_Event                57603
642 #define NextStream_Event                57604
643 #define SlowStream_Event                57605
644 #define FastStream_Event                57606
645
646 // Next default values for new objects
647 // 
648 #ifdef APSTUDIO_INVOKED
649 #ifndef APSTUDIO_READONLY_SYMBOLS
650 #define _APS_NEXT_RESOURCE_VALUE        128
651 #define _APS_NEXT_COMMAND_VALUE         40111
652 #define _APS_NEXT_CONTROL_VALUE         1013
653 #define _APS_NEXT_SYMED_VALUE           101
654 #endif
655 #endif