Commit 3ef380f9 authored by dickelbeck's avatar dickelbeck

dlist cleanups, start of edit component in schematic rework

parent 4d3d0a8f
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
// Name: 3d_class.cpp // Name: 3d_class.cpp
///////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////
...@@ -20,59 +21,62 @@ ...@@ -20,59 +21,62 @@
S3D_Vertex::S3D_Vertex() S3D_Vertex::S3D_Vertex()
/****************************/ /****************************/
{ {
x = y = z = 0.0; x = y = z = 0.0;
} }
/**************************************************************************/ /**************************************************************************/
S3D_Material::S3D_Material( Struct3D_Master * father, const wxString & name ): S3D_Material::S3D_Material( Struct3D_Master* father, const wxString& name ) :
EDA_BaseStruct( father, NOT_USED ) EDA_BaseStruct( father, NOT_USED )
/**************************************************************************/ /**************************************************************************/
{ {
m_DiffuseColor.x = m_DiffuseColor.y = m_DiffuseColor.z = 1.0; m_DiffuseColor.x = m_DiffuseColor.y = m_DiffuseColor.z = 1.0;
m_SpecularColor.x = m_SpecularColor.y = m_SpecularColor.z = 1.0; m_SpecularColor.x = m_SpecularColor.y = m_SpecularColor.z = 1.0;
m_AmbientIntensity = 1.0; m_AmbientIntensity = 1.0;
m_Transparency = 0.0; m_Transparency = 0.0;
m_Shininess = 1.0; m_Shininess = 1.0;
m_Name = name; m_Name = name;
} }
/***********************************/ /***********************************/
void S3D_Material::SetMaterial() void S3D_Material::SetMaterial()
/***********************************/ /***********************************/
{ {
glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE); glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
glColor4f(m_DiffuseColor.x * m_AmbientIntensity, glColor4f( m_DiffuseColor.x * m_AmbientIntensity,
m_DiffuseColor.y * m_AmbientIntensity, m_DiffuseColor.y * m_AmbientIntensity,
m_DiffuseColor.z * m_AmbientIntensity, m_DiffuseColor.z * m_AmbientIntensity,
1.0 - m_Transparency ); 1.0 - m_Transparency );
#if 0 #if 0
glColorMaterial(GL_FRONT_AND_BACK,GL_SPECULAR); glColorMaterial( GL_FRONT_AND_BACK, GL_SPECULAR );
glColor3f(m_SpecularColor.x, m_SpecularColor.y,m_SpecularColor.z); glColor3f( m_SpecularColor.x, m_SpecularColor.y, m_SpecularColor.z );
#endif #endif
glColorMaterial(GL_FRONT_AND_BACK,GL_AMBIENT_AND_DIFFUSE); glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
} }
/****************************************************/ /****************************************************/
void Struct3D_Master::Copy(Struct3D_Master * pattern) void Struct3D_Master::Copy( Struct3D_Master* pattern )
/****************************************************/ /****************************************************/
{ {
m_Shape3DName = pattern->m_Shape3DName; m_Shape3DName = pattern->m_Shape3DName;
m_MatScale = pattern->m_MatScale; m_MatScale = pattern->m_MatScale;
m_MatRotation = pattern->m_MatRotation; m_MatRotation = pattern->m_MatRotation;
m_MatPosition = pattern->m_MatPosition; m_MatPosition = pattern->m_MatPosition;
m_3D_Drawings = NULL; m_3D_Drawings = NULL;
m_Materials = NULL; m_Materials = NULL;
} }
/***************************************************************/ /***************************************************************/
Struct3D_Master::Struct3D_Master(EDA_BaseStruct * StructFather): Struct3D_Master::Struct3D_Master( EDA_BaseStruct* StructFather ) :
EDA_BaseStruct( StructFather, NOT_USED ) EDA_BaseStruct( StructFather, NOT_USED )
/***************************************************************/ /***************************************************************/
{ {
m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0; m_MatScale.x = m_MatScale.y = m_MatScale.z = 1.0;
m_3D_Drawings = NULL; m_3D_Drawings = NULL;
m_Materials = NULL; m_Materials = NULL;
} }
...@@ -80,32 +84,31 @@ Struct3D_Master::Struct3D_Master(EDA_BaseStruct * StructFather): ...@@ -80,32 +84,31 @@ Struct3D_Master::Struct3D_Master(EDA_BaseStruct * StructFather):
Struct3D_Master:: ~Struct3D_Master() Struct3D_Master:: ~Struct3D_Master()
/***************************************/ /***************************************/
{ {
Struct3D_Shape * next; Struct3D_Shape* next;
S3D_Material * nextmat; S3D_Material* nextmat;
for( ; m_3D_Drawings != NULL; m_3D_Drawings = next ) for( ; m_3D_Drawings != NULL; m_3D_Drawings = next )
{ {
next = (Struct3D_Shape *) m_3D_Drawings->Pnext; next = m_3D_Drawings->Next();
delete m_3D_Drawings; delete m_3D_Drawings;
} }
for( ; m_Materials != NULL; m_Materials = nextmat ) for( ; m_Materials != NULL; m_Materials = nextmat )
{ {
nextmat = (S3D_Material *) m_Materials->Pnext; nextmat = m_Materials->Next();
delete m_Materials; delete m_Materials;
} }
} }
/***************************************************************/ /***************************************************************/
Struct3D_Shape::Struct3D_Shape(EDA_BaseStruct * StructFather): Struct3D_Shape::Struct3D_Shape( EDA_BaseStruct* StructFather ) :
EDA_BaseStruct( StructFather, NOT_USED ) EDA_BaseStruct( StructFather, NOT_USED )
/***************************************************************/ /***************************************************************/
{ {
m_3D_Coord = NULL; m_3D_Coord = NULL;
m_3D_CoordIndex = NULL; m_3D_CoordIndex = NULL;
m_3D_Points = 0; m_3D_Points = 0;
} }
...@@ -113,7 +116,6 @@ Struct3D_Shape::Struct3D_Shape(EDA_BaseStruct * StructFather): ...@@ -113,7 +116,6 @@ Struct3D_Shape::Struct3D_Shape(EDA_BaseStruct * StructFather):
Struct3D_Shape:: ~Struct3D_Shape() Struct3D_Shape:: ~Struct3D_Shape()
/***************************************/ /***************************************/
{ {
delete m_3D_Coord; delete m_3D_Coord;
delete m_3D_CoordIndex; delete m_3D_CoordIndex;
} }
...@@ -214,7 +214,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List() ...@@ -214,7 +214,7 @@ GLuint Pcb3D_GLCanvas::CreateDrawGL_List()
/* draw graphic items */ /* draw graphic items */
EDA_BaseStruct* PtStruct; EDA_BaseStruct* PtStruct;
for( PtStruct = pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( PtStruct = pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
switch( PtStruct->Type() ) switch( PtStruct->Type() )
{ {
...@@ -466,7 +466,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas ) ...@@ -466,7 +466,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
/* Draw pads */ /* Draw pads */
glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE ); glColorMaterial( GL_FRONT_AND_BACK, GL_AMBIENT_AND_DIFFUSE );
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
for( ; pad != NULL; pad = (D_PAD*) pad->Pnext ) for( ; pad != NULL; pad = pad->Next() )
{ {
pad->Draw3D( glcanvas ); pad->Draw3D( glcanvas );
} }
...@@ -477,9 +477,11 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas ) ...@@ -477,9 +477,11 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
if( g_Parm_3D_Visu.m_Draw3DModule ) if( g_Parm_3D_Visu.m_Draw3DModule )
{ {
glPushMatrix(); glPushMatrix();
glTranslatef( m_Pos.x * g_Parm_3D_Visu.m_BoardScale, glTranslatef( m_Pos.x * g_Parm_3D_Visu.m_BoardScale,
-m_Pos.y * g_Parm_3D_Visu.m_BoardScale, -m_Pos.y * g_Parm_3D_Visu.m_BoardScale,
g_Parm_3D_Visu.m_LayerZcoord[m_Layer] ); g_Parm_3D_Visu.m_LayerZcoord[m_Layer] );
if( m_Orient ) if( m_Orient )
{ {
glRotatef( (double) m_Orient / 10, 0.0, 0.0, 1.0 ); glRotatef( (double) m_Orient / 10, 0.0, 0.0, 1.0 );
...@@ -491,7 +493,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas ) ...@@ -491,7 +493,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
} }
DataScale3D = g_Parm_3D_Visu.m_BoardScale * UNITS3D_TO_UNITSPCB; DataScale3D = g_Parm_3D_Visu.m_BoardScale * UNITS3D_TO_UNITSPCB;
for( ; Struct3D != NULL; Struct3D = (Struct3D_Master*) Struct3D->Pnext ) for( ; Struct3D != NULL; Struct3D = Struct3D->Next() )
{ {
if( !Struct3D->m_Shape3DName.IsEmpty() ) if( !Struct3D->m_Shape3DName.IsEmpty() )
{ {
...@@ -507,7 +509,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas ) ...@@ -507,7 +509,7 @@ void MODULE::Draw3D( Pcb3D_GLCanvas* glcanvas )
{ {
EDA_BaseStruct* Struct = m_Drawings; EDA_BaseStruct* Struct = m_Drawings;
glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis glNormal3f( 0.0, 0.0, 1.0 ); // Normal is Z axis
for( ; Struct != NULL; Struct = Struct->Pnext ) for( ; Struct != NULL; Struct = Struct->Next() )
{ {
switch( Struct->Type() ) switch( Struct->Type() )
{ {
......
...@@ -108,8 +108,7 @@ int Struct3D_Master:: ReadMaterial( FILE* file, int* LineNum ) ...@@ -108,8 +108,7 @@ int Struct3D_Master:: ReadMaterial( FILE* file, int* LineNum )
mat_name = CONV_FROM_UTF8( text ); mat_name = CONV_FROM_UTF8( text );
if( stricmp( command, "USE" ) == 0 ) if( stricmp( command, "USE" ) == 0 )
{ {
for( material = m_Materials; material != NULL; for( material = m_Materials; material; material = material->Next() )
material = (S3D_Material*) material->Pnext )
{ {
if( material->m_Name == mat_name ) if( material->m_Name == mat_name )
{ {
...@@ -126,8 +125,8 @@ int Struct3D_Master:: ReadMaterial( FILE* file, int* LineNum ) ...@@ -126,8 +125,8 @@ int Struct3D_Master:: ReadMaterial( FILE* file, int* LineNum )
{ {
material = new S3D_Material( this, mat_name ); material = new S3D_Material( this, mat_name );
material->Pnext = m_Materials; Insert( material );
m_Materials = material;
while( GetLine( file, line, LineNum, 512 ) ) while( GetLine( file, line, LineNum, 512 ) )
{ {
text = strtok( line, " \t\n\r" ); text = strtok( line, " \t\n\r" );
...@@ -297,7 +296,7 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNu ...@@ -297,7 +296,7 @@ double* ReadCoordsList( FILE* file, char* text_buffer, int* bufsize, int* LineNu
* 0.923880 -4.09802e-6 0.382683, * 0.923880 -4.09802e-6 0.382683,
* 0.707107 -9.38186e-7 0.707107] * 0.707107 -9.38186e-7 0.707107]
* } * }
* *
* Return the coordinate list * Return the coordinate list
* text_buffer contains the first line of this node : * text_buffer contains the first line of this node :
* "coord Coordinate { point [" * "coord Coordinate { point ["
......
/********************************************************/ /********************************************************/
/* 3d_struct.h : definition des structures de donnees */ /* 3d_struct.h : definition des structures de donnees */
/* pour la representation 3D des modules */ /* pour la representation 3D des modules */
/********************************************************/ /********************************************************/
#ifndef STRUCT_3D_H #ifndef STRUCT_3D_H
#define STRUCT_3D_H #define STRUCT_3D_H
...@@ -9,128 +9,143 @@ ...@@ -9,128 +9,143 @@
#include "base_struct.h" #include "base_struct.h"
/* 3D modeler units -> PCB units conversion scale: /* 3D modeler units -> PCB units conversion scale:
1 "3D unit modeler" = 1 unit wings3d = 2,54 mm = 0.1 inch */ * 1 "3D unit modeler" = 1 unit wings3d = 2,54 mm = 0.1 inch */
#define UNITS3D_TO_UNITSPCB 1000 #define UNITS3D_TO_UNITSPCB 1000
class Struct3D_Master; class Struct3D_Master;
class Struct3D_Shape; class Struct3D_Shape;
class S3D_Color /* This is a 3D color (R, G, G) 3 floats range 0 to 1.0*/ class S3D_Color /* This is a 3D color (R, G, G) 3 floats range 0 to 1.0*/
{ {
public: public:
double m_Red, m_Green, m_Blue; double m_Red, m_Green, m_Blue;
public: public:
S3D_Color() S3D_Color() {
{ m_Red = m_Green = m_Blue = 0;
m_Red = m_Green = m_Blue = 0; }
}
}; };
class S3D_Vertex /* This is a 3D coordinate (3 float numbers: x,y,z coordinates)*/ class S3D_Vertex /* This is a 3D coordinate (3 float numbers: x,y,z coordinates)*/
{ {
public: public:
double x, y, z; double x, y, z;
public: public:
S3D_Vertex(); S3D_Vertex();
}; };
class S3D_Material: public EDA_BaseStruct /* openGL "material" data*/ class S3D_Material : public EDA_BaseStruct /* openGL "material" data*/
{ {
public: public:
wxString m_Name; wxString m_Name;
S3D_Vertex m_DiffuseColor; S3D_Vertex m_DiffuseColor;
S3D_Vertex m_EmissiveColor; S3D_Vertex m_EmissiveColor;
S3D_Vertex m_SpecularColor; S3D_Vertex m_SpecularColor;
float m_AmbientIntensity; float m_AmbientIntensity;
float m_Transparency; float m_Transparency;
float m_Shininess; float m_Shininess;
public: public:
S3D_Material(Struct3D_Master * father, const wxString & name); S3D_Material( Struct3D_Master * father, const wxString &name );
void SetMaterial();
S3D_Material* Next() const { return (S3D_Material*) Pnext; }
S3D_Material* Back() const { return (S3D_Material*) Pback; }
void SetMaterial();
}; };
/*******************************************/ /*******************************************/
class Struct3D_Master: public EDA_BaseStruct class Struct3D_Master : public EDA_BaseStruct
/*******************************************/ /*******************************************/
/* Master structure for a 3D item description */ /* Master structure for a 3D item description */
{ {
public: public:
wxString m_Shape3DName; /* 3D shape name in 3D library */ wxString m_Shape3DName; /* 3D shape name in 3D library */
S3D_Vertex m_MatScale; S3D_Vertex m_MatScale;
S3D_Vertex m_MatRotation; S3D_Vertex m_MatRotation;
S3D_Vertex m_MatPosition; S3D_Vertex m_MatPosition;
Struct3D_Shape * m_3D_Drawings; Struct3D_Shape* m_3D_Drawings;
S3D_Material *m_Materials; S3D_Material* m_Materials;
public: public:
Struct3D_Master(EDA_BaseStruct * StructFather); Struct3D_Master( EDA_BaseStruct * StructFather );
~Struct3D_Master(); ~Struct3D_Master();
void Copy(Struct3D_Master * pattern); Struct3D_Master* Next() const { return (Struct3D_Master*) Pnext; }
int ReadData(); Struct3D_Master* Back() const { return (Struct3D_Master*) Pback; }
int ReadMaterial(FILE * file, int *LineNum);
int ReadChildren(FILE * file, int *LineNum); void Insert( S3D_Material* aMaterial )
int ReadShape(FILE * file, int *LineNum); {
int ReadAppearance(FILE * file, int *LineNum); aMaterial->SetNext( m_Materials );
int ReadGeometry(FILE * file, int *LineNum); m_Materials = aMaterial;
void Set_Object_Coords(S3D_Vertex * coord, int nbcoord ); }
void Copy( Struct3D_Master* pattern );
int ReadData();
int ReadMaterial( FILE* file, int* LineNum );
int ReadChildren( FILE* file, int* LineNum );
int ReadShape( FILE* file, int* LineNum );
int ReadAppearance( FILE* file, int* LineNum );
int ReadGeometry( FILE* file, int* LineNum );
void Set_Object_Coords( S3D_Vertex* coord, int nbcoord );
}; };
/*********************************************/ /*********************************************/
class Struct3D_Shape: public EDA_BaseStruct class Struct3D_Shape : public EDA_BaseStruct
/*********************************************/ /*********************************************/
/* decrit une forme complexe 3D */ /* decrit une forme complexe 3D */
{ {
public: public:
S3D_Vertex * m_3D_Coord; S3D_Vertex* m_3D_Coord;
int * m_3D_CoordIndex; int* m_3D_CoordIndex;
int m_3D_Points; int m_3D_Points;
public: public:
Struct3D_Shape(EDA_BaseStruct * StructFather); Struct3D_Shape( EDA_BaseStruct * StructFather );
~Struct3D_Shape(); ~Struct3D_Shape();
int ReadData(FILE * file, int *LineNum); Struct3D_Shape* Next() const { return (Struct3D_Shape*) Pnext; }
}; Struct3D_Shape* Back() const { return (Struct3D_Shape*) Pback; }
int ReadData( FILE* file, int* LineNum );
};
/*****************************************************************/ /*****************************************************************/
/* Classe pour afficher et editer un Vertex (triplet de valeurs),*/ /* Classe pour afficher et editer un Vertex (triplet de valeurs),*/
/* en INCHES ou MM ou sans unites */ /* en INCHES ou MM ou sans unites */
/*****************************************************************/ /*****************************************************************/
/* internal_unit is the internal unit number by inch: /* internal_unit is the internal unit number by inch:
- 1000 for EESchema * - 1000 for EESchema
- 10000 for PcbNew * - 10000 for PcbNew
*/ */
class WinEDA_VertexCtrl class WinEDA_VertexCtrl
{ {
private: private:
int m_Units; int m_Units;
int m_Internal_Unit; int m_Internal_Unit;
wxTextCtrl * m_XValueCtrl, * m_YValueCtrl, * m_ZValueCtrl; wxTextCtrl* m_XValueCtrl, * m_YValueCtrl, * m_ZValueCtrl;
wxStaticText * m_Text; wxStaticText* m_Text;
public: public:
// Constructor and destructor
WinEDA_VertexCtrl(wxWindow *parent, const wxString & title,
wxBoxSizer * BoxSizer,
int units, int internal_unit);
~WinEDA_VertexCtrl(); // Constructor and destructor
WinEDA_VertexCtrl( wxWindow * parent, const wxString &title,
wxBoxSizer * BoxSizer,
int units, int internal_unit );
S3D_Vertex GetValue(); ~WinEDA_VertexCtrl();
void SetValue(S3D_Vertex vertex);
void Enable(bool enbl);
void SetToolTip(const wxString & text);
};
S3D_Vertex GetValue();
void SetValue( S3D_Vertex vertex );
void Enable( bool enbl );
void SetToolTip( const wxString& text );
};
#endif /* STRUCT_3D_H */ #endif /* STRUCT_3D_H */
...@@ -5,6 +5,30 @@ Started 2007-June-11 ...@@ -5,6 +5,30 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2008-Nov-23 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+all
+ Made _protected_ EDA_BaseStruct's:
EDA_BaseStruct* Pnext; /* Linked list: Link (next struct) */
EDA_BaseStruct* Pback; /* Linked list: Link (previous struct) */
EDA_BaseStruct* m_Parent; /* Linked list: Link (parent struct) */
EDA_BaseStruct* m_Son; /* Linked list: Link (son struct) */
+ Split TRACK::Draw() out for SEGVIA
+ Added dlist.h & dlist.cpp for DLIST<> template. All the _inline_ list manipulation
code throughout the package is rediculous. I don't mind list traversal, only
list manipulation. DLIST<> templates can be used to consolidate reliable
list manipulation operations and get this code out of the mainline.
These functions are shared/inherited for any derivation, so only one copy exists
in the final program image. To use, simply declare e.g. DLIST<D_PAD> or similar.
See dlist.h, template class DLIST for function comments.
+ added EDA_BaseStruct::m_List to assist in debugging list manipulation functions.
+eeschema
Started on the edit component in schematic editor. It is not complete and
breaks the usefulness of the editor at this moment. Do not build this version
if you want to fully use eeschema. I will get something working in another day,
even if it is the old editor.
2008-Nov-22 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Nov-22 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
++pcbnew ++pcbnew
......
...@@ -16,6 +16,7 @@ set(COMMON_SRCS ...@@ -16,6 +16,7 @@ set(COMMON_SRCS
copy_to_clipboard.cpp copy_to_clipboard.cpp
dcsvg.cpp dcsvg.cpp
displlst.cpp displlst.cpp
dlist.cpp
drawtxt.cpp drawtxt.cpp
edaappl.cpp edaappl.cpp
eda_dde.cpp eda_dde.cpp
......
...@@ -446,14 +446,14 @@ void BASE_SCREEN::ClearUndoRedoList() ...@@ -446,14 +446,14 @@ void BASE_SCREEN::ClearUndoRedoList()
while( m_UndoList ) while( m_UndoList )
{ {
nextitem = m_UndoList->Pnext; nextitem = m_UndoList->Next();
delete m_UndoList; delete m_UndoList;
m_UndoList = nextitem; m_UndoList = nextitem;
} }
while( m_RedoList ) while( m_RedoList )
{ {
nextitem = m_RedoList->Pnext; nextitem = m_RedoList->Next();
delete m_RedoList; delete m_RedoList;
m_RedoList = nextitem; m_RedoList = nextitem;
} }
...@@ -469,32 +469,33 @@ void BASE_SCREEN::AddItemToUndoList( EDA_BaseStruct* newitem ) ...@@ -469,32 +469,33 @@ void BASE_SCREEN::AddItemToUndoList( EDA_BaseStruct* newitem )
*/ */
{ {
int ii; int ii;
EDA_BaseStruct* item, * nextitem; EDA_BaseStruct* item;
EDA_BaseStruct* nextitem;
if( newitem == NULL ) if( newitem == NULL )
return; return;
newitem->Pnext = m_UndoList; newitem->SetNext( m_UndoList );
m_UndoList = newitem; m_UndoList = newitem;
/* Free first items, if count max reached */ /* Free first items, if count max reached */
for( ii = 0, item = m_UndoList; ii < m_UndoRedoCountMax; ii++ ) for( ii = 0, item = m_UndoList; ii < m_UndoRedoCountMax; ii++ )
{ {
if( item->Pnext == NULL ) if( item->Next() == NULL )
return; return;
item = item->Pnext; item = item->Next();
} }
if( item == NULL ) if( item == NULL )
return; return;
nextitem = item->Pnext; nextitem = item->Next();
item->Pnext = NULL; // Set end of chain item->SetNext( NULL ); // Set end of chain
// Delete the extra items // Delete the extra items
for( item = nextitem; item != NULL; item = nextitem ) for( item = nextitem; item != NULL; item = nextitem )
{ {
nextitem = item->Pnext; nextitem = item->Next();
delete item; delete item;
} }
} }
...@@ -510,26 +511,26 @@ void BASE_SCREEN::AddItemToRedoList( EDA_BaseStruct* newitem ) ...@@ -510,26 +511,26 @@ void BASE_SCREEN::AddItemToRedoList( EDA_BaseStruct* newitem )
if( newitem == NULL ) if( newitem == NULL )
return; return;
newitem->Pnext = m_RedoList; newitem->SetNext( m_RedoList );
m_RedoList = newitem; m_RedoList = newitem;
/* Free first items, if count max reached */ /* Free first items, if count max reached */
for( ii = 0, item = m_RedoList; ii < m_UndoRedoCountMax; ii++ ) for( ii = 0, item = m_RedoList; ii < m_UndoRedoCountMax; ii++ )
{ {
if( item->Pnext == NULL ) if( item->Next() == NULL )
break; break;
item = item->Pnext; item = item->Next();
} }
if( item == NULL ) if( item == NULL )
return; return;
nextitem = item->Pnext; nextitem = item->Next();
item->Pnext = NULL; // Set end of chain item->SetNext( NULL ); // Set end of chain
// Delete the extra items // Delete the extra items
for( item = nextitem; item != NULL; item = nextitem ) for( item = nextitem; item != NULL; item = nextitem )
{ {
nextitem = item->Pnext; nextitem = item->Next();
delete item; delete item;
} }
} }
...@@ -542,7 +543,7 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromUndoList() ...@@ -542,7 +543,7 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromUndoList()
EDA_BaseStruct* item = m_UndoList; EDA_BaseStruct* item = m_UndoList;
if( item ) if( item )
m_UndoList = item->Pnext; m_UndoList = item->Next();
return item; return item;
} }
...@@ -554,7 +555,7 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList() ...@@ -554,7 +555,7 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList()
EDA_BaseStruct* item = m_RedoList; EDA_BaseStruct* item = m_RedoList;
if( item ) if( item )
m_RedoList = item->Pnext; m_RedoList = item->Next();
return item; return item;
} }
......
...@@ -43,15 +43,16 @@ void EDA_BaseStruct::InitVars() ...@@ -43,15 +43,16 @@ void EDA_BaseStruct::InitVars()
/********************************************/ /********************************************/
{ {
m_StructType = TYPE_NOT_INIT; m_StructType = TYPE_NOT_INIT;
Pnext = NULL; /* Linked list: Link (next struct) */ Pnext = NULL; // Linked list: Link (next struct)
Pback = NULL; /* Linked list: Link (previous struct) */ Pback = NULL; // Linked list: Link (previous struct)
m_Parent = NULL; /* Linked list: Link (parent struct) */ m_Parent = NULL; // Linked list: Link (parent struct)
m_Son = NULL; /* Linked list: Link (son struct) */ m_Son = NULL; // Linked list: Link (son struct)
m_Image = NULL; /* Link to an image copy for undelete or abort command */ m_List = NULL; // I am not on any list yet
m_Flags = 0; /* flags for editions and other */ m_Image = NULL; // Link to an image copy for undelete or abort command
m_TimeStamp = 0; // Time stamp used for logical links m_Flags = 0; // flags for editions and other
m_TimeStamp = 0; // Time stamp used for logical links
m_Status = 0; m_Status = 0;
m_Selected = 0; /* Used by block commands, and selective editing */ m_Selected = 0; // Used by block commands, and selective editing
} }
...@@ -536,11 +537,11 @@ void EDA_TextStruct::CreateDrawData() ...@@ -536,11 +537,11 @@ void EDA_TextStruct::CreateDrawData()
{ {
x0 = 0; y0 = 0; x0 = 0; y0 = 0;
#if defined(wxUSE_UNICODE) && defined(KICAD_CYRILLIC) #if defined(wxUSE_UNICODE) && defined(KICAD_CYRILLIC)
AsciiCode = (*ptr) & 0x7FF; AsciiCode = (*ptr) & 0x7FF;
if ( AsciiCode > 0x40F && AsciiCode < 0x450 ) // big small Cyr if ( AsciiCode > 0x40F && AsciiCode < 0x450 ) // big small Cyr
AsciiCode = utf8_to_ascii[AsciiCode - 0x410] & 0xFF; AsciiCode = utf8_to_ascii[AsciiCode - 0x410] & 0xFF;
else else
AsciiCode = AsciiCode & 0xFF; AsciiCode = AsciiCode & 0xFF;
#else #else
AsciiCode = (*ptr) & 255; AsciiCode = (*ptr) & 255;
#endif #endif
......
...@@ -254,7 +254,7 @@ void InitBlockLocateDatas( WinEDA_DrawPanel* Panel, const wxPoint& startpos ) ...@@ -254,7 +254,7 @@ void InitBlockLocateDatas( WinEDA_DrawPanel* Panel, const wxPoint& startpos )
screen->BlockLocate.m_State = STATE_BLOCK_INIT; screen->BlockLocate.m_State = STATE_BLOCK_INIT;
screen->BlockLocate.SetOrigin( startpos ); screen->BlockLocate.SetOrigin( startpos );
screen->BlockLocate.SetSize( wxSize( 0, 0 ) ); screen->BlockLocate.SetSize( wxSize( 0, 0 ) );
screen->BlockLocate.Pnext = NULL; screen->BlockLocate.SetNext( NULL );
screen->BlockLocate.m_BlockDrawStruct = NULL; screen->BlockLocate.m_BlockDrawStruct = NULL;
Panel->ManageCurseur = DrawAndSizingBlockOutlines; Panel->ManageCurseur = DrawAndSizingBlockOutlines;
Panel->ForceCloseManageCurseur = AbortBlockCurrentCommand; Panel->ForceCloseManageCurseur = AbortBlockCurrentCommand;
......
...@@ -128,7 +128,7 @@ void DHEAD::Insert( EDA_BaseStruct* aNewElement, EDA_BaseStruct* aAfterMe ) ...@@ -128,7 +128,7 @@ void DHEAD::Insert( EDA_BaseStruct* aNewElement, EDA_BaseStruct* aAfterMe )
void DHEAD::Remove( EDA_BaseStruct* aElement ) void DHEAD::Remove( EDA_BaseStruct* aElement )
{ {
wxASSERT( aElement ) wxASSERT( aElement );
wxASSERT( aElement->GetList() == this ); wxASSERT( aElement->GetList() == this );
if( aElement->Next() ) if( aElement->Next() )
......
...@@ -5,36 +5,37 @@ COMMON = ../include/colors.h ...@@ -5,36 +5,37 @@ COMMON = ../include/colors.h
OBJECTS= \ OBJECTS= \
confirm.o \ confirm.o \
base_struct.o\ base_struct.o\
copy_to_clipboard.o\ copy_to_clipboard.o\
basicframe.o\ basicframe.o\
class_drawpickedstruct.o\ class_drawpickedstruct.o\
common_plot_functions.o\ common_plot_functions.o\
common_plotPS_functions.o\ common_plotPS_functions.o\
common_plotHPGL_functions.o\ common_plotHPGL_functions.o\
hotkeys_basic.o\ dlist.o \
drawtxt.o \ hotkeys_basic.o\
about_kicad.o\ drawtxt.o \
wxwineda.o \ about_kicad.o\
string.o \ wxwineda.o \
gr_basic.o\ string.o \
gestfich.o\ gr_basic.o\
trigo.o\ gestfich.o\
selcolor.o\ trigo.o\
common.o\ selcolor.o\
eda_doc.o\ common.o\
toolbars.o\ eda_doc.o\
displlst.o \ toolbars.o\
edaappl.o\ displlst.o \
block_commande.o\ edaappl.o\
msgpanel.o\ block_commande.o\
projet_config.o\ msgpanel.o\
get_component_dialog.o\ projet_config.o\
eda_dde.o\ get_component_dialog.o\
worksheet.o\ eda_dde.o\
base_screen.o\ worksheet.o\
dcsvg.o base_screen.o\
dcsvg.o
ifdef KICAD_PYTHON ifdef KICAD_PYTHON
OBJECTS += pyhandler.o OBJECTS += pyhandler.o
...@@ -86,8 +87,8 @@ trigo.o: trigo.cpp ../include/trigo.h ...@@ -86,8 +87,8 @@ trigo.o: trigo.cpp ../include/trigo.h
bitmaps.o: bitmaps.cpp ../include/bitmaps.h bitmaps.o: bitmaps.cpp ../include/bitmaps.h
edaappl.o: edaappl.cpp $(COMMON) ../include/worksheet.h\ edaappl.o: edaappl.cpp $(COMMON) ../include/worksheet.h\
../include/common.h ../include/gr_basic.h\ ../include/common.h ../include/gr_basic.h\
../include/build_version.h ../include/build_version.h
eda_dde.o: eda_dde.cpp $(COMMON) ../include/eda_dde.h eda_dde.o: eda_dde.cpp $(COMMON) ../include/eda_dde.h
......
...@@ -36,7 +36,8 @@ set(EESCHEMA_SRCS ...@@ -36,7 +36,8 @@ set(EESCHEMA_SRCS
# dialog_cmp_graphic_properties.cpp # dialog_cmp_graphic_properties.cpp
dialog_create_component.cpp dialog_create_component.cpp
# dialog_edit_component_in_lib.cpp # dialog_edit_component_in_lib.cpp
# dialog_edit_component_in_schematic.cpp dialog_edit_component_in_schematic_fbp.cpp
dialog_edit_component_in_schematic.cpp
# dialog_edit_label.cpp # dialog_edit_label.cpp
dialog_eeschema_config.cpp dialog_eeschema_config.cpp
dialog_erc.cpp dialog_erc.cpp
......
...@@ -64,7 +64,7 @@ void ReAnnotatePowerSymbolsOnly( void ) ...@@ -64,7 +64,7 @@ void ReAnnotatePowerSymbolsOnly( void )
sheet = SheetList.GetNext() ) sheet = SheetList.GetNext() )
{ {
EDA_BaseStruct* DrawList = sheet->LastDrawList(); EDA_BaseStruct* DrawList = sheet->LastDrawList();
for( ; DrawList != NULL; DrawList = DrawList->Pnext ) for( ; DrawList != NULL; DrawList = DrawList->Next() )
{ {
if( DrawList->Type() != TYPE_SCH_COMPONENT ) if( DrawList->Type() != TYPE_SCH_COMPONENT )
continue; continue;
...@@ -207,7 +207,7 @@ void WinEDA_SchematicFrame::DeleteAnnotation( bool aCurrentSheetOnly, bool aRedr ...@@ -207,7 +207,7 @@ void WinEDA_SchematicFrame::DeleteAnnotation( bool aCurrentSheetOnly, bool aRedr
while( screen ) while( screen )
{ {
strct = screen->EEDrawList; strct = screen->EEDrawList;
for( ; strct; strct = strct->Pnext ) for( ; strct; strct = strct->Next() )
{ {
if( strct->Type() == TYPE_SCH_COMPONENT ) if( strct->Type() == TYPE_SCH_COMPONENT )
{ {
...@@ -348,7 +348,7 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet ) ...@@ -348,7 +348,7 @@ int ListeComposants( CmpListStruct* BaseListeCmp, DrawSheetPath* sheet )
SCH_COMPONENT* DrawLibItem; SCH_COMPONENT* DrawLibItem;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
for( ; DrawList; DrawList = DrawList->Pnext ) for( ; DrawList; DrawList = DrawList->Next() )
{ {
if( DrawList->Type() == TYPE_SCH_COMPONENT ) if( DrawList->Type() == TYPE_SCH_COMPONENT )
{ {
......
This diff is collapsed.
...@@ -517,7 +517,7 @@ void CopyMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset ) ...@@ -517,7 +517,7 @@ void CopyMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
item->m_Selected = 0; item->m_Selected = 0;
LibEDA_BaseStruct* newitem = CopyDrawEntryStruct( NULL, item ); LibEDA_BaseStruct* newitem = CopyDrawEntryStruct( NULL, item );
newitem->m_Selected = IS_SELECTED; newitem->m_Selected = IS_SELECTED;
newitem->Pnext = LibEntry->m_Drawings; newitem->SetNext( LibEntry->m_Drawings );
LibEntry->m_Drawings = newitem; LibEntry->m_Drawings = newitem;
} }
......
...@@ -301,7 +301,7 @@ int BuildComponentsListFromSchematic( ListComponent* aList ) ...@@ -301,7 +301,7 @@ int BuildComponentsListFromSchematic( ListComponent* aList )
itemCount++; itemCount++;
DrawLibItem = (SCH_COMPONENT*) SchItem; DrawLibItem = (SCH_COMPONENT*) SchItem;
DrawLibItem->m_Parent = sheet->LastScreen(); DrawLibItem->SetParent( sheet->LastScreen() );
if( aList ) if( aList )
{ {
aList->m_Comp = DrawLibItem; aList->m_Comp = DrawLibItem;
...@@ -362,29 +362,29 @@ static int GenListeGLabels( ListLabel* list ) ...@@ -362,29 +362,29 @@ static int GenListeGLabels( ListLabel* list )
break; break;
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
{
#define Sheet ( (DrawSheetStruct*) DrawList )
SheetLabel = Sheet->m_Label;
while( SheetLabel != NULL )
{ {
if( list ) #define Sheet ( (DrawSheetStruct*) DrawList )
SheetLabel = Sheet->m_Label;
while( SheetLabel != NULL )
{ {
list->m_LabelType = DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE; if( list )
snprintf( list->m_SheetPath, sizeof(list->m_SheetPath), {
"%s", CONV_TO_UTF8( path ) ); list->m_LabelType = DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE;
list->m_Label = SheetLabel; snprintf( list->m_SheetPath, sizeof(list->m_SheetPath),
list++; "%s", CONV_TO_UTF8( path ) );
list->m_Label = SheetLabel;
list++;
}
itemCount++;
SheetLabel = SheetLabel->Next();
} }
itemCount++;
SheetLabel = (Hierarchical_PIN_Sheet_Struct*) (SheetLabel->Pnext);
} }
}
break; break;
default: default:
break; break;
} }
DrawList = DrawList->Pnext; DrawList = DrawList->Next();
} }
} }
...@@ -750,13 +750,13 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f, ...@@ -750,13 +750,13 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByRef( FILE* f,
if( CompactForm ) if( CompactForm )
{ {
fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) ); fprintf( f, "%c%s", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*)DrawLibItem->m_Parent, DrawLibItem->m_Pos ); msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*)DrawLibItem->GetParent(), DrawLibItem->m_Pos );
fprintf( f, "%c%s)", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) ); fprintf( f, "%c%s)", s_ExportSeparatorSymbol, CONV_TO_UTF8( msg ) );
} }
else else
{ {
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) ); fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*)DrawLibItem->m_Parent, DrawLibItem->m_Pos ); msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*)DrawLibItem->GetParent(), DrawLibItem->m_Pos );
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) ); fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) );
} }
} }
...@@ -819,7 +819,7 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByVal( FILE* f, ...@@ -819,7 +819,7 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByVal( FILE* f,
if( ( Multi > 1 ) && aIncludeSubComponents ) if( ( Multi > 1 ) && aIncludeSubComponents )
{ {
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
Unit = aList[ii].m_Unit + '1' - 1; Unit = aList[ii].m_Unit + '1' - 1;
} }
...@@ -837,7 +837,7 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByVal( FILE* f, ...@@ -837,7 +837,7 @@ int WinEDA_Build_BOM_Frame::PrintComponentsListByVal( FILE* f,
{ {
msg = aList[ii].m_SheetList.PathHumanReadable(); msg = aList[ii].m_SheetList.PathHumanReadable();
fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) ); fprintf( f, " (Sheet %s)", CONV_TO_UTF8( msg ) );
msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*)DrawLibItem->m_Parent, DrawLibItem->m_Pos ); msg = m_Parent->GetXYSheetReferences( (BASE_SCREEN*)DrawLibItem->GetParent(), DrawLibItem->m_Pos );
fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) ); fprintf( f, " (loc %s)", CONV_TO_UTF8( msg ) );
} }
......
...@@ -50,7 +50,7 @@ SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy ) ...@@ -50,7 +50,7 @@ SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy )
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
RemoveFromDrawList( item ); RemoveFromDrawList( item );
item->Pnext = List; item->SetNext( List );
List = item; List = item;
if( CreateCopy ) if( CreateCopy )
{ {
...@@ -58,7 +58,7 @@ SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy ) ...@@ -58,7 +58,7 @@ SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy )
new_item = ( (DrawJunctionStruct*) item )->GenCopy(); new_item = ( (DrawJunctionStruct*) item )->GenCopy();
else else
new_item = ( (EDA_DrawLineStruct*) item )->GenCopy(); new_item = ( (EDA_DrawLineStruct*) item )->GenCopy();
new_item->Pnext = EEDrawList; new_item->SetNext( EEDrawList );
EEDrawList = new_item; EEDrawList = new_item;
} }
break; break;
...@@ -79,7 +79,8 @@ static void RestoreOldWires( SCH_SCREEN* screen ) ...@@ -79,7 +79,8 @@ static void RestoreOldWires( SCH_SCREEN* screen )
/* Replace the wires in screen->EEDrawList by s_OldWiresList wires. /* Replace the wires in screen->EEDrawList by s_OldWiresList wires.
*/ */
{ {
SCH_ITEM* item, * next_item; SCH_ITEM* item;
SCH_ITEM* next_item;
for( item = screen->EEDrawList; item != NULL; item = next_item ) for( item = screen->EEDrawList; item != NULL; item = next_item )
{ {
...@@ -101,7 +102,8 @@ static void RestoreOldWires( SCH_SCREEN* screen ) ...@@ -101,7 +102,8 @@ static void RestoreOldWires( SCH_SCREEN* screen )
while( s_OldWiresList ) while( s_OldWiresList )
{ {
next_item = s_OldWiresList->Next(); next_item = s_OldWiresList->Next();
s_OldWiresList->Pnext = screen->EEDrawList,
s_OldWiresList->SetNext( screen->EEDrawList );
screen->EEDrawList = s_OldWiresList; screen->EEDrawList = s_OldWiresList;
s_OldWiresList = next_item; s_OldWiresList = next_item;
} }
...@@ -166,8 +168,8 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) ...@@ -166,8 +168,8 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
{ {
nextsegment = newsegment->GenCopy(); nextsegment = newsegment->GenCopy();
nextsegment->m_Flags = IS_NEW; nextsegment->m_Flags = IS_NEW;
newsegment->Pnext = nextsegment; newsegment->SetNext( nextsegment );
nextsegment->Pback = newsegment; nextsegment->SetBack( newsegment );
} }
GetScreen()->SetCurItem( newsegment ); GetScreen()->SetCurItem( newsegment );
DrawPanel->ManageCurseur = Segment_in_Ghost; DrawPanel->ManageCurseur = Segment_in_Ghost;
...@@ -176,7 +178,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) ...@@ -176,7 +178,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
} }
else /* Trace en cours: Placement d'un point supplementaire */ else /* Trace en cours: Placement d'un point supplementaire */
{ {
nextsegment = (EDA_DrawLineStruct*) oldsegment->Pnext; nextsegment = oldsegment->Next();
if( !g_HVLines ) if( !g_HVLines )
{ /* if only one segment is needed and the current is has len = 0, do not create a new one*/ { /* if only one segment is needed and the current is has len = 0, do not create a new one*/
if( oldsegment->IsNull() ) if( oldsegment->IsNull() )
...@@ -198,7 +200,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) ...@@ -198,7 +200,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
} }
/* Placement en liste generale */ /* Placement en liste generale */
oldsegment->Pnext = GetScreen()->EEDrawList; oldsegment->SetNext( GetScreen()->EEDrawList );
GetScreen()->EEDrawList = oldsegment; GetScreen()->EEDrawList = oldsegment;
DrawPanel->CursorOff( DC ); // Erase schematic cursor DrawPanel->CursorOff( DC ); // Erase schematic cursor
RedrawOneStruct( DrawPanel, DC, oldsegment, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( DrawPanel, DC, oldsegment, GR_DEFAULT_DRAWMODE );
...@@ -209,10 +211,10 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) ...@@ -209,10 +211,10 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
{ {
newsegment = nextsegment->GenCopy(); newsegment = nextsegment->GenCopy();
nextsegment->m_Start = newsegment->m_End; nextsegment->m_Start = newsegment->m_End;
nextsegment->Pnext = NULL; nextsegment->SetNext( NULL );
nextsegment->Pback = newsegment; nextsegment->SetBack( newsegment );
newsegment->Pnext = nextsegment; newsegment->SetNext( nextsegment );
newsegment->Pback = NULL; newsegment->SetBack( NULL );
} }
else else
{ {
...@@ -256,16 +258,16 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC ) ...@@ -256,16 +258,16 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
lastsegment = firstsegment; lastsegment = firstsegment;
while( lastsegment ) while( lastsegment )
{ {
EDA_DrawLineStruct* nextsegment = (EDA_DrawLineStruct*) lastsegment->Pnext; EDA_DrawLineStruct* nextsegment = lastsegment->Next();
if( lastsegment->IsNull() ) if( lastsegment->IsNull() )
{ {
EDA_DrawLineStruct* previous_segment = (EDA_DrawLineStruct*) lastsegment->Pback; EDA_DrawLineStruct* previous_segment = lastsegment->Back();
if( firstsegment == lastsegment ) if( firstsegment == lastsegment )
firstsegment = nextsegment; firstsegment = nextsegment;
if( nextsegment ) if( nextsegment )
nextsegment->Pback = NULL; nextsegment->SetBack( NULL );
if( previous_segment ) if( previous_segment )
previous_segment->Pnext = nextsegment; previous_segment->SetNext( nextsegment );
delete lastsegment; delete lastsegment;
} }
lastsegment = nextsegment; lastsegment = nextsegment;
...@@ -276,8 +278,8 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC ) ...@@ -276,8 +278,8 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
while( segment ) while( segment )
{ {
lastsegment = segment; lastsegment = segment;
segment = (EDA_DrawLineStruct*) segment->Pnext; segment = segment->Next();
lastsegment->Pnext = GetScreen()->EEDrawList; lastsegment->SetNext( GetScreen()->EEDrawList );
GetScreen()->EEDrawList = lastsegment; GetScreen()->EEDrawList = lastsegment;
} }
...@@ -311,7 +313,7 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC ) ...@@ -311,7 +313,7 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
g_ItemToRepeat = segment; g_ItemToRepeat = segment;
} }
segment->m_Flags = 0; segment->m_Flags = 0;
segment = (EDA_DrawLineStruct*) segment->Pnext; segment = segment->Next();
} }
// Automatic place of a junction on the end point, if needed // Automatic place of a junction on the end point, if needed
...@@ -348,7 +350,7 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC ) ...@@ -348,7 +350,7 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
break; break;
} }
item = item->Pnext; item = item->Next();
} }
...@@ -386,7 +388,7 @@ static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -386,7 +388,7 @@ static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
if( !segment->IsNull() ) // Redraw if segment lengtht != 0 if( !segment->IsNull() ) // Redraw if segment lengtht != 0
RedrawOneStruct( panel, DC, segment, g_XorMode, color ); RedrawOneStruct( panel, DC, segment, g_XorMode, color );
segment = (EDA_DrawLineStruct*) segment->Pnext; segment = segment->Next();
} }
} }
...@@ -403,7 +405,7 @@ static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -403,7 +405,7 @@ static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
if( !segment->IsNull() ) // Redraw if segment lengtht != 0 if( !segment->IsNull() ) // Redraw if segment lengtht != 0
RedrawOneStruct( panel, DC, segment, g_XorMode, color ); RedrawOneStruct( panel, DC, segment, g_XorMode, color );
segment = (EDA_DrawLineStruct*) segment->Pnext; segment = segment->Next();
} }
} }
...@@ -416,7 +418,7 @@ static void ComputeBreakPoint( EDA_DrawLineStruct* segment, const wxPoint& new_p ...@@ -416,7 +418,7 @@ static void ComputeBreakPoint( EDA_DrawLineStruct* segment, const wxPoint& new_p
* with the 2 segments kept H or V only * with the 2 segments kept H or V only
*/ */
{ {
EDA_DrawLineStruct* nextsegment = (EDA_DrawLineStruct*) segment->Pnext; EDA_DrawLineStruct* nextsegment = segment->Next();
wxPoint middle_position = new_pos; wxPoint middle_position = new_pos;
if( nextsegment == NULL ) if( nextsegment == NULL )
...@@ -543,7 +545,7 @@ DrawJunctionStruct* WinEDA_SchematicFrame::CreateNewJunctionStruct( ...@@ -543,7 +545,7 @@ DrawJunctionStruct* WinEDA_SchematicFrame::CreateNewJunctionStruct(
RedrawOneStruct( DrawPanel, DC, NewJunction, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( DrawPanel, DC, NewJunction, GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); // Display schematic cursor DrawPanel->CursorOn( DC ); // Display schematic cursor
NewJunction->Pnext = GetScreen()->EEDrawList; NewJunction->SetNext( GetScreen()->EEDrawList );
GetScreen()->EEDrawList = NewJunction; GetScreen()->EEDrawList = NewJunction;
GetScreen()->SetModify(); GetScreen()->SetModify();
if( PutInUndoList ) if( PutInUndoList )
...@@ -568,7 +570,7 @@ DrawNoConnectStruct* WinEDA_SchematicFrame::CreateNewNoConnectStruct( wxDC* DC ) ...@@ -568,7 +570,7 @@ DrawNoConnectStruct* WinEDA_SchematicFrame::CreateNewNoConnectStruct( wxDC* DC )
RedrawOneStruct( DrawPanel, DC, NewNoConnect, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( DrawPanel, DC, NewNoConnect, GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); // Display schematic cursor DrawPanel->CursorOn( DC ); // Display schematic cursor
NewNoConnect->Pnext = GetScreen()->EEDrawList; NewNoConnect->SetNext( GetScreen()->EEDrawList );
GetScreen()->EEDrawList = NewNoConnect; GetScreen()->EEDrawList = NewNoConnect;
GetScreen()->SetModify(); GetScreen()->SetModify();
SaveCopyInUndoList( NewNoConnect, IS_NEW ); SaveCopyInUndoList( NewNoConnect, IS_NEW );
...@@ -729,7 +731,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC ) ...@@ -729,7 +731,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
if( g_ItemToRepeat ) if( g_ItemToRepeat )
{ {
g_ItemToRepeat->Pnext = GetScreen()->EEDrawList; g_ItemToRepeat->SetNext( GetScreen()->EEDrawList );
GetScreen()->EEDrawList = g_ItemToRepeat; GetScreen()->EEDrawList = g_ItemToRepeat;
TestDanglingEnds( GetScreen()->EEDrawList, NULL ); TestDanglingEnds( GetScreen()->EEDrawList, NULL );
RedrawOneStruct( DrawPanel, DC, g_ItemToRepeat, GR_DEFAULT_DRAWMODE ); RedrawOneStruct( DrawPanel, DC, g_ItemToRepeat, GR_DEFAULT_DRAWMODE );
......
...@@ -146,7 +146,7 @@ DrawSheetStruct* DrawSheetStruct::GenCopy() ...@@ -146,7 +146,7 @@ DrawSheetStruct* DrawSheetStruct::GenCopy()
newitem->m_Size = m_Size; newitem->m_Size = m_Size;
newitem->m_Parent = m_Parent; newitem->SetParent( m_Parent );
newitem->m_TimeStamp = GetTimeStamp(); newitem->m_TimeStamp = GetTimeStamp();
newitem->m_FileName = m_FileName; newitem->m_FileName = m_FileName;
...@@ -161,15 +161,15 @@ DrawSheetStruct* DrawSheetStruct::GenCopy() ...@@ -161,15 +161,15 @@ DrawSheetStruct* DrawSheetStruct::GenCopy()
if( label ) if( label )
{ {
Slabel = newitem->m_Label = label->GenCopy(); Slabel = newitem->m_Label = label->GenCopy();
Slabel->m_Parent = newitem; Slabel->SetParent( newitem );
label = label->Next(); label = label->Next();
} }
while( label ) while( label )
{ {
Slabel->Pnext = label->GenCopy(); Slabel->SetNext( label->GenCopy() );
Slabel = (Hierarchical_PIN_Sheet_Struct*) Slabel->Pnext; Slabel = Slabel->Next();
Slabel->m_Parent = newitem; Slabel->SetParent( newitem );
label = label->Next(); label = label->Next();
} }
...@@ -202,14 +202,14 @@ void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem ) ...@@ -202,14 +202,14 @@ void DrawSheetStruct::SwapData( DrawSheetStruct* copyitem )
Hierarchical_PIN_Sheet_Struct* label = m_Label; Hierarchical_PIN_Sheet_Struct* label = m_Label;
while( label ) while( label )
{ {
label->m_Parent = this; label->SetParent( this );
label = label->Next(); label = label->Next();
} }
label = copyitem->m_Label; label = copyitem->m_Label;
while( label ) while( label )
{ {
label->m_Parent = copyitem; label->SetParent( copyitem );
label = label->Next(); label = label->Next();
} }
} }
...@@ -257,13 +257,15 @@ void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* aFrame, bool aRedraw ...@@ -257,13 +257,15 @@ void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* aFrame, bool aRedraw
EDA_BaseStruct* DrawStruct = m_AssociatedScreen->EEDrawList; EDA_BaseStruct* DrawStruct = m_AssociatedScreen->EEDrawList;
SCH_HIERLABEL* HLabel = NULL; SCH_HIERLABEL* HLabel = NULL;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{ {
if( DrawStruct->Type() != TYPE_SCH_HIERLABEL ) if( DrawStruct->Type() != TYPE_SCH_HIERLABEL )
continue; continue;
HLabel = (SCH_HIERLABEL*) DrawStruct; HLabel = (SCH_HIERLABEL*) DrawStruct;
if( Pinsheet->m_Text.CmpNoCase( HLabel->m_Text ) == 0 ) if( Pinsheet->m_Text.CmpNoCase( HLabel->m_Text ) == 0 )
break; // Found! break; // Found!
HLabel = NULL; HLabel = NULL;
} }
...@@ -375,7 +377,7 @@ int DrawSheetStruct::ComponentCount() ...@@ -375,7 +377,7 @@ int DrawSheetStruct::ComponentCount()
if( m_AssociatedScreen ) if( m_AssociatedScreen )
{ {
EDA_BaseStruct* bs; EDA_BaseStruct* bs;
for( bs = m_AssociatedScreen->EEDrawList; bs != NULL; bs = bs->Pnext ) for( bs = m_AssociatedScreen->EEDrawList; bs != NULL; bs = bs->Next() )
{ {
if( bs->Type() == TYPE_SCH_COMPONENT ) if( bs->Type() == TYPE_SCH_COMPONENT )
{ {
...@@ -416,7 +418,7 @@ bool DrawSheetStruct::SearchHierarchy( wxString filename, SCH_SCREEN** screen ) ...@@ -416,7 +418,7 @@ bool DrawSheetStruct::SearchHierarchy( wxString filename, SCH_SCREEN** screen )
if( ss->SearchHierarchy( filename, screen ) ) if( ss->SearchHierarchy( filename, screen ) )
return true; return true;
} }
strct = strct->Pnext; strct = strct->Next();
} }
} }
return false; return false;
...@@ -446,7 +448,7 @@ bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* screen, DrawSheetPath* lis ...@@ -446,7 +448,7 @@ bool DrawSheetStruct::LocatePathOfScreen( SCH_SCREEN* screen, DrawSheetPath* lis
if( ss->LocatePathOfScreen( screen, list ) ) if( ss->LocatePathOfScreen( screen, list ) )
return true; return true;
} }
strct = strct->Pnext; strct = strct->Next();
} }
list->Pop(); list->Pop();
...@@ -488,7 +490,7 @@ bool DrawSheetStruct::Load( WinEDA_SchematicFrame* frame ) ...@@ -488,7 +490,7 @@ bool DrawSheetStruct::Load( WinEDA_SchematicFrame* frame )
if( !sheetstruct->Load( frame ) ) if( !sheetstruct->Load( frame ) )
success = false; success = false;
} }
bs = bs->Pnext; bs = bs->Next();
} }
} }
} }
...@@ -506,7 +508,7 @@ int DrawSheetStruct::CountSheets() ...@@ -506,7 +508,7 @@ int DrawSheetStruct::CountSheets()
if( m_AssociatedScreen ) if( m_AssociatedScreen )
{ {
EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList; EDA_BaseStruct* strct = m_AssociatedScreen->EEDrawList;
for( ; strct; strct = strct->Pnext ) for( ; strct; strct = strct->Next() )
{ {
if( strct->Type() == DRAW_SHEET_STRUCT_TYPE ) if( strct->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
...@@ -787,7 +789,7 @@ void DrawSheetPath::UpdateAllScreenReferences() ...@@ -787,7 +789,7 @@ void DrawSheetPath::UpdateAllScreenReferences()
component->GetField(REFERENCE)->m_Text = component->GetRef( this ); component->GetField(REFERENCE)->m_Text = component->GetRef( this );
component->m_Multi = component->GetUnitSelection( this ); component->m_Multi = component->GetUnitSelection( this );
} }
t = t->Pnext; t = t->Next();
} }
} }
......
...@@ -41,7 +41,7 @@ void FreeLibraryEntry( LibCmpEntry* Entry ) ...@@ -41,7 +41,7 @@ void FreeLibraryEntry( LibCmpEntry* Entry )
/* Used by PQFreeFunc() to delete all entries /* Used by PQFreeFunc() to delete all entries
*/ */
{ {
SAFE_DELETE( Entry ); SAFE_DELETE( Entry );
} }
...@@ -196,8 +196,9 @@ EDA_LibComponentStruct::~EDA_LibComponentStruct() ...@@ -196,8 +196,9 @@ EDA_LibComponentStruct::~EDA_LibComponentStruct()
field = Fields; Fields = NULL; field = Fields; Fields = NULL;
while( field ) while( field )
{ {
TempField = field; field = (LibDrawField*) field->Pnext; TempField = field;
SAFE_DELETE( TempField ); field = field->Next();
SAFE_DELETE( TempField );
} }
/* suppression des elements dependants */ /* suppression des elements dependants */
...@@ -205,7 +206,7 @@ EDA_LibComponentStruct::~EDA_LibComponentStruct() ...@@ -205,7 +206,7 @@ EDA_LibComponentStruct::~EDA_LibComponentStruct()
while( DrawItem ) while( DrawItem )
{ {
NextDrawItem = DrawItem->Next(); NextDrawItem = DrawItem->Next();
SAFE_DELETE( DrawItem ); SAFE_DELETE( DrawItem );
DrawItem = NextDrawItem; DrawItem = NextDrawItem;
} }
} }
......
...@@ -28,7 +28,7 @@ void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen ) ...@@ -28,7 +28,7 @@ void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
case DRAW_MARKER_STRUCT_TYPE: case DRAW_MARKER_STRUCT_TYPE:
case DRAW_NOCONNECT_STRUCT_TYPE: case DRAW_NOCONNECT_STRUCT_TYPE:
Struct->m_Parent = Screen; Struct->SetParent( Screen );
break; break;
case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE: case DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE:
...@@ -138,9 +138,9 @@ void SCH_SCREEN::RemoveFromDrawList( SCH_ITEM * DrawStruct ) ...@@ -138,9 +138,9 @@ void SCH_SCREEN::RemoveFromDrawList( SCH_ITEM * DrawStruct )
EDA_BaseStruct* DrawList = EEDrawList; EDA_BaseStruct* DrawList = EEDrawList;
while( DrawList && DrawList->Next() ) while( DrawList && DrawList->Next() )
{ {
if( DrawList->Pnext == DrawStruct ) if( DrawList->Next() == DrawStruct )
{ {
DrawList->Pnext = DrawList->Pnext->Pnext; DrawList->SetNext( DrawList->Next()->Next() );
break; break;
} }
DrawList = DrawList->Next(); DrawList = DrawList->Next();
...@@ -170,7 +170,7 @@ bool SCH_SCREEN::CheckIfOnDrawList( SCH_ITEM* st ) ...@@ -170,7 +170,7 @@ bool SCH_SCREEN::CheckIfOnDrawList( SCH_ITEM* st )
void SCH_SCREEN::AddToDrawList( SCH_ITEM* st ) void SCH_SCREEN::AddToDrawList( SCH_ITEM* st )
/**************************************************************/ /**************************************************************/
{ //simple function to add to the head of the drawlist. { //simple function to add to the head of the drawlist.
st->Pnext = EEDrawList; st->SetNext( EEDrawList );
EEDrawList = st; EEDrawList = st;
} }
...@@ -262,7 +262,7 @@ void EDA_ScreenList::BuildScreenList( EDA_BaseStruct* s ) ...@@ -262,7 +262,7 @@ void EDA_ScreenList::BuildScreenList( EDA_BaseStruct* s )
{ {
BuildScreenList( strct ); BuildScreenList( strct );
} }
strct = strct->Pnext; strct = strct->Next();
} }
} }
} }
...@@ -335,7 +335,7 @@ void EDA_SheetList::BuildSheetList( DrawSheetStruct* sheet ) ...@@ -335,7 +335,7 @@ void EDA_SheetList::BuildSheetList( DrawSheetStruct* sheet )
DrawSheetStruct* sht = (DrawSheetStruct*) strct; DrawSheetStruct* sht = (DrawSheetStruct*) strct;
BuildSheetList( sht ); BuildSheetList( sht );
} }
strct = strct->Pnext; strct = strct->Next();
} }
} }
m_currList.Pop(); m_currList.Pop();
......
...@@ -193,10 +193,15 @@ public: ...@@ -193,10 +193,15 @@ public:
public: public:
LibDrawPin(); LibDrawPin();
~LibDrawPin() { } ~LibDrawPin() { }
LibDrawPin* Next() const { return (LibDrawPin*) Pnext; }
LibDrawPin* Back() const { return (LibDrawPin*) Pback; }
virtual wxString GetClass() const virtual wxString GetClass() const
{ {
return wxT( "LibDrawPin" ); return wxT( "LibDrawPin" );
} }
/** /**
* Function Save * Function Save
* writes the data structures for this object out to a FILE in "*.brd" format. * writes the data structures for this object out to a FILE in "*.brd" format.
...@@ -451,8 +456,8 @@ public: ...@@ -451,8 +456,8 @@ public:
public: public:
LibDrawField* Next() { return (LibDrawField*) Pnext; } LibDrawField* Next() const { return (LibDrawField*) Pnext; }
LibDrawField* Prev() { return (LibDrawField*) Pback; } LibDrawField* Back() const { return (LibDrawField*) Pback; }
LibDrawField( int idfield = 2 ); LibDrawField( int idfield = 2 );
......
...@@ -167,14 +167,14 @@ DrawPickedStruct* BreakSegment( SCH_SCREEN* screen, ...@@ -167,14 +167,14 @@ DrawPickedStruct* BreakSegment( SCH_SCREEN* screen,
wrapper->m_PickedStruct = segment->GenCopy(); wrapper->m_PickedStruct = segment->GenCopy();
wrapper->m_Image = segment; wrapper->m_Image = segment;
wrapper->m_PickedStruct->m_Image = segment; wrapper->m_PickedStruct->m_Image = segment;
wrapper->Pnext = List; wrapper->SetNext( List );
List = wrapper; List = wrapper;
} }
NewSegment = segment->GenCopy(); NewSegment = segment->GenCopy();
NewSegment->m_Start = breakpoint; NewSegment->m_Start = breakpoint;
segment->m_End = NewSegment->m_Start; segment->m_End = NewSegment->m_Start;
NewSegment->Pnext = segment->Pnext; NewSegment->SetNext( segment->Next() );
segment->Pnext = NewSegment; segment->SetNext( NewSegment );
DrawList = NewSegment; DrawList = NewSegment;
if( PutInUndoList ) if( PutInUndoList )
{ {
...@@ -182,7 +182,7 @@ DrawPickedStruct* BreakSegment( SCH_SCREEN* screen, ...@@ -182,7 +182,7 @@ DrawPickedStruct* BreakSegment( SCH_SCREEN* screen,
wrapper->m_Flags = IS_NEW; wrapper->m_Flags = IS_NEW;
wrapper->m_Image = NewSegment; wrapper->m_Image = NewSegment;
wrapper->Pnext = List; wrapper->SetNext( List );
List = wrapper; List = wrapper;
} }
break; break;
...@@ -196,7 +196,7 @@ DrawPickedStruct* BreakSegment( SCH_SCREEN* screen, ...@@ -196,7 +196,7 @@ DrawPickedStruct* BreakSegment( SCH_SCREEN* screen,
break; break;
} }
DrawList = DrawList->Pnext; DrawList = DrawList->Next();
} }
return List; return List;
......
...@@ -72,10 +72,10 @@ SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aTemplate ) : ...@@ -72,10 +72,10 @@ SCH_COMPONENT::SCH_COMPONENT( const SCH_COMPONENT& aTemplate ) :
Pnext = NULL; Pnext = NULL;
m_Son = NULL; m_Son = NULL;
// Re-parent the fields, which before this were aTemplate's parent // Re-parent the fields, which before this had aTemplate as parent
for( int i=0; i<GetFieldCount(); ++i ) for( int i=0; i<GetFieldCount(); ++i )
{ {
GetField( i )->m_Parent = this; GetField( i )->SetParent( this );
} }
} }
...@@ -424,11 +424,11 @@ void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem ) ...@@ -424,11 +424,11 @@ void SCH_COMPONENT::SwapData( SCH_COMPONENT* copyitem )
// (after swap(), m_Parent member does not point to the right parent): // (after swap(), m_Parent member does not point to the right parent):
for( int ii = 0; ii < copyitem->GetFieldCount(); ++ii ) for( int ii = 0; ii < copyitem->GetFieldCount(); ++ii )
{ {
copyitem->GetField(ii)->m_Parent = copyitem; copyitem->GetField(ii)->SetParent( copyitem );
} }
for( int ii = 0; ii < GetFieldCount(); ++ii ) for( int ii = 0; ii < GetFieldCount(); ++ii )
{ {
GetField(ii)->m_Parent = this; GetField(ii)->SetParent( this );
} }
} }
......
...@@ -39,7 +39,11 @@ struct Error ...@@ -39,7 +39,11 @@ struct Error
} }
}; };
/* Fields identifiers */
/**
* Enum NumFieldType
* is the numbered set of all fields a SCH_COMPONENT can hold
*/
enum NumFieldType { enum NumFieldType {
REFERENCE = 0, ///< Field Reference of part, i.e. "IC21" REFERENCE = 0, ///< Field Reference of part, i.e. "IC21"
VALUE, ///< Field Value of part, i.e. "3.3K" VALUE, ///< Field Value of part, i.e. "3.3K"
...@@ -59,31 +63,36 @@ enum NumFieldType { ...@@ -59,31 +63,36 @@ enum NumFieldType {
}; };
/// A container for several SCH_CMP_FIELD items
typedef std::vector<SCH_CMP_FIELD> SCH_CMP_FIELDS;
/** /**
* Class SCH_COMPONENT * Class SCH_COMPONENT
* describes a real schematic component * describes a real schematic component
*/ */
class SCH_COMPONENT : public SCH_ITEM class SCH_COMPONENT : public SCH_ITEM
{ {
friend class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC;
public: public:
int m_Multi; /* In multi unit chip - which unit to draw. */ int m_Multi; ///< In multi unit chip - which unit to draw.
wxPoint m_Pos; wxPoint m_Pos;
wxString m_ChipName; /* Key to look for in the library, i.e. "74LS00". */ wxString m_ChipName; ///< Key to look for in the library, i.e. "74LS00".
wxString m_PrefixString; /* C, R, U, Q etc - the first character which typically indicates what the component is. wxString m_PrefixString; /* C, R, U, Q etc - the first character which typically indicates what the component is.
* determined, upon placement, from the library component. * determined, upon placement, from the library component.
* determined, upon file load, by the first non-digits in the reference fields. */ * determined, upon file load, by the first non-digits in the reference fields.
*/
int m_Convert; /* Handle mutiple shape (for instance De Morgan conversion) */ int m_Convert; /* Handle mutiple shape (for instance De Morgan conversion) */
int m_Transform[2][2]; /* The rotation/mirror transformation matrix. */ int m_Transform[2][2]; /* The rotation/mirror transformation matrix. */
private: private:
/** how many fields are fixed, or automatic and pre-made in the SCH_COMPONENT class */ SCH_CMP_FIELDS m_Fields; ///< variable length list of fields
typedef std::vector<SCH_CMP_FIELD> SCH_CMP_FIELDS;
SCH_CMP_FIELDS m_Fields;
/* Hierarchical references. /* Hierarchical references.
...@@ -200,14 +209,16 @@ public: ...@@ -200,14 +209,16 @@ public:
void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
// returns a unique ID, in the form of a path.
//returns a unique ID, in the form of a path.
wxString GetPath( DrawSheetPath* sheet ); wxString GetPath( DrawSheetPath* sheet );
//returns the reference, for the given sheet path.
/**
* Function GetRef
* returns the reference, for the given sheet path.
*/
const wxString GetRef( DrawSheetPath* sheet ); const wxString GetRef( DrawSheetPath* sheet );
//Set the reference, for the given sheet path. // Set the reference, for the given sheet path.
void SetRef( DrawSheetPath* sheet, const wxString& ref ); void SetRef( DrawSheetPath* sheet, const wxString& ref );
/** /**
......
...@@ -54,7 +54,7 @@ SCH_ITEM * WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Includ ...@@ -54,7 +54,7 @@ SCH_ITEM * WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool Includ
{ {
case DRAW_PART_TEXT_STRUCT_TYPE: case DRAW_PART_TEXT_STRUCT_TYPE:
case COMPONENT_FIELD_DRAW_TYPE: case COMPONENT_FIELD_DRAW_TYPE:
LibItem = (SCH_COMPONENT*) DrawStruct->m_Parent; LibItem = (SCH_COMPONENT*) DrawStruct->GetParent();
SendMessageToPCBNEW( DrawStruct,LibItem ); SendMessageToPCBNEW( DrawStruct,LibItem );
break; break;
...@@ -168,7 +168,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin ...@@ -168,7 +168,7 @@ SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoin
if( DrawStruct ) if( DrawStruct )
{ {
SCH_CMP_FIELD* Field = (SCH_CMP_FIELD*) DrawStruct; SCH_CMP_FIELD* Field = (SCH_CMP_FIELD*) DrawStruct;
LibItem = (SCH_COMPONENT*) Field->m_Parent; LibItem = (SCH_COMPONENT*) Field->GetParent();
LibItem->Display_Infos( this ); LibItem->Display_Infos( this );
return DrawStruct; return DrawStruct;
......
...@@ -314,7 +314,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ) ...@@ -314,7 +314,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
DanglingEndHandle* StartList = NULL, * item, * lastitem = NULL; DanglingEndHandle* StartList = NULL, * item, * lastitem = NULL;
EDA_BaseStruct* DrawItem; EDA_BaseStruct* DrawItem;
for( DrawItem = DrawList; DrawItem != NULL; DrawItem = DrawItem->Pnext ) for( DrawItem = DrawList; DrawItem != NULL; DrawItem = DrawItem->Next() )
{ {
switch( DrawItem->Type() ) switch( DrawItem->Type() )
{ {
......
...@@ -147,7 +147,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio ...@@ -147,7 +147,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
/* Put this structure in the picked list: */ /* Put this structure in the picked list: */
PickedItem = new DrawPickedStruct( DelStruct ); PickedItem = new DrawPickedStruct( DelStruct );
PickedItem->Pnext = PickedList; PickedItem->SetNext( PickedList );
PickedList = PickedItem; PickedList = PickedItem;
DelStruct = DelStruct->Next(); DelStruct = DelStruct->Next();
screen->EEDrawList = DelStruct; screen->EEDrawList = DelStruct;
...@@ -194,7 +194,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio ...@@ -194,7 +194,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
EDA_BaseStruct* removed_struct; EDA_BaseStruct* removed_struct;
for( removed_struct = GetScreen()->EEDrawList; for( removed_struct = GetScreen()->EEDrawList;
removed_struct != NULL; removed_struct != NULL;
removed_struct = removed_struct->Pnext ) removed_struct = removed_struct->Next() )
{ {
if( (removed_struct->m_Flags & STRUCT_DELETED) == 0 ) if( (removed_struct->m_Flags & STRUCT_DELETED) == 0 )
continue; continue;
...@@ -214,7 +214,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio ...@@ -214,7 +214,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
* and now is not connected, the wire can be deleted */ * and now is not connected, the wire can be deleted */
for( removed_struct = GetScreen()->EEDrawList; for( removed_struct = GetScreen()->EEDrawList;
removed_struct != NULL; removed_struct != NULL;
removed_struct = removed_struct->Pnext ) removed_struct = removed_struct->Next() )
{ {
if( (removed_struct->m_Flags & STRUCT_DELETED) == 0 ) if( (removed_struct->m_Flags & STRUCT_DELETED) == 0 )
continue; continue;
...@@ -236,7 +236,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio ...@@ -236,7 +236,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
/* Put this structure in the picked list: */ /* Put this structure in the picked list: */
PickedItem = new DrawPickedStruct( DelStruct ); PickedItem = new DrawPickedStruct( DelStruct );
PickedItem->Pnext = PickedList; PickedItem->SetNext( PickedList );
PickedList = PickedItem; PickedList = PickedItem;
DelStruct = GetScreen()->EEDrawList; DelStruct = GetScreen()->EEDrawList;
} }
...@@ -264,7 +264,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio ...@@ -264,7 +264,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
/* Put this structure in the picked list: */ /* Put this structure in the picked list: */
PickedItem = new DrawPickedStruct( DelStruct ); PickedItem = new DrawPickedStruct( DelStruct );
PickedItem->Pnext = PickedList; PickedItem->SetNext( PickedList );
PickedList = PickedItem; PickedList = PickedItem;
} }
#undef JUNCTION #undef JUNCTION
...@@ -292,7 +292,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio ...@@ -292,7 +292,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
/* Put this structure in the picked list: */ /* Put this structure in the picked list: */
PickedItem = new DrawPickedStruct( DelStruct ); PickedItem = new DrawPickedStruct( DelStruct );
PickedItem->Pnext = PickedList; PickedItem->SetNext( PickedList );
PickedList = PickedItem; PickedList = PickedItem;
} }
} }
...@@ -398,7 +398,7 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen ) ...@@ -398,7 +398,7 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
* accessible par la liste globale directement */ * accessible par la liste globale directement */
//this structure has a sheet attached, which we must find. //this structure has a sheet attached, which we must find.
DrawList = Screen->EEDrawList; DrawList = Screen->EEDrawList;
for( ; DrawList != NULL; DrawList = DrawList->Pnext ) for( ; DrawList != NULL; DrawList = DrawList->Next() )
{ {
if( DrawList->Type() != DRAW_SHEET_STRUCT_TYPE ) if( DrawList->Type() != DRAW_SHEET_STRUCT_TYPE )
continue; continue;
...@@ -411,19 +411,19 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen ) ...@@ -411,19 +411,19 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
if( SheetLabel == (Hierarchical_PIN_Sheet_Struct*) DrawStruct ) if( SheetLabel == (Hierarchical_PIN_Sheet_Struct*) DrawStruct )
{ {
( (DrawSheetStruct*) DrawList )->m_Label = ( (DrawSheetStruct*) DrawList )->m_Label =
(Hierarchical_PIN_Sheet_Struct*) SheetLabel->Pnext; (Hierarchical_PIN_Sheet_Struct*) SheetLabel->Next();
SAFE_DELETE( DrawStruct ); SAFE_DELETE( DrawStruct );
return; return;
} }
else else
{ {
while( SheetLabel->Pnext ) /* Examen de la liste dependante */ while( SheetLabel->Next() ) /* Examen de la liste dependante */
{ {
NextLabel = (Hierarchical_PIN_Sheet_Struct*) SheetLabel->Pnext; NextLabel = (Hierarchical_PIN_Sheet_Struct*) SheetLabel->Next();
if( NextLabel == (Hierarchical_PIN_Sheet_Struct*) DrawStruct ) if( NextLabel == (Hierarchical_PIN_Sheet_Struct*) DrawStruct )
{ {
SheetLabel->Pnext = (EDA_BaseStruct*) NextLabel->Pnext; SheetLabel->SetNext( (EDA_BaseStruct*) NextLabel->Next() );
SAFE_DELETE( DrawStruct ); SAFE_DELETE( DrawStruct );
return; return;
} }
...@@ -448,18 +448,18 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen ) ...@@ -448,18 +448,18 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
else else
{ {
DrawList = Screen->EEDrawList; DrawList = Screen->EEDrawList;
while( DrawList && DrawList->Pnext ) while( DrawList && DrawList->Next() )
{ {
if( DrawList->Pnext == PickedList->m_PickedStruct ) if( DrawList->Next() == PickedList->m_PickedStruct )
{ {
DrawList->Pnext = DrawList->Pnext->Pnext; DrawList->SetNext( DrawList->Next()->Next() );
SAFE_DELETE( DrawStruct ); SAFE_DELETE( DrawStruct );
return; return;
} }
DrawList = DrawList->Pnext; DrawList = DrawList->Next();
} }
} }
PickedList = (DrawPickedStruct*) PickedList->Pnext; PickedList = (DrawPickedStruct*) PickedList->Next();
} }
} }
else // structure usuelle */ else // structure usuelle */
...@@ -472,15 +472,15 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen ) ...@@ -472,15 +472,15 @@ void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
else else
{ {
DrawList = Screen->EEDrawList; DrawList = Screen->EEDrawList;
while( DrawList && DrawList->Pnext ) while( DrawList && DrawList->Next() )
{ {
if( DrawList->Pnext == DrawStruct ) if( DrawList->Next() == DrawStruct )
{ {
DrawList->Pnext = DrawStruct->Pnext; DrawList->SetNext( DrawStruct->Next() );
SAFE_DELETE( DrawStruct ); SAFE_DELETE( DrawStruct );
return; return;
} }
DrawList = DrawList->Pnext; DrawList = DrawList->Next();
} }
} }
} }
...@@ -557,9 +557,9 @@ void DeleteOneLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -557,9 +557,9 @@ void DeleteOneLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
while( PreviousDrawItem ) while( PreviousDrawItem )
{ {
if( PreviousDrawItem->Pnext == DrawItem ) if( PreviousDrawItem->Next() == DrawItem )
{ {
PreviousDrawItem->Pnext = DrawItem->Pnext; PreviousDrawItem->SetNext( DrawItem->Next() );
SAFE_DELETE( DrawItem ); SAFE_DELETE( DrawItem );
break; break;
} }
......
/*******************************************************/ /*******************************************************/
/* delsheet.cpp Routine d'effacement d'une hierarchie */ /* delsheet.cpp Routine d'effacement d'une hierarchie */
/*******************************************************/ /*******************************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -14,102 +14,110 @@ ...@@ -14,102 +14,110 @@
/**************************************************************************/ /**************************************************************************/
void DeleteSubHierarchy(DrawSheetStruct * FirstSheet, bool confirm_deletion) void DeleteSubHierarchy( DrawSheetStruct* FirstSheet, bool confirm_deletion )
/**************************************************************************/ /**************************************************************************/
/* Free (delete) all schematic data (include the sub hierarchy sheets ) /* Free (delete) all schematic data (include the sub hierarchy sheets )
for the hierarchical sheet FirstSheet * for the hierarchical sheet FirstSheet
FirstSheet is not deleted. * FirstSheet is not deleted.
*/ */
{ {
EDA_BaseStruct *DrawStruct; EDA_BaseStruct* DrawStruct;
EDA_BaseStruct *EEDrawList; EDA_BaseStruct* EEDrawList;
WinEDA_SchematicFrame * frame = g_EDA_Appl->m_SchematicFrame; WinEDA_SchematicFrame* frame = g_EDA_Appl->m_SchematicFrame;
wxString msg; wxString msg;
if( FirstSheet == NULL ) return; if( FirstSheet == NULL )
return;
if( FirstSheet->Type() != DRAW_SHEET_STRUCT_TYPE)
{ if( FirstSheet->Type() != DRAW_SHEET_STRUCT_TYPE )
DisplayError(NULL, {
wxT("DeleteSubHierarchy error(): NOT a Sheet")); DisplayError( NULL,
return; wxT( "DeleteSubHierarchy error(): NOT a Sheet" ) );
} return;
}
/* effacement du sous schema correspondant */
if( FirstSheet->m_AssociatedScreen->IsModify() && confirm_deletion ) /* effacement du sous schema correspondant */
{ if( FirstSheet->m_AssociatedScreen->IsModify() && confirm_deletion )
msg.Printf( _("Sheet %s (file %s) modified. Save it?"), {
FirstSheet->m_SheetName.GetData(), msg.Printf( _( "Sheet %s (file %s) modified. Save it?" ),
FirstSheet->GetFileName().GetData()); FirstSheet->m_SheetName.GetData(),
if( IsOK(NULL, msg) ) FirstSheet->GetFileName().GetData() );
{ if( IsOK( NULL, msg ) )
frame->SaveEEFile(FirstSheet->m_AssociatedScreen, FILE_SAVE_AS); {
} frame->SaveEEFile( FirstSheet->m_AssociatedScreen, FILE_SAVE_AS );
} }
}
/* free the sub hierarchy */
if(FirstSheet->m_AssociatedScreen){ /* free the sub hierarchy */
EEDrawList = FirstSheet->m_AssociatedScreen->EEDrawList; if( FirstSheet->m_AssociatedScreen )
while (EEDrawList != NULL) {
{ EEDrawList = FirstSheet->m_AssociatedScreen->EEDrawList;
DrawStruct = EEDrawList; while( EEDrawList != NULL )
EEDrawList = EEDrawList->Pnext; {
if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) DrawStruct = EEDrawList;
{ EEDrawList = EEDrawList->Next();
DeleteSubHierarchy((DrawSheetStruct *) DrawStruct, confirm_deletion); if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE )
} {
} DeleteSubHierarchy( (DrawSheetStruct*) DrawStruct, confirm_deletion );
/* Effacement des elements de la feuille courante */ }
FirstSheet->m_AssociatedScreen->FreeDrawList(); }
}
/* Effacement des elements de la feuille courante */
FirstSheet->m_AssociatedScreen->FreeDrawList();
}
} }
/*********************************************************************/ /*********************************************************************/
//void ClearDrawList(EDA_BaseStruct *DrawList, bool confirm_deletion) //void ClearDrawList(EDA_BaseStruct *DrawList, bool confirm_deletion)
/********************************************************************/ /********************************************************************/
/* free the draw list DrawList and the subhierarchies */ /* free the draw list DrawList and the subhierarchies */
//this is redundant -- use FreeDrawList, a member of SCH_SCREEN
/*
{
EDA_BaseStruct *DrawStruct;
while (DrawList != NULL)
{
DrawStruct = DrawList;
DrawList = DrawList->Pnext;
if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) //this is redundant -- use FreeDrawList, a member of SCH_SCREEN
{
DeleteSubHierarchy((DrawSheetStruct*) DrawStruct, confirm_deletion);
}
delete DrawStruct; /*
} * {
} * EDA_BaseStruct *DrawStruct;
*/ *
* while (DrawList != NULL)
* {
* DrawStruct = DrawList;
* DrawList = DrawList->Pnext;
*
* if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE)
* {
* DeleteSubHierarchy((DrawSheetStruct*) DrawStruct, confirm_deletion);
* }
*
* delete DrawStruct;
* }
* }
*/
/********************************************************************/ /********************************************************************/
bool ClearProjectDrawList(SCH_SCREEN * screen, bool confirm_deletion) bool ClearProjectDrawList( SCH_SCREEN* screen, bool confirm_deletion )
/********************************************************************/ /********************************************************************/
/* free the draw list screen->EEDrawList and the subhierarchies /* free the draw list screen->EEDrawList and the subhierarchies
clear the screen datas (filenames ..) * clear the screen datas (filenames ..)
*/ */
{ {
if ( screen == NULL ) return(TRUE); if( screen == NULL )
return TRUE;
screen->FreeDrawList();
screen->FreeDrawList();
/* Clear the screen datas */
screen->m_ScreenNumber = screen->m_NumberOfScreen = 1; /* Clear the screen datas */
screen->m_Title.Empty(); screen->m_ScreenNumber = screen->m_NumberOfScreen = 1;
screen->m_Revision.Empty(); screen->m_Title.Empty();
screen->m_Company.Empty(); screen->m_Revision.Empty();
screen->m_Commentaire1.Empty(); screen->m_Company.Empty();
screen->m_Commentaire2.Empty(); screen->m_Commentaire1.Empty();
screen->m_Commentaire3.Empty(); screen->m_Commentaire2.Empty();
screen->m_Commentaire4.Empty(); screen->m_Commentaire3.Empty();
screen->m_Date = GenDate(); screen->m_Commentaire4.Empty();
screen->m_Date = GenDate();
return TRUE;
return TRUE;
} }
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_edit_component_in_schematic.h
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Created: 03/03/2006 15:02:54
// RCS-ID:
// Copyright: License GNU
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 03/03/2006 15:02:54
#ifndef _DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_H_
#define _DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_H_
/*!
* Includes
*/
////@begin includes #ifndef __dialog_edit_component_in_schematic__
#include "wx/notebook.h" #define __dialog_edit_component_in_schematic__
////@end includes
/*!
* Forward declarations
*/
////@begin forward declarations #include "dialog_edit_component_in_schematic_fbp.h"
class wxBoxSizer;
class wxNotebook;
////@end forward declarations
/*! /**
* Control identifiers * class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC
* is hand coded and implements DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP which is maintained by
* wxFormBuilder. Do not auto-generate this class or file, it is hand coded.
*/ */
class DIALOG_EDIT_COMPONENT_IN_SCHEMATIC : public DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP
{
WinEDA_SchematicFrame* m_Parent;
SCH_COMPONENT* m_Cmp;
EDA_LibComponentStruct* m_LibEntry;
////@begin control identifiers /// a copy of the edited component's SCH_CMP_FIELDs
#define ID_DIALOG 10000 SCH_CMP_FIELDS m_FieldBuf;
#define ID_SCHEDIT_NOTEBOOK 10001
#define ID_PANEL_BASIC 10002
#define ID_RADIOBOX_UNIT 10004
#define ID_RADIOBOX_ORIENT 10005
#define ID_RADIOBOX_MIRROR 10007
#define ID_CHECKBOX 10008
#define ID_TEXTCTRL 10009
#define ID_PANEL_FIELD 10003
#define ID_CHECKBOX_SHOW_FILED 10010
#define ID_CHECKBOX_FILED_ORIENT 10011
#define ID_RESTORE_CMP_DEFAULTS 10006
#define SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_STYLE wxDEFAULT_DIALOG_STYLE|MAYBE_RESIZE_BORDER
#define SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_TITLE _("Component Properties")
#define SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_IDNAME ID_DIALOG
#define SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_SIZE wxSize(400, 300)
#define SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_POSITION wxDefaultPosition
////@end control identifiers
/*!
* Compatibility
*/
#ifndef wxCLOSE_BOX void setSelectedFieldNdx( int aFieldNdx );
#define wxCLOSE_BOX 0x1000
#endif
/*! int getSelectedFieldNdx();
* WinEDA_ComponentPropertiesFrame class declaration
*/
class WinEDA_ComponentPropertiesFrame: public wxDialog
{ /**
DECLARE_DYNAMIC_CLASS( WinEDA_ComponentPropertiesFrame ) * Function CopyDataToPanel
DECLARE_EVENT_TABLE() * sets the values displayed on the panel according to
* the current field number
*/
void copyDataToPanel();
void fillTableModel();
protected:
// Handlers for DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_FBP events.
// void OnGridCellLeftClick( wxGridEvent& event );
public: public:
/// Constructors /** Constructor */
WinEDA_ComponentPropertiesFrame( ); DIALOG_EDIT_COMPONENT_IN_SCHEMATIC( wxWindow* parent );
WinEDA_ComponentPropertiesFrame( WinEDA_SchematicFrame* parent,
SCH_COMPONENT * cmp, /**
wxWindowID id = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_STYLE ); * Function InitBuffers
* sets up to edit the given component.
/// Creation * @param aComponent The component to edit.
bool Create( wxWindow* parent, wxWindowID id = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_IDNAME, const wxString& caption = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_TITLE, const wxPoint& pos = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_POSITION, const wxSize& size = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_SIZE, long style = SYMBOL_WINEDA_COMPONENTPROPERTIESFRAME_STYLE ); */
void InitBuffers( SCH_COMPONENT* aComponent );
/// Creates the controls and sizers
void CreateControls();
////@begin WinEDA_ComponentPropertiesFrame event handler declarations
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_CANCEL
void OnCancelClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for ID_RESTORE_CMP_DEFAULTS
void OnRestoreCmpDefaultsClick( wxCommandEvent& event );
/// wxEVT_COMMAND_BUTTON_CLICKED event handler for wxID_OK
void OnOkClick( wxCommandEvent& event );
////@end WinEDA_ComponentPropertiesFrame event handler declarations
////@begin WinEDA_ComponentPropertiesFrame member function declarations
/// Retrieves bitmap resources
wxBitmap GetBitmapResource( const wxString& name );
/// Retrieves icon resources
wxIcon GetIconResource( const wxString& name );
////@end WinEDA_ComponentPropertiesFrame member function declarations
/// Should we show tooltips?
static bool ShowToolTips();
void InitBuffers();
void BuildPanelBasic();
void BuildPanelFields();
void ComponentPropertiesAccept(wxCommandEvent& event);
void SetInitCmp( wxCommandEvent& event );
void CopyDataToPanelField();
void CopyPanelFieldToData();
void SelectNewField(wxCommandEvent& event);
////@begin WinEDA_ComponentPropertiesFrame member variables
wxBoxSizer* m_GeneralBoxSizer;
wxNotebook* m_NoteBook;
wxPanel* m_PanelBasic;
wxRadioBox* m_SelectUnit;
wxRadioBox* m_OrientUnit;
wxRadioBox* m_MirrorUnit;
wxStaticText* m_MsgPartLocked;
wxCheckBox* m_ConvertButt;
wxTextCtrl* m_RefInLib;
wxPanel* m_PanelField;
wxCheckBox* m_ShowFieldTextCtrl;
wxCheckBox* m_VorientFieldText;
wxBoxSizer* m_FieldDatasBoxSizer;
wxBoxSizer* m_FieldSelectionBoxSizer;
wxButton* m_btClose;
////@end WinEDA_ComponentPropertiesFrame member variables
WinEDA_SchematicFrame * m_Parent;
SCH_COMPONENT * m_Cmp;
EDA_LibComponentStruct * m_LibEntry;
int m_CurrentFieldId;
wxRadioBox * m_FieldSelection;
WinEDA_GraphicTextCtrl * m_FieldTextCtrl;
WinEDA_EnterText * m_FieldNameCtrl;
WinEDA_PositionCtrl * m_FieldPositionCtrl;
wxString m_FieldText[NUMBER_OF_FIELDS];
wxString m_FieldName[NUMBER_OF_FIELDS];
wxPoint m_FieldPosition[NUMBER_OF_FIELDS];
int m_FieldSize[NUMBER_OF_FIELDS];
int m_FieldFlags[NUMBER_OF_FIELDS];
int m_FieldOrient[NUMBER_OF_FIELDS];
}; };
#endif #endif // __dialog_edit_component_in_schematic__
// _DIALOG_EDIT_COMPONENT_IN_SCHEMATIC_H_
...@@ -191,7 +191,7 @@ void WinEDA_PartPropertiesFrame::InitBuffers() ...@@ -191,7 +191,7 @@ void WinEDA_PartPropertiesFrame::InitBuffers()
while( Field ) while( Field )
{ {
CopyFieldDataToBuffer( Field ); CopyFieldDataToBuffer( Field );
Field = (LibDrawField*) Field->Pnext; Field = Field->Next();
} }
} }
...@@ -753,7 +753,7 @@ void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event ) ...@@ -753,7 +753,7 @@ void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event )
LibDrawField* NextField, * previousField = NULL; LibDrawField* NextField, * previousField = NULL;
while( Field ) while( Field )
{ {
NextField = (LibDrawField*) Field->Pnext; NextField = Field->Next();
if( Field->m_FieldId == ii ) if( Field->m_FieldId == ii )
{ {
CopyBufferToFieldData( Field ); CopyBufferToFieldData( Field );
...@@ -765,7 +765,7 @@ void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event ) ...@@ -765,7 +765,7 @@ void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event )
{ {
SAFE_DELETE( Field ); SAFE_DELETE( Field );
if( previousField ) if( previousField )
previousField->Pnext = NextField; previousField->SetNext( NextField );
else else
CurrentLibEntry->Fields = NextField; CurrentLibEntry->Fields = NextField;
} }
...@@ -789,7 +789,7 @@ void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event ) ...@@ -789,7 +789,7 @@ void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event )
Field = new LibDrawField( ii ); Field = new LibDrawField( ii );
CopyBufferToFieldData( Field ); CopyBufferToFieldData( Field );
Field->Pnext = CurrentLibEntry->Fields; Field->SetNext( CurrentLibEntry->Fields );
CurrentLibEntry->Fields = Field; CurrentLibEntry->Fields = Field;
} }
} }
...@@ -805,7 +805,7 @@ void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event ) ...@@ -805,7 +805,7 @@ void WinEDA_PartPropertiesFrame::PartPropertiesAccept( wxCommandEvent& event )
if( Field->m_FieldId >= FIELD1 ) if( Field->m_FieldId >= FIELD1 )
if( Field->m_Text.IsEmpty() ) if( Field->m_Text.IsEmpty() )
Field->m_Text = wxT( "~" ); Field->m_Text = wxT( "~" );
Field = (LibDrawField*) Field->Pnext; Field = Field->Next();
} }
} }
...@@ -1043,7 +1043,7 @@ bool WinEDA_PartPropertiesFrame::ChangeNbUnitsPerPackage( int MaxUnit ) ...@@ -1043,7 +1043,7 @@ bool WinEDA_PartPropertiesFrame::ChangeNbUnitsPerPackage( int MaxUnit )
for( ii = OldNumUnits + 1; ii <= MaxUnit; ii++ ) for( ii = OldNumUnits + 1; ii <= MaxUnit; ii++ )
{ {
NextDrawItem = CopyDrawEntryStruct( this, DrawItem ); NextDrawItem = CopyDrawEntryStruct( this, DrawItem );
NextDrawItem->Pnext = CurrentLibEntry->m_Drawings; NextDrawItem->SetNext( CurrentLibEntry->m_Drawings );
CurrentLibEntry->m_Drawings = NextDrawItem; CurrentLibEntry->m_Drawings = NextDrawItem;
NextDrawItem->m_Unit = ii; NextDrawItem->m_Unit = ii;
} }
...@@ -1090,7 +1090,7 @@ bool WinEDA_PartPropertiesFrame::SetUnsetConvert() ...@@ -1090,7 +1090,7 @@ bool WinEDA_PartPropertiesFrame::SetUnsetConvert()
} }
} }
NextDrawItem = CopyDrawEntryStruct( this, DrawItem ); NextDrawItem = CopyDrawEntryStruct( this, DrawItem );
NextDrawItem->Pnext = CurrentLibEntry->m_Drawings; NextDrawItem->SetNext( CurrentLibEntry->m_Drawings );
CurrentLibEntry->m_Drawings = NextDrawItem; CurrentLibEntry->m_Drawings = NextDrawItem;
NextDrawItem->m_Convert = 2; NextDrawItem->m_Convert = 2;
} }
......
This diff is collapsed.
...@@ -378,7 +378,7 @@ void WinEDA_SchematicFrame::ConvertTextType( SCH_TEXT* Text, ...@@ -378,7 +378,7 @@ void WinEDA_SchematicFrame::ConvertTextType( SCH_TEXT* Text,
/* add the new text in linked list if old text is in list */ /* add the new text in linked list if old text is in list */
if( (flags & IS_NEW) == 0 ) if( (flags & IS_NEW) == 0 )
{ {
newtext->Pnext = GetScreen()->EEDrawList; newtext->SetNext( GetScreen()->EEDrawList );
GetScreen()->EEDrawList = newtext; GetScreen()->EEDrawList = newtext;
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
......
...@@ -64,7 +64,7 @@ wxPoint TransformCoordinate( int aTransformMatrix[2][2], wxPoint& aPosition ) ...@@ -64,7 +64,7 @@ wxPoint TransformCoordinate( int aTransformMatrix[2][2], wxPoint& aPosition )
void CreateDummyCmp() void CreateDummyCmp()
/******************************/ /******************************/
{ {
DummyCmp = new EDA_LibComponentStruct( NULL ); DummyCmp = new EDA_LibComponentStruct( NULL );
LibDrawSquare* Square = new LibDrawSquare(); LibDrawSquare* Square = new LibDrawSquare();
...@@ -78,7 +78,7 @@ void CreateDummyCmp() ...@@ -78,7 +78,7 @@ void CreateDummyCmp()
Text->m_Text = wxT( "??" ); Text->m_Text = wxT( "??" );
DummyCmp->m_Drawings = Square; DummyCmp->m_Drawings = Square;
Square->Pnext = Text; Square->SetNext( Text );
} }
...@@ -153,7 +153,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -153,7 +153,7 @@ void DrawLibEntry( WinEDA_DrawPanel* panel, wxDC* DC,
if( (LibEntry->m_Name.m_Flags & IS_MOVED) == 0 ) if( (LibEntry->m_Name.m_Flags & IS_MOVED) == 0 )
LibEntry->m_Name.Draw( panel, DC, aOffset, color, DrawMode, NULL, TransMat ); LibEntry->m_Name.Draw( panel, DC, aOffset, color, DrawMode, NULL, TransMat );
for( Field = LibEntry->Fields; Field != NULL; Field = (LibDrawField*) Field->Pnext ) for( Field = LibEntry->Fields; Field != NULL; Field = Field->Next() )
{ {
if( Field->m_Text.IsEmpty() ) if( Field->m_Text.IsEmpty() )
return; return;
......
...@@ -92,8 +92,8 @@ LibraryStruct* LoadLibraryName( WinEDA_DrawFrame* frame, ...@@ -92,8 +92,8 @@ LibraryStruct* LoadLibraryName( WinEDA_DrawFrame* frame,
LoadDocLib( frame, FullFileName, NewLib->m_Name ); LoadDocLib( frame, FullFileName, NewLib->m_Name );
} }
else{ else{
SAFE_DELETE( NewLib ); SAFE_DELETE( NewLib );
} }
fclose( f ); fclose( f );
return NewLib; return NewLib;
} }
...@@ -138,7 +138,7 @@ void LoadLibraries( WinEDA_DrawFrame* frame ) ...@@ -138,7 +138,7 @@ void LoadLibraries( WinEDA_DrawFrame* frame )
if( LibName.IsEmpty() ) if( LibName.IsEmpty() )
continue; continue;
FullLibName = MakeFileName( g_RealLibDirBuffer, LibName, g_LibExtBuffer ); FullLibName = MakeFileName( g_RealLibDirBuffer, LibName, g_LibExtBuffer );
// Loaded library statusbar message // Loaded library statusbar message
msg = _( "Library " ) + FullLibName; msg = _( "Library " ) + FullLibName;
...@@ -238,7 +238,7 @@ void FreeCmpLibrary( wxWindow* frame, const wxString& LibName ) ...@@ -238,7 +238,7 @@ void FreeCmpLibrary( wxWindow* frame, const wxString& LibName )
TempLib->m_Pnext = TempLib->m_Pnext->m_Pnext; TempLib->m_Pnext = TempLib->m_Pnext->m_Pnext;
} }
SAFE_DELETE( Lib ); SAFE_DELETE( Lib );
/* The removed librairy can be the current library in libedit. /* The removed librairy can be the current library in libedit.
* If so, clear the current library in libedit */ * If so, clear the current library in libedit */
...@@ -285,7 +285,7 @@ int LibraryEntryCompare( EDA_LibComponentStruct* LE1, EDA_LibComponentStruct* LE ...@@ -285,7 +285,7 @@ int LibraryEntryCompare( EDA_LibComponentStruct* LE1, EDA_LibComponentStruct* LE
/**************************************************/ /**************************************************/
/* Routine to load a library from given open file */ /* Routine to load a library from given open file */
/**************************************************/ /**************************************************/
PriorQue* LoadLibraryAux( WinEDA_DrawFrame* frame, PriorQue* LoadLibraryAux( WinEDA_DrawFrame* frame,
LibraryStruct* Library, LibraryStruct* Library,
FILE* libfile, FILE* libfile,
int* NumOfParts ) int* NumOfParts )
...@@ -487,7 +487,7 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame, char ...@@ -487,7 +487,7 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame, char
Msg.Printf( wxT( " Error at line %d of library \n\"%s\",\nlibrary not loaded" ), Msg.Printf( wxT( " Error at line %d of library \n\"%s\",\nlibrary not loaded" ),
*LineNum, currentLibraryName.GetData() ); *LineNum, currentLibraryName.GetData() );
DisplayError( frame, Msg ); DisplayError( frame, Msg );
SAFE_DELETE( LibEntry ); SAFE_DELETE( LibEntry );
return NULL; return NULL;
} }
} }
...@@ -784,7 +784,7 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char* ...@@ -784,7 +784,7 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char*
MsgLine.Printf( wxT( "Error in %c DRAW command in line %d, aborted." ), MsgLine.Printf( wxT( "Error in %c DRAW command in line %d, aborted." ),
Line[0], *LineNum ); Line[0], *LineNum );
DisplayError( frame, MsgLine ); DisplayError( frame, MsgLine );
SAFE_DELETE( New ); SAFE_DELETE( New );
/* FLush till end of draw: */ /* FLush till end of draw: */
do { do {
...@@ -803,7 +803,8 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char* ...@@ -803,7 +803,8 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char*
Head = Tail = New; Head = Tail = New;
else else
{ {
Tail->Pnext = New; Tail = New; Tail->SetNext( New );
Tail = New;
} }
} }
} }
...@@ -935,7 +936,7 @@ static bool GetLibEntryField( EDA_LibComponentStruct* LibEntry, char* line ) ...@@ -935,7 +936,7 @@ static bool GetLibEntryField( EDA_LibComponentStruct* LibEntry, char* line )
Field = new LibDrawField( NumOfField ); Field = new LibDrawField( NumOfField );
Field->Pnext = LibEntry->Fields; Field->SetNext( LibEntry->Fields );
LibEntry->Fields = Field; LibEntry->Fields = Field;
break; break;
} }
...@@ -1154,7 +1155,7 @@ void EDA_LibComponentStruct::SortDrawItems() ...@@ -1154,7 +1155,7 @@ void EDA_LibComponentStruct::SortDrawItems()
Bufentry = BufentryBase; Bufentry = BufentryBase;
for( ii = 0; ii < nbitems; ii++ ) for( ii = 0; ii < nbitems; ii++ )
{ {
(*Bufentry)->Pnext = *(Bufentry + 1); (*Bufentry)->SetNext( *(Bufentry + 1) );
Bufentry++; Bufentry++;
} }
......
...@@ -428,7 +428,7 @@ void WinEDA_ErcFrame::DelERCMarkers( wxCommandEvent& event ) ...@@ -428,7 +428,7 @@ void WinEDA_ErcFrame::DelERCMarkers( wxCommandEvent& event )
// Delete markers for the current screen // Delete markers for the current screen
DrawStruct = m_Parent->GetScreen()->EEDrawList; DrawStruct = m_Parent->GetScreen()->EEDrawList;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{ {
if( DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE ) if( DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE )
continue; continue;
...@@ -533,7 +533,7 @@ static void Diagnose( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -533,7 +533,7 @@ static void Diagnose( WinEDA_DrawPanel* panel, wxDC* DC,
Marker->m_Type = MARQ_ERC; Marker->m_Type = MARQ_ERC;
Marker->m_MarkFlags = WAR; Marker->m_MarkFlags = WAR;
screen = NetItemRef->m_SheetList.LastScreen(); screen = NetItemRef->m_SheetList.LastScreen();
Marker->Pnext = screen->EEDrawList; Marker->SetNext( screen->EEDrawList );
screen->EEDrawList = Marker; screen->EEDrawList = Marker;
g_EESchemaVar.NbErrorErc++; g_EESchemaVar.NbErrorErc++;
g_EESchemaVar.NbWarningErc++; g_EESchemaVar.NbWarningErc++;
...@@ -741,7 +741,7 @@ static bool WriteDiagnosticERC( const wxString& FullFileName ) ...@@ -741,7 +741,7 @@ static bool WriteDiagnosticERC( const wxString& FullFileName )
fprintf( OutErc, "%s", CONV_TO_UTF8( msg ) ); fprintf( OutErc, "%s", CONV_TO_UTF8( msg ) );
DrawStruct = Sheet->LastDrawList(); DrawStruct = Sheet->LastDrawList();
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{ {
if( DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE ) if( DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE )
continue; continue;
......
...@@ -216,7 +216,7 @@ SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen( ...@@ -216,7 +216,7 @@ SCH_SCREEN* WinEDA_SchematicFrame::CreateNewScreen(
NewScreen->m_Company = OldScreen->m_Company; NewScreen->m_Company = OldScreen->m_Company;
NewScreen->m_TimeStamp = TimeStamp; NewScreen->m_TimeStamp = TimeStamp;
NewScreen->Pback = OldScreen; NewScreen->SetBack( OldScreen );
return NewScreen; return NewScreen;
} }
......
...@@ -218,7 +218,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC, ...@@ -218,7 +218,7 @@ SCH_COMPONENT* WinEDA_SchematicFrame::Load_Component( wxDC* DC,
DrawLibItem->GetField( REFERENCE )->m_VJustify = Entry->m_Prefix.m_VJustify; DrawLibItem->GetField( REFERENCE )->m_VJustify = Entry->m_Prefix.m_VJustify;
/* Init des autres champs si predefinis dans la librairie */ /* Init des autres champs si predefinis dans la librairie */
for( Field = Entry->Fields; Field != NULL; Field = (LibDrawField*) Field->Pnext ) for( Field = Entry->Fields; Field != NULL; Field = Field->Next() )
{ {
if( Field->m_Text.IsEmpty() && Field->m_Name.IsEmpty() ) if( Field->m_Text.IsEmpty() && Field->m_Name.IsEmpty() )
continue; continue;
......
...@@ -233,7 +233,7 @@ void WinEDA_HierFrame::BuildSheetList( DrawSheetPath* list, ...@@ -233,7 +233,7 @@ void WinEDA_HierFrame::BuildSheetList( DrawSheetPath* list,
m_Tree->Expand( menu ); m_Tree->Expand( menu );
list->Pop(); list->Pop();
} }
bs = bs->Pnext; bs = bs->Next();
} }
maxposx -= m_Tree->GetIndent(); maxposx -= m_Tree->GetIndent();
......
/********************************************/ /********************************************/
/* library editor: undo and redo functions */ /* library editor: undo and redo functions */
/********************************************/ /********************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
...@@ -15,72 +15,79 @@ ...@@ -15,72 +15,79 @@
/*************************************************************************/ /*************************************************************************/
void WinEDA_LibeditFrame::SaveCopyInUndoList(EDA_BaseStruct * ItemToCopy, void WinEDA_LibeditFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
int unused_flag) int unused_flag )
/*************************************************************************/ /*************************************************************************/
{ {
EDA_BaseStruct * item; EDA_BaseStruct* item;
EDA_LibComponentStruct * CopyItem; EDA_LibComponentStruct* CopyItem;
CopyItem = CopyLibEntryStruct ( this, (EDA_LibComponentStruct *) ItemToCopy); CopyItem = CopyLibEntryStruct( this, (EDA_LibComponentStruct*) ItemToCopy );
GetScreen()->AddItemToUndoList((EDA_BaseStruct *)CopyItem); GetScreen()->AddItemToUndoList( (EDA_BaseStruct*) CopyItem );
/* Clear current flags (which can be temporary set by a current edit command) */ /* Clear current flags (which can be temporary set by a current edit command) */
for ( item = CopyItem->m_Drawings; item != NULL; item = item->Pnext ) for( item = CopyItem->m_Drawings; item != NULL; item = item->Next() )
item->m_Flags = 0; item->m_Flags = 0;
/* Clear redo list, because after new save there is no redo to do */
/* Clear redo list, because after new save there is no redo to do */ while( GetScreen()->m_RedoList )
while ( GetScreen()->m_RedoList ) {
{ item = GetScreen()->m_RedoList->Next();
item = GetScreen()->m_RedoList->Pnext; delete( GetScreen()->m_RedoList );
delete (GetScreen()->m_RedoList); GetScreen()->m_RedoList = item;
GetScreen()->m_RedoList = item; }
}
} }
/******************************************************/ /******************************************************/
bool WinEDA_LibeditFrame::GetComponentFromRedoList() bool WinEDA_LibeditFrame::GetComponentFromRedoList()
/******************************************************/ /******************************************************/
/* Redo the last edition: /* Redo the last edition:
- Place the current edited library component in undo list * - Place the current edited library component in undo list
- Get old version of the current edited library component * - Get old version of the current edited library component
* @return FALSE if nothing done, else TRUE * @return FALSE if nothing done, else TRUE
*/ */
{ {
if ( GetScreen()->m_RedoList == NULL ) return FALSE; if( GetScreen()->m_RedoList == NULL )
return FALSE;
GetScreen()->AddItemToUndoList((EDA_BaseStruct *)CurrentLibEntry);
CurrentLibEntry = GetScreen()->AddItemToUndoList( (EDA_BaseStruct*) CurrentLibEntry );
(EDA_LibComponentStruct *) GetScreen()->GetItemFromRedoList(); CurrentLibEntry =
if ( CurrentLibEntry ) CurrentLibEntry->Pnext = NULL; (EDA_LibComponentStruct*) GetScreen()->GetItemFromRedoList();
CurrentDrawItem = NULL; if( CurrentLibEntry )
GetScreen()->SetModify(); CurrentLibEntry->SetNext( NULL );
ReCreateHToolbar(); CurrentDrawItem = NULL;
SetToolbars(); GetScreen()->SetModify();
ReCreateHToolbar();
return TRUE; SetToolbars();
return TRUE;
} }
/******************************************************/ /******************************************************/
bool WinEDA_LibeditFrame::GetComponentFromUndoList() bool WinEDA_LibeditFrame::GetComponentFromUndoList()
/******************************************************/ /******************************************************/
/* Undo the last edition: /* Undo the last edition:
- Place the current edited library component in Redo list * - Place the current edited library component in Redo list
- Get old version of the current edited library component * - Get old version of the current edited library component
* @return FALSE if nothing done, else TRUE * @return FALSE if nothing done, else TRUE
*/ */
{ {
if ( GetScreen()->m_UndoList == NULL ) return FALSE; if( GetScreen()->m_UndoList == NULL )
return FALSE;
GetScreen()->AddItemToRedoList((EDA_BaseStruct *)CurrentLibEntry);
CurrentLibEntry = GetScreen()->AddItemToRedoList( (EDA_BaseStruct*) CurrentLibEntry );
(EDA_LibComponentStruct *) GetScreen()->GetItemFromUndoList(); CurrentLibEntry =
(EDA_LibComponentStruct*) GetScreen()->GetItemFromUndoList();
if ( CurrentLibEntry ) CurrentLibEntry->Pnext = NULL;
CurrentDrawItem = NULL; if( CurrentLibEntry )
GetScreen()->SetModify(); CurrentLibEntry->SetNext( NULL );
ReCreateHToolbar(); CurrentDrawItem = NULL;
SetToolbars(); GetScreen()->SetModify();
ReCreateHToolbar();
return TRUE; SetToolbars();
return TRUE;
} }
This diff is collapsed.
...@@ -212,7 +212,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F ...@@ -212,7 +212,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
if( !Failed ) if( !Failed )
{ {
SegmentStruct->Pnext = screen->EEDrawList; SegmentStruct->SetNext( screen->EEDrawList );
screen->EEDrawList = SegmentStruct; screen->EEDrawList = SegmentStruct;
} }
break; break;
...@@ -251,7 +251,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F ...@@ -251,7 +251,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
{ {
RaccordStruct->m_Size.x -= RaccordStruct->m_Pos.x; RaccordStruct->m_Size.x -= RaccordStruct->m_Pos.x;
RaccordStruct->m_Size.y -= RaccordStruct->m_Pos.y; RaccordStruct->m_Size.y -= RaccordStruct->m_Pos.y;
RaccordStruct->Pnext = screen->EEDrawList; RaccordStruct->SetNext( screen->EEDrawList );
screen->EEDrawList = RaccordStruct; screen->EEDrawList = RaccordStruct;
} }
break; break;
...@@ -294,7 +294,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F ...@@ -294,7 +294,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
if( !Failed ) if( !Failed )
{ {
PolylineStruct->Pnext = screen->EEDrawList; PolylineStruct->SetNext( screen->EEDrawList );
screen->EEDrawList = PolylineStruct; screen->EEDrawList = PolylineStruct;
} }
break; break;
...@@ -314,7 +314,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F ...@@ -314,7 +314,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
} }
else else
{ {
ConnectionStruct->Pnext = screen->EEDrawList; ConnectionStruct->SetNext( screen->EEDrawList );
screen->EEDrawList = ConnectionStruct; screen->EEDrawList = ConnectionStruct;
} }
break; break;
...@@ -331,7 +331,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F ...@@ -331,7 +331,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
{ {
NoConnectStruct = new DrawNoConnectStruct( pos ); NoConnectStruct = new DrawNoConnectStruct( pos );
NoConnectStruct->Pnext = screen->EEDrawList; NoConnectStruct->SetNext( screen->EEDrawList );
screen->EEDrawList = NoConnectStruct; screen->EEDrawList = NoConnectStruct;
} }
break; break;
...@@ -362,7 +362,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F ...@@ -362,7 +362,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
sscanf( text + 3, "%X", &ii ); sscanf( text + 3, "%X", &ii );
MarkerStruct->m_MarkFlags = ii; MarkerStruct->m_MarkFlags = ii;
} }
MarkerStruct->Pnext = screen->EEDrawList; MarkerStruct->SetNext( screen->EEDrawList );
screen->EEDrawList = MarkerStruct; screen->EEDrawList = MarkerStruct;
} }
break; break;
...@@ -452,7 +452,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F ...@@ -452,7 +452,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
} }
if( Struct ) if( Struct )
{ {
Struct->Pnext = screen->EEDrawList; Struct->SetNext( screen->EEDrawList );
screen->EEDrawList = Struct; screen->EEDrawList = Struct;
} }
} }
...@@ -480,7 +480,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F ...@@ -480,7 +480,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
{ {
Pnext = screen->EEDrawList; Pnext = screen->EEDrawList;
screen->EEDrawList = screen->EEDrawList->Next(); screen->EEDrawList = screen->EEDrawList->Next();
Pnext->Pnext = Phead; Pnext->SetNext( Phead );
Phead = Pnext; Phead = Pnext;
} }
...@@ -825,9 +825,9 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, ...@@ -825,9 +825,9 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
if( !Failed ) if( !Failed )
{ {
component->Pnext = Window->EEDrawList; component->SetNext( Window->EEDrawList );
Window->EEDrawList = component; Window->EEDrawList = component;
component->m_Parent = Window; component->SetParent( Window );
} }
return Failed; /* Fin lecture 1 composant */ return Failed; /* Fin lecture 1 composant */
...@@ -965,7 +965,7 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi ...@@ -965,7 +965,7 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
if( SheetStruct->m_Label == NULL ) if( SheetStruct->m_Label == NULL )
OldSheetLabel = SheetStruct->m_Label = SheetLabelStruct; OldSheetLabel = SheetStruct->m_Label = SheetLabelStruct;
else else
OldSheetLabel->Pnext = (EDA_BaseStruct*) SheetLabelStruct; OldSheetLabel->SetNext( (EDA_BaseStruct*) SheetLabelStruct );
OldSheetLabel = SheetLabelStruct; OldSheetLabel = SheetLabelStruct;
/* Lecture des coordonnees */ /* Lecture des coordonnees */
...@@ -1017,9 +1017,9 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi ...@@ -1017,9 +1017,9 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
} }
if( !Failed ) if( !Failed )
{ {
SheetStruct->Pnext = Window->EEDrawList; SheetStruct->SetNext( Window->EEDrawList );
Window->EEDrawList = SheetStruct; Window->EEDrawList = SheetStruct;
SheetStruct->m_Parent = Window; SheetStruct->SetParent( Window );
} }
return Failed; /* Fin lecture 1 composant */ return Failed; /* Fin lecture 1 composant */
} }
......
...@@ -165,12 +165,12 @@ SCH_ITEM* PickStruct( EDA_Rect& block, BASE_SCREEN* screen, int SearchMask ) ...@@ -165,12 +165,12 @@ SCH_ITEM* PickStruct( EDA_Rect& block, BASE_SCREEN* screen, int SearchMask )
/* Put this structure in the picked list: */ /* Put this structure in the picked list: */
PickedItem = new DrawPickedStruct( DrawStruct ); PickedItem = new DrawPickedStruct( DrawStruct );
PickedItem->Pnext = PickedList; PickedItem->SetNext( PickedList );
PickedList = PickedItem; PickedList = PickedItem;
} }
} }
if( PickedList && PickedList->Pnext == NULL ) if( PickedList && PickedList->Next() == NULL )
{ {
/* Only one item was picked - convert to scalar form (no list): */ /* Only one item was picked - convert to scalar form (no list): */
PickedItem = PickedList; PickedItem = PickedList;
...@@ -1192,7 +1192,7 @@ Hierarchical_PIN_Sheet_Struct* LocateSheetLabel( DrawSheetStruct* Sheet, const w ...@@ -1192,7 +1192,7 @@ Hierarchical_PIN_Sheet_Struct* LocateSheetLabel( DrawSheetStruct* Sheet, const w
&& (pos.x <= maxx) && (pos.x <= maxx)
&& (pos.x >= minx) ) && (pos.x >= minx) )
return SheetLabel; return SheetLabel;
SheetLabel = (Hierarchical_PIN_Sheet_Struct*) SheetLabel->Pnext; SheetLabel = SheetLabel->Next();
} }
return NULL; return NULL;
......
...@@ -289,7 +289,7 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame, ...@@ -289,7 +289,7 @@ void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame,
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
for( SchItem = sheet->LastDrawList(); SchItem != NULL; SchItem = SchItem->Pnext ) for( SchItem = sheet->LastDrawList(); SchItem != NULL; SchItem = SchItem->Next() )
{ {
SchItem = Component = FindNextComponentAndCreatPinList( SchItem, sheet ); SchItem = Component = FindNextComponentAndCreatPinList( SchItem, sheet );
...@@ -413,7 +413,7 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f, ...@@ -413,7 +413,7 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext ) for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Next() )
{ {
wxChar ident; wxChar ident;
if( DrawList->Type() != TYPE_SCH_TEXT ) if( DrawList->Type() != TYPE_SCH_TEXT )
...@@ -467,7 +467,7 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f, ...@@ -467,7 +467,7 @@ static void WriteNetListPspice( WinEDA_SchematicFrame* frame, FILE* f,
ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic files*/ ClearUsedFlags(); /* Reset the flags FlagControlMulti in all schematic files*/
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext ) for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Next() )
{ {
DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet ); DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet );
if( Component == NULL ) if( Component == NULL )
...@@ -556,7 +556,7 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with ...@@ -556,7 +556,7 @@ static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, bool with
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext ) for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Next() )
{ {
DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet ); DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet );
if( Component == NULL ) if( Component == NULL )
...@@ -771,7 +771,7 @@ static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component_in, ...@@ -771,7 +771,7 @@ static void FindAllsInstancesOfComponent( SCH_COMPONENT* Component_in,
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
for( SchItem = sheet->LastDrawList(); SchItem; SchItem = SchItem->Pnext ) for( SchItem = sheet->LastDrawList(); SchItem; SchItem = SchItem->Next() )
{ {
if( SchItem->Type() != TYPE_SCH_COMPONENT ) if( SchItem->Type() != TYPE_SCH_COMPONENT )
continue; continue;
...@@ -960,7 +960,7 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f ) ...@@ -960,7 +960,7 @@ static void WriteNetListCADSTAR( WinEDA_SchematicFrame* frame, FILE* f )
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Pnext ) for( DrawList = sheet->LastDrawList(); DrawList != NULL; DrawList = DrawList->Next() )
{ {
DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet ); DrawList = Component = FindNextComponentAndCreatPinList( DrawList, sheet );
if( Component == NULL ) if( Component == NULL )
......
...@@ -489,7 +489,7 @@ static int ListeObjetConnection( DrawSheetPath* sheetlist, ObjetNetListStruct* O ...@@ -489,7 +489,7 @@ static int ListeObjetConnection( DrawSheetPath* sheetlist, ObjetNetListStruct* O
DrawSheetPath list; DrawSheetPath list;
DrawList = sheetlist->LastScreen()->EEDrawList; DrawList = sheetlist->LastScreen()->EEDrawList;
for( ; DrawList; DrawList = DrawList->Pnext ) for( ; DrawList; DrawList = DrawList->Next() )
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )
{ {
...@@ -678,7 +678,7 @@ static int ListeObjetConnection( DrawSheetPath* sheetlist, ObjetNetListStruct* O ...@@ -678,7 +678,7 @@ static int ListeObjetConnection( DrawSheetPath* sheetlist, ObjetNetListStruct* O
list.Push( STRUCT ); list.Push( STRUCT );
SheetLabel = STRUCT->m_Label; SheetLabel = STRUCT->m_Label;
for( ; SheetLabel != NULL; for( ; SheetLabel != NULL;
SheetLabel = (Hierarchical_PIN_Sheet_Struct*) SheetLabel->Pnext ) SheetLabel = SheetLabel->Next() )
{ {
ii = IsBusLabel( SheetLabel->m_Text ); ii = IsBusLabel( SheetLabel->m_Text );
if( ObjNet ) if( ObjNet )
......
...@@ -135,7 +135,7 @@ void WinEDA_LibeditFrame::InitEditOnePin() ...@@ -135,7 +135,7 @@ void WinEDA_LibeditFrame::InitEditOnePin()
/* Marquage des pins a traiter,Si edition d'une pin non deja selectionnee */ /* Marquage des pins a traiter,Si edition d'une pin non deja selectionnee */
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = Pin->Next() )
{ {
if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
continue; continue;
...@@ -200,7 +200,7 @@ void WinEDA_LibeditFrame::PlacePin( wxDC* DC ) ...@@ -200,7 +200,7 @@ void WinEDA_LibeditFrame::PlacePin( wxDC* DC )
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
// Tst for an other pin in same new position: // Tst for an other pin in same new position:
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = Pin->Next() )
{ {
if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
continue; continue;
...@@ -239,7 +239,7 @@ void WinEDA_LibeditFrame::PlacePin( wxDC* DC ) ...@@ -239,7 +239,7 @@ void WinEDA_LibeditFrame::PlacePin( wxDC* DC )
/* Put linked pins in new position, and clear flags */ /* Put linked pins in new position, and clear flags */
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = Pin->Next() )
{ {
if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
continue; continue;
...@@ -276,7 +276,7 @@ void WinEDA_PinPropertiesFrame::SetPinOrient( int neworient ) ...@@ -276,7 +276,7 @@ void WinEDA_PinPropertiesFrame::SetPinOrient( int neworient )
RefPin->m_Orient = neworient; RefPin->m_Orient = neworient;
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = Pin->Next() )
{ {
if( Pin->m_Flags == 0 ) if( Pin->m_Flags == 0 )
continue; continue;
...@@ -302,7 +302,7 @@ void WinEDA_LibeditFrame::StartMovePin( wxDC* DC ) ...@@ -302,7 +302,7 @@ void WinEDA_LibeditFrame::StartMovePin( wxDC* DC )
/* Marquage des pins a traiter */ /* Marquage des pins a traiter */
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = Pin->Next() )
{ {
Pin->m_Flags = 0; Pin->m_Flags = 0;
if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
...@@ -381,7 +381,7 @@ void WinEDA_PinPropertiesFrame::SetPinShape( int newshape ) ...@@ -381,7 +381,7 @@ void WinEDA_PinPropertiesFrame::SetPinShape( int newshape )
CurrentPin->Display_Infos_DrawEntry( m_Parent ); CurrentPin->Display_Infos_DrawEntry( m_Parent );
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = Pin->Next() )
{ {
if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
continue; continue;
...@@ -414,7 +414,7 @@ void WinEDA_PinPropertiesFrame::SetPinType( int newtype ) ...@@ -414,7 +414,7 @@ void WinEDA_PinPropertiesFrame::SetPinType( int newtype )
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = Pin->Next() )
{ {
if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
continue; continue;
...@@ -450,7 +450,7 @@ void WinEDA_PinPropertiesFrame::SetPinName( const wxString& newname, int newsize ...@@ -450,7 +450,7 @@ void WinEDA_PinPropertiesFrame::SetPinName( const wxString& newname, int newsize
/* Traitement des autres pins */ /* Traitement des autres pins */
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = Pin->Next() )
{ {
if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
continue; continue;
...@@ -492,7 +492,7 @@ void WinEDA_PinPropertiesFrame::SetPinNum( const wxString& newnum, int newsize ) ...@@ -492,7 +492,7 @@ void WinEDA_PinPropertiesFrame::SetPinNum( const wxString& newnum, int newsize )
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = Pin->Next() )
{ {
if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
continue; continue;
...@@ -539,7 +539,8 @@ void WinEDA_LibeditFrame::DeletePin( wxDC* DC, ...@@ -539,7 +539,8 @@ void WinEDA_LibeditFrame::DeletePin( wxDC* DC,
{ {
if( DrawItem->Type() != COMPONENT_PIN_DRAW_TYPE ) if( DrawItem->Type() != COMPONENT_PIN_DRAW_TYPE )
{ {
DrawItem = DrawItem->Next(); continue; DrawItem = DrawItem->Next();
continue;
} }
Pin = (LibDrawPin*) DrawItem; Pin = (LibDrawPin*) DrawItem;
DrawItem = DrawItem->Next(); DrawItem = DrawItem->Next();
...@@ -602,7 +603,7 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC ) ...@@ -602,7 +603,7 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
else else
CurrentPin->m_Attributs &= ~PINNOTDRAW; CurrentPin->m_Attributs &= ~PINNOTDRAW;
CurrentPin->Pnext = CurrentLibEntry->m_Drawings; CurrentPin->SetNext( CurrentLibEntry->m_Drawings );
CurrentLibEntry->m_Drawings = CurrentPin; CurrentLibEntry->m_Drawings = CurrentPin;
CurrentLibEntry->SortDrawItems(); CurrentLibEntry->SortDrawItems();
...@@ -725,7 +726,7 @@ void WinEDA_PinPropertiesFrame::SetAttributsPin( bool draw, ...@@ -725,7 +726,7 @@ void WinEDA_PinPropertiesFrame::SetAttributsPin( bool draw,
CurrentPin->m_Attributs &= ~PINNOTDRAW; CurrentPin->m_Attributs &= ~PINNOTDRAW;
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = Pin->Next() )
{ {
if( Pin->m_Flags == 0 ) if( Pin->m_Flags == 0 )
continue; continue;
...@@ -765,7 +766,7 @@ void WinEDA_PinPropertiesFrame::NewSizePin( int newsize ) ...@@ -765,7 +766,7 @@ void WinEDA_PinPropertiesFrame::NewSizePin( int newsize )
if( g_EditPinByPinIsOn == FALSE ) if( g_EditPinByPinIsOn == FALSE )
{ {
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = Pin->Next() )
{ {
if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
continue; continue;
...@@ -805,7 +806,7 @@ static void CreateImagePins( LibDrawPin* Pin ) ...@@ -805,7 +806,7 @@ static void CreateImagePins( LibDrawPin* Pin )
NewPin->m_Convert = 1; NewPin->m_Convert = 1;
else else
NewPin->m_Convert = 2; NewPin->m_Convert = 2;
NewPin->Pnext = CurrentLibEntry->m_Drawings; NewPin->SetNext( CurrentLibEntry->m_Drawings );
CurrentLibEntry->m_Drawings = NewPin; CurrentLibEntry->m_Drawings = NewPin;
} }
...@@ -821,7 +822,7 @@ static void CreateImagePins( LibDrawPin* Pin ) ...@@ -821,7 +822,7 @@ static void CreateImagePins( LibDrawPin* Pin )
if( CurrentConvert != 0 ) if( CurrentConvert != 0 )
NewPin->m_Convert = 1; NewPin->m_Convert = 1;
NewPin->m_Unit = ii; NewPin->m_Unit = ii;
NewPin->Pnext = CurrentLibEntry->m_Drawings; NewPin->SetNext( CurrentLibEntry->m_Drawings );
CurrentLibEntry->m_Drawings = NewPin; CurrentLibEntry->m_Drawings = NewPin;
/* Creation pour la representation "Convert" */ /* Creation pour la representation "Convert" */
...@@ -832,7 +833,7 @@ static void CreateImagePins( LibDrawPin* Pin ) ...@@ -832,7 +833,7 @@ static void CreateImagePins( LibDrawPin* Pin )
NewPin->m_Convert = 2; NewPin->m_Convert = 2;
if( Pin->m_Unit != 0 ) if( Pin->m_Unit != 0 )
NewPin->m_Unit = ii; NewPin->m_Unit = ii;
NewPin->Pnext = CurrentLibEntry->m_Drawings; NewPin->SetNext( CurrentLibEntry->m_Drawings );
CurrentLibEntry->m_Drawings = NewPin; CurrentLibEntry->m_Drawings = NewPin;
} }
} }
...@@ -861,7 +862,7 @@ void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC, ...@@ -861,7 +862,7 @@ void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC,
GetScreen()->SetModify(); GetScreen()->SetModify();
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ; Pin != NULL; Pin = Pin->Next() )
{ {
if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE )
continue; continue;
...@@ -911,7 +912,7 @@ void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LibDrawPin* SourcePin ) ...@@ -911,7 +912,7 @@ void WinEDA_LibeditFrame::RepeatPinItem( wxDC* DC, LibDrawPin* SourcePin )
return; return;
Pin = SourcePin->GenCopy(); Pin = SourcePin->GenCopy();
Pin->Pnext = CurrentLibEntry->m_Drawings; Pin->SetNext( CurrentLibEntry->m_Drawings );
CurrentLibEntry->m_Drawings = Pin; CurrentLibEntry->m_Drawings = Pin;
Pin->m_Flags = IS_NEW; Pin->m_Flags = IS_NEW;
...@@ -960,16 +961,17 @@ bool WinEDA_LibeditFrame::TestPins( EDA_LibComponentStruct* LibEntry ) ...@@ -960,16 +961,17 @@ bool WinEDA_LibeditFrame::TestPins( EDA_LibComponentStruct* LibEntry )
// Test des pins ( duplicates...) // Test des pins ( duplicates...)
{ {
int nb_pins, ii, error; int nb_pins, ii, error;
LibDrawPin* Pin, ** PinList; LibDrawPin* Pin;
wxString msg; LibDrawPin** PinList;
wxString msg;
if( CurrentLibEntry == NULL ) if( CurrentLibEntry == NULL )
return FALSE; return FALSE;
// Construction de la liste des pins: // Construction de la liste des pins:
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( nb_pins = 0; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( nb_pins = 0; Pin != NULL; Pin = Pin->Next() )
{ {
if( Pin->Type() == COMPONENT_PIN_DRAW_TYPE ) if( Pin->Type() == COMPONENT_PIN_DRAW_TYPE )
nb_pins++; nb_pins++;
...@@ -977,7 +979,7 @@ bool WinEDA_LibeditFrame::TestPins( EDA_LibComponentStruct* LibEntry ) ...@@ -977,7 +979,7 @@ bool WinEDA_LibeditFrame::TestPins( EDA_LibComponentStruct* LibEntry )
PinList = (LibDrawPin**) MyZMalloc( (nb_pins + 1) * sizeof(LibDrawPin*) ); PinList = (LibDrawPin**) MyZMalloc( (nb_pins + 1) * sizeof(LibDrawPin*) );
Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*) CurrentLibEntry->m_Drawings;
for( ii = 0; Pin != NULL; Pin = (LibDrawPin*) Pin->Pnext ) for( ii = 0; Pin != NULL; Pin = Pin->Next() )
{ {
if( Pin->Type() == COMPONENT_PIN_DRAW_TYPE ) if( Pin->Type() == COMPONENT_PIN_DRAW_TYPE )
PinList[ii++] = Pin; PinList[ii++] = Pin;
...@@ -993,23 +995,29 @@ bool WinEDA_LibeditFrame::TestPins( EDA_LibComponentStruct* LibEntry ) ...@@ -993,23 +995,29 @@ bool WinEDA_LibeditFrame::TestPins( EDA_LibComponentStruct* LibEntry )
wxString aux_msg, StringPinNum; wxString aux_msg, StringPinNum;
LibDrawPin* curr_pin = PinList[ii]; LibDrawPin* curr_pin = PinList[ii];
Pin = PinList[ii - 1]; Pin = PinList[ii - 1];
if( Pin->m_PinNum != curr_pin->m_PinNum ) if( Pin->m_PinNum != curr_pin->m_PinNum )
continue; continue;
if( Pin->m_Convert != curr_pin->m_Convert ) if( Pin->m_Convert != curr_pin->m_Convert )
continue; continue;
if( Pin->m_Unit != curr_pin->m_Unit ) if( Pin->m_Unit != curr_pin->m_Unit )
continue; continue;
error++; error++;
curr_pin->ReturnPinStringNum( StringPinNum ); curr_pin->ReturnPinStringNum( StringPinNum );
msg.Printf( _( "Duplicate Pin %4.4s (Pin %s loc %d, %d, and Pin %s loc %d, %d)" ), msg.Printf( _( "Duplicate Pin %4.4s (Pin %s loc %d, %d, and Pin %s loc %d, %d)" ),
StringPinNum.GetData(), StringPinNum.GetData(),
curr_pin->m_PinName.GetData(), curr_pin->m_Pos.x, -curr_pin->m_Pos.y, curr_pin->m_PinName.GetData(), curr_pin->m_Pos.x, -curr_pin->m_Pos.y,
Pin->m_PinName.GetData(), Pin->m_Pos.x, -Pin->m_Pos.y ); Pin->m_PinName.GetData(), Pin->m_Pos.x, -Pin->m_Pos.y );
if( CurrentLibEntry->m_UnitCount > 1 ) if( CurrentLibEntry->m_UnitCount > 1 )
{ {
aux_msg.Printf( _( " Part %d" ), curr_pin->m_Unit ); aux_msg.Printf( _( " Part %d" ), curr_pin->m_Unit );
msg += aux_msg; msg += aux_msg;
} }
if( g_AsDeMorgan ) if( g_AsDeMorgan )
{ {
if( curr_pin->m_Convert ) if( curr_pin->m_Convert )
...@@ -1017,6 +1025,7 @@ bool WinEDA_LibeditFrame::TestPins( EDA_LibComponentStruct* LibEntry ) ...@@ -1017,6 +1025,7 @@ bool WinEDA_LibeditFrame::TestPins( EDA_LibComponentStruct* LibEntry )
else else
msg += _( " Normal" ); msg += _( " Normal" );
} }
DisplayError( this, msg ); DisplayError( this, msg );
} }
......
...@@ -434,7 +434,7 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem, ...@@ -434,7 +434,7 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
wxString Text; wxString Text;
Text = field->m_Text; Text = field->m_Text;
#if defined(KICAD_GOST) #if defined(KICAD_GOST)
Text.Append( '.' ); Text.Append( '.' );
Text.Append( '1' - 1 + DrawLibItem->m_Multi ); Text.Append( '1' - 1 + DrawLibItem->m_Multi );
#else #else
Text.Append( 'A' - 1 + DrawLibItem->m_Multi ); Text.Append( 'A' - 1 + DrawLibItem->m_Multi );
...@@ -772,20 +772,26 @@ void PlotSheetStruct( DrawSheetStruct* Struct ) ...@@ -772,20 +772,26 @@ void PlotSheetStruct( DrawSheetStruct* Struct )
Move_Plume( Struct->m_Pos, 'U' ); Move_Plume( Struct->m_Pos, 'U' );
pos = Struct->m_Pos; pos.x += Struct->m_Size.x; pos = Struct->m_Pos; pos.x += Struct->m_Size.x;
Move_Plume( pos, 'D' ); Move_Plume( pos, 'D' );
pos.y += Struct->m_Size.y; pos.y += Struct->m_Size.y;
Move_Plume( pos, 'D' ); Move_Plume( pos, 'D' );
pos = Struct->m_Pos; pos.y += Struct->m_Size.y; pos = Struct->m_Pos; pos.y += Struct->m_Size.y;
Move_Plume( pos, 'D' ); Move_Plume( pos, 'D' );
Move_Plume( Struct->m_Pos, 'D' ); Move_Plume( Struct->m_Pos, 'D' );
Plume( 'U' ); Plume( 'U' );
/* Trace des textes : SheetName */ /* Trace des textes : SheetName */
Text = Struct->m_SheetName; Text = Struct->m_SheetName;
size = wxSize( Struct->m_SheetNameSize, Struct->m_SheetNameSize ); size = wxSize( Struct->m_SheetNameSize, Struct->m_SheetNameSize );
pos = Struct->m_Pos; pos.y -= 4; pos = Struct->m_Pos; pos.y -= 4;
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
SetColorMapPS( ReturnLayerColor( LAYER_SHEETNAME ) ); SetColorMapPS( ReturnLayerColor( LAYER_SHEETNAME ) );
PlotGraphicText( g_PlotFormat, pos, txtcolor, PlotGraphicText( g_PlotFormat, pos, txtcolor,
Text, TEXT_ORIENT_HORIZ, size, Text, TEXT_ORIENT_HORIZ, size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM ); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM );
...@@ -793,8 +799,10 @@ void PlotSheetStruct( DrawSheetStruct* Struct ) ...@@ -793,8 +799,10 @@ void PlotSheetStruct( DrawSheetStruct* Struct )
/* Trace des textes : FileName */ /* Trace des textes : FileName */
Text = Struct->GetFileName(); Text = Struct->GetFileName();
size = wxSize( Struct->m_FileNameSize, Struct->m_FileNameSize ); size = wxSize( Struct->m_FileNameSize, Struct->m_FileNameSize );
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
SetColorMapPS( ReturnLayerColor( LAYER_SHEETFILENAME ) ); SetColorMapPS( ReturnLayerColor( LAYER_SHEETFILENAME ) );
PlotGraphicText( g_PlotFormat, PlotGraphicText( g_PlotFormat,
wxPoint( Struct->m_Pos.x, Struct->m_Pos.y + Struct->m_Size.y + 4 ), wxPoint( Struct->m_Pos.x, Struct->m_Pos.y + Struct->m_Size.y + 4 ),
txtcolor, txtcolor,
...@@ -805,9 +813,10 @@ void PlotSheetStruct( DrawSheetStruct* Struct ) ...@@ -805,9 +813,10 @@ void PlotSheetStruct( DrawSheetStruct* Struct )
SheetLabelStruct = Struct->m_Label; SheetLabelStruct = Struct->m_Label;
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
SetColorMapPS( ReturnLayerColor( Struct->m_Layer ) ); SetColorMapPS( ReturnLayerColor( Struct->m_Layer ) );
while( SheetLabelStruct != NULL ) while( SheetLabelStruct != NULL )
{ {
PlotSheetLabelStruct( SheetLabelStruct ); PlotSheetLabelStruct( SheetLabelStruct );
SheetLabelStruct = (Hierarchical_PIN_Sheet_Struct*) (SheetLabelStruct->Pnext); SheetLabelStruct = SheetLabelStruct->Next();
} }
} }
...@@ -572,7 +572,7 @@ void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll, int HPGL_She ...@@ -572,7 +572,7 @@ void WinEDA_PlotHPGLFrame::Plot_Schematic_HPGL( int Select_PlotAll, int HPGL_She
InitPlotParametresHPGL( PlotOffset, g_PlotScaleX, g_PlotScaleY ); InitPlotParametresHPGL( PlotOffset, g_PlotScaleX, g_PlotScaleY );
Plot_1_Page_HPGL( PlotFileName, screen ); Plot_1_Page_HPGL( PlotFileName, screen );
SetLocaleTo_Default( ); SetLocaleTo_Default( );
screen = (BASE_SCREEN*) screen->Pnext; screen = screen->Next();
if( Select_PlotAll == FALSE ) if( Select_PlotAll == FALSE )
break; break;
} }
...@@ -721,7 +721,7 @@ void WinEDA_PlotHPGLFrame::Plot_1_Page_HPGL( const wxString& FullFileName, ...@@ -721,7 +721,7 @@ void WinEDA_PlotHPGLFrame::Plot_1_Page_HPGL( const wxString& FullFileName,
} }
Plume( 'U' ); Plume( 'U' );
DrawList = DrawList->Pnext; DrawList = DrawList->Next();
} }
/* fin */ /* fin */
......
...@@ -401,7 +401,7 @@ void WinEDA_PlotPSFrame::CreatePSFile( int AllPages, int pagesize ) ...@@ -401,7 +401,7 @@ void WinEDA_PlotPSFrame::CreatePSFile( int AllPages, int pagesize )
PlotOneSheetPS( PlotFileName, screen, RealSheet, BBox, plot_offset ); PlotOneSheetPS( PlotFileName, screen, RealSheet, BBox, plot_offset );
screen = (BASE_SCREEN*) screen->Pnext; screen = screen->Next();
if( AllPages == FALSE ) if( AllPages == FALSE )
break; break;
......
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.
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.
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.
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.
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