Simplify copy/paste of pad settings.

Fixes: lp:1743141
* https://bugs.launchpad.net/kicad/+bug/1743141

(cherry picked from commit 13ece03)
This commit is contained in:
Jeff Young 2018-07-05 17:14:19 +01:00
parent 1bca706115
commit 45e6dfc7af
20 changed files with 537 additions and 1126 deletions

View File

@ -406,31 +406,27 @@ public:
*/
void StartMovePad( D_PAD* aPad, wxDC* aDC, bool aDragConnectedTracks );
void RotatePad( D_PAD* Pad, wxDC* DC );
void PlacePad( D_PAD* Pad, wxDC* DC );
void Export_Pad_Settings( D_PAD* aPad );
void Import_Pad_Settings( D_PAD* aPad, bool aDraw );
/**
* Function GlobalChange_PadSettings
* Function to change pad caracteristics for the given footprint
* or all footprints which look like the given footprint
* Function DoPushPadProperties
* Function to change pad settings for the given footprint or all identical footprints
* @param aPad is the pattern. The given footprint is the parent of this pad
* @param aSameFootprints: if true, make changes on all identical footprints
* @param aPadShapeFilter: if true, make changes only on pads having the same shape as aPad
* @param aPadOrientFilter: if true, make changes only on pads having the same orientation as aPad
* @param aPadLayerFilter: if true, make changes only on pads having the same layers as aPad
* @param aRedraw: if true: redraws the footprint
* @param aSaveForUndo: if true: create an entry in the Undo/Redo list
* (usually: true in Schematic editor, false in Module editor)
*/
void GlobalChange_PadSettings( D_PAD* aPad,
bool aSameFootprints,
bool aPadShapeFilter,
bool aPadOrientFilter,
bool aPadLayerFilter,
bool aRedraw,
bool aSaveForUndo );
void DoPushPadProperties( D_PAD* aPad,
bool aSameFootprints,
bool aPadShapeFilter,
bool aPadOrientFilter,
bool aPadLayerFilter,
bool aSaveForUndo );
/**
* Function SelectFootprint

View File

@ -99,8 +99,8 @@ set( PCBNEW_DIALOGS
dialogs/dialog_global_edit_tracks_and_vias_base.cpp
dialogs/dialog_global_edit_text_and_graphics.cpp
dialogs/dialog_global_edit_text_and_graphics_base.cpp
dialogs/dialog_global_pads_edition.cpp
dialogs/dialog_global_pads_edition_base.cpp
dialogs/dialog_push_pad_properties.cpp
dialogs/dialog_push_pad_properties_base.cpp
dialogs/dialog_graphic_item_properties.cpp
dialogs/dialog_graphic_item_properties_base.cpp
dialogs/dialog_import_settings.cpp
@ -242,7 +242,6 @@ set( PCBNEW_CLASS_SRCS
footprint_edit_frame.cpp
footprint_libraries_utils.cpp
footprint_viewer_frame.cpp
globaleditpad.cpp
grid_layer_box_helpers.cpp
grid_layer_box_helpers.h
highlight.cpp
@ -263,7 +262,7 @@ set( PCBNEW_CLASS_SRCS
netlist.cpp
onleftclick.cpp
onrightclick.cpp
pad_edition_functions.cpp
pad_edit_functions.cpp
pcb_base_edit_frame.cpp
pcb_footprint_edit_utils.cpp
pcb_layer_box_selector.cpp

View File

@ -1433,6 +1433,16 @@ void D_PAD::ImportSettingsFromMaster( const D_PAD& aMasterPad )
;
}
// copy also local settings:
SetLocalClearance( aMasterPad.GetLocalClearance() );
SetLocalSolderMaskMargin( aMasterPad.GetLocalSolderMaskMargin() );
SetLocalSolderPasteMargin( aMasterPad.GetLocalSolderPasteMargin() );
SetLocalSolderPasteMarginRatio( aMasterPad.GetLocalSolderPasteMarginRatio() );
SetZoneConnection( aMasterPad.GetZoneConnection() );
SetThermalWidth( aMasterPad.GetThermalWidth() );
SetThermalGap( aMasterPad.GetThermalGap() );
// Add or remove custom pad shapes:
SetPrimitives( aMasterPad.GetPrimitives() );
SetAnchorPadShape( aMasterPad.GetAnchorPadShape() );

View File

@ -1,81 +0,0 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_global_pads_edition_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_GLOBAL_PADS_EDITION_BASE::DIALOG_GLOBAL_PADS_EDITION_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxHORIZONTAL );
wxBoxSizer* bLeftSizer;
bLeftSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pad Filter :") ), wxVERTICAL );
m_Pad_Shape_Filter_CB = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Do not modify pads having a different shape"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer1->Add( m_Pad_Shape_Filter_CB, 0, wxALL, 5 );
m_Pad_Layer_Filter_CB = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Do not modify pads having different layers"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer1->Add( m_Pad_Layer_Filter_CB, 0, wxALL, 5 );
m_Pad_Orient_Filter_CB = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Do not modify pads having a different orientation"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer1->Add( m_Pad_Orient_Filter_CB, 0, wxALL, 5 );
bLeftSizer->Add( sbSizer1, 1, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bLeftSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
m_buttonPadEditor = new wxButton( this, ID_CHANGE_GET_PAD_SETTINGS, _("Pad Properties..."), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_buttonPadEditor, 0, wxALL|wxEXPAND, 5 );
bRightSizer->Add( 10, 10, 0, 0, 5 );
m_buttonChangeModule = new wxButton( this, ID_CHANGE_CURRENT_MODULE, _("Change Pads on Footprint"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_buttonChangeModule, 0, wxALL|wxEXPAND, 5 );
m_buttonIdModules = new wxButton( this, ID_CHANGE_ID_MODULES, _("Change Pads on Identical Footprints"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_buttonIdModules, 0, wxALL|wxEXPAND, 5 );
m_buttonCancel = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_buttonCancel, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bRightSizer, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
m_buttonPadEditor->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_PADS_EDITION_BASE::InstallPadEditor ), NULL, this );
m_buttonChangeModule->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_PADS_EDITION_BASE::PadPropertiesAccept ), NULL, this );
m_buttonIdModules->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_PADS_EDITION_BASE::PadPropertiesAccept ), NULL, this );
m_buttonCancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_PADS_EDITION_BASE::OnCancelClick ), NULL, this );
}
DIALOG_GLOBAL_PADS_EDITION_BASE::~DIALOG_GLOBAL_PADS_EDITION_BASE()
{
// Disconnect Events
m_buttonPadEditor->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_PADS_EDITION_BASE::InstallPadEditor ), NULL, this );
m_buttonChangeModule->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_PADS_EDITION_BASE::PadPropertiesAccept ), NULL, this );
m_buttonIdModules->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_PADS_EDITION_BASE::PadPropertiesAccept ), NULL, this );
m_buttonCancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_PADS_EDITION_BASE::OnCancelClick ), NULL, this );
}

View File

@ -22,64 +22,58 @@
*/
#include <dialog_global_pads_edition.h>
#include <dialog_push_pad_properties.h>
#include <class_pad.h>
#include <pcb_edit_frame.h>
DIALOG_GLOBAL_PADS_EDITION::DIALOG_GLOBAL_PADS_EDITION( PCB_BASE_FRAME* aParent, D_PAD* aPad ) :
DIALOG_GLOBAL_PADS_EDITION_BASE( aParent )
{
m_parent = aParent;
m_currentPad = aPad;
// Class DIALOG_PUSH_PAD_PROPERTIES static variables
bool DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Shape_Filter = true;
bool DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Layer_Filter = true;
bool DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Orient_Filter = true;
DIALOG_PUSH_PAD_PROPERTIES::DIALOG_PUSH_PAD_PROPERTIES( PCB_BASE_FRAME* aParent ) :
DIALOG_PUSH_PAD_PROPERTIES_BASE( aParent ),
m_parent( aParent )
{
// Pad filter selection.
m_Pad_Shape_Filter_CB->SetValue( m_Pad_Shape_Filter );
m_Pad_Layer_Filter_CB->SetValue( m_Pad_Layer_Filter );
m_Pad_Orient_Filter_CB->SetValue( m_Pad_Orient_Filter );
SetFocus();
// We use a sdbSizer to get platform-dependent ordering of the action buttons, but
// that requires us to correct the button labels here.
m_sdbSizer1OK->SetLabel( _( "Change Pads on Current Footprint" ) );
GetSizer()->Fit( this );
Centre();
}
if( aParent->IsType( FRAME_PCB_MODULE_EDITOR ) )
m_sdbSizer1Apply->Show( false );
else
m_sdbSizer1Apply->SetLabel( _( "Change Pads on Identical Footprints" ) );
m_sdbSizer1->Layout();
// Class DIALOG_GLOBAL_PADS_EDITION static variables
bool DIALOG_GLOBAL_PADS_EDITION::m_Pad_Shape_Filter = true;
bool DIALOG_GLOBAL_PADS_EDITION::m_Pad_Layer_Filter = true;
bool DIALOG_GLOBAL_PADS_EDITION::m_Pad_Orient_Filter = true;
m_sdbSizer1OK->SetDefault();
void DIALOG_GLOBAL_PADS_EDITION::OnCancelClick( wxCommandEvent& event )
{
EndModal( -1 );
}
/* Calls the Pad editor.
*/
void DIALOG_GLOBAL_PADS_EDITION::InstallPadEditor( wxCommandEvent& event )
{
m_parent->InstallPadOptionsFrame( m_currentPad );
FinishDialogSettings();
}
/* Update the parameters for the component being edited.
*/
void DIALOG_GLOBAL_PADS_EDITION::PadPropertiesAccept( wxCommandEvent& event )
void DIALOG_PUSH_PAD_PROPERTIES::PadPropertiesAccept( wxCommandEvent& event )
{
int returncode = 0;
switch( event.GetId() )
{
case ID_CHANGE_ID_MODULES:
case wxID_APPLY:
returncode = 1;
// Fall through
case ID_CHANGE_CURRENT_MODULE:
case wxID_OK:
m_Pad_Shape_Filter = m_Pad_Shape_Filter_CB->GetValue();
m_Pad_Layer_Filter = m_Pad_Layer_Filter_CB->GetValue();
m_Pad_Orient_Filter = m_Pad_Orient_Filter_CB->GetValue();

View File

@ -24,19 +24,18 @@
#ifndef __DIALOG_GLOBAL_PADS_EDITION_H
#define __DIALOG_GLOBAL_PADS_EDITION_H
#include <dialog_global_pads_edition_base.h>
#include <dialog_push_pad_properties_base.h>
class D_PAD;
class PCB_BASE_FRAME;
/************************************/
/* class DIALOG_GLOBAL_PADS_EDITION */
/* class DIALOG_PUSH_PAD_PROPERTIES */
/************************************/
class DIALOG_GLOBAL_PADS_EDITION : public DIALOG_GLOBAL_PADS_EDITION_BASE
class DIALOG_PUSH_PAD_PROPERTIES : public DIALOG_PUSH_PAD_PROPERTIES_BASE
{
private:
PCB_BASE_FRAME* m_parent;
D_PAD* m_currentPad;
public:
static bool m_Pad_Shape_Filter;
@ -44,12 +43,10 @@ public:
static bool m_Pad_Orient_Filter;
public:
DIALOG_GLOBAL_PADS_EDITION( PCB_BASE_FRAME* aParent, D_PAD* aPad );
DIALOG_PUSH_PAD_PROPERTIES( PCB_BASE_FRAME* aParent );
private:
void InstallPadEditor( wxCommandEvent& event ) override;
void PadPropertiesAccept( wxCommandEvent& event ) override;
void OnCancelClick( wxCommandEvent& event ) override;
};

View File

@ -0,0 +1,67 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Dec 30 2017)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#include "dialog_push_pad_properties_base.h"
///////////////////////////////////////////////////////////////////////////
DIALOG_PUSH_PAD_PROPERTIES_BASE::DIALOG_PUSH_PAD_PROPERTIES_BASE( wxWindow* parent, wxWindowID id, const wxString& title, const wxPoint& pos, const wxSize& size, long style ) : DIALOG_SHIM( parent, id, title, pos, size, style )
{
this->SetSizeHints( wxDefaultSize, wxDefaultSize );
wxBoxSizer* bMainSizer;
bMainSizer = new wxBoxSizer( wxVERTICAL );
wxBoxSizer* bLeftSizer;
bLeftSizer = new wxBoxSizer( wxVERTICAL );
wxStaticBoxSizer* sbSizer1;
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Options") ), wxVERTICAL );
m_Pad_Shape_Filter_CB = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Do not modify pads having a different shape"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer1->Add( m_Pad_Shape_Filter_CB, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
m_Pad_Layer_Filter_CB = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Do not modify pads having different layers"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer1->Add( m_Pad_Layer_Filter_CB, 0, wxALL, 5 );
m_Pad_Orient_Filter_CB = new wxCheckBox( sbSizer1->GetStaticBox(), wxID_ANY, _("Do not modify pads having a different orientation"), wxDefaultPosition, wxDefaultSize, 0 );
sbSizer1->Add( m_Pad_Orient_Filter_CB, 0, wxALL, 5 );
bLeftSizer->Add( sbSizer1, 1, wxEXPAND|wxTOP|wxRIGHT|wxLEFT, 5 );
bMainSizer->Add( bLeftSizer, 1, wxALL|wxEXPAND, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Apply = new wxButton( this, wxID_APPLY );
m_sdbSizer1->AddButton( m_sdbSizer1Apply );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
bMainSizer->Add( m_sdbSizer1, 0, wxALL|wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
bMainSizer->Fit( this );
// Connect Events
m_sdbSizer1Apply->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PUSH_PAD_PROPERTIES_BASE::PadPropertiesAccept ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PUSH_PAD_PROPERTIES_BASE::PadPropertiesAccept ), NULL, this );
}
DIALOG_PUSH_PAD_PROPERTIES_BASE::~DIALOG_PUSH_PAD_PROPERTIES_BASE()
{
// Disconnect Events
m_sdbSizer1Apply->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PUSH_PAD_PROPERTIES_BASE::PadPropertiesAccept ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_PUSH_PAD_PROPERTIES_BASE::PadPropertiesAccept ), NULL, this );
}

