Commit ee918d7d authored by stambaughw's avatar stambaughw

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.
parent 498f0c91
......@@ -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
......
......@@ -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 )
......
......@@ -794,9 +794,9 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
* - a BUS
*/
{
EDA_BaseStruct* item;
LibDrawPin* pin;
SCH_COMPONENT* LibItem = NULL;
EDA_BaseStruct* item;
LIB_PIN* pin;
SCH_COMPONENT* LibItem = NULL;
Hierarchical_PIN_Sheet_Struct* pinsheet;
wxPoint itempos;
......
......@@ -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,8 +151,8 @@ 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,
const int aTransMat[2][2] )
bool LIB_TEXT::HitTest( wxPoint aPosRef, int aThreshold,
const int aTransMat[2][2] )
{
wxPoint physicalpos = TransformCoordinate( aTransMat, m_Pos );
wxPoint tmp = 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,8 +249,8 @@ void LibDrawText::DoMirrorHorizontal( const wxPoint& center )
}
void LibDrawText::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] )
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,9 +285,9 @@ int LibDrawText::GetPenSize( )
return pensize;
}
void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] )
void LIB_TEXT::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] )
{
wxPoint pos1, pos2;
......@@ -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;
......
......@@ -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 )
{
......
......@@ -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,8 +123,8 @@ public:
* m_TextInside in mils */
bool m_DrawPinNum;
bool m_DrawPinName;
DLIST<LibDrawField> m_Fields; /* Auxiliary Field list (id >= 2 ) */
long m_LastDate; // Last change Date
DLIST<LIB_FIELD> m_Fields; /* Auxiliary Field list (id >= 2 ) */
long m_LastDate; // Last change Date
protected:
int m_UnitCount; /* Units (or sections) per package */
......@@ -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,10 +244,10 @@ 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,
COMPONENT_PIN_DRAW_TYPE );
return (LIB_PIN*) GetNextDrawItem( (LIB_DRAW_ITEM*) item,
COMPONENT_PIN_DRAW_TYPE );
}
/**
......
......@@ -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,9 +266,9 @@ 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,
const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] )
void LIB_FIELD::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC,
const wxPoint& aOffset, int aColor, int aDrawMode,
void* aData, const int aTransformMatrix[2][2] )
{
wxPoint text_pos;
int color;
......@@ -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,8 +345,8 @@ 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,
const int aTransMat[2][2] )
bool LIB_FIELD::HitTest( wxPoint aPosRef, int aThreshold,
const int aTransMat[2][2] )
{
int extraCharCount = 0;
// Reference designator text has one or 2 additional character (displays
......@@ -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,8 +477,8 @@ void LibDrawField::DoMirrorHorizontal( const wxPoint& center )
}
void LibDrawField::DoPlot( PLOTTER* plotter, const wxPoint& offset, bool fill,
const int transform[2][2] )
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;
......
......@@ -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
......@@ -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 )
......
......@@ -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.
*
......
This diff is collapsed.
......@@ -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,19 +209,19 @@ 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;
m_HJustify = aSource.m_HJustify;
m_VJustify = aSource.m_VJustify;
m_Italic = aSource.m_Italic;
m_Bold = aSource.m_Bold;
m_Width = aSource.m_Width;
m_Orient = aSource.m_Orient;
m_Size = aSource.m_Size;
m_HJustify = aSource.m_HJustify;
m_VJustify = aSource.m_VJustify;
m_Italic = aSource.m_Italic;
m_Bold = aSource.m_Bold;
m_Width = aSource.m_Width;
m_Attributs = aSource.m_Attributs;
m_Mirror = aSource.m_Mirror;
m_Mirror = aSource.m_Mirror;
}
/**
......
......@@ -15,6 +15,7 @@
class SCH_COMPONENT;
class LIB_FIELD;
/**
......@@ -23,7 +24,7 @@ class SCH_COMPONENT;
* reference designator, footprint, and user definable name-value pairs of
* arbitrary purpose.
*/
class SCH_CMP_FIELD : public SCH_ITEM, public EDA_TextStruct
class SCH_CMP_FIELD : public SCH_ITEM, public EDA_TextStruct
{
public:
int m_FieldId; // Field indicator type (REFERENCE, VALUE or other id)
......@@ -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
......
......@@ -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( "??" );
......
This diff is collapsed.
......@@ -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
......@@ -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;
......
......@@ -98,8 +98,8 @@ void WinEDA_SchematicFrame::SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
if( objectToSync == NULL )
return;
LibDrawPin* Pin = NULL;
char Line[1024];
LIB_PIN* Pin = NULL;
char Line[1024];
/* Cross probing to pcbnew if a pin or a component is found */
switch( objectToSync->Type() )
......@@ -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;
......
......@@ -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 );
......
......@@ -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;
case COMPONENT_POLYLINE_DRAW_TYPE:
show_fill_option = TRUE;
fill_option = ((LibDrawPolyline*)CurrentItem)->m_Fill;
m_GraphicShapeWidthCtrl->SetValue(((LibDrawPolyline*)CurrentItem)->m_Width);
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;
......
/////////////////////////////////////////////////////////////////////////////
// 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_
This diff is collapsed.
#ifndef APSTUDIO_INVOKED
#include "wx/msw/wx.rc"
#endif
......@@ -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;
......
#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 );
}
This diff is collapsed.
#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__
///////////////////////////////////////////////////////////////////////////
// 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()
{
}
///////////////////////////////////////////////////////////////////////////
// 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__
......@@ -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;
......
......@@ -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;
......
......@@ -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() )
{
......
......@@ -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();
......
......@@ -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 && m_library->FindEntry( name ) )
{
if( m_library->FindEntry( msg ) )
{
wxString msg;
msg.Printf( _( "Component \"%s\" already exists in \
library \"%s\"." ),
(const wxChar*) Dialogbox.ReturnCmpName(),
(const wxChar*) m_library->GetName() );
DisplayError( this, msg );
return;
}
wxString msg;
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�
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();
}
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -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;
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment