Hide menubar + minor UI refactor.

Add ui/hideMenuBar boolean option, defaulting to on, which hides the
main menubar when the mouse is idle or outside the frame.

This is disabled on mac, because on macs the main menubar is not part of
the application window.

Fix pointer hiding/unhiding by connecting panel events to the gamearea
mouse event handler.

Clean up the pausing when menus are opened code, make it actually work
on Windows.

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Rafael Kitover 2020-04-27 21:02:02 +00:00
parent 2868c1b753
commit 504ca08b6b
11 changed files with 290 additions and 186 deletions

View File

@ -8,7 +8,7 @@ msgid ""
msgstr "" msgstr ""
"Project-Id-Version: PACKAGE VERSION\n" "Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n" "Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2020-04-12 00:19+0000\n" "POT-Creation-Date: 2020-04-27 20:23+0000\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n" "Language-Team: LANGUAGE <LL@li.org>\n"
@ -155,7 +155,7 @@ msgstr ""
msgid "VBA cheat lists (*.clt)|*.clt|CHT cheat lists (*.cht)|*.cht" msgid "VBA cheat lists (*.clt)|*.clt|CHT cheat lists (*.cht)|*.cht"
msgstr "" msgstr ""
#: guiinit.cpp:256 panel.cpp:417 #: guiinit.cpp:256 panel.cpp:424
msgid "Loaded cheats" msgid "Loaded cheats"
msgstr "" msgstr ""
@ -308,40 +308,40 @@ msgstr ""
msgid "Menu accelerator %s for %s overrides default for %s ; keeping menu" msgid "Menu accelerator %s for %s overrides default for %s ; keeping menu"
msgstr "" msgstr ""
#: guiinit.cpp:2998 #: guiinit.cpp:3006
#, c-format #, c-format
msgid "Invalid menu item %s; removing" msgid "Invalid menu item %s; removing"
msgstr "" msgstr ""
#: guiinit.cpp:3206 #: guiinit.cpp:3214
msgid "Code" msgid "Code"
msgstr "" msgstr ""
#: guiinit.cpp:3215 #: guiinit.cpp:3223
msgid "Description" msgid "Description"
msgstr "" msgstr ""
#: guiinit.cpp:3289 xrc/CheatAdd.xrc:31 #: guiinit.cpp:3297 xrc/CheatAdd.xrc:31
msgid "Address" msgid "Address"
msgstr "" msgstr ""
#: guiinit.cpp:3290 #: guiinit.cpp:3298
msgid "Old Value" msgid "Old Value"
msgstr "" msgstr ""
#: guiinit.cpp:3291 #: guiinit.cpp:3299
msgid "New Value" msgid "New Value"
msgstr "" msgstr ""
#: guiinit.cpp:3799 #: guiinit.cpp:3811
msgid "Menu commands" msgid "Menu commands"
msgstr "" msgstr ""
#: guiinit.cpp:3822 #: guiinit.cpp:3834
msgid "Other commands" msgid "Other commands"
msgstr "" msgstr ""
#: guiinit.cpp:3933 #: guiinit.cpp:3945
msgid "JoyBus host invalid; disabling" msgid "JoyBus host invalid; disabling"
msgstr "" msgstr ""
@ -611,7 +611,7 @@ msgstr ""
msgid "Confirm import" msgid "Confirm import"
msgstr "" msgstr ""
#: cmdevents.cpp:907 panel.cpp:360 #: cmdevents.cpp:907 panel.cpp:367
#, c-format #, c-format
msgid "Loaded battery %s" msgid "Loaded battery %s"
msgstr "" msgstr ""
@ -694,7 +694,7 @@ msgstr ""
msgid "Wrote battery %s" msgid "Wrote battery %s"
msgstr "" msgstr ""
#: cmdevents.cpp:1100 panel.cpp:666 #: cmdevents.cpp:1100 panel.cpp:673
#, c-format #, c-format
msgid "Error writing battery %s" msgid "Error writing battery %s"
msgstr "" msgstr ""
@ -790,32 +790,32 @@ msgstr ""
msgid "Waiting for GDB..." msgid "Waiting for GDB..."
msgstr "" msgstr ""
#: cmdevents.cpp:2618 #: cmdevents.cpp:2626
#, c-format #, c-format
msgid "Using pixel filter #%d" msgid "Using pixel filter #%d"
msgstr "" msgstr ""
#: cmdevents.cpp:2633 #: cmdevents.cpp:2641
#, c-format #, c-format
msgid "Using interframe blending #%d" msgid "Using interframe blending #%d"
msgstr "" msgstr ""
#: cmdevents.cpp:2672 panel.cpp:176 panel.cpp:277 #: cmdevents.cpp:2680 panel.cpp:181 panel.cpp:284
msgid "Could not initialize the sound driver!" msgid "Could not initialize the sound driver!"
msgstr "" msgstr ""
#: cmdevents.cpp:2764 #: cmdevents.cpp:2772
msgid "Nintendo GameBoy (+Color+Advance) emulator." msgid "Nintendo GameBoy (+Color+Advance) emulator."
msgstr "" msgstr ""
#: cmdevents.cpp:2765 #: cmdevents.cpp:2773
msgid "" msgid ""
"Copyright (C) 1999-2003 Forgotten\n" "Copyright (C) 1999-2003 Forgotten\n"
"Copyright (C) 2004-2006 VBA development team\n" "Copyright (C) 2004-2006 VBA development team\n"
"Copyright (C) 2007-2017 VBA-M development team" "Copyright (C) 2007-2017 VBA-M development team"
msgstr "" msgstr ""
#: cmdevents.cpp:2766 #: cmdevents.cpp:2774
msgid "" msgid ""
"This program is free software: you can redistribute it and/or modify\n" "This program is free software: you can redistribute it and/or modify\n"
"it under the terms of the GNU General Public License as published by\n" "it under the terms of the GNU General Public License as published by\n"
@ -831,35 +831,35 @@ msgid ""
"along with this program. If not, see http://www.gnu.org/licenses ." "along with this program. If not, see http://www.gnu.org/licenses ."
msgstr "" msgstr ""
#: cmdevents.cpp:3061 #: cmdevents.cpp:3069
msgid "LAN link is already active. Disable link mode to disconnect." msgid "LAN link is already active. Disable link mode to disconnect."
msgstr "" msgstr ""
#: cmdevents.cpp:3067 #: cmdevents.cpp:3075
msgid "Network is not supported in local mode." msgid "Network is not supported in local mode."
msgstr "" msgstr ""
#: opts.cpp:555 opts.cpp:860 #: opts.cpp:560 opts.cpp:865
#, c-format #, c-format
msgid "Invalid value %s for option %s; valid values are %s%s%s" msgid "Invalid value %s for option %s; valid values are %s%s%s"
msgstr "" msgstr ""
#: opts.cpp:572 opts.cpp:872 #: opts.cpp:577 opts.cpp:877
#, c-format #, c-format
msgid "Invalid value %d for option %s; valid values are %d - %d" msgid "Invalid value %d for option %s; valid values are %d - %d"
msgstr "" msgstr ""
#: opts.cpp:579 opts.cpp:588 opts.cpp:880 opts.cpp:888 #: opts.cpp:584 opts.cpp:593 opts.cpp:885 opts.cpp:893
#, c-format #, c-format
msgid "Invalid value %f for option %s; valid values are %f - %f" msgid "Invalid value %f for option %s; valid values are %f - %f"
msgstr "" msgstr ""
#: opts.cpp:648 opts.cpp:669 opts.cpp:957 opts.cpp:983 #: opts.cpp:653 opts.cpp:674 opts.cpp:962 opts.cpp:988
#, c-format #, c-format
msgid "Invalid key binding %s for %s" msgid "Invalid key binding %s for %s"
msgstr "" msgstr ""
#: opts.cpp:843 #: opts.cpp:848
#, c-format #, c-format
msgid "Invalid flag option %s - %s ignored" msgid "Invalid flag option %s - %s ignored"
msgstr "" msgstr ""
@ -939,155 +939,155 @@ msgstr ""
msgid "Error setting up server socket (%d)" msgid "Error setting up server socket (%d)"
msgstr "" msgstr ""
#: panel.cpp:90 #: panel.cpp:95
#, c-format #, c-format
msgid "%s is not a valid ROM file" msgid "%s is not a valid ROM file"
msgstr "" msgstr ""
#: panel.cpp:91 panel.cpp:152 panel.cpp:215 #: panel.cpp:96 panel.cpp:157 panel.cpp:222
msgid "Problem loading file" msgid "Problem loading file"
msgstr "" msgstr ""
#: panel.cpp:151 #: panel.cpp:156
#, c-format #, c-format
msgid "Unable to load Game Boy ROM %s" msgid "Unable to load Game Boy ROM %s"
msgstr "" msgstr ""
#: panel.cpp:191 panel.cpp:291 #: panel.cpp:198 panel.cpp:298
#, c-format #, c-format
msgid "Could not load BIOS %s" msgid "Could not load BIOS %s"
msgstr "" msgstr ""
#: panel.cpp:214 #: panel.cpp:221
#, c-format #, c-format
msgid "Unable to load Game Boy Advance ROM %s" msgid "Unable to load Game Boy Advance ROM %s"
msgstr "" msgstr ""
#: panel.cpp:449 #: panel.cpp:456
msgid " player " msgid " player "
msgstr "" msgstr ""
#: panel.cpp:614 #: panel.cpp:621
#, c-format #, c-format
msgid "Loaded state %s" msgid "Loaded state %s"
msgstr "" msgstr ""
#: panel.cpp:614 #: panel.cpp:621
#, c-format #, c-format
msgid "Error loading state %s" msgid "Error loading state %s"
msgstr "" msgstr ""
#: panel.cpp:638 #: panel.cpp:645
#, c-format #, c-format
msgid "Saved state %s" msgid "Saved state %s"
msgstr "" msgstr ""
#: panel.cpp:638 #: panel.cpp:645
#, c-format #, c-format
msgid "Error saving state %s" msgid "Error saving state %s"
msgstr "" msgstr ""
#: panel.cpp:842 #: panel.cpp:849
#, c-format #, c-format
msgid "Fullscreen mode %dx%d-%d@%d not supported; looking for another" msgid "Fullscreen mode %dx%d-%d@%d not supported; looking for another"
msgstr "" msgstr ""
#: panel.cpp:880 #: panel.cpp:887
#, c-format #, c-format
msgid "Fullscreen mode %dx%d-%d@%d not supported" msgid "Fullscreen mode %dx%d-%d@%d not supported"
msgstr "" msgstr ""
#: panel.cpp:885 #: panel.cpp:892
#, c-format #, c-format
msgid "Valid mode: %dx%d-%d@%d" msgid "Valid mode: %dx%d-%d@%d"
msgstr "" msgstr ""
#: panel.cpp:893 #: panel.cpp:900
#, c-format #, c-format
msgid "Chose mode %dx%d-%d@%d" msgid "Chose mode %dx%d-%d@%d"
msgstr "" msgstr ""
#: panel.cpp:897 #: panel.cpp:904
#, c-format #, c-format
msgid "Failed to change mode to %dx%d-%d@%d" msgid "Failed to change mode to %dx%d-%d@%d"
msgstr "" msgstr ""
#: panel.cpp:981 #: panel.cpp:988
msgid "Not a valid GBA cartridge" msgid "Not a valid GBA cartridge"
msgstr "" msgstr ""
#: panel.cpp:1129 #: panel.cpp:1146
msgid "No memory for rewinding" msgid "No memory for rewinding"
msgstr "" msgstr ""
#: panel.cpp:1139 #: panel.cpp:1156
msgid "Error writing rewind state" msgid "Error writing rewind state"
msgstr "" msgstr ""
#: panel.cpp:2236 #: panel.cpp:2253
msgid "Failed to set glXSwapIntervalEXT" msgid "Failed to set glXSwapIntervalEXT"
msgstr "" msgstr ""
#: panel.cpp:2245 #: panel.cpp:2262
msgid "Failed to set glXSwapIntervalSGI" msgid "Failed to set glXSwapIntervalSGI"
msgstr "" msgstr ""
#: panel.cpp:2254 #: panel.cpp:2271
msgid "Failed to set glXSwapIntervalMESA" msgid "Failed to set glXSwapIntervalMESA"
msgstr "" msgstr ""
#: panel.cpp:2261 #: panel.cpp:2278
msgid "No support for wglGetExtensionsString" msgid "No support for wglGetExtensionsString"
msgstr "" msgstr ""
#: panel.cpp:2263 #: panel.cpp:2280
msgid "No support for WGL_EXT_swap_control" msgid "No support for WGL_EXT_swap_control"
msgstr "" msgstr ""
#: panel.cpp:2272 #: panel.cpp:2289
msgid "Failed to set wglSwapIntervalEXT" msgid "Failed to set wglSwapIntervalEXT"
msgstr "" msgstr ""
#: panel.cpp:2278 #: panel.cpp:2295
msgid "No VSYNC available on this platform" msgid "No VSYNC available on this platform"
msgstr "" msgstr ""
#: panel.cpp:2374 #: panel.cpp:2391
msgid "memory allocation error" msgid "memory allocation error"
msgstr "" msgstr ""
#: panel.cpp:2377 #: panel.cpp:2394
msgid "error initializing codec" msgid "error initializing codec"
msgstr "" msgstr ""
#: panel.cpp:2380 #: panel.cpp:2397
msgid "error writing to output file" msgid "error writing to output file"
msgstr "" msgstr ""
#: panel.cpp:2383 #: panel.cpp:2400
msgid "can't guess output format from file name" msgid "can't guess output format from file name"
msgstr "" msgstr ""
#: panel.cpp:2388 #: panel.cpp:2405
msgid "programming error; aborting!" msgid "programming error; aborting!"
msgstr "" msgstr ""
#: panel.cpp:2400 panel.cpp:2429 #: panel.cpp:2417 panel.cpp:2446
#, c-format #, c-format
msgid "Unable to begin recording to %s (%s)" msgid "Unable to begin recording to %s (%s)"
msgstr "" msgstr ""
#: panel.cpp:2457 #: panel.cpp:2474
#, c-format #, c-format
msgid "Error in audio/video recording (%s); aborting" msgid "Error in audio/video recording (%s); aborting"
msgstr "" msgstr ""
#: panel.cpp:2463 #: panel.cpp:2480
#, c-format #, c-format
msgid "Error in audio recording (%s); aborting" msgid "Error in audio recording (%s); aborting"
msgstr "" msgstr ""
#: panel.cpp:2473 #: panel.cpp:2490
#, c-format #, c-format
msgid "Error in video recording (%s); aborting" msgid "Error in video recording (%s); aborting"
msgstr "" msgstr ""
@ -3250,175 +3250,179 @@ msgstr ""
msgid "&Key Shortcuts ..." msgid "&Key Shortcuts ..."
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:566 #: xrc/MainMenu.xrc:565
msgid "&UI Settings ..."
msgstr ""
#: xrc/MainMenu.xrc:569
msgid "&Tools" msgid "&Tools"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:568 #: xrc/MainMenu.xrc:571
msgid "&Cheats" msgid "&Cheats"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:570 #: xrc/MainMenu.xrc:573
msgid "List &cheats ..." msgid "List &cheats ..."
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:573 #: xrc/MainMenu.xrc:576
msgid "Find c&heat ..." msgid "Find c&heat ..."
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:577 #: xrc/MainMenu.xrc:580
msgid "A&utomatically save/load cheats" msgid "A&utomatically save/load cheats"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:581 #: xrc/MainMenu.xrc:584
msgid "&Enable cheats" msgid "&Enable cheats"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:588 #: xrc/MainMenu.xrc:591
msgid "&Break into GDB" msgid "&Break into GDB"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:592 #: xrc/MainMenu.xrc:595
msgid "&Configure port..." msgid "&Configure port..."
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:595 #: xrc/MainMenu.xrc:598
msgid "&Break on load" msgid "&Break on load"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:600 #: xrc/MainMenu.xrc:603
msgid "&Disconnect" msgid "&Disconnect"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:602 #: xrc/MainMenu.xrc:605
msgid "&GDB" msgid "&GDB"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:605 #: xrc/MainMenu.xrc:608
msgid "&Disassemble..." msgid "&Disassemble..."
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:608 #: xrc/MainMenu.xrc:611
msgid "&Logging..." msgid "&Logging..."
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:611 #: xrc/MainMenu.xrc:614
msgid "&IO Viewer..." msgid "&IO Viewer..."
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:614 #: xrc/MainMenu.xrc:617
msgid "&Map Viewer..." msgid "&Map Viewer..."
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:617 #: xrc/MainMenu.xrc:620
msgid "M&emory Viewer..." msgid "M&emory Viewer..."
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:620 #: xrc/MainMenu.xrc:623
msgid "&OAM Viewer..." msgid "&OAM Viewer..."
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:623 #: xrc/MainMenu.xrc:626
msgid "&Palette Viewer..." msgid "&Palette Viewer..."
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:626 #: xrc/MainMenu.xrc:629
msgid "&Tile Viewer..." msgid "&Tile Viewer..."
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:631 #: xrc/MainMenu.xrc:634
msgid "Show all video layers" msgid "Show all video layers"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:635 #: xrc/MainMenu.xrc:638
msgid "BG &0" msgid "BG &0"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:640 #: xrc/MainMenu.xrc:643
msgid "BG &1" msgid "BG &1"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:645 #: xrc/MainMenu.xrc:648
msgid "BG &2" msgid "BG &2"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:650 #: xrc/MainMenu.xrc:653
msgid "BG &3" msgid "BG &3"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:655 #: xrc/MainMenu.xrc:658
msgid "&OBJ" msgid "&OBJ"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:660 #: xrc/MainMenu.xrc:663
msgid "&WIN 0" msgid "&WIN 0"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:665 #: xrc/MainMenu.xrc:668
msgid "W&IN 1" msgid "W&IN 1"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:670 #: xrc/MainMenu.xrc:673
msgid "O&BJ WIN" msgid "O&BJ WIN"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:674 #: xrc/MainMenu.xrc:677
msgid "&View Layers" msgid "&View Layers"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:678 #: xrc/MainMenu.xrc:681
msgid "Channel &1" msgid "Channel &1"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:683 #: xrc/MainMenu.xrc:686
msgid "Channel &2" msgid "Channel &2"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:688 #: xrc/MainMenu.xrc:691
msgid "Channel &3" msgid "Channel &3"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:693 #: xrc/MainMenu.xrc:696
msgid "Channel &4" msgid "Channel &4"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:698 #: xrc/MainMenu.xrc:701
msgid "Direct Sound &A" msgid "Direct Sound &A"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:703 #: xrc/MainMenu.xrc:706
msgid "Direct Sound &B" msgid "Direct Sound &B"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:707 #: xrc/MainMenu.xrc:710
msgid "&Sound Channels" msgid "&Sound Channels"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:711 #: xrc/MainMenu.xrc:714
msgid "&Help" msgid "&Help"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:713 #: xrc/MainMenu.xrc:716
msgid "Report &Bugs" msgid "Report &Bugs"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:716 #: xrc/MainMenu.xrc:719
msgid "VBA-M Support &Forum" msgid "VBA-M Support &Forum"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:719 #: xrc/MainMenu.xrc:722
msgid "Translations" msgid "Translations"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:727 #: xrc/MainMenu.xrc:730
msgid "Check for updates" msgid "Check for updates"
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:730 #: xrc/MainMenu.xrc:733
msgid "&Factory Reset..." msgid "&Factory Reset..."
msgstr "" msgstr ""
#: xrc/MainMenu.xrc:734 #: xrc/MainMenu.xrc:737
msgid "&About..." msgid "&About..."
msgstr "" msgstr ""
@ -3701,3 +3705,11 @@ msgstr ""
#: xrc/SpeedupConfig.xrc:84 #: xrc/SpeedupConfig.xrc:84
msgid "Frame skip" msgid "Frame skip"
msgstr "" msgstr ""
#: xrc/UIConfig.xrc:4
msgid "User Interface Settings"
msgstr ""
#: xrc/UIConfig.xrc:9
msgid "Hide Menu Bar"
msgstr ""

View File

@ -623,6 +623,7 @@ set(
xrc/SoundConfig.xrc xrc/SoundConfig.xrc
xrc/TileViewer.xrc xrc/TileViewer.xrc
xrc/SpeedupConfig.xrc xrc/SpeedupConfig.xrc
xrc/UIConfig.xrc
) )
# wxrc does not support xrs files in -c output (> 10x compression) # wxrc does not support xrs files in -c output (> 10x compression)

View File

@ -2326,6 +2326,14 @@ EVT_HANDLER(SpeedupConfigure, "Speedup / Turbo options...")
update_opts(); update_opts();
} }
EVT_HANDLER(UIConfigure, "UI Settings...")
{
wxDialog* dlg = GetXRCDialog("UIConfig");
if (ShowModal(dlg) == wxID_OK)
update_opts();
}
EVT_HANDLER(GameBoyConfigure, "Game Boy options...") EVT_HANDLER(GameBoyConfigure, "Game Boy options...")
{ {
wxDialog* dlg = GetXRCDialog("GameBoyConfig"); wxDialog* dlg = GetXRCDialog("GameBoyConfig");

View File

@ -2907,15 +2907,23 @@ bool MainFrame::BindControls()
// remove this item from the menu completely // remove this item from the menu completely
wxMenuItem* gdbmi = XRCITEM("GDBMenu"); wxMenuItem* gdbmi = XRCITEM("GDBMenu");
gdbmi->GetMenu()->Remove(gdbmi); gdbmi->GetMenu()->Remove(gdbmi);
gdbmi = NULL; gdbmi = nullptr;
#endif #endif
#ifdef NO_LINK #ifdef NO_LINK
// remove this item from the menu completely // remove this item from the menu completely
wxMenuItem* linkmi = XRCITEM("LinkMenu"); wxMenuItem* linkmi = XRCITEM("LinkMenu");
linkmi->GetMenu()->Remove(linkmi); linkmi->GetMenu()->Remove(linkmi);
linkmi = NULL; linkmi = nullptr;
#endif #endif
#ifdef __WXMAC__
// Remove UI Config menu item, because it only has an option that does nothing on mac.
wxMenuItem* ui_config_mi = XRCITEM("UIConfigure");
ui_config_mi->GetMenu()->Remove(ui_config_mi);
ui_config_mi = nullptr;
#endif
// if a recent menu is present, save its location // if a recent menu is present, save its location
wxMenuItem* recentmi = XRCITEM("RecentMenu"); wxMenuItem* recentmi = XRCITEM("RecentMenu");
@ -3425,6 +3433,10 @@ bool MainFrame::BindControls()
NULL, &speedup_throttle_ctrl); NULL, &speedup_throttle_ctrl);
d->Fit(); d->Fit();
} }
d = LoadXRCDialog("UIConfig");
{
getcbb("HideMenuBar", gopts.hide_menu_bar);
}
#define getcbbe(n, o) getbe(n, o, cb, wxCheckBox, CB) #define getcbbe(n, o) getbe(n, o, cb, wxCheckBox, CB)
wxBoolIntEnValidator* bienval; wxBoolIntEnValidator* bienval;
(void)bienval; // not used yet (void)bienval; // not used yet

