Code cleanup: Remove outdated decimils to/from iu defines and conversion functions (decimils are no more in use since a long time).

Remove convert_from_iu.h file, only used for one define, and containing brokenand duplicate defines. Only convert_to_biu.h is now used.
This commit is contained in:
jean-pierre charras 2016-06-05 13:49:25 +02:00
parent 2b459acfe9
commit 6d1e904334
33 changed files with 133 additions and 247 deletions

View File

@ -109,59 +109,6 @@ void WX_UNIT_TEXT::SetValue( double aValue )
}
/*boost::optional<double> WX_UNIT_TEXT::GetValue( EDA_UNITS_T aUnit ) const
{
if( aUnit == m_units )
return GetValue(); // no conversion needed
switch( m_units )
{
case MILLIMETRES:
switch( aUnit )
{
case INCHES:
iu = Mils2iu( GetValue() * 1000.0 );
break;
case UNSCALED_UNITS:
iu = GetValue();
break;
}
break;
case INCHES:
switch( aUnit )
{
case MILLIMETRES:
return Mils2mm( GetValue() * 1000.0 );
break;
case UNSCALED_UNITS:
return Mils2iu( GetValue() * 1000.0 );
break;
}
break;
case UNSCALED_UNITS:
switch( aUnit )
{
case MILLIMETRES:
return Iu2Mils( GetValue() ) / 1000.0;
break;
// case INCHES:
// return
// break;
}
break;
}
assert( false ); // seems that there are some conversions missing
return 0.0;
}*/
boost::optional<double> WX_UNIT_TEXT::GetValue() const
{
wxString text = m_inputValue->GetValue();

View File

@ -156,7 +156,9 @@ void LIB_EDIT_FRAME::SVG_PlotComponent( const wxString& aFullFileName )
wxPoint plot_offset;
const double scale = 1.0;
plotter->SetViewport( plot_offset, IU_PER_DECIMILS, scale, false );
// Currently, plot units are in decimil
plotter->SetViewport( plot_offset, IU_PER_MILS/10, scale, false );
// Init :
plotter->SetCreator( wxT( "Eeschema-SVG" ) );

View File

@ -115,7 +115,8 @@ bool DIALOG_PLOT_SCHEMATIC::PlotOneSheetDXF( const wxString& aFileName,
const PAGE_INFO& pageInfo = aScreen->GetPageSettings();
plotter->SetPageSettings( pageInfo );
plotter->SetColorMode( getModeColor() );
plotter->SetViewport( aPlotOffset, IU_PER_DECIMILS, aScale, false );
// Currently, plot units are in decimil
plotter->SetViewport( aPlotOffset, IU_PER_MILS/10, aScale, false );
// Init :
plotter->SetCreator( wxT( "Eeschema-DXF" ) );

View File

@ -208,7 +208,8 @@ bool DIALOG_PLOT_SCHEMATIC::Plot_1_Page_HPGL( const wxString& aFileName,
HPGL_PLOTTER* plotter = new HPGL_PLOTTER();
plotter->SetPageSettings( aPageInfo );
plotter->SetViewport( aPlot0ffset, IU_PER_DECIMILS, aScale, false );
// Currently, plot units are in decimil
plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );
// Init :
plotter->SetCreator( wxT( "Eeschema-HPGL" ) );

View File

@ -188,6 +188,7 @@ void DIALOG_PLOT_SCHEMATIC::setupPlotPagePDF( PLOTTER * aPlotter, SCH_SCREEN* aS
double scaley = (double) plotPage.GetHeightMils() / actualPage.GetHeightMils();
double scale = std::min( scalex, scaley );
aPlotter->SetPageSettings( plotPage );
aPlotter->SetViewport( wxPoint( 0, 0 ), IU_PER_DECIMILS, scale, false );
// Currently, plot units are in decimil
aPlotter->SetViewport( wxPoint( 0, 0 ), IU_PER_MILS/10, scale, false );
}

View File

@ -140,7 +140,8 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetPS( const wxString& aFileName,
plotter->SetPageSettings( aPageInfo );
plotter->SetDefaultLineWidth( GetDefaultLineThickness() );
plotter->SetColorMode( getModeColor() );
plotter->SetViewport( aPlot0ffset, IU_PER_DECIMILS, aScale, false );
// Currently, plot units are in decimil
plotter->SetViewport( aPlot0ffset, IU_PER_MILS/10, aScale, false );
// Init :
plotter->SetCreator( wxT( "Eeschema-PS" ) );

View File

@ -114,7 +114,8 @@ bool DIALOG_PLOT_SCHEMATIC::plotOneSheetSVG( EDA_DRAW_FRAME* aFrame,
plotter->SetColorMode( aPlotBlackAndWhite ? false : true );
wxPoint plot_offset;
double scale = 1.0;
plotter->SetViewport( plot_offset, IU_PER_DECIMILS, scale, false );
// Currently, plot units are in decimil
plotter->SetViewport( plot_offset, IU_PER_MILS/10, scale, false );
// Init :
plotter->SetCreator( wxT( "Eeschema-SVG" ) );

View File

@ -33,8 +33,8 @@
#include <gerbview_id.h>
#define DMIL_GRID( x ) wxRealPoint( x * IU_PER_DECIMILS,\
x * IU_PER_DECIMILS )
#define MIL_GRID( x ) wxRealPoint( x * IU_PER_MILS,\
x * IU_PER_MILS)
#define MM_GRID( x ) wxRealPoint( x * IU_PER_MM,\
x * IU_PER_MM )
@ -45,46 +45,46 @@
*/
static const double gbrZoomList[] =
{
ZOOM_FACTOR( 0.5 ),
ZOOM_FACTOR( 0.75 ),
ZOOM_FACTOR( 0.05 ),
ZOOM_FACTOR( 0.075 ),
ZOOM_FACTOR( 0.1 ),
ZOOM_FACTOR( 0.15 ),
ZOOM_FACTOR( 0.2 ),
ZOOM_FACTOR( 0.3 ),
ZOOM_FACTOR( 0.45 ),
ZOOM_FACTOR( 0.7 ),
ZOOM_FACTOR( 1.0 ),
ZOOM_FACTOR( 1.5 ),
ZOOM_FACTOR( 2.0 ),
ZOOM_FACTOR( 3.0 ),
ZOOM_FACTOR( 4.5 ),
ZOOM_FACTOR( 7.0 ),
ZOOM_FACTOR( 10.0 ),
ZOOM_FACTOR( 2.2 ),
ZOOM_FACTOR( 3.5 ),
ZOOM_FACTOR( 5.0 ),
ZOOM_FACTOR( 8.0 ),
ZOOM_FACTOR( 11.0 ),
ZOOM_FACTOR( 15.0 ),
ZOOM_FACTOR( 22.0 ),
ZOOM_FACTOR( 20.0 ),
ZOOM_FACTOR( 35.0 ),
ZOOM_FACTOR( 50.0 ),
ZOOM_FACTOR( 80.0 ),
ZOOM_FACTOR( 110.0 ),
ZOOM_FACTOR( 150.0 ),
ZOOM_FACTOR( 200.0 ),
ZOOM_FACTOR( 350.0 ),
ZOOM_FACTOR( 500.0 ),
ZOOM_FACTOR( 1000.0 ),
ZOOM_FACTOR( 2000.0 )
ZOOM_FACTOR( 100.0 ),
ZOOM_FACTOR( 200.0 )
};
// Default grid sizes for PCB editor screens.
static GRID_TYPE gbrGridList[] =
{
// predefined grid list in 0.0001 inches
{ ID_POPUP_GRID_LEVEL_1000, DMIL_GRID( 1000 ) },
{ ID_POPUP_GRID_LEVEL_500, DMIL_GRID( 500 ) },
{ ID_POPUP_GRID_LEVEL_250, DMIL_GRID( 250 ) },
{ ID_POPUP_GRID_LEVEL_200, DMIL_GRID( 200 ) },
{ ID_POPUP_GRID_LEVEL_100, DMIL_GRID( 100 ) },
{ ID_POPUP_GRID_LEVEL_50, DMIL_GRID( 50 ) },
{ ID_POPUP_GRID_LEVEL_25, DMIL_GRID( 25 ) },
{ ID_POPUP_GRID_LEVEL_20, DMIL_GRID( 20 ) },
{ ID_POPUP_GRID_LEVEL_10, DMIL_GRID( 10 ) },
{ ID_POPUP_GRID_LEVEL_5, DMIL_GRID( 5 ) },
{ ID_POPUP_GRID_LEVEL_2, DMIL_GRID( 2 ) },
{ ID_POPUP_GRID_LEVEL_1, DMIL_GRID( 1 ) },
// predefined grid list in mils
{ ID_POPUP_GRID_LEVEL_1000, MIL_GRID( 100 ) },
{ ID_POPUP_GRID_LEVEL_500, MIL_GRID( 50 ) },
{ ID_POPUP_GRID_LEVEL_250, MIL_GRID( 25 ) },
{ ID_POPUP_GRID_LEVEL_200, MIL_GRID( 20 ) },
{ ID_POPUP_GRID_LEVEL_100, MIL_GRID( 10 ) },
{ ID_POPUP_GRID_LEVEL_50, MIL_GRID( 5 ) },
{ ID_POPUP_GRID_LEVEL_25, MIL_GRID( 2.5 ) },
{ ID_POPUP_GRID_LEVEL_20, MIL_GRID( 2 ) },
{ ID_POPUP_GRID_LEVEL_10, MIL_GRID( 1 ) },
{ ID_POPUP_GRID_LEVEL_5, MIL_GRID( 0.5 ) },
{ ID_POPUP_GRID_LEVEL_2, MIL_GRID( 0.2 ) },
{ ID_POPUP_GRID_LEVEL_1, MIL_GRID( 0.1 ) },
// predefined grid list in mm
{ ID_POPUP_GRID_LEVEL_5MM, MM_GRID( 5.0 ) },
@ -109,8 +109,8 @@ GBR_SCREEN::GBR_SCREEN( const wxSize& aPageSizeIU ) :
for( unsigned i = 0; i < DIM( gbrGridList ); ++i )
AddGrid( gbrGridList[i] );
// Set the working grid size to a reasonable value (in 1/10000 inch)
SetGrid( DMIL_GRID( 500 ) );
// Set the working grid size to a reasonable value
SetGrid( MIL_GRID( 50 ) );
SetZoom( ZOOM_FACTOR( 350 ) ); // a default value for zoom
m_Active_Layer = 0; // default active layer = first graphic layer

View File

@ -34,7 +34,7 @@
#include <class_base_screen.h>
#include <layers_id_colors_and_visibility.h>
#define ZOOM_FACTOR( x ) ( x * IU_PER_DECIMILS )
#define ZOOM_FACTOR( x ) ( x * IU_PER_MILS )
/* Handle info to display a board */
class GBR_SCREEN : public BASE_SCREEN

View File

@ -1,69 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 CERN
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file convert_from_iu.h
* @brief Definitions and functions to convert from internal units to user units
* depending upon the application and/or build options.
*/
#ifndef _CONVERT_FROM_IU_
#define _CONVERT_FROM_IU_
/// Convert from internal units to user units.
#if defined(PCBNEW) || defined(CVPCB) || defined(GERBVIEW)
#if defined(GERBVIEW)
#define MM_PER_IU 1.0 / 1e5 // Gerbview uses 10 micrometer.
#else
#define MM_PER_IU 1.0 / 1e6 // Pcbnew in nanometers.
#endif
#define MILS_PER_IU ( MM_PER_IU * 0.0254 )
#define DECIMILS_PER_IU (MM_PER_IU * 0.00254 )
/// Convert PCBNEW internal units (iu) to mils.
inline int Iu2Mils( int iu )
{
double x = iu * MILS_PER_IU;
return int( x < 0 ? x - 0.5 : x + 0.5 );
}
/// Convert PCBNEW internal units (iu) to deci-mils.
inline int Iu2DMils( int iu )
{
double x = iu * DECIMILS_PER_IU;
return int( x < 0 ? x - 0.5 : x + 0.5 );
}
#else // Eeschema and anything else.
#define MILS_PER_IU 1.0
#define MM_PER_IU (MILS_PER_IU / 0.0254)
inline int Iu2Mils( int iu )
{
return iu;
}
#endif
#endif // #define _CONVERT_FROM_IU_

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012-2014 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see CHANGELOG.TXT for contributors.
* Copyright (C) 2012-2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2016 KiCad Developers, see CHANGELOG.TXT for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
@ -46,7 +46,6 @@
#define IU_PER_MM 1e6 // Pcbnew IU is 1 nanometer.
#endif
#define IU_PER_MILS (IU_PER_MM * 0.0254)
#define IU_PER_DECIMILS (IU_PER_MM * 0.00254)
/// Convert mils to PCBNEW internal units (iu).
inline int Mils2iu( int mils )
@ -55,17 +54,9 @@ inline int Mils2iu( int mils )
return int( x < 0 ? x - 0.5 : x + 0.5 );
}
/// Convert deci-mils to PCBNEW internal units (iu).
inline int DMils2iu( int dmils )
{
double x = dmils * IU_PER_DECIMILS;
return int( x < 0 ? x - 0.5 : x + 0.5 );
}
#elif defined (PL_EDITOR)
#define IU_PER_MM 1e3 // internal units in micron (should be enough)
#define IU_PER_MILS (IU_PER_MM * 0.0254)
#define IU_PER_DECIMILS (IU_PER_MM * 0.00254)
/// Convert mils to page layout editor internal units (iu).
inline int Mils2iu( int mils )
{
@ -73,15 +64,7 @@ inline int Mils2iu( int mils )
return int( x < 0 ? x - 0.5 : x + 0.5 );
}
/// Convert deci-mils to page layout editor internal units (iu).
inline int DMils2iu( int dmils )
{
double x = dmils * IU_PER_DECIMILS;
return int( x < 0 ? x - 0.5 : x + 0.5 );
}
#else // Eeschema and anything else.
#define IU_PER_DECIMILS 0.1
#elif defined (EESCHEMA) // Eeschema
#define IU_PER_MILS 1.0
#define IU_PER_MM (IU_PER_MILS / 0.0254)
@ -89,13 +72,33 @@ inline int Mils2iu( int mils )
{
return mils;
}
#else
// Here, we do not know the value of internal units: do not define
// conversion functions (They do not have meaning
#define UNKNOWN_IU
#endif
#ifndef UNKNOWN_IU
// Other definitions used in a few files
#define MM_PER_IU (1/IU_PER_MM)
/// Convert mm to internal units (iu).
inline int Millimeter2iu( double mm )
{
return (int) ( mm < 0 ? mm * IU_PER_MM - 0.5 : mm * IU_PER_MM + 0.5);
}
/// Convert mm to internal units (iu).
inline double Iu2Millimeter( int iu )
{
return iu / IU_PER_MM;
}
/// Convert mm to internal units (iu).
inline double Iu2Mils( int iu )
{
return iu / IU_PER_MILS;
}
#endif
#endif // CONVERT_TO_BIU_H_

View File

@ -107,7 +107,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
m_auxiliaryToolBar = NULL;
m_zoomLevelCoeff = 110.0 * IU_PER_DECIMILS; // Adjusted to roughly displays zoom level = 1
m_zoomLevelCoeff = 11.0 * IU_PER_MILS; // Adjusted to roughly displays zoom level = 1
// when the screen shows a 1:1 image
// obviously depends on the monitor,
// but this is an acceptable value

View File

@ -34,7 +34,7 @@
#include <class_board_design_settings.h>
#include <class_track.h>
#include <convert_from_iu.h>
#include <convert_to_biu.h>
BOARD_DESIGN_SETTINGS::BOARD_DESIGN_SETTINGS() :

View File

@ -231,7 +231,7 @@ void DIMENSION::UpdateHeight()
void DIMENSION::AdjustDimensionDetails( bool aDoNotChangeText )
{
const int arrowz = DMils2iu( 500 ); // size of arrows
const int arrowz = Mils2iu( 50 ); // size of arrows
int ii;
int measure, deltax, deltay; // value of the measure on X and Y axes
int arrow_up_X = 0, arrow_up_Y = 0; // coordinates of arrow line /

View File

@ -41,7 +41,7 @@
/// Adjust the actual size of markers, when using default shape
#define SCALING_FACTOR DMils2iu( 30 )
#define SCALING_FACTOR Mils2iu( 3 )
MARKER_PCB::MARKER_PCB( BOARD_ITEM* aParent ) :

View File

@ -41,7 +41,7 @@
#include <class_board.h>
#include <class_module.h>
#include <polygon_test_point_inside.h>
#include <convert_from_iu.h>
#include <convert_to_biu.h>
#include <boost/foreach.hpp>
#include <convert_basic_shapes_to_polygon.h>
@ -53,9 +53,9 @@ D_PAD::D_PAD( MODULE* parent ) :
BOARD_CONNECTED_ITEM( parent, PCB_PAD_T )
{
m_NumPadName = 0;
m_Size.x = m_Size.y = DMils2iu( 600 ); // Default pad size 60 mils.
m_Drill.x = m_Drill.y = DMils2iu( 300 ); // Default drill size 30 mils.
m_Orient = 0; // Pad rotation in 1/10 degrees.
m_Size.x = m_Size.y = Mils2iu( 60 ); // Default pad size 60 mils.
m_Drill.x = m_Drill.y = Mils2iu( 30 ); // Default drill size 30 mils.
m_Orient = 0; // Pad rotation in 1/10 degrees.
m_LengthPadToDie = 0;
if( m_Parent && m_Parent->Type() == PCB_MODULE_T )

View File

@ -45,9 +45,9 @@
#include <pcbnew_id.h>
#define ZOOM_FACTOR( x ) ( x * IU_PER_DECIMILS )
#define DMIL_GRID( x ) wxRealPoint( x * IU_PER_DECIMILS,\
x * IU_PER_DECIMILS )
#define ZOOM_FACTOR( x ) ( x * IU_PER_MILS / 10 )
#define DMIL_GRID( x ) wxRealPoint( x * IU_PER_MILS / 10,\
x * IU_PER_MILS / 10 )
#define MM_GRID( x ) wxRealPoint( x * IU_PER_MM,\
x * IU_PER_MM )

