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

This commit is contained in:
charras 2008-04-14 19:22:48 +00:00
parent 7bb6007a67
commit 7f453831d5
74 changed files with 1499 additions and 1600 deletions

View File

@ -5,6 +5,13 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with
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>
================================================================================
+eeschema

View File

@ -6,6 +6,7 @@ set(COMMON_SRCS
basicframe.cpp
bitmaps.cpp
block_commande.cpp
class_drawpickedstruct.cpp
common.cpp
common_plot_functions.cpp
common_plotHPGL_functions.cpp

View File

@ -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
SEARCH_RESULT EDA_BaseStruct::IterateForward( EDA_BaseStruct* listStart,
@ -827,80 +795,3 @@ void EDA_Rect::Merge( const EDA_Rect& aRect )
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;
}
}

View File

@ -9,6 +9,7 @@
#include "gr_basic.h"
#include "wxstruct.h"
#include "common.h"
#include "sch_item_struct.h"
#include "macros.h"

View File

@ -0,0 +1,84 @@
/****************************************************/
/* 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;
}
}

View File

@ -9,6 +9,7 @@ OBJECTS= \
base_struct.o\
copy_to_clipboard.o\
basicframe.o\
class_drawpickedstruct.o\
common_plot_functions.o\
common_plotPS_functions.o\
common_plotHPGL_functions.o\

View File

@ -13,8 +13,6 @@
#include "protos.h"
#include "schframe.h"
/***********************************************************/
void DrawSheetStruct::Display_Infos( WinEDA_DrawFrame* frame )

View File

@ -9,8 +9,6 @@
#include "netlist.h"
#include "protos.h"
#include "schframe.h"
/* Local Functions*/
static int ListeComposants( CmpListStruct* BaseListeCmp,
DrawSheetPath* sheet );

View File