View File

@ -11,11 +11,11 @@
<property name="embedded_files_path">res</property>
<property name="encoding">UTF-8</property>
<property name="event_generation">connect</property>
<property name="file">dialog_global_pads_edition_base</property>
<property name="file">dialog_push_pad_properties_base</property>
<property name="first_id">1000</property>
<property name="help_provider">none</property>
<property name="internationalize">1</property>
<property name="name">dialog_global_pads_edition</property>
<property name="name">dialog_push_pad_properties</property>
<property name="namespace"></property>
<property name="path">.</property>
<property name="precompiled_header"></property>
@ -42,7 +42,7 @@
<property name="id">wxID_ANY</property>
<property name="maximum_size"></property>
<property name="minimum_size"></property>
<property name="name">DIALOG_GLOBAL_PADS_EDITION_BASE</property>
<property name="name">DIALOG_PUSH_PAD_PROPERTIES_BASE</property>
<property name="pos"></property>
<property name="size">-1,-1</property>
<property name="style">wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER</property>
@ -91,11 +91,11 @@
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bMainSizer</property>
<property name="orient">wxHORIZONTAL</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
@ -104,11 +104,11 @@
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="flag">wxEXPAND|wxTOP|wxRIGHT|wxLEFT</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Pad Filter :</property>
<property name="label">Options</property>
<property name="minimum_size"></property>
<property name="name">sbSizer1</property>
<property name="orient">wxVERTICAL</property>
@ -117,7 +117,7 @@
<event name="OnUpdateUI"></event>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<property name="BottomDockable">1</property>
@ -387,373 +387,26 @@
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<object class="wxStdDialogButtonSizer" expanded="1">
<property name="Apply">1</property>
<property name="Cancel">1</property>
<property name="ContextHelp">0</property>
<property name="Help">0</property>
<property name="No">0</property>
<property name="OK">1</property>
<property name="Save">0</property>
<property name="Yes">0</property>
<property name="minimum_size"></property>
<property name="name">bRightSizer</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">ID_CHANGE_GET_PAD_SETTINGS</property>
<property name="label">Pad Properties...</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonPadEditor</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">InstallPadEditor</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag"></property>
<property name="proportion">0</property>
<object class="spacer" expanded="1">
<property name="height">10</property>
<property name="permission">protected</property>
<property name="width">10</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">ID_CHANGE_CURRENT_MODULE</property>
<property name="label">Change Pads on Footprint</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonChangeModule</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">PadPropertiesAccept</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">ID_CHANGE_ID_MODULES</property>
<property name="label">Change Pads on Identical Footprints</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonIdModules</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">public</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">PadPropertiesAccept</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxALL|wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxButton" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
<property name="TopDockable">1</property>
<property name="aui_layer"></property>
<property name="aui_name"></property>
<property name="aui_position"></property>
<property name="aui_row"></property>
<property name="best_size"></property>
<property name="bg"></property>
<property name="caption"></property>
<property name="caption_visible">1</property>
<property name="center_pane">0</property>
<property name="close_button">1</property>
<property name="context_help"></property>
<property name="context_menu">1</property>
<property name="default">0</property>
<property name="default_pane">0</property>
<property name="dock">Dock</property>
<property name="dock_fixed">0</property>
<property name="docking">Left</property>
<property name="enabled">1</property>
<property name="fg"></property>
<property name="floatable">1</property>
<property name="font"></property>
<property name="gripper">0</property>
<property name="hidden">0</property>
<property name="id">wxID_CANCEL</property>
<property name="label">Cancel</property>
<property name="max_size"></property>
<property name="maximize_button">0</property>
<property name="maximum_size"></property>
<property name="min_size"></property>
<property name="minimize_button">0</property>
<property name="minimum_size"></property>
<property name="moveable">1</property>
<property name="name">m_buttonCancel</property>
<property name="pane_border">1</property>
<property name="pane_position"></property>
<property name="pane_size"></property>
<property name="permission">protected</property>
<property name="pin_button">1</property>
<property name="pos"></property>
<property name="resize">Resizable</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass"></property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="validator_data_type"></property>
<property name="validator_style">wxFILTER_NONE</property>
<property name="validator_type">wxDefaultValidator</property>
<property name="validator_variable"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<event name="OnButtonClick">OnCancelClick</event>
<event name="OnChar"></event>
<event name="OnEnterWindow"></event>
<event name="OnEraseBackground"></event>
<event name="OnKeyDown"></event>
<event name="OnKeyUp"></event>
<event name="OnKillFocus"></event>
<event name="OnLeaveWindow"></event>
<event name="OnLeftDClick"></event>
<event name="OnLeftDown"></event>
<event name="OnLeftUp"></event>
<event name="OnMiddleDClick"></event>
<event name="OnMiddleDown"></event>
<event name="OnMiddleUp"></event>
<event name="OnMotion"></event>
<event name="OnMouseEvents"></event>
<event name="OnMouseWheel"></event>
<event name="OnPaint"></event>
<event name="OnRightDClick"></event>
<event name="OnRightDown"></event>
<event name="OnRightUp"></event>
<event name="OnSetFocus"></event>
<event name="OnSize"></event>
<event name="OnUpdateUI"></event>
</object>
</object>
<property name="name">m_sdbSizer1</property>
<property name="permission">protected</property>
<event name="OnApplyButtonClick">PadPropertiesAccept</event>
<event name="OnCancelButtonClick"></event>
<event name="OnContextHelpButtonClick"></event>
<event name="OnHelpButtonClick"></event>
<event name="OnNoButtonClick"></event>
<event name="OnOKButtonClick">PadPropertiesAccept</event>
<event name="OnSaveButtonClick"></event>
<event name="OnYesButtonClick"></event>
</object>
</object>
</object>

