Metric conversion constants not doubled in each port code.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxWidgets/trunk@31101 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
This commit is contained in:
Włodzimierz Skiba 2004-12-21 16:25:59 +00:00
parent 885fb02fa1
commit e2bcbdfbc7
13 changed files with 33 additions and 114 deletions

View File

@ -17,17 +17,6 @@
#pragma warn -ccc #pragma warn -ccc
#endif #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 class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC
{ {

View File

@ -17,17 +17,6 @@
#pragma warn -ccc #pragma warn -ccc
#endif #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 class WXDLLIMPEXP_SVG wxSVGFileDC : public wxDC
{ {

View File

@ -26,6 +26,36 @@
#define M_PI 3.1415926535897932384626433832795 #define M_PI 3.1415926535897932384626433832795
#endif #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__ */ /* unknown __VISAGECC__, __SYMANTECCC__ */
#if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__) #if defined(__VISUALC__) || defined(__BORLANDC__) || defined(__WATCOMC__)

View File

@ -33,19 +33,6 @@ class WXDLLEXPORT wxWindow;
// private constants // 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 // 260 was taken from windef.h
#ifndef MAX_PATH #ifndef MAX_PATH
#define MAX_PATH 260 #define MAX_PATH 260

View File

@ -46,19 +46,6 @@ class WXDLLEXPORT wxBitmap;
// private constants // 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 // Constant strings for control names and classes
// //

View File

@ -20,17 +20,6 @@
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include <gtk/gtk.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 // wxDC
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -117,7 +106,7 @@ void wxDC::SetMapMode( int mode )
break; break;
} }
m_mappingMode = mode; m_mappingMode = mode;
/* we don't do this mega optimisation /* we don't do this mega optimisation
if (mode != wxMM_TEXT) if (mode != wxMM_TEXT)
{ {

View File

@ -20,17 +20,6 @@
#include <gdk/gdk.h> #include <gdk/gdk.h>
#include <gtk/gtk.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 // wxDC
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------
@ -117,7 +106,7 @@ void wxDC::SetMapMode( int mode )
break; break;
} }
m_mappingMode = mode; m_mappingMode = mode;
/* we don't do this mega optimisation /* we don't do this mega optimisation
if (mode != wxMM_TEXT) if (mode != wxMM_TEXT)
{ {

View File

@ -40,13 +40,6 @@ IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
// constants // 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 double RAD2DEG = 180.0 / M_PI;
const short kEmulatedMode = -1 ; const short kEmulatedMode = -1 ;
const short kUnsupportedMode = -2 ; const short kUnsupportedMode = -2 ;

View File

@ -40,13 +40,6 @@ IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject)
// constants // 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 double RAD2DEG = 180.0 / M_PI;
const short kEmulatedMode = -1 ; const short kEmulatedMode = -1 ;
const short kUnsupportedMode = -2 ; const short kUnsupportedMode = -2 ;

View File

@ -47,12 +47,6 @@
// constants // 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; const double RAD2DEG = 180.0 / M_PI;

View File

@ -22,17 +22,6 @@
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject) 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 // wxDC
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------

View File

@ -39,6 +39,7 @@
#include "wx/log.h" #include "wx/log.h"
#include "wx/app.h" #include "wx/app.h"
#include "wx/menu.h" #include "wx/menu.h"
#include "wx/math.h"
#endif #endif
#include "wx/module.h" #include "wx/module.h"

View File

@ -19,17 +19,6 @@
IMPLEMENT_ABSTRACT_CLASS(wxDC, wxObject) 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 // wxDC
//----------------------------------------------------------------------------- //-----------------------------------------------------------------------------