00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifdef HAVE_CONFIG_H
00025 # include "config.h"
00026 #endif
00027
00028 #ifndef _WXVLC_WIDGETS_H_
00029 #define _WXVLC_WIDGETS_H_
00030
00031 #ifdef WIN32
00032 #undef Yield
00033 #undef CreateDialog
00034 #endif
00035
00036 #ifdef _MSC_VER
00037
00038 # pragma warning( disable:4786 )
00039 #endif
00040
00041
00042 #define WXINTL_NO_GETTEXT_MACRO
00043
00044 #include <vlc_common.h>
00045 #include <vlc_interface.h>
00046 #include "vlc_charset.h"
00047 #include <vlc_playlist.h>
00048 #include <wx/wx.h>
00049 #define SLIDER_MAX_POS 10000
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065 #if (!wxCHECK_VERSION(2,5,0))
00066 typedef long wxTreeItemIdValue;
00067 #endif
00068
00069 DECLARE_LOCAL_EVENT_TYPE( wxEVT_DIALOG, 0 );
00070 DECLARE_LOCAL_EVENT_TYPE( wxEVT_INTF, 1 );
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080 #if wxUSE_UNICODE
00081 # define wxU(utf8) wxString(utf8, wxConvUTF8)
00082 #else
00083 # define wxU(utf8) wxString(wxConvUTF8.cMB2WC(utf8), *wxConvCurrent)
00084 #endif
00085
00086
00087
00088
00089
00090
00091 #define wxL2U(utf8) wxU(utf8)
00092
00093
00094
00095
00096
00097
00098
00099
00100 static inline char *wxFromLocale (const wxString& string)
00101 {
00102 #if defined( wxUSE_UNICODE )
00103 # if defined( WIN32 )
00104 return FromWide ((const wchar_t *)string.c_str());
00105 # define wxLocaleFree free
00106 # else
00107 return FromLocaleDup (string.mb_str());
00108 # define wxLocaleFree free
00109 # endif
00110 #else
00111 # warning Please use WxWidgets with Unicode.
00112 return FromLocale (string.c_str());
00113 # define wxLocaleFree LocaleFree
00114 #endif
00115 }
00116
00117
00118 #if defined( wxUSE_UNICODE ) && !defined( WIN32 )
00119 static inline char *wxDnDFromLocale( const wxChar *stupid )
00120 {
00121
00122
00123
00124
00125
00126
00127
00128
00129
00130
00131 size_t n = 0;
00132 while (stupid[n])
00133 n++;
00134
00135 char psz_local[n + 1];
00136 for (size_t i = 0; i <= n; i++)
00137 psz_local[i] = stupid[i];
00138
00139
00140 if ((n >= 1) && (strchr ("\n\r", stupid[n - 1]) != NULL))
00141 psz_local[n - 1] = '\0';
00142
00143 return FromLocaleDup( psz_local );
00144 }
00145 # define wxDnDLocaleFree free
00146 #else
00147 # define wxDnDFromLocale wxFromLocale
00148 # define wxDnDLocaleFree wxLocaleFree
00149 #endif
00150
00151 #define WRAPCOUNT 80
00152
00153 #define OPEN_NORMAL 0
00154 #define OPEN_STREAM 1
00155
00156 enum
00157 {
00158 ID_CONTROLS_TIMER,
00159 ID_SLIDER_TIMER,
00160 };
00161
00162 namespace wxvlc {
00163 class WindowSettings;
00164 class VideoWindow;
00165 };
00166
00167 using namespace wxvlc;
00168
00169
00170
00171
00172 struct intf_sys_t
00173 {
00174
00175 wxWindow *p_wxwindow;
00176 wxIcon *p_icon;
00177
00178
00179 WindowSettings *p_window_settings;
00180
00181
00182 bool b_playing;
00183 bool b_intf_show;
00184
00185
00186 input_thread_t * p_input;
00187
00188
00189 msg_subscription_t* p_sub;
00190
00191
00192 int i_playing;
00193 unsigned i_playlist_usage;
00194
00195
00196 void (*pf_show_dialog) ( intf_thread_t *p_intf, int i_dialog, int i_arg,
00197 intf_dialog_args_t *p_arg );
00198
00199
00200 wxMenu *p_popup_menu;
00201
00202
00203 int i_first_hotkey_event;
00204 int i_hotkeys;
00205
00206
00207 VideoWindow *p_video_window;
00208 wxBoxSizer *p_video_sizer;
00209 bool b_video_autosize;
00210
00211
00212 aout_instance_t *p_aout;
00213 };
00214
00215
00216
00217 wxArrayString SeparateEntries( wxString );
00218 wxWindow *CreateDialogsProvider( intf_thread_t *p_intf, wxWindow *p_parent );
00219
00220
00221
00222
00223
00224
00225 inline void LockPlaylist( intf_sys_t *p_sys, playlist_t *p_pl )
00226 {
00227 if( p_sys->i_playlist_usage++ == 0)
00228 vlc_object_lock( p_pl );
00229 }
00230
00231 inline void UnlockPlaylist( intf_sys_t *p_sys, playlist_t *p_pl )
00232 {
00233 if( --p_sys->i_playlist_usage == 0)
00234 vlc_object_unlock( p_pl );
00235 }
00236
00237 #endif