]> git.saurik.com Git - wxWidgets.git/commitdiff
Metric conversion constants not doubled in each port code.
authorWłodzimierz Skiba <abx@abx.art.pl>
Tue, 21 Dec 2004 16:25:59 +0000 (16:25 +0000)
committerWłodzimierz Skiba <abx@abx.art.pl>
Tue, 21 Dec 2004 16:25:59 +0000 (16:25 +0000)
git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31101 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775

13 files changed:
contrib/include/wx/svg/dcsvg.h
include/wx/dcsvg.h
include/wx/math.h
include/wx/msw/private.h
include/wx/os2/private.h
src/gtk/dc.cpp
src/gtk1/dc.cpp
src/mac/carbon/dc.cpp
src/mac/classic/dc.cpp
src/mgl/dc.cpp
src/motif/dc.cpp
src/msw/textctrl.cpp
src/x11/dc.cpp

index e6e19364daf76e41306eb1a6d1c7385a9333e596..ce5b4a2218d16bc1552a30bbc9f5fe15ef967755 100644 (file)
 #pragma warn -ccc
 #endif
 
-//-----------------------------------------------------------------------------
-// constants
-//-----------------------------------------------------------------------------
-
-#define mm2inches        0.0393700787402
-#define inches2mm        25.4
-#define mm2twips         56.6929133859
-#define twips2mm         0.0176388888889
-#define mm2pt            2.83464566929
-#define pt2mm            0.352777777778
-
 class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC
 {
 
index e6e19364daf76e41306eb1a6d1c7385a9333e596..ce5b4a2218d16bc1552a30bbc9f5fe15ef967755 100644 (file)
 #pragma warn -ccc
 #endif
 
-//-----------------------------------------------------------------------------
-// constants
-//-----------------------------------------------------------------------------
-
-#define mm2inches        0.0393700787402
-#define inches2mm        25.4
-#define mm2twips         56.6929133859
-#define twips2mm         0.0176388888889
-#define mm2pt            2.83464566929
-#define pt2mm            0.352777777778
-
 class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC
 {
 
index cd96cd6bee948a38afcfa64e828f538bf3892d50..7a8651f7e00aa3a156dcfde3fe094adcb237c868 100644 (file)
     #define M_PI 3.1415926535897932384626433832795
 #endif
 
+// Scaling factors for various unit conversions
+#ifndef METRIC_CONVERSION_CONSTANT
+    #define METRIC_CONVERSION_CONSTANT 0.0393700787
+#endif
+
+#ifndef mm2inches
+    #define mm2inches (METRIC_CONVERSION_CONSTANT)
+#endif
+
+#ifndef inches2mm
+    #define inches2mm (1/(mm2inches))
+#endif
+
+#ifndef mm2twips
+    #define mm2twips (METRIC_CONVERSION_CONSTANT*1440)
+#endif
+
+#ifndef twips2mm
+    #define twips2mm (1/(mm2twips))
+#endif
+
+#ifndef mm2pt
+    #define mm2pt (METRIC_CONVERSION_CONSTANT*72)
+#endif
+
+#ifndef pt2mm
+    #define pt2mm (1/(mm2pt))
+#endif
+
+
 /* unknown __VISAGECC__, __SYMANTECCC__ */
 
 #if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__)
index 6ddf2d4c5bedd36bf12fda942174e8668b2a9b25..a7b41605a0dfbc2e14063c80f7989501e93e7523 100644 (file)
@@ -33,19 +33,6 @@ class WXDLLEXPORT wxWindow;
 // private constants
 // ---------------------------------------------------------------------------
 
-// Conversion
-static const double METRIC_CONVERSION_CONSTANT = 0.0393700787;
-
-// Scaling factors for various unit conversions
-static const double mm2inches = (METRIC_CONVERSION_CONSTANT);
-static const double inches2mm = (1/METRIC_CONVERSION_CONSTANT);
-
-static const double mm2twips = (METRIC_CONVERSION_CONSTANT*1440);
-static const double twips2mm = (1/(METRIC_CONVERSION_CONSTANT*1440));
-
-static const double mm2pt = (METRIC_CONVERSION_CONSTANT*72);
-static const double pt2mm = (1/(METRIC_CONVERSION_CONSTANT*72));
-
 // 260 was taken from windef.h
 #ifndef MAX_PATH
     #define MAX_PATH  260
index 6654816b583d719416f9005c1aa21f3b9bc05933..024663695baf88c0d635235af80e9813e23de4b2 100644 (file)
@@ -46,19 +46,6 @@ class WXDLLEXPORT wxBitmap;
 // private constants
 // ---------------------------------------------------------------------------
 
-// Conversion
-static const double METRIC_CONVERSION_CONSTANT = 0.0393700787;
-
-// Scaling factors for various unit conversions
-static const double mm2inches = (METRIC_CONVERSION_CONSTANT);
-static const double inches2mm = (1/METRIC_CONVERSION_CONSTANT);
-
-static const double mm2twips = (METRIC_CONVERSION_CONSTANT*1440);
-static const double twips2mm = (1/(METRIC_CONVERSION_CONSTANT*1440));
-
-static const double mm2pt = (METRIC_CONVERSION_CONSTANT*72);
-static const double pt2mm = (1/(METRIC_CONVERSION_CONSTANT*72));
-
 //
 // Constant strings for control names and classes
 //
index c74bbc81bb99e0e979b590f2509242b4473c70b2..00b3fafcb5816656ab2f8e01acd73b040d62e60b 100644 (file)
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
 
-//-----------------------------------------------------------------------------
-// constants
-//-----------------------------------------------------------------------------
-
-#define mm2inches        0.0393700787402
-#define inches2mm        25.4
-#define mm2twips         56.6929133859
-#define twips2mm         0.0176388888889
-#define mm2pt            2.83464566929
-#define pt2mm            0.352777777778
-
 //-----------------------------------------------------------------------------
 // wxDC
 //-----------------------------------------------------------------------------
@@ -117,7 +106,7 @@ void wxDC::SetMapMode( int mode )
           break;
     }
     m_mappingMode = mode;
-    
+
 /*  we don't do this mega optimisation
     if (mode != wxMM_TEXT)
     {
index c74bbc81bb99e0e979b590f2509242b4473c70b2..00b3fafcb5816656ab2f8e01acd73b040d62e60b 100644 (file)
 #include <gdk/gdk.h>
 #include <gtk/gtk.h>
 
-//-----------------------------------------------------------------------------
-// constants
-//-----------------------------------------------------------------------------
-
-#define mm2inches        0.0393700787402
-#define inches2mm        25.4
-#define mm2twips         56.6929133859
-#define twips2mm         0.0176388888889
-#define mm2pt            2.83464566929
-#define pt2mm            0.352777777778
-
 //-----------------------------------------------------------------------------
 // wxDC
 //-----------------------------------------------------------------------------
@@ -117,7 +106,7 @@ void wxDC::SetMapMode( int mode )
           break;
     }
     m_mappingMode = mode;
-    
+
 /*  we don't do this mega optimisation
     if (mode != wxMM_TEXT)
     {
index 028c3cd0fcfbccf3a712b08158880b2eb55c44ce..6485dc81e5e4c7c21e509926033b37c5b31bfc14 100644 (file)
@@ -40,13 +40,6 @@ IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
 // constants
 //-----------------------------------------------------------------------------
 
-#define mm2inches        0.0393700787402
-#define inches2mm        25.4
-#define mm2twips        56.6929133859
-#define twips2mm        0.0176388888889
-#define mm2pt            2.83464566929
-#define pt2mm            0.352777777778
-
 const double RAD2DEG  = 180.0 / M_PI;
 const short kEmulatedMode = -1 ;
 const short kUnsupportedMode = -2 ;
index 5be3660fc2a7e35b546dc5d6901219942413379e..ae7936dd6cce78827bfbc60a51c64b970d4a6b92 100644 (file)
@@ -40,13 +40,6 @@ IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
 // constants
 //-----------------------------------------------------------------------------
 
-#define mm2inches        0.0393700787402
-#define inches2mm        25.4
-#define mm2twips        56.6929133859
-#define twips2mm        0.0176388888889
-#define mm2pt            2.83464566929
-#define pt2mm            0.352777777778
-
 const double RAD2DEG  = 180.0 / M_PI;
 const short kEmulatedMode = -1 ;
 const short kUnsupportedMode = -2 ;
index 3fb64cab409a014507f1d8e94fe701ea395a8667..37fee41ab79e6641938f55227b2e07b1865696a0 100644 (file)
 // constants
 //-----------------------------------------------------------------------------
 
-const double mm2inches      = 0.0393700787402;
-const double inches2mm      = 25.4;
-const double mm2twips       = 56.6929133859;
-const double twips2mm       = 0.0176388888889;
-const double mm2pt          = 2.83464566929;
-const double pt2mm          = 0.352777777778;
 const double RAD2DEG        = 180.0 / M_PI;
 
 
index 187bf9f0184f0d18415fff7bdded3bf33df091c8..f4d0e3f56d952533d082b3cc7a48a46b4615d078 100644 (file)
 
     IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
 
-//-----------------------------------------------------------------------------
-// constants
-//-----------------------------------------------------------------------------
-
-#define mm2inches        0.0393700787402
-#define inches2mm        25.4
-#define mm2twips         56.6929133859
-#define twips2mm         0.0176388888889
-#define mm2pt            2.83464566929
-#define pt2mm            0.352777777778
-
 //-----------------------------------------------------------------------------
 // wxDC
 //-----------------------------------------------------------------------------
index bf6b78b8365796dd13e259d09f08bc73b7f2b64a..ef70b6f9e34cacc659f9455e60fef9faf5f61de6 100644 (file)
@@ -39,6 +39,7 @@
     #include "wx/log.h"
     #include "wx/app.h"
     #include "wx/menu.h"
+    #include "wx/math.h"
 #endif
 
 #include "wx/module.h"
index 4b82e09a700a4cbab654b9f5f8071d8381017a36..cecac158633b2daa759720e7df15916979a8b3dc 100644 (file)
 
 IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
 
-//-----------------------------------------------------------------------------
-// constants
-//-----------------------------------------------------------------------------
-
-#define mm2inches        0.0393700787402
-#define inches2mm        25.4
-#define mm2twips         56.6929133859
-#define twips2mm         0.0176388888889
-#define mm2pt            2.83464566929
-#define pt2mm            0.352777777778
-
 //-----------------------------------------------------------------------------
 // wxDC
 //-----------------------------------------------------------------------------