Commit 5916688f authored by jean-pierre charras's avatar jean-pierre charras

Pcbnew: Fix error message in Module Editor after a global pad change.

Minor other enhancements and code cleaning.
parent 8985a180
This diff is collapsed.
This diff is collapsed.
......@@ -325,7 +325,26 @@ public:
void PlacePad( D_PAD* Pad, wxDC* DC );
void Export_Pad_Settings( D_PAD* aPad );
void Import_Pad_Settings( D_PAD* aPad, bool aDraw );
void Global_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
* @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 );
// loading footprints
......
......@@ -877,6 +877,16 @@ public:
void InstallModuleOptionsFrame( MODULE* Module, wxDC* DC );
void StartMove_Module( MODULE* module, wxDC* DC );
/**
* Function DlgGlobalChange_PadSettings
* 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 );
/**
* Function Delete Module
* Remove a footprint from m_Modules linked list and put it in undelete buffer
......
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// 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 ) : wxDialog( 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( this, 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( this, 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( this, 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, 5 );
bMainSizer->Add( bLeftSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
m_buttonPadEditor = new wxButton( this, ID_CHANGE_GET_PAD_SETTINGS, _("Pad Editor"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_buttonPadEditor, 0, wxALL|wxEXPAND, 5 );
bRightSizer->Add( 10, 10, 0, 0, 5 );
m_button2 = new wxButton( this, ID_CHANGE_CURRENT_MODULE, _("Change Pads on Module"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_button2, 0, wxALL|wxEXPAND, 5 );
m_button3 = new wxButton( this, ID_CHANGE_ID_MODULES, _("Change Pads on Same Modules"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_button3, 0, wxALL|wxEXPAND, 5 );
m_button4 = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_button4, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bRightSizer, 0, wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// Connect Events
m_buttonPadEditor->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_PADS_EDITION_BASE::InstallPadEditor ), NULL, this );
m_button2->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_PADS_EDITION_BASE::PadPropertiesAccept ), NULL, this );
m_button3->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_PADS_EDITION_BASE::PadPropertiesAccept ), NULL, this );
m_button4->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_button2->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_PADS_EDITION_BASE::PadPropertiesAccept ), NULL, this );
m_button3->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_PADS_EDITION_BASE::PadPropertiesAccept ), NULL, this );
m_button4->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_PADS_EDITION_BASE::OnCancelClick ), NULL, this );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// 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 ) : wxDialog( 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( this, 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( this, 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( this, 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, 5 );
bMainSizer->Add( bLeftSizer, 1, wxEXPAND, 5 );
wxBoxSizer* bRightSizer;
bRightSizer = new wxBoxSizer( wxVERTICAL );
m_buttonPadEditor = new wxButton( this, ID_CHANGE_GET_PAD_SETTINGS, _("Pad Editor"), 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 Module"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_buttonChangeModule, 0, wxALL|wxEXPAND, 5 );
m_buttonIdModules = new wxButton( this, ID_CHANGE_ID_MODULES, _("Change Pads on Same Modules"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_buttonIdModules, 0, wxALL|wxEXPAND, 5 );
m_buttonCancel = new wxButton( this, wxID_ANY, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_buttonCancel, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bRightSizer, 0, wxEXPAND, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// 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 );
}
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_global_pads_edition_base__
#define __dialog_global_pads_edition_base__
#include <wx/string.h>
#include <wx/checkbox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#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_GLOBAL_PADS_EDITION_BASE : public wxDialog
{
private:
protected:
wxCheckBox* m_Pad_Shape_Filter_CB;
wxCheckBox* m_Pad_Layer_Filter_CB;
wxCheckBox* m_Pad_Orient_Filter_CB;
wxButton* m_buttonPadEditor;
wxButton* m_button2;
wxButton* m_button3;
wxButton* m_button4;
// 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:
DIALOG_GLOBAL_PADS_EDITION_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _( "Global Pads Edition" ), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 482,165 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GLOBAL_PADS_EDITION_BASE();
};
#endif //__dialog_global_pads_edition_base__
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
///////////////////////////////////////////////////////////////////////////
#ifndef __DIALOG_GLOBAL_PADS_EDITION_BASE_H__
#define __DIALOG_GLOBAL_PADS_EDITION_BASE_H__
#include <wx/artprov.h>
#include <wx/xrc/xmlres.h>
#include <wx/intl.h>
#include <wx/string.h>
#include <wx/checkbox.h>
#include <wx/gdicmn.h>
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/sizer.h>
#include <wx/statbox.h>
#include <wx/button.h>
#include <wx/dialog.h>
///////////////////////////////////////////////////////////////////////////
#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_GLOBAL_PADS_EDITION_BASE : public wxDialog
{
private:
protected:
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;
// 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 = _("Global Pads Edition"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 482,165 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GLOBAL_PADS_EDITION_BASE();
};
#endif //__DIALOG_GLOBAL_PADS_EDITION_BASE_H__
......@@ -813,7 +813,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
m_canvas->MoveCursorToCrossHair();
Global_Import_Pad_Settings( (D_PAD*) GetCurItem(), true );
DlgGlobalChange_PadSettings( (D_PAD*) GetCurItem(), true );
break;
case ID_POPUP_PCB_EXPORT_PAD_SETTINGS:
......
......@@ -6,8 +6,9 @@
#include "common.h"
#include "class_drawpanel.h"
#include "confirm.h"
#include "wxBasePcbFrame.h"
#include "wxPcbStruct.h"
#include "pcbcommon.h"
#include "module_editor_frame.h"
#include "class_board.h"
#include "class_module.h"
......@@ -105,24 +106,22 @@ void DIALOG_GLOBAL_PADS_EDITION::PadPropertiesAccept( wxCommandEvent& event )
}
/**
* Function Global_Import_Pad_Settings
/*
* PCB_EDIT_FRAME::Function DlgGlobalChange_PadSettings
* Function to change pad caracteristics for the given footprint
* or alls footprints which look like the given footprint
* @param aPad pad to use as pattern. The given footprint is the parent of
* this pad
* @param aDraw: if true: redraws the 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_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
void PCB_EDIT_FRAME::DlgGlobalChange_PadSettings( D_PAD* aPad, bool aRedraw )
{
MODULE* Module_Ref, * Module;
int diag;
bool edit_Same_Modules = false;
if( aPad == NULL )
aPad = &g_Pad_Master;
Module = (MODULE*) aPad->GetParent();
MODULE* Module = (MODULE*) aPad->GetParent();
if( Module == NULL )
{
......@@ -140,88 +139,172 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
if( diag == -1 )
return;
bool edit_Same_Modules = false;
if( diag == 1 )
edit_Same_Modules = true;
/* Search and copy the name of library reference. */
Module_Ref = Module;
int pad_orient = aPad->m_Orient - Module_Ref->m_Orient;
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 );
}
// Prepare an undo list:
PICKED_ITEMS_LIST itemsList;
Module = (MODULE*) m_Pcb->m_Modules;
for( ; Module != NULL; Module = Module->Next() )
/*
* 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 = &g_Pad_Master;
MODULE* Module = (MODULE*) aPad->GetParent();
if( Module == NULL )
{
if( !edit_Same_Modules && (Module != Module_Ref) )
continue;
DisplayError( this, wxT( "Global_Import_Pad_Settings() Error: NULL module" ) );
return;
}
if( Module->m_LibRef != Module_Ref->m_LibRef )
continue;
Module->DisplayInfo( this );
bool saveMe = false;
D_PAD* pt_pad = (D_PAD*) Module->m_Pads;
DIALOG_GLOBAL_PADS_EDITION* dlg = new DIALOG_GLOBAL_PADS_EDITION( this, aPad );
dlg->m_buttonIdModules->Enable( false );
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
diag = dlg->ShowModal();
dlg->Destroy();
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 = &g_Pad_Master;
MODULE* 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;
int pad_orient = aPad->m_Orient - Module_Ref->m_Orient;
// Prepare an undo list:
if( aSaveForUndo )
{
PICKED_ITEMS_LIST itemsList;
Module = (MODULE*) m_Pcb->m_Modules;
for( ; Module != NULL; Module = Module->Next() )
{
/* Filters changes prohibited. */
if( DIALOG_GLOBAL_PADS_EDITION::m_Pad_Shape_Filter
&& ( pt_pad->m_PadShape != aPad->m_PadShape ) )
if( !aSameFootprints && (Module != Module_Ref) )
continue;
if( DIALOG_GLOBAL_PADS_EDITION::m_Pad_Orient_Filter
&& ( (pt_pad->m_Orient - Module->m_Orient) != pad_orient ) )
if( Module->m_LibRef != Module_Ref->m_LibRef )
continue;
if( DIALOG_GLOBAL_PADS_EDITION::m_Pad_Layer_Filter
&& ( pt_pad->m_layerMask != aPad->m_layerMask ) )
continue;
bool saveMe = false;
D_PAD* pt_pad = (D_PAD*) Module->m_Pads;
saveMe = true;
}
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
{
/* Filters changes prohibited. */
if( aPadShapeFilter && ( pt_pad->m_PadShape != aPad->m_PadShape ) )
continue;
if( saveMe )
{
ITEM_PICKER itemWrapper( Module, UR_CHANGED );
itemWrapper.m_PickedItemType = Module->Type();
itemsList.PushItem( itemWrapper );
int currpad_orient = pt_pad->m_Orient - Module->m_Orient;
if( aPadOrientFilter && ( currpad_orient != pad_orient ) )
continue;
if( aPadLayerFilter
&& ( pt_pad->m_layerMask != aPad->m_layerMask ) )
continue;
saveMe = true;
}
if( saveMe )
{
ITEM_PICKER itemWrapper( Module, UR_CHANGED );
itemWrapper.m_PickedItemType = Module->Type();
itemsList.PushItem( itemWrapper );
}
}
}
SaveCopyInUndoList( itemsList, UR_CHANGED );
SaveCopyInUndoList( itemsList, UR_CHANGED );
}
/* Update the current module and same others modules if requested. */
Module = (MODULE*) m_Pcb->m_Modules;
Module = m_Pcb->m_Modules;
for( ; Module != NULL; Module = Module->Next() )
{
if( !edit_Same_Modules && (Module != Module_Ref) )
if( !aSameFootprints && (Module != Module_Ref) )
continue;
if( Module->m_LibRef != Module_Ref->m_LibRef )
continue;
/* Erase module on screen */
if( aDraw )
if( aRedraw )
{
Module->SetFlags( DO_NOT_DRAW );
m_canvas->RefreshDrawingRect( Module->GetBoundingBox() );
Module->ClearFlags( DO_NOT_DRAW );
}
D_PAD* pt_pad = (D_PAD*) Module->m_Pads;
D_PAD* pt_pad = Module->m_Pads;
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
{
/* Filters changes prohibited. */
if( DIALOG_GLOBAL_PADS_EDITION::m_Pad_Shape_Filter
&& ( pt_pad->m_PadShape != aPad->m_PadShape ) )
// Filters changes prohibited.
if( aPadShapeFilter && ( pt_pad->m_PadShape != aPad->m_PadShape ) )
continue;
if( DIALOG_GLOBAL_PADS_EDITION::m_Pad_Orient_Filter
if( aPadOrientFilter
&& ( (pt_pad->m_Orient - Module->m_Orient) != pad_orient ) )
continue;
if( DIALOG_GLOBAL_PADS_EDITION::m_Pad_Layer_Filter )
if( aPadLayerFilter )
{
if( pt_pad->m_layerMask != aPad->m_layerMask )
continue;
......@@ -229,7 +312,7 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
m_Pcb->m_Status_Pcb &= ~( LISTE_RATSNEST_ITEM_OK | CONNEXION_OK);
}
/* Change characteristics.: */
// Change characteristics:
pt_pad->m_Attribut = aPad->m_Attribut;
pt_pad->m_PadShape = aPad->m_PadShape;
......@@ -278,7 +361,7 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
Module->CalculateBoundingBox();
if( aDraw )
if( aRedraw )
m_canvas->RefreshDrawingRect( Module->GetBoundingBox() );
}
......
......@@ -512,7 +512,8 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT );
Global_Import_Pad_Settings( (D_PAD*) GetScreen()->GetCurItem(), true );
// Calls the global change dialog:
DlgGlobalChange_PadSettings( (D_PAD*) GetScreen()->GetCurItem() );
m_canvas->MoveCursorToCrossHair();
break;
......
......@@ -334,6 +334,15 @@ public:
/* Function to place a graphic item type EDGE_MODULE currently moved */
void Place_EdgeMod( EDGE_MODULE* drawitem );
/**
* Function DlgGlobalChange_PadSettings
* 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
*/
void DlgGlobalChange_PadSettings( D_PAD* aPad );
// handlers for libraries:
void Delete_Module_In_Library( const wxString& libname );
......
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