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