MainFrame.h

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00024 #ifndef _MAINFRAME_H
00025 #define _MAINFRAME_H
00026 
00027 
00028 #include <vector>
00029 #include <set>
00030 #include <map>
00031 
00032 #include "PT/Panorama.h"
00033 
00034 #include "wx/docview.h"
00035 #ifdef __WXMSW__
00036 #include "wx/msw/helpchm.h"
00037 #endif
00038 
00039 #include <appbase/ProgressDisplayOld.h>
00040 #include <appbase/ProgressReporterOld.h>
00041 
00042 #include "hugin/OptimizePanel.h"
00043 #include "hugin/PreferencesDialog.h"
00044 
00045 // Celeste header
00046 #include "Celeste.h"
00047 #include "GuiLevel.h"
00048 
00049 using namespace PT;
00050 
00051 // forward declarations, to save the #include statements
00052 class CPEditorPanel;
00053 class ImgPreview;
00054 class ImagesPanel;
00055 class MaskEditorPanel;
00056 class OptimizePhotometricPanel;
00057 class PanoPanel;
00058 class PreviewFrame;
00059 class GLPreviewFrame;
00060 class CPListFrame;
00061 
00062 
00064 class PanoDropTarget : public wxFileDropTarget
00065 {
00066 public:
00067     PanoDropTarget(PT::Panorama & p, bool imageOnly = false)
00068         : pano(p)
00069     { m_imageOnly = imageOnly; }
00070 
00071     bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames);
00072 
00073 private:
00074     PT::Panorama & pano;
00075     bool m_imageOnly;
00076 };
00077 
00086 class MainFrame : public wxFrame, public PT::PanoramaObserver, public AppBase::MultiProgressDisplay, public AppBase::ProgressReporter
00087 {
00088 public:
00089 
00092     MainFrame(wxWindow* parent, PT::Panorama & pano);
00093 
00096     virtual ~MainFrame();
00097 
00101     virtual void panoramaChanged(PT::Panorama &pano);
00102     void panoramaImagesChanged(PT::Panorama &pano, const PT::UIntSet & imgNr);
00104     const PT::Panorama & getPanorama() { return pano; };
00105 
00106     // called when a control point in CPListFrame is selected
00107     void ShowCtrlPoint(unsigned int cpNr);
00108 
00110     const wxString & GetXRCPath();
00112     const wxString & GetDataPath();
00113 
00115     static MainFrame * Get();
00116 
00117     // Used to display tip of the day after main interface is initialised and visible
00118         void OnTipOfDay(wxCommandEvent & e);
00119 
00120     // load a project
00121     void LoadProjectFile(const wxString & filename);
00122     void RunAssistant(wxWindow* mainWin);
00123 
00125     void DisableOpenGLTools();
00126 #ifdef __WXMAC__
00127     void MacOnOpenFile(const wxString & filename);
00128 #endif
00129     bool CloseProject(bool cancelable);
00130 
00131     // TODO: create a nice generic optimisation & stitching function
00132     // instead of these gateway functions to the optimizer and pano panels.
00133     void OnOptimize(wxCommandEvent & e);
00134     void OnPhotometricOptimize(wxCommandEvent & e);
00135     void OnDoStitch(wxCommandEvent & e);
00136     void OnTogglePreviewFrame(wxCommandEvent & e);
00137     void OnToggleGLPreviewFrame(wxCommandEvent & e);
00138     void OnAddImages(wxCommandEvent & e);
00139     void OnSaveProject(wxCommandEvent & e);
00140     void OnSetGuiSimple(wxCommandEvent & e);
00141     void OnSetGuiAdvanced(wxCommandEvent & e);
00142     void OnSetGuiExpert(wxCommandEvent & e);
00143 
00145     void DisplayHelp(wxString section);
00146 
00148     void ShowCtrlPointEditor(unsigned int img1, unsigned int img2);
00150     void ShowMaskEditor(size_t imgNr);
00152     void ShowStitcherTab();
00153 
00154     void resetProgress(double max);
00155     bool increaseProgress(double delta);
00156     bool increaseProgress(double delta, const std::string & msg);
00157     void setMessage(const std::string & msg);
00158 
00159     void OnCPListFrameClosed();
00161     CPDetectorSetting& GetDefaultSetting();
00162 
00163     wxString getProjectName();
00164 
00165     struct celeste::svm_model* GetSVMModel();
00166     
00167     GLPreviewFrame * getGLPreview();
00168 #ifdef __WXMSW__
00169     wxCHMHelpController& GetHelpController() { return m_msHtmlHelp; }
00170 #endif
00171     void SetGuiLevel(GuiLevel newLevel);
00172     const GuiLevel GetGuiLevel() const { return m_guiLevel; };
00173 
00174     wxFileHistory* GetFileHistory() { return &m_mruFiles; };
00175 
00176 protected:
00177     // called when a progress message should be displayed
00183     void updateProgressDisplay();
00184 
00185 private:
00186 
00187     // event handlers
00188     void OnExit(wxCloseEvent & e);
00189     void OnUserQuit(wxCommandEvent & e);
00190     void OnAbout(wxCommandEvent & e);
00191     void OnHelp(wxCommandEvent & e);
00192     void OnKeyboardHelp(wxCommandEvent & e);
00193     void OnFAQ(wxCommandEvent & e);
00194     void OnShowPrefs(wxCommandEvent &e);
00195 #ifdef HUGIN_HSI
00196     void OnPythonScript(wxCommandEvent & e);
00197     void OnPlugin(wxCommandEvent& e);
00198 #endif
00199     void OnUndo(wxCommandEvent & e);
00200     void OnRedo(wxCommandEvent & e);
00201     void OnSaveProjectAs(wxCommandEvent & e);
00202     void OnSavePTStitcherAs(wxCommandEvent & e);
00203     void OnLoadProject(wxCommandEvent & e);
00204     void OnNewProject(wxCommandEvent & e);
00205     void OnAddTimeImages(wxCommandEvent & e);
00206     void OnRunAssistant(wxCommandEvent & e);
00207     void OnFineTuneAll(wxCommandEvent & e);
00208     void OnRemoveCPinMasks(wxCommandEvent & e);
00209     void OnMergeProject(wxCommandEvent & e);
00210     void OnApplyTemplate(wxCommandEvent & e);
00211     void OnSendToBatch(wxCommandEvent & e);
00212     void OnSendToAssistantQueue(wxCommandEvent & e);
00213     void OnOpenPTBatcher(wxCommandEvent & e);
00214 //    void OnToggleOptimizeFrame(wxCommandEvent & e);
00215     void OnShowCPFrame(wxCommandEvent & e);
00217     void OnMRUFiles(wxCommandEvent &e);
00219     void OnFullScreen(wxCommandEvent &e);
00220     void UpdatePanels(wxCommandEvent & e);
00221     void OnSize(wxSizeEvent &e);
00222     void enableTools(bool option);
00224     void AddImages(wxArrayString& filenameArray);
00225 
00226     void OnShowDonate(wxCommandEvent &e);
00227     void OnShowPanel(wxCommandEvent &e);
00228 
00229     // update progress display
00230     bool displayProgress();
00231 
00232     wxFileHistory m_mruFiles;
00233     wxNotebook * m_notebook;
00234     // tab panels
00235     ImagesPanel* images_panel;
00236     MaskEditorPanel* mask_panel;
00237     CPEditorPanel * cpe;
00238     OptimizePanel * opt_panel;
00239     bool m_show_opt_panel;
00240     OptimizePhotometricPanel * opt_photo_panel;
00241     bool m_show_opt_photo_panel;
00242     PanoPanel * pano_panel;
00243     struct celeste::svm_model* svmModel;
00244 
00245     // flying windows
00246     PreviewFrame * preview_frame;
00247     GLPreviewFrame * gl_preview_frame;
00248     CPListFrame * cp_frame;
00249     GuiLevel m_guiLevel;
00250 
00251     // Image Preview
00252     ImgPreview *canvas;
00253 
00254     // Preferences
00255     //PreferencesDialog * pref_dlg;
00256 
00257     // the model
00258     PT::Panorama & pano;
00259 
00260     // filename of the current project
00261     wxString m_filename;
00262 
00263     // self
00264     static MainFrame* m_this;
00265     // file menu
00266     wxMenu* m_menu_file_simple;
00267     wxMenu* m_menu_file_advanced;
00268 
00269     // progress reporter
00270     double m_progressMax;
00271     double m_progress;
00272     wxString m_progressMsg;
00273 #ifdef __WXMSW__
00274     wxCHMHelpController     m_msHtmlHelp;
00275 #endif
00276 
00277 #ifdef HUGIN_HSI
00278     // list associating the wxID in the menu with a python script
00279     std::map<int, wxFileName> m_plugins;
00280 #endif
00281 
00282     DECLARE_EVENT_TABLE()
00283 };
00284 
00285 bool getLensDataFromUser(wxWindow * parent, SrcPanoImage & srcImg,
00286                          double & focalLength, double & cropFactor);
00287 
00288 #endif // _MAINFRAME_H

Generated on Wed Jul 30 01:25:38 2014 for Hugintrunk by  doxygen 1.3.9.1