mirror of
https://gitlab.com/kicad/code/kicad.git
synced 2025-09-14 02:03:12 +02:00
Eeschema: make arc edit mode user-selectable
For now, this is a preferences choicebox, same as Pcbnew. Making the mode-switch more discoverable and fluent is a sepearate issue (https://gitlab.com/kicad/code/kicad/-/issues/20824). Relates-To: https://gitlab.com/kicad/code/kicad/-/issues/18781
This commit is contained in:
parent
4def9d8daf
commit
8ce0149e7f
@ -31,6 +31,42 @@
|
||||
#include <widgets/ui_common.h>
|
||||
|
||||
|
||||
static int arcEditModeToComboIndex( ARC_EDIT_MODE aMode )
|
||||
{
|
||||
switch( aMode )
|
||||
{
|
||||
case ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS:
|
||||
return 0;
|
||||
case ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION:
|
||||
return 1;
|
||||
case ARC_EDIT_MODE::KEEP_CENTER_ENDS_ADJUST_ANGLE:
|
||||
return 2;
|
||||
// No default
|
||||
}
|
||||
wxFAIL_MSG( "Invalid ARC_EDIT_MODE" );
|
||||
return 0;
|
||||
};
|
||||
|
||||
|
||||
static ARC_EDIT_MODE arcEditModeToEnum( int aIndex )
|
||||
{
|
||||
switch( aIndex )
|
||||
{
|
||||
case 0:
|
||||
return ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS;
|
||||
case 1:
|
||||
return ARC_EDIT_MODE::KEEP_ENDPOINTS_OR_START_DIRECTION;
|
||||
case 2:
|
||||
return ARC_EDIT_MODE::KEEP_CENTER_ENDS_ADJUST_ANGLE;
|
||||
default:
|
||||
wxFAIL_MSG( wxString::Format( "Invalid index for ARC_EDIT_MODE: %d", aIndex ) );
|
||||
break;
|
||||
}
|
||||
|
||||
return ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS;
|
||||
};
|
||||
|
||||
|
||||
PANEL_EESCHEMA_EDITING_OPTIONS::PANEL_EESCHEMA_EDITING_OPTIONS( wxWindow* aWindow,
|
||||
UNITS_PROVIDER* aUnitsProvider,
|
||||
wxWindow* aEventSource ) :
|
||||
@ -77,6 +113,7 @@ void PANEL_EESCHEMA_EDITING_OPTIONS::loadEEschemaSettings( EESCHEMA_SETTINGS* aC
|
||||
false );
|
||||
|
||||
m_choiceLineMode->SetSelection( aCfg->m_Drawing.line_mode );
|
||||
m_choiceArcMode->SetSelection( arcEditModeToComboIndex( aCfg->m_Drawing.arc_edit_mode ) );
|
||||
m_footprintPreview->SetValue( aCfg->m_Appearance.footprint_preview );
|
||||
m_neverShowRescue->SetValue( aCfg->m_RescueNeverShow );
|
||||
|
||||
@ -119,6 +156,7 @@ bool PANEL_EESCHEMA_EDITING_OPTIONS::TransferDataFromWindow()
|
||||
cfg->m_Drawing.repeat_label_increment = m_spinLabelRepeatStep->GetValue();
|
||||
|
||||
cfg->m_Drawing.line_mode = m_choiceLineMode->GetSelection();
|
||||
cfg->m_Drawing.arc_edit_mode = arcEditModeToEnum( m_choiceArcMode->GetSelection() );
|
||||
cfg->m_Appearance.footprint_preview = m_footprintPreview->GetValue();
|
||||
cfg->m_RescueNeverShow = m_neverShowRescue->GetValue();
|
||||
|
||||
@ -142,5 +180,3 @@ void PANEL_EESCHEMA_EDITING_OPTIONS::ResetPanel()
|
||||
|
||||
loadEEschemaSettings( &cfg );
|
||||
}
|
||||
|
||||
|
||||
|
@ -43,6 +43,16 @@ PANEL_EESCHEMA_EDITING_OPTIONS_BASE::PANEL_EESCHEMA_EDITING_OPTIONS_BASE( wxWind
|
||||
|
||||
bSizer5->Add( bSizer61, 1, wxEXPAND, 5 );
|
||||
|
||||
m_staticTextArcEdit = new wxStaticText( this, wxID_ANY, _("Arc editing mode:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticTextArcEdit->Wrap( -1 );
|
||||
bSizer5->Add( m_staticTextArcEdit, 0, wxALL, 5 );
|
||||
|
||||
wxString m_choiceArcModeChoices[] = { _("Keep center, adjust radius"), _("Keep endpoints or direction of starting point"), _("Keep center and radius, adjust endpoints") };
|
||||
int m_choiceArcModeNChoices = sizeof( m_choiceArcModeChoices ) / sizeof( wxString );
|
||||
m_choiceArcMode = new wxChoice( this, wxID_ANY, wxDefaultPosition, wxDefaultSize, m_choiceArcModeNChoices, m_choiceArcModeChoices, 0 );
|
||||
m_choiceArcMode->SetSelection( 1 );
|
||||
bSizer5->Add( m_choiceArcMode, 0, wxALL|wxEXPAND, 5 );
|
||||
|
||||
m_mouseDragIsDrag = new wxCheckBox( this, wxID_ANY, _("Mouse drag performs Drag (G) operation"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_mouseDragIsDrag->SetToolTip( _("If unchecked, mouse drag will perform move (M) operation") );
|
||||
|
||||
|
@ -337,6 +337,133 @@
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</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="drag_accept_files">0</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_staticTextArcEdit</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="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL|wxEXPAND</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxChoice" expanded="true">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
<property name="TopDockable">1</property>
|
||||
<property name="aui_layer">0</property>
|
||||
<property name="aui_name"></property>
|
||||
<property name="aui_position">0</property>
|
||||
<property name="aui_row">0</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">"Keep center, adjust radius" "Keep endpoints or direction of starting point" "Keep center and radius, adjust endpoints"</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="drag_accept_files">0</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_choiceArcMode</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">1</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 class="sizeritem" expanded="true">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxLEFT|wxRIGHT|wxTOP</property>
|
||||
|
@ -42,6 +42,8 @@ class PANEL_EESCHEMA_EDITING_OPTIONS_BASE : public RESETTABLE_PANEL
|
||||
wxStaticLine* m_staticline3;
|
||||
wxStaticText* m_staticText24;
|
||||
wxChoice* m_choiceLineMode;
|
||||
wxStaticText* m_staticTextArcEdit;
|
||||
wxChoice* m_choiceArcMode;
|
||||
wxCheckBox* m_mouseDragIsDrag;
|
||||
wxCheckBox* m_cbAutoStartWires;
|
||||
wxCheckBox* m_escClearsNetHighlight;
|
||||
|
@ -359,6 +359,10 @@ EESCHEMA_SETTINGS::EESCHEMA_SETTINGS() :
|
||||
m_params.emplace_back( new PARAM<int>( "drawing.line_mode", &m_Drawing.line_mode,
|
||||
LINE_MODE::LINE_MODE_90 ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "editing.arc_edit_mode",
|
||||
reinterpret_cast<int*>( &m_Drawing.arc_edit_mode ),
|
||||
static_cast<int>( ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS ) ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "drawing.auto_start_wires",
|
||||
&m_Drawing.auto_start_wires, true ) );
|
||||
|
||||
|
@ -168,6 +168,7 @@ public:
|
||||
POWER_SYMBOLS new_power_symbols;
|
||||
wxString field_names;
|
||||
int line_mode;
|
||||
ARC_EDIT_MODE arc_edit_mode;
|
||||
int repeat_label_increment;
|
||||
bool intersheets_ref_show;
|
||||
bool intersheets_ref_own_page;
|
||||
|
@ -853,7 +853,7 @@ void SCH_POINT_EDITOR::makePointsAndBehavior( EDA_ITEM* aItem )
|
||||
{
|
||||
case SHAPE_T::ARC:
|
||||
m_editBehavior = std::make_unique<EDA_ARC_POINT_EDIT_BEHAVIOR>(
|
||||
*shape, ARC_EDIT_MODE::KEEP_CENTER_ADJUST_ANGLE_RADIUS, *getViewControls() );
|
||||
*shape, m_frame->eeconfig()->m_Drawing.arc_edit_mode, *getViewControls() );
|
||||
break;
|
||||
case SHAPE_T::CIRCLE:
|
||||
m_editBehavior = std::make_unique<EDA_CIRCLE_POINT_EDIT_BEHAVIOR>( *shape );
|
||||
|
Loading…
x
Reference in New Issue
Block a user