Expose changing arc edit mode in arc button context menu and Preferences

Ctrl+Space can still be used to cycle through modes.

Fixes https://gitlab.com/kicad/code/kicad/issues/5412
This commit is contained in:
Alex 2022-12-05 21:27:00 +03:00
parent c58340629c
commit 6d513e7ecf
19 changed files with 414 additions and 63 deletions

View File

@ -200,8 +200,9 @@ TOOL_ACTION ACTIONS::deleteTool( "common.Interactive.deleteTool",
TOOL_ACTION ACTIONS::activatePointEditor( "common.Control.activatePointEditor",
AS_GLOBAL );
TOOL_ACTION ACTIONS::changeEditMethod( "common.Interactive.changeEditMethod", AS_GLOBAL,
MD_CTRL + ' ', "", _( "Change Edit Method" ), _( "Change edit method constraints" ) );
TOOL_ACTION ACTIONS::cycleArcEditMode( "common.Interactive.cycleArcEditMode", AS_GLOBAL,
MD_CTRL + ' ', "", _( "Cycle arc editing mode" ),
_( "Switch to a different method of editing arcs" ) );
TOOL_ACTION ACTIONS::showSearch( "common.Interactive.search",
AS_GLOBAL,

View File

@ -69,6 +69,8 @@ public:
bool m_Use45Limit;
ARC_EDIT_MODE m_ArcEditMode;
int m_LibWidth;
wxString m_LastImportExportPath;

View File

@ -63,6 +63,15 @@ struct GRID_SETTINGS
int snap;
};
/**
* Settings for arc editing. Used by pcbnew and footprint editor
*/
enum class ARC_EDIT_MODE
{
KEEP_CENTER_ADJUST_ANGLE_RADIUS,
KEEP_ENDPOINTS_OR_START_DIRECTION
};
/**
* Stores the window positioning/state
*/

View File

@ -170,7 +170,7 @@ public:
// Internal
static TOOL_ACTION updateMenu;
static TOOL_ACTION activatePointEditor;
static TOOL_ACTION changeEditMethod;
static TOOL_ACTION cycleArcEditMode;
static TOOL_ACTION updatePreferences;
static TOOL_ACTION selectColumns;

View File

@ -39,8 +39,7 @@ PANEL_EDIT_OPTIONS::PANEL_EDIT_OPTIONS( wxWindow* aParent, UNITS_PROVIDER* aUnit
{
m_magneticPads->Show( m_isFootprintEditor );
m_magneticGraphics->Show( m_isFootprintEditor );
m_flipLeftRight->Show( !m_isFootprintEditor );
m_allowFreePads->Show( !m_isFootprintEditor );
m_sizerBoardEdit->Show( !m_isFootprintEditor );
m_rotationAngle.SetUnits( EDA_UNITS::DEGREES );
@ -69,6 +68,8 @@ void PANEL_EDIT_OPTIONS::loadPCBSettings( PCBNEW_SETTINGS* aCfg )
m_flipLeftRight->SetValue( aCfg->m_FlipLeftRight );
m_cbConstrainHV45Mode->SetValue( aCfg->m_Use45DegreeLimit );
m_cbCourtyardCollisions->SetValue( aCfg->m_ShowCourtyardCollisions );
m_arcEditMode->SetSelection(
aCfg->m_ArcEditMode == ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS ? 0 : 1 );
/* Set display options */
m_OptDisplayCurvedRatsnestLines->SetValue( aCfg->m_Display.m_DisplayRatsnestLinesCurved );
@ -101,6 +102,8 @@ void PANEL_EDIT_OPTIONS::loadFPSettings( FOOTPRINT_EDITOR_SETTINGS* aCfg )
m_magneticPads->SetValue( aCfg->m_MagneticItems.pads == MAGNETIC_OPTIONS::CAPTURE_ALWAYS );
m_magneticGraphics->SetValue( aCfg->m_MagneticItems.graphics );
m_cbConstrainHV45Mode->SetValue( aCfg->m_Use45Limit );
m_arcEditMode->SetSelection(
aCfg->m_ArcEditMode == ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS ? 0 : 1 );
}
@ -140,6 +143,10 @@ bool PANEL_EDIT_OPTIONS::TransferDataFromWindow()
cfg->m_MagneticItems.graphics = m_magneticGraphics->GetValue();
cfg->m_Use45Limit = m_cbConstrainHV45Mode->GetValue();
cfg->m_ArcEditMode = m_arcEditMode->GetSelection() == 0
? ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS
: ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION;
}
else
{
@ -175,6 +182,10 @@ bool PANEL_EDIT_OPTIONS::TransferDataFromWindow()
cfg->m_Use45DegreeLimit = m_cbConstrainHV45Mode->GetValue();
cfg->m_ShowCourtyardCollisions = m_cbCourtyardCollisions->GetValue();
cfg->m_ArcEditMode = m_arcEditMode->GetSelection() == 0
? ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS
: ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION;
}
return true;

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -23,22 +23,21 @@ PANEL_EDIT_OPTIONS_BASE::PANEL_EDIT_OPTIONS_BASE( wxWindow* parent, wxWindowID i
wxStaticBoxSizer* bOptionsSizer;
bOptionsSizer = new wxStaticBoxSizer( new wxStaticBox( this, wxID_ANY, _("Editing Options") ), wxVERTICAL );
wxBoxSizer* bSizerBoardEdit;
bSizerBoardEdit = new wxBoxSizer( wxVERTICAL );
m_sizerBoardEdit = new wxBoxSizer( wxVERTICAL );
m_flipLeftRight = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_ANY, _("Flip board items L/R (default is T/B)"), wxDefaultPosition, wxDefaultSize, 0 );
bSizerBoardEdit->Add( m_flipLeftRight, 0, wxBOTTOM|wxLEFT, 5 );
m_sizerBoardEdit->Add( m_flipLeftRight, 0, wxBOTTOM|wxLEFT, 5 );
m_allowFreePads = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_ANY, _("Allow free pads"), wxDefaultPosition, wxDefaultSize, 0 );
m_allowFreePads->SetToolTip( _("If checked, pads can be moved with respect to the rest of the footprint.") );
bSizerBoardEdit->Add( m_allowFreePads, 0, wxBOTTOM|wxLEFT, 5 );
m_sizerBoardEdit->Add( m_allowFreePads, 0, wxBOTTOM|wxLEFT, 5 );
m_staticline3 = new wxStaticLine( bOptionsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizerBoardEdit->Add( m_staticline3, 0, wxEXPAND|wxTOP|wxBOTTOM, 4 );
m_sizerBoardEdit->Add( m_staticline3, 0, wxEXPAND|wxTOP|wxBOTTOM, 4 );
bOptionsSizer->Add( bSizerBoardEdit, 0, wxEXPAND, 5 );
bOptionsSizer->Add( m_sizerBoardEdit, 0, wxEXPAND, 5 );
wxBoxSizer* bSizerUniversal;
bSizerUniversal = new wxBoxSizer( wxVERTICAL );
@ -66,6 +65,25 @@ PANEL_EDIT_OPTIONS_BASE::PANEL_EDIT_OPTIONS_BASE( wxWindow* parent, wxWindowID i
bSizerUniversal->Add( bSizerRotationStep, 0, wxEXPAND, 5 );
wxBoxSizer* bSizer101;
bSizer101 = new wxBoxSizer( wxVERTICAL );
m_staticline4 = new wxStaticLine( bOptionsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, wxLI_HORIZONTAL );
bSizer101->Add( m_staticline4, 0, wxBOTTOM|wxEXPAND|wxTOP, 4 );
m_arcEditModeLabel = new wxStaticText( bOptionsSizer->GetStaticBox(), wxID_ANY, _("Arc editing mode:"), wxDefaultPosition, wxDefaultSize, 0 );
m_arcEditModeLabel->Wrap( -1 );
bSizer101->Add( m_arcEditModeLabel, 0, wxALIGN_CENTER_VERTICAL|wxRIGHT, 5 );
wxString m_arcEditModeChoices[] = { _("Keep center, adjust radius"), _("Keep endpoints or direction of starting point") };
int m_arcEditModeNChoices = sizeof( m_arcEditModeChoices ) / sizeof( wxString );
m_arcEditMode = new wxChoice( bOptionsSizer->GetStaticBox(), wxID_ANY, wxDefaultPosition, wxDefaultSize, m_arcEditModeNChoices, m_arcEditModeChoices, 0 );
m_arcEditMode->SetSelection( 0 );
bSizer101->Add( m_arcEditMode, 0, wxBOTTOM|wxTOP, 5 );
bSizerUniversal->Add( bSizer101, 1, wxEXPAND, 5 );
bOptionsSizer->Add( bSizerUniversal, 0, wxEXPAND|wxRIGHT|wxLEFT, 5 );

View File

@ -93,14 +93,14 @@
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerBoardEdit</property>
<property name="name">m_sizerBoardEdit</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="permission">protected</property>
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -160,11 +160,11 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -224,11 +224,11 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">4</property>
<property name="flag">wxEXPAND|wxTOP|wxBOTTOM</property>
<property name="proportion">0</property>
<object class="wxStaticLine" expanded="1">
<object class="wxStaticLine" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -288,7 +288,7 @@
<property name="border">5</property>
<property name="flag">wxEXPAND|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerUniversal</property>
<property name="orient">wxVERTICAL</property>
@ -357,11 +357,11 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">0</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizerRotationStep</property>
<property name="orient">wxHORIZONTAL</property>
@ -554,6 +554,200 @@
</object>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer101</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<property name="border">4</property>
<property name="flag">wxBOTTOM|wxEXPAND|wxTOP</property>
<property name="proportion">0</property>
<object class="wxStaticLine" 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="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="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_staticline4</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">wxLI_HORIZONTAL</property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></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">wxALIGN_CENTER_VERTICAL|wxRIGHT</property>
<property name="proportion">0</property>
<object class="wxStaticText" 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="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">Arc editing mode:</property>
<property name="markup">0</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_arcEditModeLabel</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">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></property>
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style"></property>
<property name="wrap">-1</property>
</object>
</object>
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxTOP</property>
<property name="proportion">0</property>
<object class="wxChoice" 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="choices">&quot;Keep center, adjust radius&quot; &quot;Keep endpoints or direction of starting point&quot;</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="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_arcEditMode</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="selection">0</property>
<property name="show">1</property>
<property name="size"></property>
<property name="style"></property>
<property name="subclass">; ; forward_declare</property>
<property name="toolbar_pane">0</property>
<property name="tooltip"></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>
</object>
</object>
</object>
</object>
@ -562,7 +756,7 @@
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="0">
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Left Click Mouse Commands</property>
<property name="minimum_size"></property>
@ -689,11 +883,11 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="0">
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">2</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
@ -1328,7 +1522,7 @@
<property name="border">5</property>
<property name="flag">wxEXPAND|wxALL</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="0">
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Left Click Mouse Commands</property>
<property name="minimum_size"></property>
@ -1455,11 +1649,11 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxFlexGridSizer" expanded="0">
<object class="wxFlexGridSizer" expanded="1">
<property name="cols">2</property>
<property name="flexible_direction">wxBOTH</property>
<property name="growablecols"></property>
@ -2272,7 +2466,7 @@
<object class="simplebookpage" expanded="1">
<property name="label">a page</property>
<property name="select">0</property>
<object class="wxPanel" expanded="0">
<object class="wxPanel" expanded="1">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -2323,16 +2517,16 @@
<property name="window_extra_style"></property>
<property name="window_name"></property>
<property name="window_style">wxTAB_TRAVERSAL</property>
<object class="wxBoxSizer" expanded="0">
<object class="wxBoxSizer" expanded="1">
<property name="minimum_size"></property>
<property name="name">bSizer10</property>
<property name="orient">wxVERTICAL</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="0">
<object class="sizeritem" expanded="1">
<property name="border">5</property>
<property name="flag">wxEXPAND</property>
<property name="proportion">1</property>
<object class="wxStaticBoxSizer" expanded="0">
<object class="wxStaticBoxSizer" expanded="1">
<property name="id">wxID_ANY</property>
<property name="label">Magnetic Points</property>
<property name="minimum_size"></property>
@ -3371,11 +3565,11 @@
<property name="orient">wxVERTICAL</property>
<property name="parent">1</property>
<property name="permission">none</property>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -3499,11 +3693,11 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>
@ -3563,11 +3757,11 @@
<property name="window_style"></property>
</object>
</object>
<object class="sizeritem" expanded="1">
<object class="sizeritem" expanded="0">
<property name="border">5</property>
<property name="flag">wxBOTTOM|wxRIGHT|wxLEFT</property>
<property name="proportion">0</property>
<object class="wxCheckBox" expanded="1">
<object class="wxCheckBox" expanded="0">
<property name="BottomDockable">1</property>
<property name="LeftDockable">1</property>
<property name="RightDockable">1</property>

View File

@ -1,5 +1,5 @@
///////////////////////////////////////////////////////////////////////////
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b)
// C++ code generated with wxFormBuilder (version 3.10.1-0-g8feb16b3)
// http://www.wxformbuilder.org/
//
// PLEASE DO *NOT* EDIT THIS FILE!
@ -21,10 +21,10 @@
#include <wx/sizer.h>
#include <wx/stattext.h>
#include <wx/textctrl.h>
#include <wx/choice.h>
#include <wx/statbox.h>
#include <wx/radiobox.h>
#include <wx/panel.h>
#include <wx/choice.h>
#include <wx/radiobut.h>
#include <wx/simplebook.h>
@ -38,6 +38,7 @@ class PANEL_EDIT_OPTIONS_BASE : public RESETTABLE_PANEL
private:
protected:
wxBoxSizer* m_sizerBoardEdit;
wxCheckBox* m_flipLeftRight;
wxCheckBox* m_allowFreePads;
wxStaticLine* m_staticline3;
@ -45,6 +46,9 @@ class PANEL_EDIT_OPTIONS_BASE : public RESETTABLE_PANEL
wxStaticText* m_rotationAngleLabel;
wxTextCtrl* m_rotationAngleCtrl;
wxStaticText* m_rotationAngleUnits;
wxStaticLine* m_staticline4;
wxStaticText* m_arcEditModeLabel;
wxChoice* m_arcEditMode;
wxStaticBoxSizer* m_mouseCmdsWinLin;
wxStaticText* m_staticText181;
wxRadioBox* m_rbCtrlClickAction;

View File

@ -1186,6 +1186,19 @@ void FOOTPRINT_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( PCB_ACTIONS::repairFootprint, ENABLE( haveFootprintCond ) );
mgr->SetConditions( PCB_ACTIONS::cleanupGraphics, ENABLE( haveFootprintCond ) );
auto isArcKeepCenterMode = [this]( const SELECTION& )
{
return GetSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS;
};
auto isArcKeepEndpointMode = [this]( const SELECTION& )
{
return GetSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION;
};
mgr->SetConditions( PCB_ACTIONS::pointEditorArcKeepCenter, CHECK( isArcKeepCenterMode ) );
mgr->SetConditions( PCB_ACTIONS::pointEditorArcKeepEndpoint, CHECK( isArcKeepEndpointMode ) );
// Only enable a tool if the part is edtable
#define CURRENT_EDIT_TOOL( action ) mgr->SetConditions( action, \

View File

@ -46,6 +46,7 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
m_PolarCoords( false ),
m_RotationAngle( ANGLE_90 ),
m_Use45Limit( true ),
m_ArcEditMode( ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS ),
m_LibWidth( 250 ),
m_LastImportExportPath(),
m_FootprintTextShownColumns()

View File

@ -817,6 +817,20 @@ void PCB_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( PCB_ACTIONS::showProperties, CHECK( propertiesCond ) );
mgr->SetConditions( PCB_ACTIONS::showSearch, CHECK( searchPaneCond ) );
auto isArcKeepCenterMode = [this]( const SELECTION& )
{
return GetPcbNewSettings()->m_ArcEditMode == ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS;
};
auto isArcKeepEndpointMode = [this]( const SELECTION& )
{
return GetPcbNewSettings()->m_ArcEditMode
== ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION;
};
mgr->SetConditions( PCB_ACTIONS::pointEditorArcKeepCenter, CHECK( isArcKeepCenterMode ) );
mgr->SetConditions( PCB_ACTIONS::pointEditorArcKeepEndpoint, CHECK( isArcKeepEndpointMode ) );
auto isHighlightMode =
[this]( const SELECTION& )
{

View File

@ -67,6 +67,7 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
m_FootprintWizard(),
m_Display(),
m_TrackDragAction( TRACK_DRAG_ACTION::DRAG ),
m_ArcEditMode( ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS ),
m_CtrlClickHighlight( false ),
m_Use45DegreeLimit( false ),
m_FlipLeftRight( false ),
@ -153,6 +154,10 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
reinterpret_cast<int*>( &m_TrackDragAction ),
static_cast<int>( TRACK_DRAG_ACTION::DRAG ) ) );
m_params.emplace_back( new PARAM<int>( "editing.arc_edit_mode",
reinterpret_cast<int*>( &m_ArcEditMode ),
static_cast<int>( ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS ) ) );
m_params.emplace_back( new PARAM<bool>( "editing.ctrl_click_highlight",
&m_CtrlClickHighlight, false ) );

View File

@ -374,6 +374,8 @@ public:
TRACK_DRAG_ACTION m_TrackDragAction;
ARC_EDIT_MODE m_ArcEditMode;
bool m_CtrlClickHighlight;
bool m_Use45DegreeLimit; // True to constrain tool actions to horizontal,

View File

@ -195,6 +195,20 @@ void FOOTPRINT_EDIT_FRAME::ReCreateVToolbar()
m_drawToolBar->Add( PCB_ACTIONS::gridSetOrigin, ACTION_TOOLBAR::TOGGLE );
m_drawToolBar->Add( ACTIONS::measureTool, ACTION_TOOLBAR::TOGGLE );
PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_SELECTION_TOOL>();
auto makeArcMenu = [&]()
{
std::unique_ptr<ACTION_MENU> arcMenu = std::make_unique<ACTION_MENU>( false, selTool );
arcMenu->Add( PCB_ACTIONS::pointEditorArcKeepCenter, ACTION_MENU::CHECK );
arcMenu->Add( PCB_ACTIONS::pointEditorArcKeepEndpoint, ACTION_MENU::CHECK );
return arcMenu;
};
m_drawToolBar->AddToolContextMenu( PCB_ACTIONS::drawArc, makeArcMenu() );
m_drawToolBar->KiRealize();
}

View File

@ -477,11 +477,21 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
PCB_SELECTION_TOOL* selTool = m_toolManager->GetTool<PCB_SELECTION_TOOL>();
auto makeRouteMenu =
[&]()
auto makeArcMenu = [&]()
{
std::unique_ptr<ACTION_MENU> routeMenu =
std::make_unique<ACTION_MENU>( false, selTool );
std::unique_ptr<ACTION_MENU> arcMenu = std::make_unique<ACTION_MENU>( false, selTool );
arcMenu->Add( PCB_ACTIONS::pointEditorArcKeepCenter, ACTION_MENU::CHECK );
arcMenu->Add( PCB_ACTIONS::pointEditorArcKeepEndpoint, ACTION_MENU::CHECK );
return arcMenu;
};
m_drawToolBar->AddToolContextMenu( PCB_ACTIONS::drawArc, makeArcMenu() );
auto makeRouteMenu = [&]()
{
std::unique_ptr<ACTION_MENU> routeMenu = std::make_unique<ACTION_MENU>( false, selTool );
routeMenu->Add( PCB_ACTIONS::routerHighlightMode, ACTION_MENU::CHECK );
routeMenu->Add( PCB_ACTIONS::routerShoveMode, ACTION_MENU::CHECK );

View File

@ -1251,6 +1251,18 @@ TOOL_ACTION PCB_ACTIONS::pointEditorRemoveCorner( "pcbnew.PointEditor.removeCorn
_( "Remove Corner" ), _( "Remove corner" ),
BITMAPS::delete_cursor );
TOOL_ACTION PCB_ACTIONS::pointEditorArcKeepCenter( "pcbnew.PointEditor.arcKeepCenter",
AS_GLOBAL, 0, "",
_( "Keep arc center, adjust radius" ),
_( "Switch arc editing mode to keep center, adjust radius and endpoints" ),
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS );
TOOL_ACTION PCB_ACTIONS::pointEditorArcKeepEndpoint( "pcbnew.PointEditor.arcKeepEndpoint",
AS_GLOBAL, 0, "",
_( "Keep arc endpoints or direction of starting point" ),
_( "Switch arc editing mode to keep endpoints, or to keep direction of the other point" ),
BITMAPS::INVALID_BITMAP, AF_NONE, (void*) ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION );
// GROUP_TOOL
//

View File

@ -245,6 +245,10 @@ public:
static TOOL_ACTION pointEditorAddCorner;
static TOOL_ACTION pointEditorRemoveCorner;
static TOOL_ACTION pointEditorArcKeepCenter;
static TOOL_ACTION pointEditorArcKeepEndpoint;
// Group Tool
static TOOL_ACTION groupProperties;
static TOOL_ACTION pickNewGroupMember;

View File

@ -110,7 +110,7 @@ PCB_POINT_EDITOR::PCB_POINT_EDITOR() :
m_hoveredPoint( nullptr ),
m_original( VECTOR2I( 0, 0 ) ),
m_refill( false ),
m_altEditMethod( false ),
m_arcEditMode( ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS ),
m_altConstrainer( VECTOR2I( 0, 0 ) )
{
}
@ -504,9 +504,15 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
grid.SetUseGrid( getView()->GetGAL()->GetGridSnapping() && !evt->DisableGridSnapping() );
if( editFrame->IsType( FRAME_PCB_EDITOR ) )
{
useAltContraint = editFrame->GetPcbNewSettings()->m_Use45DegreeLimit;
m_arcEditMode = editFrame->GetPcbNewSettings()->m_ArcEditMode;
}
else
{
useAltContraint = editFrame->GetFootprintEditorSettings()->m_Use45Limit;
m_arcEditMode = editFrame->GetFootprintEditorSettings()->m_ArcEditMode;
}
if( !m_editPoints || evt->IsSelectionEvent() ||
evt->Matches( EVENTS::InhibitSelectionEditing ) )
@ -1158,7 +1164,7 @@ void PCB_POINT_EDITOR::updateItem() const
{
const VECTOR2I& cursorPos = getViewControls()->GetCursorPosition( false );
if( m_altEditMethod )
if( m_arcEditMode == ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION )
editArcMidKeepEndpoints( shape, start, end, cursorPos );
else
editArcMidKeepCenter( shape, center, start, mid, end, cursorPos );
@ -1168,7 +1174,7 @@ void PCB_POINT_EDITOR::updateItem() const
{
const VECTOR2I& cursorPos = getViewControls()->GetCursorPosition();
if( m_altEditMethod )
if( m_arcEditMode == ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION )
editArcEndpointKeepTangent( shape, center, start, mid, end, cursorPos );
else
editArcEndpointKeepCenter( shape, center, start, mid, end, cursorPos );
@ -2364,9 +2370,37 @@ int PCB_POINT_EDITOR::modifiedSelection( const TOOL_EVENT& aEvent )
}
int PCB_POINT_EDITOR::changeEditMethod( const TOOL_EVENT& aEvent )
int PCB_POINT_EDITOR::changeArcEditMode( const TOOL_EVENT& aEvent )
{
m_altEditMethod = !m_altEditMethod;
PCB_BASE_EDIT_FRAME* editFrame = getEditFrame<PCB_BASE_EDIT_FRAME>();
if( aEvent.Matches( ACTIONS::cycleArcEditMode.MakeEvent() ) )
{
if( editFrame->IsType( FRAME_PCB_EDITOR ) )
m_arcEditMode = editFrame->GetPcbNewSettings()->m_ArcEditMode;
else
m_arcEditMode = editFrame->GetFootprintEditorSettings()->m_ArcEditMode;
switch( m_arcEditMode )
{
case ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS:
m_arcEditMode = ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION;
break;
case ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION:
m_arcEditMode = ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS;
break;
}
}
else
{
m_arcEditMode = aEvent.Parameter<ARC_EDIT_MODE>();
}
if( editFrame->IsType( FRAME_PCB_EDITOR ) )
editFrame->GetPcbNewSettings()->m_ArcEditMode = m_arcEditMode;
else
editFrame->GetFootprintEditorSettings()->m_ArcEditMode = m_arcEditMode;
return 0;
}
@ -2375,13 +2409,14 @@ void PCB_POINT_EDITOR::setTransitions()
{
Go( &PCB_POINT_EDITOR::OnSelectionChange, ACTIONS::activatePointEditor.MakeEvent() );
Go( &PCB_POINT_EDITOR::addCorner, PCB_ACTIONS::pointEditorAddCorner.MakeEvent() );
Go( &PCB_POINT_EDITOR::removeCorner, PCB_ACTIONS::pointEditorRemoveCorner.MakeEvent() );
Go( &PCB_POINT_EDITOR::changeArcEditMode, PCB_ACTIONS::pointEditorArcKeepCenter.MakeEvent() );
Go( &PCB_POINT_EDITOR::changeArcEditMode, PCB_ACTIONS::pointEditorArcKeepEndpoint.MakeEvent() );
Go( &PCB_POINT_EDITOR::changeArcEditMode, ACTIONS::cycleArcEditMode.MakeEvent() );
Go( &PCB_POINT_EDITOR::modifiedSelection, EVENTS::SelectedItemsModified );
Go( &PCB_POINT_EDITOR::modifiedSelection, EVENTS::SelectedItemsMoved );
Go( &PCB_POINT_EDITOR::OnSelectionChange, EVENTS::PointSelectedEvent );
Go( &PCB_POINT_EDITOR::OnSelectionChange, EVENTS::SelectedEvent );
Go( &PCB_POINT_EDITOR::OnSelectionChange, EVENTS::UnselectedEvent );
Go( &PCB_POINT_EDITOR::changeEditMethod, ACTIONS::changeEditMethod.MakeEvent() );
Go( &PCB_POINT_EDITOR::OnSelectionChange, EVENTS::InhibitSelectionEditing );
Go( &PCB_POINT_EDITOR::OnSelectionChange, EVENTS::UninhibitSelectionEditing );
}

View File

@ -29,6 +29,7 @@
#include <tool/tool_interactive.h>
#include "tool/edit_points.h"
#include <pcbnew_settings.h>
#include <status_popup.h>
#include <memory>
@ -159,8 +160,8 @@ private:
const VECTOR2I& aMid, const VECTOR2I& aEnd,
const VECTOR2I& aCursor ) const;
///< Change the edit method to an alternative method ( currently, arcs only )
int changeEditMethod( const TOOL_EVENT& aEvent );
///< Change the edit method for arcs.
int changeArcEditMode( const TOOL_EVENT& aEvent );
PCB_SELECTION_TOOL* m_selectionTool;
mutable std::unique_ptr<STATUS_TEXT_POPUP> m_statusPopup;
@ -172,7 +173,8 @@ private:
EDIT_POINT m_original; ///< Original position for the current drag point.
bool m_refill;
bool m_altEditMethod;
ARC_EDIT_MODE m_arcEditMode;
// Alternative constraint, enabled while a modifier key is held
std::shared_ptr<EDIT_CONSTRAINT<EDIT_POINT>> m_altConstraint;