Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
M
magicseteditor
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
magicseteditor
Commits
660f5243
Commit
660f5243
authored
Feb 02, 2011
by
twanvl
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add 'insert symbol menu' in EVT_MENU_OPEN instead of updateUI, this fixes crash on wxGTK
parent
111264d7
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
32 additions
and
1 deletion
+32
-1
src/gui/set/cards_panel.cpp
src/gui/set/cards_panel.cpp
+21
-1
src/gui/set/cards_panel.hpp
src/gui/set/cards_panel.hpp
+1
-0
src/gui/set/panel.hpp
src/gui/set/panel.hpp
+3
-0
src/gui/set/window.cpp
src/gui/set/window.cpp
+6
-0
src/gui/set/window.hpp
src/gui/set/window.hpp
+1
-0
No files found.
src/gui/set/cards_panel.cpp
View file @
660f5243
...
@@ -284,18 +284,38 @@ void CardsPanel::onUpdateUI(wxUpdateUIEvent& ev) {
...
@@ -284,18 +284,38 @@ void CardsPanel::onUpdateUI(wxUpdateUIEvent& ev) {
case
ID_INSERT_SYMBOL
:
{
case
ID_INSERT_SYMBOL
:
{
wxMenu
*
menu
=
editor
->
getMenu
(
ID_INSERT_SYMBOL
);
wxMenu
*
menu
=
editor
->
getMenu
(
ID_INSERT_SYMBOL
);
ev
.
Enable
(
menu
);
ev
.
Enable
(
menu
);
/*
if (insertSymbolMenu->GetSubMenu() != menu || (menu && menu->GetParent() != menuFormat)) {
if (insertSymbolMenu->GetSubMenu() != menu || (menu && menu->GetParent() != menuFormat)) {
// re-add the menu
// re-add the menu
fprintf(stderr,"insert1 %p %p\n", menuFormat,insertSymbolMenu);fflush(stderr);
menuFormat->Remove(ID_INSERT_SYMBOL);
menuFormat->Remove(ID_INSERT_SYMBOL);
fprintf(stderr,"insert2\n");fflush(stderr);
insertSymbolMenu->SetSubMenu(menu);
insertSymbolMenu->SetSubMenu(menu);
fprintf(stderr,"insert3\n");fflush(stderr);
menuFormat->Append(insertSymbolMenu);
menuFormat->Append(insertSymbolMenu);
}
fprintf(stderr,"insert4\n");fflush(stderr);
}*/
break
;
break
;
}
}
#endif
#endif
}
}
}
}
void
CardsPanel
::
onMenuOpen
(
wxMenuEvent
&
ev
)
{
if
(
ev
.
GetMenu
()
!=
menuFormat
)
return
;
wxMenu
*
menu
=
editor
->
getMenu
(
ID_INSERT_SYMBOL
);
if
(
insertSymbolMenu
->
GetSubMenu
()
!=
menu
||
(
menu
&&
menu
->
GetParent
()
!=
menuFormat
))
{
// re-add the menu
fprintf
(
stderr
,
"insert1 %p %p
\n
"
,
menuFormat
,
insertSymbolMenu
);
fflush
(
stderr
);
menuFormat
->
Remove
(
ID_INSERT_SYMBOL
);
fprintf
(
stderr
,
"insert2
\n
"
);
fflush
(
stderr
);
insertSymbolMenu
->
SetSubMenu
(
menu
);
fprintf
(
stderr
,
"insert3
\n
"
);
fflush
(
stderr
);
menuFormat
->
Append
(
insertSymbolMenu
);
fprintf
(
stderr
,
"insert4
\n
"
);
fflush
(
stderr
);
}
}
void
CardsPanel
::
onCommand
(
int
id
)
{
void
CardsPanel
::
onCommand
(
int
id
)
{
switch
(
id
)
{
switch
(
id
)
{
case
ID_CARD_PREV
:
case
ID_CARD_PREV
:
...
...
src/gui/set/cards_panel.hpp
View file @
660f5243
...
@@ -37,6 +37,7 @@ class CardsPanel : public SetWindowPanel {
...
@@ -37,6 +37,7 @@ class CardsPanel : public SetWindowPanel {
virtual
void
destroyUI
(
wxToolBar
*
tb
,
wxMenuBar
*
mb
);
virtual
void
destroyUI
(
wxToolBar
*
tb
,
wxMenuBar
*
mb
);
virtual
void
onUpdateUI
(
wxUpdateUIEvent
&
);
virtual
void
onUpdateUI
(
wxUpdateUIEvent
&
);
virtual
void
onCommand
(
int
id
);
virtual
void
onCommand
(
int
id
);
virtual
void
onMenuOpen
(
wxMenuEvent
&
);
// --------------------------------------------------- : Actions
// --------------------------------------------------- : Actions
...
...
src/gui/set/panel.hpp
View file @
660f5243
...
@@ -44,6 +44,9 @@ class SetWindowPanel : public wxPanel, public SetView {
...
@@ -44,6 +44,9 @@ class SetWindowPanel : public wxPanel, public SetView {
/// Respond to one of those extra menu/tool items
/// Respond to one of those extra menu/tool items
virtual
void
onCommand
(
int
id
)
{}
virtual
void
onCommand
(
int
id
)
{}
/// Called before a menu is opened in the parent window
virtual
void
onMenuOpen
(
wxMenuEvent
&
)
{}
// --------------------------------------------------- : Actions/Events
// --------------------------------------------------- : Actions/Events
/// Should return true if this panel wants to get focus to show an action
/// Should return true if this panel wants to get focus to show an action
...
...
src/gui/set/window.cpp
View file @
660f5243
...
@@ -813,6 +813,11 @@ void SetWindow::onChildMenu(wxCommandEvent& ev) {
...
@@ -813,6 +813,11 @@ void SetWindow::onChildMenu(wxCommandEvent& ev) {
current_panel
->
onCommand
(
ev
.
GetId
());
current_panel
->
onCommand
(
ev
.
GetId
());
}
}
void
SetWindow
::
onMenuOpen
(
wxMenuEvent
&
ev
)
{
wxFrame
::
OnMenuOpen
(
ev
);
current_panel
->
onMenuOpen
(
ev
);
}
void
SetWindow
::
onIdle
(
wxIdleEvent
&
ev
)
{
void
SetWindow
::
onIdle
(
wxIdleEvent
&
ev
)
{
// Stuff that must be done in the main thread
// Stuff that must be done in the main thread
show_update_dialog
(
this
);
show_update_dialog
(
this
);
...
@@ -856,6 +861,7 @@ BEGIN_EVENT_TABLE(SetWindow, wxFrame)
...
@@ -856,6 +861,7 @@ BEGIN_EVENT_TABLE(SetWindow, wxFrame)
EVT_MENU
(
ID_HELP_INDEX
,
SetWindow
::
onHelpIndex
)
EVT_MENU
(
ID_HELP_INDEX
,
SetWindow
::
onHelpIndex
)
EVT_MENU
(
ID_HELP_WEBSITE
,
SetWindow
::
onHelpWebsite
)
EVT_MENU
(
ID_HELP_WEBSITE
,
SetWindow
::
onHelpWebsite
)
EVT_MENU
(
ID_HELP_ABOUT
,
SetWindow
::
onHelpAbout
)
EVT_MENU
(
ID_HELP_ABOUT
,
SetWindow
::
onHelpAbout
)
EVT_MENU_OPEN
(
SetWindow
::
onMenuOpen
)
EVT_TOOL_RANGE
(
ID_CHILD_MIN
,
ID_CHILD_MAX
,
SetWindow
::
onChildMenu
)
EVT_TOOL_RANGE
(
ID_CHILD_MIN
,
ID_CHILD_MAX
,
SetWindow
::
onChildMenu
)
EVT_COMMAND_RANGE
(
ID_CHILD_MIN
,
ID_CHILD_MAX
,
wxEVT_COMMAND_BUTTON_CLICKED
,
SetWindow
::
onChildMenu
)
EVT_COMMAND_RANGE
(
ID_CHILD_MIN
,
ID_CHILD_MAX
,
wxEVT_COMMAND_BUTTON_CLICKED
,
SetWindow
::
onChildMenu
)
EVT_COMMAND_RANGE
(
ID_CHILD_MIN
,
ID_CHILD_MAX
,
wxEVT_COMMAND_SPINCTRL_UPDATED
,
SetWindow
::
onChildMenu
)
EVT_COMMAND_RANGE
(
ID_CHILD_MIN
,
ID_CHILD_MAX
,
wxEVT_COMMAND_SPINCTRL_UPDATED
,
SetWindow
::
onChildMenu
)
...
...
src/gui/set/window.hpp
View file @
660f5243
...
@@ -165,6 +165,7 @@ class SetWindow : public wxFrame, public SetView {
...
@@ -165,6 +165,7 @@ class SetWindow : public wxFrame, public SetView {
// --------------------------------------------------- : Window events - other
// --------------------------------------------------- : Window events - other
void
onChildMenu
(
wxCommandEvent
&
);
void
onChildMenu
(
wxCommandEvent
&
);
void
onMenuOpen
(
wxMenuEvent
&
);
void
onIdle
(
wxIdleEvent
&
);
void
onIdle
(
wxIdleEvent
&
);
...
...
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