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
d73ab976
Commit
d73ab976
authored
Jul 09, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added support for placing the footprint anchor.
parent
637919a6
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
65 additions
and
2 deletions
+65
-2
common_actions.cpp
pcbnew/tools/common_actions.cpp
+8
-1
common_actions.h
pcbnew/tools/common_actions.h
+3
-0
drawing_tool.cpp
pcbnew/tools/drawing_tool.cpp
+47
-0
drawing_tool.h
pcbnew/tools/drawing_tool.h
+6
-0
pcbnew_control.cpp
pcbnew/tools/pcbnew_control.cpp
+1
-1
No files found.
pcbnew/tools/common_actions.cpp
View file @
d73ab976
...
...
@@ -101,6 +101,11 @@ TOOL_ACTION COMMON_ACTIONS::placePad( "pcbnew.InteractiveDrawing.placePad",
AS_GLOBAL
,
0
,
"Add pads"
,
"Add pads"
,
AF_ACTIVATE
);
TOOL_ACTION
COMMON_ACTIONS
::
setAnchor
(
"pcbnew.InteractiveDrawing.setAnchor"
,
AS_GLOBAL
,
0
,
"Place the footprint anchor"
,
"Place the footprint anchor"
,
AF_ACTIVATE
);
// View Controls
TOOL_ACTION
COMMON_ACTIONS
::
zoomIn
(
"pcbnew.Control.zoomIn"
,
AS_GLOBAL
,
WXK_F1
,
...
...
@@ -313,6 +318,9 @@ boost::optional<TOOL_EVENT> COMMON_ACTIONS::TranslateLegacyId( int aId )
case
ID_MODEDIT_PAD_TOOL
:
return
COMMON_ACTIONS
::
placePad
.
MakeEvent
();
case
ID_MODEDIT_ANCHOR_TOOL
:
return
COMMON_ACTIONS
::
setAnchor
.
MakeEvent
();
case
ID_PCB_PLACE_GRID_COORD_BUTT
:
case
ID_MODEDIT_PLACE_GRID_COORD
:
return
COMMON_ACTIONS
::
gridSetOrigin
.
MakeEvent
();
...
...
@@ -336,7 +344,6 @@ boost::optional<TOOL_EVENT> COMMON_ACTIONS::TranslateLegacyId( int aId )
case
ID_MENU_PCB_SHOW_HIDE_MUWAVE_TOOLBAR
:
case
ID_MICROWAVE_V_TOOLBAR
:
case
ID_MODEDIT_DELETE_TOOL
:
case
ID_MODEDIT_ANCHOR_TOOL
:
return
COMMON_ACTIONS
::
toBeDone
.
MakeEvent
();
}
...
...
pcbnew/tools/common_actions.h
View file @
d73ab976
...
...
@@ -93,6 +93,9 @@ public:
/// Activation of the drawing tool (placing a PAD)
static
TOOL_ACTION
placePad
;
/// Activation of the drawing tool (placing the footprint anchor)
static
TOOL_ACTION
setAnchor
;
// Push and Shove Router Tool
/// Activation of the Push and Shove router
static
TOOL_ACTION
routerActivate
;
...
...
pcbnew/tools/drawing_tool.cpp
View file @
d73ab976
...
...
@@ -700,6 +700,52 @@ int DRAWING_TOOL::PlacePad( TOOL_EVENT& aEvent )
}
int
DRAWING_TOOL
::
SetAnchor
(
TOOL_EVENT
&
aEvent
)
{
assert
(
m_editModules
);
Activate
();
m_frame
->
SetToolID
(
ID_MODEDIT_ANCHOR_TOOL
,
wxCURSOR_PENCIL
,
_
(
"Place the footprint anchor"
)
);
KIGFX
::
VIEW_CONTROLS
*
controls
=
getViewControls
();
controls
->
ShowCursor
(
true
);
controls
->
SetSnapping
(
true
);
controls
->
SetAutoPan
(
true
);
while
(
OPT_TOOL_EVENT
evt
=
Wait
()
)
{
if
(
evt
->
IsClick
(
BUT_LEFT
)
)
{
MODULE
*
module
=
m_board
->
m_Modules
;
m_frame
->
SaveCopyInUndoList
(
module
,
UR_MODEDIT
);
// set the new relative internal local coordinates of footprint items
VECTOR2I
cursorPos
=
controls
->
GetCursorPosition
();
wxPoint
moveVector
=
module
->
GetPosition
()
-
wxPoint
(
cursorPos
.
x
,
cursorPos
.
y
);
module
->
MoveAnchorPosition
(
moveVector
);
// Usually, we do not need to change twice the anchor position,
// so deselect the active tool
break
;
}
else
if
(
evt
->
IsCancel
()
||
evt
->
IsActivate
()
)
break
;
}
controls
->
SetAutoPan
(
false
);
controls
->
SetSnapping
(
false
);
controls
->
ShowCursor
(
false
);
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
}
bool
DRAWING_TOOL
::
drawSegment
(
int
aShape
,
DRAWSEGMENT
*
aGraphic
)
{
// Only two shapes are currently supported
...
...
@@ -1534,4 +1580,5 @@ void DRAWING_TOOL::setTransitions()
Go
(
&
DRAWING_TOOL
::
PlaceTarget
,
COMMON_ACTIONS
::
placeTarget
.
MakeEvent
()
);
Go
(
&
DRAWING_TOOL
::
PlaceModule
,
COMMON_ACTIONS
::
placeModule
.
MakeEvent
()
);
Go
(
&
DRAWING_TOOL
::
PlacePad
,
COMMON_ACTIONS
::
placePad
.
MakeEvent
()
);
Go
(
&
DRAWING_TOOL
::
SetAnchor
,
COMMON_ACTIONS
::
setAnchor
.
MakeEvent
()
);
}
pcbnew/tools/drawing_tool.h
View file @
d73ab976
...
...
@@ -126,6 +126,12 @@ public:
*/
int
PlacePad
(
TOOL_EVENT
&
aEvent
);
/**
* Function SetAnchor()
* Places the footprint anchor (only in module editor).
*/
int
SetAnchor
(
TOOL_EVENT
&
aEvent
);
/**
* Function EditModules()
* Toggles edit module mode. When enabled, one may select parts of modules individually
...
...
pcbnew/tools/pcbnew_control.cpp
View file @
d73ab976
...
...
@@ -452,7 +452,7 @@ int PCBNEW_CONTROL::GridSetOrigin( TOOL_EVENT& aEvent )
getView
()
->
MarkDirty
();
}
else
if
(
evt
->
IsCancel
()
)
else
if
(
evt
->
IsCancel
()
||
evt
->
IsActivate
()
)
break
;
}
...
...
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