View File

@ -34,7 +34,7 @@
#include <wxBasePcbFrame.h>
#include <class_pcb_screen.h>
#include <base_units.h>
#include <convert_from_iu.h>
#include <convert_to_biu.h>
#include <wildcards_and_files_ext.h>
#include <macros.h>
#include <reporter.h>

View File

@ -29,7 +29,7 @@
#include <kiface_i.h>
#include <pcbnew.h>
#include <class_board.h>
#include <convert_from_iu.h>
#include <convert_to_biu.h>
// IDF export header generated by wxFormBuilder
#include <dialog_export_idf_base.h>

View File

@ -104,7 +104,7 @@ static int compute_pad_access_code( BOARD *aPcb, LSET aLayerMask )
/* Convert and clamp a size from IU to decimils */
static int iu_to_d356(int iu, int clamp)
{
int val = KiROUND( iu / IU_PER_DECIMILS );
int val = KiROUND( iu / ( IU_PER_MILS / 10 ) );
if( val > clamp ) return clamp;
if( val < -clamp ) return -clamp;
return val;

View File

@ -220,9 +220,8 @@ static std::string fmt_mask( LSET aSet )
// These are the export origin (the auxiliary axis)
static int GencadOffsetX, GencadOffsetY;
/* GerbTool chokes on units different than INCH so this is the conversion
* factor */
const static double SCALE_FACTOR = 10000.0 * IU_PER_DECIMILS;
// GerbTool chokes on units different than INCH so this is the conversion factor
const static double SCALE_FACTOR = 1000.0 * IU_PER_MILS;
/* Two helper functions to calculate coordinates of modules in gencad values
@ -782,7 +781,7 @@ static void CreateSignalsSection( FILE* aFile, BOARD* aPcb )
if( net->GetNetname() == wxEmptyString ) // dummy netlist (no connection)
{
wxString msg; msg << wxT( "NoConnection" ) << NbNoConn++;
msg.Printf( "NoConnection%d", NbNoConn++ );
}
if( net->GetNet() <= 0 ) // dummy netlist (no connection)
@ -1243,8 +1242,12 @@ static void FootprintWriteShape( FILE* aFile, MODULE* module )
break;
}
case S_POLYGON:
// Not exported (TODO)
break;
default:
DisplayError( NULL, wxT( "Type Edge Module invalid." ) );
DisplayError( NULL, wxString::Format( "Type Edge Module %d invalid.", PtStruct->Type() ) );
break;
}
}

View File

@ -36,7 +36,6 @@
#include <idf_parser.h>
#include <3d_struct.h>
#include <build_version.h>
#include <convert_from_iu.h>
#ifndef PCBNEW
#define PCBNEW // needed to define the right value of Millimeter2iu(x)

View File

@ -45,7 +45,7 @@
#include <class_zone.h>
#include <class_edge_mod.h>
#include <class_pcb_text.h>
#include <convert_from_iu.h>
#include <convert_to_biu.h>
#include "../3d-viewer/modelparsers.h"

View File

@ -79,7 +79,7 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName,
case PLOT_FORMAT_GERBER:
offset = GetOffset();
plotter = new GERBER_PLOTTER();
plotter->SetViewport( offset, IU_PER_DECIMILS, scale, false );
plotter->SetViewport( offset, IU_PER_MILS/10, scale, false );
plotter->SetGerberCoordinatesFormat( 5 ); // format x.5 unit = mm
break;
@ -90,7 +90,7 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName,
hpgl_plotter->SetPenNumber( plot_opts.GetHPGLPenNum() );
hpgl_plotter->SetPenSpeed( plot_opts.GetHPGLPenSpeed() );
plotter->SetPageSettings( page_info );
plotter->SetViewport( offset, IU_PER_DECIMILS, scale, false );
plotter->SetViewport( offset, IU_PER_MILS/10, scale, false );
}
break;
@ -133,7 +133,7 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName,
plotter = new PS_PLOTTER;
plotter->SetPageSettings( pageA4 );
plotter->SetViewport( offset, IU_PER_DECIMILS, scale, false );
plotter->SetViewport( offset, IU_PER_MILS/10, scale, false );
}
break;
@ -142,7 +142,7 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName,
DXF_PLOTTER* dxf_plotter = new DXF_PLOTTER;
plotter = dxf_plotter;
plotter->SetPageSettings( page_info );
plotter->SetViewport( offset, IU_PER_DECIMILS, scale, false );
plotter->SetViewport( offset, IU_PER_MILS/10, scale, false );
}
break;
@ -151,7 +151,7 @@ bool EXCELLON_WRITER::GenDrillMapFile( const wxString& aFullFileName,
SVG_PLOTTER* svg_plotter = new SVG_PLOTTER;
plotter = svg_plotter;
plotter->SetPageSettings( page_info );
plotter->SetViewport( offset, IU_PER_DECIMILS, scale, false );
plotter->SetViewport( offset, IU_PER_MILS/10, scale, false );
}
break;
}

View File

@ -29,7 +29,7 @@
#include <dialog_dxf_import.h>
#include <kiface_i.h>
#include <convert_from_iu.h>
#include <convert_to_biu.h>
#include <class_pcb_layer_box_selector.h>
#include <class_board.h>

View File

@ -45,7 +45,6 @@
#include <class_board.h>
#include <class_drawsegment.h>
#include <class_pcb_text.h>
#include <convert_from_iu.h>
#include <drw_base.h>
// minimum bulge value before resorting to a line segment;

View File

@ -88,7 +88,7 @@ class FP_CACHE_ITEM
{
wxFileName m_file_name; ///< The the full file name and path of the footprint to cache.
wxDateTime m_mod_time; ///< The last file modified time stamp.
std::auto_ptr<MODULE> m_module;
std::unique_ptr<MODULE> m_module;
public:
FP_CACHE_ITEM( MODULE* aModule, const wxFileName& aFileName );

View File

@ -238,7 +238,7 @@ static inline char* ReadLine( LINE_READER* rdr, const char* caller )
using namespace std; // auto_ptr
using namespace std; // unique_ptr
static EDA_TEXT_HJUSTIFY_T horizJustify( const char* horizontal )
@ -401,7 +401,7 @@ BOARD* LEGACY_PLUGIN::Load( const wxString& aFileName, BOARD* aAppendToMe,
m_board->SetFileName( aFileName );
// delete on exception, iff I own m_board, according to aAppendToMe
auto_ptr<BOARD> deleter( aAppendToMe ? NULL : m_board );
unique_ptr<BOARD> deleter( aAppendToMe ? NULL : m_board );
FILE_LINE_READER reader( aFileName );
@ -433,7 +433,7 @@ void LEGACY_PLUGIN::loadAllSections( bool doAppend )
if( TESTLINE( "$MODULE" ) )
{
auto_ptr<MODULE> module( new MODULE( m_board ) );
unique_ptr<MODULE> module( new MODULE( m_board ) );
FPID fpid;
std::string fpName = StrPurge( line + SZ( "$MODULE" ) );
@ -1386,7 +1386,7 @@ void LEGACY_PLUGIN::loadMODULE( MODULE* aModule )
void LEGACY_PLUGIN::loadPAD( MODULE* aModule )
{
auto_ptr<D_PAD> pad( new D_PAD( aModule ) );
unique_ptr<D_PAD> pad( new D_PAD( aModule ) );
char* line;
char* saveptr;
@ -1644,7 +1644,7 @@ void LEGACY_PLUGIN::loadMODULE_EDGE( MODULE* aModule )
THROW_IO_ERROR( m_error );
}
auto_ptr<EDGE_MODULE> dwg( new EDGE_MODULE( aModule, shape ) ); // a drawing
unique_ptr<EDGE_MODULE> dwg( new EDGE_MODULE( aModule, shape ) ); // a drawing
const char* data;
@ -1942,7 +1942,7 @@ void LEGACY_PLUGIN::loadPCB_LINE()
$EndDRAWSEGMENT
*/
auto_ptr<DRAWSEGMENT> dseg( new DRAWSEGMENT( m_board ) );
unique_ptr<DRAWSEGMENT> dseg( new DRAWSEGMENT( m_board ) );
char* line;
char* saveptr;
@ -2406,7 +2406,7 @@ void LEGACY_PLUGIN::loadNETCLASS()
// create an empty NETCLASS without a name, but do not add it to the BOARD
// yet since that would bypass duplicate netclass name checking within the BOARD.
// store it temporarily in an auto_ptr until successfully inserted into the BOARD
// store it temporarily in an unique_ptr until successfully inserted into the BOARD
// just before returning.
NETCLASSPTR nc = boost::make_shared<NETCLASS>( wxEmptyString );
@ -2475,7 +2475,7 @@ void LEGACY_PLUGIN::loadNETCLASS()
// Must have been a name conflict, this is a bad board file.
// User may have done a hand edit to the file.
// auto_ptr will delete nc on this code path
// unique_ptr will delete nc on this code path
m_error.Printf( _( "duplicate NETCLASS name '%s'" ), nc->GetName().GetData() );
THROW_IO_ERROR( m_error );
@ -2491,7 +2491,7 @@ void LEGACY_PLUGIN::loadNETCLASS()
void LEGACY_PLUGIN::loadZONE_CONTAINER()
{
auto_ptr<ZONE_CONTAINER> zc( new ZONE_CONTAINER( m_board ) );
unique_ptr<ZONE_CONTAINER> zc( new ZONE_CONTAINER( m_board ) );
CPolyLine::HATCH_STYLE outline_hatch = CPolyLine::NO_HATCH;
bool sawCorner = false;
@ -2760,7 +2760,7 @@ void LEGACY_PLUGIN::loadZONE_CONTAINER()
void LEGACY_PLUGIN::loadDIMENSION()
{
auto_ptr<DIMENSION> dim( new DIMENSION( m_board ) );
unique_ptr<DIMENSION> dim( new DIMENSION( m_board ) );
char* line;
char* saveptr;
@ -3079,7 +3079,7 @@ void LEGACY_PLUGIN::init( const PROPERTIES* aProperties )
// mm to nanometers. The deci-mil legacy files have no such "Units" marker
// so we must assume the file is in deci-mils until told otherwise.
diskToBiu = IU_PER_DECIMILS; // BIUs are nanometers
diskToBiu = IU_PER_MILS / 10; // BIUs are nanometers
}
@ -3310,7 +3310,7 @@ void LP_CACHE::LoadModules( LINE_READER* aReader )
// test first for the $MODULE, even before reading because of INDEX bug.
if( TESTLINE( "$MODULE" ) )
{
auto_ptr<MODULE> module( new MODULE( m_owner->m_board ) );
unique_ptr<MODULE> module( new MODULE( m_owner->m_board ) );
std::string footprintName = StrPurge( line + SZ( "$MODULE" ) );

View File

@ -31,7 +31,6 @@
#include <common.h>
#include <confirm.h>
#include <macros.h>
#include <convert_from_iu.h>
#include <trigo.h>
#include <3d_struct.h>
#include <class_title_block.h>
@ -346,7 +345,7 @@ S3D_MASTER* PCB_PARSER::parse3DModel() throw( PARSE_ERROR, IO_ERROR )
T token;
std::auto_ptr< S3D_MASTER > n3D( new S3D_MASTER( NULL ) );
std::unique_ptr< S3D_MASTER > n3D( new S3D_MASTER( NULL ) );
NeedSYMBOLorNUMBER();
n3D->SetShape3DName( FromUTF8() );
@ -419,7 +418,7 @@ BOARD_ITEM* PCB_PARSER::Parse() throw( IO_ERROR, PARSE_ERROR )
// MODULEs can be prefixed with an initial block of single line comments and these
// are kept for Format() so they round trip in s-expression form. BOARDs might
// eventually do the same, but currently do not.
std::auto_ptr<wxArrayString> initial_comments( ReadCommentLines() );
std::unique_ptr<wxArrayString> initial_comments( ReadCommentLines() );
token = CurTok();
@ -1323,7 +1322,7 @@ void PCB_PARSER::parseNETCLASS() throw( IO_ERROR, PARSE_ERROR )
// Must have been a name conflict, this is a bad board file.
// User may have done a hand edit to the file.
// auto_ptr will delete nc on this code path
// unique_ptr will delete nc on this code path
wxString error;
error.Printf( _( "duplicate NETCLASS name '%s' in file <%s> at line %d, offset %d" ),
@ -1341,7 +1340,7 @@ DRAWSEGMENT* PCB_PARSER::parseDRAWSEGMENT() throw( IO_ERROR, PARSE_ERROR )
T token;
wxPoint pt;
std::auto_ptr< DRAWSEGMENT > segment( new DRAWSEGMENT( NULL ) );
std::unique_ptr< DRAWSEGMENT > segment( new DRAWSEGMENT( NULL ) );
switch( CurTok() )
{
@ -1502,7 +1501,7 @@ TEXTE_PCB* PCB_PARSER::parseTEXTE_PCB() throw( IO_ERROR, PARSE_ERROR )
T token;
std::auto_ptr<TEXTE_PCB> text( new TEXTE_PCB( m_board ) );
std::unique_ptr<TEXTE_PCB> text( new TEXTE_PCB( m_board ) );
NeedSYMBOLorNUMBER();
text->SetText( FromUTF8() );
@ -1570,7 +1569,7 @@ DIMENSION* PCB_PARSER::parseDIMENSION() throw( IO_ERROR, PARSE_ERROR )
T token;
std::auto_ptr<DIMENSION> dimension( new DIMENSION( NULL ) );
std::unique_ptr<DIMENSION> dimension( new DIMENSION( NULL ) );
dimension->SetValue( parseBoardUnits( "dimension value" ) );
NeedLEFT();
@ -1743,7 +1742,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
T token;
FPID fpid;
std::auto_ptr<MODULE> module( new MODULE( m_board ) );
std::unique_ptr<MODULE> module( new MODULE( m_board ) );
module->SetInitialComments( aInitialComments );
@ -1956,7 +1955,7 @@ MODULE* PCB_PARSER::parseMODULE_unchecked( wxArrayString* aInitialComments )
case T_pad:
{
D_PAD* pad = parseD_PAD( module.get() );
wxPoint pt = pad->GetPos0();
pt = pad->GetPos0();
RotatePoint( &pt, module->GetOrientation() );
pad->SetPosition( pt + module->GetPosition() );
@ -1993,7 +1992,7 @@ TEXTE_MODULE* PCB_PARSER::parseTEXTE_MODULE() throw( IO_ERROR, PARSE_ERROR )
T token = NextTok();
std::auto_ptr<TEXTE_MODULE> text( new TEXTE_MODULE( NULL ) );
std::unique_ptr<TEXTE_MODULE> text( new TEXTE_MODULE( NULL ) );
switch( token )
{
@ -2078,7 +2077,7 @@ EDGE_MODULE* PCB_PARSER::parseEDGE_MODULE() throw( IO_ERROR, PARSE_ERROR )
wxPoint pt;
T token;
std::auto_ptr< EDGE_MODULE > segment( new EDGE_MODULE( NULL ) );
std::unique_ptr< EDGE_MODULE > segment( new EDGE_MODULE( NULL ) );
switch( CurTok() )
{
@ -2244,7 +2243,7 @@ D_PAD* PCB_PARSER::parseD_PAD( MODULE* aParent ) throw( IO_ERROR, PARSE_ERROR )
wxSize sz;
wxPoint pt;
std::auto_ptr< D_PAD > pad( new D_PAD( aParent ) );
std::unique_ptr< D_PAD > pad( new D_PAD( aParent ) );
NeedSYMBOLorNUMBER();
pad->SetPadName( FromUTF8() );
@ -2498,7 +2497,7 @@ TRACK* PCB_PARSER::parseTRACK() throw( IO_ERROR, PARSE_ERROR )
wxPoint pt;
T token;
std::auto_ptr< TRACK > track( new TRACK( m_board ) );
std::unique_ptr< TRACK > track( new TRACK( m_board ) );
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
{
@ -2564,7 +2563,7 @@ VIA* PCB_PARSER::parseVIA() throw( IO_ERROR, PARSE_ERROR )
wxPoint pt;
T token;
std::auto_ptr< VIA > via( new VIA( m_board ) );
std::unique_ptr< VIA > via( new VIA( m_board ) );
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
{
@ -2656,7 +2655,7 @@ ZONE_CONTAINER* PCB_PARSER::parseZONE_CONTAINER() throw( IO_ERROR, PARSE_ERROR )
// bigger scope since each filled_polygon is concatenated in here
SHAPE_POLY_SET pts;
std::auto_ptr< ZONE_CONTAINER > zone( new ZONE_CONTAINER( m_board ) );
std::unique_ptr< ZONE_CONTAINER > zone( new ZONE_CONTAINER( m_board ) );
zone->SetPriority( 0 );
@ -3014,7 +3013,7 @@ PCB_TARGET* PCB_PARSER::parsePCB_TARGET() throw( IO_ERROR, PARSE_ERROR )
wxPoint pt;
T token;
std::auto_ptr< PCB_TARGET > target( new PCB_TARGET( NULL ) );
std::unique_ptr< PCB_TARGET > target( new PCB_TARGET( NULL ) );
for( token = NextTok(); token != T_RIGHT; token = NextTok() )
{

View File

@ -53,7 +53,7 @@
#include <module_editor_frame.h>
#include <dialog_helpers.h>
#include <dialog_plot.h>
#include <convert_from_iu.h>
#include <convert_to_biu.h>
#include <view/view.h>
#include <view/view_controls.h>
#include <pcb_painter.h>

View File

@ -33,7 +33,7 @@
#include <fctsys.h> // wxWidgets include.
#include <base_struct.h> // IS_DRAGGED and IN_EDIT definitions.
#include <dlist.h>
#include <convert_to_biu.h> // to define DMils2iu() conversion function
#include <convert_to_biu.h> // to define Mils2iu() conversion function
#include <layers_id_colors_and_visibility.h>
// Arcs are approximated by segments: define the number of segments per 360 deg (KiCad uses 0.1
@ -59,9 +59,9 @@ enum ENDPOINT_T {
#define DIM_ANCRE_MODULE 3 // Anchor size (footprint center)
#define TEXTS_MIN_SIZE DMils2iu( 50 ) ///< Minimum text size in Pcbnew units value (50 * 0.0001 mils)
#define TEXTS_MAX_SIZE DMils2iu( 10000 ) ///< Maximum text size in Pcbnew units value (1 inch) )
#define TEXTS_MAX_WIDTH DMils2iu( 5000 ) ///< Maximum text width in Pcbnew units value (0.5 inches)
#define TEXTS_MIN_SIZE Mils2iu( 5 ) ///< Minimum text size in Pcbnew units value (5 mils)
#define TEXTS_MAX_SIZE Mils2iu( 1000 ) ///< Maximum text size in Pcbnew units value (1 inch) )
#define TEXTS_MAX_WIDTH Mils2iu( 500 ) ///< Maximum text width in Pcbnew units value (0.5 inches)
#define MIN_DRAW_WIDTH 1 ///< Minimum trace drawing width in pixels.

View File

@ -868,7 +868,7 @@ static void initializePlotter( PLOTTER *aPlotter, BOARD * aBoard,
most of that taken from the options */
aPlotter->SetPageSettings( *sheet_info );
aPlotter->SetViewport( offset, IU_PER_DECIMILS, compound_scale,
aPlotter->SetViewport( offset, IU_PER_MILS/10, compound_scale,
aPlotOpts->GetMirror() );
// has meaning only for gerber plotter. Must be called only after SetViewport
aPlotter->SetGerberCoordinatesFormat( aPlotOpts->GetGerberPrecision() );

View File

@ -72,7 +72,6 @@
#include <class_colors_design_settings.h>
#include <class_marker_base.h>
#include <eda_text.h>
#include <convert_from_iu.h>
#include <convert_to_biu.h>
%}
@ -105,7 +104,6 @@
%include <class_colors_design_settings.h>
%include <class_marker_base.h>
%include <eda_text.h>
%include <convert_from_iu.h>
%include <convert_to_biu.h>
%include <fpid.h>