2007-08-24 15:10:46 +00:00
|
|
|
/*************************************************/
|
|
|
|
/* Functions to Load from file and save to file */
|
|
|
|
/* the graphic shapes used to draw a component */
|
|
|
|
/* When using the import/export symbol options */
|
|
|
|
/* files are the *.sym files */
|
|
|
|
/*************************************************/
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
/* fichier symbedit.cpp */
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
#include "gr_basic.h"
|
|
|
|
#include "common.h"
|
2009-02-04 15:25:03 +00:00
|
|
|
#include "class_drawpanel.h"
|
|
|
|
#include "confirm.h"
|
|
|
|
#include "kicad_string.h"
|
|
|
|
#include "gestfich.h"
|
|
|
|
|
2007-05-06 16:03:28 +00:00
|
|
|
#include "program.h"
|
|
|
|
#include "libcmp.h"
|
|
|
|
#include "general.h"
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
|
|
|
|
/* Routines locales */
|
2007-08-24 15:10:46 +00:00
|
|
|
static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
|
|
|
|
LibEDA_BaseStruct* DEntryCompare );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
|
|
|
/* Variables locales */
|
|
|
|
|
|
|
|
|
2009-03-04 17:19:08 +00:00
|
|
|
/***********************************************/
|
|
|
|
void WinEDA_LibeditFrame::LoadOneSymbol( void )
|
|
|
|
/***********************************************/
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-03-04 17:19:08 +00:00
|
|
|
/* Read a component shape file (a symbol file *.sym )and add data (graphic items) to the current
|
2007-08-24 15:10:46 +00:00
|
|
|
* component.
|
2009-03-04 17:19:08 +00:00
|
|
|
* a symbol file *.sym has the same format as a library, and contains only one symbol
|
2007-08-24 15:10:46 +00:00
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-24 15:10:46 +00:00
|
|
|
int NumOfParts;
|
|
|
|
PriorQue* Entries;
|
|
|
|
EDA_LibComponentStruct* LibEntry = NULL;
|
|
|
|
LibEDA_BaseStruct* DrawEntry;
|
|
|
|
wxString FullFileName, mask;
|
|
|
|
FILE* ImportFile;
|
|
|
|
wxString msg;
|
|
|
|
|
|
|
|
if( CurrentLibEntry == NULL )
|
|
|
|
return;
|
|
|
|
|
2009-03-04 17:19:08 +00:00
|
|
|
if( CurrentDrawItem && CurrentDrawItem->m_Flags ) // a command is in progress
|
|
|
|
return;
|
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
DrawPanel->m_IgnoreMouseEvents = TRUE;
|
|
|
|
|
|
|
|
mask = wxT( "*" ) + g_SymbolExtBuffer;
|
|
|
|
FullFileName = EDA_FileSelector( _( "Import symbol drawings:" ),
|
|
|
|
g_RealLibDirBuffer, /* Chemin par defaut */
|
|
|
|
wxEmptyString, /* nom fichier par defaut */
|
|
|
|
g_SymbolExtBuffer, /* extension par defaut */
|
|
|
|
mask, /* Masque d'affichage */
|
|
|
|
this,
|
|
|
|
0,
|
|
|
|
TRUE
|
|
|
|
);
|
|
|
|
|
|
|
|
GetScreen()->m_Curseur = wxPoint( 0, 0 );
|
|
|
|
DrawPanel->MouseToCursorSchema();
|
|
|
|
DrawPanel->m_IgnoreMouseEvents = FALSE;
|
|
|
|
|
|
|
|
if( FullFileName.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
|
|
|
|
/* Load data */
|
|
|
|
ImportFile = wxFopen( FullFileName, wxT( "rt" ) );
|
|
|
|
if( ImportFile == NULL )
|
|
|
|
{
|
|
|
|
msg.Printf( _( "Failed to open Symbol File <%s>" ), FullFileName.GetData() );
|
|
|
|
DisplayError( this, msg, 20 );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Entries = LoadLibraryAux( this, NULL, ImportFile, &NumOfParts );
|
|
|
|
fclose( ImportFile );
|
|
|
|
|
|
|
|
if( Entries == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
if( NumOfParts > 1 )
|
|
|
|
DisplayError( this, _( "Warning: more than 1 part in Symbol File" ), 20 );
|
|
|
|
|
|
|
|
LibEntry = (EDA_LibComponentStruct*) PQFirst( &Entries, FALSE );
|
|
|
|
|
|
|
|
if( LibEntry == NULL )
|
|
|
|
DisplayError( this, _( "Symbol File is void" ), 20 );
|
|
|
|
|
|
|
|
else /* add data to the current symbol */
|
|
|
|
{
|
|
|
|
DrawEntry = LibEntry->m_Drawings;
|
|
|
|
while( DrawEntry )
|
|
|
|
{
|
|
|
|
if( DrawEntry->m_Unit )
|
|
|
|
DrawEntry->m_Unit = CurrentUnit;
|
|
|
|
if( DrawEntry->m_Convert )
|
|
|
|
DrawEntry->m_Convert = CurrentConvert;
|
|
|
|
DrawEntry->m_Flags = IS_NEW;
|
|
|
|
DrawEntry->m_Selected = IS_SELECTED;
|
|
|
|
|
2008-11-24 06:53:43 +00:00
|
|
|
if( DrawEntry->Next() == NULL )
|
2007-08-24 15:10:46 +00:00
|
|
|
{ /* Fin de liste trouvee */
|
2008-11-24 06:53:43 +00:00
|
|
|
DrawEntry->SetNext( CurrentLibEntry->m_Drawings );
|
2007-08-24 15:10:46 +00:00
|
|
|
CurrentLibEntry->m_Drawings = LibEntry->m_Drawings;
|
|
|
|
LibEntry->m_Drawings = NULL;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
DrawEntry = DrawEntry->Next();
|
|
|
|
}
|
|
|
|
|
2009-03-04 17:19:08 +00:00
|
|
|
// Remove duplicated drawings:
|
2007-08-24 15:10:46 +00:00
|
|
|
SuppressDuplicateDrawItem( CurrentLibEntry );
|
2009-03-04 17:19:08 +00:00
|
|
|
|
|
|
|
// crear flags
|
|
|
|
DrawEntry = CurrentLibEntry->m_Drawings;
|
|
|
|
while( DrawEntry )
|
|
|
|
{
|
|
|
|
DrawEntry->m_Flags = 0;
|
|
|
|
DrawEntry->m_Selected = 0;
|
|
|
|
DrawEntry = DrawEntry->Next();
|
|
|
|
}
|
|
|
|
|
2008-11-21 21:17:15 +00:00
|
|
|
GetScreen()->SetModify();
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2009-03-04 17:19:08 +00:00
|
|
|
DrawPanel->Refresh();
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
PQFreeFunc( Entries, ( void( * ) ( void* ) )FreeLibraryEntry );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/********************************************/
|
2007-09-01 12:00:30 +00:00
|
|
|
void WinEDA_LibeditFrame::SaveOneSymbol()
|
2007-05-06 16:03:28 +00:00
|
|
|
/********************************************/
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2007-05-28 18:09:49 +00:00
|
|
|
/* Save in file the current symbol
|
2007-08-24 15:10:46 +00:00
|
|
|
* file format is like the standard libraries, but there is only one symbol
|
|
|
|
* Invisible pins are not saved
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-24 15:10:46 +00:00
|
|
|
EDA_LibComponentStruct* LibEntry = CurrentLibEntry;
|
|
|
|
int Unit = CurrentUnit, convert = CurrentConvert;
|
|
|
|
LibEDA_BaseStruct* DrawEntry;
|
|
|
|
wxString FullFileName, mask;
|
|
|
|
wxString msg;
|
|
|
|
FILE* ExportFile;
|
|
|
|
|
|
|
|
if( LibEntry->m_Drawings == NULL )
|
|
|
|
return;
|
|
|
|
|
|
|
|
/* Creation du fichier symbole */
|
|
|
|
mask = wxT( "*" ) + g_SymbolExtBuffer;
|
|
|
|
FullFileName = EDA_FileSelector( _( "Export symbol drawings:" ),
|
|
|
|
g_RealLibDirBuffer, /* Chemin par defaut */
|
|
|
|
wxEmptyString, /* nom fichier par defaut */
|
|
|
|
g_SymbolExtBuffer, /* extension par defaut */
|
|
|
|
mask, /* Masque d'affichage */
|
|
|
|
this,
|
|
|
|
wxFD_SAVE,
|
|
|
|
TRUE
|
|
|
|
);
|
|
|
|
if( FullFileName.IsEmpty() )
|
|
|
|
return;
|
|
|
|
|
|
|
|
ExportFile = wxFopen( FullFileName, wxT( "wt" ) );
|
|
|
|
if( ExportFile == NULL )
|
|
|
|
{
|
|
|
|
msg.Printf( _( "Unable to create <%s>" ), FullFileName.GetData() );
|
|
|
|
DisplayError( this, msg );
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
msg.Printf( _( "Save Symbol in [%s]" ), FullFileName.GetData() );
|
|
|
|
Affiche_Message( msg );
|
|
|
|
|
|
|
|
/* Creation de l'entete de la librairie */
|
|
|
|
char Line[256];
|
|
|
|
fprintf( ExportFile, "%s %d.%d %s Date: %s\n", LIBFILE_IDENT,
|
|
|
|
LIB_VERSION_MAJOR, LIB_VERSION_MINOR,
|
|
|
|
"SYMBOL", DateAndTime( Line ) );
|
|
|
|
|
|
|
|
/* Creation du commentaire donnant le nom du composant */
|
|
|
|
fprintf( ExportFile, "# SYMBOL %s\n#\n",
|
|
|
|
(const char*) LibEntry->m_Name.m_Text.GetData() );
|
|
|
|
|
|
|
|
/* Generation des lignes utiles */
|
|
|
|
fprintf( ExportFile, "DEF %s", (const char*) LibEntry->m_Name.m_Text.GetData() );
|
|
|
|
if( !LibEntry->m_Prefix.m_Text.IsEmpty() )
|
|
|
|
fprintf( ExportFile, " %s", (const char*) LibEntry->m_Prefix.m_Text.GetData() );
|
|
|
|
else
|
|
|
|
fprintf( ExportFile, " ~" );
|
|
|
|
|
|
|
|
fprintf( ExportFile, " %d %d %c %c %d %d %c\n",
|
|
|
|
0, /* unused */
|
|
|
|
LibEntry->m_TextInside,
|
|
|
|
LibEntry->m_DrawPinNum ? 'Y' : 'N',
|
|
|
|
LibEntry->m_DrawPinName ? 'Y' : 'N',
|
|
|
|
1, 0 /* unused */, 'N' );
|
|
|
|
|
|
|
|
/* Position / orientation / visibilite des champs */
|
2008-09-18 17:10:54 +00:00
|
|
|
LibEntry->m_Prefix.Save( ExportFile );
|
|
|
|
LibEntry->m_Name.Save( ExportFile );
|
2007-05-06 16:03:28 +00:00
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
DrawEntry = LibEntry->m_Drawings;
|
|
|
|
if( DrawEntry )
|
|
|
|
{
|
|
|
|
fprintf( ExportFile, "DRAW\n" );
|
|
|
|
for( ; DrawEntry != NULL; DrawEntry = DrawEntry->Next() )
|
|
|
|
{
|
|
|
|
/* Elimination des elements non relatifs a l'unite */
|
|
|
|
if( Unit && DrawEntry->m_Unit && (DrawEntry->m_Unit != Unit) )
|
|
|
|
continue;
|
|
|
|
if( convert && DrawEntry->m_Convert && (DrawEntry->m_Convert != convert) )
|
|
|
|
continue;
|
|
|
|
|
2008-09-18 17:10:54 +00:00
|
|
|
DrawEntry->Save( ExportFile );
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
|
|
|
fprintf( ExportFile, "ENDDRAW\n" );
|
|
|
|
}
|
|
|
|
fprintf( ExportFile, "ENDDEF\n" );
|
|
|
|
fclose( ExportFile );
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/*****************************************************************/
|
2007-08-24 15:10:46 +00:00
|
|
|
void SuppressDuplicateDrawItem( EDA_LibComponentStruct* LibEntry )
|
2007-05-06 16:03:28 +00:00
|
|
|
/*****************************************************************/
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
/* Delete redundant graphic items.
|
2007-08-24 15:10:46 +00:00
|
|
|
* Useful after loading asymbole from a file symbol, because some graphic items
|
|
|
|
* can be duplicated.
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-24 15:10:46 +00:00
|
|
|
LibEDA_BaseStruct* DEntryRef, * DEntryCompare;
|
|
|
|
bool deleted;
|
|
|
|
wxDC* DC = NULL;
|
|
|
|
|
|
|
|
DEntryRef = LibEntry->m_Drawings;
|
|
|
|
while( DEntryRef )
|
|
|
|
{
|
2008-11-24 06:53:43 +00:00
|
|
|
if( DEntryRef->Next() == NULL )
|
2007-08-24 15:10:46 +00:00
|
|
|
return;
|
|
|
|
DEntryCompare = DEntryRef->Next();
|
|
|
|
if( DEntryCompare == NULL )
|
|
|
|
return;
|
|
|
|
deleted = 0;
|
|
|
|
while( DEntryCompare )
|
|
|
|
{
|
|
|
|
if( CompareSymbols( DEntryRef, DEntryCompare ) == TRUE )
|
|
|
|
{
|
|
|
|
DeleteOneLibraryDrawStruct( NULL, DC, LibEntry, DEntryRef, 1 );
|
|
|
|
deleted = TRUE;
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
DEntryCompare = DEntryCompare->Next();
|
|
|
|
}
|
|
|
|
|
|
|
|
if( !deleted )
|
|
|
|
DEntryRef = DEntryRef->Next();
|
|
|
|
else
|
|
|
|
DEntryRef = LibEntry->m_Drawings;
|
|
|
|
}
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/********************************************************************/
|
2007-08-24 15:10:46 +00:00
|
|
|
static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
|
|
|
|
LibEDA_BaseStruct* DEntryCompare )
|
|
|
|
/********************************************************************/
|
|
|
|
|
2007-05-28 18:09:49 +00:00
|
|
|
/* Compare 2 graphic items (arc, lines ...).
|
2007-08-24 15:10:46 +00:00
|
|
|
* return FALSE si different
|
|
|
|
* TRUE si they are identical, and therefore redundant
|
|
|
|
*/
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-24 15:10:46 +00:00
|
|
|
/* Comparaison des proprietes generales */
|
2007-09-01 12:00:30 +00:00
|
|
|
if( DEntryRef->Type() != DEntryCompare->Type() )
|
2007-08-24 15:10:46 +00:00
|
|
|
return FALSE;
|
|
|
|
if( DEntryRef->m_Unit != DEntryCompare->m_Unit )
|
|
|
|
return FALSE;
|
|
|
|
if( DEntryRef->m_Convert != DEntryCompare->m_Convert )
|
|
|
|
return FALSE;
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( DEntryRef->Type() )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
|
|
|
case COMPONENT_ARC_DRAW_TYPE:
|
|
|
|
#undef REFSTRUCT
|
|
|
|
#undef CMPSTRUCT
|
|
|
|
#define REFSTRUCT ( (LibDrawArc*) DEntryRef )
|
|
|
|
#define CMPSTRUCT ( (LibDrawArc*) DEntryCompare )
|
|
|
|
if( REFSTRUCT->m_Pos.x != CMPSTRUCT->m_Pos.x )
|
|
|
|
return FALSE;
|
|
|
|
if( REFSTRUCT->m_Pos.y != CMPSTRUCT->m_Pos.y )
|
|
|
|
return FALSE;
|
|
|
|
if( REFSTRUCT->t1 != CMPSTRUCT->t1 )
|
|
|
|
return FALSE;
|
|
|
|
if( REFSTRUCT->t2 != CMPSTRUCT->t2 )
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COMPONENT_CIRCLE_DRAW_TYPE:
|
|
|
|
#undef REFSTRUCT
|
|
|
|
#undef CMPSTRUCT
|
|
|
|
#define REFSTRUCT ( (LibDrawCircle*) DEntryRef )
|
|
|
|
#define CMPSTRUCT ( (LibDrawCircle*) DEntryCompare )
|
|
|
|
if( REFSTRUCT->m_Pos.x != CMPSTRUCT->m_Pos.x )
|
|
|
|
return FALSE;
|
|
|
|
if( REFSTRUCT->m_Pos.y != CMPSTRUCT->m_Pos.y )
|
|
|
|
return FALSE;
|
|
|
|
if( REFSTRUCT->m_Rayon != CMPSTRUCT->m_Rayon )
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
|
|
|
#undef REFSTRUCT
|
|
|
|
#undef CMPSTRUCT
|
|
|
|
#define REFSTRUCT ( (LibDrawText*) DEntryRef )
|
|
|
|
#define CMPSTRUCT ( (LibDrawText*) DEntryCompare )
|
|
|
|
if( REFSTRUCT->m_Pos != CMPSTRUCT->m_Pos )
|
|
|
|
return FALSE;
|
|
|
|
if( REFSTRUCT->m_Size != CMPSTRUCT->m_Size )
|
|
|
|
return FALSE;
|
|
|
|
if( REFSTRUCT->m_Text != CMPSTRUCT->m_Text )
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COMPONENT_RECT_DRAW_TYPE:
|
|
|
|
#undef REFSTRUCT
|
|
|
|
#undef CMPSTRUCT
|
|
|
|
#define REFSTRUCT ( (LibDrawSquare*) DEntryRef )
|
|
|
|
#define CMPSTRUCT ( (LibDrawSquare*) DEntryCompare )
|
|
|
|
if( REFSTRUCT->m_Pos != CMPSTRUCT->m_Pos )
|
|
|
|
return FALSE;
|
|
|
|
if( REFSTRUCT->m_End != CMPSTRUCT->m_End )
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COMPONENT_PIN_DRAW_TYPE:
|
|
|
|
#undef REFSTRUCT
|
|
|
|
#undef CMPSTRUCT
|
|
|
|
#define REFSTRUCT ( (LibDrawPin*) DEntryRef )
|
|
|
|
#define CMPSTRUCT ( (LibDrawPin*) DEntryCompare )
|
|
|
|
if( REFSTRUCT->m_Pos != CMPSTRUCT->m_Pos )
|
|
|
|
return FALSE;
|
|
|
|
break;
|
|
|
|
|
|
|
|
case COMPONENT_POLYLINE_DRAW_TYPE:
|
|
|
|
#undef REFSTRUCT
|
|
|
|
#undef CMPSTRUCT
|
|
|
|
#define REFSTRUCT ( (LibDrawPolyline*) DEntryRef )
|
|
|
|
#define CMPSTRUCT ( (LibDrawPolyline*) DEntryCompare )
|
2009-01-02 13:19:34 +00:00
|
|
|
if( REFSTRUCT->GetCornerCount() != CMPSTRUCT->GetCornerCount() )
|
2007-08-24 15:10:46 +00:00
|
|
|
return FALSE;
|
2009-01-02 13:19:34 +00:00
|
|
|
for( unsigned ii = 0; ii < REFSTRUCT->GetCornerCount(); ii++ )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
2009-01-02 13:19:34 +00:00
|
|
|
if( REFSTRUCT->m_PolyPoints[ii] != CMPSTRUCT->m_PolyPoints[ii] )
|
|
|
|
return false;
|
2007-08-24 15:10:46 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
default:
|
|
|
|
;
|
|
|
|
}
|
|
|
|
|
|
|
|
return TRUE;
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
/* Routine de placement du point d'ancrage ( reference des coordonnes pour */
|
|
|
|
/* le trace) du composant courant */
|
|
|
|
/* Toutes les coord apparaissant dans les structures sont modifiees */
|
|
|
|
/* pour repositionner le point repere par le curseur souris au point */
|
|
|
|
/* d'ancrage ( coord 0,0 ). */
|
|
|
|
/***************************************************************************/
|
|
|
|
|
2007-09-01 12:00:30 +00:00
|
|
|
void WinEDA_LibeditFrame::PlaceAncre()
|
2007-05-06 16:03:28 +00:00
|
|
|
{
|
2007-08-24 15:10:46 +00:00
|
|
|
EDA_LibComponentStruct* LibEntry;
|
2008-11-21 21:17:15 +00:00
|
|
|
LibEDA_BaseStruct* DrawEntry;
|
2007-08-24 15:10:46 +00:00
|
|
|
|
|
|
|
LibEntry = CurrentLibEntry;
|
|
|
|
if( LibEntry == NULL )
|
|
|
|
return;
|
|
|
|
|
2008-11-21 21:17:15 +00:00
|
|
|
wxSize offset( -GetScreen()->m_Curseur.x, GetScreen()->m_Curseur.y );
|
|
|
|
|
|
|
|
GetScreen()->SetModify();
|
2007-08-24 15:10:46 +00:00
|
|
|
|
2008-11-21 21:17:15 +00:00
|
|
|
LibEntry->m_Name.m_Pos += offset;
|
|
|
|
LibEntry->m_Prefix.m_Pos += offset;
|
|
|
|
|
2008-12-31 15:01:29 +00:00
|
|
|
for( LibDrawField* field = LibEntry->m_Fields; field; field = field->Next() )
|
2008-11-21 21:17:15 +00:00
|
|
|
{
|
|
|
|
field->m_Pos += offset;
|
|
|
|
}
|
2007-08-24 15:10:46 +00:00
|
|
|
|
|
|
|
DrawEntry = LibEntry->m_Drawings;
|
|
|
|
while( DrawEntry )
|
|
|
|
{
|
2007-09-01 12:00:30 +00:00
|
|
|
switch( DrawEntry->Type() )
|
2007-08-24 15:10:46 +00:00
|
|
|
{
|
|
|
|
case COMPONENT_ARC_DRAW_TYPE:
|
|
|
|
#undef STRUCT
|
|
|
|
#define STRUCT ( (LibDrawArc*) DrawEntry )
|
2008-11-21 21:17:15 +00:00
|
|
|
STRUCT->m_Pos += offset;
|
|
|
|
STRUCT->m_ArcStart += offset;
|
|
|
|
STRUCT->m_ArcEnd += offset;
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COMPONENT_CIRCLE_DRAW_TYPE:
|
|
|
|
#undef STRUCT
|
|
|
|
#define STRUCT ( (LibDrawCircle*) DrawEntry )
|
2008-11-21 21:17:15 +00:00
|
|
|
STRUCT->m_Pos += offset;
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COMPONENT_GRAPHIC_TEXT_DRAW_TYPE:
|
|
|
|
#undef STRUCT
|
|
|
|
#define STRUCT ( (LibDrawText*) DrawEntry )
|
2008-11-21 21:17:15 +00:00
|
|
|
STRUCT->m_Pos += offset;
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COMPONENT_RECT_DRAW_TYPE:
|
|
|
|
#undef STRUCT
|
|
|
|
#define STRUCT ( (LibDrawSquare*) DrawEntry )
|
2008-11-21 21:17:15 +00:00
|
|
|
STRUCT->m_Pos += offset;
|
|
|
|
STRUCT->m_End += offset;
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COMPONENT_PIN_DRAW_TYPE:
|
|
|
|
#undef STRUCT
|
|
|
|
#define STRUCT ( (LibDrawPin*) DrawEntry )
|
2008-11-21 21:17:15 +00:00
|
|
|
STRUCT->m_Pos += offset;
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
|
|
|
|
|
|
|
case COMPONENT_POLYLINE_DRAW_TYPE:
|
|
|
|
#undef STRUCT
|
|
|
|
#define STRUCT ( (LibDrawPolyline*) DrawEntry )
|
2009-01-02 13:19:34 +00:00
|
|
|
for( unsigned ii = 0; ii < STRUCT->GetCornerCount(); ii ++ )
|
|
|
|
STRUCT->m_PolyPoints[ii] += offset;
|
2007-08-24 15:10:46 +00:00
|
|
|
break;
|
2008-09-13 18:59:57 +00:00
|
|
|
|
2007-08-24 15:10:46 +00:00
|
|
|
default:
|
|
|
|
;
|
|
|
|
}
|
|
|
|
DrawEntry = DrawEntry->Next();
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Redraw the symbol */
|
2008-11-21 21:17:15 +00:00
|
|
|
GetScreen()->m_Curseur.x = GetScreen()->m_Curseur.y = 0;
|
2007-08-24 15:10:46 +00:00
|
|
|
Recadre_Trace( TRUE );
|
2008-11-21 21:17:15 +00:00
|
|
|
GetScreen()->SetRefreshReq();
|
2007-05-06 16:03:28 +00:00
|
|
|
}
|