Commit 2f99ef29 authored by charras's avatar charras

eeschema: code cleaning

parent a178978c
...@@ -14,9 +14,11 @@ set(EESCHEMA_SRCS ...@@ -14,9 +14,11 @@ set(EESCHEMA_SRCS
bus-wire-junction.cpp bus-wire-junction.cpp
class_drawsheet.cpp class_drawsheet.cpp
class_hierarchical_PIN_sheet.cpp class_hierarchical_PIN_sheet.cpp
class_pin.cpp
class_schematic_items.cpp class_schematic_items.cpp
class_screen.cpp class_screen.cpp
class_text-label.cpp class_text-label.cpp
classes_body_items.cpp
cleanup.cpp cleanup.cpp
component_class.cpp component_class.cpp
controle.cpp controle.cpp
......
...@@ -139,8 +139,8 @@ int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent, ...@@ -139,8 +139,8 @@ int MarkItemsInBloc( EDA_LibComponentStruct* LibComponent,
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
{ {
int ii, imax = ( (LibDrawPolyline*) item )->n * 2; int ii, imax = ( (LibDrawPolyline*) item )->m_CornersCount * 2;
int* ptpoly = ( (LibDrawPolyline*) item )->PolyList; int* ptpoly = ( (LibDrawPolyline*) item )->m_PolyList;
for( ii = 0; ii < imax; ii += 2 ) for( ii = 0; ii < imax; ii += 2 )
{ {
pos.x = ptpoly[ii]; pos.y = -ptpoly[ii + 1]; pos.x = ptpoly[ii]; pos.y = -ptpoly[ii + 1];
...@@ -577,8 +577,8 @@ void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset ) ...@@ -577,8 +577,8 @@ void MoveMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
{ {
int ii, imax = ( (LibDrawPolyline*) item )->n * 2; int ii, imax = ( (LibDrawPolyline*) item )->m_CornersCount * 2;
int* ptpoly = ( (LibDrawPolyline*) item )->PolyList; int* ptpoly = ( (LibDrawPolyline*) item )->m_PolyList;
for( ii = 0; ii < imax; ii += 2 ) for( ii = 0; ii < imax; ii += 2 )
{ {
ptpoly[ii] += offset.x; ptpoly[ii] += offset.x;
...@@ -689,8 +689,8 @@ void MirrorMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset ) ...@@ -689,8 +689,8 @@ void MirrorMarkedItems( EDA_LibComponentStruct* LibEntry, wxPoint offset )
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
{ {
int ii, imax = ( (LibDrawPolyline*) item )->n * 2; int ii, imax = ( (LibDrawPolyline*) item )->m_CornersCount * 2;
int* ptpoly = ( (LibDrawPolyline*) item )->PolyList; int* ptpoly = ( (LibDrawPolyline*) item )->m_PolyList;
for( ii = 0; ii < imax; ii += 2 ) for( ii = 0; ii < imax; ii += 2 )
{ {
SETMIRROR( ptpoly[ii] ); SETMIRROR( ptpoly[ii] );
......
/****************************************************************/
/* Headers fo library definition and lib component definitions */
/****************************************************************/
#ifndef CLASS_LIBRARY_H
#define CLASS_LIBRARY_H
/* Types for components in libraries
* components can be a true component or an alias of a true component.
*/
enum LibrEntryType {
ROOT, /* This is a true component standard EDA_LibComponentStruct */
ALIAS /* This is an alias of a true component */
};
/* values for member .m_Options */
enum LibrEntryOptions {
ENTRY_NORMAL, // Libentry is a standard component (real or alias)
ENTRY_POWER // Libentry is a power symbol
};
/******************************/
/* Classe to handle a library */
/******************************/
class LibraryStruct
{
public:
int m_Type; /* type indicator */
wxString m_Name; /* Short Name of the loaded library (without path). */
wxString m_FullFileName; /* Full File Name (with path) of library. */
wxString m_Header; /* first line of loaded library. */
int m_NumOfParts; /* Number of parts this library has. */
PriorQue* m_Entries; /* Parts themselves are saved here. */
LibraryStruct* m_Pnext; /* Point on next lib in chain. */
int m_Modified; /* flag indicateur d'edition */
int m_Size; // Size in bytes (for statistics)
unsigned long m_TimeStamp; // Signature temporelle
int m_Flags; // variable used in some functions
bool m_IsLibCache; /* False for the "standard" libraries,
* True for the library cache */
public:
LibraryStruct( int type, const wxString& name, const wxString& fullname );
~LibraryStruct();
bool WriteHeader( FILE* file );
bool ReadHeader( FILE* file, int* LineNum );
};
#include "classes_body_items.h"
/* basic class to describe components in libraries (true component or alias), non used directly */
class LibCmpEntry : public EDA_BaseStruct
{
public:
LibrEntryType Type; /* Type = ROOT;
* = ALIAS pour struct LibraryAliasType */
LibDrawField m_Name; // name (74LS00 ..) in lib ( = VALUE )
wxString m_Doc; /* documentation for info */
wxString m_KeyWord; /* keyword list (used to select a group of components by keyword) */
wxString m_DocFile; /* Associed doc filename */
LibrEntryOptions m_Options; // special features (i.e. Entry is a POWER)
public:
LibCmpEntry( LibrEntryType CmpType, const wxChar* CmpName );
virtual ~LibCmpEntry();
virtual wxString GetClass() const
{
return wxT( "LibCmpEntry" );
}
bool WriteDescr( FILE* File );
};
/*********************************************/
/* class to handle an usual component in lib */
/*********************************************/
class EDA_LibComponentStruct : public LibCmpEntry
{
public:
LibDrawField m_Prefix; /* Prefix ( U, IC ... ) = REFERENCE */
wxArrayString m_AliasList; /* ALIAS list for the component */
wxArrayString m_FootprintList; /* list of suitable footprint names for the component (wildcard names accepted)*/
int m_UnitCount; /* Units (or sections) per package */
bool m_UnitSelectionLocked; // True if units are differents and their selection is locked
// (i.e. if part A cannot be automatically changed in part B
int m_TextInside; /* if 0: pin name drawn on the pin itself
* if > 0 pin name drawn inside the component,
* with a distance of m_TextInside in mils */
bool m_DrawPinNum;
bool m_DrawPinName;
LibDrawField* Fields; /* Auxiliairy Field list (id = 2 a 11) */
LibEDA_BaseStruct* m_Drawings; /* How to draw this part */
long m_LastDate; // Last change Date
public:
virtual wxString GetClass() const
{
return wxT( "EDA_LibComponentStruct" );
}
EDA_LibComponentStruct( const wxChar* CmpName );
EDA_Rect GetBoundaryBox( int Unit, int Convert ); /* return Box around the part. */
~EDA_LibComponentStruct();
void SortDrawItems();
};
/**************************************************************************/
/* class to handle an alias of an usual component in lib (root component) */
/**************************************************************************/
class EDA_LibCmpAliasStruct : public LibCmpEntry
{
public:
wxString m_RootName; /* Root component Part name */
public:
EDA_LibCmpAliasStruct( const wxChar* CmpName, const wxChar* CmpRootName );
~EDA_LibCmpAliasStruct();
virtual wxString GetClass() const
{
return wxT( "EDA_LibCmpAliasStruct" );
}
};
#endif // CLASS_LIBRARY_H
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -66,8 +66,8 @@ LibraryStruct* LoadLibraryName( WinEDA_DrawFrame* frame, ...@@ -66,8 +66,8 @@ LibraryStruct* LoadLibraryName( WinEDA_DrawFrame* frame,
return NULL; return NULL;
} }
currentLibraryName = FullLibName; currentLibraryName = FullLibName;
NewLib = new LibraryStruct( LIBRARY_TYPE_EESCHEMA, LibName, FullLibName ); NewLib = new LibraryStruct( LIBRARY_TYPE_EESCHEMA, LibName, FullLibName );
Entries = LoadLibraryAux( frame, NewLib, f, &NumOfParts ); Entries = LoadLibraryAux( frame, NewLib, f, &NumOfParts );
...@@ -480,7 +480,7 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame, char ...@@ -480,7 +480,7 @@ EDA_LibComponentStruct* Read_Component_Definition( WinEDA_DrawFrame* frame, char
/* End line or block analysis: test for an error */ /* End line or block analysis: test for an error */
if( !Res ) if( !Res )
{ /* Something went wrong there. */ { /* Something went wrong there. */
Msg.Printf( wxT( " Error at line %d of library \n\"%s\",\nlibrary not loaded" ), Msg.Printf( wxT( " Error at line %d of library \n\"%s\",\nlibrary not loaded" ),
*LineNum, currentLibraryName.GetData() ); *LineNum, currentLibraryName.GetData() );
DisplayError( frame, Msg ); DisplayError( frame, Msg );
SAFE_DELETE( LibEntry ); SAFE_DELETE( LibEntry );
...@@ -734,24 +734,24 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char* ...@@ -734,24 +734,24 @@ static LibEDA_BaseStruct* GetDrawEntry( WinEDA_DrawFrame* frame, FILE* f, char*
New = Polyl; New = Polyl;
if( sscanf( &Line[2], "%d %d %d %d", if( sscanf( &Line[2], "%d %d %d %d",
&Polyl->n, &Unit, &Convert, &Polyl->m_CornersCount, &Unit, &Convert,
&Polyl->m_Width ) == 4 &Polyl->m_Width ) == 4
&& Polyl->n > 0 ) && Polyl->m_CornersCount > 0 )
{ {
Polyl->m_Unit = Unit; Polyl->m_Convert = Convert; Polyl->m_Unit = Unit; Polyl->m_Convert = Convert;
Polyl->PolyList = (int*) Polyl->m_PolyList = (int*)
MyZMalloc( sizeof(int) * Polyl->n * 2 ); MyZMalloc( sizeof(int) * Polyl->m_CornersCount * 2 );
p = strtok( &Line[2], " \t\n" ); p = strtok( &Line[2], " \t\n" );
p = strtok( NULL, " \t\n" ); p = strtok( NULL, " \t\n" );
p = strtok( NULL, " \t\n" ); p = strtok( NULL, " \t\n" );
p = strtok( NULL, " \t\n" ); p = strtok( NULL, " \t\n" );
for( i = 0; i < Polyl->n * 2 && !Error; i++ ) for( i = 0; i < Polyl->m_CornersCount * 2 && !Error; i++ )
{ {
p = strtok( NULL, " \t\n" ); p = strtok( NULL, " \t\n" );
Error = sscanf( p, "%d", &Polyl->PolyList[i] ) != 1; Error = sscanf( p, "%d", &Polyl->m_PolyList[i] ) != 1;
} }
Polyl->m_Fill = NO_FILL; Polyl->m_Fill = NO_FILL;
......
This diff is collapsed.
...@@ -256,7 +256,7 @@ eda_global wxString g_NetListerCommandLine; // ligne de commande pour l'appel au ...@@ -256,7 +256,7 @@ eda_global wxString g_NetListerCommandLine; // ligne de commande pour l'appel au
eda_global LayerStruct g_LayerDescr; /* couleurs des couches */ eda_global LayerStruct g_LayerDescr; /* couleurs des couches */
eda_global bool g_EditPinByPinIsOn /* bool: TRUE si edition des pins pin a pin au lieu */ eda_global bool g_EditPinByPinIsOn /* bool: TRUE si edition des pins pin a pin au lieu */
#ifdef MAIN /* de l'edition simultan�e des pins de meme coordonn�es */ #ifdef MAIN /* de l'edition simultanee des pins de meme coordonnees */
= FALSE = FALSE
#endif #endif
; ;
...@@ -265,6 +265,13 @@ eda_global int g_LibSymbolDefaultLineWidth; /* default line width (in EESCHEMA ...@@ -265,6 +265,13 @@ eda_global int g_LibSymbolDefaultLineWidth; /* default line width (in EESCHEMA
eda_global int g_DrawMinimunLineWidth; /* Minimum line (in EESCHEMA units) width used to draw items on screen; 0 = single pixel line width */ eda_global int g_DrawMinimunLineWidth; /* Minimum line (in EESCHEMA units) width used to draw items on screen; 0 = single pixel line width */
eda_global int g_PlotPSMinimunLineWidth; /* Minimum line (in EESCHEMA units) width used to Plot items , postscript format */ eda_global int g_PlotPSMinimunLineWidth; /* Minimum line (in EESCHEMA units) width used to Plot items , postscript format */
eda_global int g_ItemSelectetColor // Color to draw selected items
#ifdef MAIN
= BROWN
#endif
;
/* Config keys */ /* Config keys */
#define MINI_DRAW_LINE_WIDTH_KEY wxT("MinimunDrawLineWidth") #define MINI_DRAW_LINE_WIDTH_KEY wxT("MinimunDrawLineWidth")
#define MINI_PLOTPS_LINE_WIDTH_KEY wxT("MinimunPlotPSLineWidth") #define MINI_PLOTPS_LINE_WIDTH_KEY wxT("MinimunPlotPSLineWidth")
......
...@@ -229,12 +229,12 @@ EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert ) ...@@ -229,12 +229,12 @@ EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert )
DrawEntry = m_Drawings; DrawEntry = m_Drawings;
if( DrawEntry ) if( DrawEntry )
{ {
xmin = ymin = 0x7FFFFFFF; xmin = ymin = 0x7FFFFFFF;
xmax = ymax = 0x80000000; xmax = ymax = 0x80000000;
} }
else else
{ {
xmin = ymin = -50; xmin = ymin = -50;
xmax = ymax = 50; // Min size in 1/1000 inch xmax = ymax = 50; // Min size in 1/1000 inch
} }
...@@ -337,8 +337,8 @@ EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert ) ...@@ -337,8 +337,8 @@ EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert )
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
{ {
LibDrawPolyline* polyline = (LibDrawPolyline*) DrawEntry; LibDrawPolyline* polyline = (LibDrawPolyline*) DrawEntry;
pt = polyline->PolyList; pt = polyline->m_PolyList;
for( ii = 0; ii < polyline->n; ii++ ) for( ii = 0; ii < polyline->m_CornersCount; ii++ )
{ {
if( xmin > *pt ) if( xmin > *pt )
xmin = *pt; xmin = *pt;
...@@ -353,7 +353,7 @@ EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert ) ...@@ -353,7 +353,7 @@ EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert )
} }
} }
break; break;
default: default:
; ;
} }
...@@ -380,7 +380,7 @@ EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert ) ...@@ -380,7 +380,7 @@ EDA_Rect EDA_LibComponentStruct::GetBoundaryBox( int Unit, int Convert )
/* a Field is a string linked to a component. /* a Field is a string linked to a component.
* Unlike a pure graphic text, fields can be used in netlist generation * Unlike a pure graphic text, fields can be used in netlist generation
* and other things. * and other things.
* *
* 4 fields have a special meaning: * 4 fields have a special meaning:
* REFERENCE * REFERENCE
* VALUE * VALUE
...@@ -739,8 +739,8 @@ LibDrawSegment* LibDrawSegment::GenCopy() ...@@ -739,8 +739,8 @@ LibDrawSegment* LibDrawSegment::GenCopy()
LibDrawPolyline::LibDrawPolyline() : LibEDA_BaseStruct( COMPONENT_POLYLINE_DRAW_TYPE ) LibDrawPolyline::LibDrawPolyline() : LibEDA_BaseStruct( COMPONENT_POLYLINE_DRAW_TYPE )
{ {
n = 0; m_CornersCount = 0;
PolyList = NULL; m_PolyList = NULL;
m_Fill = NO_FILL; m_Fill = NO_FILL;
m_Width = 0; m_Width = 0;
} }
...@@ -754,12 +754,12 @@ LibDrawPolyline* LibDrawPolyline::GenCopy() ...@@ -754,12 +754,12 @@ LibDrawPolyline* LibDrawPolyline::GenCopy()
int size; int size;
newitem->n = n; newitem->m_CornersCount = m_CornersCount;
size = sizeof(int) * 2 * n; size = sizeof(int) * 2 * m_CornersCount;
if( size ) if( size )
{ {
newitem->PolyList = (int*) MyMalloc( size ); newitem->m_PolyList = (int*) MyMalloc( size );
memcpy( newitem->PolyList, PolyList, size ); memcpy( newitem->m_PolyList, m_PolyList, size );
} }
newitem->m_Pos = m_Pos; newitem->m_Pos = m_Pos;
newitem->m_Width = m_Width; newitem->m_Width = m_Width;
...@@ -780,13 +780,13 @@ void LibDrawPolyline::AddPoint( const wxPoint& point ) ...@@ -780,13 +780,13 @@ void LibDrawPolyline::AddPoint( const wxPoint& point )
{ {
int allocsize; int allocsize;
n++; m_CornersCount++;
allocsize = 2 * sizeof(int) * n; allocsize = 2 * sizeof(int) * m_CornersCount;
if( PolyList == NULL ) if( m_PolyList == NULL )
PolyList = (int*) MyMalloc( allocsize ); m_PolyList = (int*) MyMalloc( allocsize );
else else
PolyList = (int*) realloc( PolyList, allocsize ); m_PolyList = (int*) realloc( m_PolyList, allocsize );
PolyList[(n * 2) - 2] = point.x; m_PolyList[(m_CornersCount * 2) - 2] = point.x;
PolyList[(n * 2) - 1] = -point.y; m_PolyList[(m_CornersCount * 2) - 1] = -point.y;
} }
This diff is collapsed.
...@@ -153,7 +153,7 @@ bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE); ...@@ -153,7 +153,7 @@ bool BlockActive = (GetScreen()->BlockLocate.m_Command != BLOCK_IDLE);
} }
else if( (DrawEntry->m_Flags & IS_NEW) ) else if( (DrawEntry->m_Flags & IS_NEW) )
{ {
if( ((LibDrawPolyline*)DrawEntry)->n > 2 ) if( ((LibDrawPolyline*)DrawEntry)->m_CornersCount > 2 )
{ {
msg = AddHotkeyName( _( "Delete Segment " ), s_Libedit_Hokeys_Descr, HK_DELETE_PIN ); msg = AddHotkeyName( _( "Delete Segment " ), s_Libedit_Hokeys_Descr, HK_DELETE_PIN );
ADD_MENUITEM(PopMenu, ADD_MENUITEM(PopMenu,
......
...@@ -880,8 +880,8 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen, ...@@ -880,8 +880,8 @@ LibEDA_BaseStruct* LocateDrawItem( SCH_SCREEN* Screen,
LibDrawPolyline* polyline = (LibDrawPolyline*) DrawItem; LibDrawPolyline* polyline = (LibDrawPolyline*) DrawItem;
if( (masque & LOCATE_COMPONENT_POLYLINE_DRAW_TYPE) == 0 ) if( (masque & LOCATE_COMPONENT_POLYLINE_DRAW_TYPE) == 0 )
break; break;
ptpoly = polyline->PolyList; ptpoly = polyline->m_PolyList;
for( ii = polyline->n - 1; ii > 0; ii--, ptpoly += 2 ) for( ii = polyline->m_CornersCount - 1; ii > 0; ii--, ptpoly += 2 )
{ {
if( IsPointOnSegment( px, py, if( IsPointOnSegment( px, py,
ptpoly[0], -ptpoly[1], ptpoly[2], -ptpoly[3], seuil ) ) ptpoly[0], -ptpoly[1], ptpoly[2], -ptpoly[3], seuil ) )
......
...@@ -20,7 +20,9 @@ OBJECTS = eeschema.o\ ...@@ -20,7 +20,9 @@ OBJECTS = eeschema.o\
cross-probing.o\ cross-probing.o\
setpage.o\ setpage.o\
class_schematic_items.o\ class_schematic_items.o\
classes_body_items.o\
class_drawsheet.o\ class_drawsheet.o\
class_pin.o\
class_hierarchical_PIN_sheet.o\ class_hierarchical_PIN_sheet.o\
class_text-label.o\ class_text-label.o\
component_class.o\ component_class.o\
......
...@@ -326,15 +326,15 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem ) ...@@ -326,15 +326,15 @@ void PlotLibPart( SCH_COMPONENT* DrawLibItem )
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
{ {
LibDrawPolyline* polyline = (LibDrawPolyline*) DEntry; LibDrawPolyline* polyline = (LibDrawPolyline*) DEntry;
Poly = (int*) MyMalloc( sizeof(int) * 2 * polyline->n ); Poly = (int*) MyMalloc( sizeof(int) * 2 * polyline->m_CornersCount );
for( ii = 0; ii < polyline->n; ii++ ) for( ii = 0; ii < polyline->m_CornersCount; ii++ )
{ {
Poly[ii * 2] = PartX + Poly[ii * 2] = PartX +
TransMat[0][0] * polyline->PolyList[ii * 2] + TransMat[0][0] * polyline->m_PolyList[ii * 2] +
TransMat[0][1] * polyline->PolyList[ii * 2 + 1]; TransMat[0][1] * polyline->m_PolyList[ii * 2 + 1];
Poly[ii * 2 + 1] = PartY + Poly[ii * 2 + 1] = PartY +
TransMat[1][0] * polyline->PolyList[ii * 2] + TransMat[1][0] * polyline->m_PolyList[ii * 2] +
TransMat[1][1] * polyline->PolyList[ii * 2 + 1]; TransMat[1][1] * polyline->m_PolyList[ii * 2 + 1];
} }
if ( draw_bgfill && polyline->m_Fill == FILLED_WITH_BG_BODYCOLOR ) if ( draw_bgfill && polyline->m_Fill == FILLED_WITH_BG_BODYCOLOR )
......
...@@ -36,7 +36,7 @@ void InstallCmpeditFrame(WinEDA_SchematicFrame * parent, wxPoint & pos, ...@@ -36,7 +36,7 @@ void InstallCmpeditFrame(WinEDA_SchematicFrame * parent, wxPoint & pos,
/**************/ /**************/
/* EELIBS2.CPP */ /* EELIBS_.CPP */
/**************/ /**************/
/* Functions common to all EELibs?.c modules: */ /* Functions common to all EELibs?.c modules: */
...@@ -69,6 +69,14 @@ EDA_LibComponentStruct * Read_Component_Definition(WinEDA_DrawFrame * frame, cha ...@@ -69,6 +69,14 @@ EDA_LibComponentStruct * Read_Component_Definition(WinEDA_DrawFrame * frame, cha
FILE *f, int *LineNum); FILE *f, int *LineNum);
/* Routine to Read a DEF/ENDDEF part entry from given open file. */ /* Routine to Read a DEF/ENDDEF part entry from given open file. */
/** Function TransformCoordinate
* Calculate the wew coordinate from the old one, according to the transform matrix.
* @param aTransformMatrix = rotation, mirror .. matrix
* @param aPosition = the position to transform
* @return the new coordinate
*/
wxPoint TransformCoordinate( int aTransformMatrix[2][2], wxPoint & aPosition );
LibraryStruct *FindLibrary(const wxString & Name); LibraryStruct *FindLibrary(const wxString & Name);
int LoadDocLib(WinEDA_DrawFrame * frame, const wxString & FullDocLibName, const wxString & Libname); int LoadDocLib(WinEDA_DrawFrame * frame, const wxString & FullDocLibName, const wxString & Libname);
PriorQue *LoadLibraryAux(WinEDA_DrawFrame * frame, LibraryStruct * library, PriorQue *LoadLibraryAux(WinEDA_DrawFrame * frame, LibraryStruct * library,
......
...@@ -156,11 +156,11 @@ bool LibDrawPolyline::WriteDescr( FILE* ExportFile ) ...@@ -156,11 +156,11 @@ 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, m_CornersCount,
m_Unit, m_Convert, m_Unit, m_Convert,
m_Width ); m_Width );
ptpoly = PolyList; ptpoly = m_PolyList;
for( ii = n; ii > 0; ii-- ) for( ii = m_CornersCount; ii > 0; ii-- )
{ {
fprintf( ExportFile, " %d %d", *ptpoly, *(ptpoly + 1) ); fprintf( ExportFile, " %d %d", *ptpoly, *(ptpoly + 1) );
ptpoly += 2; ptpoly += 2;
......
...@@ -261,9 +261,9 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC ) ...@@ -261,9 +261,9 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
LibDrawPolyline* polyline = new LibDrawPolyline(); LibDrawPolyline* polyline = new LibDrawPolyline();
CurrentDrawItem = polyline; CurrentDrawItem = polyline;
polyline->n = 2; polyline->m_CornersCount = 2;
ptpoly = (int*) MyZMalloc( 4 * sizeof(int) ); ptpoly = (int*) MyZMalloc( 4 * sizeof(int) );
polyline->PolyList = ptpoly; polyline->m_PolyList = ptpoly;
ptpoly[0] = ptpoly[2] = GetScreen()->m_Curseur.x; ptpoly[0] = ptpoly[2] = GetScreen()->m_Curseur.x;
ptpoly[1] = ptpoly[3] = -( GetScreen()->m_Curseur.y ); ptpoly[1] = ptpoly[3] = -( GetScreen()->m_Curseur.y );
polyline->m_Fill = FlSymbol_Fill; polyline->m_Fill = FlSymbol_Fill;
...@@ -444,8 +444,8 @@ void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos ) ...@@ -444,8 +444,8 @@ void MoveLibDrawItemAt( LibEDA_BaseStruct* DrawItem, wxPoint newpos )
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
{ {
int ii, imax = ( (LibDrawPolyline*) CurrentDrawItem )->n * 2; int ii, imax = ( (LibDrawPolyline*) CurrentDrawItem )->m_CornersCount * 2;
int* ptpoly = ( (LibDrawPolyline*) CurrentDrawItem )->PolyList; int* ptpoly = ( (LibDrawPolyline*) CurrentDrawItem )->m_PolyList;
int dx = mx - ptpoly[0]; int dx = mx - ptpoly[0];
int dy = -my - ptpoly[1]; int dy = -my - ptpoly[1];
for( ii = 0; ii < imax; ii += 2 ) for( ii = 0; ii < imax; ii += 2 )
...@@ -497,8 +497,8 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC ) ...@@ -497,8 +497,8 @@ void WinEDA_LibeditFrame::StartMoveDrawSymbol( wxDC* DC )
break; break;
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
InitPosition.x = *( (LibDrawPolyline*) CurrentDrawItem )->PolyList; InitPosition.x = *( (LibDrawPolyline*) CurrentDrawItem )->m_PolyList;
InitPosition.y = *( ( (LibDrawPolyline*) CurrentDrawItem )->PolyList + 1 ); InitPosition.y = *( ( (LibDrawPolyline*) CurrentDrawItem )->m_PolyList + 1 );
break; break;
case COMPONENT_LINE_DRAW_TYPE: case COMPONENT_LINE_DRAW_TYPE:
...@@ -589,8 +589,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -589,8 +589,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
break; break;
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
ptpoly = ( (LibDrawPolyline*) CurrentDrawItem )->PolyList; ptpoly = ( (LibDrawPolyline*) CurrentDrawItem )->m_PolyList;
ptpoly += 2 * ( ( (LibDrawPolyline*) CurrentDrawItem )->n - 1 ); ptpoly += 2 * ( ( (LibDrawPolyline*) CurrentDrawItem )->m_CornersCount - 1 );
ptpoly[0] = mx; ptpoly[0] = mx;
ptpoly[1] = -my; ptpoly[1] = -my;
( (LibDrawPolyline*) CurrentDrawItem )->m_Fill = FlSymbol_Fill; ( (LibDrawPolyline*) CurrentDrawItem )->m_Fill = FlSymbol_Fill;
...@@ -827,10 +827,10 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC ) ...@@ -827,10 +827,10 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, 0, 0, DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, 0, 0,
CurrentDrawItem, CurrentUnit, g_XorMode ); CurrentDrawItem, CurrentUnit, g_XorMode );
while( Poly->n > 2 ) // First segment is kept, only its end point is changed while( Poly->m_CornersCount > 2 ) // First segment is kept, only its end point is changed
{ {
Poly->n--; Poly->m_CornersCount--;
ptpoly = Poly->PolyList + ( 2 * (Poly->n - 1) ); ptpoly = Poly->m_PolyList + ( 2 * (Poly->m_CornersCount - 1) );
if( (ptpoly[0] != GetScreen()->m_Curseur.x) if( (ptpoly[0] != GetScreen()->m_Curseur.x)
|| (ptpoly[1] != -GetScreen()->m_Curseur.y) ) || (ptpoly[1] != -GetScreen()->m_Curseur.y) )
{ {
...@@ -840,8 +840,8 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC ) ...@@ -840,8 +840,8 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
} }
} }
int allocsize = 2 * sizeof(int) * Poly->n; int allocsize = 2 * sizeof(int) * Poly->m_CornersCount;
Poly->PolyList = (int*) realloc( Poly->PolyList, allocsize ); Poly->m_PolyList = (int*) realloc( Poly->m_PolyList, allocsize );
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, 0, 0, DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, 0, 0,
CurrentDrawItem, CurrentUnit, g_XorMode ); CurrentDrawItem, CurrentUnit, g_XorMode );
......
...@@ -398,11 +398,11 @@ static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef, ...@@ -398,11 +398,11 @@ static bool CompareSymbols( LibEDA_BaseStruct* DEntryRef,
#undef CMPSTRUCT #undef CMPSTRUCT
#define REFSTRUCT ( (LibDrawPolyline*) DEntryRef ) #define REFSTRUCT ( (LibDrawPolyline*) DEntryRef )
#define CMPSTRUCT ( (LibDrawPolyline*) DEntryCompare ) #define CMPSTRUCT ( (LibDrawPolyline*) DEntryCompare )
if( REFSTRUCT->n != CMPSTRUCT->n ) if( REFSTRUCT->m_CornersCount != CMPSTRUCT->m_CornersCount )
return FALSE; return FALSE;
ptref = REFSTRUCT->PolyList; ptref = REFSTRUCT->m_PolyList;
ptcomp = CMPSTRUCT->PolyList; ptcomp = CMPSTRUCT->m_PolyList;
for( ii = 2 * REFSTRUCT->n; ii > 0; ii-- ) for( ii = 2 * REFSTRUCT->m_CornersCount; ii > 0; ii-- )
{ {
if( *ptref != *ptcomp ) if( *ptref != *ptcomp )
return FALSE; return FALSE;
...@@ -495,14 +495,14 @@ void WinEDA_LibeditFrame::PlaceAncre() ...@@ -495,14 +495,14 @@ void WinEDA_LibeditFrame::PlaceAncre()
case COMPONENT_POLYLINE_DRAW_TYPE: case COMPONENT_POLYLINE_DRAW_TYPE:
#undef STRUCT #undef STRUCT
#define STRUCT ( (LibDrawPolyline*) DrawEntry ) #define STRUCT ( (LibDrawPolyline*) DrawEntry )
ptsegm = STRUCT->PolyList; ptsegm = STRUCT->m_PolyList;
for( ii = STRUCT->n; ii > 0; ii-- ) for( ii = STRUCT->m_CornersCount; ii > 0; ii-- )
{ {
*ptsegm += dx; ptsegm++; *ptsegm += dx; ptsegm++;
*ptsegm += dy; ptsegm++; *ptsegm += dy; ptsegm++;
} }
break; break;
default: default:
; ;
} }
......
...@@ -22,9 +22,9 @@ DEBUG = 0 ...@@ -22,9 +22,9 @@ DEBUG = 0
#Define the wxWidget path (if not found in environment variables): #Define the wxWidget path (if not found in environment variables):
ifndef WXWIN ifndef WXWIN
ifeq ($(DEBUG), 1) ifeq ($(DEBUG), 1)
WXWIN=f:/wxMSW-2.8.8-debug WXWIN=f:/wxMSW-2.8.9-debug
else else
WXWIN=f:/wxMSW-2.8.8 WXWIN=f:/wxMSW-2.8.9-rc1
endif endif
endif endif
LIBVERSION = 2.8 LIBVERSION = 2.8
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment