IS_HATCH macro replaced with wxBrush::IsHatch() + source and docs little cleaning.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@30819 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba
2004-11-30 18:46:20 +00:00
parent 44ac608d14
commit ab9d0a8ca3
20 changed files with 631 additions and 579 deletions

View File

@@ -33,6 +33,7 @@ All (GUI):
- wxBookCtrl renamed to wxBookCtrlBase, wxBookCtrl is reserved for most native - wxBookCtrl renamed to wxBookCtrlBase, wxBookCtrl is reserved for most native
book control (for now wxChoicebook for MSSmartphone, wxNotebook for others). book control (for now wxChoicebook for MSSmartphone, wxNotebook for others).
Necessary event macros, types and styles mapped accordingly. Necessary event macros, types and styles mapped accordingly.
- new wxBrush::IsHatch() checking for brush type replaces IS_HATCH macro
Unix: Unix:

View File

@@ -178,6 +178,16 @@ Returns the brush style, one of:
\helpref{wxBrush::SetStyle}{wxbrushsetstyle}, \helpref{wxBrush::SetColour}{wxbrushsetcolour},\rtfsp \helpref{wxBrush::SetStyle}{wxbrushsetstyle}, \helpref{wxBrush::SetColour}{wxbrushsetcolour},\rtfsp
\helpref{wxBrush::SetStipple}{wxbrushsetstipple} \helpref{wxBrush::SetStipple}{wxbrushsetstipple}
\membersection{wxBrush::IsHatch}\label{wxbrushishatch}
\constfunc{bool}{IsHatch}{\void}
Returns true if the style of the brush is any of hatched fills.
\wxheading{See also}
\helpref{wxBrush::GetStyle}{wxbrushgetstyle}
\membersection{wxBrush::Ok}\label{wxbrushok} \membersection{wxBrush::Ok}\label{wxbrushok}
\constfunc{bool}{Ok}{\void} \constfunc{bool}{Ok}{\void}

View File

@@ -4,17 +4,17 @@ Listed here are the depreciated and incompatable changes made to wxWidgets.
For other changes (such as additional features, bug fixes, etc.) see the changes.txt file located in the docs directory of your wxWidgets directory. For other changes (such as additional features, bug fixes, etc.) see the changes.txt file located in the docs directory of your wxWidgets directory.
\subsection{Incompatable changes since 2.4.x} \subsection{Incompatable changes since 2.4.x}\label{incompatiblesince24}
\subsubsection{New window repainting behaviour} \subsubsection{New window repainting behaviour}\label{newwindowrepainting}
Windows are no longer fully repainted when resized, use new style wxFULL\_REPAINT\_ON\_RESIZE to force this (wxNO\_FULL\_REPAINT\_ON\_RESIZE still exists but doesn't do anything any more, this behaviour is default now). Windows are no longer fully repainted when resized, use new style wxFULL\_REPAINT\_ON\_RESIZE to force this (wxNO\_FULL\_REPAINT\_ON\_RESIZE still exists but doesn't do anything any more, this behaviour is default now).
\subsubsection{Window class member changes} \subsubsection{Window class member changes}\label{windowclassmemberchanges}
wxWindow::m\_font and m\_backgroundColour/m\_foregroundColour are no longer always set, use GetFont(), GetBack/ForegroundColour() to access them, and they will be dynamically determined if necessary. wxWindow::m\_font and m\_backgroundColour/m\_foregroundColour are no longer always set, use GetFont(), GetBack/ForegroundColour() to access them, and they will be dynamically determined if necessary.
\subsubsection{Sizers Internal Overhaul} \subsubsection{Sizers Internal Overhaul}\label{sizersinternaloverhaul}
The Sizers have had some fundamental internal changes in the 2.5.2 and 2.5.3 releases intended to make them do more of the "Right Thing" but also be as backwards compatible as possible. First a bit about how things used to work: The Sizers have had some fundamental internal changes in the 2.5.2 and 2.5.3 releases intended to make them do more of the "Right Thing" but also be as backwards compatible as possible. First a bit about how things used to work:
@@ -94,7 +94,7 @@ The Sizers have had some fundamental internal changes in the 2.5.2 and 2.5.3 rel
control is sized to a blending of the min size and best size. control is sized to a blending of the min size and best size.
This can be done by calling SetBestFittingSize. This can be done by calling SetBestFittingSize.
\subsubsection{Massive wxURL Rewrite} \subsubsection{Massive wxURL Rewrite}\label{wxurlrewrite}
wxURL has undergone some radical changes. wxURL has undergone some radical changes.
@@ -107,7 +107,7 @@ wxURL has undergone some radical changes.
* ConvertFromURI has been replaced by wxURI::Unescape. * ConvertFromURI has been replaced by wxURI::Unescape.
\subsubsection{Less drastic incompatable changes since 2.4.x} \subsubsection{Less drastic incompatable changes since 2.4.x}\label{24incompatiblelessdrastic}
- no initialization/cleanup can be done in wxApp/~wxApp because they are - no initialization/cleanup can be done in wxApp/~wxApp because they are
now called much earlier/later than before; please move any exiting code now called much earlier/later than before; please move any exiting code
@@ -188,7 +188,9 @@ wxURL has undergone some radical changes.
- wxSizer::Add/Insert returns pointer to wxSizerItem just added so conditions - wxSizer::Add/Insert returns pointer to wxSizerItem just added so conditions
writeen with if(Add(..)==true) will not work. Use if(Add(..)) instead. writeen with if(Add(..)==true) will not work. Use if(Add(..)) instead.
\subsection{Depreciated changes since 2.4.x} - New wxBrush::IsHatch() checking for brush type replaces IS_HATCH macro.
\subsection{Depreciated changes since 2.4.x}\label{depreciatedsince24}
- wxURL::GetInputStream() and similar functionality has been depreciated in - wxURL::GetInputStream() and similar functionality has been depreciated in
favor of other ways of connecting, such as though sockets or wxFileSystem. favor of other ways of connecting, such as though sockets or wxFileSystem.

View File

@@ -59,6 +59,9 @@ public:
int GetStyle() const; int GetStyle() const;
wxBitmap *GetStipple() const; wxBitmap *GetStipple() const;
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
virtual bool Ok() const virtual bool Ok() const
{ return (m_refData != NULL); } { return (m_refData != NULL); }

View File

@@ -1824,8 +1824,11 @@ enum
wxCAP_BUTT wxCAP_BUTT
}; };
/* VZ: why doesn't it start with "wx"? FIXME */ #if WXWIN_COMPATIBILITY_2_4
#define IS_HATCH(s) ((s)>=wxBDIAGONAL_HATCH && (s)<=wxVERTICAL_HATCH) #define IS_HATCH(s) ((s)>=wxBDIAGONAL_HATCH && (s)<=wxVERTICAL_HATCH)
#else
/* use wxBrush::IsHatch() instead thought wxMotif still uses it in src/motif/dcclient.cpp */
#endif
/* Logical ops */ /* Logical ops */
typedef enum typedef enum

View File

