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
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
...
@@ -31,6 +31,8 @@ install_manifest.txt
Documentation/doxygen
Documentation/doxygen
Documentation/development/doxygen
Documentation/development/doxygen
*.bak
*.bak
.*.swp
*.~*
common/pcb_plot_params_keywords.cpp
common/pcb_plot_params_keywords.cpp
include/pcb_plot_params_lexer.h
include/pcb_plot_params_lexer.h
pcbnew/specctra_keywords.cpp
pcbnew/specctra_keywords.cpp
...
...
common/CMakeLists.txt
View file @
f261bf38
...
@@ -56,9 +56,14 @@ set( GAL_SRCS
...
@@ -56,9 +56,14 @@ set( GAL_SRCS
add_library
(
gal STATIC
${
GAL_SRCS
}
)
add_library
(
gal STATIC
${
GAL_SRCS
}
)
add_dependencies
(
gal shader_headers
)
add_dependencies
(
gal shader_headers
)
add_dependencies
(
gal lib-dependencies
)
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
# Only for win32 cross compilation using MXE
...
@@ -247,7 +252,7 @@ set( COMMON_SRCS
...
@@ -247,7 +252,7 @@ set( COMMON_SRCS
)
)
add_library
(
common STATIC
${
COMMON_SRCS
}
)
add_library
(
common STATIC
${
COMMON_SRCS
}
)
add_dependencies
(
common lib-dependencies
)
add_dependencies
(
common lib-dependencies
)
target_link_libraries
(
common
${
Boost_LIBRARIES
}
)
set
(
PCB_COMMON_SRCS
set
(
PCB_COMMON_SRCS
base_screen.cpp
base_screen.cpp
...
...
common/draw_frame.cpp
View file @
f261bf38
...
@@ -51,6 +51,8 @@
...
@@ -51,6 +51,8 @@
#include <view/view.h>
#include <view/view.h>
#include <view/view_controls.h>
#include <view/view_controls.h>
#include <gal/graphics_abstraction_layer.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
* 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,
...
@@ -110,6 +112,8 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
m_canvas
=
NULL
;
m_canvas
=
NULL
;
m_galCanvas
=
NULL
;
m_galCanvas
=
NULL
;
m_galCanvasActive
=
false
;
m_galCanvasActive
=
false
;
m_toolManager
=
NULL
;
m_toolDispatcher
=
NULL
;
m_messagePanel
=
NULL
;
m_messagePanel
=
NULL
;
m_currentScreen
=
NULL
;
m_currentScreen
=
NULL
;
m_toolId
=
ID_NO_TOOL_SELECTED
;
m_toolId
=
ID_NO_TOOL_SELECTED
;
...
@@ -180,6 +184,10 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
...
@@ -180,6 +184,10 @@ EDA_DRAW_FRAME::EDA_DRAW_FRAME( KIWAY* aKiway, wxWindow* aParent,
EDA_DRAW_FRAME
::~
EDA_DRAW_FRAME
()
EDA_DRAW_FRAME
::~
EDA_DRAW_FRAME
()
{
{
delete
m_toolManager
;
delete
m_toolDispatcher
;
delete
m_galCanvas
;
delete
m_currentScreen
;
delete
m_currentScreen
;
m_currentScreen
=
NULL
;
m_currentScreen
=
NULL
;
...
@@ -379,47 +387,17 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
...
@@ -379,47 +387,17 @@ void EDA_DRAW_FRAME::OnSelectGrid( wxCommandEvent& event )
else
else
{
{
eventId
=
event
.
GetId
();
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.
int
idx
=
eventId
-
ID_POPUP_GRID_LEVEL_1000
;
m_LastGridSizeId
=
eventId
-
ID_POPUP_GRID_LEVEL_1000
;
BASE_SCREEN
*
screen
=
GetScreen
();
if
(
screen
->
GetGridId
()
==
eventId
)
return
;
/*
// Notify GAL
* This allows for saving non-sequential command ID offsets used that
TOOL_MANAGER
*
mgr
=
GetToolManager
();
* may be used in the grid size combobox. Do not use the selection
* index returned by GetSelection().
*/
screen
->
SetGrid
(
eventId
);
SetCrossHairPosition
(
RefPos
(
true
)
);
if
(
IsGalCanvasActive
()
)
if
(
mgr
&&
IsGalCanvasActive
()
)
{
mgr
->
RunAction
(
"common.Control.gridPreset"
,
true
,
idx
);
GetGalCanvas
()
->
GetGAL
()
->
SetGridSize
(
VECTOR2D
(
screen
->
GetGrid
().
m_Size
.
x
,
else
screen
->
GetGrid
().
m_Size
.
y
)
);
SetPresetGrid
(
idx
);
GetGalCanvas
()
->
GetView
()
->
MarkTargetDirty
(
KIGFX
::
TARGET_NONCACHED
);
}
m_canvas
->
Refresh
();
m_canvas
->
Refresh
();
}
}
...
@@ -448,22 +426,14 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
...
@@ -448,22 +426,14 @@ void EDA_DRAW_FRAME::OnSelectZoom( wxCommandEvent& event )
return
;
return
;
GetScreen
()
->
SetZoom
(
selectedZoom
);
GetScreen
()
->
SetZoom
(
selectedZoom
);
RedrawScreen
(
GetScrollCenterPosition
(),
false
);
}
if
(
IsGalCanvasActive
()
)
// Notify GAL
{
TOOL_MANAGER
*
mgr
=
GetToolManager
();
// 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
()
);
view
->
SetScale
(
zoom
);
if
(
mgr
&&
IsGalCanvasActive
()
)
GetGalCanvas
()
->
Refresh
();
mgr
->
RunAction
(
"common.Control.zoomPreset"
,
true
,
id
);
}
else
RedrawScreen
(
GetScrollCenterPosition
(),
false
);
}
}
}
...
@@ -557,14 +527,7 @@ wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const
...
@@ -557,14 +527,7 @@ wxPoint EDA_DRAW_FRAME::GetGridPosition( const wxPoint& aPosition ) const
void
EDA_DRAW_FRAME
::
SetNextGrid
()
void
EDA_DRAW_FRAME
::
SetNextGrid
()
{
{
if
(
m_gridSelectBox
)
if
(
m_gridSelectBox
)
{
SetPresetGrid
(
(
m_gridSelectBox
->
GetSelection
()
+
1
)
%
m_gridSelectBox
->
GetCount
()
);
m_gridSelectBox
->
SetSelection
(
(
m_gridSelectBox
->
GetSelection
()
+
1
)
%
m_gridSelectBox
->
GetCount
()
);
wxCommandEvent
cmd
(
wxEVT_COMMAND_COMBOBOX_SELECTED
);
// cmd.SetEventObject( this );
OnSelectGrid
(
cmd
);
}
}
}
...
@@ -572,17 +535,31 @@ void EDA_DRAW_FRAME::SetPrevGrid()
...
@@ -572,17 +535,31 @@ void EDA_DRAW_FRAME::SetPrevGrid()
{
{
if
(
m_gridSelectBox
)
if
(
m_gridSelectBox
)
{
{
int
cnt
=
m_gridSelectBox
->
GetSelection
();
int
idx
=
m_gridSelectBox
->
GetSelection
();
if
(
--
idx
<
0
)
idx
=
m_gridSelectBox
->
GetCount
()
-
1
;
if
(
--
cnt
<
0
)
SetPresetGrid
(
idx
);
cnt
=
m_gridSelectBox
->
GetCount
()
-
1
;
}
}
m_gridSelectBox
->
SetSelection
(
cnt
);
wxCommandEvent
cmd
(
wxEVT_COMMAND_COMBOBOX_SELECTED
);
void
EDA_DRAW_FRAME
::
SetPresetGrid
(
int
aIndex
)
// cmd.SetEventObject( this );
{
OnSelectGrid
(
cmd
);
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 )
...
@@ -1018,38 +995,29 @@ void EDA_DRAW_FRAME::UseGalCanvas( bool aEnable )
KIGFX
::
GAL
*
gal
=
GetGalCanvas
()
->
GetGAL
();
KIGFX
::
GAL
*
gal
=
GetGalCanvas
()
->
GetGAL
();
double
zoomFactor
=
gal
->
GetWorldScale
()
/
gal
->
GetZoomFactor
();
double
zoomFactor
=
gal
->
GetWorldScale
()
/
gal
->
GetZoomFactor
();
BASE_SCREEN
*
screen
=
GetScreen
();
// Display the same view after canvas switching
// Display the same view after canvas switching
if
(
aEnable
)
if
(
aEnable
)
// Switch to GAL rendering
{
{
BASE_SCREEN
*
screen
=
GetScreen
();
// Set up viewport
double
zoom
=
1.0
/
(
zoomFactor
*
m_canvas
->
GetZoom
()
);
// Switch to GAL rendering
view
->
SetScale
(
zoom
);
if
(
!
IsGalCanvasActive
()
)
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
// Set up grid settings
gal
->
SetGridVisibility
(
IsGridVisible
()
);
gal
->
SetGridVisibility
(
IsGridVisible
()
);
gal
->
SetGridSize
(
VECTOR2D
(
screen
->
GetGridSize
()
.
x
,
screen
->
GetGridSize
().
y
)
);
gal
->
SetGridSize
(
VECTOR2D
(
screen
->
GetGridSize
()
)
);
gal
->
SetGridOrigin
(
VECTOR2D
(
GetGridOrigin
()
)
);
gal
->
SetGridOrigin
(
VECTOR2D
(
GetGridOrigin
()
)
);
}
}
else
else
// Switch to standard rendering
{
{
// Switch to standard rendering
// Change view settings only if GAL was active previously
if
(
IsGalCanvasActive
()
)
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
();
VECTOR2D
center
=
view
->
GetCenter
();
RedrawScreen
(
wxPoint
(
center
.
x
,
center
.
y
),
false
);
AdjustScrollBars
(
wxPoint
(
center
.
x
,
center
.
y
)
);
}
}
}
m_canvas
->
SetEvtHandlerEnabled
(
!
aEnable
);
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
...
@@ -99,17 +99,10 @@ EDA_DRAW_PANEL_GAL::EDA_DRAW_PANEL_GAL( wxWindow* aParentWindow, wxWindowID aWin
EDA_DRAW_PANEL_GAL
::~
EDA_DRAW_PANEL_GAL
()
EDA_DRAW_PANEL_GAL
::~
EDA_DRAW_PANEL_GAL
()
{
{
if
(
m_painter
)
delete
m_painter
;
delete
m_painter
;
delete
m_viewControls
;
delete
m_view
;
if
(
m_viewControls
)
delete
m_gal
;
delete
m_viewControls
;
if
(
m_view
)
delete
m_view
;
if
(
m_gal
)
delete
m_gal
;
}
}
...
@@ -194,42 +187,29 @@ void EDA_DRAW_PANEL_GAL::SetEventDispatcher( TOOL_DISPATCHER* aEventDispatcher )
...
@@ -194,42 +187,29 @@ void EDA_DRAW_PANEL_GAL::SetEventDispatcher( TOOL_DISPATCHER* aEventDispatcher )
m_eventDispatcher
=
aEventDispatcher
;
m_eventDispatcher
=
aEventDispatcher
;
#if wxCHECK_VERSION( 3, 0, 0 )
#if wxCHECK_VERSION( 3, 0, 0 )
if
(
m_eventDispatcher
)
const
wxEventType
eventTypes
[]
=
{
wxEVT_TOOL
};
{
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
)
);
}
#else
#else
const
wxEventType
eventTypes
[]
=
{
wxEVT_COMMAND_MENU_SELECTED
,
wxEVT_COMMAND_TOOL_CLICKED
};
#endif
if
(
m_eventDispatcher
)
if
(
m_eventDispatcher
)
{
{
m_parent
->
Connect
(
wxEVT_COMMAND_MENU_SELECTED
,
BOOST_FOREACH
(
wxEventType
type
,
eventTypes
)
wxCommandEventHandler
(
TOOL_DISPATCHER
::
DispatchWxCommand
),
{
NULL
,
m_eventDispatcher
);
m_parent
->
Connect
(
type
,
wxCommandEventHandler
(
TOOL_DISPATCHER
::
DispatchWxCommand
),
NULL
,
m_eventDispatcher
);
m_parent
->
Connect
(
wxEVT_COMMAND_TOOL_CLICKED
,
}
wxCommandEventHandler
(
TOOL_DISPATCHER
::
DispatchWxCommand
),
NULL
,
m_eventDispatcher
);
}
}
else
else
{
{
// While loops are used to be sure, that we are removing all event handlers
BOOST_FOREACH
(
wxEventType
type
,
eventTypes
)
while
(
m_parent
->
Disconnect
(
wxEVT_COMMAND_MENU_SELECTED
,
{
wxCommandEventHandler
(
TOOL_DISPATCHER
::
DispatchWxCommand
),
// While loop is used to be sure that all event handlers are removed.
NULL
,
m_eventDispatcher
)
);
while
(
m_parent
->
Disconnect
(
type
,
wxCommandEventHandler
(
TOOL_DISPATCHER
::
DispatchWxCommand
),
while
(
m_parent
->
Disconnect
(
wxEVT_COMMAND_TOOL_CLICKED
,
NULL
,
m_eventDispatcher
)
);
wxCommandEventHandler
(
TOOL_DISPATCHER
::
DispatchWxCommand
),
}
NULL
,
m_eventDispatcher
)
);
}
}
#endif
}
}
...
@@ -316,7 +296,7 @@ bool EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType )
...
@@ -316,7 +296,7 @@ bool EDA_DRAW_PANEL_GAL::SwitchBackend( GalType aGalType )
m_backend
=
aGalType
;
m_backend
=
aGalType
;
}
}
catch
(
std
::
runtime_error
&
err
)
catch
(
std
::
runtime_error
&
err
)
{
{
DisplayError
(
m_parent
,
wxString
(
err
.
what
()
)
);
DisplayError
(
m_parent
,
wxString
(
err
.
what
()
)
);
return
false
;
return
false
;
...
...
common/tool/context_menu.cpp
View file @
f261bf38
/*
/*
* This program source code file is part of KiCad, a free EDA CAD application.
* 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 Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* modify it under the terms of the GNU General Public License
...
@@ -31,34 +32,37 @@
...
@@ -31,34 +32,37 @@
#include <cassert>
#include <cassert>
CONTEXT_MENU
::
CONTEXT_MENU
()
:
CONTEXT_MENU
::
CONTEXT_MENU
()
:
m_titleSet
(
false
),
m_selected
(
-
1
),
m_tool
(
NULL
),
m_icon
(
NULL
)
m_titleSet
(
false
),
m_selected
(
-
1
),
m_tool
(
NULL
),
m_parent
(
NULL
),
m_icon
(
NULL
),
m_menu_handler
(
CONTEXT_MENU
::
menuHandlerStub
),
m_update_handler
(
CONTEXT_MENU
::
updateHandlerStub
)
{
{
setCustomEventHandler
(
boost
::
bind
(
&
CONTEXT_MENU
::
handleCustomEvent
,
this
,
_1
)
);
setupEvents
();
setupEvents
();
}
}
CONTEXT_MENU
::
CONTEXT_MENU
(
const
CONTEXT_MENU
&
aMenu
)
:
CONTEXT_MENU
::
CONTEXT_MENU
(
const
CONTEXT_MENU
&
aMenu
)
m_titleSet
(
aMenu
.
m_titleSet
),
m_selected
(
-
1
),
m_tool
(
aMenu
.
m_tool
),
m_toolActions
(
aMenu
.
m_toolActions
),
m_customHandler
(
aMenu
.
m_customHandler
)
{
{
copyFrom
(
aMenu
);
copyFrom
(
aMenu
);
setupEvents
();
setupEvents
();
}
}
CONTEXT_MENU
::~
CONTEXT_MENU
()
{
// Set parent to NULL to prevent submenus from unregistering from a notexisting object
for
(
std
::
list
<
CONTEXT_MENU
*>::
iterator
it
=
m_submenus
.
begin
();
it
!=
m_submenus
.
end
();
++
it
)
(
*
it
)
->
m_parent
=
NULL
;
if
(
m_parent
)
m_parent
->
m_submenus
.
remove
(
this
);
}
CONTEXT_MENU
&
CONTEXT_MENU
::
operator
=
(
const
CONTEXT_MENU
&
aMenu
)
CONTEXT_MENU
&
CONTEXT_MENU
::
operator
=
(
const
CONTEXT_MENU
&
aMenu
)
{
{
Clear
();
Clear
();
m_titleSet
=
aMenu
.
m_titleSet
;
m_selected
=
aMenu
.
m_selected
;
m_tool
=
aMenu
.
m_tool
;
m_toolActions
=
aMenu
.
m_toolActions
;
m_customHandler
=
aMenu
.
m_customHandler
;
copyFrom
(
aMenu
);
copyFrom
(
aMenu
);
setupEvents
();
return
*
this
;
return
*
this
;
}
}
...
@@ -90,31 +94,31 @@ void CONTEXT_MENU::SetTitle( const wxString& aTitle )
...
@@ -90,31 +94,31 @@ void CONTEXT_MENU::SetTitle( const wxString& aTitle )
}
}
void
CONTEXT_MENU
::
Add
(
const
wxString
&
aLabel
,
int
aId
,
const
BITMAP_OPAQUE
*
aIcon
)
wxMenuItem
*
CONTEXT_MENU
::
Add
(
const
wxString
&
aLabel
,
int
aId
,
const
BITMAP_OPAQUE
*
aIcon
)
{
{
#ifdef DEBUG
#ifdef DEBUG
if
(
FindItem
(
aId
)
!=
NULL
)
if
(
FindItem
(
aId
)
!=
NULL
)
wxLogWarning
(
wxT
(
"Adding more than one menu entry with the same ID may result in"
wxLogWarning
(
wxT
(
"Adding more than one menu entry with the same ID may result in"
"undefined behaviour"
)
);
"undefined behaviour"
)
);
#endif
#endif
wxMenuItem
*
item
=
new
wxMenuItem
(
this
,
aId
,
aLabel
,
wxEmptyString
,
wxITEM_NORMAL
);
wxMenuItem
*
item
=
new
wxMenuItem
(
this
,
aId
,
aLabel
,
wxEmptyString
,
wxITEM_NORMAL
);
if
(
aIcon
)
if
(
aIcon
)
item
->
SetBitmap
(
KiBitmap
(
aIcon
)
);
item
->
SetBitmap
(
KiBitmap
(
aIcon
)
);
Append
(
item
);
return
Append
(
item
);
}
}
void
CONTEXT_MENU
::
Add
(
const
TOOL_ACTION
&
aAction
)
wxMenuItem
*
CONTEXT_MENU
::
Add
(
const
TOOL_ACTION
&
aAction
)
{
{
/// ID numbers for tool actions need to have a value higher than
m_actionId
/// ID numbers for tool actions need to have a value higher than
ACTION_ID
int
id
=
m_actionId
+
aAction
.
GetId
();
int
id
=
ACTION_ID
+
aAction
.
GetId
();
const
BITMAP_OPAQUE
*
icon
=
aAction
.
GetIcon
();
const
BITMAP_OPAQUE
*
icon
=
aAction
.
GetIcon
();
wxMenuItem
*
item
=
new
wxMenuItem
(
this
,
id
,
wxMenuItem
*
item
=
new
wxMenuItem
(
this
,
id
,
aAction
.
GetMenuItem
(),
aAction
.
GetMenuItem
(),
aAction
.
GetDescription
(),
wxITEM_NORMAL
);
aAction
.
GetDescription
(),
wxITEM_NORMAL
);
if
(
icon
)
if
(
icon
)
item
->
SetBitmap
(
KiBitmap
(
icon
)
);
item
->
SetBitmap
(
KiBitmap
(
icon
)
);
...
@@ -136,24 +140,43 @@ void CONTEXT_MENU::Add( const TOOL_ACTION& aAction )
...
@@ -136,24 +140,43 @@ void CONTEXT_MENU::Add( const TOOL_ACTION& aAction )
item
->
SetAccel
(
&
accel
);
item
->
SetAccel
(
&
accel
);
}
}
Append
(
item
);
m_toolActions
[
id
]
=
&
aAction
;
m_toolActions
[
id
]
=
&
aAction
;
return
Append
(
item
);
}
}
void
CONTEXT_MENU
::
Add
(
CONTEXT_MENU
*
aMenu
,
const
wxString
&
aLabel
)
std
::
list
<
wxMenuItem
*>
CONTEXT_MENU
::
Add
(
CONTEXT_MENU
*
aMenu
,
const
wxString
&
aLabel
,
bool
aExpand
)
{
{
if
(
aMenu
->
m_icon
)
std
::
list
<
wxMenuItem
*>
items
;
if
(
aExpand
)
{
{
wxMenuItem
*
newItem
=
new
wxMenuItem
(
this
,
-
1
,
aLabel
,
wxEmptyString
,
wxITEM_NORMAL
);
for
(
int
i
=
0
;
i
<
(
int
)
aMenu
->
GetMenuItemCount
();
++
i
)
newItem
->
SetBitmap
(
KiBitmap
(
aMenu
->
m_icon
)
);
{
newItem
->
SetSubMenu
(
aMenu
);
wxMenuItem
*
item
=
aMenu
->
FindItemByPosition
(
i
);
Append
(
newItem
);
items
.
push_back
(
appendCopy
(
item
)
);
}
}
}
else
else
{
{
AppendSubMenu
(
aMenu
,
aLabel
);
if
(
aMenu
->
m_icon
)
{
wxMenuItem
*
newItem
=
new
wxMenuItem
(
this
,
-
1
,
aLabel
,
wxEmptyString
,
wxITEM_NORMAL
);
newItem
->
SetBitmap
(
KiBitmap
(
aMenu
->
m_icon
)
);
newItem
->
SetSubMenu
(
aMenu
);
items
.
push_back
(
Append
(
newItem
)
);
}
else
{
items
.
push_back
(
AppendSubMenu
(
aMenu
,
aLabel
)
);
}
}
}
m_submenus
.
push_back
(
aMenu
);
aMenu
->
m_parent
=
this
;
return
items
;
}
}
...
@@ -161,15 +184,25 @@ void CONTEXT_MENU::Clear()
...
@@ -161,15 +184,25 @@ void CONTEXT_MENU::Clear()
{
{
m_titleSet
=
false
;
m_titleSet
=
false
;
GetMenuItems
().
DeleteContents
(
true
);
for
(
int
i
=
GetMenuItemCount
()
-
1
;
i
>=
0
;
--
i
)
GetMenuItems
().
Clear
();
Destroy
(
FindItemByPosition
(
i
)
);
m_toolActions
.
clear
();
m_toolActions
.
clear
();
GetMenuItems
().
DeleteContents
(
false
);
// restore the default so destructor does not go wild
m_submenus
.
clear
();
m_parent
=
NULL
;
assert
(
GetMenuItemCount
()
==
0
);
assert
(
GetMenuItemCount
()
==
0
);
}
}
void
CONTEXT_MENU
::
UpdateAll
()
{
m_update_handler
();
runOnSubmenus
(
boost
::
bind
(
&
CONTEXT_MENU
::
UpdateAll
,
_1
)
);
}
void
CONTEXT_MENU
::
onMenuEvent
(
wxMenuEvent
&
aEvent
)
void
CONTEXT_MENU
::
onMenuEvent
(
wxMenuEvent
&
aEvent
)
{
{
OPT_TOOL_EVENT
evt
;
OPT_TOOL_EVENT
evt
;
...
@@ -195,8 +228,10 @@ void CONTEXT_MENU::onMenuEvent( wxMenuEvent& aEvent )
...
@@ -195,8 +228,10 @@ void CONTEXT_MENU::onMenuEvent( wxMenuEvent& aEvent )
}
}
else
else
{
{
// Under Linux, every submenu can have a separate event handler, under
runEventHandlers
(
aEvent
,
evt
);
// Windows all submenus are handled by the main menu.
// Under Linux, every submenu can have a separate event handler, under
// Windows all submenus are handled by the main menu.
#ifdef __WINDOWS__
#ifdef __WINDOWS__
if
(
!
evt
)
if
(
!
evt
)
{
{
...
@@ -211,7 +246,6 @@ void CONTEXT_MENU::onMenuEvent( wxMenuEvent& aEvent )
...
@@ -211,7 +246,6 @@ void CONTEXT_MENU::onMenuEvent( wxMenuEvent& aEvent )
}
}
}
}
#endif
#endif
evt
=
m_customHandler
(
aEvent
);
// Handling non-action menu entries (e.g. items in clarification list)
// Handling non-action menu entries (e.g. items in clarification list)
if
(
!
evt
)
if
(
!
evt
)
...
@@ -231,62 +265,88 @@ void CONTEXT_MENU::setTool( TOOL_INTERACTIVE* aTool )
...
@@ -231,62 +265,88 @@ void CONTEXT_MENU::setTool( TOOL_INTERACTIVE* aTool )
{
{
m_tool
=
aTool
;
m_tool
=
aTool
;
for
(
unsigned
i
=
0
;
i
<
GetMenuItemCount
();
++
i
)
runOnSubmenus
(
boost
::
bind
(
&
CONTEXT_MENU
::
setTool
,
_1
,
aTool
)
);
{
}
wxMenuItem
*
item
=
FindItemByPosition
(
i
);
if
(
item
->
IsSubMenu
()
)
{
void
CONTEXT_MENU
::
runEventHandlers
(
const
wxMenuEvent
&
aMenuEvent
,
OPT_TOOL_EVENT
&
aToolEvent
)
CONTEXT_MENU
*
menu
=
static_cast
<
CONTEXT_MENU
*>
(
item
->
GetSubMenu
()
);
{
menu
->
setTool
(
aTool
);
aToolEvent
=
m_menu_handler
(
aMenuEvent
);
}
}
if
(
!
aToolEvent
)
runOnSubmenus
(
boost
::
bind
(
&
CONTEXT_MENU
::
runEventHandlers
,
_1
,
aMenuEvent
,
aToolEvent
)
);
}
}
void
CONTEXT_MENU
::
copyItem
(
const
wxMenuItem
*
aSource
,
wxMenuItem
*
aDest
)
const
void
CONTEXT_MENU
::
runOnSubmenus
(
boost
::
function
<
void
(
CONTEXT_MENU
*
)
>
aFunction
)
{
{
assert
(
!
aSource
->
IsSubMenu
()
);
// it does not transfer submenus
std
::
for_each
(
m_submenus
.
begin
(),
m_submenus
.
end
(),
aFunction
);
}
wxMenuItem
*
CONTEXT_MENU
::
appendCopy
(
const
wxMenuItem
*
aSource
)
{
wxMenuItem
*
newItem
=
new
wxMenuItem
(
this
,
aSource
->
GetId
(),
aSource
->
GetItemLabel
(),
aSource
->
GetHelp
(),
aSource
->
GetKind
()
);
if
(
aSource
->
GetKind
()
==
wxITEM_NORMAL
)
newItem
->
SetBitmap
(
aSource
->
GetBitmap
()
);
if
(
aSource
->
IsSubMenu
()
)
{
#ifdef DEBUG
// Submenus of a CONTEXT_MENU are supposed to be CONTEXT_MENUs as well
assert
(
dynamic_cast
<
CONTEXT_MENU
*>
(
aSource
->
GetSubMenu
()
)
);
#endif
CONTEXT_MENU
*
menu
=
new
CONTEXT_MENU
(
static_cast
<
const
CONTEXT_MENU
&>
(
*
aSource
->
GetSubMenu
()
)
);
newItem
->
SetSubMenu
(
menu
);
Append
(
newItem
);
m_submenus
.
push_back
(
menu
);
menu
->
m_parent
=
this
;
}
else
{
Append
(
newItem
);
newItem
->
SetKind
(
aSource
->
GetKind
()
);
newItem
->
SetHelp
(
aSource
->
GetHelp
()
);
newItem
->
Enable
(
aSource
->
IsEnabled
()
);
aDest
->
SetKind
(
aSource
->
GetKind
()
);
if
(
aSource
->
IsCheckable
()
)
aDest
->
SetHelp
(
aSource
->
GetHelp
()
);
newItem
->
Check
(
aSource
->
IsChecked
()
);
aDest
->
Enable
(
aSource
->
IsEnabled
()
);
}
if
(
aSource
->
IsCheckable
()
)
return
newItem
;
aDest
->
Check
(
aSource
->
IsChecked
()
);
}
}
void
CONTEXT_MENU
::
copyFrom
(
const
CONTEXT_MENU
&
aMenu
)
void
CONTEXT_MENU
::
copyFrom
(
const
CONTEXT_MENU
&
aMenu
)
{
{
m_icon
=
aMenu
.
m_icon
;
m_icon
=
aMenu
.
m_icon
;
m_titleSet
=
aMenu
.
m_titleSet
;
m_selected
=
-
1
;
// aMenu.m_selected;
m_tool
=
aMenu
.
m_tool
;
m_toolActions
=
aMenu
.
m_toolActions
;
m_parent
=
NULL
;
// aMenu.m_parent;
m_menu_handler
=
aMenu
.
m_menu_handler
;
m_update_handler
=
aMenu
.
m_update_handler
;
// Copy all the menu entries
// Copy all the menu entries
for
(
unsigned
i
=
0
;
i
<
aMenu
.
GetMenuItemCount
();
++
i
)
for
(
int
i
=
0
;
i
<
(
int
)
aMenu
.
GetMenuItemCount
();
++
i
)
{
{
wxMenuItem
*
item
=
aMenu
.
FindItemByPosition
(
i
);
wxMenuItem
*
item
=
aMenu
.
FindItemByPosition
(
i
);
appendCopy
(
item
);
}
}
wxMenuItem
*
newItem
=
new
wxMenuItem
(
this
,
item
->
GetId
(),
item
->
GetItemLabel
(),
item
->
GetHelp
(),
item
->
GetKind
()
);
if
(
item
->
GetKind
()
==
wxITEM_NORMAL
)
OPT_TOOL_EVENT
CONTEXT_MENU
::
menuHandlerStub
(
const
wxMenuEvent
&
)
newItem
->
SetBitmap
(
item
->
GetBitmap
()
);
{
return
OPT_TOOL_EVENT
();
}
if
(
item
->
IsSubMenu
()
)
{
#ifdef DEBUG
// Submenus of a CONTEXT_MENU are supposed to be CONTEXT_MENUs as well
assert
(
dynamic_cast
<
CONTEXT_MENU
*>
(
item
->
GetSubMenu
()
)
);
#endif
CONTEXT_MENU
*
menu
=
new
CONTEXT_MENU
(
static_cast
<
const
CONTEXT_MENU
&>
(
*
item
->
GetSubMenu
()
)
);
void
CONTEXT_MENU
::
updateHandlerStub
()
newItem
->
SetSubMenu
(
menu
);
{
Append
(
newItem
);
}
else
{
Append
(
newItem
);
copyItem
(
item
,
newItem
);
}
}
}
}
common/tool/tool_manager.cpp
View file @
f261bf38
...
@@ -303,7 +303,10 @@ bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow, void* a
...
@@ -303,7 +303,10 @@ bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow, void* a
if
(
action
)
if
(
action
)
{
{
TOOL_EVENT
event
=
action
->
MakeEvent
();
TOOL_EVENT
event
=
action
->
MakeEvent
();
event
.
SetParameter
(
aParam
);
// Allow to override the action parameter
if
(
aParam
)
event
.
SetParameter
(
aParam
);
if
(
aNow
)
if
(
aNow
)
ProcessEvent
(
event
);
ProcessEvent
(
event
);
...
@@ -313,6 +316,8 @@ bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow, void* a
...
@@ -313,6 +316,8 @@ bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow, void* a
return
true
;
return
true
;
}
}
wxASSERT_MSG
(
action
!=
NULL
,
wxString
::
Format
(
_
(
"Could not find action %s."
),
aActionName
)
);
return
false
;
return
false
;
}
}
...
@@ -320,7 +325,10 @@ bool TOOL_MANAGER::RunAction( const std::string& aActionName, bool aNow, void* a
...
@@ -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
)
void
TOOL_MANAGER
::
RunAction
(
const
TOOL_ACTION
&
aAction
,
bool
aNow
,
void
*
aParam
)
{
{
TOOL_EVENT
event
=
aAction
.
MakeEvent
();
TOOL_EVENT
event
=
aAction
.
MakeEvent
();
event
.
SetParameter
(
aParam
);
// Allow to override the action parameter
if
(
aParam
)
event
.
SetParameter
(
aParam
);
if
(
aNow
)
if
(
aNow
)
ProcessEvent
(
event
);
ProcessEvent
(
event
);
...
@@ -383,6 +391,7 @@ bool TOOL_MANAGER::runTool( TOOL_BASE* aTool )
...
@@ -383,6 +391,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
()
);
...
@@ -419,7 +428,10 @@ void TOOL_MANAGER::ResetTools( TOOL_BASE::RESET_REASON aReason )
...
@@ -419,7 +428,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
();
}
}
}
...
@@ -584,8 +596,13 @@ void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent )
...
@@ -584,8 +596,13 @@ void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent )
// Temporarily store the cursor position, so the tools could execute actions
// Temporarily store the cursor position, so the tools could execute actions
// using the point where the user has invoked a context menu
// 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
()
);
m_viewControls
->
ForceCursorPosition
(
true
,
m_viewControls
->
GetCursorPosition
()
);
// Run update handlers
st
->
contextMenu
->
UpdateAll
();
boost
::
scoped_ptr
<
CONTEXT_MENU
>
menu
(
new
CONTEXT_MENU
(
*
st
->
contextMenu
)
);
boost
::
scoped_ptr
<
CONTEXT_MENU
>
menu
(
new
CONTEXT_MENU
(
*
st
->
contextMenu
)
);
GetEditFrame
()
->
PopupMenu
(
menu
.
get
()
);
GetEditFrame
()
->
PopupMenu
(
menu
.
get
()
);
...
@@ -596,7 +613,10 @@ void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent )
...
@@ -596,7 +613,10 @@ void TOOL_MANAGER::dispatchContextMenu( const TOOL_EVENT& aEvent )
dispatchInternal
(
evt
);
dispatchInternal
(
evt
);
}
}
m_viewControls
->
ForceCursorPosition
(
false
);
TOOL_EVENT
evt
(
TC_COMMAND
,
TA_CONTEXT_MENU_CLOSED
);
dispatchInternal
(
evt
);
m_viewControls
->
ForceCursorPosition
(
forcedCursor
,
cursorPos
);
break
;
break
;
}
}
...
@@ -615,6 +635,8 @@ void TOOL_MANAGER::finishTool( TOOL_STATE* aState )
...
@@ -615,6 +635,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
();
}
}
...
...
common/zoom.cpp
View file @
f261bf38
...
@@ -33,8 +33,6 @@
...
@@ -33,8 +33,6 @@
#include <fctsys.h>
#include <fctsys.h>
#include <id.h>
#include <id.h>
#include <class_drawpanel.h>
#include <class_drawpanel.h>
#include <class_draw_panel_gal.h>
#include <gal/graphics_abstraction_layer.h>
#include <view/view.h>
#include <view/view.h>
#include <class_base_screen.h>
#include <class_base_screen.h>
#include <draw_frame.h>
#include <draw_frame.h>
...
@@ -42,10 +40,14 @@
...
@@ -42,10 +40,14 @@
#include <hotkeys_basic.h>
#include <hotkeys_basic.h>
#include <menus_helpers.h>
#include <menus_helpers.h>
#include <base_units.h>
#include <base_units.h>
#include <tool/tool_manager.h>
void
EDA_DRAW_FRAME
::
RedrawScreen
(
const
wxPoint
&
aCenterPoint
,
bool
aWarpPointer
)
void
EDA_DRAW_FRAME
::
RedrawScreen
(
const
wxPoint
&
aCenterPoint
,
bool
aWarpPointer
)
{
{
if
(
IsGalCanvasActive
()
)
return
;
AdjustScrollBars
(
aCenterPoint
);
AdjustScrollBars
(
aCenterPoint
);
// Move the mouse cursor to the on grid graphic cursor position
// 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
...
@@ -58,6 +60,9 @@ void EDA_DRAW_FRAME::RedrawScreen( const wxPoint& aCenterPoint, bool aWarpPointe
void
EDA_DRAW_FRAME
::
RedrawScreen2
(
const
wxPoint
&
posBefore
)
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
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
newScreenPos
=
m_canvas
->
ToDeviceXY
(
GetCrossHairPosition
()
);
// screen position of crosshair after zoom
wxPoint
newCenter
=
m_canvas
->
ToLogicalXY
(
newScreenPos
-
dPos
);
wxPoint
newCenter
=
m_canvas
->
ToLogicalXY
(
newScreenPos
-
dPos
);
...
@@ -86,6 +91,8 @@ void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
...
@@ -86,6 +91,8 @@ void EDA_DRAW_FRAME::Zoom_Automatique( bool aWarpPointer )
if
(
!
IsGalCanvasActive
()
)
if
(
!
IsGalCanvasActive
()
)
RedrawScreen
(
GetScrollCenterPosition
(),
aWarpPointer
);
RedrawScreen
(
GetScrollCenterPosition
(),
aWarpPointer
);
else
m_toolManager
->
RunAction
(
"common.Control.zoomFitScreen"
,
true
);
}
}
...
@@ -186,18 +193,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
...
@@ -186,18 +193,7 @@ void EDA_DRAW_FRAME::OnZoom( wxCommandEvent& event )
break
;
break
;
default
:
default
:
unsigned
i
;
SetPresetZoom
(
id
-
ID_POPUP_ZOOM_LEVEL_START
);
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
);
}
}
UpdateStatusBar
();
UpdateStatusBar
();
...
@@ -216,6 +212,26 @@ void EDA_DRAW_FRAME::SetPrevZoom()
...
@@ -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.
/* add the zoom list menu the the MasterMenu.
* used in OnRightClick(wxMouseEvent& event)
* used in OnRightClick(wxMouseEvent& event)
*/
*/
...
...
cvpcb/CMakeLists.txt
View file @
f261bf38
...
@@ -117,26 +117,9 @@ target_link_libraries( cvpcb_kiface
...
@@ -117,26 +117,9 @@ target_link_libraries( cvpcb_kiface
polygon
polygon
gal
gal
${
wxWidgets_LIBRARIES
}
${
wxWidgets_LIBRARIES
}
${
OPENGL_LIBRARIES
}
${
GDI_PLUS_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
)
if
(
BUILD_GITHUB_PLUGIN
)
target_link_libraries
(
cvpcb_kiface github_plugin
)
target_link_libraries
(
cvpcb_kiface github_plugin
)
endif
()
endif
()
...
...
gerbview/CMakeLists.txt
View file @
f261bf38
...
@@ -131,7 +131,6 @@ target_link_libraries( gerbview_kiface
...
@@ -131,7 +131,6 @@ target_link_libraries( gerbview_kiface
common
common
polygon
polygon
bitmaps
bitmaps
${
OPENGL_LIBRARIES
}
${
wxWidgets_LIBRARIES
}
${
wxWidgets_LIBRARIES
}
${
GDI_PLUS_LIBRARIES
}
${
GDI_PLUS_LIBRARIES
}
)
)
...
...
include/class_base_screen.h
View file @
f261bf38
...
@@ -215,7 +215,7 @@ public:
...
@@ -215,7 +215,7 @@ public:
int
m_ScreenNumber
;
int
m_ScreenNumber
;
int
m_NumberOfScreens
;
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
;
bool
m_IsPrinting
;
public
:
public
:
...
...
include/draw_frame.h
View file @
f261bf38
...
@@ -72,6 +72,9 @@ protected:
...
@@ -72,6 +72,9 @@ protected:
/// The area to draw on.
/// The area to draw on.
EDA_DRAW_PANEL
*
m_canvas
;
EDA_DRAW_PANEL
*
m_canvas
;
TOOL_MANAGER
*
m_toolManager
;
TOOL_DISPATCHER
*
m_toolDispatcher
;
/// Tool ID of previously active draw tool bar button.
/// Tool ID of previously active draw tool bar button.
int
m_lastDrawToolId
;
int
m_lastDrawToolId
;
...
@@ -343,6 +346,12 @@ public:
...
@@ -343,6 +346,12 @@ public:
*/
*/
virtual
const
wxString
GetZoomLevelIndicator
()
const
;
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
EraseMsgBox
();
void
Process_PageSettings
(
wxCommandEvent
&
event
);
void
Process_PageSettings
(
wxCommandEvent
&
event
);
...
@@ -430,6 +439,13 @@ public:
...
@@ -430,6 +439,13 @@ public:
*/
*/
virtual
void
SetPrevGrid
();
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.
* Command event handler for selecting grid sizes.
*
*
...
@@ -502,6 +518,13 @@ public:
...
@@ -502,6 +518,13 @@ public:
*/
*/
void
SetPrevZoom
();
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
* Function RedrawScreen
* redraws the entire screen area by updating the scroll bars and mouse pointer in
* redraws the entire screen area by updating the scroll bars and mouse pointer in
...
@@ -730,6 +753,12 @@ public:
...
@@ -730,6 +753,12 @@ public:
EDA_DRAW_PANEL_GAL
*
GetGalCanvas
()
const
{
return
m_galCanvas
;
}
EDA_DRAW_PANEL_GAL
*
GetGalCanvas
()
const
{
return
m_galCanvas
;
}
void
SetGalCanvas
(
EDA_DRAW_PANEL_GAL
*
aPanel
)
{
m_galCanvas
=
aPanel
;
}
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
* Function GetDisplayOptions
* A way to pass info to draw functions. the base class has no knowledge about
* 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.
* 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 Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
* modify it under the terms of the GNU General Public License
* modify it under the terms of the GNU General Public License
...
@@ -47,9 +48,9 @@ public:
...
@@ -47,9 +48,9 @@ public:
///> Copy constructor
///> Copy constructor
CONTEXT_MENU
(
const
CONTEXT_MENU
&
aMenu
);
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()
* Function SetTitle()
...
@@ -64,7 +65,7 @@ public:
...
@@ -64,7 +65,7 @@ public:
* Assigns an icon for the entry.
* Assigns an icon for the entry.
* @param aIcon is the icon to be assigned. NULL is used to remove icon.
* @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
;
m_icon
=
aIcon
;
}
}
...
@@ -77,7 +78,7 @@ public:
...
@@ -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 aId is the ID that is sent in the TOOL_EVENT. It should be unique for every entry.
* @param aIcon is an optional icon.
* @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()
* Function Add()
...
@@ -85,7 +86,7 @@ public:
...
@@ -85,7 +86,7 @@ public:
* a TOOL_EVENT command containing name of the action is sent.
* a TOOL_EVENT command containing name of the action is sent.
* @param aAction is the action to be added to menu entry.
* @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()
* Function Add()
...
@@ -93,8 +94,10 @@ public:
...
@@ -93,8 +94,10 @@ public:
* is the capability to handle icons.
* is the capability to handle icons.
* @param aMenu is the submenu to be added.
* @param aMenu is the submenu to be added.
* @param aLabel is the caption displayed for the menu entry.
* @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()
* Function Clear()
...
@@ -109,28 +112,48 @@ public:
...
@@ -109,28 +112,48 @@ public:
* menu was dismissed.
* menu was dismissed.
* @return The position of selected item in the context menu.
* @return The position of selected item in the context menu.
*/
*/
int
GetSelected
()
const
in
line
in
t
GetSelected
()
const
{
{
return
m_selected
;
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
:
private
:
// Empty stubs used by the default constructor
static
OPT_TOOL_EVENT
menuHandlerStub
(
const
wxMenuEvent
&
);
static
void
updateHandlerStub
();
/**
/**
* Function
copyItem
* Function
appendCopy
*
Copies all properties of a menu entry to another
.
*
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.
///> Common part of copy constructor and assignment operator.
void
copyFrom
(
const
CONTEXT_MENU
&
aMenu
);
void
copyFrom
(
const
CONTEXT_MENU
&
aMenu
);
...
@@ -138,7 +161,7 @@ private:
...
@@ -138,7 +161,7 @@ private:
///> Initializes handlers for events.
///> Initializes handlers for events.
void
setupEvents
();
void
setupEvents
();
///>
E
vent handler.
///>
The default menu e
vent handler.
void
onMenuEvent
(
wxMenuEvent
&
aEvent
);
void
onMenuEvent
(
wxMenuEvent
&
aEvent
);
/**
/**
...
@@ -148,30 +171,43 @@ private:
...
@@ -148,30 +171,43 @@ private:
*/
*/
void
setTool
(
TOOL_INTERACTIVE
*
aTool
);
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.
///> Flag indicating that the menu title was set up.
bool
m_titleSet
;
bool
m_titleSet
;
///> Stores the id number of selected item.
///> Stores the id number of selected item.
int
m_selected
;
int
m_selected
;
///> Instance of menu event handler.
//CMEventHandler m_handler;
///> Creator of the menu
///> Creator of the menu
TOOL_INTERACTIVE
*
m_tool
;
TOOL_INTERACTIVE
*
m_tool
;
/// Menu items with ID higher than that are considered TOOL_ACTIONs
///
>
Menu items with ID higher than that are considered TOOL_ACTIONs
static
const
int
m_actionId
=
1
0000
;
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
;
std
::
map
<
int
,
const
TOOL_ACTION
*>
m_toolActions
;
/// Custom events handler, allows to translate wxEvents to TOOL_EVENTs.
///> List of submenus.
boost
::
function
<
OPT_TOOL_EVENT
(
const
wxMenuEvent
&
aEvent
)
>
m_customHandler
;
std
::
list
<
CONTEXT_MENU
*>
m_submenus
;
///> Parent CONTEXT_MENU.
CONTEXT_MENU
*
m_parent
;
/// Optional icon
///
>
Optional icon
const
BITMAP_OPAQUE
*
m_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
;
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.
* 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 Tomasz Wlostowski <tomasz.wlostowski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch>
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
*
...
@@ -41,7 +41,7 @@ struct BITMAP_OPAQUE;
...
@@ -41,7 +41,7 @@ struct BITMAP_OPAQUE;
* - running the DRC from the menu
* - running the DRC from the menu
* and so on, and so forth....
* and so on, and so forth....
* Action class groups all necessary properties of an action, including explanation,
* Action class groups all necessary properties of an action, including explanation,
* icons, hotkeys,
.
menu items, etc.
* icons, hotkeys,
menu items, etc.
*/
*/
class
TOOL_ACTION
class
TOOL_ACTION
{
{
...
@@ -49,10 +49,10 @@ public:
...
@@ -49,10 +49,10 @@ public:
TOOL_ACTION
(
const
std
::
string
&
aName
,
TOOL_ACTION_SCOPE
aScope
=
AS_CONTEXT
,
TOOL_ACTION
(
const
std
::
string
&
aName
,
TOOL_ACTION_SCOPE
aScope
=
AS_CONTEXT
,
int
aDefaultHotKey
=
0
,
const
wxString
aMenuItem
=
wxEmptyString
,
int
aDefaultHotKey
=
0
,
const
wxString
aMenuItem
=
wxEmptyString
,
const
wxString
&
aMenuDesc
=
wxEmptyString
,
const
BITMAP_OPAQUE
*
aIcon
=
NULL
,
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_name
(
aName
),
m_scope
(
aScope
),
m_defaultHotKey
(
aDefaultHotKey
),
m_currentHotKey
(
aDefaultHotKey
),
m_menuItem
(
aMenuItem
),
m_currentHotKey
(
aDefaultHotKey
),
m_menuItem
(
aMenuItem
),
m_menuDescription
(
aMenuDesc
),
m_
menuDescription
(
aMenuDesc
),
m_icon
(
aIcon
),
m_id
(
-
1
),
m_flags
(
aFlags
)
m_
icon
(
aIcon
),
m_id
(
-
1
),
m_flags
(
aFlags
),
m_param
(
aParam
)
{
{
TOOL_MANAGER
::
GetActionList
().
push_back
(
this
);
TOOL_MANAGER
::
GetActionList
().
push_back
(
this
);
}
}
...
@@ -150,11 +150,11 @@ public:
...
@@ -150,11 +150,11 @@ public:
TOOL_EVENT
MakeEvent
()
const
TOOL_EVENT
MakeEvent
()
const
{
{
if
(
IsActivation
()
)
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
()
)
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
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
const
wxString
&
GetMenuItem
()
const
...
@@ -219,7 +219,7 @@ private:
...
@@ -219,7 +219,7 @@ private:
/// Name of the action (convention is: app.[tool.]action.name)
/// Name of the action (convention is: app.[tool.]action.name)
std
::
string
m_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
;
TOOL_ACTION_SCOPE
m_scope
;
/// Default hot key that activates the action.
/// Default hot key that activates the action.
...
@@ -243,11 +243,8 @@ private:
...
@@ -243,11 +243,8 @@ private:
/// Action flags
/// Action flags
TOOL_ACTION_FLAGS
m_flags
;
TOOL_ACTION_FLAGS
m_flags
;
/// Origin of the action
/// Generic parameter
// const TOOL_BASE* m_origin;
void
*
m_param
;
/// Originating UI object
// wxWindow* m_uiOrigin;
};
};
#endif
#endif
include/tool/tool_base.h
View file @
f261bf38
...
@@ -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
;
...
...
include/tool/tool_event.h
View file @
f261bf38
...
@@ -88,14 +88,19 @@ enum TOOL_ACTIONS
...
@@ -88,14 +88,19 @@ enum TOOL_ACTIONS
// closed it without selecting anything.
// closed it without selecting anything.
TA_CONTEXT_MENU_CHOICE
=
0x8000
,
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.
// 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).
// Tool action (allows to control tools).
TA_ACTION
=
0x
2
0000
,
TA_ACTION
=
0x
4
0000
,
// Tool activation event.
// Tool activation event.
TA_ACTIVATE
=
0x
4
0000
,
TA_ACTIVATE
=
0x
8
0000
,
TA_ANY
=
0xffffffff
TA_ANY
=
0xffffffff
};
};
...
@@ -159,24 +164,24 @@ public:
...
@@ -159,24 +164,24 @@ public:
const
std
::
string
Format
()
const
;
const
std
::
string
Format
()
const
;
TOOL_EVENT
(
TOOL_EVENT_CATEGORY
aCategory
=
TC_NONE
,
TOOL_ACTIONS
aAction
=
TA_NONE
,
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_category
(
aCategory
),
m_actions
(
aAction
),
m_actions
(
aAction
),
m_scope
(
aScope
),
m_scope
(
aScope
),
m_mouseButtons
(
0
),
m_mouseButtons
(
0
),
m_keyCode
(
0
),
m_keyCode
(
0
),
m_modifiers
(
0
),
m_modifiers
(
0
),
m_param
(
NULL
)
{}
m_param
(
aParameter
)
{}
TOOL_EVENT
(
TOOL_EVENT_CATEGORY
aCategory
,
TOOL_ACTIONS
aAction
,
int
aExtraParam
,
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_category
(
aCategory
),
m_actions
(
aAction
),
m_actions
(
aAction
),
m_scope
(
aScope
),
m_scope
(
aScope
),
m_mouseButtons
(
0
),
m_mouseButtons
(
0
),
m_keyCode
(
0
),
m_keyCode
(
0
),
m_modifiers
(
0
),
m_modifiers
(
0
),
m_param
(
NULL
)
m_param
(
aParameter
)
{
{
if
(
aCategory
==
TC_MOUSE
)
if
(
aCategory
==
TC_MOUSE
)
{
{
...
@@ -198,14 +203,15 @@ public:
...
@@ -198,14 +203,15 @@ public:
}
}
TOOL_EVENT
(
TOOL_EVENT_CATEGORY
aCategory
,
TOOL_ACTIONS
aAction
,
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_category
(
aCategory
),
m_actions
(
aAction
),
m_actions
(
aAction
),
m_scope
(
aScope
),
m_scope
(
aScope
),
m_mouseButtons
(
0
),
m_mouseButtons
(
0
),
m_keyCode
(
0
),
m_keyCode
(
0
),
m_modifiers
(
0
),
m_modifiers
(
0
),
m_param
(
NULL
)
m_param
(
aParameter
)
{
{
if
(
aCategory
==
TC_COMMAND
||
aCategory
==
TC_MESSAGE
)
if
(
aCategory
==
TC_COMMAND
||
aCategory
==
TC_MESSAGE
)
m_commandStr
=
aExtraParam
;
m_commandStr
=
aExtraParam
;
...
@@ -360,9 +366,10 @@ public:
...
@@ -360,9 +366,10 @@ public:
* Returns a non-standard parameter assigned to the event. Its meaning depends on the
* Returns a non-standard parameter assigned to the event. Its meaning depends on the
* target tool.
* 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:
...
@@ -371,9 +378,10 @@ public:
* target tool.
* target tool.
* @param aParam is the new parameter.
* @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
boost
::
optional
<
int
>
GetCommandId
()
const
...
...
include/tool/tool_manager.h
View file @
f261bf38
...
@@ -110,7 +110,18 @@ public:
...
@@ -110,7 +110,18 @@ public:
* depends on the action.
* depends on the action.
* @return False if the action was not found.
* @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()
* Function RunAction()
...
@@ -122,7 +133,18 @@ public:
...
@@ -122,7 +133,18 @@ public:
* @param aParam is an optional parameter that might be used by the invoked action. Its meaning
* @param aParam is an optional parameter that might be used by the invoked action. Its meaning
* depends on the action.
* 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()
* Function FindTool()
...
...
include/view/view_controls.h
View file @
f261bf38
...
@@ -152,7 +152,6 @@ public:
...
@@ -152,7 +152,6 @@ public:
*/
*/
virtual
VECTOR2D
GetCursorPosition
()
const
=
0
;
virtual
VECTOR2D
GetCursorPosition
()
const
=
0
;
/**
/**
* Function ForceCursorPosition()
* Function ForceCursorPosition()
* Places the cursor immediately at a given point. Mouse movement is ignored.
* Places the cursor immediately at a given point. Mouse movement is ignored.
...
@@ -182,6 +181,11 @@ public:
...
@@ -182,6 +181,11 @@ public:
m_cursorCaptured
=
aEnabled
;
m_cursorCaptured
=
aEnabled
;
}
}
inline
bool
IsCursorPositionForced
()
const
{
return
m_forceCursorPosition
;
}
protected
:
protected
:
/// Sets center for VIEW, takes into account panning boundaries.
/// Sets center for VIEW, takes into account panning boundaries.
void
setCenter
(
const
VECTOR2D
&
aCenter
);
void
setCenter
(
const
VECTOR2D
&
aCenter
);
...
...
include/view/view_item.h
View file @
f261bf38
...
@@ -203,10 +203,15 @@ public:
...
@@ -203,10 +203,15 @@ public:
*/
*/
virtual
void
ViewUpdate
(
int
aUpdateFlags
=
ALL
)
virtual
void
ViewUpdate
(
int
aUpdateFlags
=
ALL
)
{
{
if
(
m_view
&&
m_requiredUpdate
==
NONE
)
if
(
m_view
)
m_view
->
MarkForUpdate
(
this
);
{
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:
...
@@ -86,9 +86,6 @@ protected:
/// main window.
/// main window.
wxAuiToolBar
*
m_auxiliaryToolBar
;
wxAuiToolBar
*
m_auxiliaryToolBar
;
TOOL_MANAGER
*
m_toolManager
;
TOOL_DISPATCHER
*
m_toolDispatcher
;
void
updateGridSelectBox
();
void
updateGridSelectBox
();
void
updateZoomSelectBox
();
void
updateZoomSelectBox
();
virtual
void
unitsChangeRefresh
();
virtual
void
unitsChangeRefresh
();
...
...
include/wxstruct.h
View file @
f261bf38
...
@@ -72,6 +72,8 @@ class PAGE_INFO;
...
@@ -72,6 +72,8 @@ class PAGE_INFO;
class
PLOTTER
;
class
PLOTTER
;
class
TITLE_BLOCK
;
class
TITLE_BLOCK
;
class
MSG_PANEL_ITEM
;
class
MSG_PANEL_ITEM
;
class
TOOL_MANAGER
;
class
TOOL_DISPATCHER
;
enum
id_librarytype
{
enum
id_librarytype
{
...
...
pagelayout_editor/CMakeLists.txt
View file @
f261bf38
...
@@ -100,7 +100,6 @@ target_link_libraries( pl_editor_kiface
...
@@ -100,7 +100,6 @@ target_link_libraries( pl_editor_kiface
common
common
polygon
polygon
bitmaps
bitmaps
${
OPENGL_LIBRARIES
}
${
wxWidgets_LIBRARIES
}
${
wxWidgets_LIBRARIES
}
${
GDI_PLUS_LIBRARIES
}
${
GDI_PLUS_LIBRARIES
}
)
)
...
...
pcbnew/CMakeLists.txt
View file @
f261bf38
...
@@ -271,6 +271,7 @@ set( PCBNEW_CLASS_SRCS
...
@@ -271,6 +271,7 @@ set( PCBNEW_CLASS_SRCS
tools/selection_tool.cpp
tools/selection_tool.cpp
tools/selection_area.cpp
tools/selection_area.cpp
tools/selection_conditions.cpp
tools/selection_conditions.cpp
tools/conditional_menu.cpp
tools/bright_box.cpp
tools/bright_box.cpp
tools/edit_points.cpp
tools/edit_points.cpp
tools/edit_constraints.cpp
tools/edit_constraints.cpp
...
@@ -284,6 +285,9 @@ set( PCBNEW_CLASS_SRCS
...
@@ -284,6 +285,9 @@ set( PCBNEW_CLASS_SRCS
tools/common_actions.cpp
tools/common_actions.cpp
tools/grid_helper.cpp
tools/grid_helper.cpp
tools/tools_common.cpp
tools/tools_common.cpp
tools/grid_menu.cpp
tools/zoom_menu.cpp
)
)
set
(
PCBNEW_SRCS
${
PCBNEW_AUTOROUTER_SRCS
}
${
PCBNEW_CLASS_SRCS
}
${
PCBNEW_DIALOGS
}
)
set
(
PCBNEW_SRCS
${
PCBNEW_AUTOROUTER_SRCS
}
${
PCBNEW_CLASS_SRCS
}
${
PCBNEW_DIALOGS
}
)
...
@@ -413,11 +417,7 @@ if( KICAD_SCRIPTING_MODULES )
...
@@ -413,11 +417,7 @@ if( KICAD_SCRIPTING_MODULES )
polygon
polygon
bitmaps
bitmaps
gal
gal
${
GLEW_LIBRARIES
}
${
CAIRO_LIBRARIES
}
${
PIXMAN_LIBRARY
}
${
wxWidgets_LIBRARIES
}
${
wxWidgets_LIBRARIES
}
${
OPENGL_LIBRARIES
}
${
GDI_PLUS_LIBRARIES
}
${
GDI_PLUS_LIBRARIES
}
${
PYTHON_LIBRARIES
}
${
PYTHON_LIBRARIES
}
${
PCBNEW_EXTRA_LIBS
}
${
PCBNEW_EXTRA_LIBS
}
...
@@ -583,12 +583,8 @@ target_link_libraries( pcbnew_kiface
...
@@ -583,12 +583,8 @@ target_link_libraries( pcbnew_kiface
idf3
idf3
${
GITHUB_PLUGIN_LIBRARIES
}
${
GITHUB_PLUGIN_LIBRARIES
}
${
wxWidgets_LIBRARIES
}
${
wxWidgets_LIBRARIES
}
${
OPENGL_LIBRARIES
}
${
GDI_PLUS_LIBRARIES
}
${
GDI_PLUS_LIBRARIES
}
${
PYTHON_LIBRARIES
}
${
PYTHON_LIBRARIES
}
${
GLEW_LIBRARIES
}
${
CAIRO_LIBRARIES
}
${
PIXMAN_LIBRARY
}
${
Boost_LIBRARIES
}
# must follow GITHUB
${
Boost_LIBRARIES
}
# must follow GITHUB
${
PCBNEW_EXTRA_LIBS
}
# -lrt must follow Boost
${
PCBNEW_EXTRA_LIBS
}
# -lrt must follow Boost
${
OPENMP_LIBRARIES
}
${
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
...
@@ -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
)
EDA_DRAW_FRAME
(
aKiway
,
aParent
,
aFrameType
,
aTitle
,
aPos
,
aSize
,
aStyle
,
aFrameName
)
{
{
m_Pcb
=
NULL
;
m_Pcb
=
NULL
;
m_toolManager
=
NULL
;
m_toolDispatcher
=
NULL
;
m_Draw3DFrame
=
NULL
;
// Display Window in 3D mode (OpenGL)
m_Draw3DFrame
=
NULL
;
// Display Window in 3D mode (OpenGL)
m_UserGridSize
=
wxRealPoint
(
100.0
,
100.0
);
m_UserGridSize
=
wxRealPoint
(
100.0
,
100.0
);
...
@@ -119,12 +117,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
...
@@ -119,12 +117,7 @@ PCB_BASE_FRAME::PCB_BASE_FRAME( KIWAY* aKiway, wxWindow* aParent, FRAME_T aFrame
PCB_BASE_FRAME
::~
PCB_BASE_FRAME
()
PCB_BASE_FRAME
::~
PCB_BASE_FRAME
()
{
{
delete
m_Collector
;
delete
m_Collector
;
delete
m_toolManager
;
delete
m_toolDispatcher
;
delete
m_Pcb
;
delete
m_Pcb
;
delete
GetGalCanvas
();
}
}
...
...
pcbnew/dialogs/dialog_set_grid.cpp
View file @
f261bf38
...
@@ -34,8 +34,10 @@
...
@@ -34,8 +34,10 @@
#include <pcbnew_id.h>
#include <pcbnew_id.h>
#include <dialog_set_grid_base.h>
#include <dialog_set_grid_base.h>
#include <invoke_pcb_dialog.h>
#include <invoke_pcb_dialog.h>
#include <gal/graphics_abstraction_layer.h>
#include <gal/graphics_abstraction_layer.h>
#include <class_draw_panel_gal.h>
#include <class_draw_panel_gal.h>
#include <tool/tool_manager.h>
class
DIALOG_SET_GRID
:
public
DIALOG_SET_GRID_BASE
class
DIALOG_SET_GRID
:
public
DIALOG_SET_GRID_BASE
...
@@ -227,12 +229,12 @@ bool PCB_BASE_FRAME::InvokeDialogGrid()
...
@@ -227,12 +229,12 @@ bool PCB_BASE_FRAME::InvokeDialogGrid()
if
(
screen
->
GetGridId
()
==
ID_POPUP_GRID_USER
)
if
(
screen
->
GetGridId
()
==
ID_POPUP_GRID_USER
)
screen
->
SetGrid
(
ID_POPUP_GRID_USER
);
screen
->
SetGrid
(
ID_POPUP_GRID_USER
);
if
(
IsGalCanvasActive
()
)
// Notify GAL
{
TOOL_MANAGER
*
mgr
=
GetToolManager
();
GetGalCanvas
()
->
GetGAL
()
->
SetGridSize
(
VECTOR2D
(
screen
->
GetGrid
().
m_Size
.
x
,
screen
->
GetGrid
().
m_Size
.
y
)
);
if
(
mgr
&&
IsGalCanvasActive
()
)
GetGalCanvas
()
->
GetView
()
->
MarkTargetDirty
(
KIGFX
::
TARGET_NONCACHED
);
mgr
->
RunAction
(
"common.Control.gridPreset"
,
true
,
}
ID_POPUP_GRID_USER
-
ID_POPUP_GRID_LEVEL_1000
);
m_canvas
->
Refresh
();
m_canvas
->
Refresh
();
...
...
pcbnew/ratsnest_data.cpp
View file @
f261bf38
...
@@ -1182,9 +1182,10 @@ void RN_DATA::Recalculate( int aNet )
...
@@ -1182,9 +1182,10 @@ void RN_DATA::Recalculate( int aNet )
if
(
netCount
>
m_nets
.
size
()
)
if
(
netCount
>
m_nets
.
size
()
)
m_nets
.
resize
(
netCount
);
m_nets
.
resize
(
netCount
);
if
(
aNet
<
0
)
// Recompute everything
if
(
aNet
<
0
&&
netCount
>
1
)
// Recompute everything
{
{
unsigned
int
i
;
unsigned
int
i
;
#ifdef USE_OPENMP
#ifdef USE_OPENMP
#pragma omp parallel shared(netCount) private(i)
#pragma omp parallel shared(netCount) private(i)
{
{
...
...
pcbnew/router/router_tool.cpp
View file @
f261bf38
...
@@ -96,8 +96,7 @@ public:
...
@@ -96,8 +96,7 @@ public:
{
{
m_board
=
NULL
;
m_board
=
NULL
;
SetIcon
(
width_track_via_xpm
);
SetIcon
(
width_track_via_xpm
);
setCustomEventHandler
(
boost
::
bind
(
&
CONTEXT_TRACK_WIDTH_MENU
::
handleCustomEvent
,
SetMenuHandler
(
boost
::
bind
(
&
CONTEXT_TRACK_WIDTH_MENU
::
EventHandler
,
this
,
_1
)
);
this
,
_1
)
);
}
}
void
SetBoard
(
BOARD
*
aBoard
)
void
SetBoard
(
BOARD
*
aBoard
)
...
@@ -153,8 +152,7 @@ public:
...
@@ -153,8 +152,7 @@ public:
}
}
}
}
protected
:
OPT_TOOL_EVENT
EventHandler
(
const
wxMenuEvent
&
aEvent
)
OPT_TOOL_EVENT
handleCustomEvent
(
const
wxMenuEvent
&
aEvent
)
{
{
#if ID_POPUP_PCB_SELECT_VIASIZE1 < ID_POPUP_PCB_SELECT_WIDTH1
#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.
#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.
* 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>
* @author Maciej Suminski <maciej.suminski@cern.ch>
*
*
* This program is free software; you can redistribute it and/or
* This program is free software; you can redistribute it and/or
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include "common_actions.h"
#include "common_actions.h"
#include <tool/action_manager.h>
#include <tool/action_manager.h>
#include <pcbnew_id.h>
#include <pcbnew_id.h>
#include <layers_id_colors_and_visibility.h>
#include <wx/defs.h>
#include <wx/defs.h>
// These members are static in class COMMON_ACTIONS: Build them here:
// These members are static in class COMMON_ACTIONS: Build them here:
...
@@ -121,7 +122,7 @@ TOOL_ACTION COMMON_ACTIONS::flip( "pcbnew.InteractiveEdit.flip",
...
@@ -121,7 +122,7 @@ TOOL_ACTION COMMON_ACTIONS::flip( "pcbnew.InteractiveEdit.flip",
TOOL_ACTION
COMMON_ACTIONS
::
remove
(
"pcbnew.InteractiveEdit.remove"
,
TOOL_ACTION
COMMON_ACTIONS
::
remove
(
"pcbnew.InteractiveEdit.remove"
,
AS_GLOBAL
,
WXK_DELETE
,
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"
,
TOOL_ACTION
COMMON_ACTIONS
::
properties
(
"pcbnew.InteractiveEdit.properties"
,
AS_GLOBAL
,
'E'
,
AS_GLOBAL
,
'E'
,
...
@@ -180,28 +181,32 @@ TOOL_ACTION COMMON_ACTIONS::arcPosture( "pcbnew.InteractiveDrawing.arcPosture",
...
@@ -180,28 +181,32 @@ TOOL_ACTION COMMON_ACTIONS::arcPosture( "pcbnew.InteractiveDrawing.arcPosture",
// View Controls
// View Controls
TOOL_ACTION
COMMON_ACTIONS
::
zoomIn
(
"
pcbnew
.Control.zoomIn"
,
TOOL_ACTION
COMMON_ACTIONS
::
zoomIn
(
"
common
.Control.zoomIn"
,
AS_GLOBAL
,
WXK_F1
,
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
,
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
,
AS_GLOBAL
,
0
,
""
,
""
);
""
,
""
);
TOOL_ACTION
COMMON_ACTIONS
::
zoomOutCenter
(
"
pcbnew
.Control.zoomOutCenter"
,
TOOL_ACTION
COMMON_ACTIONS
::
zoomOutCenter
(
"
common
.Control.zoomOutCenter"
,
AS_GLOBAL
,
0
,
AS_GLOBAL
,
0
,
""
,
""
);
""
,
""
);
TOOL_ACTION
COMMON_ACTIONS
::
zoomCenter
(
"
pcbnew
.Control.zoomCenter"
,
TOOL_ACTION
COMMON_ACTIONS
::
zoomCenter
(
"
common
.Control.zoomCenter"
,
AS_GLOBAL
,
WXK_F4
,
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
,
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",
...
@@ -246,35 +251,35 @@ TOOL_ACTION COMMON_ACTIONS::highContrastDec( "pcbnew.Control.highContrastDec",
// Layer control
// Layer control
TOOL_ACTION
COMMON_ACTIONS
::
layerTop
(
"pcbnew.Control.layerTop"
,
TOOL_ACTION
COMMON_ACTIONS
::
layerTop
(
"pcbnew.Control.layerTop"
,
AS_GLOBAL
,
WXK_PAGEUP
,
AS_GLOBAL
,
WXK_PAGEUP
,
""
,
""
);
""
,
""
,
NULL
,
AF_NONE
,
(
void
*
)
F_Cu
);
TOOL_ACTION
COMMON_ACTIONS
::
layerInner1
(
"pcbnew.Control.layerInner1"
,
TOOL_ACTION
COMMON_ACTIONS
::
layerInner1
(
"pcbnew.Control.layerInner1"
,
AS_GLOBAL
,
WXK_F5
,
AS_GLOBAL
,
WXK_F5
,
""
,
""
);
""
,
""
,
NULL
,
AF_NONE
,
(
void
*
)
In1_Cu
);
TOOL_ACTION
COMMON_ACTIONS
::
layerInner2
(
"pcbnew.Control.layerInner2"
,
TOOL_ACTION
COMMON_ACTIONS
::
layerInner2
(
"pcbnew.Control.layerInner2"
,
AS_GLOBAL
,
WXK_F6
,
AS_GLOBAL
,
WXK_F6
,
""
,
""
);
""
,
""
,
NULL
,
AF_NONE
,
(
void
*
)
In2_Cu
);
TOOL_ACTION
COMMON_ACTIONS
::
layerInner3
(
"pcbnew.Control.layerInner3"
,
TOOL_ACTION
COMMON_ACTIONS
::
layerInner3
(
"pcbnew.Control.layerInner3"
,
AS_GLOBAL
,
WXK_F7
,
AS_GLOBAL
,
WXK_F7
,
""
,
""
);
""
,
""
,
NULL
,
AF_NONE
,
(
void
*
)
In3_Cu
);
TOOL_ACTION
COMMON_ACTIONS
::
layerInner4
(
"pcbnew.Control.layerInner4"
,
TOOL_ACTION
COMMON_ACTIONS
::
layerInner4
(
"pcbnew.Control.layerInner4"
,
AS_GLOBAL
,
WXK_F8
,
AS_GLOBAL
,
WXK_F8
,
""
,
""
);
""
,
""
,
NULL
,
AF_NONE
,
(
void
*
)
In4_Cu
);
TOOL_ACTION
COMMON_ACTIONS
::
layerInner5
(
"pcbnew.Control.layerInner5"
,
TOOL_ACTION
COMMON_ACTIONS
::
layerInner5
(
"pcbnew.Control.layerInner5"
,
AS_GLOBAL
,
WXK_F9
,
AS_GLOBAL
,
WXK_F9
,
""
,
""
);
""
,
""
,
NULL
,
AF_NONE
,
(
void
*
)
In5_Cu
);
TOOL_ACTION
COMMON_ACTIONS
::
layerInner6
(
"pcbnew.Control.layerInner6"
,
TOOL_ACTION
COMMON_ACTIONS
::
layerInner6
(
"pcbnew.Control.layerInner6"
,
AS_GLOBAL
,
WXK_F10
,
AS_GLOBAL
,
WXK_F10
,
""
,
""
);
""
,
""
,
NULL
,
AF_NONE
,
(
void
*
)
In6_Cu
);
TOOL_ACTION
COMMON_ACTIONS
::
layerBottom
(
"pcbnew.Control.layerBottom"
,
TOOL_ACTION
COMMON_ACTIONS
::
layerBottom
(
"pcbnew.Control.layerBottom"
,
AS_GLOBAL
,
WXK_PAGEDOWN
,
AS_GLOBAL
,
WXK_PAGEDOWN
,
""
,
""
);
""
,
""
,
NULL
,
AF_NONE
,
(
void
*
)
B_Cu
);
TOOL_ACTION
COMMON_ACTIONS
::
layerNext
(
"pcbnew.Control.layerNext"
,
TOOL_ACTION
COMMON_ACTIONS
::
layerNext
(
"pcbnew.Control.layerNext"
,
AS_GLOBAL
,
'+'
,
AS_GLOBAL
,
'+'
,
...
@@ -298,26 +303,29 @@ TOOL_ACTION COMMON_ACTIONS::layerChanged( "pcbnew.Control.layerChanged",
...
@@ -298,26 +303,29 @@ TOOL_ACTION COMMON_ACTIONS::layerChanged( "pcbnew.Control.layerChanged",
// Grid control
// Grid control
TOOL_ACTION
COMMON_ACTIONS
::
gridFast1
(
"
pcbnew
.Control.gridFast1"
,
TOOL_ACTION
COMMON_ACTIONS
::
gridFast1
(
"
common
.Control.gridFast1"
,
AS_GLOBAL
,
MD_ALT
+
int
(
'1'
),
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'
),
AS_GLOBAL
,
MD_ALT
+
int
(
'2'
),
""
,
""
);
""
,
""
);
TOOL_ACTION
COMMON_ACTIONS
::
gridNext
(
"
pcbnew
.Control.gridNext"
,
TOOL_ACTION
COMMON_ACTIONS
::
gridNext
(
"
common
.Control.gridNext"
,
AS_GLOBAL
,
'`'
,
AS_GLOBAL
,
'`'
,
""
,
""
);
""
,
""
);
TOOL_ACTION
COMMON_ACTIONS
::
gridPrev
(
"
pcbnew
.Control.gridPrev"
,
TOOL_ACTION
COMMON_ACTIONS
::
gridPrev
(
"
common
.Control.gridPrev"
,
AS_GLOBAL
,
MD_CTRL
+
int
(
'`'
),
AS_GLOBAL
,
MD_CTRL
+
int
(
'`'
),
""
,
""
);
""
,
""
);
TOOL_ACTION
COMMON_ACTIONS
::
gridSetOrigin
(
"
pcbnew
.Control.gridSetOrigin"
,
TOOL_ACTION
COMMON_ACTIONS
::
gridSetOrigin
(
"
common
.Control.gridSetOrigin"
,
AS_GLOBAL
,
0
,
AS_GLOBAL
,
0
,
""
,
""
);
""
,
""
);
TOOL_ACTION
COMMON_ACTIONS
::
gridPreset
(
"common.Control.gridPreset"
,
AS_GLOBAL
,
0
,
""
,
""
);
// Track & via size control
// Track & via size control
TOOL_ACTION
COMMON_ACTIONS
::
trackWidthInc
(
"pcbnew.EditorControl.trackWidthInc"
,
TOOL_ACTION
COMMON_ACTIONS
::
trackWidthInc
(
"pcbnew.EditorControl.trackWidthInc"
,
...
...
pcbnew/tools/common_actions.h
View file @
f261bf38
...
@@ -188,6 +188,7 @@ public:
...
@@ -188,6 +188,7 @@ public:
static
TOOL_ACTION
zoomOutCenter
;
static
TOOL_ACTION
zoomOutCenter
;
static
TOOL_ACTION
zoomCenter
;
static
TOOL_ACTION
zoomCenter
;
static
TOOL_ACTION
zoomFitScreen
;
static
TOOL_ACTION
zoomFitScreen
;
static
TOOL_ACTION
zoomPreset
;
// Display modes
// Display modes
static
TOOL_ACTION
trackDisplayMode
;
static
TOOL_ACTION
trackDisplayMode
;
...
@@ -222,6 +223,7 @@ public:
...
@@ -222,6 +223,7 @@ public:
static
TOOL_ACTION
gridNext
;
static
TOOL_ACTION
gridNext
;
static
TOOL_ACTION
gridPrev
;
static
TOOL_ACTION
gridPrev
;
static
TOOL_ACTION
gridSetOrigin
;
static
TOOL_ACTION
gridSetOrigin
;
static
TOOL_ACTION
gridPreset
;
// Track & via size control
// Track & via size control
static
TOOL_ACTION
trackWidthInc
;
static
TOOL_ACTION
trackWidthInc
;
...
...
pcbnew/tools/drawing_tool.cpp
View file @
f261bf38
...
@@ -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 @
f261bf38
...
@@ -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 @
f261bf38
...
@@ -79,25 +79,23 @@ bool EDIT_TOOL::Init()
...
@@ -79,25 +79,23 @@ bool EDIT_TOOL::Init()
}
}
// Add context menu entries that are displayed when selection tool is active
// Add context menu entries that are displayed when selection tool is active
m_selectionTool
->
AddMenu
Item
(
COMMON_ACTIONS
::
editActivate
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
GetMenu
().
Add
Item
(
COMMON_ACTIONS
::
editActivate
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
AddMenu
Item
(
COMMON_ACTIONS
::
rotate
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
GetMenu
().
Add
Item
(
COMMON_ACTIONS
::
rotate
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
AddMenu
Item
(
COMMON_ACTIONS
::
flip
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
GetMenu
().
Add
Item
(
COMMON_ACTIONS
::
flip
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
AddMenu
Item
(
COMMON_ACTIONS
::
remove
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
GetMenu
().
Add
Item
(
COMMON_ACTIONS
::
remove
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
AddMenu
Item
(
COMMON_ACTIONS
::
properties
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
GetMenu
().
Add
Item
(
COMMON_ACTIONS
::
properties
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
AddMenu
Item
(
COMMON_ACTIONS
::
moveExact
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
GetMenu
().
Add
Item
(
COMMON_ACTIONS
::
moveExact
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
AddMenu
Item
(
COMMON_ACTIONS
::
duplicate
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
GetMenu
().
Add
Item
(
COMMON_ACTIONS
::
duplicate
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
AddMenu
Item
(
COMMON_ACTIONS
::
createArray
,
SELECTION_CONDITIONS
::
NotEmpty
);
m_selectionTool
->
GetMenu
().
Add
Item
(
COMMON_ACTIONS
::
createArray
,
SELECTION_CONDITIONS
::
NotEmpty
);
// Footprint actions
// Footprint actions
m_selectionTool
->
AddMenu
Item
(
COMMON_ACTIONS
::
editFootprintInFpEditor
,
m_selectionTool
->
GetMenu
().
Add
Item
(
COMMON_ACTIONS
::
editFootprintInFpEditor
,
SELECTION_CONDITIONS
::
OnlyType
(
PCB_MODULE_T
)
&&
SELECTION_CONDITIONS
::
OnlyType
(
PCB_MODULE_T
)
&&
SELECTION_CONDITIONS
::
Count
(
1
)
);
SELECTION_CONDITIONS
::
Count
(
1
)
);
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 @
f261bf38
...
@@ -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 @
f261bf38
...
@@ -74,9 +74,7 @@ bool MODULE_TOOLS::Init()
...
@@ -74,9 +74,7 @@ bool MODULE_TOOLS::Init()
return
false
;
return
false
;
}
}
selectionTool
->
AddMenuItem
(
COMMON_ACTIONS
::
enumeratePads
);
selectionTool
->
GetMenu
().
AddItem
(
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 @
f261bf38
...
@@ -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 @
f261bf38
...
@@ -74,12 +74,10 @@ bool PCB_EDITOR_CONTROL::Init()
...
@@ -74,12 +74,10 @@ bool PCB_EDITOR_CONTROL::Init()
if
(
selTool
)
if
(
selTool
)
{
{
selTool
->
AddSubMenu
(
new
ZONE_CONTEXT_MENU
,
_
(
"Zones"
)
,
selTool
->
GetMenu
().
AddMenu
(
new
ZONE_CONTEXT_MENU
,
_
(
"Zones"
),
false
,
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 @
f261bf38
...
@@ -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 @
f261bf38
...
@@ -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
;
}
}
...
@@ -111,18 +100,17 @@ int PCBNEW_CONTROL::ZoomFitScreen( const TOOL_EVENT& aEvent )
...
@@ -111,18 +100,17 @@ int PCBNEW_CONTROL::ZoomFitScreen( const TOOL_EVENT& aEvent )
BOARD
*
board
=
getModel
<
BOARD
>
();
BOARD
*
board
=
getModel
<
BOARD
>
();
board
->
ComputeBoundingBox
();
board
->
ComputeBoundingBox
();
BOX2I
boardBBox
=
board
->
ViewBBox
();
BOX2I
boardBBox
=
board
->
ViewBBox
();
VECTOR2I
screenSize
=
gal
->
GetScreenPixelSize
();
if
(
boardBBox
.
GetSize
().
x
==
0
||
boardBBox
.
GetSize
().
y
==
0
)
if
(
boardBBox
.
GetSize
().
x
==
0
||
boardBBox
.
GetSize
().
y
==
0
)
{
{
// Empty view
// Empty view
view
->
Set
Scale
(
100000.0
);
view
->
Set
Center
(
view
->
ToWorld
(
VECTOR2D
(
screenSize
.
x
/
2
,
screenSize
.
y
/
2
)
)
);
view
->
Set
Center
(
VECTOR2D
(
0
,
0
)
);
view
->
Set
Scale
(
17.0
);
}
}
else
else
{
{
// Autozoom to board
// Autozoom to board
VECTOR2I
screenSize
=
gal
->
GetScreenPixelSize
();
double
iuPerX
=
screenSize
.
x
?
boardBBox
.
GetWidth
()
/
screenSize
.
x
:
1.0
;
double
iuPerX
=
screenSize
.
x
?
boardBBox
.
GetWidth
()
/
screenSize
.
x
:
1.0
;
double
iuPerY
=
screenSize
.
y
?
boardBBox
.
GetHeight
()
/
screenSize
.
y
:
1.0
;
double
iuPerY
=
screenSize
.
y
?
boardBBox
.
GetHeight
()
/
screenSize
.
y
:
1.0
;
...
@@ -130,11 +118,36 @@ int PCBNEW_CONTROL::ZoomFitScreen( const TOOL_EVENT& aEvent )
...
@@ -130,11 +118,36 @@ int PCBNEW_CONTROL::ZoomFitScreen( const TOOL_EVENT& aEvent )
double
zoomFactor
=
gal
->
GetWorldScale
()
/
gal
->
GetZoomFactor
();
double
zoomFactor
=
gal
->
GetWorldScale
()
/
gal
->
GetZoomFactor
();
double
zoom
=
1.0
/
(
zoomFactor
*
bestZoom
);
double
zoom
=
1.0
/
(
zoomFactor
*
bestZoom
);
view
->
SetScale
(
zoom
);
view
->
SetCenter
(
boardBBox
.
Centre
()
);
view
->
SetCenter
(
boardBBox
.
Centre
()
);
view
->
SetScale
(
zoom
);
}
return
0
;
}
int
PCBNEW_CONTROL
::
ZoomPreset
(
const
TOOL_EVENT
&
aEvent
)
{
unsigned
int
idx
=
aEvent
.
Parameter
<
long
>
();
std
::
vector
<
int
>&
zoomList
=
m_frame
->
GetScreen
()
->
m_ZoomList
;
KIGFX
::
VIEW
*
view
=
m_frame
->
GetGalCanvas
()
->
GetView
();
KIGFX
::
GAL
*
gal
=
m_frame
->
GetGalCanvas
()
->
GetGAL
();
m_frame
->
SetPresetZoom
(
idx
);
if
(
idx
==
0
)
// Zoom Auto
{
return
ZoomFitScreen
(
aEvent
);
}
else
if
(
idx
<
0
||
idx
>=
zoomList
.
size
()
)
{
assert
(
false
);
return
0
;
}
}
setTransitions
();
double
selectedZoom
=
zoomList
[
idx
];
double
zoomFactor
=
gal
->
GetWorldScale
()
/
gal
->
GetZoomFactor
();
view
->
SetScale
(
1.0
/
(
zoomFactor
*
selectedZoom
)
);
return
0
;
return
0
;
}
}
...
@@ -159,7 +172,6 @@ int PCBNEW_CONTROL::TrackDisplayMode( const TOOL_EVENT& aEvent )
...
@@ -159,7 +172,6 @@ int PCBNEW_CONTROL::TrackDisplayMode( const TOOL_EVENT& aEvent )
}
}
m_frame
->
GetGalCanvas
()
->
Refresh
();
m_frame
->
GetGalCanvas
()
->
Refresh
();
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -184,7 +196,6 @@ int PCBNEW_CONTROL::PadDisplayMode( const TOOL_EVENT& aEvent )
...
@@ -184,7 +196,6 @@ int PCBNEW_CONTROL::PadDisplayMode( const TOOL_EVENT& aEvent )
}
}
m_frame
->
GetGalCanvas
()
->
Refresh
();
m_frame
->
GetGalCanvas
()
->
Refresh
();
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -209,7 +220,6 @@ int PCBNEW_CONTROL::ViaDisplayMode( const TOOL_EVENT& aEvent )
...
@@ -209,7 +220,6 @@ int PCBNEW_CONTROL::ViaDisplayMode( const TOOL_EVENT& aEvent )
}
}
m_frame
->
GetGalCanvas
()
->
Refresh
();
m_frame
->
GetGalCanvas
()
->
Refresh
();
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -240,7 +250,6 @@ int PCBNEW_CONTROL::ZoneDisplayMode( const TOOL_EVENT& aEvent )
...
@@ -240,7 +250,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
;
}
}
...
@@ -258,8 +267,6 @@ int PCBNEW_CONTROL::HighContrastMode( const TOOL_EVENT& aEvent )
...
@@ -258,8 +267,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
;
}
}
...
@@ -267,7 +274,6 @@ int PCBNEW_CONTROL::HighContrastMode( const TOOL_EVENT& aEvent )
...
@@ -267,7 +274,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
;
}
}
...
@@ -276,7 +282,6 @@ int PCBNEW_CONTROL::HighContrastInc( const TOOL_EVENT& aEvent )
...
@@ -276,7 +282,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
;
}
}
...
@@ -285,24 +290,7 @@ int PCBNEW_CONTROL::HighContrastDec( const TOOL_EVENT& aEvent )
...
@@ -285,24 +290,7 @@ int PCBNEW_CONTROL::HighContrastDec( const TOOL_EVENT& aEvent )
// Layer control
// Layer control
int
PCBNEW_CONTROL
::
LayerSwitch
(
const
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
LayerSwitch
(
const
TOOL_EVENT
&
aEvent
)
{
{
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
layerTop
)
)
m_frame
->
SwitchLayer
(
NULL
,
(
LAYER_ID
)
aEvent
.
Parameter
<
long
>
()
);
m_frame
->
SwitchLayer
(
NULL
,
F_Cu
);
else
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
layerInner1
)
)
m_frame
->
SwitchLayer
(
NULL
,
In1_Cu
);
else
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
layerInner2
)
)
m_frame
->
SwitchLayer
(
NULL
,
In2_Cu
);
else
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
layerInner3
)
)
m_frame
->
SwitchLayer
(
NULL
,
In3_Cu
);
else
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
layerInner4
)
)
m_frame
->
SwitchLayer
(
NULL
,
In4_Cu
);
else
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
layerInner5
)
)
m_frame
->
SwitchLayer
(
NULL
,
In5_Cu
);
else
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
layerInner6
)
)
m_frame
->
SwitchLayer
(
NULL
,
In6_Cu
);
else
if
(
aEvent
.
IsAction
(
&
COMMON_ACTIONS
::
layerBottom
)
)
m_frame
->
SwitchLayer
(
NULL
,
B_Cu
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -314,10 +302,7 @@ int PCBNEW_CONTROL::LayerNext( const TOOL_EVENT& aEvent )
...
@@ -314,10 +302,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
();
...
@@ -330,7 +315,6 @@ int PCBNEW_CONTROL::LayerNext( const TOOL_EVENT& aEvent )
...
@@ -330,7 +315,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
;
}
}
...
@@ -342,10 +326,7 @@ int PCBNEW_CONTROL::LayerPrev( const TOOL_EVENT& aEvent )
...
@@ -342,10 +326,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
();
...
@@ -358,7 +339,6 @@ int PCBNEW_CONTROL::LayerPrev( const TOOL_EVENT& aEvent )
...
@@ -358,7 +339,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
;
}
}
...
@@ -381,8 +361,6 @@ int PCBNEW_CONTROL::LayerAlphaInc( const TOOL_EVENT& aEvent )
...
@@ -381,8 +361,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
;
}
}
...
@@ -404,8 +382,6 @@ int PCBNEW_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
...
@@ -404,8 +382,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
;
}
}
...
@@ -414,7 +390,6 @@ int PCBNEW_CONTROL::LayerAlphaDec( const TOOL_EVENT& aEvent )
...
@@ -414,7 +390,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
;
}
}
...
@@ -423,7 +398,6 @@ int PCBNEW_CONTROL::GridFast1( const TOOL_EVENT& aEvent )
...
@@ -423,7 +398,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
;
}
}
...
@@ -432,7 +406,6 @@ int PCBNEW_CONTROL::GridFast2( const TOOL_EVENT& aEvent )
...
@@ -432,7 +406,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
;
}
}
...
@@ -441,7 +414,6 @@ int PCBNEW_CONTROL::GridNext( const TOOL_EVENT& aEvent )
...
@@ -441,7 +414,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
;
}
}
...
@@ -450,8 +422,7 @@ int PCBNEW_CONTROL::GridPrev( const TOOL_EVENT& aEvent )
...
@@ -450,8 +422,7 @@ int PCBNEW_CONTROL::GridPrev( const TOOL_EVENT& aEvent )
int
PCBNEW_CONTROL
::
GridSetOrigin
(
const
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
GridSetOrigin
(
const
TOOL_EVENT
&
aEvent
)
{
{
Activate
();
Activate
();
m_frame
->
SetToolID
(
ID_PCB_PLACE_GRID_COORD_BUTT
,
wxCURSOR_PENCIL
,
m_frame
->
SetToolID
(
ID_PCB_PLACE_GRID_COORD_BUTT
,
wxCURSOR_PENCIL
,
_
(
"Adjust grid origin"
)
);
_
(
"Adjust grid origin"
)
);
KIGFX
::
VIEW_CONTROLS
*
controls
=
getViewControls
();
KIGFX
::
VIEW_CONTROLS
*
controls
=
getViewControls
();
controls
->
ShowCursor
(
true
);
controls
->
ShowCursor
(
true
);
...
@@ -473,13 +444,27 @@ int PCBNEW_CONTROL::GridSetOrigin( const TOOL_EVENT& aEvent )
...
@@ -473,13 +444,27 @@ 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
;
}
}
int
PCBNEW_CONTROL
::
GridPreset
(
const
TOOL_EVENT
&
aEvent
)
{
long
idx
=
aEvent
.
Parameter
<
long
>
();
m_frame
->
SetPresetGrid
(
idx
);
BASE_SCREEN
*
screen
=
m_frame
->
GetScreen
();
GRID_TYPE
grid
=
screen
->
GetGrid
(
idx
);
getView
()
->
GetGAL
()
->
SetGridSize
(
VECTOR2D
(
grid
.
m_Size
)
);
getView
()
->
MarkTargetDirty
(
KIGFX
::
TARGET_NONCACHED
);
return
0
;
}
// Miscellaneous
// Miscellaneous
int
PCBNEW_CONTROL
::
ResetCoords
(
const
TOOL_EVENT
&
aEvent
)
int
PCBNEW_CONTROL
::
ResetCoords
(
const
TOOL_EVENT
&
aEvent
)
{
{
...
@@ -487,7 +472,6 @@ int PCBNEW_CONTROL::ResetCoords( const TOOL_EVENT& aEvent )
...
@@ -487,7 +472,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
;
}
}
...
@@ -505,8 +489,6 @@ int PCBNEW_CONTROL::SwitchCursor( const TOOL_EVENT& aEvent )
...
@@ -505,8 +489,6 @@ int PCBNEW_CONTROL::SwitchCursor( const TOOL_EVENT& aEvent )
else
else
gal
->
SetCursorSize
(
BIG_CURSOR
);
gal
->
SetCursorSize
(
BIG_CURSOR
);
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -522,7 +504,6 @@ int PCBNEW_CONTROL::SwitchUnits( const TOOL_EVENT& aEvent )
...
@@ -522,7 +504,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
;
}
}
...
@@ -532,7 +513,6 @@ int PCBNEW_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
...
@@ -532,7 +513,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
;
}
}
...
@@ -541,13 +521,12 @@ int PCBNEW_CONTROL::ShowHelp( const TOOL_EVENT& aEvent )
...
@@ -541,13 +521,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
()
);
...
@@ -556,6 +535,7 @@ void PCBNEW_CONTROL::setTransitions()
...
@@ -556,6 +535,7 @@ void PCBNEW_CONTROL::setTransitions()
Go
(
&
PCBNEW_CONTROL
::
ZoomInOutCenter
,
COMMON_ACTIONS
::
zoomOutCenter
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
ZoomInOutCenter
,
COMMON_ACTIONS
::
zoomOutCenter
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
ZoomCenter
,
COMMON_ACTIONS
::
zoomCenter
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
ZoomCenter
,
COMMON_ACTIONS
::
zoomCenter
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
ZoomFitScreen
,
COMMON_ACTIONS
::
zoomFitScreen
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
ZoomFitScreen
,
COMMON_ACTIONS
::
zoomFitScreen
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
ZoomPreset
,
COMMON_ACTIONS
::
zoomPreset
.
MakeEvent
()
);
// Display modes
// Display modes
Go
(
&
PCBNEW_CONTROL
::
TrackDisplayMode
,
COMMON_ACTIONS
::
trackDisplayMode
.
MakeEvent
()
);
Go
(
&
PCBNEW_CONTROL
::
TrackDisplayMode
,
COMMON_ACTIONS
::
trackDisplayMode
.
MakeEvent
()
);
...
@@ -588,6 +568,7 @@ void PCBNEW_CONTROL::setTransitions()
...
@@ -588,6 +568,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
::
GridPreset
,
COMMON_ACTIONS
::
gridPreset
.
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 @
f261bf38
...
@@ -43,14 +43,12 @@ public:
...
@@ -43,14 +43,12 @@ 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
);
int
ZoomCenter
(
const
TOOL_EVENT
&
aEvent
);
int
ZoomCenter
(
const
TOOL_EVENT
&
aEvent
);
int
ZoomFitScreen
(
const
TOOL_EVENT
&
aEvent
);
int
ZoomFitScreen
(
const
TOOL_EVENT
&
aEvent
);
int
ZoomPreset
(
const
TOOL_EVENT
&
aEvent
);
// Display modes
// Display modes
int
TrackDisplayMode
(
const
TOOL_EVENT
&
aEvent
);
int
TrackDisplayMode
(
const
TOOL_EVENT
&
aEvent
);
...
@@ -74,6 +72,7 @@ public:
...
@@ -74,6 +72,7 @@ public:
int
GridNext
(
const
TOOL_EVENT
&
aEvent
);
int
GridNext
(
const
TOOL_EVENT
&
aEvent
);
int
GridPrev
(
const
TOOL_EVENT
&
aEvent
);
int
GridPrev
(
const
TOOL_EVENT
&
aEvent
);
int
GridSetOrigin
(
const
TOOL_EVENT
&
aEvent
);
int
GridSetOrigin
(
const
TOOL_EVENT
&
aEvent
);
int
GridPreset
(
const
TOOL_EVENT
&
aEvent
);
// Miscellaneous
// Miscellaneous
int
ResetCoords
(
const
TOOL_EVENT
&
aEvent
);
int
ResetCoords
(
const
TOOL_EVENT
&
aEvent
);
...
@@ -82,10 +81,10 @@ public:
...
@@ -82,10 +81,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 @
f261bf38
...
@@ -63,10 +63,8 @@ bool PLACEMENT_TOOL::Init()
...
@@ -63,10 +63,8 @@ bool PLACEMENT_TOOL::Init()
menu
->
AppendSeparator
();
menu
->
AppendSeparator
();
menu
->
Add
(
COMMON_ACTIONS
::
distributeHorizontally
);
menu
->
Add
(
COMMON_ACTIONS
::
distributeHorizontally
);
menu
->
Add
(
COMMON_ACTIONS
::
distributeVertically
);
menu
->
Add
(
COMMON_ACTIONS
::
distributeVertically
);
m_selectionTool
->
AddSubMenu
(
menu
,
_
(
"Align/distribute"
),
m_selectionTool
->
GetMenu
().
AddMenu
(
menu
,
_
(
"Align/distribute"
),
false
,
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 @
f261bf38
...
@@ -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 @
f261bf38
...
@@ -210,10 +210,8 @@ bool POINT_EDITOR::Init()
...
@@ -210,10 +210,8 @@ bool POINT_EDITOR::Init()
return
false
;
return
false
;
}
}
m_selectionTool
->
AddMenuItem
(
COMMON_ACTIONS
::
pointEditorBreakOutline
,
m_selectionTool
->
GetMenu
().
AddItem
(
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 @
f261bf38
...
@@ -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 @
f261bf38
...
@@ -51,6 +51,8 @@
...
@@ -51,6 +51,8 @@
#include "selection_tool.h"
#include "selection_tool.h"
#include "selection_area.h"
#include "selection_area.h"
#include "zoom_menu.h"
#include "grid_menu.h"
#include "bright_box.h"
#include "bright_box.h"
#include "common_actions.h"
#include "common_actions.h"
...
@@ -70,22 +72,39 @@ SELECTION_TOOL::SELECTION_TOOL() :
...
@@ -70,22 +72,39 @@ SELECTION_TOOL::SELECTION_TOOL() :
m_frame
(
NULL
),
m_additive
(
false
),
m_multiple
(
false
),
m_frame
(
NULL
),
m_additive
(
false
),
m_multiple
(
false
),
m_editModules
(
false
),
m_locked
(
true
)
m_editModules
(
false
),
m_locked
(
true
)
{
{
m_selArea
=
new
SELECTION_AREA
;
m_selection
.
group
=
new
KIGFX
::
VIEW_GROUP
;
AddSubMenu
(
new
SELECT_MENU
,
_
(
"Select..."
),
(
SELECTION_CONDITION
)
SELECTION_CONDITIONS
::
OnlyConnectedItems
&&
SELECTION_CONDITIONS
::
Count
(
1
)
);
}
}
SELECTION_TOOL
::~
SELECTION_TOOL
()
SELECTION_TOOL
::~
SELECTION_TOOL
()
{
{
delete
m_selArea
;
delete
m_selection
.
group
;
delete
m_selection
.
group
;
}
}
bool
SELECTION_TOOL
::
Init
()
{
m_selection
.
group
=
new
KIGFX
::
VIEW_GROUP
;
m_menu
.
AddMenu
(
new
SELECT_MENU
,
_
(
"Select..."
),
false
,
(
SELECTION_CONDITION
)
SELECTION_CONDITIONS
::
OnlyConnectedItems
&&
SELECTION_CONDITIONS
::
Count
(
1
)
);
m_menu
.
AddSeparator
(
SELECTION_CONDITIONS
::
ShowAlways
,
1000
);
m_menu
.
AddItem
(
COMMON_ACTIONS
::
zoomCenter
,
SELECTION_CONDITIONS
::
ShowAlways
,
1000
);
m_menu
.
AddItem
(
COMMON_ACTIONS
::
zoomIn
,
SELECTION_CONDITIONS
::
ShowAlways
,
1000
);
m_menu
.
AddItem
(
COMMON_ACTIONS
::
zoomOut
,
SELECTION_CONDITIONS
::
ShowAlways
,
1000
);
m_menu
.
AddItem
(
COMMON_ACTIONS
::
zoomFitScreen
,
SELECTION_CONDITIONS
::
ShowAlways
,
1000
);
m_menu
.
AddMenu
(
new
ZOOM_MENU
(
getEditFrame
<
PCB_BASE_FRAME
>
()
),
"Zoom"
,
false
,
SELECTION_CONDITIONS
::
ShowAlways
,
1000
);
m_menu
.
AddMenu
(
new
GRID_MENU
(
getEditFrame
<
PCB_BASE_FRAME
>
()
),
"Grid"
,
false
,
SELECTION_CONDITIONS
::
ShowAlways
,
1000
);
return
true
;
}
void
SELECTION_TOOL
::
Reset
(
RESET_REASON
aReason
)
void
SELECTION_TOOL
::
Reset
(
RESET_REASON
aReason
)
{
{
if
(
aReason
==
TOOL_BASE
::
MODEL_RELOAD
)
if
(
aReason
==
TOOL_BASE
::
MODEL_RELOAD
)
...
@@ -93,7 +112,6 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason )
...
@@ -93,7 +112,6 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason )
// Remove pointers to the selected items from containers
// Remove pointers to the selected items from containers
// without changing their properties (as they are already deleted
// without changing their properties (as they are already deleted
// while a new board is loaded)
// while a new board is loaded)
m_selection
.
group
->
Clear
();
m_selection
.
clear
();
m_selection
.
clear
();
}
}
else
else
...
@@ -102,12 +120,11 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason )
...
@@ -102,12 +120,11 @@ void SELECTION_TOOL::Reset( RESET_REASON aReason )
m_frame
=
getEditFrame
<
PCB_BASE_FRAME
>
();
m_frame
=
getEditFrame
<
PCB_BASE_FRAME
>
();
m_locked
=
true
;
m_locked
=
true
;
m_preliminary
=
true
;
// 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
();
}
}
...
@@ -139,10 +156,17 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
...
@@ -139,10 +156,17 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
// right click? if there is any object - show the context menu
// right click? if there is any object - show the context menu
else
if
(
evt
->
IsClick
(
BUT_RIGHT
)
)
else
if
(
evt
->
IsClick
(
BUT_RIGHT
)
)
{
{
if
(
m_selection
.
Empty
()
)
bool
emptySelection
=
m_selection
.
Empty
();
if
(
emptySelection
)
selectCursor
(
evt
->
Position
()
);
selectCursor
(
evt
->
Position
()
);
generateMenu
();
CONTEXT_MENU
&
contextMenu
=
m_menu
.
Generate
(
m_selection
);
if
(
contextMenu
.
GetMenuItemCount
()
>
0
)
SetContextMenu
(
&
contextMenu
,
CMENU_NOW
);
m_preliminary
=
emptySelection
;
}
}
// double click? Display the properties window
// double click? Display the properties window
...
@@ -159,10 +183,14 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
...
@@ -159,10 +183,14 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
{
{
if
(
m_additive
)
if
(
m_additive
)
{
{
m_preliminary
=
false
;
selectMultiple
();
selectMultiple
();
}
}
else
if
(
m_selection
.
Empty
()
)
else
if
(
m_selection
.
Empty
()
)
{
{
m_preliminary
=
false
;
// There is nothing selected, so try to select something
// There is nothing selected, so try to select something
if
(
!
selectCursor
(
getView
()
->
ToWorld
(
getViewControls
()
->
GetMousePosition
()
),
false
)
)
if
(
!
selectCursor
(
getView
()
->
ToWorld
(
getViewControls
()
->
GetMousePosition
()
),
false
)
)
{
{
...
@@ -233,6 +261,12 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
...
@@ -233,6 +261,12 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
{
{
selectNet
(
*
evt
);
selectNet
(
*
evt
);
}
}
else
if
(
evt
->
Action
()
==
TA_CONTEXT_MENU_CLOSED
)
{
if
(
m_preliminary
)
clearSelection
();
}
}
}
// This tool is supposed to be active forever
// This tool is supposed to be active forever
...
@@ -242,23 +276,6 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
...
@@ -242,23 +276,6 @@ int SELECTION_TOOL::Main( const TOOL_EVENT& aEvent )
}
}
void
SELECTION_TOOL
::
AddMenuItem
(
const
TOOL_ACTION
&
aAction
,
const
SELECTION_CONDITION
&
aCondition
)
{
assert
(
aAction
.
GetId
()
>
0
);
// Check if the action was registered before in ACTION_MANAGER
m_menu
.
Add
(
aAction
);
m_menuConditions
.
push_back
(
aCondition
);
}
void
SELECTION_TOOL
::
AddSubMenu
(
CONTEXT_MENU
*
aMenu
,
const
wxString
&
aLabel
,
const
SELECTION_CONDITION
&
aCondition
)
{
m_menu
.
Add
(
aMenu
,
aLabel
);
m_menuConditions
.
push_back
(
aCondition
);
}
void
SELECTION_TOOL
::
toggleSelection
(
BOARD_ITEM
*
aItem
)
void
SELECTION_TOOL
::
toggleSelection
(
BOARD_ITEM
*
aItem
)
{
{
if
(
aItem
->
IsSelected
()
)
if
(
aItem
->
IsSelected
()
)
...
@@ -334,7 +351,7 @@ bool SELECTION_TOOL::selectCursor( const VECTOR2I& aWhere, bool aOnDrag )
...
@@ -334,7 +351,7 @@ bool SELECTION_TOOL::selectCursor( const VECTOR2I& aWhere, bool aOnDrag )
else
if
(
collector
.
GetCount
()
>
1
)
else
if
(
collector
.
GetCount
()
>
1
)
{
{
if
(
aOnDrag
)
if
(
aOnDrag
)
Wait
(
TOOL_EVENT
(
TC_ANY
,
TA_MOUSE_UP
,
BUT_LEFT
)
);
Wait
(
TOOL_EVENT
(
TC_ANY
,
TA_MOUSE_UP
,
BUT_LEFT
)
);
item
=
disambiguationMenu
(
&
collector
);
item
=
disambiguationMenu
(
&
collector
);
...
@@ -359,7 +376,8 @@ bool SELECTION_TOOL::selectMultiple()
...
@@ -359,7 +376,8 @@ bool SELECTION_TOOL::selectMultiple()
KIGFX
::
VIEW
*
view
=
getView
();
KIGFX
::
VIEW
*
view
=
getView
();
getViewControls
()
->
SetAutoPan
(
true
);
getViewControls
()
->
SetAutoPan
(
true
);
view
->
Add
(
m_selArea
);
SELECTION_AREA
area
;
view
->
Add
(
&
area
);
while
(
OPT_TOOL_EVENT
evt
=
Wait
()
)
while
(
OPT_TOOL_EVENT
evt
=
Wait
()
)
{
{
...
@@ -375,20 +393,20 @@ bool SELECTION_TOOL::selectMultiple()
...
@@ -375,20 +393,20 @@ bool SELECTION_TOOL::selectMultiple()
clearSelection
();
clearSelection
();
// Start drawing a selection box
// Start drawing a selection box
m_selArea
->
SetOrigin
(
evt
->
DragOrigin
()
);
area
.
SetOrigin
(
evt
->
DragOrigin
()
);
m_selArea
->
SetEnd
(
evt
->
Position
()
);
area
.
SetEnd
(
evt
->
Position
()
);
m_selArea
->
ViewSetVisible
(
true
);
area
.
ViewSetVisible
(
true
);
m_selArea
->
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
area
.
ViewUpdate
(
KIGFX
::
VIEW_ITEM
::
GEOMETRY
);
}
}
if
(
evt
->
IsMouseUp
(
BUT_LEFT
)
)
if
(
evt
->
IsMouseUp
(
BUT_LEFT
)
)
{
{
// End drawing the selection box
// End drawing the selection box
m_selArea
->
ViewSetVisible
(
false
);
area
.
ViewSetVisible
(
false
);
// Mark items within the selection box as selected
// Mark items within the selection box as selected
std
::
vector
<
KIGFX
::
VIEW
::
LAYER_ITEM_PAIR
>
selectedItems
;
std
::
vector
<
KIGFX
::
VIEW
::
LAYER_ITEM_PAIR
>
selectedItems
;
BOX2I
selectionBox
=
m_selArea
->
ViewBBox
();
BOX2I
selectionBox
=
area
.
ViewBBox
();
view
->
Query
(
selectionBox
,
selectedItems
);
// Get the list of selected items
view
->
Query
(
selectionBox
,
selectedItems
);
// Get the list of selected items
std
::
vector
<
KIGFX
::
VIEW
::
LAYER_ITEM_PAIR
>::
iterator
it
,
it_end
;
std
::
vector
<
KIGFX
::
VIEW
::
LAYER_ITEM_PAIR
>::
iterator
it
,
it_end
;
...
@@ -419,8 +437,8 @@ bool SELECTION_TOOL::selectMultiple()
...
@@ -419,8 +437,8 @@ bool SELECTION_TOOL::selectMultiple()
}
}
// Stop drawing the selection box
// Stop drawing the selection box
m_selArea
->
ViewSetVisible
(
false
);
area
.
ViewSetVisible
(
false
);
view
->
Remove
(
m_selA
rea
);
view
->
Remove
(
&
a
rea
);
m_multiple
=
false
;
// Multiple selection mode is inactive
m_multiple
=
false
;
// Multiple selection mode is inactive
getViewControls
()
->
SetAutoPan
(
false
);
getViewControls
()
->
SetAutoPan
(
false
);
...
@@ -428,7 +446,7 @@ bool SELECTION_TOOL::selectMultiple()
...
@@ -428,7 +446,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
()
);
...
@@ -489,10 +507,10 @@ SELECTION_LOCK_FLAGS SELECTION_TOOL::CheckLock()
...
@@ -489,10 +507,10 @@ SELECTION_LOCK_FLAGS SELECTION_TOOL::CheckLock()
return
SELECTION_UNLOCKED
;
return
SELECTION_UNLOCKED
;
}
}
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,15 +519,15 @@ int SELECTION_TOOL::CursorSelection( const TOOL_EVENT& aEvent )
...
@@ -501,15 +519,15 @@ 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
;
}
}
int
SELECTION_TOOL
::
SelectItem
(
const
TOOL_EVENT
&
aEvent
)
int
SELECTION_TOOL
::
SelectItem
(
const
TOOL_EVENT
&
aEvent
)
{
{
// Check if there is an item to be selected
// Check if there is an item to be selected
BOARD_ITEM
*
item
=
static_cast
<
BOARD_ITEM
*>
(
aEvent
.
Parameter
()
);
BOARD_ITEM
*
item
=
aEvent
.
Parameter
<
BOARD_ITEM
*>
(
);
if
(
item
)
if
(
item
)
{
{
...
@@ -519,15 +537,14 @@ int SELECTION_TOOL::SelectItem( const TOOL_EVENT& aEvent )
...
@@ -519,15 +537,14 @@ int SELECTION_TOOL::SelectItem( const TOOL_EVENT& aEvent )
m_toolMgr
->
ProcessEvent
(
SelectedEvent
);
m_toolMgr
->
ProcessEvent
(
SelectedEvent
);
}
}
setTransitions
();
return
0
;
return
0
;
}
}
int
SELECTION_TOOL
::
UnselectItem
(
const
TOOL_EVENT
&
aEvent
)
int
SELECTION_TOOL
::
UnselectItem
(
const
TOOL_EVENT
&
aEvent
)
{
{
// Check if there is an item to be selected
// Check if there is an item to be selected
BOARD_ITEM
*
item
=
static_cast
<
BOARD_ITEM
*>
(
aEvent
.
Parameter
()
);
BOARD_ITEM
*
item
=
aEvent
.
Parameter
<
BOARD_ITEM
*>
(
);
if
(
item
)
if
(
item
)
{
{
...
@@ -537,8 +554,6 @@ int SELECTION_TOOL::UnselectItem( const TOOL_EVENT& aEvent )
...
@@ -537,8 +554,6 @@ int SELECTION_TOOL::UnselectItem( const TOOL_EVENT& aEvent )
m_toolMgr
->
ProcessEvent
(
UnselectedEvent
);
m_toolMgr
->
ProcessEvent
(
UnselectedEvent
);
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -562,8 +577,6 @@ int SELECTION_TOOL::selectConnection( const TOOL_EVENT& aEvent )
...
@@ -562,8 +577,6 @@ int SELECTION_TOOL::selectConnection( const TOOL_EVENT& aEvent )
m_toolMgr
->
ProcessEvent
(
selectEvent
);
m_toolMgr
->
ProcessEvent
(
selectEvent
);
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -588,8 +601,6 @@ int SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent )
...
@@ -588,8 +601,6 @@ int SELECTION_TOOL::selectNet( const TOOL_EVENT& aEvent )
m_toolMgr
->
ProcessEvent
(
selectEvent
);
m_toolMgr
->
ProcessEvent
(
selectEvent
);
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -618,7 +629,6 @@ int SELECTION_TOOL::find( const TOOL_EVENT& aEvent )
...
@@ -618,7 +629,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 +645,6 @@ int SELECTION_TOOL::findMove( const TOOL_EVENT& aEvent )
...
@@ -635,8 +645,6 @@ int SELECTION_TOOL::findMove( const TOOL_EVENT& aEvent )
m_toolMgr
->
InvokeTool
(
"pcbnew.InteractiveEdit"
);
m_toolMgr
->
InvokeTool
(
"pcbnew.InteractiveEdit"
);
}
}
setTransitions
();
return
0
;
return
0
;
}
}
...
@@ -1293,38 +1301,6 @@ bool SELECTION_TOOL::SanitizeSelection()
...
@@ -1293,38 +1301,6 @@ bool SELECTION_TOOL::SanitizeSelection()
}
}
void
SELECTION_TOOL
::
generateMenu
()
{
// Create a copy of the master context menu
m_menuCopy
=
m_menu
;
assert
(
m_menuCopy
.
GetMenuItemCount
()
==
m_menuConditions
.
size
()
);
// Filter out entries that does not apply to the current selection
for
(
int
i
=
m_menuCopy
.
GetMenuItemCount
()
-
1
;
i
>=
0
;
--
i
)
{
try
{
if
(
!
m_menuConditions
[
i
](
m_selection
)
)
{
wxMenuItem
*
item
=
m_menuCopy
.
FindItemByPosition
(
i
);
m_menuCopy
.
Destroy
(
item
);
}
}
catch
(
boost
::
bad_function_call
)
{
// If it is not possible to determine if a menu entry should be
// shown or not - do not let users pick non-existing options
wxMenuItem
*
item
=
m_menuCopy
.
FindItemByPosition
(
i
);
m_menuCopy
.
Destroy
(
item
);
}
}
if
(
m_menuCopy
.
GetMenuItemCount
()
>
0
)
SetContextMenu
(
&
m_menuCopy
,
CMENU_NOW
);
}
void
SELECTION
::
clear
()
void
SELECTION
::
clear
()
{
{
items
.
ClearItemsList
();
items
.
ClearItemsList
();
...
...
pcbnew/tools/selection_tool.h
View file @
f261bf38
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include <class_undoredo_container.h>
#include <class_undoredo_container.h>
#include "selection_conditions.h"
#include "selection_conditions.h"
#include "conditional_menu.h"
class
PCB_BASE_FRAME
;
class
PCB_BASE_FRAME
;
class
SELECTION_AREA
;
class
SELECTION_AREA
;
...
@@ -104,7 +105,10 @@ public:
...
@@ -104,7 +105,10 @@ public:
SELECTION_TOOL
();
SELECTION_TOOL
();
~
SELECTION_TOOL
();
~
SELECTION_TOOL
();
/// @copydoc TOOL_INTERACTIVE::Reset()
/// @copydoc TOOL_BASE::Init()
bool
Init
();
/// @copydoc TOOL_BASE::Reset()
void
Reset
(
RESET_REASON
aReason
);
void
Reset
(
RESET_REASON
aReason
);
/**
/**
...
@@ -119,32 +123,13 @@ public:
...
@@ -119,32 +123,13 @@ public:
*
*
* Returns the set of currently selected items.
* 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
;
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()
* Function EditModules()
*
*
...
@@ -152,11 +137,16 @@ public:
...
@@ -152,11 +137,16 @@ public:
* (graphics, pads, etc.), so they can be modified.
* (graphics, pads, etc.), so they can be modified.
* @param aEnabled decides if the mode should be enabled.
* @param aEnabled decides if the mode should be enabled.
*/
*/
void
EditModules
(
bool
aEnabled
)
inline
void
EditModules
(
bool
aEnabled
)
{
{
m_editModules
=
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.
///> Checks if the user has agreed to modify locked items for the given selection.
SELECTION_LOCK_FLAGS
CheckLock
();
SELECTION_LOCK_FLAGS
CheckLock
();
...
@@ -166,8 +156,8 @@ public:
...
@@ -166,8 +156,8 @@ public:
///> Clear current selection event handler.
///> Clear current selection event handler.
int
ClearSelection
(
const
TOOL_EVENT
&
aEvent
);
int
ClearSelection
(
const
TOOL_EVENT
&
aEvent
);
///> Makes sure a group selection does not contain items that would cause
///> 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)
///> conflicts when moving/rotating together (e.g. a footprint and one of the same footprint's pads)
bool
SanitizeSelection
();
bool
SanitizeSelection
();
///> Item selection event handler.
///> Item selection event handler.
...
@@ -185,6 +175,9 @@ public:
...
@@ -185,6 +175,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 +214,6 @@ private:
...
@@ -221,9 +214,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.
...
@@ -317,19 +307,9 @@ private:
...
@@ -317,19 +307,9 @@ private:
*/
*/
void
guessSelectionCandidates
(
GENERAL_COLLECTOR
&
aCollector
)
const
;
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.
/// Pointer to the parent frame.
PCB_BASE_FRAME
*
m_frame
;
PCB_BASE_FRAME
*
m_frame
;
/// Visual representation of selection box.
SELECTION_AREA
*
m_selArea
;
/// Current state of selection.
/// Current state of selection.
SELECTION
m_selection
;
SELECTION
m_selection
;
...
@@ -339,20 +319,17 @@ private:
...
@@ -339,20 +319,17 @@ private:
/// Flag saying if multiple selection mode is active.
/// Flag saying if multiple selection mode is active.
bool
m_multiple
;
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.
/// Edit module mode flag.
bool
m_editModules
;
bool
m_editModules
;
/// Can other tools modify locked items.
/// Can other tools modify locked items.
bool
m_locked
;
bool
m_locked
;
/// Conditions for specific context menu entries.
/// Determines if the selection is preliminary or final.
std
::
deque
<
SELECTION_CONDITION
>
m_menuConditions
;
bool
m_preliminary
;
/// Menu displayed by the tool.
CONDITIONAL_MENU
m_menu
;
};
};
#endif
#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