From 9d33d1242336c4810953c573f868dd7800626d73 Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sun, 5 Jun 2016 13:21:57 -0400 Subject: [PATCH] Ruler button tooltip can use Mac special chars --- src/widgets/Ruler.cpp | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/src/widgets/Ruler.cpp b/src/widgets/Ruler.cpp index bed7b01ae..7ffa5e655 100644 --- a/src/widgets/Ruler.cpp +++ b/src/widgets/Ruler.cpp @@ -2060,19 +2060,6 @@ void AdornedRulerPanel::UpdatePrefs() RegenerateTooltips(mPrevZone); } -namespace -{ - wxString ComposeButtonLabel - (AudacityProject &project, const wxString &commandName, const wxString &label) - { - auto pCmdMgr = project.GetCommandManager(); - const auto &keyString = pCmdMgr->GetKeyFromName(commandName); - return keyString.empty() - ? label - : label + wxT(" (") + keyString + wxT(")"); - } -} - void AdornedRulerPanel::ReCreateButtons() { for (auto & button : mButtons) { @@ -2797,10 +2784,12 @@ void AdornedRulerPanel::OnContextMenu(wxContextMenuEvent & WXUNUSED(event)) void AdornedRulerPanel::UpdateButtonStates() { auto common = [this] - (wxWindow *button, const wxString &commandName, const wxString &label){ - const auto &fullLabel = ComposeButtonLabel(*mProject, commandName, label); - button->SetLabel(fullLabel); - button->SetToolTip(fullLabel); + (AButton &button, const wxString &commandName, const wxString &label) { + std::vector commands; + commands.push_back(label); + commands.push_back(commandName); + ToolBar::SetButtonToolTip(button, commands); + button.SetLabel(button.GetToolTipText()); }; { @@ -2813,7 +2802,7 @@ void AdornedRulerPanel::UpdateButtonStates() // (which is, to toggle the state) ? _("Pinned play/record Head") : _("Unpinned play/record Head"); - common(pinButton, wxT("PinnedHead"), label); + common(*pinButton, wxT("PinnedHead"), label); } auto &scrubber = mProject->GetScrubber();