29 #include <wx/stdpaths.h>
49 #if wxUSE_ON_FATAL_EXCEPTION
50 wxHandleFatalExceptions();
52 SetAppName(wxT(
"hugin"));
54 CheckConfigFilename();
60 wxFileName exeDir(wxStandardPaths::Get().GetExecutablePath());
61 exeDir.RemoveLastDir();
62 m_xrcPrefix = exeDir.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) + wxT(
"share\\hugin\\xrc\\");
64 locale.AddCatalogLookupPathPrefix(exeDir.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR) + wxT(
"share\\locale"));
65 #elif defined __WXMAC__ && defined MAC_SELF_CONTAINED_BUNDLE
67 wxString thePath = MacGetPathToBundledResourceFile(CFSTR(
"xrc"));
68 if (thePath == wxT(
"")) {
69 wxMessageBox(_(
"xrc directory not found in bundle"), _(
"Fatal Error"));
72 m_xrcPrefix = thePath + wxT(
"/");
73 #elif defined UNIX_SELF_CONTAINED_BUNDLE
76 wxFileName exePath(wxStandardPaths::Get().GetExecutablePath());
77 exePath.RemoveLastDir();
78 const wxString huginRoot=exePath.GetPath(wxPATH_GET_VOLUME | wxPATH_GET_SEPARATOR);
80 m_xrcPrefix = huginRoot + wxT(
"share/hugin/xrc/");
81 locale.AddCatalogLookupPathPrefix(huginRoot + wxT(
"share/locale"));
85 m_xrcPrefix = wxT(INSTALL_XRC_DIR);
86 locale.AddCatalogLookupPathPrefix(wxT(INSTALL_LOCALE_DIR));
89 if ( ! wxFile::Exists(m_xrcPrefix + wxT(
"/lenscal_frame.xrc")) )
91 wxMessageBox(_(
"xrc directory not found, hugin needs to be properly installed\nTried Path:" + m_xrcPrefix ), _(
"Fatal Error"));
96 wxConfigBase * config = wxConfigBase::Get();
98 config->SetRecordDefaults(
false);
102 setlocale(LC_ALL,
"");
104 int localeID = config->Read(wxT(
"language"), (
long)
HUGIN_LANGUAGE);
108 bLInit = locale.Init(localeID);
111 DEBUG_TRACE(
"System Locale: " << locale.GetSysName().mb_str(wxConvLocal))
112 DEBUG_TRACE(
"Canonical Locale: " << locale.GetCanonicalName().mb_str(wxConvLocal))
119 locale.AddCatalog(wxT(
"hugin"));
122 wxInitAllImageHandlers();
125 wxXmlResource::Get()->InitAllHandlers();
128 wxXmlResource::Get()->Load(m_xrcPrefix + wxT(
"lenscal_frame.xrc"));
129 wxXmlResource::Get()->Load(m_xrcPrefix + wxT(
"lensdb_dialogs.xrc"));
130 wxXmlResource::Get()->Load(m_xrcPrefix + wxT(
"dlg_warning.xrc"));
134 SetTopWindow(m_frame);
143 TIFFSetWarningHandler(0);
148 #if wxUSE_ON_FATAL_EXCEPTION
149 void LensCalApp::OnFatalException()
151 GenerateReport(wxDebugReport::Context_Exception);
159 wxConfigBase * config = wxConfigBase::Get();
163 wxDisplaySize(&dx,&dy);
169 int w = config->Read(wxT(
"/") + basename + wxT(
"/width"),-1l);
170 int h = config->Read(wxT(
"/") + basename + wxT(
"/height"),-1l);
171 if (w > 0 && w <= dx) {
172 frame->SetClientSize(w,h);
177 int x = config->Read(wxT(
"/") + basename + wxT(
"/positionX"),-1l);
178 int y = config->Read(wxT(
"/") + basename + wxT(
"/positionY"),-1l);
179 if ( y >= 0 && x >= 0 && x < dx && y < dy) {
185 bool maximized = config->Read(wxT(
"/") + basename + wxT(
"/maximized"), 0l) != 0;
190 int w = config->Read(wxT(
"/") + basename + wxT(
"/width"),-1l);
191 int h = config->Read(wxT(
"/") + basename + wxT(
"/height"),-1l);
192 if (w > 0 && w <= dx) {
193 frame->SetClientSize(w,h);
198 int x = config->Read(wxT(
"/") + basename + wxT(
"/positionX"),-1l);
199 int y = config->Read(wxT(
"/") + basename + wxT(
"/positionY"),-1l);
200 if ( y >= 0 && x >= 0 && x < dx && y < dy) {
214 wxConfigBase * config = wxConfigBase::Get();
220 wxSize sz = frame->GetClientSize();
221 config->Write(wxT(
"/") + basename + wxT(
"/width"), sz.GetWidth());
222 config->Write(wxT(
"/") + basename + wxT(
"/height"), sz.GetHeight());
223 wxPoint ps = frame->GetPosition();
224 config->Write(wxT(
"/") + basename + wxT(
"/positionX"), ps.x);
225 config->Write(wxT(
"/") + basename + wxT(
"/positionY"), ps.y);
226 config->Write(wxT(
"/") + basename + wxT(
"/maximized"), 0);
228 if ( (! frame->IsMaximized()) && (! frame->IsIconized()) ) {
229 wxSize sz = frame->GetClientSize();
230 config->Write(wxT(
"/") + basename + wxT(
"/width"), sz.GetWidth());
231 config->Write(wxT(
"/") + basename + wxT(
"/height"), sz.GetHeight());
232 wxPoint ps = frame->GetPosition();
233 config->Write(wxT(
"/") + basename + wxT(
"/positionX"), ps.x);
234 config->Write(wxT(
"/") + basename + wxT(
"/positionY"), ps.y);
235 config->Write(wxT(
"/") + basename + wxT(
"/maximized"), 0);
236 }
else if (frame->IsMaximized()){
237 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