1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-23 07:58:05 +02:00

Ensure correct update of Selection bar tooptips for language change

This commit is contained in:
Paul Licameli 2016-06-21 00:15:37 -04:00
parent 9b21e11ff6
commit d6187f6972
2 changed files with 12 additions and 7 deletions

View File

@ -240,9 +240,6 @@ void SelectionBar::Populate()
0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
mSnapTo->SetName(_("Snap To"));
mSnapTo->SetSelection(mListener ? mListener->AS_GetSnapTo() : SNAP_OFF);
#if wxUSE_TOOLTIPS
mSnapTo->SetToolTip(wxString::Format(_("Snap Clicks/Selections to %s"), formatName.c_str()));
#endif
mSnapTo->Connect(wxEVT_SET_FOCUS,
wxFocusEventHandler(SelectionBar::OnFocus),
@ -280,6 +277,8 @@ void SelectionBar::Populate()
mainSizer->Layout();
RegenerateTooltips();
Layout();
SetMinSize( GetSizer()->GetMinSize() );
@ -310,6 +309,14 @@ void SelectionBar::SetListener(SelectionBarListener *l)
SetSelectionFormat(mListener->AS_GetSelectionFormat());
};
void SelectionBar::RegenerateTooltips()
{
#if wxUSE_TOOLTIPS
wxString formatName = mListener ? mListener->AS_GetSelectionFormat() : wxString(wxEmptyString);
mSnapTo->SetToolTip(wxString::Format(_("Snap Clicks/Selections to %s"), formatName.c_str()));
#endif
}
void SelectionBar::OnSize(wxSizeEvent &evt)
{
Refresh( true );
@ -377,9 +384,7 @@ void SelectionBar::OnUpdate(wxCommandEvent &evt)
format = mLeftTime->GetBuiltinName(index);
mListener->AS_SetSelectionFormat(format);
#if wxUSE_TOOLTIPS
mSnapTo->SetToolTip(wxString::Format(_("Snap Clicks/Selections to %s"), format.c_str()));
#endif
RegenerateTooltips();
// ToolBar::ReCreateButtons() will get rid of our sizers and controls
// so reset pointers first.

View File

@ -49,7 +49,7 @@ class SelectionBar final : public ToolBar {
void SetSelectionFormat(const wxString & format);
void SetRate(double rate);
void SetListener(SelectionBarListener *l);
void RegenerateTooltips() override {};
void RegenerateTooltips() override;
private: