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:
parent
44ac608d14
commit
ab9d0a8ca3
@ -33,6 +33,7 @@ All (GUI):
|
||||
- wxBookCtrl renamed to wxBookCtrlBase, wxBookCtrl is reserved for most native
|
||||
book control (for now wxChoicebook for MSSmartphone, wxNotebook for others).
|
||||
Necessary event macros, types and styles mapped accordingly.
|
||||
- new wxBrush::IsHatch() checking for brush type replaces IS_HATCH macro
|
||||
|
||||
Unix:
|
||||
|
||||
|
@ -178,6 +178,16 @@ Returns the brush style, one of:
|
||||
\helpref{wxBrush::SetStyle}{wxbrushsetstyle}, \helpref{wxBrush::SetColour}{wxbrushsetcolour},\rtfsp
|
||||
\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}
|
||||
|
||||
\constfunc{bool}{Ok}{\void}
|
||||
|
@ -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.
|
||||
|
||||
\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).
|
||||
|
||||
\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.
|
||||
|
||||
\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:
|
||||
|
||||
@ -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.
|
||||
This can be done by calling SetBestFittingSize.
|
||||
|
||||
\subsubsection{Massive wxURL Rewrite}
|
||||
\subsubsection{Massive wxURL Rewrite}\label{wxurlrewrite}
|
||||
|
||||
wxURL has undergone some radical changes.
|
||||
|
||||
@ -107,7 +107,7 @@ wxURL has undergone some radical changes.
|
||||
|
||||
* 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
|
||||
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
|
||||
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
|
||||
favor of other ways of connecting, such as though sockets or wxFileSystem.
|
||||
|
@ -6,7 +6,7 @@
|
||||
// Created: 2003/07/03
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) 2003 David Elliott
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef __WX_COCOA_BRUSH_H__
|
||||
@ -59,6 +59,9 @@ public:
|
||||
int GetStyle() const;
|
||||
wxBitmap *GetStipple() const;
|
||||
|
||||
bool IsHatch() const
|
||||
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
|
||||
|
||||
virtual bool Ok() const
|
||||
{ return (m_refData != NULL); }
|
||||
|
||||
|
@ -1824,28 +1824,31 @@ enum
|
||||
wxCAP_BUTT
|
||||
};
|
||||
|
||||
/* VZ: why doesn't it start with "wx"? FIXME */
|
||||
#define IS_HATCH(s) ((s)>=wxBDIAGONAL_HATCH && (s)<=wxVERTICAL_HATCH)
|
||||
#if WXWIN_COMPATIBILITY_2_4
|
||||
#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 */
|
||||
typedef enum
|
||||
{
|
||||
wxCLEAR, wxROP_BLACK = wxCLEAR, wxBLIT_BLACKNESS = wxCLEAR, /* 0 */
|
||||
wxXOR, wxROP_XORPEN = wxXOR, wxBLIT_SRCINVERT = wxXOR, /* src XOR dst */
|
||||
wxINVERT, wxROP_NOT = wxINVERT, wxBLIT_DSTINVERT = wxINVERT, /* NOT dst */
|
||||
wxOR_REVERSE, wxROP_MERGEPENNOT = wxOR_REVERSE, wxBLIT_00DD0228 = wxOR_REVERSE, /* src OR (NOT dst) */
|
||||
wxAND_REVERSE, wxROP_MASKPENNOT = wxAND_REVERSE, wxBLIT_SRCERASE = wxAND_REVERSE, /* src AND (NOT dst) */
|
||||
wxCOPY, wxROP_COPYPEN = wxCOPY, wxBLIT_SRCCOPY = wxCOPY, /* src */
|
||||
wxAND, wxROP_MASKPEN = wxAND, wxBLIT_SRCAND = wxAND, /* src AND dst */
|
||||
wxAND_INVERT, wxROP_MASKNOTPEN = wxAND_INVERT, wxBLIT_00220326 = wxAND_INVERT, /* (NOT src) AND dst */
|
||||
wxNO_OP, wxROP_NOP = wxNO_OP, wxBLIT_00AA0029 = wxNO_OP, /* dst */
|
||||
wxNOR, wxROP_NOTMERGEPEN = wxNOR, wxBLIT_NOTSRCERASE = wxNOR, /* (NOT src) AND (NOT dst) */
|
||||
wxEQUIV, wxROP_NOTXORPEN = wxEQUIV, wxBLIT_00990066 = wxEQUIV, /* (NOT src) XOR dst */
|
||||
wxSRC_INVERT, wxROP_NOTCOPYPEN = wxSRC_INVERT, wxBLIT_NOTSCRCOPY = wxSRC_INVERT, /* (NOT src) */
|
||||
wxOR_INVERT, wxROP_MERGENOTPEN = wxOR_INVERT, wxBLIT_MERGEPAINT = wxOR_INVERT, /* (NOT src) OR dst */
|
||||
wxNAND, wxROP_NOTMASKPEN = wxNAND, wxBLIT_007700E6 = wxNAND, /* (NOT src) OR (NOT dst) */
|
||||
wxOR, wxROP_MERGEPEN = wxOR, wxBLIT_SRCPAINT = wxOR, /* src OR dst */
|
||||
wxSET, wxROP_WHITE = wxSET, wxBLIT_WHITENESS = wxSET /* 1 */
|
||||
wxCLEAR, wxROP_BLACK = wxCLEAR, wxBLIT_BLACKNESS = wxCLEAR, /* 0 */
|
||||
wxXOR, wxROP_XORPEN = wxXOR, wxBLIT_SRCINVERT = wxXOR, /* src XOR dst */
|
||||
wxINVERT, wxROP_NOT = wxINVERT, wxBLIT_DSTINVERT = wxINVERT, /* NOT dst */
|
||||
wxOR_REVERSE, wxROP_MERGEPENNOT = wxOR_REVERSE, wxBLIT_00DD0228 = wxOR_REVERSE, /* src OR (NOT dst) */
|
||||
wxAND_REVERSE, wxROP_MASKPENNOT = wxAND_REVERSE, wxBLIT_SRCERASE = wxAND_REVERSE, /* src AND (NOT dst) */
|
||||
wxCOPY, wxROP_COPYPEN = wxCOPY, wxBLIT_SRCCOPY = wxCOPY, /* src */
|
||||
wxAND, wxROP_MASKPEN = wxAND, wxBLIT_SRCAND = wxAND, /* src AND dst */
|
||||
wxAND_INVERT, wxROP_MASKNOTPEN = wxAND_INVERT, wxBLIT_00220326 = wxAND_INVERT, /* (NOT src) AND dst */
|
||||
wxNO_OP, wxROP_NOP = wxNO_OP, wxBLIT_00AA0029 = wxNO_OP, /* dst */
|
||||
wxNOR, wxROP_NOTMERGEPEN = wxNOR, wxBLIT_NOTSRCERASE = wxNOR, /* (NOT src) AND (NOT dst) */
|
||||
wxEQUIV, wxROP_NOTXORPEN = wxEQUIV, wxBLIT_00990066 = wxEQUIV, /* (NOT src) XOR dst */
|
||||
wxSRC_INVERT, wxROP_NOTCOPYPEN = wxSRC_INVERT, wxBLIT_NOTSCRCOPY = wxSRC_INVERT, /* (NOT src) */
|
||||
wxOR_INVERT, wxROP_MERGENOTPEN = wxOR_INVERT, wxBLIT_MERGEPAINT = wxOR_INVERT, /* (NOT src) OR dst */
|
||||
wxNAND, wxROP_NOTMASKPEN = wxNAND, wxBLIT_007700E6 = wxNAND, /* (NOT src) OR (NOT dst) */
|
||||
wxOR, wxROP_MERGEPEN = wxOR, wxBLIT_SRCPAINT = wxOR, /* src OR dst */
|
||||
wxSET, wxROP_WHITE = wxSET, wxBLIT_WHITENESS = wxSET /* 1 */
|
||||
} form_ops_t;
|
||||
|
||||
/* Flood styles */
|
||||
@ -1910,7 +1913,7 @@ enum wxKeyCode
|
||||
/* These are, by design, not compatable with unicode characters.
|
||||
If you want to get a unicode character from a key event, use
|
||||
wxKeyEvent::GetUnicodeKey instead. */
|
||||
WXK_START = 300,
|
||||
WXK_START = 300,
|
||||
WXK_LBUTTON,
|
||||
WXK_RBUTTON,
|
||||
WXK_CANCEL,
|
||||
|
@ -35,18 +35,18 @@ class wxBrush: public wxGDIObject
|
||||
{
|
||||
public:
|
||||
wxBrush() { }
|
||||
|
||||
|
||||
wxBrush( const wxColour &colour, int style = wxSOLID );
|
||||
wxBrush( const wxBitmap &stippleBitmap );
|
||||
~wxBrush();
|
||||
|
||||
|
||||
wxBrush( const wxBrush &brush )
|
||||
: wxGDIObject()
|
||||
{ Ref(brush); }
|
||||
wxBrush& operator = ( const wxBrush& brush ) { Ref(brush); return *this; }
|
||||
|
||||
|
||||
bool Ok() const { return m_refData != NULL; }
|
||||
|
||||
|
||||
bool operator == ( const wxBrush& brush ) const;
|
||||
bool operator != (const wxBrush& brush) const { return !(*this == brush); }
|
||||
|
||||
@ -54,6 +54,9 @@ public:
|
||||
wxColour &GetColour() const;
|
||||
wxBitmap *GetStipple() const;
|
||||
|
||||
bool IsHatch() const
|
||||
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
|
||||
|
||||
void SetColour( const wxColour& col );
|
||||
void SetColour( unsigned char r, unsigned char g, unsigned char b );
|
||||
void SetStyle( int style );
|
||||
@ -63,7 +66,7 @@ private:
|
||||
// ref counting code
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxBrush)
|
||||
};
|
||||
|
||||
|
@ -35,18 +35,18 @@ class wxBrush: public wxGDIObject
|
||||
{
|
||||
public:
|
||||
wxBrush() { }
|
||||
|
||||
|
||||
wxBrush( const wxColour &colour, int style = wxSOLID );
|
||||
wxBrush( const wxBitmap &stippleBitmap );
|
||||
~wxBrush();
|
||||
|
||||
|
||||
wxBrush( const wxBrush &brush )
|
||||
: wxGDIObject()
|
||||
{ Ref(brush); }
|
||||
wxBrush& operator = ( const wxBrush& brush ) { Ref(brush); return *this; }
|
||||
|
||||
|
||||
bool Ok() const { return m_refData != NULL; }
|
||||
|
||||
|
||||
bool operator == ( const wxBrush& brush ) const;
|
||||
bool operator != (const wxBrush& brush) const { return !(*this == brush); }
|
||||
|
||||
@ -54,6 +54,9 @@ public:
|
||||
wxColour &GetColour() const;
|
||||
wxBitmap *GetStipple() const;
|
||||
|
||||
bool IsHatch() const
|
||||
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
|
||||
|
||||
void SetColour( const wxColour& col );
|
||||
void SetColour( unsigned char r, unsigned char g, unsigned char b );
|
||||
void SetStyle( int style );
|
||||
@ -63,7 +66,7 @@ private:
|
||||
// ref counting code
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxBrush)
|
||||
};
|
||||
|
||||
|
@ -22,60 +22,63 @@
|
||||
|
||||
class WXDLLEXPORT wxBrush;
|
||||
|
||||
typedef enum
|
||||
typedef enum
|
||||
{
|
||||
kwxMacBrushColour ,
|
||||
kwxMacBrushTheme ,
|
||||
kwxMacBrushThemeBackground
|
||||
kwxMacBrushColour ,
|
||||
kwxMacBrushTheme ,
|
||||
kwxMacBrushThemeBackground
|
||||
} wxMacBrushKind ;
|
||||
|
||||
// Brush
|
||||
class WXDLLEXPORT wxBrush: public wxGDIObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxBrush)
|
||||
DECLARE_DYNAMIC_CLASS(wxBrush)
|
||||
|
||||
public:
|
||||
wxBrush();
|
||||
wxBrush(short macThemeBrush ) ;
|
||||
wxBrush(const wxColour& col, int style = wxSOLID);
|
||||
wxBrush(const wxBitmap& stipple);
|
||||
wxBrush(const wxBrush& brush)
|
||||
: wxGDIObject()
|
||||
{ Ref(brush); }
|
||||
~wxBrush();
|
||||
wxBrush();
|
||||
wxBrush(short macThemeBrush ) ;
|
||||
wxBrush(const wxColour& col, int style = wxSOLID);
|
||||
wxBrush(const wxBitmap& stipple);
|
||||
wxBrush(const wxBrush& brush)
|
||||
: wxGDIObject()
|
||||
{ Ref(brush); }
|
||||
~wxBrush();
|
||||
|
||||
virtual void SetColour(const wxColour& col) ;
|
||||
virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) ;
|
||||
virtual void SetStyle(int style) ;
|
||||
virtual void SetStipple(const wxBitmap& stipple) ;
|
||||
virtual void MacSetTheme(short macThemeBrush) ;
|
||||
virtual void MacSetThemeBackground(unsigned long macThemeBackground , WXRECTPTR extent) ;
|
||||
virtual void SetColour(const wxColour& col) ;
|
||||
virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) ;
|
||||
virtual void SetStyle(int style) ;
|
||||
virtual void SetStipple(const wxBitmap& stipple) ;
|
||||
virtual void MacSetTheme(short macThemeBrush) ;
|
||||
virtual void MacSetThemeBackground(unsigned long macThemeBackground , WXRECTPTR extent) ;
|
||||
|
||||
wxBrush& operator = (const wxBrush& brush)
|
||||
{ if (*this == brush) return (*this); Ref(brush); return *this; }
|
||||
bool operator == (const wxBrush& brush)
|
||||
{ return m_refData == brush.m_refData; }
|
||||
bool operator != (const wxBrush& brush)
|
||||
{ return m_refData != brush.m_refData; }
|
||||
wxBrush& operator = (const wxBrush& brush)
|
||||
{ if (*this == brush) return (*this); Ref(brush); return *this; }
|
||||
bool operator == (const wxBrush& brush)
|
||||
{ return m_refData == brush.m_refData; }
|
||||
bool operator != (const wxBrush& brush)
|
||||
{ return m_refData != brush.m_refData; }
|
||||
|
||||
wxMacBrushKind MacGetBrushKind() const ;
|
||||
wxMacBrushKind MacGetBrushKind() const ;
|
||||
|
||||
unsigned long MacGetThemeBackground(WXRECTPTR extent) const ;
|
||||
short MacGetTheme() const ;
|
||||
wxColour& GetColour() const ;
|
||||
int GetStyle() const ;
|
||||
wxBitmap *GetStipple() const ;
|
||||
unsigned long MacGetThemeBackground(WXRECTPTR extent) const ;
|
||||
short MacGetTheme() const ;
|
||||
wxColour& GetColour() const ;
|
||||
int GetStyle() const ;
|
||||
wxBitmap *GetStipple() const ;
|
||||
|
||||
virtual bool Ok() const { return (m_refData != NULL) ; }
|
||||
bool IsHatch() const
|
||||
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
|
||||
|
||||
virtual bool Ok() const { return (m_refData != NULL) ; }
|
||||
|
||||
// Implementation
|
||||
|
||||
// Useful helper: create the brush resource
|
||||
bool RealizeResource();
|
||||
// Useful helper: create the brush resource
|
||||
bool RealizeResource();
|
||||
|
||||
// When setting properties, we must make sure we're not changing
|
||||
// another object
|
||||
void Unshare();
|
||||
// When setting properties, we must make sure we're not changing
|
||||
// another object
|
||||
void Unshare();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -22,60 +22,63 @@
|
||||
|
||||
class WXDLLEXPORT wxBrush;
|
||||
|
||||
typedef enum
|
||||
typedef enum
|
||||
{
|
||||
kwxMacBrushColour ,
|
||||
kwxMacBrushTheme ,
|
||||
kwxMacBrushThemeBackground
|
||||
kwxMacBrushColour ,
|
||||
kwxMacBrushTheme ,
|
||||
kwxMacBrushThemeBackground
|
||||
} wxMacBrushKind ;
|
||||
|
||||
// Brush
|
||||
class WXDLLEXPORT wxBrush: public wxGDIObject
|
||||
{
|
||||
DECLARE_DYNAMIC_CLASS(wxBrush)
|
||||
DECLARE_DYNAMIC_CLASS(wxBrush)
|
||||
|
||||
public:
|
||||
wxBrush();
|
||||
wxBrush(short macThemeBrush ) ;
|
||||
wxBrush(const wxColour& col, int style = wxSOLID);
|
||||
wxBrush(const wxBitmap& stipple);
|
||||
wxBrush(const wxBrush& brush)
|
||||
: wxGDIObject()
|
||||
{ Ref(brush); }
|
||||
~wxBrush();
|
||||
wxBrush();
|
||||
wxBrush(short macThemeBrush ) ;
|
||||
wxBrush(const wxColour& col, int style = wxSOLID);
|
||||
wxBrush(const wxBitmap& stipple);
|
||||
wxBrush(const wxBrush& brush)
|
||||
: wxGDIObject()
|
||||
{ Ref(brush); }
|
||||
~wxBrush();
|
||||
|
||||
virtual void SetColour(const wxColour& col) ;
|
||||
virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) ;
|
||||
virtual void SetStyle(int style) ;
|
||||
virtual void SetStipple(const wxBitmap& stipple) ;
|
||||
virtual void SetMacTheme(short macThemeBrush) ;
|
||||
virtual void SetMacThemeBackground(unsigned long macThemeBackground , WXRECTPTR extent) ;
|
||||
virtual void SetColour(const wxColour& col) ;
|
||||
virtual void SetColour(unsigned char r, unsigned char g, unsigned char b) ;
|
||||
virtual void SetStyle(int style) ;
|
||||
virtual void SetStipple(const wxBitmap& stipple) ;
|
||||
virtual void SetMacTheme(short macThemeBrush) ;
|
||||
virtual void SetMacThemeBackground(unsigned long macThemeBackground , WXRECTPTR extent) ;
|
||||
|
||||
wxBrush& operator = (const wxBrush& brush)
|
||||
{ if (*this == brush) return (*this); Ref(brush); return *this; }
|
||||
bool operator == (const wxBrush& brush)
|
||||
{ return m_refData == brush.m_refData; }
|
||||
bool operator != (const wxBrush& brush)
|
||||
{ return m_refData != brush.m_refData; }
|
||||
wxBrush& operator = (const wxBrush& brush)
|
||||
{ if (*this == brush) return (*this); Ref(brush); return *this; }
|
||||
bool operator == (const wxBrush& brush)
|
||||
{ return m_refData == brush.m_refData; }
|
||||
bool operator != (const wxBrush& brush)
|
||||
{ return m_refData != brush.m_refData; }
|
||||
|
||||
wxMacBrushKind MacGetBrushKind() const ;
|
||||
wxMacBrushKind MacGetBrushKind() const ;
|
||||
|
||||
unsigned long GetMacThemeBackground(WXRECTPTR extent) const ;
|
||||
short GetMacTheme() const ;
|
||||
wxColour& GetColour() const ;
|
||||
int GetStyle() const ;
|
||||
wxBitmap *GetStipple() const ;
|
||||
unsigned long GetMacThemeBackground(WXRECTPTR extent) const ;
|
||||
short GetMacTheme() const ;
|
||||
wxColour& GetColour() const ;
|
||||
int GetStyle() const ;
|
||||
wxBitmap *GetStipple() const ;
|
||||
|
||||
virtual bool Ok() const { return (m_refData != NULL) ; }
|
||||
bool IsHatch() const
|
||||
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
|
||||
|
||||
virtual bool Ok() const { return (m_refData != NULL) ; }
|
||||
|
||||
// Implementation
|
||||
|
||||
// Useful helper: create the brush resource
|
||||
bool RealizeResource();
|
||||
// Useful helper: create the brush resource
|
||||
bool RealizeResource();
|
||||
|
||||
// When setting properties, we must make sure we're not changing
|
||||
// another object
|
||||
void Unshare();
|
||||
// When setting properties, we must make sure we're not changing
|
||||
// another object
|
||||
void Unshare();
|
||||
};
|
||||
|
||||
#endif
|
||||
|
@ -49,11 +49,14 @@ public:
|
||||
wxColour &GetColour() const;
|
||||
wxBitmap *GetStipple() const;
|
||||
|
||||
bool IsHatch() const
|
||||
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
|
||||
|
||||
void SetColour(const wxColour& col);
|
||||
void SetColour(unsigned char r, unsigned char g, unsigned char b);
|
||||
void SetStyle(int style);
|
||||
void SetStipple(const wxBitmap& stipple);
|
||||
|
||||
|
||||
// implementation:
|
||||
|
||||
void* GetMaskPattern() const;
|
||||
|
@ -48,6 +48,9 @@ public:
|
||||
int GetStyle() const;
|
||||
wxBitmap *GetStipple() const;
|
||||
|
||||
bool IsHatch() const
|
||||
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
|
||||
|
||||
bool Ok() const { return m_refData != NULL; }
|
||||
|
||||
// return the HBRUSH for this brush
|
||||
|
@ -68,6 +68,9 @@ public:
|
||||
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); };
|
||||
|
||||
bool IsHatch() const
|
||||
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
|
||||
|
||||
inline virtual bool Ok(void) const { return (m_refData != NULL) ; }
|
||||
|
||||
//
|
||||
@ -79,7 +82,7 @@ public:
|
||||
//
|
||||
bool RealizeResource(void);
|
||||
WXHANDLE GetResourceHandle(void) ;
|
||||
bool FreeResource(bool bForce = FALSE);
|
||||
bool FreeResource(bool bForce = false);
|
||||
bool IsFree(void) const;
|
||||
void Unshare(void);
|
||||
}; // end of CLASS wxBrush
|
||||
|
@ -4,7 +4,7 @@
|
||||
// Author: William Osborne
|
||||
// Modified by:
|
||||
// Created: 10/13/04
|
||||
// RCS-ID: $Id:
|
||||
// RCS-ID: $Id:
|
||||
// Copyright: (c) William Osborne
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
@ -48,6 +48,9 @@ public:
|
||||
int GetStyle() const;
|
||||
wxBitmap *GetStipple() const;
|
||||
|
||||
bool IsHatch() const
|
||||
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
|
||||
|
||||
bool Ok() const { return m_refData != NULL; }
|
||||
|
||||
// return the HBRUSH for this brush
|
||||
|
@ -6,7 +6,7 @@
|
||||
// Created: 17/09/98
|
||||
// RCS-ID: $Id$
|
||||
// Copyright: (c) Julian Smart, Robert Roebling
|
||||
// Licence: wxWindows licence
|
||||
// Licence: wxWindows licence
|
||||
/////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#ifndef _WX_BRUSH_H_
|
||||
@ -34,16 +34,16 @@ class wxBrush: public wxGDIObject
|
||||
{
|
||||
public:
|
||||
wxBrush() { }
|
||||
|
||||
|
||||
wxBrush( const wxColour &colour, int style = wxSOLID );
|
||||
wxBrush( const wxBitmap &stippleBitmap );
|
||||
~wxBrush();
|
||||
|
||||
|
||||
wxBrush( const wxBrush &brush ) { Ref(brush); }
|
||||
wxBrush& operator = ( const wxBrush& brush ) { Ref(brush); return *this; }
|
||||
|
||||
|
||||
bool Ok() const { return m_refData != NULL; }
|
||||
|
||||
|
||||
bool operator == ( const wxBrush& brush ) const;
|
||||
bool operator != (const wxBrush& brush) const { return !(*this == brush); }
|
||||
|
||||
@ -51,6 +51,9 @@ public:
|
||||
wxColour &GetColour() const;
|
||||
wxBitmap *GetStipple() const;
|
||||
|
||||
bool IsHatch() const
|
||||
{ return (GetStyle()>=wxBDIAGONAL_HATCH) && (GetStyle()<=wxVERTICAL_HATCH); }
|
||||
|
||||
void SetColour( const wxColour& col );
|
||||
void SetColour( unsigned char r, unsigned char g, unsigned char b );
|
||||
void SetStyle( int style );
|
||||
@ -60,7 +63,7 @@ private:
|
||||
// ref counting code
|
||||
virtual wxObjectRefData *CreateRefData() const;
|
||||
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||
|
||||
|
||||
DECLARE_DYNAMIC_CLASS(wxBrush)
|
||||
};
|
||||
|
||||
|
@ -95,7 +95,7 @@ void gdk_wx_draw_bitmap(GdkDrawable *drawable,
|
||||
g_return_if_fail (drawable != NULL);
|
||||
g_return_if_fail (src != NULL);
|
||||
g_return_if_fail (gc != NULL);
|
||||
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
gint src_width, src_height;
|
||||
gdk_drawable_get_size(src, &src_width, &src_height);
|
||||
@ -114,7 +114,7 @@ void gdk_wx_draw_bitmap(GdkDrawable *drawable,
|
||||
GdkWindowPrivate *drawable_private;
|
||||
GdkWindowPrivate *src_private;
|
||||
GdkGCPrivate *gc_private;
|
||||
|
||||
|
||||
drawable_private = (GdkWindowPrivate*) drawable;
|
||||
src_private = (GdkWindowPrivate*) src;
|
||||
if (drawable_private->destroyed || src_private->destroyed)
|
||||
@ -124,10 +124,10 @@ void gdk_wx_draw_bitmap(GdkDrawable *drawable,
|
||||
gint src_height = src_private->height;
|
||||
|
||||
gc_private = (GdkGCPrivate*) gc;
|
||||
|
||||
|
||||
if (width == -1) width = src_width;
|
||||
if (height == -1) height = src_height;
|
||||
|
||||
|
||||
XCopyPlane( drawable_private->xdisplay,
|
||||
src_private->xwindow,
|
||||
drawable_private->xwindow,
|
||||
@ -180,10 +180,10 @@ static void wxInitGCPool()
|
||||
// This really could wait until the first call to
|
||||
// wxGetPoolGC, but we will make the first allocation
|
||||
// now when other initialization is being performed.
|
||||
|
||||
|
||||
// Set initial pool size.
|
||||
wxGCPoolSize = GC_POOL_ALLOC_SIZE;
|
||||
|
||||
|
||||
// Allocate initial pool.
|
||||
wxGCPool = (wxGC *)malloc(wxGCPoolSize * sizeof(wxGC));
|
||||
if (wxGCPool == NULL)
|
||||
@ -195,7 +195,7 @@ static void wxInitGCPool()
|
||||
wxFAIL_MSG( wxT("Cannot allocate GC pool") );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Zero initial pool.
|
||||
memset(wxGCPool, 0, wxGCPoolSize * sizeof(wxGC));
|
||||
}
|
||||
@ -216,7 +216,7 @@ static void wxCleanUpGCPool()
|
||||
static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type )
|
||||
{
|
||||
wxGC *pptr;
|
||||
|
||||
|
||||
// Look for an available GC.
|
||||
for (int i = 0; i < wxGCPoolSize; i++)
|
||||
{
|
||||
@ -225,11 +225,11 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type )
|
||||
wxGCPool[i].m_gc = gdk_gc_new( window );
|
||||
gdk_gc_set_exposures( wxGCPool[i].m_gc, FALSE );
|
||||
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))
|
||||
{
|
||||
wxGCPool[i].m_used = TRUE;
|
||||
wxGCPool[i].m_used = true;
|
||||
return wxGCPool[i].m_gc;
|
||||
}
|
||||
}
|
||||
@ -244,20 +244,20 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type )
|
||||
wxGCPool = pptr;
|
||||
memset(&wxGCPool[wxGCPoolSize], 0,
|
||||
GC_POOL_ALLOC_SIZE*sizeof(wxGC));
|
||||
|
||||
// Initialize entry we will return.
|
||||
|
||||
// Initialize entry we will return.
|
||||
wxGCPool[wxGCPoolSize].m_gc = gdk_gc_new( window );
|
||||
gdk_gc_set_exposures( wxGCPool[wxGCPoolSize].m_gc, FALSE );
|
||||
wxGCPool[wxGCPoolSize].m_type = type;
|
||||
wxGCPool[wxGCPoolSize].m_used = TRUE;
|
||||
|
||||
wxGCPool[wxGCPoolSize].m_used = true;
|
||||
|
||||
// Set new value of pool size.
|
||||
wxGCPoolSize += GC_POOL_ALLOC_SIZE;
|
||||
|
||||
|
||||
// Return newly allocated entry.
|
||||
return wxGCPool[wxGCPoolSize-GC_POOL_ALLOC_SIZE].m_gc;
|
||||
}
|
||||
|
||||
|
||||
// The realloc failed. Fall through to error.
|
||||
wxFAIL_MSG( wxT("No GC available") );
|
||||
|
||||
@ -270,7 +270,7 @@ static void wxFreePoolGC( GdkGC *gc )
|
||||
{
|
||||
if (wxGCPool[i].m_gc == gc)
|
||||
{
|
||||
wxGCPool[i].m_used = FALSE;
|
||||
wxGCPool[i].m_used = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -291,8 +291,8 @@ wxWindowDC::wxWindowDC()
|
||||
m_textGC = (GdkGC *) NULL;
|
||||
m_bgGC = (GdkGC *) NULL;
|
||||
m_cmap = (GdkColormap *) NULL;
|
||||
m_isMemDC = FALSE;
|
||||
m_isScreenDC = FALSE;
|
||||
m_isMemDC = false;
|
||||
m_isScreenDC = false;
|
||||
m_owner = (wxWindow *)NULL;
|
||||
#ifdef __WXGTK20__
|
||||
m_context = (PangoContext *)NULL;
|
||||
@ -311,8 +311,8 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
||||
m_bgGC = (GdkGC *) NULL;
|
||||
m_cmap = (GdkColormap *) NULL;
|
||||
m_owner = (wxWindow *)NULL;
|
||||
m_isMemDC = FALSE;
|
||||
m_isScreenDC = FALSE;
|
||||
m_isMemDC = false;
|
||||
m_isScreenDC = false;
|
||||
m_font = window->GetFont();
|
||||
|
||||
GtkWidget *widget = window->m_wxwindow;
|
||||
@ -341,7 +341,7 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
||||
if (!m_window)
|
||||
{
|
||||
// Don't report problems as per MSW.
|
||||
m_ok = TRUE;
|
||||
m_ok = true;
|
||||
|
||||
return;
|
||||
}
|
||||
@ -363,7 +363,7 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
||||
wxWindowDC::~wxWindowDC()
|
||||
{
|
||||
Destroy();
|
||||
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
if (m_layout)
|
||||
g_object_unref( G_OBJECT( m_layout ) );
|
||||
@ -374,7 +374,7 @@ wxWindowDC::~wxWindowDC()
|
||||
|
||||
void wxWindowDC::SetUpDC()
|
||||
{
|
||||
m_ok = TRUE;
|
||||
m_ok = true;
|
||||
|
||||
wxASSERT_MSG( !m_penGC, wxT("GCs already created") );
|
||||
|
||||
@ -465,7 +465,7 @@ void wxWindowDC::DoGetSize( int* width, int* height ) const
|
||||
m_owner->GetSize(width, height);
|
||||
}
|
||||
|
||||
extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
|
||||
extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
|
||||
const wxColour & col, int style);
|
||||
|
||||
bool wxWindowDC::DoFloodFill(wxCoord x, wxCoord y,
|
||||
@ -486,7 +486,7 @@ bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
|
||||
|
||||
wxImage image = bitmap.ConvertToImage();
|
||||
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 )
|
||||
@ -700,7 +700,7 @@ void wxWindowDC::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
wxCoord x1 = XLOG2DEV(points[i].x + xoffset);
|
||||
wxCoord y1 = YLOG2DEV(points[i].y + yoffset);
|
||||
@ -784,7 +784,7 @@ void wxWindowDC::DoDrawPolygon( int n, wxPoint points[], wxCoord xoffset, wxCoor
|
||||
}
|
||||
*/
|
||||
gdk_draw_polygon( m_window, m_penGC, FALSE, gdkpoints, n );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 )
|
||||
{
|
||||
// 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,
|
||||
@ -1075,11 +1075,11 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
return;
|
||||
}
|
||||
|
||||
// scale bitmap if required
|
||||
// scale bitmap if required
|
||||
wxBitmap use_bitmap = bitmap;
|
||||
if ((w != ww) || (h != hh))
|
||||
use_bitmap = use_bitmap.Rescale( 0, 0, ww, hh, ww, hh );
|
||||
|
||||
|
||||
#if !GTK_CHECK_VERSION(2,2,0)
|
||||
// NB: We can't render pixbufs with GTK+ < 2.2, we need to use pixmaps code.
|
||||
// Pixbufs-based bitmaps with alpha channel don't have a mask, so we
|
||||
@ -1087,13 +1087,13 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
// and also creates the mask as a side-effect:
|
||||
use_bitmap.GetPixmap();
|
||||
#endif
|
||||
|
||||
|
||||
// apply mask if any
|
||||
GdkBitmap *mask = (GdkBitmap *) NULL;
|
||||
if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->GetBitmap();
|
||||
|
||||
GdkBitmap *new_mask = (GdkBitmap*) NULL;
|
||||
|
||||
|
||||
if (useMask && mask)
|
||||
{
|
||||
if (!m_currentClippingRegion.IsNull())
|
||||
@ -1115,7 +1115,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, ww, hh );
|
||||
gdk_gc_unref( gc );
|
||||
}
|
||||
|
||||
|
||||
if (is_mono)
|
||||
{
|
||||
if (new_mask)
|
||||
@ -1144,9 +1144,9 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
gdk_gc_set_foreground( gc, m_textForegroundColour.GetColor() );
|
||||
gdk_gc_set_background( gc, m_textBackgroundColour.GetColor() );
|
||||
gdk_wx_draw_bitmap( bitmap, gc, use_bitmap.GetBitmap(), 0, 0, 0, 0, -1, -1 );
|
||||
|
||||
|
||||
gdk_draw_drawable( m_window, m_textGC, bitmap, 0, 0, xx, yy, -1, -1 );
|
||||
|
||||
|
||||
gdk_bitmap_unref( bitmap );
|
||||
gdk_gc_unref( gc );
|
||||
#else
|
||||
@ -1190,7 +1190,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
gdk_gc_set_clip_region( m_penGC, m_currentClippingRegion.GetRegion() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (new_mask)
|
||||
gdk_bitmap_unref( new_mask );
|
||||
}
|
||||
@ -1203,11 +1203,11 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
bool useMask,
|
||||
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
|
||||
xsrc = source->XLOG2DEV(xsrc);
|
||||
@ -1216,8 +1216,8 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
wxClientDC *srcDC = (wxClientDC*)source;
|
||||
wxMemoryDC *memDC = (wxMemoryDC*)source;
|
||||
|
||||
bool use_bitmap_method = FALSE;
|
||||
bool is_mono = FALSE;
|
||||
bool use_bitmap_method = false;
|
||||
bool is_mono = false;
|
||||
|
||||
// TODO: use the mask origin when drawing transparently
|
||||
if (xsrcMask == -1 && ysrcMask == -1)
|
||||
@ -1228,7 +1228,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
|
||||
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);
|
||||
|
||||
@ -1243,14 +1243,14 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
// we HAVE TO use the direct way for memory dcs
|
||||
// that have mask since the XCopyArea doesn't know
|
||||
// about masks
|
||||
use_bitmap_method = TRUE;
|
||||
use_bitmap_method = true;
|
||||
}
|
||||
else if (is_mono)
|
||||
{
|
||||
// we HAVE TO use the direct way for memory dcs
|
||||
// that are bitmaps because XCopyArea doesn't cope
|
||||
// with different bit depths
|
||||
use_bitmap_method = TRUE;
|
||||
use_bitmap_method = true;
|
||||
}
|
||||
else if ((xsrc == 0) && (ysrc == 0) &&
|
||||
(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
|
||||
// wouldn't be able able to boost performace by reducing
|
||||
// the area to be scaled
|
||||
use_bitmap_method = TRUE;
|
||||
use_bitmap_method = true;
|
||||
}
|
||||
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 );
|
||||
tmp.Intersect( m_currentClippingRegion );
|
||||
if (tmp.IsEmpty())
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
int old_logical_func = m_logicalFunction;
|
||||
@ -1304,7 +1304,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
wxCoord cy = yy;
|
||||
wxCoord cw = ww;
|
||||
wxCoord ch = hh;
|
||||
|
||||
|
||||
// interpret userscale of src too
|
||||
double xsc,ysc;
|
||||
memDC->GetUserScale(&xsc,&ysc);
|
||||
@ -1324,7 +1324,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
wxRegion tmp( xx,yy,ww,hh );
|
||||
tmp.Intersect( m_currentClippingRegion );
|
||||
tmp.GetBox(cx,cy,cw,ch);
|
||||
|
||||
|
||||
// Scale and clipped bitmap
|
||||
use_bitmap = memDC->m_selected.Rescale(cx-xx,cy-yy,cw,ch,bm_ww,bm_hh);
|
||||
}
|
||||
@ -1339,7 +1339,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->GetBitmap();
|
||||
|
||||
GdkBitmap *new_mask = (GdkBitmap*) NULL;
|
||||
|
||||
|
||||
if (useMask && mask)
|
||||
{
|
||||
if (!m_currentClippingRegion.IsNull())
|
||||
@ -1394,9 +1394,9 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
gdk_gc_set_foreground( gc, m_textForegroundColour.GetColor() );
|
||||
gdk_gc_set_background( gc, m_textBackgroundColour.GetColor() );
|
||||
gdk_wx_draw_bitmap( bitmap, gc, use_bitmap.GetBitmap(), 0, 0, 0, 0, -1, -1 );
|
||||
|
||||
|
||||
gdk_draw_drawable( m_window, m_textGC, bitmap, xsrc, ysrc, cx, cy, cw, ch );
|
||||
|
||||
|
||||
gdk_bitmap_unref( bitmap );
|
||||
gdk_gc_unref( gc );
|
||||
#else
|
||||
@ -1428,7 +1428,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
gdk_gc_set_clip_region( m_penGC, m_currentClippingRegion.GetRegion() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (new_mask)
|
||||
gdk_bitmap_unref( new_mask );
|
||||
}
|
||||
@ -1441,8 +1441,8 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
tmp.Intersect( m_currentClippingRegion );
|
||||
wxCoord cx,cy,cw,ch;
|
||||
tmp.GetBox(cx,cy,cw,ch);
|
||||
|
||||
// rescale bitmap
|
||||
|
||||
// rescale bitmap
|
||||
wxBitmap bitmap = memDC->m_selected.Rescale( cx-xx, cy-yy, cw, ch, ww, hh );
|
||||
|
||||
// draw scaled bitmap
|
||||
@ -1451,7 +1451,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
}
|
||||
else
|
||||
{
|
||||
// No scaling and not a memory dc with a mask either
|
||||
// No scaling and not a memory dc with a mask either
|
||||
|
||||
// copy including child window contents
|
||||
gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS );
|
||||
@ -1463,8 +1463,8 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
}
|
||||
|
||||
SetLogicalFunction( old_logical_func );
|
||||
|
||||
return TRUE;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
@ -1472,7 +1472,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
wxCHECK_RET( Ok(), wxT("invalid window dc") );
|
||||
|
||||
if (!m_window) return;
|
||||
|
||||
|
||||
if (text.empty()) return;
|
||||
|
||||
#ifndef __WXGTK20__
|
||||
@ -1501,7 +1501,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
#endif
|
||||
size_t datalen = strlen((const char*)data);
|
||||
pango_layout_set_text( m_layout, (const char*) data, datalen);
|
||||
|
||||
|
||||
if (underlined)
|
||||
{
|
||||
PangoAttrList *attrs = pango_attr_list_new();
|
||||
@ -1519,16 +1519,16 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
{
|
||||
// If there is a user or actually any scale applied to
|
||||
// the device context, scale the font.
|
||||
|
||||
|
||||
// scale font description
|
||||
gint oldSize = pango_font_description_get_size( m_fontdesc );
|
||||
double size = oldSize;
|
||||
size = size * m_scaleY;
|
||||
pango_font_description_set_size( m_fontdesc, (gint)size );
|
||||
|
||||
|
||||
// actually apply scaled font
|
||||
pango_layout_set_font_description( m_layout, m_fontdesc );
|
||||
|
||||
|
||||
pango_layout_get_pixel_size( m_layout, &w, &h );
|
||||
if ( m_backgroundMode == wxSOLID )
|
||||
{
|
||||
@ -1536,13 +1536,13 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
gdk_draw_rectangle(m_window, m_textGC, TRUE, x, y, w, h);
|
||||
gdk_gc_set_foreground(m_textGC, m_textForegroundColour.GetColor());
|
||||
}
|
||||
|
||||
|
||||
// Draw layout.
|
||||
gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
|
||||
|
||||
|
||||
// reset unscaled size
|
||||
pango_font_description_set_size( m_fontdesc, oldSize );
|
||||
|
||||
|
||||
// actually apply unscaled font
|
||||
pango_layout_set_font_description( m_layout, m_fontdesc );
|
||||
}
|
||||
@ -1564,10 +1564,10 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
// undo underline attributes setting:
|
||||
pango_layout_set_attributes(m_layout, NULL);
|
||||
}
|
||||
|
||||
|
||||
wxCoord width = w;
|
||||
wxCoord height = h;
|
||||
|
||||
|
||||
#else // GTK+ 1.x
|
||||
wxCoord width = gdk_string_width( font, text.mbc_str() );
|
||||
wxCoord height = font->ascent + font->descent;
|
||||
@ -1620,7 +1620,7 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
|
||||
#ifdef __WXGTK20__
|
||||
// implement later without GdkFont for GTK 2.0
|
||||
GetTextExtent(text, &w, &h, NULL,NULL, &m_font);
|
||||
|
||||
|
||||
#else
|
||||
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
||||
|
||||
@ -1655,7 +1655,7 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
|
||||
y4 = h*dx;
|
||||
double x3 = x4 + x2,
|
||||
y3 = y4 + y2;
|
||||
|
||||
|
||||
// calc max and min
|
||||
wxCoord maxX = (wxCoord)(dmax(x2, dmax(x3, x4)) + 0.5),
|
||||
maxY = (wxCoord)(dmax(y2, dmax(y3, y4)) + 0.5),
|
||||
@ -1669,7 +1669,7 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
|
||||
m_textForegroundColour.Green(),
|
||||
m_textForegroundColour.Blue() );
|
||||
image = image.Rotate( rad, wxPoint(0,0) );
|
||||
|
||||
|
||||
int i_angle = (int) angle;
|
||||
i_angle = i_angle % 360;
|
||||
int xoffset = 0;
|
||||
@ -1678,19 +1678,19 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
|
||||
int yoffset = 0;
|
||||
if ((i_angle >= 0.0) && (i_angle < 180.0))
|
||||
yoffset = image.GetHeight();
|
||||
|
||||
|
||||
if ((i_angle >= 0) && (i_angle < 90))
|
||||
yoffset -= (int)( cos(rad)*h );
|
||||
if ((i_angle >= 90) && (i_angle < 180))
|
||||
xoffset -= (int)( sin(rad)*h );
|
||||
xoffset -= (int)( sin(rad)*h );
|
||||
if ((i_angle >= 180) && (i_angle < 270))
|
||||
yoffset -= (int)( cos(rad)*h );
|
||||
if ((i_angle >= 270) && (i_angle < 360))
|
||||
xoffset -= (int)( sin(rad)*h );
|
||||
|
||||
|
||||
int i_x = x - xoffset;
|
||||
int i_y = y - yoffset;
|
||||
|
||||
|
||||
src = image;
|
||||
DoDrawBitmap( src, i_x, i_y, true );
|
||||
|
||||
@ -1725,16 +1725,16 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
|
||||
if ( externalLeading )
|
||||
*externalLeading = 0;
|
||||
|
||||
if (string.IsEmpty())
|
||||
if (string.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
// Set new font description
|
||||
if (theFont)
|
||||
pango_layout_set_font_description( m_layout, theFont->GetNativeFontInfo()->description );
|
||||
|
||||
|
||||
// Set layout's text
|
||||
#if wxUSE_UNICODE
|
||||
const wxCharBuffer data = wxConvUTF8.cWC2MB( string );
|
||||
@ -1758,12 +1758,12 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
|
||||
}
|
||||
|
||||
pango_layout_set_text( m_layout, dataUTF8, strlen(dataUTF8) );
|
||||
|
||||
|
||||
int w,h;
|
||||
pango_layout_get_pixel_size( m_layout, &w, &h );
|
||||
|
||||
|
||||
if (width)
|
||||
*width = (wxCoord) w;
|
||||
*width = (wxCoord) w;
|
||||
if (height)
|
||||
*height = (wxCoord) h;
|
||||
if (descent)
|
||||
@ -1773,7 +1773,7 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
|
||||
pango_layout_iter_free(iter);
|
||||
*descent = h - PANGO_PIXELS(baseline);
|
||||
}
|
||||
|
||||
|
||||
// Reset old font description
|
||||
if (theFont)
|
||||
pango_layout_set_font_description( m_layout, m_fontdesc );
|
||||
@ -1781,7 +1781,7 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
|
||||
wxFont fontToUse = m_font;
|
||||
if (theFont)
|
||||
fontToUse = *theFont;
|
||||
|
||||
|
||||
GdkFont *font = fontToUse.GetInternalFont( m_scaleY );
|
||||
if ( !font )
|
||||
return;
|
||||
@ -1866,39 +1866,39 @@ void wxWindowDC::Clear()
|
||||
void wxWindowDC::SetFont( const wxFont &font )
|
||||
{
|
||||
m_font = font;
|
||||
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
if (m_font.Ok())
|
||||
{
|
||||
if (m_fontdesc)
|
||||
pango_font_description_free( m_fontdesc );
|
||||
|
||||
|
||||
m_fontdesc = pango_font_description_copy( m_font.GetNativeFontInfo()->description );
|
||||
|
||||
|
||||
|
||||
|
||||
if (m_owner)
|
||||
{
|
||||
PangoContext *oldContext = m_context;
|
||||
|
||||
|
||||
// We might want to use the X11 context for faster
|
||||
// rendering on screen
|
||||
if (m_font.GetNoAntiAliasing())
|
||||
m_context = m_owner->GtkGetPangoX11Context();
|
||||
else
|
||||
m_context = m_owner->GtkGetPangoDefaultContext();
|
||||
|
||||
|
||||
// If we switch back/forth between different contexts
|
||||
// we also have to create a new layout. I think so,
|
||||
// at least, and it doesn't hurt to do it.
|
||||
// at least, and it doesn't hurt to do it.
|
||||
if (oldContext != m_context)
|
||||
{
|
||||
if (m_layout)
|
||||
g_object_unref( G_OBJECT( m_layout ) );
|
||||
|
||||
|
||||
m_layout = pango_layout_new( m_context );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pango_layout_set_font_description( m_layout, m_fontdesc );
|
||||
}
|
||||
#endif
|
||||
@ -2093,7 +2093,7 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
|
||||
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 );
|
||||
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 );
|
||||
int num = m_backgroundBrush.GetStyle() - wxBDIAGONAL_HATCH;
|
||||
@ -2431,7 +2431,7 @@ wxPaintDC::wxPaintDC( wxWindow *win )
|
||||
wxSize sz = win->GetSize();
|
||||
m_paintClippingRegion = win->GetUpdateRegion();
|
||||
wxLimitRegionToSize(m_paintClippingRegion, sz);
|
||||
|
||||
|
||||
GdkRegion *region = m_paintClippingRegion.GetRegion();
|
||||
if ( region )
|
||||
{
|
||||
@ -2494,7 +2494,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxDCModule, wxModule)
|
||||
bool wxDCModule::OnInit()
|
||||
{
|
||||
wxInitGCPool();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxDCModule::OnExit()
|
||||
|
@ -95,7 +95,7 @@ void gdk_wx_draw_bitmap(GdkDrawable *drawable,
|
||||
g_return_if_fail (drawable != NULL);
|
||||
g_return_if_fail (src != NULL);
|
||||
g_return_if_fail (gc != NULL);
|
||||
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
gint src_width, src_height;
|
||||
gdk_drawable_get_size(src, &src_width, &src_height);
|
||||
@ -114,7 +114,7 @@ void gdk_wx_draw_bitmap(GdkDrawable *drawable,
|
||||
GdkWindowPrivate *drawable_private;
|
||||
GdkWindowPrivate *src_private;
|
||||
GdkGCPrivate *gc_private;
|
||||
|
||||
|
||||
drawable_private = (GdkWindowPrivate*) drawable;
|
||||
src_private = (GdkWindowPrivate*) src;
|
||||
if (drawable_private->destroyed || src_private->destroyed)
|
||||
@ -124,10 +124,10 @@ void gdk_wx_draw_bitmap(GdkDrawable *drawable,
|
||||
gint src_height = src_private->height;
|
||||
|
||||
gc_private = (GdkGCPrivate*) gc;
|
||||
|
||||
|
||||
if (width == -1) width = src_width;
|
||||
if (height == -1) height = src_height;
|
||||
|
||||
|
||||
XCopyPlane( drawable_private->xdisplay,
|
||||
src_private->xwindow,
|
||||
drawable_private->xwindow,
|
||||
@ -180,10 +180,10 @@ static void wxInitGCPool()
|
||||
// This really could wait until the first call to
|
||||
// wxGetPoolGC, but we will make the first allocation
|
||||
// now when other initialization is being performed.
|
||||
|
||||
|
||||
// Set initial pool size.
|
||||
wxGCPoolSize = GC_POOL_ALLOC_SIZE;
|
||||
|
||||
|
||||
// Allocate initial pool.
|
||||
wxGCPool = (wxGC *)malloc(wxGCPoolSize * sizeof(wxGC));
|
||||
if (wxGCPool == NULL)
|
||||
@ -195,7 +195,7 @@ static void wxInitGCPool()
|
||||
wxFAIL_MSG( wxT("Cannot allocate GC pool") );
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// Zero initial pool.
|
||||
memset(wxGCPool, 0, wxGCPoolSize * sizeof(wxGC));
|
||||
}
|
||||
@ -216,7 +216,7 @@ static void wxCleanUpGCPool()
|
||||
static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type )
|
||||
{
|
||||
wxGC *pptr;
|
||||
|
||||
|
||||
// Look for an available GC.
|
||||
for (int i = 0; i < wxGCPoolSize; i++)
|
||||
{
|
||||
@ -225,11 +225,11 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type )
|
||||
wxGCPool[i].m_gc = gdk_gc_new( window );
|
||||
gdk_gc_set_exposures( wxGCPool[i].m_gc, FALSE );
|
||||
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))
|
||||
{
|
||||
wxGCPool[i].m_used = TRUE;
|
||||
wxGCPool[i].m_used = true;
|
||||
return wxGCPool[i].m_gc;
|
||||
}
|
||||
}
|
||||
@ -244,20 +244,20 @@ static GdkGC* wxGetPoolGC( GdkWindow *window, wxPoolGCType type )
|
||||
wxGCPool = pptr;
|
||||
memset(&wxGCPool[wxGCPoolSize], 0,
|
||||
GC_POOL_ALLOC_SIZE*sizeof(wxGC));
|
||||
|
||||
// Initialize entry we will return.
|
||||
|
||||
// Initialize entry we will return.
|
||||
wxGCPool[wxGCPoolSize].m_gc = gdk_gc_new( window );
|
||||
gdk_gc_set_exposures( wxGCPool[wxGCPoolSize].m_gc, FALSE );
|
||||
wxGCPool[wxGCPoolSize].m_type = type;
|
||||
wxGCPool[wxGCPoolSize].m_used = TRUE;
|
||||
|
||||
wxGCPool[wxGCPoolSize].m_used = true;
|
||||
|
||||
// Set new value of pool size.
|
||||
wxGCPoolSize += GC_POOL_ALLOC_SIZE;
|
||||
|
||||
|
||||
// Return newly allocated entry.
|
||||
return wxGCPool[wxGCPoolSize-GC_POOL_ALLOC_SIZE].m_gc;
|
||||
}
|
||||
|
||||
|
||||
// The realloc failed. Fall through to error.
|
||||
wxFAIL_MSG( wxT("No GC available") );
|
||||
|
||||
@ -270,7 +270,7 @@ static void wxFreePoolGC( GdkGC *gc )
|
||||
{
|
||||
if (wxGCPool[i].m_gc == gc)
|
||||
{
|
||||
wxGCPool[i].m_used = FALSE;
|
||||
wxGCPool[i].m_used = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -291,8 +291,8 @@ wxWindowDC::wxWindowDC()
|
||||
m_textGC = (GdkGC *) NULL;
|
||||
m_bgGC = (GdkGC *) NULL;
|
||||
m_cmap = (GdkColormap *) NULL;
|
||||
m_isMemDC = FALSE;
|
||||
m_isScreenDC = FALSE;
|
||||
m_isMemDC = false;
|
||||
m_isScreenDC = false;
|
||||
m_owner = (wxWindow *)NULL;
|
||||
#ifdef __WXGTK20__
|
||||
m_context = (PangoContext *)NULL;
|
||||
@ -311,8 +311,8 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
||||
m_bgGC = (GdkGC *) NULL;
|
||||
m_cmap = (GdkColormap *) NULL;
|
||||
m_owner = (wxWindow *)NULL;
|
||||
m_isMemDC = FALSE;
|
||||
m_isScreenDC = FALSE;
|
||||
m_isMemDC = false;
|
||||
m_isScreenDC = false;
|
||||
m_font = window->GetFont();
|
||||
|
||||
GtkWidget *widget = window->m_wxwindow;
|
||||
@ -341,7 +341,7 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
||||
if (!m_window)
|
||||
{
|
||||
// Don't report problems as per MSW.
|
||||
m_ok = TRUE;
|
||||
m_ok = true;
|
||||
|
||||
return;
|
||||
}
|
||||
@ -363,7 +363,7 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
||||
wxWindowDC::~wxWindowDC()
|
||||
{
|
||||
Destroy();
|
||||
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
if (m_layout)
|
||||
g_object_unref( G_OBJECT( m_layout ) );
|
||||
@ -374,7 +374,7 @@ wxWindowDC::~wxWindowDC()
|
||||
|
||||
void wxWindowDC::SetUpDC()
|
||||
{
|
||||
m_ok = TRUE;
|
||||
m_ok = true;
|
||||
|
||||
wxASSERT_MSG( !m_penGC, wxT("GCs already created") );
|
||||
|
||||
@ -465,7 +465,7 @@ void wxWindowDC::DoGetSize( int* width, int* height ) const
|
||||
m_owner->GetSize(width, height);
|
||||
}
|
||||
|
||||
extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
|
||||
extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
|
||||
const wxColour & col, int style);
|
||||
|
||||
bool wxWindowDC::DoFloodFill(wxCoord x, wxCoord y,
|
||||
@ -486,7 +486,7 @@ bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
|
||||
|
||||
wxImage image = bitmap.ConvertToImage();
|
||||
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 )
|
||||
@ -700,7 +700,7 @@ void wxWindowDC::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord
|
||||
return;
|
||||
}
|
||||
|
||||
for (int i = 0; i < n; i++)
|
||||
for (int i = 0; i < n; i++)
|
||||
{
|
||||
wxCoord x1 = XLOG2DEV(points[i].x + xoffset);
|
||||
wxCoord y1 = YLOG2DEV(points[i].y + yoffset);
|
||||
@ -784,7 +784,7 @@ void wxWindowDC::DoDrawPolygon( int n, wxPoint points[], wxCoord xoffset, wxCoor
|
||||
}
|
||||
*/
|
||||
gdk_draw_polygon( m_window, m_penGC, FALSE, gdkpoints, n );
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -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 )
|
||||
{
|
||||
// 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,
|
||||
@ -1075,11 +1075,11 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
return;
|
||||
}
|
||||
|
||||
// scale bitmap if required
|
||||
// scale bitmap if required
|
||||
wxBitmap use_bitmap = bitmap;
|
||||
if ((w != ww) || (h != hh))
|
||||
use_bitmap = use_bitmap.Rescale( 0, 0, ww, hh, ww, hh );
|
||||
|
||||
|
||||
#if !GTK_CHECK_VERSION(2,2,0)
|
||||
// NB: We can't render pixbufs with GTK+ < 2.2, we need to use pixmaps code.
|
||||
// Pixbufs-based bitmaps with alpha channel don't have a mask, so we
|
||||
@ -1087,13 +1087,13 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
// and also creates the mask as a side-effect:
|
||||
use_bitmap.GetPixmap();
|
||||
#endif
|
||||
|
||||
|
||||
// apply mask if any
|
||||
GdkBitmap *mask = (GdkBitmap *) NULL;
|
||||
if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->GetBitmap();
|
||||
|
||||
GdkBitmap *new_mask = (GdkBitmap*) NULL;
|
||||
|
||||
|
||||
if (useMask && mask)
|
||||
{
|
||||
if (!m_currentClippingRegion.IsNull())
|
||||
@ -1115,7 +1115,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
gdk_draw_rectangle( new_mask, gc, TRUE, 0, 0, ww, hh );
|
||||
gdk_gc_unref( gc );
|
||||
}
|
||||
|
||||
|
||||
if (is_mono)
|
||||
{
|
||||
if (new_mask)
|
||||
@ -1144,9 +1144,9 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
gdk_gc_set_foreground( gc, m_textForegroundColour.GetColor() );
|
||||
gdk_gc_set_background( gc, m_textBackgroundColour.GetColor() );
|
||||
gdk_wx_draw_bitmap( bitmap, gc, use_bitmap.GetBitmap(), 0, 0, 0, 0, -1, -1 );
|
||||
|
||||
|
||||
gdk_draw_drawable( m_window, m_textGC, bitmap, 0, 0, xx, yy, -1, -1 );
|
||||
|
||||
|
||||
gdk_bitmap_unref( bitmap );
|
||||
gdk_gc_unref( gc );
|
||||
#else
|
||||
@ -1190,7 +1190,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
gdk_gc_set_clip_region( m_penGC, m_currentClippingRegion.GetRegion() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (new_mask)
|
||||
gdk_bitmap_unref( new_mask );
|
||||
}
|
||||
@ -1203,11 +1203,11 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
bool useMask,
|
||||
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
|
||||
xsrc = source->XLOG2DEV(xsrc);
|
||||
@ -1216,8 +1216,8 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
wxClientDC *srcDC = (wxClientDC*)source;
|
||||
wxMemoryDC *memDC = (wxMemoryDC*)source;
|
||||
|
||||
bool use_bitmap_method = FALSE;
|
||||
bool is_mono = FALSE;
|
||||
bool use_bitmap_method = false;
|
||||
bool is_mono = false;
|
||||
|
||||
// TODO: use the mask origin when drawing transparently
|
||||
if (xsrcMask == -1 && ysrcMask == -1)
|
||||
@ -1228,7 +1228,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
|
||||
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);
|
||||
|
||||
@ -1243,14 +1243,14 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
// we HAVE TO use the direct way for memory dcs
|
||||
// that have mask since the XCopyArea doesn't know
|
||||
// about masks
|
||||
use_bitmap_method = TRUE;
|
||||
use_bitmap_method = true;
|
||||
}
|
||||
else if (is_mono)
|
||||
{
|
||||
// we HAVE TO use the direct way for memory dcs
|
||||
// that are bitmaps because XCopyArea doesn't cope
|
||||
// with different bit depths
|
||||
use_bitmap_method = TRUE;
|
||||
use_bitmap_method = true;
|
||||
}
|
||||
else if ((xsrc == 0) && (ysrc == 0) &&
|
||||
(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
|
||||
// wouldn't be able able to boost performace by reducing
|
||||
// the area to be scaled
|
||||
use_bitmap_method = TRUE;
|
||||
use_bitmap_method = true;
|
||||
}
|
||||
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 );
|
||||
tmp.Intersect( m_currentClippingRegion );
|
||||
if (tmp.IsEmpty())
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
int old_logical_func = m_logicalFunction;
|
||||
@ -1304,7 +1304,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
wxCoord cy = yy;
|
||||
wxCoord cw = ww;
|
||||
wxCoord ch = hh;
|
||||
|
||||
|
||||
// interpret userscale of src too
|
||||
double xsc,ysc;
|
||||
memDC->GetUserScale(&xsc,&ysc);
|
||||
@ -1324,7 +1324,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
wxRegion tmp( xx,yy,ww,hh );
|
||||
tmp.Intersect( m_currentClippingRegion );
|
||||
tmp.GetBox(cx,cy,cw,ch);
|
||||
|
||||
|
||||
// Scale and clipped bitmap
|
||||
use_bitmap = memDC->m_selected.Rescale(cx-xx,cy-yy,cw,ch,bm_ww,bm_hh);
|
||||
}
|
||||
@ -1339,7 +1339,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->GetBitmap();
|
||||
|
||||
GdkBitmap *new_mask = (GdkBitmap*) NULL;
|
||||
|
||||
|
||||
if (useMask && mask)
|
||||
{
|
||||
if (!m_currentClippingRegion.IsNull())
|
||||
@ -1394,9 +1394,9 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
gdk_gc_set_foreground( gc, m_textForegroundColour.GetColor() );
|
||||
gdk_gc_set_background( gc, m_textBackgroundColour.GetColor() );
|
||||
gdk_wx_draw_bitmap( bitmap, gc, use_bitmap.GetBitmap(), 0, 0, 0, 0, -1, -1 );
|
||||
|
||||
|
||||
gdk_draw_drawable( m_window, m_textGC, bitmap, xsrc, ysrc, cx, cy, cw, ch );
|
||||
|
||||
|
||||
gdk_bitmap_unref( bitmap );
|
||||
gdk_gc_unref( gc );
|
||||
#else
|
||||
@ -1428,7 +1428,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
gdk_gc_set_clip_region( m_penGC, m_currentClippingRegion.GetRegion() );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (new_mask)
|
||||
gdk_bitmap_unref( new_mask );
|
||||
}
|
||||
@ -1441,8 +1441,8 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
tmp.Intersect( m_currentClippingRegion );
|
||||
wxCoord cx,cy,cw,ch;
|
||||
tmp.GetBox(cx,cy,cw,ch);
|
||||
|
||||
// rescale bitmap
|
||||
|
||||
// rescale bitmap
|
||||
wxBitmap bitmap = memDC->m_selected.Rescale( cx-xx, cy-yy, cw, ch, ww, hh );
|
||||
|
||||
// draw scaled bitmap
|
||||
@ -1451,7 +1451,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
}
|
||||
else
|
||||
{
|
||||
// No scaling and not a memory dc with a mask either
|
||||
// No scaling and not a memory dc with a mask either
|
||||
|
||||
// copy including child window contents
|
||||
gdk_gc_set_subwindow( m_penGC, GDK_INCLUDE_INFERIORS );
|
||||
@ -1463,8 +1463,8 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
}
|
||||
|
||||
SetLogicalFunction( old_logical_func );
|
||||
|
||||
return TRUE;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
@ -1472,7 +1472,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
wxCHECK_RET( Ok(), wxT("invalid window dc") );
|
||||
|
||||
if (!m_window) return;
|
||||
|
||||
|
||||
if (text.empty()) return;
|
||||
|
||||
#ifndef __WXGTK20__
|
||||
@ -1501,7 +1501,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
#endif
|
||||
size_t datalen = strlen((const char*)data);
|
||||
pango_layout_set_text( m_layout, (const char*) data, datalen);
|
||||
|
||||
|
||||
if (underlined)
|
||||
{
|
||||
PangoAttrList *attrs = pango_attr_list_new();
|
||||
@ -1519,16 +1519,16 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
{
|
||||
// If there is a user or actually any scale applied to
|
||||
// the device context, scale the font.
|
||||
|
||||
|
||||
// scale font description
|
||||
gint oldSize = pango_font_description_get_size( m_fontdesc );
|
||||
double size = oldSize;
|
||||
size = size * m_scaleY;
|
||||
pango_font_description_set_size( m_fontdesc, (gint)size );
|
||||
|
||||
|
||||
// actually apply scaled font
|
||||
pango_layout_set_font_description( m_layout, m_fontdesc );
|
||||
|
||||
|
||||
pango_layout_get_pixel_size( m_layout, &w, &h );
|
||||
if ( m_backgroundMode == wxSOLID )
|
||||
{
|
||||
@ -1536,13 +1536,13 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
gdk_draw_rectangle(m_window, m_textGC, TRUE, x, y, w, h);
|
||||
gdk_gc_set_foreground(m_textGC, m_textForegroundColour.GetColor());
|
||||
}
|
||||
|
||||
|
||||
// Draw layout.
|
||||
gdk_draw_layout( m_window, m_textGC, x, y, m_layout );
|
||||
|
||||
|
||||
// reset unscaled size
|
||||
pango_font_description_set_size( m_fontdesc, oldSize );
|
||||
|
||||
|
||||
// actually apply unscaled font
|
||||
pango_layout_set_font_description( m_layout, m_fontdesc );
|
||||
}
|
||||
@ -1564,10 +1564,10 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
// undo underline attributes setting:
|
||||
pango_layout_set_attributes(m_layout, NULL);
|
||||
}
|
||||
|
||||
|
||||
wxCoord width = w;
|
||||
wxCoord height = h;
|
||||
|
||||
|
||||
#else // GTK+ 1.x
|
||||
wxCoord width = gdk_string_width( font, text.mbc_str() );
|
||||
wxCoord height = font->ascent + font->descent;
|
||||
@ -1620,7 +1620,7 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
|
||||
#ifdef __WXGTK20__
|
||||
// implement later without GdkFont for GTK 2.0
|
||||
GetTextExtent(text, &w, &h, NULL,NULL, &m_font);
|
||||
|
||||
|
||||
#else
|
||||
GdkFont *font = m_font.GetInternalFont( m_scaleY );
|
||||
|
||||
@ -1655,7 +1655,7 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
|
||||
y4 = h*dx;
|
||||
double x3 = x4 + x2,
|
||||
y3 = y4 + y2;
|
||||
|
||||
|
||||
// calc max and min
|
||||
wxCoord maxX = (wxCoord)(dmax(x2, dmax(x3, x4)) + 0.5),
|
||||
maxY = (wxCoord)(dmax(y2, dmax(y3, y4)) + 0.5),
|
||||
@ -1669,7 +1669,7 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
|
||||
m_textForegroundColour.Green(),
|
||||
m_textForegroundColour.Blue() );
|
||||
image = image.Rotate( rad, wxPoint(0,0) );
|
||||
|
||||
|
||||
int i_angle = (int) angle;
|
||||
i_angle = i_angle % 360;
|
||||
int xoffset = 0;
|
||||
@ -1678,19 +1678,19 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
|
||||
int yoffset = 0;
|
||||
if ((i_angle >= 0.0) && (i_angle < 180.0))
|
||||
yoffset = image.GetHeight();
|
||||
|
||||
|
||||
if ((i_angle >= 0) && (i_angle < 90))
|
||||
yoffset -= (int)( cos(rad)*h );
|
||||
if ((i_angle >= 90) && (i_angle < 180))
|
||||
xoffset -= (int)( sin(rad)*h );
|
||||
xoffset -= (int)( sin(rad)*h );
|
||||
if ((i_angle >= 180) && (i_angle < 270))
|
||||
yoffset -= (int)( cos(rad)*h );
|
||||
if ((i_angle >= 270) && (i_angle < 360))
|
||||
xoffset -= (int)( sin(rad)*h );
|
||||
|
||||
|
||||
int i_x = x - xoffset;
|
||||
int i_y = y - yoffset;
|
||||
|
||||
|
||||
src = image;
|
||||
DoDrawBitmap( src, i_x, i_y, true );
|
||||
|
||||
@ -1725,16 +1725,16 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
|
||||
if ( externalLeading )
|
||||
*externalLeading = 0;
|
||||
|
||||
if (string.IsEmpty())
|
||||
if (string.empty())
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
// Set new font description
|
||||
if (theFont)
|
||||
pango_layout_set_font_description( m_layout, theFont->GetNativeFontInfo()->description );
|
||||
|
||||
|
||||
// Set layout's text
|
||||
#if wxUSE_UNICODE
|
||||
const wxCharBuffer data = wxConvUTF8.cWC2MB( string );
|
||||
@ -1758,12 +1758,12 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
|
||||
}
|
||||
|
||||
pango_layout_set_text( m_layout, dataUTF8, strlen(dataUTF8) );
|
||||
|
||||
|
||||
int w,h;
|
||||
pango_layout_get_pixel_size( m_layout, &w, &h );
|
||||
|
||||
|
||||
if (width)
|
||||
*width = (wxCoord) w;
|
||||
*width = (wxCoord) w;
|
||||
if (height)
|
||||
*height = (wxCoord) h;
|
||||
if (descent)
|
||||
@ -1773,7 +1773,7 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
|
||||
pango_layout_iter_free(iter);
|
||||
*descent = h - PANGO_PIXELS(baseline);
|
||||
}
|
||||
|
||||
|
||||
// Reset old font description
|
||||
if (theFont)
|
||||
pango_layout_set_font_description( m_layout, m_fontdesc );
|
||||
@ -1781,7 +1781,7 @@ void wxWindowDC::DoGetTextExtent(const wxString &string,
|
||||
wxFont fontToUse = m_font;
|
||||
if (theFont)
|
||||
fontToUse = *theFont;
|
||||
|
||||
|
||||
GdkFont *font = fontToUse.GetInternalFont( m_scaleY );
|
||||
if ( !font )
|
||||
return;
|
||||
@ -1866,39 +1866,39 @@ void wxWindowDC::Clear()
|
||||
void wxWindowDC::SetFont( const wxFont &font )
|
||||
{
|
||||
m_font = font;
|
||||
|
||||
|
||||
#ifdef __WXGTK20__
|
||||
if (m_font.Ok())
|
||||
{
|
||||
if (m_fontdesc)
|
||||
pango_font_description_free( m_fontdesc );
|
||||
|
||||
|
||||
m_fontdesc = pango_font_description_copy( m_font.GetNativeFontInfo()->description );
|
||||
|
||||
|
||||
|
||||
|
||||
if (m_owner)
|
||||
{
|
||||
PangoContext *oldContext = m_context;
|
||||
|
||||
|
||||
// We might want to use the X11 context for faster
|
||||
// rendering on screen
|
||||
if (m_font.GetNoAntiAliasing())
|
||||
m_context = m_owner->GtkGetPangoX11Context();
|
||||
else
|
||||
m_context = m_owner->GtkGetPangoDefaultContext();
|
||||
|
||||
|
||||
// If we switch back/forth between different contexts
|
||||
// we also have to create a new layout. I think so,
|
||||
// at least, and it doesn't hurt to do it.
|
||||
// at least, and it doesn't hurt to do it.
|
||||
if (oldContext != m_context)
|
||||
{
|
||||
if (m_layout)
|
||||
g_object_unref( G_OBJECT( m_layout ) );
|
||||
|
||||
|
||||
m_layout = pango_layout_new( m_context );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
pango_layout_set_font_description( m_layout, m_fontdesc );
|
||||
}
|
||||
#endif
|
||||
@ -2093,7 +2093,7 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
|
||||
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 );
|
||||
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 );
|
||||
int num = m_backgroundBrush.GetStyle() - wxBDIAGONAL_HATCH;
|
||||
@ -2431,7 +2431,7 @@ wxPaintDC::wxPaintDC( wxWindow *win )
|
||||
wxSize sz = win->GetSize();
|
||||
m_paintClippingRegion = win->GetUpdateRegion();
|
||||
wxLimitRegionToSize(m_paintClippingRegion, sz);
|
||||
|
||||
|
||||
GdkRegion *region = m_paintClippingRegion.GetRegion();
|
||||
if ( region )
|
||||
{
|
||||
@ -2494,7 +2494,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxDCModule, wxModule)
|
||||
bool wxDCModule::OnInit()
|
||||
{
|
||||
wxInitGCPool();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxDCModule::OnExit()
|
||||
|
@ -77,23 +77,23 @@ wxMacPortSetter::~wxMacPortSetter()
|
||||
class wxMacFastPortSetter
|
||||
{
|
||||
public :
|
||||
wxMacFastPortSetter( const wxDC *dc )
|
||||
wxMacFastPortSetter( const wxDC *dc )
|
||||
{
|
||||
wxASSERT( dc->Ok() ) ;
|
||||
m_swapped = QDSwapPort( (GrafPtr) dc->m_macPort , &m_oldPort ) ;
|
||||
m_clipRgn = NewRgn() ;
|
||||
GetClip( m_clipRgn ) ;
|
||||
m_dc = dc ;
|
||||
dc->MacSetupPort( NULL ) ;
|
||||
wxASSERT( dc->Ok() ) ;
|
||||
m_swapped = QDSwapPort( (GrafPtr) dc->m_macPort , &m_oldPort ) ;
|
||||
m_clipRgn = NewRgn() ;
|
||||
GetClip( m_clipRgn ) ;
|
||||
m_dc = dc ;
|
||||
dc->MacSetupPort( NULL ) ;
|
||||
}
|
||||
~wxMacFastPortSetter()
|
||||
{
|
||||
// SetPort( (GrafPtr) m_dc->m_macPort ) ;
|
||||
SetClip( m_clipRgn ) ;
|
||||
if ( m_swapped )
|
||||
SetPort( m_oldPort ) ;
|
||||
m_dc->MacCleanupPort( NULL ) ;
|
||||
DisposeRgn( m_clipRgn ) ;
|
||||
SetPort( m_oldPort ) ;
|
||||
m_dc->MacCleanupPort( NULL ) ;
|
||||
DisposeRgn( m_clipRgn ) ;
|
||||
}
|
||||
private :
|
||||
bool m_swapped ;
|
||||
@ -113,7 +113,7 @@ wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win ) :
|
||||
m_formerClip = NewRgn() ;
|
||||
m_newClip = NewRgn() ;
|
||||
GetClip( m_formerClip ) ;
|
||||
|
||||
|
||||
if ( win )
|
||||
{
|
||||
int x = 0 , y = 0;
|
||||
@ -127,7 +127,7 @@ wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win ) :
|
||||
}
|
||||
}
|
||||
|
||||
wxMacWindowClipper::~wxMacWindowClipper()
|
||||
wxMacWindowClipper::~wxMacWindowClipper()
|
||||
{
|
||||
SetPort( m_newPort ) ;
|
||||
SetClip( m_formerClip ) ;
|
||||
@ -143,7 +143,7 @@ wxMacWindowStateSaver::wxMacWindowStateSaver( const wxWindow* win ) :
|
||||
GetThemeDrawingState( &m_themeDrawingState ) ;
|
||||
}
|
||||
|
||||
wxMacWindowStateSaver::~wxMacWindowStateSaver()
|
||||
wxMacWindowStateSaver::~wxMacWindowStateSaver()
|
||||
{
|
||||
SetPort( m_newPort ) ;
|
||||
SetThemeDrawingState( m_themeDrawingState , true ) ;
|
||||
@ -249,8 +249,8 @@ void wxMacCalculateColour( int logical_func , const RGBColor &srcColor , RGBColo
|
||||
|
||||
wxDC::wxDC()
|
||||
{
|
||||
m_ok = FALSE;
|
||||
m_colour = TRUE;
|
||||
m_ok = false;
|
||||
m_colour = true;
|
||||
m_mm_to_pix_x = mm2pt;
|
||||
m_mm_to_pix_y = mm2pt;
|
||||
m_internalDeviceOriginX = 0;
|
||||
@ -263,11 +263,11 @@ wxDC::wxDC()
|
||||
m_userScaleY = 1.0;
|
||||
m_scaleX = 1.0;
|
||||
m_scaleY = 1.0;
|
||||
m_needComputeScaleX = FALSE;
|
||||
m_needComputeScaleY = FALSE;
|
||||
m_needComputeScaleX = false;
|
||||
m_needComputeScaleY = false;
|
||||
m_macPort = NULL ;
|
||||
m_macMask = NULL ;
|
||||
m_ok = FALSE ;
|
||||
m_ok = false ;
|
||||
m_macFontInstalled = false ;
|
||||
m_macBrushInstalled = false ;
|
||||
m_macPenInstalled = false ;
|
||||
@ -280,7 +280,7 @@ wxDC::wxDC()
|
||||
m_font = *wxNORMAL_FONT;
|
||||
m_brush = *wxWHITE_BRUSH;
|
||||
#ifdef __WXDEBUG__
|
||||
// needed to debug possible errors with two active drawing methods at the same time on
|
||||
// needed to debug possible errors with two active drawing methods at the same time on
|
||||
// the same DC
|
||||
m_macCurrentPortStateHelper = NULL ;
|
||||
#endif
|
||||
@ -453,7 +453,7 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
|
||||
}
|
||||
else
|
||||
{
|
||||
m_clipping = TRUE;
|
||||
m_clipping = true;
|
||||
m_clipX1 = xx;
|
||||
m_clipY1 = yy;
|
||||
m_clipX2 = xx + ww;
|
||||
@ -500,7 +500,7 @@ void wxDC::DoSetClippingRegionAsRegion( const wxRegion ®ion )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_clipping = TRUE;
|
||||
m_clipping = true;
|
||||
m_clipX1 = xx;
|
||||
m_clipY1 = yy;
|
||||
m_clipX2 = xx + ww;
|
||||
@ -562,8 +562,8 @@ void wxDC::SetMapMode( int mode )
|
||||
}
|
||||
if (mode != wxMM_TEXT)
|
||||
{
|
||||
m_needComputeScaleX = TRUE;
|
||||
m_needComputeScaleY = TRUE;
|
||||
m_needComputeScaleX = 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(source->Ok(), false, wxT("wxDC::DoBlit Illegal source DC"));
|
||||
if ( logical_func == wxNO_OP )
|
||||
return TRUE ;
|
||||
return true ;
|
||||
if (xsrcMask == -1 && ysrcMask == -1)
|
||||
{
|
||||
xsrcMask = xsrc; ysrcMask = ysrc;
|
||||
@ -1143,7 +1143,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
||||
if ( mode == kUnsupportedMode )
|
||||
{
|
||||
wxFAIL_MSG(wxT("unsupported blitting mode" ));
|
||||
return FALSE ;
|
||||
return false ;
|
||||
}
|
||||
CGrafPtr sourcePort = (CGrafPtr) source->m_macPort ;
|
||||
PixMapHandle bmappixels = GetGWorldPixMap( sourcePort ) ;
|
||||
@ -1302,7 +1302,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
||||
m_macPenInstalled = false ;
|
||||
m_macBrushInstalled = false ;
|
||||
m_macFontInstalled = false ;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef FixedToInt
|
||||
@ -1341,16 +1341,16 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
|
||||
UniCharCount chars = str.Length() ;
|
||||
UniChar* ubuf = NULL ;
|
||||
#if SIZEOF_WCHAR_T == 4
|
||||
wxMBConvUTF16BE converter ;
|
||||
wxMBConvUTF16BE converter ;
|
||||
#if wxUSE_UNICODE
|
||||
size_t unicharlen = converter.WC2MB( NULL , str.wc_str() , 0 ) ;
|
||||
ubuf = (UniChar*) malloc( unicharlen + 2 ) ;
|
||||
converter.WC2MB( (char*) ubuf , str.wc_str(), unicharlen + 2 ) ;
|
||||
size_t unicharlen = converter.WC2MB( NULL , str.wc_str() , 0 ) ;
|
||||
ubuf = (UniChar*) malloc( unicharlen + 2 ) ;
|
||||
converter.WC2MB( (char*) ubuf , str.wc_str(), unicharlen + 2 ) ;
|
||||
#else
|
||||
const wxWCharBuffer wchar = str.wc_str( wxConvLocal ) ;
|
||||
size_t unicharlen = converter.WC2MB( NULL , wchar.data() , 0 ) ;
|
||||
ubuf = (UniChar*) malloc( unicharlen + 2 ) ;
|
||||
converter.WC2MB( (char*) ubuf , wchar.data() , unicharlen + 2 ) ;
|
||||
size_t unicharlen = converter.WC2MB( NULL , wchar.data() , 0 ) ;
|
||||
ubuf = (UniChar*) malloc( unicharlen + 2 ) ;
|
||||
converter.WC2MB( (char*) ubuf , wchar.data() , unicharlen + 2 ) ;
|
||||
#endif
|
||||
chars = unicharlen / 2 ;
|
||||
#else
|
||||
@ -1370,13 +1370,13 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
|
||||
int iAngle = int( angle );
|
||||
int drawX = XLOG2DEVMAC(x) ;
|
||||
int drawY = YLOG2DEVMAC(y) ;
|
||||
|
||||
|
||||
ATSUTextMeasurement textBefore ;
|
||||
ATSUTextMeasurement textAfter ;
|
||||
ATSUTextMeasurement ascent ;
|
||||
ATSUTextMeasurement descent ;
|
||||
|
||||
|
||||
|
||||
|
||||
if ( abs(iAngle) > 0 )
|
||||
{
|
||||
Fixed atsuAngle = IntToFixed( iAngle ) ;
|
||||
@ -1397,7 +1397,7 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
|
||||
}
|
||||
status = ::ATSUMeasureText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
|
||||
&textBefore , &textAfter, &ascent , &descent );
|
||||
|
||||
|
||||
drawX += (int)(sin(angle/RAD2DEG) * FixedToInt(ascent));
|
||||
drawY += (int)(cos(angle/RAD2DEG) * FixedToInt(ascent));
|
||||
status = ::ATSUDrawText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
|
||||
@ -1480,7 +1480,7 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
wxCharBuffer text = linetext.mb_str(wxConvLocal) ;
|
||||
wxCharBuffer text = linetext.mb_str(wxConvLocal) ;
|
||||
::DrawText( text , 0 , strlen(text) ) ;
|
||||
}
|
||||
}
|
||||
@ -1508,7 +1508,7 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
|
||||
MacInstallFont() ;
|
||||
FontInfo fi ;
|
||||
::GetFontInfo( &fi ) ;
|
||||
#if TARGET_CARBON
|
||||
#if TARGET_CARBON
|
||||
bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
|
||||
if ( UMAGetSystemVersion() < 0x1000 || IsKindOf(CLASSINFO( wxPrinterDC ) ) || ((wxFont*)&m_font)->GetNoAntiAliasing() )
|
||||
useGetThemeText = false ;
|
||||
@ -1542,7 +1542,7 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
|
||||
}
|
||||
else
|
||||
{
|
||||
wxCharBuffer text = linetext.mb_str(wxConvLocal) ;
|
||||
wxCharBuffer text = linetext.mb_str(wxConvLocal) ;
|
||||
curwidth = ::TextWidth( text , 0 , strlen(text) ) ;
|
||||
}
|
||||
if ( curwidth > *width )
|
||||
@ -1566,10 +1566,10 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
|
||||
|
||||
if (text.Length() == 0)
|
||||
return false;
|
||||
|
||||
|
||||
wxMacFastPortSetter helper(this) ;
|
||||
MacInstallFont() ;
|
||||
#if TARGET_CARBON
|
||||
#if TARGET_CARBON
|
||||
bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
|
||||
if ( UMAGetSystemVersion() < 0x1000 || IsKindOf(CLASSINFO( wxPrinterDC ) ) || ((wxFont*)&m_font)->GetNoAntiAliasing() )
|
||||
useGetThemeText = false ;
|
||||
@ -1596,7 +1596,7 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
|
||||
widths[i] = XDEV2LOGREL(bounds.h);
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
#endif
|
||||
{
|
||||
wxCharBuffer buff = text.mb_str(wxConvLocal);
|
||||
@ -1610,7 +1610,7 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
|
||||
for (size_t i=0; i<text.Length(); i++)
|
||||
widths[i] = XDEV2LOGREL(measurements[i+1]);
|
||||
|
||||
delete [] measurements;
|
||||
delete [] measurements;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1834,7 +1834,7 @@ static void wxMacGetPattern(int penStyle, Pattern *pattern)
|
||||
{
|
||||
int index = 0; // solid pattern by default
|
||||
switch(penStyle)
|
||||
{
|
||||
{
|
||||
// hatches
|
||||
case wxBDIAGONAL_HATCH: index = 1; break;
|
||||
case wxFDIAGONAL_HATCH: index = 2; break;
|
||||
@ -1848,7 +1848,7 @@ static void wxMacGetPattern(int penStyle, Pattern *pattern)
|
||||
case wxSHORT_DASH: index = 9; break;
|
||||
case wxDOT_DASH: index = 10; break;
|
||||
}
|
||||
*pattern = gPatterns[index];
|
||||
*pattern = gPatterns[index];
|
||||
}
|
||||
|
||||
void wxDC::MacInstallPen() const
|
||||
@ -1867,11 +1867,11 @@ void wxDC::MacInstallPen() const
|
||||
if ( penWidth == 0 )
|
||||
penWidth = 1 ;
|
||||
::PenSize(penWidth, penWidth);
|
||||
|
||||
|
||||
int penStyle = m_pen.GetStyle();
|
||||
Pattern pat;
|
||||
if (penStyle == wxUSER_DASH)
|
||||
{
|
||||
{
|
||||
// FIXME: there should be exactly 8 items in the dash
|
||||
wxDash* dash ;
|
||||
int number = m_pen.GetDashes(&dash) ;
|
||||
@ -1958,7 +1958,7 @@ void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
|
||||
int brushStyle = background.GetStyle();
|
||||
if (brushStyle == wxSOLID)
|
||||
::BackPat(GetQDGlobalsWhite(&whiteColor));
|
||||
else if (IS_HATCH(brushStyle))
|
||||
else if (background.IsHatch())
|
||||
{
|
||||
Pattern pat ;
|
||||
wxMacGetPattern(brushStyle, &pat);
|
||||
@ -1989,7 +1989,7 @@ void wxDC::MacInstallBrush() const
|
||||
{
|
||||
::PenPat(GetQDGlobalsBlack(&blackColor));
|
||||
}
|
||||
else if (IS_HATCH(brushStyle))
|
||||
else if (m_brush.IsHatch())
|
||||
{
|
||||
Pattern pat ;
|
||||
wxMacGetPattern(brushStyle, &pat);
|
||||
|
@ -76,23 +76,23 @@ wxMacPortSetter::~wxMacPortSetter()
|
||||
class wxMacFastPortSetter
|
||||
{
|
||||
public :
|
||||
wxMacFastPortSetter( const wxDC *dc )
|
||||
wxMacFastPortSetter( const wxDC *dc )
|
||||
{
|
||||
wxASSERT( dc->Ok() ) ;
|
||||
GetPort( &m_oldPort ) ;
|
||||
SetPort( (GrafPtr) dc->m_macPort ) ;
|
||||
m_clipRgn = NewRgn() ;
|
||||
GetClip( m_clipRgn ) ;
|
||||
m_dc = dc ;
|
||||
dc->MacSetupPort( NULL ) ;
|
||||
wxASSERT( dc->Ok() ) ;
|
||||
GetPort( &m_oldPort ) ;
|
||||
SetPort( (GrafPtr) dc->m_macPort ) ;
|
||||
m_clipRgn = NewRgn() ;
|
||||
GetClip( m_clipRgn ) ;
|
||||
m_dc = dc ;
|
||||
dc->MacSetupPort( NULL ) ;
|
||||
}
|
||||
~wxMacFastPortSetter()
|
||||
{
|
||||
SetPort( (GrafPtr) m_dc->m_macPort ) ;
|
||||
SetClip( m_clipRgn ) ;
|
||||
SetPort( m_oldPort ) ;
|
||||
m_dc->MacCleanupPort( NULL ) ;
|
||||
DisposeRgn( m_clipRgn ) ;
|
||||
SetPort( m_oldPort ) ;
|
||||
m_dc->MacCleanupPort( NULL ) ;
|
||||
DisposeRgn( m_clipRgn ) ;
|
||||
}
|
||||
private :
|
||||
RgnHandle m_clipRgn ;
|
||||
@ -128,12 +128,12 @@ public :
|
||||
|
||||
#endif
|
||||
|
||||
wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win )
|
||||
wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win )
|
||||
{
|
||||
m_formerClip = NewRgn() ;
|
||||
m_newClip = NewRgn() ;
|
||||
GetClip( m_formerClip ) ;
|
||||
|
||||
|
||||
if ( win )
|
||||
{
|
||||
#if 0
|
||||
@ -144,8 +144,8 @@ wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win )
|
||||
wxWindow *parent = win->GetParent() ;
|
||||
parent->MacWindowToRootWindow( &x,&y ) ;
|
||||
wxSize size = parent->GetSize() ;
|
||||
SetRectRgn( insidergn , parent->MacGetLeftBorderSize() , parent->MacGetTopBorderSize() ,
|
||||
size.x - parent->MacGetRightBorderSize(),
|
||||
SetRectRgn( insidergn , parent->MacGetLeftBorderSize() , parent->MacGetTopBorderSize() ,
|
||||
size.x - parent->MacGetRightBorderSize(),
|
||||
size.y - parent->MacGetBottomBorderSize()) ;
|
||||
CopyRgn( (RgnHandle) parent->MacGetVisibleRegion(false).GetWXHRGN() , m_newClip ) ;
|
||||
SectRgn( m_newClip , insidergn , m_newClip ) ;
|
||||
@ -158,11 +158,11 @@ wxMacWindowClipper::wxMacWindowClipper( const wxWindow* win )
|
||||
CopyRgn( (RgnHandle) ((wxWindow*)win)->MacGetVisibleRegion().GetWXHRGN() , m_newClip ) ;
|
||||
OffsetRgn( m_newClip , x , y ) ;
|
||||
SetClip( m_newClip ) ;
|
||||
#endif
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
wxMacWindowClipper::~wxMacWindowClipper()
|
||||
wxMacWindowClipper::~wxMacWindowClipper()
|
||||
{
|
||||
SetClip( m_formerClip ) ;
|
||||
DisposeRgn( m_newClip ) ;
|
||||
@ -269,8 +269,8 @@ void wxMacCalculateColour( int logical_func , const RGBColor &srcColor , RGBColo
|
||||
|
||||
wxDC::wxDC()
|
||||
{
|
||||
m_ok = FALSE;
|
||||
m_colour = TRUE;
|
||||
m_ok = false;
|
||||
m_colour = true;
|
||||
m_mm_to_pix_x = mm2pt;
|
||||
m_mm_to_pix_y = mm2pt;
|
||||
m_internalDeviceOriginX = 0;
|
||||
@ -283,11 +283,11 @@ wxDC::wxDC()
|
||||
m_userScaleY = 1.0;
|
||||
m_scaleX = 1.0;
|
||||
m_scaleY = 1.0;
|
||||
m_needComputeScaleX = FALSE;
|
||||
m_needComputeScaleY = FALSE;
|
||||
m_needComputeScaleX = false;
|
||||
m_needComputeScaleY = false;
|
||||
m_macPort = NULL ;
|
||||
m_macMask = NULL ;
|
||||
m_ok = FALSE ;
|
||||
m_ok = false ;
|
||||
m_macFontInstalled = false ;
|
||||
m_macBrushInstalled = false ;
|
||||
m_macPenInstalled = false ;
|
||||
@ -300,7 +300,7 @@ wxDC::wxDC()
|
||||
m_font = *wxNORMAL_FONT;
|
||||
m_brush = *wxWHITE_BRUSH;
|
||||
#ifdef __WXDEBUG__
|
||||
// needed to debug possible errors with two active drawing methods at the same time on
|
||||
// needed to debug possible errors with two active drawing methods at the same time on
|
||||
// the same DC
|
||||
m_macCurrentPortStateHelper = NULL ;
|
||||
#endif
|
||||
@ -473,7 +473,7 @@ void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
|
||||
}
|
||||
else
|
||||
{
|
||||
m_clipping = TRUE;
|
||||
m_clipping = true;
|
||||
m_clipX1 = xx;
|
||||
m_clipY1 = yy;
|
||||
m_clipX2 = xx + ww;
|
||||
@ -520,7 +520,7 @@ void wxDC::DoSetClippingRegionAsRegion( const wxRegion ®ion )
|
||||
}
|
||||
else
|
||||
{
|
||||
m_clipping = TRUE;
|
||||
m_clipping = true;
|
||||
m_clipX1 = xx;
|
||||
m_clipY1 = yy;
|
||||
m_clipX2 = xx + ww;
|
||||
@ -582,8 +582,8 @@ void wxDC::SetMapMode( int mode )
|
||||
}
|
||||
if (mode != wxMM_TEXT)
|
||||
{
|
||||
m_needComputeScaleX = TRUE;
|
||||
m_needComputeScaleY = TRUE;
|
||||
m_needComputeScaleX = 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(source->Ok(), false, wxT("wxDC::DoBlit Illegal source DC"));
|
||||
if ( logical_func == wxNO_OP )
|
||||
return TRUE ;
|
||||
return true ;
|
||||
if (xsrcMask == -1 && ysrcMask == -1)
|
||||
{
|
||||
xsrcMask = xsrc; ysrcMask = ysrc;
|
||||
@ -1179,7 +1179,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
||||
if ( mode == kUnsupportedMode )
|
||||
{
|
||||
wxFAIL_MSG(wxT("unsupported blitting mode" ));
|
||||
return FALSE ;
|
||||
return false ;
|
||||
}
|
||||
CGrafPtr sourcePort = (CGrafPtr) source->m_macPort ;
|
||||
PixMapHandle bmappixels = GetGWorldPixMap( sourcePort ) ;
|
||||
@ -1338,7 +1338,7 @@ bool wxDC::DoBlit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
|
||||
m_macPenInstalled = false ;
|
||||
m_macBrushInstalled = false ;
|
||||
m_macFontInstalled = false ;
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
#ifndef FixedToInt
|
||||
@ -1367,7 +1367,7 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
|
||||
|
||||
if ( str.Length() == 0 )
|
||||
return ;
|
||||
|
||||
|
||||
wxMacFastPortSetter helper(this) ;
|
||||
MacInstallFont() ;
|
||||
|
||||
@ -1393,13 +1393,13 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
|
||||
int iAngle = int( angle );
|
||||
int drawX = XLOG2DEVMAC(x) ;
|
||||
int drawY = YLOG2DEVMAC(y) ;
|
||||
|
||||
|
||||
ATSUTextMeasurement textBefore ;
|
||||
ATSUTextMeasurement textAfter ;
|
||||
ATSUTextMeasurement ascent ;
|
||||
ATSUTextMeasurement descent ;
|
||||
|
||||
|
||||
|
||||
|
||||
if ( abs(iAngle) > 0 )
|
||||
{
|
||||
Fixed atsuAngle = IntToFixed( iAngle ) ;
|
||||
@ -1420,7 +1420,7 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
|
||||
}
|
||||
status = ::ATSUMeasureText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
|
||||
&textBefore , &textAfter, &ascent , &descent );
|
||||
|
||||
|
||||
drawX += (int)(sin(angle/RAD2DEG) * FixedToInt(ascent));
|
||||
drawY += (int)(cos(angle/RAD2DEG) * FixedToInt(ascent));
|
||||
status = ::ATSUDrawText( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd,
|
||||
@ -1514,7 +1514,7 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
wxCharBuffer text = linetext.mb_str(wxConvLocal) ;
|
||||
wxCharBuffer text = linetext.mb_str(wxConvLocal) ;
|
||||
::DrawText( text , 0 , strlen(text) ) ;
|
||||
if ( m_backgroundMode != wxTRANSPARENT )
|
||||
{
|
||||
@ -1573,7 +1573,7 @@ void wxDC::DoDrawText(const wxString& strtext, wxCoord x, wxCoord y)
|
||||
else
|
||||
#endif
|
||||
{
|
||||
wxCharBuffer text = linetext.mb_str(wxConvLocal) ;
|
||||
wxCharBuffer text = linetext.mb_str(wxConvLocal) ;
|
||||
if ( m_backgroundMode != wxTRANSPARENT )
|
||||
{
|
||||
Rect frame = { yy - fi.ascent + line*(fi.descent + fi.ascent + fi.leading) ,xx , yy - fi.ascent + (line+1)*(fi.descent + fi.ascent + fi.leading) , xx + 10000 } ;
|
||||
@ -1609,7 +1609,7 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
|
||||
MacInstallFont() ;
|
||||
FontInfo fi ;
|
||||
::GetFontInfo( &fi ) ;
|
||||
#if TARGET_CARBON
|
||||
#if TARGET_CARBON
|
||||
bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
|
||||
if ( UMAGetSystemVersion() < 0x1000 || IsKindOf(CLASSINFO( wxPrinterDC ) ) || ((wxFont*)&m_font)->GetNoAntiAliasing() )
|
||||
useGetThemeText = false ;
|
||||
@ -1653,7 +1653,7 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
|
||||
else
|
||||
#endif
|
||||
{
|
||||
wxCharBuffer text = linetext.mb_str(wxConvLocal) ;
|
||||
wxCharBuffer text = linetext.mb_str(wxConvLocal) ;
|
||||
curwidth = ::TextWidth( text , 0 , strlen(text) ) ;
|
||||
}
|
||||
if ( curwidth > *width )
|
||||
@ -1662,7 +1662,7 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
|
||||
}
|
||||
i++ ;
|
||||
}
|
||||
|
||||
|
||||
wxString linetext = strtext.Mid( laststop , i - laststop ) ;
|
||||
#endif // 0
|
||||
wxString linetext = strtext ;
|
||||
@ -1683,7 +1683,7 @@ void wxDC::DoGetTextExtent( const wxString &strtext, wxCoord *width, wxCoord *h
|
||||
else
|
||||
#endif
|
||||
{
|
||||
wxCharBuffer text = linetext.mb_str(wxConvLocal) ;
|
||||
wxCharBuffer text = linetext.mb_str(wxConvLocal) ;
|
||||
curwidth = ::TextWidth( text , 0 , strlen(text) ) ;
|
||||
}
|
||||
if ( curwidth > *width )
|
||||
@ -1707,10 +1707,10 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
|
||||
|
||||
if (text.Length() == 0)
|
||||
return false;
|
||||
|
||||
|
||||
wxMacFastPortSetter helper(this) ;
|
||||
MacInstallFont() ;
|
||||
#if TARGET_CARBON
|
||||
#if TARGET_CARBON
|
||||
bool useGetThemeText = ( GetThemeTextDimensions != (void*) kUnresolvedCFragSymbolAddress ) ;
|
||||
if ( UMAGetSystemVersion() < 0x1000 || IsKindOf(CLASSINFO( wxPrinterDC ) ) || ((wxFont*)&m_font)->GetNoAntiAliasing() )
|
||||
useGetThemeText = false ;
|
||||
@ -1737,7 +1737,7 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
|
||||
widths[i] = XDEV2LOGREL(bounds.h);
|
||||
}
|
||||
}
|
||||
else
|
||||
else
|
||||
#endif
|
||||
{
|
||||
wxCharBuffer buff = text.mb_str(wxConvLocal);
|
||||
@ -1751,7 +1751,7 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
|
||||
for (size_t i=0; i<text.Length(); i++)
|
||||
widths[i] = XDEV2LOGREL(measurements[i+1]);
|
||||
|
||||
delete [] measurements;
|
||||
delete [] measurements;
|
||||
}
|
||||
|
||||
return true;
|
||||
@ -1971,7 +1971,7 @@ static void wxMacGetPattern(int penStyle, Pattern *pattern)
|
||||
{
|
||||
int index = 0; // solid pattern by default
|
||||
switch(penStyle)
|
||||
{
|
||||
{
|
||||
// hatches
|
||||
case wxBDIAGONAL_HATCH: index = 1; break;
|
||||
case wxFDIAGONAL_HATCH: index = 2; break;
|
||||
@ -1985,7 +1985,7 @@ static void wxMacGetPattern(int penStyle, Pattern *pattern)
|
||||
case wxSHORT_DASH: index = 9; break;
|
||||
case wxDOT_DASH: index = 10; break;
|
||||
}
|
||||
*pattern = gPatterns[index];
|
||||
*pattern = gPatterns[index];
|
||||
}
|
||||
|
||||
void wxDC::MacInstallPen() const
|
||||
@ -2004,11 +2004,11 @@ void wxDC::MacInstallPen() const
|
||||
if ( penWidth == 0 )
|
||||
penWidth = 1 ;
|
||||
::PenSize(penWidth, penWidth);
|
||||
|
||||
|
||||
int penStyle = m_pen.GetStyle();
|
||||
Pattern pat;
|
||||
if (penStyle == wxUSER_DASH)
|
||||
{
|
||||
{
|
||||
// FIXME: there should be exactly 8 items in the dash
|
||||
wxDash* dash ;
|
||||
int number = m_pen.GetDashes(&dash) ;
|
||||
@ -2093,7 +2093,7 @@ void wxDC::MacSetupBackgroundForCurrentPort(const wxBrush& background )
|
||||
int brushStyle = background.GetStyle();
|
||||
if (brushStyle == wxSOLID)
|
||||
::BackPat(GetQDGlobalsWhite(&whiteColor));
|
||||
else if (IS_HATCH(brushStyle))
|
||||
else if (background.IsHatch())
|
||||
{
|
||||
Pattern pat ;
|
||||
wxMacGetPattern(brushStyle, &pat);
|
||||
@ -2123,7 +2123,7 @@ void wxDC::MacInstallBrush() const
|
||||
{
|
||||
::PenPat(GetQDGlobalsBlack(&blackColor));
|
||||
}
|
||||
else if (IS_HATCH(brushStyle))
|
||||
else if (m_brush.IsHatch())
|
||||
{
|
||||
Pattern pat ;
|
||||
wxMacGetPattern(brushStyle, &pat);
|
||||
|
@ -86,9 +86,15 @@ static Pixmap bdiag, cdiag, fdiag, cross, horiz, verti;
|
||||
// macros
|
||||
// ----------------------------------------------------------------------------
|
||||
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxWindowDC, wxDC)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxClientDC, wxWindowDC)
|
||||
IMPLEMENT_DYNAMIC_CLASS(wxPaintDC, wxWindowDC)
|
||||
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
|
||||
@ -163,7 +169,7 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
||||
|
||||
m_window = window;
|
||||
m_font = window->GetFont();
|
||||
m_ok = TRUE;
|
||||
m_ok = true;
|
||||
|
||||
m_display = window->GetXDisplay();
|
||||
m_pixmap = window->GetXWindow();
|
||||
@ -222,7 +228,7 @@ wxWindowDC::~wxWindowDC()
|
||||
m_clipRegion = (WXRegion) 0;
|
||||
}
|
||||
|
||||
extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
|
||||
extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
|
||||
const wxColour & col, int style);
|
||||
|
||||
bool wxWindowDC::DoFloodFill(wxCoord x, wxCoord y,
|
||||
@ -230,7 +236,7 @@ bool wxWindowDC::DoFloodFill(wxCoord x, wxCoord y,
|
||||
{
|
||||
return wxDoFloodFill(this, x, y, col, style);
|
||||
}
|
||||
|
||||
|
||||
bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
|
||||
{
|
||||
// Generic (and therefore rather inefficient) method.
|
||||
@ -242,7 +248,7 @@ bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
|
||||
memdc.SelectObject(wxNullBitmap);
|
||||
wxImage image = bitmap.ConvertToImage();
|
||||
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 )
|
||||
@ -781,12 +787,12 @@ void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
|
||||
|
||||
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
|
||||
// in Contrib/Utilities
|
||||
bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
wxCoord width, wxCoord height,
|
||||
@ -794,7 +800,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
int rop, bool useMask,
|
||||
wxCoord xsrcMask, wxCoord ysrcMask )
|
||||
{
|
||||
wxCHECK_MSG( Ok(), FALSE, "invalid dc" );
|
||||
wxCHECK_MSG( Ok(), false, "invalid dc" );
|
||||
|
||||
wxWindowDC* sourceDC = wxDynamicCast(source, wxWindowDC);
|
||||
|
||||
@ -823,8 +829,8 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
|
||||
if( m_textForegroundColour.GetPixel() <= -1 )
|
||||
CalculatePixel( m_textForegroundColour,
|
||||
m_textForegroundColour, TRUE);
|
||||
|
||||
m_textForegroundColour, true);
|
||||
|
||||
int pixel = m_textForegroundColour.GetPixel();
|
||||
if (pixel > -1)
|
||||
SetForegroundPixelWithLogicalFunction(pixel);
|
||||
@ -836,7 +842,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
Pixmap sourcePixmap = (Pixmap) NULL;
|
||||
double scaleX, scaleY;
|
||||
GetUserScale(& scaleX, & scaleY);
|
||||
bool retVal = FALSE;
|
||||
bool retVal = false;
|
||||
|
||||
/* TODO: use the mask origin when drawing transparently */
|
||||
if (xsrcMask == -1 && ysrcMask == -1)
|
||||
@ -924,7 +930,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
|
||||
} else
|
||||
{ //XGCValues values;
|
||||
//XGetGCValues((Display*)m_display, (GC)m_gc, GCForeground, &values);
|
||||
//XGetGCValues((Display*)m_display, (GC)m_gc, GCForeground, &values);
|
||||
|
||||
if (m_window && m_window->GetBackingPixmap())
|
||||
{
|
||||
@ -997,7 +1003,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest,
|
||||
|
||||
SetLogicalFunction(orig);
|
||||
|
||||
retVal = TRUE;
|
||||
retVal = true;
|
||||
}
|
||||
if (scaledBitmap) delete scaledBitmap;
|
||||
|
||||
@ -1115,7 +1121,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
if (!sameColour || !GetOptimization())
|
||||
{
|
||||
int pixel = CalculatePixel(m_textForegroundColour,
|
||||
m_currentColour, FALSE);
|
||||
m_currentColour, false);
|
||||
|
||||
// Set the GC to the required colour
|
||||
if (pixel > -1)
|
||||
@ -1191,8 +1197,8 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
|
||||
|
||||
if( m_textForegroundColour.GetPixel() <= -1 )
|
||||
CalculatePixel( m_textForegroundColour,
|
||||
m_textForegroundColour, TRUE);
|
||||
|
||||
m_textForegroundColour, true);
|
||||
|
||||
foregroundPixel = m_textForegroundColour.GetPixel();
|
||||
}
|
||||
|
||||
@ -1323,7 +1329,7 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
|
||||
|
||||
bool wxWindowDC::CanGetTextExtent() const
|
||||
{
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxWindowDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoord *height,
|
||||
@ -1505,7 +1511,7 @@ int wxWindowDC::CalculatePixel(wxColour& colour, wxColour& curCol,
|
||||
bool roundToWhite) const
|
||||
{
|
||||
const unsigned char wp = (unsigned char)255;
|
||||
|
||||
|
||||
int pixel = -1;
|
||||
if(!m_colour) // Mono display
|
||||
{
|
||||
@ -1789,7 +1795,7 @@ void wxWindowDC::SetPen( const wxPen &pen )
|
||||
pixel = m_backgroundPixel;
|
||||
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
|
||||
@ -1853,7 +1859,7 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
|
||||
// determine whether fill style should be solid or
|
||||
// transparent
|
||||
int style = stippleDepth == 1 ?
|
||||
(m_backgroundMode == wxSOLID ?
|
||||
(m_backgroundMode == wxSOLID ?
|
||||
FillOpaqueStippled : FillStippled) :
|
||||
FillTiled;
|
||||
XSetFillStyle ((Display*) m_display, (GC) m_gc, style);
|
||||
@ -1951,8 +1957,8 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
|
||||
// must test m_logicalFunction, because it involves background!
|
||||
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)
|
||||
SetForegroundPixelWithLogicalFunction(pixel);
|
||||
}
|
||||
@ -2207,7 +2213,7 @@ int wxWindowDC::GetDepth() const
|
||||
wxPaintDC::wxPaintDC(wxWindow* win) : wxWindowDC(win)
|
||||
{
|
||||
// Set the clipping region.to the update region
|
||||
SetDCClipping((WXRegion)NULL);
|
||||
SetDCClipping((WXRegion)NULL);
|
||||
}
|
||||
|
||||
wxPaintDC::~wxPaintDC()
|
||||
|
@ -127,11 +127,11 @@ static GC wxGetPoolGC( Window window, wxPoolGCType type )
|
||||
wxGCPool[i].m_gc = XCreateGC( wxGlobalDisplay(), window, 0, NULL );
|
||||
XSetGraphicsExposures( wxGlobalDisplay(), wxGCPool[i].m_gc, FALSE );
|
||||
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))
|
||||
{
|
||||
wxGCPool[i].m_used = TRUE;
|
||||
wxGCPool[i].m_used = true;
|
||||
return wxGCPool[i].m_gc;
|
||||
}
|
||||
}
|
||||
@ -147,7 +147,7 @@ static void wxFreePoolGC( GC gc )
|
||||
{
|
||||
if (wxGCPool[i].m_gc == gc)
|
||||
{
|
||||
wxGCPool[i].m_used = FALSE;
|
||||
wxGCPool[i].m_used = false;
|
||||
return;
|
||||
}
|
||||
}
|
||||
@ -169,10 +169,10 @@ wxWindowDC::wxWindowDC()
|
||||
m_textGC = (WXGC *) NULL;
|
||||
m_bgGC = (WXGC *) NULL;
|
||||
m_cmap = (WXColormap *) NULL;
|
||||
m_isMemDC = FALSE;
|
||||
m_isScreenDC = FALSE;
|
||||
m_isMemDC = false;
|
||||
m_isScreenDC = false;
|
||||
m_owner = (wxWindow *)NULL;
|
||||
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
m_context = (PangoContext *)NULL;
|
||||
m_fontdesc = (PangoFontDescription *)NULL;
|
||||
@ -190,8 +190,8 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
||||
m_bgGC = (WXGC *) NULL;
|
||||
m_cmap = (WXColormap *) NULL;
|
||||
m_owner = (wxWindow *)NULL;
|
||||
m_isMemDC = FALSE;
|
||||
m_isScreenDC = FALSE;
|
||||
m_isMemDC = false;
|
||||
m_isScreenDC = false;
|
||||
m_font = window->GetFont();
|
||||
|
||||
m_window = (WXWindow*) window->GetMainWindow();
|
||||
@ -200,13 +200,13 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
||||
if (!m_window)
|
||||
{
|
||||
// don't report problems
|
||||
m_ok = TRUE;
|
||||
m_ok = true;
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
m_display = (WXDisplay *) wxGlobalDisplay();
|
||||
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
m_context = wxTheApp->GetPangoContext();
|
||||
m_fontdesc = window->GetFont().GetNativeFontInfo()->description;
|
||||
@ -234,7 +234,7 @@ wxWindowDC::~wxWindowDC()
|
||||
|
||||
void wxWindowDC::SetUpDC()
|
||||
{
|
||||
m_ok = TRUE;
|
||||
m_ok = true;
|
||||
|
||||
wxASSERT_MSG( !m_penGC, wxT("GCs already created") );
|
||||
|
||||
@ -300,7 +300,7 @@ void wxWindowDC::SetUpDC()
|
||||
/* m_bgGC */
|
||||
XSetForeground( (Display*) m_display, (GC) m_bgGC, bg_col );
|
||||
XSetBackground( (Display*) m_display, (GC) m_bgGC, bg_col );
|
||||
|
||||
|
||||
XSetFillStyle( (Display*) m_display, (GC) m_bgGC, FillSolid );
|
||||
|
||||
/* ROPs */
|
||||
@ -318,7 +318,7 @@ void wxWindowDC::SetUpDC()
|
||||
{
|
||||
int xscreen = DefaultScreen( (Display*) m_display );
|
||||
Window xroot = RootWindow( (Display*) m_display, xscreen );
|
||||
|
||||
|
||||
hatch_bitmap = hatches;
|
||||
hatch_bitmap[0] = XCreateBitmapFromData( (Display*) m_display, xroot, bdiag_bits, bdiag_width, bdiag_height );
|
||||
hatch_bitmap[1] = XCreateBitmapFromData( (Display*) m_display, xroot, cdiag_bits, cdiag_width, cdiag_height );
|
||||
@ -336,7 +336,7 @@ void wxWindowDC::DoGetSize( int* width, int* height ) const
|
||||
m_owner->GetSize(width, height);
|
||||
}
|
||||
|
||||
extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
|
||||
extern bool wxDoFloodFill(wxDC *dc, wxCoord x, wxCoord y,
|
||||
const wxColour & col, int style);
|
||||
|
||||
bool wxWindowDC::DoFloodFill(wxCoord x, wxCoord y,
|
||||
@ -356,7 +356,7 @@ bool wxWindowDC::DoGetPixel( wxCoord x1, wxCoord y1, wxColour *col ) const
|
||||
memdc.SelectObject(wxNullBitmap);
|
||||
wxImage image(bitmap.ConvertToImage());
|
||||
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 )
|
||||
@ -375,8 +375,8 @@ void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
|
||||
points[1].x = x2;
|
||||
points[1].y = y2;
|
||||
DrawLines( 2, points, 0, 0 );
|
||||
|
||||
// XDrawLine( (Display*) m_display, (Window) m_window,
|
||||
|
||||
// XDrawLine( (Display*) m_display, (Window) m_window,
|
||||
// (GC) m_penGC, XLOG2DEV(x1), YLOG2DEV(y1), XLOG2DEV(x2), YLOG2DEV(y2) );
|
||||
}
|
||||
|
||||
@ -455,30 +455,30 @@ void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCo
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
|
||||
|
||||
XFillArc( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_brushGC, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_textGC, 0, 0 );
|
||||
} else
|
||||
if (IS_15_PIX_HATCH(m_brush.GetStyle()))
|
||||
{
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
|
||||
m_deviceOriginX % 15, m_deviceOriginY % 15 );
|
||||
|
||||
|
||||
XFillArc( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_brushGC, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
|
||||
} else
|
||||
if (IS_16_PIX_HATCH(m_brush.GetStyle()))
|
||||
{
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
|
||||
m_deviceOriginX % 16, m_deviceOriginY % 16 );
|
||||
|
||||
|
||||
XFillArc( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_brushGC, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
|
||||
} else
|
||||
if (m_brush.GetStyle() == wxSTIPPLE)
|
||||
@ -486,10 +486,10 @@ void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCo
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
|
||||
|
||||
XFillArc( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_brushGC, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
|
||||
}
|
||||
else
|
||||
@ -503,10 +503,10 @@ void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCo
|
||||
{
|
||||
XDrawArc( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_penGC, xxc-r, yyc-r, 2*r,2*r, alpha1, alpha2 );
|
||||
|
||||
|
||||
XDrawLine( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_penGC, xx1, yy1, xxc, yyc );
|
||||
|
||||
|
||||
XDrawLine( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_penGC, xxc, yyc, xx2, yy2 );
|
||||
}
|
||||
@ -541,30 +541,30 @@ void wxWindowDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
|
||||
|
||||
XFillArc( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_textGC, xx, yy, ww, hh, start, end );
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_textGC, 0, 0 );
|
||||
} else
|
||||
if (IS_15_PIX_HATCH(m_brush.GetStyle()))
|
||||
{
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
|
||||
m_deviceOriginX % 15, m_deviceOriginY % 15 );
|
||||
|
||||
|
||||
XFillArc( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_brushGC, xx, yy, ww, hh, start, end );
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
|
||||
} else
|
||||
if (IS_16_PIX_HATCH(m_brush.GetStyle()))
|
||||
{
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
|
||||
m_deviceOriginX % 16, m_deviceOriginY % 16 );
|
||||
|
||||
|
||||
XFillArc( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_brushGC, xx, yy, ww, hh, start, end );
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
|
||||
} else
|
||||
if (m_brush.GetStyle() == wxSTIPPLE)
|
||||
@ -572,10 +572,10 @@ void wxWindowDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
|
||||
|
||||
XFillArc( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_brushGC, xx, yy, ww, hh, start, end );
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
|
||||
}
|
||||
else
|
||||
@ -619,7 +619,7 @@ void wxWindowDC::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord
|
||||
{
|
||||
xpoints[i].x = XLOG2DEV (points[i].x + xoffset);
|
||||
xpoints[i].y = YLOG2DEV (points[i].y + yoffset);
|
||||
|
||||
|
||||
CalcBoundingBox( points[i].x + xoffset, points[i].y + yoffset );
|
||||
}
|
||||
XDrawLines( (Display*) m_display, (Window) m_window, (GC) m_penGC, xpoints, n, 0 );
|
||||
@ -640,7 +640,7 @@ void wxWindowDC::DoDrawPolygon( int n, wxPoint points[],
|
||||
{
|
||||
xpoints[i].x = XLOG2DEV (points[i].x + xoffset);
|
||||
xpoints[i].y = YLOG2DEV (points[i].y + yoffset);
|
||||
|
||||
|
||||
CalcBoundingBox (points[i].x + xoffset, points[i].y + yoffset);
|
||||
}
|
||||
|
||||
@ -648,36 +648,36 @@ void wxWindowDC::DoDrawPolygon( int n, wxPoint points[],
|
||||
{
|
||||
if (m_brush.GetStyle() != wxTRANSPARENT)
|
||||
{
|
||||
|
||||
|
||||
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
|
||||
{
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
|
||||
|
||||
XFillPolygon( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_textGC, xpoints, n, Complex, 0);
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_textGC, 0, 0 );
|
||||
} else
|
||||
if (IS_15_PIX_HATCH(m_brush.GetStyle()))
|
||||
{
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
|
||||
m_deviceOriginX % 15, m_deviceOriginY % 15 );
|
||||
|
||||
|
||||
XFillPolygon( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_brushGC, xpoints, n, Complex, 0);
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
|
||||
} else
|
||||
if (IS_16_PIX_HATCH(m_brush.GetStyle()))
|
||||
{
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
|
||||
m_deviceOriginX % 16, m_deviceOriginY % 16 );
|
||||
|
||||
|
||||
XFillPolygon( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_brushGC, xpoints, n, Complex, 0);
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
|
||||
} else
|
||||
if (m_brush.GetStyle() == wxSTIPPLE)
|
||||
@ -685,10 +685,10 @@ void wxWindowDC::DoDrawPolygon( int n, wxPoint points[],
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
|
||||
|
||||
XFillPolygon( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_brushGC, xpoints, n, Complex, 0);
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
|
||||
}
|
||||
else
|
||||
@ -726,7 +726,7 @@ void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord h
|
||||
// CMB: handle -ve width and/or height
|
||||
if (ww < 0) { ww = -ww; xx = xx - ww; }
|
||||
if (hh < 0) { hh = -hh; yy = yy - hh; }
|
||||
|
||||
|
||||
if (m_window)
|
||||
{
|
||||
if (m_brush.GetStyle() != wxTRANSPARENT)
|
||||
@ -736,30 +736,30 @@ void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord h
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
|
||||
|
||||
XFillRectangle( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_textGC, xx, yy, ww, hh );
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_textGC, 0, 0 );
|
||||
} else
|
||||
if (IS_15_PIX_HATCH(m_brush.GetStyle()))
|
||||
{
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
|
||||
m_deviceOriginX % 15, m_deviceOriginY % 15 );
|
||||
|
||||
|
||||
XFillRectangle( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_brushGC, xx, yy, ww, hh );
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
|
||||
} else
|
||||
if (IS_16_PIX_HATCH(m_brush.GetStyle()))
|
||||
{
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
|
||||
m_deviceOriginX % 16, m_deviceOriginY % 16 );
|
||||
|
||||
|
||||
XFillRectangle( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_brushGC, xx, yy, ww, hh );
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
|
||||
} else
|
||||
if (m_brush.GetStyle() == wxSTIPPLE)
|
||||
@ -767,10 +767,10 @@ void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord h
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
|
||||
|
||||
XFillRectangle( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_brushGC, xx, yy, ww, hh );
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
|
||||
}
|
||||
else
|
||||
@ -794,19 +794,19 @@ void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord h
|
||||
void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord height, double radius )
|
||||
{
|
||||
wxCHECK_RET( Ok(), wxT("invalid window dc") );
|
||||
|
||||
|
||||
if (radius < 0.0) radius = - radius * ((width < height) ? width : height);
|
||||
|
||||
|
||||
wxCoord xx = XLOG2DEV(x);
|
||||
wxCoord yy = YLOG2DEV(y);
|
||||
wxCoord ww = m_signX * XLOG2DEVREL(width);
|
||||
wxCoord hh = m_signY * YLOG2DEVREL(height);
|
||||
wxCoord rr = XLOG2DEVREL((wxCoord)radius);
|
||||
|
||||
|
||||
// CMB: handle -ve width and/or height
|
||||
if (ww < 0) { ww = -ww; xx = xx - ww; }
|
||||
if (hh < 0) { hh = -hh; yy = yy - hh; }
|
||||
|
||||
|
||||
// CMB: if radius is zero use DrawRectangle() instead to avoid
|
||||
// X drawing errors with small radii
|
||||
if (rr == 0)
|
||||
@ -815,10 +815,10 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx
|
||||
(GC) m_penGC, x, y, width, height);
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// CMB: draw nothing if transformed w or h is 0
|
||||
if (ww == 0 || hh == 0) return;
|
||||
|
||||
|
||||
// CMB: adjust size if outline is drawn otherwise the result is
|
||||
// 1 pixel too wide and high
|
||||
if (m_pen.GetStyle() != wxTRANSPARENT)
|
||||
@ -826,7 +826,7 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx
|
||||
ww--;
|
||||
hh--;
|
||||
}
|
||||
|
||||
|
||||
if (m_window)
|
||||
{
|
||||
// CMB: ensure dd is not larger than rectangle otherwise we
|
||||
@ -835,13 +835,13 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx
|
||||
if (dd > ww) dd = ww;
|
||||
if (dd > hh) dd = hh;
|
||||
rr = dd / 2;
|
||||
|
||||
|
||||
if (m_brush.GetStyle() != wxTRANSPARENT)
|
||||
{
|
||||
if ((m_brush.GetStyle() == wxSTIPPLE_MASK_OPAQUE) && (m_brush.GetStipple()->GetMask()))
|
||||
{
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
XFillRectangle( (Display*) m_display, (Window) m_window, (GC) m_textGC, xx+rr, yy, ww-dd+1, hh );
|
||||
XFillRectangle( (Display*) m_display, (Window) m_window, (GC) m_textGC, xx, yy+rr, ww, hh-dd+1 );
|
||||
@ -875,7 +875,7 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx
|
||||
} else
|
||||
if (m_brush.GetStyle() == wxSTIPPLE)
|
||||
{
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
XFillRectangle( (Display*) m_display, (Window) m_window, (GC) m_brushGC, xx+rr, yy, ww-dd+1, hh );
|
||||
@ -908,7 +908,7 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx
|
||||
XDrawArc( (Display*) m_display, (Window) m_window, (GC) m_penGC, xx, yy+hh-dd, dd, dd, 180*64, 90*64 );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
// this ignores the radius
|
||||
CalcBoundingBox( x, y );
|
||||
CalcBoundingBox( x + width, y + height );
|
||||
@ -936,30 +936,30 @@ void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_textGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
|
||||
|
||||
XFillArc( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_textGC, xx, yy, ww, hh, 0, 360*64 );
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_textGC, 0, 0 );
|
||||
} else
|
||||
if (IS_15_PIX_HATCH(m_brush.GetStyle()))
|
||||
{
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
|
||||
m_deviceOriginX % 15, m_deviceOriginY % 15 );
|
||||
|
||||
|
||||
XFillArc( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_brushGC, xx, yy, ww, hh, 0, 360*64 );
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
|
||||
} else
|
||||
if (IS_16_PIX_HATCH(m_brush.GetStyle()))
|
||||
{
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
|
||||
m_deviceOriginX % 16, m_deviceOriginY % 16 );
|
||||
|
||||
|
||||
XFillArc( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_brushGC, xx, yy, ww, hh, 0, 360*64 );
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
|
||||
} else
|
||||
if (m_brush.GetStyle() == wxSTIPPLE)
|
||||
@ -967,10 +967,10 @@ void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC,
|
||||
m_deviceOriginX % m_brush.GetStipple()->GetWidth(),
|
||||
m_deviceOriginY % m_brush.GetStipple()->GetHeight() );
|
||||
|
||||
|
||||
XFillArc( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_brushGC, xx, yy, ww, hh, 0, 360*64 );
|
||||
|
||||
|
||||
XSetTSOrigin( (Display*) m_display, (GC) m_brushGC, 0, 0 );
|
||||
}
|
||||
else
|
||||
@ -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)
|
||||
{
|
||||
DoDrawBitmap(icon, x, y, TRUE);
|
||||
DoDrawBitmap(icon, x, y, true);
|
||||
}
|
||||
|
||||
#if wxUSE_NANOX
|
||||
@ -1004,7 +1004,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
wxCHECK_RET( Ok(), wxT("invalid window dc") );
|
||||
|
||||
wxCHECK_RET( bitmap.Ok(), wxT("invalid bitmap") );
|
||||
|
||||
|
||||
bool is_mono = (bitmap.GetBitmap() != NULL);
|
||||
|
||||
/* scale/translate size and position */
|
||||
@ -1076,7 +1076,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
GrCopyArea(bufPixmap, gc, 0, 0, w, h, (Window) m_window,
|
||||
0, 0, GR_MODE_COPY);
|
||||
#endif
|
||||
|
||||
|
||||
// Copy src to buffer using selected raster op (none selected
|
||||
// in DrawBitmap, so just use Gxcopy)
|
||||
GrCopyArea(bufPixmap, gc, 0, 0, w, h, pixmap,
|
||||
@ -1087,7 +1087,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
GrSetGCForeground(gc, BLACK);
|
||||
GrCopyArea(bufPixmap, gc, 0, 0, w, h, maskPixmap,
|
||||
0, 0, GR_MODE_AND);
|
||||
|
||||
|
||||
// set unmasked area in dest to BLACK
|
||||
GrSetGCBackground(gc, BLACK);
|
||||
GrSetGCForeground(gc, WHITE);
|
||||
@ -1123,7 +1123,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
wxCHECK_RET( Ok(), wxT("invalid window dc") );
|
||||
|
||||
wxCHECK_RET( bitmap.Ok(), wxT("invalid bitmap") );
|
||||
|
||||
|
||||
bool is_mono = (bitmap.GetBitmap() != NULL);
|
||||
|
||||
// scale/translate size and position
|
||||
@ -1171,7 +1171,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
// apply mask if any
|
||||
WXPixmap mask = NULL;
|
||||
if (use_bitmap.GetMask()) mask = use_bitmap.GetMask()->GetBitmap();
|
||||
|
||||
|
||||
if (useMask && mask)
|
||||
{
|
||||
WXPixmap new_mask = NULL;
|
||||
@ -1212,7 +1212,7 @@ void wxWindowDC::DoDrawBitmap( const wxBitmap &bitmap,
|
||||
XSetClipMask( (Display*) m_display, (GC) m_penGC, (Pixmap) mask );
|
||||
XSetClipOrigin( (Display*) m_display, (GC) m_penGC, xx, yy );
|
||||
}
|
||||
|
||||
|
||||
if (new_mask)
|
||||
XFreePixmap( (Display*) m_display, (Pixmap) new_mask );
|
||||
}
|
||||
@ -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
|
||||
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
|
||||
xsrc = source->XLOG2DEV(xsrc);
|
||||
@ -1270,19 +1270,19 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
|
||||
wxClientDC *srcDC = (wxClientDC*)source;
|
||||
wxMemoryDC *memDC = (wxMemoryDC*)source;
|
||||
|
||||
bool use_bitmap_method = FALSE;
|
||||
bool is_mono = FALSE;
|
||||
bool use_bitmap_method = 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)
|
||||
{
|
||||
xsrcMask = xsrc;
|
||||
ysrcMask = ysrc;
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
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
|
||||
that have mask since the XCopyArea doesn't know
|
||||
about masks */
|
||||
use_bitmap_method = TRUE;
|
||||
use_bitmap_method = true;
|
||||
}
|
||||
else if (memDC->m_selected.GetDepth() == 1)
|
||||
{
|
||||
/* we HAVE TO use the direct way for memory dcs
|
||||
that are bitmaps because XCopyArea doesn't cope
|
||||
with different bit depths */
|
||||
is_mono = TRUE;
|
||||
use_bitmap_method = TRUE;
|
||||
is_mono = true;
|
||||
use_bitmap_method = true;
|
||||
}
|
||||
else if ((xsrc == 0) && (ysrc == 0) &&
|
||||
(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
|
||||
wouldn't be able able to boost performace by reducing
|
||||
the area to be scaled */
|
||||
use_bitmap_method = TRUE;
|
||||
use_bitmap_method = true;
|
||||
}
|
||||
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 );
|
||||
tmp.Intersect( m_currentClippingRegion );
|
||||
if (tmp.IsEmpty())
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
int old_logical_func = m_logicalFunction;
|
||||
@ -1416,7 +1416,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
|
||||
XSetClipMask( (Display*) m_display, (GC) m_penGC, (Pixmap) mask );
|
||||
XSetClipOrigin( (Display*) m_display, (GC) m_penGC, xx, yy );
|
||||
}
|
||||
|
||||
|
||||
if (new_mask)
|
||||
XFreePixmap( (Display*) m_display, (Pixmap) new_mask );
|
||||
}
|
||||
@ -1483,7 +1483,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
|
||||
bitmap = image;
|
||||
|
||||
// draw scaled bitmap
|
||||
XCopyArea( (Display*) m_display, (Window) bitmap.GetPixmap(), (Window) m_window,
|
||||
XCopyArea( (Display*) m_display, (Window) bitmap.GetPixmap(), (Window) m_window,
|
||||
(GC) m_penGC, 0, 0, width, height, xx, yy );
|
||||
}
|
||||
else
|
||||
@ -1492,15 +1492,15 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
|
||||
|
||||
// copy including child window contents
|
||||
XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, IncludeInferiors );
|
||||
XCopyArea( (Display*) m_display, (Window) srcDC->GetWindow(), (Window) m_window,
|
||||
XCopyArea( (Display*) m_display, (Window) srcDC->GetWindow(), (Window) m_window,
|
||||
(GC) m_penGC, xsrc, ysrc, width, height, xx, yy );
|
||||
XSetSubwindowMode( (Display*) m_display, (GC) m_penGC, ClipByChildren );
|
||||
}
|
||||
}
|
||||
|
||||
SetLogicalFunction( old_logical_func );
|
||||
|
||||
return TRUE;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
@ -1515,28 +1515,28 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
#if wxUSE_UNICODE
|
||||
PangoLayout *layout = pango_layout_new(m_context);
|
||||
pango_layout_set_font_description(layout, m_fontdesc);
|
||||
|
||||
|
||||
const wxCharBuffer data = wxConvUTF8.cWC2MB( text );
|
||||
pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data ));
|
||||
|
||||
|
||||
// Measure layout.
|
||||
int w,h;
|
||||
pango_layout_get_pixel_size(layout, &w, &h);
|
||||
wxCoord width = w;
|
||||
wxCoord height = h;
|
||||
|
||||
|
||||
// Draw layout.
|
||||
x11_draw_layout( (Drawable) m_window, (GC) m_textGC, x, y, layout, m_textForegroundColour );
|
||||
|
||||
|
||||
g_object_unref( G_OBJECT( layout ) );
|
||||
|
||||
|
||||
CalcBoundingBox (x + width, y + height);
|
||||
CalcBoundingBox (x, y);
|
||||
#else
|
||||
XFontStruct *xfont = (XFontStruct*) m_font.GetFontStruct( m_scaleY, m_display );
|
||||
|
||||
wxCHECK_RET( xfont, wxT("invalid font") );
|
||||
|
||||
|
||||
// First draw a rectangle representing the text background, if a text
|
||||
// background is specified
|
||||
if (m_textBackgroundColour.Ok () && (m_backgroundMode != wxTRANSPARENT))
|
||||
@ -1570,7 +1570,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
if ((xfont->min_byte1 == 0) && (xfont->max_byte1 == 0))
|
||||
#endif
|
||||
{
|
||||
XDrawString( (Display*) m_display, (Window) m_window,
|
||||
XDrawString( (Display*) m_display, (Window) m_window,
|
||||
(GC) m_textGC, x, y + XFontStructGetAscent(xfont), text.c_str(), text.Len() );
|
||||
}
|
||||
|
||||
@ -1584,7 +1584,7 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
||||
|
||||
width = wxCoord(width / m_scaleX);
|
||||
height = wxCoord(height / m_scaleY);
|
||||
|
||||
|
||||
CalcBoundingBox (x + width, y + height);
|
||||
CalcBoundingBox (x, y);
|
||||
#endif
|
||||
@ -1602,13 +1602,13 @@ void wxWindowDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoor
|
||||
{
|
||||
wxCHECK_RET( Ok(), wxT("invalid dc") );
|
||||
|
||||
if (string.IsEmpty())
|
||||
if (string.empty())
|
||||
{
|
||||
if (width) (*width) = 0;
|
||||
if (height) (*height) = 0;
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
PangoLayout *layout = pango_layout_new( m_context );
|
||||
|
||||
@ -1616,15 +1616,15 @@ void wxWindowDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoor
|
||||
pango_layout_set_font_description( layout, font->GetNativeFontInfo()->description );
|
||||
else
|
||||
pango_layout_set_font_description(layout, m_fontdesc);
|
||||
|
||||
|
||||
const wxCharBuffer data = wxConvUTF8.cWC2MB( string );
|
||||
pango_layout_set_text(layout, (const char*) data, strlen( (const char*) data ));
|
||||
|
||||
|
||||
// Measure text.
|
||||
int w,h;
|
||||
pango_layout_get_pixel_size(layout, &w, &h);
|
||||
|
||||
if (width) (*width) = (wxCoord) w;
|
||||
|
||||
if (width) (*width) = (wxCoord) w;
|
||||
if (height) (*height) = (wxCoord) h;
|
||||
if (descent)
|
||||
{
|
||||
@ -1632,7 +1632,7 @@ void wxWindowDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoor
|
||||
(*descent) = 0;
|
||||
}
|
||||
if (externalLeading) (*externalLeading) = 0; // ??
|
||||
|
||||
|
||||
g_object_unref( G_OBJECT( layout ) );
|
||||
#else
|
||||
wxFont fontToUse = m_font;
|
||||
@ -1643,7 +1643,7 @@ void wxWindowDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoor
|
||||
XFontStruct *xfont = (XFontStruct*) fontToUse.GetFontStruct( m_scaleY, m_display );
|
||||
|
||||
wxCHECK_RET( xfont, wxT("invalid font") );
|
||||
|
||||
|
||||
int direction, ascent, descent2;
|
||||
XCharStruct overall;
|
||||
|
||||
@ -1664,22 +1664,22 @@ void wxWindowDC::DoGetTextExtent( const wxString &string, wxCoord *width, wxCoor
|
||||
wxCoord wxWindowDC::GetCharWidth() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), 0, wxT("invalid dc") );
|
||||
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
PangoLayout *layout = pango_layout_new( m_context );
|
||||
|
||||
|
||||
if (!m_fontdesc)
|
||||
{
|
||||
char *crash = NULL;
|
||||
*crash = 0;
|
||||
}
|
||||
|
||||
|
||||
pango_layout_set_font_description(layout, m_fontdesc);
|
||||
pango_layout_set_text(layout, "H", 1 );
|
||||
int w,h;
|
||||
pango_layout_get_pixel_size(layout, &w, &h);
|
||||
g_object_unref( G_OBJECT( layout ) );
|
||||
|
||||
|
||||
return w;
|
||||
#else
|
||||
wxCHECK_MSG( m_font.Ok(), 0, wxT("invalid font") );
|
||||
@ -1690,9 +1690,9 @@ wxCoord wxWindowDC::GetCharWidth() const
|
||||
|
||||
int direction, ascent, descent;
|
||||
XCharStruct overall;
|
||||
|
||||
|
||||
XTextExtents( xfont, "H", 1, &direction, &ascent, &descent, &overall );
|
||||
|
||||
|
||||
return (wxCoord)(overall.width / m_scaleX);
|
||||
#endif
|
||||
}
|
||||
@ -1700,23 +1700,23 @@ wxCoord wxWindowDC::GetCharWidth() const
|
||||
wxCoord wxWindowDC::GetCharHeight() const
|
||||
{
|
||||
wxCHECK_MSG( Ok(), 0, wxT("invalid dc") );
|
||||
|
||||
|
||||
#if wxUSE_UNICODE
|
||||
PangoLayout *layout = pango_layout_new( m_context );
|
||||
|
||||
|
||||
if (!m_fontdesc)
|
||||
{
|
||||
char *crash = NULL;
|
||||
*crash = 0;
|
||||
}
|
||||
|
||||
|
||||
pango_layout_set_font_description(layout, m_fontdesc);
|
||||
|
||||
|
||||
pango_layout_set_text(layout, "H", 1 );
|
||||
int w,h;
|
||||
pango_layout_get_pixel_size(layout, &w, &h);
|
||||
g_object_unref( G_OBJECT( layout ) );
|
||||
|
||||
|
||||
return h;
|
||||
#else
|
||||
wxCHECK_MSG( m_font.Ok(), 0, wxT("invalid font") );
|
||||
@ -1727,9 +1727,9 @@ wxCoord wxWindowDC::GetCharHeight() const
|
||||
|
||||
int direction, ascent, descent;
|
||||
XCharStruct overall;
|
||||
|
||||
|
||||
XTextExtents( xfont, "H", 1, &direction, &ascent, &descent, &overall );
|
||||
|
||||
|
||||
return (wxCoord)((ascent+descent) / m_scaleY);
|
||||
#endif
|
||||
}
|
||||
@ -1912,7 +1912,7 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
|
||||
|
||||
m_brush.GetColour().CalcPixel( m_cmap );
|
||||
XSetForeground( (Display*) m_display, (GC) m_brushGC, m_brush.GetColour().GetPixel() );
|
||||
|
||||
|
||||
XSetFillStyle( (Display*) m_display, (GC) m_brushGC, FillSolid );
|
||||
|
||||
if ((m_brush.GetStyle() == wxSTIPPLE) && (m_brush.GetStipple()->Ok()))
|
||||
@ -1935,7 +1935,7 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
|
||||
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 );
|
||||
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 );
|
||||
int num = m_backgroundBrush.GetStyle() - wxBDIAGONAL_HATCH;
|
||||
@ -2000,7 +2000,7 @@ void wxWindowDC::SetLogicalFunction( int function )
|
||||
// VZ: shouldn't this be a CHECK?
|
||||
if (!m_window)
|
||||
return;
|
||||
|
||||
|
||||
switch (function)
|
||||
{
|
||||
case wxCLEAR:
|
||||
@ -2061,7 +2061,7 @@ void wxWindowDC::SetLogicalFunction( int function )
|
||||
// operations (i.e. DrawText/DrawRotatedText).
|
||||
// True, but mono-bitmaps use the m_textGC and they use ROPs as well.
|
||||
XSetFunction( (Display*) m_display, (GC) m_textGC, x_function );
|
||||
|
||||
|
||||
m_logicalFunction = function;
|
||||
}
|
||||
|
||||
@ -2289,9 +2289,9 @@ wxClientDC::wxClientDC( wxWindow *window )
|
||||
: wxWindowDC( window )
|
||||
{
|
||||
wxCHECK_RET( window, _T("NULL window in wxClientDC::wxClientDC") );
|
||||
|
||||
|
||||
m_window = (WXWindow*) window->GetClientAreaWindow();
|
||||
|
||||
|
||||
// Adjust the client area when the wxWindow is not using 2 X11 windows.
|
||||
if (m_window == (WXWindow*) window->GetMainWindow())
|
||||
{
|
||||
@ -2355,7 +2355,7 @@ IMPLEMENT_DYNAMIC_CLASS(wxDCModule, wxModule)
|
||||
bool wxDCModule::OnInit()
|
||||
{
|
||||
wxInitGCPool();
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
void wxDCModule::OnExit()
|
||||
|
Loading…
Reference in New Issue
Block a user