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
2647fdfd
Commit
2647fdfd
authored
Jan 25, 2015
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed context submenus event handlers (GAL/Windows).
parent
5447bb59
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
27 additions
and
9 deletions
+27
-9
context_menu.cpp
common/tool/context_menu.cpp
+21
-3
context_menu.h
include/tool/context_menu.h
+4
-4
router_tool.cpp
pcbnew/router/router_tool.cpp
+2
-2
No files found.
common/tool/context_menu.cpp
View file @
2647fdfd
...
...
@@ -114,8 +114,8 @@ CONTEXT_MENU& CONTEXT_MENU::operator=( const CONTEXT_MENU& aMenu )
void
CONTEXT_MENU
::
setupEvents
()
{
Connect
(
wxEVT_MENU_HIGHLIGHT
,
wxEventHandler
(
CONTEXT_MENU
::
onMenuEvent
),
NULL
,
this
);
Connect
(
wxEVT_COMMAND_MENU_SELECTED
,
wxEventHandler
(
CONTEXT_MENU
::
onMenuEvent
),
NULL
,
this
);
Connect
(
wxEVT_MENU_HIGHLIGHT
,
wx
Menu
EventHandler
(
CONTEXT_MENU
::
onMenuEvent
),
NULL
,
this
);
Connect
(
wxEVT_COMMAND_MENU_SELECTED
,
wx
Menu
EventHandler
(
CONTEXT_MENU
::
onMenuEvent
),
NULL
,
this
);
}
...
...
@@ -194,7 +194,7 @@ void CONTEXT_MENU::Clear()
}
void
CONTEXT_MENU
::
onMenuEvent
(
wxEvent
&
aEvent
)
void
CONTEXT_MENU
::
onMenuEvent
(
wx
Menu
Event
&
aEvent
)
{
OPT_TOOL_EVENT
evt
;
...
...
@@ -219,7 +219,25 @@ void CONTEXT_MENU::onMenuEvent( wxEvent& aEvent )
}
else
{
// Under Linux, every submenu can have a separate event handler, under
// Windows all submenus are handled by the main menu.
#ifdef __WINDOWS__
if
(
!
evt
)
{
// Try to find the submenu which holds the selected item
wxMenu
*
menu
=
NULL
;
FindItem
(
m_selected
,
&
menu
);
if
(
menu
)
{
menu
->
ProcessEvent
(
aEvent
);
return
;
}
assert
(
false
);
// The event should be handled above
}
#else
evt
=
m_customHandler
(
aEvent
);
#endif
/* else __WINDOWS__ */
// Handling non-action menu entries (e.g. items in clarification list)
if
(
!
evt
)
...
...
include/tool/context_menu.h
View file @
2647fdfd
...
...
@@ -95,12 +95,12 @@ public:
}
protected
:
void
setCustomEventHandler
(
boost
::
function
<
OPT_TOOL_EVENT
(
const
wxEvent
&
)
>
aHandler
)
void
setCustomEventHandler
(
boost
::
function
<
OPT_TOOL_EVENT
(
const
wx
Menu
Event
&
)
>
aHandler
)
{
m_customHandler
=
aHandler
;
}
virtual
OPT_TOOL_EVENT
handleCustomEvent
(
const
wxEvent
&
aEvent
)
virtual
OPT_TOOL_EVENT
handleCustomEvent
(
const
wx
Menu
Event
&
aEvent
)
{
return
OPT_TOOL_EVENT
();
}
...
...
@@ -116,7 +116,7 @@ private:
void
setupEvents
();
///> Event handler.
void
onMenuEvent
(
wxEvent
&
aEvent
);
void
onMenuEvent
(
wx
Menu
Event
&
aEvent
);
/**
* Function setTool()
...
...
@@ -144,7 +144,7 @@ private:
std
::
map
<
int
,
const
TOOL_ACTION
*>
m_toolActions
;
/// Custom events handler, allows to translate wxEvents to TOOL_EVENTs.
boost
::
function
<
OPT_TOOL_EVENT
(
const
wxEvent
&
aEvent
)
>
m_customHandler
;
boost
::
function
<
OPT_TOOL_EVENT
(
const
wx
Menu
Event
&
aEvent
)
>
m_customHandler
;
friend
class
TOOL_INTERACTIVE
;
};
...
...
pcbnew/router/router_tool.cpp
View file @
2647fdfd
...
...
@@ -152,7 +152,7 @@ public:
}
protected
:
OPT_TOOL_EVENT
handleCustomEvent
(
const
wxEvent
&
aEvent
)
OPT_TOOL_EVENT
handleCustomEvent
(
const
wx
Menu
Event
&
aEvent
)
{
#if ID_POPUP_PCB_SELECT_VIASIZE1 < ID_POPUP_PCB_SELECT_WIDTH1
#error You have changed event ids order, it breaks code. Check the source code for more details.
...
...
@@ -183,7 +183,7 @@ protected:
bds
.
SetTrackWidthIndex
(
0
);
}
else
if
(
id
>
ID_POPUP_PCB_SELECT_VIASIZE1
)
// via size has changed
else
if
(
id
>
=
ID_POPUP_PCB_SELECT_VIASIZE1
)
// via size has changed
{
assert
(
id
<
ID_POPUP_PCB_SELECT_WIDTH_END_RANGE
);
...
...
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