Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
12b8714a
Commit
12b8714a
authored
Sep 26, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Different way of handling CONTEXT_MENU in the selection tool. Removed some unnecessary lines.
parent
61066fa6
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
11 additions
and
18 deletions
+11
-18
selection_tool.cpp
pcbnew/tools/selection_tool.cpp
+10
-13
selection_tool.h
pcbnew/tools/selection_tool.h
+1
-5
No files found.
pcbnew/tools/selection_tool.cpp
View file @
12b8714a
...
@@ -312,21 +312,19 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR* aCollector )
...
@@ -312,21 +312,19 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR* aCollector )
{
{
BOARD_ITEM
*
current
=
NULL
;
BOARD_ITEM
*
current
=
NULL
;
boost
::
shared_ptr
<
BRIGHT_BOX
>
brightBox
;
boost
::
shared_ptr
<
BRIGHT_BOX
>
brightBox
;
CONTEXT_MENU
m_menu
;
m_menu
.
reset
(
new
CONTEXT_MENU
()
);
m_menu
->
SetTitle
(
_
(
"Clarify selection"
)
);
int
limit
=
std
::
min
(
10
,
aCollector
->
GetCount
()
);
int
limit
=
std
::
min
(
10
,
aCollector
->
GetCount
()
);
for
(
int
i
=
0
;
i
<
limit
;
++
i
)
for
(
int
i
=
0
;
i
<
limit
;
++
i
)
{
{
wxString
text
;
wxString
text
;
BOARD_ITEM
*
item
=
(
*
aCollector
)[
i
];
BOARD_ITEM
*
item
=
(
*
aCollector
)[
i
];
text
=
item
->
GetSelectMenuText
();
text
=
item
->
GetSelectMenuText
();
m_menu
->
Add
(
text
,
i
);
m_menu
.
Add
(
text
,
i
);
}
}
SetContextMenu
(
m_menu
.
get
(),
CMENU_NOW
);
m_menu
.
SetTitle
(
_
(
"Clarify selection"
)
);
SetContextMenu
(
&
m_menu
,
CMENU_NOW
);
while
(
OPT_TOOL_EVENT
evt
=
Wait
()
)
while
(
OPT_TOOL_EVENT
evt
=
Wait
()
)
{
{
...
@@ -350,14 +348,8 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR* aCollector )
...
@@ -350,14 +348,8 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR* aCollector )
{
{
optional
<
int
>
id
=
evt
->
GetCommandId
();
optional
<
int
>
id
=
evt
->
GetCommandId
();
if
(
current
)
current
->
ClearSelected
();
if
(
id
&&
(
*
id
>=
0
)
)
if
(
id
&&
(
*
id
>=
0
)
)
{
current
=
(
*
aCollector
)[
*
id
];
current
=
(
*
aCollector
)[
*
id
];
current
->
SetSelected
();
}
break
;
break
;
}
}
...
@@ -371,11 +363,12 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR* aCollector )
...
@@ -371,11 +363,12 @@ BOARD_ITEM* SELECTION_TOOL::disambiguationMenu( GENERAL_COLLECTOR* aCollector )
}
}
getView
()
->
MarkTargetDirty
(
TARGET_OVERLAY
);
getView
()
->
MarkTargetDirty
(
TARGET_OVERLAY
);
return
current
;
return
current
;
}
}
bool
SELECTION_TOOL
::
selectable
(
const
BOARD_ITEM
*
aItem
)
bool
SELECTION_TOOL
::
selectable
(
const
BOARD_ITEM
*
aItem
)
const
{
{
bool
highContrast
=
getView
()
->
GetPainter
()
->
GetSettings
()
->
GetHighContrast
();
bool
highContrast
=
getView
()
->
GetPainter
()
->
GetSettings
()
->
GetHighContrast
();
...
@@ -443,8 +436,12 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem )
...
@@ -443,8 +436,12 @@ bool SELECTION_TOOL::selectable( const BOARD_ITEM* aItem )
// These are not selectable, otherwise silkscreen drawings would be easily destroyed
// These are not selectable, otherwise silkscreen drawings would be easily destroyed
return
false
;
return
false
;
break
;
break
;
default
:
// Suppress warnings
break
;
}
}
// All other items are selected only if the layer on which they exist is visible
// All other items are selected only if the layer on which they exist is visible
return
board
->
IsLayerVisible
(
aItem
->
GetLayer
()
);
return
board
->
IsLayerVisible
(
aItem
->
GetLayer
()
);
}
}
...
...
pcbnew/tools/selection_tool.h
View file @
12b8714a
...
@@ -27,7 +27,6 @@
...
@@ -27,7 +27,6 @@
#define __SELECTION_TOOL_H
#define __SELECTION_TOOL_H
#include <set>
#include <set>
#include <boost/shared_ptr.hpp>
#include <math/vector2d.h>
#include <math/vector2d.h>
#include <tool/tool_interactive.h>
#include <tool/tool_interactive.h>
...
@@ -134,7 +133,7 @@ private:
...
@@ -134,7 +133,7 @@ private:
*
*
* @return True if the item fulfills conditions to be selected.
* @return True if the item fulfills conditions to be selected.
*/
*/
bool
selectable
(
const
BOARD_ITEM
*
aItem
);
bool
selectable
(
const
BOARD_ITEM
*
aItem
)
const
;
/**
/**
* Function containsSelected()
* Function containsSelected()
...
@@ -150,9 +149,6 @@ private:
...
@@ -150,9 +149,6 @@ private:
/// Visual representation of selection box
/// Visual representation of selection box
SELECTION_AREA
*
m_selArea
;
SELECTION_AREA
*
m_selArea
;
/// Menu shown in case of selection ambiguity
boost
::
shared_ptr
<
CONTEXT_MENU
>
m_menu
;
/// Flag saying if items should be added to the current selection or rather replace it
/// Flag saying if items should be added to the current selection or rather replace it
bool
m_additive
;
bool
m_additive
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment