GUI: Stop the double posting of menu and toolbar events to the code window

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4176 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
John Peterson
2009-09-03 05:24:30 +00:00
parent 47a16da49a
commit 566b5df761
6 changed files with 124 additions and 110 deletions
+21 -14
View File
@@ -210,7 +210,9 @@ int abc = 0;
const wxEventType wxEVT_HOST_COMMAND = wxNewEventType();
BEGIN_EVENT_TABLE(CFrame, wxFrame)
EVT_CLOSE(CFrame::OnClose)
// Menu bar
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
EVT_MENU(wxID_OPEN, CFrame::OnOpen)
EVT_MENU(wxID_EXIT, CFrame::OnQuit)
EVT_MENU(IDM_HELPWEBSITE, CFrame::OnHelp)
@@ -279,25 +281,28 @@ EVT_MENU_RANGE(IDM_SAVESLOT1, IDM_SAVESLOT8, CFrame::OnSaveState)
EVT_MENU_RANGE(IDM_FRAMESKIP0, IDM_FRAMESKIP9, CFrame::OnFrameSkip)
EVT_MENU_RANGE(IDM_DRIVE1, IDM_DRIVE24, CFrame::OnBootDrive)
// Other
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
EVT_CLOSE(CFrame::OnClose)
EVT_SIZE(CFrame::OnResize)
EVT_LIST_ITEM_ACTIVATED(LIST_CTRL, CFrame::OnGameListCtrl_ItemActivated)
EVT_HOST_COMMAND(wxID_ANY, CFrame::OnHostMessage)
#if wxUSE_TIMER
EVT_TIMER(wxID_ANY, CFrame::OnTimer)
EVT_TIMER(wxID_ANY, CFrame::OnTimer)
#endif
// Debugger Menu Entries
EVT_MENU(wxID_ANY, CFrame::PostEvent)
EVT_TEXT(wxID_ANY, CFrame::PostEvent)
//EVT_MENU_HIGHLIGHT_ALL(CFrame::PostMenuEvent)
//EVT_UPDATE_UI(wxID_ANY, CFrame::PostUpdateUIEvent)
EVT_AUI_PANE_CLOSE(CFrame::OnPaneClose)
EVT_AUINOTEBOOK_PAGE_CLOSE(wxID_ANY, CFrame::OnNotebookPageClose)
EVT_AUINOTEBOOK_ALLOW_DND(wxID_ANY, CFrame::OnAllowNotebookDnD)
EVT_AUINOTEBOOK_PAGE_CHANGED(wxID_ANY, CFrame::OnNotebookPageChanged)
// Post events to child panels
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
EVT_MENU(wxID_ANY, CFrame::PostEvent)
EVT_TEXT(wxID_ANY, CFrame::PostEvent)
//EVT_MENU_HIGHLIGHT_ALL(CFrame::PostMenuEvent)
//EVT_UPDATE_UI(wxID_ANY, CFrame::PostUpdateUIEvent)
END_EVENT_TABLE()
//---------------
@@ -312,7 +317,7 @@ CFrame::CFrame(wxFrame* parent,
bool ShowLogWindow,
long style)
: wxFrame(parent, id, title, pos, size, style)
, m_LogWindow(NULL), m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL)
, m_LogWindow(NULL), m_MenuBar(NULL), m_ToolBar(NULL), m_ToolBarDebug(NULL), m_ToolBarAui(NULL)
, m_pStatusBar(NULL), m_GameListCtrl(NULL), m_Panel(NULL)
, UseDebugger(_UseDebugger), m_bEdit(false), m_bTabSplit(false), m_bNoDocking(false), bRenderToMain(true)
, HaveLeds(false), HaveSpeakers(false)
@@ -541,14 +546,16 @@ void CFrame::OnClose(wxCloseEvent& event)
// Warning: This may cause an endless loop if the event is propagated back to its parent
void CFrame::PostEvent(wxCommandEvent& event)
{
event.Skip();
event.StopPropagation();
if (g_pCodeWindow
&& event.GetId() >= IDM_INTERPRETER && event.GetId() <= IDM_ADDRBOX
&& event.GetId() != IDM_JITUNLIMITED
//&& event.GetId() != IDM_JITUNLIMITED
)
{
event.StopPropagation();
wxPostEvent(g_pCodeWindow, event);
}
else
event.Skip();
}
void CFrame::PostMenuEvent(wxMenuEvent& event)
{
+1
View File
@@ -68,6 +68,7 @@ class CFrame : public wxFrame
// These have to be public
CCodeWindow* g_pCodeWindow;
wxMenuBar* m_MenuBar;
wxBitmap aNormalFile;
void InitBitmaps();
void DoStop();
+10 -11
View File
@@ -98,10 +98,9 @@ wxInfoWindow* InfoWindow;
// ¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯
void CFrame::CreateMenu()
{
if (GetMenuBar())
GetMenuBar()->Destroy();
if (GetMenuBar()) GetMenuBar()->Destroy();
wxMenuBar* menuBar = new wxMenuBar(wxMB_DOCKABLE);
m_MenuBar = new wxMenuBar(wxMB_DOCKABLE);
// file menu
wxMenu* fileMenu = new wxMenu;
@@ -123,7 +122,7 @@ void CFrame::CreateMenu()
fileMenu->Append(IDM_RESTART, UseDebugger ? _T("Restart in regular mode") : _T("Restart in debugging mode"));
fileMenu->AppendSeparator();
fileMenu->Append(wxID_EXIT, _T("E&xit\tAlt+F4"));
menuBar->Append(fileMenu, _T("&File"));
m_MenuBar->Append(fileMenu, _T("&File"));
// Emulation menu
wxMenu* emulationMenu = new wxMenu;
@@ -163,7 +162,7 @@ void CFrame::CreateMenu()
loadMenu->Append(IDM_LOADSLOT1 + i - 1, wxString::Format(_T("Slot %i\tF%i"), i, i));
saveMenu->Append(IDM_SAVESLOT1 + i - 1, wxString::Format(_T("Slot %i\tShift+F%i"), i, i));
}
menuBar->Append(emulationMenu, _T("&Emulation"));
m_MenuBar->Append(emulationMenu, _T("&Emulation"));
// Options menu
wxMenu* pOptionsMenu = new wxMenu;
@@ -175,7 +174,7 @@ void CFrame::CreateMenu()
pOptionsMenu->Append(IDM_CONFIG_WIIMOTE_PLUGIN, _T("&Wiimote Settings"));
pOptionsMenu->AppendSeparator();
pOptionsMenu->Append(IDM_TOGGLE_FULLSCREEN, _T("&Fullscreen\tAlt+Enter"));
menuBar->Append(pOptionsMenu, _T("&Options"));
m_MenuBar->Append(pOptionsMenu, _T("&Options"));
// Tools menu
wxMenu* toolsMenu = new wxMenu;
@@ -192,7 +191,7 @@ void CFrame::CreateMenu()
toolsMenu->Append(IDM_LOAD_WII_MENU, _T("Load Wii Menu"));
}
menuBar->Append(toolsMenu, _T("&Tools"));
m_MenuBar->Append(toolsMenu, _T("&Tools"));
wxMenu* viewMenu = new wxMenu;
viewMenu->AppendCheckItem(IDM_TOGGLE_TOOLBAR, _T("Show &Toolbar"));
@@ -221,7 +220,7 @@ void CFrame::CreateMenu()
viewMenu->Check(IDM_LISTDRIVES, SConfig::GetInstance().m_ListDrives);
viewMenu->AppendSeparator();
viewMenu->Append(IDM_PURGECACHE, _T("Purge Cache"));
menuBar->Append(viewMenu, _T("&View"));
m_MenuBar->Append(viewMenu, _T("&View"));
// Help menu
wxMenu* helpMenu = new wxMenu;
@@ -231,12 +230,12 @@ void CFrame::CreateMenu()
helpMenu->Append(IDM_HELPGOOGLECODE, _T("Dolphin at &Google Code"));
helpMenu->AppendSeparator();
helpMenu->Append(IDM_HELPABOUT, _T("&About..."));
menuBar->Append(helpMenu, _T("&Help"));
m_MenuBar->Append(helpMenu, _T("&Help"));
if (UseDebugger) g_pCodeWindow->CreateMenu(SConfig::GetInstance().m_LocalCoreStartupParameter, menuBar);
if (UseDebugger) g_pCodeWindow->CreateMenu(SConfig::GetInstance().m_LocalCoreStartupParameter, m_MenuBar);
// Associate the menu bar with the frame
SetMenuBar(menuBar);
SetMenuBar(m_MenuBar);
}