Commit 8570d331 authored by stambaughw's avatar stambaughw

Component library editor improvements and minor bug fixes.

* Component library objects renamed for improved readability.
* Fields now move when selected in library editor.
* Add copy constructor to all library draw and library component objects.
* Added copy constructor to EDA_BaseStruct.
* Delete base screen in WinEDA_DrawFrame destructor to prevent potential memory leak.
* Fixed memory access bug when replacing and adding a component to library.
* Moved library component block manipulation code into component object.
* Removed all of the global variables used by the library editor main window object.
* The usual code cleaning and refactoring.
parent fb52997c
...@@ -41,6 +41,18 @@ EDA_BaseStruct::EDA_BaseStruct( KICAD_T idType ) ...@@ -41,6 +41,18 @@ EDA_BaseStruct::EDA_BaseStruct( KICAD_T idType )
} }
EDA_BaseStruct::EDA_BaseStruct( const EDA_BaseStruct& base )
{
m_StructType = base.m_StructType;
m_Parent = base.m_Parent;
m_Son = base.m_Son;
m_Flags = base.m_Flags;
m_TimeStamp = base.m_TimeStamp;
m_Status = base.m_Status;
m_Selected = base.m_Selected;
}
/********************************************/ /********************************************/
void EDA_BaseStruct::InitVars() void EDA_BaseStruct::InitVars()
/********************************************/ /********************************************/
......
...@@ -58,7 +58,7 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, ...@@ -58,7 +58,7 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
MsgPanel = NULL; MsgPanel = NULL;
m_CurrentScreen = NULL; m_CurrentScreen = NULL;
m_ID_current_state = 0; m_ID_current_state = 0;
m_ID_last_state = 0; m_ID_last_state = 0;
m_HTOOL_current_state = 0; m_HTOOL_current_state = 0;
m_Draw_Axis = FALSE; // TRUE pour avoir les axes dessines m_Draw_Axis = FALSE; // TRUE pour avoir les axes dessines
m_Draw_Grid = FALSE; // TRUE pour avoir la axes dessinee m_Draw_Grid = FALSE; // TRUE pour avoir la axes dessinee
...@@ -108,10 +108,10 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype, ...@@ -108,10 +108,10 @@ WinEDA_DrawFrame::WinEDA_DrawFrame( wxWindow* father, int idtype,
} }
/****************************************/
WinEDA_DrawFrame::~WinEDA_DrawFrame() WinEDA_DrawFrame::~WinEDA_DrawFrame()
/****************************************/
{ {
if( m_CurrentScreen != NULL )
delete m_CurrentScreen;
} }
......
...@@ -101,7 +101,6 @@ set(EESCHEMA_SRCS ...@@ -101,7 +101,6 @@ set(EESCHEMA_SRCS
plotps.cpp plotps.cpp
plotdxf.cpp plotdxf.cpp
read_from_file_schematic_items_descriptions.cpp read_from_file_schematic_items_descriptions.cpp
savelib.cpp
save_schemas.cpp save_schemas.cpp
schedit.cpp schedit.cpp
schematic_undo_redo.cpp schematic_undo_redo.cpp
......
...@@ -10,8 +10,9 @@ ...@@ -10,8 +10,9 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "wxstruct.h" #include "wxstruct.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "class_library.h"
#include "protos.h" #include "protos.h"
#include "netlist.h" #include "netlist.h"
......
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
#include "confirm.h" #include "confirm.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "gestfich.h" #include "gestfich.h"
#include "libcmp.h"
#include "general.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "general.h"
/* Variables Locales */ /* Variables Locales */
/*******************************************************************************************/ /*******************************************************************************************/
......
...@@ -12,31 +12,36 @@ ...@@ -12,31 +12,36 @@
#include "block_commande.h" #include "block_commande.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
#include "class_library.h"
#include "protos.h" #include "protos.h"
/* Variables Locales */ /* Variables Locales */
// Imported functions: // Imported functions:
void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector ); void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList,
void MirrorListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& Center ); const wxPoint aMoveVector );
void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList ); void MirrorListOfItems( PICKED_ITEMS_LIST& aItemsList,
void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector ); wxPoint& Center );
void DeleteItemsInList( WinEDA_DrawPanel* panel,
PICKED_ITEMS_LIST& aItemsList );
void DuplicateItemsInList( SCH_SCREEN* screen,
PICKED_ITEMS_LIST& aItemsList,
const wxPoint aMoveVector );
/* Fonctions exportees */ /* Fonctions exportees */
/* Fonctions Locales */ /* Fonctions Locales */
static void CollectStructsToDrag( SCH_SCREEN* screen ); static void CollectStructsToDrag( SCH_SCREEN* screen );
static void AddPickedItem( SCH_SCREEN* screen, wxPoint aPosition ); static void AddPickedItem( SCH_SCREEN* screen, wxPoint aPosition );
static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem, static LIB_DRAW_ITEM* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
wxPoint& aPosition ); wxPoint& aPosition );
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel,
wxDC* DC, wxDC* DC,
bool erase ); bool erase );
static void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList ); static void SaveStructListForPaste( PICKED_ITEMS_LIST& aItemsList );
/*************************************************************************/ /*************************************************************************/
...@@ -645,7 +650,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -645,7 +650,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
if( Struct->Type() == TYPE_SCH_COMPONENT ) if( Struct->Type() == TYPE_SCH_COMPONENT )
{ {
// Add all pins of the selected component to list // Add all pins of the selected component to list
LibEDA_BaseStruct* DrawItem; LIB_DRAW_ITEM* DrawItem;
wxPoint pos; wxPoint pos;
DrawItem = GetNextPinPosition( (SCH_COMPONENT*) Struct, pos ); DrawItem = GetNextPinPosition( (SCH_COMPONENT*) Struct, pos );
while( DrawItem ) while( DrawItem )
...@@ -840,8 +845,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -840,8 +845,8 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
/*********************************************************************************/ /*********************************************************************************/
static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem, static LIB_DRAW_ITEM* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
wxPoint& aPosition ) wxPoint& aPosition )
/*********************************************************************************/ /*********************************************************************************/
/** GetNextPinPosition() /** GetNextPinPosition()
...@@ -856,9 +861,9 @@ static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem, ...@@ -856,9 +861,9 @@ static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* aDrawLibItem,
*/ */
{ {
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
static LibEDA_BaseStruct* NextItem; static LIB_DRAW_ITEM* NextItem;
static int Multi, convert, TransMat[2][2]; static int Multi, convert, TransMat[2][2];
LibEDA_BaseStruct* DEntry; LIB_DRAW_ITEM* DEntry;
int orient; int orient;
LibDrawPin* Pin; LibDrawPin* Pin;
static wxPoint CmpPosition; static wxPoint CmpPosition;
......
This diff is collapsed.
...@@ -14,17 +14,16 @@ ...@@ -14,17 +14,16 @@
#include "kicad_string.h" #include "kicad_string.h"
#include "gestfich.h" #include "gestfich.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "class_library.h"
#include "netlist.h" #include "netlist.h"
#include "protos.h"
#include "dialog_build_BOM.h" #include "dialog_build_BOM.h"
#include "protos.h"
/* object used in build BOM to handle the list of labels in schematic /* object used in build BOM to handle the list of labels in schematic
* because in a complex hierarchy, a label is used more than once, * because in a complex hierarchy, a label is used more than once,
* and had more than one sheet path, so we must create a flat list of labels * and had more than one sheet path, so we must create a flat list of labels
......
...@@ -9,7 +9,7 @@ ...@@ -9,7 +9,7 @@
#include "confirm.h" #include "confirm.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "classes_body_items.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
......
...@@ -10,7 +10,6 @@ ...@@ -10,7 +10,6 @@
#include "confirm.h" #include "confirm.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
......
...@@ -15,7 +15,7 @@ ...@@ -15,7 +15,7 @@
#include "trigo.h" #include "trigo.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "classes_body_items.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
...@@ -23,7 +23,7 @@ ...@@ -23,7 +23,7 @@
LibDrawText::LibDrawText(LIB_COMPONENT * aParent) : LibDrawText::LibDrawText(LIB_COMPONENT * aParent) :
LibEDA_BaseStruct( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE, aParent ), LIB_DRAW_ITEM( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE, aParent ),
EDA_TextStruct() EDA_TextStruct()
{ {
m_Size = wxSize( 50, 50 ); m_Size = wxSize( 50, 50 );
...@@ -172,7 +172,7 @@ bool LibDrawText::HitTest( wxPoint aPosRef, int aThreshold, ...@@ -172,7 +172,7 @@ bool LibDrawText::HitTest( wxPoint aPosRef, int aThreshold,
} }
LibEDA_BaseStruct* LibDrawText::DoGenCopy() LIB_DRAW_ITEM* LibDrawText::DoGenCopy()
{ {
LibDrawText* newitem = new LibDrawText(NULL); LibDrawText* newitem = new LibDrawText(NULL);
...@@ -189,11 +189,11 @@ LibEDA_BaseStruct* LibDrawText::DoGenCopy() ...@@ -189,11 +189,11 @@ LibEDA_BaseStruct* LibDrawText::DoGenCopy()
newitem->m_Bold = m_Bold; newitem->m_Bold = m_Bold;
newitem->m_HJustify = m_HJustify; newitem->m_HJustify = m_HJustify;
newitem->m_VJustify = m_VJustify; newitem->m_VJustify = m_VJustify;
return (LibEDA_BaseStruct*) newitem; return (LIB_DRAW_ITEM*) newitem;
} }
bool LibDrawText::DoCompare( const LibEDA_BaseStruct& other ) const bool LibDrawText::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_GRAPHIC_TEXT_DRAW_TYPE );
...@@ -220,6 +220,12 @@ bool LibDrawText::DoTestInside( EDA_Rect& rect ) ...@@ -220,6 +220,12 @@ bool LibDrawText::DoTestInside( EDA_Rect& rect )
} }
void LibDrawText::DoMove( const wxPoint& newPosition )
{
m_Pos = newPosition;
}
/** Function GetPenSize /** Function GetPenSize
* @return the size of the "pen" that be used to draw or plot this item * @return the size of the "pen" that be used to draw or plot this item
*/ */
...@@ -273,7 +279,7 @@ void LibDrawText::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -273,7 +279,7 @@ void LibDrawText::DisplayInfo( WinEDA_DrawFrame* frame )
{ {
wxString msg; wxString msg;
LibEDA_BaseStruct::DisplayInfo( frame ); LIB_DRAW_ITEM::DisplayInfo( frame );
msg = ReturnStringFromValue( g_UnitMetric, m_Width, msg = ReturnStringFromValue( g_UnitMetric, m_Width,
EESCHEMA_INTERNAL_UNIT, true ); EESCHEMA_INTERNAL_UNIT, true );
......
...@@ -19,7 +19,6 @@ ...@@ -19,7 +19,6 @@
#include "confirm.h" #include "confirm.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
......
...@@ -18,7 +18,6 @@ ...@@ -18,7 +18,6 @@
#include "drawtxt.h" #include "drawtxt.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
......
This diff is collapsed.
...@@ -53,6 +53,8 @@ public: ...@@ -53,6 +53,8 @@ public:
public: public:
CMP_LIB_ENTRY( LibrEntryType CmpType, const wxString& name, CMP_LIB_ENTRY( LibrEntryType CmpType, const wxString& name,
CMP_LIBRARY* lib = NULL ); CMP_LIBRARY* lib = NULL );
CMP_LIB_ENTRY( const CMP_LIB_ENTRY& entry, CMP_LIBRARY* lib = NULL );
virtual ~CMP_LIB_ENTRY(); virtual ~CMP_LIB_ENTRY();
virtual wxString GetClass() const virtual wxString GetClass() const
...@@ -123,7 +125,7 @@ public: ...@@ -123,7 +125,7 @@ public:
bool m_DrawPinNum; bool m_DrawPinNum;
bool m_DrawPinName; bool m_DrawPinName;
DLIST<LibDrawField> m_Fields; /* Auxiliary Field list (id >= 2 ) */ DLIST<LibDrawField> m_Fields; /* Auxiliary Field list (id >= 2 ) */
LibEDA_BaseStruct* m_Drawings; /* How to draw this part */ LIB_DRAW_ITEM * m_Drawings; /* How to draw this part */
long m_LastDate; // Last change Date long m_LastDate; // Last change Date
public: public:
...@@ -134,6 +136,8 @@ public: ...@@ -134,6 +136,8 @@ public:
LIB_COMPONENT( const wxString& name, CMP_LIBRARY* lib = NULL ); LIB_COMPONENT( const wxString& name, CMP_LIBRARY* lib = NULL );
LIB_COMPONENT( const LIB_COMPONENT& component, CMP_LIBRARY* lib = NULL );
~LIB_COMPONENT(); ~LIB_COMPONENT();
EDA_Rect GetBoundaryBox( int Unit, int Convert ); EDA_Rect GetBoundaryBox( int Unit, int Convert );
...@@ -207,7 +211,7 @@ public: ...@@ -207,7 +211,7 @@ public:
* @param panel - Panel to remove part from. * @param panel - Panel to remove part from.
* @param dc - Device context to remove part from. * @param dc - Device context to remove part from.
*/ */
void RemoveDrawItem( LibEDA_BaseStruct* item, void RemoveDrawItem( LIB_DRAW_ITEM* item,
WinEDA_DrawPanel* panel = NULL, WinEDA_DrawPanel* panel = NULL,
wxDC* dc = NULL ); wxDC* dc = NULL );
...@@ -244,6 +248,52 @@ public: ...@@ -244,6 +248,52 @@ public:
wxASSERT( name != NULL ); wxASSERT( name != NULL );
return m_AliasList.Index( name ) != wxNOT_FOUND; return m_AliasList.Index( name ) != wxNOT_FOUND;
} }
/**
* Checks all draw objects of component to see if they are with block.
*
* Use this method to mark draw objects as selected during block
* functions.
*
* @param rect - The bounding rectangle to test in draw items are inside.
* @param unit - The current unit number to test against.
* @param convert - Are the draw items being selected a conversion.
* @param editPinByPin - Used to ignore pin selections when in edit pin
* by pin mode is enabled.
*
* @return int - The number of draw object found inside the block select
* rectangle.
*/
int SelectItems( EDA_Rect& rect, int unit, int convert,
bool editPinByPin );
/**
* Clears all the draw items marked by a block select.
*/
void ClearSelectedItems( void );
/**
* Deletes the select draw items marked by a block select.
*
* The name and reference field will not be deleted. They are the
* minimum drawing items required for any component. Thier properties
* can be changed but the cannot be removed.
*/
void DeleteSelectedItems( void );
/**
* Move the selected draw items marked by a block select.
*/
void MoveSelectedItems( const wxPoint& offset );
/**
* Make a copy of the selected draw items marked by a block select.
*
* Fields are not copied. Only component body items are copied.
* Copying fields would result in duplicate fields which does not
* make sense in this context.
*/
void CopySelectedItems( const wxPoint& offset );
}; };
...@@ -264,7 +314,8 @@ protected: ...@@ -264,7 +314,8 @@ protected:
public: public:
LIB_ALIAS( const wxString& name, LIB_COMPONENT* root, LIB_ALIAS( const wxString& name, LIB_COMPONENT* root,
CMP_LIBRARY* lib = NULL ); CMP_LIBRARY* lib = NULL );
LIB_ALIAS( const LIB_ALIAS& alias, CMP_LIBRARY* lib = NULL );
~LIB_ALIAS(); ~LIB_ALIAS();
virtual wxString GetClass() const virtual wxString GetClass() const
......
...@@ -10,10 +10,9 @@ ...@@ -10,10 +10,9 @@
#include "kicad_string.h" #include "kicad_string.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_libentry.h"
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
#include <wx/stream.h> #include <wx/stream.h>
...@@ -39,19 +38,35 @@ ...@@ -39,19 +38,35 @@
* others = free fields * others = free fields
*/ */
LibDrawField::LibDrawField(LIB_COMPONENT * aParent, int idfield ) : LibDrawField::LibDrawField(LIB_COMPONENT * aParent, int idfield ) :
LibEDA_BaseStruct( COMPONENT_FIELD_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( COMPONENT_FIELD_DRAW_TYPE, aParent )
{ {
m_FieldId = idfield; m_FieldId = idfield;
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT;
} }
LibDrawField::LibDrawField( int idfield ) : LibDrawField::LibDrawField( int idfield ) :
LibEDA_BaseStruct( COMPONENT_FIELD_DRAW_TYPE, NULL ) LIB_DRAW_ITEM( COMPONENT_FIELD_DRAW_TYPE, NULL )
{ {
m_FieldId = idfield; m_FieldId = idfield;
m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT; m_Size.x = m_Size.y = DEFAULT_SIZE_TEXT;
} }
LibDrawField::LibDrawField( const LibDrawField& field ) :
LIB_DRAW_ITEM( field )
{
m_Pos = field.m_Pos;
m_Size = field.m_Size;
m_Width = field.m_Width;
m_Orient = field.m_Orient;
m_Attributs = field.m_Attributs;
m_Text = field.m_Text;
m_Name = field.m_Name;
m_HJustify = field.m_HJustify;
m_VJustify = field.m_VJustify;
m_Italic = field.m_Italic;
m_Bold = field.m_Bold;
}
LibDrawField::~LibDrawField() LibDrawField::~LibDrawField()
{ {
...@@ -358,13 +373,13 @@ bool LibDrawField::HitTest( wxPoint aPosRef, int aThreshold, ...@@ -358,13 +373,13 @@ bool LibDrawField::HitTest( wxPoint aPosRef, int aThreshold,
} }
// Creation et Duplication d'un field // Creation et Duplication d'un field
LibEDA_BaseStruct* LibDrawField::DoGenCopy() LIB_DRAW_ITEM* LibDrawField::DoGenCopy()
{ {
LibDrawField* newfield = new LibDrawField( m_FieldId ); LibDrawField* newfield = new LibDrawField( m_FieldId );
Copy( newfield ); Copy( newfield );
return (LibEDA_BaseStruct*) newfield; return (LIB_DRAW_ITEM*) newfield;
} }
...@@ -389,7 +404,7 @@ void LibDrawField::Copy( LibDrawField* Target ) const ...@@ -389,7 +404,7 @@ void LibDrawField::Copy( LibDrawField* Target ) const
} }
bool LibDrawField::DoCompare( const LibEDA_BaseStruct& other ) const bool LibDrawField::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_FIELD_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_FIELD_DRAW_TYPE );
...@@ -416,13 +431,19 @@ bool LibDrawField::DoTestInside( EDA_Rect& rect ) ...@@ -416,13 +431,19 @@ bool LibDrawField::DoTestInside( EDA_Rect& rect )
} }
void LibDrawField::DoMove( const wxPoint& newPosition )
{
m_Pos = newPosition;
}
/* /*
* If the field is the reference, return reference like schematic, * If the field is the reference, return reference like schematic,
* i.e U -> U? or U?A or the field text for others * i.e U -> U? or U?A or the field text for others
* *
* @fixme This should be handled by the field object. * @fixme This should be handled by the field object.
*/ */
wxString LibDrawField::GetFullText( void ) wxString LibDrawField::GetFullText( int unit )
{ {
if( m_FieldId != REFERENCE ) if( m_FieldId != REFERENCE )
return m_Text; return m_Text;
...@@ -433,11 +454,11 @@ wxString LibDrawField::GetFullText( void ) ...@@ -433,11 +454,11 @@ wxString LibDrawField::GetFullText( void )
{ {
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
text.Printf( wxT( "%s?.%c" ), text.Printf( wxT( "%s?.%c" ),
m_Text.GetData(), CurrentUnit + '1' - 1 ); m_Text.GetData(), unit + '1' - 1 );
#else #else
text.Printf( wxT( "%s?%c" ), text.Printf( wxT( "%s?%c" ),
m_Text.GetData(), CurrentUnit + 'A' - 1 ); m_Text.GetData(), unit + 'A' - 1 );
#endif #endif
} }
else else
......
...@@ -6,6 +6,9 @@ ...@@ -6,6 +6,9 @@
#define CLASS_LIBENTRY_FIELDS_H #define CLASS_LIBENTRY_FIELDS_H
#include "classes_body_items.h"
/* Fields , same as component fields. /* Fields , same as component fields.
* can be defined in libraries (mandatory for ref and value, ca be useful for * can be defined in libraries (mandatory for ref and value, ca be useful for
* footprints) * footprints)
...@@ -15,7 +18,7 @@ ...@@ -15,7 +18,7 @@
* default value in schematic * default value in schematic
*/ */
class LibDrawField : public LibEDA_BaseStruct, class LibDrawField : public LIB_DRAW_ITEM,
public EDA_TextStruct public EDA_TextStruct
{ {
public: public:
...@@ -36,6 +39,7 @@ public: ...@@ -36,6 +39,7 @@ public:
LibDrawField( int idfield = 2 ); LibDrawField( int idfield = 2 );
LibDrawField( LIB_COMPONENT * aParent, int idfield = 2 ); LibDrawField( LIB_COMPONENT * aParent, int idfield = 2 );
LibDrawField( const LibDrawField& field );
~LibDrawField(); ~LibDrawField();
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
...@@ -103,13 +107,26 @@ public: ...@@ -103,13 +107,26 @@ public:
m_Parent = field.m_Parent; m_Parent = field.m_Parent;
} }
wxString GetFullText( void ); /**
* Return the text of a field.
*
* If the field is the reference field, the unit number is used to
* create a pseudo reference text. If the base reference field is U,
* the string U?A will be returned for unit = 1.
*
* @param unit - The package unit number. Only effects reference field.
*
* @return wxString - Field text.
*/
wxString GetFullText( int unit = 1 );
protected: protected:
virtual LibEDA_BaseStruct* DoGenCopy(); virtual LIB_DRAW_ITEM* DoGenCopy();
virtual bool DoCompare( const LibEDA_BaseStruct& other ) const; virtual bool DoCompare( const LIB_DRAW_ITEM& other ) const;
virtual void DoOffset( const wxPoint& offset ); virtual void DoOffset( const wxPoint& offset );
virtual bool DoTestInside( EDA_Rect& rect ); virtual bool DoTestInside( EDA_Rect& rect );
virtual void DoMove( const wxPoint& newPosition );
virtual wxPoint DoGetPosition( void ) { return m_Pos; }
}; };
#endif // CLASS_LIBENTRY_FIELDS_H #endif // CLASS_LIBENTRY_FIELDS_H
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "eda_doc.h" #include "eda_doc.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"
...@@ -197,7 +196,7 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* cmp ) ...@@ -197,7 +196,7 @@ LIB_COMPONENT* CMP_LIBRARY::AddComponent( LIB_COMPONENT* cmp )
{ {
wxASSERT( cmp != NULL ); wxASSERT( cmp != NULL );
LIB_COMPONENT* newCmp = CopyLibEntryStruct( cmp ); LIB_COMPONENT* newCmp = new LIB_COMPONENT( *cmp, this );
if( newCmp == NULL ) if( newCmp == NULL )
return NULL; return NULL;
...@@ -387,7 +386,7 @@ in library <%s>." ), ...@@ -387,7 +386,7 @@ in library <%s>." ),
RemoveEntry( oldComponent->GetName() ); RemoveEntry( oldComponent->GetName() );
LIB_COMPONENT* newCmp = CopyLibEntryStruct( newComponent ); LIB_COMPONENT* newCmp = new LIB_COMPONENT( *newComponent, this );
if( newCmp == NULL ) if( newCmp == NULL )
return NULL; return NULL;
...@@ -706,13 +705,12 @@ document file." ), ...@@ -706,13 +705,12 @@ document file." ),
} }
bool CMP_LIBRARY::Save( const wxString& FullFileName ) bool CMP_LIBRARY::Save( const wxString& FullFileName, bool oldDocFormat )
{ {
FILE* libfile, *docfile; FILE* libfile;
wxString msg; wxString msg;
wxFileName libFileName = FullFileName; wxFileName libFileName = FullFileName;
wxFileName backupFileName = FullFileName; wxFileName backupFileName = FullFileName;
wxFileName docFileName = FullFileName;
/* the old .lib file is renamed .bak */ /* the old .lib file is renamed .bak */
if( libFileName.FileExists() ) if( libFileName.FileExists() )
...@@ -723,15 +721,69 @@ bool CMP_LIBRARY::Save( const wxString& FullFileName ) ...@@ -723,15 +721,69 @@ bool CMP_LIBRARY::Save( const wxString& FullFileName )
if( !wxRenameFile( libFileName.GetFullPath(), if( !wxRenameFile( libFileName.GetFullPath(),
backupFileName.GetFullPath() ) ) backupFileName.GetFullPath() ) )
{ {
msg = wxT( "Failed to rename old lib file " ) + libFileName.MakeAbsolute();
msg = wxT( "Failed to rename old component library file " ) +
backupFileName.GetFullPath(); backupFileName.GetFullPath();
DisplayError( NULL, msg ); DisplayError( NULL, msg );
} }
} }
libfile = wxFopen( libFileName.GetFullPath(), wxT( "wt" ) );
if( libfile == NULL )
{
libFileName.MakeAbsolute();
msg = wxT( "Failed to create component library file " ) +
libFileName.GetFullPath();
DisplayError( NULL, msg );
return false;
}
m_IsModified = false;
/* Creation de l'entete de la librairie */
m_TimeStamp = GetTimeStamp();
if( !SaveHeader( libfile ) )
{
fclose( libfile );
return false;
}
bool success = true;
BOOST_FOREACH( CMP_LIB_ENTRY& entry, m_Entries )
{
if ( entry.Type == ROOT )
{
LIB_COMPONENT* component = ( LIB_COMPONENT* ) &entry;
if ( !component->Save( libfile ) )
success = false;
}
}
if( fprintf( libfile, "#\n#End Library\n" ) < 0 )
success = false;
fclose( libfile );
if( USE_OLD_DOC_FILE_FORMAT( m_verMajor, m_verMinor ) && oldDocFormat )
success = SaveDocFile( FullFileName );
return success;
}
bool CMP_LIBRARY::SaveDocFile( const wxString& FullFileName )
{
FILE* docfile;
wxString msg;
wxFileName backupFileName = FullFileName;
wxFileName docFileName = FullFileName;
docFileName.SetExt( DOC_EXT ); docFileName.SetExt( DOC_EXT );
/* L'ancien fichier doc lib est renomme en .bck */
if( wxFileExists( docFileName.GetFullPath() ) ) /* Save current doc file as .bck */
if( docFileName.FileExists() )
{ {
backupFileName = docFileName; backupFileName = docFileName;
backupFileName.SetExt( wxT( "bck" ) ); backupFileName.SetExt( wxT( "bck" ) );
...@@ -740,64 +792,44 @@ bool CMP_LIBRARY::Save( const wxString& FullFileName ) ...@@ -740,64 +792,44 @@ bool CMP_LIBRARY::Save( const wxString& FullFileName )
if( !wxRenameFile( docFileName.GetFullPath(), if( !wxRenameFile( docFileName.GetFullPath(),
backupFileName.GetFullPath() ) ) backupFileName.GetFullPath() ) )
{ {
msg = wxT( "Failed to save old doc lib file " ) + msg = wxT( "Failed to save old library document file " ) +
backupFileName.GetFullPath(); backupFileName.GetFullPath();
DisplayError( NULL, msg ); DisplayError( NULL, msg );
} }
} }
libfile = wxFopen( libFileName.GetFullPath(), wxT( "wt" ) );
if( libfile == NULL )
{
msg = wxT( "Failed to create component library file " ) +
libFileName.GetFullPath();
DisplayError( NULL, msg );
return false;
}
docfile = wxFopen( docFileName.GetFullPath(), wxT( "wt" ) ); docfile = wxFopen( docFileName.GetFullPath(), wxT( "wt" ) );
if( docfile == NULL ) if( docfile == NULL )
{ {
docFileName.MakeAbsolute();
msg = wxT( "Failed to create component document library file " ) + msg = wxT( "Failed to create component document library file " ) +
docFileName.GetFullPath(); docFileName.GetFullPath();
DisplayError( NULL, msg ); DisplayError( NULL, msg );
return false;
} }
m_IsModified = false;
/* Creation de l'entete de la librairie */
m_TimeStamp = GetTimeStamp();
SaveHeader( libfile );
/* Sauvegarde des composant: */
char Line[256]; char Line[256];
fprintf( docfile, "%s Date: %s\n", DOCFILE_IDENT, if( fprintf( docfile, "%s Date: %s\n", DOCFILE_IDENT,
DateAndTime( Line ) ); DateAndTime( Line ) ) < 0 )
{
fclose( docfile );
return false;
}
bool success = true; bool success = true;
BOOST_FOREACH( CMP_LIB_ENTRY& entry, m_Entries ) BOOST_FOREACH( CMP_LIB_ENTRY& entry, m_Entries )
{ {
if ( entry.Type == ROOT ) if ( !entry.SaveDoc( docfile ) )
{ success = false;
LIB_COMPONENT* component = ( LIB_COMPONENT* ) &entry;
if ( ! component->Save( libfile ) )
success = false;
}
if ( docfile )
{
if ( ! entry.SaveDoc( docfile ) )
success = false;
}
} }
fprintf( libfile, "#\n#End Library\n" ); if ( fprintf( docfile, "#\n#End Doc Library\n" ) < 0 )
if ( docfile ) success = false;
fprintf( docfile, "#\n#End Doc Library\n" );
fclose( libfile );
fclose( docfile ); fclose( docfile );
return success; return success;
} }
...@@ -805,7 +837,7 @@ bool CMP_LIBRARY::Save( const wxString& FullFileName ) ...@@ -805,7 +837,7 @@ bool CMP_LIBRARY::Save( const wxString& FullFileName )
bool CMP_LIBRARY::SaveHeader( FILE* file ) bool CMP_LIBRARY::SaveHeader( FILE* file )
{ {
char BufLine[1024]; char BufLine[1024];
bool succes = false; bool succes = true;
DateAndTime( BufLine ); DateAndTime( BufLine );
if( fprintf( file, "%s %d.%d Date: %s\n", LIBFILE_IDENT, if( fprintf( file, "%s %d.%d Date: %s\n", LIBFILE_IDENT,
...@@ -844,7 +876,8 @@ CMP_LIBRARY* CMP_LIBRARY::LoadLibrary( const wxFileName& fileName, ...@@ -844,7 +876,8 @@ CMP_LIBRARY* CMP_LIBRARY::LoadLibrary( const wxFileName& fileName,
return NULL; return NULL;
} }
lib->LoadDocs( errMsg ); if( USE_OLD_DOC_FILE_FORMAT( lib->m_verMajor, lib->m_verMinor ) )
lib->LoadDocs( errMsg );
return lib; return lib;
} }
......
/***********************************/ /*********************************************/
/* Headers for library definition */ /* Headers for component library definition */
/***********************************/ /*********************************************/
#ifndef CLASS_LIBRARY_H #ifndef CLASS_LIBRARY_H
#define CLASS_LIBRARY_H #define CLASS_LIBRARY_H
...@@ -8,6 +8,37 @@ ...@@ -8,6 +8,37 @@
#include "class_libentry.h" #include "class_libentry.h"
/*
* Component Library version and file header macros.
*/
#define LIB_VERSION_MAJOR 2
#define LIB_VERSION_MINOR 3
/* Must be the first line of component library (.lib) files. */
#define LIBFILE_IDENT "EESchema-LIBRARY Version"
#define LIB_VERSION( major, minor ) ( major * 100 + minor )
#define IS_LIB_CURRENT_VERSION( major, minor ) \
( \
LIB_VERSION( major1, minor1 ) == \
LIB_VERSION( LIB_VERSION_MAJOR, LIB_VERSION_MINOR) \
)
/*
* Library versions 2.3 and lower use the old separate library (.lib) and
* document (.dcm) files. Component libraries after 2.3 merged the library
* and document files into a single library file. This macro checks if the
* library version supports the old format
*/
#define USE_OLD_DOC_FILE_FORMAT( major, minor ) \
( LIB_VERSION( major, minor ) <= LIB_VERSION( 2, 3 ) )
/* Must be the first line of component library document (.dcm) files. */
#define DOCFILE_IDENT "EESchema-DOCLIB Version 2.0"
#define DOC_EXT wxT( "dcm" )
/* Helpers for creating a list of component libraries. */ /* Helpers for creating a list of component libraries. */
class CMP_LIBRARY; class CMP_LIBRARY;
...@@ -43,17 +74,35 @@ public: ...@@ -43,17 +74,35 @@ public:
/** /**
* Save library to file. * Save library to file.
* *
* Two files are created. The component objects are save as component * Prior to component library version 3.0, two files were created. The
* library (*.lib) files. The alias objects are save as document * component objects are wer as component library (*.lib) files. The
* definition (*.dcm) files. If the component library already exists, * library entry ojbect document strings were save in library document
* it is backup up in file *.bak. If the document definition file * definition (*.dcm) files. After version component library version 3.0,
* already exists, it is backed up in file *.bck. * the document string information is saved as part of the library file.
* Saving separate document is maintained for backwards compatability.
* Please note that this behavior may change in the future. If the
* component library already exists, it is backup up in file *.bak.
*
* @param aFullFileName - The library filename with path.
* @param oldDocFormat - Save the document information in a separate
* file if true. The default is to save as the
* current library file format.
*
* @return bool - true if success writing else false.
*/
bool Save( const wxString& aFullFileName, bool oldDocFormat = false );
/**
* Save library document information to file.
*
* If the document definition file* already exists, it is backed up in
* file *.bck.
* *
* @param aFullFileName - The library filename with path. * @param aFullFileName - The library filename with path.
* *
* @return bool - true if success writing else false. * @return bool - true if success writing else false.
*/ */
bool Save( const wxString& aFullFileName ); bool SaveDocFile( const wxString& FullFileName );
/** /**
* Load library from file. * Load library from file.
......
...@@ -6,7 +6,6 @@ ...@@ -6,7 +6,6 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "class_netlist_object.h" #include "class_netlist_object.h"
......
...@@ -12,10 +12,10 @@ ...@@ -12,10 +12,10 @@
#include "plot_common.h" #include "plot_common.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditfrm.h" #include "libeditfrm.h"
#include "class_libentry.h"
const wxChar* MsgPinElectricType[] = const wxChar* MsgPinElectricType[] =
...@@ -34,7 +34,7 @@ const wxChar* MsgPinElectricType[] = ...@@ -34,7 +34,7 @@ const wxChar* MsgPinElectricType[] =
}; };
LibDrawPin::LibDrawPin(LIB_COMPONENT * aParent) : LibDrawPin::LibDrawPin(LIB_COMPONENT * aParent) :
LibEDA_BaseStruct( COMPONENT_PIN_DRAW_TYPE, aParent ) LIB_DRAW_ITEM( COMPONENT_PIN_DRAW_TYPE, aParent )
{ {
m_PinLen = 300; /* default Pin len */ m_PinLen = 300; /* default Pin len */
m_Orient = PIN_RIGHT; /* Pin oprient: Up, Down, Left, Right */ m_Orient = PIN_RIGHT; /* Pin oprient: Up, Down, Left, Right */
...@@ -53,6 +53,26 @@ LibDrawPin::LibDrawPin(LIB_COMPONENT * aParent) : ...@@ -53,6 +53,26 @@ LibDrawPin::LibDrawPin(LIB_COMPONENT * aParent) :
} }
LibDrawPin::LibDrawPin( const LibDrawPin& pin ) : LIB_DRAW_ITEM( pin )
{
m_Pos = pin.m_Pos;
m_PinLen = pin.m_PinLen;
m_Orient = pin.m_Orient;
m_PinShape = pin.m_PinShape;
m_PinType = pin.m_PinType;
m_Attributs = pin.m_Attributs;
m_PinNum = pin.m_PinNum;
m_PinNumSize = pin.m_PinNumSize;
m_PinNameSize = pin.m_PinNameSize;
m_PinNumShapeOpt = pin.m_PinNumShapeOpt;
m_PinNameShapeOpt = pin.m_PinNameShapeOpt;
m_PinNumPositionOpt = pin.m_PinNumPositionOpt;
m_PinNamePositionOpt = pin.m_PinNamePositionOpt;
m_Width = pin.m_Width;
m_PinName = pin.m_PinName;
}
/** /**
* Function HitTest * Function HitTest
* tests if the given wxPoint is within the bounds of this object. * tests if the given wxPoint is within the bounds of this object.
...@@ -1035,7 +1055,7 @@ void LibDrawPin::SetPinNumFromString( wxString& buffer ) ...@@ -1035,7 +1055,7 @@ void LibDrawPin::SetPinNumFromString( wxString& buffer )
/*************************************/ /*************************************/
LibEDA_BaseStruct* LibDrawPin::DoGenCopy() LIB_DRAW_ITEM* LibDrawPin::DoGenCopy()
/*************************************/ /*************************************/
{ {
LibDrawPin* newpin = new LibDrawPin( GetParent() ); LibDrawPin* newpin = new LibDrawPin( GetParent() );
...@@ -1059,11 +1079,11 @@ LibEDA_BaseStruct* LibDrawPin::DoGenCopy() ...@@ -1059,11 +1079,11 @@ LibEDA_BaseStruct* LibDrawPin::DoGenCopy()
newpin->m_Width = m_Width; newpin->m_Width = m_Width;
newpin->m_PinName = m_PinName; newpin->m_PinName = m_PinName;
return (LibEDA_BaseStruct*) newpin; return (LIB_DRAW_ITEM*) newpin;
} }
bool LibDrawPin::DoCompare( const LibEDA_BaseStruct& other ) const bool LibDrawPin::DoCompare( const LIB_DRAW_ITEM& other ) const
{ {
wxASSERT( other.Type() == COMPONENT_PIN_DRAW_TYPE ); wxASSERT( other.Type() == COMPONENT_PIN_DRAW_TYPE );
...@@ -1087,6 +1107,12 @@ bool LibDrawPin::DoTestInside( EDA_Rect& rect ) ...@@ -1087,6 +1107,12 @@ bool LibDrawPin::DoTestInside( EDA_Rect& rect )
} }
void LibDrawPin::DoMove( const wxPoint& newPosition )
{
m_Pos = newPosition;
}
/** Function LibDrawPin::DisplayInfo /** Function LibDrawPin::DisplayInfo
* Displays info (pin num and name, orientation ... * Displays info (pin num and name, orientation ...
* on the Info window * on the Info window
...@@ -1096,7 +1122,7 @@ void LibDrawPin::DisplayInfo( WinEDA_DrawFrame* frame ) ...@@ -1096,7 +1122,7 @@ void LibDrawPin::DisplayInfo( WinEDA_DrawFrame* frame )
wxString Text; wxString Text;
int ii; int ii;
LibEDA_BaseStruct::DisplayInfo( frame ); LIB_DRAW_ITEM::DisplayInfo( frame );
/* Affichage du nom */ /* Affichage du nom */
frame->MsgPanel->Affiche_1_Parametre( 30, _( "PinName" ), m_PinName, frame->MsgPanel->Affiche_1_Parametre( 30, _( "PinName" ), m_PinName,
......
...@@ -16,13 +16,12 @@ ...@@ -16,13 +16,12 @@
#include "base_struct.h" #include "base_struct.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "drawtxt.h" #include "drawtxt.h"
#include "macros.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "macros.h"
#include "protos.h" #include "protos.h"
#include "class_library.h"
SCH_CMP_FIELD::SCH_CMP_FIELD( const wxPoint& aPos, int aFieldId, SCH_CMP_FIELD::SCH_CMP_FIELD( const wxPoint& aPos, int aFieldId,
......
...@@ -6,12 +6,12 @@ ...@@ -6,12 +6,12 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "macros.h" #include "macros.h"
#include "protos.h" #include "protos.h"
#include "class_library.h"
#include <wx/tokenzr.h> #include <wx/tokenzr.h>
......
...@@ -4,8 +4,8 @@ ...@@ -4,8 +4,8 @@
#include "common.h" #include "common.h"
#include "eeschema_id.h" #include "eeschema_id.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
......
...@@ -8,9 +8,7 @@ ...@@ -8,9 +8,7 @@
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
/* used to calculate the pen size from default value /* used to calculate the pen size from default value
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "drawtxt.h" #include "drawtxt.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
......
This diff is collapsed.
This diff is collapsed.
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
#include "common.h" #include "common.h"
#include "trigo.h" #include "trigo.h"
#include "confirm.h" #include "confirm.h"
#include "macros.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "netlist.h"
#include "macros.h"
#include "protos.h" #include "protos.h"
#include "netlist.h"
/* Routines locales */ /* Routines locales */
......
...@@ -10,14 +10,14 @@ ...@@ -10,14 +10,14 @@
#include "eeschema_id.h" #include "eeschema_id.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditfrm.h" #include "libeditfrm.h"
#include "libviewfrm.h" #include "libviewfrm.h"
#include "classes_body_items.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
/**************************************************************************************/ /**************************************************************************************/
SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool IncludePin ) SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool IncludePin )
/**************************************************************************************/ /**************************************************************************************/
......
...@@ -5,15 +5,13 @@ ...@@ -5,15 +5,13 @@
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "program.h"
#include "libcmp.h"
#include "general.h"
#include "eda_dde.h" #include "eda_dde.h"
#include "program.h"
#include "general.h"
#include "eeschema_id.h" #include "eeschema_id.h"
#include "protos.h" #include "protos.h"
#include "classes_body_items.h"
/***************************************************************/ /***************************************************************/
......
...@@ -5,12 +5,12 @@ ...@@ -5,12 +5,12 @@
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "netlist.h" /* Definitions generales liees au calcul de netliste */ #include "netlist.h" /* Definitions generales liees au calcul de netliste */
#include "protos.h" #include "protos.h"
#include "class_library.h"
enum End_Type { enum End_Type {
...@@ -392,7 +392,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ) ...@@ -392,7 +392,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
if( Entry == NULL ) if( Entry == NULL )
break; break;
LibEDA_BaseStruct* DrawLibItem = Entry->m_Drawings; LIB_DRAW_ITEM* DrawLibItem = Entry->m_Drawings;
for( ; DrawLibItem != NULL; DrawLibItem = DrawLibItem->Next() ) for( ; DrawLibItem != NULL; DrawLibItem = DrawLibItem->Next() )
{ {
if( DrawLibItem->Type() != COMPONENT_PIN_DRAW_TYPE ) if( DrawLibItem->Type() != COMPONENT_PIN_DRAW_TYPE )
......
...@@ -13,9 +13,9 @@ ...@@ -13,9 +13,9 @@
#include "kicad_string.h" #include "kicad_string.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
......
...@@ -7,7 +7,6 @@ ...@@ -7,7 +7,6 @@
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "confirm.h" #include "confirm.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
......
...@@ -9,10 +9,9 @@ ...@@ -9,10 +9,9 @@
#include "fctsys.h" #include "fctsys.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "netlist.h" #include "netlist.h"
......
...@@ -51,7 +51,7 @@ WinEDA_bodygraphics_PropertiesFrame::WinEDA_bodygraphics_PropertiesFrame( ) ...@@ -51,7 +51,7 @@ WinEDA_bodygraphics_PropertiesFrame::WinEDA_bodygraphics_PropertiesFrame( )
WinEDA_bodygraphics_PropertiesFrame::WinEDA_bodygraphics_PropertiesFrame( WinEDA_LibeditFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style ) WinEDA_bodygraphics_PropertiesFrame::WinEDA_bodygraphics_PropertiesFrame( WinEDA_LibeditFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{ {
LibEDA_BaseStruct * CurrentItem = CurrentDrawItem; LIB_DRAW_ITEM * CurrentItem = parent->GetDrawItem();
m_Parent = parent; m_Parent = parent;
Create(parent, id, caption, pos, size, style); Create(parent, id, caption, pos, size, style);
......
...@@ -16,12 +16,12 @@ ...@@ -16,12 +16,12 @@
#endif #endif
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h"
#include "common.h" #include "common.h"
#include "confirm.h" #include "confirm.h"
#include "program.h" #include "program.h"
#include "libcmp.h" #include "class_libentry.h"
#include "general.h" #include "libeditfrm.h"
////@begin includes ////@begin includes
////@end includes ////@end includes
...@@ -104,7 +104,9 @@ bool WinEDA_CreateCmpDialog::Create( WinEDA_DrawFrame* parent, wxWindowID id, co ...@@ -104,7 +104,9 @@ bool WinEDA_CreateCmpDialog::Create( WinEDA_DrawFrame* parent, wxWindowID id, co
void WinEDA_CreateCmpDialog::SetComponentData( LIB_COMPONENT & component ) void WinEDA_CreateCmpDialog::SetComponentData( LIB_COMPONENT & component )
/**********************************************************************************/ /**********************************************************************************/
{ {
g_AsDeMorgan = m_AsConvert->GetValue(); WinEDA_LibeditFrame* parent = (WinEDA_LibeditFrame*) GetParent();
parent->SetShowDeMorgan( m_AsConvert->GetValue() );
component.m_UnitCount = m_PartsCount->GetSelection() + 1; component.m_UnitCount = m_PartsCount->GetSelection() + 1;
component.m_Prefix.m_Text = m_Reference->GetValue(); component.m_Prefix.m_Text = m_Reference->GetValue();
if ( m_PinNameInside->GetValue() == FALSE) if ( m_PinNameInside->GetValue() == FALSE)
......
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
#include "gestfich.h" #include "gestfich.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditfrm.h" #include "libeditfrm.h"
#include "class_libentry.h"
#include "dialog_edit_component_in_lib.h" #include "dialog_edit_component_in_lib.h"
...@@ -45,7 +45,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::Init( ) ...@@ -45,7 +45,7 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::Init( )
SetFocus(); SetFocus();
m_AliasLocation = -1; m_AliasLocation = -1;
LIB_COMPONENT* component = m_Parent->GetCurrentComponent(); LIB_COMPONENT* component = m_Parent->GetComponent();
if( component == NULL ) if( component == NULL )
{ {
...@@ -55,22 +55,22 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::Init( ) ...@@ -55,22 +55,22 @@ void DIALOG_EDIT_COMPONENT_IN_LIBRARY::Init( )
wxString title = _( "Properties for " ); wxString title = _( "Properties for " );
if( !CurrentAliasName.IsEmpty() ) if( !m_Parent->GetAliasName().IsEmpty() )
{ {
title += CurrentAliasName + _( " (alias of " ) + title += m_Parent->GetAliasName() + _( " (alias of " ) +
component->GetName() + wxT( ")" ); component->GetName() + wxT( ")" );
} }
else else
{ {
title += component->GetName(); title += component->GetName();
CurrentAliasName.Empty(); m_Parent->GetAliasName().Empty();
} }
SetTitle( title ); SetTitle( title );
InitPanelDoc(); InitPanelDoc();
InitBasicPanel(); InitBasicPanel();
if( !CurrentAliasName.IsEmpty() ) if( !m_Parent->GetAliasName().IsEmpty() )
m_ButtonDeleteAllAlias->Enable( false ); m_ButtonDeleteAllAlias->Enable( false );
/* Place list of alias names in listbox */ /* Place list of alias names in listbox */
......
...@@ -9,9 +9,9 @@ ...@@ -9,9 +9,9 @@
#include "confirm.h" #include "confirm.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h"
#include "dialog_edit_component_in_schematic.h" #include "dialog_edit_component_in_schematic.h"
......
...@@ -13,7 +13,6 @@ ...@@ -13,7 +13,6 @@
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "dialog_edit_label.h" #include "dialog_edit_label.h"
......
...@@ -10,10 +10,10 @@ ...@@ -10,10 +10,10 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditfrm.h" #include "libeditfrm.h"
#include "class_library.h"
#include "dialog_edit_libentry_fields_in_lib_base.h" #include "dialog_edit_libentry_fields_in_lib_base.h"
...@@ -101,12 +101,12 @@ private: ...@@ -101,12 +101,12 @@ private:
void WinEDA_LibeditFrame::InstallFieldsEditorDialog( wxCommandEvent& event ) void WinEDA_LibeditFrame::InstallFieldsEditorDialog( wxCommandEvent& event )
{ {
if( m_currentComponent == NULL ) if( m_component == NULL )
return; return;
DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW ); DrawPanel->UnManageCursor( 0, wxCURSOR_ARROW );
DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB dlg( this, m_currentComponent ); DIALOG_EDIT_LIBENTRY_FIELDS_IN_LIB dlg( this, m_component );
int abort = dlg.ShowModal(); int abort = dlg.ShowModal();
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "gestfich.h" #include "gestfich.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "netlist.h" #include "netlist.h"
......
...@@ -8,16 +8,14 @@ ...@@ -8,16 +8,14 @@
// Licence: GPL // Licence: GPL
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "bitmaps.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "netlist.h" #include "netlist.h"
#include "bitmaps.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
#include "protos.h" #include "protos.h"
#include "dialog_erc.h" #include "dialog_erc.h"
......
...@@ -24,7 +24,6 @@ ...@@ -24,7 +24,6 @@
#include "confirm.h" #include "confirm.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
......
This diff is collapsed.
...@@ -9,10 +9,9 @@ ...@@ -9,10 +9,9 @@
#include "confirm.h" #include "confirm.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h"
/* Fonctions locales */ /* Fonctions locales */
......
...@@ -13,10 +13,10 @@ ...@@ -13,10 +13,10 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditfrm.h" #include "libeditfrm.h"
#include "class_libentry.h"
#include "dialog_bodygraphictext_properties_base.h" #include "dialog_bodygraphictext_properties_base.h"
...@@ -144,7 +144,7 @@ void Dialog_BodyGraphicText_Properties::OnOkClick( wxCommandEvent& event ) ...@@ -144,7 +144,7 @@ void Dialog_BodyGraphicText_Properties::OnOkClick( wxCommandEvent& event )
/* Met a jour les differents parametres pour le composant en cours d'edition /* Met a jour les differents parametres pour le composant en cours d'edition
*/ */
{ {
wxString Line; wxString Line;
Line = m_TextValue->GetValue(); Line = m_TextValue->GetValue();
g_LastTextOrient = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ; g_LastTextOrient = m_Orient->GetValue() ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ;
...@@ -165,12 +165,12 @@ wxString Line; ...@@ -165,12 +165,12 @@ wxString Line;
m_GraphicText->m_Orient = g_LastTextOrient; m_GraphicText->m_Orient = g_LastTextOrient;
if( g_FlDrawSpecificUnit ) if( g_FlDrawSpecificUnit )
m_GraphicText->m_Unit = CurrentUnit; m_GraphicText->m_Unit = m_Parent->GetUnit();
else else
m_GraphicText->m_Unit = 0; m_GraphicText->m_Unit = 0;
if( g_FlDrawSpecificConvert ) if( g_FlDrawSpecificConvert )
m_GraphicText->m_Convert = CurrentConvert; m_GraphicText->m_Convert = m_Parent->GetConvert();
else else
m_GraphicText->m_Convert = 0; m_GraphicText->m_Convert = 0;
...@@ -216,14 +216,14 @@ wxString Line; ...@@ -216,14 +216,14 @@ wxString Line;
} }
Close(); Close();
if ( CurrentDrawItem ) if ( m_Parent->GetDrawItem() )
CurrentDrawItem->DisplayInfo( m_Parent ); m_Parent->GetDrawItem()->DisplayInfo( m_Parent );
Close(); Close();
} }
void WinEDA_LibeditFrame::EditSymbolText(wxDC * DC, LibEDA_BaseStruct * DrawItem) void WinEDA_LibeditFrame::EditSymbolText(wxDC* DC, LIB_DRAW_ITEM* DrawItem)
{ {
int DrawMode = g_XorMode; int DrawMode = g_XorMode;
...@@ -263,7 +263,7 @@ void WinEDA_LibeditFrame::RotateSymbolText(wxDC * DC) ...@@ -263,7 +263,7 @@ void WinEDA_LibeditFrame::RotateSymbolText(wxDC * DC)
90 deg Graphic text Rotation . 90 deg Graphic text Rotation .
*/ */
{ {
LibDrawText * DrawItem = (LibDrawText *) CurrentDrawItem; LibDrawText * DrawItem = (LibDrawText *) m_drawItem;
if( DrawItem == NULL ) if( DrawItem == NULL )
return; return;
......
...@@ -12,12 +12,11 @@ ...@@ -12,12 +12,11 @@
#include "confirm.h" #include "confirm.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "dialog_edit_label.h"
#include "protos.h" #include "protos.h"
#include "dialog_edit_label.h"
/* Fonctions locales */ /* Fonctions locales */
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void ExitMoveTexte( WinEDA_DrawPanel* panel, wxDC* DC ); static void ExitMoveTexte( WinEDA_DrawPanel* panel, wxDC* DC );
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "gestfich.h" #include "gestfich.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "eeconfig.h" #include "eeconfig.h"
......
...@@ -16,7 +16,6 @@ ...@@ -16,7 +16,6 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
......
...@@ -6,8 +6,8 @@ ...@@ -6,8 +6,8 @@
#include "gr_basic.h" #include "gr_basic.h"
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"
......
...@@ -7,8 +7,8 @@ ...@@ -7,8 +7,8 @@
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "class_library.h"
#include "dialog_load_error.h" #include "dialog_load_error.h"
......
...@@ -10,9 +10,10 @@ ...@@ -10,9 +10,10 @@
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h"
static EDA_BaseStruct* HighLightStruct = NULL; static EDA_BaseStruct* HighLightStruct = NULL;
......
...@@ -8,12 +8,11 @@ ...@@ -8,12 +8,11 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "gestfich.h" #include "gestfich.h"
#include "program.h"
#include "general.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "eda_dde.h" #include "eda_dde.h"
#include "libcmp.h" #include "program.h"
#include "general.h"
#include "protos.h" #include "protos.h"
#include <wx/snglinst.h> #include <wx/snglinst.h>
...@@ -65,7 +64,6 @@ HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr; ...@@ -65,7 +64,6 @@ HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
//SCH_SCREEN * ScreenSch; //SCH_SCREEN * ScreenSch;
DrawSheetStruct* g_RootSheet = NULL; DrawSheetStruct* g_RootSheet = NULL;
SCH_SCREEN* g_ScreenLib = NULL;
wxString g_NetCmpExtBuffer( wxT( "cmp" ) ); wxString g_NetCmpExtBuffer( wxT( "cmp" ) );
...@@ -97,21 +95,6 @@ int g_ItemSelectetColor = BROWN; ...@@ -97,21 +95,6 @@ int g_ItemSelectetColor = BROWN;
// Color to draw items flagged invisible, in libedit (they are insisible in eeschema // Color to draw items flagged invisible, in libedit (they are insisible in eeschema
int g_InvisibleItemColor = DARKGRAY; int g_InvisibleItemColor = DARKGRAY;
/* Variables used by LibEdit */
LibEDA_BaseStruct* LibItemToRepeat = NULL; /* pointer on a graphic item than
* can be duplicated by the Ins key
* (usually the last created item */
CMP_LIBRARY* CurrentLib = NULL; /* Current opened library */
LibEDA_BaseStruct* CurrentDrawItem = NULL; /* current edited item */
// Current selected alias (for components which have aliases)
wxString CurrentAliasName;
// True if the current component has a "De Morgan" representation
bool g_AsDeMorgan;
int CurrentUnit = 1;
int CurrentConvert = 1;
int DefaultTransformMatrix[2][2] = { { 1, 0 }, { 0, -1 } }; int DefaultTransformMatrix[2][2] = { { 1, 0 }, { 0, -1 } };
......
...@@ -8,18 +8,17 @@ ...@@ -8,18 +8,17 @@
#include "kicad_string.h" #include "kicad_string.h"
#include "gestfich.h" #include "gestfich.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "bitmaps.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "netlist.h" #include "netlist.h"
#include "bitmaps.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
#include "protos.h"
#include "erc.h"
#include "dialog_erc.h" #include "dialog_erc.h"
#include "erc.h"
#include "protos.h"
/* ERC tests : /* ERC tests :
* 1 - conflicts between connected pins ( example: 2 connected outputs ) * 1 - conflicts between connected pins ( example: 2 connected outputs )
......
...@@ -7,12 +7,12 @@ ...@@ -7,12 +7,12 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "gestfich.h" #include "gestfich.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "eeschema_id.h" #include "eeschema_id.h"
#include "class_library.h"
/****************************************************************/ /****************************************************************/
......
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
#include "gestfich.h" #include "gestfich.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
#include "protos.h" #include "protos.h"
#include "class_library.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
......
...@@ -158,7 +158,7 @@ extern HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr; ...@@ -158,7 +158,7 @@ extern HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
/* First and main (root) screen */ /* First and main (root) screen */
extern DrawSheetStruct* g_RootSheet; extern DrawSheetStruct* g_RootSheet;
extern SCH_SCREEN* g_ScreenLib;
/*************************************/ /*************************************/
/* Gestion de recherche des elements */ /* Gestion de recherche des elements */
......
...@@ -9,14 +9,14 @@ ...@@ -9,14 +9,14 @@
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "get_component_dialog.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h" #include "class_library.h"
#include "libviewfrm.h" #include "libviewfrm.h"
#include "get_component_dialog.h"
#include <boost/foreach.hpp> #include <boost/foreach.hpp>
...@@ -441,7 +441,7 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent, ...@@ -441,7 +441,7 @@ void WinEDA_SchematicFrame::ConvertPart( SCH_COMPONENT* DrawComponent,
int LookForConvertPart( LIB_COMPONENT* LibEntry ) int LookForConvertPart( LIB_COMPONENT* LibEntry )
{ {
int ii; int ii;
LibEDA_BaseStruct* DrawLibEntry; LIB_DRAW_ITEM* DrawLibEntry;
DrawLibEntry = LibEntry->m_Drawings; DrawLibEntry = LibEntry->m_Drawings;
ii = 0; ii = 0;
......
...@@ -7,18 +7,15 @@ ...@@ -7,18 +7,15 @@
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "bitmaps.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "wx/imaglist.h" #include "wx/imaglist.h"
#include "wx/treectrl.h" #include "wx/treectrl.h"
#include "bitmaps.h"
static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame ); static bool UpdateScreenFromSheet( WinEDA_SchematicFrame* frame );
enum { enum {
......
...@@ -8,10 +8,11 @@ ...@@ -8,10 +8,11 @@
#include "hotkeys.h" #include "hotkeys.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditfrm.h" #include "libeditfrm.h"
#include "class_libentry.h"
/* How to add a new hotkey: /* How to add a new hotkey:
* add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION (see * add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION (see
...@@ -463,7 +464,7 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -463,7 +464,7 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
wxPoint MousePos = GetScreen()->m_MousePosition; wxPoint MousePos = GetScreen()->m_MousePosition;
LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor(); LIB_DRAW_ITEM* DrawEntry = LocateItemUsingCursor();
// Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to // Remap the control key Ctrl A (0x01) to GR_KB_CTRL + 'A' (easier to
// handle...) // handle...)
...@@ -533,10 +534,10 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -533,10 +534,10 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
break; break;
case HK_REPEAT_LAST: case HK_REPEAT_LAST:
if( LibItemToRepeat && (LibItemToRepeat->m_Flags == 0) if( m_lastDrawItem && (m_lastDrawItem->m_Flags == 0)
&& (LibItemToRepeat->Type() == COMPONENT_PIN_DRAW_TYPE) ) && (m_lastDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE) )
{ {
RepeatPinItem( DC, (LibDrawPin*) LibItemToRepeat ); RepeatPinItem( DC, (LibDrawPin*) m_lastDrawItem );
} }
else else
wxBell(); wxBell();
...@@ -544,18 +545,18 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -544,18 +545,18 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_EDIT_PIN: case HK_EDIT_PIN:
if( DrawEntry ) if( DrawEntry )
CurrentDrawItem = DrawEntry; m_drawItem = DrawEntry;
if( CurrentDrawItem ) if( m_drawItem )
{ {
if( CurrentDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE ) if( m_drawItem->Type() == COMPONENT_PIN_DRAW_TYPE )
InstallPineditFrame( this, DC, MousePos ); InstallPineditFrame( this, DC, MousePos );
} }
break; break;
case HK_DELETE_PIN: case HK_DELETE_PIN:
if( DrawEntry ) if( DrawEntry )
CurrentDrawItem = DrawEntry; m_drawItem = DrawEntry;
if( CurrentDrawItem ) if( m_drawItem )
{ {
wxCommandEvent evt; wxCommandEvent evt;
evt.SetId( ID_POPUP_LIBEDIT_DELETE_ITEM ); evt.SetId( ID_POPUP_LIBEDIT_DELETE_ITEM );
...@@ -565,8 +566,8 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -565,8 +566,8 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_MOVE_PIN: case HK_MOVE_PIN:
if( DrawEntry ) if( DrawEntry )
CurrentDrawItem = DrawEntry; m_drawItem = DrawEntry;
if( CurrentDrawItem ) if( m_drawItem )
{ {
wxCommandEvent evt; wxCommandEvent evt;
evt.SetId( ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST ); evt.SetId( ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST );
......
...@@ -16,10 +16,10 @@ ...@@ -16,10 +16,10 @@
#include "eeschema_id.h" #include "eeschema_id.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditfrm.h" #include "libeditfrm.h"
#include "class_library.h"
#include <wx/filename.h> #include <wx/filename.h>
...@@ -41,7 +41,7 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event ) ...@@ -41,7 +41,7 @@ void WinEDA_LibeditFrame::OnImportPart( wxCommandEvent& event )
CMP_LIBRARY* LibTmp; CMP_LIBRARY* LibTmp;
CMP_LIB_ENTRY* LibEntry; CMP_LIB_ENTRY* LibEntry;
LibItemToRepeat = NULL; m_lastDrawItem = NULL;
wxFileDialog dlg( this, _( "Import Component" ), m_LastLibImportPath, wxFileDialog dlg( this, _( "Import Component" ), m_LastLibImportPath,
wxEmptyString, CompLibFileWildcard, wxEmptyString, CompLibFileWildcard,
...@@ -96,13 +96,13 @@ void WinEDA_LibeditFrame::OnExportPart( wxCommandEvent& event ) ...@@ -96,13 +96,13 @@ void WinEDA_LibeditFrame::OnExportPart( wxCommandEvent& event )
CMP_LIBRARY* CurLibTmp; CMP_LIBRARY* CurLibTmp;
bool createLib = ( event.GetId() != ExportPartId ) ? false : true; bool createLib = ( event.GetId() != ExportPartId ) ? false : true;
if( m_currentComponent == NULL ) if( m_component == NULL )
{ {
DisplayError( this, _( "There is no component selected to save." ) ); DisplayError( this, _( "There is no component selected to save." ) );
return; return;
} }
fn = m_currentComponent->GetName().Lower(); fn = m_component->GetName().Lower();
fn.SetExt( CompLibFileExtension ); fn.SetExt( CompLibFileExtension );
title = createLib ? _( "New Library" ) : _( "Export Component" ); title = createLib ? _( "New Library" ) : _( "Export Component" );
...@@ -115,19 +115,19 @@ void WinEDA_LibeditFrame::OnExportPart( wxCommandEvent& event ) ...@@ -115,19 +115,19 @@ void WinEDA_LibeditFrame::OnExportPart( wxCommandEvent& event )
fn = dlg.GetPath(); fn = dlg.GetPath();
CurLibTmp = CurrentLib; CurLibTmp = m_library;
CurrentLib = new CMP_LIBRARY( LIBRARY_TYPE_EESCHEMA, fn ); m_library = new CMP_LIBRARY( LIBRARY_TYPE_EESCHEMA, fn );
SaveOnePartInMemory(); SaveOnePartInMemory();
bool success = CurrentLib->Save( fn.GetFullPath() ); bool success = m_library->Save( fn.GetFullPath() );
if( success ) if( success )
m_LastLibExportPath = fn.GetPath(); m_LastLibExportPath = fn.GetPath();
delete CurrentLib; delete m_library;
CurrentLib = CurLibTmp; m_library = CurLibTmp;
if( createLib && success ) if( createLib && success )
{ {
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
#include "confirm.h" #include "confirm.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "netlist.h" #include "netlist.h"
#include "protos.h" #include "protos.h"
#include "class_library.h"
/* /*
......
...@@ -6,35 +6,6 @@ ...@@ -6,35 +6,6 @@
#define LIBCMP_H #define LIBCMP_H
#define LIB_VERSION_MAJOR 2
#define LIB_VERSION_MINOR 3
/* Must be the first line of component library (.lib) files. */
#define LIBFILE_IDENT "EESchema-LIBRARY Version"
#define LIB_VERSION( major, minor ) ( major * 100 + minor )
#define IS_LIB_CURRENT_VERSION( major, minor ) \
( \
LIB_VERSION( major1, minor1 ) == \
LIB_VERSION( LIB_VERSION_MAJOR, LIB_VERSION_MINOR) \
)
/*
* Library versions 2.3 and lower use the old separate library (.lib) and
* document (.dcm) files. Component libraries after 2.3 merged the library
* and document files into a single library file. This macro checks if the
* library version supports the old format
*/
#define USE_OLD_DOC_FILE_FORMAT( major, minor ) \
( LIB_VERSION( major, minor ) < LIB_VERSION( 2, 3 )
/* Must be the first line of component library document (.dcm) files. */
#define DOCFILE_IDENT "EESchema-DOCLIB Version 2.0"
#define DOC_EXT wxT( "dcm" )
enum LocateDrawStructType enum LocateDrawStructType
{ {
LOCATE_COMPONENT_ARC_DRAW_TYPE = 1, LOCATE_COMPONENT_ARC_DRAW_TYPE = 1,
...@@ -49,19 +20,4 @@ enum LocateDrawStructType ...@@ -49,19 +20,4 @@ enum LocateDrawStructType
#define LOCATE_ALL_DRAW_ITEM 0xFFFFFFFF #define LOCATE_ALL_DRAW_ITEM 0xFFFFFFFF
#include "class_library.h"
/* Variables used by LibEdit */
extern LibEDA_BaseStruct* LibItemToRepeat; /* pointer on a graphic item than
* can be duplicated by the Ins key
* (usually the last created item */
extern CMP_LIBRARY* CurrentLib; /* Current opened library */
extern LibEDA_BaseStruct* CurrentDrawItem; /* current edited item */
extern wxString CurrentAliasName;
extern bool g_AsDeMorgan;
extern int CurrentUnit;
extern int CurrentConvert;
#endif // LIBCMP_H #endif // LIBCMP_H
This diff is collapsed.
...@@ -13,24 +13,25 @@ ...@@ -13,24 +13,25 @@
#include "eeschema_id.h" #include "eeschema_id.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "libcmp.h"
#include "protos.h" #include "protos.h"
#include "libeditfrm.h" #include "libeditfrm.h"
#include "class_libentry.h"
void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem; LIB_DRAW_ITEM* DrawEntry = m_drawItem;
if( m_currentComponent == NULL ) // No component loaded ! if( m_component == NULL ) // No component loaded !
return; return;
if( m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
{ {
if( DrawEntry && DrawEntry->m_Flags ) if( DrawEntry && DrawEntry->m_Flags )
{ {
SaveCopyInUndoList( m_currentComponent ); SaveCopyInUndoList( m_component );
switch( DrawEntry->Type() ) switch( DrawEntry->Type() )
{ {
...@@ -50,28 +51,24 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -50,28 +51,24 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
} }
else else
{ {
DrawEntry = LocatePin( GetScreen()->m_MousePosition, DrawEntry = LocatePin( GetScreen()->m_MousePosition, m_component,
m_currentComponent, CurrentUnit, m_unit, m_convert );
CurrentConvert );
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(), DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(),
GetScreen()->m_MousePosition, GetScreen()->m_MousePosition,
m_currentComponent, CurrentUnit, m_component, m_unit, m_convert,
CurrentConvert,
LOCATE_ALL_DRAW_ITEM ); LOCATE_ALL_DRAW_ITEM );
} }
if( DrawEntry == NULL ) if( DrawEntry == NULL )
DrawEntry = LocatePin( GetScreen()->m_Curseur, DrawEntry = LocatePin( GetScreen()->m_Curseur, m_component,
m_currentComponent, CurrentUnit, m_unit, m_convert );
CurrentConvert );
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(), DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(),
GetScreen()->m_Curseur, GetScreen()->m_Curseur,
m_currentComponent, CurrentUnit, m_component, m_unit, m_convert,
CurrentConvert,
LOCATE_ALL_DRAW_ITEM ); LOCATE_ALL_DRAW_ITEM );
} }
...@@ -91,13 +88,13 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -91,13 +88,13 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
break; break;
case ID_LIBEDIT_PIN_BUTT: case ID_LIBEDIT_PIN_BUTT:
if( CurrentDrawItem == NULL || CurrentDrawItem->m_Flags == 0 ) if( m_drawItem == NULL || m_drawItem->m_Flags == 0 )
{ {
CreatePin( DC ); CreatePin( DC );
} }
else else
{ {
SaveCopyInUndoList( m_currentComponent ); SaveCopyInUndoList( m_component );
PlacePin( DC ); PlacePin( DC );
} }
break; break;
...@@ -107,60 +104,57 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -107,60 +104,57 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
case ID_LIBEDIT_BODY_CIRCLE_BUTT: case ID_LIBEDIT_BODY_CIRCLE_BUTT:
case ID_LIBEDIT_BODY_RECT_BUTT: case ID_LIBEDIT_BODY_RECT_BUTT:
case ID_LIBEDIT_BODY_TEXT_BUTT: case ID_LIBEDIT_BODY_TEXT_BUTT:
if( CurrentDrawItem == NULL || CurrentDrawItem->m_Flags == 0 ) if( m_drawItem == NULL || m_drawItem->m_Flags == 0 )
{ {
CurrentDrawItem = CreateGraphicItem( m_currentComponent, DC ); m_drawItem = CreateGraphicItem( m_component, DC );
} }
else if( CurrentDrawItem ) else if( m_drawItem )
{ {
if( CurrentDrawItem->m_Flags & IS_NEW ) if( m_drawItem->m_Flags & IS_NEW )
GraphicItemBeginDraw( DC ); GraphicItemBeginDraw( DC );
else else
{ {
SaveCopyInUndoList( m_currentComponent ); SaveCopyInUndoList( m_component );
EndDrawGraphicItem( DC ); EndDrawGraphicItem( DC );
} }
} }
break; break;
case ID_LIBEDIT_DELETE_ITEM_BUTT: case ID_LIBEDIT_DELETE_ITEM_BUTT:
DrawEntry = LocatePin( GetScreen()->m_MousePosition, DrawEntry = LocatePin( GetScreen()->m_MousePosition, m_component,
m_currentComponent, CurrentUnit, m_unit, m_convert );
CurrentConvert );
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(), DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(),
GetScreen()->m_MousePosition, GetScreen()->m_MousePosition,
m_currentComponent, CurrentUnit, m_component, m_unit, m_convert,
CurrentConvert,
LOCATE_ALL_DRAW_ITEM ); LOCATE_ALL_DRAW_ITEM );
} }
if( DrawEntry == NULL ) if( DrawEntry == NULL )
DrawEntry = LocatePin( GetScreen()->m_Curseur, DrawEntry = LocatePin( GetScreen()->m_Curseur,
m_currentComponent, CurrentUnit, m_component, m_unit,
CurrentConvert ); m_convert );
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(), DrawEntry = LocateDrawItem( (SCH_SCREEN*)GetScreen(),
GetScreen()->m_Curseur, GetScreen()->m_Curseur,
m_currentComponent, CurrentUnit, m_component, m_unit, m_convert,
CurrentConvert,
LOCATE_ALL_DRAW_ITEM ); LOCATE_ALL_DRAW_ITEM );
} }
if( DrawEntry == NULL ) if( DrawEntry == NULL )
DisplayCmpDoc(); DisplayCmpDoc();
SaveCopyInUndoList( m_currentComponent ); SaveCopyInUndoList( m_component );
if( DrawEntry->Type() == COMPONENT_PIN_DRAW_TYPE ) if( DrawEntry->Type() == COMPONENT_PIN_DRAW_TYPE )
DeletePin( DC, m_currentComponent, (LibDrawPin*) DrawEntry ); DeletePin( DC, m_component, (LibDrawPin*) DrawEntry );
else else
m_currentComponent->RemoveDrawItem( DrawEntry, DrawPanel, DC ); m_component->RemoveDrawItem( DrawEntry, DrawPanel, DC );
DrawEntry = NULL; DrawEntry = NULL;
GetScreen()->SetModify(); GetScreen()->SetModify();
break; break;
case ID_LIBEDIT_ANCHOR_ITEM_BUTT: case ID_LIBEDIT_ANCHOR_ITEM_BUTT:
SaveCopyInUndoList( m_currentComponent ); SaveCopyInUndoList( m_component );
PlaceAncre(); PlaceAncre();
SetToolID( 0, wxCURSOR_ARROW, wxEmptyString ); SetToolID( 0, wxCURSOR_ARROW, wxEmptyString );
break; break;
...@@ -183,39 +177,37 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -183,39 +177,37 @@ void WinEDA_LibeditFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
*/ */
void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
{ {
wxPoint pos = GetPosition(); wxPoint pos = GetPosition();
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem; LIB_DRAW_ITEM* DrawEntry = m_drawItem;
if( m_currentComponent == NULL ) if( m_component == NULL )
return; return;
if( ( DrawEntry == NULL ) || ( DrawEntry->m_Flags == 0 ) ) if( ( DrawEntry == NULL ) || ( DrawEntry->m_Flags == 0 ) )
{ // We can locate an item { // We can locate an item
DrawEntry = LocatePin( GetScreen()->m_MousePosition, m_currentComponent, DrawEntry = LocatePin( GetScreen()->m_MousePosition, m_component,
CurrentUnit, CurrentConvert ); m_unit, m_convert );
if( DrawEntry == NULL ) if( DrawEntry == NULL )
DrawEntry = LocatePin( GetScreen()->m_Curseur, m_currentComponent, DrawEntry = LocatePin( GetScreen()->m_Curseur, m_component,
CurrentUnit, CurrentConvert ); m_unit, m_convert );
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = CurrentDrawItem = DrawEntry = m_drawItem =
LocateDrawItem( (SCH_SCREEN*) GetScreen(), LocateDrawItem( (SCH_SCREEN*) GetScreen(),
GetScreen()->m_MousePosition, GetScreen()->m_MousePosition, m_component,
m_currentComponent, CurrentUnit, m_unit, m_convert, LOCATE_ALL_DRAW_ITEM );
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
} }
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = CurrentDrawItem = DrawEntry = m_drawItem =
LocateDrawItem( (SCH_SCREEN*) GetScreen(), LocateDrawItem( (SCH_SCREEN*) GetScreen(),
GetScreen()->m_Curseur, GetScreen()->m_Curseur, m_component, m_unit,
m_currentComponent, CurrentUnit, m_convert, LOCATE_ALL_DRAW_ITEM );
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
} }
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = CurrentDrawItem = DrawEntry = m_drawItem =
(LibEDA_BaseStruct*) LocateField( m_currentComponent ); (LIB_DRAW_ITEM*) LocateField( m_component );
} }
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
...@@ -228,7 +220,7 @@ void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -228,7 +220,7 @@ void WinEDA_LibeditFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
else else
return; return;
CurrentDrawItem = DrawEntry; m_drawItem = DrawEntry;
DrawPanel->m_IgnoreMouseEvents = TRUE; DrawPanel->m_IgnoreMouseEvents = TRUE;
......
...@@ -14,10 +14,10 @@ ...@@ -14,10 +14,10 @@
#include "hotkeys.h" #include "hotkeys.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditfrm.h" #include "libeditfrm.h"
#include "class_libentry.h"
/* functions to add commands and submenus depending on the item */ /* functions to add commands and submenus depending on the item */
...@@ -29,10 +29,10 @@ static void AddMenusForPin( wxMenu* PopMenu, LibDrawPin* Pin, ...@@ -29,10 +29,10 @@ static void AddMenusForPin( wxMenu* PopMenu, LibDrawPin* Pin,
bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos, bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos,
wxMenu* PopMenu ) wxMenu* PopMenu )
{ {
LibEDA_BaseStruct* DrawEntry = LocateItemUsingCursor(); LIB_DRAW_ITEM* DrawEntry = LocateItemUsingCursor();
bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE); bool BlockActive = (GetScreen()->m_BlockLocate.m_Command != BLOCK_IDLE);
if( m_currentComponent == NULL ) if( m_component == NULL )
return true; return true;
// If Command in progresss: put the menu "cancel" and "end tool" // If Command in progresss: put the menu "cancel" and "end tool"
...@@ -68,7 +68,7 @@ bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos, ...@@ -68,7 +68,7 @@ bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos,
else else
return true; return true;
CurrentDrawItem = DrawEntry; m_drawItem = DrawEntry;
wxString msg; wxString msg;
switch( DrawEntry->Type() ) switch( DrawEntry->Type() )
...@@ -211,7 +211,7 @@ bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos, ...@@ -211,7 +211,7 @@ bool WinEDA_LibeditFrame::OnRightClick( const wxPoint& MousePos,
StructType %d" ), StructType %d" ),
DrawEntry->Type() ); DrawEntry->Type() );
DisplayError( this, msg ); DisplayError( this, msg );
CurrentDrawItem = NULL; m_drawItem = NULL;
break; break;
} }
......
...@@ -7,10 +7,10 @@ ...@@ -7,10 +7,10 @@
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "libeditfrm.h" #include "libeditfrm.h"
#include "class_libentry.h"
/*************************************************************************/ /*************************************************************************/
...@@ -22,7 +22,7 @@ void WinEDA_LibeditFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, ...@@ -22,7 +22,7 @@ void WinEDA_LibeditFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
LIB_COMPONENT* CopyItem; LIB_COMPONENT* CopyItem;
PICKED_ITEMS_LIST* lastcmd; PICKED_ITEMS_LIST* lastcmd;
CopyItem = CopyLibEntryStruct( (LIB_COMPONENT*) ItemToCopy ); CopyItem = new LIB_COMPONENT( *( (LIB_COMPONENT*) ItemToCopy ) );
if( CopyItem == NULL ) if( CopyItem == NULL )
return; return;
...@@ -54,17 +54,17 @@ void WinEDA_LibeditFrame::GetComponentFromRedoList(wxCommandEvent& event) ...@@ -54,17 +54,17 @@ void WinEDA_LibeditFrame::GetComponentFromRedoList(wxCommandEvent& event)
return; return;
PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST(); PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
ITEM_PICKER wrapper(m_currentComponent, UR_LIBEDIT); ITEM_PICKER wrapper(m_component, UR_LIBEDIT);
lastcmd->PushItem(wrapper); lastcmd->PushItem(wrapper);
GetScreen()->PushCommandToUndoList( lastcmd ); GetScreen()->PushCommandToUndoList( lastcmd );
lastcmd = GetScreen()->PopCommandFromRedoList( ); lastcmd = GetScreen()->PopCommandFromRedoList( );
wrapper = lastcmd->PopItem(); wrapper = lastcmd->PopItem();
m_currentComponent = (LIB_COMPONENT*) wrapper.m_PickedItem; m_component = (LIB_COMPONENT*) wrapper.m_PickedItem;
if( m_currentComponent ) if( m_component )
m_currentComponent->SetNext( NULL ); m_component->SetNext( NULL );
CurrentDrawItem = NULL; m_drawItem = NULL;
GetScreen()->SetModify(); GetScreen()->SetModify();
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
...@@ -84,18 +84,18 @@ void WinEDA_LibeditFrame::GetComponentFromUndoList(wxCommandEvent& event) ...@@ -84,18 +84,18 @@ void WinEDA_LibeditFrame::GetComponentFromUndoList(wxCommandEvent& event)
return; return;
PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST(); PICKED_ITEMS_LIST* lastcmd = new PICKED_ITEMS_LIST();
ITEM_PICKER wrapper(m_currentComponent, UR_LIBEDIT); ITEM_PICKER wrapper(m_component, UR_LIBEDIT);
lastcmd->PushItem(wrapper); lastcmd->PushItem(wrapper);
GetScreen()->PushCommandToRedoList( lastcmd ); GetScreen()->PushCommandToRedoList( lastcmd );
lastcmd = GetScreen()->PopCommandFromUndoList( ); lastcmd = GetScreen()->PopCommandFromUndoList( );
wrapper = lastcmd->PopItem(); wrapper = lastcmd->PopItem();
m_currentComponent = (LIB_COMPONENT*) wrapper.m_PickedItem; m_component = (LIB_COMPONENT*) wrapper.m_PickedItem;
if( m_currentComponent ) if( m_component )
m_currentComponent->SetNext( NULL ); m_component->SetNext( NULL );
CurrentDrawItem = NULL; m_drawItem = NULL;
GetScreen()->SetModify(); GetScreen()->SetModify();
DrawPanel->Refresh(); DrawPanel->Refresh();
} }
...@@ -12,6 +12,7 @@ class SCH_SCREEN; ...@@ -12,6 +12,7 @@ class SCH_SCREEN;
class CMP_LIBRARY; class CMP_LIBRARY;
class LIB_COMPONENT; class LIB_COMPONENT;
class LIB_ALIAS; class LIB_ALIAS;
class LIB_DRAW_ITEM;
/** /**
* The component library editor main window. * The component library editor main window.
...@@ -39,6 +40,10 @@ public: ...@@ -39,6 +40,10 @@ public:
void CreateNewLibraryPart( wxCommandEvent& event ); void CreateNewLibraryPart( wxCommandEvent& event );
void OnEditComponentProperties( wxCommandEvent& event ); void OnEditComponentProperties( wxCommandEvent& event );
void InstallFieldsEditorDialog( wxCommandEvent& event ); void InstallFieldsEditorDialog( wxCommandEvent& event );
void LoadOneLibraryPart( wxCommandEvent& event );
void OnViewEntryDoc( wxCommandEvent& event );
void OnCheckComponent( wxCommandEvent& event );
void OnSelectBodyStyle( wxCommandEvent& event );
void OnUpdateEditingPart( wxUpdateUIEvent& event ); void OnUpdateEditingPart( wxUpdateUIEvent& event );
void OnUpdateNotEditingPart( wxUpdateUIEvent& event ); void OnUpdateNotEditingPart( wxUpdateUIEvent& event );
...@@ -74,17 +79,51 @@ public: ...@@ -74,17 +79,51 @@ public:
void LoadSettings(); void LoadSettings();
void SaveSettings(); void SaveSettings();
LIB_COMPONENT* GetCurrentComponent( void ) LIB_COMPONENT* GetComponent( void ) { return m_component; }
CMP_LIBRARY* GetLibrary( void ) { return m_library; }
wxString& GetAliasName( void ) { return m_aliasName; }
int GetUnit( void ) { return m_unit; }
void SetUnit( int unit )
{
wxASSERT( unit >= 1 );
m_unit = unit;
}
int GetConvert( void ) { return m_convert; }
void SetConvert( int convert )
{ {
return m_currentComponent; wxASSERT( convert >= 1 );
m_convert = convert;
} }
LIB_DRAW_ITEM* GetLastDrawItem( void ) { return m_lastDrawItem; }
void SetLastDrawItem( LIB_DRAW_ITEM* drawItem )
{
m_lastDrawItem = drawItem;
}
LIB_DRAW_ITEM* GetDrawItem( void ) { return m_drawItem; }
void SetDrawItem( LIB_DRAW_ITEM* drawItem )
{
m_drawItem = drawItem;
}
bool GetShowDeMorgan( void ) { return m_showDeMorgan; }
void SetShowDeMorgan( bool show ) { m_showDeMorgan = show; }
private: private:
// General: // General:
void SaveOnePartInMemory(); void SaveOnePartInMemory();
void SelectActiveLibrary(); void SelectActiveLibrary();
bool LoadOneLibraryPart();
void SaveActiveLibrary( wxCommandEvent& event ); void SaveActiveLibrary( wxCommandEvent& event );
bool LoadOneLibraryPartAux( CMP_LIB_ENTRY* LibEntry, bool LoadOneLibraryPartAux( CMP_LIB_ENTRY* LibEntry,
...@@ -109,26 +148,23 @@ private: ...@@ -109,26 +148,23 @@ private:
LibDrawPin* Pin ); LibDrawPin* Pin );
void StartMovePin( wxDC* DC ); void StartMovePin( wxDC* DC );
// Test des pins ( duplicates...)
bool TestPins( LIB_COMPONENT* LibEntry );
// Edition de l'ancre // Edition de l'ancre
void PlaceAncre(); void PlaceAncre();
// Edition des graphismes: // Edition des graphismes:
LibEDA_BaseStruct* CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* DC ); LIB_DRAW_ITEM* CreateGraphicItem( LIB_COMPONENT* LibEntry, wxDC* DC );
void GraphicItemBeginDraw( wxDC* DC ); void GraphicItemBeginDraw( wxDC* DC );
void StartMoveDrawSymbol( wxDC* DC ); void StartMoveDrawSymbol( wxDC* DC );
void EndDrawGraphicItem( wxDC* DC ); void EndDrawGraphicItem( wxDC* DC );
void LoadOneSymbol(); void LoadOneSymbol();
void SaveOneSymbol(); void SaveOneSymbol();
void EditGraphicSymbol( wxDC* DC, void EditGraphicSymbol( wxDC* DC,
LibEDA_BaseStruct* DrawItem ); LIB_DRAW_ITEM* DrawItem );
void EditSymbolText( wxDC* DC, LibEDA_BaseStruct* DrawItem ); void EditSymbolText( wxDC* DC, LIB_DRAW_ITEM* DrawItem );
void RotateSymbolText( wxDC* DC ); void RotateSymbolText( wxDC* DC );
void DeleteDrawPoly( wxDC* DC ); void DeleteDrawPoly( wxDC* DC );
LibDrawField* LocateField( LIB_COMPONENT* LibEntry ); LibDrawField* LocateField( LIB_COMPONENT* LibEntry );
LibEDA_BaseStruct* LocateItemUsingCursor(); LIB_DRAW_ITEM* LocateItemUsingCursor();
void RotateField( wxDC* DC, LibDrawField* Field ); void RotateField( wxDC* DC, LibDrawField* Field );
void PlaceField( wxDC* DC, LibDrawField* Field ); void PlaceField( wxDC* DC, LibDrawField* Field );
void EditField( wxDC* DC, LibDrawField* Field ); void EditField( wxDC* DC, LibDrawField* Field );
...@@ -152,7 +188,15 @@ protected: ...@@ -152,7 +188,15 @@ protected:
wxString m_LastLibImportPath; wxString m_LastLibImportPath;
wxString m_LastLibExportPath; wxString m_LastLibExportPath;
static LIB_COMPONENT* m_currentComponent; static LIB_COMPONENT* m_component;
static CMP_LIBRARY* m_library;
static LIB_DRAW_ITEM* m_lastDrawItem;
static LIB_DRAW_ITEM* m_drawItem;
static wxString m_aliasName;
static int m_unit;
static int m_convert;
static bool m_showDeMorgan;
static wxSize m_clientSize;
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
......
...@@ -9,10 +9,11 @@ ...@@ -9,10 +9,11 @@
#include "confirm.h" #include "confirm.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "libcmp.h"
#include "protos.h" #include "protos.h"
#include "libeditfrm.h" #include "libeditfrm.h"
#include "class_library.h"
/* Routines locales */ /* Routines locales */
...@@ -20,7 +21,7 @@ static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); ...@@ -20,7 +21,7 @@ static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
/* Variables locales */ /* Variables locales */
extern int CurrentUnit; extern int m_unit;
static wxPoint StartCursor, LastTextPosition; static wxPoint StartCursor, LastTextPosition;
...@@ -28,7 +29,15 @@ static void ExitMoveField( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -28,7 +29,15 @@ static void ExitMoveField( WinEDA_DrawPanel* Panel, wxDC* DC )
{ {
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
if( CurrentDrawItem == NULL )
WinEDA_LibeditFrame* parent = ( WinEDA_LibeditFrame* ) Panel->GetParent();
if( parent == NULL )
return;
LIB_DRAW_ITEM* item = parent->GetDrawItem();
if( item == NULL )
return; return;
wxPoint curpos = Panel->GetScreen()->m_Curseur; wxPoint curpos = Panel->GetScreen()->m_Curseur;
...@@ -36,9 +45,8 @@ static void ExitMoveField( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -36,9 +45,8 @@ static void ExitMoveField( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->GetScreen()->m_Curseur = StartCursor; Panel->GetScreen()->m_Curseur = StartCursor;
ShowMoveField( Panel, DC, TRUE ); ShowMoveField( Panel, DC, TRUE );
Panel->GetScreen()->m_Curseur = curpos; Panel->GetScreen()->m_Curseur = curpos;
CurrentDrawItem->m_Flags = 0; item->m_Flags = 0;
parent->SetDrawItem( NULL );
CurrentDrawItem = NULL;
} }
...@@ -49,12 +57,12 @@ void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LibDrawField* field ) ...@@ -49,12 +57,12 @@ void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LibDrawField* field )
{ {
wxPoint startPos; wxPoint startPos;
if( ( m_currentComponent == NULL ) || ( field == NULL ) ) if( ( m_component == NULL ) || ( field == NULL ) )
return; return;
CurrentDrawItem = field; m_drawItem = field;
LastTextPosition = field->m_Pos; LastTextPosition = field->m_Pos;
CurrentDrawItem->m_Flags |= IS_MOVED; m_drawItem->m_Flags |= IS_MOVED;
startPos.x = LastTextPosition.x; startPos.x = LastTextPosition.x;
startPos.y = -LastTextPosition.y; startPos.y = -LastTextPosition.y;
...@@ -77,12 +85,17 @@ void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LibDrawField* field ) ...@@ -77,12 +85,17 @@ void WinEDA_LibeditFrame::StartMoveField( wxDC* DC, LibDrawField* field )
/*****************************************************************/ /*****************************************************************/
static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) static void ShowMoveField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
LibDrawField* Field = (LibDrawField*) CurrentDrawItem; WinEDA_LibeditFrame* parent = (WinEDA_LibeditFrame*) panel->GetParent();
if( parent == NULL )
return;
LibDrawField* Field = (LibDrawField*) parent->GetDrawItem();
if( Field == NULL ) if( Field == NULL )
return; return;
wxString text = Field->GetFullText(); wxString text = Field->GetFullText( parent->GetUnit() );
if( erase ) if( erase )
Field->Draw( panel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &text, Field->Draw( panel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &text,
...@@ -107,7 +120,7 @@ void WinEDA_LibeditFrame::PlaceField( wxDC* DC, LibDrawField* Field ) ...@@ -107,7 +120,7 @@ void WinEDA_LibeditFrame::PlaceField( wxDC* DC, LibDrawField* Field )
Field->m_Pos.y = -GetScreen()->m_Curseur.y; Field->m_Pos.y = -GetScreen()->m_Curseur.y;
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
wxString fieldText = Field->GetFullText(); wxString fieldText = Field->GetFullText( m_unit );
Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE, Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, GR_DEFAULT_DRAWMODE,
&fieldText, DefaultTransformMatrix ); &fieldText, DefaultTransformMatrix );
...@@ -116,7 +129,7 @@ void WinEDA_LibeditFrame::PlaceField( wxDC* DC, LibDrawField* Field ) ...@@ -116,7 +129,7 @@ void WinEDA_LibeditFrame::PlaceField( wxDC* DC, LibDrawField* Field )
GetScreen()->SetModify(); GetScreen()->SetModify();
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
DrawPanel->ForceCloseManageCurseur = NULL; DrawPanel->ForceCloseManageCurseur = NULL;
CurrentDrawItem = NULL; m_drawItem = NULL;
} }
...@@ -148,13 +161,12 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field ) ...@@ -148,13 +161,12 @@ void WinEDA_LibeditFrame::EditField( wxDC* DC, LibDrawField* Field )
Get_Message( title, _( "Edit field" ), Text, this ); Get_Message( title, _( "Edit field" ), Text, this );
Text.Replace( wxT( " " ), wxT( "_" ) ); Text.Replace( wxT( " " ), wxT( "_" ) );
/* If the value is changed, this is equivalent to create a new component /* If the value field is changed, this is equivalent to creating a new
* from the old one. * component from the old one. Check for an existing library entry of
* So we must check for an existing alias of this "new" component * this "new" component and change the value only if there is no existing
* and change the value only if there is no existing alias with the same * entry with the same name.
* name for this component
*/ */
if( Field->m_FieldId == VALUE ) if( Field->m_FieldId == VALUE && Text != Field->m_Text )
{ {
wxString msg; wxString msg;
...@@ -173,19 +185,19 @@ names in the alias list." ), ...@@ -173,19 +185,19 @@ names in the alias list." ),
/* Test for an existing entry in the library to prevent duplicate /* Test for an existing entry in the library to prevent duplicate
* entry names. * entry names.
*/ */
if( CurrentLib && CurrentLib->FindEntry( Text ) != NULL ) if( m_library && m_library->FindEntry( Text ) != NULL )
{ {
msg.Printf( _( "The field name <%s> conflicts with an existing \ msg.Printf( _( "The field name <%s> conflicts with an existing \
entry in the component library <%s>.\nPlease choose another name that does \ entry in the component library <%s>.\nPlease choose another name that does \
not conflict with any library entries." ), not conflict with any library entries." ),
(const wxChar*) Text, (const wxChar*) Text,
(const wxChar*) CurrentLib->GetName() ); (const wxChar*) m_library->GetName() );
DisplayError( this, msg ); DisplayError( this, msg );
return; return;
} }
} }
wxString fieldText = Field->GetFullText(); wxString fieldText = Field->GetFullText( m_unit );
Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &fieldText, Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &fieldText,
DefaultTransformMatrix ); DefaultTransformMatrix );
...@@ -200,7 +212,7 @@ not conflict with any library entries." ), ...@@ -200,7 +212,7 @@ not conflict with any library entries." ),
DisplayError( this, _( "No new text: no change" ) ); DisplayError( this, _( "No new text: no change" ) );
} }
fieldText = Field->GetFullText(); fieldText = Field->GetFullText( m_unit );
int drawMode = g_XorMode; int drawMode = g_XorMode;
if( Field->m_Flags == 0 ) if( Field->m_Flags == 0 )
...@@ -229,7 +241,7 @@ void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field ) ...@@ -229,7 +241,7 @@ void WinEDA_LibeditFrame::RotateField( wxDC* DC, LibDrawField* Field )
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
GRSetDrawMode( DC, g_XorMode ); GRSetDrawMode( DC, g_XorMode );
wxString fieldText = Field->GetFullText(); wxString fieldText = Field->GetFullText( m_unit );
Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &fieldText, Field->Draw( DrawPanel, DC, wxPoint( 0, 0 ), -1, g_XorMode, &fieldText,
DefaultTransformMatrix ); DefaultTransformMatrix );
...@@ -283,37 +295,35 @@ LibDrawField* WinEDA_LibeditFrame::LocateField( LIB_COMPONENT* LibEntry ) ...@@ -283,37 +295,35 @@ LibDrawField* WinEDA_LibeditFrame::LocateField( LIB_COMPONENT* LibEntry )
} }
LibEDA_BaseStruct* WinEDA_LibeditFrame::LocateItemUsingCursor() LIB_DRAW_ITEM* WinEDA_LibeditFrame::LocateItemUsingCursor()
{ {
LibEDA_BaseStruct* DrawEntry = CurrentDrawItem; LIB_DRAW_ITEM* DrawEntry = m_drawItem;
if( m_currentComponent == NULL ) if( m_component == NULL )
return NULL; return NULL;
if( ( DrawEntry == NULL ) || ( DrawEntry->m_Flags == 0 ) ) if( ( DrawEntry == NULL ) || ( DrawEntry->m_Flags == 0 ) )
{ {
DrawEntry = LocatePin( GetScreen()->m_Curseur, m_currentComponent, DrawEntry = LocatePin( GetScreen()->m_Curseur, m_component,
CurrentUnit, CurrentConvert ); m_unit, m_convert );
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = CurrentDrawItem = DrawEntry = m_drawItem =
LocateDrawItem( (SCH_SCREEN*) GetScreen(), LocateDrawItem( (SCH_SCREEN*) GetScreen(),
GetScreen()->m_MousePosition, GetScreen()->m_MousePosition, m_component,
m_currentComponent, CurrentUnit, m_unit, m_convert, LOCATE_ALL_DRAW_ITEM );
CurrentConvert, LOCATE_ALL_DRAW_ITEM );
} }
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = CurrentDrawItem = DrawEntry = m_drawItem =
LocateDrawItem( (SCH_SCREEN*) GetScreen(), LocateDrawItem( (SCH_SCREEN*) GetScreen(),
GetScreen()->m_Curseur, m_currentComponent, GetScreen()->m_Curseur, m_component,
CurrentUnit, CurrentConvert, m_unit, m_convert, LOCATE_ALL_DRAW_ITEM );
LOCATE_ALL_DRAW_ITEM );
} }
if( DrawEntry == NULL ) if( DrawEntry == NULL )
{ {
DrawEntry = CurrentDrawItem = DrawEntry = m_drawItem =
(LibEDA_BaseStruct*) LocateField( m_currentComponent ); (LIB_DRAW_ITEM*) LocateField( m_component );
} }
} }
......
This diff is collapsed.
...@@ -5,12 +5,13 @@ ...@@ -5,12 +5,13 @@
#include "fctsys.h" #include "fctsys.h"
#include "confirm.h" #include "confirm.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
/* in read_from_file_schematic_items_description.cpp */ /* in read_from_file_schematic_items_description.cpp */
SCH_ITEM* ReadTextDescr( FILE* aFile, wxString& aMsgDiag, char* aLine, SCH_ITEM* ReadTextDescr( FILE* aFile, wxString& aMsgDiag, char* aLine,
int aBufsize, int* aLineNum, int aBufsize, int* aLineNum,
......
...@@ -5,16 +5,19 @@ ...@@ -5,16 +5,19 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h"
#include "trigo.h" #include "trigo.h"
#include "macros.h" #include "macros.h"
#include "class_marker_sch.h"
#include "libcmp.h"
#include "general.h"
#include "class_marker_sch.h"
#include "protos.h" #include "protos.h"
#include "class_library.h"
/* Routines Locales */ /* Routines Locales */
static bool DrawStructInBox(int x1, int y1, int x2, int y2, SCH_ITEM *DrawStruct); static bool DrawStructInBox( int x1, int y1, int x2, int y2,
SCH_ITEM *DrawStruct );
static SCH_ITEM* LastSnappedStruct = NULL; static SCH_ITEM* LastSnappedStruct = NULL;
static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1, static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
int StartX2, int StartY2, int EndX2, int EndY2 ); int StartX2, int StartY2, int EndX2, int EndY2 );
...@@ -612,12 +615,12 @@ static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1, ...@@ -612,12 +615,12 @@ static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
/*********************************************************************************/ /*********************************************************************************/
LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen, LIB_DRAW_ITEM* LocateDrawItem( SCH_SCREEN* Screen,
const wxPoint& aRefPoint, const wxPoint& aRefPoint,
LIB_COMPONENT* LibEntry, LIB_COMPONENT* LibEntry,
int Unit, int Unit,
int Convert, int Convert,
int masque ) int masque )
/*********************************************************************************/ /*********************************************************************************/
/* Locates a body item( not pins ) /* Locates a body item( not pins )
...@@ -626,7 +629,7 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen, ...@@ -626,7 +629,7 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
* remember the Y axis is from bottom to top in library entries for graphic items. * remember the Y axis is from bottom to top in library entries for graphic items.
*/ */
{ {
LibEDA_BaseStruct* DrawItem; LIB_DRAW_ITEM* DrawItem;
if( LibEntry == NULL ) if( LibEntry == NULL )
return NULL; return NULL;
...@@ -717,7 +720,7 @@ LibDrawPin* LocatePinByNumber( const wxString& ePin_Number, ...@@ -717,7 +720,7 @@ LibDrawPin* LocatePinByNumber( const wxString& ePin_Number,
* @return a pointer on the pin, or NULL if not found * @return a pointer on the pin, or NULL if not found
*/ */
{ {
LibEDA_BaseStruct* DrawItem; LIB_DRAW_ITEM* DrawItem;
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
LibDrawPin* Pin; LibDrawPin* Pin;
int Unit, Convert; int Unit, Convert;
...@@ -760,8 +763,8 @@ LibDrawPin* LocatePinByNumber( const wxString& ePin_Number, ...@@ -760,8 +763,8 @@ LibDrawPin* LocatePinByNumber( const wxString& ePin_Number,
/*******************************************************************/ /*******************************************************************/
LibEDA_BaseStruct* LocatePin( const wxPoint& RefPos, LIB_COMPONENT* Entry, LIB_DRAW_ITEM* LocatePin( const wxPoint& RefPos, LIB_COMPONENT* Entry,
int Unit, int convert, SCH_COMPONENT* DrawLibItem ) int Unit, int convert, SCH_COMPONENT* DrawLibItem )
/*******************************************************************/ /*******************************************************************/
/* Routine de localisation d'une PIN de la PartLib pointee par Entry /* Routine de localisation d'une PIN de la PartLib pointee par Entry
...@@ -779,7 +782,7 @@ LibEDA_BaseStruct* LocatePin( const wxPoint& RefPos, LIB_COMPONENT* Entry, ...@@ -779,7 +782,7 @@ LibEDA_BaseStruct* LocatePin( const wxPoint& RefPos, LIB_COMPONENT* Entry,
return NULL; return NULL;
} }
LibEDA_BaseStruct* DrawItem = Entry->m_Drawings; LIB_DRAW_ITEM* DrawItem = Entry->m_Drawings;
for( ; DrawItem != NULL; DrawItem = DrawItem->Next() ) for( ; DrawItem != NULL; DrawItem = DrawItem->Next() )
{ {
if( DrawItem->Type() == COMPONENT_PIN_DRAW_TYPE ) /* Pin Trouvee */ if( DrawItem->Type() == COMPONENT_PIN_DRAW_TYPE ) /* Pin Trouvee */
......
...@@ -9,10 +9,10 @@ ...@@ -9,10 +9,10 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "bitmaps.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "bitmaps.h"
#include "protos.h" #include "protos.h"
#include "eeschema_id.h" #include "eeschema_id.h"
#include "hotkeys.h" #include "hotkeys.h"
......
...@@ -8,13 +8,14 @@ ...@@ -8,13 +8,14 @@
#include "confirm.h" #include "confirm.h"
#include "kicad_string.h" #include "kicad_string.h"
#include "gestfich.h" #include "gestfich.h"
#include "appl_wxstruct.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "netlist.h" #include "netlist.h"
#include "appl_wxstruct.h"
#include "protos.h" #include "protos.h"
#include "class_library.h"
/* Routines locales */ /* Routines locales */
static void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame, const wxString& FullFileName ); static void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame, const wxString& FullFileName );
...@@ -108,9 +109,9 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList( ...@@ -108,9 +109,9 @@ static SCH_COMPONENT* FindNextComponentAndCreatPinList(
* Must be deallocated by the user * Must be deallocated by the user
*/ */
{ {
SCH_COMPONENT* Component = NULL; SCH_COMPONENT* Component = NULL;
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
LibEDA_BaseStruct* DEntry; LIB_DRAW_ITEM* DEntry;
s_SortedComponentPinList.clear(); s_SortedComponentPinList.clear();
for( ; DrawList != NULL; DrawList = DrawList->Next() ) for( ; DrawList != NULL; DrawList = DrawList->Next() )
...@@ -767,7 +768,7 @@ static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component_in, ...@@ -767,7 +768,7 @@ static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component_in,
{ {
EDA_BaseStruct* SchItem; EDA_BaseStruct* SchItem;
SCH_COMPONENT* Component2; SCH_COMPONENT* Component2;
LibEDA_BaseStruct* DEntry; LIB_DRAW_ITEM* DEntry;
DrawSheetPath* sheet; DrawSheetPath* sheet;
wxString str, Reference = Component_in->GetRef( Sheet_in ); wxString str, Reference = Component_in->GetRef( Sheet_in );
......
...@@ -4,15 +4,16 @@ ...@@ -4,15 +4,16 @@
#include "fctsys.h" #include "fctsys.h"
#include "common.h" #include "common.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "netlist.h" /* Definitions generales liees au calcul de netliste */ #include "netlist.h" /* Definitions generales liees au calcul de netliste */
#include "protos.h" #include "protos.h"
#include "class_library.h"
#include "algorithm" #include "algorithm"
// Buffer to build the list of items used in netlist and erc calculations // Buffer to build the list of items used in netlist and erc calculations
NETLIST_OBJECT_LIST g_NetObjectslist; NETLIST_OBJECT_LIST g_NetObjectslist;
...@@ -354,7 +355,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist, ...@@ -354,7 +355,7 @@ static void ListeObjetConnection( DrawSheetPath* sheetlist,
NETLIST_OBJECT* new_item; NETLIST_OBJECT* new_item;
SCH_COMPONENT* DrawLibItem; SCH_COMPONENT* DrawLibItem;
LIB_COMPONENT* Entry; LIB_COMPONENT* Entry;
LibEDA_BaseStruct* DEntry; LIB_DRAW_ITEM* DEntry;
Hierarchical_PIN_Sheet_Struct* SheetLabel; Hierarchical_PIN_Sheet_Struct* SheetLabel;
DrawSheetPath list; DrawSheetPath list;
......
...@@ -5,6 +5,10 @@ ...@@ -5,6 +5,10 @@
#ifndef _NETLIST_H_ #ifndef _NETLIST_H_
#define _NETLIST_H_ #define _NETLIST_H_
#include "class_libentry.h"
#define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1" #define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1"
#define ISBUS 1 #define ISBUS 1
......
...@@ -17,13 +17,14 @@ ...@@ -17,13 +17,14 @@
#include "common.h" #include "common.h"
#include "confirm.h" #include "confirm.h"
#include "gestfich.h" #include "gestfich.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "netlist.h" #include "netlist.h"
#include "protos.h" #include "protos.h"
#include "netlist_control.h" #include "netlist_control.h"
// ID for configuration: // ID for configuration:
#define CUSTOM_NETLIST_TITLE wxT( "CustomNetlistTitle" ) #define CUSTOM_NETLIST_TITLE wxT( "CustomNetlistTitle" )
#define CUSTOM_NETLIST_COMMAND wxT( "CustomNetlistCommand" ) #define CUSTOM_NETLIST_COMMAND wxT( "CustomNetlistCommand" )
......
...@@ -9,12 +9,11 @@ ...@@ -9,12 +9,11 @@
#include "confirm.h" #include "confirm.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
#include "protos.h" #include "protos.h"
static wxArrayString s_CmpNameList; static wxArrayString s_CmpNameList;
static wxArrayString s_PowerNameList; static wxArrayString s_PowerNameList;
......
...@@ -8,16 +8,15 @@ ...@@ -8,16 +8,15 @@
#include "eeschema_id.h" #include "eeschema_id.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "bitmaps.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
#include "protos.h" #include "protos.h"
#include "hotkeys.h" #include "hotkeys.h"
#include "class_library.h"
#include "bitmaps.h"
/* functions to add commands and submenus depending on the item */ /* functions to add commands and submenus depending on the item */
static void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame ); static void AddMenusForBlock( wxMenu* PopMenu, WinEDA_SchematicFrame* frame );
......
...@@ -8,18 +8,20 @@ ...@@ -8,18 +8,20 @@
#include "appl_wxstruct.h" #include "appl_wxstruct.h"
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "class_marker_sch.h" #include "class_marker_sch.h"
#include "protos.h" #include "protos.h"
/* Exported Functions */ /* Exported Functions */
void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector ); void MoveItemsInList( PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector );
void MirrorListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint ); void MirrorListOfItems( PICKED_ITEMS_LIST& aItemsList, wxPoint& aMirrorPoint );
void DeleteItemsInList( WinEDA_DrawPanel* panel, PICKED_ITEMS_LIST& aItemsList ); void DeleteItemsInList( WinEDA_DrawPanel* panel,
void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList, const wxPoint aMoveVector ); PICKED_ITEMS_LIST& aItemsList );
void DuplicateItemsInList( SCH_SCREEN* screen, PICKED_ITEMS_LIST& aItemsList,
const wxPoint aMoveVector );
/***************************************************************************** /*****************************************************************************
......
This diff is collapsed.
This diff is collapsed.
...@@ -11,9 +11,10 @@ ...@@ -11,9 +11,10 @@
#include "trigo.h" #include "trigo.h"
#include "program.h" #include "program.h"
#include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "class_library.h"
/* Local Variables : */ /* Local Variables : */
static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter, static void Plot_Hierarchical_PIN_Sheet( PLOTTER* plotter,
...@@ -64,7 +65,7 @@ static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem ) ...@@ -64,7 +65,7 @@ static void PlotLibPart( PLOTTER* plotter, SCH_COMPONENT* DrawLibItem )
Multi = DrawLibItem->m_Multi; Multi = DrawLibItem->m_Multi;
convert = DrawLibItem->m_Convert; convert = DrawLibItem->m_Convert;
for( LibEDA_BaseStruct* DEntry = Entry->m_Drawings; for( LIB_DRAW_ITEM* DEntry = Entry->m_Drawings;
DEntry != NULL; DEntry = DEntry->Next() ) DEntry != NULL; DEntry = DEntry->Next() )
{ {
/* Elimination des elements non relatifs a l'unite */ /* Elimination des elements non relatifs a l'unite */
......
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.
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.
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.
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