28#include <wx/dcclient.h> 
   54        DIALOG_SHIM( (wxWindow*)aParent, wxID_ANY, 
_( 
"Pad Table" ), wxDefaultPosition, wxDefaultSize,
 
   55                     wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER ),
 
   60    wxBoxSizer* topSizer = 
new wxBoxSizer( wxVERTICAL );
 
   63    m_grid->CreateGrid( 0, 11 );
 
   75    m_grid->EnableEditing( 
true );
 
   80    attr = 
new wxGridCellAttr;
 
   82        wxArrayString typeNames;
 
   83        typeNames.push_back( 
_( 
"Through-hole" ) ); 
 
   84        typeNames.push_back( 
_( 
"SMD" ) );          
 
   85        typeNames.push_back( 
_( 
"Connector" ) );    
 
   86        typeNames.push_back( 
_( 
"NPTH" ) );         
 
   87        typeNames.push_back( 
_( 
"Aperture" ) );     
 
   92    attr = 
new wxGridCellAttr;
 
  104    attr = 
new wxGridCellAttr;
 
  108    attr = 
new wxGridCellAttr;
 
  112    attr = 
new wxGridCellAttr;
 
  116    attr = 
new wxGridCellAttr;
 
  121    attr = 
new wxGridCellAttr;
 
  126    attr = 
new wxGridCellAttr;
 
  131    attr = 
new wxGridCellAttr;
 
  136    attr = 
new wxGridCellAttr;
 
  148    topSizer->Add( 
m_grid, 1, wxEXPAND | wxALL, 5 );
 
  150    wxStdDialogButtonSizer* buttons = 
new wxStdDialogButtonSizer();
 
  151    buttons->AddButton( 
new wxButton( 
this, wxID_OK ) );
 
  152    buttons->AddButton( 
new wxButton( 
this, wxID_CANCEL ) );
 
  154    topSizer->Add( buttons, 0, wxALIGN_RIGHT | wxALL, 5 );
 
  156    SetSizerAndFit( topSizer );
 
  167          [
this]( wxCommandEvent& aEvt )
 
 
  200        switch( 
pad->GetAttribute() )
 
  206        default: attrStr = 
_( 
"Through-hole" ); 
break;
 
  211        if( 
pad->IsAperturePad() )
 
  212            attrStr = 
_( 
"Aperture" );
 
  240        if( 
pad->GetPadToDieLength() )
 
  243        if( 
pad->GetPadToDieDelay() )
 
  253    m_grid->AutoSizeColumns();
 
  260        dc.SetFont( 
m_grid->GetFont() );
 
  268        shapeNames.push_back( 
_( 
"Chamfered rectangle" ) );
 
  276            dc.GetTextExtent( str, &w, &h );
 
  277            maxWidth = std::max( maxWidth, w );
 
  281        int padding = FromDIP( 30 ); 
 
  291    wxSizeEvent sizeEvt( GetSize(), GetId() );
 
  295                wxSizeEvent evt( sizeEvt );
 
  300    if( 
m_grid->GetNumberRows() > 0 )
 
  302        m_grid->SetGridCursor( 0, 0 );
 
  304        wxGridEvent ev( 
m_grid->GetId(), wxEVT_GRID_SELECT_CELL, 
m_grid, 0, 0, -1, -1, 
true );
 
 
  355        pad->ClearBrightened();
 
 
  371    if( !
m_grid->CommitPendingChanges() )
 
  385        if( typeStr == 
_( 
"Through-hole" ) )
 
  387        else if( typeStr == 
_( 
"SMD" ) )
 
  389        else if( typeStr == 
_( 
"Connector" ) )
 
  391        else if( typeStr == 
_( 
"NPTH" ) )
 
  403        pad->SetPosition( pos );
 
  415            if( dx > 0 || dy > 0 )
 
  417                if( dx <= 0 ) dx = dy;
 
  418                if( dy <= 0 ) dy = dx;
 
  419                pad->SetDrillSize( { dx, dy } );
 
  427        if( !lenStr.IsEmpty() )
 
  430            pad->SetPadToDieLength( 0 );
 
  432        if( !delayStr.IsEmpty() )
 
  436            if( delayStr.ToLong( &delayVal ) )
 
  437                pad->SetPadToDieDelay( (
int) delayVal );
 
  439                pad->SetPadToDieDelay( 0 );
 
  442            pad->SetPadToDieDelay( 0 );
 
 
  460    int cols = 
m_grid->GetNumberCols();
 
  462    std::vector<int> widths;
 
  463    widths.reserve( cols );
 
  465    for( 
int c = 0; c < cols; ++c )
 
  467        int w = 
m_grid->GetColSize( c );
 
  468        widths.push_back( w );
 
  475    for( 
int w : widths )
 
 
  492    int cols = 
m_grid->GetNumberCols();
 
  495    for( 
int c = 0; c < cols; ++c )
 
  496        available += 
m_grid->GetColSize( c );
 
  499    int clientW = 
m_grid->GetClientSize().x;
 
  506    for( 
int c = 0; c < cols; ++c )
 
  515        m_grid->SetColSize( c, target );
 
 
  525    int row = aEvent.GetRow();
 
  526    int col = aEvent.GetCol();
 
  533    PAD* target = 
nullptr;
 
  537        if( idx == row ) { target = 
pad; 
break; }
 
  543    bool needCanvasRefresh = 
