From 310786333d0618552a861b70a02206cb7b8b971b Mon Sep 17 00:00:00 2001 From: Marek Roszko Date: Sat, 10 Oct 2020 18:25:28 -0400 Subject: [PATCH] Add missing cursors for bus, graphic lines, and hier labels Fix #5949 --- bitmaps_png/cursors/cursor-connector.xpm | 38 ---------- ...obal-label.xpm => cursor-label-global.xpm} | 2 +- bitmaps_png/cursors/cursor-label-hier.xpm | 38 ++++++++++ ...sor-net-label.xpm => cursor-label-net.xpm} | 2 +- bitmaps_png/cursors/cursor-line-bus.xpm | 39 ++++++++++ bitmaps_png/cursors/cursor-line-graphic.xpm | 38 ++++++++++ bitmaps_png/cursors/cursor-line-wire-add.xpm | 39 ++++++++++ bitmaps_png/cursors/cursor-line-wire.xpm | 39 ++++++++++ common/cursors.cpp | 72 ++++++++++++++----- eeschema/tools/ee_selection_tool.cpp | 2 +- eeschema/tools/sch_drawing_tools.cpp | 7 +- eeschema/tools/sch_line_wire_bus_tool.cpp | 9 ++- include/cursors.h | 12 ++-- 13 files changed, 271 insertions(+), 66 deletions(-) delete mode 100644 bitmaps_png/cursors/cursor-connector.xpm rename bitmaps_png/cursors/{cursor-global-label.xpm => cursor-label-global.xpm} (93%) create mode 100644 bitmaps_png/cursors/cursor-label-hier.xpm rename bitmaps_png/cursors/{cursor-net-label.xpm => cursor-label-net.xpm} (93%) create mode 100644 bitmaps_png/cursors/cursor-line-bus.xpm create mode 100644 bitmaps_png/cursors/cursor-line-graphic.xpm create mode 100644 bitmaps_png/cursors/cursor-line-wire-add.xpm create mode 100644 bitmaps_png/cursors/cursor-line-wire.xpm diff --git a/bitmaps_png/cursors/cursor-connector.xpm b/bitmaps_png/cursors/cursor-connector.xpm deleted file mode 100644 index 86e8d17535..0000000000 --- a/bitmaps_png/cursors/cursor-connector.xpm +++ /dev/null @@ -1,38 +0,0 @@ -/* XPM */ -static const char * cursor_connector_xpm[] = { -"32 32 3 1 1 1", -" c None", -". c #FFFFFF", -"+ c #000000", -" ... ", -" .+. ", -" .+. ", -"....+.... ", -".+++ +++. ... ", -"....+.... .+. ", -" .+. .+. ", -" .+. .+. ", -" ... .+. ", -" .+. ", -" .+. ", -" .+. ", -" .+. ", -" ...........+. ", -" .+++++++++++. ", -" .+........... ", -" .+. ", -" .+. ", -" ...+... ", -" .+++++. ", -" .+++. ", -" .+. ", -" . ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" ", -" "}; diff --git a/bitmaps_png/cursors/cursor-global-label.xpm b/bitmaps_png/cursors/cursor-label-global.xpm similarity index 93% rename from bitmaps_png/cursors/cursor-global-label.xpm rename to bitmaps_png/cursors/cursor-label-global.xpm index 2ed538d2af..d6bf01019d 100644 --- a/bitmaps_png/cursors/cursor-global-label.xpm +++ b/bitmaps_png/cursors/cursor-label-global.xpm @@ -1,5 +1,5 @@ /* XPM */ -static const char * cursor_global_label_xpm[] = { +static const char * cursor_label_global_xpm[] = { "32 32 3 1", " c None", "! c black", diff --git a/bitmaps_png/cursors/cursor-label-hier.xpm b/bitmaps_png/cursors/cursor-label-hier.xpm new file mode 100644 index 0000000000..d9711b3ba5 --- /dev/null +++ b/bitmaps_png/cursors/cursor-label-hier.xpm @@ -0,0 +1,38 @@ +/* XPM */ +static char const *cursor_label_hier_xpm[] = { +"32 32 3 1", +" c None", +"! c black", +"# c white", +" # ", +" #!# ", +" #!# ", +" #!# ", +" #!# ", +" #!# ", +" ##### ##### ", +"#!!!!! !!!!!# ", +" ##### ##### ", +" #!# ", +" #!# ", +" #!# ", +" #!# ", +" #!# ", +" # ", +" ", +" #### ", +" #!!!!# #### ", +" #!!!!# #!!!!# ", +" #!!!!!!# #!###!# ", +" #!!!!!!# #!# #!# ", +" #!!##!!# #!# #!# ", +" #!!!##!!!# #!# #! ", +" #!!!##!!!# #!# #!# ", +" #!!!!!!!!# #!# #!# ", +" #!!!!!!!!!!# #!###!# ", +" #!!!####!!!# #!!!!# ", +" #!!!# #!!!# #### ", +" #!!!# #!!!# ", +" ### ### ", +" ", +" "}; \ No newline at end of file diff --git a/bitmaps_png/cursors/cursor-net-label.xpm b/bitmaps_png/cursors/cursor-label-net.xpm similarity index 93% rename from bitmaps_png/cursors/cursor-net-label.xpm rename to bitmaps_png/cursors/cursor-label-net.xpm index d432ffbeb6..4417ef52fe 100644 --- a/bitmaps_png/cursors/cursor-net-label.xpm +++ b/bitmaps_png/cursors/cursor-label-net.xpm @@ -1,5 +1,5 @@ /* XPM */ -static const char * cursor_net_label_xpm[] = { +static const char * cursor_label_net_xpm[] = { "32 32 3 1", " c None", "! c black", diff --git a/bitmaps_png/cursors/cursor-line-bus.xpm b/bitmaps_png/cursors/cursor-line-bus.xpm new file mode 100644 index 0000000000..e8b6eacbca --- /dev/null +++ b/bitmaps_png/cursors/cursor-line-bus.xpm @@ -0,0 +1,39 @@ +/* XPM */ +static const char * cursor_line_bus_xpm[] = { +"32 32 4 1", +" c None", +"! c black", +"# c white", +"$ c #0000FF", +" ### ", +" #!# ", +" #!# ", +"####!#### ", +"#!!! !!!# ", +"####!#### ", +" #!# ## ", +" #!# #$$# ", +" ### #$$$$# ", +" #$$$$$$# ", +" #$$$$$$# ", +" #$$$$$$# ", +" #$$$$$$# ", +" #$$$$$$# ", +" #$$$$$$# ", +" #$$$$$$# ", +" #$$$$$$# ", +" #$$$$$$# ", +" #$$$$$$# ", +" #$$$$$$# ", +" #$$$$$$# ", +" #$$$$$$# ", +" #$$$$$$# ", +" #$$$$$$# ", +" #$$$$$$# ", +" #$$$$# ", +" #$$# ", +" ## ", +" ", +" ", +" ", +" "}; \ No newline at end of file diff --git a/bitmaps_png/cursors/cursor-line-graphic.xpm b/bitmaps_png/cursors/cursor-line-graphic.xpm new file mode 100644 index 0000000000..ea870782b1 --- /dev/null +++ b/bitmaps_png/cursors/cursor-line-graphic.xpm @@ -0,0 +1,38 @@ +/* XPM */ +static const char * cursor_line_graphic_xpm[] = { +"32 32 3 1", +" c None", +"! c black", +"# c white", +" ### ", +" #!# ", +" #!# ", +"####!#### ", +"#!!! !!!# ", +"####!#### ", +" #!# ", +" #!# # ", +" ### #!# ", +" #!!!# ", +" #!!!# ", +" # #!# ", +" #!# # ", +" #!!!# ", +" #!!!# ", +" # #!# ", +" #!# # ", +" #!!!# ", +" #!!!# ", +" # #!# ", +" #!# # ", +" #!!!# ", +" #!!!# ", +" #!# ", +" # ", +" ", +" ", +" ", +" ", +" ", +" ", +" "}; \ No newline at end of file diff --git a/bitmaps_png/cursors/cursor-line-wire-add.xpm b/bitmaps_png/cursors/cursor-line-wire-add.xpm new file mode 100644 index 0000000000..2ea0515418 --- /dev/null +++ b/bitmaps_png/cursors/cursor-line-wire-add.xpm @@ -0,0 +1,39 @@ +/* XPM */ +static char const *cursor_line_wire_add_xpm[] = { +"32 32 4 1", +" c None", +"! c black", +"# c white", +"$ c #008000", +" ### ", +" #!# ", +" #!# ", +"####!#### ", +"#!!! !!!# ", +"####!#### # ", +" #!# #$# ", +" #!# #$$$# ", +" ### #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ## ", +" #$$$# #$$# ", +" #$$$# ##$$## ", +" #$$$# #$$$$$$# ", +" #$$$# #$$$$$$# ", +" #$# ##$$## ", +" # #$$# ", +" ## ", +" ", +" ", +" ", +" "}; \ No newline at end of file diff --git a/bitmaps_png/cursors/cursor-line-wire.xpm b/bitmaps_png/cursors/cursor-line-wire.xpm new file mode 100644 index 0000000000..903c0ac12b --- /dev/null +++ b/bitmaps_png/cursors/cursor-line-wire.xpm @@ -0,0 +1,39 @@ +/* XPM */ +static const char * cursor_line_wire_xpm[] = { +"32 32 4 1", +" c None", +"! c black", +"# c white", +"$ c #008000", +" ### ", +" #!# ", +" #!# ", +"####!#### ", +"#!!! !!!# ", +"####!#### # ", +" #!# #$# ", +" #!# #$$$# ", +" ### #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$$$# ", +" #$# ", +" # ", +" ", +" ", +" ", +" ", +" "}; \ No newline at end of file diff --git a/common/cursors.cpp b/common/cursors.cpp index ded3cd729d..4752a8b75b 100644 --- a/common/cursors.cpp +++ b/common/cursors.cpp @@ -20,17 +20,21 @@ * or you may write to the Free Software Foundation, Inc., * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA */ - + #include #include #include #include #include -#include #include -#include -#include +#include +#include +#include +#include +#include +#include +#include #include #include #include @@ -136,14 +140,6 @@ static const std::vector standard_cursors = { { 32, 32 }, { 4, 4 }, }, - { - KICURSOR::WIRE, - nullptr, - nullptr, - cursor_connector_xpm, - { 32, 32 }, - { 1, 1 }, - }, { KICURSOR::TEXT, nullptr, @@ -201,20 +197,20 @@ static const std::vector standard_cursors = { { 6, 6 }, }, { - KICURSOR::NET_LABEL, + KICURSOR::LABEL_NET, nullptr, nullptr, - cursor_net_label_xpm, + cursor_label_net_xpm, { 32, 32 }, - { 7, 10 }, + { 7, 7 }, }, { - KICURSOR::GLOBAL_LABEL, + KICURSOR::LABEL_GLOBAL, nullptr, nullptr, - cursor_global_label_xpm, + cursor_label_global_xpm, { 32, 32 }, - { 7, 10 }, + { 7, 7 }, }, { KICURSOR::COMPONENT, @@ -240,6 +236,46 @@ static const std::vector standard_cursors = { { 32, 32 }, { 7, 10 }, }, + { + KICURSOR::LINE_BUS, + nullptr, + nullptr, + cursor_line_bus_xpm, + { 32, 32 }, + { 4, 4 }, + }, + { + KICURSOR::LINE_WIRE, + nullptr, + nullptr, + cursor_line_wire_xpm, + { 32, 32 }, + { 4, 4 }, + }, + { + KICURSOR::LINE_WIRE_ADD, + nullptr, + nullptr, + cursor_line_wire_add_xpm, + { 32, 32 }, + { 4, 4 }, + }, + { + KICURSOR::LINE_GRAPHIC, + nullptr, + nullptr, + cursor_line_graphic_xpm, + { 32, 32 }, + { 4, 4 }, + }, + { + KICURSOR::LABEL_HIER, + nullptr, + nullptr, + cursor_label_hier_xpm, + { 32, 32 }, + { 7, 7 }, + }, }; diff --git a/eeschema/tools/ee_selection_tool.cpp b/eeschema/tools/ee_selection_tool.cpp index 64070daa3f..f46421861e 100644 --- a/eeschema/tools/ee_selection_tool.cpp +++ b/eeschema/tools/ee_selection_tool.cpp @@ -551,7 +551,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent ) if( m_frame->ToolStackIsEmpty() ) { if( displayWireCursor ) - m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::WIRE ); + m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::LINE_WIRE_ADD ); else if( rolloverItem != niluuid ) m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::HAND ); else if( !modifier_enabled && !m_selection.Empty() diff --git a/eeschema/tools/sch_drawing_tools.cpp b/eeschema/tools/sch_drawing_tools.cpp index a1d77c55ec..b282982f1a 100644 --- a/eeschema/tools/sch_drawing_tools.cpp +++ b/eeschema/tools/sch_drawing_tools.cpp @@ -817,6 +817,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent ) bool isImportMode = aEvent.IsAction( &EE_ACTIONS::importSheetPin ); bool isText = aEvent.IsAction( &EE_ACTIONS::placeSchematicText ); bool isGlobalLabel = aEvent.IsAction( &EE_ACTIONS::placeGlobalLabel ); + bool isHierLabel = aEvent.IsAction( &EE_ACTIONS::placeHierLabel ); bool isNetLabel = aEvent.IsAction( &EE_ACTIONS::placeLabel ); KICAD_T type = aEvent.Parameter(); @@ -839,9 +840,11 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent ) else if( isText ) m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::TEXT ); else if( isGlobalLabel ) - m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::GLOBAL_LABEL ); + m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::LABEL_GLOBAL ); else if( isNetLabel ) - m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::NET_LABEL ); + m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::LABEL_NET ); + else if( isHierLabel ) + m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::LABEL_HIER ); else m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL ); }; diff --git a/eeschema/tools/sch_line_wire_bus_tool.cpp b/eeschema/tools/sch_line_wire_bus_tool.cpp index 3c3535ceb3..4d0063da39 100644 --- a/eeschema/tools/sch_line_wire_bus_tool.cpp +++ b/eeschema/tools/sch_line_wire_bus_tool.cpp @@ -483,7 +483,14 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType, auto setCursor = [&]() { - m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::WIRE ); + if( aType == LAYER_WIRE ) + m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::LINE_WIRE ); + else if( aType == LAYER_BUS ) + m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::LINE_BUS ); + else if( aType == LAYER_NOTES ) + m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::LINE_GRAPHIC ); + else + m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::LINE_WIRE ); }; // Set initial cursor diff --git a/include/cursors.h b/include/cursors.h index e44bc5e60a..7a1e8ff371 100644 --- a/include/cursors.h +++ b/include/cursors.h @@ -43,18 +43,22 @@ enum class KICURSOR CURRENT_PROBE, TUNE, TEXT, - WIRE, MEASURE, ADD, SUBTRACT, XOR, ZOOM_IN, ZOOM_OUT, - NET_LABEL, - GLOBAL_LABEL, + LABEL_NET, + LABEL_GLOBAL, COMPONENT, SELECT_WINDOW, - SELECT_LASSO + SELECT_LASSO, + LINE_BUS, + LINE_GRAPHIC, + LINE_WIRE, + LINE_WIRE_ADD, + LABEL_HIER }; /**