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
f261bf38
Commit
f261bf38
authored
Apr 30, 2015
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Plain Diff
Zoom & grid menu for GAL.
parents
89699a19
8390fec6
Changes
44
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
44 changed files
with
675 additions
and
721 deletions
+675
-721
.bzrignore
.bzrignore
+2
-0
CMakeLists.txt
common/CMakeLists.txt
+8
-3
draw_frame.cpp
common/draw_frame.cpp
+56
-88
draw_panel_gal.cpp
common/draw_panel_gal.cpp
+21
-41
context_menu.cpp
common/tool/context_menu.cpp
+132
-72
tool_manager.cpp
common/tool/tool_manager.cpp
+25
-3
zoom.cpp
common/zoom.cpp
+30
-14
CMakeLists.txt
cvpcb/CMakeLists.txt
+0
-17
CMakeLists.txt
gerbview/CMakeLists.txt
+0
-1
class_base_screen.h
include/class_base_screen.h
+1
-1
draw_frame.h
include/draw_frame.h
+29
-0
context_menu.h
include/tool/context_menu.h
+62
-26
tool_action.h
include/tool/tool_action.h
+11
-14
tool_base.h
include/tool/tool_base.h
+7
-0
tool_event.h
include/tool/tool_event.h
+21
-13
tool_manager.h
include/tool/tool_manager.h
+24
-2
view_controls.h
include/view/view_controls.h
+5
-1
view_item.h
include/view/view_item.h
+8
-3
wxBasePcbFrame.h
include/wxBasePcbFrame.h
+0
-3
wxstruct.h
include/wxstruct.h
+2
-0
CMakeLists.txt
pagelayout_editor/CMakeLists.txt
+0
-1
CMakeLists.txt
pcbnew/CMakeLists.txt
+4
-8
basepcbframe.cpp
pcbnew/basepcbframe.cpp
+0
-7
dialog_set_grid.cpp
pcbnew/dialogs/dialog_set_grid.cpp
+8
-6
ratsnest_data.cpp
pcbnew/ratsnest_data.cpp
+2
-1
router_tool.cpp
pcbnew/router/router_tool.cpp
+2
-4
common_actions.cpp
pcbnew/tools/common_actions.cpp
+32
-24
common_actions.h
pcbnew/tools/common_actions.h
+2
-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
+12
-57
edit_tool.h
pcbnew/tools/edit_tool.h
+3
-3
module_tools.cpp
pcbnew/tools/module_tools.cpp
+2
-19
module_tools.h
pcbnew/tools/module_tools.h
+2
-2
pcb_editor_control.cpp
pcbnew/tools/pcb_editor_control.cpp
+3
-25
pcb_editor_control.h
pcbnew/tools/pcb_editor_control.h
+2
-2
pcbnew_control.cpp
pcbnew/tools/pcbnew_control.cpp
+50
-69
pcbnew_control.h
pcbnew/tools/pcbnew_control.h
+4
-5
placement_tool.cpp
pcbnew/tools/placement_tool.cpp
+3
-17
placement_tool.h
pcbnew/tools/placement_tool.h
+2
-2
point_editor.cpp
pcbnew/tools/point_editor.cpp
+4
-10
point_editor.h
pcbnew/tools/point_editor.h
+3
-3
selection_tool.cpp
pcbnew/tools/selection_tool.cpp
+63
-87
selection_tool.h
pcbnew/tools/selection_tool.h
+24
-47
No files found.
.bzrignore
View file @
f261bf38
...
...
@@ -31,6 +31,8 @@ install_manifest.txt
Documentation/doxygen
Documentation/development/doxygen
*.bak
.*.swp
*.~*
common/pcb_plot_params_keywords.cpp
include/pcb_plot_params_lexer.h
pcbnew/specctra_keywords.cpp
...
...
common/CMakeLists.txt
View file @
f261bf38
...
...
@@ -56,9 +56,14 @@ set( GAL_SRCS
add_library
(
gal STATIC
${
GAL_SRCS
}
)
add_dependencies
(
gal shader_headers
)
add_dependencies
(
gal lib-dependencies
)
add_dependencies
(
shader_headers lib-dependencies
)
target_link_libraries
(
gal
${
GLEW_LIBRARIES
}
${
CAIRO_LIBRARIES
}
${
PIXMAN_LIBRARY
}
${
OPENGL_LIBRARIES
}
)
# Only for win32 cross compilation using MXE
...
...
@@ -247,7 +252,7 @@ set( COMMON_SRCS
)
add_library
(
common STATIC
${
COMMON_SRCS
}
)
add_dependencies
(
common lib-dependencies
)
target_link_libraries
(
common
${
Boost_LIBRARIES
}
)
set
(
PCB_COMMON_SRCS
base_screen.cpp
...
...
common/draw_frame.cpp
View file @
f261bf38
...
...
@@ -51,6 +51,8 @@
#include <view/view.h>
#include <view/view_controls.h>
#include <gal/graphics_abstraction_layer.h>
#include <tool/tool_manager.h>
#include <tool/tool_dispatcher.h>
/**
* Definition for enabling and disabling scroll bar setting trace output. See the
...
...
@@ -110,6 +112,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_canvas
=
NULL
;
m_galCanvas
=
NULL
;
m_galCanvasActive
=
false
;
m_toolManager
=
NULL
;
m_toolDispatcher
=
NULL
;
m_messagePanel
=
NULL
;
m_currentScreen
=
NULL
;
m_toolId
=
ID_NO_TOOL_SELECTED
;
...
...
@@ -180,6 +184,10 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
EDA_DRAW_FRAME
::~
EDA_DRAW_FRAME
()
{
delete
m_toolManager
;
delete
m_toolDispatcher
;
delete
m_galCanvas
;
delete
m_currentScreen
;
m_currentScreen
=
NULL
;
...
...
@@ -379,47 +387,17 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
else
{
eventId
=
event
.
GetId
();
/* Update the grid select combobox if the grid size was changed
* by menu event.
*/
if
(
m_gridSelectBox
!=
NULL
)
{
for
(
size_t
i
=
0
;
i
<
m_gridSelectBox
->
GetCount
();
i
++
)
{
clientData
=
(
int
*
)
m_gridSelectBox
->
wxItemContainer
::
GetClientData
(
i
);
if
(
clientData
&&
eventId
==
*
clientData
)
{
m_gridSelectBox
->
SetSelection
(
i
);
break
;
}
}
}
}
// Be sure m_LastGridSizeId is up to date.
m_LastGridSizeId
=
eventId
-
ID_POPUP_GRID_LEVEL_1000
;
BASE_SCREEN
*
screen
=
GetScreen
();
if
(
screen
->
GetGridId
()
==
eventId
)
return
;
int
idx
=
eventId
-
ID_POPUP_GRID_LEVEL_1000
;
/*
* This allows for saving non-sequential command ID offsets used that
* may be used in the grid size combobox. Do not use the selection
* index returned by GetSelection().
*/
screen
->
SetGrid
(
eventId
);
SetCrossHairPosition
(
RefPos
(
true
)
);
// Notify GAL
TOOL_MANAGER
*
mgr
=
GetToolManager
();
if
(
IsGalCanvasActive
()
)
{
GetGalCanvas
()
->
GetGAL
()
->
SetGridSize
(
VECTOR2D
(
screen
->
GetGrid
().
m_Size
.
x
,
screen
->
GetGrid
().
m_Size
.
y
)
);
GetGalCanvas
()
->
GetView
()
->
MarkTargetDirty
(
KIGFX
::
TARGET_NONCACHED
);
}
if
(
mgr
&&
IsGalCanvasActive
()
)
mgr
->
RunAction
(
"common.Control.gridPreset"
,
true
,
idx
);
else
SetPresetGrid
(
idx
);
m_canvas
->
Refresh
();
}
...
...
@@ -448,22 +426,14 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
return
;
GetScreen
()
->
SetZoom
(
selectedZoom
);
RedrawScreen
(
GetScrollCenterPosition
(),
false
);
}
if
(
IsGalCanvasActive
()
)
{
// Apply computed view settings to GAL
KIGFX
::
VIEW
*
view
=
GetGalCanvas
()
->
GetView
();
KIGFX
::
GAL
*
gal
=
GetGalCanvas
()
->
GetGAL
();
double
zoomFactor
=
gal
->
GetWorldScale
()
/
gal
->
GetZoomFactor
();
double
zoom
=
1.0
/
(
zoomFactor
*
GetZoom
()
);
// Notify GAL
TOOL_MANAGER
*
mgr
=
GetToolManager
();
view
->
SetScale
(
zoom
);
GetGalCanvas
()
->
Refresh
();
}
else
RedrawScreen
(
GetScrollCenterPosition
(),
false
);
}
if
(
mgr
&&
IsGalCanvasActive
()
)
mgr
->
RunAction
(
"common.Control.zoomPreset"
,
true
,
id
);
}
...
...
@@ -557,14 +527,7 @@ wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const
void
EDA_DRAW_FRAME
::
SetNextGrid
()
{
if
(
m_gridSelectBox
)
{
m_gridSelectBox
->
SetSelection
(
(
m_gridSelectBox
->
GetSelection
()
+
1
)
%
m_gridSelectBox
->
GetCount
()
);
wxCommandEvent
cmd
(
wxEVT_COMMAND_COMBOBOX_SELECTED
);
// cmd.SetEventObject( this );
OnSelectGrid
(
cmd
);
}
SetPresetGrid
(
(
m_gridSelectBox
->
GetSelection
()
+
1
)
%
m_gridSelectBox
->
GetCount
()
);
}
...
...
@@ -572,17 +535,31 @@ void EDA_DRAW_FRAME::SetPrevGrid()
{
if
(
m_gridSelectBox
)
{
int
cnt
=
m_gridSelectBox
->
GetSelection
();
int
idx
=
m_gridSelectBox
->
GetSelection
();
if
(
--
idx
<
0
)
idx
=
m_gridSelectBox
->
GetCount
()
-
1
;
if
(
--
cnt
<
0
)
cnt
=
m_gridSelectBox
->
GetCount
()
-
1
;
SetPresetGrid
(
idx
);
}
}
m_gridSelectBox
->
SetSelection
(
cnt
);
wxCommandEvent
cmd
(
wxEVT_COMMAND_COMBOBOX_SELECTED
);
// cmd.SetEventObject( this );
OnSelectGrid
(
cmd
);
void
EDA_DRAW_FRAME
::
SetPresetGrid
(
int
aIndex
)
{
if
(
aIndex
<
0
||
aIndex
>=
(
int
)
m_gridSelectBox
->
GetCount
()
)
{
wxASSERT_MSG
(
false
,
"Invalid grid index"
);
return
;
}
if
(
m_gridSelectBox
)
m_gridSelectBox
->
SetSelection
(
aIndex
);
// Be sure m_LastGridSizeId is up to date.
m_LastGridSizeId
=
aIndex
;
GetScreen
()
->
SetGrid
(
aIndex
+
ID_POPUP_GRID_LEVEL_1000
);
SetCrossHairPosition
(
RefPos
(
true
)
);
}
...
...
@@ -1018,38 +995,29 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
KIGFX
::
GAL
*
gal
=
GetGalCanvas
()
->
GetGAL
();
double
zoomFactor
=
gal
->
GetWorldScale
()
/
gal
->
GetZoomFactor
();
BASE_SCREEN
*
screen
=
GetScreen
();
// Display the same view after canvas switching
if
(
aEnable
)
if
(
aEnable
)
// Switch to GAL rendering
{
BASE_SCREEN
*
screen
=
GetScreen
();
// Switch to GAL rendering
if
(
!
IsGalCanvasActive
()
)
{
// Set up viewport
double
zoom
=
1.0
/
(
zoomFactor
*
m_canvas
->
GetZoom
()
);
view
->
SetScale
(
zoom
);
view
->
SetCenter
(
VECTOR2D
(
m_canvas
->
GetScreenCenterLogicalPosition
()
)
);
}
// Set up viewport
double
zoom
=
1.0
/
(
zoomFactor
*
m_canvas
->
GetZoom
()
);
view
->
SetScale
(
zoom
);
view
->
SetCenter
(
VECTOR2D
(
m_canvas
->
GetScreenCenterLogicalPosition
()
)
);
// Set up grid settings
gal
->
SetGridVisibility
(
IsGridVisible
()
);
gal
->
SetGridSize
(
VECTOR2D
(
screen
->
GetGridSize
()
.
x
,
screen
->
GetGridSize
().
y
)
);
gal
->
SetGridSize
(
VECTOR2D
(
screen
->
GetGridSize
()
)
);
gal
->
SetGridOrigin
(
VECTOR2D
(
GetGridOrigin
()
)
);
}
else
else
// Switch to standard rendering
{
// Switch to standard rendering
if
(
IsGalCanvasActive
()
)
{
// Change view settings only if GAL was active previously
double
zoom
=
1.0
/
(
zoomFactor
*
view
->
GetScale
()
);
m_canvas
->
SetZoom
(
zoom
);
// Change view settings only if GAL was active previously
double
zoom
=
1.0
/
(
zoomFactor
*
view
->
GetScale
()
);
m_canvas
->
SetZoom
(
zoom
);
VECTOR2D
center
=
view
->
GetCenter
();
RedrawScreen
(
wxPoint
(
center
.
x
,
center
.
y
),
false
);
}
VECTOR2D
center
=
view
->
GetCenter
();
AdjustScrollBars
(
wxPoint
(
center
.
x
,
center
.
y
)
);
}
m_canvas
->
SetEvtHandlerEnabled
(
!
aEnable
);
...
...
common/draw_panel_gal.cpp
View file @
f261bf38
...
...
@@ -99,17 +99,10 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
EDA_DRAW_PANEL_GAL
::~
EDA_DRAW_PANEL_GAL
()
{
if
(
m_painter
)
delete
m_painter
;
if
(
m_viewControls
)
delete
m_viewControls
;
if
(
m_view
)
delete
m_view
;
if
(
m_gal
)
delete
m_gal
;
delete
m_painter
;
delete
m_viewControls
;
delete
m_view
;
delete
m_gal
;
}
...
...
@@ -194,42 +187,29 @@ void EDA_DRAW_PANEL_GAL::SetEventDispatcher( TOOL_DISPATCHER* aEventDispatcher )
m_eventDispatcher
=
aEventDispatcher
;
#if wxCHECK_VERSION( 3, 0, 0 )
if
(
m_eventDispatcher
)
{
m_parent
->
Connect
(
wxEVT_TOOL
,
wxCommandEventHandler
(
TOOL_DISPATCHER
::
DispatchWxCommand
),
NULL
,
m_eventDispatcher
);
}
else
{
// While loops are used to be sure, that we are removing all event handlers
while
(
m_parent
->
Disconnect
(
wxEVT_TOOL
,
wxCommandEventHandler
(
TOOL_DISPATCHER
::
DispatchWxCommand
),
NULL
,
m_eventDispatcher
)
);
}
const
wxEventType
eventTypes
[]
=
{
wxEVT_TOOL
};
#else
const
wxEventType
eventTypes
[]
=
{
wxEVT_COMMAND_MENU_SELECTED
,
wxEVT_COMMAND_TOOL_CLICKED
};
#endif
if
(
m_eventDispatcher
)
{
m_parent
->
Connect
(
wxEVT_COMMAND_MENU_SELECTED
,
wxCommandEventHandler
(
TOOL_DISPATCHER
::
DispatchWxCommand
),
NULL
,
m_eventDispatcher
);
m_parent
->
Connect
(
wxEVT_COMMAND_TOOL_CLICKED
,
wxCommandEventHandler
(
TOOL_DISPATCHER
::
DispatchWxCommand
),
NULL
,
m_eventDispatcher
);
BOOST_FOREACH
(
wxEventType
type
,
eventTypes
)
{
m_parent
->
Connect
(
type
,
wxCommandEventHandler
(
TOOL_DISPATCHER
::
DispatchWxCommand
),
NULL
,
m_eventDispatcher
);
}
}
else
{
// While loops are used to be sure, that we are removing all event handlers
while
(
m_parent
->
Disconnect
(
wxEVT_COMMAND_MENU_SELECTED
,
wxCommandEventHandler
(
TOOL_DISPATCHER
::
DispatchWxCommand
),
NULL
,
m_eventDispatcher
)
);
while
(
m_parent
->
Disconnect
(
wxEVT_COMMAND_TOOL_CLICKED
,
wxCommandEventHandler
(
TOOL_DISPATCHER
::
DispatchWxCommand
),
NULL
,
m_eventDispatcher
)
);
BOOST_FOREACH
(
wxEventType
type
,
eventTypes
)
{
// While loop is used to be sure that all event handlers are removed.
while
(
m_parent
->
Disconnect
(
type
,
wxCommandEventHandler
(
TOOL_DISPATCHER
::
DispatchWxCommand
),
NULL
,
m_eventDispatcher
)
);
}
}
#endif
}
...
...
@@ -316,7 +296,7 @@ bool EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType )
m_backend
=
aGalType
;
}
catch
(
std
::
runtime_error
&
err
)
catch
(
std
::
runtime_error
&
err
)
{
DisplayError
(
m_parent
,
wxString
(
err
.
what
()
)
);
return
false
;
...
...
common/tool/context_menu.cpp
View file @
f261bf38
This diff is collapsed.
Click to expand it.
common/tool/tool_manager.cpp
View file @
f261bf38
...
...
@@ -303,7 +303,10 @@ bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow, void* a
if
(
action
)
{
TOOL_EVENT
event
=
action
->
MakeEvent
();
event
.
SetParameter
(
aParam
);
// Allow to override the action parameter
if
(
aParam
)
event
.
SetParameter
(
aParam
);
if
(
aNow
)
ProcessEvent
(
event
);
...
...
@@ -313,6 +316,8 @@ bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow, void* a
return
true
;
}
wxASSERT_MSG
(
action
!=
NULL
,
wxString
::
Format
(
_
(
"Could not find action %s."
),
aActionName
)
);
return
false
;
}
...
...
@@ -320,7 +325,10 @@ bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow, void* a
void
TOOL_MANAGER
::
RunAction
(
const
TOOL_ACTION
&
aAction
,
bool
aNow
,
void
*
aParam
)
{
TOOL_EVENT
event
=
aAction
.
MakeEvent
();
event
.
SetParameter
(
aParam
);
// Allow to override the action parameter
if
(
aParam
)
event
.
SetParameter
(
aParam
);
if
(
aNow
)
ProcessEvent
(
event
);
...
...
@@ -383,6 +391,7 @@ bool TOOL_MANAGER::runTool( TOOL_BASE* aTool )
}
aTool
->
Reset
(
TOOL_INTERACTIVE
::
RUN
);
aTool
->
SetTransitions
();
// Add the tool on the front of the processing queue (it gets events first)
m_activeTools
.
push_front
(
aTool
->
GetId
()
);
...
...
@@ -419,7 +428,10 @@ void TOOL_MANAGER::ResetTools( TOOL_BASE::RESET_REASON aReason )
ProcessEvent
(
evt
);
BOOST_FOREACH
(
TOOL_BASE
*
tool
,
m_toolState
|
boost
::
adaptors
::
map_keys
)
{
tool
->
Reset
(
aReason
);
tool
->
SetTransitions
();
}
}
...
...
@@ -584,8 +596,13 @@ void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent )
// Temporarily store the cursor position, so the tools could execute actions
// using the point where the user has invoked a context menu
bool
forcedCursor
=
m_viewControls
->
IsCursorPositionForced
();
VECTOR2D
cursorPos
=
m_viewControls
->
GetCursorPosition
();
m_viewControls
->
ForceCursorPosition
(
true
,
m_viewControls
->
GetCursorPosition
()
);
// Run update handlers
st
->
contextMenu
->
UpdateAll
();
boost
::
scoped_ptr
<
CONTEXT_MENU
>
menu
(
new
CONTEXT_MENU
(
*
st
->
contextMenu
)
);
GetEditFrame
()
->
PopupMenu
(
menu
.
get
()
);
...
...
@@ -596,7 +613,10 @@ void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent )
dispatchInternal
(
evt
);
}
m_viewControls
->
ForceCursorPosition
(
false
);
TOOL_EVENT
evt
(
TC_COMMAND
,
TA_CONTEXT_MENU_CLOSED
);
dispatchInternal
(
evt
);
m_viewControls
->
ForceCursorPosition
(
forcedCursor
,
cursorPos
);
break
;
}
...
...
@@ -615,6 +635,8 @@ void TOOL_MANAGER::finishTool( TOOL_STATE* aState )
if
(
tool
!=
m_activeTools
.
end
()
)
m_activeTools
.
erase
(
tool
);
}
aState
->
theTool
->
SetTransitions
();
}
...
...
common/zoom.cpp
View file @
f261bf38
...
...
@@ -33,8 +33,6 @@
#include <fctsys.h>
#include <id.h>
#include <class_drawpanel.h>
#include <class_draw_panel_gal.h>
#include <gal/graphics_abstraction_layer.h>
#include <view/view.h>
#include <class_base_screen.h>
#include <draw_frame.h>
...
...
@@ -42,10 +40,14 @@
#include <hotkeys_basic.h>
#include <menus_helpers.h>
#include <base_units.h>
#include <tool/tool_manager.h>
void
EDA_DRAW_FRAME
::
RedrawScreen
(
const
wxPoint
&
aCenterPoint
,
bool
aWarpPointer
)
{
if
(
IsGalCanvasActive
()
)
return
;
AdjustScrollBars
(
aCenterPoint
);
// Move the mouse cursor to the on grid graphic cursor position
...
...
@@ -58,6 +60,9 @@ void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointe
void
EDA_DRAW_FRAME
::
RedrawScreen2
(
const
wxPoint
&
posBefore
)
{
if
(
IsGalCanvasActive
()
)
return
;
wxPoint
dPos
=
posBefore
-
m_canvas
->
GetClientSize
()
/
2
;
// relative screen position to center before zoom
wxPoint
newScreenPos
=
m_canvas
->
ToDeviceXY
(
GetCrossHairPosition
()
);
// screen position of crosshair after zoom
wxPoint
newCenter
=
m_canvas
->
ToLogicalXY
(
newScreenPos
-
dPos
);
...
...
@@ -86,6 +91,8 @@ void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
if
(
!
IsGalCanvasActive
()
)
RedrawScreen
(
GetScrollCenterPosition
(),
aWarpPointer
);
else
m_toolManager
->
RunAction
(
"common.Control.zoomFitScreen"
,
true
);
}
...
...
@@ -186,18 +193,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
break
;
default
:
unsigned
i
;
i
=
id
-
ID_POPUP_ZOOM_LEVEL_START
;
if
(
i
>=
screen
->
m_ZoomList
.
size
()
)
{
wxLogDebug
(
wxT
(
"%s %d: index %d is outside the bounds of the zoom list."
),
__TFILE__
,
__LINE__
,
i
);
return
;
}
if
(
screen
->
SetZoom
(
screen
->
m_ZoomList
[
i
]
)
)
RedrawScreen
(
center
,
true
);
SetPresetZoom
(
id
-
ID_POPUP_ZOOM_LEVEL_START
);
}
UpdateStatusBar
();
...
...
@@ -216,6 +212,26 @@ void EDA_DRAW_FRAME::SetPrevZoom()
}
void
EDA_DRAW_FRAME
::
SetPresetZoom
(
int
aIndex
)
{
BASE_SCREEN
*
screen
=
GetScreen
();
if
(
aIndex
>=
(
int
)
screen
->
m_ZoomList
.
size
()
)
{
wxLogDebug
(
wxT
(
"%s %d: index %d is outside the bounds of the zoom list."
),
__TFILE__
,
__LINE__
,
aIndex
);
return
;
}
m_zoomSelectBox
->
SetSelection
(
aIndex
);
if
(
screen
->
SetZoom
(
screen
->
m_ZoomList
[
aIndex
]
)
)
RedrawScreen
(
GetScrollCenterPosition
(),
true
);
UpdateStatusBar
();
}
/* add the zoom list menu the the MasterMenu.
* used in OnRightClick(wxMouseEvent& event)
*/
...
...
cvpcb/CMakeLists.txt
View file @
f261bf38
...
...
@@ -117,26 +117,9 @@ target_link_libraries( cvpcb_kiface
polygon
gal
${
wxWidgets_LIBRARIES
}
${
OPENGL_LIBRARIES
}
${
GDI_PLUS_LIBRARIES
}
${
GLEW_LIBRARIES
}
${
CAIRO_LIBRARIES
}
${
PIXMAN_LIBRARY
}
${
OPENMP_LIBRARIES
}
)
# Only for win32 cross compilation using MXE
if
(
WIN32 AND MSYS AND CMAKE_CROSSCOMPILING
)
target_link_libraries
(
cvpcb_kiface
opengl32
glu32
pixman-1
fontconfig
freetype
bz2
)
endif
()
if
(
BUILD_GITHUB_PLUGIN
)
target_link_libraries
(
cvpcb_kiface github_plugin
)
endif
()
...
...
gerbview/CMakeLists.txt
View file @
f261bf38
...
...
@@ -131,7 +131,6 @@ target_link_libraries( gerbview_kiface
common
polygon
bitmaps
${
OPENGL_LIBRARIES
}
${
wxWidgets_LIBRARIES
}
${
GDI_PLUS_LIBRARIES
}
)
...
...
include/class_base_screen.h
View file @
f261bf38
...
...
@@ -215,7 +215,7 @@ public:
int
m_ScreenNumber
;
int
m_NumberOfScreens
;
std
::
vector
<
double
>
m_ZoomList
;
///< standard zoom (i.e. scale) coefficients.
std
::
vector
<
int
>
m_ZoomList
;
///< standard zoom (i.e. scale) coefficients.
bool
m_IsPrinting
;
public
:
...
...
include/draw_frame.h
View file @
f261bf38
...
...
@@ -72,6 +72,9 @@ protected:
/// The area to draw on.
EDA_DRAW_PANEL
*
m_canvas
;
TOOL_MANAGER
*
m_toolManager
;
TOOL_DISPATCHER
*
m_toolDispatcher
;
/// Tool ID of previously active draw tool bar button.
int
m_lastDrawToolId
;
...
...
@@ -343,6 +346,12 @@ public:
*/
virtual
const
wxString
GetZoomLevelIndicator
()
const
;
/**
* Function GetZoomLevelCoeff
* returns the coefficient to convert internal display scale factor to zoom level.
*/
inline
double
GetZoomLevelCoeff
()
const
{
return
m_zoomLevelCoeff
;
}
void
EraseMsgBox
();
void
Process_PageSettings
(
wxCommandEvent
&
event
);
...
...
@@ -430,6 +439,13 @@ public:
*/
virtual
void
SetPrevGrid
();
/**
* Function SetPresetGrid()
* changes the grid size to one of the preset values.
* @param aIndex is the index from the list.
*/
void
SetPresetGrid
(
int
aIndex
);
/**
* Command event handler for selecting grid sizes.
*
...
...
@@ -502,6 +518,13 @@ public:
*/
void
SetPrevZoom
();
/**
* Function SetPresetZoom()
* changes zoom to one of the preset values.
* @param aIndex is the zoom index from the list.
*/
void
SetPresetZoom
(
int
aIndex
);
/**
* Function RedrawScreen
* redraws the entire screen area by updating the scroll bars and mouse pointer in
...
...
@@ -730,6 +753,12 @@ public:
EDA_DRAW_PANEL_GAL
*
GetGalCanvas
()
const
{
return
m_galCanvas
;
}
void
SetGalCanvas
(
EDA_DRAW_PANEL_GAL
*
aPanel
)
{
m_galCanvas
=
aPanel
;
}
/**
* Function GetToolManager
* returns the tool manager instance, if any.
*/
TOOL_MANAGER
*
GetToolManager
()
const
{
return
m_toolManager
;
}
/**
* Function GetDisplayOptions
* A way to pass info to draw functions. the base class has no knowledge about
...
...
include/tool/context_menu.h
View file @
f261bf38
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* Copyright (C) 2013
-2015
CERN
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @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
...
...
@@ -47,9 +48,9 @@ public:
///> Copy constructor
CONTEXT_MENU
(
const
CONTEXT_MENU
&
aMenu
);
CONTEXT_MENU
&
operator
=
(
const
CONTEXT_MENU
&
aMenu
);
virtual
~
CONTEXT_MENU
(
);
virtual
~
CONTEXT_MENU
()
{}
CONTEXT_MENU
&
operator
=
(
const
CONTEXT_MENU
&
aMenu
);
/**
* Function SetTitle()
...
...
@@ -64,7 +65,7 @@ public:
* Assigns an icon for the entry.
* @param aIcon is the icon to be assigned. NULL is used to remove icon.
*/
void
SetIcon
(
const
BITMAP_OPAQUE
*
aIcon
)
inline
void
SetIcon
(
const
BITMAP_OPAQUE
*
aIcon
)
{
m_icon
=
aIcon
;
}
...
...
@@ -77,7 +78,7 @@ public:
* @param aId is the ID that is sent in the TOOL_EVENT. It should be unique for every entry.
* @param aIcon is an optional icon.
*/
void
Add
(
const
wxString
&
aLabel
,
int
aId
,
const
BITMAP_OPAQUE
*
aIcon
=
NULL
);
wxMenuItem
*
Add
(
const
wxString
&
aLabel
,
int
aId
,
const
BITMAP_OPAQUE
*
aIcon
=
NULL
);
/**
* Function Add()
...
...
@@ -85,7 +86,7 @@ public:
* a TOOL_EVENT command containing name of the action is sent.
* @param aAction is the action to be added to menu entry.
*/
void
Add
(
const
TOOL_ACTION
&
aAction
);
wxMenuItem
*
Add
(
const
TOOL_ACTION
&
aAction
);
/**
* Function Add()
...
...
@@ -93,8 +94,10 @@ public:
* is the capability to handle icons.
* @param aMenu is the submenu to be added.
* @param aLabel is the caption displayed for the menu entry.
* @param aExpand allows to add all entries from the menu as individual entries rather than
* add everything as a submenu.
*/
void
Add
(
CONTEXT_MENU
*
aMenu
,
const
wxString
&
aLabel
);
std
::
list
<
wxMenuItem
*>
Add
(
CONTEXT_MENU
*
aMenu
,
const
wxString
&
aLabel
,
bool
aExpand
=
false
);
/**
* Function Clear()
...
...
@@ -109,28 +112,48 @@ public:
* menu was dismissed.
* @return The position of selected item in the context menu.
*/
int
GetSelected
()
const
in
line
in
t
GetSelected
()
const
{
return
m_selected
;
}
protected
:
void
setCustomEventHandler
(
boost
::
function
<
OPT_TOOL_EVENT
(
const
wxMenuEvent
&
)
>
aHandler
)
/**
* Function UpdateAll()
* Runs update handlers for the menu and its submenus.
*/
void
UpdateAll
();
typedef
boost
::
function
<
OPT_TOOL_EVENT
(
const
wxMenuEvent
&
)
>
MENU_HANDLER
;
typedef
boost
::
function
<
void
()
>
UPDATE_HANDLER
;
/**
* Function SetMenuHandler()
* Sets the menu event handler to another function.
*/
inline
void
SetMenuHandler
(
MENU_HANDLER
aMenuHandler
)
{
m_
customHandler
=
a
Handler
;
m_
menu_handler
=
aMenu
Handler
;
}
virtual
OPT_TOOL_EVENT
handleCustomEvent
(
const
wxMenuEvent
&
aEvent
)
/**
* Function SetUpdateHandler()
* Sets the update handler to a different function.
*/
inline
void
SetUpdateHandler
(
UPDATE_HANDLER
aUpdateHandler
)
{
return
OPT_TOOL_EVENT
()
;
m_update_handler
=
aUpdateHandler
;
}
private
:
// Empty stubs used by the default constructor
static
OPT_TOOL_EVENT
menuHandlerStub
(
const
wxMenuEvent
&
);
static
void
updateHandlerStub
();
/**
* Function
copyItem
*
Copies all properties of a menu entry to another
.
* Function
appendCopy
*
Appends a copy of wxMenuItem
.
*/
void
copyItem
(
const
wxMenuItem
*
aSource
,
wxMenuItem
*
aDest
)
const
;
wxMenuItem
*
appendCopy
(
const
wxMenuItem
*
aSource
)
;
///> Common part of copy constructor and assignment operator.
void
copyFrom
(
const
CONTEXT_MENU
&
aMenu
);
...
...
@@ -138,7 +161,7 @@ private:
///> Initializes handlers for events.
void
setupEvents
();
///>
E
vent handler.
///>
The default menu e
vent handler.
void
onMenuEvent
(
wxMenuEvent
&
aEvent
);
/**
...
...
@@ -148,30 +171,43 @@ private:
*/
void
setTool
(
TOOL_INTERACTIVE
*
aTool
);
///> Traverses the submenus tree looking for a submenu capable of handling a particular menu
///> event. In case it is handled, it is returned the aToolEvent parameter.
void
runEventHandlers
(
const
wxMenuEvent
&
aMenuEvent
,
OPT_TOOL_EVENT
&
aToolEvent
);
///> Runs a function on the menu and all its submenus.
void
runOnSubmenus
(
boost
::
function
<
void
(
CONTEXT_MENU
*
)
>
aFunction
);
///> Flag indicating that the menu title was set up.
bool
m_titleSet
;
///> Stores the id number of selected item.
int
m_selected
;
///> Instance of menu event handler.
//CMEventHandler m_handler;
///> Creator of the menu
TOOL_INTERACTIVE
*
m_tool
;
/// Menu items with ID higher than that are considered TOOL_ACTIONs
static
const
int
m_actionId
=
1
0000
;
///
>
Menu items with ID higher than that are considered TOOL_ACTIONs
static
const
int
ACTION_ID
=
3
0000
;
/// Associates tool actions with menu item IDs. Non-owning.
///
>
Associates tool actions with menu item IDs. Non-owning.
std
::
map
<
int
,
const
TOOL_ACTION
*>
m_toolActions
;
/// Custom events handler, allows to translate wxEvents to TOOL_EVENTs.
boost
::
function
<
OPT_TOOL_EVENT
(
const
wxMenuEvent
&
aEvent
)
>
m_customHandler
;
///> List of submenus.
std
::
list
<
CONTEXT_MENU
*>
m_submenus
;
///> Parent CONTEXT_MENU.
CONTEXT_MENU
*
m_parent
;
/// Optional icon
///
>
Optional icon
const
BITMAP_OPAQUE
*
m_icon
;
///> Optional callback to translate wxMenuEvents to TOOL_EVENTs.
MENU_HANDLER
m_menu_handler
;
///> Optional callback to update the menu state before it is displayed.
UPDATE_HANDLER
m_update_handler
;
friend
class
TOOL_INTERACTIVE
;
};
...
...
include/tool/tool_action.h
View file @
f261bf38
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* Copyright (C) 2013
-2015
CERN
* @author Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
...
...
@@ -41,7 +41,7 @@ struct BITMAP_OPAQUE;
* - running the DRC from the menu
* and so on, and so forth....
* Action class groups all necessary properties of an action, including explanation,
* icons, hotkeys,
.
menu items, etc.
* icons, hotkeys,
menu items, etc.
*/
class
TOOL_ACTION
{
...
...
@@ -49,10 +49,10 @@ public:
TOOL_ACTION
(
const
std
::
string
&
aName
,
TOOL_ACTION_SCOPE
aScope
=
AS_CONTEXT
,
int
aDefaultHotKey
=
0
,
const
wxString
aMenuItem
=
wxEmptyString
,
const
wxString
&
aMenuDesc
=
wxEmptyString
,
const
BITMAP_OPAQUE
*
aIcon
=
NULL
,
TOOL_ACTION_FLAGS
aFlags
=
AF_NONE
)
:
TOOL_ACTION_FLAGS
aFlags
=
AF_NONE
,
void
*
aParam
=
NULL
)
:
m_name
(
aName
),
m_scope
(
aScope
),
m_defaultHotKey
(
aDefaultHotKey
),
m_currentHotKey
(
aDefaultHotKey
),
m_menuItem
(
aMenuItem
),
m_
menuDescription
(
aMenuDesc
),
m_icon
(
aIcon
),
m_id
(
-
1
),
m_flags
(
aFlags
)
m_currentHotKey
(
aDefaultHotKey
),
m_menuItem
(
aMenuItem
),
m_menuDescription
(
aMenuDesc
),
m_
icon
(
aIcon
),
m_id
(
-
1
),
m_flags
(
aFlags
),
m_param
(
aParam
)
{
TOOL_MANAGER
::
GetActionList
().
push_back
(
this
);
}
...
...
@@ -150,11 +150,11 @@ public:
TOOL_EVENT
MakeEvent
()
const
{
if
(
IsActivation
()
)
return
TOOL_EVENT
(
TC_COMMAND
,
TA_ACTIVATE
,
m_name
,
m_scope
);
return
TOOL_EVENT
(
TC_COMMAND
,
TA_ACTIVATE
,
m_name
,
m_scope
,
m_param
);
else
if
(
IsNotification
()
)
return
TOOL_EVENT
(
TC_MESSAGE
,
TA_NONE
,
m_name
,
m_scope
);
return
TOOL_EVENT
(
TC_MESSAGE
,
TA_NONE
,
m_name
,
m_scope
,
m_param
);
else
return
TOOL_EVENT
(
TC_COMMAND
,
TA_ACTION
,
m_name
,
m_scope
);
return
TOOL_EVENT
(
TC_COMMAND
,
TA_ACTION
,
m_name
,
m_scope
,
m_param
);
}
const
wxString
&
GetMenuItem
()
const
...
...
@@ -219,7 +219,7 @@ private:
/// Name of the action (convention is: app.[tool.]action.name)
std
::
string
m_name
;
/// Scope of the action
(i.e. the event that is issued after activation).
/// Scope of the action
TOOL_ACTION_SCOPE
m_scope
;
/// Default hot key that activates the action.
...
...
@@ -243,11 +243,8 @@ private:
/// Action flags
TOOL_ACTION_FLAGS
m_flags
;
/// Origin of the action
// const TOOL_BASE* m_origin;
/// Originating UI object
// wxWindow* m_uiOrigin;
/// Generic parameter
void
*
m_param
;
};
#endif
include/tool/tool_base.h
View file @
f261bf38
...
...
@@ -140,6 +140,13 @@ public:
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
:
friend
class
TOOL_MANAGER
;
...
...
include/tool/tool_event.h
View file @
f261bf38
...
...
@@ -88,14 +88,19 @@ enum TOOL_ACTIONS
// closed it without selecting anything.
TA_CONTEXT_MENU_CHOICE
=
0x8000
,
// Context menu is closed, no matter whether anything has been chosen or not.
TA_CONTEXT_MENU_CLOSED
=
0x10000
,
TA_CONTEXT_MENU
=
TA_CONTEXT_MENU_UPDATE
|
TA_CONTEXT_MENU_CHOICE
|
TA_CONTEXT_MENU_CLOSED
,
// This event is sent *before* undo/redo command is performed.
TA_UNDO_REDO
=
0x
1
0000
,
TA_UNDO_REDO
=
0x
2
0000
,
// Tool action (allows to control tools).
TA_ACTION
=
0x
2
0000
,
TA_ACTION
=
0x
4
0000
,
// Tool activation event.
TA_ACTIVATE
=
0x
4
0000
,
TA_ACTIVATE
=
0x
8
0000
,
TA_ANY
=
0xffffffff
};
...
...
@@ -159,24 +164,24 @@ public:
const
std
::
string
Format
()
const
;
TOOL_EVENT
(
TOOL_EVENT_CATEGORY
aCategory
=
TC_NONE
,
TOOL_ACTIONS
aAction
=
TA_NONE
,
TOOL_ACTION_SCOPE
aScope
=
AS_GLOBAL
)
:
TOOL_ACTION_SCOPE
aScope
=
AS_GLOBAL
,
void
*
aParameter
=
NULL
)
:
m_category
(
aCategory
),
m_actions
(
aAction
),
m_scope
(
aScope
),
m_mouseButtons
(
0
),
m_keyCode
(
0
),
m_modifiers
(
0
),
m_param
(
NULL
)
{}
m_param
(
aParameter
)
{}
TOOL_EVENT
(
TOOL_EVENT_CATEGORY
aCategory
,
TOOL_ACTIONS
aAction
,
int
aExtraParam
,
TOOL_ACTION_SCOPE
aScope
=
AS_GLOBAL
)
:
TOOL_ACTION_SCOPE
aScope
=
AS_GLOBAL
,
void
*
aParameter
=
NULL
)
:
m_category
(
aCategory
),
m_actions
(
aAction
),
m_scope
(
aScope
),
m_mouseButtons
(
0
),
m_keyCode
(
0
),
m_modifiers
(
0
),
m_param
(
NULL
)
m_param
(
aParameter
)
{
if
(
aCategory
==
TC_MOUSE
)
{
...
...
@@ -198,14 +203,15 @@ public:
}
TOOL_EVENT
(
TOOL_EVENT_CATEGORY
aCategory
,
TOOL_ACTIONS
aAction
,
const
std
::
string
&
aExtraParam
,
TOOL_ACTION_SCOPE
aScope
=
AS_GLOBAL
)
:
const
std
::
string
&
aExtraParam
,
TOOL_ACTION_SCOPE
aScope
=
AS_GLOBAL
,
void
*
aParameter
=
NULL
)
:
m_category
(
aCategory
),
m_actions
(
aAction
),
m_scope
(
aScope
),
m_mouseButtons
(
0
),
m_keyCode
(
0
),
m_modifiers
(
0
),
m_param
(
NULL
)
m_param
(
aParameter
)
{
if
(
aCategory
==
TC_COMMAND
||
aCategory
==
TC_MESSAGE
)
m_commandStr
=
aExtraParam
;
...
...
@@ -360,9 +366,10 @@ public:
* Returns a non-standard parameter assigned to the event. Its meaning depends on the
* target tool.
*/
void
*
Parameter
()
const
template
<
typename
T
>
inline
T
Parameter
()
const
{
return
m_param
;
return
reinterpret_cast
<
T
>
(
m_param
)
;
}
/**
...
...
@@ -371,9 +378,10 @@ public:
* target tool.
* @param aParam is the new parameter.
*/
void
SetParameter
(
void
*
aParam
)
template
<
typename
T
>
void
SetParameter
(
T
aParam
)
{
m_param
=
aParam
;
m_param
=
(
void
*
)
aParam
;
}
boost
::
optional
<
int
>
GetCommandId
()
const
...
...
include/tool/tool_manager.h
View file @
f261bf38
...
...
@@ -110,7 +110,18 @@ public:
* depends on the action.
* @return False if the action was not found.
*/
bool
RunAction
(
const
std
::
string
&
aActionName
,
bool
aNow
=
false
,
void
*
aParam
=
NULL
);
template
<
typename
T
>
bool
RunAction
(
const
std
::
string
&
aActionName
,
bool
aNow
=
false
,
T
aParam
=
NULL
)
{
return
RunAction
(
aActionName
,
aNow
,
reinterpret_cast
<
void
*>
(
aParam
)
);
}
bool
RunAction
(
const
std
::
string
&
aActionName
,
bool
aNow
,
void
*
aParam
);
bool
RunAction
(
const
std
::
string
&
aActionName
,
bool
aNow
=
false
)
{
return
RunAction
(
aActionName
,
aNow
,
(
void
*
)
NULL
);
}
/**
* Function RunAction()
...
...
@@ -122,7 +133,18 @@ public:
* @param aParam is an optional parameter that might be used by the invoked action. Its meaning
* depends on the action.
*/
void
RunAction
(
const
TOOL_ACTION
&
aAction
,
bool
aNow
=
false
,
void
*
aParam
=
NULL
);
template
<
typename
T
>
void
RunAction
(
const
TOOL_ACTION
&
aAction
,
bool
aNow
=
false
,
T
aParam
=
NULL
)
{
RunAction
(
aAction
,
aNow
,
reinterpret_cast
<
void
*>
(
aParam
)
);
}
void
RunAction
(
const
TOOL_ACTION
&
aAction
,
bool
aNow
,
void
*
aParam
);
void
RunAction
(
const
TOOL_ACTION
&
aAction
,
bool
aNow
=
false
)
{
RunAction
(
aAction
,
aNow
,
(
void
*
)
NULL
);
}
/**
* Function FindTool()
...
...
include/view/view_controls.h
View file @
f261bf38
...
...
@@ -152,7 +152,6 @@ public:
*/
virtual
VECTOR2D
GetCursorPosition
()
const
=
0
;
/**
* Function ForceCursorPosition()
* Places the cursor immediately at a given point. Mouse movement is ignored.
...
...
@@ -182,6 +181,11 @@ public:
m_cursorCaptured
=
aEnabled
;
}
inline
bool
IsCursorPositionForced
()
const
{
return
m_forceCursorPosition
;
}
protected
:
/// Sets center for VIEW, takes into account panning boundaries.
void
setCenter
(
const
VECTOR2D
&
aCenter
);
...
...
include/view/view_item.h
View file @
f261bf38
...
...
@@ -203,10 +203,15 @@ public:
*/
virtual
void
ViewUpdate
(
int
aUpdateFlags
=
ALL
)
{
if
(
m_view
&&
m_requiredUpdate
==
NONE
)
m_view
->
MarkForUpdate
(
this
);
if
(
m_view
)
{
assert
(
aUpdateFlags
!=
NONE
);
if
(
m_requiredUpdate
==
NONE
)
m_view
->
MarkForUpdate
(
this
);
m_requiredUpdate
|=
aUpdateFlags
;
m_requiredUpdate
|=
aUpdateFlags
;
}
}
/**
...
...
include/wxBasePcbFrame.h
View file @
f261bf38
...
...
@@ -86,9 +86,6 @@ protected:
/// main window.
wxAuiToolBar
*
m_auxiliaryToolBar
;
TOOL_MANAGER
*
m_toolManager
;
TOOL_DISPATCHER
*
m_toolDispatcher
;
void
updateGridSelectBox
();
void
updateZoomSelectBox
();
virtual
void
unitsChangeRefresh
();
...
...
include/wxstruct.h
View file @
f261bf38
...
...
@@ -72,6 +72,8 @@ class PAGE_INFO;
class
PLOTTER
;
class
TITLE_BLOCK
;
class
MSG_PANEL_ITEM
;
class
TOOL_MANAGER
;
class
TOOL_DISPATCHER
;
enum
id_librarytype
{
...
...
pagelayout_editor/CMakeLists.txt
View file @
f261bf38
...
...
@@ -100,7 +100,6 @@ target_link_libraries( pl_editor_kiface
common
polygon
bitmaps
${
OPENGL_LIBRARIES
}
${
wxWidgets_LIBRARIES
}
${
GDI_PLUS_LIBRARIES
}
)
...
...
pcbnew/CMakeLists.txt
View file @
f261bf38
...
...
@@ -271,6 +271,7 @@ set( PCBNEW_CLASS_SRCS
tools/selection_tool.cpp
tools/selection_area.cpp
tools/selection_conditions.cpp
tools/conditional_menu.cpp
tools/bright_box.cpp
tools/edit_points.cpp
tools/edit_constraints.cpp
...
...
@@ -284,6 +285,9 @@ set( PCBNEW_CLASS_SRCS
tools/common_actions.cpp
tools/grid_helper.cpp
tools/tools_common.cpp
tools/grid_menu.cpp
tools/zoom_menu.cpp
)
set
(
PCBNEW_SRCS
${
PCBNEW_AUTOROUTER_SRCS
}
${
PCBNEW_CLASS_SRCS
}
${
PCBNEW_DIALOGS
}
)
...
...
@@ -413,11 +417,7 @@ if( KICAD_SCRIPTING_MODULES )
polygon
bitmaps
gal
${
GLEW_LIBRARIES
}
${
CAIRO_LIBRARIES
}
${
PIXMAN_LIBRARY
}
${
wxWidgets_LIBRARIES
}
${
OPENGL_LIBRARIES
}
${
GDI_PLUS_LIBRARIES
}
${
PYTHON_LIBRARIES
}
${
PCBNEW_EXTRA_LIBS
}
...
...
@@ -583,12 +583,8 @@ target_link_libraries( pcbnew_kiface
idf3
${
GITHUB_PLUGIN_LIBRARIES
}
${
wxWidgets_LIBRARIES
}
${
OPENGL_LIBRARIES
}
${
GDI_PLUS_LIBRARIES
}
${
PYTHON_LIBRARIES
}
${
GLEW_LIBRARIES
}
${
CAIRO_LIBRARIES
}
${
PIXMAN_LIBRARY
}
${
Boost_LIBRARIES
}
# must follow GITHUB
${
PCBNEW_EXTRA_LIBS
}
# -lrt must follow Boost
${
OPENMP_LIBRARIES
}
...
...
pcbnew/basepcbframe.cpp
View file @
f261bf38
...
...
@@ -96,8 +96,6 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
EDA_DRAW_FRAME
(
aKiway
,
aParent
,
aFrameType
,
aTitle
,
aPos
,
aSize
,
aStyle
,
aFrameName
)
{
m_Pcb
=
NULL
;
m_toolManager
=
NULL
;
m_toolDispatcher
=
NULL
;
m_Draw3DFrame
=
NULL
;
// Display Window in 3D mode (OpenGL)
m_UserGridSize
=
wxRealPoint
(
100.0
,
100.0
);
...
...
@@ -119,12 +117,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
PCB_BASE_FRAME
::~
PCB_BASE_FRAME
()
{
delete
m_Collector
;
delete
m_toolManager
;
delete
m_toolDispatcher
;
delete
m_Pcb
;
delete
GetGalCanvas
();
}
...
...
pcbnew/dialogs/dialog_set_grid.cpp
View file @
f261bf38
...
...
@@ -34,8 +34,10 @@
#include <pcbnew_id.h>
#include <dialog_set_grid_base.h>
#include <invoke_pcb_dialog.h>
#include <gal/graphics_abstraction_layer.h>
#include <class_draw_panel_gal.h>
#include <tool/tool_manager.h>
class
DIALOG_SET_GRID
:
public
DIALOG_SET_GRID_BASE
...
...
@@ -227,12 +229,12 @@ bool PCB_BASE_FRAME::InvokeDialogGrid()
if
(
screen
->
GetGridId
()
==
ID_POPUP_GRID_USER
)
screen
->
SetGrid
(
ID_POPUP_GRID_USER
);
if
(
IsGalCanvasActive
()
)
{
GetGalCanvas
()
->
GetGAL
()
->
SetGridSize
(
VECTOR2D
(
screen
->
GetGrid
().
m_Size
.
x
,
screen
->
GetGrid
().
m_Size
.
y
)
);
GetGalCanvas
()
->
GetView
()
->
MarkTargetDirty
(
KIGFX
::
TARGET_NONCACHED
);
}
// Notify GAL
TOOL_MANAGER
*
mgr
=
GetToolManager
();
if
(
mgr
&&
IsGalCanvasActive
()
)
mgr
->
RunAction
(
"common.Control.gridPreset"
,
true
,
ID_POPUP_GRID_USER
-
ID_POPUP_GRID_LEVEL_1000
);
m_canvas
->
Refresh
();
...
...
pcbnew/ratsnest_data.cpp
View file @
f261bf38
...
...
@@ -1182,9 +1182,10 @@ void RN_DATA::Recalculate( int aNet )
if
(
netCount
>
m_nets
.
size
()
)
m_nets
.
resize
(
netCount
);
if
(
aNet
<
0
)
// Recompute everything
if
(
aNet
<
0
&&
netCount
>
1
)
// Recompute everything
{
unsigned
int
i
;
#ifdef USE_OPENMP
#pragma omp parallel shared(netCount) private(i)
{
...
...
pcbnew/router/router_tool.cpp
View file @
f261bf38
...
...
@@ -96,8 +96,7 @@ public:
{
m_board
=
NULL
;
SetIcon
(
width_track_via_xpm
);
setCustomEventHandler
(
boost
::
bind
(
&
CONTEXT_TRACK_WIDTH_MENU
::
handleCustomEvent
,
this
,
_1
)
);
SetMenuHandler
(
boost
::
bind
(
&
CONTEXT_TRACK_WIDTH_MENU
::
EventHandler
,
this
,
_1
)
);
}
void
SetBoard
(
BOARD
*
aBoard
)
...
...
@@ -153,8 +152,7 @@ public:
}
}
protected
:
OPT_TOOL_EVENT
handleCustomEvent
(
const
wxMenuEvent
&
aEvent
)
OPT_TOOL_EVENT
EventHandler
(
const
wxMenuEvent
&
aEvent
)
{
#if ID_POPUP_PCB_SELECT_VIASIZE1 < ID_POPUP_PCB_SELECT_WIDTH1
#error You have changed event ids order, it breaks code. Check the source code for more details.
...
...
pcbnew/tools/common_actions.cpp
View file @
f261bf38
/*
* This program source code file is part of KiCad, a free EDA CAD application.
*
* Copyright (C) 2013 CERN
* Copyright (C) 2013
-2015
CERN
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
* This program is free software; you can redistribute it and/or
...
...
@@ -25,6 +25,7 @@
#include "common_actions.h"
#include <tool/action_manager.h>
#include <pcbnew_id.h>
#include <layers_id_colors_and_visibility.h>
#include <wx/defs.h>
// These members are static in class COMMON_ACTIONS: Build them here:
...
...
@@ -121,7 +122,7 @@ TOOL_ACTION COMMON_ACTIONS::flip( "pcbnew.InteractiveEdit.flip",
TOOL_ACTION
COMMON_ACTIONS
::
remove
(
"pcbnew.InteractiveEdit.remove"
,
AS_GLOBAL
,
WXK_DELETE
,
_
(
"Remove"
),
_
(
"Deletes selected item(s)"
),
delete_
track_
xpm
);
_
(
"Remove"
),
_
(
"Deletes selected item(s)"
),
delete_xpm
);
TOOL_ACTION
COMMON_ACTIONS
::
properties
(
"pcbnew.InteractiveEdit.properties"
,
AS_GLOBAL
,
'E'
,
...
...
@@ -180,28 +181,32 @@ TOOL_ACTION COMMON_ACTIONS::arcPosture( "pcbnew.InteractiveDrawing.arcPosture",
// View Controls
TOOL_ACTION
COMMON_ACTIONS
::
zoomIn
(
"
pcbnew
.Control.zoomIn"
,
TOOL_ACTION
COMMON_ACTIONS
::
zoomIn
(
"
common
.Control.zoomIn"
,
AS_GLOBAL
,
WXK_F1
,
"
"
,
""
);
"
Zoom In"
,
""
,
zoom_in_xpm
);
TOOL_ACTION
COMMON_ACTIONS
::
zoomOut
(
"
pcbnew
.Control.zoomOut"
,
TOOL_ACTION
COMMON_ACTIONS
::
zoomOut
(
"
common
.Control.zoomOut"
,
AS_GLOBAL
,
WXK_F2
,
"
"
,
""
);
"
Zoom Out"
,
""
,
zoom_out_xpm
);
TOOL_ACTION
COMMON_ACTIONS
::
zoomInCenter
(
"
pcbnew
.Control.zoomInCenter"
,
TOOL_ACTION
COMMON_ACTIONS
::
zoomInCenter
(
"
common
.Control.zoomInCenter"
,
AS_GLOBAL
,
0
,
""
,
""
);
TOOL_ACTION
COMMON_ACTIONS
::
zoomOutCenter
(
"
pcbnew
.Control.zoomOutCenter"
,
TOOL_ACTION
COMMON_ACTIONS
::
zoomOutCenter
(
"
common
.Control.zoomOutCenter"
,
AS_GLOBAL
,
0
,
""
,
""
);
TOOL_ACTION
COMMON_ACTIONS
::
zoomCenter
(
"
pcbnew
.Control.zoomCenter"
,
TOOL_ACTION
COMMON_ACTIONS
::
zoomCenter
(
"
common
.Control.zoomCenter"
,
AS_GLOBAL
,
WXK_F4
,
"
"
,
""
);
"
Center"
,
""
,
zoom_center_on_screen_xpm
);
TOOL_ACTION
COMMON_ACTIONS
::
zoomFitScreen
(
"
pcbnew
.Control.zoomFitScreen"
,
TOOL_ACTION
COMMON_ACTIONS
::
zoomFitScreen
(
"
common
.Control.zoomFitScreen"
,
AS_GLOBAL
,
WXK_HOME
,
"Zoom Auto"
,
""
,
zoom_fit_in_page_xpm
);
TOOL_ACTION
COMMON_ACTIONS
::
zoomPreset
(
"common.Control.zoomPreset"
,
AS_GLOBAL
,
0
,
""
,
""
);
...
...
@@ -246,35 +251,35 @@ TOOL_ACTION COMMON_ACTIONS::highContrastDec( "pcbnew.Control.highContrastDec",
// Layer control
TOOL_ACTION
COMMON_ACTIONS
::
layerTop
(
"pcbnew.Control.layerTop"
,
AS_GLOBAL
,
WXK_PAGEUP
,
""
,
""
);
""
,
""
,
NULL
,
AF_NONE
,
(
void
*
)
F_Cu
);
TOOL_ACTION
COMMON_ACTIONS
::
layerInner1
(
"pcbnew.Control.layerInner1"
,
AS_GLOBAL
,
WXK_F5
,
""
,
""
);
""
,
""
,
NULL
,
AF_NONE
,
(
void
*
)
In1_Cu
);
TOOL_ACTION
COMMON_ACTIONS
::
layerInner2
(
"pcbnew.Control.layerInner2"
,
AS_GLOBAL
,
WXK_F6
,
""
,
""
);
""
,
""
,
NULL
,
AF_NONE
,
(
void
*
)
In2_Cu
);
TOOL_ACTION
COMMON_ACTIONS
::
layerInner3
(
"pcbnew.Control.layerInner3"
,
AS_GLOBAL
,
WXK_F7
,
""
,
""
);
""
,
""
,
NULL
,
AF_NONE
,
(
void
*
)
In3_Cu
);
TOOL_ACTION
COMMON_ACTIONS
::
layerInner4
(
"pcbnew.Control.layerInner4"
,
AS_GLOBAL
,
WXK_F8
,
""
,
""
);
""
,
""
,
NULL
,
AF_NONE
,
(
void
*
)
In4_Cu
);
TOOL_ACTION
COMMON_ACTIONS
::
layerInner5
(
"pcbnew.Control.layerInner5"
,
AS_GLOBAL
,
WXK_F9
,
""
,
""
);
""
,
""
,
NULL
,
AF_NONE
,
(
void
*
)
In5_Cu
);
TOOL_ACTION
COMMON_ACTIONS
::
layerInner6
(
"pcbnew.Control.layerInner6"
,
AS_GLOBAL
,
WXK_F10
,
""
,
""
);
""
,
""
,
NULL
,
AF_NONE
,
(
void
*
)
In6_Cu
);
TOOL_ACTION
COMMON_ACTIONS
::
layerBottom
(
"pcbnew.Control.layerBottom"
,
AS_GLOBAL
,
WXK_PAGEDOWN
,
""
,
""
);
""
,
""
,
NULL
,
AF_NONE
,
(
void
*
)
B_Cu
);
TOOL_ACTION
COMMON_ACTIONS
::
layerNext
(
"pcbnew.Control.layerNext"
,
AS_GLOBAL
,
'+'
,
...
...
@@ -298,26 +303,29 @@ TOOL_ACTION COMMON_ACTIONS::layerChanged( "pcbnew.Control.layerChanged",
// Grid control
TOOL_ACTION
COMMON_ACTIONS
::
gridFast1
(
"
pcbnew
.Control.gridFast1"
,
TOOL_ACTION
COMMON_ACTIONS
::
gridFast1
(
"
common
.Control.gridFast1"
,
AS_GLOBAL
,
MD_ALT
+
int
(
'1'
),
""
,
""
);
TOOL_ACTION
COMMON_ACTIONS
::
gridFast2
(
"
pcbnew
.Control.gridFast2"
,
TOOL_ACTION
COMMON_ACTIONS
::
gridFast2
(
"
common
.Control.gridFast2"
,
AS_GLOBAL
,
MD_ALT
+
int
(
'2'
),
""
,
""
);
TOOL_ACTION
COMMON_ACTIONS
::
gridNext
(
"
pcbnew
.Control.gridNext"
,
TOOL_ACTION
COMMON_ACTIONS
::
gridNext
(
"
common
.Control.gridNext"
,
AS_GLOBAL
,
'`'
,
""
,
""
);
TOOL_ACTION
COMMON_ACTIONS
::
gridPrev
(
"
pcbnew
.Control.gridPrev"
,
TOOL_ACTION
COMMON_ACTIONS
::
gridPrev
(
"
common
.Control.gridPrev"
,
AS_GLOBAL
,
MD_CTRL
+
int
(
'`'
),
""
,
""
);
TOOL_ACTION
COMMON_ACTIONS
::
gridSetOrigin
(
"
pcbnew
.Control.gridSetOrigin"
,
TOOL_ACTION
COMMON_ACTIONS
::
gridSetOrigin
(
"
common
.Control.gridSetOrigin"
,
AS_GLOBAL
,
0
,
""
,
""
);
TOOL_ACTION
COMMON_ACTIONS
::
gridPreset
(
"common.Control.gridPreset"
,
AS_GLOBAL
,
0
,
""
,
""
);
// Track & via size control
TOOL_ACTION
COMMON_ACTIONS
::
trackWidthInc
(
"pcbnew.EditorControl.trackWidthInc"
,
...
...
pcbnew/tools/common_actions.h
View file @
f261bf38
...
...
@@ -188,6 +188,7 @@ public:
static
TOOL_ACTION
zoomOutCenter
;
static
TOOL_ACTION
zoomCenter
;
static
TOOL_ACTION
zoomFitScreen
;
static
TOOL_ACTION
zoomPreset
;
// Display modes
static
TOOL_ACTION
trackDisplayMode
;
...
...
@@ -222,6 +223,7 @@ public:
static
TOOL_ACTION
gridNext
;
static
TOOL_ACTION
gridPrev
;
static
TOOL_ACTION
gridSetOrigin
;
static
TOOL_ACTION
gridPreset
;
// Track & via size control
static
TOOL_ACTION
trackWidthInc
;
...
...
pcbnew/tools/drawing_tool.cpp
View file @
f261bf38
...
...
@@ -66,8 +66,6 @@ void DRAWING_TOOL::Reset( RESET_REASON aReason )
m_controls
=
getViewControls
();
m_board
=
getModel
<
BOARD
>
();
m_frame
=
getEditFrame
<
PCB_EDIT_FRAME
>
();
setTransitions
();
}
...
...
@@ -124,7 +122,6 @@ int DRAWING_TOOL::DrawLine( const TOOL_EVENT& aEvent )
}
}
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
...
...
@@ -172,7 +169,6 @@ int DRAWING_TOOL::DrawCircle( const TOOL_EVENT& aEvent )
}
}
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
...
...
@@ -220,7 +216,6 @@ int DRAWING_TOOL::DrawArc( const TOOL_EVENT& aEvent )
}
}
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
...
...
@@ -411,7 +406,6 @@ int DRAWING_TOOL::DrawDimension( const TOOL_EVENT& aEvent )
m_controls
->
CaptureCursor
(
false
);
m_view
->
Remove
(
&
preview
);
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
...
...
@@ -442,11 +436,7 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent )
const
std
::
list
<
BOARD_ITEM
*>&
list
=
dlg
.
GetImportedItems
();
if
(
dlgResult
!=
wxID_OK
||
m_board
->
m_Modules
==
NULL
||
list
.
empty
()
)
{
setTransitions
();
return
0
;
}
VECTOR2I
cursorPos
=
m_controls
->
GetCursorPosition
();
VECTOR2I
delta
=
cursorPos
-
(
*
list
.
begin
())
->
GetPosition
();
...
...
@@ -617,8 +607,6 @@ int DRAWING_TOOL::PlaceDXF( const TOOL_EVENT& aEvent )
m_controls
->
CaptureCursor
(
false
);
m_view
->
Remove
(
&
preview
);
setTransitions
();
return
0
;
}
...
...
@@ -663,7 +651,6 @@ int DRAWING_TOOL::SetAnchor( const TOOL_EVENT& aEvent )
m_controls
->
SetSnapping
(
false
);
m_controls
->
ShowCursor
(
false
);
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
...
...
@@ -1230,7 +1217,6 @@ int DRAWING_TOOL::drawZone( bool aKeepout )
m_controls
->
CaptureCursor
(
false
);
m_view
->
Remove
(
&
preview
);
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
...
...
@@ -1351,7 +1337,6 @@ int DRAWING_TOOL::placeTextModule()
m_controls
->
CaptureCursor
(
true
);
m_view
->
Remove
(
&
preview
);
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
...
...
@@ -1461,7 +1446,6 @@ int DRAWING_TOOL::placeTextPcb()
m_controls
->
CaptureCursor
(
false
);
m_view
->
Remove
(
&
preview
);
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
...
...
@@ -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
::
DrawCircle
,
COMMON_ACTIONS
::
drawCircle
.
MakeEvent
()
);
...
...
pcbnew/tools/drawing_tool.h
View file @
f261bf38
...
...
@@ -132,6 +132,9 @@ public:
m_editModules
=
aEnabled
;
}
///> Sets up handlers for various events.
void
SetTransitions
();
private
:
///> Starts drawing a selected shape (i.e. DRAWSEGMENT).
///> @param aShape is the type of created shape (@see STROKE_T).
...
...
@@ -176,9 +179,6 @@ private:
*/
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.
int
getSegmentWidth
(
unsigned
int
aLayer
)
const
;
...
...
pcbnew/tools/edit_tool.cpp
View file @
f261bf38
...
...
@@ -79,25 +79,23 @@ bool EDIT_TOOL::Init()
}
// Add context menu entries that are displayed when selection tool is active
m_selectionTool
->
AddMenu
Item
(
COMMON_ACTIONS
::
editActivate
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
AddMenu
Item
(
COMMON_ACTIONS
::
rotate
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
AddMenu
Item
(
COMMON_ACTIONS
::
flip
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
AddMenu
Item
(
COMMON_ACTIONS
::
remove
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
AddMenu
Item
(
COMMON_ACTIONS
::
properties
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
AddMenu
Item
(
COMMON_ACTIONS
::
moveExact
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
AddMenu
Item
(
COMMON_ACTIONS
::
duplicate
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
AddMenu
Item
(
COMMON_ACTIONS
::
createArray
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
GetMenu
().
Add
Item
(
COMMON_ACTIONS
::
editActivate
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
GetMenu
().
Add
Item
(
COMMON_ACTIONS
::
rotate
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
GetMenu
().
Add
Item
(
COMMON_ACTIONS
::
flip
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
GetMenu
().
Add
Item
(
COMMON_ACTIONS
::
remove
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
GetMenu
().
Add
Item
(
COMMON_ACTIONS
::
properties
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
GetMenu
().
Add
Item
(
COMMON_ACTIONS
::
moveExact
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
GetMenu
().
Add
Item
(
COMMON_ACTIONS
::
duplicate
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
GetMenu
().
Add
Item
(
COMMON_ACTIONS
::
createArray
,
SELECTION_CONDITIONS
::
NotEmpty
);
// Footprint actions
m_selectionTool
->
AddMenu
Item
(
COMMON_ACTIONS
::
editFootprintInFpEditor
,
SELECTION_CONDITIONS
::
OnlyType
(
PCB_MODULE_T
)
&&
SELECTION_CONDITIONS
::
Count
(
1
)
);
m_selectionTool
->
GetMenu
().
Add
Item
(
COMMON_ACTIONS
::
editFootprintInFpEditor
,
SELECTION_CONDITIONS
::
OnlyType
(
PCB_MODULE_T
)
&&
SELECTION_CONDITIONS
::
Count
(
1
)
);
m_offset
.
x
=
0
;
m_offset
.
y
=
0
;
setTransitions
();
return
true
;
}
...
...
@@ -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,
// try looking for the stuff under mouse cursor (i.e. Kicad old-style hover selection)
if
(
!
hoverSelection
(
selection
)
)
{
setTransitions
();
return
0
;
}
Activate
();
...
...
@@ -345,8 +340,6 @@ int EDIT_TOOL::Main( const TOOL_EVENT& aEvent )
controls
->
SetAutoPan
(
false
);
controls
->
ForceCursorPosition
(
false
);
setTransitions
();
return
0
;
}
...
...
@@ -357,11 +350,7 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
PCB_BASE_EDIT_FRAME
*
editFrame
=
getEditFrame
<
PCB_BASE_EDIT_FRAME
>
();
if
(
!
hoverSelection
(
selection
,
false
)
)
{
setTransitions
();
return
0
;
}
// Properties are displayed when there is only one item selected
if
(
selection
.
Size
()
==
1
)
...
...
@@ -398,8 +387,6 @@ int EDIT_TOOL::Properties( const TOOL_EVENT& aEvent )
item
->
SetFlags
(
flags
);
}
setTransitions
();
return
0
;
}
...
...
@@ -413,11 +400,7 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
bool
unselect
=
selection
.
Empty
();
if
(
!
hoverSelection
(
selection
)
)
{
setTransitions
();
return
0
;
}
wxPoint
rotatePoint
=
getModificationPoint
(
selection
);
...
...
@@ -453,7 +436,6 @@ int EDIT_TOOL::Rotate( const TOOL_EVENT& aEvent )
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
selectionClear
,
true
);
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
pointEditorUpdate
,
true
);
setTransitions
();
return
0
;
}
...
...
@@ -468,11 +450,7 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
bool
unselect
=
selection
.
Empty
();
if
(
!
hoverSelection
(
selection
)
)
{
setTransitions
();
return
0
;
}
wxPoint
flipPoint
=
getModificationPoint
(
selection
);
...
...
@@ -507,7 +485,6 @@ int EDIT_TOOL::Flip( const TOOL_EVENT& aEvent )
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
selectionClear
,
true
);
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
pointEditorUpdate
,
true
);
setTransitions
();
return
0
;
}
...
...
@@ -518,11 +495,7 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
const
SELECTION
&
selection
=
m_selectionTool
->
GetSelection
();
if
(
!
hoverSelection
(
selection
)
)
{
setTransitions
();
return
0
;
}
// Get a copy of the selected items set
PICKED_ITEMS_LIST
selectedItems
=
selection
.
items
;
...
...
@@ -544,8 +517,6 @@ int EDIT_TOOL::Remove( const TOOL_EVENT& aEvent )
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
setTransitions
();
return
0
;
}
...
...
@@ -655,11 +626,7 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
bool
unselect
=
selection
.
Empty
();
if
(
!
hoverSelection
(
selection
)
)
{
setTransitions
();
return
0
;
}
wxPoint
translation
;
double
rotation
=
0
;
...
...
@@ -705,8 +672,6 @@ int EDIT_TOOL::MoveExact( const TOOL_EVENT& aEvent )
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
pointEditorUpdate
,
true
);
}
setTransitions
();
return
0
;
}
...
...
@@ -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
if
(
!
hoverSelection
(
selection
)
)
{
setTransitions
();
return
0
;
}
// 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 )
// and re-enable undos
decUndoInhibit
();
setTransitions
();
return
0
;
}
...
...
@@ -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
if
(
!
hoverSelection
(
selection
)
)
{
setTransitions
();
return
0
;
}
bool
originalItemsModified
=
false
;
...
...
@@ -980,13 +937,12 @@ int EDIT_TOOL::CreateArray( const TOOL_EVENT& aEvent )
}
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
setTransitions
();
return
0
;
}
void
EDIT_TOOL
::
s
etTransitions
()
void
EDIT_TOOL
::
S
etTransitions
()
{
Go
(
&
EDIT_TOOL
::
Main
,
COMMON_ACTIONS
::
editActivate
.
MakeEvent
()
);
Go
(
&
EDIT_TOOL
::
Rotate
,
COMMON_ACTIONS
::
rotate
.
MakeEvent
()
);
...
...
@@ -1125,6 +1081,5 @@ int EDIT_TOOL::editFootprintInFpEditor( const TOOL_EVENT& aEvent )
editor
->
Show
(
true
);
editor
->
Raise
();
// Iconize( false );
setTransitions
();
return
0
;
}
pcbnew/tools/edit_tool.h
View file @
f261bf38
...
...
@@ -126,6 +126,9 @@ public:
m_editModules
=
aEnabled
;
}
///> Sets up handlers for various events.
void
SetTransitions
();
private
:
///> Selection tool used for obtaining selected items
SELECTION_TOOL
*
m_selectionTool
;
...
...
@@ -149,9 +152,6 @@ private:
///> Removes and frees a single BOARD_ITEM.
void
remove
(
BOARD_ITEM
*
aItem
);
///> Sets up handlers for various events.
void
setTransitions
();
///> The required update flag for modified items
KIGFX
::
VIEW_ITEM
::
VIEW_UPDATE_FLAGS
m_updateFlag
;
...
...
pcbnew/tools/module_tools.cpp
View file @
f261bf38
...
...
@@ -74,9 +74,7 @@ bool MODULE_TOOLS::Init()
return
false
;
}
selectionTool
->
AddMenuItem
(
COMMON_ACTIONS
::
enumeratePads
);
setTransitions
();
selectionTool
->
GetMenu
().
AddItem
(
COMMON_ACTIONS
::
enumeratePads
);
return
true
;
}
...
...
@@ -170,7 +168,6 @@ int MODULE_TOOLS::PlacePad( const TOOL_EVENT& aEvent )
m_controls
->
SetAutoPan
(
false
);
m_view
->
Remove
(
&
preview
);
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
...
...
@@ -200,11 +197,7 @@ int MODULE_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
DIALOG_ENUM_PADS
settingsDlg
(
m_frame
);
if
(
settingsDlg
.
ShowModal
()
==
wxID_CANCEL
)
{
setTransitions
();
return
0
;
}
int
padNumber
=
settingsDlg
.
GetStartNumber
();
wxString
padPrefix
=
settingsDlg
.
GetPrefix
();
...
...
@@ -312,8 +305,6 @@ int MODULE_TOOLS::EnumeratePads( const TOOL_EVENT& aEvent )
m_frame
->
DisplayToolMsg
(
wxEmptyString
);
m_controls
->
ShowCursor
(
false
);
setTransitions
();
return
0
;
}
...
...
@@ -384,8 +375,6 @@ int MODULE_TOOLS::CopyItems( const TOOL_EVENT& aEvent )
m_controls
->
ShowCursor
(
false
);
m_controls
->
SetAutoPan
(
false
);
setTransitions
();
return
0
;
}
...
...
@@ -406,8 +395,6 @@ int MODULE_TOOLS::PasteItems( const TOOL_EVENT& aEvent )
catch
(
...
)
{
m_frame
->
DisplayToolMsg
(
_
(
"Invalid clipboard contents"
)
);
setTransitions
();
return
0
;
}
...
...
@@ -516,8 +503,6 @@ int MODULE_TOOLS::PasteItems( const TOOL_EVENT& aEvent )
m_controls
->
SetAutoPan
(
false
);
m_view
->
Remove
(
&
preview
);
setTransitions
();
return
0
;
}
...
...
@@ -553,7 +538,6 @@ int MODULE_TOOLS::ModuleTextOutlines( const TOOL_EVENT& aEvent )
}
m_frame
->
GetGalCanvas
()
->
Refresh
();
setTransitions
();
return
0
;
}
...
...
@@ -585,13 +569,12 @@ int MODULE_TOOLS::ModuleEdgeOutlines( const TOOL_EVENT& aEvent )
}
m_frame
->
GetGalCanvas
()
->
Refresh
();
setTransitions
();
return
0
;
}
void
MODULE_TOOLS
::
s
etTransitions
()
void
MODULE_TOOLS
::
S
etTransitions
()
{
Go
(
&
MODULE_TOOLS
::
PlacePad
,
COMMON_ACTIONS
::
placePad
.
MakeEvent
()
);
Go
(
&
MODULE_TOOLS
::
EnumeratePads
,
COMMON_ACTIONS
::
enumeratePads
.
MakeEvent
()
);
...
...
pcbnew/tools/module_tools.h
View file @
f261bf38
...
...
@@ -98,10 +98,10 @@ public:
*/
int
ModuleEdgeOutlines
(
const
TOOL_EVENT
&
aEvent
);
private
:
///> Sets up handlers for various events.
void
s
etTransitions
();
void
S
etTransitions
();
private
:
KIGFX
::
VIEW
*
m_view
;
KIGFX
::
VIEW_CONTROLS
*
m_controls
;
BOARD
*
m_board
;
...
...
pcbnew/tools/pcb_editor_control.cpp
View file @
f261bf38
...
...
@@ -74,12 +74,10 @@ bool PCB_EDITOR_CONTROL::Init()
if
(
selTool
)
{
selTool
->
AddSubMenu
(
new
ZONE_CONTEXT_MENU
,
_
(
"Zones"
)
,
SELECTION_CONDITIONS
::
OnlyType
(
PCB_ZONE_AREA_T
)
);
selTool
->
GetMenu
().
AddMenu
(
new
ZONE_CONTEXT_MENU
,
_
(
"Zones"
),
false
,
SELECTION_CONDITIONS
::
OnlyType
(
PCB_ZONE_AREA_T
)
);
}
setTransitions
();
return
true
;
}
...
...
@@ -98,8 +96,6 @@ int PCB_EDITOR_CONTROL::TrackWidthInc( const TOOL_EVENT& aEvent )
wxUpdateUIEvent
dummy
;
m_frame
->
OnUpdateSelectTrackWidth
(
dummy
);
setTransitions
();
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
trackViaSizeChanged
);
return
0
;
...
...
@@ -119,8 +115,6 @@ int PCB_EDITOR_CONTROL::TrackWidthDec( const TOOL_EVENT& aEvent )
wxUpdateUIEvent
dummy
;
m_frame
->
OnUpdateSelectTrackWidth
(
dummy
);
setTransitions
();
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
trackViaSizeChanged
);
return
0
;
...
...
@@ -140,8 +134,6 @@ int PCB_EDITOR_CONTROL::ViaSizeInc( const TOOL_EVENT& aEvent )
wxUpdateUIEvent
dummy
;
m_frame
->
OnUpdateSelectViaSize
(
dummy
);
setTransitions
();
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
trackViaSizeChanged
);
return
0
;
...
...
@@ -161,8 +153,6 @@ int PCB_EDITOR_CONTROL::ViaSizeDec( const TOOL_EVENT& aEvent )
wxUpdateUIEvent
dummy
;
m_frame
->
OnUpdateSelectViaSize
(
dummy
);
setTransitions
();
m_toolMgr
->
RunAction
(
COMMON_ACTIONS
::
trackViaSizeChanged
);
return
0
;
...
...
@@ -277,7 +267,6 @@ int PCB_EDITOR_CONTROL::PlaceModule( const TOOL_EVENT& aEvent )
controls
->
CaptureCursor
(
false
);
view
->
Remove
(
&
preview
);
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
...
...
@@ -370,7 +359,6 @@ int PCB_EDITOR_CONTROL::PlaceTarget( const TOOL_EVENT& aEvent )
controls
->
CaptureCursor
(
false
);
view
->
Remove
(
&
preview
);
setTransitions
();
m_frame
->
SetToolID
(
ID_NO_TOOL_SELECTED
,
wxCURSOR_DEFAULT
,
wxEmptyString
);
return
0
;
...
...
@@ -393,8 +381,6 @@ int PCB_EDITOR_CONTROL::ZoneFill( const TOOL_EVENT& aEvent )
zone
->
ViewUpdate
();
}
setTransitions
();
return
0
;
}
...
...
@@ -411,8 +397,6 @@ int PCB_EDITOR_CONTROL::ZoneFillAll( const TOOL_EVENT& aEvent )
zone
->
ViewUpdate
();
}
setTransitions
();
return
0
;
}
...
...
@@ -432,8 +416,6 @@ int PCB_EDITOR_CONTROL::ZoneUnfill( const TOOL_EVENT& aEvent )
zone
->
ViewUpdate
();
}
setTransitions
();
return
0
;
}
...
...
@@ -450,8 +432,6 @@ int PCB_EDITOR_CONTROL::ZoneUnfillAll( const TOOL_EVENT& aEvent )
zone
->
ViewUpdate
();
}
setTransitions
();
return
0
;
}
...
...
@@ -464,13 +444,11 @@ int PCB_EDITOR_CONTROL::SelectionCrossProbe( const TOOL_EVENT& aEvent )
if
(
selection
.
Size
()
==
1
)
m_frame
->
SendMessageToEESCHEMA
(
selection
.
Item
<
BOARD_ITEM
>
(
0
)
);
setTransitions
();
return
0
;
}
void
PCB_EDITOR_CONTROL
::
s
etTransitions
()
void
PCB_EDITOR_CONTROL
::
S
etTransitions
()
{
// Track & via size control
Go
(
&
PCB_EDITOR_CONTROL
::
TrackWidthInc
,
COMMON_ACTIONS
::
trackWidthInc
.
MakeEvent
()
);
...
...
pcbnew/tools/pcb_editor_control.h
View file @
f261bf38
...
...
@@ -72,10 +72,10 @@ public:
///> Notifies eeschema about the selected item.
int
SelectionCrossProbe
(
const
TOOL_EVENT
&
aEvent
);
private
:
///> Sets up handlers for various events.
void
s
etTransitions
();
void
S
etTransitions
();
private
:
///> Pointer to the currently used edit frame.
PCB_EDIT_FRAME
*
m_frame
;
...
...
pcbnew/tools/pcbnew_control.cpp
View file @
f261bf38
This diff is collapsed.
Click to expand it.
pcbnew/tools/pcbnew_control.h
View file @
f261bf38
...
...
@@ -43,14 +43,12 @@ public:
/// @copydoc TOOL_INTERACTIVE::Reset()
void
Reset
(
RESET_REASON
aReason
);
/// @copydoc TOOL_INTERACTIVE::Init()
bool
Init
();
// View controls
int
ZoomInOut
(
const
TOOL_EVENT
&
aEvent
);
int
ZoomInOutCenter
(
const
TOOL_EVENT
&
aEvent
);
int
ZoomCenter
(
const
TOOL_EVENT
&
aEvent
);
int
ZoomFitScreen
(
const
TOOL_EVENT
&
aEvent
);
int
ZoomPreset
(
const
TOOL_EVENT
&
aEvent
);
// Display modes
int
TrackDisplayMode
(
const
TOOL_EVENT
&
aEvent
);
...
...
@@ -74,6 +72,7 @@ public:
int
GridNext
(
const
TOOL_EVENT
&
aEvent
);
int
GridPrev
(
const
TOOL_EVENT
&
aEvent
);
int
GridSetOrigin
(
const
TOOL_EVENT
&
aEvent
);
int
GridPreset
(
const
TOOL_EVENT
&
aEvent
);
// Miscellaneous
int
ResetCoords
(
const
TOOL_EVENT
&
aEvent
);
...
...
@@ -82,10 +81,10 @@ public:
int
ShowHelp
(
const
TOOL_EVENT
&
aEvent
);
int
ToBeDone
(
const
TOOL_EVENT
&
aEvent
);
private
:
///> Sets up handlers for various events.
void
s
etTransitions
();
void
S
etTransitions
();
private
:
///> Pointer to the currently used edit frame.
PCB_BASE_FRAME
*
m_frame
;
};
...
...
pcbnew/tools/placement_tool.cpp
View file @
f261bf38
...
...
@@ -63,10 +63,8 @@ bool PLACEMENT_TOOL::Init()
menu
->
AppendSeparator
();
menu
->
Add
(
COMMON_ACTIONS
::
distributeHorizontally
);
menu
->
Add
(
COMMON_ACTIONS
::
distributeVertically
);
m_selectionTool
->
AddSubMenu
(
menu
,
_
(
"Align/distribute"
),
SELECTION_CONDITIONS
::
MoreThan
(
1
)
);
setTransitions
();
m_selectionTool
->
GetMenu
().
AddMenu
(
menu
,
_
(
"Align/distribute"
),
false
,
SELECTION_CONDITIONS
::
MoreThan
(
1
)
);
return
true
;
}
...
...
@@ -109,8 +107,6 @@ int PLACEMENT_TOOL::AlignTop( const TOOL_EVENT& aEvent )
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
}
setTransitions
();
return
0
;
}
...
...
@@ -152,8 +148,6 @@ int PLACEMENT_TOOL::AlignBottom( const TOOL_EVENT& aEvent )
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
}
setTransitions
();
return
0
;
}
...
...
@@ -195,8 +189,6 @@ int PLACEMENT_TOOL::AlignLeft( const TOOL_EVENT& aEvent )
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
}
setTransitions
();
return
0
;
}
...
...
@@ -238,8 +230,6 @@ int PLACEMENT_TOOL::AlignRight( const TOOL_EVENT& aEvent )
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
}
setTransitions
();
return
0
;
}
...
...
@@ -299,8 +289,6 @@ int PLACEMENT_TOOL::DistributeHorizontally( const TOOL_EVENT& aEvent )
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
}
setTransitions
();
return
0
;
}
...
...
@@ -348,13 +336,11 @@ int PLACEMENT_TOOL::DistributeVertically( const TOOL_EVENT& aEvent )
getModel
<
BOARD
>
()
->
GetRatsnest
()
->
Recalculate
();
}
setTransitions
();
return
0
;
}
void
PLACEMENT_TOOL
::
s
etTransitions
()
void
PLACEMENT_TOOL
::
S
etTransitions
()
{
Go
(
&
PLACEMENT_TOOL
::
AlignTop
,
COMMON_ACTIONS
::
alignTop
.
MakeEvent
()
);
Go
(
&
PLACEMENT_TOOL
::
AlignBottom
,
COMMON_ACTIONS
::
alignBottom
.
MakeEvent
()
);
...
...
pcbnew/tools/placement_tool.h
View file @
f261bf38
...
...
@@ -77,10 +77,10 @@ public:
*/
int
DistributeVertically
(
const
TOOL_EVENT
&
aEvent
);
private
:
///> Sets up handlers for various events.
void
s
etTransitions
();
void
S
etTransitions
();
private
:
SELECTION_TOOL
*
m_selectionTool
;
};
...
...
pcbnew/tools/point_editor.cpp
View file @
f261bf38
...
...
@@ -210,10 +210,8 @@ bool POINT_EDITOR::Init()
return
false
;
}
m_selectionTool
->
AddMenuItem
(
COMMON_ACTIONS
::
pointEditorBreakOutline
,
POINT_EDITOR
::
breakOutlineCondition
);
setTransitions
();
m_selectionTool
->
GetMenu
().
AddItem
(
COMMON_ACTIONS
::
pointEditorBreakOutline
,
POINT_EDITOR
::
breakOutlineCondition
);
return
true
;
}
...
...
@@ -233,11 +231,9 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
EDA_ITEM
*
item
=
selection
.
items
.
GetPickedItem
(
0
);
m_editPoints
=
EDIT_POINTS_FACTORY
::
Make
(
item
,
getView
()
->
GetGAL
()
);
if
(
!
m_editPoints
)
{
setTransitions
();
return
0
;
}
view
->
Add
(
m_editPoints
.
get
()
);
m_dragPoint
=
NULL
;
...
...
@@ -363,8 +359,6 @@ int POINT_EDITOR::OnSelectionChange( const TOOL_EVENT& aEvent )
controls
->
ForceCursorPosition
(
false
);
}
setTransitions
();
return
0
;
}
...
...
@@ -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
::
UnselectedEvent
);
...
...
pcbnew/tools/point_editor.h
View file @
f261bf38
...
...
@@ -55,6 +55,9 @@ public:
*/
int
OnSelectionChange
(
const
TOOL_EVENT
&
aEvent
);
///> Sets up handlers for various events.
void
SetTransitions
();
private
:
///> Selection tool used for obtaining selected items
SELECTION_TOOL
*
m_selectionTool
;
...
...
@@ -98,9 +101,6 @@ private:
///> Adds a new edit point on a zone outline/line.
void
breakOutline
(
const
VECTOR2I
&
aBreakPoint
);
///> Sets up handlers for various events.
void
setTransitions
();
///> Condition to display "Create corner" context menu entry.
static
bool
breakOutlineCondition
(
const
SELECTION
&
aSelection
);
};
...
...
pcbnew/tools/selection_tool.cpp
View file @
f261bf38
This diff is collapsed.
Click to expand it.
pcbnew/tools/selection_tool.h
View file @
f261bf38
...
...
@@ -32,6 +32,7 @@
#include <class_undoredo_container.h>
#include "selection_conditions.h"
#include "conditional_menu.h"
class
PCB_BASE_FRAME
;
class
SELECTION_AREA
;
...
...
@@ -104,7 +105,10 @@ public:
SELECTION_TOOL
();
~
SELECTION_TOOL
();
/// @copydoc TOOL_INTERACTIVE::Reset()
/// @copydoc TOOL_BASE::Init()
bool
Init
();
/// @copydoc TOOL_BASE::Reset()
void
Reset
(
RESET_REASON
aReason
);
/**
...
...
@@ -119,32 +123,13 @@ public:
*
* Returns the set of currently selected items.
*/
const
SELECTION
&
GetSelection
()
const
inline
const
SELECTION
&
GetSelection
()
{
// The selected items list has been requested, so it is no longer preliminary
m_preliminary
=
false
;
return
m_selection
;
}
/**
* Function AddMenuItem()
*
* Adds a menu entry to run a TOOL_ACTION on selected items.
* @param aAction is a menu entry to be added.
* @param aCondition is a condition that has to be fulfilled to enable the menu entry.
*/
void
AddMenuItem
(
const
TOOL_ACTION
&
aAction
,
const
SELECTION_CONDITION
&
aCondition
=
SELECTION_CONDITIONS
::
ShowAlways
);
/**
* Function AddSubMenu()
*
* Adds a submenu to the selection tool right-click context menu.
* @param aMenu is the submenu to be added.
* @param aLabel is the label of added submenu.
* @param aCondition is a condition that has to be fulfilled to enable the submenu entry.
*/
void
AddSubMenu
(
CONTEXT_MENU
*
aMenu
,
const
wxString
&
aLabel
,
const
SELECTION_CONDITION
&
aCondition
=
SELECTION_CONDITIONS
::
ShowAlways
);
/**
* Function EditModules()
*
...
...
@@ -152,11 +137,16 @@ public:
* (graphics, pads, etc.), so they can be modified.
* @param aEnabled decides if the mode should be enabled.
*/
void
EditModules
(
bool
aEnabled
)
inline
void
EditModules
(
bool
aEnabled
)
{
m_editModules
=
aEnabled
;
}
inline
CONDITIONAL_MENU
&
GetMenu
()
{
return
m_menu
;
}
///> Checks if the user has agreed to modify locked items for the given selection.
SELECTION_LOCK_FLAGS
CheckLock
();
...
...
@@ -166,8 +156,8 @@ public:
///> Clear current selection event handler.
int
ClearSelection
(
const
TOOL_EVENT
&
aEvent
);
///> Makes sure a group selection does not contain items that would cause
///> conflicts when moving/rotating together (e.g. a footprint and one of the same footprint's pads)
///> Makes sure a group selection does not contain items that would cause
///> conflicts when moving/rotating together (e.g. a footprint and one of the same footprint's pads)
bool
SanitizeSelection
();
///> Item selection event handler.
...
...
@@ -185,6 +175,9 @@ public:
///> Event sent after selection is cleared.
static
const
TOOL_EVENT
ClearedEvent
;
///> Sets up handlers for various events.
void
SetTransitions
();
private
:
/**
* Function selectCursor()
...
...
@@ -221,9 +214,6 @@ private:
///> Find an item and start moving.
int
findMove
(
const
TOOL_EVENT
&
aEvent
);
///> Sets up handlers for various events.
void
setTransitions
();
/**
* Function clearSelection()
* Clears the current selection.
...
...
@@ -317,19 +307,9 @@ private:
*/
void
guessSelectionCandidates
(
GENERAL_COLLECTOR
&
aCollector
)
const
;
/**
* Function generateMenu()
* Creates a copy of context menu that is filtered by menu conditions and displayed to
* the user.
*/
void
generateMenu
();
/// Pointer to the parent frame.
PCB_BASE_FRAME
*
m_frame
;
/// Visual representation of selection box.
SELECTION_AREA
*
m_selArea
;
/// Current state of selection.
SELECTION
m_selection
;
...
...
@@ -339,20 +319,17 @@ private:
/// Flag saying if multiple selection mode is active.
bool
m_multiple
;
/// Right click popup menu (master instance).
CONTEXT_MENU
m_menu
;
/// Copy of the context menu that is filtered by menu conditions and displayed to the user.
CONTEXT_MENU
m_menuCopy
;
/// Edit module mode flag.
bool
m_editModules
;
/// Can other tools modify locked items.
bool
m_locked
;
/// Conditions for specific context menu entries.
std
::
deque
<
SELECTION_CONDITION
>
m_menuConditions
;
/// Determines if the selection is preliminary or final.
bool
m_preliminary
;
/// Menu displayed by the tool.
CONDITIONAL_MENU
m_menu
;
};
#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