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_base.cpp
# dialog_cmp_graphic_properties.cpp
dialog_create_component.cpp
dialog_edit_component_in_lib.cpp
dialog_edit_component_in_lib_base.cpp
dialog_edit_component_in_schematic_fbp.cpp
@ -57,6 +56,8 @@ set(EESCHEMA_SRCS
dialog_erc.cpp
dialog_erc_base.cpp
# dialog_find.cpp
dialog_lib_new_component.cpp
dialog_lib_new_component_base.cpp
dialog_options.cpp
dialog_print_using_printer_base.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 LibDrawPin* NextPin;
static LIB_PIN* NextPin;
static int Multi, convert, TransMat[2][2];
int orient;
LibDrawPin* Pin;
LIB_PIN* Pin;
static wxPoint CmpPosition;
if( aDrawLibItem )

View File

@ -795,7 +795,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
*/
{
EDA_BaseStruct* item;
LibDrawPin* pin;
LIB_PIN* pin;
SCH_COMPONENT* LibItem = NULL;
Hierarchical_PIN_Sheet_Struct* pinsheet;
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
*/
@ -21,7 +21,7 @@
#include "protos.h"
LibDrawText::LibDrawText(LIB_COMPONENT * aParent) :
LIB_TEXT::LIB_TEXT(LIB_COMPONENT * aParent) :
LIB_DRAW_ITEM( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE, aParent ),
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;
@ -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;
char hjustify = 'C', vjustify = 'C';
@ -139,7 +139,7 @@ bool LibDrawText::Load( char* line, wxString& errorMsg )
* @param refPos A wxPoint to test
* @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 );
}
@ -151,7 +151,7 @@ bool LibDrawText::HitTest( const wxPoint& refPos )
* @param aThreshold = unused here (TextHitTest calculates its threshold )
* @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] )
{
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_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 );
const LibDrawText* tmp = ( LibDrawText* ) &other;
const LIB_TEXT* tmp = ( LIB_TEXT* ) &other;
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;
}
bool LibDrawText::DoTestInside( EDA_Rect& rect )
bool LIB_TEXT::DoTestInside( EDA_Rect& rect )
{
/*
* 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;
}
void LibDrawText::DoMirrorHorizontal( const wxPoint& center )
void LIB_TEXT::DoMirrorHorizontal( const wxPoint& center )
{
m_Pos.x -= center.x;
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] )
{
wxASSERT( plotter != NULL );
@ -269,7 +269,7 @@ void LibDrawText::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
/** Function GetPenSize
* @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;
@ -285,7 +285,7 @@ int LibDrawText::GetPenSize( )
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,
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;
@ -331,7 +331,7 @@ void LibDrawText::DisplayInfo( WinEDA_DrawFrame* frame )
}
EDA_Rect LibDrawText::GetBoundingBox()
EDA_Rect LIB_TEXT::GetBoundingBox()
{
EDA_Rect rect = GetTextBox();
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 )
{
LIB_DRAW_ITEM* newItem;
LibDrawField* oldField;
LibDrawField* newField;
LIB_FIELD* oldField;
LIB_FIELD* newField;
m_Prefix = component.m_Prefix;
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;
oldField = oldField->Next() )
{
newField = (LibDrawField*) oldField->GenCopy();
newField = (LIB_FIELD*) oldField->GenCopy();
newField->SetParent( this );
m_Fields.PushBack( newField );
}
@ -240,8 +240,6 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* dc,
bool showPinText, bool drawFields,
bool onlySelected )
{
wxString fieldText;
LibDrawField* Field;
BASE_SCREEN* screen = panel->GetScreen();
GRSetDrawMode( dc, drawMode );
@ -282,25 +280,13 @@ void LIB_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* dc,
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.
*
* FIXME: This should be handled by the LibDrawField class.
*/
if( m_UnitCount > 1 )
{
#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( "?" );
}
wxString fieldText = m_Prefix.GetFullText( multi );
if( !( onlySelected && m_Prefix.m_Selected == 0 ) )
m_Prefix.Draw( panel, dc, offset, color, drawMode, &fieldText,
@ -384,7 +370,7 @@ void LIB_COMPONENT::RemoveDrawItem( LIB_DRAW_ITEM* item,
}
else
{
LibDrawField* field;
LIB_FIELD* field;
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 )
{
LibDrawField* Field;
LIB_FIELD* Field;
/* 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 )
@ -689,31 +675,31 @@ bool LIB_COMPONENT::LoadDrawEntries( FILE* f, char* line,
switch( line[0] )
{
case 'A': /* Arc */
newEntry = ( LIB_DRAW_ITEM* ) new LibDrawArc(this);
newEntry = ( LIB_DRAW_ITEM* ) new LIB_ARC(this);
break;
case 'C': /* Circle */
newEntry = ( LIB_DRAW_ITEM* ) new LibDrawCircle(this);
newEntry = ( LIB_DRAW_ITEM* ) new LIB_CIRCLE(this);
break;
case 'T': /* Text */
newEntry = ( LIB_DRAW_ITEM* ) new LibDrawText(this);
newEntry = ( LIB_DRAW_ITEM* ) new LIB_TEXT(this);
break;
case 'S': /* Square */
newEntry = ( LIB_DRAW_ITEM* ) new LibDrawSquare(this);
newEntry = ( LIB_DRAW_ITEM* ) new LIB_RECTANGLE(this);
break;
case 'X': /* Pin Description */
newEntry = ( LIB_DRAW_ITEM* ) new LibDrawPin(this);
newEntry = ( LIB_DRAW_ITEM* ) new LIB_PIN(this);
break;
case 'P': /* Polyline */
newEntry = ( LIB_DRAW_ITEM* ) new LibDrawPolyline(this);
newEntry = ( LIB_DRAW_ITEM* ) new LIB_POLYLINE(this);
break;
case 'B': /* Bezier Curves */
newEntry = ( LIB_DRAW_ITEM* ) new LibDrawBezier(this);
newEntry = ( LIB_DRAW_ITEM* ) new LIB_BEZIER(this);
break;
default:
@ -766,7 +752,7 @@ bool LIB_COMPONENT::LoadAliases( 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 ) )
{
@ -846,9 +832,9 @@ EDA_Rect LIB_COMPONENT::GetBoundaryBox( int Unit, int Convert )
/** Function SetFields
* 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):
aFields[VALUE].Copy( &m_Name );
@ -867,7 +853,7 @@ void LIB_COMPONENT::SetFields( const std::vector <LibDrawField> aFields )
create = TRUE;
if( create )
{
LibDrawField*Field = new LibDrawField( this, ii );
LIB_FIELD*Field = new LIB_FIELD( this, ii );
aFields[ii].Copy( 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
* (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 );
if( Field->m_FieldId >= FIELD1 )
@ -947,7 +933,7 @@ void LIB_COMPONENT::SetOffset( const wxPoint& offset )
m_Name.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 );
}
@ -979,7 +965,7 @@ bool LIB_COMPONENT::HasConversion() const
void LIB_COMPONENT::ClearStatus( void )
{
LibDrawField* field;
LIB_FIELD* field;
BOOST_FOREACH( LIB_DRAW_ITEM& item, m_Drawings )
item.m_Flags = 0;
@ -1032,7 +1018,7 @@ int LIB_COMPONENT::SelectItems( EDA_Rect& rect, int unit, int convert,
ItemsCount++;
}
for( LibDrawField* field = m_Fields.GetFirst(); field != NULL;
for( LIB_FIELD* field = m_Fields.GetFirst(); field != NULL;
field = field->Next() )
{
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 )
{
LibDrawField* field;
LIB_FIELD* field;
BOOST_FOREACH( LIB_DRAW_ITEM& item, m_Drawings )
{
@ -1086,7 +1072,7 @@ void LIB_COMPONENT::MoveSelectedItems( const wxPoint& offset )
void LIB_COMPONENT::ClearSelectedItems( void )
{
LibDrawField* field;
LIB_FIELD* field;
BOOST_FOREACH( LIB_DRAW_ITEM& item, m_Drawings )
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 )
{
LibDrawField* field;
LIB_FIELD* field;
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,
KICAD_T type, const wxPoint& pt )
{
LibDrawField* field;
LIB_FIELD* field;
BOOST_FOREACH( LIB_DRAW_ITEM& item, m_Drawings )
{

View File

@ -43,7 +43,7 @@ class CMP_LIB_ENTRY : public EDA_BaseStruct
public:
LibrEntryType Type; /* Type = ROOT;
* = 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_KeyWord; /* keyword list (used to select a group of
* components by keyword) */
@ -107,7 +107,7 @@ extern int LibraryEntryCompare( const CMP_LIB_ENTRY* LE1,
class LIB_COMPONENT : public CMP_LIB_ENTRY
{
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_FootprintList; /* list of suitable footprint names
* for the component (wildcard names
@ -123,7 +123,7 @@ public:
* m_TextInside in mils */
bool m_DrawPinNum;
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
protected:
@ -177,9 +177,9 @@ public:
/**
* 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.
@ -244,9 +244,9 @@ public:
LIB_DRAW_ITEM* GetNextDrawItem( LIB_DRAW_ITEM* item = NULL,
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 );
}

View File

@ -40,22 +40,21 @@
*
* 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 )
{
m_FieldId = idfield;
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 )
{
m_FieldId = idfield;
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT;
}
LibDrawField::LibDrawField( const LibDrawField& field ) :
LIB_DRAW_ITEM( field )
LIB_FIELD::LIB_FIELD( const LIB_FIELD& field ) : LIB_DRAW_ITEM( field )
{
m_Pos = field.m_Pos;
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;
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;
char textOrient;
@ -257,7 +256,7 @@ parameter <%c> is not valid" ),
/** Function GetPenSize
* @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;
}
@ -267,7 +266,7 @@ int LibDrawField::GetPenSize()
* if aData not NULL, aData must point a wxString which is used instead of
* 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,
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
* @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 );
}
@ -346,7 +345,7 @@ bool LibDrawField::HitTest( const wxPoint& refPos )
* @param aThreshold = unused here (TextHitTest calculates its threshold )
* @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] )
{
int extraCharCount = 0;
@ -387,9 +386,9 @@ bool LibDrawField::HitTest( wxPoint aPosRef, int aThreshold,
}
// 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 );
@ -399,9 +398,9 @@ LIB_DRAW_ITEM* LibDrawField::DoGenCopy()
/** Function Copy
* 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->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 );
const LibDrawField* tmp = ( LibDrawField* ) &other;
const LIB_FIELD* tmp = ( LIB_FIELD* ) &other;
if( 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;
}
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
@ -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;
}
void LibDrawField::DoMirrorHorizontal( const wxPoint& center )
void LIB_FIELD::DoMirrorHorizontal( const wxPoint& center )
{
m_Pos.x -= center.x;
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] )
{
}
@ -490,7 +489,7 @@ void LibDrawField::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
*
* @fixme This should be handled by the field object.
*/
wxString LibDrawField::GetFullText( int unit )
wxString LIB_FIELD::GetFullText( int unit )
{
if( m_FieldId != REFERENCE )
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();
rect.m_Pos.y *= -1;

View File

@ -18,8 +18,7 @@
* default value in schematic
*/
class LibDrawField : public LIB_DRAW_ITEM,
public EDA_TextStruct
class LIB_FIELD : public LIB_DRAW_ITEM, public EDA_TextStruct
{
public:
int m_FieldId; /* 0 = REFERENCE
@ -33,17 +32,17 @@ public:
public:
LibDrawField* Next() const { return (LibDrawField*) Pnext; }
LibDrawField* Back() const { return (LibDrawField*) Pback; }
LIB_FIELD* Next() const { return (LIB_FIELD*) Pnext; }
LIB_FIELD* Back() const { return (LIB_FIELD*) Pback; }
LibDrawField( int idfield = 2 );
LibDrawField( LIB_COMPONENT * aParent, int idfield = 2 );
LibDrawField( const LibDrawField& field );
~LibDrawField();
LIB_FIELD( int idfield = 2 );
LIB_FIELD( LIB_COMPONENT * aParent, int idfield = 2 );
LIB_FIELD( const LIB_FIELD& field );
~LIB_FIELD();
virtual wxString GetClass() const
{
return wxT( "LibDrawField" );
return wxT( "LIB_FIELD" );
}
@ -64,11 +63,11 @@ public:
/** Function Copy
* 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,
int aColor, int aDrawMode, void* aData,
@ -100,7 +99,7 @@ public:
virtual bool HitTest( wxPoint aPosRef, int aThreshold,
const int aTransMat[2][2] );
void operator=( const LibDrawField& field )
void operator=( const LIB_FIELD& field )
{
m_FieldId = field.m_FieldId;
m_Text = field.m_Text;
@ -154,6 +153,7 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] );
virtual int DoGetWidth( void ) { return m_Width; }
};
#endif // CLASS_LIBENTRY_FIELDS_H

View File

@ -18,6 +18,7 @@
#include <boost/foreach.hpp>
#include <wx/tokenzr.h>
#include <wx/regex.h>
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 )
{
BOOST_FOREACH( CMP_LIB_ENTRY& entry, m_Entries )

View File

@ -42,6 +42,8 @@
/* Helpers for creating a list of component libraries. */
class CMP_LIBRARY;
class wxRegEx;
typedef boost::ptr_vector< CMP_LIBRARY > CMP_LIBRARY_LIST;
@ -176,9 +178,6 @@ public:
* WildCompareString(). The names array will be populated with the
* 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 nameSearch - Name wild card search criteria.
* @param keySearch - Key word search criteria.
@ -189,6 +188,16 @@ public:
const wxString& keySearch = wxEmptyString,
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.
*

View File

@ -37,7 +37,7 @@ const wxChar* MsgPinElectricType[] =
wxT( "?????" )
};
LibDrawPin::LibDrawPin(LIB_COMPONENT * aParent) :
LIB_PIN::LIB_PIN(LIB_COMPONENT * aParent) :
LIB_DRAW_ITEM( COMPONENT_PIN_DRAW_TYPE, aParent )
{
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_PinLen = pin.m_PinLen;
@ -83,7 +83,7 @@ LibDrawPin::LibDrawPin( const LibDrawPin& pin ) : LIB_DRAW_ITEM( pin )
* @param aRefPos A wxPoint to test
* @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;
@ -100,7 +100,7 @@ bool LibDrawPin::HitTest( const wxPoint& aRefPos )
* @param aThreshold = max distance to a segment
* @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] )
{
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;
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;
char pinAttrs[64];
@ -324,13 +324,13 @@ bool LibDrawPin::Load( char* line, wxString& errorMsg )
/** Function GetPenSize
* @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;
}
void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel,
void LIB_PIN::Draw( WinEDA_DrawPanel* aPanel,
wxDC* aDC,
const wxPoint& aOffset,
int aColor,
@ -388,7 +388,7 @@ void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel,
* Draw the pin symbol (without texts)
* 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,
const wxPoint& aPinPos,
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.
* Pin Name: substring beteween '~' is negated
*****************************************************************************/
void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel,
void LIB_PIN::DrawPinTexts( WinEDA_DrawPanel* panel,
wxDC* DC,
wxPoint& pin_pos,
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 *
* 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,
int orient,
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
@ -977,7 +977,7 @@ wxPoint LibDrawPin::ReturnPinEndPoint()
* according to its orientation and the matrix transform (rot, mirror) TransMat
* @param TransMat = transform matrix
*/
int LibDrawPin::ReturnPinDrawOrient( const int TransMat[2][2] )
int LIB_PIN::ReturnPinDrawOrient( const int TransMat[2][2] )
{
int orient;
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
* @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 );
}
@ -1031,7 +1031,7 @@ void LibDrawPin::ReturnPinStringNum( wxString& aStringBuffer ) const
* @param aPinNum = a long containing a pin num
* @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];
@ -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
* Pin num is coded as a long
* Used to print/draw the pin num
*/
void LibDrawPin::SetPinNumFromString( wxString& buffer )
void LIB_PIN::SetPinNumFromString( wxString& buffer )
{
char ascii_buf[4];
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_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 );
const LibDrawPin* tmp = ( LibDrawPin* ) &other;
const LIB_PIN* tmp = ( LIB_PIN* ) &other;
if( 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;
}
bool LibDrawPin::DoTestInside( EDA_Rect& rect )
bool LIB_PIN::DoTestInside( EDA_Rect& rect )
{
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;
}
void LibDrawPin::DoMirrorHorizontal( const wxPoint& center )
void LIB_PIN::DoMirrorHorizontal( const wxPoint& center )
{
m_Pos.x -= center.x;
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] )
{
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 ...
* on the Info window
*/
void LibDrawPin::DisplayInfo( WinEDA_DrawFrame* frame )
void LIB_PIN::DisplayInfo( WinEDA_DrawFrame* frame )
{
wxString Text;
int ii;
LIB_DRAW_ITEM::DisplayInfo( frame );
/* Affichage du nom */
frame->MsgPanel->Affiche_1_Parametre( 30, _( "PinName" ), m_PinName,
DARKCYAN );
frame->MsgPanel->AppendMessage( _( "Pin name" ), m_PinName, DARKCYAN );
/* Affichage du numero */
if( m_PinNum == 0 )
Text = wxT( "?" );
else
ReturnPinStringNum( Text );
frame->MsgPanel->Affiche_1_Parametre( 38, _( "PinNum" ), Text, DARKCYAN );
frame->MsgPanel->AppendMessage( _( "Pin number" ), Text, DARKCYAN );
/* Affichage du type */
ii = m_PinType;
frame->MsgPanel->Affiche_1_Parametre( 44, _( "PinType" ),
MsgPinElectricType[ii], RED );
frame->MsgPanel->AppendMessage( _( "Pin type" ), MsgPinElectricType[ii],
RED );
/* Affichage de la visiblite */
ii = m_Attributs;
if( ii & 1 )
Text = _( "no" );
Text = _( "Not visible" );
else
Text = _( "yes" );
frame->MsgPanel->Affiche_1_Parametre( 50, _( "Display" ), Text, DARKGREEN );
Text = _( "Visible" );
frame->MsgPanel->AppendMessage( _( "Display" ), Text, DARKGREEN );
/* Display pin length */
Text = ReturnStringFromValue( g_UnitMetric, m_PinLen,
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 )
{
case PIN_UP:
@ -1232,18 +1226,18 @@ void LibDrawPin::DisplayInfo( WinEDA_DrawFrame* frame )
break;
default:
Text = wxT( "??" );
Text = _( "Unknown" );
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
*/
EDA_Rect LibDrawPin::GetBoundingBox()
EDA_Rect LIB_PIN::GetBoundingBox()
{
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,
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.
* Pointers and specific values (position, texts) are not copied
* 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_Size = aSource.m_Size;

View File

@ -15,6 +15,7 @@
class SCH_COMPONENT;
class LIB_FIELD;
/**
@ -53,9 +54,9 @@ public:
/** Function ImportValues
* copy parameters from a source.
* 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
* @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 );
LibDrawSquare* Square = new LibDrawSquare(DummyCmp);
LIB_RECTANGLE* Square = new LIB_RECTANGLE(DummyCmp);
Square->m_Pos = 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_Text = wxT( "??" );

View File

@ -60,14 +60,14 @@ void LIB_DRAW_ITEM::DisplayInfo( WinEDA_DrawFrame* frame )
frame->MsgPanel->EraseMsgBox();
frame->MsgPanel->Affiche_1_Parametre( 1, _( "Type" ), m_typeName, CYAN );
frame->MsgPanel->AppendMessage( _( "Type" ), m_typeName, CYAN );
/* Affichage de l'appartenance */
if( m_Unit == 0 )
msg = _( "All" );
else
msg.Printf( wxT( "%d" ), m_Unit );
Affiche_1_Parametre( frame, 8, _( "Unit" ), msg, BROWN );
frame->MsgPanel->AppendMessage( _( "Unit" ), msg, BROWN );
if( m_Convert == 0 )
msg = _( "All" );
@ -77,7 +77,7 @@ void LIB_DRAW_ITEM::DisplayInfo( WinEDA_DrawFrame* frame )
msg = _( "yes" );
else
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 )
{
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_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
* 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;
@ -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;
char tmp[256];
@ -224,7 +224,7 @@ bool LibDrawArc::Load( char* line, wxString& errorMsg )
* @param aRefPoint A wxPoint to test in eeschema space
* @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;
@ -243,7 +243,7 @@ bool LibDrawArc::HitTest( const wxPoint& aRefPoint )
* of a line)
* @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] )
{
// 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_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 );
const LibDrawArc* tmp = ( LibDrawArc* ) &other;
const LIB_ARC* tmp = ( LIB_ARC* ) &other;
if( 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_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 )
|| 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;
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 *= -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] )
{
wxASSERT( plotter != NULL );
@ -384,16 +384,15 @@ void LibDrawArc::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
/** Function GetPenSize
* @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;
}
void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor,
int aDrawMode, void* aData,
const int aTransformMatrix[2][2] )
void LIB_ARC::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] )
{
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;
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;
EDA_Rect bBox = GetBoundingBox();
@ -526,20 +525,20 @@ void LibDrawArc::DisplayInfo( WinEDA_DrawFrame* frame )
msg = ReturnStringFromValue( g_UnitMetric, m_Width,
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,
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 )
{
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 )
{
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,
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];
@ -596,7 +595,7 @@ bool LibDrawCircle::Load( char* line, wxString& errorMsg )
* @param aRefPos A wxPoint to test in eeschema space
* @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;
@ -615,7 +614,7 @@ bool LibDrawCircle::HitTest( const wxPoint& aPosRef )
* thickness of a line)
* @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] )
{
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_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 );
const LibDrawCircle* tmp = ( LibDrawCircle* ) &other;
const LIB_CIRCLE* tmp = ( LIB_CIRCLE* ) &other;
if( 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;
}
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
@ -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;
}
void LibDrawCircle::DoMirrorHorizontal( const wxPoint& center )
void LIB_CIRCLE::DoMirrorHorizontal( const wxPoint& center )
{
m_Pos.x -= center.x;
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] )
{
wxPoint pos = TransformCoordinate( transform, m_Pos ) + offset;
@ -714,13 +713,13 @@ void LibDrawCircle::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
/** Function GetPenSize
* @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;
}
void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
void LIB_CIRCLE::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode,
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;
@ -776,7 +775,7 @@ EDA_Rect LibDrawCircle::GetBoundingBox()
}
void LibDrawCircle::DisplayInfo( WinEDA_DrawFrame* frame )
void LIB_CIRCLE::DisplayInfo( WinEDA_DrawFrame* frame )
{
wxString msg;
EDA_Rect bBox = GetBoundingBox();
@ -786,24 +785,24 @@ void LibDrawCircle::DisplayInfo( WinEDA_DrawFrame* frame )
msg = ReturnStringFromValue( g_UnitMetric, m_Width,
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,
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,
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 )
{
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 )
{
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,
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;
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_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 );
const LibDrawSquare* tmp = ( LibDrawSquare* ) &other;
const LIB_RECTANGLE* tmp = ( LIB_RECTANGLE* ) &other;
if( 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_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 );
}
void LibDrawSquare::DoMove( const wxPoint& newPosition )
void LIB_RECTANGLE::DoMove( const wxPoint& newPosition )
{
wxPoint size = m_End - m_Pos;
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 *= -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] )
{
wxASSERT( plotter != NULL );
@ -949,12 +948,12 @@ void LibDrawSquare::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
/** Function GetPenSize
* @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;
}
void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
void LIB_RECTANGLE::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode,
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;
@ -1010,11 +1009,11 @@ void LibDrawSquare::DisplayInfo( WinEDA_DrawFrame* frame )
msg = ReturnStringFromValue( g_UnitMetric, m_Width,
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;
@ -1031,7 +1030,7 @@ EDA_Rect LibDrawSquare::GetBoundingBox()
* @param aRefPoint A wxPoint to test in eeschema space
* @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;
@ -1050,7 +1049,7 @@ bool LibDrawSquare::HitTest( const wxPoint& aRefPoint )
* of a line)
* @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] )
{
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 )
{
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 )
{
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 ) )
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;
}
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_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 );
const LibDrawSegment* tmp = ( LibDrawSegment* ) &other;
const LIB_SEGMENT* tmp = ( LIB_SEGMENT* ) &other;
if( 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_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 );
}
void LibDrawSegment::DoMove( const wxPoint& newPosition )
void LIB_SEGMENT::DoMove( const wxPoint& newPosition )
{
wxPoint offset = newPosition - m_Pos;
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 *= -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] )
{
wxASSERT( plotter != NULL );
@ -1211,12 +1210,12 @@ void LibDrawSegment::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
/** Function GetPenSize
* @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;
}
void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
void LIB_SEGMENT::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode,
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;
EDA_Rect bBox = GetBoundingBox();
@ -1261,12 +1260,12 @@ void LibDrawSegment::DisplayInfo( WinEDA_DrawFrame* frame )
msg = ReturnStringFromValue( g_UnitMetric, m_Width,
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,
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
* @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;
@ -1295,7 +1294,7 @@ bool LibDrawSegment::HitTest( const wxPoint& aPosRef )
* thickness of a line)
* @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] )
{
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 )
{
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 )
{
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();
@ -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;
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_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 );
const LibDrawPolyline* tmp = ( LibDrawPolyline* ) &other;
const LIB_POLYLINE* tmp = ( LIB_POLYLINE* ) &other;
if( 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++ )
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++ )
{
@ -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] );
}
void LibDrawPolyline::DoMirrorHorizontal( const wxPoint& center )
void LIB_POLYLINE::DoMirrorHorizontal( const wxPoint& center )
{
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] )
{
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 );
}
@ -1520,12 +1519,12 @@ void LibDrawPolyline::AddPoint( const wxPoint& point )
/** Function GetPenSize
* @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;
}
void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
void LIB_POLYLINE::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode,
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
* @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;
@ -1616,7 +1615,7 @@ bool LibDrawPolyline::HitTest( const wxPoint& aRefPos )
* @param aThreshold = max distance to a segment
* @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] )
{
wxPoint ref, start, end;
@ -1637,7 +1636,7 @@ bool LibDrawPolyline::HitTest( wxPoint aPosRef, int aThreshold,
/** Function GetBoundingBox
* @return the boundary box for this, in library coordinates
*/
EDA_Rect LibDrawPolyline::GetBoundingBox()
EDA_Rect LIB_POLYLINE::GetBoundingBox()
{
EDA_Rect rect;
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;
EDA_Rect bBox = GetBoundingBox();
@ -1671,18 +1670,18 @@ void LibDrawPolyline::DisplayInfo( WinEDA_DrawFrame* frame )
msg = ReturnStringFromValue( g_UnitMetric, m_Width,
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,
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 )
{
m_Fill = NO_FILL;
@ -1691,8 +1690,7 @@ LibDrawBezier::LibDrawBezier( LIB_COMPONENT* aParent ) :
}
LibDrawBezier::LibDrawBezier( const LibDrawBezier& bezier ) :
LIB_DRAW_ITEM( bezier )
LIB_BEZIER::LIB_BEZIER( const LIB_BEZIER& bezier ) : LIB_DRAW_ITEM( bezier )
{
m_PolyPoints = bezier.m_PolyPoints;
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();
@ -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;
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_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 );
const LibDrawBezier* tmp = ( LibDrawBezier* ) &other;
const LIB_BEZIER* tmp = ( LIB_BEZIER* ) &other;
if( 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;
@ -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++ )
{
@ -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] );
}
void LibDrawBezier::DoMirrorHorizontal( const wxPoint& center )
void LIB_BEZIER::DoMirrorHorizontal( const wxPoint& center )
{
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] )
{
wxASSERT( plotter != NULL );
@ -1900,12 +1898,12 @@ void LibDrawBezier::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
/** Function GetPenSize
* @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;
}
void LibDrawBezier::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
void LIB_BEZIER::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode,
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
* @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;
// 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 aTransMat = the transform matrix
*/
bool LibDrawBezier::HitTest( wxPoint aPosRef, int aThreshold,
bool LIB_BEZIER::HitTest( wxPoint aPosRef, int aThreshold,
const int aTransMat[2][2] )
{
wxPoint ref, start, end;
@ -2003,7 +2001,7 @@ bool LibDrawBezier::HitTest( wxPoint aPosRef, int aThreshold,
/** Function GetBoundingBox
* @return the boundary box for this, in library coordinates
*/
EDA_Rect LibDrawBezier::GetBoundingBox()
EDA_Rect LIB_BEZIER::GetBoundingBox()
{
EDA_Rect rect;
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;
EDA_Rect bBox = GetBoundingBox();
@ -2040,10 +2038,10 @@ void LibDrawBezier::DisplayInfo( WinEDA_DrawFrame* frame )
msg = ReturnStringFromValue( g_UnitMetric, m_Width,
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,
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 );
}
/**
* Return the width of the draw item.
*
* @return int - Width of draw object.
*/
int GetWidth( void ) { return DoGetWidth(); }
protected:
virtual LIB_DRAW_ITEM* DoGenCopy() = 0;
@ -299,6 +307,7 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center ) = 0;
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
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 */
/********/
class LibDrawPin : public LIB_DRAW_ITEM
class LIB_PIN : public LIB_DRAW_ITEM
{
public:
int m_PinLen; /* Pin length */
@ -339,16 +348,16 @@ public:
int m_Width; /* Line width */
public:
LibDrawPin(LIB_COMPONENT * aParent);
LibDrawPin( const LibDrawPin& pin );
~LibDrawPin() { }
LIB_PIN(LIB_COMPONENT * aParent);
LIB_PIN( const LIB_PIN& pin );
~LIB_PIN() { }
LibDrawPin* Next() const { return (LibDrawPin*) Pnext; }
LibDrawPin* Back() const { return (LibDrawPin*) Pback; }
LIB_PIN* Next() const { return (LIB_PIN*) Pnext; }
LIB_PIN* Back() const { return (LIB_PIN*) Pback; }
virtual wxString GetClass() const
{
return wxT( "LibDrawPin" );
return wxT( "LIB_PIN" );
}
@ -452,6 +461,7 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] );
virtual int DoGetWidth( void ) { return m_Width; }
};
@ -459,7 +469,7 @@ protected:
/* Graphic Body Item: Arc */
/**************************/
class LibDrawArc : public LIB_DRAW_ITEM
class LIB_ARC : public LIB_DRAW_ITEM
{
public:
int m_Radius;
@ -472,12 +482,12 @@ public:
int m_Width; /* Line width */
public:
LibDrawArc(LIB_COMPONENT * aParent);
LibDrawArc( const LibDrawArc& arc );
~LibDrawArc() { }
LIB_ARC(LIB_COMPONENT * aParent);
LIB_ARC( const LIB_ARC& arc );
~LIB_ARC() { }
virtual wxString GetClass() const
{
return wxT( "LibDrawArc" );
return wxT( "LIB_ARC" );
}
@ -540,13 +550,14 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] );
virtual int DoGetWidth( void ) { return m_Width; }
};
/*****************************/
/* Graphic Body Item: Circle */
/*****************************/
class LibDrawCircle : public LIB_DRAW_ITEM
class LIB_CIRCLE : public LIB_DRAW_ITEM
{
public:
int m_Radius;
@ -555,12 +566,12 @@ public:
int m_Width; /* Line width */
public:
LibDrawCircle(LIB_COMPONENT * aParent);
LibDrawCircle( const LibDrawCircle& circle );
~LibDrawCircle() { }
LIB_CIRCLE(LIB_COMPONENT * aParent);
LIB_CIRCLE( const LIB_CIRCLE& circle );
~LIB_CIRCLE() { }
virtual wxString GetClass() const
{
return wxT( "LibDrawCircle" );
return wxT( "LIB_CIRCLE" );
}
@ -624,6 +635,7 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] );
virtual int DoGetWidth( void ) { return m_Width; }
};
@ -633,15 +645,15 @@ protected:
/* Fields like Ref , value... are not Text, */
/* 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:
LibDrawText(LIB_COMPONENT * aParent);
LibDrawText( const LibDrawText& text );
~LibDrawText() { }
LIB_TEXT(LIB_COMPONENT * aParent);
LIB_TEXT( const LIB_TEXT& text );
~LIB_TEXT() { }
virtual wxString GetClass() const
{
return wxT( "LibDrawText" );
return wxT( "LIB_TEXT" );
}
@ -719,13 +731,14 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] );
virtual int DoGetWidth( void ) { return m_Width; }
};
/********************************/
/* Graphic Body Item: Rectangle */
/********************************/
class LibDrawSquare : public LIB_DRAW_ITEM
class LIB_RECTANGLE : public LIB_DRAW_ITEM
{
public:
wxPoint m_End; /* Rectangle end point. */
@ -733,12 +746,12 @@ public:
int m_Width; /* Line width */
public:
LibDrawSquare(LIB_COMPONENT * aParent);
LibDrawSquare( const LibDrawSquare& rect );
~LibDrawSquare() { }
LIB_RECTANGLE(LIB_COMPONENT * aParent);
LIB_RECTANGLE( const LIB_RECTANGLE& rect );
~LIB_RECTANGLE() { }
virtual wxString GetClass() const
{
return wxT( "LibDrawSquare" );
return wxT( "LIB_RECTANGLE" );
}
@ -803,12 +816,13 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] );
virtual int DoGetWidth( void ) { return m_Width; }
};
/**********************************/
/* Graphic Body Item: single line */
/**********************************/
class LibDrawSegment : public LIB_DRAW_ITEM
class LIB_SEGMENT : public LIB_DRAW_ITEM
{
public:
wxPoint m_End;
@ -817,12 +831,12 @@ public:
int m_Width; /* Line width */
public:
LibDrawSegment(LIB_COMPONENT * aParent);
LibDrawSegment( const LibDrawSegment& segment );
~LibDrawSegment() { }
LIB_SEGMENT(LIB_COMPONENT * aParent);
LIB_SEGMENT( const LIB_SEGMENT& segment );
~LIB_SEGMENT() { }
virtual wxString GetClass() const
{
return wxT( "LibDrawSegment" );
return wxT( "LIB_SEGMENT" );
}
@ -886,26 +900,27 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] );
virtual int DoGetWidth( void ) { return m_Width; }
};
/**********************************************************/
/* Graphic Body Item: Polygon and polyline (set of lines) */
/**********************************************************/
class LibDrawPolyline : public LIB_DRAW_ITEM
class LIB_POLYLINE : public LIB_DRAW_ITEM
{
public:
int m_Width; /* Line width */
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
public:
LibDrawPolyline(LIB_COMPONENT * aParent);
LibDrawPolyline( const LibDrawPolyline& polyline );
~LibDrawPolyline() { }
LIB_POLYLINE(LIB_COMPONENT * aParent);
LIB_POLYLINE( const LIB_POLYLINE& polyline );
~LIB_POLYLINE() { }
virtual wxString GetClass() const
{
return wxT( "LibDrawPolyline" );
return wxT( "LIB_POLYLINE" );
}
@ -978,12 +993,13 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] );
virtual int DoGetWidth( void ) { return m_Width; }
};
/**********************************************************/
/* Graphic Body Item: Bezier Curve (set of lines) */
/**********************************************************/
class LibDrawBezier : public LIB_DRAW_ITEM
class LIB_BEZIER : public LIB_DRAW_ITEM
{
public:
int m_Width; /* Line width */
@ -991,13 +1007,13 @@ public:
std::vector<wxPoint> m_PolyPoints; // list of points (>= 2)
public:
LibDrawBezier( LIB_COMPONENT * aParent );
LibDrawBezier( const LibDrawBezier& bezier );
~LibDrawBezier() { }
LIB_BEZIER( LIB_COMPONENT * aParent );
LIB_BEZIER( const LIB_BEZIER& bezier );
~LIB_BEZIER() { }
virtual wxString GetClass() const
{
return wxT( "LibDrawBezier" );
return wxT( "LIB_BEZIER" );
}
@ -1070,6 +1086,7 @@ protected:
virtual void DoMirrorHorizontal( const wxPoint& center );
virtual void DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] );
virtual int DoGetWidth( void ) { return m_Width; }
};
#endif // CLASSES_BODY_ITEMS_H

