mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-20 14:20:06 +02:00
TranslatableString for toolbar button labels
This commit is contained in:
parent
75996a851c
commit
c682718ee4
@ -1758,7 +1758,7 @@ void AdornedRulerPanel::UpdateButtonStates()
|
||||
AButton &button, const CommandID &commandName, const TranslatableString &label) {
|
||||
ComponentInterfaceSymbol command{ commandName, label };
|
||||
ToolBar::SetButtonToolTip( *mProject, button, &command, 1u );
|
||||
button.SetLabel(button.GetToolTipText());
|
||||
button.SetLabel( Verbatim( button.GetToolTipText() ) );
|
||||
|
||||
button.UpdateStatus();
|
||||
};
|
||||
|
@ -151,7 +151,7 @@ AButton *ControlToolBar::MakeButton(ControlToolBar *pBar,
|
||||
teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
|
||||
int id,
|
||||
bool processdownevents,
|
||||
const wxChar *label)
|
||||
const TranslatableString &label)
|
||||
{
|
||||
AButton *r = ToolBar::MakeButton(pBar,
|
||||
bmpRecoloredUpLarge, bmpRecoloredDownLarge, bmpRecoloredUpHiliteLarge, bmpRecoloredHiliteLarge,
|
||||
@ -190,10 +190,10 @@ void ControlToolBar::Populate()
|
||||
MakeButtonBackgroundsLarge();
|
||||
|
||||
mPause = MakeButton(this, bmpPause, bmpPause, bmpPauseDisabled,
|
||||
ID_PAUSE_BUTTON, true, _("Pause"));
|
||||
ID_PAUSE_BUTTON, true, XO("Pause"));
|
||||
|
||||
mPlay = MakeButton(this, bmpPlay, bmpPlay, bmpPlayDisabled,
|
||||
ID_PLAY_BUTTON, true, _("Play"));
|
||||
ID_PLAY_BUTTON, true, XO("Play"));
|
||||
MakeAlternateImages(*mPlay, 1, bmpLoop, bmpLoop, bmpLoopDisabled);
|
||||
MakeAlternateImages(*mPlay, 2,
|
||||
bmpCutPreview, bmpCutPreview, bmpCutPreviewDisabled);
|
||||
@ -204,16 +204,16 @@ void ControlToolBar::Populate()
|
||||
mPlay->FollowModifierKeys();
|
||||
|
||||
mStop = MakeButton(this, bmpStop, bmpStop, bmpStopDisabled ,
|
||||
ID_STOP_BUTTON, false, _("Stop"));
|
||||
ID_STOP_BUTTON, false, XO("Stop"));
|
||||
|
||||
mRewind = MakeButton(this, bmpRewind, bmpRewind, bmpRewindDisabled,
|
||||
ID_REW_BUTTON, false, _("Skip to Start"));
|
||||
ID_REW_BUTTON, false, XO("Skip to Start"));
|
||||
|
||||
mFF = MakeButton(this, bmpFFwd, bmpFFwd, bmpFFwdDisabled,
|
||||
ID_FF_BUTTON, false, _("Skip to End"));
|
||||
ID_FF_BUTTON, false, XO("Skip to End"));
|
||||
|
||||
mRecord = MakeButton(this, bmpRecord, bmpRecord, bmpRecordDisabled,
|
||||
ID_RECORD_BUTTON, false, _("Record"));
|
||||
ID_RECORD_BUTTON, false, XO("Record"));
|
||||
|
||||
bool bPreferNewTrack;
|
||||
gPrefs->Read("/GUI/PreferNewTrackRecord",&bPreferNewTrack, false);
|
||||
|
@ -88,7 +88,7 @@ class ControlToolBar final : public ToolBar {
|
||||
teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
|
||||
int id,
|
||||
bool processdownevents,
|
||||
const wxChar *label);
|
||||
const TranslatableString &label);
|
||||
|
||||
static
|
||||
void MakeAlternateImages(AButton &button, int idx,
|
||||
|
@ -104,7 +104,7 @@ AButton *EditToolBar::AddButton(
|
||||
EditToolBar *pBar,
|
||||
teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
|
||||
int id,
|
||||
const wxChar *label,
|
||||
const TranslatableString &label,
|
||||
bool toggle)
|
||||
{
|
||||
AButton *&r = pBar->mButtons[id];
|
||||
@ -134,28 +134,28 @@ void EditToolBar::Populate()
|
||||
/* Buttons */
|
||||
// Tooltips slightly more verbose than the menu entries are.
|
||||
AddButton(this, bmpCut, bmpCut, bmpCutDisabled, ETBCutID,
|
||||
_("Cut selection"));
|
||||
XO("Cut selection"));
|
||||
AddButton(this, bmpCopy, bmpCopy, bmpCopyDisabled, ETBCopyID,
|
||||
_("Copy selection"));
|
||||
XO("Copy selection"));
|
||||
AddButton(this, bmpPaste, bmpPaste, bmpPasteDisabled, ETBPasteID,
|
||||
_("Paste"));
|
||||
XO("Paste"));
|
||||
AddButton(this, bmpTrim, bmpTrim, bmpTrimDisabled, ETBTrimID,
|
||||
_("Trim audio outside selection"));
|
||||
XO("Trim audio outside selection"));
|
||||
AddButton(this, bmpSilence, bmpSilence, bmpSilenceDisabled, ETBSilenceID,
|
||||
_("Silence audio selection"));
|
||||
XO("Silence audio selection"));
|
||||
|
||||
AddSeparator();
|
||||
|
||||
AddButton(this, bmpUndo, bmpUndo, bmpUndoDisabled, ETBUndoID,
|
||||
_("Undo"));
|
||||
XO("Undo"));
|
||||
AddButton(this, bmpRedo, bmpRedo, bmpRedoDisabled, ETBRedoID,
|
||||
_("Redo"));
|
||||
XO("Redo"));
|
||||
|
||||
AddSeparator();
|
||||
|
||||
#ifdef OPTION_SYNC_LOCK_BUTTON
|
||||
AddButton(this, bmpSyncLockTracksUp, bmpSyncLockTracksDown, bmpSyncLockTracksUp, ETBSyncLockID,
|
||||
_("Sync-Lock Tracks"), true);
|
||||
XO("Sync-Lock Tracks"), true);
|
||||
|
||||
AddSeparator();
|
||||
#endif
|
||||
@ -163,17 +163,17 @@ void EditToolBar::Populate()
|
||||
// Tooltips match menu entries.
|
||||
// We previously had longer tooltips which were not more clear.
|
||||
AddButton(this, bmpZoomIn, bmpZoomIn, bmpZoomInDisabled, ETBZoomInID,
|
||||
_("Zoom In"));
|
||||
XO("Zoom In"));
|
||||
AddButton(this, bmpZoomOut, bmpZoomOut, bmpZoomOutDisabled, ETBZoomOutID,
|
||||
_("Zoom Out"));
|
||||
XO("Zoom Out"));
|
||||
AddButton(this, bmpZoomSel, bmpZoomSel, bmpZoomSelDisabled, ETBZoomSelID,
|
||||
_("Zoom to Selection"));
|
||||
XO("Zoom to Selection"));
|
||||
AddButton(this, bmpZoomFit, bmpZoomFit, bmpZoomFitDisabled, ETBZoomFitID,
|
||||
_("Fit to Width"));
|
||||
XO("Fit to Width"));
|
||||
|
||||
#ifdef EXPERIMENTAL_ZOOM_TOGGLE_BUTTON
|
||||
AddButton(this, bmpZoomToggle, bmpZoomToggle, bmpZoomToggleDisabled, ETBZoomToggleID,
|
||||
_("Zoom Toggle"));
|
||||
XO("Zoom Toggle"));
|
||||
#endif
|
||||
|
||||
|
||||
@ -195,7 +195,7 @@ void EditToolBar::Populate()
|
||||
#if defined(EXPERIMENTAL_EFFECTS_RACK)
|
||||
AddSeparator();
|
||||
AddButton(this, bmpEditEffects, bmpEditEffects, bmpEditEffects, ETBEffectsID,
|
||||
_("Show Effects Rack"), true);
|
||||
XO("Show Effects Rack"), true);
|
||||
#endif
|
||||
|
||||
RegenerateTooltips();
|
||||
|
@ -91,7 +91,7 @@ class EditToolBar final : public ToolBar {
|
||||
static AButton *AddButton(
|
||||
EditToolBar *pBar,
|
||||
teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
|
||||
int id, const wxChar *label, bool toggle = false);
|
||||
int id, const TranslatableString &label, bool toggle = false);
|
||||
|
||||
void AddSeparator();
|
||||
|
||||
|
@ -89,7 +89,7 @@ AButton *ScrubbingToolBar::AddButton
|
||||
(ScrubbingToolBar *pBar,
|
||||
teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
|
||||
int id,
|
||||
const wxChar *label,
|
||||
const TranslatableString &label,
|
||||
bool toggle)
|
||||
{
|
||||
AButton *&r = pBar->mButtons[id];
|
||||
@ -119,12 +119,12 @@ void ScrubbingToolBar::Populate()
|
||||
|
||||
/* Buttons */
|
||||
AddButton(this, bmpScrub, bmpScrub, bmpScrubDisabled, STBScrubID,
|
||||
_("Scrub"), true);
|
||||
XO("Scrub"), true);
|
||||
AddButton(this, bmpSeek, bmpSeek, bmpSeekDisabled, STBSeekID,
|
||||
_("Seek"), true);
|
||||
XO("Seek"), true);
|
||||
AddButton(this, bmpToggleScrubRuler, bmpToggleScrubRuler, bmpToggleScrubRuler,
|
||||
STBRulerID,
|
||||
_("Scrub Ruler"), true);
|
||||
XO("Scrub Ruler"), true);
|
||||
|
||||
|
||||
RegenerateTooltips();
|
||||
|
@ -62,7 +62,7 @@ private:
|
||||
static AButton *AddButton(
|
||||
ScrubbingToolBar *pBar,
|
||||
teBmps eEnabledUp, teBmps eEnabledDown, teBmps eDisabled,
|
||||
int id, const wxChar *label, bool toggle = false);
|
||||
int id, const TranslatableString &label, bool toggle = false);
|
||||
|
||||
void MakeButtons();
|
||||
|
||||
|
@ -173,7 +173,7 @@ void ToolsToolBar::UpdatePrefs()
|
||||
|
||||
AButton * ToolsToolBar::MakeTool(
|
||||
ToolsToolBar *pBar, teBmps eTool,
|
||||
int id, const wxChar *label)
|
||||
int id, const TranslatableString &label)
|
||||
{
|
||||
AButton *button = ToolBar::MakeButton(pBar,
|
||||
bmpRecoloredUpSmall,
|
||||
@ -198,12 +198,12 @@ void ToolsToolBar::Populate()
|
||||
|
||||
/* Tools */
|
||||
using namespace ToolCodes;
|
||||
mTool[ selectTool ] = MakeTool( this, bmpIBeam, selectTool, _("Selection Tool") );
|
||||
mTool[ envelopeTool ] = MakeTool( this, bmpEnvelope, envelopeTool, _("Envelope Tool") );
|
||||
mTool[ drawTool ] = MakeTool( this, bmpDraw, drawTool, _("Draw Tool") );
|
||||
mTool[ zoomTool ] = MakeTool( this, bmpZoom, zoomTool, _("Zoom Tool") );
|
||||
mTool[ slideTool ] = MakeTool( this, bmpTimeShift, slideTool, _("Slide Tool") );
|
||||
mTool[ multiTool ] = MakeTool( this, bmpMulti, multiTool, _("Multi Tool") );
|
||||
mTool[ selectTool ] = MakeTool( this, bmpIBeam, selectTool, XO("Selection Tool") );
|
||||
mTool[ envelopeTool ] = MakeTool( this, bmpEnvelope, envelopeTool, XO("Envelope Tool") );
|
||||
mTool[ drawTool ] = MakeTool( this, bmpDraw, drawTool, XO("Draw Tool") );
|
||||
mTool[ zoomTool ] = MakeTool( this, bmpZoom, zoomTool, XO("Zoom Tool") );
|
||||
mTool[ slideTool ] = MakeTool( this, bmpTimeShift, slideTool, XO("Slide Tool") );
|
||||
mTool[ multiTool ] = MakeTool( this, bmpMulti, multiTool, XO("Multi Tool") );
|
||||
|
||||
mTool[mCurrentTool]->PushDown();
|
||||
|
||||
|
@ -63,7 +63,7 @@ class ToolsToolBar final : public ToolBar {
|
||||
void RegenerateTooltips() override;
|
||||
wxImage *MakeToolImage(wxImage *tool, wxImage *mask, int style);
|
||||
static AButton *MakeTool(
|
||||
ToolsToolBar *pBar, teBmps eTool, int id, const wxChar *label);
|
||||
ToolsToolBar *pBar, teBmps eTool, int id, const TranslatableString &label);
|
||||
|
||||
enum { numTools = 6 };
|
||||
AButton *mTool[numTools];
|
||||
|
@ -167,7 +167,7 @@ AButton *TranscriptionToolBar::AddButton(
|
||||
TranscriptionToolBar *pBar,
|
||||
teBmps eFore, teBmps eDisabled,
|
||||
int id,
|
||||
const wxChar *label)
|
||||
const TranslatableString &label)
|
||||
{
|
||||
AButton *&r = pBar->mButtons[id];
|
||||
|
||||
@ -206,7 +206,7 @@ void TranscriptionToolBar::Populate()
|
||||
MakeButtonBackgroundsSmall();
|
||||
|
||||
AddButton(this, bmpPlay, bmpPlayDisabled, TTB_PlaySpeed,
|
||||
_("Play at selected speed"));
|
||||
XO("Play at selected speed"));
|
||||
MakeAlternateImages(bmpLoop, bmpLoopDisabled, TTB_PlaySpeed, 1);
|
||||
MakeAlternateImages(bmpCutPreview, bmpCutPreviewDisabled, TTB_PlaySpeed, 2);
|
||||
mButtons[TTB_PlaySpeed]->FollowModifierKeys();
|
||||
@ -238,7 +238,7 @@ void TranscriptionToolBar::Populate()
|
||||
#ifdef EXPERIMENTAL_VOICE_DETECTION
|
||||
// If we need these strings translated, then search and replace
|
||||
// TRANSLATBLE by _ and remove this #define.
|
||||
#define TRANSLATABLE( x ) wxT( x )
|
||||
#define TRANSLATABLE( x ) Verbatim( x )
|
||||
AddButton(this, bmpTnStartOn, bmpTnStartOnDisabled, TTB_StartOn,
|
||||
TRANSLATABLE("Adjust left selection to next onset"));
|
||||
AddButton(this, bmpTnEndOn, bmpTnEndOnDisabled, TTB_EndOn,
|
||||
|
@ -126,7 +126,7 @@ class TranscriptionToolBar final : public ToolBar {
|
||||
TranscriptionToolBar *pBar,
|
||||
teBmps eFore, teBmps eDisabled,
|
||||
int id,
|
||||
const wxChar *label);
|
||||
const TranslatableString &label);
|
||||
void MakeAlternateImages(
|
||||
teBmps eFore, teBmps eDisabled,
|
||||
int id, unsigned altIdx);
|
||||
|
@ -285,9 +285,14 @@ void AButton::UseDisabledAsDownHiliteImage(bool flag)
|
||||
mUseDisabledAsDownHiliteImage = flag;
|
||||
}
|
||||
|
||||
void AButton::SetToolTip( TranslatableString toolTip )
|
||||
void AButton::SetToolTip( const TranslatableString &toolTip )
|
||||
{
|
||||
wxWindow::SetToolTip( toolTip.Strip().Translation() );
|
||||
wxWindow::SetToolTip( toolTip.Stripped().Translation() );
|
||||
}
|
||||
|
||||
void AButton::SetLabel( const TranslatableString &toolTip )
|
||||
{
|
||||
wxWindow::SetLabel( toolTip.Stripped().Translation() );
|
||||
}
|
||||
|
||||
// This compensates for a but in wxWidgets 3.0.2 for mac:
|
||||
|
@ -56,8 +56,11 @@ class AButton final : public wxWindow {
|
||||
|
||||
virtual ~ AButton();
|
||||
|
||||
// overload and hide the inherited function that takes naked wxString:
|
||||
void SetToolTip(TranslatableString toolTip);
|
||||
// hide the inherited function that takes naked wxString:
|
||||
void SetToolTip(const TranslatableString &toolTip);
|
||||
|
||||
// hide the inherited function that takes naked wxString:
|
||||
void SetLabel(const TranslatableString &label);
|
||||
|
||||
bool AcceptsFocus() const override { return s_AcceptsFocus; }
|
||||
bool AcceptsFocusFromKeyboard() const override { return mEnabled; }
|
||||
|
Loading…
x
Reference in New Issue
Block a user