Commit a13ddf38 authored by jean-pierre charras's avatar jean-pierre charras

Fixed some issues about trapezoidal pads. Better pad editor dialog. fixed...

Fixed some issues about trapezoidal pads. Better pad editor dialog. fixed other (very) minor bugs. Code cleaning.
Plaese note plot functions are not yet updated, so minor differences can be seen between pads on screen and plot files.
parents 0c3541b7 a989a214
...@@ -29,7 +29,6 @@ ...@@ -29,7 +29,6 @@
double s_HerscheyScaleFactor = HERSHEY_SCALE_FACTOR; double s_HerscheyScaleFactor = HERSHEY_SCALE_FACTOR;
/** Function GetPensizeForBold /** Function GetPensizeForBold
* @return the "best" value for a pen size to draw/plot a bold text * @return the "best" value for a pen size to draw/plot a bold text
* @param aTextSize = the char size (height or width) * @param aTextSize = the char size (height or width)
...@@ -62,12 +61,13 @@ int Clamp_Text_PenSize( int aPenSize, int aSize, bool aBold ) ...@@ -62,12 +61,13 @@ int Clamp_Text_PenSize( int aPenSize, int aSize, bool aBold )
return penSize; return penSize;
} }
int Clamp_Text_PenSize( int aPenSize, wxSize aSize, bool aBold ) int Clamp_Text_PenSize( int aPenSize, wxSize aSize, bool aBold )
{ {
int size = MIN( ABS( aSize.x ), ABS( aSize.y ) ); int size = MIN( ABS( aSize.x ), ABS( aSize.y ) );
return Clamp_Text_PenSize(aPenSize, size, aBold);;
}
return Clamp_Text_PenSize( aPenSize, size, aBold );;
}
/* Functions to draw / plot a string. /* Functions to draw / plot a string.
...@@ -97,7 +97,6 @@ int NegableTextLength( const wxString& aText ) ...@@ -97,7 +97,6 @@ int NegableTextLength( const wxString& aText )
} }
/* Function GetHersheyShapeDescription() /* Function GetHersheyShapeDescription()
* return a pointer to the shape corresponding to unicode value AsciiCode * return a pointer to the shape corresponding to unicode value AsciiCode
* Note we use the same font for Bold and Normal texts * Note we use the same font for Bold and Normal texts
...@@ -108,7 +107,8 @@ static const char* GetHersheyShapeDescription( int AsciiCode ) ...@@ -108,7 +107,8 @@ static const char* GetHersheyShapeDescription( int AsciiCode )
{ {
/* calculate font length */ /* calculate font length */
int font_length_max = newstroke_font_bufsize; int font_length_max = newstroke_font_bufsize;
if ( AsciiCode >= (32 + font_length_max) )
if( AsciiCode >= (32 + font_length_max) )
AsciiCode = '?'; AsciiCode = '?';
if( AsciiCode < 32 ) if( AsciiCode < 32 )
AsciiCode = 32; /* Clamp control chars */ AsciiCode = 32; /* Clamp control chars */
...@@ -150,7 +150,7 @@ int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool aItalic, boo ...@@ -150,7 +150,7 @@ int ReturnGraphicTextWidth( const wxString& aText, int aXSize, bool aItalic, boo
/* Helper function for drawing character polygons */ /* Helper function for drawing character polygons */
static void DrawGraphicTextPline( static void DrawGraphicTextPline(
WinEDA_DrawPanel* aPanel, EDA_Rect* aClipBox,
wxDC* aDC, wxDC* aDC,
EDA_Colors aColor, EDA_Colors aColor,
int aWidth, int aWidth,
...@@ -158,18 +158,19 @@ static void DrawGraphicTextPline( ...@@ -158,18 +158,19 @@ static void DrawGraphicTextPline(
int point_count, int point_count,
wxPoint* coord, wxPoint* coord,
void (* aCallback)(int x0, int y0, int xf, int yf ), void (* aCallback)(int x0, int y0, int xf, int yf ),
PLOTTER *plotter ) PLOTTER* plotter )
{ {
if( plotter ) if( plotter )
{ {
plotter->move_to(coord[0]); plotter->move_to( coord[0] );
for( int ik = 1; ik < point_count; ik++ ) for( int ik = 1; ik < point_count; ik++ )
{ {
plotter->line_to( coord[ik] ); plotter->line_to( coord[ik] );
} }
plotter->pen_finish(); plotter->pen_finish();
} }
else if (aCallback) else if( aCallback )
{ {
for( int ik = 0; ik < (point_count - 1); ik++ ) for( int ik = 0; ik < (point_count - 1); ik++ )
{ {
...@@ -180,11 +181,11 @@ static void DrawGraphicTextPline( ...@@ -180,11 +181,11 @@ static void DrawGraphicTextPline(
else if( sketch_mode ) else if( sketch_mode )
{ {
for( int ik = 0; ik < (point_count - 1); ik++ ) for( int ik = 0; ik < (point_count - 1); ik++ )
GRCSegm( &aPanel->m_ClipBox, aDC, coord[ik].x, coord[ik].y, GRCSegm( aClipBox, aDC, coord[ik].x, coord[ik].y,
coord[ik + 1].x, coord[ik + 1].y, aWidth, aColor ); coord[ik + 1].x, coord[ik + 1].y, aWidth, aColor );
} }
else else
GRPoly( &aPanel->m_ClipBox, aDC, point_count, coord, 0, GRPoly( aClipBox, aDC, point_count, coord, 0,
aWidth, aColor, aColor ); aWidth, aColor, aColor );
} }
...@@ -228,7 +229,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -228,7 +229,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
bool aItalic, bool aItalic,
bool aBold, bool aBold,
void (* aCallback)( int x0, int y0, int xf, int yf ), void (* aCallback)( int x0, int y0, int xf, int yf ),
PLOTTER *plotter ) PLOTTER* plotter )
/****************************************************************************************************/ /****************************************************************************************************/
{ {
int AsciiCode; int AsciiCode;
...@@ -240,8 +241,9 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -240,8 +241,9 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
wxPoint overbar_pos; // Start point for the current overbar wxPoint overbar_pos; // Start point for the current overbar
int overbars; // Number of ~ seen int overbars; // Number of ~ seen
int overbar_italic_comp; // Italic compensation for overbar int overbar_italic_comp; // Italic compensation for overbar
EDA_Rect* clipBox; // Clip box used in basic draw functions
clipBox = aPanel ? &aPanel->m_ClipBox : NULL;
#define BUF_SIZE 100 #define BUF_SIZE 100
wxPoint coord[BUF_SIZE + 1]; // Buffer coordinate used to draw polylines (one char shape) wxPoint coord[BUF_SIZE + 1]; // Buffer coordinate used to draw polylines (one char shape)
bool sketch_mode = false; bool sketch_mode = false;
...@@ -347,11 +349,12 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -347,11 +349,12 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
RotatePoint( &current_char_pos, aPos, aOrient ); RotatePoint( &current_char_pos, aPos, aOrient );
RotatePoint( &end, aPos, aOrient ); RotatePoint( &end, aPos, aOrient );
if( plotter ) { if( plotter )
plotter->move_to(current_char_pos); {
plotter->move_to( current_char_pos );
plotter->finish_to( end ); plotter->finish_to( end );
} }
else if (aCallback) else if( aCallback )
{ {
aCallback( current_char_pos.x, current_char_pos.y, end.x, end.y ); aCallback( current_char_pos.x, current_char_pos.y, end.x, end.y );
} }
...@@ -402,7 +405,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -402,7 +405,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
RotatePoint( &overbar_pos, aPos, aOrient ); RotatePoint( &overbar_pos, aPos, aOrient );
coord[1] = overbar_pos; coord[1] = overbar_pos;
/* Plot the overbar segment */ /* Plot the overbar segment */
DrawGraphicTextPline( aPanel, aDC, aColor, aWidth, DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
sketch_mode, 2, coord, aCallback, plotter ); sketch_mode, 2, coord, aCallback, plotter );
} }
continue; /* Skip ~ processing */ continue; /* Skip ~ processing */
...@@ -426,12 +429,13 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -426,12 +429,13 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
} }
else else
{ {
/* End of character, insert a synthetic pen up */ // End of character, insert a synthetic pen up:
hc1 = ' '; hc1 = ' ';
hc2 = 'R'; hc2 = 'R';
endcar = true; endcar = true;
} }
hc1 -= 'R'; hc2 -= 'R'; /* Do the Hershey decode thing: coordinates values are coded as <value> + 'R' */ // Do the Hershey decode thing: coordinates values are coded as <value> + 'R'
hc1 -= 'R'; hc2 -= 'R';
/* Pen up request */ /* Pen up request */
if( hc1 == -50 && hc2 == 0 ) if( hc1 == -50 && hc2 == 0 )
...@@ -440,7 +444,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -440,7 +444,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
{ {
if( aWidth <= 1 ) if( aWidth <= 1 )
aWidth = 0; aWidth = 0;
DrawGraphicTextPline( aPanel, aDC, aColor, aWidth, DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
sketch_mode, point_count, coord, sketch_mode, point_count, coord,
aCallback, plotter ); aCallback, plotter );
} }
...@@ -483,7 +487,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel, ...@@ -483,7 +487,7 @@ void DrawGraphicText( WinEDA_DrawPanel* aPanel,
RotatePoint( &overbar_pos, aPos, aOrient ); RotatePoint( &overbar_pos, aPos, aOrient );
coord[1] = overbar_pos; coord[1] = overbar_pos;
/* Plot the overbar segment */ /* Plot the overbar segment */
DrawGraphicTextPline( aPanel, aDC, aColor, aWidth, DrawGraphicTextPline( clipBox, aDC, aColor, aWidth,
sketch_mode, 2, coord, aCallback, plotter ); sketch_mode, 2, coord, aCallback, plotter );
} }
} }
...@@ -521,10 +525,10 @@ void PLOTTER::text( const wxPoint& aPos, ...@@ -521,10 +525,10 @@ void PLOTTER::text( const wxPoint& aPos,
if( aWidth == 0 && aBold ) // Use default values if aWidth == 0 if( aWidth == 0 && aBold ) // Use default values if aWidth == 0
aWidth = GetPenSizeForBold( MIN( aSize.x, aSize.y ) ); aWidth = GetPenSizeForBold( MIN( aSize.x, aSize.y ) );
if ( aWidth >= 0 ) if( aWidth >= 0 )
aWidth = Clamp_Text_PenSize( aWidth, aSize, aBold ); aWidth = Clamp_Text_PenSize( aWidth, aSize, aBold );
else else
aWidth = - Clamp_Text_PenSize( -aWidth, aSize, aBold ); aWidth = -Clamp_Text_PenSize( -aWidth, aSize, aBold );
set_current_line_width( aWidth ); set_current_line_width( aWidth );
......
...@@ -1138,6 +1138,9 @@ void GRSCSegm( EDA_Rect* ClipBox, ...@@ -1138,6 +1138,9 @@ void GRSCSegm( EDA_Rect* ClipBox,
static bool IsGRSPolyDrawable( EDA_Rect* ClipBox, int n, wxPoint Points[] ) static bool IsGRSPolyDrawable( EDA_Rect* ClipBox, int n, wxPoint Points[] )
{ {
if( ! ClipBox )
return true;
int Xmin, Xmax, Ymin, Ymax; int Xmin, Xmax, Ymin, Ymax;
Xmin = Xmax = Points[0].x; Xmin = Xmax = Points[0].x;
......
...@@ -13,11 +13,6 @@ ...@@ -13,11 +13,6 @@
#include "cvpcb.h" #include "cvpcb.h"
#include "protos.h" #include "protos.h"
#define MAX_LEN_NETNAME 16
static void ChangePinNet( COMPONENT_LIST& list, wxString& PinNet,
int* netNumber, bool rightJustify );
static void WriteFootprintFilterInfos( FILE* dest, COMPONENT_LIST& list ); static void WriteFootprintFilterInfos( FILE* dest, COMPONENT_LIST& list );
...@@ -74,7 +69,6 @@ int GenNetlistPcbnew( FILE* file, COMPONENT_LIST& list, bool isEESchemaNetlist, ...@@ -74,7 +69,6 @@ int GenNetlistPcbnew( FILE* file, COMPONENT_LIST& list, bool isEESchemaNetlist,
{ {
#define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1" #define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1"
char Line[1024]; char Line[1024];
int netNumber = 1;
DateAndTime( Line ); DateAndTime( Line );
...@@ -103,9 +97,6 @@ int GenNetlistPcbnew( FILE* file, COMPONENT_LIST& list, bool isEESchemaNetlist, ...@@ -103,9 +97,6 @@ int GenNetlistPcbnew( FILE* file, COMPONENT_LIST& list, bool isEESchemaNetlist,
BOOST_FOREACH( PIN& pin, component.m_Pins ) BOOST_FOREACH( PIN& pin, component.m_Pins )
{ {
if( pin.m_Net.Len() > MAX_LEN_NETNAME )
ChangePinNet( list, pin.m_Net, &netNumber, rightJustify );
if( !pin.m_Net.IsEmpty() ) if( !pin.m_Net.IsEmpty() )
fprintf( file, " ( %s %s )\n", fprintf( file, " ( %s %s )\n",
CONV_TO_UTF8( pin.m_Number ), CONV_TO_UTF8( pin.m_Number ),
...@@ -161,42 +152,3 @@ void WriteFootprintFilterInfos( FILE* file, COMPONENT_LIST& list ) ...@@ -161,42 +152,3 @@ void WriteFootprintFilterInfos( FILE* file, COMPONENT_LIST& list )
fprintf( file, "$endfootprintlist\n}\n" ); fprintf( file, "$endfootprintlist\n}\n" );
} }
/* ???
* Change le NetName PinNet par un nom compose des 8 derniers codes de PinNet
* suivi de _Xnnnnn ou nnnnn est un nom de 0 a 99999
*/
static void ChangePinNet( COMPONENT_LIST& list, wxString& PinNet,
int* netNumber, bool rightJustify )
{
wxASSERT( netNumber != NULL );
wxString OldName;
wxString NewName;
OldName = PinNet;
if( rightJustify ) /* Retain the last 8 letters of the name. */
{
NewName = OldName.Right( 8 );
NewName << *netNumber;
}
else /* Retain the first 8 letters of the name. */
{
NewName = OldName.Left( 8 );
NewName << *netNumber;
}
*netNumber = *netNumber + 1;
BOOST_FOREACH( COMPONENT& component, list )
{
BOOST_FOREACH( PIN& pin, component.m_Pins )
{
if( pin.m_Net != OldName )
continue;
pin.m_Net = NewName;
}
}
}
...@@ -41,11 +41,6 @@ private: ...@@ -41,11 +41,6 @@ private:
* orientation. * orientation.
*/ */
public:
//int m_Shape;
//bool m_IsDangling; // TRUE non connected
public: public:
SCH_SHEET_PIN( SCH_SHEET* parent, SCH_SHEET_PIN( SCH_SHEET* parent,
const wxPoint& pos = wxPoint( 0, 0 ), const wxPoint& pos = wxPoint( 0, 0 ),
...@@ -63,6 +58,19 @@ public: ...@@ -63,6 +58,19 @@ public:
SCH_SHEET_PIN* GenCopy(); SCH_SHEET_PIN* GenCopy();
virtual void Draw( WinEDA_DrawPanel* aPanel,
wxDC* aDC,
const wxPoint& aOffset,
int aDraw_mode,
int aColor = -1 );
/** function CreateGraphicShape (virual)
* Calculates the graphic shape (a polygon) associated to the text
* @param aCorner_list = a buffer to fill with polygon corners coordinates
* @param Pos = Position of the shape
*/
virtual void CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
const wxPoint& Pos );
SCH_SHEET_PIN* Next() SCH_SHEET_PIN* Next()
{ {
return (SCH_SHEET_PIN*) Pnext; return (SCH_SHEET_PIN*) Pnext;
......
...@@ -60,6 +60,22 @@ SCH_SHEET_PIN* SCH_SHEET_PIN::GenCopy() ...@@ -60,6 +60,22 @@ SCH_SHEET_PIN* SCH_SHEET_PIN::GenCopy()
return newitem; return newitem;
} }
/** SCH_SHEET_PIN::Draw is the same as SCH_HIERLABEL::Draw
* but the graphic icon is slightly different
* for INPUT type the icon is the OUTPUT shape of SCH_HIERLABEL
* for OUTPUT type the icon is the INPUT shape of SCH_HIERLABEL
*/
void SCH_SHEET_PIN::Draw( WinEDA_DrawPanel* aPanel,
wxDC* aDC,
const wxPoint& aOffset,
int aDraw_mode,
int aColor )
{
// The icon selection is handle by the virtual method CreateGraphicShape
// called by ::Draw
SCH_HIERLABEL::Draw(aPanel, aDC, aOffset, aDraw_mode, aColor );
}
void SCH_SHEET_PIN::SwapData( SCH_SHEET_PIN* copyitem ) void SCH_SHEET_PIN::SwapData( SCH_SHEET_PIN* copyitem )
{ {
......
...@@ -1010,11 +1010,12 @@ bool SCH_HIERLABEL::HitTest( const wxPoint& aPosRef ) ...@@ -1010,11 +1010,12 @@ bool SCH_HIERLABEL::HitTest( const wxPoint& aPosRef )
} }
/*********************************************************************************************/ /** Function SCH_LABEL::Draw
* a label is drawn like a text. So just call SCH_TEXT::Draw
*/
void SCH_LABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset, void SCH_LABEL::Draw( WinEDA_DrawPanel* panel, wxDC* DC, const wxPoint& offset,
int DrawMode, int Color ) int DrawMode, int Color )
{ {
/*********************************************************************************************/
SCH_TEXT::Draw( panel, DC, offset, DrawMode, Color ); SCH_TEXT::Draw( panel, DC, offset, DrawMode, Color );
} }
...@@ -1028,8 +1029,8 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel, ...@@ -1028,8 +1029,8 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel,
{ {
/*****************************************************************************/ /*****************************************************************************/
/* Texts type Global Label have 4 directions, and the Text origin is the /* Hierarchical Label have a text and a graphic icon.
* graphic icon * Texts type have 4 directions, and the text origin is the graphic icon
*/ */
static std::vector <wxPoint> Poly; static std::vector <wxPoint> Poly;
EDA_Colors color; EDA_Colors color;
...@@ -1100,6 +1101,36 @@ void SCH_HIERLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list, ...@@ -1100,6 +1101,36 @@ void SCH_HIERLABEL::CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
} }
} }
/** Virtual Function SCH_SHEET_PIN::CreateGraphicShape
* calculates the graphic shape (a polygon) associated to the text
* @param aCorner_list = a buffer to fill with polygon corners coordinates
* @param aPos = Position of the shape
*/
void SCH_SHEET_PIN::CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
const wxPoint& aPos )
{
/* This is the same icon shapes as SCH_HIERLABEL
* but the graphic icon is slightly different in 2 cases:
* for INPUT type the icon is the OUTPUT shape of SCH_HIERLABEL
* for OUTPUT type the icon is the INPUT shape of SCH_HIERLABEL
*/
int tmp = m_Shape;
switch( m_Shape )
{
case NET_INPUT:
m_Shape = NET_OUTPUT;
break;
case NET_OUTPUT:
m_Shape = NET_INPUT;
break;
default:
break;
}
SCH_HIERLABEL::CreateGraphicShape( aCorner_list, aPos );
m_Shape = tmp;
}
/****************************************/ /****************************************/
EDA_Rect SCH_HIERLABEL::GetBoundingBox() EDA_Rect SCH_HIERLABEL::GetBoundingBox()
......
...@@ -93,6 +93,18 @@ public: ...@@ -93,6 +93,18 @@ public:
int draw_mode, int draw_mode,
int Color = -1 ); int Color = -1 );
/** function CreateGraphicShape
* Calculates the graphic shape (a polygon) associated to the text
* @param aCorner_list = a buffer to fill with polygon corners coordinates
* @param Pos = Postion of the shape
* for texts and labels: do nothing
* Mainly for derived classes (SCH_SHEET_PIN and Hierarchical labels)
*/
virtual void CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
const wxPoint& Pos )
{
aCorner_list.clear();
}
void SwapData( SCH_TEXT* copyitem ); void SwapData( SCH_TEXT* copyitem );
void Place( WinEDA_SchematicFrame* frame, wxDC* DC ); void Place( WinEDA_SchematicFrame* frame, wxDC* DC );
...@@ -291,13 +303,13 @@ public: ...@@ -291,13 +303,13 @@ public:
*/ */
EDA_Rect GetBoundingBox(); EDA_Rect GetBoundingBox();
/** function CreateGraphicShape /** function CreateGraphicShape (virual)
* Calculates the graphic shape (a polygon) associated to the text * Calculates the graphic shape (a polygon) associated to the text
* @param aCorner_list = a buffer to fill with polygon corners coordinates * @param aCorner_list = a buffer to fill with polygon corners coordinates
* @param Pos = Position of the shape * @param aPos = Position of the shape
*/ */
void CreateGraphicShape( std::vector <wxPoint>& aCorner_list, virtual void CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
const wxPoint& Pos ); const wxPoint& aPos );
/** virtual function Mirror_Y /** virtual function Mirror_Y
* mirror item relative to an Y axis * mirror item relative to an Y axis
...@@ -355,7 +367,7 @@ public: ...@@ -355,7 +367,7 @@ public:
* @param aCorner_list = a buffer to fill with polygon corners coordinates * @param aCorner_list = a buffer to fill with polygon corners coordinates
* @param Pos = Postion of the shape * @param Pos = Postion of the shape
*/ */
void CreateGraphicShape( std::vector <wxPoint>& aCorner_list, virtual void CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
const wxPoint& Pos ); const wxPoint& Pos );
/** /**
......
This diff is collapsed.
...@@ -107,7 +107,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -107,7 +107,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_PanelBasic->SetSizer( bSizerBasicPanel ); m_PanelBasic->SetSizer( bSizerBasicPanel );
m_PanelBasic->Layout(); m_PanelBasic->Layout();
bSizerBasicPanel->Fit( m_PanelBasic ); bSizerBasicPanel->Fit( m_PanelBasic );
m_NoteBook->AddPage( m_PanelBasic, _("Options"), false ); m_NoteBook->AddPage( m_PanelBasic, _("Options"), true );
m_PanelDoc = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); m_PanelDoc = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
wxBoxSizer* m_PanelDocBoxSizer; wxBoxSizer* m_PanelDocBoxSizer;
m_PanelDocBoxSizer = new wxBoxSizer( wxVERTICAL ); m_PanelDocBoxSizer = new wxBoxSizer( wxVERTICAL );
...@@ -123,7 +123,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -123,7 +123,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_staticTextKeywords = new wxStaticText( m_PanelDoc, wxID_ANY, _("Keywords:"), wxDefaultPosition, wxDefaultSize, 0 ); m_staticTextKeywords = new wxStaticText( m_PanelDoc, wxID_ANY, _("Keywords:"), wxDefaultPosition, wxDefaultSize, 0 );
m_staticTextKeywords->Wrap( -1 ); m_staticTextKeywords->Wrap( -1 );
m_staticTextKeywords->SetToolTip( _("Enter keys words that can be used to select this composant.\nKey words cannot have spaces and are separated by a space.") ); m_staticTextKeywords->SetToolTip( _("Enter key words that can be used to select this composant.\nKey words cannot have spaces and are separated by a space.") );
m_PanelDocBoxSizer->Add( m_staticTextKeywords, 0, wxTOP|wxRIGHT|wxLEFT, 5 ); m_PanelDocBoxSizer->Add( m_staticTextKeywords, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
...@@ -153,7 +153,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx ...@@ -153,7 +153,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_PanelDoc->SetSizer( m_PanelDocBoxSizer ); m_PanelDoc->SetSizer( m_PanelDocBoxSizer );
m_PanelDoc->Layout(); m_PanelDoc->Layout();
m_PanelDocBoxSizer->Fit( m_PanelDoc ); m_PanelDocBoxSizer->Fit( m_PanelDoc );
m_NoteBook->AddPage( m_PanelDoc, _("Description"), true ); m_NoteBook->AddPage( m_PanelDoc, _("Description"), false );
m_PanelAlias = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL ); m_PanelAlias = new wxPanel( m_NoteBook, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxSUNKEN_BORDER|wxTAB_TRAVERSAL );
wxBoxSizer* bSizerMainPanelAlias; wxBoxSizer* bSizerMainPanelAlias;
bSizerMainPanelAlias = new wxBoxSizer( wxHORIZONTAL ); bSizerMainPanelAlias = new wxBoxSizer( wxHORIZONTAL );
......
...@@ -128,7 +128,7 @@ ...@@ -128,7 +128,7 @@
<object class="notebookpage" expanded="1"> <object class="notebookpage" expanded="1">
<property name="bitmap"></property> <property name="bitmap"></property>
<property name="label">Options</property> <property name="label">Options</property>
<property name="select">0</property> <property name="select">1</property>
<object class="wxPanel" expanded="1"> <object class="wxPanel" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="context_help"></property> <property name="context_help"></property>
...@@ -851,7 +851,7 @@ ...@@ -851,7 +851,7 @@
<object class="notebookpage" expanded="1"> <object class="notebookpage" expanded="1">
<property name="bitmap"></property> <property name="bitmap"></property>
<property name="label">Description</property> <property name="label">Description</property>
<property name="select">1</property> <property name="select">0</property>
<object class="wxPanel" expanded="1"> <object class="wxPanel" expanded="1">
<property name="bg"></property> <property name="bg"></property>
<property name="context_help"></property> <property name="context_help"></property>
...@@ -1026,7 +1026,7 @@ ...@@ -1026,7 +1026,7 @@
<property name="size"></property> <property name="size"></property>
<property name="style"></property> <property name="style"></property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip">Enter keys words that can be used to select this composant.&#x0A;Key words cannot have spaces and are separated by a space.</property> <property name="tooltip">Enter key words that can be used to select this composant.&#x0A;Key words cannot have spaces and are separated by a space.</property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
......
...@@ -288,19 +288,9 @@ static void PlotTextStruct( PLOTTER* plotter, SCH_TEXT* aSchText ) ...@@ -288,19 +288,9 @@ static void PlotTextStruct( PLOTTER* plotter, SCH_TEXT* aSchText )
aSchText->m_Bold ); aSchText->m_Bold );
/* Draw graphic symbol for global or hierarchical labels */ /* Draw graphic symbol for global or hierarchical labels */
if( aSchText->Type() == TYPE_SCH_GLOBALLABEL ) aSchText->CreateGraphicShape( Poly, aSchText->m_Pos );
{ if( Poly.size() )
( (SCH_GLOBALLABEL*) aSchText )->CreateGraphicShape( Poly,
aSchText->m_Pos );
plotter->poly( Poly.size(), &Poly[0].x, NO_FILL ); plotter->poly( Poly.size(), &Poly[0].x, NO_FILL );
}
if( ( aSchText->Type() == TYPE_SCH_HIERLABEL )
|| ( aSchText->Type() == DRAW_HIERARCHICAL_PIN_SHEET_STRUCT_TYPE) )
{
( (SCH_HIERLABEL*) aSchText )->CreateGraphicShape( Poly,
aSchText->m_Pos );
plotter->poly( Poly.size(), &Poly[0].x, NO_FILL );
}
} }
......
...@@ -392,7 +392,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event ) ...@@ -392,7 +392,7 @@ void WinEDA_SchematicFrame::Process_Special_Functions( wxCommandEvent& event )
return; return;
} }
if( !IsOK( this, _( "Do you wish to cleanup this sheet" ) ) ) if( !IsOK( this, _( "Do you wish to cleanup this sheet?" ) ) )
return; return;
/* Save sheet in undo list before cleaning up unreferenced hierarchical labels. */ /* Save sheet in undo list before cleaning up unreferenced hierarchical labels. */
......
...@@ -71,11 +71,10 @@ int ChangeSideNumLayer( int oldlayer ) ...@@ -71,11 +71,10 @@ int ChangeSideNumLayer( int oldlayer )
} }
/* Change the mask layer during routing cu / cmp layers for /* Calculate the mask layer when flipping a footprint
* Cu / CMP.. * BACK and FRONT copper layers , mask, paste, solder layers are swapped
* (Copper, mask, paste, solder)
*/ */
static int ChangeSideMaskLayer( int masque ) int ChangeSideMaskLayer( int masque )
{ {
int newmasque; int newmasque;
......
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
/***********************************************/ /***********************************************/
#include "fctsys.h" #include "fctsys.h"
#include "PolyLine.h"
#include "common.h" #include "common.h"
#include "confirm.h" #include "confirm.h"
#include "kicad_string.h" #include "kicad_string.h"
...@@ -176,7 +177,7 @@ void D_PAD::Copy( D_PAD* source ) ...@@ -176,7 +177,7 @@ void D_PAD::Copy( D_PAD* source )
m_Pos = source->m_Pos; m_Pos = source->m_Pos;
m_Masque_Layer = source->m_Masque_Layer; m_Masque_Layer = source->m_Masque_Layer;
memcpy( m_Padname, source->m_Padname, sizeof(m_Padname) ); m_NumPadName = source->m_NumPadName;
SetNet( source->GetNet() ); SetNet( source->GetNet() );
m_Drill = source->m_Drill; m_Drill = source->m_Drill;
m_DrillShape = source->m_DrillShape; m_DrillShape = source->m_DrillShape;
...@@ -779,6 +780,23 @@ bool D_PAD::HitTest( const wxPoint& ref_pos ) ...@@ -779,6 +780,23 @@ bool D_PAD::HitTest( const wxPoint& ref_pos )
return true; return true;
break; break;
case PAD_TRAPEZOID:
{
wxPoint poly[4];
BuildPadPolygon( poly, wxSize(0,0), 0 );
// Build the same polygon with CPolyPt corners,
// to use TestPointInsidePolygon
static std::vector <CPolyPt> polysList; // Is static to avoid memory reallocation
polysList.clear();
for(int ii= 0; ii < 4; ii++ )
{
CPolyPt corner(poly[ii].x, poly[ii].y);
polysList.push_back(corner);
}
RotatePoint( &deltaX, &deltaY, -m_Orient );
return TestPointInsidePolygon( polysList, 0, 3, deltaX, deltaY );
}
default: default:
RotatePoint( &deltaX, &deltaY, -m_Orient ); RotatePoint( &deltaX, &deltaY, -m_Orient );
if( (abs( deltaX ) <= dx ) && (abs( deltaY ) <= dy) ) if( (abs( deltaX ) <= dx ) && (abs( deltaY ) <= dy) )
......
...@@ -25,6 +25,28 @@ class Pcb3D_GLCanvas; ...@@ -25,6 +25,28 @@ class Pcb3D_GLCanvas;
#define PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS LAYER_BACK | SILKSCREEN_LAYER_FRONT | \ #define PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS LAYER_BACK | SILKSCREEN_LAYER_FRONT | \
SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT SOLDERMASK_LAYER_BACK | SOLDERMASK_LAYER_FRONT
// Helper class to staore parameters used to draw a pad
class PAD_DRAWINFO
{
public:
WinEDA_DrawPanel * m_DrawPanel; // the WinEDA_DrawPanel used to draw a PAD ; can be null
int m_DrawMode; // the draw mode
int m_Color; // color used to draw the pad shape , from pad layers and visible layers
int m_HoleColor; // color used to draw the pad hole
int m_PadClearance; // clearance value, used to draw the pad area outlines
wxSize m_Mask_margin; // margin, used to draw solder paste when only one layer is shown
bool m_Display_padnum; // true to show pad number
bool m_Display_netname; // true to show net name
bool m_ShowPadFilled; // true to show pad as solid area, false to show pas in sketch mode
bool m_ShowNCMark; // true to show pad not connected mark
bool m_IsPrinting; // true to print, false to display on screen.
wxPoint m_Offset; // general draw offset
#ifndef USE_WX_ZOOM
double m_Scale; // Draw scaling factor
#endif
PAD_DRAWINFO( );
};
class D_PAD : public BOARD_CONNECTED_ITEM class D_PAD : public BOARD_CONNECTED_ITEM
{ {
...@@ -210,6 +232,22 @@ public: ...@@ -210,6 +232,22 @@ public:
void Draw3D( Pcb3D_GLCanvas* glcanvas ); void Draw3D( Pcb3D_GLCanvas* glcanvas );
/** function DrawShape
* basic function to draw a pad.
* used by Draw after calculation of parameters (color, ) final orientation ...
*/
void DrawShape( EDA_Rect* aClipBox, wxDC* aDC, PAD_DRAWINFO& aDrawInfo );
/** function BuildPadPolygon
* Has meaning only for polygonal pads (trapeziod and rectangular)
* Build the Corner list of the polygonal shape,
* depending on shape, extra size (clearance ...) and orientation
* @param aCoord[4] = a buffer to fill.
* @param aInflateValue = wxSize: the clearance or margin value. value > 0: inflate, < 0 deflate
* @param aRotation = full rotation of the polygon
*/
void BuildPadPolygon( wxPoint aCoord[4], wxSize aInflateValue, int aRotation );
// others // others
void SetPadName( const wxString& name ); // Change pad name void SetPadName( const wxString& name ); // Change pad name
wxString ReturnStringPadName(); // Return pad name as string in a wxString wxString ReturnStringPadName(); // Return pad name as string in a wxString
......
This diff is collapsed.
...@@ -58,7 +58,7 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con ...@@ -58,7 +58,7 @@ DIALOG_GENDRILL_BASE::DIALOG_GENDRILL_BASE( wxWindow* parent, wxWindowID id, con
int m_Choice_Drill_MapNChoices = sizeof( m_Choice_Drill_MapChoices ) / sizeof( wxString ); int m_Choice_Drill_MapNChoices = sizeof( m_Choice_Drill_MapChoices ) / sizeof( wxString );
m_Choice_Drill_Map = new wxRadioBox( this, wxID_ANY, _("Drill Sheet:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_MapNChoices, m_Choice_Drill_MapChoices, 1, wxRA_SPECIFY_COLS ); m_Choice_Drill_Map = new wxRadioBox( this, wxID_ANY, _("Drill Sheet:"), wxDefaultPosition, wxDefaultSize, m_Choice_Drill_MapNChoices, m_Choice_Drill_MapChoices, 1, wxRA_SPECIFY_COLS );
m_Choice_Drill_Map->SetSelection( 0 ); m_Choice_Drill_Map->SetSelection( 0 );
m_Choice_Drill_Map->SetToolTip( _("Creates a drill map in PS, HPGL or others formats") ); m_Choice_Drill_Map->SetToolTip( _("Creates a drill map in PS, HPGL or other formats") );
bMiddleBoxSizer->Add( m_Choice_Drill_Map, 0, wxALL|wxEXPAND, 5 ); bMiddleBoxSizer->Add( m_Choice_Drill_Map, 0, wxALL|wxEXPAND, 5 );
......
...@@ -335,7 +335,7 @@ ...@@ -335,7 +335,7 @@
<property name="size"></property> <property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</property> <property name="style">wxRA_SPECIFY_COLS</property>
<property name="subclass"></property> <property name="subclass"></property>
<property name="tooltip">Creates a drill map in PS, HPGL or others formats</property> <property name="tooltip">Creates a drill map in PS, HPGL or other formats</property>
<property name="window_extra_style"></property> <property name="window_extra_style"></property>
<property name="window_name"></property> <property name="window_name"></property>
<property name="window_style"></property> <property name="window_style"></property>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
...@@ -21,6 +21,7 @@ ...@@ -21,6 +21,7 @@
#include <wx/sizer.h> #include <wx/sizer.h>
#include <wx/statbox.h> #include <wx/statbox.h>
#include <wx/radiobox.h> #include <wx/radiobox.h>
#include <wx/panel.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/button.h> #include <wx/button.h>
#include <wx/dialog.h> #include <wx/dialog.h>
...@@ -92,7 +93,13 @@ class DIALOG_PAD_PROPERTIES_BASE : public wxDialog ...@@ -92,7 +93,13 @@ class DIALOG_PAD_PROPERTIES_BASE : public wxDialog
wxRadioBox* m_PadOrient; wxRadioBox* m_PadOrient;
wxStaticText* m_PadOrientText; wxStaticText* m_PadOrientText;
wxTextCtrl* m_PadOrientCtrl; wxTextCtrl* m_PadOrientCtrl;
wxStaticText* m_staticText20; wxPanel* m_panelShowPad;
wxStaticText* m_staticTitleModuleRot;
wxStaticText* m_staticModuleRotValue;
wxStaticText* m_staticTitleModuleSide;
wxStaticText* m_staticModuleSideValue;
wxStaticText* m_staticTextWarningPadFlipped;
wxStaticText* m_staticTextWarning;
wxStaticText* m_staticTextNetClearance; wxStaticText* m_staticTextNetClearance;
wxTextCtrl* m_NetClearanceValueCtrl; wxTextCtrl* m_NetClearanceValueCtrl;
wxStaticText* m_NetClearanceUnits; wxStaticText* m_NetClearanceUnits;
...@@ -128,16 +135,19 @@ class DIALOG_PAD_PROPERTIES_BASE : public wxDialog ...@@ -128,16 +135,19 @@ class DIALOG_PAD_PROPERTIES_BASE : public wxDialog
wxButton* m_sdbSizer1Cancel; wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void OnValuesChanged( wxCommandEvent& event ){ event.Skip(); }
virtual void OnPadShapeSelection( wxCommandEvent& event ){ event.Skip(); } virtual void OnPadShapeSelection( wxCommandEvent& event ){ event.Skip(); }
virtual void OnDrillShapeSelected( wxCommandEvent& event ){ event.Skip(); } virtual void OnDrillShapeSelected( wxCommandEvent& event ){ event.Skip(); }
virtual void PadOrientEvent( wxCommandEvent& event ){ event.Skip(); } virtual void PadOrientEvent( wxCommandEvent& event ){ event.Skip(); }
virtual void OnPaintShowPanel( wxPaintEvent& event ){ event.Skip(); }
virtual void PadTypeSelected( wxCommandEvent& event ){ event.Skip(); } virtual void PadTypeSelected( wxCommandEvent& event ){ event.Skip(); }
virtual void OnSetLayer( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnCancelButtonClick( wxCommandEvent& event ){ event.Skip(); }
virtual void PadPropertiesAccept( wxCommandEvent& event ){ event.Skip(); } virtual void PadPropertiesAccept( wxCommandEvent& event ){ event.Skip(); }
public: public:
DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_DIALOG_EDIT_PAD, const wxString& title = _("Pad Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 673,488 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSUNKEN_BORDER ); DIALOG_PAD_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_DIALOG_EDIT_PAD, const wxString& title = _("Pad Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 733,486 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER|wxSUNKEN_BORDER );
~DIALOG_PAD_PROPERTIES_BASE(); ~DIALOG_PAD_PROPERTIES_BASE();
}; };
......
...@@ -291,7 +291,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar() ...@@ -291,7 +291,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
/* Swap Layers */ /* Swap Layers */
item = new wxMenuItem( editMenu, ID_MENU_PCB_SWAP_LAYERS, item = new wxMenuItem( editMenu, ID_MENU_PCB_SWAP_LAYERS,
_( "&Swap Layers" ), _( "&Swap Layers" ),
_( "Swap tracks on copper layers or drawings on others layers" ) ); _( "Swap tracks on copper layers or drawings on other layers" ) );
item->SetBitmap( swap_layer_xpm ); item->SetBitmap( swap_layer_xpm );
editMenu->Append( item ); editMenu->Append( item );
...@@ -309,7 +309,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar() ...@@ -309,7 +309,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
* From hotkeys, zooming is made around the mouse cursor position * From hotkeys, zooming is made around the mouse cursor position
* (obviously not possible from the toolbar or menubar command) * (obviously not possible from the toolbar or menubar command)
* *
* in others words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators * in other words HK_ZOOM_IN and HK_ZOOM_OUT *are NOT* accelerators
* for Zoom in and Zoom out sub menus * for Zoom in and Zoom out sub menus
*/ */
/* Zoom in */ /* Zoom in */
......
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