mirror of
https://github.com/hrydgard/ppsspp.git
synced 2024-11-27 07:20:49 +00:00
Fix multiple windows UI translations.
Just keep track of the original values used as keys.
This commit is contained in:
parent
24ecf9416c
commit
110f9513ca
@ -156,8 +156,7 @@ void WindowsHost::ShutdownSound()
|
||||
|
||||
void WindowsHost::UpdateUI()
|
||||
{
|
||||
MainWindow::TranslateMenus();
|
||||
MainWindow::Update();
|
||||
PostMessage(MainWindow::GetHWND(), MainWindow::WM_USER_UPDATE_UI, 0, 0);
|
||||
}
|
||||
|
||||
|
||||
|
@ -21,6 +21,7 @@
|
||||
#include "Common/CommonWindows.h"
|
||||
|
||||
#include <map>
|
||||
#include <string>
|
||||
|
||||
#include "base/NativeApp.h"
|
||||
#include "Globals.h"
|
||||
@ -104,6 +105,7 @@ namespace MainWindow
|
||||
static void *rawInputBuffer;
|
||||
static size_t rawInputBufferSize;
|
||||
static int currentSavestateSlot = 0;
|
||||
static std::map<int, std::string> initialMenuKeys;
|
||||
|
||||
#define MAX_LOADSTRING 100
|
||||
const TCHAR *szTitle = TEXT("PPSSPP");
|
||||
@ -254,6 +256,13 @@ namespace MainWindow
|
||||
return retVal;
|
||||
}
|
||||
|
||||
const std::string &GetMenuItemInitialText(const int menuID) {
|
||||
if (initialMenuKeys.find(menuID) == initialMenuKeys.end()) {
|
||||
initialMenuKeys[menuID] = GetMenuItemText(menuID);
|
||||
}
|
||||
return initialMenuKeys[menuID];
|
||||
}
|
||||
|
||||
// These are used as an offset
|
||||
// to determine which menu item to change.
|
||||
// Make sure to count(from 0) the separators too, when dealing with submenus!!
|
||||
@ -308,7 +317,7 @@ namespace MainWindow
|
||||
|
||||
void TranslateMenuItem(const int menuID, const char *category, const bool enabled = true, const bool checked = false, const std::wstring& accelerator = L"") {
|
||||
I18NCategory *c = GetI18NCategory(category);
|
||||
std::string key = c->T(GetMenuItemText(menuID).c_str());
|
||||
std::string key = c->T(GetMenuItemInitialText(menuID).c_str());
|
||||
std::wstring translated = ConvertUTF8ToWString(key);
|
||||
translated.append(accelerator);
|
||||
ModifyMenu(menu, menuID, MF_STRING
|
||||
@ -1415,6 +1424,11 @@ namespace MainWindow
|
||||
EnableMenuItem(menu, ID_EMULATION_ATRAC3_SOUND, MF_GRAYED);
|
||||
break;
|
||||
|
||||
case WM_USER_UPDATE_UI:
|
||||
TranslateMenus();
|
||||
Update();
|
||||
break;
|
||||
|
||||
case WM_MENUSELECT:
|
||||
// Unfortunately, accelerate keys (hotkeys) shares the same enabled/disabled states
|
||||
// with corresponding menu items.
|
||||
|
@ -9,8 +9,9 @@ namespace MainWindow
|
||||
{
|
||||
enum {
|
||||
WM_USER_SAVESTATE_FINISH = WM_USER + 100,
|
||||
WM_USER_LOG_STATUS_CHANGED = WM_USER + 200,
|
||||
WM_USER_ATRAC_STATUS_CHANGED = WM_USER + 300,
|
||||
WM_USER_LOG_STATUS_CHANGED = WM_USER + 101,
|
||||
WM_USER_ATRAC_STATUS_CHANGED = WM_USER + 102,
|
||||
WM_USER_UPDATE_UI = WM_USER + 103,
|
||||
};
|
||||
|
||||
enum {
|
||||
|
Loading…
Reference in New Issue
Block a user