Hugintrunk  0.1
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
huginApp.h
Go to the documentation of this file.
1 // -*- c-basic-offset: 4 -*-
24 #ifndef _HUGINAPP_H
25 #define _HUGINAPP_H
26 
27 #include "hugin_config.h"
28 #include <huginapp/ImageCache.h>
29 #include <lcms2.h>
31 
32 #include "hugin/MainFrame.h"
33 
34 // utility functions
36 
38 void StoreFramePosition(wxTopLevelWindow * frame, const wxString & basename);
40 void RestoreFramePosition(wxTopLevelWindow * frame, const wxString & basename);
41 
46 #ifdef _INCLUDE_UI_RESOURCES
47  void InitXmlResource();
48 #endif
49 
50 
55 class ImageReadyEvent : public wxEvent
56 {
57 public:
60 
62  virtual wxEvent* Clone() const;
63 };
64 wxDECLARE_EVENT(EVT_IMAGE_READY, ImageReadyEvent);
65 
70 class huginApp : public wxApp
71 {
72 public:
73 
76  huginApp();
77 
80  virtual ~huginApp();
81 
84  virtual bool OnInit();
85 
87  virtual int OnExit();
88 
90  static huginApp * Get();
91  static MainFrame* getMainFrame();
92 
94  void relayImageLoaded(ImageReadyEvent & event);
95 
99 
101  wxLocale & GetLocale()
102  {
103  return locale;
104  }
105 
106  wxString GetWorkDir()
107  {
108  return m_workDir;
109  }
110 
112  const wxString & GetXRCPath()
113  {
114  return m_xrcPrefix;
115  }
116 
118  const wxString & GetDataPath()
119  {
120  return m_DataDir;
121  }
122 
123  const wxString & GetUtilsBinDir()
124  {
125  return m_utilsBinDir;
126  }
127 
129  const cmsHPROFILE GetMonitorProfile() const
130  {
131  return m_monitorProfile;
132  }
134  bool HasMonitorProfile() const
135  {
136  return !m_monitorProfileName.IsEmpty();
137  }
139  const wxString& GetMonitorProfileName() const
140  {
141  return m_monitorProfileName;
142  };
143 
144 #ifdef __WXMAC__
145  //Defined in wxApp.h; This one lets project file to be opened from Finder and other applications.
146  void MacOpenFile(const wxString &fileName);
147 #endif
148 
149 #if wxUSE_ON_FATAL_EXCEPTION
150  virtual void OnFatalException() wxOVERRIDE;
151 #endif
152 
153 private:
155  wxLocale locale;
156 
158  wxString m_workDir;
159 
161 
162  // self
163  static huginApp * m_this;
164 
165  // the model
167 
168  // folder for xrc (GUI resources)
169  wxString m_xrcPrefix;
170  // folder for data shared by CLI and GUI to enable separate packaging of CLI tools
171  wxString m_DataDir;
172  // folder for CLI tools
173  wxString m_utilsBinDir;
174  // monitor profile
176  cmsHPROFILE m_monitorProfile;
177 
178 #ifdef __WXMAC__
179  bool m_macInitDone;
180  bool m_macOpenFileOnStart;
181  wxString m_macFileNameToOpenOnStart;
182 #endif
183 };
184 
185 DECLARE_APP(huginApp)
186 
187 #endif // _HUGINAPP_H
static huginApp * m_this
Definition: huginApp.h:163
The application class for hugin.
Definition: huginApp.h:70
const wxString & GetDataPath()
return the current data path
Definition: huginApp.h:118
virtual bool OnInit()
pseudo constructor.
Definition: huginApp.cpp:188
HuginBase::Panorama pano
Definition: huginApp.h:166
cmsHPROFILE m_monitorProfile
Definition: huginApp.h:176
void relayImageLoaded(ImageReadyEvent &event)
Relay image loaded event when the UI thread is ready to process it.
Definition: huginApp.cpp:665
MainFrame * frame
Definition: huginApp.h:160
const cmsHPROFILE GetMonitorProfile() const
returns the monitor profile, if no monitor profile was found the sRGB profile is used instead ...
Definition: huginApp.h:129
huginApp()
ctor.
Definition: huginApp.cpp:157
wxString m_DataDir
Definition: huginApp.h:171
virtual wxEvent * Clone() const
Definition: huginApp.cpp:152
wxString m_monitorProfileName
Definition: huginApp.h:175
std::vector< HuginBase::UIntSet > Components
stores the components of the graph
Definition: ImageGraph.h:50
static huginApp * Get()
hack.. kind of a pseudo singleton...
Definition: huginApp.cpp:645
The main window frame.
Definition: MainFrame.h:83
Model for a panorama.
Definition: Panorama.h:152
wxString m_xrcPrefix
Definition: huginApp.h:169
HuginBase::ImageCache::EntryPtr entry
Definition: huginApp.h:59
std::shared_ptr< Entry > EntryPtr
a shared pointer to the entry
Definition: ImageCache.h:112
void StoreFramePosition(wxTopLevelWindow *frame, const wxString &basename)
Store window size and position in configfile/registry.
Definition: LensCalApp.cpp:210
static MainFrame * getMainFrame()
Definition: huginApp.cpp:656
std::shared_ptr< Request > RequestPtr
Reference counted request for an image to load.
Definition: ImageCache.h:151
wxString m_utilsBinDir
Definition: huginApp.h:173
bool HasMonitorProfile() const
return true if we found a suitable monitor profile and could loading it
Definition: huginApp.h:134
wxDECLARE_EVENT(wxEVT_COMMAND_THUMBNAILTHREAD_UPDATE, wxCommandEvent)
void RestoreFramePosition(wxTopLevelWindow *frame, const wxString &basename)
Restore window size and position from configfile/registry.
Definition: LensCalApp.cpp:156
const wxString & GetMonitorProfileName() const
return filename of monitor profile
Definition: huginApp.h:139
const wxString & GetUtilsBinDir()
Definition: huginApp.h:123
ImageReadyEvent(HuginBase::ImageCache::RequestPtr request, HuginBase::ImageCache::EntryPtr entry)
Definition: huginApp.cpp:148
wxString m_workDir
temporary working directory
Definition: huginApp.h:158
virtual ~huginApp()
dtor.
Definition: huginApp.cpp:168
virtual int OnExit()
just for testing purposes
Definition: huginApp.cpp:638
wxString GetWorkDir()
Definition: huginApp.h:106
wxLocale & GetLocale()
return currently active locale
Definition: huginApp.h:101
const wxString & GetXRCPath()
return the current xrc path
Definition: huginApp.h:112
HuginBase::ImageCache::RequestPtr request
Definition: huginApp.h:58
wxString Components2Str(const HuginGraph::ImageGraph::Components &comp)
Definition: huginApp.cpp:83
Resources Definition.
Definition: huginApp.h:55
static void imageLoadedAsync(HuginBase::ImageCache::RequestPtr request, HuginBase::ImageCache::EntryPtr entry)
Queue up an image loaded event when an image has just loaded.
Definition: huginApp.cpp:682
wxLocale locale
locale for internationalisation
Definition: huginApp.h:142