@ -28,8 +28,9 @@
#include "wx/wx.h"
#endif
#include "../include/wxstruct.h"
#include "schframe.h"
#include "fctsys.h"
#include "common.h"
#include "program.h"
#include "annotate_dialog.h"
extern void DeleteAnnotation( WinEDA_SchematicFrame* parent,

View File

@ -13,24 +13,23 @@
#include "protos.h"
#include "schframe.h"
/* Variables Locales */
/* Fonctions exportees */
/* Fonctions Locales */
static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* screen,
EDA_BaseStruct* DrawStruct );
static SCH_ITEM* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* screen,
SCH_ITEM* DrawStruct );
static void CollectStructsToDrag( SCH_SCREEN* screen );
static void AddPickedItem( SCH_SCREEN* screen, wxPoint position );
static LibEDA_BaseStruct* GetNextPinPosition( SCH_COMPONENT* DrawLibItem,
wxPoint& position );
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,
EDA_BaseStruct* DrawStruct, wxPoint& Center );
static void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center );
SCH_ITEM * DrawStruct, wxPoint& Center );
static void MirrorOneStruct( SCH_ITEM* DrawStruct, wxPoint& Center );
/*************************************************************************/
int WinEDA_SchematicFrame::ReturnBlockCommand( int key )
@ -101,7 +100,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
bool err = FALSE;
DrawBlockStruct* block = &GetScreen()->BlockLocate;
EDA_BaseStruct* NewStruct = NULL;
SCH_ITEM * NewStruct = NULL;
if( DrawPanel->ManageCurseur == NULL )
{
@ -131,9 +130,9 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
if( DrawPanel->ManageCurseur )
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;
DrawPanel->Refresh( TRUE );
break;
@ -143,7 +142,7 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
if( DrawPanel->ManageCurseur )
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,
(block->m_Command == BLOCK_PRESELECT_MOVE) ? IS_CHANGED : IS_NEW );
@ -173,8 +172,8 @@ void WinEDA_SchematicFrame::HandleBlockPlace( wxDC* DC )
GetScreen()->SetModify();
/* clear struct.m_Flags */
EDA_BaseStruct* Struct;
for( Struct = GetScreen()->EEDrawList; Struct != NULL; Struct = Struct->Pnext )
SCH_ITEM* Struct;
for( Struct = GetScreen()->EEDrawList; Struct != NULL; Struct = Struct->Next() )
Struct->m_Flags = 0;
DrawPanel->ManageCurseur = NULL;
@ -204,7 +203,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
* retourne :
* 0 si aucun composant selectionne
* 1 sinon
* -1 si commande termin<EFBFBD>e et composants trouv<EFBFBD>s (block delete, block save)
* -1 si commande terminee et composants trouves (block delete, block save)
*/
{
int ii = 0;
@ -268,7 +267,7 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
if( block->m_BlockDrawStruct != NULL )
{
ii = -1;
DeleteStruct( DrawPanel, DC, block->m_BlockDrawStruct );
DeleteStruct( DrawPanel, DC, (SCH_ITEM*) block->m_BlockDrawStruct );
GetScreen()->SetModify();
}
block->m_BlockDrawStruct = NULL;
@ -284,8 +283,8 @@ int WinEDA_SchematicFrame::HandleBlockEnd( wxDC* DC )
{
wxPoint oldpos = GetScreen()->m_Curseur;
GetScreen()->m_Curseur = wxPoint( 0, 0 );
EDA_BaseStruct* DrawStructCopy =
SaveStructListForPaste( block->m_BlockDrawStruct );
SCH_ITEM * DrawStructCopy =
SaveStructListForPaste( (SCH_ITEM*)block->m_BlockDrawStruct );
PlaceStruct( GetScreen(), DrawStructCopy );
GetScreen()->m_Curseur = oldpos;
ii = -1;
@ -402,7 +401,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
if( block->m_BlockDrawStruct != NULL )
{
ii = -1;
DeleteStruct( DrawPanel, DC, block->m_BlockDrawStruct );
DeleteStruct( DrawPanel, DC, (SCH_ITEM*) block->m_BlockDrawStruct );
GetScreen()->SetModify();
}
TestDanglingEnds( GetScreen()->EEDrawList, DC );
@ -415,8 +414,8 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
{
wxPoint oldpos = GetScreen()->m_Curseur;
GetScreen()->m_Curseur = wxPoint( 0, 0 );
EDA_BaseStruct* DrawStructCopy =
SaveStructListForPaste( block->m_BlockDrawStruct );
SCH_ITEM * DrawStructCopy =
SaveStructListForPaste( (SCH_ITEM*) block->m_BlockDrawStruct );
PlaceStruct( GetScreen(), DrawStructCopy );
GetScreen()->m_Curseur = oldpos;
ii = -1;
@ -439,13 +438,13 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
if( block->m_BlockDrawStruct != NULL )
{
SaveCopyInUndoList( block->m_BlockDrawStruct, IS_CHANGED );
SaveCopyInUndoList( (SCH_ITEM*)block->m_BlockDrawStruct, IS_CHANGED );
ii = -1;
/* Compute the mirror centre and put it on grid */
wxPoint Center = block->Centre();
PutOnGrid( &Center );
MirrorStruct( DrawPanel, DC, block->m_BlockDrawStruct, Center );
MirrorStruct( DrawPanel, DC, (SCH_ITEM*)block->m_BlockDrawStruct, Center );
GetScreen()->SetModify();
}
TestDanglingEnds( GetScreen()->EEDrawList, DC );
@ -500,7 +499,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
{
DrawStructsInGhost( panel,
DC,
PickedList->m_PickedStruct,
(SCH_ITEM*)PickedList->m_PickedStruct,
PtBlock->m_MoveVector.x,
PtBlock->m_MoveVector.y );
PickedList = (DrawPickedStruct*) PickedList->Pnext;
@ -509,7 +508,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
else
DrawStructsInGhost( panel,
DC,
PtBlock->m_BlockDrawStruct,
(SCH_ITEM*)PtBlock->m_BlockDrawStruct,
PtBlock->m_MoveVector.x,
PtBlock->m_MoveVector.y );
}
@ -533,7 +532,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
{
DrawStructsInGhost( panel,
DC,
PickedList->m_PickedStruct,
(SCH_ITEM*)PickedList->m_PickedStruct,
PtBlock->m_MoveVector.x,
PtBlock->m_MoveVector.y );
PickedList = (DrawPickedStruct*) PickedList->Pnext;
@ -542,7 +541,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
else
DrawStructsInGhost( panel,
DC,
PtBlock->m_BlockDrawStruct,
(SCH_ITEM*)PtBlock->m_BlockDrawStruct,
PtBlock->m_MoveVector.x,
PtBlock->m_MoveVector.y );
}
@ -554,7 +553,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
* If DrawStruct is of type DrawPickedStruct, a list of objects picked is *
* 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 )
return FALSE;
@ -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.
@ -753,7 +752,7 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
* If DrawStruct is of type DrawPickedStruct, a list of objects picked is *
* 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 )
return FALSE;
@ -767,7 +766,7 @@ bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
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;
}
@ -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,
EDA_BaseStruct* DrawStruct )
static SCH_ITEM * CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREEN* screen,
SCH_ITEM * DrawStruct )
/*****************************************************************************/
/* 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
* Return the new created struct
*/
{
EDA_BaseStruct* NewDrawStruct;
SCH_ITEM * NewDrawStruct;
DrawPickedStruct* PickedList = NULL;
if( !DrawStruct )
@ -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.
@ -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
* 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 );
return;
}
@ -945,7 +944,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
for( DrawPickedStruct* cur = (DrawPickedStruct*) DrawStruct; cur; cur=cur->Next() )
{
EDA_BaseStruct* item = cur->m_PickedStruct;
SCH_ITEM * item = cur->m_PickedStruct;
screen->RemoveFromDrawList( item );
panel->PostDirtyRect( item->GetBoundingBox() );
item->Pnext = item->Pback = NULL;
@ -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.
@ -988,7 +987,7 @@ EDA_BaseStruct* SaveStructListForPaste( EDA_BaseStruct* DrawStruct )
*/
{
DrawPickedStruct* PickedList;
EDA_BaseStruct* DrawStructCopy;
SCH_ITEM * DrawStructCopy;
if( !DrawStruct )
return NULL;
@ -1028,7 +1027,7 @@ EDA_BaseStruct* SaveStructListForPaste( EDA_BaseStruct* DrawStruct )
*****************************************************************************/
void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
{
EDA_BaseStruct* DrawStruct;
SCH_ITEM * DrawStruct;
DrawPickedStruct* PickedList = NULL;
if( g_BlockSaveDataList == NULL )
@ -1061,11 +1060,11 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
RedrawStructList( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE );
for( PickedList = (DrawPickedStruct*) DrawStruct; PickedList != NULL; )
{
EDA_BaseStruct* Struct = PickedList->m_PickedStruct;
SCH_ITEM * Struct = PickedList->m_PickedStruct;
Struct->Pnext = GetScreen()->EEDrawList;
SetStructFather( Struct, GetScreen() );
GetScreen()->EEDrawList = Struct;
PickedList = (DrawPickedStruct*) PickedList->Pnext;
PickedList = PickedList->Next();
}
/* Save wrapper list in undo stack */
@ -1086,8 +1085,8 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
}
/* clear .m_Flags member for all items */
EDA_BaseStruct* Struct;
for( Struct = GetScreen()->EEDrawList; Struct != NULL; Struct = Struct->Pnext )
SCH_ITEM * Struct;
for( Struct = GetScreen()->EEDrawList; Struct != NULL; Struct = Struct->Next() )
Struct->m_Flags = 0;
GetScreen()->SetModify();
@ -1099,7 +1098,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
/*****************************************************************************
* Routine to place a given object. *
*****************************************************************************/
bool PlaceStruct( BASE_SCREEN* screen, EDA_BaseStruct* DrawStruct )
bool PlaceStruct( BASE_SCREEN* screen, SCH_ITEM * DrawStruct )
{
DrawPickedStruct* DrawStructs;
wxPoint move_vector;
@ -1139,7 +1138,7 @@ bool PlaceStruct( BASE_SCREEN* screen, EDA_BaseStruct* DrawStruct )
while( DrawStructs )
{
MoveOneStruct( DrawStructs->m_PickedStruct, move_vector );
DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext;
DrawStructs = DrawStructs->Next();
}
break;
@ -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.
@ -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.
* The new object is not put in draw list (not linked)
*/
{
EDA_BaseStruct* NewDrawStruct = NULL;
SCH_ITEM * NewDrawStruct = NULL;
if( DrawStruct == NULL )
{
@ -1351,7 +1350,7 @@ EDA_BaseStruct* DuplicateStruct( EDA_BaseStruct* DrawStruct )
LastPickedItem = NewPickedItem;
NewPickedItem->m_PickedStruct =
DuplicateStruct( PickedList->m_PickedStruct );
PickedList = (DrawPickedStruct*) PickedList->Pnext;
PickedList = PickedList->Next();
}
break;
@ -1380,12 +1379,12 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
/****************************************************/
{
DrawPickedStruct* DrawStructs, * FirstPicked;
EDA_BaseStruct* Struct;
SCH_ITEM * Struct;
EDA_DrawLineStruct* SegmStruct;
int ox, oy, fx, fy;
/* 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;
if( screen->BlockLocate.m_BlockDrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
@ -1397,7 +1396,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
while( DrawStructs )
{
Struct = DrawStructs->m_PickedStruct;
DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext;
DrawStructs = DrawStructs->Next();
Struct->m_Flags = SELECTED;
}
}
@ -1419,7 +1418,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
* a qu'un seul element ( pour homogeneiser les traitements ulterieurs */
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;
}
@ -1429,7 +1428,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
while( DrawStructs )
{
Struct = DrawStructs->m_PickedStruct;
DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext;
DrawStructs = DrawStructs->Next();
if( Struct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
{
SegmStruct = (EDA_DrawLineStruct*) Struct;
@ -1451,7 +1450,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
while( DrawStructs )
{
Struct = DrawStructs->m_PickedStruct;
DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext;
DrawStructs = DrawStructs->Next();
if( Struct->Type() == TYPE_SCH_COMPONENT )
{
LibEDA_BaseStruct* DrawItem;
@ -1492,7 +1491,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
/******************************************************************/
{
DrawPickedStruct* DrawStructs;
EDA_BaseStruct* Struct;
SCH_ITEM * Struct;
/* Examen de la liste des elements deja selectionnes */
DrawStructs = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct;
@ -1649,7 +1648,7 @@ static void AddPickedItem( SCH_SCREEN* screen, wxPoint position )
default:
break;
}
Struct = Struct->Pnext;
Struct = Struct->Next();
}
}

View File

@ -12,8 +12,6 @@
#include "protos.h"
#include "schframe.h"
/* Routines Locales */
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 )
static bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos );
static void ComputeBreakPoint( EDA_DrawLineStruct* segment, const wxPoint& new_pos );
EDA_BaseStruct* s_OldWiresList;
SCH_ITEM* s_OldWiresList;
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.
@ -41,11 +39,11 @@ EDA_BaseStruct* SCH_SCREEN::ExtractWires( bool CreateCopy )
* 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 )
{
next_item = item->Pnext;
next_item = item->Next();
switch( item->Type() )
{
@ -81,11 +79,11 @@ static void RestoreOldWires( SCH_SCREEN* screen )
/* 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 )
{
next_item = item->Pnext;
next_item = item->Next();
switch( item->Type() )
{
@ -102,7 +100,7 @@ static void RestoreOldWires( SCH_SCREEN* screen )
while( s_OldWiresList )
{
next_item = s_OldWiresList->Pnext;
next_item = s_OldWiresList->Next();
s_OldWiresList->Pnext = screen->EEDrawList,
screen->EEDrawList = s_OldWiresList;
s_OldWiresList = next_item;
@ -194,7 +192,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
/* Creation du segment suivant ou fin de trac<61> 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;
}
@ -379,7 +377,7 @@ static void Segment_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if( CurrentLine == NULL )
return;
color = ReturnLayerColor( CurrentLine->m_Layer ) ^ HIGHT_LIGHT_FLAG;
color = ReturnLayerColor( CurrentLine->GetLayer() ) ^ HIGHT_LIGHT_FLAG;
if( erase )
{
@ -470,7 +468,7 @@ static void Show_Polyline_in_Ghost( WinEDA_DrawPanel* panel, wxDC* DC, bool eras
wxPoint endpos;
endpos = panel->m_Parent->GetScreen()->m_Curseur;
color = ReturnLayerColor( NewPoly->m_Layer );
color = ReturnLayerColor( NewPoly->GetLayer() );
GRSetDrawMode( DC, g_XorMode );
@ -521,7 +519,7 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC )
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;
GetScreen()->SetCurItem( NULL );
}
@ -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)
*/
@ -592,7 +590,7 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->ManageCurseur( Panel, DC, FALSE );
Panel->ManageCurseur = NULL;
Panel->ForceCloseManageCurseur = NULL;
EraseStruct( Screen->GetCurItem(), (SCH_SCREEN*) Screen );
EraseStruct( (SCH_ITEM*) Screen->GetCurItem(), (SCH_SCREEN*) Screen );
Screen->SetCurItem( NULL );
RestoreOldWires( Screen );
}
@ -600,11 +598,11 @@ static void AbortCreateNewLine( WinEDA_DrawPanel* Panel, wxDC* DC )
g_ItemToRepeat = NULL; // Fin de commande generale
/* Clear m_Flags wich is used in edit functions: */
EDA_BaseStruct* item = Screen->EEDrawList;
SCH_ITEM* item = Screen->EEDrawList;
while( item )
{
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 )
&& ( ( (SCH_GLOBALLABEL*) item )->m_Pos.y == pos.y ) )
return TRUE;
pinsheet = LocateAnyPinSheet( pos, screen );
pinsheet = LocateAnyPinSheet( pos, screen->EEDrawList );
if( pinsheet && !IsBusLabel( pinsheet->m_Text ) )
{
itempos = pinsheet->m_Pos;
@ -880,7 +878,7 @@ bool IsJunctionNeeded( WinEDA_SchematicFrame* frame, wxPoint& pos )
{
if( PickStruct( pos, frame->GetScreen(), WIREITEM | WIRE_BUS_ENDPOINTS_ONLY ) )
return TRUE;
if( frame->LocatePinEnd( frame->GetScreen(), pos ) )
if( frame->LocatePinEnd( frame->GetScreen()->EEDrawList, pos ) )
return TRUE;
}

View File

@ -13,8 +13,6 @@
#include "protos.h"
#include "schframe.h"
/* Routines Locales */
/* Variables locales */

View File

@ -31,12 +31,11 @@
#include "general.h"
#include "protos.h"
#include "schframe.h"
/***********************************************************/
DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
EDA_BaseStruct( DRAW_SHEET_STRUCT_TYPE )
SCH_ITEM( NULL, DRAW_SHEET_STRUCT_TYPE )
/***********************************************************/
{
m_Label = NULL;
@ -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
/*******************************************************************/
DrawSheetLabelStruct::DrawSheetLabelStruct( DrawSheetStruct* parent,
const wxPoint& pos, const wxString& text ) :
EDA_BaseStruct( DRAW_SHEETLABEL_STRUCT_TYPE )
SCH_ITEM( NULL, DRAW_SHEETLABEL_STRUCT_TYPE )
, EDA_TextStruct( text )
/*******************************************************************/
{
m_Layer = LAYER_SHEETLABEL;
m_Parent = parent;
m_Pos = pos;
m_Edge = 0;
m_Shape = NET_INPUT;

View File

@ -14,11 +14,10 @@
extern DrawSheetStruct* g_RootSheet;
class DrawSheetLabelStruct : public EDA_BaseStruct,
class DrawSheetLabelStruct : public SCH_ITEM,
public EDA_TextStruct
{
public:
int m_Layer;
int m_Edge, m_Shape;
bool m_IsDangling; // TRUE non connected
@ -50,7 +49,7 @@ public:
*/
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:
wxString m_SheetName; //this is equivalent to C101 for components:

View File

@ -8,7 +8,6 @@
#include "general.h"
#include "protos.h"
#include "schframe.h"
/******************************************************************/
@ -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.
@ -113,12 +112,12 @@ void SCH_SCREEN::FreeDrawList()
/* Routine to clear (free) EESchema drawing list of a screen.
*/
{
EDA_BaseStruct* DrawStruct;
SCH_ITEM* DrawStruct;
while( EEDrawList != NULL )
{
DrawStruct = EEDrawList;
EEDrawList = EEDrawList->Pnext;
EEDrawList = EEDrawList->Next();
SAFE_DELETE( DrawStruct );
}
@ -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.
@ -135,34 +134,34 @@ void SCH_SCREEN::RemoveFromDrawList( EDA_BaseStruct* DrawStruct )
*/
{
if( DrawStruct == EEDrawList )
EEDrawList = EEDrawList->Pnext;
EEDrawList = EEDrawList->Next();
else
{
EDA_BaseStruct* DrawList = EEDrawList;
while( DrawList && DrawList->Pnext )
while( DrawList && DrawList->Next() )
{
if( DrawList->Pnext == DrawStruct )
{
DrawList->Pnext = DrawList->Pnext->Pnext;
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 )
{
if( DrawList == st )
return true;
DrawList = DrawList->Pnext;
DrawList = DrawList->Next();
}
return false;
@ -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.
st->Pnext = EEDrawList;

View File

@ -35,13 +35,13 @@ public:
void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies)
void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { };
void RemoveFromDrawList( EDA_BaseStruct* DrawStruct ); /* remove DrawStruct from EEDrawList. */
bool CheckIfOnDrawList( EDA_BaseStruct* st );
void AddToDrawList( EDA_BaseStruct* DrawStruct );
void RemoveFromDrawList( SCH_ITEM* DrawStruct ); /* remove DrawStruct from EEDrawList. */
bool CheckIfOnDrawList( SCH_ITEM* st );
void AddToDrawList( SCH_ITEM* DrawStruct );
void ClearUndoORRedoList( EDA_BaseStruct* List );
bool SchematicCleanUp( wxDC* DC = NULL );
EDA_BaseStruct* ExtractWires( bool CreateCopy );
SCH_ITEM* ExtractWires( bool CreateCopy );
/* full undo redo management : */
virtual void ClearUndoRedoList();

View File

@ -14,7 +14,6 @@
#include "id.h"
#include "protos.h"
#include "schframe.h"
/************************/
@ -113,7 +112,7 @@ void SCH_TEXT::Place( WinEDA_DrawFrame* frame, wxDC* DC )
SAFE_DELETE( g_ItemToUndoCopy );
}
EDA_BaseStruct::Place( frame, DC );
SCH_ITEM::Place( frame, DC );
}

View File

@ -12,7 +12,6 @@
#include "netlist.h"
#include "macros.h"
#include "protos.h"
#include "schframe.h"
/* Routines locales */
@ -30,16 +29,16 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
* - Detecte les objets identiques superposes
*/
{
EDA_BaseStruct* DrawList, * TstDrawList;
SCH_ITEM* DrawList, * TstDrawList;
int flag;
bool Modify = FALSE;
DrawList = EEDrawList;
for( ; DrawList != NULL; DrawList = DrawList->Pnext )
for( ; DrawList != NULL; DrawList = DrawList->Next() )
{
if( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE )
{
TstDrawList = DrawList->Pnext;
TstDrawList = DrawList->Next();
while( TstDrawList )
{
if( TstDrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE )
@ -56,10 +55,10 @@ bool SCH_SCREEN::SchematicCleanUp( wxDC* DC )
Modify = TRUE;
}
else
TstDrawList = TstDrawList->Pnext;
TstDrawList = TstDrawList->Next();
}
else
TstDrawList = TstDrawList->Pnext;
TstDrawList = TstDrawList->Next();
}
}
}
@ -77,7 +76,7 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
* et les raccords
*/
{
EDA_BaseStruct* DrawList;
SCH_ITEM* DrawList;
if( Screen == NULL )
{
@ -120,7 +119,7 @@ void BreakSegmentOnJunction( SCH_SCREEN* Screen )
default:
break;
}
DrawList = DrawList->Pnext;
DrawList = DrawList->Next();
}
}
@ -216,7 +215,7 @@ static int TstAlignSegment( EDA_DrawLineStruct* RefSegm,
{
if( RefSegm == TstSegm )
return 0;
if( RefSegm->m_Layer != TstSegm->m_Layer )
if( RefSegm->GetLayer() != TstSegm->GetLayer() )
return 0;
// search for a common end, and modify coordinates to ensure RefSegm->m_End == TstSegm->m_Start

View File

@ -16,7 +16,7 @@
/*******************************************************************/
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;
@ -67,7 +67,7 @@ DrawBusEntryStruct* DrawBusEntryStruct::GenCopy()
/************************************************************/
DrawJunctionStruct::DrawJunctionStruct( const wxPoint& pos ) :
EDA_BaseStruct( DRAW_JUNCTION_STRUCT_TYPE )
SCH_ITEM( NULL, DRAW_JUNCTION_STRUCT_TYPE )
/************************************************************/
{
m_Pos = pos;
@ -91,7 +91,7 @@ DrawJunctionStruct* DrawJunctionStruct::GenCopy()
/*****************************/
DrawNoConnectStruct::DrawNoConnectStruct( const wxPoint& pos ) :
EDA_BaseStruct( DRAW_NOCONNECT_STRUCT_TYPE )
SCH_ITEM( NULL, DRAW_NOCONNECT_STRUCT_TYPE )
{
m_Pos = pos;
}
@ -112,7 +112,7 @@ DrawNoConnectStruct* DrawNoConnectStruct::GenCopy()
/**************************/
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_Type = MARQ_UNSPEC;
@ -165,7 +165,7 @@ void DrawMarkerStruct::Show( int nestLevel, std::ostream& os )
/***************************/
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_End = pos;
@ -294,7 +294,7 @@ EDA_Rect SCH_COMPONENT::GetBoundingBox()
/***********************************************************/
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. */

View File

@ -15,7 +15,6 @@
#include "protos.h"
#include "macros.h"
#include "schframe.h"
#include <wx/arrimpl.cpp>
@ -152,13 +151,11 @@ void SCH_COMPONENT::SetRef( DrawSheetPath* sheet, const wxString& ref )
}
if( notInArray )
{
m_References.Add( ref );
m_Paths.Add( path );
}
AddHierarchicalReference(path, ref);
if( m_Field[REFERENCE].m_Text.IsEmpty()
|| ( 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..
m_Field[REFERENCE].m_Pos = m_Pos;
@ -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
/******************************************************************/
{
// avoid unnecessarily copying wxStrings.
static const wxString myEmpty = wxEmptyString;
@ -216,13 +205,13 @@ SCH_COMPONENT::SCH_COMPONENT( const wxPoint& aPos ) :
for( ii = 0; ii < NUMBER_OF_FIELDS; ii++ )
{
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_Parent = this;
}
m_Field[VALUE].m_Layer = LAYER_VALUEPART;
m_Field[REFERENCE].m_Layer = LAYER_REFERENCEPART;
m_Field[VALUE].SetLayer(LAYER_VALUEPART);
m_Field[REFERENCE].SetLayer(LAYER_REFERENCEPART);
m_PrefixString = wxString( _( "U" ) );
}
@ -347,7 +336,7 @@ void SCH_COMPONENT::Place( WinEDA_DrawFrame* frame, wxDC* DC )
SAFE_DELETE( g_ItemToUndoCopy );
}
EDA_BaseStruct::Place( frame, DC );
SCH_ITEM::Place( frame, DC );
}
@ -378,11 +367,6 @@ void SCH_COMPONENT::ClearAnnotation()
if( !Entry || !Entry->m_UnitSelectionLocked )
{
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 )
/***************************************************************************/
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 )
/***************************************************************************/
{
m_Pos = pos;
m_FieldId = 0;
m_AddExtraText = false;
}

View File

@ -37,14 +37,14 @@ enum NumFieldType {
* component fields are texts attached to the component (not the graphic texts)
* There are 2 major fields : Reference and Value
*/
class PartTextStruct : public EDA_BaseStruct,
class PartTextStruct : public SCH_ITEM,
public EDA_TextStruct
{
public:
int m_Layer;
int m_FieldId;
int m_FieldId; // Field indicator type (REFERENCE, VALUE or other id)
wxString m_Name; /* Field name (ref, value,pcb, sheet, filed 1..
* 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:
PartTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
@ -62,6 +62,14 @@ public:
EDA_Rect GetBoundaryBox() const;
bool IsVoid();
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:
private:
wxArrayString m_Paths; // /sheet1/C102, /sh2/sh1/U32 etc.
wxArrayString m_References; // C102, U32 etc.
wxArrayString m_PartPerPackageSelections; // "1", "2" etc. when a component has more than 1 partper package
public:
SCH_COMPONENT( const wxPoint& pos = wxPoint( 0, 0 ) );
@ -136,6 +143,7 @@ public:
const wxPoint& offset,
int draw_mode,
int Color = -1 );
void SwapData( SCH_COMPONENT* copyitem );
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
@ -145,7 +153,6 @@ public:
wxString GetPath( DrawSheetPath* sheet );
const wxString GetRef( DrawSheetPath* sheet );
void SetRef( DrawSheetPath* sheet, const wxString & ref );
void ClearRefs();
void AddHierarchicalReference(const wxString & path, const wxString & ref);
int GetUnitSelection( DrawSheetPath* aSheet );
void SetUnitSelection( DrawSheetPath* aSheet, int aUnitSelection );

View File

@ -17,11 +17,8 @@
#include "protos.h"
#include "schframe.h"
/**************************************************************/
EDA_BaseStruct* WinEDA_SchematicFrame::
SchematicGeneralLocateAndDisplay( bool IncludePin )
SCH_ITEM * WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( bool IncludePin )
/**************************************************************/
/* Routine de localisation et d'affichage des caract (si utile )
@ -38,7 +35,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
* Null sinon
*/
{
EDA_BaseStruct* DrawStruct;
SCH_ITEM* DrawStruct;
wxString msg;
wxPoint mouse_position = GetScreen()->m_MousePosition;
LibDrawPin* Pin = NULL;
@ -96,8 +93,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
/************************************************************************************/
EDA_BaseStruct* WinEDA_SchematicFrame::
SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
SCH_ITEM* WinEDA_SchematicFrame:: SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
/************************************************************************************/
/* Find the schematic item at position "refpoint"
@ -116,14 +112,14 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
* For some items, caracteristics are displayed on the screen.
*/
{
EDA_BaseStruct* DrawStruct;
SCH_ITEM* DrawStruct;
LibDrawPin* Pin;
SCH_COMPONENT* LibItem;
wxString Text;
wxString msg;
int ii;
DrawStruct = PickStruct( refpoint, GetScreen(), MARKERITEM );
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), MARKERITEM );
if( DrawStruct )
{
DrawMarkerStruct* Marker = (DrawMarkerStruct*) DrawStruct;
@ -136,27 +132,24 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
return DrawStruct;
}
DrawStruct = PickStruct( refpoint, GetScreen(),
NOCONNECTITEM );
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), NOCONNECTITEM );
if( DrawStruct )
{
MsgPanel->EraseMsgBox();
return DrawStruct;
}
DrawStruct = PickStruct( refpoint, GetScreen(),
JUNCTIONITEM );
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), JUNCTIONITEM );
if( DrawStruct )
{
MsgPanel->EraseMsgBox();
return DrawStruct;
}
DrawStruct = PickStruct( refpoint, GetScreen(),
WIREITEM | BUSITEM | RACCORDITEM );
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), WIREITEM | BUSITEM | RACCORDITEM );
if( DrawStruct ) // Search for a pin
{
Pin = LocateAnyPin( m_CurrentSheet->LastDrawList(), refpoint, &LibItem );
Pin = LocateAnyPin( (SCH_ITEM*) m_CurrentSheet->LastDrawList(), refpoint, &LibItem );
if( Pin )
{
Pin->Display_Infos( this );
@ -171,7 +164,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
return DrawStruct;
}
DrawStruct = PickStruct( refpoint, GetScreen(), FIELDCMPITEM );
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), FIELDCMPITEM );
if( DrawStruct )
{
PartTextStruct* Field = (PartTextStruct*) DrawStruct;
@ -182,7 +175,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
}
/* search for a pin */
Pin = LocateAnyPin( m_CurrentSheet->LastDrawList(), refpoint, &LibItem );
Pin = LocateAnyPin( (SCH_ITEM*) m_CurrentSheet->LastDrawList(), refpoint, &LibItem );
if( Pin )
{
Pin->Display_Infos( this );
@ -195,7 +188,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
return LibItem;
}
DrawStruct = PickStruct( refpoint, GetScreen(), LIBITEM );
DrawStruct = (SCH_ITEM*) PickStruct( refpoint, GetScreen(), LIBITEM );
if( DrawStruct )
{
DrawStruct = LocateSmallestComponent( (SCH_SCREEN*)GetScreen() );
@ -204,8 +197,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
return DrawStruct;
}
DrawStruct = PickStruct( refpoint, GetScreen(),
SHEETITEM );
DrawStruct = (SCH_ITEM*)PickStruct( refpoint, GetScreen(), SHEETITEM );
if( DrawStruct )
{
( (DrawSheetStruct*) DrawStruct )->Display_Infos( this );
@ -213,8 +205,7 @@ SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, bool IncludePin )
}
// Recherche des autres elements
DrawStruct = PickStruct( refpoint, GetScreen(),
SEARCHALL );
DrawStruct = (SCH_ITEM*)PickStruct( refpoint, GetScreen(), SEARCHALL );
if( DrawStruct )
{
return DrawStruct;

View File

@ -15,8 +15,6 @@
#include "protos.h"
#include "schframe.h"
/***************************************************************/
void RemoteCommand( const char* cmdline )

View File

@ -12,8 +12,6 @@
#include "netlist.h" /* Definitions generales liees au calcul de netliste */
#include "protos.h"
#include "schframe.h"
enum End_Type {
UNKNOWN = 0,
@ -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
@ -107,7 +105,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC
ItemList = RebuildEndList( DrawList );
// Controle des elements
for( DrawItem = DrawList; DrawItem != NULL; DrawItem = DrawItem->Pnext )
for( DrawItem = DrawList; DrawItem != NULL; DrawItem = DrawItem->Next() )
{
switch( DrawItem->Type() )
{
@ -123,14 +121,14 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC
case DRAW_SEGMENT_STRUCT_TYPE:
#undef STRUCT
#define STRUCT ( (EDA_DrawLineStruct*) DrawItem )
if( STRUCT->m_Layer == LAYER_WIRE )
if( STRUCT->GetLayer() == LAYER_WIRE )
{
TestWireForDangling( STRUCT, this, DC );
break;
}
if( STRUCT->m_Layer == LAYER_NOTES )
if( STRUCT->GetLayer() == LAYER_NOTES )
break;
if( STRUCT->m_Layer == LAYER_BUS )
if( STRUCT->GetLayer() == LAYER_BUS )
{
STRUCT->m_StartIsDangling =
STRUCT->m_EndIsDangling = FALSE;
@ -145,14 +143,13 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC
}
/********************************************************************/
LibDrawPin* WinEDA_SchematicFrame::LocatePinEnd( EDA_BaseStruct* DrawList,
const wxPoint& pos )
/********************************************************************/
/************************************************************************************************/
LibDrawPin* WinEDA_SchematicFrame::LocatePinEnd( SCH_ITEM* DrawList, const wxPoint& pos )
/************************************************************************************************/
/* Teste si le point de coordonn<6E>es pos est sur l'extr<74>mit<69> d'une PIN
* retourne un pointeur sur la pin
* NULL sinon
/** Teste if point pos is on a pin end
* @return un pointer on the pin or NULL
* @param DrawList = list of SCH_ITEMs
*/
{
SCH_COMPONENT* DrawLibItem;
@ -337,11 +334,11 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
case DRAW_SEGMENT_STRUCT_TYPE:
#undef STRUCT
#define STRUCT ( (EDA_DrawLineStruct*) DrawItem )
if( STRUCT->m_Layer == LAYER_NOTES )
if( STRUCT->GetLayer() == LAYER_NOTES )
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 );
item->m_Item = DrawItem;
@ -351,7 +348,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
else
StartList = item;
lastitem = item;
item = new DanglingEndHandle( (STRUCT->m_Layer == LAYER_BUS) ?
item = new DanglingEndHandle( (STRUCT->GetLayer() == LAYER_BUS) ?
BUS_END_END : WIRE_END_END );
item->m_Item = DrawItem;

View File

@ -13,12 +13,10 @@
#include "protos.h"
#include "schframe.h"
/********************************************************************************/
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 :
@ -28,13 +26,13 @@ static int CountConnectedItems( WinEDA_SchematicFrame* frame,
* Used by WinEDA_SchematicFrame::DeleteConnection()
*/
{
EDA_BaseStruct* Struct;
SCH_ITEM* Struct;
int count = 0;
if( frame->LocatePinEnd( ListStruct, pos ) )
count++;
for( Struct = ListStruct; Struct != NULL; Struct = Struct->Pnext )
for( Struct = ListStruct; Struct != NULL; Struct = Struct->Next() )
{
if( Struct->m_Flags & STRUCT_DELETED )
continue;
@ -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 )
/************************************************************************************/
@ -76,7 +74,7 @@ static bool MarkConnected( WinEDA_SchematicFrame* frame, EDA_BaseStruct* ListStr
{
EDA_BaseStruct* Struct;
for( Struct = ListStruct; Struct != NULL; Struct = Struct->Pnext )
for( Struct = ListStruct; Struct != NULL; Struct = Struct->Next() )
{
if( Struct->m_Flags )
continue;
@ -125,11 +123,11 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
*/
{
wxPoint refpos = GetScreen()->m_Curseur;
EDA_BaseStruct* DelStruct;
SCH_ITEM* DelStruct;
DrawPickedStruct* PickedItem, * PickedList = NULL;
/* 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;
BreakSegmentOnJunction( (SCH_SCREEN*) GetScreen() );
@ -139,7 +137,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
* of items to delete
*/
SCH_SCREEN* screen = (SCH_SCREEN*) GetScreen();
EDA_BaseStruct* savedEEDrawList = screen->EEDrawList;
SCH_ITEM* savedEEDrawList = screen->EEDrawList;
while( DelStruct
&& ( DelStruct = PickStruct( screen->m_Curseur,
screen, JUNCTIONITEM | WIREITEM | BUSITEM ) ) != NULL )
@ -151,7 +149,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
PickedItem->Pnext = PickedList;
PickedList = PickedItem;
DelStruct = DelStruct->Pnext;
DelStruct = DelStruct->Next();
screen->EEDrawList = DelStruct;
}
@ -161,7 +159,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
*/
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) )
continue;
@ -175,7 +173,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
}
// 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;
@ -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)
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Pnext )
for( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Next() )
{
int count;
if( DelStruct->m_Flags & STRUCT_DELETED )
@ -275,7 +273,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
// Delete labels attached to wires
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 )
continue;
@ -302,7 +300,7 @@ void WinEDA_SchematicFrame::DeleteConnection( wxDC* DC, bool DeleteFullConnectio
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;
if( PickedList )
@ -331,7 +329,7 @@ bool LocateAndDeleteItem( WinEDA_SchematicFrame* frame, wxDC* DC )
* return TRUE if an item was deleted
*/
{
EDA_BaseStruct* DelStruct;
SCH_ITEM* DelStruct;
SCH_SCREEN* screen = (SCH_SCREEN*) ( frame->GetScreen() );
bool item_deleted = FALSE;
@ -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
@ -444,7 +442,7 @@ void EraseStruct( EDA_BaseStruct* DrawStruct, SCH_SCREEN* Screen )
{
if( PickedList->m_PickedStruct == Screen->EEDrawList )
{
Screen->EEDrawList = Screen->EEDrawList->Pnext;
Screen->EEDrawList = Screen->EEDrawList->Next();
SAFE_DELETE( DrawStruct );
}
else
@ -468,7 +466,7 @@ void EraseStruct( EDA_BaseStruct* DrawStruct, SCH_SCREEN* Screen )
{
if( DrawStruct == Screen->EEDrawList )
{
Screen->EEDrawList = DrawStruct->Pnext;
Screen->EEDrawList = DrawStruct->Next();
SAFE_DELETE( DrawStruct );
}
else
@ -495,7 +493,7 @@ void DeleteAllMarkers( int type )
/* Effacement des marqueurs du type "type" */
{
SCH_SCREEN* screen;
EDA_BaseStruct* DrawStruct, * NextStruct;
SCH_ITEM * DrawStruct, * NextStruct;
DrawMarkerStruct* Marker;
EDA_ScreenList ScreenList;
@ -504,7 +502,7 @@ void DeleteAllMarkers( int type )
{
for( DrawStruct = screen->EEDrawList; DrawStruct != NULL; DrawStruct = NextStruct )
{
NextStruct = DrawStruct->Pnext;
NextStruct = DrawStruct->Next();
if( DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE )
continue;

View File

@ -11,7 +11,6 @@
#include "general.h"
#include "protos.h"
#include "schframe.h"
/**************************************************************************/

View File

@ -40,8 +40,6 @@
#include "id.h"
#include "schframe.h"
#include "dialog_eeschema_config.h"
////@begin XPM images

View File

@ -1,12 +1,12 @@
/////////////////////////////////////////////////////////////////////////////
// Name: dialog_erc.cpp
// Purpose:
// Purpose:
// Author: jean-pierre Charras
// Modified by:
// Modified by:
// Created: 12/02/2006 17:08:38
// RCS-ID:
// RCS-ID:
// Copyright: License GNU
// Licence:
// Licence:
/////////////////////////////////////////////////////////////////////////////
// Generated by DialogBlocks (unregistered), 12/02/2006 17:08:38
@ -37,7 +37,6 @@
#include "netlist.h"
#include "protos.h"
#include "schframe.h"
#include "dialog_erc.h"
@ -85,7 +84,7 @@ WinEDA_ErcFrame::WinEDA_ErcFrame( )
WinEDA_ErcFrame::WinEDA_ErcFrame( WinEDA_SchematicFrame* parent, wxWindowID id, const wxString& caption, const wxPoint& pos, const wxSize& size, long style )
{
int ii, jj;
m_Parent = parent;
m_Initialized = FALSE;
for( ii = 0; ii < PIN_NMAX; ii++ )
@ -104,7 +103,7 @@ int ii, jj;
num.Printf(wxT("%d"), g_EESchemaVar.NbWarningErc);
m_LastWarningCount->SetLabel(num);
}
/*!
@ -150,7 +149,7 @@ bool WinEDA_ErcFrame::Create( wxWindow* parent, wxWindowID id, const wxString& c
*/
void WinEDA_ErcFrame::CreateControls()
{
{
SetFont(*g_DialogFont);
////@begin WinEDA_ErcFrame content construction
@ -287,7 +286,7 @@ wxIcon WinEDA_ErcFrame::GetIconResource( const wxString& name )
void WinEDA_ErcFrame::OnEraseDrcMarkersClick( wxCommandEvent& event )
{
DelERCMarkers(event);
DelERCMarkers(event);
}
/*!
@ -315,5 +314,5 @@ void WinEDA_ErcFrame::OnResetMatrixClick( wxCommandEvent& event )
void WinEDA_ErcFrame::OnErcCmpClick( wxCommandEvent& event )
{
TestErc(event);
TestErc(event);
}

View File

@ -14,8 +14,6 @@
#include "protos.h"
#include "schframe.h"
/* Fonctions exportees */
@ -557,7 +555,8 @@ void WinEDA_SchematicFrame::EditCmpFieldText( PartTextStruct* Field, wxDC* DC )
DrawPanel->MouseToCursorSchema();
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() )
{
@ -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 );
GetScreen()->SetModify();
}
@ -612,8 +611,11 @@ static void MoveCmpField( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
FieldNumber = CurrentField->m_FieldId;
/* Effacement: */
CurrentField->m_AddExtraText = Multiflag;
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;
@ -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.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 )
Panel->ManageCurseur = NULL;
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_Pos = OldPos;
DrawTextField( Panel, DC, CurrentField, Multiflag, GR_DEFAULT_DRAWMODE );
CurrentField->Draw( Panel, DC, wxPoint(0,0), g_XorMode );
}
CurrentField = NULL;
SAFE_DELETE( g_ItemToUndoCopy );
@ -677,13 +680,14 @@ void WinEDA_SchematicFrame::RotateCmpField( PartTextStruct* Field, wxDC* DC )
if( Field->m_Flags == 0 )
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 )
Field->m_Orient = TEXT_ORIENT_VERT;
else
Field->m_Orient = TEXT_ORIENT_HORIZ;
DrawTextField( DrawPanel, DC, Field, flag, g_XorMode );
Field->Draw( DrawPanel, DC, wxPoint(0,0), g_XorMode );
GetScreen()->SetModify();
}
@ -693,7 +697,7 @@ void WinEDA_SchematicFrame::RotateCmpField( PartTextStruct* Field, wxDC* DC )
void PartTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/*********************************************************************/
{
int FieldNumber, flag;
int FieldNumber;
EDA_LibComponentStruct* Entry;
frame->DrawPanel->ManageCurseur = NULL;
@ -709,19 +713,18 @@ void PartTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
}
FieldNumber = m_FieldId;
flag = 0;
m_AddExtraText = 0;
if( FieldNumber == REFERENCE )
{
Entry = FindLibPart( Cmp->m_ChipName.GetData(),
wxEmptyString, FIND_ROOT );
Entry = FindLibPart( Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry != NULL )
{
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;
frame->GetScreen()->SetCurItem( NULL );
frame->GetScreen()->SetModify();
@ -757,9 +760,10 @@ void WinEDA_SchematicFrame::EditComponentReference( SCH_COMPONENT* Cmp, wxDC* DC
SaveCopyInUndoList( Cmp, IS_CHANGED );
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 );
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 );
GetScreen()->SetModify();
}
@ -774,7 +778,6 @@ void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC )
{
wxString msg;
EDA_LibComponentStruct* Entry;
int flag = 0;
if( Cmp == NULL )
return;
@ -782,8 +785,6 @@ void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC )
Entry = FindLibPart( Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry == NULL )
return;
if( Entry->m_UnitCount > 1 )
flag = 1;
PartTextStruct* TextField = &Cmp->m_Field[VALUE];
@ -797,9 +798,9 @@ void WinEDA_SchematicFrame::EditComponentValue( SCH_COMPONENT* Cmp, wxDC* DC )
if( Cmp->m_Flags == 0 )
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;
DrawTextField( DrawPanel, DC, &Cmp->m_Field[VALUE], flag,
TextField->Draw( DrawPanel, DC, wxPoint(0,0),
Cmp->m_Flags ? g_XorMode : GR_DEFAULT_DRAWMODE );
GetScreen()->SetModify();
}
@ -813,7 +814,6 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC
{
wxString msg;
EDA_LibComponentStruct* Entry;
int flag = 0;
bool wasEmpty = false;
if( Cmp == NULL )
@ -822,8 +822,6 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC
Entry = FindLibPart( Cmp->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry == NULL )
return;
if( Entry->m_UnitCount > 1 )
flag = 1;
PartTextStruct* TextField = &Cmp->m_Field[FOOTPRINT];
@ -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 ... */
if( Cmp->m_Flags == 0 )
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.
if(wasEmpty && !msg.IsEmpty())
{
@ -853,7 +851,7 @@ void WinEDA_SchematicFrame::EditComponentFootprint( SCH_COMPONENT* Cmp, wxDC* DC
}
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 );
GetScreen()->SetModify();

View File

@ -13,8 +13,6 @@
#include "protos.h"
#include "schframe.h"
/* Fonctions locales */
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
static void ExitMoveTexte( WinEDA_DrawPanel* panel, wxDC* DC );
@ -116,7 +114,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC )
/*************************************************************************/
void WinEDA_SchematicFrame::EditSchematicText( SCH_TEXT* TextStruct,
wxDC* DC )
wxDC* DC )
/*************************************************************************/
/* Edit the properties of the text (Label, Global label, graphic text).. )
@ -130,8 +128,8 @@ void WinEDA_SchematicFrame::EditSchematicText( SCH_TEXT* TextStruct,
RedrawOneStruct( DrawPanel, DC, TextStruct, g_XorMode );
WinEDA_LabelPropertiesFrame* frame = new WinEDA_LabelPropertiesFrame( this,
TextStruct,
wxPoint( 30, 30 ) );
TextStruct,
wxPoint( 30, 30 ) );
frame->ShowModal(); frame->Destroy();
RedrawOneStruct( DrawPanel, DC, TextStruct, GR_DEFAULT_DRAWMODE );
@ -145,7 +143,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC )
{
if( TextStruct == NULL )
TextStruct = (SCH_TEXT*) PickStruct( GetScreen()->m_Curseur,
GetScreen(), TEXTITEM | LABELITEM );
GetScreen(), TEXTITEM | LABELITEM );
if( TextStruct == NULL )
return;
@ -202,13 +200,13 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
break;
case LAYER_HIERLABEL:
NewText = new SCH_HIERLABEL(GetScreen()->m_Curseur );
NewText = new SCH_HIERLABEL( GetScreen()->m_Curseur );
NewText->m_Shape = s_DefaultShapeGLabel;
NewText->m_Orient = s_DefaultOrientGLabel;
break;
case LAYER_GLOBLABEL:
NewText = new SCH_GLOBALLABEL(GetScreen()->m_Curseur );
NewText = new SCH_GLOBALLABEL( GetScreen()->m_Curseur );
NewText->m_Shape = s_DefaultShapeGLabel;
NewText->m_Orient = s_DefaultOrientGLabel;
break;
@ -230,7 +228,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
return NULL;
}
if( type == LAYER_GLOBLABEL || type == LAYER_HIERLABEL)
if( type == LAYER_GLOBLABEL || type == LAYER_HIERLABEL )
{
s_DefaultShapeGLabel = NewText->m_Shape;
s_DefaultOrientGLabel = NewText->m_Orient;
@ -251,7 +249,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
/************************************/
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*/
if( erase )
@ -280,8 +278,8 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
/*************************************************************/
/* Abort function for the command move text */
{
SCH_SCREEN* screen = (SCH_SCREEN*) Panel->m_Parent->GetScreen();
EDA_BaseStruct* Struct = screen->GetCurItem();
SCH_SCREEN* screen = (SCH_SCREEN*) Panel->m_Parent->GetScreen();
SCH_ITEM* Struct = (SCH_ITEM*) screen->GetCurItem();
g_ItemToRepeat = NULL;
Panel->ManageCurseur = NULL;
@ -348,11 +346,13 @@ void WinEDA_SchematicFrame::ConvertTextType( SCH_TEXT* Text,
break;
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;
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;
case TYPE_SCH_TEXT:
newtext = new SCH_TEXT( Text->m_Pos, Text->m_Text );
break;

View File

@ -15,8 +15,6 @@
#include "id.h"
#include "schframe.h"
/* Variables locales */

View File

@ -12,11 +12,6 @@
#include "protos.h"
#include "schframe.h"
#include "schframe.h"
/* Routines Locales */
static void Polyline_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 )
}
/*************************************************************************/
EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewNoConnectStruct( wxDC* DC )
/*************************************************************************/
/*********************************************************************************/
DrawNoConnectStruct * WinEDA_SchematicFrame::CreateNewNoConnectStruct( wxDC* DC )
/*********************************************************************************/
/*Routine to create new NoConnect struct. ( Symbole de Non Connexion)
*/

View File

@ -212,7 +212,7 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
bool dummy = FALSE;
if( ( Entry = FindLibPart( m_ChipName.GetData(), wxEmptyString, FIND_ROOT ) ) == NULL )
{ /* composant non trouv<EFBFBD>, on affiche un composant "dummy" */
{ /* composant non trouve, on affiche un composant "dummy" */
dummy = TRUE;
if( DummyCmp == NULL )
CreateDummyCmp();
@ -233,55 +233,60 @@ void SCH_COMPONENT::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
&& !(m_Field[REFERENCE].m_Flags & IS_MOVED) )
{
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
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++ )
{
if( m_Field[ii].m_Flags & IS_MOVED )
continue;
DrawTextField( panel, DC, &m_Field[ii], 0, DrawMode );
m_Field[ii].Draw( panel, DC, offset, DrawMode );
}
}
/***********************************************************/
void DrawTextField( WinEDA_DrawPanel* panel, wxDC* DC,
PartTextStruct* Field, int IsMulti, int DrawMode )
void PartTextStruct::Draw( WinEDA_DrawPanel* panel,
wxDC* DC,
const wxPoint& offset,
int DrawMode,
int Color)
/***********************************************************/
/* Routine de trace des textes type Field du composant.
* 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
*/
{
int orient, color;
wxPoint pos; /* Position des textes */
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) Field->m_Parent;
int hjustify, vjustify;
int LineWidth = MAX( Field->m_Width, g_DrawMinimunLineWidth );
if( Field->m_Attributs & TEXT_NO_VISIBLE )
wxPoint pos; /* Position des textes */
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) m_Parent;
int hjustify, vjustify;
int LineWidth = MAX( m_Width, g_DrawMinimunLineWidth );
if( m_Attributs & TEXT_NO_VISIBLE )
return;
if( Field->IsVoid() )
if( IsVoid() )
return;
GRSetDrawMode( DC, DrawMode );
/* Calcul de la position des textes, selon orientation du composant */
orient = Field->m_Orient;
hjustify = Field->m_HJustify; vjustify = Field->m_VJustify;
pos.x = Field->m_Pos.x - DrawLibItem->m_Pos.x;
pos.y = Field->m_Pos.y - DrawLibItem->m_Pos.y;
orient = m_Orient;
hjustify = m_HJustify; vjustify = m_VJustify;
pos = m_Pos - DrawLibItem->m_Pos;
pos = DrawLibItem->GetScreenCoord( pos );
pos.x += DrawLibItem->m_Pos.x;
pos.y += DrawLibItem->m_Pos.y;
pos += DrawLibItem->m_Pos;
/* Y a t-il rotation (pour l'orientation, la justification)*/
if( DrawLibItem->m_Transform[0][1] ) // Rotation du composant de 90deg
@ -306,27 +311,27 @@ void DrawTextField( WinEDA_DrawPanel* panel, wxDC* DC,
vjustify = -vjustify;
}
if( Field->m_FieldId == REFERENCE )
if( m_FieldId == REFERENCE )
color = ReturnLayerColor( LAYER_REFERENCEPART );
else if( Field->m_FieldId == VALUE )
else if( m_FieldId == VALUE )
color = ReturnLayerColor( LAYER_VALUEPART );
else
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,
Field->m_Size,
m_Size,
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 */
wxString fulltext = Field->m_Text;
wxString fulltext = m_Text;
fulltext.Append( 'A' - 1 + DrawLibItem->m_Multi );
DrawGraphicText( panel, DC, pos, color, fulltext.GetData(),
orient ? TEXT_ORIENT_VERT : TEXT_ORIENT_HORIZ,
Field->m_Size,
m_Size,
hjustify, vjustify, LineWidth );
}
}

View File

@ -13,8 +13,6 @@
#include "protos.h"
#include "schframe.h"
char marq_bitmap[] =
{
@ -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. *
*****************************************************************************/
void RedrawStructList( WinEDA_DrawPanel* panel, wxDC* DC,
EDA_BaseStruct* Structs, int DrawMode, int Color )
SCH_ITEM* Structs, int DrawMode, int Color )
{
while( Structs )
{
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()
// if( panel->m_ClipBox.Intersects( item->GetBoundingBox() ) )
@ -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,
* Routine to redraw list of structs. *
*****************************************************************************/
void RedrawOneStruct( WinEDA_DrawPanel* panel, wxDC* DC,
EDA_BaseStruct* Struct, int DrawMode, int Color )
SCH_ITEM* Struct, int DrawMode, int Color )
{
if( Struct == NULL )
return;
@ -388,7 +386,7 @@ void DrawJunctionStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint&
/**********************************************************/
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
@ -480,9 +478,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
{
SCH_TEXT* Struct;
Struct = (SCH_TEXT*) DrawStruct;
Struct->m_Pos.x += dx; Struct->m_Pos.y += dy;
Struct->Draw( panel, DC, wxPoint( 0, 0 ), DrawMode, g_GhostColor );
Struct->m_Pos.x -= dx; Struct->m_Pos.y -= dy;
Struct->Draw( panel, DC, wxPoint( dx, dy ), DrawMode, g_GhostColor );
break;
}
@ -492,9 +488,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
{
SCH_LABEL* Struct;
Struct = (SCH_LABEL*) DrawStruct;
Struct->m_Pos.x += dx; Struct->m_Pos.y += dy;
Struct->Draw( panel, DC, wxPoint( 0, 0 ), DrawMode, g_GhostColor );
Struct->m_Pos.x -= dx; Struct->m_Pos.y -= dy;
Struct->Draw( panel, DC, wxPoint( dx, dy ), DrawMode, g_GhostColor );
break;
}
@ -502,9 +496,7 @@ void DrawStructsInGhost( WinEDA_DrawPanel* panel, wxDC* DC,
{
DrawNoConnectStruct* Struct;
Struct = (DrawNoConnectStruct*) DrawStruct;
Struct->m_Pos.x += dx; Struct->m_Pos.y += dy;
Struct->Draw( panel, DC, wxPoint( 0, 0 ), DrawMode, g_GhostColor );
Struct->m_Pos.x -= dx; Struct->m_Pos.y -= dy;
Struct->Draw( panel, DC, wxPoint( dx, dy ), DrawMode, g_GhostColor );
break;
}

View File

@ -20,11 +20,10 @@
#include "netlist.h"
#include "worksheet.h"
#include "trigo.h"
#include "protos.h"
#include "bitmaps.h"
#include "eda_dde.h"
#include "schframe.h"
#include "protos.h"
// Global variables
wxString g_Main_Title( wxT( "EESchema" ) );

View File

@ -12,8 +12,6 @@
#include "protos.h"
#include "schframe.h"
#include "../bitmaps/ercgreen.xpm"
#include "../bitmaps/ercwarn.xpm"
#include "../bitmaps/ercerr.xpm"

View File

@ -13,8 +13,6 @@
#include "protos.h"
#include "id.h"
#include "schframe.h"
/* Fonctions locales */

View File

@ -15,8 +15,6 @@
#include "libcmp.h"
#include "general.h"
#include "schframe.h"
/* Variables Locales */
static int s_ItemsCount, s_MarkerCount;
static wxString s_OldStringFound;
@ -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,
int SearchType,
const wxString& text_to_find,
@ -71,7 +69,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
*/
{
DrawSheetPath* sheet, * SheetWithComponentFound = NULL;
EDA_BaseStruct* DrawList = NULL;
SCH_ITEM* DrawList = NULL;
SCH_COMPONENT* Component = NULL;
wxSize DrawAreaSize = DrawPanel->GetClientSize();
wxPoint pos, curpos;
@ -88,8 +86,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindComponentAndItem(
for( ; sheet != NULL; sheet = SheetList.GetNext() )
{
DrawList = sheet->LastDrawList();
for( ; (DrawList != NULL) && (NotFound == true); DrawList = DrawList->Pnext )
DrawList = (SCH_ITEM*) sheet->LastDrawList();
for( ; (DrawList != NULL) && (NotFound == true); DrawList = DrawList->Next() )
{
if( DrawList->Type() == TYPE_SCH_COMPONENT )
{
@ -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.
@ -267,8 +265,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
*/
{
DrawSheetPath* sheet, * FirstSheet = NULL;
EDA_BaseStruct* DrawList, * FirstStruct = NULL, * Struct = NULL;
DrawMarkerStruct* Marker = NULL;
SCH_ITEM* DrawList, * FirstStruct = NULL, * Struct = NULL;
DrawMarkerStruct * Marker = NULL;
int StartCount;
bool NotFound;
wxPoint firstpos, pos;
@ -288,7 +286,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
/* Search for s_MarkerCount markers */
for( sheet = SheetList.GetFirst(); sheet != NULL; sheet = SheetList.GetNext() )
{
DrawList = sheet->LastDrawList();
DrawList = (SCH_ITEM*) sheet->LastDrawList();
while( DrawList && NotFound )
{
if( DrawList->Type() == DRAW_MARKER_STRUCT_TYPE )
@ -312,7 +310,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
Struct = DrawList; s_MarkerCount++; break;
}
}
DrawList = DrawList->Pnext;
DrawList = DrawList->Next();
}
if( NotFound == FALSE )
@ -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 )
/************************************************************************/
@ -421,7 +419,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
*/
{
DrawSheetPath* Sheet, * FirstSheet = NULL;
EDA_BaseStruct* DrawList = NULL, * FirstStruct = NULL, * Struct = NULL;
SCH_ITEM* DrawList = NULL, * FirstStruct = NULL, * Struct = NULL;
int StartCount, ii, jj;
bool NotFound;
wxPoint firstpos, pos, old_cursor_position;
@ -460,7 +458,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
for( ; Sheet != NULL; Sheet = SheetList.GetNext() )
{
DrawList = Sheet->LastDrawList();
DrawList = (SCH_ITEM*)Sheet->LastDrawList();
while( DrawList )
{
switch( DrawList->Type() )
@ -521,7 +519,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
}
if( NotFound == FALSE )
break;
DrawList = DrawList->Pnext;
DrawList = DrawList->Next();
}
if( NotFound == FALSE )

View File

@ -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
les numeros (netlist PSPICE seulement) */
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
Repeat ( NULL si aucune struct existe ) */
eda_global wxSize g_RepeatStep;
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 ) */
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
/* 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
eda_global int g_ShowAllPins;
@ -224,7 +224,7 @@ eda_global HPGL_Pen_Descr_Struct g_HPGL_Pen_Descr;
/* Ecrans usuels */
//eda_global SCH_SCREEN * ScreenSch;
eda_global DrawSheetStruct* g_RootSheet;
eda_global DrawSheetStruct* g_RootSheet;
eda_global SCH_SCREEN * ScreenLib;
/*************************************/

View File

@ -13,8 +13,6 @@
#include "protos.h"
#include "schframe.h"
/* Routines Locales */
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );

View File

@ -10,9 +10,7 @@
#include "libcmp.h"
#include "general.h"
#include "protos.h"
#include "schframe.h"
//#include "protos.h"
#include "wx/image.h"
#include "wx/imaglist.h"
@ -133,8 +131,8 @@ WinEDA_HierFrame::WinEDA_HierFrame(WinEDA_SchematicFrame *parent, wxDC * DC,
cellule = m_Tree->AddRoot(_("Root"), 0, 1);
m_Tree->SetItemBold(cellule, TRUE);
DrawSheetPath list;
list.Push(g_RootSheet);
DrawSheetPath list;
list.Push(g_RootSheet);
m_Tree->SetItemData( cellule, new TreeItemData(list) );
wxRect itemrect;
@ -199,15 +197,15 @@ wxTreeItemId menu;
return;
}
maxposx += m_Tree->GetIndent();
EDA_BaseStruct* bs = list->LastDrawList();
maxposx += m_Tree->GetIndent();
EDA_BaseStruct* bs = list->LastDrawList();
while(bs && m_nbsheets < NB_MAX_SHEET){
if(bs->Type() == DRAW_SHEET_STRUCT_TYPE){
DrawSheetStruct* ss = (DrawSheetStruct*)bs;
m_nbsheets++;
DrawSheetStruct* ss = (DrawSheetStruct*)bs;
m_nbsheets++;
menu = m_Tree->AppendItem(*previousmenu,
ss->m_SheetName, 0 , 1 );
list->Push(ss);
list->Push(ss);
m_Tree->SetItemData( menu, new TreeItemData(*list) );
int ll = m_Tree->GetItemText(menu).Len();
#ifdef __WINDOWS__
@ -222,11 +220,11 @@ wxTreeItemId menu;
m_Tree->EnsureVisible(menu);
m_Tree->SelectItem(menu);
}
BuildSheetList(list, &menu);
BuildSheetList(list, &menu);
m_Tree->Expand(menu);
list->Pop();
list->Pop();
}
bs = bs->Pnext;
bs = bs->Pnext;
}
maxposx -= m_Tree->GetIndent();
}
@ -240,11 +238,11 @@ void WinEDA_HierFrame::OnSelect(wxTreeEvent& event)
*/
{
wxTreeItemId ItemSel = m_Tree->GetSelection();
*(m_Parent->m_CurrentSheet) =
((TreeItemData*)(m_Tree->GetItemData(ItemSel)))->m_SheetList;
wxString path = m_Parent->m_CurrentSheet->PathHumanReadable();
printf("changing to sheet %s\n", CONV_TO_UTF8(path));
*(m_Parent->m_CurrentSheet) =
((TreeItemData*)(m_Tree->GetItemData(ItemSel)))->m_SheetList;
wxString path = m_Parent->m_CurrentSheet->PathHumanReadable();
printf("changing to sheet %s\n", CONV_TO_UTF8(path));
UpdateScreenFromSheet(m_Parent);
Close(TRUE);
}
@ -259,14 +257,14 @@ void WinEDA_SchematicFrame::InstallPreviousSheet()
g_ItemToRepeat = NULL;
MsgPanel->EraseMsgBox();
//make a copy for testing purposes.
DrawSheetPath listtemp = *m_CurrentSheet;
listtemp.Pop();
//make a copy for testing purposes.
DrawSheetPath listtemp = *m_CurrentSheet;
listtemp.Pop();
if ( listtemp.LastScreen() == NULL ){
DisplayError( this, wxT("InstallPreviousScreen() Error: Sheet not found"));
return;
}
m_CurrentSheet->Pop();
m_CurrentSheet->Pop();
UpdateScreenFromSheet(this);
}
@ -284,7 +282,7 @@ void WinEDA_SchematicFrame::InstallNextScreen(DrawSheetStruct * Sheet)
{
DisplayError(this,wxT("InstallNextScreen() error")); return;
}
m_CurrentSheet->Push(Sheet);
m_CurrentSheet->Push(Sheet);
g_ItemToRepeat = NULL;
MsgPanel->EraseMsgBox();
UpdateScreenFromSheet(this);
@ -301,13 +299,13 @@ static bool UpdateScreenFromSheet(WinEDA_SchematicFrame * frame)
{
SCH_SCREEN * NewScreen;
NewScreen = frame->m_CurrentSheet->LastScreen();
NewScreen = frame->m_CurrentSheet->LastScreen();
if(!NewScreen)
{
DisplayError(frame, wxT("Screen not found for this sheet"));
return false;
}
// Reinit des parametres d'affichage du nouvel ecran
// assumes m_CurrentSheet has already been updated.
frame->MsgPanel->EraseMsgBox();
@ -319,7 +317,7 @@ static bool UpdateScreenFromSheet(WinEDA_SchematicFrame * frame)
NewScreen->m_ScrollbarPos.y,TRUE);
//update the References
frame->m_CurrentSheet->UpdateAllScreenReferences();
frame->m_CurrentSheet->UpdateAllScreenReferences();
frame->DrawPanel->m_CanStartBlock = -1;
if ( NewScreen->m_FirstRedraw ){
NewScreen->m_FirstRedraw = FALSE;
@ -328,7 +326,7 @@ static bool UpdateScreenFromSheet(WinEDA_SchematicFrame * frame)
frame->ReDrawPanel();
frame->DrawPanel->MouseToCursorSchema();
}
ActiveScreen = frame->m_CurrentSheet->LastScreen();
ActiveScreen = frame->m_CurrentSheet->LastScreen();
return true;
}

View File

@ -17,8 +17,6 @@
#include "protos.h"
#include "schframe.h"
/* 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 Ki_HotkeyInfo entry like:
@ -260,7 +258,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
if( DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
{
EDA_DrawLineStruct* segment = (EDA_DrawLineStruct*) DrawStruct;
if( segment->m_Layer != LAYER_WIRE )
if( segment->GetLayer() != LAYER_WIRE )
break;
}
else
@ -292,7 +290,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case TYPE_SCH_COMPONENT:
if( DrawStruct->m_Flags == 0 )
{
SaveCopyInUndoList( DrawStruct, IS_CHANGED );
SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, IS_CHANGED );
RefreshToolBar = TRUE;
}
@ -306,7 +304,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
case TYPE_SCH_HIERLABEL:
if( DrawStruct->m_Flags == 0 )
{
SaveCopyInUndoList( DrawStruct, IS_CHANGED );
SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, IS_CHANGED );
RefreshToolBar = TRUE;
}
ChangeTextOrient( (SCH_TEXT*) DrawStruct, DC );
@ -325,11 +323,10 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
{
if( DrawStruct->m_Flags == 0 )
{
SaveCopyInUndoList( DrawStruct, IS_CHANGED );
SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, IS_CHANGED );
RefreshToolBar = TRUE;
}
CmpRotationMiroir(
(SCH_COMPONENT*) DrawStruct, DC, CMP_MIROIR_Y );
CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_MIROIR_Y );
}
break;
@ -340,7 +337,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
{
if( DrawStruct->m_Flags == 0 )
{
SaveCopyInUndoList( DrawStruct, IS_CHANGED );
SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, IS_CHANGED );
RefreshToolBar = TRUE;
}
CmpRotationMiroir(
@ -355,12 +352,11 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
{
if( DrawStruct->m_Flags == 0 )
{
SaveCopyInUndoList( DrawStruct, IS_CHANGED );
SaveCopyInUndoList( (SCH_ITEM*) DrawStruct, IS_CHANGED );
RefreshToolBar = TRUE;
}
CmpRotationMiroir(
(SCH_COMPONENT*) DrawStruct, DC, CMP_NORMAL );
TestDanglingEnds( (SCH_SCREEN*)GetScreen()->EEDrawList, DC );
CmpRotationMiroir( (SCH_COMPONENT*) DrawStruct, DC, CMP_NORMAL );
TestDanglingEnds( GetScreen()->EEDrawList, DC );
}
break;

View File

@ -14,8 +14,6 @@
#include "id.h"
#include "schframe.h"
/* Format des fichiers:
* - entete:
* EESchema Schematic File Version n
@ -82,7 +80,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
int ii, layer, orient, size;
wxPoint pos;
bool Failed = FALSE;
EDA_BaseStruct* Phead, * Pnext;
SCH_ITEM* Phead, * Pnext;
DrawJunctionStruct* ConnectionStruct;
DrawPolylineStruct* PolylineStruct;
EDA_DrawLineStruct* SegmentStruct;
@ -207,7 +205,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
if( !Failed )
{
SegmentStruct->Pnext = screen->EEDrawList;
screen->EEDrawList = (EDA_BaseStruct*) SegmentStruct;
screen->EEDrawList = SegmentStruct;
}
break;
@ -288,7 +286,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
if( !Failed )
{
PolylineStruct->Pnext = screen->EEDrawList;
screen->EEDrawList = (EDA_BaseStruct*) PolylineStruct;
screen->EEDrawList = PolylineStruct;
}
break;
@ -359,7 +357,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
case 'T': /* Its a text item. */
{
EDA_BaseStruct* Struct = NULL;
SCH_ITEM* Struct = NULL;
*Name1 = *Name2 = 0;
ii = sscanf( SLine, "%s %d %d %d %d %s",
Name1, &pos.x, &pos.y, &orient, &size, Name2 );
@ -394,13 +392,12 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
new SCH_LABEL( pos, CONV_FROM_UTF8( text ) );
TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient;
Struct = (EDA_BaseStruct*) TextStruct;
Struct = TextStruct;
}
else if( Name1[0] == 'G' && version > '1')
{
SCH_GLOBALLABEL* TextStruct =
new SCH_GLOBALLABEL(pos, CONV_FROM_UTF8( text ) );
Struct = (EDA_BaseStruct*) TextStruct;
SCH_GLOBALLABEL* TextStruct = new SCH_GLOBALLABEL(pos, CONV_FROM_UTF8( text ) );
Struct = TextStruct;
TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient;
TextStruct->m_Shape = NET_INPUT;
@ -415,9 +412,8 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
}
else if( (Name1[0] == 'H') || (Name1[0] == 'G' && version == '1'))
{ //in schematic file version 1, glabels were actually hierarchal labels.
SCH_HIERLABEL* TextStruct =
new SCH_HIERLABEL(pos, CONV_FROM_UTF8( text ) );
Struct = (EDA_BaseStruct*) TextStruct;
SCH_HIERLABEL* TextStruct = new SCH_HIERLABEL(pos, CONV_FROM_UTF8( text ) );
Struct = TextStruct;
TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient;
TextStruct->m_Shape = NET_INPUT;
@ -436,7 +432,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
new SCH_TEXT( pos, CONV_FROM_UTF8( text ) );
TextStruct->m_Size.x = TextStruct->m_Size.y = size;
TextStruct->m_Orient = orient;
Struct = (EDA_BaseStruct*) TextStruct;
Struct = TextStruct;
}
if( Struct )
{
@ -467,7 +463,7 @@ bool WinEDA_SchematicFrame::LoadOneEEFile( SCH_SCREEN* screen, const wxString& F
while( screen->EEDrawList )
{
Pnext = screen->EEDrawList;
screen->EEDrawList = screen->EEDrawList->Pnext;
screen->EEDrawList = screen->EEDrawList->Next();
Pnext->Pnext = Phead;
Phead = Pnext;
}
@ -777,7 +773,7 @@ static int ReadPartDescr( wxWindow* frame, char* Line, FILE* f,
if( !Failed )
{
LibItemStruct->Pnext = Window->EEDrawList;
Window->EEDrawList = (EDA_BaseStruct*) LibItemStruct;
Window->EEDrawList = LibItemStruct;
LibItemStruct->m_Parent = Window;
}
@ -963,7 +959,7 @@ static int ReadSheetDescr( wxWindow* frame, char* Line, FILE* f, BASE_SCREEN* Wi
if( !Failed )
{
SheetStruct->Pnext = Window->EEDrawList;
Window->EEDrawList = (EDA_BaseStruct*)SheetStruct;
Window->EEDrawList = SheetStruct;
SheetStruct->m_Parent = Window;
}
return Failed; /* Fin lecture 1 composant */

View File

@ -18,8 +18,8 @@
int distance( int dx, int dy, int spot_cX, int spot_cY, int seuil );
/* Routines Locales */
static EDA_BaseStruct* LastSnappedStruct = NULL;
static int PickedBoxMinX, PickedBoxMinY, PickedBoxMaxX, PickedBoxMaxY;
static SCH_ITEM* LastSnappedStruct = NULL;
static int PickedBoxMinX, PickedBoxMinY, PickedBoxMaxX, PickedBoxMaxY;
static bool IsBox1InBox2( int StartX1, int StartY1, int EndX1, int EndY1,
int StartX2, int StartY2, int EndX2, int EndY2 );
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,
int SegmX1, int SegmY1, int SegmX2, int SegmY2, int seuil = 0 );
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,23 +39,23 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
*/
{
SCH_COMPONENT* DrawLibItem = NULL, * LastDrawLibItem = NULL;
EDA_BaseStruct* DrawList;
EDA_Rect BoundaryBox;
float sizeref = 0, sizecurr;
SCH_ITEM* DrawList;
EDA_Rect BoundaryBox;
float sizeref = 0, sizecurr;
DrawList = Screen->EEDrawList;
while( DrawList )
{
if( ( SnapPoint2( Screen->m_MousePosition, LIBITEM,
DrawList, NULL, Screen->GetZoom() ) ) == FALSE )
DrawList, NULL, Screen->GetZoom() ) ) == FALSE )
{
if( ( SnapPoint2( Screen->m_Curseur, LIBITEM,
DrawList, NULL, Screen->GetZoom() ) ) == FALSE )
DrawList, NULL, Screen->GetZoom() ) ) == FALSE )
break;
}
DrawLibItem = (SCH_COMPONENT*) LastSnappedStruct;
DrawList = DrawLibItem->Pnext;
DrawList = DrawLibItem->Next();
if( LastDrawLibItem == NULL ) // First time a component is located
{
LastDrawLibItem = DrawLibItem;
@ -111,21 +111,21 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
* Si pas de structures selectionnees: retourne NULL
*
*/
/***********************************************************************/
EDA_BaseStruct* PickStruct( const wxPoint& refpos,
BASE_SCREEN* screen, int SearchMask)
/************************************************************************/
/********************************************************************************/
SCH_ITEM* PickStruct( const wxPoint& refpos, BASE_SCREEN* screen, int SearchMask )
/******************************************************************************/
/* Search an item at pos pos
/* Search an item at pos refpos
*/
{
bool Snapped;
EDA_BaseStruct* DrawList = screen->EEDrawList;
bool Snapped;
SCH_ITEM* DrawList = screen->EEDrawList;
if( screen==NULL || DrawList == NULL )
return NULL;
if( ( Snapped = SnapPoint2( refpos, SearchMask,
DrawList, NULL, screen->GetZoom() ) ) != FALSE )
DrawList, NULL, screen->GetZoom() ) ) != FALSE )
{
return LastSnappedStruct;
}
@ -134,8 +134,7 @@ EDA_BaseStruct* PickStruct( const wxPoint& refpos,
/***********************************************************************/
EDA_BaseStruct* PickStruct( EDA_Rect& block,
BASE_SCREEN* screen, int SearchMask )
SCH_ITEM* PickStruct( EDA_Rect& block, BASE_SCREEN* screen, int SearchMask )
/************************************************************************/
/* Search items in block
@ -143,7 +142,7 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block,
{
int x, y, OrigX, OrigY;
DrawPickedStruct* PickedList = NULL, * PickedItem;
EDA_BaseStruct* DrawStruct;
SCH_ITEM* DrawStruct;
OrigX = block.GetX();
OrigY = block.GetY();
@ -155,11 +154,11 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block,
if( y < OrigY )
EXCHG( y, OrigY );
EDA_BaseStruct* DrawList = screen->EEDrawList;
if( screen==NULL || DrawList == NULL )
return NULL;
SCH_ITEM* DrawList = screen->EEDrawList;
if( screen==NULL || DrawList == 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 ) )
{
@ -176,7 +175,7 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block,
/* Only one item was picked - convert to scalar form (no list): */
PickedItem = PickedList;
PickedList = (DrawPickedStruct*) PickedList->m_PickedStruct;
SAFE_DELETE( PickedItem ) ;
SAFE_DELETE( PickedItem );
}
if( PickedList != NULL )
@ -199,18 +198,18 @@ EDA_BaseStruct* PickStruct( EDA_Rect& block,
* The routine returns TRUE if point was snapped. *
*****************************************************************************/
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 x1, y1, x2, y2, NumOfPoints2;
DrawPickedStruct* DontSnap;
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: */
DontSnap = DontSnapList;
for( ; DontSnap != NULL; DontSnap = (DrawPickedStruct*) DontSnap->Pnext )
for( ; DontSnap != NULL; DontSnap = DontSnap->Next() )
if( DontSnap->m_PickedStruct == DrawList )
break;
@ -238,6 +237,7 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
return TRUE;
}
}
break;
case DRAW_SEGMENT_STRUCT_TYPE:
@ -247,11 +247,11 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
break;
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) )
|| ( (SearchMask & WIREITEM) && (STRUCT->m_Layer == LAYER_WIRE) )
|| ( (SearchMask & BUSITEM) && (STRUCT->m_Layer == LAYER_BUS) )
if( ( (SearchMask & DRAWITEM) && (STRUCT->GetLayer() == LAYER_NOTES) )
|| ( (SearchMask & WIREITEM) && (STRUCT->GetLayer() == LAYER_WIRE) )
|| ( (SearchMask & BUSITEM) && (STRUCT->GetLayer() == LAYER_BUS) )
)
{
if( SearchMask & EXCLUDE_WIRE_BUS_ENDPOINTS )
@ -282,7 +282,7 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
break;
if( IsPointOnSegment( x, y, STRUCT->m_Pos.x, STRUCT->m_Pos.y,
STRUCT->m_End().x, STRUCT->m_End().y ) )
STRUCT->m_End().x, STRUCT->m_End().y ) )
{
LastSnappedStruct = DrawList;
return TRUE;
@ -422,8 +422,8 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
if( SearchMask & FIELDCMPITEM )
{
PartTextStruct* Field;
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) DrawList;
PartTextStruct* Field;
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) DrawList;
for( i = REFERENCE; i < NUMBER_OF_FIELDS; i++ )
{
Field = &DrawLibItem->m_Field[i];
@ -494,7 +494,7 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
* routine is used to pick all points in a given box. *
*****************************************************************************/
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 dx, dy;
@ -782,12 +782,12 @@ static bool IsPointOnSegment( int pX, int pY,
/*********************************************************************************/
LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
const wxPoint& refpoint,
LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
const wxPoint& refpoint,
EDA_LibComponentStruct* LibEntry,
int Unit,
int Convert,
int masque )
int Unit,
int Convert,
int masque )
/*********************************************************************************/
/* Routine de localisation d'un element de dessin de symbole( sauf pins )
@ -857,20 +857,20 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
if( (masque & LOCATE_COMPONENT_RECT_DRAW_TYPE) == 0 )
break;
if( IsPointOnSegment( px, py, // locate lower segment
Square->m_Pos.x, -Square->m_Pos.y,
Square->m_End.x, -Square->m_Pos.y, seuil ) )
Square->m_Pos.x, -Square->m_Pos.y,
Square->m_End.x, -Square->m_Pos.y, seuil ) )
return DrawItem;
if( IsPointOnSegment( px, py, // locate right segment
Square->m_End.x, -Square->m_Pos.y,
Square->m_End.x, -Square->m_End.y, seuil ) )
Square->m_End.x, -Square->m_Pos.y,
Square->m_End.x, -Square->m_End.y, seuil ) )
return DrawItem;
if( IsPointOnSegment( px, py, // locate upper segment
Square->m_End.x, -Square->m_End.y,
Square->m_Pos.x, -Square->m_End.y, seuil ) )
Square->m_End.x, -Square->m_End.y,
Square->m_Pos.x, -Square->m_End.y, seuil ) )
return DrawItem;
if( IsPointOnSegment( px, py, // locate left segment
Square->m_Pos.x, -Square->m_End.y,
Square->m_Pos.x, -Square->m_Pos.y, seuil ) )
Square->m_Pos.x, -Square->m_End.y,
Square->m_Pos.x, -Square->m_Pos.y, seuil ) )
return DrawItem;
}
break;
@ -884,7 +884,7 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
for( ii = polyline->n - 1; ii > 0; ii--, ptpoly += 2 )
{
if( IsPointOnSegment( px, py,
ptpoly[0], -ptpoly[1], ptpoly[2], -ptpoly[3], seuil ) )
ptpoly[0], -ptpoly[1], ptpoly[2], -ptpoly[3], seuil ) )
return DrawItem;
}
}
@ -896,8 +896,8 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
if( (masque & LOCATE_COMPONENT_LINE_DRAW_TYPE) == 0 )
break;
if( IsPointOnSegment( px, py,
Segment->m_Pos.x, -Segment->m_Pos.y,
Segment->m_End.x, -Segment->m_End.y, seuil ) )
Segment->m_Pos.x, -Segment->m_Pos.y,
Segment->m_End.x, -Segment->m_End.y, seuil ) )
return DrawItem;
}
break;
@ -918,7 +918,7 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
x = px - Text->m_Pos.x;
y = py + Text->m_Pos.y;
if( (abs( x ) <= dx) && (abs( y ) <= dy) )
return DrawItem; /* Texte trouve */
return DrawItem; /* Texte trouve */
}
break;
@ -952,8 +952,8 @@ 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 */
segX, segY; /* coord extremite segment tj >= 0 */
int pointX, pointY;/* coord point a tester dans repere modifie dans lequel
* segX et segY sont >=0 */
int pointX, pointY; /* coord point a tester dans repere modifie dans lequel
* segX et segY sont >=0 */
segX = dx; segY = dy; pointX = spot_cX; pointY = spot_cY;
@ -1041,9 +1041,10 @@ int distance( int dx, int dy, int spot_cX, int spot_cY, int seuil )
return 0;
}
/*******************************************************************/
LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
SCH_COMPONENT* eComponent )
LibDrawPin* LocatePinByNumber( const wxString& ePin_Number,
SCH_COMPONENT* eComponent )
/*******************************************************************/
/** Find a PIN in a component
@ -1057,7 +1058,7 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
LibDrawPin* Pin;
int Unit, Convert;
Entry = FindLibPart(eComponent->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
Entry = FindLibPart( eComponent->m_ChipName.GetData(), wxEmptyString, FIND_ROOT );
if( Entry == NULL )
return NULL;
@ -1067,7 +1068,7 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
return NULL;
}
Unit = eComponent->m_Multi;
Unit = eComponent->m_Multi;
Convert = eComponent->m_Convert;
DrawItem = Entry->m_Drawings;
@ -1084,7 +1085,7 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
continue;
wxString pNumber;
Pin->ReturnPinStringNum( pNumber );
if ( ePin_Number == pNumber )
if( ePin_Number == pNumber )
return Pin;
}
}
@ -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 )
/**************************************************************************/
{
EDA_BaseStruct* DrawStruct;
SCH_ITEM* DrawStruct;
EDA_LibComponentStruct* Entry;
SCH_COMPONENT* LibItem = 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 )
continue;
@ -1215,7 +1216,7 @@ LibDrawPin* LocateAnyPin( EDA_BaseStruct* DrawList, const wxPoint& RefPos,
if( Entry == NULL )
continue;
Pin = (LibDrawPin*) LocatePin( RefPos, Entry, LibItem->m_Multi,
LibItem->m_Convert, LibItem );
LibItem->m_Convert, LibItem );
if( Pin )
break;
}
@ -1228,18 +1229,18 @@ LibDrawPin* LocateAnyPin( EDA_BaseStruct* DrawList, const wxPoint& RefPos,
/***************************************************************/
DrawSheetLabelStruct* LocateAnyPinSheet( const wxPoint& RefPos,
EDA_BaseStruct* DrawList )
SCH_ITEM* DrawList )
/***************************************************************/
{
EDA_BaseStruct* DrawStruct;
SCH_ITEM* DrawStruct;
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 )
continue;
PinSheet = LocateSheetLabel( (DrawSheetStruct*) DrawStruct,
RefPos );
RefPos );
if( PinSheet )
break;
}

