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 #include "wx/help.h"
00036 #if !wxUSE_HELP
00037 #error wxWidgets needs to be compiled with help support (wxUSE_HELP not set)
00038 #endif
00039 #if defined __WXMSW__ && !(wxCHECK_VERSION(3,1,1))
00040 #include "base_wx/wxPlatform.h"
00041 #define wxHelpController HuginCHMHelpController
00042 #endif
00043 
00044 #include <appbase/ProgressDisplay.h>
00045 
00046 #include "hugin/OptimizePanel.h"
00047 #include "hugin/PreferencesDialog.h"
00048 
00049 // Celeste header
00050 #include "Celeste.h"
00051 #include "GuiLevel.h"
00052 
00053 // forward declarations, to save the #include statements
00054 class CPEditorPanel;
00055 class ImgPreview;
00056 class ImagesPanel;
00057 class MaskEditorPanel;
00058 class OptimizePhotometricPanel;
00059 class PanoPanel;
00060 class PreviewFrame;
00061 class GLPreviewFrame;
00062 class CPListFrame;
00063 
00065 class PanoDropTarget : public wxFileDropTarget
00066 {
00067 public:
00068     PanoDropTarget(HuginBase::Panorama & p, bool imageOnly = false)
00069         : pano(p)
00070     { m_imageOnly = imageOnly; }
00071 
00072     bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames);
00073 
00074 private:
00075     HuginBase::Panorama & pano;
00076     bool m_imageOnly;
00077 };
00078 
00087 class MainFrame : public wxFrame, public HuginBase::PanoramaObserver, public AppBase::ProgressDisplay
00088 {
00089 public:
00090 
00093     MainFrame(wxWindow* parent, HuginBase::Panorama & pano);
00094 
00097     virtual ~MainFrame();
00098 
00102     virtual void panoramaChanged(HuginBase::Panorama &pano);
00103     void panoramaImagesChanged(HuginBase::Panorama &pano, const HuginBase::UIntSet & imgNr);
00105     const HuginBase::Panorama & getPanorama() { return pano; };
00106 
00107     // called when a control point in CPListFrame is selected
00108     void ShowCtrlPoint(unsigned int cpNr);
00109 
00111     const wxString & GetXRCPath();
00113     const wxString & GetDataPath();
00115     void SetOptimizeOnlyActiveImages(const bool onlyActive);
00116     const bool GetOptimizeOnlyActiveImages() const;
00117 
00119     static MainFrame * Get();
00120 
00121     // Used to display tip of the day after main interface is initialised and visible
00122         void OnTipOfDay(wxCommandEvent & e);
00123 
00124     // load a project
00125     void LoadProjectFile(const wxString & filename);
00126     void RunAssistant(wxWindow* mainWin);
00127 
00129     void DisableOpenGLTools();
00130 #ifdef __WXMAC__
00131     void MacOnOpenFile(const wxString & filename);
00132 #endif
00133     bool CloseProject(bool cancelable);
00134 
00135     // TODO: create a nice generic optimisation & stitching function
00136     // instead of these gateway functions to the optimizer and pano panels.
00137     void OnOptimize(wxCommandEvent & e);
00138     void OnOnlyActiveImages(wxCommandEvent &e);
00139     void OnPhotometricOptimize(wxCommandEvent & e);
00140     void OnDoStitch(wxCommandEvent & e);
00141     void OnUserDefinedStitch(wxCommandEvent & e);
00142     void OnTogglePreviewFrame(wxCommandEvent & e);
00143     void OnToggleGLPreviewFrame(wxCommandEvent & e);
00144     void OnAddImages(wxCommandEvent & e);
00145     void OnSaveProject(wxCommandEvent & e);
00146     void OnSetGuiSimple(wxCommandEvent & e);
00147     void OnSetGuiAdvanced(wxCommandEvent & e);
00148     void OnSetGuiExpert(wxCommandEvent & e);
00149 
00151     void DisplayHelp(wxString section = wxEmptyString);
00152 
00154     void ShowCtrlPointEditor(unsigned int img1, unsigned int img2);
00156     void ShowMaskEditor(size_t imgNr);
00158     void ShowStitcherTab();
00159 
00160     void OnCPListFrameClosed();
00162     CPDetectorSetting& GetDefaultSetting();
00164     void RunCPGenerator(CPDetectorSetting &setting, const HuginBase::UIntSet& img);
00166     void RunCPGenerator(const HuginBase::UIntSet& img);
00168     const wxString GetSelectedCPGenerator();
00169 
00170     wxString getProjectName();
00171 
00172     struct celeste::svm_model* GetSVMModel();
00173     
00174     GLPreviewFrame * getGLPreview();
00175     wxHelpController& GetHelpController() { return m_HelpController; }
00176     void SetGuiLevel(GuiLevel newLevel);
00177     const GuiLevel GetGuiLevel() const { return m_guiLevel; };
00178 
00179     wxFileHistory* GetFileHistory() { return &m_mruFiles; };
00180 
00182     wxString GetCurrentOptimizerString();
00183 
00184 protected:
00185     // called when a progress message should be displayed
00191     void updateProgressDisplay();
00192 
00193 private:
00194 
00195     // event handlers
00196     void OnExit(wxCloseEvent & e);
00197     void OnUserQuit(wxCommandEvent & e);
00198     void OnAbout(wxCommandEvent & e);
00199     void OnHelp(wxCommandEvent & e);
00200     void OnKeyboardHelp(wxCommandEvent & e);
00201     void OnFAQ(wxCommandEvent & e);
00202     void OnShowPrefs(wxCommandEvent &e);
00203 #ifdef HUGIN_HSI
00204     void OnPythonScript(wxCommandEvent & e);
00205     void OnPlugin(wxCommandEvent& e);
00206 #endif
00207     void OnUndo(wxCommandEvent & e);
00208     void OnRedo(wxCommandEvent & e);
00209     void OnSaveProjectAs(wxCommandEvent & e);
00210     void OnSavePTStitcherAs(wxCommandEvent & e);
00211     void OnLoadProject(wxCommandEvent & e);
00212     void OnNewProject(wxCommandEvent & e);
00213     void OnAddTimeImages(wxCommandEvent & e);
00214     void OnRunAssistant(wxCommandEvent & e);
00215     void OnFineTuneAll(wxCommandEvent & e);
00216     void OnRemoveCPinMasks(wxCommandEvent & e);
00217     void OnMergeProject(wxCommandEvent & e);
00218     void OnReadPapywizard(wxCommandEvent & e);
00219     void OnApplyTemplate(wxCommandEvent & e);
00220     void OnSendToBatch(wxCommandEvent & e);
00221     void OnSendToAssistantQueue(wxCommandEvent & e);
00222     void OnOpenPTBatcher(wxCommandEvent & e);
00223 //    void OnToggleOptimizeFrame(wxCommandEvent & e);
00224     void OnShowCPFrame(wxCommandEvent & e);
00226     void OnMRUFiles(wxCommandEvent &e);
00228     void OnFullScreen(wxCommandEvent &e);
00229     void UpdatePanels(wxCommandEvent & e);
00230     void OnSize(wxSizeEvent &e);
00231     void enableTools(bool option);
00233     void AddImages(wxArrayString& filenameArray);
00234 
00235     void OnShowDonate(wxCommandEvent &e);
00236     void OnShowPanel(wxCommandEvent &e);
00238     void OnLoadingFailed(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     // help controller
00279     wxHelpController m_HelpController;
00280 
00281 #ifdef HUGIN_HSI
00282     // list associating the wxID in the menu with a python script
00283     std::map<int, wxFileName> m_plugins;
00284 #endif
00285 
00286     DECLARE_EVENT_TABLE()
00287 };
00288 
00289 // event used to signal invalid or missing image files
00290 #if defined _WIN32 && defined Hugin_shared
00291 DECLARE_LOCAL_EVENT_TYPE(EVT_LOADING_FAILED, -1)
00292 #else
00293 DECLARE_EVENT_TYPE(EVT_LOADING_FAILED, -1)
00294 #endif
00295 
00296 #endif // _MAINFRAME_H

Generated on 3 Dec 2016 for Hugintrunk by  doxygen 1.4.7