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
e6c1254d
Commit
e6c1254d
authored
Jul 09, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
"Create corner" context menu entry for draw segments and zone outlines (GAL).
parent
ff30ced4
Changes
4
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
56 additions
and
13 deletions
+56
-13
common_actions.cpp
pcbnew/tools/common_actions.cpp
+6
-0
common_actions.h
pcbnew/tools/common_actions.h
+3
-0
point_editor.cpp
pcbnew/tools/point_editor.cpp
+41
-6
point_editor.h
pcbnew/tools/point_editor.h
+6
-7
No files found.
pcbnew/tools/common_actions.cpp
View file @
e6c1254d
...
...
@@ -322,10 +322,16 @@ TOOL_ACTION COMMON_ACTIONS::routerActivate( "pcbnew.InteractiveRouter",
AS_GLOBAL
,
'X'
,
"Run push & shove router"
,
"Run push & shove router"
,
AF_ACTIVATE
);
// Point editor
TOOL_ACTION
COMMON_ACTIONS
::
pointEditorUpdate
(
"pcbnew.PointEditor.update"
,
AS_GLOBAL
,
0
,
""
,
""
);
// No description, it is not supposed to be shown anywhere
TOOL_ACTION
COMMON_ACTIONS
::
pointEditorBreakOutline
(
"pcbnew.PointEditor.breakOutline"
,
AS_GLOBAL
,
0
,
"Create corner"
,
"Create corner"
);
// Placement tool
TOOL_ACTION
COMMON_ACTIONS
::
alignTop
(
"pcbnew.Place.alignTop"
,
...
...
pcbnew/tools/common_actions.h
View file @
e6c1254d
...
...
@@ -105,6 +105,9 @@ public:
/// Update edit points
static
TOOL_ACTION
pointEditorUpdate
;
/// Break outline (insert additional points to an edge)
static
TOOL_ACTION
pointEditorBreakOutline
;
// Placement tool
/// Align items to the top edge of selection bounding box
static
TOOL_ACTION
alignTop
;
...
...
pcbnew/tools/point_editor.cpp
View file @
e6c1254d
...
...
@@ -195,6 +195,9 @@ bool POINT_EDITOR::Init()
return
false
;
}
m_selectionTool
->
AddMenuItem
(
COMMON_ACTIONS
::
pointEditorBreakOutline
,
POINT_EDITOR
::
breakOutlineCondition
);
setTransitions
();
return
true
;
...
...
@@ -259,9 +262,10 @@ int POINT_EDITOR::OnSelectionChange( TOOL_EVENT& aEvent )
m_dragPoint
=
point
;
}
else
if
(
evt
->
Is
DblClick
(
BUT_LEFT
)
)
else
if
(
evt
->
Is
Action
(
&
COMMON_ACTIONS
::
pointEditorBreakOutline
)
)
{
breakOutline
(
controls
->
GetCursorPosition
()
);
updatePoints
();
}
else
if
(
evt
->
IsDrag
(
BUT_LEFT
)
&&
m_dragPoint
)
...
...
@@ -446,8 +450,9 @@ void POINT_EDITOR::updateItem() const
for
(
int
i
=
0
;
i
<
outline
->
GetCornersCount
();
++
i
)
{
outline
->
SetX
(
i
,
m_editPoints
->
Point
(
i
).
GetPosition
().
x
);
outline
->
SetY
(
i
,
m_editPoints
->
Point
(
i
).
GetPosition
().
y
);
VECTOR2I
point
=
m_editPoints
->
Point
(
i
).
GetPosition
();
outline
->
SetX
(
i
,
point
.
x
);
outline
->
SetY
(
i
,
point
.
y
);
}
break
;
...
...
@@ -521,7 +526,7 @@ void POINT_EDITOR::finishItem() const
}
void
POINT_EDITOR
::
updatePoints
()
const
void
POINT_EDITOR
::
updatePoints
()
{
EDA_ITEM
*
item
=
m_editPoints
->
GetParent
();
...
...
@@ -563,8 +568,17 @@ void POINT_EDITOR::updatePoints() const
const
ZONE_CONTAINER
*
zone
=
static_cast
<
const
ZONE_CONTAINER
*>
(
item
);
const
CPolyLine
*
outline
=
zone
->
Outline
();
if
(
m_editPoints
->
PointsSize
()
!=
(
unsigned
)
outline
->
GetCornersCount
()
)
{
getView
()
->
Remove
(
m_editPoints
.
get
()
);
m_editPoints
=
EDIT_POINTS_FACTORY
::
Make
(
item
,
getView
()
->
GetGAL
()
);
getView
()
->
Add
(
m_editPoints
.
get
()
);
}
else
{
for
(
int
i
=
0
;
i
<
outline
->
GetCornersCount
();
++
i
)
m_editPoints
->
Point
(
i
).
SetPosition
(
outline
->
GetPos
(
i
)
);
}
break
;
}
...
...
@@ -763,3 +777,24 @@ void POINT_EDITOR::breakOutline( const VECTOR2I& aBreakPoint )
}
}
}
void
POINT_EDITOR
::
setTransitions
()
{
Go
(
&
POINT_EDITOR
::
OnSelectionChange
,
m_selectionTool
->
SelectedEvent
);
Go
(
&
POINT_EDITOR
::
OnSelectionChange
,
m_selectionTool
->
DeselectedEvent
);
}
bool
POINT_EDITOR
::
breakOutlineCondition
(
const
SELECTION
&
aSelection
)
{
if
(
aSelection
.
Size
()
!=
1
)
return
false
;
BOARD_ITEM
*
item
=
aSelection
.
Item
<
BOARD_ITEM
>
(
0
);
// Works only for zones and line segments
return
item
->
Type
()
==
PCB_ZONE_AREA_T
||
(
(
item
->
Type
()
==
PCB_LINE_T
||
item
->
Type
()
==
PCB_MODULE_EDGE_T
)
&&
static_cast
<
DRAWSEGMENT
*>
(
item
)
->
GetShape
()
==
S_SEGMENT
);
}
pcbnew/tools/point_editor.h
View file @
e6c1254d
...
...
@@ -81,7 +81,7 @@ private:
void
finishItem
()
const
;
///> Updates edit points with item's points.
void
updatePoints
()
const
;
void
updatePoints
();
///> Returns true if aPoint is the currently modified point.
inline
bool
isModified
(
const
EDIT_POINT
&
aPoint
)
const
...
...
@@ -95,15 +95,14 @@ private:
///> Returns a point that should be used as a constrainer for 45 degrees mode.
EDIT_POINT
get45DegConstrainer
()
const
;
///> Adds a new edit point on a zone outline.
///> Adds a new edit point on a zone outline
/line
.
void
breakOutline
(
const
VECTOR2I
&
aBreakPoint
);
///> Sets up handlers for various events.
void
setTransitions
()
{
Go
(
&
POINT_EDITOR
::
OnSelectionChange
,
m_selectionTool
->
SelectedEvent
);
Go
(
&
POINT_EDITOR
::
OnSelectionChange
,
m_selectionTool
->
DeselectedEvent
);
}
void
setTransitions
();
///> Condition to display "Create corner" context menu entry.
static
bool
breakOutlineCondition
(
const
SELECTION
&
aSelection
);
};
#endif
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