Move LIB_PART save code to legacy schematic plugin.
This is the last of the object save/load code that was not moved into the SCH_LEGACY_PLUGIN object. All schematic and library I/O is now performed in the SCH_LEGACY_PLUGIN object and as been removed from the schematic and library objects. The old single symbol file format has been replaced with the normal symbol library file format since there was no difference between them except the SYMBOL token. The SYMBOL token was no longer being read since the introduction of the SCH_LEGACY_PLUGIN symbol library loader. Update the Doxygen comments in all of the modified files.
This commit is contained in:
parent
b588c1902a
commit
694ad93385
|
@ -120,35 +120,6 @@ PART_LIB* LIB_ALIAS::GetLib()
|
|||
}
|
||||
|
||||
|
||||
bool LIB_ALIAS::SaveDoc( OUTPUTFORMATTER& aFormatter )
|
||||
{
|
||||
if( description.IsEmpty() && keyWords.IsEmpty() && docFileName.IsEmpty() )
|
||||
return true;
|
||||
|
||||
try
|
||||
{
|
||||
aFormatter.Print( 0, "#\n$CMP %s\n", TO_UTF8( name ) );
|
||||
|
||||
if( !description.IsEmpty() )
|
||||
aFormatter.Print( 0, "D %s\n", TO_UTF8( description ) );
|
||||
|
||||
if( !keyWords.IsEmpty() )
|
||||
aFormatter.Print( 0, "K %s\n", TO_UTF8( keyWords ) );
|
||||
|
||||
if( !docFileName.IsEmpty() )
|
||||
aFormatter.Print( 0, "F %s\n", TO_UTF8( docFileName ) );
|
||||
|
||||
aFormatter.Print( 0, "$ENDCMP\n" );
|
||||
}
|
||||
catch( const IO_ERROR& )
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool LIB_ALIAS::operator==( const wxChar* aName ) const
|
||||
{
|
||||
return name == aName;
|
||||
|
@ -175,6 +146,7 @@ struct null_deleter
|
|||
}
|
||||
};
|
||||
|
||||
|
||||
LIB_PART::LIB_PART( const wxString& aName, PART_LIB* aLibrary ) :
|
||||
EDA_ITEM( LIB_PART_T ),
|
||||
m_me( this, null_deleter() )
|
||||
|
@ -498,6 +470,7 @@ void LIB_PART::Plot( PLOTTER* aPlotter, int aUnit, int aConvert,
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
void LIB_PART::PlotLibFields( PLOTTER* aPlotter, int aUnit, int aConvert,
|
||||
const wxPoint& aOffset, const TRANSFORM& aTransform )
|
||||
{
|
||||
|
@ -706,133 +679,6 @@ bool LIB_PART::PinsConflictWith( LIB_PART& aOtherPart, bool aTestNums, bool aTes
|
|||
}
|
||||
|
||||
|
||||
bool LIB_PART::Save( OUTPUTFORMATTER& aFormatter )
|
||||
{
|
||||
LIB_FIELD& value = GetValueField();
|
||||
|
||||
// First line: it s a comment (component name for readers)
|
||||
aFormatter.Print( 0, "#\n# %s\n#\n", TO_UTF8( value.GetText() ) );
|
||||
|
||||
// Save data
|
||||
aFormatter.Print( 0, "DEF" );
|
||||
|
||||
if( value.IsVisible() )
|
||||
{
|
||||
aFormatter.Print( 0, " %s", TO_UTF8( value.GetText() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
aFormatter.Print( 0, " ~%s", TO_UTF8( value.GetText() ) );
|
||||
}
|
||||
|
||||
LIB_FIELD& reference = GetReferenceField();
|
||||
|
||||
if( !reference.GetText().IsEmpty() )
|
||||
{
|
||||
aFormatter.Print( 0, " %s", TO_UTF8( reference.GetText() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
aFormatter.Print( 0, " ~" );
|
||||
}
|
||||
|
||||
aFormatter.Print( 0, " %d %d %c %c %d %c %c\n",
|
||||
0, m_pinNameOffset,
|
||||
m_showPinNumbers ? 'Y' : 'N',
|
||||
m_showPinNames ? 'Y' : 'N',
|
||||
m_unitCount, m_unitsLocked ? 'L' : 'F',
|
||||
m_options == ENTRY_POWER ? 'P' : 'N' );
|
||||
|
||||
if( !SaveDateAndTime( aFormatter ) )
|
||||
return false;
|
||||
|
||||
LIB_FIELDS fields;
|
||||
GetFields( fields );
|
||||
|
||||
// Mandatory fields:
|
||||
// may have their own save policy so there is a separate loop for them.
|
||||
// Empty fields are saved, because the user may have set visibility,
|
||||
// size and orientation
|
||||
for( int i = 0; i < MANDATORY_FIELDS; ++i )
|
||||
{
|
||||
if( !fields[i].Save( aFormatter ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
// User defined fields:
|
||||
// may have their own save policy so there is a separate loop for them.
|
||||
|
||||
int fieldId = MANDATORY_FIELDS; // really wish this would go away.
|
||||
|
||||
for( unsigned i = MANDATORY_FIELDS; i < fields.size(); ++i )
|
||||
{
|
||||
// There is no need to save empty fields, i.e. no reason to preserve field
|
||||
// names now that fields names come in dynamically through the template
|
||||
// fieldnames.
|
||||
if( !fields[i].GetText().IsEmpty() )
|
||||
{
|
||||
fields[i].SetId( fieldId++ );
|
||||
|
||||
if( !fields[i].Save( aFormatter ) )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
// Save the alias list: a line starting by "ALIAS". The first alias is the root
|
||||
// and has the same name as the component. In the old library file format this
|
||||
// alias does not get added to the alias list.
|
||||
if( m_aliases.size() > 1 )
|
||||
{
|
||||
aFormatter.Print( 0, "ALIAS" );
|
||||
|
||||
for( unsigned i = 1; i < m_aliases.size(); i++ )
|
||||
{
|
||||
aFormatter.Print( 0, " %s", TO_UTF8( m_aliases[i]->GetName() ) );
|
||||
}
|
||||
|
||||
aFormatter.Print( 0, "\n" );
|
||||
}
|
||||
|
||||
// Write the footprint filter list
|
||||
if( m_FootprintList.GetCount() != 0 )
|
||||
{
|
||||
aFormatter.Print( 0, "$FPLIST\n" );
|
||||
|
||||
for( unsigned i = 0; i < m_FootprintList.GetCount(); i++ )
|
||||
{
|
||||
aFormatter.Print( 0, " %s\n", TO_UTF8( m_FootprintList[i] ) );
|
||||
}
|
||||
|
||||
aFormatter.Print( 0, "$ENDFPLIST\n" );
|
||||
}
|
||||
|
||||
// Save graphics items (including pins)
|
||||
if( !m_drawings.empty() )
|
||||
{
|
||||
/* we sort the draw items, in order to have an edition more easy,
|
||||
* when a file editing "by hand" is made */
|
||||
m_drawings.sort();
|
||||
|
||||
aFormatter.Print( 0, "DRAW\n" );
|
||||
|
||||
for( LIB_ITEM& item : m_drawings )
|
||||
{
|
||||
if( item.Type() == LIB_FIELD_T )
|
||||
continue;
|
||||
|
||||
if( !item.Save( aFormatter ) )
|
||||
return false;
|
||||
}
|
||||
|
||||
aFormatter.Print( 0, "ENDDRAW\n" );
|
||||
}
|
||||
|
||||
aFormatter.Print( 0, "ENDDEF\n" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
const EDA_RECT LIB_PART::GetUnitBoundingBox( int aUnit, int aConvert ) const
|
||||
{
|
||||
EDA_RECT bBox;
|
||||
|
@ -1137,12 +983,6 @@ void LIB_PART::DeleteSelectedItems()
|
|||
{
|
||||
if( item->Type() == LIB_FIELD_T )
|
||||
{
|
||||
#if 0 // Set to 1 to allows fields deletion on block delete or other global command
|
||||
LIB_FIELD& field = ( LIB_FIELD& ) *item;
|
||||
|
||||
if( (field.GetId() == REFERENCE) || (field.m_FieldId == VALUE) ||
|
||||
(field.m_Attributs & TEXT_NO_VISIBLE) )
|
||||
#endif
|
||||
item->ClearFlags( SELECTED );
|
||||
}
|
||||
|
||||
|
@ -1430,27 +1270,6 @@ void LIB_PART::SetAliases( const wxArrayString& aAliasList )
|
|||
}
|
||||
|
||||
|
||||
#if 0 // this version looked suspect to me, it did not rename a deleted root
|
||||
|
||||
void LIB_PART::RemoveAlias( const wxString& aName )
|
||||
{
|
||||
wxCHECK_RET( m_library == NULL,
|
||||
wxT( "Part aliases cannot be changed when they are owned by a library." ) );
|
||||
wxCHECK_RET( !aName.IsEmpty(), wxT( "Cannot get alias with an empty name." ) );
|
||||
|
||||
LIB_ALIASES::iterator it;
|
||||
|
||||
for( it = m_aliases.begin(); it != m_aliases.end(); it++ )
|
||||
{
|
||||
if( aName == (*it)->GetName() )
|
||||
{
|
||||
m_aliases.erase( it );
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#else
|
||||
void LIB_PART::RemoveAlias( const wxString& aName )
|
||||
{
|
||||
LIB_ALIAS* a = GetAlias( aName );
|
||||
|
@ -1458,7 +1277,6 @@ void LIB_PART::RemoveAlias( const wxString& aName )
|
|||
if( a )
|
||||
RemoveAlias( a );
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
LIB_ALIAS* LIB_PART::RemoveAlias( LIB_ALIAS* aAlias )
|
||||
|
|
|
@ -107,8 +107,7 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Function GetPart
|
||||
* gets the shared LIB_PART.
|
||||
* Get the shared LIB_PART.
|
||||
*
|
||||
* @return LIB_PART* - the LIB_PART shared by
|
||||
* this LIB_ALIAS with possibly other LIB_ALIASes.
|
||||
|
@ -149,15 +148,6 @@ public:
|
|||
|
||||
wxString GetDocFileName() const { return docFileName; }
|
||||
|
||||
/**
|
||||
* Function SaveDocs
|
||||
* write the entry document information to \a aFormatter in "*.dcm" format.
|
||||
*
|
||||
* @param aFormatter The #OUTPUTFORMATTER to write the alias documents to.
|
||||
* @return True if success writing else false.
|
||||
*/
|
||||
bool SaveDoc( OUTPUTFORMATTER& aFormatter );
|
||||
|
||||
/**
|
||||
* KEEPCASE sensitive comparison of the part entry name.
|
||||
*/
|
||||
|
@ -216,11 +206,10 @@ struct PART_DRAW_OPTIONS
|
|||
|
||||
|
||||
/**
|
||||
* Class LIB_PART
|
||||
* defines a library part object.
|
||||
* Define a library symbol object.
|
||||
*
|
||||
* A library part object is typically saved and loaded in a part library file (.lib).
|
||||
* Library parts are different from schematic components.
|
||||
* A library symbol object is typically saved and loaded in a part library file (.lib).
|
||||
* Library symbols are different from schematic symbols.
|
||||
*/
|
||||
class LIB_PART : public EDA_ITEM
|
||||
{
|
||||
|
@ -291,9 +280,9 @@ public:
|
|||
|
||||
LIB_ALIAS* GetAlias( const wxString& aName );
|
||||
|
||||
long GetDateModified() const { return m_dateModified; }
|
||||
|
||||
/**
|
||||
* Function AddAlias
|
||||
*
|
||||
* Add an alias \a aName to the part.
|
||||
*
|
||||
* Duplicate alias names are not added to the alias list. Debug builds will raise an
|
||||
|
@ -320,10 +309,11 @@ public:
|
|||
|
||||
void RemoveAllAliases();
|
||||
|
||||
wxArrayString& GetFootPrints() { return m_FootprintList; }
|
||||
wxArrayString& GetFootprints() { return m_FootprintList; }
|
||||
|
||||
/**
|
||||
* Function GetBoundingBox
|
||||
* Get the bounding box for the symbol.
|
||||
*
|
||||
* @return the part bounding box ( in user coordinates )
|
||||
* @param aUnit = unit selection = 0, or 1..n
|
||||
* @param aConvert = 0, 1 or 2
|
||||
|
@ -334,7 +324,8 @@ public:
|
|||
const EDA_RECT GetUnitBoundingBox( int aUnit, int aConvert ) const;
|
||||
|
||||
/**
|
||||
* Function GetBodyBoundingBox
|
||||
* Get the symbol bounding box excluding fields.
|
||||
*
|
||||
* @return the part bounding box ( in user coordinates ) without fields
|
||||
* @param aUnit = unit selection = 0, or 1..n
|
||||
* @param aConvert = 0, 1 or 2
|
||||
|
@ -350,8 +341,7 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Function SaveDateAndTime
|
||||
* write the date and time of part to \a aFile in the format:
|
||||
* Write the date and time of part to \a aFile in the format:
|
||||
* "Ti yy/mm/jj hh:mm:ss"
|
||||
*
|
||||
* @param aFormatter A reference to an #OUTPUTFORMATTER object containing the
|
||||
|
@ -363,9 +353,7 @@ public:
|
|||
bool LoadDateAndTime( char* aLine );
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures out to \a aFormatter in the part library "*.lib"
|
||||
* format.
|
||||
* Write the data structures out to \a aFormatter in the part library "*.lib" format.
|
||||
*
|
||||
* @param aFormatter A reference to an OUTPUTFORMATTER to write to.
|
||||
* @return True if success writing else false.
|
||||
|
@ -382,18 +370,18 @@ public:
|
|||
bool UnitsLocked() const { return m_unitsLocked; }
|
||||
|
||||
/**
|
||||
* Function SetFields
|
||||
* overwrites all the existing in this part with fields supplied
|
||||
* in \a aFieldsList. The only known caller of this function is the
|
||||
* library part field editor, and it establishes needed behavior.
|
||||
* Overwrite all the existing fields in this symbol with fields supplied
|
||||
* in \a aFieldsList.
|
||||
*
|
||||
` * @param aFieldsList is a set of fields to import, removing all previous fields.
|
||||
* The only known caller of this function is the library part field editor, and it
|
||||
* establishes needed behavior.
|
||||
*
|
||||
* @param aFieldsList is a set of fields to import, removing all previous fields.
|
||||
*/
|
||||
void SetFields( const std::vector <LIB_FIELD>& aFieldsList );
|
||||
|
||||
/**
|
||||
* Function GetFields
|
||||
* returns a list of fields withing this part. The only known caller of
|
||||
* Return a list of fields withing this part. The only known caller of
|
||||
* this function is the library part field editor, and it establishes
|
||||
* needed behavior.
|
||||
*
|
||||
|
@ -402,9 +390,7 @@ public:
|
|||
void GetFields( LIB_FIELDS& aList );
|
||||
|
||||
/**
|
||||
* Function FindField
|
||||
* finds a field within this part matching \a aFieldName and returns
|
||||
* it or NULL if not found.
|
||||
* Findd a field within this part matching \a aFieldName and returns it or NULL if not found.
|
||||
*/
|
||||
LIB_FIELD* FindField( const wxString& aFieldName );
|
||||
|
||||
|
@ -536,8 +522,7 @@ public:
|
|||
LIB_PIN* GetPin( const wxString& aNumber, int aUnit = 0, int aConvert = 0 );
|
||||
|
||||
/**
|
||||
* Function PinsConflictWith
|
||||
* returns true if this part's pins do not match another part's pins. This
|
||||
* Return true if this part's pins do not match another part's pins. This
|
||||
* is used to detect whether the project cache is out of sync with the
|
||||
* system libs.
|
||||
*
|
||||
|
@ -689,14 +674,12 @@ public:
|
|||
int GetUnitCount() const { return m_unitCount; }
|
||||
|
||||
/**
|
||||
* Function IsMulti
|
||||
* @return true if the part has multiple units per part.
|
||||
* When happens, the reference has a sub reference ti identify part
|
||||
*/
|
||||
bool IsMulti() const { return m_unitCount > 1; }
|
||||
|
||||
/**
|
||||
* Function SubReference
|
||||
* @return the sub reference for part having multiple units per part.
|
||||
* The sub reference identify the part (or unit)
|
||||
* @param aUnit = the part identifier ( 1 to max count)
|
||||
|
@ -720,7 +703,8 @@ public:
|
|||
*/
|
||||
static int* SubpartFirstIdPtr() { return &m_subpartFirstId; }
|
||||
|
||||
/** Set the separator char between the subpart id and the reference
|
||||
/**
|
||||
* Set the separator char between the subpart id and the reference
|
||||
* 0 (no separator) or '.' , '-' and '_'
|
||||
* and the ascii char value to calculate the subpart symbol id from the part number:
|
||||
* 'A' or '1' only are allowed. (to print U1.A or U1.1)
|
||||
|
|
|
@ -278,7 +278,7 @@ void DIALOG_CHOOSE_COMPONENT::PopulateFootprintSelector( LIB_ID const& aLibId )
|
|||
alias->GetPart()->GetPins( temp_pins );
|
||||
|
||||
m_fp_sel_ctrl->FilterByPinCount( temp_pins.size() );
|
||||
m_fp_sel_ctrl->FilterByFootprintFilters( alias->GetPart()->GetFootPrints(), true );
|
||||
m_fp_sel_ctrl->FilterByFootprintFilters( alias->GetPart()->GetFootprints(), true );
|
||||
m_fp_sel_ctrl->SetDefaultFootprint( fp_name );
|
||||
m_fp_sel_ctrl->UpdateList();
|
||||
m_fp_sel_ctrl->Enable();
|
||||
|
|
|
@ -103,9 +103,9 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::initDlg()
|
|||
}
|
||||
|
||||
/* Read the Footprint Filter list */
|
||||
m_FootprintFilterListBox->Append( component->GetFootPrints() );
|
||||
m_FootprintFilterListBox->Append( component->GetFootprints() );
|
||||
|
||||
if( component->GetFootPrints().GetCount() == 0 )
|
||||
if( component->GetFootprints().GetCount() == 0 )
|
||||
{
|
||||
m_ButtonDeleteAllFootprintFilter->Enable( false );
|
||||
m_ButtonDeleteOneFootprintFilter->Enable( false );
|
||||
|
@ -261,8 +261,8 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::OnOkClick( wxCommandEvent& event )
|
|||
component->LockUnits( false );
|
||||
|
||||
/* Update the footprint filter list */
|
||||
component->GetFootPrints().Clear();
|
||||
component->GetFootPrints() = m_FootprintFilterListBox->GetStrings();
|
||||
component->GetFootprints().Clear();
|
||||
component->GetFootprints() = m_FootprintFilterListBox->GetStrings();
|
||||
|
||||
EndModal( wxID_OK );
|
||||
}
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include <class_plotter.h>
|
||||
#include <trigo.h>
|
||||
#include <wxstruct.h>
|
||||
#include <richio.h>
|
||||
#include <base_units.h>
|
||||
#include <msgpanel.h>
|
||||
#include <bitmaps.h>
|
||||
|
@ -102,27 +101,6 @@ LIB_ARC::LIB_ARC( LIB_PART* aParent ) : LIB_ITEM( LIB_ARC_T, aParent )
|
|||
}
|
||||
|
||||
|
||||
bool LIB_ARC::Save( OUTPUTFORMATTER& aFormatter )
|
||||
{
|
||||
int x1 = m_t1;
|
||||
|
||||
if( x1 > 1800 )
|
||||
x1 -= 3600;
|
||||
|
||||
int x2 = m_t2;
|
||||
|
||||
if( x2 > 1800 )
|
||||
x2 -= 3600;
|
||||
|
||||
aFormatter.Print( 0, "A %d %d %d %d %d %d %d %d %c %d %d %d %d\n",
|
||||
m_Pos.x, m_Pos.y, m_Radius, x1, x2, m_Unit, m_Convert, m_Width,
|
||||
fill_tab[m_Fill], m_ArcStart.x, m_ArcStart.y, m_ArcEnd.x,
|
||||
m_ArcEnd.y );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool LIB_ARC::HitTest( const wxPoint& aRefPoint ) const
|
||||
{
|
||||
int mindist = GetPenSize() / 2;
|
||||
|
|
|
@ -91,9 +91,6 @@ public:
|
|||
return wxT( "LIB_ARC" );
|
||||
}
|
||||
|
||||
|
||||
bool Save( OUTPUTFORMATTER& aFormatter ) override;
|
||||
|
||||
bool HitTest( const wxPoint& aPosition ) const override;
|
||||
|
||||
bool HitTest( const wxPoint& aPosition, int aThreshold, const TRANSFORM& aTransform ) const override;
|
||||
|
@ -143,8 +140,12 @@ public:
|
|||
|
||||
int GetSecondRadiusAngle() const { return m_t2; }
|
||||
|
||||
wxPoint GetStart() const { return m_ArcStart; }
|
||||
|
||||
void SetStart( const wxPoint& aPoint ) { m_ArcStart = aPoint; }
|
||||
|
||||
wxPoint GetEnd() const { return m_ArcEnd; }
|
||||
|
||||
void SetEnd( const wxPoint& aPoint ) { m_ArcEnd = aPoint; }
|
||||
|
||||
/**
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include <trigo.h>
|
||||
#include <wxstruct.h>
|
||||
#include <bezier_curves.h>
|
||||
#include <richio.h>
|
||||
#include <base_units.h>
|
||||
#include <msgpanel.h>
|
||||
|
||||
|
@ -52,20 +51,6 @@ LIB_BEZIER::LIB_BEZIER( LIB_PART* aParent ) :
|
|||
}
|
||||
|
||||
|
||||
bool LIB_BEZIER::Save( OUTPUTFORMATTER& aFormatter )
|
||||
{
|
||||
aFormatter.Print( 0, "B %lu %d %d %d", (long unsigned)m_BezierPoints.size(),
|
||||
m_Unit, m_Convert, m_Width );
|
||||
|
||||
for( const auto& pt : m_BezierPoints )
|
||||
aFormatter.Print( 0, " %d %d", pt.x, pt.y );
|
||||
|
||||
aFormatter.Print( 0, " %c\n", fill_tab[m_Fill] );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
EDA_ITEM* LIB_BEZIER::Clone() const
|
||||
{
|
||||
return new LIB_BEZIER( *this );
|
||||
|
|
|
@ -59,8 +59,6 @@ public:
|
|||
}
|
||||
|
||||
|
||||
bool Save( OUTPUTFORMATTER& aFormatter ) override;
|
||||
|
||||
void AddPoint( const wxPoint& aPoint ) { m_BezierPoints.push_back( aPoint ); }
|
||||
|
||||
void SetOffset( const wxPoint& aOffset ) override;
|
||||
|
@ -70,6 +68,11 @@ public:
|
|||
*/
|
||||
unsigned GetCornerCount() const { return m_PolyPoints.size(); }
|
||||
|
||||
const std::vector< wxPoint >& GetPoints() const
|
||||
{
|
||||
return m_BezierPoints;
|
||||
}
|
||||
|
||||
bool HitTest( const wxPoint& aPosition ) const override;
|
||||
|
||||
bool HitTest( const wxPoint& aPosRef, int aThreshold, const TRANSFORM& aTransform ) const override;
|
||||
|
|
|
@ -34,7 +34,6 @@
|
|||
#include <class_plotter.h>
|
||||
#include <trigo.h>
|
||||
#include <wxstruct.h>
|
||||
#include <richio.h>
|
||||
#include <base_units.h>
|
||||
#include <msgpanel.h>
|
||||
#include <bitmaps.h>
|
||||
|
@ -55,15 +54,6 @@ LIB_CIRCLE::LIB_CIRCLE( LIB_PART* aParent ) :
|
|||
}
|
||||
|
||||
|
||||
bool LIB_CIRCLE::Save( OUTPUTFORMATTER& aFormatter )
|
||||
{
|
||||
aFormatter.Print( 0, "C %d %d %d %d %d %d %c\n", m_Pos.x, m_Pos.y,
|
||||
m_Radius, m_Unit, m_Convert, m_Width, fill_tab[m_Fill] );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool LIB_CIRCLE::HitTest( const wxPoint& aPosRef ) const
|
||||
{
|
||||
int mindist = GetPenSize() / 2;
|
||||
|
|
|
@ -57,8 +57,6 @@ public:
|
|||
}
|
||||
|
||||
|
||||
bool Save( OUTPUTFORMATTER& aFormatter ) override;
|
||||
|
||||
bool HitTest( const wxPoint& aPosition ) const override;
|
||||
|
||||
bool HitTest( const wxPoint& aPosRef, int aThreshold, const TRANSFORM& aTransform ) const override;
|
||||
|
|
|
@ -61,15 +61,12 @@ typedef std::vector< LIB_PIN* > LIB_PINS;
|
|||
|
||||
|
||||
/**
|
||||
* Class LIB_ITEM
|
||||
* is the base class for drawable items used by schematic library components.
|
||||
* The base class for drawable items used by schematic library components.
|
||||
*/
|
||||
class LIB_ITEM : public EDA_ITEM
|
||||
{
|
||||
/**
|
||||
* Function drawGraphic
|
||||
*
|
||||
* draws the item on \a aPanel.
|
||||
* Draw the item on \a aPanel.
|
||||
*
|
||||
* @param aPanel A pointer to the panel to draw the object upon.
|
||||
* @param aDC A pointer to the device context used to draw the object.
|
||||
|
@ -211,22 +208,10 @@ public:
|
|||
const TRANSFORM& aTransform );
|
||||
|
||||
/**
|
||||
* Function GetPenSize
|
||||
*
|
||||
* @return the size of the "pen" that be used to draw or plot this item
|
||||
*/
|
||||
virtual int GetPenSize() const = 0;
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes draw item object to \a aFormatter in component library "*.lib" format.
|
||||
*
|
||||
* @param aFormatter A reference to an #OUTPUTFORMATTER object to write the
|
||||
* component library item to.
|
||||
* @return True if success writing else false.
|
||||
*/
|
||||
virtual bool Save( OUTPUTFORMATTER& aFormatter ) = 0;
|
||||
|
||||
LIB_PART* GetParent() const
|
||||
{
|
||||
return (LIB_PART *)m_Parent;
|
||||
|
@ -253,9 +238,7 @@ public:
|
|||
virtual const EDA_RECT GetBoundingBox() const override { return EDA_ITEM::GetBoundingBox(); }
|
||||
|
||||
/**
|
||||
* Function GetMsgPanelInfo
|
||||
* displays basic info (type, part and convert) about the current item
|
||||
* in message panel.
|
||||
* Display basic info (type, part and convert) about the current item in message panel.
|
||||
* <p>
|
||||
* This base function is used to display the information common to the
|
||||
* all library items. Call the base class from the derived class or the
|
||||
|
@ -286,16 +269,14 @@ public:
|
|||
bool operator<( const LIB_ITEM& aOther) const;
|
||||
|
||||
/**
|
||||
* Function Offset
|
||||
* sets the drawing object by \a aOffset from the current position.
|
||||
* Set the drawing object by \a aOffset from the current position.
|
||||
*
|
||||
* @param aOffset Coordinates to offset the item position.
|
||||
*/
|
||||
virtual void SetOffset( const wxPoint& aOffset ) = 0;
|
||||
|
||||
/**
|
||||
* Function Inside
|
||||
* tests if any part of the draw object is inside rectangle bounds of \a aRect.
|
||||
* Test if any part of the draw object is inside rectangle bounds of \a aRect.
|
||||
*
|
||||
* @param aRect Rectangle to check against.
|
||||
* @return True if object is inside rectangle.
|
||||
|
@ -303,16 +284,14 @@ public:
|
|||
virtual bool Inside( EDA_RECT& aRect ) const = 0;
|
||||
|
||||
/**
|
||||
* Function Move
|
||||
* moves a draw object to \a aPosition.
|
||||
* Move a draw object to \a aPosition.
|
||||
*
|
||||
* @param aPosition Position to move draw item to.
|
||||
*/
|
||||
virtual void Move( const wxPoint& aPosition ) = 0;
|
||||
|
||||
/**
|
||||
* Function GetPosition
|
||||
* returns the current draw object position.
|
||||
* Return the current draw object position.
|
||||
*
|
||||
* @return A wxPoint object containing the position of the object.
|
||||
*/
|
||||
|
@ -321,24 +300,21 @@ public:
|
|||
void SetPosition( const wxPoint& aPosition ) { Move( aPosition ); }
|
||||
|
||||
/**
|
||||
* Function MirrorHorizontal
|
||||
* mirrors the draw object along the horizontal (X) axis about \a aCenter point.
|
||||
* Mirror the draw object along the horizontal (X) axis about \a aCenter point.
|
||||
*
|
||||
* @param aCenter Point to mirror around.
|
||||
*/
|
||||
virtual void MirrorHorizontal( const wxPoint& aCenter ) = 0;
|
||||
|
||||
/**
|
||||
* Function MirrorVertical
|
||||
* mirrors the draw object along the MirrorVertical (Y) axis about \a aCenter point.
|
||||
* Mirror the draw object along the MirrorVertical (Y) axis about \a aCenter point.
|
||||
*
|
||||
* @param aCenter Point to mirror around.
|
||||
*/
|
||||
virtual void MirrorVertical( const wxPoint& aCenter ) = 0;
|
||||
|
||||
/**
|
||||
* Function Rotate
|
||||
* rotates the object about \a aCenter point.
|
||||
* Rotate the object about \a aCenter point.
|
||||
*
|
||||
* @param aCenter Point to rotate around.
|
||||
* @param aRotateCCW True to rotate counter clockwise. False to rotate clockwise.
|
||||
|
@ -362,16 +338,14 @@ public:
|
|||
const TRANSFORM& aTransform ) = 0;
|
||||
|
||||
/**
|
||||
* Function GetWidth
|
||||
* return the width of the draw item.
|
||||
* Return the width of the draw item.
|
||||
*
|
||||
* @return Width of draw object.
|
||||
*/
|
||||
virtual int GetWidth() const = 0;
|
||||
|
||||
/**
|
||||
* Function SetWidth
|
||||
* sets the width of the draw item to \a aWidth.
|
||||
* Set the width of the draw item to \a aWidth.
|
||||
*/
|
||||
virtual void SetWidth( int aWidth ) = 0;
|
||||
|
||||
|
@ -415,8 +389,7 @@ public:
|
|||
private:
|
||||
|
||||
/**
|
||||
* Function compare
|
||||
* provides the draw object specific comparison called by the == and < operators.
|
||||
* Provide the draw object specific comparison called by the == and < operators.
|
||||
*
|
||||
* The base object sort order which always proceeds the derived object sort order
|
||||
* is as follows:
|
||||
|
|
|
@ -109,51 +109,6 @@ void LIB_FIELD::Init( int id )
|
|||
}
|
||||
|
||||
|
||||
bool LIB_FIELD::Save( OUTPUTFORMATTER& aFormatter )
|
||||
{
|
||||
int hjustify, vjustify;
|
||||
wxString text = m_Text;
|
||||
|
||||
hjustify = 'C';
|
||||
|
||||
if( GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT )
|
||||
hjustify = 'L';
|
||||
else if( GetHorizJustify() == GR_TEXT_HJUSTIFY_RIGHT )
|
||||
hjustify = 'R';
|
||||
|
||||
vjustify = 'C';
|
||||
|
||||
if( GetVertJustify() == GR_TEXT_VJUSTIFY_BOTTOM )
|
||||
vjustify = 'B';
|
||||
else if( GetVertJustify() == GR_TEXT_VJUSTIFY_TOP )
|
||||
vjustify = 'T';
|
||||
|
||||
aFormatter.Print( 0, "F%d %s %d %d %d %c %c %c %c%c%c",
|
||||
m_id,
|
||||
EscapedUTF8( text ).c_str(), // wraps in quotes
|
||||
GetTextPos().x, GetTextPos().y, GetTextWidth(),
|
||||
GetTextAngle() == 0 ? 'H' : 'V',
|
||||
IsVisible() ? 'V' : 'I',
|
||||
hjustify, vjustify,
|
||||
IsItalic() ? 'I' : 'N',
|
||||
IsBold() ? 'B' : 'N' );
|
||||
|
||||
/* Save field name, if necessary
|
||||
* Field name is saved only if it is not the default name.
|
||||
* Just because default name depends on the language and can change from
|
||||
* a country to an other
|
||||
*/
|
||||
wxString defName = TEMPLATE_FIELDNAME::GetDefaultFieldName( m_id );
|
||||
|
||||
if( m_id >= FIELD1 && !m_name.IsEmpty() && m_name != defName )
|
||||
aFormatter.Print( 0, " %s", EscapedUTF8( m_name ).c_str() );
|
||||
|
||||
aFormatter.Print( 0, "\n" );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
int LIB_FIELD::GetPenSize() const
|
||||
{
|
||||
return GetThickness() == 0 ? GetDefaultLineThickness() : GetThickness();
|
||||
|
|
|
@ -37,8 +37,7 @@ class SCH_LEGACY_PLUGIN_CACHE;
|
|||
|
||||
|
||||
/**
|
||||
* Class LIB_FIELD
|
||||
* is used in symbol libraries. At least MANDATORY_FIELDS are always present
|
||||
* Field object used in symbol libraries. At least MANDATORY_FIELDS are always present
|
||||
* in a ram resident library symbol. All constructors must ensure this because
|
||||
* the component property editor assumes it.
|
||||
* <p>
|
||||
|
@ -121,9 +120,7 @@ public:
|
|||
wxString GetName( bool aTranslate = true ) const;
|
||||
|
||||
/**
|
||||
* Function SetName
|
||||
*
|
||||
* Sets a user definable field name to \a aName.
|
||||
* Set a user definable field name to \a aName.
|
||||
*
|
||||
* Reserved fields such as value and reference are not renamed. If the field name is
|
||||
* changed, the field modified flag is set. If the field is the child of a component,
|
||||
|
@ -139,8 +136,6 @@ public:
|
|||
|
||||
int GetPenSize( ) const override;
|
||||
|
||||
bool Save( OUTPUTFORMATTER& aFormatter ) override;
|
||||
|
||||
/**
|
||||
* Copy parameters of this field to another field. Pointers are not copied.
|
||||
*
|
||||
|
@ -151,7 +146,6 @@ public:
|
|||
void SetFields( const std::vector <LIB_FIELD> aFields );
|
||||
|
||||
/**
|
||||
* Function IsVoid
|
||||
* @return true if the field value is void (no text in this field)
|
||||
*/
|
||||
bool IsVoid() const
|
||||
|
@ -160,7 +154,6 @@ public:
|
|||
}
|
||||
|
||||
/**
|
||||
* Function IsVisible
|
||||
* @return true is this field is visible, false if flagged invisible
|
||||
*/
|
||||
bool IsVisible() const { return EDA_TEXT::IsVisible(); } // why needed?
|
||||
|
|
|
@ -27,6 +27,8 @@
|
|||
* @file lib_pin.cpp
|
||||
*/
|
||||
|
||||
#include <wx/tokenzr.h>
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <pgm_base.h>
|
||||
#include <gr_basic.h>
|
||||
|
@ -36,7 +38,6 @@
|
|||
#include <drawtxt.h>
|
||||
#include <class_plotter.h>
|
||||
#include <schframe.h>
|
||||
#include <richio.h>
|
||||
#include <base_units.h>
|
||||
#include <msgpanel.h>
|
||||
|
||||
|
@ -560,145 +561,6 @@ bool LIB_PIN::HitTest( const wxPoint &aPosition, int aThreshold, const TRANSFORM
|
|||
}
|
||||
|
||||
|
||||
bool LIB_PIN::Save( OUTPUTFORMATTER& aFormatter )
|
||||
{
|
||||
int Etype;
|
||||
|
||||
switch( m_type )
|
||||
{
|
||||
default:
|
||||
case PIN_INPUT:
|
||||
Etype = 'I';
|
||||
break;
|
||||
|
||||
case PIN_OUTPUT:
|
||||
Etype = 'O';
|
||||
break;
|
||||
|
||||
case PIN_BIDI:
|
||||
Etype = 'B';
|
||||
break;
|
||||
|
||||
case PIN_TRISTATE:
|
||||
Etype = 'T';
|
||||
break;
|
||||
|
||||
case PIN_PASSIVE:
|
||||
Etype = 'P';
|
||||
break;
|
||||
|
||||
case PIN_UNSPECIFIED:
|
||||
Etype = 'U';
|
||||
break;
|
||||
|
||||
case PIN_POWER_IN:
|
||||
Etype = 'W';
|
||||
break;
|
||||
|
||||
case PIN_POWER_OUT:
|
||||
Etype = 'w';
|
||||
break;
|
||||
|
||||
case PIN_OPENCOLLECTOR:
|
||||
Etype = 'C';
|
||||
break;
|
||||
|
||||
case PIN_OPENEMITTER:
|
||||
Etype = 'E';
|
||||
break;
|
||||
|
||||
case PIN_NC:
|
||||
Etype = 'N';
|
||||
break;
|
||||
}
|
||||
|
||||
if( !m_name.IsEmpty() )
|
||||
{
|
||||
if( aFormatter.Print( 0, "X %s", TO_UTF8( m_name ) ) < 0 )
|
||||
return false;
|
||||
}
|
||||
else
|
||||
{
|
||||
if( aFormatter.Print( 0, "X ~" ) < 0 )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( aFormatter.Print( 0, " %s %d %d %d %c %d %d %d %d %c",
|
||||
m_number.IsEmpty() ? "~" : TO_UTF8( m_number ),
|
||||
m_position.x, m_position.y,
|
||||
(int) m_length, (int) m_orientation, m_numTextSize, m_nameTextSize,
|
||||
m_Unit, m_Convert, Etype ) < 0 )
|
||||
return false;
|
||||
|
||||
if( m_shape || !IsVisible() )
|
||||
{
|
||||
if( aFormatter.Print( 0, " " ) < 0 )
|
||||
return false;
|
||||
}
|
||||
|
||||
if( !IsVisible() && aFormatter.Print( 0, "N" ) < 0 )
|
||||
return false;
|
||||
|
||||
switch( m_shape )
|
||||
{
|
||||
case PINSHAPE_LINE:
|
||||
break;
|
||||
|
||||
case PINSHAPE_INVERTED:
|
||||
if( aFormatter.Print( 0, "I" ) < 0 )
|
||||
return false;
|
||||
break;
|
||||
|
||||
case PINSHAPE_CLOCK:
|
||||
if( aFormatter.Print( 0, "C" ) < 0 )
|
||||
return false;
|
||||
break;
|
||||
|
||||
case PINSHAPE_INVERTED_CLOCK:
|
||||
if( aFormatter.Print( 0, "IC" ) < 0 )
|
||||
return false;
|
||||
break;
|
||||
|
||||
case PINSHAPE_INPUT_LOW:
|
||||
if( aFormatter.Print( 0, "L" ) < 0 )
|
||||
return false;
|
||||
break;
|
||||
|
||||
case PINSHAPE_CLOCK_LOW:
|
||||
if( aFormatter.Print( 0, "CL" ) < 0 )
|
||||
return false;
|
||||
break;
|
||||
|
||||
case PINSHAPE_OUTPUT_LOW:
|
||||
if( aFormatter.Print( 0, "V" ) < 0 )
|
||||
return false;
|
||||
break;
|
||||
|
||||
case PINSHAPE_FALLING_EDGE_CLOCK:
|
||||
if( aFormatter.Print( 0, "F" ) < 0 )
|
||||
return false;
|
||||
break;
|
||||
|
||||
case PINSHAPE_NONLOGIC:
|
||||
if( aFormatter.Print( 0, "X" ) < 0 )
|
||||
return false;
|
||||
break;
|
||||
|
||||
default:
|
||||
assert( !"Invalid pin shape" );
|
||||
return false;
|
||||
}
|
||||
|
||||
if( aFormatter.Print( 0, "\n" ) < 0 )
|
||||
return false;
|
||||
|
||||
ClearFlags( IS_CHANGED );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
#include <wx/tokenzr.h>
|
||||
|
||||
int LIB_PIN::GetPenSize() const
|
||||
{
|
||||
return ( m_width == 0 ) ? GetDefaultLineThickness() : m_width;
|
||||
|
|
|
@ -114,8 +114,6 @@ public:
|
|||
void Show( int nestLevel, std::ostream& os ) const override;
|
||||
#endif
|
||||
|
||||
bool Save( OUTPUTFORMATTER& aFormatter ) override;
|
||||
|
||||
bool HitTest( const wxPoint& aPosition ) const override;
|
||||
|
||||
bool HitTest( const wxPoint &aPosRef, int aThreshold, const TRANSFORM& aTransform ) const override;
|
||||
|
@ -136,23 +134,19 @@ public:
|
|||
const EDA_RECT GetBoundingBox() const override { return GetBoundingBox( false ); }
|
||||
|
||||
/**
|
||||
* Function GetBoundingBox
|
||||
* @param aIncludeInvisibles - if false, do not include labels for invisible pins
|
||||
* in the calculation.
|
||||
*/
|
||||
const EDA_RECT GetBoundingBox( bool aIncludeInvisibles ) const;
|
||||
|
||||
/**
|
||||
* Function PinEndPoint
|
||||
*
|
||||
* @return The pin end position for a component in the normal orientation.
|
||||
*/
|
||||
wxPoint PinEndPoint() const;
|
||||
|
||||
/**
|
||||
* Function PinDrawOrient
|
||||
* returns the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT),
|
||||
* according to its orientation and the matrix transform (rot, mirror) \a aTransform
|
||||
* Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT),
|
||||
* according to its orientation and the matrix transform (rot, mirror) \a aTransform.
|
||||
*
|
||||
* @param aTransform Transform matrix
|
||||
*/
|
||||
|
@ -369,7 +363,6 @@ public:
|
|||
int GetPenSize() const override;
|
||||
|
||||
/**
|
||||
* Function DrawPinSymbol
|
||||
* Draw the pin symbol without text.
|
||||
* If \a aColor != 0, draw with \a aColor, else with the normal pin color.
|
||||
*/
|
||||
|
@ -380,8 +373,7 @@ public:
|
|||
bool aOnlyTarget = false );
|
||||
|
||||
/**
|
||||
* Function DrawPinTexts
|
||||
* puts the pin number and pin text info, given the pin line coordinates.
|
||||
* Put the pin number and pin text info, given the pin line coordinates.
|
||||
* The line must be vertical or horizontal.
|
||||
* If DrawPinName == false the pin name is not printed.
|
||||
* If DrawPinNum = false the pin number is not printed.
|
||||
|
@ -394,16 +386,14 @@ public:
|
|||
COLOR4D aColor, GR_DRAWMODE aDrawMode );
|
||||
|
||||
/**
|
||||
* Function DrawPinElectricalTypeName
|
||||
* draws the electrical type text of the pin (only for the footprint editor)
|
||||
* Draw the electrical type text of the pin (only for the footprint editor)
|
||||
* aDrawMode = GR_OR, XOR ...
|
||||
*/
|
||||
void DrawPinElectricalTypeName( EDA_DRAW_PANEL* aPanel, wxDC* aDC, wxPoint& aPosition,
|
||||
int aOrientation, COLOR4D aColor, GR_DRAWMODE aDrawMode );
|
||||
|
||||
/**
|
||||
* Function PlotPinTexts
|
||||
* plots the pin number and pin text info, given the pin line coordinates.
|
||||
* Plot the pin number and pin text info, given the pin line coordinates.
|
||||
* Same as DrawPinTexts((), but output is the plotter
|
||||
* The line must be vertical or horizontal.
|
||||
* If TextInside then the text is been put inside (moving from x1, y1 in
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include <class_plotter.h>
|
||||
#include <trigo.h>
|
||||
#include <wxstruct.h>
|
||||
#include <richio.h>
|
||||
#include <base_units.h>
|
||||
#include <msgpanel.h>
|
||||
#include <bitmaps.h>
|
||||
|
@ -54,23 +53,6 @@ LIB_POLYLINE::LIB_POLYLINE( LIB_PART* aParent ) :
|
|||
}
|
||||
|
||||
|
||||
bool LIB_POLYLINE::Save( OUTPUTFORMATTER& aFormatter )
|
||||
{
|
||||
int ccount = GetCornerCount();
|
||||
|
||||
aFormatter.Print( 0, "P %d %d %d %d", ccount, m_Unit, m_Convert, m_Width );
|
||||
|
||||
for( unsigned i = 0; i < GetCornerCount(); i++ )
|
||||
{
|
||||
aFormatter.Print( 0, " %d %d", m_PolyPoints[i].x, m_PolyPoints[i].y );
|
||||
}
|
||||
|
||||
aFormatter.Print( 0, " %c\n", fill_tab[m_Fill] );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
EDA_ITEM* LIB_POLYLINE::Clone() const
|
||||
{
|
||||
return new LIB_POLYLINE( *this );
|
||||
|
|
|
@ -58,10 +58,10 @@ public:
|
|||
}
|
||||
|
||||
|
||||
bool Save( OUTPUTFORMATTER& aFormatter ) override;
|
||||
|
||||
void AddPoint( const wxPoint& aPoint );
|
||||
|
||||
const std::vector< wxPoint >& GetPolyPoints() const { return m_PolyPoints; }
|
||||
|
||||
/**
|
||||
* Delete the segment at \a aPosition.
|
||||
*/
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include <class_plotter.h>
|
||||
#include <trigo.h>
|
||||
#include <wxstruct.h>
|
||||
#include <richio.h>
|
||||
#include <base_units.h>
|
||||
#include <msgpanel.h>
|
||||
#include <bitmaps.h>
|
||||
|
@ -56,15 +55,6 @@ LIB_RECTANGLE::LIB_RECTANGLE( LIB_PART* aParent ) :
|
|||
}
|
||||
|
||||
|
||||
bool LIB_RECTANGLE::Save( OUTPUTFORMATTER& aFormatter )
|
||||
{
|
||||
aFormatter.Print( 0, "S %d %d %d %d %d %d %d %c\n", m_Pos.x, m_Pos.y,
|
||||
m_End.x, m_End.y, m_Unit, m_Convert, m_Width, fill_tab[m_Fill] );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
EDA_ITEM* LIB_RECTANGLE::Clone() const
|
||||
{
|
||||
return new LIB_RECTANGLE( *this );
|
||||
|
|
|
@ -61,8 +61,6 @@ public:
|
|||
|
||||
void SetEndPosition( const wxPoint& aPosition ) { m_End = aPosition; }
|
||||
|
||||
bool Save( OUTPUTFORMATTER& aFormatter ) override;
|
||||
|
||||
bool HitTest( const wxPoint& aPosition ) const override;
|
||||
|
||||
bool HitTest( const wxPoint &aPosRef, int aThreshold, const TRANSFORM& aTransform ) const override;
|
||||
|
|
|
@ -33,7 +33,6 @@
|
|||
#include <drawtxt.h>
|
||||
#include <trigo.h>
|
||||
#include <wxstruct.h>
|
||||
#include <richio.h>
|
||||
#include <base_units.h>
|
||||
#include <msgpanel.h>
|
||||
#include <bitmaps.h>
|
||||
|
@ -55,49 +54,6 @@ LIB_TEXT::LIB_TEXT( LIB_PART * aParent ) :
|
|||
}
|
||||
|
||||
|
||||
bool LIB_TEXT::Save( OUTPUTFORMATTER& aFormatter )
|
||||
{
|
||||
wxString text = m_Text;
|
||||
|
||||
if( text.Contains( wxT( "~" ) ) || text.Contains( wxT( "\"" ) ) )
|
||||
{
|
||||
// convert double quote to similar-looking two apostrophes
|
||||
text.Replace( wxT( "\"" ), wxT( "''" ) );
|
||||
text = wxT( "\"" ) + text + wxT( "\"" );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Spaces are not allowed in text because it is not double quoted:
|
||||
// changed to '~'
|
||||
text.Replace( wxT( " " ), wxT( "~" ) );
|
||||
}
|
||||
|
||||
aFormatter.Print( 0, "T %g %d %d %d %d %d %d %s", GetTextAngle(),
|
||||
GetTextPos().x, GetTextPos().y,
|
||||
GetTextWidth(), !IsVisible(), m_Unit, m_Convert, TO_UTF8( text ) );
|
||||
|
||||
aFormatter.Print( 0, " %s %d", IsItalic() ? "Italic" : "Normal", IsBold() );
|
||||
|
||||
char hjustify = 'C';
|
||||
|
||||
if( GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT )
|
||||
hjustify = 'L';
|
||||
else if( GetHorizJustify() == GR_TEXT_HJUSTIFY_RIGHT )
|
||||
hjustify = 'R';
|
||||
|
||||
char vjustify = 'C';
|
||||
|
||||
if( GetVertJustify() == GR_TEXT_VJUSTIFY_BOTTOM )
|
||||
vjustify = 'B';
|
||||
else if( GetVertJustify() == GR_TEXT_VJUSTIFY_TOP )
|
||||
vjustify = 'T';
|
||||
|
||||
aFormatter.Print( 0, " %c %c\n", hjustify, vjustify );
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool LIB_TEXT::HitTest( const wxPoint& aPosition ) const
|
||||
{
|
||||
return HitTest( aPosition, 0, DefaultTransform );
|
||||
|
|
|
@ -34,11 +34,10 @@
|
|||
|
||||
|
||||
/**
|
||||
* Class LIB_TEXT
|
||||
* defines a component library graphical text item.
|
||||
* Define a symbol library graphical text item.
|
||||
* <p>
|
||||
* This is only a graphical text item. Field text like the reference designator,
|
||||
* component value, etc. are not LIB_TEXT items. See the #LIB_FIELD class for the
|
||||
* symbol value, etc. are not LIB_TEXT items. See the #LIB_FIELD class for the
|
||||
* field item definition.
|
||||
* </p>
|
||||
*/
|
||||
|
@ -78,8 +77,6 @@ public:
|
|||
*/
|
||||
void SetText( const wxString& aText ) override;
|
||||
|
||||
bool Save( OUTPUTFORMATTER& aFormatter ) override;
|
||||
|
||||
bool HitTest( const wxPoint& aPosition ) const override;
|
||||
|
||||
bool HitTest( const wxPoint &aPosition, int aThreshold, const TRANSFORM& aTransform ) const override;
|
||||
|
|
|
@ -407,14 +407,14 @@ XNODE* NETLIST_EXPORTER_GENERIC::makeLibParts()
|
|||
xlibpart->AddChild( node( "docs", lcomp->GetAlias( 0 )->GetDocFileName() ) );
|
||||
|
||||
// Write the footprint list
|
||||
if( lcomp->GetFootPrints().GetCount() )
|
||||
if( lcomp->GetFootprints().GetCount() )
|
||||
{
|
||||
XNODE* xfootprints;
|
||||
xlibpart->AddChild( xfootprints = node( "footprints" ) );
|
||||
|
||||
for( unsigned i=0; i<lcomp->GetFootPrints().GetCount(); ++i )
|
||||
for( unsigned i=0; i<lcomp->GetFootprints().GetCount(); ++i )
|
||||
{
|
||||
xfootprints->AddChild( node( "fp", lcomp->GetFootPrints()[i] ) );
|
||||
xfootprints->AddChild( node( "fp", lcomp->GetFootprints()[i] ) );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -86,7 +86,7 @@ bool NETLIST_EXPORTER_ORCADPCB2::WriteNetlist( const wxString& aOutFileName,
|
|||
|
||||
if( part )
|
||||
{
|
||||
if( part->GetFootPrints().GetCount() != 0 ) // Put in list
|
||||
if( part->GetFootprints().GetCount() != 0 ) // Put in list
|
||||
{
|
||||
cmpList.push_back( SCH_REFERENCE( comp, part.get(), sheetList[i] ) );
|
||||
}
|
||||
|
|
|
@ -34,8 +34,6 @@
|
|||
#include <class_base_screen.h>
|
||||
#include <general.h>
|
||||
|
||||
#include <boost/ptr_container/ptr_vector.hpp>
|
||||
|
||||
class SCH_ITEM;
|
||||
class SCH_SHEET_PATH;
|
||||
class LINE_READER;
|
||||
|
@ -46,13 +44,6 @@ class NETLIST_OBJECT;
|
|||
class NETLIST_OBJECT_LIST;
|
||||
|
||||
|
||||
typedef boost::ptr_vector< SCH_ITEM > SCH_ITEMS;
|
||||
typedef SCH_ITEMS::iterator SCH_ITEMS_ITR;
|
||||
typedef std::vector< SCH_ITEMS_ITR > SCH_ITEMS_ITRS;
|
||||
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* @ingroup trace_env_vars
|
||||
*
|
||||
|
|
|
@ -35,16 +35,15 @@
|
|||
#include <properties.h>
|
||||
|
||||
#include <general.h>
|
||||
#include <lib_field.h>
|
||||
#include <sch_bitmap.h>
|
||||
#include <sch_bus_entry.h>
|
||||
#include <sch_marker.h>
|
||||
#include <sch_component.h>
|
||||
#include <sch_junction.h>
|
||||
#include <sch_line.h>
|
||||
#include <sch_marker.h>
|
||||
#include <sch_no_connect.h>
|
||||
#include <sch_component.h>
|
||||
#include <sch_text.h>
|
||||
#include <sch_sheet.h>
|
||||
#include <sch_bitmap.h>
|
||||
#include <sch_legacy_plugin.h>
|
||||
#include <template_fieldnames.h>
|
||||
#include <class_sch_screen.h>
|
||||
|
@ -53,6 +52,7 @@
|
|||
#include <lib_arc.h>
|
||||
#include <lib_bezier.h>
|
||||
#include <lib_circle.h>
|
||||
#include <lib_field.h>
|
||||
#include <lib_pin.h>
|
||||
#include <lib_polyline.h>
|
||||
#include <lib_rectangle.h>
|
||||
|
@ -102,9 +102,7 @@ static bool is_eol( char c )
|
|||
|
||||
|
||||
/**
|
||||
* Function strCompare
|
||||
*
|
||||
* compares \a aString to the string starting at \a aLine and advances the character point to
|
||||
* Compare \a aString to the string starting at \a aLine and advances the character point to
|
||||
* the end of \a String and returns the new pointer position in \a aOutput if it is not NULL.
|
||||
*
|
||||
* @param aString - A pointer to the string to compare.
|
||||
|
@ -137,9 +135,7 @@ static bool strCompare( const char* aString, const char* aLine, const char** aOu
|
|||
|
||||
|
||||
/**
|
||||
* Function parseInt
|
||||
*
|
||||
* parses an ASCII integer string with possible leading whitespace into
|
||||
* Parse an ASCII integer string with possible leading whitespace into
|
||||
* an integer and updates the pointer at \a aOutput if it is not NULL, just
|
||||
* like "man strtol()".
|
||||
*
|
||||
|
@ -148,8 +144,8 @@ static bool strCompare( const char* aString, const char* aLine, const char** aOu
|
|||
* @param aOutput - The pointer to a string pointer to copy the string pointer position when
|
||||
* the parsing is complete.
|
||||
* @return A valid integer value.
|
||||
* @throws An #IO_ERROR on an unexpected end of line.
|
||||
* @throws A #PARSE_ERROR if the parsed token is not a valid integer.
|
||||
* @throw An #IO_ERROR on an unexpected end of line.
|
||||
* @throw A #PARSE_ERROR if the parsed token is not a valid integer.
|
||||
*/
|
||||
static int parseInt( FILE_LINE_READER& aReader, const char* aLine, const char** aOutput = NULL )
|
||||
{
|
||||
|
@ -181,9 +177,7 @@ static int parseInt( FILE_LINE_READER& aReader, const char* aLine, const char**
|
|||
|
||||
|
||||
/**
|
||||
* Function parseHex
|
||||
*
|
||||
* parses an ASCII hex integer string with possible leading whitespace into
|
||||
* Parse an ASCII hex integer string with possible leading whitespace into
|
||||
* a long integer and updates the pointer at \a aOutput if it is not NULL, just
|
||||
* like "man strtol".
|
||||
*
|
||||
|
@ -192,8 +186,8 @@ static int parseInt( FILE_LINE_READER& aReader, const char* aLine, const char**
|
|||
* @param aOutput - The pointer to a string pointer to copy the string pointer position when
|
||||
* the parsing is complete.
|
||||
* @return A valid integer value.
|
||||
* @throws An #IO_ERROR on an unexpected end of line.
|
||||
* @throws A #PARSE_ERROR if the parsed token is not a valid integer.
|
||||
* @throw IO_ERROR on an unexpected end of line.
|
||||
* @throw PARSE_ERROR if the parsed token is not a valid integer.
|
||||
*/
|
||||
static unsigned long parseHex( FILE_LINE_READER& aReader, const char* aLine,
|
||||
const char** aOutput = NULL )
|
||||
|
@ -229,9 +223,7 @@ static unsigned long parseHex( FILE_LINE_READER& aReader, const char* aLine,
|
|||
|
||||
|
||||
/**
|
||||
* Function parseDouble
|
||||
*
|
||||
* parses an ASCII point string with possible leading whitespace into a double precision
|
||||
* Parses an ASCII point string with possible leading whitespace into a double precision
|
||||
* floating point number and updates the pointer at \a aOutput if it is not NULL, just
|
||||
* like "man strtod".
|
||||
*
|
||||
|
@ -240,8 +232,8 @@ static unsigned long parseHex( FILE_LINE_READER& aReader, const char* aLine,
|
|||
* @param aOutput - The pointer to a string pointer to copy the string pointer position when
|
||||
* the parsing is complete.
|
||||
* @return A valid double value.
|
||||
* @throws An #IO_ERROR on an unexpected end of line.
|
||||
* @throws A #PARSE_ERROR if the parsed token is not a valid integer.
|
||||
* @throw IO_ERROR on an unexpected end of line.
|
||||
* @throw PARSE_ERROR if the parsed token is not a valid integer.
|
||||
*/
|
||||
static double parseDouble( FILE_LINE_READER& aReader, const char* aLine,
|
||||
const char** aOutput = NULL )
|
||||
|
@ -274,17 +266,15 @@ static double parseDouble( FILE_LINE_READER& aReader, const char* aLine,
|
|||
|
||||
|
||||
/**
|
||||
* Function parseChar
|
||||
*
|
||||
* parses a single ASCII character and updates the pointer at \a aOutput if it is not NULL.
|
||||
* Parse a single ASCII character and updates the pointer at \a aOutput if it is not NULL.
|
||||
*
|
||||
* @param aReader - The line reader used to generate exception throw information.
|
||||
* @param aCurrentToken - A pointer the current position in a string.
|
||||
* @param aNextToken - The pointer to a string pointer to copy the string pointer position when
|
||||
* the parsing is complete.
|
||||
* @return A valid ASCII character.
|
||||
* @throws An #IO_ERROR on an unexpected end of line.
|
||||
* @throws A #PARSE_ERROR if the parsed token is not a a single character token.
|
||||
* @throw IO_ERROR on an unexpected end of line.
|
||||
* @throw PARSE_ERROR if the parsed token is not a a single character token.
|
||||
*/
|
||||
static char parseChar( FILE_LINE_READER& aReader, const char* aCurrentToken,
|
||||
const char** aNextToken = NULL )
|
||||
|
@ -313,9 +303,7 @@ static char parseChar( FILE_LINE_READER& aReader, const char* aCurrentToken,
|
|||
|
||||
|
||||
/**
|
||||
* Function parseUnquotedString.
|
||||
*
|
||||
* parses an unquoted utf8 string and updates the pointer at \a aOutput if it is not NULL.
|
||||
* Parse an unquoted utf8 string and updates the pointer at \a aOutput if it is not NULL.
|
||||
*
|
||||
* The parsed string must be a continuous string with no white space.
|
||||
*
|
||||
|
@ -325,8 +313,8 @@ static char parseChar( FILE_LINE_READER& aReader, const char* aCurrentToken,
|
|||
* @param aNextToken - The pointer to a string pointer to copy the string pointer position when
|
||||
* the parsing is complete.
|
||||
* @param aCanBeEmpty - True if the parsed string is optional. False if it is mandatory.
|
||||
* @throws An #IO_ERROR on an unexpected end of line.
|
||||
* @throws A #PARSE_ERROR if the \a aCanBeEmpty is false and no string was parsed.
|
||||
* @throw IO_ERROR on an unexpected end of line.
|
||||
* @throw PARSE_ERROR if the \a aCanBeEmpty is false and no string was parsed.
|
||||
*/
|
||||
static void parseUnquotedString( wxString& aString, FILE_LINE_READER& aReader,
|
||||
const char* aCurrentToken, const char** aNextToken = NULL,
|
||||
|
@ -376,9 +364,7 @@ static void parseUnquotedString( wxString& aString, FILE_LINE_READER& aReader,
|
|||
|
||||
|
||||
/**
|
||||
* Function parseQuotedString.
|
||||
*
|
||||
* parses an quoted ASCII utf8 and updates the pointer at \a aOutput if it is not NULL.
|
||||
* Parse an quoted ASCII utf8 and updates the pointer at \a aOutput if it is not NULL.
|
||||
*
|
||||
* The parsed string must be contained within a single line. There are no multi-line
|
||||
* quoted strings in the legacy schematic file format.
|
||||
|
@ -389,8 +375,8 @@ static void parseUnquotedString( wxString& aString, FILE_LINE_READER& aReader,
|
|||
* @param aNextToken - The pointer to a string pointer to copy the string pointer position when
|
||||
* the parsing is complete.
|
||||
* @param aCanBeEmpty - True if the parsed string is optional. False if it is mandatory.
|
||||
* @throws An #IO_ERROR on an unexpected end of line.
|
||||
* @throws A #PARSE_ERROR if the \a aCanBeEmpty is false and no string was parsed.
|
||||
* @throw IO_ERROR on an unexpected end of line.
|
||||
* @throw PARSE_ERROR if the \a aCanBeEmpty is false and no string was parsed.
|
||||
*/
|
||||
static void parseQuotedString( wxString& aString, FILE_LINE_READER& aReader,
|
||||
const char* aCurrentToken, const char** aNextToken = NULL,
|
||||
|
@ -477,8 +463,7 @@ static void parseQuotedString( wxString& aString, FILE_LINE_READER& aReader,
|
|||
|
||||
|
||||
/**
|
||||
* Class SCH_LEGACY_PLUGIN_CACHE
|
||||
* is a cache assistant for the part library portion of the #SCH_PLUGIN API, and only for the
|
||||
* A cache assistant for the part library portion of the #SCH_PLUGIN API, and only for the
|
||||
* #SCH_LEGACY_PLUGIN, so therefore is private to this implementation file, i.e. not placed
|
||||
* into a header.
|
||||
*/
|
||||
|
@ -518,6 +503,22 @@ class SCH_LEGACY_PLUGIN_CACHE
|
|||
LIB_ALIAS* removeAlias( LIB_ALIAS* aAlias );
|
||||
|
||||
void saveDocFile();
|
||||
void saveSymbol( LIB_PART* aSymbol,
|
||||
std::unique_ptr< FILE_OUTPUTFORMATTER >& aFormatter );
|
||||
void saveArc( LIB_ARC* aArc, std::unique_ptr< FILE_OUTPUTFORMATTER >& aFormatter );
|
||||
void saveBezier( LIB_BEZIER* aBezier,
|
||||
std::unique_ptr< FILE_OUTPUTFORMATTER >& aFormatter );
|
||||
void saveCircle( LIB_CIRCLE* aCircle,
|
||||
std::unique_ptr< FILE_OUTPUTFORMATTER >& aFormatter );
|
||||
void saveField( LIB_FIELD* aField,
|
||||
std::unique_ptr< FILE_OUTPUTFORMATTER >& aFormatter );
|
||||
void savePin( LIB_PIN* aPin, std::unique_ptr< FILE_OUTPUTFORMATTER >& aFormatter );
|
||||
void savePolyLine( LIB_POLYLINE* aPolyLine,
|
||||
std::unique_ptr< FILE_OUTPUTFORMATTER >& aFormatter );
|
||||
void saveRectangle( LIB_RECTANGLE* aRectangle,
|
||||
std::unique_ptr< FILE_OUTPUTFORMATTER >& aFormatter );
|
||||
void saveText( LIB_TEXT* aText,
|
||||
std::unique_ptr< FILE_OUTPUTFORMATTER >& aFormatter );
|
||||
|
||||
friend SCH_LEGACY_PLUGIN;
|
||||
|
||||
|
@ -3364,7 +3365,7 @@ void SCH_LEGACY_PLUGIN_CACHE::loadFootprintFilters( std::unique_ptr< LIB_PART >&
|
|||
wxString footprint;
|
||||
|
||||
parseUnquotedString( footprint, aReader, line, &line );
|
||||
aPart->GetFootPrints().Add( footprint );
|
||||
aPart->GetFootprints().Add( footprint );
|
||||
line = aReader.ReadLine();
|
||||
}
|
||||
|
||||
|
@ -3386,7 +3387,7 @@ void SCH_LEGACY_PLUGIN_CACHE::Save( bool aSaveDocFile )
|
|||
if( !it->second->IsRoot() )
|
||||
continue;
|
||||
|
||||
it->second->GetPart()->Save( *formatter.get() );
|
||||
saveSymbol( it->second->GetPart(), formatter );
|
||||
}
|
||||
|
||||
formatter->Print( 0, "#\n#End Library\n" );
|
||||
|
@ -3400,18 +3401,505 @@ void SCH_LEGACY_PLUGIN_CACHE::Save( bool aSaveDocFile )
|
|||
}
|
||||
|
||||
|
||||
void SCH_LEGACY_PLUGIN_CACHE::saveSymbol( LIB_PART* aSymbol,
|
||||
std::unique_ptr< FILE_OUTPUTFORMATTER >& aFormatter )
|
||||
{
|
||||
wxCHECK_RET( aSymbol, "Invalid LIB_PART pointer." );
|
||||
|
||||
LIB_FIELD& value = aSymbol->GetValueField();
|
||||
|
||||
// First line: it s a comment (component name for readers)
|
||||
aFormatter->Print( 0, "#\n# %s\n#\n", TO_UTF8( value.GetText() ) );
|
||||
|
||||
// Save data
|
||||
aFormatter->Print( 0, "DEF" );
|
||||
|
||||
if( value.IsVisible() )
|
||||
{
|
||||
aFormatter->Print( 0, " %s", TO_UTF8( value.GetText() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
aFormatter->Print( 0, " ~%s", TO_UTF8( value.GetText() ) );
|
||||
}
|
||||
|
||||
LIB_FIELD& reference = aSymbol->GetReferenceField();
|
||||
|
||||
if( !reference.GetText().IsEmpty() )
|
||||
{
|
||||
aFormatter->Print( 0, " %s", TO_UTF8( reference.GetText() ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
aFormatter->Print( 0, " ~" );
|
||||
}
|
||||
|
||||
aFormatter->Print( 0, " %d %d %c %c %d %c %c\n",
|
||||
0, aSymbol->GetPinNameOffset(),
|
||||
aSymbol->ShowPinNumbers() ? 'Y' : 'N',
|
||||
aSymbol->ShowPinNames() ? 'Y' : 'N',
|
||||
aSymbol->GetUnitCount(), aSymbol->UnitsLocked() ? 'L' : 'F',
|
||||
aSymbol->IsPower() ? 'P' : 'N' );
|
||||
|
||||
long dateModified = aSymbol->GetDateModified();
|
||||
|
||||
if( dateModified != 0 )
|
||||
{
|
||||
int year, mon, day, hour, min, sec;
|
||||
|
||||
sec = dateModified & 63;
|
||||
min = ( dateModified >> 6 ) & 63;
|
||||
hour = ( dateModified >> 12 ) & 31;
|
||||
day = ( dateModified >> 17 ) & 31;
|
||||
mon = ( dateModified >> 22 ) & 15;
|
||||
year = ( dateModified >> 26 ) + 1990;
|
||||
|
||||
aFormatter->Print( 0, "Ti %d/%d/%d %d:%d:%d\n", year, mon, day, hour, min, sec );
|
||||
}
|
||||
|
||||
LIB_FIELDS fields;
|
||||
aSymbol->GetFields( fields );
|
||||
|
||||
// Mandatory fields:
|
||||
// may have their own save policy so there is a separate loop for them.
|
||||
// Empty fields are saved, because the user may have set visibility,
|
||||
// size and orientation
|
||||
for( int i = 0; i < MANDATORY_FIELDS; ++i )
|
||||
{
|
||||
saveField( &fields[i], aFormatter );
|
||||
}
|
||||
|
||||
// User defined fields:
|
||||
// may have their own save policy so there is a separate loop for them.
|
||||
|
||||
int fieldId = MANDATORY_FIELDS; // really wish this would go away.
|
||||
|
||||
for( unsigned i = MANDATORY_FIELDS; i < fields.size(); ++i )
|
||||
{
|
||||
// There is no need to save empty fields, i.e. no reason to preserve field
|
||||
// names now that fields names come in dynamically through the template
|
||||
// fieldnames.
|
||||
if( !fields[i].GetText().IsEmpty() )
|
||||
{
|
||||
fields[i].SetId( fieldId++ );
|
||||
saveField( &fields[i], aFormatter );
|
||||
}
|
||||
}
|
||||
|
||||
// Save the alias list: a line starting by "ALIAS". The first alias is the root
|
||||
// and has the same name as the component. In the old library file format this
|
||||
// alias does not get added to the alias list.
|
||||
if( aSymbol->GetAliasCount() > 1 )
|
||||
{
|
||||
wxArrayString aliases = aSymbol->GetAliasNames();
|
||||
|
||||
aFormatter->Print( 0, "ALIAS" );
|
||||
|
||||
for( unsigned i = 1; i < aliases.size(); i++ )
|
||||
{
|
||||
aFormatter->Print( 0, " %s", TO_UTF8( aliases[i] ) );
|
||||
}
|
||||
|
||||
aFormatter->Print( 0, "\n" );
|
||||
}
|
||||
|
||||
wxArrayString footprints = aSymbol->GetFootprints();
|
||||
|
||||
// Write the footprint filter list
|
||||
if( footprints.GetCount() != 0 )
|
||||
{
|
||||
aFormatter->Print( 0, "$FPLIST\n" );
|
||||
|
||||
for( unsigned i = 0; i < footprints.GetCount(); i++ )
|
||||
{
|
||||
aFormatter->Print( 0, " %s\n", TO_UTF8( footprints[i] ) );
|
||||
}
|
||||
|
||||
aFormatter->Print( 0, "$ENDFPLIST\n" );
|
||||
}
|
||||
|
||||
// Save graphics items (including pins)
|
||||
if( !aSymbol->GetDrawItems().empty() )
|
||||
{
|
||||
// Sort the draw items in order to editing a file editing by hand.
|
||||
aSymbol->GetDrawItems().sort();
|
||||
|
||||
aFormatter->Print( 0, "DRAW\n" );
|
||||
|
||||
for( LIB_ITEM& item : aSymbol->GetDrawItems() )
|
||||
{
|
||||
switch( item.Type() )
|
||||
{
|
||||
case LIB_FIELD_T: // Fields have already been saved above.
|
||||
continue;
|
||||
|
||||
case LIB_ARC_T:
|
||||
saveArc( (LIB_ARC*) &item, aFormatter );
|
||||
break;
|
||||
|
||||
case LIB_BEZIER_T:
|
||||
saveBezier( (LIB_BEZIER*) &item, aFormatter );
|
||||
break;
|
||||
|
||||
|
||||
case LIB_CIRCLE_T:
|
||||
saveCircle( ( LIB_CIRCLE* ) &item, aFormatter );
|
||||
break;
|
||||
|
||||
case LIB_PIN_T:
|
||||
savePin( (LIB_PIN* ) &item, aFormatter );
|
||||
break;
|
||||
|
||||
case LIB_POLYLINE_T:
|
||||
savePolyLine( ( LIB_POLYLINE* ) &item, aFormatter );
|
||||
break;
|
||||
|
||||
case LIB_RECTANGLE_T:
|
||||
saveRectangle( ( LIB_RECTANGLE* ) &item, aFormatter );
|
||||
break;
|
||||
|
||||
case LIB_TEXT_T:
|
||||
saveText( ( LIB_TEXT* ) &item, aFormatter );
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
aFormatter->Print( 0, "ENDDRAW\n" );
|
||||
}
|
||||
|
||||
aFormatter->Print( 0, "ENDDEF\n" );
|
||||
}
|
||||
|
||||
|
||||
void SCH_LEGACY_PLUGIN_CACHE::saveArc( LIB_ARC* aArc,
|
||||
std::unique_ptr< FILE_OUTPUTFORMATTER >& aFormatter )
|
||||
{
|
||||
wxCHECK_RET( aArc && aArc->Type() == LIB_ARC_T, "Invalid LIB_ARC object." );
|
||||
|
||||
int x1 = aArc->GetFirstRadiusAngle();
|
||||
|
||||
if( x1 > 1800 )
|
||||
x1 -= 3600;
|
||||
|
||||
int x2 = aArc->GetSecondRadiusAngle();
|
||||
|
||||
if( x2 > 1800 )
|
||||
x2 -= 3600;
|
||||
|
||||
aFormatter->Print( 0, "A %d %d %d %d %d %d %d %d %c %d %d %d %d\n",
|
||||
aArc->GetPosition().x, aArc->GetPosition().y,
|
||||
aArc->GetRadius(), x1, x2, aArc->GetUnit(), aArc->GetConvert(),
|
||||
aArc->GetWidth(), fill_tab[aArc->GetFillMode()],
|
||||
aArc->GetStart().x, aArc->GetStart().y,
|
||||
aArc->GetEnd().x, aArc->GetEnd().y );
|
||||
}
|
||||
|
||||
|
||||
void SCH_LEGACY_PLUGIN_CACHE::saveBezier( LIB_BEZIER* aBezier,
|
||||
std::unique_ptr< FILE_OUTPUTFORMATTER >& aFormatter )
|
||||
{
|
||||
wxCHECK_RET( aBezier && aBezier->Type() == LIB_BEZIER_T, "Invalid LIB_BEZIER object." );
|
||||
|
||||
aFormatter->Print( 0, "B %lu %d %d %d", (unsigned long)aBezier->GetCornerCount(),
|
||||
aBezier->GetUnit(), aBezier->GetConvert(), aBezier->GetWidth() );
|
||||
|
||||
for( const auto& pt : aBezier->GetPoints() )
|
||||
aFormatter->Print( 0, " %d %d", pt.x, pt.y );
|
||||
|
||||
aFormatter->Print( 0, " %c\n", fill_tab[aBezier->GetFillMode()] );
|
||||
}
|
||||
|
||||
|
||||
void SCH_LEGACY_PLUGIN_CACHE::saveCircle( LIB_CIRCLE* aCircle,
|
||||
std::unique_ptr< FILE_OUTPUTFORMATTER >& aFormatter )
|
||||
{
|
||||
wxCHECK_RET( aCircle && aCircle->Type() == LIB_CIRCLE_T, "Invalid LIB_CIRCLE object." );
|
||||
|
||||
aFormatter->Print( 0, "C %d %d %d %d %d %d %c\n",
|
||||
aCircle->GetPosition().x, aCircle->GetPosition().y,
|
||||
aCircle->GetRadius(), aCircle->GetUnit(), aCircle->GetConvert(),
|
||||
aCircle->GetWidth(), fill_tab[aCircle->GetFillMode()] );
|
||||
}
|
||||
|
||||
|
||||
void SCH_LEGACY_PLUGIN_CACHE::saveField( LIB_FIELD* aField,
|
||||
std::unique_ptr< FILE_OUTPUTFORMATTER >& aFormatter )
|
||||
{
|
||||
wxCHECK_RET( aField && aField->Type() == LIB_FIELD_T, "Invalid LIB_FIELD object." );
|
||||
|
||||
int hjustify, vjustify;
|
||||
int id = aField->GetId();
|
||||
wxString text = aField->m_Text;
|
||||
|
||||
hjustify = 'C';
|
||||
|
||||
if( aField->GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT )
|
||||
hjustify = 'L';
|
||||
else if( aField->GetHorizJustify() == GR_TEXT_HJUSTIFY_RIGHT )
|
||||
hjustify = 'R';
|
||||
|
||||
vjustify = 'C';
|
||||
|
||||
if( aField->GetVertJustify() == GR_TEXT_VJUSTIFY_BOTTOM )
|
||||
vjustify = 'B';
|
||||
else if( aField->GetVertJustify() == GR_TEXT_VJUSTIFY_TOP )
|
||||
vjustify = 'T';
|
||||
|
||||
aFormatter->Print( 0, "F%d %s %d %d %d %c %c %c %c%c%c",
|
||||
id,
|
||||
EscapedUTF8( text ).c_str(), // wraps in quotes
|
||||
aField->GetTextPos().x, aField->GetTextPos().y, aField->GetTextWidth(),
|
||||
aField->GetTextAngle() == 0 ? 'H' : 'V',
|
||||
aField->IsVisible() ? 'V' : 'I',
|
||||
hjustify, vjustify,
|
||||
aField->IsItalic() ? 'I' : 'N',
|
||||
aField->IsBold() ? 'B' : 'N' );
|
||||
|
||||
/* Save field name, if necessary
|
||||
* Field name is saved only if it is not the default name.
|
||||
* Just because default name depends on the language and can change from
|
||||
* a country to an other
|
||||
*/
|
||||
wxString defName = TEMPLATE_FIELDNAME::GetDefaultFieldName( id );
|
||||
|
||||
if( id >= FIELD1 && !aField->m_name.IsEmpty() && aField->m_name != defName )
|
||||
aFormatter->Print( 0, " %s", EscapedUTF8( aField->m_name ).c_str() );
|
||||
|
||||
aFormatter->Print( 0, "\n" );
|
||||
}
|
||||
|
||||
|
||||
void SCH_LEGACY_PLUGIN_CACHE::savePin( LIB_PIN* aPin,
|
||||
std::unique_ptr< FILE_OUTPUTFORMATTER >& aFormatter )
|
||||
{
|
||||
wxCHECK_RET( aPin && aPin->Type() == LIB_PIN_T, "Invalid LIB_PIN object." );
|
||||
|
||||
int Etype;
|
||||
|
||||
switch( aPin->GetType() )
|
||||
{
|
||||
default:
|
||||
case PIN_INPUT:
|
||||
Etype = 'I';
|
||||
break;
|
||||
|
||||
case PIN_OUTPUT:
|
||||
Etype = 'O';
|
||||
break;
|
||||
|
||||
case PIN_BIDI:
|
||||
Etype = 'B';
|
||||
break;
|
||||
|
||||
case PIN_TRISTATE:
|
||||
Etype = 'T';
|
||||
break;
|
||||
|
||||
case PIN_PASSIVE:
|
||||
Etype = 'P';
|
||||
break;
|
||||
|
||||
case PIN_UNSPECIFIED:
|
||||
Etype = 'U';
|
||||
break;
|
||||
|
||||
case PIN_POWER_IN:
|
||||
Etype = 'W';
|
||||
break;
|
||||
|
||||
case PIN_POWER_OUT:
|
||||
Etype = 'w';
|
||||
break;
|
||||
|
||||
case PIN_OPENCOLLECTOR:
|
||||
Etype = 'C';
|
||||
break;
|
||||
|
||||
case PIN_OPENEMITTER:
|
||||
Etype = 'E';
|
||||
break;
|
||||
|
||||
case PIN_NC:
|
||||
Etype = 'N';
|
||||
break;
|
||||
}
|
||||
|
||||
if( !aPin->GetName().IsEmpty() )
|
||||
aFormatter->Print( 0, "X %s", TO_UTF8( aPin->GetName() ) );
|
||||
else
|
||||
aFormatter->Print( 0, "X ~" );
|
||||
|
||||
aFormatter->Print( 0, " %s %d %d %d %c %d %d %d %d %c",
|
||||
aPin->GetNumber().IsEmpty() ? "~" : TO_UTF8( aPin->GetNumber() ),
|
||||
aPin->GetPosition().x, aPin->GetPosition().y,
|
||||
(int) aPin->GetLength(), (int) aPin->GetOrientation(),
|
||||
aPin->GetNumberTextSize(), aPin->GetNameTextSize(),
|
||||
aPin->GetUnit(), aPin->GetConvert(), Etype );
|
||||
|
||||
if( aPin->GetShape() || !aPin->IsVisible() )
|
||||
aFormatter->Print( 0, " " );
|
||||
|
||||
if( !aPin->IsVisible() )
|
||||
aFormatter->Print( 0, "N" );
|
||||
|
||||
switch( aPin->GetShape() )
|
||||
{
|
||||
case PINSHAPE_LINE:
|
||||
break;
|
||||
|
||||
case PINSHAPE_INVERTED:
|
||||
aFormatter->Print( 0, "I" );
|
||||
break;
|
||||
|
||||
case PINSHAPE_CLOCK:
|
||||
aFormatter->Print( 0, "C" );
|
||||
break;
|
||||
|
||||
case PINSHAPE_INVERTED_CLOCK:
|
||||
aFormatter->Print( 0, "IC" );
|
||||
break;
|
||||
|
||||
case PINSHAPE_INPUT_LOW:
|
||||
aFormatter->Print( 0, "L" );
|
||||
break;
|
||||
|
||||
case PINSHAPE_CLOCK_LOW:
|
||||
aFormatter->Print( 0, "CL" );
|
||||
break;
|
||||
|
||||
case PINSHAPE_OUTPUT_LOW:
|
||||
aFormatter->Print( 0, "V" );
|
||||
break;
|
||||
|
||||
case PINSHAPE_FALLING_EDGE_CLOCK:
|
||||
aFormatter->Print( 0, "F" );
|
||||
break;
|
||||
|
||||
case PINSHAPE_NONLOGIC:
|
||||
aFormatter->Print( 0, "X" );
|
||||
break;
|
||||
|
||||
default:
|
||||
assert( !"Invalid pin shape" );
|
||||
}
|
||||
|
||||
aFormatter->Print( 0, "\n" );
|
||||
|
||||
aPin->ClearFlags( IS_CHANGED );
|
||||
}
|
||||
|
||||
|
||||
void SCH_LEGACY_PLUGIN_CACHE::savePolyLine( LIB_POLYLINE* aPolyLine,
|
||||
std::unique_ptr< FILE_OUTPUTFORMATTER >& aFormatter )
|
||||
{
|
||||
wxCHECK_RET( aPolyLine && aPolyLine->Type() == LIB_POLYLINE_T, "Invalid LIB_POLYLINE object." );
|
||||
|
||||
int ccount = aPolyLine->GetCornerCount();
|
||||
|
||||
aFormatter->Print( 0, "P %d %d %d %d", ccount, aPolyLine->GetUnit(), aPolyLine->GetConvert(),
|
||||
aPolyLine->GetWidth() );
|
||||
|
||||
for( const auto& pt : aPolyLine->GetPolyPoints() )
|
||||
{
|
||||
aFormatter->Print( 0, " %d %d", pt.x, pt.y );
|
||||
}
|
||||
|
||||
aFormatter->Print( 0, " %c\n", fill_tab[aPolyLine->GetFillMode()] );
|
||||
}
|
||||
|
||||
|
||||
void SCH_LEGACY_PLUGIN_CACHE::saveRectangle( LIB_RECTANGLE* aRectangle,
|
||||
std::unique_ptr< FILE_OUTPUTFORMATTER >& aFormatter )
|
||||
{
|
||||
wxCHECK_RET( aRectangle && aRectangle->Type() == LIB_RECTANGLE_T,
|
||||
"Invalid LIB_RECTANGLE object." );
|
||||
|
||||
aFormatter->Print( 0, "S %d %d %d %d %d %d %d %c\n",
|
||||
aRectangle->GetPosition().x, aRectangle->GetPosition().y,
|
||||
aRectangle->GetEnd().x, aRectangle->GetEnd().y,
|
||||
aRectangle->GetUnit(), aRectangle->GetConvert(),
|
||||
aRectangle->GetWidth(), fill_tab[aRectangle->GetFillMode()] );
|
||||
}
|
||||
|
||||
|
||||
void SCH_LEGACY_PLUGIN_CACHE::saveText( LIB_TEXT* aText,
|
||||
std::unique_ptr< FILE_OUTPUTFORMATTER >& aFormatter )
|
||||
{
|
||||
wxCHECK_RET( aText && aText->Type() == LIB_TEXT_T, "Invalid LIB_TEXT object." );
|
||||
|
||||
wxString text = aText->GetText();
|
||||
|
||||
if( text.Contains( wxT( "~" ) ) || text.Contains( wxT( "\"" ) ) )
|
||||
{
|
||||
// convert double quote to similar-looking two apostrophes
|
||||
text.Replace( wxT( "\"" ), wxT( "''" ) );
|
||||
text = wxT( "\"" ) + text + wxT( "\"" );
|
||||
}
|
||||
else
|
||||
{
|
||||
// Spaces are not allowed in text because it is not double quoted:
|
||||
// changed to '~'
|
||||
text.Replace( wxT( " " ), wxT( "~" ) );
|
||||
}
|
||||
|
||||
aFormatter->Print( 0, "T %g %d %d %d %d %d %d %s", aText->GetTextAngle(),
|
||||
aText->GetTextPos().x, aText->GetTextPos().y,
|
||||
aText->GetTextWidth(), !aText->IsVisible(),
|
||||
aText->GetUnit(), aText->GetConvert(), TO_UTF8( text ) );
|
||||
|
||||
aFormatter->Print( 0, " %s %d", aText->IsItalic() ? "Italic" : "Normal", aText->IsBold() );
|
||||
|
||||
char hjustify = 'C';
|
||||
|
||||
if( aText->GetHorizJustify() == GR_TEXT_HJUSTIFY_LEFT )
|
||||
hjustify = 'L';
|
||||
else if( aText->GetHorizJustify() == GR_TEXT_HJUSTIFY_RIGHT )
|
||||
hjustify = 'R';
|
||||
|
||||
char vjustify = 'C';
|
||||
|
||||
if( aText->GetVertJustify() == GR_TEXT_VJUSTIFY_BOTTOM )
|
||||
vjustify = 'B';
|
||||
else if( aText->GetVertJustify() == GR_TEXT_VJUSTIFY_TOP )
|
||||
vjustify = 'T';
|
||||
|
||||
aFormatter->Print( 0, " %c %c\n", hjustify, vjustify );
|
||||
}
|
||||
|
||||
|
||||
void SCH_LEGACY_PLUGIN_CACHE::saveDocFile()
|
||||
{
|
||||
wxFileName docFileName = m_libFileName;
|
||||
wxFileName fileName = m_libFileName;
|
||||
|
||||
docFileName.SetExt( DOC_EXT );
|
||||
FILE_OUTPUTFORMATTER formatter( docFileName.GetFullPath() );
|
||||
fileName.SetExt( DOC_EXT );
|
||||
FILE_OUTPUTFORMATTER formatter( fileName.GetFullPath() );
|
||||
|
||||
formatter.Print( 0, "%s\n", DOCFILE_IDENT );
|
||||
|
||||
for( LIB_ALIAS_MAP::iterator it = m_aliases.begin(); it != m_aliases.end(); it++ )
|
||||
{
|
||||
it->second->SaveDoc( formatter );
|
||||
wxString description = it->second->GetDescription();
|
||||
wxString keyWords = it->second->GetKeyWords();
|
||||
wxString docFileName = it->second->GetDocFileName();
|
||||
|
||||
if( description.IsEmpty() && keyWords.IsEmpty() && docFileName.IsEmpty() )
|
||||
continue;
|
||||
|
||||
formatter.Print( 0, "#\n$CMP %s\n", TO_UTF8( it->second->GetName() ) );
|
||||
|
||||
if( !description.IsEmpty() )
|
||||
formatter.Print( 0, "D %s\n", TO_UTF8( description ) );
|
||||
|
||||
if( !keyWords.IsEmpty() )
|
||||
formatter.Print( 0, "K %s\n", TO_UTF8( keyWords ) );
|
||||
|
||||
if( !docFileName.IsEmpty() )
|
||||
formatter.Print( 0, "F %s\n", TO_UTF8( docFileName ) );
|
||||
|
||||
formatter.Print( 0, "$ENDCMP\n" );
|
||||
}
|
||||
|
||||
formatter.Print( 0, "#\n#End Doc Library\n" );
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
|
||||
/**
|
||||
* @file symbedit.cpp
|
||||
* @brief Functions to load from and save to file component libraries and symbols.
|
||||
* @brief Functions to load and save individual symbols.
|
||||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
|
@ -35,12 +35,13 @@
|
|||
#include <confirm.h>
|
||||
#include <kicad_string.h>
|
||||
#include <gestfich.h>
|
||||
#include <class_sch_screen.h>
|
||||
|
||||
#include <class_sch_screen.h>
|
||||
#include <general.h>
|
||||
#include <libeditframe.h>
|
||||
#include <class_library.h>
|
||||
#include <class_libentry.h>
|
||||
#include <wildcards_and_files_ext.h>
|
||||
#include <sch_legacy_plugin.h>
|
||||
|
||||
|
||||
void LIB_EDIT_FRAME::LoadOneSymbol()
|
||||
|
@ -61,7 +62,7 @@ void LIB_EDIT_FRAME::LoadOneSymbol()
|
|||
if( !default_path )
|
||||
default_path = search->LastVisitedPath();
|
||||
|
||||
wxFileDialog dlg( this, _( "Import Symbol Drawings" ), default_path,
|
||||
wxFileDialog dlg( this, _( "Import Symbol" ), default_path,
|
||||
wxEmptyString, SchematicSymbolFileWildcard(),
|
||||
wxFD_OPEN | wxFD_FILE_MUST_EXIST );
|
||||
|
||||
|
@ -76,40 +77,49 @@ void LIB_EDIT_FRAME::LoadOneSymbol()
|
|||
|
||||
prj.SetRString( PROJECT::SCH_LIB_PATH, filename );
|
||||
|
||||
std::unique_ptr<PART_LIB> lib( new PART_LIB( LIBRARY_TYPE_SYMBOL, filename ) );
|
||||
wxArrayString symbols;
|
||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) );
|
||||
|
||||
wxString msg;
|
||||
|
||||
try
|
||||
{
|
||||
if( lib->IsEmpty() )
|
||||
pi->EnumerateSymbolLib( symbols, filename );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
msg.Printf( _( "No parts found in part file '%s'." ), GetChars( filename ) );
|
||||
DisplayError( this, msg );
|
||||
msg.Printf( _( "Cannot import symbol library '%s'." ), filename );
|
||||
DisplayErrorMessage( this, msg, ioe.What() );
|
||||
return;
|
||||
}
|
||||
}
|
||||
catch( const IO_ERROR& exc )
|
||||
|
||||
if( symbols.empty() )
|
||||
{
|
||||
msg.Printf( _( "Error '%s' occurred loading part file '%s'." ),
|
||||
GetChars( exc.Problem() ), GetChars( filename ) );
|
||||
msg.Printf( _( "Symbol library file '%s' is empty." ), filename );
|
||||
DisplayError( this, msg );
|
||||
return;
|
||||
}
|
||||
|
||||
if( lib->GetCount() > 1 )
|
||||
if( symbols.GetCount() > 1 )
|
||||
{
|
||||
msg.Printf( _( "More than one part in part file '%s'." ), GetChars( filename ) );
|
||||
msg.Printf( _( "More than one symbol found in symbol file '%s'." ), filename );
|
||||
wxMessageBox( msg, _( "Warning" ), wxOK | wxICON_EXCLAMATION, this );
|
||||
}
|
||||
|
||||
wxArrayString aliasNames;
|
||||
LIB_ALIAS* alias = nullptr;
|
||||
|
||||
lib->GetAliasNames( aliasNames );
|
||||
try
|
||||
{
|
||||
alias = pi->LoadSymbol( filename, symbols[0] );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
wxCHECK_RET( !aliasNames.IsEmpty(), "No aliases found in library " + filename );
|
||||
wxCHECK_RET( alias && alias->GetPart(), "Invalid symbol." );
|
||||
|
||||
LIB_PART* first = lib->FindAlias( aliasNames[0] )->GetPart();
|
||||
LIB_PART* first = alias->GetPart();
|
||||
LIB_ITEMS_CONTAINER& drawList = first->GetDrawItems();
|
||||
|
||||
for( LIB_ITEM& item : drawList )
|
||||
|
@ -154,7 +164,7 @@ void LIB_EDIT_FRAME::SaveOneSymbol()
|
|||
if( !default_path )
|
||||
default_path = search->LastVisitedPath();
|
||||
|
||||
wxFileDialog dlg( this, _( "Export Symbol Drawings" ), default_path,
|
||||
wxFileDialog dlg( this, _( "Export Symbol" ), default_path,
|
||||
part->GetName() + "." + SchematicSymbolFileExtension,
|
||||
SchematicSymbolFileWildcard(),
|
||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT );
|
||||
|
@ -174,78 +184,17 @@ void LIB_EDIT_FRAME::SaveOneSymbol()
|
|||
msg.Printf( _( "Saving symbol in '%s'" ), GetChars( fn.GetPath() ) );
|
||||
SetStatusText( msg );
|
||||
|
||||
wxString line;
|
||||
|
||||
// File header
|
||||
line << wxT( LIBFILE_IDENT ) << wxT( " " ) << LIB_VERSION_MAJOR
|
||||
<< wxT( "." ) << LIB_VERSION_MINOR << wxT( " SYMBOL " )
|
||||
<< wxT( "Date: " ) << DateAndTime() << wxT( "\n" );
|
||||
|
||||
// Component name comment and definition.
|
||||
line << wxT( "# SYMBOL " ) << part->GetName() << wxT( "\n#\nDEF " )
|
||||
<< part->GetName() << wxT( " " );
|
||||
|
||||
if( !part->GetReferenceField().GetText().IsEmpty() )
|
||||
line << part->GetReferenceField().GetText() << wxT( " " );
|
||||
else
|
||||
line << wxT( "~ " );
|
||||
|
||||
line << 0 << wxT( " " ) << part->GetPinNameOffset() << wxT( " " );
|
||||
|
||||
if( part->ShowPinNumbers() )
|
||||
line << wxT( "Y " );
|
||||
else
|
||||
line << wxT( "N " );
|
||||
|
||||
if( part->ShowPinNames() )
|
||||
line << wxT( "Y " );
|
||||
else
|
||||
line << wxT( "N " );
|
||||
|
||||
line << wxT( "1 0 N\n" );
|
||||
SCH_PLUGIN::SCH_PLUGIN_RELEASER pi( SCH_IO_MGR::FindPlugin( SCH_IO_MGR::SCH_LEGACY ) );
|
||||
|
||||
try
|
||||
{
|
||||
FILE_OUTPUTFORMATTER formatter( fn.GetFullPath() );
|
||||
|
||||
try
|
||||
{
|
||||
formatter.Print( 0, "%s", TO_UTF8( line ) );
|
||||
part->GetReferenceField().Save( formatter );
|
||||
part->GetValueField().Save( formatter );
|
||||
formatter.Print( 0, "DRAW\n" );
|
||||
|
||||
LIB_ITEMS_CONTAINER& drawList = part->GetDrawItems();
|
||||
|
||||
for( LIB_ITEM& item : drawList )
|
||||
{
|
||||
if( item.Type() == LIB_FIELD_T )
|
||||
continue;
|
||||
|
||||
// Don't save unused parts or alternate body styles.
|
||||
if( m_unit && item.GetUnit() && ( item.GetUnit() != m_unit ) )
|
||||
continue;
|
||||
|
||||
if( m_convert && item.GetConvert() && ( item.GetConvert() != m_convert ) )
|
||||
continue;
|
||||
|
||||
item.Save( formatter );
|
||||
}
|
||||
|
||||
formatter.Print( 0, "ENDDRAW\n" );
|
||||
formatter.Print( 0, "ENDDEF\n" );
|
||||
}
|
||||
catch( const IO_ERROR& )
|
||||
{
|
||||
msg.Printf( _( "An error occurred attempting to save symbol file '%s'" ),
|
||||
GetChars( fn.GetFullPath() ) );
|
||||
DisplayError( this, msg );
|
||||
}
|
||||
pi->SaveSymbol( fn.GetFullPath(), part );
|
||||
}
|
||||
catch( const IO_ERROR& ioe )
|
||||
{
|
||||
DisplayError( this, ioe.What() );
|
||||
return;
|
||||
msg.Printf( _( "An error occurred attempting to save symbol file '%s'" ),
|
||||
fn.GetFullPath() );
|
||||
DisplayErrorMessage( this, msg, ioe.What() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue