Commit c65942e1 authored by charras's avatar charras

eeschema: code cleaning

parent 45a066ab
...@@ -462,8 +462,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -462,8 +462,7 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
if( CurrentConvert && item->m_Convert && (item->m_Convert != CurrentConvert) ) if( CurrentConvert && item->m_Convert && (item->m_Convert != CurrentConvert) )
continue; continue;
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, DrawLibraryDrawStruct( panel, DC, CurrentLibEntry,
PtBlock->m_MoveVector.x, PtBlock->m_MoveVector.y, PtBlock->m_MoveVector, item, g_XorMode );
item, CurrentUnit, g_XorMode );
} }
} }
} }
...@@ -491,8 +490,8 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -491,8 +490,8 @@ static void DrawMovingBlockOutlines( WinEDA_DrawPanel* panel, wxDC* DC,
if( CurrentConvert && item->m_Convert && (item->m_Convert != CurrentConvert) ) if( CurrentConvert && item->m_Convert && (item->m_Convert != CurrentConvert) )
continue; continue;
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, DrawLibraryDrawStruct( panel, DC, CurrentLibEntry,
PtBlock->m_MoveVector.x, PtBlock->m_MoveVector.y, PtBlock->m_MoveVector,
item, CurrentUnit, g_XorMode ); item, g_XorMode );
} }
} }
} }
......
...@@ -665,3 +665,166 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient, ...@@ -665,3 +665,166 @@ void LibDrawPin::PlotPinTexts( wxPoint& pin_pos, int orient,
} }
} }
} }
/***************************************************************/
LibDrawPin::LibDrawPin() : LibEDA_BaseStruct( COMPONENT_PIN_DRAW_TYPE )
/***************************************************************/
{
m_PinLen = 300; /* default Pin len */
m_Orient = PIN_RIGHT; /* Pin oprient: Up, Down, Left, Right */
m_PinShape = NONE; /* Bit a bit: Pin shape (voir enum prec) */
m_PinType = PIN_UNSPECIFIED; /* electrical type of pin */
m_Attributs = 0; /* bit 0 != 0: pin invisible */
m_PinNum = 0; /*pin number ( i.e. 4 codes Ascii ) */
m_PinNumSize = 50;
m_PinNameSize = 50; /* Default size for pin name and num */
m_Width = 0;
// m_PinNumWidth = m_PinNameWidth = 0; // Unused
}
/******************************************/
wxPoint LibDrawPin::ReturnPinEndPoint()
/******************************************/
/* return the pin end position, for a component in normal orient
*/
{
wxPoint pos = m_Pos;
switch( m_Orient )
{
case PIN_UP:
pos.y += m_PinLen; break;
case PIN_DOWN:
pos.y -= m_PinLen; break;
case PIN_LEFT:
pos.x -= m_PinLen; break;
case PIN_RIGHT:
pos.x += m_PinLen; break;
}
return pos;
}
/********************************************************/
int LibDrawPin::ReturnPinDrawOrient( int TransMat[2][2] )
/********************************************************/
/* Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT),
* according to its orientation,
* AND the matrix transform (rot, mirror) TransMat
*/
{
int orient;
int x1 = 0, y1 = 0;
int t1, t2;
switch( m_Orient )
{
case PIN_UP:
y1 = 1; break;
case PIN_DOWN:
y1 = -1; break;
case PIN_LEFT:
x1 = -1; break;
case PIN_RIGHT:
x1 = 1; break;
}
t1 = TransMat[0][0] * x1 + TransMat[0][1] * y1;
t2 = TransMat[1][0] * x1 + TransMat[1][1] * y1;
orient = PIN_UP;
if( t1 == 0 )
{
if( t2 > 0 )
orient = PIN_DOWN;
}
else
{
orient = PIN_RIGHT;
if( t1 < 0 )
orient = PIN_LEFT;
}
return orient;
}
/****************************************************/
void LibDrawPin::ReturnPinStringNum( wxString& buffer )
/****************************************************/
/* fill the buffer with pin num as a wxString
* Pin num is coded as a long
* Used to print/draw the pin num
*/
{
char ascii_buf[5];
strncpy( ascii_buf, (char*) &m_PinNum, 4 );
ascii_buf[4] = 0;
buffer = CONV_FROM_UTF8( ascii_buf );
}
/****************************************************/
void LibDrawPin::SetPinNumFromString( wxString& buffer )
/****************************************************/
/* fill the buffer with pin num as a wxString
* Pin num is coded as a long
* Used to print/draw the pin num
*/
{
char ascii_buf[4];
unsigned ii, len = buffer.Len();
ascii_buf[0] = ascii_buf[1] = ascii_buf[2] = ascii_buf[3] = 0;
if( len > 4 )
len = 4;
for( ii = 0; ii < len; ii++ )
{
ascii_buf[ii] = buffer.GetChar( ii ) & 0xFF;
}
strncpy( (char*) &m_PinNum, ascii_buf, 4 );
}
/*************************************/
LibDrawPin* LibDrawPin::GenCopy()
/*************************************/
{
LibDrawPin* newpin = new LibDrawPin();
newpin->m_Pos = m_Pos;
newpin->m_PinLen = m_PinLen;
newpin->m_Orient = m_Orient;
newpin->m_PinShape = m_PinShape;
newpin->m_PinType = m_PinType;
newpin->m_Attributs = m_Attributs;
newpin->m_PinNum = m_PinNum;
newpin->m_PinNumSize = m_PinNumSize;
newpin->m_PinNameSize = m_PinNameSize;
newpin->m_Unit = m_Unit;
newpin->m_Convert = m_Convert;
newpin->m_Flags = m_Flags;
newpin->m_Width = m_Width;
newpin->m_PinName = m_PinName;
return newpin;
}
...@@ -15,6 +15,20 @@ ...@@ -15,6 +15,20 @@
//#define DRAW_ARC_WITH_ANGLE // Used to draw arcs //#define DRAW_ARC_WITH_ANGLE // Used to draw arcs
/* Basic class (abstract) for components bodies items */
LibEDA_BaseStruct::LibEDA_BaseStruct( KICAD_T struct_type ) :
EDA_BaseStruct( struct_type )
{
m_Unit = 0; /* Unit identification (for multi part per package)
* 0 if the item is common to all units */
m_Convert = 0; /* Shape identification (for parts which have a convert shape)
* 0 if the item is common to all shapes */
m_Width = 0; /* Default value to draw lines or arc ... */
m_Fill = NO_FILL; /* NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR.
* has meaning only for some items */
}
/** Function Draw (virtual) /** Function Draw (virtual)
* Draw A body item * Draw A body item
* @param aPanel = DrawPanel to use (can be null) mainly used for clipping purposes * @param aPanel = DrawPanel to use (can be null) mainly used for clipping purposes
...@@ -70,10 +84,14 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffs ...@@ -70,10 +84,14 @@ void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffs
else else
#ifdef DRAW_ARC_WITH_ANGLE #ifdef DRAW_ARC_WITH_ANGLE
GRArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2, GRArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2,
m_Rayon, LineWidth, color ); m_Rayon, LineWidth, color );
#else #else
GRArc1( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, GRArc1( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y,
posc.x, posc.y, LineWidth, color ); posc.x, posc.y, LineWidth, color );
#endif #endif
......
...@@ -132,6 +132,7 @@ public: ...@@ -132,6 +132,7 @@ public:
* 0 if the item is common to all shapes */ * 0 if the item is common to all shapes */
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */ wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */
int m_Width; /* Tickness */ int m_Width; /* Tickness */
FILL_T m_Fill; /* NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR. has meaning only for some items */
public: public:
LibEDA_BaseStruct* Next() LibEDA_BaseStruct* Next()
...@@ -154,7 +155,7 @@ public: ...@@ -154,7 +155,7 @@ public:
* used for some items to force to force no fill mode * used for some items to force to force no fill mode
* ( has meaning only for items what can be filled ). used in printing or moving objects mode * ( has meaning only for items what can be filled ). used in printing or moving objects mode
* or to pass refernce to the lib component for pins * or to pass refernce to the lib component for pins
* @param aTransformMatrix = Transform Matrix * @param aTransformMatrix = Transform Matrix (rotaion, mirror ..)
*/ */
virtual void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor, virtual void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor,
int aDrawMode, void * aData, int aTransformMatrix[2][2] ) = 0; int aDrawMode, void * aData, int aTransformMatrix[2][2] ) = 0;
...@@ -223,7 +224,6 @@ class LibDrawArc : public LibEDA_BaseStruct ...@@ -223,7 +224,6 @@ class LibDrawArc : public LibEDA_BaseStruct
{ {
public: public:
int m_Rayon; int m_Rayon;
FILL_T m_Fill; // NO_FILL, FILLED_SHAPE or FILLED_WITH_BG_BODYCOLOR
int t1, t2; /* position des 2 extremites de l'arc en 0.1 degres */ int t1, t2; /* position des 2 extremites de l'arc en 0.1 degres */
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*/
...@@ -249,7 +249,6 @@ class LibDrawCircle : public LibEDA_BaseStruct ...@@ -249,7 +249,6 @@ class LibDrawCircle : public LibEDA_BaseStruct
{ {
public: public:
int m_Rayon; int m_Rayon;
FILL_T m_Fill;
public: public:
LibDrawCircle(); LibDrawCircle();
...@@ -304,7 +303,6 @@ class LibDrawSquare : public LibEDA_BaseStruct ...@@ -304,7 +303,6 @@ class LibDrawSquare : public LibEDA_BaseStruct
{ {
public: public:
wxPoint m_End; wxPoint m_End;
FILL_T m_Fill;
public: public:
LibDrawSquare(); LibDrawSquare();
...@@ -352,7 +350,6 @@ class LibDrawPolyline : public LibEDA_BaseStruct ...@@ -352,7 +350,6 @@ class LibDrawPolyline : public LibEDA_BaseStruct
public: public:
int m_CornersCount; int m_CornersCount;
int* m_PolyList; int* m_PolyList;
FILL_T m_Fill;
public: public:
LibDrawPolyline(); LibDrawPolyline();
...@@ -392,7 +389,6 @@ class LibDrawField : public LibEDA_BaseStruct ...@@ -392,7 +389,6 @@ class LibDrawField : public LibEDA_BaseStruct
public: public:
int m_FieldId; // 0 a 11 int m_FieldId; // 0 a 11
// 0 = Name; 1 = Valeur; 2 .. 11 other fields // 0 = Name; 1 = Valeur; 2 .. 11 other fields
wxPoint m_Pos;
wxSize m_Size; wxSize m_Size;
int m_Orient; /* Orientation */ int m_Orient; /* Orientation */
int m_Attributs; /* Attributes (Non visible ...) */ int m_Attributs; /* Attributes (Non visible ...) */
......
...@@ -540,7 +540,7 @@ void DeleteOneLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC, ...@@ -540,7 +540,7 @@ void DeleteOneLibraryDrawStruct( WinEDA_DrawPanel* panel, wxDC* DC,
/* Effacement du graphique */ /* Effacement du graphique */
if( Affiche && DC ) if( Affiche && DC )
DrawLibraryDrawStruct( panel, DC, LibEntry, 0, 0, DrawItem, CurrentUnit, g_XorMode ); DrawLibraryDrawStruct( panel, DC, LibEntry, wxPoint(0, 0), DrawItem, g_XorMode );
/* Effacement de la structure en memoire */ /* Effacement de la structure en memoire */
if( LibEntry ) /* Recherche du predecesseur */ if( LibEntry ) /* Recherche du predecesseur */
......
This diff is collapsed.
...@@ -434,179 +434,6 @@ void LibDrawField::Copy( LibDrawField* Target ) ...@@ -434,179 +434,6 @@ void LibDrawField::Copy( LibDrawField* Target )
} }
/* Elements Graphiques */
LibEDA_BaseStruct::LibEDA_BaseStruct( KICAD_T struct_type ) :
EDA_BaseStruct( struct_type )
{
m_Unit = 0; /* Unit identification (for multi part per package)
* 0 if the item is common to all units */
m_Convert = 0; /* Shape identification (for parts which have a convert shape)
* 0 if the item is common to all shapes */
m_Width = 0; /* Default value to draw lines or arc ... */
}
/***************************************************************/
LibDrawPin::LibDrawPin() : LibEDA_BaseStruct( COMPONENT_PIN_DRAW_TYPE )
/***************************************************************/
{
m_PinLen = 300; /* default Pin len */
m_Orient = PIN_RIGHT; /* Pin oprient: Up, Down, Left, Right */
m_PinShape = NONE; /* Bit a bit: Pin shape (voir enum prec) */
m_PinType = PIN_UNSPECIFIED; /* electrical type of pin */
m_Attributs = 0; /* bit 0 != 0: pin invisible */
m_PinNum = 0; /*pin number ( i.e. 4 codes Ascii ) */
m_PinNumSize = 50;
m_PinNameSize = 50; /* Default size for pin name and num */
m_Width = 0;
// m_PinNumWidth = m_PinNameWidth = 0; // Unused
}
/******************************************/
wxPoint LibDrawPin::ReturnPinEndPoint()
/******************************************/
/* return the pin end position, for a component in normal orient
*/
{
wxPoint pos = m_Pos;
switch( m_Orient )
{
case PIN_UP:
pos.y += m_PinLen; break;
case PIN_DOWN:
pos.y -= m_PinLen; break;
case PIN_LEFT:
pos.x -= m_PinLen; break;
case PIN_RIGHT:
pos.x += m_PinLen; break;
}
return pos;
}
/********************************************************/
int LibDrawPin::ReturnPinDrawOrient( int TransMat[2][2] )
/********************************************************/
/* Return the pin real orientation (PIN_UP, PIN_DOWN, PIN_RIGHT, PIN_LEFT),
* according to its orientation,
* AND the matrix transform (rot, mirror) TransMat
*/
{
int orient;
int x1 = 0, y1 = 0;
int t1, t2;
switch( m_Orient )
{
case PIN_UP:
y1 = 1; break;
case PIN_DOWN:
y1 = -1; break;
case PIN_LEFT:
x1 = -1; break;
case PIN_RIGHT:
x1 = 1; break;
}
t1 = TransMat[0][0] * x1 + TransMat[0][1] * y1;
t2 = TransMat[1][0] * x1 + TransMat[1][1] * y1;
orient = PIN_UP;
if( t1 == 0 )
{
if( t2 > 0 )
orient = PIN_DOWN;
}
else
{
orient = PIN_RIGHT;
if( t1 < 0 )
orient = PIN_LEFT;
}
return orient;
}
/****************************************************/
void LibDrawPin::ReturnPinStringNum( wxString& buffer )
/****************************************************/
/* fill the buffer with pin num as a wxString
* Pin num is coded as a long
* Used to print/draw the pin num
*/
{
char ascii_buf[5];
strncpy( ascii_buf, (char*) &m_PinNum, 4 );
ascii_buf[4] = 0;
buffer = CONV_FROM_UTF8( ascii_buf );
}
/****************************************************/
void LibDrawPin::SetPinNumFromString( wxString& buffer )
/****************************************************/
/* fill the buffer with pin num as a wxString
* Pin num is coded as a long
* Used to print/draw the pin num
*/
{
char ascii_buf[4];
unsigned ii, len = buffer.Len();
ascii_buf[0] = ascii_buf[1] = ascii_buf[2] = ascii_buf[3] = 0;
if( len > 4 )
len = 4;
for( ii = 0; ii < len; ii++ )
{
ascii_buf[ii] = buffer.GetChar( ii ) & 0xFF;
}
strncpy( (char*) &m_PinNum, ascii_buf, 4 );
}
/*************************************/
LibDrawPin* LibDrawPin::GenCopy()
/*************************************/
{
LibDrawPin* newpin = new LibDrawPin();
newpin->m_Pos = m_Pos;
newpin->m_PinLen = m_PinLen;
newpin->m_Orient = m_Orient;
newpin->m_PinShape = m_PinShape;
newpin->m_PinType = m_PinType;
newpin->m_Attributs = m_Attributs;
newpin->m_PinNum = m_PinNum;
newpin->m_PinNumSize = m_PinNumSize;
newpin->m_PinNameSize = m_PinNameSize;
newpin->m_Unit = m_Unit;
newpin->m_Convert = m_Convert;
newpin->m_Flags = m_Flags;
newpin->m_Width = m_Width;
newpin->m_PinName = m_PinName;
return newpin;
}
/**************************************************************/ /**************************************************************/
LibDrawArc::LibDrawArc() : LibEDA_BaseStruct( COMPONENT_ARC_DRAW_TYPE ) LibDrawArc::LibDrawArc() : LibEDA_BaseStruct( COMPONENT_ARC_DRAW_TYPE )
/**************************************************************/ /**************************************************************/
......
...@@ -88,7 +88,7 @@ void WinEDA_PinPropertiesFrame::PinPropertiesAccept( wxCommandEvent& event ) ...@@ -88,7 +88,7 @@ void WinEDA_PinPropertiesFrame::PinPropertiesAccept( wxCommandEvent& event )
m_Parent->DrawPanel->ManageCurseur( m_Parent->DrawPanel, &dc, FALSE ); m_Parent->DrawPanel->ManageCurseur( m_Parent->DrawPanel, &dc, FALSE );
else else
DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry, DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry,
0, 0, CurrentPin, CurrentUnit, g_XorMode ); wxPoint(0, 0), CurrentPin, g_XorMode );
SetPinName( m_PinNameCtrl->GetValue(), LastPinNameSize ); SetPinName( m_PinNameCtrl->GetValue(), LastPinNameSize );
msg = m_PinNumCtrl->GetValue(); if( msg.IsEmpty() ) msg = m_PinNumCtrl->GetValue(); if( msg.IsEmpty() )
...@@ -103,7 +103,7 @@ void WinEDA_PinPropertiesFrame::PinPropertiesAccept( wxCommandEvent& event ) ...@@ -103,7 +103,7 @@ void WinEDA_PinPropertiesFrame::PinPropertiesAccept( wxCommandEvent& event )
m_Parent->DrawPanel->ManageCurseur( m_Parent->DrawPanel, &dc, FALSE ); m_Parent->DrawPanel->ManageCurseur( m_Parent->DrawPanel, &dc, FALSE );
else else
DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry, DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry,
0, 0, CurrentPin, CurrentUnit, g_XorMode ); wxPoint(0, 0), CurrentPin, g_XorMode );
} }
if( CurrentDrawItem ) if( CurrentDrawItem )
...@@ -250,7 +250,7 @@ void WinEDA_LibeditFrame::PlacePin( wxDC* DC ) ...@@ -250,7 +250,7 @@ void WinEDA_LibeditFrame::PlacePin( wxDC* DC )
} }
DrawPanel->CursorOff( DC ); DrawPanel->CursorOff( DC );
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, 0, 0, CurrentPin, CurrentUnit, DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0), CurrentPin,
GR_DEFAULT_DRAWMODE ); GR_DEFAULT_DRAWMODE );
DrawPanel->CursorOn( DC ); DrawPanel->CursorOn( DC );
...@@ -344,14 +344,14 @@ static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -344,14 +344,14 @@ static void DrawMovePin( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
if( erase || (CurrentPin->m_Flags & IS_NEW) ) if( erase || (CurrentPin->m_Flags & IS_NEW) )
{ {
CurrentPin->m_Pos = PinPreviousPos; CurrentPin->m_Pos = PinPreviousPos;
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, 0, 0, DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, wxPoint(0, 0),
CurrentPin, CurrentUnit, g_XorMode ); CurrentPin, g_XorMode );
} }
/* Redraw pin in new position */ /* Redraw pin in new position */
CurrentPin->m_Pos.x = panel->GetScreen()->m_Curseur.x; CurrentPin->m_Pos.x = panel->GetScreen()->m_Curseur.x;
CurrentPin->m_Pos.y = -panel->GetScreen()->m_Curseur.y; CurrentPin->m_Pos.y = -panel->GetScreen()->m_Curseur.y;
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, 0, 0, CurrentPin, CurrentUnit, g_XorMode ); DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, wxPoint(0, 0), CurrentPin, g_XorMode );
PinPreviousPos = CurrentPin->m_Pos; PinPreviousPos = CurrentPin->m_Pos;
...@@ -608,7 +608,7 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC ) ...@@ -608,7 +608,7 @@ void WinEDA_LibeditFrame::CreatePin( wxDC* DC )
if( DC ) if( DC )
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry,
0, 0, CurrentPin, CurrentUnit, g_XorMode ); wxPoint(0, 0), CurrentPin, g_XorMode );
DrawPanel->m_IgnoreMouseEvents = TRUE; DrawPanel->m_IgnoreMouseEvents = TRUE;
InstallPineditFrame( this, DC, wxPoint( -1, -1 ) ); InstallPineditFrame( this, DC, wxPoint( -1, -1 ) );
...@@ -872,7 +872,7 @@ void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC, ...@@ -872,7 +872,7 @@ void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC,
if( selected && (Pin->m_Selected & IS_SELECTED) == 0 ) if( selected && (Pin->m_Selected & IS_SELECTED) == 0 )
continue; continue;
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, 0, 0, Pin, CurrentUnit, g_XorMode ); DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0), Pin, g_XorMode );
switch( id ) switch( id )
{ {
...@@ -889,8 +889,7 @@ void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC, ...@@ -889,8 +889,7 @@ void WinEDA_LibeditFrame::GlobalSetPins( wxDC* DC,
break; break;
} }
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, 0, 0, Pin, CurrentUnit, DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0), Pin, GR_DEFAULT_DRAWMODE );
GR_DEFAULT_DRAWMODE );
} }
} }
......
...@@ -54,10 +54,10 @@ void DrawLibEntry(WinEDA_DrawPanel * panel, wxDC * DC, ...@@ -54,10 +54,10 @@ void DrawLibEntry(WinEDA_DrawPanel * panel, wxDC * DC,
int Multi, int convert, int Multi, int convert,
int DrawMode, int Color = -1); int DrawMode, int Color = -1);
void DrawLibraryDrawStruct(WinEDA_DrawPanel * panel, wxDC * DC, void DrawLibraryDrawStruct(WinEDA_DrawPanel * aPanel, wxDC * aDC,
EDA_LibComponentStruct *LibEntry, int PartX, int PartY, EDA_LibComponentStruct *aLibEntry, wxPoint aPosition,
LibEDA_BaseStruct *DrawItem, int Multi, LibEDA_BaseStruct *aDrawItem,
int DrawMode, int Color = -1); int aDrawMode, int aColor = -1);
bool MapAngles(int *Angle1, int *Angle2, int TransMat[2][2]); bool MapAngles(int *Angle1, int *Angle2, int TransMat[2][2]);
......
...@@ -60,8 +60,8 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event ) ...@@ -60,8 +60,8 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event )
m_Parent->DrawPanel->PrepareGraphicContext( &dc ); m_Parent->DrawPanel->PrepareGraphicContext( &dc );
DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry, 0, 0, DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry, wxPoint(0, 0),
CurrentDrawItem, CurrentUnit, g_XorMode ); CurrentDrawItem, g_XorMode );
if( g_FlDrawSpecificUnit ) if( g_FlDrawSpecificUnit )
CurrentDrawItem->m_Unit = CurrentUnit; CurrentDrawItem->m_Unit = CurrentUnit;
...@@ -104,8 +104,8 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event ) ...@@ -104,8 +104,8 @@ bodygraphics_PropertiesAccept( wxCommandEvent& event )
m_Parent->GetScreen()->SetModify(); m_Parent->GetScreen()->SetModify();
DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry, 0, 0, DrawLibraryDrawStruct( m_Parent->DrawPanel, &dc, CurrentLibEntry, wxPoint(0, 0),
CurrentDrawItem, CurrentUnit, g_XorMode ); CurrentDrawItem, g_XorMode );
} }
Close(); Close();
...@@ -150,8 +150,8 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -150,8 +150,8 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->m_Parent->RedrawActiveWindow( DC, TRUE ); Panel->m_Parent->RedrawActiveWindow( DC, TRUE );
} }
else else
DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, 0, 0, DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, wxPoint(0, 0),
CurrentDrawItem, CurrentUnit, g_XorMode ); CurrentDrawItem, g_XorMode );
SAFE_DELETE( CurrentDrawItem ); SAFE_DELETE( CurrentDrawItem );
} }
else else
...@@ -161,8 +161,8 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC ) ...@@ -161,8 +161,8 @@ static void AbortSymbolTraceOn( WinEDA_DrawPanel* Panel, wxDC* DC )
Panel->GetScreen()->m_Curseur = StartCursor; Panel->GetScreen()->m_Curseur = StartCursor;
RedrawWhileMovingCursor( Panel, DC, TRUE ); RedrawWhileMovingCursor( Panel, DC, TRUE );
Panel->GetScreen()->m_Curseur = curpos; Panel->GetScreen()->m_Curseur = curpos;
DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, 0, 0, DrawLibraryDrawStruct( Panel, DC, CurrentLibEntry, wxPoint(0, 0),
CurrentDrawItem, CurrentUnit, GR_DEFAULT_DRAWMODE ); CurrentDrawItem, GR_DEFAULT_DRAWMODE );
CurrentDrawItem->m_Flags = 0; CurrentDrawItem->m_Flags = 0;
} }
...@@ -303,8 +303,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC ) ...@@ -303,8 +303,8 @@ LibEDA_BaseStruct* WinEDA_LibeditFrame::CreateGraphicItem( wxDC* DC )
else else
{ {
StartMoveDrawSymbol( DC ); StartMoveDrawSymbol( DC );
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, 0, 0, DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
Text, CurrentUnit, g_XorMode ); Text, g_XorMode );
} }
} }
break; break;
...@@ -383,23 +383,20 @@ static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool era ...@@ -383,23 +383,20 @@ static void RedrawWhileMovingCursor( WinEDA_DrawPanel* panel, wxDC* DC, bool era
*/ */
{ {
BASE_SCREEN* Screen = panel->GetScreen(); BASE_SCREEN* Screen = panel->GetScreen();
int mx, my; wxPoint pos;
/* Erase shape in the old positon*/ /* Erase shape in the old positon*/
if( erase ) if( erase )
{ {
mx = ItemPreviousPos.x - StartCursor.x, pos = ItemPreviousPos - StartCursor,
my = ItemPreviousPos.y - StartCursor.y; DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, pos,
CurrentDrawItem, g_XorMode );
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, mx, my,
CurrentDrawItem, CurrentUnit, g_XorMode );
} }
/* Redraw moved shape */ /* Redraw moved shape */
mx = Screen->m_Curseur.x - StartCursor.x, pos = Screen->m_Curseur - StartCursor,
my = Screen->m_Curseur.y - StartCursor.y; DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, pos,
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, mx, my, CurrentDrawItem, g_XorMode );
CurrentDrawItem, CurrentUnit, g_XorMode );
ItemPreviousPos = Screen->m_Curseur; ItemPreviousPos = Screen->m_Curseur;
} }
...@@ -543,8 +540,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -543,8 +540,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
} }
else else
{ {
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, 0, 0, DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, wxPoint(0, 0),
CurrentDrawItem, CurrentUnit, DrawMode ); CurrentDrawItem, DrawMode );
if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE ) if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE )
{ {
int Color = ReturnLayerColor( LAYER_DEVICE ); int Color = ReturnLayerColor( LAYER_DEVICE );
...@@ -615,8 +612,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase ) ...@@ -615,8 +612,8 @@ static void SymbolDisplayDraw( WinEDA_DrawPanel* panel, wxDC* DC, bool erase )
} }
else else
{ {
DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, 0, 0, DrawLibraryDrawStruct( panel, DC, CurrentLibEntry, wxPoint(0, 0),
CurrentDrawItem, CurrentUnit, DrawMode ); CurrentDrawItem, DrawMode );
if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE ) if( CurrentDrawItem->Type() == COMPONENT_ARC_DRAW_TYPE )
{ {
int Color = ReturnLayerColor( LAYER_DEVICE ); int Color = ReturnLayerColor( LAYER_DEVICE );
...@@ -824,8 +821,8 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC ) ...@@ -824,8 +821,8 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
int* ptpoly; int* ptpoly;
LibDrawPolyline* Poly = (LibDrawPolyline*) CurrentDrawItem; LibDrawPolyline* Poly = (LibDrawPolyline*) CurrentDrawItem;
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, 0, 0, DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
CurrentDrawItem, CurrentUnit, g_XorMode ); CurrentDrawItem, g_XorMode );
while( Poly->m_CornersCount > 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
{ {
...@@ -843,6 +840,6 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC ) ...@@ -843,6 +840,6 @@ void WinEDA_LibeditFrame::DeleteDrawPoly( wxDC* DC )
int allocsize = 2 * sizeof(int) * Poly->m_CornersCount; int allocsize = 2 * sizeof(int) * Poly->m_CornersCount;
Poly->m_PolyList = (int*) realloc( Poly->m_PolyList, allocsize ); Poly->m_PolyList = (int*) realloc( Poly->m_PolyList, allocsize );
DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, 0, 0, DrawLibraryDrawStruct( DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
CurrentDrawItem, CurrentUnit, g_XorMode ); CurrentDrawItem, g_XorMode );
} }
...@@ -291,8 +291,8 @@ int DrawMode = g_XorMode; ...@@ -291,8 +291,8 @@ int DrawMode = g_XorMode;
/* Effacement ancien texte */ /* Effacement ancien texte */
if( ((LibDrawText*)DrawItem)->m_Text && DC) if( ((LibDrawText*)DrawItem)->m_Text && DC)
DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, 0 , 0, DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
DrawItem, CurrentUnit, DrawMode); DrawItem, DrawMode);
WinEDA_bodytext_PropertiesFrame * frame = WinEDA_bodytext_PropertiesFrame * frame =
...@@ -306,8 +306,8 @@ int DrawMode = g_XorMode; ...@@ -306,8 +306,8 @@ int DrawMode = g_XorMode;
{ {
if ( (DrawItem->m_Flags & IS_MOVED) == 0 ) if ( (DrawItem->m_Flags & IS_MOVED) == 0 )
DrawMode = GR_DEFAULT_DRAWMODE; DrawMode = GR_DEFAULT_DRAWMODE;
DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, 0 , 0, DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
DrawItem, CurrentUnit, DrawMode); DrawItem, DrawMode);
} }
} }
...@@ -325,8 +325,8 @@ LibDrawText * DrawItem = (LibDrawText *) CurrentDrawItem; ...@@ -325,8 +325,8 @@ LibDrawText * DrawItem = (LibDrawText *) CurrentDrawItem;
/* Erase drawing (can be within a move command) */ /* Erase drawing (can be within a move command) */
if ( DrawPanel->ManageCurseur == NULL) if ( DrawPanel->ManageCurseur == NULL)
DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, 0 , 0, DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
DrawItem, CurrentUnit, g_XorMode); DrawItem, g_XorMode);
else DrawPanel->ManageCurseur(DrawPanel, DC, FALSE); else DrawPanel->ManageCurseur(DrawPanel, DC, FALSE);
if( DrawItem->m_Horiz == TEXT_ORIENT_HORIZ) if( DrawItem->m_Horiz == TEXT_ORIENT_HORIZ)
...@@ -337,8 +337,8 @@ LibDrawText * DrawItem = (LibDrawText *) CurrentDrawItem; ...@@ -337,8 +337,8 @@ LibDrawText * DrawItem = (LibDrawText *) CurrentDrawItem;
/* Redraw item with new orient */ /* Redraw item with new orient */
if ( DrawPanel->ManageCurseur == NULL) if ( DrawPanel->ManageCurseur == NULL)
DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, 0 , 0, DrawLibraryDrawStruct(DrawPanel, DC, CurrentLibEntry, wxPoint(0, 0),
DrawItem, CurrentUnit, GR_DEFAULT_DRAWMODE); DrawItem, GR_DEFAULT_DRAWMODE);
else DrawPanel->ManageCurseur(DrawPanel, DC, FALSE); else DrawPanel->ManageCurseur(DrawPanel, DC, FALSE);
} }
......
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