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()
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
class_bitmap_base.cpp
class_colors_design_settings.cpp
class_marker_base.cpp
class_page_info.cpp
class_plotter.cpp
class_undoredo_container.cpp
common.cpp
......@@ -84,6 +83,8 @@ add_library(common STATIC ${COMMON_SRCS})
set(PCB_COMMON_SRCS
base_screen.cpp
eda_text.cpp
class_page_info.cpp
pcbcommon.cpp
footprint_info.cpp
class_layer_box_selector.cpp
......
This diff is collapsed.
......@@ -36,6 +36,7 @@
#define PAPER_A1 wxPAPER_A2
#endif
// Standard paper sizes nicknames.
const wxString PAGE_INFO::A4( wxT( "A4" ) );
const wxString PAGE_INFO::A3( wxT( "A3" ) );
......@@ -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( !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.
if( GetType() == PAGE_INFO::Custom )
aFormatter->Print( aNestLevel, " %d %d", GetWidthMils(), GetHeightMils() );
aFormatter->Print( aNestLevel, " %d %d", GetWidthIU(), GetHeightIU() );
if( IsCustom() && IsPortrait() )
aFormatter->Print( aNestLevel, " portrait" );
......
......@@ -560,15 +560,3 @@ wxString& operator <<( wxString& aString, const wxPoint& aPos )
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 @@
*/
#include <fctsys.h>
#include <gr_basic.h>
#include <common.h>
#include <plot_common.h>
#include <eda_text.h> // EDA_TEXT_HJUSTIFY_T and EDA_TEXT_VJUSTIFY_T
#include <trigo.h>
#include <macros.h>
#include <class_drawpanel.h>
......
This diff is collapsed.
......@@ -105,3 +105,52 @@ void SCH_ITEM::Plot( PLOTTER* aPlotter )
{
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
set(EESCHEMA_COMMON_SRCS
../common/dialogs/dialog_page_settings.cpp
../common/base_screen.cpp
../common/eda_text.cpp
../common/class_page_info.cpp
)
......
......@@ -35,6 +35,7 @@
#include <eda_dde.h>
#include <id.h>
#include <wxEeschemaStruct.h>
#include <eda_text.h>
#include <general.h>
#include <protos.h>
......
......@@ -29,6 +29,7 @@
#ifndef CLASS_LIBENTRY_FIELDS_H
#define CLASS_LIBENTRY_FIELDS_H
#include <eda_text.h>
#include <lib_draw_item.h>
......
......@@ -29,9 +29,9 @@
#ifndef _LIB_TEXT_H_
#define _LIB_TEXT_H_
#include <eda_text.h>
#include <lib_draw_item.h>
/**
* Class LIB_TEXT
* defines a component library graphical text item.
......
......@@ -31,6 +31,7 @@
#define CLASS_SCH_FIELD_H
#include <eda_text.h>
#include <sch_item_struct.h>
#include <general.h>
......
......@@ -1498,20 +1498,3 @@ void SCH_SCREEN::Show( int nestLevel, std::ostream& os ) const
NestedSpace( nestLevel, os ) << "</" << GetClass().Lower().mb_str() << ">\n";
}
#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 @@
#include <macros.h>
#include <eda_text.h>
#include <sch_item_struct.h>
......
This diff is collapsed.
......@@ -36,6 +36,10 @@
#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 EDA_DRAW_PANEL;
......@@ -247,6 +251,33 @@ public:
* @return wxString containing the layer name associated with this item.
*/
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 */
......@@ -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:
class LibNameList;
......
......@@ -8,6 +8,7 @@
#define __INCLUDE__DRAWTXT_H__ 1
#include <base_struct.h>
#include <eda_text.h> // EDA_TEXT_HJUSTIFY_T and EDA_TEXT_VJUSTIFY_T
class EDA_DRAW_PANEL;
class PLOTTER;
......
This diff is collapsed.
......@@ -11,6 +11,7 @@
#include <vector>
#include <drawtxt.h>
#include <common.h> // PAGE_INFO
#include <eda_text.h> // FILL_T
/**
* Enum PlotFormat
......
......@@ -60,6 +60,10 @@ typedef vector< SCH_ITEMS_ITR > SCH_ITEMS_ITRS;
#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.
extern const wxString traceFindReplace;
......@@ -365,6 +369,31 @@ public:
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:
/**
* Function doIsConnected
......
......@@ -36,6 +36,7 @@
#include <wxstruct.h>
#include <base_struct.h>
#include <eda_text.h> // EDA_DRAW_MODE_T
#include <richio.h>
#include <class_pcb_screen.h>
......
......@@ -299,16 +299,3 @@ void KICAD_MANAGER_FRAME::SaveSettings()
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)
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
// Write Bounding box info
aFormatter->Print( aNestLevel+1, "(area %s %s %s %s)\n",
FormatBIU( m_BoundingBox.GetX() ).c_str(),
FormatBIU( m_BoundingBox.GetY() ).c_str(),
FormatBIU( m_BoundingBox.GetRight() ).c_str(),
FormatBIU( m_BoundingBox.GetBottom() ).c_str() );
FMT_IU( m_BoundingBox.GetX() ).c_str(),
FMT_IU( m_BoundingBox.GetY() ).c_str(),
FMT_IU( m_BoundingBox.GetRight() ).c_str(),
FMT_IU( m_BoundingBox.GetBottom() ).c_str() );
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, "(tracks %d)\n", GetNumSegmTrack() );
......@@ -2195,92 +2195,92 @@ void BOARD::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBit
// Save current default track width, for compatibility with older Pcbnew version;
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
for( unsigned ii = 1; ii < m_TrackWidthList.size(); ii++ )
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",
FormatBIU( m_NetClasses.GetDefault()->GetClearance() ).c_str() );
FMT_IU( m_NetClasses.GetDefault()->GetClearance() ).c_str() );
// ZONE_SETTINGS
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, "(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",
FormatBIU( GetDesignSettings().m_DrawSegmentWidth ).c_str() );
FMT_IU( GetDesignSettings().m_DrawSegmentWidth ).c_str() );
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;
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",
FormatBIU( m_NetClasses.GetDefault()->GetViaDrill() ).c_str() );
FMT_IU( m_NetClasses.GetDefault()->GetViaDrill() ).c_str() );
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",
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
// the netclass value
for( unsigned ii = 1; ii < m_ViasDimensionsList.size(); ii++ )
aFormatter->Print( aNestLevel+1, "(user_via%d %s %s)\n", ii,
FormatBIU( m_ViasDimensionsList[ii].m_Diameter ).c_str(),
FormatBIU( m_ViasDimensionsList[ii].m_Drill ).c_str() );
FMT_IU( m_ViasDimensionsList[ii].m_Diameter ).c_str(),
FMT_IU( m_ViasDimensionsList[ii].m_Drill ).c_str() );
// for old versions compatibility:
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",
FormatBIU( m_NetClasses.GetDefault()->GetuViaDrill() ).c_str() );
FMT_IU( m_NetClasses.GetDefault()->GetuViaDrill() ).c_str() );
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",
FormatBIU( GetDesignSettings().m_MicroViasMinSize ).c_str() );
FMT_IU( GetDesignSettings().m_MicroViasMinSize ).c_str() );
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",
FormatBIU( GetDesignSettings().m_PcbTextWidth ).c_str() );
FMT_IU( GetDesignSettings().m_PcbTextWidth ).c_str() );
aFormatter->Print( aNestLevel+1, "(pcb_text_size %s %s)\n",
FormatBIU( GetDesignSettings().m_PcbTextSize.x ).c_str(),
FormatBIU( GetDesignSettings().m_PcbTextSize.y ).c_str() );
FMT_IU( GetDesignSettings().m_PcbTextSize.x ).c_str(),
FMT_IU( GetDesignSettings().m_PcbTextSize.y ).c_str() );
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",
FormatBIU( GetDesignSettings().m_ModuleTextSize.x ).c_str(),
FormatBIU( GetDesignSettings().m_ModuleTextSize.y ).c_str() );
FMT_IU( GetDesignSettings().m_ModuleTextSize.x ).c_str(),
FMT_IU( GetDesignSettings().m_ModuleTextSize.y ).c_str() );
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",
FormatBIU( 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(),
FMT_IU( GetDesignSettings().m_Pad_Master.GetSize().x ).c_str() );
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",
FormatBIU( GetDesignSettings().m_SolderMaskMargin ).c_str() );
FMT_IU( GetDesignSettings().m_SolderMaskMargin ).c_str() );
if( GetDesignSettings().m_SolderPasteMargin != 0 )
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 )
aFormatter->Print( aNestLevel+1, "(pad_to_paste_clearance_ratio %g)\n",
GetDesignSettings().m_SolderPasteMarginRatio );
aFormatter->Print( aNestLevel+1, "(aux_axis_origin %s %s)\n",
FormatBIU( GetOriginAxisPosition().x ).c_str(),
FormatBIU( GetOriginAxisPosition().y ).c_str() );
FMT_IU( GetOriginAxisPosition().x ).c_str(),
FMT_IU( GetOriginAxisPosition().y ).c_str() );
aFormatter->Print( aNestLevel+1, "(visible_elements %X)\n",
GetDesignSettings().GetVisibleElements() );
......
......@@ -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 FormatBIU( int aValue )
std::string BOARD_ITEM::FormatInternalUnits( 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];
#if defined( USE_PCBNEW_NANOMETRES )
double engUnits = aValue / 1000000.0;
#else
double engUnits = ( aValue * 10000.0 ) / 25.4 / 1000000.0;
#endif
int len;
if( engUnits != 0.0 && fabs( engUnits ) <= 0.0001 )
......@@ -93,3 +94,30 @@ std::string FormatBIU( int aValue )
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
void DIMENSION::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
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",
FormatBIU( m_Width ).c_str(), GetLayer(), GetTimeStamp() );
FMT_IU( m_Width ).c_str(), GetLayer(), GetTimeStamp() );
m_Text.EDA_TEXT::Format( aFormatter, aNestLevel+1, aControlBits );
aFormatter->Print( aNestLevel+1, "(feature1 pts((xy %s %s) (xy %s %s)))\n",
FormatBIU( m_featureLineDOx ).c_str(),
FormatBIU( m_featureLineDOy ).c_str(),
FormatBIU( m_featureLineDFx ).c_str(),
FormatBIU( m_featureLineDFy ).c_str() );
FMT_IU( m_featureLineDOx ).c_str(),
FMT_IU( m_featureLineDOy ).c_str(),
FMT_IU( m_featureLineDFx ).c_str(),
FMT_IU( m_featureLineDFy ).c_str() );
aFormatter->Print( aNestLevel+1, "(feature2 pts((xy %s %s) (xy %s %s)))\n",
FormatBIU( m_featureLineGOx ).c_str(),
FormatBIU( m_featureLineGOy ).c_str(),
FormatBIU( m_featureLineGFx ).c_str(),
FormatBIU( m_featureLineGFy ).c_str() );
FMT_IU( m_featureLineGOx ).c_str(),
FMT_IU( m_featureLineGOy ).c_str(),
FMT_IU( m_featureLineGFx ).c_str(),
FMT_IU( m_featureLineGFy ).c_str() );
aFormatter->Print( aNestLevel+1, "(crossbar pts((xy %s %s) (xy %s %s)))\n",
FormatBIU( m_crossBarOx ).c_str(),
FormatBIU( m_crossBarOy ).c_str(),
FormatBIU( m_crossBarFx ).c_str(),
FormatBIU( m_crossBarFy ).c_str() );
FMT_IU( m_crossBarOx ).c_str(),
FMT_IU( m_crossBarOy ).c_str(),
FMT_IU( m_crossBarFx ).c_str(),
FMT_IU( m_crossBarFy ).c_str() );
aFormatter->Print( aNestLevel+1, "(arrow1a pts((xy %s %s) (xy %s %s)))\n",
FormatBIU( m_arrowD1Ox ).c_str(),
FormatBIU( m_arrowD1Oy ).c_str(),
FormatBIU( m_arrowD1Fx ).c_str(),
FormatBIU( m_arrowD1Fy ).c_str() );
FMT_IU( m_arrowD1Ox ).c_str(),
FMT_IU( m_arrowD1Oy ).c_str(),
FMT_IU( m_arrowD1Fx ).c_str(),
FMT_IU( m_arrowD1Fy ).c_str() );
aFormatter->Print( aNestLevel+1, "(arrow1b pts((xy %s %s) (xy %s %s)))\n",
FormatBIU( m_arrowD2Ox ).c_str(),
FormatBIU( m_arrowD2Oy ).c_str(),
FormatBIU( m_arrowD2Fx ).c_str(),
FormatBIU( m_arrowD2Fy ).c_str() );
FMT_IU( m_arrowD2Ox ).c_str(),
FMT_IU( m_arrowD2Oy ).c_str(),
FMT_IU( m_arrowD2Fx ).c_str(),
FMT_IU( m_arrowD2Fy ).c_str() );
aFormatter->Print( aNestLevel+1, "(arrow2a pts((xy %s %s) (xy %s %s)))\n",
FormatBIU( m_arrowG1Ox ).c_str(),
FormatBIU( m_arrowG1Oy ).c_str(),
FormatBIU( m_arrowG1Fx ).c_str(),
FormatBIU( m_arrowG1Fy ).c_str() );
FMT_IU( m_arrowG1Ox ).c_str(),
FMT_IU( m_arrowG1Oy ).c_str(),
FMT_IU( m_arrowG1Fx ).c_str(),
FMT_IU( m_arrowG1Fy ).c_str() );
aFormatter->Print( aNestLevel+1, "(arrow2b pts((xy %s %s) (xy %s %s)))\n",
FormatBIU( m_arrowG2Ox ).c_str(),
FormatBIU( m_arrowG2Oy ).c_str(),
FormatBIU( m_arrowG2Fx ).c_str(),
FormatBIU( m_arrowG2Fy ).c_str() );
FMT_IU( m_arrowG2Ox ).c_str(),
FMT_IU( m_arrowG2Oy ).c_str(),
FMT_IU( m_arrowG2Fx ).c_str(),
FMT_IU( m_arrowG2Fy ).c_str() );
aFormatter->Print( aNestLevel, ")\n" );
}
......@@ -554,39 +554,39 @@ void DRAWSEGMENT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aCont
switch( m_Shape )
{
case S_SEGMENT: // Line
aFormatter->Print( 0, "line (pts xy(%s) xy(%s))",
FormatBIU( m_Start ).c_str(),
FormatBIU( m_End ).c_str() );
aFormatter->Print( 0, "line (pts (xy %s) (xy %s))",
FMT_IU( m_Start ).c_str(),
FMT_IU( m_End ).c_str() );
break;
case S_CIRCLE: // Circle
aFormatter->Print( 0, "circle (center (xy %s)) (end (xy %s))",
FormatBIU( m_Start ).c_str(),
FormatBIU( m_End ).c_str() );
FMT_IU( m_Start ).c_str(),
FMT_IU( m_End ).c_str() );
break;
case S_ARC: // Arc
aFormatter->Print( 0, "arc (start (xy %s)) (end (xy %s)) (angle %0.1f)",
FormatBIU( m_Start ).c_str(),
FormatBIU( m_End ).c_str(),
m_Angle );
aFormatter->Print( 0, "arc (start (xy %s)) (end (xy %s)) (angle %s)",
FMT_IU( m_Start ).c_str(),
FMT_IU( m_End ).c_str(),
FMT_ANGLE( m_Angle ).c_str() );
break;
case S_POLYGON: // Polygon
aFormatter->Print( 0, "line (pts" );
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, ")" );
break;
case S_CURVE: // Bezier curve
aFormatter->Print( 0, "curve pts(xy(%s) xy(%s) xy(%s) xy(%s))",
FormatBIU( m_Start ).c_str(),
FormatBIU( m_BezierC1 ).c_str(),
FormatBIU( m_BezierC2 ).c_str(),
FormatBIU( m_End ).c_str() );
FMT_IU( m_Start ).c_str(),
FMT_IU( m_BezierC1 ).c_str(),
FMT_IU( m_BezierC2 ).c_str(),
FMT_IU( m_End ).c_str() );
break;
default:
......@@ -596,7 +596,7 @@ void DRAWSEGMENT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aCont
aFormatter->Print( 0, " (layer %d)", GetLayer() );
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() )
aFormatter->Print( 0, " (tstamp %lX)", GetTimeStamp() );
......
......@@ -283,7 +283,7 @@ void EDGE_MODULE::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aCont
throw( IO_ERROR )
{
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 );
aFormatter->Print( aNestLevel, ")\n" );
}
......
......@@ -230,11 +230,11 @@ void PCB_TARGET::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aContr
{
aFormatter->Print( aNestLevel, "(target %c (pos (xy %s)) (size %s)",
( m_Shape ) ? 'x' : '+',
FormatBIU( m_Pos ).c_str(),
FormatBIU( m_Size ).c_str() );
FMT_IU( m_Pos ).c_str(),
FMT_IU( m_Size ).c_str() );
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() );
......
......@@ -677,10 +677,10 @@ void MODULE::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBi
aFormatter->Print( 0, " (tedit %lX) (tstamp %lX)\n",
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 )
aFormatter->Print( 0, " %0.1f", m_Orient );
aFormatter->Print( 0, " %s", FMT_ANGLE( m_Orient ).c_str() );
aFormatter->Print( 0, ")\n" );
......@@ -701,11 +701,11 @@ void MODULE::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBi
if( m_LocalSolderMaskMargin != 0 )
aFormatter->Print( aNestLevel+1, "(solder_mask_margin %s)\n",
FormatBIU( m_LocalSolderMaskMargin ).c_str() );
FMT_IU( m_LocalSolderMaskMargin ).c_str() );
if( m_LocalSolderPasteMargin != 0 )
aFormatter->Print( aNestLevel+1, "(solder_paste_margin %s)\n",
FormatBIU( m_LocalSolderPasteMargin ).c_str() );
FMT_IU( m_LocalSolderPasteMargin ).c_str() );
if( m_LocalSolderPasteMarginRatio != 0 )
aFormatter->Print( aNestLevel+1, "(solder_paste_ratio %g)\n",
......@@ -713,18 +713,18 @@ void MODULE::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBi
if( m_LocalClearance != 0 )
aFormatter->Print( aNestLevel+1, "(clearance %s)\n",
FormatBIU( m_LocalClearance ).c_str() );
FMT_IU( m_LocalClearance ).c_str() );
if( m_ZoneConnection != UNDEFINED_CONNECTION )
aFormatter->Print( aNestLevel+1, "(zone_connect %d)\n", m_ZoneConnection );
if( m_ThermalWidth != 0 )
aFormatter->Print( aNestLevel+1, "(thermal_width %s)\n",
FormatBIU( m_ThermalWidth ).c_str() );
FMT_IU( m_ThermalWidth ).c_str() );
if( m_ThermalGap != 0 )
aFormatter->Print( aNestLevel+1, "(thermal_gap %s)\n",
FormatBIU( m_ThermalGap ).c_str() );
FMT_IU( m_ThermalGap ).c_str() );
// Attributes
if( m_Attributs != MOD_DEFAULT )
......
......@@ -328,14 +328,14 @@ void NETCLASS::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControl
aFormatter->Quotew( GetName() ).c_str(),
aFormatter->Quotew( GetDescription() ).c_str() );
aFormatter->Print( aNestLevel+1, "(clearance %s)\n", FormatBIU( GetClearance() ).c_str() );
aFormatter->Print( aNestLevel+1, "(trace_width %s)\n", FormatBIU( GetTrackWidth() ).c_str() );
aFormatter->Print( aNestLevel+1, "(clearance %s)\n", FMT_IU( GetClearance() ).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_drill %s)\n", FormatBIU( GetViaDrill() ).c_str() );
aFormatter->Print( aNestLevel+1, "(via_dia %s)\n", FMT_IU( GetViaDiameter() ).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_drill %s)\n", FormatBIU( GetuViaDrill() ).c_str() );
aFormatter->Print( aNestLevel+1, "(uvia_dia %s)\n", FMT_IU( GetuViaDiameter() ).c_str() );
aFormatter->Print( aNestLevel+1, "(uvia_drill %s)\n", FMT_IU( GetuViaDrill() ).c_str() );
for( NETCLASS::const_iterator it = begin(); it!= end(); ++it )
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
aFormatter->Print( aNestLevel, "(pad %s %s %s (size %s)\n",
aFormatter->Quotew( GetPadName() ).c_str(), type.c_str(), shape.c_str(),
FormatBIU( m_Size ).c_str() );
aFormatter->Print( aNestLevel+1, "(at %s", FormatBIU( m_Pos0 ).c_str() );
FMT_IU( m_Size ).c_str() );
aFormatter->Print( aNestLevel+1, "(at %s", FMT_IU( m_Pos0 ).c_str() );
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" );
if( (m_Drill.GetWidth() > 0) || (m_Drill.GetHeight() > 0) )
{
std::string drill = (m_Drill.GetHeight() > 0) ? FormatBIU( m_Drill ).c_str() :
FormatBIU( m_Drill.GetWidth() ).c_str();
std::string drill = (m_Drill.GetHeight() > 0) ? FMT_IU( m_Drill ).c_str() :
FMT_IU( m_Drill.GetWidth() ).c_str();
aFormatter->Print( aNestLevel+1, "(drill %s", drill.c_str() );
if( (m_Offset.x > 0) || (m_Offset.y > 0) )
{
std::string drillOffset = ( m_Offset.x > 0 ) ?
FormatBIU( m_Offset ).c_str() :
FormatBIU( m_Offset.x ).c_str();
FMT_IU( m_Offset ).c_str() :
FMT_IU( m_Offset.x ).c_str();
aFormatter->Print( 0, " (offset %s)", drillOffset.c_str() );
}
......@@ -891,15 +891,15 @@ void D_PAD::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBit
GetNet(), aFormatter->Quotew( m_Netname ).c_str() );
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 )
aFormatter->Print( aNestLevel+1, "(solder_mask_margin %s)\n",
FormatBIU( m_LocalSolderMaskMargin ).c_str() );
FMT_IU( m_LocalSolderMaskMargin ).c_str() );
if( m_LocalSolderPasteMargin != 0 )
aFormatter->Print( aNestLevel+1, "(solder_paste_margin %s)\n",
FormatBIU( m_LocalSolderPasteMargin ).c_str() );
FMT_IU( m_LocalSolderPasteMargin ).c_str() );
if( m_LocalSolderPasteMarginRatio != 0 )
aFormatter->Print( aNestLevel+1, "(solder_paste_margin_ratio %g)\n",
......@@ -907,18 +907,18 @@ void D_PAD::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBit
if( m_LocalClearance != 0 )
aFormatter->Print( aNestLevel+1, "(clearance %s)\n",
FormatBIU( m_LocalClearance ).c_str() );
FMT_IU( m_LocalClearance ).c_str() );
if( GetZoneConnection() != UNDEFINED_CONNECTION )
aFormatter->Print( aNestLevel+1, "(zone_connect %d)\n", GetZoneConnection() );
if( GetThermalWidth() != 0 )
aFormatter->Print( aNestLevel+1, "(thermal_width %s)\n",
FormatBIU( GetThermalWidth() ).c_str() );
FMT_IU( GetThermalWidth() ).c_str() );
if( GetThermalGap() != 0 )
aFormatter->Print( aNestLevel+1, "(thermal_gap %s)\n",
FormatBIU( GetThermalGap() ).c_str() );
FMT_IU( GetThermalGap() ).c_str() );
aFormatter->Print( aNestLevel, ")\n" );
}
......
......@@ -30,6 +30,7 @@
#ifndef CLASS_PCB_TEXT_H
#define CLASS_PCB_TEXT_H
#include <eda_text.h>
#include <class_board_item.h>
#include <PolyLine.h>
......
......@@ -492,7 +492,7 @@ void TEXTE_MODULE::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aCon
orient += parent->GetOrientation();
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 );
......
......@@ -32,6 +32,7 @@
#define TEXT_MODULE_H_
#include <eda_text.h>
#include <class_board_item.h>
......
......@@ -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(),
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 )
aFormatter->Print( 0, " (drill %s)", FormatBIU( m_Drill ).c_str() );
aFormatter->Print( 0, " (drill %s)", FMT_IU( m_Drill ).c_str() );
}
else
{
aFormatter->Print( aNestLevel, "(segment (start %s) (end %s) (width %s)",
FormatBIU( m_Start ).c_str(), FormatBIU( m_End ).c_str(),
FormatBIU( m_Width ).c_str() );
FMT_IU( m_Start ).c_str(), FMT_IU( m_End ).c_str(),
FMT_IU( m_Width ).c_str() );
}
aFormatter->Print( 0, " (layer %d) (net %d)", GetLayer(), GetNet() );
......
......@@ -993,18 +993,18 @@ void ZONE_CONTAINER::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aC
}
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",
FormatBIU( m_ZoneMinThickness ).c_str() );
FMT_IU( m_ZoneMinThickness ).c_str() );
aFormatter->Print( aNestLevel+1,
"(fill %s (mode %s) (arc_segments %d) (thermal_gap %s) (thermal_bridge_width %s)\n",
(m_IsFilled) ? "yes" : "no",
(m_FillMode) ? "segment" : "polygon",
m_ArcToSegmentsCount,
FormatBIU( m_ThermalReliefGap ).c_str(),
FormatBIU( m_ThermalReliefCopperBridge ).c_str() );
FMT_IU( m_ThermalReliefGap ).c_str(),
FMT_IU( m_ThermalReliefCopperBridge ).c_str() );
std::string smoothing;
......@@ -1019,7 +1019,7 @@ void ZONE_CONTAINER::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aC
}
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;
......@@ -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 )
{
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 )
{
......@@ -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 )
{
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 )
{
......@@ -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 )
{
aFormatter->Print( aNestLevel+2, "(pts (xy %s) (xy %s))\n",
FormatBIU( it->m_Start ).c_str(),
FormatBIU( it->m_End ).c_str() );
FMT_IU( it->m_Start ).c_str(),
FMT_IU( it->m_End ).c_str() );
}
aFormatter->Print( aNestLevel+1, ")\n" );
......
......@@ -9,6 +9,8 @@
#include <macros.h>
#include <trigo.h>
#include <class_pcb_screen.h>
#include <eda_text.h> // FILLED
#include <pcbnew.h>
#include <class_board_design_settings.h>
#include <layers_id_colors_and_visibility.h>
......
......@@ -25,7 +25,7 @@
#include <wx/wx.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 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