Add new place cursor, fix cursor hotpoints again

This commit is contained in:
Marek Roszko 2020-10-10 23:45:21 -04:00
parent 06144824d1
commit 558f4b4b51
7 changed files with 60 additions and 11 deletions

View File

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

View File

@ -37,6 +37,7 @@
#include <cursors/cursor-line-wire-add.xpm>
#include <cursors/cursor-measure.xpm>
#include <cursors/cursor-pencil.xpm>
#include <cursors/cursor-place.xpm>
#include <cursors/cursor-select-lasso.xpm>
#include <cursors/cursor-select-m.xpm>
#include <cursors/cursor-select-window.xpm>
@ -146,7 +147,7 @@ static const std::vector<CURSOR_STORE::CURSOR_DEF> standard_cursors = {
nullptr,
cursor_text_xpm,
{ 32, 32 },
{ 7, 10 },
{ 7, 7 },
},
{
KICURSOR::MEASURE,
@ -218,7 +219,7 @@ static const std::vector<CURSOR_STORE::CURSOR_DEF> standard_cursors = {
nullptr,
cursor_component_xpm,
{ 32, 32 },
{ 7, 10 },
{ 7, 7 },
},
{
KICURSOR::SELECT_LASSO,
@ -226,7 +227,7 @@ static const std::vector<CURSOR_STORE::CURSOR_DEF> standard_cursors = {
nullptr,
cursor_select_lasso_xpm,
{ 32, 32 },
{ 7, 10 },
{ 7, 7 },
},
{
KICURSOR::SELECT_WINDOW,
@ -276,6 +277,14 @@ static const std::vector<CURSOR_STORE::CURSOR_DEF> standard_cursors = {
{ 32, 32 },
{ 7, 7 },
},
{
KICURSOR::PLACE,
nullptr,
nullptr,
cursor_place_xpm,
{ 32, 32 },
{ 1, 1 },
},
};

View File

@ -94,7 +94,7 @@ int LIB_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
[&]()
{
if( item )
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING );
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PLACE );
else
m_frame->GetCanvas()->SetCurrentCursor( isText ? KICURSOR::TEXT : KICURSOR::PENCIL );
};

View File

@ -512,7 +512,7 @@ int SCH_DRAWING_TOOLS::SingleClickPlace( const TOOL_EVENT& aEvent )
auto setCursor =
[&]()
{
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::ARROW );
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PLACE );
};
// Set initial cursor
@ -836,7 +836,7 @@ int SCH_DRAWING_TOOLS::TwoClickPlace( const TOOL_EVENT& aEvent )
[&]()
{
if( item )
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING );
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PLACE );
else if( isText )
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::TEXT );
else if( isGlobalLabel )

View File

@ -58,7 +58,8 @@ enum class KICURSOR
LINE_GRAPHIC,
LINE_WIRE,
LINE_WIRE_ADD,
LABEL_HIER
LABEL_HIER,
PLACE
};
/**

View File

@ -94,7 +94,7 @@ int PL_DRAWING_TOOLS::PlaceItem( const TOOL_EVENT& aEvent )
[&]()
{
if( item )
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING );
m_frame->GetCanvas()->SetCurrentCursor( KICURSOR::PLACE );
else
m_frame->GetCanvas()->SetCurrentCursor( isText ? KICURSOR::TEXT : KICURSOR::PENCIL );
};

View File

@ -82,13 +82,13 @@ void PCB_TOOL_BASE::doInteractiveItemPlacement( const std::string& aTool,
if( aOptions & IPO_SINGLE_CLICK )
makeNewItem( controls()->GetCursorPosition() );
auto setCursor =
[&]()
auto setCursor =
[&]()
{
if( !newItem )
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::PENCIL );
else
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::MOVING );
frame()->GetCanvas()->SetCurrentCursor( KICURSOR::PLACE );
};
// Set initial cursor