]> git.saurik.com Git - wxWidgets.git/commitdiff
Moved all the coordinate system calculation to wxDCBase
authorRobert Roebling <robert@roebling.de>
Wed, 2 May 2007 11:05:45 +0000 (11:05 +0000)
committerRobert Roebling <robert@roebling.de>
Wed, 2 May 2007 11:05:45 +0000 (11:05 +0000)
   and thus removed all the duplicated code in all wxDC
   classes.
  Problematic is that wxSVGFileDC and wxPostscriptDC inherit
   from wxDC and therefore include platform specific code
   (also before this change) so I chose to override all
   SetLogicalOrigin() etc. methods in these classes and
   call their wxDCBase methods thereby circumventing the
   platform dependent code.
  I'm afraid the Mac code will require updating, too.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@45752 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

27 files changed:
include/wx/dc.h
include/wx/dcsvg.h
include/wx/dfb/dc.h
include/wx/generic/dcpsg.h
include/wx/gtk/dc.h
include/wx/gtk1/dc.h
include/wx/mac/carbon/dc.h
include/wx/mgl/dc.h
include/wx/motif/dc.h
include/wx/msw/dc.h
include/wx/os2/dc.h
include/wx/x11/dc.h
src/common/dcbase.cpp
src/common/dcsvg.cpp
src/dfb/dc.cpp
src/generic/dcpsg.cpp
src/gtk/dc.cpp
src/gtk1/dc.cpp
src/mac/carbon/dc.cpp
src/mac/carbon/dcclient.cpp
src/mac/carbon/dcprint.cpp
src/mac/carbon/dcscreen.cpp
src/mgl/dc.cpp
src/motif/dc.cpp
src/msw/dc.cpp
src/os2/dc.cpp
src/x11/dc.cpp

index e0ace2828f9ec9d9f1ee30054cc3d1166d58ef27..a5577528a69c34555b93b48a487b9f8594502e84 100644 (file)
@@ -101,40 +101,9 @@ protected:
 class WXDLLEXPORT wxDCBase : public wxObject
 {
 public:
 class WXDLLEXPORT wxDCBase : public wxObject
 {
 public:
-    wxDCBase()
-        : m_colour(wxColourDisplay())
-        , m_ok(true)
-        , m_clipping(false)
-        , m_isInteractive(0)
-        , m_isBBoxValid(false)
-        , m_logicalOriginX(0), m_logicalOriginY(0)
-        , m_deviceOriginX(0), m_deviceOriginY(0)
-        , m_logicalScaleX(1.0), m_logicalScaleY(1.0)
-        , m_userScaleX(1.0), m_userScaleY(1.0)
-        , m_scaleX(1.0), m_scaleY(1.0)
-        , m_signX(1), m_signY(1)
-        , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0)
-        , m_clipX1(0), m_clipY1(0), m_clipX2(0), m_clipY2(0)
-        , m_logicalFunction(wxCOPY)
-        , m_backgroundMode(wxTRANSPARENT)
-        , m_mappingMode(wxMM_TEXT)
-        , m_pen()
-        , m_brush()
-        , m_backgroundBrush(*wxTRANSPARENT_BRUSH)
-        , m_textForegroundColour(*wxBLACK)
-        , m_textBackgroundColour(*wxWHITE)
-        , m_font()
-#if wxUSE_PALETTE
-        , m_palette()
-        , m_hasCustomPalette(false)
-#endif // wxUSE_PALETTE
-    {
-        ResetBoundingBox();
-        ResetClipping();
-    }
-
-    virtual ~wxDCBase() { }
-
+    wxDCBase();
+    virtual ~wxDCBase();
+    
     // graphic primitives
     // ------------------
 
     // graphic primitives
     // ------------------
 
@@ -511,20 +480,6 @@ public:
         return wxSize(w, h);
     }
 
         return wxSize(w, h);
     }
 
-    // coordinates conversions
-    // -----------------------
-
-    // This group of functions does actual conversion of the input, as you'd
-    // expect.
-    virtual wxCoord DeviceToLogicalX(wxCoord x) const = 0;
-    virtual wxCoord DeviceToLogicalY(wxCoord y) const = 0;
-    virtual wxCoord DeviceToLogicalXRel(wxCoord x) const = 0;
-    virtual wxCoord DeviceToLogicalYRel(wxCoord y) const = 0;
-    virtual wxCoord LogicalToDeviceX(wxCoord x) const = 0;
-    virtual wxCoord LogicalToDeviceY(wxCoord y) const = 0;
-    virtual wxCoord LogicalToDeviceXRel(wxCoord x) const = 0;
-    virtual wxCoord LogicalToDeviceYRel(wxCoord y) const = 0;
-
     // query DC capabilities
     // ---------------------
 
     // query DC capabilities
     // ---------------------
 
@@ -556,43 +511,60 @@ public:
     virtual void SetTextBackground(const wxColour& colour)
         { m_textBackgroundColour = colour; }
 
     virtual void SetTextBackground(const wxColour& colour)
         { m_textBackgroundColour = colour; }
 
+
+    // coordinates conversions and transforms
+    // --------------------------------------
+
+    virtual wxCoord DeviceToLogicalX(wxCoord x) const;
+    virtual wxCoord DeviceToLogicalY(wxCoord y) const;
+    virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
+    virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
+    virtual wxCoord LogicalToDeviceX(wxCoord x) const;
+    virtual wxCoord LogicalToDeviceY(wxCoord y) const;
+    virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
+    virtual wxCoord LogicalToDeviceYRel(wxCoord y) const;
+
+    virtual void SetMapMode(int mode);
     virtual int GetMapMode() const { return m_mappingMode; }
     virtual int GetMapMode() const { return m_mappingMode; }
-    virtual void SetMapMode(int mode) = 0;
 
 
+    virtual void SetUserScale(double x, double y);
     virtual void GetUserScale(double *x, double *y) const
     {
         if ( x ) *x = m_userScaleX;
         if ( y ) *y = m_userScaleY;
     }
     virtual void GetUserScale(double *x, double *y) const
     {
         if ( x ) *x = m_userScaleX;
         if ( y ) *y = m_userScaleY;
     }
-    virtual void SetUserScale(double x, double y) = 0;
 
 
+    virtual void SetLogicalScale(double x, double y);
     virtual void GetLogicalScale(double *x, double *y)
     {
         if ( x ) *x = m_logicalScaleX;
         if ( y ) *y = m_logicalScaleY;
     }
     virtual void GetLogicalScale(double *x, double *y)
     {
         if ( x ) *x = m_logicalScaleX;
         if ( y ) *y = m_logicalScaleY;
     }
-    virtual void SetLogicalScale(double x, double y)
-    {
-        m_logicalScaleX = x;
-        m_logicalScaleY = y;
-    }
 
 
+    virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
     void GetLogicalOrigin(wxCoord *x, wxCoord *y) const
         { DoGetLogicalOrigin(x, y); }
     wxPoint GetLogicalOrigin() const
         { wxCoord x, y; DoGetLogicalOrigin(&x, &y); return wxPoint(x, y); }
     void GetLogicalOrigin(wxCoord *x, wxCoord *y) const
         { DoGetLogicalOrigin(x, y); }
     wxPoint GetLogicalOrigin() const
         { wxCoord x, y; DoGetLogicalOrigin(&x, &y); return wxPoint(x, y); }
-    virtual void SetLogicalOrigin(wxCoord x, wxCoord y) = 0;
 
 
+    virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
     void GetDeviceOrigin(wxCoord *x, wxCoord *y) const
         { DoGetDeviceOrigin(x, y); }
     wxPoint GetDeviceOrigin() const
         { wxCoord x, y; DoGetDeviceOrigin(&x, &y); return wxPoint(x, y); }
     void GetDeviceOrigin(wxCoord *x, wxCoord *y) const
         { DoGetDeviceOrigin(x, y); }
     wxPoint GetDeviceOrigin() const
         { wxCoord x, y; DoGetDeviceOrigin(&x, &y); return wxPoint(x, y); }
-    virtual void SetDeviceOrigin(wxCoord x, wxCoord y) = 0;
+        
+    virtual void SetDeviceLocalOrigin( wxCoord x, wxCoord y );
 
 
-    virtual void ComputeScaleAndOrigin() {}
+    virtual void ComputeScaleAndOrigin();
 
 
-    virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp) = 0;
+    // this needs to overidden if the axis is inverted (such
+    // as when using Postscript, where 0,0 is the lower left
+    // corner, not the upper left).
+    virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
 
 
+    // logical functions
+    // ---------------------------
+    
     virtual int GetLogicalFunction() const { return m_logicalFunction; }
     virtual void SetLogicalFunction(int function) = 0;
 
     virtual int GetLogicalFunction() const { return m_logicalFunction; }
     virtual void SetLogicalFunction(int function) = 0;
 
@@ -836,15 +808,25 @@ protected:
     // TODO short descriptions of what exactly they are would be nice...
 
     wxCoord m_logicalOriginX, m_logicalOriginY;
     // TODO short descriptions of what exactly they are would be nice...
 
     wxCoord m_logicalOriginX, m_logicalOriginY;
-    wxCoord m_deviceOriginX, m_deviceOriginY;
-
+    wxCoord m_deviceOriginX, m_deviceOriginY;           // Usually 0,0, can be change by user
+    
+    wxCoord m_deviceLocalOriginX, m_deviceLocalOriginY; // non-zero if native top-left corner
+                                                        // is not at 0,0. This was the case under
+                                                        // Mac's GrafPorts (coordinate system
+                                                        // used toplevel window's origin) and
+                                                        // e.g. for Postscript, where the native
+                                                        // origin in the bottom left corner.
     double m_logicalScaleX, m_logicalScaleY;
     double m_userScaleX, m_userScaleY;
     double m_logicalScaleX, m_logicalScaleY;
     double m_userScaleX, m_userScaleY;
-    double m_scaleX, m_scaleY;
+    double m_scaleX, m_scaleY;  // calculated from logical scale and user scale
 
     // Used by SetAxisOrientation() to invert the axes
     int m_signX, m_signY;
 
 
     // Used by SetAxisOrientation() to invert the axes
     int m_signX, m_signY;
 
+    // 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;
+                 
     // bounding and clipping boxes
     wxCoord m_minX, m_minY, m_maxX, m_maxY;
     wxCoord m_clipX1, m_clipY1, m_clipX2, m_clipY2;
     // bounding and clipping boxes
     wxCoord m_minX, m_minY, m_maxX, m_maxY;
     wxCoord m_clipX1, m_clipY1, m_clipX2, m_clipY2;
index 14d922409ce86dad2a4c31808af85ce47df34d1a..a14a1ee31cf2612895d7ce734ca0f1f05556b427 100644 (file)
@@ -46,47 +46,38 @@ public:
     wxCoord GetCharHeight() const;
     wxCoord GetCharWidth() const;
 
     wxCoord GetCharHeight() const;
     wxCoord GetCharWidth() const;
 
