Add net and global label cursors

This commit is contained in:
Marek Roszko 2020-10-08 20:40:03 -04:00
parent 8fa42a74bd
commit 6cf4016a64
5 changed files with 111 additions and 7 deletions

View File

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

View File

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

View File

@ -28,6 +28,8 @@
#include <cursors/cursor-add.xpm>
#include <cursors/cursor-connector.xpm>
#include <cursors/cursor-eraser.xpm>
#include <cursors/cursor-global-label.xpm>
#include <cursors/cursor-net-label.xpm>
#include <cursors/cursor-measure.xpm>
#include <cursors/cursor-pencil.xpm>
#include <cursors/cursor-select-m.xpm>
@ -195,6 +197,22 @@ static const std::vector<CURSOR_STORE::CURSOR_DEF> standard_cursors = {
{ 32, 32 },
{ 6, 6 },
},
{
KICURSOR::NET_LABEL,
nullptr,
nullptr,
cursor_net_label_xpm,
{ 32, 32 },
{ 7, 10 },
},
{
KICURSOR::GLOBAL_LABEL,
nullptr,
nullptr,
cursor_global_label_xpm,
{ 32, 32 },
{ 7, 10 },
},
};

View File

@ -811,8 +811,10 @@ SCH_TEXT* SCH_DRAWING_TOOLS::createNewText( const VECTOR2I& aPosition, int aType
int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
{
EDA_ITEM* item = nullptr;
bool importMode = aEvent.IsAction( &EE_ACTIONS::importSheetPin );
bool isImportMode = aEvent.IsAction( &EE_ACTIONS::importSheetPin );
bool isText = aEvent.IsAction( &EE_ACTIONS::placeSchematicText );
bool isGlobalLabel = aEvent.IsAction( &EE_ACTIONS::placeGlobalLabel );
bool isNetLabel = aEvent.IsAction( &EE_ACTIONS::placeLabel );
KICAD_T type = aEvent.Parameter<KICAD_T>();
m_toolMgr->RunAction( EE_ACTIONS::clearSelection, true );
@ -831,8 +833,14 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
{
if( item )
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING );
else if( isText )
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::TEXT );
else if( isGlobalLabel )
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::GLOBAL_LABEL );
else if( isNetLabel )
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::NET_LABEL );
else
m_frame->GetCanvas()->SetCurrentCursor( isText ? KICURSOR::TEXT : KICURSOR::PENCIL );
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
};
// Set initial cursor
@ -922,7 +930,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
break;
}
if( importMode )
if( isImportMode )
{
label = m_frame->ImportHierLabel( sheet );

View File

@ -49,7 +49,9 @@ enum class KICURSOR
SUBTRACT,
XOR,
ZOOM_IN,
ZOOM_OUT
ZOOM_OUT,
NET_LABEL,
GLOBAL_LABEL
};
/**