Add selection lasso and window cursors
This commit is contained in:
parent
8f4fba4c67
commit
bd30a4a406
|
@ -0,0 +1,38 @@
|
||||||
|
/* XPM */
|
||||||
|
static char const *cursor_select_lasso_xpm[] = {
|
||||||
|
"32 32 3 1",
|
||||||
|
" c None",
|
||||||
|
"! c black",
|
||||||
|
"# c white",
|
||||||
|
" # ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" ##### ##### ",
|
||||||
|
"#!!!!! !!!!!# ",
|
||||||
|
" ##### ##### ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ################### ",
|
||||||
|
" #!# #!!!!!!!!!!!!!!!!!# ",
|
||||||
|
" #!# #!###############!# ",
|
||||||
|
" #!# #!# #!# ",
|
||||||
|
" # #!# #!# ",
|
||||||
|
" #!# #!# ",
|
||||||
|
" #!!!# #!# ",
|
||||||
|
" #!!!!!# #!# ",
|
||||||
|
" #!!!!!!!# #!# ",
|
||||||
|
" #!!!!!!!# #!# ",
|
||||||
|
" #!!!!!!!# #!# ",
|
||||||
|
" #!!!!!# #!# ",
|
||||||
|
" #!!!# #!# ",
|
||||||
|
" #!# #!# ",
|
||||||
|
" #!# #!# ",
|
||||||
|
" #!# #!# ",
|
||||||
|
" #!###############!# ",
|
||||||
|
" #!!!!!!!!!!!!!!!!!# ",
|
||||||
|
" ################### ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
|
@ -0,0 +1,38 @@
|
||||||
|
/* XPM */
|
||||||
|
static char const *cursor_select_window_xpm[] = {
|
||||||
|
"32 32 3 1",
|
||||||
|
" c None",
|
||||||
|
"! c black",
|
||||||
|
"# c white",
|
||||||
|
" # ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ",
|
||||||
|
" ##### ##### ",
|
||||||
|
"#!!!!! !!!!!# ",
|
||||||
|
" ##### ##### ",
|
||||||
|
" #!# ",
|
||||||
|
" #!# ################### ",
|
||||||
|
" #!# #!!!!!!!!!!!!!!!!!# ",
|
||||||
|
" #!# #!###############!# ",
|
||||||
|
" #!# #!# #!# ",
|
||||||
|
" # #!# #!# ",
|
||||||
|
" #!# ### #!# ",
|
||||||
|
" #!# #!!!# #!# ",
|
||||||
|
" #!# #!!!!!# #!# ",
|
||||||
|
" #!# #!!!!!!!# #!# ",
|
||||||
|
" #!# #!!!!!!!# #!# ",
|
||||||
|
" #!# #!!!!!!!# #!# ",
|
||||||
|
" #!# #!!!!!# #!# ",
|
||||||
|
" #!# #!!!# #!# ",
|
||||||
|
" #!# ### #!# ",
|
||||||
|
" #!# #!# ",
|
||||||
|
" #!# #!# ",
|
||||||
|
" #!###############!# ",
|
||||||
|
" #!!!!!!!!!!!!!!!!!# ",
|
||||||
|
" ################### ",
|
||||||
|
" ",
|
||||||
|
" ",
|
||||||
|
" "};
|
|
@ -33,7 +33,9 @@
|
||||||
#include <cursors/cursor-net-label.xpm>
|
#include <cursors/cursor-net-label.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-m.xpm>
|
#include <cursors/cursor-select-m.xpm>
|
||||||
|
#include <cursors/cursor-select-window.xpm>
|
||||||
#include <cursors/cursor-subtract.xpm>
|
#include <cursors/cursor-subtract.xpm>
|
||||||
#include <cursors/cursor-text.xpm>
|
#include <cursors/cursor-text.xpm>
|
||||||
#include <cursors/cursor-xor.xpm>
|
#include <cursors/cursor-xor.xpm>
|
||||||
|
@ -222,6 +224,22 @@ static const std::vector<CURSOR_STORE::CURSOR_DEF> standard_cursors = {
|
||||||
{ 32, 32 },
|
{ 32, 32 },
|
||||||
{ 7, 10 },
|
{ 7, 10 },
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
KICURSOR::SELECT_LASSO,
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
cursor_select_lasso_xpm,
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 7, 10 },
|
||||||
|
},
|
||||||
|
{
|
||||||
|
KICURSOR::SELECT_WINDOW,
|
||||||
|
nullptr,
|
||||||
|
nullptr,
|
||||||
|
cursor_select_window_xpm,
|
||||||
|
{ 32, 32 },
|
||||||
|
{ 7, 10 },
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -974,6 +974,20 @@ bool EE_SELECTION_TOOL::selectMultiple()
|
||||||
|
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
|
int width = area.GetEnd().x - area.GetOrigin().x;
|
||||||
|
|
||||||
|
/* Selection mode depends on direction of drag-selection:
|
||||||
|
* Left > Right : Select objects that are fully enclosed by selection
|
||||||
|
* Right > Left : Select objects that are crossed by selection
|
||||||
|
*/
|
||||||
|
bool windowSelection = width >= 0;
|
||||||
|
|
||||||
|
if( view->IsMirroredX() )
|
||||||
|
windowSelection = !windowSelection;
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor(
|
||||||
|
windowSelection ? KICURSOR::SELECT_WINDOW : KICURSOR::SELECT_LASSO );
|
||||||
|
|
||||||
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
||||||
{
|
{
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
|
@ -1028,20 +1042,11 @@ bool EE_SELECTION_TOOL::selectMultiple()
|
||||||
|
|
||||||
selectedItems.insert( selectedItems.end(), sheetPins.begin(), sheetPins.end() );
|
selectedItems.insert( selectedItems.end(), sheetPins.begin(), sheetPins.end() );
|
||||||
|
|
||||||
int width = area.GetEnd().x - area.GetOrigin().x;
|
|
||||||
int height = area.GetEnd().y - area.GetOrigin().y;
|
int height = area.GetEnd().y - area.GetOrigin().y;
|
||||||
|
|
||||||
/* Selection mode depends on direction of drag-selection:
|
|
||||||
* Left > Right : Select objects that are fully enclosed by selection
|
|
||||||
* Right > Left : Select objects that are crossed by selection
|
|
||||||
*/
|
|
||||||
bool windowSelection = width >= 0;
|
|
||||||
bool anyAdded = false;
|
bool anyAdded = false;
|
||||||
bool anySubtracted = false;
|
bool anySubtracted = false;
|
||||||
|
|
||||||
if( view->IsMirroredX() )
|
|
||||||
windowSelection = !windowSelection;
|
|
||||||
|
|
||||||
// Construct an EDA_RECT to determine EDA_ITEM selection
|
// Construct an EDA_RECT to determine EDA_ITEM selection
|
||||||
EDA_RECT selectionRect( (wxPoint) area.GetOrigin(), wxSize( width, height ) );
|
EDA_RECT selectionRect( (wxPoint) area.GetOrigin(), wxSize( width, height ) );
|
||||||
|
|
||||||
|
|
|
@ -52,7 +52,9 @@ enum class KICURSOR
|
||||||
ZOOM_OUT,
|
ZOOM_OUT,
|
||||||
NET_LABEL,
|
NET_LABEL,
|
||||||
GLOBAL_LABEL,
|
GLOBAL_LABEL,
|
||||||
COMPONENT
|
COMPONENT,
|
||||||
|
SELECT_WINDOW,
|
||||||
|
SELECT_LASSO
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -342,6 +342,17 @@ bool PL_SELECTION_TOOL::selectMultiple()
|
||||||
|
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
|
int width = area.GetEnd().x - area.GetOrigin().x;
|
||||||
|
|
||||||
|
/* Selection mode depends on direction of drag-selection:
|
||||||
|
* Left > Right : Select objects that are fully enclosed by selection
|
||||||
|
* Right > Left : Select objects that are crossed by selection
|
||||||
|
*/
|
||||||
|
bool windowSelection = width >= 0 ? true : false;
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor(
|
||||||
|
windowSelection ? KICURSOR::SELECT_WINDOW : KICURSOR::SELECT_LASSO );
|
||||||
|
|
||||||
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
||||||
{
|
{
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
|
@ -372,14 +383,8 @@ bool PL_SELECTION_TOOL::selectMultiple()
|
||||||
// End drawing the selection box
|
// End drawing the selection box
|
||||||
view->SetVisible( &area, false );
|
view->SetVisible( &area, false );
|
||||||
|
|
||||||
int width = area.GetEnd().x - area.GetOrigin().x;
|
|
||||||
int height = area.GetEnd().y - area.GetOrigin().y;
|
int height = area.GetEnd().y - area.GetOrigin().y;
|
||||||
|
|
||||||
/* Selection mode depends on direction of drag-selection:
|
|
||||||
* Left > Right : Select objects that are fully enclosed by selection
|
|
||||||
* Right > Left : Select objects that are crossed by selection
|
|
||||||
*/
|
|
||||||
bool windowSelection = width >= 0 ? true : false;
|
|
||||||
bool anyAdded = false;
|
bool anyAdded = false;
|
||||||
bool anySubtracted = false;
|
bool anySubtracted = false;
|
||||||
|
|
||||||
|
|
|
@ -643,6 +643,20 @@ bool SELECTION_TOOL::selectMultiple()
|
||||||
|
|
||||||
while( TOOL_EVENT* evt = Wait() )
|
while( TOOL_EVENT* evt = Wait() )
|
||||||
{
|
{
|
||||||
|
int width = area.GetEnd().x - area.GetOrigin().x;
|
||||||
|
|
||||||
|
/* Selection mode depends on direction of drag-selection:
|
||||||
|
* Left > Right : Select objects that are fully enclosed by selection
|
||||||
|
* Right > Left : Select objects that are crossed by selection
|
||||||
|
*/
|
||||||
|
bool windowSelection = width >= 0 ? true : false;
|
||||||
|
|
||||||
|
if( view->IsMirroredX() )
|
||||||
|
windowSelection = !windowSelection;
|
||||||
|
|
||||||
|
m_frame->GetCanvas()->SetCurrentCursor(
|
||||||
|
windowSelection ? KICURSOR::SELECT_WINDOW : KICURSOR::SELECT_LASSO );
|
||||||
|
|
||||||
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
if( evt->IsCancelInteractive() || evt->IsActivate() )
|
||||||
{
|
{
|
||||||
cancelled = true;
|
cancelled = true;
|
||||||
|
@ -683,18 +697,8 @@ bool SELECTION_TOOL::selectMultiple()
|
||||||
BOX2I selectionBox = area.ViewBBox();
|
BOX2I selectionBox = area.ViewBBox();
|
||||||
view->Query( selectionBox, candidates ); // Get the list of nearby items
|
view->Query( selectionBox, candidates ); // Get the list of nearby items
|
||||||
|
|
||||||
int width = area.GetEnd().x - area.GetOrigin().x;
|
|
||||||
int height = area.GetEnd().y - area.GetOrigin().y;
|
int height = area.GetEnd().y - area.GetOrigin().y;
|
||||||
|
|
||||||
/* Selection mode depends on direction of drag-selection:
|
|
||||||
* Left > Right : Select objects that are fully enclosed by selection
|
|
||||||
* Right > Left : Select objects that are crossed by selection
|
|
||||||
*/
|
|
||||||
bool windowSelection = width >= 0 ? true : false;
|
|
||||||
|
|
||||||
if( view->IsMirroredX() )
|
|
||||||
windowSelection = !windowSelection;
|
|
||||||
|
|
||||||
// Construct an EDA_RECT to determine BOARD_ITEM selection
|
// Construct an EDA_RECT to determine BOARD_ITEM selection
|
||||||
EDA_RECT selectionRect( (wxPoint) area.GetOrigin(), wxSize( width, height ) );
|
EDA_RECT selectionRect( (wxPoint) area.GetOrigin(), wxSize( width, height ) );
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue