From d167407d1a578b288e9eb85eff89db95b13f47c5 Mon Sep 17 00:00:00 2001 From: jean-pierre charras Date: Fri, 14 Oct 2016 21:07:04 +0200 Subject: [PATCH] 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. --- .../dialog_global_edit_tracks_and_vias.cpp | 144 +- .../dialog_global_edit_tracks_and_vias.h | 21 +- ...ialog_global_edit_tracks_and_vias_base.cpp | 75 +- ...ialog_global_edit_tracks_and_vias_base.fbp | 1580 +++++++++-------- .../dialog_global_edit_tracks_and_vias_base.h | 22 +- pcbnew/edit.cpp | 7 + pcbnew/edit_track_width.cpp | 50 +- pcbnew/menubar_pcbframe.cpp | 23 +- pcbnew/pcbframe.cpp | 1 + pcbnew/pcbnew_id.h | 1 + pcbnew/tools/pcb_editor_control.cpp | 9 +- 11 files changed, 1046 insertions(+), 887 deletions(-) diff --git a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp index 91c749adee..8ba9521d63 100644 --- a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp +++ b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.cpp @@ -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 = ""; + + 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 + 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(); } diff --git a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.h b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.h index 4071e91066..45da323bc6 100644 --- a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.h +++ b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias.h @@ -27,6 +27,8 @@ #include +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__ diff --git a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.cpp b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.cpp index cf973d4a5c..83bbce4d58 100644 --- a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.cpp +++ b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.cpp @@ -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 ); } diff --git a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.fbp b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.fbp index e4ef2ac533..a43322d191 100644 --- a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.fbp +++ b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.fbp @@ -2,7 +2,7 @@ - + C++ 1 source_name @@ -16,78 +16,80 @@ none 1 dialog_global_edit_tracks_and_vias_base - + . - + 1 + 1 1 1 + UI 0 0 0 wxAUI_MGR_DEFAULT - - - + + + 1 1 impl_virtual - - - + + + 0 wxID_ANY - - + + DIALOG_GLOBAL_EDIT_TRACKS_AND_VIAS_BASE - - 711,376 + + 706,412 wxDEFAULT_DIALOG_STYLE|wxRESIZE_BORDER DIALOG_SHIM; dialog_shim.h Global Edition of Tracks and Vias - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + - + bMainSizer wxVERTICAL none @@ -96,7 +98,7 @@ wxEXPAND 0 - + bSizerCurrSettings wxVERTICAL none @@ -109,78 +111,78 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 ,90,92,-1,70,0 0 0 wxID_ANY Current Settings: - + 0 - - + + 0 - + 1 m_staticText12 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -188,13 +190,13 @@ wxEXPAND 1 - + bSizerCurrSettingsLeft wxHORIZONTAL none 5 - + 0 0 @@ -207,7 +209,7 @@ wxEXPAND 1 - + bSizerGrids wxVERTICAL none @@ -218,352 +220,357 @@ 2 wxBOTH - - + 1 + 0 - + fgSizeNetInfo wxFLEX_GROWMODE_SPECIFIED none - 2 + 0 0 5 - wxTOP|wxRIGHT|wxLEFT + wxALIGN_CENTER_VERTICAL|wxALL 0 1 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Current Net: - + 0 - - + + 0 - + 1 m_CurrentNetText 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + 5 - wxTOP|wxRIGHT|wxLEFT + wxEXPAND|wxALIGN_CENTER_VERTICAL|wxALL 0 - + 1 1 1 1 - - - - - - - + + + + + + + 1 0 + 1 - + 1 0 Dock 0 Left 1 - + 1 - ,90,92,-1,70,0 + 0 0 wxID_ANY - NetName - + 0 - - + + 0 - + 1 - m_CurrentNetName + m_choiceNetName 1 - - + + protected 1 - + Resizable + 0 1 - - - + + + 0 - - - - - -1 - - - - - - - - - - - - - - - - - - - - - - - + + + wxFILTER_NONE + wxDefaultValidator + + + + + + onNetSelection + + + + + + + + + + + + + + + + + + + + + + 5 - wxALL + wxALL|wxALIGN_CENTER_VERTICAL 0 1 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY Current NetClass: - + 0 - - + + 0 - + 1 m_CurrentNetclassText 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + 5 - wxALL + wxALL|wxALIGN_CENTER_VERTICAL 0 1 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 ,90,92,-1,70,0 0 0 wxID_ANY - NetClassName - + unknown + 0 - - + + 0 - + 1 m_CurrentNetclassName 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + 5 - + 0 10 @@ -580,20 +587,20 @@ 1 1 1 - - - - + + + + 1 1 - - - + + + 1 - - + + wxALIGN_CENTRE - + wxALIGN_CENTRE 0 1 @@ -602,8 +609,8 @@ "Track size" "Via diameter" "Via drill" "uVia size" "uVia Drill" wxALIGN_CENTRE 5 - - + + 1 0 Dock @@ -615,103 +622,103 @@ 1 1 1 - + 1 - - + + 1 0 0 wxID_ANY - - - + + + 0 10 - + 0 - - + + 0 - + 1 m_gridDisplayCurrentSettings 1 - - + + protected 1 - + Resizable wxALIGN_CENTRE 100 "Netclass value" "Current value" wxALIGN_CENTRE - + 2 1 - - + + 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -729,76 +736,76 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 wxID_ANY - + 0 - - + + 0 - + 1 m_staticline1 1 - - + + protected 1 - + Resizable 1 - + wxLI_HORIZONTAL - + 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -806,91 +813,91 @@ wxALL|wxEXPAND 0 - + bLowerSizer wxVERTICAL none 5 - wxALL + wxRIGHT|wxLEFT 0 1 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 ,90,92,-1,70,0 0 0 wxID_ANY Global Edition Option: - + 0 - - + + 0 - + 1 m_staticText11 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - - - + + + + -1 - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + @@ -900,13 +907,13 @@ wxEXPAND 0 - + bSizerOptions wxHORIZONTAL none 5 - + 0 0 @@ -919,7 +926,7 @@ wxEXPAND 1 - + bSizerRadioButtons wxVERTICAL none @@ -932,83 +939,83 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 ID_CURRENT_VALUES_TO_CURRENT_NET - Set tracks and vias of the current Net to the current value - + Set tracks and vias of the current Net to the current selected user value + 0 - - + + 0 - + 1 m_Net2CurrValueButton 1 - - + + protected 1 - + Resizable 1 - + wxRB_GROUP - + 0 - - + + wxFILTER_NONE wxDefaultValidator - + 1 - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + OnSelectionClick - - - - - - + + + + + + @@ -1020,83 +1027,83 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 ID_NETCLASS_VALUES_TO_CURRENT_NET Set tracks and vias of the current Net to the Netclass value - + 0 - - + + 0 - + 1 m_NetUseNetclassValueButton 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - + 0 - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + OnSelectionClick - - - - - - + + + + + + @@ -1108,83 +1115,83 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 ID_ALL_TRACKS_VIAS Set all tracks and vias to their Netclass value - + 0 - - + + 0 - + 1 - m_radioBtn3 + m_radioBtnAll 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - + 0 - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + OnSelectionClick - - - - - - + + + + + + @@ -1196,83 +1203,83 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 ID_ALL_VIAS Set all vias (no track) to their Netclass value - + 0 - - + + 0 - + 1 - m_radioBtn4 + m_radioAllVias 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - + 0 - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + OnSelectionClick - - - - - - + + + + + + @@ -1284,89 +1291,170 @@ 1 1 1 - - - - - - - + + + + + + + 1 0 1 - + 1 0 Dock 0 Left 1 - + 1 - + 0 0 ID_ALL_TRACKS Set all tracks (no via) to their Netclass value - + 0 - - + + 0 - + 1 - m_radioBtn5 + m_radioAllTracks 1 - - + + protected 1 - + Resizable 1 - - - + + + 0 - - + + wxFILTER_NONE wxDefaultValidator - + 0 - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + OnSelectionClick - - - - - - + + + + + + + + 5 + wxEXPAND | wxALL + 0 + + 1 + 1 + 1 + 1 + + + + + + + + 1 + 0 + 1 + + 1 + 0 + Dock + 0 + Left + 1 + + 1 + + 0 + 0 + wxID_ANY + + 0 + + + 0 + + 1 + m_staticline2 + 1 + + + protected + 1 + + Resizable + 1 + + wxLI_HORIZONTAL + + 0 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + 5 wxEXPAND|wxALL @@ -1380,17 +1468,17 @@ 1 0 0 - - m_sdbSizer1 + + m_sdbSizer protected - - OnCancelClick - - - + + + + + OnOkClick - - + + diff --git a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.h b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.h index 2fd62ac076..8cba0db235 100644 --- a/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.h +++ b/pcbnew/dialogs/dialog_global_edit_tracks_and_vias_base.h @@ -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 #include #include +#include #include #include #include @@ -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(); }; diff --git a/pcbnew/edit.cpp b/pcbnew/edit.cpp index 471da31496..12ebcb3bc2 100644 --- a/pcbnew/edit.cpp +++ b/pcbnew/edit.cpp @@ -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; diff --git a/pcbnew/edit_track_width.cpp b/pcbnew/edit_track_width.cpp index d163bc970a..756f0bedc6 100644 --- a/pcbnew/edit_track_width.cpp +++ b/pcbnew/edit_track_width.cpp @@ -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 #include #include -#include #include #include @@ -38,22 +37,19 @@ #include #include -#include -/** - * 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 ) diff --git a/pcbnew/menubar_pcbframe.cpp b/pcbnew/menubar_pcbframe.cpp index 00c7d95d35..b787dd7e60 100644 --- a/pcbnew/menubar_pcbframe.cpp +++ b/pcbnew/menubar_pcbframe.cpp @@ -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; diff --git a/pcbnew/pcbframe.cpp b/pcbnew/pcbframe.cpp index 866f3c7373..9aae464ace 100644 --- a/pcbnew/pcbframe.cpp +++ b/pcbnew/pcbframe.cpp @@ -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 ) diff --git a/pcbnew/pcbnew_id.h b/pcbnew/pcbnew_id.h index 92201c4d90..e5a6e90cbb 100644 --- a/pcbnew/pcbnew_id.h +++ b/pcbnew/pcbnew_id.h @@ -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, diff --git a/pcbnew/tools/pcb_editor_control.cpp b/pcbnew/tools/pcb_editor_control.cpp index 5869825907..8c94e0b40a 100644 --- a/pcbnew/tools/pcb_editor_control.cpp +++ b/pcbnew/tools/pcb_editor_control.cpp @@ -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( aToolMgr->GetEditFrame() )->GetCollectorsGuide(); + GENERAL_COLLECTORS_GUIDE guide = + static_cast( aToolMgr->GetEditFrame() )->GetCollectorsGuide(); BOARD* board = static_cast( 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; }