Commit 7f453831 authored by charras's avatar charras

eeschema: code cleaning. SCH_ITEM class used for all schematic items in...

eeschema: code cleaning. SCH_ITEM class used for all schematic items in eeschema. Files reorganization.
parent 7bb6007a
...@@ -5,6 +5,13 @@ Started 2007-June-11 ...@@ -5,6 +5,13 @@ 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-Apr-14 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================
+eeschema
code cleaning. SCH_ITEM class used for all schematic items in eeschema.
Files reorganization.
2008-Apr-09 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr> 2008-Apr-09 UPDATE Jean-Pierre Charras <jean-pierre.charras@inpg.fr>
================================================================================ ================================================================================
+eeschema +eeschema
......
...@@ -6,6 +6,7 @@ set(COMMON_SRCS ...@@ -6,6 +6,7 @@ set(COMMON_SRCS
basicframe.cpp basicframe.cpp
bitmaps.cpp bitmaps.cpp
block_commande.cpp block_commande.cpp
class_drawpickedstruct.cpp
common.cpp common.cpp
common_plot_functions.cpp common_plot_functions.cpp
common_plotHPGL_functions.cpp common_plotHPGL_functions.cpp
......
...@@ -88,38 +88,6 @@ void EDA_BaseStruct::AddToChain( EDA_BaseStruct* laststruct ) ...@@ -88,38 +88,6 @@ void EDA_BaseStruct::AddToChain( EDA_BaseStruct* laststruct )
} }
/**************************************************************************************/
void EDA_BaseStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color )
/**************************************************************************************/
/* Virtual
*/
{
wxString msg, name;
msg.Printf( wxT(
"EDA_BaseStruct::Draw() error. Method for struct type %d used but not implemented (" ),
Type() );
msg += GetClass() + wxT( ")\n" );
printf( CONV_TO_UTF8( msg ) );
}
#if 0
/**************************************************************/
void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/**************************************************************/
/* fonction virtuelle de placement: non utilisee en pcbnew (utilisee eeschema)
* ---- A mieux utiliser (TODO...)
*/
{
}
#endif
// see base_struct.h // see base_struct.h
SEARCH_RESULT EDA_BaseStruct::IterateForward( EDA_BaseStruct* listStart, SEARCH_RESULT EDA_BaseStruct::IterateForward( EDA_BaseStruct* listStart,
...@@ -827,80 +795,3 @@ void EDA_Rect::Merge( const EDA_Rect& aRect ) ...@@ -827,80 +795,3 @@ void EDA_Rect::Merge( const EDA_Rect& aRect )
SetEnd( end ); SetEnd( end );
} }
/**************************/
/* class DrawPickedStruct */
/**************************/
/* This class has only one useful member: .m_PickedStruct, used as a link.
* It does not describe really an item.
* It is used to create a linked list of selected items (in block selection).
* Each DrawPickedStruct item has is member: .m_PickedStruct pointing the
* real selected item
*/
/*******************************************************************/
DrawPickedStruct::DrawPickedStruct( EDA_BaseStruct* pickedstruct ) :
SCH_ITEM( NULL, DRAW_PICK_ITEM_STRUCT_TYPE )
/*******************************************************************/
{
m_PickedStruct = pickedstruct;
}
DrawPickedStruct::~DrawPickedStruct()
{
}
#if defined(DEBUG)
void DrawPickedStruct::Show( int nestLevel, std::ostream& os )
{
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << "/>\n";
}
#endif
EDA_Rect DrawPickedStruct::GetBoundingBox()
{
if( m_PickedStruct )
return m_PickedStruct->GetBoundingBox();
else
{
return EDA_Rect(); // empty rectangle
}
}
EDA_Rect DrawPickedStruct::GetBoundingBoxUnion()
{
EDA_Rect ret;
DrawPickedStruct* cur = this;
EDA_BaseStruct* item;
while( cur && (item = cur->m_PickedStruct) != NULL )
{
ret.Merge( item->GetBoundingBox() );
cur = cur->Next();
}
return ret;
}
/*********************************************/
void DrawPickedStruct::DeleteWrapperList()
/*********************************************/
/* Delete this item all the items of the linked list
* Free the wrapper, but DOES NOT delete the picked items linked by .m_PickedStruct
*/
{
DrawPickedStruct* wrapp_struct, * next_struct;
for( wrapp_struct = Next(); wrapp_struct != NULL; wrapp_struct = next_struct )
{
next_struct = wrapp_struct->Next();
delete wrapp_struct;
}
}
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "gr_basic.h" #include "gr_basic.h"
#include "wxstruct.h" #include "wxstruct.h"
#include "common.h" #include "common.h"
#include "sch_item_struct.h"
#include "macros.h" #include "macros.h"
......
/****************************************************/
/* class_drawpickedstruct.cpp */
/****************************************************/
#include "fctsys.h"
#include "common.h"
#include "sch_item_struct.h"
/**************************/
/* class DrawPickedStruct */
/**************************/
/* This class has only one useful member: .m_PickedStruct, used as a link.
* It does not describe really an item.
* It is used to create a linked list of selected items (in block selection).
* Each DrawPickedStruct item has is member: .m_PickedStruct pointing the
* real selected item
*/
/*******************************************************************/
DrawPickedStruct::DrawPickedStruct( SCH_ITEM * pickedstruct ) :
SCH_ITEM( NULL, DRAW_PICK_ITEM_STRUCT_TYPE )
/*******************************************************************/
{
m_PickedStruct = pickedstruct;
}
DrawPickedStruct::~DrawPickedStruct()
{
}
#if defined(DEBUG)
void DrawPickedStruct::Show( int nestLevel, std::ostream& os )
{
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << "/>\n";
}
#endif
EDA_Rect DrawPickedStruct::GetBoundingBox()
{
if( m_PickedStruct )
return m_PickedStruct->GetBoundingBox();
else
{
return EDA_Rect(); // empty rectangle
}
}
EDA_Rect DrawPickedStruct::GetBoundingBoxUnion()
{
EDA_Rect ret;
DrawPickedStruct* cur = this;
SCH_ITEM* item;
while( cur && (item = cur->m_PickedStruct) != NULL )
{
ret.Merge( item->GetBoundingBox() );
cur = cur->Next();
}
return ret;
}
/*********************************************/
void DrawPickedStruct::DeleteWrapperList()
/*********************************************/
/* Delete this item all the items of the linked list
* Free the wrapper, but DOES NOT delete the picked items linked by .m_PickedStruct
*/
{
DrawPickedStruct* wrapp_struct, * next_struct;
for( wrapp_struct = Next(); wrapp_struct != NULL; wrapp_struct = next_struct )
{
next_struct = wrapp_struct->Next();
delete wrapp_struct;
}
}
...@@ -9,6 +9,7 @@ OBJECTS= \ ...@@ -9,6 +9,7 @@ OBJECTS= \
base_struct.o\ base_struct.o\
copy_to_clipboard.o\ copy_to_clipboard.o\
basicframe.o\ basicframe.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\
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
/***********************************************************/ /***********************************************************/
void DrawSheetStruct::Display_Infos( WinEDA_DrawFrame* frame ) void DrawSheetStruct::Display_Infos( WinEDA_DrawFrame* frame )
......
...@@ -9,8 +9,6 @@ ...@@ -9,8 +9,6 @@
#include "netlist.h" #include "netlist.h"
#include "protos.h" #include "protos.h"
#include "schframe.h"
/* Local Functions*/ /* Local Functions*/
static int ListeComposants( CmpListStruct* BaseListeCmp, static int ListeComposants( CmpListStruct* BaseListeCmp,
DrawSheetPath* sheet ); DrawSheetPath* sheet );
......
...@@ -28,8 +28,9 @@ ...@@ -28,8 +28,9 @@
#include "wx/wx.h" #include "wx/wx.h"
#endif #endif
#include "../include/wxstruct.h" #include "fctsys.h"
#include "schframe.h" #include "common.h"
#include "program.h"
#include "annotate_dialog.h" #include "annotate_dialog.h"
extern void DeleteAnnotation( WinEDA_SchematicFrame* parent, extern void DeleteAnnotation( WinEDA_SchematicFrame* parent,
......
...@@ -13,24 +13,23 @@ ...@@ -13,24 +13,23 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
/* Variables Locales */ /* Variables Locales */
/* Fonctions exportees */ /* Fonctions exportees */
/* Fonctions Locales */ /* Fonctions Locales */
static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* screen, static SCH_ITEM* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* screen,
EDA_BaseStruct* DrawStruct ); SCH_ITEM* DrawStruct );
static void CollectStructsToDrag( SCH_SCREEN* screen ); static void CollectStructsToDrag( SCH_SCREEN* screen );
static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ); static void AddPickedItem( SCH_SCREEN* screen, wxPoint position );
static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* DrawLibItem, static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* DrawLibItem,
wxPoint& position ); wxPoint& position );
static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static EDA_BaseStruct* SaveStructListForPaste( EDA_BaseStruct* DrawStruct ); static SCH_ITEM * SaveStructListForPaste( SCH_ITEM* DrawStruct );
static bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, static bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC,
EDA_BaseStruct* DrawStruct, wxPoint& Center ); SCH_ITEM * DrawStruct, wxPoint& Center );
static void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center ); static void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center );
/*************************************************************************/ /*************************************************************************/
int WinEDA_SchematicFrame::ReturnBlockCommand( int key ) int WinEDA_SchematicFrame::ReturnBlockCommand( int key )
...@@ -101,7 +100,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC ) ...@@ -101,7 +100,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
bool err = FALSE; bool err = FALSE;
DrawBlockStruct* block = &GetScreen()->BlockLocate; DrawBlockStruct* block = &GetScreen()->BlockLocate;
EDA_BaseStruct* NewStruct = NULL; SCH_ITEM * NewStruct = NULL;
if( DrawPanel->ManageCurseur == NULL ) if( DrawPanel->ManageCurseur == NULL )
{ {
...@@ -131,9 +130,9 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC ) ...@@ -131,9 +130,9 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
SaveCopyInUndoList( block->m_BlockDrawStruct, IS_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*)block->m_BlockDrawStruct, IS_CHANGED );
MoveStruct( DrawPanel, DC, block->m_BlockDrawStruct ); MoveStruct( DrawPanel, DC, (SCH_ITEM*)block->m_BlockDrawStruct );
block->m_BlockDrawStruct = NULL; block->m_BlockDrawStruct = NULL;
DrawPanel->Refresh( TRUE ); DrawPanel->Refresh( TRUE );
break; break;
...@@ -143,7 +142,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC ) ...@@ -143,7 +142,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
if( DrawPanel->ManageCurseur ) if( DrawPanel->ManageCurseur )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
NewStruct = CopyStruct( DrawPanel, DC, GetScreen(), block->m_BlockDrawStruct ); NewStruct = CopyStruct( DrawPanel, DC, GetScreen(), (SCH_ITEM*)block->m_BlockDrawStruct );
SaveCopyInUndoList( NewStruct, SaveCopyInUndoList( NewStruct,
(block->m_Command == BLOCK_PRESELECT_MOVE) ? IS_CHANGED : IS_NEW ); (block->m_Command == BLOCK_PRESELECT_MOVE) ? IS_CHANGED : IS_NEW );
...@@ -173,8 +172,8 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC ) ...@@ -173,8 +172,8 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
GetScreen()->SetModify(); GetScreen()->SetModify();
/* clear struct.m_Flags */ /* clear struct.m_Flags */
EDA_BaseStruct* Struct; SCH_ITEM* Struct;
for( Struct = GetScreen()->EEDrawList; Struct != NULL; Struct = Struct->Pnext ) for( Struct = GetScreen()->EEDrawList; Struct != NULL; Struct = Struct->Next() )
Struct->m_Flags = 0; Struct->m_Flags = 0;
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
...@@ -204,7 +203,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC ) ...@@ -204,7 +203,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
* retourne : * retourne :
* 0 si aucun composant selectionne * 0 si aucun composant selectionne
* 1 sinon * 1 sinon
* -1 si commande termin�e et composants trouv�s (block delete, block save) * -1 si commande terminee et composants trouves (block delete, block save)
*/ */
{ {
int ii = 0; int ii = 0;
...@@ -268,7 +267,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC ) ...@@ -268,7 +267,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
if( block->m_BlockDrawStruct != NULL ) if( block->m_BlockDrawStruct != NULL )
{ {
ii = -1; ii = -1;
DeleteStruct( DrawPanel, DC, block->m_BlockDrawStruct ); DeleteStruct( DrawPanel, DC, (SCH_ITEM*) block->m_BlockDrawStruct );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
block->m_BlockDrawStruct = NULL; block->m_BlockDrawStruct = NULL;
...@@ -284,8 +283,8 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC ) ...@@ -284,8 +283,8 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
{ {
wxPoint oldpos = GetScreen()->m_Curseur; wxPoint oldpos = GetScreen()->m_Curseur;
GetScreen()->m_Curseur = wxPoint( 0, 0 ); GetScreen()->m_Curseur = wxPoint( 0, 0 );
EDA_BaseStruct* DrawStructCopy = SCH_ITEM * DrawStructCopy =
SaveStructListForPaste( block->m_BlockDrawStruct ); SaveStructListForPaste( (SCH_ITEM*)block->m_BlockDrawStruct );
PlaceStruct( GetScreen(), DrawStructCopy ); PlaceStruct( GetScreen(), DrawStructCopy );
GetScreen()->m_Curseur = oldpos; GetScreen()->m_Curseur = oldpos;
ii = -1; ii = -1;
...@@ -402,7 +401,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -402,7 +401,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
if( block->m_BlockDrawStruct != NULL ) if( block->m_BlockDrawStruct != NULL )
{ {
ii = -1; ii = -1;
DeleteStruct( DrawPanel, DC, block->m_BlockDrawStruct ); DeleteStruct( DrawPanel, DC, (SCH_ITEM*) block->m_BlockDrawStruct );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
...@@ -415,8 +414,8 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -415,8 +414,8 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
{ {
wxPoint oldpos = GetScreen()->m_Curseur; wxPoint oldpos = GetScreen()->m_Curseur;
GetScreen()->m_Curseur = wxPoint( 0, 0 ); GetScreen()->m_Curseur = wxPoint( 0, 0 );
EDA_BaseStruct* DrawStructCopy = SCH_ITEM * DrawStructCopy =
SaveStructListForPaste( block->m_BlockDrawStruct ); SaveStructListForPaste( (SCH_ITEM*) block->m_BlockDrawStruct );
PlaceStruct( GetScreen(), DrawStructCopy ); PlaceStruct( GetScreen(), DrawStructCopy );
GetScreen()->m_Curseur = oldpos; GetScreen()->m_Curseur = oldpos;
ii = -1; ii = -1;
...@@ -439,13 +438,13 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC ) ...@@ -439,13 +438,13 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
if( block->m_BlockDrawStruct != NULL ) if( block->m_BlockDrawStruct != NULL )
{ {
SaveCopyInUndoList( block->m_BlockDrawStruct, IS_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*)block->m_BlockDrawStruct, IS_CHANGED );
ii = -1; ii = -1;
/* Compute the mirror centre and put it on grid */ /* Compute the mirror centre and put it on grid */
wxPoint Center = block->Centre(); wxPoint Center = block->Centre();
PutOnGrid( &Center ); PutOnGrid( &Center );
MirrorStruct( DrawPanel, DC, block->m_BlockDrawStruct, Center ); MirrorStruct( DrawPanel, DC, (SCH_ITEM*)block->m_BlockDrawStruct, Center );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
TestDanglingEnds( GetScreen()->EEDrawList, DC ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
...@@ -500,7 +499,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -500,7 +499,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
DrawStructsInGhost( panel, DrawStructsInGhost( panel,
DC, DC,
PickedList->m_PickedStruct, (SCH_ITEM*)PickedList->m_PickedStruct,
PtBlock->m_MoveVector.x, PtBlock->m_MoveVector.x,
PtBlock->m_MoveVector.y ); PtBlock->m_MoveVector.y );
PickedList = (DrawPickedStruct*) PickedList->Pnext; PickedList = (DrawPickedStruct*) PickedList->Pnext;
...@@ -509,7 +508,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -509,7 +508,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
else else
DrawStructsInGhost( panel, DrawStructsInGhost( panel,
DC, DC,
PtBlock->m_BlockDrawStruct, (SCH_ITEM*)PtBlock->m_BlockDrawStruct,
PtBlock->m_MoveVector.x, PtBlock->m_MoveVector.x,
PtBlock->m_MoveVector.y ); PtBlock->m_MoveVector.y );
} }
...@@ -533,7 +532,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -533,7 +532,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
DrawStructsInGhost( panel, DrawStructsInGhost( panel,
DC, DC,
PickedList->m_PickedStruct, (SCH_ITEM*)PickedList->m_PickedStruct,
PtBlock->m_MoveVector.x, PtBlock->m_MoveVector.x,
PtBlock->m_MoveVector.y ); PtBlock->m_MoveVector.y );
PickedList = (DrawPickedStruct*) PickedList->Pnext; PickedList = (DrawPickedStruct*) PickedList->Pnext;
...@@ -542,7 +541,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -542,7 +541,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
else else
DrawStructsInGhost( panel, DrawStructsInGhost( panel,
DC, DC,
PtBlock->m_BlockDrawStruct, (SCH_ITEM*)PtBlock->m_BlockDrawStruct,
PtBlock->m_MoveVector.x, PtBlock->m_MoveVector.x,
PtBlock->m_MoveVector.y ); PtBlock->m_MoveVector.y );
} }
...@@ -554,7 +553,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -554,7 +553,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
* If DrawStruct is of type DrawPickedStruct, a list of objects picked is * * If DrawStruct is of type DrawPickedStruct, a list of objects picked is *
* assumed, otherwise exactly one structure is assumed been picked. * * assumed, otherwise exactly one structure is assumed been picked. *
*****************************************************************************/ *****************************************************************************/
bool MoveStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct ) bool MoveStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM* DrawStruct )
{ {
if( !DrawStruct ) if( !DrawStruct )
return FALSE; return FALSE;
...@@ -595,7 +594,7 @@ static void MirrorYPoint( wxPoint& point, wxPoint& Center ) ...@@ -595,7 +594,7 @@ static void MirrorYPoint( wxPoint& point, wxPoint& Center )
/**************************************************************/ /**************************************************************/
void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center ) void MirrorOneStruct( SCH_ITEM * DrawStruct, wxPoint& Center )
/**************************************************************/ /**************************************************************/
/* Given a structure rotate it to 90 degrees refer to the Center point. /* Given a structure rotate it to 90 degrees refer to the Center point.
...@@ -753,7 +752,7 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center ) ...@@ -753,7 +752,7 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
* If DrawStruct is of type DrawPickedStruct, a list of objects picked is * * If DrawStruct is of type DrawPickedStruct, a list of objects picked is *
* assumed, otherwise exactly one structure is assumed been picked. * * assumed, otherwise exactly one structure is assumed been picked. *
*****************************************************************************/ *****************************************************************************/
bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct, wxPoint& Center ) bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM * DrawStruct, wxPoint& Center )
{ {
if( !DrawStruct ) if( !DrawStruct )
return FALSE; return FALSE;
...@@ -767,7 +766,7 @@ bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct ...@@ -767,7 +766,7 @@ bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
for( DrawPickedStruct* cur = pickedList; cur; cur=cur->Next() ) for( DrawPickedStruct* cur = pickedList; cur; cur=cur->Next() )
{ {
MirrorOneStruct( cur->m_PickedStruct, Center ); MirrorOneStruct( (SCH_ITEM*) cur->m_PickedStruct, Center );
cur->m_PickedStruct->m_Flags = 0; cur->m_PickedStruct->m_Flags = 0;
} }
...@@ -795,8 +794,8 @@ bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct ...@@ -795,8 +794,8 @@ bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
/*****************************************************************************/ /*****************************************************************************/
static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* screen, static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* screen,
EDA_BaseStruct* DrawStruct ) SCH_ITEM * DrawStruct )
/*****************************************************************************/ /*****************************************************************************/
/* Routine to copy a new entity of an object and reposition it. /* Routine to copy a new entity of an object and reposition it.
...@@ -805,7 +804,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE ...@@ -805,7 +804,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
* Return the new created struct * Return the new created struct
*/ */
{ {
EDA_BaseStruct* NewDrawStruct; SCH_ITEM * NewDrawStruct;
DrawPickedStruct* PickedList = NULL; DrawPickedStruct* PickedList = NULL;
if( !DrawStruct ) if( !DrawStruct )
...@@ -917,7 +916,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE ...@@ -917,7 +916,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
/*********************************************************************************/ /*********************************************************************************/
void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct ) void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, SCH_ITEM * DrawStruct )
/*********************************************************************************/ /*********************************************************************************/
/* Routine to delete an object from global drawing object list. /* Routine to delete an object from global drawing object list.
...@@ -934,7 +933,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct ...@@ -934,7 +933,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
{ {
/* Cette stucture est rattachee a une feuille, et n'est pas /* Cette stucture est rattachee a une feuille, et n'est pas
* accessible par la liste globale directement */ * accessible par la liste globale directement */
frame->SaveCopyInUndoList( ( (DrawSheetLabelStruct*) DrawStruct )->m_Parent, IS_CHANGED ); frame->SaveCopyInUndoList( (SCH_ITEM*) ( (DrawSheetLabelStruct*) DrawStruct )->m_Parent, IS_CHANGED );
frame->DeleteSheetLabel( DC, (DrawSheetLabelStruct*) DrawStruct ); frame->DeleteSheetLabel( DC, (DrawSheetLabelStruct*) DrawStruct );
return; return;
} }
...@@ -945,7 +944,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct ...@@ -945,7 +944,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
for( DrawPickedStruct* cur = (DrawPickedStruct*) DrawStruct; cur; cur=cur->Next() ) for( DrawPickedStruct* cur = (DrawPickedStruct*) DrawStruct; cur; cur=cur->Next() )
{ {
EDA_BaseStruct* item = cur->m_PickedStruct; SCH_ITEM * item = cur->m_PickedStruct;
screen->RemoveFromDrawList( item ); screen->RemoveFromDrawList( item );
panel->PostDirtyRect( item->GetBoundingBox() ); panel->PostDirtyRect( item->GetBoundingBox() );
item->Pnext = item->Pback = NULL; item->Pnext = item->Pback = NULL;
...@@ -978,7 +977,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct ...@@ -978,7 +977,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
/*****************************************************************/ /*****************************************************************/
EDA_BaseStruct* SaveStructListForPaste( EDA_BaseStruct* DrawStruct ) SCH_ITEM * SaveStructListForPaste( SCH_ITEM * DrawStruct )
/*****************************************************************/ /*****************************************************************/
/* Routine to Save an object from global drawing object list. /* Routine to Save an object from global drawing object list.
...@@ -988,7 +987,7 @@ EDA_BaseStruct* SaveStructListForPaste( EDA_BaseStruct* DrawStruct ) ...@@ -988,7 +987,7 @@ EDA_BaseStruct* SaveStructListForPaste( EDA_BaseStruct* DrawStruct )
*/ */
{ {
DrawPickedStruct* PickedList; DrawPickedStruct* PickedList;
EDA_BaseStruct* DrawStructCopy; SCH_ITEM * DrawStructCopy;
if( !DrawStruct ) if( !DrawStruct )
return NULL; return NULL;
...@@ -1028,7 +1027,7 @@ EDA_BaseStruct* SaveStructListForPaste( EDA_BaseStruct* DrawStruct ) ...@@ -1028,7 +1027,7 @@ EDA_BaseStruct* SaveStructListForPaste( EDA_BaseStruct* DrawStruct )
*****************************************************************************/ *****************************************************************************/
void WinEDA_SchematicFrame::PasteStruct( wxDC* DC ) void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
{ {
EDA_BaseStruct* DrawStruct; SCH_ITEM * DrawStruct;
DrawPickedStruct* PickedList = NULL; DrawPickedStruct* PickedList = NULL;
if( g_BlockSaveDataList == NULL ) if( g_BlockSaveDataList == NULL )
...@@ -1061,11 +1060,11 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC ) ...@@ -1061,11 +1060,11 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
RedrawStructList( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE ); RedrawStructList( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE );
for( PickedList = (DrawPickedStruct*) DrawStruct; PickedList != NULL; ) for( PickedList = (DrawPickedStruct*) DrawStruct; PickedList != NULL; )
{ {
EDA_BaseStruct* Struct = PickedList->m_PickedStruct; SCH_ITEM * Struct = PickedList->m_PickedStruct;
Struct->Pnext = GetScreen()->EEDrawList; Struct->Pnext = GetScreen()->EEDrawList;
SetStructFather( Struct, GetScreen() ); SetStructFather( Struct, GetScreen() );
GetScreen()->EEDrawList = Struct; GetScreen()->EEDrawList = Struct;
PickedList = (DrawPickedStruct*) PickedList->Pnext; PickedList = PickedList->Next();
} }
/* Save wrapper list in undo stack */ /* Save wrapper list in undo stack */
...@@ -1086,8 +1085,8 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC ) ...@@ -1086,8 +1085,8 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
} }
/* clear .m_Flags member for all items */ /* clear .m_Flags member for all items */
EDA_BaseStruct* Struct; SCH_ITEM * Struct;
for( Struct = GetScreen()->EEDrawList; Struct != NULL; Struct = Struct->Pnext ) for( Struct = GetScreen()->EEDrawList; Struct != NULL; Struct = Struct->Next() )
Struct->m_Flags = 0; Struct->m_Flags = 0;
GetScreen()->SetModify(); GetScreen()->SetModify();
...@@ -1099,7 +1098,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC ) ...@@ -1099,7 +1098,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
/***************************************************************************** /*****************************************************************************
* Routine to place a given object. * * Routine to place a given object. *
*****************************************************************************/ *****************************************************************************/
bool PlaceStruct( BASE_SCREEN* screen, EDA_BaseStruct* DrawStruct ) bool PlaceStruct( BASE_SCREEN* screen, SCH_ITEM * DrawStruct )
{ {
DrawPickedStruct* DrawStructs; DrawPickedStruct* DrawStructs;
wxPoint move_vector; wxPoint move_vector;
...@@ -1139,7 +1138,7 @@ bool PlaceStruct( BASE_SCREEN* screen, EDA_BaseStruct* DrawStruct ) ...@@ -1139,7 +1138,7 @@ bool PlaceStruct( BASE_SCREEN* screen, EDA_BaseStruct* DrawStruct )
while( DrawStructs ) while( DrawStructs )
{ {
MoveOneStruct( DrawStructs->m_PickedStruct, move_vector ); MoveOneStruct( DrawStructs->m_PickedStruct, move_vector );
DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext; DrawStructs = DrawStructs->Next();
} }
break; break;
...@@ -1150,7 +1149,7 @@ bool PlaceStruct( BASE_SCREEN* screen, EDA_BaseStruct* DrawStruct ) ...@@ -1150,7 +1149,7 @@ bool PlaceStruct( BASE_SCREEN* screen, EDA_BaseStruct* DrawStruct )
/**************************************************************************/ /**************************************************************************/
void MoveOneStruct( EDA_BaseStruct* DrawStruct, const wxPoint& move_vector ) void MoveOneStruct( SCH_ITEM * DrawStruct, const wxPoint& move_vector )
/*************************************************************************/ /*************************************************************************/
/* Given a structure move it by Dx, Dy. /* Given a structure move it by Dx, Dy.
...@@ -1271,14 +1270,14 @@ void MoveOneStruct( EDA_BaseStruct* DrawStruct, const wxPoint& move_vector ) ...@@ -1271,14 +1270,14 @@ void MoveOneStruct( EDA_BaseStruct* DrawStruct, const wxPoint& move_vector )
/************************************************************/ /************************************************************/
EDA_BaseStruct* DuplicateStruct( EDA_BaseStruct* DrawStruct ) SCH_ITEM * DuplicateStruct( SCH_ITEM * DrawStruct )
/************************************************************/ /************************************************************/
/* Routine to create a new copy of given struct. /* Routine to create a new copy of given struct.
* The new object is not put in draw list (not linked) * The new object is not put in draw list (not linked)
*/ */
{ {
EDA_BaseStruct* NewDrawStruct = NULL; SCH_ITEM * NewDrawStruct = NULL;
if( DrawStruct == NULL ) if( DrawStruct == NULL )
{ {
...@@ -1351,7 +1350,7 @@ EDA_BaseStruct* DuplicateStruct( EDA_BaseStruct* DrawStruct ) ...@@ -1351,7 +1350,7 @@ EDA_BaseStruct* DuplicateStruct( EDA_BaseStruct* DrawStruct )
LastPickedItem = NewPickedItem; LastPickedItem = NewPickedItem;
NewPickedItem->m_PickedStruct = NewPickedItem->m_PickedStruct =
DuplicateStruct( PickedList->m_PickedStruct ); DuplicateStruct( PickedList->m_PickedStruct );
PickedList = (DrawPickedStruct*) PickedList->Pnext; PickedList = PickedList->Next();
} }
break; break;
...@@ -1380,12 +1379,12 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -1380,12 +1379,12 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
/****************************************************/ /****************************************************/
{ {
DrawPickedStruct* DrawStructs, * FirstPicked; DrawPickedStruct* DrawStructs, * FirstPicked;
EDA_BaseStruct* Struct; SCH_ITEM * Struct;
EDA_DrawLineStruct* SegmStruct; EDA_DrawLineStruct* SegmStruct;
int ox, oy, fx, fy; int ox, oy, fx, fy;
/* Set membre .m_Flags des segments */ /* Set membre .m_Flags des segments */
for( Struct = screen->EEDrawList; Struct != NULL; Struct = Struct->Pnext ) for( Struct = screen->EEDrawList; Struct != NULL; Struct = Struct->Next() )
Struct->m_Flags = 0; Struct->m_Flags = 0;
if( screen->BlockLocate.m_BlockDrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( screen->BlockLocate.m_BlockDrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
...@@ -1397,7 +1396,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -1397,7 +1396,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
while( DrawStructs ) while( DrawStructs )
{ {
Struct = DrawStructs->m_PickedStruct; Struct = DrawStructs->m_PickedStruct;
DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext; DrawStructs = DrawStructs->Next();
Struct->m_Flags = SELECTED; Struct->m_Flags = SELECTED;
} }
} }
...@@ -1419,7 +1418,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -1419,7 +1418,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
* a qu'un seul element ( pour homogeneiser les traitements ulterieurs */ * a qu'un seul element ( pour homogeneiser les traitements ulterieurs */
if( screen->BlockLocate.m_BlockDrawStruct->Type() != DRAW_PICK_ITEM_STRUCT_TYPE ) if( screen->BlockLocate.m_BlockDrawStruct->Type() != DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
DrawStructs = new DrawPickedStruct( screen->BlockLocate.m_BlockDrawStruct ); DrawStructs = new DrawPickedStruct( (SCH_ITEM*) screen->BlockLocate.m_BlockDrawStruct );
screen->BlockLocate.m_BlockDrawStruct = DrawStructs; screen->BlockLocate.m_BlockDrawStruct = DrawStructs;
} }
...@@ -1429,7 +1428,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -1429,7 +1428,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
while( DrawStructs ) while( DrawStructs )
{ {
Struct = DrawStructs->m_PickedStruct; Struct = DrawStructs->m_PickedStruct;
DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext; DrawStructs = DrawStructs->Next();
if( Struct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( Struct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
{ {
SegmStruct = (EDA_DrawLineStruct*) Struct; SegmStruct = (EDA_DrawLineStruct*) Struct;
...@@ -1451,7 +1450,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen ) ...@@ -1451,7 +1450,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
while( DrawStructs ) while( DrawStructs )
{ {
Struct = DrawStructs->m_PickedStruct; Struct = DrawStructs->m_PickedStruct;
DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext; DrawStructs = DrawStructs->Next();
if( Struct->Type() == TYPE_SCH_COMPONENT ) if( Struct->Type() == TYPE_SCH_COMPONENT )
{ {
LibEDA_BaseStruct* DrawItem; LibEDA_BaseStruct* DrawItem;
...@@ -1492,7 +1491,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -1492,7 +1491,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
/******************************************************************/ /******************************************************************/
{ {
DrawPickedStruct* DrawStructs; DrawPickedStruct* DrawStructs;
EDA_BaseStruct* Struct; SCH_ITEM * Struct;
/* Examen de la liste des elements deja selectionnes */ /* Examen de la liste des elements deja selectionnes */
DrawStructs = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct; DrawStructs = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct;
...@@ -1649,7 +1648,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position ) ...@@ -1649,7 +1648,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
default: default:
break; break;
} }
Struct = Struct->Pnext; Struct = Struct->Next();
} }
} }
......
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
/* Routines Locales */ /* Routines Locales */
static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
...@@ -23,11 +21,11 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) ...@@ -23,11 +21,11 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
static bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos ); static bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos );
static void ComputeBreakPoint( EDA_DrawLineStruct* segment, const wxPoint& new_pos ); static void ComputeBreakPoint( EDA_DrawLineStruct* segment, const wxPoint& new_pos );
EDA_BaseStruct* s_OldWiresList; SCH_ITEM* s_OldWiresList;
wxPoint s_ConnexionStartPoint; wxPoint s_ConnexionStartPoint;
/*********************************************************/ /*********************************************************/
EDA_BaseStruct* SCH_SCREEN::ExtractWires( bool CreateCopy ) SCH_ITEM* SCH_SCREEN::ExtractWires( bool CreateCopy )
/*********************************************************/ /*********************************************************/
/* Extract the old wires, junctions and busses, an if CreateCopy replace them by a copy. /* Extract the old wires, junctions and busses, an if CreateCopy replace them by a copy.
...@@ -41,11 +39,11 @@ EDA_BaseStruct* SCH_SCREEN::ExtractWires( bool CreateCopy ) ...@@ -41,11 +39,11 @@ EDA_BaseStruct* SCH_SCREEN::ExtractWires( bool CreateCopy )
* and use a new copy of wires for cleanup * and use a new copy of wires for cleanup
*/ */
{ {
EDA_BaseStruct* item, * next_item, * new_item, * List = NULL; SCH_ITEM* item, * next_item, * new_item, * List = NULL;
for( item = EEDrawList; item != NULL; item = next_item ) for( item = EEDrawList; item != NULL; item = next_item )
{ {
next_item = item->Pnext; next_item = item->Next();
switch( item->Type() ) switch( item->Type() )
{ {
...@@ -81,11 +79,11 @@ static void RestoreOldWires( SCH_SCREEN* screen ) ...@@ -81,11 +79,11 @@ 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.
*/ */
{ {
EDA_BaseStruct* item, * next_item; SCH_ITEM* item, * next_item;
for( item = screen->EEDrawList; item != NULL; item = next_item ) for( item = screen->EEDrawList; item != NULL; item = next_item )
{ {
next_item = item->Pnext; next_item = item->Next();
switch( item->Type() ) switch( item->Type() )
{ {
...@@ -102,7 +100,7 @@ static void RestoreOldWires( SCH_SCREEN* screen ) ...@@ -102,7 +100,7 @@ static void RestoreOldWires( SCH_SCREEN* screen )
while( s_OldWiresList ) while( s_OldWiresList )
{ {
next_item = s_OldWiresList->Pnext; next_item = s_OldWiresList->Next();
s_OldWiresList->Pnext = screen->EEDrawList, s_OldWiresList->Pnext = screen->EEDrawList,
screen->EEDrawList = s_OldWiresList; screen->EEDrawList = s_OldWiresList;
s_OldWiresList = next_item; s_OldWiresList = next_item;
...@@ -194,7 +192,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type ) ...@@ -194,7 +192,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
/* Creation du segment suivant ou fin de trac� si point sur pin, jonction ...*/ /* Creation du segment suivant ou fin de trac� si point sur pin, jonction ...*/
if( IsTerminalPoint( (SCH_SCREEN*)GetScreen(), cursorpos, oldsegment->m_Layer ) ) if( IsTerminalPoint( (SCH_SCREEN*)GetScreen(), cursorpos, oldsegment->GetLayer() ) )
{ {
EndSegment( DC ); return; EndSegment( DC ); return;
} }
...@@ -379,7 +377,7 @@ static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -379,7 +377,7 @@ static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if( CurrentLine == NULL ) if( CurrentLine == NULL )
return; return;
color = ReturnLayerColor( CurrentLine->m_Layer ) ^ HIGHT_LIGHT_FLAG; color = ReturnLayerColor( CurrentLine->GetLayer() ) ^ HIGHT_LIGHT_FLAG;
if( erase ) if( erase )
{ {
...@@ -470,7 +468,7 @@ static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool eras ...@@ -470,7 +468,7 @@ static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool eras
wxPoint endpos; wxPoint endpos;
endpos = panel->m_Parent->GetScreen()->m_Curseur; endpos = panel->m_Parent->GetScreen()->m_Curseur;
color = ReturnLayerColor( NewPoly->m_Layer ); color = ReturnLayerColor( NewPoly->GetLayer() );
GRSetDrawMode( DC, g_XorMode ); GRSetDrawMode( DC, g_XorMode );
...@@ -521,7 +519,7 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC ) ...@@ -521,7 +519,7 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC )
Segment_in_Ghost( DrawPanel, DC, FALSE ); /* Effacement du trace en cours */ Segment_in_Ghost( DrawPanel, DC, FALSE ); /* Effacement du trace en cours */
} }
EraseStruct( GetScreen()->GetCurItem(), (SCH_SCREEN*)GetScreen() ); EraseStruct( (SCH_ITEM*) GetScreen()->GetCurItem(), (SCH_SCREEN*)GetScreen() );
DrawPanel->ManageCurseur = NULL; DrawPanel->ManageCurseur = NULL;
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
} }
...@@ -554,9 +552,9 @@ DrawJunctionStruct* WinEDA_SchematicFrame::CreateNewJunctionStruct( ...@@ -554,9 +552,9 @@ DrawJunctionStruct* WinEDA_SchematicFrame::CreateNewJunctionStruct(
} }
/**************************************************************************/ /*******************************************************************************/
EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewNoConnectStruct( wxDC* DC ) DrawNoConnectStruct* WinEDA_SchematicFrame::CreateNewNoConnectStruct( wxDC* DC )
/**************************************************************************/ /*******************************************************************************/
/*Routine to create new NoConnect struct. ( Symbole de Non Connexion) /*Routine to create new NoConnect struct. ( Symbole de Non Connexion)
*/ */
...@@ -592,7 +590,7 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -592,7 +590,7 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->ManageCurseur( Panel, DC, FALSE ); Panel->ManageCurseur( Panel, DC, FALSE );
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL; Panel->ForceCloseManageCurseur = NULL;
EraseStruct( Screen->GetCurItem(), (SCH_SCREEN*) Screen ); EraseStruct( (SCH_ITEM*) Screen->GetCurItem(), (SCH_SCREEN*) Screen );
Screen->SetCurItem( NULL ); Screen->SetCurItem( NULL );
RestoreOldWires( Screen ); RestoreOldWires( Screen );
} }
...@@ -600,11 +598,11 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -600,11 +598,11 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC )
g_ItemToRepeat = NULL; // Fin de commande generale g_ItemToRepeat = NULL; // Fin de commande generale
/* Clear m_Flags wich is used in edit functions: */ /* Clear m_Flags wich is used in edit functions: */
EDA_BaseStruct* item = Screen->EEDrawList; SCH_ITEM* item = Screen->EEDrawList;
while( item ) while( item )
{ {
item->m_Flags = 0; item->m_Flags = 0;
item = item->Pnext; item = item->Next();
} }
} }
...@@ -842,7 +840,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer ) ...@@ -842,7 +840,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
&& ( ( (SCH_GLOBALLABEL*) item )->m_Pos.y == pos.y ) ) && ( ( (SCH_GLOBALLABEL*) item )->m_Pos.y == pos.y ) )
return TRUE; return TRUE;
pinsheet = LocateAnyPinSheet( pos, screen ); pinsheet = LocateAnyPinSheet( pos, screen->EEDrawList );
if( pinsheet && !IsBusLabel( pinsheet->m_Text ) ) if( pinsheet && !IsBusLabel( pinsheet->m_Text ) )
{ {
itempos = pinsheet->m_Pos; itempos = pinsheet->m_Pos;
...@@ -880,7 +878,7 @@ bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos ) ...@@ -880,7 +878,7 @@ bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos )
{ {
if( PickStruct( pos, frame->GetScreen(), WIREITEM | WIRE_BUS_ENDPOINTS_ONLY ) ) if( PickStruct( pos, frame->GetScreen(), WIREITEM | WIRE_BUS_ENDPOINTS_ONLY ) )
return TRUE; return TRUE;
if( frame->LocatePinEnd( frame->GetScreen(), pos ) ) if( frame->LocatePinEnd( frame->GetScreen()->EEDrawList, pos ) )
return TRUE; return TRUE;
} }
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
/* Routines Locales */ /* Routines Locales */
/* Variables locales */ /* Variables locales */
......
...@@ -31,12 +31,11 @@ ...@@ -31,12 +31,11 @@
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "schframe.h"
/***********************************************************/ /***********************************************************/
DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) : DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
EDA_BaseStruct( DRAW_SHEET_STRUCT_TYPE ) SCH_ITEM( NULL, DRAW_SHEET_STRUCT_TYPE )
/***********************************************************/ /***********************************************************/
{ {
m_Label = NULL; m_Label = NULL;
...@@ -252,7 +251,7 @@ void DrawSheetStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) ...@@ -252,7 +251,7 @@ void DrawSheetStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
} }
} }
EDA_BaseStruct::Place( frame, DC ); //puts it on the EEDrawList. SCH_ITEM::Place( frame, DC ); //puts it on the EEDrawList.
} }
...@@ -674,12 +673,11 @@ bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame * aFrame, const wxSt ...@@ -674,12 +673,11 @@ bool DrawSheetStruct::ChangeFileName( WinEDA_SchematicFrame * aFrame, const wxSt
/*******************************************************************/ /*******************************************************************/
DrawSheetLabelStruct::DrawSheetLabelStruct( DrawSheetStruct* parent, DrawSheetLabelStruct::DrawSheetLabelStruct( DrawSheetStruct* parent,
const wxPoint& pos, const wxString& text ) : const wxPoint& pos, const wxString& text ) :
EDA_BaseStruct( DRAW_SHEETLABEL_STRUCT_TYPE ) SCH_ITEM( NULL, DRAW_SHEETLABEL_STRUCT_TYPE )
, EDA_TextStruct( text ) , EDA_TextStruct( text )
/*******************************************************************/ /*******************************************************************/
{ {
m_Layer = LAYER_SHEETLABEL; m_Layer = LAYER_SHEETLABEL;
m_Parent = parent;
m_Pos = pos; m_Pos = pos;
m_Edge = 0; m_Edge = 0;
m_Shape = NET_INPUT; m_Shape = NET_INPUT;
......
...@@ -14,11 +14,10 @@ ...@@ -14,11 +14,10 @@
extern DrawSheetStruct* g_RootSheet; extern DrawSheetStruct* g_RootSheet;
class DrawSheetLabelStruct : public EDA_BaseStruct, class DrawSheetLabelStruct : public SCH_ITEM,
public EDA_TextStruct public EDA_TextStruct
{ {
public: public:
int m_Layer;
int m_Edge, m_Shape; int m_Edge, m_Shape;
bool m_IsDangling; // TRUE non connected bool m_IsDangling; // TRUE non connected
...@@ -50,7 +49,7 @@ public: ...@@ -50,7 +49,7 @@ public:
*/ */
WX_DEFINE_ARRAY( DrawSheetStruct *, SheetGrowArray ); WX_DEFINE_ARRAY( DrawSheetStruct *, SheetGrowArray );
class DrawSheetStruct : public EDA_BaseStruct /*public SCH_SCREEN*/ /* Gestion de la hierarchie */ class DrawSheetStruct : public SCH_ITEM /*public SCH_SCREEN*/ /* Gestion de la hierarchie */
{ {
public: public:
wxString m_SheetName; //this is equivalent to C101 for components: wxString m_SheetName; //this is equivalent to C101 for components:
......
...@@ -8,7 +8,6 @@ ...@@ -8,7 +8,6 @@
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "schframe.h"
/******************************************************************/ /******************************************************************/
...@@ -43,7 +42,7 @@ void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen ) ...@@ -43,7 +42,7 @@ void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
/***************************************************************/ /***************************************************************/
void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) void SCH_ITEM::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/***************************************************************/ /***************************************************************/
/* place the struct in EEDrawList. /* place the struct in EEDrawList.
...@@ -113,12 +112,12 @@ void SCH_SCREEN::FreeDrawList() ...@@ -113,12 +112,12 @@ void SCH_SCREEN::FreeDrawList()
/* Routine to clear (free) EESchema drawing list of a screen. /* Routine to clear (free) EESchema drawing list of a screen.
*/ */
{ {
EDA_BaseStruct* DrawStruct; SCH_ITEM* DrawStruct;
while( EEDrawList != NULL ) while( EEDrawList != NULL )
{ {
DrawStruct = EEDrawList; DrawStruct = EEDrawList;
EEDrawList = EEDrawList->Pnext; EEDrawList = EEDrawList->Next();
SAFE_DELETE( DrawStruct ); SAFE_DELETE( DrawStruct );
} }
...@@ -127,7 +126,7 @@ void SCH_SCREEN::FreeDrawList() ...@@ -127,7 +126,7 @@ void SCH_SCREEN::FreeDrawList()
/**************************************************************/ /**************************************************************/
void SCH_SCREEN::RemoveFromDrawList( EDA_BaseStruct* DrawStruct ) void SCH_SCREEN::RemoveFromDrawList( SCH_ITEM * DrawStruct )
/**************************************************************/ /**************************************************************/
/* If found in EEDrawList, remove DrawStruct from EEDrawList. /* If found in EEDrawList, remove DrawStruct from EEDrawList.
...@@ -135,34 +134,34 @@ void SCH_SCREEN::RemoveFromDrawList( EDA_BaseStruct* DrawStruct ) ...@@ -135,34 +134,34 @@ void SCH_SCREEN::RemoveFromDrawList( EDA_BaseStruct* DrawStruct )
*/ */
{ {
if( DrawStruct == EEDrawList ) if( DrawStruct == EEDrawList )
EEDrawList = EEDrawList->Pnext; EEDrawList = EEDrawList->Next();
else else
{ {
EDA_BaseStruct* DrawList = EEDrawList; EDA_BaseStruct* DrawList = EEDrawList;
while( DrawList && DrawList->Pnext ) while( DrawList && DrawList->Next() )
{ {
if( DrawList->Pnext == DrawStruct ) if( DrawList->Pnext == DrawStruct )
{ {
DrawList->Pnext = DrawList->Pnext->Pnext; DrawList->Pnext = DrawList->Pnext->Pnext;
break; break;
} }
DrawList = DrawList->Pnext; DrawList = DrawList->Next();
} }
} }
} }
/**************************************************************/ /**************************************************************/
bool SCH_SCREEN::CheckIfOnDrawList( EDA_BaseStruct* st ) bool SCH_SCREEN::CheckIfOnDrawList( SCH_ITEM* st )
/**************************************************************/ /**************************************************************/
{ {
EDA_BaseStruct* DrawList = EEDrawList; SCH_ITEM * DrawList = EEDrawList;
while( DrawList ) while( DrawList )
{ {
if( DrawList == st ) if( DrawList == st )
return true; return true;
DrawList = DrawList->Pnext; DrawList = DrawList->Next();
} }
return false; return false;
...@@ -170,7 +169,7 @@ bool SCH_SCREEN::CheckIfOnDrawList( EDA_BaseStruct* st ) ...@@ -170,7 +169,7 @@ bool SCH_SCREEN::CheckIfOnDrawList( EDA_BaseStruct* st )
/**************************************************************/ /**************************************************************/
void SCH_SCREEN::AddToDrawList( EDA_BaseStruct* 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->Pnext = EEDrawList;
......
...@@ -35,13 +35,13 @@ public: ...@@ -35,13 +35,13 @@ public:
void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies) void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies)
void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { }; void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { };
void RemoveFromDrawList( EDA_BaseStruct* DrawStruct ); /* remove DrawStruct from EEDrawList. */ void RemoveFromDrawList( SCH_ITEM* DrawStruct ); /* remove DrawStruct from EEDrawList. */
bool CheckIfOnDrawList( EDA_BaseStruct* st ); bool CheckIfOnDrawList( SCH_ITEM* st );
void AddToDrawList( EDA_BaseStruct* DrawStruct ); void AddToDrawList( SCH_ITEM* DrawStruct );
void ClearUndoORRedoList( EDA_BaseStruct* List ); void ClearUndoORRedoList( EDA_BaseStruct* List );
bool SchematicCleanUp( wxDC* DC = NULL ); bool SchematicCleanUp( wxDC* DC = NULL );
EDA_BaseStruct* ExtractWires( bool CreateCopy ); SCH_ITEM* ExtractWires( bool CreateCopy );
/* full undo redo management : */ /* full undo redo management : */
virtual void ClearUndoRedoList(); virtual void ClearUndoRedoList();
......
...@@ -14,7 +14,6 @@ ...@@ -14,7 +14,6 @@
#include "id.h" #include "id.h"
#include "protos.h" #include "protos.h"
#include "schframe.h"
/************************/ /************************/
...@@ -113,7 +112,7 @@ void SCH_TEXT::Place( WinEDA_DrawFrame* frame, wxDC* DC ) ...@@ -113,7 +112,7 @@ void SCH_TEXT::Place( WinEDA_DrawFrame* frame, wxDC* DC )
SAFE_DELETE( g_ItemToUndoCopy ); SAFE_DELETE( g_ItemToUndoCopy );
} }
EDA_BaseStruct::Place( frame, DC ); SCH_ITEM::Place( frame, DC );
} }
......
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include "netlist.h" #include "netlist.h"
#include "macros.h" #include "macros.h"
#include "protos.h" #include "protos.h"
#include "schframe.h"
/* Routines locales */ /* Routines locales */
...@@ -30,16 +29,16 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC ) ...@@ -30,16 +29,16 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
* - Detecte les objets identiques superposes * - Detecte les objets identiques superposes
*/ */
{ {
EDA_BaseStruct* DrawList, * TstDrawList; SCH_ITEM* DrawList, * TstDrawList;
int flag; int flag;
bool Modify = FALSE; bool Modify = FALSE;
DrawList = EEDrawList; DrawList = EEDrawList;
for( ; DrawList != NULL; DrawList = DrawList->Pnext ) for( ; DrawList != NULL; DrawList = DrawList->Next() )
{ {
if( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE )
{ {
TstDrawList = DrawList->Pnext; TstDrawList = DrawList->Next();
while( TstDrawList ) while( TstDrawList )
{ {
if( TstDrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( TstDrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE )
...@@ -56,10 +55,10 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC ) ...@@ -56,10 +55,10 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
Modify = TRUE; Modify = TRUE;
} }
else else
TstDrawList = TstDrawList->Pnext; TstDrawList = TstDrawList->Next();
} }
else else
TstDrawList = TstDrawList->Pnext; TstDrawList = TstDrawList->Next();
} }
} }
} }
...@@ -77,7 +76,7 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen ) ...@@ -77,7 +76,7 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
* et les raccords * et les raccords
*/ */
{ {
EDA_BaseStruct* DrawList; SCH_ITEM* DrawList;
if( Screen == NULL ) if( Screen == NULL )
{ {
...@@ -120,7 +119,7 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen ) ...@@ -120,7 +119,7 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
default: default:
break; break;
} }
DrawList = DrawList->Pnext; DrawList = DrawList->Next();
} }
} }
...@@ -216,7 +215,7 @@ static int TstAlignSegment( EDA_DrawLineStruct* RefSegm, ...@@ -216,7 +215,7 @@ static int TstAlignSegment( EDA_DrawLineStruct* RefSegm,
{ {
if( RefSegm == TstSegm ) if( RefSegm == TstSegm )
return 0; return 0;
if( RefSegm->m_Layer != TstSegm->m_Layer ) if( RefSegm->GetLayer() != TstSegm->GetLayer() )
return 0; return 0;
// search for a common end, and modify coordinates to ensure RefSegm->m_End == TstSegm->m_Start // search for a common end, and modify coordinates to ensure RefSegm->m_End == TstSegm->m_Start
......
...@@ -16,7 +16,7 @@ ...@@ -16,7 +16,7 @@
/*******************************************************************/ /*******************************************************************/
DrawBusEntryStruct::DrawBusEntryStruct( const wxPoint& pos, int shape, int id ) : DrawBusEntryStruct::DrawBusEntryStruct( const wxPoint& pos, int shape, int id ) :
EDA_BaseStruct( DRAW_BUSENTRY_STRUCT_TYPE ) SCH_ITEM( NULL, DRAW_BUSENTRY_STRUCT_TYPE )
/*******************************************************************/ /*******************************************************************/
{ {
m_Pos = pos; m_Pos = pos;
...@@ -67,7 +67,7 @@ DrawBusEntryStruct* DrawBusEntryStruct::GenCopy() ...@@ -67,7 +67,7 @@ DrawBusEntryStruct* DrawBusEntryStruct::GenCopy()
/************************************************************/ /************************************************************/
DrawJunctionStruct::DrawJunctionStruct( const wxPoint& pos ) : DrawJunctionStruct::DrawJunctionStruct( const wxPoint& pos ) :
EDA_BaseStruct( DRAW_JUNCTION_STRUCT_TYPE ) SCH_ITEM( NULL, DRAW_JUNCTION_STRUCT_TYPE )
/************************************************************/ /************************************************************/
{ {
m_Pos = pos; m_Pos = pos;
...@@ -91,7 +91,7 @@ DrawJunctionStruct* DrawJunctionStruct::GenCopy() ...@@ -91,7 +91,7 @@ DrawJunctionStruct* DrawJunctionStruct::GenCopy()
/*****************************/ /*****************************/
DrawNoConnectStruct::DrawNoConnectStruct( const wxPoint& pos ) : DrawNoConnectStruct::DrawNoConnectStruct( const wxPoint& pos ) :
EDA_BaseStruct( DRAW_NOCONNECT_STRUCT_TYPE ) SCH_ITEM( NULL, DRAW_NOCONNECT_STRUCT_TYPE )
{ {
m_Pos = pos; m_Pos = pos;
} }
...@@ -112,7 +112,7 @@ DrawNoConnectStruct* DrawNoConnectStruct::GenCopy() ...@@ -112,7 +112,7 @@ DrawNoConnectStruct* DrawNoConnectStruct::GenCopy()
/**************************/ /**************************/
DrawMarkerStruct::DrawMarkerStruct( const wxPoint& pos, const wxString& text ) : DrawMarkerStruct::DrawMarkerStruct( const wxPoint& pos, const wxString& text ) :
EDA_BaseStruct( DRAW_MARKER_STRUCT_TYPE ) SCH_ITEM( NULL, DRAW_MARKER_STRUCT_TYPE )
{ {
m_Pos = pos; /* XY coordinates of marker. */ m_Pos = pos; /* XY coordinates of marker. */
m_Type = MARQ_UNSPEC; m_Type = MARQ_UNSPEC;
...@@ -165,7 +165,7 @@ void DrawMarkerStruct::Show( int nestLevel, std::ostream& os ) ...@@ -165,7 +165,7 @@ void DrawMarkerStruct::Show( int nestLevel, std::ostream& os )
/***************************/ /***************************/
EDA_DrawLineStruct::EDA_DrawLineStruct( const wxPoint& pos, int layer ) : EDA_DrawLineStruct::EDA_DrawLineStruct( const wxPoint& pos, int layer ) :
EDA_BaseStruct( NULL, DRAW_SEGMENT_STRUCT_TYPE ) SCH_ITEM( NULL, DRAW_SEGMENT_STRUCT_TYPE )
{ {
m_Start = pos; m_Start = pos;
m_End = pos; m_End = pos;
...@@ -294,7 +294,7 @@ EDA_Rect SCH_COMPONENT::GetBoundingBox() ...@@ -294,7 +294,7 @@ EDA_Rect SCH_COMPONENT::GetBoundingBox()
/***********************************************************/ /***********************************************************/
DrawPolylineStruct::DrawPolylineStruct( int layer ) : DrawPolylineStruct::DrawPolylineStruct( int layer ) :
EDA_BaseStruct( DRAW_POLYLINE_STRUCT_TYPE ) SCH_ITEM( NULL, DRAW_POLYLINE_STRUCT_TYPE )
/***********************************************************/ /***********************************************************/
{ {
m_NumOfPoints = 0; /* Number of XY pairs in Points array. */ m_NumOfPoints = 0; /* Number of XY pairs in Points array. */
......
...@@ -15,7 +15,6 @@ ...@@ -15,7 +15,6 @@
#include "protos.h" #include "protos.h"
#include "macros.h" #include "macros.h"
#include "schframe.h"
#include <wx/arrimpl.cpp> #include <wx/arrimpl.cpp>
...@@ -152,13 +151,11 @@ void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref ) ...@@ -152,13 +151,11 @@ void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref )
} }
if( notInArray ) if( notInArray )
{ AddHierarchicalReference(path, ref);
m_References.Add( ref );
m_Paths.Add( path );
}
if( m_Field[REFERENCE].m_Text.IsEmpty() if( m_Field[REFERENCE].m_Text.IsEmpty()
|| ( abs( m_Field[REFERENCE].m_Pos.x - m_Pos.x ) + || ( abs( m_Field[REFERENCE].m_Pos.x - m_Pos.x ) +
abs( m_Field[REFERENCE].m_Pos.y - m_Pos.y ) > 1000) ) abs( m_Field[REFERENCE].m_Pos.y - m_Pos.y ) > 10000) )
{ {
//move it to a reasonable position.. //move it to a reasonable position..
m_Field[REFERENCE].m_Pos = m_Pos; m_Field[REFERENCE].m_Pos = m_Pos;
...@@ -169,17 +166,9 @@ void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref ) ...@@ -169,17 +166,9 @@ void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref )
} }
/**************************************/ /******************************************************************/
void SCH_COMPONENT::ClearRefs()
/**************************************/
{
m_Paths.Empty();
m_References.Empty();
m_PartPerPackageSelections.Empty();
}
const wxString& SCH_COMPONENT::GetFieldValue( int aFieldNdx ) const const wxString& SCH_COMPONENT::GetFieldValue( int aFieldNdx ) const
/******************************************************************/
{ {
// avoid unnecessarily copying wxStrings. // avoid unnecessarily copying wxStrings.
static const wxString myEmpty = wxEmptyString; static const wxString myEmpty = wxEmptyString;
...@@ -216,13 +205,13 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos ) : ...@@ -216,13 +205,13 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos ) :
for( ii = 0; ii < NUMBER_OF_FIELDS; ii++ ) for( ii = 0; ii < NUMBER_OF_FIELDS; ii++ )
{ {
m_Field[ii].m_Pos = m_Pos; m_Field[ii].m_Pos = m_Pos;
m_Field[ii].m_Layer = LAYER_FIELDS; m_Field[ii].SetLayer(LAYER_FIELDS);
m_Field[ii].m_FieldId = REFERENCE + ii; m_Field[ii].m_FieldId = REFERENCE + ii;
m_Field[ii].m_Parent = this; m_Field[ii].m_Parent = this;
} }
m_Field[VALUE].m_Layer = LAYER_VALUEPART; m_Field[VALUE].SetLayer(LAYER_VALUEPART);
m_Field[REFERENCE].m_Layer = LAYER_REFERENCEPART; m_Field[REFERENCE].SetLayer(LAYER_REFERENCEPART);
m_PrefixString = wxString( _( "U" ) ); m_PrefixString = wxString( _( "U" ) );
} }
...@@ -347,7 +336,7 @@ void SCH_COMPONENT::Place( WinEDA_DrawFrame* frame, wxDC* DC ) ...@@ -347,7 +336,7 @@ void SCH_COMPONENT::Place( WinEDA_DrawFrame* frame, wxDC* DC )
SAFE_DELETE( g_ItemToUndoCopy ); SAFE_DELETE( g_ItemToUndoCopy );
} }
EDA_BaseStruct::Place( frame, DC ); SCH_ITEM::Place( frame, DC );
} }
...@@ -378,11 +367,6 @@ void SCH_COMPONENT::ClearAnnotation() ...@@ -378,11 +367,6 @@ void SCH_COMPONENT::ClearAnnotation()
if( !Entry || !Entry->m_UnitSelectionLocked ) if( !Entry || !Entry->m_UnitSelectionLocked )
{ {
m_Multi = 1; m_Multi = 1;
m_PartPerPackageSelections.Empty();
for( i = 0; i< m_Paths.GetCount(); i++ )
{
m_PartPerPackageSelections.Add( wxT( "1" ) );
}
} }
} }
...@@ -686,12 +670,13 @@ void SCH_COMPONENT::Show( int nestLevel, std::ostream& os ) ...@@ -686,12 +670,13 @@ void SCH_COMPONENT::Show( int nestLevel, std::ostream& os )
/***************************************************************************/ /***************************************************************************/
PartTextStruct::PartTextStruct( const wxPoint& pos, const wxString& text ) : PartTextStruct::PartTextStruct( const wxPoint& pos, const wxString& text ) :
EDA_BaseStruct( DRAW_PART_TEXT_STRUCT_TYPE ), SCH_ITEM( NULL, DRAW_PART_TEXT_STRUCT_TYPE ),
EDA_TextStruct( text ) EDA_TextStruct( text )
/***************************************************************************/ /***************************************************************************/
{ {
m_Pos = pos; m_Pos = pos;
m_FieldId = 0; m_FieldId = 0;
m_AddExtraText = false;
} }
......
...@@ -37,14 +37,14 @@ enum NumFieldType { ...@@ -37,14 +37,14 @@ enum NumFieldType {
* component fields are texts attached to the component (not the graphic texts) * component fields are texts attached to the component (not the graphic texts)
* There are 2 major fields : Reference and Value * There are 2 major fields : Reference and Value
*/ */
class PartTextStruct : public EDA_BaseStruct, class PartTextStruct : public SCH_ITEM,
public EDA_TextStruct public EDA_TextStruct
{ {
public: public:
int m_Layer; int m_FieldId; // Field indicator type (REFERENCE, VALUE or other id)
int m_FieldId;
wxString m_Name; /* Field name (ref, value,pcb, sheet, filed 1.. wxString m_Name; /* Field name (ref, value,pcb, sheet, filed 1..
* and for fields 1 to 8 the name is editable */ * and for fields 1 to 8 the name is editable */
bool m_AddExtraText; // Mainly for REFERENCE, add extar info (for REFERENCE: add part selection text
public: public:
PartTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString ); PartTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
...@@ -62,6 +62,14 @@ public: ...@@ -62,6 +62,14 @@ public:
EDA_Rect GetBoundaryBox() const; EDA_Rect GetBoundaryBox() const;
bool IsVoid(); bool IsVoid();
void SwapData( PartTextStruct* copyitem ); void SwapData( PartTextStruct* copyitem );
/**
* Function Draw
*/
void Draw( WinEDA_DrawPanel* panel,
wxDC* DC,
const wxPoint& offset,
int draw_mode,
int Color = -1 );
}; };
...@@ -92,7 +100,6 @@ public: ...@@ -92,7 +100,6 @@ public:
private: private:
wxArrayString m_Paths; // /sheet1/C102, /sh2/sh1/U32 etc. wxArrayString m_Paths; // /sheet1/C102, /sh2/sh1/U32 etc.
wxArrayString m_References; // C102, U32 etc. wxArrayString m_References; // C102, U32 etc.
wxArrayString m_PartPerPackageSelections; // "1", "2" etc. when a component has more than 1 partper package
public: public:
SCH_COMPONENT( const wxPoint& pos = wxPoint( 0, 0 ) ); SCH_COMPONENT( const wxPoint& pos = wxPoint( 0, 0 ) );
...@@ -136,6 +143,7 @@ public: ...@@ -136,6 +143,7 @@ public:
const wxPoint& offset, const wxPoint& offset,
int draw_mode, int draw_mode,
int Color = -1 ); int Color = -1 );
void SwapData( SCH_COMPONENT* copyitem ); void SwapData( SCH_COMPONENT* copyitem );
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC ); virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
...@@ -145,7 +153,6 @@ public: ...@@ -145,7 +153,6 @@ public:
wxString GetPath( DrawSheetPath* sheet ); wxString GetPath( DrawSheetPath* sheet );
const wxString GetRef( DrawSheetPath* sheet ); const wxString GetRef( DrawSheetPath* sheet );
void SetRef( DrawSheetPath* sheet, const wxString & ref ); void SetRef( DrawSheetPath* sheet, const wxString & ref );
void ClearRefs();
void AddHierarchicalReference(const wxString & path, const wxString & ref); void AddHierarchicalReference(const wxString & path, const wxString & ref);
int GetUnitSelection( DrawSheetPath* aSheet ); int GetUnitSelection( DrawSheetPath* aSheet );
void SetUnitSelection( DrawSheetPath* aSheet, int aUnitSelection ); void SetUnitSelection( DrawSheetPath* aSheet, int aUnitSelection );
......
...@@ -17,11 +17,8 @@ ...@@ -17,11 +17,8 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
/**************************************************************/ /**************************************************************/
EDA_BaseStruct* WinEDA_SchematicFrame:: SCH_ITEM * WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool IncludePin )
SchematicGeneralLocateAndDisplay( bool IncludePin )
/**************************************************************/ /**************************************************************/
/* Routine de localisation et d'affichage des caract (si utile ) /* Routine de localisation et d'affichage des caract (si utile )
...@@ -38,7 +35,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin ) ...@@ -38,7 +35,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
* Null sinon * Null sinon
*/ */
{ {
EDA_BaseStruct* DrawStruct; SCH_ITEM* DrawStruct;
wxString msg; wxString msg;
wxPoint mouse_position = GetScreen()->m_MousePosition; wxPoint mouse_position = GetScreen()->m_MousePosition;
LibDrawPin* Pin = NULL; LibDrawPin* Pin = NULL;
...@@ -96,8 +93,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin ) ...@@ -96,8 +93,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
/************************************************************************************/ /************************************************************************************/
EDA_BaseStruct* WinEDA_SchematicFrame:: SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
/************************************************************************************/ /************************************************************************************/
/* Find the schematic item at position "refpoint" /* Find the schematic item at position "refpoint"
...@@ -116,14 +112,14 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin ) ...@@ -116,14 +112,14 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
* For some items, caracteristics are displayed on the screen. * For some items, caracteristics are displayed on the screen.
*/ */
{ {
EDA_BaseStruct* DrawStruct; SCH_ITEM* DrawStruct;
LibDrawPin* Pin; LibDrawPin* Pin;
SCH_COMPONENT* LibItem; SCH_COMPONENT* LibItem;
wxString Text; wxString Text;
wxString msg; wxString msg;
int ii; int ii;
DrawStruct = PickStruct( refpoint, GetScreen(), MARKERITEM ); DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), MARKERITEM );
if( DrawStruct ) if( DrawStruct )
{ {
DrawMarkerStruct* Marker = (DrawMarkerStruct*) DrawStruct; DrawMarkerStruct* Marker = (DrawMarkerStruct*) DrawStruct;
...@@ -136,27 +132,24 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin ) ...@@ -136,27 +132,24 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
return DrawStruct; return DrawStruct;
} }
DrawStruct = PickStruct( refpoint, GetScreen(), DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), NOCONNECTITEM );
NOCONNECTITEM );
if( DrawStruct ) if( DrawStruct )
{ {
MsgPanel->EraseMsgBox(); MsgPanel->EraseMsgBox();
return DrawStruct; return DrawStruct;
} }
DrawStruct = PickStruct( refpoint, GetScreen(), DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), JUNCTIONITEM );
JUNCTIONITEM );
if( DrawStruct ) if( DrawStruct )
{ {
MsgPanel->EraseMsgBox(); MsgPanel->EraseMsgBox();
return DrawStruct; return DrawStruct;
} }
DrawStruct = PickStruct( refpoint, GetScreen(), DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), WIREITEM | BUSITEM | RACCORDITEM );
WIREITEM | BUSITEM | RACCORDITEM );
if( DrawStruct ) // Search for a pin if( DrawStruct ) // Search for a pin
{ {
Pin = LocateAnyPin( m_CurrentSheet->LastDrawList(), refpoint, &LibItem ); Pin = LocateAnyPin( (SCH_ITEM*) m_CurrentSheet->LastDrawList(), refpoint, &LibItem );
if( Pin ) if( Pin )
{ {
Pin->Display_Infos( this ); Pin->Display_Infos( this );
...@@ -171,7 +164,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin ) ...@@ -171,7 +164,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
return DrawStruct; return DrawStruct;
} }
DrawStruct = PickStruct( refpoint, GetScreen(), FIELDCMPITEM ); DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), FIELDCMPITEM );
if( DrawStruct ) if( DrawStruct )
{ {
PartTextStruct* Field = (PartTextStruct*) DrawStruct; PartTextStruct* Field = (PartTextStruct*) DrawStruct;
...@@ -182,7 +175,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin ) ...@@ -182,7 +175,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
} }
/* search for a pin */ /* search for a pin */
Pin = LocateAnyPin( m_CurrentSheet->LastDrawList(), refpoint, &LibItem ); Pin = LocateAnyPin( (SCH_ITEM*) m_CurrentSheet->LastDrawList(), refpoint, &LibItem );
if( Pin ) if( Pin )
{ {
Pin->Display_Infos( this ); Pin->Display_Infos( this );
...@@ -195,7 +188,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin ) ...@@ -195,7 +188,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
return LibItem; return LibItem;
} }
DrawStruct = PickStruct( refpoint, GetScreen(), LIBITEM ); DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), LIBITEM );
if( DrawStruct ) if( DrawStruct )
{ {
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() ); DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
...@@ -204,8 +197,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin ) ...@@ -204,8 +197,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
return DrawStruct; return DrawStruct;
} }
DrawStruct = PickStruct( refpoint, GetScreen(), DrawStruct = (SCH_ITEM*)PickStruct( refpoint, GetScreen(), SHEETITEM );
SHEETITEM );
if( DrawStruct ) if( DrawStruct )
{ {
( (DrawSheetStruct*) DrawStruct )->Display_Infos( this ); ( (DrawSheetStruct*) DrawStruct )->Display_Infos( this );
...@@ -213,8 +205,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin ) ...@@ -213,8 +205,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
} }
// Recherche des autres elements // Recherche des autres elements
DrawStruct = PickStruct( refpoint, GetScreen(), DrawStruct = (SCH_ITEM*)PickStruct( refpoint, GetScreen(), SEARCHALL );
SEARCHALL );
if( DrawStruct ) if( DrawStruct )
{ {
return DrawStruct; return DrawStruct;
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
/***************************************************************/ /***************************************************************/
void RemoteCommand( const char* cmdline ) void RemoteCommand( const char* cmdline )
......
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
#include "netlist.h" /* Definitions generales liees au calcul de netliste */ #include "netlist.h" /* Definitions generales liees au calcul de netliste */
#include "protos.h" #include "protos.h"
#include "schframe.h"
enum End_Type { enum End_Type {
UNKNOWN = 0, UNKNOWN = 0,
...@@ -88,7 +86,7 @@ bool SegmentIntersect( int Sx1, int Sy1, int Sx2, int Sy2, ...@@ -88,7 +86,7 @@ bool SegmentIntersect( int Sx1, int Sy1, int Sx2, int Sy2,
/******************************************************************************/ /******************************************************************************/
void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC ) void WinEDA_SchematicFrame::TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC )
/******************************************************************************/ /******************************************************************************/
/* Met a jour les membres m_Dangling des wires, bus, labels /* Met a jour les membres m_Dangling des wires, bus, labels
...@@ -107,7 +105,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC ...@@ -107,7 +105,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC
ItemList = RebuildEndList( DrawList ); ItemList = RebuildEndList( DrawList );
// Controle des elements // Controle des elements
for( DrawItem = DrawList; DrawItem != NULL; DrawItem = DrawItem->Pnext ) for( DrawItem = DrawList; DrawItem != NULL; DrawItem = DrawItem->Next() )
{ {
switch( DrawItem->Type() ) switch( DrawItem->Type() )
{ {
...@@ -123,14 +121,14 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC ...@@ -123,14 +121,14 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (EDA_DrawLineStruct*) DrawItem ) #define STRUCT ( (EDA_DrawLineStruct*) DrawItem )
if( STRUCT->m_Layer == LAYER_WIRE ) if( STRUCT->GetLayer() == LAYER_WIRE )
{ {
TestWireForDangling( STRUCT, this, DC ); TestWireForDangling( STRUCT, this, DC );
break; break;
} }
if( STRUCT->m_Layer == LAYER_NOTES ) if( STRUCT->GetLayer() == LAYER_NOTES )
break; break;
if( STRUCT->m_Layer == LAYER_BUS ) if( STRUCT->GetLayer() == LAYER_BUS )
{ {
STRUCT->m_StartIsDangling = STRUCT->m_StartIsDangling =
STRUCT->m_EndIsDangling = FALSE; STRUCT->m_EndIsDangling = FALSE;
...@@ -145,14 +143,13 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC ...@@ -145,14 +143,13 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC
} }
/********************************************************************/ /************************************************************************************************/
LibDrawPin* WinEDA_SchematicFrame::LocatePinEnd( EDA_BaseStruct* DrawList, LibDrawPin* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList, const wxPoint& pos )
const wxPoint& pos ) /************************************************************************************************/
/********************************************************************/
/* Teste si le point de coordonn�es pos est sur l'extr�mit� d'une PIN /** Teste if point pos is on a pin end
* retourne un pointeur sur la pin * @return un pointer on the pin or NULL
* NULL sinon * @param DrawList = list of SCH_ITEMs
*/ */
{ {
SCH_COMPONENT* DrawLibItem; SCH_COMPONENT* DrawLibItem;
...@@ -337,11 +334,11 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ) ...@@ -337,11 +334,11 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (EDA_DrawLineStruct*) DrawItem ) #define STRUCT ( (EDA_DrawLineStruct*) DrawItem )
if( STRUCT->m_Layer == LAYER_NOTES ) if( STRUCT->GetLayer() == LAYER_NOTES )
break; break;
if( (STRUCT->m_Layer == LAYER_BUS) || (STRUCT->m_Layer == LAYER_WIRE) ) if( (STRUCT->GetLayer() == LAYER_BUS) || (STRUCT->GetLayer() == LAYER_WIRE) )
{ {
item = new DanglingEndHandle( (STRUCT->m_Layer == LAYER_BUS) ? item = new DanglingEndHandle( (STRUCT->GetLayer() == LAYER_BUS) ?
BUS_START_END : WIRE_START_END ); BUS_START_END : WIRE_START_END );
item->m_Item = DrawItem; item->m_Item = DrawItem;
...@@ -351,7 +348,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList ) ...@@ -351,7 +348,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
else else
StartList = item; StartList = item;
lastitem = item; lastitem = item;
item = new DanglingEndHandle( (STRUCT->m_Layer == LAYER_BUS) ? item = new DanglingEndHandle( (STRUCT->GetLayer() == LAYER_BUS) ?
BUS_END_END : WIRE_END_END ); BUS_END_END : WIRE_END_END );
item->m_Item = DrawItem; item->m_Item = DrawItem;
......
...@@ -13,12 +13,10 @@ ...@@ -13,12 +13,10 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
/********************************************************************************/ /********************************************************************************/
static int CountConnectedItems( WinEDA_SchematicFrame* frame, static int CountConnectedItems( WinEDA_SchematicFrame* frame,
EDA_BaseStruct* ListStruct, wxPoint pos, bool TstJunction ) SCH_ITEM* ListStruct, wxPoint pos, bool TstJunction )
/********************************************************************************/ /********************************************************************************/
/* Count number of items connected to point pos : /* Count number of items connected to point pos :
...@@ -28,13 +26,13 @@ static int CountConnectedItems( WinEDA_SchematicFrame* frame, ...@@ -28,13 +26,13 @@ static int CountConnectedItems( WinEDA_SchematicFrame* frame,
* Used by WinEDA_SchematicFrame::DeleteConnection() * Used by WinEDA_SchematicFrame::DeleteConnection()
*/ */
{ {
EDA_BaseStruct* Struct; SCH_ITEM* Struct;
int count = 0; int count = 0;
if( frame->LocatePinEnd( ListStruct, pos ) ) if( frame->LocatePinEnd( ListStruct, pos ) )
count++; count++;
for( Struct = ListStruct; Struct != NULL; Struct = Struct->Pnext ) for( Struct = ListStruct; Struct != NULL; Struct = Struct->Next() )
{ {
if( Struct->m_Flags & STRUCT_DELETED ) if( Struct->m_Flags & STRUCT_DELETED )
continue; continue;
...@@ -64,7 +62,7 @@ static int CountConnectedItems( WinEDA_SchematicFrame* frame, ...@@ -64,7 +62,7 @@ static int CountConnectedItems( WinEDA_SchematicFrame* frame,
/************************************************************************************/ /************************************************************************************/
static bool MarkConnected( WinEDA_SchematicFrame* frame, EDA_BaseStruct* ListStruct, static bool MarkConnected( WinEDA_SchematicFrame* frame, SCH_ITEM* ListStruct,
EDA_DrawLineStruct* segment ) EDA_DrawLineStruct* segment )
/************************************************************************************/ /************************************************************************************/
...@@ -76,7 +74,7 @@ static bool MarkConnected( WinEDA_SchematicFrame* frame, EDA_BaseStruct* ListStr ...@@ -76,7 +74,7 @@ static bool MarkConnected( WinEDA_SchematicFrame* frame, EDA_BaseStruct* ListStr
{ {
EDA_BaseStruct* Struct; EDA_BaseStruct* Struct;
for( Struct = ListStruct; Struct != NULL; Struct = Struct->Pnext ) for( Struct = ListStruct; Struct != NULL; Struct = Struct->Next() )
{ {
if( Struct->m_Flags ) if( Struct->m_Flags )
continue; continue;
...@@ -125,11 +123,11 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio ...@@ -125,11 +123,11 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
*/ */
{ {
wxPoint refpos = GetScreen()->m_Curseur; wxPoint refpos = GetScreen()->m_Curseur;
EDA_BaseStruct* DelStruct; SCH_ITEM* DelStruct;
DrawPickedStruct* PickedItem, * PickedList = NULL; DrawPickedStruct* PickedItem, * PickedList = NULL;
/* Clear .m_Flags member for all items */ /* Clear .m_Flags member for all items */
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Pnext ) for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Next() )
DelStruct->m_Flags = 0; DelStruct->m_Flags = 0;
BreakSegmentOnJunction( (SCH_SCREEN*) GetScreen() ); BreakSegmentOnJunction( (SCH_SCREEN*) GetScreen() );
...@@ -139,7 +137,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio ...@@ -139,7 +137,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
* of items to delete * of items to delete
*/ */
SCH_SCREEN* screen = (SCH_SCREEN*) GetScreen(); SCH_SCREEN* screen = (SCH_SCREEN*) GetScreen();
EDA_BaseStruct* savedEEDrawList = screen->EEDrawList; SCH_ITEM* savedEEDrawList = screen->EEDrawList;
while( DelStruct while( DelStruct
&& ( DelStruct = PickStruct( screen->m_Curseur, && ( DelStruct = PickStruct( screen->m_Curseur,
screen, JUNCTIONITEM | WIREITEM | BUSITEM ) ) != NULL ) screen, JUNCTIONITEM | WIREITEM | BUSITEM ) ) != NULL )
...@@ -151,7 +149,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio ...@@ -151,7 +149,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
PickedItem->Pnext = PickedList; PickedItem->Pnext = PickedList;
PickedList = PickedItem; PickedList = PickedItem;
DelStruct = DelStruct->Pnext; DelStruct = DelStruct->Next();
screen->EEDrawList = DelStruct; screen->EEDrawList = DelStruct;
} }
...@@ -161,7 +159,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio ...@@ -161,7 +159,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
*/ */
if( DeleteFullConnection ) if( DeleteFullConnection )
{ {
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Pnext ) for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Next() )
{ {
if( !(DelStruct->m_Flags & SELECTEDNODE) ) if( !(DelStruct->m_Flags & SELECTEDNODE) )
continue; continue;
...@@ -175,7 +173,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio ...@@ -175,7 +173,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
} }
// Search all removable wires (i.e wire with one new dangling end ) // Search all removable wires (i.e wire with one new dangling end )
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Pnext ) for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Next() )
{ {
bool noconnect = FALSE; bool noconnect = FALSE;
...@@ -246,7 +244,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio ...@@ -246,7 +244,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
} }
// Delete redundant junctions (junctions which connect < 3 end wires and no pin are removed) // Delete redundant junctions (junctions which connect < 3 end wires and no pin are removed)
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Pnext ) for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Next() )
{ {
int count; int count;
if( DelStruct->m_Flags & STRUCT_DELETED ) if( DelStruct->m_Flags & STRUCT_DELETED )
...@@ -275,7 +273,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio ...@@ -275,7 +273,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
// Delete labels attached to wires // Delete labels attached to wires
wxPoint pos = GetScreen()->m_Curseur; wxPoint pos = GetScreen()->m_Curseur;
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Pnext ) for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Next() )
{ {
if( DelStruct->m_Flags & STRUCT_DELETED ) if( DelStruct->m_Flags & STRUCT_DELETED )
continue; continue;
...@@ -302,7 +300,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio ...@@ -302,7 +300,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
GetScreen()->m_Curseur = pos; GetScreen()->m_Curseur = pos;
} }
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Pnext ) for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Next() )
DelStruct->m_Flags = 0; DelStruct->m_Flags = 0;
if( PickedList ) if( PickedList )
...@@ -331,7 +329,7 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC ) ...@@ -331,7 +329,7 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC )
* return TRUE if an item was deleted * return TRUE if an item was deleted
*/ */
{ {
EDA_BaseStruct* DelStruct; SCH_ITEM* DelStruct;
SCH_SCREEN* screen = (SCH_SCREEN*) ( frame->GetScreen() ); SCH_SCREEN* screen = (SCH_SCREEN*) ( frame->GetScreen() );
bool item_deleted = FALSE; bool item_deleted = FALSE;
...@@ -367,7 +365,7 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC ) ...@@ -367,7 +365,7 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC )
/***************************************************************/ /***************************************************************/
void EraseStruct( EDA_BaseStruct* DrawStruct, SCH_SCREEN* Screen ) void EraseStruct( SCH_ITEM* DrawStruct, SCH_SCREEN* Screen )
/***************************************************************/ /***************************************************************/
/* Suppression definitive d'une structure dans une liste chainee /* Suppression definitive d'une structure dans une liste chainee
...@@ -444,7 +442,7 @@ void EraseStruct( EDA_BaseStruct* DrawStruct, SCH_SCREEN* Screen ) ...@@ -444,7 +442,7 @@ void EraseStruct( EDA_BaseStruct* DrawStruct, SCH_SCREEN* Screen )
{ {
if( PickedList->m_PickedStruct == Screen->EEDrawList ) if( PickedList->m_PickedStruct == Screen->EEDrawList )
{ {
Screen->EEDrawList = Screen->EEDrawList->Pnext; Screen->EEDrawList = Screen->EEDrawList->Next();
SAFE_DELETE( DrawStruct ); SAFE_DELETE( DrawStruct );
} }
else else
...@@ -468,7 +466,7 @@ void EraseStruct( EDA_BaseStruct* DrawStruct, SCH_SCREEN* Screen ) ...@@ -468,7 +466,7 @@ void EraseStruct( EDA_BaseStruct* DrawStruct, SCH_SCREEN* Screen )
{ {
if( DrawStruct == Screen->EEDrawList ) if( DrawStruct == Screen->EEDrawList )
{ {
Screen->EEDrawList = DrawStruct->Pnext; Screen->EEDrawList = DrawStruct->Next();
SAFE_DELETE( DrawStruct ); SAFE_DELETE( DrawStruct );
} }
else else
...@@ -495,7 +493,7 @@ void DeleteAllMarkers( int type ) ...@@ -495,7 +493,7 @@ void DeleteAllMarkers( int type )
/* Effacement des marqueurs du type "type" */ /* Effacement des marqueurs du type "type" */
{ {
SCH_SCREEN* screen; SCH_SCREEN* screen;
EDA_BaseStruct* DrawStruct, * NextStruct; SCH_ITEM * DrawStruct, * NextStruct;
DrawMarkerStruct* Marker; DrawMarkerStruct* Marker;
EDA_ScreenList ScreenList; EDA_ScreenList ScreenList;
...@@ -504,7 +502,7 @@ void DeleteAllMarkers( int type ) ...@@ -504,7 +502,7 @@ void DeleteAllMarkers( int type )
{ {
for( DrawStruct = screen->EEDrawList; DrawStruct != NULL; DrawStruct = NextStruct ) for( DrawStruct = screen->EEDrawList; DrawStruct != NULL; DrawStruct = NextStruct )
{ {
NextStruct = DrawStruct->Pnext; NextStruct = DrawStruct->Next();
if( DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE ) if( DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE )
continue; continue;
......
...@@ -11,7 +11,6 @@ ...@@ -11,7 +11,6 @@
#include "general.h" #include "general.h"
#include "protos.h" #include "protos.h"
#include "schframe.h"
/**************************************************************************/ /**************************************************************************/
......
...@@ -40,8 +40,6 @@ ...@@ -40,8 +40,6 @@
#include "id.h" #include "id.h"
#include "schframe.h"
#include "dialog_eeschema_config.h" #include "dialog_eeschema_config.h"
////@begin XPM images ////@begin XPM images
......
...@@ -37,7 +37,6 @@ ...@@ -37,7 +37,6 @@
#include "netlist.h" #include "netlist.h"
#include "protos.h" #include "protos.h"
#include "schframe.h"
#include "dialog_erc.h" #include "dialog_erc.h"
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
/* Fonctions exportees */ /* Fonctions exportees */
...@@ -557,7 +555,8 @@ void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC ) ...@@ -557,7 +555,8 @@ void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC )
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->m_IgnoreMouseEvents = FALSE; DrawPanel->m_IgnoreMouseEvents = FALSE;
DrawTextField( DrawPanel, DC, Field, flag, g_XorMode ); Field->m_AddExtraText = flag;
Field->Draw( DrawPanel, DC, wxPoint(0,0), g_XorMode );
if( !newtext.IsEmpty() ) if( !newtext.IsEmpty() )
{ {
...@@ -587,7 +586,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC ) ...@@ -587,7 +586,7 @@ void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC )
} }
} }
DrawTextField( DrawPanel, DC, Field, flag, g_XorMode ); Field->Draw( DrawPanel, DC, wxPoint(0,0), g_XorMode );
Cmp->Display_Infos( this ); Cmp->Display_Infos( this );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
...@@ -612,8 +611,11 @@ static void MoveCmpField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -612,8 +611,11 @@ static void MoveCmpField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
FieldNumber = CurrentField->m_FieldId; FieldNumber = CurrentField->m_FieldId;
/* Effacement: */ /* Effacement: */
CurrentField->m_AddExtraText = Multiflag;
if( erase ) if( erase )
DrawTextField( panel, DC, CurrentField, Multiflag, g_XorMode ); {
CurrentField->Draw( panel, DC, wxPoint(0,0), g_XorMode );
}
pos = ( (SCH_COMPONENT*) CurrentField->m_Parent )->m_Pos; pos = ( (SCH_COMPONENT*) CurrentField->m_Parent )->m_Pos;
...@@ -624,7 +626,7 @@ static void MoveCmpField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -624,7 +626,7 @@ static void MoveCmpField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
CurrentField->m_Pos.x = pos.x + Cmp->m_Transform[0][0] * x1 + Cmp->m_Transform[1][0] * y1; CurrentField->m_Pos.x = pos.x + Cmp->m_Transform[0][0] * x1 + Cmp->m_Transform[1][0] * y1;
CurrentField->m_Pos.y = pos.y + Cmp->m_Transform[0][1] * x1 + Cmp->m_Transform[1][1] * y1; CurrentField->m_Pos.y = pos.y + Cmp->m_Transform[0][1] * x1 + Cmp->m_Transform[1][1] * y1;
DrawTextField( panel, DC, CurrentField, Multiflag, g_XorMode ); CurrentField->Draw( panel, DC, wxPoint(0,0), g_XorMode );
} }
...@@ -636,10 +638,11 @@ static void AbortMoveCmpField( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -636,10 +638,11 @@ static void AbortMoveCmpField( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
if( CurrentField ) if( CurrentField )
{ {
DrawTextField( Panel, DC, CurrentField, Multiflag, g_XorMode ); CurrentField->m_AddExtraText = Multiflag;
CurrentField->Draw( Panel, DC, wxPoint(0,0), g_XorMode );
CurrentField->m_Flags = 0; CurrentField->m_Flags = 0;
CurrentField->m_Pos = OldPos; CurrentField->m_Pos = OldPos;
DrawTextField( Panel, DC, CurrentField, Multiflag, GR_DEFAULT_DRAWMODE ); CurrentField->Draw( Panel, DC, wxPoint(0,0), g_XorMode );
} }
CurrentField = NULL; CurrentField = NULL;
SAFE_DELETE( g_ItemToUndoCopy ); SAFE_DELETE( g_ItemToUndoCopy );
...@@ -677,13 +680,14 @@ void WinEDA_SchematicFrame::RotateCmpField( PartTextStruct* Field, wxDC* DC ) ...@@ -677,13 +680,14 @@ void WinEDA_SchematicFrame::RotateCmpField( PartTextStruct* Field, wxDC* DC )
if( Field->m_Flags == 0 ) if( Field->m_Flags == 0 )
SaveCopyInUndoList( Cmp, IS_CHANGED ); SaveCopyInUndoList( Cmp, IS_CHANGED );
DrawTextField( DrawPanel, DC, Field, flag, g_XorMode ); Field->m_AddExtraText = flag;
Field->Draw( DrawPanel, DC, wxPoint(0,0), g_XorMode );
if( Field->m_Orient == TEXT_ORIENT_HORIZ ) if( Field->m_Orient == TEXT_ORIENT_HORIZ )
Field->m_Orient = TEXT_ORIENT_VERT; Field->m_Orient = TEXT_ORIENT_VERT;
else else
Field->m_Orient = TEXT_ORIENT_HORIZ; Field->m_Orient = TEXT_ORIENT_HORIZ;
DrawTextField( DrawPanel, DC, Field, flag, g_XorMode ); Field->Draw( DrawPanel, DC, wxPoint(0,0), g_XorMode );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
...@@ -693,7 +697,7 @@ void WinEDA_SchematicFrame::RotateCmpField( PartTextStruct* Field, wxDC* DC ) ...@@ -693,7 +697,7 @@ void WinEDA_SchematicFrame::RotateCmpField( PartTextStruct* Field, wxDC* DC )
void PartTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) void PartTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/*********************************************************************/ /*********************************************************************/
{ {
int FieldNumber, flag; int FieldNumber;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
frame->DrawPanel->ManageCurseur = NULL; frame->DrawPanel->ManageCurseur = NULL;
...@@ -709,19 +713,18 @@ void PartTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC ) ...@@ -709,19 +713,18 @@ void PartTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
} }
FieldNumber = m_FieldId; FieldNumber = m_FieldId;
flag = 0; m_AddExtraText = 0;
if( FieldNumber == REFERENCE ) if( FieldNumber == REFERENCE )
{ {
Entry = FindLibPart( Cmp->m_ChipName.GetData(), Entry = FindLibPart( Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
wxEmptyString, FIND_ROOT );
if( Entry != NULL ) if( Entry != NULL )
{ {
if( Entry->m_UnitCount > 1 ) if( Entry->m_UnitCount > 1 )
flag = 1; m_AddExtraText = 1;
} }
} }
DrawTextField( frame->DrawPanel, DC, this, flag, GR_DEFAULT_DRAWMODE ); Draw( frame->DrawPanel, DC, wxPoint(0,0), GR_DEFAULT_DRAWMODE );
m_Flags = 0; m_Flags = 0;
frame->GetScreen()->SetCurItem( NULL ); frame->GetScreen()->SetCurItem( NULL );
frame->GetScreen()->SetModify(); frame->GetScreen()->SetModify();
...@@ -757,9 +760,10 @@ void WinEDA_SchematicFrame::EditComponentReference( SCH_COMPONENT* Cmp, wxDC* DC ...@@ -757,9 +760,10 @@ void WinEDA_SchematicFrame::EditComponentReference( SCH_COMPONENT* Cmp, wxDC* DC
SaveCopyInUndoList( Cmp, IS_CHANGED ); SaveCopyInUndoList( Cmp, IS_CHANGED );
Cmp->SetRef(GetSheet(), ref); Cmp->SetRef(GetSheet(), ref);
DrawTextField( DrawPanel, DC, &Cmp->m_Field[REFERENCE], flag, g_XorMode ); Cmp->m_Field[REFERENCE].m_AddExtraText = flag;
Cmp->m_Field[REFERENCE].Draw( DrawPanel, DC, wxPoint(0,0), g_XorMode );
Cmp->SetRef(GetSheet(), ref ); Cmp->SetRef(GetSheet(), ref );
DrawTextField( DrawPanel, DC, &Cmp->m_Field[REFERENCE], flag, Cmp->m_Field[REFERENCE].Draw( DrawPanel, DC, wxPoint(0,0),
Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE ); Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
...@@ -774,7 +778,6 @@ void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC ) ...@@ -774,7 +778,6 @@ void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC )
{ {
wxString msg; wxString msg;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
int flag = 0;
if( Cmp == NULL ) if( Cmp == NULL )
return; return;
...@@ -782,8 +785,6 @@ void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC ) ...@@ -782,8 +785,6 @@ void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC )
Entry = FindLibPart( Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); Entry = FindLibPart( Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry == NULL ) if( Entry == NULL )
return; return;
if( Entry->m_UnitCount > 1 )
flag = 1;
PartTextStruct* TextField = &Cmp->m_Field[VALUE]; PartTextStruct* TextField = &Cmp->m_Field[VALUE];
...@@ -797,9 +798,9 @@ void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC ) ...@@ -797,9 +798,9 @@ void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC )
if( Cmp->m_Flags == 0 ) if( Cmp->m_Flags == 0 )
SaveCopyInUndoList( Cmp, IS_CHANGED ); SaveCopyInUndoList( Cmp, IS_CHANGED );
DrawTextField( DrawPanel, DC, &Cmp->m_Field[VALUE], flag, g_XorMode ); TextField->Draw( DrawPanel, DC, wxPoint(0,0), g_XorMode );
TextField->m_Text = msg; TextField->m_Text = msg;
DrawTextField( DrawPanel, DC, &Cmp->m_Field[VALUE], flag, TextField->Draw( DrawPanel, DC, wxPoint(0,0),
Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE ); Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
GetScreen()->SetModify(); GetScreen()->SetModify();
} }
...@@ -813,7 +814,6 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC ...@@ -813,7 +814,6 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC
{ {
wxString msg; wxString msg;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
int flag = 0;
bool wasEmpty = false; bool wasEmpty = false;
if( Cmp == NULL ) if( Cmp == NULL )
...@@ -822,8 +822,6 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC ...@@ -822,8 +822,6 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC
Entry = FindLibPart( Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); Entry = FindLibPart( Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry == NULL ) if( Entry == NULL )
return; return;
if( Entry->m_UnitCount > 1 )
flag = 1;
PartTextStruct* TextField = &Cmp->m_Field[FOOTPRINT]; PartTextStruct* TextField = &Cmp->m_Field[FOOTPRINT];
...@@ -836,7 +834,7 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC ...@@ -836,7 +834,7 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC
/* save old cmp in undo list if not already in edit, or moving ... */ /* save old cmp in undo list if not already in edit, or moving ... */
if( Cmp->m_Flags == 0 ) if( Cmp->m_Flags == 0 )
SaveCopyInUndoList( Cmp, IS_CHANGED ); SaveCopyInUndoList( Cmp, IS_CHANGED );
DrawTextField( DrawPanel, DC, &Cmp->m_Field[FOOTPRINT], flag, g_XorMode ); Cmp->m_Field[FOOTPRINT].Draw( DrawPanel, DC, wxPoint(0,0), g_XorMode );
//move the field if it was new. //move the field if it was new.
if(wasEmpty && !msg.IsEmpty()) if(wasEmpty && !msg.IsEmpty())
{ {
...@@ -853,7 +851,7 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC ...@@ -853,7 +851,7 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC
} }
TextField->m_Text = msg; TextField->m_Text = msg;
DrawTextField( DrawPanel, DC, &Cmp->m_Field[FOOTPRINT], flag, Cmp->m_Field[FOOTPRINT].Draw( DrawPanel, DC, wxPoint(0,0),
Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE ); Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
GetScreen()->SetModify(); GetScreen()->SetModify();
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
/* Fonctions locales */ /* Fonctions locales */
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void ExitMoveTexte( WinEDA_DrawPanel* panel, wxDC* DC ); static void ExitMoveTexte( WinEDA_DrawPanel* panel, wxDC* DC );
...@@ -202,13 +200,13 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) ...@@ -202,13 +200,13 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
break; break;
case LAYER_HIERLABEL: case LAYER_HIERLABEL:
NewText = new SCH_HIERLABEL(GetScreen()->m_Curseur ); NewText = new SCH_HIERLABEL( GetScreen()->m_Curseur );
NewText->m_Shape = s_DefaultShapeGLabel; NewText->m_Shape = s_DefaultShapeGLabel;
NewText->m_Orient = s_DefaultOrientGLabel; NewText->m_Orient = s_DefaultOrientGLabel;
break; break;
case LAYER_GLOBLABEL: case LAYER_GLOBLABEL:
NewText = new SCH_GLOBALLABEL(GetScreen()->m_Curseur ); NewText = new SCH_GLOBALLABEL( GetScreen()->m_Curseur );
NewText->m_Shape = s_DefaultShapeGLabel; NewText->m_Shape = s_DefaultShapeGLabel;
NewText->m_Orient = s_DefaultOrientGLabel; NewText->m_Orient = s_DefaultOrientGLabel;
break; break;
...@@ -230,7 +228,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) ...@@ -230,7 +228,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
return NULL; return NULL;
} }
if( type == LAYER_GLOBLABEL || type == LAYER_HIERLABEL) if( type == LAYER_GLOBLABEL || type == LAYER_HIERLABEL )
{ {
s_DefaultShapeGLabel = NewText->m_Shape; s_DefaultShapeGLabel = NewText->m_Shape;
s_DefaultOrientGLabel = NewText->m_Orient; s_DefaultOrientGLabel = NewText->m_Orient;
...@@ -251,7 +249,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type ) ...@@ -251,7 +249,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
/************************************/ /************************************/
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
EDA_BaseStruct* TextStruct = panel->GetScreen()->GetCurItem(); SCH_ITEM* TextStruct = (SCH_ITEM*) panel->GetScreen()->GetCurItem();
/* "Undraw" the current text at its old position*/ /* "Undraw" the current text at its old position*/
if( erase ) if( erase )
...@@ -281,7 +279,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -281,7 +279,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
/* Abort function for the command move text */ /* Abort function for the command move text */
{ {
SCH_SCREEN* screen = (SCH_SCREEN*) Panel->m_Parent->GetScreen(); SCH_SCREEN* screen = (SCH_SCREEN*) Panel->m_Parent->GetScreen();
EDA_BaseStruct* Struct = screen->GetCurItem(); SCH_ITEM* Struct = (SCH_ITEM*) screen->GetCurItem();
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
Panel->ManageCurseur = NULL; Panel->ManageCurseur = NULL;
...@@ -348,11 +346,13 @@ void WinEDA_SchematicFrame::ConvertTextType( SCH_TEXT* Text, ...@@ -348,11 +346,13 @@ void WinEDA_SchematicFrame::ConvertTextType( SCH_TEXT* Text,
break; break;
case TYPE_SCH_GLOBALLABEL: case TYPE_SCH_GLOBALLABEL:
newtext = new SCH_GLOBALLABEL(Text->m_Pos, Text->m_Text ); newtext = new SCH_GLOBALLABEL( Text->m_Pos, Text->m_Text );
break; break;
case TYPE_SCH_HIERLABEL: case TYPE_SCH_HIERLABEL:
newtext = new SCH_HIERLABEL(Text->m_Pos, Text->m_Text ); newtext = new SCH_HIERLABEL( Text->m_Pos, Text->m_Text );
break; break;
case TYPE_SCH_TEXT: case TYPE_SCH_TEXT:
newtext = new SCH_TEXT( Text->m_Pos, Text->m_Text ); newtext = new SCH_TEXT( Text->m_Pos, Text->m_Text );
break; break;
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
#include "id.h" #include "id.h"
#include "schframe.h"
/* Variables locales */ /* Variables locales */
......
...@@ -12,11 +12,6 @@ ...@@ -12,11 +12,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
#include "schframe.h"
/* Routines Locales */ /* Routines Locales */
static void Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
...@@ -298,9 +293,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewJunctionStruct( wxDC* DC ) ...@@ -298,9 +293,9 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewJunctionStruct( wxDC* DC )
} }
/*************************************************************************/ /*********************************************************************************/
EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewNoConnectStruct( wxDC* DC ) DrawNoConnectStruct * WinEDA_SchematicFrame::CreateNewNoConnectStruct( wxDC* DC )
/*************************************************************************/ /*********************************************************************************/
/*Routine to create new NoConnect struct. ( Symbole de Non Connexion) /*Routine to create new NoConnect struct. ( Symbole de Non Connexion)
*/ */
......
...@@ -212,7 +212,7 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -212,7 +212,7 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
bool dummy = FALSE; bool dummy = FALSE;
if( ( Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT ) ) == NULL ) if( ( Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT ) ) == NULL )
{ /* composant non trouv, on affiche un composant "dummy" */ { /* composant non trouve, on affiche un composant "dummy" */
dummy = TRUE; dummy = TRUE;
if( DummyCmp == NULL ) if( DummyCmp == NULL )
CreateDummyCmp(); CreateDummyCmp();
...@@ -233,55 +233,60 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -233,55 +233,60 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
&& !(m_Field[REFERENCE].m_Flags & IS_MOVED) ) && !(m_Field[REFERENCE].m_Flags & IS_MOVED) )
{ {
if( Entry->m_UnitCount > 1 ) if( Entry->m_UnitCount > 1 )
DrawTextField( panel, DC, &m_Field[REFERENCE], 1, DrawMode ); {
m_Field[REFERENCE].m_AddExtraText = true;
m_Field[REFERENCE].Draw( panel, DC, offset, DrawMode );
}
else else
DrawTextField( panel, DC, &m_Field[REFERENCE], 0, DrawMode ); {
m_Field[REFERENCE].m_AddExtraText = false;
m_Field[REFERENCE].Draw( panel, DC, offset, DrawMode );
}
} }
for( ii = VALUE; ii < NUMBER_OF_FIELDS; ii++ ) for( ii = VALUE; ii < NUMBER_OF_FIELDS; ii++ )
{ {
if( m_Field[ii].m_Flags & IS_MOVED ) if( m_Field[ii].m_Flags & IS_MOVED )
continue; continue;
DrawTextField( panel, DC, &m_Field[ii], 0, DrawMode ); m_Field[ii].Draw( panel, DC, offset, DrawMode );
} }
} }
/***********************************************************/ /***********************************************************/
void DrawTextField( WinEDA_DrawPanel* panel, wxDC* DC, void PartTextStruct::Draw( WinEDA_DrawPanel* panel,
PartTextStruct* Field, int IsMulti, int DrawMode ) wxDC* DC,
const wxPoint& offset,
int DrawMode,
int Color)
/***********************************************************/ /***********************************************************/
/* Routine de trace des textes type Field du composant. /* Routine de trace des textes type Field du composant.
* entree: * entree:
* IsMulti: flag Non Null si il y a plusieurs parts par boitier.
* n'est utile que pour le champ reference pour ajouter a celui ci
* l'identification de la part ( A, B ... )
* DrawMode: mode de trace * DrawMode: mode de trace
*/ */
{ {
int orient, color; int orient, color;
wxPoint pos; /* Position des textes */ wxPoint pos; /* Position des textes */
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) Field->m_Parent; SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) m_Parent;
int hjustify, vjustify; int hjustify, vjustify;
int LineWidth = MAX( Field->m_Width, g_DrawMinimunLineWidth ); int LineWidth = MAX( m_Width, g_DrawMinimunLineWidth );
if( Field->m_Attributs & TEXT_NO_VISIBLE ) if( m_Attributs & TEXT_NO_VISIBLE )
return; return;
if( Field->IsVoid() ) if( IsVoid() )
return; return;
GRSetDrawMode( DC, DrawMode ); GRSetDrawMode( DC, DrawMode );
/* Calcul de la position des textes, selon orientation du composant */ /* Calcul de la position des textes, selon orientation du composant */
orient = Field->m_Orient; orient = m_Orient;
hjustify = Field->m_HJustify; vjustify = Field->m_VJustify; hjustify = m_HJustify; vjustify = m_VJustify;
pos.x = Field->m_Pos.x - DrawLibItem->m_Pos.x; pos = m_Pos - DrawLibItem->m_Pos;
pos.y = Field->m_Pos.y - DrawLibItem->m_Pos.y;
pos = DrawLibItem->GetScreenCoord( pos ); pos = DrawLibItem->GetScreenCoord( pos );
pos.x += DrawLibItem->m_Pos.x; pos += DrawLibItem->m_Pos;
pos.y += DrawLibItem->m_Pos.y;
/* Y a t-il rotation (pour l'orientation, la justification)*/ /* Y a t-il rotation (pour l'orientation, la justification)*/
if( DrawLibItem->m_Transform[0][1] ) // Rotation du composant de 90deg if( DrawLibItem->m_Transform[0][1] ) // Rotation du composant de 90deg
...@@ -306,27 +311,27 @@ void DrawTextField( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -306,27 +311,27 @@ void DrawTextField( WinEDA_DrawPanel* panel, wxDC* DC,
vjustify = -vjustify; vjustify = -vjustify;
} }
if( Field->m_FieldId == REFERENCE ) if( m_FieldId == REFERENCE )
color = ReturnLayerColor( LAYER_REFERENCEPART ); color = ReturnLayerColor( LAYER_REFERENCEPART );
else if( Field->m_FieldId == VALUE ) else if( m_FieldId == VALUE )
color = ReturnLayerColor( LAYER_VALUEPART ); color = ReturnLayerColor( LAYER_VALUEPART );
else else
color = ReturnLayerColor( LAYER_FIELDS ); color = ReturnLayerColor( LAYER_FIELDS );
if( !IsMulti || (Field->m_FieldId != REFERENCE) ) if( !m_AddExtraText || (m_FieldId != REFERENCE) )
{ {
DrawGraphicText( panel, DC, pos, color, Field->m_Text.GetData(), DrawGraphicText( panel, DC, pos, color, m_Text.GetData(),
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size, m_Size,
hjustify, vjustify, LineWidth ); hjustify, vjustify, LineWidth );
} }
else /* Le champ est la reference, et il y a plusieurs parts par boitier */ else // Si il y a plusieurs parts par boitier, ajouter a la reference l'identification de la selection ( A, B ... )
{ {
/* On ajoute alors A ou B ... a la reference */ /* On ajoute alors A ou B ... a la reference */
wxString fulltext = Field->m_Text; wxString fulltext = m_Text;
fulltext.Append( 'A' - 1 + DrawLibItem->m_Multi ); fulltext.Append( 'A' - 1 + DrawLibItem->m_Multi );
DrawGraphicText( panel, DC, pos, color, fulltext.GetData(), DrawGraphicText( panel, DC, pos, color, fulltext.GetData(),
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ, orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size, m_Size,
hjustify, vjustify, LineWidth ); hjustify, vjustify, LineWidth );
} }
} }
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
char marq_bitmap[] = char marq_bitmap[] =
{ {
...@@ -155,13 +153,13 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int PrintMask ...@@ -155,13 +153,13 @@ void WinEDA_DrawPanel::PrintPage( wxDC* DC, bool Print_Sheet_Ref, int PrintMask
* If the list is of DrawPickStruct types then the picked item are drawn. * * If the list is of DrawPickStruct types then the picked item are drawn. *
*****************************************************************************/ *****************************************************************************/
void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC, void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC,
EDA_BaseStruct* Structs, int DrawMode, int Color ) SCH_ITEM* Structs, int DrawMode, int Color )
{ {
while( Structs ) while( Structs )
{ {
if( Structs->Type() == DRAW_PICK_ITEM_STRUCT_TYPE ) if( Structs->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
EDA_BaseStruct* item = ( (DrawPickedStruct*) Structs )->m_PickedStruct; SCH_ITEM* item = ( (DrawPickedStruct*) Structs )->m_PickedStruct;
// uncomment line below when there is a virtual EDA_BaseStruct::GetBoundingBox() // uncomment line below when there is a virtual EDA_BaseStruct::GetBoundingBox()
// if( panel->m_ClipBox.Intersects( item->GetBoundingBox() ) ) // if( panel->m_ClipBox.Intersects( item->GetBoundingBox() ) )
...@@ -179,7 +177,7 @@ void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -179,7 +177,7 @@ void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC,
} }
} }
Structs = Structs->Pnext; Structs = Structs->Next();
} }
} }
...@@ -188,7 +186,7 @@ void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -188,7 +186,7 @@ void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC,
* Routine to redraw list of structs. * * Routine to redraw list of structs. *
*****************************************************************************/ *****************************************************************************/
void RedrawOneStruct( WinEDA_DrawPanel* panel, wxDC* DC, void RedrawOneStruct( WinEDA_DrawPanel* panel, wxDC* DC,
EDA_BaseStruct* Struct, int DrawMode, int Color ) SCH_ITEM* Struct, int DrawMode, int Color )
{ {
if( Struct == NULL ) if( Struct == NULL )
return; return;
...@@ -388,7 +386,7 @@ void DrawJunctionStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& ...@@ -388,7 +386,7 @@ void DrawJunctionStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint&
/**********************************************************/ /**********************************************************/
void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC, void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
EDA_BaseStruct* DrawStruct, int dx, int dy ) SCH_ITEM* DrawStruct, int dx, int dy )
/**********************************************************/ /**********************************************************/
/* Routine de redessin en mode fantome (Dessin simplifie en g_XorMode et /* Routine de redessin en mode fantome (Dessin simplifie en g_XorMode et
...@@ -480,9 +478,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -480,9 +478,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
SCH_TEXT* Struct; SCH_TEXT* Struct;
Struct = (SCH_TEXT*) DrawStruct; Struct = (SCH_TEXT*) DrawStruct;
Struct->m_Pos.x += dx; Struct->m_Pos.y += dy; Struct->Draw( panel, DC, wxPoint( dx, dy ), DrawMode, g_GhostColor );
Struct->Draw( panel, DC, wxPoint( 0, 0 ), DrawMode, g_GhostColor );
Struct->m_Pos.x -= dx; Struct->m_Pos.y -= dy;
break; break;
} }
...@@ -492,9 +488,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -492,9 +488,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
SCH_LABEL* Struct; SCH_LABEL* Struct;
Struct = (SCH_LABEL*) DrawStruct; Struct = (SCH_LABEL*) DrawStruct;
Struct->m_Pos.x += dx; Struct->m_Pos.y += dy; Struct->Draw( panel, DC, wxPoint( dx, dy ), DrawMode, g_GhostColor );
Struct->Draw( panel, DC, wxPoint( 0, 0 ), DrawMode, g_GhostColor );
Struct->m_Pos.x -= dx; Struct->m_Pos.y -= dy;
break; break;
} }
...@@ -502,9 +496,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -502,9 +496,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
{ {
DrawNoConnectStruct* Struct; DrawNoConnectStruct* Struct;
Struct = (DrawNoConnectStruct*) DrawStruct; Struct = (DrawNoConnectStruct*) DrawStruct;
Struct->m_Pos.x += dx; Struct->m_Pos.y += dy; Struct->Draw( panel, DC, wxPoint( dx, dy ), DrawMode, g_GhostColor );
Struct->Draw( panel, DC, wxPoint( 0, 0 ), DrawMode, g_GhostColor );
Struct->m_Pos.x -= dx; Struct->m_Pos.y -= dy;
break; break;
} }
......
...@@ -20,11 +20,10 @@ ...@@ -20,11 +20,10 @@
#include "netlist.h" #include "netlist.h"
#include "worksheet.h" #include "worksheet.h"
#include "trigo.h" #include "trigo.h"
#include "protos.h"
#include "bitmaps.h" #include "bitmaps.h"
#include "eda_dde.h" #include "eda_dde.h"
#include "schframe.h"
#include "protos.h"
// Global variables // Global variables
wxString g_Main_Title( wxT( "EESchema" ) ); wxString g_Main_Title( wxT( "EESchema" ) );
......
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
#include "../bitmaps/ercgreen.xpm" #include "../bitmaps/ercgreen.xpm"
#include "../bitmaps/ercwarn.xpm" #include "../bitmaps/ercwarn.xpm"
#include "../bitmaps/ercerr.xpm" #include "../bitmaps/ercerr.xpm"
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#include "protos.h" #include "protos.h"
#include "id.h" #include "id.h"
#include "schframe.h"
/* Fonctions locales */ /* Fonctions locales */
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
#include "libcmp.h" #include "libcmp.h"
#include "general.h" #include "general.h"
#include "schframe.h"
/* Variables Locales */ /* Variables Locales */
static int s_ItemsCount, s_MarkerCount; static int s_ItemsCount, s_MarkerCount;
static wxString s_OldStringFound; static wxString s_OldStringFound;
...@@ -48,7 +46,7 @@ void WinEDA_FindFrame::FindMarker( wxCommandEvent& event ) ...@@ -48,7 +46,7 @@ void WinEDA_FindFrame::FindMarker( wxCommandEvent& event )
/************************************************************************/ /************************************************************************/
EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem( SCH_ITEM * WinEDA_SchematicFrame::FindComponentAndItem(
const wxString& component_reference, bool Find_in_hierarchy, const wxString& component_reference, bool Find_in_hierarchy,
int SearchType, int SearchType,
const wxString& text_to_find, const wxString& text_to_find,
...@@ -71,7 +69,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem( ...@@ -71,7 +69,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
*/ */
{ {
DrawSheetPath* sheet, * SheetWithComponentFound = NULL; DrawSheetPath* sheet, * SheetWithComponentFound = NULL;
EDA_BaseStruct* DrawList = NULL; SCH_ITEM* DrawList = NULL;
SCH_COMPONENT* Component = NULL; SCH_COMPONENT* Component = NULL;
wxSize DrawAreaSize = DrawPanel->GetClientSize(); wxSize DrawAreaSize = DrawPanel->GetClientSize();
wxPoint pos, curpos; wxPoint pos, curpos;
...@@ -88,8 +86,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem( ...@@ -88,8 +86,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
for( ; sheet != NULL; sheet = SheetList.GetNext() ) for( ; sheet != NULL; sheet = SheetList.GetNext() )
{ {
DrawList = sheet->LastDrawList(); DrawList = (SCH_ITEM*) sheet->LastDrawList();
for( ; (DrawList != NULL) && (NotFound == true); DrawList = DrawList->Pnext ) for( ; (DrawList != NULL) && (NotFound == true); DrawList = DrawList->Next() )
{ {
if( DrawList->Type() == TYPE_SCH_COMPONENT ) if( DrawList->Type() == TYPE_SCH_COMPONENT )
{ {
...@@ -258,7 +256,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem( ...@@ -258,7 +256,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
/*****************************************************************/ /*****************************************************************/
EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType ) SCH_ITEM * WinEDA_SchematicFrame::FindMarker( int SearchType )
/*****************************************************************/ /*****************************************************************/
/* Search markers in whole the hierarchy. /* Search markers in whole the hierarchy.
...@@ -267,8 +265,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType ) ...@@ -267,8 +265,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
*/ */
{ {
DrawSheetPath* sheet, * FirstSheet = NULL; DrawSheetPath* sheet, * FirstSheet = NULL;
EDA_BaseStruct* DrawList, * FirstStruct = NULL, * Struct = NULL; SCH_ITEM* DrawList, * FirstStruct = NULL, * Struct = NULL;
DrawMarkerStruct* Marker = NULL; DrawMarkerStruct * Marker = NULL;
int StartCount; int StartCount;
bool NotFound; bool NotFound;
wxPoint firstpos, pos; wxPoint firstpos, pos;
...@@ -288,7 +286,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType ) ...@@ -288,7 +286,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
/* Search for s_MarkerCount markers */ /* Search for s_MarkerCount markers */
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() ) for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{ {
DrawList = sheet->LastDrawList(); DrawList = (SCH_ITEM*) sheet->LastDrawList();
while( DrawList && NotFound ) while( DrawList && NotFound )
{ {
if( DrawList->Type() == DRAW_MARKER_STRUCT_TYPE ) if( DrawList->Type() == DRAW_MARKER_STRUCT_TYPE )
...@@ -312,7 +310,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType ) ...@@ -312,7 +310,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
Struct = DrawList; s_MarkerCount++; break; Struct = DrawList; s_MarkerCount++; break;
} }
} }
DrawList = DrawList->Pnext; DrawList = DrawList->Next();
} }
if( NotFound == FALSE ) if( NotFound == FALSE )
...@@ -406,7 +404,7 @@ void WinEDA_FindFrame::FindSchematicItem( wxCommandEvent& event ) ...@@ -406,7 +404,7 @@ void WinEDA_FindFrame::FindSchematicItem( wxCommandEvent& event )
/************************************************************************/ /************************************************************************/
EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( SCH_ITEM* WinEDA_SchematicFrame::FindSchematicItem(
const wxString& pattern, int SearchType, bool mouseWarp ) const wxString& pattern, int SearchType, bool mouseWarp )
/************************************************************************/ /************************************************************************/
...@@ -421,7 +419,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -421,7 +419,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
*/ */
{ {
DrawSheetPath* Sheet, * FirstSheet = NULL; DrawSheetPath* Sheet, * FirstSheet = NULL;
EDA_BaseStruct* DrawList = NULL, * FirstStruct = NULL, * Struct = NULL; SCH_ITEM* DrawList = NULL, * FirstStruct = NULL, * Struct = NULL;
int StartCount, ii, jj; int StartCount, ii, jj;
bool NotFound; bool NotFound;
wxPoint firstpos, pos, old_cursor_position; wxPoint firstpos, pos, old_cursor_position;
...@@ -460,7 +458,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -460,7 +458,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
for( ; Sheet != NULL; Sheet = SheetList.GetNext() ) for( ; Sheet != NULL; Sheet = SheetList.GetNext() )
{ {
DrawList = Sheet->LastDrawList(); DrawList = (SCH_ITEM*)Sheet->LastDrawList();
while( DrawList ) while( DrawList )
{ {
switch( DrawList->Type() ) switch( DrawList->Type() )
...@@ -521,7 +519,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem( ...@@ -521,7 +519,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
} }
if( NotFound == FALSE ) if( NotFound == FALSE )
break; break;
DrawList = DrawList->Pnext; DrawList = DrawList->Next();
} }
if( NotFound == FALSE ) if( NotFound == FALSE )
......
...@@ -122,13 +122,13 @@ eda_global int g_NetFormat; /* Numero de reference du type de netliste */ ...@@ -122,13 +122,13 @@ eda_global int g_NetFormat; /* Numero de reference du type de netliste */
eda_global int g_OptNetListUseNames; /* TRUE pour utiliser les noms de net plutot que eda_global int g_OptNetListUseNames; /* TRUE pour utiliser les noms de net plutot que
les numeros (netlist PSPICE seulement) */ les numeros (netlist PSPICE seulement) */
eda_global int g_BGColor; /* couleur fond d'ecran (normalement blanc) */ eda_global int g_BGColor; /* couleur fond d'ecran (normalement blanc) */
eda_global EDA_BaseStruct * g_ItemToRepeat; /* pointeur sur la derniere structure eda_global SCH_ITEM * g_ItemToRepeat; /* pointeur sur la derniere structure
dessinee pouvant etre dupliquee par la commande dessinee pouvant etre dupliquee par la commande
Repeat ( NULL si aucune struct existe ) */ Repeat ( NULL si aucune struct existe ) */
eda_global wxSize g_RepeatStep; eda_global wxSize g_RepeatStep;
eda_global int g_RepeatDeltaLabel; eda_global int g_RepeatDeltaLabel;
eda_global EDA_BaseStruct * g_ItemToUndoCopy; /* copy of last modified schematic item eda_global SCH_ITEM * g_ItemToUndoCopy; /* copy of last modified schematic item
before it is modified (used for undo managing to restore old values ) */ before it is modified (used for undo managing to restore old values ) */
eda_global bool g_LastSearchIsMarker; // True if last seach is a marker serach eda_global bool g_LastSearchIsMarker; // True if last seach is a marker serach
...@@ -136,7 +136,7 @@ eda_global bool g_LastSearchIsMarker; // True if last seach is a marker serach ...@@ -136,7 +136,7 @@ eda_global bool g_LastSearchIsMarker; // True if last seach is a marker serach
// Used for hotkey next search // Used for hotkey next search
/* Block operation (copy, paste) */ /* Block operation (copy, paste) */
eda_global EDA_BaseStruct * g_BlockSaveDataList; // List of items to paste (Created by Block Save) eda_global SCH_ITEM * g_BlockSaveDataList; // List of items to paste (Created by Block Save)
// Gestion d'options // Gestion d'options
eda_global int g_ShowAllPins; eda_global int g_ShowAllPins;
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
/* Routines Locales */ /* Routines Locales */
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
......
...@@ -10,9 +10,7 @@ ...@@ -10,9 +10,7 @@
#include "libcmp.h" #include "libcmp.h"
#include "general.h" #include "general.h"
#include "protos.h" //#include "protos.h"
#include "schframe.h"
#include "wx/image.h" #include "wx/image.h"
#include "wx/imaglist.h" #include "wx/imaglist.h"
......
...@@ -17,8 +17,6 @@ ...@@ -17,8 +17,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
/* How to add a new hotkey: /* How to add a new hotkey:
* add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION (see hotkeys.h). * add a new id in the enum hotkey_id_commnand like MY_NEW_ID_FUNCTION (see hotkeys.h).
* add a new Ki_HotkeyInfo entry like: * add a new Ki_HotkeyInfo entry like:
...@@ -260,7 +258,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -260,7 +258,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if( DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
{ {
EDA_DrawLineStruct* segment = (EDA_DrawLineStruct*) DrawStruct; EDA_DrawLineStruct* segment = (EDA_DrawLineStruct*) DrawStruct;
if( segment->m_Layer != LAYER_WIRE ) if( segment->GetLayer() != LAYER_WIRE )
break; break;
} }
else else
...@@ -292,7 +290,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -292,7 +290,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case TYPE_SCH_COMPONENT: case TYPE_SCH_COMPONENT:
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
{ {
SaveCopyInUndoList( DrawStruct, IS_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, IS_CHANGED );
RefreshToolBar = TRUE; RefreshToolBar = TRUE;
} }
...@@ -306,7 +304,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -306,7 +304,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case TYPE_SCH_HIERLABEL: case TYPE_SCH_HIERLABEL:
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
{ {
SaveCopyInUndoList( DrawStruct, IS_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, IS_CHANGED );
RefreshToolBar = TRUE; RefreshToolBar = TRUE;
} }
ChangeTextOrient( (SCH_TEXT*) DrawStruct, DC ); ChangeTextOrient( (SCH_TEXT*) DrawStruct, DC );
...@@ -325,11 +323,10 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -325,11 +323,10 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
{ {
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
{ {
SaveCopyInUndoList( DrawStruct, IS_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, IS_CHANGED );
RefreshToolBar = TRUE; RefreshToolBar = TRUE;
} }
CmpRotationMiroir( CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_MIROIR_Y );
(SCH_COMPONENT*) DrawStruct, DC, CMP_MIROIR_Y );
} }
break; break;
...@@ -340,7 +337,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -340,7 +337,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
{ {
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
{ {
SaveCopyInUndoList( DrawStruct, IS_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, IS_CHANGED );
RefreshToolBar = TRUE; RefreshToolBar = TRUE;
} }
CmpRotationMiroir( CmpRotationMiroir(
...@@ -355,12 +352,11 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey, ...@@ -355,12 +352,11 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
{ {
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
{ {
SaveCopyInUndoList( DrawStruct, IS_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, IS_CHANGED );
RefreshToolBar = TRUE; RefreshToolBar = TRUE;
} }
CmpRotationMiroir( CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_NORMAL );
(SCH_COMPONENT*) DrawStruct, DC, CMP_NORMAL ); TestDanglingEnds( GetScreen()->EEDrawList, DC );
TestDanglingEnds( (SCH_SCREEN*)GetScreen()->EEDrawList, DC );
} }
break; break;
......
...@@ -14,8 +14,6 @@ ...@@ -14,8 +14,6 @@
#include "id.h" #include "id.h"
#include "schframe.h"
/* Format des fichiers: /* Format des fichiers:
* - entete: * - entete:
* EESchema Schematic File Version n * EESchema Schematic File Version n
...@@ -82,7 +80,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F ...@@ -82,7 +80,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
int ii, layer, orient, size; int ii, layer, orient, size;
wxPoint pos; wxPoint pos;
bool Failed = FALSE; bool Failed = FALSE;
EDA_BaseStruct* Phead, * Pnext; SCH_ITEM* Phead, * Pnext;
DrawJunctionStruct* ConnectionStruct; DrawJunctionStruct* ConnectionStruct;
DrawPolylineStruct* PolylineStruct; DrawPolylineStruct* PolylineStruct;
EDA_DrawLineStruct* SegmentStruct; EDA_DrawLineStruct* SegmentStruct;
...@@ -207,7 +205,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F ...@@ -207,7 +205,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
if( !Failed ) if( !Failed )
{ {
SegmentStruct->Pnext = screen->EEDrawList; SegmentStruct->Pnext = screen->EEDrawList;
screen->EEDrawList = (EDA_BaseStruct*) SegmentStruct; screen->EEDrawList = SegmentStruct;
} }
break; break;
...@@ -288,7 +286,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F ...@@ -288,7 +286,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
if( !Failed ) if( !Failed )
{ {
PolylineStruct->Pnext = screen->EEDrawList; PolylineStruct->Pnext = screen->EEDrawList;
screen->EEDrawList = (EDA_BaseStruct*) PolylineStruct; screen->EEDrawList = PolylineStruct;
} }
break; break;
...@@ -359,7 +357,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F ...@@ -359,7 +357,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
case 'T': /* Its a text item. */ case 'T': /* Its a text item. */
{ {
EDA_BaseStruct* Struct = NULL; SCH_ITEM* Struct = NULL;
*Name1 = *Name2 = 0; *Name1 = *Name2 = 0;
ii = sscanf( SLine, "%s %d %d %d %d %s", ii = sscanf( SLine, "%s %d %d %d %d %s",
Name1, &pos.x, &pos.y, &orient, &size, Name2 ); Name1, &pos.x, &pos.y, &orient, &size, Name2 );
...@@ -394,13 +392,12 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F ...@@ -394,13 +392,12 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
new SCH_LABEL( pos, CONV_FROM_UTF8( text ) ); new SCH_LABEL( pos, CONV_FROM_UTF8( text ) );
TextStruct->m_Size.x = TextStruct->m_Size.y = size; TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient; TextStruct->m_Orient = orient;
Struct = (EDA_BaseStruct*) TextStruct; Struct = TextStruct;
} }
else if( Name1[0] == 'G' && version > '1') else if( Name1[0] == 'G' && version > '1')
{ {
SCH_GLOBALLABEL* TextStruct = SCH_GLOBALLABEL* TextStruct = new SCH_GLOBALLABEL(pos, CONV_FROM_UTF8( text ) );
new SCH_GLOBALLABEL(pos, CONV_FROM_UTF8( text ) ); Struct = TextStruct;
Struct = (EDA_BaseStruct*) TextStruct;
TextStruct->m_Size.x = TextStruct->m_Size.y = size; TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient; TextStruct->m_Orient = orient;
TextStruct->m_Shape = NET_INPUT; TextStruct->m_Shape = NET_INPUT;
...@@ -415,9 +412,8 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F ...@@ -415,9 +412,8 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
} }
else if( (Name1[0] == 'H') || (Name1[0] == 'G' && version == '1')) else if( (Name1[0] == 'H') || (Name1[0] == 'G' && version == '1'))
{ //in schematic file version 1, glabels were actually hierarchal labels. { //in schematic file version 1, glabels were actually hierarchal labels.
SCH_HIERLABEL* TextStruct = SCH_HIERLABEL* TextStruct = new SCH_HIERLABEL(pos, CONV_FROM_UTF8( text ) );
new SCH_HIERLABEL(pos, CONV_FROM_UTF8( text ) ); Struct = TextStruct;
Struct = (EDA_BaseStruct*) TextStruct;
TextStruct->m_Size.x = TextStruct->m_Size.y = size; TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient; TextStruct->m_Orient = orient;
TextStruct->m_Shape = NET_INPUT; TextStruct->m_Shape = NET_INPUT;
...@@ -436,7 +432,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F ...@@ -436,7 +432,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
new SCH_TEXT( pos, CONV_FROM_UTF8( text ) ); new SCH_TEXT( pos, CONV_FROM_UTF8( text ) );
TextStruct->m_Size.x = TextStruct->m_Size.y = size; TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient; TextStruct->m_Orient = orient;
Struct = (EDA_BaseStruct*) TextStruct; Struct = TextStruct;
} }
if( Struct ) if( Struct )
{ {
...@@ -467,7 +463,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F ...@@ -467,7 +463,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
while( screen->EEDrawList ) while( screen->EEDrawList )
{ {
Pnext = screen->EEDrawList; Pnext = screen->EEDrawList;
screen->EEDrawList = screen->EEDrawList->Pnext; screen->EEDrawList = screen->EEDrawList->Next();
Pnext->Pnext = Phead; Pnext->Pnext = Phead;
Phead = Pnext; Phead = Pnext;
} }
...@@ -777,7 +773,7 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f, ...@@ -777,7 +773,7 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
if( !Failed ) if( !Failed )
{ {
LibItemStruct->Pnext = Window->EEDrawList; LibItemStruct->Pnext = Window->EEDrawList;
Window->EEDrawList = (EDA_BaseStruct*) LibItemStruct; Window->EEDrawList = LibItemStruct;
LibItemStruct->m_Parent = Window; LibItemStruct->m_Parent = Window;
} }
...@@ -963,7 +959,7 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi ...@@ -963,7 +959,7 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
if( !Failed ) if( !Failed )
{ {
SheetStruct->Pnext = Window->EEDrawList; SheetStruct->Pnext = Window->EEDrawList;
Window->EEDrawList = (EDA_BaseStruct*)SheetStruct; Window->EEDrawList = SheetStruct;
SheetStruct->m_Parent = Window; SheetStruct->m_Parent = Window;
} }
return Failed; /* Fin lecture 1 composant */ return Failed; /* Fin lecture 1 composant */
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
int distance( int dx, int dy, int spot_cX, int spot_cY, int seuil ); int distance( int dx, int dy, int spot_cX, int spot_cY, int seuil );
/* Routines Locales */ /* Routines Locales */
static EDA_BaseStruct* LastSnappedStruct = NULL; static SCH_ITEM* LastSnappedStruct = NULL;
static int PickedBoxMinX, PickedBoxMinY, PickedBoxMaxX, PickedBoxMaxY; static int PickedBoxMinX, PickedBoxMinY, PickedBoxMaxX, PickedBoxMaxY;
static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1, static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
int StartX2, int StartY2, int EndX2, int EndY2 ); int StartX2, int StartY2, int EndX2, int EndY2 );
...@@ -27,7 +27,7 @@ static bool IsPointInBox( int pX, int pY, ...@@ -27,7 +27,7 @@ static bool IsPointInBox( int pX, int pY,
static bool IsPointOnSegment( int pX, int pY, static bool IsPointOnSegment( int pX, int pY,
int SegmX1, int SegmY1, int SegmX2, int SegmY2, int seuil = 0 ); int SegmX1, int SegmY1, int SegmX2, int SegmY2, int seuil = 0 );
static bool SnapPoint2( const wxPoint& PosRef, int SearchMask, static bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
EDA_BaseStruct* DrawList, DrawPickedStruct* DontSnapList, int zoom_value ); SCH_ITEM* DrawList, DrawPickedStruct* DontSnapList, int zoom_value );
/*********************************************************************/ /*********************************************************************/
...@@ -39,7 +39,7 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen ) ...@@ -39,7 +39,7 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
*/ */
{ {
SCH_COMPONENT* DrawLibItem = NULL, * LastDrawLibItem = NULL; SCH_COMPONENT* DrawLibItem = NULL, * LastDrawLibItem = NULL;
EDA_BaseStruct* DrawList; SCH_ITEM* DrawList;
EDA_Rect BoundaryBox; EDA_Rect BoundaryBox;
float sizeref = 0, sizecurr; float sizeref = 0, sizecurr;
...@@ -55,7 +55,7 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen ) ...@@ -55,7 +55,7 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
break; break;
} }
DrawLibItem = (SCH_COMPONENT*) LastSnappedStruct; DrawLibItem = (SCH_COMPONENT*) LastSnappedStruct;
DrawList = DrawLibItem->Pnext; DrawList = DrawLibItem->Next();
if( LastDrawLibItem == NULL ) // First time a component is located if( LastDrawLibItem == NULL ) // First time a component is located
{ {
LastDrawLibItem = DrawLibItem; LastDrawLibItem = DrawLibItem;
...@@ -111,16 +111,16 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen ) ...@@ -111,16 +111,16 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
* Si pas de structures selectionnees: retourne NULL * Si pas de structures selectionnees: retourne NULL
* *
*/ */
/***********************************************************************/ /********************************************************************************/
EDA_BaseStruct* PickStruct( const wxPoint& refpos, SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask )
BASE_SCREEN* screen, int SearchMask) /******************************************************************************/
/************************************************************************/
/* Search an item at pos pos /* Search an item at pos refpos
*/ */
{ {
bool Snapped; bool Snapped;
EDA_BaseStruct* DrawList = screen->EEDrawList; SCH_ITEM* DrawList = screen->EEDrawList;
if( screen==NULL || DrawList == NULL ) if( screen==NULL || DrawList == NULL )
return NULL; return NULL;
...@@ -134,8 +134,7 @@ EDA_BaseStruct* PickStruct( const wxPoint& refpos, ...@@ -134,8 +134,7 @@ EDA_BaseStruct* PickStruct( const wxPoint& refpos,
/***********************************************************************/ /***********************************************************************/
EDA_BaseStruct* PickStruct( EDA_Rect& block, SCH_ITEM* PickStruct( EDA_Rect& block, BASE_SCREEN* screen, int SearchMask )
BASE_SCREEN* screen, int SearchMask )
/************************************************************************/ /************************************************************************/
/* Search items in block /* Search items in block
...@@ -143,7 +142,7 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block, ...@@ -143,7 +142,7 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block,
{ {
int x, y, OrigX, OrigY; int x, y, OrigX, OrigY;
DrawPickedStruct* PickedList = NULL, * PickedItem; DrawPickedStruct* PickedList = NULL, * PickedItem;
EDA_BaseStruct* DrawStruct; SCH_ITEM* DrawStruct;
OrigX = block.GetX(); OrigX = block.GetX();
OrigY = block.GetY(); OrigY = block.GetY();
...@@ -155,11 +154,11 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block, ...@@ -155,11 +154,11 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block,
if( y < OrigY ) if( y < OrigY )
EXCHG( y, OrigY ); EXCHG( y, OrigY );
EDA_BaseStruct* DrawList = screen->EEDrawList; SCH_ITEM* DrawList = screen->EEDrawList;
if( screen==NULL || DrawList == NULL ) if( screen==NULL || DrawList == NULL )
return NULL; return NULL;
for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{ {
if( DrawStructInBox( OrigX, OrigY, x, y, DrawStruct ) ) if( DrawStructInBox( OrigX, OrigY, x, y, DrawStruct ) )
{ {
...@@ -176,7 +175,7 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block, ...@@ -176,7 +175,7 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block,
/* 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;
PickedList = (DrawPickedStruct*) PickedList->m_PickedStruct; PickedList = (DrawPickedStruct*) PickedList->m_PickedStruct;
SAFE_DELETE( PickedItem ) ; SAFE_DELETE( PickedItem );
} }
if( PickedList != NULL ) if( PickedList != NULL )
...@@ -199,18 +198,18 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block, ...@@ -199,18 +198,18 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block,
* The routine returns TRUE if point was snapped. * * The routine returns TRUE if point was snapped. *
*****************************************************************************/ *****************************************************************************/
bool SnapPoint2( const wxPoint& PosRef, int SearchMask, bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
EDA_BaseStruct* DrawList, DrawPickedStruct* DontSnapList, int zoom_value ) SCH_ITEM* DrawList, DrawPickedStruct* DontSnapList, int zoom_value )
{ {
int i, * Points, x = PosRef.x, y = PosRef.y; int i, * Points, x = PosRef.x, y = PosRef.y;
int x1, y1, x2, y2, NumOfPoints2; int x1, y1, x2, y2, NumOfPoints2;
DrawPickedStruct* DontSnap; DrawPickedStruct* DontSnap;
int dx, dy; int dx, dy;
for( ; DrawList != NULL; DrawList = DrawList->Pnext ) for( ; DrawList != NULL; DrawList = DrawList->Next() )
{ {
/* Make sure this structure is NOT in the dont snap list: */ /* Make sure this structure is NOT in the dont snap list: */
DontSnap = DontSnapList; DontSnap = DontSnapList;
for( ; DontSnap != NULL; DontSnap = (DrawPickedStruct*) DontSnap->Pnext ) for( ; DontSnap != NULL; DontSnap = DontSnap->Next() )
if( DontSnap->m_PickedStruct == DrawList ) if( DontSnap->m_PickedStruct == DrawList )
break; break;
...@@ -238,6 +237,7 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask, ...@@ -238,6 +237,7 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
return TRUE; return TRUE;
} }
} }
break; break;
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
...@@ -249,9 +249,9 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask, ...@@ -249,9 +249,9 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
if( IsPointOnSegment( x, y, STRUCT->m_Start.x, STRUCT->m_Start.y, if( IsPointOnSegment( x, y, STRUCT->m_Start.x, STRUCT->m_Start.y,
STRUCT->m_End.x, STRUCT->m_End.y ) ) STRUCT->m_End.x, STRUCT->m_End.y ) )
{ {
if( ( (SearchMask & DRAWITEM) && (STRUCT->m_Layer == LAYER_NOTES) ) if( ( (SearchMask & DRAWITEM) && (STRUCT->GetLayer() == LAYER_NOTES) )
|| ( (SearchMask & WIREITEM) && (STRUCT->m_Layer == LAYER_WIRE) ) || ( (SearchMask & WIREITEM) && (STRUCT->GetLayer() == LAYER_WIRE) )
|| ( (SearchMask & BUSITEM) && (STRUCT->m_Layer == LAYER_BUS) ) || ( (SearchMask & BUSITEM) && (STRUCT->GetLayer() == LAYER_BUS) )
) )
{ {
if( SearchMask & EXCLUDE_WIRE_BUS_ENDPOINTS ) if( SearchMask & EXCLUDE_WIRE_BUS_ENDPOINTS )
...@@ -494,7 +494,7 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask, ...@@ -494,7 +494,7 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
* routine is used to pick all points in a given box. * * routine is used to pick all points in a given box. *
*****************************************************************************/ *****************************************************************************/
bool DrawStructInBox( int x1, int y1, int x2, int y2, bool DrawStructInBox( int x1, int y1, int x2, int y2,
EDA_BaseStruct* DrawStruct ) SCH_ITEM* DrawStruct )
{ {
int i, * Points, xt1, yt1, xt2, yt2, NumOfPoints2; int i, * Points, xt1, yt1, xt2, yt2, NumOfPoints2;
int dx, dy; int dx, dy;
...@@ -952,7 +952,7 @@ int distance( int dx, int dy, int spot_cX, int spot_cY, int seuil ) ...@@ -952,7 +952,7 @@ int distance( int dx, int dy, int spot_cX, int spot_cY, int seuil )
{ {
int cXrot, cYrot, /* coord du point (souris) dans le repere tourne */ int cXrot, cYrot, /* coord du point (souris) dans le repere tourne */
segX, segY; /* coord extremite segment tj >= 0 */ segX, segY; /* coord extremite segment tj >= 0 */
int pointX, pointY;/* coord point a tester dans repere modifie dans lequel int pointX, pointY; /* coord point a tester dans repere modifie dans lequel
* segX et segY sont >=0 */ * segX et segY sont >=0 */
segX = dx; segY = dy; pointX = spot_cX; pointY = spot_cY; segX = dx; segY = dy; pointX = spot_cX; pointY = spot_cY;
...@@ -1041,8 +1041,9 @@ int distance( int dx, int dy, int spot_cX, int spot_cY, int seuil ) ...@@ -1041,8 +1041,9 @@ int distance( int dx, int dy, int spot_cX, int spot_cY, int seuil )
return 0; return 0;
} }
/*******************************************************************/ /*******************************************************************/
LibDrawPin* LocatePinByNumber( const wxString & ePin_Number, LibDrawPin* LocatePinByNumber( const wxString& ePin_Number,
SCH_COMPONENT* eComponent ) SCH_COMPONENT* eComponent )
/*******************************************************************/ /*******************************************************************/
...@@ -1057,7 +1058,7 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number, ...@@ -1057,7 +1058,7 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
LibDrawPin* Pin; LibDrawPin* Pin;
int Unit, Convert; int Unit, Convert;
Entry = FindLibPart(eComponent->m_ChipName.GetData(), wxEmptyString, FIND_ROOT ); Entry = FindLibPart( eComponent->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry == NULL ) if( Entry == NULL )
return NULL; return NULL;
...@@ -1084,7 +1085,7 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number, ...@@ -1084,7 +1085,7 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
continue; continue;
wxString pNumber; wxString pNumber;
Pin->ReturnPinStringNum( pNumber ); Pin->ReturnPinStringNum( pNumber );
if ( ePin_Number == pNumber ) if( ePin_Number == pNumber )
return Pin; return Pin;
} }
} }
...@@ -1197,16 +1198,16 @@ DrawSheetLabelStruct* LocateSheetLabel( DrawSheetStruct* Sheet, const wxPoint& p ...@@ -1197,16 +1198,16 @@ DrawSheetLabelStruct* LocateSheetLabel( DrawSheetStruct* Sheet, const wxPoint& p
/**************************************************************************/ /**************************************************************************/
LibDrawPin* LocateAnyPin( EDA_BaseStruct* DrawList, const wxPoint& RefPos, LibDrawPin* LocateAnyPin( SCH_ITEM* DrawList, const wxPoint& RefPos,
SCH_COMPONENT** libpart ) SCH_COMPONENT** libpart )
/**************************************************************************/ /**************************************************************************/
{ {
EDA_BaseStruct* DrawStruct; SCH_ITEM* DrawStruct;
EDA_LibComponentStruct* Entry; EDA_LibComponentStruct* Entry;
SCH_COMPONENT* LibItem = NULL; SCH_COMPONENT* LibItem = NULL;
LibDrawPin* Pin = NULL; LibDrawPin* Pin = NULL;
for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{ {
if( DrawStruct->Type() != TYPE_SCH_COMPONENT ) if( DrawStruct->Type() != TYPE_SCH_COMPONENT )
continue; continue;
...@@ -1228,13 +1229,13 @@ LibDrawPin* LocateAnyPin( EDA_BaseStruct* DrawList, const wxPoint& RefPos, ...@@ -1228,13 +1229,13 @@ LibDrawPin* LocateAnyPin( EDA_BaseStruct* DrawList, const wxPoint& RefPos,
/***************************************************************/ /***************************************************************/
DrawSheetLabelStruct* LocateAnyPinSheet( const wxPoint& RefPos, DrawSheetLabelStruct* LocateAnyPinSheet( const wxPoint& RefPos,
EDA_BaseStruct* DrawList ) SCH_ITEM* DrawList )
/***************************************************************/ /***************************************************************/
{ {
EDA_BaseStruct* DrawStruct; SCH_ITEM* DrawStruct;
DrawSheetLabelStruct* PinSheet = NULL; DrawSheetLabelStruct* PinSheet = NULL;
for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Next() )
{ {
if( DrawStruct->Type() != DRAW_SHEET_STRUCT_TYPE ) if( DrawStruct->Type() != DRAW_SHEET_STRUCT_TYPE )
continue; continue;
......
...@@ -18,8 +18,6 @@ ...@@ -18,8 +18,6 @@
#include "id.h" #include "id.h"
#include "hotkeys.h" #include "hotkeys.h"
#include "schframe.h"
/************************************************/ /************************************************/
void WinEDA_SchematicFrame::ReCreateMenuBar() void WinEDA_SchematicFrame::ReCreateMenuBar()
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
/* Routines locales */ /* Routines locales */
static void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame, const wxString& FullFileName ); static void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame, const wxString& FullFileName );
static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f, static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f,
......
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
#include "netlist.h" /* Definitions generales liees au calcul de netliste */ #include "netlist.h" /* Definitions generales liees au calcul de netliste */
#include "protos.h" #include "protos.h"
#include "schframe.h"
//#define NETLIST_DEBUG //#define NETLIST_DEBUG
/* Routines locales */ /* Routines locales */
...@@ -471,15 +469,15 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh ...@@ -471,15 +469,15 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
#define STRUCT ( (EDA_DrawLineStruct*) DrawList ) #define STRUCT ( (EDA_DrawLineStruct*) DrawList )
if( ObjNet ) if( ObjNet )
{ {
if( (STRUCT->m_Layer != LAYER_BUS) if( (STRUCT->GetLayer() != LAYER_BUS)
&& (STRUCT->m_Layer != LAYER_WIRE) ) && (STRUCT->GetLayer() != LAYER_WIRE) )
break; break;
ObjNet[NbrItem].m_Comp = STRUCT; ObjNet[NbrItem].m_Comp = STRUCT;
ObjNet[NbrItem].m_Start = STRUCT->m_Start; ObjNet[NbrItem].m_Start = STRUCT->m_Start;
ObjNet[NbrItem].m_End = STRUCT->m_End; ObjNet[NbrItem].m_End = STRUCT->m_End;
if( STRUCT->m_Layer == LAYER_BUS ) if( STRUCT->GetLayer() == LAYER_BUS )
{ {
ObjNet[NbrItem].m_Type = NET_BUS; ObjNet[NbrItem].m_Type = NET_BUS;
} }
......
...@@ -22,7 +22,6 @@ ...@@ -22,7 +22,6 @@
#include "netlist.h" #include "netlist.h"
#include "protos.h" #include "protos.h"
#include "schframe.h"
#include "netlist_control.h" #include "netlist_control.h"
// ID for configuration: // ID for configuration:
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
static wxArrayString s_CmpNameList; static wxArrayString s_CmpNameList;
static wxArrayString s_PowerNameList; static wxArrayString s_PowerNameList;
...@@ -28,7 +26,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos ) ...@@ -28,7 +26,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
* quand un outil est deja selectionn� * quand un outil est deja selectionn�
*/ */
{ {
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem();
if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) ) if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
{ {
......
...@@ -20,8 +20,6 @@ ...@@ -20,8 +20,6 @@
#include "bitmaps.h" #include "bitmaps.h"
#include "schframe.h"
#include "Enter_Sheet.xpm" #include "Enter_Sheet.xpm"
#include "Leave_Sheet.xpm" #include "Leave_Sheet.xpm"
#include "Delete_Sheet.xpm" #include "Delete_Sheet.xpm"
...@@ -90,7 +88,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos, ...@@ -90,7 +88,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
* Ce menu est ensuite compl�t� par la liste des commandes de ZOOM * Ce menu est ensuite compl�t� par la liste des commandes de ZOOM
*/ */
{ {
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem(); SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem();
bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE); bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
...@@ -219,9 +217,8 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos, ...@@ -219,9 +217,8 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
break; break;
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
// if( !flags ) PopMenu->Append(ID_POPUP_SCH_MOVE_ITEM_REQUEST, "Move"); // if( !flags ) PopMenu->Append(ID_POPUP_SCH_MOVE_ITEM_REQUEST, "Move");
switch( ( (EDA_DrawLineStruct*) DrawStruct )->m_Layer ) switch( DrawStruct->GetLayer() )
{ {
case LAYER_WIRE: case LAYER_WIRE:
AddMenusForWire( PopMenu, (EDA_DrawLineStruct*) DrawStruct, this ); AddMenusForWire( PopMenu, (EDA_DrawLineStruct*) DrawStruct, this );
......
...@@ -362,7 +362,7 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem, ...@@ -362,7 +362,7 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
int orient, color = -1; int orient, color = -1;
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
color = ReturnLayerColor( Field->m_Layer ); color = ReturnLayerColor( Field->GetLayer() );
DrawMode = 0; /* Unused */ DrawMode = 0; /* Unused */
if( Field->m_Attributs & TEXT_NO_VISIBLE ) if( Field->m_Attributs & TEXT_NO_VISIBLE )
...@@ -670,7 +670,7 @@ static void PlotSheetLabelStruct( DrawSheetLabelStruct* Struct ) ...@@ -670,7 +670,7 @@ static void PlotSheetLabelStruct( DrawSheetLabelStruct* Struct )
int coord[16]; int coord[16];
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
txtcolor = ReturnLayerColor( Struct->m_Layer ); txtcolor = ReturnLayerColor( Struct->GetLayer() );
posx = Struct->m_Pos.x; posy = Struct->m_Pos.y; size = Struct->m_Size.x; posx = Struct->m_Pos.x; posy = Struct->m_Pos.y; size = Struct->m_Size.x;
if( Struct->m_Edge ) if( Struct->m_Edge )
......
...@@ -41,8 +41,6 @@ ...@@ -41,8 +41,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
/* coeff de conversion dim en 1 mil -> dim en unite HPGL: */ /* coeff de conversion dim en 1 mil -> dim en unite HPGL: */
#define SCALE_HPGL 1.02041 #define SCALE_HPGL 1.02041
...@@ -583,7 +581,7 @@ wxString msg; ...@@ -583,7 +581,7 @@ wxString msg;
#define STRUCT ((DrawBusEntryStruct*)DrawList) #define STRUCT ((DrawBusEntryStruct*)DrawList)
x1 = STRUCT->m_Pos.x; y1 = STRUCT->m_Pos.y; x1 = STRUCT->m_Pos.x; y1 = STRUCT->m_Pos.y;
x2 = STRUCT->m_End().x; y2 = STRUCT->m_End().y; x2 = STRUCT->m_End().x; y2 = STRUCT->m_End().y;
layer = STRUCT->m_Layer; layer = STRUCT->GetLayer();
case DRAW_SEGMENT_STRUCT_TYPE : case DRAW_SEGMENT_STRUCT_TYPE :
#undef STRUCT #undef STRUCT
#define STRUCT ((EDA_DrawLineStruct*)DrawList) #define STRUCT ((EDA_DrawLineStruct*)DrawList)
...@@ -591,7 +589,7 @@ wxString msg; ...@@ -591,7 +589,7 @@ wxString msg;
{ {
x1 = STRUCT->m_Start.x; y1 = STRUCT->m_Start.y; x1 = STRUCT->m_Start.x; y1 = STRUCT->m_Start.y;
x2 = STRUCT->m_End.x; y2 = STRUCT->m_End.y; x2 = STRUCT->m_End.x; y2 = STRUCT->m_End.y;
layer = STRUCT->m_Layer; layer = STRUCT->GetLayer();
} }
switch (layer) switch (layer)
{ {
......
...@@ -36,8 +36,6 @@ ...@@ -36,8 +36,6 @@
#include "plot_common.h" #include "plot_common.h"
#include "protos.h" #include "protos.h"
#include "schframe.h"
#include "wx/defs.h" #include "wx/defs.h"
// coeff de conversion dim en 1 mil -> dim en unite PS: // coeff de conversion dim en 1 mil -> dim en unite PS:
...@@ -379,7 +377,7 @@ void WinEDA_PlotPSFrame::PlotOneSheetPS(const wxString & FileName, ...@@ -379,7 +377,7 @@ void WinEDA_PlotPSFrame::PlotOneSheetPS(const wxString & FileName,
*/ */
{ {
wxString Line; wxString Line;
EDA_BaseStruct *DrawList; SCH_ITEM *DrawList;
SCH_COMPONENT *DrawLibItem; SCH_COMPONENT *DrawLibItem;
int layer; int layer;
wxPoint StartPos, EndPos; wxPoint StartPos, EndPos;
...@@ -424,7 +422,7 @@ wxPoint StartPos, EndPos; ...@@ -424,7 +422,7 @@ wxPoint StartPos, EndPos;
#define STRUCT ((DrawBusEntryStruct*)DrawList) #define STRUCT ((DrawBusEntryStruct*)DrawList)
StartPos = STRUCT->m_Pos; StartPos = STRUCT->m_Pos;
EndPos = STRUCT->m_End(); EndPos = STRUCT->m_End();
layer = STRUCT->m_Layer; layer = STRUCT->GetLayer();
case DRAW_SEGMENT_STRUCT_TYPE : case DRAW_SEGMENT_STRUCT_TYPE :
#undef STRUCT #undef STRUCT
#define STRUCT ((EDA_DrawLineStruct*)DrawList) #define STRUCT ((EDA_DrawLineStruct*)DrawList)
...@@ -432,7 +430,7 @@ wxPoint StartPos, EndPos; ...@@ -432,7 +430,7 @@ wxPoint StartPos, EndPos;
{ {
StartPos = STRUCT->m_Start; StartPos = STRUCT->m_Start;
EndPos = STRUCT->m_End; EndPos = STRUCT->m_End;
layer = STRUCT->m_Layer; layer = STRUCT->GetLayer();
} }
if ( g_PlotPSColorOpt ) if ( g_PlotPSColorOpt )
SetColorMapPS ( ReturnLayerColor(layer) ); SetColorMapPS ( ReturnLayerColor(layer) );
...@@ -467,7 +465,7 @@ wxPoint StartPos, EndPos; ...@@ -467,7 +465,7 @@ wxPoint StartPos, EndPos;
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawJunctionStruct*)DrawList) #define STRUCT ((DrawJunctionStruct*)DrawList)
if ( g_PlotPSColorOpt ) if ( g_PlotPSColorOpt )
SetColorMapPS (ReturnLayerColor(STRUCT->m_Layer) ); SetColorMapPS (ReturnLayerColor(STRUCT->GetLayer()) );
PlotCercle( STRUCT->m_Pos, DRAWJUNCTION_SIZE); PlotCercle( STRUCT->m_Pos, DRAWJUNCTION_SIZE);
break; break;
...@@ -507,7 +505,7 @@ wxPoint StartPos, EndPos; ...@@ -507,7 +505,7 @@ wxPoint StartPos, EndPos;
} }
Plume('U'); Plume('U');
DrawList = DrawList->Pnext; DrawList = DrawList->Next();
} }
/* fin */ /* fin */
......
...@@ -9,8 +9,10 @@ ...@@ -9,8 +9,10 @@
#define eda_global extern #define eda_global extern
#endif #endif
#include "wxEeschemaStruct.h"
#include "macros.h" #include "macros.h"
#include "base_struct.h" #include "base_struct.h"
#include "sch_item_struct.h"
#include "component_class.h" #include "component_class.h"
#include "class_screen.h" #include "class_screen.h"
...@@ -63,10 +65,9 @@ class DrawSheetStruct; ...@@ -63,10 +65,9 @@ class DrawSheetStruct;
* is a segment decription base class to describe items which have 2 end * is a segment decription base class to describe items which have 2 end
* points (track, wire, draw line ...) * points (track, wire, draw line ...)
*/ */
class EDA_DrawLineStruct : public EDA_BaseStruct class EDA_DrawLineStruct : public SCH_ITEM
{ {
public: public:
int m_Layer; // Layer number
int m_Width; // 0 = line, > 0 = tracks, bus ... int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point wxPoint m_End; // Line end point
...@@ -110,7 +111,7 @@ public: ...@@ -110,7 +111,7 @@ public:
}; };
class DrawMarkerStruct : public EDA_BaseStruct /* marqueurs */ class DrawMarkerStruct : public SCH_ITEM /* marqueurs */
{ {
public: public:
wxPoint m_Pos; /* XY coordinates of marker. */ wxPoint m_Pos; /* XY coordinates of marker. */
...@@ -144,7 +145,7 @@ public: ...@@ -144,7 +145,7 @@ public:
}; };
class DrawNoConnectStruct : public EDA_BaseStruct /* Symboles de non connexion */ class DrawNoConnectStruct : public SCH_ITEM /* Symboles de non connexion */
{ {
public: public:
wxPoint m_Pos; /* XY coordinates of NoConnect. */ wxPoint m_Pos; /* XY coordinates of NoConnect. */
...@@ -169,10 +170,9 @@ public: ...@@ -169,10 +170,9 @@ public:
* Class DrawBusEntryStruct * Class DrawBusEntryStruct
* Struct de descr 1 raccord a 45 degres de BUS ou WIRE * Struct de descr 1 raccord a 45 degres de BUS ou WIRE
*/ */
class DrawBusEntryStruct : public EDA_BaseStruct class DrawBusEntryStruct : public SCH_ITEM
{ {
public: public:
int m_Layer;
int m_Width; int m_Width;
wxPoint m_Pos; wxPoint m_Pos;
wxSize m_Size; wxSize m_Size;
...@@ -194,10 +194,9 @@ public: ...@@ -194,10 +194,9 @@ public:
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox();
}; };
class DrawPolylineStruct : public EDA_BaseStruct /* Polyligne (serie de segments) */ class DrawPolylineStruct : public SCH_ITEM /* Polyligne (serie de segments) */
{ {
public: public:
int m_Layer;
int m_Width; int m_Width;
int m_NumOfPoints; /* Number of XY pairs in Points array. */ int m_NumOfPoints; /* Number of XY pairs in Points array. */
int* m_Points; /* XY pairs that forms the polyline. */ int* m_Points; /* XY pairs that forms the polyline. */
...@@ -217,10 +216,9 @@ public: ...@@ -217,10 +216,9 @@ public:
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
}; };
class DrawJunctionStruct : public EDA_BaseStruct class DrawJunctionStruct : public SCH_ITEM
{ {
public: public:
int m_Layer;
wxPoint m_Pos; /* XY coordinates of connection. */ wxPoint m_Pos; /* XY coordinates of connection. */
public: public:
......
...@@ -10,10 +10,6 @@ LibEDA_BaseStruct * LocatePin(const wxPoint & RefPos, ...@@ -10,10 +10,6 @@ LibEDA_BaseStruct * LocatePin(const wxPoint & RefPos,
const wxString& ReturnDefaultFieldName( int aFieldNdx ); const wxString& ReturnDefaultFieldName( int aFieldNdx );
/***************/
/* FILE_IO.CPP */
/***************/
/****************/ /****************/
/* DATABASE.CPP */ /* DATABASE.CPP */
...@@ -67,7 +63,7 @@ bool MapAngles(int *Angle1, int *Angle2, int TransMat[2][2]); ...@@ -67,7 +63,7 @@ bool MapAngles(int *Angle1, int *Angle2, int TransMat[2][2]);
/**************/ /**************/
/* EELIBS1.CPP */ /* EELIBS_DRAW_COMPONENTS.CPP */
/**************/ /**************/
EDA_LibComponentStruct * Read_Component_Definition(WinEDA_DrawFrame * frame, char * Line, EDA_LibComponentStruct * Read_Component_Definition(WinEDA_DrawFrame * frame, char * Line,
FILE *f, int *LineNum); FILE *f, int *LineNum);
...@@ -87,15 +83,6 @@ void SnapLibItemPoint(int OrigX, int OrigY, int *ClosestX, int *ClosestY, ...@@ -87,15 +83,6 @@ void SnapLibItemPoint(int OrigX, int OrigY, int *ClosestX, int *ClosestY,
SCH_COMPONENT *DrawLibItem); SCH_COMPONENT *DrawLibItem);
bool LibItemInBox(int x1, int y1, int x2, int y2, bool LibItemInBox(int x1, int y1, int x2, int y2,
SCH_COMPONENT *DrawLibItem); SCH_COMPONENT *DrawLibItem);
void DrawTextField(WinEDA_DrawPanel * panel, wxDC * DC, PartTextStruct * Field, int IsMulti, int DrawMode);
/* Routine de trace des textes type Field du composant.
entree:
Field: champ
IsMulti: flag Non Null si il y a plusieurs parts par boitier.
n'est utile que pour le champ reference pour ajouter a celui ci
l'identification de la part ( A, B ... )
DrawMode: mode de trace */
char * StrPurge(char * text); char * StrPurge(char * text);
/* Supprime les caracteres Space en debut de la ligne text /* Supprime les caracteres Space en debut de la ligne text
retourne un pointeur sur le 1er caractere non Space de text */ retourne un pointeur sur le 1er caractere non Space de text */
...@@ -103,15 +90,15 @@ char * StrPurge(char * text); ...@@ -103,15 +90,15 @@ char * StrPurge(char * text);
/************/ /************/
/* BLOCK.CPP */ /* BLOCK.CPP */
/************/ /************/
EDA_BaseStruct * DuplicateStruct(EDA_BaseStruct *DrawStruct); SCH_ITEM * DuplicateStruct(SCH_ITEM *DrawStruct);
void MoveOneStruct(EDA_BaseStruct *DrawStructs, const wxPoint & move_vector); void MoveOneStruct(SCH_ITEM *DrawStructs, const wxPoint & move_vector);
/* Given a structure move it by move_vector.x, move_vector.y. */ /* Given a structure move it by move_vector. */
bool PlaceStruct(BASE_SCREEN * screen, EDA_BaseStruct *DrawStruct); bool PlaceStruct(BASE_SCREEN * screen, SCH_ITEM *DrawStruct);
bool MoveStruct(WinEDA_DrawPanel * panel, wxDC * DC, EDA_BaseStruct *DrawStruct); bool MoveStruct(WinEDA_DrawPanel * panel, wxDC * DC, SCH_ITEM *DrawStruct);
void DeleteStruct(WinEDA_DrawPanel * panel, wxDC * DC, EDA_BaseStruct *DrawStruct); void DeleteStruct(WinEDA_DrawPanel * panel, wxDC * DC, SCH_ITEM *DrawStruct);
bool DrawStructInBox(int x1, int y1, int x2, int y2, bool DrawStructInBox(int x1, int y1, int x2, int y2,
EDA_BaseStruct *DrawStruct); SCH_ITEM *DrawStruct);
/*************/ /*************/
/* LOCATE.CPP */ /* LOCATE.CPP */
...@@ -122,12 +109,10 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number, ...@@ -122,12 +109,10 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
SCH_COMPONENT * LocateSmallestComponent( SCH_SCREEN * Screen ); SCH_COMPONENT * LocateSmallestComponent( SCH_SCREEN * Screen );
/* Recherche du plus petit (en surface) composant pointe par la souris */ /* Recherche du plus petit (en surface) composant pointe par la souris */
EDA_BaseStruct * PickStruct(EDA_Rect & block, SCH_ITEM * PickStruct(EDA_Rect & block, BASE_SCREEN* screen, int SearchMask );
BASE_SCREEN* screen, int SearchMask ); SCH_ITEM * PickStruct(const wxPoint & refpos, BASE_SCREEN* screen, int SearchMask);
EDA_BaseStruct * PickStruct(const wxPoint & refpos, /* 2 functions PickStruct:
BASE_SCREEN* screen, int SearchMask); Search in block, or Search at location pos
/* 2 functions EDA_BaseStruct * PickStruct:
Search in block, or Serach at location pos
SearchMask = (bitwise OR): SearchMask = (bitwise OR):
LIBITEM LIBITEM
...@@ -167,11 +152,11 @@ LibEDA_BaseStruct * LocateDrawItem(SCH_SCREEN * Screen, const wxPoint & refpoint ...@@ -167,11 +152,11 @@ LibEDA_BaseStruct * LocateDrawItem(SCH_SCREEN * Screen, const wxPoint & refpoint
EDA_LibComponentStruct * LibEntry, int Unit, int Convert, int masque); EDA_LibComponentStruct * LibEntry, int Unit, int Convert, int masque);
DrawSheetLabelStruct * LocateSheetLabel(DrawSheetStruct *Sheet, const wxPoint & pos); DrawSheetLabelStruct * LocateSheetLabel(DrawSheetStruct *Sheet, const wxPoint & pos);
LibDrawPin * LocateAnyPin(EDA_BaseStruct *DrawList, const wxPoint & RefPos, LibDrawPin * LocateAnyPin(SCH_ITEM *DrawList, const wxPoint & RefPos,
SCH_COMPONENT ** libpart = NULL ); SCH_COMPONENT ** libpart = NULL );
DrawSheetLabelStruct * LocateAnyPinSheet(const wxPoint & RefPos, DrawSheetLabelStruct * LocateAnyPinSheet(const wxPoint & RefPos,
EDA_BaseStruct *DrawList); SCH_ITEM *DrawList);
int distance(int dx, int dy, int spot_cX, int spot_cY, int seuil); int distance(int dx, int dy, int spot_cX, int spot_cY, int seuil);
/* Calcul de la distance du point spot_cx,spot_cy a un segment de droite, /* Calcul de la distance du point spot_cx,spot_cy a un segment de droite,
...@@ -198,12 +183,12 @@ void Draw_Marqueur(WinEDA_DrawPanel * panel, wxDC * DC, ...@@ -198,12 +183,12 @@ void Draw_Marqueur(WinEDA_DrawPanel * panel, wxDC * DC,
wxPoint pos, char* pt_bitmap, int DrawMode, int Color); wxPoint pos, char* pt_bitmap, int DrawMode, int Color);
void DrawStructsInGhost(WinEDA_DrawPanel * panel, wxDC * DC, void DrawStructsInGhost(WinEDA_DrawPanel * panel, wxDC * DC,
EDA_BaseStruct * DrawStruct, int dx, int dy ); SCH_ITEM * DrawStruct, int dx, int dy );
void SetHighLightStruct(EDA_BaseStruct *HighLight); void SetHighLightStruct(SCH_ITEM *HighLight);
void RedrawActiveWindow(WinEDA_DrawPanel * panel, wxDC * DC); void RedrawActiveWindow(WinEDA_DrawPanel * panel, wxDC * DC);
void RedrawStructList(WinEDA_DrawPanel * panel, wxDC * DC, EDA_BaseStruct *Structs, int DrawMode, void RedrawStructList(WinEDA_DrawPanel * panel, wxDC * DC, SCH_ITEM *Structs, int DrawMode,
int Color = -1); int Color = -1);
void RedrawOneStruct(WinEDA_DrawPanel * panel, wxDC * DC, EDA_BaseStruct *Struct, int DrawMode, void RedrawOneStruct(WinEDA_DrawPanel * panel, wxDC * DC, SCH_ITEM *Struct, int DrawMode,
int Color = -1); int Color = -1);
/**************/ /**************/
...@@ -218,12 +203,6 @@ void DisplayColorSetupFrame(WinEDA_DrawFrame * parent, const wxPoint & pos); ...@@ -218,12 +203,6 @@ void DisplayColorSetupFrame(WinEDA_DrawFrame * parent, const wxPoint & pos);
/*************/ /*************/
int CountCmpNumber(); int CountCmpNumber();
/***************/
/* EESTRING.CPP */
/***************/
/***************/ /***************/
/* EECONFIG.CPP */ /* EECONFIG.CPP */
/***************/ /***************/
...@@ -335,7 +314,7 @@ bool ClearProjectDrawList(SCH_SCREEN * FirstWindow, bool confirm_deletion); ...@@ -335,7 +314,7 @@ bool ClearProjectDrawList(SCH_SCREEN * FirstWindow, bool confirm_deletion);
/*************/ /*************/
bool LocateAndDeleteItem(WinEDA_SchematicFrame * frame, wxDC * DC); bool LocateAndDeleteItem(WinEDA_SchematicFrame * frame, wxDC * DC);
void EraseStruct(EDA_BaseStruct *DrawStruct, SCH_SCREEN * Window); void EraseStruct(SCH_ITEM *DrawStruct, SCH_SCREEN * Window);
void DeleteAllMarkers(int type); void DeleteAllMarkers(int type);
/* Effacement des marqueurs du type "type" */ /* Effacement des marqueurs du type "type" */
......
...@@ -13,12 +13,6 @@ ...@@ -13,12 +13,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
/* Format des fichiers: Voir EELOAD.CC */
/* Fonctions externes */
/* Fonctions Locales */ /* Fonctions Locales */
static void SaveLayers(FILE *f); static void SaveLayers(FILE *f);
...@@ -155,8 +149,8 @@ bool WinEDA_SchematicFrame::SaveEEFile(SCH_SCREEN *screen, int FileSave) ...@@ -155,8 +149,8 @@ bool WinEDA_SchematicFrame::SaveEEFile(SCH_SCREEN *screen, int FileSave)
#undef STRUCT #undef STRUCT
#define STRUCT ((EDA_DrawLineStruct *) Phead) #define STRUCT ((EDA_DrawLineStruct *) Phead)
layer = "Notes"; width = "Line"; layer = "Notes"; width = "Line";
if (STRUCT->m_Layer == LAYER_WIRE) layer = "Wire"; if (STRUCT->GetLayer() == LAYER_WIRE) layer = "Wire";
if (STRUCT->m_Layer == LAYER_BUS) layer = "Bus"; if (STRUCT->GetLayer() == LAYER_BUS) layer = "Bus";
if( STRUCT->m_Width != GR_NORM_WIDTH) layer = "Bus"; if( STRUCT->m_Width != GR_NORM_WIDTH) layer = "Bus";
if (fprintf(f, "Wire %s %s\n", layer, width ) == EOF) if (fprintf(f, "Wire %s %s\n", layer, width ) == EOF)
{ {
...@@ -174,7 +168,7 @@ bool WinEDA_SchematicFrame::SaveEEFile(SCH_SCREEN *screen, int FileSave) ...@@ -174,7 +168,7 @@ bool WinEDA_SchematicFrame::SaveEEFile(SCH_SCREEN *screen, int FileSave)
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawBusEntryStruct *) Phead) #define STRUCT ((DrawBusEntryStruct *) Phead)
layer = "Wire"; width = "Line"; layer = "Wire"; width = "Line";
if (STRUCT->m_Layer == LAYER_BUS) if (STRUCT->GetLayer() == LAYER_BUS)
{ {
layer = "Bus"; width = "Bus"; layer = "Bus"; width = "Bus";
} }
...@@ -195,8 +189,8 @@ bool WinEDA_SchematicFrame::SaveEEFile(SCH_SCREEN *screen, int FileSave) ...@@ -195,8 +189,8 @@ bool WinEDA_SchematicFrame::SaveEEFile(SCH_SCREEN *screen, int FileSave)
#undef STRUCT #undef STRUCT
#define STRUCT ((DrawPolylineStruct *) Phead) #define STRUCT ((DrawPolylineStruct *) Phead)
layer = "Notes"; width = "Line"; layer = "Notes"; width = "Line";
if (STRUCT->m_Layer == LAYER_WIRE) layer = "Wire"; if (STRUCT->GetLayer() == LAYER_WIRE) layer = "Wire";
if (STRUCT->m_Layer == LAYER_BUS) layer = "Bus"; if (STRUCT->GetLayer() == LAYER_BUS) layer = "Bus";
if( STRUCT->m_Width != GR_NORM_WIDTH) width = "Bus"; if( STRUCT->m_Width != GR_NORM_WIDTH) width = "Bus";
if (fprintf(f, "Poly %s %s %d\n", if (fprintf(f, "Poly %s %s %d\n",
width, layer, STRUCT->m_NumOfPoints) == EOF) width, layer, STRUCT->m_NumOfPoints) == EOF)
......
...@@ -15,8 +15,6 @@ ...@@ -15,8 +15,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
/***************************************************************************** /*****************************************************************************
* *
...@@ -354,7 +352,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -354,7 +352,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_DELETE: case ID_POPUP_SCH_DELETE:
if( GetScreen()->GetCurItem() == NULL ) if( GetScreen()->GetCurItem() == NULL )
break; break;
DeleteStruct( this->DrawPanel, &dc, GetScreen()->GetCurItem() ); DeleteStruct( DrawPanel, &dc, (SCH_ITEM*)GetScreen()->GetCurItem() );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
TestDanglingEnds( GetScreen()->EEDrawList, &dc ); TestDanglingEnds( GetScreen()->EEDrawList, &dc );
...@@ -367,19 +365,17 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -367,19 +365,17 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_END_SHEET: case ID_POPUP_SCH_END_SHEET:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
GetScreen()->GetCurItem()->Place( this, &dc ); ((SCH_ITEM*)GetScreen()->GetCurItem())->Place( this, &dc );
break; break;
case ID_POPUP_SCH_RESIZE_SHEET: case ID_POPUP_SCH_RESIZE_SHEET:
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
ReSizeSheet( (DrawSheetStruct*) ReSizeSheet( (DrawSheetStruct*) GetScreen()->GetCurItem(), &dc );
GetScreen()->GetCurItem(), &dc );
TestDanglingEnds( GetScreen()->EEDrawList, &dc ); TestDanglingEnds( GetScreen()->EEDrawList, &dc );
break; break;
case ID_POPUP_SCH_EDIT_SHEET: case ID_POPUP_SCH_EDIT_SHEET:
EditSheet( (DrawSheetStruct*) EditSheet( (DrawSheetStruct*) GetScreen()->GetCurItem(), &dc );
GetScreen()->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_CLEANUP_SHEET: case ID_POPUP_SCH_CLEANUP_SHEET:
...@@ -424,7 +420,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -424,7 +420,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
} }
} }
else else
Process_Move_Item( GetScreen()->GetCurItem(), &dc ); Process_Move_Item( (SCH_ITEM*) GetScreen()->GetCurItem(), &dc );
break; break;
case ID_POPUP_SCH_EDIT_CMP: case ID_POPUP_SCH_EDIT_CMP:
...@@ -477,7 +473,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -477,7 +473,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if( GetScreen()->GetCurItem()->m_Flags == 0 ) if( GetScreen()->GetCurItem()->m_Flags == 0 )
SaveCopyInUndoList( GetScreen()->GetCurItem(), IS_CHANGED ); SaveCopyInUndoList( (SCH_ITEM*) GetScreen()->GetCurItem(), IS_CHANGED );
CmpRotationMiroir( CmpRotationMiroir(
(SCH_COMPONENT*) GetScreen()->GetCurItem(), (SCH_COMPONENT*) GetScreen()->GetCurItem(),
...@@ -705,7 +701,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -705,7 +701,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
LAYER_LOCLABEL : LAYER_GLOBLABEL ) ); LAYER_LOCLABEL : LAYER_GLOBLABEL ) );
if( GetScreen()->GetCurItem() ) if( GetScreen()->GetCurItem() )
{ {
GetScreen()->GetCurItem()->Place( this, &dc ); ((SCH_ITEM*)GetScreen()->GetCurItem())->Place( this, &dc );
TestDanglingEnds( GetScreen()->EEDrawList, &dc ); TestDanglingEnds( GetScreen()->EEDrawList, &dc );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
} }
...@@ -738,14 +734,12 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -738,14 +734,12 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
if( m_ID_current_state == 0 ) if( m_ID_current_state == 0 )
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
SetToolbars(); SetToolbars();
dc.SetBrush( wxNullBrush );
dc.SetPen( wxNullPen );
} }
void WinEDA_SchematicFrame::Process_Move_Item( EDA_BaseStruct* DrawStruct, /*************************************************************************************/
wxDC* DC ) void WinEDA_SchematicFrame::Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC )
/*************************************************************************************/
{ {
if( DrawStruct == NULL ) if( DrawStruct == NULL )
return; return;
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
/* Functions to undo and redo edit commands. /* Functions to undo and redo edit commands.
* commmands to undo are in CurrentScreen->m_UndoList * commmands to undo are in CurrentScreen->m_UndoList
* commmands to redo are in CurrentScreen->m_RedoList * commmands to redo are in CurrentScreen->m_RedoList
...@@ -176,7 +174,7 @@ void SwapData( EDA_BaseStruct* Item ) ...@@ -176,7 +174,7 @@ void SwapData( EDA_BaseStruct* Item )
/***********************************************************************/ /***********************************************************************/
void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, void WinEDA_SchematicFrame::SaveCopyInUndoList( SCH_ITEM * ItemToCopy,
int flag_type_command ) int flag_type_command )
/***********************************************************************/ /***********************************************************************/
...@@ -205,7 +203,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, ...@@ -205,7 +203,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
* saved in Undo List (for Undo or Redo commands, saved wires will be exchanged with current wire list * saved in Undo List (for Undo or Redo commands, saved wires will be exchanged with current wire list
*/ */
{ {
EDA_BaseStruct* CopyItem; SCH_ITEM* CopyItem;
DrawPickedStruct* NewList = new DrawPickedStruct( NULL ); DrawPickedStruct* NewList = new DrawPickedStruct( NULL );
...@@ -228,7 +226,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, ...@@ -228,7 +226,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
CopyItem = PickedList->m_PickedStruct; CopyItem = PickedList->m_PickedStruct;
CopyItem->m_Flags = flag_type_command; CopyItem->m_Flags = flag_type_command;
PickedList->m_Image = CopyItem->m_Image; PickedList->m_Image = CopyItem->m_Image;
PickedList = (DrawPickedStruct*) PickedList->Pnext; PickedList = PickedList->Next();
} }
} }
else else
...@@ -249,7 +247,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, ...@@ -249,7 +247,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
PickedList->m_Image = CopyItem; PickedList->m_Image = CopyItem;
PickedList->m_PickedStruct = NULL; PickedList->m_PickedStruct = NULL;
PickedList->m_Flags = flag_type_command; PickedList->m_Flags = flag_type_command;
PickedList = (DrawPickedStruct*) PickedList->Pnext; PickedList = PickedList->Next();
} }
} }
else else
...@@ -274,7 +272,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, ...@@ -274,7 +272,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
CopyItem = PickedList->m_PickedStruct; CopyItem = PickedList->m_PickedStruct;
CopyItem->m_Flags = flag_type_command; CopyItem->m_Flags = flag_type_command;
PickedList->m_Flags = flag_type_command; PickedList->m_Flags = flag_type_command;
PickedList = (DrawPickedStruct*) PickedList->Pnext; PickedList = PickedList->Next();
} }
} }
break; break;
...@@ -329,8 +327,8 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List ) ...@@ -329,8 +327,8 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
* Put data pointed by List in the previous state, i.e. the state memorised by List * Put data pointed by List in the previous state, i.e. the state memorised by List
*/ */
{ {
EDA_BaseStruct* FirstItem = List->m_Son; SCH_ITEM* FirstItem = (SCH_ITEM*) List->m_Son;
EDA_BaseStruct* item; SCH_ITEM* item;
DrawPickedStruct* PickedList; DrawPickedStruct* PickedList;
switch( List->m_Flags ) switch( List->m_Flags )
...@@ -363,7 +361,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List ) ...@@ -363,7 +361,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
PickedList = (DrawPickedStruct*) FirstItem; PickedList = (DrawPickedStruct*) FirstItem;
while( PickedList ) while( PickedList )
{ {
item = PickedList->m_Image; item = (SCH_ITEM*) PickedList->m_Image;
( (SCH_SCREEN*) GetScreen() )->RemoveFromDrawList( item ); ( (SCH_SCREEN*) GetScreen() )->RemoveFromDrawList( item );
item->m_Flags = IS_DELETED; item->m_Flags = IS_DELETED;
PickedList->m_PickedStruct = item; PickedList->m_PickedStruct = item;
...@@ -373,7 +371,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List ) ...@@ -373,7 +371,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
} }
else else
{ {
FirstItem = List->m_Image; FirstItem = (SCH_ITEM*)List->m_Image;
( (SCH_SCREEN*) GetScreen() )->RemoveFromDrawList( FirstItem ); ( (SCH_SCREEN*) GetScreen() )->RemoveFromDrawList( FirstItem );
FirstItem->m_Flags = IS_DELETED; FirstItem->m_Flags = IS_DELETED;
List->m_Son = FirstItem; List->m_Son = FirstItem;
...@@ -412,7 +410,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List ) ...@@ -412,7 +410,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
List->m_Son = ( (SCH_SCREEN*) GetScreen() )->ExtractWires( FALSE ); List->m_Son = ( (SCH_SCREEN*) GetScreen() )->ExtractWires( FALSE );
while( FirstItem ) while( FirstItem )
{ {
EDA_BaseStruct* nextitem = FirstItem->Pnext; SCH_ITEM* nextitem = FirstItem->Next();
FirstItem->Pnext = GetScreen()->EEDrawList; FirstItem->Pnext = GetScreen()->EEDrawList;
GetScreen()->EEDrawList = FirstItem; GetScreen()->EEDrawList = FirstItem;
FirstItem->m_Flags = 0; FirstItem->m_Flags = 0;
...@@ -438,7 +436,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List ) ...@@ -438,7 +436,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
break; break;
case IS_NEW: case IS_NEW:
item = PickedList->m_Image; item = (SCH_ITEM*) PickedList->m_Image;
( (SCH_SCREEN*) GetScreen() )->RemoveFromDrawList( item ); ( (SCH_SCREEN*) GetScreen() )->RemoveFromDrawList( item );
item->m_Flags = IS_DELETED; item->m_Flags = IS_DELETED;
PickedList->m_PickedStruct = item; PickedList->m_PickedStruct = item;
......
...@@ -17,7 +17,6 @@ ...@@ -17,7 +17,6 @@
#include "protos.h" #include "protos.h"
#include "id.h" #include "id.h"
#include "netlist.h" #include "netlist.h"
#include "schframe.h"
#include "annotate_dialog.h" #include "annotate_dialog.h"
#include "dialog_build_BOM.h" #include "dialog_build_BOM.h"
......
/*****************************************************************************
*
* schframe.h
*
* Header for class definition of WinEDA_SchematicFrame. This is the main
* window for EESchema.
*
*****************************************************************************/
#ifndef _SCHFRAME_H_
#define _SCHFRAME_H_
class WinEDA_DrawFrame;
class WinEDA_SchematicFrame : public WinEDA_DrawFrame
{
public:
WinEDAChoiceBox* m_SelPartBox;
DrawSheetPath* m_CurrentSheet; //which sheet we are presently working on.
private:
wxMenu* m_FilesMenu;
public:
WinEDA_SchematicFrame( wxWindow* father, WinEDA_App* parent,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_SchematicFrame();
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event );
void Save_Config( wxWindow* displayframe );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void CreateScreens();
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
void SetToolbars();
void OnHotKey( wxDC* DC,
int hotkey,
EDA_BaseStruct* DrawStruct );
DrawSheetPath* GetSheet();
virtual BASE_SCREEN* GetScreen();
virtual void SetScreen(SCH_SCREEN* screen);
virtual wxString GetScreenDesc();
void InstallConfigFrame( const wxPoint& pos );
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event );
void ToolOnRightClick( wxCommandEvent& event );
int BestZoom(); // Retourne le meilleur zoom
EDA_BaseStruct* SchematicGeneralLocateAndDisplay( bool IncludePin = TRUE );
EDA_BaseStruct* SchematicGeneralLocateAndDisplay( const wxPoint& refpoint,
bool IncludePin );
EDA_BaseStruct* FindComponentAndItem( const wxString& component_reference,
bool Find_in_hierarchy,
int SearchType,
const wxString& text_to_find,
bool mouseWarp );
/* Cross probing with pcbnew */
void SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
SCH_COMPONENT* LibItem );
/* netlist generation */
void* BuildNetListBase();
// FUnctions used for hierarchy handling
void InstallPreviousSheet();
void InstallNextScreen( DrawSheetStruct* Sheet );
void ToPlot_PS( wxCommandEvent& event );
void ToPlot_HPGL( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event );
void Save_File( wxCommandEvent& event );
void SaveProject();
int LoadOneEEProject( const wxString& FileName, bool IsNew );
bool LoadOneEEFile(SCH_SCREEN* screen, const wxString& FullFileName );
bool SaveEEFile( SCH_SCREEN* screen, int FileSave );
SCH_SCREEN * CreateNewScreen(SCH_SCREEN * OldScreen, int TimeStamp);
// General search:
/**
* Function FindSchematicItem
* finds a string in the schematic.
* @param pattern The text to search for, either in value, reference or
* elsewhere.
* @param SearchType: 0 => Search is made in current sheet
* 1 => the whole hierarchy
* 2 => or for the next item
* @param mouseWarp If true, then move the mouse cursor to the item.
*/
EDA_BaseStruct* FindSchematicItem( const wxString& pattern,
int SearchType,
bool mouseWarp = true );
EDA_BaseStruct* FindMarker( int SearchType );
private:
void Process_Move_Item( EDA_BaseStruct* DrawStruct, wxDC* DC );
void OnExit( wxCommandEvent& event );
void OnAnnotate ( wxCommandEvent& event );
void OnErc( wxCommandEvent& event );
void OnCreateNetlist( wxCommandEvent& event );
void OnCreateBillOfMaterials( wxCommandEvent& event );
void OnFindItems( wxCommandEvent& event );
void OnLoadFile( wxCommandEvent& event );
void OnNewProject( wxCommandEvent& event );
void OnLoadProject( wxCommandEvent& event );
void OnOpenPcbnew( wxCommandEvent& event );
void OnOpenCvpcb( wxCommandEvent& event );
void OnOpenLibraryViewer( wxCommandEvent& event );
void OnOpenLibraryEditor( wxCommandEvent& event );
// Bus Entry
DrawBusEntryStruct* CreateBusEntry( wxDC* DC, int entry_type );
void SetBusEntryShape( wxDC* DC,
DrawBusEntryStruct* BusEntry,
int entry_type );
int GetBusEntryShape( DrawBusEntryStruct* BusEntry );
void StartMoveBusEntry( DrawBusEntryStruct* DrawLibItem, wxDC* DC );
// NoConnect
EDA_BaseStruct* CreateNewNoConnectStruct( wxDC* DC );
// Junction
DrawJunctionStruct* CreateNewJunctionStruct( wxDC* DC,
const wxPoint& pos,
bool PutInUndoList = FALSE );
// Text ,label, glabel
EDA_BaseStruct* CreateNewText( wxDC* DC, int type );
void EditSchematicText( SCH_TEXT* TextStruct, wxDC* DC );
void ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC );
void StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC );
void ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype );
// Wire, Bus
void BeginSegment( wxDC* DC, int type );
void EndSegment( wxDC* DC );
void DeleteCurrentSegment( wxDC* DC );
void DeleteConnection( wxDC* DC, bool DeleteFullConnection );
// graphic lines
void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC );
void Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC );
DRAWSEGMENT* Begin_Edge( DRAWSEGMENT* Segment, wxDC* DC );
// Hierarchical Sheet & PinSheet
void InstallHierarchyFrame( wxDC* DC, wxPoint& pos );
DrawSheetStruct* CreateSheet( wxDC* DC );
void ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC );
public:
bool EditSheet( DrawSheetStruct* Sheet, wxDC* DC );
/** Function UpdateSheetNumberAndDate
* Set a sheet number, the sheet count for sheets in the whole schematic
* and update the date in all screens
*/
void UpdateSheetNumberAndDate();
private:
void StartMoveSheet( DrawSheetStruct* sheet, wxDC* DC );
DrawSheetLabelStruct* Create_PinSheet( DrawSheetStruct* Sheet, wxDC* DC );
void Edit_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC );
void StartMove_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC );
void Place_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC );
DrawSheetLabelStruct* Import_PinSheet( DrawSheetStruct* Sheet, wxDC* DC );
public:
void DeleteSheetLabel( wxDC* DC, DrawSheetLabelStruct* SheetLabelToDel );
private:
// Component
SCH_COMPONENT* Load_Component( wxDC* DC,
const wxString& libname,
wxArrayString& List,
bool UseLibBrowser );
void StartMovePart( SCH_COMPONENT* DrawLibItem, wxDC* DC );
public:
void CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
wxDC* DC, int type_rotate );
private:
void SelPartUnit( SCH_COMPONENT* DrawComponent,
int unit, wxDC* DC );
void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC );
void SetInitCmp( SCH_COMPONENT* DrawComponent, wxDC* DC );
void EditComponentReference( SCH_COMPONENT* DrawLibItem,
wxDC* DC );
void EditComponentValue( SCH_COMPONENT* DrawLibItem, wxDC* DC );
void EditComponentFootprint( SCH_COMPONENT* DrawLibItem,
wxDC* DC );
void StartMoveCmpField( PartTextStruct* Field, wxDC* DC );
void EditCmpFieldText( PartTextStruct* Field, wxDC* DC );
void RotateCmpField( PartTextStruct* Field, wxDC* DC );
/* Operations sur bloc */
void PasteStruct( wxDC* DC );
/* Undo - redo */
public:
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
int flag_type_command = 0 );
private:
void PutDataInPreviousState( DrawPickedStruct* List );
bool GetSchematicFromRedoList();
bool GetSchematicFromUndoList();
public:
void Key( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
/* Gestion generale des operations sur block */
int ReturnBlockCommand( int key );
void InitBlockPasteInfos();
void HandleBlockPlace( wxDC* DC );
int HandleBlockEnd( wxDC* DC );
void HandleBlockEndByPopUp( int Command, wxDC* DC );
// Repetition automatique de placements
void RepeatDrawItem( wxDC* DC );
// Test des points de connexion en l'air (dangling ends)
void TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC );
LibDrawPin* LocatePinEnd( EDA_BaseStruct* DrawList, const wxPoint& pos );
DECLARE_EVENT_TABLE()
};
#endif /* _SCHFRAME_H_ */
...@@ -39,8 +39,6 @@ ...@@ -39,8 +39,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
/* Routines Locales */ /* Routines Locales */
static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC ); static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC );
static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ); static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
...@@ -343,9 +341,9 @@ void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event ) ...@@ -343,9 +341,9 @@ void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event )
/*************************************************************************/ /*************************************************************************/
bool WinEDA_SchematicFrame::EditSheet( DrawSheetStruct* Sheet, wxDC* DC ) bool WinEDA_SchematicFrame::EditSheet( DrawSheetStruct* Sheet, wxDC* DC )
{
/*************************************************************************/ /*************************************************************************/
/* Routine to edit the SheetName and the FileName for the sheet "Sheet" */ /* Routine to edit the SheetName and the FileName for the sheet "Sheet" */
{
WinEDA_SheetPropertiesFrame* frame; WinEDA_SheetPropertiesFrame* frame;
bool edit = TRUE; bool edit = TRUE;
...@@ -370,9 +368,9 @@ bool WinEDA_SchematicFrame::EditSheet( DrawSheetStruct* Sheet, wxDC* DC ) ...@@ -370,9 +368,9 @@ bool WinEDA_SchematicFrame::EditSheet( DrawSheetStruct* Sheet, wxDC* DC )
#define SHEET_MIN_HEIGHT 150 #define SHEET_MIN_HEIGHT 150
/****************************************************************/ /****************************************************************/
DrawSheetStruct* WinEDA_SchematicFrame::CreateSheet( wxDC* DC ) DrawSheetStruct* WinEDA_SchematicFrame::CreateSheet( wxDC* DC )
{
/****************************************************************/ /****************************************************************/
/* Routine de Creation d'une feuille de hierarchie (Sheet) */ /* Routine de Creation d'une feuille de hierarchie (Sheet) */
{
g_ItemToRepeat = NULL; g_ItemToRepeat = NULL;
DrawSheetStruct* Sheet = new DrawSheetStruct( GetScreen()->m_Curseur ); DrawSheetStruct* Sheet = new DrawSheetStruct( GetScreen()->m_Curseur );
...@@ -400,8 +398,8 @@ DrawSheetStruct* WinEDA_SchematicFrame::CreateSheet( wxDC* DC ) ...@@ -400,8 +398,8 @@ DrawSheetStruct* WinEDA_SchematicFrame::CreateSheet( wxDC* DC )
/*******************************************************************************/ /*******************************************************************************/
void WinEDA_SchematicFrame::ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC ) void WinEDA_SchematicFrame::ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC )
{
/*******************************************************************************/ /*******************************************************************************/
{
DrawSheetLabelStruct* sheetlabel; DrawSheetLabelStruct* sheetlabel;
if( Sheet == NULL ) if( Sheet == NULL )
...@@ -443,8 +441,8 @@ void WinEDA_SchematicFrame::ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC ) ...@@ -443,8 +441,8 @@ void WinEDA_SchematicFrame::ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC )
/*********************************************************************************/ /*********************************************************************************/
void WinEDA_SchematicFrame::StartMoveSheet( DrawSheetStruct* Sheet, wxDC* DC ) void WinEDA_SchematicFrame::StartMoveSheet( DrawSheetStruct* Sheet, wxDC* DC )
{
/*********************************************************************************/ /*********************************************************************************/
{
if( (Sheet == NULL) || ( Sheet->Type() != DRAW_SHEET_STRUCT_TYPE) ) if( (Sheet == NULL) || ( Sheet->Type() != DRAW_SHEET_STRUCT_TYPE) )
return; return;
......
...@@ -12,8 +12,6 @@ ...@@ -12,8 +12,6 @@
#include "protos.h" #include "protos.h"
#include "schframe.h"
/* Routines Locales */ /* Routines Locales */
static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC ); static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC );
......
...@@ -13,8 +13,6 @@ ...@@ -13,8 +13,6 @@
#include "protos.h" #include "protos.h"
#include "hotkeys.h" #include "hotkeys.h"
#include "schframe.h"
#define BITMAP wxBitmap #define BITMAP wxBitmap
#include "bitmaps.h" /* general bitmaps */ #include "bitmaps.h" /* general bitmaps */
......
...@@ -21,90 +21,92 @@ ...@@ -21,90 +21,92 @@
#include "library_browse.xpm" #include "library_browse.xpm"
/*****************************/ /*****************************/
/* class WinEDA_ViewlibFrame */ /* class WinEDA_ViewlibFrame */
/*****************************/ /*****************************/
BEGIN_EVENT_TABLE(WinEDA_ViewlibFrame, wxFrame) BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_ViewlibFrame::OnCloseWindow )
EVT_SIZE( WinEDA_ViewlibFrame::OnSize )
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
EVT_CLOSE(WinEDA_ViewlibFrame::OnCloseWindow) EVT_TOOL_RANGE( ID_LIBVIEW_START_H_TOOL, ID_LIBVIEW_END_H_TOOL,
EVT_SIZE(WinEDA_ViewlibFrame::OnSize) WinEDA_ViewlibFrame::Process_Special_Functions )
EVT_ACTIVATE(WinEDA_DrawFrame::OnActivate)
EVT_TOOL_RANGE(ID_LIBVIEW_START_H_TOOL, ID_LIBVIEW_END_H_TOOL, EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_ViewlibFrame::Process_Special_Functions) WinEDA_DrawFrame::Process_Zoom )
EVT_TOOL_RANGE(ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT, EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
WinEDA_DrawFrame::Process_Zoom) WinEDA_ViewlibFrame::ExportToSchematicLibraryPart )
EVT_TOOL(ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC, EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER,
WinEDA_ViewlibFrame::ExportToSchematicLibraryPart) WinEDA_ViewlibFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX(ID_LIBVIEW_SELECT_PART_NUMBER, EVT_LISTBOX( ID_LIBVIEW_LIB_LIST, WinEDA_ViewlibFrame::ClickOnLibList )
WinEDA_ViewlibFrame::Process_Special_Functions) EVT_LISTBOX( ID_LIBVIEW_CMP_LIST, WinEDA_ViewlibFrame::ClickOnCmpList )
EVT_LISTBOX(ID_LIBVIEW_LIB_LIST, WinEDA_ViewlibFrame::ClickOnLibList)
EVT_LISTBOX(ID_LIBVIEW_CMP_LIST, WinEDA_ViewlibFrame::ClickOnCmpList)
END_EVENT_TABLE() END_EVENT_TABLE()
/****************/ /****************/
/* Constructeur */ /* Constructeur */
/****************/ /****************/
WinEDA_ViewlibFrame::WinEDA_ViewlibFrame(wxWindow * father, WinEDA_App *parent, WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent,
LibraryStruct * Library, wxSemaphore * semaphore ): LibraryStruct* Library, wxSemaphore* semaphore ) :
WinEDA_DrawFrame(father, VIEWER_FRAME, parent, _("Library browser"), WinEDA_DrawFrame( father, VIEWER_FRAME, parent, _( "Library browser" ),
wxDefaultPosition, wxDefaultSize) wxDefaultPosition, wxDefaultSize )
{ {
m_FrameName = wxT("ViewlibFrame"); m_FrameName = wxT( "ViewlibFrame" );
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee
// Give an icon // Give an icon
SetIcon(wxIcon(library_browse_xpm)); SetIcon( wxIcon( library_browse_xpm ) );
m_CmpList = NULL; m_CmpList = NULL;
m_LibList = NULL; m_LibList = NULL;
m_Semaphore = semaphore; m_Semaphore = semaphore;
if ( m_Semaphore ) SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP); if( m_Semaphore )
SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP );
m_CurrentScreen = new SCH_SCREEN(VIEWER_FRAME); m_CurrentScreen = new SCH_SCREEN( VIEWER_FRAME );
GetScreen()->SetZoom(16); GetScreen()->SetZoom( 16 );
if ( Library == NULL ) if( Library == NULL )
{ {
m_LibListSize.x = 90; m_LibListSize.x = 90;
m_LibListSize.y = -1; m_LibListSize.y = -1;
m_LibList = new wxListBox(this, ID_LIBVIEW_LIB_LIST,wxPoint(0,0), m_LibList = new wxListBox( this, ID_LIBVIEW_LIB_LIST, wxPoint( 0, 0 ),
m_LibListSize, 0, NULL, wxLB_HSCROLL ); m_LibListSize, 0, NULL, wxLB_HSCROLL );
m_LibList->SetFont(*g_DialogFont); m_LibList->SetFont( *g_DialogFont );
m_LibList->SetBackgroundColour(wxColour(150,255,255)); m_LibList->SetBackgroundColour( wxColour( 150, 255, 255 ) );
m_LibList->SetForegroundColour(wxColour(0,0,0)); m_LibList->SetForegroundColour( wxColour( 0, 0, 0 ) );
} }
else g_CurrentViewLibraryName = Library->m_Name; else
g_CurrentViewLibraryName = Library->m_Name;
m_CmpListSize.x = 150; m_CmpListSize.x = 150;
m_CmpListSize.y = -1; m_CmpListSize.y = -1;
m_CmpList = new wxListBox(this, ID_LIBVIEW_CMP_LIST,wxPoint(m_LibListSize.x,0), m_CmpList = new wxListBox( this, ID_LIBVIEW_CMP_LIST, wxPoint( m_LibListSize.x, 0 ),
m_CmpListSize, 0, NULL, wxLB_HSCROLL ); m_CmpListSize, 0, NULL, wxLB_HSCROLL );
m_CmpList->SetFont(*g_DialogFont); m_CmpList->SetFont( *g_DialogFont );
m_CmpList->SetBackgroundColour(wxColour(255,255,200)); m_CmpList->SetBackgroundColour( wxColour( 255, 255, 200 ) );
m_CmpList->SetForegroundColour(wxColour(0,0,0)); m_CmpList->SetForegroundColour( wxColour( 0, 0, 0 ) );
GetSettings(); GetSettings();
SetSize(m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y); SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
ReCreateHToolbar(); ReCreateHToolbar();
ReCreateVToolbar(); ReCreateVToolbar();
if ( m_LibList) ReCreateListLib(); if( m_LibList )
ReCreateListLib();
DisplayLibInfos(); DisplayLibInfos();
Show(TRUE); Show( TRUE );
} }
/***************/
/* Destructeur */ /***************/
/***************/ /* Destructeur */
/***************/
WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame() WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame()
{ {
...@@ -112,25 +114,27 @@ WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame() ...@@ -112,25 +114,27 @@ WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame()
m_Parent->m_ViewlibFrame = NULL; m_Parent->m_ViewlibFrame = NULL;
} }
/*****************************************************************/ /*****************************************************************/
void WinEDA_ViewlibFrame::OnCloseWindow(wxCloseEvent & Event) void WinEDA_ViewlibFrame::OnCloseWindow( wxCloseEvent& Event )
/*****************************************************************/ /*****************************************************************/
{ {
SaveSettings(); SaveSettings();
if ( m_Semaphore ) m_Semaphore->Post(); if( m_Semaphore )
m_Semaphore->Post();
Destroy(); Destroy();
} }
/*****************************************************/ /*****************************************************/
void WinEDA_ViewlibFrame::OnSize(wxSizeEvent & SizeEv) void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv )
/*****************************************************/ /*****************************************************/
{ {
wxSize size; wxSize size;
wxSize maintoolbar_size; wxSize maintoolbar_size;
wxSize Vtoolbar_size; wxSize Vtoolbar_size;
GetClientSize(&size.x, &size.y); GetClientSize( &size.x, &size.y );
m_FrameSize = size; m_FrameSize = size;
size.y -= m_MsgFrameHeight; size.y -= m_MsgFrameHeight;
...@@ -142,31 +146,31 @@ wxSize Vtoolbar_size; ...@@ -142,31 +146,31 @@ wxSize Vtoolbar_size;
if( m_VToolBar ) if( m_VToolBar )
{ {
Vtoolbar_size = m_VToolBar->GetSize(); Vtoolbar_size = m_VToolBar->GetSize();
m_VToolBar->SetSize(size.x - maintoolbar_size.y, 0,-1, size.y); m_VToolBar->SetSize( size.x - maintoolbar_size.y, 0, -1, size.y );
} }
if ( MsgPanel ) if( MsgPanel )
{ {
MsgPanel->SetSize(0, size.y, size.x, m_MsgFrameHeight); MsgPanel->SetSize( 0, size.y, size.x, m_MsgFrameHeight );
} }
if ( DrawPanel ) if( DrawPanel )
{ {
DrawPanel->SetSize(m_LibListSize.x + m_CmpListSize.x, 0, DrawPanel->SetSize( m_LibListSize.x + m_CmpListSize.x, 0,
size.x - Vtoolbar_size.x - m_LibListSize.x - m_CmpListSize.x, size.x - Vtoolbar_size.x - m_LibListSize.x - m_CmpListSize.x,
size.y); size.y );
} }
if ( m_LibList ) if( m_LibList )
{ {
m_LibListSize.y = size.y; m_LibListSize.y = size.y;
m_LibList->SetSize(0, 0, m_LibListSize.x, m_LibListSize.y); m_LibList->SetSize( 0, 0, m_LibListSize.x, m_LibListSize.y );
} }
if ( m_CmpList ) if( m_CmpList )
{ {
m_CmpListSize.y = size.y; m_CmpListSize.y = size.y;
m_CmpList->SetSize(m_LibListSize.x, 0, m_CmpListSize.x, m_CmpListSize.y); m_CmpList->SetSize( m_LibListSize.x, 0, m_CmpListSize.x, m_CmpListSize.y );
} }
} }
...@@ -175,70 +179,72 @@ wxSize Vtoolbar_size; ...@@ -175,70 +179,72 @@ wxSize Vtoolbar_size;
int WinEDA_ViewlibFrame::BestZoom() int WinEDA_ViewlibFrame::BestZoom()
/*******************************************/ /*******************************************/
{ {
int bestzoom, ii, jj; int bestzoom, ii, jj;
wxSize size, itemsize; wxSize size, itemsize;
EDA_LibComponentStruct * CurrentLibEntry = NULL; EDA_LibComponentStruct* CurrentLibEntry = NULL;
CurrentLibEntry = FindLibPart(g_CurrentViewComponentName.GetData(), CurrentLibEntry = FindLibPart( g_CurrentViewComponentName.GetData(),
g_CurrentViewLibraryName.GetData(), FIND_ROOT); g_CurrentViewLibraryName.GetData(), FIND_ROOT );
if( CurrentLibEntry == NULL ) if( CurrentLibEntry == NULL )
{ {
bestzoom = 16; bestzoom = 16;
GetScreen()->m_Curseur.x = 0; GetScreen()->m_Curseur.x = 0;
GetScreen()->m_Curseur.y = 0; GetScreen()->m_Curseur.y = 0;
return(bestzoom); return bestzoom;
} }
EDA_Rect BoundaryBox = CurrentLibEntry->GetBoundaryBox(g_ViewUnit, g_ViewConvert); EDA_Rect BoundaryBox = CurrentLibEntry->GetBoundaryBox( g_ViewUnit, g_ViewConvert );
itemsize = BoundaryBox.GetSize(); itemsize = BoundaryBox.GetSize();
size = DrawPanel->GetClientSize(); size = DrawPanel->GetClientSize();
size.x -= 60; // Pour marges haut et bas size.x -= 60; // Pour marges haut et bas
ii = itemsize.x / size.x; ii = itemsize.x / size.x;
jj = itemsize.y / size.y; jj = itemsize.y / size.y;
ii = MAX(ii, jj); ii = MAX( ii, jj );
/* determination du zoom existant le plus proche */ /* determination du zoom existant le plus proche */
for ( bestzoom = 1 ; bestzoom < 512 ; bestzoom <<= 1 ) for( bestzoom = 1; bestzoom < 512; bestzoom <<= 1 )
{ {
if(bestzoom > ii ) break; if( bestzoom > ii )
break;
} }
GetScreen()->m_Curseur = BoundaryBox.Centre(); GetScreen()->m_Curseur = BoundaryBox.Centre();
GetScreen()->m_Curseur.y = -( GetScreen()->m_Curseur.y );
return(bestzoom); return bestzoom;
} }
/***************************************************/ /***************************************************/
void WinEDA_ViewlibFrame::ReCreateListLib() void WinEDA_ViewlibFrame::ReCreateListLib()
/***************************************************/ /***************************************************/
{ {
const wxChar ** ListNames, ** names; const wxChar** ListNames, ** names;
int ii; int ii;
bool found = FALSE; bool found = FALSE;
if ( m_LibList == NULL ) return; if( m_LibList == NULL )
return;
ListNames = GetLibNames(); ListNames = GetLibNames();
m_LibList->Clear(); m_LibList->Clear();
for ( names = ListNames, ii = 0; *names != NULL; names++, ii++ ) for( names = ListNames, ii = 0; *names != NULL; names++, ii++ )
{ {
m_LibList->Append(*names); m_LibList->Append( *names );
if ( g_CurrentViewLibraryName.Cmp(*names) == 0) if( g_CurrentViewLibraryName.Cmp( *names ) == 0 )
{ {
m_LibList->SetSelection(ii, TRUE); m_LibList->SetSelection( ii, TRUE );
found = TRUE; found = TRUE;
} }
} }
free (ListNames); free( ListNames );
/* Librairie courante peut etre non retrouv�e en liste /* Librairie courante peut etre non retrouv�e en liste
(peut etre effac�e lors d'une modification de configuration) */ * (peut etre effac�e lors d'une modification de configuration) */
if ( ! found ) if( !found )
{ {
g_CurrentViewLibraryName.Empty(); g_CurrentViewLibraryName.Empty();
g_CurrentViewComponentName.Empty(); g_CurrentViewComponentName.Empty();
...@@ -250,38 +256,42 @@ bool found = FALSE; ...@@ -250,38 +256,42 @@ bool found = FALSE;
ReDrawPanel(); ReDrawPanel();
} }
/***********************************************/ /***********************************************/
void WinEDA_ViewlibFrame::ReCreateListCmp() void WinEDA_ViewlibFrame::ReCreateListCmp()
/***********************************************/ /***********************************************/
{ {
int ii; int ii;
EDA_LibComponentStruct *LibEntry = NULL; EDA_LibComponentStruct* LibEntry = NULL;
LibraryStruct *Library = FindLibrary(g_CurrentViewLibraryName.GetData()); LibraryStruct* Library = FindLibrary( g_CurrentViewLibraryName.GetData() );
m_CmpList->Clear(); m_CmpList->Clear();
ii = 0; ii = 0;
g_CurrentViewComponentName.Empty(); g_CurrentViewComponentName.Empty();
g_ViewConvert = 1; /* Vue normal / convert */ g_ViewConvert = 1; /* Vue normal / convert */
g_ViewUnit = 1; /* unit� a afficher (A, B ..) */ g_ViewUnit = 1; /* unit� a afficher (A, B ..) */
if ( Library ) if( Library )
LibEntry = (EDA_LibComponentStruct *) PQFirst(&Library->m_Entries, FALSE); LibEntry = (EDA_LibComponentStruct*) PQFirst( &Library->m_Entries, FALSE );
while( LibEntry ) while( LibEntry )
{ {
m_CmpList->Append(LibEntry->m_Name.m_Text); m_CmpList->Append( LibEntry->m_Name.m_Text );
LibEntry = (EDA_LibComponentStruct *) PQNext(Library->m_Entries, LibEntry, NULL); LibEntry = (EDA_LibComponentStruct*) PQNext( Library->m_Entries, LibEntry, NULL );
} }
} }
/********************************************************************/ /********************************************************************/
void WinEDA_ViewlibFrame::ClickOnLibList(wxCommandEvent & event) void WinEDA_ViewlibFrame::ClickOnLibList( wxCommandEvent& event )
/********************************************************************/ /********************************************************************/
{ {
int ii = m_LibList->GetSelection(); int ii = m_LibList->GetSelection();
if ( ii < 0 ) return;
wxString name = m_LibList->GetString(ii); if( ii < 0 )
if ( g_CurrentViewLibraryName == name ) return; return;
wxString name = m_LibList->GetString( ii );
if( g_CurrentViewLibraryName == name )
return;
g_CurrentViewLibraryName = name; g_CurrentViewLibraryName = name;
ReCreateListCmp(); ReCreateListCmp();
ReDrawPanel(); ReDrawPanel();
...@@ -291,31 +301,37 @@ wxString name = m_LibList->GetString(ii); ...@@ -291,31 +301,37 @@ wxString name = m_LibList->GetString(ii);
/****************************************************************/ /****************************************************************/
void WinEDA_ViewlibFrame::ClickOnCmpList(wxCommandEvent & event) void WinEDA_ViewlibFrame::ClickOnCmpList( wxCommandEvent& event )
/****************************************************************/ /****************************************************************/
{ {
int ii = m_CmpList->GetSelection(); int ii = m_CmpList->GetSelection();
if ( ii < 0 ) return;
if( ii < 0 )
return;
wxString name = m_CmpList->GetString(ii); wxString name = m_CmpList->GetString( ii );
g_CurrentViewComponentName = name; g_CurrentViewComponentName = name;
DisplayLibInfos(); DisplayLibInfos();
g_ViewUnit = 1; g_ViewUnit = 1;
g_ViewConvert = 1; g_ViewConvert = 1;
Zoom_Automatique(FALSE); Zoom_Automatique( FALSE );
ReCreateHToolbar(); ReCreateHToolbar();
ReDrawPanel(); ReDrawPanel();
} }
/****************************************************************************/ /****************************************************************************/
void WinEDA_ViewlibFrame::ExportToSchematicLibraryPart(wxCommandEvent& event) void WinEDA_ViewlibFrame::ExportToSchematicLibraryPart( wxCommandEvent& event )
/****************************************************************************/ /****************************************************************************/
/* Export to schematic the current viewed component, and close the library browser /* Export to schematic the current viewed component, and close the library browser
*/ */
{ {
int ii = m_CmpList->GetSelection(); int ii = m_CmpList->GetSelection();
if ( ii >= 0 ) g_CurrentViewComponentName = m_CmpList->GetString(ii);
else g_CurrentViewComponentName.Empty(); if( ii >= 0 )
Close(TRUE); g_CurrentViewComponentName = m_CmpList->GetString( ii );
else
g_CurrentViewComponentName.Empty();
Close( TRUE );
} }
...@@ -303,16 +303,6 @@ public: ...@@ -303,16 +303,6 @@ public:
m_Status = new_status; m_Status = new_status;
} }
/* fonction de placement */
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
virtual void Draw( WinEDA_DrawPanel* panel,
wxDC* DC,
const wxPoint& offset,
int draw_mode,
int Color = -1 );
/** /**
* Function Display_Infos * Function Display_Infos
* has knowledge about the frame and how and where to put status information * has knowledge about the frame and how and where to put status information
...@@ -545,213 +535,4 @@ public: ...@@ -545,213 +535,4 @@ public:
int Len_Size(); int Len_Size();
}; };
/**
* Class BOARD_ITEM
* is a base class for any item which can be embedded within the BOARD
* container class, and therefore instances of derived classes should only be
* found in PCBNEW or other programs that use class BOARD and its contents.
* The corresponding class in EESCHEMA seems to be DrawPartStruct.
*/
class BOARD_ITEM : public EDA_BaseStruct
{
protected:
int m_Layer;
public:
BOARD_ITEM( BOARD_ITEM* StructFather, KICAD_T idtype ) :
EDA_BaseStruct( StructFather, idtype )
, m_Layer( 0 )
{
}
BOARD_ITEM( const BOARD_ITEM& src ) :
EDA_BaseStruct( src.m_Parent, src.Type() )
, m_Layer( src.m_Layer )
{
}
/**
* A value of wxPoint(0,0) which can be passed to the Draw() functions.
*/
static wxPoint ZeroOffset;
BOARD_ITEM* Next() const { return (BOARD_ITEM*) Pnext; }
BOARD_ITEM* Back() const { return (BOARD_ITEM*) Pback; }
BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; }
/**
* Function GetPosition
* returns the position of this object.
* @return wxPoint& - The position of this object, non-const so it
* can be changed
*/
virtual wxPoint& GetPosition() = 0;
/**
* Function GetLayer
* returns the layer this item is on.
*/
int GetLayer() const { return m_Layer; }
/**
* Function SetLayer
* sets the layer this item is on.
* @param aLayer The layer number.
*/
void SetLayer( int aLayer ) { m_Layer = aLayer; }
/**
* Function Draw
* overrides Draw() from EDA_BaseStruct in order to make it virtual
* without the default color argument, which is more appropriate for
* BOARD_ITEMs which have their own color information.
*/
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int aDrawMode, const wxPoint& offset = ZeroOffset ) = 0;
/**
* Function IsOnLayer
* tests to see if this object is on the given layer. Is virtual so
* objects like D_PAD, which reside on multiple layers can do their own
* form of testing.
* @param aLayer The layer to test for.
* @return bool - true if on given layer, else false.
*/
virtual bool IsOnLayer( int aLayer ) const
{
return m_Layer == aLayer;
}
/**
* Function IsLocked
* @return bool - true if the object is locked, else false
*/
virtual bool IsLocked() const
{
return false; // only MODULEs can be locked at this time.
}
/**
* Function UnLink
* detaches this object from its owner.
*/
virtual void UnLink() = 0;
/**
* Function DeleteStructure
* deletes this object after UnLink()ing it from its owner.
*/
void DeleteStructure()
{
UnLink();
delete this;
}
/**
* Function MenuText
* returns the text to use in any menu type UI control which must uniquely
* identify this item.
* @param aBoard The PCB in which this item resides, needed for Net lookup.
* @return wxString
* @todo: maybe: make this virtual and split into each derived class
*/
wxString MenuText( const BOARD* aBoard ) const;
/**
* Function MenuIcon
* @return const char** - The XPM to use in any UI control which can help
* identify this item.
* @todo: make this virtual and split into each derived class
*/
const char** MenuIcon() const;
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
virtual bool Save( FILE* aFile ) const = 0;
};
/**
* Class SCH_ITEM
* is a base class for any item which can be embedded within the SCHEMATIC
* container class, and therefore instances of derived classes should only be
* found in EESCHEMA or other programs that use class SCHEMATIC and its contents.
* The corresponding class in PCBNEW is BOARD_ITEM.
*/
class SCH_ITEM : public EDA_BaseStruct
{
protected:
int m_Layer;
public:
SCH_ITEM( EDA_BaseStruct* aParent, KICAD_T aType ) :
EDA_BaseStruct( aParent, aType ),
m_Layer( 0 )
{
}
~SCH_ITEM(){}
virtual wxString GetClass() const
{
return wxT( "SCH_ITEM" );
}
};
/**
* Class DrawPickedStruct
* holds structures picked by pick events (like block selection).
* This class has only one useful member: .m_PickedStruct, used as a link.
* It is used to create a linked list of selected items (in block selection).
* Each DrawPickedStruct item has is member: .m_PickedStruct pointing the
* real selected item.
*/
class DrawPickedStruct : public SCH_ITEM
{
public:
EDA_BaseStruct* m_PickedStruct;
public:
DrawPickedStruct( EDA_BaseStruct* pickedstruct = NULL );
~DrawPickedStruct();
void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { };
void DeleteWrapperList();
DrawPickedStruct* Next() { return (DrawPickedStruct*) Pnext; }
EDA_Rect GetBoundingBox();
/**
* Function GetBoundingBoxUnion
* returns the union of all the BoundingBox rectangles of all held items
* in the picklist whose list head is this DrawPickedStruct.
* @return EDA_Rect - The combined, composite, bounding box.
*/
EDA_Rect GetBoundingBoxUnion();
wxString GetClass() const { return wxT( "DrawPickedStruct" ); }
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os );
#endif
};
#endif /* BASE_STRUCT_H */ #endif /* BASE_STRUCT_H */
/*********************************************************************/
/* board_item_struct.h : Basic classes for BOARD_ITEM descriptions */
/*********************************************************************/
#ifndef BOARD_ITEM_STRUCT_H
#define BOARD_ITEM_STRUCT_H
/**
* Class BOARD_ITEM
* is a base class for any item which can be embedded within the BOARD
* container class, and therefore instances of derived classes should only be
* found in PCBNEW or other programs that use class BOARD and its contents.
* The corresponding class in EESCHEMA seems to be DrawPartStruct.
*/
class BOARD_ITEM : public EDA_BaseStruct
{
protected:
int m_Layer;
public:
BOARD_ITEM( BOARD_ITEM* StructFather, KICAD_T idtype ) :
EDA_BaseStruct( StructFather, idtype )
, m_Layer( 0 )
{
}
BOARD_ITEM( const BOARD_ITEM& src ) :
EDA_BaseStruct( src.m_Parent, src.Type() )
, m_Layer( src.m_Layer )
{
}
/**
* A value of wxPoint(0,0) which can be passed to the Draw() functions.
*/
static wxPoint ZeroOffset;
BOARD_ITEM* Next() const { return (BOARD_ITEM*) Pnext; }
BOARD_ITEM* Back() const { return (BOARD_ITEM*) Pback; }
BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; }
/**
* Function GetPosition
* returns the position of this object.
* @return wxPoint& - The position of this object, non-const so it
* can be changed
*/
virtual wxPoint& GetPosition() = 0;
/**
* Function GetLayer
* returns the layer this item is on.
*/
int GetLayer() const { return m_Layer; }
/**
* Function SetLayer
* sets the layer this item is on.
* @param aLayer The layer number.
*/
void SetLayer( int aLayer ) { m_Layer = aLayer; }
/**
* Function Draw
* BOARD_ITEMs have their own color information.
*/
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int aDrawMode, const wxPoint& offset = ZeroOffset ) = 0;
/**
* Function IsOnLayer
* tests to see if this object is on the given layer. Is virtual so
* objects like D_PAD, which reside on multiple layers can do their own
* form of testing.
* @param aLayer The layer to test for.
* @return bool - true if on given layer, else false.
*/
virtual bool IsOnLayer( int aLayer ) const
{
return m_Layer == aLayer;
}
/**
* Function IsLocked
* @return bool - true if the object is locked, else false
*/
virtual bool IsLocked() const
{
return false; // only MODULEs can be locked at this time.
}
/**
* Function UnLink
* detaches this object from its owner.
*/
virtual void UnLink() = 0;
/**
* Function DeleteStructure
* deletes this object after UnLink()ing it from its owner.
*/
void DeleteStructure()
{
UnLink();
delete this;
}
/**
* Function MenuText
* returns the text to use in any menu type UI control which must uniquely
* identify this item.
* @param aBoard The PCB in which this item resides, needed for Net lookup.
* @return wxString
* @todo: maybe: make this virtual and split into each derived class
*/
wxString MenuText( const BOARD* aBoard ) const;
/**
* Function MenuIcon
* @return const char** - The XPM to use in any UI control which can help
* identify this item.
* @todo: make this virtual and split into each derived class
*/
const char** MenuIcon() const;
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
virtual bool Save( FILE* aFile ) const = 0;
};
#endif /* BOARD_ITEM_STRUCT_H */
...@@ -17,6 +17,8 @@ ...@@ -17,6 +17,8 @@
#include "colors.h" #include "colors.h"
class SCH_ITEM;
/****************************************************/ /****************************************************/
/* classe representant un ecran graphique de dessin */ /* classe representant un ecran graphique de dessin */
/****************************************************/ /****************************************************/
...@@ -218,9 +220,9 @@ public: ...@@ -218,9 +220,9 @@ public:
bool m_FirstRedraw; bool m_FirstRedraw;
/* Gestion des editions */ /* Gestion des editions */
EDA_BaseStruct* EEDrawList; /* Object list (main data) for schematic */ SCH_ITEM * EEDrawList; /* Object list (main data) for schematic */
EDA_BaseStruct* m_UndoList; /* Object list for the undo command (old data) */ EDA_BaseStruct * m_UndoList; /* Object list for the undo command (old data) */
EDA_BaseStruct* m_RedoList; /* Object list for the redo command (old data) */ EDA_BaseStruct * m_RedoList; /* Object list for the redo command (old data) */
int m_UndoRedoCountMax; /* undo/Redo command Max depth */ int m_UndoRedoCountMax; /* undo/Redo command Max depth */
/* block control */ /* block control */
......
...@@ -6,6 +6,7 @@ ...@@ -6,6 +6,7 @@
#define PCBSTRUCT_H #define PCBSTRUCT_H
#include "base_struct.h" #include "base_struct.h"
#include "board_item_struct.h"
// Definitions relatives aux libariries // Definitions relatives aux libariries
#define ENTETE_LIBRAIRIE "PCBNEW-LibModule-V1" #define ENTETE_LIBRAIRIE "PCBNEW-LibModule-V1"
......
/*****************************************************************************/
/* sch_item_struct.h : Basic classes for most eeschema items descriptions */
/*****************************************************************************/
#ifndef SCH_ITEM_STRUCT_H
#define SCH_ITEM_STRUCT_H
/**
* Class SCH_ITEM
* is a base class for any item which can be embedded within the SCHEMATIC
* container class, and therefore instances of derived classes should only be
* found in EESCHEMA or other programs that use class SCHEMATIC and its contents.
* The corresponding class in PCBNEW is BOARD_ITEM.
*/
class SCH_ITEM : public EDA_BaseStruct
{
protected:
int m_Layer;
public:
SCH_ITEM( EDA_BaseStruct* aParent, KICAD_T aType ) :
EDA_BaseStruct( aParent, aType ),
m_Layer( 0 )
{
}
~SCH_ITEM(){}
virtual wxString GetClass() const
{
return wxT( "SCH_ITEM" );
}
SCH_ITEM* Next() { return (SCH_ITEM*) Pnext; }
/**
* Function GetLayer
* returns the layer this item is on.
*/
int GetLayer() const { return m_Layer; }
/**
* Function SetLayer
* sets the layer this item is on.
* @param aLayer The layer number.
*/
void SetLayer( int aLayer ) { m_Layer = aLayer; }
/**
* Function Draw
*/
virtual void Draw( WinEDA_DrawPanel* panel,
wxDC* DC,
const wxPoint& offset,
int draw_mode,
int Color = -1 ) = 0;
/* fonction de placement */
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
};
/**
* Class DrawPickedStruct
* holds structures picked by pick events (like block selection).
* This class has only one useful member: .m_PickedStruct, used as a link.
* It is used to create a linked list of selected items (in block selection).
* Each DrawPickedStruct item has is member: .m_PickedStruct pointing the
* real selected item.
*/
class DrawPickedStruct : public SCH_ITEM
{
public:
SCH_ITEM * m_PickedStruct;
public:
DrawPickedStruct( SCH_ITEM * pickedstruct = NULL );
~DrawPickedStruct();
void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { };
void DeleteWrapperList();
DrawPickedStruct* Next() { return (DrawPickedStruct*) Pnext; }
EDA_Rect GetBoundingBox();
/**
* Function GetBoundingBoxUnion
* returns the union of all the BoundingBox rectangles of all held items
* in the picklist whose list head is this DrawPickedStruct.
* @return EDA_Rect - The combined, composite, bounding box.
*/
EDA_Rect GetBoundingBoxUnion();
wxString GetClass() const { return wxT( "DrawPickedStruct" ); }
/**
* Function Draw
* Do nothing, needed for SCH_ITEM compat.
*/
void Draw( WinEDA_DrawPanel* panel,
wxDC* DC,
const wxPoint& offset,
int draw_mode,
int Color = -1 )
{
}
#if defined(DEBUG)
void Show( int nestLevel, std::ostream& os );
#endif
};
#endif /* SCH_ITEM_STRUCT_H */
/***********************************************************/
/* wxEeschemaStruct.h: */
/* descriptions des principales classes derivees utilisees */
/***********************************************************/
#ifndef WX_EESCHEMA_STRUCT_H
#define WX_EESCHEMA_STRUCT_H
class DrawPickedStruct;
class SCH_ITEM;
class DrawNoConnectStruct;
/*******************************/
/* class WinEDA_SchematicFrame */
/*******************************/
/* enum used in RotationMiroir() */
enum fl_rot_cmp {
CMP_NORMAL, // orientation normale (O, pas de miroir)
CMP_ROTATE_CLOCKWISE, // nouvelle rotation de -90
CMP_ROTATE_COUNTERCLOCKWISE, // nouvelle rotation de +90
CMP_ORIENT_0, // orientation 0, pas de miroir, id CMP_NORMAL
CMP_ORIENT_90, // orientation 90, pas de miroir
CMP_ORIENT_180, // orientation 180, pas de miroir
CMP_ORIENT_270, // orientation -90, pas de miroir
CMP_MIROIR_X = 0x100, // miroir selon axe X
CMP_MIROIR_Y = 0x200 // miroir selon axe Y
};
class WinEDA_SchematicFrame : public WinEDA_DrawFrame
{
public:
WinEDAChoiceBox* m_SelPartBox;
DrawSheetPath* m_CurrentSheet; //which sheet we are presently working on.
private:
wxMenu* m_FilesMenu;
public:
WinEDA_SchematicFrame( wxWindow* father, WinEDA_App* parent,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_SchematicFrame();
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event );
void Save_Config( wxWindow* displayframe );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void CreateScreens();
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
void SetToolbars();
void OnHotKey( wxDC* DC,
int hotkey,
EDA_BaseStruct* DrawStruct );
DrawSheetPath* GetSheet();
virtual BASE_SCREEN* GetScreen();
virtual void SetScreen( SCH_SCREEN* screen );
virtual wxString GetScreenDesc();
void InstallConfigFrame( const wxPoint& pos );
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event );
void ToolOnRightClick( wxCommandEvent& event );
int BestZoom(); // Retourne le meilleur zoom
SCH_ITEM* SchematicGeneralLocateAndDisplay( bool IncludePin = TRUE );
SCH_ITEM* SchematicGeneralLocateAndDisplay(
const wxPoint& refpoint,
bool
IncludePin );
SCH_ITEM* FindComponentAndItem( const wxString& component_reference,
bool Find_in_hierarchy,
int SearchType,
const wxString& text_to_find,
bool mouseWarp );
/* Cross probing with pcbnew */
void SendMessageToPCBNEW( EDA_BaseStruct * objectToSync,
SCH_COMPONENT* LibItem );
/* netlist generation */
void* BuildNetListBase();
// FUnctions used for hierarchy handling
void InstallPreviousSheet();
void InstallNextScreen( DrawSheetStruct* Sheet );
void ToPlot_PS( wxCommandEvent& event );
void ToPlot_HPGL( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event );
void Save_File( wxCommandEvent& event );
void SaveProject();
int LoadOneEEProject( const wxString& FileName, bool IsNew );
bool LoadOneEEFile( SCH_SCREEN* screen, const wxString& FullFileName );
bool SaveEEFile( SCH_SCREEN* screen, int FileSave );
SCH_SCREEN* CreateNewScreen( SCH_SCREEN* OldScreen, int TimeStamp );
// General search:
/**
* Function FindSchematicItem
* finds a string in the schematic.
* @param pattern The text to search for, either in value, reference or
* elsewhere.
* @param SearchType: 0 => Search is made in current sheet
* 1 => the whole hierarchy
* 2 => or for the next item
* @param mouseWarp If true, then move the mouse cursor to the item.
*/
SCH_ITEM* FindSchematicItem( const wxString& pattern,
int SearchType,
bool mouseWarp = true );
SCH_ITEM* FindMarker( int SearchType );
private:
void Process_Move_Item( SCH_ITEM* DrawStruct, wxDC* DC );
void OnExit( wxCommandEvent& event );
void OnAnnotate( wxCommandEvent& event );
void OnErc( wxCommandEvent& event );
void OnCreateNetlist( wxCommandEvent& event );
void OnCreateBillOfMaterials( wxCommandEvent& event );
void OnFindItems( wxCommandEvent& event );
void OnLoadFile( wxCommandEvent& event );
void OnNewProject( wxCommandEvent& event );
void OnLoadProject( wxCommandEvent& event );
void OnOpenPcbnew( wxCommandEvent& event );
void OnOpenCvpcb( wxCommandEvent& event );
void OnOpenLibraryViewer( wxCommandEvent& event );
void OnOpenLibraryEditor( wxCommandEvent& event );
// Bus Entry
DrawBusEntryStruct* CreateBusEntry( wxDC* DC, int entry_type );
void SetBusEntryShape( wxDC* DC,
DrawBusEntryStruct* BusEntry,
int entry_type );
int GetBusEntryShape( DrawBusEntryStruct* BusEntry );
void StartMoveBusEntry( DrawBusEntryStruct* DrawLibItem, wxDC* DC );
// NoConnect
DrawNoConnectStruct* CreateNewNoConnectStruct( wxDC* DC );
// Junction
DrawJunctionStruct* CreateNewJunctionStruct( wxDC* DC,
const wxPoint& pos,
bool PutInUndoList = FALSE );
// Text ,label, glabel
EDA_BaseStruct* CreateNewText( wxDC* DC, int type );
void EditSchematicText( SCH_TEXT* TextStruct, wxDC* DC );
void ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC );
void StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC );
void ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype );
// Wire, Bus
void BeginSegment( wxDC* DC, int type );
void EndSegment( wxDC* DC );
void DeleteCurrentSegment( wxDC* DC );
void DeleteConnection( wxDC* DC, bool DeleteFullConnection );
// graphic lines
void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC );
void Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC );
DRAWSEGMENT* Begin_Edge( DRAWSEGMENT* Segment, wxDC* DC );
// Hierarchical Sheet & PinSheet
void InstallHierarchyFrame( wxDC* DC, wxPoint& pos );
DrawSheetStruct* CreateSheet( wxDC* DC );
void ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC );
public:
bool EditSheet( DrawSheetStruct* Sheet, wxDC* DC );
/** Function UpdateSheetNumberAndDate
* Set a sheet number, the sheet count for sheets in the whole schematic
* and update the date in all screens
*/
void UpdateSheetNumberAndDate();
private:
void StartMoveSheet( DrawSheetStruct* sheet, wxDC* DC );
DrawSheetLabelStruct* Create_PinSheet( DrawSheetStruct* Sheet, wxDC* DC );
void Edit_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC );
void StartMove_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC );
void Place_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC );
DrawSheetLabelStruct* Import_PinSheet( DrawSheetStruct* Sheet, wxDC* DC );
public:
void DeleteSheetLabel( wxDC* DC, DrawSheetLabelStruct* SheetLabelToDel );
private:
// Component
SCH_COMPONENT* Load_Component( wxDC* DC,
const wxString& libname,
wxArrayString& List,
bool UseLibBrowser );
void StartMovePart( SCH_COMPONENT* DrawLibItem, wxDC* DC );
public:
void CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
wxDC* DC, int type_rotate );
private:
void SelPartUnit( SCH_COMPONENT* DrawComponent,
int unit, wxDC* DC );
void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC );
void SetInitCmp( SCH_COMPONENT* DrawComponent, wxDC* DC );
void EditComponentReference( SCH_COMPONENT* DrawLibItem,
wxDC* DC );
void EditComponentValue( SCH_COMPONENT* DrawLibItem, wxDC* DC );
void EditComponentFootprint( SCH_COMPONENT* DrawLibItem,
wxDC* DC );
void StartMoveCmpField( PartTextStruct* Field, wxDC* DC );
void EditCmpFieldText( PartTextStruct* Field, wxDC* DC );
void RotateCmpField( PartTextStruct* Field, wxDC* DC );
/* Operations sur bloc */
void PasteStruct( wxDC* DC );
/* Undo - redo */
public:
void SaveCopyInUndoList( SCH_ITEM* ItemToCopy,
int flag_type_command = 0 );
private:
void PutDataInPreviousState( DrawPickedStruct* List );
bool GetSchematicFromRedoList();
bool GetSchematicFromUndoList();
public:
void Key( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
/* Gestion generale des operations sur block */
int ReturnBlockCommand( int key );
void InitBlockPasteInfos();
void HandleBlockPlace( wxDC* DC );
int HandleBlockEnd( wxDC* DC );
void HandleBlockEndByPopUp( int Command, wxDC* DC );
// Repetition automatique de placements
void RepeatDrawItem( wxDC* DC );
// Test des points de connexion en l'air (dangling ends)
void TestDanglingEnds( SCH_ITEM* DrawList, wxDC* DC );
LibDrawPin* LocatePinEnd( SCH_ITEM* DrawList, const wxPoint& pos );
DECLARE_EVENT_TABLE()
};
/*****************************/
/* class WinEDA_LibeditFrame */
/*****************************/
class WinEDA_LibeditFrame : public WinEDA_DrawFrame
{
public:
WinEDAChoiceBox* m_SelpartBox;
WinEDAChoiceBox* m_SelAliasBox;
public:
WinEDA_LibeditFrame( wxWindow* father, WinEDA_App* parent,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_LibeditFrame();
void Process_Special_Functions( wxCommandEvent& event );
void DisplayLibInfos();
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar();
void ReCreateVToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
int BestZoom(); // Retourne le meilleur zoom
void SetToolbars();
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
virtual BASE_SCREEN* GetScreen() { return (BASE_SCREEN*) m_CurrentScreen; }
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
private:
// General:
void CreateNewLibraryPart();
void DeleteOnePart();
void SaveOnePartInMemory();
void SelectActiveLibrary();
bool LoadOneLibraryPart();
void SaveActiveLibrary();
void ImportOnePart();
void ExportOnePart( bool create_lib );
int LoadOneLibraryPartAux( EDA_LibComponentStruct* LibEntry,
LibraryStruct* Library, int noMsg = 0 );
void DisplayCmpDoc( const wxString& Name );
void InstallLibeditFrame( const wxPoint& pos );
// General editing
public:
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 );
private:
bool GetComponentFromUndoList();
bool GetComponentFromRedoList();
// Edition des Pins:
void CreatePin( wxDC* DC );
void DeletePin( wxDC* DC,
EDA_LibComponentStruct* LibEntry,
LibDrawPin* Pin );
void StartMovePin( wxDC* DC );
// Test des pins ( duplicates...)
bool TestPins( EDA_LibComponentStruct* LibEntry );
// Edition de l'ancre
void PlaceAncre();
// Edition des graphismes:
LibEDA_BaseStruct* CreateGraphicItem( wxDC* DC );
void GraphicItemBeginDraw( wxDC* DC );
void StartMoveDrawSymbol( wxDC* DC );
void EndDrawGraphicItem( wxDC* DC );
void LoadOneSymbol( wxDC* DC );
void SaveOneSymbol();
void EditGraphicSymbol( wxDC* DC, LibEDA_BaseStruct* DrawItem );
void EditSymbolText( wxDC* DC, LibEDA_BaseStruct* DrawItem );
void RotateSymbolText( wxDC* DC );
void DeleteDrawPoly( wxDC* DC );
LibDrawField* LocateField( EDA_LibComponentStruct* LibEntry );
LibEDA_BaseStruct* LocateItemUsingCursor();
void RotateField( wxDC* DC, LibDrawField* Field );
void PlaceField( wxDC* DC, LibDrawField* Field );
void EditField( wxDC* DC, LibDrawField* Field );
void StartMoveField( wxDC* DC, LibDrawField* field );
public:
/* Block commands: */
int ReturnBlockCommand( int key );
void HandleBlockPlace( wxDC* DC );
int HandleBlockEnd( wxDC* DC );
void DeletePartInLib( LibraryStruct* Library, EDA_LibComponentStruct* Entry );
void PlacePin( wxDC* DC );
void InitEditOnePin();
void GlobalSetPins( wxDC* DC, LibDrawPin* MasterPin, int id );
// Repetition automatique de placement de pins
void RepeatPinItem( wxDC* DC, LibDrawPin* Pin );
DECLARE_EVENT_TABLE()
};
class LibraryStruct;
class WinEDA_ViewlibFrame : public WinEDA_DrawFrame
{
public:
WinEDAChoiceBox* SelpartBox;
wxListBox* m_LibList;
wxSize m_LibListSize;
wxListBox* m_CmpList;
wxSize m_CmpListSize;
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog
public:
WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent,
LibraryStruct* Library = NULL,
wxSemaphore* semaphore = NULL );
~WinEDA_ViewlibFrame();
void OnSize( wxSizeEvent& event );
void ReCreateListLib();
void ReCreateListCmp();
void Process_Special_Functions( wxCommandEvent& event );
void DisplayLibInfos();
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar();
void ReCreateVToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
int BestZoom(); // Retourne le meilleur zoom
void ClickOnLibList( wxCommandEvent& event );
void ClickOnCmpList( wxCommandEvent& event );
virtual BASE_SCREEN* GetScreen() { return (BASE_SCREEN*) m_CurrentScreen; }
private:
void SelectCurrentLibrary();
void SelectAndViewLibraryPart( int option );
void ExportToSchematicLibraryPart( wxCommandEvent& event );
void ViewOneLibraryContent( LibraryStruct* Lib, int Flag );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
DECLARE_EVENT_TABLE()
};
#endif // WX_EESCHEMA_STRUCT_H
...@@ -323,177 +323,6 @@ public: ...@@ -323,177 +323,6 @@ public:
/*******************************/
/* class WinEDA_SchematicFrame */
/*******************************/
/* enum used in RotationMiroir() */
enum fl_rot_cmp {
CMP_NORMAL, // orientation normale (O, pas de miroir)
CMP_ROTATE_CLOCKWISE, // nouvelle rotation de -90
CMP_ROTATE_COUNTERCLOCKWISE, // nouvelle rotation de +90
CMP_ORIENT_0, // orientation 0, pas de miroir, id CMP_NORMAL
CMP_ORIENT_90, // orientation 90, pas de miroir
CMP_ORIENT_180, // orientation 180, pas de miroir
CMP_ORIENT_270, // orientation -90, pas de miroir
CMP_MIROIR_X = 0x100, // miroir selon axe X
CMP_MIROIR_Y = 0x200 // miroir selon axe Y
};
/*****************************/
/* class WinEDA_LibeditFrame */
/*****************************/
class WinEDA_LibeditFrame : public WinEDA_DrawFrame
{
public:
WinEDAChoiceBox* m_SelpartBox;
WinEDAChoiceBox* m_SelAliasBox;
public:
WinEDA_LibeditFrame( wxWindow* father, WinEDA_App* parent,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_LibeditFrame();
void Process_Special_Functions( wxCommandEvent& event );
void DisplayLibInfos();
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar();
void ReCreateVToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
int BestZoom(); // Retourne le meilleur zoom
void SetToolbars();
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
virtual BASE_SCREEN* GetScreen() { return (BASE_SCREEN*) m_CurrentScreen; }
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
private:
// General:
void CreateNewLibraryPart();
void DeleteOnePart();
void SaveOnePartInMemory();
void SelectActiveLibrary();
bool LoadOneLibraryPart();
void SaveActiveLibrary();
void ImportOnePart();
void ExportOnePart( bool create_lib );
int LoadOneLibraryPartAux( EDA_LibComponentStruct* LibEntry,
LibraryStruct* Library, int noMsg = 0 );
void DisplayCmpDoc( const wxString& Name );
void InstallLibeditFrame( const wxPoint& pos );
// General editing
public:
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 );
private:
bool GetComponentFromUndoList();
bool GetComponentFromRedoList();
// Edition des Pins:
void CreatePin( wxDC* DC );
void DeletePin( wxDC* DC,
EDA_LibComponentStruct* LibEntry,
LibDrawPin* Pin );
void StartMovePin( wxDC* DC );
// Test des pins ( duplicates...)
bool TestPins( EDA_LibComponentStruct* LibEntry );
// Edition de l'ancre
void PlaceAncre();
// Edition des graphismes:
LibEDA_BaseStruct* CreateGraphicItem( wxDC* DC );
void GraphicItemBeginDraw( wxDC* DC );
void StartMoveDrawSymbol( wxDC* DC );
void EndDrawGraphicItem( wxDC* DC );
void LoadOneSymbol( wxDC* DC );
void SaveOneSymbol();
void EditGraphicSymbol( wxDC* DC, LibEDA_BaseStruct* DrawItem );
void EditSymbolText( wxDC* DC, LibEDA_BaseStruct* DrawItem );
void RotateSymbolText( wxDC* DC );
void DeleteDrawPoly( wxDC* DC );
LibDrawField* LocateField( EDA_LibComponentStruct* LibEntry );
LibEDA_BaseStruct* LocateItemUsingCursor();
void RotateField( wxDC* DC, LibDrawField* Field );
void PlaceField( wxDC* DC, LibDrawField* Field );
void EditField( wxDC* DC, LibDrawField* Field );
void StartMoveField( wxDC* DC, LibDrawField* field );
public:
/* Block commands: */
int ReturnBlockCommand( int key );
void HandleBlockPlace( wxDC* DC );
int HandleBlockEnd( wxDC* DC );
void DeletePartInLib( LibraryStruct* Library, EDA_LibComponentStruct* Entry );
void PlacePin( wxDC* DC );
void InitEditOnePin();
void GlobalSetPins( wxDC* DC, LibDrawPin* MasterPin, int id );
// Repetition automatique de placement de pins
void RepeatPinItem( wxDC* DC, LibDrawPin* Pin );
DECLARE_EVENT_TABLE()
};
class LibraryStruct;
class WinEDA_ViewlibFrame : public WinEDA_DrawFrame
{
public:
WinEDAChoiceBox* SelpartBox;
wxListBox* m_LibList;
wxSize m_LibListSize;
wxListBox* m_CmpList;
wxSize m_CmpListSize;
wxSemaphore* m_Semaphore; // != NULL if the frame must emulate a modal dialog
public:
WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent,
LibraryStruct* Library = NULL,
wxSemaphore* semaphore = NULL );
~WinEDA_ViewlibFrame();
void OnSize( wxSizeEvent& event );
void ReCreateListLib();
void ReCreateListCmp();
void Process_Special_Functions( wxCommandEvent& event );
void DisplayLibInfos();
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar();
void ReCreateVToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
int BestZoom(); // Retourne le meilleur zoom
void ClickOnLibList( wxCommandEvent& event );
void ClickOnCmpList( wxCommandEvent& event );
virtual BASE_SCREEN* GetScreen() { return (BASE_SCREEN*) m_CurrentScreen; }
private:
void SelectCurrentLibrary();
void SelectAndViewLibraryPart( int option );
void ExportToSchematicLibraryPart( wxCommandEvent& event );
void ViewOneLibraryContent( LibraryStruct* Lib, int Flag );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
DECLARE_EVENT_TABLE()
};
/****************************************************/ /****************************************************/
/* classe representant un ecran graphique de dessin */ /* classe representant un ecran graphique de dessin */
/****************************************************/ /****************************************************/
......
...@@ -15,21 +15,9 @@ ...@@ -15,21 +15,9 @@
#include "cvpcb.h" #include "cvpcb.h"
#endif #endif
#include "protos.h"
#include "trigo.h" #include "trigo.h"
/**************************************************************/
void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/**************************************************************/
/* fonction virtuelle de placement: non utilisee en pcbnew (utilisee eeschema)
* ---- A mieux utiliser (TODO...)
*/
{
}
/**************************************************/ /**************************************************/
/* Class SCREEN: classe de gestion d'un affichage */ /* Class SCREEN: classe de gestion d'un affichage */
/***************************************************/ /***************************************************/
......
...@@ -44,7 +44,6 @@ ...@@ -44,7 +44,6 @@
#ifdef EESCHEMA #ifdef EESCHEMA
#include "program.h" #include "program.h"
#include "../eeschema/schframe.h"
#endif #endif
////@begin XPM images ////@begin XPM images
......
...@@ -70,16 +70,7 @@ rework zones so they are modifiable and so that the user does not ...@@ -70,16 +70,7 @@ rework zones so they are modifiable and so that the user does not
need to enter tracks for thru hole pads or vias which connect to a zone. need to enter tracks for thru hole pads or vias which connect to a zone.
I propose a two step solution: I propose a two step solution:
1) interim enhancement: make zone edges retained in BRD file and make the 1) interim enhancement: make zone edges retained in BRD file and make the
edges editable. edges editable. (DONE)
2) final solution: get rid of requirement for tracks buried within a zone. 2) final solution: get rid of requirement for tracks buried within a zone.
Reivew the GEDA source code and other sources to gather ideas before doing 2). Review the GEDA source code and other sources to gather ideas before doing 2).
2008-Mar-31 Assigned To:
asked by: Dick Hollenbeck
================================================================================
EESCHEMA:
Derive all eeschema classes from SCH_ITEM, not EDA_BaseStruct.
Move the virtual EDA_BaseStruct::Draw() function into SCH_ITEM, so that
there is no EDA_BaseStruct::Draw() function.
Make the KICAD_T spelling mimic the class names.
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