\func{void}{DrawBitmap}{\param{const wxBitmap\&}{ bitmap}, \param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{bool}{ transparent}}
-Draw a bitmap on the device context at the specified point. If {\it transparent} is TRUE and the bitmap has
+Draw a bitmap on the device context at the specified point. If {\it transparent} is true and the bitmap has
a transparency mask, the bitmap will be drawn transparently.
When drawing a mono-bitmap, the current text foreground colour will be used to draw the foreground
Gets the {\it mapping mode} for the device context (see \helpref{wxSVGFileDC::SetMapMode}{wxdcsetmapmode}).
-\membersection{wxSVGFileDC::GetOptimization}\label{wxdcgetoptimization}
-
-\func{bool}{GetOptimization}{\void}
-
-Always returns TRUE, with an assertion in debug mode that optimisation is not implemented
-
\membersection{wxSVGFileDC::GetPen}\label{wxdcgetpen}
\func{wxPen\&}{GetPen}{\void}
\func{bool}{Ok}{\void}
-Returns TRUE if the DC is ok to use; False values arise from being unable to
+Returns true if the DC is ok to use; False values arise from being unable to
write the file
\membersection{wxSVGFileDC::ResetBoundingBox}\label{wxdcresetboundingbox}
\twocolitem{wxMM\_TEXT}{Each logical unit is 1 pixel.}
\end{twocollist}
-\membersection{wxSVGFileDC::SetOptimization}\label{wxsetoptimization}
-
-\func{void}{SetOptimization}{\param{bool }{optimize}}
-
-Does nothing
-
\membersection{wxSVGFileDC::SetPen}\label{wxdcsetpen}
\func{void}{SetPen}{\param{const wxPen\& }{pen}}
int m_sub_images ;
bool m_OK, m_graphics_changed ;
int m_width, m_height ;
-
- double
+
+ double
m_logicalScaleX,
m_logicalScaleY,
m_userScaleX,
m_userScaleY,
m_scaleX,
m_scaleY,
- m_OriginX,
+ m_OriginX,
m_OriginY,
m_mm_to_pix_x,
m_mm_to_pix_y;
- bool
- m_needComputeScaleX,
+ bool
+ m_needComputeScaleX,
m_needComputeScaleY; // not yet used
-
- bool DoGetPixel(wxCoord, wxCoord, class wxColour *) const
- { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::DoGetPixel Call not implemented")); return TRUE ; };
+
+ bool DoGetPixel(wxCoord, wxCoord, class wxColour *) const
+ { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::DoGetPixel Call not implemented")); return true; };
virtual bool DoBlit(wxCoord, wxCoord, wxCoord, wxCoord, class wxDC *,
wxCoord, wxCoord, int = wxCOPY, bool = 0, int = -1, int = -1) ;
- void DoCrossHair(wxCoord, wxCoord)
+ void DoCrossHair(wxCoord, wxCoord)
{ wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::CrossHair Call not implemented")); return ; };
void DoDrawArc(wxCoord, wxCoord, wxCoord, wxCoord, wxCoord, wxCoord);
void DoGetTextExtent(const wxString& string, wxCoord *w, wxCoord *h, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, wxFont *font = NULL) const ;
- void DoSetClippingRegionAsRegion(const class wxRegion &)
+ void DoSetClippingRegionAsRegion(const class wxRegion &)
{ wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::DoSetClippingRegionAsRegion Call not yet implemented")); return ; };
void Init (wxString f, int Width, int Height, float dpi);
return (wxCoord)((double)(y) * m_scaleY - 0.5);
}
- void write(const wxString &s);
+ void write(const wxString &s);
public:
~wxSVGFileDC();
- bool CanDrawBitmap() const { return TRUE ; };
+ bool CanDrawBitmap() const { return true; };
- bool CanGetTextExtent() const { return TRUE ; };
+ bool CanGetTextExtent() const { return true; };
int GetDepth() const
{ wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::GetDepth Call not implemented")); return -1 ; };
-
+
void BeginDrawing() { return;};
bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC* source, wxCoord xsrc, wxCoord ysrc, int logicalFunc = wxCOPY, bool useMask = FALSE)
void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool transparent)
{ DoDrawBitmap ( bitmap, x, y, transparent ) ; return ;};
-
void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
{DoDrawIcon(icon, x, y) ; return ; };
int GetMapMode() ;
- bool GetOptimization()
- { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::GetOptimization() No optimization code used")); return TRUE ; };
-
bool GetPixel(wxCoord x, wxCoord y, wxColour *colour)
{ return DoGetPixel (x, y, colour) ; } ;
void SetMapMode(int anint) ;
- void SetOptimization(bool WXUNUSED(optimize)) { return ; };
-
void SetPen(const wxPen& pen) ;
void SetUserScale(double xScale, double yScale) ;
Gets the {\it mapping mode} for the device context (see \helpref{wxDC::SetMapMode}{wxdcsetmapmode}).
-\membersection{wxDC::GetOptimization}\label{wxdcgetoptimization}
-
-\func{bool}{GetOptimization}{\void}
-
-Returns true if device context optimization is on.
-See \helpref{wxDC::SetOptimization}{wxsetoptimization} for details.
-
-
\membersection{wxDC::GetPartialTextExtents}\label{wxdcgetpartialtextextents}
\constfunc{bool}{GetPartialTextExtents}{\param{const wxString\& }{text},
\end{twocollist}
-\membersection{wxDC::SetOptimization}\label{wxsetoptimization}
-
-\func{void}{SetOptimization}{\param{bool }{optimize}}
-
-If {\it optimize} is true (the default), this function sets optimization mode on.
-This currently means that under X, the device context will not try to set a pen or brush
-property if it is known to be set already. This approach can fall down
-if non-wxWidgets code is using the same device context or window, for example
-when the window is a panel on which the windowing system draws panel items.
-The wxWidgets device context 'memory' will now be out of step with reality.
-
-Setting optimization off, drawing, then setting it back on again, is a trick
-that must occasionally be employed.
-
-
\membersection{wxDC::SetPalette}\label{wxdcsetpalette}
\func{void}{SetPalette}{\param{const wxPalette\& }{palette}}
\func{void}{DrawBitmap}{\param{const wxBitmap\&}{ bitmap}, \param{wxCoord}{ x}, \param{wxCoord}{ y}, \param{bool}{ transparent}}
-Draw a bitmap on the device context at the specified point. If {\it transparent} is TRUE and the bitmap has
+Draw a bitmap on the device context at the specified point. If {\it transparent} is true and the bitmap has
a transparency mask, the bitmap will be drawn transparently.
When drawing a mono-bitmap, the current text foreground colour will be used to draw the foreground
Gets the {\it mapping mode} for the device context (see \helpref{wxSVGFileDC::SetMapMode}{wxdcsetmapmode}).
-\membersection{wxSVGFileDC::GetOptimization}\label{wxdcgetoptimization}
-
-\func{bool}{GetOptimization}{\void}
-
-Always returns TRUE, with an assertion in debug mode that optimisation is not implemented
-
\membersection{wxSVGFileDC::GetPen}\label{wxdcgetpen}
\func{wxPen\&}{GetPen}{\void}
\func{bool}{Ok}{\void}
-Returns TRUE if the DC is ok to use; False values arise from being unable to
+Returns true if the DC is ok to use; False values arise from being unable to
write the file
\membersection{wxSVGFileDC::ResetBoundingBox}\label{wxdcresetboundingbox}
\twocolitem{wxMM\_TEXT}{Each logical unit is 1 pixel.}
\end{twocollist}
-\membersection{wxSVGFileDC::SetOptimization}\label{wxsetoptimization}
-
-\func{void}{SetOptimization}{\param{bool }{optimize}}
-
-Does nothing
-
\membersection{wxSVGFileDC::SetPen}\label{wxdcsetpen}
\func{void}{SetPen}{\param{const wxPen\& }{pen}}
int GetLogicalFunction() const { return m_logicalFunction; }
virtual void SetLogicalFunction(int function) = 0;
- // Sometimes we need to override optimization, e.g. if other software is
- // drawing onto our surface and we can't be sure of who's done what.
- //
- // FIXME: is this (still) used?
+#if WXWIN_COMPATIBILITY_2_4
virtual void SetOptimization(bool WXUNUSED(opt)) { }
virtual bool GetOptimization() { return false; }
+#endif
// bounding box
// ------------
int m_sub_images ;
bool m_OK, m_graphics_changed ;
int m_width, m_height ;
-
- double
+
+ double
m_logicalScaleX,
m_logicalScaleY,
m_userScaleX,
m_userScaleY,
m_scaleX,
m_scaleY,
- m_OriginX,
+ m_OriginX,
m_OriginY,
m_mm_to_pix_x,
m_mm_to_pix_y;
- bool
- m_needComputeScaleX,
+ bool
+ m_needComputeScaleX,
m_needComputeScaleY; // not yet used
-
- bool DoGetPixel(wxCoord, wxCoord, class wxColour *) const
- { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::DoGetPixel Call not implemented")); return TRUE ; };
+
+ bool DoGetPixel(wxCoord, wxCoord, class wxColour *) const
+ { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::DoGetPixel Call not implemented")); return true; };
virtual bool DoBlit(wxCoord, wxCoord, wxCoord, wxCoord, class wxDC *,
wxCoord, wxCoord, int = wxCOPY, bool = 0, int = -1, int = -1) ;
- void DoCrossHair(wxCoord, wxCoord)
+ void DoCrossHair(wxCoord, wxCoord)
{ wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::CrossHair Call not implemented")); return ; };
void DoDrawArc(wxCoord, wxCoord, wxCoord, wxCoord, wxCoord, wxCoord);
void DoGetTextExtent(const wxString& string, wxCoord *w, wxCoord *h, wxCoord *descent = NULL, wxCoord *externalLeading = NULL, wxFont *font = NULL) const ;
- void DoSetClippingRegionAsRegion(const class wxRegion &)
+ void DoSetClippingRegionAsRegion(const class wxRegion &)
{ wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::DoSetClippingRegionAsRegion Call not yet implemented")); return ; };
void Init (wxString f, int Width, int Height, float dpi);
return (wxCoord)((double)(y) * m_scaleY - 0.5);
}
- void write(const wxString &s);
+ void write(const wxString &s);
public:
~wxSVGFileDC();
- bool CanDrawBitmap() const { return TRUE ; };
+ bool CanDrawBitmap() const { return true; };
- bool CanGetTextExtent() const { return TRUE ; };
+ bool CanGetTextExtent() const { return true; };
int GetDepth() const
{ wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::GetDepth Call not implemented")); return -1 ; };
-
+
void BeginDrawing() { return;};
bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height, wxDC* source, wxCoord xsrc, wxCoord ysrc, int logicalFunc = wxCOPY, bool useMask = FALSE)
void DrawBitmap(const wxBitmap& bitmap, wxCoord x, wxCoord y, bool transparent)
{ DoDrawBitmap ( bitmap, x, y, transparent ) ; return ;};
-
void DrawIcon(const wxIcon& icon, wxCoord x, wxCoord y)
{DoDrawIcon(icon, x, y) ; return ; };
int GetMapMode() ;
- bool GetOptimization()
- { wxASSERT_MSG (FALSE, wxT("wxSVGFILEDC::GetOptimization() No optimization code used")); return TRUE ; };
-
bool GetPixel(wxCoord x, wxCoord y, wxColour *colour)
{ return DoGetPixel (x, y, colour) ; } ;
void SetMapMode(int anint) ;
- void SetOptimization(bool WXUNUSED(optimize)) { return ; };
-
void SetPen(const wxPen& pen) ;
void SetUserScale(double xScale, double yScale) ;
#define IS_HATCH(s) ((s)>=wxFIRST_HATCH && (s)<=wxLAST_HATCH)
#endif
+// FIXME: left over after removal of wxDC::GetOptimization()
+#define GET_OPTIMIZATION false
+
// ----------------------------------------------------------------------------
// prototypes
// ----------------------------------------------------------------------------
sameColour = (sameColour &&
(oldPenColour.GetPixel() == m_textBackgroundColour.GetPixel()));
- if (!sameColour || !GetOptimization())
+ if (!sameColour || !GET_OPTIMIZATION)
{
int pixel = m_textBackgroundColour.AllocColour(m_display);
m_currentColour = m_textBackgroundColour;
(oldPenColour.Green () == m_currentColour.Green ()) &&
(oldPenColour.GetPixel() == m_currentColour.GetPixel()));
- if (!sameColour || !GetOptimization())
+ if (!sameColour || !GET_OPTIMIZATION)
{
int pixel = CalculatePixel(m_textForegroundColour,
m_currentColour, false);
(oldPenColour.Green () == m_currentColour.Green ()) &&
(oldPenColour.GetPixel() == m_currentColour.GetPixel()));
- if (!sameStyle || !GetOptimization())
+ if (!sameStyle || !GET_OPTIMIZATION)
{
int scaled_width = (int) XLOG2DEVREL (m_pen.GetWidth ());
if (scaled_width < 0)
XSetLineAttributes ((Display*) m_display,(GC) m_gcBacking, scaled_width, style, cap, join);
}
- if (IS_HATCH(m_currentFill) && ((m_currentFill != oldFill) || !GetOptimization()))
+ if (IS_HATCH(m_currentFill) && ((m_currentFill != oldFill) || !GET_OPTIMIZATION))
{
Pixmap myStipple;
XSetStipple ((Display*) m_display,(GC) m_gcBacking, myStipple);
}
else if (m_currentStipple.Ok()
- && ((m_currentStipple != oldStipple) || !GetOptimization()))
+ && ((m_currentStipple != oldStipple) || !GET_OPTIMIZATION))
{
XSetStipple ((Display*) m_display, (GC) m_gc, (Pixmap) m_currentStipple.GetDrawable());
XSetStipple ((Display*) m_display,(GC) m_gcBacking, (Pixmap) m_currentStipple.GetDrawable());
}
- if ((m_currentFill != oldFill) || !GetOptimization())
+ if ((m_currentFill != oldFill) || !GET_OPTIMIZATION)
{
int fill_style;
}
// must test m_logicalFunction, because it involves background!
- if (!sameColour || !GetOptimization()
+ if (!sameColour || !GET_OPTIMIZATION
|| ((m_logicalFunction == wxXOR) || (m_autoSetting & 0x2)))
{
int pixel = -1;
int stippleDepth = -1;
- if ((oldFill != m_brush.GetStyle ()) || !GetOptimization())
+ if ((oldFill != m_brush.GetStyle ()) || !GET_OPTIMIZATION)
{
switch (brush.GetStyle ())
{
}
}
- if (IS_HATCH(m_currentFill) && ((m_currentFill != oldFill) || !GetOptimization()))
+ if (IS_HATCH(m_currentFill) && ((m_currentFill != oldFill) || !GET_OPTIMIZATION))
{
Pixmap myStipple;
}
// must test m_logicalFunction, because it involves background!
- if (!sameColour || !GetOptimization() || m_logicalFunction == wxXOR)
+ if (!sameColour || !GET_OPTIMIZATION || m_logicalFunction == wxXOR)
{
int pixel = CalculatePixel(m_brush.GetColour(), m_currentColour, true);
// Created: 01/02/97
// RCS-ID: $Id$
// Copyright: (c) Julian Smart
-// Licence: wxWindows licence
+// Licence: wxWindows licence
/////////////////////////////////////////////////////////////////////////////
#if defined(__GNUG__) && !defined(NO_GCC_PRAGMA)
wxMemoryDC::wxMemoryDC(void)
{
- m_ok = TRUE;
+ m_ok = true;
m_display = wxGetDisplay();
-
+
Display* display = (Display*) m_display;
-
+
XGCValues gcvalues;
gcvalues.foreground = BlackPixel (display, DefaultScreen (display));
gcvalues.background = WhitePixel (display, DefaultScreen (display));
m_gc = (WXGC) XCreateGC (display, RootWindow (display, DefaultScreen (display)),
GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode,
&gcvalues);
-
+
m_backgroundPixel = (int) gcvalues.background;
-
+
// Get the current Font so we can set it back later
XGCValues valReturn;
XGetGCValues((Display*) m_display, (GC) m_gc, GCFont, &valReturn);
m_oldFont = (WXFont) valReturn.font;
SetBrush (* wxWHITE_BRUSH);
SetPen (* wxBLACK_PEN);
- SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
+ SetFont(wxSystemSettings::GetFont(wxSYS_DEFAULT_GUI_FONT));
};
wxMemoryDC::wxMemoryDC( wxDC* dc )
{
- m_ok = TRUE;
+ m_ok = true;
if (dc && dc->IsKindOf(CLASSINFO(wxWindowDC)))
m_display = ((wxWindowDC*)dc)->GetDisplay();
else
m_display = wxGetDisplay();
-
+
Display* display = (Display*) m_display;
-
+
XGCValues gcvalues;
gcvalues.foreground = BlackPixel (display, DefaultScreen (display));
gcvalues.background = WhitePixel (display, DefaultScreen (display));
m_gc = (WXGC) XCreateGC (display, RootWindow (display, DefaultScreen (display)),
GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode,
&gcvalues);
-
+
m_backgroundPixel = (int) gcvalues.background;
-
+
// Get the current Font so we can set it back later
XGCValues valReturn;
XGetGCValues((Display*) m_display, (GC) m_gc, GCFont, &valReturn);
void wxMemoryDC::SelectObject( const wxBitmap& bitmap )
{
m_bitmap = bitmap;
-
+
if (m_gc)
XFreeGC((Display*) m_display, (GC) m_gc);
m_gc = (WXGC) NULL;
-
+
if (m_bitmap.Ok() && (bitmap.GetDisplay() == m_display))
{
m_pixmap = m_bitmap.GetDrawable();
Display* display = (Display*) m_display;
-
+
XGCValues gcvalues;
gcvalues.foreground = BlackPixel (display, DefaultScreen (display));
gcvalues.background = WhitePixel (display, DefaultScreen (display));
m_gc = (WXGC) XCreateGC (display, (Drawable)m_pixmap/* RootWindow (display, DefaultScreen (display)) */,
GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode,
&gcvalues);
-
+
m_backgroundPixel = (int) gcvalues.background;
- m_ok = TRUE;
-
+ m_ok = true;
+
// Get the current Font so we can set it back later
XGCValues valReturn;
XGetGCValues((Display*) m_display, (GC) m_gc, GCFont, &valReturn);
m_oldFont = (WXFont) valReturn.font;
-
- bool oldOpt = GetOptimization();
- SetOptimization(FALSE);
-
+
SetBrush (* wxWHITE_BRUSH);
SetPen (* wxBLACK_PEN);
-
- SetOptimization(oldOpt);
-
}
else
{
strcat (resName, entry.c_str());
XrmPutStringResource (&database, resName, value);
- return TRUE;
+ return true;
}
bool wxWriteResource(const wxString& section, const wxString& entry, float value, const wxString& file)
*value = new char[xvalue.size + 1];
strncpy (*value, xvalue.addr, (int) xvalue.size);
- return TRUE;
+ return true;
}
return FALSE;
}
{
*value = (float)strtod(s, NULL);
delete[] s;
- return TRUE;
+ return true;
}
else return FALSE;
}
{
*value = strtol(s, NULL, 10);
delete[] s;
- return TRUE;
+ return true;
}
else return FALSE;
}
else
*value = (int) strtol (s, NULL, 10);
delete[] s;
- return TRUE;
+ return true;
}
else
return FALSE;
#endif
};
-// Return TRUE if we have a colour display
+// Return true if we have a colour display
bool wxColourDisplay()
{
return wxDisplayDepth() > 1;
{
gs_displayName = display_name;
- if ( display_name.IsEmpty() )
+ if ( display_name.empty() )
{
gs_currentDisplay = NULL;
- return TRUE;
+ return true;
}
else
{
if (display)
{
gs_currentDisplay = (WXDisplay*) display;
- return TRUE;
+ return true;
}
else
return FALSE;
return str;
#else
int type = event.xany.type;
- static char* event_name[] = {
- "", "unknown(-)", // 0-1
- "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", // 2-5
- "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", // 6-9
- "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose", // 10-13
- "NoExpose", "VisibilityNotify", "CreateNotify", // 14-16
- "DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest",// 17-20
- "ReparentNotify", "ConfigureNotify", "ConfigureRequest", // 21-23
- "GravityNotify", "ResizeRequest", "CirculateNotify", // 24-26
- "CirculateRequest", "PropertyNotify", "SelectionClear", // 27-29
- "SelectionRequest", "SelectionNotify", "ColormapNotify", // 30-32
- "ClientMessage", "MappingNotify", // 33-34
- "unknown(+)"}; // 35
- type = wxMin(35, type); type = wxMax(1, type);
- wxString str(event_name[type]);
- return str;
+ static char* event_name[] = {
+ "", "unknown(-)", // 0-1
+ "KeyPress", "KeyRelease", "ButtonPress", "ButtonRelease", // 2-5
+ "MotionNotify", "EnterNotify", "LeaveNotify", "FocusIn", // 6-9
+ "FocusOut", "KeymapNotify", "Expose", "GraphicsExpose", // 10-13
+ "NoExpose", "VisibilityNotify", "CreateNotify", // 14-16
+ "DestroyNotify", "UnmapNotify", "MapNotify", "MapRequest",// 17-20
+ "ReparentNotify", "ConfigureNotify", "ConfigureRequest", // 21-23
+ "GravityNotify", "ResizeRequest", "CirculateNotify", // 24-26
+ "CirculateRequest", "PropertyNotify", "SelectionClear", // 27-29
+ "SelectionRequest", "SelectionNotify", "ColormapNotify", // 30-32
+ "ClientMessage", "MappingNotify", // 33-34
+ "unknown(+)"}; // 35
+ type = wxMin(35, type); type = wxMax(1, type);
+ wxString str(event_name[type]);
+ return str;
#endif
}
#endif
destDC.SelectObject(newBitmap);
wxBrush brush(colour, wxSOLID);
- // destDC.SetOptimization(FALSE);
destDC.SetBackground(brush);
destDC.Clear();
destDC.Blit(0, 0, bitmap.GetWidth(), bitmap.GetHeight(),
- &srcDC, 0, 0, wxCOPY, TRUE);
+ &srcDC, 0, 0, wxCOPY, true);
return newBitmap;
}