]> git.saurik.com Git - wxWidgets.git/commitdiff
try to clear the device/logical unit fog; remove unused and unsupported (an assertion...
authorFrancesco Montorsi <f18m_cpp217828@yahoo.it>
Wed, 25 Feb 2009 12:08:12 +0000 (12:08 +0000)
committerFrancesco Montorsi <f18m_cpp217828@yahoo.it>
Wed, 25 Feb 2009 12:08:12 +0000 (12:08 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@59127 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

include/wx/dc.h
interface/wx/dc.h
src/msw/metafile.cpp
src/os2/metafile.cpp

index f9fec15da9672f49314b29c7e8dc43bfdf562571..b9283143868731be6805bd441b80f988f4c3de04 100644 (file)
@@ -104,19 +104,14 @@ enum wxFloodFillStyle
     wxFLOOD_BORDER
 };
 
     wxFLOOD_BORDER
 };
 
-//  Mapping modes (same values as used by Windows, don't change)
+//  Mapping modes
 enum wxMappingMode
 {
     wxMM_TEXT = 1,
 enum wxMappingMode
 {
     wxMM_TEXT = 1,
+    wxMM_METRIC,
     wxMM_LOMETRIC,
     wxMM_LOMETRIC,
-    wxMM_HIMETRIC,
-    wxMM_LOENGLISH,
-    wxMM_HIENGLISH,
     wxMM_TWIPS,
     wxMM_TWIPS,
-    wxMM_ISOTROPIC,
-    wxMM_ANISOTROPIC,
-    wxMM_POINTS,
-    wxMM_METRIC
+    wxMM_POINTS
 };
 
 #if WXWIN_COMPATIBILITY_2_8
 };
 
 #if WXWIN_COMPATIBILITY_2_8
@@ -373,7 +368,7 @@ public:
     // logical functions
 
     virtual void SetLogicalFunction(wxRasterOperationMode function) = 0;
     // logical functions
 
     virtual void SetLogicalFunction(wxRasterOperationMode function) = 0;
-    virtual wxRasterOperationMode GetLogicalFunction() const 
+    virtual wxRasterOperationMode GetLogicalFunction() const
                                       { return m_logicalFunction; }
 
     // text measurement
                                       { return m_logicalFunction; }
 
     // text measurement