View File

@ -306,6 +306,9 @@ opt_desc opts[] = {
INTOPT("geometry/windowX", "X", wxTRANSLATE("Window axis X position at startup"), windowPositionX, -1, 99999), INTOPT("geometry/windowX", "X", wxTRANSLATE("Window axis X position at startup"), windowPositionX, -1, 99999),
INTOPT("geometry/windowY", "Y", wxTRANSLATE("Window axis Y position at startup"), windowPositionY, -1, 99999), INTOPT("geometry/windowY", "Y", wxTRANSLATE("Window axis Y position at startup"), windowPositionY, -1, 99999),
/// UI
BOOLOPT("ui/hideMenuBar", "", wxTRANSLATE("Hide menu bar when mouse is inactive"), gopts.hide_menu_bar),
/// Sound /// Sound
ENUMOPT("Sound/AudioAPI", "", wxTRANSLATE("Sound API; if unsupported, default API will be used"), gopts.audio_api, wxTRANSLATE("sdl|openal|directsound|xaudio2|faudio")), ENUMOPT("Sound/AudioAPI", "", wxTRANSLATE("Sound API; if unsupported, default API will be used"), gopts.audio_api, wxTRANSLATE("sdl|openal|directsound|xaudio2|faudio")),
STROPT("Sound/AudioDevice", "", wxTRANSLATE("Device ID of chosen audio device for chosen driver"), gopts.audio_dev), STROPT("Sound/AudioDevice", "", wxTRANSLATE("Device ID of chosen audio device for chosen driver"), gopts.audio_dev),
@ -366,6 +369,8 @@ opts_t::opts_t()
link_host = "127.0.0.1"; link_host = "127.0.0.1";
server_ip = "*"; server_ip = "*";
link_port = 5738; link_port = 5738;
hide_menu_bar = true;
} }
// for binary_search() and friends // for binary_search() and friends

