Fix issue with MDI window menu label
If the locale is changed while the MDI window menu is active, the menubar entry labelled with the previous translation will not be removed. The previous translation is now remembered and used to locate the menubar entry.
This commit is contained in:
@@ -77,6 +77,7 @@ const int wxID_MDI_MORE_WINDOWS = wxLAST_MDI_CHILD + 1;
|
|||||||
|
|
||||||
// The MDI "Window" menu label
|
// The MDI "Window" menu label
|
||||||
const char *WINDOW_MENU_LABEL = gettext_noop("&Window");
|
const char *WINDOW_MENU_LABEL = gettext_noop("&Window");
|
||||||
|
wxString WINDOW_MENU_LABEL_TRANSLATED;
|
||||||
|
|
||||||
// ---------------------------------------------------------------------------
|
// ---------------------------------------------------------------------------
|
||||||
// private functions
|
// private functions
|
||||||
@@ -1562,6 +1563,7 @@ void MDIInsertWindowMenu(wxWindow *win, WXHMENU hMenu, HMENU menuWin)
|
|||||||
bool inserted = false;
|
bool inserted = false;
|
||||||
wxString buf;
|
wxString buf;
|
||||||
MenuIterator it(hmenu);
|
MenuIterator it(hmenu);
|
||||||
|
WINDOW_MENU_LABEL_TRANSLATED = wxGetTranslation(WINDOW_MENU_LABEL);
|
||||||
while ( it.GetNext(buf) )
|
while ( it.GetNext(buf) )
|
||||||
{
|
{
|
||||||
const wxString label = wxStripMenuCodes(buf);
|
const wxString label = wxStripMenuCodes(buf);
|
||||||
@@ -1571,7 +1573,7 @@ void MDIInsertWindowMenu(wxWindow *win, WXHMENU hMenu, HMENU menuWin)
|
|||||||
::InsertMenu(hmenu, it.GetPos(),
|
::InsertMenu(hmenu, it.GetPos(),
|
||||||
MF_BYPOSITION | MF_POPUP | MF_STRING,
|
MF_BYPOSITION | MF_POPUP | MF_STRING,
|
||||||
(UINT_PTR)menuWin,
|
(UINT_PTR)menuWin,
|
||||||
wxString(wxGetTranslation(WINDOW_MENU_LABEL)).t_str());
|
WINDOW_MENU_LABEL_TRANSLATED.t_str());
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1580,7 +1582,7 @@ void MDIInsertWindowMenu(wxWindow *win, WXHMENU hMenu, HMENU menuWin)
|
|||||||
{
|
{
|
||||||
::AppendMenu(hmenu, MF_POPUP,
|
::AppendMenu(hmenu, MF_POPUP,
|
||||||
(UINT_PTR)menuWin,
|
(UINT_PTR)menuWin,
|
||||||
wxString(wxGetTranslation(WINDOW_MENU_LABEL)).t_str());
|
WINDOW_MENU_LABEL_TRANSLATED.t_str());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1597,7 +1599,7 @@ void MDIRemoveWindowMenu(wxWindow *win, WXHMENU hMenu)
|
|||||||
MenuIterator it(hmenu);
|
MenuIterator it(hmenu);
|
||||||
while ( it.GetNext(buf) )
|
while ( it.GetNext(buf) )
|
||||||
{
|
{
|
||||||
if ( wxStrcmp(buf, wxGetTranslation(WINDOW_MENU_LABEL)) == 0 )
|
if ( wxStrcmp(buf, WINDOW_MENU_LABEL_TRANSLATED) == 0 )
|
||||||
{
|
{
|
||||||
if ( !::RemoveMenu(hmenu, it.GetPos(), MF_BYPOSITION) )
|
if ( !::RemoveMenu(hmenu, it.GetPos(), MF_BYPOSITION) )
|
||||||
{
|
{
|
||||||
|
Reference in New Issue
Block a user