see change_log for 2007-Aug-31

This commit is contained in:
dickelbeck 2007-09-01 12:00:30 +00:00
parent 726a8ab4df
commit dff70646a2
197 changed files with 3032 additions and 2652 deletions

View File

@ -80,7 +80,7 @@ Pcb3D_GLCanvas::Pcb3D_GLCanvas( WinEDA3D_DrawFrame* parent, wxWindowID id,
/*************************************/ /*************************************/
Pcb3D_GLCanvas::~Pcb3D_GLCanvas( void ) Pcb3D_GLCanvas::~Pcb3D_GLCanvas()
/*************************************/ /*************************************/
{ {
ClearLists(); ClearLists();
@ -88,7 +88,7 @@ Pcb3D_GLCanvas::~Pcb3D_GLCanvas( void )
/*************************************/ /*************************************/
void Pcb3D_GLCanvas::ClearLists( void ) void Pcb3D_GLCanvas::ClearLists()
/*************************************/ /*************************************/
{ {
if( m_gllist > 0 ) if( m_gllist > 0 )
@ -448,7 +448,7 @@ void Pcb3D_GLCanvas::OnPopUpMenu( wxCommandEvent& event )
/***************************************/ /***************************************/
void Pcb3D_GLCanvas::DisplayStatus( void ) void Pcb3D_GLCanvas::DisplayStatus()
/***************************************/ /***************************************/
{ {
wxString msg; wxString msg;
@ -573,7 +573,7 @@ void Pcb3D_GLCanvas::InitGL()
/***********************************/ /***********************************/
void Pcb3D_GLCanvas::SetLights( void ) void Pcb3D_GLCanvas::SetLights()
/***********************************/ /***********************************/
/* Init sources lumineuses pour OPENGL /* Init sources lumineuses pour OPENGL

View File

@ -168,7 +168,7 @@ glEnable(GL_FOG);
/* Tracé des pistes : */ /* Tracé des pistes : */
for (pt_piste = pcb->m_Track ; pt_piste != NULL ; pt_piste = (TRACK*) pt_piste->Pnext ) for (pt_piste = pcb->m_Track ; pt_piste != NULL ; pt_piste = (TRACK*) pt_piste->Pnext )
{ {
if ( pt_piste->m_StructType == TYPEVIA ) if ( pt_piste->Type() == TYPEVIA )
Draw3D_Via((SEGVIA*)pt_piste); Draw3D_Via((SEGVIA*)pt_piste);
else Draw3D_Track( pt_piste); else Draw3D_Track( pt_piste);
} }
@ -178,7 +178,7 @@ EDA_BaseStruct * PtStruct;
for ( PtStruct = pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Pnext) for ( PtStruct = pcb->m_Drawings; PtStruct != NULL; PtStruct = PtStruct->Pnext)
{ {
#define STRUCT ((DRAWSEGMENT *) PtStruct) #define STRUCT ((DRAWSEGMENT *) PtStruct)
if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) continue; if( PtStruct->Type() != TYPEDRAWSEGMENT ) continue;
Draw3D_DrawSegment(STRUCT); Draw3D_DrawSegment(STRUCT);
} }
@ -358,7 +358,7 @@ bool As3dShape = FALSE;
glNormal3f( 0.0, 0.0, 1.0); // Normal is Z axis glNormal3f( 0.0, 0.0, 1.0); // Normal is Z axis
for( ;Struct != NULL; Struct = Struct->Pnext ) for( ;Struct != NULL; Struct = Struct->Pnext )
{ {
switch( Struct->m_StructType ) switch( Struct->Type() )
{ {
case TYPETEXTEMODULE: case TYPETEXTEMODULE:
break; break;

View File

@ -97,7 +97,7 @@ public:
void OnEnterWindow( wxMouseEvent& event ); void OnEnterWindow( wxMouseEvent& event );
void Render( void ); void Render();
GLuint CreateDrawGL_List(void); GLuint CreateDrawGL_List(void);
void InitGL(void); void InitGL(void);
void SetLights(void); void SetLights(void);

View File

@ -4,6 +4,19 @@ Started 2007-June-11
Please add newer entries at the top, list the date and your name with Please add newer entries at the top, list the date and your name with
email address. email address.
2007-Aug-31 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================
+ pcbnew & gerbview
* Added TRACK::Copy() which can copy a SEGVIA or a TRACK.
* Changed export_to_pcbnew.cpp so it created a SEGVIA properly, a significant change.
Moved and changed a big block of code in export_to_pcbnew.cpp so we can
properly construct the SEGVIA(). Not tested.
* Make EDA_BaseStruct::m_StructType private so we can trap where it is being
changed. (It should never be changed after construction, see comment above
EDA_BaseStruct::SetType().)
2007-Aug-30 UPDATE Dick Hollenbeck <dick@softplc.com> 2007-Aug-30 UPDATE Dick Hollenbeck <dick@softplc.com>
================================================================================ ================================================================================
+ pcbnew + pcbnew

View File

@ -16,7 +16,8 @@
/*******************************************************/ /*******************************************************/
/* Class BASE_SCREEN: classe de gestion d'un affichage */ /* Class BASE_SCREEN: classe de gestion d'un affichage */
/*******************************************************/ /*******************************************************/
BASE_SCREEN::BASE_SCREEN( int idscreen ) : EDA_BaseStruct( SCREEN_STRUCT_TYPE ) BASE_SCREEN::BASE_SCREEN( int idscreen, KICAD_T aType ) :
EDA_BaseStruct( aType )
{ {
EEDrawList = NULL; /* Schematic items list */ EEDrawList = NULL; /* Schematic items list */
m_Type = idscreen; m_Type = idscreen;
@ -31,7 +32,7 @@ BASE_SCREEN::BASE_SCREEN( int idscreen ) : EDA_BaseStruct( SCREEN_STRUCT_TYPE )
/******************************/ /******************************/
BASE_SCREEN::~BASE_SCREEN( void ) BASE_SCREEN::~BASE_SCREEN()
/******************************/ /******************************/
{ {
if( m_ZoomList ) if( m_ZoomList )
@ -43,7 +44,7 @@ BASE_SCREEN::~BASE_SCREEN( void )
/*******************************/ /*******************************/
void BASE_SCREEN::InitDatas( void ) void BASE_SCREEN::InitDatas()
/*******************************/ /*******************************/
{ {
m_SheetNumber = m_NumberOfSheet = 1; /* gestion hierarchie: Root: SheetNumber = 1 */ m_SheetNumber = m_NumberOfSheet = 1; /* gestion hierarchie: Root: SheetNumber = 1 */
@ -121,7 +122,7 @@ wxPoint BASE_SCREEN::CursorRealPosition( const wxPoint& ScreenPos )
/***************************************/ /***************************************/
int BASE_SCREEN::GetInternalUnits( void ) int BASE_SCREEN::GetInternalUnits()
/***************************************/ /***************************************/
{ {
switch( m_Type ) switch( m_Type )
@ -141,7 +142,7 @@ int BASE_SCREEN::GetInternalUnits( void )
/*****************************************/ /*****************************************/
wxSize BASE_SCREEN::ReturnPageSize( void ) wxSize BASE_SCREEN::ReturnPageSize()
/*****************************************/ /*****************************************/
/* Retourne en unites internes la taille de la feuille de dessin /* Retourne en unites internes la taille de la feuille de dessin
@ -199,7 +200,7 @@ void BASE_SCREEN::SetZoomList( int* zoomlist )
/***********************************/ /***********************************/
void BASE_SCREEN::SetFirstZoom( void ) void BASE_SCREEN::SetFirstZoom()
/***********************************/ /***********************************/
/* ajuste le coeff de zoom a 1*/ /* ajuste le coeff de zoom a 1*/
{ {
@ -208,7 +209,7 @@ void BASE_SCREEN::SetFirstZoom( void )
/****************************/ /****************************/
int BASE_SCREEN::GetZoom( void ) int BASE_SCREEN::GetZoom()
/****************************/ /****************************/
/* retourne le coeff de zoom */ /* retourne le coeff de zoom */
{ {
@ -228,7 +229,7 @@ void BASE_SCREEN::SetZoom( int coeff )
/********************************/ /********************************/
void BASE_SCREEN::SetNextZoom( void ) void BASE_SCREEN::SetNextZoom()
/********************************/ /********************************/
/* Selectionne le prochain coeff de zoom /* Selectionne le prochain coeff de zoom
@ -249,7 +250,7 @@ void BASE_SCREEN::SetNextZoom( void )
/*************************************/ /*************************************/
void BASE_SCREEN::SetPreviousZoom( void ) void BASE_SCREEN::SetPreviousZoom()
/*************************************/ /*************************************/
/* Selectionne le precedent coeff de zoom /* Selectionne le precedent coeff de zoom
@ -262,7 +263,7 @@ void BASE_SCREEN::SetPreviousZoom( void )
/**********************************/ /**********************************/
void BASE_SCREEN::SetLastZoom( void ) void BASE_SCREEN::SetLastZoom()
/**********************************/ /**********************************/
/* ajuste le coeff de zoom au max /* ajuste le coeff de zoom au max
@ -326,7 +327,7 @@ void BASE_SCREEN::SetGrid( const wxSize& size )
/*********************************/ /*********************************/
wxSize BASE_SCREEN::GetGrid( void ) wxSize BASE_SCREEN::GetGrid()
/*********************************/ /*********************************/
{ {
wxSize grid = m_Grid; wxSize grid = m_Grid;
@ -351,7 +352,7 @@ wxSize BASE_SCREEN::GetGrid( void )
/*********************************/ /*********************************/
void BASE_SCREEN::SetNextGrid( void ) void BASE_SCREEN::SetNextGrid()
/*********************************/ /*********************************/
/* Selectionne la prochaine grille /* Selectionne la prochaine grille
@ -376,7 +377,7 @@ void BASE_SCREEN::SetNextGrid( void )
/*************************************/ /*************************************/
void BASE_SCREEN::SetPreviousGrid( void ) void BASE_SCREEN::SetPreviousGrid()
/*************************************/ /*************************************/
/* Selectionne le precedent coeff de grille /* Selectionne le precedent coeff de grille
@ -401,7 +402,7 @@ void BASE_SCREEN::SetPreviousGrid( void )
/**********************************/ /**********************************/
void BASE_SCREEN::SetFirstGrid( void ) void BASE_SCREEN::SetFirstGrid()
/**********************************/ /**********************************/
/* ajuste le coeff de grille a 1 /* ajuste le coeff de grille a 1
@ -419,7 +420,7 @@ void BASE_SCREEN::SetFirstGrid( void )
/**********************************/ /**********************************/
void BASE_SCREEN::SetLastGrid( void ) void BASE_SCREEN::SetLastGrid()
/**********************************/ /**********************************/
/* ajuste le coeff de grille au max /* ajuste le coeff de grille au max
@ -432,7 +433,7 @@ void BASE_SCREEN::SetLastGrid( void )
/*****************************************/ /*****************************************/
void BASE_SCREEN::ClearUndoRedoList( void ) void BASE_SCREEN::ClearUndoRedoList()
/*****************************************/ /*****************************************/
/* free the undo and the redo lists /* free the undo and the redo lists
@ -532,7 +533,7 @@ void BASE_SCREEN::AddItemToRedoList( EDA_BaseStruct* newitem )
/*****************************************************/ /*****************************************************/
EDA_BaseStruct* BASE_SCREEN::GetItemFromUndoList( void ) EDA_BaseStruct* BASE_SCREEN::GetItemFromUndoList()
/*****************************************************/ /*****************************************************/
{ {
EDA_BaseStruct* item = m_UndoList; EDA_BaseStruct* item = m_UndoList;
@ -544,7 +545,7 @@ EDA_BaseStruct* BASE_SCREEN::GetItemFromUndoList( void )
/******************************************************/ /******************************************************/
EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList( void ) EDA_BaseStruct* BASE_SCREEN::GetItemFromRedoList()
/******************************************************/ /******************************************************/
{ {
EDA_BaseStruct* item = m_RedoList; EDA_BaseStruct* item = m_RedoList;

View File

@ -93,7 +93,7 @@ EDA_BaseStruct::EDA_BaseStruct( KICAD_T idType )
/********************************************/ /********************************************/
void EDA_BaseStruct::InitVars( void ) void EDA_BaseStruct::InitVars()
/********************************************/ /********************************************/
{ {
m_StructType = TYPE_NOT_INIT; m_StructType = TYPE_NOT_INIT;
@ -151,7 +151,7 @@ void EDA_BaseStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& off
msg.Printf( wxT( msg.Printf( wxT(
"EDA_BaseStruct::Draw() error. Method for struct type %d used but not implemented (" ), "EDA_BaseStruct::Draw() error. Method for struct type %d used but not implemented (" ),
m_StructType ); Type() );
msg += ReturnClassName() + wxT( ")\n" ); msg += ReturnClassName() + wxT( ")\n" );
printf( CONV_TO_UTF8( msg ) ); printf( CONV_TO_UTF8( msg ) );
} }
@ -175,10 +175,10 @@ wxString EDA_BaseStruct::ReturnClassName() const
/*********************************************/ /*********************************************/
/* Used at run time for diags: return the class name of the item, /* Used at run time for diags: return the class name of the item,
* from its .m_StructType value. * from its .Type() value.
*/ */
{ {
int ii = m_StructType; int ii = Type();
wxString classname; wxString classname;
if( (ii < 0) || (ii > MAX_STRUCT_TYPE_ID) ) if( (ii < 0) || (ii > MAX_STRUCT_TYPE_ID) )
@ -218,7 +218,7 @@ SEARCH_RESULT EDA_BaseStruct::Visit( INSPECTOR* inspector, const void* testData,
for( const KICAD_T* p = scanTypes; (stype=*p) != EOT; ++p ) for( const KICAD_T* p = scanTypes; (stype=*p) != EOT; ++p )
{ {
// If caller wants to inspect my type // If caller wants to inspect my type
if( stype == m_StructType ) if( stype == Type() )
{ {
if( SEARCH_QUIT == inspector->Inspect( this, testData ) ) if( SEARCH_QUIT == inspector->Inspect( this, testData ) )
return SEARCH_QUIT; return SEARCH_QUIT;
@ -307,7 +307,7 @@ EDA_TextStruct::EDA_TextStruct( const wxString& text )
} }
EDA_TextStruct::~EDA_TextStruct( void ) EDA_TextStruct::~EDA_TextStruct()
{ {
if( m_TextDrawings ) /* pointeur sur la liste des segments de dessin */ if( m_TextDrawings ) /* pointeur sur la liste des segments de dessin */
{ {
@ -318,7 +318,7 @@ EDA_TextStruct::~EDA_TextStruct( void )
/********************************/ /********************************/
int EDA_TextStruct::Len_Size( void ) int EDA_TextStruct::Len_Size()
/********************************/ /********************************/
// Return the text lenght in internal units // Return the text lenght in internal units
@ -364,7 +364,7 @@ bool EDA_TextStruct::HitTest( const wxPoint& posref )
/*******************************/ /*******************************/
int EDA_TextStruct::Pitch( void ) int EDA_TextStruct::Pitch()
/*******************************/ /*******************************/
/* retourne le pas entre 2 caracteres /* retourne le pas entre 2 caracteres
@ -474,7 +474,7 @@ void EDA_TextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC,
/****************************************/ /****************************************/
void EDA_TextStruct::CreateDrawData( void ) void EDA_TextStruct::CreateDrawData()
/****************************************/ /****************************************/
/* Cree le tableau de donn<6E>s n<>essaire au trace d'un texte (pcb, module..) /* Cree le tableau de donn<6E>s n<>essaire au trace d'un texte (pcb, module..)
@ -683,7 +683,7 @@ void EDA_TextStruct::CreateDrawData( void )
/******************************/ /******************************/
void EDA_Rect::Normalize( void ) void EDA_Rect::Normalize()
/******************************/ /******************************/
// Ensure the height ant width are >= 0 // Ensure the height ant width are >= 0
@ -785,13 +785,13 @@ DrawPickedStruct::DrawPickedStruct( EDA_BaseStruct* pickedstruct ) :
} }
DrawPickedStruct::~DrawPickedStruct( void ) DrawPickedStruct::~DrawPickedStruct()
{ {
} }
/*********************************************/ /*********************************************/
void DrawPickedStruct::DeleteWrapperList( void ) void DrawPickedStruct::DeleteWrapperList()
/*********************************************/ /*********************************************/
/* Delete this item all the items of the linked list /* Delete this item all the items of the linked list

View File

@ -17,7 +17,7 @@
/*******************/ /*******************/
/****************************************************************************/ /****************************************************************************/
DrawBlockStruct::DrawBlockStruct( void ) : DrawBlockStruct::DrawBlockStruct() :
EDA_BaseStruct( BLOCK_LOCATE_STRUCT_TYPE ) EDA_BaseStruct( BLOCK_LOCATE_STRUCT_TYPE )
, EDA_Rect() , EDA_Rect()
/****************************************************************************/ /****************************************************************************/
@ -30,7 +30,7 @@ DrawBlockStruct::DrawBlockStruct( void ) :
/****************************************/ /****************************************/
DrawBlockStruct::~DrawBlockStruct( void ) DrawBlockStruct::~DrawBlockStruct()
/****************************************/ /****************************************/
{ {
} }
@ -219,7 +219,7 @@ void AbortBlockCurrentCommand( WinEDA_DrawPanel* Panel, wxDC* DC )
if( (screen->BlockLocate.m_Command != BLOCK_PASTE) if( (screen->BlockLocate.m_Command != BLOCK_PASTE)
&& screen->BlockLocate.m_BlockDrawStruct ) && screen->BlockLocate.m_BlockDrawStruct )
{ {
if( screen->BlockLocate.m_BlockDrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) if( screen->BlockLocate.m_BlockDrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
DrawPickedStruct* PickedList; DrawPickedStruct* PickedList;
PickedList = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct; PickedList = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct;

View File

@ -14,7 +14,7 @@
#include "build_version.h" #include "build_version.h"
/*****************************/ /*****************************/
wxString GetBuildVersion( void ) wxString GetBuildVersion()
/*****************************/ /*****************************/
/* Return the build date /* Return the build date
@ -193,7 +193,7 @@ int From_User_Unit( bool is_metric, double val, int internal_unit_value )
/**********************/ /**********************/
wxString GenDate( void ) wxString GenDate()
/**********************/ /**********************/
/* Return the string date "day month year" like "23 jun 2005" /* Return the string date "day month year" like "23 jun 2005"
@ -427,7 +427,7 @@ void AfficheDoc( WinEDA_DrawFrame* frame, const wxString& Doc, const wxString& K
/***********************/ /***********************/
int GetTimeStamp( void ) int GetTimeStamp()
/***********************/ /***********************/
/* /*

View File

@ -233,7 +233,7 @@ static int SortItems( const wxString ** ptr1, const wxString ** ptr2 )
/************************************/ /************************************/
void WinEDAListBox:: SortList( void ) void WinEDAListBox:: SortList()
/************************************/ /************************************/
{ {
int ii, NbItems = m_List->GetCount(); int ii, NbItems = m_List->GetCount();

View File

@ -312,7 +312,7 @@ wxString EDA_FileSelector( const wxString& Title, /* Dialog ti
/********************************************************/ /********************************************************/
wxString FindKicadHelpPath( void ) wxString FindKicadHelpPath()
/********************************************************/ /********************************************************/
/* Find absolute path for kicad/help (or kicad/help/<language>) */ /* Find absolute path for kicad/help (or kicad/help/<language>) */
@ -536,7 +536,7 @@ void SetRealLibraryPath( const wxString& shortlibname )
/***********************************/ /***********************************/
wxString ReturnKicadDatasPath( void ) wxString ReturnKicadDatasPath()
/***********************************/ /***********************************/
/* Retourne le chemin des donnees communes de kicad. /* Retourne le chemin des donnees communes de kicad.
@ -605,7 +605,7 @@ wxString ReturnKicadDatasPath( void )
/***************************/ /***************************/
wxString GetEditorName( void ) wxString GetEditorName()
/***************************/ /***************************/
/* Return the prefered editor name /* Return the prefered editor name

View File

@ -27,7 +27,7 @@ using namespace boost::python;
/* Common Python Binding */ /* Common Python Binding */
/*****************************************************************************/ /*****************************************************************************/
static int GetLastID( void ) { return ID_END_LIST; } static int GetLastID() { return ID_END_LIST; }
static object ChooseFile( str objTitle, str objMask, object objOpen ) static object ChooseFile( str objTitle, str objMask, object objOpen )
{ {

View File

@ -58,7 +58,7 @@ wxString msg;
PtStruct = (EDA_BaseStruct *) GenericStructure; PtStruct = (EDA_BaseStruct *) GenericStructure;
if( PtStruct == NULL) return ; if( PtStruct == NULL) return ;
typestruct = (int)PtStruct->m_StructType; typestruct = (int)PtStruct->Type();
IsDeleted = PtStruct->GetState(DELETED); IsDeleted = PtStruct->GetState(DELETED);
PtNext = PtStruct->Pnext; PtNext = PtStruct->Pnext;
@ -167,7 +167,7 @@ wxString msg;
default: default:
msg.Printf( wxT(" DeleteStructure: Type %d Inattendu"), msg.Printf( wxT(" DeleteStructure: Type %d Inattendu"),
PtStruct->m_StructType); PtStruct->Type());
DisplayError(NULL, msg); DisplayError(NULL, msg);
break; break;
} }

View File

@ -132,7 +132,7 @@ void LibEDA_BaseStruct::Display_Infos_DrawEntry( WinEDA_DrawFrame* frame )
/* affichage du type */ /* affichage du type */
msg = wxT( "??" ); msg = wxT( "??" );
switch( m_StructType ) switch( Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
msg = wxT( "Arc" ); break; msg = wxT( "Arc" ); break;

View File

@ -26,7 +26,7 @@ static bool SortByPosition = TRUE;
/**************************************/ /**************************************/
void ReAnnotatePowerSymbolsOnly( void ) void ReAnnotatePowerSymbolsOnly()
/**************************************/ /**************************************/
/* Used to reannotate the power symbols, before testing erc or computing netlist /* Used to reannotate the power symbols, before testing erc or computing netlist
when a true component reannotation is not necessary when a true component reannotation is not necessary
@ -48,7 +48,7 @@ In order to avoid conflicts the ref number start with a 0:
EDA_BaseStruct *DrawList = screen->EEDrawList; EDA_BaseStruct *DrawList = screen->EEDrawList;
for ( ; DrawList != NULL ; DrawList = DrawList->Pnext ) for ( ; DrawList != NULL ; DrawList = DrawList->Pnext )
{ {
if ( DrawList->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) if ( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
continue; continue;
EDA_SchComponentStruct * DrawLibItem = (EDA_SchComponentStruct *) DrawList; EDA_SchComponentStruct * DrawLibItem = (EDA_SchComponentStruct *) DrawList;
EDA_LibComponentStruct * Entry = EDA_LibComponentStruct * Entry =
@ -194,7 +194,7 @@ EDA_SchComponentStruct *DrawLibItem;
EDA_BaseStruct *DrawList = screen->EEDrawList; EDA_BaseStruct *DrawList = screen->EEDrawList;
for ( ; DrawList != NULL ; DrawList = DrawList->Pnext ) for ( ; DrawList != NULL ; DrawList = DrawList->Pnext )
{ {
if ( DrawList->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE ) if ( DrawList->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
{ {
DrawLibItem = (EDA_SchComponentStruct *) DrawList; DrawLibItem = (EDA_SchComponentStruct *) DrawList;
DrawLibItem->ClearAnnotation(); DrawLibItem->ClearAnnotation();
@ -224,7 +224,7 @@ EDA_LibComponentStruct *Entry;
while ( DrawList ) while ( DrawList )
{ {
switch( DrawList->m_StructType ) switch( DrawList->Type() )
{ {
case DRAW_SEGMENT_STRUCT_TYPE : case DRAW_SEGMENT_STRUCT_TYPE :
case DRAW_JUNCTION_STRUCT_TYPE : case DRAW_JUNCTION_STRUCT_TYPE :

View File

@ -371,7 +371,7 @@ void WinEDA_SchematicFrame::HandleBlockEndByPopUp( int Command, wxDC* DC )
DrawPanel->ManageCurseur( DrawPanel, DC, FALSE ); DrawPanel->ManageCurseur( DrawPanel, DC, FALSE );
if( block->m_BlockDrawStruct ) if( block->m_BlockDrawStruct )
{ {
if( block->m_BlockDrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) if( block->m_BlockDrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ /* Delete the picked wrapper if this is a picked list. */ { /* Delete the picked wrapper if this is a picked list. */
DrawPickedStruct* PickedList; DrawPickedStruct* PickedList;
PickedList = (DrawPickedStruct*) block->m_BlockDrawStruct; PickedList = (DrawPickedStruct*) block->m_BlockDrawStruct;
@ -490,7 +490,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
PtBlock->Offset( -PtBlock->m_MoveVector.x, -PtBlock->m_MoveVector.y ); PtBlock->Offset( -PtBlock->m_MoveVector.x, -PtBlock->m_MoveVector.y );
/* Effacement ancien affichage */ /* Effacement ancien affichage */
if( PtBlock->m_BlockDrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) if( PtBlock->m_BlockDrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
PickedList = (DrawPickedStruct*) PtBlock->m_BlockDrawStruct; PickedList = (DrawPickedStruct*) PtBlock->m_BlockDrawStruct;
while( PickedList ) while( PickedList )
@ -523,7 +523,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
if( PtBlock->m_BlockDrawStruct ) if( PtBlock->m_BlockDrawStruct )
{ {
if( PtBlock->m_BlockDrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) if( PtBlock->m_BlockDrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
PickedList = (DrawPickedStruct*) PtBlock->m_BlockDrawStruct; PickedList = (DrawPickedStruct*) PtBlock->m_BlockDrawStruct;
while( PickedList ) while( PickedList )
@ -558,7 +558,7 @@ bool MoveStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct )
if( !DrawStruct ) if( !DrawStruct )
return FALSE; return FALSE;
if( DrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
if( DC ) if( DC )
RedrawStructList( panel, DC, DrawStruct, g_XorMode ); RedrawStructList( panel, DC, DrawStruct, g_XorMode );
@ -613,7 +613,7 @@ void MirrorOneStruct( EDA_BaseStruct* DrawStruct, wxPoint& Center )
if( !DrawStruct ) if( !DrawStruct )
return; return;
switch( DrawStruct->m_StructType ) switch( DrawStruct->Type() )
{ {
case TYPE_NOT_INIT: case TYPE_NOT_INIT:
break; break;
@ -756,7 +756,7 @@ bool MirrorStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
if( !DrawStruct ) if( !DrawStruct )
return FALSE; return FALSE;
if( DrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
if( DC ) if( DC )
RedrawStructList( panel, DC, DrawStruct, g_XorMode ); RedrawStructList( panel, DC, DrawStruct, g_XorMode );
@ -813,14 +813,14 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
PlaceStruct( screen, NewDrawStruct ); PlaceStruct( screen, NewDrawStruct );
/* Draw the new structure and chain it in: */ /* Draw the new structure and chain it in: */
if( NewDrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) if( NewDrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
PickedList = (DrawPickedStruct*) NewDrawStruct; PickedList = (DrawPickedStruct*) NewDrawStruct;
while( PickedList ) // Clear annotation for new components while( PickedList ) // Clear annotation for new components
{ {
EDA_BaseStruct* Struct = PickedList->m_PickedStruct; EDA_BaseStruct* Struct = PickedList->m_PickedStruct;
switch( Struct->m_StructType ) switch( Struct->Type() )
{ {
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
{ {
@ -862,7 +862,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
} }
else else
{ {
switch( NewDrawStruct->m_StructType ) switch( NewDrawStruct->Type() )
{ {
case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE:
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
@ -905,7 +905,7 @@ static EDA_BaseStruct* CopyStruct( WinEDA_DrawPanel* panel, wxDC* DC, BASE_SCREE
} }
/* Free the original DrawPickedStruct chain: */ /* Free the original DrawPickedStruct chain: */
if( DrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
PickedList = (DrawPickedStruct*) DrawStruct; PickedList = (DrawPickedStruct*) DrawStruct;
PickedList->DeleteWrapperList(); PickedList->DeleteWrapperList();
@ -931,7 +931,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
return; return;
if( DrawStruct->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_SHEETLABEL_STRUCT_TYPE )
{ /* Cette stucture est rattachee a une feuille, et n'est pas { /* Cette stucture est rattachee a une feuille, et n'est pas
* accessible par la liste globale directement */ * accessible par la liste globale directement */
frame->SaveCopyInUndoList( ( (DrawSheetLabelStruct*) DrawStruct )->m_Parent, IS_CHANGED ); frame->SaveCopyInUndoList( ( (DrawSheetLabelStruct*) DrawStruct )->m_Parent, IS_CHANGED );
@ -939,7 +939,7 @@ void DeleteStruct( WinEDA_DrawPanel* panel, wxDC* DC, EDA_BaseStruct* DrawStruct
return; return;
} }
if( DrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
/* Unlink all picked structs from current EEDrawList */ /* Unlink all picked structs from current EEDrawList */
PickedList = (DrawPickedStruct*) DrawStruct; PickedList = (DrawPickedStruct*) DrawStruct;
@ -988,7 +988,7 @@ EDA_BaseStruct* SaveStructListForPaste( EDA_BaseStruct* DrawStruct )
/* Make a copy of the original picked item. */ /* Make a copy of the original picked item. */
DrawStructCopy = DuplicateStruct( DrawStruct ); DrawStructCopy = DuplicateStruct( DrawStruct );
if( DrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
/* Delete the picked wrapper if this is a picked list. */ /* Delete the picked wrapper if this is a picked list. */
PickedList = (DrawPickedStruct*) DrawStruct; PickedList = (DrawPickedStruct*) DrawStruct;
@ -1036,12 +1036,12 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
RedrawStructList( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE ); RedrawStructList( DrawPanel, DC, DrawStruct, GR_DEFAULT_DRAWMODE );
// Clear annotation and init new time stamp for the new components: // Clear annotation and init new time stamp for the new components:
if( DrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
for( PickedList = (DrawPickedStruct*) DrawStruct; PickedList != NULL; ) // Clear annotation for new components for( PickedList = (DrawPickedStruct*) DrawStruct; PickedList != NULL; ) // Clear annotation for new components
{ {
EDA_BaseStruct* Struct = PickedList->m_PickedStruct; EDA_BaseStruct* Struct = PickedList->m_PickedStruct;
if( Struct->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE ) if( Struct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
{ {
( (EDA_SchComponentStruct*) Struct )->m_TimeStamp = GetTimeStamp(); ( (EDA_SchComponentStruct*) Struct )->m_TimeStamp = GetTimeStamp();
( (EDA_SchComponentStruct*) Struct )->ClearAnnotation(); ( (EDA_SchComponentStruct*) Struct )->ClearAnnotation();
@ -1065,7 +1065,7 @@ void WinEDA_SchematicFrame::PasteStruct( wxDC* DC )
} }
else else
{ {
if( DrawStruct->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
{ {
( (EDA_SchComponentStruct*) DrawStruct )->m_TimeStamp = GetTimeStamp(); ( (EDA_SchComponentStruct*) DrawStruct )->m_TimeStamp = GetTimeStamp();
( (EDA_SchComponentStruct*) DrawStruct )->ClearAnnotation(); ( (EDA_SchComponentStruct*) DrawStruct )->ClearAnnotation();
@ -1104,7 +1104,7 @@ bool PlaceStruct( BASE_SCREEN* screen, EDA_BaseStruct* DrawStruct )
move_vector.y = screen->m_Curseur.y - move_vector.y = screen->m_Curseur.y -
screen->BlockLocate.m_BlockLastCursorPosition.y; screen->BlockLocate.m_BlockLastCursorPosition.y;
switch( DrawStruct->m_StructType ) switch( DrawStruct->Type() )
{ {
default: default:
case TYPE_NOT_INIT: case TYPE_NOT_INIT:
@ -1161,7 +1161,7 @@ void MoveOneStruct( EDA_BaseStruct* DrawStruct, const wxPoint& move_vector )
if( !DrawStruct ) if( !DrawStruct )
return; return;
switch( DrawStruct->m_StructType ) switch( DrawStruct->Type() )
{ {
case TYPE_NOT_INIT: case TYPE_NOT_INIT:
break; break;
@ -1276,7 +1276,7 @@ EDA_BaseStruct* DuplicateStruct( EDA_BaseStruct* DrawStruct )
return NULL; return NULL;
} }
switch( DrawStruct->m_StructType ) switch( DrawStruct->Type() )
{ {
case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE:
NewDrawStruct = ( (DrawPolylineStruct*) DrawStruct )->GenCopy(); NewDrawStruct = ( (DrawPolylineStruct*) DrawStruct )->GenCopy();
@ -1350,7 +1350,7 @@ EDA_BaseStruct* DuplicateStruct( EDA_BaseStruct* DrawStruct )
{ {
wxString msg; wxString msg;
msg << wxT( "DuplicateStruct error: unexpected StructType " ) << msg << wxT( "DuplicateStruct error: unexpected StructType " ) <<
DrawStruct->m_StructType << wxT( " " ) << DrawStruct->ReturnClassName(); DrawStruct->Type() << wxT( " " ) << DrawStruct->ReturnClassName();
DisplayError( NULL, msg ); DisplayError( NULL, msg );
} }
break; break;
@ -1374,10 +1374,10 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
for( Struct = screen->EEDrawList; Struct != NULL; Struct = Struct->Pnext ) for( Struct = screen->EEDrawList; Struct != NULL; Struct = Struct->Pnext )
Struct->m_Flags = 0; Struct->m_Flags = 0;
if( screen->BlockLocate.m_BlockDrawStruct->m_StructType == DRAW_SEGMENT_STRUCT_TYPE ) if( screen->BlockLocate.m_BlockDrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
screen->BlockLocate.m_BlockDrawStruct->m_Flags = SELECTED; screen->BlockLocate.m_BlockDrawStruct->m_Flags = SELECTED;
else if( screen->BlockLocate.m_BlockDrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) else if( screen->BlockLocate.m_BlockDrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
DrawStructs = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct; DrawStructs = (DrawPickedStruct*) screen->BlockLocate.m_BlockDrawStruct;
while( DrawStructs ) while( DrawStructs )
@ -1403,7 +1403,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
/* Pour Drag Block: remise sous forme de liste de structure, s'il n'y /* Pour Drag Block: remise sous forme de liste de structure, s'il n'y
* a qu'un seul element ( pour homogeneiser les traitements ulterieurs */ * a qu'un seul element ( pour homogeneiser les traitements ulterieurs */
if( screen->BlockLocate.m_BlockDrawStruct->m_StructType != DRAW_PICK_ITEM_STRUCT_TYPE ) if( screen->BlockLocate.m_BlockDrawStruct->Type() != DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
DrawStructs = new DrawPickedStruct( screen->BlockLocate.m_BlockDrawStruct ); DrawStructs = new DrawPickedStruct( screen->BlockLocate.m_BlockDrawStruct );
screen->BlockLocate.m_BlockDrawStruct = DrawStructs; screen->BlockLocate.m_BlockDrawStruct = DrawStructs;
@ -1416,7 +1416,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
{ {
Struct = DrawStructs->m_PickedStruct; Struct = DrawStructs->m_PickedStruct;
DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext; DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext;
if( Struct->m_StructType == DRAW_SEGMENT_STRUCT_TYPE ) if( Struct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
{ {
SegmStruct = (EDA_DrawLineStruct*) Struct; SegmStruct = (EDA_DrawLineStruct*) Struct;
if( (SegmStruct->m_Start.x < ox) || (SegmStruct->m_Start.x > fx) if( (SegmStruct->m_Start.x < ox) || (SegmStruct->m_Start.x > fx)
@ -1438,7 +1438,7 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
{ {
Struct = DrawStructs->m_PickedStruct; Struct = DrawStructs->m_PickedStruct;
DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext; DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext;
if( Struct->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE ) if( Struct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
{ {
LibEDA_BaseStruct* DrawItem; LibEDA_BaseStruct* DrawItem;
int x, y; int x, y;
@ -1452,18 +1452,18 @@ static void CollectStructsToDrag( SCH_SCREEN* screen )
} }
} }
if( Struct->m_StructType == DRAW_SHEET_STRUCT_TYPE ) if( Struct->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
DrawSheetLabelStruct* SLabel = ( (DrawSheetStruct*) Struct )->m_Label; DrawSheetLabelStruct* SLabel = ( (DrawSheetStruct*) Struct )->m_Label;
while( SLabel ) while( SLabel )
{ {
if( SLabel->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE ) if( SLabel->Type() == DRAW_SHEETLABEL_STRUCT_TYPE )
AddPickedItem( screen, SLabel->m_Pos.x, SLabel->m_Pos.y ); AddPickedItem( screen, SLabel->m_Pos.x, SLabel->m_Pos.y );
SLabel = (DrawSheetLabelStruct*) SLabel->Pnext; SLabel = (DrawSheetLabelStruct*) SLabel->Pnext;
} }
} }
if( Struct->m_StructType == DRAW_BUSENTRY_STRUCT_TYPE ) if( Struct->Type() == DRAW_BUSENTRY_STRUCT_TYPE )
{ {
DrawBusEntryStruct* item = (DrawBusEntryStruct*) Struct; DrawBusEntryStruct* item = (DrawBusEntryStruct*) Struct;
AddPickedItem( screen, item->m_Pos.x, item->m_Pos.y ); AddPickedItem( screen, item->m_Pos.x, item->m_Pos.y );
@ -1487,7 +1487,7 @@ static void AddPickedItem( SCH_SCREEN* screen, int px, int py )
Struct = DrawStructs->m_PickedStruct; Struct = DrawStructs->m_PickedStruct;
DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext; DrawStructs = (DrawPickedStruct*) DrawStructs->Pnext;
switch( Struct->m_StructType ) switch( Struct->Type() )
{ {
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
@ -1509,7 +1509,7 @@ static void AddPickedItem( SCH_SCREEN* screen, int px, int py )
Struct = screen->EEDrawList; Struct = screen->EEDrawList;
while( Struct ) while( Struct )
{ {
switch( Struct->m_StructType ) switch( Struct->Type() )
{ {
case TYPE_NOT_INIT: case TYPE_NOT_INIT:
break; break;
@ -1684,7 +1684,7 @@ static LibEDA_BaseStruct* GetNextPinPosition( EDA_SchComponentStruct* DrawLibIte
continue; continue;
if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) ) if( convert && DEntry->m_Convert && (DEntry->m_Convert != convert) )
continue; continue;
if( DEntry->m_StructType != COMPONENT_PIN_DRAW_TYPE ) if( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE )
continue; continue;
Pin = (LibDrawPin*) DEntry; Pin = (LibDrawPin*) DEntry;

View File

@ -81,7 +81,7 @@ int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent,
ItemIsInOtherConvert = TRUE; ItemIsInOtherConvert = TRUE;
if( ItemIsInOtherPart || ItemIsInOtherConvert ) if( ItemIsInOtherPart || ItemIsInOtherConvert )
{ {
if( item->m_StructType == COMPONENT_PIN_DRAW_TYPE ) if( item->Type() == COMPONENT_PIN_DRAW_TYPE )
{ // Specific rules for pins: { // Specific rules for pins:
if( g_EditPinByPinIsOn ) if( g_EditPinByPinIsOn )
continue; continue;
@ -94,7 +94,7 @@ int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent,
continue; continue;
} }
switch( item->m_StructType ) switch( item->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
{ {
@ -545,7 +545,7 @@ void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
if( item->m_Selected == 0 ) if( item->m_Selected == 0 )
continue; continue;
switch( item->m_StructType ) switch( item->Type() )
{ {
case COMPONENT_PIN_DRAW_TYPE: case COMPONENT_PIN_DRAW_TYPE:
( (LibDrawPin*) item )->m_Pos.x += offset.x; ( (LibDrawPin*) item )->m_Pos.x += offset.x;
@ -647,7 +647,7 @@ void MirrorMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
if( item->m_Selected == 0 ) if( item->m_Selected == 0 )
continue; continue;
switch( item->m_StructType ) switch( item->Type() )
{ {
case COMPONENT_PIN_DRAW_TYPE: case COMPONENT_PIN_DRAW_TYPE:
SETMIRROR( ( (LibDrawPin*) item )->m_Pos.x ); SETMIRROR( ( (LibDrawPin*) item )->m_Pos.x );

View File

@ -45,7 +45,7 @@ EDA_BaseStruct* SCH_SCREEN::ExtractWires( bool CreateCopy )
{ {
next_item = item->Pnext; next_item = item->Pnext;
switch( item->m_StructType ) switch( item->Type() )
{ {
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
@ -54,7 +54,7 @@ EDA_BaseStruct* SCH_SCREEN::ExtractWires( bool CreateCopy )
List = item; List = item;
if( CreateCopy ) if( CreateCopy )
{ {
if( item->m_StructType == DRAW_JUNCTION_STRUCT_TYPE ) if( item->Type() == DRAW_JUNCTION_STRUCT_TYPE )
new_item = ( (DrawJunctionStruct*) item )->GenCopy(); new_item = ( (DrawJunctionStruct*) item )->GenCopy();
else else
new_item = ( (EDA_DrawLineStruct*) item )->GenCopy(); new_item = ( (EDA_DrawLineStruct*) item )->GenCopy();
@ -85,7 +85,7 @@ static void RestoreOldWires( SCH_SCREEN* screen )
{ {
next_item = item->Pnext; next_item = item->Pnext;
switch( item->m_StructType ) switch( item->Type() )
{ {
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
@ -123,7 +123,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
if( GetScreen()->GetCurItem() ) if( GetScreen()->GetCurItem() )
{ {
switch( GetScreen()->GetCurItem()->m_StructType ) switch( GetScreen()->GetCurItem()->Type() )
{ {
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE:
@ -337,7 +337,7 @@ void WinEDA_SchematicFrame::EndSegment( wxDC* DC )
EDA_BaseStruct* item = GetScreen()->EEDrawList; EDA_BaseStruct* item = GetScreen()->EEDrawList;
while( item ) while( item )
{ {
switch( item->m_StructType ) switch( item->Type() )
{ {
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
@ -510,7 +510,7 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC )
} }
/* Trace en cours: annulation */ /* Trace en cours: annulation */
if( GetScreen()->GetCurItem()->m_StructType == DRAW_POLYLINE_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() == DRAW_POLYLINE_STRUCT_TYPE )
{ {
Show_Polyline_in_Ghost( DrawPanel, DC, FALSE ); /* Effacement du trace en cours */ Show_Polyline_in_Ghost( DrawPanel, DC, FALSE ); /* Effacement du trace en cours */
} }
@ -622,7 +622,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
if( g_ItemToRepeat == NULL ) if( g_ItemToRepeat == NULL )
return; return;
switch( g_ItemToRepeat->m_StructType ) switch( g_ItemToRepeat->Type() )
{ {
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
@ -825,7 +825,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
return TRUE; return TRUE;
item = PickStruct( pos, screen->EEDrawList, LABELITEM ); item = PickStruct( pos, screen->EEDrawList, LABELITEM );
if( item && (item->m_StructType != DRAW_TEXT_STRUCT_TYPE) if( item && (item->Type() != DRAW_TEXT_STRUCT_TYPE)
&& ( ( (DrawGlobalLabelStruct*) item )->m_Pos.x == pos.x ) && ( ( (DrawGlobalLabelStruct*) item )->m_Pos.x == pos.x )
&& ( ( (DrawGlobalLabelStruct*) item )->m_Pos.y == pos.y ) ) && ( ( (DrawGlobalLabelStruct*) item )->m_Pos.y == pos.y ) )
return TRUE; return TRUE;

View File

@ -137,7 +137,7 @@ void WinEDA_SchematicFrame::SetBusEntryShape( wxDC* DC,
if( BusEntry == NULL ) if( BusEntry == NULL )
return; return;
if( BusEntry->m_StructType != DRAW_BUSENTRY_STRUCT_TYPE ) if( BusEntry->Type() != DRAW_BUSENTRY_STRUCT_TYPE )
{ {
DisplayError( this, wxT( "SetBusEntryType: Bad StructType" ) ); DisplayError( this, wxT( "SetBusEntryType: Bad StructType" ) );
return; return;

View File

@ -34,7 +34,7 @@
/***********************************************************/ /***********************************************************/
DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) : DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
SCH_SCREEN( SCHEMATIC_FRAME ) SCH_SCREEN( DRAW_SHEET_STRUCT_TYPE )
/***********************************************************/ /***********************************************************/
{ {
m_Label = NULL; m_Label = NULL;
@ -42,8 +42,6 @@ DrawSheetStruct::DrawSheetStruct( const wxPoint& pos ) :
m_Layer = LAYER_SHEET; m_Layer = LAYER_SHEET;
m_Pos = pos; m_Pos = pos;
m_SheetNameSize = m_FileNameSize = 60; m_SheetNameSize = m_FileNameSize = 60;
/* change the struct type: SCREEN_STRUCT_TYPE to DRAW_SHEET_STRUCT_TYPE */
m_StructType = DRAW_SHEET_STRUCT_TYPE;
} }
@ -63,7 +61,7 @@ DrawSheetStruct::~DrawSheetStruct()
/***********************************************/ /***********************************************/
DrawSheetStruct* DrawSheetStruct::GenCopy( void ) DrawSheetStruct* DrawSheetStruct::GenCopy()
/***********************************************/ /***********************************************/
/* creates a copy of a sheet /* creates a copy of a sheet
@ -226,7 +224,7 @@ DrawSheetLabelStruct::DrawSheetLabelStruct( DrawSheetStruct* parent,
/***********************************************************/ /***********************************************************/
DrawSheetLabelStruct* DrawSheetLabelStruct::GenCopy( void ) DrawSheetLabelStruct* DrawSheetLabelStruct::GenCopy()
/***********************************************************/ /***********************************************************/
{ {
DrawSheetLabelStruct* newitem = DrawSheetLabelStruct* newitem =

View File

@ -17,7 +17,7 @@
void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen ) void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
/******************************************************************/ /******************************************************************/
{ {
switch( Struct->m_StructType ) switch( Struct->Type() )
{ {
case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE:
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
@ -82,7 +82,8 @@ void EDA_BaseStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
static int table_zoom[] = { 1, 2, 4, 8, 16, 32, 64, 128, 0 }; /* Valeurs standards du zoom */ static int table_zoom[] = { 1, 2, 4, 8, 16, 32, 64, 128, 0 }; /* Valeurs standards du zoom */
/* Constructeur de SCREEN */ /* Constructeur de SCREEN */
SCH_SCREEN::SCH_SCREEN( int screentype ) : BASE_SCREEN( screentype ) SCH_SCREEN::SCH_SCREEN( int screentype, KICAD_T aType ) :
BASE_SCREEN( screentype, aType )
{ {
EEDrawList = NULL; /* Schematic items list */ EEDrawList = NULL; /* Schematic items list */
m_Zoom = 32; m_Zoom = 32;
@ -94,7 +95,7 @@ SCH_SCREEN::SCH_SCREEN( int screentype ) : BASE_SCREEN( screentype )
/****************************/ /****************************/
SCH_SCREEN::~SCH_SCREEN( void ) SCH_SCREEN::~SCH_SCREEN()
/****************************/ /****************************/
{ {
ClearUndoRedoList(); ClearUndoRedoList();
@ -103,7 +104,7 @@ SCH_SCREEN::~SCH_SCREEN( void )
/***********************************/ /***********************************/
void SCH_SCREEN::FreeDrawList( void ) void SCH_SCREEN::FreeDrawList()
/***********************************/ /***********************************/
/* Routine to clear (free) EESchema drawing list of a screen. /* Routine to clear (free) EESchema drawing list of a screen.
@ -187,7 +188,7 @@ EDA_ScreenList::~EDA_ScreenList()
/*****************************************/ /*****************************************/
SCH_SCREEN* EDA_ScreenList::GetFirst( void ) SCH_SCREEN* EDA_ScreenList::GetFirst()
/*****************************************/ /*****************************************/
{ {
m_Index = 0; m_Index = 0;
@ -199,7 +200,7 @@ SCH_SCREEN* EDA_ScreenList::GetFirst( void )
/*****************************************/ /*****************************************/
SCH_SCREEN* EDA_ScreenList::GetNext( void ) SCH_SCREEN* EDA_ScreenList::GetNext()
/*****************************************/ /*****************************************/
{ {
if( m_Index < m_Count ) if( m_Index < m_Count )
@ -231,7 +232,7 @@ SCH_SCREEN* EDA_ScreenList::GetScreen( int index )
/**************************************************/ /**************************************************/
void EDA_ScreenList::UpdateSheetNumberAndDate( void ) void EDA_ScreenList::UpdateSheetNumberAndDate()
/**************************************************/ /**************************************************/
/* Update the sheet number, the sheet count and the date for all sheets in list /* Update the sheet number, the sheet count and the date for all sheets in list
@ -285,7 +286,7 @@ SCH_SCREEN** EDA_ScreenList::BuildScreenList( SCH_SCREEN** ScreenList,
CurrStruct = DrawStruct; CurrStruct = DrawStruct;
while( CurrStruct ) while( CurrStruct )
{ {
if( CurrStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE ) if( CurrStruct->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
HasSubhierarchy = TRUE; HasSubhierarchy = TRUE;
if( ScreenList ) if( ScreenList )
@ -306,7 +307,7 @@ SCH_SCREEN** EDA_ScreenList::BuildScreenList( SCH_SCREEN** ScreenList,
CurrStruct = DrawStruct; CurrStruct = DrawStruct;
while( CurrStruct ) while( CurrStruct )
{ {
if( CurrStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE ) if( CurrStruct->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
SCH_SCREEN* Screen = (SCH_SCREEN*) CurrStruct; SCH_SCREEN* Screen = (SCH_SCREEN*) CurrStruct;

View File

@ -88,10 +88,10 @@ class DrawSheetStruct;
class SCH_SCREEN : public BASE_SCREEN class SCH_SCREEN : public BASE_SCREEN
{ {
public: public:
SCH_SCREEN( int idtype ); SCH_SCREEN( int idtype, KICAD_T aType = SCREEN_STRUCT_TYPE );
~SCH_SCREEN(); ~SCH_SCREEN();
void FreeDrawList( void ); // Free EESchema drawing list (does not delete the sub hierarchies) void FreeDrawList(); // Free EESchema drawing list (does not delete the sub hierarchies)
void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { }; void Place( WinEDA_DrawFrame* frame, wxDC* DC ) { };
void RemoveFromDrawList( EDA_BaseStruct* DrawStruct );/* remove DrawStruct from EEDrawList. */ void RemoveFromDrawList( EDA_BaseStruct* DrawStruct );/* remove DrawStruct from EEDrawList. */
@ -101,7 +101,7 @@ public:
EDA_BaseStruct* ExtractWires( bool CreateCopy ); EDA_BaseStruct* ExtractWires( bool CreateCopy );
/* full undo redo management : */ /* full undo redo management : */
virtual void ClearUndoRedoList( void ); virtual void ClearUndoRedoList();
virtual void AddItemToUndoList( EDA_BaseStruct* item ); virtual void AddItemToUndoList( EDA_BaseStruct* item );
virtual void AddItemToRedoList( EDA_BaseStruct* item ); virtual void AddItemToRedoList( EDA_BaseStruct* item );
}; };
@ -119,10 +119,10 @@ public:
const wxPoint& pos = wxPoint( 0, 0 ), const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString ); const wxString& text = wxEmptyString );
~DrawSheetLabelStruct( void ) { } ~DrawSheetLabelStruct() { }
DrawSheetLabelStruct* GenCopy( void ); DrawSheetLabelStruct* GenCopy();
DrawSheetLabelStruct* Next( void ) DrawSheetLabelStruct* Next()
{ return (DrawSheetLabelStruct*) Pnext; } { return (DrawSheetLabelStruct*) Pnext; }
void Place( WinEDA_DrawFrame* frame, wxDC* DC ); void Place( WinEDA_DrawFrame* frame, wxDC* DC );
@ -147,9 +147,9 @@ public:
public: public:
DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) ); DrawSheetStruct( const wxPoint& pos = wxPoint( 0, 0 ) );
~DrawSheetStruct( void ); ~DrawSheetStruct();
void Place( WinEDA_DrawFrame* frame, wxDC* DC ); void Place( WinEDA_DrawFrame* frame, wxDC* DC );
DrawSheetStruct* GenCopy( void ); DrawSheetStruct* GenCopy();
void Display_Infos( WinEDA_DrawFrame* frame ); void Display_Infos( WinEDA_DrawFrame* frame );
void CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC ); void CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC );
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
@ -169,11 +169,11 @@ private:
public: public:
EDA_ScreenList( EDA_BaseStruct* DrawStruct ); EDA_ScreenList( EDA_BaseStruct* DrawStruct );
~EDA_ScreenList(); ~EDA_ScreenList();
int GetCount( void ) { return m_Count; } int GetCount() { return m_Count; }
SCH_SCREEN* GetFirst( void ); SCH_SCREEN* GetFirst();
SCH_SCREEN* GetNext( void ); SCH_SCREEN* GetNext();
SCH_SCREEN* GetScreen( int index ); SCH_SCREEN* GetScreen( int index );
void UpdateSheetNumberAndDate( void ); void UpdateSheetNumberAndDate();
private: private:
SCH_SCREEN** BuildScreenList( SCH_SCREEN** ScreenList, SCH_SCREEN** BuildScreenList( SCH_SCREEN** ScreenList,

View File

@ -14,16 +14,16 @@
#include "protos.h" #include "protos.h"
/************************/ /************************/
/* class DrawTextStruct */ /* class DrawTextStruct */
/* class DrawLabelStruct */ /* class DrawLabelStruct */
/* class DrawGlobalLabelStruct */ /* class DrawGlobalLabelStruct */
/************************/ /************************/
/**************************************************************************/ /**************************************************************************/
DrawTextStruct::DrawTextStruct(const wxPoint & pos, const wxString & text): DrawTextStruct::DrawTextStruct( const wxPoint& pos, const wxString& text, KICAD_T aType ) :
EDA_BaseStruct(DRAW_TEXT_STRUCT_TYPE), EDA_BaseStruct( aType ),
EDA_TextStruct(text) EDA_TextStruct( text )
/**************************************************************************/ /**************************************************************************/
{ {
m_Layer = LAYER_NOTES; m_Layer = LAYER_NOTES;
@ -32,13 +32,28 @@ DrawTextStruct::DrawTextStruct(const wxPoint & pos, const wxString & text):
m_IsDangling = FALSE; m_IsDangling = FALSE;
} }
/*********************************************/ /*********************************************/
DrawTextStruct * DrawTextStruct::GenCopy(void) DrawTextStruct* DrawTextStruct::GenCopy()
/*********************************************/ /*********************************************/
{ {
DrawTextStruct * newitem = new DrawTextStruct(m_Pos, m_Text); DrawTextStruct* newitem;
switch( Type() )
{
case DRAW_TEXT_STRUCT_TYPE:
newitem = new DrawTextStruct( m_Pos, m_Text );
break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
newitem = new DrawGlobalLabelStruct( m_Pos, m_Text );
break;
case DRAW_LABEL_STRUCT_TYPE:
newitem = new DrawLabelStruct( m_Pos, m_Text );
break;
default:
newitem = 0; // will crash below
}
newitem->m_StructType = m_StructType;
newitem->m_Layer = m_Layer; newitem->m_Layer = m_Layer;
newitem->m_Shape = m_Shape; newitem->m_Shape = m_Shape;
newitem->m_Orient = m_Orient; newitem->m_Orient = m_Orient;
@ -46,67 +61,76 @@ DrawTextStruct * newitem = new DrawTextStruct(m_Pos, m_Text);
newitem->m_Width = m_Width; newitem->m_Width = m_Width;
newitem->m_HJustify = m_HJustify; newitem->m_HJustify = m_HJustify;
newitem->m_VJustify = m_VJustify; newitem->m_VJustify = m_VJustify;
newitem->m_IsDangling = m_IsDangling ; newitem->m_IsDangling = m_IsDangling;
return newitem; return newitem;
} }
/********************************************************/ /********************************************************/
void DrawTextStruct::SwapData(DrawTextStruct * copyitem) void DrawTextStruct::SwapData( DrawTextStruct* copyitem )
/********************************************************/ /********************************************************/
{ {
EXCHG(m_Text, copyitem->m_Text); EXCHG( m_Text, copyitem->m_Text );
EXCHG(m_Pos, copyitem->m_Pos); EXCHG( m_Pos, copyitem->m_Pos );
EXCHG(m_Size, copyitem->m_Size); EXCHG( m_Size, copyitem->m_Size );
EXCHG(m_Width, copyitem->m_Width); EXCHG( m_Width, copyitem->m_Width );
EXCHG(m_Shape, copyitem->m_Shape); EXCHG( m_Shape, copyitem->m_Shape );
EXCHG(m_Orient, copyitem->m_Orient); EXCHG( m_Orient, copyitem->m_Orient );
EXCHG(m_StructType, copyitem->m_StructType);
EXCHG(m_Layer, copyitem->m_Layer); // EXCHG( m_StructType, copyitem->m_StructType );
EXCHG(m_HJustify, copyitem->m_HJustify); // how can you swap a type, it is what it was created as!
EXCHG(m_VJustify, copyitem->m_VJustify); // this is a very bad usage of m_StructType.
EXCHG(m_IsDangling, copyitem->m_IsDangling); KICAD_T aType = copyitem->Type();
copyitem->SetType( Type() );
SetType( aType );
EXCHG( m_Layer, copyitem->m_Layer );
EXCHG( m_HJustify, copyitem->m_HJustify );
EXCHG( m_VJustify, copyitem->m_VJustify );
EXCHG( m_IsDangling, copyitem->m_IsDangling );
} }
/***************************************************************/ /***************************************************************/
void DrawTextStruct::Place(WinEDA_DrawFrame * frame, wxDC * DC) void DrawTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
/***************************************************************/ /***************************************************************/
{ {
/* save old text in undo list */ /* save old text in undo list */
if ( g_ItemToUndoCopy && ((m_Flags & IS_NEW) == 0) ) if( g_ItemToUndoCopy && ( (m_Flags & IS_NEW) == 0 ) )
{ {
/* restore old values and save new ones */ /* restore old values and save new ones */
SwapData( (DrawTextStruct*)g_ItemToUndoCopy); SwapData( (DrawTextStruct*) g_ItemToUndoCopy );
/* save in undo list */ /* save in undo list */
((WinEDA_SchematicFrame*)frame)->SaveCopyInUndoList(this, IS_CHANGED); ( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( this, IS_CHANGED );
/* restore new values */ /* restore new values */
SwapData((DrawTextStruct*)g_ItemToUndoCopy); SwapData( (DrawTextStruct*) g_ItemToUndoCopy );
delete g_ItemToUndoCopy; delete g_ItemToUndoCopy;
g_ItemToUndoCopy = NULL; g_ItemToUndoCopy = NULL;
} }
EDA_BaseStruct::Place(frame, DC); EDA_BaseStruct::Place( frame, DC );
} }
/****************************************************************************/ /****************************************************************************/
DrawLabelStruct::DrawLabelStruct(const wxPoint & pos, const wxString & text): DrawLabelStruct::DrawLabelStruct( const wxPoint& pos, const wxString& text ) :
DrawTextStruct(pos, text) DrawTextStruct( pos, text, DRAW_LABEL_STRUCT_TYPE )
/****************************************************************************/ /****************************************************************************/
{ {
m_StructType = DRAW_LABEL_STRUCT_TYPE;
m_Layer = LAYER_LOCLABEL; m_Layer = LAYER_LOCLABEL;
m_IsDangling = TRUE; m_IsDangling = TRUE;
} }
/***********************************************************************************/ /***********************************************************************************/
DrawGlobalLabelStruct::DrawGlobalLabelStruct(const wxPoint & pos, const wxString & text): DrawGlobalLabelStruct::DrawGlobalLabelStruct( const wxPoint& pos, const wxString& text ) :
DrawTextStruct(pos, text) DrawTextStruct( pos, text, DRAW_GLOBAL_LABEL_STRUCT_TYPE )
/***********************************************************************************/ /***********************************************************************************/
{ {
m_StructType = DRAW_GLOBAL_LABEL_STRUCT_TYPE;
m_Layer = LAYER_GLOBLABEL; m_Layer = LAYER_GLOBLABEL;
m_Shape = NET_INPUT; m_Shape = NET_INPUT;
m_IsDangling = TRUE; m_IsDangling = TRUE;
@ -114,133 +138,144 @@ DrawGlobalLabelStruct::DrawGlobalLabelStruct(const wxPoint & pos, const wxString
/***************************************************************/ /***************************************************************/
void DrawTextStruct::Draw(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & offset, void DrawTextStruct::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color) int DrawMode, int Color )
/***************************************************************/ /***************************************************************/
/* Les textes type label ou notes peuvent avoir 4 directions, mais /* Les textes type label ou notes peuvent avoir 4 directions, mais
sont tj cadres par rapport a la 1ere lettre du texte * sont tj cadres par rapport a la 1ere lettre du texte
*/ */
{ {
switch ( m_StructType ) switch( Type() )
{ {
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
DrawAsGlobalLabel(panel, DC, offset, DrawMode, Color); DrawAsGlobalLabel( panel, DC, offset, DrawMode, Color );
break; break;
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
DrawAsLabel(panel, DC, offset, DrawMode, Color); DrawAsLabel( panel, DC, offset, DrawMode, Color );
break; break;
default: default:
DrawAsText(panel, DC, offset, DrawMode, Color); DrawAsText( panel, DC, offset, DrawMode, Color );
} }
} }
/*******************************************************************************************/ /*******************************************************************************************/
void DrawTextStruct::DrawAsText(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & offset, void DrawTextStruct::DrawAsText( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color) int DrawMode, int Color )
/*******************************************************************************************/ /*******************************************************************************************/
/* Texts type Label or Comment (text on layer "NOTE") have 4 directions, and the Text origin is the first letter /* Texts type Label or Comment (text on layer "NOTE") have 4 directions, and the Text origin is the first letter
*/ */
{ {
int color; int color;
int width = MAX(m_Width, g_DrawMinimunLineWidth); int width = MAX( m_Width, g_DrawMinimunLineWidth );
if( Color >= 0 ) color = Color; if( Color >= 0 )
else color = ReturnLayerColor(m_Layer); color = Color;
GRSetDrawMode(DC, DrawMode); else
color = ReturnLayerColor( m_Layer );
GRSetDrawMode( DC, DrawMode );
switch(m_Orient) switch( m_Orient )
{ {
case 0: /* Orientation horiz normale */ case 0: /* Orientation horiz normale */
DrawGraphicText(panel, DC, DrawGraphicText( panel, DC,
wxPoint(m_Pos.x + offset.x, m_Pos.y - TXTMARGE + offset.y), wxPoint( m_Pos.x + offset.x, m_Pos.y - TXTMARGE + offset.y ),
color, color,
m_Text, m_Orient*900, m_Size, m_Text, m_Orient * 900, m_Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, width); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_BOTTOM, width );
break; break;
case 1: /* Orientation vert UP */ case 1: /* Orientation vert UP */
DrawGraphicText(panel, DC, DrawGraphicText( panel, DC,
wxPoint(m_Pos.x - TXTMARGE + offset.x, m_Pos.y + offset.y), color, wxPoint( m_Pos.x - TXTMARGE + offset.x, m_Pos.y + offset.y ), color,
m_Text, m_Orient*900, m_Size, m_Text, m_Orient * 900, m_Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, width); GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_BOTTOM, width );
break; break;
case 2: /* Orientation horiz inverse */ case 2: /* Orientation horiz inverse */
DrawGraphicText(panel, DC, DrawGraphicText( panel, DC,
wxPoint(m_Pos.x + offset.x, m_Pos.y + TXTMARGE + offset.y), color, wxPoint( m_Pos.x + offset.x, m_Pos.y + TXTMARGE + offset.y ), color,
m_Text, m_Orient*900, m_Size, m_Text, m_Orient * 900, m_Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP, width); GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_TOP, width );
break; break;
case 3: /* Orientation vert BOTTOM */ case 3: /* Orientation vert BOTTOM */
DrawGraphicText(panel, DC, DrawGraphicText( panel, DC,
wxPoint(m_Pos.x + TXTMARGE + offset.y, m_Pos.y + offset.y), color, wxPoint( m_Pos.x + TXTMARGE + offset.y, m_Pos.y + offset.y ), color,
m_Text, m_Orient*900, m_Size, m_Text, m_Orient * 900, m_Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, width); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_TOP, width );
break; break;
} }
if ( m_IsDangling )
DrawDanglingSymbol(panel, DC, m_Pos + offset, color); if( m_IsDangling )
DrawDanglingSymbol( panel, DC, m_Pos + offset, color );
} }
/***************************************************************/ /***************************************************************/
void DrawTextStruct::DrawAsLabel(WinEDA_DrawPanel * panel,wxDC * DC, const wxPoint & offset, void DrawTextStruct::DrawAsLabel( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color) int DrawMode, int Color )
/***************************************************************/ /***************************************************************/
{ {
DrawAsText(panel, DC, offset, DrawMode, Color); DrawAsText( panel, DC, offset, DrawMode, Color );
} }
/*****************************************************************************/ /*****************************************************************************/
void DrawTextStruct::DrawAsGlobalLabel(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint& offset, void DrawTextStruct::DrawAsGlobalLabel( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color) int DrawMode, int Color )
/*****************************************************************************/ /*****************************************************************************/
/* Texts type Global Label have 4 directions, and the Text origin is the graphic icon /* Texts type Global Label have 4 directions, and the Text origin is the graphic icon
*/ */
{ {
int * Template; int* Template;
int Poly[12]; int Poly[12];
int ii, jj, imax, color, HalfSize; int ii, jj, imax, color, HalfSize;
wxSize Size = m_Size; wxSize Size = m_Size;
int width = MAX(m_Width, g_DrawMinimunLineWidth); int width = MAX( m_Width, g_DrawMinimunLineWidth );
if( Color >= 0 ) color = Color; if( Color >= 0 )
else color = ReturnLayerColor(m_Layer); color = Color;
else
color = ReturnLayerColor( m_Layer );
GRSetDrawMode(DC, DrawMode); GRSetDrawMode( DC, DrawMode );
HalfSize = Size.x / 2; ii = Size.x + TXTMARGE; HalfSize = Size.x / 2; ii = Size.x + TXTMARGE;
switch(m_Orient) switch( m_Orient )
{ {
case 0: /* Orientation horiz normale */ case 0: /* Orientation horiz normale */
DrawGraphicText(panel, DC, DrawGraphicText( panel, DC,
wxPoint(m_Pos.x - ii + offset.x, m_Pos.y + offset.y), color, wxPoint( m_Pos.x - ii + offset.x, m_Pos.y + offset.y ), color,
m_Text, TEXT_ORIENT_HORIZ, Size, m_Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width); GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, width );
break; break;
case 1: /* Orientation vert UP */ case 1: /* Orientation vert UP */
DrawGraphicText(panel, DC, DrawGraphicText( panel, DC,
wxPoint(m_Pos.x + offset.x, m_Pos.y + ii + offset.y), color, wxPoint( m_Pos.x + offset.x, m_Pos.y + ii + offset.y ), color,
m_Text, TEXT_ORIENT_VERT, Size, m_Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, width); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, width );
break; break;
case 2: /* Orientation horiz inverse */ case 2: /* Orientation horiz inverse */
DrawGraphicText(panel, DC, DrawGraphicText( panel, DC,
wxPoint(m_Pos.x + ii + offset.x, m_Pos.y + offset.y), color, wxPoint( m_Pos.x + ii + offset.x, m_Pos.y + offset.y ), color,
m_Text, TEXT_ORIENT_HORIZ, Size, m_Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, width );
break; break;
case 3: /* Orientation vert BOTTOM */ case 3: /* Orientation vert BOTTOM */
DrawGraphicText(panel, DC, DrawGraphicText( panel, DC,
wxPoint(m_Pos.x + offset.x, m_Pos.y - ii + offset.y), color, wxPoint( m_Pos.x + offset.x, m_Pos.y - ii + offset.y ), color,
m_Text, TEXT_ORIENT_VERT, Size, m_Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, width );
break; break;
} }
@ -248,7 +283,7 @@ int width = MAX(m_Width, g_DrawMinimunLineWidth);
Template = TemplateShape[m_Shape][m_Orient]; Template = TemplateShape[m_Shape][m_Orient];
imax = *Template; Template++; imax = *Template; Template++;
for ( ii = 0, jj = 0; ii < imax ; ii++ ) for( ii = 0, jj = 0; ii < imax; ii++ )
{ {
Poly[jj] = ( HalfSize * (*Template) ) + m_Pos.x + offset.x; Poly[jj] = ( HalfSize * (*Template) ) + m_Pos.x + offset.x;
jj++; Template++; jj++; Template++;
@ -257,8 +292,8 @@ int width = MAX(m_Width, g_DrawMinimunLineWidth);
} }
// GRPoly(&panel->m_ClipBox, DC, imax,Poly,1, width, color, color ); /* Polygne Rempli */ // GRPoly(&panel->m_ClipBox, DC, imax,Poly,1, width, color, color ); /* Polygne Rempli */
GRPoly(&panel->m_ClipBox, DC, imax,Poly,0, width, color, color ); /* Polygne Non Rempli */ GRPoly( &panel->m_ClipBox, DC, imax, Poly, 0, width, color, color ); /* Polygne Non Rempli */
if ( m_IsDangling ) if( m_IsDangling )
DrawDanglingSymbol(panel, DC, m_Pos + offset, color); DrawDanglingSymbol( panel, DC, m_Pos + offset, color );
} }

View File

@ -35,12 +35,12 @@ bool Modify = FALSE;
DrawList = EEDrawList; DrawList = EEDrawList;
for ( ;DrawList != NULL; DrawList = DrawList->Pnext ) for ( ;DrawList != NULL; DrawList = DrawList->Pnext )
{ {
if( DrawList->m_StructType == DRAW_SEGMENT_STRUCT_TYPE ) if( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE )
{ {
TstDrawList = DrawList->Pnext; TstDrawList = DrawList->Pnext;
while ( TstDrawList ) while ( TstDrawList )
{ {
if( TstDrawList->m_StructType == DRAW_SEGMENT_STRUCT_TYPE ) if( TstDrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE )
{ {
flag = TstAlignSegment( (EDA_DrawLineStruct*)DrawList, flag = TstAlignSegment( (EDA_DrawLineStruct*)DrawList,
(EDA_DrawLineStruct*)TstDrawList); (EDA_DrawLineStruct*)TstDrawList);
@ -82,7 +82,7 @@ EDA_BaseStruct *DrawList;
DrawList = Screen->EEDrawList; DrawList = Screen->EEDrawList;
while ( DrawList ) while ( DrawList )
{ {
switch( DrawList->m_StructType ) switch( DrawList->Type() )
{ {
case DRAW_JUNCTION_STRUCT_TYPE : case DRAW_JUNCTION_STRUCT_TYPE :
#undef STRUCT #undef STRUCT
@ -136,7 +136,7 @@ DrawPickedStruct * List = NULL;
DrawList = screen->EEDrawList; DrawList = screen->EEDrawList;
while ( DrawList ) while ( DrawList )
{ {
switch( DrawList->m_StructType ) switch( DrawList->Type() )
{ {
case DRAW_SEGMENT_STRUCT_TYPE : case DRAW_SEGMENT_STRUCT_TYPE :
segment = (EDA_DrawLineStruct*)DrawList; segment = (EDA_DrawLineStruct*)DrawList;

View File

@ -37,7 +37,7 @@ DrawBusEntryStruct::DrawBusEntryStruct( const wxPoint& pos, int shape, int id )
/*************************************/ /*************************************/
wxPoint DrawBusEntryStruct::m_End( void ) wxPoint DrawBusEntryStruct::m_End()
/*************************************/ /*************************************/
// retourne la coord de fin du raccord // retourne la coord de fin du raccord
@ -47,7 +47,7 @@ wxPoint DrawBusEntryStruct::m_End( void )
/***************************************************/ /***************************************************/
DrawBusEntryStruct* DrawBusEntryStruct::GenCopy( void ) DrawBusEntryStruct* DrawBusEntryStruct::GenCopy()
/***************************************************/ /***************************************************/
{ {
DrawBusEntryStruct* newitem = new DrawBusEntryStruct( m_Pos, 0, 0 ); DrawBusEntryStruct* newitem = new DrawBusEntryStruct( m_Pos, 0, 0 );
@ -75,7 +75,7 @@ DrawJunctionStruct::DrawJunctionStruct( const wxPoint& pos ) :
} }
DrawJunctionStruct* DrawJunctionStruct::GenCopy( void ) DrawJunctionStruct* DrawJunctionStruct::GenCopy()
{ {
DrawJunctionStruct* newitem = new DrawJunctionStruct( m_Pos ); DrawJunctionStruct* newitem = new DrawJunctionStruct( m_Pos );
@ -97,7 +97,7 @@ DrawNoConnectStruct::DrawNoConnectStruct( const wxPoint& pos ) :
} }
DrawNoConnectStruct* DrawNoConnectStruct::GenCopy( void ) DrawNoConnectStruct* DrawNoConnectStruct::GenCopy()
{ {
DrawNoConnectStruct* newitem = new DrawNoConnectStruct( m_Pos ); DrawNoConnectStruct* newitem = new DrawNoConnectStruct( m_Pos );
@ -121,12 +121,12 @@ DrawMarkerStruct::DrawMarkerStruct( const wxPoint& pos, const wxString& text ) :
} }
DrawMarkerStruct::~DrawMarkerStruct( void ) DrawMarkerStruct::~DrawMarkerStruct()
{ {
} }
DrawMarkerStruct* DrawMarkerStruct::GenCopy( void ) DrawMarkerStruct* DrawMarkerStruct::GenCopy()
{ {
DrawMarkerStruct* newitem = new DrawMarkerStruct( m_Pos, m_Comment ); DrawMarkerStruct* newitem = new DrawMarkerStruct( m_Pos, m_Comment );
@ -137,7 +137,7 @@ DrawMarkerStruct* DrawMarkerStruct::GenCopy( void )
} }
wxString DrawMarkerStruct::GetComment( void ) wxString DrawMarkerStruct::GetComment()
{ {
return m_Comment; return m_Comment;
} }
@ -175,7 +175,7 @@ EDA_DrawLineStruct::EDA_DrawLineStruct( const wxPoint& pos, int layer ) :
/***************************************************/ /***************************************************/
EDA_DrawLineStruct* EDA_DrawLineStruct::GenCopy( void ) EDA_DrawLineStruct* EDA_DrawLineStruct::GenCopy()
/***************************************************/ /***************************************************/
{ {
EDA_DrawLineStruct* newitem = new EDA_DrawLineStruct( m_Start, m_Layer ); EDA_DrawLineStruct* newitem = new EDA_DrawLineStruct( m_Start, m_Layer );
@ -234,7 +234,7 @@ DrawPolylineStruct::DrawPolylineStruct( int layer ) :
/********************************************/ /********************************************/
DrawPolylineStruct::~DrawPolylineStruct( void ) DrawPolylineStruct::~DrawPolylineStruct()
/*********************************************/ /*********************************************/
{ {
if( m_Points ) if( m_Points )
@ -243,7 +243,7 @@ DrawPolylineStruct::~DrawPolylineStruct( void )
/*****************************************************/ /*****************************************************/
DrawPolylineStruct* DrawPolylineStruct::GenCopy( void ) DrawPolylineStruct* DrawPolylineStruct::GenCopy()
/*****************************************************/ /*****************************************************/
{ {
int memsize; int memsize;

View File

@ -109,7 +109,7 @@ int ii;
/**********************************************************************/ /**********************************************************************/
EDA_Rect EDA_SchComponentStruct::GetBoundaryBox( void ) EDA_Rect EDA_SchComponentStruct::GetBoundaryBox()
/**********************************************************************/ /**********************************************************************/
{ {
EDA_LibComponentStruct * Entry = FindLibPart(m_ChipName.GetData(), wxEmptyString, FIND_ROOT); EDA_LibComponentStruct * Entry = FindLibPart(m_ChipName.GetData(), wxEmptyString, FIND_ROOT);
@ -203,7 +203,7 @@ void EDA_SchComponentStruct::Place(WinEDA_DrawFrame * frame, wxDC * DC)
{ {
/* save old text in undo list */ /* save old text in undo list */
if ( g_ItemToUndoCopy && if ( g_ItemToUndoCopy &&
(g_ItemToUndoCopy->m_StructType == m_StructType) && (g_ItemToUndoCopy->Type() == Type()) &&
((m_Flags & IS_NEW) == 0) ) ((m_Flags & IS_NEW) == 0) )
{ {
/* restore old values and save new ones */ /* restore old values and save new ones */

View File

@ -95,7 +95,7 @@ public:
wxPoint GetScreenCoord(const wxPoint & coord); wxPoint GetScreenCoord(const wxPoint & coord);
void Display_Infos(WinEDA_DrawFrame * frame); void Display_Infos(WinEDA_DrawFrame * frame);
void ClearAnnotation(void); void ClearAnnotation(void);
EDA_Rect GetBoundaryBox( void ); EDA_Rect GetBoundaryBox();
wxString ReturnFieldName(int FieldNumber); wxString ReturnFieldName(int FieldNumber);
virtual void Draw(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, int draw_mode, int Color = -1); virtual void Draw(WinEDA_DrawPanel * panel, wxDC * DC, const wxPoint & offset, int draw_mode, int Color = -1);

View File

@ -87,7 +87,7 @@ SchematicGeneralLocateAndDisplay( bool IncludePin )
return NULL; return NULL;
/* Cross probing to pcbnew if a pin or a component is found */ /* Cross probing to pcbnew if a pin or a component is found */
switch( DrawStruct->m_StructType ) switch( DrawStruct->Type() )
{ {
case COMPONENT_FIELD_DRAW_TYPE: case COMPONENT_FIELD_DRAW_TYPE:
{ {

View File

@ -106,7 +106,7 @@ void WinEDA_SchematicFrame::TestDanglingEnds( EDA_BaseStruct* DrawList, wxDC* DC
// Controle des elements // Controle des elements
for( DrawItem = DrawList; DrawItem != NULL; DrawItem = DrawItem->Pnext ) for( DrawItem = DrawList; DrawItem != NULL; DrawItem = DrawItem->Pnext )
{ {
switch( DrawItem->m_StructType ) switch( DrawItem->Type() )
{ {
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
@ -310,7 +310,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
for( DrawItem = DrawList; DrawItem != NULL; DrawItem = DrawItem->Pnext ) for( DrawItem = DrawList; DrawItem != NULL; DrawItem = DrawItem->Pnext )
{ {
switch( DrawItem->m_StructType ) switch( DrawItem->Type() )
{ {
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
break; break;
@ -402,7 +402,7 @@ DanglingEndHandle* RebuildEndList( EDA_BaseStruct* DrawList )
LibEDA_BaseStruct* DrawLibItem = Entry->m_Drawings; LibEDA_BaseStruct* DrawLibItem = Entry->m_Drawings;
for( ; DrawLibItem != NULL; DrawLibItem = DrawLibItem->Next() ) for( ; DrawLibItem != NULL; DrawLibItem = DrawLibItem->Next() )
{ {
if( DrawLibItem->m_StructType != COMPONENT_PIN_DRAW_TYPE ) if( DrawLibItem->Type() != COMPONENT_PIN_DRAW_TYPE )
continue; continue;
LibDrawPin* Pin = (LibDrawPin*) DrawLibItem; LibDrawPin* Pin = (LibDrawPin*) DrawLibItem;

View File

@ -36,7 +36,7 @@ int count = 0;
if ( Struct->m_Flags & SKIP_STRUCT ) continue; if ( Struct->m_Flags & SKIP_STRUCT ) continue;
if ( TstJunction && (Struct->m_StructType == DRAW_JUNCTION_STRUCT_TYPE) ) if ( TstJunction && (Struct->Type() == DRAW_JUNCTION_STRUCT_TYPE) )
{ {
#define JUNCTION ((DrawJunctionStruct*)Struct) #define JUNCTION ((DrawJunctionStruct*)Struct)
if ( (JUNCTION->m_Pos.x == pos.x) && (JUNCTION->m_Pos.y == pos.y) ) if ( (JUNCTION->m_Pos.x == pos.x) && (JUNCTION->m_Pos.y == pos.y) )
@ -44,7 +44,7 @@ int count = 0;
#undef JUNCTION #undef JUNCTION
} }
if ( Struct->m_StructType != DRAW_SEGMENT_STRUCT_TYPE ) continue; if ( Struct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) continue;
#define SEGM ((EDA_DrawLineStruct*)Struct) #define SEGM ((EDA_DrawLineStruct*)Struct)
if ( SEGM->IsOneEndPointAt(pos) ) count++; if ( SEGM->IsOneEndPointAt(pos) ) count++;
#undef SEGM #undef SEGM
@ -68,7 +68,7 @@ EDA_BaseStruct * Struct;
for ( Struct = ListStruct; Struct != NULL; Struct = Struct->Pnext) for ( Struct = ListStruct; Struct != NULL; Struct = Struct->Pnext)
{ {
if ( Struct->m_Flags ) continue; if ( Struct->m_Flags ) continue;
if ( Struct->m_StructType == DRAW_JUNCTION_STRUCT_TYPE ) if ( Struct->Type() == DRAW_JUNCTION_STRUCT_TYPE )
{ {
#define JUNCTION ((DrawJunctionStruct*)Struct) #define JUNCTION ((DrawJunctionStruct*)Struct)
if ( segment->IsOneEndPointAt(JUNCTION->m_Pos) ) Struct->m_Flags |= CANDIDATE; if ( segment->IsOneEndPointAt(JUNCTION->m_Pos) ) Struct->m_Flags |= CANDIDATE;
@ -76,7 +76,7 @@ EDA_BaseStruct * Struct;
#undef JUNCTION #undef JUNCTION
} }
if ( Struct->m_StructType != DRAW_SEGMENT_STRUCT_TYPE ) continue; if ( Struct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) continue;
#define SEGM ((EDA_DrawLineStruct*)Struct) #define SEGM ((EDA_DrawLineStruct*)Struct)
if ( segment->IsOneEndPointAt(SEGM->m_Start) ) if ( segment->IsOneEndPointAt(SEGM->m_Start) )
@ -142,7 +142,7 @@ DrawPickedStruct * PickedItem, *PickedList = NULL;
{ {
if ( ! (DelStruct->m_Flags & SELECTEDNODE) ) continue; if ( ! (DelStruct->m_Flags & SELECTEDNODE) ) continue;
#define SEGM ((EDA_DrawLineStruct*)DelStruct) #define SEGM ((EDA_DrawLineStruct*)DelStruct)
if ( DelStruct->m_StructType != DRAW_SEGMENT_STRUCT_TYPE ) continue; if ( DelStruct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) continue;
MarkConnected(this, GetScreen()->EEDrawList, SEGM); MarkConnected(this, GetScreen()->EEDrawList, SEGM);
#undef SEGM #undef SEGM
} }
@ -154,7 +154,7 @@ DrawPickedStruct * PickedItem, *PickedList = NULL;
if ( DelStruct->m_Flags & STRUCT_DELETED ) continue; // Already seen if ( DelStruct->m_Flags & STRUCT_DELETED ) continue; // Already seen
if ( ! (DelStruct->m_Flags & CANDIDATE) ) continue; // Already seen if ( ! (DelStruct->m_Flags & CANDIDATE) ) continue; // Already seen
if ( DelStruct->m_StructType != DRAW_SEGMENT_STRUCT_TYPE ) continue; if ( DelStruct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) continue;
DelStruct->m_Flags |= SKIP_STRUCT; DelStruct->m_Flags |= SKIP_STRUCT;
#define SEGM ((EDA_DrawLineStruct*)DelStruct) #define SEGM ((EDA_DrawLineStruct*)DelStruct)
/* Test the SEGM->m_Start point: if this point was connected to an STRUCT_DELETED wire, /* Test the SEGM->m_Start point: if this point was connected to an STRUCT_DELETED wire,
@ -163,7 +163,7 @@ DrawPickedStruct * PickedItem, *PickedList = NULL;
for ( removed_struct = GetScreen()->EEDrawList; removed_struct != NULL; removed_struct = removed_struct->Pnext) for ( removed_struct = GetScreen()->EEDrawList; removed_struct != NULL; removed_struct = removed_struct->Pnext)
{ {
if( (removed_struct->m_Flags & STRUCT_DELETED) == 0 ) continue; if( (removed_struct->m_Flags & STRUCT_DELETED) == 0 ) continue;
if ( removed_struct->m_StructType != DRAW_SEGMENT_STRUCT_TYPE ) continue; if ( removed_struct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) continue;
#define WIRE ((EDA_DrawLineStruct*)removed_struct) #define WIRE ((EDA_DrawLineStruct*)removed_struct)
if ( WIRE->IsOneEndPointAt(SEGM->m_Start) ) break; if ( WIRE->IsOneEndPointAt(SEGM->m_Start) ) break;
} }
@ -175,7 +175,7 @@ DrawPickedStruct * PickedItem, *PickedList = NULL;
for ( removed_struct = GetScreen()->EEDrawList; removed_struct != NULL; removed_struct = removed_struct->Pnext) for ( removed_struct = GetScreen()->EEDrawList; removed_struct != NULL; removed_struct = removed_struct->Pnext)
{ {
if( (removed_struct->m_Flags & STRUCT_DELETED) == 0 ) continue; if( (removed_struct->m_Flags & STRUCT_DELETED) == 0 ) continue;
if ( removed_struct->m_StructType != DRAW_SEGMENT_STRUCT_TYPE ) continue; if ( removed_struct->Type() != DRAW_SEGMENT_STRUCT_TYPE ) continue;
if ( WIRE->IsOneEndPointAt(SEGM->m_End) ) break; if ( WIRE->IsOneEndPointAt(SEGM->m_End) ) break;
} }
if ( removed_struct && ! CountConnectedItems(this, GetScreen()->EEDrawList, SEGM->m_End, TRUE) ) if ( removed_struct && ! CountConnectedItems(this, GetScreen()->EEDrawList, SEGM->m_End, TRUE) )
@ -200,7 +200,7 @@ DrawPickedStruct * PickedItem, *PickedList = NULL;
int count; int count;
if ( DelStruct->m_Flags & STRUCT_DELETED ) continue; if ( DelStruct->m_Flags & STRUCT_DELETED ) continue;
if ( ! (DelStruct->m_Flags & CANDIDATE) ) continue; if ( ! (DelStruct->m_Flags & CANDIDATE) ) continue;
if ( DelStruct->m_StructType == DRAW_JUNCTION_STRUCT_TYPE ) if ( DelStruct->Type() == DRAW_JUNCTION_STRUCT_TYPE )
{ {
#define JUNCTION ((DrawJunctionStruct*)DelStruct) #define JUNCTION ((DrawJunctionStruct*)DelStruct)
count = CountConnectedItems(this, GetScreen()->EEDrawList, JUNCTION->m_Pos, FALSE); count = CountConnectedItems(this, GetScreen()->EEDrawList, JUNCTION->m_Pos, FALSE);
@ -221,7 +221,7 @@ DrawPickedStruct * PickedItem, *PickedList = NULL;
for ( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Pnext) for ( DelStruct = GetScreen()->EEDrawList; DelStruct != NULL; DelStruct = DelStruct->Pnext)
{ {
if ( DelStruct->m_Flags & STRUCT_DELETED ) continue; if ( DelStruct->m_Flags & STRUCT_DELETED ) continue;
if ( DelStruct->m_StructType != DRAW_LABEL_STRUCT_TYPE ) continue; if ( DelStruct->Type() != DRAW_LABEL_STRUCT_TYPE ) continue;
GetScreen()->m_Curseur = ((DrawTextStruct*)DelStruct)->m_Pos; GetScreen()->m_Curseur = ((DrawTextStruct*)DelStruct)->m_Pos;
EDA_BaseStruct * TstStruct = EDA_BaseStruct * TstStruct =
PickStruct(GetScreen()->m_Curseur, GetScreen()->EEDrawList,WIREITEM|BUSITEM); PickStruct(GetScreen()->m_Curseur, GetScreen()->EEDrawList,WIREITEM|BUSITEM);
@ -328,13 +328,13 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
Screen->SetModify(); Screen->SetModify();
if (DrawStruct->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE) if (DrawStruct->Type() == DRAW_SHEETLABEL_STRUCT_TYPE)
{ /* Cette stucture est rattachee a une feuille, et n'est pas { /* Cette stucture est rattachee a une feuille, et n'est pas
accessible par la liste globale directement */ accessible par la liste globale directement */
DrawList = Screen->EEDrawList; DrawList = Screen->EEDrawList;
for ( ; DrawList != NULL; DrawList = DrawList->Pnext ) for ( ; DrawList != NULL; DrawList = DrawList->Pnext )
{ {
if(DrawList->m_StructType != DRAW_SHEET_STRUCT_TYPE) continue; if(DrawList->Type() != DRAW_SHEET_STRUCT_TYPE) continue;
/* Examen de la Sheet */ /* Examen de la Sheet */
SheetLabel = ((DrawSheetStruct *) DrawList)->m_Label; SheetLabel = ((DrawSheetStruct *) DrawList)->m_Label;
if (SheetLabel == NULL) continue; if (SheetLabel == NULL) continue;
@ -361,7 +361,7 @@ DrawSheetLabelStruct* SheetLabel, *NextLabel;
} }
if (DrawStruct->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE) if (DrawStruct->Type() == DRAW_PICK_ITEM_STRUCT_TYPE)
{ {
PickedList = (DrawPickedStruct *) DrawStruct; PickedList = (DrawPickedStruct *) DrawStruct;
while (PickedList) while (PickedList)
@ -429,7 +429,7 @@ DrawMarkerStruct * Marker;
for ( DrawStruct = screen->EEDrawList; DrawStruct != NULL; DrawStruct = NextStruct) for ( DrawStruct = screen->EEDrawList; DrawStruct != NULL; DrawStruct = NextStruct)
{ {
NextStruct = DrawStruct->Pnext; NextStruct = DrawStruct->Pnext;
if(DrawStruct->m_StructType != DRAW_MARKER_STRUCT_TYPE ) continue; if(DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE ) continue;
/* Marqueur trouve */ /* Marqueur trouve */
Marker = (DrawMarkerStruct * ) DrawStruct; Marker = (DrawMarkerStruct * ) DrawStruct;
if( Marker->m_Type != type ) continue; if( Marker->m_Type != type ) continue;

View File

@ -29,7 +29,7 @@ wxString msg;
if( FirstSheet == NULL ) return; if( FirstSheet == NULL ) return;
if( FirstSheet->m_StructType != DRAW_SHEET_STRUCT_TYPE) if( FirstSheet->Type() != DRAW_SHEET_STRUCT_TYPE)
{ {
DisplayError(NULL, DisplayError(NULL,
wxT("DeleteSubHierarchy error(): NOT a Sheet")); wxT("DeleteSubHierarchy error(): NOT a Sheet"));
@ -54,7 +54,7 @@ wxString msg;
{ {
DrawStruct = EEDrawList; DrawStruct = EEDrawList;
EEDrawList = EEDrawList->Pnext; EEDrawList = EEDrawList->Pnext;
if( DrawStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE) if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE)
{ {
DeleteSubHierarchy((DrawSheetStruct *) DrawStruct, confirm_deletion); DeleteSubHierarchy((DrawSheetStruct *) DrawStruct, confirm_deletion);
} }
@ -76,7 +76,7 @@ EDA_BaseStruct *DrawStruct;
DrawStruct = DrawList; DrawStruct = DrawList;
DrawList = DrawList->Pnext; DrawList = DrawList->Pnext;
if( DrawStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE) if( DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE)
{ {
DeleteSubHierarchy((DrawSheetStruct*) DrawStruct, confirm_deletion); DeleteSubHierarchy((DrawSheetStruct*) DrawStruct, confirm_deletion);
} }

View File

@ -641,7 +641,7 @@ BASE_SCREEN * screen;
DrawList = screen->EEDrawList; DrawList = screen->EEDrawList;
while ( DrawList ) while ( DrawList )
{ {
switch( DrawList->m_StructType ) switch( DrawList->Type() )
{ {
case DRAW_LIB_ITEM_STRUCT_TYPE : case DRAW_LIB_ITEM_STRUCT_TYPE :
@ -685,7 +685,7 @@ BASE_SCREEN * screen;
DrawList = screen->EEDrawList; DrawList = screen->EEDrawList;
while ( DrawList ) while ( DrawList )
{ {
switch( DrawList->m_StructType ) switch( DrawList->Type() )
{ {
case DRAW_GLOBAL_LABEL_STRUCT_TYPE : case DRAW_GLOBAL_LABEL_STRUCT_TYPE :
ItemCount++; ItemCount++;
@ -981,7 +981,7 @@ wxString msg;
DrawList = List[ii]; DrawList = List[ii];
if( DrawList == NULL ) continue; if( DrawList == NULL ) continue;
if( DrawList->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) continue;
DrawLibItem = (EDA_SchComponentStruct *) DrawList; DrawLibItem = (EDA_SchComponentStruct *) DrawList;
if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) continue; if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) continue;
@ -1004,7 +1004,7 @@ wxString msg;
{ {
DrawSheetStruct * sheet = (DrawSheetStruct *)(DrawLibItem->m_Parent); DrawSheetStruct * sheet = (DrawSheetStruct *)(DrawLibItem->m_Parent);
wxString sheetname; wxString sheetname;
if( sheet && sheet->m_StructType == DRAW_SHEET_STRUCT_TYPE ) if( sheet && sheet->Type() == DRAW_SHEET_STRUCT_TYPE )
sheetname = sheet->m_SheetName; sheetname = sheet->m_SheetName;
else sheetname = _("Root"); else sheetname = _("Root");
if ( CompactForm ) if ( CompactForm )
@ -1047,7 +1047,7 @@ wxString msg;
DrawList = List[ii]; DrawList = List[ii];
if( DrawList == NULL ) continue; if( DrawList == NULL ) continue;
if( DrawList->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) continue;
DrawLibItem = (EDA_SchComponentStruct *) DrawList; DrawLibItem = (EDA_SchComponentStruct *) DrawList;
if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) continue; if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) continue;

View File

@ -71,7 +71,7 @@ LibEDA_BaseStruct * CurrentItem = CurrentDrawItem;
bool show_fill_option = FALSE; bool show_fill_option = FALSE;
int fill_option = 0; int fill_option = 0;
if( CurrentItem ) if( CurrentItem )
switch(CurrentItem->m_StructType) switch(CurrentItem->Type())
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
show_fill_option = TRUE; show_fill_option = TRUE;

View File

@ -64,7 +64,7 @@ wxString msg;
Create(parent, id, caption, pos, size, style); Create(parent, id, caption, pos, size, style);
m_TextLabel->SetValue(m_CurrentText->m_Text); m_TextLabel->SetValue(m_CurrentText->m_Text);
m_TextLabel->SetFocus(); m_TextLabel->SetFocus();
switch( m_CurrentText->m_StructType ) switch( m_CurrentText->Type() )
{ {
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
SetTitle(_("Global Label properties")); SetTitle(_("Global Label properties"));
@ -187,7 +187,7 @@ void WinEDA_LabelPropertiesFrame::CreateControls()
m_TextShape->SetValidator( wxGenericValidator(& m_CurrentText->m_Shape) ); m_TextShape->SetValidator( wxGenericValidator(& m_CurrentText->m_Shape) );
////@end WinEDA_LabelPropertiesFrame content construction ////@end WinEDA_LabelPropertiesFrame content construction
if (m_CurrentText->m_StructType == DRAW_GLOBAL_LABEL_STRUCT_TYPE ) if (m_CurrentText->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE )
m_TextShape->Show(true); m_TextShape->Show(true);
} }

View File

@ -960,7 +960,7 @@ LibEDA_BaseStruct* DrawItem = NULL, * NextDrawItem;
for ( ; DrawItem != NULL; DrawItem = DrawItem->Next() ) for ( ; DrawItem != NULL; DrawItem = DrawItem->Next() )
{ {
/* Duplication des items pour autres elements */ /* Duplication des items pour autres elements */
if( DrawItem->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; if( DrawItem->Type() != COMPONENT_PIN_DRAW_TYPE ) continue;
if( DrawItem->m_Convert == 1 ) if( DrawItem->m_Convert == 1 )
{ {
if( FlagDel == 0 ) if( FlagDel == 0 )

View File

@ -44,7 +44,7 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
*/ */
{ {
parent->DrawPanel->m_IgnoreMouseEvents = TRUE; parent->DrawPanel->m_IgnoreMouseEvents = TRUE;
if( cmp->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) if( cmp->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
{ {
DisplayError( parent, DisplayError( parent,
wxT( "InstallCmpeditFrame() error: This struct is not a component" ) ); wxT( "InstallCmpeditFrame() error: This struct is not a component" ) );
@ -62,7 +62,7 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
/*****************************************************/ /*****************************************************/
void WinEDA_ComponentPropertiesFrame::InitBuffers( void ) void WinEDA_ComponentPropertiesFrame::InitBuffers()
/*****************************************************/ /*****************************************************/
/* Init the buffers to a default value, /* Init the buffers to a default value,
@ -105,7 +105,7 @@ void WinEDA_ComponentPropertiesFrame::InitBuffers( void )
/****************************************************************/ /****************************************************************/
void WinEDA_ComponentPropertiesFrame::CopyDataToPanelField( void ) void WinEDA_ComponentPropertiesFrame::CopyDataToPanelField()
/****************************************************************/ /****************************************************************/
/* Set the values displayed on the panel field according to /* Set the values displayed on the panel field according to
@ -153,7 +153,7 @@ void WinEDA_ComponentPropertiesFrame::CopyDataToPanelField( void )
/****************************************************************/ /****************************************************************/
void WinEDA_ComponentPropertiesFrame::CopyPanelFieldToData( void ) void WinEDA_ComponentPropertiesFrame::CopyPanelFieldToData()
/****************************************************************/ /****************************************************************/
/* Copy the values displayed on the panel field to the buffers according to /* Copy the values displayed on the panel field to the buffers according to
@ -172,7 +172,7 @@ void WinEDA_ComponentPropertiesFrame::CopyPanelFieldToData( void )
/*************************************************************/ /*************************************************************/
void WinEDA_ComponentPropertiesFrame::BuildPanelFields( void ) void WinEDA_ComponentPropertiesFrame::BuildPanelFields()
/*************************************************************/ /*************************************************************/
{ {
int ii, FieldId; int ii, FieldId;
@ -226,7 +226,7 @@ void WinEDA_ComponentPropertiesFrame::BuildPanelFields( void )
/**********************************************************/ /**********************************************************/
void WinEDA_ComponentPropertiesFrame::BuildPanelBasic( void ) void WinEDA_ComponentPropertiesFrame::BuildPanelBasic()
/**********************************************************/ /**********************************************************/
/* create the basic panel for component properties editing /* create the basic panel for component properties editing
@ -691,7 +691,7 @@ void PartTextStruct::Place( WinEDA_DrawFrame* frame, wxDC* DC )
EDA_SchComponentStruct* Cmp = (EDA_SchComponentStruct*) m_Parent; EDA_SchComponentStruct* Cmp = (EDA_SchComponentStruct*) m_Parent;
/* save old cmp in undo list */ /* save old cmp in undo list */
if( g_ItemToUndoCopy && ( g_ItemToUndoCopy->m_StructType == Cmp->m_StructType) ) if( g_ItemToUndoCopy && ( g_ItemToUndoCopy->Type() == Cmp->Type()) )
{ {
Cmp->SwapData( (EDA_SchComponentStruct*) g_ItemToUndoCopy ); Cmp->SwapData( (EDA_SchComponentStruct*) g_ItemToUndoCopy );
( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( Cmp, IS_CHANGED ); ( (WinEDA_SchematicFrame*) frame )->SaveCopyInUndoList( Cmp, IS_CHANGED );

View File

@ -82,7 +82,7 @@ void WinEDA_SchematicFrame::StartMoveTexte( DrawTextStruct* TextStruct, wxDC* DC
TextStruct->m_Flags |= IS_MOVED; TextStruct->m_Flags |= IS_MOVED;
switch( TextStruct->m_StructType ) switch( TextStruct->Type() )
{ {
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
@ -153,7 +153,7 @@ void WinEDA_SchematicFrame::ChangeTextOrient( DrawTextStruct* TextStruct, wxDC*
RedrawOneStruct( DrawPanel, DC, TextStruct, g_XorMode ); RedrawOneStruct( DrawPanel, DC, TextStruct, g_XorMode );
/* Rotation du texte */ /* Rotation du texte */
switch( TextStruct->m_StructType ) switch( TextStruct->Type() )
{ {
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
@ -193,10 +193,8 @@ EDA_BaseStruct* WinEDA_SchematicFrame::CreateNewText( wxDC* DC, int type )
break; break;
case LAYER_LOCLABEL: case LAYER_LOCLABEL:
{
NewText = new DrawLabelStruct( m_CurrentScreen->m_Curseur ); NewText = new DrawLabelStruct( m_CurrentScreen->m_Curseur );
NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize; NewText->m_Size.x = NewText->m_Size.y = g_DefaultTextLabelSize;
}
break; break;
case LAYER_GLOBLABEL: case LAYER_GLOBLABEL:
@ -250,7 +248,7 @@ static void ShowWhileMoving( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
RedrawOneStruct( panel, DC, TextStruct, g_XorMode ); RedrawOneStruct( panel, DC, TextStruct, g_XorMode );
/* Redessin du texte */ /* Redessin du texte */
switch( TextStruct->m_StructType ) switch( TextStruct->Type() )
{ {
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
@ -295,7 +293,7 @@ static void ExitMoveTexte( WinEDA_DrawPanel* Panel, wxDC* DC )
} }
else /* Remise a jour des anciens parametres du texte */ else /* Remise a jour des anciens parametres du texte */
{ {
switch( Struct->m_StructType ) switch( Struct->Type() )
{ {
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
@ -340,17 +338,17 @@ void WinEDA_SchematicFrame::ConvertTextType( DrawTextStruct* Text,
switch( newtype ) switch( newtype )
{ {
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
Text->m_StructType = DRAW_LABEL_STRUCT_TYPE; Text->SetType( DRAW_LABEL_STRUCT_TYPE );
Text->m_Layer = LAYER_LOCLABEL; Text->m_Layer = LAYER_LOCLABEL;
break; break;
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
Text->m_StructType = DRAW_GLOBAL_LABEL_STRUCT_TYPE; Text->SetType( DRAW_GLOBAL_LABEL_STRUCT_TYPE );
Text->m_Layer = LAYER_GLOBLABEL; Text->m_Layer = LAYER_GLOBLABEL;
break; break;
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
Text->m_StructType = DRAW_TEXT_STRUCT_TYPE; Text->SetType( DRAW_TEXT_STRUCT_TYPE );
Text->m_Layer = LAYER_NOTES; Text->m_Layer = LAYER_NOTES;
break; break;

View File

@ -86,13 +86,13 @@ public:
// Constructor and destructor // Constructor and destructor
WinEDA_ComponentPropertiesFrame( WinEDA_SchematicFrame* parent, wxPoint& pos, WinEDA_ComponentPropertiesFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
EDA_SchComponentStruct* cmp ); EDA_SchComponentStruct* cmp );
~WinEDA_ComponentPropertiesFrame( void ) ~WinEDA_ComponentPropertiesFrame()
{ {
} }
private: private:
void BuildPanelBasic( void ); void BuildPanelBasic();
void ComponentPropertiesAccept( wxCommandEvent& event ); void ComponentPropertiesAccept( wxCommandEvent& event );
void SetInitCmp( wxCommandEvent& event ); void SetInitCmp( wxCommandEvent& event );
void OnQuit( wxCommandEvent& event ); void OnQuit( wxCommandEvent& event );
@ -116,7 +116,7 @@ void InstallCmpeditFrame( WinEDA_SchematicFrame* parent, wxPoint& pos,
*/ */
{ {
parent->DrawPanel->m_IgnoreMouseEvents = TRUE; parent->DrawPanel->m_IgnoreMouseEvents = TRUE;
if( cmp->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) if( cmp->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
{ {
DisplayError( parent, DisplayError( parent,
wxT( "InstallCmpeditFrame() error: This struct is not a component" ) ); wxT( "InstallCmpeditFrame() error: This struct is not a component" ) );
@ -265,7 +265,7 @@ void WinEDA_ComponentPropertiesFrame::OnQuit( wxCommandEvent& WXUNUSED (event) )
/**********************************************************/ /**********************************************************/
void WinEDA_ComponentPropertiesFrame::BuildPanelBasic( void ) void WinEDA_ComponentPropertiesFrame::BuildPanelBasic()
/**********************************************************/ /**********************************************************/
/* create the basic panel for component properties editing /* create the basic panel for component properties editing

View File

@ -18,7 +18,7 @@
void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen ) void SetStructFather( EDA_BaseStruct* Struct, BASE_SCREEN* Screen )
/************************************************************/ /************************************************************/
{ {
switch( Struct->m_StructType ) switch( Struct->Type() )
{ {
case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE:
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
@ -86,7 +86,7 @@ SCH_SCREEN::SCH_SCREEN( EDA_BaseStruct* parent, WinEDA_DrawFrame* frame_source,
/****************************/ /****************************/
SCH_SCREEN::~SCH_SCREEN( void ) SCH_SCREEN::~SCH_SCREEN()
/****************************/ /****************************/
{ {
ClearUndoRedoList(); ClearUndoRedoList();
@ -95,7 +95,7 @@ SCH_SCREEN::~SCH_SCREEN( void )
/*************************************/ /*************************************/
SCH_SCREEN* SCH_SCREEN::GenCopy( void ) SCH_SCREEN* SCH_SCREEN::GenCopy()
/*************************************/ /*************************************/
{ {
// TODO // TODO
@ -104,7 +104,7 @@ SCH_SCREEN* SCH_SCREEN::GenCopy( void )
/***********************************/ /***********************************/
void SCH_SCREEN::FreeDrawList( void ) void SCH_SCREEN::FreeDrawList()
/***********************************/ /***********************************/
/* Routine to clear EESchema drawing list of a screen. /* Routine to clear EESchema drawing list of a screen.

View File

@ -37,7 +37,7 @@ void WinEDA_SchematicFrame::BeginSegment( wxDC* DC, int type )
if( GetScreen()->GetCurItem() ) if( GetScreen()->GetCurItem() )
{ {
switch( GetScreen()->GetCurItem()->m_StructType ) switch( GetScreen()->GetCurItem()->Type() )
{ {
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE:
@ -254,7 +254,7 @@ void WinEDA_SchematicFrame::DeleteCurrentSegment( wxDC* DC )
} }
/* Trace en cours: annulation */ /* Trace en cours: annulation */
if( GetScreen()->GetCurItem()->m_StructType == DRAW_POLYLINE_STRUCT_TYPE ) if( GetScreen()->GetCurItem()->Type() == DRAW_POLYLINE_STRUCT_TYPE )
{ {
Polyline_in_Ghost( DrawPanel, DC, FALSE ); /* Effacement du trace en cours */ Polyline_in_Ghost( DrawPanel, DC, FALSE ); /* Effacement du trace en cours */
} }
@ -353,7 +353,7 @@ void WinEDA_SchematicFrame::RepeatDrawItem( wxDC* DC )
if( g_ItemToRepeat == NULL ) if( g_ItemToRepeat == NULL )
return; return;
switch( g_ItemToRepeat->m_StructType ) switch( g_ItemToRepeat->Type() )
{ {
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
@ -534,7 +534,7 @@ static bool IsTerminalPoint( SCH_SCREEN* screen, const wxPoint& pos, int layer )
return TRUE; return TRUE;
item = PickStruct( screen, LABELITEM ); item = PickStruct( screen, LABELITEM );
if( item && (item->m_StructType != DRAW_TEXT_STRUCT_TYPE) if( item && (item->Type() != DRAW_TEXT_STRUCT_TYPE)
&& ( ( (DrawGlobalLabelStruct*) item )->m_Pos.x == pos.x ) && ( ( (DrawGlobalLabelStruct*) item )->m_Pos.x == pos.x )
&& ( ( (DrawGlobalLabelStruct*) item )->m_Pos.y == pos.y ) ) && ( ( (DrawGlobalLabelStruct*) item )->m_Pos.y == pos.y ) )
return TRUE; return TRUE;

View File

@ -48,7 +48,7 @@ static void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
int DrawMode, int Color = -1, bool DrawPinText = TRUE ); int DrawMode, int Color = -1, bool DrawPinText = TRUE );
/******************************/ /******************************/
static void CreateDummyCmp( void ) static void CreateDummyCmp()
/******************************/ /******************************/
{ {
DummyCmp = new EDA_LibComponentStruct( NULL ); DummyCmp = new EDA_LibComponentStruct( NULL );
@ -433,7 +433,7 @@ void DrawLibPartAux( WinEDA_DrawPanel* panel, wxDC* DC,
SetHightColor = (DEntry->m_Selected & IS_SELECTED) ? HIGHT_LIGHT_FLAG : 0; SetHightColor = (DEntry->m_Selected & IS_SELECTED) ? HIGHT_LIGHT_FLAG : 0;
LineWidth = MAX( DEntry->m_Width, g_DrawMinimunLineWidth ); LineWidth = MAX( DEntry->m_Width, g_DrawMinimunLineWidth );
switch( DEntry->m_StructType ) switch( DEntry->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
{ {
@ -925,7 +925,7 @@ void DrawLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC,
int LineWidth = MAX( DrawItem->m_Width, g_DrawMinimunLineWidth ); int LineWidth = MAX( DrawItem->m_Width, g_DrawMinimunLineWidth );
switch( DrawItem->m_StructType ) switch( DrawItem->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
{ {

View File

@ -237,7 +237,7 @@ void FreeCmpLibrary( wxWindow* frame, const wxString& LibName )
/******************************/ /******************************/
const wxChar** GetLibNames( void ) const wxChar** GetLibNames()
/******************************/ /******************************/
/* Routine to return pointers to all library names. /* Routine to return pointers to all library names.
@ -806,7 +806,7 @@ LibraryStruct* FindLibrary( const wxString& Name )
/***************************************************************************** /*****************************************************************************
* Routine to find the number of libraries currently loaded. * * Routine to find the number of libraries currently loaded. *
*****************************************************************************/ *****************************************************************************/
int NumOfLibraries( void ) int NumOfLibraries()
{ {
int ii; int ii;
LibraryStruct* Lib = g_LibraryList; LibraryStruct* Lib = g_LibraryList;
@ -1080,7 +1080,7 @@ static bool ReadLibEntryDateAndTime( EDA_LibComponentStruct* LibEntry, char* Lin
/*******************************************/ /*******************************************/
static int SortItemsFct( const void* ref, const void* item ); static int SortItemsFct( const void* ref, const void* item );
void EDA_LibComponentStruct::SortDrawItems( void ) void EDA_LibComponentStruct::SortDrawItems()
/*******************************************/ /*******************************************/
/* Trie les éléments graphiques d'un composant lib pour améliorer /* Trie les éléments graphiques d'un composant lib pour améliorer
@ -1130,7 +1130,7 @@ int SortItemsFct( const void* ref, const void* item )
int fill_ref = 0, fill_item = 0; int fill_ref = 0, fill_item = 0;
switch( Ref->m_StructType ) switch( Ref->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
{ {
@ -1161,15 +1161,15 @@ int SortItemsFct( const void* ref, const void* item )
} }
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
if( Item->m_StructType == COMPONENT_PIN_DRAW_TYPE ) if( Item->Type() == COMPONENT_PIN_DRAW_TYPE )
return BEFORE; return BEFORE;
if( Item->m_StructType == COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) if( Item->Type() == COMPONENT_GRAPHIC_TEXT_DRAW_TYPE )
return 0; return 0;
return 1; return 1;
break; break;
case COMPONENT_PIN_DRAW_TYPE: case COMPONENT_PIN_DRAW_TYPE:
if( Item->m_StructType == COMPONENT_PIN_DRAW_TYPE ) if( Item->Type() == COMPONENT_PIN_DRAW_TYPE )
{ {
int ii; int ii;
@ -1199,7 +1199,7 @@ int SortItemsFct( const void* ref, const void* item )
} }
/* Test de l'item */ /* Test de l'item */
switch( Item->m_StructType ) switch( Item->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
{ {

View File

@ -182,7 +182,7 @@ void LoadSubHierarchy( WinEDA_SchematicFrame* frame, EDA_BaseStruct* DrawList )
while( EEDrawList ) while( EEDrawList )
{ {
if( EEDrawList->m_StructType == DRAW_SHEET_STRUCT_TYPE ) if( EEDrawList->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
#undef STRUCT #undef STRUCT
#define STRUCT ( (DrawSheetStruct*) EEDrawList ) #define STRUCT ( (DrawSheetStruct*) EEDrawList )

View File

@ -154,7 +154,7 @@ void RedrawStructList(WinEDA_DrawPanel * panel, wxDC * DC,
{ {
while (Structs) while (Structs)
{ {
if (Structs->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE) if (Structs->Type() == DRAW_PICK_ITEM_STRUCT_TYPE)
{ {
RedrawOneStruct(panel, DC, RedrawOneStruct(panel, DC,
((DrawPickedStruct *) Structs)->m_PickedStruct, ((DrawPickedStruct *) Structs)->m_PickedStruct,
@ -353,7 +353,7 @@ int width = g_DrawMinimunLineWidth;
GRSetDrawMode(DC, DrawMode); GRSetDrawMode(DC, DrawMode);
switch (DrawStruct->m_StructType) switch (DrawStruct->Type())
{ {
case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE:
{ {

View File

@ -26,7 +26,7 @@
/* Routines locales */ /* Routines locales */
static void CreateScreens( void ); static void CreateScreens();
// Global variables // Global variables
wxString g_Main_Title( wxT( "EESchema" ) ); wxString g_Main_Title( wxT( "EESchema" ) );
@ -42,7 +42,7 @@ wxString g_Main_Title( wxT( "EESchema" ) );
// not wxApp) // not wxApp)
IMPLEMENT_APP( WinEDA_App ) IMPLEMENT_APP( WinEDA_App )
bool WinEDA_App::OnInit( void ) bool WinEDA_App::OnInit()
{ {
wxString FFileName; wxString FFileName;
@ -108,7 +108,7 @@ bool WinEDA_App::OnInit( void )
/******************************/ /******************************/
static void CreateScreens( void ) static void CreateScreens()
/******************************/ /******************************/
/* /*

View File

@ -413,7 +413,7 @@ wxClientDC dc(m_Parent->DrawPanel);
DrawStruct = m_Parent->GetScreen()->EEDrawList; DrawStruct = m_Parent->GetScreen()->EEDrawList;
for ( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for ( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
{ {
if(DrawStruct->m_StructType != DRAW_MARKER_STRUCT_TYPE ) continue; if(DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE ) continue;
/* Marqueur trouve */ /* Marqueur trouve */
Marker = (DrawMarkerStruct * ) DrawStruct; Marker = (DrawMarkerStruct * ) DrawStruct;
if( Marker->m_Type == MARQ_ERC ) if( Marker->m_Type == MARQ_ERC )
@ -693,7 +693,7 @@ wxString msg;
DrawStruct = Screen->EEDrawList; DrawStruct = Screen->EEDrawList;
for ( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext) for ( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext)
{ {
if(DrawStruct->m_StructType != DRAW_MARKER_STRUCT_TYPE ) if(DrawStruct->Type() != DRAW_MARKER_STRUCT_TYPE )
continue; continue;
/* Marqueur trouve */ /* Marqueur trouve */

View File

@ -1063,7 +1063,7 @@ LibEDA_BaseStruct* DrawItem = NULL, * NextDrawItem;
for ( ; DrawItem != NULL; DrawItem = DrawItem->Pnext ) for ( ; DrawItem != NULL; DrawItem = DrawItem->Pnext )
{ {
/* Duplication des items pour autres elements */ /* Duplication des items pour autres elements */
if( DrawItem->m_StructType != PIN_DRAW_TYPE ) continue; if( DrawItem->Type() != PIN_DRAW_TYPE ) continue;
if( DrawItem->m_Convert == 1 ) if( DrawItem->m_Convert == 1 )
{ {
if( FlagDel == 0 ) if( FlagDel == 0 )

View File

@ -128,7 +128,7 @@ int Nb = 0;
{ {
for( Phead=Window->EEDrawList; Phead != NULL; Phead=Phead->Pnext) for( Phead=Window->EEDrawList; Phead != NULL; Phead=Phead->Pnext)
{ {
if (Phead->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE) if (Phead->Type() == DRAW_LIB_ITEM_STRUCT_TYPE)
{ {
DrawPartStruct * Cmp = (DrawPartStruct *) Phead; DrawPartStruct * Cmp = (DrawPartStruct *) Phead;
if ( Cmp->m_Field[VALUE].m_Text.GetChar(0) != '#' ) Nb++; if ( Cmp->m_Field[VALUE].m_Text.GetChar(0) != '#' ) Nb++;

View File

@ -90,7 +90,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindMarker( int SearchType )
DrawList = Screen->EEDrawList; DrawList = Screen->EEDrawList;
while( DrawList && NotFound ) while( DrawList && NotFound )
{ {
if( DrawList->m_StructType == DRAW_MARKER_STRUCT_TYPE ) if( DrawList->Type() == DRAW_MARKER_STRUCT_TYPE )
{ {
Marker = (DrawMarkerStruct*) DrawList; Marker = (DrawMarkerStruct*) DrawList;
NotFound = FALSE; NotFound = FALSE;
@ -255,7 +255,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
DrawList = Screen->EEDrawList; DrawList = Screen->EEDrawList;
while( DrawList ) while( DrawList )
{ {
switch( DrawList->m_StructType ) switch( DrawList->Type() )
{ {
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
EDA_SchComponentStruct* pSch; EDA_SchComponentStruct* pSch;
@ -343,7 +343,7 @@ EDA_BaseStruct* WinEDA_SchematicFrame::FindSchematicItem(
/* If the struct found is a DRAW_LIB_ITEM_STRUCT_TYPE type, /* If the struct found is a DRAW_LIB_ITEM_STRUCT_TYPE type,
* coordinates must be computed according to its orientation matrix * coordinates must be computed according to its orientation matrix
*/ */
if( Struct->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE ) if( Struct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
{ {
EDA_SchComponentStruct* pSch = (EDA_SchComponentStruct*) Struct; EDA_SchComponentStruct* pSch = (EDA_SchComponentStruct*) Struct;

View File

@ -17,7 +17,7 @@
/* Structures pour memo et liste des elements */ /* Structures pour memo et liste des elements */
typedef struct ListLabel typedef struct ListLabel
{ {
int m_StructType; int Type();
void * m_Label; void * m_Label;
int m_SheetNumber; int m_SheetNumber;
} ListLabel; } ListLabel;
@ -318,7 +318,7 @@ BASE_SCREEN * screen = ScreenSch;
DrawList = screen->EEDrawList; DrawList = screen->EEDrawList;
while ( DrawList ) while ( DrawList )
{ {
switch( DrawList->m_StructType ) switch( DrawList->Type() )
{ {
case DRAW_LIB_ITEM_STRUCT_TYPE : case DRAW_LIB_ITEM_STRUCT_TYPE :
@ -359,12 +359,12 @@ BASE_SCREEN * screen = ScreenSch;
DrawList = screen->EEDrawList; DrawList = screen->EEDrawList;
while ( DrawList ) while ( DrawList )
{ {
switch( DrawList->m_StructType ) switch( DrawList->Type() )
{ {
case DRAW_GLOBAL_LABEL_STRUCT_TYPE : case DRAW_GLOBAL_LABEL_STRUCT_TYPE :
if( List ) if( List )
{ {
List->m_StructType = DRAW_TEXT_STRUCT_TYPE; List->Type() = DRAW_TEXT_STRUCT_TYPE;
List->m_SheetNumber = screen->m_SheetNumber; List->m_SheetNumber = screen->m_SheetNumber;
List->m_Label = DrawList; List++; List->m_Label = DrawList; List++;
} }
@ -379,7 +379,7 @@ BASE_SCREEN * screen = ScreenSch;
{ {
if ( List ) if ( List )
{ {
List->m_StructType = DRAW_SHEETLABEL_STRUCT_TYPE; List->Type() = DRAW_SHEETLABEL_STRUCT_TYPE;
List->m_SheetNumber = screen->m_SheetNumber; List->m_SheetNumber = screen->m_SheetNumber;
List->m_Label = SheetLabel; List->m_Label = SheetLabel;
List++; List++;
@ -487,12 +487,12 @@ static int ListTriGLabelByVal(ListLabel *Objet1, ListLabel *Objet2)
int ii; int ii;
const wxString * Text1, *Text2; const wxString * Text1, *Text2;
if( Objet1->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE ) if( Objet1->Type() == DRAW_SHEETLABEL_STRUCT_TYPE )
Text1 = &((DrawSheetLabelStruct *)Objet1->m_Label)->m_Text; Text1 = &((DrawSheetLabelStruct *)Objet1->m_Label)->m_Text;
else else
Text1 = &((DrawTextStruct *)Objet1->m_Label)->m_Text; Text1 = &((DrawTextStruct *)Objet1->m_Label)->m_Text;
if( Objet2->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE ) if( Objet2->Type() == DRAW_SHEETLABEL_STRUCT_TYPE )
Text2 = &((DrawSheetLabelStruct *)Objet2->m_Label)->m_Text; Text2 = &((DrawSheetLabelStruct *)Objet2->m_Label)->m_Text;
else else
Text2 = &((DrawTextStruct *)Objet2->m_Label)->m_Text; Text2 = &((DrawTextStruct *)Objet2->m_Label)->m_Text;
@ -523,12 +523,12 @@ const wxString * Text1, *Text2;
if ( ii == 0 ) if ( ii == 0 )
{ {
if( Objet1->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE ) if( Objet1->Type() == DRAW_SHEETLABEL_STRUCT_TYPE )
Text1 = &((DrawSheetLabelStruct *)Objet1->m_Label)->m_Text; Text1 = &((DrawSheetLabelStruct *)Objet1->m_Label)->m_Text;
else else
Text1 = &((DrawTextStruct *)Objet1->m_Label)->m_Text; Text1 = &((DrawTextStruct *)Objet1->m_Label)->m_Text;
if( Objet2->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE ) if( Objet2->Type() == DRAW_SHEETLABEL_STRUCT_TYPE )
Text2 = &((DrawSheetLabelStruct *)Objet2->m_Label)->m_Text; Text2 = &((DrawSheetLabelStruct *)Objet2->m_Label)->m_Text;
else else
Text2 = &((DrawTextStruct *)Objet2->m_Label)->m_Text; Text2 = &((DrawTextStruct *)Objet2->m_Label)->m_Text;
@ -590,7 +590,7 @@ wxString msg;
DrawList = List[ii]; DrawList = List[ii];
if( DrawList == NULL ) continue; if( DrawList == NULL ) continue;
if( DrawList->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) continue;
DrawLibItem = (EDA_SchComponentStruct *) DrawList; DrawLibItem = (EDA_SchComponentStruct *) DrawList;
if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) continue; if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) continue;
@ -646,7 +646,7 @@ wxString msg;
DrawList = List[ii]; DrawList = List[ii];
if( DrawList == NULL ) continue; if( DrawList == NULL ) continue;
if( DrawList->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; if( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) continue;
DrawLibItem = (EDA_SchComponentStruct *) DrawList; DrawLibItem = (EDA_SchComponentStruct *) DrawList;
if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) continue; if( DrawLibItem->m_Field[REFERENCE].m_Text[0] == '#' ) continue;
@ -689,7 +689,7 @@ wxString msg;
{ {
LabelItem = & List[ii]; LabelItem = & List[ii];
switch( LabelItem->m_StructType ) switch( LabelItem->Type() )
{ {
case DRAW_GLOBAL_LABEL_STRUCT_TYPE : case DRAW_GLOBAL_LABEL_STRUCT_TYPE :
DrawTextItem = (DrawGlobalLabelStruct *)(LabelItem->m_Label); DrawTextItem = (DrawGlobalLabelStruct *)(LabelItem->m_Label);

View File

@ -466,7 +466,7 @@ void WinEDA_SchematicFrame::StartMovePart( EDA_SchComponentStruct* Component,
{ {
if( Component == NULL ) if( Component == NULL )
return; return;
if( Component->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) if( Component->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
return; return;
if( Component->m_Flags == 0 ) if( Component->m_Flags == 0 )

View File

@ -206,7 +206,7 @@ SCH_SCREEN * Screen;
while( DrawStruct ) while( DrawStruct )
{ {
if(DrawStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE ) if(DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
#define STRUCT ((DrawSheetStruct*)DrawStruct) #define STRUCT ((DrawSheetStruct*)DrawStruct)
nbsheets++; nbsheets++;

View File

@ -190,7 +190,7 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
{ {
if( DrawStruct->m_Flags ) // Item selected and edition in progress if( DrawStruct->m_Flags ) // Item selected and edition in progress
{ {
if( DrawStruct->m_StructType == DRAW_SEGMENT_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_SEGMENT_STRUCT_TYPE )
{ {
EDA_DrawLineStruct* segment = (EDA_DrawLineStruct*) DrawStruct; EDA_DrawLineStruct* segment = (EDA_DrawLineStruct*) DrawStruct;
if( segment->m_Layer != LAYER_WIRE ) if( segment->m_Layer != LAYER_WIRE )
@ -214,13 +214,13 @@ void WinEDA_SchematicFrame::OnHotKey( wxDC* DC, int hotkey,
GetScreen()->EEDrawList, LIBITEM | TEXTITEM | LABELITEM ); GetScreen()->EEDrawList, LIBITEM | TEXTITEM | LABELITEM );
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
if( DrawStruct->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawStruct->Type() == DRAW_LIB_ITEM_STRUCT_TYPE )
DrawStruct = LocateSmallestComponent( GetScreen() ); DrawStruct = LocateSmallestComponent( GetScreen() );
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
} }
switch( DrawStruct->m_StructType ) switch( DrawStruct->Type() )
{ {
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
if( DrawStruct->m_Flags == 0 ) if( DrawStruct->m_Flags == 0 )
@ -368,7 +368,7 @@ void WinEDA_LibeditFrame::OnHotKey( wxDC* DC, int hotkey,
case HK_REPEAT_LAST: case HK_REPEAT_LAST:
if( LibItemToRepeat && (LibItemToRepeat->m_Flags == 0) if( LibItemToRepeat && (LibItemToRepeat->m_Flags == 0)
&& (LibItemToRepeat->m_StructType == COMPONENT_PIN_DRAW_TYPE) ) && (LibItemToRepeat->Type() == COMPONENT_PIN_DRAW_TYPE) )
{ {
RepeatPinItem( DC, (LibDrawPin*) LibItemToRepeat ); RepeatPinItem( DC, (LibDrawPin*) LibItemToRepeat );
} }

View File

@ -130,7 +130,7 @@ LibCmpEntry::LibCmpEntry( LibrEntryType CmpType, const wxChar* CmpName ) :
/******************************/ /******************************/
LibCmpEntry::~LibCmpEntry( void ) LibCmpEntry::~LibCmpEntry()
/******************************/ /******************************/
{ {
} }
@ -159,7 +159,7 @@ EDA_LibCmpAliasStruct:: EDA_LibCmpAliasStruct( const wxChar* CmpName,
} }
EDA_LibCmpAliasStruct::~EDA_LibCmpAliasStruct( void ) EDA_LibCmpAliasStruct::~EDA_LibCmpAliasStruct()
{ {
} }
@ -187,7 +187,7 @@ EDA_LibComponentStruct:: EDA_LibComponentStruct( const wxChar* CmpName ) :
/******************************************************/ /******************************************************/
EDA_LibComponentStruct::~EDA_LibComponentStruct( void ) EDA_LibComponentStruct::~EDA_LibComponentStruct()
/******************************************************/ /******************************************************/
{ {
LibEDA_BaseStruct* DrawItem, * NextDrawItem; LibEDA_BaseStruct* DrawItem, * NextDrawItem;
@ -247,7 +247,7 @@ EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert )
if( (Convert > 0) && (Convert != DrawEntry->m_Convert) ) if( (Convert > 0) && (Convert != DrawEntry->m_Convert) )
continue; continue;
switch( DrawEntry->m_StructType ) switch( DrawEntry->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
{ {
@ -403,13 +403,13 @@ LibDrawField::LibDrawField( int idfield ) : LibEDA_BaseStruct( COMPONENT_FIELD_D
} }
LibDrawField::~LibDrawField( void ) LibDrawField::~LibDrawField()
{ {
} }
// Creation et Duplication d'un field // Creation et Duplication d'un field
LibDrawField* LibDrawField::GenCopy( void ) LibDrawField* LibDrawField::GenCopy()
{ {
LibDrawField* newfield = new LibDrawField( m_FieldId ); LibDrawField* newfield = new LibDrawField( m_FieldId );
@ -447,7 +447,7 @@ LibEDA_BaseStruct::LibEDA_BaseStruct( KICAD_T struct_type ) :
/***************************************************************/ /***************************************************************/
LibDrawPin::LibDrawPin( void ) : LibEDA_BaseStruct( COMPONENT_PIN_DRAW_TYPE ) LibDrawPin::LibDrawPin() : LibEDA_BaseStruct( COMPONENT_PIN_DRAW_TYPE )
/***************************************************************/ /***************************************************************/
{ {
m_PinLen = 300; /* default Pin len */ m_PinLen = 300; /* default Pin len */
@ -465,7 +465,7 @@ LibDrawPin::LibDrawPin( void ) : LibEDA_BaseStruct( COMPONENT_PIN_DRAW_TYPE )
/******************************************/ /******************************************/
wxPoint LibDrawPin::ReturnPinEndPoint( void ) wxPoint LibDrawPin::ReturnPinEndPoint()
/******************************************/ /******************************************/
/* return the pin end position, for a component in normal orient /* return the pin end position, for a component in normal orient
@ -582,7 +582,7 @@ void LibDrawPin::SetPinNumFromString( wxString& buffer )
/*************************************/ /*************************************/
LibDrawPin* LibDrawPin::GenCopy( void ) LibDrawPin* LibDrawPin::GenCopy()
/*************************************/ /*************************************/
{ {
LibDrawPin* newpin = new LibDrawPin(); LibDrawPin* newpin = new LibDrawPin();
@ -608,7 +608,7 @@ LibDrawPin* LibDrawPin::GenCopy( void )
/**************************************************************/ /**************************************************************/
LibDrawArc::LibDrawArc( void ) : LibEDA_BaseStruct( COMPONENT_ARC_DRAW_TYPE ) LibDrawArc::LibDrawArc() : LibEDA_BaseStruct( COMPONENT_ARC_DRAW_TYPE )
/**************************************************************/ /**************************************************************/
{ {
m_Rayon = 0; m_Rayon = 0;
@ -619,7 +619,7 @@ LibDrawArc::LibDrawArc( void ) : LibEDA_BaseStruct( COMPONENT_ARC_DRAW_TYPE )
/************************************/ /************************************/
LibDrawArc* LibDrawArc::GenCopy( void ) LibDrawArc* LibDrawArc::GenCopy()
/************************************/ /************************************/
{ {
LibDrawArc* newitem = new LibDrawArc(); LibDrawArc* newitem = new LibDrawArc();
@ -640,7 +640,7 @@ LibDrawArc* LibDrawArc::GenCopy( void )
/**********************************************************************/ /**********************************************************************/
LibDrawCircle::LibDrawCircle( void ) : LibEDA_BaseStruct( COMPONENT_CIRCLE_DRAW_TYPE ) LibDrawCircle::LibDrawCircle() : LibEDA_BaseStruct( COMPONENT_CIRCLE_DRAW_TYPE )
/**********************************************************************/ /**********************************************************************/
{ {
m_Rayon = 0; m_Rayon = 0;
@ -649,7 +649,7 @@ LibDrawCircle::LibDrawCircle( void ) : LibEDA_BaseStruct( COMPONENT_CIRCLE_DRAW_
/*******************************************/ /*******************************************/
LibDrawCircle* LibDrawCircle::GenCopy( void ) LibDrawCircle* LibDrawCircle::GenCopy()
/*******************************************/ /*******************************************/
{ {
LibDrawCircle* newitem = new LibDrawCircle(); LibDrawCircle* newitem = new LibDrawCircle();
@ -666,7 +666,7 @@ LibDrawCircle* LibDrawCircle::GenCopy( void )
/*****************************************************************/ /*****************************************************************/
LibDrawText::LibDrawText( void ) : LibEDA_BaseStruct( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) LibDrawText::LibDrawText() : LibEDA_BaseStruct( COMPONENT_GRAPHIC_TEXT_DRAW_TYPE )
/*****************************************************************/ /*****************************************************************/
{ {
m_Horiz = TEXT_ORIENT_HORIZ; m_Horiz = TEXT_ORIENT_HORIZ;
@ -677,7 +677,7 @@ LibDrawText::LibDrawText( void ) : LibEDA_BaseStruct( COMPONENT_GRAPHIC_TEXT_DRA
/***************************************/ /***************************************/
LibDrawText* LibDrawText::GenCopy( void ) LibDrawText* LibDrawText::GenCopy()
/***************************************/ /***************************************/
{ {
LibDrawText* newitem = new LibDrawText(); LibDrawText* newitem = new LibDrawText();
@ -695,14 +695,14 @@ LibDrawText* LibDrawText::GenCopy( void )
} }
LibDrawSquare::LibDrawSquare( void ) : LibEDA_BaseStruct( COMPONENT_RECT_DRAW_TYPE ) LibDrawSquare::LibDrawSquare() : LibEDA_BaseStruct( COMPONENT_RECT_DRAW_TYPE )
{ {
m_Width = 0; m_Width = 0;
m_Fill = NO_FILL; m_Fill = NO_FILL;
} }
LibDrawSquare* LibDrawSquare::GenCopy( void ) LibDrawSquare* LibDrawSquare::GenCopy()
{ {
LibDrawSquare* newitem = new LibDrawSquare(); LibDrawSquare* newitem = new LibDrawSquare();
@ -717,13 +717,13 @@ LibDrawSquare* LibDrawSquare::GenCopy( void )
} }
LibDrawSegment::LibDrawSegment( void ) : LibEDA_BaseStruct( COMPONENT_LINE_DRAW_TYPE ) LibDrawSegment::LibDrawSegment() : LibEDA_BaseStruct( COMPONENT_LINE_DRAW_TYPE )
{ {
m_Width = 0; m_Width = 0;
} }
LibDrawSegment* LibDrawSegment::GenCopy( void ) LibDrawSegment* LibDrawSegment::GenCopy()
{ {
LibDrawSegment* newitem = new LibDrawSegment(); LibDrawSegment* newitem = new LibDrawSegment();
@ -737,7 +737,7 @@ LibDrawSegment* LibDrawSegment::GenCopy( void )
} }
LibDrawPolyline::LibDrawPolyline( void ) : LibEDA_BaseStruct( COMPONENT_POLYLINE_DRAW_TYPE ) LibDrawPolyline::LibDrawPolyline() : LibEDA_BaseStruct( COMPONENT_POLYLINE_DRAW_TYPE )
{ {
n = 0; n = 0;
PolyList = NULL; PolyList = NULL;
@ -747,7 +747,7 @@ LibDrawPolyline::LibDrawPolyline( void ) : LibEDA_BaseStruct( COMPONENT_POLYLINE
/************************************************/ /************************************************/
LibDrawPolyline* LibDrawPolyline::GenCopy( void ) LibDrawPolyline* LibDrawPolyline::GenCopy()
/************************************************/ /************************************************/
{ {
LibDrawPolyline* newitem = new LibDrawPolyline(); LibDrawPolyline* newitem = new LibDrawPolyline();

View File

@ -177,12 +177,12 @@ public:
int m_Width; /* Width of draw lines */ int m_Width; /* Width of draw lines */
public: public:
LibEDA_BaseStruct* Next( void ) LibEDA_BaseStruct* Next()
{ {
return (LibEDA_BaseStruct*) Pnext; return (LibEDA_BaseStruct*) Pnext;
} }
LibEDA_BaseStruct( KICAD_T struct_type ); LibEDA_BaseStruct( KICAD_T struct_type );
virtual ~LibEDA_BaseStruct( void ) { } virtual ~LibEDA_BaseStruct() { }
void Display_Infos_DrawEntry( WinEDA_DrawFrame* frame ); void Display_Infos_DrawEntry( WinEDA_DrawFrame* frame );
}; };
@ -203,12 +203,12 @@ public:
// short m_PinNumWidth, m_PinNameWidth; /* (Unused) Pin num and Pin name text width */ // short m_PinNumWidth, m_PinNameWidth; /* (Unused) Pin num and Pin name text width */
public: public:
LibDrawPin( void ); LibDrawPin();
~LibDrawPin( void ) { } ~LibDrawPin() { }
LibDrawPin* GenCopy( void ); LibDrawPin* GenCopy();
bool WriteDescr( FILE* File ); bool WriteDescr( FILE* File );
void Display_Infos( WinEDA_DrawFrame* frame ); void Display_Infos( WinEDA_DrawFrame* frame );
wxPoint ReturnPinEndPoint( void ); wxPoint ReturnPinEndPoint();
int ReturnPinDrawOrient( int TransMat[2][2] ); int ReturnPinDrawOrient( int TransMat[2][2] );
void ReturnPinStringNum( wxString& buffer ); void ReturnPinStringNum( wxString& buffer );
void SetPinNumFromString( wxString& buffer ); void SetPinNumFromString( wxString& buffer );
@ -234,9 +234,9 @@ public:
wxPoint m_ArcStart, m_ArcEnd; /* position des 2 extremites de l'arc en coord reelles*/ wxPoint m_ArcStart, m_ArcEnd; /* position des 2 extremites de l'arc en coord reelles*/
public: public:
LibDrawArc( void ); LibDrawArc();
~LibDrawArc( void ) { } ~LibDrawArc() { }
LibDrawArc* GenCopy( void ); LibDrawArc* GenCopy();
bool WriteDescr( FILE* File ); bool WriteDescr( FILE* File );
}; };
@ -247,9 +247,9 @@ public:
int m_Fill; int m_Fill;
public: public:
LibDrawCircle( void ); LibDrawCircle();
~LibDrawCircle( void ) { } ~LibDrawCircle() { }
LibDrawCircle* GenCopy( void ); LibDrawCircle* GenCopy();
bool WriteDescr( FILE* File ); bool WriteDescr( FILE* File );
}; };
@ -262,9 +262,9 @@ public:
wxString m_Text; wxString m_Text;
public: public:
LibDrawText( void ); LibDrawText();
~LibDrawText( void ) { } ~LibDrawText() { }
LibDrawText* GenCopy( void ); LibDrawText* GenCopy();
bool WriteDescr( FILE* File ); bool WriteDescr( FILE* File );
}; };
@ -275,9 +275,9 @@ public:
int m_Fill; int m_Fill;
public: public:
LibDrawSquare( void ); LibDrawSquare();
~LibDrawSquare( void ) { } ~LibDrawSquare() { }
LibDrawSquare* GenCopy( void ); LibDrawSquare* GenCopy();
bool WriteDescr( FILE* File ); bool WriteDescr( FILE* File );
}; };
@ -287,9 +287,9 @@ public:
wxPoint m_End; wxPoint m_End;
public: public:
LibDrawSegment( void ); LibDrawSegment();
~LibDrawSegment( void ) { } ~LibDrawSegment() { }
LibDrawSegment* GenCopy( void ); LibDrawSegment* GenCopy();
bool WriteDescr( FILE* File ); bool WriteDescr( FILE* File );
}; };
@ -300,12 +300,12 @@ public:
int m_Fill; int m_Fill;
public: public:
LibDrawPolyline( void ); LibDrawPolyline();
~LibDrawPolyline( void ) { ~LibDrawPolyline() {
if( PolyList ) if( PolyList )
free( PolyList ); free( PolyList );
} }
LibDrawPolyline* GenCopy( void ); LibDrawPolyline* GenCopy();
void AddPoint( const wxPoint& point ); void AddPoint( const wxPoint& point );
bool WriteDescr( FILE* File ); bool WriteDescr( FILE* File );
}; };
@ -327,9 +327,9 @@ public:
public: public:
LibDrawField( int idfield = 2 ); LibDrawField( int idfield = 2 );
~LibDrawField( void ); ~LibDrawField();
LibDrawField* GenCopy( void ); LibDrawField* GenCopy();
void Copy( LibDrawField* Target ); void Copy( LibDrawField* Target );
bool WriteDescr( FILE* File ); bool WriteDescr( FILE* File );
}; };
@ -349,7 +349,7 @@ public:
public: public:
LibCmpEntry( LibrEntryType CmpType, const wxChar * CmpName ); LibCmpEntry( LibrEntryType CmpType, const wxChar * CmpName );
virtual ~LibCmpEntry( void ); virtual ~LibCmpEntry();
bool WriteDescr( FILE* File ); bool WriteDescr( FILE* File );
}; };
@ -375,8 +375,8 @@ public:
EDA_LibComponentStruct( const wxChar * CmpName ); EDA_LibComponentStruct( const wxChar * CmpName );
EDA_Rect GetBoundaryBox( int Unit, int Convert );/* return Box around the part. */ EDA_Rect GetBoundaryBox( int Unit, int Convert );/* return Box around the part. */
~EDA_LibComponentStruct( void ); ~EDA_LibComponentStruct();
void SortDrawItems( void ); void SortDrawItems();
}; };
class EDA_LibCmpAliasStruct : public LibCmpEntry class EDA_LibCmpAliasStruct : public LibCmpEntry
@ -386,7 +386,7 @@ public:
public: public:
EDA_LibCmpAliasStruct( const wxChar * CmpName, const wxChar * CmpRootName ); EDA_LibCmpAliasStruct( const wxChar * CmpName, const wxChar * CmpRootName );
~EDA_LibCmpAliasStruct( void ); ~EDA_LibCmpAliasStruct();
}; };
/* Variables */ /* Variables */

View File

@ -32,7 +32,7 @@ LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
if ( DrawEntry && DrawEntry->m_Flags ) if ( DrawEntry && DrawEntry->m_Flags )
{ {
SaveCopyInUndoList(CurrentLibEntry); SaveCopyInUndoList(CurrentLibEntry);
switch (DrawEntry->m_StructType ) switch (DrawEntry->Type() )
{ {
case COMPONENT_PIN_DRAW_TYPE: case COMPONENT_PIN_DRAW_TYPE:
PlacePin(DC); PlacePin(DC);
@ -146,7 +146,7 @@ LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
break; break;
} }
SaveCopyInUndoList(CurrentLibEntry); SaveCopyInUndoList(CurrentLibEntry);
if ( DrawEntry->m_StructType == COMPONENT_PIN_DRAW_TYPE ) if ( DrawEntry->Type() == COMPONENT_PIN_DRAW_TYPE )
DeletePin(DC, CurrentLibEntry, (LibDrawPin*)DrawEntry); DeletePin(DC, CurrentLibEntry, (LibDrawPin*)DrawEntry);
else else
DeleteOneLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry,DrawEntry, TRUE); DeleteOneLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry,DrawEntry, TRUE);
@ -233,7 +233,7 @@ LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
CurrentDrawItem = DrawEntry; CurrentDrawItem = DrawEntry;
DrawPanel->m_IgnoreMouseEvents = TRUE; DrawPanel->m_IgnoreMouseEvents = TRUE;
switch ( DrawEntry->m_StructType ) switch ( DrawEntry->Type() )
{ {
case COMPONENT_PIN_DRAW_TYPE: case COMPONENT_PIN_DRAW_TYPE:
if( DrawEntry->m_Flags == 0 ) // Item localisé et non en edition: placement commande move if( DrawEntry->m_Flags == 0 ) // Item localisé et non en edition: placement commande move
@ -282,7 +282,7 @@ LibEDA_BaseStruct* DrawEntry = CurrentDrawItem;
wxString msg; wxString msg;
msg.Printf( msg.Printf(
wxT("WinEDA_LibeditFrame::OnLeftDClick Error: unknown StructType %d"), wxT("WinEDA_LibeditFrame::OnLeftDClick Error: unknown StructType %d"),
DrawEntry->m_StructType); DrawEntry->Type());
DisplayError(this, msg ); DisplayError(this, msg );
break; break;
} }

View File

@ -90,7 +90,7 @@ bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE);
CurrentDrawItem = DrawEntry; CurrentDrawItem = DrawEntry;
switch ( DrawEntry->m_StructType ) switch ( DrawEntry->Type() )
{ {
case COMPONENT_PIN_DRAW_TYPE: case COMPONENT_PIN_DRAW_TYPE:
AddMenusForPin(PopMenu, (LibDrawPin*)DrawEntry, this); AddMenusForPin(PopMenu, (LibDrawPin*)DrawEntry, this);
@ -202,7 +202,7 @@ bool BlockActive = (m_CurrentScreen->BlockLocate.m_Command != BLOCK_IDLE);
wxString msg; wxString msg;
msg.Printf( msg.Printf(
wxT("WinEDA_LibeditFrame::OnRightClick Error: unknown StructType %d"), wxT("WinEDA_LibeditFrame::OnRightClick Error: unknown StructType %d"),
DrawEntry->m_StructType); DrawEntry->Type());
DisplayError(this, msg ); DisplayError(this, msg );
CurrentDrawItem = NULL; CurrentDrawItem = NULL;
break; break;

View File

@ -1049,7 +1049,7 @@ LibEDA_BaseStruct* DrawItem = NULL, * NextDrawItem;
for ( ; DrawItem != NULL; DrawItem = DrawItem->Next() ) for ( ; DrawItem != NULL; DrawItem = DrawItem->Next() )
{ {
/* Duplication des items pour autres elements */ /* Duplication des items pour autres elements */
if( DrawItem->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; if( DrawItem->Type() != COMPONENT_PIN_DRAW_TYPE ) continue;
if( DrawItem->m_Convert == 1 ) if( DrawItem->m_Convert == 1 )
{ {
if( FlagDel == 0 ) if( FlagDel == 0 )

View File

@ -531,7 +531,7 @@ wxClientDC dc(DrawPanel);
if ( CurrentDrawItem ) if ( CurrentDrawItem )
{ {
DrawPanel->CursorOff(&dc); DrawPanel->CursorOff(&dc);
switch ( CurrentDrawItem->m_StructType ) switch ( CurrentDrawItem->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
case COMPONENT_CIRCLE_DRAW_TYPE: case COMPONENT_CIRCLE_DRAW_TYPE:
@ -568,7 +568,7 @@ wxClientDC dc(DrawPanel);
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
DrawPanel->CursorOff(&dc); DrawPanel->CursorOff(&dc);
SaveCopyInUndoList(CurrentLibEntry); SaveCopyInUndoList(CurrentLibEntry);
if ( CurrentDrawItem->m_StructType == COMPONENT_PIN_DRAW_TYPE ) if ( CurrentDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE )
{ {
DeletePin(&dc, CurrentLibEntry, (LibDrawPin*)CurrentDrawItem); DeletePin(&dc, CurrentLibEntry, (LibDrawPin*)CurrentDrawItem);
} }
@ -588,9 +588,9 @@ wxClientDC dc(DrawPanel);
case ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST: case ID_POPUP_LIBEDIT_MOVE_ITEM_REQUEST:
if ( CurrentDrawItem == NULL) break; if ( CurrentDrawItem == NULL) break;
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if ( CurrentDrawItem->m_StructType == COMPONENT_PIN_DRAW_TYPE ) if ( CurrentDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE )
StartMovePin(&dc); StartMovePin(&dc);
else if ( CurrentDrawItem->m_StructType == COMPONENT_FIELD_DRAW_TYPE ) else if ( CurrentDrawItem->Type() == COMPONENT_FIELD_DRAW_TYPE )
StartMoveField(&dc, (LibDrawField *) CurrentDrawItem); StartMoveField(&dc, (LibDrawField *) CurrentDrawItem);
else StartMoveDrawSymbol(&dc); else StartMoveDrawSymbol(&dc);
break; break;
@ -609,7 +609,7 @@ wxClientDC dc(DrawPanel);
if ( CurrentDrawItem == NULL) break; if ( CurrentDrawItem == NULL) break;
DrawPanel->CursorOff(&dc); DrawPanel->CursorOff(&dc);
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
if ( CurrentDrawItem->m_StructType == COMPONENT_FIELD_DRAW_TYPE ) if ( CurrentDrawItem->Type() == COMPONENT_FIELD_DRAW_TYPE )
{ {
SaveCopyInUndoList(CurrentLibEntry); SaveCopyInUndoList(CurrentLibEntry);
RotateField(&dc, (LibDrawField *) CurrentDrawItem); RotateField(&dc, (LibDrawField *) CurrentDrawItem);
@ -620,7 +620,7 @@ wxClientDC dc(DrawPanel);
case ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM: case ID_POPUP_LIBEDIT_FIELD_EDIT_ITEM:
if ( CurrentDrawItem == NULL) break; if ( CurrentDrawItem == NULL) break;
DrawPanel->CursorOff(&dc); DrawPanel->CursorOff(&dc);
if ( CurrentDrawItem->m_StructType == COMPONENT_FIELD_DRAW_TYPE ) if ( CurrentDrawItem->Type() == COMPONENT_FIELD_DRAW_TYPE )
{ {
EditField(&dc, (LibDrawField *) CurrentDrawItem); EditField(&dc, (LibDrawField *) CurrentDrawItem);
} }
@ -631,7 +631,7 @@ wxClientDC dc(DrawPanel);
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM: case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNAMESIZE_ITEM:
case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM: case ID_POPUP_LIBEDIT_PIN_GLOBAL_CHANGE_PINNUMSIZE_ITEM:
if ( (CurrentDrawItem == NULL) || if ( (CurrentDrawItem == NULL) ||
(CurrentDrawItem->m_StructType != COMPONENT_PIN_DRAW_TYPE) ) (CurrentDrawItem->Type() != COMPONENT_PIN_DRAW_TYPE) )
break; break;
SaveCopyInUndoList(CurrentLibEntry); SaveCopyInUndoList(CurrentLibEntry);
GlobalSetPins(&dc, (LibDrawPin *) CurrentDrawItem, id); GlobalSetPins(&dc, (LibDrawPin *) CurrentDrawItem, id);

View File

@ -202,7 +202,7 @@ int dx, dy;
if(DontSnap) if (DontSnap->m_PickedStruct == DrawList) continue; if(DontSnap) if (DontSnap->m_PickedStruct == DrawList) continue;
switch (DrawList->m_StructType) switch (DrawList->Type())
{ {
case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
@ -440,7 +440,7 @@ int dx, dy;
default: default:
{ {
wxString msg; wxString msg;
msg.Printf(wxT("SnapPoint2() error: unexpected strct type %d ("), DrawList->m_StructType); msg.Printf(wxT("SnapPoint2() error: unexpected strct type %d ("), DrawList->Type());
msg << DrawList->ReturnClassName() << wxT(")"); msg << DrawList->ReturnClassName() << wxT(")");
DisplayError(NULL, msg); DisplayError(NULL, msg);
break; break;
@ -463,7 +463,7 @@ int i, *Points, xt1, yt1, xt2, yt2, NumOfPoints2;
int dx, dy; int dx, dy;
wxString msg; wxString msg;
switch (DrawStruct->m_StructType) switch (DrawStruct->Type())
{ {
case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE:
#undef STRUCT #undef STRUCT
@ -612,7 +612,7 @@ wxString msg;
default: default:
msg.Printf( msg.Printf(
wxT("DrawStructInBox() Err: unexpected StructType %d ("), wxT("DrawStructInBox() Err: unexpected StructType %d ("),
DrawStruct->m_StructType ); DrawStruct->Type() );
msg << DrawStruct->ReturnClassName() << wxT(")"); msg << DrawStruct->ReturnClassName() << wxT(")");
DisplayError(NULL, msg ); DisplayError(NULL, msg );
break; break;
@ -750,7 +750,7 @@ int seuil;
if(Convert && DrawItem->m_Convert && (Convert != DrawItem->m_Convert) ) if(Convert && DrawItem->m_Convert && (Convert != DrawItem->m_Convert) )
continue; continue;
switch ( DrawItem->m_StructType ) switch ( DrawItem->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
{ {
@ -988,7 +988,7 @@ int x1, y1, x2, y2;
DrawItem = Entry->m_Drawings; DrawItem = Entry->m_Drawings;
for ( ; DrawItem != NULL; DrawItem = DrawItem->Next()) for ( ; DrawItem != NULL; DrawItem = DrawItem->Next())
{ {
if(DrawItem->m_StructType == COMPONENT_PIN_DRAW_TYPE) /* Pin Trouvee */ if(DrawItem->Type() == COMPONENT_PIN_DRAW_TYPE) /* Pin Trouvee */
{ {
Pin = (LibDrawPin *) DrawItem; Pin = (LibDrawPin *) DrawItem;
@ -1039,7 +1039,7 @@ int size , dy, minx, maxx;
DrawSheetLabelStruct * SheetLabel; DrawSheetLabelStruct * SheetLabel;
SheetLabel = Sheet->m_Label; SheetLabel = Sheet->m_Label;
while((SheetLabel) && (SheetLabel->m_StructType==DRAW_SHEETLABEL_STRUCT_TYPE)) while((SheetLabel) && (SheetLabel->Type()==DRAW_SHEETLABEL_STRUCT_TYPE))
{ {
size = ( SheetLabel->GetLength()+1 ) * SheetLabel->m_Size.x; size = ( SheetLabel->GetLength()+1 ) * SheetLabel->m_Size.x;
if (SheetLabel->m_Edge) size = -size ; if (SheetLabel->m_Edge) size = -size ;
@ -1067,7 +1067,7 @@ LibDrawPin * Pin = NULL;
for(DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for(DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
{ {
if( DrawStruct->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) if( DrawStruct->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
continue; continue;
LibItem = (EDA_SchComponentStruct *) DrawStruct; LibItem = (EDA_SchComponentStruct *) DrawStruct;
Entry = FindLibPart( LibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT); Entry = FindLibPart( LibItem->m_ChipName.GetData(), wxEmptyString, FIND_ROOT);
@ -1090,7 +1090,7 @@ DrawSheetLabelStruct * PinSheet = NULL;
for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for( DrawStruct = DrawList; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
{ {
if( DrawStruct->m_StructType != DRAW_SHEET_STRUCT_TYPE ) if( DrawStruct->Type() != DRAW_SHEET_STRUCT_TYPE )
continue; continue;
PinSheet = LocateSheetLabel( (DrawSheetStruct *) DrawStruct, PinSheet = LocateSheetLabel( (DrawSheetStruct *) DrawStruct,
RefPos); RefPos);

View File

@ -123,7 +123,7 @@ LibEDA_BaseStruct *DEntry;
for ( ; DrawList != NULL; DrawList = DrawList->Next() ) for ( ; DrawList != NULL; DrawList = DrawList->Next() )
{ {
if ( DrawList->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) continue; if ( DrawList->Type() != DRAW_LIB_ITEM_STRUCT_TYPE ) continue;
Component = (EDA_SchComponentStruct *) DrawList; Component = (EDA_SchComponentStruct *) DrawList;
/* already tested ? : */ /* already tested ? : */
@ -145,7 +145,7 @@ LibEDA_BaseStruct *DEntry;
DEntry = Entry->m_Drawings; DEntry = Entry->m_Drawings;
for ( ;DEntry != NULL; DEntry = DEntry->Next()) for ( ;DEntry != NULL; DEntry = DEntry->Next())
{ {
if ( DEntry->m_StructType != COMPONENT_PIN_DRAW_TYPE) continue; if ( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE) continue;
if( DEntry->m_Unit && if( DEntry->m_Unit &&
(DEntry->m_Unit != Component->m_Multi) ) continue; (DEntry->m_Unit != Component->m_Multi) ) continue;
if( DEntry->m_Convert && if( DEntry->m_Convert &&
@ -336,7 +336,7 @@ EDA_BaseStruct *DrawList;
DrawList = screen->EEDrawList; DrawList = screen->EEDrawList;
while ( DrawList ) while ( DrawList )
{ {
if( DrawList->m_StructType == DRAW_LIB_ITEM_STRUCT_TYPE) if( DrawList->Type() == DRAW_LIB_ITEM_STRUCT_TYPE)
{ {
EDA_SchComponentStruct * Component = (EDA_SchComponentStruct *) DrawList; EDA_SchComponentStruct * Component = (EDA_SchComponentStruct *) DrawList;
Component->m_FlagControlMulti = 0; Component->m_FlagControlMulti = 0;
@ -384,7 +384,7 @@ wxChar bufnum[BUFYPOS_LEN+1];
for ( DrawList = screen->EEDrawList; DrawList != NULL; DrawList = DrawList->Pnext ) for ( DrawList = screen->EEDrawList; DrawList != NULL; DrawList = DrawList->Pnext )
{ {
wxChar ident; wxChar ident;
if ( DrawList->m_StructType != DRAW_TEXT_STRUCT_TYPE ) continue; if ( DrawList->Type() != DRAW_TEXT_STRUCT_TYPE ) continue;
#define DRAWTEXT ((DrawTextStruct *) DrawList) #define DRAWTEXT ((DrawTextStruct *) DrawList)
text = DRAWTEXT->m_Text; if ( text.IsEmpty() ) continue; text = DRAWTEXT->m_Text; if ( text.IsEmpty() ) continue;
ident = text.GetChar(0); ident = text.GetChar(0);
@ -685,7 +685,7 @@ SCH_SCREEN * screen;
DrawList = screen->EEDrawList; DrawList = screen->EEDrawList;
while ( DrawList ) while ( DrawList )
{ {
switch( DrawList->m_StructType ) switch( DrawList->Type() )
{ {
case DRAW_LIB_ITEM_STRUCT_TYPE : case DRAW_LIB_ITEM_STRUCT_TYPE :
Component2 = (EDA_SchComponentStruct *) DrawList; Component2 = (EDA_SchComponentStruct *) DrawList;
@ -705,7 +705,7 @@ SCH_SCREEN * screen;
DEntry = Entry->m_Drawings; DEntry = Entry->m_Drawings;
for ( ;DEntry != NULL; DEntry = DEntry->Next()) for ( ;DEntry != NULL; DEntry = DEntry->Next())
{ {
if ( DEntry->m_StructType != COMPONENT_PIN_DRAW_TYPE) continue; if ( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE) continue;
if( DEntry->m_Unit && if( DEntry->m_Unit &&
(DEntry->m_Unit != Component2->m_Multi) ) continue; (DEntry->m_Unit != Component2->m_Multi) ) continue;
if( DEntry->m_Convert && if( DEntry->m_Convert &&

View File

@ -353,7 +353,7 @@ int NumInclude;
while ( DrawList ) while ( DrawList )
{ {
switch( DrawList->m_StructType ) switch( DrawList->Type() )
{ {
case DRAW_SEGMENT_STRUCT_TYPE : case DRAW_SEGMENT_STRUCT_TYPE :
#undef STRUCT #undef STRUCT
@ -465,7 +465,7 @@ int NumInclude;
for ( ;DEntry != NULL; DEntry = DEntry->Next()) for ( ;DEntry != NULL; DEntry = DEntry->Next())
{ {
LibDrawPin * Pin = (LibDrawPin *) DEntry; LibDrawPin * Pin = (LibDrawPin *) DEntry;
if( DEntry->m_StructType != COMPONENT_PIN_DRAW_TYPE) continue; if( DEntry->Type() != COMPONENT_PIN_DRAW_TYPE) continue;
if( DEntry->m_Unit && if( DEntry->m_Unit &&
(DEntry->m_Unit != DrawLibItem->m_Multi) ) continue; (DEntry->m_Unit != DrawLibItem->m_Multi) ) continue;
if( DEntry->m_Convert && if( DEntry->m_Convert &&
@ -555,7 +555,7 @@ int NumInclude;
{ {
wxString msg; wxString msg;
msg.Printf( wxT("Netlist: unexpected type struct %d"), msg.Printf( wxT("Netlist: unexpected type struct %d"),
DrawList->m_StructType); DrawList->Type());
DisplayError(frame, msg); DisplayError(frame, msg);
break; break;
} }

View File

@ -35,7 +35,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours if( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours
{ {
switch( DrawStruct->m_StructType ) switch( DrawStruct->Type() )
{ {
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
@ -86,7 +86,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( DrawStruct && DrawStruct->m_Flags ) if( DrawStruct && DrawStruct->m_Flags )
break; break;
DrawStruct = SchematicGeneralLocateAndDisplay(); DrawStruct = SchematicGeneralLocateAndDisplay();
if( DrawStruct && (DrawStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE) ) if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
{ {
InstallNextScreen( (DrawSheetStruct*) DrawStruct ); InstallNextScreen( (DrawSheetStruct*) DrawStruct );
} }
@ -229,7 +229,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
if( (DrawStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE) if( (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE)
&& (DrawStruct->m_Flags == 0) ) && (DrawStruct->m_Flags == 0) )
{ {
if( m_ID_current_state == ID_IMPORT_GLABEL_BUTT ) if( m_ID_current_state == ID_IMPORT_GLABEL_BUTT )
@ -239,7 +239,7 @@ void WinEDA_SchematicFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
m_CurrentScreen->SetCurItem( m_CurrentScreen->SetCurItem(
Create_PinSheet( (DrawSheetStruct*) DrawStruct, DC ) ); Create_PinSheet( (DrawSheetStruct*) DrawStruct, DC ) );
} }
else if( (DrawStruct->m_StructType == DRAW_SHEETLABEL_STRUCT_TYPE) else if( (DrawStruct->Type() == DRAW_SHEETLABEL_STRUCT_TYPE)
&& (DrawStruct->m_Flags != 0) ) && (DrawStruct->m_Flags != 0) )
{ {
DrawStruct->Place( this, DC ); DrawStruct->Place( this, DC );
@ -316,7 +316,7 @@ void WinEDA_SchematicFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break; break;
// Element localisé // Element localisé
switch( DrawStruct->m_StructType ) switch( DrawStruct->Type() )
{ {
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
InstallNextScreen( (DrawSheetStruct*) DrawStruct ); InstallNextScreen( (DrawSheetStruct*) DrawStruct );

View File

@ -96,7 +96,7 @@ void WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) ) if( (DrawStruct == NULL) || (DrawStruct->m_Flags == 0) )
{ {
DrawStruct = SchematicGeneralLocateAndDisplay( FALSE ); DrawStruct = SchematicGeneralLocateAndDisplay( FALSE );
if( DrawStruct && (DrawStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE) ) if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
{ {
DrawSheetLabelStruct* slabel; DrawSheetLabelStruct* slabel;
slabel = LocateSheetLabel( (DrawSheetStruct*) DrawStruct, slabel = LocateSheetLabel( (DrawSheetStruct*) DrawStruct,
@ -148,7 +148,7 @@ void WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
int flags = DrawStruct->m_Flags; int flags = DrawStruct->m_Flags;
bool is_new = (flags & IS_NEW) ? TRUE : FALSE; bool is_new = (flags & IS_NEW) ? TRUE : FALSE;
switch( DrawStruct->m_StructType ) switch( DrawStruct->Type() )
{ {
case DRAW_NOCONNECT_STRUCT_TYPE: case DRAW_NOCONNECT_STRUCT_TYPE:
@ -243,7 +243,7 @@ void WinEDA_SchematicFrame::OnRightClick( const wxPoint& MousePos,
wxString msg; wxString msg;
msg.Printf( msg.Printf(
wxT( "WinEDA_SchematicFrame::OnRightClick Error: unknown DrawType %d" ), wxT( "WinEDA_SchematicFrame::OnRightClick Error: unknown DrawType %d" ),
DrawStruct->m_StructType ); DrawStruct->Type() );
DisplayError( this, msg ); DisplayError( this, msg );
break; break;
} }

View File

@ -36,7 +36,7 @@ void InstallPineditFrame(WinEDA_LibeditFrame * parent, wxDC * DC, const wxPoint
{ {
wxPoint MousePos = parent->GetScreen()->m_Curseur; wxPoint MousePos = parent->GetScreen()->m_Curseur;
int accept = TRUE; int accept = TRUE;
if ( (CurrentDrawItem == NULL) || (CurrentDrawItem->m_StructType == COMPONENT_PIN_DRAW_TYPE) ) if ( (CurrentDrawItem == NULL) || (CurrentDrawItem->Type() == COMPONENT_PIN_DRAW_TYPE) )
{ {
LibDrawPin * Pin = (LibDrawPin *) CurrentDrawItem; LibDrawPin * Pin = (LibDrawPin *) CurrentDrawItem;
WinEDA_PinPropertiesFrame * frame = new WinEDA_PinPropertiesFrame(parent); WinEDA_PinPropertiesFrame * frame = new WinEDA_PinPropertiesFrame(parent);

View File

@ -122,7 +122,7 @@ LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem;
Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings;
for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext ) for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext )
{ {
if (Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue;
if ( Pin == CurrentPin ) continue; if ( Pin == CurrentPin ) continue;
if( (Pin->m_Pos == CurrentPin->m_Pos) && if( (Pin->m_Pos == CurrentPin->m_Pos) &&
(Pin->m_Orient == CurrentPin->m_Orient) && (Pin->m_Orient == CurrentPin->m_Orient) &&
@ -179,7 +179,7 @@ bool status;
// Tst for an other pin in same new position: // Tst for an other pin in same new position:
for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext) for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext)
{ {
if ( Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; if ( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue;
if ( Pin == CurrentPin ) continue; if ( Pin == CurrentPin ) continue;
if( newpos != Pin->m_Pos ) continue; if( newpos != Pin->m_Pos ) continue;
if ( Pin->m_Flags ) continue; if ( Pin->m_Flags ) continue;
@ -213,7 +213,7 @@ bool status;
Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings; Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings;
for ( ; Pin != NULL; Pin = (LibDrawPin *)Pin->Pnext) for ( ; Pin != NULL; Pin = (LibDrawPin *)Pin->Pnext)
{ {
if(Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; if(Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue;
if( Pin->m_Flags == 0 ) continue; if( Pin->m_Flags == 0 ) continue;
Pin->m_Pos = CurrentPin->m_Pos; Pin->m_Pos = CurrentPin->m_Pos;
Pin->m_Flags = 0; Pin->m_Flags = 0;
@ -270,7 +270,7 @@ wxPoint startPos;
for ( ; Pin != NULL; Pin = (LibDrawPin *)Pin->Pnext ) for ( ; Pin != NULL; Pin = (LibDrawPin *)Pin->Pnext )
{ {
Pin->m_Flags = 0; Pin->m_Flags = 0;
if (Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue;
if ( Pin == CurrentPin) continue; if ( Pin == CurrentPin) continue;
if ( (Pin->m_Pos == CurrentPin->m_Pos) && (Pin->m_Orient == CurrentPin->m_Orient) && if ( (Pin->m_Pos == CurrentPin->m_Pos) && (Pin->m_Orient == CurrentPin->m_Orient) &&
(g_EditPinByPinIsOn == FALSE ) ) (g_EditPinByPinIsOn == FALSE ) )
@ -345,7 +345,7 @@ LibDrawPin * CurrentPin = (LibDrawPin *) CurrentDrawItem;
Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings;
for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext) for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext)
{ {
if(Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; if(Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue;
if( Pin->m_Flags == 0 ) continue; if( Pin->m_Flags == 0 ) continue;
if( Pin->m_Convert != CurrentPin->m_Convert ) continue; if( Pin->m_Convert != CurrentPin->m_Convert ) continue;
Pin->m_PinShape = newshape; Pin->m_PinShape = newshape;
@ -373,7 +373,7 @@ LibDrawPin * CurrentPin = (LibDrawPin*)CurrentDrawItem;
Pin = (LibDrawPin*)CurrentLibEntry->m_Drawings; Pin = (LibDrawPin*)CurrentLibEntry->m_Drawings;
for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext) for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext)
{ {
if(Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; if(Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue;
if( Pin->m_Flags == 0 ) continue; if( Pin->m_Flags == 0 ) continue;
Pin->m_PinType = newtype; Pin->m_PinType = newtype;
} }
@ -404,7 +404,7 @@ wxString buf;
Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings;
for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext) for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext)
{ {
if (Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue;
if( (Pin->m_Flags & IS_LINKED) == 0 ) continue; if( (Pin->m_Flags & IS_LINKED) == 0 ) continue;
if (newsize >= 0 ) Pin->m_PinNameSize = newsize; if (newsize >= 0 ) Pin->m_PinNameSize = newsize;
Pin->m_PinName = buf; Pin->m_PinName = buf;
@ -439,7 +439,7 @@ wxString buf;
Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings; Pin = (LibDrawPin *) CurrentLibEntry->m_Drawings;
for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext) for ( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext)
{ {
if (Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue;
if( (Pin->m_Flags & IS_LINKED) == 0 ) continue; if( (Pin->m_Flags & IS_LINKED) == 0 ) continue;
if( Pin->m_Unit != CurrentPin->m_Unit ) continue; if( Pin->m_Unit != CurrentPin->m_Unit ) continue;
if ( newsize >= 0) Pin->m_PinNumSize = newsize; if ( newsize >= 0) Pin->m_PinNumSize = newsize;
@ -474,7 +474,7 @@ wxPoint PinPos;
DrawItem = LibEntry->m_Drawings; DrawItem = LibEntry->m_Drawings;
for ( ; DrawItem != NULL; ) for ( ; DrawItem != NULL; )
{ {
if (DrawItem->m_StructType != COMPONENT_PIN_DRAW_TYPE ) if (DrawItem->Type() != COMPONENT_PIN_DRAW_TYPE )
{ {
DrawItem = DrawItem->Next(); continue; DrawItem = DrawItem->Next(); continue;
} }
@ -591,7 +591,7 @@ LibDrawPin * Pin, * CurrentPin = (LibDrawPin * ) CurrentDrawItem;
{ {
Pin = (LibDrawPin *)DrawItem; Pin = (LibDrawPin *)DrawItem;
DrawItem = DrawItem->Next(); DrawItem = DrawItem->Next();
if( Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE) continue; if( Pin->Type() != COMPONENT_PIN_DRAW_TYPE) continue;
if( Pin->m_Flags == 0 ) continue; if( Pin->m_Flags == 0 ) continue;
if( Pin == CurrentPin) continue; if( Pin == CurrentPin) continue;
if(CurrentPin->m_Convert && (CurrentPin->m_Convert != Pin->m_Convert)) if(CurrentPin->m_Convert && (CurrentPin->m_Convert != Pin->m_Convert))
@ -615,7 +615,7 @@ LibDrawPin * Pin, * CurrentPin = (LibDrawPin * ) CurrentDrawItem;
for ( ; DrawItem != NULL; ) for ( ; DrawItem != NULL; )
{ {
Pin = (LibDrawPin *)DrawItem; DrawItem = DrawItem->Next(); Pin = (LibDrawPin *)DrawItem; DrawItem = DrawItem->Next();
if(Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE) continue; if(Pin->Type() != COMPONENT_PIN_DRAW_TYPE) continue;
if( Pin->m_Flags == 0 ) continue; if( Pin->m_Flags == 0 ) continue;
if( Pin == CurrentPin) continue; if( Pin == CurrentPin) continue;
if( CurrentPin->m_Unit && (CurrentPin->m_Unit != Pin->m_Unit) ) if( CurrentPin->m_Unit && (CurrentPin->m_Unit != Pin->m_Unit) )
@ -672,7 +672,7 @@ LibDrawPin * RefPin, * Pin = (LibDrawPin *) CurrentDrawItem;
Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings; Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings;
for ( ; Pin != NULL; Pin = (LibDrawPin *)Pin->Pnext ) for ( ; Pin != NULL; Pin = (LibDrawPin *)Pin->Pnext )
{ {
if (Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; if (Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue;
if( Pin->m_Pos != RefPin->m_Pos ) continue; if( Pin->m_Pos != RefPin->m_Pos ) continue;
if(Pin->m_Orient != RefPin->m_Orient) continue; if(Pin->m_Orient != RefPin->m_Orient) continue;
if( Pin->m_Convert == RefPin->m_Convert ) Pin->m_PinLen = newsize; if( Pin->m_Convert == RefPin->m_Convert ) Pin->m_PinLen = newsize;
@ -745,14 +745,14 @@ LibDrawPin * Pin;
bool selected = (MasterPin->m_Selected & IS_SELECTED) != 0; bool selected = (MasterPin->m_Selected & IS_SELECTED) != 0;
if( (CurrentLibEntry == NULL) || (MasterPin == NULL) ) return; if( (CurrentLibEntry == NULL) || (MasterPin == NULL) ) return;
if(MasterPin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) return; if(MasterPin->Type() != COMPONENT_PIN_DRAW_TYPE ) return;
GetScreen()->SetModify(); GetScreen()->SetModify();
Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings; Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings;
for( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext ) for( ; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext )
{ {
if ( Pin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) continue; if ( Pin->Type() != COMPONENT_PIN_DRAW_TYPE ) continue;
if ( (Pin->m_Convert) && (Pin->m_Convert != CurrentConvert) ) continue; if ( (Pin->m_Convert) && (Pin->m_Convert != CurrentConvert) ) continue;
// Is it the "selected mode" ? // Is it the "selected mode" ?
if (selected && (Pin->m_Selected & IS_SELECTED) == 0 ) continue; if (selected && (Pin->m_Selected & IS_SELECTED) == 0 ) continue;
@ -793,7 +793,7 @@ int ox = 0, oy = 0;
if(CurrentLibEntry == NULL ) return; if(CurrentLibEntry == NULL ) return;
if(SourcePin == NULL ) return; if(SourcePin == NULL ) return;
if(SourcePin->m_StructType != COMPONENT_PIN_DRAW_TYPE ) return; if(SourcePin->Type() != COMPONENT_PIN_DRAW_TYPE ) return;
Pin = SourcePin->GenCopy(); Pin = SourcePin->GenCopy();
Pin->Pnext = CurrentLibEntry->m_Drawings; Pin->Pnext = CurrentLibEntry->m_Drawings;
@ -848,13 +848,13 @@ wxString msg;
Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings; Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings;
for( nb_pins = 0; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext ) for( nb_pins = 0; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext )
{ {
if ( Pin->m_StructType == COMPONENT_PIN_DRAW_TYPE ) nb_pins++; if ( Pin->Type() == COMPONENT_PIN_DRAW_TYPE ) nb_pins++;
} }
PinList = (LibDrawPin **) MyZMalloc( (nb_pins+1) * sizeof(LibDrawPin *) ); PinList = (LibDrawPin **) MyZMalloc( (nb_pins+1) * sizeof(LibDrawPin *) );
Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings; Pin = (LibDrawPin *)CurrentLibEntry->m_Drawings;
for( ii = 0; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext ) for( ii = 0; Pin != NULL; Pin = (LibDrawPin *) Pin->Pnext )
{ {
if ( Pin->m_StructType == COMPONENT_PIN_DRAW_TYPE ) PinList[ii++] = Pin; if ( Pin->Type() == COMPONENT_PIN_DRAW_TYPE ) PinList[ii++] = Pin;
} }
// Classement des pins par numero de pin // Classement des pins par numero de pin

View File

@ -180,7 +180,7 @@ wxPoint pos;
if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
SetColorMapPS ( ReturnLayerColor(LAYER_DEVICE) ); SetColorMapPS ( ReturnLayerColor(LAYER_DEVICE) );
switch (DEntry->m_StructType) switch (DEntry->Type())
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
{ {
@ -517,7 +517,7 @@ wxString Text;
int color = -1; int color = -1;
int HalfSize; int HalfSize;
switch ( Struct->m_StructType ) switch ( Struct->Type() )
{ {
case DRAW_GLOBAL_LABEL_STRUCT_TYPE: case DRAW_GLOBAL_LABEL_STRUCT_TYPE:
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
@ -529,7 +529,7 @@ int HalfSize;
pX = ((DrawTextStruct*)Struct)->m_Pos.x; pX = ((DrawTextStruct*)Struct)->m_Pos.x;
pY = ((DrawTextStruct*)Struct)->m_Pos.y; pY = ((DrawTextStruct*)Struct)->m_Pos.y;
offset = TXTMARGE; offset = TXTMARGE;
if ( Struct->m_StructType == DRAW_GLOBAL_LABEL_STRUCT_TYPE) if ( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE)
offset += Size.x; // We must draw the Glabel graphoc symbol offset += Size.x; // We must draw the Glabel graphoc symbol
if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt ) if ( (g_PlotFormat == PLOT_FORMAT_POST) && g_PlotPSColorOpt )
color = ReturnLayerColor(((DrawTextStruct*)Struct)->m_Layer); color = ReturnLayerColor(((DrawTextStruct*)Struct)->m_Layer);
@ -545,7 +545,7 @@ int HalfSize;
switch(Orient) switch(Orient)
{ {
case 0: /* Orientation horiz normale */ case 0: /* Orientation horiz normale */
if( Struct->m_StructType == DRAW_GLOBAL_LABEL_STRUCT_TYPE ) if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE )
PlotGraphicText(g_PlotFormat, wxPoint(pX - offset, pY), PlotGraphicText(g_PlotFormat, wxPoint(pX - offset, pY),
color, Text, TEXT_ORIENT_HORIZ, Size, color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER); GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER);
@ -556,7 +556,7 @@ int HalfSize;
break; break;
case 1: /* Orientation vert UP */ case 1: /* Orientation vert UP */
if( Struct->m_StructType == DRAW_GLOBAL_LABEL_STRUCT_TYPE ) if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE )
PlotGraphicText(g_PlotFormat, wxPoint(pX, pY + offset), PlotGraphicText(g_PlotFormat, wxPoint(pX, pY + offset),
color, Text, TEXT_ORIENT_VERT, Size, color, Text, TEXT_ORIENT_VERT, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP);
@ -567,7 +567,7 @@ int HalfSize;
break; break;
case 2: /* Orientation horiz inverse */ case 2: /* Orientation horiz inverse */
if( Struct->m_StructType == DRAW_GLOBAL_LABEL_STRUCT_TYPE) if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE)
PlotGraphicText(g_PlotFormat, wxPoint(pX + offset, pY), PlotGraphicText(g_PlotFormat, wxPoint(pX + offset, pY),
color, Text, TEXT_ORIENT_HORIZ, Size, color, Text, TEXT_ORIENT_HORIZ, Size,
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER); GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER);
@ -578,7 +578,7 @@ int HalfSize;
break; break;
case 3: /* Orientation vert BOTTOM */ case 3: /* Orientation vert BOTTOM */
if( Struct->m_StructType == DRAW_GLOBAL_LABEL_STRUCT_TYPE) if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE)
PlotGraphicText(g_PlotFormat, wxPoint(pX, pY - offset), PlotGraphicText(g_PlotFormat, wxPoint(pX, pY - offset),
color, Text, 2700, Size, color, Text, 2700, Size,
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM); GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM);
@ -590,7 +590,7 @@ int HalfSize;
} }
/* Trace du symbole associe au label global */ /* Trace du symbole associe au label global */
if( Struct->m_StructType == DRAW_GLOBAL_LABEL_STRUCT_TYPE) if( Struct->Type() == DRAW_GLOBAL_LABEL_STRUCT_TYPE)
{ {
int jj, imax; int jj, imax;
HalfSize = Size.x / 2; HalfSize = Size.x / 2;

View File

@ -574,7 +574,7 @@ wxString msg;
{ {
Plume('U'); Plume('U');
layer = LAYER_NOTES; layer = LAYER_NOTES;
switch( DrawList->m_StructType ) switch( DrawList->Type() )
{ {
case DRAW_BUSENTRY_STRUCT_TYPE : case DRAW_BUSENTRY_STRUCT_TYPE :
#undef STRUCT #undef STRUCT
@ -585,7 +585,7 @@ wxString msg;
case DRAW_SEGMENT_STRUCT_TYPE : case DRAW_SEGMENT_STRUCT_TYPE :
#undef STRUCT #undef STRUCT
#define STRUCT ((EDA_DrawLineStruct*)DrawList) #define STRUCT ((EDA_DrawLineStruct*)DrawList)
if ( DrawList->m_StructType == DRAW_SEGMENT_STRUCT_TYPE) if ( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE)
{ {
x1 = STRUCT->m_Start.x; y1 = STRUCT->m_Start.y; x1 = STRUCT->m_Start.x; y1 = STRUCT->m_Start.y;
x2 = STRUCT->m_End.x; y2 = STRUCT->m_End.y; x2 = STRUCT->m_End.x; y2 = STRUCT->m_End.y;

View File

@ -415,7 +415,7 @@ wxPoint StartPos, EndPos;
{ {
Plume('U'); Plume('U');
layer = LAYER_NOTES; layer = LAYER_NOTES;
switch( DrawList->m_StructType ) switch( DrawList->Type() )
{ {
case DRAW_BUSENTRY_STRUCT_TYPE : /* Struct Raccord et Segment sont identiques */ case DRAW_BUSENTRY_STRUCT_TYPE : /* Struct Raccord et Segment sont identiques */
#undef STRUCT #undef STRUCT
@ -426,7 +426,7 @@ wxPoint StartPos, EndPos;
case DRAW_SEGMENT_STRUCT_TYPE : case DRAW_SEGMENT_STRUCT_TYPE :
#undef STRUCT #undef STRUCT
#define STRUCT ((EDA_DrawLineStruct*)DrawList) #define STRUCT ((EDA_DrawLineStruct*)DrawList)
if ( DrawList->m_StructType == DRAW_SEGMENT_STRUCT_TYPE) if ( DrawList->Type() == DRAW_SEGMENT_STRUCT_TYPE)
{ {
StartPos = STRUCT->m_Start; StartPos = STRUCT->m_Start;
EndPos = STRUCT->m_End; EndPos = STRUCT->m_End;

View File

@ -119,13 +119,13 @@ public:
long m_TimeStamp; long m_TimeStamp;
public: public:
ComponentDataClass( void ) ComponentDataClass()
{ {
InitData(); InitData();
} }
void InitData( void ) void InitData()
{ {
m_TimeStamp = 0; m_TimeStamp = 0;
m_Reference[0] = 0; m_Reference[0] = 0;

View File

@ -74,11 +74,11 @@ public:
public: public:
EDA_DrawLineStruct( const wxPoint &pos, int layer ); EDA_DrawLineStruct( const wxPoint &pos, int layer );
~EDA_DrawLineStruct( void ) { } ~EDA_DrawLineStruct() { }
bool IsOneEndPointAt( const wxPoint& pos ); bool IsOneEndPointAt( const wxPoint& pos );
EDA_DrawLineStruct* GenCopy( void ); EDA_DrawLineStruct* GenCopy();
bool IsNull( void ) bool IsNull()
{ {
return m_Start == m_End; return m_Start == m_End;
} }
@ -98,9 +98,9 @@ public:
public: public:
DrawMarkerStruct( const wxPoint &pos, const wxString &text ); DrawMarkerStruct( const wxPoint &pos, const wxString &text );
~DrawMarkerStruct( void ); ~DrawMarkerStruct();
DrawMarkerStruct* GenCopy( void ); DrawMarkerStruct* GenCopy();
wxString GetComment( void ); wxString GetComment();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
}; };
@ -113,8 +113,8 @@ public:
public: public:
DrawNoConnectStruct( const wxPoint &pos ); DrawNoConnectStruct( const wxPoint &pos );
~DrawNoConnectStruct( void ) { } ~DrawNoConnectStruct() { }
DrawNoConnectStruct* GenCopy( void ); DrawNoConnectStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
}; };
@ -134,9 +134,9 @@ public:
public: public:
DrawBusEntryStruct( const wxPoint &pos, int shape, int id ); DrawBusEntryStruct( const wxPoint &pos, int shape, int id );
~DrawBusEntryStruct( void ) { } ~DrawBusEntryStruct() { }
DrawBusEntryStruct* GenCopy( void ); DrawBusEntryStruct* GenCopy();
wxPoint m_End( void ); // retourne la coord de fin du raccord wxPoint m_End(); // retourne la coord de fin du raccord
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
}; };
@ -151,8 +151,8 @@ public:
public: public:
DrawPolylineStruct( int layer ); DrawPolylineStruct( int layer );
~DrawPolylineStruct( void ); ~DrawPolylineStruct();
DrawPolylineStruct* GenCopy( void ); DrawPolylineStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
}; };
@ -165,12 +165,13 @@ public:
public: public:
DrawJunctionStruct( const wxPoint &pos ); DrawJunctionStruct( const wxPoint &pos );
~DrawJunctionStruct( void ) { } ~DrawJunctionStruct() { }
DrawJunctionStruct* GenCopy( void ); DrawJunctionStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color = -1 ); int draw_mode, int Color = -1 );
}; };
class DrawTextStruct : public EDA_BaseStruct, public EDA_TextStruct class DrawTextStruct : public EDA_BaseStruct, public EDA_TextStruct
{ {
public: public:
@ -179,14 +180,22 @@ public:
bool m_IsDangling; // TRUE si non connecté bool m_IsDangling; // TRUE si non connecté
public: public:
DrawTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString ); DrawTextStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString,
~DrawTextStruct( void ) { } KICAD_T aType = DRAW_TEXT_STRUCT_TYPE );
DrawTextStruct* GenCopy( void ); ~DrawTextStruct() { }
DrawTextStruct* GenCopy();
virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode, virtual void Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, int draw_mode,
int Color = -1 ); int Color = -1 );
void SwapData( DrawTextStruct* copyitem ); void SwapData( DrawTextStruct* copyitem );
virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC ); virtual void Place( WinEDA_DrawFrame* frame, wxDC* DC );
// selectively give public access to a very dangerous protected function:
void SetType( KICAD_T aType ) { EDA_BaseStruct::SetType( aType ); }
private: private:
void DrawAsText( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void DrawAsText( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int draw_mode, int Color ); int draw_mode, int Color );
@ -201,7 +210,7 @@ class DrawLabelStruct : public DrawTextStruct
{ {
public: public:
DrawLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString ); DrawLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), const wxString& text = wxEmptyString );
~DrawLabelStruct( void ) { } ~DrawLabelStruct() { }
}; };
@ -210,7 +219,7 @@ class DrawGlobalLabelStruct : public DrawTextStruct
public: public:
DrawGlobalLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ), DrawGlobalLabelStruct( const wxPoint& pos = wxPoint( 0, 0 ),
const wxString& text = wxEmptyString ); const wxString& text = wxEmptyString );
~DrawGlobalLabelStruct( void ) { } ~DrawGlobalLabelStruct() { }
}; };

View File

@ -297,7 +297,7 @@ void InstallNetlistFrame(WinEDA_SchematicFrame *parent, wxPoint &pos);
/***************/ /***************/
/* ANNOTATE.CPP */ /* ANNOTATE.CPP */
/***************/ /***************/
void ReAnnotatePowerSymbolsOnly( void ); void ReAnnotatePowerSymbolsOnly();
void InstallAnnotateFrame(WinEDA_SchematicFrame * parent, wxPoint &pos); void InstallAnnotateFrame(WinEDA_SchematicFrame * parent, wxPoint &pos);
int CheckAnnotate(WinEDA_SchematicFrame * frame, bool OneSheetOnly); int CheckAnnotate(WinEDA_SchematicFrame * frame, bool OneSheetOnly);

View File

@ -142,7 +142,7 @@ wxString dirbuf;
Phead = screen->EEDrawList; Phead = screen->EEDrawList;
while (Phead) while (Phead)
{ {
switch(Phead->m_StructType) switch(Phead->Type())
{ {
case DRAW_LIB_ITEM_STRUCT_TYPE: /* Its a library item. */ case DRAW_LIB_ITEM_STRUCT_TYPE: /* Its a library item. */
SavePartDescr( f, (EDA_SchComponentStruct *) Phead); SavePartDescr( f, (EDA_SchComponentStruct *) Phead);

View File

@ -1,9 +1,9 @@
/****************************/ /****************************/
/* EESchema - eesavlib.cpp */ /* EESchema - eesavlib.cpp */
/****************************/ /****************************/
/* Write Routines to save schematic libraries and library components (::WriteDescr() members) /* Write Routines to save schematic libraries and library components (::WriteDescr() members)
*/ */
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -20,244 +20,290 @@
/* Variables locales */ /* Variables locales */
static bool WriteLibEntryDateAndTime(FILE * ExportFile, static bool WriteLibEntryDateAndTime( FILE* ExportFile,
EDA_LibComponentStruct * LibEntry); EDA_LibComponentStruct* LibEntry );
static int fill_tab[3] = { 'N', 'F', 'f' }; static int fill_tab[3] = { 'N', 'F', 'f' };
/***********************************************/ /***********************************************/
bool LibDrawArc::WriteDescr( FILE * ExportFile ) bool LibDrawArc::WriteDescr( FILE* ExportFile )
/***********************************************/ /***********************************************/
/* format
A centre_posx centre_posy rayon start_angle end_angle unit convert fill('N', 'F' ou 'f') startx starty endx endy
*/
{
int x1 = t1; if(x1 > 1800) x1 -= 3600;
int x2 = t2; if(x2 > 1800) x2 -= 3600;
fprintf(ExportFile,"A %d %d %d %d %d %d %d %d %c %d %d %d %d\n", /* format
* A centre_posx centre_posy rayon start_angle end_angle unit convert fill('N', 'F' ou 'f') startx starty endx endy
*/
{
int x1 = t1; if( x1 > 1800 )
x1 -= 3600;
int x2 = t2; if( x2 > 1800 )
x2 -= 3600;
fprintf( ExportFile, "A %d %d %d %d %d %d %d %d %c %d %d %d %d\n",
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
m_Rayon, x1, x2, m_Rayon, x1, x2,
m_Unit,m_Convert, m_Unit, m_Convert,
m_Width, fill_tab[m_Fill], m_Width, fill_tab[m_Fill],
m_ArcStart.x, m_ArcStart.y, m_ArcEnd.x, m_ArcEnd.y); m_ArcStart.x, m_ArcStart.y, m_ArcEnd.x, m_ArcEnd.y );
return FALSE; return FALSE;
} }
/***************************************************/ /***************************************************/
bool LibDrawCircle::WriteDescr( FILE * ExportFile ) bool LibDrawCircle::WriteDescr( FILE* ExportFile )
/***************************************************/ /***************************************************/
{ {
fprintf(ExportFile,"C %d %d %d %d %d %d %c\n", fprintf( ExportFile, "C %d %d %d %d %d %d %c\n",
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
m_Rayon, m_Rayon,
m_Unit,m_Convert, m_Unit, m_Convert,
m_Width, fill_tab[m_Fill]); m_Width, fill_tab[m_Fill] );
return FALSE; return FALSE;
} }
/************************************************/ /************************************************/
bool LibDrawText::WriteDescr( FILE * ExportFile ) bool LibDrawText::WriteDescr( FILE* ExportFile )
/************************************************/ /************************************************/
{ {
wxString text = m_Text; wxString text = m_Text;
text.Replace( wxT(" "), wxT("~") ); // Spaces are not allowed: changed to '~' text.Replace( wxT( " " ), wxT( "~" ) ); // Spaces are not allowed: changed to '~'
fprintf(ExportFile,"T %d %d %d %d %d %d %d %s\n", fprintf( ExportFile, "T %d %d %d %d %d %d %d %s\n",
m_Horiz, m_Horiz,
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
m_Size.x, m_Type, m_Size.x, m_Type,
m_Unit,m_Convert, m_Unit, m_Convert,
CONV_TO_UTF8(text) ); CONV_TO_UTF8( text ) );
return FALSE; return FALSE;
} }
/***************************************************/ /***************************************************/
bool LibDrawSquare::WriteDescr( FILE * ExportFile ) bool LibDrawSquare::WriteDescr( FILE* ExportFile )
/***************************************************/ /***************************************************/
{ {
fprintf(ExportFile,"S %d %d %d %d %d %d %d %c\n", fprintf( ExportFile, "S %d %d %d %d %d %d %d %c\n",
m_Pos.x, m_Pos.y, m_End.x, m_End.y, m_Pos.x, m_Pos.y, m_End.x, m_End.y,
m_Unit,m_Convert, m_Unit, m_Convert,
m_Width, fill_tab[m_Fill]); m_Width, fill_tab[m_Fill] );
return FALSE; return FALSE;
} }
/************************************************/ /************************************************/
bool LibDrawPin::WriteDescr( FILE * ExportFile ) bool LibDrawPin::WriteDescr( FILE* ExportFile )
/************************************************/ /************************************************/
{ {
int Etype = 'I'; int Etype = 'I';
wxString StringPinNum; wxString StringPinNum;
switch(m_PinType) switch( m_PinType )
{ {
case PIN_INPUT: Etype = 'I'; break; case PIN_INPUT:
case PIN_OUTPUT: Etype = 'O'; break; Etype = 'I'; break;
case PIN_BIDI: Etype = 'B'; break;
case PIN_TRISTATE: Etype = 'T'; break; case PIN_OUTPUT:
case PIN_PASSIVE: Etype = 'P'; break; Etype = 'O'; break;
case PIN_UNSPECIFIED: Etype = 'U'; break;
case PIN_POWER_IN: Etype = 'W'; break; case PIN_BIDI:
case PIN_POWER_OUT: Etype = 'w'; break; Etype = 'B'; break;
case PIN_OPENCOLLECTOR: Etype = 'C'; break;
case PIN_OPENEMITTER: Etype = 'E'; break; case PIN_TRISTATE:
Etype = 'T'; break;
case PIN_PASSIVE:
Etype = 'P'; break;
case PIN_UNSPECIFIED:
Etype = 'U'; break;
case PIN_POWER_IN:
Etype = 'W'; break;
case PIN_POWER_OUT:
Etype = 'w'; break;
case PIN_OPENCOLLECTOR:
Etype = 'C'; break;
case PIN_OPENEMITTER:
Etype = 'E'; break;
} }
ReturnPinStringNum(StringPinNum); ReturnPinStringNum( StringPinNum );
if ( StringPinNum.IsEmpty() ) StringPinNum = wxT("~"); if( StringPinNum.IsEmpty() )
StringPinNum = wxT( "~" );
if( ! m_PinName.IsEmpty() ) if( !m_PinName.IsEmpty() )
fprintf(ExportFile,"X %s", CONV_TO_UTF8(m_PinName) ); fprintf( ExportFile, "X %s", CONV_TO_UTF8( m_PinName ) );
else fprintf(ExportFile,"X ~"); else
fprintf( ExportFile, "X ~" );
fprintf(ExportFile," %s %d %d %d %c %d %d %d %d %c", fprintf( ExportFile, " %s %d %d %d %c %d %d %d %d %c",
CONV_TO_UTF8(StringPinNum), CONV_TO_UTF8( StringPinNum ),
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
(int)m_PinLen, (int)m_Orient, (int) m_PinLen, (int) m_Orient,
m_PinNumSize, m_PinNameSize, m_PinNumSize, m_PinNameSize,
m_Unit,m_Convert, Etype); m_Unit, m_Convert, Etype );
if( (m_PinShape) || (m_Attributs & PINNOTDRAW) ) if( (m_PinShape) || (m_Attributs & PINNOTDRAW) )
fprintf(ExportFile," "); fprintf( ExportFile, " " );
if (m_Attributs & PINNOTDRAW) fprintf(ExportFile,"N"); if( m_Attributs & PINNOTDRAW )
if (m_PinShape & INVERT) fprintf(ExportFile,"I"); fprintf( ExportFile, "N" );
if (m_PinShape & CLOCK) fprintf(ExportFile,"C"); if( m_PinShape & INVERT )
if (m_PinShape & LOWLEVEL_IN) fprintf(ExportFile,"L"); fprintf( ExportFile, "I" );
if (m_PinShape & LOWLEVEL_OUT) fprintf(ExportFile,"V"); if( m_PinShape & CLOCK )
fprintf( ExportFile, "C" );
if( m_PinShape & LOWLEVEL_IN )
fprintf( ExportFile, "L" );
if( m_PinShape & LOWLEVEL_OUT )
fprintf( ExportFile, "V" );
fprintf(ExportFile,"\n"); fprintf( ExportFile, "\n" );
return FALSE; return FALSE;
} }
/****************************************************/ /****************************************************/
bool LibDrawPolyline::WriteDescr( FILE * ExportFile ) bool LibDrawPolyline::WriteDescr( FILE* ExportFile )
/****************************************************/ /****************************************************/
{ {
int ii, *ptpoly; int ii, * ptpoly;
fprintf(ExportFile,"P %d %d %d %d", fprintf( ExportFile, "P %d %d %d %d",
n, n,
m_Unit,m_Convert, m_Unit, m_Convert,
m_Width); m_Width );
ptpoly = PolyList; ptpoly = PolyList;
for( ii = n ; ii > 0; ii-- ) for( ii = n; ii > 0; ii-- )
{ {
fprintf(ExportFile," %d %d", *ptpoly, *(ptpoly+1) ); fprintf( ExportFile, " %d %d", *ptpoly, *(ptpoly + 1) );
ptpoly += 2; ptpoly += 2;
} }
fprintf(ExportFile," %c\n", fill_tab[m_Fill]);
fprintf( ExportFile, " %c\n", fill_tab[m_Fill] );
return FALSE; return FALSE;
} }
/**************************************************/ /**************************************************/
bool LibDrawField::WriteDescr( FILE * ExportFile ) bool LibDrawField::WriteDescr( FILE* ExportFile )
/**************************************************/ /**************************************************/
{ {
int hjustify, vjustify; int hjustify, vjustify;
wxString text = m_Text; wxString text = m_Text;
hjustify = 'C'; hjustify = 'C';
if ( m_HJustify == GR_TEXT_HJUSTIFY_LEFT ) hjustify = 'L'; if( m_HJustify == GR_TEXT_HJUSTIFY_LEFT )
else if ( m_HJustify == GR_TEXT_HJUSTIFY_RIGHT ) hjustify = 'R'; hjustify = 'L';
else if( m_HJustify == GR_TEXT_HJUSTIFY_RIGHT )
hjustify = 'R';
vjustify = 'C'; vjustify = 'C';
if ( m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM) vjustify = 'B'; if( m_VJustify == GR_TEXT_VJUSTIFY_BOTTOM )
else if ( m_VJustify == GR_TEXT_VJUSTIFY_TOP) vjustify = 'T'; vjustify = 'B';
if ( text.IsEmpty() ) text = wxT("~"); else if( m_VJustify == GR_TEXT_VJUSTIFY_TOP )
fprintf(ExportFile,"F%d \"%s\" %d %d %d %c %c %c %c", vjustify = 'T';
m_FieldId, CONV_TO_UTF8(text), if( text.IsEmpty() )
text = wxT( "~" );
fprintf( ExportFile, "F%d \"%s\" %d %d %d %c %c %c %c",
m_FieldId, CONV_TO_UTF8( text ),
m_Pos.x, m_Pos.y, m_Pos.x, m_Pos.y,
m_Size.x, m_Size.x,
m_Orient == 0 ? 'H' : 'V', m_Orient == 0 ? 'H' : 'V',
(m_Attributs & TEXT_NO_VISIBLE )? 'I' : 'V', (m_Attributs & TEXT_NO_VISIBLE ) ? 'I' : 'V',
hjustify, vjustify ); hjustify, vjustify );
// Save field name, if necessary
if ( m_FieldId >= FIELD1 && ! m_Name.IsEmpty() )
fprintf(ExportFile," \"%s\"", CONV_TO_UTF8(m_Name) );
fprintf(ExportFile,"\n"); // Save field name, if necessary
if( m_FieldId >= FIELD1 && !m_Name.IsEmpty() )
fprintf( ExportFile, " \"%s\"", CONV_TO_UTF8( m_Name ) );
fprintf( ExportFile, "\n" );
return FALSE; return FALSE;
} }
/**********************************************************/
LibEDA_BaseStruct * CopyDrawEntryStruct( wxWindow * frame,
LibEDA_BaseStruct * DrawItem)
/**********************************************************/
/* Routine de Duplication d'une structure DrawLibItem d'une partlib
Parametres d'entree:
DrawEntry = pointeur sur la structure a dupliquer
La structure nouvelle est creee, mais n'est pas inseree dans le
chainage
Retourne:
Pointeur sur la structure creee
*/
{
LibEDA_BaseStruct * NewDrawItem = NULL;
wxString msg;
switch(DrawItem->m_StructType) /**********************************************************/
LibEDA_BaseStruct* CopyDrawEntryStruct( wxWindow* frame,
LibEDA_BaseStruct* DrawItem )
/**********************************************************/
/* Routine de Duplication d'une structure DrawLibItem d'une partlib
* Parametres d'entree:
* DrawEntry = pointeur sur la structure a dupliquer
* La structure nouvelle est creee, mais n'est pas inseree dans le
* chainage
* Retourne:
* Pointeur sur la structure creee
*/
{
LibEDA_BaseStruct* NewDrawItem = NULL;
wxString msg;
switch( DrawItem->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
NewDrawItem = ((LibDrawArc*)DrawItem)->GenCopy(); NewDrawItem = ( (LibDrawArc*) DrawItem )->GenCopy();
break; break;
case COMPONENT_CIRCLE_DRAW_TYPE: case COMPONENT_CIRCLE_DRAW_TYPE:
NewDrawItem = ((LibDrawCircle*)DrawItem)->GenCopy(); NewDrawItem = ( (LibDrawCircle*) DrawItem )->GenCopy();
break; break;
case COMPONENT_RECT_DRAW_TYPE: case COMPONENT_RECT_DRAW_TYPE:
NewDrawItem = ((LibDrawSquare*)DrawItem)->GenCopy(); NewDrawItem = ( (LibDrawSquare*) DrawItem )->GenCopy();
break; break;
case COMPONENT_PIN_DRAW_TYPE: case COMPONENT_PIN_DRAW_TYPE:
NewDrawItem = ((LibDrawPin*)DrawItem)->GenCopy(); NewDrawItem = ( (LibDrawPin*) DrawItem )->GenCopy();
break; break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
NewDrawItem = ((LibDrawText*)DrawItem)->GenCopy(); NewDrawItem = ( (LibDrawText*) DrawItem )->GenCopy();
break; break;
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
NewDrawItem = ((LibDrawPolyline*)DrawItem)->GenCopy(); NewDrawItem = ( (LibDrawPolyline*) DrawItem )->GenCopy();
break; break;
default: default:
msg.Printf( wxT("CopyDrawLibEntryStruct: unknown Draw Type %d"), msg.Printf( wxT( "CopyDrawLibEntryStruct: unknown Draw Type %d" ),
DrawItem->m_StructType); DrawItem->Type() );
DisplayError(frame, msg); DisplayError( frame, msg );
break; break;
} }
return(NewDrawItem); return NewDrawItem;
} }
/*************************************************************************************************/ /*************************************************************************************************/
EDA_LibComponentStruct * CopyLibEntryStruct ( wxWindow * frame, EDA_LibComponentStruct * OldEntry) EDA_LibComponentStruct* CopyLibEntryStruct( wxWindow* frame, EDA_LibComponentStruct* OldEntry )
/*************************************************************************************************/ /*************************************************************************************************/
/* Routine de copie d'une partlib /* Routine de copie d'une partlib
Parametres d'entree: pointeur sur la structure de depart * Parametres d'entree: pointeur sur la structure de depart
Parametres de sortie: pointeur sur la structure creee * Parametres de sortie: pointeur sur la structure creee
Do not copy new items ( i.e. with m_Flag & IS_NEW) * Do not copy new items ( i.e. with m_Flag & IS_NEW)
*/ */
{ {
EDA_LibComponentStruct * NewStruct; EDA_LibComponentStruct* NewStruct;
LibEDA_BaseStruct * NewDrawings, * OldDrawings; LibEDA_BaseStruct* NewDrawings, * OldDrawings;
LibEDA_BaseStruct * LastItem; LibEDA_BaseStruct* LastItem;
LibDrawField * OldField, * NewField; LibDrawField* OldField, * NewField;
if( OldEntry->Type != ROOT ) if( OldEntry->Type != ROOT )
{ {
DisplayError(frame, wxT("CopyLibEntryStruct(): Type != ROOT")); DisplayError( frame, wxT( "CopyLibEntryStruct(): Type != ROOT" ) );
return(NULL); return NULL;
} }
NewStruct = new EDA_LibComponentStruct(NULL); NewStruct = new EDA_LibComponentStruct( NULL );
OldEntry->m_Prefix.Copy(&NewStruct->m_Prefix);
OldEntry->m_Name.Copy(&NewStruct->m_Name); OldEntry->m_Prefix.Copy( &NewStruct->m_Prefix );
OldEntry->m_Name.Copy( &NewStruct->m_Name );
NewStruct->m_UnitCount = OldEntry->m_UnitCount; NewStruct->m_UnitCount = OldEntry->m_UnitCount;
NewStruct->m_TextInside = OldEntry->m_TextInside; NewStruct->m_TextInside = OldEntry->m_TextInside;
@ -273,8 +319,8 @@ LibDrawField * OldField, * NewField;
NewStruct->m_DocFile = OldEntry->m_DocFile; NewStruct->m_DocFile = OldEntry->m_DocFile;
/* Copie des champs */ /* Copie des champs */
for(OldField = OldEntry->Fields; OldField != NULL; for( OldField = OldEntry->Fields; OldField != NULL;
OldField = (LibDrawField*)OldField->Pnext) OldField = (LibDrawField*) OldField->Pnext )
{ {
NewField = OldField->GenCopy(); NewField = OldField->GenCopy();
NewField->Pnext = NewStruct->Fields; NewField->Pnext = NewStruct->Fields;
@ -283,321 +329,339 @@ LibDrawField * OldField, * NewField;
/* Copie des elements type Drawing */ /* Copie des elements type Drawing */
LastItem = NULL; LastItem = NULL;
for(OldDrawings = OldEntry->m_Drawings; OldDrawings != NULL; OldDrawings = OldDrawings->Next()) for( OldDrawings = OldEntry->m_Drawings; OldDrawings != NULL; OldDrawings = OldDrawings->Next() )
{ {
if ( ( OldDrawings->m_Flags & IS_NEW) != 0 ) continue; if( ( OldDrawings->m_Flags & IS_NEW) != 0 )
NewDrawings = CopyDrawEntryStruct(frame, OldDrawings); continue;
if ( NewDrawings )
NewDrawings = CopyDrawEntryStruct( frame, OldDrawings );
if( NewDrawings )
{ {
if (LastItem == NULL ) NewStruct->m_Drawings = NewDrawings; if( LastItem == NULL )
else LastItem->Pnext = NewDrawings; NewStruct->m_Drawings = NewDrawings;
else
LastItem->Pnext = NewDrawings;
LastItem = NewDrawings; LastItem = NewDrawings;
NewDrawings->Pnext = NULL; NewDrawings->Pnext = NULL;
} }
else // Probleme rencontré: arret de copie else // Probleme rencontré: arret de copie
{ {
OldDrawings->m_StructType = TYPE_NOT_INIT; /* why this? m_StructType is not a flag, it is a type indicator!
DisplayError(frame, wxT("CopyLibEntryStruct(): error: aborted")); OldDrawings->Type() = TYPE_NOT_INIT;
*/
DisplayError( frame, wxT( "CopyLibEntryStruct(): error: aborted" ) );
break; break;
} }
} }
/* Copy the footprint filter list */ /* Copy the footprint filter list */
for ( unsigned ii = 0 ; ii < OldEntry->m_FootprintList.GetCount(); ii++ ) for( unsigned ii = 0; ii < OldEntry->m_FootprintList.GetCount(); ii++ )
NewStruct->m_FootprintList.Add(OldEntry->m_FootprintList[ii]); NewStruct->m_FootprintList.Add( OldEntry->m_FootprintList[ii] );
return(NewStruct); return NewStruct;
} }
/********************************************************/ /********************************************************/
int WriteOneLibEntry(wxWindow * frame, FILE * ExportFile, int WriteOneLibEntry( wxWindow* frame, FILE* ExportFile,
EDA_LibComponentStruct * LibEntry) EDA_LibComponentStruct* LibEntry )
/********************************************************/ /********************************************************/
/* Routine d'ecriture du composant pointe par LibEntry /* Routine d'ecriture du composant pointe par LibEntry
dans le fichier ExportFile( qui doit etre deja ouvert) * dans le fichier ExportFile( qui doit etre deja ouvert)
return: 0 si Ok * return: 0 si Ok
-1 si err write * -1 si err write
1 si composant non ecrit ( type ALIAS ) * 1 si composant non ecrit ( type ALIAS )
*/ */
#define UNUSED 0 #define UNUSED 0
{ {
LibEDA_BaseStruct *DrawEntry; LibEDA_BaseStruct* DrawEntry;
LibDrawField * Field; LibDrawField* Field;
if( LibEntry->Type != ROOT ) return(1); if( LibEntry->Type != ROOT )
return 1;
/* Creation du commentaire donnant le nom du composant */ /* Creation du commentaire donnant le nom du composant */
fprintf(ExportFile,"#\n# %s\n#\n", CONV_TO_UTF8(LibEntry->m_Name.m_Text)); fprintf( ExportFile, "#\n# %s\n#\n", CONV_TO_UTF8( LibEntry->m_Name.m_Text ) );
/* Generation des lignes utiles */ /* Generation des lignes utiles */
fprintf(ExportFile,"DEF"); fprintf( ExportFile, "DEF" );
if( (LibEntry->m_Name.m_Attributs & TEXT_NO_VISIBLE) == 0) if( (LibEntry->m_Name.m_Attributs & TEXT_NO_VISIBLE) == 0 )
fprintf(ExportFile," %s", CONV_TO_UTF8(LibEntry->m_Name.m_Text)); fprintf( ExportFile, " %s", CONV_TO_UTF8( LibEntry->m_Name.m_Text ) );
else fprintf(ExportFile," ~%s", CONV_TO_UTF8(LibEntry->m_Name.m_Text)); else
fprintf( ExportFile, " ~%s", CONV_TO_UTF8( LibEntry->m_Name.m_Text ) );
if( ! LibEntry->m_Prefix.m_Text.IsEmpty()) if( !LibEntry->m_Prefix.m_Text.IsEmpty() )
fprintf(ExportFile," %s", CONV_TO_UTF8(LibEntry->m_Prefix.m_Text)); fprintf( ExportFile, " %s", CONV_TO_UTF8( LibEntry->m_Prefix.m_Text ) );
else fprintf(ExportFile," ~"); else
fprintf(ExportFile," %d %d %c %c %d %c %c\n", fprintf( ExportFile, " ~" );
fprintf( ExportFile, " %d %d %c %c %d %c %c\n",
UNUSED, LibEntry->m_TextInside, UNUSED, LibEntry->m_TextInside,
LibEntry->m_DrawPinNum ? 'Y' : 'N', LibEntry->m_DrawPinNum ? 'Y' : 'N',
LibEntry->m_DrawPinName ? 'Y' : 'N', LibEntry->m_DrawPinName ? 'Y' : 'N',
LibEntry->m_UnitCount, LibEntry->m_UnitSelectionLocked ? 'L' : 'F', LibEntry->m_UnitCount, LibEntry->m_UnitSelectionLocked ? 'L' : 'F',
LibEntry->m_Options == ENTRY_POWER ? 'P' : 'N'); LibEntry->m_Options == ENTRY_POWER ? 'P' : 'N' );
WriteLibEntryDateAndTime(ExportFile, LibEntry); WriteLibEntryDateAndTime( ExportFile, LibEntry );
/* Position / orientation / visibilite des champs */ /* Position / orientation / visibilite des champs */
LibEntry->m_Prefix.WriteDescr( ExportFile ); LibEntry->m_Prefix.WriteDescr( ExportFile );
LibEntry->m_Name.WriteDescr( ExportFile ); LibEntry->m_Name.WriteDescr( ExportFile );
for ( Field = LibEntry->Fields; Field!= NULL; for( Field = LibEntry->Fields; Field!= NULL;
Field = (LibDrawField*)Field->Pnext ) Field = (LibDrawField*) Field->Pnext )
{ {
if( Field->m_Text.IsEmpty() && Field->m_Name.IsEmpty() ) continue; if( Field->m_Text.IsEmpty() && Field->m_Name.IsEmpty() )
continue;
Field->WriteDescr( ExportFile ); Field->WriteDescr( ExportFile );
} }
/* Sauvegarde de la ligne "ALIAS" */ /* Sauvegarde de la ligne "ALIAS" */
if( LibEntry->m_AliasList.GetCount() != 0) if( LibEntry->m_AliasList.GetCount() != 0 )
{ {
fprintf(ExportFile,"ALIAS"); fprintf( ExportFile, "ALIAS" );
unsigned ii; unsigned ii;
for ( ii = 0; ii < LibEntry->m_AliasList.GetCount(); ii++ ) for( ii = 0; ii < LibEntry->m_AliasList.GetCount(); ii++ )
fprintf(ExportFile," %s", CONV_TO_UTF8(LibEntry->m_AliasList[ii])); fprintf( ExportFile, " %s", CONV_TO_UTF8( LibEntry->m_AliasList[ii] ) );
fprintf(ExportFile,"\n");
fprintf( ExportFile, "\n" );
} }
/* Write the footprint filter list */ /* Write the footprint filter list */
if( LibEntry->m_FootprintList.GetCount() != 0) if( LibEntry->m_FootprintList.GetCount() != 0 )
{ {
fprintf(ExportFile,"$FPLIST\n"); fprintf( ExportFile, "$FPLIST\n" );
unsigned ii; unsigned ii;
for ( ii = 0; ii < LibEntry->m_FootprintList.GetCount(); ii++ ) for( ii = 0; ii < LibEntry->m_FootprintList.GetCount(); ii++ )
fprintf(ExportFile," %s\n", CONV_TO_UTF8(LibEntry->m_FootprintList[ii])); fprintf( ExportFile, " %s\n", CONV_TO_UTF8( LibEntry->m_FootprintList[ii] ) );
fprintf(ExportFile,"$ENDFPLIST\n");
fprintf( ExportFile, "$ENDFPLIST\n" );
} }
/* Sauvegarde des elements de trace */ /* Sauvegarde des elements de trace */
DrawEntry = LibEntry->m_Drawings; DrawEntry = LibEntry->m_Drawings;
if(LibEntry->m_Drawings) if( LibEntry->m_Drawings )
{ {
/* we sort the draw items, in order to have an edition more easy, /* we sort the draw items, in order to have an edition more easy,
when a file editing "by hand" is made */ * when a file editing "by hand" is made */
LibEntry->SortDrawItems(); LibEntry->SortDrawItems();
fprintf(ExportFile,"DRAW\n"); fprintf( ExportFile, "DRAW\n" );
DrawEntry = LibEntry->m_Drawings; DrawEntry = LibEntry->m_Drawings;
while( DrawEntry ) while( DrawEntry )
{ {
switch( DrawEntry->m_StructType) switch( DrawEntry->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
#define DRAWSTRUCT ((LibDrawArc *) DrawEntry) #define DRAWSTRUCT ( (LibDrawArc*) DrawEntry )
DRAWSTRUCT->WriteDescr( ExportFile ); DRAWSTRUCT->WriteDescr( ExportFile );
break; break;
case COMPONENT_CIRCLE_DRAW_TYPE: case COMPONENT_CIRCLE_DRAW_TYPE:
#undef DRAWSTRUCT #undef DRAWSTRUCT
#define DRAWSTRUCT ((LibDrawCircle *) DrawEntry) #define DRAWSTRUCT ( (LibDrawCircle*) DrawEntry )
DRAWSTRUCT->WriteDescr( ExportFile ); DRAWSTRUCT->WriteDescr( ExportFile );
break; break;
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE: case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
#undef DRAWSTRUCT #undef DRAWSTRUCT
#define DRAWSTRUCT ((LibDrawText *) DrawEntry) #define DRAWSTRUCT ( (LibDrawText*) DrawEntry )
DRAWSTRUCT->WriteDescr( ExportFile ); DRAWSTRUCT->WriteDescr( ExportFile );
break; break;
case COMPONENT_RECT_DRAW_TYPE: case COMPONENT_RECT_DRAW_TYPE:
#undef DRAWSTRUCT #undef DRAWSTRUCT
#define DRAWSTRUCT ((LibDrawSquare *) DrawEntry) #define DRAWSTRUCT ( (LibDrawSquare*) DrawEntry )
DRAWSTRUCT->WriteDescr( ExportFile ); DRAWSTRUCT->WriteDescr( ExportFile );
break; break;
case COMPONENT_PIN_DRAW_TYPE: case COMPONENT_PIN_DRAW_TYPE:
#undef DRAWSTRUCT #undef DRAWSTRUCT
#define DRAWSTRUCT ((LibDrawPin *) DrawEntry) #define DRAWSTRUCT ( (LibDrawPin*) DrawEntry )
DRAWSTRUCT->WriteDescr( ExportFile ); DRAWSTRUCT->WriteDescr( ExportFile );
break; break;
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
#undef DRAWSTRUCT #undef DRAWSTRUCT
#define DRAWSTRUCT ((LibDrawPolyline *) DrawEntry) #define DRAWSTRUCT ( (LibDrawPolyline*) DrawEntry )
DRAWSTRUCT->WriteDescr( ExportFile ); DRAWSTRUCT->WriteDescr( ExportFile );
break; break;
default: DisplayError(frame, wxT("Save Lib: Unknown Draw Type")); default:
DisplayError( frame, wxT( "Save Lib: Unknown Draw Type" ) );
break; break;
} }
DrawEntry = DrawEntry->Next(); DrawEntry = DrawEntry->Next();
} }
fprintf(ExportFile,"ENDDRAW\n"); fprintf( ExportFile, "ENDDRAW\n" );
} }
fprintf(ExportFile,"ENDDEF\n"); fprintf( ExportFile, "ENDDEF\n" );
return(0); return 0;
} }
/*************************************************************************/ /*************************************************************************/
int WriteOneDocLibEntry(FILE * ExportFile, EDA_LibComponentStruct * LibEntry) int WriteOneDocLibEntry( FILE* ExportFile, EDA_LibComponentStruct* LibEntry )
/*************************************************************************/ /*************************************************************************/
/* Routine d'ecriture de la doc du composant pointe par LibEntry /* Routine d'ecriture de la doc du composant pointe par LibEntry
dans le fichier ExportFile( qui doit etre deja ouvert) * dans le fichier ExportFile( qui doit etre deja ouvert)
return: 0 si Ok * return: 0 si Ok
1 si err write * 1 si err write
Cependant, si i tous les Pointeurs sur textes sont nulls ( pas de Doc ) * Cependant, si i tous les Pointeurs sur textes sont nulls ( pas de Doc )
rien ne sera ecrit. * rien ne sera ecrit.
*/ */
{ {
if( ( LibEntry->m_Doc.IsEmpty() )
if( (LibEntry->m_Doc.IsEmpty() ) && && ( LibEntry->m_KeyWord.IsEmpty() )
(LibEntry->m_KeyWord.IsEmpty() ) && && ( LibEntry->m_DocFile.IsEmpty() ) )
(LibEntry->m_DocFile.IsEmpty() ) ) return 0;
return(0);
/* Generation des lignes utiles */ /* Generation des lignes utiles */
fprintf(ExportFile,"#\n$CMP %s\n", CONV_TO_UTF8(LibEntry->m_Name.m_Text)); fprintf( ExportFile, "#\n$CMP %s\n", CONV_TO_UTF8( LibEntry->m_Name.m_Text ) );
if( ! LibEntry->m_Doc.IsEmpty()) if( !LibEntry->m_Doc.IsEmpty() )
fprintf(ExportFile,"D %s\n", CONV_TO_UTF8(LibEntry->m_Doc)); fprintf( ExportFile, "D %s\n", CONV_TO_UTF8( LibEntry->m_Doc ) );
if( ! LibEntry->m_KeyWord.IsEmpty()) if( !LibEntry->m_KeyWord.IsEmpty() )
fprintf(ExportFile,"K %s\n", CONV_TO_UTF8(LibEntry->m_KeyWord)); fprintf( ExportFile, "K %s\n", CONV_TO_UTF8( LibEntry->m_KeyWord ) );
if( ! LibEntry->m_DocFile.IsEmpty()) if( !LibEntry->m_DocFile.IsEmpty() )
fprintf(ExportFile,"F %s\n", CONV_TO_UTF8(LibEntry->m_DocFile)); fprintf( ExportFile, "F %s\n", CONV_TO_UTF8( LibEntry->m_DocFile ) );
fprintf(ExportFile,"$ENDCMP\n"); fprintf( ExportFile, "$ENDCMP\n" );
return(0); return 0;
} }
/*********************************************************************************/ /*********************************************************************************/
int SaveOneLibrary(wxWindow * frame, const wxString & FullFileName, LibraryStruct * Library) int SaveOneLibrary( wxWindow* frame, const wxString& FullFileName, LibraryStruct* Library )
/*********************************************************************************/ /*********************************************************************************/
/* Sauvegarde en fichier la librairie pointee par Library, sous le nom /* Sauvegarde en fichier la librairie pointee par Library, sous le nom
FullFileName. * FullFileName.
2 fichiers sont crees * 2 fichiers sont crees
- La librarie * - La librarie
- le fichier de documentation * - le fichier de documentation
*
une sauvegarde .bak de l'ancien fichier librairie est cree * une sauvegarde .bak de l'ancien fichier librairie est cree
une sauvegarde .bck de l'ancien fichier documentation est cree * une sauvegarde .bck de l'ancien fichier documentation est cree
*
return: * return:
0 si OK * 0 si OK
1 si erreur * 1 si erreur
*/ */
{ {
FILE * SaveFile, * SaveDocFile; FILE* SaveFile, * SaveDocFile;
EDA_LibComponentStruct *LibEntry; EDA_LibComponentStruct* LibEntry;
char Line[1024]; char Line[1024];
int err = 1; int err = 1;
wxString Name,DocName,BakName, msg; wxString Name, DocName, BakName, msg;
if(Library == NULL) return(err); if( Library == NULL )
return err;
Name = FullFileName; Name = FullFileName;
/* L'ancien fichier lib est renomme en .bak */ /* L'ancien fichier lib est renomme en .bak */
if( wxFileExists(Name) ) if( wxFileExists( Name ) )
{ {
BakName = Name; ChangeFileNameExt(BakName, wxT(".bak")); BakName = Name; ChangeFileNameExt( BakName, wxT( ".bak" ) );
wxRemoveFile(BakName); wxRemoveFile( BakName );
if( ! wxRenameFile(Name, BakName) ) if( !wxRenameFile( Name, BakName ) )
{ {
msg = wxT("Failed to rename old lib file ") + BakName; msg = wxT( "Failed to rename old lib file " ) + BakName;
DisplayError(frame, msg, 20); DisplayError( frame, msg, 20 );
} }
} }
DocName = Name; ChangeFileNameExt(DocName,DOC_EXT); DocName = Name; ChangeFileNameExt( DocName, DOC_EXT );
/* L'ancien fichier doc lib est renomme en .bck */ /* L'ancien fichier doc lib est renomme en .bck */
if( wxFileExists(DocName) ) if( wxFileExists( DocName ) )
{ {
BakName = DocName; ChangeFileNameExt(BakName, wxT(".bck") ); BakName = DocName; ChangeFileNameExt( BakName, wxT( ".bck" ) );
wxRemoveFile(BakName); wxRemoveFile( BakName );
if( ! wxRenameFile(DocName, BakName) ) if( !wxRenameFile( DocName, BakName ) )
{ {
msg = wxT("Failed to save old doc lib file ") + BakName; msg = wxT( "Failed to save old doc lib file " ) + BakName;
DisplayError(frame, msg, 20); DisplayError( frame, msg, 20 );
} }
} }
SaveFile = wxFopen(Name, wxT("wt") ); SaveFile = wxFopen( Name, wxT( "wt" ) );
if (SaveFile == NULL) if( SaveFile == NULL )
{ {
msg = wxT("Failed to create Lib File ") + Name; msg = wxT( "Failed to create Lib File " ) + Name;
DisplayError(frame, msg, 20); DisplayError( frame, msg, 20 );
return(err); return err;
} }
SaveDocFile = wxFopen(DocName, wxT("wt") ); SaveDocFile = wxFopen( DocName, wxT( "wt" ) );
if (SaveDocFile == NULL) if( SaveDocFile == NULL )
{ {
msg = wxT("Failed to create DocLib File ") + DocName; msg = wxT( "Failed to create DocLib File " ) + DocName;
DisplayError(frame, msg, 20); DisplayError( frame, msg, 20 );
return(err); return err;
} }
Library->m_Modified = 0; Library->m_Modified = 0;
/* Creation de l'entete de la librairie */ /* Creation de l'entete de la librairie */
Library->m_TimeStamp = GetTimeStamp(); Library->m_TimeStamp = GetTimeStamp();
Library->WriteHeader(SaveFile); Library->WriteHeader( SaveFile );
fprintf(SaveDocFile,"%s Date: %s\n", DOCFILE_IDENT, fprintf( SaveDocFile, "%s Date: %s\n", DOCFILE_IDENT,
DateAndTime(Line) ); DateAndTime( Line ) );
/* Sauvegarde des composant: */ /* Sauvegarde des composant: */
PQCompFunc((PQCompFuncType) LibraryEntryCompare); PQCompFunc( (PQCompFuncType) LibraryEntryCompare );
LibEntry = (EDA_LibComponentStruct *) PQFirst(&Library->m_Entries, FALSE); LibEntry = (EDA_LibComponentStruct*) PQFirst( &Library->m_Entries, FALSE );
while( LibEntry ) while( LibEntry )
{ {
err = WriteOneLibEntry(frame, SaveFile, LibEntry); err = WriteOneLibEntry( frame, SaveFile, LibEntry );
err = WriteOneDocLibEntry(SaveDocFile, LibEntry); err = WriteOneDocLibEntry( SaveDocFile, LibEntry );
LibEntry = (EDA_LibComponentStruct *) LibEntry = (EDA_LibComponentStruct*)
PQNext(Library->m_Entries, LibEntry, NULL); PQNext( Library->m_Entries, LibEntry, NULL );
} }
fprintf(SaveFile,"#\n#End Library\n"); fprintf( SaveFile, "#\n#End Library\n" );
fprintf(SaveDocFile,"#\n#End Doc Library\n"); fprintf( SaveDocFile, "#\n#End Doc Library\n" );
fclose(SaveFile); fclose( SaveFile );
fclose(SaveDocFile); fclose( SaveDocFile );
return(err); return err;
} }
/*************************************************************************************/ /*************************************************************************************/
static bool WriteLibEntryDateAndTime(FILE * ExportFile, EDA_LibComponentStruct * LibEntry) static bool WriteLibEntryDateAndTime( FILE* ExportFile, EDA_LibComponentStruct* LibEntry )
/*************************************************************************************/ /*************************************************************************************/
/* lit date et time de modif composant sous le format:
"Ti yy/mm/jj hh:mm:ss"
*/
{
int year,mon,day,hour,min,sec;
if ( LibEntry->m_LastDate == 0 ) return TRUE; /* lit date et time de modif composant sous le format:
* "Ti yy/mm/jj hh:mm:ss"
*/
{
int year, mon, day, hour, min, sec;
if( LibEntry->m_LastDate == 0 )
return TRUE;
sec = LibEntry->m_LastDate & 63; sec = LibEntry->m_LastDate & 63;
min = (LibEntry->m_LastDate >> 6) & 63 ; min = (LibEntry->m_LastDate >> 6) & 63;
hour = (LibEntry->m_LastDate >> 12) & 31; hour = (LibEntry->m_LastDate >> 12) & 31;
day = (LibEntry->m_LastDate >> 17) & 31; day = (LibEntry->m_LastDate >> 17) & 31;
mon = (LibEntry->m_LastDate >> 22) & 15; mon = (LibEntry->m_LastDate >> 22) & 15;
year = (LibEntry->m_LastDate >> 26) + 1990; year = (LibEntry->m_LastDate >> 26) + 1990;
fprintf(ExportFile,"Ti %d/%d/%d %d:%d:%d\n",year,mon,day,hour,min,sec); fprintf( ExportFile, "Ti %d/%d/%d %d:%d:%d\n", year, mon, day, hour, min, sec );
return TRUE; return TRUE;
} }

View File

@ -436,7 +436,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
break; break;
// Ensure the struct is a component (could be a struct of a component, like Field, text..) // Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
case ID_POPUP_SCH_DELETE: case ID_POPUP_SCH_DELETE:
@ -489,7 +489,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_MOVE_CMP_REQUEST: case ID_POPUP_SCH_MOVE_CMP_REQUEST:
// Ensure the struct is a component (could be a struct of a component, like Field, text..) // Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL ) if( m_CurrentScreen->GetCurItem() == NULL )
break; break;
@ -502,7 +502,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_EDIT_CMP: case ID_POPUP_SCH_EDIT_CMP:
// Ensure the struct is a component (could be a struct of a component, like Field, text..) // Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL ) if( m_CurrentScreen->GetCurItem() == NULL )
break; break;
@ -517,7 +517,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ORIENT_NORMAL_CMP: case ID_POPUP_SCH_ORIENT_NORMAL_CMP:
// Ensure the struct is a component (could be a struct of a component, like Field, text..) // Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL ) if( m_CurrentScreen->GetCurItem() == NULL )
break; break;
@ -559,7 +559,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_EDIT_VALUE_CMP: case ID_POPUP_SCH_EDIT_VALUE_CMP:
// Ensure the struct is a component (could be a struct of a component, like Field, text..) // Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL ) if( m_CurrentScreen->GetCurItem() == NULL )
break; break;
@ -570,7 +570,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_EDIT_REF_CMP: case ID_POPUP_SCH_EDIT_REF_CMP:
// Ensure the struct is a component (could be a struct of a component, like Field, text..) // Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL ) if( m_CurrentScreen->GetCurItem() == NULL )
break; break;
@ -581,7 +581,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_EDIT_CONVERT_CMP: case ID_POPUP_SCH_EDIT_CONVERT_CMP:
// Ensure the struct is a component (could be a struct of a component, like Field, text..) // Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL ) if( m_CurrentScreen->GetCurItem() == NULL )
break; break;
@ -595,7 +595,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
{ {
EDA_SchComponentStruct* olditem, * newitem; EDA_SchComponentStruct* olditem, * newitem;
if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
olditem = (EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem(); olditem = (EDA_SchComponentStruct*) m_CurrentScreen->GetCurItem();
if( olditem == NULL ) if( olditem == NULL )
@ -638,7 +638,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_SELECT_UNIT26: case ID_POPUP_SCH_SELECT_UNIT26:
// Ensure the struct is a component (could be a struct of a component, like Field, text..) // Ensure the struct is a component (could be a struct of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL ) if( m_CurrentScreen->GetCurItem() == NULL )
break; break;
@ -652,7 +652,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_DISPLAYDOC_CMP: case ID_POPUP_SCH_DISPLAYDOC_CMP:
// Ensure the struct is a component (could be a piece of a component, like Field, text..) // Ensure the struct is a component (could be a piece of a component, like Field, text..)
if( m_CurrentScreen->GetCurItem()->m_StructType != DRAW_LIB_ITEM_STRUCT_TYPE ) if( m_CurrentScreen->GetCurItem()->Type() != DRAW_LIB_ITEM_STRUCT_TYPE )
m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) ); m_CurrentScreen->SetCurItem( LocateSmallestComponent( GetScreen() ) );
if( m_CurrentScreen->GetCurItem() == NULL ) if( m_CurrentScreen->GetCurItem() == NULL )
break; break;
@ -669,7 +669,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_SCH_ENTER_SHEET: case ID_POPUP_SCH_ENTER_SHEET:
{ {
EDA_BaseStruct* DrawStruct = m_CurrentScreen->GetCurItem(); EDA_BaseStruct* DrawStruct = m_CurrentScreen->GetCurItem();
if( DrawStruct && (DrawStruct->m_StructType == DRAW_SHEET_STRUCT_TYPE) ) if( DrawStruct && (DrawStruct->Type() == DRAW_SHEET_STRUCT_TYPE) )
{ {
InstallNextScreen( (DrawSheetStruct*) DrawStruct ); InstallNextScreen( (DrawSheetStruct*) DrawStruct );
} }
@ -781,7 +781,7 @@ void WinEDA_SchematicFrame::Process_Move_Item( EDA_BaseStruct* DrawStruct,
DrawPanel->MouseToCursorSchema(); DrawPanel->MouseToCursorSchema();
switch( DrawStruct->m_StructType ) switch( DrawStruct->Type() )
{ {
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
break; break;
@ -820,7 +820,7 @@ void WinEDA_SchematicFrame::Process_Move_Item( EDA_BaseStruct* DrawStruct,
wxString msg; wxString msg;
msg.Printf( msg.Printf(
wxT( "WinEDA_SchematicFrame::Move_Item Error: Bad DrawType %d" ), wxT( "WinEDA_SchematicFrame::Move_Item Error: Bad DrawType %d" ),
DrawStruct->m_StructType ); DrawStruct->Type() );
DisplayError( this, msg ); DisplayError( this, msg );
break; break;
} }

View File

@ -1,6 +1,6 @@
/********************************************/ /********************************************/
/* library editor: undo and redo functions */ /* library editor: undo and redo functions */
/********************************************/ /********************************************/
#include "fctsys.h" #include "fctsys.h"
#include "gr_basic.h" #include "gr_basic.h"
@ -14,75 +14,78 @@
#include "protos.h" #include "protos.h"
/* Functions to undo and redo edit commands. /* Functions to undo and redo edit commands.
commmands to undo are in CurrentScreen->m_UndoList * commmands to undo are in CurrentScreen->m_UndoList
commmands to redo are in CurrentScreen->m_RedoList * commmands to redo are in CurrentScreen->m_RedoList
*
m_UndoList and m_RedoList are a linked list of DrawPickedStruct. * m_UndoList and m_RedoList are a linked list of DrawPickedStruct.
each DrawPickedStruct has its .m_Son member pointing to an item to undo or redo, * each DrawPickedStruct has its .m_Son member pointing to an item to undo or redo,
or to a list of DrawPickedStruct which points (.m_PickedStruct membre) * or to a list of DrawPickedStruct which points (.m_PickedStruct membre)
the items to undo or redo * the items to undo or redo
*
there are 3 cases: * there are 3 cases:
- delete item(s) command * - delete item(s) command
- change item(s) command * - change item(s) command
- add item(s) command * - add item(s) command
*
Undo command * Undo command
- delete item(s) command: * - delete item(s) command:
deleted items are moved in undo list * deleted items are moved in undo list
*
- change item(s) command * - change item(s) command
A copy of item(s) is made (a DrawPickedStruct list of wrappers) * A copy of item(s) is made (a DrawPickedStruct list of wrappers)
the .m_Image member of each wrapper points the modified item. * the .m_Image member of each wrapper points the modified item.
*
- add item(s) command * - add item(s) command
A list of item(s) is made * A list of item(s) is made
the .m_Image member of each wrapper points the new item. * the .m_Image member of each wrapper points the new item.
*
Redo command * Redo command
- delete item(s) old command: * - delete item(s) old command:
deleted items are moved in EEDrawList list * deleted items are moved in EEDrawList list
*
- change item(s) command * - change item(s) command
the copy of item(s) is moved in Undo list * the copy of item(s) is moved in Undo list
*
- add item(s) command * - add item(s) command
The list of item(s) is used to create a deleted list in undo list * The list of item(s) is used to create a deleted list in undo list
(same as a delete command) * (same as a delete command)
*
A problem is the hierarchical sheet handling. * A problem is the hierarchical sheet handling.
the data associated (subhierarchy, uno/redo list) is deleted only * the data associated (subhierarchy, uno/redo list) is deleted only
when the sheet is really deleted (i.e. when deleted from undo or redo list) * when the sheet is really deleted (i.e. when deleted from undo or redo list)
and not when it is a copy. * and not when it is a copy.
*/ */
/************************************/ /************************************/
void SwapData(EDA_BaseStruct * Item) void SwapData( EDA_BaseStruct* Item )
/************************************/ /************************************/
/* Used if undo / redo command: /* Used if undo / redo command:
swap data between Item and its copy, pointed by its .m_Image member * swap data between Item and its copy, pointed by its .m_Image member
*/ */
{ {
if ( Item == NULL ) return; if( Item == NULL )
EDA_BaseStruct * image = Item->m_Image; return;
if (image == NULL ) return; EDA_BaseStruct* image = Item->m_Image;
if( image == NULL )
return;
switch ( Item->m_StructType ) switch( Item->Type() )
{ {
case DRAW_POLYLINE_STRUCT_TYPE: case DRAW_POLYLINE_STRUCT_TYPE:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ((DrawPolylineStruct*)Item) #define SOURCE ( (DrawPolylineStruct*) Item )
#define DEST ((DrawPolylineStruct*)image) #define DEST ( (DrawPolylineStruct*) image )
break; break;
case DRAW_JUNCTION_STRUCT_TYPE: case DRAW_JUNCTION_STRUCT_TYPE:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ((DrawJunctionStruct*)Item) #define SOURCE ( (DrawJunctionStruct*) Item )
#define DEST ((DrawJunctionStruct*)image) #define DEST ( (DrawJunctionStruct*) image )
EXCHG(SOURCE->m_Pos, DEST->m_Pos); EXCHG( SOURCE->m_Pos, DEST->m_Pos );
break; break;
case DRAW_LABEL_STRUCT_TYPE: case DRAW_LABEL_STRUCT_TYPE:
@ -90,135 +93,139 @@ void SwapData(EDA_BaseStruct * Item)
case DRAW_TEXT_STRUCT_TYPE: case DRAW_TEXT_STRUCT_TYPE:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ((DrawTextStruct*)Item) #define SOURCE ( (DrawTextStruct*) Item )
#define DEST ((DrawTextStruct*)image) #define DEST ( (DrawTextStruct*) image )
DEST->SwapData(SOURCE); DEST->SwapData( SOURCE );
break; break;
case DRAW_LIB_ITEM_STRUCT_TYPE: case DRAW_LIB_ITEM_STRUCT_TYPE:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ((EDA_SchComponentStruct*)Item) #define SOURCE ( (EDA_SchComponentStruct*) Item )
#define DEST ((EDA_SchComponentStruct*)image) #define DEST ( (EDA_SchComponentStruct*) image )
DEST->SwapData(SOURCE); DEST->SwapData( SOURCE );
break; break;
case DRAW_SEGMENT_STRUCT_TYPE: case DRAW_SEGMENT_STRUCT_TYPE:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ((EDA_DrawLineStruct*)Item) #define SOURCE ( (EDA_DrawLineStruct*) Item )
#define DEST ((EDA_DrawLineStruct*)image) #define DEST ( (EDA_DrawLineStruct*) image )
EXCHG(SOURCE->m_Start, DEST->m_Start); EXCHG( SOURCE->m_Start, DEST->m_Start );
EXCHG(SOURCE->m_End, DEST->m_End); EXCHG( SOURCE->m_End, DEST->m_End );
break; break;
case DRAW_BUSENTRY_STRUCT_TYPE: case DRAW_BUSENTRY_STRUCT_TYPE:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ((DrawBusEntryStruct*)Item) #define SOURCE ( (DrawBusEntryStruct*) Item )
#define DEST ((DrawBusEntryStruct*)image) #define DEST ( (DrawBusEntryStruct*) image )
EXCHG(SOURCE->m_Pos, DEST->m_Pos); EXCHG( SOURCE->m_Pos, DEST->m_Pos );
EXCHG(SOURCE->m_Size, DEST->m_Size); EXCHG( SOURCE->m_Size, DEST->m_Size );
break; break;
case DRAW_SHEET_STRUCT_TYPE: case DRAW_SHEET_STRUCT_TYPE:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ((DrawSheetStruct*)Item) #define SOURCE ( (DrawSheetStruct*) Item )
#define DEST ((DrawSheetStruct*)image) #define DEST ( (DrawSheetStruct*) image )
DEST->SwapData(SOURCE); DEST->SwapData( SOURCE );
break; break;
case DRAW_MARKER_STRUCT_TYPE: case DRAW_MARKER_STRUCT_TYPE:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ((DrawMarkerStruct*)Item) #define SOURCE ( (DrawMarkerStruct*) Item )
#define DEST ((DrawMarkerStruct*)image) #define DEST ( (DrawMarkerStruct*) image )
EXCHG(SOURCE->m_Pos, DEST->m_Pos); EXCHG( SOURCE->m_Pos, DEST->m_Pos );
break; break;
case DRAW_SHEETLABEL_STRUCT_TYPE: case DRAW_SHEETLABEL_STRUCT_TYPE:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ((DrawSheetLabelStruct*)Item) #define SOURCE ( (DrawSheetLabelStruct*) Item )
#define DEST ((DrawSheetLabelStruct*)image) #define DEST ( (DrawSheetLabelStruct*) image )
EXCHG(SOURCE->m_Edge, DEST->m_Edge); EXCHG( SOURCE->m_Edge, DEST->m_Edge );
EXCHG(SOURCE->m_Shape, DEST->m_Shape); EXCHG( SOURCE->m_Shape, DEST->m_Shape );
break; break;
case DRAW_NOCONNECT_STRUCT_TYPE: case DRAW_NOCONNECT_STRUCT_TYPE:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ((DrawNoConnectStruct*)Item) #define SOURCE ( (DrawNoConnectStruct*) Item )
#define DEST ((DrawNoConnectStruct*)image) #define DEST ( (DrawNoConnectStruct*) image )
EXCHG(SOURCE->m_Pos, DEST->m_Pos); EXCHG( SOURCE->m_Pos, DEST->m_Pos );
break; break;
case DRAW_PART_TEXT_STRUCT_TYPE: case DRAW_PART_TEXT_STRUCT_TYPE:
#undef SOURCE #undef SOURCE
#undef DEST #undef DEST
#define SOURCE ((DrawPolylineStruct*)Item) #define SOURCE ( (DrawPolylineStruct*) Item )
#define DEST ((DrawPolylineStruct*)image) #define DEST ( (DrawPolylineStruct*) image )
break; break;
// not directly used in schematic: // not directly used in schematic:
default: default:
DisplayInfo(NULL, wxT("SwapData() error: unexpected type")); DisplayInfo( NULL, wxT( "SwapData() error: unexpected type" ) );
break; break;
} }
} }
/***********************************************************************/ /***********************************************************************/
void WinEDA_SchematicFrame::SaveCopyInUndoList(EDA_BaseStruct * ItemToCopy, void WinEDA_SchematicFrame::SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy,
int flag_type_command) int flag_type_command )
/***********************************************************************/ /***********************************************************************/
/* Create a copy of the current schematic draw list, and put it in the undo list. /* Create a copy of the current schematic draw list, and put it in the undo list.
A DrawPickedStruct wrapper is created to handle the draw list. * A DrawPickedStruct wrapper is created to handle the draw list.
the .m_Son of this wrapper points the list of items * the .m_Son of this wrapper points the list of items
*
flag_type_command = * flag_type_command =
0 (unspecified) * 0 (unspecified)
IS_CHANGED * IS_CHANGED
IS_NEW * IS_NEW
IS_DELETED * IS_DELETED
IS_WIRE_IMAGE * IS_WIRE_IMAGE
*
for 0: only a wrapper is created. The used must init the .Flags member of the * for 0: only a wrapper is created. The used must init the .Flags member of the
wrapper, and add the item list to the wrapper * wrapper, and add the item list to the wrapper
If it is a delete command, items are put on list with the .Flags member set to IS_DELETED. * If it is a delete command, items are put on list with the .Flags member set to IS_DELETED.
When it will be really deleted, the EEDrawList and the subhierarchy will be deleted. * When it will be really deleted, the EEDrawList and the subhierarchy will be deleted.
If it is only a copy, the EEDrawList and the subhierarchy must NOT be deleted. * If it is only a copy, the EEDrawList and the subhierarchy must NOT be deleted.
*
Note: * Note:
Edit wires and busses is a bit complex. * Edit wires and busses is a bit complex.
because when a new wire is added, modifications in wire list * because when a new wire is added, modifications in wire list
(wire concatenation) there are modified items, deleted items and new items * (wire concatenation) there are modified items, deleted items and new items
so flag_type_command is IS_WIRE_IMAGE: the struct ItemToCopy is a list of wires * so flag_type_command is IS_WIRE_IMAGE: the struct ItemToCopy is a list of wires
saved in Undo List (for Undo or Redo commands, saved wires will be exchanged with current wire list * saved in Undo List (for Undo or Redo commands, saved wires will be exchanged with current wire list
*/ */
{ {
EDA_BaseStruct * CopyItem; EDA_BaseStruct* CopyItem;
DrawPickedStruct* NewList = new DrawPickedStruct( NULL );
DrawPickedStruct * NewList = new DrawPickedStruct(NULL);
NewList->m_Flags = flag_type_command; NewList->m_Flags = flag_type_command;
if ( ItemToCopy ) if( ItemToCopy )
{ {
switch ( flag_type_command ) switch( flag_type_command )
{ {
case 0: case 0:
break; break;
case IS_CHANGED: /* Create a copy of schematic */ case IS_CHANGED: /* Create a copy of schematic */
NewList->m_Son = CopyItem = DuplicateStruct(ItemToCopy); NewList->m_Son = CopyItem = DuplicateStruct( ItemToCopy );
if ( ItemToCopy->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE) if( ItemToCopy->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
DrawPickedStruct * PickedList = (DrawPickedStruct *) CopyItem; DrawPickedStruct* PickedList = (DrawPickedStruct*) CopyItem;
while (PickedList) while( PickedList )
{ {
CopyItem = PickedList->m_PickedStruct; CopyItem = PickedList->m_PickedStruct;
CopyItem->m_Flags = flag_type_command; CopyItem->m_Flags = flag_type_command;
PickedList->m_Image = CopyItem->m_Image; PickedList->m_Image = CopyItem->m_Image;
PickedList = (DrawPickedStruct *)PickedList->Pnext; PickedList = (DrawPickedStruct*) PickedList->Pnext;
} }
} }
else else
@ -229,17 +236,17 @@ EDA_BaseStruct * CopyItem;
break; break;
case IS_NEW: case IS_NEW:
if ( ItemToCopy->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE) if( ItemToCopy->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
NewList->m_Son = ItemToCopy; NewList->m_Son = ItemToCopy;
DrawPickedStruct * PickedList = (DrawPickedStruct *) ItemToCopy; DrawPickedStruct* PickedList = (DrawPickedStruct*) ItemToCopy;
while (PickedList) while( PickedList )
{ {
CopyItem = PickedList->m_PickedStruct; CopyItem = PickedList->m_PickedStruct;
PickedList->m_Image = CopyItem; PickedList->m_Image = CopyItem;
PickedList->m_PickedStruct = NULL; PickedList->m_PickedStruct = NULL;
PickedList->m_Flags = flag_type_command; PickedList->m_Flags = flag_type_command;
PickedList = (DrawPickedStruct *)PickedList->Pnext; PickedList = (DrawPickedStruct*) PickedList->Pnext;
} }
} }
else else
@ -248,7 +255,7 @@ EDA_BaseStruct * CopyItem;
} }
break; break;
case IS_NEW|IS_CHANGED: case IS_NEW | IS_CHANGED:
case IS_WIRE_IMAGE: case IS_WIRE_IMAGE:
NewList->m_Son = ItemToCopy; NewList->m_Son = ItemToCopy;
break; break;
@ -256,47 +263,50 @@ EDA_BaseStruct * CopyItem;
case IS_DELETED: case IS_DELETED:
NewList->m_Son = ItemToCopy; NewList->m_Son = ItemToCopy;
ItemToCopy->m_Flags = flag_type_command; ItemToCopy->m_Flags = flag_type_command;
if ( ItemToCopy->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) if( ItemToCopy->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
DrawPickedStruct * PickedList = (DrawPickedStruct *) ItemToCopy; DrawPickedStruct* PickedList = (DrawPickedStruct*) ItemToCopy;
while (PickedList) while( PickedList )
{ {
CopyItem = PickedList->m_PickedStruct; CopyItem = PickedList->m_PickedStruct;
CopyItem->m_Flags = flag_type_command; CopyItem->m_Flags = flag_type_command;
PickedList->m_Flags = flag_type_command; PickedList->m_Flags = flag_type_command;
PickedList = (DrawPickedStruct *)PickedList->Pnext; PickedList = (DrawPickedStruct*) PickedList->Pnext;
} }
} }
break; break;
default: default:
DisplayError(this, wxT("SaveCopyInUndoList() error")); DisplayError( this, wxT( "SaveCopyInUndoList() error" ) );
break; break;
} }
} }
/* Save the copy in undo list */ /* Save the copy in undo list */
GetScreen()->AddItemToUndoList(NewList); GetScreen()->AddItemToUndoList( NewList );
/* Clear redo list, because after new save there is no redo to do */ /* Clear redo list, because after new save there is no redo to do */
GetScreen()->ClearUndoORRedoList(GetScreen()->m_RedoList); GetScreen()->ClearUndoORRedoList( GetScreen()->m_RedoList );
GetScreen()->m_RedoList = NULL; GetScreen()->m_RedoList = NULL;
} }
/**********************************************************/ /**********************************************************/
void WinEDA_SchematicFrame::GetSchematicFromRedoList(void) void WinEDA_SchematicFrame::GetSchematicFromRedoList()
/**********************************************************/ /**********************************************************/
/* Redo the last edition: /* Redo the last edition:
- Save the current schematic in undo list * - Save the current schematic in undo list
- Get the old version * - Get the old version
*/ */
{ {
if ( GetScreen()->m_RedoList == NULL ) return; if( GetScreen()->m_RedoList == NULL )
return;
/* Get the old wrapper and put it in UndoList */ /* Get the old wrapper and put it in UndoList */
DrawPickedStruct * List = (DrawPickedStruct *)GetScreen()->GetItemFromRedoList(); DrawPickedStruct* List = (DrawPickedStruct*) GetScreen()->GetItemFromRedoList();
GetScreen()->AddItemToUndoList(List); GetScreen()->AddItemToUndoList( List );
/* Redo the command: */ /* Redo the command: */
PutDataInPreviousState(List); PutDataInPreviousState( List );
CurrentDrawItem = NULL; CurrentDrawItem = NULL;
GetScreen()->SetModify(); GetScreen()->SetModify();
@ -306,48 +316,49 @@ void WinEDA_SchematicFrame::GetSchematicFromRedoList(void)
/***************************************************************************/ /***************************************************************************/
void WinEDA_SchematicFrame::PutDataInPreviousState(DrawPickedStruct * List) void WinEDA_SchematicFrame::PutDataInPreviousState( DrawPickedStruct* List )
/***************************************************************************/ /***************************************************************************/
/* Used in undo or redo command.
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;
DrawPickedStruct * PickedList;
switch ( List->m_Flags ) /* Used in undo or redo command.
* 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;
DrawPickedStruct* PickedList;
switch( List->m_Flags )
{ {
case IS_CHANGED: /* Exchange old and new data for each item */ case IS_CHANGED: /* Exchange old and new data for each item */
if ( FirstItem == NULL ) if( FirstItem == NULL )
{ {
DisplayError(this, wxT("PutDataInPreviousState() error : Null item")); DisplayError( this, wxT( "PutDataInPreviousState() error : Null item" ) );
break; break;
} }
if ( FirstItem->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE) if( FirstItem->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
DrawPickedStruct * PickedList = (DrawPickedStruct *) FirstItem; DrawPickedStruct* PickedList = (DrawPickedStruct*) FirstItem;
while ( PickedList ) while( PickedList )
{ {
SwapData(PickedList->m_PickedStruct); SwapData( PickedList->m_PickedStruct );
PickedList = PickedList->Next(); PickedList = PickedList->Next();
} }
} }
else else
{ {
SwapData(FirstItem); SwapData( FirstItem );
} }
break; break;
case IS_NEW: /* new items are deleted */ case IS_NEW: /* new items are deleted */
List->m_Flags = IS_DELETED; List->m_Flags = IS_DELETED;
if ( FirstItem && FirstItem->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE) if( FirstItem && FirstItem->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
PickedList = (DrawPickedStruct *) FirstItem; PickedList = (DrawPickedStruct*) FirstItem;
while ( PickedList ) while( PickedList )
{ {
item = PickedList->m_Image; item = PickedList->m_Image;
GetScreen()->RemoveFromDrawList(item); GetScreen()->RemoveFromDrawList( item );
item->m_Flags = IS_DELETED; item->m_Flags = IS_DELETED;
PickedList->m_PickedStruct = item; PickedList->m_PickedStruct = item;
PickedList->m_Flags = IS_DELETED; PickedList->m_Flags = IS_DELETED;
@ -357,7 +368,7 @@ DrawPickedStruct * PickedList;
else else
{ {
FirstItem = List->m_Image; FirstItem = List->m_Image;
GetScreen()->RemoveFromDrawList(FirstItem); GetScreen()->RemoveFromDrawList( FirstItem );
FirstItem->m_Flags = IS_DELETED; FirstItem->m_Flags = IS_DELETED;
List->m_Son = FirstItem; List->m_Son = FirstItem;
} }
@ -365,10 +376,10 @@ DrawPickedStruct * PickedList;
case IS_DELETED: /* deleted items are put in EEdrawList, as new items */ case IS_DELETED: /* deleted items are put in EEdrawList, as new items */
List->m_Flags = IS_NEW; List->m_Flags = IS_NEW;
if ( FirstItem->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE) if( FirstItem->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
PickedList = (DrawPickedStruct *) FirstItem; PickedList = (DrawPickedStruct*) FirstItem;
while ( PickedList ) while( PickedList )
{ {
item = PickedList->m_PickedStruct; item = PickedList->m_PickedStruct;
item->Pnext = GetScreen()->EEDrawList; item->Pnext = GetScreen()->EEDrawList;
@ -392,36 +403,37 @@ DrawPickedStruct * PickedList;
case IS_WIRE_IMAGE: case IS_WIRE_IMAGE:
/* Exchange the current wires and the oild wires */ /* Exchange the current wires and the oild wires */
List->m_Son = GetScreen()->ExtractWires(FALSE); List->m_Son = GetScreen()->ExtractWires( FALSE );
while ( FirstItem ) while( FirstItem )
{ {
EDA_BaseStruct * nextitem = FirstItem->Pnext; EDA_BaseStruct* nextitem = FirstItem->Pnext;
FirstItem->Pnext = GetScreen()->EEDrawList; FirstItem->Pnext = GetScreen()->EEDrawList;
GetScreen()->EEDrawList = FirstItem; GetScreen()->EEDrawList = FirstItem;
FirstItem->m_Flags = 0; FirstItem->m_Flags = 0;
FirstItem = nextitem; FirstItem = nextitem;
} }
break; break;
case IS_NEW|IS_CHANGED: case IS_NEW | IS_CHANGED:
case IS_DELETED|IS_CHANGED: case IS_DELETED | IS_CHANGED:
if ( !FirstItem || FirstItem->m_StructType != DRAW_PICK_ITEM_STRUCT_TYPE) if( !FirstItem || FirstItem->Type() != DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
DisplayError(this, wxT("GetSchematicFromUndoList() error: Pickstruct expected")); DisplayError( this, wxT( "GetSchematicFromUndoList() error: Pickstruct expected" ) );
break; break;
} }
PickedList = (DrawPickedStruct *) FirstItem; PickedList = (DrawPickedStruct*) FirstItem;
while ( PickedList ) while( PickedList )
{ {
switch (PickedList->m_Flags) switch( PickedList->m_Flags )
{ {
case IS_CHANGED: case IS_CHANGED:
SwapData(PickedList->m_PickedStruct); SwapData( PickedList->m_PickedStruct );
break; break;
case IS_NEW: case IS_NEW:
item = PickedList->m_Image; item = PickedList->m_Image;
GetScreen()->RemoveFromDrawList(item); GetScreen()->RemoveFromDrawList( item );
item->m_Flags = IS_DELETED; item->m_Flags = IS_DELETED;
PickedList->m_PickedStruct = item; PickedList->m_PickedStruct = item;
PickedList->m_Flags = IS_DELETED; PickedList->m_Flags = IS_DELETED;
@ -437,31 +449,36 @@ DrawPickedStruct * PickedList;
PickedList->m_Flags = IS_NEW; PickedList->m_Flags = IS_NEW;
break; break;
} }
PickedList = PickedList->Next(); PickedList = PickedList->Next();
} }
break; break;
default: default:
DisplayError(this, wxT("GetSchematicFromUndoList() error: Unknown cmd")); DisplayError( this, wxT( "GetSchematicFromUndoList() error: Unknown cmd" ) );
break; break;
} }
} }
/**********************************************************/ /**********************************************************/
void WinEDA_SchematicFrame::GetSchematicFromUndoList(void) void WinEDA_SchematicFrame::GetSchematicFromUndoList()
/**********************************************************/ /**********************************************************/
/* Undo the last edition: /* Undo the last edition:
- Save the current schematic in Redo list * - Save the current schematic in Redo list
- Get an old version of the schematic * - Get an old version of the schematic
*/ */
{ {
if ( GetScreen()->m_UndoList == NULL ) return; if( GetScreen()->m_UndoList == NULL )
return;
/* Get the old wrapper and put it in RedoList (the real data list is the m_Son member) */ /* Get the old wrapper and put it in RedoList (the real data list is the m_Son member) */
DrawPickedStruct * List = (DrawPickedStruct *)GetScreen()->GetItemFromUndoList(); DrawPickedStruct* List = (DrawPickedStruct*) GetScreen()->GetItemFromUndoList();
GetScreen()->AddItemToRedoList(List); GetScreen()->AddItemToRedoList( List );
/* Undo the command */ /* Undo the command */
PutDataInPreviousState(List); PutDataInPreviousState( List );
CurrentDrawItem = NULL; CurrentDrawItem = NULL;
GetScreen()->SetModify(); GetScreen()->SetModify();
@ -471,21 +488,23 @@ void WinEDA_SchematicFrame::GetSchematicFromUndoList(void)
/*********************************************************/ /*********************************************************/
void SCH_SCREEN::ClearUndoORRedoList(EDA_BaseStruct *List) void SCH_SCREEN::ClearUndoORRedoList( EDA_BaseStruct* List )
/*********************************************************/ /*********************************************************/
/* free the undo or redo list from List element /* free the undo or redo list from List element
Wrappers are deleted. * Wrappers are deleted.
datas pointed by wrappers are deleted if not flagged IS_NEW * datas pointed by wrappers are deleted if not flagged IS_NEW
because they are copy of used data or they are not in use (DELETED) * because they are copy of used data or they are not in use (DELETED)
*/ */
{ {
EDA_BaseStruct *nextitem; EDA_BaseStruct* nextitem;
EDA_BaseStruct * FirstItem; EDA_BaseStruct* FirstItem;
int CmdType; int CmdType;
if ( List == NULL ) return; if( List == NULL )
return;
for ( ; List != NULL; List = nextitem ) for( ; List != NULL; List = nextitem )
{ {
nextitem = List->Pnext; nextitem = List->Pnext;
FirstItem = List->m_Son; FirstItem = List->m_Son;
@ -493,27 +512,28 @@ int CmdType;
delete List; delete List;
if (FirstItem == NULL ) continue; if( FirstItem == NULL )
continue;
if ( FirstItem->m_StructType == DRAW_PICK_ITEM_STRUCT_TYPE ) if( FirstItem->Type() == DRAW_PICK_ITEM_STRUCT_TYPE )
{ {
EDA_BaseStruct * item; EDA_BaseStruct* item;
DrawPickedStruct * PickedList = (DrawPickedStruct *) FirstItem; DrawPickedStruct* PickedList = (DrawPickedStruct*) FirstItem;
while ( PickedList ) // delete wrapper list and copies while( PickedList ) // delete wrapper list and copies
{ {
item = PickedList->m_PickedStruct; item = PickedList->m_PickedStruct;
if ( item ) if( item )
{ {
if ( item->m_StructType == DRAW_SHEET_STRUCT_TYPE ) if( item->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
DrawSheetStruct * sheet = (DrawSheetStruct*)item; DrawSheetStruct* sheet = (DrawSheetStruct*) item;
/* Delete sub hierarchy if the sheet must be deleted */ /* Delete sub hierarchy if the sheet must be deleted */
if ( (sheet->m_Flags & IS_DELETED) != 0 ) if( (sheet->m_Flags & IS_DELETED) != 0 )
DeleteSubHierarchy(sheet, FALSE); DeleteSubHierarchy( sheet, FALSE );
else /* EEDrawList, UndoList and Redo list are shared, and are deleted else /* EEDrawList, UndoList and Redo list are shared, and are deleted
only if sheet is deleted */ * only if sheet is deleted */
{ {
if ( (item->m_Flags & IS_NEW) == 0 ) if( (item->m_Flags & IS_NEW) == 0 )
{ {
sheet->EEDrawList = NULL; sheet->EEDrawList = NULL;
sheet->m_UndoList = NULL; sheet->m_UndoList = NULL;
@ -521,35 +541,36 @@ int CmdType;
} }
} }
} }
if ( (item->m_Flags & IS_NEW) == 0 ) delete item; if( (item->m_Flags & IS_NEW) == 0 )
delete item;
} }
DrawPickedStruct * wrapper = PickedList; DrawPickedStruct* wrapper = PickedList;
PickedList = PickedList->Next(); PickedList = PickedList->Next();
delete wrapper; delete wrapper;
} }
} }
else // This is a single item: deleted copy else // This is a single item: deleted copy
{ {
if ( CmdType == IS_WIRE_IMAGE ) if( CmdType == IS_WIRE_IMAGE )
{ {
while ( FirstItem ) while( FirstItem )
{ {
EDA_BaseStruct * nextitem = FirstItem->Pnext; EDA_BaseStruct* nextitem = FirstItem->Pnext;
delete FirstItem; delete FirstItem;
FirstItem = nextitem; FirstItem = nextitem;
} }
} }
else else
{ {
if ( FirstItem->m_StructType == DRAW_SHEET_STRUCT_TYPE ) if( FirstItem->Type() == DRAW_SHEET_STRUCT_TYPE )
{ {
DrawSheetStruct * sheet = (DrawSheetStruct*)FirstItem; DrawSheetStruct* sheet = (DrawSheetStruct*) FirstItem;
/* Delete hierarchy if the sheet must be deleted */ /* Delete hierarchy if the sheet must be deleted */
if ( (sheet->m_Flags & IS_DELETED) == IS_DELETED ) if( (sheet->m_Flags & IS_DELETED) == IS_DELETED )
DeleteSubHierarchy(sheet, FALSE); DeleteSubHierarchy( sheet, FALSE );
else else
{ {
if ( (FirstItem->m_Flags & IS_NEW) == 0 ) if( (FirstItem->m_Flags & IS_NEW) == 0 )
{ {
sheet->EEDrawList = NULL; sheet->EEDrawList = NULL;
sheet->m_UndoList = NULL; sheet->m_UndoList = NULL;
@ -557,80 +578,92 @@ int CmdType;
} }
} }
} }
if ( (FirstItem->m_Flags & IS_NEW) == 0 ) delete FirstItem; if( (FirstItem->m_Flags & IS_NEW) == 0 )
delete FirstItem;
} }
} }
} }
} }
/*****************************************/ /*****************************************/
void SCH_SCREEN::ClearUndoRedoList(void) void SCH_SCREEN::ClearUndoRedoList()
/*****************************************/ /*****************************************/
/* free the undo and the redo lists /* free the undo and the redo lists
*/ */
{ {
ClearUndoORRedoList(m_UndoList); m_UndoList = NULL; ClearUndoORRedoList( m_UndoList ); m_UndoList = NULL;
ClearUndoORRedoList(m_RedoList); m_RedoList = NULL; ClearUndoORRedoList( m_RedoList ); m_RedoList = NULL;
} }
/***********************************************************/ /***********************************************************/
void SCH_SCREEN::AddItemToUndoList(EDA_BaseStruct * newitem) void SCH_SCREEN::AddItemToUndoList( EDA_BaseStruct* newitem )
/************************************************************/ /************************************************************/
/* Put newitem in head of undo list /* Put newitem in head of undo list
Deletes olds items if > count max. * Deletes olds items if > count max.
*/ */
{ {
int ii; int ii;
EDA_BaseStruct * item, *nextitem; EDA_BaseStruct* item, * nextitem;
if ( newitem == NULL ) return; if( newitem == NULL )
return;
if ( m_UndoList ) m_UndoList->Pback = newitem; if( m_UndoList )
m_UndoList->Pback = newitem;
newitem->Pnext = m_UndoList; newitem->Pnext = m_UndoList;
newitem->Pback = NULL; newitem->Pback = NULL;
m_UndoList = newitem; m_UndoList = newitem;
/* Free oldest items, if count max reached */ /* Free oldest items, if count max reached */
for ( ii = 0, item = m_UndoList; ii < m_UndoRedoCountMax; ii++ ) for( ii = 0, item = m_UndoList; ii < m_UndoRedoCountMax; ii++ )
{ {
if ( item->Pnext == NULL ) return; if( item->Pnext == NULL )
return;
item = item->Pnext; item = item->Pnext;
} }
if ( item == NULL ) return; if( item == NULL )
return;
nextitem = item->Pnext; nextitem = item->Pnext;
item->Pnext = NULL; // Set end of chain item->Pnext = NULL; // Set end of chain
// Delete the extra items // Delete the extra items
ClearUndoORRedoList(nextitem); ClearUndoORRedoList( nextitem );
} }
/***********************************************************/ /***********************************************************/
void SCH_SCREEN::AddItemToRedoList(EDA_BaseStruct * newitem) void SCH_SCREEN::AddItemToRedoList( EDA_BaseStruct* newitem )
/***********************************************************/ /***********************************************************/
{ {
int ii; int ii;
EDA_BaseStruct * item, *nextitem; EDA_BaseStruct* item, * nextitem;
if ( newitem == NULL ) return; if( newitem == NULL )
return;
newitem->Pback = NULL; newitem->Pback = NULL;
newitem->Pnext = m_RedoList; newitem->Pnext = m_RedoList;
m_RedoList = newitem; m_RedoList = newitem;
/* Free first items, if count max reached */ /* Free first items, if count max reached */
for ( ii = 0, item = m_RedoList; ii < m_UndoRedoCountMax; ii++ ) for( ii = 0, item = m_RedoList; ii < m_UndoRedoCountMax; ii++ )
{ {
if ( item->Pnext == NULL ) break; if( item->Pnext == NULL )
break;
item = item->Pnext; item = item->Pnext;
} }
if ( item == NULL ) return; if( item == NULL )
return;
nextitem = item->Pnext; nextitem = item->Pnext;
item->Pnext = NULL; // Set end of chain item->Pnext = NULL; // Set end of chain
// Delete the extra items // Delete the extra items
ClearUndoORRedoList(nextitem); ClearUndoORRedoList( nextitem );
} }

View File

@ -385,7 +385,7 @@ void WinEDA_SchematicFrame::ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC )
if( Sheet->m_Flags & IS_NEW ) if( Sheet->m_Flags & IS_NEW )
return; return;
if( Sheet->m_StructType != DRAW_SHEET_STRUCT_TYPE ) if( Sheet->Type() != DRAW_SHEET_STRUCT_TYPE )
{ {
DisplayError( this, wxT( "WinEDA_SchematicFrame::ReSizeSheet: Bad SructType" ) ); DisplayError( this, wxT( "WinEDA_SchematicFrame::ReSizeSheet: Bad SructType" ) );
return; return;
@ -420,7 +420,7 @@ void WinEDA_SchematicFrame::ReSizeSheet( DrawSheetStruct* Sheet, wxDC* DC )
void WinEDA_SchematicFrame::StartMoveSheet( DrawSheetStruct* Sheet, wxDC* DC ) void WinEDA_SchematicFrame::StartMoveSheet( DrawSheetStruct* Sheet, wxDC* DC )
/*********************************************************************************/ /*********************************************************************************/
{ {
if( (Sheet == NULL) || ( Sheet->m_StructType != DRAW_SHEET_STRUCT_TYPE) ) if( (Sheet == NULL) || ( Sheet->Type() != DRAW_SHEET_STRUCT_TYPE) )
return; return;
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
@ -573,7 +573,7 @@ void DrawSheetStruct::CleanupSheet( WinEDA_SchematicFrame* frame, wxDC* DC )
DrawGlobalLabelStruct* GLabel = NULL; DrawGlobalLabelStruct* GLabel = NULL;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
{ {
if( DrawStruct->m_StructType != DRAW_GLOBAL_LABEL_STRUCT_TYPE ) if( DrawStruct->Type() != DRAW_GLOBAL_LABEL_STRUCT_TYPE )
continue; continue;
GLabel = (DrawGlobalLabelStruct*) DrawStruct; GLabel = (DrawGlobalLabelStruct*) DrawStruct;
if( Pinsheet->m_Text.CmpNoCase( GLabel->m_Text ) == 0 ) if( Pinsheet->m_Text.CmpNoCase( GLabel->m_Text ) == 0 )

View File

@ -54,7 +54,7 @@ public:
WinEDA_PinSheetPropertiesFrame( WinEDA_SchematicFrame* parent, WinEDA_PinSheetPropertiesFrame( WinEDA_SchematicFrame* parent,
DrawSheetLabelStruct* curr_pinsheet, DrawSheetLabelStruct* curr_pinsheet,
const wxPoint& framepos = wxPoint( -1, -1 ) ); const wxPoint& framepos = wxPoint( -1, -1 ) );
~WinEDA_PinSheetPropertiesFrame( void ) { }; ~WinEDA_PinSheetPropertiesFrame() { };
private: private:
void PinSheetPropertiesAccept( wxCommandEvent& event ); void PinSheetPropertiesAccept( wxCommandEvent& event );
@ -371,7 +371,7 @@ DrawSheetLabelStruct* WinEDA_SchematicFrame::Import_PinSheet( DrawSheetStruct* S
GLabel = NULL; GLabel = NULL;
for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext ) for( ; DrawStruct != NULL; DrawStruct = DrawStruct->Pnext )
{ {
if( DrawStruct->m_StructType != DRAW_GLOBAL_LABEL_STRUCT_TYPE ) if( DrawStruct->Type() != DRAW_GLOBAL_LABEL_STRUCT_TYPE )
continue; continue;
GLabel = (DrawGlobalLabelStruct*) DrawStruct; GLabel = (DrawGlobalLabelStruct*) DrawStruct;
@ -437,7 +437,7 @@ void WinEDA_SchematicFrame::DeleteSheetLabel( wxDC* DC,
if( DrawStruct ) // Modification du chainage if( DrawStruct ) // Modification du chainage
{ {
if( DrawStruct->m_StructType != DRAW_SHEET_STRUCT_TYPE ) if( DrawStruct->Type() != DRAW_SHEET_STRUCT_TYPE )
{ {
DisplayError( this, DisplayError( this,
wxT( "DeleteSheetLabel error: m_Parent != DRAW_SHEET_STRUCT_TYPE" ) ); wxT( "DeleteSheetLabel error: m_Parent != DRAW_SHEET_STRUCT_TYPE" ) );

View File

@ -71,7 +71,7 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event )
CurrentDrawItem->m_Convert = 0; CurrentDrawItem->m_Convert = 0;
if( m_Filled ) if( m_Filled )
{ {
switch( CurrentDrawItem->m_StructType ) switch( CurrentDrawItem->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
( (LibDrawArc*) CurrentDrawItem )->m_Fill = FlSymbol_Fill; ( (LibDrawArc*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
@ -143,7 +143,7 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
if( CurrentDrawItem->m_Flags & IS_NEW ) if( CurrentDrawItem->m_Flags & IS_NEW )
{ {
if( CurrentDrawItem->m_StructType == COMPONENT_ARC_DRAW_TYPE ) if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE )
{ {
Panel->m_Parent->RedrawActiveWindow( DC, TRUE ); Panel->m_Parent->RedrawActiveWindow( DC, TRUE );
} }
@ -339,7 +339,7 @@ void WinEDA_LibeditFrame::GraphicItemBeginDraw( wxDC* DC )
if( CurrentDrawItem == NULL ) if( CurrentDrawItem == NULL )
return; return;
switch( CurrentDrawItem->m_StructType ) switch( CurrentDrawItem->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
if( StateDrawArc == 1 ) if( StateDrawArc == 1 )
@ -414,7 +414,7 @@ void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos )
int mx = newpos.x, my = newpos.y; int mx = newpos.x, my = newpos.y;
wxSize size; wxSize size;
switch( DrawItem->m_StructType ) switch( DrawItem->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
{ {
@ -485,7 +485,7 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC )
CurrentDrawItem->m_Flags |= IS_MOVED; CurrentDrawItem->m_Flags |= IS_MOVED;
StartCursor = m_CurrentScreen->m_Curseur; StartCursor = m_CurrentScreen->m_Curseur;
switch( CurrentDrawItem->m_StructType ) switch( CurrentDrawItem->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
InitPosition = ( (LibDrawArc*) CurrentDrawItem )->m_Pos; InitPosition = ( (LibDrawArc*) CurrentDrawItem )->m_Pos;
@ -548,7 +548,7 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, 0, 0, DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, 0, 0,
CurrentDrawItem, CurrentUnit, DrawMode ); CurrentDrawItem, CurrentUnit, DrawMode );
if( CurrentDrawItem->m_StructType == COMPONENT_ARC_DRAW_TYPE ) if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE )
{ {
int Color = ReturnLayerColor( LAYER_DEVICE ); int Color = ReturnLayerColor( LAYER_DEVICE );
GRDashedLine( &panel->m_ClipBox, DC, ArcStartX, -ArcStartY, GRDashedLine( &panel->m_ClipBox, DC, ArcStartX, -ArcStartY,
@ -563,7 +563,7 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
} }
} }
switch( CurrentDrawItem->m_StructType ) switch( CurrentDrawItem->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
if( StateDrawArc == 1 ) if( StateDrawArc == 1 )
@ -620,7 +620,7 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
{ {
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, 0, 0, DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, 0, 0,
CurrentDrawItem, CurrentUnit, DrawMode ); CurrentDrawItem, CurrentUnit, DrawMode );
if( CurrentDrawItem->m_StructType == COMPONENT_ARC_DRAW_TYPE ) if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE )
{ {
int Color = ReturnLayerColor( LAYER_DEVICE ); int Color = ReturnLayerColor( LAYER_DEVICE );
GRDashedLine( &panel->m_ClipBox, DC, ArcStartX, -ArcStartY, GRDashedLine( &panel->m_ClipBox, DC, ArcStartX, -ArcStartY,
@ -652,7 +652,7 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
if( CurrentDrawItem == NULL ) if( CurrentDrawItem == NULL )
return; return;
if( CurrentDrawItem->m_StructType == COMPONENT_ARC_DRAW_TYPE ) if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE )
{ {
if( StateDrawArc == 1 ) /* Trace d'arc en cours: doit etre termine */ if( StateDrawArc == 1 ) /* Trace d'arc en cours: doit etre termine */
{ {
@ -673,7 +673,7 @@ void WinEDA_LibeditFrame::EndDrawGraphicItem( wxDC* DC )
CurrentDrawItem->Pnext = CurrentLibEntry->m_Drawings; CurrentDrawItem->Pnext = CurrentLibEntry->m_Drawings;
CurrentLibEntry->m_Drawings = CurrentDrawItem; CurrentLibEntry->m_Drawings = CurrentDrawItem;
switch( CurrentDrawItem->m_StructType ) switch( CurrentDrawItem->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
( (LibDrawArc*) CurrentDrawItem )->m_Fill = FlSymbol_Fill; ( (LibDrawArc*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
@ -821,7 +821,7 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
{ {
if( CurrentDrawItem == NULL ) if( CurrentDrawItem == NULL )
return; return;
if( CurrentDrawItem->m_StructType != COMPONENT_POLYLINE_DRAW_TYPE ) if( CurrentDrawItem->Type() != COMPONENT_POLYLINE_DRAW_TYPE )
return; return;
int* ptpoly; int* ptpoly;

View File

@ -127,7 +127,7 @@ void WinEDA_LibeditFrame::LoadOneSymbol( wxDC* DC )
/********************************************/ /********************************************/
void WinEDA_LibeditFrame::SaveOneSymbol( void ) void WinEDA_LibeditFrame::SaveOneSymbol()
/********************************************/ /********************************************/
/* Save in file the current symbol /* Save in file the current symbol
@ -218,7 +218,7 @@ void WinEDA_LibeditFrame::SaveOneSymbol( void )
if( SymbConvert > 1 ) if( SymbConvert > 1 )
SymbConvert = 1; SymbConvert = 1;
switch( DrawEntry->m_StructType ) switch( DrawEntry->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
#define DRAWSTRUCT ( (LibDrawArc*) DrawEntry ) #define DRAWSTRUCT ( (LibDrawArc*) DrawEntry )
@ -323,14 +323,14 @@ static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
int* ptref, * ptcomp; int* ptref, * ptcomp;
/* Comparaison des proprietes generales */ /* Comparaison des proprietes generales */
if( DEntryRef->m_StructType != DEntryCompare->m_StructType ) if( DEntryRef->Type() != DEntryCompare->Type() )
return FALSE; return FALSE;
if( DEntryRef->m_Unit != DEntryCompare->m_Unit ) if( DEntryRef->m_Unit != DEntryCompare->m_Unit )
return FALSE; return FALSE;
if( DEntryRef->m_Convert != DEntryCompare->m_Convert ) if( DEntryRef->m_Convert != DEntryCompare->m_Convert )
return FALSE; return FALSE;
switch( DEntryRef->m_StructType ) switch( DEntryRef->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
#undef REFSTRUCT #undef REFSTRUCT
@ -427,7 +427,7 @@ static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
/* d'ancrage ( coord 0,0 ). */ /* d'ancrage ( coord 0,0 ). */
/***************************************************************************/ /***************************************************************************/
void WinEDA_LibeditFrame::PlaceAncre( void ) void WinEDA_LibeditFrame::PlaceAncre()
{ {
int ii, * ptsegm; int ii, * ptsegm;
int dx, dy; /* Offsets de deplacement */ int dx, dy; /* Offsets de deplacement */
@ -449,7 +449,7 @@ void WinEDA_LibeditFrame::PlaceAncre( void )
DrawEntry = LibEntry->m_Drawings; DrawEntry = LibEntry->m_Drawings;
while( DrawEntry ) while( DrawEntry )
{ {
switch( DrawEntry->m_StructType ) switch( DrawEntry->Type() )
{ {
case COMPONENT_ARC_DRAW_TYPE: case COMPONENT_ARC_DRAW_TYPE:
#undef STRUCT #undef STRUCT

View File

@ -282,7 +282,7 @@ void WinEDA_LibeditFrame::EditSymbolText(wxDC * DC,
int DrawMode = g_XorMode; int DrawMode = g_XorMode;
if ( DrawItem == NULL ) return; if ( DrawItem == NULL ) return;
if ( DrawItem->m_StructType != COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) return; if ( DrawItem->Type() != COMPONENT_GRAPHIC_TEXT_DRAW_TYPE ) return;
/* Effacement ancien texte */ /* Effacement ancien texte */
if( ((LibDrawText*)DrawItem)->m_Text && DC) if( ((LibDrawText*)DrawItem)->m_Text && DC)

View File

@ -35,7 +35,7 @@
/****************************************************/ /****************************************************/
void WinEDA_LibeditFrame::ReCreateVToolbar( void ) void WinEDA_LibeditFrame::ReCreateVToolbar()
/****************************************************/ /****************************************************/
{ {
if( m_VToolBar == NULL ) if( m_VToolBar == NULL )
@ -100,7 +100,7 @@ void WinEDA_LibeditFrame::ReCreateVToolbar( void )
/*************************************************/ /*************************************************/
void WinEDA_LibeditFrame::ReCreateHToolbar( void ) void WinEDA_LibeditFrame::ReCreateHToolbar()
/*************************************************/ /*************************************************/
/* Create or update the main Horizontal Toolbar for the schematic library editor /* Create or update the main Horizontal Toolbar for the schematic library editor

View File

@ -37,7 +37,7 @@
/**************************************************************/ /**************************************************************/
void WinEDA_SchematicFrame::ReCreateHToolbar( void ) void WinEDA_SchematicFrame::ReCreateHToolbar()
/**************************************************************/ /**************************************************************/
/* Create the main Horizontal Toolbar for the schematic editor /* Create the main Horizontal Toolbar for the schematic editor
@ -144,7 +144,7 @@ void WinEDA_SchematicFrame::ReCreateHToolbar( void )
/*************************************************/ /*************************************************/
void WinEDA_SchematicFrame::ReCreateVToolbar( void ) void WinEDA_SchematicFrame::ReCreateVToolbar()
/*************************************************/ /*************************************************/
/* Create Vertical Right Toolbar /* Create Vertical Right Toolbar
@ -239,7 +239,7 @@ void WinEDA_SchematicFrame::ReCreateVToolbar( void )
/****************************************************************/ /****************************************************************/
void WinEDA_SchematicFrame::ReCreateOptToolbar( void ) void WinEDA_SchematicFrame::ReCreateOptToolbar()
/****************************************************************/ /****************************************************************/
/* Create Vertical Left Toolbar (Option Toolbar) /* Create Vertical Left Toolbar (Option Toolbar)

View File

@ -25,7 +25,7 @@ void Affiche_Infos_PCB_Texte( WinEDA_BasePcbFrame* frame, TEXTE_PCB* pt_texte )
frame->MsgPanel->EraseMsgBox(); frame->MsgPanel->EraseMsgBox();
if( pt_texte->m_StructType == TYPECOTATION ) if( pt_texte->Type() == TYPECOTATION )
Affiche_1_Parametre( frame, 1, _( "COTATION" ), pt_texte->m_Text, DARKGREEN ); Affiche_1_Parametre( frame, 1, _( "COTATION" ), pt_texte->m_Text, DARKGREEN );
else else
@ -74,7 +74,7 @@ void Affiche_Infos_Piste( WinEDA_BasePcbFrame* frame, TRACK* pt_piste )
d_index = pt_piste->m_NetCode; d_index = pt_piste->m_NetCode;
pt_D_code = ReturnToolDescr( layer, d_index, &ii ); pt_D_code = ReturnToolDescr( layer, d_index, &ii );
switch( pt_piste->m_StructType ) switch( pt_piste->Type() )
{ {
case TYPETRACK: case TYPETRACK:
if( pt_piste->m_Shape < S_SPOT_CIRCLE ) if( pt_piste->m_Shape < S_SPOT_CIRCLE )

View File

@ -62,7 +62,7 @@ TRACK* WinEDA_GerberFrame::Delete_Segment( wxDC* DC, TRACK* Track )
g_CurrentTrackSegment = (TRACK*) g_CurrentTrackSegment->Pback; g_CurrentTrackSegment = (TRACK*) g_CurrentTrackSegment->Pback;
delete Track; g_TrackSegmentCount--; delete Track; g_TrackSegmentCount--;
if( g_TrackSegmentCount && (g_CurrentTrackSegment->m_StructType == TYPEVIA) ) if( g_TrackSegmentCount && (g_CurrentTrackSegment->Type() == TYPEVIA) )
{ {
Track = g_CurrentTrackSegment; Track = g_CurrentTrackSegment;
g_CurrentTrackSegment = (TRACK*) g_CurrentTrackSegment->Pback; g_CurrentTrackSegment = (TRACK*) g_CurrentTrackSegment->Pback;

View File

@ -30,12 +30,12 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
{ {
if( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours if( DrawStruct && DrawStruct->m_Flags ) // Commande "POPUP" en cours
{ {
switch( DrawStruct->m_StructType ) switch( DrawStruct->Type() )
{ {
default: default:
msg.Printf( msg.Printf(
wxT( "WinEDA_GerberFrame::ProcessCommand err: Struct %d, m_Flags = %X" ), wxT( "WinEDA_GerberFrame::ProcessCommand err: Struct %d, m_Flags = %X" ),
(unsigned) DrawStruct->m_StructType, (unsigned) DrawStruct->Type(),
(unsigned) DrawStruct->m_Flags ); (unsigned) DrawStruct->m_Flags );
DisplayError( this, msg ); DisplayError( this, msg );
} }
@ -60,7 +60,7 @@ void WinEDA_GerberFrame::OnLeftClick( wxDC* DC, const wxPoint& MousePos )
DrawStruct = GerberGeneralLocateAndDisplay(); DrawStruct = GerberGeneralLocateAndDisplay();
if( DrawStruct == NULL ) if( DrawStruct == NULL )
break; break;
if( DrawStruct->m_StructType == TYPETRACK ) if( DrawStruct->Type() == TYPETRACK )
{ {
Delete_Segment( DC, (TRACK*) DrawStruct ); Delete_Segment( DC, (TRACK*) DrawStruct );
GetScreen()->SetCurItem( NULL ); GetScreen()->SetCurItem( NULL );
@ -309,13 +309,13 @@ static void Process_Move_Item( WinEDA_GerberFrame* frame,
frame->DrawPanel->MouseToCursorSchema(); frame->DrawPanel->MouseToCursorSchema();
switch( DrawStruct->m_StructType ) switch( DrawStruct->Type() )
{ {
default: default:
wxString msg; wxString msg;
msg.Printf( msg.Printf(
wxT( "WinEDA_LibeditFrame::Move_Item Error: Bad DrawType %d" ), wxT( "WinEDA_LibeditFrame::Move_Item Error: Bad DrawType %d" ),
DrawStruct->m_StructType ); DrawStruct->Type() );
DisplayError( frame, msg ); DisplayError( frame, msg );
break; break;
} }
@ -350,7 +350,7 @@ void WinEDA_GerberFrame::OnLeftDClick( wxDC* DC, const wxPoint& MousePos )
break; break;
// Element localisé // Element localisé
switch( DrawStruct->m_StructType ) switch( DrawStruct->Type() )
{ {
default: default:
break; break;

View File

@ -1,7 +1,7 @@
/* export_to_pcbnew.cpp */ /* export_to_pcbnew.cpp */
/* /*
* Export des couches vers pcbnew * Export the layers to pcbnew
*/ */
#include "fctsys.h" #include "fctsys.h"
@ -119,7 +119,8 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* File,
*/ */
{ {
char Line[256]; char Line[256];
TRACK* track, * next_track; TRACK* track;
TRACK* next_track;
BOARD_ITEM* PtStruct; BOARD_ITEM* PtStruct;
BOARD_ITEM* NextStruct; BOARD_ITEM* NextStruct;
BOARD* GerberPcb = frame->m_Pcb; BOARD* GerberPcb = frame->m_Pcb;
@ -136,6 +137,7 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* File,
int pcb_layer_number = LayerLookUpTable[layer]; int pcb_layer_number = LayerLookUpTable[layer];
if( pcb_layer_number < 0 ) if( pcb_layer_number < 0 )
continue; continue;
if( pcb_layer_number > CMP_N ) if( pcb_layer_number > CMP_N )
{ {
DRAWSEGMENT* drawitem = new DRAWSEGMENT( NULL, TYPEDRAWSEGMENT ); DRAWSEGMENT* drawitem = new DRAWSEGMENT( NULL, TYPEDRAWSEGMENT );
@ -149,47 +151,57 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* File,
} }
else else
{ {
TRACK* newtrack = new TRACK( * track ); TRACK* newtrack;
// replace spots with vias when possible
if( (track->m_Shape == S_SPOT_CIRCLE)
|| (track->m_Shape == S_SPOT_RECT)
|| (track->m_Shape == S_SPOT_OVALE) )
{
newtrack = new SEGVIA( (const SEGVIA&) *track );
// A spot is found, and can be a via: change it to via, and delete other
// spots at same location
newtrack->m_Shape = VIA_NORMALE;
newtrack->SetLayer( 0x0F ); // Layers are 0 to 15 (Cu/Cmp)
newtrack->m_Drill = -1;
// Compute the via position from track position ( Via position is the
// position of the middle of the track segment )
newtrack->m_Start.x = (newtrack->m_Start.x + newtrack->m_End.x) / 2;
newtrack->m_Start.y = (newtrack->m_Start.y + newtrack->m_End.y) / 2;
newtrack->m_End = newtrack->m_Start;
}
else // a true TRACK
{
newtrack = new TRACK( *track );
newtrack->SetLayer( pcb_layer_number ); newtrack->SetLayer( pcb_layer_number );
}
newtrack->Insert( Pcb, NULL ); newtrack->Insert( Pcb, NULL );
} }
} }
/* replace spots by vias when possible */ // delete redundant vias
for( track = Pcb->m_Track; track != NULL; track = (TRACK*) track->Pnext )
{
if( (track->m_Shape != S_SPOT_CIRCLE) && (track->m_Shape != S_SPOT_RECT) &&
(track->m_Shape != S_SPOT_OVALE) )
continue;
/* A spot is found, and can be a via: change it for via, and delete others
* spots at same location */
track->m_Shape = VIA_NORMALE;
track->m_StructType = TYPEVIA;
track->SetLayer( 0x0F ); // Layers are 0 to 15 (Cu/Cmp)
track->m_Drill = -1;
/* Compute the via position from track position ( Via position is the position of the middle of the track segment */
track->m_Start.x = (track->m_Start.x + track->m_End.x) / 2;
track->m_Start.y = (track->m_Start.y + track->m_End.y) / 2;
track->m_End = track->m_Start;
}
/* delete redundant vias */
for( track = Pcb->m_Track; track != NULL; track = track->Next() ) for( track = Pcb->m_Track; track != NULL; track = track->Next() )
{ {
if( track->m_Shape != VIA_NORMALE ) if( track->m_Shape != VIA_NORMALE )
continue; continue;
/* Search and delete others vias*/
// Search and delete others vias
TRACK* alt_track = track->Next(); TRACK* alt_track = track->Next();
for( ; alt_track != NULL; alt_track = next_track ) for( ; alt_track != NULL; alt_track = next_track )
{ {
next_track = (TRACK*) alt_track->Pnext; next_track = alt_track->Next();
if( alt_track->m_Shape != VIA_NORMALE ) if( alt_track->m_Shape != VIA_NORMALE )
continue; continue;
if( alt_track->m_Start != track->m_Start ) if( alt_track->m_Start != track->m_Start )
continue; continue;
/* delete track */
// delete track
alt_track->UnLink(); alt_track->UnLink();
delete alt_track; delete alt_track;
} }
@ -197,17 +209,18 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* File,
// Switch the locale to standard C (needed to print floating point numbers like 1.3) // Switch the locale to standard C (needed to print floating point numbers like 1.3)
setlocale( LC_NUMERIC, "C" ); setlocale( LC_NUMERIC, "C" );
/* Ecriture de l'entete PCB : */
// write the PCB heading
fprintf( File, "PCBNEW-BOARD Version %d date %s\n\n", g_CurrentVersionPCB, fprintf( File, "PCBNEW-BOARD Version %d date %s\n\n", g_CurrentVersionPCB,
DateAndTime( Line ) ); DateAndTime( Line ) );
WriteGeneralDescrPcb( Pcb, File ); WriteGeneralDescrPcb( Pcb, File );
WriteSetup( File, Pcb ); WriteSetup( File, Pcb );
/* Ecriture des donnes utiles du pcb */ // write the useful part of the pcb
PtStruct = Pcb->m_Drawings; PtStruct = Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
switch( PtStruct->m_StructType ) switch( PtStruct->Type() )
{ {
case TYPETEXTE: case TYPETEXTE:
( (TEXTE_PCB*) PtStruct )->WriteTextePcbDescr( File ); ( (TEXTE_PCB*) PtStruct )->WriteTextePcbDescr( File );
@ -232,7 +245,7 @@ static int SavePcbFormatAscii( WinEDA_GerberFrame* frame, FILE* File,
fprintf( File, "$EndBOARD\n" ); fprintf( File, "$EndBOARD\n" );
/* Delete the copy */ // Delete the copy
for( PtStruct = Pcb->m_Drawings; PtStruct != NULL; PtStruct = NextStruct ) for( PtStruct = Pcb->m_Drawings; PtStruct != NULL; PtStruct = NextStruct )
{ {
NextStruct = PtStruct->Next(); NextStruct = PtStruct->Next();

View File

@ -115,7 +115,7 @@ void WinEDA_GerberFrame::Erase_Segments_Pcb( wxDC* DC,
{ {
PtNext = PtStruct->Next(); PtNext = PtStruct->Next();
switch( PtStruct->m_StructType ) switch( PtStruct->Type() )
{ {
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
case TYPETEXTE: case TYPETEXTE:
@ -179,7 +179,7 @@ void WinEDA_GerberFrame::Erase_Textes_Pcb( wxDC* DC, bool query )
for( ; PtStruct != NULL; PtStruct = PtNext ) for( ; PtStruct != NULL; PtStruct = PtNext )
{ {
PtNext = PtStruct->Next(); PtNext = PtStruct->Next();
if( PtStruct->m_StructType == TYPETEXTE ) if( PtStruct->Type() == TYPETEXTE )
DeleteStructure( PtStruct ); DeleteStructure( PtStruct );
} }

View File

@ -57,7 +57,7 @@ EDA_BaseStruct* WinEDA_GerberFrame::Locate( int typeloc )
while( ( TrackLocate = Locate_Pistes( TrackLocate, layer, typeloc ) ) != NULL ) while( ( TrackLocate = Locate_Pistes( TrackLocate, layer, typeloc ) ) != NULL )
{ {
Track = TrackLocate; Track = TrackLocate;
if( TrackLocate->m_StructType == TYPEVIA ) if( TrackLocate->Type() == TYPEVIA )
break; break;
TrackLocate = (TRACK*) TrackLocate->Pnext; TrackLocate = (TRACK*) TrackLocate->Pnext;
} }
@ -112,7 +112,7 @@ DRAWSEGMENT* Locate_Segment_Pcb( BOARD* Pcb, int typeloc )
PtStruct = Pcb->m_Drawings; PtStruct = Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) if( PtStruct->Type() != TYPEDRAWSEGMENT )
continue; continue;
pts = (DRAWSEGMENT*) PtStruct; pts = (DRAWSEGMENT*) PtStruct;
ux0 = pts->m_Start.x; uy0 = pts->m_Start.y; ux0 = pts->m_Start.x; uy0 = pts->m_Start.y;
@ -198,7 +198,7 @@ TRACK* Locate_Pistes( TRACK* start_adresse, wxPoint ref, int Layer )
dx -= ux0; dy -= uy0; dx -= ux0; dy -= uy0;
spot_cX = ref.x - ux0; spot_cY = ref.y - uy0; spot_cX = ref.x - ux0; spot_cY = ref.y - uy0;
if( Track->m_StructType == TYPEVIA ) /* VIA rencontree */ if( Track->Type() == TYPEVIA ) /* VIA rencontree */
{ {
if( (abs( spot_cX ) <= l_piste ) && (abs( spot_cY ) <=l_piste) ) if( (abs( spot_cX ) <= l_piste ) && (abs( spot_cY ) <=l_piste) )
{ {
@ -289,7 +289,7 @@ TEXTE_PCB* Locate_Texte_Pcb( TEXTE_PCB* pt_txt_pcb, int typeloc )
PtStruct = (EDA_BaseStruct*) pt_txt_pcb; PtStruct = (EDA_BaseStruct*) pt_txt_pcb;
for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext ) for( ; PtStruct != NULL; PtStruct = PtStruct->Pnext )
{ {
if( PtStruct->m_StructType != TYPETEXTE ) if( PtStruct->Type() != TYPETEXTE )
continue; continue;
pt_txt_pcb = (TEXTE_PCB*) PtStruct; pt_txt_pcb = (TEXTE_PCB*) PtStruct;

View File

@ -71,7 +71,7 @@ void WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu
GetScreen()->SetCurItem( DrawStruct ); GetScreen()->SetCurItem( DrawStruct );
switch( DrawStruct->m_StructType ) switch( DrawStruct->Type() )
{ {
case TYPETRACK: case TYPETRACK:
@ -84,7 +84,7 @@ void WinEDA_GerberFrame::OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu
default: default:
msg.Printf( msg.Printf(
wxT( "WinEDA_GerberFrame::OnRightClick Error: illegal or unknown DrawType %d" ), wxT( "WinEDA_GerberFrame::OnRightClick Error: illegal or unknown DrawType %d" ),
DrawStruct->m_StructType ); DrawStruct->Type() );
DisplayError( this, msg ); DisplayError( this, msg );
break; break;
} }

View File

@ -8,7 +8,7 @@ int * InstallDialogLayerPairChoice(WinEDA_GerberFrame * parent);
/****************/ /****************/
/* undelete.cpp */ /* undelete.cpp */
/****************/ /****************/
EDA_BaseStruct * SaveItemEfface(EDA_BaseStruct * PtItem, int nbitems); BOARD_ITEM* SaveItemEfface( BOARD_ITEM* PtItem, int nbitems );
/***********/ /***********/

View File

@ -28,7 +28,7 @@ wxString msg;
PtNext = PtStruct->Pnext; PtNext = PtStruct->Pnext;
PtBack = PtStruct->Pback; PtBack = PtStruct->Pback;
switch( PtStruct->m_StructType ) switch( PtStruct->Type() )
{ {
case TYPE_NOT_INIT: case TYPE_NOT_INIT:
DisplayError(NULL, wxT("DeleteStruct: Type NOT_INIT")); DisplayError(NULL, wxT("DeleteStruct: Type NOT_INIT"));
@ -69,7 +69,7 @@ wxString msg;
case TYPEPCB: case TYPEPCB:
default: default:
msg.Printf( wxT("DeleteStructure: unexpected %d type"), msg.Printf( wxT("DeleteStructure: unexpected %d type"),
PtStruct->m_StructType); PtStruct->Type());
DisplayError(NULL, msg); DisplayError(NULL, msg);
break; break;
} }

View File

@ -1,6 +1,6 @@
/********************************************************/ /********************************************************/
/* Effacements : Routines de sauvegarde et d'effacement */ /* Effacements : Routines de sauvegarde et d'effacement */
/********************************************************/ /********************************************************/
#include "fctsys.h" #include "fctsys.h"
@ -14,95 +14,104 @@
/* Routines Locales */ /* Routines Locales */
/***********************************************/ /***********************************************/
void WinEDA_GerberFrame::UnDeleteItem(wxDC * DC) void WinEDA_GerberFrame::UnDeleteItem( wxDC* DC )
/***********************************************/ /***********************************************/
/* Restitution d'un element (MODULE ou TRACK ) Efface /* Restitution d'un element (MODULE ou TRACK ) Efface
*/ */
{ {
EDA_BaseStruct * PtStruct, *PtNext; EDA_BaseStruct* PtStruct, * PtNext;
TRACK * pt_track; TRACK* pt_track;
int net_code; int net_code;
if( ! g_UnDeleteStackPtr ) return; if( !g_UnDeleteStackPtr )
return;
g_UnDeleteStackPtr --; g_UnDeleteStackPtr--;
PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr]; PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr];
if ( PtStruct == NULL ) return; // Ne devrait pas se produire if( PtStruct == NULL )
return; // Ne devrait pas se produire
switch(PtStruct->m_StructType) switch( PtStruct->Type() )
{ {
case TYPEVIA: case TYPEVIA:
case TYPETRACK: case TYPETRACK:
for( ; PtStruct != NULL; PtStruct = PtNext) for( ; PtStruct != NULL; PtStruct = PtNext )
{ {
PtNext = PtStruct->Pnext; PtNext = PtStruct->Pnext;
PtStruct->SetState(DELETED,OFF); /* Effacement du bit DELETED */ PtStruct->SetState( DELETED, OFF ); /* Effacement du bit DELETED */
Trace_Segment(DrawPanel, DC, (TRACK*) PtStruct, GR_OR); Trace_Segment( DrawPanel, DC, (TRACK*) PtStruct, GR_OR );
} }
PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr]; PtStruct = g_UnDeleteStack[g_UnDeleteStackPtr];
net_code = ((TRACK*)PtStruct)->m_NetCode; net_code = ( (TRACK*) PtStruct )->m_NetCode;
pt_track = ( (TRACK*) PtStruct)->GetBestInsertPoint(m_Pcb); pt_track = ( (TRACK*) PtStruct )->GetBestInsertPoint( m_Pcb );
((TRACK*)PtStruct)->Insert(m_Pcb, pt_track); ( (TRACK*) PtStruct )->Insert( m_Pcb, pt_track );
g_UnDeleteStack[g_UnDeleteStackPtr] = NULL; g_UnDeleteStack[g_UnDeleteStackPtr] = NULL;
break; break;
default: default:
DisplayError(this, wxT("Undelete struct: type Struct inattendu")); DisplayError( this, wxT( "Undelete struct: type Struct inattendu" ) );
break; break;
} }
} }
/********************************************************************/ /********************************************************************/
EDA_BaseStruct * SaveItemEfface(EDA_BaseStruct * PtItem, int nbitems) BOARD_ITEM* SaveItemEfface( BOARD_ITEM* PtItem, int nbitems )
/********************************************************************/ /********************************************************************/
/* Sauvegarde d'un element aux fins de restitution par Undelete
Supporte actuellement : Module et segments de piste
*/
{
EDA_BaseStruct * NextS, * PtStruct = PtItem;
int ii;
if( (PtItem == NULL) || (nbitems == 0) ) return NULL;
if (g_UnDeleteStackPtr >= UNDELETE_STACK_SIZE ) /* Sauvegarde d'un element aux fins de restitution par Undelete
* Supporte actuellement : Module et segments de piste
*/
{
BOARD_ITEM* NextS, * PtStruct = PtItem;
int ii;
if( (PtItem == NULL) || (nbitems == 0) )
return NULL;
if( g_UnDeleteStackPtr >= UNDELETE_STACK_SIZE )
{ {
/* Delete last deleted item, and shift stack. */ /* Delete last deleted item, and shift stack. */
DeleteStructure(g_UnDeleteStack[0]); DeleteStructure( g_UnDeleteStack[0] );
for (ii = 0; ii < (g_UnDeleteStackPtr-1); ii++) for( ii = 0; ii < (g_UnDeleteStackPtr - 1); ii++ )
{ {
g_UnDeleteStack[ii] = g_UnDeleteStack[ii + 1]; g_UnDeleteStack[ii] = g_UnDeleteStack[ii + 1];
} }
g_UnDeleteStackPtr--;; g_UnDeleteStackPtr--;;
} }
g_UnDeleteStack[g_UnDeleteStackPtr++] = PtItem; g_UnDeleteStack[g_UnDeleteStackPtr++] = PtItem;
switch ( PtStruct->m_StructType ) switch( PtStruct->Type() )
{ {
case TYPEVIA: case TYPEVIA:
case TYPETRACK: case TYPETRACK:
{ {
EDA_BaseStruct * Back = NULL; EDA_BaseStruct* Back = NULL;
g_UnDeleteStack[g_UnDeleteStackPtr-1] = PtStruct; g_UnDeleteStack[g_UnDeleteStackPtr - 1] = PtStruct;
for ( ; nbitems > 0; nbitems--, PtStruct = NextS) for( ; nbitems > 0; nbitems--, PtStruct = NextS )
{ {
NextS = PtStruct->Pnext; NextS = PtStruct->Next();
((TRACK*)PtStruct)->UnLink(); ( (TRACK*) PtStruct )->UnLink();
PtStruct->SetState(DELETED, ON);
if( nbitems <= 1 ) NextS = NULL; /* fin de chaine */ PtStruct->SetState( DELETED, ON );
if( nbitems <= 1 )
NextS = NULL; /* fin de chaine */
PtStruct->Pnext = NextS; PtStruct->Pnext = NextS;
PtStruct->Pback = Back; Back = PtStruct; PtStruct->Pback = Back; Back = PtStruct;
if(NextS == NULL) break; if( NextS == NULL )
break;
} }
} }
break; break;
default: break; default:
break;
} }
return(g_UnDeleteStack[g_UnDeleteStackPtr-1]); return g_UnDeleteStack[g_UnDeleteStackPtr - 1];
} }

View File

@ -60,21 +60,21 @@ public:
bool m_PdfBrowserIsDefault; // True if the pdf browser is the default (m_PdfBrowser not used) bool m_PdfBrowserIsDefault; // True if the pdf browser is the default (m_PdfBrowser not used)
public: public:
WinEDA_App( void ); WinEDA_App();
~WinEDA_App( void ); ~WinEDA_App();
bool OnInit( void ); bool OnInit();
int OnRun( void ); int OnRun();
bool SetBinDir( void ); bool SetBinDir();
void InitEDA_Appl( const wxString& name ); void InitEDA_Appl( const wxString& name );
bool SetLanguage( bool first_time = FALSE ); bool SetLanguage( bool first_time = FALSE );
wxMenu* SetLanguageList( wxMenu* MasterMenu ); wxMenu* SetLanguageList( wxMenu* MasterMenu );
void SetLanguageIdentifier( int menu_id ); void SetLanguageIdentifier( int menu_id );
void InitOnLineHelp( void ); void InitOnLineHelp();
// Sauvegarde de configurations et options: // Sauvegarde de configurations et options:
void GetSettings( void ); void GetSettings();
void SaveSettings( void ); void SaveSettings();
void SetLastProject( const wxString& FullFileName ); void SetLastProject( const wxString& FullFileName );
void WriteProjectConfig( const wxString& local_config_filename, void WriteProjectConfig( const wxString& local_config_filename,
const wxString& GroupName, PARAM_CFG_BASE** List ); const wxString& GroupName, PARAM_CFG_BASE** List );
@ -83,8 +83,8 @@ public:
const wxString& GroupName, PARAM_CFG_BASE** List, const wxString& GroupName, PARAM_CFG_BASE** List,
bool Load_Only_if_New ); bool Load_Only_if_New );
void ReadPdfBrowserInfos( void ); void ReadPdfBrowserInfos();
void WritePdfBrowserInfos( void ); void WritePdfBrowserInfos();
}; };

View File

@ -126,8 +126,14 @@ public:
class EDA_BaseStruct /* Basic class, not directly used */ class EDA_BaseStruct /* Basic class, not directly used */
{ {
private:
/**
* Run time identification, _keep private_ so it can never be changed after
* a constructor sets it. See comment near SetType() regarding virtual functions.
*/
KICAD_T m_StructType;
public: public:
KICAD_T m_StructType; /* Struct ident for run time identification */
EDA_BaseStruct* Pnext; /* Linked list: Link (next struct) */ EDA_BaseStruct* Pnext; /* Linked list: Link (next struct) */
EDA_BaseStruct* Pback; /* Linked list: Link (previous struct) */ EDA_BaseStruct* Pback; /* Linked list: Link (previous struct) */
EDA_BaseStruct* m_Parent; /* Linked list: Link (parent struct) */ EDA_BaseStruct* m_Parent; /* Linked list: Link (parent struct) */
@ -162,22 +168,43 @@ private:
private: private:
void InitVars(); void InitVars();
protected:
/**
* Function SetType
* is dangerous and should not be used. It is here to work around a design
* issue in the DrawTextStruct -> DrawLabelStruct and
* DrawTextStruct -> DrawGlobalLabelStruct class hierarchy of eeschema.
* Only constructors should set m_StructType and once set, there should be
* no reason to change an object's type. For if you do, you risk mis-matching
* the virtual functions of the object with its Type() function, because the
* virtual function table is set in the call to a constructor and cannot be
* changed later without doing an "in place constructor" call (ugly and dangerous).
*/
void SetType( KICAD_T aType ) { m_StructType = aType; }
public: public:
EDA_BaseStruct( EDA_BaseStruct* parent, KICAD_T idType ); EDA_BaseStruct( EDA_BaseStruct* parent, KICAD_T idType );
EDA_BaseStruct( KICAD_T struct_type ); EDA_BaseStruct( KICAD_T struct_type );
virtual ~EDA_BaseStruct() { }; virtual ~EDA_BaseStruct() { };
EDA_BaseStruct* Next() { return Pnext; } /**
* Function Type
* returns the type of object. This attribute should never be changed after
* a constructor sets it, so there is no public "setter" method.
* @return KICAD_T - the type of object.
*/
KICAD_T Type() const { return m_StructType; }
EDA_BaseStruct* Next() const { return Pnext; }
/* Gestion de l'etat (status) de la structure (active, deleted..) */ /* Gestion de l'etat (status) de la structure (active, deleted..) */
int GetState( int type ); int GetState( int type );
void SetState( int type, int state ); void SetState( int type, int state );
int ReturnStatus() const int ReturnStatus() const { return m_Status; }
{
return m_Status;
}
void SetStatus( int new_status ) void SetStatus( int new_status )
{ {
@ -389,12 +416,14 @@ public:
} }
BOARD_ITEM( const BOARD_ITEM& src ) : BOARD_ITEM( const BOARD_ITEM& src ) :
EDA_BaseStruct( src.m_Parent, src.m_StructType ), EDA_BaseStruct( src.m_Parent, src.Type() ),
m_Layer( src.m_Layer ) m_Layer( src.m_Layer )
{ {
} }
BOARD_ITEM* Next() const { return (BOARD_ITEM*) Pnext; } 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; } BOARD_ITEM* GetParent() const { return (BOARD_ITEM*) m_Parent; }
/** /**

View File

@ -57,16 +57,16 @@ public:
// Constructor and destructor // Constructor and destructor
WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos, const wxSize& size ); WinEDA_DrawPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos, const wxSize& size );
~WinEDA_DrawPanel( void ) { } ~WinEDA_DrawPanel() { }
/****************************/ /****************************/
BASE_SCREEN* GetScreen( void ) { return m_Parent->m_CurrentScreen; } BASE_SCREEN* GetScreen() { return m_Parent->m_CurrentScreen; }
void PrepareGraphicContext( wxDC* DC ); void PrepareGraphicContext( wxDC* DC );
wxPoint CalcAbsolutePosition( const wxPoint& rel_pos ); wxPoint CalcAbsolutePosition( const wxPoint& rel_pos );
bool IsPointOnDisplay( wxPoint ref_pos ); bool IsPointOnDisplay( wxPoint ref_pos );
void OnPaint( wxPaintEvent& event ); void OnPaint( wxPaintEvent& event );
void OnSize( wxSizeEvent& event ); void OnSize( wxSizeEvent& event );
void SetBoundaryBox( void ); void SetBoundaryBox();
void ReDraw( wxDC* DC, bool erasebg = TRUE ); void ReDraw( wxDC* DC, bool erasebg = TRUE );
void PrintPage( wxDC* DC, bool Print_Sheet_Ref, int PrintMask ); void PrintPage( wxDC* DC, bool Print_Sheet_Ref, int PrintMask );
void DrawBackGround( wxDC* DC ); void DrawBackGround( wxDC* DC );
@ -86,18 +86,18 @@ public:
void OnScroll( wxScrollWinEvent& event ); void OnScroll( wxScrollWinEvent& event );
void SetZoom( int mode ); void SetZoom( int mode );
int GetZoom( void ); int GetZoom();
void SetGrid( const wxSize& size ); void SetGrid( const wxSize& size );
wxSize GetGrid( void ); wxSize GetGrid();
void AddMenuZoom( wxMenu* MasterMenu ); void AddMenuZoom( wxMenu* MasterMenu );
void OnRightClick( wxMouseEvent& event ); void OnRightClick( wxMouseEvent& event );
void Process_Popup_Zoom( wxCommandEvent& event ); void Process_Popup_Zoom( wxCommandEvent& event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
wxPoint CursorRealPosition( const wxPoint& ScreenPos ); wxPoint CursorRealPosition( const wxPoint& ScreenPos );
wxPoint CursorScreenPosition( void ); wxPoint CursorScreenPosition();
wxPoint GetScreenCenterRealPosition( void ); wxPoint GetScreenCenterRealPosition();
void MouseToCursorSchema( void ); void MouseToCursorSchema();
void MouseTo( const wxPoint& Mouse ); void MouseTo( const wxPoint& Mouse );
/* Cursor functions */ /* Cursor functions */
@ -156,8 +156,8 @@ public:
* = 0,0 in block paste */ * = 0,0 in block paste */
public: public:
DrawBlockStruct( void ); DrawBlockStruct();
~DrawBlockStruct( void ); ~DrawBlockStruct();
void SetMessageBlock( WinEDA_DrawFrame* frame ); void SetMessageBlock( WinEDA_DrawFrame* frame );
void Draw( WinEDA_DrawPanel* panel, wxDC* DC ); void Draw( WinEDA_DrawPanel* panel, wxDC* DC );
}; };
@ -229,32 +229,32 @@ public:
int m_Zoom; /* coeff de ZOOM */ int m_Zoom; /* coeff de ZOOM */
public: public:
BASE_SCREEN( int idscreen ); BASE_SCREEN( int idscreen, KICAD_T aType = SCREEN_STRUCT_TYPE );
~BASE_SCREEN( void ); ~BASE_SCREEN();
void InitDatas( void );/* Inits completes des variables */ void InitDatas();/* Inits completes des variables */
wxSize ReturnPageSize( void ); wxSize ReturnPageSize();
int GetInternalUnits( void ); int GetInternalUnits();
wxPoint CursorRealPosition( const wxPoint& ScreenPos ); wxPoint CursorRealPosition( const wxPoint& ScreenPos );
/* general Undo/Redo command control */ /* general Undo/Redo command control */
virtual void ClearUndoRedoList( void ); virtual void ClearUndoRedoList();
virtual void AddItemToUndoList( EDA_BaseStruct* item ); virtual void AddItemToUndoList( EDA_BaseStruct* item );
virtual void AddItemToRedoList( EDA_BaseStruct* item ); virtual void AddItemToRedoList( EDA_BaseStruct* item );
virtual EDA_BaseStruct* GetItemFromUndoList( void ); virtual EDA_BaseStruct* GetItemFromUndoList();
virtual EDA_BaseStruct* GetItemFromRedoList( void ); virtual EDA_BaseStruct* GetItemFromRedoList();
/* Manipulation des flags */ /* Manipulation des flags */
void SetRefreshReq( void ) { m_FlagRefreshReq = 1; } void SetRefreshReq() { m_FlagRefreshReq = 1; }
void ClrRefreshReq( void ) { m_FlagRefreshReq = 0; } void ClrRefreshReq() { m_FlagRefreshReq = 0; }
void SetModify( void ) { m_FlagModified = 1; m_FlagSave = 0; } void SetModify() { m_FlagModified = 1; m_FlagSave = 0; }
void ClrModify( void ) { m_FlagModified = 0; m_FlagSave = 1; } void ClrModify() { m_FlagModified = 0; m_FlagSave = 1; }
void SetSave( void ) { m_FlagSave = 1; } void SetSave() { m_FlagSave = 1; }
void ClrSave( void ) { m_FlagSave = 0; } void ClrSave() { m_FlagSave = 0; }
int IsModify( void ) { return m_FlagModified & 1; } int IsModify() { return m_FlagModified & 1; }
int IsRefreshReq( void ) { return m_FlagRefreshReq & 1; } int IsRefreshReq() { return m_FlagRefreshReq & 1; }
int IsSave( void ) { return m_FlagSave & 1; } int IsSave() { return m_FlagSave & 1; }
/** /**
@ -268,22 +268,22 @@ public:
EDA_BaseStruct* GetCurItem() const { return m_CurrentItem; } EDA_BaseStruct* GetCurItem() const { return m_CurrentItem; }
/* fonctions relatives au zoom */ /* fonctions relatives au zoom */
int GetZoom( void ); /* retourne le coeff de zoom */ int GetZoom(); /* retourne le coeff de zoom */
void SetZoom( int coeff ); /* ajuste le coeff de zoom a coeff */ void SetZoom( int coeff ); /* ajuste le coeff de zoom a coeff */
void SetZoomList( int* zoomlist ); /* init liste des zoom (NULL terminated) */ void SetZoomList( int* zoomlist ); /* init liste des zoom (NULL terminated) */
void SetNextZoom( void ); /* ajuste le prochain coeff de zoom */ void SetNextZoom(); /* ajuste le prochain coeff de zoom */
void SetPreviousZoom( void ); /* ajuste le precedent coeff de zoom */ void SetPreviousZoom(); /* ajuste le precedent coeff de zoom */
void SetFirstZoom( void ); /* ajuste le coeff de zoom a 1*/ void SetFirstZoom(); /* ajuste le coeff de zoom a 1*/
void SetLastZoom( void ); /* ajuste le coeff de zoom au max */ void SetLastZoom(); /* ajuste le coeff de zoom au max */
/* fonctions relatives a la grille */ /* fonctions relatives a la grille */
wxSize GetGrid( void ); /* retourne la grille */ wxSize GetGrid(); /* retourne la grille */
void SetGrid( const wxSize& size ); void SetGrid( const wxSize& size );
void SetGridList( wxSize* sizelist ); /* init liste des grilles (NULL terminated) */ void SetGridList( wxSize* sizelist ); /* init liste des grilles (NULL terminated) */
void SetNextGrid( void ); /* ajuste le prochain coeff de grille */ void SetNextGrid(); /* ajuste le prochain coeff de grille */
void SetPreviousGrid( void ); /* ajuste le precedent coeff de grille */ void SetPreviousGrid(); /* ajuste le precedent coeff de grille */
void SetFirstGrid( void ); /* ajuste la grille au mini*/ void SetFirstGrid(); /* ajuste la grille au mini*/
void SetLastGrid( void ); /* ajuste la grille au max */ void SetLastGrid(); /* ajuste la grille au max */
/** /**

View File

@ -169,13 +169,13 @@ public:
WinEDA_BasicFrame( const WinEDA_BasicFrame& ) { } // Should throw!! WinEDA_BasicFrame( const WinEDA_BasicFrame& ) { } // Should throw!!
WinEDA_BasicFrame() { } // Should throw!! WinEDA_BasicFrame() { } // Should throw!!
#endif #endif
~WinEDA_BasicFrame( void ); ~WinEDA_BasicFrame();
void GetKicadHelp( wxCommandEvent& event ); void GetKicadHelp( wxCommandEvent& event );
void GetKicadAbout( wxCommandEvent& event ); void GetKicadAbout( wxCommandEvent& event );
void PrintMsg( const wxString& text ); void PrintMsg( const wxString& text );
void GetSettings( void ); void GetSettings();
void SaveSettings( void ); void SaveSettings();
int WriteHotkeyConfigFile(const wxString & Filename, Ki_HotkeyInfo ** List, bool verbose); int WriteHotkeyConfigFile(const wxString & Filename, Ki_HotkeyInfo ** List, bool verbose);
int ReadHotkeyConfigFile(const wxString & Filename, Ki_HotkeyInfo ** List, bool verbose); int ReadHotkeyConfigFile(const wxString & Filename, Ki_HotkeyInfo ** List, bool verbose);
void SetLanguage( wxCommandEvent& event ); void SetLanguage( wxCommandEvent& event );
@ -184,7 +184,7 @@ public:
wxString GetLastProject( int rang ); wxString GetLastProject( int rang );
void SetLastProject( const wxString& FullFileName ); void SetLastProject( const wxString& FullFileName );
void DisplayActivity( int PerCent, const wxString& Text ); void DisplayActivity( int PerCent, const wxString& Text );
virtual void ReCreateMenuBar( void ); virtual void ReCreateMenuBar();
}; };
@ -233,9 +233,9 @@ public:
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size ); const wxPoint& pos, const wxSize& size );
~WinEDA_DrawFrame( void ); ~WinEDA_DrawFrame();
BASE_SCREEN* GetScreen( void ) { return m_CurrentScreen; } BASE_SCREEN* GetScreen() { return m_CurrentScreen; }
void OnMenuOpen( wxMenuEvent& event ); void OnMenuOpen( wxMenuEvent& event );
void OnMouseEvent( wxMouseEvent& event ); void OnMouseEvent( wxMouseEvent& event );
@ -244,15 +244,15 @@ public:
void ProcessFontPreferences( wxCommandEvent& event ); void ProcessFontPreferences( wxCommandEvent& event );
void Affiche_Message( const wxString& message ); void Affiche_Message( const wxString& message );
void EraseMsgBox( void ); void EraseMsgBox();
void Process_PageSettings( wxCommandEvent& event ); void Process_PageSettings( wxCommandEvent& event );
void SetDrawBgColor( int color_num ); void SetDrawBgColor( int color_num );
virtual void SetToolbars( void ); virtual void SetToolbars();
void SetLanguage( wxCommandEvent& event ); void SetLanguage( wxCommandEvent& event );
virtual void ReCreateHToolbar( void ) = 0; virtual void ReCreateHToolbar() = 0;
virtual void ReCreateVToolbar( void ) = 0; virtual void ReCreateVToolbar() = 0;
virtual void ReCreateMenuBar( void ); virtual void ReCreateMenuBar();
virtual void ReCreateAuxiliaryToolbar( void ); virtual void ReCreateAuxiliaryToolbar();
void SetToolID( int id, int new_cursor_id, const wxString& title ); void SetToolID( int id, int new_cursor_id, const wxString& title );
virtual void OnSelectGrid( wxCommandEvent& event ); virtual void OnSelectGrid( wxCommandEvent& event );
@ -279,13 +279,13 @@ public:
/* Recalcule le zoom et les offsets pour que l'affichage se fasse dans la /* Recalcule le zoom et les offsets pour que l'affichage se fasse dans la
* fenetre de coord x0, y0 a x1, y1 */ * fenetre de coord x0, y0 a x1, y1 */
virtual int BestZoom( void ) = 0; // Retourne le meilleur zoom virtual int BestZoom() = 0; // Retourne le meilleur zoom
void ToPrinter( wxCommandEvent& event ); void ToPrinter( wxCommandEvent& event );
void SVG_Print( wxCommandEvent& event ); void SVG_Print( wxCommandEvent& event );
void OnActivate( wxActivateEvent& event ); void OnActivate( wxActivateEvent& event );
void ReDrawPanel( void ); void ReDrawPanel();
void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width ); void TraceWorkSheet( wxDC* DC, BASE_SCREEN* screen, int line_width );
void DisplayToolMsg( const wxString msg ); void DisplayToolMsg( const wxString msg );
void Process_Zoom( wxCommandEvent& event ); void Process_Zoom( wxCommandEvent& event );
@ -296,9 +296,9 @@ public:
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
virtual void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0; virtual void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual void ToolOnRightClick( wxCommandEvent& event ); virtual void ToolOnRightClick( wxCommandEvent& event );
void AdjustScrollBars( void ); void AdjustScrollBars();
void Affiche_Status_Box( void );/* Affichage des coord curseur, zoom .. */ void Affiche_Status_Box();/* Affichage des coord curseur, zoom .. */
void DisplayUnitsMsg( void ); void DisplayUnitsMsg();
/* Gestion generale des operations sur block */ /* Gestion generale des operations sur block */
virtual int ReturnBlockCommand( int key ); virtual int ReturnBlockCommand( int key );
@ -343,21 +343,21 @@ public:
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size ); const wxPoint& pos, const wxSize& size );
~WinEDA_BasePcbFrame( void ); ~WinEDA_BasePcbFrame();
// General // General
virtual void OnCloseWindow( wxCloseEvent& Event ) = 0; virtual void OnCloseWindow( wxCloseEvent& Event ) = 0;
virtual void Process_Special_Functions( wxCommandEvent& event ) = 0; virtual void Process_Special_Functions( wxCommandEvent& event ) = 0;
virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0; virtual void RedrawActiveWindow( wxDC* DC, bool EraseBg ) = 0;
virtual void ReCreateHToolbar( void ) = 0; virtual void ReCreateHToolbar() = 0;
virtual void ReCreateVToolbar( void ) = 0; virtual void ReCreateVToolbar() = 0;
virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0; virtual void OnLeftClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) = 0; virtual void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ) = 0;
virtual void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0; virtual void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ) = 0;
virtual void ReCreateMenuBar( void ); virtual void ReCreateMenuBar();
PCB_SCREEN* GetScreen( void ) { return (PCB_SCREEN*) m_CurrentScreen; } PCB_SCREEN* GetScreen() { return (PCB_SCREEN*) m_CurrentScreen; }
int BestZoom( void ); // Retourne le meilleur zoom int BestZoom(); // Retourne le meilleur zoom
void Show3D_Frame( wxCommandEvent& event ); void Show3D_Frame( wxCommandEvent& event );
@ -369,8 +369,8 @@ public:
int flag_type_command = 0 ); int flag_type_command = 0 );
private: private:
virtual void GetComponentFromUndoList( void ); virtual void GetComponentFromUndoList();
virtual void GetComponentFromRedoList( void ); virtual void GetComponentFromRedoList();
#if defined(DEBUG) #if defined(DEBUG)
protected: protected:
@ -409,7 +409,7 @@ public:
bool Overwrite, bool DisplayDialog ); bool Overwrite, bool DisplayDialog );
void Archive_Modules( const wxString& LibName, bool NewModulesOnly ); void Archive_Modules( const wxString& LibName, bool NewModulesOnly );
MODULE* Select_1_Module_From_BOARD( BOARD* Pcb ); MODULE* Select_1_Module_From_BOARD( BOARD* Pcb );
MODULE* GetModuleByName( void ); MODULE* GetModuleByName();
// Modules // Modules
MODULE* Create_1_Module( wxDC* DC, const wxString& module_name ); MODULE* Create_1_Module( wxDC* DC, const wxString& module_name );
@ -459,9 +459,9 @@ public:
void Build_Board_Ratsnest( wxDC* DC ); void Build_Board_Ratsnest( wxDC* DC );
void DrawGeneralRatsnest( wxDC* DC, int net_code = 0 ); void DrawGeneralRatsnest( wxDC* DC, int net_code = 0 );
void trace_ratsnest_pad( wxDC* DC ); void trace_ratsnest_pad( wxDC* DC );
void recalcule_pad_net_code( void );/* Routine de void recalcule_pad_net_code();/* Routine de
* calcul et de mise a jour des net_codes des PADS */ * calcul et de mise a jour des net_codes des PADS */
void build_liste_pads( void ); void build_liste_pads();
int* build_ratsnest_pad( EDA_BaseStruct* ref, const wxPoint& refpos, bool init ); int* build_ratsnest_pad( EDA_BaseStruct* ref, const wxPoint& refpos, bool init );
void Tst_Ratsnest( wxDC* DC, int ref_netcode ); void Tst_Ratsnest( wxDC* DC, int ref_netcode );
@ -497,7 +497,7 @@ public:
// Gestion des layers: // Gestion des layers:
int SelectLayer( int default_layer, int min_layer, int max_layer ); int SelectLayer( int default_layer, int min_layer, int max_layer );
void SelectLayerPair( void ); void SelectLayerPair();
virtual void SwitchLayer( wxDC* DC, int layer ); virtual void SwitchLayer( wxDC* DC, int layer );
// divers // divers
@ -526,7 +526,7 @@ public:
WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, WinEDA_PcbFrame( wxWindow* father, WinEDA_App* parent, const wxString& title,
const wxPoint& pos, const wxSize& size ); const wxPoint& pos, const wxSize& size );
~WinEDA_PcbFrame( void ); ~WinEDA_PcbFrame();
// Configurations: // Configurations:
void InstallConfigFrame( const wxPoint& pos ); void InstallConfigFrame( const wxPoint& pos );
@ -541,14 +541,14 @@ public:
void MuWaveCommand( wxDC* DC, const wxPoint& MousePos ); void MuWaveCommand( wxDC* DC, const wxPoint& MousePos );
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar( void ); void ReCreateHToolbar();
void ReCreateAuxiliaryToolbar( void ); void ReCreateAuxiliaryToolbar();
void ReCreateVToolbar( void ); void ReCreateVToolbar();
void ReCreateAuxVToolbar( void ); void ReCreateAuxVToolbar();
void ReCreateOptToolbar( void ); void ReCreateOptToolbar();
void ReCreateMenuBar( void ); void ReCreateMenuBar();
WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent ); WinEDAChoiceBox* ReCreateLayerBox( WinEDA_Toolbar* parent );
void PrepareLayerIndicator( void ); void PrepareLayerIndicator();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
@ -560,7 +560,7 @@ public:
void HandleBlockPlace( wxDC* DC ); void HandleBlockPlace( wxDC* DC );
int HandleBlockEnd( wxDC* DC ); int HandleBlockEnd( wxDC* DC );
void SetToolbars( void ); void SetToolbars();
void Process_Settings( wxCommandEvent& event ); void Process_Settings( wxCommandEvent& event );
void InstallPcbOptionsFrame( const wxPoint& pos, wxDC* DC, int id ); void InstallPcbOptionsFrame( const wxPoint& pos, wxDC* DC, int id );
void InstallPcbGlobalDeleteFrame( const wxPoint& pos ); void InstallPcbGlobalDeleteFrame( const wxPoint& pos );
@ -576,12 +576,12 @@ public:
bool SavePcbFile( const wxString& FileName ); bool SavePcbFile( const wxString& FileName );
int SavePcbFormatAscii( FILE* File ); int SavePcbFormatAscii( FILE* File );
bool WriteGeneralDescrPcb( FILE* File ); bool WriteGeneralDescrPcb( FILE* File );
bool RecreateCmpFileFromBoard( void ); bool RecreateCmpFileFromBoard();
void ExportToGenCAD( wxCommandEvent& event ); void ExportToGenCAD( wxCommandEvent& event );
/* Fonctions specifiques */ /* Fonctions specifiques */
MODULE* ListAndSelectModuleName( void ); MODULE* ListAndSelectModuleName();
void Liste_Equipot( wxCommandEvent& event ); void Liste_Equipot( wxCommandEvent& event );
void Swap_Layers( wxCommandEvent& event ); void Swap_Layers( wxCommandEvent& event );
int Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone ); int Test_DRC( wxDC* DC, bool TestPad2Pad, bool TestZone );
@ -614,7 +614,7 @@ public:
void Erase_Pistes( wxDC* DC, int masque_type, bool query ); void Erase_Pistes( wxDC* DC, int masque_type, bool query );
void Erase_Modules( wxDC* DC, bool query ); void Erase_Modules( wxDC* DC, bool query );
void Erase_Textes_Pcb( wxDC* DC, bool query ); void Erase_Textes_Pcb( wxDC* DC, bool query );
void Erase_Marqueurs( void ); void Erase_Marqueurs();
void UnDeleteItem( wxDC* DC ); void UnDeleteItem( wxDC* DC );
void RemoveStruct( EDA_BaseStruct* Item, wxDC* DC ); void RemoveStruct( EDA_BaseStruct* Item, wxDC* DC );
void Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via ); void Via_Edit_Control( wxDC* DC, int command_type, SEGVIA* via );
@ -625,7 +625,7 @@ public:
void DrawHightLight( wxDC* DC, int NetCode ); void DrawHightLight( wxDC* DC, int NetCode );
// Track and via edition: // Track and via edition:
void DisplayTrackSettings( void ); void DisplayTrackSettings();
void Other_Layer_Route( TRACK* track, wxDC* DC ); void Other_Layer_Route( TRACK* track, wxDC* DC );
void Affiche_PadsNoConnect( wxDC* DC ); void Affiche_PadsNoConnect( wxDC* DC );
void Affiche_Status_Net( wxDC* DC ); void Affiche_Status_Net( wxDC* DC );
@ -653,7 +653,7 @@ public:
// Edition des zones // Edition des zones
EDGE_ZONE* Del_SegmEdgeZone( wxDC* DC, EDGE_ZONE* edge_zone ); EDGE_ZONE* Del_SegmEdgeZone( wxDC* DC, EDGE_ZONE* edge_zone );
void CaptureNetName( wxDC* DC ); void CaptureNetName( wxDC* DC );
EDGE_ZONE* Begin_Zone( void ); EDGE_ZONE* Begin_Zone();
void End_Zone( wxDC* DC ); void End_Zone( wxDC* DC );
void Fill_Zone( wxDC* DC ); void Fill_Zone( wxDC* DC );
@ -686,12 +686,12 @@ public:
bool include_fixe, wxDC* DC ); bool include_fixe, wxDC* DC );
void FixeModule( MODULE* Module, bool Fixe ); void FixeModule( MODULE* Module, bool Fixe );
void AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb ); void AutoMoveModulesOnPcb( wxDC* DC, bool PlaceModulesHorsPcb );
bool SetBoardBoundaryBoxFromEdgesOnly( void ); bool SetBoardBoundaryBoxFromEdgesOnly();
void AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC ); void AutoPlaceModule( MODULE* Module, int place_mode, wxDC* DC );
int RecherchePlacementModule( MODULE* Module, wxDC* DC ); int RecherchePlacementModule( MODULE* Module, wxDC* DC );
void GenModuleOnBoard( MODULE* Module ); void GenModuleOnBoard( MODULE* Module );
float Compute_Ratsnest_PlaceModule( wxDC* DC ); float Compute_Ratsnest_PlaceModule( wxDC* DC );
int GenPlaceBoard( void ); int GenPlaceBoard();
void DrawInfoPlace( wxDC* DC ); void DrawInfoPlace( wxDC* DC );
// Autoroutage: // Autoroutage:
@ -705,7 +705,7 @@ public:
void Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC ); void Show_1_Ratsnest( EDA_BaseStruct* item, wxDC* DC );
void Ratsnest_On_Off( wxDC* DC ); void Ratsnest_On_Off( wxDC* DC );
void Clean_Pcb( wxDC* DC ); void Clean_Pcb( wxDC* DC );
EDA_BaseStruct* SaveItemEfface( EDA_BaseStruct* PtItem, int nbitems ); BOARD_ITEM* SaveItemEfface( BOARD_ITEM* PtItem, int nbitems );
// divers // divers
void InstallFindFrame( const wxPoint& pos, wxDC* DC ); void InstallFindFrame( const wxPoint& pos, wxDC* DC );
@ -746,26 +746,26 @@ public:
WinEDA_GerberFrame( wxWindow* father, WinEDA_App* parent, const wxString& title, WinEDA_GerberFrame( wxWindow* father, WinEDA_App* parent, const wxString& title,
const wxPoint& pos, const wxSize& size ); const wxPoint& pos, const wxSize& size );
~WinEDA_GerberFrame( void ); ~WinEDA_GerberFrame();
void Update_config( void ); void Update_config();
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar( void ); void ReCreateHToolbar();
void ReCreateVToolbar( void ); void ReCreateVToolbar();
void ReCreateOptToolbar( void ); void ReCreateOptToolbar();
void ReCreateMenuBar( void ); void ReCreateMenuBar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
int BestZoom( void ); // Retourne le meilleur zoom int BestZoom(); // Retourne le meilleur zoom
void OnSelectOptionToolbar( wxCommandEvent& event ); void OnSelectOptionToolbar( wxCommandEvent& event );
EDA_BaseStruct* GerberGeneralLocateAndDisplay( void ); EDA_BaseStruct* GerberGeneralLocateAndDisplay();
EDA_BaseStruct* Locate( int typeloc ); EDA_BaseStruct* Locate( int typeloc );
void SetToolbars( void ); void SetToolbars();
void Process_Settings( wxCommandEvent& event ); void Process_Settings( wxCommandEvent& event );
void Process_Config( wxCommandEvent& event ); void Process_Config( wxCommandEvent& event );
void InstallConfigFrame( const wxPoint& pos ); void InstallConfigFrame( const wxPoint& pos );
@ -798,7 +798,7 @@ public:
const wxString& D_Code_FullFileName ); const wxString& D_Code_FullFileName );
bool SaveGerberFile( const wxString& FileName, wxDC* DC ); bool SaveGerberFile( const wxString& FileName, wxDC* DC );
int Read_D_Code_File( const wxString& D_Code_FullFileName ); int Read_D_Code_File( const wxString& D_Code_FullFileName );
void CopyDCodesSizeToItems( void ); void CopyDCodesSizeToItems();
void Liste_D_Codes( wxDC* DC ); void Liste_D_Codes( wxDC* DC );
/* Fonctions specifiques */ /* Fonctions specifiques */
@ -849,22 +849,22 @@ public:
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size ); const wxPoint& pos, const wxSize& size );
~WinEDA_ModuleEditFrame( void ); ~WinEDA_ModuleEditFrame();
void InstallOptionsFrame( const wxPoint& pos ); void InstallOptionsFrame( const wxPoint& pos );
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar( void ); void ReCreateHToolbar();
void ReCreateVToolbar( void ); void ReCreateVToolbar();
void ReCreateOptToolbar( void ); void ReCreateOptToolbar();
void ReCreateAuxiliaryToolbar( void ); void ReCreateAuxiliaryToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void SetToolbars( void ); void SetToolbars();
void ReCreateMenuBar( void ); void ReCreateMenuBar();
void ToolOnRightClick( wxCommandEvent& event ); void ToolOnRightClick( wxCommandEvent& event );
void OnSelectOptionToolbar( wxCommandEvent& event ); void OnSelectOptionToolbar( wxCommandEvent& event );
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
@ -874,14 +874,14 @@ public:
virtual void HandleBlockPlace( wxDC* DC ); virtual void HandleBlockPlace( wxDC* DC );
virtual int HandleBlockEnd( wxDC* DC ); virtual int HandleBlockEnd( wxDC* DC );
EDA_BaseStruct* ModeditLocateAndDisplay( void ); EDA_BaseStruct* ModeditLocateAndDisplay();
public: public:
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 ); void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 );
private: private:
void GetComponentFromUndoList( void ); void GetComponentFromUndoList();
void GetComponentFromRedoList( void ); void GetComponentFromRedoList();
public: public:
@ -908,7 +908,7 @@ public:
// Gestion des librairies: // Gestion des librairies:
void Delete_Module_In_Library( const wxString& libname ); void Delete_Module_In_Library( const wxString& libname );
int Create_Librairie( const wxString& LibName ); int Create_Librairie( const wxString& LibName );
void Select_Active_Library( void ); void Select_Active_Library();
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()
}; };
@ -944,7 +944,7 @@ public:
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size ); const wxPoint& pos, const wxSize& size );
~WinEDA_SchematicFrame( void ); ~WinEDA_SchematicFrame();
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
@ -953,13 +953,13 @@ public:
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void ReCreateHToolbar( void ); void ReCreateHToolbar();
void ReCreateVToolbar( void ); void ReCreateVToolbar();
void ReCreateOptToolbar( void ); void ReCreateOptToolbar();
void ReCreateMenuBar( void ); void ReCreateMenuBar();
void SetToolbars( void ); void SetToolbars();
SCH_SCREEN* GetScreen( void ) { return (SCH_SCREEN*) m_CurrentScreen; } SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) m_CurrentScreen; }
void InstallConfigFrame( const wxPoint& pos ); void InstallConfigFrame( const wxPoint& pos );
@ -968,17 +968,17 @@ public:
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
void OnSelectOptionToolbar( wxCommandEvent& event ); void OnSelectOptionToolbar( wxCommandEvent& event );
void ToolOnRightClick( wxCommandEvent& event ); void ToolOnRightClick( wxCommandEvent& event );
int BestZoom( void ); // Retourne le meilleur zoom int BestZoom(); // Retourne le meilleur zoom
EDA_BaseStruct* SchematicGeneralLocateAndDisplay( bool IncludePin = TRUE ); EDA_BaseStruct* SchematicGeneralLocateAndDisplay( bool IncludePin = TRUE );
EDA_BaseStruct* SchematicGeneralLocateAndDisplay( const wxPoint& refpoint, EDA_BaseStruct* SchematicGeneralLocateAndDisplay( const wxPoint& refpoint,
bool IncludePin ); bool IncludePin );
/* netlist generation */ /* netlist generation */
void* BuildNetListBase( void ); void* BuildNetListBase();
// FUnctions used for hierarchy handling // FUnctions used for hierarchy handling
void InstallPreviousScreen( void ); void InstallPreviousScreen();
void InstallNextScreen( DrawSheetStruct* Sheet ); void InstallNextScreen( DrawSheetStruct* Sheet );
void ToPlot_PS( wxCommandEvent& event ); void ToPlot_PS( wxCommandEvent& event );
@ -1095,8 +1095,8 @@ public:
private: private:
void PutDataInPreviousState( DrawPickedStruct* List ); void PutDataInPreviousState( DrawPickedStruct* List );
void GetSchematicFromRedoList( void ); void GetSchematicFromRedoList();
void GetSchematicFromUndoList( void ); void GetSchematicFromUndoList();
public: public:
@ -1135,32 +1135,32 @@ public:
const wxString& title, const wxString& title,
const wxPoint& pos, const wxSize& size ); const wxPoint& pos, const wxSize& size );
~WinEDA_LibeditFrame( void ); ~WinEDA_LibeditFrame();
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void DisplayLibInfos( void ); void DisplayLibInfos();
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar( void ); void ReCreateHToolbar();
void ReCreateVToolbar( void ); void ReCreateVToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu ); void OnRightClick( const wxPoint& MousePos, wxMenu* PopMenu );
int BestZoom( void ); // Retourne le meilleur zoom int BestZoom(); // Retourne le meilleur zoom
void SetToolbars( void ); void SetToolbars();
void OnLeftDClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftDClick( wxDC* DC, const wxPoint& MousePos );
SCH_SCREEN* GetScreen( void ) { return (SCH_SCREEN*) m_CurrentScreen; } SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) m_CurrentScreen; }
void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct ); void OnHotKey( wxDC* DC, int hotkey, EDA_BaseStruct* DrawStruct );
private: private:
// General: // General:
void CreateNewLibraryPart( void ); void CreateNewLibraryPart();
void DeleteOnePart( void ); void DeleteOnePart();
void SaveOnePartInMemory( void ); void SaveOnePartInMemory();
void SelectActiveLibrary( void ); void SelectActiveLibrary();
bool LoadOneLibraryPart( void ); bool LoadOneLibraryPart();
void SaveActiveLibrary( void ); void SaveActiveLibrary();
void ImportOnePart( void ); void ImportOnePart();
void ExportOnePart( bool create_lib ); void ExportOnePart( bool create_lib );
int LoadOneLibraryPartAux( EDA_LibComponentStruct* LibEntry, int LoadOneLibraryPartAux( EDA_LibComponentStruct* LibEntry,
LibraryStruct* Library, int noMsg = 0 ); LibraryStruct* Library, int noMsg = 0 );
@ -1173,8 +1173,8 @@ public:
void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 ); void SaveCopyInUndoList( EDA_BaseStruct* ItemToCopy, int flag_type_command = 0 );
private: private:
void GetComponentFromUndoList( void ); void GetComponentFromUndoList();
void GetComponentFromRedoList( void ); void GetComponentFromRedoList();
// Edition des Pins: // Edition des Pins:
void CreatePin( wxDC* DC ); void CreatePin( wxDC* DC );
@ -1187,7 +1187,7 @@ private:
bool TestPins( EDA_LibComponentStruct* LibEntry ); bool TestPins( EDA_LibComponentStruct* LibEntry );
// Edition de l'ancre // Edition de l'ancre
void PlaceAncre( void ); void PlaceAncre();
// Edition des graphismes: // Edition des graphismes:
LibEDA_BaseStruct* CreateGraphicItem( wxDC* DC ); LibEDA_BaseStruct* CreateGraphicItem( wxDC* DC );
@ -1195,7 +1195,7 @@ private:
void StartMoveDrawSymbol( wxDC* DC ); void StartMoveDrawSymbol( wxDC* DC );
void EndDrawGraphicItem( wxDC* DC ); void EndDrawGraphicItem( wxDC* DC );
void LoadOneSymbol( wxDC* DC ); void LoadOneSymbol( wxDC* DC );
void SaveOneSymbol( void ); void SaveOneSymbol();
void EditGraphicSymbol( wxDC* DC, LibEDA_BaseStruct* DrawItem ); void EditGraphicSymbol( wxDC* DC, LibEDA_BaseStruct* DrawItem );
void EditSymbolText( wxDC* DC, LibEDA_BaseStruct* DrawItem ); void EditSymbolText( wxDC* DC, LibEDA_BaseStruct* DrawItem );
void RotateSymbolText( wxDC* DC ); void RotateSymbolText( wxDC* DC );
@ -1214,7 +1214,7 @@ public:
void DeletePartInLib( LibraryStruct* Library, EDA_LibComponentStruct* Entry ); void DeletePartInLib( LibraryStruct* Library, EDA_LibComponentStruct* Entry );
void PlacePin( wxDC* DC ); void PlacePin( wxDC* DC );
void InitEditOnePin( void ); void InitEditOnePin();
void GlobalSetPins( wxDC* DC, LibDrawPin* MasterPin, int id ); void GlobalSetPins( wxDC* DC, LibDrawPin* MasterPin, int id );
// Repetition automatique de placement de pins // Repetition automatique de placement de pins
@ -1241,26 +1241,26 @@ public:
LibraryStruct* Library = NULL, LibraryStruct* Library = NULL,
wxSemaphore* semaphore = NULL ); wxSemaphore* semaphore = NULL );
~WinEDA_ViewlibFrame( void ); ~WinEDA_ViewlibFrame();
void OnSize( wxSizeEvent& event ); void OnSize( wxSizeEvent& event );
void ReCreateListLib( void ); void ReCreateListLib();
void ReCreateListCmp( void ); void ReCreateListCmp();
void Process_Special_Functions( wxCommandEvent& event ); void Process_Special_Functions( wxCommandEvent& event );
void DisplayLibInfos( void ); void DisplayLibInfos();
void RedrawActiveWindow( wxDC* DC, bool EraseBg ); void RedrawActiveWindow( wxDC* DC, bool EraseBg );
void OnCloseWindow( wxCloseEvent& Event ); void OnCloseWindow( wxCloseEvent& Event );
void ReCreateHToolbar( void ); void ReCreateHToolbar();
void ReCreateVToolbar( void ); void ReCreateVToolbar();
void OnLeftClick( wxDC* DC, const wxPoint& MousePos ); void OnLeftClick( wxDC* DC, const wxPoint& MousePos );
int BestZoom( void ); // Retourne le meilleur zoom int BestZoom(); // Retourne le meilleur zoom
void ClickOnLibList( wxCommandEvent& event ); void ClickOnLibList( wxCommandEvent& event );
void ClickOnCmpList( wxCommandEvent& event ); void ClickOnCmpList( wxCommandEvent& event );
SCH_SCREEN* GetScreen( void ) { return (SCH_SCREEN*) m_CurrentScreen; } SCH_SCREEN* GetScreen() { return (SCH_SCREEN*) m_CurrentScreen; }
private: private:
void SelectCurrentLibrary( void ); void SelectCurrentLibrary();
void SelectAndViewLibraryPart( int option ); void SelectAndViewLibraryPart( int option );
void ExportToSchematicLibraryPart( wxCommandEvent& event ); void ExportToSchematicLibraryPart( wxCommandEvent& event );
void ViewOneLibraryContent( LibraryStruct* Lib, int Flag ); void ViewOneLibraryContent( LibraryStruct* Lib, int Flag );
@ -1291,10 +1291,10 @@ public:
// Constructor and destructor // Constructor and destructor
WinEDA_MsgPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos, const wxSize& size ); WinEDA_MsgPanel( WinEDA_DrawFrame* parent, int id, const wxPoint& pos, const wxSize& size );
~WinEDA_MsgPanel( void ); ~WinEDA_MsgPanel();
void OnPaint( wxPaintEvent& event ); void OnPaint( wxPaintEvent& event );
void EraseMsgBox( void ); void EraseMsgBox();
void EraseMsgBox( wxDC* DC ); void EraseMsgBox( wxDC* DC );
void Affiche_1_Parametre( int pos_X, const wxString& texte_H, void Affiche_1_Parametre( int pos_X, const wxString& texte_H,
const wxString& texte_L, int color ); const wxString& texte_L, int color );
@ -1324,17 +1324,17 @@ public:
const wxString& TextToEdit, wxBoxSizer* BoxSizer, const wxString& TextToEdit, wxBoxSizer* BoxSizer,
const wxSize& Size ); const wxSize& Size );
~WinEDA_EnterText( void ) ~WinEDA_EnterText()
{ {
} }
wxString GetValue( void ); wxString GetValue();
void GetValue( char* buffer, int lenmax ); void GetValue( char* buffer, int lenmax );
void SetValue( const wxString& new_text ); void SetValue( const wxString& new_text );
void Enable( bool enbl ); void Enable( bool enbl );
void SetFocus( void ) { m_FrameText->SetFocus(); } void SetFocus() { m_FrameText->SetFocus(); }
void SetInsertionPoint( int n ) { m_FrameText->SetInsertionPoint( n ); } void SetInsertionPoint( int n ) { m_FrameText->SetInsertionPoint( n ); }
void SetSelection( int n, int m ) void SetSelection( int n, int m )
{ {
@ -1363,14 +1363,14 @@ public:
int units, wxBoxSizer* BoxSizer, int framelen = 200, int units, wxBoxSizer* BoxSizer, int framelen = 200,
int internal_unit = EESCHEMA_INTERNAL_UNIT ); int internal_unit = EESCHEMA_INTERNAL_UNIT );
~WinEDA_GraphicTextCtrl( void ); ~WinEDA_GraphicTextCtrl();
wxString GetText( void ); wxString GetText();
int GetTextSize( void ); int GetTextSize();
void Enable( bool state ); void Enable( bool state );
void SetTitle( const wxString& title ); void SetTitle( const wxString& title );
void SetFocus( void ) { m_FrameText->SetFocus(); } void SetFocus() { m_FrameText->SetFocus(); }
void SetValue( const wxString& value ); void SetValue( const wxString& value );
void SetValue( int value ); void SetValue( int value );
}; };
@ -1398,11 +1398,11 @@ public:
int units, wxBoxSizer* BoxSizer, int units, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT ); int internal_unit = EESCHEMA_INTERNAL_UNIT );
~WinEDA_PositionCtrl( void ); ~WinEDA_PositionCtrl();
void Enable( bool x_win_on, bool y_win_on ); void Enable( bool x_win_on, bool y_win_on );
void SetValue( int x_value, int y_value ); void SetValue( int x_value, int y_value );
wxPoint GetValue( void ); wxPoint GetValue();
}; };
/*****************************************************************/ /*****************************************************************/
@ -1418,8 +1418,8 @@ public:
int units, wxBoxSizer* BoxSizer, int units, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT ); int internal_unit = EESCHEMA_INTERNAL_UNIT );
~WinEDA_SizeCtrl( void ) { } ~WinEDA_SizeCtrl() { }
wxSize GetValue( void ); wxSize GetValue();
}; };
@ -1448,9 +1448,9 @@ public:
int units, wxBoxSizer* BoxSizer, int units, wxBoxSizer* BoxSizer,
int internal_unit = EESCHEMA_INTERNAL_UNIT ); int internal_unit = EESCHEMA_INTERNAL_UNIT );
~WinEDA_ValueCtrl( void ); ~WinEDA_ValueCtrl();
int GetValue( void ); int GetValue();
void SetValue( int new_value ); void SetValue( int new_value );
void Enable( bool enbl ); void Enable( bool enbl );
@ -1477,9 +1477,9 @@ public:
WinEDA_DFloatValueCtrl( wxWindow* parent, const wxString& title, WinEDA_DFloatValueCtrl( wxWindow* parent, const wxString& title,
double value, wxBoxSizer* BoxSizer ); double value, wxBoxSizer* BoxSizer );
~WinEDA_DFloatValueCtrl( void ); ~WinEDA_DFloatValueCtrl();
double GetValue( void ); double GetValue();
void SetValue( double new_value ); void SetValue( double new_value );
void Enable( bool enbl ); void Enable( bool enbl );
@ -1506,7 +1506,7 @@ public:
public: public:
WinEDA_Toolbar( id_toolbar type, wxWindow* parent, WinEDA_Toolbar( id_toolbar type, wxWindow* parent,
wxWindowID id, bool horizontal ); wxWindowID id, bool horizontal );
WinEDA_Toolbar* Next( void ) { return Pnext; } WinEDA_Toolbar* Next() { return Pnext; }
}; };
@ -1532,13 +1532,13 @@ public:
void (* movefct)(wxString& Text) = NULL, void (* movefct)(wxString& Text) = NULL,
const wxColour& colour = wxNullColour, const wxColour& colour = wxNullColour,
wxPoint dialog_position = wxDefaultPosition ); wxPoint dialog_position = wxDefaultPosition );
~WinEDAListBox( void ); ~WinEDAListBox();
void SortList( void ); void SortList();
void Append( const wxString& item ); void Append( const wxString& item );
void InsertItems( const wxArrayString& itemlist, int position = 0 ); void InsertItems( const wxArrayString& itemlist, int position = 0 );
void MoveMouseToOrigin( void ); void MoveMouseToOrigin();
wxString GetTextSelection( void ); wxString GetTextSelection();
private: private:
void OnClose( wxCloseEvent& event ); void OnClose( wxCloseEvent& event );
@ -1586,7 +1586,7 @@ public:
} }
int GetChoice( void ) int GetChoice()
{ {
return GetCurrentSelection(); return GetCurrentSelection();
} }

View File

@ -54,7 +54,7 @@ void Affiche_Infos_Equipot( int netcode, WinEDA_BasePcbFrame* frame )
for( ii = 0, Struct = frame->m_Pcb->m_Track; Struct != NULL; Struct = Struct->Pnext ) for( ii = 0, Struct = frame->m_Pcb->m_Track; Struct != NULL; Struct = Struct->Pnext )
{ {
ii++; ii++;
if( Struct->m_StructType == TYPEVIA ) if( Struct->Type() == TYPEVIA )
if( ( (SEGVIA*) Struct )->m_NetCode == netcode ) if( ( (SEGVIA*) Struct )->m_NetCode == netcode )
nb_vias++; nb_vias++;
} }

View File

@ -50,18 +50,18 @@ void TraceArc(int ux0,int uy0,int ux1,int uy1, int ArcAngle, int lg,int layer,
/* QUEUE.CPP */ /* QUEUE.CPP */
void FreeQueue(void); /* Libere la memoire de la queue de recherche */ void FreeQueue(void); /* Libere la memoire de la queue de recherche */
void InitQueue( void ); void InitQueue();
void GetQueue( int *, int *, int *, int *, int * ); void GetQueue( int *, int *, int *, int *, int * );
int SetQueue( int, int, int, int, int, int, int ); int SetQueue( int, int, int, int, int, int, int );
void ReSetQueue( int, int, int, int, int, int, int ); void ReSetQueue( int, int, int, int, int, int, int );
/* WORK.CPP */ /* WORK.CPP */
void InitWork( void ); void InitWork();
void ReInitWork( void ); void ReInitWork();
int SetWork( int, int, int , int, int, CHEVELU *, int ); int SetWork( int, int, int , int, int, CHEVELU *, int );
void GetWork( int *, int *, int *, int *, int *, CHEVELU ** ); void GetWork( int *, int *, int *, int *, int *, CHEVELU ** );
void SortWork( void ); /* order the work items; shortest first */ void SortWork(); /* order the work items; shortest first */
/* DIST.CPP */ /* DIST.CPP */
int GetApxDist( int, int, int, int ); int GetApxDist( int, int, int, int );

View File

@ -41,7 +41,7 @@ void WinEDA_PcbFrame::Attribut_Track( TRACK* track, wxDC* DC, bool Flag_On )
TRACK* Track; TRACK* Track;
int nb_segm; int nb_segm;
if( (track == NULL ) || (track->m_StructType == TYPEZONE) ) if( (track == NULL ) || (track->Type() == TYPEZONE) )
return; return;
DrawPanel->CursorOff( DC ); // Erase cursor shape DrawPanel->CursorOff( DC ); // Erase cursor shape

View File

@ -368,7 +368,7 @@ void WinEDA_PcbFrame::DrawInfoPlace( wxDC* DC )
/***************************************/ /***************************************/
int WinEDA_PcbFrame::GenPlaceBoard( void ) int WinEDA_PcbFrame::GenPlaceBoard()
/***************************************/ /***************************************/
/* Routine de generation du board ( cote composant + cote cuivre ) : /* Routine de generation du board ( cote composant + cote cuivre ) :
@ -455,7 +455,7 @@ int WinEDA_PcbFrame::GenPlaceBoard( void )
{ {
DRAWSEGMENT* DrawSegm; DRAWSEGMENT* DrawSegm;
switch( PtStruct->m_StructType ) switch( PtStruct->Type() )
{ {
case TYPEDRAWSEGMENT: case TYPEDRAWSEGMENT:
DrawSegm = (DRAWSEGMENT*) PtStruct; DrawSegm = (DRAWSEGMENT*) PtStruct;
@ -1181,7 +1181,7 @@ static MODULE* PickModule( WinEDA_PcbFrame* pcbframe, wxDC* DC )
/*******************************************************/ /*******************************************************/
bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly( void ) bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly()
/*******************************************************/ /*******************************************************/
/* Determine le rectangle d'encadrement du pcb, selon les contours /* Determine le rectangle d'encadrement du pcb, selon les contours
@ -1207,7 +1207,7 @@ bool WinEDA_PcbFrame::SetBoardBoundaryBoxFromEdgesOnly( void )
PtStruct = m_Pcb->m_Drawings; PtStruct = m_Pcb->m_Drawings;
for( ; PtStruct != NULL; PtStruct = PtStruct->Next() ) for( ; PtStruct != NULL; PtStruct = PtStruct->Next() )
{ {
if( PtStruct->m_StructType != TYPEDRAWSEGMENT ) if( PtStruct->Type() != TYPEDRAWSEGMENT )
continue; continue;
succes = TRUE; succes = TRUE;
ptr = (DRAWSEGMENT*) PtStruct; ptr = (DRAWSEGMENT*) PtStruct;

Some files were not shown because too many files have changed in this diff Show More