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
242d42cf
Commit
242d42cf
authored
Aug 04, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Changed 'line width change' & 'change arc posture' to TOOL_ACTIONs.
parent
cdffdc39
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
66 additions
and
35 deletions
+66
-35
common_actions.cpp
pcbnew/tools/common_actions.cpp
+12
-0
common_actions.h
pcbnew/tools/common_actions.h
+9
-0
drawing_tool.cpp
pcbnew/tools/drawing_tool.cpp
+45
-35
No files found.
pcbnew/tools/common_actions.cpp
View file @
242d42cf
...
@@ -109,6 +109,18 @@ TOOL_ACTION COMMON_ACTIONS::setAnchor( "pcbnew.InteractiveDrawing.setAnchor",
...
@@ -109,6 +109,18 @@ TOOL_ACTION COMMON_ACTIONS::setAnchor( "pcbnew.InteractiveDrawing.setAnchor",
"Place the footprint anchor"
,
"Place the footprint anchor"
,
"Place the footprint anchor"
,
"Place the footprint anchor"
,
AF_ACTIVATE
);
AF_ACTIVATE
);
TOOL_ACTION
COMMON_ACTIONS
::
incWidth
(
"pcbnew.InteractiveDrawing.incWidth"
,
AS_CONTEXT
,
'+'
,
"Increase the line width"
,
"Increase the line width"
);
TOOL_ACTION
COMMON_ACTIONS
::
decWidth
(
"pcbnew.InteractiveDrawing.decWidth"
,
AS_CONTEXT
,
'-'
,
"Decrease the line width"
,
"Decrease the line width"
);
TOOL_ACTION
COMMON_ACTIONS
::
arcPosture
(
"pcbnew.InteractiveDrawing.arcPosture"
,
AS_CONTEXT
,
'/'
,
"Switch the arc posture"
,
"Switch the arc posture"
);
// View Controls
// View Controls
TOOL_ACTION
COMMON_ACTIONS
::
zoomIn
(
"pcbnew.Control.zoomIn"
,
TOOL_ACTION
COMMON_ACTIONS
::
zoomIn
(
"pcbnew.Control.zoomIn"
,
...
...
pcbnew/tools/common_actions.h
View file @
242d42cf
...
@@ -96,6 +96,15 @@ public:
...
@@ -96,6 +96,15 @@ public:
/// Activation of the drawing tool (placing the footprint anchor)
/// Activation of the drawing tool (placing the footprint anchor)
static
TOOL_ACTION
setAnchor
;
static
TOOL_ACTION
setAnchor
;
/// Increase width of currently drawn line
static
TOOL_ACTION
incWidth
;
/// Decrease width of currently drawn line
static
TOOL_ACTION
decWidth
;
/// Switch posture when drawing arc
static
TOOL_ACTION
arcPosture
;
// Push and Shove Router Tool
// Push and Shove Router Tool
/// Activation of the Push and Shove router
/// Activation of the Push and Shove router
static
TOOL_ACTION
routerActivate
;
static
TOOL_ACTION
routerActivate
;
...
...
pcbnew/tools/drawing_tool.cpp
View file @
242d42cf
...
@@ -941,19 +941,6 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
...
@@ -941,19 +941,6 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
break
;
break
;
}
}
else
if
(
evt
->
IsKeyPressed
()
)
{
int
width
=
aGraphic
->
GetWidth
();
// Modify the new item width
if
(
evt
->
KeyCode
()
==
'-'
&&
width
>
WIDTH_STEP
)
// TODO change it to TOOL_ACTIONs
aGraphic
->
SetWidth
(
width
-
WIDTH_STEP
);
else
if
(
evt
->
KeyCode
()
==
'='
)
aGraphic
->
SetWidth
(
width
+
WIDTH_STEP
);
updatePreview
=
true
;
}
else
if
(
evt
->
IsClick
(
BUT_LEFT
)
)
else
if
(
evt
->
IsClick
(
BUT_LEFT
)
)
{
{
if
(
!
started
)
if
(
!
started
)
...
@@ -1014,6 +1001,23 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
...
@@ -1014,6 +1001,23 @@ bool DRAWING_TOOL::drawSegment( int aShape, DRAWSEGMENT*& aGraphic,
updatePreview
=
true
;
updatePreview
=
true
;
}
}
else
if
(
evt
->
IsAction
(
&
COMMON_ACTIONS
::
incWidth
)
)
{
aGraphic
->
SetWidth
(
aGraphic
->
GetWidth
()
+
WIDTH_STEP
);
updatePreview
=
true
;
}
else
if
(
evt
->
IsAction
(
&
COMMON_ACTIONS
::
decWidth
)
)
{
int
width
=
aGraphic
->
GetWidth
();
if
(
width
>
WIDTH_STEP
)
{
aGraphic
->
SetWidth
(
width
-
WIDTH_STEP
);
updatePreview
=
true
;
}
}
if
(
updatePreview
)
if
(
updatePreview
)
preview
.
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
preview
.
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
}
}
...
@@ -1071,28 +1075,6 @@ bool DRAWING_TOOL::drawArc( DRAWSEGMENT*& aGraphic )
...
@@ -1071,28 +1075,6 @@ bool DRAWING_TOOL::drawArc( DRAWSEGMENT*& aGraphic )
break
;
break
;
}
}
else
if
(
evt
->
IsKeyPressed
()
&&
step
!=
SET_ORIGIN
)
{
int
width
=
aGraphic
->
GetWidth
();
// Modify the new item width
if
(
evt
->
KeyCode
()
==
'-'
&&
width
>
WIDTH_STEP
)
// TODO convert to tool actions
aGraphic
->
SetWidth
(
width
-
WIDTH_STEP
);
else
if
(
evt
->
KeyCode
()
==
'='
)
aGraphic
->
SetWidth
(
width
+
WIDTH_STEP
);
else
if
(
evt
->
KeyCode
()
==
'/'
)
{
if
(
clockwise
)
aGraphic
->
SetAngle
(
aGraphic
->
GetAngle
()
-
3600.0
);
else
aGraphic
->
SetAngle
(
aGraphic
->
GetAngle
()
+
3600.0
);
clockwise
=
!
clockwise
;
}
preview
.
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
}
else
if
(
evt
->
IsClick
(
BUT_LEFT
)
)
else
if
(
evt
->
IsClick
(
BUT_LEFT
)
)
{
{
switch
(
step
)
switch
(
step
)
...
@@ -1191,6 +1173,34 @@ bool DRAWING_TOOL::drawArc( DRAWSEGMENT*& aGraphic )
...
@@ -1191,6 +1173,34 @@ bool DRAWING_TOOL::drawArc( DRAWSEGMENT*& aGraphic )
// Show a preview of the item
// Show a preview of the item
preview
.
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
preview
.
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
}
}
else
if
(
evt
->
IsAction
(
&
COMMON_ACTIONS
::
incWidth
)
)
{
aGraphic
->
SetWidth
(
aGraphic
->
GetWidth
()
+
WIDTH_STEP
);
preview
.
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
}
else
if
(
evt
->
IsAction
(
&
COMMON_ACTIONS
::
decWidth
)
)
{
int
width
=
aGraphic
->
GetWidth
();
if
(
width
>
WIDTH_STEP
)
{
aGraphic
->
SetWidth
(
width
-
WIDTH_STEP
);
preview
.
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
}
}
else
if
(
evt
->
IsAction
(
&
COMMON_ACTIONS
::
arcPosture
)
)
{
if
(
clockwise
)
aGraphic
->
SetAngle
(
aGraphic
->
GetAngle
()
-
3600.0
);
else
aGraphic
->
SetAngle
(
aGraphic
->
GetAngle
()
+
3600.0
);
clockwise
=
!
clockwise
;
preview
.
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
}
}
}
m_controls
->
ShowCursor
(
false
);
m_controls
->
ShowCursor
(
false
);
...
...
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