mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 16:10:06 +02:00
NumericTextCtrl::SetName takes TranslatableString
This commit is contained in:
parent
2214b5ff3b
commit
5909f67fdb
@ -2885,7 +2885,7 @@ void VSTEffect::BuildPlain()
|
|||||||
mSampleRate,
|
mSampleRate,
|
||||||
NumericTextCtrl::Options{}
|
NumericTextCtrl::Options{}
|
||||||
.AutoPos(true));
|
.AutoPos(true));
|
||||||
mDuration->SetName(_("Duration"));
|
mDuration->SetName( XO("Duration") );
|
||||||
gridSizer->Add(mDuration, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
gridSizer->Add(mDuration, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||||
gridSizer->Add(1, 1, 0);
|
gridSizer->Add(1, 1, 0);
|
||||||
gridSizer->Add(1, 1, 0);
|
gridSizer->Add(1, 1, 0);
|
||||||
|
@ -1251,7 +1251,7 @@ bool LadspaEffect::PopulateUI(wxWindow *parent)
|
|||||||
mSampleRate,
|
mSampleRate,
|
||||||
NumericTextCtrl::Options{}
|
NumericTextCtrl::Options{}
|
||||||
.AutoPos(true));
|
.AutoPos(true));
|
||||||
mDuration->SetName(_("Duration"));
|
mDuration->SetName( XO("Duration") );
|
||||||
gridSizer->Add(mDuration, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
gridSizer->Add(mDuration, 0, wxALIGN_CENTER_VERTICAL | wxALL, 5);
|
||||||
gridSizer->Add(1, 1, 0);
|
gridSizer->Add(1, 1, 0);
|
||||||
gridSizer->Add(1, 1, 0);
|
gridSizer->Add(1, 1, 0);
|
||||||
|
@ -2334,7 +2334,7 @@ bool LV2Effect::BuildPlain()
|
|||||||
mSampleRate,
|
mSampleRate,
|
||||||
NumericTextCtrl::Options {}
|
NumericTextCtrl::Options {}
|
||||||
.AutoPos(true));
|
.AutoPos(true));
|
||||||
mDuration->SetName(_("Duration"));
|
mDuration->SetName( XO("Duration") );
|
||||||
sizer->Add(mDuration, 0, wxALIGN_CENTER | wxALL, 5);
|
sizer->Add(mDuration, 0, wxALIGN_CENTER | wxALL, 5);
|
||||||
|
|
||||||
groupSizer->Add(sizer.release(), 0, wxALIGN_CENTER | wxALL, 5);
|
groupSizer->Add(sizer.release(), 0, wxALIGN_CENTER | wxALL, 5);
|
||||||
|
@ -162,12 +162,13 @@ auStaticText * SelectionBar::AddTitle( const wxString & Title, wxSizer * pSizer
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
NumericTextCtrl * SelectionBar::AddTime( const wxString Name, int id, wxSizer * pSizer ){
|
NumericTextCtrl * SelectionBar::AddTime(
|
||||||
|
const TranslatableString &Name, int id, wxSizer * pSizer ){
|
||||||
auto formatName = mListener ? mListener->AS_GetSelectionFormat()
|
auto formatName = mListener ? mListener->AS_GetSelectionFormat()
|
||||||
: NumericFormatSymbol{};
|
: NumericFormatSymbol{};
|
||||||
auto pCtrl = safenew NumericTextCtrl(
|
auto pCtrl = safenew NumericTextCtrl(
|
||||||
this, id, NumericConverter::TIME, formatName, 0.0, mRate);
|
this, id, NumericConverter::TIME, formatName, 0.0, mRate);
|
||||||
pCtrl->SetName(Name);
|
pCtrl->SetName( Name );
|
||||||
pSizer->Add(pCtrl, 0, wxALIGN_TOP | wxRIGHT, 5);
|
pSizer->Add(pCtrl, 0, wxALIGN_TOP | wxRIGHT, 5);
|
||||||
return pCtrl;
|
return pCtrl;
|
||||||
}
|
}
|
||||||
@ -327,7 +328,7 @@ void SelectionBar::Populate()
|
|||||||
|
|
||||||
AddVLine( mainSizer );
|
AddVLine( mainSizer );
|
||||||
|
|
||||||
mAudioTime = AddTime(_("Audio Position"), AudioTimeID, mainSizer );
|
mAudioTime = AddTime( XO("Audio Position"), AudioTimeID, mainSizer );
|
||||||
// This vertical line is NOT just for decoration!
|
// This vertical line is NOT just for decoration!
|
||||||
// It works around a wxWidgets-on-Windows RadioButton bug, where tabbing
|
// It works around a wxWidgets-on-Windows RadioButton bug, where tabbing
|
||||||
// into the radiobutton group jumps to selecting the first item in the
|
// into the radiobutton group jumps to selecting the first item in the
|
||||||
@ -341,10 +342,10 @@ void SelectionBar::Populate()
|
|||||||
{
|
{
|
||||||
auto hSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
auto hSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
||||||
|
|
||||||
mStartTime = AddTime(_("Start"), StartTimeID, hSizer.get() );
|
mStartTime = AddTime( XO("Start"), StartTimeID, hSizer.get() );
|
||||||
mLengthTime = AddTime(_("Length"), LengthTimeID, hSizer.get() );
|
mLengthTime = AddTime( XO("Length"), LengthTimeID, hSizer.get() );
|
||||||
mCenterTime = AddTime(_("Center"), CenterTimeID, hSizer.get() );
|
mCenterTime = AddTime( XO("Center"), CenterTimeID, hSizer.get() );
|
||||||
mEndTime = AddTime(_("End"), EndTimeID, hSizer.get() );
|
mEndTime = AddTime( XO("End"), EndTimeID, hSizer.get() );
|
||||||
mainSizer->Add(hSizer.release(), 0, wxALIGN_TOP | wxRIGHT, 0);
|
mainSizer->Add(hSizer.release(), 0, wxALIGN_TOP | wxRIGHT, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -557,18 +558,30 @@ void SelectionBar::SetDrivers( int driver1, int driver2 )
|
|||||||
mDrive2 = driver2;
|
mDrive2 = driver2;
|
||||||
|
|
||||||
NumericTextCtrl ** Ctrls[4] = { &mStartTime, &mCenterTime, &mLengthTime, &mEndTime};
|
NumericTextCtrl ** Ctrls[4] = { &mStartTime, &mCenterTime, &mLengthTime, &mEndTime};
|
||||||
wxString Text[4] = { _("Start"), _("Center"), _("Length"), _("End") };
|
static TranslatableString Text[4] = {
|
||||||
|
/* i18n-hint noun */
|
||||||
|
XO("Start"),
|
||||||
|
XO("Center"),
|
||||||
|
XO("Length"),
|
||||||
|
/* i18n-hint noun */
|
||||||
|
XO("End")
|
||||||
|
};
|
||||||
|
|
||||||
for(int i=0;i<4;i++){
|
for(int i=0;i<4;i++){
|
||||||
int id = i + StartTimeID;
|
int id = i + StartTimeID;
|
||||||
int fixed = (( id == mDrive2 )?mDrive1:mDrive2)-StartTimeID;
|
int fixed = (( id == mDrive2 )?mDrive1:mDrive2)-StartTimeID;
|
||||||
|
|
||||||
wxString Temp = Text[i];
|
const auto &Temp = Text[i];
|
||||||
// i18n-hint: %s is replaced e.g by 'Length', to indicate that it will be calculated from other parameters.
|
auto Title = ( (id!=mDrive1) && (id!=mDrive2 ) )
|
||||||
wxString Format = ( (id!=mDrive1) && (id!=mDrive2 ) ) ? _("%s - driven") : "%s";
|
/* i18n-hint: %s is replaced e.g by one of 'Length', 'Center',
|
||||||
wxString Title= wxString::Format( Format, Temp );
|
'Start', or 'End' (translated), to indicate that it will be
|
||||||
// i18n-hint: %s1 is replaced e.g by 'Length', %s2 e.g by 'Center'.
|
calculated from other parameters. */
|
||||||
wxString VoiceOverText = wxString::Format(_("Selection %s. %s won't change."), Temp, Text[fixed]);
|
? XO("%s - driven").Format( Temp )
|
||||||
|
: Temp ;
|
||||||
|
auto VoiceOverText =
|
||||||
|
/* i18n-hint: each string is replaced by one of 'Length', 'Center',
|
||||||
|
'Start', or 'End' (translated) */
|
||||||
|
XO("Selection %s. %s won't change.").Format( Temp, Text[fixed] );
|
||||||
if( *Ctrls[i] ){
|
if( *Ctrls[i] ){
|
||||||
(*Ctrls[i])->SetName( Temp );
|
(*Ctrls[i])->SetName( Temp );
|
||||||
}
|
}
|
||||||
|
@ -63,7 +63,7 @@ class SelectionBar final : public ToolBar {
|
|||||||
private:
|
private:
|
||||||
auStaticText * AddTitle( const wxString & Title,
|
auStaticText * AddTitle( const wxString & Title,
|
||||||
wxSizer * pSizer );
|
wxSizer * pSizer );
|
||||||
NumericTextCtrl * AddTime( const wxString Name, int id, wxSizer * pSizer );
|
NumericTextCtrl * AddTime( const TranslatableString &Name, int id, wxSizer * pSizer );
|
||||||
void AddVLine( wxSizer * pSizer );
|
void AddVLine( wxSizer * pSizer );
|
||||||
|
|
||||||
void SetSelectionMode(int mode);
|
void SetSelectionMode(int mode);
|
||||||
|
@ -197,7 +197,7 @@ void SpectralSelectionBar::Populate()
|
|||||||
NumericTextCtrl::Options{}
|
NumericTextCtrl::Options{}
|
||||||
.InvalidValue( true, SelectedRegion::UndefinedFrequency )
|
.InvalidValue( true, SelectedRegion::UndefinedFrequency )
|
||||||
);
|
);
|
||||||
mCenterCtrl->SetName(_("Center Frequency"));
|
mCenterCtrl->SetName( XO("Center Frequency") );
|
||||||
subSizer->Add(mCenterCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
subSizer->Add(mCenterCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
||||||
|
|
||||||
mWidthCtrl = safenew NumericTextCtrl(
|
mWidthCtrl = safenew NumericTextCtrl(
|
||||||
@ -206,7 +206,7 @@ void SpectralSelectionBar::Populate()
|
|||||||
NumericTextCtrl::Options{}
|
NumericTextCtrl::Options{}
|
||||||
.InvalidValue( true, -1.0 )
|
.InvalidValue( true, -1.0 )
|
||||||
);
|
);
|
||||||
mWidthCtrl->SetName(wxString(_("Bandwidth")));
|
mWidthCtrl->SetName( XO("Bandwidth") );
|
||||||
subSizer->Add(mWidthCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
subSizer->Add(mWidthCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
||||||
|
|
||||||
mLowCtrl = safenew NumericTextCtrl(
|
mLowCtrl = safenew NumericTextCtrl(
|
||||||
@ -215,7 +215,7 @@ void SpectralSelectionBar::Populate()
|
|||||||
NumericTextCtrl::Options{}
|
NumericTextCtrl::Options{}
|
||||||
.InvalidValue( true, SelectedRegion::UndefinedFrequency )
|
.InvalidValue( true, SelectedRegion::UndefinedFrequency )
|
||||||
);
|
);
|
||||||
mLowCtrl->SetName(_("Low Frequency"));
|
mLowCtrl->SetName( XO("Low Frequency") );
|
||||||
subSizer->Add(mLowCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
subSizer->Add(mLowCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
||||||
|
|
||||||
mHighCtrl = safenew NumericTextCtrl(
|
mHighCtrl = safenew NumericTextCtrl(
|
||||||
@ -224,7 +224,7 @@ void SpectralSelectionBar::Populate()
|
|||||||
NumericTextCtrl::Options{}
|
NumericTextCtrl::Options{}
|
||||||
.InvalidValue( true, SelectedRegion::UndefinedFrequency )
|
.InvalidValue( true, SelectedRegion::UndefinedFrequency )
|
||||||
);
|
);
|
||||||
mHighCtrl->SetName(wxString(_("High Frequency")));
|
mHighCtrl->SetName( XO("High Frequency") );
|
||||||
subSizer->Add(mHighCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
subSizer->Add(mHighCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
||||||
|
|
||||||
mCenterCtrl->Show(mbCenterAndWidth);
|
mCenterCtrl->Show(mbCenterAndWidth);
|
||||||
|
@ -1338,7 +1338,7 @@ NumericTextCtrl::NumericTextCtrl(wxWindow *parent, wxWindowID id,
|
|||||||
|
|
||||||
#if wxUSE_ACCESSIBILITY
|
#if wxUSE_ACCESSIBILITY
|
||||||
SetLabel(wxT(""));
|
SetLabel(wxT(""));
|
||||||
SetName(wxT(""));
|
SetName( {} );
|
||||||
SetAccessible(safenew NumericTextCtrlAx(this));
|
SetAccessible(safenew NumericTextCtrlAx(this));
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
@ -1356,6 +1356,11 @@ NumericTextCtrl::~NumericTextCtrl()
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void NumericTextCtrl::SetName( const TranslatableString &name )
|
||||||
|
{
|
||||||
|
wxControl::SetName( name.Translation() );
|
||||||
|
}
|
||||||
|
|
||||||
// Set the focus to the first (left-most) non-zero digit
|
// Set the focus to the first (left-most) non-zero digit
|
||||||
// If all digits are zero, the right-most position is focused
|
// If all digits are zero, the right-most position is focused
|
||||||
// If all digits are hyphens (invalid), the left-most position is focused
|
// If all digits are hyphens (invalid), the left-most position is focused
|
||||||
|
@ -187,6 +187,9 @@ class NumericTextCtrl final : public wxControl, public NumericConverter
|
|||||||
|
|
||||||
virtual ~NumericTextCtrl();
|
virtual ~NumericTextCtrl();
|
||||||
|
|
||||||
|
// Hide the inherited function that takes wxString
|
||||||
|
void SetName( const TranslatableString &name );
|
||||||
|
|
||||||
bool Layout() override;
|
bool Layout() override;
|
||||||
void Fit() override;
|
void Fit() override;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user