1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-21 23:00:06 +02:00

Fixes for ControlToolBar tooltips with keyboard shortcuts not working correctly in some languages, and for tooltips being updated without having to exit and restart.

This commit is contained in:
v.audacity 2013-07-30 00:36:57 +00:00
parent 8ae5acb310
commit c52f2d3b12
2 changed files with 24 additions and 7 deletions

View File

@ -94,6 +94,7 @@ ControlToolBar::ControlToolBar()
mCutPreviewTracks = NULL; mCutPreviewTracks = NULL;
gPrefs->Read(wxT("/GUI/ErgonomicTransportButtons"), &mErgonomicTransportButtons, true); gPrefs->Read(wxT("/GUI/ErgonomicTransportButtons"), &mErgonomicTransportButtons, true);
mStrLocale = gPrefs->Read(wxT("/Locale/Language"), wxT(""));
} }
ControlToolBar::~ControlToolBar() ControlToolBar::~ControlToolBar()
@ -217,23 +218,27 @@ void ControlToolBar::RegenerateToolsTooltips()
switch (iWinID) switch (iWinID)
{ {
case ID_PLAY_BUTTON: case ID_PLAY_BUTTON:
strKey += pCmdMgr->GetKeyFromName(strToolTip); strKey += pCmdMgr->GetKeyFromName(wxT("Play"));
strKey += _(") / Loop Play ("); strKey += _(") / Loop Play (");
strKey += pCmdMgr->GetKeyFromName(wxT("PlayLooped")); strKey += pCmdMgr->GetKeyFromName(wxT("PlayLooped"));
break; break;
case ID_RECORD_BUTTON: case ID_RECORD_BUTTON:
strKey += pCmdMgr->GetKeyFromName(strToolTip); strKey += pCmdMgr->GetKeyFromName(wxT("Record"));
strKey += _(") / Append Record ("); strKey += _(") / Append Record (");
strKey += pCmdMgr->GetKeyFromName(wxT("RecordAppend")); strKey += pCmdMgr->GetKeyFromName(wxT("RecordAppend"));
break; break;
case ID_PAUSE_BUTTON:
strKey += pCmdMgr->GetKeyFromName(wxT("Pause"));
break;
case ID_STOP_BUTTON:
strKey += pCmdMgr->GetKeyFromName(wxT("Stop"));
break;
case ID_FF_BUTTON: case ID_FF_BUTTON:
strKey += pCmdMgr->GetKeyFromName(wxT("SkipEnd")); strKey += pCmdMgr->GetKeyFromName(wxT("SkipEnd"));
break; break;
case ID_REW_BUTTON: case ID_REW_BUTTON:
strKey += pCmdMgr->GetKeyFromName(wxT("SkipStart")); strKey += pCmdMgr->GetKeyFromName(wxT("SkipStart"));
break; break;
default:
strKey += pCmdMgr->GetKeyFromName(strToolTip);
} }
strKey += wxT(")"); strKey += wxT(")");
strToolTip += strKey; strToolTip += strKey;
@ -248,20 +253,30 @@ void ControlToolBar::UpdatePrefs()
bool updated = false; bool updated = false;
bool active; bool active;
RegenerateToolsTooltips();
gPrefs->Read( wxT("/GUI/ErgonomicTransportButtons"), &active, true ); gPrefs->Read( wxT("/GUI/ErgonomicTransportButtons"), &active, true );
if( mErgonomicTransportButtons != active ) if( mErgonomicTransportButtons != active )
{ {
mErgonomicTransportButtons = active; mErgonomicTransportButtons = active;
updated = true; updated = true;
} }
wxString strLocale = gPrefs->Read(wxT("/Locale/Language"), wxT(""));
if (mStrLocale != strLocale)
{
mStrLocale = strLocale;
updated = true;
}
if( updated ) if( updated )
{ {
ReCreateButtons(); ReCreateButtons(); // side effect: calls RegenerateToolsTooltips()
Updated(); Updated();
} }
else
// The other reason to regenerate tooltips is if keyboard shortcuts for
// transport buttons changed, but that's too much work to check for, so just
// always do it. (Much cheaper than calling ReCreateButtons() in all cases.
RegenerateToolsTooltips();
// Set label to pull in language change // Set label to pull in language change
SetLabel(_("Transport")); SetLabel(_("Transport"));

View File

@ -123,6 +123,8 @@ class ControlToolBar:public ToolBar {
// Activate ergonomic order for transport buttons // Activate ergonomic order for transport buttons
bool mErgonomicTransportButtons; bool mErgonomicTransportButtons;
wxString mStrLocale; // standard locale abbreviation
//wxBoxSizer *mBatchGroup; //wxBoxSizer *mBatchGroup;
wxBoxSizer *mSizer; wxBoxSizer *mSizer;