View File

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

View File

@ -98,7 +98,7 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
if( objectToSync == NULL )
return;
LibDrawPin* Pin = NULL;
LIB_PIN* Pin = NULL;
char Line[1024];
/* 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 )
break;
Pin = (LibDrawPin*) objectToSync;
Pin = (LIB_PIN*) objectToSync;
if( Pin->m_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
* @param DrawList = list of SCH_ITEMs
/**
* Test if point pos is on a pin end.
*
* @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;
LibDrawPin* Pin;
LIB_PIN* Pin;
wxPoint pinpos;
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
* du composant */
wxPoint ReturnPinPhysicalPosition( LIB_PIN* Pin, SCH_COMPONENT* DrawLibItem )
{
wxPoint PinPos = Pin->m_Pos;
@ -289,7 +288,8 @@ wxPoint ReturnPinPhysicalPosition( LibDrawPin* Pin,
NEGATE( PinPos.y );
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;
}
@ -392,7 +392,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
if( Entry == NULL )
break;
for( LibDrawPin* Pin = Entry->GetNextPin(); Pin != NULL;
for( LIB_PIN* Pin = Entry->GetNextPin(); Pin != NULL;
Pin = Entry->GetNextPin( Pin ) )
{
wxASSERT( Pin->Type() == COMPONENT_PIN_DRAW_TYPE );

View File

@ -59,57 +59,62 @@ WinEDA_bodygraphics_PropertiesFrame::WinEDA_bodygraphics_PropertiesFrame( WinEDA
/* Set the dialog items: */
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->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;
int fill_option = 0;
bool show_fill_option = false;
int fill_option = 0;
if( CurrentItem )
switch(CurrentItem->Type())
{
fill_option = CurrentItem->m_Fill;
switch( CurrentItem->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:
show_fill_option = TRUE;
fill_option = ((LibDrawCircle*)CurrentItem)->m_Fill;
m_GraphicShapeWidthCtrl->SetValue(((LibDrawCircle*)CurrentItem)->m_Width);
break;
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:
show_fill_option = TRUE;
fill_option = ((LibDrawPolyline*)CurrentItem)->m_Fill;
m_GraphicShapeWidthCtrl->SetValue(((LibDrawPolyline*)CurrentItem)->m_Width);
break;
show_fill_option = true;
default: break;
default:
break;
}
if ( show_fill_option ) m_Filled->SetSelection(fill_option);
else m_Filled->Enable(false);
m_GraphicShapeWidthCtrl->SetValue( CurrentItem->GetWidth() );
}
if ( show_fill_option )
m_Filled->SetSelection( fill_option );
else
m_Filled->Enable( false );
}
/*!
* 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
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;
bool m_skipCopyFromPanel;
/// a copy of the edited component's LibDrawFields
std::vector <LibDrawField> m_FieldsBuf;
/// a copy of the edited component's LIB_FIELDs
std::vector <LIB_FIELD> m_FieldsBuf;
public:
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.
*/
bool copyPanelToSelectedField();
void setRowItem( int aFieldNdx, const LibDrawField& aField );
void setRowItem( int aFieldNdx, const LIB_FIELD& aField );
/** Function updateDisplay
* 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();
LibDrawField blank( fieldNdx );
LIB_FIELD blank( fieldNdx );
m_FieldsBuf.push_back( blank );
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
// and in the fieldListCtrl
LibDrawField tmp = m_FieldsBuf[fieldNdx - 1];
LIB_FIELD tmp = m_FieldsBuf[fieldNdx - 1];
m_FieldsBuf[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;
}
@ -423,11 +423,11 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::InitBuffers( void )
m_FieldsBuf.push_back( m_LibEntry->m_Name );
// 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 );
// Display 12 fields (or more), and add missing fields
LibDrawField blank( 2 );
LIB_FIELD blank( 2 );
unsigned fcount = m_FieldsBuf.size();
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 );
@ -503,7 +503,7 @@ void DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB::copySelectedFieldToPanel()
if( fieldNdx >= m_FieldsBuf.size() ) // traps the -1 case too
return;
LibDrawField& field = m_FieldsBuf[fieldNdx];
LIB_FIELD& field = m_FieldsBuf[fieldNdx];
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
return true;
LibDrawField& field = m_FieldsBuf[fieldNdx];
LIB_FIELD& field = m_FieldsBuf[fieldNdx];
if( showCheckBox->GetValue() )
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:
WinEDA_LibeditFrame * m_Parent;
LibDrawText * m_GraphicText;
LIB_TEXT* m_GraphicText;
public:
Dialog_BodyGraphicText_Properties( WinEDA_LibeditFrame* aParent, LibDrawText * aGraphicText);
Dialog_BodyGraphicText_Properties( WinEDA_LibeditFrame* aParent,
LIB_TEXT* aGraphicText );
~Dialog_BodyGraphicText_Properties() {};
private:
@ -38,8 +39,9 @@ private:
};
Dialog_BodyGraphicText_Properties::Dialog_BodyGraphicText_Properties( WinEDA_LibeditFrame* aParent, LibDrawText * aGraphicText) :
Dialog_BodyGraphicText_Properties_base(aParent)
Dialog_BodyGraphicText_Properties::Dialog_BodyGraphicText_Properties( WinEDA_LibeditFrame* aParent,
LIB_TEXT* aGraphicText ) :
Dialog_BodyGraphicText_Properties_base( aParent )
{
m_Parent = aParent;
m_GraphicText = aGraphicText;
@ -239,7 +241,7 @@ void WinEDA_LibeditFrame::EditSymbolText(wxDC* DC, LIB_DRAW_ITEM* DrawItem)
Dialog_BodyGraphicText_Properties * frame =
new Dialog_BodyGraphicText_Properties( this,
(LibDrawText *) DrawItem );
(LIB_TEXT*) DrawItem );
frame->ShowModal();
frame->Destroy();
GetScreen()->SetModify();
@ -263,7 +265,7 @@ void WinEDA_LibeditFrame::RotateSymbolText(wxDC * DC)
90 deg Graphic text Rotation .
*/
{
LibDrawText * DrawItem = (LibDrawText *) m_drawItem;
LIB_TEXT* DrawItem = (LIB_TEXT *) m_drawItem;
if( DrawItem == NULL )
return;

View File

@ -82,7 +82,7 @@ SCH_ITEM* WinEDA_SchematicFrame::FindComponentAndItem(
bool DoCenterAndRedraw = FALSE;
bool NotFound = true;
wxString msg;
LibDrawPin* pin;
LIB_PIN* pin;
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;
/* Init des autres champs si predefinis dans la librairie */
LibDrawField* EntryField;
LIB_FIELD* EntryField;
for( EntryField = Entry->m_Fields; EntryField != NULL;
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)
&& (m_lastDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE) )
{
RepeatPinItem( DC, (LibDrawPin*) m_lastDrawItem );
RepeatPinItem( DC, (LIB_PIN*) m_lastDrawItem );
}
else
wxBell();

View File

@ -21,10 +21,10 @@
#include "libeditfrm.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()
{
wxString msg = _( "Component Library Editor: " );
@ -490,9 +490,7 @@ All changes will be lost. Discard changes?" ) ) )
*/
void WinEDA_LibeditFrame::CreateNewLibraryPart( wxCommandEvent& event )
{
int diag;
wxString msg;
LIB_COMPONENT* NewStruct;
wxString name;
if( m_component && GetScreen()->IsModify()
&& !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;
WinEDA_CreateCmpDialog Dialogbox( this );
diag = Dialogbox.ShowModal();
if( diag != wxID_OK )
DIALOG_LIB_NEW_COMPONENT dlg( this );
if( dlg.ShowModal() == wxID_CANCEL )
return;
msg = Dialogbox.ReturnCmpName();
if( msg.IsEmpty() )
if( dlg.GetName().IsEmpty() )
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 */
if( m_library )
{
if( m_library->FindEntry( msg ) )
if( m_library && m_library->FindEntry( name ) )
{
wxString msg;
msg.Printf( _( "Component \"%s\" already exists in \
library \"%s\"." ),
(const wxChar*) Dialogbox.ReturnCmpName(),
msg.Printf( _( "Component \"%s\" already exists in library \"%s\"." ),
(const wxChar*) name,
(const wxChar*) m_library->GetName() );
DisplayError( this, msg );
return;
}
}
NewStruct = new LIB_COMPONENT( msg );
Dialogbox.SetComponentData( *NewStruct );
if( NewStruct->m_Prefix.m_Text.IsEmpty() )
NewStruct->m_Prefix.m_Text = wxT( "U" );
NewStruct->m_Prefix.m_Text.MakeUpper();
LIB_COMPONENT* component = new LIB_COMPONENT( name );
component->m_Prefix.m_Text = dlg.GetReference();
component->SetPartCount( dlg.GetPartCount() );
component->SetConversion( dlg.GetAlternateBodyStyle() );
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 )
{
SAFE_DELETE( m_component );
}
m_component = NewStruct;
m_component = component;
m_unit = 1;
m_convert = 1;
DisplayLibInfos();
@ -549,6 +547,7 @@ library \"%s\"." ),
g_EditPinByPinIsOn = false;
m_lastDrawItem = NULL;
GetScreen()->ClearUndoRedoList();
GetScreen()->SetModify();
DrawPanel->Refresh();
}

View File

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

View File

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

View File

@ -142,7 +142,7 @@ private:
void CreatePin( wxDC* DC );
void DeletePin( wxDC* DC,
LIB_COMPONENT* LibEntry,
LibDrawPin* Pin );
LIB_PIN* Pin );
void StartMovePin( wxDC* DC );
// Edition de l'ancre
@ -161,10 +161,10 @@ private:
void RotateSymbolText( wxDC* DC );
void DeleteDrawPoly( wxDC* DC );
LIB_DRAW_ITEM* LocateItemUsingCursor();
void RotateField( wxDC* DC, LibDrawField* Field );
void PlaceField( wxDC* DC, LibDrawField* Field );
void EditField( wxDC* DC, LibDrawField* Field );
void StartMoveField( wxDC* DC, LibDrawField* field );
void RotateField( wxDC* DC, LIB_FIELD* Field );
void PlaceField( wxDC* DC, LIB_FIELD* Field );
void EditField( wxDC* DC, LIB_FIELD* Field );
void StartMoveField( wxDC* DC, LIB_FIELD* field );
public:
/* Block commands: */
@ -174,10 +174,10 @@ public:
void PlacePin( wxDC* DC );
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
void RepeatPinItem( wxDC* DC, LibDrawPin* Pin );
void RepeatPinItem( wxDC* DC, LIB_PIN* Pin );
protected:
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 )
*/
void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LibDrawField* field )
void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LIB_FIELD* field )
{
wxPoint startPos;
@ -89,7 +89,7 @@ static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if( parent == NULL )
return;
LibDrawField* Field = (LibDrawField*) parent->GetDrawItem();
LIB_FIELD* Field = (LIB_FIELD*) parent->GetDrawItem();
if( Field == NULL )
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 )
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 title;
@ -230,7 +230,7 @@ not conflict with any library entries." ),
* si un champ est en cours d'edition, modif de celui ci.
* 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 )

