21 changed files with 1493 additions and 1217 deletions
-
2eeschema/CMakeLists.txt
-
12eeschema/block_libedit.cpp
-
135eeschema/class_library.h
-
426eeschema/class_pin.cpp
-
283eeschema/classes_body_items.cpp
-
419eeschema/classes_body_items.h
-
561eeschema/eelibs_draw_components.cpp
-
18eeschema/eelibs_read_libraryfiles.cpp
-
254eeschema/eestring.cpp
-
9eeschema/general.h
-
38eeschema/libclass.cpp
-
473eeschema/libcmp.h
-
2eeschema/libedit_onrightclick.cpp
-
4eeschema/locate.cpp
-
2eeschema/makefile.include
-
12eeschema/plot.cpp
-
10eeschema/protos.h
-
6eeschema/savelib.cpp
-
26eeschema/symbdraw.cpp
-
14eeschema/symbedit.cpp
-
4libs.win
@ -0,0 +1,135 @@ |
|||
/****************************************************************/ |
|||
/* 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 |
@ -0,0 +1,426 @@ |
|||
/*****************/ |
|||
/* class_pin.cpp */ |
|||
/*****************/ |
|||
|
|||
#include "fctsys.h"
|
|||
#include "gr_basic.h"
|
|||
|
|||
#include "common.h"
|
|||
#include "program.h"
|
|||
#include "libcmp.h"
|
|||
#include "general.h"
|
|||
#include "protos.h"
|
|||
|
|||
|
|||
/**********************************************************************************************/ |
|||
void LibDrawPin::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset, int aColor, |
|||
int aDrawMode, void* aData, int aTransformMatrix[2][2] ) |
|||
/**********************************************************************************************/ |
|||
{ |
|||
if( ( m_Attributs & PINNOTDRAW ) && !g_ShowAllPins ) |
|||
return; |
|||
|
|||
EDA_LibComponentStruct* Entry = ( (DrawPinPrms*) aData )->m_Entry; |
|||
bool DrawPinText = ( (DrawPinPrms*) aData )->m_DrawPinText; |
|||
|
|||
/* Calculate Pin orient takin in account the component orientation */ |
|||
int orient = ReturnPinDrawOrient( aTransformMatrix ); |
|||
|
|||
/* Calculate the pin position */ |
|||
wxPoint pos1 = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset; |
|||
|
|||
/* Dessin de la pin et du symbole special associe */ |
|||
DrawPinSymbol( aPanel, aDC, pos1, orient, aDrawMode, aColor ); |
|||
|
|||
if( DrawPinText ) |
|||
{ |
|||
DrawPinTexts( aPanel, aDC, pos1, orient, |
|||
Entry->m_TextInside, |
|||
Entry->m_DrawPinNum, Entry->m_DrawPinName, |
|||
aColor, aDrawMode ); |
|||
} |
|||
} |
|||
|
|||
|
|||
/********************************************************************************/ |
|||
void LibDrawPin::DrawPinSymbol( WinEDA_DrawPanel* aPanel, wxDC* aDC, |
|||
const wxPoint& aPinPos, int aOrient, int aDrawMode, int aColor ) |
|||
/*******************************************************************************/ |
|||
|
|||
/* Draw the pin symbol (without texts)
|
|||
* if Color != 0 draw with Color, else with the normal pin color |
|||
*/ |
|||
{ |
|||
int MapX1, MapY1, x1, y1; |
|||
int color; |
|||
int width = MAX( m_Width, g_DrawMinimunLineWidth ); |
|||
int posX = aPinPos.x, posY = aPinPos.y, len = m_PinLen; |
|||
|
|||
|
|||
color = ReturnLayerColor( LAYER_PIN ); |
|||
if( aColor < 0 ) // Used normal color or selected color
|
|||
{ |
|||
if( (m_Selected & IS_SELECTED) ) |
|||
color = g_ItemSelectetColor; |
|||
} |
|||
else |
|||
color = aColor; |
|||
|
|||
GRSetDrawMode( aDC, aDrawMode ); |
|||
|
|||
MapX1 = MapY1 = 0; x1 = posX; y1 = posY; |
|||
|
|||
switch( aOrient ) |
|||
{ |
|||
case PIN_UP: |
|||
y1 = posY - len; MapY1 = 1; |
|||
break; |
|||
|
|||
case PIN_DOWN: |
|||
y1 = posY + len; MapY1 = -1; |
|||
break; |
|||
|
|||
case PIN_LEFT: |
|||
x1 = posX - len, MapX1 = 1; |
|||
break; |
|||
|
|||
case PIN_RIGHT: |
|||
x1 = posX + len; MapX1 = -1; |
|||
break; |
|||
} |
|||
|
|||
if( m_PinShape & INVERT ) |
|||
{ |
|||
GRCircle( &aPanel->m_ClipBox, aDC, MapX1 * INVERT_PIN_RADIUS + x1, |
|||
MapY1 * INVERT_PIN_RADIUS + y1, |
|||
INVERT_PIN_RADIUS, width, color ); |
|||
|
|||
GRMoveTo( MapX1 * INVERT_PIN_RADIUS * 2 + x1, |
|||
MapY1 * INVERT_PIN_RADIUS * 2 + y1 ); |
|||
GRLineTo( &aPanel->m_ClipBox, aDC, posX, posY, width, color ); |
|||
} |
|||
else |
|||
{ |
|||
GRMoveTo( x1, y1 ); |
|||
GRLineTo( &aPanel->m_ClipBox, aDC, posX, posY, width, color ); |
|||
} |
|||
|
|||
if( m_PinShape & CLOCK ) |
|||
{ |
|||
if( MapY1 == 0 ) /* MapX1 = +- 1 */ |
|||
{ |
|||
GRMoveTo( x1, y1 + CLOCK_PIN_DIM ); |
|||
GRLineTo( &aPanel->m_ClipBox, aDC, x1 - MapX1 * CLOCK_PIN_DIM, y1, width, color ); |
|||
GRLineTo( &aPanel->m_ClipBox, aDC, x1, y1 - CLOCK_PIN_DIM, width, color ); |
|||
} |
|||
else /* MapX1 = 0 */ |
|||
{ |
|||
GRMoveTo( x1 + CLOCK_PIN_DIM, y1 ); |
|||
GRLineTo( &aPanel->m_ClipBox, aDC, x1, y1 - MapY1 * CLOCK_PIN_DIM, width, color ); |
|||
GRLineTo( &aPanel->m_ClipBox, aDC, x1 - CLOCK_PIN_DIM, y1, width, color ); |
|||
} |
|||
} |
|||
|
|||
if( m_PinShape & LOWLEVEL_IN ) /* IEEE symbol "Active Low Input" */ |
|||
{ |
|||
if( MapY1 == 0 ) /* MapX1 = +- 1 */ |
|||
{ |
|||
GRMoveTo( x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, y1 ); |
|||
GRLineTo( &aPanel->m_ClipBox, aDC, x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, |
|||
y1 - IEEE_SYMBOL_PIN_DIM, width, color ); |
|||
GRLineTo( &aPanel->m_ClipBox, aDC, x1, y1, width, color ); |
|||
} |
|||
else /* MapX1 = 0 */ |
|||
{ |
|||
GRMoveTo( x1, y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2 ); |
|||
GRLineTo( &aPanel->m_ClipBox, aDC, x1 - IEEE_SYMBOL_PIN_DIM, |
|||
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2, width, color ); |
|||
GRLineTo( &aPanel->m_ClipBox, aDC, x1, y1, width, color ); |
|||
} |
|||
} |
|||
|
|||
|
|||
if( m_PinShape & LOWLEVEL_OUT ) /* IEEE symbol "Active Low Output" */ |
|||
{ |
|||
if( MapY1 == 0 ) /* MapX1 = +- 1 */ |
|||
{ |
|||
GRMoveTo( x1, y1 - IEEE_SYMBOL_PIN_DIM ); |
|||
GRLineTo( &aPanel->m_ClipBox, |
|||
aDC, |
|||
x1 + MapX1 * IEEE_SYMBOL_PIN_DIM * 2, |
|||
y1, |
|||
width, |
|||
color ); |
|||
} |
|||
else /* MapX1 = 0 */ |
|||
{ |
|||
GRMoveTo( x1 - IEEE_SYMBOL_PIN_DIM, y1 ); |
|||
GRLineTo( &aPanel->m_ClipBox, |
|||
aDC, |
|||
x1, |
|||
y1 + MapY1 * IEEE_SYMBOL_PIN_DIM * 2, |
|||
width, |
|||
color ); |
|||
} |
|||
} |
|||
|
|||
/* Draw the pin end target (active end of the pin) */ |
|||
if( !g_IsPrinting ) // Draw but do not print the pin end target 1 pixel width */
|
|||
GRCircle( &aPanel->m_ClipBox, aDC, posX, posY, TARGET_PIN_DIAM, 0, color ); |
|||
} |
|||
|
|||
|
|||
/*****************************************************************************
|
|||
* Put out pin number and pin text info, given the pin line coordinates. |
|||
* The line must be vertical or horizontal. |
|||
* If PinText == NULL nothing is printed. If PinNum = 0 no number is printed. |
|||
* Current Zoom factor is taken into account. |
|||
* If TextInside then the text is been put inside,otherwise all is drawn outside. |
|||
* Pin Name: substring beteween '~' is negated |
|||
*****************************************************************************/ |
|||
void LibDrawPin::DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC, |
|||
wxPoint& pin_pos, int orient, |
|||
int TextInside, bool DrawPinNum, bool DrawPinName, |
|||
int Color, int DrawMode ) |
|||
/* DrawMode = GR_OR, XOR ... */ |
|||
{ |
|||
int ii, x, y, x1, y1, dx, dy, len; |
|||
wxString StringPinNum; |
|||
wxString PinText; |
|||
int PinTextBarPos[256]; |
|||
int PinTextBarCount; |
|||
int NameColor, NumColor; |
|||
int PinTxtLen; |
|||
|
|||
wxSize PinNameSize( m_PinNameSize, m_PinNameSize ); |
|||
wxSize PinNumSize( m_PinNumSize, m_PinNumSize ); |
|||
|
|||
int LineWidth = g_DrawMinimunLineWidth; |
|||
|
|||
GRSetDrawMode( DC, DrawMode ); |
|||
|
|||
/* Get the num and name colors */ |
|||
if( (Color < 0) && (m_Selected & IS_SELECTED) ) |
|||
Color = g_ItemSelectetColor; |
|||
NameColor = Color == -1 ? ReturnLayerColor( LAYER_PINNAM ) : Color; |
|||
NumColor = Color == -1 ? ReturnLayerColor( LAYER_PINNUM ) : Color; |
|||
|
|||
/* Create the pin num string */ |
|||
ReturnPinStringNum( StringPinNum ); |
|||
|
|||
x1 = pin_pos.x; y1 = pin_pos.y; |
|||
|
|||
switch( orient ) |
|||
{ |
|||
case PIN_UP: |
|||
y1 -= m_PinLen; break; |
|||
|
|||
case PIN_DOWN: |
|||
y1 += m_PinLen; break; |
|||
|
|||
case PIN_LEFT: |
|||
x1 -= m_PinLen; break; |
|||
|
|||
case PIN_RIGHT: |
|||
x1 += m_PinLen; break; |
|||
} |
|||
|
|||
const wxChar* textsrc = m_PinName.GetData(); |
|||
float fPinTextPitch = PinNameSize.x * 1.1; |
|||
/* Do we need to invert the string? Is this string has only "~"? */ |
|||
PinTextBarCount = 0; PinTxtLen = 0; |
|||
ii = 0; |
|||
while( *textsrc ) |
|||
{ |
|||
if( *textsrc == '~' ) |
|||
{ |
|||
PinTextBarPos[PinTextBarCount++] = (int) (PinTxtLen * fPinTextPitch); |
|||
} |
|||
else |
|||
{ |
|||
PinText.Append( *textsrc ); |
|||
PinTxtLen++; |
|||
} |
|||
|
|||
textsrc++; |
|||
} |
|||
|
|||
PinTxtLen = (int) (fPinTextPitch * PinTxtLen); |
|||
PinTextBarPos[PinTextBarCount] = PinTxtLen; // Needed if no end '~'
|
|||
|
|||
if( PinText[0] == 0 ) |
|||
DrawPinName = FALSE; |
|||
|
|||
if( TextInside ) /* Draw the text inside, but the pin numbers outside. */ |
|||
{ |
|||
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) |
|||
|
|||
// It is an horizontal line
|
|||
{ |
|||
if( PinText && DrawPinName ) |
|||
{ |
|||
if( orient == PIN_RIGHT ) |
|||
{ |
|||
x = x1 + TextInside; |
|||
DrawGraphicText( panel, DC, wxPoint( x, y1 ), NameColor, PinText, |
|||
TEXT_ORIENT_HORIZ, |
|||
PinNameSize, |
|||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, LineWidth ); |
|||
|
|||
for( ii = 0; ii < PinTextBarCount; ) |
|||
{ |
|||
GRMoveTo( x, y1 - TXTMARGE ); |
|||
dy = -PinNameSize.y / 2; |
|||
GRMoveRel( 0, dy ); |
|||
dx = PinTextBarPos[ii++]; // Get the line pos
|
|||
GRMoveRel( dx, 0 ); |
|||
len = PinTextBarPos[ii++] - dx; // Get the line length
|
|||
GRLineRel( &panel->m_ClipBox, DC, len, 0, LineWidth, NameColor ); |
|||
} |
|||
} |
|||
else // Orient == PIN_LEFT
|
|||
{ |
|||
x = x1 - TextInside; |
|||
DrawGraphicText( panel, DC, wxPoint( x, y1 ), NameColor, PinText, |
|||
TEXT_ORIENT_HORIZ, |
|||
PinNameSize, |
|||
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, LineWidth ); |
|||
|
|||
for( ii = 0; ii < PinTextBarCount; ) |
|||
{ |
|||
GRMoveTo( x, y1 - TXTMARGE ); |
|||
dy = -PinNameSize.y / 2; |
|||
GRMoveRel( 0, dy ); |
|||
dx = PinTextBarPos[ii++]; // Get the line pos
|
|||
GRMoveRel( dx - PinTxtLen, 0 ); |
|||
len = PinTextBarPos[ii++] - dx; // Get the line length
|
|||
GRLineRel( &panel->m_ClipBox, DC, len, 0, LineWidth, NameColor ); |
|||
} |
|||
} |
|||
} |
|||
|
|||
if( DrawPinNum ) |
|||
{ |
|||
DrawGraphicText( panel, DC, |
|||
wxPoint( (x1 + pin_pos.x) / 2, y1 - TXTMARGE ), NumColor, StringPinNum, |
|||
TEXT_ORIENT_HORIZ, PinNumSize, |
|||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth ); |
|||
} |
|||
} |
|||
else /* Its a vertical line. */ |
|||
{ |
|||
// Text is drawn from bottom to top (i.e. to negative value for Y axis)
|
|||
if( PinText && DrawPinName ) |
|||
{ |
|||
if( orient == PIN_DOWN ) |
|||
{ |
|||
y = y1 + TextInside; |
|||
|
|||
DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor, PinText, |
|||
TEXT_ORIENT_VERT, PinNameSize, |
|||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, LineWidth ); |
|||
|
|||
for( ii = 0; ii < PinTextBarCount; ) |
|||
{ |
|||
GRMoveTo( x1 - TXTMARGE, y ); |
|||
dy = -PinNameSize.y / 2; |
|||
GRMoveRel( dy, 0 ); |
|||
dx = PinTextBarPos[ii++]; // Get the line pos
|
|||
GRMoveRel( 0, PinTxtLen - dx ); |
|||
len = PinTextBarPos[ii++] - dx; // Get the line length
|
|||
GRLineRel( &panel->m_ClipBox, DC, 0, -len, LineWidth, NameColor ); |
|||
} |
|||
} |
|||
else /* PIN_UP */ |
|||
{ |
|||
y = y1 - TextInside; |
|||
|
|||
DrawGraphicText( panel, DC, wxPoint( x1, y ), NameColor, PinText, |
|||
TEXT_ORIENT_VERT, PinNameSize, |
|||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth ); |
|||
|
|||
for( ii = 0; ii < PinTextBarCount; ) |
|||
{ |
|||
GRMoveTo( x1 - TXTMARGE, y ); |
|||
dy = -PinNameSize.y / 2; |
|||
GRMoveRel( dy, 0 ); |
|||
dx = PinTextBarPos[ii++]; // Get the line pos
|
|||
GRMoveRel( 0, -dx ); |
|||
len = PinTextBarPos[ii++] - dx; // Get the line length
|
|||
GRLineRel( &panel->m_ClipBox, DC, 0, -len, LineWidth, NameColor ); |
|||
} |
|||
} |
|||
} |
|||
|
|||
if( DrawPinNum ) |
|||
{ |
|||
DrawGraphicText( panel, DC, |
|||
wxPoint( x1 - TXTMARGE, (y1 + pin_pos.y) / 2 ), NumColor, StringPinNum, |
|||
TEXT_ORIENT_VERT, PinNumSize, |
|||
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, LineWidth ); |
|||
} |
|||
} |
|||
} |
|||
else /**** Draw num & text pin outside ****/ |
|||
{ |
|||
if( (orient == PIN_LEFT) || (orient == PIN_RIGHT) ) |
|||
/* Its an horizontal line. */ |
|||
{ |
|||
if( PinText && DrawPinName ) |
|||
{ |
|||
x = (x1 + pin_pos.x) / 2; |
|||
DrawGraphicText( panel, DC, wxPoint( x, y1 - TXTMARGE ), |
|||
NameColor, PinText, |
|||
TEXT_ORIENT_HORIZ, PinNameSize, |
|||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_BOTTOM, LineWidth ); |
|||
|
|||
for( ii = 0; ii < PinTextBarCount; ) |
|||
{ |
|||
GRMoveTo( x, y1 - TXTMARGE * 2 ); |
|||
GRMoveRel( -PinTxtLen / 2, -PinNameSize.y ); |
|||
dx = PinTextBarPos[ii++]; // Get the line pos
|
|||
GRMoveRel( dx, 0 ); |
|||
len = PinTextBarPos[ii++] - dx; // Get the line length
|
|||
GRLineRel( &panel->m_ClipBox, DC, len, 0, LineWidth, NameColor ); |
|||
} |
|||
} |
|||
if( DrawPinNum ) |
|||
{ |
|||
x = (x1 + pin_pos.x) / 2; |
|||
DrawGraphicText( panel, DC, wxPoint( x, y1 + TXTMARGE ), |
|||
NumColor, StringPinNum, |
|||
TEXT_ORIENT_HORIZ, PinNumSize, |
|||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_TOP, LineWidth ); |
|||
} |
|||
} |
|||
else /* Its a vertical line. */ |
|||
{ |
|||
if( PinText && DrawPinName ) |
|||
{ |
|||
y = (y1 + pin_pos.y) / 2; |
|||
DrawGraphicText( panel, DC, wxPoint( x1 - TXTMARGE, y ), |
|||
NameColor, PinText, |
|||
TEXT_ORIENT_VERT, PinNameSize, |
|||
GR_TEXT_HJUSTIFY_RIGHT, GR_TEXT_VJUSTIFY_CENTER, LineWidth ); |
|||
|
|||
for( ii = 0; ii < PinTextBarCount; ) |
|||
{ |
|||
GRMoveTo( x1 - (TXTMARGE * 2), y ); |
|||
GRMoveRel( -PinNameSize.y, -PinTxtLen / 2 ); |
|||
dx = PinTextBarPos[ii++]; // Get the line pos
|
|||
GRMoveRel( 0, PinTxtLen - dx ); |
|||
len = PinTextBarPos[ii++] - dx; // Get the line length
|
|||
GRLineRel( &panel->m_ClipBox, DC, 0, -len, LineWidth, NameColor ); |
|||
} |
|||
} |
|||
|
|||
if( DrawPinNum ) |
|||
{ |
|||
DrawGraphicText( panel, DC, wxPoint( x1 + TXTMARGE, (y1 + pin_pos.y) / 2 ), |
|||
NumColor, StringPinNum, |
|||
TEXT_ORIENT_VERT, PinNumSize, |
|||
GR_TEXT_HJUSTIFY_LEFT, GR_TEXT_VJUSTIFY_CENTER, LineWidth ); |
|||
} |
|||
} |
|||
} |
|||
} |
@ -0,0 +1,283 @@ |
|||
/************************/ |
|||
/* class_body_items.cpp */ |
|||
/************************/ |
|||
|
|||
#include "fctsys.h"
|
|||
#include "gr_basic.h"
|
|||
|
|||
#include "common.h"
|
|||
#include "program.h"
|
|||
#include "libcmp.h"
|
|||
#include "general.h"
|
|||
#include "protos.h"
|
|||
|
|||
|
|||
//#define DRAW_ARC_WITH_ANGLE // Used to draw arcs
|
|||
|
|||
|
|||
/** Function Draw (virtual)
|
|||
* Draw A body item |
|||
* @param aPanel = DrawPanel to use (can be null) mainly used for clipping purposes |
|||
* @param aDC = Device Context (can be null) |
|||
* @param aOffset = offset to draw |
|||
* @param aDrawMode = GR_OR, GR_XOR, ... |
|||
* @param aDisplay_mode = FILL_T value ( has meaning only for items what can be filled ) |
|||
* @param aTransformMatrix = Transform Matrix |
|||
*/ |
|||
|
|||
/**********************************************************************************************/ |
|||
void LibDrawArc::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset, int aColor, |
|||
int aDrawMode, void* aData, int aTransformMatrix[2][2] ) |
|||
/**********************************************************************************************/ |
|||
{ |
|||
wxPoint pos1, pos2, posc; |
|||
|
|||
int color = ReturnLayerColor( LAYER_DEVICE ); |
|||
int LineWidth = MAX( m_Width, g_DrawMinimunLineWidth ); |
|||
|
|||
if( aColor < 0 ) // Used normal color or selected color
|
|||
{ |
|||
if( (m_Selected & IS_SELECTED) ) |
|||
color = g_ItemSelectetColor; |
|||
} |
|||
else |
|||
color = aColor; |
|||
|
|||
pos1 = TransformCoordinate( aTransformMatrix, m_ArcEnd ) + aOffset; |
|||
pos2 = TransformCoordinate( aTransformMatrix, m_ArcStart ) + aOffset; |
|||
posc = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset; |
|||
int pt1 = t1; |
|||
int pt2 = t2; |
|||
bool swap = MapAngles( &pt1, &pt2, aTransformMatrix ); |
|||
if( swap ) |
|||
{ |
|||
EXCHG( pos1.x, pos2.x ); EXCHG( pos1.y, pos2.y ) |
|||
} |
|||
|
|||
GRSetDrawMode( aDC, aDrawMode ); |
|||
|
|||
FILL_T fill = aData ? NO_FILL : m_Fill; |
|||
if( aColor >= 0 ) |
|||
fill = NO_FILL; |
|||
|
|||
if( fill == FILLED_WITH_BG_BODYCOLOR ) |
|||
GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2, |
|||
m_Rayon, LineWidth, color, |
|||
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); |
|||
else if( fill == FILLED_SHAPE && !aData ) |
|||
GRFilledArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2, |
|||
m_Rayon, color, color ); |
|||
else |
|||
#ifdef DRAW_ARC_WITH_ANGLE
|
|||
|
|||
GRArc( &aPanel->m_ClipBox, aDC, posc.x, posc.y, pt1, pt2, |
|||
m_Rayon, LineWidth, color ); |
|||
#else
|
|||
|
|||
GRArc1( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, |
|||
posc.x, posc.y, LineWidth, color ); |
|||
#endif
|
|||
} |
|||
|
|||
|
|||
/*************************************************************************************************/ |
|||
void LibDrawCircle::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset, int aColor, |
|||
int aDrawMode, void* aData, int aTransformMatrix[2][2] ) |
|||
/*************************************************************************************************/ |
|||
{ |
|||
wxPoint pos1; |
|||
|
|||
int color = ReturnLayerColor( LAYER_DEVICE ); |
|||
int LineWidth = MAX( m_Width, g_DrawMinimunLineWidth ); |
|||
|
|||
if( aColor < 0 ) // Used normal color or selected color
|
|||
{ |
|||
if( (m_Selected & IS_SELECTED) ) |
|||
color = g_ItemSelectetColor; |
|||
} |
|||
else |
|||
color = aColor; |
|||
|
|||
pos1 = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset; |
|||
GRSetDrawMode( aDC, aDrawMode ); |
|||
|
|||
FILL_T fill = aData ? NO_FILL : m_Fill; |
|||
if( aColor >= 0 ) |
|||
fill = NO_FILL; |
|||
|
|||
if( fill == FILLED_WITH_BG_BODYCOLOR ) |
|||
GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, |
|||
m_Rayon, LineWidth, color, |
|||
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); |
|||
else if( fill == FILLED_SHAPE ) |
|||
GRFilledCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, |
|||
m_Rayon, 0, color, color ); |
|||
else |
|||
GRCircle( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, |
|||
m_Rayon, LineWidth, color ); |
|||
} |
|||
|
|||
|
|||
/*************************************************************************************************/ |
|||
void LibDrawText::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset, int aColor, |
|||
int aDrawMode, void* aData, int aTransformMatrix[2][2] ) |
|||
/*************************************************************************************************/ |
|||
{ |
|||
wxPoint pos1, pos2; |
|||
|
|||
int color = ReturnLayerColor( LAYER_DEVICE ); |
|||
int LineWidth = MAX( m_Width, g_DrawMinimunLineWidth ); |
|||
|
|||
if( aColor < 0 ) // Used normal color or selected color
|
|||
{ |
|||
if( (m_Selected & IS_SELECTED) ) |
|||
color = g_ItemSelectetColor; |
|||
} |
|||
else |
|||
color = aColor; |
|||
|
|||
pos1 = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset; |
|||
|
|||
/* The text orientation may need to be flipped if the
|
|||
* transformation matrix causes xy axes to be flipped. */ |
|||
int t1 = (aTransformMatrix[0][0] != 0) ^ (m_Horiz != 0); |
|||
|
|||
DrawGraphicText( aPanel, aDC, pos1, color, m_Text, |
|||
t1 ? TEXT_ORIENT_HORIZ : TEXT_ORIENT_VERT, |
|||
m_Size, |
|||
GR_TEXT_HJUSTIFY_CENTER, GR_TEXT_VJUSTIFY_CENTER, LineWidth ); |
|||
} |
|||
|
|||
|
|||
/*************************************************************************************************/ |
|||
void LibDrawSquare::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset, int aColor, |
|||
int aDrawMode, void* aData, int aTransformMatrix[2][2] ) |
|||
/*************************************************************************************************/ |
|||
{ |
|||
wxPoint pos1, pos2; |
|||
|
|||
int color = ReturnLayerColor( LAYER_DEVICE ); |
|||
int LineWidth = MAX( m_Width, g_DrawMinimunLineWidth ); |
|||
|
|||
if( aColor < 0 ) // Used normal color or selected color
|
|||
{ |
|||
if( (m_Selected & IS_SELECTED) ) |
|||
color = g_ItemSelectetColor; |
|||
} |
|||
else |
|||
color = aColor; |
|||
|
|||
pos1 = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset; |
|||
pos2 = TransformCoordinate( aTransformMatrix, m_End ) + aOffset; |
|||
|
|||
FILL_T fill = aData ? NO_FILL : m_Fill; |
|||
if( aColor >= 0 ) |
|||
fill = NO_FILL; |
|||
|
|||
if( fill == FILLED_WITH_BG_BODYCOLOR && !aData ) |
|||
GRFilledRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, |
|||
color, LineWidth, |
|||
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); |
|||
else if( m_Fill == FILLED_SHAPE && !aData ) |
|||
GRFilledRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, |
|||
color, color ); |
|||
else |
|||
GRRect( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, |
|||
LineWidth, color ); |
|||
} |
|||
|
|||
|
|||
/*************************************************************************************************/ |
|||
void LibDrawSegment::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset, int aColor, |
|||
int aDrawMode, void* aData, int aTransformMatrix[2][2] ) |
|||
/*************************************************************************************************/ |
|||
{ |
|||
wxPoint pos1, pos2; |
|||
|
|||
int color = ReturnLayerColor( LAYER_DEVICE ); |
|||
int LineWidth = MAX( m_Width, g_DrawMinimunLineWidth ); |
|||
|
|||
if( aColor < 0 ) // Used normal color or selected color
|
|||
{ |
|||
if( (m_Selected & IS_SELECTED) ) |
|||
color = g_ItemSelectetColor; |
|||
} |
|||
else |
|||
color = aColor; |
|||
|
|||
pos1 = TransformCoordinate( aTransformMatrix, m_Pos ) + aOffset; |
|||
pos2 = TransformCoordinate( aTransformMatrix, m_End ) + aOffset; |
|||
|
|||
GRLine( &aPanel->m_ClipBox, aDC, pos1.x, pos1.y, pos2.x, pos2.y, LineWidth, color ); |
|||
} |
|||
|
|||
|
|||
/*************************************************************************************************/ |
|||
void LibDrawPolyline::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, |
|||
const wxPoint& aOffset, int aColor, |
|||
int aDrawMode, void* aData, |
|||
int aTransformMatrix[2][2] ) |
|||
/*************************************************************************************************/ |
|||
{ |
|||
wxPoint pos1; |
|||
|
|||
int color = ReturnLayerColor( LAYER_DEVICE ); |
|||
int LineWidth = MAX( m_Width, g_DrawMinimunLineWidth ); |
|||
static int* Buf_Poly_Drawings = NULL; // Buffer used to store current corners coordinates for drawings
|
|||
static int Buf_Poly_Size = 0; // Buffer used to store current corners coordinates for drawings
|
|||
|
|||
if( aColor < 0 ) // Used normal color or selected color
|
|||
{ |
|||
if( (m_Selected & IS_SELECTED) ) |
|||
color = g_ItemSelectetColor; |
|||
} |
|||
else |
|||
color = aColor; |
|||
|
|||
// Set the size of the buffer od coordinates
|
|||
if( Buf_Poly_Drawings == NULL ) |
|||
{ |
|||
Buf_Poly_Size = m_CornersCount; |
|||
Buf_Poly_Drawings = (int*) MyMalloc( sizeof(int) * 2 * Buf_Poly_Size ); |
|||
} |
|||
else if( Buf_Poly_Size < m_CornersCount ) |
|||
{ |
|||
Buf_Poly_Size = m_CornersCount; |
|||
Buf_Poly_Drawings = (int*) realloc( Buf_Poly_Drawings, |
|||
sizeof(int) * 2 * Buf_Poly_Size ); |
|||
} |
|||
|
|||
for( int ii = 0, jj = 0; ii < m_CornersCount; ii++, jj += 2 ) |
|||
{ |
|||
pos1.x = m_PolyList[jj]; |
|||
pos1.y = m_PolyList[jj + 1]; |
|||
|
|||
pos1 = TransformCoordinate( aTransformMatrix, pos1 ) + aOffset; |
|||
|
|||
Buf_Poly_Drawings[jj] = pos1.x; |
|||
Buf_Poly_Drawings[jj + 1] = pos1.y; |
|||
} |
|||
|
|||
FILL_T fill = aData ? NO_FILL : m_Fill; |
|||
if( aColor >= 0 ) |
|||
fill = NO_FILL; |
|||
|
|||
if( fill == FILLED_WITH_BG_BODYCOLOR ) |
|||
GRPoly( &aPanel->m_ClipBox, aDC, m_CornersCount, |
|||
Buf_Poly_Drawings, 1, LineWidth, color, |
|||
ReturnLayerColor( LAYER_DEVICE_BACKGROUND ) ); |
|||
else if( fill == FILLED_SHAPE ) |
|||
GRPoly( &aPanel->m_ClipBox, aDC, m_CornersCount, |
|||
Buf_Poly_Drawings, 1, LineWidth, color, color ); |
|||
else |
|||
GRPoly( &aPanel->m_ClipBox, aDC, m_CornersCount, |
|||
Buf_Poly_Drawings, 0, LineWidth, color, color ); |
|||
} |
|||
|
|||
|
|||
/*************************************************************************************************/ |
|||
void LibDrawField::Draw( WinEDA_DrawPanel* aPanel, wxDC* aDC, const wxPoint& aOffset, int aColor, |
|||
int aDrawMode, void* aData, int aTransformMatrix[2][2] ) |
|||
/*************************************************************************************************/ |
|||
{ |
|||
} |
@ -0,0 +1,419 @@ |
|||
/****************************************************************/ |
|||
/* Headers fo library definition and lib component definitions */ |
|||
/****************************************************************/ |
|||
|
|||
#ifndef CLASSES_BODY_ITEMS_H |
|||
#define CLASSES_BODY_ITEMS_H |
|||
|
|||
#define TARGET_PIN_DIAM 12 /* Circle diameter drawn at the active end of pins */ |
|||
|
|||
#define DEFAULT_TEXT_SIZE 50 /* Default size for field texts */ |
|||
#define PART_NAME_LEN 15 /* Maximum length of part name. */ |
|||
#define PREFIX_NAME_LEN 5 /* Maximum length of prefix (IC, R, SW etc.). */ |
|||
#define PIN_WIDTH 100 /* Width between 2 pins in internal units. */ |
|||
#define PIN_LENGTH 300 /* Default Length of each pin to be drawn. */ |
|||
|
|||
#define INVERT_PIN_RADIUS 35 /* Radius of inverted pin circle. */ |
|||
#define CLOCK_PIN_DIM 40 /* Dim of clock pin symbol. */ |
|||
#define IEEE_SYMBOL_PIN_DIM 40 /* Dim of special pin symbol. */ |
|||
|
|||
|
|||
/** |
|||
* Enum FILL_T |
|||
* is the set of fill types used in plotting or drawing enclosed areas. |
|||
*/ |
|||
enum FILL_T { |
|||
NO_FILL, // Poly, Square, Circle, Arc = option No Fill |
|||
FILLED_SHAPE, // Poly, Square, Circle, Arc = option Fill with current color ("Solid shape") |
|||
FILLED_WITH_BG_BODYCOLOR, /* Poly, Square, Circle, Arc = option Fill with background body color, |
|||
* translucent (texts inside this shape can be seen) |
|||
* not filled in B&W mode when plotting or printing |
|||
*/ |
|||
}; |
|||
|
|||
|
|||
/** |
|||
* Enum ElectricPinType |
|||
* is the set of schematic pin types, used in ERC tests. |
|||
*/ |
|||
enum ElectricPinType { /* Type des Pins. si modif: modifier tableau des mgs suivant */ |
|||
PIN_INPUT, |
|||
PIN_OUTPUT, |
|||
PIN_BIDI, |
|||
PIN_TRISTATE, |
|||
PIN_PASSIVE, |
|||
PIN_UNSPECIFIED, |
|||
PIN_POWER_IN, |
|||
PIN_POWER_OUT, |
|||
PIN_OPENCOLLECTOR, |
|||
PIN_OPENEMITTER, |
|||
PIN_NC, /* No connect */ |
|||
PIN_NMAX /* End of List (no used as pin type) */ |
|||
}; |
|||
|
|||
/* Messages d'affichage du type electrique */ |
|||
eda_global const wxChar* MsgPinElectricType[] |
|||
#ifdef MAIN |
|||
= { |
|||
wxT( "input" ), |
|||
wxT( "output" ), |
|||
wxT( "BiDi" ), |
|||
wxT( "3state" ), |
|||
wxT( "passive" ), |
|||
wxT( "unspc" ), |
|||
wxT( "power_in" ), |
|||
wxT( "power_out" ), |
|||
wxT( "openCol" ), |
|||
wxT( "openEm" ), |
|||
wxT( "?????" ) |
|||
} |
|||
|
|||
|
|||
#endif |
|||
; |
|||
|
|||
/* Autres bits: bits du membre .Flag des Pins */ |
|||
#define PINNOTDRAW 1 /* si 1: pin invisible */ |
|||
|
|||
|
|||
/** |
|||
* Enum DrawPinShape |
|||
* is the set of shapes allowed for pins. |
|||
*/ |
|||
enum DrawPinShape { |
|||
NONE = 0, |
|||
INVERT = 1, |
|||
CLOCK = 2, |
|||
LOWLEVEL_IN = 4, |
|||
LOWLEVEL_OUT = 8 |
|||
}; |
|||
|
|||
|
|||
/** |
|||
* Enum DrawPinOrient |
|||
* is the set of orientations allowed for pins. |
|||
*/ |
|||
enum DrawPinOrient { |
|||
PIN_RIGHT = 'R', |
|||
PIN_LEFT = 'L', |
|||
PIN_UP = 'U', |
|||
PIN_DOWN = 'D', |
|||
}; |
|||
|
|||
// Struct to pass parameters for drawing pins, in function Draw |
|||
class DrawPinPrms |
|||
{ |
|||
public: |
|||
EDA_LibComponentStruct* m_Entry; // Pointer to the component in lib |
|||
bool m_DrawPinText; // Are pin texts drawn ? |
|||
|
|||
DrawPinPrms(EDA_LibComponentStruct* entry, bool drawpintext = true) |
|||
{ |
|||
m_Entry = entry; |
|||
m_DrawPinText = drawpintext; |
|||
} |
|||
}; |
|||
|
|||
/****************************************************************************/ |
|||
/* Classes for handle the body items of a compoment: pins add graphic items */ |
|||
/****************************************************************************/ |
|||
|
|||
|
|||
/* class LibEDA_BaseStruct : Basic class for items used in a library component |
|||
* (graphic shapes, texts, fields, pins) |
|||
*/ |
|||
|
|||
class LibEDA_BaseStruct : public EDA_BaseStruct |
|||
{ |
|||
public: |
|||
int m_Unit; /* Unit identification (for multi part per parkage) |
|||
* 0 if the item is common to all units */ |
|||
int m_Convert; /* Shape identification (for parts which have a convert shape) |
|||
* 0 if the item is common to all shapes */ |
|||
wxPoint m_Pos; /* Position or centre (Arc and Circle) or start point (segments) */ |
|||
int m_Width; /* Tickness */ |
|||
|
|||
public: |
|||
LibEDA_BaseStruct* Next() |
|||
{ |
|||
return (LibEDA_BaseStruct*) Pnext; |
|||
} |
|||
|
|||
|
|||
LibEDA_BaseStruct( KICAD_T struct_type ); |
|||
virtual ~LibEDA_BaseStruct() { } |
|||
|
|||
/** Function Draw (virtual pure) |
|||
* Draw A body item |
|||
* @param aPanel = DrawPanel to use (can be null) mainly used for clipping purposes |
|||
* @param aDC = Device Context (can be null) |
|||
* @param aOffset = offset to draw |
|||
* @param aColor = -1 to use the normal body item color, or use this color if >= 0 |
|||
* @param aDrawMode = GR_OR, GR_XOR, ... |
|||
* @param aData = pointer used to pass others parametres, depending on body items. |
|||
* 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 |
|||
* or to pass refernce to the lib component for pins |
|||
* @param aTransformMatrix = Transform Matrix |
|||
*/ |
|||
virtual void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor, |
|||
int aDrawMode, void * aData, int aTransformMatrix[2][2] ) = 0; |
|||
|
|||
void Display_Infos_DrawEntry( WinEDA_DrawFrame* frame ); |
|||
}; |
|||
|
|||
|
|||
/********/ |
|||
/* Pins */ |
|||
/********/ |
|||
class LibDrawPin : public LibEDA_BaseStruct |
|||
{ |
|||
public: |
|||
int m_PinLen; /* Pin lenght */ |
|||
int m_Orient; /* Pin orientation (Up, Down, Left, Right) */ |
|||
int m_PinShape; /* Bitwise ORed: Pin shape (see enum DrawPinShape) */ |
|||
int m_PinType; /* Electrical pin properties */ |
|||
int m_Attributs; /* bit 0 != 0: pin invisible */ |
|||
long m_PinNum; /* Pin number: 4 Ascii code like "12" or "anod" or "G6" |
|||
* "12" is stored as "12\0\0" ans does not depend on endian type*/ |
|||
wxString m_PinName; |
|||
int m_PinNumSize, m_PinNameSize; /* Pin num and Pin name sizes */ |
|||
|
|||
// int m_PinNumWidth, m_PinNameWidth; /* (Currently Unused) Pin num and Pin name text width */ |
|||
|
|||
public: |
|||
LibDrawPin(); |
|||
~LibDrawPin() { } |
|||
virtual wxString GetClass() const |
|||
{ |
|||
return wxT( "LibDrawPin" ); |
|||
} |
|||
|
|||
|
|||
LibDrawPin* GenCopy(); |
|||
bool WriteDescr( FILE* File ); |
|||
void Display_Infos( WinEDA_DrawFrame* frame ); |
|||
wxPoint ReturnPinEndPoint(); |
|||
|
|||
int ReturnPinDrawOrient( int TransMat[2][2] ); |
|||
void ReturnPinStringNum( wxString& buffer ); |
|||
void SetPinNumFromString( wxString& buffer ); |
|||
|
|||
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor, |
|||
int aDrawMode, void * aData, int aTransformMatrix[2][2] ); |
|||
|
|||
void DrawPinSymbol( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& pin_pos, |
|||
int orient, |
|||
int DrawMode, int Color = -1 ); |
|||
|
|||
void DrawPinTexts( WinEDA_DrawPanel* panel, wxDC* DC, |
|||
wxPoint& pin_pos, int orient, |
|||
int TextInside, bool DrawPinNum, bool DrawPinName, |
|||
int Color, int DrawMode ); |
|||
void PlotPinTexts( wxPoint& pin_pos, int orient, |
|||
int TextInside, bool DrawPinNum, bool DrawPinName ); |
|||
}; |
|||
|
|||
|
|||
/**************************/ |
|||
/* Graphic Body Item: Arc */ |
|||
/**************************/ |
|||
|
|||
class LibDrawArc : public LibEDA_BaseStruct |
|||
{ |
|||
public: |
|||
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 */ |
|||
wxPoint m_ArcStart, m_ArcEnd; /* position des 2 extremites de l'arc en coord reelles*/ |
|||
|
|||
public: |
|||
LibDrawArc(); |
|||
~LibDrawArc() { } |
|||
virtual wxString GetClass() const |
|||
{ |
|||
return wxT( "LibDrawArc" ); |
|||
} |
|||
|
|||
|
|||
LibDrawArc* GenCopy(); |
|||
bool WriteDescr( FILE* File ); |
|||
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor, |
|||
int aDrawMode, void * aData, int aTransformMatrix[2][2] ); |
|||
}; |
|||
|
|||
/*****************************/ |
|||
/* Graphic Body Item: Circle */ |
|||
/*****************************/ |
|||
class LibDrawCircle : public LibEDA_BaseStruct |
|||
{ |
|||
public: |
|||
int m_Rayon; |
|||
FILL_T m_Fill; |
|||
|
|||
public: |
|||
LibDrawCircle(); |
|||
~LibDrawCircle() { } |
|||
virtual wxString GetClass() const |
|||
{ |
|||
return wxT( "LibDrawCircle" ); |
|||
} |
|||
|
|||
|
|||
LibDrawCircle* GenCopy(); |
|||
bool WriteDescr( FILE* File ); |
|||
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor, |
|||
int aDrawMode, void * aData, int aTransformMatrix[2][2] ); |
|||
}; |
|||
|
|||
|
|||
/*********************************************/ |
|||
/* Graphic Body Item: Text */ |
|||
/* This is only a graphic text. */ |
|||
/* Fields like Ref , value... are not Text, */ |
|||
/* they are a separate class */ |
|||
/*********************************************/ |
|||
class LibDrawText : public LibEDA_BaseStruct |
|||
{ |
|||
public: |
|||
int m_Horiz; |
|||
wxSize m_Size; |
|||
int m_Type; |
|||
wxString m_Text; |
|||
|
|||
public: |
|||
LibDrawText(); |
|||
~LibDrawText() { } |
|||
virtual wxString GetClass() const |
|||
{ |
|||
return wxT( "LibDrawText" ); |
|||
} |
|||
|
|||
|
|||
LibDrawText* GenCopy(); |
|||
bool WriteDescr( FILE* File ); |
|||
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor, |
|||
int aDrawMode, void * aData, int aTransformMatrix[2][2] ); |
|||
}; |
|||
|
|||
|
|||
/********************************/ |
|||
/* Graphic Body Item: Rectangle */ |
|||
/********************************/ |
|||
class LibDrawSquare : public LibEDA_BaseStruct |
|||
{ |
|||
public: |
|||
wxPoint m_End; |
|||
FILL_T m_Fill; |
|||
|
|||
public: |
|||
LibDrawSquare(); |
|||
~LibDrawSquare() { } |
|||
virtual wxString GetClass() const |
|||
{ |
|||
return wxT( "LibDrawSquare" ); |
|||
} |
|||
|
|||
|
|||
LibDrawSquare* GenCopy(); |
|||
bool WriteDescr( FILE* File ); |
|||
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor, |
|||
int aDrawMode, void * aData, int aTransformMatrix[2][2] ); |
|||
}; |
|||
|
|||
/**********************************/ |
|||
/* Graphic Body Item: single line */ |
|||
/**********************************/ |
|||
class LibDrawSegment : public LibEDA_BaseStruct |
|||
{ |
|||
public: |
|||
wxPoint m_End; |
|||
|
|||
public: |
|||
LibDrawSegment(); |
|||
~LibDrawSegment() { } |
|||
virtual wxString GetClass() const |
|||
{ |
|||
return wxT( "LibDrawSegment" ); |
|||
} |
|||
|
|||
|
|||
LibDrawSegment* GenCopy(); |
|||
bool WriteDescr( FILE* File ); |
|||
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor, |
|||
int aDrawMode, void * aData, int aTransformMatrix[2][2] ); |
|||
}; |
|||
|
|||
/*********************************************/ |
|||
/* Graphic Body Item: Polygon (set of lines) */ |
|||
/*********************************************/ |
|||
class LibDrawPolyline : public LibEDA_BaseStruct |
|||
{ |
|||
public: |
|||
int m_CornersCount; |
|||
int* m_PolyList; |
|||
FILL_T m_Fill; |
|||
|
|||
public: |
|||
LibDrawPolyline(); |
|||
~LibDrawPolyline() |
|||
{ |
|||
if( m_PolyList ) |
|||
free( m_PolyList ); |
|||
} |
|||
|
|||
|
|||
virtual wxString GetClass() const |
|||
{ |
|||
return wxT( "LibDrawPolyline" ); |
|||
} |
|||
|
|||
|
|||
LibDrawPolyline* GenCopy(); |
|||
void AddPoint( const wxPoint& point ); |
|||
bool WriteDescr( FILE* File ); |
|||
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor, |
|||
int aDrawMode, void * aData, int aTransformMatrix[2][2] ); |
|||
}; |
|||
|
|||
|
|||
/**********/ |
|||
/* Fields */ |
|||
/**********/ |
|||
|
|||
/* Fields , same as component fields. |
|||
* can be defined in libraries (mandatory for ref and value, ca be useful for footprints) |
|||
* 2 Fields are always defined : |
|||
* Prefix (U, IC..) with gives the reference in scxhematic) |
|||
* Name (74LS00..) used to find the component in libraries, and give the default value in schematic |
|||
*/ |
|||
class LibDrawField : public LibEDA_BaseStruct |
|||
{ |
|||
public: |
|||
int m_FieldId; // 0 a 11 |
|||
// 0 = Name; 1 = Valeur; 2 .. 11 other fields |
|||
wxPoint m_Pos; |
|||
wxSize m_Size; |
|||
int m_Orient; /* Orientation */ |
|||
int m_Attributs; /* Attributes (Non visible ...) */ |
|||
int m_HJustify, m_VJustify; /* Horiz an Vert Texte Justifications */ |
|||
wxString m_Text; /* Field Data */ |
|||
wxString m_Name; /* Field Name */ |
|||
|
|||
public: |
|||
LibDrawField( int idfield = 2 ); |
|||
~LibDrawField(); |
|||
virtual wxString GetClass() const |
|||
{ |
|||
return wxT( "LibDrawField" ); |
|||
} |
|||
|
|||
|
|||
LibDrawField* GenCopy(); |
|||
void Copy( LibDrawField* Target ); |
|||
bool WriteDescr( FILE* File ); |
|||
void Draw( WinEDA_DrawPanel * aPanel, wxDC * aDC, const wxPoint &aOffset, int aColor, |
|||
int aDrawMode, void * aData, int aTransformMatrix[2][2] ); |
|||
}; |
|||
|
|||
#endif // CLASSES_BODY_ITEMS_H |
Write
Preview
Loading…
Cancel
Save
Reference in new issue