From 9f41cac0418ccd046f572932e0ce5743e93eef86 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 11 May 2012 11:02:35 +0200 Subject: [PATCH] Remove PCB_INTERNAL_UNIT define because it is no more used in code. 3D viewer: fix incorrect scaling factor when using nanometers. Very minor other fixes --- 3d-viewer/3d_struct.h | 4 ++-- include/wxBasePcbFrame.h | 5 ----- include/wxPcbStruct.h | 4 ---- include/wxstruct.h | 4 ---- pcbnew/class_netclass.h | 2 +- pcbnew/export_vrml.cpp | 4 ++-- pcbnew/gen_drill_report_files.cpp | 5 +++-- pcbnew/legacy_plugin.cpp | 4 +++- pcbnew/pcbnew.h | 2 +- 9 files changed, 12 insertions(+), 22 deletions(-) diff --git a/3d-viewer/3d_struct.h b/3d-viewer/3d_struct.h index 0941f17fd1..3a8c082433 100644 --- a/3d-viewer/3d_struct.h +++ b/3d-viewer/3d_struct.h @@ -35,9 +35,9 @@ /* 3D modeling units -> PCB units conversion scale: - * 1 "3D model unit" wings3d = 1 unit = 2.54 mm = 0.1 inch + * 1 "3D model unit" wings3d = 1 unit = 2.54 mm = 0.1 inch = 100 mils */ -#define UNITS3D_TO_UNITSPCB 1000 +#define UNITS3D_TO_UNITSPCB (IU_PER_MILS * 100) class S3D_MASTER; diff --git a/include/wxBasePcbFrame.h b/include/wxBasePcbFrame.h index 75e2f781ae..b9e22ac5f4 100644 --- a/include/wxBasePcbFrame.h +++ b/include/wxBasePcbFrame.h @@ -41,11 +41,6 @@ #include -#ifndef PCB_INTERNAL_UNIT -#define PCB_INTERNAL_UNIT 10000 -#endif - - /* Forward declarations of classes. */ class FOOTPRINT_EDIT_FRAME; class FOOTPRINT_VIEWER_FRAME; diff --git a/include/wxPcbStruct.h b/include/wxPcbStruct.h index 7f1736a4c7..fe06fb1ae6 100644 --- a/include/wxPcbStruct.h +++ b/include/wxPcbStruct.h @@ -36,10 +36,6 @@ #include #include -#ifndef PCB_INTERNAL_UNIT -#define PCB_INTERNAL_UNIT 10000 -#endif - /* Forward declarations of classes. */ class PCB_SCREEN; diff --git a/include/wxstruct.h b/include/wxstruct.h index 81cf334c0e..3cfd5427bf 100644 --- a/include/wxstruct.h +++ b/include/wxstruct.h @@ -54,10 +54,6 @@ #define SAFE_DELETE( p ) delete (p); (p) = NULL; #endif -#ifndef EESCHEMA_INTERNAL_UNIT -#define EESCHEMA_INTERNAL_UNIT 1000 -#endif - // Option for dialog boxes #define DIALOG_STYLE wxDEFAULT_DIALOG_STYLE | wxFRAME_FLOAT_ON_PARENT | MAYBE_RESIZE_BORDER diff --git a/pcbnew/class_netclass.h b/pcbnew/class_netclass.h index 73fab5c8a1..5226ffe4a2 100644 --- a/pcbnew/class_netclass.h +++ b/pcbnew/class_netclass.h @@ -67,7 +67,7 @@ protected: STRINGSET m_Members; ///< names of NET members of this class - /// The units on these parameters is 1/10000 of an inch, see define #PCB_INTERNAL_UNIT + /// The units on these parameters is Internal Units (1 decimil or 1 nm) int m_Clearance; ///< clearance when routing diff --git a/pcbnew/export_vrml.cpp b/pcbnew/export_vrml.cpp index 690bb13303..d1c2cfebcf 100644 --- a/pcbnew/export_vrml.cpp +++ b/pcbnew/export_vrml.cpp @@ -1121,8 +1121,8 @@ static void export_vrml_module( BOARD* aPcb, MODULE* aModule, vrmlm->m_MatScale.y * aScalingFactor, vrmlm->m_MatScale.z * aScalingFactor ); - // adjust 3D shape offset position (offset is given inch) - #define UNITS_3D_TO_PCB_UNITS PCB_INTERNAL_UNIT + // adjust 3D shape offset position (offset is given in inch) + #define UNITS_3D_TO_PCB_UNITS (IU_PER_MILS*1000) int offsetx = KiROUND( vrmlm->m_MatPosition.x * UNITS_3D_TO_PCB_UNITS ); int offsety = KiROUND( vrmlm->m_MatPosition.y * UNITS_3D_TO_PCB_UNITS ); double offsetz = vrmlm->m_MatPosition.z * UNITS_3D_TO_PCB_UNITS; diff --git a/pcbnew/gen_drill_report_files.cpp b/pcbnew/gen_drill_report_files.cpp index 9895277c4f..256d9620a1 100644 --- a/pcbnew/gen_drill_report_files.cpp +++ b/pcbnew/gen_drill_report_files.cpp @@ -197,7 +197,7 @@ void GenDrillMapFile( BOARD* aPcb, FILE* aFile, const wxString& aFullFileName, plotY += intervalle; plot_diam = (int) aToolListBuffer[ii].m_Diameter; - x = (int) ( (double) plotX - 20.0 * IU_PER_MILS * CharScale + x = (int) ( (double) plotX - 20.0 * IU_PER_MILS * CharScale - (double)plot_diam / 2.0 ); y = (int) ( (double) plotY + (double) CharSize * CharScale ); plotter->Marker( wxPoint( x, y ), plot_diam, ii ); @@ -268,7 +268,8 @@ void Gen_Drill_PcbMap( BOARD* aPcb, PLOTTER* aPlotter, if( aToolListBuffer.size() > PLOTTER::MARKER_COUNT ) { DisplayInfoMessage( NULL, - _( " Drill map: Too many diameter values to draw to draw one symbol per drill value\nPlot will use circle shape for some drill values" ), + _( " Drill map: Too many diameter values to draw one symbol per drill value\n" +"Plot will use circle shape for some drill values" ), 10 ); } diff --git a/pcbnew/legacy_plugin.cpp b/pcbnew/legacy_plugin.cpp index 29841bf480..fe8ac7f5e0 100644 --- a/pcbnew/legacy_plugin.cpp +++ b/pcbnew/legacy_plugin.cpp @@ -93,6 +93,8 @@ #define UNKNOWN_PAD_FORMAT _( "unknown pad type: %d") #define UNKNOWN_PAD_ATTRIBUTE _( "unknown pad attribute: %d" ) +// Old internal units definition (UI = decimil) +#define PCB_LEGACY_INTERNAL_UNIT 10000 /// Get the length of a string constant, at compile time #define SZ( x ) (sizeof(x)-1) @@ -2845,7 +2847,7 @@ void LEGACY_PLUGIN::saveSETUP( const BOARD* aBoard ) const /* Internal units are nobody's business, they are internal. Units used in the file are now in the "Units" attribute of $GENERAL. - fprintf( m_fp,, "InternalUnit %f INCH\n", 1.0 / PCB_INTERNAL_UNIT ); + fprintf( m_fp,, "InternalUnit %f INCH\n", 1.0 / PCB_LEGACY_INTERNAL_UNIT ); */ fprintf( m_fp, "Layers %d\n", aBoard->GetCopperLayerCount() ); diff --git a/pcbnew/pcbnew.h b/pcbnew/pcbnew.h index 2e8eb04d4a..cf39455997 100644 --- a/pcbnew/pcbnew.h +++ b/pcbnew/pcbnew.h @@ -6,7 +6,7 @@ #define PCBNEW_H -#include // PCB_INTERNAL_UNIT and EESCHEMA_INTERNAL_UNIT definitions. +#include // wxWidgets include. #include // IS_DRAGGED and IN_EDIT definitions. #include // to define DMils2iu() conversion function