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
99e52289
Commit
99e52289
authored
May 05, 2015
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Moved the list of TOOL_ACTIONs to ACTION_MANAGER.
parent
1cd3cfa2
Changes
15
Show whitespace changes
Inline
Side-by-side
Showing
15 changed files
with
50 additions
and
33 deletions
+50
-33
action_manager.cpp
common/tool/action_manager.cpp
+4
-0
tool_action.cpp
common/tool/tool_action.cpp
+18
-0
tool_manager.cpp
common/tool/tool_manager.cpp
+0
-5
action_manager.h
include/tool/action_manager.h
+13
-0
context_menu.h
include/tool/context_menu.h
+4
-2
tool_action.h
include/tool/tool_action.h
+3
-12
tool_manager.h
include/tool/tool_manager.h
+0
-13
cross-probing.cpp
pcbnew/cross-probing.cpp
+1
-0
length_tuner_tool.cpp
pcbnew/router/length_tuner_tool.cpp
+1
-0
router_tool.cpp
pcbnew/router/router_tool.cpp
+1
-0
common_actions.cpp
pcbnew/tools/common_actions.cpp
+1
-0
common_actions.h
pcbnew/tools/common_actions.h
+1
-1
module_tools.cpp
pcbnew/tools/module_tools.cpp
+1
-0
pcb_editor_control.cpp
pcbnew/tools/pcb_editor_control.cpp
+1
-0
placement_tool.cpp
pcbnew/tools/placement_tool.cpp
+1
-0
No files found.
common/tool/action_manager.cpp
View file @
99e52289
...
@@ -32,6 +32,10 @@
...
@@ -32,6 +32,10 @@
ACTION_MANAGER
::
ACTION_MANAGER
(
TOOL_MANAGER
*
aToolManager
)
:
ACTION_MANAGER
::
ACTION_MANAGER
(
TOOL_MANAGER
*
aToolManager
)
:
m_toolMgr
(
aToolManager
)
m_toolMgr
(
aToolManager
)
{
{
// Register known actions
std
::
list
<
TOOL_ACTION
*>&
actionList
=
GetActionList
();
BOOST_FOREACH
(
TOOL_ACTION
*
action
,
actionList
)
RegisterAction
(
action
);
}
}
...
...
common/tool/tool_action.cpp
View file @
99e52289
...
@@ -23,6 +23,24 @@
...
@@ -23,6 +23,24 @@
*/
*/
#include <tool/tool_action.h>
#include <tool/tool_action.h>
#include <tool/action_manager.h>
TOOL_ACTION
::
TOOL_ACTION
(
const
std
::
string
&
aName
,
TOOL_ACTION_SCOPE
aScope
,
int
aDefaultHotKey
,
const
wxString
aMenuItem
,
const
wxString
&
aMenuDesc
,
const
BITMAP_OPAQUE
*
aIcon
,
TOOL_ACTION_FLAGS
aFlags
,
void
*
aParam
)
:
m_name
(
aName
),
m_scope
(
aScope
),
m_defaultHotKey
(
aDefaultHotKey
),
m_currentHotKey
(
aDefaultHotKey
),
m_menuItem
(
aMenuItem
),
m_menuDescription
(
aMenuDesc
),
m_icon
(
aIcon
),
m_id
(
-
1
),
m_flags
(
aFlags
),
m_param
(
aParam
)
{
ACTION_MANAGER
::
GetActionList
().
push_back
(
this
);
}
TOOL_ACTION
::~
TOOL_ACTION
()
{
ACTION_MANAGER
::
GetActionList
().
remove
(
this
);
}
std
::
string
TOOL_ACTION
::
GetToolName
()
const
std
::
string
TOOL_ACTION
::
GetToolName
()
const
{
{
...
...
common/tool/tool_manager.cpp
View file @
99e52289
...
@@ -202,11 +202,6 @@ TOOL_MANAGER::TOOL_MANAGER() :
...
@@ -202,11 +202,6 @@ TOOL_MANAGER::TOOL_MANAGER() :
m_passEvent
(
false
)
m_passEvent
(
false
)
{
{
m_actionMgr
=
new
ACTION_MANAGER
(
this
);
m_actionMgr
=
new
ACTION_MANAGER
(
this
);
// Register known actions
std
::
list
<
TOOL_ACTION
*>&
actionList
=
GetActionList
();
BOOST_FOREACH
(
TOOL_ACTION
*
action
,
actionList
)
RegisterAction
(
action
);
}
}
...
...
include/tool/action_manager.h
View file @
99e52289
...
@@ -90,6 +90,19 @@ public:
...
@@ -90,6 +90,19 @@ public:
*/
*/
bool
RunHotKey
(
int
aHotKey
)
const
;
bool
RunHotKey
(
int
aHotKey
)
const
;
/**
* Returns list of TOOL_ACTIONs. TOOL_ACTIONs add themselves to the list upon their
* creation.
* @return List of TOOL_ACTIONs.
*/
static
std
::
list
<
TOOL_ACTION
*>&
GetActionList
()
{
// TODO I am afraid this approach won't work when we reach multitab version of kicad.
static
std
::
list
<
TOOL_ACTION
*>
actionList
;
return
actionList
;
}
private
:
private
:
///> Tool manager needed to run actions
///> Tool manager needed to run actions
TOOL_MANAGER
*
m_toolMgr
;
TOOL_MANAGER
*
m_toolMgr
;
...
...
include/tool/context_menu.h
View file @
99e52289
...
@@ -26,11 +26,13 @@
...
@@ -26,11 +26,13 @@
#ifndef __CONTEXT_MENU_H
#ifndef __CONTEXT_MENU_H
#define __CONTEXT_MENU_H
#define __CONTEXT_MENU_H
#include <wx/menu.h>
#include <tool/tool_action.h>
#include <map>
#include <map>
#include <list>
#include <boost/function.hpp>
#include <boost/function.hpp>
#include <wx/menu.h>
#include <tool/tool_action.h>
class
TOOL_INTERACTIVE
;
class
TOOL_INTERACTIVE
;
/**
/**
...
...
include/tool/tool_action.h
View file @
99e52289
...
@@ -29,7 +29,7 @@
...
@@ -29,7 +29,7 @@
#include <string>
#include <string>
#include <cassert>
#include <cassert>
#include <tool/tool_
manager
.h>
#include <tool/tool_
event
.h>
struct
BITMAP_OPAQUE
;
struct
BITMAP_OPAQUE
;
...
@@ -49,18 +49,9 @@ public:
...
@@ -49,18 +49,9 @@ 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
,
void
*
aParam
=
NULL
)
:
TOOL_ACTION_FLAGS
aFlags
=
AF_NONE
,
void
*
aParam
=
NULL
);
m_name
(
aName
),
m_scope
(
aScope
),
m_defaultHotKey
(
aDefaultHotKey
),
m_currentHotKey
(
aDefaultHotKey
),
m_menuItem
(
aMenuItem
),
m_menuDescription
(
aMenuDesc
),
m_icon
(
aIcon
),
m_id
(
-
1
),
m_flags
(
aFlags
),
m_param
(
aParam
)
{
TOOL_MANAGER
::
GetActionList
().
push_back
(
this
);
}
~
TOOL_ACTION
()
~
TOOL_ACTION
();
{
TOOL_MANAGER
::
GetActionList
().
remove
(
this
);
}
bool
operator
==
(
const
TOOL_ACTION
&
aRhs
)
const
bool
operator
==
(
const
TOOL_ACTION
&
aRhs
)
const
{
{
...
...
include/tool/tool_manager.h
View file @
99e52289
...
@@ -308,19 +308,6 @@ public:
...
@@ -308,19 +308,6 @@ public:
*/
*/
std
::
string
GetClipboard
()
const
;
std
::
string
GetClipboard
()
const
;
/**
* Returns list of TOOL_ACTIONs. TOOL_ACTIONs add themselves to the list upon their
* creation.
* @return List of TOOL_ACTIONs.
*/
static
std
::
list
<
TOOL_ACTION
*>&
GetActionList
()
{
// TODO I am afraid this approach won't work when we reach multitab version of kicad.
static
std
::
list
<
TOOL_ACTION
*>
actionList
;
return
actionList
;
}
private
:
private
:
struct
TOOL_STATE
;
struct
TOOL_STATE
;
typedef
std
::
pair
<
TOOL_EVENT_LIST
,
TOOL_STATE_FUNC
>
TRANSITION
;
typedef
std
::
pair
<
TOOL_EVENT_LIST
,
TOOL_STATE_FUNC
>
TRANSITION
;
...
...
pcbnew/cross-probing.cpp
View file @
99e52289
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include <pcbnew.h>
#include <pcbnew.h>
#include <tools/common_actions.h>
#include <tools/common_actions.h>
#include <tool/tool_manager.h>
#include <pcb_draw_panel_gal.h>
#include <pcb_draw_panel_gal.h>
/* Execute a remote command send by Eeschema via a socket,
/* Execute a remote command send by Eeschema via a socket,
...
...
pcbnew/router/length_tuner_tool.cpp
View file @
99e52289
...
@@ -32,6 +32,7 @@
...
@@ -32,6 +32,7 @@
#include <dialogs/dialog_pns_length_tuning_settings.h>
#include <dialogs/dialog_pns_length_tuning_settings.h>
#include <tool/context_menu.h>
#include <tool/context_menu.h>
#include <tool/tool_manager.h>
#include <tools/common_actions.h>
#include <tools/common_actions.h>
#include "pns_segment.h"
#include "pns_segment.h"
...
...
pcbnew/router/router_tool.cpp
View file @
99e52289
...
@@ -40,6 +40,7 @@
...
@@ -40,6 +40,7 @@
#include <base_units.h>
#include <base_units.h>
#include <tool/context_menu.h>
#include <tool/context_menu.h>
#include <tool/tool_manager.h>
#include <tools/common_actions.h>
#include <tools/common_actions.h>
#include <ratsnest_data.h>
#include <ratsnest_data.h>
...
...
pcbnew/tools/common_actions.cpp
View file @
99e52289
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#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 <layers_id_colors_and_visibility.h>
#include <bitmaps.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:
...
...
pcbnew/tools/common_actions.h
View file @
99e52289
...
@@ -294,6 +294,6 @@ public:
...
@@ -294,6 +294,6 @@ public:
static
boost
::
optional
<
TOOL_EVENT
>
TranslateLegacyId
(
int
aId
);
static
boost
::
optional
<
TOOL_EVENT
>
TranslateLegacyId
(
int
aId
);
};
};
void
registerAllTools
(
TOOL_MANAGER
*
aToolManager
);
void
registerAllTools
(
TOOL_MANAGER
*
aToolManager
);
#endif
#endif
pcbnew/tools/module_tools.cpp
View file @
99e52289
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include "module_tools.h"
#include "module_tools.h"
#include "selection_tool.h"
#include "selection_tool.h"
#include "common_actions.h"
#include "common_actions.h"
#include <tool/tool_manager.h>
#include <class_draw_panel_gal.h>
#include <class_draw_panel_gal.h>
#include <view/view_controls.h>
#include <view/view_controls.h>
...
...
pcbnew/tools/pcb_editor_control.cpp
View file @
99e52289
...
@@ -26,6 +26,7 @@
...
@@ -26,6 +26,7 @@
#include "pcb_editor_control.h"
#include "pcb_editor_control.h"
#include "common_actions.h"
#include "common_actions.h"
#include <tool/tool_manager.h>
#include "selection_tool.h"
#include "selection_tool.h"
...
...
pcbnew/tools/placement_tool.cpp
View file @
99e52289
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
#include "placement_tool.h"
#include "placement_tool.h"
#include "common_actions.h"
#include "common_actions.h"
#include "selection_tool.h"
#include "selection_tool.h"
#include <tool/tool_manager.h>
#include <wxPcbStruct.h>
#include <wxPcbStruct.h>
#include <class_board.h>
#include <class_board.h>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment