struct.cpp.notused 1.88 KB
Newer Older
1 2 3 4 5 6 7 8 9 10 11 12
		/***********************************************/
		/* Routines d'effacement et copie de structures*/
		/***********************************************/

#include "fctsys.h"

#include "common.h"
#include "gerbview.h"

/* Variables locales */


13 14
#if 0

15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
/***************************************************/
void DeleteStructure( EDA_BaseStruct * PtStruct )
/***************************************************/
/* Supprime de la liste chainee la stucture pointee par GenericStructure
	et libere la memoire correspondante
*/
{
EDA_BaseStruct *PtNext, *PtBack;
int IsDeleted;
wxString msg;

	if( PtStruct == NULL) return ;

	IsDeleted = PtStruct->GetState(DELETED);

	PtNext = PtStruct->Pnext;
	PtBack = PtStruct->Pback;

33
	switch( PtStruct->Type() )
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73
		{
		case TYPE_NOT_INIT:
			DisplayError(NULL, wxT("DeleteStruct: Type NOT_INIT"));
			break;


		case TYPEDRAWSEGMENT:
			#undef Struct
			#define Struct ((DRAWSEGMENT*)PtStruct)
			Struct->UnLink();
			delete Struct;
			break;

		 case TYPETEXTE:
			#undef Struct
			#define Struct ((TEXTE_PCB*)PtStruct)
			Struct->UnLink();
			delete Struct;
			break;


		case TYPEVIA:
		case TYPETRACK:
		case TYPEZONE:
			#undef Struct
			#define Struct ((TRACK*)PtStruct)
			Struct->UnLink();
			delete Struct;
			break;

		 case TYPEMARQUEUR:
			#undef Struct
			#define Struct ((MARQUEUR*)PtStruct)
			Struct->UnLink();
			delete Struct;
			break;

		case TYPEPCB:
		default:
			msg.Printf( wxT("DeleteStructure: unexpected %d type"),
74
										PtStruct->Type());
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95
			DisplayError(NULL, msg);
			break;
		}
}

/*************************************************/
void DeleteStructList( EDA_BaseStruct * PtStruct )
/*************************************************/
/* Supprime la liste chainee pointee par PtStruct
	et libere la memoire correspondante
*/
{
EDA_BaseStruct *PtNext;
	while (PtStruct)
		{
		PtNext = PtStruct->Pnext;
		delete PtStruct;
		PtStruct = PtNext;
		}
}

96 97

#endif