29 #include <wx/stdpaths.h>
49 bool LensCalApp::OnInit()
51 #if wxUSE_ON_FATAL_EXCEPTION
52 wxHandleFatalExceptions();
54 SetAppName(wxT(
"hugin"));
56 CheckConfigFilename();
62 wxFileName exeDir(wxStandardPaths::Get().GetExecutablePath());
63 exeDir.RemoveLastDir();
64 m_xrcPrefix = exeDir.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) + wxT(
"share\\hugin\\xrc\\");
66 locale.AddCatalogLookupPathPrefix(exeDir.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) + wxT(
"share\\locale"));
67 #elif defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
69 wxString thePath = MacGetPathToBundledResourceFile(CFSTR(
"xrc"));
70 if (thePath == wxT(
"")) {
71 wxMessageBox(_(
"xrc directory not found in bundle"), _(
"Fatal Error"));
74 m_xrcPrefix = thePath + wxT(
"/");
75 #elif defined UNIX_SELF_CONTAINED_BUNDLE
78 wxFileName exePath(wxStandardPaths::Get().GetExecutablePath());
79 exePath.RemoveLastDir();
80 const wxString huginRoot=exePath.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
82 m_xrcPrefix = huginRoot + wxT(
"share/hugin/xrc/");
83 locale.AddCatalogLookupPathPrefix(huginRoot + wxT(
"share/locale"));
87 m_xrcPrefix = wxT(INSTALL_XRC_DIR);
88 locale.AddCatalogLookupPathPrefix(wxT(INSTALL_LOCALE_DIR));
91 if ( ! wxFile::Exists(m_xrcPrefix + wxT(
"/lenscal_frame.xrc")) )
93 wxMessageBox(_(
"xrc directory not found, hugin needs to be properly installed\nTried Path:" + m_xrcPrefix ), _(
"Fatal Error"));
98 wxConfigBase * config = wxConfigBase::Get();
100 config->SetRecordDefaults(
false);
104 setlocale(LC_ALL,
"");
106 int localeID = config->Read(wxT(
"language"), (
long)
HUGIN_LANGUAGE);
110 bLInit = locale.Init(localeID);
113 DEBUG_TRACE(
"System Locale: " << locale.GetSysName().mb_str(wxConvLocal))
114 DEBUG_TRACE(
"Canonical Locale: " << locale.GetCanonicalName().mb_str(wxConvLocal))
121 locale.AddCatalog(wxT(
"hugin"));
124 wxInitAllImageHandlers();
127 wxXmlResource::Get()->InitAllHandlers();
130 wxXmlResource::Get()->Load(m_xrcPrefix + wxT(
"lenscal_frame.xrc"));
131 wxXmlResource::Get()->Load(m_xrcPrefix + wxT(
"lensdb_dialogs.xrc"));
132 wxXmlResource::Get()->Load(m_xrcPrefix + wxT(
"dlg_warning.xrc"));
136 SetTopWindow(m_frame);
145 TIFFSetWarningHandler(0);
150 #if wxUSE_ON_FATAL_EXCEPTION
151 void LensCalApp::OnFatalException()
153 GenerateReport(wxDebugReport::Context_Exception);
161 wxConfigBase * config = wxConfigBase::Get();
165 wxDisplaySize(&dx,&dy);
171 int w = config->Read(wxT(
"/") + basename + wxT(
"/width"),-1l);
172 int h = config->Read(wxT(
"/") + basename + wxT(
"/height"),-1l);
173 if (w > 0 && w <= dx) {
174 frame->SetClientSize(w,h);
179 int x = config->Read(wxT(
"/") + basename + wxT(
"/positionX"),-1l);
180 int y = config->Read(wxT(
"/") + basename + wxT(
"/positionY"),-1l);
181 if ( y >= 0 && x >= 0 && x < dx && y < dy) {
187 bool maximized = config->Read(wxT(
"/") + basename + wxT(
"/maximized"), 0l) != 0;
192 int w = config->Read(wxT(
"/") + basename + wxT(
"/width"),-1l);
193 int h = config->Read(wxT(
"/") + basename + wxT(
"/height"),-1l);
194 if (w > 0 && w <= dx) {
195 frame->SetClientSize(w,h);
200 int x = config->Read(wxT(
"/") + basename + wxT(
"/positionX"),-1l);
201 int y = config->Read(wxT(
"/") + basename + wxT(
"/positionY"),-1l);
202 if ( y >= 0 && x >= 0 && x < dx && y < dy) {
216 wxConfigBase * config = wxConfigBase::Get();
222 wxSize sz = frame->GetClientSize();
223 config->Write(wxT(
"/") + basename + wxT(
"/width"), sz.GetWidth());
224 config->Write(wxT(
"/") + basename + wxT(
"/height"), sz.GetHeight());
225 wxPoint ps = frame->GetPosition();
226 config->Write(wxT(
"/") + basename + wxT(
"/positionX"), ps.x);
227 config->Write(wxT(
"/") + basename + wxT(
"/positionY"), ps.y);
228 config->Write(wxT(
"/") + basename + wxT(
"/maximized"), 0);
230 if ( (! frame->IsMaximized()) && (! frame->IsIconized()) ) {
231 wxSize sz = frame->GetClientSize();
232 config->Write(wxT(
"/") + basename + wxT(
"/width"), sz.GetWidth());
233 config->Write(wxT(
"/") + basename + wxT(
"/height"), sz.GetHeight());
234 wxPoint ps = frame->GetPosition();
235 config->Write(wxT(
"/") + basename + wxT(
"/positionX"), ps.x);
236 config->Write(wxT(
"/") + basename + wxT(
"/positionY"), ps.y);
237 config->Write(wxT(
"/") + basename + wxT(
"/maximized"), 0);
238 }
else if (frame->IsMaximized()){
239 config->Write(wxT(
"/") + basename + wxT(
"/maximized"), 1l);
xrc handler for LensCalImageCtrl
void registerPTWXDlgFcn()
include file for the hugin project
void StoreFramePosition(wxTopLevelWindow *frame, const wxString &basename)
Store window size and position in configfile/registry.
void RestoreFramePosition(wxTopLevelWindow *frame, const wxString &basename)
Restore window size and position from configfile/registry.
declaration of preview for lens calibration gui
include file for the hugin project
The application class for lens_calibrate_gui .
functions for interaction with the hugin configuration file
declaration of application class for lens calibrate application