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
946b9d19
Commit
946b9d19
authored
Apr 30, 2015
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
setTransitions() are called automatically for tools.
parent
6e45180b
Changes
18
Show whitespace changes
Inline
Side-by-side
Showing
18 changed files
with
43 additions
and
219 deletions
+43
-219
tool_manager.cpp
common/tool/tool_manager.cpp
+6
-0
tool_base.h
include/tool/tool_base.h
+7
-0
drawing_tool.cpp
pcbnew/tools/drawing_tool.cpp
+1
-17
drawing_tool.h
pcbnew/tools/drawing_tool.h
+3
-3
edit_tool.cpp
pcbnew/tools/edit_tool.cpp
+1
-46
edit_tool.h
pcbnew/tools/edit_tool.h
+3
-3
module_tools.cpp
pcbnew/tools/module_tools.cpp
+1
-18
module_tools.h
pcbnew/tools/module_tools.h
+2
-2
pcb_editor_control.cpp
pcbnew/tools/pcb_editor_control.cpp
+1
-23
pcb_editor_control.h
pcbnew/tools/pcb_editor_control.h
+2
-2
pcbnew_control.cpp
pcbnew/tools/pcbnew_control.cpp
+2
-53
pcbnew_control.h
pcbnew/tools/pcbnew_control.h
+2
-5
placement_tool.cpp
pcbnew/tools/placement_tool.cpp
+1
-15
placement_tool.h
pcbnew/tools/placement_tool.h
+2
-2
point_editor.cpp
pcbnew/tools/point_editor.cpp
+2
-8
point_editor.h
pcbnew/tools/point_editor.h
+3
-3
selection_tool.cpp
pcbnew/tools/selection_tool.cpp
+1
-16
selection_tool.h
pcbnew/tools/selection_tool.h
+3
-3
No files found.
common/tool/tool_manager.cpp
View file @
946b9d19
...
@@ -389,6 +389,7 @@ bool TOOL_MANAGER::runTool( TOOL_BASE* aTool )
...
@@ -389,6 +389,7 @@ bool TOOL_MANAGER::runTool( TOOL_BASE* aTool )
}
}
aTool
->
Reset
(
TOOL_INTERACTIVE
::
RUN
);
aTool
->
Reset
(
TOOL_INTERACTIVE
::
RUN
);
aTool
->
SetTransitions
();
// Add the tool on the front of the processing queue (it gets events first)
// Add the tool on the front of the processing queue (it gets events first)
m_activeTools
.
push_front
(
aTool
->
GetId
()
);
m_activeTools
.
push_front
(
aTool
->
GetId
()
);
...
@@ -425,7 +426,10 @@ void TOOL_MANAGER::ResetTools( TOOL_BASE::RESET_REASON aReason )
...
@@ -425,7 +426,10 @@ void TOOL_MANAGER::ResetTools( TOOL_BASE::RESET_REASON aReason )
ProcessEvent
(
evt
);
ProcessEvent
(
evt
);
BOOST_FOREACH
(
TOOL_BASE
*
tool
,
m_toolState
|
boost
::
adaptors
::
map_keys
)
BOOST_FOREACH
(
TOOL_BASE
*
tool
,
m_toolState
|
boost
::
adaptors
::
map_keys
)
{
tool
->
Reset
(
aReason
);
tool
->
Reset
(
aReason
);
tool
->
SetTransitions
();
}
}
}
...
@@ -621,6 +625,8 @@ void TOOL_MANAGER::finishTool( TOOL_STATE* aState )
...
@@ -621,6 +625,8 @@ void TOOL_MANAGER::finishTool( TOOL_STATE* aState )
if
(
tool
!=
m_activeTools
.
end
()
)
if
(
tool
!=
m_activeTools
.
end
()
)
m_activeTools
.
erase
(
tool
);
m_activeTools
.
erase
(
tool
);
}
}
aState
->
theTool
->
SetTransitions
();
}
}
...
...
include/tool/tool_base.h
View file @
946b9d19
...
@@ -140,6 +140,13 @@ public:
...
@@ -140,6 +140,13 @@ public:
return
m_toolMgr
;
return
m_toolMgr
;
}
}
/**
* Function SetTransitions()
* This method is meant to be overridden in order to specify handlers for events. It is called
* every time tool is reset or finished.
*/
virtual
void
SetTransitions
()
{};
protected
:
protected
:
friend
class
TOOL_MANAGER
;
friend
class
TOOL_MANAGER
;
...
...
pcbnew/tools/drawing_tool.cpp
View file @
946b9d19
...
@@ -66,8 +66,6 @@ void DRAWING_TOOL::Reset( RESET_REASON aReason )
...
@@ -66,8 +66,6 @@ void DRAWING_TOOL::Reset( RESET_REASON aReason )
m_controls
=
getViewControls
();
m_controls
=
getViewControls
();
m_board
=
getModel
<
BOARD
>
();
m_board
=
getModel
<
BOARD
>
();
m_frame
=
getEditFrame
<
PCB_EDIT_FRAME
>
();
m_frame
=
getEditFrame
<
PCB_EDIT_FRAME
>
();
setTransitions
();
}
}
...
@@ -124,7 +122,6 @@ int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent )
...
@@ -124,7 +122,6 @@ int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent )
}
}
}
}
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
return
0
;
...
@@ -172,7 +169,6 @@ int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent )
...
@@ -172,7 +169,6 @@ int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent )
}
}
}
}
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
return
0
;
...
@@ -220,7 +216,6 @@ int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent )
...
@@ -220,7 +216,6 @@ int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent )
}
}
}
}
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
return
0
;
...
@@ -411,7 +406,6 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
...
@@ -411,7 +406,6 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
m_controls
->
CaptureCursor
(
false
);
m_controls
->
CaptureCursor
(
false
);
m_view
->
Remove
(
&
preview
);
m_view
->
Remove
(
&
preview
);
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
return
0
;
...
@@ -442,11 +436,7 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent )
...
@@ -442,11 +436,7 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent )
const
std
::
list
<
BOARD_ITEM
*>&
list
=
dlg
.
GetImportedItems
();
const
std
::
list
<
BOARD_ITEM
*>&
list
=
dlg
.
GetImportedItems
();
if
(
dlgResult
!=
wxID_OK
||
m_board
->
m_Modules
==
NULL
||
list
.
empty
()
)
if
(
dlgResult
!=
wxID_OK
||
m_board
->
m_Modules
==
NULL
||
list
.
empty
()
)
{
setTransitions
();
return
0
;
return
0
;
}
VECTOR2I
cursorPos
=
m_controls
->
GetCursorPosition
();
VECTOR2I
cursorPos
=
m_controls
->
GetCursorPosition
();
VECTOR2I
delta
=
cursorPos
-
(
*
list
.
begin
())
->
GetPosition
();
VECTOR2I
delta
=
cursorPos
-
(
*
list
.
begin
())
->
GetPosition
();
...
@@ -617,8 +607,6 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent )
...
@@ -617,8 +607,6 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent )
m_controls
->
CaptureCursor
(
false
);
m_controls
->
CaptureCursor
(
false
);
m_view
->
Remove
(
&
preview
);
m_view
->
Remove
(
&
preview
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -663,7 +651,6 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
...
@@ -663,7 +651,6 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
m_controls
->
SetSnapping
(
false
);
m_controls
->
SetSnapping
(
false
);
m_controls
->
ShowCursor
(
false
);
m_controls
->
ShowCursor
(
false
);
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
return
0
;
...
@@ -1230,7 +1217,6 @@ int DRAWING_TOOL::drawZone( bool aKeepout )
...
@@ -1230,7 +1217,6 @@ int DRAWING_TOOL::drawZone( bool aKeepout )
m_controls
->
CaptureCursor
(
false
);
m_controls
->
CaptureCursor
(
false
);
m_view
->
Remove
(
&
preview
);
m_view
->
Remove
(
&
preview
);
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
return
0
;
...
@@ -1351,7 +1337,6 @@ int DRAWING_TOOL::placeTextModule()
...
@@ -1351,7 +1337,6 @@ int DRAWING_TOOL::placeTextModule()
m_controls
->
CaptureCursor
(
true
);
m_controls
->
CaptureCursor
(
true
);
m_view
->
Remove
(
&
preview
);
m_view
->
Remove
(
&
preview
);
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
return
0
;
...
@@ -1461,7 +1446,6 @@ int DRAWING_TOOL::placeTextPcb()
...
@@ -1461,7 +1446,6 @@ int DRAWING_TOOL::placeTextPcb()
m_controls
->
CaptureCursor
(
false
);
m_controls
->
CaptureCursor
(
false
);
m_view
->
Remove
(
&
preview
);
m_view
->
Remove
(
&
preview
);
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
return
0
;
...
@@ -1490,7 +1474,7 @@ void DRAWING_TOOL::make45DegLine( DRAWSEGMENT* aSegment, DRAWSEGMENT* aHelper )
...
@@ -1490,7 +1474,7 @@ void DRAWING_TOOL::make45DegLine( DRAWSEGMENT* aSegment, DRAWSEGMENT* aHelper )
}
}
void
DRAWING_TOOL
::
s
etTransitions
()
void
DRAWING_TOOL
::
S
etTransitions
()
{
{
Go
(
&
DRAWING_TOOL
::
DrawLine
,
COMMON_ACTIONS
::
drawLine
.
MakeEvent
()
);
Go
(
&
DRAWING_TOOL
::
DrawLine
,
COMMON_ACTIONS
::
drawLine
.
MakeEvent
()
);
Go
(
&
DRAWING_TOOL
::
DrawCircle
,
COMMON_ACTIONS
::
drawCircle
.
MakeEvent
()
);
Go
(
&
DRAWING_TOOL
::
DrawCircle
,
COMMON_ACTIONS
::
drawCircle
.
MakeEvent
()
);
...
...
pcbnew/tools/drawing_tool.h
View file @
946b9d19
...
@@ -132,6 +132,9 @@ public:
...
@@ -132,6 +132,9 @@ public:
m_editModules
=
aEnabled
;
m_editModules
=
aEnabled
;
}
}
///> Sets up handlers for various events.
void
SetTransitions
();
private
:
private
:
///> Starts drawing a selected shape (i.e. DRAWSEGMENT).
///> Starts drawing a selected shape (i.e. DRAWSEGMENT).
///> @param aShape is the type of created shape (@see STROKE_T).
///> @param aShape is the type of created shape (@see STROKE_T).
...
@@ -176,9 +179,6 @@ private:
...
@@ -176,9 +179,6 @@ private:
*/
*/
void
make45DegLine
(
DRAWSEGMENT
*
aSegment
,
DRAWSEGMENT
*
aHelper
)
const
;
void
make45DegLine
(
DRAWSEGMENT
*
aSegment
,
DRAWSEGMENT
*
aHelper
)
const
;
///> Sets up handlers for various events.
void
setTransitions
();
///> Returns the appropriate width for a segment depending on the settings.
///> Returns the appropriate width for a segment depending on the settings.
int
getSegmentWidth
(
unsigned
int
aLayer
)
const
;
int
getSegmentWidth
(
unsigned
int
aLayer
)
const
;
...
...
pcbnew/tools/edit_tool.cpp
View file @
946b9d19
...
@@ -96,8 +96,6 @@ bool EDIT_TOOL::Init()
...
@@ -96,8 +96,6 @@ bool EDIT_TOOL::Init()
m_offset
.
x
=
0
;
m_offset
.
x
=
0
;
m_offset
.
y
=
0
;
m_offset
.
y
=
0
;
setTransitions
();
return
true
;
return
true
;
}
}
...
@@ -128,10 +126,7 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
...
@@ -128,10 +126,7 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
// Be sure that there is at least one item that we can modify. If nothing was selected before,
// Be sure that there is at least one item that we can modify. If nothing was selected before,
// try looking for the stuff under mouse cursor (i.e. Kicad old-style hover selection)
// try looking for the stuff under mouse cursor (i.e. Kicad old-style hover selection)
if
(
!
hoverSelection
(
selection
)
)
if
(
!
hoverSelection
(
selection
)
)
{
setTransitions
();
return
0
;
return
0
;
}
Activate
();
Activate
();
...
@@ -345,8 +340,6 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
...
@@ -345,8 +340,6 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
controls
->
SetAutoPan
(
false
);
controls
->
SetAutoPan
(
false
);
controls
->
ForceCursorPosition
(
false
);
controls
->
ForceCursorPosition
(
false
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -357,11 +350,7 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
...
@@ -357,11 +350,7 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
PCB_BASE_EDIT_FRAME
*
editFrame
=
getEditFrame
<
PCB_BASE_EDIT_FRAME
>
();
PCB_BASE_EDIT_FRAME
*
editFrame
=
getEditFrame
<
PCB_BASE_EDIT_FRAME
>
();
if
(
!
hoverSelection
(
selection
,
false
)
)
if
(
!
hoverSelection
(
selection
,
false
)
)
{
setTransitions
();
return
0
;
return
0
;
}
// Properties are displayed when there is only one item selected
// Properties are displayed when there is only one item selected
if
(
selection
.
Size
()
==
1
)
if
(
selection
.
Size
()
==
1
)
...
@@ -398,8 +387,6 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
...
@@ -398,8 +387,6 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
item
->
SetFlags
(
flags
);
item
->
SetFlags
(
flags
);
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -413,11 +400,7 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
...
@@ -413,11 +400,7 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
bool
unselect
=
selection
.
Empty
();
bool
unselect
=
selection
.
Empty
();
if
(
!
hoverSelection
(
selection
)
)
if
(
!
hoverSelection
(
selection
)
)
{
setTransitions
();
return
0
;
return
0
;
}
wxPoint
rotatePoint
=
getModificationPoint
(
selection
);
wxPoint
rotatePoint
=
getModificationPoint
(
selection
);
...
@@ -453,7 +436,6 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
...
@@ -453,7 +436,6 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
selectionClear
,
true
);
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
selectionClear
,
true
);
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
pointEditorUpdate
,
true
);
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
pointEditorUpdate
,
true
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -468,11 +450,7 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
...
@@ -468,11 +450,7 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
bool
unselect
=
selection
.
Empty
();
bool
unselect
=
selection
.
Empty
();
if
(
!
hoverSelection
(
selection
)
)
if
(
!
hoverSelection
(
selection
)
)
{
setTransitions
();
return
0
;
return
0
;
}
wxPoint
flipPoint
=
getModificationPoint
(
selection
);
wxPoint
flipPoint
=
getModificationPoint
(
selection
);
...
@@ -507,7 +485,6 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
...
@@ -507,7 +485,6 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
selectionClear
,
true
);
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
selectionClear
,
true
);
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
pointEditorUpdate
,
true
);
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
pointEditorUpdate
,
true
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -518,11 +495,7 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
...
@@ -518,11 +495,7 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
if
(
!
hoverSelection
(
selection
)
)
if
(
!
hoverSelection
(
selection
)
)
{
setTransitions
();
return
0
;
return
0
;
}
// Get a copy of the selected items set
// Get a copy of the selected items set
PICKED_ITEMS_LIST
selectedItems
=
selection
.
items
;
PICKED_ITEMS_LIST
selectedItems
=
selection
.
items
;
...
@@ -544,8 +517,6 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
...
@@ -544,8 +517,6 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -655,11 +626,7 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
...
@@ -655,11 +626,7 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
bool
unselect
=
selection
.
Empty
();
bool
unselect
=
selection
.
Empty
();
if
(
!
hoverSelection
(
selection
)
)
if
(
!
hoverSelection
(
selection
)
)
{
setTransitions
();
return
0
;
return
0
;
}
wxPoint
translation
;
wxPoint
translation
;
double
rotation
=
0
;
double
rotation
=
0
;
...
@@ -705,8 +672,6 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
...
@@ -705,8 +672,6 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
pointEditorUpdate
,
true
);
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
pointEditorUpdate
,
true
);
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -721,10 +686,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
...
@@ -721,10 +686,7 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
// Be sure that there is at least one item that we can modify
// Be sure that there is at least one item that we can modify
if
(
!
hoverSelection
(
selection
)
)
if
(
!
hoverSelection
(
selection
)
)
{
setTransitions
();
return
0
;
return
0
;
}
// we have a selection to work on now, so start the tool process
// we have a selection to work on now, so start the tool process
...
@@ -803,8 +765,6 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
...
@@ -803,8 +765,6 @@ int EDIT_TOOL::Duplicate( const TOOL_EVENT& aEvent )
// and re-enable undos
// and re-enable undos
decUndoInhibit
();
decUndoInhibit
();
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -817,10 +777,7 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent )
...
@@ -817,10 +777,7 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent )
// Be sure that there is at least one item that we can modify
// Be sure that there is at least one item that we can modify
if
(
!
hoverSelection
(
selection
)
)
if
(
!
hoverSelection
(
selection
)
)
{
setTransitions
();
return
0
;
return
0
;
}
bool
originalItemsModified
=
false
;
bool
originalItemsModified
=
false
;
...
@@ -980,13 +937,12 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent )
...
@@ -980,13 +937,12 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent )
}
}
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
setTransitions
();
return
0
;
return
0
;
}
}
void
EDIT_TOOL
::
s
etTransitions
()
void
EDIT_TOOL
::
S
etTransitions
()
{
{
Go
(
&
EDIT_TOOL
::
Main
,
COMMON_ACTIONS
::
editActivate
.
MakeEvent
()
);
Go
(
&
EDIT_TOOL
::
Main
,
COMMON_ACTIONS
::
editActivate
.
MakeEvent
()
);
Go
(
&
EDIT_TOOL
::
Rotate
,
COMMON_ACTIONS
::
rotate
.
MakeEvent
()
);
Go
(
&
EDIT_TOOL
::
Rotate
,
COMMON_ACTIONS
::
rotate
.
MakeEvent
()
);
...
@@ -1125,6 +1081,5 @@ int EDIT_TOOL::editFootprintInFpEditor( const TOOL_EVENT& aEvent )
...
@@ -1125,6 +1081,5 @@ int EDIT_TOOL::editFootprintInFpEditor( const TOOL_EVENT& aEvent )
editor
->
Show
(
true
);
editor
->
Show
(
true
);
editor
->
Raise
();
// Iconize( false );
editor
->
Raise
();
// Iconize( false );
setTransitions
();
return
0
;
return
0
;
}
}
pcbnew/tools/edit_tool.h
View file @
946b9d19
...
@@ -126,6 +126,9 @@ public:
...
@@ -126,6 +126,9 @@ public:
m_editModules
=
aEnabled
;
m_editModules
=
aEnabled
;
}
}
///> Sets up handlers for various events.
void
SetTransitions
();
private
:
private
:
///> Selection tool used for obtaining selected items
///> Selection tool used for obtaining selected items
SELECTION_TOOL
*
m_selectionTool
;
SELECTION_TOOL
*
m_selectionTool
;
...
@@ -149,9 +152,6 @@ private:
...
@@ -149,9 +152,6 @@ private:
///> Removes and frees a single BOARD_ITEM.
///> Removes and frees a single BOARD_ITEM.
void
remove
(
BOARD_ITEM
*
aItem
);
void
remove
(
BOARD_ITEM
*
aItem
);
///> Sets up handlers for various events.
void
setTransitions
();
///> The required update flag for modified items
///> The required update flag for modified items
KIGFX
::
VIEW_ITEM
::
VIEW_UPDATE_FLAGS
m_updateFlag
;
KIGFX
::
VIEW_ITEM
::
VIEW_UPDATE_FLAGS
m_updateFlag
;
...
...
pcbnew/tools/module_tools.cpp
View file @
946b9d19
...
@@ -76,8 +76,6 @@ bool MODULE_TOOLS::Init()
...
@@ -76,8 +76,6 @@ bool MODULE_TOOLS::Init()
selectionTool
->
AddMenuItem
(
COMMON_ACTIONS
::
enumeratePads
);
selectionTool
->
AddMenuItem
(
COMMON_ACTIONS
::
enumeratePads
);
setTransitions
();
return
true
;
return
true
;
}
}
...
@@ -170,7 +168,6 @@ int MODULE_TOOLS::PlacePad( const TOOL_EVENT& aEvent )
...
@@ -170,7 +168,6 @@ int MODULE_TOOLS::PlacePad( const TOOL_EVENT& aEvent )
m_controls
->
SetAutoPan
(
false
);
m_controls
->
SetAutoPan
(
false
);
m_view
->
Remove
(
&
preview
);
m_view
->
Remove
(
&
preview
);
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
return
0
;
...
@@ -200,11 +197,7 @@ int MODULE_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
...
@@ -200,11 +197,7 @@ int MODULE_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
DIALOG_ENUM_PADS
settingsDlg
(
m_frame
);
DIALOG_ENUM_PADS
settingsDlg
(
m_frame
);
if
(
settingsDlg
.
ShowModal
()
==
wxID_CANCEL
)
if
(
settingsDlg
.
ShowModal
()
==
wxID_CANCEL
)
{
setTransitions
();
return
0
;
return
0
;
}
int
padNumber
=
settingsDlg
.
GetStartNumber
();
int
padNumber
=
settingsDlg
.
GetStartNumber
();
wxString
padPrefix
=
settingsDlg
.
GetPrefix
();
wxString
padPrefix
=
settingsDlg
.
GetPrefix
();
...
@@ -312,8 +305,6 @@ int MODULE_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
...
@@ -312,8 +305,6 @@ int MODULE_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
m_frame
->
DisplayToolMsg
(
wxEmptyString
);
m_frame
->
DisplayToolMsg
(
wxEmptyString
);
m_controls
->
ShowCursor
(
false
);
m_controls
->
ShowCursor
(
false
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -384,8 +375,6 @@ int MODULE_TOOLS::CopyItems( const TOOL_EVENT& aEvent )
...
@@ -384,8 +375,6 @@ int MODULE_TOOLS::CopyItems( const TOOL_EVENT& aEvent )
m_controls
->
ShowCursor
(
false
);
m_controls
->
ShowCursor
(
false
);
m_controls
->
SetAutoPan
(
false
);
m_controls
->
SetAutoPan
(
false
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -406,8 +395,6 @@ int MODULE_TOOLS::PasteItems( const TOOL_EVENT& aEvent )
...
@@ -406,8 +395,6 @@ int MODULE_TOOLS::PasteItems( const TOOL_EVENT& aEvent )
catch
(
...
)
catch
(
...
)
{
{
m_frame
->
DisplayToolMsg
(
_
(
"Invalid clipboard contents"
)
);
m_frame
->
DisplayToolMsg
(
_
(
"Invalid clipboard contents"
)
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -516,8 +503,6 @@ int MODULE_TOOLS::PasteItems( const TOOL_EVENT& aEvent )
...
@@ -516,8 +503,6 @@ int MODULE_TOOLS::PasteItems( const TOOL_EVENT& aEvent )
m_controls
->
SetAutoPan
(
false
);
m_controls
->
SetAutoPan
(
false
);
m_view
->
Remove
(
&
preview
);
m_view
->
Remove
(
&
preview
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -553,7 +538,6 @@ int MODULE_TOOLS::ModuleTextOutlines( const TOOL_EVENT& aEvent )
...
@@ -553,7 +538,6 @@ int MODULE_TOOLS::ModuleTextOutlines( const TOOL_EVENT& aEvent )
}
}
m_frame
->
GetGalCanvas
()
->
Refresh
();
m_frame
->
GetGalCanvas
()
->
Refresh
();
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -585,13 +569,12 @@ int MODULE_TOOLS::ModuleEdgeOutlines( const TOOL_EVENT& aEvent )
...
@@ -585,13 +569,12 @@ int MODULE_TOOLS::ModuleEdgeOutlines( const TOOL_EVENT& aEvent )
}
}
m_frame
->
GetGalCanvas
()
->
Refresh
();
m_frame
->
GetGalCanvas
()
->
Refresh
();
setTransitions
();
return
0
;
return
0
;
}
}
void
MODULE_TOOLS
::
s
etTransitions
()
void
MODULE_TOOLS
::
S
etTransitions
()
{
{
Go
(
&
MODULE_TOOLS
::
PlacePad
,
COMMON_ACTIONS
::
placePad
.
MakeEvent
()
);
Go
(
&
MODULE_TOOLS
::
PlacePad
,
COMMON_ACTIONS
::
placePad
.
MakeEvent
()
);
Go
(
&
MODULE_TOOLS
::
EnumeratePads
,
COMMON_ACTIONS
::
enumeratePads
.
MakeEvent
()
);
Go
(
&
MODULE_TOOLS
::
EnumeratePads
,
COMMON_ACTIONS
::
enumeratePads
.
MakeEvent
()
);
...
...
pcbnew/tools/module_tools.h
View file @
946b9d19
...
@@ -98,10 +98,10 @@ public:
...
@@ -98,10 +98,10 @@ public:
*/
*/
int
ModuleEdgeOutlines
(
const
TOOL_EVENT
&
aEvent
);
int
ModuleEdgeOutlines
(
const
TOOL_EVENT
&
aEvent
);
private
:
///> Sets up handlers for various events.
///> Sets up handlers for various events.
void
s
etTransitions
();
void
S
etTransitions
();
private
:
KIGFX
::
VIEW
*
m_view
;
KIGFX
::
VIEW
*
m_view
;
KIGFX
::
VIEW_CONTROLS
*
m_controls
;
KIGFX
::
VIEW_CONTROLS
*
m_controls
;
BOARD
*
m_board
;
BOARD
*
m_board
;
...
...
pcbnew/tools/pcb_editor_control.cpp
View file @
946b9d19
...
@@ -78,8 +78,6 @@ bool PCB_EDITOR_CONTROL::Init()
...
@@ -78,8 +78,6 @@ bool PCB_EDITOR_CONTROL::Init()
SELECTION_CONDITIONS
::
OnlyType
(
PCB_ZONE_AREA_T
)
);
SELECTION_CONDITIONS
::
OnlyType
(
PCB_ZONE_AREA_T
)
);
}
}
setTransitions
();
return
true
;
return
true
;
}
}
...
@@ -98,8 +96,6 @@ int PCB_EDITOR_CONTROL::TrackWidthInc( const TOOL_EVENT& aEvent )
...
@@ -98,8 +96,6 @@ int PCB_EDITOR_CONTROL::TrackWidthInc( const TOOL_EVENT& aEvent )
wxUpdateUIEvent
dummy
;
wxUpdateUIEvent
dummy
;
m_frame
->
OnUpdateSelectTrackWidth
(
dummy
);
m_frame
->
OnUpdateSelectTrackWidth
(
dummy
);
setTransitions
();
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
trackViaSizeChanged
);
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
trackViaSizeChanged
);
return
0
;
return
0
;
...
@@ -119,8 +115,6 @@ int PCB_EDITOR_CONTROL::TrackWidthDec( const TOOL_EVENT& aEvent )
...
@@ -119,8 +115,6 @@ int PCB_EDITOR_CONTROL::TrackWidthDec( const TOOL_EVENT& aEvent )
wxUpdateUIEvent
dummy
;
wxUpdateUIEvent
dummy
;
m_frame
->
OnUpdateSelectTrackWidth
(
dummy
);
m_frame
->
OnUpdateSelectTrackWidth
(
dummy
);
setTransitions
();
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
trackViaSizeChanged
);
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
trackViaSizeChanged
);
return
0
;
return
0
;
...
@@ -140,8 +134,6 @@ int PCB_EDITOR_CONTROL::ViaSizeInc( const TOOL_EVENT& aEvent )
...
@@ -140,8 +134,6 @@ int PCB_EDITOR_CONTROL::ViaSizeInc( const TOOL_EVENT& aEvent )
wxUpdateUIEvent
dummy
;
wxUpdateUIEvent
dummy
;
m_frame
->
OnUpdateSelectViaSize
(
dummy
);
m_frame
->
OnUpdateSelectViaSize
(
dummy
);
setTransitions
();
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
trackViaSizeChanged
);
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
trackViaSizeChanged
);
return
0
;
return
0
;
...
@@ -161,8 +153,6 @@ int PCB_EDITOR_CONTROL::ViaSizeDec( const TOOL_EVENT& aEvent )
...
@@ -161,8 +153,6 @@ int PCB_EDITOR_CONTROL::ViaSizeDec( const TOOL_EVENT& aEvent )
wxUpdateUIEvent
dummy
;
wxUpdateUIEvent
dummy
;
m_frame
->
OnUpdateSelectViaSize
(
dummy
);
m_frame
->
OnUpdateSelectViaSize
(
dummy
);
setTransitions
();
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
trackViaSizeChanged
);
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
trackViaSizeChanged
);
return
0
;
return
0
;
...
@@ -277,7 +267,6 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
...
@@ -277,7 +267,6 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
controls
->
CaptureCursor
(
false
);
controls
->
CaptureCursor
(
false
);
view
->
Remove
(
&
preview
);
view
->
Remove
(
&
preview
);
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
return
0
;
...
@@ -370,7 +359,6 @@ int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
...
@@ -370,7 +359,6 @@ int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
controls
->
CaptureCursor
(
false
);
controls
->
CaptureCursor
(
false
);
view
->
Remove
(
&
preview
);
view
->
Remove
(
&
preview
);
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
return
0
;
...
@@ -393,8 +381,6 @@ int PCB_EDITOR_CONTROL::ZoneFill( const TOOL_EVENT& aEvent )
...
@@ -393,8 +381,6 @@ int PCB_EDITOR_CONTROL::ZoneFill( const TOOL_EVENT& aEvent )
zone
->
ViewUpdate
();
zone
->
ViewUpdate
();
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -411,8 +397,6 @@ int PCB_EDITOR_CONTROL::ZoneFillAll( const TOOL_EVENT& aEvent )
...
@@ -411,8 +397,6 @@ int PCB_EDITOR_CONTROL::ZoneFillAll( const TOOL_EVENT& aEvent )
zone
->
ViewUpdate
();
zone
->
ViewUpdate
();
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -432,8 +416,6 @@ int PCB_EDITOR_CONTROL::ZoneUnfill( const TOOL_EVENT& aEvent )
...
@@ -432,8 +416,6 @@ int PCB_EDITOR_CONTROL::ZoneUnfill( const TOOL_EVENT& aEvent )
zone
->
ViewUpdate
();
zone
->
ViewUpdate
();
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -450,8 +432,6 @@ int PCB_EDITOR_CONTROL::ZoneUnfillAll( const TOOL_EVENT& aEvent )
...
@@ -450,8 +432,6 @@ int PCB_EDITOR_CONTROL::ZoneUnfillAll( const TOOL_EVENT& aEvent )
zone
->
ViewUpdate
();
zone
->
ViewUpdate
();
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -464,13 +444,11 @@ int PCB_EDITOR_CONTROL::SelectionCrossProbe( const TOOL_EVENT& aEvent )
...
@@ -464,13 +444,11 @@ int PCB_EDITOR_CONTROL::SelectionCrossProbe( const TOOL_EVENT& aEvent )
if
(
selection
.
Size
()
==
1
)
if
(
selection
.
Size
()
==
1
)
m_frame
->
SendMessageToEESCHEMA
(
selection
.
Item
<
BOARD_ITEM
>
(
0
)
);
m_frame
->
SendMessageToEESCHEMA
(
selection
.
Item
<
BOARD_ITEM
>
(
0
)
);
setTransitions
();
return
0
;
return
0
;
}
}
void
PCB_EDITOR_CONTROL
::
s
etTransitions
()
void
PCB_EDITOR_CONTROL
::
S
etTransitions
()
{
{
// Track & via size control
// Track & via size control
Go
(
&
PCB_EDITOR_CONTROL
::
TrackWidthInc
,
COMMON_ACTIONS
::
trackWidthInc
.
MakeEvent
()
);
Go
(
&
PCB_EDITOR_CONTROL
::
TrackWidthInc
,
COMMON_ACTIONS
::
trackWidthInc
.
MakeEvent
()
);
...
...
pcbnew/tools/pcb_editor_control.h
View file @
946b9d19
...
@@ -72,10 +72,10 @@ public:
...
@@ -72,10 +72,10 @@ public:
///> Notifies eeschema about the selected item.
///> Notifies eeschema about the selected item.
int
SelectionCrossProbe
(
const
TOOL_EVENT
&
aEvent
);
int
SelectionCrossProbe
(
const
TOOL_EVENT
&
aEvent
);
private
:
///> Sets up handlers for various events.
///> Sets up handlers for various events.
void
s
etTransitions
();
void
S
etTransitions
();
private
:
///> Pointer to the currently used edit frame.
///> Pointer to the currently used edit frame.
PCB_EDIT_FRAME
*
m_frame
;
PCB_EDIT_FRAME
*
m_frame
;
...
...
pcbnew/tools/pcbnew_control.cpp
View file @
946b9d19
...
@@ -52,14 +52,6 @@ void PCBNEW_CONTROL::Reset( RESET_REASON aReason )
...
@@ -52,14 +52,6 @@ void PCBNEW_CONTROL::Reset( RESET_REASON aReason )
}
}
bool
PCBNEW_CONTROL
::
Init
()
{
setTransitions
();
return
true
;
}
int
PCBNEW_CONTROL
::
ZoomInOut
(
const
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
ZoomInOut
(
const
TOOL_EVENT
&
aEvent
)
{
{
KIGFX
::
VIEW
*
view
=
m_frame
->
GetGalCanvas
()
->
GetView
();
KIGFX
::
VIEW
*
view
=
m_frame
->
GetGalCanvas
()
->
GetView
();
...
@@ -71,7 +63,6 @@ int PCBNEW_CONTROL::ZoomInOut( const TOOL_EVENT& aEvent )
...
@@ -71,7 +63,6 @@ int PCBNEW_CONTROL::ZoomInOut( const TOOL_EVENT& aEvent )
zoomScale
=
0.7
;
zoomScale
=
0.7
;
view
->
SetScale
(
view
->
GetScale
()
*
zoomScale
,
getViewControls
()
->
GetCursorPosition
()
);
view
->
SetScale
(
view
->
GetScale
()
*
zoomScale
,
getViewControls
()
->
GetCursorPosition
()
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -88,7 +79,6 @@ int PCBNEW_CONTROL::ZoomInOutCenter( const TOOL_EVENT& aEvent )
...
@@ -88,7 +79,6 @@ int PCBNEW_CONTROL::ZoomInOutCenter( const TOOL_EVENT& aEvent )
zoomScale
=
0.7
;
zoomScale
=
0.7
;
view
->
SetScale
(
view
->
GetScale
()
*
zoomScale
);
view
->
SetScale
(
view
->
GetScale
()
*
zoomScale
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -98,7 +88,6 @@ int PCBNEW_CONTROL::ZoomCenter( const TOOL_EVENT& aEvent )
...
@@ -98,7 +88,6 @@ int PCBNEW_CONTROL::ZoomCenter( const TOOL_EVENT& aEvent )
{
{
KIGFX
::
VIEW
*
view
=
m_frame
->
GetGalCanvas
()
->
GetView
();
KIGFX
::
VIEW
*
view
=
m_frame
->
GetGalCanvas
()
->
GetView
();
view
->
SetCenter
(
getViewControls
()
->
GetCursorPosition
()
);
view
->
SetCenter
(
getViewControls
()
->
GetCursorPosition
()
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -134,8 +123,6 @@ int PCBNEW_CONTROL::ZoomFitScreen( const TOOL_EVENT& aEvent )
...
@@ -134,8 +123,6 @@ int PCBNEW_CONTROL::ZoomFitScreen( const TOOL_EVENT& aEvent )
view
->
SetCenter
(
boardBBox
.
Centre
()
);
view
->
SetCenter
(
boardBBox
.
Centre
()
);
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -150,21 +137,14 @@ int PCBNEW_CONTROL::ZoomPreset( const TOOL_EVENT& aEvent )
...
@@ -150,21 +137,14 @@ int PCBNEW_CONTROL::ZoomPreset( const TOOL_EVENT& aEvent )
m_frame
->
SetPresetZoom
(
idx
);
m_frame
->
SetPresetZoom
(
idx
);
if
(
idx
==
0
)
if
(
idx
==
0
)
{
return
ZoomFitScreen
(
aEvent
);
return
ZoomFitScreen
(
aEvent
);
}
else
if
(
idx
<
0
||
idx
>=
zoomList
.
size
()
)
else
if
(
idx
<
0
||
idx
>=
zoomList
.
size
()
)
{
setTransitions
();
return
0
;
return
0
;
}
double
selectedZoom
=
zoomList
[
idx
];
double
selectedZoom
=
zoomList
[
idx
];
double
zoomFactor
=
gal
->
GetWorldScale
()
/
gal
->
GetZoomFactor
();
double
zoomFactor
=
gal
->
GetWorldScale
()
/
gal
->
GetZoomFactor
();
view
->
SetScale
(
1.0
/
(
zoomFactor
*
selectedZoom
)
);
view
->
SetScale
(
1.0
/
(
zoomFactor
*
selectedZoom
)
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -188,7 +168,6 @@ int PCBNEW_CONTROL::TrackDisplayMode( const TOOL_EVENT& aEvent )
...
@@ -188,7 +168,6 @@ int PCBNEW_CONTROL::TrackDisplayMode( const TOOL_EVENT& aEvent )
}
}
m_frame
->
GetGalCanvas
()
->
Refresh
();
m_frame
->
GetGalCanvas
()
->
Refresh
();
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -213,7 +192,6 @@ int PCBNEW_CONTROL::PadDisplayMode( const TOOL_EVENT& aEvent )
...
@@ -213,7 +192,6 @@ int PCBNEW_CONTROL::PadDisplayMode( const TOOL_EVENT& aEvent )
}
}
m_frame
->
GetGalCanvas
()
->
Refresh
();
m_frame
->
GetGalCanvas
()
->
Refresh
();
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -238,7 +216,6 @@ int PCBNEW_CONTROL::ViaDisplayMode( const TOOL_EVENT& aEvent )
...
@@ -238,7 +216,6 @@ int PCBNEW_CONTROL::ViaDisplayMode( const TOOL_EVENT& aEvent )
}
}
m_frame
->
GetGalCanvas
()
->
Refresh
();
m_frame
->
GetGalCanvas
()
->
Refresh
();
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -269,7 +246,6 @@ int PCBNEW_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent )
...
@@ -269,7 +246,6 @@ int PCBNEW_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent )
board
->
GetArea
(
i
)
->
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
board
->
GetArea
(
i
)
->
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
m_frame
->
GetGalCanvas
()
->
Refresh
();
m_frame
->
GetGalCanvas
()
->
Refresh
();
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -287,8 +263,6 @@ int PCBNEW_CONTROL::HighContrastMode( const TOOL_EVENT& aEvent )
...
@@ -287,8 +263,6 @@ int PCBNEW_CONTROL::HighContrastMode( const TOOL_EVENT& aEvent )
settings
->
LoadDisplayOptions
(
displ_opts
);
settings
->
LoadDisplayOptions
(
displ_opts
);
m_frame
->
GetGalCanvas
()
->
SetHighContrastLayer
(
m_frame
->
GetActiveLayer
()
);
m_frame
->
GetGalCanvas
()
->
SetHighContrastLayer
(
m_frame
->
GetActiveLayer
()
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -296,7 +270,6 @@ int PCBNEW_CONTROL::HighContrastMode( const TOOL_EVENT& aEvent )
...
@@ -296,7 +270,6 @@ int PCBNEW_CONTROL::HighContrastMode( const TOOL_EVENT& aEvent )
int
PCBNEW_CONTROL
::
HighContrastInc
(
const
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
HighContrastInc
(
const
TOOL_EVENT
&
aEvent
)
{
{
std
::
cout
<<
__PRETTY_FUNCTION__
<<
std
::
endl
;
std
::
cout
<<
__PRETTY_FUNCTION__
<<
std
::
endl
;
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -305,7 +278,6 @@ int PCBNEW_CONTROL::HighContrastInc( const TOOL_EVENT& aEvent )
...
@@ -305,7 +278,6 @@ int PCBNEW_CONTROL::HighContrastInc( const TOOL_EVENT& aEvent )
int
PCBNEW_CONTROL
::
HighContrastDec
(
const
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
HighContrastDec
(
const
TOOL_EVENT
&
aEvent
)
{
{
std
::
cout
<<
__PRETTY_FUNCTION__
<<
std
::
endl
;
std
::
cout
<<
__PRETTY_FUNCTION__
<<
std
::
endl
;
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -315,7 +287,6 @@ int PCBNEW_CONTROL::HighContrastDec( const TOOL_EVENT& aEvent )
...
@@ -315,7 +287,6 @@ int PCBNEW_CONTROL::HighContrastDec( const TOOL_EVENT& aEvent )
int
PCBNEW_CONTROL
::
LayerSwitch
(
const
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
LayerSwitch
(
const
TOOL_EVENT
&
aEvent
)
{
{
m_frame
->
SwitchLayer
(
NULL
,
(
LAYER_ID
)
aEvent
.
Parameter
<
long
>
()
);
m_frame
->
SwitchLayer
(
NULL
,
(
LAYER_ID
)
aEvent
.
Parameter
<
long
>
()
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -327,10 +298,7 @@ int PCBNEW_CONTROL::LayerNext( const TOOL_EVENT& aEvent )
...
@@ -327,10 +298,7 @@ int PCBNEW_CONTROL::LayerNext( const TOOL_EVENT& aEvent )
LAYER_NUM
layer
=
editFrame
->
GetActiveLayer
();
LAYER_NUM
layer
=
editFrame
->
GetActiveLayer
();
if
(
layer
<
F_Cu
||
layer
>
B_Cu
)
if
(
layer
<
F_Cu
||
layer
>
B_Cu
)
{
setTransitions
();
return
0
;
return
0
;
}
int
layerCount
=
getModel
<
BOARD
>
()
->
GetCopperLayerCount
();
int
layerCount
=
getModel
<
BOARD
>
()
->
GetCopperLayerCount
();
...
@@ -343,7 +311,6 @@ int PCBNEW_CONTROL::LayerNext( const TOOL_EVENT& aEvent )
...
@@ -343,7 +311,6 @@ int PCBNEW_CONTROL::LayerNext( const TOOL_EVENT& aEvent )
assert
(
IsCopperLayer
(
layer
)
);
assert
(
IsCopperLayer
(
layer
)
);
editFrame
->
SwitchLayer
(
NULL
,
ToLAYER_ID
(
layer
)
);
editFrame
->
SwitchLayer
(
NULL
,
ToLAYER_ID
(
layer
)
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -355,10 +322,7 @@ int PCBNEW_CONTROL::LayerPrev( const TOOL_EVENT& aEvent )
...
@@ -355,10 +322,7 @@ int PCBNEW_CONTROL::LayerPrev( const TOOL_EVENT& aEvent )
LAYER_NUM
layer
=
editFrame
->
GetActiveLayer
();
LAYER_NUM
layer
=
editFrame
->
GetActiveLayer
();
if
(
layer
<
F_Cu
||
layer
>
B_Cu
)
if
(
layer
<
F_Cu
||
layer
>
B_Cu
)
{
setTransitions
();
return
0
;
return
0
;
}
int
layerCount
=
getModel
<
BOARD
>
()
->
GetCopperLayerCount
();
int
layerCount
=
getModel
<
BOARD
>
()
->
GetCopperLayerCount
();
...
@@ -371,7 +335,6 @@ int PCBNEW_CONTROL::LayerPrev( const TOOL_EVENT& aEvent )
...
@@ -371,7 +335,6 @@ int PCBNEW_CONTROL::LayerPrev( const TOOL_EVENT& aEvent )
assert
(
IsCopperLayer
(
layer
)
);
assert
(
IsCopperLayer
(
layer
)
);
editFrame
->
SwitchLayer
(
NULL
,
ToLAYER_ID
(
layer
)
);
editFrame
->
SwitchLayer
(
NULL
,
ToLAYER_ID
(
layer
)
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -394,8 +357,6 @@ int PCBNEW_CONTROL::LayerAlphaInc( const TOOL_EVENT& aEvent )
...
@@ -394,8 +357,6 @@ int PCBNEW_CONTROL::LayerAlphaInc( const TOOL_EVENT& aEvent )
m_frame
->
GetGalCanvas
()
->
GetView
()
->
UpdateLayerColor
(
currentLayer
);
m_frame
->
GetGalCanvas
()
->
GetView
()
->
UpdateLayerColor
(
currentLayer
);
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -417,8 +378,6 @@ int PCBNEW_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
...
@@ -417,8 +378,6 @@ int PCBNEW_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
m_frame
->
GetGalCanvas
()
->
GetView
()
->
UpdateLayerColor
(
currentLayer
);
m_frame
->
GetGalCanvas
()
->
GetView
()
->
UpdateLayerColor
(
currentLayer
);
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -427,7 +386,6 @@ int PCBNEW_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
...
@@ -427,7 +386,6 @@ int PCBNEW_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
int
PCBNEW_CONTROL
::
GridFast1
(
const
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
GridFast1
(
const
TOOL_EVENT
&
aEvent
)
{
{
m_frame
->
SetFastGrid1
();
m_frame
->
SetFastGrid1
();
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -436,7 +394,6 @@ int PCBNEW_CONTROL::GridFast1( const TOOL_EVENT& aEvent )
...
@@ -436,7 +394,6 @@ int PCBNEW_CONTROL::GridFast1( const TOOL_EVENT& aEvent )
int
PCBNEW_CONTROL
::
GridFast2
(
const
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
GridFast2
(
const
TOOL_EVENT
&
aEvent
)
{
{
m_frame
->
SetFastGrid2
();
m_frame
->
SetFastGrid2
();
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -445,7 +402,6 @@ int PCBNEW_CONTROL::GridFast2( const TOOL_EVENT& aEvent )
...
@@ -445,7 +402,6 @@ int PCBNEW_CONTROL::GridFast2( const TOOL_EVENT& aEvent )
int
PCBNEW_CONTROL
::
GridNext
(
const
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
GridNext
(
const
TOOL_EVENT
&
aEvent
)
{
{
m_frame
->
SetNextGrid
();
m_frame
->
SetNextGrid
();
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -454,7 +410,6 @@ int PCBNEW_CONTROL::GridNext( const TOOL_EVENT& aEvent )
...
@@ -454,7 +410,6 @@ int PCBNEW_CONTROL::GridNext( const TOOL_EVENT& aEvent )
int
PCBNEW_CONTROL
::
GridPrev
(
const
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
GridPrev
(
const
TOOL_EVENT
&
aEvent
)
{
{
m_frame
->
SetPrevGrid
();
m_frame
->
SetPrevGrid
();
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -485,7 +440,6 @@ int PCBNEW_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
...
@@ -485,7 +440,6 @@ int PCBNEW_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
controls
->
SetAutoPan
(
false
);
controls
->
SetAutoPan
(
false
);
controls
->
SetSnapping
(
false
);
controls
->
SetSnapping
(
false
);
controls
->
ShowCursor
(
false
);
controls
->
ShowCursor
(
false
);
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
return
0
;
...
@@ -499,7 +453,6 @@ int PCBNEW_CONTROL::ResetCoords( const TOOL_EVENT& aEvent )
...
@@ -499,7 +453,6 @@ int PCBNEW_CONTROL::ResetCoords( const TOOL_EVENT& aEvent )
m_frame
->
GetScreen
()
->
m_O_Curseur
=
wxPoint
(
cursorPos
.
x
,
cursorPos
.
y
);
m_frame
->
GetScreen
()
->
m_O_Curseur
=
wxPoint
(
cursorPos
.
x
,
cursorPos
.
y
);
m_frame
->
UpdateStatusBar
();
m_frame
->
UpdateStatusBar
();
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -517,8 +470,6 @@ int PCBNEW_CONTROL::SwitchCursor( const TOOL_EVENT& aEvent )
...
@@ -517,8 +470,6 @@ int PCBNEW_CONTROL::SwitchCursor( const TOOL_EVENT& aEvent )
else
else
gal
->
SetCursorSize
(
BIG_CURSOR
);
gal
->
SetCursorSize
(
BIG_CURSOR
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -534,7 +485,6 @@ int PCBNEW_CONTROL::SwitchUnits( const TOOL_EVENT& aEvent )
...
@@ -534,7 +485,6 @@ int PCBNEW_CONTROL::SwitchUnits( const TOOL_EVENT& aEvent )
evt
.
SetId
(
ID_TB_OPTIONS_SELECT_UNIT_INCH
);
evt
.
SetId
(
ID_TB_OPTIONS_SELECT_UNIT_INCH
);
m_frame
->
ProcessEvent
(
evt
);
m_frame
->
ProcessEvent
(
evt
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -544,7 +494,6 @@ int PCBNEW_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
...
@@ -544,7 +494,6 @@ int PCBNEW_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
{
{
// TODO
// TODO
DisplayInfoMessage
(
m_frame
,
_
(
"Not implemented yet."
)
);
DisplayInfoMessage
(
m_frame
,
_
(
"Not implemented yet."
)
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -553,13 +502,12 @@ int PCBNEW_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
...
@@ -553,13 +502,12 @@ int PCBNEW_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
int
PCBNEW_CONTROL
::
ToBeDone
(
const
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
ToBeDone
(
const
TOOL_EVENT
&
aEvent
)
{
{
DisplayInfoMessage
(
m_frame
,
_
(
"Not implemented yet."
)
);
DisplayInfoMessage
(
m_frame
,
_
(
"Not implemented yet."
)
);
setTransitions
();
return
0
;
return
0
;
}
}
void
PCBNEW_CONTROL
::
s
etTransitions
()
void
PCBNEW_CONTROL
::
S
etTransitions
()
{
{
// View controls
// View controls
Go
(
&
PCBNEW_CONTROL
::
ZoomInOut
,
COMMON_ACTIONS
::
zoomIn
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
ZoomInOut
,
COMMON_ACTIONS
::
zoomIn
.
MakeEvent
()
);
...
@@ -601,6 +549,7 @@ void PCBNEW_CONTROL::setTransitions()
...
@@ -601,6 +549,7 @@ void PCBNEW_CONTROL::setTransitions()
Go
(
&
PCBNEW_CONTROL
::
GridNext
,
COMMON_ACTIONS
::
gridNext
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
GridNext
,
COMMON_ACTIONS
::
gridNext
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
GridPrev
,
COMMON_ACTIONS
::
gridPrev
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
GridPrev
,
COMMON_ACTIONS
::
gridPrev
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
GridSetOrigin
,
COMMON_ACTIONS
::
gridSetOrigin
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
GridSetOrigin
,
COMMON_ACTIONS
::
gridSetOrigin
.
MakeEvent
()
);
//Go( &PCBNEW_CONTROL::GridSetPreset, COMMON_ACTIONS::gridSetPreset.MakeEvent() );
// Miscellaneous
// Miscellaneous
Go
(
&
PCBNEW_CONTROL
::
ResetCoords
,
COMMON_ACTIONS
::
resetCoords
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
ResetCoords
,
COMMON_ACTIONS
::
resetCoords
.
MakeEvent
()
);
...
...
pcbnew/tools/pcbnew_control.h
View file @
946b9d19
...
@@ -43,9 +43,6 @@ public:
...
@@ -43,9 +43,6 @@ public:
/// @copydoc TOOL_INTERACTIVE::Reset()
/// @copydoc TOOL_INTERACTIVE::Reset()
void
Reset
(
RESET_REASON
aReason
);
void
Reset
(
RESET_REASON
aReason
);
/// @copydoc TOOL_INTERACTIVE::Init()
bool
Init
();
// View controls
// View controls
int
ZoomInOut
(
const
TOOL_EVENT
&
aEvent
);
int
ZoomInOut
(
const
TOOL_EVENT
&
aEvent
);
int
ZoomInOutCenter
(
const
TOOL_EVENT
&
aEvent
);
int
ZoomInOutCenter
(
const
TOOL_EVENT
&
aEvent
);
...
@@ -83,10 +80,10 @@ public:
...
@@ -83,10 +80,10 @@ public:
int
ShowHelp
(
const
TOOL_EVENT
&
aEvent
);
int
ShowHelp
(
const
TOOL_EVENT
&
aEvent
);
int
ToBeDone
(
const
TOOL_EVENT
&
aEvent
);
int
ToBeDone
(
const
TOOL_EVENT
&
aEvent
);
private
:
///> Sets up handlers for various events.
///> Sets up handlers for various events.
void
s
etTransitions
();
void
S
etTransitions
();
private
:
///> Pointer to the currently used edit frame.
///> Pointer to the currently used edit frame.
PCB_BASE_FRAME
*
m_frame
;
PCB_BASE_FRAME
*
m_frame
;
};
};
...
...
pcbnew/tools/placement_tool.cpp
View file @
946b9d19
...
@@ -66,8 +66,6 @@ bool PLACEMENT_TOOL::Init()
...
@@ -66,8 +66,6 @@ bool PLACEMENT_TOOL::Init()
m_selectionTool
->
AddSubMenu
(
menu
,
_
(
"Align/distribute"
),
m_selectionTool
->
AddSubMenu
(
menu
,
_
(
"Align/distribute"
),
SELECTION_CONDITIONS
::
MoreThan
(
1
)
);
SELECTION_CONDITIONS
::
MoreThan
(
1
)
);
setTransitions
();
return
true
;
return
true
;
}
}
...
@@ -109,8 +107,6 @@ int PLACEMENT_TOOL::AlignTop( const TOOL_EVENT& aEvent )
...
@@ -109,8 +107,6 @@ int PLACEMENT_TOOL::AlignTop( const TOOL_EVENT& aEvent )
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -152,8 +148,6 @@ int PLACEMENT_TOOL::AlignBottom( const TOOL_EVENT& aEvent )
...
@@ -152,8 +148,6 @@ int PLACEMENT_TOOL::AlignBottom( const TOOL_EVENT& aEvent )
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -195,8 +189,6 @@ int PLACEMENT_TOOL::AlignLeft( const TOOL_EVENT& aEvent )
...
@@ -195,8 +189,6 @@ int PLACEMENT_TOOL::AlignLeft( const TOOL_EVENT& aEvent )
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -238,8 +230,6 @@ int PLACEMENT_TOOL::AlignRight( const TOOL_EVENT& aEvent )
...
@@ -238,8 +230,6 @@ int PLACEMENT_TOOL::AlignRight( const TOOL_EVENT& aEvent )
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -299,8 +289,6 @@ int PLACEMENT_TOOL::DistributeHorizontally( const TOOL_EVENT& aEvent )
...
@@ -299,8 +289,6 @@ int PLACEMENT_TOOL::DistributeHorizontally( const TOOL_EVENT& aEvent )
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -348,13 +336,11 @@ int PLACEMENT_TOOL::DistributeVertically( const TOOL_EVENT& aEvent )
...
@@ -348,13 +336,11 @@ int PLACEMENT_TOOL::DistributeVertically( const TOOL_EVENT& aEvent )
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
}
}
setTransitions
();
return
0
;
return
0
;
}
}
void
PLACEMENT_TOOL
::
s
etTransitions
()
void
PLACEMENT_TOOL
::
S
etTransitions
()
{
{
Go
(
&
PLACEMENT_TOOL
::
AlignTop
,
COMMON_ACTIONS
::
alignTop
.
MakeEvent
()
);
Go
(
&
PLACEMENT_TOOL
::
AlignTop
,
COMMON_ACTIONS
::
alignTop
.
MakeEvent
()
);
Go
(
&
PLACEMENT_TOOL
::
AlignBottom
,
COMMON_ACTIONS
::
alignBottom
.
MakeEvent
()
);
Go
(
&
PLACEMENT_TOOL
::
AlignBottom
,
COMMON_ACTIONS
::
alignBottom
.
MakeEvent
()
);
...
...
pcbnew/tools/placement_tool.h
View file @
946b9d19
...
@@ -77,10 +77,10 @@ public:
...
@@ -77,10 +77,10 @@ public:
*/
*/
int
DistributeVertically
(
const
TOOL_EVENT
&
aEvent
);
int
DistributeVertically
(
const
TOOL_EVENT
&
aEvent
);
private
:
///> Sets up handlers for various events.
///> Sets up handlers for various events.
void
s
etTransitions
();
void
S
etTransitions
();
private
:
SELECTION_TOOL
*
m_selectionTool
;
SELECTION_TOOL
*
m_selectionTool
;
};
};
...
...
pcbnew/tools/point_editor.cpp
View file @
946b9d19
...
@@ -213,8 +213,6 @@ bool POINT_EDITOR::Init()
...
@@ -213,8 +213,6 @@ bool POINT_EDITOR::Init()
m_selectionTool
->
AddMenuItem
(
COMMON_ACTIONS
::
pointEditorBreakOutline
,
m_selectionTool
->
AddMenuItem
(
COMMON_ACTIONS
::
pointEditorBreakOutline
,
POINT_EDITOR
::
breakOutlineCondition
);
POINT_EDITOR
::
breakOutlineCondition
);
setTransitions
();
return
true
;
return
true
;
}
}
...
@@ -233,11 +231,9 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
...
@@ -233,11 +231,9 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
EDA_ITEM
*
item
=
selection
.
items
.
GetPickedItem
(
0
);
EDA_ITEM
*
item
=
selection
.
items
.
GetPickedItem
(
0
);
m_editPoints
=
EDIT_POINTS_FACTORY
::
Make
(
item
,
getView
()
->
GetGAL
()
);
m_editPoints
=
EDIT_POINTS_FACTORY
::
Make
(
item
,
getView
()
->
GetGAL
()
);
if
(
!
m_editPoints
)
if
(
!
m_editPoints
)
{
setTransitions
();
return
0
;
return
0
;
}
view
->
Add
(
m_editPoints
.
get
()
);
view
->
Add
(
m_editPoints
.
get
()
);
m_dragPoint
=
NULL
;
m_dragPoint
=
NULL
;
...
@@ -363,8 +359,6 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
...
@@ -363,8 +359,6 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
controls
->
ForceCursorPosition
(
false
);
controls
->
ForceCursorPosition
(
false
);
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -795,7 +789,7 @@ void POINT_EDITOR::breakOutline( const VECTOR2I& aBreakPoint )
...
@@ -795,7 +789,7 @@ void POINT_EDITOR::breakOutline( const VECTOR2I& aBreakPoint )
}
}
void
POINT_EDITOR
::
s
etTransitions
()
void
POINT_EDITOR
::
S
etTransitions
()
{
{
Go
(
&
POINT_EDITOR
::
OnSelectionChange
,
SELECTION_TOOL
::
SelectedEvent
);
Go
(
&
POINT_EDITOR
::
OnSelectionChange
,
SELECTION_TOOL
::
SelectedEvent
);
Go
(
&
POINT_EDITOR
::
OnSelectionChange
,
SELECTION_TOOL
::
UnselectedEvent
);
Go
(
&
POINT_EDITOR
::
OnSelectionChange
,
SELECTION_TOOL
::
UnselectedEvent
);
...
...
pcbnew/tools/point_editor.h
View file @
946b9d19
...
@@ -55,6 +55,9 @@ public:
...
@@ -55,6 +55,9 @@ public:
*/
*/
int
OnSelectionChange
(
const
TOOL_EVENT
&
aEvent
);
int
OnSelectionChange
(
const
TOOL_EVENT
&
aEvent
);
///> Sets up handlers for various events.
void
SetTransitions
();
private
:
private
:
///> Selection tool used for obtaining selected items
///> Selection tool used for obtaining selected items
SELECTION_TOOL
*
m_selectionTool
;
SELECTION_TOOL
*
m_selectionTool
;
...
@@ -98,9 +101,6 @@ private:
...
@@ -98,9 +101,6 @@ private:
///> Adds a new edit point on a zone outline/line.
///> Adds a new edit point on a zone outline/line.
void
breakOutline
(
const
VECTOR2I
&
aBreakPoint
);
void
breakOutline
(
const
VECTOR2I
&
aBreakPoint
);
///> Sets up handlers for various events.
void
setTransitions
();
///> Condition to display "Create corner" context menu entry.
///> Condition to display "Create corner" context menu entry.
static
bool
breakOutlineCondition
(
const
SELECTION
&
aSelection
);
static
bool
breakOutlineCondition
(
const
SELECTION
&
aSelection
);
};
};
...
...
pcbnew/tools/selection_tool.cpp
View file @
946b9d19
...
@@ -106,8 +106,6 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason )
...
@@ -106,8 +106,6 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason )
// Reinsert the VIEW_GROUP, in case it was removed from the VIEW
// Reinsert the VIEW_GROUP, in case it was removed from the VIEW
getView
()
->
Remove
(
m_selection
.
group
);
getView
()
->
Remove
(
m_selection
.
group
);
getView
()
->
Add
(
m_selection
.
group
);
getView
()
->
Add
(
m_selection
.
group
);
setTransitions
();
}
}
...
@@ -428,7 +426,7 @@ bool SELECTION_TOOL::selectMultiple()
...
@@ -428,7 +426,7 @@ bool SELECTION_TOOL::selectMultiple()
}
}
void
SELECTION_TOOL
::
s
etTransitions
()
void
SELECTION_TOOL
::
S
etTransitions
()
{
{
Go
(
&
SELECTION_TOOL
::
Main
,
COMMON_ACTIONS
::
selectionActivate
.
MakeEvent
()
);
Go
(
&
SELECTION_TOOL
::
Main
,
COMMON_ACTIONS
::
selectionActivate
.
MakeEvent
()
);
Go
(
&
SELECTION_TOOL
::
CursorSelection
,
COMMON_ACTIONS
::
selectionCursor
.
MakeEvent
()
);
Go
(
&
SELECTION_TOOL
::
CursorSelection
,
COMMON_ACTIONS
::
selectionCursor
.
MakeEvent
()
);
...
@@ -492,7 +490,6 @@ SELECTION_LOCK_FLAGS SELECTION_TOOL::CheckLock()
...
@@ -492,7 +490,6 @@ SELECTION_LOCK_FLAGS SELECTION_TOOL::CheckLock()
int
SELECTION_TOOL
::
CursorSelection
(
const
TOOL_EVENT
&
aEvent
)
int
SELECTION_TOOL
::
CursorSelection
(
const
TOOL_EVENT
&
aEvent
)
{
{
selectCursor
(
getView
()
->
ToWorld
(
getViewControls
()
->
GetMousePosition
()
)
);
selectCursor
(
getView
()
->
ToWorld
(
getViewControls
()
->
GetMousePosition
()
)
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -501,7 +498,6 @@ int SELECTION_TOOL::CursorSelection( const TOOL_EVENT& aEvent )
...
@@ -501,7 +498,6 @@ int SELECTION_TOOL::CursorSelection( const TOOL_EVENT& aEvent )
int
SELECTION_TOOL
::
ClearSelection
(
const
TOOL_EVENT
&
aEvent
)
int
SELECTION_TOOL
::
ClearSelection
(
const
TOOL_EVENT
&
aEvent
)
{
{
clearSelection
();
clearSelection
();
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -519,8 +515,6 @@ int SELECTION_TOOL::SelectItem( const TOOL_EVENT& aEvent )
...
@@ -519,8 +515,6 @@ int SELECTION_TOOL::SelectItem( const TOOL_EVENT& aEvent )
m_toolMgr
->
ProcessEvent
(
SelectedEvent
);
m_toolMgr
->
ProcessEvent
(
SelectedEvent
);
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -537,8 +531,6 @@ int SELECTION_TOOL::UnselectItem( const TOOL_EVENT& aEvent )
...
@@ -537,8 +531,6 @@ int SELECTION_TOOL::UnselectItem( const TOOL_EVENT& aEvent )
m_toolMgr
->
ProcessEvent
(
UnselectedEvent
);
m_toolMgr
->
ProcessEvent
(
UnselectedEvent
);
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -562,8 +554,6 @@ int SELECTION_TOOL::selectConnection( const TOOL_EVENT& aEvent )
...
@@ -562,8 +554,6 @@ int SELECTION_TOOL::selectConnection( const TOOL_EVENT& aEvent )
m_toolMgr
->
ProcessEvent
(
selectEvent
);
m_toolMgr
->
ProcessEvent
(
selectEvent
);
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -588,8 +578,6 @@ int SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent )
...
@@ -588,8 +578,6 @@ int SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent )
m_toolMgr
->
ProcessEvent
(
selectEvent
);
m_toolMgr
->
ProcessEvent
(
selectEvent
);
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -618,7 +606,6 @@ int SELECTION_TOOL::find( const TOOL_EVENT& aEvent )
...
@@ -618,7 +606,6 @@ int SELECTION_TOOL::find( const TOOL_EVENT& aEvent )
dlg
.
EnableWarp
(
false
);
dlg
.
EnableWarp
(
false
);
dlg
.
SetCallback
(
boost
::
bind
(
&
SELECTION_TOOL
::
findCallback
,
this
,
_1
)
);
dlg
.
SetCallback
(
boost
::
bind
(
&
SELECTION_TOOL
::
findCallback
,
this
,
_1
)
);
dlg
.
ShowModal
();
dlg
.
ShowModal
();
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -635,8 +622,6 @@ int SELECTION_TOOL::findMove( const TOOL_EVENT& aEvent )
...
@@ -635,8 +622,6 @@ int SELECTION_TOOL::findMove( const TOOL_EVENT& aEvent )
m_toolMgr
->
InvokeTool
(
"pcbnew.InteractiveEdit"
);
m_toolMgr
->
InvokeTool
(
"pcbnew.InteractiveEdit"
);
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
...
pcbnew/tools/selection_tool.h
View file @
946b9d19
...
@@ -185,6 +185,9 @@ public:
...
@@ -185,6 +185,9 @@ public:
///> Event sent after selection is cleared.
///> Event sent after selection is cleared.
static
const
TOOL_EVENT
ClearedEvent
;
static
const
TOOL_EVENT
ClearedEvent
;
///> Sets up handlers for various events.
void
SetTransitions
();
private
:
private
:
/**
/**
* Function selectCursor()
* Function selectCursor()
...
@@ -221,9 +224,6 @@ private:
...
@@ -221,9 +224,6 @@ private:
///> Find an item and start moving.
///> Find an item and start moving.
int
findMove
(
const
TOOL_EVENT
&
aEvent
);
int
findMove
(
const
TOOL_EVENT
&
aEvent
);
///> Sets up handlers for various events.
void
setTransitions
();
/**
/**
* Function clearSelection()
* Function clearSelection()
* Clears the current selection.
* Clears the current selection.
...
...
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