Initial Pcbnew s-expression file format commit.
* Add s-expression Format() function to all objects derived from BOARD_ITEM. * Add s-expression Format() function to base objects as required. * Add functions to convert coordinates from base internal units (nanometers) to millimeter string for writing to s-expression file. * Add temporary dummy conversion functions to prevent link errors until schematic and board object and action code can be separated into DSO/DLL. * Add CMake build option to build Pcbnew with nanometer internal units.
This commit is contained in:
parent
57ede4aff4
commit
d7feb9ab45
|
@ -24,6 +24,8 @@ option(USE_PNG_BITMAPS "use PNG bitmaps instead of XPM (default ON)" ON)
|
|||
|
||||
option(USE_NEW_PCBNEW_LOAD "use new plugin support for legacy file format" OFF)
|
||||
option(USE_NEW_PCBNEW_SAVE "use new plugin support for legacy file format" OFF)
|
||||
option(USE_PCBNEW_NANOMETRES
|
||||
"Use nanometers for Pcbnew internal units instead of deci-mils (default OFF).")
|
||||
|
||||
# Russian GOST patch
|
||||
option(wxUSE_UNICODE "enable/disable building unicode (default OFF)")
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
|
||||
#cmakedefine USE_NEW_PCBNEW_LOAD
|
||||
#cmakedefine USE_NEW_PCBNEW_SAVE
|
||||
|
||||
#cmakedefine USE_PCBNEW_NANAMETERS
|
||||
|
||||
/// The file format revision of the *.brd file created by this build
|
||||
#if defined(KICAD_NANOMETRE)
|
||||
|
|
|
@ -426,3 +426,17 @@ 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 "";
|
||||
}
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include <trigo.h>
|
||||
#include <common.h>
|
||||
#include <macros.h>
|
||||
#include <kicad_string.h>
|
||||
#include <wxstruct.h>
|
||||
#include <class_drawpanel.h>
|
||||
#include <class_base_screen.h>
|
||||
|
@ -223,6 +224,14 @@ EDA_ITEM& EDA_ITEM::operator=( const EDA_ITEM& aItem )
|
|||
}
|
||||
|
||||
|
||||
void EDA_ITEM::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
wxFAIL_MSG( wxString::Format( wxT( "Format method not defined for item type %s." ),
|
||||
GetChars( GetClass() ) ) );
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
// A function that should have been in wxWidgets
|
||||
|
@ -546,6 +555,85 @@ wxString EDA_TEXT::GetTextStyleName()
|
|||
}
|
||||
|
||||
|
||||
bool EDA_TEXT::IsDefaultFormatting() const
|
||||
{
|
||||
return ( ( m_Size.x == DEFAULT_SIZE_TEXT )
|
||||
&& ( m_Size.y == DEFAULT_SIZE_TEXT )
|
||||
&& ( m_Attributs == 0 )
|
||||
&& ( m_Mirror == false )
|
||||
&& ( m_HJustify == GR_TEXT_HJUSTIFY_CENTER )
|
||||
&& ( m_VJustify == GR_TEXT_VJUSTIFY_CENTER )
|
||||
&& ( m_Thickness == 0 )
|
||||
&& ( m_Italic == false )
|
||||
&& ( m_Bold == false )
|
||||
&& ( m_MultilineAllowed == false ) );
|
||||
}
|
||||
|
||||
|
||||
void EDA_TEXT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
aFormatter->Print( aNestLevel, "(text %s (at %s",
|
||||
EscapedUTF8( m_Text ).c_str(), FormatBIU( m_Pos ).c_str() );
|
||||
|
||||
if( m_Orient != 0.0 )
|
||||
aFormatter->Print( aNestLevel, "%0.1f", m_Orient );
|
||||
|
||||
aFormatter->Print( aNestLevel, ")\n" );
|
||||
|
||||
if( !IsDefaultFormatting() )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+1, "(effects\n" );
|
||||
|
||||
if( ( m_Size.x != DEFAULT_SIZE_TEXT ) || ( m_Size.y != DEFAULT_SIZE_TEXT ) || m_Bold
|
||||
|| m_Italic )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+2, "(font" );
|
||||
|
||||
// Add font support here at some point in the future.
|
||||
|
||||
if( ( m_Size.x != DEFAULT_SIZE_TEXT ) || ( m_Size.y != DEFAULT_SIZE_TEXT ) )
|
||||
aFormatter->Print( aNestLevel+2, " (size %s)", FormatBIU( m_Size ).c_str() );
|
||||
|
||||
if( m_Bold )
|
||||
aFormatter->Print( aNestLevel+2, " bold" );
|
||||
|
||||
if( m_Bold )
|
||||
aFormatter->Print( aNestLevel+2, " italic" );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, ")\n");
|
||||
}
|
||||
|
||||
if( m_Mirror || ( m_HJustify != GR_TEXT_HJUSTIFY_CENTER )
|
||||
|| ( m_VJustify != GR_TEXT_VJUSTIFY_CENTER ) )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+2, "(justify");
|
||||
|
||||
if( m_HJustify != GR_TEXT_HJUSTIFY_CENTER )
|
||||
aFormatter->Print( aNestLevel+2,
|
||||
(m_HJustify == GR_TEXT_HJUSTIFY_LEFT) ? " left" : " right" );
|
||||
|
||||
if( m_VJustify != GR_TEXT_VJUSTIFY_CENTER )
|
||||
aFormatter->Print( aNestLevel+2,
|
||||
(m_VJustify == GR_TEXT_VJUSTIFY_TOP) ? " top" : " bottom" );
|
||||
|
||||
if( m_Mirror )
|
||||
aFormatter->Print( aNestLevel+2, " mirror" );
|
||||
|
||||
aFormatter->Print( aNestLevel+2, ")\n" );
|
||||
}
|
||||
|
||||
// As of now the only place this is used is in Eeschema to hide or show the text.
|
||||
if( m_Attributs )
|
||||
aFormatter->Print( aNestLevel+2, "hide" );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "\n)\n" );
|
||||
}
|
||||
|
||||
aFormatter->Print( aNestLevel, ")\n" );
|
||||
}
|
||||
|
||||
|
||||
/******************/
|
||||
/* Class EDA_RECT */
|
||||
/******************/
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
|
||||
|
||||
#include <common.h>
|
||||
#include <macros.h>
|
||||
|
||||
|
||||
// late arriving wxPAPER_A0, wxPAPER_A1
|
||||
#if wxABI_VERSION >= 20999
|
||||
|
@ -309,3 +311,22 @@ void PAGE_INFO::SetHeightMils( int aHeightInMils )
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void PAGE_INFO::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
// 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() ) );
|
||||
|
||||
// The page dimensions are only required for user defined page sizes.
|
||||
if( GetType() == PAGE_INFO::Custom )
|
||||
aFormatter->Print( aNestLevel, " %d %d", GetWidthMils(), GetHeightMils() );
|
||||
|
||||
if( IsCustom() && IsPortrait() )
|
||||
aFormatter->Print( aNestLevel, " portrait" );
|
||||
|
||||
aFormatter->Print( aNestLevel, ")\n" );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -560,3 +560,15 @@ 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() );
|
||||
}
|
||||
|
|
|
@ -12,6 +12,7 @@
|
|||
#include <confirm.h>
|
||||
#include <wxstruct.h>
|
||||
#include <appl_wxstruct.h>
|
||||
#include <kicad_string.h>
|
||||
#include <worksheet.h>
|
||||
#include <class_title_block.h>
|
||||
|
||||
|
@ -1372,7 +1373,7 @@ void EDA_DRAW_FRAME::TraceWorkSheet( wxDC* aDC, wxSize& aSz, wxPoint& aLT, wxPoi
|
|||
{
|
||||
if( jj < 26 )
|
||||
Line.Printf( wxT( "%c" ), jj + 'A' );
|
||||
else // I hope 52 identifiers are enought...
|
||||
else // I hope 52 identifiers are enough...
|
||||
Line.Printf( wxT( "%c" ), 'a' + jj - 26 );
|
||||
|
||||
if( ii < yg - PAS_REF / 2 )
|
||||
|
@ -1626,7 +1627,7 @@ const wxString EDA_DRAW_FRAME::GetXYSheetReferences( const wxPoint& aPosition )
|
|||
yg = pageInfo.GetSizeMils().y - pageInfo.GetBottomMarginMils();
|
||||
|
||||
// Get the Y axis identifier (A symbol A ... Z)
|
||||
if( aPosition.y < refy || aPosition.y > yg ) // Ouside of Y limits
|
||||
if( aPosition.y < refy || aPosition.y > yg ) // Outside of Y limits
|
||||
msg << wxT( "?" );
|
||||
else
|
||||
{
|
||||
|
@ -1637,7 +1638,7 @@ const wxString EDA_DRAW_FRAME::GetXYSheetReferences( const wxPoint& aPosition )
|
|||
}
|
||||
|
||||
// Get the X axis identifier (A number 1 ... n)
|
||||
if( aPosition.x < refx || aPosition.x > xg ) // Ouside of X limits
|
||||
if( aPosition.x < refx || aPosition.x > xg ) // Outside of X limits
|
||||
msg << wxT( "?" );
|
||||
else
|
||||
{
|
||||
|
@ -1660,3 +1661,42 @@ wxString EDA_DRAW_FRAME::GetScreenDesc()
|
|||
<< GetScreen()->m_NumberOfScreen;
|
||||
return msg;
|
||||
}
|
||||
|
||||
|
||||
void TITLE_BLOCK::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
// Don't write the title block information if there is nothing to write.
|
||||
if( !m_title.IsEmpty() || !m_date.IsEmpty() || !m_revision.IsEmpty()
|
||||
|| !m_company.IsEmpty() || !m_comment1.IsEmpty() || !m_comment2.IsEmpty()
|
||||
|| !m_comment3.IsEmpty() || !m_comment4.IsEmpty() )
|
||||
{
|
||||
aFormatter->Print( aNestLevel, "(title-block\n" );
|
||||
|
||||
if( !m_title.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "\n(title %s)", EscapedUTF8( m_title ).c_str() );
|
||||
|
||||
if( !m_date.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "\n(date %s)", EscapedUTF8( m_date ).c_str() );
|
||||
|
||||
if( !m_revision.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "\n(rev %s)", EscapedUTF8( m_revision ).c_str() );
|
||||
|
||||
if( !m_company.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "\n(company %s)", EscapedUTF8( m_company ).c_str() );
|
||||
|
||||
if( !m_comment1.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "\n(comment1 %s)", EscapedUTF8( m_comment1 ).c_str() );
|
||||
|
||||
if( !m_comment2.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "\n(comment2 %s)", EscapedUTF8( m_comment2 ).c_str() );
|
||||
|
||||
if( !m_comment3.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "\n(comment3 %s)", EscapedUTF8( m_comment3 ).c_str() );
|
||||
|
||||
if( !m_comment4.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "\n(comment4 %s)", EscapedUTF8( m_comment4 ).c_str() );
|
||||
|
||||
aFormatter->Print( aNestLevel, "\n)\n" );
|
||||
}
|
||||
}
|
||||
|
|
|
@ -84,7 +84,7 @@ class LIB_ITEM : public EDA_ITEM
|
|||
* @param aColor An #EDA_COLOR_T to draw the object or -1 to draw the object in it's
|
||||
* default color.
|
||||
* @param aDrawMode The mode used to perform the draw (#GR_OR, #GR_COPY, etc.).
|
||||
* @param aDate A pointer to any object specific data required to perform the draw.
|
||||
* @param aData A pointer to any object specific data required to perform the draw.
|
||||
* @param aTransform A reference to a #TRANSFORM object containing drawing transform.
|
||||
*/
|
||||
virtual void drawGraphic( EDA_DRAW_PANEL* aPanel, wxDC* aDC,
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <gr_basic.h>
|
||||
#include <common.h>
|
||||
#include <kicad_string.h>
|
||||
#include <eeschema_id.h>
|
||||
#include <appl_wxstruct.h>
|
||||
|
@ -1497,3 +1498,20 @@ 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 );
|
||||
}
|
||||
|
|
|
@ -33,6 +33,7 @@
|
|||
|
||||
#include <colors.h>
|
||||
#include <bitmaps.h>
|
||||
#include <richio.h>
|
||||
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
|
||||
|
@ -712,6 +713,18 @@ public:
|
|||
*/
|
||||
virtual EDA_ITEM& operator=( const EDA_ITEM& aItem );
|
||||
|
||||
/**
|
||||
* Function Format
|
||||
* outputs the object to \a aFormatter in s-expression form.
|
||||
*
|
||||
* @param aFormatter The #OUTPUTFORMATTER object to write to.
|
||||
* @param aNestLevel The indentation next level.
|
||||
* @param aControlBits The control bit definition for object specific formatting.
|
||||
* @throw IO_ERROR on write error.
|
||||
*/
|
||||
virtual void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR );
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
/**
|
||||
|
@ -812,7 +825,7 @@ public:
|
|||
double m_Orient; ///< Orient in 0.1 degrees
|
||||
wxPoint m_Pos; ///< XY position of anchor text.
|
||||
wxSize m_Size; ///< XY size of text
|
||||
bool m_Mirror; ///< true iff mirrored
|
||||
bool m_Mirror; ///< true if mirrored
|
||||
int m_Attributs; ///< bit flags such as visible, etc.
|
||||
bool m_Italic; ///< should be italic font (if available)
|
||||
bool m_Bold; ///< should be bold font (if available)
|
||||
|
@ -852,6 +865,8 @@ public:
|
|||
void SetMirrored( bool isMirrored ) { m_Mirror = isMirrored; }
|
||||
bool IsMirrored() const { return m_Mirror; }
|
||||
|
||||
bool IsDefaultFormatting() const;
|
||||
|
||||
/**
|
||||
* Function SetSize
|
||||
* sets text size.
|
||||
|
@ -989,6 +1004,19 @@ public:
|
|||
EDA_TEXT_VJUSTIFY_T GetVertJustify() const { return m_VJustify; };
|
||||
void SetHorizJustify( EDA_TEXT_HJUSTIFY_T aType ) { m_HJustify = aType; };
|
||||
void SetVertJustify( EDA_TEXT_VJUSTIFY_T aType ) { m_VJustify = aType; };
|
||||
|
||||
/**
|
||||
* Function Format
|
||||
* outputs the object to \a aFormatter in s-expression form.
|
||||
*
|
||||
* @param aFormatter The #OUTPUTFORMATTER object to write to.
|
||||
* @param aNestLevel The indentation next level.
|
||||
* @param aControlBits The control bit definition for object specific formatting.
|
||||
* @throw IO_ERROR on write error.
|
||||
*/
|
||||
virtual void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR );
|
||||
|
||||
};
|
||||
|
||||
#endif // BASE_STRUCT_H_
|
||||
|
|
|
@ -26,6 +26,10 @@
|
|||
#include <wx/string.h>
|
||||
|
||||
|
||||
class OUTPUTFORMATTER;
|
||||
class IO_ERROR;
|
||||
|
||||
|
||||
extern wxString GenDate();
|
||||
|
||||
|
||||
|
@ -81,6 +85,18 @@ public:
|
|||
m_comment4.clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function Format
|
||||
* outputs the object to \a aFormatter in s-expression form.
|
||||
*
|
||||
* @param aFormatter The #OUTPUTFORMATTER object to write to.
|
||||
* @param aNestLevel The indentation next level.
|
||||
* @param aControlBits The control bit definition for object specific formatting.
|
||||
* @throw IO_ERROR on write error.
|
||||
*/
|
||||
virtual void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR );
|
||||
|
||||
private:
|
||||
wxString m_title;
|
||||
wxString m_date;
|
||||
|
|
|
@ -38,6 +38,7 @@
|
|||
#include <wx/confbase.h>
|
||||
#include <wx/fileconf.h>
|
||||
|
||||
#include <richio.h>
|
||||
|
||||
#if !wxUSE_PRINTING_ARCHITECTURE
|
||||
# error "You must use '--enable-printarch' in your wx library configuration."
|
||||
|
@ -134,6 +135,24 @@ 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;
|
||||
|
||||
|
@ -185,12 +204,19 @@ public:
|
|||
* and will be set according to <b>previous</b> calls to
|
||||
* static PAGE_INFO::SetUserWidthMils() and
|
||||
* static PAGE_INFO::SetUserHeightMils();
|
||||
* @param IsPortrait Set to true to set page orientation to portrait mode.
|
||||
*
|
||||
* @return bool - true iff @a aStandarePageDescription was a recognized type.
|
||||
* @return bool - true if @a aStandarePageDescription was a recognized type.
|
||||
*/
|
||||
bool SetType( const wxString& aStandardPageDescriptionName, bool IsPortrait = false );
|
||||
const wxString& GetType() const { return m_type; }
|
||||
|
||||
/**
|
||||
* Function IsDefault
|
||||
* @return True if the object has the default page settings which are A3, landscape.
|
||||
*/
|
||||
bool IsDefault() const { return m_type == PAGE_INFO::A3 && !m_portrait; }
|
||||
|
||||
/**
|
||||
* Function IsCustom
|
||||
* returns true if the type is Custom
|
||||
|
@ -327,6 +353,18 @@ public:
|
|||
static wxArrayString GetStandardSizes();
|
||||
*/
|
||||
|
||||
/**
|
||||
* Function Format
|
||||
* outputs the page class to \a aFormatter in s-expression form.
|
||||
*
|
||||
* @param aFormatter The #OUTPUTFORMATTER object to write to.
|
||||
* @param aNestLevel The indentation next level.
|
||||
* @param aControlBits The control bit definition for object specific formatting.
|
||||
* @throw IO_ERROR on write error.
|
||||
*/
|
||||
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR );
|
||||
|
||||
protected:
|
||||
// only the class implementation(s) may use this constructor
|
||||
PAGE_INFO( const wxSize& aSizeMils, const wxString& aName, wxPaperSize aPaperId );
|
||||
|
@ -612,7 +650,7 @@ int From_User_Unit( EDA_UNITS_T aUnit, double val, int internal_unit_value );
|
|||
|
||||
/**
|
||||
* Function GenDate
|
||||
* @return A wsString object containg the date in the format "day month year" like
|
||||
* @return A wxString object containing the date in the format "day month year" like
|
||||
* "23 jun 2005".
|
||||
*/
|
||||
wxString GenDate();
|
||||
|
|
|
@ -298,3 +298,16 @@ 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 "";
|
||||
}
|
||||
|
|
|
@ -243,3 +243,15 @@ void PCB_CALCULATOR_FRAME::OnPaintTranslinePanel( wxPaintEvent& event )
|
|||
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @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 "";
|
||||
}
|
||||
|
|
|
@ -8,6 +8,7 @@
|
|||
|
||||
#include <fctsys.h>
|
||||
#include <common.h>
|
||||
#include <kicad_string.h>
|
||||
#include <pcbcommon.h>
|
||||
#include <wxBasePcbFrame.h>
|
||||
|
||||
|
@ -207,14 +208,14 @@ void BOARD::chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS*
|
|||
|
||||
void BOARD::PushHighLight()
|
||||
{
|
||||
m_hightLightPrevious = m_hightLight;
|
||||
m_highLightPrevious = m_highLight;
|
||||
}
|
||||
|
||||
|
||||
void BOARD::PopHighLight()
|
||||
{
|
||||
m_hightLight = m_hightLightPrevious;
|
||||
m_hightLightPrevious.Clear();
|
||||
m_highLight = m_highLightPrevious;
|
||||
m_highLightPrevious.Clear();
|
||||
}
|
||||
|
||||
|
||||
|
@ -1065,7 +1066,7 @@ SEARCH_RESULT BOARD::Visit( INSPECTOR* inspector, const void* testData,
|
|||
// So usually, connected tracks or vias are grouped in this list
|
||||
// So the algorithm (used in ratsnest computations) which computes the
|
||||
// track connectivity is faster (more than 100 time regarding to
|
||||
// a non ordered list) because when it searches for a connexion, first
|
||||
// a non ordered list) because when it searches for a connection, first
|
||||
// it tests the near (near in term of linked list) 50 items
|
||||
// from the current item (track or via) in test.
|
||||
// Usually, because of this sort, a connected item (if exists) is
|
||||
|
@ -2148,6 +2149,195 @@ TRACK* BOARD::CreateLockPoint( wxPoint& aPosition, TRACK* aSegment, PICKED_ITEMS
|
|||
}
|
||||
|
||||
|
||||
void BOARD::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
aFormatter->Print( aNestLevel, "(general\n" );
|
||||
aFormatter->Print( aNestLevel+1, "(links %d)\n", GetRatsnestsCount() );
|
||||
aFormatter->Print( aNestLevel+1, "(no-connects %d)\n", m_NbNoconnect );
|
||||
|
||||
// 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() );
|
||||
aFormatter->Print( aNestLevel+1, "(thickness %s)\n",
|
||||
FormatBIU( GetDesignSettings().m_BoardThickness ).c_str() );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "(drawings %d)\n", m_Drawings.GetCount() );
|
||||
aFormatter->Print( aNestLevel+1, "(tracks %d)\n", GetNumSegmTrack() );
|
||||
aFormatter->Print( aNestLevel+1, "(zones %d)\n", GetNumSegmZone() );
|
||||
aFormatter->Print( aNestLevel+1, "(modules %d)\n", m_Modules.GetCount() );
|
||||
aFormatter->Print( aNestLevel+1, "(nets %d)\n", GetNetCount() );
|
||||
aFormatter->Print( aNestLevel, ")\n\n" );
|
||||
|
||||
m_paper.Format( aFormatter, aNestLevel, aControlBits );
|
||||
m_titles.Format( aFormatter, aNestLevel, aControlBits );
|
||||
|
||||
// Layers.
|
||||
aFormatter->Print( aNestLevel, "(layers %d %08X", GetCopperLayerCount(), GetEnabledLayers() );
|
||||
|
||||
if( GetEnabledLayers() != GetVisibleLayers() )
|
||||
aFormatter->Print( aNestLevel+1, " %08X", GetVisibleLayers() );
|
||||
|
||||
unsigned layerMask = ALL_CU_LAYERS & GetEnabledLayers();
|
||||
|
||||
for( int layer = 0; layerMask; ++layer, layerMask >>= 1 )
|
||||
{
|
||||
if( layerMask & 1 )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+1, "(layer%d %s %s\n", layer,
|
||||
TO_UTF8( GetLayerName( layer ) ),
|
||||
LAYER::ShowType( GetLayerType( layer ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
aFormatter->Print( aNestLevel, ")\n\n" );
|
||||
|
||||
// Setup
|
||||
aFormatter->Print( aNestLevel, "(setup\n" );
|
||||
|
||||
// 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() );
|
||||
|
||||
// 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() );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "(trace-clearance %s)\n)",
|
||||
FormatBIU( m_NetClasses.GetDefault()->GetClearance() ).c_str() );
|
||||
|
||||
// ZONE_SETTINGS
|
||||
aFormatter->Print( aNestLevel+1, "(zone-clearance %s)\n",
|
||||
FormatBIU( 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() );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "(segment-width %s)\n",
|
||||
FormatBIU( GetDesignSettings().m_DrawSegmentWidth ).c_str() );
|
||||
aFormatter->Print( aNestLevel+1, "(edge-width %s)\n",
|
||||
FormatBIU( 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() );
|
||||
aFormatter->Print( aNestLevel+1, "(via-drill %s)\n",
|
||||
FormatBIU( m_NetClasses.GetDefault()->GetViaDrill() ).c_str() );
|
||||
aFormatter->Print( aNestLevel+1, "(via-min-size %s)\n",
|
||||
FormatBIU( GetDesignSettings().m_ViasMinSize ).c_str() );
|
||||
aFormatter->Print( aNestLevel+1, "(via_min_drill %s)\n",
|
||||
FormatBIU( 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() );
|
||||
|
||||
// for old versions compatibility:
|
||||
aFormatter->Print( aNestLevel+1, "(uvia-size %s)\n",
|
||||
FormatBIU( m_NetClasses.GetDefault()->GetuViaDiameter() ).c_str() );
|
||||
aFormatter->Print( aNestLevel+1, "(uvia-drill %s)\n",
|
||||
FormatBIU( m_NetClasses.GetDefault()->GetuViaDrill() ).c_str() );
|
||||
aFormatter->Print( aNestLevel+1, "(uvias_allow %s)\n",
|
||||
FormatBIU( GetDesignSettings().m_MicroViasAllowed ).c_str() );
|
||||
aFormatter->Print( aNestLevel+1, "(uvia-min-size %s)\n",
|
||||
FormatBIU( GetDesignSettings().m_MicroViasMinSize ).c_str() );
|
||||
aFormatter->Print( aNestLevel+1, "(uvia-min-drill %s)\n",
|
||||
FormatBIU( GetDesignSettings().m_MicroViasMinDrill ).c_str() );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "(pcb-text-width %s)\n",
|
||||
FormatBIU( 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() );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "(mod-edge-width %s)\n",
|
||||
FormatBIU( 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() );
|
||||
aFormatter->Print( aNestLevel+1, "(mod-text-width %s)\n",
|
||||
FormatBIU( 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() );
|
||||
aFormatter->Print( aNestLevel+1, "(pad-drill %s)\n",
|
||||
FormatBIU( GetDesignSettings().m_Pad_Master.GetDrillSize().x ).c_str() );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "(pad-to-mask-clearance %s)\n",
|
||||
FormatBIU( 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() );
|
||||
|
||||
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() );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "(visible-elements %X)\n",
|
||||
GetDesignSettings().GetVisibleElements() );
|
||||
|
||||
aFormatter->Print( aNestLevel, ")\n\n" );
|
||||
|
||||
|
||||
int netcount = GetNetCount();
|
||||
|
||||
for( int i = 0; i < netcount; ++i )
|
||||
aFormatter->Print( aNestLevel, "(net %d %s)\n",
|
||||
FindNet( i )->GetNet(),
|
||||
EscapedUTF8( FindNet( i )->GetNetname() ).c_str() );
|
||||
|
||||
// Save the default net class first.
|
||||
m_NetClasses.GetDefault()->Format( aFormatter, aNestLevel, aControlBits );
|
||||
|
||||
// Save the rest of the net classes alphabetically.
|
||||
for( NETCLASSES::const_iterator it = m_NetClasses.begin(); it != m_NetClasses.end(); ++it )
|
||||
{
|
||||
NETCLASS* netclass = it->second;
|
||||
netclass->Format( aFormatter, aNestLevel, aControlBits );
|
||||
}
|
||||
|
||||
// Save the modules.
|
||||
for( MODULE* module = m_Modules; module; module = (MODULE*) module->Next() )
|
||||
module->Format( aFormatter, aNestLevel, aControlBits );
|
||||
|
||||
// Save the graphical items on the board (not owned by a module)
|
||||
for( BOARD_ITEM* item = m_Drawings; item; item = item->Next() )
|
||||
{
|
||||
item->Format( aFormatter, aNestLevel, aControlBits );
|
||||
}
|
||||
|
||||
// Do not save MARKER_PCBs, they can be regenerated easily.
|
||||
|
||||
// Save the tracks and vias.
|
||||
for( TRACK* track = m_Track; track; track = track->Next() )
|
||||
track->Format( aFormatter, aNestLevel, aControlBits );
|
||||
|
||||
// Save the old obsolete zones which were done by segments (tracks).
|
||||
for( SEGZONE* zone = m_Zone; zone; zone = zone->Next() )
|
||||
zone->Format( aFormatter, aNestLevel, aControlBits );
|
||||
|
||||
// Save the polygon (which are the newer technology) zones.
|
||||
for( int i=0; i < GetAreaCount(); ++i )
|
||||
GetArea( i )->Format( aFormatter, aNestLevel, aControlBits );
|
||||
|
||||
aFormatter->Print( aNestLevel, "\n)\n" );
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
void BOARD::Show( int nestLevel, std::ostream& os ) const
|
||||
|
|
|
@ -165,9 +165,9 @@ private:
|
|||
ZONE_CONTAINERS m_ZoneDescriptorList;
|
||||
|
||||
LAYER m_Layer[NB_COPPER_LAYERS];
|
||||
// if true m_hightLight_NetCode is used
|
||||
HIGH_LIGHT_INFO m_hightLight; // current high light data
|
||||
HIGH_LIGHT_INFO m_hightLightPrevious; // a previously stored high light data
|
||||
// if true m_highLight_NetCode is used
|
||||
HIGH_LIGHT_INFO m_highLight; // current high light data
|
||||
HIGH_LIGHT_INFO m_highLightPrevious; // a previously stored high light data
|
||||
|
||||
int m_fileFormatVersionAtLoad; ///< the version in the *.brd header on first line
|
||||
|
||||
|
@ -195,6 +195,9 @@ private:
|
|||
*/
|
||||
void chainMarkedSegments( wxPoint aPosition, int aLayerMask, TRACK_PTRS* aList );
|
||||
|
||||
void formatNetClass( NETCLASS* aNetClass, OUTPUTFORMATTER* aFormatter, int aNestLevel,
|
||||
int aControlBits ) const
|
||||
throw( IO_ERROR );
|
||||
|
||||
public:
|
||||
|
||||
|
@ -342,15 +345,15 @@ public:
|
|||
*/
|
||||
void ResetHighLight()
|
||||
{
|
||||
m_hightLight.Clear();
|
||||
m_hightLightPrevious.Clear();
|
||||
m_highLight.Clear();
|
||||
m_highLightPrevious.Clear();
|
||||
}
|
||||
|
||||
/**
|
||||
* Function GetHighLightNetCode
|
||||
* @return netcode of net to highlight (-1 when no net selected)
|
||||
*/
|
||||
int GetHighLightNetCode() { return m_hightLight.m_netCode; }
|
||||
int GetHighLightNetCode() { return m_highLight.m_netCode; }
|
||||
|
||||
/**
|
||||
* Function SetHighLightNet
|
||||
|
@ -358,27 +361,27 @@ public:
|
|||
*/
|
||||
void SetHighLightNet( int aNetCode)
|
||||
{
|
||||
m_hightLight.m_netCode = aNetCode;
|
||||
m_highLight.m_netCode = aNetCode;
|
||||
}
|
||||
|
||||
/**
|
||||
* Function IsHighLightNetON
|
||||
* @return true if a net is currently highlighted
|
||||
*/
|
||||
bool IsHighLightNetON() { return m_hightLight.m_highLightOn; }
|
||||
bool IsHighLightNetON() { return m_highLight.m_highLightOn; }
|
||||
|
||||
/**
|
||||
* Function HighLightOFF
|
||||
* Disable highlight.
|
||||
*/
|
||||
void HighLightOFF() { m_hightLight.m_highLightOn = false; }
|
||||
void HighLightOFF() { m_highLight.m_highLightOn = false; }
|
||||
|
||||
/**
|
||||
* Function HighLightON
|
||||
* Enable highlight.
|
||||
* if m_hightLight_NetCode >= 0, this net will be highlighted
|
||||
* if m_highLight_NetCode >= 0, this net will be highlighted
|
||||
*/
|
||||
void HighLightON() { m_hightLight.m_highLightOn = true; }
|
||||
void HighLightON() { m_highLight.m_highLightOn = true; }
|
||||
|
||||
/**
|
||||
* Function PushHighLight
|
||||
|
@ -877,24 +880,16 @@ public:
|
|||
|
||||
/***************************************************************************/
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.brd" format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
bool Save( FILE* aFile ) const;
|
||||
|
||||
/**
|
||||
* Function GetClass
|
||||
* returns the class name.
|
||||
* @return wxString
|
||||
*/
|
||||
wxString GetClass() const
|
||||
{
|
||||
return wxT( "BOARD" );
|
||||
}
|
||||
|
||||
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR );
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const; // overload
|
||||
#endif
|
||||
|
@ -1192,7 +1187,7 @@ public:
|
|||
|
||||
/**
|
||||
* Function GetPadFast
|
||||
* return pad found at \a aPosition on \a aLayer uning the fast search method.
|
||||
* return pad found at \a aPosition on \a aLayer using the fast search method.
|
||||
* <p>
|
||||
* The fast search method only works if the pad list has already been built.
|
||||
* </p>
|
||||
|
@ -1204,7 +1199,7 @@ public:
|
|||
|
||||
/**
|
||||
* Function GetPad
|
||||
* locates the pad connected at \a aPosition on \a aLayer starting at list postion
|
||||
* locates the pad connected at \a aPosition on \a aLayer starting at list position
|
||||
* \a aPad
|
||||
* <p>
|
||||
* This function uses a fast search in this sorted pad list and it is faster than
|
||||
|
|
|
@ -62,3 +62,34 @@ wxString BOARD_ITEM::GetLayerName() const
|
|||
|
||||
return layerName;
|
||||
}
|
||||
|
||||
|
||||
/** @todo Move Pcbnew version of FormatBIU() where ever the common DSO/DSL code ends up. */
|
||||
std::string FormatBIU( int aValue )
|
||||
{
|
||||
#if !defined( USE_PCBNEW_NANOMETERS )
|
||||
wxFAIL_MSG( wxT( "Cannot use FormatBIU() unless Pcbnew is build with PCBNEW_NANOMETERS=ON." ) );
|
||||
#endif
|
||||
|
||||
char buf[50];
|
||||
double engUnits = aValue / 1000000.0;
|
||||
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 );
|
||||
}
|
||||
|
|
|
@ -606,3 +606,58 @@ EDA_ITEM* DIMENSION::Clone() const
|
|||
{
|
||||
return new DIMENSION( *this );
|
||||
}
|
||||
|
||||
|
||||
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+1, "(width %s)\n(layer %d)\n(tstamp %lX)\n",
|
||||
FormatBIU( 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() );
|
||||
|
||||
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() );
|
||||
|
||||
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() );
|
||||
|
||||
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() );
|
||||
|
||||
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() );
|
||||
|
||||
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() );
|
||||
|
||||
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() );
|
||||
|
||||
aFormatter->Print( aNestLevel, ")\n" );
|
||||
}
|
||||
|
|
|
@ -44,7 +44,7 @@ class DIMENSION : public BOARD_ITEM
|
|||
public:
|
||||
int m_Width;
|
||||
wxPoint m_Pos;
|
||||
int m_Shape;
|
||||
int m_Shape; /// Current always 0.
|
||||
int m_Unit; /// 0 = inches, 1 = mm
|
||||
int m_Value; /// value of PCB dimensions.
|
||||
|
||||
|
@ -138,6 +138,9 @@ public:
|
|||
|
||||
EDA_ITEM* Clone() const;
|
||||
|
||||
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR );
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
|
||||
#endif
|
||||
|
|
|
@ -284,7 +284,7 @@ void DRAWSEGMENT::Draw( EDA_DRAW_PANEL* panel, wxDC* DC, int draw_mode, const wx
|
|||
}
|
||||
break;
|
||||
case S_CURVE:
|
||||
m_BezierPoints = Bezier2Poly(m_Start,m_BezierC1, m_BezierC2, m_End);
|
||||
m_BezierPoints = Bezier2Poly(m_Start, m_BezierC1, m_BezierC2, m_End);
|
||||
|
||||
for (unsigned int i=1; i < m_BezierPoints.size(); i++) {
|
||||
if( mode == LINE )
|
||||
|
@ -544,6 +544,70 @@ EDA_ITEM* DRAWSEGMENT::Clone() const
|
|||
}
|
||||
|
||||
|
||||
void DRAWSEGMENT::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
unsigned i;
|
||||
|
||||
aFormatter->Print( aNestLevel, "(draw " );
|
||||
|
||||
switch( m_Shape )
|
||||
{
|
||||
case S_SEGMENT: // Line
|
||||
aFormatter->Print( aNestLevel, "line (pts xy(%s) xy(%s))",
|
||||
FormatBIU( m_Start ).c_str(),
|
||||
FormatBIU( m_End ).c_str() );
|
||||
break;
|
||||
|
||||
case S_CIRCLE: // Circle
|
||||
aFormatter->Print( aNestLevel, "circle (center (xy %s)) (end (xy %s))",
|
||||
FormatBIU( m_Start ).c_str(),
|
||||
FormatBIU( m_End ).c_str() );
|
||||
break;
|
||||
|
||||
case S_ARC: // Arc
|
||||
aFormatter->Print( aNestLevel, "arc (start (xy %s)) (end (xy %s)) (angle %0.1f)",
|
||||
FormatBIU( m_Start ).c_str(),
|
||||
FormatBIU( m_End ).c_str(),
|
||||
m_Angle );
|
||||
break;
|
||||
|
||||
case S_POLYGON: // Polygon
|
||||
aFormatter->Print( aNestLevel, "line (pts" );
|
||||
|
||||
for( i = 0; i<m_PolyPoints.size(); ++i )
|
||||
aFormatter->Print( aNestLevel, " (xy %s)", FormatBIU( m_PolyPoints[i] ).c_str() );
|
||||
|
||||
aFormatter->Print( aNestLevel, ")" );
|
||||
break;
|
||||
|
||||
case S_CURVE: // Bezier curve
|
||||
aFormatter->Print( aNestLevel, "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() );
|
||||
break;
|
||||
|
||||
default:
|
||||
wxFAIL_MSG( wxT( "Cannot format invalid DRAWSEGMENT type." ) );
|
||||
};
|
||||
|
||||
aFormatter->Print( aNestLevel, " (layer %d)", GetLayer() );
|
||||
|
||||
if( m_Width != 0 )
|
||||
aFormatter->Print( aNestLevel, " (width %s)", FormatBIU( m_Width ).c_str() );
|
||||
|
||||
if( GetTimeStamp() )
|
||||
aFormatter->Print( aNestLevel, " (tstamp %lX)", GetTimeStamp() );
|
||||
|
||||
if( GetStatus() )
|
||||
aFormatter->Print( aNestLevel, " (status %X)", GetStatus() );
|
||||
|
||||
aFormatter->Print( aNestLevel, ")\n" );
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
void DRAWSEGMENT::Show( int nestLevel, std::ostream& os ) const
|
||||
{
|
||||
|
|
|
@ -51,7 +51,7 @@ protected:
|
|||
int m_Type; ///< Used in complex associations ( Dimensions.. )
|
||||
double m_Angle; ///< Used only for Arcs: Arc angle in 1/10 deg
|
||||
wxPoint m_BezierC1; ///< Bezier Control Point 1
|
||||
wxPoint m_BezierC2; ///< Bezier Control Point 1
|
||||
wxPoint m_BezierC2; ///< Bezier Control Point 2
|
||||
|
||||
std::vector<wxPoint> m_BezierPoints;
|
||||
std::vector<wxPoint> m_PolyPoints;
|
||||
|
@ -219,6 +219,9 @@ public:
|
|||
|
||||
virtual EDA_ITEM* Clone() const;
|
||||
|
||||
virtual void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR );
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const; // overload
|
||||
#endif
|
||||
|
|
|
@ -279,6 +279,16 @@ EDA_ITEM* EDGE_MODULE::Clone() const
|
|||
}
|
||||
|
||||
|
||||
void EDGE_MODULE::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
aFormatter->Print( aNestLevel, "(edge (start (xy %s)) (end (xy %s))\n",
|
||||
FormatBIU( m_Start0 ).c_str(), FormatBIU( m_End0 ).c_str() );
|
||||
DRAWSEGMENT::Format( aFormatter, aNestLevel+1, aControlBits );
|
||||
aFormatter->Print( aNestLevel, ")\n" );
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
void EDGE_MODULE::Show( int nestLevel, std::ostream& os ) const
|
||||
|
|
|
@ -91,6 +91,9 @@ public:
|
|||
|
||||
EDA_ITEM* Clone() const;
|
||||
|
||||
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR );
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const; // overload
|
||||
#endif
|
||||
|
|
|
@ -223,3 +223,23 @@ EDA_ITEM* PCB_TARGET::Clone() const
|
|||
{
|
||||
return new PCB_TARGET( *this );
|
||||
}
|
||||
|
||||
|
||||
void PCB_TARGET::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
aFormatter->Print( aNestLevel, "(target %c (pos (xy %s)) (size %s)",
|
||||
( m_Shape ) ? 'x' : '+',
|
||||
FormatBIU( m_Pos ).c_str(),
|
||||
FormatBIU( m_Size ).c_str() );
|
||||
|
||||
if( m_Width != 0 )
|
||||
aFormatter->Print( aNestLevel, " (width %s)", FormatBIU( m_Width ).c_str() );
|
||||
|
||||
aFormatter->Print( aNestLevel, " (layer %d)", GetLayer() );
|
||||
|
||||
if( GetTimeStamp() )
|
||||
aFormatter->Print( aNestLevel, " (tstamp %lX)", GetTimeStamp() );
|
||||
|
||||
aFormatter->Print( aNestLevel, ")\n" );
|
||||
}
|
||||
|
|
|
@ -107,6 +107,9 @@ public:
|
|||
|
||||
EDA_ITEM* Clone() const;
|
||||
|
||||
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR );
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
|
||||
#endif
|
||||
|
|
|
@ -663,6 +663,125 @@ EDA_ITEM* MODULE::Clone() const
|
|||
}
|
||||
|
||||
|
||||
void MODULE::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
aFormatter->Print( aNestLevel, "(module %s" , EscapedUTF8( m_LibRef ).c_str() );
|
||||
|
||||
if( IsLocked() )
|
||||
aFormatter->Print( aNestLevel, " locked" );
|
||||
|
||||
if( IsPlaced() )
|
||||
aFormatter->Print( aNestLevel, " placed" );
|
||||
|
||||
aFormatter->Print( aNestLevel, " (tedit %lX) (tstamp %lX)\n",
|
||||
GetLastEditTime(), GetTimeStamp() );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "(at %s", FormatBIU( m_Pos ).c_str() );
|
||||
|
||||
if( m_Orient != 0.0 )
|
||||
aFormatter->Print( aNestLevel+1, " %0.1f", m_Orient );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, ")\n" );
|
||||
|
||||
if( !m_Doc.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "(descr %s)\n", EscapedUTF8( m_Doc ).c_str() );
|
||||
|
||||
if( !m_KeyWord.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "(tags %s)\n", EscapedUTF8( m_KeyWord ).c_str() );
|
||||
|
||||
if( !m_Path.IsEmpty() )
|
||||
aFormatter->Print( aNestLevel+1, "(path %s)\n", EscapedUTF8( m_Path ).c_str() );
|
||||
|
||||
if( m_CntRot90 != 0 )
|
||||
aFormatter->Print( aNestLevel+1, "(autoplace-cost90 %d)\n", m_CntRot90 );
|
||||
|
||||
if( m_CntRot180 != 0 )
|
||||
aFormatter->Print( aNestLevel+1, "(autoplace-cost180 %d)\n", m_CntRot180 );
|
||||
|
||||
if( m_LocalSolderMaskMargin != 0 )
|
||||
aFormatter->Print( aNestLevel+1, "(solder-mask-margin %s)\n",
|
||||
FormatBIU( m_LocalSolderMaskMargin ).c_str() );
|
||||
|
||||
if( m_LocalSolderPasteMargin != 0 )
|
||||
aFormatter->Print( aNestLevel+1, "(solder-paste-margin %s)\n",
|
||||
FormatBIU( m_LocalSolderPasteMargin ).c_str() );
|
||||
|
||||
if( m_LocalSolderPasteMarginRatio != 0 )
|
||||
aFormatter->Print( aNestLevel+1, "(solder-paste-ratio %g)\n",
|
||||
m_LocalSolderPasteMarginRatio );
|
||||
|
||||
if( m_LocalClearance != 0 )
|
||||
aFormatter->Print( aNestLevel+1, "(clearance %s)\n",
|
||||
FormatBIU( 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() );
|
||||
|
||||
if( m_ThermalGap != 0 )
|
||||
aFormatter->Print( aNestLevel+1, "(thermal-gap %s)\n",
|
||||
FormatBIU( m_ThermalGap ).c_str() );
|
||||
|
||||
// Attributes
|
||||
if( m_Attributs != MOD_DEFAULT )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+1, "(attr " );
|
||||
|
||||
if( m_Attributs & MOD_CMS )
|
||||
aFormatter->Print( aNestLevel+1, " smd" );
|
||||
|
||||
if( m_Attributs & MOD_VIRTUAL )
|
||||
aFormatter->Print( aNestLevel+1, " virtual" );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, ")\n" );
|
||||
}
|
||||
|
||||
m_Reference->Format( aFormatter, aNestLevel+1, aControlBits );
|
||||
m_Value->Format( aFormatter, aNestLevel+1, aControlBits );
|
||||
|
||||
// Save drawing elements.
|
||||
for( BOARD_ITEM* gr = m_Drawings; gr; gr = gr->Next() )
|
||||
gr->Format( aFormatter+1, aNestLevel, aControlBits );
|
||||
|
||||
// Save pads.
|
||||
for( D_PAD* pad = m_Pads; pad; pad = pad->Next() )
|
||||
pad->Format( aFormatter+1, aNestLevel, aControlBits );
|
||||
|
||||
// Save 3D info.
|
||||
for( S3D_MASTER* t3D = m_3D_Drawings; t3D; t3D = t3D->Next() )
|
||||
{
|
||||
if( !t3D->m_Shape3DName.IsEmpty() )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+1, "(3d-shape %s\n",
|
||||
EscapedUTF8( t3D->m_Shape3DName ).c_str() );
|
||||
|
||||
aFormatter->Print( aNestLevel+2, "(at (xyz %.16g %.16g %.16g))\n",
|
||||
t3D->m_MatPosition.x,
|
||||
t3D->m_MatPosition.y,
|
||||
t3D->m_MatPosition.z );
|
||||
|
||||
aFormatter->Print( aNestLevel+2, "(scale (xyz %lf %lf %lf))\n",
|
||||
t3D->m_MatScale.x,
|
||||
t3D->m_MatScale.y,
|
||||
t3D->m_MatScale.z );
|
||||
|
||||
aFormatter->Print( aNestLevel+2, "(rotate (xyz %.16g %.16g %.16g))\n",
|
||||
t3D->m_MatRotation.x,
|
||||
t3D->m_MatRotation.y,
|
||||
t3D->m_MatRotation.z );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, ")\n" );
|
||||
}
|
||||
}
|
||||
|
||||
aFormatter->Print( aNestLevel, ")\n" );
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
void MODULE::Show( int nestLevel, std::ostream& os ) const
|
||||
|
|
|
@ -346,6 +346,9 @@ public:
|
|||
|
||||
EDA_ITEM* Clone() const;
|
||||
|
||||
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR );
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const; // overload
|
||||
#endif
|
||||
|
|
|
@ -290,28 +290,55 @@ void NETCLASS::Show( int nestLevel, std::ostream& os ) const
|
|||
|
||||
#endif
|
||||
|
||||
|
||||
int NETCLASS::GetTrackMinWidth() const
|
||||
{
|
||||
return m_Parent->GetDesignSettings().m_TrackMinWidth;
|
||||
}
|
||||
|
||||
|
||||
int NETCLASS::GetViaMinDiameter() const
|
||||
{
|
||||
return m_Parent->GetDesignSettings().m_ViasMinSize;
|
||||
}
|
||||
|
||||
|
||||
int NETCLASS::GetViaMinDrill() const
|
||||
{
|
||||
return m_Parent->GetDesignSettings().m_ViasMinDrill;
|
||||
}
|
||||
|
||||
|
||||
int NETCLASS::GetuViaMinDiameter() const
|
||||
{
|
||||
return m_Parent->GetDesignSettings().m_MicroViasMinSize;
|
||||
}
|
||||
|
||||
|
||||
int NETCLASS::GetuViaMinDrill() const
|
||||
{
|
||||
return m_Parent->GetDesignSettings().m_MicroViasMinDrill;
|
||||
}
|
||||
|
||||
|
||||
void NETCLASS::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
aFormatter->Print( aNestLevel, "(net-class %s %s\n",
|
||||
EscapedUTF8( GetName() ).c_str(),
|
||||
EscapedUTF8( GetDescription() ).c_str() );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "(clearance %d)\n", GetClearance() );
|
||||
aFormatter->Print( aNestLevel+1, "(trace-width %d)\n", GetTrackWidth() );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "(via-dia %d)\n", GetViaDiameter() );
|
||||
aFormatter->Print( aNestLevel+1, "(via-drill %d)\n", GetViaDrill() );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "(uvia-dia %d)\n", GetuViaDiameter() );
|
||||
aFormatter->Print( aNestLevel+1, "(uvia-drill %d)\n", GetuViaDrill() );
|
||||
|
||||
for( NETCLASS::const_iterator it = begin(); it!= end(); ++it )
|
||||
aFormatter->Print( aNestLevel+1, "(add-net %s)\n", EscapedUTF8( *it ).c_str() );
|
||||
|
||||
aFormatter->Print( aNestLevel, ")\n" );
|
||||
}
|
||||
|
|
|
@ -36,6 +36,8 @@
|
|||
|
||||
#include <wx/string.h>
|
||||
|
||||
#include <richio.h>
|
||||
|
||||
|
||||
class LINE_READER;
|
||||
class BOARD;
|
||||
|
@ -212,6 +214,18 @@ public:
|
|||
*/
|
||||
bool ReadDescr( LINE_READER* aReader );
|
||||
|
||||
/**
|
||||
* Function Format
|
||||
* outputs the net class to \a aFormatter in s-expression form.
|
||||
*
|
||||
* @param aFormatter The #OUTPUTFORMATTER object to write to.
|
||||
* @param aNestLevel The indentation next level.
|
||||
* @param aControlBits The control bit definition for object specific formatting.
|
||||
* @throw IO_ERROR on write error.
|
||||
*/
|
||||
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR );
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const; // overload
|
||||
#endif
|
||||
|
@ -243,7 +257,7 @@ public:
|
|||
|
||||
/**
|
||||
* Function Clear
|
||||
* destroys any constained NETCLASS instances except the Default one.
|
||||
* destroys any contained NETCLASS instances except the Default one.
|
||||
*/
|
||||
void Clear();
|
||||
|
||||
|
@ -306,4 +320,3 @@ public:
|
|||
};
|
||||
|
||||
#endif // CLASS_NETCLASS_H
|
||||
|
||||
|
|
|
@ -829,6 +829,100 @@ EDA_ITEM* D_PAD::Clone() const
|
|||
}
|
||||
|
||||
|
||||
void D_PAD::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
std::string shape;
|
||||
|
||||
switch( m_PadShape )
|
||||
{
|
||||
case PAD_CIRCLE: shape = "circle"; break;
|
||||
case PAD_RECT: shape = "rectangle"; break;
|
||||
case PAD_OVAL: shape = "oval"; break;
|
||||
case PAD_TRAPEZOID: shape = "trapezoid"; break;
|
||||
|
||||
default:
|
||||
THROW_IO_ERROR( wxString::Format( _( "unknown pad type: %d"), m_PadShape ) );
|
||||
}
|
||||
|
||||
std::string type;
|
||||
|
||||
switch( m_Attribute )
|
||||
{
|
||||
case PAD_STANDARD: type = "thru-hole"; break;
|
||||
case PAD_SMD: type = "smd"; break;
|
||||
case PAD_CONN: type = "connect"; break;
|
||||
case PAD_HOLE_NOT_PLATED: type = "np-thru-hole"; break;
|
||||
|
||||
default:
|
||||
THROW_IO_ERROR( wxString::Format( _( "unknown pad attribute: %d" ), m_Attribute ) );
|
||||
}
|
||||
|
||||
aFormatter->Print( aNestLevel, "(pad %s %s %s (size %s)\n",
|
||||
EscapedUTF8( 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() );
|
||||
|
||||
if( m_Orient != 0.0 )
|
||||
aFormatter->Print( aNestLevel+1, " %0.1f", m_Orient );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, ")\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();
|
||||
aFormatter->Print( aNestLevel+1, "(drill %s\n", 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();
|
||||
aFormatter->Print( aNestLevel+1, " (offset %s)", drillOffset.c_str() );
|
||||
}
|
||||
|
||||
aFormatter->Print( aNestLevel+1, ")\n" );
|
||||
}
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "(layers %08X)\n", GetLayerMask() );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "(net %d %s)\n", GetNet(), EscapedUTF8( m_Netname ).c_str() );
|
||||
|
||||
if( m_LengthDie != 0 )
|
||||
aFormatter->Print( aNestLevel+1, "(die-length %s)\n", FormatBIU( m_LengthDie ).c_str() );
|
||||
|
||||
if( m_LocalSolderMaskMargin != 0 )
|
||||
aFormatter->Print( aNestLevel+1, "(solder-mask-margin %s)\n",
|
||||
FormatBIU( m_LocalSolderMaskMargin ).c_str() );
|
||||
|
||||
if( m_LocalSolderPasteMargin != 0 )
|
||||
aFormatter->Print( aNestLevel+1, "(solder-paste-margin %s)\n",
|
||||
FormatBIU( m_LocalSolderPasteMargin ).c_str() );
|
||||
|
||||
if( m_LocalSolderPasteMarginRatio != 0 )
|
||||
aFormatter->Print( aNestLevel+1, "(solder-paste-margin-ratio %g)\n",
|
||||
m_LocalSolderPasteMarginRatio );
|
||||
|
||||
if( m_LocalClearance != 0 )
|
||||
aFormatter->Print( aNestLevel+1, "(clearance %s)\n",
|
||||
FormatBIU( 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() );
|
||||
|
||||
if( GetThermalGap() != 0 )
|
||||
aFormatter->Print( aNestLevel+1, "(thermal-gap %s)\n",
|
||||
FormatBIU( GetThermalGap() ).c_str() );
|
||||
|
||||
aFormatter->Print( aNestLevel, ")\n" );
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
void D_PAD::Show( int nestLevel, std::ostream& os ) const
|
||||
|
|
|
@ -176,7 +176,7 @@ public:
|
|||
|
||||
/**
|
||||
* Function GetOrientation
|
||||
* returns the rotation angle of the pad in tenths of degress, but soon degrees.
|
||||
* returns the rotation angle of the pad in tenths of degrees, but soon degrees.
|
||||
*/
|
||||
double GetOrientation() const { return m_Orient; }
|
||||
|
||||
|
@ -398,6 +398,9 @@ public:
|
|||
|
||||
EDA_ITEM* Clone() const;
|
||||
|
||||
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR );
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const; // overload
|
||||
#endif
|
||||
|
|
|
@ -191,6 +191,22 @@ EDA_ITEM* TEXTE_PCB::Clone() const
|
|||
}
|
||||
|
||||
|
||||
void TEXTE_PCB::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
aFormatter->Print( aNestLevel, "(pcb-text (layer %d)", GetLayer() );
|
||||
|
||||
if( GetTimeStamp() )
|
||||
aFormatter->Print( aNestLevel, " (tstamp %lX)", GetTimeStamp() );
|
||||
|
||||
aFormatter->Print( aNestLevel, "\n" );
|
||||
|
||||
EDA_TEXT::Format( aFormatter, aNestLevel+1, aControlBits );
|
||||
|
||||
aFormatter->Print( aNestLevel, ")\n" );
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
void TEXTE_PCB::Show( int nestLevel, std::ostream& os ) const
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
|
||||
wxString GetClass() const
|
||||
{
|
||||
return wxT("PTEXT");
|
||||
return wxT( "PTEXT" );
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -119,6 +119,9 @@ public:
|
|||
|
||||
EDA_ITEM* Clone() const;
|
||||
|
||||
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR );
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const;
|
||||
#endif
|
||||
|
|
|
@ -480,6 +480,26 @@ EDA_ITEM* TEXTE_MODULE::Clone() const
|
|||
}
|
||||
|
||||
|
||||
void TEXTE_MODULE::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
MODULE* parent = (MODULE*) GetParent();
|
||||
double orient = GetOrientation();
|
||||
|
||||
// Due to the Pcbnew history, m_Orient is saved in screen value
|
||||
// but it is handled as relative to its parent footprint
|
||||
if( parent )
|
||||
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" : "" );
|
||||
|
||||
EDA_TEXT::Format( aFormatter+1, aNestLevel, aControlBits );
|
||||
|
||||
aFormatter->Print( aNestLevel, ")\n" );
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
void TEXTE_MODULE::Show( int nestLevel, std::ostream& os ) const
|
||||
|
|
|
@ -175,6 +175,9 @@ public:
|
|||
|
||||
EDA_ITEM* Clone() const;
|
||||
|
||||
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR );
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const; // overload
|
||||
#endif
|
||||
|
|
|
@ -67,7 +67,7 @@ static bool ShowClearance( const TRACK* aTrack )
|
|||
|
||||
/*
|
||||
* return true if the dist between p1 and p2 < max_dist
|
||||
* Currently in test (currently rasnest algos work only if p1 == p2)
|
||||
* Currently in test (currently ratsnest algos work only if p1 == p2)
|
||||
*/
|
||||
inline bool IsNear( wxPoint& p1, wxPoint& p2, int max_dist )
|
||||
{
|
||||
|
@ -1559,6 +1559,47 @@ wxString TRACK::GetSelectMenuText() const
|
|||
}
|
||||
|
||||
|
||||
void TRACK::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
if( Type() == PCB_VIA_T )
|
||||
{
|
||||
std::string type;
|
||||
|
||||
switch( m_Shape )
|
||||
{
|
||||
case VIA_THROUGH: type = "thru"; break;
|
||||
case VIA_BLIND_BURIED: type = "blind"; break;
|
||||
case VIA_MICROVIA: type = "micro"; break;
|
||||
default:
|
||||
THROW_IO_ERROR( wxString::Format( _( "unknown via type %d" ), m_Shape ) );
|
||||
}
|
||||
|
||||
aFormatter->Print( aNestLevel, "(via %s (at %s) (size %s)", type.c_str(),
|
||||
FormatBIU( m_Start ).c_str(), FormatBIU( m_Width ).c_str() );
|
||||
|
||||
if( m_Drill != UNDEFINED_DRILL_DIAMETER )
|
||||
aFormatter->Print( aNestLevel, " (drill %s)", FormatBIU( 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() );
|
||||
}
|
||||
|
||||
aFormatter->Print( aNestLevel, " (layer %d) (net %d)", GetLayer(), GetNet() );
|
||||
|
||||
if( GetTimeStamp() != 0 )
|
||||
aFormatter->Print( aNestLevel, " (tstamp %lX)", GetTimeStamp() );
|
||||
|
||||
if( GetStatus() != 0 )
|
||||
aFormatter->Print( aNestLevel, " (status %X)", GetStatus() );
|
||||
|
||||
aFormatter->Print( aNestLevel, ")\n" );
|
||||
}
|
||||
|
||||
|
||||
#if defined(DEBUG)
|
||||
|
||||
void TRACK::Show( int nestLevel, std::ostream& os ) const
|
||||
|
|
|
@ -46,6 +46,8 @@ class D_PAD;
|
|||
* to the near neighbor internal layer */
|
||||
#define VIA_NOT_DEFINED 0 /* not yet used */
|
||||
|
||||
#define UNDEFINED_DRILL_DIAMETER -1 //< Undefined via drill diameter.
|
||||
|
||||
|
||||
/**
|
||||
* Function GetTrace
|
||||
|
@ -206,9 +208,9 @@ public:
|
|||
|
||||
/**
|
||||
* Function SetDrillDefault
|
||||
* Set the drill value for vias at default value (-1)
|
||||
* sets the drill value for vias to the default value #UNDEFINED_DRILL_DIAMETER.
|
||||
*/
|
||||
void SetDrillDefault() { m_Drill = -1; }
|
||||
void SetDrillDefault() { m_Drill = UNDEFINED_DRILL_DIAMETER; }
|
||||
|
||||
/**
|
||||
* Function IsDrillDefault
|
||||
|
@ -333,6 +335,9 @@ public:
|
|||
|
||||
virtual EDA_ITEM* Clone() const;
|
||||
|
||||
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR );
|
||||
|
||||
#if defined (DEBUG)
|
||||
|
||||
void Show( int nestLevel, std::ostream& os ) const; // overload
|
||||
|
@ -389,7 +394,7 @@ public:
|
|||
* For a via m_Layer contains the 2 layers :
|
||||
* top layer and bottom layer used by the via.
|
||||
* The via connect all layers from top layer to bottom layer
|
||||
* 4 bits for the first layer and 4 next bits for the secaon layer
|
||||
* 4 bits for the first layer and 4 next bits for the second layer
|
||||
* @param top_layer = first layer connected by the via
|
||||
* @param bottom_layer = last layer connected by the via
|
||||
*/
|
||||
|
|
|
@ -954,3 +954,124 @@ wxString ZONE_CONTAINER::GetSelectMenuText() const
|
|||
|
||||
return text;
|
||||
}
|
||||
|
||||
|
||||
void ZONE_CONTAINER::Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR )
|
||||
{
|
||||
aFormatter->Print( aNestLevel, "(zone (net %d %s) (layer %d) (tstamp %lX)\n",
|
||||
GetNet(), EscapedUTF8( m_Netname ).c_str(), GetLayer(), GetTimeStamp() );
|
||||
|
||||
|
||||
// Save the outline aux info
|
||||
std::string hatch;
|
||||
|
||||
switch( GetHatchStyle() )
|
||||
{
|
||||
default:
|
||||
case CPolyLine::NO_HATCH: hatch = "none"; break;
|
||||
case CPolyLine::DIAGONAL_EDGE: hatch = "edge"; break;
|
||||
case CPolyLine::DIAGONAL_FULL: hatch = "full"; break;
|
||||
}
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "(hatch %s)\n", hatch.c_str() );
|
||||
|
||||
if( m_priority > 0 )
|
||||
aFormatter->Print( aNestLevel+1, "(priority %d)\n", m_priority );
|
||||
|
||||
// Save pad option and clearance
|
||||
std::string padoption;
|
||||
|
||||
switch( GetPadConnection() )
|
||||
{
|
||||
default:
|
||||
case PAD_IN_ZONE: padoption = "yes"; break;
|
||||
case THERMAL_PAD: padoption = "use-thermal"; break;
|
||||
case PAD_NOT_IN_ZONE: padoption = "no"; break;
|
||||
}
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "(connect-pads %s (clearance %s))\n",
|
||||
padoption.c_str(), FormatBIU( m_ZoneClearance ).c_str() );
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "(min-thickness %s)\n",
|
||||
FormatBIU( 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() );
|
||||
|
||||
std::string smoothing;
|
||||
|
||||
switch( cornerSmoothingType )
|
||||
{
|
||||
case ZONE_SETTINGS::SMOOTHING_NONE: smoothing = "none"; break;
|
||||
case ZONE_SETTINGS::SMOOTHING_CHAMFER: smoothing = "chamfer"; break;
|
||||
case ZONE_SETTINGS::SMOOTHING_FILLET: smoothing = "fillet"; break;
|
||||
default:
|
||||
THROW_IO_ERROR( wxString::Format( _( "unknown zone corner smoothing type %d" ),
|
||||
cornerSmoothingType ) );
|
||||
}
|
||||
|
||||
aFormatter->Print( aNestLevel+1, "(smoothing %s (radius %s))\n",
|
||||
smoothing.c_str(), FormatBIU( cornerRadius ).c_str() );
|
||||
|
||||
const std::vector< CPolyPt >& cv = m_Poly->corner;
|
||||
|
||||
if( cv.size() )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+1, "(polygon (pts" );
|
||||
|
||||
for( std::vector< CPolyPt >::const_iterator it = cv.begin(); it != cv.end(); ++it )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+1, " (xy %s %s)",
|
||||
FormatBIU( it->x ).c_str(), FormatBIU( it->y ).c_str() );
|
||||
|
||||
if( it->end_contour )
|
||||
aFormatter->Print( aNestLevel+1, ")\n(polygon (pts" );
|
||||
}
|
||||
|
||||
aFormatter->Print( aNestLevel+1, ")\n" );
|
||||
}
|
||||
|
||||
// Save the PolysList
|
||||
const std::vector< CPolyPt >& fv = m_FilledPolysList;
|
||||
|
||||
if( fv.size() )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+1, "(filled-polygon (pts" );
|
||||
|
||||
for( std::vector< CPolyPt >::const_iterator it = fv.begin(); it != fv.end(); ++it )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+1, " (xy %s %s)",
|
||||
FormatBIU( it->x ).c_str(), FormatBIU( it->y ).c_str() );
|
||||
|
||||
if( it->end_contour )
|
||||
aFormatter->Print( aNestLevel+1, ")\n(filled-polygon (pts" );
|
||||
}
|
||||
|
||||
aFormatter->Print( aNestLevel+1, ")\n" );
|
||||
}
|
||||
|
||||
// Save the filling segments list
|
||||
const std::vector< SEGMENT >& segs = m_FillSegmList;
|
||||
|
||||
if( segs.size() )
|
||||
{
|
||||
aFormatter->Print( aNestLevel+1, "(fill-segments\n" );
|
||||
|
||||
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() );
|
||||
}
|
||||
|
||||
aFormatter->Print( aNestLevel+1, ")\n" );
|
||||
}
|
||||
|
||||
aFormatter->Print( aNestLevel, ")\n" );
|
||||
}
|
||||
|
|
|
@ -122,9 +122,9 @@ private:
|
|||
CPolyLine* smoothedPoly; // Corner-smoothed version of m_Poly
|
||||
int cornerSmoothingType;
|
||||
unsigned int cornerRadius;
|
||||
// Priority: when a zone outline is inside and other zone, if its priority is highter
|
||||
// Priority: when a zone outline is inside and other zone, if its priority is higher
|
||||
// the other zone priority, it will be created inside.
|
||||
// if priorities are equal, a DRC erroc is set
|
||||
// if priorities are equal, a DRC error is set
|
||||
unsigned m_priority;
|
||||
ZoneConnection m_PadConnection;
|
||||
|
||||
|
@ -552,9 +552,11 @@ public:
|
|||
|
||||
virtual BITMAP_DEF GetMenuImage() const { return add_zone_xpm; }
|
||||
|
||||
/** @copydoc EDA_ITEM::Clone() */
|
||||
virtual EDA_ITEM* Clone() const;
|
||||
|
||||
void Format( OUTPUTFORMATTER* aFormatter, int aNestLevel, int aControlBits ) const
|
||||
throw( IO_ERROR );
|
||||
|
||||
#if defined(DEBUG)
|
||||
void Show( int nestLevel, std::ostream& os ) const { ShowDummy( os ); } // override
|
||||
#endif
|
||||
|
|
|
@ -89,9 +89,6 @@
|
|||
#include <wx/ffile.h>
|
||||
|
||||
|
||||
//#define KICAD_NANOMETRE
|
||||
|
||||
|
||||
#define VERSION_ERROR_FORMAT _( "File '%s' is format version: %d.\nI only support format version <= %d.\nPlease upgrade PCBNew to load this file." )
|
||||
#define UNKNOWN_GRAPHIC_FORMAT _( "unknown graphic type: %d")
|
||||
#define UNKNOWN_PAD_FORMAT _( "unknown pad type: %d")
|
||||
|
@ -344,7 +341,7 @@ void KICAD_PLUGIN::loadGENERAL()
|
|||
|
||||
if( !strcmp( data, "mm" ) )
|
||||
{
|
||||
#if defined(KICAD_NANOMETRE)
|
||||
#if defined(USE_PCBNEW_NANOMETERS)
|
||||
diskToBiu = 1000000.0;
|
||||
#else
|
||||
THROW_IO_ERROR( _( "May not load new *.brd file into 'PCBNew compiled for deci-mils'" ) );
|
||||
|
@ -2659,7 +2656,7 @@ void KICAD_PLUGIN::init( PROPERTIES* aProperties )
|
|||
m_props = aProperties;
|
||||
|
||||
// conversion factor for saving RAM BIUs to KICAD legacy file format.
|
||||
#if defined(KICAD_NANOMETRE)
|
||||
#if defined(USE_PCBNEW_NANOMETERS)
|
||||
biuToDisk = 1/1000000.0; // BIUs are nanometers & file is mm
|
||||
#else
|
||||
biuToDisk = 1.0; // BIUs are deci-mils
|
||||
|
@ -2673,7 +2670,7 @@ void KICAD_PLUGIN::init( PROPERTIES* aProperties )
|
|||
// then, during the file loading process, to start a conversion from
|
||||
// mm to nanometers.
|
||||
|
||||
#if defined(KICAD_NANOMETRE)
|
||||
#if defined(USE_PCBNEW_NANOMETERS)
|
||||
diskToBiu = 2540.0; // BIUs are nanometers
|
||||
#else
|
||||
diskToBiu = 1.0; // BIUs are deci-mils
|
||||
|
@ -2750,7 +2747,7 @@ void KICAD_PLUGIN::saveGENERAL() const
|
|||
fprintf( m_fp, "encoding utf-8\n" );
|
||||
|
||||
// tell folks the units used within the file, as early as possible here.
|
||||
#if defined(KICAD_NANOMETRE)
|
||||
#if defined(USE_PCBNEW_NANOMETERS)
|
||||
fprintf( m_fp, "Units mm\n" );
|
||||
#else
|
||||
fprintf( m_fp, "Units deci-mils\n" );
|
||||
|
|
Loading…
Reference in New Issue