Commit 7f453831 authored by charras's avatar charras

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

eeschema: code cleaning. SCH_ITEM class used for all schematic items in eeschema. Files reorganization.
parent 7bb6007a
......@@ -5,6 +5,13 @@ Started 2007-June-11
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
......
......@@ -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
......
......@@ -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;
}
}
......@@ -9,6 +9,7 @@
#include "gr_basic.h"
#include "wxstruct.h"
#include "common.h"
#include "sch_item_struct.h"
#include "macros.h"
......
/****************************************************/
/* class_drawpickedstruct.cpp */
/****************************************************/
#include "fctsys.h"
#include "common.h"
#include "sch_item_struct.h"
/**************************/
/* class DrawPickedStruct */
/**************************/
/* This class has only one useful member: .m_PickedStruct, used as a link.
* It does not describe really an item.
* It is used to create a linked list of selected items (in block selection).
* Each DrawPickedStruct item has is member: .m_PickedStruct pointing the
* real selected item
*/
/*******************************************************************/
DrawPickedStruct::DrawPickedStruct( SCH_ITEM * pickedstruct ) :
SCH_ITEM( NULL, DRAW_PICK_ITEM_STRUCT_TYPE )
/*******************************************************************/
{
m_PickedStruct = pickedstruct;
}
DrawPickedStruct::~DrawPickedStruct()
{
}
#if defined(DEBUG)
void DrawPickedStruct::Show( int nestLevel, std::ostream& os )
{
NestedSpace( nestLevel, os ) << '<' << GetClass().Lower().mb_str() << "/>\n";
}
#endif
EDA_Rect DrawPickedStruct::GetBoundingBox()
{
if( m_PickedStruct )
return m_PickedStruct->GetBoundingBox();
else
{
return EDA_Rect(); // empty rectangle
}
}
EDA_Rect DrawPickedStruct::GetBoundingBoxUnion()
{
EDA_Rect ret;
DrawPickedStruct* cur = this;
SCH_ITEM* item;
while( cur && (item = cur->m_PickedStruct) != NULL )
{
ret.Merge( item->GetBoundingBox() );
cur = cur->Next();
}
return ret;
}
/*********************************************/
void DrawPickedStruct::DeleteWrapperList()
/*********************************************/
/* Delete this item all the items of the linked list
* Free the wrapper, but DOES NOT delete the picked items linked by .m_PickedStruct
*/
{
DrawPickedStruct* wrapp_struct, * next_struct;
for( wrapp_struct = Next(); wrapp_struct != NULL; wrapp_struct = next_struct )
{
next_struct = wrapp_struct->Next();
delete wrapp_struct;
}
}
......@@ -9,6 +9,7 @@ OBJECTS= \
base_struct.o\
copy_to_clipboard.o\
basicframe.o\
class_drawpickedstruct.o\
common_plot_functions.o\
common_plotPS_functions.o\
common_plotHPGL_functions.o\
......
......@@ -13,8 +13,6 @@
#include "protos.h"
#include "schframe.h"
/***********************************************************/
void DrawSheetStruct::Display_Infos( WinEDA_DrawFrame* frame )
......
......@@ -9,8 +9,6 @@
#include "netlist.h"
#include "protos.h"
#include "schframe.h"
/* Local Functions*/
static int ListeComposants( CmpListStruct* BaseListeCmp,
DrawSheetPath* sheet );
......
......@@ -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,
......
This diff is collapsed.
......@@ -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� 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;
}
......
......@@ -13,8 +13,6 @@
#include "protos.h"
#include "schframe.h"
/* Routines Locales */
/* Variables locales */
......
......@@ -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;
......
......@@ -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:
......
......@@ -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;
......
......@@ -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();
......
......@@ -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 );
}
......
......@@ -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
......
......@@ -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. */
......
......@@ -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;
}
......
......@@ -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 );
......
......@@ -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;
......
......@@ -15,8 +15,6 @@
#include "protos.h"
#include "schframe.h"
/***************************************************************/
void RemoteCommand( const char* cmdline )
......
......@@ -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�es pos est sur l'extr�mit� 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;
......
......@@ -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;
......
......@@ -11,7 +11,6 @@
#include "general.h"
#include "protos.h"
#include "schframe.h"
/**************************************************************************/
......
......@@ -40,8 +40,6 @@
#include "id.h"
#include "schframe.h"
#include "dialog_eeschema_config.h"
////@begin XPM images
......
......@@ -37,7 +37,6 @@
#include "netlist.h"
#include "protos.h"
#include "schframe.h"
#include "dialog_erc.h"
......
......@@ -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();
......
......@@ -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 );
......@@ -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 )
......@@ -281,7 +279,7 @@ 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_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;
......
......@@ -15,8 +15,6 @@
#include "id.h"
#include "schframe.h"
/* Variables locales */
......
......@@ -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)
*/
......
......@@ -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, 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;
SCH_COMPONENT* DrawLibItem = (SCH_COMPONENT*) m_Parent;
int hjustify, vjustify;
int LineWidth = MAX( Field->m_Width, g_DrawMinimunLineWidth );
int LineWidth = MAX( m_Width, g_DrawMinimunLineWidth );
if( Field->m_Attributs & TEXT_NO_VISIBLE )
if( m_Attributs & TEXT_NO_VISIBLE )
return;
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 );
}
}
......
......@@ -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;
}
......
......@@ -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" ) );
......
......@@ -12,8 +12,6 @@
#include "protos.h"
#include "schframe.h"
#include "../bitmaps/ercgreen.xpm"
#include "../bitmaps/ercwarn.xpm"
#include "../bitmaps/ercerr.xpm"
......
......@@ -13,8 +13,6 @@
#include "protos.h"
#include "id.h"
#include "schframe.h"
/* Fonctions locales */
......
......@@ -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 )
......
......@@ -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;
......
......@@ -13,8 +13,6 @@
#include "protos.h"
#include "schframe.h"
/* Routines Locales */
static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase );
......
......@@ -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"
......
......@@ -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;
......
......@@ -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 */
......
......@@ -18,7 +18,7 @@
int distance( int dx, int dy, int spot_cX, int spot_cY, int seuil );
/* Routines Locales */
static EDA_BaseStruct* LastSnappedStruct = NULL;
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 );
......@@ -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,7 +39,7 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
*/
{
SCH_COMPONENT* DrawLibItem = NULL, * LastDrawLibItem = NULL;
EDA_BaseStruct* DrawList;
SCH_ITEM* DrawList;
EDA_Rect BoundaryBox;
float sizeref = 0, sizecurr;
......@@ -55,7 +55,7 @@ SCH_COMPONENT* LocateSmallestComponent( SCH_SCREEN* Screen )
break;
}
DrawLibItem = (SCH_COMPONENT*) LastSnappedStruct;
DrawList = DrawLibItem->Pnext;
DrawList = DrawLibItem->Next();
if( LastDrawLibItem == NULL ) // First time a component is located
{
LastDrawLibItem = DrawLibItem;
......@@ -111,16 +111,16 @@ 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;
SCH_ITEM* DrawList = screen->EEDrawList;
if( screen==NULL || DrawList == NULL )
return NULL;
......@@ -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;
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:
......@@ -249,9 +249,9 @@ bool SnapPoint2( const wxPoint& PosRef, int SearchMask,
if( IsPointOnSegment( x, y, STRUCT->m_Start.x, STRUCT->m_Start.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 )
......@@ -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;
......@@ -952,7 +952,7 @@ int distance( int dx, int dy, int spot_cX, int spot_cY, int seuil )
{
int cXrot, cYrot, /* coord du point (souris) dans le repere tourne */
segX, segY; /* coord extremite segment tj >= 0 */
int pointX, pointY;/* coord point a tester dans repere modifie dans lequel
int pointX, pointY; /* coord point a tester dans repere modifie dans lequel
* segX et segY sont >=0 */
segX = dx; segY = dy; pointX = spot_cX; pointY = spot_cY;
......@@ -1041,8 +1041,9 @@ int distance( int dx, int dy, int spot_cX, int spot_cY, int seuil )
return 0;
}
/*******************************************************************/
LibDrawPin* LocatePinByNumber( const wxString & ePin_Number,
LibDrawPin* LocatePinByNumber( const wxString& ePin_Number,
SCH_COMPONENT* eComponent )
/*******************************************************************/
......@@ -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;
......@@ -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;
......@@ -1228,13 +1229,13 @@ 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;
......
......@@ -18,8 +18,6 @@
#include "id.h"
#include "hotkeys.h"
#include "schframe.h"
/************************************************/
void WinEDA_SchematicFrame::ReCreateMenuBar()
......
......@@ -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,
......
......@@ -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;
}
......
......@@ -22,7 +22,6 @@
#include "netlist.h"
#include "protos.h"
#include "schframe.h"
#include "netlist_control.h"
// ID for configuration:
......
......@@ -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�
*/
{
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem();
if( (m_ID_current_state == 0) || ( DrawStruct && DrawStruct->m_Flags ) )
{
......
......@@ -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�t� par la liste des commandes de ZOOM
*/
{
EDA_BaseStruct* DrawStruct = GetScreen()->GetCurItem();
SCH_ITEM* DrawStruct = (SCH_ITEM*) GetScreen()->GetCurItem();
bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
......@@ -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 );
......
......@@ -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 )
......
......@@ -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)
{
......
......@@ -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 */
......
......@@ -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:
......
......@@ -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" */
......
......@@ -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)
......
......@@ -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;
......
......@@ -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;
......
......@@ -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"
......
/*****************************************************************************
*
* schframe.h
*
* Header for class definition of WinEDA_SchematicFrame. This is the main
* window for EESchema.
*
*****************************************************************************/
#ifndef _SCHFRAME_H_
#define _SCHFRAME_H_
class WinEDA_DrawFrame;
class WinEDA_SchematicFrame : public WinEDA_DrawFrame
{
public:
WinEDAChoiceBox* m_SelPartBox;
DrawSheetPath* m_CurrentSheet; //which sheet we are presently working on.
private:
wxMenu* m_FilesMenu;
public:
WinEDA_SchematicFrame( wxWindow* father, WinEDA_App* parent,
const wxString& title,
const wxPoint& pos, const wxSize& size,
long style = KICAD_DEFAULT_DRAWFRAME_STYLE );
~WinEDA_SchematicFrame();
void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event );
void Save_Config( wxWindow* displayframe );
void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void CreateScreens();
void ReCreateHToolbar();
void ReCreateVToolbar();
void ReCreateOptToolbar();
void ReCreateMenuBar();
void SetToolbars();
void OnHotKey( wxDC* DC,
int hotkey,
EDA_BaseStruct* DrawStruct );
DrawSheetPath* GetSheet();
virtual BASE_SCREEN* GetScreen();
virtual void SetScreen(SCH_SCREEN* screen);
virtual wxString GetScreenDesc();
void InstallConfigFrame( const wxPoint& pos );
void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
bool OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event );
void ToolOnRightClick( wxCommandEvent& event );
int BestZoom(); // Retourne le meilleur zoom
EDA_BaseStruct* SchematicGeneralLocateAndDisplay( bool IncludePin = TRUE );
EDA_BaseStruct* SchematicGeneralLocateAndDisplay( const wxPoint& refpoint,
bool IncludePin );
EDA_BaseStruct* FindComponentAndItem( const wxString& component_reference,
bool Find_in_hierarchy,
int SearchType,
const wxString& text_to_find,
bool mouseWarp );
/* Cross probing with pcbnew */
void SendMessageToPCBNEW( EDA_BaseStruct* objectToSync,
SCH_COMPONENT* LibItem );
/* netlist generation */
void* BuildNetListBase();
// FUnctions used for hierarchy handling
void InstallPreviousSheet();
void InstallNextScreen( DrawSheetStruct* Sheet );
void ToPlot_PS( wxCommandEvent& event );
void ToPlot_HPGL( wxCommandEvent& event );
void ToPostProcess( wxCommandEvent& event );
void Save_File( wxCommandEvent& event );
void SaveProject();
int LoadOneEEProject( const wxString& FileName, bool IsNew );
bool LoadOneEEFile(SCH_SCREEN* screen, const wxString& FullFileName );
bool SaveEEFile( SCH_SCREEN* screen, int FileSave );
SCH_SCREEN * CreateNewScreen(SCH_SCREEN * OldScreen, int TimeStamp);
// General search:
/**
* Function FindSchematicItem
* finds a string in the schematic.
* @param pattern The text to search for, either in value, reference or
* elsewhere.
* @param SearchType: 0 => Search is made in current sheet
* 1 => the whole hierarchy
* 2 => or for the next item
* @param mouseWarp If true, then move the mouse cursor to the item.
*/
EDA_BaseStruct* FindSchematicItem( const wxString& pattern,
int SearchType,
bool mouseWarp = true );
EDA_BaseStruct* FindMarker( int SearchType );
private:
void Process_Move_Item( EDA_BaseStruct* DrawStruct, wxDC* DC );
void OnExit( wxCommandEvent& event );
void OnAnnotate ( wxCommandEvent& event );
void OnErc( wxCommandEvent& event );
void OnCreateNetlist( wxCommandEvent& event );
void OnCreateBillOfMaterials( wxCommandEvent& event );
void OnFindItems( wxCommandEvent& event );
void OnLoadFile( wxCommandEvent& event );
void OnNewProject( wxCommandEvent& event );
void OnLoadProject( wxCommandEvent& event );
void OnOpenPcbnew( wxCommandEvent& event );
void OnOpenCvpcb( wxCommandEvent& event );
void OnOpenLibraryViewer( wxCommandEvent& event );
void OnOpenLibraryEditor( wxCommandEvent& event );
// Bus Entry
DrawBusEntryStruct* CreateBusEntry( wxDC* DC, int entry_type );
void SetBusEntryShape( wxDC* DC,
DrawBusEntryStruct* BusEntry,
int entry_type );
int GetBusEntryShape( DrawBusEntryStruct* BusEntry );
void StartMoveBusEntry( DrawBusEntryStruct* DrawLibItem, wxDC* DC );
// NoConnect
EDA_BaseStruct* CreateNewNoConnectStruct( wxDC* DC );
// Junction
DrawJunctionStruct* CreateNewJunctionStruct( wxDC* DC,
const wxPoint& pos,
bool PutInUndoList = FALSE );
// Text ,label, glabel
EDA_BaseStruct* CreateNewText( wxDC* DC, int type );
void EditSchematicText( SCH_TEXT* TextStruct, wxDC* DC );
void ChangeTextOrient( SCH_TEXT* TextStruct, wxDC* DC );
void StartMoveTexte( SCH_TEXT* TextStruct, wxDC* DC );
void ConvertTextType( SCH_TEXT* Text, wxDC* DC, int newtype );
// Wire, Bus
void BeginSegment( wxDC* DC, int type );
void EndSegment( wxDC* DC );
void DeleteCurrentSegment( wxDC* DC );
void DeleteConnection( wxDC* DC, bool DeleteFullConnection );
// graphic lines
void Delete_Segment_Edge( DRAWSEGMENT* Segment, wxDC* DC );
void Drawing_SetNewWidth( DRAWSEGMENT* DrawSegm, wxDC* DC );
void Delete_Drawings_All_Layer( DRAWSEGMENT* Segment, wxDC* DC );
DRAWSEGMENT* Begin_Edge( DRAWSEGMENT* Segment, wxDC* DC );
// Hierarchical Sheet & PinSheet
void InstallHierarchyFrame( wxDC* DC, wxPoint& pos );
DrawSheetStruct* CreateSheet( wxDC* DC );
void ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC );
public:
bool EditSheet( DrawSheetStruct* Sheet, wxDC* DC );
/** Function UpdateSheetNumberAndDate
* Set a sheet number, the sheet count for sheets in the whole schematic
* and update the date in all screens
*/
void UpdateSheetNumberAndDate();
private:
void StartMoveSheet( DrawSheetStruct* sheet, wxDC* DC );
DrawSheetLabelStruct* Create_PinSheet( DrawSheetStruct* Sheet, wxDC* DC );
void Edit_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC );
void StartMove_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC );
void Place_PinSheet( DrawSheetLabelStruct* SheetLabel, wxDC* DC );
DrawSheetLabelStruct* Import_PinSheet( DrawSheetStruct* Sheet, wxDC* DC );
public:
void DeleteSheetLabel( wxDC* DC, DrawSheetLabelStruct* SheetLabelToDel );
private:
// Component
SCH_COMPONENT* Load_Component( wxDC* DC,
const wxString& libname,
wxArrayString& List,
bool UseLibBrowser );
void StartMovePart( SCH_COMPONENT* DrawLibItem, wxDC* DC );
public:
void CmpRotationMiroir( SCH_COMPONENT* DrawComponent,
wxDC* DC, int type_rotate );
private:
void SelPartUnit( SCH_COMPONENT* DrawComponent,
int unit, wxDC* DC );
void ConvertPart( SCH_COMPONENT* DrawComponent, wxDC* DC );
void SetInitCmp( SCH_COMPONENT* DrawComponent, wxDC* DC );
void EditComponentReference( SCH_COMPONENT* DrawLibItem,
wxDC* DC );
void EditComponentValue( SCH_COMPONENT* DrawLibItem, wxDC* DC );
void EditComponentFootprint( SCH_COMPONENT* DrawLibItem,
wxDC* DC );
void StartMoveCmpField( PartTextStruct* Field, wxDC* DC );
void EditCmpFieldText( PartTextStruct* Field, wxDC* DC );
void RotateCmpField( PartTextStruct* Field, wxDC* DC );
/* Operations sur bloc */
void PasteStruct( wxDC* DC );
/* Undo - redo */
public:
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
int flag_type_command = 0 );
private:
void PutDataInPreviousState( DrawPickedStruct* List );
bool GetSchematicFromRedoList();
bool GetSchematicFromUndoList();
public:
void Key( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
/* Gestion generale des operations sur block */
int ReturnBlockCommand( int key );
void InitBlockPasteInfos();
void HandleBlockPlace( wxDC* DC );
int HandleBlockEnd( wxDC* DC );
void HandleBlockEndByPopUp( int Command, wxDC* DC );
// Repetition automatique de placements
void RepeatDrawItem( wxDC* DC );
// Test des points de connexion en l'air (dangling ends)
void TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC );
LibDrawPin* LocatePinEnd( EDA_BaseStruct* DrawList, const wxPoint& pos );
DECLARE_EVENT_TABLE()
};
#endif /* _SCHFRAME_H_ */
......@@ -39,8 +39,6 @@
#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;
......
......@@ -12,8 +12,6 @@
#include "protos.h"
#include "schframe.h"
/* Routines Locales */
static void ExitPinSheet( WinEDA_DrawPanel* Panel, wxDC* DC );
......
......@@ -13,8 +13,6 @@
#include "protos.h"
#include "hotkeys.h"
#include "schframe.h"
#define BITMAP wxBitmap
#include "bitmaps.h" /* general bitmaps */
......
This diff is collapsed.
......@@ -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 */
/*********************************************************************/
/* board_item_struct.h : Basic classes for BOARD_ITEM descriptions */
/*********************************************************************/
#ifndef BOARD_ITEM_STRUCT_H
#define BOARD_ITEM_STRUCT_H
/**
* Class BOARD_ITEM
* is a base class for any item which can be embedded within the BOARD
* container class, and therefore instances of derived classes should only be
* found in PCBNEW or other programs that use class BOARD and its contents.
* The corresponding class in EESCHEMA seems to be DrawPartStruct.
*/
class BOARD_ITEM : public EDA_BaseStruct
{
protected:
int m_Layer;
public:
BOARD_ITEM( BOARD_ITEM* StructFather, KICAD_T idtype ) :
EDA_BaseStruct( StructFather, idtype )
, m_Layer( 0 )
{
}
BOARD_ITEM( const BOARD_ITEM& src ) :
EDA_BaseStruct( src.m_Parent, src.Type() )
, m_Layer( src.m_Layer )
{
}
/**
* A value of wxPoint(0,0) which can be passed to the Draw() functions.
*/
static wxPoint ZeroOffset;
BOARD_ITEM* Next() const { return (BOARD_ITEM*) Pnext; }
BOARD_ITEM* Back() const { return (BOARD_ITEM*) Pback; }
BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; }
/**
* Function GetPosition
* returns the position of this object.
* @return wxPoint& - The position of this object, non-const so it
* can be changed
*/
virtual wxPoint& GetPosition() = 0;
/**
* Function GetLayer
* returns the layer this item is on.
*/
int GetLayer() const { return m_Layer; }
/**
* Function SetLayer
* sets the layer this item is on.
* @param aLayer The layer number.
*/
void SetLayer( int aLayer ) { m_Layer = aLayer; }
/**
* Function Draw
* BOARD_ITEMs have their own color information.
*/
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC,
int aDrawMode, const wxPoint& offset = ZeroOffset ) = 0;
/**
* Function IsOnLayer
* tests to see if this object is on the given layer. Is virtual so
* objects like D_PAD, which reside on multiple layers can do their own
* form of testing.
* @param aLayer The layer to test for.
* @return bool - true if on given layer, else false.
*/
virtual bool IsOnLayer( int aLayer ) const
{
return m_Layer == aLayer;
}
/**
* Function IsLocked
* @return bool - true if the object is locked, else false
*/
virtual bool IsLocked() const
{
return false; // only MODULEs can be locked at this time.
}
/**
* Function UnLink
* detaches this object from its owner.
*/
virtual void UnLink() = 0;
/**
* Function DeleteStructure
* deletes this object after UnLink()ing it from its owner.
*/
void DeleteStructure()
{
UnLink();
delete this;
}
/**
* Function MenuText
* returns the text to use in any menu type UI control which must uniquely
* identify this item.
* @param aBoard The PCB in which this item resides, needed for Net lookup.
* @return wxString
* @todo: maybe: make this virtual and split into each derived class
*/
wxString MenuText( const BOARD* aBoard ) const;
/**
* Function MenuIcon
* @return const char** - The XPM to use in any UI control which can help
* identify this item.
* @todo: make this virtual and split into each derived class
*/
const char** MenuIcon() const;
/**
* Function Save
* writes the data structures for this object out to a FILE in "*.brd" format.
* @param aFile The FILE to write to.
* @return bool - true if success writing else false.
*/
virtual bool Save( FILE* aFile ) const = 0;
};
#endif /* BOARD_ITEM_STRUCT_H */
......@@ -17,6 +17,8 @@
#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 */
......
......@@ -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"
......
/*****************************************************************************/
/* 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 */
This diff is collapsed.
This diff is collapsed.
......@@ -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 */
/***************************************************/
......
......@@ -44,7 +44,6 @@
#ifdef EESCHEMA
#include "program.h"
#include "../eeschema/schframe.h"
#endif
////@begin XPM images
......
......@@ -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.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment