Added new action for "Change Track Width".
Default out-of-the-box is no hotkey. Removed all the preference stuff. Note that the new implementation is a little different: the old one only operated on a selection with a single item where the new one operates on all selected items. So if you want the whole track do a 'U' before the 'W' (or whatever you have Change Track Width assigned to). Fixes: lp:1844023 * https://bugs.launchpad.net/kicad/+bug/1844023
This commit is contained in:
parent
984c64677e
commit
48c8ac9663
|
@ -60,7 +60,6 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataToWindow()
|
|||
m_magneticPadChoice->SetSelection( general_opts.m_MagneticPads );
|
||||
m_magneticTrackChoice->SetSelection( general_opts.m_MagneticTracks );
|
||||
m_magneticGraphicsChoice->SetSelection( !general_opts.m_MagneticGraphics );
|
||||
m_UseEditKeyForWidth->SetValue( general_opts.m_EditHotkeyChangesTrackWidth );
|
||||
m_FlipLeftRight->SetValue( general_opts.m_FlipLeftRight );
|
||||
|
||||
m_Show_Page_Limits->SetValue( m_Frame->ShowPageLimits() );
|
||||
|
@ -82,7 +81,6 @@ bool PANEL_PCBNEW_SETTINGS::TransferDataFromWindow()
|
|||
m_Frame->Settings().m_MagneticPads = (MAGNETIC_OPTIONS) m_magneticPadChoice->GetSelection();
|
||||
m_Frame->Settings().m_MagneticTracks = (MAGNETIC_OPTIONS) m_magneticTrackChoice->GetSelection();
|
||||
m_Frame->Settings().m_MagneticGraphics = !m_magneticGraphicsChoice->GetSelection();
|
||||
m_Frame->Settings().m_EditHotkeyChangesTrackWidth = m_UseEditKeyForWidth->GetValue();
|
||||
m_Frame->Settings().m_FlipLeftRight = m_FlipLeftRight->GetValue();
|
||||
|
||||
m_Frame->SetShowPageLimits( m_Show_Page_Limits->GetValue() );
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version May 13 2019)
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -44,11 +44,6 @@ PANEL_PCBNEW_SETTINGS_BASE::PANEL_PCBNEW_SETTINGS_BASE( wxWindow* parent, wxWind
|
|||
|
||||
bOptionsSizer->Add( m_Segments_45_Only_Ctrl, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_UseEditKeyForWidth = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_ANY, _("Edit hotkey changes track width"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_UseEditKeyForWidth->SetToolTip( _("When active, hitting Edit hotkey or double-clicking on a track or via changes its width/diameter to the one selected in the main toolbar. ") );
|
||||
|
||||
bOptionsSizer->Add( m_UseEditKeyForWidth, 0, wxBOTTOM|wxLEFT|wxRIGHT, 5 );
|
||||
|
||||
m_FlipLeftRight = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_ANY, _("Flip board items L/R (default is T/B)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
bOptionsSizer->Add( m_FlipLeftRight, 0, wxBOTTOM|wxRIGHT|wxLEFT, 5 );
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
<property name="file">panel_pcbnew_settings_base</property>
|
||||
<property name="first_id">1000</property>
|
||||
<property name="help_provider">none</property>
|
||||
<property name="image_path_wrapper_function_name"></property>
|
||||
<property name="indent_with_spaces"></property>
|
||||
<property name="internationalize">1</property>
|
||||
<property name="name">PanelPcbnewSettings</property>
|
||||
|
@ -26,7 +25,6 @@
|
|||
<property name="skip_php_events">1</property>
|
||||
<property name="skip_python_events">1</property>
|
||||
<property name="ui_table">UI</property>
|
||||
<property name="use_array_enum">0</property>
|
||||
<property name="use_enum">1</property>
|
||||
<property name="use_microsoft_bom">0</property>
|
||||
<object class="Panel" expanded="1">
|
||||
|
@ -282,70 +280,6 @@
|
|||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxLEFT|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxCheckBox" expanded="1">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer"></property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position"></property>
|
||||
<property name="aui_row"></property>
|
||||
<property name="best_size"></property>
|
||||
<property name="bg"></property>
|
||||
<property name="caption"></property>
|
||||
<property name="caption_visible">1</property>
|
||||
<property name="center_pane">0</property>
|
||||
<property name="checked">0</property>
|
||||
<property name="close_button">1</property>
|
||||
<property name="context_help"></property>
|
||||
<property name="context_menu">1</property>
|
||||
<property name="default_pane">0</property>
|
||||
<property name="dock">Dock</property>
|
||||
<property name="dock_fixed">0</property>
|
||||
<property name="docking">Left</property>
|
||||
<property name="enabled">1</property>
|
||||
<property name="fg"></property>
|
||||
<property name="floatable">1</property>
|
||||
<property name="font"></property>
|
||||
<property name="gripper">0</property>
|
||||
<property name="hidden">0</property>
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Edit hotkey changes track width</property>
|
||||
<property name="max_size"></property>
|
||||
<property name="maximize_button">0</property>
|
||||
<property name="maximum_size"></property>
|
||||
<property name="min_size"></property>
|
||||
<property name="minimize_button">0</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="moveable">1</property>
|
||||
<property name="name">m_UseEditKeyForWidth</property>
|
||||
<property name="pane_border">1</property>
|
||||
<property name="pane_position"></property>
|
||||
<property name="pane_size"></property>
|
||||
<property name="permission">protected</property>
|
||||
<property name="pin_button">1</property>
|
||||
<property name="pos"></property>
|
||||
<property name="resize">Resizable</property>
|
||||
<property name="show">1</property>
|
||||
<property name="size"></property>
|
||||
<property name="style"></property>
|
||||
<property name="subclass"></property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">When active, hitting Edit hotkey or double-clicking on a track or via changes its width/diameter to the one selected in the main toolbar. </property>
|
||||
<property name="validator_data_type"></property>
|
||||
<property name="validator_style">wxFILTER_NONE</property>
|
||||
<property name="validator_type">wxDefaultValidator</property>
|
||||
<property name="validator_variable"></property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version May 13 2019)
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -44,7 +44,6 @@ class PANEL_PCBNEW_SETTINGS_BASE : public wxPanel
|
|||
wxRadioBox* m_PolarDisplay;
|
||||
wxRadioBox* m_UnitsSelection;
|
||||
wxCheckBox* m_Segments_45_Only_Ctrl;
|
||||
wxCheckBox* m_UseEditKeyForWidth;
|
||||
wxCheckBox* m_FlipLeftRight;
|
||||
wxStaticText* m_staticTextRotationAngle;
|
||||
wxTextCtrl* m_RotationAngle;
|
||||
|
|
|
@ -139,11 +139,6 @@ void PCB_EDIT_FRAME::OnEditItemRequest( BOARD_ITEM* aItem )
|
|||
{
|
||||
switch( aItem->Type() )
|
||||
{
|
||||
case PCB_TRACE_T:
|
||||
case PCB_VIA_T:
|
||||
Edit_TrackSegm_Width( static_cast<TRACK*>( aItem ) );
|
||||
break;
|
||||
|
||||
case PCB_TEXT_T:
|
||||
InstallTextOptionsFrame( aItem );
|
||||
break;
|
||||
|
|
|
@ -23,10 +23,8 @@
|
|||
*/
|
||||
|
||||
#include <fctsys.h>
|
||||
#include <gr_basic.h>
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <pcbnew_id.h>
|
||||
#include <class_board.h>
|
||||
#include <class_track.h>
|
||||
#include <pcbnew.h>
|
||||
#include <tools/drc.h>
|
||||
|
@ -154,23 +152,6 @@ int PCB_EDIT_FRAME::SetTrackSegmentWidth( TRACK* aTrackItem,
|
|||
}
|
||||
|
||||
|
||||
/**
|
||||
* Function Edit_TrackSegm_Width
|
||||
* Modify one track segment width or one via diameter (using DRC control).
|
||||
* @param aTrackItem = the track segment or via to modify
|
||||
*/
|
||||
void PCB_EDIT_FRAME::Edit_TrackSegm_Width( TRACK* aTrackItem )
|
||||
{
|
||||
PICKED_ITEMS_LIST itemsListPicker;
|
||||
bool changed = !SetTrackSegmentWidth( aTrackItem, &itemsListPicker, false );
|
||||
|
||||
if( !changed || aTrackItem->GetEditFlags() )
|
||||
return; // No change
|
||||
|
||||
SaveCopyInUndoList( itemsListPicker, UR_CHANGED );
|
||||
}
|
||||
|
||||
|
||||
void PCB_EDIT_FRAME::Tracks_and_Vias_Size_Event( wxCommandEvent& event )
|
||||
{
|
||||
int ii;
|
||||
|
|
|
@ -861,13 +861,6 @@ public:
|
|||
*/
|
||||
void OnEditItemRequest( BOARD_ITEM* aItem ) override;
|
||||
|
||||
/**
|
||||
* Function Edit_TrackSegm_Width
|
||||
* Modify one track segment width or one via diameter (using DRC control).
|
||||
* @param aTrackItem = the track segment or via to modify
|
||||
*/
|
||||
void Edit_TrackSegm_Width( TRACK* aTrackItem );
|
||||
|
||||
void SwitchLayer( wxDC* DC, PCB_LAYER_ID layer ) override;
|
||||
|
||||
/**
|
||||
|
|
|
@ -27,7 +27,6 @@
|
|||
|
||||
PCB_GENERAL_SETTINGS::PCB_GENERAL_SETTINGS( FRAME_T aFrameType ) :
|
||||
m_Use45DegreeGraphicSegments( false ),
|
||||
m_EditHotkeyChangesTrackWidth( false ),
|
||||
m_FlipLeftRight( false ),
|
||||
m_MagneticPads( CAPTURE_CURSOR_IN_TRACK_TOOL ),
|
||||
m_MagneticTracks( CAPTURE_CURSOR_IN_TRACK_TOOL ),
|
||||
|
@ -42,7 +41,6 @@ PCB_GENERAL_SETTINGS::PCB_GENERAL_SETTINGS( FRAME_T aFrameType ) :
|
|||
Add( "MagneticPads", reinterpret_cast<int*>( &m_MagneticPads ), CAPTURE_CURSOR_IN_TRACK_TOOL );
|
||||
Add( "MagneticTracks", reinterpret_cast<int*>( &m_MagneticTracks ), CAPTURE_CURSOR_IN_TRACK_TOOL );
|
||||
Add( "MagneticGraphics", &m_MagneticGraphics, true );
|
||||
Add( "EditActionChangesTrackWidth", &m_EditHotkeyChangesTrackWidth, false );
|
||||
Add( "FlipLeftRight", &m_FlipLeftRight, false );
|
||||
break;
|
||||
|
||||
|
|
|
@ -49,7 +49,6 @@ public:
|
|||
|
||||
bool m_Use45DegreeGraphicSegments; // True to constraint graphic lines to horizontal,
|
||||
// vertical and 45º
|
||||
bool m_EditHotkeyChangesTrackWidth;
|
||||
bool m_FlipLeftRight; // True: Flip footprints across Y axis
|
||||
// False: Flip footprints across X axis
|
||||
|
||||
|
|
|
@ -28,7 +28,6 @@
|
|||
#include <class_board.h>
|
||||
#include <class_module.h>
|
||||
#include <class_edge_mod.h>
|
||||
#include <class_zone.h>
|
||||
#include <collectors.h>
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <kiway.h>
|
||||
|
@ -500,16 +499,18 @@ int EDIT_TOOL::Move( const TOOL_EVENT& aEvent )
|
|||
return 0;
|
||||
}
|
||||
|
||||
bool EDIT_TOOL::changeTrackWidthOnClick( const PCBNEW_SELECTION& selection )
|
||||
int EDIT_TOOL::ChangeTrackWidth( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
if ( selection.Size() == 1 && frame()->Settings().m_EditHotkeyChangesTrackWidth )
|
||||
const auto& selection = m_selectionTool->RequestSelection(
|
||||
[]( const VECTOR2I& aPt, GENERAL_COLLECTOR& aCollector )
|
||||
{ EditToolSelectionFilter( aCollector, EXCLUDE_TRANSIENTS ); } );
|
||||
|
||||
for( EDA_ITEM* item : selection )
|
||||
{
|
||||
auto item = static_cast<BOARD_ITEM *>( selection[0] );
|
||||
|
||||
m_commit->Modify( item );
|
||||
|
||||
if( auto via = dyn_cast<VIA*>( item ) )
|
||||
{
|
||||
m_commit->Modify( item );
|
||||
|
||||
int new_width;
|
||||
int new_drill;
|
||||
|
||||
|
@ -531,17 +532,27 @@ bool EDIT_TOOL::changeTrackWidthOnClick( const PCBNEW_SELECTION& selection )
|
|||
}
|
||||
else if ( auto track = dyn_cast<TRACK*>( item ) )
|
||||
{
|
||||
m_commit->Modify( item );
|
||||
|
||||
int new_width = board()->GetDesignSettings().GetCurrentTrackWidth();
|
||||
track->SetWidth( new_width );
|
||||
}
|
||||
|
||||
m_commit->Push( _("Edit track width/via size") );
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
m_commit->Push( _("Edit track width/via size") );
|
||||
|
||||
if( selection.IsHover() )
|
||||
{
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::selectionClear, true );
|
||||
|
||||
// Notify other tools of the changes -- This updates the visual ratsnest
|
||||
m_toolMgr->ProcessEvent( EVENTS::SelectedItemsModified );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
||||
{
|
||||
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
|
||||
|
@ -553,11 +564,8 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
|
|||
// Tracks & vias are treated in a special way:
|
||||
if( ( SELECTION_CONDITIONS::OnlyTypes( GENERAL_COLLECTOR::Tracks ) )( selection ) )
|
||||
{
|
||||
if ( !changeTrackWidthOnClick( selection ) )
|
||||
{
|
||||
DIALOG_TRACK_VIA_PROPERTIES dlg( editFrame, selection, *m_commit );
|
||||
dlg.ShowQuasiModal(); // QuasiModal required for NET_SELECTOR
|
||||
}
|
||||
}
|
||||
else if( selection.Size() == 1 ) // Properties are displayed when there is only one item selected
|
||||
{
|
||||
|
@ -1407,6 +1415,7 @@ void EDIT_TOOL::setTransitions()
|
|||
Go( &EDIT_TOOL::Duplicate, PCB_ACTIONS::duplicateIncrement.MakeEvent() );
|
||||
Go( &EDIT_TOOL::CreateArray, PCB_ACTIONS::createArray.MakeEvent() );
|
||||
Go( &EDIT_TOOL::Mirror, PCB_ACTIONS::mirror.MakeEvent() );
|
||||
Go( &EDIT_TOOL::ChangeTrackWidth, PCB_ACTIONS::changeTrackWidth.MakeEvent() );
|
||||
|
||||
Go( &EDIT_TOOL::EditFpInFpEditor, PCB_ACTIONS::editFootprintInFpEditor.MakeEvent() );
|
||||
Go( &EDIT_TOOL::MeasureTool, ACTIONS::measureTool.MakeEvent() );
|
||||
|
|
|
@ -113,6 +113,8 @@ public:
|
|||
*/
|
||||
int Mirror( const TOOL_EVENT& aEvent );
|
||||
|
||||
int ChangeTrackWidth( const TOOL_EVENT& aEvent );
|
||||
|
||||
/**
|
||||
* Function Remove()
|
||||
* Deletes currently selected items. The rotation point is the current cursor position.
|
||||
|
@ -181,7 +183,6 @@ private:
|
|||
bool invokeInlineRouter( int aDragMode );
|
||||
bool isInteractiveDragEnabled() const;
|
||||
|
||||
bool changeTrackWidthOnClick( const PCBNEW_SELECTION& selection );
|
||||
bool pickCopyReferencePoint( VECTOR2I& aReferencePoint );
|
||||
|
||||
private:
|
||||
|
|
|
@ -238,6 +238,10 @@ TOOL_ACTION PCB_ACTIONS::mirror( "pcbnew.InteractiveEdit.mirror",
|
|||
_( "Mirror" ), _( "Mirrors selected item" ),
|
||||
mirror_h_xpm );
|
||||
|
||||
TOOL_ACTION PCB_ACTIONS::changeTrackWidth( "pcbnew.InteractiveEdit.changeTrackWidth",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Change Track Width" ), _( "Updates selected track & via sizes" ) );
|
||||
|
||||
TOOL_ACTION PCB_ACTIONS::deleteFull( "pcbnew.InteractiveEdit.deleteFull",
|
||||
AS_GLOBAL,
|
||||
WXK_DELETE, LEGACY_HK_NAME( "Delete Full Track" ),
|
||||
|
|
|
@ -118,6 +118,9 @@ public:
|
|||
/// Mirroring of selected items
|
||||
static TOOL_ACTION mirror;
|
||||
|
||||
/// Updates selected tracks & vias to the current track & via dimensions
|
||||
static TOOL_ACTION changeTrackWidth;
|
||||
|
||||
/// Activation of the edit tool
|
||||
static TOOL_ACTION properties;
|
||||
|
||||
|
|
Loading…
Reference in New Issue