00001
00002
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026 #include "wxPlatform.h"
00027 #include <hugin_utils/utils.h>
00028
00029 namespace hugin_utils
00030 {
00031 wxString doubleTowxString(double d, int digits)
00032 {
00033 std::string t = hugin_utils::doubleToString(d, digits);
00034 return wxString(t.c_str(), wxConvLocal);
00035 }
00036
00037 bool str2double(const wxString& s, double & d)
00038 {
00039 if (!hugin_utils::stringToDouble(std::string(s.mb_str(wxConvLocal)), d))
00040 {
00041 return false;
00042 }
00043 return true;
00044 }
00045
00046 }
00047
00048 #if defined __WXMSW__ && !wxCHECK_VERSION(3,1,1)
00049
00050
00051
00052 void HuginCHMHelpController::DisplayHelpPage(const wxString& name)
00053 {
00054
00055
00056 wxString command(GetValidFilename());
00057 command.Append(wxT("::"));
00058 command.Append(name);
00059 CallHtmlHelp(GetParentWindow(), command.t_str(), 0 );
00060 };
00061 #endif
00062
00063 #ifndef __WXMSW__
00064 #include <wx/confbase.h>
00065 #include <wx/gdicmn.h>
00066
00067
00068 WXIMPEX void FixHelpSettings()
00069 {
00070 wxConfigBase* config = wxConfigBase::Get();
00071 int dw, dh;
00072 wxDisplaySize(&dw, &dh);
00073
00074 int x, y, w, h;
00075 config->Read("/wxWindows/wxHtmlHelpController/hcX", &x, wxDefaultCoord);
00076 config->Read("/wxWindows/wxHtmlHelpController/hcY", &y, wxDefaultCoord);
00077 config->Read("/wxWindows/wxHtmlHelpController/hcW", &w, 700);
00078 config->Read("/wxWindows/wxHtmlHelpController/hcH", &h, 480);
00079 if (w > dw)
00080 {
00081 w = 700;
00082 config->Write("/wxWindows/wxHtmlHelpController/hcW", w);
00083 };
00084 if (h > dh)
00085 {
00086 h = 480;
00087 config->Write("/wxWindows/wxHtmlHelpController/hcH", h);
00088 };
00089 if (x<-1 || x>dw-100)
00090 {
00091 x = wxDefaultCoord;
00092 config->Write("/wxWindows/wxHtmlHelpController/hcX", x);
00093 };
00094 if (y<-1 || y>dh - 100)
00095 {
00096 y = wxDefaultCoord;
00097 config->Write("/wxWindows/wxHtmlHelpController/hcY", y);
00098 };
00099 }
00100 #endif
00101
00102 #if defined __WXGTK__ && wxCHECK_VERSION(3,1,1)
00103 #include <wx/stdpaths.h>
00104 #include <wx/app.h>
00105 #include <wx/filename.h>
00106 void CheckConfigFilename()
00107 {
00108 wxStandardPaths& paths = wxStandardPaths::Get();
00109
00110 const wxFileName oldConfigFile (paths.GetUserConfigDir(), paths.MakeConfigFileName(wxTheApp->GetAppName(), wxStandardPaths::ConfigFileConv_Dot));
00111
00112 paths.SetFileLayout(wxStandardPaths::FileLayout_XDG);
00113 if (oldConfigFile.FileExists())
00114 {
00115
00116 const wxFileName newConfigFile(paths.GetUserConfigDir(), paths.MakeConfigFileName(wxTheApp->GetAppName(), wxStandardPaths::ConfigFileConv_Dot));
00117
00118 if (!newConfigFile.FileExists())
00119 {
00120 wxRenameFile(oldConfigFile.GetFullPath(), newConfigFile.GetFullPath());
00121 };
00122 };
00123 };
00124 #endif