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
f0ff744e
Commit
f0ff744e
authored
Jul 09, 2014
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Initial version of the Placement Tool.
parent
e3c4f425
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
485 additions
and
0 deletions
+485
-0
CMakeLists.txt
pcbnew/CMakeLists.txt
+1
-0
moduleframe.cpp
pcbnew/moduleframe.cpp
+2
-0
common_actions.cpp
pcbnew/tools/common_actions.cpp
+32
-0
common_actions.h
pcbnew/tools/common_actions.h
+19
-0
pcb_tools.cpp
pcbnew/tools/pcb_tools.cpp
+2
-0
placement_tool.cpp
pcbnew/tools/placement_tool.cpp
+356
-0
placement_tool.h
pcbnew/tools/placement_tool.h
+73
-0
No files found.
pcbnew/CMakeLists.txt
View file @
f0ff744e
...
...
@@ -265,6 +265,7 @@ set( PCBNEW_CLASS_SRCS
tools/pcbnew_control.cpp
tools/pcb_editor_control.cpp
tools/pcb_tools.cpp
tools/placement_tool.cpp
tools/common_actions.cpp
)
...
...
pcbnew/moduleframe.cpp
View file @
f0ff744e
...
...
@@ -61,6 +61,7 @@
#include "tools/drawing_tool.h"
#include "tools/point_editor.h"
#include "tools/pcbnew_control.h"
#include "tools/placement_tool.h"
#include "tools/common_actions.h"
...
...
@@ -278,6 +279,7 @@ FOOTPRINT_EDIT_FRAME::FOOTPRINT_EDIT_FRAME( KIWAY* aKiway, wxWindow* aParent ) :
m_toolManager
->
RegisterTool
(
new
DRAWING_TOOL
);
m_toolManager
->
RegisterTool
(
new
POINT_EDITOR
);
m_toolManager
->
RegisterTool
(
new
PCBNEW_CONTROL
);
m_toolManager
->
RegisterTool
(
new
PLACEMENT_TOOL
);
m_toolManager
->
GetTool
<
SELECTION_TOOL
>
()
->
EditModules
(
true
);
m_toolManager
->
GetTool
<
EDIT_TOOL
>
()
->
EditModules
(
true
);
...
...
pcbnew/tools/common_actions.cpp
View file @
f0ff744e
...
...
@@ -285,6 +285,38 @@ TOOL_ACTION COMMON_ACTIONS::pointEditorUpdate( "pcbnew.PointEditor.update",
AS_GLOBAL
,
0
,
""
,
""
);
// No description, it is not supposed to be shown anywhere
// Placement tool
TOOL_ACTION
COMMON_ACTIONS
::
alignTop
(
"pcbnew.Place.alignTop"
,
AS_GLOBAL
,
0
,
"Align items to the top"
,
"Aligns selected items to the top edge"
);
TOOL_ACTION
COMMON_ACTIONS
::
alignBottom
(
"pcbnew.Place.alignBottom"
,
AS_GLOBAL
,
0
,
"Align items to the bottom"
,
"Aligns selected items to the bottom edge"
);
TOOL_ACTION
COMMON_ACTIONS
::
alignLeft
(
"pcbnew.Place.alignLeft"
,
AS_GLOBAL
,
0
,
"Align items to the left"
,
"Aligns selected items to the top left"
);
TOOL_ACTION
COMMON_ACTIONS
::
alignRight
(
"pcbnew.Place.alignRight"
,
AS_GLOBAL
,
0
,
"Align items to the right"
,
"Aligns selected items to the right edge"
);
TOOL_ACTION
COMMON_ACTIONS
::
distributeHorizontally
(
"pcbnew.Place.distributeHorizontally"
,
AS_GLOBAL
,
0
,
"Distribute horizontally"
,
"Distributes selected items along the horizontal axis"
);
TOOL_ACTION
COMMON_ACTIONS
::
distributeVertically
(
"pcbnew.Place.distributeVertically"
,
AS_GLOBAL
,
0
,
"Distribure vertically"
,
"Distributes selected items along the vertical axis"
);
boost
::
optional
<
TOOL_EVENT
>
COMMON_ACTIONS
::
TranslateLegacyId
(
int
aId
)
{
switch
(
aId
)
...
...
pcbnew/tools/common_actions.h
View file @
f0ff744e
...
...
@@ -110,6 +110,25 @@ public:
/// Update edit points
static
TOOL_ACTION
pointEditorUpdate
;
// Placement tool
/// Align items to the top edge of selection bounding box
static
TOOL_ACTION
alignTop
;
/// Align items to the bottom edge of selection bounding box
static
TOOL_ACTION
alignBottom
;
/// Align items to the left edge of selection bounding box
static
TOOL_ACTION
alignLeft
;
/// Align items to the right edge of selection bounding box
static
TOOL_ACTION
alignRight
;
/// Distributes items evenly along the horizontal axis
static
TOOL_ACTION
distributeHorizontally
;
/// Distributes items evenly along the vertical axis
static
TOOL_ACTION
distributeVertically
;
// View controls
static
TOOL_ACTION
zoomIn
;
static
TOOL_ACTION
zoomOut
;
...
...
pcbnew/tools/pcb_tools.cpp
View file @
f0ff744e
...
...
@@ -36,6 +36,7 @@
#include "point_editor.h"
#include "pcbnew_control.h"
#include "pcb_editor_control.h"
#include "placement_tool.h"
#include "common_actions.h"
#include <router/router_tool.h>
...
...
@@ -55,6 +56,7 @@ void PCB_EDIT_FRAME::setupTools()
m_toolManager
->
RegisterTool
(
new
POINT_EDITOR
);
m_toolManager
->
RegisterTool
(
new
PCBNEW_CONTROL
);
m_toolManager
->
RegisterTool
(
new
PCB_EDITOR_CONTROL
);
m_toolManager
->
RegisterTool
(
new
PLACEMENT_TOOL
);
m_toolManager
->
ResetTools
(
TOOL_BASE
::
RUN
);
// Run the selection tool, it is supposed to be always active
...
...
pcbnew/tools/placement_tool.cpp
0 → 100644
View file @
f0ff744e
This diff is collapsed.
Click to expand it.
pcbnew/tools/placement_tool.h
0 → 100644
View file @
f0ff744e
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2014 CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* as published by the Free Software Foundation; either version 2
* of the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program; if not, you may find one here:
* http://www.gnu.org/licenses/old-licenses/gpl-2.0.html
* or you may search the http://www.gnu.org website for the version 2 license,
* or you may write to the Free Software Foundation, Inc.,
* 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA
*/
#ifndef PLACEMENT_TOOL_H_
#define PLACEMENT_TOOL_H_
#include <tool/tool_interactive.h>
class
SELECTION_TOOL
;
/**
* TODO description
*/
class
PLACEMENT_TOOL
:
public
TOOL_INTERACTIVE
{
public
:
PLACEMENT_TOOL
();
virtual
~
PLACEMENT_TOOL
();
/// @copydoc TOOL_INTERACTIVE::Reset()
void
Reset
(
RESET_REASON
aReason
)
{};
/// @copydoc TOOL_INTERACTIVE::Init()
bool
Init
();
/// TODO
int
AlignTop
(
TOOL_EVENT
&
aEvent
);
/// TODO
int
AlignBottom
(
TOOL_EVENT
&
aEvent
);
/// TODO
int
AlignLeft
(
TOOL_EVENT
&
aEvent
);
/// TODO
int
AlignRight
(
TOOL_EVENT
&
aEvent
);
/// TODO
int
DistributeHorizontally
(
TOOL_EVENT
&
aEvent
);
/// TODO
int
DistributeVertically
(
TOOL_EVENT
&
aEvent
);
private
:
/// TODO
void
setTransitions
();
SELECTION_TOOL
*
m_selectionTool
;
};
#endif
/* PLACEMENT_TOOL_H_ */
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