View File

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

View File

@ -620,11 +620,11 @@ static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
* @param pin_number = pin number (string)
* @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 )
{
LIB_COMPONENT* Entry;
LibDrawPin* Pin;
LIB_PIN* Pin;
int Unit, Convert;
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_ITEM* DrawStruct;
LIB_COMPONENT* Entry;
SCH_COMPONENT* schItem = NULL;
LibDrawPin* Pin = NULL;
LIB_PIN* Pin = NULL;
for( DrawStruct = DrawList; DrawStruct != NULL;
DrawStruct = DrawStruct->Next() )
@ -705,12 +705,13 @@ LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos,
if( Entry == NULL )
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
* So we must calculate the ref position relative to the component
*/
wxPoint libPos = RefPos - schItem->m_Pos;
Pin = (LibDrawPin*) Entry->LocateDrawItem( schItem->m_Multi,
Pin = (LIB_PIN*) Entry->LocateDrawItem( schItem->m_Multi,
schItem->m_Convert,
COMPONENT_PIN_DRAW_TYPE,
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 AddPinToComponentPinList( SCH_COMPONENT* Component,
DrawSheetPath* sheet,
LibDrawPin* PinEntry );
LIB_PIN* PinEntry );
static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component,
LIB_COMPONENT* Entry,
DrawSheetPath* Sheet_in );
@ -111,7 +111,7 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList( EDA_BaseStruct* DrawList
{
SCH_COMPONENT* Component = NULL;
LIB_COMPONENT* Entry;
LibDrawPin* Pin;
LIB_PIN* Pin;
s_SortedComponentPinList.clear();
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,
DrawSheetPath* sheetlist, LibDrawPin* Pin )
DrawSheetPath* sheetlist, LIB_PIN* Pin )
/*************************************************************************************/
/* 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;
SCH_COMPONENT* Component2;
LibDrawPin* pin;
LIB_PIN* pin;
DrawSheetPath* sheet;
wxString str, Reference = Component_in->GetRef( Sheet_in );

View File

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

View File

@ -29,7 +29,7 @@ void InstallPineditFrame( WinEDA_LibeditFrame* parent, wxDC* DC,
if ( ( parent->GetDrawItem() == NULL )
|| ( parent->GetDrawItem()->Type() == COMPONENT_PIN_DRAW_TYPE ) )
{
LibDrawPin * Pin = (LibDrawPin *) parent->GetDrawItem();
LIB_PIN* Pin = (LIB_PIN*) parent->GetDrawItem();
WinEDA_PinPropertiesFrame dlg( parent );
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 )
{
LibDrawPin * CurrentPin = (LibDrawPin *) parent->GetDrawItem();
LIB_PIN* CurrentPin = (LIB_PIN*) parent->GetDrawItem();
m_Parent = parent;
if ( CurrentPin )
@ -326,7 +326,7 @@ void WinEDA_PinPropertiesFrame::SetValuesInDialog(void)
/*******************************************************/
{
wxString number;
LibDrawPin * CurrentPin = (LibDrawPin *) m_Parent->GetDrawItem();
LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
wxString msg;
int tmp, ii;

View File

@ -34,7 +34,7 @@ int CodeShape[NBSHAPES] =
/* Routines locales */
static void CreateImagePins( LibDrawPin* Pin, int unit, int convert,
static void CreateImagePins( LIB_PIN* Pin, int unit, int convert,
bool asDeMorgan );
static void AbortPinMove( WinEDA_DrawPanel* Panel, wxDC* DC );
static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
@ -125,8 +125,8 @@ void WinEDA_PinPropertiesFrame::PinPropertiesAccept( wxCommandEvent& event )
*/
void WinEDA_LibeditFrame::InitEditOnePin()
{
LibDrawPin* Pin;
LibDrawPin* CurrentPin = (LibDrawPin*) m_drawItem;
LIB_PIN* Pin;
LIB_PIN* CurrentPin = (LIB_PIN*) m_drawItem;
if( m_component == NULL || CurrentPin == NULL
|| m_drawItem->Type() != COMPONENT_PIN_DRAW_TYPE )
@ -160,7 +160,7 @@ static void AbortPinMove( WinEDA_DrawPanel* Panel, wxDC* DC )
if( parent == NULL )
return;
LibDrawPin* CurrentPin = (LibDrawPin*) parent->GetDrawItem();
LIB_PIN* CurrentPin = (LIB_PIN*) parent->GetDrawItem();
if( CurrentPin == NULL || CurrentPin->Type() != COMPONENT_PIN_DRAW_TYPE )
return;
@ -184,8 +184,8 @@ static void AbortPinMove( WinEDA_DrawPanel* Panel, wxDC* DC )
*/
void WinEDA_LibeditFrame::PlacePin( wxDC* DC )
{
LibDrawPin* Pin;
LibDrawPin* CurrentPin = (LibDrawPin*) m_drawItem;
LIB_PIN* Pin;
LIB_PIN* CurrentPin = (LIB_PIN*) m_drawItem;
bool ask_for_pin = true;
wxPoint newpos;
bool status;
@ -254,8 +254,8 @@ another pin. Continue?" ) );
void WinEDA_PinPropertiesFrame::SetPinOrientation( int neworient )
{
LibDrawPin* CurrentPin = (LibDrawPin*) m_Parent->GetDrawItem();
LibDrawPin* Pin, * RefPin = CurrentPin;
LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
LIB_PIN* Pin, * RefPin = CurrentPin;
if( CurrentPin == NULL || CurrentPin->GetParent() == NULL || RefPin == NULL )
return;
@ -285,8 +285,8 @@ void WinEDA_PinPropertiesFrame::SetPinOrientation( int neworient )
*/
void WinEDA_LibeditFrame::StartMovePin( wxDC* DC )
{
LibDrawPin* Pin;
LibDrawPin* CurrentPin = (LibDrawPin*) m_drawItem;
LIB_PIN* Pin;
LIB_PIN* CurrentPin = (LIB_PIN*) m_drawItem;
wxPoint startPos;
/* Marquage des pins a traiter */
@ -330,7 +330,7 @@ static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if( parent == NULL )
return;
LibDrawPin* CurrentPin = (LibDrawPin*) parent->GetDrawItem();
LIB_PIN* CurrentPin = (LIB_PIN*) parent->GetDrawItem();
if( CurrentPin == NULL || CurrentPin->Type() != COMPONENT_PIN_DRAW_TYPE )
return;
@ -372,8 +372,8 @@ void WinEDA_PinPropertiesFrame::SetPinShape( int newshape )
* des autres unites de la seule forme convert courante
*/
{
LibDrawPin* Pin;
LibDrawPin* CurrentPin = (LibDrawPin*) m_Parent->GetDrawItem();
LIB_PIN* Pin;
LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
if( CurrentPin )
{
@ -401,8 +401,8 @@ void WinEDA_PinPropertiesFrame::SetPinType( int newtype )
* des autres unites du boitier
*/
{
LibDrawPin* Pin;
LibDrawPin* CurrentPin = (LibDrawPin*) m_Parent->GetDrawItem();
LIB_PIN* Pin;
LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
if( CurrentPin == NULL || CurrentPin->GetParent() == NULL )
return;
@ -429,8 +429,8 @@ void WinEDA_PinPropertiesFrame::SetPinName( const wxString& newname, int newsize
* si newsize < 0 : pas de changement de taille
*/
{
LibDrawPin* Pin;
LibDrawPin* CurrentPin = (LibDrawPin*) m_Parent->GetDrawItem();
LIB_PIN* Pin;
LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
wxString buf;
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
*/
{
LibDrawPin* Pin;
LibDrawPin* CurrentPin = (LibDrawPin*) m_Parent->GetDrawItem();
LIB_PIN* Pin;
LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
wxString buf;
buf = newnum;
@ -503,7 +503,7 @@ void WinEDA_PinPropertiesFrame::SetPinNum( const wxString& newnum, int newsize )
/*************************************************/
void WinEDA_LibeditFrame::DeletePin( wxDC* DC,
LIB_COMPONENT* LibEntry,
LibDrawPin* Pin )
LIB_PIN* Pin )
/*************************************************/
/* 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
*/
{
LibDrawPin* tmp;
LIB_PIN* tmp;
wxPoint PinPos;
if( LibEntry == NULL || Pin == NULL )
@ -547,7 +547,7 @@ void WinEDA_LibeditFrame::DeletePin( wxDC* DC,
*/
void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
{
LibDrawPin* CurrentPin;
LIB_PIN* CurrentPin;
bool showPinText = true;
if( m_component == NULL )
@ -556,7 +556,7 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
/* Effacement des flags */
m_component->ClearStatus();
CurrentPin = new LibDrawPin( m_component );
CurrentPin = new LIB_PIN( m_component );
m_drawItem = CurrentPin;
@ -626,9 +626,9 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
void WinEDA_PinPropertiesFrame::SetPinAttributes( bool draw, bool unit,
bool convert )
{
LibDrawPin* tmp;
LibDrawPin* Pin;
LibDrawPin* CurrentPin = (LibDrawPin*) m_Parent->GetDrawItem();
LIB_PIN* tmp;
LIB_PIN* Pin;
LIB_PIN* CurrentPin = (LIB_PIN*) m_Parent->GetDrawItem();
if( CurrentPin == NULL )
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 )
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 )
{
int ii;
LibDrawPin* NewPin;
LIB_PIN* NewPin;
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 */
if( CreateConv == true )
{
NewPin = (LibDrawPin*) Pin->GenCopy();
NewPin = (LIB_PIN*) Pin->GenCopy();
if( Pin->m_Convert > 1 )
NewPin->m_Convert = 1;
else
@ -789,7 +789,7 @@ static void CreateImagePins( LibDrawPin* Pin, int unit, int convert,
continue; /* Pin commune a toutes les unites */
/* Creation pour la representation "normale" */
NewPin = (LibDrawPin*) Pin->GenCopy();
NewPin = (LIB_PIN*) Pin->GenCopy();
if( convert != 0 )
NewPin->m_Convert = 1;
NewPin->m_Unit = ii;
@ -799,7 +799,7 @@ static void CreateImagePins( LibDrawPin* Pin, int unit, int convert,
if( CreateConv == false )
continue;
NewPin = (LibDrawPin*)Pin->GenCopy();
NewPin = (LIB_PIN*)Pin->GenCopy();
NewPin->m_Convert = 2;
if( Pin->m_Unit != 0 )
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":
* - Change pin text size (name or num) (range 10 .. 1000 mil)
* - 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 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) */
{
LibDrawPin* Pin;
LIB_PIN* Pin;
wxString msg;
int ox = 0, oy = 0;
@ -878,7 +876,7 @@ void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LibDrawPin* SourcePin )
|| SourcePin->Type() != COMPONENT_PIN_DRAW_TYPE )
return;
Pin = (LibDrawPin*)SourcePin->GenCopy();
Pin = (LIB_PIN*)SourcePin->GenCopy();
m_component->AddDrawItem( Pin );
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 )
{
const LibDrawPin* Ref = *(LibDrawPin**) ref;
const LibDrawPin* Tst = *(LibDrawPin**) tst;
const LIB_PIN* Ref = *(LIB_PIN**) ref;
const LIB_PIN* Tst = *(LIB_PIN**) tst;
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 )
{
int nb_pins, ii, error;
LibDrawPin* Pin;
LibDrawPin** PinList;
LIB_PIN* Pin;
LIB_PIN** PinList;
wxString msg;
if( m_component == NULL )
@ -940,7 +938,7 @@ void WinEDA_LibeditFrame::OnCheckComponent( wxCommandEvent& event )
nb_pins++;
}
PinList = (LibDrawPin**) MyZMalloc( (nb_pins + 1) * sizeof(LibDrawPin*) );
PinList = (LIB_PIN**) MyZMalloc( (nb_pins + 1) * sizeof(LIB_PIN*) );
Pin = m_component->GetNextPin();
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
qsort( PinList, nb_pins, sizeof(LibDrawPin*), sort_by_pin_number );
qsort( PinList, nb_pins, sizeof(LIB_PIN*), sort_by_pin_number );
// Controle des duplicates:
error = 0;
for( ii = 1; ii < nb_pins; ii++ )
{
wxString aux_msg, StringPinNum;
LibDrawPin* curr_pin = PinList[ii];
LIB_PIN* curr_pin = PinList[ii];
Pin = PinList[ii - 1];
if( Pin->m_PinNum != curr_pin->m_PinNum

View File

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

View File

@ -22,7 +22,7 @@
/* Routines locales */
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,
wxDC* DC,
bool erase );
@ -83,27 +83,27 @@ void WinEDA_bodygraphics_PropertiesFrame::bodygraphics_PropertiesAccept( wxComma
switch( item->Type() )
{
case COMPONENT_ARC_DRAW_TYPE:
( (LibDrawArc*) item )->m_Fill = FlSymbol_Fill;
( (LibDrawArc*) item )->m_Width =
( (LIB_ARC*) item )->m_Fill = FlSymbol_Fill;
( (LIB_ARC*) item )->m_Width =
m_GraphicShapeWidthCtrl->GetValue();
break;
case COMPONENT_CIRCLE_DRAW_TYPE:
( (LibDrawCircle*) item )->m_Fill = FlSymbol_Fill;
( (LibDrawCircle*) item )->m_Width =
( (LIB_CIRCLE*) item )->m_Fill = FlSymbol_Fill;
( (LIB_CIRCLE*) item )->m_Width =
m_GraphicShapeWidthCtrl->GetValue();
break;
case COMPONENT_RECT_DRAW_TYPE:
( (LibDrawSquare*) item )->m_Fill = FlSymbol_Fill;
( (LibDrawSquare*) item )->m_Width =
( (LIB_RECTANGLE*) item )->m_Fill = FlSymbol_Fill;
( (LIB_RECTANGLE*) item )->m_Width =
m_GraphicShapeWidthCtrl->GetValue();
break;
case COMPONENT_POLYLINE_DRAW_TYPE:
( (LibDrawPolyline*) item )->m_Fill =
( (LIB_POLYLINE*) item )->m_Fill =
FlSymbol_Fill;
( (LibDrawPolyline*) item )->m_Width =
( (LIB_POLYLINE*) item )->m_Width =
m_GraphicShapeWidthCtrl->GetValue();
break;
@ -188,7 +188,7 @@ LIB_DRAW_ITEM* WinEDA_LibeditFrame::CreateGraphicItem( LIB_COMPONENT* LibEntry,
{
case ID_LIBEDIT_BODY_ARC_BUTT:
{
LibDrawArc* Arc = new LibDrawArc( LibEntry );
LIB_ARC* Arc = new LIB_ARC( LibEntry );
m_drawItem = Arc;
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:
{
LibDrawCircle* Circle = new LibDrawCircle( LibEntry );
LIB_CIRCLE* Circle = new LIB_CIRCLE( LibEntry );
m_drawItem = Circle;
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:
{
LibDrawSquare* Square = new LibDrawSquare( LibEntry );
LIB_RECTANGLE* Square = new LIB_RECTANGLE( LibEntry );
m_drawItem = Square;
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:
{
LibDrawPolyline* polyline = new LibDrawPolyline( LibEntry );
LIB_POLYLINE* polyline = new LIB_POLYLINE( LibEntry );
m_drawItem = polyline;
wxPoint point = GetScreen()->m_Curseur;
NEGATE( point.y );
@ -239,7 +239,7 @@ LIB_DRAW_ITEM* WinEDA_LibeditFrame::CreateGraphicItem( LIB_COMPONENT* LibEntry,
case COMPONENT_LINE_DRAW_TYPE:
{
LibDrawSegment* Segment = new LibDrawSegment( LibEntry );
LIB_SEGMENT* Segment = new LIB_SEGMENT( LibEntry );
m_drawItem = Segment;
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:
{
LibDrawText* Text = new LibDrawText( LibEntry );
LIB_TEXT* Text = new LIB_TEXT( LibEntry );
m_drawItem = Text;
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;
NEGATE( pos.y );
( (LibDrawPolyline*) m_drawItem )->AddPoint( pos );
( (LIB_POLYLINE*) m_drawItem )->AddPoint( pos );
}
break;
@ -432,12 +432,12 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{
int Color = ReturnLayerColor( LAYER_DEVICE );
GRDashedLine( &panel->m_ClipBox, DC, ArcStartX, -ArcStartY,
( (LibDrawArc*) item )->m_Pos.x,
-( (LibDrawArc*) item )->m_Pos.y,
( (LIB_ARC*) item )->m_Pos.x,
-( (LIB_ARC*) item )->m_Pos.y,
0, Color );
GRDashedLine( &panel->m_ClipBox, DC, ArcEndX, -ArcEndY,
( (LibDrawArc*) item )->m_Pos.x,
-( (LibDrawArc*) item )->m_Pos.y,
( (LIB_ARC*) item )->m_Pos.x,
-( (LIB_ARC*) item )->m_Pos.y,
0, Color );
}
}
@ -454,34 +454,34 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
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;
case COMPONENT_CIRCLE_DRAW_TYPE:
dx = ( (LibDrawCircle*) item )->m_Pos.x - curr_pos.x;
dy = ( (LibDrawCircle*) item )->m_Pos.y - curr_pos.y;
( (LibDrawCircle*) item )->m_Radius =
dx = ( (LIB_CIRCLE*) item )->m_Pos.x - curr_pos.x;
dy = ( (LIB_CIRCLE*) item )->m_Pos.y - curr_pos.y;
( (LIB_CIRCLE*) item )->m_Radius =
(int) sqrt( ( (double) dx * dx ) + ( (double) dy * dy ) );
( (LibDrawCircle*) item )->m_Fill = FlSymbol_Fill;
( (LIB_CIRCLE*) item )->m_Fill = FlSymbol_Fill;
break;
case COMPONENT_RECT_DRAW_TYPE:
( (LibDrawSquare*) item )->m_End = curr_pos;
( (LibDrawSquare*) item )->m_Fill = FlSymbol_Fill;
( (LIB_RECTANGLE*) item )->m_End = curr_pos;
( (LIB_RECTANGLE*) item )->m_Fill = FlSymbol_Fill;
break;
case COMPONENT_POLYLINE_DRAW_TYPE:
{
unsigned idx = ( (LibDrawPolyline*) item )->GetCornerCount() - 1;
( (LibDrawPolyline*) item )->m_PolyPoints[idx] = curr_pos;
( (LibDrawPolyline*) item )->m_Fill = FlSymbol_Fill;
unsigned idx = ( (LIB_POLYLINE*) item )->GetCornerCount() - 1;
( (LIB_POLYLINE*) item )->m_PolyPoints[idx] = curr_pos;
( (LIB_POLYLINE*) item )->m_Fill = FlSymbol_Fill;
}
break;
case COMPONENT_LINE_DRAW_TYPE:
( (LibDrawSegment*) item )->m_End = curr_pos;
( (LIB_SEGMENT*) item )->m_End = curr_pos;
break;
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 );
GRDashedLine( &panel->m_ClipBox, DC, ArcStartX, -ArcStartY,
( (LibDrawArc*) item )->m_Pos.x,
-( (LibDrawArc*) item )->m_Pos.y,
( (LIB_ARC*) item )->m_Pos.x,
-( (LIB_ARC*) item )->m_Pos.y,
0, Color );
GRDashedLine( &panel->m_ClipBox, DC, ArcEndX, -ArcEndY,
( (LibDrawArc*) item )->m_Pos.x,
-( (LibDrawArc*) item )->m_Pos.y,
( (LIB_ARC*) item )->m_Pos.x,
-( (LIB_ARC*) item )->m_Pos.y,
0, Color );
}
}
@ -554,19 +554,19 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
switch( m_drawItem->Type() )
{
case COMPONENT_ARC_DRAW_TYPE:
( (LibDrawArc*) m_drawItem )->m_Fill = FlSymbol_Fill;
( (LIB_ARC*) m_drawItem )->m_Fill = FlSymbol_Fill;
break;
case COMPONENT_CIRCLE_DRAW_TYPE:
( (LibDrawCircle*) m_drawItem )->m_Fill = FlSymbol_Fill;
( (LIB_CIRCLE*) m_drawItem )->m_Fill = FlSymbol_Fill;
break;
case COMPONENT_RECT_DRAW_TYPE:
( (LibDrawSquare*) m_drawItem )->m_Fill = FlSymbol_Fill;
( (LIB_RECTANGLE*) m_drawItem )->m_Fill = FlSymbol_Fill;
break;
case COMPONENT_POLYLINE_DRAW_TYPE:
( (LibDrawPolyline*) m_drawItem )->m_Fill = FlSymbol_Fill;
( (LIB_POLYLINE*) m_drawItem )->m_Fill = FlSymbol_Fill;
break;
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
@ -705,7 +705,7 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
|| m_drawItem->Type() != COMPONENT_POLYLINE_DRAW_TYPE )
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,
DefaultTransformMatrix );

View File

@ -31,9 +31,8 @@ class DrawSheetStruct;
class DrawSheetPath;
class Hierarchical_PIN_Sheet_Struct;
class SCH_COMPONENT;
class LibDrawField;
class SCH_CMP_FIELD;
class LibDrawPin;
class LIB_PIN;
class DrawJunctionStruct;
/* enum used in RotationMiroir() */
@ -445,7 +444,7 @@ public:
// Test des points de connexion en l'air (dangling ends)
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:
/**