@@ -54,6 +54,9 @@ public:
wxColour &GetColour() const; wxColour &GetColour() const;
wxBitmap *GetStipple() const; wxBitmap *GetStipple() const;
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
void SetColour( const wxColour& col ); void SetColour( const wxColour& col );
void SetColour( unsigned char r, unsigned char g, unsigned char b ); void SetColour( unsigned char r, unsigned char g, unsigned char b );
void SetStyle( int style ); void SetStyle( int style );

View File

@@ -54,6 +54,9 @@ public:
wxColour &GetColour() const; wxColour &GetColour() const;
wxBitmap *GetStipple() const; wxBitmap *GetStipple() const;
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
void SetColour( const wxColour& col ); void SetColour( const wxColour& col );
void SetColour( unsigned char r, unsigned char g, unsigned char b ); void SetColour( unsigned char r, unsigned char g, unsigned char b );
void SetStyle( int style ); void SetStyle( int style );

View File

@@ -66,6 +66,9 @@ public:
int GetStyle() const ; int GetStyle() const ;
wxBitmap *GetStipple() const ; wxBitmap *GetStipple() const ;
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
virtual bool Ok() const { return (m_refData != NULL) ; } virtual bool Ok() const { return (m_refData != NULL) ; }
// Implementation // Implementation

View File

@@ -66,6 +66,9 @@ public:
int GetStyle() const ; int GetStyle() const ;
wxBitmap *GetStipple() const ; wxBitmap *GetStipple() const ;
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
virtual bool Ok() const { return (m_refData != NULL) ; } virtual bool Ok() const { return (m_refData != NULL) ; }
// Implementation // Implementation

View File

@@ -49,6 +49,9 @@ public:
wxColour &GetColour() const; wxColour &GetColour() const;
wxBitmap *GetStipple() const; wxBitmap *GetStipple() const;
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
void SetColour(const wxColour& col); void SetColour(const wxColour& col);
void SetColour(unsigned char r, unsigned char g, unsigned char b); void SetColour(unsigned char r, unsigned char g, unsigned char b);
void SetStyle(int style); void SetStyle(int style);

View File

@@ -48,6 +48,9 @@ public:
int GetStyle() const; int GetStyle() const;
wxBitmap *GetStipple() const; wxBitmap *GetStipple() const;
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
bool Ok() const { return m_refData != NULL; } bool Ok() const { return m_refData != NULL; }
// return the HBRUSH for this brush // return the HBRUSH for this brush

View File

@@ -68,6 +68,9 @@ public:
inline wxBitmap* GetStipple(void) const { return (M_BRUSHDATA ? & M_BRUSHDATA->m_vStipple : 0); }; inline wxBitmap* GetStipple(void) const { return (M_BRUSHDATA ? & M_BRUSHDATA->m_vStipple : 0); };
inline int GetPS(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_hBrush : 0); }; inline int GetPS(void) const { return (M_BRUSHDATA ? M_BRUSHDATA->m_hBrush : 0); };
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
inline virtual bool Ok(void) const { return (m_refData != NULL) ; } inline virtual bool Ok(void) const { return (m_refData != NULL) ; }
// //
@@ -79,7 +82,7 @@ public:
// //
bool RealizeResource(void); bool RealizeResource(void);
WXHANDLE GetResourceHandle(void) ; WXHANDLE GetResourceHandle(void) ;
bool FreeResource(bool bForce = FALSE); bool FreeResource(bool bForce = false);
bool IsFree(void) const; bool IsFree(void) const;
void Unshare(void); void Unshare(void);
}; // end of CLASS wxBrush }; // end of CLASS wxBrush

View File

@@ -48,6 +48,9 @@ public:
int GetStyle() const; int GetStyle() const;
wxBitmap *GetStipple() const; wxBitmap *GetStipple() const;
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
bool Ok() const { return m_refData != NULL; } bool Ok() const { return m_refData != NULL; }
// return the HBRUSH for this brush // return the HBRUSH for this brush

View File

@@ -51,6 +51,9 @@ public:
wxColour &GetColour() const; wxColour &GetColour() const;
wxBitmap *GetStipple() const; wxBitmap *GetStipple() const;
bool IsHatch() const
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
void SetColour( const wxColour& col ); void SetColour( const wxColour& col );
void SetColour( unsigned char r, unsigned char g, unsigned char b ); void SetColour( unsigned char r, unsigned char g, unsigned char b );
void SetStyle( int style ); void SetStyle( int style );

View File

