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.
...@@ -214,19 +214,24 @@ static void InitKiCadAboutNew( AboutAppInfo& info ) ...@@ -214,19 +214,24 @@ static void InitKiCadAboutNew( AboutAppInfo& info )
info.AddDeveloper( new Contributor( wxT( "KBool Library" ), info.AddDeveloper( new Contributor( wxT( "KBool Library" ),
wxT( "http://boolean.klaasholwerda.nl/bool.html" ) ) ); wxT( "http://boolean.klaasholwerda.nl/bool.html" ) ) );
info.AddDeveloper( new Contributor( wxT( "Lorenzo Marcantonio" ), wxT( "lomarcan@tin.it" ) ) ); info.AddDeveloper( new Contributor( wxT( "Lorenzo Marcantonio" ), wxT( "lomarcan@tin.it" ) ) );
info.AddDeveloper( new Contributor( wxT( "Marco Serantoni" ), wxT( "marco.serantoni@gmail.com" ) ) ); info.AddDeveloper( new Contributor( wxT( "Marco Serantoni" ),
wxT( "marco.serantoni@gmail.com" ) ) );
info.AddDeveloper( new Contributor( wxT( "Marco Mattila" ), wxT( "marcom99@gmail.com" ) ) ); info.AddDeveloper( new Contributor( wxT( "Marco Mattila" ), wxT( "marcom99@gmail.com" ) ) );
info.AddDeveloper( new Contributor( wxT( "Rafael Sokolowski" ), info.AddDeveloper( new Contributor( wxT( "Rafael Sokolowski" ),
wxT( "rafael.sokolowski@web.de" ) ) ); wxT( "rafael.sokolowski@web.de" ) ) );
info.AddDeveloper( new Contributor( wxT( "Rok Markovic" ), wxT( "rok@kanardia.eu" ) ) ); info.AddDeveloper( new Contributor( wxT( "Rok Markovic" ), wxT( "rok@kanardia.eu" ) ) );
info.AddDeveloper( new Contributor( wxT( "Tim Hanson" ), wxT( "sideskate@gmail.com" ) ) ); info.AddDeveloper( new Contributor( wxT( "Tim Hanson" ), wxT( "sideskate@gmail.com" ) ) );
info.AddDeveloper( new Contributor( wxT( "Vesa Solonen" ), wxT( "vesa.solonen@hut.fi" ) ) ); info.AddDeveloper( new Contributor( wxT( "Vesa Solonen" ), wxT( "vesa.solonen@hut.fi" ) ) );
info.AddDeveloper( new Contributor( wxT( "Wayne Stambaugh" ), wxT( "stambaughw@verizon.net" ) ) ); info.AddDeveloper( new Contributor( wxT( "Wayne Stambaugh" ),
wxT( "stambaughw@verizon.net" ) ) );
/* The document writers */ /* The document writers */
info.AddDocWriter( new Contributor( wxT( "Jean-Pierre Charras" ), info.AddDocWriter( new Contributor( wxT( "Jean-Pierre Charras" ),
wxT( "jean-pierre.charras@gipsa-lab.inpg.fr" ) ) ); wxT( "jean-pierre.charras@gipsa-lab.inpg.fr" ) ) );
info.AddDocWriter( new Contributor( wxT( "Igor Plyatov" ), wxT( "plyatov@gmail.com" ) ) ); info.AddDocWriter( new Contributor( wxT( "Igor Plyatov" ),
wxT( "plyatov@gmail.com" ) ) );
info.AddDocWriter( new Contributor( wxT( "Fabrizio Tappero" ),
wxT( "fabrizio.tappero@gmail.com" ) ) );
/* The translators /* The translators
* As category the language to which the translation was done is used * As category the language to which the translation was done is used
...@@ -270,7 +275,9 @@ static void InitKiCadAboutNew( AboutAppInfo& info ) ...@@ -270,7 +275,9 @@ static void InitKiCadAboutNew( AboutAppInfo& info )
wxT( "evgeniy_p_ivanov@yahoo.ca" ), wxT( "Bulgarian (BG)" ), wxT( "evgeniy_p_ivanov@yahoo.ca" ), wxT( "Bulgarian (BG)" ),
KiBitmapNew( lang_bg_xpm ) ) ); KiBitmapNew( lang_bg_xpm ) ) );
/* TODO: are these all russian translators, placed them here now, or else align them below other language maintainer with mail adress */ // TODO: are these all russian translators,
// placed them here now,
// or else align them below other language maintainer with mail adress
info.AddTranslator( new Contributor( wxT( "Remy Halvick" ), wxEmptyString, wxT( "Others" ) ) ); info.AddTranslator( new Contributor( wxT( "Remy Halvick" ), wxEmptyString, wxT( "Others" ) ) );
info.AddTranslator( new Contributor( wxT( "David Briscoe" ), wxEmptyString, wxT( "Others" ) ) ); info.AddTranslator( new Contributor( wxT( "David Briscoe" ), wxEmptyString, wxT( "Others" ) ) );
info.AddTranslator( new Contributor( wxT( "Dominique Laigle" ), wxEmptyString, wxT( "Others" ) ) ); info.AddTranslator( new Contributor( wxT( "Dominique Laigle" ), wxEmptyString, wxT( "Others" ) ) );
......
...@@ -325,7 +325,26 @@ public: ...@@ -325,7 +325,26 @@ public:
void PlacePad( D_PAD* Pad, wxDC* DC ); void PlacePad( D_PAD* Pad, wxDC* DC );
void Export_Pad_Settings( D_PAD* aPad ); void Export_Pad_Settings( D_PAD* aPad );
void Import_Pad_Settings( D_PAD* aPad, bool aDraw ); 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 // loading footprints
......
...@@ -877,6 +877,16 @@ public: ...@@ -877,6 +877,16 @@ public:
void InstallModuleOptionsFrame( MODULE* Module, wxDC* DC ); void InstallModuleOptionsFrame( MODULE* Module, wxDC* DC );
void StartMove_Module( 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 * Function Delete Module
* Remove a footprint from m_Modules linked list and put it in undelete buffer * Remove a footprint from m_Modules linked list and put it in undelete buffer
......
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version Apr 16 2008) // C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
...@@ -23,15 +23,12 @@ DIALOG_GLOBAL_PADS_EDITION_BASE::DIALOG_GLOBAL_PADS_EDITION_BASE( wxWindow* pare ...@@ -23,15 +23,12 @@ DIALOG_GLOBAL_PADS_EDITION_BASE::DIALOG_GLOBAL_PADS_EDITION_BASE( wxWindow* pare
sbSizer1 = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Pad Filter :") ), wxVERTICAL ); 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 ); 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 ); 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 ); 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 ); 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 ); 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 ); sbSizer1->Add( m_Pad_Orient_Filter_CB, 0, wxALL, 5 );
bLeftSizer->Add( sbSizer1, 1, wxEXPAND, 5 ); bLeftSizer->Add( sbSizer1, 1, wxEXPAND, 5 );
...@@ -47,14 +44,14 @@ DIALOG_GLOBAL_PADS_EDITION_BASE::DIALOG_GLOBAL_PADS_EDITION_BASE( wxWindow* pare ...@@ -47,14 +44,14 @@ DIALOG_GLOBAL_PADS_EDITION_BASE::DIALOG_GLOBAL_PADS_EDITION_BASE( wxWindow* pare
bRightSizer->Add( 10, 10, 0, 0, 5 ); bRightSizer->Add( 10, 10, 0, 0, 5 );
m_button2 = new wxButton( this, ID_CHANGE_CURRENT_MODULE, _("Change Pads on Module"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonChangeModule = new wxButton( this, ID_CHANGE_CURRENT_MODULE, _("Change Pads on Module"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_button2, 0, wxALL|wxEXPAND, 5 ); bRightSizer->Add( m_buttonChangeModule, 0, wxALL|wxEXPAND, 5 );
m_button3 = new wxButton( this, ID_CHANGE_ID_MODULES, _("Change Pads on Same Modules"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonIdModules = new wxButton( this, ID_CHANGE_ID_MODULES, _("Change Pads on Same Modules"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_button3, 0, wxALL|wxEXPAND, 5 ); bRightSizer->Add( m_buttonIdModules, 0, wxALL|wxEXPAND, 5 );
m_button4 = new wxButton( this, wxID_CANCEL, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 ); m_buttonCancel = new wxButton( this, wxID_ANY, _("Cancel"), wxDefaultPosition, wxDefaultSize, 0 );
bRightSizer->Add( m_button4, 0, wxALL|wxEXPAND, 5 ); bRightSizer->Add( m_buttonCancel, 0, wxALL|wxEXPAND, 5 );
bMainSizer->Add( bRightSizer, 0, wxEXPAND, 5 ); bMainSizer->Add( bRightSizer, 0, wxEXPAND, 5 );
...@@ -63,16 +60,17 @@ DIALOG_GLOBAL_PADS_EDITION_BASE::DIALOG_GLOBAL_PADS_EDITION_BASE( wxWindow* pare ...@@ -63,16 +60,17 @@ DIALOG_GLOBAL_PADS_EDITION_BASE::DIALOG_GLOBAL_PADS_EDITION_BASE( wxWindow* pare
// Connect Events // Connect Events
m_buttonPadEditor->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_PADS_EDITION_BASE::InstallPadEditor ), NULL, this ); 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_buttonChangeModule->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_buttonIdModules->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 ); 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() DIALOG_GLOBAL_PADS_EDITION_BASE::~DIALOG_GLOBAL_PADS_EDITION_BASE()
{ {
// Disconnect Events // Disconnect Events
m_buttonPadEditor->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_PADS_EDITION_BASE::InstallPadEditor ), NULL, this ); 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_buttonChangeModule->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_buttonIdModules->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 ); 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) // C++ code generated with wxFormBuilder (version Jun 30 2011)
// http://www.wxformbuilder.org/ // http://www.wxformbuilder.org/
// //
// PLEASE DO "NOT" EDIT THIS FILE! // PLEASE DO "NOT" EDIT THIS FILE!
/////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////
#ifndef __dialog_global_pads_edition_base__ #ifndef __DIALOG_GLOBAL_PADS_EDITION_BASE_H__
#define __dialog_global_pads_edition_base__ #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/string.h>
#include <wx/checkbox.h> #include <wx/checkbox.h>
#include <wx/gdicmn.h> #include <wx/gdicmn.h>
...@@ -37,21 +40,21 @@ class DIALOG_GLOBAL_PADS_EDITION_BASE : public wxDialog ...@@ -37,21 +40,21 @@ class DIALOG_GLOBAL_PADS_EDITION_BASE : public wxDialog
wxCheckBox* m_Pad_Layer_Filter_CB; wxCheckBox* m_Pad_Layer_Filter_CB;
wxCheckBox* m_Pad_Orient_Filter_CB; wxCheckBox* m_Pad_Orient_Filter_CB;
wxButton* m_buttonPadEditor; wxButton* m_buttonPadEditor;
wxButton* m_buttonChangeModule;
wxButton* m_button2; wxButton* m_buttonCancel;
wxButton* m_button3;
wxButton* m_button4;
// Virtual event handlers, overide them in your derived class // Virtual event handlers, overide them in your derived class
virtual void InstallPadEditor( wxCommandEvent& event ){ event.Skip(); } virtual void InstallPadEditor( wxCommandEvent& event ) { event.Skip(); }
virtual void PadPropertiesAccept( wxCommandEvent& event ){ event.Skip(); } virtual void PadPropertiesAccept( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ){ event.Skip(); } virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
public: 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 ); 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(); ~DIALOG_GLOBAL_PADS_EDITION_BASE();
}; };
#endif //__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 ) ...@@ -813,7 +813,7 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS: case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
m_canvas->MoveCursorToCrossHair(); m_canvas->MoveCursorToCrossHair();
Global_Import_Pad_Settings( (D_PAD*) GetCurItem(), true ); DlgGlobalChange_PadSettings( (D_PAD*) GetCurItem(), true );
break; break;
case ID_POPUP_PCB_EXPORT_PAD_SETTINGS: case ID_POPUP_PCB_EXPORT_PAD_SETTINGS:
......
...@@ -6,8 +6,9 @@ ...@@ -6,8 +6,9 @@
#include "common.h" #include "common.h"
#include "class_drawpanel.h" #include "class_drawpanel.h"
#include "confirm.h" #include "confirm.h"
#include "wxBasePcbFrame.h" #include "wxPcbStruct.h"
#include "pcbcommon.h" #include "pcbcommon.h"
#include "module_editor_frame.h"
#include "class_board.h" #include "class_board.h"
#include "class_module.h" #include "class_module.h"
...@@ -105,24 +106,65 @@ void DIALOG_GLOBAL_PADS_EDITION::PadPropertiesAccept( wxCommandEvent& event ) ...@@ -105,24 +106,65 @@ 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 * Function to change pad caracteristics for the given footprint
* or alls footprints which look like 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 * Options are set by the opened dialog.
* this pad * aPad is the pattern. The given footprint is the parent of this pad
* @param aDraw: if true: redraws the footprint * 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; int diag;
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;
}
Module->DisplayInfo( this );
DIALOG_GLOBAL_PADS_EDITION* dlg = new DIALOG_GLOBAL_PADS_EDITION( this, aPad );
diag = dlg->ShowModal();
dlg->Destroy();
if( diag == -1 )
return;
bool edit_Same_Modules = false; 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 ) if( aPad == NULL )
aPad = &g_Pad_Master; aPad = &g_Pad_Master;
Module = (MODULE*) aPad->GetParent(); MODULE* Module = (MODULE*) aPad->GetParent();
if( Module == NULL ) if( Module == NULL )
{ {
...@@ -133,6 +175,7 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw ) ...@@ -133,6 +175,7 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
Module->DisplayInfo( this ); Module->DisplayInfo( this );
DIALOG_GLOBAL_PADS_EDITION* dlg = new DIALOG_GLOBAL_PADS_EDITION( this, aPad ); DIALOG_GLOBAL_PADS_EDITION* dlg = new DIALOG_GLOBAL_PADS_EDITION( this, aPad );
dlg->m_buttonIdModules->Enable( false );
diag = dlg->ShowModal(); diag = dlg->ShowModal();
dlg->Destroy(); dlg->Destroy();
...@@ -140,19 +183,60 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw ) ...@@ -140,19 +183,60 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
if( diag == -1 ) if( diag == -1 )
return; return;
bool edit_Same_Modules = false;
if( diag == 1 ) if( diag == 1 )
edit_Same_Modules = true; 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. */ /* Search and copy the name of library reference. */
Module_Ref = Module; MODULE* Module_Ref = Module;
int pad_orient = aPad->m_Orient - Module_Ref->m_Orient; int pad_orient = aPad->m_Orient - Module_Ref->m_Orient;
// Prepare an undo list: // Prepare an undo list:
if( aSaveForUndo )
{
PICKED_ITEMS_LIST itemsList; PICKED_ITEMS_LIST itemsList;
Module = (MODULE*) m_Pcb->m_Modules; Module = (MODULE*) m_Pcb->m_Modules;
for( ; Module != NULL; Module = Module->Next() ) for( ; Module != NULL; Module = Module->Next() )
{ {
if( !edit_Same_Modules && (Module != Module_Ref) ) if( !aSameFootprints && (Module != Module_Ref) )
continue; continue;
if( Module->m_LibRef != Module_Ref->m_LibRef ) if( Module->m_LibRef != Module_Ref->m_LibRef )
...@@ -164,15 +248,14 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw ) ...@@ -164,15 +248,14 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
for( ; pt_pad != NULL; pt_pad = pt_pad->Next() ) for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
{ {
/* Filters changes prohibited. */ /* Filters changes prohibited. */
if( DIALOG_GLOBAL_PADS_EDITION::m_Pad_Shape_Filter if( aPadShapeFilter && ( pt_pad->m_PadShape != aPad->m_PadShape ) )
&& ( pt_pad->m_PadShape != aPad->m_PadShape ) )
continue; continue;
if( DIALOG_GLOBAL_PADS_EDITION::m_Pad_Orient_Filter int currpad_orient = pt_pad->m_Orient - Module->m_Orient;
&& ( (pt_pad->m_Orient - Module->m_Orient) != pad_orient ) ) if( aPadOrientFilter && ( currpad_orient != pad_orient ) )
continue; continue;
if( DIALOG_GLOBAL_PADS_EDITION::m_Pad_Layer_Filter if( aPadLayerFilter
&& ( pt_pad->m_layerMask != aPad->m_layerMask ) ) && ( pt_pad->m_layerMask != aPad->m_layerMask ) )
continue; continue;
...@@ -188,40 +271,40 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw ) ...@@ -188,40 +271,40 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
} }
SaveCopyInUndoList( itemsList, UR_CHANGED ); SaveCopyInUndoList( itemsList, UR_CHANGED );
}
/* Update the current module and same others modules if requested. */ /* 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() ) for( ; Module != NULL; Module = Module->Next() )
{ {
if( !edit_Same_Modules && (Module != Module_Ref) ) if( !aSameFootprints && (Module != Module_Ref) )
continue; continue;
if( Module->m_LibRef != Module_Ref->m_LibRef ) if( Module->m_LibRef != Module_Ref->m_LibRef )
continue; continue;
/* Erase module on screen */ /* Erase module on screen */
if( aDraw ) if( aRedraw )
{ {
Module->SetFlags( DO_NOT_DRAW ); Module->SetFlags( DO_NOT_DRAW );
m_canvas->RefreshDrawingRect( Module->GetBoundingBox() ); m_canvas->RefreshDrawingRect( Module->GetBoundingBox() );
Module->ClearFlags( DO_NOT_DRAW ); 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() ) for( ; pt_pad != NULL; pt_pad = pt_pad->Next() )
{ {
/* Filters changes prohibited. */ // Filters changes prohibited.
if( DIALOG_GLOBAL_PADS_EDITION::m_Pad_Shape_Filter if( aPadShapeFilter && ( pt_pad->m_PadShape != aPad->m_PadShape ) )
&& ( pt_pad->m_PadShape != aPad->m_PadShape ) )
continue; continue;
if( DIALOG_GLOBAL_PADS_EDITION::m_Pad_Orient_Filter if( aPadOrientFilter
&& ( (pt_pad->m_Orient - Module->m_Orient) != pad_orient ) ) && ( (pt_pad->m_Orient - Module->m_Orient) != pad_orient ) )
continue; continue;
if( DIALOG_GLOBAL_PADS_EDITION::m_Pad_Layer_Filter ) if( aPadLayerFilter )
{ {
if( pt_pad->m_layerMask != aPad->m_layerMask ) if( pt_pad->m_layerMask != aPad->m_layerMask )
continue; continue;
...@@ -229,7 +312,7 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw ) ...@@ -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); 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_Attribut = aPad->m_Attribut;
pt_pad->m_PadShape = aPad->m_PadShape; pt_pad->m_PadShape = aPad->m_PadShape;
...@@ -278,7 +361,7 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw ) ...@@ -278,7 +361,7 @@ void PCB_BASE_FRAME::Global_Import_Pad_Settings( D_PAD* aPad, bool aDraw )
Module->CalculateBoundingBox(); Module->CalculateBoundingBox();
if( aDraw ) if( aRedraw )
m_canvas->RefreshDrawingRect( Module->GetBoundingBox() ); m_canvas->RefreshDrawingRect( Module->GetBoundingBox() );
} }
......
...@@ -512,7 +512,8 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event ) ...@@ -512,7 +512,8 @@ void FOOTPRINT_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS: case ID_POPUP_PCB_GLOBAL_IMPORT_PAD_SETTINGS:
SaveCopyInUndoList( GetBoard()->m_Modules, UR_MODEDIT ); 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(); m_canvas->MoveCursorToCrossHair();
break; break;
......
...@@ -334,6 +334,15 @@ public: ...@@ -334,6 +334,15 @@ public:
/* Function to place a graphic item type EDGE_MODULE currently moved */ /* Function to place a graphic item type EDGE_MODULE currently moved */
void Place_EdgeMod( EDGE_MODULE* drawitem ); 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: // handlers for libraries:
void Delete_Module_In_Library( const wxString& libname ); 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