-        void SetClippingRegion(wxCoord  WXUNUSED(x), wxCoord  WXUNUSED(y), wxCoord  WXUNUSED(width), wxCoord  WXUNUSED(height))
+    void SetClippingRegion(wxCoord  WXUNUSED(x), wxCoord  WXUNUSED(y), wxCoord  WXUNUSED(width), wxCoord  WXUNUSED(height))
             { wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetClippingRegion not implemented")); return ; }
 
             { wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetClippingRegion not implemented")); return ; }
 
-        void SetPalette(const wxPalette&  WXUNUSED(palette))
+    void SetPalette(const wxPalette&  WXUNUSED(palette))
             { wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetPalette not implemented")); return ; }
 
             { wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetPalette not implemented")); return ; }
 
-        void GetClippingBox(wxCoord *WXUNUSED(x), wxCoord *WXUNUSED(y), wxCoord * WXUNUSED(width), wxCoord * WXUNUSED(height))
+    void GetClippingBox(wxCoord *WXUNUSED(x), wxCoord *WXUNUSED(y), wxCoord * WXUNUSED(width), wxCoord * WXUNUSED(height))
             { wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetClippingBox not implemented")); return ; }
 
             { wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetClippingBox not implemented")); return ; }
 
-        void SetLogicalFunction(int  WXUNUSED(function))
+    void SetLogicalFunction(int  WXUNUSED(function))
             { wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetLogicalFunction Call not implemented")); return ; }
 
             { wxASSERT_MSG (false, wxT("wxSVGFILEDC::SetLogicalFunction Call not implemented")); return ; }
 
-        int GetLogicalFunction() const
+    int GetLogicalFunction() const
             { wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetLogicalFunction() not implemented")); return wxCOPY ; }
 
             { wxASSERT_MSG (false, wxT("wxSVGFILEDC::GetLogicalFunction() not implemented")); return wxCOPY ; }
 
-        void SetBackground( const wxBrush &brush ) ;
-        void SetBackgroundMode( int mode ) ;
-        void SetBrush(const wxBrush& brush) ;
-        void SetFont(const wxFont& font) ;
-        void SetPen(const wxPen& pen)  ;
+    void SetBackground( const wxBrush &brush ) ;
+    void SetBackgroundMode( int mode ) ;
+    void SetBrush(const wxBrush& brush) ;
+    void SetFont(const wxFont& font) ;
+    void SetPen(const wxPen& pen)  ;
           
           
-        bool IsOk() const {return m_OK;}
-
-    virtual wxCoord DeviceToLogicalX(wxCoord x) const;
-    virtual wxCoord DeviceToLogicalY(wxCoord y) const;
-    virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
-    virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
-    virtual wxCoord LogicalToDeviceX(wxCoord x) const;
-    virtual wxCoord LogicalToDeviceY(wxCoord y) const;
-    virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
-    virtual wxCoord LogicalToDeviceYRel(wxCoord y) const ;
+    bool IsOk() const {return m_OK;}
 
 
+    // these need to be overridden as wxPostscriptDC inherits
+    // from the platform dependent wxDC and this we'd call
+    // e.g. wxMSW specific code here.
     virtual void SetMapMode( int mode );
     virtual void SetUserScale( double x, double y );
     virtual void SetLogicalScale( double x, double y );
     virtual void SetLogicalOrigin( wxCoord x, wxCoord y );
     virtual void SetDeviceOrigin( wxCoord x, wxCoord y );
     virtual void SetMapMode( int mode );
     virtual void SetUserScale( double x, double y );
     virtual void SetLogicalScale( double x, double y );
     virtual void SetLogicalOrigin( wxCoord x, wxCoord y );
     virtual void SetDeviceOrigin( wxCoord x, wxCoord y );
-
-    virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
-
-    virtual void ComputeScaleAndOrigin();
+    void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
 
 private:
         bool DoGetPixel(wxCoord, wxCoord, class wxColour *) const
 
 private:
         bool DoGetPixel(wxCoord, wxCoord, class wxColour *) const
@@ -150,7 +141,6 @@ private:
     bool                m_OK;
     bool                m_graphics_changed;
     int                 m_width, m_height;
     bool                m_OK;
     bool                m_graphics_changed;
     int                 m_width, m_height;
-    double              m_mm_to_pix_x, m_mm_to_pix_y;
     
 private:
     DECLARE_ABSTRACT_CLASS(wxSVGFileDC)
     
 private:
     DECLARE_ABSTRACT_CLASS(wxSVGFileDC)
index 5bfed574b7936a6da2c070af36f9fb693b0ec592..717be0a84461392c89b381d98732d518ce0bdfb0 100644 (file)
@@ -65,65 +65,20 @@ public:
     virtual int GetDepth() const;
     virtual wxSize GetPPI() const;
 
     virtual int GetDepth() const;
     virtual wxSize GetPPI() const;
 
-    virtual void SetMapMode(int mode);
-    virtual void SetUserScale(double x, double y);
-    virtual void SetLogicalScale(double x, double y);
-    virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
-    virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
-    virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
-    virtual void SetLogicalFunction(int function);
-
-    virtual wxCoord DeviceToLogicalX(wxCoord x) const;
-    virtual wxCoord DeviceToLogicalY(wxCoord y) const;
-    virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
-    virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
-    virtual wxCoord LogicalToDeviceX(wxCoord x) const;
-    virtual wxCoord LogicalToDeviceY(wxCoord y) const;
-    virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
-    virtual wxCoord LogicalToDeviceYRel(wxCoord y) const ;
-    
-    // implementation from now on
-    // --------------------------
-
-    virtual void ComputeScaleAndOrigin();
-
-    wxCoord XDEV2LOG(wxCoord x) const
-    {
-        return wxRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
-    }
-    wxCoord XDEV2LOGREL(wxCoord x) const
-    {
-        return wxRound((double)(x) / m_scaleX);
-    }
-    wxCoord YDEV2LOG(wxCoord y) const
-    {
-        return wxRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
-    }
-    wxCoord YDEV2LOGREL(wxCoord y) const
-    {
-        return wxRound((double)(y) / m_scaleY);
-    }
-    wxCoord XLOG2DEV(wxCoord x) const
-    {
-        return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
-    }
-    wxCoord XLOG2DEVREL(wxCoord x) const
-    {
-        return wxRound((double)(x) * m_scaleX);
-    }
-    wxCoord YLOG2DEV(wxCoord y) const
-    {
-        return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
-    }
-    wxCoord YLOG2DEVREL(wxCoord y) const
-    {
-        return wxRound((double)(y) * m_scaleY);
-    }
-
     // Returns the surface (and increases its ref count)
     wxIDirectFBSurfacePtr GetDirectFBSurface() const { return m_surface; }
 
 protected:
     // Returns the surface (and increases its ref count)
     wxIDirectFBSurfacePtr GetDirectFBSurface() const { return m_surface; }
 
 protected:
+    // implementation
+    wxCoord XDEV2LOG(wxCoord x) const       { return DeviceToLogicalX(x); }
+    wxCoord XDEV2LOGREL(wxCoord x) const    { return DeviceToLogicalXRel(x); }
+    wxCoord YDEV2LOG(wxCoord y) const       { return DeviceToLogicalY(y); }
+    wxCoord YDEV2LOGREL(wxCoord y) const    { return DeviceToLogicalYRel(y); }
+    wxCoord XLOG2DEV(wxCoord x) const       { return LogicalToDeviceX(x); }
+    wxCoord XLOG2DEVREL(wxCoord x) const    { return LogicalToDeviceXRel(x); }
+    wxCoord YLOG2DEV(wxCoord y) const       { return LogicalToDeviceY(y); }
+    wxCoord YLOG2DEVREL(wxCoord y) const    { return LogicalToDeviceYRel(y); }
+    
     // initializes the DC from a surface, must be called if default ctor
     // was used
     void DFBInit(const wxIDirectFBSurfacePtr& surface);
     // initializes the DC from a surface, must be called if default ctor
     // was used
     void DFBInit(const wxIDirectFBSurfacePtr& surface);
index f1932134d85afd3f5bbebfa2e0bcf5ce54eae7ec..2d6fa5955a8ebd29bd1c4fb60b6838fbb839da10 100644 (file)
@@ -42,59 +42,67 @@ public:
 
     // Recommended constructor
     wxPostScriptDC(const wxPrintData& printData);
 
     // Recommended constructor
     wxPostScriptDC(const wxPrintData& printData);
-
-    // Recommended destructor :-)
+    
     virtual ~wxPostScriptDC();
 
     virtual ~wxPostScriptDC();
 
-  virtual bool Ok() const { return IsOk(); }
-  virtual bool IsOk() const;
+    virtual bool Ok() const { return IsOk(); }
+    virtual bool IsOk() const;
 
 
-  bool CanDrawBitmap() const { return true; }
+    bool CanDrawBitmap() const { return true; }
 
 
-  void Clear();
-  void SetFont( const wxFont& font );
-  void SetPen( const wxPen& pen );
-  void SetBrush( const wxBrush& brush );
-  void SetLogicalFunction( int function );
-  void SetBackground( const wxBrush& brush );
+    void Clear();
+    void SetFont( const wxFont& font );
+    void SetPen( const wxPen& pen );
+    void SetBrush( const wxBrush& brush );
+    void SetLogicalFunction( int function );
+    void SetBackground( const wxBrush& brush );
 
 
-  void DestroyClippingRegion();
+    void DestroyClippingRegion();
 
 
-  bool StartDoc(const wxString& message);
-  void EndDoc();
-  void StartPage();
-  void EndPage();
+    bool StartDoc(const wxString& message);
+    void EndDoc();
+    void StartPage();
+    void EndPage();
 
 
-  wxCoord GetCharHeight() const;
-  wxCoord GetCharWidth() const;
-  bool CanGetTextExtent() const { return true; }
+    wxCoord GetCharHeight() const;
+    wxCoord GetCharWidth() const;
+    bool CanGetTextExtent() const { return true; }
 
 
-  // Resolution in pixels per logical inch
-  wxSize GetPPI() const;
+    // Resolution in pixels per logical inch
+    wxSize GetPPI() const;
 
 
-  void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
-  void SetDeviceOrigin( wxCoord x, wxCoord y );
+    // overridden because origin is bottom left and
+    // axes are inverted
+    void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
+    
+    // these need to be overridden as wxPostscriptDC inherits
+    // from the platform dependent wxDC and this we'd call
+    // e.g. wxMSW specific code here.
+    virtual void SetMapMode(int mode);
+    virtual void SetUserScale(double x, double y);
+    virtual void SetLogicalScale(double x, double y);
+    virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
+    virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
 
 
-  void SetBackgroundMode(int WXUNUSED(mode)) { }
-  void SetPalette(const wxPalette& WXUNUSED(palette)) { }
+    void SetBackgroundMode(int WXUNUSED(mode)) { }
+    void SetPalette(const wxPalette& WXUNUSED(palette)) { }
 
 
-  wxPrintData& GetPrintData() { return m_printData; }
-  void SetPrintData(const wxPrintData& data) { m_printData = data; }
+    void SetPrintData(const wxPrintData& data);
+    wxPrintData& GetPrintData() { return m_printData; }
 
 
-  virtual int GetDepth() const { return 24; }
+    virtual int GetDepth() const { return 24; }
 
 
-  static void SetResolution(int ppi);
-  static int GetResolution();
+    static void SetResolution(int ppi);
+    static int GetResolution();
 
 
-  WX_DEFINE_VARARG_FUNC_VOID(PsPrintf, 1, (const wxString&), DoPsPrintfFormat)
+    WX_DEFINE_VARARG_FUNC_VOID(PsPrintf, 1, (const wxString&), DoPsPrintfFormat)
 #ifdef __WATCOMC__
     // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
 #ifdef __WATCOMC__
     // workaround for http://bugzilla.openwatcom.org/show_bug.cgi?id=351
-  WX_DEFINE_VARARG_FUNC_VOID(PsPrintf, 1, (const char*), DoPsPrintfFormat)
-  WX_DEFINE_VARARG_FUNC_VOID(PsPrintf, 1, (const wchar_t*), DoPsPrintfFormat)
+    WX_DEFINE_VARARG_FUNC_VOID(PsPrintf, 1, (const char*), DoPsPrintfFormat)
+    WX_DEFINE_VARARG_FUNC_VOID(PsPrintf, 1, (const wchar_t*), DoPsPrintfFormat)
 #endif
 #endif
-
-  void PsPrint( const wxString& psdata );
-  void PsPrint( int ch );
+    void PsPrint( const wxString& psdata );
+    void PsPrint( int ch );
 
 private:
     void DoPsPrintfFormat(const wxString& fmt, ... );
 
 private:
     void DoPsPrintfFormat(const wxString& fmt, ... );
index 3faf7252e216e020f69f1a426eb8147b78b2665a..48503572df8d6585dc9438622d6c411d909cb0df 100644 (file)
 #ifndef __GTKDCH__
 #define __GTKDCH__
 
 #ifndef __GTKDCH__
 #define __GTKDCH__
 
-//-----------------------------------------------------------------------------
-// constants
-//-----------------------------------------------------------------------------
-
-#ifndef MM_TEXT
-#define MM_TEXT         0
-#define MM_ISOTROPIC    1
-#define MM_ANISOTROPIC  2
-#define MM_LOMETRIC     3
-#define MM_HIMETRIC     4
-#define MM_TWIPS        5
-#define MM_POINTS       6
-#define MM_METRIC       7
-#endif
-
 //-----------------------------------------------------------------------------
 // wxDC
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // wxDC
 //-----------------------------------------------------------------------------
@@ -47,80 +32,23 @@ public:
     virtual void StartPage() { }
     virtual void EndPage() { }
 
     virtual void StartPage() { }
     virtual void EndPage() { }
 
-    virtual wxCoord DeviceToLogicalX(wxCoord x) const;
-    virtual wxCoord DeviceToLogicalY(wxCoord y) const;
-    virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
-    virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
-    virtual wxCoord LogicalToDeviceX(wxCoord x) const;
-    virtual wxCoord LogicalToDeviceY(wxCoord y) const;
-    virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
-    virtual wxCoord LogicalToDeviceYRel(wxCoord y) const ;
-
-    virtual void SetMapMode( int mode );
-    virtual void SetUserScale( double x, double y );
-    virtual void SetLogicalScale( double x, double y );
-    virtual void SetLogicalOrigin( wxCoord x, wxCoord y );
-    virtual void SetDeviceOrigin( wxCoord x, wxCoord y );
-
-    virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
-
-    virtual void ComputeScaleAndOrigin();
-
     virtual GdkWindow* GetGDKWindow() const { return NULL; }
 
 protected:
     // implementation
     virtual GdkWindow* GetGDKWindow() const { return NULL; }
 
 protected:
     // implementation
-    // --------------
-
-    wxCoord XDEV2LOG(wxCoord x) const
-    {
-        return DeviceToLogicalX(x);
-    }
-    wxCoord XDEV2LOGREL(wxCoord x) const
-    {
-        return DeviceToLogicalXRel(x);
-    }
-    wxCoord YDEV2LOG(wxCoord y) const
-    {
-        return DeviceToLogicalY(y);
-    }
-    wxCoord YDEV2LOGREL(wxCoord y) const
-    {
-        return DeviceToLogicalYRel(y);
-    }
-    wxCoord XLOG2DEV(wxCoord x) const
-    {
-        return LogicalToDeviceX(x);
-    }
-    wxCoord XLOG2DEVREL(wxCoord x) const
-    {
-        return LogicalToDeviceXRel(x);
-    }
-    wxCoord YLOG2DEV(wxCoord y) const
-    {
-        return LogicalToDeviceY(y);
-    }
-    wxCoord YLOG2DEVREL(wxCoord y) const
-    {
-        return LogicalToDeviceYRel(y);
-    }
+    wxCoord XDEV2LOG(wxCoord x) const       { return DeviceToLogicalX(x); }
+    wxCoord XDEV2LOGREL(wxCoord x) const    { return DeviceToLogicalXRel(x); }
+    wxCoord YDEV2LOG(wxCoord y) const       { return DeviceToLogicalY(y); }
+    wxCoord YDEV2LOGREL(wxCoord y) const    { return DeviceToLogicalYRel(y); }
+    wxCoord XLOG2DEV(wxCoord x) const       { return LogicalToDeviceX(x); }
+    wxCoord XLOG2DEVREL(wxCoord x) const    { return LogicalToDeviceXRel(x); }
+    wxCoord YLOG2DEV(wxCoord y) const       { return LogicalToDeviceY(y); }
+    wxCoord YLOG2DEVREL(wxCoord y) const    { return LogicalToDeviceYRel(y); }
 
     // base class pure virtuals implemented here
     virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
     virtual void DoGetSizeMM(int* width, int* height) const;
 
 
     // base class pure virtuals implemented here
     virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
     virtual void DoGetSizeMM(int* width, int* height) const;
 
-public:
-    // GTK-specific member variables
-
-    // 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;
-
-    bool         m_needComputeScaleX,
-                 m_needComputeScaleY; // not yet used
-
-
 private:
     DECLARE_ABSTRACT_CLASS(wxDC)
 };
 private:
     DECLARE_ABSTRACT_CLASS(wxDC)
 };
index dcd541b5a8bb2f7fd1334cd741d5c334c28e38e9..33c6663eb986fa3fa98a39b5ac7b61a1dc0b8bdb 100644 (file)
 
 class WXDLLIMPEXP_CORE wxDC;
 
 
 class WXDLLIMPEXP_CORE wxDC;
 
-//-----------------------------------------------------------------------------
-// constants
-//-----------------------------------------------------------------------------
-
-#ifndef MM_TEXT
-#define MM_TEXT         0
-#define MM_ISOTROPIC    1
-#define MM_ANISOTROPIC  2
-#define MM_LOMETRIC     3
-#define MM_HIMETRIC     4
-#define MM_TWIPS        5
-#define MM_POINTS       6
-#define MM_METRIC       7
-#endif
-
 //-----------------------------------------------------------------------------
 // wxDC
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // wxDC
 //-----------------------------------------------------------------------------
@@ -53,80 +38,21 @@ public:
     virtual void StartPage() { }
     virtual void EndPage() { }
 
     virtual void StartPage() { }
     virtual void EndPage() { }
 
-    virtual wxCoord DeviceToLogicalX(wxCoord x) const;
-    virtual wxCoord DeviceToLogicalY(wxCoord y) const;
-    virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
-    virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
-    virtual wxCoord LogicalToDeviceX(wxCoord x) const;
-    virtual wxCoord LogicalToDeviceY(wxCoord y) const;
-    virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
-    virtual wxCoord LogicalToDeviceYRel(wxCoord y) const ;
-
-    virtual void SetMapMode( int mode );
-    virtual void SetUserScale( double x, double y );
-    virtual void SetLogicalScale( double x, double y );
-    virtual void SetLogicalOrigin( wxCoord x, wxCoord y );
-    virtual void SetDeviceOrigin( wxCoord x, wxCoord y );
-
-    virtual void SetAxisOrientation( bool xLeftRight, bool yBottomUp );
-
-    // implementation
-    // --------------
-
-    virtual void ComputeScaleAndOrigin();
-
-    virtual GdkWindow* GetGDKWindow() const { return NULL; }
-
-    wxCoord XDEV2LOG(wxCoord x) const
-    {
-        return wxRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
-    }
-    wxCoord XDEV2LOGREL(wxCoord x) const
-    {
-        return wxRound((double)(x) / m_scaleX);
-    }
-    wxCoord YDEV2LOG(wxCoord y) const
-    {
-        return wxRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
-    }
-    wxCoord YDEV2LOGREL(wxCoord y) const
-    {
-        return wxRound((double)(y) / m_scaleY);
-    }
-    wxCoord XLOG2DEV(wxCoord x) const
-    {
-        return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
-    }
-    wxCoord XLOG2DEVREL(wxCoord x) const
-    {
-        return wxRound((double)(x) * m_scaleX);
-    }
-    wxCoord YLOG2DEV(wxCoord y) const
-    {
-        return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
-    }
-    wxCoord YLOG2DEVREL(wxCoord y) const
-    {
-        return wxRound((double)(y) * m_scaleY);
-    }
-
 protected:
 protected:
+    // implementation
+    wxCoord XDEV2LOG(wxCoord x) const       { return DeviceToLogicalX(x); }
+    wxCoord XDEV2LOGREL(wxCoord x) const    { return DeviceToLogicalXRel(x); }
+    wxCoord YDEV2LOG(wxCoord y) const       { return DeviceToLogicalY(y); }
+    wxCoord YDEV2LOGREL(wxCoord y) const    { return DeviceToLogicalYRel(y); }
+    wxCoord XLOG2DEV(wxCoord x) const       { return LogicalToDeviceX(x); }
+    wxCoord XLOG2DEVREL(wxCoord x) const    { return LogicalToDeviceXRel(x); }
+    wxCoord YLOG2DEV(wxCoord y) const       { return LogicalToDeviceY(y); }
+    wxCoord YLOG2DEVREL(wxCoord y) const    { return LogicalToDeviceYRel(y); }
+    
     // base class pure virtuals implemented here
     virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
     virtual void DoGetSizeMM(int* width, int* height) const;
 
     // base class pure virtuals implemented here
     virtual void DoSetClippingRegion(wxCoord x, wxCoord y, wxCoord width, wxCoord height);
     virtual void DoGetSizeMM(int* width, int* height) const;
 
-public:
-    // GTK-specific member variables
-
-    // 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;
-
-    bool         m_needComputeScaleX,
-                 m_needComputeScaleY; // not yet used
-
-
 private:
     DECLARE_ABSTRACT_CLASS(wxDC)
 };
 private:
     DECLARE_ABSTRACT_CLASS(wxDC)
 };
index 0996cabe44de71b5402e04dbf7b7fcd7275c2926..8f1831c0d2eff5dc1041fcf0bc9aadeb72c0ced1 100644 (file)
@@ -141,72 +141,23 @@ public:
     virtual int GetDepth() const;
     virtual wxSize GetPPI() const;
 
     virtual int GetDepth() const;
     virtual wxSize GetPPI() const;
 
-    virtual void SetMapMode(int mode);
-    virtual void SetUserScale(double x, double y);
-
-    virtual void SetLogicalScale(double x, double y);
-    virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
-    virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
-    virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
     virtual void SetLogicalFunction(int function);
 
     virtual void SetTextForeground(const wxColour& colour);
     virtual void SetTextBackground(const wxColour& colour);
 
     virtual void SetLogicalFunction(int function);
 
     virtual void SetTextForeground(const wxColour& colour);
     virtual void SetTextBackground(const wxColour& colour);
 
-    virtual void ComputeScaleAndOrigin();
-
-    virtual wxCoord DeviceToLogicalX(wxCoord x) const;
-    virtual wxCoord DeviceToLogicalY(wxCoord y) const;
-    virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
-    virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
-    virtual wxCoord LogicalToDeviceX(wxCoord x) const;
-    virtual wxCoord LogicalToDeviceY(wxCoord y) const;
-    virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
-    virtual wxCoord LogicalToDeviceYRel(wxCoord y) const ;
-
 public:
 public:
-    wxCoord XDEV2LOG(wxCoord x) const
-    {
-        return wxRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
-    }
-    wxCoord XDEV2LOGREL(wxCoord x) const
-    {
-        return wxRound((double)(x) / m_scaleX);
-    }
-    wxCoord YDEV2LOG(wxCoord y) const
-    {
-        return wxRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
-    }
-    wxCoord YDEV2LOGREL(wxCoord y) const
-    {
-        return wxRound((double)(y) / m_scaleY);
-    }
-    wxCoord XLOG2DEV(wxCoord x) const
-    {
-        return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
-    }
-    wxCoord XLOG2DEVREL(wxCoord x) const
-    {
-        return wxRound((double)(x) * m_scaleX);
-    }
-    wxCoord YLOG2DEV(wxCoord y) const
-    {
-        return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
-    }
-    wxCoord YLOG2DEVREL(wxCoord y) const
-    {
-        return wxRound((double)(y) * m_scaleY);
-    }
-
-    wxCoord XLOG2DEVMAC(wxCoord x) const
-    {
-        return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX + m_macLocalOrigin.x;
-    }
-
-    wxCoord YLOG2DEVMAC(wxCoord y) const
-    {
-        return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY + m_macLocalOrigin.y;
-    }
+    wxCoord XDEV2LOG(wxCoord x) const       { return DeviceToLogicalX( x ); }
+    wxCoord XDEV2LOGREL(wxCoord x) const    { return DeviceToLogicalXRel( x ); }
+    wxCoord YDEV2LOG(wxCoord y) const       { return DeviceToLogicalY( y ); }
+    wxCoord YDEV2LOGREL(wxCoord y) const    { return DeviceToLogicalYRel( y ); }
+    wxCoord XLOG2DEV(wxCoord x) const       { return LogicalToDeviceX( x ); }
+    wxCoord XLOG2DEVREL(wxCoord x) const    { return LogicalToDeviceXRel( x ); }
+    wxCoord YLOG2DEV(wxCoord y) const       { return LogicalToDeviceY( y ); }
+    wxCoord YLOG2DEVREL(wxCoord y) const    { return LogicalToDeviceYRel( y ); }
+    // probably no longer needed
+    wxCoord XLOG2DEVMAC(wxCoord x) const    { return LogicalToDeviceX( x ); }
+    wxCoord YLOG2DEVMAC(wxCoord y) const    { return LogicalToDeviceY( y ); }
 
 #if wxMAC_USE_CORE_GRAPHICS
     wxGraphicsContext* GetGraphicsContext() { return m_graphicContext; }
 
 #if wxMAC_USE_CORE_GRAPHICS
     wxGraphicsContext* GetGraphicsContext() { return m_graphicContext; }
index 94bd65c9f69db9379ed0fe18c0ab2387069f3664..8c6ae8549e3c151db861ff36edf047768b954098 100644 (file)
@@ -86,51 +86,21 @@ public:
     virtual int GetDepth() const;
     virtual wxSize GetPPI() const;
 
     virtual int GetDepth() const;
     virtual wxSize GetPPI() const;
 
-    virtual void SetMapMode(int mode);
-    virtual void SetUserScale(double x, double y);
-    virtual void SetLogicalScale(double x, double y);
-    virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
-    virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
-    virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
     virtual void SetLogicalFunction(int function);
 
     // implementation from now on
     // --------------------------
 
     virtual void ComputeScaleAndOrigin();
     virtual void SetLogicalFunction(int function);
 
     // implementation from now on
     // --------------------------
 
     virtual void ComputeScaleAndOrigin();
-
-    wxCoord XDEV2LOG(wxCoord x) const
-    {
-        return wxRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
-    }
-    wxCoord XDEV2LOGREL(wxCoord x) const
-    {
-        return wxRound((double)(x) / m_scaleX);
-    }
-    wxCoord YDEV2LOG(wxCoord y) const
-    {
-        return wxRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
-    }
-    wxCoord YDEV2LOGREL(wxCoord y) const
-    {
-        return wxRound((double)(y) / m_scaleY);
-    }
-    wxCoord XLOG2DEV(wxCoord x) const
-    {
-        return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
-    }
-    wxCoord XLOG2DEVREL(wxCoord x) const
-    {
-        return wxRound((double)(x) * m_scaleX);
-    }
-    wxCoord YLOG2DEV(wxCoord y) const
-    {
-        return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
-    }
-    wxCoord YLOG2DEVREL(wxCoord y) const
-    {
-        return wxRound((double)(y) * m_scaleY);
-    }
+    
+    wxCoord XDEV2LOG(wxCoord x) const       { return DeviceToLogicalX(x); }
+    wxCoord XDEV2LOGREL(wxCoord x) const    { return DeviceToLogicalXRel(x); }
+    wxCoord YDEV2LOG(wxCoord y) const       { return DeviceToLogicalY(y); }
+    wxCoord YDEV2LOGREL(wxCoord y) const    { return DeviceToLogicalYRel(y); }
+    wxCoord XLOG2DEV(wxCoord x) const       { return LogicalToDeviceX(x); }
+    wxCoord XLOG2DEVREL(wxCoord x) const    { return LogicalToDeviceXRel(x); }
+    wxCoord YLOG2DEV(wxCoord y) const       { return LogicalToDeviceY(y); }
+    wxCoord YLOG2DEVREL(wxCoord y) const    { return LogicalToDeviceYRel(y); }
 
     MGLDevCtx *GetMGLDC() const { return m_MGLDC; }
     void SetMGLDC(MGLDevCtx *mgldc, bool OwnsMGLDC = false);
 
     MGLDevCtx *GetMGLDC() const { return m_MGLDC; }
     void SetMGLDC(MGLDevCtx *mgldc, bool OwnsMGLDC = false);
index 8d60b16414811186dd9d21ba22e961a383bcbff7..22f35f8896d157e201e3a3c2e6098a8c20676dcf 100644 (file)
@@ -45,18 +45,8 @@ public:
     wxDC();
     virtual ~wxDC() { }
 
     wxDC();
     virtual ~wxDC() { }
 
-    // implement base class pure virtuals
-    // ----------------------------------
-
     virtual wxSize GetPPI() const;
 
     virtual wxSize GetPPI() const;
 
-    virtual void SetMapMode(int mode);
-    virtual void SetUserScale(double x, double y);
-    virtual void SetLogicalScale(double x, double y);
-    virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
-    virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
-    virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
-
 protected:
     virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
     virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
 protected:
     virtual void DoDrawIcon(const wxIcon& icon, wxCoord x, wxCoord y);
     virtual void DoDrawBitmap(const wxBitmap &bmp, wxCoord x, wxCoord y,
@@ -68,93 +58,25 @@ protected:
     virtual void DoGetSizeMM(int* width, int* height) const;
 
 public:
     virtual void DoGetSizeMM(int* width, int* height) const;
 
 public:
-    virtual void ComputeScaleAndOrigin();
-
-    wxCoord XDEV2LOG(wxCoord x) const
-    {
-        wxCoord new_x = x - m_deviceOriginX;
-        if (new_x > 0)
-            return (wxCoord)((double)(new_x) / m_scaleX + 0.5) * m_signX + m_logicalOriginX;
-        else
-            return (wxCoord)((double)(new_x) / m_scaleX - 0.5) * m_signX + m_logicalOriginX;
-    }
-    wxCoord XDEV2LOGREL(wxCoord x) const
-    {
-        if (x > 0)
-            return (wxCoord)((double)(x) / m_scaleX + 0.5);
-        else
-            return (wxCoord)((double)(x) / m_scaleX - 0.5);
-    }
-    wxCoord YDEV2LOG(wxCoord y) const
-    {
-        wxCoord new_y = y - m_deviceOriginY;
-        if (new_y > 0)
-            return (wxCoord)((double)(new_y) / m_scaleY + 0.5) * m_signY + m_logicalOriginY;
-        else
-            return (wxCoord)((double)(new_y) / m_scaleY - 0.5) * m_signY + m_logicalOriginY;
-    }
-    wxCoord YDEV2LOGREL(wxCoord y) const
-    {
-        if (y > 0)
-            return (wxCoord)((double)(y) / m_scaleY + 0.5);
-        else
-            return (wxCoord)((double)(y) / m_scaleY - 0.5);
-    }
-    wxCoord XLOG2DEV(wxCoord x) const
-    {
-        wxCoord new_x = x - m_logicalOriginX;
-        if (new_x > 0)
-            return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX + m_deviceOriginX;
-        else
-            return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX + m_deviceOriginX;
-    }
+    // implementation
+    wxCoord XDEV2LOG(wxCoord x) const       { return DeviceToLogicalX(x); }
+    wxCoord XDEV2LOGREL(wxCoord x) const    { return DeviceToLogicalXRel(x); }
+    wxCoord YDEV2LOG(wxCoord y) const       { return DeviceToLogicalY(y); }
+    wxCoord YDEV2LOGREL(wxCoord y) const    { return DeviceToLogicalYRel(y); }
+    wxCoord XLOG2DEV(wxCoord x) const       { return LogicalToDeviceX(x); }
+    wxCoord XLOG2DEVREL(wxCoord x) const    { return LogicalToDeviceXRel(x); }
+    wxCoord YLOG2DEV(wxCoord y) const       { return LogicalToDeviceY(y); }
+    wxCoord YLOG2DEVREL(wxCoord y) const    { return LogicalToDeviceYRel(y); }
+    
     // Without device translation, for backing pixmap purposes
     wxCoord XLOG2DEV_2(wxCoord x) const
     {
     // Without device translation, for backing pixmap purposes
     wxCoord XLOG2DEV_2(wxCoord x) const
     {
-        wxCoord new_x = x - m_logicalOriginX;
-        if (new_x > 0)
-            return (wxCoord)((double)(new_x) * m_scaleX + 0.5) * m_signX;
-        else
-            return (wxCoord)((double)(new_x) * m_scaleX - 0.5) * m_signX;
-    }
-    wxCoord XLOG2DEVREL(wxCoord x) const
-    {
-        if (x > 0)
-            return (wxCoord)((double)(x) * m_scaleX + 0.5);
-        else
-            return (wxCoord)((double)(x) * m_scaleX - 0.5);
+        return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX;
     }
     }
-    wxCoord YLOG2DEV(wxCoord y) const
-    {
-        wxCoord new_y = y - m_logicalOriginY;
-        if (new_y > 0)
-            return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY + m_deviceOriginY;
-        else
-            return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY + m_deviceOriginY;
-    }
-    // Without device translation, for backing pixmap purposes
     wxCoord YLOG2DEV_2(wxCoord y) const
     {
     wxCoord YLOG2DEV_2(wxCoord y) const
     {
-        wxCoord new_y = y - m_logicalOriginY;
-        if (new_y > 0)
-            return (wxCoord)((double)(new_y) * m_scaleY + 0.5) * m_signY;
-        else
-            return (wxCoord)((double)(new_y) * m_scaleY - 0.5) * m_signY;
+        return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY;
     }
     }
-    wxCoord YLOG2DEVREL(wxCoord y) const
-    {
-        if (y > 0)
-            return (wxCoord)((double)(y) * m_scaleY + 0.5);
-        else
-            return (wxCoord)((double)(y) * m_scaleY - 0.5);
-    }
-
-public:
-    // 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;
-
-    // recompute scale?
-    bool         m_needComputeScaleX, m_needComputeScaleY;
 
 };
 
 
 };
 
index a1e235225fd7388b71c1d3af4a0a1cf6b6e61209..7f2abb4bf673e35a80db3f864cc43cd8bc643cc8 100644 (file)
@@ -78,22 +78,14 @@ public:
     virtual int GetDepth() const;
     virtual wxSize GetPPI() const;
 
     virtual int GetDepth() const;
     virtual wxSize GetPPI() const;
 
-    virtual wxCoord DeviceToLogicalX(wxCoord x) const;
-    virtual wxCoord DeviceToLogicalY(wxCoord y) const;
-    virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
-    virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
-    virtual wxCoord LogicalToDeviceX(wxCoord x) const;
-    virtual wxCoord LogicalToDeviceY(wxCoord y) const;
-    virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
-    virtual wxCoord LogicalToDeviceYRel(wxCoord y) const ;
 
     virtual void SetMapMode(int mode);
     virtual void SetUserScale(double x, double y);
 
     virtual void SetMapMode(int mode);
     virtual void SetUserScale(double x, double y);
-    virtual void SetSystemScale(double x, double y);
     virtual void SetLogicalScale(double x, double y);
     virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
     virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
     virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
     virtual void SetLogicalScale(double x, double y);
     virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
     virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
     virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
+    
     virtual void SetLogicalFunction(int function);
 
     // implementation from now on
     virtual void SetLogicalFunction(int function);
 
     // implementation from now on
@@ -171,6 +163,8 @@ protected:
     // classes
     wxDC() { Init(); }
 
     // classes
     wxDC() { Init(); }
 
+    void RealizeScaleAndOrigin();
+
     virtual void DoGetTextExtent(const wxString& string,
                                  wxCoord *x, wxCoord *y,
                                  wxCoord *descent = NULL,
     virtual void DoGetTextExtent(const wxString& string,
                                  wxCoord *x, wxCoord *y,
                                  wxCoord *descent = NULL,
index f9d51c9798d7111592c9289d18c5df18abebcb16..e3f48e3710530794e67b13a665ac00554d2d9709 100644 (file)
@@ -140,9 +140,6 @@ public:
     virtual void    SetUserScale( double dX
                                  ,double dY
                                 );
     virtual void    SetUserScale( double dX
                                  ,double dY
                                 );
-    virtual void    SetSystemScale( double dX
-                                   ,double dY
-                                  );
     virtual void    SetLogicalScale( double dX
                                     ,double dY
                                    );
     virtual void    SetLogicalScale( double dX
                                     ,double dY
                                    );
@@ -157,15 +154,6 @@ public:
                                       );
     virtual void    SetLogicalFunction(int nFunction);
 
                                       );
     virtual void    SetLogicalFunction(int nFunction);
 
-    virtual wxCoord DeviceToLogicalX(wxCoord x) const;
-    virtual wxCoord DeviceToLogicalY(wxCoord y) const;
-    virtual wxCoord DeviceToLogicalXRel(wxCoord x) const;
-    virtual wxCoord DeviceToLogicalYRel(wxCoord y) const;
-    virtual wxCoord LogicalToDeviceX(wxCoord x) const;
-    virtual wxCoord LogicalToDeviceY(wxCoord y) const;
-    virtual wxCoord LogicalToDeviceXRel(wxCoord x) const;
-    virtual wxCoord LogicalToDeviceYRel(wxCoord y) const ;
-    
     // implementation from now on
     // --------------------------
 
     // implementation from now on
     // --------------------------
 
index f00e79e833befedffe4816c435225ed9910e7808..595126236cecadf14255460120f0d98b4a4ae49f 100644 (file)
 #include "wx/font.h"
 #include "wx/gdicmn.h"
 
 #include "wx/font.h"
 #include "wx/gdicmn.h"
 
-//-----------------------------------------------------------------------------
-// constants
-//-----------------------------------------------------------------------------
-
-#ifndef MM_TEXT
-#define MM_TEXT         0
-#define MM_ISOTROPIC    1
-#define MM_ANISOTROPIC  2
-#define MM_LOMETRIC     3
-#define MM_HIMETRIC     4
-#define MM_TWIPS        5
-#define MM_POINTS       6
-#define MM_METRIC       7
-#endif
-
 //-----------------------------------------------------------------------------
 // wxDC
 //-----------------------------------------------------------------------------
 //-----------------------------------------------------------------------------
 // wxDC
 //-----------------------------------------------------------------------------
@@ -48,61 +33,20 @@ public:
 
     virtual wxSize GetPPI() const;
 
 
     virtual wxSize GetPPI() const;
 
-    virtual void SetMapMode(int mode);
-    virtual void SetUserScale(double x, double y);
-    virtual void SetLogicalScale(double x, double y);
-    virtual void SetLogicalOrigin(wxCoord x, wxCoord y);
-    virtual void SetDeviceOrigin(wxCoord x, wxCoord y);
-    virtual void SetAxisOrientation(bool xLeftRight, bool yBottomUp);
-
 protected:
     virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
         wxCoord width, wxCoord height);
     virtual void DoGetSizeMM(int* width, int* height) const;
 
 protected:
     virtual void DoSetClippingRegion(wxCoord x, wxCoord y,
         wxCoord width, wxCoord height);
     virtual void DoGetSizeMM(int* width, int* height) const;
 
-public:
-    virtual void ComputeScaleAndOrigin();
-
-    wxCoord XDEV2LOG(wxCoord x) const
-    {
-        return wxRound((double)(x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
-    }
-    wxCoord XDEV2LOGREL(wxCoord x) const
-    {
-        return wxRound((double)(x) / m_scaleX);
-    }
-    wxCoord YDEV2LOG(wxCoord y) const
-    {
-        return wxRound((double)(y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
-    }
-    wxCoord YDEV2LOGREL(wxCoord y) const
-    {
-        return wxRound((double)(y) / m_scaleY);
-    }
-    wxCoord XLOG2DEV(wxCoord x) const
-    {
-        return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
-    }
-    wxCoord XLOG2DEVREL(wxCoord x) const
-    {
-        return wxRound((double)(x) * m_scaleX);
-    }
-    wxCoord YLOG2DEV(wxCoord y) const
-    {
-        return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
-    }
-    wxCoord YLOG2DEVREL(wxCoord y) const
-    {
-        return wxRound((double)(y) * m_scaleY);
-    }
-
-public:
-    // 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;
-
-    // recompute scale?
-    bool         m_needComputeScaleX, m_needComputeScaleY;
-
+    // implementation
+    wxCoord XDEV2LOG(wxCoord x) const       { return DeviceToLogicalX(x); }
+    wxCoord XDEV2LOGREL(wxCoord x) const    { return DeviceToLogicalXRel(x); }
+    wxCoord YDEV2LOG(wxCoord y) const       { return DeviceToLogicalY(y); }
+    wxCoord YDEV2LOGREL(wxCoord y) const    { return DeviceToLogicalYRel(y); }
+    wxCoord XLOG2DEV(wxCoord x) const       { return LogicalToDeviceX(x); }
+    wxCoord XLOG2DEVREL(wxCoord x) const    { return LogicalToDeviceXRel(x); }
+    wxCoord YLOG2DEV(wxCoord y) const       { return LogicalToDeviceY(y); }
+    wxCoord YLOG2DEVREL(wxCoord y) const    { return LogicalToDeviceYRel(y); }
 
 private:
     DECLARE_ABSTRACT_CLASS(wxDC)
 
 private:
     DECLARE_ABSTRACT_CLASS(wxDC)
index 8f08d60562cbafc5b63fb6f83307c9a47f7c2bb4..628b7be0df7adc0697a3944a013064b0691d1b77 100644 (file)
@@ -42,6 +42,48 @@ IMPLEMENT_ABSTRACT_CLASS(wxDCBase, wxObject)
 IMPLEMENT_DYNAMIC_CLASS(wxBufferedDC, wxMemoryDC)
 IMPLEMENT_ABSTRACT_CLASS(wxBufferedPaintDC, wxBufferedDC)
 
 IMPLEMENT_DYNAMIC_CLASS(wxBufferedDC, wxMemoryDC)
 IMPLEMENT_ABSTRACT_CLASS(wxBufferedPaintDC, wxBufferedDC)
 
+wxDCBase::wxDCBase()
+        : m_colour(wxColourDisplay())
+        , m_ok(true)
+        , m_clipping(false)
+        , m_isInteractive(0)
+        , m_isBBoxValid(false)
+        , m_logicalOriginX(0), m_logicalOriginY(0)
+        , m_deviceOriginX(0), m_deviceOriginY(0)
+        , m_deviceLocalOriginX(0), m_deviceLocalOriginY(0)
+        , m_logicalScaleX(1.0), m_logicalScaleY(1.0)
+        , m_userScaleX(1.0), m_userScaleY(1.0)
+        , m_scaleX(1.0), m_scaleY(1.0)
+        , m_signX(1), m_signY(1)
+        , m_minX(0), m_minY(0), m_maxX(0), m_maxY(0)
+        , m_clipX1(0), m_clipY1(0), m_clipX2(0), m_clipY2(0)
+        , m_logicalFunction(wxCOPY)
+        , m_backgroundMode(wxTRANSPARENT)
+        , m_mappingMode(wxMM_TEXT)
+        , m_pen()
+        , m_brush()
+        , m_backgroundBrush(*wxTRANSPARENT_BRUSH)
+        , m_textForegroundColour(*wxBLACK)
+        , m_textBackgroundColour(*wxWHITE)
+        , m_font()
+#if wxUSE_PALETTE
+        , m_palette()
+        , m_hasCustomPalette(false)
+#endif // wxUSE_PALETTE
+{
+    m_mm_to_pix_x = (double)wxGetDisplaySize().GetWidth() /
+                    (double)wxGetDisplaySizeMM().GetWidth();
+    m_mm_to_pix_y = (double)wxGetDisplaySize().GetHeight() /
+                    (double)wxGetDisplaySizeMM().GetHeight();
+                    
+    ResetBoundingBox();
+    ResetClipping();
+}
+
+wxDCBase::~wxDCBase()
+{
+}
+
 #if WXWIN_COMPATIBILITY_2_6
 void wxDCBase::BeginDrawing()
 {
 #if WXWIN_COMPATIBILITY_2_6
 void wxDCBase::BeginDrawing()
 {
@@ -52,6 +94,125 @@ void wxDCBase::EndDrawing()
 }
 #endif // WXWIN_COMPATIBILITY_2_6
 
 }
 #endif // WXWIN_COMPATIBILITY_2_6
 
+// ----------------------------------------------------------------------------
+// coordinate conversions and transforms
+// ----------------------------------------------------------------------------
+
+wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
+{
+    return wxRound((double)(x - m_deviceOriginX - m_deviceLocalOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
+}
+
+wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
+{
+    return wxRound((double)(y - m_deviceOriginY - m_deviceLocalOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
+}
+
+wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
+{
+    return wxRound((double)(x) / m_scaleX);
+}
+
+wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
+{
+    return wxRound((double)(y) / m_scaleY);
+}
+
+wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
+{
+    return wxRound((double)(x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX + m_deviceLocalOriginX;
+}
+
+wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
+{
+    return wxRound((double)(y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY + m_deviceLocalOriginY;
+}
+
+wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
+{
+    return wxRound((double)(x) * m_scaleX);
+}
+
+wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
+{
+    return wxRound((double)(y) * m_scaleY);
+}
+
+void wxDCBase::ComputeScaleAndOrigin()
+{
+    m_scaleX = m_logicalScaleX * m_userScaleX;
+    m_scaleY = m_logicalScaleY * m_userScaleY;
+}
+
+void wxDCBase::SetMapMode( int mode )
+{
+    switch (mode)
+    {
+        case wxMM_TWIPS:
+          SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
+          break;
+        case wxMM_POINTS:
+          SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
+          break;
+        case wxMM_METRIC:
+          SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
+          break;
+        case wxMM_LOMETRIC:
+          SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
+          break;
+        default:
+        case wxMM_TEXT:
+          SetLogicalScale( 1.0, 1.0 );
+          break;
+    }
+    m_mappingMode = mode;
+}
+
+void wxDCBase::SetUserScale( double x, double y )
+{
+    // allow negative ? -> no
+    m_userScaleX = x;
+    m_userScaleY = y;
+    ComputeScaleAndOrigin();
+}
+
+void wxDCBase::SetLogicalScale( double x, double y )
+{
+    // allow negative ?
+    m_logicalScaleX = x;
+    m_logicalScaleY = y;
+    ComputeScaleAndOrigin();
+}
+
+void wxDCBase::SetLogicalOrigin( wxCoord x, wxCoord y )
+{
+    m_logicalOriginX = x * m_signX;
+    m_logicalOriginY = y * m_signY;
+    ComputeScaleAndOrigin();
+}
+
+void wxDCBase::SetDeviceOrigin( wxCoord x, wxCoord y )
+{
+    m_deviceOriginX = x;
+    m_deviceOriginY = y;
+    ComputeScaleAndOrigin();
+}
+
+void wxDCBase::SetDeviceLocalOrigin( wxCoord x, wxCoord y )
+{
+    m_deviceLocalOriginX = x;
+    m_deviceLocalOriginY = y;
+    ComputeScaleAndOrigin();
+}
+
+void wxDCBase::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
+{
+    // only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
+    m_signX = (xLeftRight ?  1 : -1);
+    m_signY = (yBottomUp  ? -1 :  1);
+    ComputeScaleAndOrigin();
+}
+
 // ----------------------------------------------------------------------------
 // special symbols
 // ----------------------------------------------------------------------------
 // ----------------------------------------------------------------------------
 // special symbols
 // ----------------------------------------------------------------------------
index ebc4e74c6f8906d9f76f550e6a57a13f3b71e0d2..92f539abaf2cc48918ac36f47106fc293987281a 100644 (file)
@@ -675,114 +675,36 @@ void wxSVGFileDC::write(const wxString &s)
 // coordinates transformations
 // ---------------------------------------------------------------------------
 
 // coordinates transformations
 // ---------------------------------------------------------------------------
 
-wxCoord wxSVGFileDC::DeviceToLogicalX(wxCoord x) const
-{
-    return wxRound((x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
-}
-
-wxCoord wxSVGFileDC::DeviceToLogicalY(wxCoord y) const
-{
-    return wxRound((y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
-}
-
-wxCoord wxSVGFileDC::DeviceToLogicalXRel(wxCoord x) const
-{
-    return wxRound(x / m_scaleX);
-}
-
-wxCoord wxSVGFileDC::DeviceToLogicalYRel(wxCoord y) const
-{
-    return wxRound(y / m_scaleY);
-}
-
-wxCoord wxSVGFileDC::LogicalToDeviceX(wxCoord x) const
-{
-    return wxRound((x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
-}
-
-wxCoord wxSVGFileDC::LogicalToDeviceY(wxCoord y) const
-{
-    return wxRound((y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
-}
-
-wxCoord wxSVGFileDC::LogicalToDeviceXRel(wxCoord x) const
-{
-    return wxRound(x * m_scaleX);
-}
-
-wxCoord wxSVGFileDC::LogicalToDeviceYRel(wxCoord y) const
-{
-    return wxRound(y * m_scaleY);
-}
-
-void wxSVGFileDC::ComputeScaleAndOrigin()
+void wxSVGFileDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
 {
 {
-    m_scaleX = m_logicalScaleX * m_userScaleX;
-    m_scaleY = m_logicalScaleY * m_userScaleY;
+    wxDCBase::SetAxisOrientation( xLeftRight, yBottomUp );
 }
 
 }
 
-void wxSVGFileDC::SetMapMode( int mode )
+void wxSVGFileDC::SetMapMode(int mode)
 {
 {
-    switch (mode)
-    {
-        case wxMM_TWIPS:
-            SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
-            break;
-        case wxMM_POINTS:
-            SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
-            break;
-        case wxMM_METRIC:
-            SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
-            break;
-        case wxMM_LOMETRIC:
-            SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
-            break;
-        default:
-        case wxMM_TEXT:
-            SetLogicalScale( 1.0, 1.0 );
-            break;
-    }
-    m_mappingMode = mode;
+    wxDCBase::SetMapMode(mode);
 }
 
 }
 
-void wxSVGFileDC::SetUserScale( double x, double y )
+void wxSVGFileDC::SetUserScale(double x, double y)
 {
 {
-    // allow negative ? -> no
-    m_userScaleX = x;
-    m_userScaleY = y;
-    ComputeScaleAndOrigin();
+    wxDCBase::SetUserScale(x,y);
 }
 
 }
 
-void wxSVGFileDC::SetLogicalScale( double x, double y )
+void wxSVGFileDC::SetLogicalScale(double x, double y)
 {
 {
-    // allow negative ?
-    m_logicalScaleX = x;
-    m_logicalScaleY = y;
-    ComputeScaleAndOrigin();
+    wxDCBase::SetLogicalScale(x,y);
 }
 
 }
 
-void wxSVGFileDC::SetLogicalOrigin( wxCoord x, wxCoord y )
+void wxSVGFileDC::SetLogicalOrigin(wxCoord x, wxCoord y)
 {
 {
-    m_logicalOriginX = x * m_signX;   // is this still correct ?
-    m_logicalOriginY = y * m_signY;
-    ComputeScaleAndOrigin();
+    wxDCBase::SetLogicalOrigin(x,y);
 }
 
 }
 
-void wxSVGFileDC::SetDeviceOrigin( wxCoord x, wxCoord y )
+void wxSVGFileDC::SetDeviceOrigin(wxCoord x, wxCoord y)
 {
 {
-    // only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
-    m_deviceOriginX = x;
-    m_deviceOriginY = y;
-    ComputeScaleAndOrigin();
+    wxDCBase::SetDeviceOrigin(x,y);
 }
 
 }
 
-void wxSVGFileDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
-{
-    // only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
-    m_signX = (xLeftRight ?  1 : -1);
-    m_signY = (yBottomUp  ? -1 :  1);
-    ComputeScaleAndOrigin();
-}
 
 
 #ifdef __BORLANDC__
 
 
 #ifdef __BORLANDC__
index acfa1eb5b75e2de8f5f3579d5b309506f21d1e27..004c88c969c9debda24d1c888c1850fffb81728e 100644 (file)
@@ -528,132 +528,10 @@ void wxDC::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
 // mapping modes
 // ---------------------------------------------------------------------------
 
 // mapping modes
 // ---------------------------------------------------------------------------
 
-void wxDC::ComputeScaleAndOrigin()
-{
-    m_scaleX = m_logicalScaleX * m_userScaleX;
-    m_scaleY = m_logicalScaleY * m_userScaleY;
-
-    // FIXME_DFB: scaling affects pixel size of font, pens, brushes, which
-    //            is not currently implemented here; probably makes sense to
-    //            switch to Cairo instead of implementing everything for DFB
-    wxASSERT_MSG( m_scaleX == 1.0 && m_scaleY == 1.0,
-                  _T("scaling is not implemented in wxDFB") );
-}
-
-void wxDC::SetMapMode(int mode)
-{
-    #warning "move this to common code, it's shared by almost all ports!"
-    switch (mode)
-    {
-        case wxMM_TWIPS:
-          SetLogicalScale(twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y);
-          break;
-        case wxMM_POINTS:
-          SetLogicalScale(pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y);
-          break;
-        case wxMM_METRIC:
-          SetLogicalScale(m_mm_to_pix_x, m_mm_to_pix_y);
-          break;
-        case wxMM_LOMETRIC:
-          SetLogicalScale(m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0);
-          break;
-        default:
-        case wxMM_TEXT:
-          SetLogicalScale(1.0, 1.0);
-          break;
-    }
-    m_mappingMode = mode;
-}
-
-void wxDC::SetUserScale(double x, double y)
-{
-    #warning "move this to common code?"
-    // allow negative ? -> no
-    m_userScaleX = x;
-    m_userScaleY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetLogicalScale(double x, double y)
-{
-    #warning "move this to common code?"
-    // allow negative ?
-    m_logicalScaleX = x;
-    m_logicalScaleY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetLogicalOrigin( wxCoord x, wxCoord y )
-{
-    #warning "move this to common code?"
-    m_logicalOriginX = x * m_signX;   // is this still correct ?
-    m_logicalOriginY = y * m_signY;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetDeviceOrigin( wxCoord x, wxCoord y )
-{
-    #warning "move this to common code?"
-    // only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
-    m_deviceOriginX = x;
-    m_deviceOriginY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
-{
-    #warning "move this to common code?"
-    // only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
-    m_signX = (xLeftRight ?  1 : -1);
-    m_signY = (yBottomUp  ? -1 :  1);
-    ComputeScaleAndOrigin();
-}
-
-// ---------------------------------------------------------------------------
-// coordinates transformations
-// ---------------------------------------------------------------------------
-
-wxCoord wxDC::DeviceToLogicalX(wxCoord x) const
-{
-    return XDEV2LOG(x);
-}
-
-wxCoord wxDC::DeviceToLogicalY(wxCoord y) const
-{
-    return YDEV2LOG(y);
-}
-
-wxCoord wxDC::DeviceToLogicalXRel(wxCoord x) const
-{
-    return XDEV2LOGREL(x);
-}
-
-wxCoord wxDC::DeviceToLogicalYRel(wxCoord y) const
-{
-    return YDEV2LOGREL(y);
-}
-
-wxCoord wxDC::LogicalToDeviceX(wxCoord x) const
-{
-    return XLOG2DEV(x);
-}
-
-wxCoord wxDC::LogicalToDeviceY(wxCoord y) const
-{
-    return YLOG2DEV(y);
-}
-
-wxCoord wxDC::LogicalToDeviceXRel(wxCoord x) const
-{
-    return XLOG2DEVREL(x);
-}
-
-wxCoord wxDC::LogicalToDeviceYRel(wxCoord y) const
-{
-    return YLOG2DEVREL(y);
-}
-
-
+// FIXME_DFB: scaling affects pixel size of font, pens, brushes, which
+//            is not currently implemented here; probably makes sense to
+//            switch to Cairo instead of implementing everything for DFB
+    
 void wxDC::DoGetSize(int *w, int *h) const
 {
     wxCHECK_RET( Ok(), wxT("invalid dc") );
 void wxDC::DoGetSize(int *w, int *h) const
 {
     wxCHECK_RET( Ok(), wxT("invalid dc") );
index 805fe0fd82e20f1035393e10cacf58c920800168..a157c1c46c5cbdfe514ebf743c4bd4ff4abe736f 100644 (file)
@@ -270,6 +270,7 @@ wxPostScriptDC::wxPostScriptDC ()
 
     m_signX =  1;  // default x-axis left to right
     m_signY = -1;  // default y-axis bottom up -> top down
 
     m_signX =  1;  // default x-axis left to right
     m_signY = -1;  // default y-axis bottom up -> top down
+    
 }
 
 wxPostScriptDC::wxPostScriptDC (const wxPrintData& printData)
 }
 
 wxPostScriptDC::wxPostScriptDC (const wxPrintData& printData)
@@ -292,6 +293,10 @@ wxPostScriptDC::wxPostScriptDC (const wxPrintData& printData)
 
     m_printData = printData;
 
 
     m_printData = printData;
 
+    int h = 0;
+    GetSize( NULL, &h );
+    SetDeviceLocalOrigin( 0, h );
+    
     m_ok = true;
 }
 
     m_ok = true;
 }
 
@@ -1480,6 +1485,14 @@ wxCoord wxPostScriptDC::GetCharWidth() const
     return (wxCoord) (GetCharHeight() * 72.0 / 120.0);
 }
 
     return (wxCoord) (GetCharHeight() * 72.0 / 120.0);
 }
 
+void wxPostScriptDC::SetPrintData(const wxPrintData& data)
+{ 
+    m_printData = data;
+    
+    int h = 0;
+    GetSize( NULL, &h );
+    SetDeviceLocalOrigin( 0, h );
+}
 
 void wxPostScriptDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
 {
 
 void wxPostScriptDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
 {
@@ -1491,15 +1504,29 @@ void wxPostScriptDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
     ComputeScaleAndOrigin();
 }
 
     ComputeScaleAndOrigin();
 }
 
-void wxPostScriptDC::SetDeviceOrigin( wxCoord x, wxCoord y )
+void wxPostScriptDC::SetMapMode(int mode)
 {
 {
-    wxCHECK_RET( m_ok, wxT("invalid postscript dc") );
+    wxDCBase::SetMapMode(mode);
+}
 
 
-    int h = 0;
-    int w = 0;
-    GetSize( &w, &h );
+void wxPostScriptDC::SetUserScale(double x, double y)
+{
+    wxDCBase::SetUserScale(x,y);
+}
 
 
-    wxDC::SetDeviceOrigin( x, h-y );
+void wxPostScriptDC::SetLogicalScale(double x, double y)
+{
+    wxDCBase::SetLogicalScale(x,y);
+}
+
+void wxPostScriptDC::SetLogicalOrigin(wxCoord x, wxCoord y)
+{
+    wxDCBase::SetLogicalOrigin(x,y);
+}
+
+void wxPostScriptDC::SetDeviceOrigin(wxCoord x, wxCoord y)
+{
+    wxDCBase::SetDeviceOrigin(x,y);
 }
 
 void wxPostScriptDC::DoGetSize(int* width, int* height) const
 }
 
 void wxPostScriptDC::DoGetSize(int* width, int* height) const
index 8264117512b56f1f0ced133f5831efc25d297fb9..be84d8994eefb5412be93e1d2b42774f4940c831 100644 (file)
@@ -22,16 +22,6 @@ wxDC::wxDC()
 {
     m_ok = FALSE;
 
 {
     m_ok = FALSE;
 
-    m_mm_to_pix_x = (double)wxGetDisplaySize().GetWidth() /
-                    (double)wxGetDisplaySizeMM().GetWidth();
-    m_mm_to_pix_y = (double)wxGetDisplaySize().GetHeight() /
-                    (double)wxGetDisplaySizeMM().GetHeight();
-
-    m_needComputeScaleX = FALSE; /* not used yet */
-    m_needComputeScaleY = FALSE; /* not used yet */
-
-    m_logicalFunction = wxCOPY;
-
     m_pen = *wxBLACK_PEN;
     m_font = *wxNORMAL_FONT;
     m_brush = *wxWHITE_BRUSH;
     m_pen = *wxBLACK_PEN;
     m_font = *wxNORMAL_FONT;
     m_brush = *wxWHITE_BRUSH;
@@ -65,124 +55,3 @@ wxSize wxDC::GetPPI() const
     // TODO (should probably be pure virtual)
     return wxSize(0, 0);
 }
     // TODO (should probably be pure virtual)
     return wxSize(0, 0);
 }
-
-// ---------------------------------------------------------------------------
-// set various DC parameters
-// ---------------------------------------------------------------------------
-
-wxCoord wxDC::DeviceToLogicalX(wxCoord x) const
-{
-    return wxRound((x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
-}
-
-wxCoord wxDC::DeviceToLogicalY(wxCoord y) const
-{
-    return wxRound((y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
-}
-
-wxCoord wxDC::DeviceToLogicalXRel(wxCoord x) const
-{
-    return wxRound(x / m_scaleX);
-}
-
-wxCoord wxDC::DeviceToLogicalYRel(wxCoord y) const
-{
-    return wxRound(y / m_scaleY);
-}
-
-wxCoord wxDC::LogicalToDeviceX(wxCoord x) const
-{
-    return wxRound((x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
-}
-
-wxCoord wxDC::LogicalToDeviceY(wxCoord y) const
-{
-    return wxRound((y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
-}
-
-wxCoord wxDC::LogicalToDeviceXRel(wxCoord x) const
-{
-    return wxRound(x * m_scaleX);
-}
-
-wxCoord wxDC::LogicalToDeviceYRel(wxCoord y) const
-{
-    return wxRound(y * m_scaleY);
-}
-
-void wxDC::ComputeScaleAndOrigin()
-{
-    m_scaleX = m_logicalScaleX * m_userScaleX;
-    m_scaleY = m_logicalScaleY * m_userScaleY;
-}
-
-void wxDC::SetMapMode( int mode )
-{
-    switch (mode)
-    {
-        case wxMM_TWIPS:
-          SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
-          break;
-        case wxMM_POINTS:
-          SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
-          break;
-        case wxMM_METRIC:
-          SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
-          break;
-        case wxMM_LOMETRIC:
-          SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
-          break;
-        default:
-        case wxMM_TEXT:
-          SetLogicalScale( 1.0, 1.0 );
-          break;
-    }
-    m_mappingMode = mode;
-
-/*  we don't do this mega optimisation
-    if (mode != wxMM_TEXT)
-    {
-        m_needComputeScaleX = TRUE;
-        m_needComputeScaleY = TRUE;
-    }
-*/
-}
-
-void wxDC::SetUserScale( double x, double y )
-{
-    // allow negative ? -> no
-    m_userScaleX = x;
-    m_userScaleY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetLogicalScale( double x, double y )
-{
-    // allow negative ?
-    m_logicalScaleX = x;
-    m_logicalScaleY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetLogicalOrigin( wxCoord x, wxCoord y )
-{
-    m_logicalOriginX = x * m_signX;   // is this still correct ?
-    m_logicalOriginY = y * m_signY;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetDeviceOrigin( wxCoord x, wxCoord y )
-{
-    // only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
-    m_deviceOriginX = x;
-    m_deviceOriginY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
-{
-    // only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
-    m_signX = (xLeftRight ?  1 : -1);
-    m_signY = (yBottomUp  ? -1 :  1);
-    ComputeScaleAndOrigin();
-}
index 7247e564c3cb723349ee2e1e5333c13bbd5d365e..53b451a8f345cd3e5810e5e88cf52f6c93cac259 100644 (file)
@@ -69,168 +69,3 @@ wxSize wxDC::GetPPI() const
     return wxSize(0, 0);
 }
 
     return wxSize(0, 0);
 }
 
-// ---------------------------------------------------------------------------
-// set various DC parameters
-// ---------------------------------------------------------------------------
-
-wxCoord wxDC::DeviceToLogicalX(wxCoord x) const
-{
-    return wxRound((x - m_deviceOriginX) / m_scaleX) * m_signX + m_logicalOriginX;
-}
-
-wxCoord wxDC::DeviceToLogicalY(wxCoord y) const
-{
-    return wxRound((y - m_deviceOriginY) / m_scaleY) * m_signY + m_logicalOriginY;
-}
-
-wxCoord wxDC::DeviceToLogicalXRel(wxCoord x) const
-{
-    return wxRound(x / m_scaleX);
-}
-
-wxCoord wxDC::DeviceToLogicalYRel(wxCoord y) const
-{
-    return wxRound(y / m_scaleY);
-}
-
-wxCoord wxDC::LogicalToDeviceX(wxCoord x) const
-{
-    return wxRound((x - m_logicalOriginX) * m_scaleX) * m_signX + m_deviceOriginX;
-}
-
-wxCoord wxDC::LogicalToDeviceY(wxCoord y) const
-{
-    return wxRound((y - m_logicalOriginY) * m_scaleY) * m_signY + m_deviceOriginY;
-}
-
-wxCoord wxDC::LogicalToDeviceXRel(wxCoord x) const
-{
-    return wxRound(x * m_scaleX);
-}
-
-wxCoord wxDC::LogicalToDeviceYRel(wxCoord y) const
-{
-    return wxRound(y * m_scaleY);
-}
-
-void wxDC::ComputeScaleAndOrigin()
-{
-    m_scaleX = m_logicalScaleX * m_userScaleX;
-    m_scaleY = m_logicalScaleY * m_userScaleY;
-}
-
-void wxDC::SetMapMode( int mode )
-{
-    switch (mode)
-    {
-        case wxMM_TWIPS:
-          SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
-          break;
-        case wxMM_POINTS:
-          SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
-          break;
-        case wxMM_METRIC:
-          SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
-          break;
-        case wxMM_LOMETRIC:
-          SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
-          break;
-        default:
-        case wxMM_TEXT:
-          SetLogicalScale( 1.0, 1.0 );
-          break;
-    }
-    m_mappingMode = mode;
-
-/*  we don't do this mega optimisation
-    if (mode != wxMM_TEXT)
-    {
-        m_needComputeScaleX = TRUE;
-        m_needComputeScaleY = TRUE;
-    }
-*/
-}
-
-void wxDC::SetUserScale( double x, double y )
-{
-    // allow negative ? -> no
-    m_userScaleX = x;
-    m_userScaleY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetLogicalScale( double x, double y )
-{
-    // allow negative ?
-    m_logicalScaleX = x;
-    m_logicalScaleY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetLogicalOrigin( wxCoord x, wxCoord y )
-{
-    m_logicalOriginX = x * m_signX;   // is this still correct ?
-    m_logicalOriginY = y * m_signY;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetDeviceOrigin( wxCoord x, wxCoord y )
-{
-    // only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
-    m_deviceOriginX = x;
-    m_deviceOriginY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
-{
-    // only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
-    m_signX = (xLeftRight ?  1 : -1);
-    m_signY = (yBottomUp  ? -1 :  1);
-    ComputeScaleAndOrigin();
-}
-
-// ---------------------------------------------------------------------------
-// coordinates transformations
-// ---------------------------------------------------------------------------
-
-wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
-{
-    return ((wxDC *)this)->XDEV2LOG(x);
-}
-
-wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
-{
-    return ((wxDC *)this)->YDEV2LOG(y);
-}
-
-wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
-{
-    return ((wxDC *)this)->XDEV2LOGREL(x);
-}
-
-wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
-{
-    return ((wxDC *)this)->YDEV2LOGREL(y);
-}
-
-wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
-{
-    return ((wxDC *)this)->XLOG2DEV(x);
-}
-
-wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
-{
-    return ((wxDC *)this)->YLOG2DEV(y);
-}
-
-wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
-{
-    return ((wxDC *)this)->XLOG2DEVREL(x);
-}
-
-wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
-{
-    return ((wxDC *)this)->YLOG2DEVREL(y);
-}
-
index 45d060c38a24964d2987409c957525e1a3f29b41..79195c147d0dd101843585e72d3ad8015ab11432 100644 (file)
@@ -262,26 +262,11 @@ wxDC::wxDC()
 {
     m_ok = false;
     m_colour = true;
 {
     m_ok = false;
     m_colour = true;
-    m_mm_to_pix_x = mm2pt;
-    m_mm_to_pix_y = mm2pt;
-    m_internalDeviceOriginX = 0;
-    m_internalDeviceOriginY = 0;
-    m_externalDeviceOriginX = 0;
-    m_externalDeviceOriginY = 0;
-    m_logicalScaleX = 1.0;
-    m_logicalScaleY = 1.0;
-    m_userScaleX = 1.0;
-    m_userScaleY = 1.0;
-    m_scaleX = 1.0;
-    m_scaleY = 1.0;
-    m_needComputeScaleX = false;
-    m_needComputeScaleY = false;
     m_macPort = NULL ;
     m_macMask = NULL ;
     m_macFontInstalled = false ;
     m_macBrushInstalled = false ;
     m_macPenInstalled = false ;
     m_macPort = NULL ;
     m_macMask = NULL ;
     m_macFontInstalled = false ;
     m_macBrushInstalled = false ;
     m_macPenInstalled = false ;
-    m_macLocalOrigin.x = m_macLocalOrigin.y = 0 ;
     m_macBoundaryClipRgn = NewRgn() ;
     m_macCurrentClipRgn = NewRgn() ;
     SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , -32000 , -32000 , 32000 , 32000 ) ;
     m_macBoundaryClipRgn = NewRgn() ;
     m_macCurrentClipRgn = NewRgn() ;
     SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , -32000 , -32000 , 32000 , 32000 ) ;
@@ -567,77 +552,6 @@ void wxDC::SetTextBackground( const wxColour &col )
     m_macFontInstalled = false ;
 }
 
     m_macFontInstalled = false ;
 }
 
-void wxDC::SetMapMode( int mode )
-{
-    switch (mode)
-    {
-    case wxMM_TWIPS:
-        SetLogicalScale( twips2mm * m_mm_to_pix_x, twips2mm * m_mm_to_pix_y );
-        break;
-
-    case wxMM_POINTS:
-        SetLogicalScale( pt2mm * m_mm_to_pix_x, pt2mm * m_mm_to_pix_y );
-        break;
-
-    case wxMM_METRIC:
-        SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
-        break;
-
-    case wxMM_LOMETRIC:
-        SetLogicalScale( m_mm_to_pix_x / 10.0, m_mm_to_pix_y / 10.0 );
-        break;
-
-    default:
-    case wxMM_TEXT:
-        SetLogicalScale( 1.0, 1.0 );
-        break;
-    }
-
-    if (mode != wxMM_TEXT)
-    {
-        m_needComputeScaleX = true;
-        m_needComputeScaleY = true;
-    }
-}
-
-void wxDC::SetUserScale( double x, double y )
-{
-    // allow negative ? -> no
-    m_userScaleX = x;
-    m_userScaleY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetLogicalScale( double x, double y )
-{
-    // allow negative ?
-    m_logicalScaleX = x;
-    m_logicalScaleY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetLogicalOrigin( wxCoord x, wxCoord y )
-{
-    // is this still correct ?
-    m_logicalOriginX = x * m_signX;
-    m_logicalOriginY = y * m_signY;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetDeviceOrigin( wxCoord x, wxCoord y )
-{
-    m_externalDeviceOriginX = x;
-    m_externalDeviceOriginY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
-{
-    m_signX = (xLeftRight ?  1 : -1);
-    m_signY = (yBottomUp  ? -1 :  1);
-    ComputeScaleAndOrigin();
-}
-
 wxSize wxDC::GetPPI() const
 {
     return wxSize(72, 72);
 wxSize wxDC::GetPPI() const
 {
     return wxSize(72, 72);
@@ -651,27 +565,6 @@ int wxDC::GetDepth() const
     return 1 ;
 }
 
     return 1 ;
 }
 
-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());
-        m_pen = wxNullPen;
-        SetPen(pen);
-    }
-}
-
 void wxDC::SetPalette( const wxPalette& palette )
 {
 }
 void wxDC::SetPalette( const wxPalette& palette )
 {
 }
@@ -1580,7 +1473,7 @@ void wxDC::DoDrawRotatedText(const wxString& str, wxCoord x, wxCoord y,
         IntToFixed(drawX) , IntToFixed(drawY) , &rect );
     wxASSERT_MSG( status == noErr , wxT("couldn't measure the rotated text") );
 
         IntToFixed(drawX) , IntToFixed(drawY) , &rect );
     wxASSERT_MSG( status == noErr , wxT("couldn't measure the rotated text") );
 
-    OffsetRect( &rect , -m_macLocalOrigin.x , -m_macLocalOrigin.y ) ;
+    OffsetRect( &rect , -m_deviceLocalOriginX , -m_deviceLocalOriginY ) ;
     CalcBoundingBox(XDEV2LOG(rect.left), YDEV2LOG(rect.top) );
     CalcBoundingBox(XDEV2LOG(rect.right), YDEV2LOG(rect.bottom) );
     ::ATSUDisposeTextLayout(atsuLayout);
     CalcBoundingBox(XDEV2LOG(rect.left), YDEV2LOG(rect.top) );
     CalcBoundingBox(XDEV2LOG(rect.right), YDEV2LOG(rect.bottom) );
     ::ATSUDisposeTextLayout(atsuLayout);
index 27164c2c9ec538bee99c931a48e521664feacdb5..880d184926087c0bc1bbf8b129bda6dd30202ec5 100644 (file)
@@ -150,12 +150,12 @@ wxWindowDC::wxWindowDC(wxWindow *window)
     int x , y ;
     x = y = 0 ;
     window->MacWindowToRootWindow( &x , &y ) ;
     int x , y ;
     x = y = 0 ;
     window->MacWindowToRootWindow( &x , &y ) ;
-    m_macLocalOrigin.x = x ;
-    m_macLocalOrigin.y = y ;
+    m_deviceLocalOriginX = x;
+    m_deviceLocalOriginY = y;
     m_macPort = UMAGetWindowPort( (WindowRef) rootwindow->MacGetWindowRef() ) ;
 
     CopyRgn( (RgnHandle) window->MacGetVisibleRegion(true).GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
     m_macPort = UMAGetWindowPort( (WindowRef) rootwindow->MacGetWindowRef() ) ;
 
     CopyRgn( (RgnHandle) window->MacGetVisibleRegion(true).GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
-    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
+    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_deviceLocalOriginX , m_deviceLocalOriginY ) ;
     CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
 #endif
     SetBackground(MacGetBackgroundBrush(window));
     CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
 #endif
     SetBackground(MacGetBackgroundBrush(window));
@@ -281,12 +281,12 @@ wxClientDC::wxClientDC(wxWindow *window)
     m_macPort = UMAGetWindowPort( windowref ) ;
     m_ok = true ;
 
     m_macPort = UMAGetWindowPort( windowref ) ;
     m_ok = true ;
 
-    m_macLocalOrigin.x = x ;
-    m_macLocalOrigin.y = y ;
+    m_deviceLocalOriginX = x ;
+    m_deviceLocalOriginY = y ;
     SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
     SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
     OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
     SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
     SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
     OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
-    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
+    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_deviceLocalOriginX , m_deviceLocalOriginY ) ;
     CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle)  m_macCurrentClipRgn ) ;
 
     SetBackground(MacGetBackgroundBrush(window));
     CopyRgn( (RgnHandle) m_macBoundaryClipRgn ,(RgnHandle)  m_macCurrentClipRgn ) ;
 
     SetBackground(MacGetBackgroundBrush(window));
@@ -356,13 +356,13 @@ wxPaintDC::wxPaintDC(wxWindow *window)
     }
     // there is no out-of-order drawing on OSX
 #else
     }
     // there is no out-of-order drawing on OSX
 #else
-    m_macLocalOrigin.x = x ;
-    m_macLocalOrigin.y = y ;
+    m_deviceLocalOriginX = x ;
+    m_deviceLocalOriginY = y ;
     SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
     SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
     OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
     SectRgn( (RgnHandle) m_macBoundaryClipRgn  , (RgnHandle) window->GetUpdateRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
     SetRectRgn( (RgnHandle) m_macBoundaryClipRgn , origin.x , origin.y , origin.x + size.x , origin.y + size.y ) ;
     SectRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) window->MacGetVisibleRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
     OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , -origin.x , -origin.y ) ;
     SectRgn( (RgnHandle) m_macBoundaryClipRgn  , (RgnHandle) window->GetUpdateRegion().GetWXHRGN() , (RgnHandle) m_macBoundaryClipRgn ) ;
-    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
+    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_deviceLocalOriginX , m_deviceLocalOriginY ) ;
     CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
     SetBackground(MacGetBackgroundBrush(window));
 #endif
     CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
     SetBackground(MacGetBackgroundBrush(window));
 #endif
index 58b2eb7a1327e5003afa6e052cea49d37b8669e7..93102ac2456f3f4c6f2e9be06ad66a298d046890 100644 (file)
@@ -224,8 +224,7 @@ void wxMacCarbonPrinterDC::StartPage( wxPrinterDC* dc )
             CGContextTranslateCTM( pageContext , -paperRect.left , paperRect.bottom ) ;
             CGContextScaleCTM( pageContext , 1 , -1 ) ;
 #else
             CGContextTranslateCTM( pageContext , -paperRect.left , paperRect.bottom ) ;
             CGContextScaleCTM( pageContext , 1 , -1 ) ;
 #else
-            dc->m_macLocalOrigin.x = (int) rPage.left;
-            dc->m_macLocalOrigin.y = (int) rPage.top;
+            dc->SetDeviceLocalOrigin( (wxCoord) rPage.left, (wxCoord) rPage.top );
 #endif
         }
         // since this is a non-critical error, we set the flag back
 #endif
         }
         // since this is a non-critical error, we set the flag back
index 4c985b910fbe0b01f09be400e8e7ba78ffde1d0a..07e8218b4b49525df178ba071ad76191825bd4f6 100644 (file)
@@ -43,8 +43,8 @@ wxScreenDC::wxScreenDC()
     Point pt = { 0,0 } ;
     LocalToGlobal( &pt ) ;
     SetPort( port ) ;
     Point pt = { 0,0 } ;
     LocalToGlobal( &pt ) ;
     SetPort( port ) ;
-    m_macLocalOrigin.x = -pt.h ;
-    m_macLocalOrigin.y = -pt.v ;
+    m_deviceLocalOriginX = -pt.h ;
+    m_deviceLocalOriginY = -pt.v ;
 
     BitMap screenBits;
     GetQDGlobalsScreenBits( &screenBits );
 
     BitMap screenBits;
     GetQDGlobalsScreenBits( &screenBits );
@@ -58,7 +58,7 @@ wxScreenDC::wxScreenDC()
     m_maxY = screenBits.bounds.bottom ;
 
     MacSetRectRgn( (RgnHandle) m_macBoundaryClipRgn , m_minX , m_minY , m_maxX , m_maxY ) ;
     m_maxY = screenBits.bounds.bottom ;
 
     MacSetRectRgn( (RgnHandle) m_macBoundaryClipRgn , m_minX , m_minY , m_maxX , m_maxY ) ;
-    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_macLocalOrigin.x , m_macLocalOrigin.y ) ;
+    OffsetRgn( (RgnHandle) m_macBoundaryClipRgn , m_deviceLocalOriginX , m_deviceLocalOriginY ) ;
     CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
 #endif
     m_ok = true ;
     CopyRgn( (RgnHandle) m_macBoundaryClipRgn , (RgnHandle) m_macCurrentClipRgn ) ;
 #endif
     m_ok = true ;
index 08c78c6a1d5b7d2794e7cfc1a2149a90c85c0794..7ec1cb6030a0d73e056d426007369dbc69933299 100644 (file)
@@ -1250,7 +1250,6 @@ void wxDC::DoGetTextExtent(const wxString& string, wxCoord *x, wxCoord *y,
 }
 
 
 }
 
 
-
 // ---------------------------------------------------------------------------
 // mapping modes
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 // mapping modes
 // ---------------------------------------------------------------------------
@@ -1270,114 +1269,6 @@ void wxDC::ComputeScaleAndOrigin()
     m_scaleX = newX, m_scaleY = newY;
 }
 
     m_scaleX = newX, m_scaleY = newY;
 }
 
-void wxDC::SetMapMode(int mode)
-{
-    switch (mode)
-    {
-        case wxMM_TWIPS:
-          SetLogicalScale(twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y);
-          break;
-        case wxMM_POINTS:
-          SetLogicalScale(pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y);
-          break;
-        case wxMM_METRIC:
-          SetLogicalScale(m_mm_to_pix_x, m_mm_to_pix_y);
-          break;
-        case wxMM_LOMETRIC:
-          SetLogicalScale(m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0);
-          break;
-        default:
-        case wxMM_TEXT:
-          SetLogicalScale(1.0, 1.0);
-          break;
-    }
-    m_mappingMode = mode;
-}
-
-void wxDC::SetUserScale( double x, double y )
-{
-    // allow negative ? -> no
-    m_userScaleX = x;
-    m_userScaleY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetLogicalScale( double x, double y )
-{
-    // allow negative ?
-    m_logicalScaleX = x;
-    m_logicalScaleY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetLogicalOrigin( wxCoord x, wxCoord y )
-{
-    m_logicalOriginX = x * m_signX;   // is this still correct ?
-    m_logicalOriginY = y * m_signY;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetDeviceOrigin( wxCoord x, wxCoord y )
-{
-    // only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
-    m_deviceOriginX = x;
-    m_deviceOriginY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
-{
-    // only wxPostScripDC has m_signX = -1, we override SetAxisOrientation there
-    m_signX = (xLeftRight ?  1 : -1);
-    m_signY = (yBottomUp  ? -1 :  1);
-    ComputeScaleAndOrigin();
-}
-
-// ---------------------------------------------------------------------------
-// coordinates transformations
-// ---------------------------------------------------------------------------
-
-wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
-{
-    return ((wxDC *)this)->XDEV2LOG(x);
-}
-
-wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
-{
-    return ((wxDC *)this)->YDEV2LOG(y);
-}
-
-wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
-{
-    return ((wxDC *)this)->XDEV2LOGREL(x);
-}
-
-wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
-{
-    return ((wxDC *)this)->YDEV2LOGREL(y);
-}
-
-wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
-{
-    return ((wxDC *)this)->XLOG2DEV(x);
-}
-
-wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
-{
-    return ((wxDC *)this)->YLOG2DEV(y);
-}
-
-wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
-{
-    return ((wxDC *)this)->XLOG2DEVREL(x);
-}
-
-wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
-{
-    return ((wxDC *)this)->YLOG2DEVREL(y);
-}
-
-
 void wxDC::DoGetSize(int *w, int *h) const
 {
     if (w) *w = m_MGLDC->sizex()+1;
 void wxDC::DoGetSize(int *w, int *h) const
 {
     if (w) *w = m_MGLDC->sizex()+1;
index 939442bd32b4d5650b470603cb968415c05da26d..042d25d8c7a8ddb7ad81e216d6fd09cc031ad516 100644 (file)
@@ -28,9 +28,6 @@ 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_backgroundMode = wxTRANSPARENT;
 
     m_isInteractive = false;
@@ -102,115 +99,3 @@ wxSize wxDC::GetPPI() const
     // TODO (should probably be pure virtual)
     return wxSize(0, 0);
 }
     // TODO (should probably be pure virtual)
     return wxSize(0, 0);
 }
-
-void wxDC::SetMapMode( int mode )
-{
-    switch (mode)
-    {
-    case wxMM_TWIPS:
-        SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
-        break;
-    case wxMM_POINTS:
-        SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
-        break;
-    case wxMM_METRIC:
-        SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
-        break;
-    case wxMM_LOMETRIC:
-        SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
-        break;
-    default:
-    case wxMM_TEXT:
-        SetLogicalScale( 1.0, 1.0 );
-        break;
-    }
-    if (mode != wxMM_TEXT)
-    {
-        m_needComputeScaleX = true;
-        m_needComputeScaleY = true;
-    }
-}
-
-void wxDC::SetUserScale( double x, double y )
-{
-    // allow negative ? -> no
-    m_userScaleX = x;
-    m_userScaleY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetLogicalScale( double x, double y )
-{
-    // allow negative ?
-    m_logicalScaleX = x;
-    m_logicalScaleY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetLogicalOrigin( wxCoord x, wxCoord y )
-{
-    m_logicalOriginX = x * m_signX;   // is this still correct ?
-    m_logicalOriginY = y * m_signY;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetDeviceOrigin( wxCoord x, wxCoord y )
-{
-    // only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
-    m_deviceOriginX = x;
-    m_deviceOriginY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
-{
-    m_signX = xLeftRight ?  1 : -1;
-    m_signY = yBottomUp  ? -1 :  1;
-    ComputeScaleAndOrigin();
-}
-
-wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
-{
-  return ((wxDC *)this)->XDEV2LOG(x);
-}
-
-wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
-{
-  return ((wxDC *)this)->YDEV2LOG(y);
-}
-
-wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
-{
-  return ((wxDC *)this)->XDEV2LOGREL(x);
-}
-
-wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
-{
-  return ((wxDC *)this)->YDEV2LOGREL(y);
-}
-
-wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
-{
-  return ((wxDC *)this)->XLOG2DEV(x);
-}
-
-wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
-{
-  return ((wxDC *)this)->YLOG2DEV(y);
-}
-
-wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
-{
-  return ((wxDC *)this)->XLOG2DEVREL(x);
-}
-
-wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
-{
-  return ((wxDC *)this)->YLOG2DEVREL(y);
-}
-
-void wxDC::ComputeScaleAndOrigin()
-{
-    m_scaleX = m_logicalScaleX * m_userScaleX;
-    m_scaleY = m_logicalScaleY * m_userScaleY;
-}
index d13264eec0ad426306e305940069109c690fac2d..2a205d5f011e83129310ed95cbd0494777024947 100644 (file)
@@ -585,17 +585,7 @@ void wxDC::Clear()
     ::FillRect(GetHdc(), &rect, brush);
     ::DeleteObject(brush);
 
     ::FillRect(GetHdc(), &rect, brush);
     ::DeleteObject(brush);
 
-#ifndef __WXWINCE__
-    int width = DeviceToLogicalXRel(VIEWPORT_EXTENT)*m_signX,
-        height = DeviceToLogicalYRel(VIEWPORT_EXTENT)*m_signY;
-
-    ::SetMapMode(GetHdc(), MM_ANISOTROPIC);
-
-    ::SetViewportExtEx(GetHdc(), VIEWPORT_EXTENT, VIEWPORT_EXTENT, NULL);
-    ::SetWindowExtEx(GetHdc(), width, height, NULL);
-    ::SetViewportOrgEx(GetHdc(), (int)m_deviceOriginX, (int)m_deviceOriginY, NULL);
-    ::SetWindowOrgEx(GetHdc(), (int)m_logicalOriginX, (int)m_logicalOriginY, NULL);
-#endif
+    RealizeScaleAndOrigin();
 }
 
 bool wxDC::DoFloodFill(wxCoord WXUNUSED_IN_WINCE(x),
 }
 
 bool wxDC::DoFloodFill(wxCoord WXUNUSED_IN_WINCE(x),
@@ -1851,8 +1841,25 @@ bool wxDC::DoGetPartialTextExtents(const wxString& text, wxArrayInt& widths) con
     return true;
 }
 
     return true;
 }
 
+void wxDC::RealizeScaleAndOrigin()
+{
+    // VZ: it seems very wasteful to always use MM_ANISOTROPIC when in 99% of
+    //     cases we could do with MM_TEXT and in the remaining 0.9% with
+    //     MM_ISOTROPIC (TODO!)
+#ifndef __WXWINCE__
+    ::SetMapMode(GetHdc(), MM_ANISOTROPIC);
 
 
+    int width = DeviceToLogicalXRel(VIEWPORT_EXTENT)*m_signX,
+        height = DeviceToLogicalYRel(VIEWPORT_EXTENT)*m_signY;
 
 
+    ::SetViewportExtEx(GetHdc(), VIEWPORT_EXTENT, VIEWPORT_EXTENT, NULL);
+    ::SetWindowExtEx(GetHdc(), width, height, NULL);
+
+    ::SetViewportOrgEx(GetHdc(), m_deviceOriginX, m_deviceOriginY, NULL);
+    ::SetWindowOrgEx(GetHdc(), m_logicalOriginX, m_logicalOriginY, NULL);
+#endif
+    
+}
 
 void wxDC::SetMapMode(int mode)
 {
 
 void wxDC::SetMapMode(int mode)
 {
@@ -1907,22 +1914,10 @@ void wxDC::SetMapMode(int mode)
                 wxFAIL_MSG( _T("unknown mapping mode in SetMapMode") );
         }
     }
                 wxFAIL_MSG( _T("unknown mapping mode in SetMapMode") );
         }
     }
-
-    // VZ: it seems very wasteful to always use MM_ANISOTROPIC when in 99% of
-    //     cases we could do with MM_TEXT and in the remaining 0.9% with
-    //     MM_ISOTROPIC (TODO!)
-#ifndef __WXWINCE__
-    ::SetMapMode(GetHdc(), MM_ANISOTROPIC);
-
-    int width = DeviceToLogicalXRel(VIEWPORT_EXTENT)*m_signX,
-        height = DeviceToLogicalYRel(VIEWPORT_EXTENT)*m_signY;
-
-    ::SetViewportExtEx(GetHdc(), VIEWPORT_EXTENT, VIEWPORT_EXTENT, NULL);
-    ::SetWindowExtEx(GetHdc(), width, height, NULL);
-
-    ::SetViewportOrgEx(GetHdc(), m_deviceOriginX, m_deviceOriginY, NULL);
-    ::SetWindowOrgEx(GetHdc(), m_logicalOriginX, m_logicalOriginY, NULL);
-#endif
+    
+    ComputeScaleAndOrigin();
+    
+    RealizeScaleAndOrigin();
 }
 
 void wxDC::SetUserScale(double x, double y)
 }
 
 void wxDC::SetUserScale(double x, double y)
@@ -1932,44 +1927,25 @@ void wxDC::SetUserScale(double x, double y)
     if ( x == m_userScaleX && y == m_userScaleY )
         return;
 
     if ( x == m_userScaleX && y == m_userScaleY )
         return;
 
-    m_userScaleX = x;
-    m_userScaleY = y;
-
-    this->SetMapMode(m_mappingMode);
+    wxDCBase::SetUserScale(x,y);
+    
+    RealizeScaleAndOrigin();
 }
 
 }
 
-void wxDC::SetAxisOrientation(bool WXUNUSED_IN_WINCE(xLeftRight),
-                              bool WXUNUSED_IN_WINCE(yBottomUp))
+void wxDC::SetAxisOrientation(bool xLeftRight,
+                              bool yBottomUp)
 {
     WXMICROWIN_CHECK_HDC
 
 {
     WXMICROWIN_CHECK_HDC
 
-#ifndef __WXWINCE__
     int signX = xLeftRight ? 1 : -1,
         signY = yBottomUp ? -1 : 1;
     int signX = xLeftRight ? 1 : -1,
         signY = yBottomUp ? -1 : 1;
-
-    if ( signX != m_signX || signY != m_signY )
-    {
-        m_signX = signX;
-        m_signY = signY;
-
-        SetMapMode(m_mappingMode);
-    }
-#endif
-}
-
-void wxDC::SetSystemScale(double x, double y)
-{
-    WXMICROWIN_CHECK_HDC
-
-    if ( x == m_scaleX && y == m_scaleY )
+        
+    if (signX == m_signX && signY == m_signY)
         return;
         return;
+    
+    wxDCBase::SetAxisOrientation( xLeftRight, yBottomUp );
 
 
-    m_scaleX = x;
-    m_scaleY = y;
-
-#ifndef __WXWINCE__
-    SetMapMode(m_mappingMode);
-#endif
+    RealizeScaleAndOrigin();
 }
 
 void wxDC::SetLogicalOrigin(wxCoord x, wxCoord y)
 }
 
 void wxDC::SetLogicalOrigin(wxCoord x, wxCoord y)
@@ -1979,8 +1955,7 @@ void wxDC::SetLogicalOrigin(wxCoord x, wxCoord y)
     if ( x == m_logicalOriginX && y == m_logicalOriginY )
         return;
 
     if ( x == m_logicalOriginX && y == m_logicalOriginY )
         return;
 
-    m_logicalOriginX = x;
-    m_logicalOriginY = y;
+    wxDCBase::SetLogicalOrigin( x, y );
 
 #ifndef __WXWINCE__
     ::SetWindowOrgEx(GetHdc(), (int)m_logicalOriginX, (int)m_logicalOriginY, NULL);
 
 #ifndef __WXWINCE__
     ::SetWindowOrgEx(GetHdc(), (int)m_logicalOriginX, (int)m_logicalOriginY, NULL);
@@ -1993,64 +1968,16 @@ void wxDC::SetDeviceOrigin(wxCoord x, wxCoord y)
 
     if ( x == m_deviceOriginX && y == m_deviceOriginY )
         return;
 
     if ( x == m_deviceOriginX && y == m_deviceOriginY )
         return;
-
-    m_deviceOriginX = x;
-    m_deviceOriginY = y;
+        
+    wxDCBase::SetDeviceOrigin( x, y );
 
     ::SetViewportOrgEx(GetHdc(), (int)m_deviceOriginX, (int)m_deviceOriginY, NULL);
 }
 
 
     ::SetViewportOrgEx(GetHdc(), (int)m_deviceOriginX, (int)m_deviceOriginY, NULL);
 }
 
-// ---------------------------------------------------------------------------
-// coordinates transformations
-// ---------------------------------------------------------------------------
-
-wxCoord wxDC::DeviceToLogicalX(wxCoord x) const
-{
-    return DeviceToLogicalXRel(x - m_deviceOriginX)*m_signX + m_logicalOriginX;
-}
-
-wxCoord wxDC::DeviceToLogicalXRel(wxCoord x) const
-{
-    // axis orientation is not taken into account for conversion of a distance
-    return (wxCoord)(x / (m_logicalScaleX*m_userScaleX*m_scaleX));
-}
-
-wxCoord wxDC::DeviceToLogicalY(wxCoord y) const
-{
-    return DeviceToLogicalYRel(y - m_deviceOriginY)*m_signY + m_logicalOriginY;
-}
-
-wxCoord wxDC::DeviceToLogicalYRel(wxCoord y) const
-{
-    // axis orientation is not taken into account for conversion of a distance
-    return (wxCoord)( y / (m_logicalScaleY*m_userScaleY*m_scaleY));
-}
-
-wxCoord wxDC::LogicalToDeviceX(wxCoord x) const
-{
-    return LogicalToDeviceXRel(x - m_logicalOriginX)*m_signX + m_deviceOriginX;
-}
-
-wxCoord wxDC::LogicalToDeviceXRel(wxCoord x) const
-{
-    // axis orientation is not taken into account for conversion of a distance
-    return (wxCoord) (x*m_logicalScaleX*m_userScaleX*m_scaleX);
-}
-
-wxCoord wxDC::LogicalToDeviceY(wxCoord y) const
-{
-    return LogicalToDeviceYRel(y - m_logicalOriginY)*m_signY + m_deviceOriginY;
-}
-
-wxCoord wxDC::LogicalToDeviceYRel(wxCoord y) const
-{
-    // axis orientation is not taken into account for conversion of a distance
-    return (wxCoord) (y*m_logicalScaleY*m_userScaleY*m_scaleY);
-}
-
 // ---------------------------------------------------------------------------
 // bit blit
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 // bit blit
 // ---------------------------------------------------------------------------
+
 bool wxDC::DoBlit(wxCoord dstX, wxCoord dstY,
                   wxCoord dstWidth, wxCoord dstHeight,
                   wxDC *source,
 bool wxDC::DoBlit(wxCoord dstX, wxCoord dstY,
                   wxCoord dstWidth, wxCoord dstHeight,
                   wxDC *source,
@@ -2417,8 +2344,7 @@ void wxDC::SetLogicalScale(double x, double y)
 {
     WXMICROWIN_CHECK_HDC
 
 {
     WXMICROWIN_CHECK_HDC
 
-    m_logicalScaleX = x;
-    m_logicalScaleY = y;
+    wxDCBase::SetLogicalScale(x,y);
 }
 
 // ----------------------------------------------------------------------------
 }
 
 // ----------------------------------------------------------------------------
index ab694e6a95b1383941846e37df7ff12b153f7f92..3e6e349b6a5be78fd749103511c2ca87a40b8c20 100644 (file)
@@ -2294,6 +2294,9 @@ void wxDC::SetMapMode(
     m_nWindowExtX = (int)MS_XDEV2LOG(VIEWPORT_EXTENT);
     m_nWindowExtY = (int)MS_YDEV2LOG(VIEWPORT_EXTENT);
     // ????
     m_nWindowExtX = (int)MS_XDEV2LOG(VIEWPORT_EXTENT);
     m_nWindowExtY = (int)MS_YDEV2LOG(VIEWPORT_EXTENT);
     // ????
+    
+    ComputeScaleAndOrigin();
+    
 }; // end of wxDC::SetMapMode
 
 void wxDC::SetUserScale( double dX,
 }; // end of wxDC::SetMapMode
 
 void wxDC::SetUserScale( double dX,
@@ -2314,17 +2317,6 @@ void wxDC::SetAxisOrientation( bool bXLeftRight,
     SetMapMode(m_mappingMode);
 } // end of wxDC::SetAxisOrientation
 
     SetMapMode(m_mappingMode);
 } // end of wxDC::SetAxisOrientation
 
-void wxDC::SetSystemScale(
-  double                            dX
-, double                            dY
-)
-{
-    m_scaleX = dX;
-    m_scaleY = dY;
-
-    SetMapMode(m_mappingMode);
-} // end of wxDC::SetSystemScale
-
 void wxDC::SetLogicalOrigin(
   wxCoord                           vX
 , wxCoord                           vY
 void wxDC::SetLogicalOrigin(
   wxCoord                           vX
 , wxCoord                           vY
@@ -2365,54 +2357,6 @@ void wxDC::SetDeviceOrigin(
                         );
 }; // end of wxDC::SetDeviceOrigin
 
                         );
 }; // end of wxDC::SetDeviceOrigin
 
-// ---------------------------------------------------------------------------
-// coordinates transformations
-// ---------------------------------------------------------------------------
-
-wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
-{
-    return (wxCoord) (((x) - m_deviceOriginX)/(m_logicalScaleX*m_userScaleX*m_signX*m_scaleX) - m_logicalOriginX);
-}
-
-wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
-{
-    // axis orientation is not taken into account for conversion of a distance
-    return (wxCoord) ((x)/(m_logicalScaleX*m_userScaleX*m_scaleX));
-}
-
-wxCoord wxDC::DeviceToLogicalY(wxCoord y) const
-{
-    return (wxCoord) (((y) - m_deviceOriginY)/(m_logicalScaleY*m_userScaleY*m_signY*m_scaleY) - m_logicalOriginY);
-}
-
-wxCoord wxDC::DeviceToLogicalYRel(wxCoord y) const
-{
-    // axis orientation is not taken into account for conversion of a distance
-    return (wxCoord) ((y)/(m_logicalScaleY*m_userScaleY*m_scaleY));
-}
-
-wxCoord wxDC::LogicalToDeviceX(wxCoord x) const
-{
-    return (wxCoord) ((x - m_logicalOriginX)*m_logicalScaleX*m_userScaleX*m_signX*m_scaleX + m_deviceOriginX);
-}
-
-wxCoord wxDC::LogicalToDeviceXRel(wxCoord x) const
-{
-    // axis orientation is not taken into account for conversion of a distance
-    return (wxCoord) (x*m_logicalScaleX*m_userScaleX*m_scaleX);
-}
-
-wxCoord wxDC::LogicalToDeviceY(wxCoord y) const
-{
-    return (wxCoord) ((y - m_logicalOriginY)*m_logicalScaleY*m_userScaleY*m_signY*m_scaleY + m_deviceOriginY);
-}
-
-wxCoord wxDC::LogicalToDeviceYRel(wxCoord y) const
-{
-    // axis orientation is not taken into account for conversion of a distance
-    return (wxCoord) (y*m_logicalScaleY*m_userScaleY*m_scaleY);
-}
-
 // ---------------------------------------------------------------------------
 // bit blit
 // ---------------------------------------------------------------------------
 // ---------------------------------------------------------------------------
 // bit blit
 // ---------------------------------------------------------------------------
index 6d81131809f7bd4bb4df39be190037e9aefa5b88..1433d94f4a5cb10008c225e5ad453dc9b720a060 100644 (file)
@@ -28,28 +28,11 @@ wxDC::wxDC()
 {
     m_ok = false;
 
 {
     m_ok = false;
 
-#if 1
-    m_mm_to_pix_x = 1.0;
-    m_mm_to_pix_y = 1.0;
-#else
-    m_mm_to_pix_x = (double)wxGetDisplaySize().GetWidth() /
-                    (double)wxGetDisplaySizeMM().GetWidth();
-    m_mm_to_pix_y = (double)wxGetDisplaySize().GetHeight() /
-                    (double)wxGetDisplaySizeMM().GetHeight();
-#endif
-
-    m_needComputeScaleX = false; /* not used yet */
-    m_needComputeScaleY = false; /* not used yet */
-
-    m_logicalFunction = wxCOPY;
-
     m_pen = *wxBLACK_PEN;
     m_font = *wxNORMAL_FONT;
     m_brush = *wxWHITE_BRUSH;
 
     m_backgroundMode = wxTRANSPARENT;
     m_pen = *wxBLACK_PEN;
     m_font = *wxNORMAL_FONT;
     m_brush = *wxWHITE_BRUSH;
 
     m_backgroundMode = wxTRANSPARENT;
-
-    m_isInteractive = false;  // ???
 }
 
 void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
 }
 
 void wxDC::DoSetClippingRegion( wxCoord x, wxCoord y, wxCoord width, wxCoord height )
@@ -78,115 +61,3 @@ wxSize wxDC::GetPPI() const
     // TODO (should probably be pure virtual)
     return wxSize(0, 0);
 }
     // TODO (should probably be pure virtual)
     return wxSize(0, 0);
 }
-
-void wxDC::SetMapMode( int mode )
-{
-    switch (mode)
-    {
-    case wxMM_TWIPS:
-        SetLogicalScale( twips2mm*m_mm_to_pix_x, twips2mm*m_mm_to_pix_y );
-        break;
-    case wxMM_POINTS:
-        SetLogicalScale( pt2mm*m_mm_to_pix_x, pt2mm*m_mm_to_pix_y );
-        break;
-    case wxMM_METRIC:
-        SetLogicalScale( m_mm_to_pix_x, m_mm_to_pix_y );
-        break;
-    case wxMM_LOMETRIC:
-        SetLogicalScale( m_mm_to_pix_x/10.0, m_mm_to_pix_y/10.0 );
-        break;
-    default:
-    case wxMM_TEXT:
-        SetLogicalScale( 1.0, 1.0 );
-        break;
-    }
-    if (mode != wxMM_TEXT)
-    {
-        m_needComputeScaleX = true;
-        m_needComputeScaleY = true;
-    }
-}
-
-void wxDC::SetUserScale( double x, double y )
-{
-    // allow negative ? -> no
-    m_userScaleX = x;
-    m_userScaleY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetLogicalScale( double x, double y )
-{
-    // allow negative ?
-    m_logicalScaleX = x;
-    m_logicalScaleY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetLogicalOrigin( wxCoord x, wxCoord y )
-{
-    m_logicalOriginX = x * m_signX;   // is this still correct ?
-    m_logicalOriginY = y * m_signY;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetDeviceOrigin( wxCoord x, wxCoord y )
-{
-    // only wxPostScripDC has m_signX = -1, we override SetDeviceOrigin there
-    m_deviceOriginX = x;
-    m_deviceOriginY = y;
-    ComputeScaleAndOrigin();
-}
-
-void wxDC::SetAxisOrientation( bool xLeftRight, bool yBottomUp )
-{
-    m_signX = xLeftRight ?  1 : -1;
-    m_signY = yBottomUp  ? -1 :  1;
-    ComputeScaleAndOrigin();
-}
-
-wxCoord wxDCBase::DeviceToLogicalX(wxCoord x) const
-{
-  return ((wxDC *)this)->XDEV2LOG(x);
-}
-
-wxCoord wxDCBase::DeviceToLogicalY(wxCoord y) const
-{
-  return ((wxDC *)this)->YDEV2LOG(y);
-}
-
-wxCoord wxDCBase::DeviceToLogicalXRel(wxCoord x) const
-{
-  return ((wxDC *)this)->XDEV2LOGREL(x);
-}
-
-wxCoord wxDCBase::DeviceToLogicalYRel(wxCoord y) const
-{
-  return ((wxDC *)this)->YDEV2LOGREL(y);
-}
-
-wxCoord wxDCBase::LogicalToDeviceX(wxCoord x) const
-{
-  return ((wxDC *)this)->XLOG2DEV(x);
-}
-
-wxCoord wxDCBase::LogicalToDeviceY(wxCoord y) const
-{
-  return ((wxDC *)this)->YLOG2DEV(y);
-}
-
-wxCoord wxDCBase::LogicalToDeviceXRel(wxCoord x) const
-{
-  return ((wxDC *)this)->XLOG2DEVREL(x);
-}
-
-wxCoord wxDCBase::LogicalToDeviceYRel(wxCoord y) const
-{
-  return ((wxDC *)this)->YLOG2DEVREL(y);
-}
-
-void wxDC::ComputeScaleAndOrigin()
-{
-    m_scaleX = m_logicalScaleX * m_userScaleX;
-    m_scaleY = m_logicalScaleY * m_userScaleY;
-}