More about italic andf bold in fileds in libraries
This commit is contained in:
parent
162492efe2
commit
23748be6df
|
@ -5,6 +5,15 @@ Started 2007-June-11
|
|||
Please add newer entries at the top, list the date and your name with
|
||||
email address.
|
||||
|
||||
|
||||
2008-Dec-31 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||
================================================================================
|
||||
++Eeschema:
|
||||
Note: this is a work in progress!
|
||||
Files modification.
|
||||
More about italic andf bold in fileds in libraries
|
||||
|
||||
|
||||
2008-Dec-30 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
|
||||
================================================================================
|
||||
++Eeschema:
|
||||
|
|
|
@ -16,6 +16,8 @@ set(EESCHEMA_SRCS
|
|||
bus-wire-junction.cpp
|
||||
class_drawsheet.cpp
|
||||
class_hierarchical_PIN_sheet.cpp
|
||||
class_libentry.cpp
|
||||
class_libentry_fields.cpp
|
||||
class_library.cpp
|
||||
class_pin.cpp
|
||||
class_sch_cmp_field.cpp
|
||||
|
|
|
@ -0,0 +1,281 @@
|
|||
/**********************************************************/
|
||||
/* lib_entry.cpp */
|
||||
/**********************************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "program.h"
|
||||
#include "libcmp.h"
|
||||
#include "general.h"
|
||||
|
||||
#include "protos.h"
|
||||
|
||||
|
||||
/*********************/
|
||||
/* class LibCmpEntry */
|
||||
/*********************/
|
||||
|
||||
/* Basic class for librarty oomponent description
|
||||
* Not directly used
|
||||
* Used to create the 2 derived classes :
|
||||
* - EDA_LibCmpAliasStruct
|
||||
* - EDA_LibComponentStruct
|
||||
*/
|
||||
|
||||
/********************************************************************/
|
||||
LibCmpEntry::LibCmpEntry( LibrEntryType CmpType, const wxChar* CmpName ) :
|
||||
EDA_BaseStruct( LIBCOMPONENT_STRUCT_TYPE )
|
||||
/********************************************************************/
|
||||
{
|
||||
Type = CmpType;
|
||||
m_Name.m_FieldId = VALUE;
|
||||
if( CmpName )
|
||||
m_Name.m_Text = CmpName;
|
||||
}
|
||||
|
||||
|
||||
/******************************/
|
||||
LibCmpEntry::~LibCmpEntry()
|
||||
/******************************/
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*******************************/
|
||||
/* class EDA_LibCmpAliasStruct */
|
||||
/*******************************/
|
||||
|
||||
/* Class to define an alias of a component
|
||||
* An alias uses the component defintion (graphic, pins...)
|
||||
* but has its own name and documentation.
|
||||
* Therefore, when the component is modified, alias of this component are modified.
|
||||
* This is a simple method to create components with differs very few
|
||||
* (like 74LS00, 74HC00 ... and many op amps )
|
||||
*/
|
||||
|
||||
EDA_LibCmpAliasStruct:: EDA_LibCmpAliasStruct( const wxChar* CmpName,
|
||||
const wxChar* CmpRootName ) :
|
||||
LibCmpEntry( ALIAS, CmpName )
|
||||
{
|
||||
if( CmpRootName == NULL )
|
||||
m_RootName.Empty();
|
||||
else
|
||||
m_RootName = CmpRootName;
|
||||
}
|
||||
|
||||
|
||||
EDA_LibCmpAliasStruct::~EDA_LibCmpAliasStruct()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/********************************/
|
||||
/* class EDA_LibComponentStruct */
|
||||
/********************************/
|
||||
|
||||
/* This is a standard component (in library)
|
||||
*/
|
||||
EDA_LibComponentStruct:: EDA_LibComponentStruct( const wxChar* CmpName ) :
|
||||
LibCmpEntry( ROOT, CmpName )
|
||||
{
|
||||
m_Drawings = NULL;
|
||||
m_LastDate = 0;
|
||||
m_UnitCount = 1;
|
||||
m_TextInside = 40;
|
||||
m_Options = ENTRY_NORMAL;
|
||||
m_UnitSelectionLocked = FALSE;
|
||||
m_DrawPinNum = m_DrawPinName = 1;
|
||||
|
||||
Fields = NULL;
|
||||
m_Prefix.m_FieldId = REFERENCE;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************/
|
||||
EDA_LibComponentStruct::~EDA_LibComponentStruct()
|
||||
/******************************************************/
|
||||
{
|
||||
LibEDA_BaseStruct* DrawItem, * NextDrawItem;
|
||||
LibDrawField* TempField, * field;
|
||||
|
||||
field = Fields; Fields = NULL;
|
||||
while( field )
|
||||
{
|
||||
TempField = field;
|
||||
field = field->Next();
|
||||
SAFE_DELETE( TempField );
|
||||
}
|
||||
|
||||
/* suppression des elements dependants */
|
||||
DrawItem = m_Drawings; m_Drawings = NULL;
|
||||
while( DrawItem )
|
||||
{
|
||||
NextDrawItem = DrawItem->Next();
|
||||
SAFE_DELETE( DrawItem );
|
||||
DrawItem = NextDrawItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert )
|
||||
/**********************************************************************/
|
||||
|
||||
/* Return the componenty boundary box ( in user coordinates )
|
||||
* The unit Unit, and the shape Convert are considered.
|
||||
* If Unit == 0, Unit is not used
|
||||
* if Convert == 0 Convert is non used
|
||||
**/
|
||||
{
|
||||
int xmin, xmax, ymin, ymax, x1, y1;
|
||||
int* pt, ii;
|
||||
LibEDA_BaseStruct* DrawEntry;
|
||||
EDA_Rect BoundaryBox;
|
||||
|
||||
DrawEntry = m_Drawings;
|
||||
if( DrawEntry )
|
||||
{
|
||||
xmin = ymin = 0x7FFFFFFF;
|
||||
xmax = ymax = 0x80000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
xmin = ymin = -50;
|
||||
xmax = ymax = 50; // Min size in 1/1000 inch
|
||||
}
|
||||
|
||||
for( ; DrawEntry != NULL; DrawEntry = DrawEntry->Next() )
|
||||
{
|
||||
if( DrawEntry->m_Unit > 0 ) // The item is non common to units
|
||||
if( (m_UnitCount > 1 ) && (Unit > 0) && (Unit != DrawEntry->m_Unit) )
|
||||
continue;
|
||||
if( DrawEntry->m_Convert > 0 ) //The item is not common to alls convert
|
||||
if( (Convert > 0) && (Convert != DrawEntry->m_Convert) )
|
||||
continue;
|
||||
|
||||
switch( DrawEntry->Type() )
|
||||
{
|
||||
case COMPONENT_ARC_DRAW_TYPE:
|
||||
{
|
||||
// Arc is reduced to a line from m_Start to m_End.
|
||||
// TO DO better.
|
||||
LibDrawArc* Arc = (LibDrawArc*) DrawEntry;
|
||||
x1 = Arc->m_ArcStart.x;
|
||||
y1 = Arc->m_ArcStart.y;
|
||||
xmin = MIN( xmin, x1 );
|
||||
ymin = MIN( ymin, y1 );
|
||||
xmax = MAX( xmax, x1 );
|
||||
ymax = MAX( ymax, y1 );
|
||||
x1 = Arc->m_ArcEnd.x;
|
||||
y1 = Arc->m_ArcEnd.y;
|
||||
xmin = MIN( xmin, x1 );
|
||||
ymin = MIN( ymin, y1 );
|
||||
xmax = MAX( xmax, x1 );
|
||||
ymax = MAX( ymax, y1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
||||
{
|
||||
LibDrawCircle* Circle = (LibDrawCircle*) DrawEntry;
|
||||
x1 = Circle->m_Pos.x - Circle->m_Rayon;
|
||||
y1 = Circle->m_Pos.y - Circle->m_Rayon;
|
||||
xmin = MIN( xmin, x1 );
|
||||
ymin = MIN( ymin, y1 );
|
||||
x1 = Circle->m_Pos.x + Circle->m_Rayon;
|
||||
y1 = Circle->m_Pos.y + Circle->m_Rayon;
|
||||
xmax = MAX( xmax, x1 );
|
||||
ymax = MAX( ymax, y1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case COMPONENT_RECT_DRAW_TYPE:
|
||||
{
|
||||
LibDrawSquare* Square = (LibDrawSquare*) DrawEntry;
|
||||
xmin = MIN( xmin, Square->m_Pos.x );
|
||||
xmin = MIN( xmin, Square->m_End.x );
|
||||
xmax = MAX( xmax, Square->m_Pos.x );
|
||||
xmax = MAX( xmax, Square->m_End.x );
|
||||
ymin = MIN( ymin, Square->m_Pos.y );
|
||||
ymin = MIN( ymin, Square->m_End.y );
|
||||
ymax = MAX( ymax, Square->m_Pos.y );
|
||||
ymax = MAX( ymax, Square->m_End.y );
|
||||
}
|
||||
break;
|
||||
|
||||
case COMPONENT_PIN_DRAW_TYPE:
|
||||
{
|
||||
LibDrawPin* Pin = (LibDrawPin*) DrawEntry;
|
||||
x1 = Pin->m_Pos.x;
|
||||
y1 = Pin->m_Pos.y;
|
||||
xmin = MIN( xmin, x1 );
|
||||
xmax = MAX( xmax, x1 );
|
||||
ymin = MIN( ymin, y1 );
|
||||
ymax = MAX( ymax, y1 );
|
||||
#if 0 \
|
||||
// 0 pour englober le point origine de la pin, 1 pour englober toute la pin
|
||||
switch( Pin->Orient )
|
||||
{
|
||||
case PIN_UP:
|
||||
y1 += Pin->Len; break;
|
||||
|
||||
case PIN_DOWN:
|
||||
y1 -= Pin->Len; break;
|
||||
|
||||
case PIN_LEFT:
|
||||
x1 -= Pin->Len; break;
|
||||
|
||||
case PIN_RIGHT:
|
||||
x1 += Pin->Len; break;
|
||||
}
|
||||
|
||||
xmin = MIN( xmin, x1 );
|
||||
xmax = MAX( xmax, x1 );
|
||||
ymin = MIN( ymin, y1 );
|
||||
ymax = MAX( ymax, y1 );
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
||||
break;
|
||||
|
||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
||||
{
|
||||
LibDrawPolyline* polyline = (LibDrawPolyline*) DrawEntry;
|
||||
pt = polyline->m_PolyList;
|
||||
for( ii = 0; ii < polyline->m_CornersCount; ii++ )
|
||||
{
|
||||
if( xmin > *pt )
|
||||
xmin = *pt;
|
||||
if( xmax < *pt )
|
||||
xmax = *pt;
|
||||
pt++;
|
||||
if( ymin > *pt )
|
||||
ymin = *pt;
|
||||
if( ymax < *pt )
|
||||
ymax = *pt;
|
||||
pt++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
// Update the BoundaryBox. Remenber the fact the screen Y axis is the reverse */
|
||||
ymax = -ymax; ymin = -ymin; // Y is is screen axis sense
|
||||
// Ensure w and H > 0 (wxRect assume it)
|
||||
if( xmax < xmin )
|
||||
EXCHG( xmax, xmin );
|
||||
if( ymax < ymin )
|
||||
EXCHG( ymax, ymin );
|
||||
BoundaryBox.SetX( xmin ); BoundaryBox.SetWidth( xmax - xmin );
|
||||
BoundaryBox.SetY( ymin ); BoundaryBox.SetHeight( ymax - ymin );
|
||||
|
||||
return BoundaryBox;
|
||||
}
|
|
@ -0,0 +1,125 @@
|
|||
/****************************************************************/
|
||||
/* Headers fo lib component (or libentry) definitions */
|
||||
/****************************************************************/
|
||||
|
||||
#ifndef CLASS_LIBENTRY_H
|
||||
#define CLASS_LIBENTRY_H
|
||||
|
||||
#include "classes_body_items.h"
|
||||
#include "class_libentry_fields.h"
|
||||
|
||||
/* Types for components in libraries
|
||||
* components can be a true component or an alias of a true component.
|
||||
*/
|
||||
enum LibrEntryType {
|
||||
ROOT, /* This is a true component standard EDA_LibComponentStruct */
|
||||
ALIAS /* This is an alias of a true component */
|
||||
};
|
||||
|
||||
/* values for member .m_Options */
|
||||
enum LibrEntryOptions {
|
||||
ENTRY_NORMAL, // Libentry is a standard component (real or alias)
|
||||
ENTRY_POWER // Libentry is a power symbol
|
||||
};
|
||||
|
||||
|
||||
/* basic class to describe components in libraries (true component or alias), non used directly */
|
||||
class LibCmpEntry : public EDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
LibrEntryType Type; /* Type = ROOT;
|
||||
* = ALIAS pour struct LibraryAliasType */
|
||||
LibDrawField m_Name; // name (74LS00 ..) in lib ( = VALUE )
|
||||
wxString m_Doc; /* documentation for info */
|
||||
wxString m_KeyWord; /* keyword list (used to select a group of components by keyword) */
|
||||
wxString m_DocFile; /* Associed doc filename */
|
||||
LibrEntryOptions m_Options; // special features (i.e. Entry is a POWER)
|
||||
|
||||
public:
|
||||
LibCmpEntry( LibrEntryType CmpType, const wxChar* CmpName );
|
||||
virtual ~LibCmpEntry();
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "LibCmpEntry" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function SaveDoc
|
||||
* writes the doc info out to a FILE in "*.dcm" format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
bool SaveDoc( FILE* aFile );
|
||||
};
|
||||
|
||||
|
||||
/*********************************************/
|
||||
/* class to handle an usual component in lib */
|
||||
/*********************************************/
|
||||
class EDA_LibComponentStruct : public LibCmpEntry
|
||||
{
|
||||
public:
|
||||
LibDrawField m_Prefix; /* Prefix ( U, IC ... ) = REFERENCE */
|
||||
wxArrayString m_AliasList; /* ALIAS list for the component */
|
||||
wxArrayString m_FootprintList; /* list of suitable footprint names for the component (wildcard names accepted)*/
|
||||
int m_UnitCount; /* Units (or sections) per package */
|
||||
bool m_UnitSelectionLocked; // True if units are differents and their selection is locked
|
||||
// (i.e. if part A cannot be automatically changed in part B
|
||||
int m_TextInside; /* if 0: pin name drawn on the pin itself
|
||||
* if > 0 pin name drawn inside the component,
|
||||
* with a distance of m_TextInside in mils */
|
||||
bool m_DrawPinNum;
|
||||
bool m_DrawPinName;
|
||||
LibDrawField* Fields; /* Auxiliairy Field list (id = 2 a 11) */
|
||||
LibEDA_BaseStruct* m_Drawings; /* How to draw this part */
|
||||
long m_LastDate; // Last change Date
|
||||
|
||||
public:
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "EDA_LibComponentStruct" );
|
||||
}
|
||||
|
||||
|
||||
EDA_LibComponentStruct( const wxChar* CmpName );
|
||||
EDA_Rect GetBoundaryBox( int Unit, int Convert ); /* return Box around the part. */
|
||||
|
||||
~EDA_LibComponentStruct();
|
||||
void SortDrawItems();
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.lib" format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
bool Save( FILE* aFile );
|
||||
|
||||
/** Function SetFields
|
||||
* initialize fields from a vector of fields
|
||||
* @param aFields a std::vector <LibDrawField> to import.
|
||||
*/
|
||||
void SetFields( const std::vector <LibDrawField> aFields );
|
||||
};
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* class to handle an alias of an usual component in lib (root component) */
|
||||
/**************************************************************************/
|
||||
class EDA_LibCmpAliasStruct : public LibCmpEntry
|
||||
{
|
||||
public:
|
||||
wxString m_RootName; /* Root component Part name */
|
||||
|
||||
public:
|
||||
EDA_LibCmpAliasStruct( const wxChar* CmpName, const wxChar* CmpRootName );
|
||||
~EDA_LibCmpAliasStruct();
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "EDA_LibCmpAliasStruct" );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif // CLASS_LIBENTRY_H
|
|
@ -0,0 +1,110 @@
|
|||
/**********************************************************/
|
||||
/* libclass.cpp */
|
||||
/**********************************************************/
|
||||
|
||||
#include "fctsys.h"
|
||||
#include "gr_basic.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "program.h"
|
||||
#include "libcmp.h"
|
||||
#include "general.h"
|
||||
|
||||
|
||||
/***************************/
|
||||
/* class LibraryFieldEntry */
|
||||
/***************************/
|
||||
|
||||
/* a Field is a string linked to a component.
|
||||
* Unlike a pure graphic text, fields can be used in netlist generation
|
||||
* and other things.
|
||||
*
|
||||
* 4 fields have a special meaning:
|
||||
* REFERENCE
|
||||
* VALUE
|
||||
* FOOTPRINT NAME
|
||||
* DOCUMENTATION LINK (reserved but not used in kicad)
|
||||
*/
|
||||
LibDrawField::LibDrawField( int idfield ) : LibEDA_BaseStruct( COMPONENT_FIELD_DRAW_TYPE )
|
||||
{
|
||||
m_FieldId = idfield; /* 0 a 11, 0 = REFERENCE, 1 = VALUE*/
|
||||
if( m_FieldId < 0 )
|
||||
m_FieldId = 0;
|
||||
if( m_FieldId >= NUMBER_OF_FIELDS )
|
||||
m_FieldId = NUMBER_OF_FIELDS - 1;
|
||||
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT;
|
||||
}
|
||||
|
||||
|
||||
LibDrawField::~LibDrawField()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Creation et Duplication d'un field
|
||||
LibDrawField* LibDrawField::GenCopy()
|
||||
{
|
||||
LibDrawField* newfield = new LibDrawField( m_FieldId );
|
||||
|
||||
Copy( newfield );
|
||||
|
||||
return newfield;
|
||||
}
|
||||
|
||||
|
||||
/** Function Copy
|
||||
* copy parameters of this to Target. Pointers are not copied
|
||||
* @param Target = the LibDrawField to set with "this" values
|
||||
*/
|
||||
void LibDrawField::Copy( LibDrawField* Target ) const
|
||||
{
|
||||
Target->m_Pos = m_Pos;
|
||||
Target->m_Size = m_Size;
|
||||
Target->m_Width = m_Width;
|
||||
Target->m_Orient = m_Orient;
|
||||
Target->m_Attributs = m_Attributs;
|
||||
Target->m_Text = m_Text;
|
||||
Target->m_Name = m_Name;
|
||||
Target->m_HJustify = m_HJustify;
|
||||
Target->m_VJustify = m_VJustify;
|
||||
Target->m_Italic = m_Italic;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************/
|
||||
bool LibDrawField::Save( FILE* ExportFile ) const
|
||||
/**************************************************/
|
||||
{
|
||||
int hjustify, vjustify;
|
||||
wxString text = m_Text;
|
||||
|
||||
hjustify = 'C';
|
||||
if( m_HJustify == GR_TEXT_HJUSTIFY_LEFT )
|
||||
hjustify = 'L';
|
||||
else if( m_HJustify == GR_TEXT_HJUSTIFY_RIGHT )
|
||||
hjustify = 'R';
|
||||
vjustify = 'C';
|
||||
if( m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM )
|
||||
vjustify = 'B';
|
||||
else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP )
|
||||
vjustify = 'T';
|
||||
if( text.IsEmpty() )
|
||||
text = wxT( "~" );
|
||||
fprintf( ExportFile, "F%d \"%s\" %d %d %d %c %c %c %c%c%c",
|
||||
m_FieldId, CONV_TO_UTF8( text ),
|
||||
m_Pos.x, m_Pos.y,
|
||||
m_Size.x,
|
||||
m_Orient == 0 ? 'H' : 'V',
|
||||
(m_Attributs & TEXT_NO_VISIBLE ) ? 'I' : 'V',
|
||||
hjustify, vjustify,
|
||||
m_Italic ? 'I' : 'N',
|
||||
m_Width > 1 ? 'B' : 'N');
|
||||
|
||||
// Save field name, if necessary
|
||||
if( m_FieldId >= FIELD1 && !m_Name.IsEmpty() )
|
||||
fprintf( ExportFile, " \"%s\"", CONV_TO_UTF8( m_Name ) );
|
||||
|
||||
fprintf( ExportFile, "\n" );
|
||||
return true;
|
||||
}
|
||||
|
|
@ -0,0 +1,72 @@
|
|||
/**************************************************************/
|
||||
/* Lib component definitions (libentry) definition of fields */
|
||||
/**************************************************************/
|
||||
|
||||
#ifndef CLASS_LIBENTRY_FIELDS_H
|
||||
#define CLASS_LIBENTRY_FIELDS_H
|
||||
|
||||
|
||||
/* Fields , same as component fields.
|
||||
* can be defined in libraries (mandatory for ref and value, ca be useful for footprints)
|
||||
* 2 Fields are always defined :
|
||||
* Prefix (U, IC..) with gives the reference in schematic)
|
||||
* Name (74LS00..) used to find the component in libraries, and give the default value in schematic
|
||||
*/
|
||||
|
||||
class LibDrawField : public LibEDA_BaseStruct
|
||||
, public EDA_TextStruct
|
||||
{
|
||||
public:
|
||||
int m_FieldId; /* 0 a 11
|
||||
* 0 = Reference; 1 = Value
|
||||
* 2 = Default footprint, 3 = subsheet (not used, reserved)
|
||||
* 4 .. 11 other fields
|
||||
*/
|
||||
wxString m_Name; /* Field Name (not the field text itself, that is .m_Text) */
|
||||
|
||||
public:
|
||||
|
||||
LibDrawField* Next() const { return (LibDrawField*) Pnext; }
|
||||
LibDrawField* Back() const { return (LibDrawField*) Pback; }
|
||||
|
||||
|
||||
LibDrawField( int idfield = 2 );
|
||||
~LibDrawField();
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "LibDrawField" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
virtual bool Save( FILE* aFile ) const;
|
||||
|
||||
|
||||
LibDrawField* GenCopy();
|
||||
|
||||
/** Function Copy
|
||||
* copy parameters of this to Target. Pointers are not copied
|
||||
* @param Target = the LibDrawField to set with "this" values
|
||||
*/
|
||||
void Copy( LibDrawField* Target ) const;
|
||||
|
||||
void SetFields( const std::vector <LibDrawField> aFields );
|
||||
|
||||
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor,
|
||||
int aDrawMode, void* aData, int aTransformMatrix[2][2] );
|
||||
|
||||
/**
|
||||
* Function HitTest
|
||||
* tests if the given wxPoint is within the bounds of this object.
|
||||
* @param refPos A wxPoint to test, in Field coordinate system
|
||||
* @return bool - true if a hit, else false
|
||||
*/
|
||||
bool HitTest( const wxPoint& refPos );
|
||||
};
|
||||
|
||||
#endif // CLASS_LIBENTRY_FIELDS_H
|
|
@ -100,515 +100,3 @@ bool LibraryStruct::ReadHeader( FILE* libfile, int* LineNum )
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
|
||||
/*********************/
|
||||
/* class LibCmpEntry */
|
||||
/*********************/
|
||||
|
||||
/* Basic class for librarty oomponent description
|
||||
* Not directly used
|
||||
* Used to create the 2 derived classes :
|
||||
* - EDA_LibCmpAliasStruct
|
||||
* - EDA_LibComponentStruct
|
||||
*/
|
||||
|
||||
/********************************************************************/
|
||||
LibCmpEntry::LibCmpEntry( LibrEntryType CmpType, const wxChar* CmpName ) :
|
||||
EDA_BaseStruct( LIBCOMPONENT_STRUCT_TYPE )
|
||||
/********************************************************************/
|
||||
{
|
||||
Type = CmpType;
|
||||
m_Name.m_FieldId = VALUE;
|
||||
if( CmpName )
|
||||
m_Name.m_Text = CmpName;
|
||||
}
|
||||
|
||||
|
||||
/******************************/
|
||||
LibCmpEntry::~LibCmpEntry()
|
||||
/******************************/
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/*******************************/
|
||||
/* class EDA_LibCmpAliasStruct */
|
||||
/*******************************/
|
||||
|
||||
/* Class to define an alias of a component
|
||||
* An alias uses the component defintion (graphic, pins...)
|
||||
* but has its own name and documentation.
|
||||
* Therefore, when the component is modified, alias of this component are modified.
|
||||
* This is a simple method to create components with differs very few
|
||||
* (like 74LS00, 74HC00 ... and many op amps )
|
||||
*/
|
||||
|
||||
EDA_LibCmpAliasStruct:: EDA_LibCmpAliasStruct( const wxChar* CmpName,
|
||||
const wxChar* CmpRootName ) :
|
||||
LibCmpEntry( ALIAS, CmpName )
|
||||
{
|
||||
if( CmpRootName == NULL )
|
||||
m_RootName.Empty();
|
||||
else
|
||||
m_RootName = CmpRootName;
|
||||
}
|
||||
|
||||
|
||||
EDA_LibCmpAliasStruct::~EDA_LibCmpAliasStruct()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
/********************************/
|
||||
/* class EDA_LibComponentStruct */
|
||||
/********************************/
|
||||
|
||||
/* This is a standard component (in library)
|
||||
*/
|
||||
EDA_LibComponentStruct:: EDA_LibComponentStruct( const wxChar* CmpName ) :
|
||||
LibCmpEntry( ROOT, CmpName )
|
||||
{
|
||||
m_Drawings = NULL;
|
||||
m_LastDate = 0;
|
||||
m_UnitCount = 1;
|
||||
m_TextInside = 40;
|
||||
m_Options = ENTRY_NORMAL;
|
||||
m_UnitSelectionLocked = FALSE;
|
||||
m_DrawPinNum = m_DrawPinName = 1;
|
||||
|
||||
Fields = NULL;
|
||||
m_Prefix.m_FieldId = REFERENCE;
|
||||
}
|
||||
|
||||
|
||||
/******************************************************/
|
||||
EDA_LibComponentStruct::~EDA_LibComponentStruct()
|
||||
/******************************************************/
|
||||
{
|
||||
LibEDA_BaseStruct* DrawItem, * NextDrawItem;
|
||||
LibDrawField* TempField, * field;
|
||||
|
||||
field = Fields; Fields = NULL;
|
||||
while( field )
|
||||
{
|
||||
TempField = field;
|
||||
field = field->Next();
|
||||
SAFE_DELETE( TempField );
|
||||
}
|
||||
|
||||
/* suppression des elements dependants */
|
||||
DrawItem = m_Drawings; m_Drawings = NULL;
|
||||
while( DrawItem )
|
||||
{
|
||||
NextDrawItem = DrawItem->Next();
|
||||
SAFE_DELETE( DrawItem );
|
||||
DrawItem = NextDrawItem;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert )
|
||||
/**********************************************************************/
|
||||
|
||||
/* Return the componenty boundary box ( in user coordinates )
|
||||
* The unit Unit, and the shape Convert are considered.
|
||||
* If Unit == 0, Unit is not used
|
||||
* if Convert == 0 Convert is non used
|
||||
**/
|
||||
{
|
||||
int xmin, xmax, ymin, ymax, x1, y1;
|
||||
int* pt, ii;
|
||||
LibEDA_BaseStruct* DrawEntry;
|
||||
EDA_Rect BoundaryBox;
|
||||
|
||||
DrawEntry = m_Drawings;
|
||||
if( DrawEntry )
|
||||
{
|
||||
xmin = ymin = 0x7FFFFFFF;
|
||||
xmax = ymax = 0x80000000;
|
||||
}
|
||||
else
|
||||
{
|
||||
xmin = ymin = -50;
|
||||
xmax = ymax = 50; // Min size in 1/1000 inch
|
||||
}
|
||||
|
||||
for( ; DrawEntry != NULL; DrawEntry = DrawEntry->Next() )
|
||||
{
|
||||
if( DrawEntry->m_Unit > 0 ) // The item is non common to units
|
||||
if( (m_UnitCount > 1 ) && (Unit > 0) && (Unit != DrawEntry->m_Unit) )
|
||||
continue;
|
||||
if( DrawEntry->m_Convert > 0 ) //The item is not common to alls convert
|
||||
if( (Convert > 0) && (Convert != DrawEntry->m_Convert) )
|
||||
continue;
|
||||
|
||||
switch( DrawEntry->Type() )
|
||||
{
|
||||
case COMPONENT_ARC_DRAW_TYPE:
|
||||
{
|
||||
// Arc is reduced to a line from m_Start to m_End.
|
||||
// TO DO better.
|
||||
LibDrawArc* Arc = (LibDrawArc*) DrawEntry;
|
||||
x1 = Arc->m_ArcStart.x;
|
||||
y1 = Arc->m_ArcStart.y;
|
||||
xmin = MIN( xmin, x1 );
|
||||
ymin = MIN( ymin, y1 );
|
||||
xmax = MAX( xmax, x1 );
|
||||
ymax = MAX( ymax, y1 );
|
||||
x1 = Arc->m_ArcEnd.x;
|
||||
y1 = Arc->m_ArcEnd.y;
|
||||
xmin = MIN( xmin, x1 );
|
||||
ymin = MIN( ymin, y1 );
|
||||
xmax = MAX( xmax, x1 );
|
||||
ymax = MAX( ymax, y1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case COMPONENT_CIRCLE_DRAW_TYPE:
|
||||
{
|
||||
LibDrawCircle* Circle = (LibDrawCircle*) DrawEntry;
|
||||
x1 = Circle->m_Pos.x - Circle->m_Rayon;
|
||||
y1 = Circle->m_Pos.y - Circle->m_Rayon;
|
||||
xmin = MIN( xmin, x1 );
|
||||
ymin = MIN( ymin, y1 );
|
||||
x1 = Circle->m_Pos.x + Circle->m_Rayon;
|
||||
y1 = Circle->m_Pos.y + Circle->m_Rayon;
|
||||
xmax = MAX( xmax, x1 );
|
||||
ymax = MAX( ymax, y1 );
|
||||
}
|
||||
break;
|
||||
|
||||
case COMPONENT_RECT_DRAW_TYPE:
|
||||
{
|
||||
LibDrawSquare* Square = (LibDrawSquare*) DrawEntry;
|
||||
xmin = MIN( xmin, Square->m_Pos.x );
|
||||
xmin = MIN( xmin, Square->m_End.x );
|
||||
xmax = MAX( xmax, Square->m_Pos.x );
|
||||
xmax = MAX( xmax, Square->m_End.x );
|
||||
ymin = MIN( ymin, Square->m_Pos.y );
|
||||
ymin = MIN( ymin, Square->m_End.y );
|
||||
ymax = MAX( ymax, Square->m_Pos.y );
|
||||
ymax = MAX( ymax, Square->m_End.y );
|
||||
}
|
||||
break;
|
||||
|
||||
case COMPONENT_PIN_DRAW_TYPE:
|
||||
{
|
||||
LibDrawPin* Pin = (LibDrawPin*) DrawEntry;
|
||||
x1 = Pin->m_Pos.x;
|
||||
y1 = Pin->m_Pos.y;
|
||||
xmin = MIN( xmin, x1 );
|
||||
xmax = MAX( xmax, x1 );
|
||||
ymin = MIN( ymin, y1 );
|
||||
ymax = MAX( ymax, y1 );
|
||||
#if 0 \
|
||||
// 0 pour englober le point origine de la pin, 1 pour englober toute la pin
|
||||
switch( Pin->Orient )
|
||||
{
|
||||
case PIN_UP:
|
||||
y1 += Pin->Len; break;
|
||||
|
||||
case PIN_DOWN:
|
||||
y1 -= Pin->Len; break;
|
||||
|
||||
case PIN_LEFT:
|
||||
x1 -= Pin->Len; break;
|
||||
|
||||
case PIN_RIGHT:
|
||||
x1 += Pin->Len; break;
|
||||
}
|
||||
|
||||
xmin = MIN( xmin, x1 );
|
||||
xmax = MAX( xmax, x1 );
|
||||
ymin = MIN( ymin, y1 );
|
||||
ymax = MAX( ymax, y1 );
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
|
||||
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
||||
break;
|
||||
|
||||
case COMPONENT_POLYLINE_DRAW_TYPE:
|
||||
{
|
||||
LibDrawPolyline* polyline = (LibDrawPolyline*) DrawEntry;
|
||||
pt = polyline->m_PolyList;
|
||||
for( ii = 0; ii < polyline->m_CornersCount; ii++ )
|
||||
{
|
||||
if( xmin > *pt )
|
||||
xmin = *pt;
|
||||
if( xmax < *pt )
|
||||
xmax = *pt;
|
||||
pt++;
|
||||
if( ymin > *pt )
|
||||
ymin = *pt;
|
||||
if( ymax < *pt )
|
||||
ymax = *pt;
|
||||
pt++;
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
;
|
||||
}
|
||||
}
|
||||
|
||||
// Update the BoundaryBox. Remenber the fact the screen Y axis is the reverse */
|
||||
ymax = -ymax; ymin = -ymin; // Y is is screen axis sense
|
||||
// Ensure w and H > 0 (wxRect assume it)
|
||||
if( xmax < xmin )
|
||||
EXCHG( xmax, xmin );
|
||||
if( ymax < ymin )
|
||||
EXCHG( ymax, ymin );
|
||||
BoundaryBox.SetX( xmin ); BoundaryBox.SetWidth( xmax - xmin );
|
||||
BoundaryBox.SetY( ymin ); BoundaryBox.SetHeight( ymax - ymin );
|
||||
|
||||
return BoundaryBox;
|
||||
}
|
||||
|
||||
|
||||
/***************************/
|
||||
/* class LibraryFieldEntry */
|
||||
/***************************/
|
||||
|
||||
/* a Field is a string linked to a component.
|
||||
* Unlike a pure graphic text, fields can be used in netlist generation
|
||||
* and other things.
|
||||
*
|
||||
* 4 fields have a special meaning:
|
||||
* REFERENCE
|
||||
* VALUE
|
||||
* FOOTPRINT NAME
|
||||
* SCHEMATIC LINK (reserved but not used in kicad)
|
||||
*/
|
||||
LibDrawField::LibDrawField( int idfield ) : LibEDA_BaseStruct( COMPONENT_FIELD_DRAW_TYPE )
|
||||
{
|
||||
m_FieldId = idfield; /* 0 a 11, 0 = REFERENCE, 1 = VALUE*/
|
||||
if( m_FieldId < 0 )
|
||||
m_FieldId = 0;
|
||||
if( m_FieldId >= NUMBER_OF_FIELDS )
|
||||
m_FieldId = NUMBER_OF_FIELDS - 1;
|
||||
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT;
|
||||
}
|
||||
|
||||
|
||||
LibDrawField::~LibDrawField()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
// Creation et Duplication d'un field
|
||||
LibDrawField* LibDrawField::GenCopy()
|
||||
{
|
||||
LibDrawField* newfield = new LibDrawField( m_FieldId );
|
||||
|
||||
Copy( newfield );
|
||||
|
||||
return newfield;
|
||||
}
|
||||
|
||||
|
||||
/** Function Copy
|
||||
* copy parameters of this to Target. Pointers are not copied
|
||||
* @param Target = the LibDrawField to set with "this" values
|
||||
*/
|
||||
void LibDrawField::Copy( LibDrawField* Target ) const
|
||||
{
|
||||
Target->m_Pos = m_Pos;
|
||||
Target->m_Size = m_Size;
|
||||
Target->m_Width = m_Width;
|
||||
Target->m_Orient = m_Orient;
|
||||
Target->m_Attributs = m_Attributs;
|
||||
Target->m_Text = m_Text;
|
||||
Target->m_Name = m_Name;
|
||||
Target->m_HJustify = m_HJustify;
|
||||
Target->m_VJustify = m_VJustify;
|
||||
Target->m_Italic = m_Italic;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
LibDrawArc::LibDrawArc() : LibEDA_BaseStruct( COMPONENT_ARC_DRAW_TYPE )
|
||||
/**************************************************************/
|
||||
{
|
||||
m_Rayon = 0;
|
||||
t1 = t2 = 0;
|
||||
m_Width = 0;
|
||||
m_Fill = NO_FILL;
|
||||
}
|
||||
|
||||
|
||||
/************************************/
|
||||
LibDrawArc* LibDrawArc::GenCopy()
|
||||
/************************************/
|
||||
{
|
||||
LibDrawArc* newitem = new LibDrawArc();
|
||||
|
||||
newitem->m_Pos = m_Pos;
|
||||
newitem->m_ArcStart = m_ArcStart;
|
||||
newitem->m_ArcEnd = m_ArcEnd;
|
||||
newitem->m_Rayon = m_Rayon;
|
||||
newitem->t1 = t1;
|
||||
newitem->t2 = t2;
|
||||
newitem->m_Width = m_Width;
|
||||
newitem->m_Unit = m_Unit;
|
||||
newitem->m_Convert = m_Convert;
|
||||
newitem->m_Flags = m_Flags;
|
||||
newitem->m_Fill = m_Fill;
|
||||
return newitem;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
LibDrawCircle::LibDrawCircle() : LibEDA_BaseStruct( COMPONENT_CIRCLE_DRAW_TYPE )
|
||||
/**********************************************************************/
|
||||
{
|
||||
m_Rayon = 0;
|
||||
m_Fill = NO_FILL;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************/
|
||||
LibDrawCircle* LibDrawCircle::GenCopy()
|
||||
/*******************************************/
|
||||
{
|
||||
LibDrawCircle* newitem = new LibDrawCircle();
|
||||
|
||||
newitem->m_Pos = m_Pos;
|
||||
newitem->m_Rayon = m_Rayon;
|
||||
newitem->m_Width = m_Width;
|
||||
newitem->m_Unit = m_Unit;
|
||||
newitem->m_Convert = m_Convert;
|
||||
newitem->m_Flags = m_Flags;
|
||||
newitem->m_Fill = m_Fill;
|
||||
return newitem;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
LibDrawText::LibDrawText() : LibEDA_BaseStruct( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ),
|
||||
EDA_TextStruct()
|
||||
/*****************************************************************/
|
||||
{
|
||||
m_Size = wxSize( 50, 50 );
|
||||
}
|
||||
|
||||
|
||||
/***************************************/
|
||||
LibDrawText* LibDrawText::GenCopy()
|
||||
/***************************************/
|
||||
{
|
||||
LibDrawText* newitem = new LibDrawText();
|
||||
|
||||
newitem->m_Pos = m_Pos;
|
||||
newitem->m_Orient = m_Orient;
|
||||
newitem->m_Size = m_Size;
|
||||
newitem->m_Attributs = m_Attributs;
|
||||
newitem->m_Unit = m_Unit;
|
||||
newitem->m_Convert = m_Convert;
|
||||
newitem->m_Flags = m_Flags;
|
||||
newitem->m_Text = m_Text;
|
||||
newitem->m_Width = m_Width;
|
||||
newitem->m_Italic = m_Italic;
|
||||
newitem->m_HJustify = m_HJustify;
|
||||
newitem->m_VJustify = m_VJustify;
|
||||
return newitem;
|
||||
}
|
||||
|
||||
|
||||
LibDrawSquare::LibDrawSquare() : LibEDA_BaseStruct( COMPONENT_RECT_DRAW_TYPE )
|
||||
{
|
||||
m_Width = 0;
|
||||
m_Fill = NO_FILL;
|
||||
}
|
||||
|
||||
|
||||
LibDrawSquare* LibDrawSquare::GenCopy()
|
||||
{
|
||||
LibDrawSquare* newitem = new LibDrawSquare();
|
||||
|
||||
newitem->m_Pos = m_Pos;
|
||||
newitem->m_End = m_End;
|
||||
newitem->m_Width = m_Width;
|
||||
newitem->m_Unit = m_Unit;
|
||||
newitem->m_Convert = m_Convert;
|
||||
newitem->m_Flags = m_Flags;
|
||||
newitem->m_Fill = m_Fill;
|
||||
return newitem;
|
||||
}
|
||||
|
||||
|
||||
LibDrawSegment::LibDrawSegment() : LibEDA_BaseStruct( COMPONENT_LINE_DRAW_TYPE )
|
||||
{
|
||||
m_Width = 0;
|
||||
}
|
||||
|
||||
|
||||
LibDrawSegment* LibDrawSegment::GenCopy()
|
||||
{
|
||||
LibDrawSegment* newitem = new LibDrawSegment();
|
||||
|
||||
newitem->m_Pos = m_Pos;
|
||||
newitem->m_End = m_End;
|
||||
newitem->m_Width = m_Width;
|
||||
newitem->m_Unit = m_Unit;
|
||||
newitem->m_Convert = m_Convert;
|
||||
newitem->m_Flags = m_Flags;
|
||||
return newitem;
|
||||
}
|
||||
|
||||
|
||||
LibDrawPolyline::LibDrawPolyline() : LibEDA_BaseStruct( COMPONENT_POLYLINE_DRAW_TYPE )
|
||||
{
|
||||
m_CornersCount = 0;
|
||||
m_PolyList = NULL;
|
||||
m_Fill = NO_FILL;
|
||||
m_Width = 0;
|
||||
}
|
||||
|
||||
|
||||
/************************************************/
|
||||
LibDrawPolyline* LibDrawPolyline::GenCopy()
|
||||
/************************************************/
|
||||
{
|
||||
LibDrawPolyline* newitem = new LibDrawPolyline();
|
||||
|
||||
int size;
|
||||
|
||||
newitem->m_CornersCount = m_CornersCount;
|
||||
size = sizeof(int) * 2 * m_CornersCount;
|
||||
if( size )
|
||||
{
|
||||
newitem->m_PolyList = (int*) MyMalloc( size );
|
||||
memcpy( newitem->m_PolyList, m_PolyList, size );
|
||||
}
|
||||
newitem->m_Width = m_Width;
|
||||
newitem->m_Unit = m_Unit;
|
||||
newitem->m_Convert = m_Convert;
|
||||
newitem->m_Flags = m_Flags;
|
||||
newitem->m_Fill = m_Fill;
|
||||
return newitem;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************/
|
||||
void LibDrawPolyline::AddPoint( const wxPoint& point )
|
||||
/***************************************************/
|
||||
|
||||
/* add a point to the polyline coordinate list, and realloc the memory
|
||||
*/
|
||||
{
|
||||
int allocsize;
|
||||
|
||||
m_CornersCount++;
|
||||
allocsize = 2 * sizeof(int) * m_CornersCount;
|
||||
if( m_PolyList == NULL )
|
||||
m_PolyList = (int*) MyMalloc( allocsize );
|
||||
else
|
||||
m_PolyList = (int*) realloc( m_PolyList, allocsize );
|
||||
|
||||
m_PolyList[(m_CornersCount * 2) - 2] = point.x;
|
||||
m_PolyList[(m_CornersCount * 2) - 1] = -point.y;
|
||||
}
|
||||
|
|
|
@ -1,24 +1,11 @@
|
|||
/****************************************************************/
|
||||
/* Headers fo library definition and lib component definitions */
|
||||
/****************************************************************/
|
||||
/**********************************/
|
||||
/* Headers fo library definition */
|
||||
/**********************************/
|
||||
|
||||
#ifndef CLASS_LIBRARY_H
|
||||
#define CLASS_LIBRARY_H
|
||||
|
||||
|
||||
/* Types for components in libraries
|
||||
* components can be a true component or an alias of a true component.
|
||||
*/
|
||||
enum LibrEntryType {
|
||||
ROOT, /* This is a true component standard EDA_LibComponentStruct */
|
||||
ALIAS /* This is an alias of a true component */
|
||||
};
|
||||
|
||||
/* values for member .m_Options */
|
||||
enum LibrEntryOptions {
|
||||
ENTRY_NORMAL, // Libentry is a standard component (real or alias)
|
||||
ENTRY_POWER // Libentry is a power symbol
|
||||
};
|
||||
#include "class_libentry.h"
|
||||
|
||||
|
||||
/******************************/
|
||||
|
@ -62,106 +49,4 @@ private:
|
|||
bool WriteHeader( FILE* file );
|
||||
};
|
||||
|
||||
|
||||
#include "classes_body_items.h"
|
||||
|
||||
|
||||
/* basic class to describe components in libraries (true component or alias), non used directly */
|
||||
class LibCmpEntry : public EDA_BaseStruct
|
||||
{
|
||||
public:
|
||||
LibrEntryType Type; /* Type = ROOT;
|
||||
* = ALIAS pour struct LibraryAliasType */
|
||||
LibDrawField m_Name; // name (74LS00 ..) in lib ( = VALUE )
|
||||
wxString m_Doc; /* documentation for info */
|
||||
wxString m_KeyWord; /* keyword list (used to select a group of components by keyword) */
|
||||
wxString m_DocFile; /* Associed doc filename */
|
||||
LibrEntryOptions m_Options; // special features (i.e. Entry is a POWER)
|
||||
|
||||
public:
|
||||
LibCmpEntry( LibrEntryType CmpType, const wxChar* CmpName );
|
||||
virtual ~LibCmpEntry();
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "LibCmpEntry" );
|
||||
}
|
||||
|
||||
/**
|
||||
* Function SaveDoc
|
||||
* writes the doc info out to a FILE in "*.dcm" format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
bool SaveDoc( FILE* aFile );
|
||||
};
|
||||
|
||||
|
||||
/*********************************************/
|
||||
/* class to handle an usual component in lib */
|
||||
/*********************************************/
|
||||
class EDA_LibComponentStruct : public LibCmpEntry
|
||||
{
|
||||
public:
|
||||
LibDrawField m_Prefix; /* Prefix ( U, IC ... ) = REFERENCE */
|
||||
wxArrayString m_AliasList; /* ALIAS list for the component */
|
||||
wxArrayString m_FootprintList; /* list of suitable footprint names for the component (wildcard names accepted)*/
|
||||
int m_UnitCount; /* Units (or sections) per package */
|
||||
bool m_UnitSelectionLocked; // True if units are differents and their selection is locked
|
||||
// (i.e. if part A cannot be automatically changed in part B
|
||||
int m_TextInside; /* if 0: pin name drawn on the pin itself
|
||||
* if > 0 pin name drawn inside the component,
|
||||
* with a distance of m_TextInside in mils */
|
||||
bool m_DrawPinNum;
|
||||
bool m_DrawPinName;
|
||||
LibDrawField* Fields; /* Auxiliairy Field list (id = 2 a 11) */
|
||||
LibEDA_BaseStruct* m_Drawings; /* How to draw this part */
|
||||
long m_LastDate; // Last change Date
|
||||
|
||||
public:
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "EDA_LibComponentStruct" );
|
||||
}
|
||||
|
||||
|
||||
EDA_LibComponentStruct( const wxChar* CmpName );
|
||||
EDA_Rect GetBoundaryBox( int Unit, int Convert ); /* return Box around the part. */
|
||||
|
||||
~EDA_LibComponentStruct();
|
||||
void SortDrawItems();
|
||||
|
||||
/**
|
||||
* Function Save
|
||||
* writes the data structures for this object out to a FILE in "*.lib" format.
|
||||
* @param aFile The FILE to write to.
|
||||
* @return bool - true if success writing else false.
|
||||
*/
|
||||
bool Save( FILE* aFile );
|
||||
|
||||
/** Function SetFields
|
||||
* initialize fields from a vector of fields
|
||||
* @param aFields a std::vector <LibDrawField> to import.
|
||||
*/
|
||||
void SetFields( const std::vector <LibDrawField> aFields );
|
||||
};
|
||||
|
||||
|
||||
/**************************************************************************/
|
||||
/* class to handle an alias of an usual component in lib (root component) */
|
||||
/**************************************************************************/
|
||||
class EDA_LibCmpAliasStruct : public LibCmpEntry
|
||||
{
|
||||
public:
|
||||
wxString m_RootName; /* Root component Part name */
|
||||
|
||||
public:
|
||||
EDA_LibCmpAliasStruct( const wxChar* CmpName, const wxChar* CmpRootName );
|
||||
~EDA_LibCmpAliasStruct();
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "EDA_LibCmpAliasStruct" );
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
#endif // CLASS_LIBRARY_H
|
||||
|
|
|
@ -385,3 +385,188 @@ bool LibDrawField::HitTest( const wxPoint& refPos )
|
|||
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
/**************************************************************/
|
||||
LibDrawArc::LibDrawArc() : LibEDA_BaseStruct( COMPONENT_ARC_DRAW_TYPE )
|
||||
/**************************************************************/
|
||||
{
|
||||
m_Rayon = 0;
|
||||
t1 = t2 = 0;
|
||||
m_Width = 0;
|
||||
m_Fill = NO_FILL;
|
||||
}
|
||||
|
||||
|
||||
/************************************/
|
||||
LibDrawArc* LibDrawArc::GenCopy()
|
||||
/************************************/
|
||||
{
|
||||
LibDrawArc* newitem = new LibDrawArc();
|
||||
|
||||
newitem->m_Pos = m_Pos;
|
||||
newitem->m_ArcStart = m_ArcStart;
|
||||
newitem->m_ArcEnd = m_ArcEnd;
|
||||
newitem->m_Rayon = m_Rayon;
|
||||
newitem->t1 = t1;
|
||||
newitem->t2 = t2;
|
||||
newitem->m_Width = m_Width;
|
||||
newitem->m_Unit = m_Unit;
|
||||
newitem->m_Convert = m_Convert;
|
||||
newitem->m_Flags = m_Flags;
|
||||
newitem->m_Fill = m_Fill;
|
||||
return newitem;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************************/
|
||||
LibDrawCircle::LibDrawCircle() : LibEDA_BaseStruct( COMPONENT_CIRCLE_DRAW_TYPE )
|
||||
/**********************************************************************/
|
||||
{
|
||||
m_Rayon = 0;
|
||||
m_Fill = NO_FILL;
|
||||
}
|
||||
|
||||
|
||||
/*******************************************/
|
||||
LibDrawCircle* LibDrawCircle::GenCopy()
|
||||
/*******************************************/
|
||||
{
|
||||
LibDrawCircle* newitem = new LibDrawCircle();
|
||||
|
||||
newitem->m_Pos = m_Pos;
|
||||
newitem->m_Rayon = m_Rayon;
|
||||
newitem->m_Width = m_Width;
|
||||
newitem->m_Unit = m_Unit;
|
||||
newitem->m_Convert = m_Convert;
|
||||
newitem->m_Flags = m_Flags;
|
||||
newitem->m_Fill = m_Fill;
|
||||
return newitem;
|
||||
}
|
||||
|
||||
|
||||
/*****************************************************************/
|
||||
LibDrawText::LibDrawText() : LibEDA_BaseStruct( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ),
|
||||
EDA_TextStruct()
|
||||
/*****************************************************************/
|
||||
{
|
||||
m_Size = wxSize( 50, 50 );
|
||||
}
|
||||
|
||||
|
||||
/***************************************/
|
||||
LibDrawText* LibDrawText::GenCopy()
|
||||
/***************************************/
|
||||
{
|
||||
LibDrawText* newitem = new LibDrawText();
|
||||
|
||||
newitem->m_Pos = m_Pos;
|
||||
newitem->m_Orient = m_Orient;
|
||||
newitem->m_Size = m_Size;
|
||||
newitem->m_Attributs = m_Attributs;
|
||||
newitem->m_Unit = m_Unit;
|
||||
newitem->m_Convert = m_Convert;
|
||||
newitem->m_Flags = m_Flags;
|
||||
newitem->m_Text = m_Text;
|
||||
newitem->m_Width = m_Width;
|
||||
newitem->m_Italic = m_Italic;
|
||||
newitem->m_HJustify = m_HJustify;
|
||||
newitem->m_VJustify = m_VJustify;
|
||||
return newitem;
|
||||
}
|
||||
|
||||
|
||||
LibDrawSquare::LibDrawSquare() : LibEDA_BaseStruct( COMPONENT_RECT_DRAW_TYPE )
|
||||
{
|
||||
m_Width = 0;
|
||||
m_Fill = NO_FILL;
|
||||
}
|
||||
|
||||
|
||||
LibDrawSquare* LibDrawSquare::GenCopy()
|
||||
{
|
||||
LibDrawSquare* newitem = new LibDrawSquare();
|
||||
|
||||
newitem->m_Pos = m_Pos;
|
||||
newitem->m_End = m_End;
|
||||
newitem->m_Width = m_Width;
|
||||
newitem->m_Unit = m_Unit;
|
||||
newitem->m_Convert = m_Convert;
|
||||
newitem->m_Flags = m_Flags;
|
||||
newitem->m_Fill = m_Fill;
|
||||
return newitem;
|
||||
}
|
||||
|
||||
|
||||
LibDrawSegment::LibDrawSegment() : LibEDA_BaseStruct( COMPONENT_LINE_DRAW_TYPE )
|
||||
{
|
||||
m_Width = 0;
|
||||
}
|
||||
|
||||
|
||||
LibDrawSegment* LibDrawSegment::GenCopy()
|
||||
{
|
||||
LibDrawSegment* newitem = new LibDrawSegment();
|
||||
|
||||
newitem->m_Pos = m_Pos;
|
||||
newitem->m_End = m_End;
|
||||
newitem->m_Width = m_Width;
|
||||
newitem->m_Unit = m_Unit;
|
||||
newitem->m_Convert = m_Convert;
|
||||
newitem->m_Flags = m_Flags;
|
||||
return newitem;
|
||||
}
|
||||
|
||||
|
||||
LibDrawPolyline::LibDrawPolyline() : LibEDA_BaseStruct( COMPONENT_POLYLINE_DRAW_TYPE )
|
||||
{
|
||||
m_CornersCount = 0;
|
||||
m_PolyList = NULL;
|
||||
m_Fill = NO_FILL;
|
||||
m_Width = 0;
|
||||
}
|
||||
|
||||
|
||||
/************************************************/
|
||||
LibDrawPolyline* LibDrawPolyline::GenCopy()
|
||||
/************************************************/
|
||||
{
|
||||
LibDrawPolyline* newitem = new LibDrawPolyline();
|
||||
|
||||
int size;
|
||||
|
||||
newitem->m_CornersCount = m_CornersCount;
|
||||
size = sizeof(int) * 2 * m_CornersCount;
|
||||
if( size )
|
||||
{
|
||||
newitem->m_PolyList = (int*) MyMalloc( size );
|
||||
memcpy( newitem->m_PolyList, m_PolyList, size );
|
||||
}
|
||||
newitem->m_Width = m_Width;
|
||||
newitem->m_Unit = m_Unit;
|
||||
newitem->m_Convert = m_Convert;
|
||||
newitem->m_Flags = m_Flags;
|
||||
newitem->m_Fill = m_Fill;
|
||||
return newitem;
|
||||
}
|
||||
|
||||
|
||||
/***************************************************/
|
||||
void LibDrawPolyline::AddPoint( const wxPoint& point )
|
||||
/***************************************************/
|
||||
|
||||
/* add a point to the polyline coordinate list, and realloc the memory
|
||||
*/
|
||||
{
|
||||
int allocsize;
|
||||
|
||||
m_CornersCount++;
|
||||
allocsize = 2 * sizeof(int) * m_CornersCount;
|
||||
if( m_PolyList == NULL )
|
||||
m_PolyList = (int*) MyMalloc( allocsize );
|
||||
else
|
||||
m_PolyList = (int*) realloc( m_PolyList, allocsize );
|
||||
|
||||
m_PolyList[(m_CornersCount * 2) - 2] = point.x;
|
||||
m_PolyList[(m_CornersCount * 2) - 1] = -point.y;
|
||||
}
|
||||
|
|
|
@ -2,6 +2,8 @@
|
|||
/* Headers fo library definition and lib component definitions */
|
||||
/****************************************************************/
|
||||
|
||||
/* Definitions of graphic items used to create shapes of component in libraries (libentry)
|
||||
*/
|
||||
#ifndef CLASSES_BODY_ITEMS_H
|
||||
#define CLASSES_BODY_ITEMS_H
|
||||
|
||||
|
@ -451,71 +453,4 @@ public:
|
|||
int aDrawMode, void* aData, int aTransformMatrix[2][2] );
|
||||
};
|
||||
|
||||
|
||||
/**********/
|
||||
/* Fields */
|
||||
/**********/
|
||||
|
||||
/* Fields , same as component fields.
|
||||
* can be defined in libraries (mandatory for ref and value, ca be useful for footprints)
|
||||
* 2 Fields are always defined :
|
||||
* Prefix (U, IC..) with gives the reference in schematic)
|
||||
* Name (74LS00..) used to find the component in libraries, and give the default value in schematic
|
||||
*/
|
||||
class LibDrawField : public LibEDA_BaseStruct
|
||||
, public EDA_TextStruct
|
||||
{
|
||||
public:
|
||||
int m_FieldId; /* 0 a 11
|
||||
* 0 = Reference; 1 = Value
|
||||
* 2 = Default footprint, 3 = subsheet (not used, reserved)
|
||||
* .. 11 other fields
|
||||
*/
|
||||
wxString m_Name; /* Field Name (not the fielsd text itself, that is .m_Text) */
|
||||
|
||||
public:
|
||||
|
||||
LibDrawField* Next() const { return (LibDrawField*) Pnext; }
|
||||
LibDrawField* Back() const { return (LibDrawField*) Pback; }
|
||||
|
||||
|
||||
LibDrawField( int idfield = 2 );
|
||||
~LibDrawField();
|
||||
virtual wxString GetClass() const
|
||||
{
|
||||
return wxT( "LibDrawField" );
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 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.
|
||||
*/
|
||||
virtual bool Save( FILE* aFile ) const;
|
||||
|
||||
|
||||
LibDrawField* GenCopy();
|
||||
|
||||
/** Function Copy
|
||||
* copy parameters of this to Target. Pointers are not copied
|
||||
* @param Target = the LibDrawField to set with "this" values
|
||||
*/
|
||||
void Copy( LibDrawField* Target ) const;
|
||||
|
||||
void SetFields( const std::vector <LibDrawField> aFields );
|
||||
|
||||
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor,
|
||||
int aDrawMode, void* aData, int aTransformMatrix[2][2] );
|
||||
|
||||
/**
|
||||
* Function HitTest
|
||||
* tests if the given wxPoint is within the bounds of this object.
|
||||
* @param refPos A wxPoint to test, in Field coordinate system
|
||||
* @return bool - true if a hit, else false
|
||||
*/
|
||||
bool HitTest( const wxPoint& refPos );
|
||||
};
|
||||
|
||||
#endif // CLASSES_BODY_ITEMS_H
|
||||
|
|
|
@ -23,7 +23,7 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
|
|||
SCH_COMPONENT* aComponent )
|
||||
/*********************************************************************/
|
||||
{
|
||||
if ( aComponent == NULL ) // Null component not accepted
|
||||
if( aComponent == NULL ) // Null component not accepted
|
||||
return;
|
||||
|
||||
parent->DrawPanel->m_IgnoreMouseEvents = TRUE;
|
||||
|
@ -47,6 +47,7 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
|
|||
parent->DrawPanel->m_IgnoreMouseEvents = FALSE;
|
||||
}
|
||||
|
||||
|
||||
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow* parent ) :
|
||||
DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP( parent )
|
||||
{
|
||||
|
@ -55,25 +56,25 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow
|
|||
m_LibEntry = NULL;
|
||||
m_skipCopyFromPanel = false;
|
||||
|
||||
wxListItem columnLabel;
|
||||
wxListItem columnLabel;
|
||||
|
||||
columnLabel.SetImage(-1);
|
||||
columnLabel.SetImage( -1 );
|
||||
|
||||
columnLabel.SetText( _("Name") );
|
||||
columnLabel.SetText( _( "Name" ) );
|
||||
fieldListCtrl->InsertColumn( 0, columnLabel );
|
||||
|
||||
columnLabel.SetText( _("Value") );
|
||||
columnLabel.SetText( _( "Value" ) );
|
||||
fieldListCtrl->InsertColumn( 1, columnLabel );
|
||||
|
||||
wxString label = _( "Size" ) + ReturnUnitSymbol( g_UnitMetric );
|
||||
textSizeLabel->SetLabel( label );
|
||||
|
||||
label = _( "Pos " );
|
||||
label = _( "Pos " );
|
||||
label += _( "X" );
|
||||
label += ReturnUnitSymbol( g_UnitMetric );
|
||||
posXLabel->SetLabel( label );
|
||||
|
||||
label = _( "Pos " );
|
||||
label = _( "Pos " );
|
||||
label += _( "Y" );
|
||||
label += ReturnUnitSymbol( g_UnitMetric );
|
||||
posYLabel->SetLabel( label );
|
||||
|
@ -86,7 +87,7 @@ DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow
|
|||
|
||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnListItemDeselected( wxListEvent& event )
|
||||
{
|
||||
D(printf("OnListItemDeselected()\n");)
|
||||
D( printf( "OnListItemDeselected()\n" ); )
|
||||
|
||||
if( !m_skipCopyFromPanel )
|
||||
{
|
||||
|
@ -98,7 +99,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnListItemDeselected( wxListEvent& even
|
|||
|
||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnListItemSelected( wxListEvent& event )
|
||||
{
|
||||
D(printf("OnListItemSelected()\n");)
|
||||
D( printf( "OnListItemSelected()\n" ); )
|
||||
|
||||
// remember the selected row, statically
|
||||
s_SelectedRow = event.GetIndex();
|
||||
|
@ -115,7 +116,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnCancelButtonClick( wxCommandEvent& ev
|
|||
|
||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
|
||||
{
|
||||
wxString newname = chipnameTextCtrl->GetValue();
|
||||
wxString newname = chipnameTextCtrl->GetValue();
|
||||
|
||||
newname.MakeUpper();
|
||||
newname.Replace( wxT( " " ), wxT( "_" ) );
|
||||
|
||||
|
@ -170,6 +172,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToOptions()
|
|||
}
|
||||
|
||||
int mirror = mirrorRadioBox->GetSelection();
|
||||
|
||||
switch( mirror )
|
||||
{
|
||||
case 0:
|
||||
|
@ -198,13 +201,13 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event
|
|||
m_Parent->SaveCopyInUndoList( m_Cmp, IS_CHANGED );
|
||||
|
||||
// change all field positions from relative to absolute
|
||||
for( unsigned i=0; i<m_FieldsBuf.size(); ++i )
|
||||
for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
|
||||
{
|
||||
m_FieldsBuf[i].m_Pos += m_Cmp->m_Pos;
|
||||
}
|
||||
|
||||
// delete any fields with no name
|
||||
for( unsigned i=FIELD1; i<m_FieldsBuf.size(); )
|
||||
for( unsigned i = FIELD1; i<m_FieldsBuf.size(); )
|
||||
{
|
||||
if( m_FieldsBuf[i].m_Name.IsEmpty() )
|
||||
{
|
||||
|
@ -216,7 +219,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event
|
|||
}
|
||||
|
||||
EDA_LibComponentStruct* entry = FindLibPart(
|
||||
m_Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
||||
m_Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
||||
|
||||
if( entry && entry->m_Options == ENTRY_POWER )
|
||||
m_FieldsBuf[VALUE].m_Text = m_Cmp->m_ChipName;
|
||||
|
@ -236,12 +239,12 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::OnOKButtonClick( wxCommandEvent& event
|
|||
|
||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::addFieldButtonHandler( wxCommandEvent& event )
|
||||
{
|
||||
// in case m_FieldsBuf[REFERENCE].m_Orient has changed on screen only, grab
|
||||
// screen contents.
|
||||
// in case m_FieldsBuf[REFERENCE].m_Orient has changed on screen only, grab
|
||||
// screen contents.
|
||||
if( !copyPanelToSelectedField() )
|
||||
return;
|
||||
|
||||
unsigned fieldNdx = m_FieldsBuf.size();
|
||||
unsigned fieldNdx = m_FieldsBuf.size();
|
||||
|
||||
SCH_CMP_FIELD blank( wxPoint(), fieldNdx, m_Cmp );
|
||||
|
||||
|
@ -300,13 +303,13 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC:: moveUpButtonHandler( wxCommandEvent& e
|
|||
|
||||
// swap the fieldNdx field with the one before it, in both the vector
|
||||
// and in the fieldListCtrl
|
||||
SCH_CMP_FIELD tmp = m_FieldsBuf[fieldNdx-1];
|
||||
SCH_CMP_FIELD tmp = m_FieldsBuf[fieldNdx - 1];
|
||||
|
||||
D(printf("tmp.m_Text=\"%s\" tmp.m_Name=\"%s\"\n",
|
||||
CONV_TO_UTF8(tmp.m_Text), CONV_TO_UTF8(tmp.m_Name) ); )
|
||||
D( printf( "tmp.m_Text=\"%s\" tmp.m_Name=\"%s\"\n",
|
||||
CONV_TO_UTF8( tmp.m_Text ), CONV_TO_UTF8( tmp.m_Name ) ); )
|
||||
|
||||
m_FieldsBuf[fieldNdx-1] = m_FieldsBuf[fieldNdx];
|
||||
setRowItem( fieldNdx-1, m_FieldsBuf[fieldNdx] );
|
||||
m_FieldsBuf[fieldNdx - 1] = m_FieldsBuf[fieldNdx];
|
||||
setRowItem( fieldNdx - 1, m_FieldsBuf[fieldNdx] );
|
||||
|
||||
m_FieldsBuf[fieldNdx] = tmp;
|
||||
setRowItem( fieldNdx, tmp );
|
||||
|
@ -320,8 +323,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC:: moveUpButtonHandler( wxCommandEvent& e
|
|||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setSelectedFieldNdx( int aFieldNdx )
|
||||
{
|
||||
/* deselect old selection, but I think this is done by single selection flag within fieldListCtrl
|
||||
fieldListCtrl->SetItemState( s_SelectedRow, 0, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
|
||||
*/
|
||||
* fieldListCtrl->SetItemState( s_SelectedRow, 0, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
|
||||
*/
|
||||
|
||||
if( aFieldNdx >= (int) m_FieldsBuf.size() )
|
||||
aFieldNdx = m_FieldsBuf.size() - 1;
|
||||
|
@ -351,27 +354,29 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
|
|||
m_LibEntry = FindLibPart( m_Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
|
||||
|
||||
#if 0 && defined(DEBUG)
|
||||
for( int i=0; i<aComponent->GetFieldCount(); ++i )
|
||||
for( int i = 0; i<aComponent->GetFieldCount(); ++i )
|
||||
{
|
||||
printf("Orig[%d] (x=%d, y=%d)\n", i, aComponent->m_Fields[i].m_Pos.x,
|
||||
aComponent->m_Fields[i].m_Pos.y );
|
||||
printf( "Orig[%d] (x=%d, y=%d)\n", i, aComponent->m_Fields[i].m_Pos.x,
|
||||
aComponent->m_Fields[i].m_Pos.y );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
// copy all the fields to a work area
|
||||
m_FieldsBuf = aComponent->m_Fields;
|
||||
|
||||
#if 0 && defined(DEBUG)
|
||||
for( unsigned i=0; i<m_FieldsBuf.size(); ++i )
|
||||
for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
|
||||
{
|
||||
printf("m_FieldsBuf[%d] (x=%d, y=%d)\n", i, m_FieldsBuf[i].m_Pos.x,
|
||||
m_FieldsBuf[i].m_Pos.y );
|
||||
printf( "m_FieldsBuf[%d] (x=%d, y=%d)\n", i, m_FieldsBuf[i].m_Pos.x,
|
||||
m_FieldsBuf[i].m_Pos.y );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
m_FieldsBuf[REFERENCE].m_Text = m_Cmp->GetRef( m_Parent->GetSheet() );
|
||||
|
||||
for( unsigned i=0; i<m_FieldsBuf.size(); ++i )
|
||||
for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
|
||||
{
|
||||
// make the editable field position relative to the component
|
||||
m_FieldsBuf[i].m_Pos -= m_Cmp->m_Pos;
|
||||
|
@ -380,11 +385,12 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::InitBuffers( SCH_COMPONENT* aComponent
|
|||
}
|
||||
|
||||
#if 0 && defined(DEBUG)
|
||||
for( unsigned i=0; i<m_FieldsBuf.size(); ++i )
|
||||
for( unsigned i = 0; i<m_FieldsBuf.size(); ++i )
|
||||
{
|
||||
printf("after[%d] (x=%d, y=%d)\n", i, m_FieldsBuf[i].m_Pos.x,
|
||||
m_FieldsBuf[i].m_Pos.y );
|
||||
printf( "after[%d] (x=%d, y=%d)\n", i, m_FieldsBuf[i].m_Pos.x,
|
||||
m_FieldsBuf[i].m_Pos.y );
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
copyOptionsToPanel();
|
||||
|
@ -404,7 +410,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::setRowItem( int aFieldNdx, const SCH_CM
|
|||
// insert blanks if aFieldNdx is referencing a "yet to be defined" row
|
||||
while( aFieldNdx >= fieldListCtrl->GetItemCount() )
|
||||
{
|
||||
long ndx = fieldListCtrl->InsertItem( fieldListCtrl->GetItemCount(), wxEmptyString );
|
||||
long ndx = fieldListCtrl->InsertItem( fieldListCtrl->GetItemCount(), wxEmptyString );
|
||||
|
||||
wxASSERT( ndx >= 0 );
|
||||
|
||||
|
@ -429,18 +435,18 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
|
|||
if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
|
||||
return;
|
||||
|
||||
SCH_CMP_FIELD& field = m_FieldsBuf[fieldNdx];
|
||||
SCH_CMP_FIELD& field = m_FieldsBuf[fieldNdx];
|
||||
|
||||
showCheckBox->SetValue( !(field.m_Attributs & TEXT_NO_VISIBLE) );
|
||||
|
||||
rotateCheckBox->SetValue( field.m_Orient == TEXT_ORIENT_VERT );
|
||||
|
||||
int style = 0;
|
||||
if ( field.m_Italic )
|
||||
style = 1;
|
||||
if ( field.m_Width > 1 )
|
||||
style |= 2;
|
||||
m_StyleRadioBox->SetSelection(style);
|
||||
int style = 0;
|
||||
if( field.m_Italic )
|
||||
style = 1;
|
||||
if( field.m_Width > 1 )
|
||||
style |= 2;
|
||||
m_StyleRadioBox->SetSelection( style );
|
||||
|
||||
fieldNameTextCtrl->SetValue( field.m_Name );
|
||||
|
||||
|
@ -454,7 +460,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
|
|||
fieldValueTextCtrl->Enable( FALSE );
|
||||
|
||||
textSizeTextCtrl->SetValue(
|
||||
WinEDA_GraphicTextCtrl::FormatSize( EESCHEMA_INTERNAL_UNIT, g_UnitMetric, field.m_Size.x ) );
|
||||
WinEDA_GraphicTextCtrl::FormatSize( EESCHEMA_INTERNAL_UNIT, g_UnitMetric, field.m_Size.x ) );
|
||||
|
||||
wxPoint coord = field.m_Pos;
|
||||
wxPoint zero = -m_Cmp->m_Pos; // relative zero
|
||||
|
@ -467,8 +473,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copySelectedFieldToPanel()
|
|||
{
|
||||
rotateCheckBox->SetValue( m_FieldsBuf[REFERENCE].m_Orient == TEXT_ORIENT_VERT );
|
||||
|
||||
coord.x = m_FieldsBuf[REFERENCE].m_Pos.x + (fieldNdx-FIELD1+1)*100;
|
||||
coord.y = m_FieldsBuf[REFERENCE].m_Pos.y + (fieldNdx-FIELD1+1)*100;
|
||||
coord.x = m_FieldsBuf[REFERENCE].m_Pos.x + (fieldNdx - FIELD1 + 1) * 100;
|
||||
coord.y = m_FieldsBuf[REFERENCE].m_Pos.y + (fieldNdx - FIELD1 + 1) * 100;
|
||||
|
||||
// coord can compute negative if field is < FIELD1, e.g. FOOTPRINT.
|
||||
// That is ok, we basically don't want all the new empty fields on
|
||||
|
@ -492,7 +498,7 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
|
|||
if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
|
||||
return true;
|
||||
|
||||
SCH_CMP_FIELD& field = m_FieldsBuf[fieldNdx];
|
||||
SCH_CMP_FIELD& field = m_FieldsBuf[fieldNdx];
|
||||
|
||||
if( showCheckBox->GetValue() )
|
||||
field.m_Attributs &= ~TEXT_NO_VISIBLE;
|
||||
|
@ -512,19 +518,20 @@ bool DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyPanelToSelectedField()
|
|||
|
||||
setRowItem( fieldNdx, field ); // update fieldListCtrl
|
||||
|
||||
field.m_Size.x = WinEDA_GraphicTextCtrl::ParseSize( textSizeTextCtrl->GetValue(), EESCHEMA_INTERNAL_UNIT, g_UnitMetric );
|
||||
field.m_Size.x = WinEDA_GraphicTextCtrl::ParseSize(
|
||||
textSizeTextCtrl->GetValue(), EESCHEMA_INTERNAL_UNIT, g_UnitMetric );
|
||||
field.m_Size.y = field.m_Size.x;
|
||||
|
||||
int style = m_StyleRadioBox->GetSelection( );
|
||||
if ( (style & 1 ) != 0 )
|
||||
field.m_Italic = true;
|
||||
else
|
||||
field.m_Italic = false;
|
||||
int style = m_StyleRadioBox->GetSelection();
|
||||
if( (style & 1 ) != 0 )
|
||||
field.m_Italic = true;
|
||||
else
|
||||
field.m_Italic = false;
|
||||
|
||||
if ( (style & 2 ) != 0 )
|
||||
field.m_Width = field.m_Size.x / 4;
|
||||
else
|
||||
field.m_Width = 0;
|
||||
if( (style & 2 ) != 0 )
|
||||
field.m_Width = field.m_Size.x / 4;
|
||||
else
|
||||
field.m_Width = 0;
|
||||
|
||||
double value;
|
||||
|
||||
|
@ -544,14 +551,15 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
|
|||
|
||||
// Remove non existing choices (choiceCount must be <= number for parts)
|
||||
int unitcount = m_LibEntry ? m_LibEntry->m_UnitCount : 1;
|
||||
if ( unitcount < 1 )
|
||||
|
||||
if( unitcount < 1 )
|
||||
unitcount = 1;
|
||||
if( unitcount < choiceCount )
|
||||
{
|
||||
while ( unitcount < choiceCount )
|
||||
while( unitcount < choiceCount )
|
||||
{
|
||||
choiceCount--;
|
||||
unitChoice->Delete ( choiceCount );
|
||||
unitChoice->Delete( choiceCount );
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -561,8 +569,8 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
|
|||
unitChoice->SetSelection( m_Cmp->m_Multi - 1 );
|
||||
|
||||
// Disable unit selection if only one unit exists:
|
||||
if ( choiceCount <= 1 )
|
||||
unitChoice->Enable(false);
|
||||
if( choiceCount <= 1 )
|
||||
unitChoice->Enable( false );
|
||||
|
||||
int orientation = m_Cmp->GetRotationMiroir() & ~(CMP_MIROIR_X | CMP_MIROIR_Y);
|
||||
|
||||
|
@ -580,12 +588,12 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
|
|||
if( mirror == CMP_MIROIR_X )
|
||||
{
|
||||
mirrorRadioBox->SetSelection( 1 );
|
||||
D(printf("mirror=X,1\n");)
|
||||
D( printf( "mirror=X,1\n" ); )
|
||||
}
|
||||
else if( mirror == CMP_MIROIR_Y )
|
||||
{
|
||||
mirrorRadioBox->SetSelection( 2 );
|
||||
D(printf("mirror=Y,2\n");)
|
||||
D( printf( "mirror=Y,2\n" ); )
|
||||
}
|
||||
else
|
||||
mirrorRadioBox->SetSelection( 0 );
|
||||
|
@ -604,7 +612,7 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
|
|||
// Show the "Parts Locked" option?
|
||||
if( !m_LibEntry || !m_LibEntry->m_UnitSelectionLocked )
|
||||
{
|
||||
D(printf("partsAreLocked->false\n");)
|
||||
D( printf( "partsAreLocked->false\n" ); )
|
||||
partsAreLockedLabel->Show( false );
|
||||
}
|
||||
|
||||
|
@ -616,8 +624,9 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::copyOptionsToPanel()
|
|||
/*****************************************************************************/
|
||||
void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
|
||||
/*****************************************************************************/
|
||||
|
||||
/* reinitialise components parametres to default values found in lib
|
||||
*/
|
||||
*/
|
||||
{
|
||||
EDA_LibComponentStruct* entry;
|
||||
|
||||
|
@ -635,23 +644,21 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
|
|||
RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, g_XorMode );
|
||||
|
||||
/* Initialise fields values to default values found in library: */
|
||||
m_Cmp->GetField( REFERENCE )->m_Pos.x =
|
||||
entry->m_Prefix.m_Pos.x + m_Cmp->m_Pos.x;
|
||||
m_Cmp->GetField( REFERENCE )->m_Pos.y =
|
||||
entry->m_Prefix.m_Pos.y + m_Cmp->m_Pos.y;
|
||||
m_Cmp->GetField( REFERENCE )->m_Pos = entry->m_Prefix.m_Pos + m_Cmp->m_Pos;
|
||||
m_Cmp->GetField( REFERENCE )->m_Orient = entry->m_Prefix.m_Orient;
|
||||
m_Cmp->GetField( REFERENCE )->m_Size = entry->m_Prefix.m_Size;
|
||||
m_Cmp->GetField( REFERENCE )->m_HJustify = entry->m_Prefix.m_HJustify;
|
||||
m_Cmp->GetField( REFERENCE )->m_VJustify = entry->m_Prefix.m_VJustify;
|
||||
m_Cmp->GetField( REFERENCE )->m_Italic = entry->m_Prefix.m_Italic;
|
||||
m_Cmp->GetField( REFERENCE )->m_Width = entry->m_Prefix.m_Width;
|
||||
|
||||
m_Cmp->GetField( VALUE )->m_Pos.x =
|
||||
entry->m_Name.m_Pos.x + m_Cmp->m_Pos.x;
|
||||
m_Cmp->GetField( VALUE )->m_Pos.y =
|
||||
entry->m_Name.m_Pos.y + m_Cmp->m_Pos.y;
|
||||
m_Cmp->GetField( VALUE )->m_Pos = entry->m_Name.m_Pos + m_Cmp->m_Pos;
|
||||
m_Cmp->GetField( VALUE )->m_Orient = entry->m_Name.m_Orient;
|
||||
m_Cmp->GetField( VALUE )->m_Size = entry->m_Name.m_Size;
|
||||
m_Cmp->GetField( VALUE )->m_HJustify = entry->m_Name.m_HJustify;
|
||||
m_Cmp->GetField( VALUE )->m_VJustify = entry->m_Name.m_VJustify;
|
||||
m_Cmp->GetField( VALUE )->m_Italic = entry->m_Name.m_Italic;
|
||||
m_Cmp->GetField( VALUE )->m_Width = entry->m_Name.m_Width;
|
||||
|
||||
m_Cmp->SetRotationMiroir( CMP_NORMAL );
|
||||
|
||||
|
@ -660,4 +667,3 @@ void DIALOG_EDIT_COMPONENT_IN_SCHEMATIC::SetInitCmp( wxCommandEvent& event )
|
|||
RedrawOneStruct( m_Parent->DrawPanel, &dc, m_Cmp, GR_DEFAULT_DRAWMODE );
|
||||
EndModal( 1 );
|
||||
}
|
||||
|
||||
|
|
|
@ -868,8 +868,7 @@ NumOfLibraries()
|
|||
|
||||
|
||||
/*****************************************************************************/
|
||||
static bool
|
||||
GetLibEntryField (EDA_LibComponentStruct* LibEntry,
|
||||
static bool GetLibEntryField (EDA_LibComponentStruct* LibEntry,
|
||||
char* line)
|
||||
/*****************************************************************************/
|
||||
|
||||
|
@ -939,11 +938,6 @@ GetLibEntryField (EDA_LibComponentStruct* LibEntry,
|
|||
vjustify = GR_TEXT_VJUSTIFY_BOTTOM;
|
||||
else if( Char4[0] == 'T' )
|
||||
vjustify = GR_TEXT_VJUSTIFY_TOP;
|
||||
|
||||
if ( Char4[1] == 'I' ) // Italic
|
||||
Field->m_Italic = true;
|
||||
if ( Char4[2] == 'B' ) // Bold
|
||||
Field->m_Width = size / 4;
|
||||
}
|
||||
|
||||
switch( NumOfField )
|
||||
|
@ -975,6 +969,11 @@ GetLibEntryField (EDA_LibComponentStruct* LibEntry,
|
|||
Field->m_Pos.x = posx; Field->m_Pos.y = posy;
|
||||
Field->m_Orient = orient;
|
||||
|
||||
if ( Char4[1] == 'I' ) // Italic
|
||||
Field->m_Italic = true;
|
||||
if ( Char4[2] == 'B' ) // Bold
|
||||
Field->m_Width = size / 4;
|
||||
|
||||
if( draw == FALSE )
|
||||
Field->m_Attributs |= TEXT_NO_VISIBLE;
|
||||
|
||||
|
|
|
@ -31,7 +31,7 @@ wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent )
|
|||
wxSemaphore semaphore( 0, 1 );
|
||||
WinEDA_SchematicFrame* frame;
|
||||
|
||||
frame = (WinEDA_SchematicFrame*)wxGetApp().GetTopWindow();
|
||||
frame = (WinEDA_SchematicFrame*) wxGetApp().GetTopWindow();
|
||||
|
||||
Viewer = frame->m_ViewlibFrame;
|
||||
/* Close the current Lib browser, if open, and open a new one, in "modal" mode */
|
||||
|
@ -39,7 +39,7 @@ wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent )
|
|||
Viewer->Destroy();
|
||||
|
||||
Viewer = frame->m_ViewlibFrame =
|
||||
new WinEDA_ViewlibFrame( frame, NULL, &semaphore );
|
||||
new WinEDA_ViewlibFrame( frame, NULL, &semaphore );
|
||||
Viewer->AdjustScrollBars();
|
||||
|
||||
// Show the library viewer frame until it is closed
|
||||
|
@ -55,10 +55,10 @@ wxString SelectFromLibBrowser( WinEDA_DrawFrame* parent )
|
|||
|
||||
|
||||
/**************************************************************************/
|
||||
SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component(wxDC* DC,
|
||||
const wxString& libname,
|
||||
wxArrayString& HistoryList,
|
||||
bool UseLibBrowser )
|
||||
SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
|
||||
const wxString& libname,
|
||||
wxArrayString& HistoryList,
|
||||
bool UseLibBrowser )
|
||||
/**************************************************************************/
|
||||
|
||||
/* load from a library and place a component
|
||||
|
@ -66,7 +66,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component(wxDC* DC,
|
|||
* else search in all loaded libs
|
||||
*/
|
||||
{
|
||||
int ii, CmpCount = 0;
|
||||
int ii, CmpCount = 0;
|
||||
LibDrawField* Field;
|
||||
EDA_LibComponentStruct* Entry = NULL;
|
||||
SCH_COMPONENT* DrawLibItem = NULL;
|
||||
|
@ -184,16 +184,15 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component(wxDC* DC,
|
|||
DrawLibItem->m_Flags = IS_NEW | IS_MOVED;
|
||||
|
||||
/* Init champ Valeur */
|
||||
DrawLibItem->GetField( VALUE )->m_Pos.x =
|
||||
Entry->m_Name.m_Pos.x + DrawLibItem->m_Pos.x;
|
||||
DrawLibItem->GetField( VALUE )->m_Pos.y =
|
||||
Entry->m_Name.m_Pos.y + DrawLibItem->m_Pos.y;
|
||||
DrawLibItem->GetField( VALUE )->m_Pos = Entry->m_Name.m_Pos + DrawLibItem->m_Pos;
|
||||
DrawLibItem->GetField( VALUE )->m_Orient = Entry->m_Name.m_Orient;
|
||||
DrawLibItem->GetField( VALUE )->m_Size = Entry->m_Name.m_Size;
|
||||
DrawLibItem->GetField( VALUE )->m_Text = DrawLibItem->m_ChipName;
|
||||
DrawLibItem->GetField( VALUE )->m_Attributs = Entry->m_Name.m_Attributs;
|
||||
DrawLibItem->GetField( VALUE )->m_HJustify = Entry->m_Name.m_HJustify;
|
||||
DrawLibItem->GetField( VALUE )->m_VJustify = Entry->m_Name.m_VJustify;
|
||||
DrawLibItem->GetField( VALUE )->m_Italic = Entry->m_Name.m_Italic;
|
||||
DrawLibItem->GetField( VALUE )->m_Width = Entry->m_Name.m_Width;
|
||||
|
||||
msg = Entry->m_Prefix.m_Text;
|
||||
if( msg.IsEmpty() )
|
||||
|
@ -204,19 +203,16 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component(wxDC* DC,
|
|||
DrawLibItem->SetRef( GetSheet(), msg );
|
||||
|
||||
/* Init champ Reference */
|
||||
DrawLibItem->GetField( REFERENCE )->m_Pos.x =
|
||||
Entry->m_Prefix.m_Pos.x + DrawLibItem->m_Pos.x;
|
||||
DrawLibItem->GetField( REFERENCE )->m_Pos.y =
|
||||
Entry->m_Prefix.m_Pos.y + DrawLibItem->m_Pos.y;
|
||||
DrawLibItem->GetField( REFERENCE )->m_Pos =
|
||||
Entry->m_Prefix.m_Pos + DrawLibItem->m_Pos;
|
||||
DrawLibItem->GetField( REFERENCE )->m_Orient = Entry->m_Prefix.m_Orient;
|
||||
DrawLibItem->GetField( REFERENCE )->m_Size = Entry->m_Prefix.m_Size;
|
||||
DrawLibItem->m_PrefixString = Entry->m_Prefix.m_Text;
|
||||
DrawLibItem->GetField( REFERENCE )->m_Attributs =
|
||||
Entry->m_Prefix.m_Attributs;
|
||||
DrawLibItem->GetField( REFERENCE )->m_HJustify =
|
||||
Entry->m_Prefix.m_HJustify;
|
||||
DrawLibItem->GetField( REFERENCE )->m_VJustify =
|
||||
Entry->m_Prefix.m_VJustify;
|
||||
DrawLibItem->GetField( REFERENCE )->m_Attributs = Entry->m_Prefix.m_Attributs;
|
||||
DrawLibItem->GetField( REFERENCE )->m_HJustify = Entry->m_Prefix.m_HJustify;
|
||||
DrawLibItem->GetField( REFERENCE )->m_VJustify = Entry->m_Prefix.m_VJustify;
|
||||
DrawLibItem->GetField( REFERENCE )->m_Italic = Entry->m_Prefix.m_Italic;
|
||||
DrawLibItem->GetField( REFERENCE )->m_Width = Entry->m_Prefix.m_Width;
|
||||
|
||||
/* Init des autres champs si predefinis dans la librairie */
|
||||
for( Field = Entry->Fields; Field != NULL; Field = Field->Next() )
|
||||
|
@ -233,15 +229,16 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component(wxDC* DC,
|
|||
|
||||
SCH_CMP_FIELD* f = DrawLibItem->GetField( ii );
|
||||
|
||||
f->m_Pos.x += Field->m_Pos.x;
|
||||
f->m_Pos.y += Field->m_Pos.y;
|
||||
f->m_Size = Field->m_Size;
|
||||
f->m_Pos += Field->m_Pos;
|
||||
f->m_Size = Field->m_Size;
|
||||
f->m_Attributs = Field->m_Attributs;
|
||||
f->m_Orient = Field->m_Orient;
|
||||
f->m_Text = Field->m_Text;
|
||||
f->m_Name = Field->m_Name;
|
||||
f->m_HJustify = Field->m_HJustify;
|
||||
f->m_VJustify = Field->m_VJustify;
|
||||
f->m_Text = Field->m_Text;
|
||||
f->m_Name = Field->m_Name;
|
||||
f->m_HJustify = Field->m_HJustify;
|
||||
f->m_VJustify = Field->m_VJustify;
|
||||
f->m_Italic = Field->m_Italic;
|
||||
f->m_Width = Field->m_Width;
|
||||
}
|
||||
|
||||
DrawStructsInGhost( DrawPanel, DC, DrawLibItem, 0, 0 );
|
||||
|
|
|
@ -19,6 +19,8 @@ OBJECTS = eeschema.o\
|
|||
dangling_ends.o\
|
||||
cross-probing.o\
|
||||
setpage.o\
|
||||
class_libentry.o\
|
||||
class_libentry_fields.o\
|
||||
class_schematic_items.o\
|
||||
class_sch_cmp_field.o\
|
||||
classes_body_items.o\
|
||||
|
|
|
@ -185,44 +185,6 @@ bool LibDrawSegment::Save( FILE* ExportFile ) const
|
|||
}
|
||||
|
||||
|
||||
/**************************************************/
|
||||
bool LibDrawField::Save( FILE* ExportFile ) const
|
||||
/**************************************************/
|
||||
{
|
||||
int hjustify, vjustify;
|
||||
wxString text = m_Text;
|
||||
|
||||
hjustify = 'C';
|
||||
if( m_HJustify == GR_TEXT_HJUSTIFY_LEFT )
|
||||
hjustify = 'L';
|
||||
else if( m_HJustify == GR_TEXT_HJUSTIFY_RIGHT )
|
||||
hjustify = 'R';
|
||||
vjustify = 'C';
|
||||
if( m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM )
|
||||
vjustify = 'B';
|
||||
else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP )
|
||||
vjustify = 'T';
|
||||
if( text.IsEmpty() )
|
||||
text = wxT( "~" );
|
||||
fprintf( ExportFile, "F%d \"%s\" %d %d %d %c %c %c %c%c%c",
|
||||
m_FieldId, CONV_TO_UTF8( text ),
|
||||
m_Pos.x, m_Pos.y,
|
||||
m_Size.x,
|
||||
m_Orient == 0 ? 'H' : 'V',
|
||||
(m_Attributs & TEXT_NO_VISIBLE ) ? 'I' : 'V',
|
||||
hjustify, vjustify,
|
||||
m_Italic ? 'I' : 'N',
|
||||
m_Width > 1 ? 'B' : 'N');
|
||||
|
||||
// Save field name, if necessary
|
||||
if( m_FieldId >= FIELD1 && !m_Name.IsEmpty() )
|
||||
fprintf( ExportFile, " \"%s\"", CONV_TO_UTF8( m_Name ) );
|
||||
|
||||
fprintf( ExportFile, "\n" );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
/**********************************************************/
|
||||
LibEDA_BaseStruct* CopyDrawEntryStruct( wxWindow* frame,
|
||||
LibEDA_BaseStruct* DrawItem )
|
||||
|
|
Loading…
Reference in New Issue