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 
41 class ImageReadyEvent : public wxEvent
42 {
43 public:
46 
48  virtual wxEvent* Clone() const;
49 };
50 wxDECLARE_EVENT(EVT_IMAGE_READY, ImageReadyEvent);
51 
56 class huginApp : public wxApp
57 {
58 public:
59 
62  huginApp();
63 
66  virtual ~huginApp();
67 
70  virtual bool OnInit();
71 
73  virtual int OnExit();
74 
76  static huginApp * Get();
77  static MainFrame* getMainFrame();
78 
80  void relayImageLoaded(ImageReadyEvent & event);
81 
85 
87  wxLocale & GetLocale()
88  {
89  return locale;
90  }
91 
92  wxString GetWorkDir()
93  {
94  return m_workDir;
95  }
96 
98  const wxString & GetXRCPath()
99  {
100  return m_xrcPrefix;
101  }
102 
104  const wxString & GetDataPath()
105  {
106  return m_DataDir;
107  }
108 
109  const wxString & GetUtilsBinDir()
110  {
111  return m_utilsBinDir;
112  }
113 
115  const cmsHPROFILE GetMonitorProfile() const
116  {
117  return m_monitorProfile;
118  }
120  bool HasMonitorProfile() const
121  {
122  return !m_monitorProfileName.IsEmpty();
123  }
125  const wxString& GetMonitorProfileName() const
126  {
127  return m_monitorProfileName;
128  };
129 
130 #ifdef __WXMAC__
131  //Defined in wxApp.h; This one lets project file to be opened from Finder and other applications.
132  void MacOpenFile(const wxString &fileName);
133 #endif
134 
135 #if wxUSE_ON_FATAL_EXCEPTION
136  virtual void OnFatalException() wxOVERRIDE;
137 #endif
138 
139 private:
141  wxLocale locale;
142 
144  wxString m_workDir;
145 
147 
148  // self
149  static huginApp * m_this;
150 
151  // the model
153 
154  // folder for xrc (GUI resources)
155  wxString m_xrcPrefix;
156  // folder for data shared by CLI and GUI to enable separate packaging of CLI tools
157  wxString m_DataDir;
158  // folder for CLI tools
159  wxString m_utilsBinDir;
160  // monitor profile
162  cmsHPROFILE m_monitorProfile;
163 
164 #ifdef __WXMAC__
165  bool m_macInitDone;
166  bool m_macOpenFileOnStart;
167  wxString m_macFileNameToOpenOnStart;
168 #endif
169 };
170 
171 DECLARE_APP(huginApp)
172 
173 #endif // _HUGINAPP_H
static huginApp * m_this
Definition: huginApp.h:149
The application class for hugin.
Definition: huginApp.h:56
const wxString & GetDataPath()
return the current data path
Definition: huginApp.h:104
virtual bool OnInit()
pseudo constructor.
Definition: huginApp.cpp:189
HuginBase::Panorama pano
Definition: huginApp.h:152
cmsHPROFILE m_monitorProfile
Definition: huginApp.h:162
void relayImageLoaded(ImageReadyEvent &event)
Relay image loaded event when the UI thread is ready to process it.
Definition: huginApp.cpp:672
MainFrame * frame
Definition: huginApp.h:146
const cmsHPROFILE GetMonitorProfile() const
returns the monitor profile, if no monitor profile was found the sRGB profile is used instead ...
Definition: huginApp.h:115
huginApp()
ctor.
Definition: huginApp.cpp:158
wxString m_DataDir
Definition: huginApp.h:157
virtual wxEvent * Clone() const
Definition: huginApp.cpp:153
wxString m_monitorProfileName
Definition: huginApp.h:161
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:652
The main window frame.
Definition: MainFrame.h:83
Model for a panorama.
Definition: Panorama.h:152
wxString m_xrcPrefix
Definition: huginApp.h:155
HuginBase::ImageCache::EntryPtr entry
Definition: huginApp.h:45
std::shared_ptr< Entry > EntryPtr
a shared pointer to the entry
Definition: ImageCache.h:112
static MainFrame * getMainFrame()
Definition: huginApp.cpp:663
std::shared_ptr< Request > RequestPtr
Reference counted request for an image to load.
Definition: ImageCache.h:151
wxString m_utilsBinDir
Definition: huginApp.h:159
bool HasMonitorProfile() const
return true if we found a suitable monitor profile and could loading it
Definition: huginApp.h:120
wxDECLARE_EVENT(wxEVT_COMMAND_THUMBNAILTHREAD_UPDATE, wxCommandEvent)
const wxString & GetMonitorProfileName() const
return filename of monitor profile
Definition: huginApp.h:125
const wxString & GetUtilsBinDir()
Definition: huginApp.h:109
ImageReadyEvent(HuginBase::ImageCache::RequestPtr request, HuginBase::ImageCache::EntryPtr entry)
Definition: huginApp.cpp:149
wxString m_workDir
temporary working directory
Definition: huginApp.h:144
virtual ~huginApp()
dtor.
Definition: huginApp.cpp:169
virtual int OnExit()
just for testing purposes
Definition: huginApp.cpp:645
wxString GetWorkDir()
Definition: huginApp.h:92
wxLocale & GetLocale()
return currently active locale
Definition: huginApp.h:87
const wxString & GetXRCPath()
return the current xrc path
Definition: huginApp.h:98
HuginBase::ImageCache::RequestPtr request
Definition: huginApp.h:44
wxString Components2Str(const HuginGraph::ImageGraph::Components &comp)
Definition: huginApp.cpp:84
Event for when a requested image finished loading.
Definition: huginApp.h:41
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:689
wxLocale locale
locale for internationalisation
Definition: huginApp.h:128