2007-06-05 12:10:51 +00:00
|
|
|
|
/*************************/
|
|
|
|
|
/* Edition des Pastilles */
|
|
|
|
|
/*************************/
|
|
|
|
|
|
|
|
|
|
#include "fctsys.h"
|
|
|
|
|
#include "gr_basic.h"
|
|
|
|
|
#include "common.h"
|
|
|
|
|
#include "pcbnew.h"
|
|
|
|
|
#include "autorout.h"
|
|
|
|
|
#include "trigo.h"
|
|
|
|
|
|
|
|
|
|
#include "drag.h"
|
|
|
|
|
|
|
|
|
|
#include "protos.h"
|
|
|
|
|
|
|
|
|
|
/* Variables Locales */
|
|
|
|
|
static bool Pad_Shape_Filter = TRUE;
|
|
|
|
|
static bool Pad_Layer_Filter = TRUE;
|
|
|
|
|
static bool Pad_Orient_Filter = TRUE;
|
|
|
|
|
static bool Pad_Size_Change = TRUE;
|
|
|
|
|
static bool Pad_Shape_Change = FALSE;
|
|
|
|
|
static bool Pad_Orient_Change = FALSE;
|
|
|
|
|
static bool Pad_Drill_Change = TRUE;
|
|
|
|
|
|
|
|
|
|
enum id_pad_global_edit
|
|
|
|
|
{
|
|
|
|
|
ID_CHANGE_CURRENT_MODULE = 1900,
|
|
|
|
|
ID_CHANGE_ID_MODULES,
|
2007-10-11 04:56:44 +00:00
|
|
|
|
ID_CHANGE_GET_PAD_SETTINGS
|
2007-06-05 12:10:51 +00:00
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/************************************/
|
|
|
|
|
/* class WinEDA_PadGlobalEditFrame */
|
|
|
|
|
/************************************/
|
|
|
|
|
|
|
|
|
|
class WinEDA_PadGlobalEditFrame: public wxDialog
|
|
|
|
|
{
|
|
|
|
|
private:
|
|
|
|
|
|
|
|
|
|
WinEDA_BasePcbFrame * m_Parent;
|
|
|
|
|
wxDC * m_DC;
|
|
|
|
|
D_PAD * CurrentPad;
|
|
|
|
|
wxCheckBox * m_Pad_Shape_Filter;
|
|
|
|
|
wxCheckBox * m_Pad_Layer_Filter;
|
|
|
|
|
wxCheckBox * m_Pad_Orient_Filter;
|
|
|
|
|
wxCheckBox * m_Pad_Size_Change;
|
|
|
|
|
wxCheckBox * m_Pad_Shape_Change;
|
|
|
|
|
wxCheckBox * m_Pad_Drill_Change;
|
|
|
|
|
wxCheckBox * m_Pad_Orient_Change;
|
|
|
|
|
|
|
|
|
|
public:
|
|
|
|
|
// Constructor and destructor
|
|
|
|
|
WinEDA_PadGlobalEditFrame(WinEDA_BasePcbFrame *parent,
|
|
|
|
|
D_PAD * Pad, wxDC * DC, const wxPoint & pos);
|
2007-10-11 04:56:44 +00:00
|
|
|
|
~WinEDA_PadGlobalEditFrame() { }
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
private:
|
|
|
|
|
void PadPropertiesAccept(wxCommandEvent& event);
|
2007-10-11 04:56:44 +00:00
|
|
|
|
void OnCancelClick(wxCommandEvent& event);
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
DECLARE_EVENT_TABLE()
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
BEGIN_EVENT_TABLE(WinEDA_PadGlobalEditFrame, wxDialog)
|
|
|
|
|
EVT_BUTTON(ID_CHANGE_CURRENT_MODULE, WinEDA_PadGlobalEditFrame::PadPropertiesAccept)
|
|
|
|
|
EVT_BUTTON(ID_CHANGE_ID_MODULES, WinEDA_PadGlobalEditFrame::PadPropertiesAccept)
|
|
|
|
|
EVT_BUTTON(ID_CHANGE_GET_PAD_SETTINGS, WinEDA_PadGlobalEditFrame::PadPropertiesAccept)
|
2007-10-11 04:56:44 +00:00
|
|
|
|
EVT_BUTTON(wxID_CANCEL, WinEDA_PadGlobalEditFrame::OnCancelClick)
|
2007-06-05 12:10:51 +00:00
|
|
|
|
END_EVENT_TABLE()
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/********************************************************************************/
|
|
|
|
|
WinEDA_PadGlobalEditFrame::WinEDA_PadGlobalEditFrame(WinEDA_BasePcbFrame *parent,
|
|
|
|
|
D_PAD * Pad,wxDC * DC, const wxPoint & framepos):
|
|
|
|
|
wxDialog(parent, -1, _("Pads Global Edit"), framepos, wxSize(310, 235),
|
|
|
|
|
DIALOG_STYLE)
|
|
|
|
|
/********************************************************************************/
|
|
|
|
|
{
|
|
|
|
|
wxPoint pos;
|
|
|
|
|
wxButton * Button;
|
|
|
|
|
|
|
|
|
|
m_Parent = parent;
|
|
|
|
|
SetFont(*g_DialogFont);
|
|
|
|
|
m_DC = DC;
|
|
|
|
|
Centre();
|
|
|
|
|
|
|
|
|
|
CurrentPad = Pad;
|
|
|
|
|
|
|
|
|
|
/* Creation des boutons de commande */
|
2007-10-11 04:56:44 +00:00
|
|
|
|
pos.x = 150;
|
|
|
|
|
pos.y = 10;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
Button = new wxButton(this, ID_CHANGE_GET_PAD_SETTINGS,
|
2007-10-11 04:56:44 +00:00
|
|
|
|
_("Pad Settings..."), pos);
|
|
|
|
|
Button->SetForegroundColour( wxColor(0, 80, 0) );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-10-11 04:56:44 +00:00
|
|
|
|
pos.y += Button->GetDefaultSize().y + 50;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
Button = new wxButton(this, ID_CHANGE_CURRENT_MODULE,
|
|
|
|
|
_("Change Module"), pos);
|
2007-10-11 04:56:44 +00:00
|
|
|
|
Button->SetForegroundColour( *wxRED );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
pos.y += Button->GetDefaultSize().y + 10;
|
|
|
|
|
Button = new wxButton(this, ID_CHANGE_ID_MODULES,
|
|
|
|
|
_("Change Id Modules"), pos);
|
2007-10-11 04:56:44 +00:00
|
|
|
|
Button->SetForegroundColour( *wxRED );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
pos.y += Button->GetDefaultSize().y + 10;
|
2007-10-11 04:56:44 +00:00
|
|
|
|
Button = new wxButton(this, wxID_CANCEL, _("Cancel"), pos);
|
|
|
|
|
Button->SetForegroundColour( *wxBLUE );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
// Selection des filtres de selection des pads :
|
2007-10-11 04:56:44 +00:00
|
|
|
|
pos.x = 5;
|
|
|
|
|
pos.y = 5;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
new wxStaticBox(this, -1, _("Pad Filter :"), pos, wxSize(130, 75) );
|
2007-10-11 04:56:44 +00:00
|
|
|
|
|
|
|
|
|
pos.x += 5;
|
|
|
|
|
pos.y += 18;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
m_Pad_Shape_Filter = new wxCheckBox(this, -1, _("Shape Filter"), pos);
|
|
|
|
|
m_Pad_Shape_Filter->SetValue(Pad_Shape_Filter);
|
|
|
|
|
|
|
|
|
|
pos.y += 18;
|
|
|
|
|
m_Pad_Layer_Filter = new wxCheckBox(this, -1, _("Layer Filter"), pos);
|
|
|
|
|
m_Pad_Layer_Filter->SetValue(Pad_Layer_Filter);
|
|
|
|
|
|
|
|
|
|
pos.y += 18;
|
|
|
|
|
m_Pad_Orient_Filter = new wxCheckBox(this, -1, _("Orient Filter"), pos);
|
|
|
|
|
m_Pad_Orient_Filter->SetValue(Pad_Orient_Filter);
|
|
|
|
|
|
|
|
|
|
// Items a editer
|
2007-10-11 04:56:44 +00:00
|
|
|
|
pos.x -= 5;
|
|
|
|
|
pos.y += 25;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
new wxStaticBox(this, -1, _("Change Items :"), pos, wxSize(130, 95) );
|
2007-10-11 04:56:44 +00:00
|
|
|
|
|
|
|
|
|
pos.x += 5;
|
|
|
|
|
pos.y += 18;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
m_Pad_Size_Change = new wxCheckBox(this, -1, _("Change Size"), pos);
|
|
|
|
|
m_Pad_Size_Change->SetValue(Pad_Size_Change);
|
|
|
|
|
|
|
|
|
|
pos.y += 18;
|
|
|
|
|
m_Pad_Shape_Change = new wxCheckBox(this, -1, _("Change Shape"), pos);
|
|
|
|
|
m_Pad_Shape_Change->SetValue(Pad_Shape_Change);
|
|
|
|
|
|
|
|
|
|
pos.y += 18;
|
|
|
|
|
m_Pad_Drill_Change = new wxCheckBox(this, -1, _("Change Drill"), pos);
|
|
|
|
|
m_Pad_Drill_Change->SetValue(Pad_Drill_Change);
|
|
|
|
|
|
|
|
|
|
pos.y += 18;
|
|
|
|
|
m_Pad_Orient_Change = new wxCheckBox(this, -1, _("Change Orient"), pos);
|
|
|
|
|
m_Pad_Orient_Change->SetValue(Pad_Orient_Change);
|
|
|
|
|
}
|
|
|
|
|
|
2007-10-11 04:56:44 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/**********************************************************************/
|
2007-10-11 04:56:44 +00:00
|
|
|
|
void WinEDA_PadGlobalEditFrame::OnCancelClick(wxCommandEvent& WXUNUSED(event))
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/**********************************************************************/
|
|
|
|
|
{
|
2007-10-11 04:56:44 +00:00
|
|
|
|
EndModal( -1 );
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/*************************************************************************/
|
|
|
|
|
void WinEDA_PadGlobalEditFrame::PadPropertiesAccept(wxCommandEvent& event)
|
|
|
|
|
/*************************************************************************/
|
|
|
|
|
/* Met a jour les differents parametres pour le composant en cours d'<27>dition
|
2007-10-11 04:56:44 +00:00
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
2007-10-11 04:56:44 +00:00
|
|
|
|
int returncode = 0;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-10-11 04:56:44 +00:00
|
|
|
|
switch( event.GetId() )
|
|
|
|
|
{
|
|
|
|
|
case ID_CHANGE_GET_PAD_SETTINGS:
|
|
|
|
|
m_Parent->InstallPadOptionsFrame( NULL, NULL, wxPoint(-1, -1) );
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case ID_CHANGE_ID_MODULES:
|
|
|
|
|
returncode = 1;
|
|
|
|
|
// Fall through
|
|
|
|
|
|
|
|
|
|
case ID_CHANGE_CURRENT_MODULE:
|
|
|
|
|
Pad_Shape_Filter = m_Pad_Shape_Filter->GetValue();
|
|
|
|
|
Pad_Layer_Filter = m_Pad_Layer_Filter->GetValue();
|
|
|
|
|
Pad_Orient_Filter = m_Pad_Orient_Filter->GetValue();
|
|
|
|
|
Pad_Size_Change = m_Pad_Size_Change->GetValue();
|
|
|
|
|
Pad_Shape_Change = m_Pad_Shape_Change->GetValue();
|
|
|
|
|
Pad_Drill_Change = m_Pad_Drill_Change->GetValue();
|
|
|
|
|
Pad_Orient_Change = m_Pad_Orient_Change->GetValue();
|
|
|
|
|
EndModal( returncode );
|
|
|
|
|
break;
|
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/***************************************************************************/
|
|
|
|
|
void WinEDA_BasePcbFrame::Global_Import_Pad_Settings( D_PAD * Pad, wxDC * DC)
|
|
|
|
|
/***************************************************************************/
|
|
|
|
|
/*
|
2007-10-11 04:56:44 +00:00
|
|
|
|
* Routine de selection et de correction des dimensions des pastilles
|
|
|
|
|
* de tous les modules
|
|
|
|
|
* - semblables a l'module de reference selectionnee,
|
|
|
|
|
* c.a.d de meme nom de librairie
|
|
|
|
|
* - ou sur l'module localisee, selon le menu d'appel
|
|
|
|
|
*/
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
D_PAD* pt_pad ;
|
|
|
|
|
MODULE * Module_Ref , * Module;
|
|
|
|
|
int diag;
|
|
|
|
|
bool Edit_Same_Modules = FALSE;
|
|
|
|
|
|
2007-10-11 04:56:44 +00:00
|
|
|
|
if( Pad == NULL )
|
|
|
|
|
return;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
Module = (MODULE *) Pad->m_Parent;
|
|
|
|
|
|
2007-10-11 04:56:44 +00:00
|
|
|
|
if( Module == NULL )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
DisplayError(this, wxT("Global_Import_Pad_Settings() Error: NULL module"));
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
wxString ref_name_module = Module->m_LibRef;
|
|
|
|
|
|
|
|
|
|
Module->Display_Infos(this);
|
|
|
|
|
|
|
|
|
|
WinEDA_PadGlobalEditFrame * frame = new WinEDA_PadGlobalEditFrame(this, Pad,DC,
|
|
|
|
|
wxPoint(-1,-1));
|
2007-10-11 04:56:44 +00:00
|
|
|
|
diag = frame->ShowModal();
|
|
|
|
|
frame->Destroy();
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-10-11 04:56:44 +00:00
|
|
|
|
if( diag == -1 )
|
|
|
|
|
return;
|
|
|
|
|
if( diag == 1 )
|
|
|
|
|
Edit_Same_Modules = TRUE;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
/* Recherche et copie du nom librairie de reference: */
|
|
|
|
|
Module_Ref = Module;
|
|
|
|
|
|
|
|
|
|
/* Mise a jour des modules ou du module */
|
|
|
|
|
|
|
|
|
|
Module = (MODULE*) m_Pcb->m_Modules;
|
2007-10-11 04:56:44 +00:00
|
|
|
|
for( ; Module != NULL; Module = (MODULE*) Module->Pnext )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
if( ! Edit_Same_Modules )
|
2007-10-11 04:56:44 +00:00
|
|
|
|
if( Module != Module_Ref )
|
|
|
|
|
continue;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
if( ref_name_module != Module->m_LibRef )
|
2007-10-11 04:56:44 +00:00
|
|
|
|
continue ;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
Module->Display_Infos(this);
|
|
|
|
|
|
|
|
|
|
/* Effacement du module */
|
2007-10-11 04:56:44 +00:00
|
|
|
|
Module->Draw(DrawPanel, DC, wxPoint(0, 0), GR_XOR);
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
|
|
|
|
pt_pad = (D_PAD*) Module->m_Pads;
|
2007-10-11 04:56:44 +00:00
|
|
|
|
for( ; pt_pad != NULL; pt_pad = (D_PAD*) pt_pad->Pnext )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
/* Filtrage des modifications interdites */
|
|
|
|
|
if( Pad_Shape_Filter )
|
|
|
|
|
{
|
2007-10-11 04:56:44 +00:00
|
|
|
|
if( pt_pad->m_PadShape != g_Pad_Master.m_PadShape )
|
|
|
|
|
continue;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( Pad_Orient_Filter )
|
|
|
|
|
{
|
2007-10-11 04:56:44 +00:00
|
|
|
|
if( (pt_pad->m_Orient - Module->m_Orient) != g_Pad_Master.m_Orient )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( Pad_Layer_Filter )
|
|
|
|
|
{
|
2007-10-11 04:56:44 +00:00
|
|
|
|
if( pt_pad->m_Masque_Layer != g_Pad_Master.m_Masque_Layer )
|
|
|
|
|
continue;
|
|
|
|
|
else
|
|
|
|
|
m_Pcb->m_Status_Pcb &= ~( LISTE_CHEVELU_OK | CONNEXION_OK);
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
2007-10-11 04:56:44 +00:00
|
|
|
|
/* Modif des caracteristiques: */
|
2007-06-05 12:10:51 +00:00
|
|
|
|
if( Pad_Shape_Change )
|
|
|
|
|
{
|
2007-10-11 04:56:44 +00:00
|
|
|
|
pt_pad->m_Attribut = g_Pad_Master.m_Attribut;
|
|
|
|
|
pt_pad->m_PadShape = g_Pad_Master.m_PadShape;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pt_pad->m_Masque_Layer = g_Pad_Master.m_Masque_Layer;
|
|
|
|
|
|
|
|
|
|
if( Pad_Size_Change )
|
|
|
|
|
{
|
|
|
|
|
pt_pad->m_Size = g_Pad_Master.m_Size;
|
|
|
|
|
pt_pad->m_DeltaSize = g_Pad_Master.m_DeltaSize;
|
|
|
|
|
pt_pad->m_Offset = g_Pad_Master.m_Offset;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( Pad_Drill_Change )
|
|
|
|
|
{
|
|
|
|
|
pt_pad->m_Drill = g_Pad_Master.m_Drill;
|
|
|
|
|
pt_pad->m_DrillShape = g_Pad_Master.m_DrillShape;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if( Pad_Orient_Change )
|
|
|
|
|
{
|
|
|
|
|
pt_pad->m_Orient = g_Pad_Master.m_Orient + Module->m_Orient;
|
|
|
|
|
}
|
2007-10-11 04:56:44 +00:00
|
|
|
|
|
2007-06-05 12:10:51 +00:00
|
|
|
|
/* Traitement des cas particuliers : */
|
2008-01-05 17:30:56 +00:00
|
|
|
|
if( g_Pad_Master.m_PadShape != PAD_TRAPEZOID )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
|
|
|
|
pt_pad->m_DeltaSize.x = 0;
|
|
|
|
|
pt_pad->m_DeltaSize.y = 0;
|
|
|
|
|
}
|
2008-01-05 17:30:56 +00:00
|
|
|
|
if( g_Pad_Master.m_PadShape == PAD_CIRCLE )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
pt_pad->m_Size.y = pt_pad->m_Size.x;
|
|
|
|
|
|
2007-10-11 04:56:44 +00:00
|
|
|
|
switch( g_Pad_Master.m_Attribut & 0x7F )
|
2007-06-05 12:10:51 +00:00
|
|
|
|
{
|
2008-01-05 17:30:56 +00:00
|
|
|
|
case PAD_SMD:
|
|
|
|
|
case PAD_CONN:
|
2007-10-11 04:56:44 +00:00
|
|
|
|
pt_pad->m_Drill = wxSize(0, 0);
|
2007-06-05 12:10:51 +00:00
|
|
|
|
pt_pad->m_Offset.x = 0;
|
|
|
|
|
pt_pad->m_Offset.y = 0;
|
2007-10-11 04:56:44 +00:00
|
|
|
|
break;
|
2007-06-05 12:10:51 +00:00
|
|
|
|
|
2007-10-11 04:56:44 +00:00
|
|
|
|
default:
|
|
|
|
|
break;
|
|
|
|
|
}
|
2007-06-05 12:10:51 +00:00
|
|
|
|
pt_pad->ComputeRayon();
|
|
|
|
|
}
|
|
|
|
|
Module->Set_Rectangle_Encadrement();
|
2007-10-11 04:56:44 +00:00
|
|
|
|
Module->Draw(DrawPanel, DC, wxPoint(0, 0), GR_OR);
|
2007-06-05 12:10:51 +00:00
|
|
|
|
}
|
|
|
|
|
GetScreen()->SetModify();
|
|
|
|
|
}
|