@@ -1134,7 +1129,7 @@ public:
 
     bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
               wxDC *source, wxCoord xsrc, wxCoord ysrc,
 
     bool Blit(wxCoord xdest, wxCoord ydest, wxCoord width, wxCoord height,
               wxDC *source, wxCoord xsrc, wxCoord ysrc,
-              wxRasterOperationMode rop = wxCOPY, bool useMask = false, 
+              wxRasterOperationMode rop = wxCOPY, bool useMask = false,
               wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord)
     {
         return m_pimpl->DoBlit(xdest, ydest, width, height,
               wxCoord xsrcMask = wxDefaultCoord, wxCoord ysrcMask = wxDefaultCoord)
     {
         return m_pimpl->DoBlit(xdest, ydest, width, height,
@@ -1142,7 +1137,7 @@ public:
     }
     bool Blit(const wxPoint& destPt, const wxSize& sz,
               wxDC *source, const wxPoint& srcPt,
     }
     bool Blit(const wxPoint& destPt, const wxSize& sz,
               wxDC *source, const wxPoint& srcPt,
-              wxRasterOperationMode rop = wxCOPY, bool useMask = false, 
+              wxRasterOperationMode rop = wxCOPY, bool useMask = false,
               const wxPoint& srcPtMask = wxDefaultPosition)
     {
         return m_pimpl->DoBlit(destPt.x, destPt.y, sz.x, sz.y,
               const wxPoint& srcPtMask = wxDefaultPosition)
     {
         return m_pimpl->DoBlit(destPt.x, destPt.y, sz.x, sz.y,
@@ -1162,7 +1157,7 @@ public:
     }
     bool StretchBlit(const wxPoint& dstPt, const wxSize& dstSize,
                      wxDC *source, const wxPoint& srcPt, const wxSize& srcSize,
     }
     bool StretchBlit(const wxPoint& dstPt, const wxSize& dstSize,
                      wxDC *source, const wxPoint& srcPt, const wxSize& srcSize,
-                     wxRasterOperationMode rop = wxCOPY, bool useMask = false, 
+                     wxRasterOperationMode rop = wxCOPY, bool useMask = false,
                      const wxPoint& srcMaskPt = wxDefaultPosition)
     {
         return m_pimpl->DoStretchBlit(dstPt.x, dstPt.y, dstSize.x, dstSize.y,
                      const wxPoint& srcMaskPt = wxDefaultPosition)
     {
         return m_pimpl->DoStretchBlit(dstPt.x, dstPt.y, dstSize.x, dstSize.y,
index e4d387bc6db41c1406781c59038e8c6bbb004656..b3c0ac441b3a88274bafc17f2b147a74cb7a1e3e 100644 (file)
@@ -49,33 +49,37 @@ enum wxFloodFillStyle
 };
 
 /**
 };
 
 /**
-    The mapping mode which can be used with wxDC::SetMapMode.
+    The mapping used to transform @e logical units to @e device units.
+    See wxDC::SetMapMode.
 */
 enum wxMappingMode
 {
 */
 enum wxMappingMode
 {
-    /** Each logical unit is 1 device pixel. */
+    /**
+        Each logical unit is 1 device pixel.
+        This is the default mapping mode for all wxDC-derived classes.
+    */
     wxMM_TEXT = 1,
 
     wxMM_TEXT = 1,
 
-    wxMM_LOMETRIC,
-    wxMM_HIMETRIC,
+    /** Each logical unit is 1 millimeter. */
+    wxMM_METRIC,
 
 
-    /** Each logical unit is 1/10 of a mm. */
-    wxMM_LOENGLISH,
-
-    wxMM_HIENGLISH,
+    /** Each logical unit is 1/10 of a millimeter. */
+    wxMM_LOMETRIC,
 
 
-    /** Each logical unit is 1/20 of a point, or 1/1440 of an inch. */
+    /**
+        Each logical unit is 1/20 of a @e "printer point", or 1/1440 of an inch
+        (also known as "twip"). Equivalent to about 17.64 micrometers.
+    */
     wxMM_TWIPS,
 
     wxMM_TWIPS,
 
-    wxMM_ISOTROPIC,
-    wxMM_ANISOTROPIC,
+    /**
+        Each logical unit is a @e "printer point" i.e. 1/72 of an inch.
+        Equivalent to about 353 micrometers.
+    */
+    wxMM_POINTS
+};
 
 
-    /** Each logical unit is a point, or 1/72 of an inch. */
-    wxMM_POINTS,
 
 
-    /** Each logical unit is 1 mm. */
-    wxMM_METRIC
-};
 
 /**
     @class wxDC
 
 /**
     @class wxDC
@@ -112,6 +116,23 @@ enum wxMappingMode
     or wxBrush that are built from wxColour use the colour's alpha values
     when stroking or filling.
 
     or wxBrush that are built from wxColour use the colour's alpha values
     when stroking or filling.
 
+
+    @section dc_units Device and logical units
+
+    In the wxDC context there is a distinction between @e logical units and @e device units.
+
+    @b Device units are the units native to the particular device; e.g. for a screen,
+    a device unit is a @e pixel. For a printer, the device unit is defined by the
+    resolution of the printer (usually given in @c DPI: dot-per-inch).
+
+    All wxDC functions use instead @b logical units, unless where explicitely
+    stated. Logical units are arbitrary units mapped to device units using
+    the current mapping mode (see wxDC::SetMapMode).
+
+    This mechanism allows to reuse the same code which prints on e.g. a window
+    on the screen to print on e.g. a paper.
+
+
     @library{wxcore}
     @category{dc,gdi}
 
     @library{wxcore}
     @category{dc,gdi}
 
@@ -121,9 +142,6 @@ enum wxMappingMode
     @todo Precise definition of default/initial state.
     @todo Pixelwise definition of operations (e.g. last point of a line not
           drawn).
     @todo Precise definition of default/initial state.
     @todo Pixelwise definition of operations (e.g. last point of a line not
           drawn).
-    @todo Coordinates: state clearly which type of coordinates are returned by
-          the various Get*Point() or similar functions - often they are client
-          coordinates but not always.
 */
 class wxDC : public wxObject
 {
 */
 class wxDC : public wxObject
 {
@@ -223,26 +241,26 @@ public:
     void DestroyClippingRegion();
 
     /**
     void DestroyClippingRegion();
 
     /**
-        Convert device X coordinate to logical coordinate, using the current
+        Convert @e device X coordinate to logical coordinate, using the current
         mapping mode, user scale factor, device origin and axis orientation.
     */
     wxCoord DeviceToLogicalX(wxCoord x) const;
 
     /**
         mapping mode, user scale factor, device origin and axis orientation.
     */
     wxCoord DeviceToLogicalX(wxCoord x) const;
 
     /**
-        Convert device X coordinate to relative logical coordinate, using the
+        Convert @e device X coordinate to relative logical coordinate, using the
         current mapping mode and user scale factor but ignoring the
         axis orientation. Use this for converting a width, for example.
     */
     wxCoord DeviceToLogicalXRel(wxCoord x) const;
 
     /**
         current mapping mode and user scale factor but ignoring the
         axis orientation. Use this for converting a width, for example.
     */
     wxCoord DeviceToLogicalXRel(wxCoord x) const;
 
     /**
-        Converts device Y coordinate to logical coordinate, using the current
+        Converts @e device Y coordinate to logical coordinate, using the current
         mapping mode, user scale factor, device origin and axis orientation.
     */
     wxCoord DeviceToLogicalY(wxCoord y) const;
 
     /**
         mapping mode, user scale factor, device origin and axis orientation.
     */
     wxCoord DeviceToLogicalY(wxCoord y) const;
 
     /**
-        Convert device Y coordinate to relative logical coordinate, using the
+        Convert @e device Y coordinate to relative logical coordinate, using the
         current mapping mode and user scale factor but ignoring the
         axis orientation. Use this for converting a height, for example.
     */
         current mapping mode and user scale factor but ignoring the
         axis orientation. Use this for converting a height, for example.
     */
@@ -618,7 +636,7 @@ public:
     wxRasterOperationMode GetLogicalFunction() const;
 
     /**
     wxRasterOperationMode GetLogicalFunction() const;
 
     /**
-        Gets the mapping mode for the device context.
+        Gets the current mapping mode for the device context.
 
         @see SetMapMode()
     */
 
         @see SetMapMode()
     */
@@ -700,8 +718,8 @@ public:
 
     //@{
     /**
 
     //@{
     /**
-        This gets the horizontal and vertical resolution in device units. It
-        can be used to scale graphics to fit the page.
+        Gets the horizontal and vertical extent of this device context in @e device units.
+        It can be used to scale graphics to fit the page.
 
         For example, if @e maxX and @e maxY represent the maximum horizontal
         and vertical 'pixel' values used in your application, the following
 
         For example, if @e maxX and @e maxY represent the maximum horizontal
         and vertical 'pixel' values used in your application, the following
@@ -987,7 +1005,7 @@ public:
 
     /**
         The mapping mode of the device context defines the unit of measurement
 
     /**
         The mapping mode of the device context defines the unit of measurement
-        used to convert logical units to device units.
+        used to convert @e logical units to @e device units.
 
         Note that in X, text drawing isn't handled consistently with the mapping mode;
         a font is always specified in point size. However, setting the user scale (see
 
         Note that in X, text drawing isn't handled consistently with the mapping mode;
         a font is always specified in point size. However, setting the user scale (see
index 1f5593027ebd8123ef1f27556e78d99d8647a6fb..e66cef4a80c937061193e7dc28fbd00d686c099e 100644 (file)
@@ -64,7 +64,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC)
 wxMetafileRefData::wxMetafileRefData()
 {
     m_metafile = 0;
 wxMetafileRefData::wxMetafileRefData()
 {
     m_metafile = 0;
-    m_windowsMappingMode = wxMM_ANISOTROPIC;
+    m_windowsMappingMode = MM_ANISOTROPIC;
     m_width = m_height = 0;
 }
 
     m_width = m_height = 0;
 }
 
@@ -85,7 +85,7 @@ wxMetafile::wxMetafile(const wxString& file)
 {
     m_refData = new wxMetafileRefData;
 
 {
     m_refData = new wxMetafileRefData;
 
-    M_METAFILEDATA->m_windowsMappingMode = wxMM_ANISOTROPIC;
+    M_METAFILEDATA->m_windowsMappingMode = MM_ANISOTROPIC;
     M_METAFILEDATA->m_metafile = 0;
     if (!file.empty())
         M_METAFILEDATA->m_metafile = (WXHANDLE) GetMetaFile(file);
     M_METAFILEDATA->m_metafile = 0;
     if (!file.empty())
         M_METAFILEDATA->m_metafile = (WXHANDLE) GetMetaFile(file);
@@ -213,7 +213,7 @@ wxMetafileDCImpl::wxMetafileDCImpl(wxDC *owner, const wxString& file,
     ::SetWindowExtEx((HDC) m_hDC,xext,yext, NULL);
 
     // Actual Windows mapping mode, for future reference.
     ::SetWindowExtEx((HDC) m_hDC,xext,yext, NULL);
 
     // Actual Windows mapping mode, for future reference.
-    m_windowsMappingMode = wxMM_ANISOTROPIC;
+    m_windowsMappingMode = MM_ANISOTROPIC;
 
     SetMapMode(wxMM_TEXT); // NOTE: does not set HDC mapmode (this is correct)
 }
 
     SetMapMode(wxMM_TEXT); // NOTE: does not set HDC mapmode (this is correct)
 }
index 4cc420425b1d63b580597bacaab1f422d636d897..755d4658ccb9c4fa46e13c5dd2a2fc40df4da784 100644 (file)
@@ -40,7 +40,7 @@ IMPLEMENT_ABSTRACT_CLASS(wxMetafileDC, wxDC)
 wxMetafileRefData::wxMetafileRefData(void)
 {
     m_metafile = 0;
 wxMetafileRefData::wxMetafileRefData(void)
 {
     m_metafile = 0;
-    m_windowsMappingMode = wxMM_ANISOTROPIC;
+    m_windowsMappingMode = MM_ANISOTROPIC;
 }
 
 wxMetafileRefData::~wxMetafileRefData(void)
 }
 
 wxMetafileRefData::~wxMetafileRefData(void)
@@ -56,7 +56,7 @@ wxMetafile::wxMetafile(const wxString& file)
 {
     m_refData = new wxMetafileRefData;
 
 {
     m_refData = new wxMetafileRefData;
 
-    M_METAFILEDATA->m_windowsMappingMode = wxMM_ANISOTROPIC;
+    M_METAFILEDATA->m_windowsMappingMode = MM_ANISOTROPIC;
     M_METAFILEDATA->m_metafile = 0;
     if (!file.empty())
         M_METAFILEDATA->m_metafile = (WXHANDLE)0; // TODO: GetMetaFile(file);
     M_METAFILEDATA->m_metafile = 0;
     if (!file.empty())
         M_METAFILEDATA->m_metafile = (WXHANDLE)0; // TODO: GetMetaFile(file);
@@ -185,7 +185,7 @@ wxMetafileDCImpl::wxMetafileDCImpl( wxDC *owner, const wxString& file,
 //  ::SetWindowExtEx((HDC) m_hDC,xext,yext, NULL);
 
     // Actual Windows mapping mode, for future reference.
 //  ::SetWindowExtEx((HDC) m_hDC,xext,yext, NULL);
 
     // Actual Windows mapping mode, for future reference.
-    m_windowsMappingMode = wxMM_ANISOTROPIC;
+    m_windowsMappingMode = MM_ANISOTROPIC;
 
     SetMapMode(wxMM_TEXT); // NOTE: does not set HDC mapmode (this is correct)
 }
 
     SetMapMode(wxMM_TEXT); // NOTE: does not set HDC mapmode (this is correct)
 }