mirror of
https://github.com/cookiengineer/audacity
synced 2025-11-23 17:30:17 +01:00
TranslatableString for names, labels, tooltips of wxPanelWrapper...
... and Grabber too
This commit is contained in:
@@ -106,6 +106,10 @@ void Grabber::SetAsSpacer( bool bIsSpacer ) {
|
||||
mAsSpacer = bIsSpacer;
|
||||
};
|
||||
|
||||
void Grabber::SetToolTip(TranslatableString toolTip)
|
||||
{
|
||||
wxWindow::SetToolTip( toolTip.Strip().Translation() );
|
||||
}
|
||||
|
||||
//
|
||||
// Draw the grabber
|
||||
@@ -215,7 +219,7 @@ void Grabber::OnEnter(wxMouseEvent & WXUNUSED(event))
|
||||
// to make it pop up when we want it.
|
||||
const auto text = GetToolTipText();
|
||||
UnsetToolTip();
|
||||
SetToolTip(text);
|
||||
wxWindow::SetToolTip(text);
|
||||
|
||||
if( mAsSpacer )
|
||||
return;
|
||||
|
||||
@@ -34,6 +34,8 @@ flicker-free use.
|
||||
#include <wx/defs.h>
|
||||
#include <wx/statbmp.h> // to inherit
|
||||
|
||||
class TranslatableString;
|
||||
|
||||
////////////////////////////////////////////////////////////
|
||||
/// Grabber Class
|
||||
////////////////////////////////////////////////////////////
|
||||
@@ -116,6 +118,9 @@ class Grabber final : public wxWindow
|
||||
void PushButton(bool state);
|
||||
void SetAsSpacer( bool bIsSpacer );
|
||||
|
||||
// overload and hide the inherited function that takes naked wxString:
|
||||
void SetToolTip(TranslatableString toolTip);
|
||||
|
||||
protected:
|
||||
|
||||
void OnLeftDown(wxMouseEvent & event);
|
||||
|
||||
@@ -319,7 +319,7 @@ MeterPanel::MeterPanel(AudacityProject *project,
|
||||
mAccSilent(false)
|
||||
{
|
||||
// i18n-hint: Noun (the meter is used for playback or record level monitoring)
|
||||
SetName( _("Meter") );
|
||||
SetName( XO("Meter") );
|
||||
// Suppress warnings about the header file
|
||||
wxUnusedVar(SpeakerMenu_xpm);
|
||||
wxUnusedVar(MicMenu_xpm);
|
||||
|
||||
@@ -38,6 +38,26 @@ void wxTabTraversalWrapperCharHook(wxKeyEvent &event)
|
||||
event.Skip();
|
||||
}
|
||||
|
||||
void wxPanelWrapper::SetLabel(const TranslatableString & label)
|
||||
{
|
||||
wxPanel::SetLabel( label.Translation() );
|
||||
}
|
||||
|
||||
void wxPanelWrapper::SetName(const TranslatableString & name)
|
||||
{
|
||||
wxPanel::SetName( name.Translation() );
|
||||
}
|
||||
|
||||
void wxPanelWrapper::SetToolTip(TranslatableString toolTip)
|
||||
{
|
||||
wxPanel::SetToolTip( toolTip.Strip().Translation() );
|
||||
}
|
||||
|
||||
void wxPanelWrapper::SetName()
|
||||
{
|
||||
wxPanel::SetName( GetLabel() );
|
||||
}
|
||||
|
||||
void wxDialogWrapper::SetTitle(const TranslatableString & title)
|
||||
{
|
||||
wxDialog::SetTitle( title.Translation() );
|
||||
|
||||
@@ -50,8 +50,9 @@ public:
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||
// Important: default window name localizes!
|
||||
const wxString& name = _("Panel"))
|
||||
: wxTabTraversalWrapper<wxPanel> ( parent, winid, pos, size, style, name )
|
||||
const TranslatableString& name = XO("Panel"))
|
||||
: wxTabTraversalWrapper<wxPanel> (
|
||||
parent, winid, pos, size, style, name.Translation() )
|
||||
{}
|
||||
|
||||
// Pseudo ctor
|
||||
@@ -62,12 +63,18 @@ public:
|
||||
const wxSize& size = wxDefaultSize,
|
||||
long style = wxTAB_TRAVERSAL | wxNO_BORDER,
|
||||
// Important: default window name localizes!
|
||||
const wxString& name = _("Panel"))
|
||||
const TranslatableString& name = XO("Panel"))
|
||||
{
|
||||
return wxTabTraversalWrapper<wxPanel>::Create(
|
||||
parent, winid, pos, size, style, name
|
||||
parent, winid, pos, size, style, name.Translation()
|
||||
);
|
||||
}
|
||||
// overload and hide the inherited functions that take naked wxString:
|
||||
void SetLabel(const TranslatableString & label);
|
||||
void SetName(const TranslatableString & name);
|
||||
void SetToolTip(TranslatableString toolTip);
|
||||
// Set the name to equal the label:
|
||||
void SetName();
|
||||
};
|
||||
|
||||
class AUDACITY_DLL_API wxDialogWrapper : public wxTabTraversalWrapper<wxDialog>
|
||||
|
||||
Reference in New Issue
Block a user