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
This diff is collapsed.
......@@ -1138,6 +1138,9 @@ void GRSCSegm( EDA_Rect* ClipBox,
static bool IsGRSPolyDrawable( EDA_Rect* ClipBox, int n, wxPoint Points[] )
{
if( ! ClipBox )
return true;
int Xmin, Xmax, Ymin, Ymax;
Xmin = Xmax = Points[0].x;
......
......@@ -13,11 +13,6 @@
#include "cvpcb.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 );
......@@ -74,7 +69,6 @@ int GenNetlistPcbnew( FILE* file, COMPONENT_LIST& list, bool isEESchemaNetlist,
{
#define NETLIST_HEAD_STRING "EESchema Netlist Version 1.1"
char Line[1024];
int netNumber = 1;
DateAndTime( Line );
......@@ -103,9 +97,6 @@ int GenNetlistPcbnew( FILE* file, COMPONENT_LIST& list, bool isEESchemaNetlist,
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() )
fprintf( file, " ( %s %s )\n",
CONV_TO_UTF8( pin.m_Number ),
......@@ -161,42 +152,3 @@ void WriteFootprintFilterInfos( FILE* file, COMPONENT_LIST& list )
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:
* orientation.
*/
public:
//int m_Shape;
//bool m_IsDangling; // TRUE non connected
public:
SCH_SHEET_PIN( SCH_SHEET* parent,
const wxPoint& pos = wxPoint( 0, 0 ),
......@@ -63,6 +58,19 @@ public:
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()
{
return (SCH_SHEET_PIN*) Pnext;
......
......@@ -60,6 +60,22 @@ SCH_SHEET_PIN* SCH_SHEET_PIN::GenCopy()
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 )
{
......
......@@ -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,
int DrawMode, int Color )
{
/*********************************************************************************************/
SCH_TEXT::Draw( panel, DC, offset, DrawMode, Color );
}
......@@ -1028,8 +1029,8 @@ void SCH_HIERLABEL::Draw( WinEDA_DrawPanel* panel,
{
/*****************************************************************************/
/* Texts type Global Label have 4 directions, and the Text origin is the
* graphic icon
/* Hierarchical Label have a text and a graphic icon.
* Texts type have 4 directions, and the text origin is the graphic icon
*/
static std::vector <wxPoint> Poly;
EDA_Colors color;
......@@ -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()
......
......@@ -93,6 +93,18 @@ public:
int draw_mode,
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 Place( WinEDA_SchematicFrame* frame, wxDC* DC );
......@@ -291,13 +303,13 @@ public:
*/
EDA_Rect GetBoundingBox();
/** function CreateGraphicShape
/** 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
* @param aPos = Position of the shape
*/
void CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
const wxPoint& Pos );
virtual void CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
const wxPoint& aPos );
/** virtual function Mirror_Y
* mirror item relative to an Y axis
......@@ -355,7 +367,7 @@ public:
* @param aCorner_list = a buffer to fill with polygon corners coordinates
* @param Pos = Postion of the shape
*/
void CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
virtual void CreateGraphicShape( std::vector <wxPoint>& aCorner_list,
const wxPoint& Pos );
/**
......
This diff is collapsed.
......@@ -107,7 +107,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_PanelBasic->SetSizer( bSizerBasicPanel );
m_PanelBasic->Layout();
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 );
wxBoxSizer* m_PanelDocBoxSizer;
m_PanelDocBoxSizer = new wxBoxSizer( wxVERTICAL );
......@@ -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->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 );
......@@ -153,7 +153,7 @@ DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE::DIALOG_EDIT_COMPONENT_IN_LIBRARY_BASE( wx
m_PanelDoc->SetSizer( m_PanelDocBoxSizer );
m_PanelDoc->Layout();
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 );
wxBoxSizer* bSizerMainPanelAlias;
bSizerMainPanelAlias = new wxBoxSizer( wxHORIZONTAL );
......
......@@ -128,7 +128,7 @@
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Options</property>
<property name="select">0</property>
<property name="select">1</property>
<object class="wxPanel" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
......@@ -851,7 +851,7 @@
<object class="notebookpage" expanded="1">
<property name="bitmap"></property>
<property name="label">Description</property>
<property name="select">1</property>
<property name="select">0</property>
<object class="wxPanel" expanded="1">
<property name="bg"></property>
<property name="context_help"></property>
......@@ -1026,7 +1026,7 @@
<property name="size"></property>
<property name="style"></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_name"></property>
<property name="window_style"></property>
......
......@@ -288,19 +288,9 @@ static void PlotTextStruct( PLOTTER* plotter, SCH_TEXT* aSchText )
aSchText->m_Bold );
/* Draw graphic symbol for global or hierarchical labels */
if( aSchText->Type() == TYPE_SCH_GLOBALLABEL )
{
( (SCH_GLOBALLABEL*) aSchText )->CreateGraphicShape( Poly,
aSchText->m_Pos );
aSchText->CreateGraphicShape( Poly, aSchText->m_Pos );
if( Poly.size() )
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 )
return;
}
if( !IsOK( this, _( "Do you wish to cleanup this sheet" ) ) )
if( !IsOK( this, _( "Do you wish to cleanup this sheet?" ) ) )
return;
/* Save sheet in undo list before cleaning up unreferenced hierarchical labels. */
......
......@@ -71,11 +71,10 @@ int ChangeSideNumLayer( int oldlayer )
}
/* Change the mask layer during routing cu / cmp layers for
* Cu / CMP..
* (Copper, mask, paste, solder)
/* Calculate the mask layer when flipping a footprint
* BACK and FRONT copper layers , mask, paste, solder layers are swapped
*/
static int ChangeSideMaskLayer( int masque )
int ChangeSideMaskLayer( int masque )
{
int newmasque;
......
......@@ -3,6 +3,7 @@
/***********************************************/
#include "fctsys.h"
#include "PolyLine.h"
#include "common.h"
#include "confirm.h"
#include "kicad_string.h"
......@@ -176,7 +177,7 @@ void D_PAD::Copy( D_PAD* source )
m_Pos = source->m_Pos;
m_Masque_Layer = source->m_Masque_Layer;
memcpy( m_Padname, source->m_Padname, sizeof(m_Padname) );
m_NumPadName = source->m_NumPadName;
SetNet( source->GetNet() );
m_Drill = source->m_Drill;
m_DrillShape = source->m_DrillShape;
......@@ -779,6 +780,23 @@ bool D_PAD::HitTest( const wxPoint& ref_pos )
return true;
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:
RotatePoint( &deltaX, &deltaY, -m_Orient );
if( (abs( deltaX ) <= dx ) && (abs( deltaY ) <= dy) )
......
......@@ -25,6 +25,28 @@ class Pcb3D_GLCanvas;
#define PAD_HOLE_NOT_PLATED_DEFAULT_LAYERS LAYER_BACK | SILKSCREEN_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
{
......@@ -210,6 +232,22 @@ public:
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
void SetPadName( const wxString& name ); // Change pad name
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
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->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 );
......
......@@ -335,7 +335,7 @@
<property name="size"></property>
<property name="style">wxRA_SPECIFY_COLS</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_name"></property>
<property name="window_style"></property>
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -21,6 +21,7 @@
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/panel.h>
#include <wx/checkbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
......@@ -92,7 +93,13 @@ class DIALOG_PAD_PROPERTIES_BASE : public wxDialog
wxRadioBox* m_PadOrient;
wxStaticText* m_PadOrientText;
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;
wxTextCtrl* m_NetClearanceValueCtrl;
wxStaticText* m_NetClearanceUnits;
......@@ -128,16 +135,19 @@ class DIALOG_PAD_PROPERTIES_BASE : public wxDialog
wxButton* m_sdbSizer1Cancel;
// 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 OnDrillShapeSelected( 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 OnSetLayer( wxCommandEvent& event ){ event.Skip(); }
virtual void OnCancelButtonClick( wxCommandEvent& event ){ event.Skip(); }
virtual void PadPropertiesAccept( wxCommandEvent& event ){ event.Skip(); }
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();
};
......
......@@ -291,7 +291,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
/* Swap Layers */
item = new wxMenuItem( editMenu, ID_MENU_PCB_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 );
editMenu->Append( item );
......@@ -309,7 +309,7 @@ void WinEDA_PcbFrame::ReCreateMenuBar()
* From hotkeys, zooming is made around the mouse cursor position
* (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
*/
/* 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