false;
 
  553        wxString typeStr = 
m_grid->GetCellValue( row, col );
 
  556        if( typeStr == 
_( 
"Through-hole" ) )
 
  558        else if( typeStr == 
_( 
"SMD" ) )
 
  560        else if( typeStr == 
_( 
"Connector" ) )
 
  562        else if( typeStr == 
_( 
"NPTH" ) )
 
  573            needCanvasRefresh = 
true;
 
  580        needCanvasRefresh = 
true;
 
  589            pos.
x = 
m_grid->GetUnitValue( row, col );
 
  591            pos.
y = 
m_grid->GetUnitValue( row, col );
 
  594        needCanvasRefresh = 
true;
 
  604            size.
x = 
m_grid->GetUnitValue( row, col );
 
  606            size.
y = 
m_grid->GetUnitValue( row, col );
 
  609        needCanvasRefresh = 
true;
 
  620            if( dx > 0 || dy > 0 )
 
  622                if( dx <= 0 ) dx = dy;
 
  623                if( dy <= 0 ) dy = dx;
 
  625                needCanvasRefresh = 
true;
 
  632        if( !
m_grid->GetCellValue( row, col ).IsEmpty() )
 
  638        wxString d = 
m_grid->GetCellValue( row, col );
 
  641        if( d.ToLong( &val ) )
 
  653    if( needCanvasRefresh )
 
  656            base->GetCanvas()->ForceRefresh();
 
 
  663    int row = aEvent.GetRow();
 
  674        if( 
pad->IsBrightened() )
 
  676            pad->ClearBrightened();
 
  689            pad->SetBrightened();
 
 
constexpr EDA_IU_SCALE pcbIUScale
 
DIALOG_FP_EDIT_PAD_TABLE(PCB_BASE_FRAME *aParent, FOOTPRINT *aFootprint)
 
void CaptureOriginalPadState()
 
std::vector< PAD_SNAPSHOT > m_originalPads
 
void InitColumnProportions()
 
bool TransferDataFromWindow() override
 
void OnSize(wxSizeEvent &aEvent)
 
std::vector< int > m_minColWidths
 
void OnCellChanged(wxGridEvent &aEvent)
 
~DIALOG_FP_EDIT_PAD_TABLE() override
 
void RestoreOriginalPadState()
 
std::vector< double > m_colProportions
 
std::unique_ptr< UNITS_PROVIDER > m_unitsProvider
 
void OnSelectCell(wxGridEvent &aEvent)
 
void finishDialogSettings()
In all dialogs, we must call the same functions to fix minimal dlg size, the default position and per...
 
DIALOG_SHIM(wxWindow *aParent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_FRAME_STYLE|wxRESIZE_BORDER, const wxString &name=wxDialogNameStr)
 
EDA_UNITS GetUserUnits() const
 
void ForceRefresh()
Force a redraw.
 
This class works around a bug in wxGrid where the first keystroke doesn't get sent through the valida...
 
virtual void Update(const VIEW_ITEM *aItem, int aUpdateFlags) const override
For dynamic VIEWs, inform the associated VIEW that the graphical representation of this item has chan...
 
void MarkTargetDirty(int aTarget)
Set or clear target 'dirty' flag.
 
static constexpr PCB_LAYER_ID ALL_LAYERS
! Temporary layer identifier to identify code that is not padstack-aware
 
void SetAttribute(PAD_ATTRIB aAttribute)
 
PAD_ATTRIB GetAttribute() const
 
void SetShape(PCB_LAYER_ID aLayer, PAD_SHAPE aShape)
Set the new shape of this pad.
 
VECTOR2I GetPosition() const override
 
void SetPadToDieDelay(int aDelay)
 
void SetNumber(const wxString &aNumber)
Set the pad number (note that it can be alphanumeric, such as the array reference "AA12").
 
void SetPosition(const VECTOR2I &aPos) override
 
void SetDrillSize(const VECTOR2I &aSize)
 
void SetSize(PCB_LAYER_ID aLayer, const VECTOR2I &aSize)
 
void SetPadToDieLength(int aLength)
 
const VECTOR2I & GetSize(PCB_LAYER_ID aLayer) const
 
Base PCB main window class for Pcbnew, Gerbview, and CvPcb footprint viewer.
 
PCB_DRAW_PANEL_GAL * GetCanvas() const override
Return a pointer to GAL-based canvas of given EDA draw frame.
 
virtual KIGFX::PCB_VIEW * GetView() const override
Return a pointer to the #VIEW instance used in the panel.
 
static PAD_SHAPE ShapeFromString(const wxString &shape)
 
static std::map< int, wxString > shapeNames
 
@ REPAINT
Item needs to be redrawn.
 
@ TARGET_OVERLAY
Items that may change while the view stays the same (noncached)
 
PAD_ATTRIB
The set of pad shapes, used with PAD::{Set,Get}Attribute().
 
@ NPTH
like PAD_PTH, but not plated mechanical use only, no connection allowed
 
@ SMD
Smd pad, appears on the solder paste layer (default)
 
@ PTH
Plated through hole pad.
 
@ CONN
Like smd, does not appear on the solder paste layer (default) Note: also has a special attribute in G...
 
PAD_SHAPE
The set of pad shapes, used with PAD::{Set,Get}Shape()
 
VECTOR2< int32_t > VECTOR2I