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 #endif
00038 
00039 #include <appbase/ProgressDisplay.h>
00040 
00041 #include "hugin/OptimizePanel.h"
00042 #include "hugin/PreferencesDialog.h"
00043 
00044 // Celeste header
00045 #include "Celeste.h"
00046 #include "GuiLevel.h"
00047 
00048 // forward declarations, to save the #include statements
00049 class CPEditorPanel;
00050 class ImgPreview;
00051 class ImagesPanel;
00052 class MaskEditorPanel;
00053 class OptimizePhotometricPanel;
00054 class PanoPanel;
00055 class PreviewFrame;
00056 class GLPreviewFrame;
00057 class CPListFrame;
00058 
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();
00110 
00112     static MainFrame * Get();
00113 
00114     // Used to display tip of the day after main interface is initialised and visible
00115         void OnTipOfDay(wxCommandEvent & e);
00116 
00117     // load a project
00118     void LoadProjectFile(const wxString & filename);
00119     void RunAssistant(wxWindow* mainWin);
00120 
00122     void DisableOpenGLTools();
00123 #ifdef __WXMAC__
00124     void MacOnOpenFile(const wxString & filename);
00125 #endif
00126     bool CloseProject(bool cancelable);
00127 
00128     // TODO: create a nice generic optimisation & stitching function
00129     // instead of these gateway functions to the optimizer and pano panels.
00130     void OnOptimize(wxCommandEvent & e);
00131     void OnPhotometricOptimize(wxCommandEvent & e);
00132     void OnDoStitch(wxCommandEvent & e);
00133     void OnUserDefinedStitch(wxCommandEvent & e);
00134     void OnTogglePreviewFrame(wxCommandEvent & e);
00135     void OnToggleGLPreviewFrame(wxCommandEvent & e);
00136     void OnAddImages(wxCommandEvent & e);
00137     void OnSaveProject(wxCommandEvent & e);
00138     void OnSetGuiSimple(wxCommandEvent & e);
00139     void OnSetGuiAdvanced(wxCommandEvent & e);
00140     void OnSetGuiExpert(wxCommandEvent & e);
00141 
00143     void DisplayHelp(wxString section);
00144 
00146     void ShowCtrlPointEditor(unsigned int img1, unsigned int img2);
00148     void ShowMaskEditor(size_t imgNr);
00150     void ShowStitcherTab();
00151 
00152     void OnCPListFrameClosed();
00154     CPDetectorSetting& GetDefaultSetting();
00156     void RunCPGenerator(CPDetectorSetting &setting, const HuginBase::UIntSet& img);
00158     void RunCPGenerator(const HuginBase::UIntSet& img);
00160     const wxString GetSelectedCPGenerator();
00161 
00162     wxString getProjectName();
00163 
00164     struct celeste::svm_model* GetSVMModel();
00165     
00166     GLPreviewFrame * getGLPreview();
00167 #ifdef __WXMSW__
00168     wxCHMHelpController& GetHelpController() { return m_msHtmlHelp; }
00169 #endif
00170     void SetGuiLevel(GuiLevel newLevel);
00171     const GuiLevel GetGuiLevel() const { return m_guiLevel; };
00172 
00173     wxFileHistory* GetFileHistory() { return &m_mruFiles; };
00174 
00176     wxString GetCurrentOptimizerString();
00177 
00178 protected:
00179     // called when a progress message should be displayed
00185     void updateProgressDisplay();
00186 
00187 private:
00188 
00189     // event handlers
00190     void OnExit(wxCloseEvent & e);
00191     void OnUserQuit(wxCommandEvent & e);
00192     void OnAbout(wxCommandEvent & e);
00193     void OnHelp(wxCommandEvent & e);
00194     void OnKeyboardHelp(wxCommandEvent & e);
00195     void OnFAQ(wxCommandEvent & e);
00196     void OnShowPrefs(wxCommandEvent &e);
00197 #ifdef HUGIN_HSI
00198     void OnPythonScript(wxCommandEvent & e);
00199     void OnPlugin(wxCommandEvent& e);
00200 #endif
00201     void OnUndo(wxCommandEvent & e);
00202     void OnRedo(wxCommandEvent & e);
00203     void OnSaveProjectAs(wxCommandEvent & e);
00204     void OnSavePTStitcherAs(wxCommandEvent & e);
00205     void OnLoadProject(wxCommandEvent & e);
00206     void OnNewProject(wxCommandEvent & e);
00207     void OnAddTimeImages(wxCommandEvent & e);
00208     void OnRunAssistant(wxCommandEvent & e);
00209     void OnFineTuneAll(wxCommandEvent & e);
00210     void OnRemoveCPinMasks(wxCommandEvent & e);
00211     void OnMergeProject(wxCommandEvent & e);
00212     void OnApplyTemplate(wxCommandEvent & e);
00213     void OnSendToBatch(wxCommandEvent & e);
00214     void OnSendToAssistantQueue(wxCommandEvent & e);
00215     void OnOpenPTBatcher(wxCommandEvent & e);
00216 //    void OnToggleOptimizeFrame(wxCommandEvent & e);
00217     void OnShowCPFrame(wxCommandEvent & e);
00219     void OnMRUFiles(wxCommandEvent &e);
00221     void OnFullScreen(wxCommandEvent &e);
00222     void UpdatePanels(wxCommandEvent & e);
00223     void OnSize(wxSizeEvent &e);
00224     void enableTools(bool option);
00226     void AddImages(wxArrayString& filenameArray);
00227 
00228     void OnShowDonate(wxCommandEvent &e);
00229     void OnShowPanel(wxCommandEvent &e);
00230 
00231     wxFileHistory m_mruFiles;
00232     wxNotebook * m_notebook;
00233     // tab panels
00234     ImagesPanel* images_panel;
00235     MaskEditorPanel* mask_panel;
00236     CPEditorPanel * cpe;
00237     OptimizePanel * opt_panel;
00238     bool m_show_opt_panel;
00239     OptimizePhotometricPanel * opt_photo_panel;
00240     bool m_show_opt_photo_panel;
00241     PanoPanel * pano_panel;
00242     struct celeste::svm_model* svmModel;
00243 
00244     // flying windows
00245     PreviewFrame * preview_frame;
00246     GLPreviewFrame * gl_preview_frame;
00247     CPListFrame * cp_frame;
00248     GuiLevel m_guiLevel;
00249 
00250     // Image Preview
00251     ImgPreview *canvas;
00252 
00253     // Preferences
00254     //PreferencesDialog * pref_dlg;
00255 
00256     // the model
00257     HuginBase::Panorama & pano;
00258 
00259     // filename of the current project
00260     wxString m_filename;
00261 
00262     // self
00263     static MainFrame* m_this;
00264     // file menu
00265     wxMenu* m_menu_file_simple;
00266     wxMenu* m_menu_file_advanced;
00267 
00268 #ifdef __WXMSW__
00269     wxCHMHelpController     m_msHtmlHelp;
00270 #endif
00271 
00272 #ifdef HUGIN_HSI
00273     // list associating the wxID in the menu with a python script
00274     std::map<int, wxFileName> m_plugins;
00275 #endif
00276 
00277     DECLARE_EVENT_TABLE()
00278 };
00279 
00280 #endif // _MAINFRAME_H

Generated on 3 Aug 2015 for Hugintrunk by  doxygen 1.4.7