View File

@ -18,8 +18,6 @@
#include "id.h"
#include "hotkeys.h"
#include "schframe.h"
/************************************************/
void WinEDA_SchematicFrame::ReCreateMenuBar()

View File

@ -13,8 +13,6 @@
#include "protos.h"
#include "schframe.h"
/* Routines locales */
static void Write_GENERIC_NetList( WinEDA_SchematicFrame* frame, const wxString& FullFileName );
static void WriteNetListPCBNEW( WinEDA_SchematicFrame* frame, FILE* f,

View File

@ -12,8 +12,6 @@
#include "netlist.h" /* Definitions generales liees au calcul de netliste */
#include "protos.h"
#include "schframe.h"
//#define NETLIST_DEBUG
/* Routines locales */
@ -471,15 +469,15 @@ static int ListeObjetConnection( WinEDA_SchematicFrame* frame, DrawSheetPath* sh
#define STRUCT ( (EDA_DrawLineStruct*) DrawList )
if( ObjNet )
{
if( (STRUCT->m_Layer != LAYER_BUS)
&& (STRUCT->m_Layer != LAYER_WIRE) )
if( (STRUCT->GetLayer() != LAYER_BUS)
&& (STRUCT->GetLayer() != LAYER_WIRE) )
break;
ObjNet[NbrItem].m_Comp = STRUCT;
ObjNet[NbrItem].m_Start = STRUCT->m_Start;
ObjNet[NbrItem].m_End = STRUCT->m_End;
if( STRUCT->m_Layer == LAYER_BUS )
if( STRUCT->GetLayer() == LAYER_BUS )
{
ObjNet[NbrItem].m_Type = NET_BUS;
}

View File

@ -22,7 +22,6 @@
#include "netlist.h"
#include "protos.h"
#include "schframe.h"
#include "netlist_control.h"
// ID for configuration:
@ -451,7 +450,7 @@ void WinEDA_NetlistFrame::GenNetlist( wxCommandEvent& event )
Mask = wxT( "*" ) + FileExt + wxT( "*" );
ChangeFileNameExt( FullFileName, FileExt );
FullFileName = FullFileName.AfterLast('/');
FullFileName = FullFileName.AfterLast('/');
FullFileName = EDA_FileSelector( _( "Netlist files:" ),
wxEmptyString, /* Defaut path */
FullFileName, /* Defaut filename */

View File

@ -15,8 +15,6 @@
#include "protos.h"
#include "schframe.h"
static wxArrayString s_CmpNameList;
static wxArrayString s_PowerNameList;
@ -28,7 +26,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
* quand un outil est deja selectionn<EFBFBD>
*/
{
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem();
if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
{

View File

@ -20,8 +20,6 @@
#include "bitmaps.h"
#include "schframe.h"
#include "Enter_Sheet.xpm"
#include "Leave_Sheet.xpm"
#include "Delete_Sheet.xpm"
@ -90,7 +88,7 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
* Ce menu est ensuite compl<EFBFBD>t<EFBFBD> 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);
@ -219,9 +217,8 @@ bool WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
break;
case DRAW_SEGMENT_STRUCT_TYPE:
// if( !flags ) PopMenu->Append(ID_POPUP_SCH_MOVE_ITEM_REQUEST, "Move");
switch( ( (EDA_DrawLineStruct*) DrawStruct )->m_Layer )
switch( DrawStruct->GetLayer() )
{
case LAYER_WIRE:
AddMenusForWire( PopMenu, (EDA_DrawLineStruct*) DrawStruct, this );

View File

@ -362,7 +362,7 @@ static void PlotTextField( SCH_COMPONENT* DrawLibItem,
int orient, color = -1;
if( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
color = ReturnLayerColor( Field->m_Layer );
color = ReturnLayerColor( Field->GetLayer() );
DrawMode = 0; /* Unused */
if( Field->m_Attributs & TEXT_NO_VISIBLE )
@ -670,7 +670,7 @@ static void PlotSheetLabelStruct( DrawSheetLabelStruct* Struct )
int coord[16];
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;
if( Struct->m_Edge )

View File

@ -41,8 +41,6 @@
#include "protos.h"
#include "schframe.h"
/* coeff de conversion dim en 1 mil -> dim en unite HPGL: */
#define SCALE_HPGL 1.02041
@ -583,7 +581,7 @@ wxString msg;
#define STRUCT ((DrawBusEntryStruct*)DrawList)
x1 = STRUCT->m_Pos.x; y1 = STRUCT->m_Pos.y;
x2 = STRUCT->m_End().x; y2 = STRUCT->m_End().y;
layer = STRUCT->m_Layer;
layer = STRUCT->GetLayer();
case DRAW_SEGMENT_STRUCT_TYPE :
#undef STRUCT
#define STRUCT ((EDA_DrawLineStruct*)DrawList)
@ -591,7 +589,7 @@ wxString msg;
{
x1 = STRUCT->m_Start.x; y1 = STRUCT->m_Start.y;
x2 = STRUCT->m_End.x; y2 = STRUCT->m_End.y;
layer = STRUCT->m_Layer;
layer = STRUCT->GetLayer();
}
switch (layer)
{

View File

@ -36,8 +36,6 @@
#include "plot_common.h"
#include "protos.h"
#include "schframe.h"
#include "wx/defs.h"
// coeff de conversion dim en 1 mil -> dim en unite PS:
@ -379,7 +377,7 @@ void WinEDA_PlotPSFrame::PlotOneSheetPS(const wxString & FileName,
*/
{
wxString Line;
EDA_BaseStruct *DrawList;
SCH_ITEM *DrawList;
SCH_COMPONENT *DrawLibItem;
int layer;
wxPoint StartPos, EndPos;
@ -424,7 +422,7 @@ wxPoint StartPos, EndPos;
#define STRUCT ((DrawBusEntryStruct*)DrawList)
StartPos = STRUCT->m_Pos;
EndPos = STRUCT->m_End();
layer = STRUCT->m_Layer;
layer = STRUCT->GetLayer();
case DRAW_SEGMENT_STRUCT_TYPE :
#undef STRUCT
#define STRUCT ((EDA_DrawLineStruct*)DrawList)
@ -432,7 +430,7 @@ wxPoint StartPos, EndPos;
{
StartPos = STRUCT->m_Start;
EndPos = STRUCT->m_End;
layer = STRUCT->m_Layer;
layer = STRUCT->GetLayer();
}
if ( g_PlotPSColorOpt )
SetColorMapPS ( ReturnLayerColor(layer) );
@ -467,7 +465,7 @@ wxPoint StartPos, EndPos;
#undef STRUCT
#define STRUCT ((DrawJunctionStruct*)DrawList)
if ( g_PlotPSColorOpt )
SetColorMapPS (ReturnLayerColor(STRUCT->m_Layer) );
SetColorMapPS (ReturnLayerColor(STRUCT->GetLayer()) );
PlotCercle( STRUCT->m_Pos, DRAWJUNCTION_SIZE);
break;
@ -507,7 +505,7 @@ wxPoint StartPos, EndPos;
}
Plume('U');
DrawList = DrawList->Pnext;
DrawList = DrawList->Next();
}
/* fin */

View File

@ -9,8 +9,10 @@
#define eda_global extern
#endif
#include "wxEeschemaStruct.h"
#include "macros.h"
#include "base_struct.h"
#include "sch_item_struct.h"
#include "component_class.h"
#include "class_screen.h"
@ -63,10 +65,9 @@ class DrawSheetStruct;
* is a segment decription base class to describe items which have 2 end
* points (track, wire, draw line ...)
*/
class EDA_DrawLineStruct : public EDA_BaseStruct
class EDA_DrawLineStruct : public SCH_ITEM
{
public:
int m_Layer; // Layer number
int m_Width; // 0 = line, > 0 = tracks, bus ...
wxPoint m_Start; // Line start point
wxPoint m_End; // Line end point
@ -110,7 +111,7 @@ public:
};
class DrawMarkerStruct : public EDA_BaseStruct /* marqueurs */
class DrawMarkerStruct : public SCH_ITEM /* marqueurs */
{
public:
wxPoint m_Pos; /* XY coordinates of marker. */
@ -144,7 +145,7 @@ public:
};
class DrawNoConnectStruct : public EDA_BaseStruct /* Symboles de non connexion */
class DrawNoConnectStruct : public SCH_ITEM /* Symboles de non connexion */
{
public:
wxPoint m_Pos; /* XY coordinates of NoConnect. */
@ -169,10 +170,9 @@ public:
* Class DrawBusEntryStruct
* Struct de descr 1 raccord a 45 degres de BUS ou WIRE
*/
class DrawBusEntryStruct : public EDA_BaseStruct
class DrawBusEntryStruct : public SCH_ITEM
{
public:
int m_Layer;
int m_Width;
wxPoint m_Pos;
wxSize m_Size;
@ -194,10 +194,9 @@ public:
EDA_Rect GetBoundingBox();
};
class DrawPolylineStruct : public EDA_BaseStruct /* Polyligne (serie de segments) */
class DrawPolylineStruct : public SCH_ITEM /* Polyligne (serie de segments) */
{
public:
int m_Layer;
int m_Width;
int m_NumOfPoints; /* Number of XY pairs in Points array. */
int* m_Points; /* XY pairs that forms the polyline. */
@ -217,10 +216,9 @@ public:
int draw_mode, int Color = -1 );
};
class DrawJunctionStruct : public EDA_BaseStruct
class DrawJunctionStruct : public SCH_ITEM
{
public:
int m_Layer;
wxPoint m_Pos; /* XY coordinates of connection. */
public:

View File

@ -10,10 +10,6 @@ LibEDA_BaseStruct * LocatePin(const wxPoint & RefPos,
const wxString& ReturnDefaultFieldName( int aFieldNdx );
/***************/
/* FILE_IO.CPP */
/***************/
/****************/
/* DATABASE.CPP */
@ -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,
FILE *f, int *LineNum);
@ -87,15 +83,6 @@ void SnapLibItemPoint(int OrigX, int OrigY, int *ClosestX, int *ClosestY,
SCH_COMPONENT *DrawLibItem);
bool LibItemInBox(int x1, int y1, int x2, int y2,
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);
/* Supprime les caracteres Space en debut de la ligne text
retourne un pointeur sur le 1er caractere non Space de text */
@ -103,15 +90,15 @@ char * StrPurge(char * text);
/************/
/* BLOCK.CPP */
/************/
EDA_BaseStruct * DuplicateStruct(EDA_BaseStruct *DrawStruct);
void MoveOneStruct(EDA_BaseStruct *DrawStructs, const wxPoint & move_vector);
/* Given a structure move it by move_vector.x, move_vector.y. */
SCH_ITEM * DuplicateStruct(SCH_ITEM *DrawStruct);
void MoveOneStruct(SCH_ITEM *DrawStructs, const wxPoint & move_vector);
/* Given a structure move it by move_vector. */
bool PlaceStruct(BASE_SCREEN * screen, EDA_BaseStruct *DrawStruct);
bool MoveStruct(WinEDA_DrawPanel * panel, wxDC * DC, EDA_BaseStruct *DrawStruct);
void DeleteStruct(WinEDA_DrawPanel * panel, wxDC * DC, EDA_BaseStruct *DrawStruct);
bool PlaceStruct(BASE_SCREEN * screen, SCH_ITEM *DrawStruct);
bool MoveStruct(WinEDA_DrawPanel * panel, wxDC * DC, SCH_ITEM *DrawStruct);
void DeleteStruct(WinEDA_DrawPanel * panel, wxDC * DC, SCH_ITEM *DrawStruct);
bool DrawStructInBox(int x1, int y1, int x2, int y2,
EDA_BaseStruct *DrawStruct);
SCH_ITEM *DrawStruct);
/*************/
/* LOCATE.CPP */
@ -122,12 +109,10 @@ LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
SCH_COMPONENT * LocateSmallestComponent( SCH_SCREEN * Screen );
/* Recherche du plus petit (en surface) composant pointe par la souris */
EDA_BaseStruct * PickStruct(EDA_Rect & block,
BASE_SCREEN* screen, int SearchMask );
EDA_BaseStruct * PickStruct(const wxPoint & refpos,
BASE_SCREEN* screen, int SearchMask);
/* 2 functions EDA_BaseStruct * PickStruct:
Search in block, or Serach at location pos
SCH_ITEM * PickStruct(EDA_Rect & block, BASE_SCREEN* screen, int SearchMask );
SCH_ITEM * PickStruct(const wxPoint & refpos, BASE_SCREEN* screen, int SearchMask);
/* 2 functions PickStruct:
Search in block, or Search at location pos
SearchMask = (bitwise OR):
LIBITEM
@ -167,11 +152,11 @@ LibEDA_BaseStruct * LocateDrawItem(SCH_SCREEN * Screen, const wxPoint & refpoint
EDA_LibComponentStruct * LibEntry, int Unit, int Convert, int masque);
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 );
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);
/* 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,
wxPoint pos, char* pt_bitmap, int DrawMode, int Color);
void DrawStructsInGhost(WinEDA_DrawPanel * panel, wxDC * DC,
EDA_BaseStruct * DrawStruct, int dx, int dy );
void SetHighLightStruct(EDA_BaseStruct *HighLight);
SCH_ITEM * DrawStruct, int dx, int dy );
void SetHighLightStruct(SCH_ITEM *HighLight);
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);
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);
/**************/
@ -218,12 +203,6 @@ void DisplayColorSetupFrame(WinEDA_DrawFrame * parent, const wxPoint & pos);
/*************/
int CountCmpNumber();
/***************/
/* EESTRING.CPP */
/***************/
/***************/
/* EECONFIG.CPP */
/***************/
@ -335,7 +314,7 @@ bool ClearProjectDrawList(SCH_SCREEN * FirstWindow, bool confirm_deletion);
/*************/
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);
/* Effacement des marqueurs du type "type" */

View File

@ -13,12 +13,6 @@
#include "protos.h"
#include "schframe.h"
/* Format des fichiers: Voir EELOAD.CC */
/* Fonctions externes */
/* Fonctions Locales */
static void SaveLayers(FILE *f);
@ -155,8 +149,8 @@ bool WinEDA_SchematicFrame::SaveEEFile(SCH_SCREEN *screen, int FileSave)
#undef STRUCT
#define STRUCT ((EDA_DrawLineStruct *) Phead)
layer = "Notes"; width = "Line";
if (STRUCT->m_Layer == LAYER_WIRE) layer = "Wire";
if (STRUCT->m_Layer == LAYER_BUS) layer = "Bus";
if (STRUCT->GetLayer() == LAYER_WIRE) layer = "Wire";
if (STRUCT->GetLayer() == LAYER_BUS) layer = "Bus";
if( STRUCT->m_Width != GR_NORM_WIDTH) layer = "Bus";
if (fprintf(f, "Wire %s %s\n", layer, width ) == EOF)
{
@ -174,7 +168,7 @@ bool WinEDA_SchematicFrame::SaveEEFile(SCH_SCREEN *screen, int FileSave)
#undef STRUCT
#define STRUCT ((DrawBusEntryStruct *) Phead)
layer = "Wire"; width = "Line";
if (STRUCT->m_Layer == LAYER_BUS)
if (STRUCT->GetLayer() == LAYER_BUS)
{
layer = "Bus"; width = "Bus";
}
@ -195,8 +189,8 @@ bool WinEDA_SchematicFrame::SaveEEFile(SCH_SCREEN *screen, int FileSave)
#undef STRUCT
#define STRUCT ((DrawPolylineStruct *) Phead)
layer = "Notes"; width = "Line";
if (STRUCT->m_Layer == LAYER_WIRE) layer = "Wire";
if (STRUCT->m_Layer == LAYER_BUS) layer = "Bus";
if (STRUCT->GetLayer() == LAYER_WIRE) layer = "Wire";
if (STRUCT->GetLayer() == LAYER_BUS) layer = "Bus";
if( STRUCT->m_Width != GR_NORM_WIDTH) width = "Bus";
if (fprintf(f, "Poly %s %s %d\n",
width, layer, STRUCT->m_NumOfPoints) == EOF)

View File

@ -15,8 +15,6 @@
#include "protos.h"
#include "schframe.h"
/*****************************************************************************
*
@ -354,7 +352,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_DELETE:
if( GetScreen()->GetCurItem() == NULL )
break;
DeleteStruct( this->DrawPanel, &dc, GetScreen()->GetCurItem() );
DeleteStruct( DrawPanel, &dc, (SCH_ITEM*)GetScreen()->GetCurItem() );
GetScreen()->SetCurItem( NULL );
g_ItemToRepeat = NULL;
TestDanglingEnds( GetScreen()->EEDrawList, &dc );
@ -367,19 +365,17 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_END_SHEET:
DrawPanel->MouseToCursorSchema();
GetScreen()->GetCurItem()->Place( this, &dc );
((SCH_ITEM*)GetScreen()->GetCurItem())->Place( this, &dc );
break;
case ID_POPUP_SCH_RESIZE_SHEET:
DrawPanel->MouseToCursorSchema();
ReSizeSheet( (DrawSheetStruct*)
GetScreen()->GetCurItem(), &dc );
ReSizeSheet( (DrawSheetStruct*) GetScreen()->GetCurItem(), &dc );
TestDanglingEnds( GetScreen()->EEDrawList, &dc );
break;
case ID_POPUP_SCH_EDIT_SHEET:
EditSheet( (DrawSheetStruct*)
GetScreen()->GetCurItem(), &dc );
EditSheet( (DrawSheetStruct*) GetScreen()->GetCurItem(), &dc );
break;
case ID_POPUP_SCH_CLEANUP_SHEET:
@ -424,7 +420,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
}
}
else
Process_Move_Item( GetScreen()->GetCurItem(), &dc );
Process_Move_Item( (SCH_ITEM*) GetScreen()->GetCurItem(), &dc );
break;
case ID_POPUP_SCH_EDIT_CMP:
@ -477,7 +473,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema();
if( GetScreen()->GetCurItem()->m_Flags == 0 )
SaveCopyInUndoList( GetScreen()->GetCurItem(), IS_CHANGED );
SaveCopyInUndoList( (SCH_ITEM*) GetScreen()->GetCurItem(), IS_CHANGED );
CmpRotationMiroir(
(SCH_COMPONENT*) GetScreen()->GetCurItem(),
@ -705,7 +701,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
LAYER_LOCLABEL : LAYER_GLOBLABEL ) );
if( GetScreen()->GetCurItem() )
{
GetScreen()->GetCurItem()->Place( this, &dc );
((SCH_ITEM*)GetScreen()->GetCurItem())->Place( this, &dc );
TestDanglingEnds( GetScreen()->EEDrawList, &dc );
GetScreen()->SetCurItem( NULL );
}
@ -738,14 +734,12 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
if( m_ID_current_state == 0 )
g_ItemToRepeat = NULL;
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 )
return;

View File

@ -13,8 +13,6 @@
#include "protos.h"
#include "schframe.h"
/* Functions to undo and redo edit commands.
* commmands to undo are in CurrentScreen->m_UndoList
* commmands to redo are in CurrentScreen->m_RedoList
@ -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 )
/***********************************************************************/
@ -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
*/
{
EDA_BaseStruct* CopyItem;
SCH_ITEM* CopyItem;
DrawPickedStruct* NewList = new DrawPickedStruct( NULL );
@ -228,7 +226,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
CopyItem = PickedList->m_PickedStruct;
CopyItem->m_Flags = flag_type_command;
PickedList->m_Image = CopyItem->m_Image;
PickedList = (DrawPickedStruct*) PickedList->Pnext;
PickedList = PickedList->Next();
}
}
else
@ -249,7 +247,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
PickedList->m_Image = CopyItem;
PickedList->m_PickedStruct = NULL;
PickedList->m_Flags = flag_type_command;
PickedList = (DrawPickedStruct*) PickedList->Pnext;
PickedList = PickedList->Next();
}
}
else
@ -274,7 +272,7 @@ void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
CopyItem = PickedList->m_PickedStruct;
CopyItem->m_Flags = flag_type_command;
PickedList->m_Flags = flag_type_command;
PickedList = (DrawPickedStruct*) PickedList->Pnext;
PickedList = PickedList->Next();
}
}
break;
@ -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
*/
{
EDA_BaseStruct* FirstItem = List->m_Son;
EDA_BaseStruct* item;
SCH_ITEM* FirstItem = (SCH_ITEM*) List->m_Son;
SCH_ITEM* item;
DrawPickedStruct* PickedList;
switch( List->m_Flags )
@ -363,7 +361,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
PickedList = (DrawPickedStruct*) FirstItem;
while( PickedList )
{
item = PickedList->m_Image;
item = (SCH_ITEM*) PickedList->m_Image;
( (SCH_SCREEN*) GetScreen() )->RemoveFromDrawList( item );
item->m_Flags = IS_DELETED;
PickedList->m_PickedStruct = item;
@ -373,7 +371,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
}
else
{
FirstItem = List->m_Image;
FirstItem = (SCH_ITEM*)List->m_Image;
( (SCH_SCREEN*) GetScreen() )->RemoveFromDrawList( FirstItem );
FirstItem->m_Flags = IS_DELETED;
List->m_Son = FirstItem;
@ -412,7 +410,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
List->m_Son = ( (SCH_SCREEN*) GetScreen() )->ExtractWires( FALSE );
while( FirstItem )
{
EDA_BaseStruct* nextitem = FirstItem->Pnext;
SCH_ITEM* nextitem = FirstItem->Next();
FirstItem->Pnext = GetScreen()->EEDrawList;
GetScreen()->EEDrawList = FirstItem;
FirstItem->m_Flags = 0;
@ -438,7 +436,7 @@ void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
break;
case IS_NEW:
item = PickedList->m_Image;
item = (SCH_ITEM*) PickedList->m_Image;
( (SCH_SCREEN*) GetScreen() )->RemoveFromDrawList( item );
item->m_Flags = IS_DELETED;
PickedList->m_PickedStruct = item;

View File

@ -17,7 +17,6 @@
#include "protos.h"
#include "id.h"
#include "netlist.h"
#include "schframe.h"
#include "annotate_dialog.h"
#include "dialog_build_BOM.h"
@ -411,7 +410,7 @@ int WinEDA_SchematicFrame::BestZoom()
GetScreen()->SetZoom( ii );
GetScreen()->m_Curseur.x = dx / 2;
GetScreen()->m_Curseur.y = dy / 2;
return bestzoom;
}

View File

@ -1,249 +0,0 @@
/*****************************************************************************
*
* 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_ */

View File

@ -39,8 +39,6 @@
#include "protos.h"
#include "schframe.h"
/* Routines Locales */
static void ExitSheet( WinEDA_DrawPanel* Panel, wxDC* DC );
static void DeplaceSheet( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
@ -343,9 +341,9 @@ void WinEDA_SheetPropertiesFrame::SheetPropertiesAccept( wxCommandEvent& event )
/*************************************************************************/
bool WinEDA_SchematicFrame::EditSheet( DrawSheetStruct* Sheet, wxDC* DC )
{
/*************************************************************************/
/* Routine to edit the SheetName and the FileName for the sheet "Sheet" */
{
WinEDA_SheetPropertiesFrame* frame;
bool edit = TRUE;
@ -370,9 +368,9 @@ bool WinEDA_SchematicFrame::EditSheet( DrawSheetStruct* Sheet, wxDC* DC )
#define SHEET_MIN_HEIGHT 150
/****************************************************************/
DrawSheetStruct* WinEDA_SchematicFrame::CreateSheet( wxDC* DC )
{
/****************************************************************/
/* Routine de Creation d'une feuille de hierarchie (Sheet) */
{
g_ItemToRepeat = NULL;
DrawSheetStruct* Sheet = new DrawSheetStruct( GetScreen()->m_Curseur );
@ -400,8 +398,8 @@ DrawSheetStruct* WinEDA_SchematicFrame::CreateSheet( wxDC* DC )
/*******************************************************************************/
void WinEDA_SchematicFrame::ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC )
{
/*******************************************************************************/
{
DrawSheetLabelStruct* sheetlabel;
if( Sheet == NULL )
@ -443,8 +441,8 @@ void WinEDA_SchematicFrame::ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC )
/*********************************************************************************/
void WinEDA_SchematicFrame::StartMoveSheet( DrawSheetStruct* Sheet, wxDC* DC )
{
/*********************************************************************************/
{
if( (Sheet == NULL) || ( Sheet->Type() != DRAW_SHEET_STRUCT_TYPE) )
return;

View File

@ -12,8 +12,6 @@
#include "protos.h"
#include "schframe.h"
/* Routines Locales */
static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC );

View File

@ -13,8 +13,6 @@
#include "protos.h"
#include "hotkeys.h"
#include "schframe.h"
#define BITMAP wxBitmap
#include "bitmaps.h" /* general bitmaps */
@ -198,7 +196,7 @@ void WinEDA_SchematicFrame::ReCreateVToolbar()
BITMAP( add_glabel_xpm ),
_( "Place the global label.\nWarning: all global labels with the same name are connected in whole hierarchy" ),
wxITEM_CHECK );
m_VToolBar->AddTool( ID_JUNCTION_BUTT, wxEmptyString,
BITMAP( add_junction_xpm ),
_( "Place the junction" ), wxITEM_CHECK );

View File

@ -21,153 +21,157 @@
#include "library_browse.xpm"
/*****************************/
/* class WinEDA_ViewlibFrame */
/*****************************/
BEGIN_EVENT_TABLE(WinEDA_ViewlibFrame, wxFrame)
COMMON_EVENTS_DRAWFRAME
/*****************************/
/* class WinEDA_ViewlibFrame */
/*****************************/
BEGIN_EVENT_TABLE( WinEDA_ViewlibFrame, wxFrame )
COMMON_EVENTS_DRAWFRAME EVT_CLOSE( WinEDA_ViewlibFrame::OnCloseWindow )
EVT_SIZE( WinEDA_ViewlibFrame::OnSize )
EVT_ACTIVATE( WinEDA_DrawFrame::OnActivate )
EVT_CLOSE(WinEDA_ViewlibFrame::OnCloseWindow)
EVT_SIZE(WinEDA_ViewlibFrame::OnSize)
EVT_ACTIVATE(WinEDA_DrawFrame::OnActivate)
EVT_TOOL_RANGE( ID_LIBVIEW_START_H_TOOL, ID_LIBVIEW_END_H_TOOL,
WinEDA_ViewlibFrame::Process_Special_Functions )
EVT_TOOL_RANGE(ID_LIBVIEW_START_H_TOOL, ID_LIBVIEW_END_H_TOOL,
WinEDA_ViewlibFrame::Process_Special_Functions)
EVT_TOOL_RANGE( ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_DrawFrame::Process_Zoom )
EVT_TOOL_RANGE(ID_ZOOM_IN_BUTT, ID_ZOOM_PAGE_BUTT,
WinEDA_DrawFrame::Process_Zoom)
EVT_TOOL( ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
WinEDA_ViewlibFrame::ExportToSchematicLibraryPart )
EVT_TOOL(ID_LIBVIEW_CMP_EXPORT_TO_SCHEMATIC,
WinEDA_ViewlibFrame::ExportToSchematicLibraryPart)
EVT_KICAD_CHOICEBOX( ID_LIBVIEW_SELECT_PART_NUMBER,
WinEDA_ViewlibFrame::Process_Special_Functions )
EVT_KICAD_CHOICEBOX(ID_LIBVIEW_SELECT_PART_NUMBER,
WinEDA_ViewlibFrame::Process_Special_Functions)
EVT_LISTBOX(ID_LIBVIEW_LIB_LIST, WinEDA_ViewlibFrame::ClickOnLibList)
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()
/****************/
/* Constructeur */
/****************/
WinEDA_ViewlibFrame::WinEDA_ViewlibFrame(wxWindow * father, WinEDA_App *parent,
LibraryStruct * Library, wxSemaphore * semaphore ):
WinEDA_DrawFrame(father, VIEWER_FRAME, parent, _("Library browser"),
wxDefaultPosition, wxDefaultSize)
/****************/
/* Constructeur */
/****************/
WinEDA_ViewlibFrame::WinEDA_ViewlibFrame( wxWindow* father, WinEDA_App* parent,
LibraryStruct* Library, wxSemaphore* semaphore ) :
WinEDA_DrawFrame( father, VIEWER_FRAME, parent, _( "Library browser" ),
wxDefaultPosition, wxDefaultSize )
{
m_FrameName = wxT("ViewlibFrame");
m_FrameName = wxT( "ViewlibFrame" );
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee
m_Draw_Axis = TRUE; // TRUE pour avoir les axes dessines
m_Draw_Grid = TRUE; // TRUE pour avoir la axes dessinee
// Give an icon
SetIcon(wxIcon(library_browse_xpm));
// Give an icon
SetIcon( wxIcon( library_browse_xpm ) );
m_CmpList = NULL;
m_LibList = NULL;
m_Semaphore = semaphore;
if ( m_Semaphore ) SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP);
m_CurrentScreen = new SCH_SCREEN(VIEWER_FRAME);
GetScreen()->SetZoom(16);
m_CmpList = NULL;
m_LibList = NULL;
m_Semaphore = semaphore;
if( m_Semaphore )
SetWindowStyle( GetWindowStyle() | wxSTAY_ON_TOP );
if ( Library == NULL )
{
m_LibListSize.x = 90;
m_LibListSize.y = -1;
m_LibList = new wxListBox(this, ID_LIBVIEW_LIB_LIST,wxPoint(0,0),
m_LibListSize, 0, NULL, wxLB_HSCROLL );
m_LibList->SetFont(*g_DialogFont);
m_LibList->SetBackgroundColour(wxColour(150,255,255));
m_LibList->SetForegroundColour(wxColour(0,0,0));
}
else g_CurrentViewLibraryName = Library->m_Name;
m_CmpListSize.x = 150;
m_CmpListSize.y = -1;
m_CmpList = new wxListBox(this, ID_LIBVIEW_CMP_LIST,wxPoint(m_LibListSize.x,0),
m_CmpListSize, 0, NULL, wxLB_HSCROLL );
m_CmpList->SetFont(*g_DialogFont);
m_CmpList->SetBackgroundColour(wxColour(255,255,200));
m_CmpList->SetForegroundColour(wxColour(0,0,0));
m_CurrentScreen = new SCH_SCREEN( VIEWER_FRAME );
GetScreen()->SetZoom( 16 );
GetSettings();
SetSize(m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y);
ReCreateHToolbar();
ReCreateVToolbar();
if ( m_LibList) ReCreateListLib();
DisplayLibInfos();
Show(TRUE);
if( Library == NULL )
{
m_LibListSize.x = 90;
m_LibListSize.y = -1;
m_LibList = new wxListBox( this, ID_LIBVIEW_LIB_LIST, wxPoint( 0, 0 ),
m_LibListSize, 0, NULL, wxLB_HSCROLL );
m_LibList->SetFont( *g_DialogFont );
m_LibList->SetBackgroundColour( wxColour( 150, 255, 255 ) );
m_LibList->SetForegroundColour( wxColour( 0, 0, 0 ) );
}
else
g_CurrentViewLibraryName = Library->m_Name;
m_CmpListSize.x = 150;
m_CmpListSize.y = -1;
m_CmpList = new wxListBox( this, ID_LIBVIEW_CMP_LIST, wxPoint( m_LibListSize.x, 0 ),
m_CmpListSize, 0, NULL, wxLB_HSCROLL );
m_CmpList->SetFont( *g_DialogFont );
m_CmpList->SetBackgroundColour( wxColour( 255, 255, 200 ) );
m_CmpList->SetForegroundColour( wxColour( 0, 0, 0 ) );
GetSettings();
SetSize( m_FramePos.x, m_FramePos.y, m_FrameSize.x, m_FrameSize.y );
ReCreateHToolbar();
ReCreateVToolbar();
if( m_LibList )
ReCreateListLib();
DisplayLibInfos();
Show( TRUE );
}
/***************/
/* Destructeur */
/***************/
/***************/
/* Destructeur */
/***************/
WinEDA_ViewlibFrame::~WinEDA_ViewlibFrame()
{
SAFE_DELETE( m_CurrentScreen );
m_Parent->m_ViewlibFrame = NULL;
SAFE_DELETE( m_CurrentScreen );
m_Parent->m_ViewlibFrame = NULL;
}
/*****************************************************************/
void WinEDA_ViewlibFrame::OnCloseWindow(wxCloseEvent & Event)
void WinEDA_ViewlibFrame::OnCloseWindow( wxCloseEvent& Event )
/*****************************************************************/
{
SaveSettings();
if ( m_Semaphore ) m_Semaphore->Post();
Destroy();
SaveSettings();
if( m_Semaphore )
m_Semaphore->Post();
Destroy();
}
/*****************************************************/
void WinEDA_ViewlibFrame::OnSize(wxSizeEvent & SizeEv)
void WinEDA_ViewlibFrame::OnSize( wxSizeEvent& SizeEv )
/*****************************************************/
{
wxSize size;
wxSize maintoolbar_size;
wxSize Vtoolbar_size;
wxSize size;
wxSize maintoolbar_size;
wxSize Vtoolbar_size;
GetClientSize(&size.x, &size.y);
m_FrameSize = size;
size.y -= m_MsgFrameHeight;
GetClientSize( &size.x, &size.y );
m_FrameSize = size;
size.y -= m_MsgFrameHeight;
if( m_HToolBar )
{
maintoolbar_size = m_HToolBar->GetSize();
}
if( m_HToolBar )
{
maintoolbar_size = m_HToolBar->GetSize();
}
if( m_VToolBar )
{
Vtoolbar_size = m_VToolBar->GetSize();
m_VToolBar->SetSize(size.x - maintoolbar_size.y, 0,-1, size.y);
}
if( m_VToolBar )
{
Vtoolbar_size = m_VToolBar->GetSize();
m_VToolBar->SetSize( size.x - maintoolbar_size.y, 0, -1, size.y );
}
if ( MsgPanel )
{
MsgPanel->SetSize(0, size.y, size.x, m_MsgFrameHeight);
}
if( MsgPanel )
{
MsgPanel->SetSize( 0, size.y, size.x, m_MsgFrameHeight );
}
if ( DrawPanel )
{
DrawPanel->SetSize(m_LibListSize.x + m_CmpListSize.x, 0,
size.x - Vtoolbar_size.x - m_LibListSize.x - m_CmpListSize.x,
size.y);
}
if( DrawPanel )
{
DrawPanel->SetSize( m_LibListSize.x + m_CmpListSize.x, 0,
size.x - Vtoolbar_size.x - m_LibListSize.x - m_CmpListSize.x,
size.y );
}
if ( m_LibList )
{
m_LibListSize.y = size.y;
m_LibList->SetSize(0, 0, m_LibListSize.x, m_LibListSize.y);
}
if( m_LibList )
{
m_LibListSize.y = size.y;
m_LibList->SetSize( 0, 0, m_LibListSize.x, m_LibListSize.y );
}
if ( m_CmpList )
{
m_CmpListSize.y = size.y;
m_CmpList->SetSize(m_LibListSize.x, 0, m_CmpListSize.x, m_CmpListSize.y);
}
if( m_CmpList )
{
m_CmpListSize.y = size.y;
m_CmpList->SetSize( m_LibListSize.x, 0, m_CmpListSize.x, m_CmpListSize.y );
}
}
@ -175,147 +179,159 @@ wxSize Vtoolbar_size;
int WinEDA_ViewlibFrame::BestZoom()
/*******************************************/
{
int bestzoom, ii, jj;
wxSize size, itemsize;
EDA_LibComponentStruct * CurrentLibEntry = NULL;
int bestzoom, ii, jj;
wxSize size, itemsize;
EDA_LibComponentStruct* CurrentLibEntry = NULL;
CurrentLibEntry = FindLibPart(g_CurrentViewComponentName.GetData(),
g_CurrentViewLibraryName.GetData(), FIND_ROOT);
CurrentLibEntry = FindLibPart( g_CurrentViewComponentName.GetData(),
g_CurrentViewLibraryName.GetData(), FIND_ROOT );
if( CurrentLibEntry == NULL )
{
bestzoom = 16;
GetScreen()->m_Curseur.x = 0;
GetScreen()->m_Curseur.y = 0;
return(bestzoom);
}
if( CurrentLibEntry == NULL )
{
bestzoom = 16;
GetScreen()->m_Curseur.x = 0;
GetScreen()->m_Curseur.y = 0;
return bestzoom;
}
EDA_Rect BoundaryBox = CurrentLibEntry->GetBoundaryBox(g_ViewUnit, g_ViewConvert);
itemsize = BoundaryBox.GetSize();
EDA_Rect BoundaryBox = CurrentLibEntry->GetBoundaryBox( g_ViewUnit, g_ViewConvert );
itemsize = BoundaryBox.GetSize();
size = DrawPanel->GetClientSize();
size.x -= 60; // Pour marges haut et bas
ii = itemsize.x / size.x;
jj = itemsize.y / size.y;
ii = MAX(ii, jj);
size = DrawPanel->GetClientSize();
size.x -= 60; // Pour marges haut et bas
ii = itemsize.x / size.x;
jj = itemsize.y / size.y;
ii = MAX( ii, jj );
/* determination du zoom existant le plus proche */
for ( bestzoom = 1 ; bestzoom < 512 ; bestzoom <<= 1 )
{
if(bestzoom > ii ) break;
}
/* determination du zoom existant le plus proche */
for( bestzoom = 1; bestzoom < 512; bestzoom <<= 1 )
{
if( bestzoom > ii )
break;
}
GetScreen()->m_Curseur = BoundaryBox.Centre();
GetScreen()->m_Curseur.y = -( GetScreen()->m_Curseur.y );
GetScreen()->m_Curseur = BoundaryBox.Centre();
return(bestzoom);
return bestzoom;
}
/***************************************************/
void WinEDA_ViewlibFrame::ReCreateListLib()
/***************************************************/
{
const wxChar ** ListNames, ** names;
int ii;
bool found = FALSE;
const wxChar** ListNames, ** names;
int ii;
bool found = FALSE;
if ( m_LibList == NULL ) return;
ListNames = GetLibNames();
if( m_LibList == NULL )
return;
m_LibList->Clear();
for ( names = ListNames, ii = 0; *names != NULL; names++, ii++ )
{
m_LibList->Append(*names);
if ( g_CurrentViewLibraryName.Cmp(*names) == 0)
{
m_LibList->SetSelection(ii, TRUE);
found = TRUE;
}
}
ListNames = GetLibNames();
free (ListNames);
m_LibList->Clear();
for( names = ListNames, ii = 0; *names != NULL; names++, ii++ )
{
m_LibList->Append( *names );
if( g_CurrentViewLibraryName.Cmp( *names ) == 0 )
{
m_LibList->SetSelection( ii, TRUE );
found = TRUE;
}
}
/* Librairie courante peut etre non retrouv<75>e en liste
(peut etre effac<EFBFBD>e lors d'une modification de configuration) */
if ( ! found )
{
g_CurrentViewLibraryName.Empty();
g_CurrentViewComponentName.Empty();
}
free( ListNames );
ReCreateListCmp();
ReCreateHToolbar();
DisplayLibInfos();
ReDrawPanel();
/* Librairie courante peut etre non retrouv<75>e en liste
* (peut etre effac<EFBFBD>e lors d'une modification de configuration) */
if( !found )
{
g_CurrentViewLibraryName.Empty();
g_CurrentViewComponentName.Empty();
}
ReCreateListCmp();
ReCreateHToolbar();
DisplayLibInfos();
ReDrawPanel();
}
/***********************************************/
void WinEDA_ViewlibFrame::ReCreateListCmp()
/***********************************************/
{
int ii;
EDA_LibComponentStruct *LibEntry = NULL;
LibraryStruct *Library = FindLibrary(g_CurrentViewLibraryName.GetData());
int ii;
EDA_LibComponentStruct* LibEntry = NULL;
LibraryStruct* Library = FindLibrary( g_CurrentViewLibraryName.GetData() );
m_CmpList->Clear();
ii = 0;
g_CurrentViewComponentName.Empty();
g_ViewConvert = 1; /* Vue normal / convert */
g_ViewUnit = 1; /* unit<69> a afficher (A, B ..) */
if ( Library )
LibEntry = (EDA_LibComponentStruct *) PQFirst(&Library->m_Entries, FALSE);
while( LibEntry )
{
m_CmpList->Append(LibEntry->m_Name.m_Text);
LibEntry = (EDA_LibComponentStruct *) PQNext(Library->m_Entries, LibEntry, NULL);
}
m_CmpList->Clear();
ii = 0;
g_CurrentViewComponentName.Empty();
g_ViewConvert = 1; /* Vue normal / convert */
g_ViewUnit = 1; /* unit<69> a afficher (A, B ..) */
if( Library )
LibEntry = (EDA_LibComponentStruct*) PQFirst( &Library->m_Entries, FALSE );
while( LibEntry )
{
m_CmpList->Append( LibEntry->m_Name.m_Text );
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();
if ( ii < 0 ) return;
int ii = m_LibList->GetSelection();
wxString name = m_LibList->GetString(ii);
if ( g_CurrentViewLibraryName == name ) return;
g_CurrentViewLibraryName = name;
ReCreateListCmp();
ReDrawPanel();
DisplayLibInfos();
ReCreateHToolbar();
if( ii < 0 )
return;
wxString name = m_LibList->GetString( ii );
if( g_CurrentViewLibraryName == name )
return;
g_CurrentViewLibraryName = name;
ReCreateListCmp();
ReDrawPanel();
DisplayLibInfos();
ReCreateHToolbar();
}
/****************************************************************/
void WinEDA_ViewlibFrame::ClickOnCmpList(wxCommandEvent & event)
void WinEDA_ViewlibFrame::ClickOnCmpList( wxCommandEvent& event )
/****************************************************************/
{
int ii = m_CmpList->GetSelection();
if ( ii < 0 ) return;
int ii = m_CmpList->GetSelection();
wxString name = m_CmpList->GetString(ii);
g_CurrentViewComponentName = name;
DisplayLibInfos();
g_ViewUnit = 1;
g_ViewConvert = 1;
Zoom_Automatique(FALSE);
ReCreateHToolbar();
ReDrawPanel();
if( ii < 0 )
return;
wxString name = m_CmpList->GetString( ii );
g_CurrentViewComponentName = name;
DisplayLibInfos();
g_ViewUnit = 1;
g_ViewConvert = 1;
Zoom_Automatique( FALSE );
ReCreateHToolbar();
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
*/
*/
{
int ii = m_CmpList->GetSelection();
if ( ii >= 0 ) g_CurrentViewComponentName = m_CmpList->GetString(ii);
else g_CurrentViewComponentName.Empty();
Close(TRUE);
int ii = m_CmpList->GetSelection();
if( ii >= 0 )
g_CurrentViewComponentName = m_CmpList->GetString( ii );
else
g_CurrentViewComponentName.Empty();
Close( TRUE );
}

View File

@ -303,16 +303,6 @@ public:
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
* has knowledge about the frame and how and where to put status information
@ -545,213 +535,4 @@ public:
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 */

148
include/board_item_struct.h Normal file
View File

@ -0,0 +1,148 @@
/*********************************************************************/
/* 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 */

View File

@ -17,6 +17,8 @@
#include "colors.h"
class SCH_ITEM;
/****************************************************/
/* classe representant un ecran graphique de dessin */
/****************************************************/
@ -218,9 +220,9 @@ public:
bool m_FirstRedraw;
/* Gestion des editions */
EDA_BaseStruct* EEDrawList; /* Object list (main data) for schematic */
EDA_BaseStruct* m_UndoList; /* Object list for the undo command (old data) */
EDA_BaseStruct* m_RedoList; /* Object list for the redo command (old data) */
SCH_ITEM * EEDrawList; /* Object list (main data) for schematic */
EDA_BaseStruct * m_UndoList; /* Object list for the undo command (old data) */
EDA_BaseStruct * m_RedoList; /* Object list for the redo command (old data) */
int m_UndoRedoCountMax; /* undo/Redo command Max depth */
/* block control */

View File

@ -6,6 +6,7 @@
#define PCBSTRUCT_H
#include "base_struct.h"
#include "board_item_struct.h"
// Definitions relatives aux libariries
#define ENTETE_LIBRAIRIE "PCBNEW-LibModule-V1"

119
include/sch_item_struct.h Normal file
View File

@ -0,0 +1,119 @@
/*****************************************************************************/
/* 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 */

421
include/wxEeschemaStruct.h Normal file
View File

@ -0,0 +1,421 @@
/***********************************************************/
/* 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

View File

@ -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 */
/****************************************************/

View File

@ -15,21 +15,9 @@
#include "cvpcb.h"
#endif
#include "protos.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 */
/***************************************************/

View File

@ -44,7 +44,6 @@
#ifdef EESCHEMA
#include "program.h"
#include "../eeschema/schframe.h"
#endif
////@begin XPM images

View File

@ -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.
I propose a two step solution:
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.
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.