diff --git a/bitmaps_png/CMakeLists.txt b/bitmaps_png/CMakeLists.txt
index 92a6a92a93..76db9bde16 100644
--- a/bitmaps_png/CMakeLists.txt
+++ b/bitmaps_png/CMakeLists.txt
@@ -329,6 +329,7 @@ set( BMAPS_MID
library_archive_as
library
library_table
+ lines_any
lines90
list_nets
load_drill
diff --git a/bitmaps_png/png/hv45mode_dark_24.png b/bitmaps_png/png/hv45mode_dark_24.png
new file mode 100644
index 0000000000..5ac583f276
Binary files /dev/null and b/bitmaps_png/png/hv45mode_dark_24.png differ
diff --git a/bitmaps_png/png/lines_any_24.png b/bitmaps_png/png/lines_any_24.png
new file mode 100644
index 0000000000..56c8c5055b
Binary files /dev/null and b/bitmaps_png/png/lines_any_24.png differ
diff --git a/bitmaps_png/png/lines_any_dark_24.png b/bitmaps_png/png/lines_any_dark_24.png
new file mode 100644
index 0000000000..1012045ae4
Binary files /dev/null and b/bitmaps_png/png/lines_any_dark_24.png differ
diff --git a/bitmaps_png/sources/dark/hv45mode.svg b/bitmaps_png/sources/dark/hv45mode.svg
new file mode 100644
index 0000000000..2a777a3d29
--- /dev/null
+++ b/bitmaps_png/sources/dark/hv45mode.svg
@@ -0,0 +1,84 @@
+
+
diff --git a/bitmaps_png/sources/dark/lines_any.svg b/bitmaps_png/sources/dark/lines_any.svg
new file mode 100644
index 0000000000..a9e3770f06
--- /dev/null
+++ b/bitmaps_png/sources/dark/lines_any.svg
@@ -0,0 +1,88 @@
+
+
diff --git a/bitmaps_png/sources/light/lines_any.svg b/bitmaps_png/sources/light/lines_any.svg
new file mode 100644
index 0000000000..f322c571f9
--- /dev/null
+++ b/bitmaps_png/sources/light/lines_any.svg
@@ -0,0 +1,88 @@
+
+
diff --git a/eeschema/eeschema_settings.h b/eeschema/eeschema_settings.h
index bfc03c4f99..7335a55098 100644
--- a/eeschema/eeschema_settings.h
+++ b/eeschema/eeschema_settings.h
@@ -35,7 +35,6 @@ enum LINE_MODE
LINE_MODE_FREE = 0,
LINE_MODE_90 = 1,
LINE_MODE_45 = 2,
- LINE_MODE_135 = 3,
LINE_MODE_COUNT,
};
diff --git a/eeschema/sch_edit_frame.cpp b/eeschema/sch_edit_frame.cpp
index 446edae52f..0bfc73490b 100644
--- a/eeschema/sch_edit_frame.cpp
+++ b/eeschema/sch_edit_frame.cpp
@@ -441,7 +441,6 @@ void SCH_EDIT_FRAME::setupUIConditions()
mgr->SetConditions( EE_ACTIONS::lineModeFree, CHECK( cond.LineMode( LINE_MODE::LINE_MODE_FREE ) ) );
mgr->SetConditions( EE_ACTIONS::lineMode90, CHECK( cond.LineMode( LINE_MODE::LINE_MODE_90 ) ) );
mgr->SetConditions( EE_ACTIONS::lineMode45, CHECK( cond.LineMode( LINE_MODE::LINE_MODE_45 ) ) );
- mgr->SetConditions( EE_ACTIONS::lineMode135, CHECK( cond.LineMode( LINE_MODE::LINE_MODE_135 ) ) );
mgr->SetConditions( ACTIONS::cut, ENABLE( hasElements ) );
mgr->SetConditions( ACTIONS::copy, ENABLE( hasElements ) );
diff --git a/eeschema/toolbars_sch_editor.cpp b/eeschema/toolbars_sch_editor.cpp
index 97596b12a6..520f8c5e6c 100644
--- a/eeschema/toolbars_sch_editor.cpp
+++ b/eeschema/toolbars_sch_editor.cpp
@@ -205,7 +205,6 @@ void SCH_EDIT_FRAME::ReCreateOptToolbar()
m_optionsToolBar->Add( EE_ACTIONS::lineModeFree, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( EE_ACTIONS::lineMode90, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->Add( EE_ACTIONS::lineMode45, ACTION_TOOLBAR::TOGGLE );
- m_optionsToolBar->Add( EE_ACTIONS::lineMode135, ACTION_TOOLBAR::TOGGLE );
m_optionsToolBar->AddScaledSeparator( this );
m_optionsToolBar->Add( EE_ACTIONS::toggleAnnotateAuto, ACTION_TOOLBAR::TOGGLE );
diff --git a/eeschema/tools/ee_actions.cpp b/eeschema/tools/ee_actions.cpp
index eee05877ad..b075f40e4d 100644
--- a/eeschema/tools/ee_actions.cpp
+++ b/eeschema/tools/ee_actions.cpp
@@ -687,7 +687,7 @@ TOOL_ACTION EE_ACTIONS::toggleERCExclusions( "eeschema.EditorControl.showERCExcl
TOOL_ACTION EE_ACTIONS::lineModeFree( "eeschema.EditorControl.lineModeFree",
AS_GLOBAL, 0, "",
_( "Line Mode for Wires and Buses" ), _( "Lines drawn at any angle" ),
- BITMAPS::unknown, AF_NONE, (void*) LINE_MODE::LINE_MODE_FREE );
+ BITMAPS::lines_any, AF_NONE, (void*) LINE_MODE::LINE_MODE_FREE );
TOOL_ACTION EE_ACTIONS::lineMode90( "eeschema.EditorControl.lineModeOrthonal",
AS_GLOBAL, 0, "",
@@ -696,13 +696,8 @@ TOOL_ACTION EE_ACTIONS::lineMode90( "eeschema.EditorControl.lineModeOrthonal",
TOOL_ACTION EE_ACTIONS::lineMode45( "eeschema.EditorControl.lineMode45",
AS_GLOBAL, 0, "",
- _( "Line Mode for Wires and Buses" ), _( "Lines drawn horizontally and vertically, with a 45 degree angle end" ),
- BITMAPS::unknown, AF_NONE, (void*) LINE_MODE::LINE_MODE_45);
-
-TOOL_ACTION EE_ACTIONS::lineMode135( "eeschema.EditorControl.lineMode135",
- AS_GLOBAL, 0, "",
- _( "Line Mode for Wires and Buses" ), _( "Lines drawn horizontally and vertically, with a 45 degree angle start" ),
- BITMAPS::unknown, AF_NONE, (void*) LINE_MODE::LINE_MODE_135);
+ _( "Line Mode for Wires and Buses" ), _( "Lines drawn horizontally, vertically, and at a 45 degree angle" ),
+ BITMAPS::hv45mode, AF_NONE, (void*) LINE_MODE::LINE_MODE_45);
TOOL_ACTION EE_ACTIONS::lineModeNext( "eeschema.EditorControl.lineModeNext",
AS_GLOBAL, MD_SHIFT + WXK_SPACE, "",
diff --git a/eeschema/tools/ee_actions.h b/eeschema/tools/ee_actions.h
index 1533d16f38..15d0801a79 100644
--- a/eeschema/tools/ee_actions.h
+++ b/eeschema/tools/ee_actions.h
@@ -230,7 +230,6 @@ public:
static TOOL_ACTION lineModeFree;
static TOOL_ACTION lineMode90;
static TOOL_ACTION lineMode45;
- static TOOL_ACTION lineMode135;
static TOOL_ACTION lineModeNext;
// Annotation
diff --git a/eeschema/tools/sch_editor_control.cpp b/eeschema/tools/sch_editor_control.cpp
index c35e7a9f8f..6de9abe1f1 100644
--- a/eeschema/tools/sch_editor_control.cpp
+++ b/eeschema/tools/sch_editor_control.cpp
@@ -2190,21 +2190,6 @@ int SCH_EDITOR_CONTROL::NextLineMode( const TOOL_EVENT& aEvent )
}
-int SCH_EDITOR_CONTROL::SwitchSegmentPosture( const TOOL_EVENT& aEvent )
-{
- // The 45/135 angle modes are the only ones with fixed postures, so
- // only toggle them if we're already in one of these modes
- if (m_frame->eeconfig()->m_Drawing.line_mode == LINE_MODE::LINE_MODE_45)
- m_frame->eeconfig()->m_Drawing.line_mode = LINE_MODE::LINE_MODE_135;
- else if (m_frame->eeconfig()->m_Drawing.line_mode == LINE_MODE::LINE_MODE_135)
- m_frame->eeconfig()->m_Drawing.line_mode = LINE_MODE::LINE_MODE_45;
-
- m_toolMgr->RunAction( ACTIONS::refreshPreview );
-
- return 0;
-}
-
-
int SCH_EDITOR_CONTROL::ToggleAnnotateAuto( const TOOL_EVENT& aEvent )
{
EESCHEMA_SETTINGS* cfg = m_frame->eeconfig();
@@ -2394,9 +2379,7 @@ void SCH_EDITOR_CONTROL::setTransitions()
Go( &SCH_EDITOR_CONTROL::ChangeLineMode, EE_ACTIONS::lineModeFree.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ChangeLineMode, EE_ACTIONS::lineMode90.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ChangeLineMode, EE_ACTIONS::lineMode45.MakeEvent() );
- Go( &SCH_EDITOR_CONTROL::ChangeLineMode, EE_ACTIONS::lineMode135.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::NextLineMode, EE_ACTIONS::lineModeNext.MakeEvent() );
- Go( &SCH_EDITOR_CONTROL::SwitchSegmentPosture, EE_ACTIONS::switchSegmentPosture.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::ToggleAnnotateAuto, EE_ACTIONS::toggleAnnotateAuto.MakeEvent() );
Go( &SCH_EDITOR_CONTROL::TogglePythonConsole, EE_ACTIONS::showPythonConsole.MakeEvent() );
diff --git a/eeschema/tools/sch_editor_control.h b/eeschema/tools/sch_editor_control.h
index 955104d86b..d78fa6fce8 100644
--- a/eeschema/tools/sch_editor_control.h
+++ b/eeschema/tools/sch_editor_control.h
@@ -141,7 +141,6 @@ public:
int ToggleERCExclusions( const TOOL_EVENT& aEvent );
int ChangeLineMode( const TOOL_EVENT& aEvent );
int NextLineMode( const TOOL_EVENT& aEvent );
- int SwitchSegmentPosture( const TOOL_EVENT& aEvent );
int ToggleAnnotateAuto( const TOOL_EVENT& aEvent );
int ToggleAnnotateRecursive( const TOOL_EVENT& aEvent );
int TogglePythonConsole( const TOOL_EVENT& aEvent );
diff --git a/eeschema/tools/sch_line_wire_bus_tool.cpp b/eeschema/tools/sch_line_wire_bus_tool.cpp
index 2a48abc26d..7d6e99729d 100644
--- a/eeschema/tools/sch_line_wire_bus_tool.cpp
+++ b/eeschema/tools/sch_line_wire_bus_tool.cpp
@@ -425,7 +425,8 @@ const SCH_SHEET_PIN* SCH_LINE_WIRE_BUS_TOOL::getSheetPin( const VECTOR2I& aPosit
void SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint( const std::pair& aSegments,
VECTOR2I& aPosition,
- LINE_MODE mode )
+ LINE_MODE mode,
+ bool posture )
{
wxCHECK_RET( aSegments.first && aSegments.second,
wxT( "Cannot compute break point of NULL line segment." ) );
@@ -442,7 +443,7 @@ void SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint( const std::pairGetEndPoint().x - nextSegment->GetStartPoint().x ) != 0;
preferVertical = ( nextSegment->GetEndPoint().y - nextSegment->GetStartPoint().y ) != 0;
@@ -475,12 +476,16 @@ void SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint( const std::pairGetStartPoint().x;
- midPoint.y = aPosition.y - yDir * abs( delta.x );
- break;
- case LINE_MODE_135:
- midPoint.x = aPosition.x;
- midPoint.y = segment->GetStartPoint().y + yDir * abs( delta.x );
+ if( !posture )
+ {
+ midPoint.x = segment->GetStartPoint().x;
+ midPoint.y = aPosition.y - yDir * abs( delta.x );
+ }
+ else
+ {
+ midPoint.x = aPosition.x;
+ midPoint.y = segment->GetStartPoint().y + yDir * abs( delta.x );
+ }
break;
default:
midPoint.x = segment->GetStartPoint().x;
@@ -494,12 +499,16 @@ void SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint( const std::pairGetStartPoint().y;
- break;
- case LINE_MODE_135:
- midPoint.x = segment->GetStartPoint().x + xDir * abs( delta.y );
- midPoint.y = aPosition.y;
+ if( !posture )
+ {
+ midPoint.x = aPosition.x - xDir * abs( delta.y );
+ midPoint.y = segment->GetStartPoint().y;
+ }
+ else
+ {
+ midPoint.x = segment->GetStartPoint().x + xDir * abs( delta.y );
+ midPoint.y = aPosition.y;
+ }
break;
default:
midPoint.x = aPosition.x;
@@ -522,14 +531,14 @@ void SCH_LINE_WIRE_BUS_TOOL::computeBreakPoint( const std::pairGetStartPoint();
- if( mode == LINE_MODE::LINE_MODE_45
+ if( mode == LINE_MODE::LINE_MODE_45 && !posture
&& ( ( alg::signbit( deltaMidpoint.x ) != alg::signbit( delta.x ) )
|| ( alg::signbit( deltaMidpoint.y ) != alg::signbit( delta.y ) ) ) )
{
preferVertical = false;
preferHorizontal = false;
}
- else if( mode == LINE_MODE::LINE_MODE_135
+ else if( mode == LINE_MODE::LINE_MODE_45 && posture
&& ( ( abs( deltaMidpoint.x ) > abs( delta.x ) )
|| ( abs( deltaMidpoint.y ) > abs( delta.y ) ) ) )
{
@@ -558,6 +567,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
EE_GRID_HELPER grid( m_toolMgr );
KIGFX::VIEW_CONTROLS* controls = getViewControls();
int lastMode = m_frame->eeconfig()->m_Drawing.line_mode;
+ static bool posture = false;
auto setCursor =
[&]()
@@ -774,11 +784,8 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
// When placing lines with the forty-five degree end, the user is
// targetting the endpoint with the angled portion, so it's more
// intuitive to place both segments at the same time.
- if( currentMode == LINE_MODE::LINE_MODE_45
- || currentMode == LINE_MODE::LINE_MODE_135 )
- {
+ if( currentMode == LINE_MODE::LINE_MODE_45 )
placedSegments++;
- }
segment->SetEndPoint( cursorPos );
@@ -799,7 +806,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
{
if( twoSegments && m_wires.size() >= 2 )
computeBreakPoint( { m_wires[m_wires.size() - 2], segment }, cursorPos,
- currentMode );
+ currentMode, posture );
finishSegments();
segment = nullptr;
@@ -860,7 +867,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
if( twoSegments && m_wires.size() >= 2 )
{
computeBreakPoint( { m_wires[m_wires.size() - 2], segment }, cursorPos,
- currentMode );
+ currentMode, posture );
}
else
{
@@ -892,7 +899,7 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
if( twoSegments && m_wires.size() >= 2 )
{
computeBreakPoint( { m_wires[m_wires.size() - 2], segment }, cursorPos,
- currentMode );
+ currentMode, posture );
}
else
{
@@ -910,12 +917,14 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
wxBell();
}
}
- else if( evt->IsAction( &EE_ACTIONS::switchSegmentPosture ) )
+ else if( evt->IsAction( &EE_ACTIONS::switchSegmentPosture ) && m_wires.size() >= 2 )
{
+ posture = !posture;
+
// The 90 degree mode doesn't have a forced posture like
- // the 45 and 135 degree modes, so we don't have a mode to toggle
- // in the UI. Instead, just swap the 90 angle here.
- if( currentMode == LINE_MODE::LINE_MODE_90 && m_wires.size() >= 2 )
+ // the 45 degree mode and computeBreakPoint maintains existing 90s' postures.
+ // Instead, just swap the 90 angle here.
+ if( currentMode == LINE_MODE::LINE_MODE_90 )
{
m_view->ClearPreview();
@@ -936,9 +945,10 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
}
else
{
- // Posture change for 45/135 will come back around as a mode
- // change and we'll refresh as needed
- evt->SetPassEvent();
+ computeBreakPoint( { m_wires[m_wires.size() - 2], segment }, cursorPos, currentMode,
+ posture );
+
+ m_toolMgr->RunAction( ACTIONS::refreshPreview );
}
}
//------------------------------------------------------------------------
diff --git a/eeschema/tools/sch_line_wire_bus_tool.h b/eeschema/tools/sch_line_wire_bus_tool.h
index 1642810696..22a5687207 100644
--- a/eeschema/tools/sch_line_wire_bus_tool.h
+++ b/eeschema/tools/sch_line_wire_bus_tool.h
@@ -131,9 +131,10 @@ private:
* @param aPosition A reference to a wxPoint object containing the coordinates of the
* position used to calculate the line break point.
* @param mode LINE_MODE specifying the way to break the line
+ * @param posture Toggles the posture of the line
*/
void computeBreakPoint( const std::pair& aSegments, VECTOR2I& aPosition,
- LINE_MODE mode );
+ LINE_MODE mode, bool posture );
private:
bool m_inDrawingTool; // Reentrancy guard
diff --git a/include/bitmaps/bitmap_info.h b/include/bitmaps/bitmap_info.h
index 9632042986..65b519b91b 100644
--- a/include/bitmaps/bitmap_info.h
+++ b/include/bitmaps/bitmap_info.h
@@ -365,6 +365,7 @@ const std::vector g_BitmapInfo = {
{ BITMAPS::library_archive_as, wxT( "library_archive_as_24.png" ), 24, wxT( "light" ) },
{ BITMAPS::library, wxT( "library_24.png" ), 24, wxT( "light" ) },
{ BITMAPS::library_table, wxT( "library_table_24.png" ), 24, wxT( "light" ) },
+ { BITMAPS::lines_any, wxT( "lines_any_24.png" ), 24, wxT( "light" ) },
{ BITMAPS::lines90, wxT( "lines90_24.png" ), 24, wxT( "light" ) },
{ BITMAPS::list_nets, wxT( "list_nets_24.png" ), 24, wxT( "light" ) },
{ BITMAPS::load_drill, wxT( "load_drill_24.png" ), 24, wxT( "light" ) },
@@ -705,6 +706,7 @@ const std::vector g_BitmapInfo = {
{ BITMAPS::hotkeys, wxT( "hotkeys_dark_24.png" ), 24, wxT( "dark" ) },
{ BITMAPS::hole_to_hole_clearance, wxT( "hole_to_hole_clearance_dark_24.png" ), 24, wxT( "dark" ) },
{ BITMAPS::hole_to_copper_clearance, wxT( "hole_to_copper_clearance_dark_24.png" ), 24, wxT( "dark" ) },
+ { BITMAPS::hv45mode, wxT( "hv45mode_dark_24.png" ), 24, wxT( "dark" ) },
{ BITMAPS::icon_cvpcb_24, wxT( "icon_cvpcb_24_dark_24.png" ), 24, wxT( "dark" ) },
{ BITMAPS::icon_footprint_browser, wxT( "icon_footprint_browser_dark_24.png" ), 24, wxT( "dark" ) },
{ BITMAPS::icon_gerbview_24, wxT( "icon_gerbview_24_dark_24.png" ), 24, wxT( "dark" ) },
@@ -734,6 +736,7 @@ const std::vector g_BitmapInfo = {
{ BITMAPS::library_archive_as, wxT( "library_archive_as_dark_24.png" ), 24, wxT( "dark" ) },
{ BITMAPS::library, wxT( "library_dark_24.png" ), 24, wxT( "dark" ) },
{ BITMAPS::library_table, wxT( "library_table_dark_24.png" ), 24, wxT( "dark" ) },
+ { BITMAPS::lines_any, wxT( "lines_any_dark_24.png" ), 24, wxT( "dark" ) },
{ BITMAPS::lines90, wxT( "lines90_dark_24.png" ), 24, wxT( "dark" ) },
{ BITMAPS::list_nets, wxT( "list_nets_dark_24.png" ), 24, wxT( "dark" ) },
{ BITMAPS::load_drill, wxT( "load_drill_dark_24.png" ), 24, wxT( "dark" ) },
diff --git a/include/bitmaps/bitmaps_list.h b/include/bitmaps/bitmaps_list.h
index 8e4d4419a4..9933642af3 100644
--- a/include/bitmaps/bitmaps_list.h
+++ b/include/bitmaps/bitmaps_list.h
@@ -307,6 +307,7 @@ enum class BITMAPS : unsigned int
library_archive_as,
library_browser,
library_table,
+ lines_any,
lines90,
list_nets,
list_nets_16,