ADDED: Setting to control track mouse drag behavior
Default is now to perform a 45-degree drag
This commit is contained in:
parent
55e283634a
commit
c0175c48af
|
@ -73,6 +73,13 @@ bool PANEL_EDIT_OPTIONS::TransferDataToWindow()
|
|||
m_FlipLeftRight->SetValue( general_opts.m_FlipLeftRight );
|
||||
|
||||
m_Show_Page_Limits->SetValue( m_Frame->ShowPageLimits() );
|
||||
|
||||
switch( general_opts.m_TrackDragAction )
|
||||
{
|
||||
case TRACK_DRAG_ACTION::MOVE: m_rbTrackDragMove->SetValue( true ); break;
|
||||
case TRACK_DRAG_ACTION::DRAG: m_rbTrackDrag45->SetValue( true ); break;
|
||||
case TRACK_DRAG_ACTION::DRAG_FREE_ANGLE: m_rbTrackDragFree->SetValue( true ); break;
|
||||
}
|
||||
}
|
||||
else if( dynamic_cast<FOOTPRINT_EDIT_FRAME*>( m_Frame ) )
|
||||
{
|
||||
|
@ -104,6 +111,18 @@ bool PANEL_EDIT_OPTIONS::TransferDataFromWindow()
|
|||
|
||||
m_Frame->SetShowPageLimits( m_Show_Page_Limits->GetValue() );
|
||||
|
||||
if( dynamic_cast<PCB_EDIT_FRAME*>( m_Frame ) )
|
||||
{
|
||||
PCBNEW_SETTINGS& settings = m_Frame->Settings();
|
||||
|
||||
if( m_rbTrackDragMove->GetValue() )
|
||||
settings.m_TrackDragAction = TRACK_DRAG_ACTION::MOVE;
|
||||
else if( m_rbTrackDrag45->GetValue() )
|
||||
settings.m_TrackDragAction = TRACK_DRAG_ACTION::DRAG;
|
||||
else if( m_rbTrackDragFree->GetValue() )
|
||||
settings.m_TrackDragAction = TRACK_DRAG_ACTION::DRAG_FREE_ANGLE;
|
||||
}
|
||||
|
||||
// Apply changes to the GAL
|
||||
PCB_DISPLAY_OPTIONS displ_opts = m_Frame->GetDisplayOptions();
|
||||
KIGFX::VIEW* view = m_Frame->GetCanvas()->GetView();
|
||||
|
|
|
@ -164,6 +164,33 @@ PANEL_EDIT_OPTIONS_BASE::PANEL_EDIT_OPTIONS_BASE( wxWindow* parent, wxWindowID i
|
|||
|
||||
pcbOptionsSizer->Add( sbSizer4, 0, wxEXPAND|wxTOP, 5 );
|
||||
|
||||
wxStaticBoxSizer* sbSizer41;
|
||||
sbSizer41 = new wxStaticBoxSizer( new wxStaticBox( pcbPage, wxID_ANY, _("Track Editing") ), wxVERTICAL );
|
||||
|
||||
m_staticText5 = new wxStaticText( sbSizer41->GetStaticBox(), wxID_ANY, _("Track mouse drag behavior:"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_staticText5->Wrap( -1 );
|
||||
m_staticText5->SetToolTip( _("Choose the action to perform when dragging a track segment with the mouse") );
|
||||
|
||||
sbSizer41->Add( m_staticText5, 0, wxALL, 5 );
|
||||
|
||||
m_rbTrackDragMove = new wxRadioButton( sbSizer41->GetStaticBox(), wxID_ANY, _("Move"), wxDefaultPosition, wxDefaultSize, wxRB_GROUP );
|
||||
m_rbTrackDragMove->SetToolTip( _("Moves the track segment without moving connected tracks") );
|
||||
|
||||
sbSizer41->Add( m_rbTrackDragMove, 0, wxALL, 5 );
|
||||
|
||||
m_rbTrackDrag45 = new wxRadioButton( sbSizer41->GetStaticBox(), wxID_ANY, _("Drag (45 degree mode)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_rbTrackDrag45->SetToolTip( _("Drags the track segment while keeping connected tracks at 45 degrees.") );
|
||||
|
||||
sbSizer41->Add( m_rbTrackDrag45, 0, wxALL, 5 );
|
||||
|
||||
m_rbTrackDragFree = new wxRadioButton( sbSizer41->GetStaticBox(), wxID_ANY, _("Drag (free angle)"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_rbTrackDragFree->SetToolTip( _("Drags the nearest joint in the track without restricting the track angle.") );
|
||||
|
||||
sbSizer41->Add( m_rbTrackDragFree, 0, wxALL, 5 );
|
||||
|
||||
|
||||
pcbOptionsSizer->Add( sbSizer41, 1, wxEXPAND|wxTOP, 5 );
|
||||
|
||||
|
||||
pcbPage->SetSizer( pcbOptionsSizer );
|
||||
pcbPage->Layout();
|
||||
|
|
|
@ -1416,6 +1416,273 @@
|
|||
</object>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxEXPAND|wxTOP</property>
|
||||
<property name="proportion">1</property>
|
||||
<object class="wxStaticBoxSizer" expanded="1">
|
||||
<property name="id">wxID_ANY</property>
|
||||
<property name="label">Track Editing</property>
|
||||
<property name="minimum_size"></property>
|
||||
<property name="name">sbSizer41</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="parent">1</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALL</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">Track mouse drag behavior:</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_staticText5</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">Choose the action to perform when dragging a track segment with the mouse</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">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxRadioButton" 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">Move</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_rbTrackDragMove</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">wxRB_GROUP</property>
|
||||
<property name="subclass">; ; forward_declare</property>
|
||||
<property name="toolbar_pane">0</property>
|
||||
<property name="tooltip">Moves the track segment without moving connected tracks</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="value">0</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">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxRadioButton" 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">Drag (45 degree mode)</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_rbTrackDrag45</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">Drags the track segment while keeping connected tracks at 45 degrees.</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="value">0</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">wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxRadioButton" 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">Drag (free angle)</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_rbTrackDragFree</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">Drags the nearest joint in the track without restricting the track angle.</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="value">0</property>
|
||||
<property name="window_extra_style"></property>
|
||||
<property name="window_name"></property>
|
||||
<property name="window_style"></property>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
</object>
|
||||
|
|
|
@ -23,6 +23,7 @@
|
|||
#include <wx/statbox.h>
|
||||
#include <wx/panel.h>
|
||||
#include <wx/choice.h>
|
||||
#include <wx/radiobut.h>
|
||||
#include <wx/simplebook.h>
|
||||
|
||||
///////////////////////////////////////////////////////////////////////////
|
||||
|
@ -60,6 +61,10 @@ class PANEL_EDIT_OPTIONS_BASE : public wxPanel
|
|||
wxCheckBox* m_showSelectedRatsnest;
|
||||
wxCheckBox* m_OptDisplayCurvedRatsnestLines;
|
||||
wxCheckBox* m_Show_Page_Limits;
|
||||
wxStaticText* m_staticText5;
|
||||
wxRadioButton* m_rbTrackDragMove;
|
||||
wxRadioButton* m_rbTrackDrag45;
|
||||
wxRadioButton* m_rbTrackDragFree;
|
||||
|
||||
public:
|
||||
|
||||
|
|
|
@ -111,6 +111,10 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
|
|||
|
||||
m_params.emplace_back( new PARAM<bool>( "editing.polar_coords", &m_PolarCoords, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<int>( "editing.track_drag_action",
|
||||
reinterpret_cast<int*>( &m_TrackDragAction ),
|
||||
static_cast<int>( TRACK_DRAG_ACTION::DRAG ) ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "editing.use_45_degree_graphic_segments",
|
||||
&m_Use45DegreeGraphicSegments, false ) );
|
||||
|
||||
|
|
|
@ -50,6 +50,13 @@ struct MAGNETIC_SETTINGS
|
|||
}
|
||||
};
|
||||
|
||||
enum class TRACK_DRAG_ACTION
|
||||
{
|
||||
MOVE,
|
||||
DRAG,
|
||||
DRAG_FREE_ANGLE
|
||||
};
|
||||
|
||||
#if defined(KICAD_SCRIPTING) && defined(KICAD_SCRIPTING_ACTION_MENU)
|
||||
typedef std::vector<std::pair<wxString, bool>> ACTION_PLUGIN_SETTINGS_LIST;
|
||||
#endif
|
||||
|
@ -242,6 +249,8 @@ public:
|
|||
|
||||
MAGNETIC_SETTINGS m_MagneticItems;
|
||||
|
||||
TRACK_DRAG_ACTION m_TrackDragAction;
|
||||
|
||||
bool m_Use45DegreeGraphicSegments; // True to constraint graphic lines to horizontal,
|
||||
// vertical and 45º
|
||||
bool m_FlipLeftRight; // True: Flip footprints across Y axis
|
||||
|
|
|
@ -43,6 +43,7 @@ using namespace std::placeholders;
|
|||
#include <preview_items/selection_area.h>
|
||||
#include <painter.h>
|
||||
#include <bitmaps.h>
|
||||
#include <pcbnew_settings.h>
|
||||
#include <tool/tool_event.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <router/router_tool.h>
|
||||
|
@ -191,6 +192,7 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
m_frame->GetCanvas()->SetCurrentCursor( wxCURSOR_ARROW );
|
||||
|
||||
bool dragAlwaysSelects = getEditFrame<PCB_BASE_FRAME>()->GetDragSelects();
|
||||
TRACK_DRAG_ACTION dragAction = getEditFrame<PCB_BASE_FRAME>()->Settings().m_TrackDragAction;
|
||||
m_additive = m_subtractive = m_exclusive_or = false;
|
||||
|
||||
// OSX uses CTRL for context menu, and SHIFT is exclusive-or
|
||||
|
@ -266,7 +268,14 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
|
|||
if( selectionContains( evt->Position() ) )
|
||||
{
|
||||
// Yes -> run the move tool and wait till it finishes
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::drag, true );
|
||||
TRACK* track = dynamic_cast<TRACK*>( m_selection.GetItem( 0 ) );
|
||||
|
||||
if( track && dragAction == TRACK_DRAG_ACTION::DRAG )
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::drag45Degree, true );
|
||||
else if( track && dragAction == TRACK_DRAG_ACTION::DRAG_FREE_ANGLE )
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::dragFreeAngle, true );
|
||||
else
|
||||
m_toolMgr->RunAction( PCB_ACTIONS::drag, true );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue