Hugin trunk 0.1
Loading...
Searching...
No Matches
MainFrame.h
Go to the documentation of this file.
1// -*- c-basic-offset: 4 -*-
24#ifndef _MAINFRAME_H
25#define _MAINFRAME_H
26
27
28#include <vector>
29#include <set>
30#include <map>
31
32#include "panodata/Panorama.h"
33
34#include "wx/docview.h"
35#include "wx/help.h"
36#if !wxUSE_HELP
37#error wxWidgets needs to be compiled with help support (wxUSE_HELP not set)
38#endif
39
41
42#include "hugin/OptimizePanel.h"
44
45// Celeste header
46#include "Celeste.h"
47#include "GuiLevel.h"
48
49// forward declarations, to save the #include statements
50class CPEditorPanel;
51class ImgPreview;
52class ImagesPanel;
53class MaskEditorPanel;
55class PanoPanel;
56class PreviewFrame;
57class GLPreviewFrame;
58class CPListFrame;
59
61class PanoDropTarget : public wxFileDropTarget
62{
63public:
67
69
70private:
73};
74
84{
85public:
86
90
93 virtual ~MainFrame();
94
101 const HuginBase::Panorama & getPanorama() { return pano; };
102
103 // called when a control point in CPListFrame is selected
104 void ShowCtrlPoint(unsigned int cpNr);
105
107 const wxString & GetXRCPath();
109 const wxString & GetDataPath();
112 const bool GetOptimizeOnlyActiveImages() const;
114 void SetOptimizeIgnoreLineCp(const bool ignoreLineCP);
115 const bool GetOptimizeIgnoreLineCp() const;
116
118 static MainFrame * Get();
119
120 // Used to display tip of the day after main interface is initialised and visible
121 void OnTipOfDay(wxCommandEvent & e);
122
123 // load a project
124 void LoadProjectFile(const wxString & filename);
126
128 void DisableOpenGLTools();
129#ifdef __WXMAC__
130 void MacOnOpenFile(const wxString & filename);
131#endif
139
140 // TODO: create a nice generic optimisation & stitching function
141 // instead of these gateway functions to the optimizer and pano panels.
142 void OnOptimize(wxCommandEvent & e);
143 void OnOnlyActiveImages(wxCommandEvent &e);
144 void OnIgnoreLineCp(wxCommandEvent &e);
145 void OnPhotometricOptimize(wxCommandEvent & e);
146 void OnDoStitch(wxCommandEvent & e);
147 void OnUserDefinedStitch(wxCommandEvent & e);
148 void OnUserDefinedStitchSaved(wxCommandEvent & e);
149 void OnTogglePreviewFrame(wxCommandEvent & e);
150 void OnToggleGLPreviewFrame(wxCommandEvent & e);
151 void OnAddImages(wxCommandEvent & e);
152 void OnSaveProject(wxCommandEvent & e);
153 void OnSetGuiSimple(wxCommandEvent & e);
154 void OnSetGuiAdvanced(wxCommandEvent & e);
155 void OnSetGuiExpert(wxCommandEvent & e);
156
159
161 void ShowCtrlPointEditor(unsigned int img1, unsigned int img2);
163 void ShowMaskEditor(size_t imgNr, bool switchToCropMode = false);
165 void ShowStitcherTab();
166
167 void OnCPListFrameClosed();
173 void RunCPGenerator(const HuginBase::UIntSet& img);
176
178 bool IsShowingCorrelation() const;
179
181
185 const GuiLevel GetGuiLevel() const { return m_guiLevel; };
186
188
191
192protected:
193 // called when a progress message should be displayed
200
201private:
202
203 // event handlers
204 void OnExit(wxCloseEvent & e);
205 void OnUserQuit(wxCommandEvent & e);
206 void OnAbout(wxCommandEvent & e);
207 void OnHelp(wxCommandEvent & e);
208 void OnKeyboardHelp(wxCommandEvent & e);
209 void OnFAQ(wxCommandEvent & e);
210 void OnShowPrefs(wxCommandEvent &e);
211#ifdef HUGIN_HSI
212 void OnPythonScript(wxCommandEvent & e);
213 void OnPlugin(wxCommandEvent& e);
214#endif
215 void OnUndo(wxCommandEvent & e);
216 void OnRedo(wxCommandEvent & e);
217 void OnSaveProjectAs(wxCommandEvent & e);
218 void OnSavePTStitcherAs(wxCommandEvent & e);
219 void OnLoadProject(wxCommandEvent & e);
220 void OnBrowseProjects(wxCommandEvent & e);
221 void OnNewProject(wxCommandEvent & e);
222 void OnAddTimeImages(wxCommandEvent & e);
223 void OnRunAssistant(wxCommandEvent & e);
224 void OnRunAssistantUserdefined(wxCommandEvent & e);
225 void OnFineTuneAll(wxCommandEvent & e);
226 void OnRemoveCPinMasks(wxCommandEvent & e);
227 void OnMergeProject(wxCommandEvent & e);
228 void OnReadPapywizard(wxCommandEvent & e);
229 void OnApplyTemplate(wxCommandEvent & e);
230 void OnSendToBatch(wxCommandEvent & e);
231 void OnSendToAssistantQueue(wxCommandEvent & e);
232 void OnOpenPTBatcher(wxCommandEvent & e);
233// void OnToggleOptimizeFrame(wxCommandEvent & e);
234 void OnShowCPFrame(wxCommandEvent & e);
236 void OnMRUFiles(wxCommandEvent &e);
238 void OnFullScreen(wxCommandEvent &e);
239 void OnSize(wxSizeEvent &e);
240 void enableTools(bool option);
243
244 void OnShowPanel(wxCommandEvent &e);
246 void OnLoadingFailed(wxCommandEvent& e);
247
250 // tab panels
260
261 // flying windows
266
267 // Image Preview
269
270 // Preferences
271 //PreferencesDialog * pref_dlg;
272
273 // the model
275
276 // filename of the current project
278 // true, if cp errors contains correlation instead of error
280
281 // self
283 // file menu
288 // sticky setting, to prevent reading to often
291 // help controller
293
294#ifdef HUGIN_HSI
295 // list associating the wxID in the menu with a python script
296 std::map<int, wxFileName> m_plugins;
297#endif
298 // list for user-defined output sequences
299 std::map<int, wxString> m_userOutput;
300 std::map<int, wxString> m_userAssistant;
301};
302
303// event used to signal invalid or missing image files
305
306#endif // _MAINFRAME_H
declaration of helper for work with different GuiLevels
GuiLevel
Definition GuiLevel.h:32
wxDECLARE_EVENT(EVT_LOADING_FAILED, wxCommandEvent)
class, which stores all settings of one cp detector
control point editor panel.
The OpenGL preview frame.
this handler class will receive change events from the Panorama.
Model for a panorama.
Definition Panorama.h:153
Hugin's first panel.
Definition ImagesPanel.h:41
The main window frame.
Definition MainFrame.h:84
void OnTogglePreviewFrame(wxCommandEvent &e)
PanoPanel * pano_panel
Definition MainFrame.h:258
bool m_show_opt_panel
Definition MainFrame.h:255
void ShowCtrlPoint(unsigned int cpNr)
wxFileHistory * GetFileHistory()
Definition MainFrame.h:187
void OnFAQ(wxCommandEvent &e)
void OnLoadingFailed(wxCommandEvent &e)
event handler called when loading of image file failed
bool m_optIgnoreLineCp
Definition MainFrame.h:290
void OnMRUFiles(wxCommandEvent &e)
event handler for recently used files
static MainFrame * Get()
hack.. kind of a pseudo singleton...
void OnSaveProject(wxCommandEvent &e)
virtual ~MainFrame()
dtor.
void AddImages(wxArrayString &filenameArray)
adds the given files to the projects, with checking for invalid filenames
void SetGuiLevel(GuiLevel newLevel)
bool m_optOnlyActiveImages
Definition MainFrame.h:289
bool m_show_opt_photo_panel
Definition MainFrame.h:257
void updateProgressDisplay()
receive notification about progress.
void OnShowPrefs(wxCommandEvent &e)
void LoadProjectFile(const wxString &filename)
void OnTipOfDay(wxCommandEvent &e)
void OnDoStitch(wxCommandEvent &e)
void OnRunAssistantUserdefined(wxCommandEvent &e)
void OnShowCPFrame(wxCommandEvent &e)
std::map< int, wxString > m_userOutput
Definition MainFrame.h:299
void DisableOpenGLTools()
disables all OpenGL related menu items and toobar buttons
void OnSendToBatch(wxCommandEvent &e)
void ShowCtrlPointEditor(unsigned int img1, unsigned int img2)
opens the control points tab with the both images selected
const GuiLevel GetGuiLevel() const
Definition MainFrame.h:185
void OnKeyboardHelp(wxCommandEvent &e)
GLPreviewFrame * gl_preview_frame
Definition MainFrame.h:263
const wxString & GetXRCPath()
get the path to the xrc directory
HuginBase::Panorama & pano
Definition MainFrame.h:274
void OnPhotometricOptimize(wxCommandEvent &e)
void OnOpenPTBatcher(wxCommandEvent &e)
void OnSendToAssistantQueue(wxCommandEvent &e)
PreviewFrame * preview_frame
Definition MainFrame.h:262
void OnAbout(wxCommandEvent &e)
void OnAddImages(wxCommandEvent &e)
struct celeste::svm_model * svmModel
Definition MainFrame.h:259
GuiLevel m_guiLevel
Definition MainFrame.h:265
void OnToggleGLPreviewFrame(wxCommandEvent &e)
wxMenu * m_menu_file_simple
Definition MainFrame.h:284
void OnRemoveCPinMasks(wxCommandEvent &e)
std::map< int, wxString > m_userAssistant
Definition MainFrame.h:300
void OnHelp(wxCommandEvent &e)
wxHelpController & GetHelpController()
Definition MainFrame.h:183
wxString m_filename
Definition MainFrame.h:277
ImgPreview * canvas
Definition MainFrame.h:268
void OnUserQuit(wxCommandEvent &e)
void RunCPGenerator(CPDetectorSetting &setting, const HuginBase::UIntSet &img)
run the cp generator with the given setting on selected images
void OnOnlyActiveImages(wxCommandEvent &e)
void OnSetGuiSimple(wxCommandEvent &e)
void RunAssistant(wxWindow *mainWin, const wxString &userdefinedAssistant=wxEmptyString)
void ShowMaskEditor(size_t imgNr, bool switchToCropMode=false)
opens the mask/crop editor with the given image selected
void OnSetGuiAdvanced(wxCommandEvent &e)
wxString getProjectName()
void OnNewProject(wxCommandEvent &e)
static MainFrame * m_this
Definition MainFrame.h:282
void OnMergeProject(wxCommandEvent &e)
void OnReadPapywizard(wxCommandEvent &e)
void OnOptimize(wxCommandEvent &e)
const bool GetOptimizeIgnoreLineCp() const
wxMenuItem * m_assistantUserMenu
Definition MainFrame.h:287
CPListFrame * cp_frame
Definition MainFrame.h:264
OptimizePanel * opt_panel
Definition MainFrame.h:254
wxMenuItem * m_outputUserMenu
Definition MainFrame.h:286
bool IsShowingCorrelation() const
void OnFullScreen(wxCommandEvent &e)
event handler for full screen
MaskEditorPanel * mask_panel
Definition MainFrame.h:252
void OnLoadProject(wxCommandEvent &e)
wxHelpController m_HelpController
Definition MainFrame.h:292
virtual void panoramaChanged(HuginBase::Panorama &pano)
Enable or disable undo and redo.
wxString GetCurrentOptimizerString()
returns the string which describes the current selected optimizer setting
void DisplayHelp(wxString section=wxEmptyString)
call help browser with given file
void OnRunAssistant(wxCommandEvent &e)
void OnCPListFrameClosed()
void OnUndo(wxCommandEvent &e)
bool CloseProject(bool cancelable, CloseReason reason)
void enableTools(bool option)
wxFileHistory m_mruFiles
Definition MainFrame.h:248
const wxString GetSelectedCPGenerator()
return the currently selected cp generator description
void OnFineTuneAll(wxCommandEvent &e)
void OnUserDefinedStitch(wxCommandEvent &e)
wxNotebook * m_notebook
Definition MainFrame.h:249
void SetOptimizeIgnoreLineCp(const bool ignoreLineCP)
sets the status of the "ignore line cp" menu item
const HuginBase::Panorama & getPanorama()
returns panorama object
Definition MainFrame.h:101
void OnRedo(wxCommandEvent &e)
const wxString & GetDataPath()
get the path to data directory
void OnIgnoreLineCp(wxCommandEvent &e)
struct celeste::svm_model * GetSVMModel()
void OnSavePTStitcherAs(wxCommandEvent &e)
void panoramaImagesChanged(HuginBase::Panorama &pano, const HuginBase::UIntSet &imgNr)
notifies about changes to images
GLPreviewFrame * getGLPreview()
void OnSetGuiExpert(wxCommandEvent &e)
void OnAddTimeImages(wxCommandEvent &e)
ImagesPanel * images_panel
Definition MainFrame.h:251
const bool GetOptimizeOnlyActiveImages() const
void OnSize(wxSizeEvent &e)
OptimizePhotometricPanel * opt_photo_panel
Definition MainFrame.h:256
void OnBrowseProjects(wxCommandEvent &e)
CPEditorPanel * cpe
Definition MainFrame.h:253
void OnShowPanel(wxCommandEvent &e)
CPDetectorSetting & GetDefaultSetting()
returns default cp detector setting
void ShowStitcherTab()
opens the stitcher tab
void OnUserDefinedStitchSaved(wxCommandEvent &e)
@ CLOSE_PROGRAM
Definition MainFrame.h:134
@ LOAD_NEW_PROJECT
Definition MainFrame.h:135
int m_showCorrelation
Definition MainFrame.h:279
void OnApplyTemplate(wxCommandEvent &e)
void SetOptimizeOnlyActiveImages(const bool onlyActive)
sets the status of the "optimize only active images" menu item
void OnExit(wxCloseEvent &e)
wxMenu * m_menu_file_advanced
Definition MainFrame.h:285
void OnSaveProjectAs(wxCommandEvent &e)
mask editor panel.
run the optimizer.
simple class that forward the drop to the mainframe
Definition MainFrame.h:62
PanoDropTarget(HuginBase::Panorama &p, bool imageOnly=false)
Definition MainFrame.h:64
bool OnDropFiles(wxCoord x, wxCoord y, const wxArrayString &filenames)
file drag and drop handler method
HuginBase::Panorama & pano
Definition MainFrame.h:71
Define the pano edit panel.
Definition PanoPanel.h:44
The image preview frame.
std::set< unsigned int > UIntSet
std::vector< deghosting::BImagePtr > threshold(const std::vector< deghosting::FImagePtr > &inputImages, const double threshold, const uint16_t flags)
Threshold function used for creating alpha masks for images.
Definition threshold.h:41