View File

@ -84,6 +84,9 @@ extern struct opts_t {
/// Recent /// Recent
wxFileHistory* recent; wxFileHistory* recent;
/// UI Config
bool hide_menu_bar;
/// wxWindows /// wxWindows
// wxWidgets-generated options (opaque) // wxWidgets-generated options (opaque)
} gopts; } gopts;

View File

@ -3,6 +3,7 @@
#include <cstring> #include <cstring>
#include <vector> #include <vector>
#include <wx/dcbuffer.h> #include <wx/dcbuffer.h>
#include <wx/menu.h>
#include <SDL_joystick.h> #include <SDL_joystick.h>
#include "../common/version_cpp.h" #include "../common/version_cpp.h"
@ -16,6 +17,10 @@
#include "filters.h" #include "filters.h"
#include "wxvbam.h" #include "wxvbam.h"
#ifdef __WXMSW__
#include <windows.h>
#endif
// release all buttons currently pressed // release all buttons currently pressed
static void clear_input_press(); static void clear_input_press();
@ -925,7 +930,7 @@ GameArea::~GameArea()
void GameArea::OnKillFocus(wxFocusEvent& ev) void GameArea::OnKillFocus(wxFocusEvent& ev)
{ {
clear_input_press(); clear_input_press();
ev.Skip(true); ev.Skip();
} }
void GameArea::Pause() void GameArea::Pause()
@ -1038,9 +1043,16 @@ void GameArea::OnIdle(wxIdleEvent& event)
// the userdata is freed on disconnect/destruction // the userdata is freed on disconnect/destruction
this->Connect(wxEVT_SIZE, wxSizeEventHandler(GameArea::OnSize), NULL, this); this->Connect(wxEVT_SIZE, wxSizeEventHandler(GameArea::OnSize), NULL, this);
// we need to check if the buttons stayed pressed when focus the panel // We need to check if the buttons stayed pressed when focus the panel.
w->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(GameArea::OnKillFocus), NULL, this); w->Connect(wxEVT_KILL_FOCUS, wxFocusEventHandler(GameArea::OnKillFocus), NULL, this);
// Update mouse last-used timers on mouse events etc..
w->Connect(wxEVT_MOTION, wxMouseEventHandler(GameArea::MouseEvent), NULL, this);
w->Connect(wxEVT_LEFT_DOWN, wxMouseEventHandler(GameArea::MouseEvent), NULL, this);
w->Connect(wxEVT_RIGHT_DOWN, wxMouseEventHandler(GameArea::MouseEvent), NULL, this);
w->Connect(wxEVT_MIDDLE_DOWN, wxMouseEventHandler(GameArea::MouseEvent), NULL, this);
w->Connect(wxEVT_MOUSEWHEEL, wxMouseEventHandler(GameArea::MouseEvent), NULL, this);
w->SetBackgroundStyle(wxBG_STYLE_CUSTOM); w->SetBackgroundStyle(wxBG_STYLE_CUSTOM);
w->SetSize(wxSize(basic_width, basic_height)); w->SetSize(wxSize(basic_width, basic_height));
@ -1095,6 +1107,7 @@ void GameArea::OnIdle(wxIdleEvent& event)
if (!paused) { if (!paused) {
HidePointer(); HidePointer();
HideMenuBar();
event.RequestMore(); event.RequestMore();
#ifndef NO_DEBUGGER #ifndef NO_DEBUGGER
@ -1123,6 +1136,8 @@ void GameArea::OnIdle(wxIdleEvent& event)
if (paused) if (paused)
SetExtraStyle(GetExtraStyle() & ~wxWS_EX_PROCESS_IDLE); SetExtraStyle(GetExtraStyle() & ~wxWS_EX_PROCESS_IDLE);
ShowMenuBar();
} }
if (do_rewind && emusys->emuWriteMemState) { if (do_rewind && emusys->emuWriteMemState) {
@ -1306,7 +1321,7 @@ void GameArea::OnKeyDown(wxKeyEvent& ev)
wxWakeUpIdle(); wxWakeUpIdle();
} }
else { else {
ev.Skip(true); ev.Skip();
} }
} }
@ -1318,7 +1333,7 @@ void GameArea::OnKeyUp(wxKeyEvent& ev)
wxWakeUpIdle(); wxWakeUpIdle();
} }
else { else {
ev.Skip(true); ev.Skip();
} }
} }
@ -1342,7 +1357,7 @@ void GameArea::OnSize(wxSizeEvent& ev)
if (panel) if (panel)
panel->OnSize(ev); panel->OnSize(ev);
ev.Skip(true); ev.Skip();
} }
#if defined(__WXGTK__) && defined(HAVE_XSS) #if defined(__WXGTK__) && defined(HAVE_XSS)
@ -2005,7 +2020,7 @@ void DrawingPanelBase::DrawOSD(wxWindowDC& dc)
void DrawingPanelBase::OnSize(wxSizeEvent& ev) void DrawingPanelBase::OnSize(wxSizeEvent& ev)
{ {
ev.Skip(true); ev.Skip();
} }
DrawingPanelBase::~DrawingPanelBase() DrawingPanelBase::~DrawingPanelBase()
@ -2289,7 +2304,7 @@ void GLDrawingPanel::OnSize(wxSizeEvent& ev)
{ {
AdjustViewport(); AdjustViewport();
ev.Skip(true); ev.Skip();
} }
void GLDrawingPanel::AdjustViewport() void GLDrawingPanel::AdjustViewport()
@ -2482,17 +2497,22 @@ void GameArea::AddFrame(const uint8_t* data)
} }
#endif #endif
void GameArea::ShowPointer() void GameArea::MouseEvent(wxMouseEvent& ev)
{ {
if (fullscreen)
return;
mouse_active_time = systemGetClock(); mouse_active_time = systemGetClock();
if (!pointer_blanked) ShowPointer();
return; ShowMenuBar();
ev.Skip();
}
void GameArea::ShowPointer()
{
if (!pointer_blanked || fullscreen) return;
pointer_blanked = false; pointer_blanked = false;
SetCursor(wxNullCursor); SetCursor(wxNullCursor);
if (panel) if (panel)
@ -2501,12 +2521,11 @@ void GameArea::ShowPointer()
void GameArea::HidePointer() void GameArea::HidePointer()
{ {
if (pointer_blanked) if (pointer_blanked || !main_frame) return;
return;
// FIXME: make time configurable // FIXME: make time configurable
if ((fullscreen || (systemGetClock() - mouse_active_time) > 3000) && if ((fullscreen || (systemGetClock() - mouse_active_time) > 3000) &&
!(main_frame && (main_frame->MenusOpened() || main_frame->DialogOpened()))) { !(main_frame->MenusOpened() || main_frame->DialogOpened())) {
pointer_blanked = true; pointer_blanked = true;
SetCursor(wxCursor(wxCURSOR_BLANK)); SetCursor(wxCursor(wxCURSOR_BLANK));
@ -2516,6 +2535,44 @@ void GameArea::HidePointer()
} }
} }
// We do not hide the menubar on mac, on mac it is not part of the main frame
// and the user can adjust hiding behavior herself.
void GameArea::HideMenuBar()
{
#ifndef __WXMAC__
if (!main_frame || menu_bar_hidden || !gopts.hide_menu_bar) return;
if (((systemGetClock() - mouse_active_time) > 3000) && !main_frame->MenusOpened()) {
#ifdef __WXMSW__
current_hmenu = static_cast<HMENU>(main_frame->GetMenuBar()->GetHMenu());
::SetMenu(main_frame->GetHandle(), nullptr);
#else
main_frame->GetMenuBar()->Hide();
#endif
SendSizeEvent();
menu_bar_hidden = true;
}
#endif
}
void GameArea::ShowMenuBar()
{
#ifndef __WXMAC__
if (!main_frame || !menu_bar_hidden) return;
#ifdef __WXMSW__
if (current_hmenu != nullptr) {
::SetMenu(main_frame->GetHandle(), current_hmenu);
current_hmenu = nullptr;
}
#else
main_frame->GetMenuBar()->Show();
#endif
SendSizeEvent();
menu_bar_hidden = false;
#endif
}
// stub HiDPI methods, see macsupport.mm for the Mac support // stub HiDPI methods, see macsupport.mm for the Mac support
#ifndef __WXMAC__ #ifndef __WXMAC__
double HiDPIAware::HiDPIScaleFactor() double HiDPIAware::HiDPIScaleFactor()

View File

@ -755,20 +755,11 @@ EVT_DROP_FILES(MainFrame::OnDropFile)
// for window geometry // for window geometry
EVT_MOVE(MainFrame::OnMove) EVT_MOVE(MainFrame::OnMove)
EVT_SIZE(MainFrame::OnSize) EVT_SIZE(MainFrame::OnSize)
// pause game if menu pops up
// // For tracking menubar state.
// This is a feature most people don't like, and it causes problems with
// keyboard game keys on mac, so we will disable it for now.
//
// On Windows, there will still be a pause because of how the windows event
// model works, in addition the audio will loop with SDL, so we still pause on
// Windows, TODO: this needs to be fixed properly
//
#ifdef __WXMSW__
EVT_MENU_OPEN(MainFrame::MenuPopped) EVT_MENU_OPEN(MainFrame::MenuPopped)
EVT_MENU_CLOSE(MainFrame::MenuPopped) EVT_MENU_CLOSE(MainFrame::MenuPopped)
EVT_MENU_HIGHLIGHT_ALL(MainFrame::MenuPopped) EVT_MENU_HIGHLIGHT_ALL(MainFrame::MenuPopped)
#endif
END_EVENT_TABLE() END_EVENT_TABLE()
@ -1069,65 +1060,43 @@ int MainFrame::newest_state_slot()
return ns + 1; return ns + 1;
} }
// disable emulator loop while menus are popped up
// not sure how to match up w/ down other than counting...
// only msw is guaranteed to only give one up & one down event for entire
// menu browsing
// if there is ever a mismatch, the game will freeze and there is no way
// to detect if it's doing that
// FIXME: this does not work.
// Not all open events are followed by close events.
// Removing the nesting counter may help, but on wxGTK I still get lockups.
void MainFrame::MenuPopped(wxMenuEvent& evt) void MainFrame::MenuPopped(wxMenuEvent& evt)
{ {
bool popped = evt.GetEventType() != wxEVT_MENU_CLOSE; // We consider the menu closed when the main menubar or system menu is closed, not any submenus.
#if 0 // On Windows nullptr is the system menu.
if (evt.GetEventType() == wxEVT_MENU_CLOSE && (evt.GetMenu() == nullptr || evt.GetMenu()->GetMenuBar() == GetMenuBar()))
if (popped) SetMenusOpened(false);
++menus_opened;
else
--menus_opened;
if (menus_opened < 0) // how could this ever be???
menus_opened = 0;
#else
if (popped)
menus_opened = 1;
else else
menus_opened = 0; SetMenusOpened(true);
#endif evt.Skip();
// workaround for lack of wxGTK mouse motion events: unblank
// pointer when menu popped up
// of course this does not help in finding the menus in the first place
// the user is better off clicking in the window or entering/
// exiting the window (which does generate a mouse event)
// it will auto-hide again once game resumes
if (popped)
panel->ShowPointer();
//if (menus_opened)
// panel->Pause();
//else if (!IsPaused())
// panel->Resume();
} }
// Pause game if menu pops up.
//
// This is a feature most people don't like, and it causes problems with
// keyboard game keys on mac, so we will disable it for now.
//
// On Windows, there will still be a pause because of how the windows event
// model works, in addition the audio will loop with SDL, so we still pause on
// Windows.
//
// TODO: This needs to be fixed properly.
//
void MainFrame::SetMenusOpened(bool state) void MainFrame::SetMenusOpened(bool state)
{ {
if (state) { if ((menus_opened = state)) {
menus_opened = 1; #ifdef __WXMSW__
paused = true; paused = true;
panel->Pause(); panel->Pause();
#endif
} }
else { else {
menus_opened = 0; #ifdef __WXMSW__
paused = false; paused = false;
pause_next = false; pause_next = false;
panel->Resume(); panel->Resume();
#endif
} }
} }

