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
da75c526
Commit
da75c526
authored
May 05, 2015
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Hot keys settings are synchronized between GAL & legacy
parent
99e52289
Changes
30
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
30 changed files
with
397 additions
and
108 deletions
+397
-108
draw_frame.cpp
common/draw_frame.cpp
+9
-0
hotkeys_basic.cpp
common/hotkeys_basic.cpp
+15
-0
action_manager.cpp
common/tool/action_manager.cpp
+87
-13
context_menu.cpp
common/tool/context_menu.cpp
+35
-20
tool_manager.cpp
common/tool/tool_manager.cpp
+7
-0
class_DisplayFootprintsFrame.h
cvpcb/class_DisplayFootprintsFrame.h
+3
-0
hotkeys.cpp
eeschema/hotkeys.cpp
+35
-0
libeditframe.h
eeschema/libeditframe.h
+3
-0
schframe.h
eeschema/schframe.h
+4
-0
viewlib_frame.h
eeschema/viewlib_frame.h
+3
-0
gerbview_frame.h
gerbview/gerbview_frame.h
+3
-0
hotkeys.cpp
gerbview/hotkeys.cpp
+8
-0
draw_frame.h
include/draw_frame.h
+13
-1
hotkeys_basic.h
include/hotkeys_basic.h
+11
-2
action_manager.h
include/tool/action_manager.h
+14
-0
context_menu.h
include/tool/context_menu.h
+9
-0
tool_action.h
include/tool/tool_action.h
+31
-25
tool_manager.h
include/tool/tool_manager.h
+3
-0
wxPcbStruct.h
include/wxPcbStruct.h
+3
-0
wxstruct.h
include/wxstruct.h
+1
-1
hotkeys.cpp
pagelayout_editor/hotkeys.cpp
+11
-0
pl_editor_frame.h
pagelayout_editor/pl_editor_frame.h
+3
-0
footprint_wizard_frame.h
pcbnew/footprint_wizard_frame.h
+2
-0
hotkeys.cpp
pcbnew/hotkeys.cpp
+11
-0
hotkeys_board_editor.cpp
pcbnew/hotkeys_board_editor.cpp
+11
-0
hotkeys_module_editor.cpp
pcbnew/hotkeys_module_editor.cpp
+10
-0
module_editor_frame.h
pcbnew/module_editor_frame.h
+4
-1
modview_frame.h
pcbnew/modview_frame.h
+3
-0
common_actions.cpp
pcbnew/tools/common_actions.cpp
+44
-44
conditional_menu.cpp
pcbnew/tools/conditional_menu.cpp
+1
-1
No files found.
common/draw_frame.cpp
View file @
da75c526
...
...
@@ -350,6 +350,15 @@ bool EDA_DRAW_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
return
false
;
}
int
EDA_DRAW_FRAME
::
WriteHotkeyConfig
(
struct
EDA_HOTKEY_CONFIG
*
aDescList
,
wxString
*
aFullFileName
)
{
int
result
=
EDA_BASE_FRAME
::
WriteHotkeyConfig
(
aDescList
,
aFullFileName
);
if
(
IsGalCanvasActive
()
)
GetToolManager
()
->
UpdateHotKeys
();
return
result
;
}
void
EDA_DRAW_FRAME
::
ToolOnRightClick
(
wxCommandEvent
&
event
)
{
...
...
common/hotkeys_basic.cpp
View file @
da75c526
...
...
@@ -39,6 +39,7 @@
#include <macros.h>
#include <dialog_hotkeys_editor.h>
#include <menus_helpers.h>
#include <tool/tool_manager.h>
#include <wx/apptrait.h>
#include <wx/stdpaths.h>
...
...
@@ -482,6 +483,20 @@ EDA_HOTKEY* GetDescriptorFromHotkey( int aKey, EDA_HOTKEY** aList )
}
EDA_HOTKEY
*
GetDescriptorFromCommand
(
int
aCommand
,
EDA_HOTKEY
**
aList
)
{
for
(
;
*
aList
!=
NULL
;
aList
++
)
{
EDA_HOTKEY
*
hk_decr
=
*
aList
;
if
(
hk_decr
->
m_Idcommand
==
aCommand
)
return
hk_decr
;
}
return
NULL
;
}
int
EDA_BASE_FRAME
::
WriteHotkeyConfig
(
struct
EDA_HOTKEY_CONFIG
*
aDescList
,
wxString
*
aFullFileName
)
{
...
...
common/tool/action_manager.cpp
View file @
da75c526
...
...
@@ -24,9 +24,12 @@
#include <tool/action_manager.h>
#include <tool/tool_manager.h>
#include <tool/tool_event.h>
#include <tool/tool_action.h>
#include <draw_frame.h>
#include <hotkeys_basic.h>
#include <boost/foreach.hpp>
#include <boost/range/adaptor/map.hpp>
#include <cassert>
ACTION_MANAGER
::
ACTION_MANAGER
(
TOOL_MANAGER
*
aToolManager
)
:
...
...
@@ -61,18 +64,6 @@ void ACTION_MANAGER::RegisterAction( TOOL_ACTION* aAction )
m_actionNameIndex
[
aAction
->
m_name
]
=
aAction
;
m_actionIdIndex
[
aAction
->
m_id
]
=
aAction
;
#ifndef NDEBUG
// Check if there are two global actions assigned to the same hotkey
if
(
aAction
->
GetScope
()
==
AS_GLOBAL
)
{
BOOST_FOREACH
(
const
TOOL_ACTION
*
action
,
m_actionHotKeys
[
aAction
->
m_currentHotKey
]
)
assert
(
action
->
GetScope
()
!=
AS_GLOBAL
);
}
#endif
/* not NDEBUG */
if
(
aAction
->
HasHotKey
()
)
m_actionHotKeys
[
aAction
->
m_currentHotKey
].
push_back
(
aAction
);
}
...
...
@@ -181,3 +172,86 @@ bool ACTION_MANAGER::RunHotKey( int aHotKey ) const
return
false
;
}
void
ACTION_MANAGER
::
UpdateHotKeys
()
{
m_actionHotKeys
.
clear
();
std
::
list
<
TOOL_ACTION
*>&
actions
=
GetActionList
();
for
(
std
::
list
<
TOOL_ACTION
*>::
iterator
it
=
actions
.
begin
();
it
!=
actions
.
end
();
++
it
)
{
TOOL_ACTION
*
aAction
=
*
it
;
int
hotkey
=
processHotKey
(
aAction
,
true
);
if
(
hotkey
>
0
)
m_actionHotKeys
[
hotkey
].
push_back
(
aAction
);
}
#ifndef NDEBUG
// Check if there are two global actions assigned to the same hotkey
BOOST_FOREACH
(
std
::
list
<
TOOL_ACTION
*>&
action_list
,
m_actionHotKeys
|
boost
::
adaptors
::
map_values
)
{
int
global_actions_cnt
=
0
;
BOOST_FOREACH
(
TOOL_ACTION
*
action
,
action_list
)
{
if
(
action
->
GetScope
()
==
AS_GLOBAL
)
++
global_actions_cnt
;
}
assert
(
global_actions_cnt
<=
1
);
}
#endif
/* not NDEBUG */
}
int
ACTION_MANAGER
::
processHotKey
(
TOOL_ACTION
*
aAction
,
bool
aForceUpdate
)
{
int
hotkey
=
0
;
if
(
aForceUpdate
)
hotkey
=
aAction
->
getDefaultHotKey
();
else
hotkey
=
aAction
->
GetHotKey
();
if
(
(
hotkey
&
TOOL_ACTION
::
LEGACY_HK
)
)
{
hotkey
=
hotkey
&
~
TOOL_ACTION
::
LEGACY_HK
;
// it leaves only HK_xxx identifier
EDA_DRAW_FRAME
*
frame
=
static_cast
<
EDA_DRAW_FRAME
*>
(
m_toolMgr
->
GetEditFrame
()
);
EDA_HOTKEY
*
hk_desc
=
frame
->
GetHotKeyDescription
(
hotkey
);
if
(
hk_desc
)
{
hotkey
=
hk_desc
->
m_KeyCode
;
// Convert modifiers to the ones used by the Tool Framework
if
(
hotkey
&
GR_KB_CTRL
)
{
hotkey
&=
~
GR_KB_CTRL
;
hotkey
|=
MD_CTRL
;
}
if
(
hotkey
&
GR_KB_ALT
)
{
hotkey
&=
~
GR_KB_ALT
;
hotkey
|=
MD_ALT
;
}
if
(
hotkey
&
GR_KB_SHIFT
)
{
hotkey
&=
~
GR_KB_SHIFT
;
hotkey
|=
MD_SHIFT
;
}
}
else
{
hotkey
=
0
;
}
aAction
->
setHotKey
(
hotkey
);
}
return
hotkey
;
}
common/tool/context_menu.cpp
View file @
da75c526
...
...
@@ -114,33 +114,15 @@ wxMenuItem* CONTEXT_MENU::Add( const wxString& aLabel, int aId, const BITMAP_OPA
wxMenuItem
*
CONTEXT_MENU
::
Add
(
const
TOOL_ACTION
&
aAction
)
{
/// ID numbers for tool actions need to have a value higher than ACTION_ID
int
id
=
ACTION_ID
+
aAction
.
GetId
();
const
BITMAP_OPAQUE
*
icon
=
aAction
.
GetIcon
();
wxMenuItem
*
item
=
new
wxMenuItem
(
this
,
id
,
aAction
.
GetMenuItem
(),
wxMenuItem
*
item
=
new
wxMenuItem
(
this
,
getMenuId
(
aAction
)
,
aAction
.
GetMenuItem
(),
aAction
.
GetDescription
(),
wxITEM_NORMAL
);
if
(
icon
)
item
->
SetBitmap
(
KiBitmap
(
icon
)
);
if
(
aAction
.
HasHotKey
()
)
{
int
key
=
aAction
.
GetHotKey
()
&
~
MD_MODIFIER_MASK
;
int
mod
=
aAction
.
GetHotKey
()
&
MD_MODIFIER_MASK
;
int
flags
=
wxACCEL_NORMAL
;
switch
(
mod
)
{
case
MD_ALT
:
flags
=
wxACCEL_ALT
;
break
;
case
MD_CTRL
:
flags
=
wxACCEL_CTRL
;
break
;
case
MD_SHIFT
:
flags
=
wxACCEL_SHIFT
;
break
;
}
wxAcceleratorEntry
accel
(
flags
,
key
,
id
,
item
);
item
->
SetAccel
(
&
accel
);
}
m_toolActions
[
id
]
=
&
aAction
;
m_toolActions
[
getMenuId
(
aAction
)]
=
&
aAction
;
return
Append
(
item
);
}
...
...
@@ -198,11 +180,44 @@ void CONTEXT_MENU::Clear()
void
CONTEXT_MENU
::
UpdateAll
()
{
m_update_handler
();
updateHotKeys
();
runOnSubmenus
(
boost
::
bind
(
&
CONTEXT_MENU
::
UpdateAll
,
_1
)
);
}
void
CONTEXT_MENU
::
updateHotKeys
()
{
for
(
std
::
map
<
int
,
const
TOOL_ACTION
*>::
const_iterator
it
=
m_toolActions
.
begin
();
it
!=
m_toolActions
.
end
();
++
it
)
{
int
id
=
it
->
first
;
const
TOOL_ACTION
&
action
=
*
it
->
second
;
if
(
action
.
HasHotKey
()
)
{
int
key
=
action
.
GetHotKey
()
&
~
MD_MODIFIER_MASK
;
int
mod
=
action
.
GetHotKey
()
&
MD_MODIFIER_MASK
;
int
flags
=
wxACCEL_NORMAL
;
wxMenuItem
*
item
=
FindChildItem
(
id
);
if
(
item
)
{
switch
(
mod
)
{
case
MD_ALT
:
flags
=
wxACCEL_ALT
;
break
;
case
MD_CTRL
:
flags
=
wxACCEL_CTRL
;
break
;
case
MD_SHIFT
:
flags
=
wxACCEL_SHIFT
;
break
;
}
wxAcceleratorEntry
accel
(
flags
,
key
,
id
,
item
);
item
->
SetAccel
(
&
accel
);
}
}
}
}
void
CONTEXT_MENU
::
onMenuEvent
(
wxMenuEvent
&
aEvent
)
{
OPT_TOOL_EVENT
evt
;
...
...
common/tool/tool_manager.cpp
View file @
da75c526
...
...
@@ -332,6 +332,12 @@ void TOOL_MANAGER::RunAction( const TOOL_ACTION& aAction, bool aNow, void* aPara
}
void
TOOL_MANAGER
::
UpdateHotKeys
()
{
m_actionMgr
->
UpdateHotKeys
();
}
bool
TOOL_MANAGER
::
invokeTool
(
TOOL_BASE
*
aTool
)
{
wxASSERT
(
aTool
!=
NULL
);
...
...
@@ -723,6 +729,7 @@ void TOOL_MANAGER::SetEnvironment( EDA_ITEM* aModel, KIGFX::VIEW* aView,
m_view
=
aView
;
m_viewControls
=
aViewControls
;
m_editFrame
=
aFrame
;
m_actionMgr
->
UpdateHotKeys
();
}
...
...
cvpcb/class_DisplayFootprintsFrame.h
View file @
da75c526
...
...
@@ -96,6 +96,9 @@ public:
void
InstallOptionsDisplay
(
wxCommandEvent
&
event
);
MODULE
*
Get_Module
(
const
wxString
&
CmpName
);
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY
*
GetHotKeyDescription
(
int
aCommand
)
const
{
return
NULL
;
}
void
Process_Settings
(
wxCommandEvent
&
event
);
/**
...
...
eeschema/hotkeys.cpp
View file @
da75c526
...
...
@@ -353,6 +353,18 @@ struct EDA_HOTKEY_CONFIG g_Viewlib_Hokeys_Descr[] =
{
NULL
,
NULL
,
NULL
}
};
EDA_HOTKEY
*
SCH_EDIT_FRAME
::
GetHotKeyDescription
(
int
aCommand
)
const
{
EDA_HOTKEY
*
HK_Descr
=
GetDescriptorFromCommand
(
aCommand
,
common_Hotkey_List
);
if
(
HK_Descr
==
NULL
)
HK_Descr
=
GetDescriptorFromCommand
(
aCommand
,
schematic_Hotkey_List
);
return
HK_Descr
;
}
/*
* Hot keys. Some commands are relative to the item under the mouse cursor
* Commands are case insensitive
...
...
@@ -581,6 +593,17 @@ bool SCH_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
}
EDA_HOTKEY
*
LIB_EDIT_FRAME
::
GetHotKeyDescription
(
int
aCommand
)
const
{
EDA_HOTKEY
*
HK_Descr
=
GetDescriptorFromCommand
(
aCommand
,
common_Hotkey_List
);
if
(
HK_Descr
==
NULL
)
HK_Descr
=
GetDescriptorFromCommand
(
aCommand
,
libEdit_Hotkey_List
);
return
HK_Descr
;
}
bool
LIB_EDIT_FRAME
::
OnHotKey
(
wxDC
*
aDC
,
int
aHotKey
,
const
wxPoint
&
aPosition
,
EDA_ITEM
*
aItem
)
{
if
(
aHotKey
==
0
)
...
...
@@ -749,6 +772,18 @@ bool LIB_EDIT_FRAME::OnHotKey( wxDC* aDC, int aHotKey, const wxPoint& aPosition,
return
true
;
}
EDA_HOTKEY
*
LIB_VIEW_FRAME
::
GetHotKeyDescription
(
int
aCommand
)
const
{
EDA_HOTKEY
*
HK_Descr
=
GetDescriptorFromCommand
(
aCommand
,
common_Hotkey_List
);
if
(
HK_Descr
==
NULL
)
HK_Descr
=
GetDescriptorFromCommand
(
aCommand
,
viewlib_Hotkey_List
);
return
HK_Descr
;
}
bool
LIB_VIEW_FRAME
::
OnHotKey
(
wxDC
*
aDC
,
int
aHotKey
,
const
wxPoint
&
aPosition
,
EDA_ITEM
*
aItem
)
{
...
...
eeschema/libeditframe.h
View file @
da75c526
...
...
@@ -337,6 +337,9 @@ public:
double
BestZoom
();
// Returns the best zoom
void
OnLeftDClick
(
wxDC
*
DC
,
const
wxPoint
&
MousePos
);
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY
*
GetHotKeyDescription
(
int
aCommand
)
const
;
bool
OnHotKey
(
wxDC
*
aDC
,
int
aHotKey
,
const
wxPoint
&
aPosition
,
EDA_ITEM
*
aItem
=
NULL
);
bool
GeneralControl
(
wxDC
*
aDC
,
const
wxPoint
&
aPosition
,
int
aHotKey
=
0
);
...
...
eeschema/schframe.h
View file @
da75c526
...
...
@@ -357,6 +357,10 @@ public:
void
ReCreateVToolbar
();
void
ReCreateOptToolbar
();
void
ReCreateMenuBar
();
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY
*
GetHotKeyDescription
(
int
aCommand
)
const
;
bool
OnHotKey
(
wxDC
*
aDC
,
int
aHotKey
,
const
wxPoint
&
aPosition
,
EDA_ITEM
*
aItem
=
NULL
);
/**
...
...
eeschema/viewlib_frame.h
View file @
da75c526
...
...
@@ -96,6 +96,9 @@ public:
bool
GeneralControl
(
wxDC
*
aDC
,
const
wxPoint
&
aPosition
,
int
aHotKey
=
0
);
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY
*
GetHotKeyDescription
(
int
aCommand
)
const
;
/**
* Function OnHotKey
* handle hot key events.
...
...
gerbview/gerbview_frame.h
View file @
da75c526
...
...
@@ -515,6 +515,9 @@ public:
*/
void
OnQuit
(
wxCommandEvent
&
event
);
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY
*
GetHotKeyDescription
(
int
aCommand
)
const
;
/**
* Function OnHotKey.
* ** Commands are case insensitive **
...
...
gerbview/hotkeys.cpp
View file @
da75c526
...
...
@@ -102,6 +102,14 @@ struct EDA_HOTKEY_CONFIG GerbviewHokeysDescr[] =
};
EDA_HOTKEY
*
GERBVIEW_FRAME
::
GetHotKeyDescription
(
int
aCommand
)
const
{
EDA_HOTKEY
*
HK_Descr
=
GetDescriptorFromCommand
(
aCommand
,
gerbviewHotkeyList
);
return
HK_Descr
;
}
bool
GERBVIEW_FRAME
::
OnHotKey
(
wxDC
*
aDC
,
int
aHotkeyCode
,
const
wxPoint
&
aPosition
,
EDA_ITEM
*
aItem
)
{
#define CHANGE( x ) ( x ) = not (x )
...
...
include/draw_frame.h
View file @
da75c526
...
...
@@ -29,7 +29,7 @@
#include <kiway_player.h>
class
wxSingleInstanceChecker
;
class
EDA_HOTKEY
;
/**
* Class EDA_DRAW_FRAME
...
...
@@ -324,6 +324,18 @@ public:
*/
void
SkipNextLeftButtonReleaseEvent
();
///> @copydoc EDA_BASE_FRAME::WriteHotkeyConfig
int
WriteHotkeyConfig
(
struct
EDA_HOTKEY_CONFIG
*
aDescList
,
wxString
*
aFullFileName
=
NULL
);
/**
* Function GetHotKeyDescription
* Searches lists of hot key identifiers (HK_xxx) used in the frame to find a matching
* hot key descriptor.
* @param aCommand is the hot key identifier.
* @return Hot key descriptor or NULL if none found.
*/
virtual
EDA_HOTKEY
*
GetHotKeyDescription
(
int
aCommand
)
const
=
0
;
virtual
bool
OnHotKey
(
wxDC
*
aDC
,
int
aHotKey
,
const
wxPoint
&
aPosition
,
EDA_ITEM
*
aItem
=
NULL
);
...
...
include/hotkeys_basic.h
View file @
da75c526
...
...
@@ -196,13 +196,22 @@ void DisplayHotkeyList( EDA_BASE_FRAME* aFrame, struct EDA_HOTKEY_CONFIG* aList
/**
* Function GetDescriptorFromHotkey
* Return
a EDA_HOTKEY
* pointer from a key code for OnHotKey() function
* Return
s a EDA_HOTKEY
* pointer from a key code for OnHotKey() function
* @param aKey = key code (ascii value, or wxWidgets value for function keys
* @param aList = pointer to a EDA_HOTKEY list of commands
* @return the corresponding EDA_HOTKEY pointer from the EDA_HOTKEY List
*/
EDA_HOTKEY
*
GetDescriptorFromHotkey
(
int
aKey
,
EDA_HOTKEY
**
aList
);
/**
* Function GetDescriptorFromCommand
* Returns a EDA_HOTKEY* pointer from a hot key identifier.
* @param aCommand = hot key identifier (@see hotkeys.h)
* @param aList = pointer to a EDA_HOTKEY list of commands
* @return the corresponding EDA_HOTKEY pointer from the EDA_HOTKEY List
*/
EDA_HOTKEY
*
GetDescriptorFromCommand
(
int
aCommand
,
EDA_HOTKEY
**
aList
);
/**
* Function ReadHotkeyConfig
* Read hotkey configuration for a given app,
...
...
include/tool/action_manager.h
View file @
da75c526
...
...
@@ -91,6 +91,13 @@ public:
bool
RunHotKey
(
int
aHotKey
)
const
;
/**
* Function UpdateHotKeys()
* Updates TOOL_ACTIONs hot key assignment according to the current frame's Hot Key Editor settings.
*/
void
UpdateHotKeys
();
/**
* Function GetActionList()
* Returns list of TOOL_ACTIONs. TOOL_ACTIONs add themselves to the list upon their
* creation.
* @return List of TOOL_ACTIONs.
...
...
@@ -104,6 +111,13 @@ public:
}
private
:
///> Resolves a reference to legacy hot key settings to a particular hot key.
///> @param aAction is the action to be resolved.
///> @param aForceUpdate determines whether it should be resolved only when the current hot key
///> setting contains a reference to legacy settings, or update the hot key basing on the
///> originally assigned reference.
int
processHotKey
(
TOOL_ACTION
*
aAction
,
bool
aForceUpdate
=
false
);
///> Tool manager needed to run actions
TOOL_MANAGER
*
m_toolMgr
;
...
...
include/tool/context_menu.h
View file @
da75c526
...
...
@@ -173,6 +173,9 @@ private:
*/
void
setTool
(
TOOL_INTERACTIVE
*
aTool
);
///> Updates hot key settings for TOOL_ACTIONs in this menu.
void
updateHotKeys
();
///> 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
);
...
...
@@ -180,6 +183,12 @@ private:
///> Runs a function on the menu and all its submenus.
void
runOnSubmenus
(
boost
::
function
<
void
(
CONTEXT_MENU
*
)
>
aFunction
);
///> Returns the corresponding wxMenuItem identifier for a TOOL_ACTION object.
static
inline
int
getMenuId
(
const
TOOL_ACTION
&
aAction
)
{
return
aAction
.
GetId
()
+
ACTION_ID
;
}
///> Flag indicating that the menu title was set up.
bool
m_titleSet
;
...
...
include/tool/tool_action.h
View file @
da75c526
...
...
@@ -96,30 +96,6 @@ public:
return
m_currentHotKey
;
}
/**
* Function ChangeHotKey()
* Assigns a new hot key.
*
* @param aNewHotKey is the new hot key.
*/
void
ChangeHotKey
(
int
aNewHotKey
)
{
assert
(
false
);
// hotkey has to be changed in the ACTION_MANAGER, or change the implementation
m_currentHotKey
=
aNewHotKey
;
}
/**
* Function RestoreHotKey()
* Changes the assigned hot key to the default one.
*/
void
RestoreHotKey
()
{
assert
(
false
);
// hotkey has to be changed in the ACTION_MANAGER, or change the implementation
m_currentHotKey
=
m_defaultHotKey
;
}
/**
* Function HasHotKey()
* Checks if the action has a hot key assigned.
...
...
@@ -128,7 +104,7 @@ public:
*/
bool
HasHotKey
()
const
{
return
m_currentHotKey
>
0
;
return
m_currentHotKey
!=
0
;
}
/**
...
...
@@ -204,9 +180,35 @@ public:
return
m_icon
;
}
/**
* Creates a hot key code that refers to a legacy hot key setting, instead of a particular key.
* @param aHotKey is an ID of hot key to be referred (see @hotkeys.h).
*/
inline
static
int
LegacyHotKey
(
int
aHotKey
)
{
assert
(
(
aHotKey
&
LEGACY_HK
)
==
0
);
return
aHotKey
|
LEGACY_HK
;
}
private
:
friend
class
ACTION_MANAGER
;
/// Returns the hot key assigned in the object definition. It may refer to a legacy hot key setting
/// (if LEGACY_HK flag is set).
int
getDefaultHotKey
()
{
return
m_defaultHotKey
;
}
/// Changes the assigned hot key.
void
setHotKey
(
int
aHotKey
)
{
// it is not the right moment to use legacy hot key, it should be given in the object definition
assert
(
(
aHotKey
&
LEGACY_HK
)
==
0
);
m_currentHotKey
=
aHotKey
;
}
/// Name of the action (convention is: app.[tool.]action.name)
std
::
string
m_name
;
...
...
@@ -236,6 +238,10 @@ private:
/// Generic parameter
void
*
m_param
;
/// Flag to determine the hot key settings is not a particular key, but a reference to legacy
/// hot key setting.
static
const
int
LEGACY_HK
=
0x800000
;
};
#endif
include/tool/tool_manager.h
View file @
da75c526
...
...
@@ -146,6 +146,9 @@ public:
RunAction
(
aAction
,
aNow
,
(
void
*
)
NULL
);
}
///> @copydoc ACTION_MANAGER::UpdateHotKeys()
void
UpdateHotKeys
();
/**
* Function FindTool()
* Searches for a tool with given ID.
...
...
include/wxPcbStruct.h
View file @
da75c526
...
...
@@ -431,6 +431,9 @@ public:
m_useCmpFileForFpNames
=
aUseCmpfile
;
}
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY
*
GetHotKeyDescription
(
int
aCommand
)
const
;
/**
* Function OnHotKey.
* ** Commands are case insensitive **
...
...
include/wxstruct.h
View file @
da75c526
...
...
@@ -285,7 +285,7 @@ public:
* the output format is: shortcut "key" "function"
* lines starting with # are comments
*/
int
WriteHotkeyConfig
(
struct
EDA_HOTKEY_CONFIG
*
aDescList
,
wxString
*
aFullFileName
=
NULL
);
virtual
int
WriteHotkeyConfig
(
struct
EDA_HOTKEY_CONFIG
*
aDescList
,
wxString
*
aFullFileName
=
NULL
);
/**
* Function ReadHotkeyConfigFile
...
...
pagelayout_editor/hotkeys.cpp
View file @
da75c526
...
...
@@ -126,6 +126,17 @@ struct EDA_HOTKEY_CONFIG PlEditorHokeysDescr[] =
};
EDA_HOTKEY
*
PL_EDITOR_FRAME
::
GetHotKeyDescription
(
int
aCommand
)
const
{
EDA_HOTKEY
*
HK_Descr
=
GetDescriptorFromCommand
(
aCommand
,
s_Common_Hotkey_List
);
if
(
HK_Descr
==
NULL
)
HK_Descr
=
GetDescriptorFromCommand
(
aCommand
,
s_PlEditor_Hotkey_List
);
return
HK_Descr
;
}
bool
PL_EDITOR_FRAME
::
OnHotKey
(
wxDC
*
aDC
,
int
aHotkeyCode
,
const
wxPoint
&
aPosition
,
EDA_ITEM
*
aItem
)
{
...
...
pagelayout_editor/pl_editor_frame.h
View file @
da75c526
...
...
@@ -236,6 +236,9 @@ public:
*/
void
OnQuit
(
wxCommandEvent
&
event
);
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY
*
GetHotKeyDescription
(
int
aCommand
)
const
;
/**
* Function OnHotKey.
* ** Commands are case insensitive **
...
...
pcbnew/footprint_wizard_frame.h
View file @
da75c526
...
...
@@ -139,6 +139,8 @@ private:
void
LoadSettings
(
wxConfigBase
*
aCfg
);
// override virtual
void
SaveSettings
(
wxConfigBase
*
aCfg
);
// override virtual
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY
*
GetHotKeyDescription
(
int
)
const
{
return
NULL
;
}
/**
* Function OnActivate
...
...
pcbnew/hotkeys.cpp
View file @
da75c526
...
...
@@ -371,6 +371,17 @@ struct EDA_HOTKEY_CONFIG g_Module_Viewer_Hokeys_Descr[] = {
};
EDA_HOTKEY
*
FOOTPRINT_VIEWER_FRAME
::
GetHotKeyDescription
(
int
aCommand
)
const
{
EDA_HOTKEY
*
HK_Descr
=
GetDescriptorFromCommand
(
aCommand
,
common_Hotkey_List
);
if
(
HK_Descr
==
NULL
)
HK_Descr
=
GetDescriptorFromCommand
(
aCommand
,
module_viewer_Hotkey_List
);
return
HK_Descr
;
}
bool
FOOTPRINT_VIEWER_FRAME
::
OnHotKey
(
wxDC
*
aDC
,
int
aHotKey
,
const
wxPoint
&
aPosition
,
EDA_ITEM
*
aItem
)
{
...
...
pcbnew/hotkeys_board_editor.cpp
View file @
da75c526
...
...
@@ -107,6 +107,17 @@ void PCB_EDIT_FRAME::CallMacros( wxDC* aDC, const wxPoint& aPosition, int aNumbe
}
EDA_HOTKEY
*
PCB_EDIT_FRAME
::
GetHotKeyDescription
(
int
aCommand
)
const
{
EDA_HOTKEY
*
HK_Descr
=
GetDescriptorFromCommand
(
aCommand
,
common_Hotkey_List
);
if
(
HK_Descr
==
NULL
)
HK_Descr
=
GetDescriptorFromCommand
(
aCommand
,
board_edit_Hotkey_List
);
return
HK_Descr
;
}
bool
PCB_EDIT_FRAME
::
OnHotKey
(
wxDC
*
aDC
,
int
aHotkeyCode
,
const
wxPoint
&
aPosition
,
EDA_ITEM
*
aItem
)
{
...
...
pcbnew/hotkeys_module_editor.cpp
View file @
da75c526
...
...
@@ -41,6 +41,16 @@
* See hotkeys.cpp
*/
EDA_HOTKEY
*
FOOTPRINT_EDIT_FRAME
::
GetHotKeyDescription
(
int
aCommand
)
const
{
EDA_HOTKEY
*
HK_Descr
=
GetDescriptorFromCommand
(
aCommand
,
common_Hotkey_List
);
if
(
HK_Descr
==
NULL
)
HK_Descr
=
GetDescriptorFromCommand
(
aCommand
,
module_edit_Hotkey_List
);
return
HK_Descr
;
}
bool
FOOTPRINT_EDIT_FRAME
::
OnHotKey
(
wxDC
*
aDC
,
int
aHotKey
,
const
wxPoint
&
aPosition
,
EDA_ITEM
*
aItem
)
...
...
pcbnew/module_editor_frame.h
View file @
da75c526
...
...
@@ -136,10 +136,13 @@ public:
*/
void
OnSaveLibraryAs
(
wxCommandEvent
&
aEvent
);
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY
*
GetHotKeyDescription
(
int
aCommand
)
const
;
/**
* Function OnHotKey
* handle hot key events.
* <p
?
* <p
>
* Some commands are relative to the item under the mouse cursor. Commands are
* case insensitive
* </p>
...
...
pcbnew/modview_frame.h
View file @
da75c526
...
...
@@ -118,6 +118,9 @@ private:
bool
GeneralControl
(
wxDC
*
aDC
,
const
wxPoint
&
aPosition
,
int
aHotKey
=
0
);
///> @copydoc EDA_DRAW_FRAME::GetHotKeyDescription()
EDA_HOTKEY
*
GetHotKeyDescription
(
int
aCommand
)
const
;
/**
* Function OnHotKey
* handle hot key events.
...
...
pcbnew/tools/common_actions.cpp
View file @
da75c526
This diff is collapsed.
Click to expand it.
pcbnew/tools/conditional_menu.cpp
View file @
da75c526
...
...
@@ -48,7 +48,7 @@ void CONDITIONAL_MENU::AddSeparator( const SELECTION_CONDITION& aCondition, int
CONTEXT_MENU
&
CONDITIONAL_MENU
::
Generate
(
SELECTION
&
aSelection
)
{
//
D
o not delete entries - they are going to be reused
//
Clear, but d
o not delete entries - they are going to be reused
m_menu
.
GetMenuItems
().
clear
();
for
(
std
::
list
<
ENTRY
>::
iterator
it
=
m_entries
.
begin
();
it
!=
m_entries
.
end
();
++
it
)
...
...
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