@@ -225,11 +225,11 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type )
wxGCPool[i].m_gc = gdk_gc_new( window ); wxGCPool[i].m_gc = gdk_gc_new( window );
gdk_gc_set_exposures( wxGCPool[i].m_gc, FALSE ); gdk_gc_set_exposures( wxGCPool[i].m_gc, FALSE );
wxGCPool[i].m_type = type; wxGCPool[i].m_type = type;
wxGCPool[i].m_used = FALSE; wxGCPool[i].m_used = false;
} }
if ((!wxGCPool[i].m_used) && (wxGCPool[i].m_type == type)) if ((!wxGCPool[i].m_used) && (wxGCPool[i].m_type == type))
{ {
wxGCPool[i].m_used = TRUE; wxGCPool[i].m_used = true;
return wxGCPool[i].m_gc; return wxGCPool[i].m_gc;
} }
} }
@@ -249,7 +249,7 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type )
wxGCPool[wxGCPoolSize].m_gc = gdk_gc_new( window ); wxGCPool[wxGCPoolSize].m_gc = gdk_gc_new( window );
gdk_gc_set_exposures( wxGCPool[wxGCPoolSize].m_gc, FALSE ); gdk_gc_set_exposures( wxGCPool[wxGCPoolSize].m_gc, FALSE );
wxGCPool[wxGCPoolSize].m_type = type; wxGCPool[wxGCPoolSize].m_type = type;
wxGCPool[wxGCPoolSize].m_used = TRUE; wxGCPool[wxGCPoolSize].m_used = true;
// Set new value of pool size. // Set new value of pool size.
wxGCPoolSize += GC_POOL_ALLOC_SIZE; wxGCPoolSize += GC_POOL_ALLOC_SIZE;
@@ -270,7 +270,7 @@ static void wxFreePoolGC( GdkGC *gc )
{ {
if (wxGCPool[i].m_gc == gc) if (wxGCPool[i].m_gc == gc)
{ {
wxGCPool[i].m_used = FALSE; wxGCPool[i].m_used = false;
return; return;
} }
} }
@@ -291,8 +291,8 @@ wxWindowDC::wxWindowDC()
m_textGC = (GdkGC *) NULL; m_textGC = (GdkGC *) NULL;
m_bgGC = (GdkGC *) NULL; m_bgGC = (GdkGC *) NULL;
m_cmap = (GdkColormap *) NULL; m_cmap = (GdkColormap *) NULL;
m_isMemDC = FALSE; m_isMemDC = false;
m_isScreenDC = FALSE; m_isScreenDC = false;
m_owner = (wxWindow *)NULL; m_owner = (wxWindow *)NULL;
#ifdef __WXGTK20__ #ifdef __WXGTK20__
m_context = (PangoContext *)NULL; m_context = (PangoContext *)NULL;
@@ -311,8 +311,8 @@ wxWindowDC::wxWindowDC( wxWindow *window )
m_bgGC = (GdkGC *) NULL; m_bgGC = (GdkGC *) NULL;
m_cmap = (GdkColormap *) NULL; m_cmap = (GdkColormap *) NULL;
m_owner = (wxWindow *)NULL; m_owner = (wxWindow *)NULL;
m_isMemDC = FALSE; m_isMemDC = false;
m_isScreenDC = FALSE; m_isScreenDC = false;
m_font = window->GetFont(); m_font = window->GetFont();
GtkWidget *widget = window->m_wxwindow; GtkWidget *widget = window->m_wxwindow;
@@ -341,7 +341,7 @@ wxWindowDC::wxWindowDC( wxWindow *window )
if (!m_window) if (!m_window)
{ {
// Don't report problems as per MSW. // Don't report problems as per MSW.
m_ok = TRUE; m_ok = true;
return; return;
} }
@@ -374,7 +374,7 @@ wxWindowDC::~wxWindowDC()
void wxWindowDC::SetUpDC() void wxWindowDC::SetUpDC()
{ {
m_ok = TRUE; m_ok = true;
wxASSERT_MSG( !m_penGC, wxT("GCs already created") ); wxASSERT_MSG( !m_penGC, wxT("GCs already created") );
@@ -486,7 +486,7 @@ bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
wxImage image = bitmap.ConvertToImage(); wxImage image = bitmap.ConvertToImage();
col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0)); col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0));
return TRUE; return true;
} }
void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
@@ -1038,7 +1038,7 @@ void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
void wxWindowDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ) void wxWindowDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y )
{ {
// VZ: egcs 1.0.3 refuses to compile this without cast, no idea why // VZ: egcs 1.0.3 refuses to compile this without cast, no idea why
DoDrawBitmap( (const wxBitmap&)icon, x, y, (bool)TRUE ); DoDrawBitmap( (const wxBitmap&)icon, x, y, true );
} }
void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
@@ -1203,11 +1203,11 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
bool useMask, bool useMask,
wxCoord xsrcMask, wxCoord ysrcMask ) wxCoord xsrcMask, wxCoord ysrcMask )
{ {
wxCHECK_MSG( Ok(), FALSE, wxT("invalid window dc") ); wxCHECK_MSG( Ok(), false, wxT("invalid window dc") );
wxCHECK_MSG( source, FALSE, wxT("invalid source dc") ); wxCHECK_MSG( source, false, wxT("invalid source dc") );
if (!m_window) return FALSE; if (!m_window) return false;
// transform the source DC coords to the device ones // transform the source DC coords to the device ones
xsrc = source->XLOG2DEV(xsrc); xsrc = source->XLOG2DEV(xsrc);
@@ -1216,8 +1216,8 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
wxClientDC *srcDC = (wxClientDC*)source; wxClientDC *srcDC = (wxClientDC*)source;
wxMemoryDC *memDC = (wxMemoryDC*)source; wxMemoryDC *memDC = (wxMemoryDC*)source;
bool use_bitmap_method = FALSE; bool use_bitmap_method = false;
bool is_mono = FALSE; bool is_mono = false;
// TODO: use the mask origin when drawing transparently // TODO: use the mask origin when drawing transparently
if (xsrcMask == -1 && ysrcMask == -1) if (xsrcMask == -1 && ysrcMask == -1)
@@ -1228,7 +1228,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
if (srcDC->m_isMemDC) if (srcDC->m_isMemDC)
{ {
if (!memDC->m_selected.Ok()) return FALSE; if (!memDC->m_selected.Ok()) return false;
is_mono = (memDC->m_selected.GetDepth() == 1); is_mono = (memDC->m_selected.GetDepth() == 1);
@@ -1243,14 +1243,14 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
// we HAVE TO use the direct way for memory dcs // we HAVE TO use the direct way for memory dcs
// that have mask since the XCopyArea doesn't know // that have mask since the XCopyArea doesn't know
// about masks // about masks
use_bitmap_method = TRUE; use_bitmap_method = true;
} }
else if (is_mono) else if (is_mono)
{ {
// we HAVE TO use the direct way for memory dcs // we HAVE TO use the direct way for memory dcs
// that are bitmaps because XCopyArea doesn't cope // that are bitmaps because XCopyArea doesn't cope
// with different bit depths // with different bit depths
use_bitmap_method = TRUE; use_bitmap_method = true;
} }
else if ((xsrc == 0) && (ysrc == 0) && else if ((xsrc == 0) && (ysrc == 0) &&
(width == memDC->m_selected.GetWidth()) && (width == memDC->m_selected.GetWidth()) &&
@@ -1260,11 +1260,11 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
// in the memory dc is copied in which case XCopyArea // in the memory dc is copied in which case XCopyArea
// wouldn't be able able to boost performace by reducing // wouldn't be able able to boost performace by reducing
// the area to be scaled // the area to be scaled
use_bitmap_method = TRUE; use_bitmap_method = true;
} }
else else
{ {
use_bitmap_method = FALSE; use_bitmap_method = false;
} }
} }
@@ -1284,7 +1284,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
wxRegion tmp( xx,yy,ww,hh ); wxRegion tmp( xx,yy,ww,hh );
tmp.Intersect( m_currentClippingRegion ); tmp.Intersect( m_currentClippingRegion );
if (tmp.IsEmpty()) if (tmp.IsEmpty())
return TRUE; return true;
} }
int old_logical_func = m_logicalFunction; int old_logical_func = m_logicalFunction;
@@ -1464,7 +1464,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
SetLogicalFunction( old_logical_func ); SetLogicalFunction( old_logical_func );
return TRUE; return true;
} }
void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
@@ -1725,7 +1725,7 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
if ( externalLeading ) if ( externalLeading )
*externalLeading = 0; *externalLeading = 0;
if (string.IsEmpty()) if (string.empty())
{ {
return; return;
} }
@@ -2093,7 +2093,7 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
gdk_gc_set_stipple( m_textGC, m_brush.GetStipple()->GetMask()->GetBitmap() ); gdk_gc_set_stipple( m_textGC, m_brush.GetStipple()->GetMask()->GetBitmap() );
} }
if (IS_HATCH(m_brush.GetStyle())) if (m_brush.IsHatch())
{ {
gdk_gc_set_fill( m_brushGC, GDK_STIPPLED ); gdk_gc_set_fill( m_brushGC, GDK_STIPPLED );
int num = m_brush.GetStyle() - wxBDIAGONAL_HATCH; int num = m_brush.GetStyle() - wxBDIAGONAL_HATCH;
@@ -2138,7 +2138,7 @@ void wxWindowDC::SetBackground( const wxBrush &brush )
} }
} }
if (IS_HATCH(m_backgroundBrush.GetStyle())) if (m_backgroundBrush.IsHatch())
{ {
gdk_gc_set_fill( m_bgGC, GDK_STIPPLED ); gdk_gc_set_fill( m_bgGC, GDK_STIPPLED );
int num = m_backgroundBrush.GetStyle() - wxBDIAGONAL_HATCH; int num = m_backgroundBrush.GetStyle() - wxBDIAGONAL_HATCH;
@@ -2494,7 +2494,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxDCModule, wxModule)
bool wxDCModule::OnInit() bool wxDCModule::OnInit()
{ {
wxInitGCPool(); wxInitGCPool();
return TRUE; return true;
} }
void wxDCModule::OnExit() void wxDCModule::OnExit()

View File

@@ -225,11 +225,11 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type )
wxGCPool[i].m_gc = gdk_gc_new( window ); wxGCPool[i].m_gc = gdk_gc_new( window );
gdk_gc_set_exposures( wxGCPool[i].m_gc, FALSE ); gdk_gc_set_exposures( wxGCPool[i].m_gc, FALSE );
wxGCPool[i].m_type = type; wxGCPool[i].m_type = type;
wxGCPool[i].m_used = FALSE; wxGCPool[i].m_used = false;
} }
if ((!wxGCPool[i].m_used) && (wxGCPool[i].m_type == type)) if ((!wxGCPool[i].m_used) && (wxGCPool[i].m_type == type))
{ {
wxGCPool[i].m_used = TRUE; wxGCPool[i].m_used = true;
return wxGCPool[i].m_gc; return wxGCPool[i].m_gc;
} }
} }
@@ -249,7 +249,7 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type )
wxGCPool[wxGCPoolSize].m_gc = gdk_gc_new( window ); wxGCPool[wxGCPoolSize].m_gc = gdk_gc_new( window );
gdk_gc_set_exposures( wxGCPool[wxGCPoolSize].m_gc, FALSE ); gdk_gc_set_exposures( wxGCPool[wxGCPoolSize].m_gc, FALSE );
wxGCPool[wxGCPoolSize].m_type = type; wxGCPool[wxGCPoolSize].m_type = type;
wxGCPool[wxGCPoolSize].m_used = TRUE; wxGCPool[wxGCPoolSize].m_used = true;
// Set new value of pool size. // Set new value of pool size.
wxGCPoolSize += GC_POOL_ALLOC_SIZE; wxGCPoolSize += GC_POOL_ALLOC_SIZE;
@@ -270,7 +270,7 @@ static void wxFreePoolGC( GdkGC *gc )
{ {
if (wxGCPool[i].m_gc == gc) if (wxGCPool[i].m_gc == gc)
{ {
wxGCPool[i].m_used = FALSE; wxGCPool[i].m_used = false;
return; return;
} }
} }
@@ -291,8 +291,8 @@ wxWindowDC::wxWindowDC()
m_textGC = (GdkGC *) NULL; m_textGC = (GdkGC *) NULL;
m_bgGC = (GdkGC *) NULL; m_bgGC = (GdkGC *) NULL;
m_cmap = (GdkColormap *) NULL; m_cmap = (GdkColormap *) NULL;
m_isMemDC = FALSE; m_isMemDC = false;
m_isScreenDC = FALSE; m_isScreenDC = false;
m_owner = (wxWindow *)NULL; m_owner = (wxWindow *)NULL;
#ifdef __WXGTK20__ #ifdef __WXGTK20__
m_context = (PangoContext *)NULL; m_context = (PangoContext *)NULL;
@@ -311,8 +311,8 @@ wxWindowDC::wxWindowDC( wxWindow *window )
m_bgGC = (GdkGC *) NULL; m_bgGC = (GdkGC *) NULL;
m_cmap = (GdkColormap *) NULL; m_cmap = (GdkColormap *) NULL;
m_owner = (wxWindow *)NULL; m_owner = (wxWindow *)NULL;
m_isMemDC = FALSE; m_isMemDC = false;
m_isScreenDC = FALSE; m_isScreenDC = false;
m_font = window->GetFont(); m_font = window->GetFont();
GtkWidget *widget = window->m_wxwindow; GtkWidget *widget = window->m_wxwindow;
@@ -341,7 +341,7 @@ wxWindowDC::wxWindowDC( wxWindow *window )
if (!m_window) if (!m_window)
{ {
// Don't report problems as per MSW. // Don't report problems as per MSW.
m_ok = TRUE; m_ok = true;
return; return;
} }
@@ -374,7 +374,7 @@ wxWindowDC::~wxWindowDC()
void wxWindowDC::SetUpDC() void wxWindowDC::SetUpDC()
{ {
m_ok = TRUE; m_ok = true;
wxASSERT_MSG( !m_penGC, wxT("GCs already created") ); wxASSERT_MSG( !m_penGC, wxT("GCs already created") );
@@ -486,7 +486,7 @@ bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
wxImage image = bitmap.ConvertToImage(); wxImage image = bitmap.ConvertToImage();
col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0)); col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0));
return TRUE; return true;
} }
void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
@@ -1038,7 +1038,7 @@ void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
void wxWindowDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y ) void wxWindowDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y )
{ {
// VZ: egcs 1.0.3 refuses to compile this without cast, no idea why // VZ: egcs 1.0.3 refuses to compile this without cast, no idea why
DoDrawBitmap( (const wxBitmap&)icon, x, y, (bool)TRUE ); DoDrawBitmap( (const wxBitmap&)icon, x, y, true );
} }
void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap, void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
@@ -1203,11 +1203,11 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
bool useMask, bool useMask,
wxCoord xsrcMask, wxCoord ysrcMask ) wxCoord xsrcMask, wxCoord ysrcMask )
{ {
wxCHECK_MSG( Ok(), FALSE, wxT("invalid window dc") ); wxCHECK_MSG( Ok(), false, wxT("invalid window dc") );
wxCHECK_MSG( source, FALSE, wxT("invalid source dc") ); wxCHECK_MSG( source, false, wxT("invalid source dc") );
if (!m_window) return FALSE; if (!m_window) return false;
// transform the source DC coords to the device ones // transform the source DC coords to the device ones
xsrc = source->XLOG2DEV(xsrc); xsrc = source->XLOG2DEV(xsrc);
@@ -1216,8 +1216,8 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
wxClientDC *srcDC = (wxClientDC*)source; wxClientDC *srcDC = (wxClientDC*)source;
wxMemoryDC *memDC = (wxMemoryDC*)source; wxMemoryDC *memDC = (wxMemoryDC*)source;
bool use_bitmap_method = FALSE; bool use_bitmap_method = false;
bool is_mono = FALSE; bool is_mono = false;
// TODO: use the mask origin when drawing transparently // TODO: use the mask origin when drawing transparently
if (xsrcMask == -1 && ysrcMask == -1) if (xsrcMask == -1 && ysrcMask == -1)
@@ -1228,7 +1228,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
if (srcDC->m_isMemDC) if (srcDC->m_isMemDC)
{ {
if (!memDC->m_selected.Ok()) return FALSE; if (!memDC->m_selected.Ok()) return false;
is_mono = (memDC->m_selected.GetDepth() == 1); is_mono = (memDC->m_selected.GetDepth() == 1);
@@ -1243,14 +1243,14 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
// we HAVE TO use the direct way for memory dcs // we HAVE TO use the direct way for memory dcs
// that have mask since the XCopyArea doesn't know // that have mask since the XCopyArea doesn't know
// about masks // about masks
use_bitmap_method = TRUE; use_bitmap_method = true;
} }
else if (is_mono) else if (is_mono)
{ {
// we HAVE TO use the direct way for memory dcs // we HAVE TO use the direct way for memory dcs
// that are bitmaps because XCopyArea doesn't cope // that are bitmaps because XCopyArea doesn't cope
// with different bit depths // with different bit depths
use_bitmap_method = TRUE; use_bitmap_method = true;
} }
else if ((xsrc == 0) && (ysrc == 0) && else if ((xsrc == 0) && (ysrc == 0) &&
(width == memDC->m_selected.GetWidth()) && (width == memDC->m_selected.GetWidth()) &&
@@ -1260,11 +1260,11 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
// in the memory dc is copied in which case XCopyArea // in the memory dc is copied in which case XCopyArea
// wouldn't be able able to boost performace by reducing // wouldn't be able able to boost performace by reducing
// the area to be scaled // the area to be scaled
use_bitmap_method = TRUE; use_bitmap_method = true;
} }
else else
{ {
use_bitmap_method = FALSE; use_bitmap_method = false;
} }
} }
@@ -1284,7 +1284,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
wxRegion tmp( xx,yy,ww,hh ); wxRegion tmp( xx,yy,ww,hh );
tmp.Intersect( m_currentClippingRegion ); tmp.Intersect( m_currentClippingRegion );
if (tmp.IsEmpty()) if (tmp.IsEmpty())
return TRUE; return true;
} }
int old_logical_func = m_logicalFunction; int old_logical_func = m_logicalFunction;
@@ -1464,7 +1464,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
SetLogicalFunction( old_logical_func ); SetLogicalFunction( old_logical_func );
return TRUE; return true;
} }
void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
@@ -1725,7 +1725,7 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
if ( externalLeading ) if ( externalLeading )
*externalLeading = 0; *externalLeading = 0;
if (string.IsEmpty()) if (string.empty())
{ {
return; return;
} }
@@ -2093,7 +2093,7 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
gdk_gc_set_stipple( m_textGC, m_brush.GetStipple()->GetMask()->GetBitmap() ); gdk_gc_set_stipple( m_textGC, m_brush.GetStipple()->GetMask()->GetBitmap() );
} }
if (IS_HATCH(m_brush.GetStyle())) if (m_brush.IsHatch())
{ {
gdk_gc_set_fill( m_brushGC, GDK_STIPPLED ); gdk_gc_set_fill( m_brushGC, GDK_STIPPLED );
int num = m_brush.GetStyle() - wxBDIAGONAL_HATCH; int num = m_brush.GetStyle() - wxBDIAGONAL_HATCH;
@@ -2138,7 +2138,7 @@ void wxWindowDC::SetBackground( const wxBrush &brush )
} }
} }
if (IS_HATCH(m_backgroundBrush.GetStyle())) if (m_backgroundBrush.IsHatch())
{ {
gdk_gc_set_fill( m_bgGC, GDK_STIPPLED ); gdk_gc_set_fill( m_bgGC, GDK_STIPPLED );
int num = m_backgroundBrush.GetStyle() - wxBDIAGONAL_HATCH; int num = m_backgroundBrush.GetStyle() - wxBDIAGONAL_HATCH;
@@ -2494,7 +2494,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxDCModule, wxModule)
bool wxDCModule::OnInit() bool wxDCModule::OnInit()
{ {
wxInitGCPool(); wxInitGCPool();
return TRUE; return true;
} }
void wxDCModule::OnExit() void wxDCModule::OnExit()

View File

@@ -249,8 +249,8 @@ void wxMacCalculateColour( int logical_func , const RGBColor &srcColor , RGBColo
wxDC::wxDC() wxDC::wxDC()
{ {
m_ok = FALSE; m_ok = false;
m_colour = TRUE; m_colour = true;
m_mm_to_pix_x = mm2pt; m_mm_to_pix_x = mm2pt;
m_mm_to_pix_y = mm2pt; m_mm_to_pix_y = mm2pt;
m_internalDeviceOriginX = 0; m_internalDeviceOriginX = 0;
@@ -263,11 +263,11 @@ wxDC::wxDC()
m_userScaleY = 1.0; m_userScaleY = 1.0;
m_scaleX = 1.0; m_scaleX = 1.0;
m_scaleY = 1.0; m_scaleY = 1.0;
m_needComputeScaleX = FALSE; m_needComputeScaleX = false;
m_needComputeScaleY = FALSE; m_needComputeScaleY = false;
m_macPort = NULL ; m_macPort = NULL ;
m_macMask = NULL ; m_macMask = NULL ;
m_ok = FALSE ; m_ok = false ;
m_macFontInstalled = false ; m_macFontInstalled = false ;
m_macBrushInstalled = false ; m_macBrushInstalled = false ;
m_macPenInstalled = false ; m_macPenInstalled = false ;
@@ -453,7 +453,7 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
} }
else else
{ {
m_clipping = TRUE; m_clipping = true;
m_clipX1 = xx; m_clipX1 = xx;
m_clipY1 = yy; m_clipY1 = yy;
m_clipX2 = xx + ww; m_clipX2 = xx + ww;
@@ -500,7 +500,7 @@ void wxDC::DoSetClippingRegionAsRegion( const wxRegion &region )
} }
else else
{ {
m_clipping = TRUE; m_clipping = true;
m_clipX1 = xx; m_clipX1 = xx;
m_clipY1 = yy; m_clipY1 = yy;
m_clipX2 = xx + ww; m_clipX2 = xx + ww;
@@ -562,8 +562,8 @@ void wxDC::SetMapMode( int mode )
} }
if (mode != wxMM_TEXT) if (mode != wxMM_TEXT)
{ {
m_needComputeScaleX = TRUE; m_needComputeScaleX = true;
m_needComputeScaleY = TRUE; m_needComputeScaleY = true;
} }
} }
@@ -1064,7 +1064,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxCHECK_MSG(Ok(), false, wxT("wxDC::DoBlit Illegal dc")); wxCHECK_MSG(Ok(), false, wxT("wxDC::DoBlit Illegal dc"));
wxCHECK_MSG(source->Ok(), false, wxT("wxDC::DoBlit Illegal source DC")); wxCHECK_MSG(source->Ok(), false, wxT("wxDC::DoBlit Illegal source DC"));
if ( logical_func == wxNO_OP ) if ( logical_func == wxNO_OP )
return TRUE ; return true ;
if (xsrcMask == -1 && ysrcMask == -1) if (xsrcMask == -1 && ysrcMask == -1)
{ {
xsrcMask = xsrc; ysrcMask = ysrc; xsrcMask = xsrc; ysrcMask = ysrc;
@@ -1143,7 +1143,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
if ( mode == kUnsupportedMode ) if ( mode == kUnsupportedMode )
{ {
wxFAIL_MSG(wxT("unsupported blitting mode" )); wxFAIL_MSG(wxT("unsupported blitting mode" ));
return FALSE ; return false ;
} }
CGrafPtr sourcePort = (CGrafPtr) source->m_macPort ; CGrafPtr sourcePort = (CGrafPtr) source->m_macPort ;
PixMapHandle bmappixels = GetGWorldPixMap( sourcePort ) ; PixMapHandle bmappixels = GetGWorldPixMap( sourcePort ) ;
@@ -1302,7 +1302,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
m_macPenInstalled = false ; m_macPenInstalled = false ;
m_macBrushInstalled = false ; m_macBrushInstalled = false ;
m_macFontInstalled = false ; m_macFontInstalled = false ;
return TRUE; return true;
} }
#ifndef FixedToInt #ifndef FixedToInt
@@ -1958,7 +1958,7 @@ void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
int brushStyle = background.GetStyle(); int brushStyle = background.GetStyle();
if (brushStyle == wxSOLID) if (brushStyle == wxSOLID)
::BackPat(GetQDGlobalsWhite(&whiteColor)); ::BackPat(GetQDGlobalsWhite(&whiteColor));
else if (IS_HATCH(brushStyle)) else if (background.IsHatch())
{ {
Pattern pat ; Pattern pat ;
wxMacGetPattern(brushStyle, &pat); wxMacGetPattern(brushStyle, &pat);
@@ -1989,7 +1989,7 @@ void wxDC::MacInstallBrush() const
{ {
::PenPat(GetQDGlobalsBlack(&blackColor)); ::PenPat(GetQDGlobalsBlack(&blackColor));
} }
else if (IS_HATCH(brushStyle)) else if (m_brush.IsHatch())
{ {
Pattern pat ; Pattern pat ;
wxMacGetPattern(brushStyle, &pat); wxMacGetPattern(brushStyle, &pat);

View File

@@ -269,8 +269,8 @@ void wxMacCalculateColour( int logical_func , const RGBColor &srcColor , RGBColo
wxDC::wxDC() wxDC::wxDC()
{ {
m_ok = FALSE; m_ok = false;
m_colour = TRUE; m_colour = true;
m_mm_to_pix_x = mm2pt; m_mm_to_pix_x = mm2pt;
m_mm_to_pix_y = mm2pt; m_mm_to_pix_y = mm2pt;
m_internalDeviceOriginX = 0; m_internalDeviceOriginX = 0;
@@ -283,11 +283,11 @@ wxDC::wxDC()
m_userScaleY = 1.0; m_userScaleY = 1.0;
m_scaleX = 1.0; m_scaleX = 1.0;
m_scaleY = 1.0; m_scaleY = 1.0;
m_needComputeScaleX = FALSE; m_needComputeScaleX = false;
m_needComputeScaleY = FALSE; m_needComputeScaleY = false;
m_macPort = NULL ; m_macPort = NULL ;
m_macMask = NULL ; m_macMask = NULL ;
m_ok = FALSE ; m_ok = false ;
m_macFontInstalled = false ; m_macFontInstalled = false ;
m_macBrushInstalled = false ; m_macBrushInstalled = false ;
m_macPenInstalled = false ; m_macPenInstalled = false ;
@@ -473,7 +473,7 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
} }
else else
{ {
m_clipping = TRUE; m_clipping = true;
m_clipX1 = xx; m_clipX1 = xx;
m_clipY1 = yy; m_clipY1 = yy;
m_clipX2 = xx + ww; m_clipX2 = xx + ww;
@@ -520,7 +520,7 @@ void wxDC::DoSetClippingRegionAsRegion( const wxRegion &region )
} }
else else
{ {
m_clipping = TRUE; m_clipping = true;
m_clipX1 = xx; m_clipX1 = xx;
m_clipY1 = yy; m_clipY1 = yy;
m_clipX2 = xx + ww; m_clipX2 = xx + ww;
@@ -582,8 +582,8 @@ void wxDC::SetMapMode( int mode )
} }
if (mode != wxMM_TEXT) if (mode != wxMM_TEXT)
{ {
m_needComputeScaleX = TRUE; m_needComputeScaleX = true;
m_needComputeScaleY = TRUE; m_needComputeScaleY = true;
} }
} }
@@ -1100,7 +1100,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
wxCHECK_MSG(Ok(), false, wxT("wxDC::DoBlit Illegal dc")); wxCHECK_MSG(Ok(), false, wxT("wxDC::DoBlit Illegal dc"));
wxCHECK_MSG(source->Ok(), false, wxT("wxDC::DoBlit Illegal source DC")); wxCHECK_MSG(source->Ok(), false, wxT("wxDC::DoBlit Illegal source DC"));
if ( logical_func == wxNO_OP ) if ( logical_func == wxNO_OP )
return TRUE ; return true ;
if (xsrcMask == -1 && ysrcMask == -1) if (xsrcMask == -1 && ysrcMask == -1)
{ {
xsrcMask = xsrc; ysrcMask = ysrc; xsrcMask = xsrc; ysrcMask = ysrc;
@@ -1179,7 +1179,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
if ( mode == kUnsupportedMode ) if ( mode == kUnsupportedMode )
{ {
wxFAIL_MSG(wxT("unsupported blitting mode" )); wxFAIL_MSG(wxT("unsupported blitting mode" ));
return FALSE ; return false ;
} }
CGrafPtr sourcePort = (CGrafPtr) source->m_macPort ; CGrafPtr sourcePort = (CGrafPtr) source->m_macPort ;
PixMapHandle bmappixels = GetGWorldPixMap( sourcePort ) ; PixMapHandle bmappixels = GetGWorldPixMap( sourcePort ) ;
@@ -1338,7 +1338,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
m_macPenInstalled = false ; m_macPenInstalled = false ;
m_macBrushInstalled = false ; m_macBrushInstalled = false ;
m_macFontInstalled = false ; m_macFontInstalled = false ;
return TRUE; return true;
} }
#ifndef FixedToInt #ifndef FixedToInt
@@ -2093,7 +2093,7 @@ void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
int brushStyle = background.GetStyle(); int brushStyle = background.GetStyle();
if (brushStyle == wxSOLID) if (brushStyle == wxSOLID)
::BackPat(GetQDGlobalsWhite(&whiteColor)); ::BackPat(GetQDGlobalsWhite(&whiteColor));
else if (IS_HATCH(brushStyle)) else if (background.IsHatch())
{ {
Pattern pat ; Pattern pat ;
wxMacGetPattern(brushStyle, &pat); wxMacGetPattern(brushStyle, &pat);
@@ -2123,7 +2123,7 @@ void wxDC::MacInstallBrush() const
{ {
::PenPat(GetQDGlobalsBlack(&blackColor)); ::PenPat(GetQDGlobalsBlack(&blackColor));
} }
else if (IS_HATCH(brushStyle)) else if (m_brush.IsHatch())
{ {
Pattern pat ; Pattern pat ;
wxMacGetPattern(brushStyle, &pat); wxMacGetPattern(brushStyle, &pat);

View File

@@ -90,6 +90,12 @@ static Pixmap bdiag, cdiag, fdiag, cross, horiz, verti;
IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC) IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC) IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
#ifndef IS_HATCH
// IS_HATCH exists for WXWIN_COMPATIBILITY_2_4 only
// but wxMotif needs it for its internals here
#define IS_HATCH(s) ((s)>=wxBDIAGONAL_HATCH && (s)<=wxVERTICAL_HATCH)
#endif
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
// prototypes // prototypes
// ---------------------------------------------------------------------------- // ----------------------------------------------------------------------------
@@ -163,7 +169,7 @@ wxWindowDC::wxWindowDC( wxWindow *window )
m_window = window; m_window = window;
m_font = window->GetFont(); m_font = window->GetFont();
m_ok = TRUE; m_ok = true;
m_display = window->GetXDisplay(); m_display = window->GetXDisplay();
m_pixmap = window->GetXWindow(); m_pixmap = window->GetXWindow();
@@ -242,7 +248,7 @@ bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
memdc.SelectObject(wxNullBitmap); memdc.SelectObject(wxNullBitmap);
wxImage image = bitmap.ConvertToImage(); wxImage image = bitmap.ConvertToImage();
col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0)); col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0));
return TRUE; return true;
} }
void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
@@ -781,9 +787,9 @@ void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
bool wxWindowDC::CanDrawBitmap() const bool wxWindowDC::CanDrawBitmap() const
{ {
wxCHECK_MSG( Ok(), FALSE, "invalid dc" ); wxCHECK_MSG( Ok(), false, "invalid dc" );
return TRUE; return true;
} }
// TODO: use scaled Blit e.g. as per John Price's implementation // TODO: use scaled Blit e.g. as per John Price's implementation
@@ -794,7 +800,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
int rop, bool useMask, int rop, bool useMask,
wxCoord xsrcMask, wxCoord ysrcMask ) wxCoord xsrcMask, wxCoord ysrcMask )
{ {
wxCHECK_MSG( Ok(), FALSE, "invalid dc" ); wxCHECK_MSG( Ok(), false, "invalid dc" );
wxWindowDC* sourceDC = wxDynamicCast(source, wxWindowDC); wxWindowDC* sourceDC = wxDynamicCast(source, wxWindowDC);
@@ -823,7 +829,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
if( m_textForegroundColour.GetPixel() <= -1 ) if( m_textForegroundColour.GetPixel() <= -1 )
CalculatePixel( m_textForegroundColour, CalculatePixel( m_textForegroundColour,
m_textForegroundColour, TRUE); m_textForegroundColour, true);
int pixel = m_textForegroundColour.GetPixel(); int pixel = m_textForegroundColour.GetPixel();
if (pixel > -1) if (pixel > -1)
@@ -836,7 +842,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
Pixmap sourcePixmap = (Pixmap) NULL; Pixmap sourcePixmap = (Pixmap) NULL;
double scaleX, scaleY; double scaleX, scaleY;
GetUserScale(& scaleX, & scaleY); GetUserScale(& scaleX, & scaleY);
bool retVal = FALSE; bool retVal = false;
/* TODO: use the mask origin when drawing transparently */ /* TODO: use the mask origin when drawing transparently */
if (xsrcMask == -1 && ysrcMask == -1) if (xsrcMask == -1 && ysrcMask == -1)
@@ -997,7 +1003,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
SetLogicalFunction(orig); SetLogicalFunction(orig);
retVal = TRUE; retVal = true;
} }
if (scaledBitmap) delete scaledBitmap; if (scaledBitmap) delete scaledBitmap;
@@ -1115,7 +1121,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
if (!sameColour || !GetOptimization()) if (!sameColour || !GetOptimization())
{ {
int pixel = CalculatePixel(m_textForegroundColour, int pixel = CalculatePixel(m_textForegroundColour,
m_currentColour, FALSE); m_currentColour, false);
// Set the GC to the required colour // Set the GC to the required colour
if (pixel > -1) if (pixel > -1)
@@ -1191,7 +1197,7 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
if( m_textForegroundColour.GetPixel() <= -1 ) if( m_textForegroundColour.GetPixel() <= -1 )
CalculatePixel( m_textForegroundColour, CalculatePixel( m_textForegroundColour,
m_textForegroundColour, TRUE); m_textForegroundColour, true);
foregroundPixel = m_textForegroundColour.GetPixel(); foregroundPixel = m_textForegroundColour.GetPixel();
} }
@@ -1323,7 +1329,7 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
bool wxWindowDC::CanGetTextExtent() const bool wxWindowDC::CanGetTextExtent() const
{ {
return TRUE; return true;
} }
void wxWindowDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height, void wxWindowDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height,
@@ -1789,7 +1795,7 @@ void wxWindowDC::SetPen( const wxPen &pen )
pixel = m_backgroundPixel; pixel = m_backgroundPixel;
else else
{ {
pixel = CalculatePixel(m_pen.GetColour(), m_currentColour, FALSE); pixel = CalculatePixel(m_pen.GetColour(), m_currentColour, false);
} }
// Finally, set the GC to the required colour // Finally, set the GC to the required colour
@@ -1951,7 +1957,7 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
// must test m_logicalFunction, because it involves background! // must test m_logicalFunction, because it involves background!
if (!sameColour || !GetOptimization() || m_logicalFunction == wxXOR) if (!sameColour || !GetOptimization() || m_logicalFunction == wxXOR)
{ {
int pixel = CalculatePixel(m_brush.GetColour(), m_currentColour, TRUE); int pixel = CalculatePixel(m_brush.GetColour(), m_currentColour, true);
if (pixel > -1) if (pixel > -1)
SetForegroundPixelWithLogicalFunction(pixel); SetForegroundPixelWithLogicalFunction(pixel);

View File

@@ -127,11 +127,11 @@ static GC wxGetPoolGC( Window window, wxPoolGCType type )
wxGCPool[i].m_gc = XCreateGC( wxGlobalDisplay(), window, 0, NULL ); wxGCPool[i].m_gc = XCreateGC( wxGlobalDisplay(), window, 0, NULL );
XSetGraphicsExposures( wxGlobalDisplay(), wxGCPool[i].m_gc, FALSE ); XSetGraphicsExposures( wxGlobalDisplay(), wxGCPool[i].m_gc, FALSE );
wxGCPool[i].m_type = type; wxGCPool[i].m_type = type;
wxGCPool[i].m_used = FALSE; wxGCPool[i].m_used = false;
} }
if ((!wxGCPool[i].m_used) && (wxGCPool[i].m_type == type)) if ((!wxGCPool[i].m_used) && (wxGCPool[i].m_type == type))
{ {
wxGCPool[i].m_used = TRUE; wxGCPool[i].m_used = true;
return wxGCPool[i].m_gc; return wxGCPool[i].m_gc;
} }
} }
@@ -147,7 +147,7 @@ static void wxFreePoolGC( GC gc )
{ {
if (wxGCPool[i].m_gc == gc) if (wxGCPool[i].m_gc == gc)
{ {
wxGCPool[i].m_used = FALSE; wxGCPool[i].m_used = false;
return; return;
} }
} }
@@ -169,8 +169,8 @@ wxWindowDC::wxWindowDC()
m_textGC = (WXGC *) NULL; m_textGC = (WXGC *) NULL;
m_bgGC = (WXGC *) NULL; m_bgGC = (WXGC *) NULL;
m_cmap = (WXColormap *) NULL; m_cmap = (WXColormap *) NULL;
m_isMemDC = FALSE; m_isMemDC = false;
m_isScreenDC = FALSE; m_isScreenDC = false;
m_owner = (wxWindow *)NULL; m_owner = (wxWindow *)NULL;
#if wxUSE_UNICODE #if wxUSE_UNICODE
@@ -190,8 +190,8 @@ wxWindowDC::wxWindowDC( wxWindow *window )
m_bgGC = (WXGC *) NULL; m_bgGC = (WXGC *) NULL;
m_cmap = (WXColormap *) NULL; m_cmap = (WXColormap *) NULL;
m_owner = (wxWindow *)NULL; m_owner = (wxWindow *)NULL;
m_isMemDC = FALSE; m_isMemDC = false;
m_isScreenDC = FALSE; m_isScreenDC = false;
m_font = window->GetFont(); m_font = window->GetFont();
m_window = (WXWindow*) window->GetMainWindow(); m_window = (WXWindow*) window->GetMainWindow();
@@ -200,7 +200,7 @@ wxWindowDC::wxWindowDC( wxWindow *window )
if (!m_window) if (!m_window)
{ {
// don't report problems // don't report problems
m_ok = TRUE; m_ok = true;
return; return;
} }
@@ -234,7 +234,7 @@ wxWindowDC::~wxWindowDC()
void wxWindowDC::SetUpDC() void wxWindowDC::SetUpDC()
{ {
m_ok = TRUE; m_ok = true;
wxASSERT_MSG( !m_penGC, wxT("GCs already created") ); wxASSERT_MSG( !m_penGC, wxT("GCs already created") );
@@ -356,7 +356,7 @@ bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
memdc.SelectObject(wxNullBitmap); memdc.SelectObject(wxNullBitmap);
wxImage image(bitmap.ConvertToImage()); wxImage image(bitmap.ConvertToImage());
col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0)); col->Set(image.GetRed(0, 0), image.GetGreen(0, 0), image.GetBlue(0, 0));
return TRUE; return true;
} }
void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
@@ -993,7 +993,7 @@ void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
void wxWindowDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y) void wxWindowDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y)
{ {
DoDrawBitmap(icon, x, y, TRUE); DoDrawBitmap(icon, x, y, true);
} }
#if wxUSE_NANOX #if wxUSE_NANOX
@@ -1257,11 +1257,11 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
of the source dc, but scales correctly on the target dc and of the source dc, but scales correctly on the target dc and
knows about possible mask information in a memory dc. */ knows about possible mask information in a memory dc. */
wxCHECK_MSG( Ok(), FALSE, wxT("invalid window dc") ); wxCHECK_MSG( Ok(), false, wxT("invalid window dc") );
wxCHECK_MSG( source, FALSE, wxT("invalid source dc") ); wxCHECK_MSG( source, false, wxT("invalid source dc") );
if (!m_window) return FALSE; if (!m_window) return false;
// transform the source DC coords to the device ones // transform the source DC coords to the device ones
xsrc = source->XLOG2DEV(xsrc); xsrc = source->XLOG2DEV(xsrc);
@@ -1270,8 +1270,8 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
wxClientDC *srcDC = (wxClientDC*)source; wxClientDC *srcDC = (wxClientDC*)source;
wxMemoryDC *memDC = (wxMemoryDC*)source; wxMemoryDC *memDC = (wxMemoryDC*)source;
bool use_bitmap_method = FALSE; bool use_bitmap_method = false;
bool is_mono = FALSE; bool is_mono = false;
// TODO: use the mask origin when drawing transparently // TODO: use the mask origin when drawing transparently
if (xsrcMask == -1 && ysrcMask == -1) if (xsrcMask == -1 && ysrcMask == -1)
@@ -1282,7 +1282,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
if (srcDC->m_isMemDC) if (srcDC->m_isMemDC)
{ {
if (!memDC->m_selected.Ok()) return FALSE; if (!memDC->m_selected.Ok()) return false;
/* we use the "XCopyArea" way to copy a memory dc into /* we use the "XCopyArea" way to copy a memory dc into
y different window if the memory dc BOTH y different window if the memory dc BOTH
@@ -1295,15 +1295,15 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
/* we HAVE TO use the direct way for memory dcs /* we HAVE TO use the direct way for memory dcs
that have mask since the XCopyArea doesn't know that have mask since the XCopyArea doesn't know
about masks */ about masks */
use_bitmap_method = TRUE; use_bitmap_method = true;
} }
else if (memDC->m_selected.GetDepth() == 1) else if (memDC->m_selected.GetDepth() == 1)
{ {
/* we HAVE TO use the direct way for memory dcs /* we HAVE TO use the direct way for memory dcs
that are bitmaps because XCopyArea doesn't cope that are bitmaps because XCopyArea doesn't cope
with different bit depths */ with different bit depths */
is_mono = TRUE; is_mono = true;
use_bitmap_method = TRUE; use_bitmap_method = true;
} }
else if ((xsrc == 0) && (ysrc == 0) && else if ((xsrc == 0) && (ysrc == 0) &&
(width == memDC->m_selected.GetWidth()) && (width == memDC->m_selected.GetWidth()) &&
@@ -1313,11 +1313,11 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
in the memory dc is copied in which case XCopyArea in the memory dc is copied in which case XCopyArea
wouldn't be able able to boost performace by reducing wouldn't be able able to boost performace by reducing
the area to be scaled */ the area to be scaled */
use_bitmap_method = TRUE; use_bitmap_method = true;
} }
else else
{ {
use_bitmap_method = FALSE; use_bitmap_method = false;
} }
} }
@@ -1337,7 +1337,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
wxRegion tmp( xx,yy,ww,hh ); wxRegion tmp( xx,yy,ww,hh );
tmp.Intersect( m_currentClippingRegion ); tmp.Intersect( m_currentClippingRegion );
if (tmp.IsEmpty()) if (tmp.IsEmpty())
return TRUE; return true;
} }
int old_logical_func = m_logicalFunction; int old_logical_func = m_logicalFunction;
@@ -1500,7 +1500,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
SetLogicalFunction( old_logical_func ); SetLogicalFunction( old_logical_func );
return TRUE; return true;
} }
void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y ) void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
@@ -1602,7 +1602,7 @@ void wxWindowDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoor
{ {
wxCHECK_RET( Ok(), wxT("invalid dc") ); wxCHECK_RET( Ok(), wxT("invalid dc") );
if (string.IsEmpty()) if (string.empty())
{ {
if (width) (*width) = 0; if (width) (*width) = 0;
if (height) (*height) = 0; if (height) (*height) = 0;
@@ -1935,7 +1935,7 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
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() );
} }
if (IS_HATCH(m_brush.GetStyle())) if (m_brush.IsHatch())
{ {
XSetFillStyle( (Display*) m_display, (GC) m_brushGC, FillStippled ); XSetFillStyle( (Display*) m_display, (GC) m_brushGC, FillStippled );
int num = m_brush.GetStyle() - wxBDIAGONAL_HATCH; int num = m_brush.GetStyle() - wxBDIAGONAL_HATCH;
@@ -1980,7 +1980,7 @@ void wxWindowDC::SetBackground( const wxBrush &brush )
} }
} }
if (IS_HATCH(m_backgroundBrush.GetStyle())) if (m_backgroundBrush.IsHatch())
{ {
XSetFillStyle( (Display*) m_display, (GC) m_bgGC, FillStippled ); XSetFillStyle( (Display*) m_display, (GC) m_bgGC, FillStippled );
int num = m_backgroundBrush.GetStyle() - wxBDIAGONAL_HATCH; int num = m_backgroundBrush.GetStyle() - wxBDIAGONAL_HATCH;
@@ -2355,7 +2355,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxDCModule, wxModule)
bool wxDCModule::OnInit() bool wxDCModule::OnInit()
{ {
wxInitGCPool(); wxInitGCPool();
return TRUE; return true;
} }
void wxDCModule::OnExit() void wxDCModule::OnExit()