View File

@ -305,7 +305,7 @@ public:
// call this to update the viewers once a frame: // call this to update the viewers once a frame:
void UpdateViewers(); void UpdateViewers();
virtual bool MenusOpened() { return menus_opened != 0; } virtual bool MenusOpened() { return menus_opened; }
virtual void SetMenusOpened(bool state); virtual void SetMenusOpened(bool state);
@ -315,7 +315,7 @@ public:
bool IsPaused(bool incendental = false) bool IsPaused(bool incendental = false)
{ {
return (paused && !pause_next && !incendental) || menus_opened || dialog_opened; return (paused && !pause_next && !incendental) || dialog_opened;
} }
void PollJoysticks() { joy.Poll(); } void PollJoysticks() { joy.Poll(); }
@ -331,9 +331,8 @@ protected:
private: private:
GameArea* panel; GameArea* panel;
// the various reasons the game might be paused bool paused, menus_opened;
bool paused; int dialog_opened;
int menus_opened, dialog_opened;
bool autoLoadMostRecent; bool autoLoadMostRecent;
// copy of top-level menu bar as a context menu // copy of top-level menu bar as a context menu
@ -474,6 +473,11 @@ enum audioapi { AUD_SDL,
class DrawingPanelBase; class DrawingPanelBase;
#ifdef __WXMSW__
// For saving menu handle.
#include <windows.h>
#endif
class GameArea : public wxPanel, public HiDPIAware { class GameArea : public wxPanel, public HiDPIAware {
public: public:
GameArea(); GameArea();
@ -628,14 +632,16 @@ protected:
public: public:
void ShowPointer(); void ShowPointer();
void HidePointer(); void HidePointer();
void HideMenuBar();
void ShowMenuBar();
protected: protected:
void MouseEvent(wxMouseEvent&) void MouseEvent(wxMouseEvent&);
{ bool pointer_blanked, menu_bar_hidden = false;
ShowPointer();
}
bool pointer_blanked;
uint32_t mouse_active_time; uint32_t mouse_active_time;
#ifdef __WXMSW__
HMENU current_hmenu = nullptr;
#endif
DECLARE_DYNAMIC_CLASS(GameArea) DECLARE_DYNAMIC_CLASS(GameArea)
DECLARE_EVENT_TABLE() DECLARE_EVENT_TABLE()

View File

@ -561,6 +561,9 @@
<object class="wxMenuItem" name="Customize"> <object class="wxMenuItem" name="Customize">
<label>_Key Shortcuts ...</label> <label>_Key Shortcuts ...</label>
</object> </object>
<object class="wxMenuItem" name="UIConfigure">
<label>_UI Settings ...</label>
</object>
</object> </object>
<object class="wxMenu"> <object class="wxMenu">
<label>_Tools</label> <label>_Tools</label>

28
src/wx/xrc/UIConfig.xrc Normal file
View File

@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
<resource xmlns="http://www.wxwidgets.org/wxxrc" version="2.5.3.0">
<object class="wxDialog" name="UIConfig">
<title>User Interface Settings</title>
<object class="wxBoxSizer">
<orient>wxVERTICAL</orient>
<object class="sizeritem">
<object class="wxCheckBox" name="HideMenuBar">
<label>Hide Menu Bar</label>
</object>
<flag>wxALL</flag>
<border>5</border>
</object>
<object class="sizeritem">
<flag>wxALL|wxEXPAND</flag>
<border>5</border>
<object class="wxStdDialogButtonSizer">
<object class="button">
<object class="wxButton" name="wxID_OK"/>
</object>
<object class="button">
<object class="wxButton" name="wxID_CANCEL"/>
</object>
</object>
</object>
</object>
</object>
</resource>