View File

@ -5,8 +5,8 @@
// PLEASE DO *NOT* EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_GLOBAL_PADS_EDITION_BASE_H__
#define __DIALOG_GLOBAL_PADS_EDITION_BASE_H__
#ifndef __DIALOG_PUSH_PAD_PROPERTIES_BASE_H__
#define __DIALOG_PUSH_PAD_PROPERTIES_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
@ -25,14 +25,11 @@
///////////////////////////////////////////////////////////////////////////
#define ID_CHANGE_GET_PAD_SETTINGS 1000
#define ID_CHANGE_CURRENT_MODULE 1001
#define ID_CHANGE_ID_MODULES 1002
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GLOBAL_PADS_EDITION_BASE
/// Class DIALOG_PUSH_PAD_PROPERTIES_BASE
///////////////////////////////////////////////////////////////////////////////
class DIALOG_GLOBAL_PADS_EDITION_BASE : public DIALOG_SHIM
class DIALOG_PUSH_PAD_PROPERTIES_BASE : public DIALOG_SHIM
{
private:
@ -40,22 +37,20 @@ class DIALOG_GLOBAL_PADS_EDITION_BASE : public DIALOG_SHIM
wxCheckBox* m_Pad_Shape_Filter_CB;
wxCheckBox* m_Pad_Layer_Filter_CB;
wxCheckBox* m_Pad_Orient_Filter_CB;
wxButton* m_buttonPadEditor;
wxButton* m_buttonChangeModule;
wxButton* m_buttonCancel;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Apply;
wxButton* m_sdbSizer1Cancel;
// Virtual event handlers, overide them in your derived class
virtual void InstallPadEditor( wxCommandEvent& event ) { event.Skip(); }
virtual void PadPropertiesAccept( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
public:
wxButton* m_buttonIdModules;
DIALOG_GLOBAL_PADS_EDITION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Push Pad Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GLOBAL_PADS_EDITION_BASE();
DIALOG_PUSH_PAD_PROPERTIES_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Push Pad Properties"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( -1,-1 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_PUSH_PAD_PROPERTIES_BASE();
};
#endif //__DIALOG_GLOBAL_PADS_EDITION_BASE_H__
#endif //__DIALOG_PUSH_PAD_PROPERTIES_BASE_H__

View File

@ -946,7 +946,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
m_canvas->MoveCursorToCrossHair();
DlgGlobalChange_PadSettings( (D_PAD*) GetCurItem(), true );
PushPadProperties((D_PAD*) GetCurItem() );
break;
case ID_POPUP_PCB_COPY_PAD_SETTINGS:

View File

@ -385,7 +385,7 @@ public:
* Options are set by the opened dialog.
* @param aPad is the pattern. The given footprint is the parent of this pad
*/
void DlgGlobalChange_PadSettings( D_PAD* aPad );
void PushPadProperties( D_PAD* aPad );
/**
* Function DeleteModuleFromCurrentLibrary

View File

@ -319,7 +319,7 @@ bool FOOTPRINT_EDIT_FRAME::OnRightClick( const wxPoint& MousePos, wxMenu* PopMen
AddMenuItem( PopMenu, ID_POPUP_PCB_COPY_PAD_SETTINGS,
_( "Copy Pad Properties" ), KiBitmap( copy_pad_settings_xpm ) );
AddMenuItem( PopMenu, ID_POPUP_PCB_APPLY_PAD_SETTINGS,
_( "Apply Pad Properties" ), KiBitmap( apply_pad_settings_xpm ) );
_( "Paste Pad Properties" ), KiBitmap( apply_pad_settings_xpm ) );
msg = AddHotkeyName( _("Delete Pad" ), g_Module_Editor_Hotkeys_Descr, HK_DELETE );
AddMenuItem( PopMenu, ID_POPUP_PCB_DELETE_PAD, msg, KiBitmap( delete_pad_xpm ) );

View File

@ -664,7 +664,7 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
SaveCopyInUndoList( GetBoard()->m_Modules, UR_CHANGED );
// Calls the global change dialog:
DlgGlobalChange_PadSettings( (D_PAD*) GetScreen()->GetCurItem() );
PushPadProperties((D_PAD*) GetScreen()->GetCurItem());
m_canvas->MoveCursorToCrossHair();
break;

View File

@ -1,269 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009-2018 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file globaleditpad.cpp
*/
#include <fctsys.h>
#include <common.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <pcb_edit_frame.h>
#include <footprint_edit_frame.h>
#include <class_board.h>
#include <class_module.h>
#include <pcbnew.h>
#include <dialog_global_pads_edition.h>
/*
* PCB_EDIT_FRAME::Function DlgGlobalChange_PadSettings
* Function to change pad caracteristics for the given footprint
* or alls footprints which look like the given footprint
* Options are set by the opened dialog.
* aPad is the pattern. The given footprint is the parent of this pad
* aRedraw: if true: redraws the footprint
*/
void PCB_EDIT_FRAME::DlgGlobalChange_PadSettings( D_PAD* aPad, bool aRedraw )
{
int diag;
if( aPad == NULL )
aPad = &GetDesignSettings().m_Pad_Master;
MODULE* module = aPad->GetParent();
if( module == NULL )
{
DisplayError( this, wxT( "Global_Import_Pad_Settings() Error: NULL module" ) );
return;
}
SetMsgPanel( module );
{
DIALOG_GLOBAL_PADS_EDITION dlg( this, aPad );
diag = dlg.ShowModal();
}
if( diag == -1 )
return;
bool edit_Same_Modules = false;
if( diag == 1 )
edit_Same_Modules = true;
GlobalChange_PadSettings( aPad,edit_Same_Modules,
DIALOG_GLOBAL_PADS_EDITION::m_Pad_Shape_Filter,
DIALOG_GLOBAL_PADS_EDITION::m_Pad_Orient_Filter,
DIALOG_GLOBAL_PADS_EDITION::m_Pad_Layer_Filter,
aRedraw, true );
}
/*
* FOOTPRINT_EDIT_FRAME::Function DlgGlobalChange_PadSettings
* Function to change pad caracteristics for the given footprint
* or alls footprints which look like the given footprint
* Options are set by the opened dialog.
* aPad is the pattern. The given footprint is the parent of this pad
*/
void FOOTPRINT_EDIT_FRAME::DlgGlobalChange_PadSettings( D_PAD* aPad )
{
int diag;
if( aPad == NULL )
aPad = &GetDesignSettings().m_Pad_Master;
MODULE* module = aPad->GetParent();
if( module == NULL )
{
DisplayError( this, wxT( "Global_Import_Pad_Settings() Error: NULL module" ) );
return;
}
SetMsgPanel( module );
{
DIALOG_GLOBAL_PADS_EDITION dlg( this, aPad );
dlg.m_buttonIdModules->Enable( false );
diag = dlg.ShowModal();
}
if( diag == -1 )
return;
bool edit_Same_Modules = false;
if( diag == 1 )
edit_Same_Modules = true;
GlobalChange_PadSettings( aPad, edit_Same_Modules,
DIALOG_GLOBAL_PADS_EDITION::m_Pad_Shape_Filter,
DIALOG_GLOBAL_PADS_EDITION::m_Pad_Orient_Filter,
DIALOG_GLOBAL_PADS_EDITION::m_Pad_Layer_Filter,
true, false );
}
/*
* Function GlobalChange_PadSettings
* Function to change pad caracteristics for the given footprint
* or alls footprints which look like the given footprint
* aPad is the pattern. The given footprint is the parent of this pad
* aSameFootprints: if true, make changes on all identical footprints
* aPadShapeFilter: if true, make changes only on pads having the same shape as aPad
* aPadOrientFilter: if true, make changes only on pads having the same orientation as aPad
* aPadLayerFilter: if true, make changes only on pads having the same layers as aPad
* aRedraw: if true: redraws the footprint
* aSaveForUndo: if true: create an entry in the Undo/Redo list
* (usually: true in Schematic editor, false in Module editor)
*/
void PCB_BASE_FRAME::GlobalChange_PadSettings( D_PAD* aPad,
bool aSameFootprints,
bool aPadShapeFilter,
bool aPadOrientFilter,
bool aPadLayerFilter,
bool aRedraw, bool aSaveForUndo )
{
if( aPad == NULL )
aPad = &GetDesignSettings().m_Pad_Master;
MODULE* module = aPad->GetParent();
if( module == NULL )
{
DisplayError( this, wxT( "Global_Import_Pad_Settings() Error: NULL module" ) );
return;
}
// Search and copy the name of library reference.
MODULE* Module_Ref = module;
double pad_orient = aPad->GetOrientation() - Module_Ref->GetOrientation();
// Prepare an undo list:
if( aSaveForUndo )
{
PICKED_ITEMS_LIST itemsList;
for( module = m_Pcb->m_Modules; module; module = module->Next() )
{
if( !aSameFootprints && (module != Module_Ref) )
continue;
if( module->GetFPID() != Module_Ref->GetFPID() )
continue;
bool saveMe = false;
for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
{
// Filters changes prohibited.
if( aPadShapeFilter && ( pad->GetShape() != aPad->GetShape() ) )
continue;
double currpad_orient = pad->GetOrientation() - module->GetOrientation();
if( aPadOrientFilter && ( currpad_orient != pad_orient ) )
continue;
if( aPadLayerFilter && pad->GetLayerSet() != aPad->GetLayerSet() )
continue;
// Do not copy a pad into it, it can create issue, and this is useless
if( pad == aPad )
continue;
saveMe = true;
}
if( saveMe )
{
ITEM_PICKER itemWrapper( module, UR_CHANGED );
itemsList.PushItem( itemWrapper );
}
}
SaveCopyInUndoList( itemsList, UR_CHANGED );
}
// Update the current module and same others modules if requested.
for( module = m_Pcb->m_Modules; module; module = module->Next() )
{
if( !aSameFootprints && (module != Module_Ref) )
continue;
if( module->GetFPID() != Module_Ref->GetFPID() )
continue;
// Erase module on screen
if( aRedraw )
{
module->SetFlags( DO_NOT_DRAW );
m_canvas->RefreshDrawingRect( module->GetBoundingBox() );
module->ClearFlags( DO_NOT_DRAW );
}
for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
{
// Filters changes prohibited.
if( aPadShapeFilter && ( pad->GetShape() != aPad->GetShape() ) )
continue;
if( aPadOrientFilter &&
(pad->GetOrientation() - module->GetOrientation()) != pad_orient )
continue;
if( aPadLayerFilter )
{
if( pad->GetLayerSet() != aPad->GetLayerSet() )
continue;
}
// Do not copy a pad into it, it can create issue in custom pads
// and primitive list.
if( pad == aPad )
continue;
// Copy physical characteristics:
pad->ImportSettingsFromMaster( *aPad );
// copy also local mask margins:
pad->SetLocalSolderMaskMargin( aPad->GetLocalSolderMaskMargin() );
pad->SetLocalSolderPasteMargin( aPad->GetLocalSolderPasteMargin() );
pad->SetLocalSolderPasteMarginRatio( aPad->GetLocalSolderPasteMarginRatio() );
}
module->CalculateBoundingBox();
if( aRedraw )
m_canvas->RefreshDrawingRect( module->GetBoundingBox() );
}
OnModify();
}

View File

@ -914,7 +914,7 @@ void PCB_EDIT_FRAME::createPopUpMenuForFpPads( D_PAD* Pad, wxMenu* menu )
wxEmptyString,
KiBitmap( copy_pad_settings_xpm ) );
AddMenuItem( sub_menu_Pad, ID_POPUP_PCB_APPLY_PAD_SETTINGS,
_( "Apply Pad Properties" ),
_( "Paste Pad Properties" ),
wxEmptyString,
KiBitmap( apply_pad_settings_xpm ) );
AddMenuItem( sub_menu_Pad, ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS,

View File

@ -0,0 +1,338 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2018 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#include <fctsys.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <trigo.h>
#include <macros.h>
#include <pcb_base_frame.h>
#include <pcb_edit_frame.h>
#include <footprint_edit_frame.h>
#include <pcbnew.h>
#include <class_board.h>
#include <class_module.h>
#include <class_pad.h>
#include <board_design_settings.h>
#include <dialog_push_pad_properties.h>
/*
* Exports the current pad settings to board design settings.
*/
void PCB_BASE_FRAME::Export_Pad_Settings( D_PAD* aPad )
{
if( aPad == NULL )
return;
SetMsgPanel( aPad );
D_PAD& masterPad = GetDesignSettings().m_Pad_Master;
masterPad.ImportSettingsFromMaster( *aPad );
}
/*
* Imports the board design settings to aPad
* - The position, names, and keys are not modifed.
* The parameters are expected to be correct (i.e. settings are valid)
*/
void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
{
if( aDraw )
{
aPad->SetFlags( DO_NOT_DRAW );
m_canvas->RefreshDrawingRect( aPad->GetBoundingBox() );
aPad->ClearFlags( DO_NOT_DRAW );
}
const D_PAD& mp = GetDesignSettings().m_Pad_Master;
aPad->ImportSettingsFromMaster( mp );
if( aDraw )
m_canvas->RefreshDrawingRect( aPad->GetBoundingBox() );
aPad->GetParent()->SetLastEditTime();
OnModify();
}
/*
* Compute the 'next' pad number for autoincrement
* aPadName is the last pad name used
* */
static wxString GetNextPadName( wxString aPadName )
{
// Automatically increment the current pad number.
int num = 0;
int ponder = 1;
// Trim and extract the trailing numeric part
while( aPadName.Len() && aPadName.Last() >= '0' && aPadName.Last() <= '9' )
{
num += ( aPadName.Last() - '0' ) * ponder;
aPadName.RemoveLast();
ponder *= 10;
}
num++; // Use next number for the new pad
aPadName << num;
return aPadName;
}
/*
* Add a new pad to aModule.
*/
void PCB_BASE_FRAME::AddPad( MODULE* aModule, bool draw )
{
m_Pcb->m_Status_Pcb = 0;
aModule->SetLastEditTime();
D_PAD* pad = new D_PAD( aModule );
// Add the new pad to end of the module pad list.
aModule->PadsList().PushBack( pad );
// Update the pad properties,
// and keep NETINFO_LIST::ORPHANED as net info
// which is the default when nets cannot be handled.
Import_Pad_Settings( pad, false );
pad->SetPosition( GetCrossHairPosition() );
// Set the relative pad position
// ( pad position for module orient, 0, and relative to the module position)
wxPoint pos0 = pad->GetPosition() - aModule->GetPosition();
RotatePoint( &pos0, -aModule->GetOrientation() );
pad->SetPos0( pos0 );
/* NPTH pads take empty pad number (since they can't be connected),
* other pads get incremented from the last one edited */
wxString padName;
if( pad->GetAttribute() != PAD_ATTRIB_HOLE_NOT_PLATED )
padName = GetNextPadName( GetDesignSettings().m_Pad_Master.GetName() );
pad->SetName( padName );
GetDesignSettings().m_Pad_Master.SetName( padName );
aModule->CalculateBoundingBox();
SetMsgPanel( pad );
if( draw )
m_canvas->RefreshDrawingRect( aModule->GetBoundingBox() );
}
void PCB_BASE_FRAME::DeletePad( D_PAD* aPad, bool aQuery )
{
if( aPad == NULL )
return;
MODULE* module = aPad->GetParent();
module->SetLastEditTime();
// aQuery = true to prompt for confirmation, false to delete silently
if( aQuery )
{
wxString msg = wxString::Format( _( "Delete pad (footprint %s %s)?" ),
module->GetReference(),
module->GetValue() );
if( !IsOK( this, msg ) )
return;
}
// Stores the initial bounding box to refresh the old area
EDA_RECT bbox = module->GetBoundingBox();
m_Pcb->m_Status_Pcb = 0;
GetBoard()->PadDelete( aPad );
// Update the bounding box
module->CalculateBoundingBox();
// Refresh the modified screen area, using the initial bounding box
// which is perhaps larger than the new bounding box
m_canvas->RefreshDrawingRect( bbox );
OnModify();
}
/*
* PCB_EDIT_FRAME::Function PushPadProperties
* Function to change pad caracteristics for the given footprint or all identical footprints
* Options are set by the opened dialog.
*/
void PCB_EDIT_FRAME::PushPadProperties( D_PAD* aPad )
{
if( !aPad )
return;
MODULE* module = aPad->GetParent();
if( !module )
return;
SetMsgPanel( module );
DIALOG_PUSH_PAD_PROPERTIES dlg( this );
int retCode = dlg.ShowModal();
if( retCode == wxID_CANCEL )
return;
bool edit_Same_Modules = ( retCode == 1 );
DoPushPadProperties( aPad, edit_Same_Modules,
DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Shape_Filter,
DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Orient_Filter,
DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Layer_Filter,
true );
}
/*
* FOOTPRINT_EDIT_FRAME::Function PushPadProperties
* Function to change pad caracteristics for the footprint.
* Options are set by the opened dialog.
*/
void FOOTPRINT_EDIT_FRAME::PushPadProperties( D_PAD* aPad )
{
if( !aPad )
return;
MODULE* module = aPad->GetParent();
if( !module )
return;
SetMsgPanel( module );
DIALOG_PUSH_PAD_PROPERTIES dlg( this );
int retCode = dlg.ShowModal();
if( retCode == wxID_CANCEL )
return;
bool edit_Same_Modules = ( retCode == 1 );
DoPushPadProperties( aPad, edit_Same_Modules,
DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Shape_Filter,
DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Orient_Filter,
DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Layer_Filter,
false );
}
/*
* Function DoPushPadProperties
* Function to change pad properties for the given footprint or all identical footprints
* aPad is the pattern. The given footprint is the parent of this pad
* aSameFootprints: if true, make changes on all identical footprints
* aPadShapeFilter: if true, make changes only on pads having the same shape as aPad
* aPadOrientFilter: if true, make changes only on pads having the same orientation as aPad
* aPadLayerFilter: if true, make changes only on pads having the same layers as aPad
* aSaveForUndo: if true: create an entry in the Undo/Redo list
* (usually: true in Schematic editor, false in Module editor)
*/
void PCB_BASE_FRAME::DoPushPadProperties( D_PAD* aPad, bool aSameFootprints,
bool aPadShapeFilter,
bool aPadOrientFilter,
bool aPadLayerFilter,
bool aSaveForUndo )
{
MODULE* Module_Ref = aPad->GetParent();
double pad_orient = aPad->GetOrientation() - Module_Ref->GetOrientation();
// Prepare an undo list:
if( aSaveForUndo )
{
PICKED_ITEMS_LIST itemsList;
if( aSameFootprints )
{
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
{
if( module->GetFPID() == Module_Ref->GetFPID() )
{
ITEM_PICKER itemWrapper( module, UR_CHANGED );
itemsList.PushItem( itemWrapper );
}
}
}
else
{
ITEM_PICKER itemWrapper( Module_Ref, UR_CHANGED );
itemsList.PushItem( itemWrapper );
}
SaveCopyInUndoList( itemsList, UR_CHANGED );
}
// Update the current module and same others modules if requested.
for( MODULE* module = m_Pcb->m_Modules; module; module = module->Next() )
{
if( !aSameFootprints && (module != Module_Ref) )
continue;
if( module->GetFPID() != Module_Ref->GetFPID() )
continue;
// Erase module on screen
module->SetFlags( DO_NOT_DRAW );
m_canvas->RefreshDrawingRect( module->GetBoundingBox() );
module->ClearFlags( DO_NOT_DRAW );
for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
{
if( aPadShapeFilter && ( pad->GetShape() != aPad->GetShape() ) )
continue;
double currpad_orient = pad->GetOrientation() - module->GetOrientation();
if( aPadOrientFilter && ( currpad_orient != pad_orient ) )
continue;
if( aPadLayerFilter && ( pad->GetLayerSet() != aPad->GetLayerSet() ) )
continue;
// Do not copy pad to itself, it can create issues with custom pad primitives.
if( pad == aPad )
continue;
pad->ImportSettingsFromMaster( *aPad );
}
module->CalculateBoundingBox();
m_canvas->RefreshDrawingRect( module->GetBoundingBox() );
}
OnModify();
}

View File

@ -1,236 +0,0 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2012 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 2012 SoftPLC Corporation, Dick Hollenbeck <dick@softplc.com>
* Copyright (C) 2011 Wayne Stambaugh <stambaughw@verizon.net>
* Copyright (C) 1992-2011 KiCad Developers, see AUTHORS.txt for contributors.
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
/**
* @file pad_edition_functions.cpp
*/
#include <fctsys.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <trigo.h>
#include <macros.h>
#include <pcb_base_frame.h>
#include <pcbnew.h>
#include <class_board.h>
#include <class_module.h>
#include <class_pad.h>
#include <board_design_settings.h>
/* Exports the current pad settings to board design settings.
*/
void PCB_BASE_FRAME::Export_Pad_Settings( D_PAD* aPad )
{
if( aPad == NULL )
return;
SetMsgPanel( aPad );
D_PAD& masterPad = GetDesignSettings().m_Pad_Master;
masterPad.ImportSettingsFromMaster( *aPad );
}
/* Imports the board design settings to aPad
* - The position, names, and keys are not modifed.
* The parameters are expected to be correct (i.e. settings are valid)
*/
void PCB_BASE_FRAME::Import_Pad_Settings( D_PAD* aPad, bool aDraw )
{
if( aDraw )
{
aPad->SetFlags( DO_NOT_DRAW );
m_canvas->RefreshDrawingRect( aPad->GetBoundingBox() );
aPad->ClearFlags( DO_NOT_DRAW );
}
const D_PAD& mp = GetDesignSettings().m_Pad_Master;
aPad->ImportSettingsFromMaster( mp );
aPad->SetPrimitives( mp.GetPrimitives() );
aPad->SetAnchorPadShape( mp.GetAnchorPadShape() );
aPad->MergePrimitivesAsPolygon();
if( aDraw )
m_canvas->RefreshDrawingRect( aPad->GetBoundingBox() );
aPad->GetParent()->SetLastEditTime();
OnModify();
}
/** Compute the 'next' pad number for autoincrement
* aPadName is the last pad name used */
static wxString GetNextPadName( wxString aPadName )
{
// Automatically increment the current pad number.
int num = 0;
int ponder = 1;
// Trim and extract the trailing numeric part
while( aPadName.Len()
&& aPadName.Last() >= '0'
&& aPadName.Last() <= '9' )
{
num += ( aPadName.Last() - '0' ) * ponder;
aPadName.RemoveLast();
ponder *= 10;
}
num++; // Use next number for the new pad
aPadName << num;
return aPadName;
}
/* Add a new pad to aModule.
*/
void PCB_BASE_FRAME::AddPad( MODULE* aModule, bool draw )
{
m_Pcb->m_Status_Pcb = 0;
aModule->SetLastEditTime();
D_PAD* pad = new D_PAD( aModule );
// Add the new pad to end of the module pad list.
aModule->PadsList().PushBack( pad );
// Update the pad properties,
// and keep NETINFO_LIST::ORPHANED as net info
// which is the default when nets cannot be handled.
Import_Pad_Settings( pad, false );
pad->SetPosition( GetCrossHairPosition() );
// Set the relative pad position
// ( pad position for module orient, 0, and relative to the module position)
wxPoint pos0 = pad->GetPosition() - aModule->GetPosition();
RotatePoint( &pos0, -aModule->GetOrientation() );
pad->SetPos0( pos0 );
/* NPTH pads take empty pad number (since they can't be connected),
* other pads get incremented from the last one edited */
wxString padName;
if( pad->GetAttribute() != PAD_ATTRIB_HOLE_NOT_PLATED )
{
padName = GetNextPadName( GetDesignSettings()
.m_Pad_Master.GetName() );
}
pad->SetName( padName );
GetDesignSettings().m_Pad_Master.SetName( padName );
aModule->CalculateBoundingBox();
SetMsgPanel( pad );
if( draw )
m_canvas->RefreshDrawingRect( aModule->GetBoundingBox() );
}
void PCB_BASE_FRAME::DeletePad( D_PAD* aPad, bool aQuery )
{
if( aPad == NULL )
return;
MODULE* module = aPad->GetParent();
module->SetLastEditTime();
// aQuery = true to prompt for confirmation, false to delete silently
if( aQuery )
{
wxString msg;
msg.Printf( _( "Delete Pad (footprint %s %s) ?" ),
GetChars( module->GetReference() ),
GetChars( module->GetValue() ) );
if( !IsOK( this, msg ) )
return;
}
// Stores the initial bounding box to refresh the old area
EDA_RECT bbox = module->GetBoundingBox();
m_Pcb->m_Status_Pcb = 0;
GetBoard()->PadDelete( aPad );
// Update the bounding box
module->CalculateBoundingBox();
// Refresh the modified screen area, using the initial bounding box
// which is perhaps larger than the new bounding box
m_canvas->RefreshDrawingRect( bbox );
OnModify();
}
// Rotate selected pad 90 degrees.
void PCB_BASE_FRAME::RotatePad( D_PAD* aPad, wxDC* DC )
{
if( aPad == NULL )
return;
MODULE* module = aPad->GetParent();
module->SetLastEditTime();
OnModify();
if( DC )
module->Draw( m_canvas, DC, GR_XOR );
wxSize sz = aPad->GetSize();
std::swap( sz.x, sz.y );
aPad->SetSize( sz );
sz = aPad->GetDrillSize();
std::swap( sz.x, sz.y );
aPad->SetDrillSize( sz );
wxPoint pt = aPad->GetOffset();
std::swap( pt.x, pt.y );
aPad->SetOffset( pt );
aPad->SetOffset( wxPoint( aPad->GetOffset().x, -aPad->GetOffset().y ) );
sz = aPad->GetDelta();
std::swap( sz.x, sz.y );
sz.x = -sz.x;
aPad->SetDelta( sz );
module->CalculateBoundingBox();
SetMsgPanel( aPad );
if( DC )
module->Draw( m_canvas, DC, GR_OR );
}

View File

@ -1094,14 +1094,13 @@ public:
void StartMoveModule( MODULE* aModule, wxDC* aDC, bool aDragConnectedTracks );
/**
* Function DlgGlobalChange_PadSettings
* Function PushPadProperties
* Function to change pad caracteristics for the given footprint
* or all footprints which look like the given footprint
* Options are set by the opened dialog.
* @param aPad is the pattern. The given footprint is the parent of this pad
* @param aRedraw: if true: redraws the footprint
*/
void DlgGlobalChange_PadSettings( D_PAD* aPad, bool aRedraw );
void PushPadProperties( D_PAD* aPad );
/**
* Function Delete Module

View File

@ -35,10 +35,7 @@
#include <class_module.h>
#include <board_commit.h>
#include <dialogs/dialog_global_pads_edition.h>
#include <utility>
#include <dialogs/dialog_push_pad_properties.h>
#include "pcb_actions.h"
#include "selection_tool.h"
#include "pcb_selection_conditions.h"
@ -48,19 +45,19 @@
TOOL_ACTION PCB_ACTIONS::copyPadSettings(
"pcbnew.PadTool.CopyPadSettings",
AS_GLOBAL, 0,
_( "Copy Pad Properties" ), _( "Copy current pad's properties to the default pad properties" ),
_( "Copy Pad Properties" ), _( "Copy current pad's properties" ),
copy_pad_settings_xpm );
TOOL_ACTION PCB_ACTIONS::applyPadSettings(
"pcbnew.PadTool.ApplyPadSettings",
AS_GLOBAL, 0,
_( "Apply Pad Properties" ), _( "Copy the default pad properties to the current pad" ),
_( "Paste Pad Properties" ), _( "Replace the current pad's properties with those copied earlier" ),
apply_pad_settings_xpm );
TOOL_ACTION PCB_ACTIONS::pushPadSettings(
"pcbnew.PadTool.PushPadSettings",
AS_GLOBAL, 0,
_( "Push Pad Properties..." ), _( "Copy the current pad settings to other pads" ),
_( "Push Pad Properties..." ), _( "Copy the current pad's properties to other pads" ),
push_pad_settings_xpm );
@ -70,8 +67,7 @@ public:
using SHOW_FUNCTOR = std::function<bool()>;
PAD_CONTEXT_MENU( bool aEditingFootprint,
SHOW_FUNCTOR aHaveGlobalPadSetting ):
PAD_CONTEXT_MENU( bool aEditingFootprint, SHOW_FUNCTOR aHaveGlobalPadSetting ):
m_editingFootprint( aEditingFootprint ),
m_haveGlobalPadSettings( std::move( aHaveGlobalPadSetting ) )
{
@ -82,12 +78,10 @@ public:
Add( PCB_ACTIONS::applyPadSettings );
Add( PCB_ACTIONS::pushPadSettings );
// show modedit-specific items
if( m_editingFootprint )
{
AppendSeparator();
Add( PCB_ACTIONS::enumeratePads );
}
}
@ -148,9 +142,9 @@ private:
PAD_TOOL::PAD_TOOL() :
PCB_TOOL( "pcbnew.PadTool" ), m_padCopied( false )
{
}
PCB_TOOL( "pcbnew.PadTool" ),
m_padCopied( false )
{}
PAD_TOOL::~PAD_TOOL()
@ -173,7 +167,7 @@ bool PAD_TOOL::haveFootprints()
bool PAD_TOOL::Init()
{
auto contextMenu = std::make_shared<PAD_CONTEXT_MENU>( EditingModules(),
[this]() { return m_padCopied; } );
[this]() { return m_padCopied; } );
contextMenu->SetTool( this );
SELECTION_TOOL* selTool = m_toolMgr->GetTool<SELECTION_TOOL>();
@ -208,30 +202,26 @@ bool PAD_TOOL::Init()
}
int PAD_TOOL::applyPadSettings( const TOOL_EVENT& aEvent )
int PAD_TOOL::pastePadProperties( const TOOL_EVENT& aEvent )
{
auto& selTool = *m_toolMgr->GetTool<SELECTION_TOOL>();
const auto& selection = selTool.GetSelection();
auto& frame = *getEditFrame<PCB_EDIT_FRAME>();
const D_PAD& masterPad = frame.GetDesignSettings().m_Pad_Master;
BOARD_COMMIT commit( &frame );
// for every selected pad, copy global settings
// for every selected pad, paste global settings
for( auto item : selection )
{
if( item->Type() == PCB_PAD_T )
{
commit.Modify( item );
D_PAD& destPad = static_cast<D_PAD&>( *item );
destPad.ImportSettingsFromMaster( masterPad );
static_cast<D_PAD&>( *item ).ImportSettingsFromMaster( masterPad );
}
}
commit.Push( _( "Apply Pad Properties" ) );
commit.Push( _( "Paste Pad Properties" ) );
m_toolMgr->RunAction( PCB_ACTIONS::selectionModified, true );
frame.Refresh();
@ -266,24 +256,14 @@ int PAD_TOOL::copyPadSettings( const TOOL_EVENT& aEvent )
}
static void globalChangePadSettings( BOARD& board,
const D_PAD& aSrcPad,
BOARD_COMMIT& commit,
bool aSameFootprints,
bool aPadShapeFilter,
bool aPadOrientFilter,
bool aPadLayerFilter )
static void doPushPadProperties( BOARD& board, const D_PAD& aSrcPad, BOARD_COMMIT& commit,
bool aSameFootprints,
bool aPadShapeFilter,
bool aPadOrientFilter,
bool aPadLayerFilter )
{
const MODULE* moduleRef = aSrcPad.GetParent();
// If there is no module, we can't make the comparisons to see which
// pads to apply the source pad settings to
if( moduleRef == nullptr )
{
wxLogDebug( "globalChangePadSettings() Error: NULL module" );
return;
}
double pad_orient = aSrcPad.GetOrientation() - moduleRef->GetOrientation();
for( const MODULE* module = board.m_Modules; module; module = module->Next() )
@ -296,7 +276,6 @@ static void globalChangePadSettings( BOARD& board,
for( D_PAD* pad = module->PadsList(); pad; pad = pad->Next() )
{
// Filters changes prohibited.
if( aPadShapeFilter && ( pad->GetShape() != aSrcPad.GetShape() ) )
continue;
@ -322,69 +301,39 @@ static void globalChangePadSettings( BOARD& board,
int PAD_TOOL::pushPadSettings( const TOOL_EVENT& aEvent )
{
auto& selTool = *m_toolMgr->GetTool<SELECTION_TOOL>();
auto& selTool = *m_toolMgr->GetTool<SELECTION_TOOL>();
const auto& selection = selTool.GetSelection();
auto& frame = *getEditFrame<PCB_EDIT_FRAME>();
D_PAD* srcPad;
auto& frame = *getEditFrame<PCB_EDIT_FRAME>();
// not const - can be changed in the dialog
D_PAD* srcPad = nullptr;
// If nothing selected, use the master pad setting,
// otherwise, if one pad selected, use the selected pad
if( selection.Size() == 0 )
{
srcPad = &frame.GetDesignSettings().m_Pad_Master;
}
else if( selection.Size() == 1 )
{
if( selection[0]->Type() == PCB_PAD_T )
{
srcPad = static_cast<D_PAD*>( selection[0] );
}
}
if( selection.Size() == 1 && selection[0]->Type() == PCB_PAD_T )
srcPad = static_cast<D_PAD*>( selection[0] );
else
{
// multiple selected what to do?
// maybe master->selection? same as apply multiple?
}
// no valid selection, nothing to do
if( !srcPad )
{
return 0;
}
MODULE* module = srcPad->GetParent();
if( module != nullptr )
{
frame.SetMsgPanel( module );
}
int dialogRet;
{
DIALOG_GLOBAL_PADS_EDITION dlg( &frame, srcPad );
dialogRet = dlg.ShowModal();
}
// cancel
if( dialogRet == -1 )
{
if( !module )
return 0;
frame.SetMsgPanel( module );
DIALOG_PUSH_PAD_PROPERTIES dlg( &frame );
int dialogRet = dlg.ShowModal();
if( dialogRet == wxID_CANCEL )
return 0;
}
const bool edit_Same_Modules = (dialogRet == 1);
BOARD_COMMIT commit( &frame );
globalChangePadSettings( *getModel<BOARD>(), *srcPad, commit,
edit_Same_Modules,
DIALOG_GLOBAL_PADS_EDITION::m_Pad_Shape_Filter,
DIALOG_GLOBAL_PADS_EDITION::m_Pad_Orient_Filter,
DIALOG_GLOBAL_PADS_EDITION::m_Pad_Layer_Filter );
doPushPadProperties( *getModel<BOARD>(), *srcPad, commit, edit_Same_Modules,
DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Shape_Filter,
DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Orient_Filter,
DIALOG_PUSH_PAD_PROPERTIES::m_Pad_Layer_Filter );
commit.Push( _( "Apply Pad Properties" ) );
commit.Push( _( "Paste Pad Properties" ) );
m_toolMgr->RunAction( PCB_ACTIONS::selectionModified, true );
frame.Refresh();
@ -395,7 +344,7 @@ int PAD_TOOL::pushPadSettings( const TOOL_EVENT& aEvent )
void PAD_TOOL::setTransitions()
{
Go( &PAD_TOOL::applyPadSettings, PCB_ACTIONS::applyPadSettings.MakeEvent() );
Go( &PAD_TOOL::pastePadProperties, PCB_ACTIONS::applyPadSettings.MakeEvent() );
Go( &PAD_TOOL::copyPadSettings, PCB_ACTIONS::copyPadSettings.MakeEvent() );
Go( &PAD_TOOL::pushPadSettings, PCB_ACTIONS::pushPadSettings.MakeEvent() );
}

View File

@ -54,7 +54,7 @@ private:
bool haveFootprints();
///> Apply pad settings from board design settings to a pad
int applyPadSettings( const TOOL_EVENT& aEvent );
int pastePadProperties( const TOOL_EVENT& aEvent );
///> Copy pad settings from a pad to the board design settings
int copyPadSettings( const TOOL_EVENT& aEvent );