update the samples to use new (non-deprecated) wxGLCanvas API; added more comments; some cleanup (modified patch 1882679)

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@51630 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2008-02-10 13:26:01 +00:00
parent 845035287a
commit 451c13c85c
7 changed files with 247 additions and 214 deletions

View File

@@ -33,6 +33,8 @@
#include <GL/glu.h>
#endif
#include <sstream>
#include "dxfrenderer.h"
#include "wx/listimpl.cpp"
@@ -435,6 +437,22 @@ bool DXFRenderer::ParseTables(wxInputStream& stream)
return false;
}
// This method is used instead of numStr.ToDouble(d) because the latter
// (wxString::ToDouble()) takes the systems proper locale into account,
// whereas the implementation below works with the default locale.
// (Converting numbers that are formatted in the default locale can fail
// with system locales that use e.g. the comma as the decimal separator.)
static double ToDouble(const wxString& numStr)
{
double d;
std::string numStr_(numStr.c_str());
std::istringstream iss(numStr_);
iss >> d;
return d;
}
// parse entities section: save 3DFACE and LINE entities
bool DXFRenderer::ParseEntities(wxInputStream& stream)
{
@@ -490,8 +508,8 @@ bool DXFRenderer::ParseEntities(wxInputStream& stream)
state = 2;
else if (state > 0)
{
double d;
line2.ToDouble(&d);
const double d=ToDouble(line2);
if (line1 == wxT("10"))
v[0].x = d;
else if (line1 == wxT("20"))