X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/cfb50f14ecc87d39319a3f23ddbae938e7858c33..db8db70a19a52f14f284a99cafbf2f18c66372ea:/src/gtk1/dcclient.cpp diff --git a/src/gtk1/dcclient.cpp b/src/gtk1/dcclient.cpp index c945bcd140..0df1276c4b 100644 --- a/src/gtk1/dcclient.cpp +++ b/src/gtk1/dcclient.cpp @@ -109,34 +109,30 @@ wxWindowDC::wxWindowDC( wxWindow *window ) m_bgGC = (GdkGC *) NULL; m_cmap = (GdkColormap *) NULL; m_owner = (wxWindow *)NULL; + m_isMemDC = FALSE; + m_font = window->GetFont(); - if (!window) - return; + wxASSERT_MSG( window, _T("DC needs a window") ); GtkWidget *widget = window->m_wxwindow; - if (!widget) - return; + + wxASSERT_MSG( widget, _T("DC needs a widget") ); m_window = widget->window; /* not realized ? */ if (!m_window) { - /* force realization */ - gtk_widget_realize( widget ); - m_window = widget->window; + /* don't report problems */ + m_ok = TRUE; + + return; } - /* still not realized ? */ - if (!m_window) - return; - if (window->m_wxwindow) m_cmap = gtk_widget_get_colormap( window->m_wxwindow ); else m_cmap = gtk_widget_get_colormap( window->m_widget ); - - m_isMemDC = FALSE; SetUpDC(); @@ -173,8 +169,8 @@ void wxWindowDC::DoDrawLine( long x1, long y1, long x2, long y2 ) if (m_pen.GetStyle() != wxTRANSPARENT) { - gdk_draw_line( m_window, m_penGC, - XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) ); + if (m_window) + gdk_draw_line( m_window, m_penGC, XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) ); CalcBoundingBox(x1, y1); CalcBoundingBox(x2, y2); @@ -192,8 +188,11 @@ void wxWindowDC::DoCrossHair( long x, long y ) GetSize( &w, &h ); long xx = XLOG2DEV(x); long yy = YLOG2DEV(y); - gdk_draw_line( m_window, m_penGC, 0, yy, XLOG2DEVREL(w), yy ); - gdk_draw_line( m_window, m_penGC, xx, 0, xx, YLOG2DEVREL(h) ); + if (m_window) + { + gdk_draw_line( m_window, m_penGC, 0, yy, XLOG2DEVREL(w), yy ); + gdk_draw_line( m_window, m_penGC, xx, 0, xx, YLOG2DEVREL(h) ); + } } } @@ -238,11 +237,14 @@ void wxWindowDC::DoDrawArc( long x1, long y1, long x2, long y2, while (alpha2 <= 0) alpha2 += 360*64; while (alpha1 > 360*64) alpha1 -= 360*64; - if (m_brush.GetStyle() != wxTRANSPARENT) - gdk_draw_arc( m_window, m_brushGC, TRUE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 ); + if (m_window) + { + if (m_brush.GetStyle() != wxTRANSPARENT) + gdk_draw_arc( m_window, m_brushGC, TRUE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 ); - if (m_pen.GetStyle() != wxTRANSPARENT) - gdk_draw_arc( m_window, m_penGC, FALSE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 ); + if (m_pen.GetStyle() != wxTRANSPARENT) + gdk_draw_arc( m_window, m_penGC, FALSE, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 ); + } CalcBoundingBox (x1, y1); CalcBoundingBox (x2, y2); @@ -261,13 +263,17 @@ void wxWindowDC::DoDrawEllipticArc( long x, long y, long width, long height, dou if (ww < 0) { ww = -ww; xx = xx - ww; } if (hh < 0) { hh = -hh; yy = yy - hh; } - long start = long(sa * 64.0); - long end = long(ea * 64.0); - if (m_brush.GetStyle() != wxTRANSPARENT) - gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, ww, hh, start, end ); + if (m_window) + { + long start = long(sa * 64.0); + long end = long(ea * 64.0); + + if (m_brush.GetStyle() != wxTRANSPARENT) + gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, ww, hh, start, end ); - if (m_pen.GetStyle() != wxTRANSPARENT) - gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, start, end ); + if (m_pen.GetStyle() != wxTRANSPARENT) + gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, start, end ); + } CalcBoundingBox (x, y); CalcBoundingBox (x + width, y + height); @@ -277,7 +283,7 @@ void wxWindowDC::DoDrawPoint( long x, long y ) { wxCHECK_RET( Ok(), _T("invalid window dc") ); - if (m_pen.GetStyle() != wxTRANSPARENT) + if ((m_pen.GetStyle() != wxTRANSPARENT) && m_window) gdk_draw_point( m_window, m_penGC, XLOG2DEV(x), YLOG2DEV(y) ); CalcBoundingBox (x, y); @@ -298,7 +304,8 @@ void wxWindowDC::DoDrawLines( int n, wxPoint points[], long xoffset, long yoffse long x2 = XLOG2DEV(points[i+1].x + xoffset); long y1 = YLOG2DEV(points[i].y + yoffset); // oh, what a waste long y2 = YLOG2DEV(points[i+1].y + yoffset); - gdk_draw_line( m_window, m_penGC, x1, y1, x2, y2 ); + if (m_window) + gdk_draw_line( m_window, m_penGC, x1, y1, x2, y2 ); CalcBoundingBox( points[i+1].x + xoffset, points[i+1].y + yoffset ); } @@ -325,7 +332,8 @@ void wxWindowDC::DoDrawPolygon( int n, wxPoint points[], long xoffset, long yoff // To do: Fillstyle - if (m_pen.GetStyle() != wxTRANSPARENT) + if ((m_pen.GetStyle() != wxTRANSPARENT) && m_window) + { for (i = 0 ; i < n ; i++) { gdk_draw_line( m_window, m_penGC, @@ -334,6 +342,7 @@ void wxWindowDC::DoDrawPolygon( int n, wxPoint points[], long xoffset, long yoff gdkpoints[(i+1)%n].x, gdkpoints[(i+1)%n].y); } + } delete[] gdkpoints; } @@ -354,11 +363,14 @@ void wxWindowDC::DoDrawRectangle( long x, long y, long width, long height ) if (ww < 0) { ww = -ww; xx = xx - ww; } if (hh < 0) { hh = -hh; yy = yy - hh; } - if (m_brush.GetStyle() != wxTRANSPARENT) - gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy, ww, hh ); + if (m_window) + { + if (m_brush.GetStyle() != wxTRANSPARENT) + gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy, ww, hh ); - if (m_pen.GetStyle() != wxTRANSPARENT) - gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-1, hh-1 ); + if (m_pen.GetStyle() != wxTRANSPARENT) + gdk_draw_rectangle( m_window, m_penGC, FALSE, xx, yy, ww-1, hh-1 ); + } CalcBoundingBox( x, y ); CalcBoundingBox( x + width, y + height ); @@ -399,33 +411,36 @@ void wxWindowDC::DoDrawRoundedRectangle( long x, long y, long width, long height hh--; } - // CMB: ensure dd is not larger than rectangle otherwise we - // get an hour glass shape - long dd = 2 * rr; - if (dd > ww) dd = ww; - if (dd > hh) dd = hh; - rr = dd / 2; - - if (m_brush.GetStyle() != wxTRANSPARENT) + if (m_window) { - gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx+rr, yy, ww-dd+1, hh ); - gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy+rr, ww, hh-dd+1 ); - gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, dd, dd, 90*64, 90*64 ); - gdk_draw_arc( m_window, m_brushGC, TRUE, xx+ww-dd, yy, dd, dd, 0, 90*64 ); - gdk_draw_arc( m_window, m_brushGC, TRUE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 ); - gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 ); - } + // CMB: ensure dd is not larger than rectangle otherwise we + // get an hour glass shape + long dd = 2 * rr; + if (dd > ww) dd = ww; + if (dd > hh) dd = hh; + rr = dd / 2; + + if (m_brush.GetStyle() != wxTRANSPARENT) + { + gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx+rr, yy, ww-dd+1, hh ); + gdk_draw_rectangle( m_window, m_brushGC, TRUE, xx, yy+rr, ww, hh-dd+1 ); + gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, dd, dd, 90*64, 90*64 ); + gdk_draw_arc( m_window, m_brushGC, TRUE, xx+ww-dd, yy, dd, dd, 0, 90*64 ); + gdk_draw_arc( m_window, m_brushGC, TRUE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 ); + gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 ); + } - if (m_pen.GetStyle() != wxTRANSPARENT) - { - gdk_draw_line( m_window, m_penGC, xx+rr, yy, xx+ww-rr, yy ); - gdk_draw_line( m_window, m_penGC, xx+rr, yy+hh, xx+ww-rr, yy+hh ); - gdk_draw_line( m_window, m_penGC, xx, yy+rr, xx, yy+hh-rr ); - gdk_draw_line( m_window, m_penGC, xx+ww, yy+rr, xx+ww, yy+hh-rr ); - gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, dd, dd, 90*64, 90*64 ); - gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy, dd, dd, 0, 90*64 ); - gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 ); - gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 ); + if (m_pen.GetStyle() != wxTRANSPARENT) + { + gdk_draw_line( m_window, m_penGC, xx+rr, yy, xx+ww-rr, yy ); + gdk_draw_line( m_window, m_penGC, xx+rr, yy+hh, xx+ww-rr, yy+hh ); + gdk_draw_line( m_window, m_penGC, xx, yy+rr, xx, yy+hh-rr ); + gdk_draw_line( m_window, m_penGC, xx+ww, yy+rr, xx+ww, yy+hh-rr ); + gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, dd, dd, 90*64, 90*64 ); + gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy, dd, dd, 0, 90*64 ); + gdk_draw_arc( m_window, m_penGC, FALSE, xx+ww-dd, yy+hh-dd, dd, dd, 270*64, 90*64 ); + gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy+hh-dd, dd, dd, 180*64, 90*64 ); + } } // this ignores the radius @@ -446,11 +461,14 @@ void wxWindowDC::DoDrawEllipse( long x, long y, long width, long height ) if (ww < 0) { ww = -ww; xx = xx - ww; } if (hh < 0) { hh = -hh; yy = yy - hh; } - if (m_brush.GetStyle() != wxTRANSPARENT) - gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, ww, hh, 0, 360*64 ); + if (m_window) + { + if (m_brush.GetStyle() != wxTRANSPARENT) + gdk_draw_arc( m_window, m_brushGC, TRUE, xx, yy, ww, hh, 0, 360*64 ); - if (m_pen.GetStyle() != wxTRANSPARENT) - gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, 0, 360*64 ); + if (m_pen.GetStyle() != wxTRANSPARENT) + gdk_draw_arc( m_window, m_penGC, FALSE, xx, yy, ww, hh, 0, 360*64 ); + } CalcBoundingBox( x - width, y - height ); CalcBoundingBox( x + width, y + height ); @@ -478,6 +496,11 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, int w = bitmap.GetWidth(); int h = bitmap.GetHeight(); + CalcBoundingBox( x, y ); + CalcBoundingBox( x + w, y + h ); + + if (!m_window) return; + int ww = XLOG2DEVREL(w); int hh = YLOG2DEVREL(h); @@ -531,9 +554,6 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, gdk_gc_set_clip_mask( m_penGC, (GdkBitmap *) NULL ); gdk_gc_set_clip_origin( m_penGC, 0, 0 ); } - - CalcBoundingBox( x, y ); - CalcBoundingBox( x + w, y + h ); } bool wxWindowDC::DoBlit( long xdest, long ydest, long width, long height, @@ -549,6 +569,8 @@ bool wxWindowDC::DoBlit( long xdest, long ydest, long width, long height, wxCHECK_MSG( source, FALSE, _T("invalid source dc") ); + if (!m_window) return FALSE; + wxClientDC *srcDC = (wxClientDC*)source; wxMemoryDC *memDC = (wxMemoryDC*)source; @@ -733,6 +755,8 @@ void wxWindowDC::DoDrawText( const wxString &text, long x, long y ) { wxCHECK_RET( Ok(), _T("invalid window dc") ); + if (!m_window) return; + GdkFont *font = m_font.GetInternalFont( m_scaleY ); x = XLOG2DEV(x); @@ -796,6 +820,8 @@ void wxWindowDC::Clear() { wxCHECK_RET( Ok(), _T("invalid window dc") ); + if (!m_window) return; + /* - we either are a memory dc or have a window as the owner. anything else shouldn't happen. - we don't use gdk_window_clear() as we don't set @@ -835,10 +861,12 @@ void wxWindowDC::SetPen( const wxPen &pen ) if (!m_pen.Ok()) return; + if (!m_window) return; + gint width = m_pen.GetWidth(); - // CMB: if width is non-zero scale it with the dc if (width <= 0) { + // CMB: if width is non-zero scale it with the dc width = 1; } else @@ -849,16 +877,87 @@ void wxWindowDC::SetPen( const wxPen &pen ) width = (int)w; } + const static char dotted[] = {1, 1}; + const static char short_dashed[] = {2, 2}; + const static char long_dashed[] = {2, 4}; + const static char dotted_dashed[] = {3, 3, 1, 3}; + + // We express dash pattern in pen width unit, so we are + // independent of zoom factor and so on... + int req_nb_dash; + const char *req_dash; + GdkLineStyle lineStyle = GDK_LINE_SOLID; switch (m_pen.GetStyle()) { - case wxSOLID: { lineStyle = GDK_LINE_SOLID; break; } - case wxDOT: { lineStyle = GDK_LINE_ON_OFF_DASH; break; } - case wxLONG_DASH: { lineStyle = GDK_LINE_ON_OFF_DASH; break; } - case wxSHORT_DASH: { lineStyle = GDK_LINE_ON_OFF_DASH; break; } - case wxDOT_DASH: { lineStyle = GDK_LINE_DOUBLE_DASH; break; } + case wxUSER_DASH: + { + lineStyle = GDK_LINE_ON_OFF_DASH; + req_nb_dash = m_pen.GetDashCount(); + req_dash = m_pen.GetDash(); + break; + } + case wxDOT: + { + lineStyle = GDK_LINE_ON_OFF_DASH; + req_nb_dash = 2; + req_dash = dotted; + break; + } + case wxLONG_DASH: + { + lineStyle = GDK_LINE_ON_OFF_DASH; + req_nb_dash = 2; + req_dash = long_dashed; + break; + } + case wxSHORT_DASH: + { + lineStyle = GDK_LINE_ON_OFF_DASH; + req_nb_dash = 2; + req_dash = short_dashed; + break; + } + case wxDOT_DASH: + { +// lineStyle = GDK_LINE_DOUBLE_DASH; + lineStyle = GDK_LINE_ON_OFF_DASH; + req_nb_dash = 4; + req_dash = dotted_dashed; + break; + } + + case wxTRANSPARENT: + case wxSTIPPLE: + case wxSOLID: + default: + { + lineStyle = GDK_LINE_SOLID; + req_dash = (wxDash*)NULL; + req_nb_dash = 0; + break; + } } +#if (GTK_MINOR_VERSION > 0) + if (req_dash && req_nb_dash) + { + char *real_req_dash = new char[req_nb_dash]; + if (real_req_dash) + { + for (int i = 0; i < req_nb_dash; i++) + real_req_dash[i] = req_dash[i] * width; + gdk_gc_set_dashes( m_penGC, 0, real_req_dash, req_nb_dash ); + delete[] real_req_dash; + } + else + { + // No Memory. We use non-scaled dash pattern... + gdk_gc_set_dashes( m_penGC, 0, (char*)req_dash, req_nb_dash ); + } + } +#endif + GdkCapStyle capStyle = GDK_CAP_ROUND; switch (m_pen.GetCap()) { @@ -891,6 +990,8 @@ void wxWindowDC::SetBrush( const wxBrush &brush ) if (!m_brush.Ok()) return; + if (!m_window) return; + m_brush.GetColour().CalcPixel( m_cmap ); gdk_gc_set_foreground( m_brushGC, m_brush.GetColour().GetColor() ); @@ -909,7 +1010,7 @@ void wxWindowDC::SetBrush( const wxBrush &brush ) if ((m_brush.GetStyle() == wxSTIPPLE) && (m_brush.GetStipple()->Ok())) { if (m_brush.GetStipple()->GetPixmap()) - gdk_gc_set_stipple( m_brushGC, m_brush.GetStipple()->GetPixmap() ); + gdk_gc_set_tile( m_brushGC, m_brush.GetStipple()->GetPixmap() ); else gdk_gc_set_stipple( m_brushGC, m_brush.GetStipple()->GetBitmap() ); } @@ -934,6 +1035,8 @@ void wxWindowDC::SetBackground( const wxBrush &brush ) if (!m_backgroundBrush.Ok()) return; + if (!m_window) return; + m_backgroundBrush.GetColour().CalcPixel( m_cmap ); gdk_gc_set_background( m_brushGC, m_backgroundBrush.GetColour().GetColor() ); gdk_gc_set_background( m_penGC, m_backgroundBrush.GetColour().GetColor() ); @@ -952,9 +1055,12 @@ void wxWindowDC::SetBackground( const wxBrush &brush ) gdk_gc_set_fill( m_bgGC, fillStyle ); - if (m_backgroundBrush.GetStyle() == wxSTIPPLE) + if ((m_backgroundBrush.GetStyle() == wxSTIPPLE) && (m_backgroundBrush.GetStipple()->Ok())) { - gdk_gc_set_stipple( m_bgGC, m_backgroundBrush.GetStipple()->GetPixmap() ); + if (m_brush.GetStipple()->GetPixmap()) + gdk_gc_set_tile( m_bgGC, m_brush.GetStipple()->GetPixmap() ); + else + gdk_gc_set_stipple( m_bgGC, m_brush.GetStipple()->GetBitmap() ); } if (IS_HATCH(m_backgroundBrush.GetStyle())) @@ -969,29 +1075,40 @@ void wxWindowDC::SetLogicalFunction( int function ) wxCHECK_RET( Ok(), _T("invalid window dc") ); if (m_logicalFunction == function) return; - + GdkFunction mode = GDK_COPY; switch (function) { - case wxXOR: mode = GDK_INVERT; break; - case wxINVERT: mode = GDK_XOR; break; -#if (GDK_MINOR_VERSION > 0) - case wxOR_REVERSE: mode = GDK_OR_REVERSE; break; - case wxAND_REVERSE: mode = GDK_AND_REVERSE; break; - case wxCLEAR: mode = GDK_CLEAR; break; - case wxSET: mode = GDK_SET; break; - case wxOR_INVERT: mode = GDK_OR_INVERT; break; - case wxAND: mode = GDK_AND; break; - case wxOR: mode = GDK_OR; break; - case wxEQUIV: mode = GDK_EQUIV; break; - case wxNAND: mode = GDK_NAND; break; - case wxAND_INVERT: mode = GDK_AND_INVERT; break; -/* ? wxSRC_INVERT GDK_AND_REVERSE, GDK_OR_REVERSE, GDK_OR_INVERT */ + case wxXOR: mode = GDK_XOR; break; + case wxINVERT: mode = GDK_INVERT; break; +#if (GTK_MINOR_VERSION > 0) + case wxOR_REVERSE: mode = GDK_OR_REVERSE; break; + case wxAND_REVERSE: mode = GDK_AND_REVERSE; break; + case wxCLEAR: mode = GDK_CLEAR; break; + case wxSET: mode = GDK_SET; break; + case wxOR_INVERT: mode = GDK_OR_INVERT; break; + case wxSRC_AND: + case wxAND: mode = GDK_AND; break; + case wxSRC_OR: + case wxOR: mode = GDK_OR; break; + case wxEQUIV: mode = GDK_EQUIV; break; + case wxNAND: mode = GDK_NAND; break; + case wxAND_INVERT: mode = GDK_AND_INVERT; break; + case wxCOPY: mode = GDK_COPY; break; + case wxNO_OP: mode = GDK_NOOP; break; + case wxSRC_INVERT: mode = GDK_COPY_INVERT; break; #endif - default: break; + default: + { + wxFAIL_MSG( _T("unsupported logical function") ); + break; + } } m_logicalFunction = function; + + if (!m_window) return; + gdk_gc_set_function( m_penGC, mode ); gdk_gc_set_function( m_brushGC, mode ); gdk_gc_set_function( m_textGC, mode ); @@ -1006,6 +1123,8 @@ void wxWindowDC::SetTextForeground( const wxColour &col ) m_textForegroundColour = col; if (!m_textForegroundColour.Ok()) return; + if (!m_window) return; + m_textForegroundColour.CalcPixel( m_cmap ); gdk_gc_set_foreground( m_textGC, m_textForegroundColour.GetColor() ); } @@ -1019,6 +1138,8 @@ void wxWindowDC::SetTextBackground( const wxColour &col ) m_textBackgroundColour = col; if (!m_textBackgroundColour.Ok()) return; + if (!m_window) return; + m_textBackgroundColour.CalcPixel( m_cmap ); gdk_gc_set_background( m_textGC, m_textBackgroundColour.GetColor() ); } @@ -1029,6 +1150,8 @@ void wxWindowDC::SetBackgroundMode( int mode ) m_backgroundMode = mode; + if (!m_window) return; + // CMB 21/7/98: fill style of cross-hatch brushes is affected by // transparent/solid background mode @@ -1050,6 +1173,8 @@ void wxWindowDC::DoSetClippingRegion( long x, long y, long width, long height ) wxDC::DoSetClippingRegion( x, y, width, height ); + if (!m_window) return; + GdkRectangle rect; rect.x = XLOG2DEV(x); rect.y = YLOG2DEV(y); @@ -1071,6 +1196,8 @@ void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion ®ion ) return; } + if (!m_window) return; + gdk_gc_set_clip_region( m_penGC, region.GetRegion() ); gdk_gc_set_clip_region( m_brushGC, region.GetRegion() ); gdk_gc_set_clip_region( m_textGC, region.GetRegion() ); @@ -1083,6 +1210,8 @@ void wxWindowDC::DestroyClippingRegion() wxDC::DestroyClippingRegion(); + if (!m_window) return; + gdk_gc_set_clip_rectangle( m_penGC, (GdkRectangle *) NULL ); gdk_gc_set_clip_rectangle( m_brushGC, (GdkRectangle *) NULL ); gdk_gc_set_clip_rectangle( m_textGC, (GdkRectangle *) NULL ); @@ -1118,9 +1247,15 @@ void wxWindowDC::SetUpDC() m_brush = wxNullBrush; SetBrush( tmp_brush ); +/* tmp_brush = m_backgroundBrush; m_backgroundBrush = wxNullBrush; SetBackground( tmp_brush ); +*/ + tmp_brush = m_backgroundBrush; + m_backgroundBrush = wxNullBrush; + SetBackground( *wxWHITE_BRUSH ); + m_backgroundBrush = tmp_brush; if (!hatch_bitmap) { @@ -1146,6 +1281,26 @@ void wxWindowDC::Destroy() m_bgGC = (GdkGC*) NULL; } +void wxWindowDC::ComputeScaleAndOrigin() +{ + /* CMB: copy scale to see if it changes */ + double origScaleX = m_scaleX; + double origScaleY = m_scaleY; + + wxDC::ComputeScaleAndOrigin(); + + /* CMB: if scale has changed call SetPen to recalulate the line width */ + if ((m_scaleX != origScaleX || m_scaleY != origScaleY) && + (m_pen.Ok())) + { + /* this is a bit artificial, but we need to force wxDC to think + the pen has changed */ + wxPen pen = m_pen; + m_pen = wxNullPen; + SetPen( pen ); + } +} + // Resolution in pixels per logical inch wxSize wxWindowDC::GetPPI() const {