X-Git-Url: https://git.saurik.com/wxWidgets.git/blobdiff_plain/7b65ea1af911e4ba65c47e2ed4f3138367b2bdbb..a7cfe08aff22afc81e29fc93018cff111f59d129:/src/motif/dc.cpp diff --git a/src/motif/dc.cpp b/src/motif/dc.cpp index 1ece237483..884ac2e7e6 100644 --- a/src/motif/dc.cpp +++ b/src/motif/dc.cpp @@ -1,5 +1,5 @@ ///////////////////////////////////////////////////////////////////////////// -// Name: dc.cpp +// Name: src/motif/dc.cpp // Purpose: wxDC class // Author: Julian Smart // Modified by: @@ -9,28 +9,16 @@ // Licence: wxWindows licence ///////////////////////////////////////////////////////////////////////////// -#ifdef __GNUG__ - #pragma implementation "dc.h" -#endif +// For compilers that support precompilation, includes "wx.h". +#include "wx/wxprec.h" #include "wx/dc.h" -#include "wx/dcmemory.h" -#include "wx/defs.h" -#if !USE_SHARED_LIBRARY - IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject) +#ifndef WX_PRECOMP + #include "wx/dcmemory.h" #endif -//----------------------------------------------------------------------------- -// constants -//----------------------------------------------------------------------------- - -#define mm2inches 0.0393700787402 -#define inches2mm 25.4 -#define mm2twips 56.6929133859 -#define twips2mm 0.0176388888889 -#define mm2pt 2.83464566929 -#define pt2mm 0.352777777778 +IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject) //----------------------------------------------------------------------------- // wxDC @@ -38,14 +26,14 @@ wxDC::wxDC() { - m_ok = FALSE; + m_ok = false; m_mm_to_pix_x = 1.0; m_mm_to_pix_y = 1.0; m_backgroundMode = wxTRANSPARENT; - m_isInteractive = FALSE; + m_isInteractive = false; } void wxDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y) @@ -53,7 +41,7 @@ void wxDC::DoDrawIcon( const wxIcon &icon, wxCoord x, wxCoord y) wxCHECK_RET( Ok(), "invalid dc" ); wxCHECK_RET( icon.Ok(), "invalid icon" ); - DoDrawBitmap(icon, x, y, TRUE); + DoDrawBitmap(icon, x, y, true); } void wxDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useMask ) @@ -82,18 +70,13 @@ void wxDC::DoDrawBitmap( const wxBitmap& bitmap, wxCoord x, wxCoord y, bool useM void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height ) { - m_clipping = TRUE; + m_clipping = true; m_clipX1 = x; m_clipY1 = y; m_clipX2 = x + width; m_clipY2 = y + height; } -void wxDC::DestroyClippingRegion() -{ - m_clipping = FALSE; -} - void wxDC::DoGetSize( int* width, int* height ) const { if ( width ) @@ -143,8 +126,8 @@ void wxDC::SetMapMode( int mode ) } if (mode != wxMM_TEXT) { - m_needComputeScaleX = TRUE; - m_needComputeScaleY = TRUE; + m_needComputeScaleX = true; + m_needComputeScaleY = true; } } @@ -173,24 +156,12 @@ void wxDC::SetLogicalOrigin( wxCoord x, wxCoord y ) void wxDC::SetDeviceOrigin( wxCoord x, wxCoord y ) { - m_externalDeviceOriginX = x; - m_externalDeviceOriginY = y; - ComputeScaleAndOrigin(); -} - -void wxDC::SetInternalDeviceOrigin( wxCoord x, wxCoord y ) -{ - m_internalDeviceOriginX = x; - m_internalDeviceOriginY = y; + // only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there + m_deviceOriginX = x; + m_deviceOriginY = y; ComputeScaleAndOrigin(); } -void wxDC::GetInternalDeviceOrigin( wxCoord *x, wxCoord *y ) -{ - if (x) *x = m_internalDeviceOriginX; - if (y) *y = m_internalDeviceOriginY; -} - void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp ) { m_signX = xLeftRight ? 1 : -1; @@ -240,25 +211,6 @@ wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const void wxDC::ComputeScaleAndOrigin() { - // CMB: copy scale to see if it changes - double origScaleX = m_scaleX; - double origScaleY = m_scaleY; - m_scaleX = m_logicalScaleX * m_userScaleX; m_scaleY = m_logicalScaleY * m_userScaleY; - - m_deviceOriginX = m_internalDeviceOriginX + m_externalDeviceOriginX; - m_deviceOriginY = m_internalDeviceOriginY + m_externalDeviceOriginY; - - // CMB: if scale has changed call SetPen to recalulate the line width - if (m_scaleX != origScaleX || m_scaleY != origScaleY) - { - // this is a bit artificial, but we need to force wxDC to think - // the pen has changed - wxPen* pen = & GetPen(); - wxPen tempPen; - m_pen = tempPen; - SetPen(* pen); - } } -