wxPlatform.cpp

Go to the documentation of this file.
00001 // -*- c-basic-offset: 4 -*-
00002 
00010 /*  This program is free software; you can redistribute it and/or
00011 *  modify it under the terms of the GNU General Public
00012 *  License as published by the Free Software Foundation; either
00013 *  version 2 of the License, or (at your option) any later version.
00014 *
00015 *  This software is distributed in the hope that it will be useful,
00016 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
00017 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00018 *  General Public License for more details.
00019 *
00020 *  You should have received a copy of the GNU General Public
00021 *  License along with this software. If not, see
00022 *  <http://www.gnu.org/licenses/>.
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 } // namespace
00047 
00048 #if defined __WXMSW__ && !wxCHECK_VERSION(3,1,1)
00049   // workaround for wxWidgets bug 14888
00050   // see: http://trac.wxwidgets.org/ticket/14888
00051   // if this is fixed upstreams this workaround can be removed
00052 void HuginCHMHelpController::DisplayHelpPage(const wxString& name)
00053 {
00054     // instead of passing filename as dwData to HH_DISPLAY_TOPIC
00055     // we pass chmFilename::filename to pszfile 
00056     wxString command(GetValidFilename());
00057     command.Append(wxT("::"));
00058     command.Append(name);
00059     CallHtmlHelp(GetParentWindow(), command.t_str(), 0 /* =HH_DISPLAY_TOPIC */);
00060 };
00061 #endif
00062 
00063 #ifndef __WXMSW__
00064 #include <wx/confbase.h>
00065 #include <wx/gdicmn.h> 
00066 // check if the help window has correct position/size inside current display
00067 // this is not done by wxWidgets
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

Generated on 23 Jan 2018 for Hugintrunk by  doxygen 1.4.7