Move 45° limit to hotkey
This assigns the "Tab" key to a general pcbnew 45° limitation. Limit can be enabled/disabled using context menu as well. Removed the user preference for 45° limitation on graphic lines as that is overlapping with the general limitation, which is not an editing preference so much as a temporary adjustment to tool action. Related to https://gitlab.com/kicad/code/kicad/-/issues/8490
This commit is contained in:
parent
69a31f41b8
commit
092cdc0bb5
|
@ -56,8 +56,7 @@ public:
|
|||
|
||||
bool m_PolarCoords;
|
||||
|
||||
bool m_Use45DegreeGraphicSegments; // True to constraint graphic lines to horizontal,
|
||||
// vertical and 45º
|
||||
bool m_Use45Limit;
|
||||
|
||||
int m_LibWidth;
|
||||
|
||||
|
|
|
@ -59,8 +59,6 @@ bool PANEL_EDIT_OPTIONS::TransferDataToWindow()
|
|||
const PCB_DISPLAY_OPTIONS& displ_opts = m_frame->GetDisplayOptions();
|
||||
const PCBNEW_SETTINGS& general_opts = m_frame->Settings();
|
||||
|
||||
m_segments45OnlyCtrl->SetValue( general_opts.m_Use45DegreeGraphicSegments );
|
||||
|
||||
wxString rotationAngle;
|
||||
rotationAngle = AngleToStringDegrees( (double) m_frame->GetRotationAngle() );
|
||||
m_rotationAngle->SetValue( rotationAngle );
|
||||
|
@ -108,8 +106,6 @@ bool PANEL_EDIT_OPTIONS::TransferDataFromWindow()
|
|||
|
||||
m_frame->SetRotationAngle( wxRound( 10.0 * wxAtof( m_rotationAngle->GetValue() ) ) );
|
||||
|
||||
m_frame->Settings().m_Use45DegreeGraphicSegments = m_segments45OnlyCtrl->GetValue();
|
||||
|
||||
if( dynamic_cast<PCB_EDIT_FRAME*>( m_frame ) )
|
||||
{
|
||||
PCBNEW_SETTINGS& pcbnewSettings = m_frame->Settings();
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// C++ code generated with wxFormBuilder (version 3.9.0 Apr 22 2021)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -47,11 +47,6 @@ PANEL_EDIT_OPTIONS_BASE::PANEL_EDIT_OPTIONS_BASE( wxWindow* parent, wxWindowID i
|
|||
wxBoxSizer* bSizerUniversal;
|
||||
bSizerUniversal = new wxBoxSizer( wxVERTICAL );
|
||||
|
||||
m_segments45OnlyCtrl = new wxCheckBox( bOptionsSizer->GetStaticBox(), wxID_SEGMENTS45, _("L&imit graphic lines to H, V and 45 degrees"), wxDefaultPosition, wxDefaultSize, 0 );
|
||||
m_segments45OnlyCtrl->SetToolTip( _("When drawing graphic lines force to horizontal, vertical, or 45 degrees.") );
|
||||
|
||||
bSizerUniversal->Add( m_segments45OnlyCtrl, 0, wxBOTTOM, 3 );
|
||||
|
||||
wxBoxSizer* bSizerRotationStep;
|
||||
bSizerRotationStep = new wxBoxSizer( wxHORIZONTAL );
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@
|
|||
<property name="file">panel_edit_options_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">PanelEditOptions</property>
|
||||
|
@ -25,6 +26,7 @@
|
|||
<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">
|
||||
|
@ -307,70 +309,6 @@
|
|||
<property name="name">bSizerUniversal</property>
|
||||
<property name="orient">wxVERTICAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<property name="border">3</property>
|
||||
<property name="flag">wxBOTTOM</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_SEGMENTS45</property>
|
||||
<property name="label">L&imit graphic lines to H, V and 45 degrees</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_segments45OnlyCtrl</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 drawing graphic lines force to horizontal, vertical, or 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="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">wxEXPAND</property>
|
||||
|
@ -380,11 +318,11 @@
|
|||
<property name="name">bSizerRotationStep</property>
|
||||
<property name="orient">wxHORIZONTAL</property>
|
||||
<property name="permission">none</property>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxTOP|wxBOTTOM|wxRIGHT</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -441,11 +379,11 @@
|
|||
<property name="wrap">-1</property>
|
||||
</object>
|
||||
</object>
|
||||
<object class="sizeritem" expanded="1">
|
||||
<object class="sizeritem" expanded="0">
|
||||
<property name="border">5</property>
|
||||
<property name="flag">wxALIGN_CENTER_VERTICAL|wxALL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxTextCtrl" expanded="1">
|
||||
<object class="wxTextCtrl" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
@ -505,11 +443,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">wxTOP|wxBOTTOM|wxRIGHT|wxALIGN_CENTER_VERTICAL</property>
|
||||
<property name="proportion">0</property>
|
||||
<object class="wxStaticText" expanded="1">
|
||||
<object class="wxStaticText" expanded="0">
|
||||
<property name="BottomDockable">1</property>
|
||||
<property name="LeftDockable">1</property>
|
||||
<property name="RightDockable">1</property>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
///////////////////////////////////////////////////////////////////////////
|
||||
// C++ code generated with wxFormBuilder (version Oct 26 2018)
|
||||
// C++ code generated with wxFormBuilder (version 3.9.0 Apr 22 2021)
|
||||
// http://www.wxformbuilder.org/
|
||||
//
|
||||
// PLEASE DO *NOT* EDIT THIS FILE!
|
||||
|
@ -36,15 +36,9 @@ class PANEL_EDIT_OPTIONS_BASE : public wxPanel
|
|||
private:
|
||||
|
||||
protected:
|
||||
enum
|
||||
{
|
||||
wxID_SEGMENTS45 = 1000
|
||||
};
|
||||
|
||||
wxCheckBox* m_magneticPads;
|
||||
wxCheckBox* m_magneticGraphics;
|
||||
wxCheckBox* m_flipLeftRight;
|
||||
wxCheckBox* m_segments45OnlyCtrl;
|
||||
wxStaticText* m_staticTextRotationAngle;
|
||||
wxTextCtrl* m_rotationAngle;
|
||||
wxStaticText* m_staticText32;
|
||||
|
|
|
@ -44,7 +44,7 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
|
|||
m_Display(),
|
||||
m_UserGrid(),
|
||||
m_PolarCoords( false ),
|
||||
m_Use45DegreeGraphicSegments( true ),
|
||||
m_Use45Limit( true ),
|
||||
m_LibWidth( 250 ),
|
||||
m_LastImportExportPath(),
|
||||
m_FootprintTextShownColumns()
|
||||
|
@ -71,8 +71,8 @@ FOOTPRINT_EDITOR_SETTINGS::FOOTPRINT_EDITOR_SETTINGS() :
|
|||
|
||||
m_params.emplace_back( new PARAM<bool>( "editing.polar_coords", &m_PolarCoords, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "editing.use_45_degree_graphic_segments",
|
||||
&m_Use45DegreeGraphicSegments, false ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "editing.use_45_degree_limit",
|
||||
&m_Use45Limit, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "pcb_display.text_fill",
|
||||
&m_Display.m_DisplayTextFill, true ) );
|
||||
|
|
|
@ -214,7 +214,7 @@ int MICROWAVE_TOOL::drawMicrowaveInductor( const TOOL_EVENT& aEvent )
|
|||
// the end point
|
||||
else if( originSet && ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) )
|
||||
{
|
||||
tpGeomMgr.SetAngleSnap( evt->Modifier( MD_SHIFT ) );
|
||||
tpGeomMgr.SetAngleSnap( Is45Limited() );
|
||||
tpGeomMgr.SetEnd( cursorPos );
|
||||
|
||||
view.SetVisible( &previewRect, true );
|
||||
|
|
|
@ -691,7 +691,7 @@ void PCB_EDIT_FRAME::setupUIConditions()
|
|||
mgr->SetConditions( PCB_ACTIONS::zoneFill, ENABLE( SELECTION_CONDITIONS::MoreThan( 0 ) ) );
|
||||
mgr->SetConditions( PCB_ACTIONS::zoneUnfill, ENABLE( SELECTION_CONDITIONS::MoreThan( 0 ) ) );
|
||||
|
||||
mgr->SetConditions( PCB_ACTIONS::toggleLine45degMode, CHECK( cond.Line45degMode() ) );
|
||||
mgr->SetConditions( PCB_ACTIONS::toggle45, CHECK( cond.Get45degMode() ) );
|
||||
|
||||
#define CURRENT_TOOL( action ) mgr->SetConditions( action, CHECK( cond.CurrentTool( action ) ) )
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
|
|||
m_FootprintWizard(),
|
||||
m_Display(),
|
||||
m_TrackDragAction( TRACK_DRAG_ACTION::DRAG ),
|
||||
m_Use45DegreeGraphicSegments( false ),
|
||||
m_Use45DegreeLimit( false ),
|
||||
m_FlipLeftRight( false ),
|
||||
m_PolarCoords( false ),
|
||||
m_RotationAngle( 900 ),
|
||||
|
@ -124,8 +124,8 @@ PCBNEW_SETTINGS::PCBNEW_SETTINGS()
|
|||
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 ) );
|
||||
m_params.emplace_back( new PARAM<bool>( "editing.use_45_degree_limit",
|
||||
&m_Use45DegreeLimit, false ) );
|
||||
|
||||
m_params.emplace_back( new PARAM<bool>( "editing.auto_fill_zones",
|
||||
&m_AutoRefillZones, true ) );
|
||||
|
|
|
@ -275,8 +275,8 @@ public:
|
|||
|
||||
TRACK_DRAG_ACTION m_TrackDragAction;
|
||||
|
||||
bool m_Use45DegreeGraphicSegments; // True to constraint graphic lines to horizontal,
|
||||
// vertical and 45º
|
||||
bool m_Use45DegreeLimit; // True to constrain tool actions to horizontal,
|
||||
// vertical and 45º
|
||||
bool m_FlipLeftRight; // True: Flip footprints across Y axis
|
||||
// False: Flip footprints across X axis
|
||||
|
||||
|
|
|
@ -1098,7 +1098,6 @@ void ROUTER_TOOL::performRouting()
|
|||
|
||||
if( evt->IsMotion() )
|
||||
{
|
||||
m_router->SetOrthoMode( evt->Modifier( MD_SHIFT ) );
|
||||
updateEndItem( *evt );
|
||||
m_router->Move( m_endSnapPoint, m_endItem );
|
||||
}
|
||||
|
|
|
@ -499,7 +499,6 @@ void PCB_EDIT_FRAME::ReCreateVToolbar()
|
|||
m_drawToolBar->AddToolContextMenu( PCB_ACTIONS::drawZone, std::move( zoneMenu ) );
|
||||
|
||||
std::unique_ptr<ACTION_MENU> lineMenu = std::make_unique<ACTION_MENU>( false, selTool );
|
||||
lineMenu->Add( PCB_ACTIONS::toggleLine45degMode, ACTION_MENU::CHECK );
|
||||
m_drawToolBar->AddToolContextMenu( PCB_ACTIONS::drawLine, std::move( lineMenu ) );
|
||||
|
||||
m_drawToolBar->KiRealize();
|
||||
|
|
|
@ -24,43 +24,48 @@
|
|||
*/
|
||||
|
||||
#include "drawing_tool.h"
|
||||
#include "pcb_actions.h"
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <confirm.h>
|
||||
|
||||
|
||||
#include <dialogs/dialog_text_properties.h>
|
||||
#include <dialogs/dialog_track_via_size.h>
|
||||
#include <geometry/geometry_utils.h>
|
||||
#include <geometry/shape_segment.h>
|
||||
#include <import_gfx/dialog_import_gfx.h>
|
||||
#include <view/view.h>
|
||||
#include <preview_items/two_point_assistant.h>
|
||||
#include <preview_items/two_point_geom_manager.h>
|
||||
#include <ratsnest/ratsnest_data.h>
|
||||
#include <router/router_tool.h>
|
||||
#include <tool/tool_manager.h>
|
||||
#include <tools/pcb_actions.h>
|
||||
#include <tools/pcb_editor_conditions.h>
|
||||
#include <tools/pcb_grid_helper.h>
|
||||
#include <tools/pcb_selection_tool.h>
|
||||
#include <tools/tool_event_utils.h>
|
||||
#include <tools/zone_create_helper.h>
|
||||
#include <view/view.h>
|
||||
#include <widgets/appearance_controls.h>
|
||||
#include <router/router_tool.h>
|
||||
#include <geometry/geometry_utils.h>
|
||||
#include <geometry/shape_segment.h>
|
||||
#include <board_commit.h>
|
||||
#include <scoped_set_reset.h>
|
||||
#include <widgets/infobar.h>
|
||||
|
||||
#include <bitmaps.h>
|
||||
#include <painter.h>
|
||||
#include <status_popup.h>
|
||||
#include <dialogs/dialog_text_properties.h>
|
||||
#include <preview_items/arc_assistant.h>
|
||||
#include <board.h>
|
||||
#include <board_commit.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <confirm.h>
|
||||
#include <footprint.h>
|
||||
#include <fp_shape.h>
|
||||
#include <macros.h>
|
||||
#include <painter.h>
|
||||
#include <pcb_edit_frame.h>
|
||||
#include <pcb_group.h>
|
||||
#include <pcb_text.h>
|
||||
#include <pcb_dimension.h>
|
||||
#include <zone.h>
|
||||
#include <footprint.h>
|
||||
#include <preview_items/two_point_assistant.h>
|
||||
#include <preview_items/two_point_geom_manager.h>
|
||||
#include <ratsnest/ratsnest_data.h>
|
||||
#include <pcbnew_id.h>
|
||||
#include <dialogs/dialog_track_via_size.h>
|
||||
#include <preview_items/arc_assistant.h>
|
||||
#include <scoped_set_reset.h>
|
||||
#include <status_popup.h>
|
||||
#include <string_utils.h>
|
||||
#include <macros.h>
|
||||
#include <widgets/infobar.h>
|
||||
#include <board_design_settings.h>
|
||||
#include <zone.h>
|
||||
|
||||
|
||||
using SCOPED_DRAW_MODE = SCOPED_SET_RESET<DRAWING_TOOL::MODE>;
|
||||
|
||||
|
@ -207,6 +212,7 @@ bool DRAWING_TOOL::Init()
|
|||
ctxMenu.AddItem( PCB_ACTIONS::closeOutline, canCloseOutline, 200 );
|
||||
ctxMenu.AddItem( PCB_ACTIONS::deleteLastPoint, canUndoPoint, 200 );
|
||||
|
||||
ctxMenu.AddCheckItem( PCB_ACTIONS::toggle45, SELECTION_CONDITIONS::ShowAlways, 250 );
|
||||
ctxMenu.AddSeparator( 500 );
|
||||
|
||||
std::shared_ptr<VIA_SIZE_MENU> viaSizeMenu = std::make_shared<VIA_SIZE_MENU>();
|
||||
|
@ -897,7 +903,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
dimension->SetEnd( (wxPoint) cursorPos );
|
||||
dimension->Update();
|
||||
|
||||
if( !!evt->Modifier( MD_SHIFT ) || dimension->Type() == PCB_DIM_CENTER_T )
|
||||
if( Is45Limited() || dimension->Type() == PCB_DIM_CENTER_T )
|
||||
constrainDimension( dimension );
|
||||
|
||||
// Dimensions that have origin and end in the same spot are not valid
|
||||
|
@ -978,7 +984,7 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
|
|||
|
||||
dimension->Update();
|
||||
|
||||
if( !!evt->Modifier( MD_SHIFT ) || dimension->Type() == PCB_DIM_CENTER_T )
|
||||
if( Is45Limited() || dimension->Type() == PCB_DIM_CENTER_T )
|
||||
constrainDimension( dimension );
|
||||
|
||||
break;
|
||||
|
@ -1367,8 +1373,8 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
|
|||
|
||||
int DRAWING_TOOL::ToggleLine45degMode( const TOOL_EVENT& toolEvent )
|
||||
{
|
||||
m_frame->Settings().m_Use45DegreeGraphicSegments =
|
||||
!m_frame->Settings().m_Use45DegreeGraphicSegments;
|
||||
m_frame->Settings().m_Use45DegreeLimit =
|
||||
!m_frame->Settings().m_Use45DegreeLimit;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
@ -1463,12 +1469,6 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic,
|
|||
cursorPos = grid.BestSnapAnchor( m_controls->GetMousePosition(), drawingLayer );
|
||||
m_controls->ForceCursorPosition( true, cursorPos );
|
||||
|
||||
// 45 degree angle constraint enabled with an option and toggled with Ctrl
|
||||
bool limit45 = frame()->Settings().m_Use45DegreeGraphicSegments;
|
||||
|
||||
if( evt->Modifier( MD_SHIFT ) )
|
||||
limit45 = !limit45;
|
||||
|
||||
if( evt->IsCancelInteractive() )
|
||||
{
|
||||
cleanup();
|
||||
|
@ -1633,9 +1633,7 @@ bool DRAWING_TOOL::drawSegment( const std::string& aTool, PCB_SHAPE** aGraphic,
|
|||
else if( evt->IsMotion() )
|
||||
{
|
||||
// 45 degree lines
|
||||
if( started
|
||||
&& ( ( limit45 && shape == SHAPE_T::SEGMENT )
|
||||
|| ( evt->Modifier( MD_SHIFT ) && shape == SHAPE_T::RECT ) ) )
|
||||
if( started && Is45Limited() )
|
||||
{
|
||||
const VECTOR2I lineVector( cursorPos - VECTOR2I( twoPointManager.GetOrigin() ) );
|
||||
|
||||
|
@ -1860,7 +1858,7 @@ bool DRAWING_TOOL::drawArc( const std::string& aTool, PCB_SHAPE** aGraphic, bool
|
|||
else if( evt->IsMotion() )
|
||||
{
|
||||
// set angle snap
|
||||
arcManager.SetAngleSnap( evt->Modifier( MD_SHIFT ) );
|
||||
arcManager.SetAngleSnap( Is45Limited() );
|
||||
|
||||
// update, but don't step the manager state
|
||||
arcManager.AddPoint( cursorPos, false );
|
||||
|
@ -2102,7 +2100,7 @@ int DRAWING_TOOL::DrawZone( const TOOL_EVENT& aEvent )
|
|||
|
||||
m_controls->ForceCursorPosition( true, cursorPos );
|
||||
|
||||
if( ( sourceZone && sourceZone->GetHV45() ) || constrainAngle || evt->Modifier( MD_SHIFT ) )
|
||||
if( ( sourceZone && sourceZone->GetHV45() ) || constrainAngle || Is45Limited() )
|
||||
polyGeomMgr.SetLeaderMode( POLYGON_GEOM_MANAGER::LEADER_MODE::DEG45 );
|
||||
else
|
||||
polyGeomMgr.SetLeaderMode( POLYGON_GEOM_MANAGER::LEADER_MODE::DIRECT );
|
||||
|
@ -2701,5 +2699,5 @@ void DRAWING_TOOL::setTransitions()
|
|||
Go( &DRAWING_TOOL::PlaceText, PCB_ACTIONS::placeText.MakeEvent() );
|
||||
Go( &DRAWING_TOOL::PlaceImportedGraphics, PCB_ACTIONS::placeImportedGraphics.MakeEvent() );
|
||||
Go( &DRAWING_TOOL::SetAnchor, PCB_ACTIONS::setAnchor.MakeEvent() );
|
||||
Go( &DRAWING_TOOL::ToggleLine45degMode, PCB_ACTIONS::toggleLine45degMode.MakeEvent() );
|
||||
Go( &DRAWING_TOOL::ToggleLine45degMode, PCB_ACTIONS::toggle45.MakeEvent() );
|
||||
}
|
||||
|
|
|
@ -217,11 +217,6 @@ TOOL_ACTION PCB_ACTIONS::closeOutline( "pcbnew.InteractiveDrawing.closeOutline",
|
|||
_( "Close Outline" ), _( "Close the in progress outline" ),
|
||||
BITMAPS::checked_ok );
|
||||
|
||||
TOOL_ACTION PCB_ACTIONS::toggleLine45degMode( "pcbnew.InteractiveDrawing.line45degMode",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Limit Lines to 45 deg" ), _( "Limit graphic lines to H, V and 45 degrees" ),
|
||||
BITMAPS::INVALID_BITMAP, AF_NONE );
|
||||
|
||||
// DRC
|
||||
//
|
||||
TOOL_ACTION PCB_ACTIONS::runDRC( "pcbnew.DRCTool.runDRC",
|
||||
|
@ -667,6 +662,11 @@ TOOL_ACTION PCB_ACTIONS::toggleLock( "pcbnew.EditorControl.toggleLock",
|
|||
_( "Toggle Lock" ), _( "Lock or unlock selected items" ),
|
||||
BITMAPS::lock_unlock );
|
||||
|
||||
TOOL_ACTION PCB_ACTIONS::toggle45( "pcbnew.EditorControl.toggle45",
|
||||
AS_GLOBAL, WXK_TAB, "",
|
||||
_( "Toggle 45 Limit" ), _( "Limit actions to 45 degrees from the starting point" ),
|
||||
BITMAPS::INVALID_BITMAP );
|
||||
|
||||
TOOL_ACTION PCB_ACTIONS::lock( "pcbnew.EditorControl.lock",
|
||||
AS_GLOBAL, 0, "",
|
||||
_( "Lock" ), _( "Prevent items from being moved and/or resized on the canvas" ),
|
||||
|
|
|
@ -163,9 +163,6 @@ public:
|
|||
static TOOL_ACTION deleteLastPoint;
|
||||
static TOOL_ACTION closeOutline;
|
||||
|
||||
/// Toggle 45 degree line drawing mode
|
||||
static TOOL_ACTION toggleLine45degMode;
|
||||
|
||||
/// Increase width of currently drawn line
|
||||
static TOOL_ACTION incWidth;
|
||||
|
||||
|
@ -419,6 +416,8 @@ public:
|
|||
|
||||
static TOOL_ACTION microwaveCreateLine;
|
||||
|
||||
static TOOL_ACTION toggle45;
|
||||
|
||||
// Locking
|
||||
static TOOL_ACTION toggleLock;
|
||||
static TOOL_ACTION lock;
|
||||
|
|
|
@ -123,13 +123,13 @@ SELECTION_CONDITION PCB_EDITOR_CONDITIONS::ZoneDisplayMode( ZONE_DISPLAY_MODE aM
|
|||
}
|
||||
|
||||
|
||||
SELECTION_CONDITION PCB_EDITOR_CONDITIONS::Line45degMode()
|
||||
SELECTION_CONDITION PCB_EDITOR_CONDITIONS::Get45degMode()
|
||||
{
|
||||
PCB_BASE_FRAME* drwFrame = dynamic_cast<PCB_BASE_FRAME*>( m_frame );
|
||||
|
||||
wxASSERT( drwFrame );
|
||||
|
||||
return std::bind( &PCB_EDITOR_CONDITIONS::line45degModeFunc, _1, drwFrame );
|
||||
return std::bind( &PCB_EDITOR_CONDITIONS::get45degModeFunc, _1, drwFrame );
|
||||
}
|
||||
|
||||
|
||||
|
@ -183,7 +183,7 @@ bool PCB_EDITOR_CONDITIONS::zoneDisplayModeFunc( const SELECTION& aSelection, PC
|
|||
return aFrame->GetDisplayOptions().m_ZoneDisplayMode == aMode;
|
||||
}
|
||||
|
||||
bool PCB_EDITOR_CONDITIONS::line45degModeFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame )
|
||||
bool PCB_EDITOR_CONDITIONS::get45degModeFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame )
|
||||
{
|
||||
return aFrame->Settings().m_Use45DegreeGraphicSegments;
|
||||
return aFrame->Settings().m_Use45DegreeLimit;
|
||||
}
|
||||
|
|
|
@ -103,11 +103,11 @@ public:
|
|||
SELECTION_CONDITION ZoneDisplayMode( ZONE_DISPLAY_MODE aMode );
|
||||
|
||||
/**
|
||||
* Create a functor that tests whether only 45 degree graphic lines should be drawn
|
||||
* Create a functor that tests whether only 45 degree lines should be allowed
|
||||
*
|
||||
* @return Functor returning true if only 45 degree graphic lines should be drawn
|
||||
* @return Functor returning true if only 45 degree lines should be allowed
|
||||
*/
|
||||
SELECTION_CONDITION Line45degMode();
|
||||
SELECTION_CONDITION Get45degMode();
|
||||
|
||||
protected:
|
||||
///< Helper function used by HasItems()
|
||||
|
@ -136,7 +136,7 @@ protected:
|
|||
ZONE_DISPLAY_MODE aMode );
|
||||
|
||||
///< Helper function used by Line45degMode()
|
||||
static bool line45degModeFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
|
||||
static bool get45degModeFunc( const SELECTION& aSelection, PCB_BASE_FRAME* aFrame );
|
||||
};
|
||||
|
||||
#endif /* PCB_EDITOR_CONDITIONS_H_ */
|
||||
|
|
|
@ -516,9 +516,7 @@ int PCB_POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
|
|||
}
|
||||
|
||||
// The alternative constraint limits to 45 degrees
|
||||
bool enableAltConstraint = !!evt->Modifier( MD_SHIFT );
|
||||
|
||||
if( enableAltConstraint )
|
||||
if( Is45Limited() )
|
||||
m_altConstraint->Apply();
|
||||
else
|
||||
m_editedPoint->ApplyConstraint();
|
||||
|
|
|
@ -318,6 +318,12 @@ PCB_SELECTION& PCB_TOOL_BASE::selection()
|
|||
}
|
||||
|
||||
|
||||
bool PCB_TOOL_BASE::Is45Limited() const
|
||||
{
|
||||
return frame()->Settings().m_Use45DegreeLimit;
|
||||
}
|
||||
|
||||
|
||||
void INTERACTIVE_PLACER_BASE::SnapItem( BOARD_ITEM *aItem )
|
||||
{
|
||||
// Base implementation performs no snapping
|
||||
|
@ -329,3 +335,4 @@ bool INTERACTIVE_PLACER_BASE::PlaceItem( BOARD_ITEM *aItem, BOARD_COMMIT& aCommi
|
|||
aCommit.Add( aItem );
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
|
@ -103,6 +103,12 @@ public:
|
|||
void SetIsFootprintEditor( bool aEnabled ) { m_isFootprintEditor = aEnabled; }
|
||||
bool IsFootprintEditor() const { return m_isFootprintEditor; }
|
||||
|
||||
/**
|
||||
* Should the tool use its 45° mode option?
|
||||
* @return True if set to use 45°
|
||||
*/
|
||||
bool Is45Limited() const;
|
||||
|
||||
protected:
|
||||
/**
|
||||
* Options for placing items interactively.
|
||||
|
@ -173,6 +179,7 @@ protected:
|
|||
|
||||
protected:
|
||||
bool m_isFootprintEditor;
|
||||
|
||||
};
|
||||
|
||||
#endif
|
||||
|
|
|
@ -301,7 +301,7 @@ int PCB_VIEWER_TOOLS::MeasureTool( const TOOL_EVENT& aEvent )
|
|||
// move or drag when origin set updates rules
|
||||
else if( originSet && ( evt->IsMotion() || evt->IsDrag( BUT_LEFT ) ) )
|
||||
{
|
||||
twoPtMgr.SetAngleSnap( evt->Modifier( MD_SHIFT ) );
|
||||
twoPtMgr.SetAngleSnap( frame()->Settings().m_Use45DegreeLimit );
|
||||
twoPtMgr.SetEnd( cursorPos );
|
||||
|
||||
view.SetVisible( &ruler, true );
|
||||
|
|
Loading…
Reference in New Issue