00001
00023 #ifndef _GLPREVIEWFRAME_H
00024 #define _GLPREVIEWFRAME_H
00025
00026 class GLRenderer;
00027 class wxToolBar;
00028 class wxToggleButton;
00029 class wxCheckBox;
00030 class wxTextCtrl;
00031 class wxBitmapButton;
00032 class wxSpinButton;
00033 class wxScrolledWindow;
00034 class wxBoxSizer;
00035 class wxStaticBoxSizer;
00036 class wxStaticText;
00037 class wxSlider;
00038 class GLViewer;
00039 class GLPreview;
00040 class GLOverview;
00041 class ViewState;
00042 class wxSpinEvent;
00043 class wxChoice;
00044 #if wxCHECK_VERSION(2,9,1)
00045
00046
00047
00048 #include <wx/infobar.h>
00049 #endif
00050
00051 class MeshManager;
00052
00053 class ToolHelper;
00054 class PreviewToolHelper;
00055 class PanosphereOverviewToolHelper;
00056 class PlaneOverviewToolHelper;
00057 class Tool;
00058 class PreviewTool;
00059 class PreviewCropTool;
00060 class DragTool;
00061 class OverviewDragTool;
00062 class PanosphereOverviewCameraTool;
00063 class PlaneOverviewCameraTool;
00064 class PreviewDragTool;
00065 class PreviewIdentifyTool;
00066 class PreviewDifferenceTool;
00067 class PreviewPanoMaskTool;
00068 class PreviewControlPointTool;
00069 class PreviewLayoutLinesTool;
00070 class PreviewColorPickerTool;
00071
00072 class PanosphereOverviewProjectionGridTool;
00073 class PreviewProjectionGridTool;
00074 class PanosphereSphereTool;
00075
00076 class PanosphereOverviewOutlinesTool;
00077 class PlaneOverviewOutlinesTool;
00078
00079 class PreviewGuideTool;
00080
00081 class GLPreviewFrame;
00082
00083 class GLwxAuiManager;
00084 class GLwxAuiFloatingFrame;
00085
00086 #include <wx/string.h>
00087 #include <wx/frame.h>
00088 #include <wx/aui/aui.h>
00089 #include <wx/clrpicker.h>
00090 #include "hugin/GuiLevel.h"
00091
00092 #include <iostream>
00093
00094
00095
00096 class ImageToogleButtonEventHandler : public wxEvtHandler
00097 {
00098 public:
00099 ImageToogleButtonEventHandler(unsigned int image_number,
00100 wxToolBarToolBase* identify_toolbutton_in,
00101 PT::Panorama * m_pano);
00102 void OnChange(wxCommandEvent &e);
00103 void AddIdentifyTool(PreviewIdentifyTool** identify_tool_in);
00104 protected:
00105 void OnEnter(wxMouseEvent & e);
00106 void OnLeave(wxMouseEvent & e);
00107 private:
00108 DECLARE_EVENT_TABLE()
00109 unsigned int image_number;
00110 std::vector<PreviewIdentifyTool**> identify_tools;
00111 wxToolBarToolBase *identify_toolbutton;
00112 PT::Panorama * m_pano;
00113 };
00114
00115 class ImageGroupButtonEventHandler : public wxEvtHandler
00116 {
00117 public:
00118 ImageGroupButtonEventHandler(unsigned int image_number, GLPreviewFrame* frame_in, PT::Panorama* m_pano);
00119 void OnChange(wxCommandEvent &e);
00120 void AddDragTool(DragTool** drag_tool_in);
00121 void AddIdentifyTool(PreviewIdentifyTool** identify_tool_in);
00122 protected:
00123 void OnEnter(wxMouseEvent & e);
00124 void OnLeave(wxMouseEvent & e);
00125 private:
00126 DECLARE_EVENT_TABLE()
00127 unsigned int image_number;
00128 std::vector<DragTool**> drag_tools;
00129 std::vector<PreviewIdentifyTool**> identify_tools;
00130 GLPreviewFrame* frame;
00131 PT::Panorama * m_pano;
00132 };
00133
00134
00138 class GLwxAuiFloatingFrame : public wxAuiFloatingFrame {
00139 public:
00140 GLwxAuiFloatingFrame(wxWindow* parent,
00141 GLwxAuiManager* owner_mgr,
00142 const wxAuiPaneInfo& pane,
00143 wxWindowID id = wxID_ANY,
00144 long style = wxRESIZE_BORDER | wxSYSTEM_MENU | wxCAPTION |
00145
00146 wxFRAME_FLOAT_ON_PARENT |
00147 wxCLIP_CHILDREN
00148 ) : wxAuiFloatingFrame(parent, (wxAuiManager*) owner_mgr, pane, id, style) {}
00149
00150
00151 void OnActivate(wxActivateEvent& evt);
00152 void OnMoveFinished();
00153
00154
00155 DECLARE_EVENT_TABLE()
00156
00157 };
00158
00163 class GLwxAuiManager : public wxAuiManager {
00164 public:
00165 GLwxAuiManager(GLPreviewFrame* frame, GLPreview * preview, GLOverview * overview) : frame(frame), preview(preview), overview(overview) {}
00166 GLwxAuiFloatingFrame* CreateFloatingFrame(wxWindow* parent, const wxAuiPaneInfo& p);
00167 GLPreviewFrame * getPreviewFrame() {return frame;}
00168 GLPreview * getGLPreview() {return preview;}
00169 GLOverview * getGLOverview() {return overview;}
00170
00171 private:
00172 GLPreviewFrame * frame;
00173 GLPreview * preview;
00174 GLOverview * overview;
00175 };
00176
00177
00178
00186 class GLPreviewFrame : public wxFrame, public PT::PanoramaObserver, public AppBase::MultiProgressDisplay
00187 {
00188 public:
00189
00192 GLPreviewFrame(wxFrame * frame, PT::Panorama &pano);
00193
00196 virtual ~GLPreviewFrame();
00197
00198 void panoramaChanged(PT::Panorama &pano);
00199 void panoramaImagesChanged(PT::Panorama &pano, const PT::UIntSet &changed);
00200
00201 void updateProgressDisplay();
00202
00203 void MakePreviewTools(PreviewToolHelper * helper);
00204 void MakePanosphereOverviewTools(PanosphereOverviewToolHelper * helper);
00205 void MakePlaneOverviewTools(PlaneOverviewToolHelper* helper);
00206
00207 void SetImageButtonColour(unsigned int image_nr, unsigned char red,
00208 unsigned char green, unsigned char blue);
00209 void SetStatusMessage(wxString message);
00212 void FillBlendChoice();
00214 void LoadOpenGLLayout();
00216 void InitPreviews();
00218 void SetGuiLevel(GuiLevel newLevel);
00219
00220 GLwxAuiManager* getAuiManager() {return m_mgr;}
00221 GLPreview* getPreview() {return m_GLPreview;}
00222 GLOverview* getOverview() {return m_GLOverview;}
00223
00224 void PauseResize();
00225 void ContinueResize();
00226 bool CanResize() {return GLresize;}
00227
00234 void redrawPreview();
00236 void SetShowProjectionHints(bool new_value);
00237 void OnShowEvent(wxShowEvent& e);
00238
00239 bool individualDragging();
00240 void ToggleImageInDragGroup(unsigned int image_nr, bool update_check_box = true);
00241 void RemoveImageFromDragGroup(unsigned int image_nr, bool update_check_box = true);
00242 void AddImageToDragGroup(unsigned int image_nr, bool update_check_box = true);
00243 void SetDragGroupImages(PT::UIntSet imageDragGroup_in, bool update_check_box = true);
00244 PT::UIntSet GetDragGroupImages();
00245 void ClearDragGroupImages(bool update_check_box = true);
00250 void UpdateGlobalWhiteBalance(double redFactor, double blueFactor);
00251 void UpdateIdentifyTools(std::set<unsigned int> new_image_set);
00252
00253 wxColour GetPreviewBackgroundColor();
00254
00255 protected:
00256
00257 bool GLresize;
00258
00259 void OnClose(wxCloseEvent& e);
00260
00261 void OnOverviewToggle(wxCommandEvent& e);
00262
00263 void OnCenterHorizontally(wxCommandEvent & e);
00264 void OnFitPano(wxCommandEvent& e);
00265 void OnStraighten(wxCommandEvent & e);
00266 void OnShowAll(wxCommandEvent & e);
00267 void OnShowNone(wxCommandEvent & e);
00268 void OnPhotometric(wxCommandEvent & e);
00269 void OnIdentify(wxCommandEvent &e);
00270 void OnAutocrop(wxCommandEvent &e);
00271 void OnStackAutocrop(wxCommandEvent &e);
00272 void OnControlPoint(wxCommandEvent &e);
00273 void OnNumTransform(wxCommandEvent & e);
00274 void OnChangeFOV(wxScrollEvent & e);
00275 void OnTrackChangeFOV(wxScrollEvent & e);
00276 void OnExposureChanged(wxCommandEvent & e);
00277 void OnProjParameterChanged(wxCommandEvent & e);
00279 void OnProjParameterReset(wxCommandEvent & e);
00281 void OnSwitchPreviewGrid(wxCommandEvent & e);
00283 void OnUserExit(wxCommandEvent & e);
00284
00285 void OnDefaultExposure( wxCommandEvent & e );
00286 void OnDecreaseExposure( wxSpinEvent & e );
00287 void OnIncreaseExposure( wxSpinEvent & e );
00288
00289 void OnBlendChoice(wxCommandEvent & e);
00290 void OnDragChoice(wxCommandEvent & e);
00291
00292 void KeyDown(wxKeyEvent & e);
00293 void KeyUp(wxKeyEvent & e);
00294
00295 void DragChoiceLayout( int index );
00296 void OnProjectionChoice(wxCommandEvent & e);
00297 void OnOverviewModeChoice(wxCommandEvent & e);
00299 void OnROIChanged(wxCommandEvent & e);
00301 void OnResetCrop(wxCommandEvent & e);
00302 void OnHFOVChanged(wxCommandEvent & e);
00303 void OnVFOVChanged(wxCommandEvent & e);
00305 void OnHideProjectionHints(wxCommandEvent &e);
00306
00307
00308
00309 void updateBlendMode();
00310
00311 void updatePano();
00313 void OnFullScreen(wxCommandEvent &e);
00315 void OnSelectMode(wxNotebookEvent &e);
00317 void OnToolModeChanging(wxNotebookEvent &e);
00319 void OnLayoutScaleChange(wxScrollEvent &e);
00321 void OnColorPicker(wxCommandEvent &e);
00323 void OnPreviewBackgroundColorChanged(wxColourPickerEvent & e);
00325 void OnGuideChanged(wxCommandEvent &e);
00327 void OnShowMainFrame(wxCommandEvent &e);
00328
00329 void OnLoadImages( wxCommandEvent & e );
00330 void OnAlign( wxCommandEvent & e );
00331 void OnCreate( wxCommandEvent & e );
00332 void OnLensTypeChanged (wxCommandEvent & e);
00333 void OnFocalLengthChanged(wxCommandEvent & e);
00334 void OnCropFactorChanged(wxCommandEvent & e);
00335
00336 private:
00340 void EnableGroupCheckboxes(bool isShown);
00345 bool UpdateOverviewMode(int newMode);
00347 void UpdateRoiDisplay(const HuginBase::PanoramaOptions opts);
00349 GLwxAuiManager * m_mgr;
00350
00351 void SetMode(int newMode);
00352 PT::Panorama & m_pano;
00353
00354 GLPreview * m_GLPreview;
00355 GLOverview * m_GLOverview;
00356
00357 GuiLevel m_guiLevel;
00358
00359 ViewState* m_view_state;
00360
00361 int m_mode;
00362 int non_layout_blend_mode;
00363 wxToolBar* m_ToolBar_Identify;
00364 wxNotebook* m_tool_notebook;
00365 wxPanel* m_projection_panel;
00366 wxSlider * m_HFOVSlider;
00367 wxSlider * m_VFOVSlider;
00368 wxTextCtrl * m_HFOVText;
00369 wxTextCtrl * m_VFOVText;
00370 wxTextCtrl * m_ROILeftTxt;
00371 wxTextCtrl * m_ROIRightTxt;
00372 wxTextCtrl * m_ROITopTxt;
00373 wxTextCtrl * m_ROIBottomTxt;
00374 wxChoice * m_BlendModeChoice;
00375 wxChoice * m_DragModeChoice;
00376 wxChoice * m_ProjectionChoice;
00377 wxChoice * m_OverviewModeChoice;
00378 wxChoice * m_GuideChoiceCrop;
00379 wxChoice * m_GuideChoiceDrag;
00380 wxChoice * m_GuideChoiceProj;
00381
00382
00383 wxTextCtrl * m_exposureTextCtrl;
00384 wxBitmapButton * m_defaultExposureBut;
00385 wxSpinButton * m_exposureSpinBut;
00386 #if wxCHECK_VERSION(2, 9, 1)
00387
00388 wxInfoBar * m_infoBar;
00389 #else
00390
00391 bool m_projectionStatusPushed;
00392 #endif
00393
00394 wxStaticText * m_imagesText;
00395 wxButton * m_alignButton;
00396 wxButton * m_createButton;
00397 wxChoice * m_lensTypeChoice;
00398 wxTextCtrl * m_focalLengthText;
00399 wxTextCtrl * m_cropFactorText;
00400 wxButton * m_loadLensButton;
00401 wxMenu* m_filemenuSimple;
00402
00403 int m_degDigits;
00404
00405 wxColour m_preview_background_color;
00406
00407 wxString m_choices[3];
00408 int m_oldProjFormat;
00409
00410 int m_differenceIndex;
00411
00412 wxScrolledWindow * m_ButtonPanel;
00413 wxBoxSizer * m_ButtonSizer;
00414 wxStaticBoxSizer * m_ToggleButtonSizer;
00415
00416 wxBoxSizer * m_topsizer;
00417 wxBoxSizer * m_projParamSizer;
00418 std::vector<wxStaticText *> m_projParamNamesLabel;
00419 std::vector<wxTextCtrl *> m_projParamTextCtrl;
00420 std::vector<wxSlider *> m_projParamSlider;
00421
00422 #ifdef USE_TOGGLE_BUTTON
00423 std::vector<wxToggleButton *> m_ToggleButtons;
00424 #else
00425 std::vector<wxCheckBox *> m_ToggleButtons;
00426 #endif
00427 std::vector<wxCheckBox *> m_GroupToggleButtons;
00428 std::vector<wxPanel *> m_ToggleButtonPanel;
00429 std::vector<ImageToogleButtonEventHandler *> toogle_button_event_handlers;
00430 std::vector<ImageGroupButtonEventHandler *> toggle_group_button_event_handlers;
00431
00432 DECLARE_EVENT_TABLE()
00433
00434
00435 PreviewToolHelper *preview_helper;
00436
00437 PreviewCropTool *crop_tool;
00438 PT::UIntSet imageDragGroup;
00439 PreviewDragTool *drag_tool;
00440 PreviewColorPickerTool *color_picker_tool;
00441
00442 PreviewIdentifyTool *identify_tool;
00443 PreviewIdentifyTool *panosphere_overview_identify_tool;
00444 PreviewIdentifyTool *plane_overview_identify_tool;
00445
00446 PreviewDifferenceTool *difference_tool;
00447 PreviewDifferenceTool *plane_difference_tool;
00448 PreviewDifferenceTool *panosphere_difference_tool;
00449
00450 PreviewControlPointTool *preview_control_point_tool;
00451 PreviewControlPointTool *panosphere_control_point_tool;
00452 PreviewControlPointTool *plane_control_point_tool;
00453
00454 PreviewPanoMaskTool *pano_mask_tool;
00455
00456 bool m_showProjectionHints;
00457 PreviewLayoutLinesTool *m_preview_layoutLinesTool;
00458 PreviewLayoutLinesTool *m_panosphere_layoutLinesTool;
00459 PreviewLayoutLinesTool *m_plane_layoutLinesTool;
00460
00461 PanosphereOverviewProjectionGridTool * overview_projection_grid;
00462 PreviewProjectionGridTool * preview_projection_grid;
00463 PanosphereSphereTool * panosphere_sphere_tool;
00464
00465 PanosphereOverviewToolHelper *panosphere_overview_helper;
00466
00467 PlaneOverviewToolHelper *plane_overview_helper;
00468
00469 OverviewDragTool *overview_drag_tool;
00470
00471 PanosphereOverviewCameraTool *panosphere_overview_camera_tool;
00472 PlaneOverviewCameraTool *plane_overview_camera_tool;
00473
00474 PanosphereOverviewOutlinesTool *overview_outlines_tool;
00475 PlaneOverviewOutlinesTool *plane_overview_outlines_tool;
00476
00477 PreviewGuideTool *preview_guide_tool;
00478
00479 void TurnOffTools(std::set<Tool*> tools);
00480
00481 #ifdef __WXGTK__
00482 bool loadedLayout;
00483 #endif
00484
00488 bool HasNonZeroTranslationPlaneParameters();
00490 void ResetTranslationPlaneParameters();
00491 void CleanButtonColours();
00497 void ShowProjectionWarnings();
00498 };
00499
00500
00501 #endif