Pcbnew: add "edit all tracks and vias" command in edit menu.

Previously, this command was accessible only by right clicking on a track and only in the legacy mode.
This commit is contained in:
jean-pierre charras 2016-10-14 21:07:04 +02:00
parent 87eda6180d
commit d167407d1a
11 changed files with 1046 additions and 887 deletions

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2009-2014 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2014 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2009-2016 Jean-Pierre Charras, jean-pierre.charras at wanadoo.fr
* Copyright (C) 1992-2016 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
@ -44,12 +44,12 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS( PCB_EDIT
int aNetcode ) :
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE( aParent )
{
m_Parent = aParent;
m_Netcode = aNetcode;
m_OptionID = 0;
m_parent = aParent;
m_curr_netcode = aNetcode;
m_optionID = 0;
MyInit();
GetSizer()->SetSizeHints( this );
Layout();
}
@ -57,45 +57,53 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit()
{
SetFocus();
wxString msg;
// Display current setup for tracks and vias
BOARD* board = m_Parent->GetBoard();
BOARD_DESIGN_SETTINGS& dsnSettings = board->GetDesignSettings();
NETCLASSES& netclasses = dsnSettings.m_NetClasses;
m_brd = m_parent->GetBoard();
buildNetsList();
updateNetInfo();
m_gridDisplayCurrentSettings->Fit();
}
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::updateNetInfo()
{
BOARD_DESIGN_SETTINGS& brdSettings = m_brd->GetDesignSettings();
NETCLASSES& netclasses = brdSettings.m_NetClasses;
NETCLASSPTR netclass = netclasses.GetDefault();
NETINFO_ITEM* net = board->FindNet( m_Netcode );
NETINFO_ITEM* net = m_brd->FindNet( m_curr_netcode );
if( net )
{
m_CurrentNetName->SetLabel( net->GetNetname() );
m_CurrentNetclassName->SetLabel( dsnSettings.GetCurrentNetClassName() );
netclass = netclasses.Find( dsnSettings.GetCurrentNetClassName() );
netclass = net->GetNetClass();
m_CurrentNetclassName->SetLabel( netclass->GetName() );
}
/* Disable the option "copy current to net" if we have only default netclass values
* i.e. when m_TrackWidthSelector and m_ViaSizeSelector are set to 0
*/
if( !dsnSettings.GetTrackWidthIndex() && !dsnSettings.GetViaSizeIndex() )
if( !brdSettings.GetTrackWidthIndex() && !brdSettings.GetViaSizeIndex() )
{
m_Net2CurrValueButton->Enable( false );
m_OptionID = ID_NETCLASS_VALUES_TO_CURRENT_NET;
m_optionID = ID_NETCLASS_VALUES_TO_CURRENT_NET;
m_NetUseNetclassValueButton->SetValue(true);
}
else
{
m_OptionID = ID_CURRENT_VALUES_TO_CURRENT_NET;
m_optionID = ID_CURRENT_VALUES_TO_CURRENT_NET;
m_Net2CurrValueButton->SetValue(true);
}
// Display current values, and current netclass values:
wxString msg;
int value = netclass->GetTrackWidth(); // Display track width
msg = StringFromValue( g_UserUnit, value, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 0, msg );
if( dsnSettings.GetTrackWidthIndex() )
if( brdSettings.GetTrackWidthIndex() > 0 )
{
value = dsnSettings.GetCurrentTrackWidth();
value = brdSettings.GetCurrentTrackWidth();
msg = StringFromValue( g_UserUnit, value, true );
}
else
@ -107,44 +115,37 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit()
msg = StringFromValue( g_UserUnit, value, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 1, msg );
if( dsnSettings.GetViaSizeIndex() )
if( brdSettings.GetViaSizeIndex() > 0 )
{
value = dsnSettings.GetCurrentViaSize();
value = brdSettings.GetCurrentViaSize();
msg = StringFromValue( g_UserUnit, value, true );
}
else
msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 1, msg );
value = netclass->GetViaDrill(); // Display via drill
msg = StringFromValue( g_UserUnit, value, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 2, msg );
value = dsnSettings.GetCurrentViaDrill();
value = brdSettings.GetCurrentViaDrill();
if( value >= 0 )
msg = StringFromValue( g_UserUnit, value, true );
else
msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 2, msg );
value = netclass->GetuViaDiameter(); // Display micro via diameter
msg = StringFromValue( g_UserUnit, value, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 3, msg );
#if 0 // Currently we use always the default netclass value
value = board->GetCurrentMicroViaSize();
msg = StringFromValue( g_UserUnit, value, true );
#endif
msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 3, msg );
value = netclass->GetuViaDrill(); // Display micro via drill
msg = StringFromValue( g_UserUnit, value, true );
m_gridDisplayCurrentSettings->SetCellValue( 0, 4, msg );
#if 0 // Currently we use always the default netclass value
value = board->GetCurrentMicroViaDrill();
if( value >= 0 )
msg = StringFromValue( g_UserUnit, value, true );
else
#endif
msg = _( "Default" );
m_gridDisplayCurrentSettings->SetCellValue( 1, 4, msg );
@ -155,18 +156,56 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::MyInit()
m_gridDisplayCurrentSettings->SetReadOnly( ii, jj, true );
}
// needs wxWidgets version >= 2.8.8:
m_gridDisplayCurrentSettings->SetRowLabelSize(wxGRID_AUTOSIZE);
m_gridDisplayCurrentSettings->Fit();
}
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::buildNetsList()
{
wxString txt;
// Populate the nets list with nets names
for( unsigned netcode = 0; netcode < m_brd->GetNetCount(); netcode++ )
{
NETINFO_ITEM* net = m_brd->GetNetInfo().GetNetItem( netcode );
wxString netname = net->GetNetname();
if( netcode == 0 ) // netcode 0 is the netcode of not connected items
netname = "<no net>";
txt.Printf( _( "net %.3d" ), net->GetNet() );
txt << " " << netname;
m_choiceNetName->Append( txt );
}
if( m_curr_netcode < 0 )
m_curr_netcode = 0;
m_choiceNetName->SetSelection( m_curr_netcode );
updateNetInfo();
}
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::onNetSelection( wxCommandEvent& event )
{
int idx = m_choiceNetName->GetSelection();
if( idx == wxNOT_FOUND )
return;
m_curr_netcode = idx;
updateNetInfo();
}
#include <ratsnest_data.h>
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick( wxCommandEvent& event )
{
bool change = false;
switch( m_OptionID )
switch( m_optionID )
{
case ID_CURRENT_VALUES_TO_CURRENT_NET:
if( !IsOK( this,
@ -174,7 +213,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick( wxCommandEvent& event )
return;
{
wxBusyCursor dummy;
change = m_Parent->Change_Net_Tracks_And_Vias_Sizes( m_Netcode, false );
change = m_parent->Change_Net_Tracks_And_Vias_Sizes( m_curr_netcode, false );
}
break;
@ -184,7 +223,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick( wxCommandEvent& event )
return;
{
wxBusyCursor dummy;
change = m_Parent->Change_Net_Tracks_And_Vias_Sizes( m_Netcode, true );
change = m_parent->Change_Net_Tracks_And_Vias_Sizes( m_curr_netcode, true );
}
break;
@ -193,7 +232,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick( wxCommandEvent& event )
return;
{
wxBusyCursor dummy;
change = m_Parent->Reset_All_Tracks_And_Vias_To_Netclass_Values( true, true );
change = m_parent->Reset_All_Tracks_And_Vias_To_Netclass_Values( true, true );
}
break;
@ -202,7 +241,7 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick( wxCommandEvent& event )
return;
{
wxBusyCursor dummy;
change = m_Parent->Reset_All_Tracks_And_Vias_To_Netclass_Values( false, true );
change = m_parent->Reset_All_Tracks_And_Vias_To_Netclass_Values( false, true );
}
break;
@ -211,19 +250,22 @@ void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnOkClick( wxCommandEvent& event )
return;
{
wxBusyCursor dummy;
change = m_Parent->Reset_All_Tracks_And_Vias_To_Netclass_Values( true, false );
change = m_parent->Reset_All_Tracks_And_Vias_To_Netclass_Values( true, false );
}
break;
}
EndModal( 1 );
if( change )
m_Parent->GetCanvas()->Refresh();
}
{
if( m_parent->IsGalCanvasActive() )
{
for( TRACK* track = m_parent->GetBoard()->m_Track; track != NULL; track = track->Next() )
track->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
}
else
m_parent->GetCanvas()->Refresh();
}
void DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS::OnCancelClick( wxCommandEvent& event )
{
EndModal( 0 );
// Call the default handler
event.Skip();
}

View File

@ -27,6 +27,8 @@
#include <dialog_global_edit_tracks_and_vias_base.h>
class BOARD;
///////////////////////////////////////////////////////////////////////////////
/// Class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS
///////////////////////////////////////////////////////////////////////////////
@ -34,19 +36,28 @@ class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS :
public DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE
{
private:
PCB_EDIT_FRAME* m_Parent;
int m_Netcode;
int m_OptionID;
PCB_EDIT_FRAME* m_parent;
BOARD* m_brd;
int m_curr_netcode;
int m_optionID;
public:
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS( PCB_EDIT_FRAME* aParent, int aNetcode );
~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS() {};
private:
// Virtual event handlers, overided here
void OnSelectionClick( wxCommandEvent& event ) override { m_OptionID = event.GetId(); }
void OnSelectionClick( wxCommandEvent& event ) override
{
m_optionID = event.GetId();
}
void OnOkClick( wxCommandEvent& event ) override;
void OnCancelClick( wxCommandEvent& event ) override;
void onNetSelection( wxCommandEvent& event ) override;
void MyInit();
void updateNetInfo();
void buildNetsList();
};
#endif //__dialog_global_edit_tracks_and_vias__

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version May 6 2016)
// C++ code generated with wxFormBuilder (version Sep 8 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -35,29 +35,29 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE
bSizerGrids = new wxBoxSizer( wxVERTICAL );
wxFlexGridSizer* fgSizeNetInfo;
fgSizeNetInfo = new wxFlexGridSizer( 2, 2, 0, 0 );
fgSizeNetInfo = new wxFlexGridSizer( 0, 2, 0, 0 );
fgSizeNetInfo->AddGrowableCol( 1 );
fgSizeNetInfo->SetFlexibleDirection( wxBOTH );
fgSizeNetInfo->SetNonFlexibleGrowMode( wxFLEX_GROWMODE_SPECIFIED );
m_CurrentNetText = new wxStaticText( this, wxID_ANY, _("Current Net:"), wxDefaultPosition, wxDefaultSize, 0 );
m_CurrentNetText->Wrap( -1 );
fgSizeNetInfo->Add( m_CurrentNetText, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
fgSizeNetInfo->Add( m_CurrentNetText, 0, wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_CurrentNetName = new wxStaticText( this, wxID_ANY, _("NetName"), wxDefaultPosition, wxDefaultSize, 0 );
m_CurrentNetName->Wrap( -1 );
m_CurrentNetName->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
fgSizeNetInfo->Add( m_CurrentNetName, 0, wxTOP|wxRIGHT|wxLEFT, 5 );
wxArrayString m_choiceNetNameChoices;
m_choiceNetName = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceNetNameChoices, 0 );
m_choiceNetName->SetSelection( 0 );
fgSizeNetInfo->Add( m_choiceNetName, 0, wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL, 5 );
m_CurrentNetclassText = new wxStaticText( this, wxID_ANY, _("Current NetClass:"), wxDefaultPosition, wxDefaultSize, 0 );
m_CurrentNetclassText->Wrap( -1 );
fgSizeNetInfo->Add( m_CurrentNetclassText, 0, wxALL, 5 );
fgSizeNetInfo->Add( m_CurrentNetclassText, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
m_CurrentNetclassName = new wxStaticText( this, wxID_ANY, _("NetClassName"), wxDefaultPosition, wxDefaultSize, 0 );
m_CurrentNetclassName = new wxStaticText( this, wxID_ANY, _("unknown"), wxDefaultPosition, wxDefaultSize, 0 );
m_CurrentNetclassName->Wrap( -1 );
m_CurrentNetclassName->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
fgSizeNetInfo->Add( m_CurrentNetclassName, 0, wxALL, 5 );
fgSizeNetInfo->Add( m_CurrentNetclassName, 0, wxALL|wxALIGN_CENTER_VERTICAL, 5 );
bSizerGrids->Add( fgSizeNetInfo, 0, wxEXPAND, 5 );
@ -119,7 +119,7 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE
m_staticText11->Wrap( -1 );
m_staticText11->SetFont( wxFont( wxNORMAL_FONT->GetPointSize(), wxFONTFAMILY_DEFAULT, wxFONTSTYLE_NORMAL, wxFONTWEIGHT_BOLD, false, wxEmptyString ) );
bLowerSizer->Add( m_staticText11, 0, wxALL, 5 );
bLowerSizer->Add( m_staticText11, 0, wxRIGHT|wxLEFT, 5 );
bMainSizer->Add( bLowerSizer, 0, wxALL|wxEXPAND, 5 );
@ -133,21 +133,21 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE
wxBoxSizer* bSizerRadioButtons;
bSizerRadioButtons = new wxBoxSizer( wxVERTICAL );
m_Net2CurrValueButton = new wxRadioButton( this, ID_CURRENT_VALUES_TO_CURRENT_NET, _("Set tracks and vias of the current Net to the current value"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_Net2CurrValueButton = new wxRadioButton( this, ID_CURRENT_VALUES_TO_CURRENT_NET, _("Set tracks and vias of the current Net to the current selected user value"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
m_Net2CurrValueButton->SetValue( true );
bSizerRadioButtons->Add( m_Net2CurrValueButton, 0, wxALL, 5 );
m_NetUseNetclassValueButton = new wxRadioButton( this, ID_NETCLASS_VALUES_TO_CURRENT_NET, _("Set tracks and vias of the current Net to the Netclass value"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRadioButtons->Add( m_NetUseNetclassValueButton, 0, wxALL, 5 );
m_radioBtn3 = new wxRadioButton( this, ID_ALL_TRACKS_VIAS, _("Set all tracks and vias to their Netclass value"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRadioButtons->Add( m_radioBtn3, 0, wxALL, 5 );
m_radioBtnAll = new wxRadioButton( this, ID_ALL_TRACKS_VIAS, _("Set all tracks and vias to their Netclass value"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRadioButtons->Add( m_radioBtnAll, 0, wxALL, 5 );
m_radioBtn4 = new wxRadioButton( this, ID_ALL_VIAS, _("Set all vias (no track) to their Netclass value"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRadioButtons->Add( m_radioBtn4, 0, wxALL, 5 );
m_radioAllVias = new wxRadioButton( this, ID_ALL_VIAS, _("Set all vias (no track) to their Netclass value"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRadioButtons->Add( m_radioAllVias, 0, wxALL, 5 );
m_radioBtn5 = new wxRadioButton( this, ID_ALL_TRACKS, _("Set all tracks (no via) to their Netclass value"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRadioButtons->Add( m_radioBtn5, 0, wxALL, 5 );
m_radioAllTracks = new wxRadioButton( this, ID_ALL_TRACKS, _("Set all tracks (no via) to their Netclass value"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerRadioButtons->Add( m_radioAllTracks, 0, wxALL, 5 );
bSizerOptions->Add( bSizerRadioButtons, 1, wxEXPAND, 5 );
@ -155,38 +155,41 @@ DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE
bMainSizer->Add( bSizerOptions, 0, wxEXPAND, 5 );
m_sdbSizer1 = new wxStdDialogButtonSizer();
m_sdbSizer1OK = new wxButton( this, wxID_OK );
m_sdbSizer1->AddButton( m_sdbSizer1OK );
m_sdbSizer1Cancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer1->AddButton( m_sdbSizer1Cancel );
m_sdbSizer1->Realize();
m_staticline2 = new wxStaticLine( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bMainSizer->Add( m_staticline2, 0, wxEXPAND | wxALL, 5 );
bMainSizer->Add( m_sdbSizer1, 0, wxEXPAND|wxALL, 5 );
m_sdbSizer = new wxStdDialogButtonSizer();
m_sdbSizerOK = new wxButton( this, wxID_OK );
m_sdbSizer->AddButton( m_sdbSizerOK );
m_sdbSizerCancel = new wxButton( this, wxID_CANCEL );
m_sdbSizer->AddButton( m_sdbSizerCancel );
m_sdbSizer->Realize();
bMainSizer->Add( m_sdbSizer, 0, wxEXPAND|wxALL, 5 );
this->SetSizer( bMainSizer );
this->Layout();
// Connect Events
m_choiceNetName->Connect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::onNetSelection ), NULL, this );
m_Net2CurrValueButton->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_NetUseNetclassValueButton->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_radioBtn3->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_radioBtn4->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_radioBtn5->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_sdbSizer1Cancel->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnOkClick ), NULL, this );
m_radioBtnAll->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_radioAllVias->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_radioAllTracks->Connect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_sdbSizerOK->Connect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnOkClick ), NULL, this );
}
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE()
{
// Disconnect Events
m_choiceNetName->Disconnect( wxEVT_COMMAND_CHOICE_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::onNetSelection ), NULL, this );
m_Net2CurrValueButton->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_NetUseNetclassValueButton->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_radioBtn3->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_radioBtn4->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_radioBtn5->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_sdbSizer1Cancel->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnCancelClick ), NULL, this );
m_sdbSizer1OK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnOkClick ), NULL, this );
m_radioBtnAll->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_radioAllVias->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_radioAllTracks->Disconnect( wxEVT_COMMAND_RADIOBUTTON_SELECTED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnSelectionClick ), NULL, this );
m_sdbSizerOK->Disconnect( wxEVT_COMMAND_BUTTON_CLICKED, wxCommandEventHandler( DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE::OnOkClick ), NULL, this );
}

File diff suppressed because it is too large Load Diff

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version May 6 2016)
// C++ code generated with wxFormBuilder (version Sep 8 2016)
// http://www.wxformbuilder.org/
//
// PLEASE DO "NOT" EDIT THIS FILE!
@ -20,6 +20,7 @@ class DIALOG_SHIM;
#include <wx/font.h>
#include <wx/colour.h>
#include <wx/settings.h>
#include <wx/choice.h>
#include <wx/sizer.h>
#include <wx/grid.h>
#include <wx/statline.h>
@ -45,7 +46,7 @@ class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE : public DIALOG_SHIM
protected:
wxStaticText* m_staticText12;
wxStaticText* m_CurrentNetText;
wxStaticText* m_CurrentNetName;
wxChoice* m_choiceNetName;
wxStaticText* m_CurrentNetclassText;
wxStaticText* m_CurrentNetclassName;
wxGrid* m_gridDisplayCurrentSettings;
@ -53,22 +54,23 @@ class DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE : public DIALOG_SHIM
wxStaticText* m_staticText11;
wxRadioButton* m_Net2CurrValueButton;
wxRadioButton* m_NetUseNetclassValueButton;
wxRadioButton* m_radioBtn3;
wxRadioButton* m_radioBtn4;
wxRadioButton* m_radioBtn5;
wxStdDialogButtonSizer* m_sdbSizer1;
wxButton* m_sdbSizer1OK;
wxButton* m_sdbSizer1Cancel;
wxRadioButton* m_radioBtnAll;
wxRadioButton* m_radioAllVias;
wxRadioButton* m_radioAllTracks;
wxStaticLine* m_staticline2;
wxStdDialogButtonSizer* m_sdbSizer;
wxButton* m_sdbSizerOK;
wxButton* m_sdbSizerCancel;
// Virtual event handlers, overide them in your derived class
virtual void onNetSelection( wxCommandEvent& event ) { event.Skip(); }
virtual void OnSelectionClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnCancelClick( wxCommandEvent& event ) { event.Skip(); }
virtual void OnOkClick( wxCommandEvent& event ) { event.Skip(); }
public:
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Global Edition of Tracks and Vias"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 711,376 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE( wxWindow* parent, wxWindowID id = wxID_ANY, const wxString& title = _("Global Edition of Tracks and Vias"), const wxPoint& pos = wxDefaultPosition, const wxSize& size = wxSize( 706,412 ), long style = wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER );
~DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE();
};

View File

@ -336,6 +336,13 @@ void PCB_EDIT_FRAME::Process_Special_Functions( wxCommandEvent& event )
OnModify();
break;
case ID_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE:
{
DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS dlg( this, GetBoard()->GetHighLightNetCode() );
dlg.ShowModal();
}
break;
case ID_POPUP_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE:
if( GetCurItem() == NULL )
break;

View File

@ -1,8 +1,8 @@
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2007-2014 Jean-Pierre Charras, jean-pierre.charras@ujf-grenoble.fr
* Copyright (C) 1992-2012 KiCad Developers, see AUTHORS.txt for contributors.
* Copyright (C) 2007-2016 Jean-Pierre Charras, jp.charras at wanadoo.fr
* Copyright (C) 1992-2016 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
@ -30,7 +30,6 @@
#include <fctsys.h>
#include <gr_basic.h>
#include <class_drawpanel.h>
#include <confirm.h>
#include <wxPcbStruct.h>
#include <class_board.h>
@ -38,22 +37,19 @@
#include <pcbnew.h>
#include <drc_stuff.h>
#include <protos.h>
/**
* Function SetTrackSegmentWidth
* Modify one track segment width or one via diameter and drill (using DRC control).
* Basic routine used by other routines when editing tracks or vias
* @param aTrackItem = the track segment or via to modify
* @param aItemsListPicker = the list picker to use for an undo command (can be NULL)
* @param aUseNetclassValue = true to use NetClass value, false to use BOARD::m_designSettings value
* @return true if done, false if no not change (because DRC error)
*/
bool PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
PICKED_ITEMS_LIST* aItemsListPicker,
bool aUseNetclassValue )
{
/* Modify one track segment width or one via diameter and drill (using DRC control).
* Basic function used by other routines when editing tracks or vias
* aTrackItem = the track segment or via to modify
* aItemsListPicker = the list picker to use for an undo command (can be NULL)
* aUseNetclassValue = true to use NetClass value, false to use BOARD::m_designSettings value
* return true if done, false if no not change (due to DRC error)
*/
int initial_width, new_width;
int initial_drill = -1,new_drill = -1;
bool change_ok = false;
@ -201,16 +197,14 @@ void PCB_EDIT_FRAME::Edit_TrackSegm_Width( wxDC* aDC, TRACK* aTrackItem )
}
/**
* Function Edit_Track_Width
* Modify a full track width (using DRC control).
* a full track is the set of track segments between 2 ends: pads or a point that has
* more than 2 segments ends connected
* @param aDC = the curred device context (can be NULL)
* @param aTrackSegment = a segment or via on the track to change
*/
void PCB_EDIT_FRAME::Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment )
{
/* Modify a full track (a trace) width (using DRC control).
* a full track is the set of track segments between 2 nodes: pads or a node that has
* more than 2 segments connected
* aDC = the curred device context (can be NULL)
* aTrackSegment = a via or a track belonging to the trace to change
*/
TRACK* pt_track;
int nb_segm;
@ -244,6 +238,8 @@ void PCB_EDIT_FRAME::Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment )
segm->Draw( m_canvas, aDC, GR_XOR ); // Erase old track shape
segm = (TRACK*) itemsListPicker.GetPickedItem( ii );
segm->Draw( m_canvas, aDC, GR_OR ); // Display new track shape
segm->ViewUpdate( KIGFX::VIEW_ITEM::GEOMETRY );
}
m_canvas->CrossHairOn( aDC ); // Display cursor shape
@ -253,15 +249,13 @@ void PCB_EDIT_FRAME::Edit_Track_Width( wxDC* aDC, TRACK* aTrackSegment )
}
/**
* Function Change_Net_Tracks_And_Vias_Sizes
* Reset all tracks width and vias diameters and drill
* to their default Netclass value or current values
* @param aNetcode : the netcode of the net to edit
* @param aUseNetclassValue : bool. True to use netclass values, false to use current values
*/
bool PCB_EDIT_FRAME::Change_Net_Tracks_And_Vias_Sizes( int aNetcode, bool aUseNetclassValue )
{
/* Reset all tracks width and vias diameters and drill
* to their default Netclass value or current values
* aNetcode : the netcode of the net to edit
* aUseNetclassValue = true to use netclass values, false to use current values
*/
TRACK* pt_segm;
if( aNetcode <= 0 )

View File

@ -300,7 +300,20 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
AddMenuItem( editMenu, ID_FIND_ITEMS, text, HELP_FIND , KiBitmap( find_xpm ) );
editMenu->AppendSeparator();
AddMenuItem( editMenu, ID_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE,
_( "Edit All Tracks and Vias" ), KiBitmap( width_track_via_xpm ) );
AddMenuItem( editMenu, ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES,
_( "Set Footp&rint Field Sizes" ),
_( "Set text size and width of footprint fields." ),
KiBitmap( reset_text_xpm ) );
AddMenuItem( editMenu, ID_MENU_PCB_SWAP_LAYERS,
_( "&Swap Layers" ),
_( "Swap tracks on copper layers or drawings on other layers" ),
KiBitmap( swap_layer_xpm ) );
editMenu->AppendSeparator();
AddMenuItem( editMenu, ID_PCB_GLOBAL_DELETE,
_( "&Global Deletions" ),
_( "Delete tracks, footprints, texts... on board" ),
@ -311,16 +324,6 @@ void PCB_EDIT_FRAME::ReCreateMenuBar()
_( "Clean stubs, vias, delete break points, or unconnected tracks to pads and vias" ),
KiBitmap( delete_xpm ) );
AddMenuItem( editMenu, ID_MENU_PCB_SWAP_LAYERS,
_( "&Swap Layers" ),
_( "Swap tracks on copper layers or drawings on other layers" ),
KiBitmap( swap_layer_xpm ) );
AddMenuItem( editMenu, ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES,
_( "Set Footp&rint Field Sizes" ),
_( "Set text size and width of footprint fields." ),
KiBitmap( reset_text_xpm ) );
//----- View menu -----------------------------------------------------------
wxMenu* viewMenu = new wxMenu;

View File

@ -170,6 +170,7 @@ BEGIN_EVENT_TABLE( PCB_EDIT_FRAME, PCB_BASE_FRAME )
// menu Miscellaneous
EVT_MENU( ID_MENU_LIST_NETS, PCB_EDIT_FRAME::ListNetsAndSelect )
EVT_MENU( ID_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_PCB_GLOBAL_DELETE, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_CLEAN, PCB_EDIT_FRAME::Process_Special_Functions )
EVT_MENU( ID_MENU_PCB_SWAP_LAYERS, PCB_EDIT_FRAME::Process_Special_Functions )

View File

@ -259,6 +259,7 @@ enum pcbnew_ids
ID_MENU_CREATE_LIBRARY_AND_ARCHIVE_MODULES,
ID_MENU_MICELLANOUS,
ID_MENU_LIST_NETS,
ID_PCB_EDIT_ALL_VIAS_AND_TRACK_SIZE,
ID_MENU_PCB_CLEAN,
ID_MENU_PCB_SWAP_LAYERS,
ID_MENU_PCB_RESET_TEXTMODULE_FIELDS_SIZES,

View File

@ -747,7 +747,8 @@ int PCB_EDITOR_CONTROL::DrillOrigin( const TOOL_EVENT& aEvent )
static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
{
KIGFX::RENDER_SETTINGS* render = aToolMgr->GetView()->GetPainter()->GetSettings();
GENERAL_COLLECTORS_GUIDE guide = static_cast<PCB_BASE_FRAME*>( aToolMgr->GetEditFrame() )->GetCollectorsGuide();
GENERAL_COLLECTORS_GUIDE guide =
static_cast<PCB_BASE_FRAME*>( aToolMgr->GetEditFrame() )->GetCollectorsGuide();
BOARD* board = static_cast<BOARD*>( aToolMgr->GetModel() );
GENERAL_COLLECTOR collector;
int net = -1;
@ -771,6 +772,12 @@ static bool highlightNet( TOOL_MANAGER* aToolMgr, const VECTOR2D& aPosition )
aToolMgr->GetView()->UpdateAllLayersColor();
}
// Store the highlighted netcode in the current board (for dialogs for instance)
if( enableHighlight && net >= 0 )
board->SetHighLightNet( net );
else
board->ResetHighLight();
return true;
}