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
ee3f47ae
Commit
ee3f47ae
authored
Sep 02, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added autopanning to the selection tool.
parent
8e88a621
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
8 deletions
+34
-8
pcbframe.cpp
pcbnew/pcbframe.cpp
+1
-2
selection_tool.cpp
pcbnew/tools/selection_tool.cpp
+33
-6
No files found.
pcbnew/pcbframe.cpp
View file @
ee3f47ae
...
...
@@ -319,8 +319,6 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
for
(
int
i
=
0
;
i
<
10
;
i
++
)
m_Macros
[
i
].
m_Record
.
clear
();
setupTools
();
SetBoard
(
new
BOARD
()
);
...
...
@@ -482,6 +480,7 @@ PCB_EDIT_FRAME::PCB_EDIT_FRAME( wxWindow* parent, const wxString& title,
}
}
setupTools
();
}
PCB_EDIT_FRAME
::~
PCB_EDIT_FRAME
()
...
...
pcbnew/tools/selection_tool.cpp
View file @
ee3f47ae
...
...
@@ -32,6 +32,7 @@
#include <wxPcbStruct.h>
#include <collectors.h>
#include <view/view_controls.h>
#include <tool/context_menu.h>
...
...
@@ -59,13 +60,15 @@ void SELECTION_TOOL::Reset()
{
m_selectedItems
.
clear
();
//
t
he tool launches upon reception of activate ("pcbnew.InteractiveSelection")
Go
(
&
SELECTION_TOOL
::
Main
,
TOOL_EVENT
(
TC_Command
,
TA_ActivateTool
,
GetName
()
)
);
//"pcbnew.InteractiveSelection"));
//
T
he tool launches upon reception of activate ("pcbnew.InteractiveSelection")
Go
(
&
SELECTION_TOOL
::
Main
,
TOOL_EVENT
(
TC_Command
,
TA_ActivateTool
,
GetName
()
)
);
}
int
SELECTION_TOOL
::
Main
(
TOOL_EVENT
&
aEvent
)
{
bool
dragging
=
false
;
// Main loop: keep receiving events
while
(
OPT_TOOL_EVENT
evt
=
Wait
()
)
{
...
...
@@ -76,18 +79,42 @@ int SELECTION_TOOL::Main( TOOL_EVENT& aEvent )
if
(
!
m_selectedItems
.
empty
()
)
clearSelection
();
else
return
0
;
break
;
// Finish
}
// single click? Select single object
if
(
evt
->
IsClick
(
MB_Left
)
)
selectSingle
(
evt
->
Position
()
);
// drag with LMB? Select multiple objects (or at least draw a selection box)
// drag with LMB? Select multiple objects (or at least draw a selection box)
or drag them
if
(
evt
->
IsDrag
(
MB_Left
)
)
selectMultiple
();
{
dragging
=
true
;
getViewControls
()
->
SetAutoPan
(
true
);
if
(
m_selectedItems
.
empty
()
||
m_additive
)
{
// If nothings has been selected or user wants to select more
// draw the selection box
selectMultiple
();
}
else
{
// Now user wants to drag the selected items
m_toolMgr
->
InvokeTool
(
"pcbnew.InteractiveMove"
);
}
}
else
if
(
dragging
)
{
dragging
=
false
;
getViewControls
()
->
SetAutoPan
(
false
);
}
}
// Restore the default settings
getViewControls
()
->
SetAutoPan
(
false
);
return
0
;
}
...
...
@@ -213,7 +240,7 @@ void SELECTION_TOOL::selectMultiple()
m_selArea
->
SetOrigin
(
evt
->
DragOrigin
()
);
m_selArea
->
SetEnd
(
evt
->
Position
()
);
m_selArea
->
ViewSetVisible
(
true
);
m_selArea
->
ViewUpdate
(
VIEW_ITEM
::
APPEARANCE
|
VIEW_ITEM
::
GEOMETRY
);
m_selArea
->
ViewUpdate
(
VIEW_ITEM
::
GEOMETRY
);
}
if
(
evt
->
IsMouseUp
(
MB_Left
)
)
...
...
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