mac changes : wxDC - removed doubly defined vars (inherited from base) and fixed wxPen - width scales with context and 0 width always renders one pixel wide

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@9457 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Stefan Csomor
2001-03-03 17:18:03 +00:00
parent 1d261710b8
commit 0b014ec713
5 changed files with 22 additions and 71 deletions

View File

@@ -424,34 +424,9 @@ protected:
// //
public: public:
//begin wxmac
bool m_ok;
bool m_colour;
// not sure, what these mean
bool m_clipping; // Is clipping on right now ?
bool m_isInteractive; // Is GetPixel possible ?
bool m_autoSetting; // wxMSW only ?
bool m_dontDelete; // wxMSW only ?
bool m_optimize; // wxMSW only ?
wxString m_filename; // Not sure where this belongs.
wxPen m_pen;
wxBrush m_brush;
wxBrush m_backgroundBrush;
wxColour m_textForegroundColour;
wxColour m_textBackgroundColour;
wxFont m_font;
int m_logicalFunction;
int m_backgroundMode;
int m_textAlignment; // gone in wxWin 2.0 ?
int m_mappingMode;
// not sure what for, but what is a mm on a screen you don't know the size of?
double m_mm_to_pix_x,m_mm_to_pix_y; double m_mm_to_pix_x,m_mm_to_pix_y;
bool m_needComputeScaleX,m_needComputeScaleY; // not yet used
long m_internalDeviceOriginX,m_internalDeviceOriginY; // If un-scrolled is non-zero or long m_internalDeviceOriginX,m_internalDeviceOriginY; // If un-scrolled is non-zero or
// d.o. changes with scrolling. // d.o. changes with scrolling.
// Set using SetInternalDeviceOrigin(). // Set using SetInternalDeviceOrigin().
@@ -459,24 +434,6 @@ protected:
long m_externalDeviceOriginX,m_externalDeviceOriginY; // To be set by external classes long m_externalDeviceOriginX,m_externalDeviceOriginY; // To be set by external classes
// such as wxScrolledWindow // such as wxScrolledWindow
// using SetDeviceOrigin() // using SetDeviceOrigin()
long m_deviceOriginX,m_deviceOriginY; // Sum of the two above.
long m_logicalOriginX,m_logicalOriginY; // User defined.
double m_scaleX,m_scaleY;
double m_logicalScaleX,m_logicalScaleY;
double m_userScaleX,m_userScaleY;
long m_signX,m_signY;
bool m_needComputeScaleX,m_needComputeScaleY; // not yet used
float m_scaleFactor; // wxPSDC wants to have this. Will disappear.
long m_clipX1,m_clipY1,m_clipX2,m_clipY2;
long m_minX,m_maxX,m_minY,m_maxY;
//begin wxmac
GrafPtr m_macPort ; GrafPtr m_macPort ;
GWorldPtr m_macMask ; GWorldPtr m_macMask ;

View File

@@ -45,8 +45,8 @@ long wxDC::m_macCurrentPortId = 1 ;
wxDC::wxDC() wxDC::wxDC()
{ {
m_ok = FALSE; m_ok = FALSE;
m_optimize = FALSE; // m_optimize = FALSE;
m_autoSetting = FALSE; // m_autoSetting = FALSE;
m_colour = TRUE; m_colour = TRUE;
m_clipping = FALSE; m_clipping = FALSE;
@@ -539,7 +539,7 @@ void wxDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
if (m_pen.GetStyle() != wxTRANSPARENT) if (m_pen.GetStyle() != wxTRANSPARENT)
{ {
MacInstallPen() ; MacInstallPen() ;
int offset = (m_pen.GetWidth() - 1) / 2 ; int offset = ( (m_pen.GetWidth() == 0 ? 1 : m_pen.GetWidth() ) * m_scaleX - 1) / 2 ;
long xx1 = XLOG2DEV(x1); long xx1 = XLOG2DEV(x1);
long yy1 = YLOG2DEV(y1); long yy1 = YLOG2DEV(y1);
long xx2 = XLOG2DEV(x2); long xx2 = XLOG2DEV(x2);
@@ -1367,7 +1367,11 @@ void wxDC::MacInstallPen() const
::RGBBackColor( &backcolor ); ::RGBBackColor( &backcolor );
::PenNormal() ; ::PenNormal() ;
int penWidth = m_pen.GetWidth(); int penWidth = m_pen.GetWidth() * m_scaleX ;
// null means only one pixel, at whatever resolution
if ( penWidth == 0 )
penWidth = 1 ;
::PenSize(penWidth, penWidth); ::PenSize(penWidth, penWidth);
int penStyle = m_pen.GetStyle(); int penStyle = m_pen.GetStyle();

View File

@@ -29,9 +29,6 @@ wxPenRefData::wxPenRefData()
m_cap = wxCAP_ROUND ; m_cap = wxCAP_ROUND ;
m_nbDash = 0 ; m_nbDash = 0 ;
m_dash = 0 ; m_dash = 0 ;
/* TODO: null data
m_hPen = 0;
*/
} }
wxPenRefData::wxPenRefData(const wxPenRefData& data) wxPenRefData::wxPenRefData(const wxPenRefData& data)
@@ -43,14 +40,10 @@ wxPenRefData::wxPenRefData(const wxPenRefData& data)
m_nbDash = data.m_nbDash; m_nbDash = data.m_nbDash;
m_dash = data.m_dash; m_dash = data.m_dash;
m_colour = data.m_colour; m_colour = data.m_colour;
/* TODO: null data
m_hPen = 0;
*/
} }
wxPenRefData::~wxPenRefData() wxPenRefData::~wxPenRefData()
{ {
// TODO: delete data
} }
// Pens // Pens
@@ -195,8 +188,8 @@ void wxPen::SetCap(int Cap)
bool wxPen::RealizeResource() bool wxPen::RealizeResource()
{ {
// TODO: create actual pen // nothing to do here for mac
return FALSE; return TRUE;
} }

View File

@@ -45,8 +45,8 @@ long wxDC::m_macCurrentPortId = 1 ;
wxDC::wxDC() wxDC::wxDC()
{ {
m_ok = FALSE; m_ok = FALSE;
m_optimize = FALSE; // m_optimize = FALSE;
m_autoSetting = FALSE; // m_autoSetting = FALSE;
m_colour = TRUE; m_colour = TRUE;
m_clipping = FALSE; m_clipping = FALSE;
@@ -539,7 +539,7 @@ void wxDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 )
if (m_pen.GetStyle() != wxTRANSPARENT) if (m_pen.GetStyle() != wxTRANSPARENT)
{ {
MacInstallPen() ; MacInstallPen() ;
int offset = (m_pen.GetWidth() - 1) / 2 ; int offset = ( (m_pen.GetWidth() == 0 ? 1 : m_pen.GetWidth() ) * m_scaleX - 1) / 2 ;
long xx1 = XLOG2DEV(x1); long xx1 = XLOG2DEV(x1);
long yy1 = YLOG2DEV(y1); long yy1 = YLOG2DEV(y1);
long xx2 = XLOG2DEV(x2); long xx2 = XLOG2DEV(x2);
@@ -1367,7 +1367,11 @@ void wxDC::MacInstallPen() const
::RGBBackColor( &backcolor ); ::RGBBackColor( &backcolor );
::PenNormal() ; ::PenNormal() ;
int penWidth = m_pen.GetWidth(); int penWidth = m_pen.GetWidth() * m_scaleX ;
// null means only one pixel, at whatever resolution
if ( penWidth == 0 )
penWidth = 1 ;
::PenSize(penWidth, penWidth); ::PenSize(penWidth, penWidth);
int penStyle = m_pen.GetStyle(); int penStyle = m_pen.GetStyle();

View File

@@ -29,9 +29,6 @@ wxPenRefData::wxPenRefData()
m_cap = wxCAP_ROUND ; m_cap = wxCAP_ROUND ;
m_nbDash = 0 ; m_nbDash = 0 ;
m_dash = 0 ; m_dash = 0 ;
/* TODO: null data
m_hPen = 0;
*/
} }
wxPenRefData::wxPenRefData(const wxPenRefData& data) wxPenRefData::wxPenRefData(const wxPenRefData& data)
@@ -43,14 +40,10 @@ wxPenRefData::wxPenRefData(const wxPenRefData& data)
m_nbDash = data.m_nbDash; m_nbDash = data.m_nbDash;
m_dash = data.m_dash; m_dash = data.m_dash;
m_colour = data.m_colour; m_colour = data.m_colour;
/* TODO: null data
m_hPen = 0;
*/
} }
wxPenRefData::~wxPenRefData() wxPenRefData::~wxPenRefData()
{ {
// TODO: delete data
} }
// Pens // Pens
@@ -195,8 +188,8 @@ void wxPen::SetCap(int Cap)
bool wxPen::RealizeResource() bool wxPen::RealizeResource()
{ {
// TODO: create actual pen // nothing to do here for mac
return FALSE; return TRUE;
} }