Fixed SF Bug #781355. It was a problem with the clipping region. (By
default when drawing the ctrl characters a different drawtext method is called than for normal text and this one didn't take care of the clipping region correctly.) Also fixed a couple buffer overflow errors. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/branches/WX_2_4_BRANCH@22618 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -405,7 +405,7 @@ void SurfaceImpl::DrawTextNoClip(PRectangle rc, Font &font, int ybase,
|
||||
SetFont(font);
|
||||
hdc->SetTextForeground(wxColourFromCA(fore));
|
||||
hdc->SetTextBackground(wxColourFromCA(back));
|
||||
//FillRectangle(rc, back);
|
||||
FillRectangle(rc, back);
|
||||
|
||||
// ybase is where the baseline should be, but wxWin uses the upper left
|
||||
// corner, so I need to calculate the real position for the text...
|
||||
@@ -418,11 +418,12 @@ void SurfaceImpl::DrawTextClipped(PRectangle rc, Font &font, int ybase,
|
||||
SetFont(font);
|
||||
hdc->SetTextForeground(wxColourFromCA(fore));
|
||||
hdc->SetTextBackground(wxColourFromCA(back));
|
||||
//FillRectangle(rc, back);
|
||||
FillRectangle(rc, back);
|
||||
hdc->SetClippingRegion(wxRectFromPRectangle(rc));
|
||||
|
||||
// see comments above
|
||||
hdc->DrawText(stc2wx(s, len), rc.left, ybase - font.ascent);
|
||||
hdc->DestroyClippingRegion();
|
||||
}
|
||||
|
||||
|
||||
@@ -450,7 +451,7 @@ void SurfaceImpl::MeasureWidths(Font &font, const char *s, int len, int *positio
|
||||
#ifndef __WXMAC__
|
||||
// Calculate the position of each character based on the widths of
|
||||
// the previous characters
|
||||
int* tpos = new int[len];
|
||||
int* tpos = new int[len+1];
|
||||
int totalWidth = 0;
|
||||
size_t i;
|
||||
for (i=0; i<str.Length(); i++) {
|
||||
@@ -465,7 +466,7 @@ void SurfaceImpl::MeasureWidths(Font &font, const char *s, int len, int *positio
|
||||
// on OS X widths can be fractions of pixels wide when more than one
|
||||
// are drawn together, so the sum of all character widths is not necessarily
|
||||
// (and probably not) the same as the whole string width.
|
||||
int* tpos = new int[len];
|
||||
int* tpos = new int[len+1];
|
||||
size_t i;
|
||||
for (i=0; i<str.Length(); i++) {
|
||||
int w, h;
|
||||
|
@@ -395,7 +395,7 @@ methodOverrideMap = {
|
||||
int len = end - start;
|
||||
if (!len) return wxEmptyString;
|
||||
|
||||
wxMemoryBuffer mbuf(len+1);
|
||||
wxMemoryBuffer mbuf(len+2);
|
||||
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
||||
SendMsg(%s, 0, (long)buf);
|
||||
mbuf.UngetWriteBuf(len);
|
||||
|
@@ -475,7 +475,7 @@ void wxStyledTextCtrl::MarkerDefineBitmap(int markerNumber, const wxBitmap& bmp)
|
||||
buff[len] = 0;
|
||||
SendMsg(2049, markerNumber, (long)buff);
|
||||
delete [] buff;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Set a margin to be either numeric or symbolic.
|
||||
@@ -858,7 +858,7 @@ void wxStyledTextCtrl::RegisterImage(int type, const wxBitmap& bmp) {
|
||||
buff[len] = 0;
|
||||
SendMsg(2405, type, (long)buff);
|
||||
delete [] buff;
|
||||
|
||||
|
||||
}
|
||||
|
||||
// Clear all the registered images.
|
||||
@@ -1121,7 +1121,7 @@ wxString wxStyledTextCtrl::GetSelectedText() {
|
||||
int len = end - start;
|
||||
if (!len) return wxEmptyString;
|
||||
|
||||
wxMemoryBuffer mbuf(len+1);
|
||||
wxMemoryBuffer mbuf(len+2);
|
||||
char* buf = (char*)mbuf.GetWriteBuf(len+1);
|
||||
SendMsg(2161, 0, (long)buf);
|
||||
mbuf.UngetWriteBuf(len);
|
||||
|
Reference in New Issue
Block a user