Add missing cursors for bus, graphic lines, and hier labels

Fix #5949
This commit is contained in:
Marek Roszko 2020-10-10 18:25:28 -04:00
parent b263164c72
commit 310786333d
13 changed files with 271 additions and 66 deletions

View File

@ -1,38 +0,0 @@
/* XPM */
static const char * cursor_connector_xpm[] = {
"32 32 3 1 1 1",
" c None",
". c #FFFFFF",
"+ c #000000",
" ... ",
" .+. ",
" .+. ",
"....+.... ",
".+++ +++. ... ",
"....+.... .+. ",
" .+. .+. ",
" .+. .+. ",
" ... .+. ",
" .+. ",
" .+. ",
" .+. ",
" .+. ",
" ...........+. ",
" .+++++++++++. ",
" .+........... ",
" .+. ",
" .+. ",
" ...+... ",
" .+++++. ",
" .+++. ",
" .+. ",
" . ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

View File

@ -1,5 +1,5 @@
/* XPM */ /* XPM */
static const char * cursor_global_label_xpm[] = { static const char * cursor_label_global_xpm[] = {
"32 32 3 1", "32 32 3 1",
" c None", " c None",
"! c black", "! c black",

View File

@ -0,0 +1,38 @@
/* XPM */
static char const *cursor_label_hier_xpm[] = {
"32 32 3 1",
" c None",
"! c black",
"# c white",
" # ",
" #!# ",
" #!# ",
" #!# ",
" #!# ",
" #!# ",
" ##### ##### ",
"#!!!!! !!!!!# ",
" ##### ##### ",
" #!# ",
" #!# ",
" #!# ",
" #!# ",
" #!# ",
" # ",
" ",
" #### ",
" #!!!!# #### ",
" #!!!!# #!!!!# ",
" #!!!!!!# #!###!# ",
" #!!!!!!# #!# #!# ",
" #!!##!!# #!# #!# ",
" #!!!##!!!# #!# #! ",
" #!!!##!!!# #!# #!# ",
" #!!!!!!!!# #!# #!# ",
" #!!!!!!!!!!# #!###!# ",
" #!!!####!!!# #!!!!# ",
" #!!!# #!!!# #### ",
" #!!!# #!!!# ",
" ### ### ",
" ",
" "};

View File

@ -1,5 +1,5 @@
/* XPM */ /* XPM */
static const char * cursor_net_label_xpm[] = { static const char * cursor_label_net_xpm[] = {
"32 32 3 1", "32 32 3 1",
" c None", " c None",
"! c black", "! c black",

View File

@ -0,0 +1,39 @@
/* XPM */
static const char * cursor_line_bus_xpm[] = {
"32 32 4 1",
" c None",
"! c black",
"# c white",
"$ c #0000FF",
" ### ",
" #!# ",
" #!# ",
"####!#### ",
"#!!! !!!# ",
"####!#### ",
" #!# ## ",
" #!# #$$# ",
" ### #$$$$# ",
" #$$$$$$# ",
" #$$$$$$# ",
" #$$$$$$# ",
" #$$$$$$# ",
" #$$$$$$# ",
" #$$$$$$# ",
" #$$$$$$# ",
" #$$$$$$# ",
" #$$$$$$# ",
" #$$$$$$# ",
" #$$$$$$# ",
" #$$$$$$# ",
" #$$$$$$# ",
" #$$$$$$# ",
" #$$$$$$# ",
" #$$$$$$# ",
" #$$$$# ",
" #$$# ",
" ## ",
" ",
" ",
" ",
" "};

View File

@ -0,0 +1,38 @@
/* XPM */
static const char * cursor_line_graphic_xpm[] = {
"32 32 3 1",
" c None",
"! c black",
"# c white",
" ### ",
" #!# ",
" #!# ",
"####!#### ",
"#!!! !!!# ",
"####!#### ",
" #!# ",
" #!# # ",
" ### #!# ",
" #!!!# ",
" #!!!# ",
" # #!# ",
" #!# # ",
" #!!!# ",
" #!!!# ",
" # #!# ",
" #!# # ",
" #!!!# ",
" #!!!# ",
" # #!# ",
" #!# # ",
" #!!!# ",
" #!!!# ",
" #!# ",
" # ",
" ",
" ",
" ",
" ",
" ",
" ",
" "};

View File

@ -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",
" ### ",
" #!# ",
" #!# ",
"####!#### ",
"#!!! !!!# ",
"####!#### # ",
" #!# #$# ",
" #!# #$$$# ",
" ### #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ## ",
" #$$$# #$$# ",
" #$$$# ##$$## ",
" #$$$# #$$$$$$# ",
" #$$$# #$$$$$$# ",
" #$# ##$$## ",
" # #$$# ",
" ## ",
" ",
" ",
" ",
" "};

View File

@ -0,0 +1,39 @@
/* XPM */
static const char * cursor_line_wire_xpm[] = {
"32 32 4 1",
" c None",
"! c black",
"# c white",
"$ c #008000",
" ### ",
" #!# ",
" #!# ",
"####!#### ",
"#!!! !!!# ",
"####!#### # ",
" #!# #$# ",
" #!# #$$$# ",
" ### #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$$$# ",
" #$# ",
" # ",
" ",
" ",
" ",
" ",
" "};

View File

@ -20,17 +20,21 @@
* or you may write to the Free Software Foundation, Inc., * or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/ */
#include <vector> #include <vector>
#include <cursors.h> #include <cursors.h>
#include <kiplatform/ui.h> #include <kiplatform/ui.h>
#include <cursors/cursor-add.xpm> #include <cursors/cursor-add.xpm>
#include <cursors/cursor-component.xpm> #include <cursors/cursor-component.xpm>
#include <cursors/cursor-connector.xpm>
#include <cursors/cursor-eraser.xpm> #include <cursors/cursor-eraser.xpm>
#include <cursors/cursor-global-label.xpm> #include <cursors/cursor-label-global.xpm>
#include <cursors/cursor-net-label.xpm> #include <cursors/cursor-label-hier.xpm>
#include <cursors/cursor-label-net.xpm>
#include <cursors/cursor-line-bus.xpm>
#include <cursors/cursor-line-graphic.xpm>
#include <cursors/cursor-line-wire.xpm>
#include <cursors/cursor-line-wire-add.xpm>
#include <cursors/cursor-measure.xpm> #include <cursors/cursor-measure.xpm>
#include <cursors/cursor-pencil.xpm> #include <cursors/cursor-pencil.xpm>
#include <cursors/cursor-select-lasso.xpm> #include <cursors/cursor-select-lasso.xpm>
@ -136,14 +140,6 @@ static const std::vector<CURSOR_STORE::CURSOR_DEF> standard_cursors = {
{ 32, 32 }, { 32, 32 },
{ 4, 4 }, { 4, 4 },
}, },
{
KICURSOR::WIRE,
nullptr,
nullptr,
cursor_connector_xpm,
{ 32, 32 },
{ 1, 1 },
},
{ {
KICURSOR::TEXT, KICURSOR::TEXT,
nullptr, nullptr,
@ -201,20 +197,20 @@ static const std::vector<CURSOR_STORE::CURSOR_DEF> standard_cursors = {
{ 6, 6 }, { 6, 6 },
}, },
{ {
KICURSOR::NET_LABEL, KICURSOR::LABEL_NET,
nullptr, nullptr,
nullptr, nullptr,
cursor_net_label_xpm, cursor_label_net_xpm,
{ 32, 32 }, { 32, 32 },
{ 7, 10 }, { 7, 7 },
}, },
{ {
KICURSOR::GLOBAL_LABEL, KICURSOR::LABEL_GLOBAL,
nullptr, nullptr,
nullptr, nullptr,
cursor_global_label_xpm, cursor_label_global_xpm,
{ 32, 32 }, { 32, 32 },
{ 7, 10 }, { 7, 7 },
}, },
{ {
KICURSOR::COMPONENT, KICURSOR::COMPONENT,
@ -240,6 +236,46 @@ static const std::vector<CURSOR_STORE::CURSOR_DEF> standard_cursors = {
{ 32, 32 }, { 32, 32 },
{ 7, 10 }, { 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 },
},
}; };

View File

@ -551,7 +551,7 @@ int EE_SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
if( m_frame->ToolStackIsEmpty() ) if( m_frame->ToolStackIsEmpty() )
{ {
if( displayWireCursor ) if( displayWireCursor )
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::WIRE ); m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::LINE_WIRE_ADD );
else if( rolloverItem != niluuid ) else if( rolloverItem != niluuid )
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::HAND ); m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::HAND );
else if( !modifier_enabled && !m_selection.Empty() else if( !modifier_enabled && !m_selection.Empty()

View File

@ -817,6 +817,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
bool isImportMode = aEvent.IsAction( &EE_ACTIONS::importSheetPin ); bool isImportMode = aEvent.IsAction( &EE_ACTIONS::importSheetPin );
bool isText = aEvent.IsAction( &EE_ACTIONS::placeSchematicText ); bool isText = aEvent.IsAction( &EE_ACTIONS::placeSchematicText );
bool isGlobalLabel = aEvent.IsAction( &EE_ACTIONS::placeGlobalLabel ); bool isGlobalLabel = aEvent.IsAction( &EE_ACTIONS::placeGlobalLabel );
bool isHierLabel = aEvent.IsAction( &EE_ACTIONS::placeHierLabel );
bool isNetLabel = aEvent.IsAction( &EE_ACTIONS::placeLabel ); bool isNetLabel = aEvent.IsAction( &EE_ACTIONS::placeLabel );
KICAD_T type = aEvent.Parameter<KICAD_T>(); KICAD_T type = aEvent.Parameter<KICAD_T>();
@ -839,9 +840,11 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
else if( isText ) else if( isText )
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::TEXT ); m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::TEXT );
else if( isGlobalLabel ) else if( isGlobalLabel )
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::GLOBAL_LABEL ); m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::LABEL_GLOBAL );
else if( isNetLabel ) 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 else
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL ); m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
}; };

View File

@ -483,7 +483,14 @@ int SCH_LINE_WIRE_BUS_TOOL::doDrawSegments( const std::string& aTool, int aType,
auto setCursor = 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 // Set initial cursor

View File

@ -43,18 +43,22 @@ enum class KICURSOR
CURRENT_PROBE, CURRENT_PROBE,
TUNE, TUNE,
TEXT, TEXT,
WIRE,
MEASURE, MEASURE,
ADD, ADD,
SUBTRACT, SUBTRACT,
XOR, XOR,
ZOOM_IN, ZOOM_IN,
ZOOM_OUT, ZOOM_OUT,
NET_LABEL, LABEL_NET,
GLOBAL_LABEL, LABEL_GLOBAL,
COMPONENT, COMPONENT,
SELECT_WINDOW, SELECT_WINDOW,
SELECT_LASSO SELECT_LASSO,
LINE_BUS,
LINE_GRAPHIC,
LINE_WIRE,
LINE_WIRE_ADD,
LABEL_HIER
}; };
/** /**