X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/16dc3e3df67487e82df1c556c9aea2f7014d6ceb..19b44116d5c04181f9a20f92546cff26405ed115:/contrib/src/ogl/oglmisc.cpp diff --git a/contrib/src/ogl/oglmisc.cpp b/contrib/src/ogl/oglmisc.cpp index cd29d7437b..9b575499d5 100644 --- a/contrib/src/ogl/oglmisc.cpp +++ b/contrib/src/ogl/oglmisc.cpp @@ -6,7 +6,7 @@ // Created: 12/07/98 // RCS-ID: $Id$ // Copyright: (c) Julian Smart -// Licence: wxWindows licence +// Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// #ifdef __GNUG__ @@ -24,7 +24,7 @@ #include #endif -#if wxUSE_DEPRECATED +#if wxUSE_PROLOGIO #include #endif @@ -38,11 +38,8 @@ #include #include -#include -#include -#include -#include -#include +#include "wx/ogl/ogl.h" + wxFont* g_oglNormalFont; wxPen* g_oglBlackPen; @@ -52,7 +49,7 @@ wxBrush* g_oglWhiteBackgroundBrush; wxPen* g_oglBlackForegroundPen; wxCursor* g_oglBullseyeCursor = NULL; -char* oglBuffer = NULL; +wxChar* oglBuffer = NULL; wxList oglObjectCopyMapping(wxKEY_INTEGER); @@ -74,7 +71,7 @@ void wxOGLInitialize() OGLInitializeConstraintTypes(); // Initialize big buffer used when writing images - oglBuffer = new char[3000]; + oglBuffer = new wxChar[3000]; } @@ -86,6 +83,7 @@ void wxOGLCleanUp() oglBuffer = NULL; } oglBuffer = NULL; + if (g_oglBullseyeCursor) { delete g_oglBullseyeCursor; @@ -343,7 +341,7 @@ void oglCentreTextNoClipping(wxDC& dc, wxList *text_list, } void oglGetCentredTextExtent(wxDC& dc, wxList *text_list, - double m_xpos, double m_ypos, double width, double height, + double WXUNUSED(m_xpos), double WXUNUSED(m_ypos), double WXUNUSED(width), double WXUNUSED(height), double *actual_width, double *actual_height) { int n = text_list->GetCount(); @@ -362,7 +360,6 @@ void oglGetCentredTextExtent(wxDC& dc, wxList *text_list, long current_width = 0; wxNode *current = text_list->GetFirst(); - int i = 0; while (current) { wxShapeTextLine *line = (wxShapeTextLine *)current->GetData(); @@ -371,7 +368,6 @@ void oglGetCentredTextExtent(wxDC& dc, wxList *text_list, if (current_width > max_width) max_width = current_width; current = current->GetNext(); - i ++; } *actual_height = n*char_height; @@ -380,7 +376,7 @@ void oglGetCentredTextExtent(wxDC& dc, wxList *text_list, // Format a string to a list of strings that fit in the given box. // Interpret %n and 10 or 13 as a new line. -wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double height, int formatMode) +wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double WXUNUSED(height), int formatMode) { // First, parse the string into a list of words wxStringList word_list; @@ -388,7 +384,7 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double // Make new lines into NULL strings at this point int i = 0; int j = 0; int len = text.Length(); wxChar word[200]; word[0] = 0; - bool end_word = FALSE; bool new_line = FALSE; + bool end_word = false; bool new_line = false; while (i < len) { switch (text[i]) @@ -401,7 +397,7 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double else { if (text[i] == wxT('n')) - { new_line = TRUE; end_word = TRUE; i++; } + { new_line = true; end_word = true; i++; } else { word[j] = wxT('%'); j ++; word[j] = text[i]; j ++; i ++; } } @@ -409,16 +405,17 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double } case 10: { - new_line = TRUE; end_word = TRUE; i++; + new_line = true; end_word = true; i++; break; } case 13: { - new_line = TRUE; end_word = TRUE; i++; + new_line = true; end_word = true; i++; + break; } case wxT(' '): { - end_word = TRUE; + end_word = true; i ++; break; } @@ -429,18 +426,18 @@ wxStringList *oglFormatText(wxDC& dc, const wxString& text, double width, double break; } } - if (i == len) end_word = TRUE; + if (i == len) end_word = true; if (end_word) { word[j] = 0; j = 0; word_list.Add(word); - end_word = FALSE; + end_word = false; } if (new_line) { word_list.Append(NULL); - new_line = FALSE; + new_line = false; } } // Now, make a list of strings which can fit in the box @@ -508,7 +505,7 @@ void oglDrawFormattedText(wxDC& dc, wxList *text_list, dc.SetClippingRegion( (long)(m_xpos - width/2.0), (long)(m_ypos - height/2.0), - (long)width, (long)height); + (long)width+1, (long)height+1); // +1 to allow for rounding errors wxNode *current = text_list->GetFirst(); while (current)