update wxBrush and wxPen style in x11/dcclient.cpp

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@77851 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Vadim Zeitlin
2014-09-23 17:43:53 +00:00
parent 0d4eb27a0e
commit 24486d69a8

View File

@@ -54,8 +54,8 @@
#include "cross.xbm" #include "cross.xbm"
#define num_hatches 6 #define num_hatches 6
#define IS_15_PIX_HATCH(s) ((s)==wxCROSSDIAG_HATCH || (s)==wxHORIZONTAL_HATCH || (s)==wxVERTICAL_HATCH) #define IS_15_PIX_HATCH(s) ((s)==wxBRUSHSTYLE_CROSSDIAG_HATCH || (s)==wxBRUSHSTYLE_HORIZONTAL_HATCH || (s)==wxBRUSHSTYLE_VERTICAL_HATCH)
#define IS_16_PIX_HATCH(s) ((s)!=wxCROSSDIAG_HATCH && (s)!=wxHORIZONTAL_HATCH && (s)!=wxVERTICAL_HATCH) #define IS_16_PIX_HATCH(s) ((s)!=wxBRUSHSTYLE_CROSSDIAG_HATCH && (s)!=wxBRUSHSTYLE_HORIZONTAL_HATCH && (s)!=wxBRUSHSTYLE_VERTICAL_HATCH)
static Pixmap hatches[num_hatches]; static Pixmap hatches[num_hatches];
static Pixmap *hatch_bitmap = NULL; static Pixmap *hatch_bitmap = NULL;
@@ -371,7 +371,7 @@ void wxWindowDCImpl::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2
{ {
wxCHECK_RET( IsOk(), wxT("invalid window dc") ); wxCHECK_RET( IsOk(), wxT("invalid window dc") );
if (m_pen.GetStyle() != wxTRANSPARENT) if (m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT)
{ {
if (m_x11window) if (m_x11window)
{ {
@@ -397,7 +397,7 @@ void wxWindowDCImpl::DoCrossHair( wxCoord x, wxCoord y )
{ {
wxCHECK_RET( IsOk(), wxT("invalid window dc") ); wxCHECK_RET( IsOk(), wxT("invalid window dc") );
if (m_pen.GetStyle() != wxTRANSPARENT) if (m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT)
{ {
int w = 0; int w = 0;
int h = 0; int h = 0;
@@ -456,9 +456,9 @@ void wxWindowDCImpl::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
if (m_x11window) if (m_x11window)
{ {
if (m_brush.GetStyle() != wxTRANSPARENT) if (m_brush.GetStyle() != wxBRUSHSTYLE_TRANSPARENT)
{ {
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask())) if ((m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
{ {
XSetTSOrigin( (Display*) m_display, (GC) m_textGC, XSetTSOrigin( (Display*) m_display, (GC) m_textGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(), m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
@@ -489,7 +489,7 @@ void wxWindowDCImpl::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 ); XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
} else } else
if (m_brush.GetStyle() == wxSTIPPLE) if (m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE)
{ {
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(), m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
@@ -507,7 +507,7 @@ void wxWindowDCImpl::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2,
} }
} }
if (m_pen.GetStyle() != wxTRANSPARENT) if (m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT)
{ {
XDrawArc( (Display*) m_display, (Window) m_x11window, XDrawArc( (Display*) m_display, (Window) m_x11window,
(GC) m_penGC, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 ); (GC) m_penGC, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
@@ -542,9 +542,9 @@ void wxWindowDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxC
wxCoord start = wxCoord(sa * 64.0); wxCoord start = wxCoord(sa * 64.0);
wxCoord end = wxCoord((ea-sa) * 64.0); wxCoord end = wxCoord((ea-sa) * 64.0);
if (m_brush.GetStyle() != wxTRANSPARENT) if (m_brush.GetStyle() != wxBRUSHSTYLE_TRANSPARENT)
{ {
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask())) if ((m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
{ {
XSetTSOrigin( (Display*) m_display, (GC) m_textGC, XSetTSOrigin( (Display*) m_display, (GC) m_textGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(), m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
@@ -575,7 +575,7 @@ void wxWindowDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxC
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 ); XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
} else } else
if (m_brush.GetStyle() == wxSTIPPLE) if (m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE)
{ {
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(), m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
@@ -593,7 +593,7 @@ void wxWindowDCImpl::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxC
} }
} }
if (m_pen.GetStyle() != wxTRANSPARENT) if (m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT)
{ {
XDrawArc( (Display*) m_display, (Window) m_x11window, XDrawArc( (Display*) m_display, (Window) m_x11window,
(GC) m_penGC, xx, yy, ww, hh, start, end ); (GC) m_penGC, xx, yy, ww, hh, start, end );
@@ -608,7 +608,7 @@ void wxWindowDCImpl::DoDrawPoint( wxCoord x, wxCoord y )
{ {
wxCHECK_RET( IsOk(), wxT("invalid window dc") ); wxCHECK_RET( IsOk(), wxT("invalid window dc") );
if ((m_pen.GetStyle() != wxTRANSPARENT) && m_x11window) if ((m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT) && m_x11window)
XDrawPoint( (Display*) m_display, (Window) m_x11window, XDrawPoint( (Display*) m_display, (Window) m_x11window,
(GC) m_penGC, XLOG2DEV(x), YLOG2DEV(y) ); (GC) m_penGC, XLOG2DEV(x), YLOG2DEV(y) );
@@ -619,7 +619,7 @@ void wxWindowDCImpl::DoDrawLines( int n, const wxPoint points[], wxCoord xoffset
{ {
wxCHECK_RET( IsOk(), wxT("invalid window dc") ); wxCHECK_RET( IsOk(), wxT("invalid window dc") );
if (m_pen.GetStyle() == wxTRANSPARENT) return; if (m_pen.GetStyle() == wxPENSTYLE_TRANSPARENT) return;
if (n <= 0) return; if (n <= 0) return;
XPoint *xpoints = new XPoint[n]; XPoint *xpoints = new XPoint[n];
@@ -655,10 +655,10 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
if (m_x11window) if (m_x11window)
{ {
if (m_brush.GetStyle() != wxTRANSPARENT) if (m_brush.GetStyle() != wxBRUSHSTYLE_TRANSPARENT)
{ {
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask())) if ((m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
{ {
XSetTSOrigin( (Display*) m_display, (GC) m_textGC, XSetTSOrigin( (Display*) m_display, (GC) m_textGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(), m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
@@ -689,7 +689,7 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 ); XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
} else } else
if (m_brush.GetStyle() == wxSTIPPLE) if (m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE)
{ {
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(), m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
@@ -707,7 +707,7 @@ void wxWindowDCImpl::DoDrawPolygon( int n, const wxPoint points[],
} }
} }
if (m_pen.GetStyle () != wxTRANSPARENT) if (m_pen.GetStyle () != wxPENSTYLE_TRANSPARENT)
{ {
// Close figure for XDrawLines // Close figure for XDrawLines
xpoints[i].x = xpoints[0].x; xpoints[i].x = xpoints[0].x;
@@ -738,9 +738,9 @@ void wxWindowDCImpl::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoo
if (m_x11window) if (m_x11window)
{ {
if (m_brush.GetStyle() != wxTRANSPARENT) if (m_brush.GetStyle() != wxBRUSHSTYLE_TRANSPARENT)
{ {
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask())) if ((m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
{ {
XSetTSOrigin( (Display*) m_display, (GC) m_textGC, XSetTSOrigin( (Display*) m_display, (GC) m_textGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(), m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
@@ -771,7 +771,7 @@ void wxWindowDCImpl::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoo
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 ); XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
} else } else
if (m_brush.GetStyle() == wxSTIPPLE) if (m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE)
{ {
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(), m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
@@ -789,7 +789,7 @@ void wxWindowDCImpl::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoo
} }
} }
if (m_pen.GetStyle () != wxTRANSPARENT) if (m_pen.GetStyle () != wxPENSTYLE_TRANSPARENT)
{ {
XDrawRectangle( (Display*) m_display, (Window) m_x11window, XDrawRectangle( (Display*) m_display, (Window) m_x11window,
(GC) m_penGC, xx, yy, ww-1, hh-1 ); (GC) m_penGC, xx, yy, ww-1, hh-1 );
@@ -830,7 +830,7 @@ void wxWindowDCImpl::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width
// CMB: adjust size if outline is drawn otherwise the result is // CMB: adjust size if outline is drawn otherwise the result is
// 1 pixel too wide and high // 1 pixel too wide and high
if (m_pen.GetStyle() != wxTRANSPARENT) if (m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT)
{ {
ww--; ww--;
hh--; hh--;
@@ -845,9 +845,9 @@ void wxWindowDCImpl::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width
if (dd > hh) dd = hh; if (dd > hh) dd = hh;
rr = dd / 2; rr = dd / 2;
if (m_brush.GetStyle() != wxTRANSPARENT) if (m_brush.GetStyle() != wxBRUSHSTYLE_TRANSPARENT)
{ {
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask())) if ((m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
{ {
XSetTSOrigin( (Display*) m_display, (GC) m_textGC, XSetTSOrigin( (Display*) m_display, (GC) m_textGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(), m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
@@ -882,7 +882,7 @@ void wxWindowDCImpl::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width
XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx, yy+hh-dd, dd, dd, 180*64, 90*64 ); XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0); XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0);
} else } else
if (m_brush.GetStyle() == wxSTIPPLE) if (m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE)
{ {
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(), m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
@@ -905,7 +905,7 @@ void wxWindowDCImpl::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width
XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx, yy+hh-dd, dd, dd, 180*64, 90*64 ); XFillArc( (Display*) m_display, (Window) m_x11window, (GC) m_brushGC, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
} }
} }
if (m_pen.GetStyle() != wxTRANSPARENT) if (m_pen.GetStyle() != wxPENSTYLE_TRANSPARENT)
{ {
XDrawLine( (Display*) m_display, (Window) m_x11window, (GC) m_penGC, xx+rr+1, yy, xx+ww-rr, yy ); XDrawLine( (Display*) m_display, (Window) m_x11window, (GC) m_penGC, xx+rr+1, yy, xx+ww-rr, yy );
XDrawLine( (Display*) m_display, (Window) m_x11window, (GC) m_penGC, xx+rr+1, yy+hh, xx+ww-rr, yy+hh ); XDrawLine( (Display*) m_display, (Window) m_x11window, (GC) m_penGC, xx+rr+1, yy+hh, xx+ww-rr, yy+hh );
@@ -938,9 +938,9 @@ void wxWindowDCImpl::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord
if (m_x11window) if (m_x11window)
{ {
if (m_brush.GetStyle() != wxTRANSPARENT) if (m_brush.GetStyle() != wxBRUSHSTYLE_TRANSPARENT)
{ {
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask())) if ((m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
{ {
XSetTSOrigin( (Display*) m_display, (GC) m_textGC, XSetTSOrigin( (Display*) m_display, (GC) m_textGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(), m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
@@ -971,7 +971,7 @@ void wxWindowDCImpl::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 ); XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
} else } else
if (m_brush.GetStyle() == wxSTIPPLE) if (m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE)
{ {
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
m_deviceOriginX % m_brush.GetStipple()->GetWidth(), m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
@@ -989,7 +989,7 @@ void wxWindowDCImpl::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord
} }
} }
if (m_pen.GetStyle () != wxTRANSPARENT) if (m_pen.GetStyle () != wxPENSTYLE_TRANSPARENT)
{ {
XDrawArc( (Display*) m_display, (Window) m_x11window, XDrawArc( (Display*) m_display, (Window) m_x11window,
(GC) m_penGC, xx, yy, ww, hh, 0, 360*64 ); (GC) m_penGC, xx, yy, ww, hh, 0, 360*64 );
@@ -1643,7 +1643,7 @@ void wxWindowDCImpl::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
void wxWindowDCImpl::DoDrawRotatedText(const wxString& WXUNUSED(text), void wxWindowDCImpl::DoDrawRotatedText(const wxString& WXUNUSED(text),
wxCoord WXUNUSED(x), wxCoord WXUNUSED(y), wxCoord WXUNUSED(x), wxCoord WXUNUSED(y),
double WXUNUSED(angle)) double angle)
{ {
wxFAIL_MSG( "not implemented" ); wxFAIL_MSG( "not implemented" );
} }
@@ -1974,7 +1974,7 @@ void wxWindowDCImpl::SetBrush( const wxBrush &brush )
XSetFillStyle( (Display*) m_display, (GC) m_brushGC, FillSolid ); XSetFillStyle( (Display*) m_display, (GC) m_brushGC, FillSolid );
if ((m_brush.GetStyle() == wxSTIPPLE) && (m_brush.GetStipple()->IsOk())) if ((m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE) && (m_brush.GetStipple()->IsOk()))
{ {
if (m_brush.GetStipple()->GetPixmap()) if (m_brush.GetStipple()->GetPixmap())
{ {
@@ -1988,7 +1988,7 @@ void wxWindowDCImpl::SetBrush( const wxBrush &brush )
} }
} }
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask())) if ((m_brush.GetStyle() == wxBRUSHSTYLE_STIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
{ {
XSetFillStyle( (Display*) m_display, (GC) m_textGC, FillOpaqueStippled ); XSetFillStyle( (Display*) m_display, (GC) m_textGC, FillOpaqueStippled );
XSetStipple( (Display*) m_display, (GC) m_textGC, (Pixmap) m_brush.GetStipple()->GetMask()->GetBitmap() ); XSetStipple( (Display*) m_display, (GC) m_textGC, (Pixmap) m_brush.GetStipple()->GetMask()->GetBitmap() );
@@ -2025,7 +2025,7 @@ void wxWindowDCImpl::SetBackground( const wxBrush &brush )
XSetFillStyle( (Display*) m_display, (GC) m_bgGC, FillSolid ); XSetFillStyle( (Display*) m_display, (GC) m_bgGC, FillSolid );
if ((m_backgroundBrush.GetStyle() == wxSTIPPLE) && (m_backgroundBrush.GetStipple()->IsOk())) if ((m_backgroundBrush.GetStyle() == wxBRUSHSTYLE_STIPPLE) && (m_backgroundBrush.GetStipple()->IsOk()))
{ {
if (m_backgroundBrush.GetStipple()->GetPixmap()) if (m_backgroundBrush.GetStipple()->GetPixmap())
{ {
@@ -2175,7 +2175,7 @@ void wxWindowDCImpl::SetBackgroundMode( int mode )
// CMB 21/7/98: fill style of cross-hatch brushes is affected by // CMB 21/7/98: fill style of cross-hatch brushes is affected by
// transparent/solid background mode // transparent/solid background mode
if (m_brush.GetStyle() != wxSOLID && m_brush.GetStyle() != wxTRANSPARENT) if (m_brush.GetStyle() != wxBRUSHSTYLE_SOLID && m_brush.GetStyle() != wxBRUSHSTYLE_TRANSPARENT)
{ {
XSetFillStyle( (Display*) m_display, (GC) m_brushGC, XSetFillStyle( (Display*) m_display, (GC) m_brushGC,
(m_backgroundMode == wxTRANSPARENT) ? FillStippled : FillOpaqueStippled ); (m_backgroundMode == wxTRANSPARENT) ? FillStippled : FillOpaqueStippled );