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 "panodata/Panorama.h"
00033 
00034 #include "wx/docview.h"
00035 #ifdef __WXMSW__
00036 #include "wx/msw/helpchm.h"
00037 #include "base_wx/wxPlatform.h"
00038 #endif
00039 
00040 #include <appbase/ProgressDisplay.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 // forward declarations, to save the #include statements
00050 class CPEditorPanel;
00051 class ImgPreview;
00052 class ImagesPanel;
00053 class MaskEditorPanel;
00054 class OptimizePhotometricPanel;
00055 class PanoPanel;
00056 class PreviewFrame;
00057 class GLPreviewFrame;
00058 class CPListFrame;
00059 
00061 class PanoDropTarget : public wxFileDropTarget
00062 {
00063 public:
00064     PanoDropTarget(HuginBase::Panorama & p, bool imageOnly = false)
00065         : pano(p)
00066     { m_imageOnly = imageOnly; }
00067 
00068     bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames);
00069 
00070 private:
00071     HuginBase::Panorama & pano;
00072     bool m_imageOnly;
00073 };
00074 
00083 class MainFrame : public wxFrame, public HuginBase::PanoramaObserver, public AppBase::ProgressDisplay
00084 {
00085 public:
00086 
00089     MainFrame(wxWindow* parent, HuginBase::Panorama & pano);
00090 
00093     virtual ~MainFrame();
00094 
00098     virtual void panoramaChanged(HuginBase::Panorama &pano);
00099     void panoramaImagesChanged(HuginBase::Panorama &pano, const HuginBase::UIntSet & imgNr);
00101     const HuginBase::Panorama & getPanorama() { return pano; };
00102 
00103     // called when a control point in CPListFrame is selected
00104     void ShowCtrlPoint(unsigned int cpNr);
00105 
00107     const wxString & GetXRCPath();
00109     const wxString & GetDataPath();
00111     void SetOptimizeOnlyActiveImages(const bool onlyActive);
00112     const bool GetOptimizeOnlyActiveImages() const;
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 OnOnlyActiveImages(wxCommandEvent &e);
00135     void OnPhotometricOptimize(wxCommandEvent & e);
00136     void OnDoStitch(wxCommandEvent & e);
00137     void OnUserDefinedStitch(wxCommandEvent & e);
00138     void OnTogglePreviewFrame(wxCommandEvent & e);
00139     void OnToggleGLPreviewFrame(wxCommandEvent & e);
00140     void OnAddImages(wxCommandEvent & e);
00141     void OnSaveProject(wxCommandEvent & e);
00142     void OnSetGuiSimple(wxCommandEvent & e);
00143     void OnSetGuiAdvanced(wxCommandEvent & e);
00144     void OnSetGuiExpert(wxCommandEvent & e);
00145 
00147     void DisplayHelp(wxString section = wxEmptyString);
00148 
00150     void ShowCtrlPointEditor(unsigned int img1, unsigned int img2);
00152     void ShowMaskEditor(size_t imgNr);
00154     void ShowStitcherTab();
00155 
00156     void OnCPListFrameClosed();
00158     CPDetectorSetting& GetDefaultSetting();
00160     void RunCPGenerator(CPDetectorSetting &setting, const HuginBase::UIntSet& img);
00162     void RunCPGenerator(const HuginBase::UIntSet& img);
00164     const wxString GetSelectedCPGenerator();
00165 
00166     wxString getProjectName();
00167 
00168     struct celeste::svm_model* GetSVMModel();
00169     
00170     GLPreviewFrame * getGLPreview();
00171 #ifdef __WXMSW__
00172 #if wxCHECK_VERSION(3,1,1)
00173     wxCHMHelpController& GetHelpController() { return m_msHtmlHelp; }
00174 #else
00175     HuginCHMHelpController& GetHelpController() { return m_msHtmlHelp; }
00176 #endif
00177 #endif
00178     void SetGuiLevel(GuiLevel newLevel);
00179     const GuiLevel GetGuiLevel() const { return m_guiLevel; };
00180 
00181     wxFileHistory* GetFileHistory() { return &m_mruFiles; };
00182 
00184     wxString GetCurrentOptimizerString();
00185 
00186 protected:
00187     // called when a progress message should be displayed
00193     void updateProgressDisplay();
00194 
00195 private:
00196 
00197     // event handlers
00198     void OnExit(wxCloseEvent & e);
00199     void OnUserQuit(wxCommandEvent & e);
00200     void OnAbout(wxCommandEvent & e);
00201     void OnHelp(wxCommandEvent & e);
00202     void OnKeyboardHelp(wxCommandEvent & e);
00203     void OnFAQ(wxCommandEvent & e);
00204     void OnShowPrefs(wxCommandEvent &e);
00205 #ifdef HUGIN_HSI
00206     void OnPythonScript(wxCommandEvent & e);
00207     void OnPlugin(wxCommandEvent& e);
00208 #endif
00209     void OnUndo(wxCommandEvent & e);
00210     void OnRedo(wxCommandEvent & e);
00211     void OnSaveProjectAs(wxCommandEvent & e);
00212     void OnSavePTStitcherAs(wxCommandEvent & e);
00213     void OnLoadProject(wxCommandEvent & e);
00214     void OnNewProject(wxCommandEvent & e);
00215     void OnAddTimeImages(wxCommandEvent & e);
00216     void OnRunAssistant(wxCommandEvent & e);
00217     void OnFineTuneAll(wxCommandEvent & e);
00218     void OnRemoveCPinMasks(wxCommandEvent & e);
00219     void OnMergeProject(wxCommandEvent & e);
00220     void OnReadPapywizard(wxCommandEvent & e);
00221     void OnApplyTemplate(wxCommandEvent & e);
00222     void OnSendToBatch(wxCommandEvent & e);
00223     void OnSendToAssistantQueue(wxCommandEvent & e);
00224     void OnOpenPTBatcher(wxCommandEvent & e);
00225 //    void OnToggleOptimizeFrame(wxCommandEvent & e);
00226     void OnShowCPFrame(wxCommandEvent & e);
00228     void OnMRUFiles(wxCommandEvent &e);
00230     void OnFullScreen(wxCommandEvent &e);
00231     void UpdatePanels(wxCommandEvent & e);
00232     void OnSize(wxSizeEvent &e);
00233     void enableTools(bool option);
00235     void AddImages(wxArrayString& filenameArray);
00236 
00237     void OnShowDonate(wxCommandEvent &e);
00238     void OnShowPanel(wxCommandEvent &e);
00239 
00240     wxFileHistory m_mruFiles;
00241     wxNotebook * m_notebook;
00242     // tab panels
00243     ImagesPanel* images_panel;
00244     MaskEditorPanel* mask_panel;
00245     CPEditorPanel * cpe;
00246     OptimizePanel * opt_panel;
00247     bool m_show_opt_panel;
00248     OptimizePhotometricPanel * opt_photo_panel;
00249     bool m_show_opt_photo_panel;
00250     PanoPanel * pano_panel;
00251     struct celeste::svm_model* svmModel;
00252 
00253     // flying windows
00254     PreviewFrame * preview_frame;
00255     GLPreviewFrame * gl_preview_frame;
00256     CPListFrame * cp_frame;
00257     GuiLevel m_guiLevel;
00258 
00259     // Image Preview
00260     ImgPreview *canvas;
00261 
00262     // Preferences
00263     //PreferencesDialog * pref_dlg;
00264 
00265     // the model
00266     HuginBase::Panorama & pano;
00267 
00268     // filename of the current project
00269     wxString m_filename;
00270 
00271     // self
00272     static MainFrame* m_this;
00273     // file menu
00274     wxMenu* m_menu_file_simple;
00275     wxMenu* m_menu_file_advanced;
00276     // sticky setting, to prevent reading to often
00277     bool m_optOnlyActiveImages;
00278 
00279 #ifdef __WXMSW__
00280 #if wxCHECK_VERSION(3,1,1)
00281     wxCHMHelpController m_msHtmlHelp;
00282 #else
00283     HuginCHMHelpController     m_msHtmlHelp;
00284 #endif
00285 #endif
00286 
00287 #ifdef HUGIN_HSI
00288     // list associating the wxID in the menu with a python script
00289     std::map<int, wxFileName> m_plugins;
00290 #endif
00291 
00292     DECLARE_EVENT_TABLE()
00293 };
00294 
00295 #endif // _MAINFRAME_H

Generated on 29 Jun 2016 for Hugintrunk by  doxygen 1.4.7