Commit bed96be7 authored by Wayne Stambaugh's avatar Wayne Stambaugh

Internal unit improvements and Pcbnew s-expression file format changes.

* Move EDA_TEXT object into separate header and source file.
* Compile EDA_TEXT class separately for BOARD_ITEM and SCH_ITEM units.
* Compile PAGE_INFO  class separately for BOARD_ITEM and SCH_ITEM units.
* Minor formatting tweaks to Pcbnew s-expression file.
* Move internal unit formatting functions into BOARD_ITEM and SCH_ITEM.
parent 38ea6008
...@@ -427,17 +427,3 @@ bool EDA_APP::OnInit() ...@@ -427,17 +427,3 @@ bool EDA_APP::OnInit()
void EDA_APP::MacOpenFile(const wxString &fileName) void EDA_APP::MacOpenFile(const wxString &fileName)
{ {
} }
/**
* @copydoc
*
* This is a dummy since KiCad doesn't perform any interal unit formatting.
*/
/** @todo Remove FormatBIU() when the common DSO/DSL code is implemented. */
std::string FormatBIU( int aValue )
{
return "";
}
...@@ -36,7 +36,6 @@ set(COMMON_SRCS ...@@ -36,7 +36,6 @@ set(COMMON_SRCS
class_bitmap_base.cpp class_bitmap_base.cpp
class_colors_design_settings.cpp class_colors_design_settings.cpp
class_marker_base.cpp class_marker_base.cpp
class_page_info.cpp
class_plotter.cpp class_plotter.cpp
class_undoredo_container.cpp class_undoredo_container.cpp
common.cpp common.cpp
...@@ -84,6 +83,8 @@ add_library(common STATIC ${COMMON_SRCS}) ...@@ -84,6 +83,8 @@ add_library(common STATIC ${COMMON_SRCS})
set(PCB_COMMON_SRCS set(PCB_COMMON_SRCS
base_screen.cpp base_screen.cpp
eda_text.cpp
class_page_info.cpp
pcbcommon.cpp pcbcommon.cpp
footprint_info.cpp footprint_info.cpp
class_layer_box_selector.cpp class_layer_box_selector.cpp
......
This diff is collapsed.
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#define PAPER_A1 wxPAPER_A2 #define PAPER_A1 wxPAPER_A2
#endif #endif
// Standard paper sizes nicknames. // Standard paper sizes nicknames.
const wxString PAGE_INFO::A4( wxT( "A4" ) ); const wxString PAGE_INFO::A4( wxT( "A4" ) );
const wxString PAGE_INFO::A3( wxT( "A3" ) ); const wxString PAGE_INFO::A3( wxT( "A3" ) );
...@@ -318,11 +319,11 @@ void PAGE_INFO::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aContro ...@@ -318,11 +319,11 @@ void PAGE_INFO::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aContro
// If page is A3 landscape, then it is assumed to be the default and is not written. // If page is A3 landscape, then it is assumed to be the default and is not written.
if( !IsDefault() ) if( !IsDefault() )
{ {
aFormatter->Print( aNestLevel, "(page %s", TO_UTF8( GetType() ) ); aFormatter->Print( aNestLevel, "(page %s", aFormatter->Quotew( GetType() ).c_str() );
// The page dimensions are only required for user defined page sizes. // The page dimensions are only required for user defined page sizes.
if( GetType() == PAGE_INFO::Custom ) if( GetType() == PAGE_INFO::Custom )
aFormatter->Print( aNestLevel, " %d %d", GetWidthMils(), GetHeightMils() ); aFormatter->Print( aNestLevel, " %d %d", GetWidthIU(), GetHeightIU() );
if( IsCustom() && IsPortrait() ) if( IsCustom() && IsPortrait() )
aFormatter->Print( aNestLevel, " portrait" ); aFormatter->Print( aNestLevel, " portrait" );
......
...@@ -560,15 +560,3 @@ wxString& operator <<( wxString& aString, const wxPoint& aPos ) ...@@ -560,15 +560,3 @@ wxString& operator <<( wxString& aString, const wxPoint& aPos )
return aString; return aString;
} }
std::string FormatBIU( const wxPoint& aPoint )
{
return FormatBIU( aPoint.x ) + " " + FormatBIU( aPoint.y );
}
std::string FormatBIU( const wxSize& aSize )
{
return FormatBIU( aSize.GetWidth() ) + " " + FormatBIU( aSize.GetHeight() );
}
...@@ -4,10 +4,9 @@ ...@@ -4,10 +4,9 @@
*/ */
#include <fctsys.h> #include <fctsys.h>
#include <gr_basic.h> #include <gr_basic.h>
#include <common.h> #include <common.h>
#include <plot_common.h> #include <plot_common.h>
#include <eda_text.h> // EDA_TEXT_HJUSTIFY_T and EDA_TEXT_VJUSTIFY_T
#include <trigo.h> #include <trigo.h>
#include <macros.h> #include <macros.h>
#include <class_drawpanel.h> #include <class_drawpanel.h>
......
This diff is collapsed.
...@@ -105,3 +105,52 @@ void SCH_ITEM::Plot( PLOTTER* aPlotter ) ...@@ -105,3 +105,52 @@ void SCH_ITEM::Plot( PLOTTER* aPlotter )
{ {
wxFAIL_MSG( wxT( "Plot() method not implemented for class " ) + GetClass() ); wxFAIL_MSG( wxT( "Plot() method not implemented for class " ) + GetClass() );
} }
std::string SCH_ITEM::FormatInternalUnits( int aValue )
{
char buf[50];
double engUnits = aValue;
int len;
if( engUnits != 0.0 && fabs( engUnits ) <= 0.0001 )
{
// printf( "f: " );
len = snprintf( buf, 49, "%.10f", engUnits );
while( --len > 0 && buf[len] == '0' )
buf[len] = '\0';
++len;
}
else
{
// printf( "g: " );
len = snprintf( buf, 49, "%.10g", engUnits );
}
return std::string( buf, len );
}
std::string SCH_ITEM::FormatAngle( double aAngle )
{
char temp[50];
int len;
len = snprintf( temp, 49, "%.10g", aAngle / 10.0 );
return std::string( temp, len );
}
std::string SCH_ITEM::FormatInternalUnits( const wxPoint& aPoint )
{
return FormatInternalUnits( aPoint.x ) + " " + FormatInternalUnits( aPoint.y );
}
std::string SCH_ITEM::FormatInternalUnits( const wxSize& aSize )
{
return FormatInternalUnits( aSize.GetWidth() ) + " " + FormatInternalUnits( aSize.GetHeight() );
}
...@@ -160,6 +160,8 @@ set(EESCHEMA_SRCS ...@@ -160,6 +160,8 @@ set(EESCHEMA_SRCS
set(EESCHEMA_COMMON_SRCS set(EESCHEMA_COMMON_SRCS
../common/dialogs/dialog_page_settings.cpp ../common/dialogs/dialog_page_settings.cpp
../common/base_screen.cpp ../common/base_screen.cpp
../common/eda_text.cpp
../common/class_page_info.cpp
) )
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
#include <eda_dde.h> #include <eda_dde.h>
#include <id.h> #include <id.h>
#include <wxEeschemaStruct.h> #include <wxEeschemaStruct.h>
#include <eda_text.h>
#include <general.h> #include <general.h>
#include <protos.h> #include <protos.h>
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#ifndef CLASS_LIBENTRY_FIELDS_H #ifndef CLASS_LIBENTRY_FIELDS_H
#define CLASS_LIBENTRY_FIELDS_H #define CLASS_LIBENTRY_FIELDS_H
#include <eda_text.h>
#include <lib_draw_item.h> #include <lib_draw_item.h>
......
...@@ -29,9 +29,9 @@ ...@@ -29,9 +29,9 @@
#ifndef _LIB_TEXT_H_ #ifndef _LIB_TEXT_H_
#define _LIB_TEXT_H_ #define _LIB_TEXT_H_
#include <eda_text.h>
#include <lib_draw_item.h> #include <lib_draw_item.h>
/** /**
* Class LIB_TEXT * Class LIB_TEXT
* defines a component library graphical text item. * defines a component library graphical text item.
......
...@@ -31,6 +31,7 @@ ...@@ -31,6 +31,7 @@
#define CLASS_SCH_FIELD_H #define CLASS_SCH_FIELD_H
#include <eda_text.h>
#include <sch_item_struct.h> #include <sch_item_struct.h>
#include <general.h> #include <general.h>
......
...@@ -1498,20 +1498,3 @@ void SCH_SCREEN::Show( int nestLevel, std::ostream& os ) const ...@@ -1498,20 +1498,3 @@ void SCH_SCREEN::Show( int nestLevel, std::ostream& os ) const
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n"; NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
} }
#endif #endif
/**
* Function FormatBIU
* formats Eeschema internal units in mils to a string for s-expression output.
*
* @todo Move FormatBIU() where ever the common DSO/DSL code for Eeschema ends up.
*/
std::string FormatBIU( int aValue )
{
char buf[50];
int len;
len = snprintf( buf, 49, "%d", aValue );
return std::string( buf, len );
}
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#include <macros.h> #include <macros.h>
#include <eda_text.h>
#include <sch_item_struct.h> #include <sch_item_struct.h>
......
This diff is collapsed.
...@@ -36,6 +36,10 @@ ...@@ -36,6 +36,10 @@
#include <boost/ptr_container/ptr_vector.hpp> #include <boost/ptr_container/ptr_vector.hpp>
/// Abbrevation for fomatting internal units to a string.
#define FMT_IU BOARD_ITEM::FormatInternalUnits
#define FMT_ANGLE BOARD_ITEM::FormatAngle
class BOARD; class BOARD;
class EDA_DRAW_PANEL; class EDA_DRAW_PANEL;
...@@ -247,6 +251,33 @@ public: ...@@ -247,6 +251,33 @@ public:
* @return wxString containing the layer name associated with this item. * @return wxString containing the layer name associated with this item.
*/ */
wxString GetLayerName() const; wxString GetLayerName() const;
/**
* Function FormatInternalUnits
* converts \a aValue from board internal units to a string appropriate for writing to file.
*
* @note Internal units for board items can be either deci-mils or nanometers depending
* on how KiCad is build.
* @param aValue A coordinate value to convert.
* @return A std::string object containing the converted value.
*/
static std::string FormatInternalUnits( int aValue );
/**
* Function FormatAngle
* converts \a aAngle from board units to a string appropriate for writing to file.
*
* @note Internal angles for board items can be either degrees or tenths of degree
* on how KiCad is built.
* @param aAngle A angle value to convert.
* @return A std::string object containing the converted angle.
*/
static std::string FormatAngle( double aAngle );
static std::string FormatInternalUnits( const wxPoint& aPoint );
static std::string FormatInternalUnits( const wxSize& aSize );
}; };
#endif /* BOARD_ITEM_STRUCT_H */ #endif /* BOARD_ITEM_STRUCT_H */
...@@ -136,24 +136,6 @@ enum EDA_UNITS_T { ...@@ -136,24 +136,6 @@ enum EDA_UNITS_T {
}; };
/**
* Function FormatBIU
* converts coordinate \a aValue from the application specific internal units to a string
* appropriate to write to an #OUTPUTFORMATTER in the s-expression file formats.
*
* @note A separate version of this function exists for Pcbnew and Eeschema. This removes
* the runtime dependency for converting coordinates to the appropriate application.
* Do not add any runtime conversions to either the Pcbnew or Eeschema implementation
* of this function.
* @param aValue The value in application specific internal units to convert.
* @return An s-expression appropriate string containing the converted value in millimeters.
*/
extern std::string FormatBIU( int aValue );
extern std::string FormatBIU( const wxPoint& aPoint );
extern std::string FormatBIU( const wxSize& aSize );
// forward declarations: // forward declarations:
class LibNameList; class LibNameList;
......
...@@ -8,6 +8,7 @@ ...@@ -8,6 +8,7 @@
#define __INCLUDE__DRAWTXT_H__ 1 #define __INCLUDE__DRAWTXT_H__ 1
#include <base_struct.h> #include <base_struct.h>
#include <eda_text.h> // EDA_TEXT_HJUSTIFY_T and EDA_TEXT_VJUSTIFY_T
class EDA_DRAW_PANEL; class EDA_DRAW_PANEL;
class PLOTTER; class PLOTTER;
......
This diff is collapsed.
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <vector> #include <vector>
#include <drawtxt.h> #include <drawtxt.h>
#include <common.h> // PAGE_INFO #include <common.h> // PAGE_INFO
#include <eda_text.h> // FILL_T
/** /**
* Enum PlotFormat * Enum PlotFormat
......
...@@ -60,6 +60,10 @@ typedef vector< SCH_ITEMS_ITR > SCH_ITEMS_ITRS; ...@@ -60,6 +60,10 @@ typedef vector< SCH_ITEMS_ITR > SCH_ITEMS_ITRS;
#endif #endif
#define FMT_IU SCH_ITEM::FormatInternalUnits
#define FMT_ANGLE SCH_ITEM::FormatAngle
/// Flag to enable find and replace tracing using the WXTRACE environment variable. /// Flag to enable find and replace tracing using the WXTRACE environment variable.
extern const wxString traceFindReplace; extern const wxString traceFindReplace;
...@@ -365,6 +369,31 @@ public: ...@@ -365,6 +369,31 @@ public:
virtual bool operator <( const SCH_ITEM& aItem ) const; virtual bool operator <( const SCH_ITEM& aItem ) const;
/**
* Function FormatInternalUnits
* converts \a aValue from schematic internal units to a string appropriate for writing
* to file.
*
* @param aValue A coordinate value to convert.
* @return A std::string object containing the converted value.
*/
static std::string FormatInternalUnits( int aValue );
/**
* Function FormatAngle
* converts \a aAngle from board units to a string appropriate for writing to file.
*
* @note Internal angles for board items can be either degrees or tenths of degree
* on how KiCad is built.
* @param aAngle A angle value to convert.
* @return A std::string object containing the converted angle.
*/
static std::string FormatAngle( double aAngle );
static std::string FormatInternalUnits( const wxPoint& aPoint );
static std::string FormatInternalUnits( const wxSize& aSize );
private: private:
/** /**
* Function doIsConnected * Function doIsConnected
......
...@@ -36,6 +36,7 @@ ...@@ -36,6 +36,7 @@
#include <wxstruct.h> #include <wxstruct.h>
#include <base_struct.h> #include <base_struct.h>
#include <eda_text.h> // EDA_DRAW_MODE_T
#include <richio.h> #include <richio.h>
#include <class_pcb_screen.h> #include <class_pcb_screen.h>
......
...@@ -299,16 +299,3 @@ void KICAD_MANAGER_FRAME::SaveSettings() ...@@ -299,16 +299,3 @@ void KICAD_MANAGER_FRAME::SaveSettings()
cfg->Write( TreeFrameWidthEntry, m_LeftWin->GetSize().x ); cfg->Write( TreeFrameWidthEntry, m_LeftWin->GetSize().x );
} }
/**
* Function FormatBIU
* is a dummy function to prevent link errors since KiCad doesn't perform any interal
* unit formatting.
*
* @todo Remove FormatBIU() when the common DSO/DSL code is implemented.
*/
std::string FormatBIU( int aValue )
{
return "";
}
...@@ -358,15 +358,3 @@ void PCB_CALCULATOR_FRAME::SetDataFilename( const wxString & aFilename) ...@@ -358,15 +358,3 @@ void PCB_CALCULATOR_FRAME::SetDataFilename( const wxString & aFilename)
m_regulators_fileNameCtrl->SetValue( fn.GetFullPath() ); m_regulators_fileNameCtrl->SetValue( fn.GetFullPath() );
} }
} }
/**
* @copydoc
*
* This is a dummy since KiCad doesn't perform any interal unit formatting.
*/
/** @todo Remove FormatBIU() when the common DSO/DSL code is implemented. */
std::string FormatBIU( int aValue )
{
return "";
}
...@@ -2151,12 +2151,12 @@ void BOARD::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBit ...@@ -2151,12 +2151,12 @@ void BOARD::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBit
// Write Bounding box info // Write Bounding box info
aFormatter->Print( aNestLevel+1, "(area %s %s %s %s)\n", aFormatter->Print( aNestLevel+1, "(area %s %s %s %s)\n",
FormatBIU( m_BoundingBox.GetX() ).c_str(), FMT_IU( m_BoundingBox.GetX() ).c_str(),
FormatBIU( m_BoundingBox.GetY() ).c_str(), FMT_IU( m_BoundingBox.GetY() ).c_str(),
FormatBIU( m_BoundingBox.GetRight() ).c_str(), FMT_IU( m_BoundingBox.GetRight() ).c_str(),
FormatBIU( m_BoundingBox.GetBottom() ).c_str() ); FMT_IU( m_BoundingBox.GetBottom() ).c_str() );
aFormatter->Print( aNestLevel+1, "(thickness %s)\n", aFormatter->Print( aNestLevel+1, "(thickness %s)\n",
FormatBIU( GetDesignSettings().m_BoardThickness ).c_str() ); FMT_IU( GetDesignSettings().m_BoardThickness ).c_str() );
aFormatter->Print( aNestLevel+1, "(drawings %d)\n", m_Drawings.GetCount() ); aFormatter->Print( aNestLevel+1, "(drawings %d)\n", m_Drawings.GetCount() );
aFormatter->Print( aNestLevel+1, "(tracks %d)\n", GetNumSegmTrack() ); aFormatter->Print( aNestLevel+1, "(tracks %d)\n", GetNumSegmTrack() );
...@@ -2195,92 +2195,92 @@ void BOARD::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBit ...@@ -2195,92 +2195,92 @@ void BOARD::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBit
// Save current default track width, for compatibility with older Pcbnew version; // Save current default track width, for compatibility with older Pcbnew version;
aFormatter->Print( aNestLevel+1, "(last_trace_width %s)\n", aFormatter->Print( aNestLevel+1, "(last_trace_width %s)\n",
FormatBIU( m_TrackWidthList[m_TrackWidthSelector] ).c_str() ); FMT_IU( m_TrackWidthList[m_TrackWidthSelector] ).c_str() );
// Save custom tracks width list (the first is not saved here: this is the netclass value // Save custom tracks width list (the first is not saved here: this is the netclass value
for( unsigned ii = 1; ii < m_TrackWidthList.size(); ii++ ) for( unsigned ii = 1; ii < m_TrackWidthList.size(); ii++ )
aFormatter->Print( aNestLevel+1, "(user_trace_width%d %s)\n", aFormatter->Print( aNestLevel+1, "(user_trace_width%d %s)\n",
ii+1, FormatBIU( m_TrackWidthList[ii] ).c_str() ); ii+1, FMT_IU( m_TrackWidthList[ii] ).c_str() );
aFormatter->Print( aNestLevel+1, "(trace_clearance %s)\n", aFormatter->Print( aNestLevel+1, "(trace_clearance %s)\n",
FormatBIU( m_NetClasses.GetDefault()->GetClearance() ).c_str() ); FMT_IU( m_NetClasses.GetDefault()->GetClearance() ).c_str() );
// ZONE_SETTINGS // ZONE_SETTINGS
aFormatter->Print( aNestLevel+1, "(zone_clearance %s)\n", aFormatter->Print( aNestLevel+1, "(zone_clearance %s)\n",
FormatBIU( GetZoneSettings().m_ZoneClearance ).c_str() ); FMT_IU( GetZoneSettings().m_ZoneClearance ).c_str() );
aFormatter->Print( aNestLevel+1, "(zone_45_only %d)\n", GetZoneSettings().m_Zone_45_Only ); aFormatter->Print( aNestLevel+1, "(zone_45_only %d)\n", GetZoneSettings().m_Zone_45_Only );
aFormatter->Print( aNestLevel+1, "(trace_min %s)\n", aFormatter->Print( aNestLevel+1, "(trace_min %s)\n",
FormatBIU( GetDesignSettings().m_TrackMinWidth ).c_str() ); FMT_IU( GetDesignSettings().m_TrackMinWidth ).c_str() );
aFormatter->Print( aNestLevel+1, "(segment_width %s)\n", aFormatter->Print( aNestLevel+1, "(segment_width %s)\n",
FormatBIU( GetDesignSettings().m_DrawSegmentWidth ).c_str() ); FMT_IU( GetDesignSettings().m_DrawSegmentWidth ).c_str() );
aFormatter->Print( aNestLevel+1, "(edge_width %s)\n", aFormatter->Print( aNestLevel+1, "(edge_width %s)\n",
FormatBIU( GetDesignSettings().m_EdgeSegmentWidth ).c_str() ); FMT_IU( GetDesignSettings().m_EdgeSegmentWidth ).c_str() );
// Save current default via size, for compatibility with older Pcbnew version; // Save current default via size, for compatibility with older Pcbnew version;
aFormatter->Print( aNestLevel+1, "(via_size %s)\n", aFormatter->Print( aNestLevel+1, "(via_size %s)\n",
FormatBIU( m_NetClasses.GetDefault()->GetViaDiameter() ).c_str() ); FMT_IU( m_NetClasses.GetDefault()->GetViaDiameter() ).c_str() );
aFormatter->Print( aNestLevel+1, "(via_drill %s)\n", aFormatter->Print( aNestLevel+1, "(via_drill %s)\n",
FormatBIU( m_NetClasses.GetDefault()->GetViaDrill() ).c_str() ); FMT_IU( m_NetClasses.GetDefault()->GetViaDrill() ).c_str() );
aFormatter->Print( aNestLevel+1, "(via_min_size %s)\n", aFormatter->Print( aNestLevel+1, "(via_min_size %s)\n",
FormatBIU( GetDesignSettings().m_ViasMinSize ).c_str() ); FMT_IU( GetDesignSettings().m_ViasMinSize ).c_str() );
aFormatter->Print( aNestLevel+1, "(via_min_drill %s)\n", aFormatter->Print( aNestLevel+1, "(via_min_drill %s)\n",
FormatBIU( GetDesignSettings().m_ViasMinDrill ).c_str() ); FMT_IU( GetDesignSettings().m_ViasMinDrill ).c_str() );
// Save custom vias diameters list (the first is not saved here: this is // Save custom vias diameters list (the first is not saved here: this is
// the netclass value // the netclass value
for( unsigned ii = 1; ii < m_ViasDimensionsList.size(); ii++ ) for( unsigned ii = 1; ii < m_ViasDimensionsList.size(); ii++ )
aFormatter->Print( aNestLevel+1, "(user_via%d %s %s)\n", ii, aFormatter->Print( aNestLevel+1, "(user_via%d %s %s)\n", ii,
FormatBIU( m_ViasDimensionsList[ii].m_Diameter ).c_str(), FMT_IU( m_ViasDimensionsList[ii].m_Diameter ).c_str(),
FormatBIU( m_ViasDimensionsList[ii].m_Drill ).c_str() ); FMT_IU( m_ViasDimensionsList[ii].m_Drill ).c_str() );
// for old versions compatibility: // for old versions compatibility:
aFormatter->Print( aNestLevel+1, "(uvia_size %s)\n", aFormatter->Print( aNestLevel+1, "(uvia_size %s)\n",
FormatBIU( m_NetClasses.GetDefault()->GetuViaDiameter() ).c_str() ); FMT_IU( m_NetClasses.GetDefault()->GetuViaDiameter() ).c_str() );
aFormatter->Print( aNestLevel+1, "(uvia_drill %s)\n", aFormatter->Print( aNestLevel+1, "(uvia_drill %s)\n",
FormatBIU( m_NetClasses.GetDefault()->GetuViaDrill() ).c_str() ); FMT_IU( m_NetClasses.GetDefault()->GetuViaDrill() ).c_str() );
aFormatter->Print( aNestLevel+1, "(uvias_allow %s)\n", aFormatter->Print( aNestLevel+1, "(uvias_allow %s)\n",
FormatBIU( GetDesignSettings().m_MicroViasAllowed ).c_str() ); FMT_IU( GetDesignSettings().m_MicroViasAllowed ).c_str() );
aFormatter->Print( aNestLevel+1, "(uvia_min_size %s)\n", aFormatter->Print( aNestLevel+1, "(uvia_min_size %s)\n",
FormatBIU( GetDesignSettings().m_MicroViasMinSize ).c_str() ); FMT_IU( GetDesignSettings().m_MicroViasMinSize ).c_str() );
aFormatter->Print( aNestLevel+1, "(uvia_min_drill %s)\n", aFormatter->Print( aNestLevel+1, "(uvia_min_drill %s)\n",
FormatBIU( GetDesignSettings().m_MicroViasMinDrill ).c_str() ); FMT_IU( GetDesignSettings().m_MicroViasMinDrill ).c_str() );
aFormatter->Print( aNestLevel+1, "(pcb_text_width %s)\n", aFormatter->Print( aNestLevel+1, "(pcb_text_width %s)\n",
FormatBIU( GetDesignSettings().m_PcbTextWidth ).c_str() ); FMT_IU( GetDesignSettings().m_PcbTextWidth ).c_str() );
aFormatter->Print( aNestLevel+1, "(pcb_text_size %s %s)\n", aFormatter->Print( aNestLevel+1, "(pcb_text_size %s %s)\n",
FormatBIU( GetDesignSettings().m_PcbTextSize.x ).c_str(), FMT_IU( GetDesignSettings().m_PcbTextSize.x ).c_str(),
FormatBIU( GetDesignSettings().m_PcbTextSize.y ).c_str() ); FMT_IU( GetDesignSettings().m_PcbTextSize.y ).c_str() );
aFormatter->Print( aNestLevel+1, "(mod_edge_width %s)\n", aFormatter->Print( aNestLevel+1, "(mod_edge_width %s)\n",
FormatBIU( GetDesignSettings().m_ModuleSegmentWidth ).c_str() ); FMT_IU( GetDesignSettings().m_ModuleSegmentWidth ).c_str() );
aFormatter->Print( aNestLevel+1, "(mod_text_size %s %s)\n", aFormatter->Print( aNestLevel+1, "(mod_text_size %s %s)\n",
FormatBIU( GetDesignSettings().m_ModuleTextSize.x ).c_str(), FMT_IU( GetDesignSettings().m_ModuleTextSize.x ).c_str(),
FormatBIU( GetDesignSettings().m_ModuleTextSize.y ).c_str() ); FMT_IU( GetDesignSettings().m_ModuleTextSize.y ).c_str() );
aFormatter->Print( aNestLevel+1, "(mod_text_width %s)\n", aFormatter->Print( aNestLevel+1, "(mod_text_width %s)\n",
FormatBIU( GetDesignSettings().m_ModuleTextWidth ).c_str() ); FMT_IU( GetDesignSettings().m_ModuleTextWidth ).c_str() );
aFormatter->Print( aNestLevel+1, "(pad_size %s %s)\n", aFormatter->Print( aNestLevel+1, "(pad_size %s %s)\n",
FormatBIU( GetDesignSettings().m_Pad_Master.GetSize().x ).c_str(), FMT_IU( GetDesignSettings().m_Pad_Master.GetSize().x ).c_str(),
FormatBIU( GetDesignSettings().m_Pad_Master.GetSize().x ).c_str() ); FMT_IU( GetDesignSettings().m_Pad_Master.GetSize().x ).c_str() );
aFormatter->Print( aNestLevel+1, "(pad_drill %s)\n", aFormatter->Print( aNestLevel+1, "(pad_drill %s)\n",
FormatBIU( GetDesignSettings().m_Pad_Master.GetDrillSize().x ).c_str() ); FMT_IU( GetDesignSettings().m_Pad_Master.GetDrillSize().x ).c_str() );
aFormatter->Print( aNestLevel+1, "(pad_to_mask_clearance %s)\n", aFormatter->Print( aNestLevel+1, "(pad_to_mask_clearance %s)\n",
FormatBIU( GetDesignSettings().m_SolderMaskMargin ).c_str() ); FMT_IU( GetDesignSettings().m_SolderMaskMargin ).c_str() );
if( GetDesignSettings().m_SolderPasteMargin != 0 ) if( GetDesignSettings().m_SolderPasteMargin != 0 )
aFormatter->Print( aNestLevel+1, "(pad_to_paste_clearance %s)\n", aFormatter->Print( aNestLevel+1, "(pad_to_paste_clearance %s)\n",
FormatBIU( GetDesignSettings().m_SolderPasteMargin ).c_str() ); FMT_IU( GetDesignSettings().m_SolderPasteMargin ).c_str() );
if( GetDesignSettings().m_SolderPasteMarginRatio != 0 ) if( GetDesignSettings().m_SolderPasteMarginRatio != 0 )
aFormatter->Print( aNestLevel+1, "(pad_to_paste_clearance_ratio %g)\n", aFormatter->Print( aNestLevel+1, "(pad_to_paste_clearance_ratio %g)\n",
GetDesignSettings().m_SolderPasteMarginRatio ); GetDesignSettings().m_SolderPasteMarginRatio );
aFormatter->Print( aNestLevel+1, "(aux_axis_origin %s %s)\n", aFormatter->Print( aNestLevel+1, "(aux_axis_origin %s %s)\n",
FormatBIU( GetOriginAxisPosition().x ).c_str(), FMT_IU( GetOriginAxisPosition().x ).c_str(),
FormatBIU( GetOriginAxisPosition().y ).c_str() ); FMT_IU( GetOriginAxisPosition().y ).c_str() );
aFormatter->Print( aNestLevel+1, "(visible_elements %X)\n", aFormatter->Print( aNestLevel+1, "(visible_elements %X)\n",
GetDesignSettings().GetVisibleElements() ); GetDesignSettings().GetVisibleElements() );
......
...@@ -64,15 +64,16 @@ wxString BOARD_ITEM::GetLayerName() const ...@@ -64,15 +64,16 @@ wxString BOARD_ITEM::GetLayerName() const
} }
/** @todo Move Pcbnew version of FormatBIU() where ever the common DSO/DSL code ends up. */ std::string BOARD_ITEM::FormatInternalUnits( int aValue )
std::string FormatBIU( int aValue )
{ {
#if !defined( USE_PCBNEW_NANOMETRES )
wxFAIL_MSG( wxT( "Cannot use FormatBIU() unless Pcbnew is build with PCBNEW_NANOMETERS=ON." ) );
#endif
char buf[50]; char buf[50];
#if defined( USE_PCBNEW_NANOMETRES )
double engUnits = aValue / 1000000.0; double engUnits = aValue / 1000000.0;
#else
double engUnits = ( aValue * 10000.0 ) / 25.4 / 1000000.0;
#endif
int len; int len;
if( engUnits != 0.0 && fabs( engUnits ) <= 0.0001 ) if( engUnits != 0.0 && fabs( engUnits ) <= 0.0001 )
...@@ -93,3 +94,30 @@ std::string FormatBIU( int aValue ) ...@@ -93,3 +94,30 @@ std::string FormatBIU( int aValue )
return std::string( buf, len ); return std::string( buf, len );
} }
std::string BOARD_ITEM::FormatAngle( double aAngle )
{
char temp[50];
int len;
#if defined( USE_PCBNEW_SEXPR_FILE_FORMAT )
len = snprintf( temp, 49, "%.10g", aAngle / 10.0 );
#else
len = snprintf( temp, 49, "%.10g", aAngle );
#endif
return std::string( temp, len );
}
std::string BOARD_ITEM::FormatInternalUnits( const wxPoint& aPoint )
{
return FormatInternalUnits( aPoint.x ) + " " + FormatInternalUnits( aPoint.y );
}
std::string BOARD_ITEM::FormatInternalUnits( const wxSize& aSize )
{
return FormatInternalUnits( aSize.GetWidth() ) + " " + FormatInternalUnits( aSize.GetHeight() );
}
...@@ -610,53 +610,53 @@ EDA_ITEM* DIMENSION::Clone() const ...@@ -610,53 +610,53 @@ EDA_ITEM* DIMENSION::Clone() const
void DIMENSION::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const void DIMENSION::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
throw( IO_ERROR ) throw( IO_ERROR )
{ {
aFormatter->Print( aNestLevel, "(dimension %s\n", FormatBIU( m_Value ).c_str() ); aFormatter->Print( aNestLevel, "(dimension %s\n", FMT_IU( m_Value ).c_str() );
aFormatter->Print( aNestLevel+1, "(width %s)\n(layer %d)\n(tstamp %lX)\n", aFormatter->Print( aNestLevel+1, "(width %s)\n(layer %d)\n(tstamp %lX)\n",
FormatBIU( m_Width ).c_str(), GetLayer(), GetTimeStamp() ); FMT_IU( m_Width ).c_str(), GetLayer(), GetTimeStamp() );
m_Text.EDA_TEXT::Format( aFormatter, aNestLevel+1, aControlBits ); m_Text.EDA_TEXT::Format( aFormatter, aNestLevel+1, aControlBits );
aFormatter->Print( aNestLevel+1, "(feature1 pts((xy %s %s) (xy %s %s)))\n", aFormatter->Print( aNestLevel+1, "(feature1 pts((xy %s %s) (xy %s %s)))\n",
FormatBIU( m_featureLineDOx ).c_str(), FMT_IU( m_featureLineDOx ).c_str(),
FormatBIU( m_featureLineDOy ).c_str(), FMT_IU( m_featureLineDOy ).c_str(),
FormatBIU( m_featureLineDFx ).c_str(), FMT_IU( m_featureLineDFx ).c_str(),
FormatBIU( m_featureLineDFy ).c_str() ); FMT_IU( m_featureLineDFy ).c_str() );
aFormatter->Print( aNestLevel+1, "(feature2 pts((xy %s %s) (xy %s %s)))\n", aFormatter->Print( aNestLevel+1, "(feature2 pts((xy %s %s) (xy %s %s)))\n",
FormatBIU( m_featureLineGOx ).c_str(), FMT_IU( m_featureLineGOx ).c_str(),
FormatBIU( m_featureLineGOy ).c_str(), FMT_IU( m_featureLineGOy ).c_str(),
FormatBIU( m_featureLineGFx ).c_str(), FMT_IU( m_featureLineGFx ).c_str(),
FormatBIU( m_featureLineGFy ).c_str() ); FMT_IU( m_featureLineGFy ).c_str() );
aFormatter->Print( aNestLevel+1, "(crossbar pts((xy %s %s) (xy %s %s)))\n", aFormatter->Print( aNestLevel+1, "(crossbar pts((xy %s %s) (xy %s %s)))\n",
FormatBIU( m_crossBarOx ).c_str(), FMT_IU( m_crossBarOx ).c_str(),
FormatBIU( m_crossBarOy ).c_str(), FMT_IU( m_crossBarOy ).c_str(),
FormatBIU( m_crossBarFx ).c_str(), FMT_IU( m_crossBarFx ).c_str(),
FormatBIU( m_crossBarFy ).c_str() ); FMT_IU( m_crossBarFy ).c_str() );
aFormatter->Print( aNestLevel+1, "(arrow1a pts((xy %s %s) (xy %s %s)))\n", aFormatter->Print( aNestLevel+1, "(arrow1a pts((xy %s %s) (xy %s %s)))\n",
FormatBIU( m_arrowD1Ox ).c_str(), FMT_IU( m_arrowD1Ox ).c_str(),
FormatBIU( m_arrowD1Oy ).c_str(), FMT_IU( m_arrowD1Oy ).c_str(),
FormatBIU( m_arrowD1Fx ).c_str(), FMT_IU( m_arrowD1Fx ).c_str(),
FormatBIU( m_arrowD1Fy ).c_str() ); FMT_IU( m_arrowD1Fy ).c_str() );
aFormatter->Print( aNestLevel+1, "(arrow1b pts((xy %s %s) (xy %s %s)))\n", aFormatter->Print( aNestLevel+1, "(arrow1b pts((xy %s %s) (xy %s %s)))\n",
FormatBIU( m_arrowD2Ox ).c_str(), FMT_IU( m_arrowD2Ox ).c_str(),
FormatBIU( m_arrowD2Oy ).c_str(), FMT_IU( m_arrowD2Oy ).c_str(),
FormatBIU( m_arrowD2Fx ).c_str(), FMT_IU( m_arrowD2Fx ).c_str(),
FormatBIU( m_arrowD2Fy ).c_str() ); FMT_IU( m_arrowD2Fy ).c_str() );
aFormatter->Print( aNestLevel+1, "(arrow2a pts((xy %s %s) (xy %s %s)))\n", aFormatter->Print( aNestLevel+1, "(arrow2a pts((xy %s %s) (xy %s %s)))\n",
FormatBIU( m_arrowG1Ox ).c_str(), FMT_IU( m_arrowG1Ox ).c_str(),
FormatBIU( m_arrowG1Oy ).c_str(), FMT_IU( m_arrowG1Oy ).c_str(),
FormatBIU( m_arrowG1Fx ).c_str(), FMT_IU( m_arrowG1Fx ).c_str(),
FormatBIU( m_arrowG1Fy ).c_str() ); FMT_IU( m_arrowG1Fy ).c_str() );
aFormatter->Print( aNestLevel+1, "(arrow2b pts((xy %s %s) (xy %s %s)))\n", aFormatter->Print( aNestLevel+1, "(arrow2b pts((xy %s %s) (xy %s %s)))\n",
FormatBIU( m_arrowG2Ox ).c_str(), FMT_IU( m_arrowG2Ox ).c_str(),
FormatBIU( m_arrowG2Oy ).c_str(), FMT_IU( m_arrowG2Oy ).c_str(),
FormatBIU( m_arrowG2Fx ).c_str(), FMT_IU( m_arrowG2Fx ).c_str(),
FormatBIU( m_arrowG2Fy ).c_str() ); FMT_IU( m_arrowG2Fy ).c_str() );
aFormatter->Print( aNestLevel, ")\n" ); aFormatter->Print( aNestLevel, ")\n" );
} }
...@@ -554,39 +554,39 @@ void DRAWSEGMENT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aCont ...@@ -554,39 +554,39 @@ void DRAWSEGMENT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aCont
switch( m_Shape ) switch( m_Shape )
{ {
case S_SEGMENT: // Line case S_SEGMENT: // Line
aFormatter->Print( 0, "line (pts xy(%s) xy(%s))", aFormatter->Print( 0, "line (pts (xy %s) (xy %s))",
FormatBIU( m_Start ).c_str(), FMT_IU( m_Start ).c_str(),
FormatBIU( m_End ).c_str() ); FMT_IU( m_End ).c_str() );
break; break;
case S_CIRCLE: // Circle case S_CIRCLE: // Circle
aFormatter->Print( 0, "circle (center (xy %s)) (end (xy %s))", aFormatter->Print( 0, "circle (center (xy %s)) (end (xy %s))",
FormatBIU( m_Start ).c_str(), FMT_IU( m_Start ).c_str(),
FormatBIU( m_End ).c_str() ); FMT_IU( m_End ).c_str() );
break; break;
case S_ARC: // Arc case S_ARC: // Arc
aFormatter->Print( 0, "arc (start (xy %s)) (end (xy %s)) (angle %0.1f)", aFormatter->Print( 0, "arc (start (xy %s)) (end (xy %s)) (angle %s)",
FormatBIU( m_Start ).c_str(), FMT_IU( m_Start ).c_str(),
FormatBIU( m_End ).c_str(), FMT_IU( m_End ).c_str(),
m_Angle ); FMT_ANGLE( m_Angle ).c_str() );
break; break;
case S_POLYGON: // Polygon case S_POLYGON: // Polygon
aFormatter->Print( 0, "line (pts" ); aFormatter->Print( 0, "line (pts" );
for( i = 0; i<m_PolyPoints.size(); ++i ) for( i = 0; i<m_PolyPoints.size(); ++i )
aFormatter->Print( 0, " (xy %s)", FormatBIU( m_PolyPoints[i] ).c_str() ); aFormatter->Print( 0, " (xy %s)", FMT_IU( m_PolyPoints[i] ).c_str() );
aFormatter->Print( 0, ")" ); aFormatter->Print( 0, ")" );
break; break;
case S_CURVE: // Bezier curve case S_CURVE: // Bezier curve
aFormatter->Print( 0, "curve pts(xy(%s) xy(%s) xy(%s) xy(%s))", aFormatter->Print( 0, "curve pts(xy(%s) xy(%s) xy(%s) xy(%s))",
FormatBIU( m_Start ).c_str(), FMT_IU( m_Start ).c_str(),
FormatBIU( m_BezierC1 ).c_str(), FMT_IU( m_BezierC1 ).c_str(),
FormatBIU( m_BezierC2 ).c_str(), FMT_IU( m_BezierC2 ).c_str(),
FormatBIU( m_End ).c_str() ); FMT_IU( m_End ).c_str() );
break; break;
default: default:
...@@ -596,7 +596,7 @@ void DRAWSEGMENT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aCont ...@@ -596,7 +596,7 @@ void DRAWSEGMENT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aCont
aFormatter->Print( 0, " (layer %d)", GetLayer() ); aFormatter->Print( 0, " (layer %d)", GetLayer() );
if( m_Width != 0 ) if( m_Width != 0 )
aFormatter->Print( 0, " (width %s)", FormatBIU( m_Width ).c_str() ); aFormatter->Print( 0, " (width %s)", FMT_IU( m_Width ).c_str() );
if( GetTimeStamp() ) if( GetTimeStamp() )
aFormatter->Print( 0, " (tstamp %lX)", GetTimeStamp() ); aFormatter->Print( 0, " (tstamp %lX)", GetTimeStamp() );
......
...@@ -283,7 +283,7 @@ void EDGE_MODULE::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aCont ...@@ -283,7 +283,7 @@ void EDGE_MODULE::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aCont
throw( IO_ERROR ) throw( IO_ERROR )
{ {
aFormatter->Print( aNestLevel, "(edge (start (xy %s)) (end (xy %s))\n", aFormatter->Print( aNestLevel, "(edge (start (xy %s)) (end (xy %s))\n",
FormatBIU( m_Start0 ).c_str(), FormatBIU( m_End0 ).c_str() ); FMT_IU( m_Start0 ).c_str(), FMT_IU( m_End0 ).c_str() );
DRAWSEGMENT::Format( aFormatter, aNestLevel+1, aControlBits ); DRAWSEGMENT::Format( aFormatter, aNestLevel+1, aControlBits );
aFormatter->Print( aNestLevel, ")\n" ); aFormatter->Print( aNestLevel, ")\n" );
} }
......
...@@ -230,11 +230,11 @@ void PCB_TARGET::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aContr ...@@ -230,11 +230,11 @@ void PCB_TARGET::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aContr
{ {
aFormatter->Print( aNestLevel, "(target %c (pos (xy %s)) (size %s)", aFormatter->Print( aNestLevel, "(target %c (pos (xy %s)) (size %s)",
( m_Shape ) ? 'x' : '+', ( m_Shape ) ? 'x' : '+',
FormatBIU( m_Pos ).c_str(), FMT_IU( m_Pos ).c_str(),
FormatBIU( m_Size ).c_str() ); FMT_IU( m_Size ).c_str() );
if( m_Width != 0 ) if( m_Width != 0 )
aFormatter->Print( aNestLevel, " (width %s)", FormatBIU( m_Width ).c_str() ); aFormatter->Print( aNestLevel, " (width %s)", FMT_IU( m_Width ).c_str() );
aFormatter->Print( aNestLevel, " (layer %d)", GetLayer() ); aFormatter->Print( aNestLevel, " (layer %d)", GetLayer() );
......
...@@ -677,10 +677,10 @@ void MODULE::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBi ...@@ -677,10 +677,10 @@ void MODULE::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBi
aFormatter->Print( 0, " (tedit %lX) (tstamp %lX)\n", aFormatter->Print( 0, " (tedit %lX) (tstamp %lX)\n",
GetLastEditTime(), GetTimeStamp() ); GetLastEditTime(), GetTimeStamp() );
aFormatter->Print( aNestLevel+1, "(at %s", FormatBIU( m_Pos ).c_str() ); aFormatter->Print( aNestLevel+1, "(at %s", FMT_IU( m_Pos ).c_str() );
if( m_Orient != 0.0 ) if( m_Orient != 0.0 )
aFormatter->Print( 0, " %0.1f", m_Orient ); aFormatter->Print( 0, " %s", FMT_ANGLE( m_Orient ).c_str() );
aFormatter->Print( 0, ")\n" ); aFormatter->Print( 0, ")\n" );
...@@ -701,11 +701,11 @@ void MODULE::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBi ...@@ -701,11 +701,11 @@ void MODULE::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBi
if( m_LocalSolderMaskMargin != 0 ) if( m_LocalSolderMaskMargin != 0 )
aFormatter->Print( aNestLevel+1, "(solder_mask_margin %s)\n", aFormatter->Print( aNestLevel+1, "(solder_mask_margin %s)\n",
FormatBIU( m_LocalSolderMaskMargin ).c_str() ); FMT_IU( m_LocalSolderMaskMargin ).c_str() );
if( m_LocalSolderPasteMargin != 0 ) if( m_LocalSolderPasteMargin != 0 )
aFormatter->Print( aNestLevel+1, "(solder_paste_margin %s)\n", aFormatter->Print( aNestLevel+1, "(solder_paste_margin %s)\n",
FormatBIU( m_LocalSolderPasteMargin ).c_str() ); FMT_IU( m_LocalSolderPasteMargin ).c_str() );
if( m_LocalSolderPasteMarginRatio != 0 ) if( m_LocalSolderPasteMarginRatio != 0 )
aFormatter->Print( aNestLevel+1, "(solder_paste_ratio %g)\n", aFormatter->Print( aNestLevel+1, "(solder_paste_ratio %g)\n",
...@@ -713,18 +713,18 @@ void MODULE::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBi ...@@ -713,18 +713,18 @@ void MODULE::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBi
if( m_LocalClearance != 0 ) if( m_LocalClearance != 0 )
aFormatter->Print( aNestLevel+1, "(clearance %s)\n", aFormatter->Print( aNestLevel+1, "(clearance %s)\n",
FormatBIU( m_LocalClearance ).c_str() ); FMT_IU( m_LocalClearance ).c_str() );
if( m_ZoneConnection != UNDEFINED_CONNECTION ) if( m_ZoneConnection != UNDEFINED_CONNECTION )
aFormatter->Print( aNestLevel+1, "(zone_connect %d)\n", m_ZoneConnection ); aFormatter->Print( aNestLevel+1, "(zone_connect %d)\n", m_ZoneConnection );
if( m_ThermalWidth != 0 ) if( m_ThermalWidth != 0 )
aFormatter->Print( aNestLevel+1, "(thermal_width %s)\n", aFormatter->Print( aNestLevel+1, "(thermal_width %s)\n",
FormatBIU( m_ThermalWidth ).c_str() ); FMT_IU( m_ThermalWidth ).c_str() );
if( m_ThermalGap != 0 ) if( m_ThermalGap != 0 )
aFormatter->Print( aNestLevel+1, "(thermal_gap %s)\n", aFormatter->Print( aNestLevel+1, "(thermal_gap %s)\n",
FormatBIU( m_ThermalGap ).c_str() ); FMT_IU( m_ThermalGap ).c_str() );
// Attributes // Attributes
if( m_Attributs != MOD_DEFAULT ) if( m_Attributs != MOD_DEFAULT )
......
...@@ -39,9 +39,9 @@ ...@@ -39,9 +39,9 @@
const wxString NETCLASS::Default = wxT("Default"); const wxString NETCLASS::Default = wxT("Default");
// Initial values for netclass initialization // Initial values for netclass initialization
int NETCLASS::DEFAULT_CLEARANCE = DMils2iu( 100 ); // track to track and track to pads clearance int NETCLASS::DEFAULT_CLEARANCE = DMils2iu( 100 ); // track to track and track to pads clearance
int NETCLASS::DEFAULT_VIA_DRILL = DMils2iu( 250 ); // default via drill int NETCLASS::DEFAULT_VIA_DRILL = DMils2iu( 250 ); // default via drill
int NETCLASS::DEFAULT_UVIA_DRILL = DMils2iu( 50 ); // micro via drill int NETCLASS::DEFAULT_UVIA_DRILL = DMils2iu( 50 ); // micro via drill
NETCLASS::NETCLASS( BOARD* aParent, const wxString& aName, const NETCLASS* initialParameters ) : NETCLASS::NETCLASS( BOARD* aParent, const wxString& aName, const NETCLASS* initialParameters ) :
...@@ -328,14 +328,14 @@ void NETCLASS::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl ...@@ -328,14 +328,14 @@ void NETCLASS::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
aFormatter->Quotew( GetName() ).c_str(), aFormatter->Quotew( GetName() ).c_str(),
aFormatter->Quotew( GetDescription() ).c_str() ); aFormatter->Quotew( GetDescription() ).c_str() );
aFormatter->Print( aNestLevel+1, "(clearance %s)\n", FormatBIU( GetClearance() ).c_str() ); aFormatter->Print( aNestLevel+1, "(clearance %s)\n", FMT_IU( GetClearance() ).c_str() );
aFormatter->Print( aNestLevel+1, "(trace_width %s)\n", FormatBIU( GetTrackWidth() ).c_str() ); aFormatter->Print( aNestLevel+1, "(trace_width %s)\n", FMT_IU( GetTrackWidth() ).c_str() );
aFormatter->Print( aNestLevel+1, "(via_dia %s)\n", FormatBIU( GetViaDiameter() ).c_str() ); aFormatter->Print( aNestLevel+1, "(via_dia %s)\n", FMT_IU( GetViaDiameter() ).c_str() );
aFormatter->Print( aNestLevel+1, "(via_drill %s)\n", FormatBIU( GetViaDrill() ).c_str() ); aFormatter->Print( aNestLevel+1, "(via_drill %s)\n", FMT_IU( GetViaDrill() ).c_str() );
aFormatter->Print( aNestLevel+1, "(uvia_dia %s)\n", FormatBIU( GetuViaDiameter() ).c_str() ); aFormatter->Print( aNestLevel+1, "(uvia_dia %s)\n", FMT_IU( GetuViaDiameter() ).c_str() );
aFormatter->Print( aNestLevel+1, "(uvia_drill %s)\n", FormatBIU( GetuViaDrill() ).c_str() ); aFormatter->Print( aNestLevel+1, "(uvia_drill %s)\n", FMT_IU( GetuViaDrill() ).c_str() );
for( NETCLASS::const_iterator it = begin(); it!= end(); ++it ) for( NETCLASS::const_iterator it = begin(); it!= end(); ++it )
aFormatter->Print( aNestLevel+1, "(add_net %s)\n", aFormatter->Quotew( *it ).c_str() ); aFormatter->Print( aNestLevel+1, "(add_net %s)\n", aFormatter->Quotew( *it ).c_str() );
......
...@@ -860,25 +860,25 @@ void D_PAD::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBit ...@@ -860,25 +860,25 @@ void D_PAD::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBit
aFormatter->Print( aNestLevel, "(pad %s %s %s (size %s)\n", aFormatter->Print( aNestLevel, "(pad %s %s %s (size %s)\n",
aFormatter->Quotew( GetPadName() ).c_str(), type.c_str(), shape.c_str(), aFormatter->Quotew( GetPadName() ).c_str(), type.c_str(), shape.c_str(),
FormatBIU( m_Size ).c_str() ); FMT_IU( m_Size ).c_str() );
aFormatter->Print( aNestLevel+1, "(at %s", FormatBIU( m_Pos0 ).c_str() ); aFormatter->Print( aNestLevel+1, "(at %s", FMT_IU( m_Pos0 ).c_str() );
if( m_Orient != 0.0 ) if( m_Orient != 0.0 )
aFormatter->Print( 0, " %0.1f", m_Orient ); aFormatter->Print( 0, " %s", FMT_ANGLE( m_Orient ).c_str() );
aFormatter->Print( 0, ")\n" ); aFormatter->Print( 0, ")\n" );
if( (m_Drill.GetWidth() > 0) || (m_Drill.GetHeight() > 0) ) if( (m_Drill.GetWidth() > 0) || (m_Drill.GetHeight() > 0) )
{ {
std::string drill = (m_Drill.GetHeight() > 0) ? FormatBIU( m_Drill ).c_str() : std::string drill = (m_Drill.GetHeight() > 0) ? FMT_IU( m_Drill ).c_str() :
FormatBIU( m_Drill.GetWidth() ).c_str(); FMT_IU( m_Drill.GetWidth() ).c_str();
aFormatter->Print( aNestLevel+1, "(drill %s", drill.c_str() ); aFormatter->Print( aNestLevel+1, "(drill %s", drill.c_str() );
if( (m_Offset.x > 0) || (m_Offset.y > 0) ) if( (m_Offset.x > 0) || (m_Offset.y > 0) )
{ {
std::string drillOffset = ( m_Offset.x > 0 ) ? std::string drillOffset = ( m_Offset.x > 0 ) ?
FormatBIU( m_Offset ).c_str() : FMT_IU( m_Offset ).c_str() :
FormatBIU( m_Offset.x ).c_str(); FMT_IU( m_Offset.x ).c_str();
aFormatter->Print( 0, " (offset %s)", drillOffset.c_str() ); aFormatter->Print( 0, " (offset %s)", drillOffset.c_str() );
} }
...@@ -891,15 +891,15 @@ void D_PAD::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBit ...@@ -891,15 +891,15 @@ void D_PAD::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBit
GetNet(), aFormatter->Quotew( m_Netname ).c_str() ); GetNet(), aFormatter->Quotew( m_Netname ).c_str() );
if( m_LengthDie != 0 ) if( m_LengthDie != 0 )
aFormatter->Print( aNestLevel+1, "(die_length %s)\n", FormatBIU( m_LengthDie ).c_str() ); aFormatter->Print( aNestLevel+1, "(die_length %s)\n", FMT_IU( m_LengthDie ).c_str() );
if( m_LocalSolderMaskMargin != 0 ) if( m_LocalSolderMaskMargin != 0 )
aFormatter->Print( aNestLevel+1, "(solder_mask_margin %s)\n", aFormatter->Print( aNestLevel+1, "(solder_mask_margin %s)\n",
FormatBIU( m_LocalSolderMaskMargin ).c_str() ); FMT_IU( m_LocalSolderMaskMargin ).c_str() );
if( m_LocalSolderPasteMargin != 0 ) if( m_LocalSolderPasteMargin != 0 )
aFormatter->Print( aNestLevel+1, "(solder_paste_margin %s)\n", aFormatter->Print( aNestLevel+1, "(solder_paste_margin %s)\n",
FormatBIU( m_LocalSolderPasteMargin ).c_str() ); FMT_IU( m_LocalSolderPasteMargin ).c_str() );
if( m_LocalSolderPasteMarginRatio != 0 ) if( m_LocalSolderPasteMarginRatio != 0 )
aFormatter->Print( aNestLevel+1, "(solder_paste_margin_ratio %g)\n", aFormatter->Print( aNestLevel+1, "(solder_paste_margin_ratio %g)\n",
...@@ -907,18 +907,18 @@ void D_PAD::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBit ...@@ -907,18 +907,18 @@ void D_PAD::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBit
if( m_LocalClearance != 0 ) if( m_LocalClearance != 0 )
aFormatter->Print( aNestLevel+1, "(clearance %s)\n", aFormatter->Print( aNestLevel+1, "(clearance %s)\n",
FormatBIU( m_LocalClearance ).c_str() ); FMT_IU( m_LocalClearance ).c_str() );
if( GetZoneConnection() != UNDEFINED_CONNECTION ) if( GetZoneConnection() != UNDEFINED_CONNECTION )
aFormatter->Print( aNestLevel+1, "(zone_connect %d)\n", GetZoneConnection() ); aFormatter->Print( aNestLevel+1, "(zone_connect %d)\n", GetZoneConnection() );
if( GetThermalWidth() != 0 ) if( GetThermalWidth() != 0 )
aFormatter->Print( aNestLevel+1, "(thermal_width %s)\n", aFormatter->Print( aNestLevel+1, "(thermal_width %s)\n",
FormatBIU( GetThermalWidth() ).c_str() ); FMT_IU( GetThermalWidth() ).c_str() );
if( GetThermalGap() != 0 ) if( GetThermalGap() != 0 )
aFormatter->Print( aNestLevel+1, "(thermal_gap %s)\n", aFormatter->Print( aNestLevel+1, "(thermal_gap %s)\n",
FormatBIU( GetThermalGap() ).c_str() ); FMT_IU( GetThermalGap() ).c_str() );
aFormatter->Print( aNestLevel, ")\n" ); aFormatter->Print( aNestLevel, ")\n" );
} }
......
...@@ -30,6 +30,7 @@ ...@@ -30,6 +30,7 @@
#ifndef CLASS_PCB_TEXT_H #ifndef CLASS_PCB_TEXT_H
#define CLASS_PCB_TEXT_H #define CLASS_PCB_TEXT_H
#include <eda_text.h>
#include <class_board_item.h> #include <class_board_item.h>
#include <PolyLine.h> #include <PolyLine.h>
......
...@@ -492,7 +492,7 @@ void TEXTE_MODULE::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aCon ...@@ -492,7 +492,7 @@ void TEXTE_MODULE::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aCon
orient += parent->GetOrientation(); orient += parent->GetOrientation();
aFormatter->Print( aNestLevel, "(module_text %d (at %s %0.1f)%s\n", m_Type, aFormatter->Print( aNestLevel, "(module_text %d (at %s %0.1f)%s\n", m_Type,
FormatBIU( m_Pos0 ).c_str(), orient, (m_NoShow) ? "hide" : "" ); FMT_IU( m_Pos0 ).c_str(), orient, (m_NoShow) ? "hide" : "" );
EDA_TEXT::Format( aFormatter, aNestLevel+1, aControlBits ); EDA_TEXT::Format( aFormatter, aNestLevel+1, aControlBits );
......
...@@ -32,6 +32,7 @@ ...@@ -32,6 +32,7 @@
#define TEXT_MODULE_H_ #define TEXT_MODULE_H_
#include <eda_text.h>
#include <class_board_item.h> #include <class_board_item.h>
......
...@@ -1576,16 +1576,16 @@ void TRACK::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBit ...@@ -1576,16 +1576,16 @@ void TRACK::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBit
} }
aFormatter->Print( aNestLevel, "(via %s (at %s) (size %s)", type.c_str(), aFormatter->Print( aNestLevel, "(via %s (at %s) (size %s)", type.c_str(),
FormatBIU( m_Start ).c_str(), FormatBIU( m_Width ).c_str() ); FMT_IU( m_Start ).c_str(), FMT_IU( m_Width ).c_str() );
if( m_Drill != UNDEFINED_DRILL_DIAMETER ) if( m_Drill != UNDEFINED_DRILL_DIAMETER )
aFormatter->Print( 0, " (drill %s)", FormatBIU( m_Drill ).c_str() ); aFormatter->Print( 0, " (drill %s)", FMT_IU( m_Drill ).c_str() );
} }
else else
{ {
aFormatter->Print( aNestLevel, "(segment (start %s) (end %s) (width %s)", aFormatter->Print( aNestLevel, "(segment (start %s) (end %s) (width %s)",
FormatBIU( m_Start ).c_str(), FormatBIU( m_End ).c_str(), FMT_IU( m_Start ).c_str(), FMT_IU( m_End ).c_str(),
FormatBIU( m_Width ).c_str() ); FMT_IU( m_Width ).c_str() );
} }
aFormatter->Print( 0, " (layer %d) (net %d)", GetLayer(), GetNet() ); aFormatter->Print( 0, " (layer %d) (net %d)", GetLayer(), GetNet() );
......
...@@ -993,18 +993,18 @@ void ZONE_CONTAINER::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aC ...@@ -993,18 +993,18 @@ void ZONE_CONTAINER::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aC
} }
aFormatter->Print( aNestLevel+1, "(connect_pads %s (clearance %s))\n", aFormatter->Print( aNestLevel+1, "(connect_pads %s (clearance %s))\n",
padoption.c_str(), FormatBIU( m_ZoneClearance ).c_str() ); padoption.c_str(), FMT_IU( m_ZoneClearance ).c_str() );
aFormatter->Print( aNestLevel+1, "(min_thickness %s)\n", aFormatter->Print( aNestLevel+1, "(min_thickness %s)\n",
FormatBIU( m_ZoneMinThickness ).c_str() ); FMT_IU( m_ZoneMinThickness ).c_str() );
aFormatter->Print( aNestLevel+1, aFormatter->Print( aNestLevel+1,
"(fill %s (mode %s) (arc_segments %d) (thermal_gap %s) (thermal_bridge_width %s)\n", "(fill %s (mode %s) (arc_segments %d) (thermal_gap %s) (thermal_bridge_width %s)\n",
(m_IsFilled) ? "yes" : "no", (m_IsFilled) ? "yes" : "no",
(m_FillMode) ? "segment" : "polygon", (m_FillMode) ? "segment" : "polygon",
m_ArcToSegmentsCount, m_ArcToSegmentsCount,
FormatBIU( m_ThermalReliefGap ).c_str(), FMT_IU( m_ThermalReliefGap ).c_str(),
FormatBIU( m_ThermalReliefCopperBridge ).c_str() ); FMT_IU( m_ThermalReliefCopperBridge ).c_str() );
std::string smoothing; std::string smoothing;
...@@ -1019,7 +1019,7 @@ void ZONE_CONTAINER::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aC ...@@ -1019,7 +1019,7 @@ void ZONE_CONTAINER::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aC
} }
aFormatter->Print( aNestLevel+1, "(smoothing %s (radius %s))\n", aFormatter->Print( aNestLevel+1, "(smoothing %s (radius %s))\n",
smoothing.c_str(), FormatBIU( cornerRadius ).c_str() ); smoothing.c_str(), FMT_IU( cornerRadius ).c_str() );
const std::vector< CPolyPt >& cv = m_Poly->corner; const std::vector< CPolyPt >& cv = m_Poly->corner;
...@@ -1031,7 +1031,7 @@ void ZONE_CONTAINER::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aC ...@@ -1031,7 +1031,7 @@ void ZONE_CONTAINER::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aC
for( std::vector< CPolyPt >::const_iterator it = cv.begin(); it != cv.end(); ++it ) for( std::vector< CPolyPt >::const_iterator it = cv.begin(); it != cv.end(); ++it )
{ {
aFormatter->Print( aNestLevel+3, "(xy %s %s)\n", aFormatter->Print( aNestLevel+3, "(xy %s %s)\n",
FormatBIU( it->x ).c_str(), FormatBIU( it->y ).c_str() ); FMT_IU( it->x ).c_str(), FMT_IU( it->y ).c_str() );
if( it->end_contour ) if( it->end_contour )
{ {
...@@ -1060,7 +1060,7 @@ void ZONE_CONTAINER::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aC ...@@ -1060,7 +1060,7 @@ void ZONE_CONTAINER::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aC
for( std::vector< CPolyPt >::const_iterator it = fv.begin(); it != fv.end(); ++it ) for( std::vector< CPolyPt >::const_iterator it = fv.begin(); it != fv.end(); ++it )
{ {
aFormatter->Print( aNestLevel+3, "(xy %s %s)\n", aFormatter->Print( aNestLevel+3, "(xy %s %s)\n",
FormatBIU( it->x ).c_str(), FormatBIU( it->y ).c_str() ); FMT_IU( it->x ).c_str(), FMT_IU( it->y ).c_str() );
if( it->end_contour ) if( it->end_contour )
{ {
...@@ -1088,8 +1088,8 @@ void ZONE_CONTAINER::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aC ...@@ -1088,8 +1088,8 @@ void ZONE_CONTAINER::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aC
for( std::vector< SEGMENT >::const_iterator it = segs.begin(); it != segs.end(); ++it ) for( std::vector< SEGMENT >::const_iterator it = segs.begin(); it != segs.end(); ++it )
{ {
aFormatter->Print( aNestLevel+2, "(pts (xy %s) (xy %s))\n", aFormatter->Print( aNestLevel+2, "(pts (xy %s) (xy %s))\n",
FormatBIU( it->m_Start ).c_str(), FMT_IU( it->m_Start ).c_str(),
FormatBIU( it->m_End ).c_str() ); FMT_IU( it->m_End ).c_str() );
} }
aFormatter->Print( aNestLevel+1, ")\n" ); aFormatter->Print( aNestLevel+1, ")\n" );
......
...@@ -9,6 +9,8 @@ ...@@ -9,6 +9,8 @@
#include <macros.h> #include <macros.h>
#include <trigo.h> #include <trigo.h>
#include <class_pcb_screen.h> #include <class_pcb_screen.h>
#include <eda_text.h> // FILLED
#include <pcbnew.h> #include <pcbnew.h>
#include <class_board_design_settings.h> #include <class_board_design_settings.h>
#include <layers_id_colors_and_visibility.h> #include <layers_id_colors_and_visibility.h>
......
...@@ -25,7 +25,7 @@ ...@@ -25,7 +25,7 @@
#include <wx/wx.h> #include <wx/wx.h>
#include <pcb_plot_params_lexer.h> #include <pcb_plot_params_lexer.h>
#include <base_struct.h> #include <eda_text.h> // EDA_DRAW_MODE_T
class PCB_PLOT_PARAMS_PARSER; class PCB_PLOT_PARAMS_PARSER;
class LINE_READER; class LINE_READER;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment