[an error occurred while processing this directive]
Main Page | Modules | Namespace List | Class Hierarchy | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

hugin1/hugin/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 
00031 #include "common/utils.h"
00032 #include "PT/Panorama.h"
00033 
00034 #include "wx/docview.h"
00035 
00036 #include "hugin/OptimizePanel.h"
00037 #include "hugin/PreferencesDialog.h"
00038 
00039 using namespace PT;
00040 
00041 // forward declarations, to save the #include statements
00042 class AssistantPanel;
00043 class CPEditorPanel;
00044 class LensPanel;
00045 class ImgPreview;
00046 class ImagesPanel;
00047 class CropPanel;
00048 class MaskEditorPanel;
00049 class OptimizePhotometricPanel;
00050 class PanoPanel;
00051 class PreviewFrame;
00052 class GLPreviewFrame;
00053 class CPListFrame;
00054 
00055 
00057 class PanoDropTarget : public wxFileDropTarget
00058 {
00059 public:
00060     PanoDropTarget(PT::Panorama & p, bool imageOnly = false)
00061         : pano(p)
00062     { m_imageOnly = imageOnly; }
00063 
00064     bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString& filenames);
00065 
00066 private:
00067     PT::Panorama & pano;
00068     bool m_imageOnly;
00069 };
00070 
00071 
00080 class MainFrame : public wxFrame, public PT::PanoramaObserver, public utils::MultiProgressDisplay, public utils::ProgressReporter
00081 {
00082 public:
00083 
00086     MainFrame(wxWindow* parent, PT::Panorama & pano);
00087 
00090     virtual ~MainFrame();
00091 
00107 // virtual void panoramaChanged(PT::Panorama &pano);
00108     void panoramaImagesChanged(PT::Panorama &pano, const PT::UIntSet & imgNr);
00109 
00110     // called when a control point in CPListFrame is selected
00111     void ShowCtrlPoint(unsigned int cpNr);
00112 
00114     const wxString & GetXRCPath();
00115 
00117     static MainFrame * Get();
00118 
00119     // Used to display tip of the day after main interface is initialised and visible
00120         void OnTipOfDay(wxCommandEvent & e);
00121 
00122     // load a project
00123     void LoadProjectFile(const wxString & filename);
00124         
00125     // Restore the layout
00126     void RestoreLayout();
00127     
00129     void RestoreLayoutOnNextResize();
00130     
00131 
00132 #ifdef __WXMAC__
00133     void MacOnOpenFile(const wxString & filename);
00134 #endif
00135     bool CloseProject(bool cnacelable);
00136 
00137     // TODO: create a nice generic optimisation & stitching function
00138     // instead of these gateway functions to the optimizer and pano panels.
00139     void OnOptimize(wxCommandEvent & e);
00140     void OnDoStitch(wxCommandEvent & e);
00141     void OnTogglePreviewFrame(wxCommandEvent & e);
00142     void OnToggleGLPreviewFrame(wxCommandEvent & e);
00143     void OnAddImages(wxCommandEvent & e);
00144     void OnSaveProject(wxCommandEvent & e);
00145 
00146 
00147     void ShowCtrlPointEditor(unsigned int img1, unsigned int img2);
00148 
00149     void resetProgress(double max);
00150     bool increaseProgress(double delta);
00151     bool increaseProgress(double delta, const std::string & msg);
00152     void setMessage(const std::string & msg);
00153 
00154     void OnCPListFrameClosed();
00156     CPDetectorSetting& GetDefaultSetting();
00157 
00158     wxString getProjectName();
00159 
00160 protected:
00161     // called when a progress message should be displayed
00167     void updateProgressDisplay();
00168 
00169 private:
00170 
00171     // event handlers
00172     void OnExit(wxCloseEvent & e);
00173     void OnUserQuit(wxCommandEvent & e);
00174     void OnAbout(wxCommandEvent & e);
00175     void OnHelp(wxCommandEvent & e);
00176     void OnKeyboardHelp(wxCommandEvent & e);
00177     void OnFAQ(wxCommandEvent & e);
00178     void OnShowPrefs(wxCommandEvent &e);
00179     void OnUndo(wxCommandEvent & e);
00180     void OnRedo(wxCommandEvent & e);
00181     void OnSaveProjectAs(wxCommandEvent & e);
00182     void OnSavePTStitcherAs(wxCommandEvent & e);
00183     void OnLoadProject(wxCommandEvent & e);
00184     void OnNewProject(wxCommandEvent & e);
00185     void OnAddTimeImages(wxCommandEvent & e);
00186     void OnFineTuneAll(wxCommandEvent & e);
00187     void OnRemoveCPinMasks(wxCommandEvent & e);
00188     void OnMergeProject(wxCommandEvent & e);
00189     void OnApplyTemplate(wxCommandEvent & e);
00190         void OnSendToBatch(wxCommandEvent & e);
00191         void OnOpenPTBatcher(wxCommandEvent & e);
00192 //    void OnToggleOptimizeFrame(wxCommandEvent & e);
00193     void OnShowCPFrame(wxCommandEvent & e);
00195     void OnMRUFiles(wxCommandEvent &e);
00197     void OnFullScreen(wxCommandEvent &e);
00198     void UpdatePanels(wxCommandEvent & e);
00199     void OnSize(wxSizeEvent &e);
00200     void enableTools(bool option);
00201 
00202     void DisplayHelp(wxString section);
00203     void OnShowDonate(wxCommandEvent &e);
00204     void OnShowPanel(wxCommandEvent &e);
00205 
00206     // update progress display
00207     bool displayProgress();
00208 
00209     wxFileHistory m_mruFiles;
00210     wxNotebook * m_notebook;
00211     // tab panels
00212     AssistantPanel* assistant_panel;
00213     ImagesPanel* images_panel;
00214     LensPanel* lens_panel;
00215     CropPanel* crop_panel;
00216     MaskEditorPanel* mask_panel;
00217     CPEditorPanel * cpe;
00218     OptimizePanel * opt_panel;
00219     OptimizePhotometricPanel * opt_photo_panel;
00220     PanoPanel * pano_panel;
00221 
00222     // flying windows
00223     PreviewFrame * preview_frame;
00224     GLPreviewFrame * gl_preview_frame;
00225     CPListFrame * cp_frame;
00226 
00227     // Image Preview
00228     ImgPreview *canvas;
00229 
00230     // Preferences
00231     //PreferencesDialog * pref_dlg;
00232 
00233     // the model
00234     PT::Panorama & pano;
00235 
00236     // filename of the current project
00237     wxString m_filename;
00238 
00239 
00240     bool m_doRestoreLayout;
00241 
00242     // self
00243     static MainFrame* m_this;
00244 
00245     // progress reporter
00246     double m_progressMax;
00247     double m_progress;
00248     wxString m_progressMsg;
00249 
00250     DECLARE_EVENT_TABLE()
00251 };
00252 
00253 bool getLensDataFromUser(wxWindow * parent, SrcPanoImage & srcImg,
00254                          double & focalLength, double & cropFactor);
00255 
00256 #endif // _MAINFRAME_H

Generated on Mon Sep 20 01:01:26 2010 for Hugintrunk by doxygen 1.3.9.1