wxX11:
Rewrote wxRegion. Killed backing store Pixmap. Killed wxRectList. Adapted wxWindow to the above. git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@14105 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
@@ -13,10 +13,12 @@
|
|||||||
#define _WX_PRIVATE_H_
|
#define _WX_PRIVATE_H_
|
||||||
|
|
||||||
#include "wx/defs.h"
|
#include "wx/defs.h"
|
||||||
|
#include "wx/utils.h"
|
||||||
#include "X11/Xlib.h"
|
#include "X11/Xlib.h"
|
||||||
|
|
||||||
class wxMouseEvent;
|
class wxMouseEvent;
|
||||||
class wxKeyEvent;
|
class wxKeyEvent;
|
||||||
|
class wxWindow;
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// common callbacks
|
// common callbacks
|
||||||
|
@@ -5,7 +5,7 @@
|
|||||||
// Modified by:
|
// Modified by:
|
||||||
// Created: 17/09/98
|
// Created: 17/09/98
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) Julian Smart
|
// Copyright: (c) Julian Smart, Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -20,135 +20,148 @@
|
|||||||
#include "wx/gdiobj.h"
|
#include "wx/gdiobj.h"
|
||||||
#include "wx/gdicmn.h"
|
#include "wx/gdicmn.h"
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
// A list of rectangles type used by wxRegion and wxWindow
|
// classes
|
||||||
// ----------------------------------------------------------------------------
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
WX_DECLARE_LIST(wxRect, wxRectList);
|
class wxRegion;
|
||||||
|
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
// constants
|
||||||
|
//-----------------------------------------------------------------------------
|
||||||
|
|
||||||
enum wxRegionContain {
|
enum wxRegionContain
|
||||||
wxOutRegion = 0, wxPartRegion = 1, wxInRegion = 2
|
{
|
||||||
|
wxOutRegion = 0,
|
||||||
|
wxPartRegion = 1,
|
||||||
|
wxInRegion = 2
|
||||||
};
|
};
|
||||||
|
|
||||||
// So far, for internal use only
|
// So far, for internal use only
|
||||||
enum wxRegionOp {
|
enum wxRegionOp
|
||||||
wxRGN_AND, // Creates the intersection of the two combined regions.
|
{
|
||||||
wxRGN_COPY, // Creates a copy of the region identified by hrgnSrc1.
|
wxRGN_AND, // Creates the intersection of the two combined regions.
|
||||||
wxRGN_DIFF, // Combines the parts of hrgnSrc1 that are not part of hrgnSrc2.
|
wxRGN_COPY, // Creates a copy of the region identified by hrgnSrc1.
|
||||||
wxRGN_OR, // Creates the union of two combined regions.
|
wxRGN_DIFF, // Combines the parts of hrgnSrc1 that are not part of hrgnSrc2.
|
||||||
wxRGN_XOR // Creates the union of two combined regions except for any overlapping areas.
|
wxRGN_OR, // Creates the union of two combined regions.
|
||||||
|
wxRGN_XOR // Creates the union of two combined regions except for any overlapping areas.
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLEXPORT wxRegion : public wxGDIObject {
|
// ----------------------------------------------------------------------------
|
||||||
DECLARE_DYNAMIC_CLASS(wxRegion)
|
// wxRegion
|
||||||
friend class WXDLLEXPORT wxRegionIterator;
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxRegion : public wxGDIObject
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
|
wxRegion() { }
|
||||||
wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight);
|
|
||||||
wxRegion(const wxRect& rect);
|
wxRegion( wxCoord x, wxCoord y, wxCoord w, wxCoord h )
|
||||||
wxRegion();
|
{
|
||||||
|
InitRect(x, y, w, h);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxRegion( const wxPoint& topLeft, const wxPoint& bottomRight )
|
||||||
|
{
|
||||||
|
InitRect(topLeft.x, topLeft.y,
|
||||||
|
bottomRight.x - topLeft.x, bottomRight.y - topLeft.y);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxRegion( const wxRect& rect )
|
||||||
|
{
|
||||||
|
InitRect(rect.x, rect.y, rect.width, rect.height);
|
||||||
|
}
|
||||||
|
|
||||||
|
wxRegion( size_t n, const wxPoint *points, int fillStyle = wxODDEVEN_RULE );
|
||||||
~wxRegion();
|
~wxRegion();
|
||||||
|
|
||||||
//# Copying
|
wxRegion( const wxRegion& region ) { Ref(region); }
|
||||||
inline wxRegion(const wxRegion& r)
|
wxRegion& operator = ( const wxRegion& region ) { Ref(region); return *this; }
|
||||||
{ Ref(r); }
|
|
||||||
inline wxRegion& operator = (const wxRegion& r)
|
bool Ok() const { return m_refData != NULL; }
|
||||||
{ Ref(r); return (*this); }
|
|
||||||
|
bool operator == ( const wxRegion& region );
|
||||||
//# Modify region
|
bool operator != ( const wxRegion& region ) { return !(*this == region); }
|
||||||
// Clear current region
|
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
// Union rectangle or region with this.
|
bool Offset( wxCoord x, wxCoord y );
|
||||||
inline bool Union(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_OR); }
|
|
||||||
inline bool Union(const wxRect& rect) { return Combine(rect, wxRGN_OR); }
|
bool Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
|
||||||
inline bool Union(const wxRegion& region) { return Combine(region, wxRGN_OR); }
|
bool Union( const wxRect& rect );
|
||||||
|
bool Union( const wxRegion& region );
|
||||||
// Intersect rectangle or region with this.
|
|
||||||
inline bool Intersect(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_AND); }
|
bool Intersect( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
|
||||||
inline bool Intersect(const wxRect& rect) { return Combine(rect, wxRGN_AND); }
|
bool Intersect( const wxRect& rect );
|
||||||
inline bool Intersect(const wxRegion& region) { return Combine(region, wxRGN_AND); }
|
bool Intersect( const wxRegion& region );
|
||||||
|
|
||||||
// Subtract rectangle or region from this:
|
bool Subtract( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
|
||||||
// Combines the parts of 'this' that are not part of the second region.
|
bool Subtract( const wxRect& rect );
|
||||||
inline bool Subtract(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_DIFF); }
|
bool Subtract( const wxRegion& region );
|
||||||
inline bool Subtract(const wxRect& rect) { return Combine(rect, wxRGN_DIFF); }
|
|
||||||
inline bool Subtract(const wxRegion& region) { return Combine(region, wxRGN_DIFF); }
|
bool Xor( wxCoord x, wxCoord y, wxCoord width, wxCoord height );
|
||||||
|
bool Xor( const wxRect& rect );
|
||||||
// XOR: the union of two combined regions except for any overlapping areas.
|
bool Xor( const wxRegion& region );
|
||||||
inline bool Xor(wxCoord x, wxCoord y, wxCoord width, wxCoord height) { return Combine(x, y, width, height, wxRGN_XOR); }
|
|
||||||
inline bool Xor(const wxRect& rect) { return Combine(rect, wxRGN_XOR); }
|
void GetBox( wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h ) const;
|
||||||
inline bool Xor(const wxRegion& region) { return Combine(region, wxRGN_XOR); }
|
|
||||||
|
|
||||||
//# Information on region
|
|
||||||
// Outer bounds of region
|
|
||||||
void GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const;
|
|
||||||
wxRect GetBox() const ;
|
wxRect GetBox() const ;
|
||||||
|
|
||||||
// Is region empty?
|
|
||||||
bool Empty() const;
|
bool Empty() const;
|
||||||
inline bool IsEmpty() const { return Empty(); }
|
bool IsEmpty() const { return Empty(); }
|
||||||
bool Ok() const { return (m_refData != NULL) ; }
|
|
||||||
|
wxRegionContain Contains( wxCoord x, wxCoord y ) const;
|
||||||
//# Tests
|
wxRegionContain Contains( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) const;
|
||||||
// Does the region contain the point (x,y)?
|
|
||||||
wxRegionContain Contains(wxCoord x, wxCoord y) const;
|
|
||||||
// Does the region contain the point pt?
|
|
||||||
wxRegionContain Contains(const wxPoint& pt) const;
|
wxRegionContain Contains(const wxPoint& pt) const;
|
||||||
// Does the region contain the rectangle (x, y, w, h)?
|
|
||||||
wxRegionContain Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const;
|
|
||||||
// Does the region contain the rectangle rect?
|
|
||||||
wxRegionContain Contains(const wxRect& rect) const;
|
wxRegionContain Contains(const wxRect& rect) const;
|
||||||
|
|
||||||
|
public:
|
||||||
|
WXRegion *GetX11Region() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
// ref counting code
|
||||||
|
virtual wxObjectRefData *CreateRefData() const;
|
||||||
|
virtual wxObjectRefData *CloneRefData(const wxObjectRefData *data) const;
|
||||||
|
|
||||||
// Internal
|
// common part of ctors for a rectangle region
|
||||||
bool Combine(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxRegionOp op);
|
void InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h);
|
||||||
bool Combine(const wxRegion& region, wxRegionOp op);
|
|
||||||
bool Combine(const wxRect& rect, wxRegionOp op);
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxRegion);
|
||||||
// Get the internal Region handle
|
|
||||||
WXRegion GetXRegion() const;
|
|
||||||
|
|
||||||
// 'Naughty' functions that allow wxWindows to use a list of rects
|
|
||||||
// instead of the region, in certain circumstances (e.g. when
|
|
||||||
// making a region out of the update rectangles).
|
|
||||||
// These are used by wxPaintDC::wxPaintDC and wxRegionIterator::Reset.
|
|
||||||
bool UsingRects() const;
|
|
||||||
wxRect* GetRects();
|
|
||||||
int GetRectCount() const;
|
|
||||||
void SetRects(const wxRectList& rectList);
|
|
||||||
void SetRects(int count, const wxRect* rects);
|
|
||||||
};
|
};
|
||||||
|
|
||||||
class WXDLLEXPORT wxRegionIterator : public wxObject {
|
// ----------------------------------------------------------------------------
|
||||||
DECLARE_DYNAMIC_CLASS(wxRegionIterator)
|
// wxRegionIterator: decomposes a region into rectangles
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
class wxRegionIterator: public wxObject
|
||||||
|
{
|
||||||
public:
|
public:
|
||||||
wxRegionIterator();
|
wxRegionIterator();
|
||||||
wxRegionIterator(const wxRegion& region);
|
wxRegionIterator(const wxRegion& region);
|
||||||
~wxRegionIterator();
|
|
||||||
|
void Reset() { m_current = 0u; }
|
||||||
void Reset() { m_current = 0; }
|
|
||||||
void Reset(const wxRegion& region);
|
void Reset(const wxRegion& region);
|
||||||
|
|
||||||
operator bool () const { return m_current < m_numRects; }
|
operator bool () const;
|
||||||
bool HaveRects() const { return m_current < m_numRects; }
|
bool HaveRects() const;
|
||||||
|
|
||||||
void operator ++ ();
|
void operator ++ ();
|
||||||
void operator ++ (int);
|
void operator ++ (int);
|
||||||
|
|
||||||
wxCoord GetX() const;
|
wxCoord GetX() const;
|
||||||
wxCoord GetY() const;
|
wxCoord GetY() const;
|
||||||
wxCoord GetW() const;
|
wxCoord GetW() const;
|
||||||
wxCoord GetWidth() const { return GetW(); }
|
wxCoord GetWidth() const { return GetW(); }
|
||||||
wxCoord GetH() const;
|
wxCoord GetH() const;
|
||||||
wxCoord GetHeight() const { return GetH(); }
|
wxCoord GetHeight() const { return GetH(); }
|
||||||
wxRect GetRect() const { return wxRect(GetX(), GetY(), GetWidth(), GetHeight()); }
|
wxRect GetRect() const;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
size_t m_current;
|
size_t m_current;
|
||||||
size_t m_numRects;
|
|
||||||
wxRegion m_region;
|
wxRegion m_region;
|
||||||
wxRect* m_rects;
|
|
||||||
|
private:
|
||||||
|
DECLARE_DYNAMIC_CLASS(wxRegionIterator);
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@@ -123,12 +123,6 @@ public:
|
|||||||
WXWindow GetXWindow() const;
|
WXWindow GetXWindow() const;
|
||||||
WXDisplay *GetXDisplay() const;
|
WXDisplay *GetXDisplay() const;
|
||||||
|
|
||||||
// called from Motif callbacks - and should only be called from there
|
|
||||||
|
|
||||||
void SetButton1(bool pressed) { m_button1Pressed = pressed; }
|
|
||||||
void SetButton2(bool pressed) { m_button2Pressed = pressed; }
|
|
||||||
void SetButton3(bool pressed) { m_button3Pressed = pressed; }
|
|
||||||
|
|
||||||
void SetLastClick(int button, long timestamp)
|
void SetLastClick(int button, long timestamp)
|
||||||
{ m_lastButton = button; m_lastTS = timestamp; }
|
{ m_lastButton = button; m_lastTS = timestamp; }
|
||||||
|
|
||||||
@@ -139,25 +133,8 @@ public:
|
|||||||
// arrange status bar, toolbar etc.
|
// arrange status bar, toolbar etc.
|
||||||
virtual bool PreResize();
|
virtual bool PreResize();
|
||||||
|
|
||||||
// Generates a paint event
|
// Generates paint events
|
||||||
virtual void DoPaint();
|
void X11SendPaintEvents();
|
||||||
|
|
||||||
// update rectangle/region manipulation
|
|
||||||
// (for wxWindowDC and Motif callbacks only)
|
|
||||||
// -----------------------------------------
|
|
||||||
|
|
||||||
// read/write access to the update rect list
|
|
||||||
const wxRectList& GetUpdateRects() const { return m_updateRects; }
|
|
||||||
|
|
||||||
// Adds a recangle to the updates list
|
|
||||||
void AddUpdateRect(int x, int y, int w, int h)
|
|
||||||
{ m_updateRects.Append(new wxRect(x, y, w, h)); }
|
|
||||||
|
|
||||||
// Empties the m_updateRects list
|
|
||||||
void ClearUpdateRects();
|
|
||||||
|
|
||||||
void ClearUpdateRegion() { m_updateRegion.Clear(); }
|
|
||||||
void SetUpdateRegion(const wxRegion& region) { m_updateRegion = region; }
|
|
||||||
|
|
||||||
// sets the fore/background colour for the given widget
|
// sets the fore/background colour for the given widget
|
||||||
static void DoChangeForegroundColour(WXWindow widget, wxColour& foregroundColour);
|
static void DoChangeForegroundColour(WXWindow widget, wxColour& foregroundColour);
|
||||||
@@ -187,13 +164,6 @@ protected:
|
|||||||
void SetCanAddEventHandler(bool flag) { m_canAddEventHandler = flag; }
|
void SetCanAddEventHandler(bool flag) { m_canAddEventHandler = flag; }
|
||||||
|
|
||||||
public:
|
public:
|
||||||
WXPixmap GetBackingPixmap() const { return m_backingPixmap; }
|
|
||||||
void SetBackingPixmap(WXPixmap pixmap) { m_backingPixmap = pixmap; }
|
|
||||||
int GetPixmapWidth() const { return m_pixmapWidth; }
|
|
||||||
int GetPixmapHeight() const { return m_pixmapHeight; }
|
|
||||||
void SetPixmapWidth(int w) { m_pixmapWidth = w; }
|
|
||||||
void SetPixmapHeight(int h) { m_pixmapHeight = h; }
|
|
||||||
|
|
||||||
// Change properties
|
// Change properties
|
||||||
virtual void ChangeFont(bool keepOriginalSize = TRUE); // Change to the current font (often overridden)
|
virtual void ChangeFont(bool keepOriginalSize = TRUE); // Change to the current font (often overridden)
|
||||||
|
|
||||||
@@ -245,19 +215,17 @@ protected:
|
|||||||
|
|
||||||
bool m_needsRefresh:1; // repaint backing store?
|
bool m_needsRefresh:1; // repaint backing store?
|
||||||
bool m_canAddEventHandler:1; // ???
|
bool m_canAddEventHandler:1; // ???
|
||||||
bool m_button1Pressed:1;
|
|
||||||
bool m_button2Pressed:1;
|
|
||||||
bool m_button3Pressed:1;
|
|
||||||
|
|
||||||
// For double-click detection
|
// For double-click detection
|
||||||
long m_lastTS; // last timestamp
|
long m_lastTS; // last timestamp
|
||||||
int m_lastButton; // last pressed button
|
int m_lastButton; // last pressed button
|
||||||
|
|
||||||
// List of wxRects representing damaged region
|
|
||||||
wxRectList m_updateRects;
|
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
WXWindow m_mainWidget;
|
WXWindow m_mainWidget;
|
||||||
|
|
||||||
|
wxRegion m_clearRegion;
|
||||||
|
bool m_clipPaintRegion;
|
||||||
|
|
||||||
WXWindow m_hScrollBar;
|
WXWindow m_hScrollBar;
|
||||||
WXWindow m_vScrollBar;
|
WXWindow m_vScrollBar;
|
||||||
WXWindow m_borderWidget;
|
WXWindow m_borderWidget;
|
||||||
@@ -266,11 +234,6 @@ protected:
|
|||||||
bool m_winCaptured;
|
bool m_winCaptured;
|
||||||
bool m_hScroll;
|
bool m_hScroll;
|
||||||
bool m_vScroll;
|
bool m_vScroll;
|
||||||
WXPixmap m_backingPixmap;
|
|
||||||
int m_pixmapWidth;
|
|
||||||
int m_pixmapHeight;
|
|
||||||
int m_pixmapOffsetX;
|
|
||||||
int m_pixmapOffsetY;
|
|
||||||
|
|
||||||
// Store the last scroll pos, since in wxWin the pos isn't set automatically
|
// Store the last scroll pos, since in wxWin the pos isn't set automatically
|
||||||
// by system
|
// by system
|
||||||
|
@@ -402,13 +402,11 @@ void wxApp::ProcessXEvent(WXEvent* _event)
|
|||||||
{
|
{
|
||||||
if (win)
|
if (win)
|
||||||
{
|
{
|
||||||
win->AddUpdateRect(event->xexpose.x, event->xexpose.y,
|
win->GetUpdateRegion().Union( event->xexpose.x, event->xexpose.y,
|
||||||
event->xexpose.width, event->xexpose.height);
|
event->xexpose.width, event->xexpose.height);
|
||||||
|
if (event->xexpose.count == 0)
|
||||||
if (event -> xexpose.count == 0)
|
|
||||||
{
|
{
|
||||||
win->DoPaint();
|
win->X11SendPaintEvents(); // TODO let an idle handler do that
|
||||||
win->ClearUpdateRects();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -186,14 +186,6 @@ wxWindowDC::wxWindowDC( wxWindow *window )
|
|||||||
GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode,
|
GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode,
|
||||||
&gcvalues);
|
&gcvalues);
|
||||||
|
|
||||||
if (m_window->GetBackingPixmap())
|
|
||||||
{
|
|
||||||
m_gcBacking = (WXGC) XCreateGC (display, RootWindow (display,
|
|
||||||
DefaultScreen (display)),
|
|
||||||
GCForeground | GCBackground | GCGraphicsExposures | GCLineWidth | GCSubwindowMode,
|
|
||||||
&gcvalues);
|
|
||||||
}
|
|
||||||
|
|
||||||
m_backgroundPixel = (int) gcvalues.background;
|
m_backgroundPixel = (int) gcvalues.background;
|
||||||
|
|
||||||
// Get the current Font so we can set it back later
|
// Get the current Font so we can set it back later
|
||||||
@@ -209,9 +201,6 @@ wxWindowDC::~wxWindowDC()
|
|||||||
if (m_gc && (m_oldFont != (WXFont) 0) && ((long) m_oldFont != -1))
|
if (m_gc && (m_oldFont != (WXFont) 0) && ((long) m_oldFont != -1))
|
||||||
{
|
{
|
||||||
XSetFont ((Display*) m_display, (GC) m_gc, (Font) m_oldFont);
|
XSetFont ((Display*) m_display, (GC) m_gc, (Font) m_oldFont);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetFont ((Display*) m_display,(GC) m_gcBacking, (Font) m_oldFont);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_gc)
|
if (m_gc)
|
||||||
@@ -269,11 +258,6 @@ void wxWindowDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
|
|||||||
|
|
||||||
XDrawLine ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, x1d, y1d, x2d, y2d);
|
XDrawLine ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, x1d, y1d, x2d, y2d);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XDrawLine ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking,
|
|
||||||
XLOG2DEV_2(x1), YLOG2DEV_2(y1),
|
|
||||||
XLOG2DEV_2(x2), YLOG2DEV_2(y2));
|
|
||||||
|
|
||||||
CalcBoundingBox(x1, y1);
|
CalcBoundingBox(x1, y1);
|
||||||
CalcBoundingBox(x2, y2);
|
CalcBoundingBox(x2, y2);
|
||||||
}
|
}
|
||||||
@@ -293,18 +277,6 @@ void wxWindowDC::DoCrossHair( wxCoord x, wxCoord y )
|
|||||||
ww, yy);
|
ww, yy);
|
||||||
XDrawLine ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xx, 0,
|
XDrawLine ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xx, 0,
|
||||||
xx, hh);
|
xx, hh);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
{
|
|
||||||
xx = XLOG2DEV_2 (x);
|
|
||||||
yy = YLOG2DEV_2 (y);
|
|
||||||
XDrawLine ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking,
|
|
||||||
0, yy,
|
|
||||||
ww, yy);
|
|
||||||
XDrawLine ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking,
|
|
||||||
xx, 0,
|
|
||||||
xx, hh);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc )
|
void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCoord xc, wxCoord yc )
|
||||||
@@ -369,10 +341,6 @@ void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCo
|
|||||||
XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) (GC) m_gc,
|
XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) (GC) m_gc,
|
||||||
xxc - r, yyc - r, 2 * r, 2 * r, alpha1, alpha2);
|
xxc - r, yyc - r, 2 * r, 2 * r, alpha1, alpha2);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking,
|
|
||||||
xxc_2 - r, yyc_2 - r, 2 * r, 2 * r, alpha1, alpha2);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
|
if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
|
||||||
@@ -381,10 +349,6 @@ void wxWindowDC::DoDrawArc( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2, wxCo
|
|||||||
SetPen (m_pen);
|
SetPen (m_pen);
|
||||||
XDrawArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc,
|
XDrawArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc,
|
||||||
xxc - r, yyc - r, 2 * r, 2 * r, alpha1, alpha2);
|
xxc - r, yyc - r, 2 * r, 2 * r, alpha1, alpha2);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking,
|
|
||||||
xxc_2 - r, yyc_2 - r, 2 * r, 2 * r, alpha1, alpha2);
|
|
||||||
}
|
}
|
||||||
CalcBoundingBox (x1, y1);
|
CalcBoundingBox (x1, y1);
|
||||||
CalcBoundingBox (x2, y2);
|
CalcBoundingBox (x2, y2);
|
||||||
@@ -416,10 +380,6 @@ void wxWindowDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord
|
|||||||
|
|
||||||
SetBrush (m_brush);
|
SetBrush (m_brush);
|
||||||
XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd, start, end);
|
XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd, start, end);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking,
|
|
||||||
XLOG2DEV_2 (x), YLOG2DEV_2 (y),wd,hd,start,end);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
|
if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
|
||||||
@@ -427,10 +387,8 @@ void wxWindowDC::DoDrawEllipticArc( wxCoord x, wxCoord y, wxCoord width, wxCoord
|
|||||||
if (m_autoSetting)
|
if (m_autoSetting)
|
||||||
SetPen (m_pen);
|
SetPen (m_pen);
|
||||||
XDrawArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd, start,end);
|
XDrawArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd, start,end);
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking,
|
|
||||||
XLOG2DEV_2 (x), YLOG2DEV_2 (y),wd,hd,start,end);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CalcBoundingBox (x, y);
|
CalcBoundingBox (x, y);
|
||||||
CalcBoundingBox (x + width, y + height);
|
CalcBoundingBox (x + width, y + height);
|
||||||
}
|
}
|
||||||
@@ -445,9 +403,7 @@ void wxWindowDC::DoDrawPoint( wxCoord x, wxCoord y )
|
|||||||
SetPen (m_pen);
|
SetPen (m_pen);
|
||||||
|
|
||||||
XDrawPoint ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, XLOG2DEV (x), YLOG2DEV (y));
|
XDrawPoint ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, XLOG2DEV (x), YLOG2DEV (y));
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XDrawPoint ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, XLOG2DEV_2 (x), YLOG2DEV_2 (y));
|
|
||||||
|
|
||||||
CalcBoundingBox (x, y);
|
CalcBoundingBox (x, y);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -472,15 +428,6 @@ void wxWindowDC::DoDrawLines( int n, wxPoint points[], wxCoord xoffset, wxCoord
|
|||||||
}
|
}
|
||||||
XDrawLines ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints, n, 0);
|
XDrawLines ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints, n, 0);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
{
|
|
||||||
for (i = 0; i < n; i++)
|
|
||||||
{
|
|
||||||
xpoints[i].x = XLOG2DEV_2 (points[i].x + xoffset);
|
|
||||||
xpoints[i].y = YLOG2DEV_2 (points[i].y + yoffset);
|
|
||||||
}
|
|
||||||
XDrawLines ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, xpoints, n, 0);
|
|
||||||
}
|
|
||||||
delete[]xpoints;
|
delete[]xpoints;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -516,13 +463,6 @@ void wxWindowDC::DoDrawPolygon( int n, wxPoint points[],
|
|||||||
XSetFillRule ((Display*) m_display, (GC) m_gc, fillStyle == wxODDEVEN_RULE ? EvenOddRule : WindingRule);
|
XSetFillRule ((Display*) m_display, (GC) m_gc, fillStyle == wxODDEVEN_RULE ? EvenOddRule : WindingRule);
|
||||||
XFillPolygon ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints1, n, Complex, 0);
|
XFillPolygon ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints1, n, Complex, 0);
|
||||||
XSetFillRule ((Display*) m_display, (GC) m_gc, EvenOddRule); // default mode
|
XSetFillRule ((Display*) m_display, (GC) m_gc, EvenOddRule); // default mode
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
{
|
|
||||||
XSetFillRule ((Display*) m_display,(GC) m_gcBacking,
|
|
||||||
fillStyle == wxODDEVEN_RULE ? EvenOddRule : WindingRule);
|
|
||||||
XFillPolygon ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, xpoints2, n, Complex, 0);
|
|
||||||
XSetFillRule ((Display*) m_display,(GC) m_gcBacking, EvenOddRule); // default mode
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
|
if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
|
||||||
@@ -530,9 +470,6 @@ void wxWindowDC::DoDrawPolygon( int n, wxPoint points[],
|
|||||||
if (m_autoSetting)
|
if (m_autoSetting)
|
||||||
SetPen (m_pen);
|
SetPen (m_pen);
|
||||||
XDrawLines ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints1, n + 1, 0);
|
XDrawLines ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xpoints1, n + 1, 0);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XDrawLines ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, xpoints2, n + 1, 0);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
delete[]xpoints1;
|
delete[]xpoints1;
|
||||||
@@ -562,11 +499,6 @@ void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord h
|
|||||||
{
|
{
|
||||||
SetBrush (m_brush);
|
SetBrush (m_brush);
|
||||||
XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wfd, hfd);
|
XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wfd, hfd);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
XLOG2DEV_2 (x), YLOG2DEV_2 (y),
|
|
||||||
wfd, hfd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
|
if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
|
||||||
@@ -574,12 +506,8 @@ void wxWindowDC::DoDrawRectangle( wxCoord x, wxCoord y, wxCoord width, wxCoord h
|
|||||||
if (m_autoSetting)
|
if (m_autoSetting)
|
||||||
SetPen (m_pen);
|
SetPen (m_pen);
|
||||||
XDrawRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd);
|
XDrawRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XDrawRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
XLOG2DEV_2 (x), YLOG2DEV_2 (y),
|
|
||||||
wd, hd);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
CalcBoundingBox (x, y);
|
CalcBoundingBox (x, y);
|
||||||
CalcBoundingBox (x + width, y + height);
|
CalcBoundingBox (x + width, y + height);
|
||||||
}
|
}
|
||||||
@@ -663,29 +591,6 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx
|
|||||||
// Bottom-left
|
// Bottom-left
|
||||||
XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd + hd - rh_d,
|
XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd + hd - rh_d,
|
||||||
rw_d, rh_d, 180 * 64, 90 * 64);
|
rw_d, rh_d, 180 * 64, 90 * 64);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
{
|
|
||||||
XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
xd2 + rd2, yd2, wd2 - rw_d2, hd2);
|
|
||||||
XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
xd2, yd2 + rd2, wd2, hd2 - rh_d2);
|
|
||||||
|
|
||||||
XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
xd2, yd2, rw_d2, rh_d2, 90 * 64, 90 * 64);
|
|
||||||
XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
xd2 + wd2 - rw_d2, yd2,
|
|
||||||
// rw_d2, rh_d2, 0, 90 * 64);
|
|
||||||
rw_d2, rh_d2, 0, 91 * 64);
|
|
||||||
XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
xd2 + wd2 - rw_d2,
|
|
||||||
yd2 + hd2 - rh_d2,
|
|
||||||
// rw_d2, rh_d2, 270 * 64, 90 * 64);
|
|
||||||
rw_d2, rh_d2, 269 * 64, 92 * 64);
|
|
||||||
XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
xd2, yd2 + hd2 - rh_d2,
|
|
||||||
rw_d2, rh_d2, 180 * 64, 90 * 64);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
|
if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
|
||||||
@@ -710,37 +615,6 @@ void wxWindowDC::DoDrawRoundedRectangle( wxCoord x, wxCoord y, wxCoord width, wx
|
|||||||
rw_d, rh_d, 269 * 64, 92 * 64);
|
rw_d, rh_d, 269 * 64, 92 * 64);
|
||||||
XDrawArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd + hd - rh_d,
|
XDrawArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd + hd - rh_d,
|
||||||
rw_d, rh_d, 180 * 64, 90 * 64);
|
rw_d, rh_d, 180 * 64, 90 * 64);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
{
|
|
||||||
XDrawLine ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
xd2 + rd2, yd2,
|
|
||||||
xd2 + wd2 - rd2 + 1, yd2);
|
|
||||||
XDrawLine ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
xd2 + rd2, yd2 + hd2,
|
|
||||||
xd2 + wd2 - rd2, yd2 + hd2);
|
|
||||||
|
|
||||||
XDrawLine ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
xd2, yd2 + rd2,
|
|
||||||
xd2, yd2 + hd2 - rd2);
|
|
||||||
XDrawLine ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
xd2 + wd2, yd2 + rd2,
|
|
||||||
xd2 + wd2, yd2 + hd2 - rd2 + 1);
|
|
||||||
XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
xd2, yd2,
|
|
||||||
rw_d2, rh_d2, 90 * 64, 90 * 64);
|
|
||||||
XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
xd2 + wd2 - rw_d2, yd2,
|
|
||||||
// rw_d2, rh_d2, 0, 90 * 64);
|
|
||||||
rw_d2, rh_d2, 0, 91 * 64);
|
|
||||||
XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
xd2 + wd2 - rw_d2,
|
|
||||||
yd2 + hd2 - rh_d2,
|
|
||||||
rw_d2, rh_d2, 269 * 64, 92 * 64);
|
|
||||||
XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
xd2, yd2 + hd2 - rh_d2,
|
|
||||||
rw_d2, rh_d2, 180 * 64, 90 * 64);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
CalcBoundingBox (x, y);
|
CalcBoundingBox (x, y);
|
||||||
CalcBoundingBox (x + width, y + height);
|
CalcBoundingBox (x + width, y + height);
|
||||||
@@ -780,11 +654,6 @@ void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
|
|||||||
{
|
{
|
||||||
SetBrush (m_brush);
|
SetBrush (m_brush);
|
||||||
XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd, 0, angle);
|
XFillArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd, 0, angle);
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XFillArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
XLOG2DEV_2 (x), YLOG2DEV_2 (y),
|
|
||||||
XLOG2DEVREL (width) - WX_GC_CF,
|
|
||||||
YLOG2DEVREL (height) - WX_GC_CF, 0, angle);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
|
if (m_pen.Ok() && m_pen.GetStyle () != wxTRANSPARENT)
|
||||||
@@ -792,11 +661,6 @@ void wxWindowDC::DoDrawEllipse( wxCoord x, wxCoord y, wxCoord width, wxCoord hei
|
|||||||
if (m_autoSetting)
|
if (m_autoSetting)
|
||||||
SetPen (m_pen);
|
SetPen (m_pen);
|
||||||
XDrawArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd, 0, angle);
|
XDrawArc ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, xd, yd, wd, hd, 0, angle);
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XDrawArc ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
XLOG2DEV_2 (x), YLOG2DEV_2 (y),
|
|
||||||
XLOG2DEVREL (width) - WX_GC_CF,
|
|
||||||
YLOG2DEVREL (height) - WX_GC_CF, 0, angle);
|
|
||||||
}
|
}
|
||||||
CalcBoundingBox (x, y);
|
CalcBoundingBox (x, y);
|
||||||
CalcBoundingBox (x + width, y + height);
|
CalcBoundingBox (x + width, y + height);
|
||||||
@@ -840,21 +704,6 @@ void wxWindowDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y)
|
|||||||
0, 0, width, height,
|
0, 0, width, height,
|
||||||
(int) XLOG2DEV (x), (int) YLOG2DEV (y));
|
(int) XLOG2DEV (x), (int) YLOG2DEV (y));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
{
|
|
||||||
if (icon.GetDepth() <= 1)
|
|
||||||
{
|
|
||||||
XCopyPlane ((Display*) m_display, iconPixmap, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
0, 0, width, height, (int) XLOG2DEV_2 (x), (int) YLOG2DEV_2 (y), 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
XCopyArea ((Display*) m_display, iconPixmap, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
0, 0, width, height,
|
|
||||||
(int) XLOG2DEV_2 (x), (int) YLOG2DEV_2 (y));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
} else { /* Remote copy (different (Display*) m_displays) */
|
} else { /* Remote copy (different (Display*) m_displays) */
|
||||||
XImage *cache = NULL;
|
XImage *cache = NULL;
|
||||||
@@ -939,6 +788,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
|
|||||||
{
|
{
|
||||||
XImage *cache = NULL;
|
XImage *cache = NULL;
|
||||||
|
|
||||||
|
#if 0
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
if (m_window && m_window->GetBackingPixmap())
|
||||||
XCopyRemote((Display*) sourceDC->m_display, (Display*) m_display,
|
XCopyRemote((Display*) sourceDC->m_display, (Display*) m_display,
|
||||||
(Pixmap) sourcePixmap, (Pixmap) m_window->GetBackingPixmap(),
|
(Pixmap) sourcePixmap, (Pixmap) m_window->GetBackingPixmap(),
|
||||||
@@ -949,6 +799,7 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
|
|||||||
source->LogicalToDeviceYRel(height),
|
source->LogicalToDeviceYRel(height),
|
||||||
XLOG2DEV_2 (xdest), YLOG2DEV_2 (ydest),
|
XLOG2DEV_2 (xdest), YLOG2DEV_2 (ydest),
|
||||||
TRUE, &cache);
|
TRUE, &cache);
|
||||||
|
#endif
|
||||||
|
|
||||||
if ( useMask && source->IsKindOf(CLASSINFO(wxMemoryDC)) )
|
if ( useMask && source->IsKindOf(CLASSINFO(wxMemoryDC)) )
|
||||||
{
|
{
|
||||||
@@ -977,28 +828,6 @@ bool wxWindowDC::DoBlit( wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord he
|
|||||||
|
|
||||||
} else
|
} else
|
||||||
{
|
{
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
{
|
|
||||||
// +++ MARKUS (mho@comnets.rwth-aachen): error on blitting bitmaps with depth 1
|
|
||||||
if (source->IsKindOf(CLASSINFO(wxMemoryDC)) && ((wxMemoryDC*) source)->GetBitmap().GetDepth() == 1)
|
|
||||||
{
|
|
||||||
XCopyPlane ((Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
source->LogicalToDeviceX (xsrc),
|
|
||||||
source->LogicalToDeviceY (ysrc),
|
|
||||||
source->LogicalToDeviceXRel(width),
|
|
||||||
source->LogicalToDeviceYRel(height),
|
|
||||||
XLOG2DEV_2 (xdest), YLOG2DEV_2 (ydest), 1);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
XCopyArea ((Display*) m_display, (Pixmap) sourcePixmap, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
source->LogicalToDeviceX (xsrc),
|
|
||||||
source->LogicalToDeviceY (ysrc),
|
|
||||||
source->LogicalToDeviceXRel(width),
|
|
||||||
source->LogicalToDeviceYRel(height),
|
|
||||||
XLOG2DEV_2 (xdest), YLOG2DEV_2 (ydest));
|
|
||||||
}
|
|
||||||
}
|
|
||||||
if ( useMask && source->IsKindOf(CLASSINFO(wxMemoryDC)) )
|
if ( useMask && source->IsKindOf(CLASSINFO(wxMemoryDC)) )
|
||||||
{
|
{
|
||||||
wxMemoryDC *memDC = (wxMemoryDC *)source;
|
wxMemoryDC *memDC = (wxMemoryDC *)source;
|
||||||
@@ -1107,17 +936,12 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
|||||||
if (pixel > -1)
|
if (pixel > -1)
|
||||||
{
|
{
|
||||||
XSetForeground ((Display*) m_display, (GC) m_gc, pixel);
|
XSetForeground ((Display*) m_display, (GC) m_gc, pixel);
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetForeground ((Display*) m_display,(GC) m_gcBacking, pixel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_textBackgroundColour = oldPenColour ;
|
m_textBackgroundColour = oldPenColour ;
|
||||||
|
|
||||||
XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, XLOG2DEV (x), YLOG2DEV (y), cx, cy);
|
XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, XLOG2DEV (x), YLOG2DEV (y), cx, cy);
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
XLOG2DEV_2 (x), YLOG2DEV_2 (y), cx, cy);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Now set the text foreground and draw the text
|
// Now set the text foreground and draw the text
|
||||||
@@ -1166,8 +990,6 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
|||||||
if (pixel > -1)
|
if (pixel > -1)
|
||||||
{
|
{
|
||||||
XSetForeground ((Display*) m_display, (GC) m_gc, pixel);
|
XSetForeground ((Display*) m_display, (GC) m_gc, pixel);
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetForeground ((Display*) m_display,(GC) m_gcBacking, pixel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1184,18 +1006,6 @@ void wxWindowDC::DoDrawText( const wxString &text, wxCoord x, wxCoord y )
|
|||||||
#endif // 0
|
#endif // 0
|
||||||
XDrawString((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, XLOG2DEV (x), YLOG2DEV (y) + ascent, text, slen);
|
XDrawString((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, XLOG2DEV (x), YLOG2DEV (y) + ascent, text, slen);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap()) {
|
|
||||||
#if 0
|
|
||||||
if (use16)
|
|
||||||
XDrawString16((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking,
|
|
||||||
XLOG2DEV_2 (x), YLOG2DEV_2 (y) + ascent,
|
|
||||||
(XChar2b *)(char*) (const char*) text, slen);
|
|
||||||
else
|
|
||||||
#endif // 0
|
|
||||||
XDrawString((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(), (GC) m_gcBacking,
|
|
||||||
XLOG2DEV_2 (x), YLOG2DEV_2 (y) + ascent, (char*) (const char*) text, slen);
|
|
||||||
}
|
|
||||||
|
|
||||||
wxCoord w, h;
|
wxCoord w, h;
|
||||||
GetTextExtent (text, &w, &h);
|
GetTextExtent (text, &w, &h);
|
||||||
CalcBoundingBox (x + w, y + h);
|
CalcBoundingBox (x + w, y + h);
|
||||||
@@ -1319,17 +1129,12 @@ void wxWindowDC::DoDrawRotatedText( const wxString &text, wxCoord x, wxCoord y,
|
|||||||
if (pixel > -1)
|
if (pixel > -1)
|
||||||
{
|
{
|
||||||
XSetForeground ((Display*) m_display, (GC) m_gc, pixel);
|
XSetForeground ((Display*) m_display, (GC) m_gc, pixel);
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetForeground ((Display*) m_display,(GC) m_gcBacking, pixel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
m_textBackgroundColour = oldPenColour ;
|
m_textBackgroundColour = oldPenColour ;
|
||||||
|
|
||||||
XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, XLOG2DEV (x), YLOG2DEV (y), cx, cy);
|
XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, XLOG2DEV (x), YLOG2DEV (y), cx, cy);
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking,
|
|
||||||
XLOG2DEV_2 (x), YLOG2DEV_2 (y), cx, cy);
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@@ -1432,12 +1237,6 @@ void wxWindowDC::Clear()
|
|||||||
if (m_window)
|
if (m_window)
|
||||||
{
|
{
|
||||||
m_window->GetSize(&w, &h);
|
m_window->GetSize(&w, &h);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
{
|
|
||||||
w = m_window->GetPixmapWidth();
|
|
||||||
h = m_window->GetPixmapHeight();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@@ -1456,9 +1255,6 @@ void wxWindowDC::Clear()
|
|||||||
|
|
||||||
XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, 0, 0, w, h);
|
XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, 0, 0, w, h);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, 0, 0, w, h);
|
|
||||||
|
|
||||||
m_brush = saveBrush;
|
m_brush = saveBrush;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1474,9 +1270,6 @@ void wxWindowDC::Clear(const wxRect& rect)
|
|||||||
|
|
||||||
XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, x, y, w, h);
|
XFillRectangle ((Display*) m_display, (Pixmap) m_pixmap, (GC) m_gc, x, y, w, h);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XFillRectangle ((Display*) m_display, (Pixmap) m_window->GetBackingPixmap(),(GC) m_gcBacking, x, y, w, h);
|
|
||||||
|
|
||||||
m_brush = saveBrush;
|
m_brush = saveBrush;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1491,9 +1284,6 @@ void wxWindowDC::SetFont( const wxFont &font )
|
|||||||
if ((m_oldFont != (WXFont) 0) && ((wxCoord) m_oldFont != -1))
|
if ((m_oldFont != (WXFont) 0) && ((wxCoord) m_oldFont != -1))
|
||||||
{
|
{
|
||||||
XSetFont ((Display*) m_display, (GC) m_gc, (Font) m_oldFont);
|
XSetFont ((Display*) m_display, (GC) m_gc, (Font) m_oldFont);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetFont ((Display*) m_display,(GC) m_gcBacking, (Font) m_oldFont);
|
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -1502,9 +1292,6 @@ void wxWindowDC::SetFont( const wxFont &font )
|
|||||||
|
|
||||||
Font fontId = ((XFontStruct*)pFontStruct)->fid;
|
Font fontId = ((XFontStruct*)pFontStruct)->fid;
|
||||||
XSetFont ((Display*) m_display, (GC) m_gc, fontId);
|
XSetFont ((Display*) m_display, (GC) m_gc, fontId);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetFont ((Display*) m_display,(GC) m_gcBacking, fontId);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::SetPen( const wxPen &pen )
|
void wxWindowDC::SetPen( const wxPen &pen )
|
||||||
@@ -1615,18 +1402,12 @@ void wxWindowDC::SetPen( const wxPen &pen )
|
|||||||
for (int i = 0; i < req_nb_dash; i++)
|
for (int i = 0; i < req_nb_dash; i++)
|
||||||
real_req_dash[i] = req_dash[i] * factor;
|
real_req_dash[i] = req_dash[i] * factor;
|
||||||
XSetDashes ((Display*) m_display, (GC) m_gc, 0, real_req_dash, req_nb_dash);
|
XSetDashes ((Display*) m_display, (GC) m_gc, 0, real_req_dash, req_nb_dash);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetDashes ((Display*) m_display,(GC) m_gcBacking, 0, real_req_dash, req_nb_dash);
|
|
||||||
delete[]real_req_dash;
|
delete[]real_req_dash;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// No Memory. We use non-scaled dash pattern...
|
// No Memory. We use non-scaled dash pattern...
|
||||||
XSetDashes ((Display*) m_display, (GC) m_gc, 0, req_dash, req_nb_dash);
|
XSetDashes ((Display*) m_display, (GC) m_gc, 0, req_dash, req_nb_dash);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetDashes ((Display*) m_display,(GC) m_gcBacking, 0, req_dash, req_nb_dash);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1659,9 +1440,6 @@ void wxWindowDC::SetPen( const wxPen &pen )
|
|||||||
}
|
}
|
||||||
|
|
||||||
XSetLineAttributes ((Display*) m_display, (GC) m_gc, scaled_width, style, cap, join);
|
XSetLineAttributes ((Display*) m_display, (GC) m_gc, scaled_width, style, cap, join);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
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) || !GetOptimization()))
|
||||||
@@ -1717,17 +1495,11 @@ void wxWindowDC::SetPen( const wxPen &pen )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
XSetStipple ((Display*) m_display, (GC) m_gc, myStipple);
|
XSetStipple ((Display*) m_display, (GC) m_gc, myStipple);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetStipple ((Display*) m_display,(GC) m_gcBacking, myStipple);
|
|
||||||
}
|
}
|
||||||
else if (m_currentStipple.Ok()
|
else if (m_currentStipple.Ok()
|
||||||
&& ((m_currentStipple != oldStipple) || !GetOptimization()))
|
&& ((m_currentStipple != oldStipple) || !GetOptimization()))
|
||||||
{
|
{
|
||||||
XSetStipple ((Display*) m_display, (GC) m_gc, (Pixmap) m_currentStipple.GetPixmap());
|
XSetStipple ((Display*) m_display, (GC) m_gc, (Pixmap) m_currentStipple.GetPixmap());
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetStipple ((Display*) m_display,(GC) m_gcBacking, (Pixmap) m_currentStipple.GetPixmap());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((m_currentFill != oldFill) || !GetOptimization())
|
if ((m_currentFill != oldFill) || !GetOptimization())
|
||||||
@@ -1741,8 +1513,6 @@ void wxWindowDC::SetPen( const wxPen &pen )
|
|||||||
else
|
else
|
||||||
fill_style = FillSolid;
|
fill_style = FillSolid;
|
||||||
XSetFillStyle ((Display*) m_display, (GC) m_gc, fill_style);
|
XSetFillStyle ((Display*) m_display, (GC) m_gc, fill_style);
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetFillStyle ((Display*) m_display,(GC) m_gcBacking, fill_style);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// must test m_logicalFunction, because it involves background!
|
// must test m_logicalFunction, because it involves background!
|
||||||
@@ -1786,14 +1556,10 @@ void wxWindowDC::SetPen( const wxPen &pen )
|
|||||||
XGCValues values;
|
XGCValues values;
|
||||||
XGetGCValues ((Display*) m_display, (GC) m_gc, GCBackground, &values);
|
XGetGCValues ((Display*) m_display, (GC) m_gc, GCBackground, &values);
|
||||||
XSetForeground ((Display*) m_display, (GC) m_gc, pixel ^ values.background);
|
XSetForeground ((Display*) m_display, (GC) m_gc, pixel ^ values.background);
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetForeground ((Display*) m_display,(GC) m_gcBacking, pixel ^ values.background);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
XSetForeground ((Display*) m_display, (GC) m_gc, pixel);
|
XSetForeground ((Display*) m_display, (GC) m_gc, pixel);
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetForeground ((Display*) m_display,(GC) m_gcBacking, pixel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1848,15 +1614,11 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
|
|||||||
// fill style should be solid or transparent
|
// fill style should be solid or transparent
|
||||||
int style = (m_backgroundMode == wxSOLID ? FillOpaqueStippled : FillStippled);
|
int style = (m_backgroundMode == wxSOLID ? FillOpaqueStippled : FillStippled);
|
||||||
XSetFillStyle ((Display*) m_display, (GC) m_gc, style);
|
XSetFillStyle ((Display*) m_display, (GC) m_gc, style);
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetFillStyle ((Display*) m_display,(GC) m_gcBacking, style);
|
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
case wxSOLID:
|
case wxSOLID:
|
||||||
default:
|
default:
|
||||||
XSetFillStyle ((Display*) m_display, (GC) m_gc, FillSolid);
|
XSetFillStyle ((Display*) m_display, (GC) m_gc, FillSolid);
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetFillStyle ((Display*) m_display,(GC) m_gcBacking, FillSolid);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1911,17 +1673,12 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
XSetStipple ((Display*) m_display, (GC) m_gc, myStipple);
|
XSetStipple ((Display*) m_display, (GC) m_gc, myStipple);
|
||||||
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetStipple ((Display*) m_display,(GC) m_gcBacking, myStipple);
|
|
||||||
}
|
}
|
||||||
// X can forget the stipple value when resizing a window (apparently)
|
// X can forget the stipple value when resizing a window (apparently)
|
||||||
// so always set the stipple.
|
// so always set the stipple.
|
||||||
else if (m_currentStipple.Ok()) // && m_currentStipple != oldStipple)
|
else if (m_currentStipple.Ok()) // && m_currentStipple != oldStipple)
|
||||||
{
|
{
|
||||||
XSetStipple ((Display*) m_display, (GC) m_gc, (Pixmap) m_currentStipple.GetPixmap());
|
XSetStipple ((Display*) m_display, (GC) m_gc, (Pixmap) m_currentStipple.GetPixmap());
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetStipple ((Display*) m_display,(GC) m_gcBacking, (Pixmap) m_currentStipple.GetPixmap());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// must test m_logicalFunction, because it involves background!
|
// must test m_logicalFunction, because it involves background!
|
||||||
@@ -1975,14 +1732,10 @@ void wxWindowDC::SetBrush( const wxBrush &brush )
|
|||||||
XGCValues values;
|
XGCValues values;
|
||||||
XGetGCValues ((Display*) m_display, (GC) m_gc, GCBackground, &values);
|
XGetGCValues ((Display*) m_display, (GC) m_gc, GCBackground, &values);
|
||||||
XSetForeground ((Display*) m_display, (GC) m_gc, pixel ^ values.background);
|
XSetForeground ((Display*) m_display, (GC) m_gc, pixel ^ values.background);
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetForeground ((Display*) m_display,(GC) m_gcBacking, pixel ^ values.background);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
XSetForeground ((Display*) m_display, (GC) m_gc, pixel);
|
XSetForeground ((Display*) m_display, (GC) m_gc, pixel);
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetForeground ((Display*) m_display,(GC) m_gcBacking, pixel);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -2012,8 +1765,6 @@ void wxWindowDC::SetBackground( const wxBrush &brush )
|
|||||||
// Necessary for ::DrawIcon, which use fg/bg pixel or the GC.
|
// Necessary for ::DrawIcon, which use fg/bg pixel or the GC.
|
||||||
// And Blit,... (Any fct that use XCopyPlane, in fact.)
|
// And Blit,... (Any fct that use XCopyPlane, in fact.)
|
||||||
XSetBackground ((Display*) m_display, (GC) m_gc, pixel);
|
XSetBackground ((Display*) m_display, (GC) m_gc, pixel);
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetBackground ((Display*) m_display,(GC) m_gcBacking, pixel);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::SetLogicalFunction( int function )
|
void wxWindowDC::SetLogicalFunction( int function )
|
||||||
@@ -2080,8 +1831,6 @@ void wxWindowDC::SetLogicalFunction( int function )
|
|||||||
}
|
}
|
||||||
|
|
||||||
XSetFunction((Display*) m_display, (GC) m_gc, x_function);
|
XSetFunction((Display*) m_display, (GC) m_gc, x_function);
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XSetFunction((Display*) m_display, (GC) m_gcBacking, x_function);
|
|
||||||
|
|
||||||
if ((m_logicalFunction == wxXOR) != (function == wxXOR))
|
if ((m_logicalFunction == wxXOR) != (function == wxXOR))
|
||||||
/* MATTHEW: [9] Need to redo pen simply */
|
/* MATTHEW: [9] Need to redo pen simply */
|
||||||
@@ -2152,11 +1901,11 @@ void wxWindowDC::SetDCClipping()
|
|||||||
m_currentRegion = (WXRegion) NULL;
|
m_currentRegion = (WXRegion) NULL;
|
||||||
|
|
||||||
if ((m_window && m_window->GetUpdateRegion().Ok()) && m_userRegion)
|
if ((m_window && m_window->GetUpdateRegion().Ok()) && m_userRegion)
|
||||||
XIntersectRegion ((Region) m_window->GetUpdateRegion().GetXRegion(), (Region) m_userRegion, (Region) m_currentRegion);
|
XIntersectRegion ((Region) m_window->GetUpdateRegion().GetX11Region(), (Region) m_userRegion, (Region) m_currentRegion);
|
||||||
else if (m_userRegion)
|
else if (m_userRegion)
|
||||||
XIntersectRegion ((Region) m_userRegion, (Region) m_userRegion, (Region) m_currentRegion);
|
XIntersectRegion ((Region) m_userRegion, (Region) m_userRegion, (Region) m_currentRegion);
|
||||||
else if (m_window && m_window->GetUpdateRegion().Ok())
|
else if (m_window && m_window->GetUpdateRegion().Ok())
|
||||||
XIntersectRegion ((Region) m_window->GetUpdateRegion().GetXRegion(), (Region) m_window->GetUpdateRegion().GetXRegion(),
|
XIntersectRegion ((Region) m_window->GetUpdateRegion().GetX11Region(), (Region) m_window->GetUpdateRegion().GetX11Region(),
|
||||||
(Region) m_currentRegion);
|
(Region) m_currentRegion);
|
||||||
|
|
||||||
if (m_currentRegion)
|
if (m_currentRegion)
|
||||||
@@ -2185,18 +1934,6 @@ void wxWindowDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoo
|
|||||||
XUnionRectWithRegion (&r, (Region) m_userRegion, (Region) m_userRegion);
|
XUnionRectWithRegion (&r, (Region) m_userRegion, (Region) m_userRegion);
|
||||||
|
|
||||||
SetDCClipping ();
|
SetDCClipping ();
|
||||||
|
|
||||||
// Needs to work differently for Pixmap: without this,
|
|
||||||
// there's a nasty (Display*) m_display bug. 8/12/94
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
{
|
|
||||||
XRectangle rects[1];
|
|
||||||
rects[0].x = XLOG2DEV_2(x);
|
|
||||||
rects[0].y = YLOG2DEV_2(y);
|
|
||||||
rects[0].width = XLOG2DEVREL(width);
|
|
||||||
rects[0].height = YLOG2DEVREL(height);
|
|
||||||
XSetClipRectangles((Display*) m_display, (GC) m_gcBacking, 0, 0, rects, 1, Unsorted);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion& region )
|
void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion& region )
|
||||||
@@ -2209,21 +1946,9 @@ void wxWindowDC::DoSetClippingRegionAsRegion( const wxRegion& region )
|
|||||||
XDestroyRegion ((Region) m_userRegion);
|
XDestroyRegion ((Region) m_userRegion);
|
||||||
m_userRegion = (WXRegion) XCreateRegion ();
|
m_userRegion = (WXRegion) XCreateRegion ();
|
||||||
|
|
||||||
XUnionRegion((Region) m_userRegion, (Region) region.GetXRegion(), (Region) m_userRegion);
|
XUnionRegion((Region) m_userRegion, (Region) region.GetX11Region(), (Region) m_userRegion);
|
||||||
|
|
||||||
SetDCClipping ();
|
SetDCClipping ();
|
||||||
|
|
||||||
// Needs to work differently for Pixmap: without this,
|
|
||||||
// there's a nasty (Display*) m_display bug. 8/12/94
|
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
{
|
|
||||||
XRectangle rects[1];
|
|
||||||
rects[0].x = XLOG2DEV_2(box.x);
|
|
||||||
rects[0].y = YLOG2DEV_2(box.y);
|
|
||||||
rects[0].width = XLOG2DEVREL(box.width);
|
|
||||||
rects[0].height = YLOG2DEVREL(box.height);
|
|
||||||
XSetClipRectangles((Display*) m_display, (GC) m_gcBacking, 0, 0, rects, 1, Unsorted);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2239,8 +1964,6 @@ void wxWindowDC::DestroyClippingRegion()
|
|||||||
|
|
||||||
XGCValues gc_val;
|
XGCValues gc_val;
|
||||||
gc_val.clip_mask = None;
|
gc_val.clip_mask = None;
|
||||||
if (m_window && m_window->GetBackingPixmap())
|
|
||||||
XChangeGC((Display*) m_display, (GC) m_gcBacking, GCClipMask, &gc_val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// Resolution in pixels per logical inch
|
// Resolution in pixels per logical inch
|
||||||
@@ -2262,53 +1985,14 @@ int wxWindowDC::GetDepth() const
|
|||||||
// wxPaintDC
|
// wxPaintDC
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
wxPaintDC::wxPaintDC(wxWindow* win) : wxWindowDC(win)
|
wxPaintDC::wxPaintDC(wxWindow* win)
|
||||||
|
: wxWindowDC(win)
|
||||||
{
|
{
|
||||||
wxRegion* region = NULL;
|
// TODO clone GTK logic here
|
||||||
|
|
||||||
// Combine all the update rects into a region
|
|
||||||
const wxRectList& updateRects(win->GetUpdateRects());
|
|
||||||
if ( updateRects.GetCount() != 0 )
|
|
||||||
{
|
|
||||||
for ( wxRectList::Node *node = updateRects.GetFirst();
|
|
||||||
node;
|
|
||||||
node = node->GetNext() )
|
|
||||||
{
|
|
||||||
wxRect* rect = node->GetData();
|
|
||||||
|
|
||||||
if (!region)
|
|
||||||
region = new wxRegion(*rect);
|
|
||||||
else
|
|
||||||
// TODO: is this correct? In SetDCClipping above,
|
|
||||||
// XIntersectRegion is used to combine paint and user
|
|
||||||
// regions. XIntersectRegion appears to work in that case...
|
|
||||||
region->Union(*rect);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
int cw, ch;
|
|
||||||
win->GetClientSize(&cw, &ch);
|
|
||||||
region = new wxRegion(wxRect(0, 0, cw, ch));
|
|
||||||
}
|
|
||||||
|
|
||||||
win->SetUpdateRegion(*region);
|
|
||||||
|
|
||||||
wxRegion& theRegion(win->GetUpdateRegion());
|
|
||||||
theRegion.SetRects(updateRects); // We also store in terms of rects, for iteration to work.
|
|
||||||
|
|
||||||
// Set the clipping region. Any user-defined region will be combined with this
|
|
||||||
// one in SetDCClipping.
|
|
||||||
XSetRegion ((Display*) m_display, (GC) m_gc, (Region) region->GetXRegion());
|
|
||||||
|
|
||||||
delete region;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxPaintDC::~wxPaintDC()
|
wxPaintDC::~wxPaintDC()
|
||||||
{
|
{
|
||||||
XSetClipMask ((Display*) m_display, (GC) m_gc, None);
|
|
||||||
if (m_window)
|
|
||||||
m_window->ClearUpdateRegion();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
@@ -1,10 +1,10 @@
|
|||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
// File: region.cpp
|
// File: region.cpp
|
||||||
// Purpose: Region class
|
// Purpose: Region class
|
||||||
// Author: Markus Holzem/Julian Smart
|
// Author: Markus Holzem, Julian Smart, Robert Roebling
|
||||||
// Created: Fri Oct 24 10:46:34 MET 1997
|
// Created: Fri Oct 24 10:46:34 MET 1997
|
||||||
// RCS-ID: $Id$
|
// RCS-ID: $Id$
|
||||||
// Copyright: (c) 1997 Markus Holzem/Julian Smart
|
// Copyright: (c) 1997 Markus Holzem, Julian Smart, Robert Roebling
|
||||||
// Licence: wxWindows licence
|
// Licence: wxWindows licence
|
||||||
/////////////////////////////////////////////////////////////////////////////
|
/////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
@@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
#include "wx/region.h"
|
#include "wx/region.h"
|
||||||
#include "wx/gdicmn.h"
|
#include "wx/gdicmn.h"
|
||||||
#include "wx/window.h"
|
#include "wx/log.h"
|
||||||
|
|
||||||
#ifdef __VMS__
|
#ifdef __VMS__
|
||||||
#pragma message disable nosimpint
|
#pragma message disable nosimpint
|
||||||
@@ -25,514 +25,517 @@
|
|||||||
#pragma message enable nosimpint
|
#pragma message enable nosimpint
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject)
|
|
||||||
IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator, wxObject)
|
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
// list types
|
// wxRegionRefData: private class containing the information about the region
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
#include "wx/listimpl.cpp"
|
class wxRegionRefData : public wxObjectRefData
|
||||||
|
{
|
||||||
WX_DEFINE_LIST(wxRectList);
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// wxRegionRefData implementation
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
class WXDLLEXPORT wxRegionRefData : public wxGDIRefData {
|
|
||||||
public:
|
public:
|
||||||
wxRegionRefData()
|
wxRegionRefData()
|
||||||
{
|
{
|
||||||
m_region = XCreateRegion();
|
m_region = NULL;
|
||||||
m_usingRects = FALSE;
|
|
||||||
m_rects = (wxRect*) NULL;
|
|
||||||
m_rectCount = 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRegionRefData(const wxRegionRefData& data)
|
wxRegionRefData(const wxRegionRefData& refData)
|
||||||
{
|
{
|
||||||
m_region = XCreateRegion();
|
m_region = XCreateRegion();
|
||||||
m_rects = (wxRect*) NULL;
|
XUnionRegion( refData.m_region, m_region, m_region );
|
||||||
m_rectCount = 0;
|
|
||||||
XUnionRegion(m_region, data.m_region, m_region);
|
|
||||||
|
|
||||||
SetRects(data.m_rectCount, data.m_rects);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
~wxRegionRefData()
|
~wxRegionRefData()
|
||||||
{
|
{
|
||||||
XDestroyRegion(m_region);
|
if (m_region)
|
||||||
DeleteRects();
|
XDestroyRegion( m_region );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRect* GetRects() { return m_rects; };
|
Region m_region;
|
||||||
void SetRects(const wxRectList& rectList);
|
|
||||||
void SetRects(int count, const wxRect* rects);
|
|
||||||
bool UsingRects() const { return m_usingRects; }
|
|
||||||
int GetRectCount() const { return m_rectCount; }
|
|
||||||
|
|
||||||
void DeleteRects();
|
|
||||||
|
|
||||||
Region m_region;
|
|
||||||
wxRect* m_rects;
|
|
||||||
int m_rectCount;
|
|
||||||
bool m_usingRects; // TRUE if we're using the above.
|
|
||||||
};
|
};
|
||||||
|
|
||||||
void wxRegionRefData::SetRects(const wxRectList& rectList)
|
// ----------------------------------------------------------------------------
|
||||||
|
// macros
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define M_REGIONDATA ((wxRegionRefData *)m_refData)
|
||||||
|
#define M_REGIONDATA_OF(rgn) ((wxRegionRefData *)(rgn.m_refData))
|
||||||
|
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxRegion, wxGDIObject);
|
||||||
|
IMPLEMENT_DYNAMIC_CLASS(wxRegionIterator,wxObject);
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxRegion construction
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
#define M_REGIONDATA ((wxRegionRefData *)m_refData)
|
||||||
|
|
||||||
|
void wxRegion::InitRect(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
|
||||||
{
|
{
|
||||||
DeleteRects();
|
|
||||||
m_usingRects = (rectList.Number() > 0);
|
|
||||||
if (m_usingRects)
|
|
||||||
{
|
|
||||||
m_rectCount = rectList.Number();
|
|
||||||
m_rects = new wxRect[m_rectCount];
|
|
||||||
}
|
|
||||||
|
|
||||||
wxRectList::Node* node = rectList.GetFirst();
|
|
||||||
int i = 0;
|
|
||||||
while (node) {
|
|
||||||
wxRect* rect = node->GetData();
|
|
||||||
m_rects[i] = * rect;
|
|
||||||
node = node->GetNext();
|
|
||||||
i ++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxRegionRefData::SetRects(int count, const wxRect* rects)
|
|
||||||
{
|
|
||||||
DeleteRects();
|
|
||||||
m_usingRects = (count > 0);
|
|
||||||
if (m_usingRects)
|
|
||||||
{
|
|
||||||
m_rectCount = count;
|
|
||||||
m_rects = new wxRect[m_rectCount];
|
|
||||||
int i;
|
|
||||||
for (i = 0; i < m_rectCount; i++)
|
|
||||||
m_rects[i] = rects[i];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxRegionRefData::DeleteRects()
|
|
||||||
{
|
|
||||||
if (m_rects)
|
|
||||||
{
|
|
||||||
delete[] m_rects;
|
|
||||||
m_rects = (wxRect*) NULL;
|
|
||||||
}
|
|
||||||
m_rectCount = 0;
|
|
||||||
m_usingRects = FALSE;
|
|
||||||
}
|
|
||||||
|
|
||||||
#define M_REGION (((wxRegionRefData*)m_refData)->m_region)
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
// wxRegion
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Create an empty region.
|
|
||||||
*/
|
|
||||||
wxRegion::wxRegion()
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
wxRegion::wxRegion(wxCoord x, wxCoord y, wxCoord w, wxCoord h)
|
|
||||||
{
|
|
||||||
m_refData = new wxRegionRefData;
|
|
||||||
|
|
||||||
XRectangle rect;
|
XRectangle rect;
|
||||||
rect.x = x;
|
rect.x = x;
|
||||||
rect.y = y;
|
rect.y = y;
|
||||||
rect.width = w;
|
rect.width = w;
|
||||||
rect.height = h;
|
rect.height = h;
|
||||||
XUnionRectWithRegion(&rect, M_REGION, M_REGION);
|
|
||||||
|
m_refData = new wxRegionRefData();
|
||||||
|
|
||||||
|
M_REGIONDATA->m_region = XCreateRegion();
|
||||||
|
XUnionRectWithRegion( &rect, M_REGIONDATA->m_region, M_REGIONDATA->m_region );
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRegion::wxRegion(const wxPoint& topLeft, const wxPoint& bottomRight)
|
wxRegion::wxRegion( size_t n, const wxPoint *points, int fillStyle )
|
||||||
{
|
{
|
||||||
m_refData = new wxRegionRefData;
|
#if 0
|
||||||
|
XPoint *xpoints = new XPoint[n];
|
||||||
|
for ( size_t i = 0 ; i < n ; i++ )
|
||||||
|
{
|
||||||
|
xpoints[i].x = points[i].x;
|
||||||
|
xpoints[i].y = points[i].y;
|
||||||
|
}
|
||||||
|
|
||||||
XRectangle rect;
|
m_refData = new wxRegionRefData();
|
||||||
rect.x = topLeft.x;
|
|
||||||
rect.y = topLeft.y;
|
Region* reg = gdk_region_polygon
|
||||||
rect.width = bottomRight.x - topLeft.x;
|
(
|
||||||
rect.height = bottomRight.y - topLeft.y;
|
gdkpoints,
|
||||||
XUnionRectWithRegion(&rect, M_REGION, M_REGION);
|
n,
|
||||||
|
fillStyle == wxWINDING_RULE ? GDK_WINDING_RULE
|
||||||
|
: GDK_EVEN_ODD_RULE
|
||||||
|
);
|
||||||
|
|
||||||
|
M_REGIONDATA->m_region = reg;
|
||||||
|
|
||||||
|
delete [] xpoints;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRegion::wxRegion(const wxRect& rect)
|
|
||||||
{
|
|
||||||
m_refData = new wxRegionRefData;
|
|
||||||
|
|
||||||
XRectangle rect1;
|
|
||||||
rect1.x = rect.x;
|
|
||||||
rect1.y = rect.y;
|
|
||||||
rect1.width = rect.width;
|
|
||||||
rect1.height = rect.height;
|
|
||||||
XUnionRectWithRegion(&rect1, M_REGION, M_REGION);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Destroy the region.
|
|
||||||
*/
|
|
||||||
wxRegion::~wxRegion()
|
wxRegion::~wxRegion()
|
||||||
{
|
{
|
||||||
// m_refData unrefed in ~wxObject
|
// m_refData unrefed in ~wxObject
|
||||||
}
|
}
|
||||||
|
|
||||||
// Get the internal region handle
|
wxObjectRefData *wxRegion::CreateRefData() const
|
||||||
WXRegion wxRegion::GetXRegion() const
|
|
||||||
{
|
{
|
||||||
wxASSERT( m_refData !=NULL );
|
return new wxRegionRefData;
|
||||||
|
|
||||||
return (WXRegion) ((wxRegionRefData*)m_refData)->m_region;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
wxObjectRefData *wxRegion::CloneRefData(const wxObjectRefData *data) const
|
||||||
//# Modify region
|
{
|
||||||
//-----------------------------------------------------------------------------
|
return new wxRegionRefData(*(wxRegionRefData *)data);
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxRegion comparison
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
bool wxRegion::operator==( const wxRegion& region )
|
||||||
|
{
|
||||||
|
if (m_refData == region.m_refData) return TRUE;
|
||||||
|
|
||||||
|
if (!m_refData || !region.m_refData) return FALSE;
|
||||||
|
|
||||||
|
// compare the regions themselves, not the pointers to ref data!
|
||||||
|
return XEqualRegion( M_REGIONDATA->m_region,
|
||||||
|
M_REGIONDATA_OF(region)->m_region );
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxRegion operations
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
//! Clear current region
|
|
||||||
void wxRegion::Clear()
|
void wxRegion::Clear()
|
||||||
{
|
{
|
||||||
UnRef();
|
UnRef();
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Combine rectangle (x, y, w, h) with this.
|
bool wxRegion::Union( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
|
||||||
bool wxRegion::Combine(wxCoord x, wxCoord y, wxCoord width, wxCoord height, wxRegionOp op)
|
|
||||||
{
|
{
|
||||||
// Don't change shared data
|
|
||||||
if (!m_refData) {
|
|
||||||
m_refData = new wxRegionRefData();
|
|
||||||
} else if (m_refData->GetRefCount() > 1) {
|
|
||||||
wxRegionRefData* ref = (wxRegionRefData*)m_refData;
|
|
||||||
UnRef();
|
|
||||||
m_refData = new wxRegionRefData(*ref);
|
|
||||||
}
|
|
||||||
// If ref count is 1, that means it's 'ours' anyway so no action.
|
|
||||||
|
|
||||||
Region rectRegion = XCreateRegion();
|
|
||||||
|
|
||||||
XRectangle rect;
|
XRectangle rect;
|
||||||
rect.x = x;
|
rect.x = x;
|
||||||
rect.y = y;
|
rect.y = y;
|
||||||
rect.width = width;
|
rect.width = width;
|
||||||
rect.height = height;
|
rect.height = height;
|
||||||
XUnionRectWithRegion(&rect, rectRegion, rectRegion);
|
|
||||||
|
if (!m_refData)
|
||||||
switch (op)
|
|
||||||
{
|
{
|
||||||
case wxRGN_AND:
|
m_refData = new wxRegionRefData();
|
||||||
XIntersectRegion(M_REGION, rectRegion, M_REGION);
|
M_REGIONDATA->m_region = XCreateRegion();
|
||||||
break ;
|
XUnionRectWithRegion( &rect, M_REGIONDATA->m_region, M_REGIONDATA->m_region );
|
||||||
case wxRGN_OR:
|
}
|
||||||
XUnionRegion(M_REGION, rectRegion, M_REGION);
|
else
|
||||||
break ;
|
{
|
||||||
case wxRGN_XOR:
|
AllocExclusive();
|
||||||
// TODO
|
|
||||||
break ;
|
XUnionRectWithRegion( &rect, M_REGIONDATA->m_region, M_REGIONDATA->m_region );
|
||||||
case wxRGN_DIFF:
|
|
||||||
// TODO
|
|
||||||
break ;
|
|
||||||
case wxRGN_COPY: // Don't have to do this one
|
|
||||||
default:
|
|
||||||
// TODO
|
|
||||||
break ;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Union /e region with this.
|
bool wxRegion::Union( const wxRect& rect )
|
||||||
bool wxRegion::Combine(const wxRegion& region, wxRegionOp op)
|
|
||||||
{
|
{
|
||||||
if (region.Empty())
|
return Union( rect.x, rect.y, rect.width, rect.height );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxRegion::Union( const wxRegion& region )
|
||||||
|
{
|
||||||
|
if (region.IsNull())
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
// Don't change shared data
|
if (!m_refData)
|
||||||
if (!m_refData) {
|
|
||||||
m_refData = new wxRegionRefData();
|
|
||||||
} else if (m_refData->GetRefCount() > 1) {
|
|
||||||
wxRegionRefData* ref = (wxRegionRefData*)m_refData;
|
|
||||||
UnRef();
|
|
||||||
m_refData = new wxRegionRefData(*ref);
|
|
||||||
}
|
|
||||||
|
|
||||||
switch (op)
|
|
||||||
{
|
{
|
||||||
case wxRGN_AND:
|
m_refData = new wxRegionRefData();
|
||||||
XIntersectRegion(M_REGION, ((wxRegionRefData*)region.m_refData)->m_region,
|
M_REGIONDATA->m_region = XCreateRegion();
|
||||||
M_REGION);
|
}
|
||||||
break ;
|
else
|
||||||
case wxRGN_OR:
|
{
|
||||||
XUnionRegion(M_REGION, ((wxRegionRefData*)region.m_refData)->m_region,
|
AllocExclusive();
|
||||||
M_REGION);
|
}
|
||||||
break ;
|
|
||||||
case wxRGN_XOR:
|
XUnionRegion( M_REGIONDATA->m_region,
|
||||||
// TODO
|
M_REGIONDATA_OF(region)->m_region,
|
||||||
break ;
|
M_REGIONDATA->m_region );
|
||||||
case wxRGN_DIFF:
|
|
||||||
// TODO
|
return TRUE;
|
||||||
break ;
|
}
|
||||||
case wxRGN_COPY: // Don't have to do this one
|
|
||||||
default:
|
bool wxRegion::Intersect( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
|
||||||
// TODO
|
{
|
||||||
break ;
|
wxRegion reg( x, y, width, height );
|
||||||
|
|
||||||
|
return Intersect( reg );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxRegion::Intersect( const wxRect& rect )
|
||||||
|
{
|
||||||
|
wxRegion reg( rect );
|
||||||
|
|
||||||
|
return Intersect( reg );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxRegion::Intersect( const wxRegion& region )
|
||||||
|
{
|
||||||
|
if (region.IsNull())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!m_refData)
|
||||||
|
{
|
||||||
|
m_refData = new wxRegionRefData();
|
||||||
|
M_REGIONDATA->m_region = XCreateRegion();
|
||||||
|
|
||||||
|
// leave here
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AllocExclusive();
|
||||||
}
|
}
|
||||||
|
|
||||||
return FALSE;
|
XIntersectRegion( M_REGIONDATA->m_region,
|
||||||
|
M_REGIONDATA_OF(region)->m_region,
|
||||||
|
M_REGIONDATA->m_region );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegion::Combine(const wxRect& rect, wxRegionOp op)
|
bool wxRegion::Subtract( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
|
||||||
{
|
{
|
||||||
return Combine(rect.GetLeft(), rect.GetTop(), rect.GetWidth(), rect.GetHeight(), op);
|
wxRegion reg( x, y, width, height );
|
||||||
|
return Subtract( reg );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
bool wxRegion::Subtract( const wxRect& rect )
|
||||||
//# Information on region
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Outer bounds of region
|
|
||||||
void wxRegion::GetBox(wxCoord& x, wxCoord& y, wxCoord&w, wxCoord &h) const
|
|
||||||
{
|
{
|
||||||
if (m_refData) {
|
wxRegion reg( rect );
|
||||||
|
return Subtract( reg );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxRegion::Subtract( const wxRegion& region )
|
||||||
|
{
|
||||||
|
if (region.IsNull())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!m_refData)
|
||||||
|
{
|
||||||
|
m_refData = new wxRegionRefData();
|
||||||
|
M_REGIONDATA->m_region = XCreateRegion();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AllocExclusive();
|
||||||
|
}
|
||||||
|
|
||||||
|
XSubtractRegion( M_REGIONDATA->m_region,
|
||||||
|
M_REGIONDATA_OF(region)->m_region,
|
||||||
|
M_REGIONDATA->m_region );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxRegion::Xor( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
|
||||||
|
{
|
||||||
|
wxRegion reg( x, y, width, height );
|
||||||
|
return Xor( reg );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxRegion::Xor( const wxRect& rect )
|
||||||
|
{
|
||||||
|
wxRegion reg( rect );
|
||||||
|
return Xor( reg );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxRegion::Xor( const wxRegion& region )
|
||||||
|
{
|
||||||
|
if (region.IsNull())
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
if (!m_refData)
|
||||||
|
{
|
||||||
|
m_refData = new wxRegionRefData();
|
||||||
|
M_REGIONDATA->m_region = XCreateRegion();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
AllocExclusive();
|
||||||
|
}
|
||||||
|
|
||||||
|
XXorRegion( M_REGIONDATA->m_region,
|
||||||
|
M_REGIONDATA_OF(region)->m_region,
|
||||||
|
M_REGIONDATA->m_region );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxRegion tests
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
void wxRegion::GetBox( wxCoord &x, wxCoord &y, wxCoord &w, wxCoord &h ) const
|
||||||
|
{
|
||||||
|
if (m_refData)
|
||||||
|
{
|
||||||
XRectangle rect;
|
XRectangle rect;
|
||||||
XClipBox(M_REGION, &rect);
|
XClipBox( M_REGIONDATA->m_region, &rect );
|
||||||
x = rect.x;
|
x = rect.x;
|
||||||
y = rect.y;
|
y = rect.y;
|
||||||
w = rect.width;
|
w = rect.width;
|
||||||
h = rect.height;
|
h = rect.height;
|
||||||
} else {
|
}
|
||||||
x = y = w = h = 0;
|
else
|
||||||
|
{
|
||||||
|
x = 0;
|
||||||
|
y = 0;
|
||||||
|
w = -1;
|
||||||
|
h = -1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
wxRect wxRegion::GetBox() const
|
wxRect wxRegion::GetBox() const
|
||||||
{
|
{
|
||||||
wxCoord x, y, w, h;
|
wxCoord x, y, w, h;
|
||||||
GetBox(x, y, w, h);
|
GetBox( x, y, w, h );
|
||||||
return wxRect(x, y, w, h);
|
return wxRect( x, y, w, h );
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxRegion::Offset( wxCoord x, wxCoord y )
|
||||||
|
{
|
||||||
|
if (!m_refData)
|
||||||
|
return FALSE;
|
||||||
|
|
||||||
|
AllocExclusive();
|
||||||
|
|
||||||
|
XOffsetRegion( M_REGIONDATA->m_region, x, y );
|
||||||
|
|
||||||
|
return TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Is region empty?
|
|
||||||
bool wxRegion::Empty() const
|
bool wxRegion::Empty() const
|
||||||
{
|
{
|
||||||
return m_refData ? XEmptyRegion(M_REGION) : TRUE;
|
if (!m_refData)
|
||||||
|
return TRUE;
|
||||||
|
|
||||||
|
return XEmptyRegion( M_REGIONDATA->m_region );
|
||||||
}
|
}
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
wxRegionContain wxRegion::Contains( wxCoord x, wxCoord y ) const
|
||||||
//# Tests
|
|
||||||
//-----------------------------------------------------------------------------
|
|
||||||
|
|
||||||
// Does the region contain the point (x,y)?
|
|
||||||
wxRegionContain wxRegion::Contains(wxCoord WXUNUSED(x), wxCoord WXUNUSED(y)) const
|
|
||||||
{
|
{
|
||||||
if (!m_refData)
|
if (!m_refData)
|
||||||
return wxOutRegion;
|
return wxOutRegion;
|
||||||
|
|
||||||
// TODO. Return wxInRegion if within region.
|
if (XPointInRegion( M_REGIONDATA->m_region, x, y ))
|
||||||
if (0)
|
|
||||||
return wxInRegion;
|
return wxInRegion;
|
||||||
return wxOutRegion;
|
else
|
||||||
|
return wxOutRegion;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Does the region contain the point pt?
|
wxRegionContain wxRegion::Contains( wxCoord x, wxCoord y, wxCoord w, wxCoord h ) const
|
||||||
wxRegionContain wxRegion::Contains(const wxPoint& pt) const
|
|
||||||
{
|
{
|
||||||
if (!m_refData)
|
if (!m_refData)
|
||||||
return wxOutRegion;
|
return wxOutRegion;
|
||||||
|
|
||||||
return XPointInRegion(M_REGION, pt.x, pt.y) ? wxInRegion : wxOutRegion;
|
int res = XRectInRegion( M_REGIONDATA->m_region, x, y, w, h );
|
||||||
}
|
switch (res)
|
||||||
|
{
|
||||||
// Does the region contain the rectangle (x, y, w, h)?
|
case RectangleIn: return wxInRegion;
|
||||||
wxRegionContain wxRegion::Contains(wxCoord x, wxCoord y, wxCoord w, wxCoord h) const
|
case RectangleOut: return wxOutRegion;
|
||||||
{
|
|
||||||
if (!m_refData)
|
|
||||||
return wxOutRegion;
|
|
||||||
|
|
||||||
switch (XRectInRegion(M_REGION, x, y, w, h)) {
|
|
||||||
case RectangleIn: return wxInRegion;
|
|
||||||
case RectanglePart: return wxPartRegion;
|
case RectanglePart: return wxPartRegion;
|
||||||
}
|
}
|
||||||
return wxOutRegion;
|
return wxOutRegion;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Does the region contain the rectangle rect
|
wxRegionContain wxRegion::Contains(const wxPoint& pt) const
|
||||||
|
{
|
||||||
|
return Contains( pt.x, pt.y );
|
||||||
|
}
|
||||||
|
|
||||||
wxRegionContain wxRegion::Contains(const wxRect& rect) const
|
wxRegionContain wxRegion::Contains(const wxRect& rect) const
|
||||||
|
{
|
||||||
|
return Contains( rect.x, rect.y, rect.width, rect.height );
|
||||||
|
}
|
||||||
|
|
||||||
|
WXRegion *wxRegion::GetX11Region() const
|
||||||
{
|
{
|
||||||
if (!m_refData)
|
if (!m_refData)
|
||||||
return wxOutRegion;
|
return (WXRegion*) NULL;
|
||||||
|
|
||||||
wxCoord x, y, w, h;
|
return (WXRegion*) M_REGIONDATA->m_region;
|
||||||
x = rect.x;
|
|
||||||
y = rect.y;
|
|
||||||
w = rect.GetWidth();
|
|
||||||
h = rect.GetHeight();
|
|
||||||
return Contains(x, y, w, h);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool wxRegion::UsingRects() const
|
// ----------------------------------------------------------------------------
|
||||||
|
// wxRegionIterator
|
||||||
|
// ----------------------------------------------------------------------------
|
||||||
|
|
||||||
|
// the following structures must match the private structures
|
||||||
|
// in X11 region code ( xc/lib/X11/region.h )
|
||||||
|
|
||||||
|
// this makes the Region type transparent
|
||||||
|
// and we have access to the region rectangles
|
||||||
|
|
||||||
|
struct _XBox {
|
||||||
|
short x1, x2, y1, y2;
|
||||||
|
};
|
||||||
|
|
||||||
|
struct _XRegion {
|
||||||
|
long size , numRects;
|
||||||
|
_XBox *rects, extents;
|
||||||
|
};
|
||||||
|
|
||||||
|
class wxRIRefData: public wxObjectRefData
|
||||||
{
|
{
|
||||||
return ((wxRegionRefData*)m_refData)->UsingRects();
|
public:
|
||||||
}
|
|
||||||
|
|
||||||
/*
|
wxRIRefData() : m_rects(0), m_numRects(0){}
|
||||||
wxRectList& wxRegion::GetRectList()
|
~wxRIRefData();
|
||||||
|
|
||||||
|
wxRect *m_rects;
|
||||||
|
size_t m_numRects;
|
||||||
|
|
||||||
|
void CreateRects( const wxRegion& r );
|
||||||
|
};
|
||||||
|
|
||||||
|
wxRIRefData::~wxRIRefData()
|
||||||
{
|
{
|
||||||
return ((wxRegionRefData*)m_refData)->GetRectList();
|
delete m_rects;
|
||||||
}
|
|
||||||
*/
|
|
||||||
|
|
||||||
wxRect* wxRegion::GetRects()
|
|
||||||
{
|
|
||||||
return ((wxRegionRefData*)m_refData)->GetRects();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int wxRegion::GetRectCount() const
|
void wxRIRefData::CreateRects( const wxRegion& region )
|
||||||
{
|
|
||||||
return ((wxRegionRefData*)m_refData)->GetRectCount();
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxRegion::SetRects(const wxRectList& rectList)
|
|
||||||
{
|
|
||||||
((wxRegionRefData*)m_refData)->SetRects(rectList);
|
|
||||||
}
|
|
||||||
|
|
||||||
void wxRegion::SetRects(int count, const wxRect* rects)
|
|
||||||
{
|
|
||||||
((wxRegionRefData*)m_refData)->SetRects(count, rects);
|
|
||||||
}
|
|
||||||
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
// //
|
|
||||||
// wxRegionIterator //
|
|
||||||
// //
|
|
||||||
///////////////////////////////////////////////////////////////////////////////
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Initialize empty iterator
|
|
||||||
*/
|
|
||||||
wxRegionIterator::wxRegionIterator() : m_current(0), m_numRects(0), m_rects(NULL)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
wxRegionIterator::~wxRegionIterator()
|
|
||||||
{
|
{
|
||||||
if (m_rects)
|
if (m_rects)
|
||||||
delete[] m_rects;
|
delete m_rects;
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
m_rects = 0;
|
||||||
* Initialize iterator for region
|
m_numRects = 0;
|
||||||
*/
|
|
||||||
wxRegionIterator::wxRegionIterator(const wxRegion& region)
|
if (region.IsEmpty()) return;
|
||||||
{
|
|
||||||
m_rects = NULL;
|
Region r = (Region) region.GetX11Region();
|
||||||
|
if (r)
|
||||||
Reset(region);
|
|
||||||
}
|
|
||||||
|
|
||||||
/*!
|
|
||||||
* Reset iterator for a new /e region.
|
|
||||||
*/
|
|
||||||
void wxRegionIterator::Reset(const wxRegion& region)
|
|
||||||
{
|
|
||||||
m_current = 0;
|
|
||||||
m_region = region;
|
|
||||||
|
|
||||||
if (m_rects)
|
|
||||||
delete[] m_rects;
|
|
||||||
|
|
||||||
m_rects = NULL;
|
|
||||||
|
|
||||||
if (m_region.Empty())
|
|
||||||
m_numRects = 0;
|
|
||||||
else
|
|
||||||
{
|
{
|
||||||
// Create m_rects and fill with rectangles for this region.
|
m_numRects = r->numRects;
|
||||||
// Since we can't find the rectangles in a region, we cheat
|
if (m_numRects)
|
||||||
// by retrieving the rectangles explicitly set in wxPaintDC::wxPaintDC
|
|
||||||
// (dcclient.cpp).
|
|
||||||
if (m_region.UsingRects())
|
|
||||||
{
|
{
|
||||||
wxRect* rects = m_region.GetRects();
|
|
||||||
int count = m_region.GetRectCount();
|
|
||||||
m_numRects = count;
|
|
||||||
m_rects = new wxRect[m_numRects];
|
m_rects = new wxRect[m_numRects];
|
||||||
|
for (size_t i=0; i < m_numRects; ++i)
|
||||||
for (size_t i = 0; i < m_numRects; i++)
|
{
|
||||||
m_rects[i] = rects[i];
|
_XBox &xr = r->rects[i];
|
||||||
|
wxRect &wr = m_rects[i];
|
||||||
/*
|
wr.x = xr.x1;
|
||||||
int i = 0;
|
wr.y = xr.y1;
|
||||||
wxRectList::Node* node = rectList.GetFirst();
|
wr.width = xr.x2-xr.x1;
|
||||||
while (node) {
|
wr.height = xr.y2-xr.y1;
|
||||||
wxRect* rect = node->GetData();
|
|
||||||
m_rects[i] = * rect;
|
|
||||||
node = node->GetNext();
|
|
||||||
i ++;
|
|
||||||
}
|
}
|
||||||
*/
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
// For now, fudge by getting the whole bounding box.
|
|
||||||
m_rects = new wxRect[1];
|
|
||||||
m_numRects = 1;
|
|
||||||
m_rects[0] = m_region.GetBox();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
wxRegionIterator::wxRegionIterator()
|
||||||
* Increment iterator. The rectangle returned is the one after the
|
|
||||||
* incrementation.
|
|
||||||
*/
|
|
||||||
void wxRegionIterator::operator ++ ()
|
|
||||||
{
|
{
|
||||||
if (m_current < m_numRects)
|
m_refData = new wxRIRefData();
|
||||||
++m_current;
|
Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
wxRegionIterator::wxRegionIterator( const wxRegion& region )
|
||||||
|
{
|
||||||
|
m_refData = new wxRIRefData();
|
||||||
|
Reset(region);
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxRegionIterator::Reset( const wxRegion& region )
|
||||||
|
{
|
||||||
|
m_region = region;
|
||||||
|
((wxRIRefData*)m_refData)->CreateRects(region);
|
||||||
|
Reset();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool wxRegionIterator::HaveRects() const
|
||||||
|
{
|
||||||
|
return m_current < ((wxRIRefData*)m_refData)->m_numRects;
|
||||||
|
}
|
||||||
|
|
||||||
|
wxRegionIterator::operator bool () const
|
||||||
|
{
|
||||||
|
return HaveRects();
|
||||||
|
}
|
||||||
|
|
||||||
|
void wxRegionIterator::operator ++ ()
|
||||||
|
{
|
||||||
|
if (HaveRects()) ++m_current;
|
||||||
}
|
}
|
||||||
|
|
||||||
/*!
|
|
||||||
* Increment iterator. The rectangle returned is the one before the
|
|
||||||
* incrementation.
|
|
||||||
*/
|
|
||||||
void wxRegionIterator::operator ++ (int)
|
void wxRegionIterator::operator ++ (int)
|
||||||
{
|
{
|
||||||
if (m_current < m_numRects)
|
if (HaveRects()) ++m_current;
|
||||||
++m_current;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord wxRegionIterator::GetX() const
|
wxCoord wxRegionIterator::GetX() const
|
||||||
{
|
{
|
||||||
if (m_current < m_numRects)
|
if( !HaveRects() ) return 0;
|
||||||
return m_rects[m_current].x;
|
return ((wxRIRefData*)m_refData)->m_rects[m_current].x;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord wxRegionIterator::GetY() const
|
wxCoord wxRegionIterator::GetY() const
|
||||||
{
|
{
|
||||||
if (m_current < m_numRects)
|
if( !HaveRects() ) return 0;
|
||||||
return m_rects[m_current].y;
|
return ((wxRIRefData*)m_refData)->m_rects[m_current].y;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord wxRegionIterator::GetW() const
|
wxCoord wxRegionIterator::GetW() const
|
||||||
{
|
{
|
||||||
if (m_current < m_numRects)
|
if( !HaveRects() ) return -1;
|
||||||
return m_rects[m_current].width ;
|
return ((wxRIRefData*)m_refData)->m_rects[m_current].width;
|
||||||
return 0;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
wxCoord wxRegionIterator::GetH() const
|
wxCoord wxRegionIterator::GetH() const
|
||||||
{
|
{
|
||||||
if (m_current < m_numRects)
|
if( !HaveRects() ) return -1;
|
||||||
return m_rects[m_current].height;
|
return ((wxRIRefData*)m_refData)->m_rects[m_current].height;
|
||||||
return 0;
|
}
|
||||||
|
|
||||||
|
wxRect wxRegionIterator::GetRect() const
|
||||||
|
{
|
||||||
|
wxRect r;
|
||||||
|
if( HaveRects() )
|
||||||
|
r = ((wxRIRefData*)m_refData)->m_rects[m_current];
|
||||||
|
|
||||||
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@@ -103,10 +103,6 @@ void wxWindowX11::Init()
|
|||||||
m_needsRefresh = TRUE;
|
m_needsRefresh = TRUE;
|
||||||
m_mainWidget = (WXWindow) 0;
|
m_mainWidget = (WXWindow) 0;
|
||||||
|
|
||||||
m_button1Pressed =
|
|
||||||
m_button2Pressed =
|
|
||||||
m_button3Pressed = FALSE;
|
|
||||||
|
|
||||||
m_winCaptured = FALSE;
|
m_winCaptured = FALSE;
|
||||||
|
|
||||||
m_isShown = TRUE;
|
m_isShown = TRUE;
|
||||||
@@ -124,13 +120,6 @@ void wxWindowX11::Init()
|
|||||||
m_scrollPosX =
|
m_scrollPosX =
|
||||||
m_scrollPosY = 0;
|
m_scrollPosY = 0;
|
||||||
|
|
||||||
m_backingPixmap = (WXPixmap) 0;
|
|
||||||
m_pixmapWidth =
|
|
||||||
m_pixmapHeight = 0;
|
|
||||||
|
|
||||||
m_pixmapOffsetX =
|
|
||||||
m_pixmapOffsetY = 0;
|
|
||||||
|
|
||||||
m_lastTS = 0;
|
m_lastTS = 0;
|
||||||
m_lastButton = 0;
|
m_lastButton = 0;
|
||||||
m_canAddEventHandler = FALSE;
|
m_canAddEventHandler = FALSE;
|
||||||
@@ -231,8 +220,6 @@ wxWindowX11::~wxWindowX11()
|
|||||||
//DetachWidget(wMain);
|
//DetachWidget(wMain);
|
||||||
}
|
}
|
||||||
|
|
||||||
ClearUpdateRects();
|
|
||||||
|
|
||||||
if ( m_parent )
|
if ( m_parent )
|
||||||
m_parent->RemoveChild( this );
|
m_parent->RemoveChild( this );
|
||||||
|
|
||||||
@@ -1280,31 +1267,39 @@ void wxWindowX11::Clear()
|
|||||||
dc.Clear();
|
dc.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
void wxWindowX11::ClearUpdateRects()
|
void wxWindowX11::X11SendPaintEvents()
|
||||||
{
|
{
|
||||||
wxRectList::Node* node = m_updateRects.GetFirst();
|
m_clipPaintRegion = TRUE;
|
||||||
while (node)
|
|
||||||
|
if (!m_clearRegion.IsEmpty())
|
||||||
{
|
{
|
||||||
wxRect* rect = node->GetData();
|
wxWindowDC dc( (wxWindow*)this );
|
||||||
delete rect;
|
dc.SetClippingRegion( m_clearRegion );
|
||||||
node = node->GetNext();
|
|
||||||
|
wxEraseEvent erase_event( GetId(), &dc );
|
||||||
|
erase_event.SetEventObject( this );
|
||||||
|
|
||||||
|
if (!GetEventHandler()->ProcessEvent(erase_event))
|
||||||
|
{
|
||||||
|
wxRegionIterator upd( m_clearRegion );
|
||||||
|
while (upd)
|
||||||
|
{
|
||||||
|
// XClearArea( ... , upd.GetX(), upd.GetY(), upd.GetWidth(), upd.GetHeight() );
|
||||||
|
upd ++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
m_clearRegion.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
m_updateRects.Clear();
|
wxNcPaintEvent nc_paint_event( GetId() );
|
||||||
}
|
nc_paint_event.SetEventObject( this );
|
||||||
|
GetEventHandler()->ProcessEvent( nc_paint_event );
|
||||||
|
|
||||||
void wxWindowX11::DoPaint()
|
wxPaintEvent paint_event( GetId() );
|
||||||
{
|
paint_event.SetEventObject( this );
|
||||||
// Set an erase event first
|
GetEventHandler()->ProcessEvent( paint_event );
|
||||||
wxEraseEvent eraseEvent(GetId());
|
|
||||||
eraseEvent.SetEventObject(this);
|
m_clipPaintRegion = FALSE;
|
||||||
GetEventHandler()->ProcessEvent(eraseEvent);
|
|
||||||
|
|
||||||
wxPaintEvent event(GetId());
|
|
||||||
event.SetEventObject(this);
|
|
||||||
GetEventHandler()->ProcessEvent(event);
|
|
||||||
|
|
||||||
m_needsRefresh = FALSE;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
// ----------------------------------------------------------------------------
|
// ----------------------------------------------------------------------------
|
||||||
@@ -1600,19 +1595,16 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window,
|
|||||||
if (xevent->xbutton.button == Button1)
|
if (xevent->xbutton.button == Button1)
|
||||||
{
|
{
|
||||||
eventType = wxEVT_LEFT_DOWN;
|
eventType = wxEVT_LEFT_DOWN;
|
||||||
win->SetButton1(TRUE);
|
|
||||||
button = 1;
|
button = 1;
|
||||||
}
|
}
|
||||||
else if (xevent->xbutton.button == Button2)
|
else if (xevent->xbutton.button == Button2)
|
||||||
{
|
{
|
||||||
eventType = wxEVT_MIDDLE_DOWN;
|
eventType = wxEVT_MIDDLE_DOWN;
|
||||||
win->SetButton2(TRUE);
|
|
||||||
button = 2;
|
button = 2;
|
||||||
}
|
}
|
||||||
else if (xevent->xbutton.button == Button3)
|
else if (xevent->xbutton.button == Button3)
|
||||||
{
|
{
|
||||||
eventType = wxEVT_RIGHT_DOWN;
|
eventType = wxEVT_RIGHT_DOWN;
|
||||||
win->SetButton3(TRUE);
|
|
||||||
button = 3;
|
button = 3;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1646,17 +1638,14 @@ bool wxTranslateMouseEvent(wxMouseEvent& wxevent, wxWindow *win, Window window,
|
|||||||
if (xevent->xbutton.button == Button1)
|
if (xevent->xbutton.button == Button1)
|
||||||
{
|
{
|
||||||
eventType = wxEVT_LEFT_UP;
|
eventType = wxEVT_LEFT_UP;
|
||||||
win->SetButton1(FALSE);
|
|
||||||
}
|
}
|
||||||
else if (xevent->xbutton.button == Button2)
|
else if (xevent->xbutton.button == Button2)
|
||||||
{
|
{
|
||||||
eventType = wxEVT_MIDDLE_UP;
|
eventType = wxEVT_MIDDLE_UP;
|
||||||
win->SetButton2(FALSE);
|
|
||||||
}
|
}
|
||||||
else if (xevent->xbutton.button == Button3)
|
else if (xevent->xbutton.button == Button3)
|
||||||
{
|
{
|
||||||
eventType = wxEVT_RIGHT_UP;
|
eventType = wxEVT_RIGHT_UP;
|
||||||
win->SetButton3(FALSE);
|
|
||||||
}
|
}
|
||||||
else return FALSE;
|
else return FALSE;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user