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
517bfa35
Commit
517bfa35
authored
Jun 04, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Minor code cleaning.
parent
35e34359
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
20 additions
and
16 deletions
+20
-16
router_tool.cpp
pcbnew/router/router_tool.cpp
+2
-2
edit_tool.cpp
pcbnew/tools/edit_tool.cpp
+10
-13
selection_tool.cpp
pcbnew/tools/selection_tool.cpp
+1
-1
selection_tool.h
pcbnew/tools/selection_tool.h
+7
-0
No files found.
pcbnew/router/router_tool.cpp
View file @
517bfa35
...
@@ -385,7 +385,7 @@ void ROUTER_TOOL::handleCommonEvents( TOOL_EVENT& aEvent )
...
@@ -385,7 +385,7 @@ void ROUTER_TOOL::handleCommonEvents( TOOL_EVENT& aEvent )
#endif
#endif
if
(
aEvent
.
IsAction
(
&
ACT_RouterOptions
)
)
if
(
aEvent
.
IsAction
(
&
ACT_RouterOptions
)
)
{
{
DIALOG_PNS_SETTINGS
settingsDlg
(
m_toolMgr
->
GetEditFrame
(),
m_router
->
Settings
()
);
DIALOG_PNS_SETTINGS
settingsDlg
(
getEditFrame
<
PCB_EDIT_FRAME
>
(),
m_router
->
Settings
()
);
if
(
settingsDlg
.
ShowModal
()
)
if
(
settingsDlg
.
ShowModal
()
)
m_router
->
ApplySettings
();
m_router
->
ApplySettings
();
...
@@ -393,7 +393,7 @@ void ROUTER_TOOL::handleCommonEvents( TOOL_EVENT& aEvent )
...
@@ -393,7 +393,7 @@ void ROUTER_TOOL::handleCommonEvents( TOOL_EVENT& aEvent )
else
if
(
aEvent
.
IsAction
(
&
ACT_CustomTrackWidth
)
)
else
if
(
aEvent
.
IsAction
(
&
ACT_CustomTrackWidth
)
)
{
{
DIALOG_TRACK_VIA_SIZE
sizeDlg
(
m_toolMgr
->
GetEditFrame
(),
m_router
->
Settings
()
);
DIALOG_TRACK_VIA_SIZE
sizeDlg
(
getEditFrame
<
PCB_EDIT_FRAME
>
(),
m_router
->
Settings
()
);
BOARD_DESIGN_SETTINGS
&
bds
=
getModel
<
BOARD
>
(
PCB_T
)
->
GetDesignSettings
();
BOARD_DESIGN_SETTINGS
&
bds
=
getModel
<
BOARD
>
(
PCB_T
)
->
GetDesignSettings
();
sizeDlg
.
ShowModal
();
sizeDlg
.
ShowModal
();
...
...
pcbnew/tools/edit_tool.cpp
View file @
517bfa35
...
@@ -93,7 +93,7 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent )
...
@@ -93,7 +93,7 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent )
m_updateFlag
=
KIGFX
::
VIEW_ITEM
::
GEOMETRY
;
m_updateFlag
=
KIGFX
::
VIEW_ITEM
::
GEOMETRY
;
KIGFX
::
VIEW_CONTROLS
*
controls
=
getViewControls
();
KIGFX
::
VIEW_CONTROLS
*
controls
=
getViewControls
();
PCB_EDIT_FRAME
*
editFrame
=
static_cast
<
PCB_EDIT_FRAME
*>
(
m_toolMgr
->
GetEditFrame
()
);
PCB_EDIT_FRAME
*
editFrame
=
getEditFrame
<
PCB_EDIT_FRAME
>
(
);
controls
->
ShowCursor
(
true
);
controls
->
ShowCursor
(
true
);
controls
->
SetSnapping
(
true
);
controls
->
SetSnapping
(
true
);
controls
->
SetAutoPan
(
true
);
controls
->
SetAutoPan
(
true
);
...
@@ -208,7 +208,7 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent )
...
@@ -208,7 +208,7 @@ int EDIT_TOOL::Main( TOOL_EVENT& aEvent )
int
EDIT_TOOL
::
Properties
(
TOOL_EVENT
&
aEvent
)
int
EDIT_TOOL
::
Properties
(
TOOL_EVENT
&
aEvent
)
{
{
const
SELECTION_TOOL
::
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
const
SELECTION_TOOL
::
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
PCB_EDIT_FRAME
*
editFrame
=
static_cast
<
PCB_EDIT_FRAME
*>
(
m_toolMgr
->
GetEditFrame
()
);
PCB_EDIT_FRAME
*
editFrame
=
getEditFrame
<
PCB_EDIT_FRAME
>
(
);
// Shall the selection be cleared at the end?
// Shall the selection be cleared at the end?
bool
unselect
=
selection
.
Empty
();
bool
unselect
=
selection
.
Empty
();
...
@@ -224,7 +224,7 @@ int EDIT_TOOL::Properties( TOOL_EVENT& aEvent )
...
@@ -224,7 +224,7 @@ int EDIT_TOOL::Properties( TOOL_EVENT& aEvent )
if
(
selection
.
Size
()
==
1
)
if
(
selection
.
Size
()
==
1
)
{
{
// Display properties dialog
// Display properties dialog
BOARD_ITEM
*
item
=
s
tatic_cast
<
BOARD_ITEM
*>
(
selection
.
items
.
GetPickedItem
(
0
)
);
BOARD_ITEM
*
item
=
s
election
.
Item
<
BOARD_ITEM
>
(
0
);
// Check if user wants to edit pad or module properties
// Check if user wants to edit pad or module properties
if
(
item
->
Type
()
==
PCB_MODULE_T
)
if
(
item
->
Type
()
==
PCB_MODULE_T
)
...
@@ -280,7 +280,7 @@ int EDIT_TOOL::Properties( TOOL_EVENT& aEvent )
...
@@ -280,7 +280,7 @@ int EDIT_TOOL::Properties( TOOL_EVENT& aEvent )
int
EDIT_TOOL
::
Rotate
(
TOOL_EVENT
&
aEvent
)
int
EDIT_TOOL
::
Rotate
(
TOOL_EVENT
&
aEvent
)
{
{
const
SELECTION_TOOL
::
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
const
SELECTION_TOOL
::
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
PCB_EDIT_FRAME
*
editFrame
=
static_cast
<
PCB_EDIT_FRAME
*>
(
m_toolMgr
->
GetEditFrame
()
);
PCB_EDIT_FRAME
*
editFrame
=
getEditFrame
<
PCB_EDIT_FRAME
>
(
);
// Shall the selection be cleared at the end?
// Shall the selection be cleared at the end?
bool
unselect
=
selection
.
Empty
();
bool
unselect
=
selection
.
Empty
();
...
@@ -302,7 +302,7 @@ int EDIT_TOOL::Rotate( TOOL_EVENT& aEvent )
...
@@ -302,7 +302,7 @@ int EDIT_TOOL::Rotate( TOOL_EVENT& aEvent )
for
(
unsigned
int
i
=
0
;
i
<
selection
.
items
.
GetCount
();
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
selection
.
items
.
GetCount
();
++
i
)
{
{
BOARD_ITEM
*
item
=
s
tatic_cast
<
BOARD_ITEM
*>
(
selection
.
items
.
GetPickedItem
(
i
)
);
BOARD_ITEM
*
item
=
s
election
.
Item
<
BOARD_ITEM
>
(
i
);
item
->
Rotate
(
rotatePoint
,
editFrame
->
GetRotationAngle
()
);
item
->
Rotate
(
rotatePoint
,
editFrame
->
GetRotationAngle
()
);
...
@@ -334,7 +334,7 @@ int EDIT_TOOL::Rotate( TOOL_EVENT& aEvent )
...
@@ -334,7 +334,7 @@ int EDIT_TOOL::Rotate( TOOL_EVENT& aEvent )
int
EDIT_TOOL
::
Flip
(
TOOL_EVENT
&
aEvent
)
int
EDIT_TOOL
::
Flip
(
TOOL_EVENT
&
aEvent
)
{
{
const
SELECTION_TOOL
::
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
const
SELECTION_TOOL
::
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
PCB_EDIT_FRAME
*
editFrame
=
static_cast
<
PCB_EDIT_FRAME
*>
(
m_toolMgr
->
GetEditFrame
()
);
PCB_EDIT_FRAME
*
editFrame
=
getEditFrame
<
PCB_EDIT_FRAME
>
(
);
// Shall the selection be cleared at the end?
// Shall the selection be cleared at the end?
bool
unselect
=
selection
.
Empty
();
bool
unselect
=
selection
.
Empty
();
...
@@ -356,7 +356,7 @@ int EDIT_TOOL::Flip( TOOL_EVENT& aEvent )
...
@@ -356,7 +356,7 @@ int EDIT_TOOL::Flip( TOOL_EVENT& aEvent )
for
(
unsigned
int
i
=
0
;
i
<
selection
.
items
.
GetCount
();
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
selection
.
items
.
GetCount
();
++
i
)
{
{
BOARD_ITEM
*
item
=
s
tatic_cast
<
BOARD_ITEM
*>
(
selection
.
items
.
GetPickedItem
(
i
)
);
BOARD_ITEM
*
item
=
s
election
.
Item
<
BOARD_ITEM
>
(
i
);
item
->
Flip
(
flipPoint
);
item
->
Flip
(
flipPoint
);
...
@@ -398,7 +398,7 @@ int EDIT_TOOL::Remove( TOOL_EVENT& aEvent )
...
@@ -398,7 +398,7 @@ int EDIT_TOOL::Remove( TOOL_EVENT& aEvent )
// Get a copy of the selected items set
// Get a copy of the selected items set
PICKED_ITEMS_LIST
selectedItems
=
selection
.
items
;
PICKED_ITEMS_LIST
selectedItems
=
selection
.
items
;
PCB_EDIT_FRAME
*
editFrame
=
static_cast
<
PCB_EDIT_FRAME
*>
(
m_toolMgr
->
GetEditFrame
()
);
PCB_EDIT_FRAME
*
editFrame
=
getEditFrame
<
PCB_EDIT_FRAME
>
(
);
// As we are about to remove items, they have to be removed from the selection first
// As we are about to remove items, they have to be removed from the selection first
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
selectionClear
);
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
selectionClear
);
...
@@ -412,10 +412,7 @@ int EDIT_TOOL::Remove( TOOL_EVENT& aEvent )
...
@@ -412,10 +412,7 @@ int EDIT_TOOL::Remove( TOOL_EVENT& aEvent )
// And now remove
// And now remove
for
(
unsigned
int
i
=
0
;
i
<
selectedItems
.
GetCount
();
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
selectedItems
.
GetCount
();
++
i
)
{
remove
(
static_cast
<
BOARD_ITEM
*>
(
selectedItems
.
GetPickedItem
(
i
)
)
);
BOARD_ITEM
*
item
=
static_cast
<
BOARD_ITEM
*>
(
selectedItems
.
GetPickedItem
(
i
)
);
remove
(
item
);
}
getModel
<
BOARD
>
(
PCB_T
)
->
GetRatsnest
()
->
Recalculate
();
getModel
<
BOARD
>
(
PCB_T
)
->
GetRatsnest
()
->
Recalculate
();
...
@@ -491,7 +488,7 @@ void EDIT_TOOL::updateRatsnest( bool aRedraw )
...
@@ -491,7 +488,7 @@ void EDIT_TOOL::updateRatsnest( bool aRedraw )
ratsnest
->
ClearSimple
();
ratsnest
->
ClearSimple
();
for
(
unsigned
int
i
=
0
;
i
<
selection
.
items
.
GetCount
();
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
selection
.
items
.
GetCount
();
++
i
)
{
{
BOARD_ITEM
*
item
=
s
tatic_cast
<
BOARD_ITEM
*>
(
selection
.
items
.
GetPickedItem
(
i
)
);
BOARD_ITEM
*
item
=
s
election
.
Item
<
BOARD_ITEM
>
(
i
);
ratsnest
->
Update
(
item
);
ratsnest
->
Update
(
item
);
...
...
pcbnew/tools/selection_tool.cpp
View file @
517bfa35
...
@@ -658,7 +658,7 @@ bool SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
...
@@ -658,7 +658,7 @@ bool SELECTION_TOOL::selectionContains( const VECTOR2I& aPoint ) const
// Check if the point is located within any of the currently selected items bounding boxes
// Check if the point is located within any of the currently selected items bounding boxes
for
(
unsigned
int
i
=
0
;
i
<
m_selection
.
items
.
GetCount
();
++
i
)
for
(
unsigned
int
i
=
0
;
i
<
m_selection
.
items
.
GetCount
();
++
i
)
{
{
BOARD_ITEM
*
item
=
static_cast
<
BOARD_ITEM
*>
(
m_selection
.
items
.
GetPickedItem
(
i
)
);
BOARD_ITEM
*
item
=
m_selection
.
Item
<
BOARD_ITEM
>
(
i
);
BOX2I
itemBox
=
item
->
ViewBBox
();
BOX2I
itemBox
=
item
->
ViewBBox
();
itemBox
.
Inflate
(
margin
.
x
,
margin
.
y
);
// Give some margin for gripping an item
itemBox
.
Inflate
(
margin
.
x
,
margin
.
y
);
// Give some margin for gripping an item
...
...
pcbnew/tools/selection_tool.h
View file @
517bfa35
...
@@ -78,6 +78,13 @@ public:
...
@@ -78,6 +78,13 @@ public:
return
items
.
GetCount
();
return
items
.
GetCount
();
}
}
/// Alias to make code shorter and clearer
template
<
typename
T
>
T
*
Item
(
unsigned
int
aIndex
)
const
{
return
static_cast
<
T
*>
(
items
.
GetPickedItem
(
aIndex
)
);
}
private
:
private
:
/// Clears both the VIEW_GROUP and set of selected items. Please note that it does not
/// Clears both the VIEW_GROUP and set of selected items. Please note that it does not
/// change properties of selected items (e.g. selection flag).
/// change properties of selected items (e.g. selection flag).
...
...
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