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
00026
00027
00028 #ifndef MRPT_WX_UTILS_H
00029 #define MRPT_WX_UTILS_H
00030
00031 #include <mrpt/utils/utils_defs.h>
00032 #include <mrpt/utils/CImage.h>
00033 #include <mrpt/utils/CConfigFileBase.h>
00034 #include <mrpt/utils/CConfigFileMemory.h>
00035 #include <mrpt/synch.h>
00036 #include <mrpt/gui/keycodes.h>
00037
00038 #include <mrpt/gui/link_pragmas.h>
00039
00040 #if MRPT_HAS_WXWIDGETS
00041
00042 #include <wx/sizer.h>
00043 #include <wx/statbmp.h>
00044 #include <wx/menu.h>
00045 #include <wx/toolbar.h>
00046 #include <wx/frame.h>
00047 #include <wx/timer.h>
00048 #include <wx/statusbr.h>
00049 #include <wx/msgdlg.h>
00050 #include <wx/artprov.h>
00051 #include <wx/bitmap.h>
00052 #include <wx/intl.h>
00053 #include <wx/image.h>
00054 #include <wx/string.h>
00055 #include <wx/msgdlg.h>
00056 #include <wx/panel.h>
00057 #include <wx/filedlg.h>
00058 #include <wx/progdlg.h>
00059 #include <wx/imaglist.h>
00060 #include <wx/busyinfo.h>
00061 #include <wx/log.h>
00062 #include <wx/textdlg.h>
00063 #include <wx/dirdlg.h>
00064 #include <wx/colordlg.h>
00065 #include <wx/dcmemory.h>
00066 #include <wx/app.h>
00067 #include <wx/pen.h>
00068 #include <wx/spinctrl.h>
00069 #include <wx/sizer.h>
00070 #include <wx/notebook.h>
00071 #include <wx/button.h>
00072 #include <wx/panel.h>
00073 #include <wx/stattext.h>
00074 #include <wx/textctrl.h>
00075 #include <wx/choice.h>
00076 #include <wx/radiobox.h>
00077 #include <wx/settings.h>
00078 #include <wx/checkbox.h>
00079 #include <wx/dc.h>
00080 #include <wx/dcclient.h>
00081
00082 #endif
00083
00084 namespace mrpt
00085 {
00086 namespace gui
00087 {
00088 #if MRPT_HAS_WXWIDGETS
00089
00090
00091 #ifndef _U
00092 # ifdef wxUSE_UNICODE
00093 # define _U(x) wxString::From8BitData(x)
00094 # else
00095 # define _U(x) (x)
00096 # endif
00097 #endif
00098
00099
00100
00101
00102
00103 wxImage GUI_IMPEXP * MRPTImage2wxImage( const mrpt::utils::CImage &img );
00104
00105
00106
00107
00108 wxBitmap GUI_IMPEXP * MRPTImage2wxBitmap( const mrpt::utils::CImage &img );
00109
00110 #if MRPT_HAS_OPENCV
00111
00112
00113
00114 wxImage GUI_IMPEXP * IplImage2wxImage( void* img );
00115 #endif
00116
00117
00118
00119
00120
00121 mrpt::utils::CImage GUI_IMPEXP * wxImage2MRPTImage( const wxImage &img );
00122
00123
00124
00125
00126 mrpt::utils::CImagePtr GUI_IMPEXP wxImage2MRPTImagePtr( const wxImage &img );
00127
00128
00129 mrptKeyModifier keyEventToMrptKeyModifier( const wxKeyEvent &ev );
00130
00131
00132
00133 class GUI_IMPEXP wxMRPTImageControl : public wxPanel
00134 {
00135 protected:
00136 wxBitmap *m_img;
00137 mrpt::synch::CCriticalSection m_img_cs;
00138
00139 wxPoint m_last_mouse_point, m_last_mouse_click;
00140 mrpt::synch::CCriticalSection m_mouse_cs;
00141
00142 public:
00143 wxMRPTImageControl( wxWindow *parent,wxWindowID winID,int x, int y, int width, int height);
00144 virtual ~wxMRPTImageControl();
00145
00146 void AssignImage(wxBitmap *img);
00147 void AssignImage(const mrpt::utils::CImage &img);
00148 void GetBitmap(wxBitmap &bmp);
00149
00150 void OnPaint(wxPaintEvent &ev);
00151 void OnMouseMove(wxMouseEvent& ev);
00152 void OnMouseClick(wxMouseEvent& ev);
00153
00154 void OnEraseBackground(wxEraseEvent &ev) { }
00155 };
00156
00157
00158
00159 class GUI_IMPEXP CPanelCameraSelection: public wxPanel
00160 {
00161 public:
00162
00163 CPanelCameraSelection(wxWindow* parent,wxWindowID id=wxID_ANY);
00164 virtual ~CPanelCameraSelection();
00165
00166 void readConfigIntoVideoSourcePanel(
00167 const std::string §,
00168 const mrpt::utils::CConfigFileBase *cfg ) const;
00169
00170 void writeConfigFromVideoSourcePanel(
00171 const std::string §,
00172 mrpt::utils::CConfigFileBase *cfg ) const;
00173
00174
00175 wxTextCtrl* edRawlogLabel;
00176 wxStaticText* StaticText10;
00177 wxStaticText* StaticText9;
00178 wxPanel* Panel5;
00179 wxButton* btnBrowseRawlogDir;
00180 wxRadioBox* rbBumblebeeSel;
00181 wxButton* btnBrowseVideo;
00182 wxPanel* Panel4;
00183 wxStaticText* StaticText6;
00184 wxSpinCtrl* opencvCamIndex;
00185 wxTextCtrl* edIPcamURL;
00186 wxStaticText* StaticText8;
00187 wxStaticText* StaticText11;
00188 wxTextCtrl* edCustomCamConfig;
00189 wxPanel* Panel1;
00190 wxChoice* cbOpencvCamType;
00191 wxStaticText* StaticText1;
00192 wxStaticText* StaticText3;
00193 wxPanel* Panel6;
00194 wxButton* btnBrowseRawlog;
00195 wxPanel* Panel3;
00196 wxCheckBox* cbGrayscale;
00197 wxStaticText* StaticText5;
00198 wxStaticText* StaticText7;
00199 wxTextCtrl* edVideoFile;
00200 wxCheckBox* cbBumblebeeRectif;
00201 wxNotebook* pagesCameras;
00202 wxTextCtrl* edRawlogFile;
00203 wxTextCtrl* edRawlogImgDir;
00204 wxPanel* Panel2;
00205 wxChoice* cbOpencvResolution;
00206
00207 protected:
00208
00209
00210 static const long ID_STATICTEXT1;
00211 static const long ID_SPINCTRL1;
00212 static const long ID_STATICTEXT3;
00213 static const long ID_CHOICE1;
00214 static const long ID_STATICTEXT6;
00215 static const long ID_CHOICE2;
00216 static const long ID_PANEL2;
00217 static const long ID_STATICTEXT7;
00218 static const long ID_TEXTCTRL1;
00219 static const long ID_PANEL3;
00220 static const long ID_TEXTCTRL6;
00221 static const long ID_PANEL4;
00222 static const long ID_STATICTEXT8;
00223 static const long ID_TEXTCTRL2;
00224 static const long ID_BUTTON7;
00225 static const long ID_PANEL5;
00226 static const long ID_STATICTEXT9;
00227 static const long ID_TEXTCTRL3;
00228 static const long ID_BUTTON8;
00229 static const long ID_STATICTEXT5;
00230 static const long ID_TEXTCTRL7;
00231 static const long ID_BUTTON9;
00232 static const long ID_STATICTEXT10;
00233 static const long ID_TEXTCTRL8;
00234 static const long ID_STATICTEXT11;
00235 static const long ID_PANEL6;
00236 static const long ID_RADIOBOX1;
00237 static const long ID_CHECKBOX1;
00238 static const long ID_PANEL7;
00239 static const long ID_NOTEBOOK1;
00240 static const long ID_CHECKBOX2;
00241
00242
00243 private:
00244
00245
00246
00247 void OnbtnBrowseVideoClick(wxCommandEvent& event);
00248 void OnbtnBrowseRawlogClick(wxCommandEvent& event);
00249 void OnbtnBrowseRawlogDirClick(wxCommandEvent& event);
00250
00251 DECLARE_EVENT_TABLE()
00252 };
00253
00254
00255
00256 namespace detail
00257 {
00258 struct TReturnAskUserOpenCamera
00259 {
00260 mrpt::utils::CConfigFileMemory selectedConfig;
00261 bool accepted_by_user;
00262 };
00263 }
00264
00265 #endif
00266
00267 }
00268 }
00269
00270 #endif