Replace library editor new component dialog and minor updates.

* Replace component library editor new component dialog using wxFormBuilder.
* Rename component library draw items to conform to current coding standards.
* Add GetWidth() method to component library draw objects.
* Add regular expression key word search capability to component library object.
This commit is contained in:
stambaughw 2009-10-08 13:19:28 +00:00
parent 498f0c9164
commit ee918d7d29
47 changed files with 2297 additions and 2453 deletions

View File

@ -43,7 +43,6 @@ set(EESCHEMA_SRCS
dialog_build_BOM.cpp dialog_build_BOM.cpp
dialog_build_BOM_base.cpp dialog_build_BOM_base.cpp
# dialog_cmp_graphic_properties.cpp # dialog_cmp_graphic_properties.cpp
dialog_create_component.cpp
dialog_edit_component_in_lib.cpp dialog_edit_component_in_lib.cpp
dialog_edit_component_in_lib_base.cpp dialog_edit_component_in_lib_base.cpp
dialog_edit_component_in_schematic_fbp.cpp dialog_edit_component_in_schematic_fbp.cpp
@ -57,6 +56,8 @@ set(EESCHEMA_SRCS
dialog_erc.cpp dialog_erc.cpp
dialog_erc_base.cpp dialog_erc_base.cpp
# dialog_find.cpp # dialog_find.cpp
dialog_lib_new_component.cpp
dialog_lib_new_component_base.cpp
dialog_options.cpp dialog_options.cpp
dialog_print_using_printer_base.cpp dialog_print_using_printer_base.cpp
dialog_print_using_printer.cpp dialog_print_using_printer.cpp

View File

@ -861,10 +861,10 @@ static LIB_DRAW_ITEM* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
*/ */
{ {
static LIB_COMPONENT* Entry; static LIB_COMPONENT* Entry;
static LibDrawPin* NextPin; static LIB_PIN* NextPin;
static int Multi, convert, TransMat[2][2]; static int Multi, convert, TransMat[2][2];
int orient; int orient;
LibDrawPin* Pin; LIB_PIN* Pin;
static wxPoint CmpPosition; static wxPoint CmpPosition;
if( aDrawLibItem ) if( aDrawLibItem )

View File

@ -795,7 +795,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
*/ */
{ {
EDA_BaseStruct* item; EDA_BaseStruct* item;
LibDrawPin* pin; LIB_PIN* pin;
SCH_COMPONENT* LibItem = NULL; SCH_COMPONENT* LibItem = NULL;
Hierarchical_PIN_Sheet_Struct* pinsheet; Hierarchical_PIN_Sheet_Struct* pinsheet;
wxPoint itempos; wxPoint itempos;

View File

@ -3,7 +3,7 @@
/***************************/ /***************************/
/** /**
* class LibDrawText : describes a graphic text used to draw component shapes * class LIB_TEXT : describes a graphic text used to draw component shapes
* This is only a graphic item * This is only a graphic item
*/ */
@ -21,7 +21,7 @@
#include "protos.h" #include "protos.h"
LibDrawText::LibDrawText(LIB_COMPONENT * aParent) : LIB_TEXT::LIB_TEXT(LIB_COMPONENT * aParent) :
LIB_DRAW_ITEM( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE, aParent ), LIB_DRAW_ITEM( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE, aParent ),
EDA_TextStruct() EDA_TextStruct()
{ {
@ -30,7 +30,7 @@ LibDrawText::LibDrawText(LIB_COMPONENT * aParent) :
} }
bool LibDrawText::Save( FILE* ExportFile ) const bool LIB_TEXT::Save( FILE* ExportFile ) const
{ {
wxString text = m_Text; wxString text = m_Text;
@ -65,7 +65,7 @@ bool LibDrawText::Save( FILE* ExportFile ) const
} }
bool LibDrawText::Load( char* line, wxString& errorMsg ) bool LIB_TEXT::Load( char* line, wxString& errorMsg )
{ {
int cnt, thickness; int cnt, thickness;
char hjustify = 'C', vjustify = 'C'; char hjustify = 'C', vjustify = 'C';
@ -139,7 +139,7 @@ bool LibDrawText::Load( char* line, wxString& errorMsg )
* @param refPos A wxPoint to test * @param refPos A wxPoint to test
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
bool LibDrawText::HitTest( const wxPoint& refPos ) bool LIB_TEXT::HitTest( const wxPoint& refPos )
{ {
return HitTest( refPos, 0, DefaultTransformMatrix ); return HitTest( refPos, 0, DefaultTransformMatrix );
} }
@ -151,7 +151,7 @@ bool LibDrawText::HitTest( const wxPoint& refPos )
* @param aThreshold = unused here (TextHitTest calculates its threshold ) * @param aThreshold = unused here (TextHitTest calculates its threshold )
* @param aTransMat = the transform matrix * @param aTransMat = the transform matrix
*/ */
bool LibDrawText::HitTest( wxPoint aPosRef, int aThreshold, bool LIB_TEXT::HitTest( wxPoint aPosRef, int aThreshold,
const int aTransMat[2][2] ) const int aTransMat[2][2] )
{ {
wxPoint physicalpos = TransformCoordinate( aTransMat, m_Pos ); wxPoint physicalpos = TransformCoordinate( aTransMat, m_Pos );
@ -171,9 +171,9 @@ bool LibDrawText::HitTest( wxPoint aPosRef, int aThreshold,
} }
LIB_DRAW_ITEM* LibDrawText::DoGenCopy() LIB_DRAW_ITEM* LIB_TEXT::DoGenCopy()
{ {
LibDrawText* newitem = new LibDrawText(NULL); LIB_TEXT* newitem = new LIB_TEXT(NULL);
newitem->m_Pos = m_Pos; newitem->m_Pos = m_Pos;
newitem->m_Orient = m_Orient; newitem->m_Orient = m_Orient;
@ -192,11 +192,11 @@ LIB_DRAW_ITEM* LibDrawText::DoGenCopy()
} }
int LibDrawText::DoCompare( const LIB_DRAW_ITEM& other ) const int LIB_TEXT::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_GRAPHIC_TEXT_DRAW_TYPE );
const LibDrawText* tmp = ( LibDrawText* ) &other; const LIB_TEXT* tmp = ( LIB_TEXT* ) &other;
int result = m_Text.CmpNoCase( tmp->m_Text ); int result = m_Text.CmpNoCase( tmp->m_Text );
@ -219,13 +219,13 @@ int LibDrawText::DoCompare( const LIB_DRAW_ITEM& other ) const
} }
void LibDrawText::DoOffset( const wxPoint& offset ) void LIB_TEXT::DoOffset( const wxPoint& offset )
{ {
m_Pos += offset; m_Pos += offset;
} }
bool LibDrawText::DoTestInside( EDA_Rect& rect ) bool LIB_TEXT::DoTestInside( EDA_Rect& rect )
{ {
/* /*
* FIXME: This should calculate the text size and justification and * FIXME: This should calculate the text size and justification and
@ -235,13 +235,13 @@ bool LibDrawText::DoTestInside( EDA_Rect& rect )
} }
void LibDrawText::DoMove( const wxPoint& newPosition ) void LIB_TEXT::DoMove( const wxPoint& newPosition )
{ {
m_Pos = newPosition; m_Pos = newPosition;
} }
void LibDrawText::DoMirrorHorizontal( const wxPoint& center ) void LIB_TEXT::DoMirrorHorizontal( const wxPoint& center )
{ {
m_Pos.x -= center.x; m_Pos.x -= center.x;
m_Pos.x *= -1; m_Pos.x *= -1;
@ -249,7 +249,7 @@ void LibDrawText::DoMirrorHorizontal( const wxPoint& center )
} }
void LibDrawText::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, void LIB_TEXT::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ) const int transform[2][2] )
{ {
wxASSERT( plotter != NULL ); wxASSERT( plotter != NULL );
@ -269,7 +269,7 @@ void LibDrawText::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int LibDrawText::GetPenSize( ) int LIB_TEXT::GetPenSize( )
{ {
int pensize = m_Width; int pensize = m_Width;
@ -285,7 +285,7 @@ int LibDrawText::GetPenSize( )
return pensize; return pensize;
} }
void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void LIB_TEXT::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode, const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] ) void* aData, const int aTransformMatrix[2][2] )
{ {
@ -318,7 +318,7 @@ void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
} }
void LibDrawText::DisplayInfo( WinEDA_DrawFrame* frame ) void LIB_TEXT::DisplayInfo( WinEDA_DrawFrame* frame )
{ {
wxString msg; wxString msg;
@ -331,7 +331,7 @@ void LibDrawText::DisplayInfo( WinEDA_DrawFrame* frame )
} }
EDA_Rect LibDrawText::GetBoundingBox() EDA_Rect LIB_TEXT::GetBoundingBox()
{ {
EDA_Rect rect = GetTextBox(); EDA_Rect rect = GetTextBox();
rect.m_Pos.y *= -1; rect.m_Pos.y *= -1;

View File

@ -193,8 +193,8 @@ LIB_COMPONENT::LIB_COMPONENT( LIB_COMPONENT& component, CMP_LIBRARY* lib ) :
CMP_LIB_ENTRY( component, lib ) CMP_LIB_ENTRY( component, lib )
{ {
LIB_DRAW_ITEM* newItem; LIB_DRAW_ITEM* newItem;
LibDrawField* oldField; LIB_FIELD* oldField;
LibDrawField* newField; LIB_FIELD* newField;
m_Prefix = component.m_Prefix; m_Prefix = component.m_Prefix;
m_AliasList = component.m_AliasList; m_AliasList = component.m_AliasList;
@ -221,7 +221,7 @@ LIB_COMPONENT::LIB_COMPONENT( LIB_COMPONENT& component, CMP_LIBRARY* lib ) :
for( oldField = component.m_Fields; oldField != NULL; for( oldField = component.m_Fields; oldField != NULL;
oldField = oldField->Next() ) oldField = oldField->Next() )
{ {
newField = (LibDrawField*) oldField->GenCopy(); newField = (LIB_FIELD*) oldField->GenCopy();
newField->SetParent( this ); newField->SetParent( this );
m_Fields.PushBack( newField ); m_Fields.PushBack( newField );
} }
@ -240,8 +240,6 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* dc,
bool showPinText, bool drawFields, bool showPinText, bool drawFields,
bool onlySelected ) bool onlySelected )
{ {
wxString fieldText;
LibDrawField* Field;
BASE_SCREEN* screen = panel->GetScreen(); BASE_SCREEN* screen = panel->GetScreen();
GRSetDrawMode( dc, drawMode ); GRSetDrawMode( dc, drawMode );
@ -282,25 +280,13 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* dc,
if( drawFields ) if( drawFields )
{ {
/* The reference designator field is a special case for naming LIB_FIELD* Field;
/*
* The reference designator field is a special case for naming
* convention. * convention.
*
* FIXME: This should be handled by the LibDrawField class.
*/ */
if( m_UnitCount > 1 ) wxString fieldText = m_Prefix.GetFullText( multi );
{
#if defined(KICAD_GOST)
fieldText.Printf( wxT( "%s?.%c" ), (const wxChar*) m_Prefix.m_Text,
multi + '1' - 1 );
#else
fieldText.Printf( wxT( "%s?%c" ), (const wxChar*) m_Prefix.m_Text,
multi + 'A' - 1 );
#endif
}
else
{
fieldText = m_Prefix.m_Text + wxT( "?" );
}
if( !( onlySelected && m_Prefix.m_Selected == 0 ) ) if( !( onlySelected && m_Prefix.m_Selected == 0 ) )
m_Prefix.Draw( panel, dc, offset, color, drawMode, &fieldText, m_Prefix.Draw( panel, dc, offset, color, drawMode, &fieldText,
@ -384,7 +370,7 @@ void LIB_COMPONENT::RemoveDrawItem( LIB_DRAW_ITEM* item,
} }
else else
{ {
LibDrawField* field; LIB_FIELD* field;
for( field = m_Fields; field != NULL; field = field->Next() ) for( field = m_Fields; field != NULL; field = field->Next() )
{ {
@ -438,7 +424,7 @@ LIB_DRAW_ITEM* LIB_COMPONENT::GetNextDrawItem( LIB_DRAW_ITEM* item,
*/ */
bool LIB_COMPONENT::Save( FILE* aFile ) bool LIB_COMPONENT::Save( FILE* aFile )
{ {
LibDrawField* Field; LIB_FIELD* Field;
/* First line: it s a comment (component name for readers) */ /* First line: it s a comment (component name for readers) */
if( fprintf( aFile, "#\n# %s\n#\n", CONV_TO_UTF8( m_Name.m_Text ) ) < 0 ) if( fprintf( aFile, "#\n# %s\n#\n", CONV_TO_UTF8( m_Name.m_Text ) ) < 0 )
@ -689,31 +675,31 @@ bool LIB_COMPONENT::LoadDrawEntries( FILE* f, char* line,
switch( line[0] ) switch( line[0] )
{ {
case 'A': /* Arc */ case 'A': /* Arc */
newEntry = ( LIB_DRAW_ITEM* ) new LibDrawArc(this); newEntry = ( LIB_DRAW_ITEM* ) new LIB_ARC(this);
break; break;
case 'C': /* Circle */ case 'C': /* Circle */
newEntry = ( LIB_DRAW_ITEM* ) new LibDrawCircle(this); newEntry = ( LIB_DRAW_ITEM* ) new LIB_CIRCLE(this);
break; break;
case 'T': /* Text */ case 'T': /* Text */
newEntry = ( LIB_DRAW_ITEM* ) new LibDrawText(this); newEntry = ( LIB_DRAW_ITEM* ) new LIB_TEXT(this);
break; break;
case 'S': /* Square */ case 'S': /* Square */
newEntry = ( LIB_DRAW_ITEM* ) new LibDrawSquare(this); newEntry = ( LIB_DRAW_ITEM* ) new LIB_RECTANGLE(this);
break; break;
case 'X': /* Pin Description */ case 'X': /* Pin Description */
newEntry = ( LIB_DRAW_ITEM* ) new LibDrawPin(this); newEntry = ( LIB_DRAW_ITEM* ) new LIB_PIN(this);
break; break;
case 'P': /* Polyline */ case 'P': /* Polyline */
newEntry = ( LIB_DRAW_ITEM* ) new LibDrawPolyline(this); newEntry = ( LIB_DRAW_ITEM* ) new LIB_POLYLINE(this);
break; break;
case 'B': /* Bezier Curves */ case 'B': /* Bezier Curves */
newEntry = ( LIB_DRAW_ITEM* ) new LibDrawBezier(this); newEntry = ( LIB_DRAW_ITEM* ) new LIB_BEZIER(this);
break; break;
default: default:
@ -766,7 +752,7 @@ bool LIB_COMPONENT::LoadAliases( char* line, wxString& errorMsg )
bool LIB_COMPONENT::LoadField( char* line, wxString& errorMsg ) bool LIB_COMPONENT::LoadField( char* line, wxString& errorMsg )
{ {
LibDrawField* field = new LibDrawField( this ); LIB_FIELD* field = new LIB_FIELD( this );
if ( !field->Load( line, errorMsg ) ) if ( !field->Load( line, errorMsg ) )
{ {
@ -846,9 +832,9 @@ EDA_Rect LIB_COMPONENT::GetBoundaryBox( int Unit, int Convert )
/** Function SetFields /** Function SetFields
* initialize fields from a vector of fields * initialize fields from a vector of fields
* @param aFields a std::vector <LibDrawField> to import. * @param aFields a std::vector <LIB_FIELD> to import.
*/ */
void LIB_COMPONENT::SetFields( const std::vector <LibDrawField> aFields ) void LIB_COMPONENT::SetFields( const std::vector <LIB_FIELD> aFields )
{ {
// Init basic fields (Value = name in lib, and reference): // Init basic fields (Value = name in lib, and reference):
aFields[VALUE].Copy( &m_Name ); aFields[VALUE].Copy( &m_Name );
@ -867,7 +853,7 @@ void LIB_COMPONENT::SetFields( const std::vector <LibDrawField> aFields )
create = TRUE; create = TRUE;
if( create ) if( create )
{ {
LibDrawField*Field = new LibDrawField( this, ii ); LIB_FIELD*Field = new LIB_FIELD( this, ii );
aFields[ii].Copy( Field ); aFields[ii].Copy( Field );
m_Fields.PushBack( Field ); m_Fields.PushBack( Field );
} }
@ -879,7 +865,7 @@ void LIB_COMPONENT::SetFields( const std::vector <LibDrawField> aFields )
* text is like a void text and for non editable names, remove the name * text is like a void text and for non editable names, remove the name
* (set to the default name) * (set to the default name)
*/ */
for( LibDrawField* Field = m_Fields; Field; Field = Field->Next() ) for( LIB_FIELD* Field = m_Fields; Field; Field = Field->Next() )
{ {
Field->SetParent( this ); Field->SetParent( this );
if( Field->m_FieldId >= FIELD1 ) if( Field->m_FieldId >= FIELD1 )
@ -947,7 +933,7 @@ void LIB_COMPONENT::SetOffset( const wxPoint& offset )
m_Name.SetOffset( offset ); m_Name.SetOffset( offset );
m_Prefix.SetOffset( offset ); m_Prefix.SetOffset( offset );
for( LibDrawField* field = m_Fields; field != NULL; field = field->Next() ) for( LIB_FIELD* field = m_Fields; field != NULL; field = field->Next() )
{ {
field->SetOffset( offset ); field->SetOffset( offset );
} }
@ -979,7 +965,7 @@ bool LIB_COMPONENT::HasConversion() const
void LIB_COMPONENT::ClearStatus( void ) void LIB_COMPONENT::ClearStatus( void )
{ {
LibDrawField* field; LIB_FIELD* field;
BOOST_FOREACH( LIB_DRAW_ITEM& item, m_Drawings ) BOOST_FOREACH( LIB_DRAW_ITEM& item, m_Drawings )
item.m_Flags = 0; item.m_Flags = 0;
@ -1032,7 +1018,7 @@ int LIB_COMPONENT::SelectItems( EDA_Rect& rect, int unit, int convert,
ItemsCount++; ItemsCount++;
} }
for( LibDrawField* field = m_Fields.GetFirst(); field != NULL; for( LIB_FIELD* field = m_Fields.GetFirst(); field != NULL;
field = field->Next() ) field = field->Next() )
{ {
if( field->Inside( rect ) ) if( field->Inside( rect ) )
@ -1048,7 +1034,7 @@ int LIB_COMPONENT::SelectItems( EDA_Rect& rect, int unit, int convert,
void LIB_COMPONENT::MoveSelectedItems( const wxPoint& offset ) void LIB_COMPONENT::MoveSelectedItems( const wxPoint& offset )
{ {
LibDrawField* field; LIB_FIELD* field;
BOOST_FOREACH( LIB_DRAW_ITEM& item, m_Drawings ) BOOST_FOREACH( LIB_DRAW_ITEM& item, m_Drawings )
{ {
@ -1086,7 +1072,7 @@ void LIB_COMPONENT::MoveSelectedItems( const wxPoint& offset )
void LIB_COMPONENT::ClearSelectedItems( void ) void LIB_COMPONENT::ClearSelectedItems( void )
{ {
LibDrawField* field; LIB_FIELD* field;
BOOST_FOREACH( LIB_DRAW_ITEM& item, m_Drawings ) BOOST_FOREACH( LIB_DRAW_ITEM& item, m_Drawings )
item.m_Flags = item.m_Selected = 0; item.m_Flags = item.m_Selected = 0;
@ -1132,7 +1118,7 @@ void LIB_COMPONENT::CopySelectedItems( const wxPoint& offset )
void LIB_COMPONENT::MirrorSelectedItemsH( const wxPoint& center ) void LIB_COMPONENT::MirrorSelectedItemsH( const wxPoint& center )
{ {
LibDrawField* field; LIB_FIELD* field;
BOOST_FOREACH( LIB_DRAW_ITEM& item, m_Drawings ) BOOST_FOREACH( LIB_DRAW_ITEM& item, m_Drawings )
{ {
@ -1183,7 +1169,7 @@ void LIB_COMPONENT::MirrorSelectedItemsH( const wxPoint& center )
LIB_DRAW_ITEM* LIB_COMPONENT::LocateDrawItem( int unit, int convert, LIB_DRAW_ITEM* LIB_COMPONENT::LocateDrawItem( int unit, int convert,
KICAD_T type, const wxPoint& pt ) KICAD_T type, const wxPoint& pt )
{ {
LibDrawField* field; LIB_FIELD* field;
BOOST_FOREACH( LIB_DRAW_ITEM& item, m_Drawings ) BOOST_FOREACH( LIB_DRAW_ITEM& item, m_Drawings )
{ {

View File

@ -43,7 +43,7 @@ class CMP_LIB_ENTRY : public EDA_BaseStruct
public: public:
LibrEntryType Type; /* Type = ROOT; LibrEntryType Type; /* Type = ROOT;
* = ALIAS pour struct LibraryAliasType */ * = ALIAS pour struct LibraryAliasType */
LibDrawField m_Name; // name (74LS00 ..) in lib ( = VALUE ) LIB_FIELD m_Name; // name (74LS00 ..) in lib ( = VALUE )
wxString m_Doc; /* documentation for info */ wxString m_Doc; /* documentation for info */
wxString m_KeyWord; /* keyword list (used to select a group of wxString m_KeyWord; /* keyword list (used to select a group of
* components by keyword) */ * components by keyword) */
@ -107,7 +107,7 @@ extern int LibraryEntryCompare( const CMP_LIB_ENTRY* LE1,
class LIB_COMPONENT : public CMP_LIB_ENTRY class LIB_COMPONENT : public CMP_LIB_ENTRY
{ {
public: public:
LibDrawField m_Prefix; /* Prefix ( U, IC ... ) = REFERENCE */ LIB_FIELD m_Prefix; /* Prefix ( U, IC ... ) = REFERENCE */
wxArrayString m_AliasList; /* ALIAS list for the component */ wxArrayString m_AliasList; /* ALIAS list for the component */
wxArrayString m_FootprintList; /* list of suitable footprint names wxArrayString m_FootprintList; /* list of suitable footprint names
* for the component (wildcard names * for the component (wildcard names
@ -123,7 +123,7 @@ public:
* m_TextInside in mils */ * m_TextInside in mils */
bool m_DrawPinNum; bool m_DrawPinNum;
bool m_DrawPinName; bool m_DrawPinName;
DLIST<LibDrawField> m_Fields; /* Auxiliary Field list (id >= 2 ) */ DLIST<LIB_FIELD> m_Fields; /* Auxiliary Field list (id >= 2 ) */
long m_LastDate; // Last change Date long m_LastDate; // Last change Date
protected: protected:
@ -177,9 +177,9 @@ public:
/** /**
* Initialize fields from a vector of fields. * Initialize fields from a vector of fields.
* *
* @param aFields - a std::vector <LibDrawField> to import. * @param aFields - a std::vector <LIB_FIELD> to import.
*/ */
void SetFields( const std::vector <LibDrawField> aFields ); void SetFields( const std::vector <LIB_FIELD> aFields );
/** /**
* Draw component. * Draw component.
@ -244,9 +244,9 @@ public:
LIB_DRAW_ITEM* GetNextDrawItem( LIB_DRAW_ITEM* item = NULL, LIB_DRAW_ITEM* GetNextDrawItem( LIB_DRAW_ITEM* item = NULL,
KICAD_T type = TYPE_NOT_INIT ); KICAD_T type = TYPE_NOT_INIT );
LibDrawPin* GetNextPin( LibDrawPin* item = NULL ) LIB_PIN* GetNextPin( LIB_PIN* item = NULL )
{ {
return (LibDrawPin*) GetNextDrawItem( (LIB_DRAW_ITEM*) item, return (LIB_PIN*) GetNextDrawItem( (LIB_DRAW_ITEM*) item,
COMPONENT_PIN_DRAW_TYPE ); COMPONENT_PIN_DRAW_TYPE );
} }

View File

@ -40,22 +40,21 @@
* *
* others = free fields * others = free fields
*/ */
LibDrawField::LibDrawField(LIB_COMPONENT * aParent, int idfield ) : LIB_FIELD::LIB_FIELD(LIB_COMPONENT * aParent, int idfield ) :
LIB_DRAW_ITEM( COMPONENT_FIELD_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( COMPONENT_FIELD_DRAW_TYPE, aParent )
{ {
m_FieldId = idfield; m_FieldId = idfield;
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT;
} }
LibDrawField::LibDrawField( int idfield ) : LIB_FIELD::LIB_FIELD( int idfield ) :
LIB_DRAW_ITEM( COMPONENT_FIELD_DRAW_TYPE, NULL ) LIB_DRAW_ITEM( COMPONENT_FIELD_DRAW_TYPE, NULL )
{ {
m_FieldId = idfield; m_FieldId = idfield;
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT;
} }
LibDrawField::LibDrawField( const LibDrawField& field ) : LIB_FIELD::LIB_FIELD( const LIB_FIELD& field ) : LIB_DRAW_ITEM( field )
LIB_DRAW_ITEM( field )
{ {
m_Pos = field.m_Pos; m_Pos = field.m_Pos;
m_Size = field.m_Size; m_Size = field.m_Size;
@ -71,12 +70,12 @@ LibDrawField::LibDrawField( const LibDrawField& field ) :
} }
LibDrawField::~LibDrawField() LIB_FIELD::~LIB_FIELD()
{ {
} }
bool LibDrawField::Save( FILE* ExportFile ) const bool LIB_FIELD::Save( FILE* ExportFile ) const
{ {
int hjustify, vjustify; int hjustify, vjustify;
wxString text = m_Text; wxString text = m_Text;
@ -119,7 +118,7 @@ bool LibDrawField::Save( FILE* ExportFile ) const
} }
bool LibDrawField::Load( char* line, wxString& errorMsg ) bool LIB_FIELD::Load( char* line, wxString& errorMsg )
{ {
int cnt; int cnt;
char textOrient; char textOrient;
@ -257,7 +256,7 @@ parameter <%c> is not valid" ),
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int LibDrawField::GetPenSize() int LIB_FIELD::GetPenSize()
{ {
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
} }
@ -267,7 +266,7 @@ int LibDrawField::GetPenSize()
* if aData not NULL, aData must point a wxString which is used instead of * if aData not NULL, aData must point a wxString which is used instead of
* the m_Text * the m_Text
*/ */
void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void LIB_FIELD::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode, const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] ) void* aData, const int aTransformMatrix[2][2] )
{ {
@ -335,7 +334,7 @@ void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
* @param refPos A wxPoint to test, in Field coordinate system * @param refPos A wxPoint to test, in Field coordinate system
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
bool LibDrawField::HitTest( const wxPoint& refPos ) bool LIB_FIELD::HitTest( const wxPoint& refPos )
{ {
return HitTest( refPos, 0, DefaultTransformMatrix ); return HitTest( refPos, 0, DefaultTransformMatrix );
} }
@ -346,7 +345,7 @@ bool LibDrawField::HitTest( const wxPoint& refPos )
* @param aThreshold = unused here (TextHitTest calculates its threshold ) * @param aThreshold = unused here (TextHitTest calculates its threshold )
* @param aTransMat = the transform matrix * @param aTransMat = the transform matrix
*/ */
bool LibDrawField::HitTest( wxPoint aPosRef, int aThreshold, bool LIB_FIELD::HitTest( wxPoint aPosRef, int aThreshold,
const int aTransMat[2][2] ) const int aTransMat[2][2] )
{ {
int extraCharCount = 0; int extraCharCount = 0;
@ -387,9 +386,9 @@ bool LibDrawField::HitTest( wxPoint aPosRef, int aThreshold,
} }
// Creation et Duplication d'un field // Creation et Duplication d'un field
LIB_DRAW_ITEM* LibDrawField::DoGenCopy() LIB_DRAW_ITEM* LIB_FIELD::DoGenCopy()
{ {
LibDrawField* newfield = new LibDrawField( m_FieldId ); LIB_FIELD* newfield = new LIB_FIELD( m_FieldId );
Copy( newfield ); Copy( newfield );
@ -399,9 +398,9 @@ LIB_DRAW_ITEM* LibDrawField::DoGenCopy()
/** Function Copy /** Function Copy
* copy parameters of this to Target. Pointers are not copied * copy parameters of this to Target. Pointers are not copied
* @param Target = the LibDrawField to set with "this" values * @param Target = the LIB_FIELD to set with "this" values
*/ */
void LibDrawField::Copy( LibDrawField* Target ) const void LIB_FIELD::Copy( LIB_FIELD* Target ) const
{ {
Target->SetParent( m_Parent ); Target->SetParent( m_Parent );
Target->m_Pos = m_Pos; Target->m_Pos = m_Pos;
@ -418,11 +417,11 @@ void LibDrawField::Copy( LibDrawField* Target ) const
} }
int LibDrawField::DoCompare( const LIB_DRAW_ITEM& other ) const int LIB_FIELD::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_FIELD_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_FIELD_DRAW_TYPE );
const LibDrawField* tmp = ( LibDrawField* ) &other; const LIB_FIELD* tmp = ( LIB_FIELD* ) &other;
if( m_FieldId == tmp->m_FieldId ) if( m_FieldId == tmp->m_FieldId )
return m_FieldId - tmp->m_FieldId; return m_FieldId - tmp->m_FieldId;
@ -448,13 +447,13 @@ int LibDrawField::DoCompare( const LIB_DRAW_ITEM& other ) const
} }
void LibDrawField::DoOffset( const wxPoint& offset ) void LIB_FIELD::DoOffset( const wxPoint& offset )
{ {
m_Pos += offset; m_Pos += offset;
} }
bool LibDrawField::DoTestInside( EDA_Rect& rect ) bool LIB_FIELD::DoTestInside( EDA_Rect& rect )
{ {
/* /*
* FIXME: This fails to take into acount the size and/or orientation of * FIXME: This fails to take into acount the size and/or orientation of
@ -464,13 +463,13 @@ bool LibDrawField::DoTestInside( EDA_Rect& rect )
} }
void LibDrawField::DoMove( const wxPoint& newPosition ) void LIB_FIELD::DoMove( const wxPoint& newPosition )
{ {
m_Pos = newPosition; m_Pos = newPosition;
} }
void LibDrawField::DoMirrorHorizontal( const wxPoint& center ) void LIB_FIELD::DoMirrorHorizontal( const wxPoint& center )
{ {
m_Pos.x -= center.x; m_Pos.x -= center.x;
m_Pos.x *= -1; m_Pos.x *= -1;
@ -478,7 +477,7 @@ void LibDrawField::DoMirrorHorizontal( const wxPoint& center )
} }
void LibDrawField::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, void LIB_FIELD::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ) const int transform[2][2] )
{ {
} }
@ -490,7 +489,7 @@ void LibDrawField::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
* *
* @fixme This should be handled by the field object. * @fixme This should be handled by the field object.
*/ */
wxString LibDrawField::GetFullText( int unit ) wxString LIB_FIELD::GetFullText( int unit )
{ {
if( m_FieldId != REFERENCE ) if( m_FieldId != REFERENCE )
return m_Text; return m_Text;
@ -515,7 +514,7 @@ wxString LibDrawField::GetFullText( int unit )
} }
EDA_Rect LibDrawField::GetBoundingBox() EDA_Rect LIB_FIELD::GetBoundingBox()
{ {
EDA_Rect rect = GetTextBox(); EDA_Rect rect = GetTextBox();
rect.m_Pos.y *= -1; rect.m_Pos.y *= -1;

View File

@ -18,8 +18,7 @@
* default value in schematic * default value in schematic
*/ */
class LibDrawField : public LIB_DRAW_ITEM, class LIB_FIELD : public LIB_DRAW_ITEM, public EDA_TextStruct
public EDA_TextStruct
{ {
public: public:
int m_FieldId; /* 0 = REFERENCE int m_FieldId; /* 0 = REFERENCE
@ -33,17 +32,17 @@ public:
public: public:
LibDrawField* Next() const { return (LibDrawField*) Pnext; } LIB_FIELD* Next() const { return (LIB_FIELD*) Pnext; }
LibDrawField* Back() const { return (LibDrawField*) Pback; } LIB_FIELD* Back() const { return (LIB_FIELD*) Pback; }
LibDrawField( int idfield = 2 ); LIB_FIELD( int idfield = 2 );
LibDrawField( LIB_COMPONENT * aParent, int idfield = 2 ); LIB_FIELD( LIB_COMPONENT * aParent, int idfield = 2 );
LibDrawField( const LibDrawField& field ); LIB_FIELD( const LIB_FIELD& field );
~LibDrawField(); ~LIB_FIELD();
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "LibDrawField" ); return wxT( "LIB_FIELD" );
} }
@ -64,11 +63,11 @@ public:
/** Function Copy /** Function Copy
* copy parameters of this to Target. Pointers are not copied * copy parameters of this to Target. Pointers are not copied
* @param aTarget = the LibDrawField to set with "this" values * @param aTarget = the LIB_FIELD to set with "this" values
*/ */
void Copy( LibDrawField* aTarget ) const; void Copy( LIB_FIELD* aTarget ) const;
void SetFields( const std::vector <LibDrawField> aFields ); void SetFields( const std::vector <LIB_FIELD> aFields );
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset,
int aColor, int aDrawMode, void* aData, int aColor, int aDrawMode, void* aData,
@ -100,7 +99,7 @@ public:
virtual bool HitTest( wxPoint aPosRef, int aThreshold, virtual bool HitTest( wxPoint aPosRef, int aThreshold,
const int aTransMat[2][2] ); const int aTransMat[2][2] );
void operator=( const LibDrawField& field ) void operator=( const LIB_FIELD& field )
{ {
m_FieldId = field.m_FieldId; m_FieldId = field.m_FieldId;
m_Text = field.m_Text; m_Text = field.m_Text;
@ -154,6 +153,7 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center ); virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ); const int transform[2][2] );
virtual int DoGetWidth( void ) { return m_Width; }
}; };
#endif // CLASS_LIBENTRY_FIELDS_H #endif // CLASS_LIBENTRY_FIELDS_H

View File

@ -18,6 +18,7 @@
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
#include <wx/regex.h>
static const wxChar* duplicate_name_msg = _( "Component library <%s> has \ static const wxChar* duplicate_name_msg = _( "Component library <%s> has \
@ -129,6 +130,23 @@ void CMP_LIBRARY::SearchEntryNames( wxArrayString& names,
} }
void CMP_LIBRARY::SearchEntryNames( wxArrayString& names, const wxRegEx& re,
bool sort )
{
if( !re.IsValid() )
return;
BOOST_FOREACH( CMP_LIB_ENTRY& entry, m_Entries )
{
if( re.Matches( entry.m_KeyWord ) )
names.Add( entry.GetName() );
}
if( sort )
names.Sort();
}
CMP_LIB_ENTRY* CMP_LIBRARY::FindEntry( const wxChar* name ) CMP_LIB_ENTRY* CMP_LIBRARY::FindEntry( const wxChar* name )
{ {
BOOST_FOREACH( CMP_LIB_ENTRY& entry, m_Entries ) BOOST_FOREACH( CMP_LIB_ENTRY& entry, m_Entries )

View File

@ -42,6 +42,8 @@
/* Helpers for creating a list of component libraries. */ /* Helpers for creating a list of component libraries. */
class CMP_LIBRARY; class CMP_LIBRARY;
class wxRegEx;
typedef boost::ptr_vector< CMP_LIBRARY > CMP_LIBRARY_LIST; typedef boost::ptr_vector< CMP_LIBRARY > CMP_LIBRARY_LIST;
@ -176,9 +178,6 @@ public:
* WildCompareString(). The names array will be populated with the * WildCompareString(). The names array will be populated with the
* library entry names that meat the search criteria on exit. * library entry names that meat the search criteria on exit.
* *
* @todo Convert the search functions to use regular expressions which
* should give better search capability.
*
* @param names - String array to place entry names into. * @param names - String array to place entry names into.
* @param nameSearch - Name wild card search criteria. * @param nameSearch - Name wild card search criteria.
* @param keySearch - Key word search criteria. * @param keySearch - Key word search criteria.
@ -189,6 +188,16 @@ public:
const wxString& keySearch = wxEmptyString, const wxString& keySearch = wxEmptyString,
bool sort = true ); bool sort = true );
/**
* Find components in library by key word regular expression search.
*
* @param names - String array to place found component names into.
* @param re - Regular expression used to seach component key words.
* @param sort - Sort component name list.
*/
void SearchEntryNames( wxArrayString& names, const wxRegEx& re,
bool sort = true );
/** /**
* Find entry by name. * Find entry by name.
* *

View File

@ -37,7 +37,7 @@ const wxChar* MsgPinElectricType[] =
wxT( "?????" ) wxT( "?????" )
}; };
LibDrawPin::LibDrawPin(LIB_COMPONENT * aParent) : LIB_PIN::LIB_PIN(LIB_COMPONENT * aParent) :
LIB_DRAW_ITEM( COMPONENT_PIN_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( COMPONENT_PIN_DRAW_TYPE, aParent )
{ {
m_PinLen = 300; /* default Pin len */ m_PinLen = 300; /* default Pin len */
@ -57,7 +57,7 @@ LibDrawPin::LibDrawPin(LIB_COMPONENT * aParent) :
} }
LibDrawPin::LibDrawPin( const LibDrawPin& pin ) : LIB_DRAW_ITEM( pin ) LIB_PIN::LIB_PIN( const LIB_PIN& pin ) : LIB_DRAW_ITEM( pin )
{ {
m_Pos = pin.m_Pos; m_Pos = pin.m_Pos;
m_PinLen = pin.m_PinLen; m_PinLen = pin.m_PinLen;
@ -83,7 +83,7 @@ LibDrawPin::LibDrawPin( const LibDrawPin& pin ) : LIB_DRAW_ITEM( pin )
* @param aRefPos A wxPoint to test * @param aRefPos A wxPoint to test
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
bool LibDrawPin::HitTest( const wxPoint& aRefPos ) bool LIB_PIN::HitTest( const wxPoint& aRefPos )
{ {
int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2; int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2;
@ -100,7 +100,7 @@ bool LibDrawPin::HitTest( const wxPoint& aRefPos )
* @param aThreshold = max distance to a segment * @param aThreshold = max distance to a segment
* @param aTransMat = the transform matrix * @param aTransMat = the transform matrix
*/ */
bool LibDrawPin::HitTest( wxPoint aRefPos, int aThreshold, bool LIB_PIN::HitTest( wxPoint aRefPos, int aThreshold,
const int aTransMat[2][2] ) const int aTransMat[2][2] )
{ {
wxPoint pinPos = TransformCoordinate( aTransMat, m_Pos ); wxPoint pinPos = TransformCoordinate( aTransMat, m_Pos );
@ -110,7 +110,7 @@ bool LibDrawPin::HitTest( wxPoint aRefPos, int aThreshold,
} }
bool LibDrawPin::Save( FILE* ExportFile ) const bool LIB_PIN::Save( FILE* ExportFile ) const
{ {
wxString StringPinNum; wxString StringPinNum;
int Etype; int Etype;
@ -208,7 +208,7 @@ bool LibDrawPin::Save( FILE* ExportFile ) const
} }
bool LibDrawPin::Load( char* line, wxString& errorMsg ) bool LIB_PIN::Load( char* line, wxString& errorMsg )
{ {
int i, j; int i, j;
char pinAttrs[64]; char pinAttrs[64];
@ -324,13 +324,13 @@ bool LibDrawPin::Load( char* line, wxString& errorMsg )
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int LibDrawPin::GetPenSize() int LIB_PIN::GetPenSize()
{ {
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
} }
void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel, void LIB_PIN::Draw( WinEDA_DrawPanel* aPanel,
wxDC* aDC, wxDC* aDC,
const wxPoint& aOffset, const wxPoint& aOffset,
int aColor, int aColor,
@ -388,7 +388,7 @@ void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel,
* Draw the pin symbol (without texts) * Draw the pin symbol (without texts)
* if Color != 0 draw with Color, else with the normal pin color * if Color != 0 draw with Color, else with the normal pin color
*/ */
void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel, void LIB_PIN::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
wxDC* aDC, wxDC* aDC,
const wxPoint& aPinPos, const wxPoint& aPinPos,
int aOrient, int aOrient,
@ -555,7 +555,7 @@ void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel,
* If TextInside then the text is been put inside,otherwise all is drawn outside. * If TextInside then the text is been put inside,otherwise all is drawn outside.
* Pin Name: substring beteween '~' is negated * Pin Name: substring beteween '~' is negated
*****************************************************************************/ *****************************************************************************/
void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, void LIB_PIN::DrawPinTexts( WinEDA_DrawPanel* panel,
wxDC* DC, wxDC* DC,
wxPoint& pin_pos, wxPoint& pin_pos,
int orient, int orient,
@ -763,7 +763,7 @@ void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
* If TextInside then the text is been put inside (moving from x1, y1 in * * If TextInside then the text is been put inside (moving from x1, y1 in *
* the opposite direction to x2,y2), otherwise all is drawn outside. * * the opposite direction to x2,y2), otherwise all is drawn outside. *
*****************************************************************************/ *****************************************************************************/
void LibDrawPin::PlotPinTexts( PLOTTER *plotter, void LIB_PIN::PlotPinTexts( PLOTTER *plotter,
wxPoint& pin_pos, wxPoint& pin_pos,
int orient, int orient,
int TextInside, int TextInside,
@ -945,7 +945,7 @@ void LibDrawPin::PlotPinTexts( PLOTTER *plotter,
/******************************************/ /******************************************/
wxPoint LibDrawPin::ReturnPinEndPoint() wxPoint LIB_PIN::ReturnPinEndPoint()
/******************************************/ /******************************************/
/* return the pin end position, for a component in normal orient /* return the pin end position, for a component in normal orient
@ -977,7 +977,7 @@ wxPoint LibDrawPin::ReturnPinEndPoint()
* according to its orientation and the matrix transform (rot, mirror) TransMat * according to its orientation and the matrix transform (rot, mirror) TransMat
* @param TransMat = transform matrix * @param TransMat = transform matrix
*/ */
int LibDrawPin::ReturnPinDrawOrient( const int TransMat[2][2] ) int LIB_PIN::ReturnPinDrawOrient( const int TransMat[2][2] )
{ {
int orient; int orient;
wxPoint end; // position of a end pin starting at 0,0 according to its orientation, lenght = 1 wxPoint end; // position of a end pin starting at 0,0 according to its orientation, lenght = 1
@ -1021,7 +1021,7 @@ int LibDrawPin::ReturnPinDrawOrient( const int TransMat[2][2] )
* Used to print/draw the pin num * Used to print/draw the pin num
* @param aStringBuffer = the wxString to store the pin num as an unicode string * @param aStringBuffer = the wxString to store the pin num as an unicode string
*/ */
void LibDrawPin::ReturnPinStringNum( wxString& aStringBuffer ) const void LIB_PIN::ReturnPinStringNum( wxString& aStringBuffer ) const
{ {
aStringBuffer = ReturnPinStringNum( m_PinNum ); aStringBuffer = ReturnPinStringNum( m_PinNum );
} }
@ -1031,7 +1031,7 @@ void LibDrawPin::ReturnPinStringNum( wxString& aStringBuffer ) const
* @param aPinNum = a long containing a pin num * @param aPinNum = a long containing a pin num
* @return aStringBuffer = the wxString to store the pin num as an unicode string * @return aStringBuffer = the wxString to store the pin num as an unicode string
*/ */
wxString LibDrawPin::ReturnPinStringNum( long aPinNum ) wxString LIB_PIN::ReturnPinStringNum( long aPinNum )
{ {
char ascii_buf[5]; char ascii_buf[5];
@ -1044,12 +1044,12 @@ wxString LibDrawPin::ReturnPinStringNum( long aPinNum )
} }
/** Function LibDrawPin::SetPinNumFromString() /** Function LIB_PIN::SetPinNumFromString()
* fill the buffer with pin num as a wxString * fill the buffer with pin num as a wxString
* Pin num is coded as a long * Pin num is coded as a long
* Used to print/draw the pin num * Used to print/draw the pin num
*/ */
void LibDrawPin::SetPinNumFromString( wxString& buffer ) void LIB_PIN::SetPinNumFromString( wxString& buffer )
{ {
char ascii_buf[4]; char ascii_buf[4];
unsigned ii, len = buffer.Len(); unsigned ii, len = buffer.Len();
@ -1068,10 +1068,10 @@ void LibDrawPin::SetPinNumFromString( wxString& buffer )
/*************************************/ /*************************************/
LIB_DRAW_ITEM* LibDrawPin::DoGenCopy() LIB_DRAW_ITEM* LIB_PIN::DoGenCopy()
/*************************************/ /*************************************/
{ {
LibDrawPin* newpin = new LibDrawPin( GetParent() ); LIB_PIN* newpin = new LIB_PIN( GetParent() );
newpin->m_Pos = m_Pos; newpin->m_Pos = m_Pos;
newpin->m_PinLen = m_PinLen; newpin->m_PinLen = m_PinLen;
@ -1096,11 +1096,11 @@ LIB_DRAW_ITEM* LibDrawPin::DoGenCopy()
} }
int LibDrawPin::DoCompare( const LIB_DRAW_ITEM& other ) const int LIB_PIN::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_PIN_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_PIN_DRAW_TYPE );
const LibDrawPin* tmp = ( LibDrawPin* ) &other; const LIB_PIN* tmp = ( LIB_PIN* ) &other;
if( m_PinNum != tmp->m_PinNum ) if( m_PinNum != tmp->m_PinNum )
return m_PinNum - tmp->m_PinNum; return m_PinNum - tmp->m_PinNum;
@ -1120,13 +1120,13 @@ int LibDrawPin::DoCompare( const LIB_DRAW_ITEM& other ) const
} }
void LibDrawPin::DoOffset( const wxPoint& offset ) void LIB_PIN::DoOffset( const wxPoint& offset )
{ {
m_Pos += offset; m_Pos += offset;
} }
bool LibDrawPin::DoTestInside( EDA_Rect& rect ) bool LIB_PIN::DoTestInside( EDA_Rect& rect )
{ {
wxPoint end = ReturnPinEndPoint(); wxPoint end = ReturnPinEndPoint();
@ -1134,13 +1134,13 @@ bool LibDrawPin::DoTestInside( EDA_Rect& rect )
} }
void LibDrawPin::DoMove( const wxPoint& newPosition ) void LIB_PIN::DoMove( const wxPoint& newPosition )
{ {
m_Pos = newPosition; m_Pos = newPosition;
} }
void LibDrawPin::DoMirrorHorizontal( const wxPoint& center ) void LIB_PIN::DoMirrorHorizontal( const wxPoint& center )
{ {
m_Pos.x -= center.x; m_Pos.x -= center.x;
m_Pos.x *= -1; m_Pos.x *= -1;
@ -1153,7 +1153,7 @@ void LibDrawPin::DoMirrorHorizontal( const wxPoint& center )
} }
void LibDrawPin::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, void LIB_PIN::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ) const int transform[2][2] )
{ {
if( m_Attributs & PINNOTDRAW ) if( m_Attributs & PINNOTDRAW )
@ -1171,48 +1171,42 @@ void LibDrawPin::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
} }
/** Function LibDrawPin::DisplayInfo /** Function LIB_PIN::DisplayInfo
* Displays info (pin num and name, orientation ... * Displays info (pin num and name, orientation ...
* on the Info window * on the Info window
*/ */
void LibDrawPin::DisplayInfo( WinEDA_DrawFrame* frame ) void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame )
{ {
wxString Text; wxString Text;
int ii; int ii;
LIB_DRAW_ITEM::DisplayInfo( frame ); LIB_DRAW_ITEM::DisplayInfo( frame );
/* Affichage du nom */ frame->MsgPanel->AppendMessage( _( "Pin name" ), m_PinName, DARKCYAN );
frame->MsgPanel->Affiche_1_Parametre( 30, _( "PinName" ), m_PinName,
DARKCYAN );
/* Affichage du numero */
if( m_PinNum == 0 ) if( m_PinNum == 0 )
Text = wxT( "?" ); Text = wxT( "?" );
else else
ReturnPinStringNum( Text ); ReturnPinStringNum( Text );
frame->MsgPanel->Affiche_1_Parametre( 38, _( "PinNum" ), Text, DARKCYAN ); frame->MsgPanel->AppendMessage( _( "Pin number" ), Text, DARKCYAN );
/* Affichage du type */
ii = m_PinType; ii = m_PinType;
frame->MsgPanel->Affiche_1_Parametre( 44, _( "PinType" ), frame->MsgPanel->AppendMessage( _( "Pin type" ), MsgPinElectricType[ii],
MsgPinElectricType[ii], RED ); RED );
/* Affichage de la visiblite */
ii = m_Attributs; ii = m_Attributs;
if( ii & 1 ) if( ii & 1 )
Text = _( "no" ); Text = _( "Not visible" );
else else
Text = _( "yes" ); Text = _( "Visible" );
frame->MsgPanel->Affiche_1_Parametre( 50, _( "Display" ), Text, DARKGREEN ); frame->MsgPanel->AppendMessage( _( "Display" ), Text, DARKGREEN );
/* Display pin length */ /* Display pin length */
Text = ReturnStringFromValue( g_UnitMetric, m_PinLen, Text = ReturnStringFromValue( g_UnitMetric, m_PinLen,
EESCHEMA_INTERNAL_UNIT, true ); EESCHEMA_INTERNAL_UNIT, true );
frame->MsgPanel->Affiche_1_Parametre( 56, _( "Length" ), Text, MAGENTA ); frame->MsgPanel->AppendMessage( _( "Length" ), Text, MAGENTA );
/* Affichage de l'orientation */
switch( m_Orient ) switch( m_Orient )
{ {
case PIN_UP: case PIN_UP:
@ -1232,18 +1226,18 @@ void LibDrawPin::DisplayInfo( WinEDA_DrawFrame* frame )
break; break;
default: default:
Text = wxT( "??" ); Text = _( "Unknown" );
break; break;
} }
frame->MsgPanel->Affiche_1_Parametre( 62, _( "Orient" ), Text, MAGENTA ); frame->MsgPanel->AppendMessage( _( "Oriention" ), Text, MAGENTA );
} }
/** Function LibDrawPin::GetBoundingBox /** Function LIB_PIN::GetBoundingBox
* @return the boundary box for this, in schematic coordinates * @return the boundary box for this, in schematic coordinates
*/ */
EDA_Rect LibDrawPin::GetBoundingBox() EDA_Rect LIB_PIN::GetBoundingBox()
{ {
wxPoint pt = m_Pos; wxPoint pt = m_Pos;

View File

@ -198,7 +198,8 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
DrawGraphicText( panel, DC, pos, color, fulltext, DrawGraphicText( panel, DC, pos, color, fulltext,
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
m_Size, hjustify, vjustify, LineWidth, m_Italic, m_Bold, false ); m_Size, hjustify, vjustify, LineWidth, m_Italic,
m_Bold, false );
} }
} }
@ -208,9 +209,9 @@ void SCH_CMP_FIELD::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
* copy parameters from a source. * copy parameters from a source.
* Pointers and specific values (position, texts) are not copied * Pointers and specific values (position, texts) are not copied
* used to init a field from the model read from a lib entry * used to init a field from the model read from a lib entry
* @param aSource = the LibDrawField to read * @param aSource = the LIB_FIELD to read
*/ */
void SCH_CMP_FIELD::ImportValues( const LibDrawField& aSource ) void SCH_CMP_FIELD::ImportValues( const LIB_FIELD& aSource )
{ {
m_Orient = aSource.m_Orient; m_Orient = aSource.m_Orient;
m_Size = aSource.m_Size; m_Size = aSource.m_Size;

View File

@ -15,6 +15,7 @@
class SCH_COMPONENT; class SCH_COMPONENT;
class LIB_FIELD;
/** /**
@ -53,9 +54,9 @@ public:
/** Function ImportValues /** Function ImportValues
* copy parameters from a source. * copy parameters from a source.
* Pointers and specific values (position) are not copied * Pointers and specific values (position) are not copied
* @param aSource = the LibDrawField to read * @param aSource = the LIB_FIELD to read
*/ */
void ImportValues( const LibDrawField& aSource ); void ImportValues( const LIB_FIELD& aSource );
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item

View File

@ -35,12 +35,12 @@ void CreateDummyCmp()
{ {
DummyCmp = new LIB_COMPONENT( wxEmptyString ); DummyCmp = new LIB_COMPONENT( wxEmptyString );
LibDrawSquare* Square = new LibDrawSquare(DummyCmp); LIB_RECTANGLE* Square = new LIB_RECTANGLE(DummyCmp);
Square->m_Pos = wxPoint( -200, 200 ); Square->m_Pos = wxPoint( -200, 200 );
Square->m_End = wxPoint( 200, -200 ); Square->m_End = wxPoint( 200, -200 );
LibDrawText* Text = new LibDrawText(DummyCmp); LIB_TEXT* Text = new LIB_TEXT(DummyCmp);
Text->m_Size.x = Text->m_Size.y = 150; Text->m_Size.x = Text->m_Size.y = 150;
Text->m_Text = wxT( "??" ); Text->m_Text = wxT( "??" );

View File

@ -60,14 +60,14 @@ void LIB_DRAW_ITEM::DisplayInfo( WinEDA_DrawFrame* frame )
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
frame->MsgPanel->Affiche_1_Parametre( 1, _( "Type" ), m_typeName, CYAN ); frame->MsgPanel->AppendMessage( _( "Type" ), m_typeName, CYAN );
/* Affichage de l'appartenance */ /* Affichage de l'appartenance */
if( m_Unit == 0 ) if( m_Unit == 0 )
msg = _( "All" ); msg = _( "All" );
else else
msg.Printf( wxT( "%d" ), m_Unit ); msg.Printf( wxT( "%d" ), m_Unit );
Affiche_1_Parametre( frame, 8, _( "Unit" ), msg, BROWN ); frame->MsgPanel->AppendMessage( _( "Unit" ), msg, BROWN );
if( m_Convert == 0 ) if( m_Convert == 0 )
msg = _( "All" ); msg = _( "All" );
@ -77,7 +77,7 @@ void LIB_DRAW_ITEM::DisplayInfo( WinEDA_DrawFrame* frame )
msg = _( "yes" ); msg = _( "yes" );
else else
msg = wxT( "?" ); msg = wxT( "?" );
Affiche_1_Parametre( frame, 14, _( "Convert" ), msg, BROWN ); frame->MsgPanel->AppendMessage( _( "Convert" ), msg, BROWN );
} }
@ -112,10 +112,10 @@ bool LIB_DRAW_ITEM::operator<( const LIB_DRAW_ITEM& other ) const
/**********************/ /**********************/
/** class LibDrawArc **/ /** class LIB_ARC **/
/**********************/ /**********************/
LibDrawArc::LibDrawArc( LIB_COMPONENT* aParent ) : LIB_ARC::LIB_ARC( LIB_COMPONENT* aParent ) :
LIB_DRAW_ITEM( COMPONENT_ARC_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( COMPONENT_ARC_DRAW_TYPE, aParent )
{ {
m_Radius = 0; m_Radius = 0;
@ -127,7 +127,7 @@ LibDrawArc::LibDrawArc( LIB_COMPONENT* aParent ) :
} }
LibDrawArc::LibDrawArc( const LibDrawArc& arc ) : LIB_DRAW_ITEM( arc ) LIB_ARC::LIB_ARC( const LIB_ARC& arc ) : LIB_DRAW_ITEM( arc )
{ {
m_Radius = arc.m_Radius; m_Radius = arc.m_Radius;
m_t1 = arc.m_t1; m_t1 = arc.m_t1;
@ -145,7 +145,7 @@ LibDrawArc::LibDrawArc( const LibDrawArc& arc ) : LIB_DRAW_ITEM( arc )
* A centre_posx centre_posy rayon start_angle end_angle unit convert * A centre_posx centre_posy rayon start_angle end_angle unit convert
* fill('N', 'F' ou 'f') startx starty endx endy * fill('N', 'F' ou 'f') startx starty endx endy
*/ */
bool LibDrawArc::Save( FILE* ExportFile ) const bool LIB_ARC::Save( FILE* ExportFile ) const
{ {
int x1 = m_t1; int x1 = m_t1;
@ -167,7 +167,7 @@ bool LibDrawArc::Save( FILE* ExportFile ) const
} }
bool LibDrawArc::Load( char* line, wxString& errorMsg ) bool LIB_ARC::Load( char* line, wxString& errorMsg )
{ {
int startx, starty, endx, endy, cnt; int startx, starty, endx, endy, cnt;
char tmp[256]; char tmp[256];
@ -224,7 +224,7 @@ bool LibDrawArc::Load( char* line, wxString& errorMsg )
* @param aRefPoint A wxPoint to test in eeschema space * @param aRefPoint A wxPoint to test in eeschema space
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
bool LibDrawArc::HitTest( const wxPoint& aRefPoint ) bool LIB_ARC::HitTest( const wxPoint& aRefPoint )
{ {
int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2; int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2;
@ -243,7 +243,7 @@ bool LibDrawArc::HitTest( const wxPoint& aRefPoint )
* of a line) * of a line)
* @param aTransMat = the transform matrix * @param aTransMat = the transform matrix
*/ */
bool LibDrawArc::HitTest( wxPoint aRefPoint, int aThreshold, bool LIB_ARC::HitTest( wxPoint aRefPoint, int aThreshold,
const int aTransMat[2][2] ) const int aTransMat[2][2] )
{ {
// TODO: use aTransMat to calculmates parameters // TODO: use aTransMat to calculmates parameters
@ -278,9 +278,9 @@ bool LibDrawArc::HitTest( wxPoint aRefPoint, int aThreshold,
} }
LIB_DRAW_ITEM* LibDrawArc::DoGenCopy() LIB_DRAW_ITEM* LIB_ARC::DoGenCopy()
{ {
LibDrawArc* newitem = new LibDrawArc( GetParent() ); LIB_ARC* newitem = new LIB_ARC( GetParent() );
newitem->m_Pos = m_Pos; newitem->m_Pos = m_Pos;
newitem->m_ArcStart = m_ArcStart; newitem->m_ArcStart = m_ArcStart;
@ -298,11 +298,11 @@ LIB_DRAW_ITEM* LibDrawArc::DoGenCopy()
} }
int LibDrawArc::DoCompare( const LIB_DRAW_ITEM& other ) const int LIB_ARC::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_ARC_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_ARC_DRAW_TYPE );
const LibDrawArc* tmp = ( LibDrawArc* ) &other; const LIB_ARC* tmp = ( LIB_ARC* ) &other;
if( m_Pos.x != tmp->m_Pos.x ) if( m_Pos.x != tmp->m_Pos.x )
return m_Pos.x - tmp->m_Pos.x; return m_Pos.x - tmp->m_Pos.x;
@ -320,7 +320,7 @@ int LibDrawArc::DoCompare( const LIB_DRAW_ITEM& other ) const
} }
void LibDrawArc::DoOffset( const wxPoint& offset ) void LIB_ARC::DoOffset( const wxPoint& offset )
{ {
m_Pos += offset; m_Pos += offset;
m_ArcStart += offset; m_ArcStart += offset;
@ -328,14 +328,14 @@ void LibDrawArc::DoOffset( const wxPoint& offset )
} }
bool LibDrawArc::DoTestInside( EDA_Rect& rect ) bool LIB_ARC::DoTestInside( EDA_Rect& rect )
{ {
return rect.Inside( m_ArcStart.x, -m_ArcStart.y ) return rect.Inside( m_ArcStart.x, -m_ArcStart.y )
|| rect.Inside( m_ArcEnd.x, -m_ArcEnd.y ); || rect.Inside( m_ArcEnd.x, -m_ArcEnd.y );
} }
void LibDrawArc::DoMove( const wxPoint& newPosition ) void LIB_ARC::DoMove( const wxPoint& newPosition )
{ {
wxPoint offset = newPosition - m_Pos; wxPoint offset = newPosition - m_Pos;
m_Pos = newPosition; m_Pos = newPosition;
@ -344,7 +344,7 @@ void LibDrawArc::DoMove( const wxPoint& newPosition )
} }
void LibDrawArc::DoMirrorHorizontal( const wxPoint& center ) void LIB_ARC::DoMirrorHorizontal( const wxPoint& center )
{ {
m_Pos.x -= center.x; m_Pos.x -= center.x;
m_Pos.x *= -1; m_Pos.x *= -1;
@ -359,7 +359,7 @@ void LibDrawArc::DoMirrorHorizontal( const wxPoint& center )
} }
void LibDrawArc::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, void LIB_ARC::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ) const int transform[2][2] )
{ {
wxASSERT( plotter != NULL ); wxASSERT( plotter != NULL );
@ -384,16 +384,15 @@ void LibDrawArc::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int LibDrawArc::GetPenSize() int LIB_ARC::GetPenSize()
{ {
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
} }
void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void LIB_ARC::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, const wxPoint& aOffset, int aColor, int aDrawMode,
int aDrawMode, void* aData, void* aData, const int aTransformMatrix[2][2] )
const int aTransformMatrix[2][2] )
{ {
wxPoint pos1, pos2, posc; wxPoint pos1, pos2, posc;
@ -455,7 +454,7 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
} }
EDA_Rect LibDrawArc::GetBoundingBox() EDA_Rect LIB_ARC::GetBoundingBox()
{ {
int minX, minY, maxX, maxY, angleStart, angleEnd; int minX, minY, maxX, maxY, angleStart, angleEnd;
EDA_Rect rect; EDA_Rect rect;
@ -516,7 +515,7 @@ start(%d, %d), end(%d, %d), radius %d" ),
} }
void LibDrawArc::DisplayInfo( WinEDA_DrawFrame* frame ) void LIB_ARC::DisplayInfo( WinEDA_DrawFrame* frame )
{ {
wxString msg; wxString msg;
EDA_Rect bBox = GetBoundingBox(); EDA_Rect bBox = GetBoundingBox();
@ -526,20 +525,20 @@ void LibDrawArc::DisplayInfo( WinEDA_DrawFrame* frame )
msg = ReturnStringFromValue( g_UnitMetric, m_Width, msg = ReturnStringFromValue( g_UnitMetric, m_Width,
EESCHEMA_INTERNAL_UNIT, true ); EESCHEMA_INTERNAL_UNIT, true );
frame->MsgPanel->Affiche_1_Parametre( 20, _( "Line width" ), msg, BLUE ); frame->MsgPanel->AppendMessage( _( "Line width" ), msg, BLUE );
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
frame->MsgPanel->Affiche_1_Parametre( 40, _( "Bounding box" ), msg, BROWN ); frame->MsgPanel->AppendMessage( _( "Bounding box" ), msg, BROWN );
} }
/*************************/ /*************************/
/** class LibDrawCircle **/ /** class LIB_CIRCLE **/
/*************************/ /*************************/
LibDrawCircle::LibDrawCircle( LIB_COMPONENT* aParent ) : LIB_CIRCLE::LIB_CIRCLE( LIB_COMPONENT* aParent ) :
LIB_DRAW_ITEM( COMPONENT_CIRCLE_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( COMPONENT_CIRCLE_DRAW_TYPE, aParent )
{ {
m_Radius = 0; m_Radius = 0;
@ -548,7 +547,7 @@ LibDrawCircle::LibDrawCircle( LIB_COMPONENT* aParent ) :
} }
LibDrawCircle::LibDrawCircle( const LibDrawCircle& circle ) : LIB_CIRCLE::LIB_CIRCLE( const LIB_CIRCLE& circle ) :
LIB_DRAW_ITEM( circle ) LIB_DRAW_ITEM( circle )
{ {
m_Pos = circle.m_Pos; m_Pos = circle.m_Pos;
@ -557,7 +556,7 @@ LibDrawCircle::LibDrawCircle( const LibDrawCircle& circle ) :
} }
bool LibDrawCircle::Save( FILE* ExportFile ) const bool LIB_CIRCLE::Save( FILE* ExportFile ) const
{ {
if( fprintf( ExportFile, "C %d %d %d %d %d %d %c\n", m_Pos.x, m_Pos.y, if( fprintf( ExportFile, "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] ) < 0 ) m_Radius, m_Unit, m_Convert, m_Width, fill_tab[m_Fill] ) < 0 )
@ -567,7 +566,7 @@ bool LibDrawCircle::Save( FILE* ExportFile ) const
} }
bool LibDrawCircle::Load( char* line, wxString& errorMsg ) bool LIB_CIRCLE::Load( char* line, wxString& errorMsg )
{ {
char tmp[256]; char tmp[256];
@ -596,7 +595,7 @@ bool LibDrawCircle::Load( char* line, wxString& errorMsg )
* @param aRefPos A wxPoint to test in eeschema space * @param aRefPos A wxPoint to test in eeschema space
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
bool LibDrawCircle::HitTest( const wxPoint& aPosRef ) bool LIB_CIRCLE::HitTest( const wxPoint& aPosRef )
{ {
int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2; int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2;
@ -615,7 +614,7 @@ bool LibDrawCircle::HitTest( const wxPoint& aPosRef )
* thickness of a line) * thickness of a line)
* @param aTransMat = the transform matrix * @param aTransMat = the transform matrix
*/ */
bool LibDrawCircle::HitTest( wxPoint aPosRef, int aThreshold, bool LIB_CIRCLE::HitTest( wxPoint aPosRef, int aThreshold,
const int aTransMat[2][2] ) const int aTransMat[2][2] )
{ {
wxPoint relpos = aPosRef - TransformCoordinate( aTransMat, m_Pos ); wxPoint relpos = aPosRef - TransformCoordinate( aTransMat, m_Pos );
@ -630,9 +629,9 @@ bool LibDrawCircle::HitTest( wxPoint aPosRef, int aThreshold,
} }
LIB_DRAW_ITEM* LibDrawCircle::DoGenCopy() LIB_DRAW_ITEM* LIB_CIRCLE::DoGenCopy()
{ {
LibDrawCircle* newitem = new LibDrawCircle( GetParent() ); LIB_CIRCLE* newitem = new LIB_CIRCLE( GetParent() );
newitem->m_Pos = m_Pos; newitem->m_Pos = m_Pos;
newitem->m_Radius = m_Radius; newitem->m_Radius = m_Radius;
@ -646,11 +645,11 @@ LIB_DRAW_ITEM* LibDrawCircle::DoGenCopy()
} }
int LibDrawCircle::DoCompare( const LIB_DRAW_ITEM& other ) const int LIB_CIRCLE::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_CIRCLE_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_CIRCLE_DRAW_TYPE );
const LibDrawCircle* tmp = ( LibDrawCircle* ) &other; const LIB_CIRCLE* tmp = ( LIB_CIRCLE* ) &other;
if( m_Pos.x != tmp->m_Pos.x ) if( m_Pos.x != tmp->m_Pos.x )
return m_Pos.x - tmp->m_Pos.x; return m_Pos.x - tmp->m_Pos.x;
@ -665,13 +664,13 @@ int LibDrawCircle::DoCompare( const LIB_DRAW_ITEM& other ) const
} }
void LibDrawCircle::DoOffset( const wxPoint& offset ) void LIB_CIRCLE::DoOffset( const wxPoint& offset )
{ {
m_Pos += offset; m_Pos += offset;
} }
bool LibDrawCircle::DoTestInside( EDA_Rect& rect ) bool LIB_CIRCLE::DoTestInside( EDA_Rect& rect )
{ {
/* /*
* FIXME: This fails to take into acount the radius around the center * FIXME: This fails to take into acount the radius around the center
@ -681,13 +680,13 @@ bool LibDrawCircle::DoTestInside( EDA_Rect& rect )
} }
void LibDrawCircle::DoMove( const wxPoint& newPosition ) void LIB_CIRCLE::DoMove( const wxPoint& newPosition )
{ {
m_Pos = newPosition; m_Pos = newPosition;
} }
void LibDrawCircle::DoMirrorHorizontal( const wxPoint& center ) void LIB_CIRCLE::DoMirrorHorizontal( const wxPoint& center )
{ {
m_Pos.x -= center.x; m_Pos.x -= center.x;
m_Pos.x *= -1; m_Pos.x *= -1;
@ -695,7 +694,7 @@ void LibDrawCircle::DoMirrorHorizontal( const wxPoint& center )
} }
void LibDrawCircle::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, void LIB_CIRCLE::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ) const int transform[2][2] )
{ {
wxPoint pos = TransformCoordinate( transform, m_Pos ) + offset; wxPoint pos = TransformCoordinate( transform, m_Pos ) + offset;
@ -714,13 +713,13 @@ void LibDrawCircle::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int LibDrawCircle::GetPenSize() int LIB_CIRCLE::GetPenSize()
{ {
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
} }
void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void LIB_CIRCLE::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode, const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] ) void* aData, const int aTransformMatrix[2][2] )
{ {
@ -764,7 +763,7 @@ void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
} }
EDA_Rect LibDrawCircle::GetBoundingBox() EDA_Rect LIB_CIRCLE::GetBoundingBox()
{ {
EDA_Rect rect; EDA_Rect rect;
@ -776,7 +775,7 @@ EDA_Rect LibDrawCircle::GetBoundingBox()
} }
void LibDrawCircle::DisplayInfo( WinEDA_DrawFrame* frame ) void LIB_CIRCLE::DisplayInfo( WinEDA_DrawFrame* frame )
{ {
wxString msg; wxString msg;
EDA_Rect bBox = GetBoundingBox(); EDA_Rect bBox = GetBoundingBox();
@ -786,24 +785,24 @@ void LibDrawCircle::DisplayInfo( WinEDA_DrawFrame* frame )
msg = ReturnStringFromValue( g_UnitMetric, m_Width, msg = ReturnStringFromValue( g_UnitMetric, m_Width,
EESCHEMA_INTERNAL_UNIT, true ); EESCHEMA_INTERNAL_UNIT, true );
frame->MsgPanel->Affiche_1_Parametre( 20, _( "Line width" ), msg, BLUE ); frame->MsgPanel->AppendMessage( _( "Line width" ), msg, BLUE );
msg = ReturnStringFromValue( g_UnitMetric, m_Radius, msg = ReturnStringFromValue( g_UnitMetric, m_Radius,
EESCHEMA_INTERNAL_UNIT, true ); EESCHEMA_INTERNAL_UNIT, true );
frame->MsgPanel->Affiche_1_Parametre( 40, _( "Radius" ), msg, RED ); frame->MsgPanel->AppendMessage( _( "Radius" ), msg, RED );
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
frame->MsgPanel->Affiche_1_Parametre( 60, _( "Bounding box" ), msg, BROWN ); frame->MsgPanel->AppendMessage( _( "Bounding box" ), msg, BROWN );
} }
/*************************/ /*************************/
/** class LibDrawSquare **/ /** class LIB_RECTANGLE **/
/*************************/ /*************************/
LibDrawSquare::LibDrawSquare( LIB_COMPONENT* aParent ) : LIB_RECTANGLE::LIB_RECTANGLE( LIB_COMPONENT* aParent ) :
LIB_DRAW_ITEM( COMPONENT_RECT_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( COMPONENT_RECT_DRAW_TYPE, aParent )
{ {
m_Width = 0; m_Width = 0;
@ -812,7 +811,7 @@ LibDrawSquare::LibDrawSquare( LIB_COMPONENT* aParent ) :
} }
LibDrawSquare::LibDrawSquare( const LibDrawSquare& rect ) : LIB_RECTANGLE::LIB_RECTANGLE( const LIB_RECTANGLE& rect ) :
LIB_DRAW_ITEM( rect ) LIB_DRAW_ITEM( rect )
{ {
m_Pos = rect.m_Pos; m_Pos = rect.m_Pos;
@ -822,7 +821,7 @@ LibDrawSquare::LibDrawSquare( const LibDrawSquare& rect ) :
} }
bool LibDrawSquare::Save( FILE* ExportFile ) const bool LIB_RECTANGLE::Save( FILE* ExportFile ) const
{ {
if( fprintf( ExportFile, "S %d %d %d %d %d %d %d %c\n", m_Pos.x, m_Pos.y, if( fprintf( ExportFile, "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, m_End.x, m_End.y, m_Unit, m_Convert, m_Width,
@ -833,7 +832,7 @@ bool LibDrawSquare::Save( FILE* ExportFile ) const
} }
bool LibDrawSquare::Load( char* line, wxString& errorMsg ) bool LIB_RECTANGLE::Load( char* line, wxString& errorMsg )
{ {
int cnt; int cnt;
char tmp[256]; char tmp[256];
@ -857,9 +856,9 @@ bool LibDrawSquare::Load( char* line, wxString& errorMsg )
} }
LIB_DRAW_ITEM* LibDrawSquare::DoGenCopy() LIB_DRAW_ITEM* LIB_RECTANGLE::DoGenCopy()
{ {
LibDrawSquare* newitem = new LibDrawSquare( GetParent() ); LIB_RECTANGLE* newitem = new LIB_RECTANGLE( GetParent() );
newitem->m_Pos = m_Pos; newitem->m_Pos = m_Pos;
newitem->m_End = m_End; newitem->m_End = m_End;
@ -873,11 +872,11 @@ LIB_DRAW_ITEM* LibDrawSquare::DoGenCopy()
} }
int LibDrawSquare::DoCompare( const LIB_DRAW_ITEM& other ) const int LIB_RECTANGLE::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_RECT_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_RECT_DRAW_TYPE );
const LibDrawSquare* tmp = ( LibDrawSquare* ) &other; const LIB_RECTANGLE* tmp = ( LIB_RECTANGLE* ) &other;
if( m_Pos.x != tmp->m_Pos.x ) if( m_Pos.x != tmp->m_Pos.x )
return m_Pos.x - tmp->m_Pos.x; return m_Pos.x - tmp->m_Pos.x;
@ -895,20 +894,20 @@ int LibDrawSquare::DoCompare( const LIB_DRAW_ITEM& other ) const
} }
void LibDrawSquare::DoOffset( const wxPoint& offset ) void LIB_RECTANGLE::DoOffset( const wxPoint& offset )
{ {
m_Pos += offset; m_Pos += offset;
m_End += offset; m_End += offset;
} }
bool LibDrawSquare::DoTestInside( EDA_Rect& rect ) bool LIB_RECTANGLE::DoTestInside( EDA_Rect& rect )
{ {
return rect.Inside( m_Pos.x, -m_Pos.y ) || rect.Inside( m_End.x, -m_End.y ); return rect.Inside( m_Pos.x, -m_Pos.y ) || rect.Inside( m_End.x, -m_End.y );
} }
void LibDrawSquare::DoMove( const wxPoint& newPosition ) void LIB_RECTANGLE::DoMove( const wxPoint& newPosition )
{ {
wxPoint size = m_End - m_Pos; wxPoint size = m_End - m_Pos;
m_Pos = newPosition; m_Pos = newPosition;
@ -916,7 +915,7 @@ void LibDrawSquare::DoMove( const wxPoint& newPosition )
} }
void LibDrawSquare::DoMirrorHorizontal( const wxPoint& center ) void LIB_RECTANGLE::DoMirrorHorizontal( const wxPoint& center )
{ {
m_Pos.x -= center.x; m_Pos.x -= center.x;
m_Pos.x *= -1; m_Pos.x *= -1;
@ -927,7 +926,7 @@ void LibDrawSquare::DoMirrorHorizontal( const wxPoint& center )
} }
void LibDrawSquare::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, void LIB_RECTANGLE::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ) const int transform[2][2] )
{ {
wxASSERT( plotter != NULL ); wxASSERT( plotter != NULL );
@ -949,12 +948,12 @@ void LibDrawSquare::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int LibDrawSquare::GetPenSize() int LIB_RECTANGLE::GetPenSize()
{ {
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
} }
void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void LIB_RECTANGLE::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode, const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] ) void* aData, const int aTransformMatrix[2][2] )
{ {
@ -1001,7 +1000,7 @@ void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
} }
void LibDrawSquare::DisplayInfo( WinEDA_DrawFrame* frame ) void LIB_RECTANGLE::DisplayInfo( WinEDA_DrawFrame* frame )
{ {
wxString msg; wxString msg;
@ -1010,11 +1009,11 @@ void LibDrawSquare::DisplayInfo( WinEDA_DrawFrame* frame )
msg = ReturnStringFromValue( g_UnitMetric, m_Width, msg = ReturnStringFromValue( g_UnitMetric, m_Width,
EESCHEMA_INTERNAL_UNIT, true ); EESCHEMA_INTERNAL_UNIT, true );
frame->MsgPanel->Affiche_1_Parametre( 20, _( "Line width" ), msg, BLUE ); frame->MsgPanel->AppendMessage( _( "Line width" ), msg, BLUE );
} }
EDA_Rect LibDrawSquare::GetBoundingBox() EDA_Rect LIB_RECTANGLE::GetBoundingBox()
{ {
EDA_Rect rect; EDA_Rect rect;
@ -1031,7 +1030,7 @@ EDA_Rect LibDrawSquare::GetBoundingBox()
* @param aRefPoint A wxPoint to test in eeschema space * @param aRefPoint A wxPoint to test in eeschema space
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
bool LibDrawSquare::HitTest( const wxPoint& aRefPoint ) bool LIB_RECTANGLE::HitTest( const wxPoint& aRefPoint )
{ {
int mindist = (m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2) + 1; int mindist = (m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2) + 1;
@ -1050,7 +1049,7 @@ bool LibDrawSquare::HitTest( const wxPoint& aRefPoint )
* of a line) * of a line)
* @param aTransMat = the transform matrix * @param aTransMat = the transform matrix
*/ */
bool LibDrawSquare::HitTest( wxPoint aRefPoint, int aThreshold, bool LIB_RECTANGLE::HitTest( wxPoint aRefPoint, int aThreshold,
const int aTransMat[2][2] ) const int aTransMat[2][2] )
{ {
wxPoint actualStart = TransformCoordinate( aTransMat, m_Pos ); wxPoint actualStart = TransformCoordinate( aTransMat, m_Pos );
@ -1088,9 +1087,9 @@ bool LibDrawSquare::HitTest( wxPoint aRefPoint, int aThreshold,
/**************************/ /**************************/
/** class LibDrawSegment **/ /** class LIB_SEGMENT **/
/**************************/ /**************************/
LibDrawSegment::LibDrawSegment( LIB_COMPONENT* aParent ) : LIB_SEGMENT::LIB_SEGMENT( LIB_COMPONENT* aParent ) :
LIB_DRAW_ITEM( COMPONENT_LINE_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( COMPONENT_LINE_DRAW_TYPE, aParent )
{ {
m_Width = 0; m_Width = 0;
@ -1098,7 +1097,7 @@ LibDrawSegment::LibDrawSegment( LIB_COMPONENT* aParent ) :
} }
LibDrawSegment::LibDrawSegment( const LibDrawSegment& segment ) : LIB_SEGMENT::LIB_SEGMENT( const LIB_SEGMENT& segment ) :
LIB_DRAW_ITEM( segment ) LIB_DRAW_ITEM( segment )
{ {
m_Pos = segment.m_Pos; m_Pos = segment.m_Pos;
@ -1107,7 +1106,7 @@ LibDrawSegment::LibDrawSegment( const LibDrawSegment& segment ) :
} }
bool LibDrawSegment::Save( FILE* ExportFile ) const bool LIB_SEGMENT::Save( FILE* ExportFile ) const
{ {
if( fprintf( ExportFile, "L %d %d %d", m_Unit, m_Convert, m_Width ) ) if( fprintf( ExportFile, "L %d %d %d", m_Unit, m_Convert, m_Width ) )
return false; return false;
@ -1116,15 +1115,15 @@ bool LibDrawSegment::Save( FILE* ExportFile ) const
} }
bool LibDrawSegment::Load( char* line, wxString& errorMsg ) bool LIB_SEGMENT::Load( char* line, wxString& errorMsg )
{ {
return true; return true;
} }
LIB_DRAW_ITEM* LibDrawSegment::DoGenCopy() LIB_DRAW_ITEM* LIB_SEGMENT::DoGenCopy()
{ {
LibDrawSegment* newitem = new LibDrawSegment( GetParent() ); LIB_SEGMENT* newitem = new LIB_SEGMENT( GetParent() );
newitem->m_Pos = m_Pos; newitem->m_Pos = m_Pos;
newitem->m_End = m_End; newitem->m_End = m_End;
@ -1137,11 +1136,11 @@ LIB_DRAW_ITEM* LibDrawSegment::DoGenCopy()
} }
int LibDrawSegment::DoCompare( const LIB_DRAW_ITEM& other ) const int LIB_SEGMENT::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_LINE_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_LINE_DRAW_TYPE );
const LibDrawSegment* tmp = ( LibDrawSegment* ) &other; const LIB_SEGMENT* tmp = ( LIB_SEGMENT* ) &other;
if( m_Pos.x != tmp->m_Pos.x ) if( m_Pos.x != tmp->m_Pos.x )
return m_Pos.x - tmp->m_Pos.x; return m_Pos.x - tmp->m_Pos.x;
@ -1159,20 +1158,20 @@ int LibDrawSegment::DoCompare( const LIB_DRAW_ITEM& other ) const
} }
void LibDrawSegment::DoOffset( const wxPoint& offset ) void LIB_SEGMENT::DoOffset( const wxPoint& offset )
{ {
m_Pos += offset; m_Pos += offset;
m_End += offset; m_End += offset;
} }
bool LibDrawSegment::DoTestInside( EDA_Rect& rect ) bool LIB_SEGMENT::DoTestInside( EDA_Rect& rect )
{ {
return rect.Inside( m_Pos.x, -m_Pos.y ) || rect.Inside( m_End.x, -m_End.y ); return rect.Inside( m_Pos.x, -m_Pos.y ) || rect.Inside( m_End.x, -m_End.y );
} }
void LibDrawSegment::DoMove( const wxPoint& newPosition ) void LIB_SEGMENT::DoMove( const wxPoint& newPosition )
{ {
wxPoint offset = newPosition - m_Pos; wxPoint offset = newPosition - m_Pos;
m_Pos += offset; m_Pos += offset;
@ -1180,7 +1179,7 @@ void LibDrawSegment::DoMove( const wxPoint& newPosition )
} }
void LibDrawSegment::DoMirrorHorizontal( const wxPoint& center ) void LIB_SEGMENT::DoMirrorHorizontal( const wxPoint& center )
{ {
m_Pos.x -= center.x; m_Pos.x -= center.x;
m_Pos.x *= -1; m_Pos.x *= -1;
@ -1191,7 +1190,7 @@ void LibDrawSegment::DoMirrorHorizontal( const wxPoint& center )
} }
void LibDrawSegment::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, void LIB_SEGMENT::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ) const int transform[2][2] )
{ {
wxASSERT( plotter != NULL ); wxASSERT( plotter != NULL );
@ -1211,12 +1210,12 @@ void LibDrawSegment::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int LibDrawSegment::GetPenSize() int LIB_SEGMENT::GetPenSize()
{ {
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
} }
void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void LIB_SEGMENT::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode, const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] ) void* aData, const int aTransformMatrix[2][2] )
{ {
@ -1251,7 +1250,7 @@ void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
} }
void LibDrawSegment::DisplayInfo( WinEDA_DrawFrame* frame ) void LIB_SEGMENT::DisplayInfo( WinEDA_DrawFrame* frame )
{ {
wxString msg; wxString msg;
EDA_Rect bBox = GetBoundingBox(); EDA_Rect bBox = GetBoundingBox();
@ -1261,12 +1260,12 @@ void LibDrawSegment::DisplayInfo( WinEDA_DrawFrame* frame )
msg = ReturnStringFromValue( g_UnitMetric, m_Width, msg = ReturnStringFromValue( g_UnitMetric, m_Width,
EESCHEMA_INTERNAL_UNIT, true ); EESCHEMA_INTERNAL_UNIT, true );
frame->MsgPanel->Affiche_1_Parametre( 20, _( "Line width" ), msg, BLUE ); frame->MsgPanel->AppendMessage( _( "Line width" ), msg, BLUE );
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
frame->MsgPanel->Affiche_1_Parametre( 60, _( "Bounding box" ), msg, BROWN ); frame->MsgPanel->AppendMessage( _( "Bounding box" ), msg, BROWN );
} }
@ -1276,7 +1275,7 @@ void LibDrawSegment::DisplayInfo( WinEDA_DrawFrame* frame )
* @param aRefPos A wxPoint to test * @param aRefPos A wxPoint to test
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
bool LibDrawSegment::HitTest( const wxPoint& aPosRef ) bool LIB_SEGMENT::HitTest( const wxPoint& aPosRef )
{ {
int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2; int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2;
@ -1295,7 +1294,7 @@ bool LibDrawSegment::HitTest( const wxPoint& aPosRef )
* thickness of a line) * thickness of a line)
* @param aTransMat = the transform matrix * @param aTransMat = the transform matrix
*/ */
bool LibDrawSegment::HitTest( wxPoint aPosRef, int aThreshold, bool LIB_SEGMENT::HitTest( wxPoint aPosRef, int aThreshold,
const int aTransMat[2][2] ) const int aTransMat[2][2] )
{ {
wxPoint start = TransformCoordinate( aTransMat, m_Pos ); wxPoint start = TransformCoordinate( aTransMat, m_Pos );
@ -1306,9 +1305,9 @@ bool LibDrawSegment::HitTest( wxPoint aPosRef, int aThreshold,
/***************************/ /***************************/
/** class LibDrawPolyline **/ /** class LIB_POLYLINE **/
/***************************/ /***************************/
LibDrawPolyline::LibDrawPolyline( LIB_COMPONENT* aParent ) : LIB_POLYLINE::LIB_POLYLINE( LIB_COMPONENT* aParent ) :
LIB_DRAW_ITEM( COMPONENT_POLYLINE_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( COMPONENT_POLYLINE_DRAW_TYPE, aParent )
{ {
m_Fill = NO_FILL; m_Fill = NO_FILL;
@ -1317,7 +1316,7 @@ LibDrawPolyline::LibDrawPolyline( LIB_COMPONENT* aParent ) :
} }
LibDrawPolyline::LibDrawPolyline( const LibDrawPolyline& polyline ) : LIB_POLYLINE::LIB_POLYLINE( const LIB_POLYLINE& polyline ) :
LIB_DRAW_ITEM( polyline ) LIB_DRAW_ITEM( polyline )
{ {
m_PolyPoints = polyline.m_PolyPoints; // Vector copy m_PolyPoints = polyline.m_PolyPoints; // Vector copy
@ -1326,7 +1325,7 @@ LibDrawPolyline::LibDrawPolyline( const LibDrawPolyline& polyline ) :
} }
bool LibDrawPolyline::Save( FILE* ExportFile ) const bool LIB_POLYLINE::Save( FILE* ExportFile ) const
{ {
int ccount = GetCornerCount(); int ccount = GetCornerCount();
@ -1348,7 +1347,7 @@ bool LibDrawPolyline::Save( FILE* ExportFile ) const
} }
bool LibDrawPolyline::Load( char* line, wxString& errorMsg ) bool LIB_POLYLINE::Load( char* line, wxString& errorMsg )
{ {
char* p; char* p;
int i, ccount = 0; int i, ccount = 0;
@ -1408,9 +1407,9 @@ bool LibDrawPolyline::Load( char* line, wxString& errorMsg )
} }
LIB_DRAW_ITEM* LibDrawPolyline::DoGenCopy() LIB_DRAW_ITEM* LIB_POLYLINE::DoGenCopy()
{ {
LibDrawPolyline* newitem = new LibDrawPolyline( GetParent() ); LIB_POLYLINE* newitem = new LIB_POLYLINE( GetParent() );
newitem->m_PolyPoints = m_PolyPoints; // Vector copy newitem->m_PolyPoints = m_PolyPoints; // Vector copy
newitem->m_Width = m_Width; newitem->m_Width = m_Width;
@ -1423,11 +1422,11 @@ LIB_DRAW_ITEM* LibDrawPolyline::DoGenCopy()
} }
int LibDrawPolyline::DoCompare( const LIB_DRAW_ITEM& other ) const int LIB_POLYLINE::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_POLYLINE_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_POLYLINE_DRAW_TYPE );
const LibDrawPolyline* tmp = ( LibDrawPolyline* ) &other; const LIB_POLYLINE* tmp = ( LIB_POLYLINE* ) &other;
if( m_PolyPoints.size() != tmp->m_PolyPoints.size() ) if( m_PolyPoints.size() != tmp->m_PolyPoints.size() )
return m_PolyPoints.size() - tmp->m_PolyPoints.size(); return m_PolyPoints.size() - tmp->m_PolyPoints.size();
@ -1444,14 +1443,14 @@ int LibDrawPolyline::DoCompare( const LIB_DRAW_ITEM& other ) const
} }
void LibDrawPolyline::DoOffset( const wxPoint& offset ) void LIB_POLYLINE::DoOffset( const wxPoint& offset )
{ {
for( size_t i = 0; i < m_PolyPoints.size(); i++ ) for( size_t i = 0; i < m_PolyPoints.size(); i++ )
m_PolyPoints[i] += offset; m_PolyPoints[i] += offset;
} }
bool LibDrawPolyline::DoTestInside( EDA_Rect& rect ) bool LIB_POLYLINE::DoTestInside( EDA_Rect& rect )
{ {
for( size_t i = 0; i < m_PolyPoints.size(); i++ ) for( size_t i = 0; i < m_PolyPoints.size(); i++ )
{ {
@ -1463,13 +1462,13 @@ bool LibDrawPolyline::DoTestInside( EDA_Rect& rect )
} }
void LibDrawPolyline::DoMove( const wxPoint& newPosition ) void LIB_POLYLINE::DoMove( const wxPoint& newPosition )
{ {
DoOffset( newPosition - m_PolyPoints[0] ); DoOffset( newPosition - m_PolyPoints[0] );
} }
void LibDrawPolyline::DoMirrorHorizontal( const wxPoint& center ) void LIB_POLYLINE::DoMirrorHorizontal( const wxPoint& center )
{ {
size_t i, imax = m_PolyPoints.size(); size_t i, imax = m_PolyPoints.size();
@ -1482,7 +1481,7 @@ void LibDrawPolyline::DoMirrorHorizontal( const wxPoint& center )
} }
void LibDrawPolyline::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, void LIB_POLYLINE::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ) const int transform[2][2] )
{ {
wxASSERT( plotter != NULL ); wxASSERT( plotter != NULL );
@ -1511,7 +1510,7 @@ void LibDrawPolyline::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill
} }
void LibDrawPolyline::AddPoint( const wxPoint& point ) void LIB_POLYLINE::AddPoint( const wxPoint& point )
{ {
m_PolyPoints.push_back( point ); m_PolyPoints.push_back( point );
} }
@ -1520,12 +1519,12 @@ void LibDrawPolyline::AddPoint( const wxPoint& point )
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int LibDrawPolyline::GetPenSize() int LIB_POLYLINE::GetPenSize()
{ {
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
} }
void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void LIB_POLYLINE::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode, const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] ) void* aData, const int aTransformMatrix[2][2] )
{ {
@ -1599,7 +1598,7 @@ void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
* @param aRefPos A wxPoint to test * @param aRefPos A wxPoint to test
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
bool LibDrawPolyline::HitTest( const wxPoint& aRefPos ) bool LIB_POLYLINE::HitTest( const wxPoint& aRefPos )
{ {
int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2; int mindist = m_Width ? m_Width / 2 : g_DrawDefaultLineThickness / 2;
@ -1616,7 +1615,7 @@ bool LibDrawPolyline::HitTest( const wxPoint& aRefPos )
* @param aThreshold = max distance to a segment * @param aThreshold = max distance to a segment
* @param aTransMat = the transform matrix * @param aTransMat = the transform matrix
*/ */
bool LibDrawPolyline::HitTest( wxPoint aPosRef, int aThreshold, bool LIB_POLYLINE::HitTest( wxPoint aPosRef, int aThreshold,
const int aTransMat[2][2] ) const int aTransMat[2][2] )
{ {
wxPoint ref, start, end; wxPoint ref, start, end;
@ -1637,7 +1636,7 @@ bool LibDrawPolyline::HitTest( wxPoint aPosRef, int aThreshold,
/** Function GetBoundingBox /** Function GetBoundingBox
* @return the boundary box for this, in library coordinates * @return the boundary box for this, in library coordinates
*/ */
EDA_Rect LibDrawPolyline::GetBoundingBox() EDA_Rect LIB_POLYLINE::GetBoundingBox()
{ {
EDA_Rect rect; EDA_Rect rect;
int xmin, xmax, ymin, ymax; int xmin, xmax, ymin, ymax;
@ -1661,7 +1660,7 @@ EDA_Rect LibDrawPolyline::GetBoundingBox()
} }
void LibDrawPolyline::DisplayInfo( WinEDA_DrawFrame* frame ) void LIB_POLYLINE::DisplayInfo( WinEDA_DrawFrame* frame )
{ {
wxString msg; wxString msg;
EDA_Rect bBox = GetBoundingBox(); EDA_Rect bBox = GetBoundingBox();
@ -1671,18 +1670,18 @@ void LibDrawPolyline::DisplayInfo( WinEDA_DrawFrame* frame )
msg = ReturnStringFromValue( g_UnitMetric, m_Width, msg = ReturnStringFromValue( g_UnitMetric, m_Width,
EESCHEMA_INTERNAL_UNIT, true ); EESCHEMA_INTERNAL_UNIT, true );
frame->MsgPanel->Affiche_1_Parametre( 20, _( "Line width" ), msg, BLUE ); frame->MsgPanel->AppendMessage( _( "Line width" ), msg, BLUE );
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
frame->MsgPanel->Affiche_1_Parametre( 40, _( "Bounding box" ), msg, BROWN ); frame->MsgPanel->AppendMessage( _( "Bounding box" ), msg, BROWN );
} }
/***************************/ /***************************/
/** class LibDrawBezier **/ /** class LIB_BEZIER **/
/***************************/ /***************************/
LibDrawBezier::LibDrawBezier( LIB_COMPONENT* aParent ) : LIB_BEZIER::LIB_BEZIER( LIB_COMPONENT* aParent ) :
LIB_DRAW_ITEM( COMPONENT_BEZIER_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( COMPONENT_BEZIER_DRAW_TYPE, aParent )
{ {
m_Fill = NO_FILL; m_Fill = NO_FILL;
@ -1691,8 +1690,7 @@ LibDrawBezier::LibDrawBezier( LIB_COMPONENT* aParent ) :
} }
LibDrawBezier::LibDrawBezier( const LibDrawBezier& bezier ) : LIB_BEZIER::LIB_BEZIER( const LIB_BEZIER& bezier ) : LIB_DRAW_ITEM( bezier )
LIB_DRAW_ITEM( bezier )
{ {
m_PolyPoints = bezier.m_PolyPoints; m_PolyPoints = bezier.m_PolyPoints;
m_BezierPoints = bezier.m_BezierPoints; // Vector copy m_BezierPoints = bezier.m_BezierPoints; // Vector copy
@ -1701,7 +1699,7 @@ LibDrawBezier::LibDrawBezier( const LibDrawBezier& bezier ) :
} }
bool LibDrawBezier::Save( FILE* ExportFile ) const bool LIB_BEZIER::Save( FILE* ExportFile ) const
{ {
int ccount = GetCornerCount(); int ccount = GetCornerCount();
@ -1723,7 +1721,7 @@ bool LibDrawBezier::Save( FILE* ExportFile ) const
} }
bool LibDrawBezier::Load( char* line, wxString& errorMsg ) bool LIB_BEZIER::Load( char* line, wxString& errorMsg )
{ {
char* p; char* p;
int i, ccount = 0; int i, ccount = 0;
@ -1782,9 +1780,9 @@ bool LibDrawBezier::Load( char* line, wxString& errorMsg )
} }
LIB_DRAW_ITEM* LibDrawBezier::DoGenCopy() LIB_DRAW_ITEM* LIB_BEZIER::DoGenCopy()
{ {
LibDrawBezier* newitem = new LibDrawBezier(GetParent()); LIB_BEZIER* newitem = new LIB_BEZIER(GetParent());
newitem->m_BezierPoints = m_BezierPoints; // Vector copy newitem->m_BezierPoints = m_BezierPoints; // Vector copy
newitem->m_Width = m_Width; newitem->m_Width = m_Width;
@ -1796,11 +1794,11 @@ LIB_DRAW_ITEM* LibDrawBezier::DoGenCopy()
} }
int LibDrawBezier::DoCompare( const LIB_DRAW_ITEM& other ) const int LIB_BEZIER::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_BEZIER_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_BEZIER_DRAW_TYPE );
const LibDrawBezier* tmp = ( LibDrawBezier* ) &other; const LIB_BEZIER* tmp = ( LIB_BEZIER* ) &other;
if( m_BezierPoints.size() != tmp->m_BezierPoints.size() ) if( m_BezierPoints.size() != tmp->m_BezierPoints.size() )
return m_BezierPoints.size() - tmp->m_BezierPoints.size(); return m_BezierPoints.size() - tmp->m_BezierPoints.size();
@ -1817,7 +1815,7 @@ int LibDrawBezier::DoCompare( const LIB_DRAW_ITEM& other ) const
} }
void LibDrawBezier::DoOffset( const wxPoint& offset ) void LIB_BEZIER::DoOffset( const wxPoint& offset )
{ {
size_t i; size_t i;
@ -1829,7 +1827,7 @@ void LibDrawBezier::DoOffset( const wxPoint& offset )
} }
bool LibDrawBezier::DoTestInside( EDA_Rect& rect ) bool LIB_BEZIER::DoTestInside( EDA_Rect& rect )
{ {
for( size_t i = 0; i < m_PolyPoints.size(); i++ ) for( size_t i = 0; i < m_PolyPoints.size(); i++ )
{ {
@ -1841,13 +1839,13 @@ bool LibDrawBezier::DoTestInside( EDA_Rect& rect )
} }
void LibDrawBezier::DoMove( const wxPoint& newPosition ) void LIB_BEZIER::DoMove( const wxPoint& newPosition )
{ {
DoOffset( newPosition - m_PolyPoints[0] ); DoOffset( newPosition - m_PolyPoints[0] );
} }
void LibDrawBezier::DoMirrorHorizontal( const wxPoint& center ) void LIB_BEZIER::DoMirrorHorizontal( const wxPoint& center )
{ {
size_t i, imax = m_PolyPoints.size(); size_t i, imax = m_PolyPoints.size();
@ -1868,7 +1866,7 @@ void LibDrawBezier::DoMirrorHorizontal( const wxPoint& center )
} }
void LibDrawBezier::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, void LIB_BEZIER::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ) const int transform[2][2] )
{ {
wxASSERT( plotter != NULL ); wxASSERT( plotter != NULL );
@ -1900,12 +1898,12 @@ void LibDrawBezier::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
int LibDrawBezier::GetPenSize() int LIB_BEZIER::GetPenSize()
{ {
return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width; return ( m_Width == 0 ) ? g_DrawDefaultLineThickness : m_Width;
} }
void LibDrawBezier::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, void LIB_BEZIER::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode, const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] ) void* aData, const int aTransformMatrix[2][2] )
{ {
@ -1967,7 +1965,7 @@ void LibDrawBezier::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
* @param aRefPos A wxPoint to test * @param aRefPos A wxPoint to test
* @return bool - true if a hit, else false * @return bool - true if a hit, else false
*/ */
bool LibDrawBezier::HitTest( const wxPoint& aRefPos ) bool LIB_BEZIER::HitTest( const wxPoint& aRefPos )
{ {
int mindist = m_Width ? m_Width /2 : g_DrawDefaultLineThickness / 2; int mindist = m_Width ? m_Width /2 : g_DrawDefaultLineThickness / 2;
// Have a minimal tolerance for hit test // Have a minimal tolerance for hit test
@ -1982,7 +1980,7 @@ bool LibDrawBezier::HitTest( const wxPoint& aRefPos )
* @param aThreshold = max distance to a segment * @param aThreshold = max distance to a segment
* @param aTransMat = the transform matrix * @param aTransMat = the transform matrix
*/ */
bool LibDrawBezier::HitTest( wxPoint aPosRef, int aThreshold, bool LIB_BEZIER::HitTest( wxPoint aPosRef, int aThreshold,
const int aTransMat[2][2] ) const int aTransMat[2][2] )
{ {
wxPoint ref, start, end; wxPoint ref, start, end;
@ -2003,7 +2001,7 @@ bool LibDrawBezier::HitTest( wxPoint aPosRef, int aThreshold,
/** Function GetBoundingBox /** Function GetBoundingBox
* @return the boundary box for this, in library coordinates * @return the boundary box for this, in library coordinates
*/ */
EDA_Rect LibDrawBezier::GetBoundingBox() EDA_Rect LIB_BEZIER::GetBoundingBox()
{ {
EDA_Rect rect; EDA_Rect rect;
int xmin, xmax, ymin, ymax; int xmin, xmax, ymin, ymax;
@ -2030,7 +2028,7 @@ EDA_Rect LibDrawBezier::GetBoundingBox()
} }
void LibDrawBezier::DisplayInfo( WinEDA_DrawFrame* frame ) void LIB_BEZIER::DisplayInfo( WinEDA_DrawFrame* frame )
{ {
wxString msg; wxString msg;
EDA_Rect bBox = GetBoundingBox(); EDA_Rect bBox = GetBoundingBox();
@ -2040,10 +2038,10 @@ void LibDrawBezier::DisplayInfo( WinEDA_DrawFrame* frame )
msg = ReturnStringFromValue( g_UnitMetric, m_Width, msg = ReturnStringFromValue( g_UnitMetric, m_Width,
EESCHEMA_INTERNAL_UNIT, true ); EESCHEMA_INTERNAL_UNIT, true );
frame->MsgPanel->Affiche_1_Parametre( 20, _( "Line width" ), msg, BLUE ); frame->MsgPanel->AppendMessage( _( "Line width" ), msg, BLUE );
msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x, msg.Printf( wxT( "(%d, %d, %d, %d)" ), bBox.GetOrigin().x,
bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y ); bBox.GetOrigin().y, bBox.GetEnd().x, bBox.GetEnd().y );
frame->MsgPanel->Affiche_1_Parametre( 40, _( "Bounding box" ), msg, BROWN ); frame->MsgPanel->AppendMessage( _( "Bounding box" ), msg, BROWN );
} }

View File

@ -277,6 +277,14 @@ public:
DoPlot( plotter, offset, fill, transform ); DoPlot( plotter, offset, fill, transform );
} }
/**
* Return the width of the draw item.
*
* @return int - Width of draw object.
*/
int GetWidth( void ) { return DoGetWidth(); }
protected: protected:
virtual LIB_DRAW_ITEM* DoGenCopy() = 0; virtual LIB_DRAW_ITEM* DoGenCopy() = 0;
@ -299,6 +307,7 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center ) = 0; virtual void DoMirrorHorizontal( const wxPoint& center ) = 0;
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ) = 0; const int transform[2][2] ) = 0;
virtual int DoGetWidth( void ) = 0;
}; };
@ -311,7 +320,7 @@ typedef boost::ptr_vector< LIB_DRAW_ITEM > LIB_DRAW_ITEM_LIST;
/********/ /********/
/* Pins */ /* Pins */
/********/ /********/
class LibDrawPin : public LIB_DRAW_ITEM class LIB_PIN : public LIB_DRAW_ITEM
{ {
public: public:
int m_PinLen; /* Pin length */ int m_PinLen; /* Pin length */
@ -339,16 +348,16 @@ public:
int m_Width; /* Line width */ int m_Width; /* Line width */
public: public:
LibDrawPin(LIB_COMPONENT * aParent); LIB_PIN(LIB_COMPONENT * aParent);
LibDrawPin( const LibDrawPin& pin ); LIB_PIN( const LIB_PIN& pin );
~LibDrawPin() { } ~LIB_PIN() { }
LibDrawPin* Next() const { return (LibDrawPin*) Pnext; } LIB_PIN* Next() const { return (LIB_PIN*) Pnext; }
LibDrawPin* Back() const { return (LibDrawPin*) Pback; } LIB_PIN* Back() const { return (LIB_PIN*) Pback; }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "LibDrawPin" ); return wxT( "LIB_PIN" );
} }
@ -452,6 +461,7 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center ); virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ); const int transform[2][2] );
virtual int DoGetWidth( void ) { return m_Width; }
}; };
@ -459,7 +469,7 @@ protected:
/* Graphic Body Item: Arc */ /* Graphic Body Item: Arc */
/**************************/ /**************************/
class LibDrawArc : public LIB_DRAW_ITEM class LIB_ARC : public LIB_DRAW_ITEM
{ {
public: public:
int m_Radius; int m_Radius;
@ -472,12 +482,12 @@ public:
int m_Width; /* Line width */ int m_Width; /* Line width */
public: public:
LibDrawArc(LIB_COMPONENT * aParent); LIB_ARC(LIB_COMPONENT * aParent);
LibDrawArc( const LibDrawArc& arc ); LIB_ARC( const LIB_ARC& arc );
~LibDrawArc() { } ~LIB_ARC() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "LibDrawArc" ); return wxT( "LIB_ARC" );
} }
@ -540,13 +550,14 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center ); virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ); const int transform[2][2] );
virtual int DoGetWidth( void ) { return m_Width; }
}; };
/*****************************/ /*****************************/
/* Graphic Body Item: Circle */ /* Graphic Body Item: Circle */
/*****************************/ /*****************************/
class LibDrawCircle : public LIB_DRAW_ITEM class LIB_CIRCLE : public LIB_DRAW_ITEM
{ {
public: public:
int m_Radius; int m_Radius;
@ -555,12 +566,12 @@ public:
int m_Width; /* Line width */ int m_Width; /* Line width */
public: public:
LibDrawCircle(LIB_COMPONENT * aParent); LIB_CIRCLE(LIB_COMPONENT * aParent);
LibDrawCircle( const LibDrawCircle& circle ); LIB_CIRCLE( const LIB_CIRCLE& circle );
~LibDrawCircle() { } ~LIB_CIRCLE() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "LibDrawCircle" ); return wxT( "LIB_CIRCLE" );
} }
@ -624,6 +635,7 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center ); virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ); const int transform[2][2] );
virtual int DoGetWidth( void ) { return m_Width; }
}; };
@ -633,15 +645,15 @@ protected:
/* Fields like Ref , value... are not Text, */ /* Fields like Ref , value... are not Text, */
/* they are a separate class */ /* they are a separate class */
/*********************************************/ /*********************************************/
class LibDrawText : public LIB_DRAW_ITEM, public EDA_TextStruct class LIB_TEXT : public LIB_DRAW_ITEM, public EDA_TextStruct
{ {
public: public:
LibDrawText(LIB_COMPONENT * aParent); LIB_TEXT(LIB_COMPONENT * aParent);
LibDrawText( const LibDrawText& text ); LIB_TEXT( const LIB_TEXT& text );
~LibDrawText() { } ~LIB_TEXT() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "LibDrawText" ); return wxT( "LIB_TEXT" );
} }
@ -719,13 +731,14 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center ); virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ); const int transform[2][2] );
virtual int DoGetWidth( void ) { return m_Width; }
}; };
/********************************/ /********************************/
/* Graphic Body Item: Rectangle */ /* Graphic Body Item: Rectangle */
/********************************/ /********************************/
class LibDrawSquare : public LIB_DRAW_ITEM class LIB_RECTANGLE : public LIB_DRAW_ITEM
{ {
public: public:
wxPoint m_End; /* Rectangle end point. */ wxPoint m_End; /* Rectangle end point. */
@ -733,12 +746,12 @@ public:
int m_Width; /* Line width */ int m_Width; /* Line width */
public: public:
LibDrawSquare(LIB_COMPONENT * aParent); LIB_RECTANGLE(LIB_COMPONENT * aParent);
LibDrawSquare( const LibDrawSquare& rect ); LIB_RECTANGLE( const LIB_RECTANGLE& rect );
~LibDrawSquare() { } ~LIB_RECTANGLE() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "LibDrawSquare" ); return wxT( "LIB_RECTANGLE" );
} }
@ -803,12 +816,13 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center ); virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ); const int transform[2][2] );
virtual int DoGetWidth( void ) { return m_Width; }
}; };
/**********************************/ /**********************************/
/* Graphic Body Item: single line */ /* Graphic Body Item: single line */
/**********************************/ /**********************************/
class LibDrawSegment : public LIB_DRAW_ITEM class LIB_SEGMENT : public LIB_DRAW_ITEM
{ {
public: public:
wxPoint m_End; wxPoint m_End;
@ -817,12 +831,12 @@ public:
int m_Width; /* Line width */ int m_Width; /* Line width */
public: public:
LibDrawSegment(LIB_COMPONENT * aParent); LIB_SEGMENT(LIB_COMPONENT * aParent);
LibDrawSegment( const LibDrawSegment& segment ); LIB_SEGMENT( const LIB_SEGMENT& segment );
~LibDrawSegment() { } ~LIB_SEGMENT() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "LibDrawSegment" ); return wxT( "LIB_SEGMENT" );
} }
@ -886,26 +900,27 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center ); virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ); const int transform[2][2] );
virtual int DoGetWidth( void ) { return m_Width; }
}; };
/**********************************************************/ /**********************************************************/
/* Graphic Body Item: Polygon and polyline (set of lines) */ /* Graphic Body Item: Polygon and polyline (set of lines) */
/**********************************************************/ /**********************************************************/
class LibDrawPolyline : public LIB_DRAW_ITEM class LIB_POLYLINE : public LIB_DRAW_ITEM
{ {
public: public:
int m_Width; /* Line width */ int m_Width; /* Line width */
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2) std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
public: public:
LibDrawPolyline(LIB_COMPONENT * aParent); LIB_POLYLINE(LIB_COMPONENT * aParent);
LibDrawPolyline( const LibDrawPolyline& polyline ); LIB_POLYLINE( const LIB_POLYLINE& polyline );
~LibDrawPolyline() { } ~LIB_POLYLINE() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "LibDrawPolyline" ); return wxT( "LIB_POLYLINE" );
} }
@ -978,12 +993,13 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center ); virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ); const int transform[2][2] );
virtual int DoGetWidth( void ) { return m_Width; }
}; };
/**********************************************************/ /**********************************************************/
/* Graphic Body Item: Bezier Curve (set of lines) */ /* Graphic Body Item: Bezier Curve (set of lines) */
/**********************************************************/ /**********************************************************/
class LibDrawBezier : public LIB_DRAW_ITEM class LIB_BEZIER : public LIB_DRAW_ITEM
{ {
public: public:
int m_Width; /* Line width */ int m_Width; /* Line width */
@ -991,13 +1007,13 @@ public:
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2) std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
public: public:
LibDrawBezier( LIB_COMPONENT * aParent ); LIB_BEZIER( LIB_COMPONENT * aParent );
LibDrawBezier( const LibDrawBezier& bezier ); LIB_BEZIER( const LIB_BEZIER& bezier );
~LibDrawBezier() { } ~LIB_BEZIER() { }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "LibDrawBezier" ); return wxT( "LIB_BEZIER" );
} }
@ -1070,6 +1086,7 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center ); virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill, virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] ); const int transform[2][2] );
virtual int DoGetWidth( void ) { return m_Width; }
}; };
#endif // CLASSES_BODY_ITEMS_H #endif // CLASSES_BODY_ITEMS_H

View File

@ -42,7 +42,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Include
SCH_ITEM* DrawStruct; SCH_ITEM* DrawStruct;
wxString msg; wxString msg;
wxPoint mouse_position = GetScreen()->m_MousePosition; wxPoint mouse_position = GetScreen()->m_MousePosition;
LibDrawPin* Pin = NULL; LIB_PIN* Pin = NULL;
SCH_COMPONENT* LibItem = NULL; SCH_COMPONENT* LibItem = NULL;
DrawStruct = SchematicGeneralLocateAndDisplay( mouse_position, IncludePin ); DrawStruct = SchematicGeneralLocateAndDisplay( mouse_position, IncludePin );
@ -75,7 +75,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Include
break; break;
case COMPONENT_PIN_DRAW_TYPE: case COMPONENT_PIN_DRAW_TYPE:
Pin = (LibDrawPin*) DrawStruct; Pin = (LIB_PIN*) DrawStruct;
break; break;
} }
@ -120,7 +120,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
*/ */
{ {
SCH_ITEM* DrawStruct; SCH_ITEM* DrawStruct;
LibDrawPin* Pin; LIB_PIN* Pin;
SCH_COMPONENT* LibItem; SCH_COMPONENT* LibItem;
wxString Text; wxString Text;
wxString msg; wxString msg;

View File

@ -98,7 +98,7 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
if( objectToSync == NULL ) if( objectToSync == NULL )
return; return;
LibDrawPin* Pin = NULL; LIB_PIN* Pin = NULL;
char Line[1024]; char Line[1024];
/* Cross probing to pcbnew if a pin or a component is found */ /* Cross probing to pcbnew if a pin or a component is found */
@ -126,7 +126,7 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
if( LibItem == NULL ) if( LibItem == NULL )
break; break;
Pin = (LibDrawPin*) objectToSync; Pin = (LIB_PIN*) objectToSync;
if( Pin->m_PinNum ) if( Pin->m_PinNum )
{ {
wxString pinnum; wxString pinnum;

View File

@ -148,17 +148,19 @@ void WinEDA_SchematicFrame::TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC )
} }
/************************************************************************************************/
LibDrawPin* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList, const wxPoint& pos )
/************************************************************************************************/
/** Teste if point pos is on a pin end /**
* @return un pointer on the pin or NULL * Test if point pos is on a pin end.
* @param DrawList = list of SCH_ITEMs *
* @param DrawList = List of SCH_ITEMs to check.
*
* @return LIB_PIN - Pointer to the located pin or NULL if no pin was found.
*/ */
LIB_PIN* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList,
const wxPoint& pos )
{ {
SCH_COMPONENT* DrawLibItem; SCH_COMPONENT* DrawLibItem;
LibDrawPin* Pin; LIB_PIN* Pin;
wxPoint pinpos; wxPoint pinpos;
Pin = LocateAnyPin( DrawList, pos, &DrawLibItem ); Pin = LocateAnyPin( DrawList, pos, &DrawLibItem );
@ -275,13 +277,10 @@ void TestLabelForDangling( SCH_TEXT* label,
} }
/****************************************************/
wxPoint ReturnPinPhysicalPosition( LibDrawPin* Pin,
SCH_COMPONENT* DrawLibItem )
/****************************************************/
/* Retourne la position physique de la pin, qui d<>pend de l'orientation /* Retourne la position physique de la pin, qui d<>pend de l'orientation
* du composant */ * du composant */
wxPoint ReturnPinPhysicalPosition( LIB_PIN* Pin, SCH_COMPONENT* DrawLibItem )
{ {
wxPoint PinPos = Pin->m_Pos; wxPoint PinPos = Pin->m_Pos;
@ -289,7 +288,8 @@ wxPoint ReturnPinPhysicalPosition( LibDrawPin* Pin,
NEGATE( PinPos.y ); NEGATE( PinPos.y );
else else
PinPos = TransformCoordinate( DrawLibItem->m_Transform, Pin->m_Pos) + DrawLibItem->m_Pos; PinPos = TransformCoordinate( DrawLibItem->m_Transform,
Pin->m_Pos ) + DrawLibItem->m_Pos;
return PinPos; return PinPos;
} }
@ -392,7 +392,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
if( Entry == NULL ) if( Entry == NULL )
break; break;
for( LibDrawPin* Pin = Entry->GetNextPin(); Pin != NULL; for( LIB_PIN* Pin = Entry->GetNextPin(); Pin != NULL;
Pin = Entry->GetNextPin( Pin ) ) Pin = Entry->GetNextPin( Pin ) )
{ {
wxASSERT( Pin->Type() == COMPONENT_PIN_DRAW_TYPE ); wxASSERT( Pin->Type() == COMPONENT_PIN_DRAW_TYPE );

View File

@ -59,57 +59,62 @@ WinEDA_bodygraphics_PropertiesFrame::WinEDA_bodygraphics_PropertiesFrame( WinEDA
/* Set the dialog items: */ /* Set the dialog items: */
if ( CurrentItem ) if ( CurrentItem )
{ {
if ( CurrentItem->m_Unit == 0 ) m_CommonUnit->SetValue(TRUE); if ( CurrentItem->m_Unit == 0 )
m_CommonUnit->SetValue( TRUE );
} }
else if ( ! g_FlDrawSpecificUnit ) m_CommonUnit->SetValue(TRUE); else if ( ! g_FlDrawSpecificUnit )
{
m_CommonUnit->SetValue( TRUE );
}
if ( CurrentItem ) if ( CurrentItem )
{ {
if ( CurrentItem->m_Convert == 0 ) m_CommonConvert->SetValue(TRUE); if ( CurrentItem->m_Convert == 0 )
m_CommonConvert->SetValue( TRUE );
}
else if ( !g_FlDrawSpecificConvert )
{
m_CommonConvert->SetValue( TRUE );
} }
else if ( !g_FlDrawSpecificConvert ) m_CommonConvert->SetValue(TRUE);
bool show_fill_option = FALSE; bool show_fill_option = false;
int fill_option = 0; int fill_option = 0;
if( CurrentItem ) if( CurrentItem )
switch(CurrentItem->Type()) {
fill_option = CurrentItem->m_Fill;
switch( CurrentItem->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
show_fill_option = TRUE;
fill_option = ((LibDrawArc*)CurrentItem)->m_Fill;
m_GraphicShapeWidthCtrl->SetValue(((LibDrawArc*)CurrentItem)->m_Width);
break;
case COMPONENT_CIRCLE_DRAW_TYPE: case COMPONENT_CIRCLE_DRAW_TYPE:
show_fill_option = TRUE;
fill_option = ((LibDrawCircle*)CurrentItem)->m_Fill;
m_GraphicShapeWidthCtrl->SetValue(((LibDrawCircle*)CurrentItem)->m_Width);
break;
case COMPONENT_RECT_DRAW_TYPE: case COMPONENT_RECT_DRAW_TYPE:
show_fill_option = TRUE;
fill_option = ((LibDrawSquare *)CurrentItem)->m_Fill;
m_GraphicShapeWidthCtrl->SetValue(((LibDrawSquare*)CurrentItem)->m_Width);
break;
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
show_fill_option = TRUE; show_fill_option = true;
fill_option = ((LibDrawPolyline*)CurrentItem)->m_Fill;
m_GraphicShapeWidthCtrl->SetValue(((LibDrawPolyline*)CurrentItem)->m_Width);
break;
default: break; default:
break;
} }
if ( show_fill_option ) m_Filled->SetSelection(fill_option); m_GraphicShapeWidthCtrl->SetValue( CurrentItem->GetWidth() );
else m_Filled->Enable(false); }
if ( show_fill_option )
m_Filled->SetSelection( fill_option );
else
m_Filled->Enable( false );
} }
/*! /*!
* WinEDA_bodygraphics_PropertiesFrame creator * WinEDA_bodygraphics_PropertiesFrame creator
*/ */
bool WinEDA_bodygraphics_PropertiesFrame::Create( wxWindow* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) bool WinEDA_bodygraphics_PropertiesFrame::Create( wxWindow* parent,
wxWindowID id,
const wxString& caption,
const wxPoint& pos,
const wxSize& size,
long style )
{ {
////@begin WinEDA_bodygraphics_PropertiesFrame member initialisation ////@begin WinEDA_bodygraphics_PropertiesFrame member initialisation
m_CommonUnit = NULL; m_CommonUnit = NULL;

View File

@ -1,136 +0,0 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_create_component.h
// Purpose:
// Author:
// Modified by:
// Created: 01/14/06 10:14:28
// RCS-ID:
// Copyright:
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 01/14/06 10:14:28
#ifndef _DIALOG_CREATE_COMPONENT_H_
#define _DIALOG_CREATE_COMPONENT_H_
#if defined(__GNUG__) && !defined(__APPLE__)
#pragma interface "dialog_create_component.cpp"
#endif
/*!
* Includes
*/
////@begin includes
#include "wx/statline.h"
#include "wx/spinctrl.h"
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations
class wxSpinCtrl;
////@end forward declarations
/*!
* Control identifiers
*/
////@begin control identifiers
#define ID_DIALOG 10000
#define ID_TEXTCTRL1 10009
#define ID_TEXTCTRL 10008
#define ID_CHECKBOX3 10005
#define ID_CHECKBOX4 10006
#define ID_CHECKBOX2 10004
#define ID_RADIOBOX 10003
#define ID_CHECKBOX1 10002
#define ID_CHECKBOX5 10007
#define ID_CHECKBOX 10001
#define ID_SPINCTRL 10010
#define SYMBOL_WINEDA_CREATECMPDIALOG_STYLE wxCAPTION|wxSYSTEM_MENU|wxCLOSE_BOX|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_CREATECMPDIALOG_TITLE _("Component Creation")
#define SYMBOL_WINEDA_CREATECMPDIALOG_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_CREATECMPDIALOG_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_CREATECMPDIALOG_POSITION wxDefaultPosition
////@end control identifiers
/*!
* Compatibility
*/
#ifndef wxCLOSE_BOX
#define wxCLOSE_BOX 0x1000
#endif
#ifndef wxFIXED_MINSIZE
#define wxFIXED_MINSIZE 0
#endif
/*!
* WinEDA_CreateCmpDialog class declaration
*/
class WinEDA_CreateCmpDialog: public wxDialog
{
DECLARE_DYNAMIC_CLASS( WinEDA_CreateCmpDialog )
DECLARE_EVENT_TABLE()
public:
/// Constructors
WinEDA_CreateCmpDialog( );
WinEDA_CreateCmpDialog( WinEDA_DrawFrame* parent, wxWindowID id = SYMBOL_WINEDA_CREATECMPDIALOG_IDNAME, const wxString& caption = SYMBOL_WINEDA_CREATECMPDIALOG_TITLE, const wxPoint& pos = SYMBOL_WINEDA_CREATECMPDIALOG_POSITION, const wxSize& size = SYMBOL_WINEDA_CREATECMPDIALOG_SIZE, long style = SYMBOL_WINEDA_CREATECMPDIALOG_STYLE );
/// Creation
bool Create( WinEDA_DrawFrame* parent, wxWindowID id = SYMBOL_WINEDA_CREATECMPDIALOG_IDNAME, const wxString& caption = SYMBOL_WINEDA_CREATECMPDIALOG_TITLE, const wxPoint& pos = SYMBOL_WINEDA_CREATECMPDIALOG_POSITION, const wxSize& size = SYMBOL_WINEDA_CREATECMPDIALOG_SIZE, long style = SYMBOL_WINEDA_CREATECMPDIALOG_STYLE );
/// Creates the controls and sizers
void CreateControls();
// others functions:
wxString ReturnCmpName()
{
return m_CmpName->GetValue();
}
void SetComponentData( LIB_COMPONENT & component );
////@begin WinEDA_CreateCmpDialog event handler declarations
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void OnOkClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void OnCancelClick( wxCommandEvent& event );
////@end WinEDA_CreateCmpDialog event handler declarations
////@begin WinEDA_CreateCmpDialog member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end WinEDA_CreateCmpDialog member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
////@begin WinEDA_CreateCmpDialog member variables
wxTextCtrl* m_CmpName;
wxTextCtrl* m_Reference;
wxCheckBox* m_AsConvert;
wxCheckBox* m_IsPowerSymbol;
wxCheckBox* m_PartsAreLocked;
wxButton* m_btClose;
wxRadioBox* m_PartsCount;
wxCheckBox* m_ShowPinNum;
wxCheckBox* m_ShowPinname;
wxCheckBox* m_PinNameInside;
wxSpinCtrl* m_SetSkew;
////@end WinEDA_CreateCmpDialog member variables
};
#endif
// _DIALOG_CREATE_COMPONENT_H_

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +0,0 @@
#ifndef APSTUDIO_INVOKED
#include "wx/msw/wx.rc"
#endif

View File

@ -32,8 +32,8 @@ private:
LIB_COMPONENT* m_LibEntry; LIB_COMPONENT* m_LibEntry;
bool m_skipCopyFromPanel; bool m_skipCopyFromPanel;
/// a copy of the edited component's LibDrawFields /// a copy of the edited component's LIB_FIELDs
std::vector <LibDrawField> m_FieldsBuf; std::vector <LIB_FIELD> m_FieldsBuf;
public: public:
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB( WinEDA_LibeditFrame* aParent, DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB( WinEDA_LibeditFrame* aParent,
@ -79,7 +79,7 @@ private:
* bad data into a field, and this value can be used to deny a row change. * bad data into a field, and this value can be used to deny a row change.
*/ */
bool copyPanelToSelectedField(); bool copyPanelToSelectedField();
void setRowItem( int aFieldNdx, const LibDrawField& aField ); void setRowItem( int aFieldNdx, const LIB_FIELD& aField );
/** Function updateDisplay /** Function updateDisplay
* update the listbox showing fields, according to the fields texts * update the listbox showing fields, according to the fields texts
@ -283,7 +283,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::addFieldButtonHandler( wxCommandEvent&
unsigned fieldNdx = m_FieldsBuf.size(); unsigned fieldNdx = m_FieldsBuf.size();
LibDrawField blank( fieldNdx ); LIB_FIELD blank( fieldNdx );
m_FieldsBuf.push_back( blank ); m_FieldsBuf.push_back( blank );
m_FieldsBuf[fieldNdx].m_Name = ReturnDefaultFieldName(fieldNdx); m_FieldsBuf[fieldNdx].m_Name = ReturnDefaultFieldName(fieldNdx);
@ -362,7 +362,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB:: moveUpButtonHandler( wxCommandEvent& e
// swap the fieldNdx field with the one before it, in both the vector // swap the fieldNdx field with the one before it, in both the vector
// and in the fieldListCtrl // and in the fieldListCtrl
LibDrawField tmp = m_FieldsBuf[fieldNdx - 1]; LIB_FIELD tmp = m_FieldsBuf[fieldNdx - 1];
m_FieldsBuf[fieldNdx - 1] = m_FieldsBuf[fieldNdx]; m_FieldsBuf[fieldNdx - 1] = m_FieldsBuf[fieldNdx];
setRowItem( fieldNdx - 1, m_FieldsBuf[fieldNdx] ); setRowItem( fieldNdx - 1, m_FieldsBuf[fieldNdx] );
@ -407,7 +407,7 @@ int DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::getSelectedFieldNdx()
} }
static bool SortFieldsById(const LibDrawField& item1, const LibDrawField& item2) static bool SortFieldsById(const LIB_FIELD& item1, const LIB_FIELD& item2)
{ {
return item1.m_FieldId < item2.m_FieldId; return item1.m_FieldId < item2.m_FieldId;
} }
@ -423,11 +423,11 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers( void )
m_FieldsBuf.push_back( m_LibEntry->m_Name ); m_FieldsBuf.push_back( m_LibEntry->m_Name );
// Creates a working copy of fields // Creates a working copy of fields
for( LibDrawField* field = m_LibEntry->m_Fields; field != NULL; field = field->Next() ) for( LIB_FIELD* field = m_LibEntry->m_Fields; field != NULL; field = field->Next() )
m_FieldsBuf.push_back( *field ); m_FieldsBuf.push_back( *field );
// Display 12 fields (or more), and add missing fields // Display 12 fields (or more), and add missing fields
LibDrawField blank( 2 ); LIB_FIELD blank( 2 );
unsigned fcount = m_FieldsBuf.size(); unsigned fcount = m_FieldsBuf.size();
for( unsigned ii = 2; ii < NUMBER_OF_FIELDS; ii++ ) for( unsigned ii = 2; ii < NUMBER_OF_FIELDS; ii++ )
{ {
@ -470,7 +470,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers( void )
/***********************************************************************************************/ /***********************************************************************************************/
void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::setRowItem( int aFieldNdx, const LibDrawField& aField ) void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::setRowItem( int aFieldNdx, const LIB_FIELD& aField )
/***********************************************************************************************/ /***********************************************************************************************/
{ {
wxASSERT( aFieldNdx >= 0 ); wxASSERT( aFieldNdx >= 0 );
@ -503,7 +503,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
return; return;
LibDrawField& field = m_FieldsBuf[fieldNdx]; LIB_FIELD& field = m_FieldsBuf[fieldNdx];
showCheckBox->SetValue( !(field.m_Attributs & TEXT_NO_VISIBLE) ); showCheckBox->SetValue( !(field.m_Attributs & TEXT_NO_VISIBLE) );
@ -584,7 +584,7 @@ bool DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copyPanelToSelectedField()
if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
return true; return true;
LibDrawField& field = m_FieldsBuf[fieldNdx]; LIB_FIELD& field = m_FieldsBuf[fieldNdx];
if( showCheckBox->GetValue() ) if( showCheckBox->GetValue() )
field.m_Attributs &= ~TEXT_NO_VISIBLE; field.m_Attributs &= ~TEXT_NO_VISIBLE;

View File

@ -0,0 +1,7 @@
#include "dialog_lib_new_component.h"
DIALOG_LIB_NEW_COMPONENT::DIALOG_LIB_NEW_COMPONENT( wxWindow* parent ) :
DIALOG_LIB_NEW_COMPONENT_BASE( parent )
{
SetDefaultItem( m_sdbSizerOK );
}

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,67 @@
#ifndef __dialog_lib_new_component__
#define __dialog_lib_new_component__
/**
@file
Subclass of DIALOG_LIB_NEW_COMPONENT, which is generated by wxFormBuilder.
*/
#include "dialog_lib_new_component_base.h"
/** Implementing DIALOG_LIB_NEW_COMPONENT */
class DIALOG_LIB_NEW_COMPONENT : public DIALOG_LIB_NEW_COMPONENT_BASE
{
public:
/** Constructor */
DIALOG_LIB_NEW_COMPONENT( wxWindow* parent );
void SetName( const wxString& name ) { m_textName->SetValue( name ); }
wxString GetName( void ) { return m_textName->GetValue(); }
void SetReference( const wxString& reference )
{
m_textReference->SetValue( reference );
}
wxString GetReference( void ) { return m_textReference->GetValue(); }
void SetPartCount( int count ) { m_spinPartCount->SetValue( count ); }
int GetPartCount( void ) { return m_spinPartCount->GetValue(); }
void SetAlternateBodyStyle( bool enable )
{
m_checkHasConversion->SetValue( enable );
}
bool GetAlternateBodyStyle( void )
{
return m_checkHasConversion->GetValue();
}
void SetPowerSymbol( bool enable )
{
m_checkIsPowerSymbol->SetValue( enable );
}
bool GetPowerSymbol( void ) { return m_checkIsPowerSymbol->GetValue(); }
void SetLockItems( bool enable ) { m_checkLockItems->SetValue( enable ); }
bool GetLockItems( void ) { return m_checkLockItems->GetValue(); }
void SetPinTextPosition( int position )
{
m_spinPinTextPosition->SetValue( position );
}
int GetPinTextPosition( void ) { return m_spinPinTextPosition->GetValue(); }
void SetShowPinNumber( bool show )
{
m_checkShowPinNumber->SetValue( show );
}
bool GetShowPinNumber( void ) { return m_checkShowPinNumber->GetValue(); }
void SetShowPinName( bool show )
{
m_checkShowPinName->SetValue( show );
}
bool GetShowPinName( void ) { return m_checkShowPinName->GetValue(); }
};
#endif // __dialog_lib_new_component__

View File

@ -0,0 +1,206 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_lib_new_component_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_LIB_NEW_COMPONENT_BASE::DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : wxDialog( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* mainSizer;
mainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bSizer5;
bSizer5 = new wxBoxSizer( wxVERTICAL );
m_staticText6 = new wxStaticText( this, wxID_ANY, _("General Settings"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText6->Wrap( -1 );
m_staticText6->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
bSizer5->Add( m_staticText6, 0, wxALIGN_LEFT, 3 );
wxBoxSizer* bSizer2;
bSizer2 = new wxBoxSizer( wxHORIZONTAL );
bSizer2->Add( 12, 0, 0, wxEXPAND, 3 );
m_staticText2 = new wxStaticText( this, wxID_ANY, _("Component &name:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText2->Wrap( -1 );
bSizer2->Add( m_staticText2, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer2->Add( 0, 0, 1, wxEXPAND, 3 );
m_textName = new wxTextCtrl( this, wxID_ANY, wxEmptyString, wxDefaultPosition, wxSize( 100,-1 ), 0 );
bSizer2->Add( m_textName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer2->Add( 30, 0, 0, wxEXPAND, 3 );
bSizer5->Add( bSizer2, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer3;
bSizer3 = new wxBoxSizer( wxHORIZONTAL );
bSizer3->Add( 12, 0, 0, wxEXPAND, 3 );
m_staticText3 = new wxStaticText( this, wxID_ANY, _("Default &reference designator:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText3->Wrap( -1 );
bSizer3->Add( m_staticText3, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer3->Add( 0, 0, 1, wxEXPAND, 5 );
m_textReference = new wxTextCtrl( this, wxID_ANY, _("U"), wxDefaultPosition, wxSize( 100,-1 ), 0 );
bSizer3->Add( m_textReference, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer3->Add( 30, 0, 0, wxEXPAND, 5 );
bSizer5->Add( bSizer3, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer4;
bSizer4 = new wxBoxSizer( wxHORIZONTAL );
bSizer4->Add( 12, 0, 0, wxEXPAND, 3 );
m_staticText4 = new wxStaticText( this, wxID_ANY, _("Number of &parts per package:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText4->Wrap( -1 );
bSizer4->Add( m_staticText4, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer4->Add( 0, 0, 1, wxEXPAND, 3 );
m_spinPartCount = new wxSpinCtrl( this, wxID_ANY, wxT("1"), wxDefaultPosition, wxSize( 100,-1 ), wxSP_ARROW_KEYS, 1, 40, 0 );
bSizer4->Add( m_spinPartCount, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer4->Add( 30, 0, 0, wxEXPAND, 3 );
bSizer5->Add( bSizer4, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer7;
bSizer7 = new wxBoxSizer( wxHORIZONTAL );
bSizer7->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkHasConversion = new wxCheckBox( this, wxID_ANY, _("Create component with &alternate body style (DeMorgan)"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer7->Add( m_checkHasConversion, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer7, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer8;
bSizer8 = new wxBoxSizer( wxHORIZONTAL );
bSizer8->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkIsPowerSymbol = new wxCheckBox( this, wxID_ANY, _("Create component as power &symbol"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer8->Add( m_checkIsPowerSymbol, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer8, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer9;
bSizer9 = new wxBoxSizer( wxHORIZONTAL );
bSizer9->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkLockItems = new wxCheckBox( this, wxID_ANY, _("Prevent drawing items from being &moved"), wxDefaultPosition, wxDefaultSize, 0 );
bSizer9->Add( m_checkLockItems, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer9, 0, wxALL|wxEXPAND, 0 );
bSizer5->Add( 0, 0, 0, wxALL|wxEXPAND, 10 );
m_staticText7 = new wxStaticText( this, wxID_ANY, _("Global Pin Settings"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText7->Wrap( -1 );
m_staticText7->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), 70, 90, 92, false, wxEmptyString ) );
bSizer5->Add( m_staticText7, 0, wxALIGN_LEFT|wxBOTTOM, 3 );
wxBoxSizer* bSizer6;
bSizer6 = new wxBoxSizer( wxHORIZONTAL );
bSizer6->Add( 12, 0, 0, wxEXPAND, 3 );
m_staticText41 = new wxStaticText( this, wxID_ANY, _("Pin text position &offset:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticText41->Wrap( -1 );
bSizer6->Add( m_staticText41, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer6->Add( 0, 0, 1, wxEXPAND, 3 );
m_spinPinTextPosition = new wxSpinCtrl( this, wxID_ANY, wxT("40"), wxDefaultPosition, wxSize( 100,-1 ), wxSP_ARROW_KEYS, 0, 10000, 40 );
bSizer6->Add( m_spinPinTextPosition, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
m_staticText5 = new wxStaticText( this, wxID_ANY, _("mils"), wxDefaultPosition, wxSize( 30,-1 ), 0 );
m_staticText5->Wrap( -1 );
bSizer6->Add( m_staticText5, 0, wxALIGN_CENTER_VERTICAL, 3 );
bSizer5->Add( bSizer6, 1, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer10;
bSizer10 = new wxBoxSizer( wxHORIZONTAL );
bSizer10->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkShowPinNumber = new wxCheckBox( this, wxID_ANY, _("Show pin n&umber text"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShowPinNumber->SetValue(true);
bSizer10->Add( m_checkShowPinNumber, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer10, 0, wxALL|wxEXPAND, 0 );
wxBoxSizer* bSizer12;
bSizer12 = new wxBoxSizer( wxHORIZONTAL );
bSizer12->Add( 12, 0, 0, wxEXPAND, 3 );
m_checkShowPinName = new wxCheckBox( this, wxID_ANY, _("Show pin name te&xt"), wxDefaultPosition, wxDefaultSize, 0 );
m_checkShowPinName->SetValue(true);
bSizer12->Add( m_checkShowPinName, 0, wxALIGN_CENTER_VERTICAL|wxALL, 3 );
bSizer5->Add( bSizer12, 0, wxALL|wxEXPAND, 0 );
bSizer5->Add( 0, 5, 0, wxALL|wxEXPAND, 10 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bSizer5->Add( m_sdbSizer, 0, wxALL|wxEXPAND, 0 );
mainSizer->Add( bSizer5, 1, wxALL|wxEXPAND, 12 );
this->SetSizer( mainSizer );
this->Layout();
mainSizer->Fit( this );
this->Centre( wxBOTH );
}
DIALOG_LIB_NEW_COMPONENT_BASE::~DIALOG_LIB_NEW_COMPONENT_BASE()
{
}

View File

@ -0,0 +1,80 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_lib_new_component_base__
#define __dialog_lib_new_component_base__
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/stattext.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/textctrl.h>
#include <wx/sizer.h>
#include <wx/spinctrl.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_LIB_NEW_COMPONENT_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_LIB_NEW_COMPONENT_BASE : public wxDialog
{
private:
protected:
wxStaticText* m_staticText6;
wxStaticText* m_staticText2;
wxTextCtrl* m_textName;
wxStaticText* m_staticText3;
wxTextCtrl* m_textReference;
wxStaticText* m_staticText4;
wxSpinCtrl* m_spinPartCount;
wxCheckBox* m_checkHasConversion;
wxCheckBox* m_checkIsPowerSymbol;
wxCheckBox* m_checkLockItems;
wxStaticText* m_staticText7;
wxStaticText* m_staticText41;
wxSpinCtrl* m_spinPinTextPosition;
wxStaticText* m_staticText5;
wxCheckBox* m_checkShowPinNumber;
wxCheckBox* m_checkShowPinName;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
public:
DIALOG_LIB_NEW_COMPONENT_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Component Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxDefaultSize, long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_LIB_NEW_COMPONENT_BASE();
};
#endif //__dialog_lib_new_component_base__

View File

@ -25,10 +25,11 @@ class Dialog_BodyGraphicText_Properties : public Dialog_BodyGraphicText_Properti
{ {
private: private:
WinEDA_LibeditFrame * m_Parent; WinEDA_LibeditFrame * m_Parent;
LibDrawText * m_GraphicText; LIB_TEXT* m_GraphicText;
public: public:
Dialog_BodyGraphicText_Properties( WinEDA_LibeditFrame* aParent, LibDrawText * aGraphicText); Dialog_BodyGraphicText_Properties( WinEDA_LibeditFrame* aParent,
LIB_TEXT* aGraphicText );
~Dialog_BodyGraphicText_Properties() {}; ~Dialog_BodyGraphicText_Properties() {};
private: private:
@ -38,8 +39,9 @@ private:
}; };
Dialog_BodyGraphicText_Properties::Dialog_BodyGraphicText_Properties( WinEDA_LibeditFrame* aParent, LibDrawText * aGraphicText) : Dialog_BodyGraphicText_Properties::Dialog_BodyGraphicText_Properties( WinEDA_LibeditFrame* aParent,
Dialog_BodyGraphicText_Properties_base(aParent) LIB_TEXT* aGraphicText ) :
Dialog_BodyGraphicText_Properties_base( aParent )
{ {
m_Parent = aParent; m_Parent = aParent;
m_GraphicText = aGraphicText; m_GraphicText = aGraphicText;
@ -239,7 +241,7 @@ void WinEDA_LibeditFrame::EditSymbolText(wxDC* DC, LIB_DRAW_ITEM* DrawItem)
Dialog_BodyGraphicText_Properties * frame = Dialog_BodyGraphicText_Properties * frame =
new Dialog_BodyGraphicText_Properties( this, new Dialog_BodyGraphicText_Properties( this,
(LibDrawText *) DrawItem ); (LIB_TEXT*) DrawItem );
frame->ShowModal(); frame->ShowModal();
frame->Destroy(); frame->Destroy();
GetScreen()->SetModify(); GetScreen()->SetModify();
@ -263,7 +265,7 @@ void WinEDA_LibeditFrame::RotateSymbolText(wxDC * DC)
90 deg Graphic text Rotation . 90 deg Graphic text Rotation .
*/ */
{ {
LibDrawText * DrawItem = (LibDrawText *) m_drawItem; LIB_TEXT* DrawItem = (LIB_TEXT *) m_drawItem;
if( DrawItem == NULL ) if( DrawItem == NULL )
return; return;

View File

@ -82,7 +82,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem(
bool DoCenterAndRedraw = FALSE; bool DoCenterAndRedraw = FALSE;
bool NotFound = true; bool NotFound = true;
wxString msg; wxString msg;
LibDrawPin* pin; LIB_PIN* pin;
EDA_SheetList SheetList; EDA_SheetList SheetList;

View File

@ -203,7 +203,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
Component->m_PrefixString = Entry->m_Prefix.m_Text; Component->m_PrefixString = Entry->m_Prefix.m_Text;
/* Init des autres champs si predefinis dans la librairie */ /* Init des autres champs si predefinis dans la librairie */
LibDrawField* EntryField; LIB_FIELD* EntryField;
for( EntryField = Entry->m_Fields; EntryField != NULL; for( EntryField = Entry->m_Fields; EntryField != NULL;
EntryField = EntryField->Next() ) EntryField = EntryField->Next() )
{ {

View File

@ -554,7 +554,7 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
if( m_lastDrawItem && (m_lastDrawItem->m_Flags == 0) if( m_lastDrawItem && (m_lastDrawItem->m_Flags == 0)
&& (m_lastDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE) ) && (m_lastDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE) )
{ {
RepeatPinItem( DC, (LibDrawPin*) m_lastDrawItem ); RepeatPinItem( DC, (LIB_PIN*) m_lastDrawItem );
} }
else else
wxBell(); wxBell();

View File

@ -21,10 +21,10 @@
#include "libeditfrm.h" #include "libeditfrm.h"
#include "class_library.h" #include "class_library.h"
#include "dialog_create_component.h" #include "dialog_lib_new_component.h"
/* Affiche dans la zone messages la librairie , et le composant edite */ /* Update the main window title bar with the current library name. */
void WinEDA_LibeditFrame::DisplayLibInfos() void WinEDA_LibeditFrame::DisplayLibInfos()
{ {
wxString msg = _( "Component Library Editor: " ); wxString msg = _( "Component Library Editor: " );
@ -490,9 +490,7 @@ All changes will be lost. Discard changes?" ) ) )
*/ */
void WinEDA_LibeditFrame::CreateNewLibraryPart( wxCommandEvent& event ) void WinEDA_LibeditFrame::CreateNewLibraryPart( wxCommandEvent& event )
{ {
int diag; wxString name;
wxString msg;
LIB_COMPONENT* NewStruct;
if( m_component && GetScreen()->IsModify() if( m_component && GetScreen()->IsModify()
&& !IsOK( this, _( "All changes to the current component will be \ && !IsOK( this, _( "All changes to the current component will be \
@ -503,43 +501,43 @@ lost!\n\nClear the current component from the screen?" ) ) )
m_drawItem = NULL; m_drawItem = NULL;
WinEDA_CreateCmpDialog Dialogbox( this ); DIALOG_LIB_NEW_COMPONENT dlg( this );
diag = Dialogbox.ShowModal(); if( dlg.ShowModal() == wxID_CANCEL )
if( diag != wxID_OK )
return; return;
msg = Dialogbox.ReturnCmpName();
if( msg.IsEmpty() ) if( dlg.GetName().IsEmpty() )
return; return;
msg.MakeUpper();
msg.Replace( wxT( " " ), wxT( "_" ) ); name = dlg.GetName().MakeUpper();
name.Replace( wxT( " " ), wxT( "_" ) );
/* Test: y a t-il un composant deja de ce nom */ /* Test: y a t-il un composant deja de ce nom */
if( m_library ) if( m_library && m_library->FindEntry( name ) )
{
if( m_library->FindEntry( msg ) )
{ {
wxString msg; wxString msg;
msg.Printf( _( "Component \"%s\" already exists in \ msg.Printf( _( "Component \"%s\" already exists in library \"%s\"." ),
library \"%s\"." ), (const wxChar*) name,
(const wxChar*) Dialogbox.ReturnCmpName(),
(const wxChar*) m_library->GetName() ); (const wxChar*) m_library->GetName() );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
}
NewStruct = new LIB_COMPONENT( msg ); LIB_COMPONENT* component = new LIB_COMPONENT( name );
Dialogbox.SetComponentData( *NewStruct ); component->m_Prefix.m_Text = dlg.GetReference();
if( NewStruct->m_Prefix.m_Text.IsEmpty() ) component->SetPartCount( dlg.GetPartCount() );
NewStruct->m_Prefix.m_Text = wxT( "U" ); component->SetConversion( dlg.GetAlternateBodyStyle() );
NewStruct->m_Prefix.m_Text.MakeUpper(); component->m_TextInside = dlg.GetPinTextPosition();
component->m_Options = ( dlg.GetPowerSymbol() ) ? ENTRY_POWER :
ENTRY_NORMAL;
component->m_DrawPinNum = dlg.GetShowPinNumber();
component->m_DrawPinName = dlg.GetShowPinName();
// Effacement ancien composant affich<63>
if( m_component ) if( m_component )
{ {
SAFE_DELETE( m_component ); SAFE_DELETE( m_component );
} }
m_component = NewStruct;
m_component = component;
m_unit = 1; m_unit = 1;
m_convert = 1; m_convert = 1;
DisplayLibInfos(); DisplayLibInfos();
@ -549,6 +547,7 @@ library \"%s\"." ),
g_EditPinByPinIsOn = false; g_EditPinByPinIsOn = false;
m_lastDrawItem = NULL; m_lastDrawItem = NULL;
GetScreen()->ClearUndoRedoList(); GetScreen()->ClearUndoRedoList();
GetScreen()->SetModify();
DrawPanel->Refresh(); DrawPanel->Refresh();
} }

View File

@ -39,7 +39,7 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break; break;
case COMPONENT_FIELD_DRAW_TYPE: case COMPONENT_FIELD_DRAW_TYPE:
PlaceField( DC, (LibDrawField*) DrawEntry ); PlaceField( DC, (LIB_FIELD*) DrawEntry );
DrawEntry = NULL; DrawEntry = NULL;
break; break;
@ -126,7 +126,7 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DisplayCmpDoc(); DisplayCmpDoc();
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
if( DrawEntry->Type() == COMPONENT_PIN_DRAW_TYPE ) if( DrawEntry->Type() == COMPONENT_PIN_DRAW_TYPE )
DeletePin( DC, m_component, (LibDrawPin*) DrawEntry ); DeletePin( DC, m_component, (LIB_PIN*) DrawEntry );
else else
m_component->RemoveDrawItem( DrawEntry, DrawPanel, DC ); m_component->RemoveDrawItem( DrawEntry, DrawPanel, DC );
DrawEntry = NULL; DrawEntry = NULL;
@ -229,7 +229,7 @@ void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
case COMPONENT_FIELD_DRAW_TYPE: case COMPONENT_FIELD_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 ) if( DrawEntry->m_Flags == 0 )
{ {
EditField( DC, (LibDrawField*) DrawEntry ); EditField( DC, (LIB_FIELD*) DrawEntry );
} }
break; break;

View File

@ -22,7 +22,7 @@
/* functions to add commands and submenus depending on the item */ /* functions to add commands and submenus depending on the item */
static void AddMenusForBlock( wxMenu* PopMenu, WinEDA_LibeditFrame* frame ); static void AddMenusForBlock( wxMenu* PopMenu, WinEDA_LibeditFrame* frame );
static void AddMenusForPin( wxMenu* PopMenu, LibDrawPin* Pin, static void AddMenusForPin( wxMenu* PopMenu, LIB_PIN* Pin,
WinEDA_LibeditFrame* frame ); WinEDA_LibeditFrame* frame );
@ -74,7 +74,7 @@ bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos,
switch( DrawEntry->Type() ) switch( DrawEntry->Type() )
{ {
case COMPONENT_PIN_DRAW_TYPE: case COMPONENT_PIN_DRAW_TYPE:
AddMenusForPin( PopMenu, (LibDrawPin*) DrawEntry, this ); AddMenusForPin( PopMenu, (LIB_PIN*) DrawEntry, this );
break; break;
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
@ -179,7 +179,7 @@ bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos,
} }
else if( (DrawEntry->m_Flags & IS_NEW) ) else if( (DrawEntry->m_Flags & IS_NEW) )
{ {
if( ( (LibDrawPolyline*) DrawEntry )->GetCornerCount() > 2 ) if( ( (LIB_POLYLINE*) DrawEntry )->GetCornerCount() > 2 )
{ {
msg = AddHotkeyName( _( "Delete Segment " ), msg = AddHotkeyName( _( "Delete Segment " ),
s_Libedit_Hokeys_Descr, HK_DELETE_PIN ); s_Libedit_Hokeys_Descr, HK_DELETE_PIN );
@ -221,7 +221,7 @@ StructType %d" ),
void AddMenusForPin( wxMenu* PopMenu, void AddMenusForPin( wxMenu* PopMenu,
LibDrawPin* Pin, LIB_PIN* Pin,
WinEDA_LibeditFrame* frame ) WinEDA_LibeditFrame* frame )
{ {
bool selected = (Pin->m_Selected & IS_SELECTED) != 0; bool selected = (Pin->m_Selected & IS_SELECTED) != 0;

View File

@ -142,7 +142,7 @@ private:
void CreatePin( wxDC* DC ); void CreatePin( wxDC* DC );
void DeletePin( wxDC* DC, void DeletePin( wxDC* DC,
LIB_COMPONENT* LibEntry, LIB_COMPONENT* LibEntry,
LibDrawPin* Pin ); LIB_PIN* Pin );
void StartMovePin( wxDC* DC ); void StartMovePin( wxDC* DC );
// Edition de l'ancre // Edition de l'ancre
@ -161,10 +161,10 @@ private:
void RotateSymbolText( wxDC* DC ); void RotateSymbolText( wxDC* DC );
void DeleteDrawPoly( wxDC* DC ); void DeleteDrawPoly( wxDC* DC );
LIB_DRAW_ITEM* LocateItemUsingCursor(); LIB_DRAW_ITEM* LocateItemUsingCursor();
void RotateField( wxDC* DC, LibDrawField* Field ); void RotateField( wxDC* DC, LIB_FIELD* Field );
void PlaceField( wxDC* DC, LibDrawField* Field ); void PlaceField( wxDC* DC, LIB_FIELD* Field );
void EditField( wxDC* DC, LibDrawField* Field ); void EditField( wxDC* DC, LIB_FIELD* Field );
void StartMoveField( wxDC* DC, LibDrawField* field ); void StartMoveField( wxDC* DC, LIB_FIELD* field );
public: public:
/* Block commands: */ /* Block commands: */
@ -174,10 +174,10 @@ public:
void PlacePin( wxDC* DC ); void PlacePin( wxDC* DC );
void InitEditOnePin(); void InitEditOnePin();
void GlobalSetPins( wxDC* DC, LibDrawPin* MasterPin, int id ); void GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id );
// Repetition automatique de placement de pins // Repetition automatique de placement de pins
void RepeatPinItem( wxDC* DC, LibDrawPin* Pin ); void RepeatPinItem( wxDC* DC, LIB_PIN* Pin );
protected: protected:
wxString m_ConfigPath; wxString m_ConfigPath;

View File

@ -52,7 +52,7 @@ static void ExitMoveField( WinEDA_DrawPanel* Panel, wxDC* DC )
/* /*
* Initialise le deplacement d'un champ ( ref ou Name ) * Initialise le deplacement d'un champ ( ref ou Name )
*/ */
void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LibDrawField* field ) void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LIB_FIELD* field )
{ {
wxPoint startPos; wxPoint startPos;
@ -89,7 +89,7 @@ static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if( parent == NULL ) if( parent == NULL )
return; return;
LibDrawField* Field = (LibDrawField*) parent->GetDrawItem(); LIB_FIELD* Field = (LIB_FIELD*) parent->GetDrawItem();
if( Field == NULL ) if( Field == NULL )
return; return;
@ -109,7 +109,7 @@ static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
} }
void WinEDA_LibeditFrame::PlaceField( wxDC* DC, LibDrawField* Field ) void WinEDA_LibeditFrame::PlaceField( wxDC* DC, LIB_FIELD* Field )
{ {
if( Field == NULL ) if( Field == NULL )
return; return;
@ -132,7 +132,7 @@ void WinEDA_LibeditFrame::PlaceField( wxDC* DC, LibDrawField* Field )
} }
void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field ) void WinEDA_LibeditFrame::EditField( wxDC* DC, LIB_FIELD* Field )
{ {
wxString Text; wxString Text;
wxString title; wxString title;
@ -230,7 +230,7 @@ not conflict with any library entries." ),
* si un champ est en cours d'edition, modif de celui ci. * si un champ est en cours d'edition, modif de celui ci.
* sinon Modif du champ pointe par la souris * sinon Modif du champ pointe par la souris
*/ */
void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field ) void WinEDA_LibeditFrame::RotateField( wxDC* DC, LIB_FIELD* Field )
{ {
if( Field == NULL ) if( Field == NULL )

View File

@ -739,7 +739,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
if( m_drawItem->Type() == COMPONENT_PIN_DRAW_TYPE ) if( m_drawItem->Type() == COMPONENT_PIN_DRAW_TYPE )
{ {
DeletePin( &dc, m_component, (LibDrawPin*) m_drawItem ); DeletePin( &dc, m_component, (LIB_PIN*) m_drawItem );
} }
else else
{ {
@ -761,7 +761,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
if( m_drawItem->Type() == COMPONENT_PIN_DRAW_TYPE ) if( m_drawItem->Type() == COMPONENT_PIN_DRAW_TYPE )
StartMovePin( &dc ); StartMovePin( &dc );
else if( m_drawItem->Type() == COMPONENT_FIELD_DRAW_TYPE ) else if( m_drawItem->Type() == COMPONENT_FIELD_DRAW_TYPE )
StartMoveField( &dc, (LibDrawField*) m_drawItem ); StartMoveField( &dc, (LIB_FIELD*) m_drawItem );
else else
StartMoveDrawSymbol( &dc ); StartMoveDrawSymbol( &dc );
break; break;
@ -785,7 +785,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
if( m_drawItem->Type() == COMPONENT_FIELD_DRAW_TYPE ) if( m_drawItem->Type() == COMPONENT_FIELD_DRAW_TYPE )
{ {
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
RotateField( &dc, (LibDrawField*) m_drawItem ); RotateField( &dc, (LIB_FIELD*) m_drawItem );
} }
DrawPanel->CursorOn( &dc ); DrawPanel->CursorOn( &dc );
break; break;
@ -796,7 +796,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->CursorOff( &dc ); DrawPanel->CursorOff( &dc );
if( m_drawItem->Type() == COMPONENT_FIELD_DRAW_TYPE ) if( m_drawItem->Type() == COMPONENT_FIELD_DRAW_TYPE )
{ {
EditField( &dc, (LibDrawField*) m_drawItem ); EditField( &dc, (LIB_FIELD*) m_drawItem );
} }
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOn( &dc ); DrawPanel->CursorOn( &dc );
@ -809,7 +809,7 @@ void WinEDA_LibeditFrame::Process_Special_Functions( wxCommandEvent& event )
|| (m_drawItem->Type() != COMPONENT_PIN_DRAW_TYPE) ) || (m_drawItem->Type() != COMPONENT_PIN_DRAW_TYPE) )
break; break;
SaveCopyInUndoList( m_component ); SaveCopyInUndoList( m_component );
GlobalSetPins( &dc, (LibDrawPin*) m_drawItem, id ); GlobalSetPins( &dc, (LIB_PIN*) m_drawItem, id );
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
break; break;

View File

@ -620,11 +620,11 @@ static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
* @param pin_number = pin number (string) * @param pin_number = pin number (string)
* @return a pointer on the pin, or NULL if not found * @return a pointer on the pin, or NULL if not found
*/ */
LibDrawPin* LocatePinByNumber( const wxString& ePin_Number, LIB_PIN* LocatePinByNumber( const wxString& ePin_Number,
SCH_COMPONENT* eComponent ) SCH_COMPONENT* eComponent )
{ {
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
LibDrawPin* Pin; LIB_PIN* Pin;
int Unit, Convert; int Unit, Convert;
Entry = CMP_LIBRARY::FindLibraryComponent( eComponent->m_ChipName ); Entry = CMP_LIBRARY::FindLibraryComponent( eComponent->m_ChipName );
@ -687,13 +687,13 @@ Hierarchical_PIN_Sheet_Struct* LocateSheetLabel( DrawSheetStruct* Sheet,
} }
LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos, LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos,
SCH_COMPONENT** libpart ) SCH_COMPONENT** libpart )
{ {
SCH_ITEM* DrawStruct; SCH_ITEM* DrawStruct;
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
SCH_COMPONENT* schItem = NULL; SCH_COMPONENT* schItem = NULL;
LibDrawPin* Pin = NULL; LIB_PIN* Pin = NULL;
for( DrawStruct = DrawList; DrawStruct != NULL; for( DrawStruct = DrawList; DrawStruct != NULL;
DrawStruct = DrawStruct->Next() ) DrawStruct = DrawStruct->Next() )
@ -705,12 +705,13 @@ LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos,
if( Entry == NULL ) if( Entry == NULL )
continue; continue;
/* we use LocateDrawItem to locate pîns. but this function suppose a component /* we use LocateDrawItem to locate pîns. but this function suppose a
* component.
* at 0,0 location * at 0,0 location
* So we must calculate the ref position relative to the component * So we must calculate the ref position relative to the component
*/ */
wxPoint libPos = RefPos - schItem->m_Pos; wxPoint libPos = RefPos - schItem->m_Pos;
Pin = (LibDrawPin*) Entry->LocateDrawItem( schItem->m_Multi, Pin = (LIB_PIN*) Entry->LocateDrawItem( schItem->m_Multi,
schItem->m_Convert, schItem->m_Convert,
COMPONENT_PIN_DRAW_TYPE, COMPONENT_PIN_DRAW_TYPE,
libPos, schItem->m_Transform ); libPos, schItem->m_Transform );

View File

@ -30,7 +30,7 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList ); static void WriteGENERICListOfNets( FILE* f, NETLIST_OBJECT_LIST& aObjectsList );
static void AddPinToComponentPinList( SCH_COMPONENT* Component, static void AddPinToComponentPinList( SCH_COMPONENT* Component,
DrawSheetPath* sheet, DrawSheetPath* sheet,
LibDrawPin* PinEntry ); LIB_PIN* PinEntry );
static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component, static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component,
LIB_COMPONENT* Entry, LIB_COMPONENT* Entry,
DrawSheetPath* Sheet_in ); DrawSheetPath* Sheet_in );
@ -111,7 +111,7 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList( EDA_BaseStruct* DrawList
{ {
SCH_COMPONENT* Component = NULL; SCH_COMPONENT* Component = NULL;
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
LibDrawPin* Pin; LIB_PIN* Pin;
s_SortedComponentPinList.clear(); s_SortedComponentPinList.clear();
for( ; DrawList != NULL; DrawList = DrawList->Next() ) for( ; DrawList != NULL; DrawList = DrawList->Next() )
@ -672,7 +672,7 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
/*************************************************************************************/ /*************************************************************************************/
static void AddPinToComponentPinList( SCH_COMPONENT* Component, static void AddPinToComponentPinList( SCH_COMPONENT* Component,
DrawSheetPath* sheetlist, LibDrawPin* Pin ) DrawSheetPath* sheetlist, LIB_PIN* Pin )
/*************************************************************************************/ /*************************************************************************************/
/* Add a new pin description in the pin list s_SortedComponentPinList /* Add a new pin description in the pin list s_SortedComponentPinList
@ -769,7 +769,7 @@ static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component_in,
{ {
EDA_BaseStruct* SchItem; EDA_BaseStruct* SchItem;
SCH_COMPONENT* Component2; SCH_COMPONENT* Component2;
LibDrawPin* pin; LIB_PIN* pin;
DrawSheetPath* sheet; DrawSheetPath* sheet;
wxString str, Reference = Component_in->GetRef( Sheet_in ); wxString str, Reference = Component_in->GetRef( Sheet_in );

View File

@ -355,7 +355,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
NETLIST_OBJECT* new_item; NETLIST_OBJECT* new_item;
SCH_COMPONENT* DrawLibItem; SCH_COMPONENT* DrawLibItem;
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
LibDrawPin* pin; LIB_PIN* pin;
Hierarchical_PIN_Sheet_Struct* SheetLabel; Hierarchical_PIN_Sheet_Struct* SheetLabel;
DrawSheetPath list; DrawSheetPath list;

View File

@ -29,7 +29,7 @@ void InstallPineditFrame( WinEDA_LibeditFrame* parent, wxDC* DC,
if ( ( parent->GetDrawItem() == NULL ) if ( ( parent->GetDrawItem() == NULL )
|| ( parent->GetDrawItem()->Type() == COMPONENT_PIN_DRAW_TYPE ) ) || ( parent->GetDrawItem()->Type() == COMPONENT_PIN_DRAW_TYPE ) )
{ {
LibDrawPin * Pin = (LibDrawPin *) parent->GetDrawItem(); LIB_PIN* Pin = (LIB_PIN*) parent->GetDrawItem();
WinEDA_PinPropertiesFrame dlg( parent ); WinEDA_PinPropertiesFrame dlg( parent );
accept = dlg.ShowModal(); accept = dlg.ShowModal();
@ -81,7 +81,7 @@ WinEDA_PinPropertiesFrame::WinEDA_PinPropertiesFrame( )
WinEDA_PinPropertiesFrame::WinEDA_PinPropertiesFrame( WinEDA_LibeditFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) WinEDA_PinPropertiesFrame::WinEDA_PinPropertiesFrame( WinEDA_LibeditFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{ {
LibDrawPin * CurrentPin = (LibDrawPin *) parent->GetDrawItem(); LIB_PIN* CurrentPin = (LIB_PIN*) parent->GetDrawItem();
m_Parent = parent; m_Parent = parent;
if ( CurrentPin ) if ( CurrentPin )
@ -326,7 +326,7 @@ void WinEDA_PinPropertiesFrame::SetValuesInDialog(void)
/*******************************************************/ /*******************************************************/
{ {
wxString number; wxString number;
LibDrawPin * CurrentPin = (LibDrawPin *) m_Parent->GetDrawItem(); LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
wxString msg; wxString msg;
int tmp, ii; int tmp, ii;

View File

@ -34,7 +34,7 @@ int CodeShape[NBSHAPES] =
/* Routines locales */ /* Routines locales */
static void CreateImagePins( LibDrawPin* Pin, int unit, int convert, static void CreateImagePins( LIB_PIN* Pin, int unit, int convert,
bool asDeMorgan ); bool asDeMorgan );
static void AbortPinMove( WinEDA_DrawPanel* Panel, wxDC* DC ); static void AbortPinMove( WinEDA_DrawPanel* Panel, wxDC* DC );
static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
@ -125,8 +125,8 @@ void WinEDA_PinPropertiesFrame::PinPropertiesAccept( wxCommandEvent& event )
*/ */
void WinEDA_LibeditFrame::InitEditOnePin() void WinEDA_LibeditFrame::InitEditOnePin()
{ {
LibDrawPin* Pin; LIB_PIN* Pin;
LibDrawPin* CurrentPin = (LibDrawPin*) m_drawItem; LIB_PIN* CurrentPin = (LIB_PIN*) m_drawItem;
if( m_component == NULL || CurrentPin == NULL if( m_component == NULL || CurrentPin == NULL
|| m_drawItem->Type() != COMPONENT_PIN_DRAW_TYPE ) || m_drawItem->Type() != COMPONENT_PIN_DRAW_TYPE )
@ -160,7 +160,7 @@ static void AbortPinMove( WinEDA_DrawPanel* Panel, wxDC* DC )
if( parent == NULL ) if( parent == NULL )
return; return;
LibDrawPin* CurrentPin = (LibDrawPin*) parent->GetDrawItem(); LIB_PIN* CurrentPin = (LIB_PIN*) parent->GetDrawItem();
if( CurrentPin == NULL || CurrentPin->Type() != COMPONENT_PIN_DRAW_TYPE ) if( CurrentPin == NULL || CurrentPin->Type() != COMPONENT_PIN_DRAW_TYPE )
return; return;
@ -184,8 +184,8 @@ static void AbortPinMove( WinEDA_DrawPanel* Panel, wxDC* DC )
*/ */
void WinEDA_LibeditFrame::PlacePin( wxDC* DC ) void WinEDA_LibeditFrame::PlacePin( wxDC* DC )
{ {
LibDrawPin* Pin; LIB_PIN* Pin;
LibDrawPin* CurrentPin = (LibDrawPin*) m_drawItem; LIB_PIN* CurrentPin = (LIB_PIN*) m_drawItem;
bool ask_for_pin = true; bool ask_for_pin = true;
wxPoint newpos; wxPoint newpos;
bool status; bool status;
@ -254,8 +254,8 @@ another pin. Continue?" ) );
void WinEDA_PinPropertiesFrame::SetPinOrientation( int neworient ) void WinEDA_PinPropertiesFrame::SetPinOrientation( int neworient )
{ {
LibDrawPin* CurrentPin = (LibDrawPin*) m_Parent->GetDrawItem(); LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
LibDrawPin* Pin, * RefPin = CurrentPin; LIB_PIN* Pin, * RefPin = CurrentPin;
if( CurrentPin == NULL || CurrentPin->GetParent() == NULL || RefPin == NULL ) if( CurrentPin == NULL || CurrentPin->GetParent() == NULL || RefPin == NULL )
return; return;
@ -285,8 +285,8 @@ void WinEDA_PinPropertiesFrame::SetPinOrientation( int neworient )
*/ */
void WinEDA_LibeditFrame::StartMovePin( wxDC* DC ) void WinEDA_LibeditFrame::StartMovePin( wxDC* DC )
{ {
LibDrawPin* Pin; LIB_PIN* Pin;
LibDrawPin* CurrentPin = (LibDrawPin*) m_drawItem; LIB_PIN* CurrentPin = (LIB_PIN*) m_drawItem;
wxPoint startPos; wxPoint startPos;
/* Marquage des pins a traiter */ /* Marquage des pins a traiter */
@ -330,7 +330,7 @@ static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if( parent == NULL ) if( parent == NULL )
return; return;
LibDrawPin* CurrentPin = (LibDrawPin*) parent->GetDrawItem(); LIB_PIN* CurrentPin = (LIB_PIN*) parent->GetDrawItem();
if( CurrentPin == NULL || CurrentPin->Type() != COMPONENT_PIN_DRAW_TYPE ) if( CurrentPin == NULL || CurrentPin->Type() != COMPONENT_PIN_DRAW_TYPE )
return; return;
@ -372,8 +372,8 @@ void WinEDA_PinPropertiesFrame::SetPinShape( int newshape )
* des autres unites de la seule forme convert courante * des autres unites de la seule forme convert courante
*/ */
{ {
LibDrawPin* Pin; LIB_PIN* Pin;
LibDrawPin* CurrentPin = (LibDrawPin*) m_Parent->GetDrawItem(); LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
if( CurrentPin ) if( CurrentPin )
{ {
@ -401,8 +401,8 @@ void WinEDA_PinPropertiesFrame::SetPinType( int newtype )
* des autres unites du boitier * des autres unites du boitier
*/ */
{ {
LibDrawPin* Pin; LIB_PIN* Pin;
LibDrawPin* CurrentPin = (LibDrawPin*) m_Parent->GetDrawItem(); LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
if( CurrentPin == NULL || CurrentPin->GetParent() == NULL ) if( CurrentPin == NULL || CurrentPin->GetParent() == NULL )
return; return;
@ -429,8 +429,8 @@ void WinEDA_PinPropertiesFrame::SetPinName( const wxString& newname, int newsize
* si newsize < 0 : pas de changement de taille * si newsize < 0 : pas de changement de taille
*/ */
{ {
LibDrawPin* Pin; LIB_PIN* Pin;
LibDrawPin* CurrentPin = (LibDrawPin*) m_Parent->GetDrawItem(); LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
wxString buf; wxString buf;
if( CurrentPin == NULL || CurrentPin->GetParent() == NULL ) if( CurrentPin == NULL || CurrentPin->GetParent() == NULL )
@ -470,8 +470,8 @@ void WinEDA_PinPropertiesFrame::SetPinNum( const wxString& newnum, int newsize )
* Si newsize < 0 ) pase de changement de taille * Si newsize < 0 ) pase de changement de taille
*/ */
{ {
LibDrawPin* Pin; LIB_PIN* Pin;
LibDrawPin* CurrentPin = (LibDrawPin*) m_Parent->GetDrawItem(); LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
wxString buf; wxString buf;
buf = newnum; buf = newnum;
@ -503,7 +503,7 @@ void WinEDA_PinPropertiesFrame::SetPinNum( const wxString& newnum, int newsize )
/*************************************************/ /*************************************************/
void WinEDA_LibeditFrame::DeletePin( wxDC* DC, void WinEDA_LibeditFrame::DeletePin( wxDC* DC,
LIB_COMPONENT* LibEntry, LIB_COMPONENT* LibEntry,
LibDrawPin* Pin ) LIB_PIN* Pin )
/*************************************************/ /*************************************************/
/* Routine d'effacement de la pin pointee par la souris /* Routine d'effacement de la pin pointee par la souris
@ -512,7 +512,7 @@ void WinEDA_LibeditFrame::DeletePin( wxDC* DC,
* Sinon seule la pin de l'unite en convert courante sera effacee * Sinon seule la pin de l'unite en convert courante sera effacee
*/ */
{ {
LibDrawPin* tmp; LIB_PIN* tmp;
wxPoint PinPos; wxPoint PinPos;
if( LibEntry == NULL || Pin == NULL ) if( LibEntry == NULL || Pin == NULL )
@ -547,7 +547,7 @@ void WinEDA_LibeditFrame::DeletePin( wxDC* DC,
*/ */
void WinEDA_LibeditFrame::CreatePin( wxDC* DC ) void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
{ {
LibDrawPin* CurrentPin; LIB_PIN* CurrentPin;
bool showPinText = true; bool showPinText = true;
if( m_component == NULL ) if( m_component == NULL )
@ -556,7 +556,7 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
/* Effacement des flags */ /* Effacement des flags */
m_component->ClearStatus(); m_component->ClearStatus();
CurrentPin = new LibDrawPin( m_component ); CurrentPin = new LIB_PIN( m_component );
m_drawItem = CurrentPin; m_drawItem = CurrentPin;
@ -626,9 +626,9 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
void WinEDA_PinPropertiesFrame::SetPinAttributes( bool draw, bool unit, void WinEDA_PinPropertiesFrame::SetPinAttributes( bool draw, bool unit,
bool convert ) bool convert )
{ {
LibDrawPin* tmp; LIB_PIN* tmp;
LibDrawPin* Pin; LIB_PIN* Pin;
LibDrawPin* CurrentPin = (LibDrawPin*) m_Parent->GetDrawItem(); LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
if( CurrentPin == NULL ) if( CurrentPin == NULL )
return; return;
@ -729,7 +729,7 @@ void WinEDA_PinPropertiesFrame::NewSizePin( int newsize )
* *
*/ */
{ {
LibDrawPin* RefPin, * Pin = (LibDrawPin*) m_Parent->GetDrawItem(); LIB_PIN* RefPin, * Pin = (LIB_PIN*) m_Parent->GetDrawItem();
if( Pin == NULL || Pin->GetParent() == NULL ) if( Pin == NULL || Pin->GetParent() == NULL )
return; return;
@ -758,11 +758,11 @@ void WinEDA_PinPropertiesFrame::NewSizePin( int newsize )
} }
static void CreateImagePins( LibDrawPin* Pin, int unit, int convert, static void CreateImagePins( LIB_PIN* Pin, int unit, int convert,
bool asDeMorgan ) bool asDeMorgan )
{ {
int ii; int ii;
LibDrawPin* NewPin; LIB_PIN* NewPin;
bool CreateConv = false; bool CreateConv = false;
@ -775,7 +775,7 @@ static void CreateImagePins( LibDrawPin* Pin, int unit, int convert,
/* Creation de la pin " convert " pour la part courante */ /* Creation de la pin " convert " pour la part courante */
if( CreateConv == true ) if( CreateConv == true )
{ {
NewPin = (LibDrawPin*) Pin->GenCopy(); NewPin = (LIB_PIN*) Pin->GenCopy();
if( Pin->m_Convert > 1 ) if( Pin->m_Convert > 1 )
NewPin->m_Convert = 1; NewPin->m_Convert = 1;
else else
@ -789,7 +789,7 @@ static void CreateImagePins( LibDrawPin* Pin, int unit, int convert,
continue; /* Pin commune a toutes les unites */ continue; /* Pin commune a toutes les unites */
/* Creation pour la representation "normale" */ /* Creation pour la representation "normale" */
NewPin = (LibDrawPin*) Pin->GenCopy(); NewPin = (LIB_PIN*) Pin->GenCopy();
if( convert != 0 ) if( convert != 0 )
NewPin->m_Convert = 1; NewPin->m_Convert = 1;
NewPin->m_Unit = ii; NewPin->m_Unit = ii;
@ -799,7 +799,7 @@ static void CreateImagePins( LibDrawPin* Pin, int unit, int convert,
if( CreateConv == false ) if( CreateConv == false )
continue; continue;
NewPin = (LibDrawPin*)Pin->GenCopy(); NewPin = (LIB_PIN*)Pin->GenCopy();
NewPin->m_Convert = 2; NewPin->m_Convert = 2;
if( Pin->m_Unit != 0 ) if( Pin->m_Unit != 0 )
NewPin->m_Unit = ii; NewPin->m_Unit = ii;
@ -808,19 +808,17 @@ static void CreateImagePins( LibDrawPin* Pin, int unit, int convert,
} }
/*************************************************/
void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC,
LibDrawPin* MasterPin, int id )
/*************************************************/
/* Depending on "id": /* Depending on "id":
* - Change pin text size (name or num) (range 10 .. 1000 mil) * - Change pin text size (name or num) (range 10 .. 1000 mil)
* - Change pin lenght. * - Change pin lenght.
* *
* If Pin is selected ( .m_flag == IS_SELECTED ) only the other selected pis are modified * If Pin is selected ( .m_flag == IS_SELECTED ) only the other selected
* pins are modified
*/ */
void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC, LIB_PIN* MasterPin, int id )
{ {
LibDrawPin* Pin; LIB_PIN* Pin;
bool selected = ( MasterPin->m_Selected & IS_SELECTED ) != 0; bool selected = ( MasterPin->m_Selected & IS_SELECTED ) != 0;
bool showPinText = true; bool showPinText = true;
@ -866,11 +864,11 @@ void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC,
/************************************************************************/ /************************************************************************/
void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LibDrawPin* SourcePin ) void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LIB_PIN* SourcePin )
/************************************************************************/ /************************************************************************/
/* Creation d'une nouvelle pin par copie de la pr<70>c<EFBFBD>dente ( fct REPEAT) */ /* Creation d'une nouvelle pin par copie de la pr<70>c<EFBFBD>dente ( fct REPEAT) */
{ {
LibDrawPin* Pin; LIB_PIN* Pin;
wxString msg; wxString msg;
int ox = 0, oy = 0; int ox = 0, oy = 0;
@ -878,7 +876,7 @@ void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LibDrawPin* SourcePin )
|| SourcePin->Type() != COMPONENT_PIN_DRAW_TYPE ) || SourcePin->Type() != COMPONENT_PIN_DRAW_TYPE )
return; return;
Pin = (LibDrawPin*)SourcePin->GenCopy(); Pin = (LIB_PIN*)SourcePin->GenCopy();
m_component->AddDrawItem( Pin ); m_component->AddDrawItem( Pin );
Pin->m_Flags = IS_NEW; Pin->m_Flags = IS_NEW;
@ -916,8 +914,8 @@ void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LibDrawPin* SourcePin )
int sort_by_pin_number( const void* ref, const void* tst ) int sort_by_pin_number( const void* ref, const void* tst )
{ {
const LibDrawPin* Ref = *(LibDrawPin**) ref; const LIB_PIN* Ref = *(LIB_PIN**) ref;
const LibDrawPin* Tst = *(LibDrawPin**) tst; const LIB_PIN* Tst = *(LIB_PIN**) tst;
return Ref->m_PinNum - Tst->m_PinNum; return Ref->m_PinNum - Tst->m_PinNum;
} }
@ -926,8 +924,8 @@ int sort_by_pin_number( const void* ref, const void* tst )
void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event ) void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event )
{ {
int nb_pins, ii, error; int nb_pins, ii, error;
LibDrawPin* Pin; LIB_PIN* Pin;
LibDrawPin** PinList; LIB_PIN** PinList;
wxString msg; wxString msg;
if( m_component == NULL ) if( m_component == NULL )
@ -940,7 +938,7 @@ void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event )
nb_pins++; nb_pins++;
} }
PinList = (LibDrawPin**) MyZMalloc( (nb_pins + 1) * sizeof(LibDrawPin*) ); PinList = (LIB_PIN**) MyZMalloc( (nb_pins + 1) * sizeof(LIB_PIN*) );
Pin = m_component->GetNextPin(); Pin = m_component->GetNextPin();
for( ii = 0; Pin != NULL; Pin = m_component->GetNextPin( Pin ) ) for( ii = 0; Pin != NULL; Pin = m_component->GetNextPin( Pin ) )
{ {
@ -949,14 +947,14 @@ void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event )
} }
// Classement des pins par numero de pin // Classement des pins par numero de pin
qsort( PinList, nb_pins, sizeof(LibDrawPin*), sort_by_pin_number ); qsort( PinList, nb_pins, sizeof(LIB_PIN*), sort_by_pin_number );
// Controle des duplicates: // Controle des duplicates:
error = 0; error = 0;
for( ii = 1; ii < nb_pins; ii++ ) for( ii = 1; ii < nb_pins; ii++ )
{ {
wxString aux_msg, StringPinNum; wxString aux_msg, StringPinNum;
LibDrawPin* curr_pin = PinList[ii]; LIB_PIN* curr_pin = PinList[ii];
Pin = PinList[ii - 1]; Pin = PinList[ii - 1];
if( Pin->m_PinNum != curr_pin->m_PinNum if( Pin->m_PinNum != curr_pin->m_PinNum

View File

@ -18,7 +18,7 @@ class SCH_ITEM;
class Hierarchical_PIN_Sheet_Struct; class Hierarchical_PIN_Sheet_Struct;
class PLOTTER; class PLOTTER;
class DrawSheetStruct; class DrawSheetStruct;
class LibDrawPin; class LIB_PIN;
wxString ReturnDefaultFieldName( int aFieldNdx ); wxString ReturnDefaultFieldName( int aFieldNdx );
@ -101,7 +101,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel,
/*************/ /*************/
/* LOCATE.CPP */ /* LOCATE.CPP */
/*************/ /*************/
LibDrawPin* LocatePinByNumber( const wxString& ePin_Number, LIB_PIN* LocatePinByNumber( const wxString& ePin_Number,
SCH_COMPONENT* eComponent ); SCH_COMPONENT* eComponent );
SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen ); SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen );
@ -152,7 +152,7 @@ SCH_ITEM* PickStruct( const wxPoint& refpos,
Hierarchical_PIN_Sheet_Struct* LocateSheetLabel( DrawSheetStruct* Sheet, Hierarchical_PIN_Sheet_Struct* LocateSheetLabel( DrawSheetStruct* Sheet,
const wxPoint& pos ); const wxPoint& pos );
LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, LIB_PIN* LocateAnyPin( SCH_ITEM* DrawList,
const wxPoint& RefPos, const wxPoint& RefPos,
SCH_COMPONENT** libpart = NULL ); SCH_COMPONENT** libpart = NULL );

View File

@ -22,7 +22,7 @@
/* Routines locales */ /* Routines locales */
static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre ); static void ComputeArc( LIB_ARC* DrawItem, wxPoint ArcCentre );
static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel, static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel,
wxDC* DC, wxDC* DC,
bool erase ); bool erase );
@ -83,27 +83,27 @@ void WinEDA_bodygraphics_PropertiesFrame::bodygraphics_PropertiesAccept( wxComma
switch( item->Type() ) switch( item->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
( (LibDrawArc*) item )->m_Fill = FlSymbol_Fill; ( (LIB_ARC*) item )->m_Fill = FlSymbol_Fill;
( (LibDrawArc*) item )->m_Width = ( (LIB_ARC*) item )->m_Width =
m_GraphicShapeWidthCtrl->GetValue(); m_GraphicShapeWidthCtrl->GetValue();
break; break;
case COMPONENT_CIRCLE_DRAW_TYPE: case COMPONENT_CIRCLE_DRAW_TYPE:
( (LibDrawCircle*) item )->m_Fill = FlSymbol_Fill; ( (LIB_CIRCLE*) item )->m_Fill = FlSymbol_Fill;
( (LibDrawCircle*) item )->m_Width = ( (LIB_CIRCLE*) item )->m_Width =
m_GraphicShapeWidthCtrl->GetValue(); m_GraphicShapeWidthCtrl->GetValue();
break; break;
case COMPONENT_RECT_DRAW_TYPE: case COMPONENT_RECT_DRAW_TYPE:
( (LibDrawSquare*) item )->m_Fill = FlSymbol_Fill; ( (LIB_RECTANGLE*) item )->m_Fill = FlSymbol_Fill;
( (LibDrawSquare*) item )->m_Width = ( (LIB_RECTANGLE*) item )->m_Width =
m_GraphicShapeWidthCtrl->GetValue(); m_GraphicShapeWidthCtrl->GetValue();
break; break;
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
( (LibDrawPolyline*) item )->m_Fill = ( (LIB_POLYLINE*) item )->m_Fill =
FlSymbol_Fill; FlSymbol_Fill;
( (LibDrawPolyline*) item )->m_Width = ( (LIB_POLYLINE*) item )->m_Width =
m_GraphicShapeWidthCtrl->GetValue(); m_GraphicShapeWidthCtrl->GetValue();
break; break;
@ -188,7 +188,7 @@ LIB_DRAW_ITEM* WinEDA_LibeditFrame::CreateGraphicItem( LIB_COMPONENT* LibEntry,
{ {
case ID_LIBEDIT_BODY_ARC_BUTT: case ID_LIBEDIT_BODY_ARC_BUTT:
{ {
LibDrawArc* Arc = new LibDrawArc( LibEntry ); LIB_ARC* Arc = new LIB_ARC( LibEntry );
m_drawItem = Arc; m_drawItem = Arc;
ArcStartX = ArcEndX = GetScreen()->m_Curseur.x; ArcStartX = ArcEndX = GetScreen()->m_Curseur.x;
@ -201,7 +201,7 @@ LIB_DRAW_ITEM* WinEDA_LibeditFrame::CreateGraphicItem( LIB_COMPONENT* LibEntry,
case ID_LIBEDIT_BODY_CIRCLE_BUTT: case ID_LIBEDIT_BODY_CIRCLE_BUTT:
{ {
LibDrawCircle* Circle = new LibDrawCircle( LibEntry ); LIB_CIRCLE* Circle = new LIB_CIRCLE( LibEntry );
m_drawItem = Circle; m_drawItem = Circle;
Circle->m_Pos = GetScreen()->m_Curseur; Circle->m_Pos = GetScreen()->m_Curseur;
@ -213,7 +213,7 @@ LIB_DRAW_ITEM* WinEDA_LibeditFrame::CreateGraphicItem( LIB_COMPONENT* LibEntry,
case ID_LIBEDIT_BODY_RECT_BUTT: case ID_LIBEDIT_BODY_RECT_BUTT:
{ {
LibDrawSquare* Square = new LibDrawSquare( LibEntry ); LIB_RECTANGLE* Square = new LIB_RECTANGLE( LibEntry );
m_drawItem = Square; m_drawItem = Square;
Square->m_Pos = GetScreen()->m_Curseur; Square->m_Pos = GetScreen()->m_Curseur;
@ -226,7 +226,7 @@ LIB_DRAW_ITEM* WinEDA_LibeditFrame::CreateGraphicItem( LIB_COMPONENT* LibEntry,
case ID_LIBEDIT_BODY_LINE_BUTT: case ID_LIBEDIT_BODY_LINE_BUTT:
{ {
LibDrawPolyline* polyline = new LibDrawPolyline( LibEntry ); LIB_POLYLINE* polyline = new LIB_POLYLINE( LibEntry );
m_drawItem = polyline; m_drawItem = polyline;
wxPoint point = GetScreen()->m_Curseur; wxPoint point = GetScreen()->m_Curseur;
NEGATE( point.y ); NEGATE( point.y );
@ -239,7 +239,7 @@ LIB_DRAW_ITEM* WinEDA_LibeditFrame::CreateGraphicItem( LIB_COMPONENT* LibEntry,
case COMPONENT_LINE_DRAW_TYPE: case COMPONENT_LINE_DRAW_TYPE:
{ {
LibDrawSegment* Segment = new LibDrawSegment( LibEntry ); LIB_SEGMENT* Segment = new LIB_SEGMENT( LibEntry );
m_drawItem = Segment; m_drawItem = Segment;
Segment->m_Pos = GetScreen()->m_Curseur; Segment->m_Pos = GetScreen()->m_Curseur;
@ -251,7 +251,7 @@ LIB_DRAW_ITEM* WinEDA_LibeditFrame::CreateGraphicItem( LIB_COMPONENT* LibEntry,
case ID_LIBEDIT_BODY_TEXT_BUTT: case ID_LIBEDIT_BODY_TEXT_BUTT:
{ {
LibDrawText* Text = new LibDrawText( LibEntry ); LIB_TEXT* Text = new LIB_TEXT( LibEntry );
m_drawItem = Text; m_drawItem = Text;
Text->m_Size.x = Text->m_Size.y = g_LastTextSize; Text->m_Size.x = Text->m_Size.y = g_LastTextSize;
@ -332,7 +332,7 @@ void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC )
{ {
wxPoint pos = GetScreen()->m_Curseur; wxPoint pos = GetScreen()->m_Curseur;
NEGATE( pos.y ); NEGATE( pos.y );
( (LibDrawPolyline*) m_drawItem )->AddPoint( pos ); ( (LIB_POLYLINE*) m_drawItem )->AddPoint( pos );
} }
break; break;
@ -432,12 +432,12 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
int Color = ReturnLayerColor( LAYER_DEVICE ); int Color = ReturnLayerColor( LAYER_DEVICE );
GRDashedLine( &panel->m_ClipBox, DC, ArcStartX, -ArcStartY, GRDashedLine( &panel->m_ClipBox, DC, ArcStartX, -ArcStartY,
( (LibDrawArc*) item )->m_Pos.x, ( (LIB_ARC*) item )->m_Pos.x,
-( (LibDrawArc*) item )->m_Pos.y, -( (LIB_ARC*) item )->m_Pos.y,
0, Color ); 0, Color );
GRDashedLine( &panel->m_ClipBox, DC, ArcEndX, -ArcEndY, GRDashedLine( &panel->m_ClipBox, DC, ArcEndX, -ArcEndY,
( (LibDrawArc*) item )->m_Pos.x, ( (LIB_ARC*) item )->m_Pos.x,
-( (LibDrawArc*) item )->m_Pos.y, -( (LIB_ARC*) item )->m_Pos.y,
0, Color ); 0, Color );
} }
} }
@ -454,34 +454,34 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if( StateDrawArc == 2 ) if( StateDrawArc == 2 )
{ {
ComputeArc( (LibDrawArc*) item, Screen->m_Curseur ); ComputeArc( (LIB_ARC*) item, Screen->m_Curseur );
} }
( (LibDrawArc*) item )->m_Fill = FlSymbol_Fill; ( (LIB_ARC*) item )->m_Fill = FlSymbol_Fill;
break; break;
case COMPONENT_CIRCLE_DRAW_TYPE: case COMPONENT_CIRCLE_DRAW_TYPE:
dx = ( (LibDrawCircle*) item )->m_Pos.x - curr_pos.x; dx = ( (LIB_CIRCLE*) item )->m_Pos.x - curr_pos.x;
dy = ( (LibDrawCircle*) item )->m_Pos.y - curr_pos.y; dy = ( (LIB_CIRCLE*) item )->m_Pos.y - curr_pos.y;
( (LibDrawCircle*) item )->m_Radius = ( (LIB_CIRCLE*) item )->m_Radius =
(int) sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) ); (int) sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) );
( (LibDrawCircle*) item )->m_Fill = FlSymbol_Fill; ( (LIB_CIRCLE*) item )->m_Fill = FlSymbol_Fill;
break; break;
case COMPONENT_RECT_DRAW_TYPE: case COMPONENT_RECT_DRAW_TYPE:
( (LibDrawSquare*) item )->m_End = curr_pos; ( (LIB_RECTANGLE*) item )->m_End = curr_pos;
( (LibDrawSquare*) item )->m_Fill = FlSymbol_Fill; ( (LIB_RECTANGLE*) item )->m_Fill = FlSymbol_Fill;
break; break;
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
{ {
unsigned idx = ( (LibDrawPolyline*) item )->GetCornerCount() - 1; unsigned idx = ( (LIB_POLYLINE*) item )->GetCornerCount() - 1;
( (LibDrawPolyline*) item )->m_PolyPoints[idx] = curr_pos; ( (LIB_POLYLINE*) item )->m_PolyPoints[idx] = curr_pos;
( (LibDrawPolyline*) item )->m_Fill = FlSymbol_Fill; ( (LIB_POLYLINE*) item )->m_Fill = FlSymbol_Fill;
} }
break; break;
case COMPONENT_LINE_DRAW_TYPE: case COMPONENT_LINE_DRAW_TYPE:
( (LibDrawSegment*) item )->m_End = curr_pos; ( (LIB_SEGMENT*) item )->m_End = curr_pos;
break; break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: /* Traite par des routines specifiques */ case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: /* Traite par des routines specifiques */
@ -506,12 +506,12 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
int Color = ReturnLayerColor( LAYER_DEVICE ); int Color = ReturnLayerColor( LAYER_DEVICE );
GRDashedLine( &panel->m_ClipBox, DC, ArcStartX, -ArcStartY, GRDashedLine( &panel->m_ClipBox, DC, ArcStartX, -ArcStartY,
( (LibDrawArc*) item )->m_Pos.x, ( (LIB_ARC*) item )->m_Pos.x,
-( (LibDrawArc*) item )->m_Pos.y, -( (LIB_ARC*) item )->m_Pos.y,
0, Color ); 0, Color );
GRDashedLine( &panel->m_ClipBox, DC, ArcEndX, -ArcEndY, GRDashedLine( &panel->m_ClipBox, DC, ArcEndX, -ArcEndY,
( (LibDrawArc*) item )->m_Pos.x, ( (LIB_ARC*) item )->m_Pos.x,
-( (LibDrawArc*) item )->m_Pos.y, -( (LIB_ARC*) item )->m_Pos.y,
0, Color ); 0, Color );
} }
} }
@ -554,19 +554,19 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
switch( m_drawItem->Type() ) switch( m_drawItem->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
( (LibDrawArc*) m_drawItem )->m_Fill = FlSymbol_Fill; ( (LIB_ARC*) m_drawItem )->m_Fill = FlSymbol_Fill;
break; break;
case COMPONENT_CIRCLE_DRAW_TYPE: case COMPONENT_CIRCLE_DRAW_TYPE:
( (LibDrawCircle*) m_drawItem )->m_Fill = FlSymbol_Fill; ( (LIB_CIRCLE*) m_drawItem )->m_Fill = FlSymbol_Fill;
break; break;
case COMPONENT_RECT_DRAW_TYPE: case COMPONENT_RECT_DRAW_TYPE:
( (LibDrawSquare*) m_drawItem )->m_Fill = FlSymbol_Fill; ( (LIB_RECTANGLE*) m_drawItem )->m_Fill = FlSymbol_Fill;
break; break;
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
( (LibDrawPolyline*) m_drawItem )->m_Fill = FlSymbol_Fill; ( (LIB_POLYLINE*) m_drawItem )->m_Fill = FlSymbol_Fill;
break; break;
case COMPONENT_PIN_DRAW_TYPE: case COMPONENT_PIN_DRAW_TYPE:
@ -607,7 +607,7 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
/***************************************************************/ /***************************************************************/
static void ComputeArc( LibDrawArc* DrawItem, wxPoint ArcCentre ) static void ComputeArc( LIB_ARC* DrawItem, wxPoint ArcCentre )
/***************************************************************/ /***************************************************************/
/* routine d'ajustage des parametres de l'arc en cours de trace /* routine d'ajustage des parametres de l'arc en cours de trace
@ -705,7 +705,7 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
|| m_drawItem->Type() != COMPONENT_POLYLINE_DRAW_TYPE ) || m_drawItem->Type() != COMPONENT_POLYLINE_DRAW_TYPE )
return; return;
LibDrawPolyline* Poly = (LibDrawPolyline*) m_drawItem; LIB_POLYLINE* Poly = (LIB_POLYLINE*) m_drawItem;
m_drawItem->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, NULL, m_drawItem->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, NULL,
DefaultTransformMatrix ); DefaultTransformMatrix );

View File

@ -31,9 +31,8 @@ class DrawSheetStruct;
class DrawSheetPath; class DrawSheetPath;
class Hierarchical_PIN_Sheet_Struct; class Hierarchical_PIN_Sheet_Struct;
class SCH_COMPONENT; class SCH_COMPONENT;
class LibDrawField;
class SCH_CMP_FIELD; class SCH_CMP_FIELD;
class LibDrawPin; class LIB_PIN;
class DrawJunctionStruct; class DrawJunctionStruct;
/* enum used in RotationMiroir() */ /* enum used in RotationMiroir() */
@ -445,7 +444,7 @@ public:
// Test des points de connexion en l'air (dangling ends) // Test des points de connexion en l'air (dangling ends)
void TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC ); void TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC );
LibDrawPin* LocatePinEnd( SCH_ITEM* DrawList, const wxPoint& pos ); LIB_PIN* LocatePinEnd( SCH_ITEM* DrawList, const wxPoint& pos );
// ERC: // ERC:
/** /**