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
87da6a8a
Commit
87da6a8a
authored
Sep 09, 2013
by
Maciej Suminski
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fixed hanging up of menu loop when user never moves mouse cursor into popup menu area.
parent
d0749a3a
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
6 deletions
+14
-6
context_menu.cpp
common/tool/context_menu.cpp
+12
-4
context_menu.h
include/tool/context_menu.h
+2
-2
No files found.
common/tool/context_menu.cpp
View file @
87da6a8a
...
...
@@ -44,7 +44,7 @@ public:
if
(
type
==
wxEVT_MENU_HIGHLIGHT
)
evt
=
TOOL_EVENT
(
TC_Command
,
TA_ContextMenuUpdate
,
aEvent
.
GetId
()
);
else
if
(
type
==
wxEVT_COMMAND_MENU_SELECTED
)
else
if
(
type
==
wxEVT_COMMAND_MENU_SELECTED
)
evt
=
TOOL_EVENT
(
TC_Command
,
TA_ContextMenuChoice
,
aEvent
.
GetId
()
);
m_menu
->
m_tool
->
GetManager
()
->
ProcessEvent
(
evt
);
...
...
@@ -60,8 +60,15 @@ CONTEXT_MENU::CONTEXT_MENU()
m_tool
=
NULL
;
m_menu
=
new
wxMenu
();
m_handler
=
new
CMEventHandler
(
this
);
m_menu
->
Connect
(
wxEVT_MENU_HIGHLIGHT
,
wxEventHandler
(
CMEventHandler
::
onEvent
),
NULL
,
m_handler
);
m_menu
->
Connect
(
wxEVT_COMMAND_MENU_SELECTED
,
wxEventHandler
(
CMEventHandler
::
onEvent
),
NULL
,
m_handler
);
m_menu
->
Connect
(
wxEVT_MENU_HIGHLIGHT
,
wxEventHandler
(
CMEventHandler
::
onEvent
),
NULL
,
m_handler
);
m_menu
->
Connect
(
wxEVT_COMMAND_MENU_SELECTED
,
wxEventHandler
(
CMEventHandler
::
onEvent
),
NULL
,
m_handler
);
// Workaround for the case when mouse cursor never reaches menu (it hangs up tools using menu)
wxMenuEvent
menuEvent
(
wxEVT_MENU_HIGHLIGHT
,
0
,
m_menu
);
m_menu
->
AddPendingEvent
(
menuEvent
);
m_titleSet
=
false
;
}
...
...
@@ -75,6 +82,7 @@ CONTEXT_MENU::~CONTEXT_MENU()
void
CONTEXT_MENU
::
SetTitle
(
const
wxString
&
aTitle
)
{
// Unfortunately wxMenu::SetTitle() does nothing..
if
(
m_titleSet
)
{
m_menu
->
Delete
(
m_menu
->
FindItemByPosition
(
0
)
);
// fixme: this is LAME!
...
...
@@ -87,7 +95,7 @@ void CONTEXT_MENU::SetTitle( const wxString& aTitle )
}
void
CONTEXT_MENU
::
Add
(
const
wxString
&
aItem
,
int
aId
)
void
CONTEXT_MENU
::
Add
(
const
wxString
&
aItem
,
int
aId
)
{
m_menu
->
Append
(
new
wxMenuItem
(
m_menu
,
aId
,
aItem
,
wxEmptyString
,
wxITEM_NORMAL
)
);
}
...
...
include/tool/context_menu.h
View file @
87da6a8a
...
...
@@ -44,7 +44,7 @@ public:
~
CONTEXT_MENU
();
void
SetTitle
(
const
wxString
&
aTitle
);
void
Add
(
const
wxString
&
aItem
,
int
aId
);
void
Add
(
const
wxString
&
aItem
,
int
aId
);
// fixme: unimplemented
// void Add ( const TOOL_ACTION& aAction, int aId = -1 );
...
...
@@ -61,7 +61,7 @@ private:
friend
class
TOOL_INTERACTIVE
;
void
setTool
(
TOOL_INTERACTIVE
*
aTool
)
void
setTool
(
TOOL_INTERACTIVE
*
aTool
)
{
m_tool
=
aTool
;
}
...
...
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