From: Stefan Csomor Date: Sat, 3 Mar 2001 17:18:03 +0000 (+0000) Subject: mac changes : wxDC - removed doubly defined vars (inherited from base) and fixed... X-Git-Url: https://git.saurik.com/wxWidgets.git/commitdiff_plain/0b014ec713bbadb49460e4b23310fd325cdc0036?ds=inline 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 --- diff --git a/include/wx/mac/dc.h b/include/wx/mac/dc.h index cdf3e11a20..242a8825e5 100644 --- a/include/wx/mac/dc.h +++ b/include/wx/mac/dc.h @@ -424,34 +424,9 @@ protected: // public: - - 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? +//begin wxmac 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 // d.o. changes with scrolling. // Set using SetInternalDeviceOrigin(). @@ -459,24 +434,6 @@ protected: long m_externalDeviceOriginX,m_externalDeviceOriginY; // To be set by external classes // such as wxScrolledWindow // 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 ; GWorldPtr m_macMask ; diff --git a/src/mac/carbon/dc.cpp b/src/mac/carbon/dc.cpp index cbce6e301a..3cfe810af0 100644 --- a/src/mac/carbon/dc.cpp +++ b/src/mac/carbon/dc.cpp @@ -45,8 +45,8 @@ long wxDC::m_macCurrentPortId = 1 ; wxDC::wxDC() { m_ok = FALSE; - m_optimize = FALSE; - m_autoSetting = FALSE; +// m_optimize = FALSE; +// m_autoSetting = FALSE; m_colour = TRUE; m_clipping = FALSE; @@ -539,7 +539,7 @@ void wxDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) if (m_pen.GetStyle() != wxTRANSPARENT) { 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 yy1 = YLOG2DEV(y1); long xx2 = XLOG2DEV(x2); @@ -1367,7 +1367,11 @@ void wxDC::MacInstallPen() const ::RGBBackColor( &backcolor ); ::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); int penStyle = m_pen.GetStyle(); diff --git a/src/mac/carbon/pen.cpp b/src/mac/carbon/pen.cpp index 1e3ced2a3a..356fedcd6c 100644 --- a/src/mac/carbon/pen.cpp +++ b/src/mac/carbon/pen.cpp @@ -29,9 +29,6 @@ wxPenRefData::wxPenRefData() m_cap = wxCAP_ROUND ; m_nbDash = 0 ; m_dash = 0 ; -/* TODO: null data - m_hPen = 0; -*/ } wxPenRefData::wxPenRefData(const wxPenRefData& data) @@ -43,14 +40,10 @@ wxPenRefData::wxPenRefData(const wxPenRefData& data) m_nbDash = data.m_nbDash; m_dash = data.m_dash; m_colour = data.m_colour; -/* TODO: null data - m_hPen = 0; -*/ } wxPenRefData::~wxPenRefData() { - // TODO: delete data } // Pens @@ -195,8 +188,8 @@ void wxPen::SetCap(int Cap) bool wxPen::RealizeResource() { - // TODO: create actual pen - return FALSE; + // nothing to do here for mac + return TRUE; } diff --git a/src/mac/dc.cpp b/src/mac/dc.cpp index cbce6e301a..3cfe810af0 100644 --- a/src/mac/dc.cpp +++ b/src/mac/dc.cpp @@ -45,8 +45,8 @@ long wxDC::m_macCurrentPortId = 1 ; wxDC::wxDC() { m_ok = FALSE; - m_optimize = FALSE; - m_autoSetting = FALSE; +// m_optimize = FALSE; +// m_autoSetting = FALSE; m_colour = TRUE; m_clipping = FALSE; @@ -539,7 +539,7 @@ void wxDC::DoDrawLine( wxCoord x1, wxCoord y1, wxCoord x2, wxCoord y2 ) if (m_pen.GetStyle() != wxTRANSPARENT) { 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 yy1 = YLOG2DEV(y1); long xx2 = XLOG2DEV(x2); @@ -1367,7 +1367,11 @@ void wxDC::MacInstallPen() const ::RGBBackColor( &backcolor ); ::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); int penStyle = m_pen.GetStyle(); diff --git a/src/mac/pen.cpp b/src/mac/pen.cpp index 1e3ced2a3a..356fedcd6c 100644 --- a/src/mac/pen.cpp +++ b/src/mac/pen.cpp @@ -29,9 +29,6 @@ wxPenRefData::wxPenRefData() m_cap = wxCAP_ROUND ; m_nbDash = 0 ; m_dash = 0 ; -/* TODO: null data - m_hPen = 0; -*/ } wxPenRefData::wxPenRefData(const wxPenRefData& data) @@ -43,14 +40,10 @@ wxPenRefData::wxPenRefData(const wxPenRefData& data) m_nbDash = data.m_nbDash; m_dash = data.m_dash; m_colour = data.m_colour; -/* TODO: null data - m_hPen = 0; -*/ } wxPenRefData::~wxPenRefData() { - // TODO: delete data } // Pens @@ -195,8 +188,8 @@ void wxPen::SetCap(int Cap) bool wxPen::RealizeResource() { - // TODO: create actual pen - return FALSE; + // nothing to do here for mac + return TRUE; }