1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-03 22:19:07 +02:00

ShuttleGui static boxes can wrap long text

This commit is contained in:
Paul Licameli 2017-10-20 09:53:21 -04:00
parent 0300b49b37
commit 027a5ca32e
7 changed files with 54 additions and 27 deletions

View File

@ -225,7 +225,7 @@ void ShuttleGuiBase::HandleOptionality(const wxString &Prompt)
} }
/// Right aligned text string. /// Right aligned text string.
void ShuttleGuiBase::AddPrompt(const wxString &Prompt) void ShuttleGuiBase::AddPrompt(const wxString &Prompt, int wrapWidth)
{ {
if( mShuttleMode != eIsCreating ) if( mShuttleMode != eIsCreating )
return; return;
@ -239,35 +239,44 @@ void ShuttleGuiBase::AddPrompt(const wxString &Prompt)
if( Prompt.empty() ) if( Prompt.empty() )
return; return;
miProp=1; miProp=1;
mpWind = safenew wxStaticText(GetParent(), -1, Prompt, wxDefaultPosition, wxDefaultSize, auto text = safenew wxStaticText(GetParent(), -1, Prompt, wxDefaultPosition, wxDefaultSize,
GetStyle( wxALIGN_RIGHT )); GetStyle( wxALIGN_RIGHT ));
mpWind = text;
if (wrapWidth > 0)
text->Wrap(wrapWidth);
mpWind->SetName(wxStripMenuCodes(Prompt)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) mpWind->SetName(wxStripMenuCodes(Prompt)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
UpdateSizersCore( false, wxALL | wxALIGN_CENTRE_VERTICAL, true ); UpdateSizersCore( false, wxALL | wxALIGN_CENTRE_VERTICAL, true );
} }
/// Left aligned text string. /// Left aligned text string.
void ShuttleGuiBase::AddUnits(const wxString &Prompt) void ShuttleGuiBase::AddUnits(const wxString &Prompt, int wrapWidth)
{ {
if( Prompt.empty() ) if( Prompt.empty() )
return; return;
if( mShuttleMode != eIsCreating ) if( mShuttleMode != eIsCreating )
return; return;
miProp=1; miProp = 1;
mpWind = safenew wxStaticText(GetParent(), -1, Prompt, wxDefaultPosition, wxDefaultSize, auto text = safenew wxStaticText(GetParent(), -1, Prompt, wxDefaultPosition, wxDefaultSize,
GetStyle( wxALIGN_LEFT )); GetStyle( wxALIGN_LEFT ));
mpWind = text;
if (wrapWidth > 0)
text->Wrap(wrapWidth);
mpWind->SetName(Prompt); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) mpWind->SetName(Prompt); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
UpdateSizersCore( false, wxALL | wxALIGN_CENTRE_VERTICAL ); UpdateSizersCore( false, wxALL | wxALIGN_CENTRE_VERTICAL );
} }
/// Centred text string. /// Centred text string.
void ShuttleGuiBase::AddTitle(const wxString &Prompt) void ShuttleGuiBase::AddTitle(const wxString &Prompt, int wrapWidth)
{ {
if( Prompt.empty() ) if( Prompt.empty() )
return; return;
if( mShuttleMode != eIsCreating ) if( mShuttleMode != eIsCreating )
return; return;
mpWind = safenew wxStaticText(GetParent(), -1, Prompt, wxDefaultPosition, wxDefaultSize, auto text = safenew wxStaticText(GetParent(), -1, Prompt, wxDefaultPosition, wxDefaultSize,
GetStyle( wxALIGN_CENTRE )); GetStyle( wxALIGN_CENTRE ));
mpWind = text;
if (wrapWidth > 0)
text->Wrap(wrapWidth);
mpWind->SetName(Prompt); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) mpWind->SetName(Prompt); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
UpdateSizers(); UpdateSizers();
} }
@ -411,13 +420,16 @@ wxChoice * ShuttleGuiBase::AddChoice( const wxString &Prompt,
return AddChoice( Prompt, choices, choices.Index( Selected ) ); return AddChoice( Prompt, choices, choices.Index( Selected ) );
} }
void ShuttleGuiBase::AddFixedText(const wxString &Str, bool bCenter) void ShuttleGuiBase::AddFixedText(const wxString &Str, bool bCenter, int wrapWidth)
{ {
UseUpId(); UseUpId();
if( mShuttleMode != eIsCreating ) if( mShuttleMode != eIsCreating )
return; return;
mpWind = safenew wxStaticText(GetParent(), miId, Str, wxDefaultPosition, wxDefaultSize, auto text = safenew wxStaticText(GetParent(), miId, Str, wxDefaultPosition, wxDefaultSize,
GetStyle( wxALIGN_LEFT )); GetStyle( wxALIGN_LEFT ));
mpWind = text;
if ( wrapWidth > 0 )
text->Wrap( wrapWidth );
mpWind->SetName(wxStripMenuCodes(Str)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) mpWind->SetName(wxStripMenuCodes(Str)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
if( bCenter ) if( bCenter )
{ {
@ -428,15 +440,19 @@ void ShuttleGuiBase::AddFixedText(const wxString &Str, bool bCenter)
UpdateSizers(); UpdateSizers();
} }
wxStaticText * ShuttleGuiBase::AddVariableText(const wxString &Str, bool bCenter, int PositionFlags) wxStaticText * ShuttleGuiBase::AddVariableText(
const wxString &Str, bool bCenter, int PositionFlags, int wrapWidth )
{ {
UseUpId(); UseUpId();
if( mShuttleMode != eIsCreating ) if( mShuttleMode != eIsCreating )
return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxStaticText); return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxStaticText);
wxStaticText *pStatic; wxStaticText *pStatic;
mpWind = pStatic = safenew wxStaticText(GetParent(), miId, Str, wxDefaultPosition, wxDefaultSize, auto text = pStatic = safenew wxStaticText(GetParent(), miId, Str, wxDefaultPosition, wxDefaultSize,
GetStyle( wxALIGN_LEFT )); GetStyle( wxALIGN_LEFT ));
mpWind = text;
if ( wrapWidth > 0 )
text->Wrap( wrapWidth );
mpWind->SetName(wxStripMenuCodes(Str)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs) mpWind->SetName(wxStripMenuCodes(Str)); // fix for bug 577 (NVDA/Narrator screen readers do not read static text in dialogs)
if( bCenter ) if( bCenter )
{ {

View File

@ -268,11 +268,10 @@ public:
//-- Add functions. These only add a widget or 2. //-- Add functions. These only add a widget or 2.
void HandleOptionality(const wxString &Prompt); void HandleOptionality(const wxString &Prompt);
void AddPrompt(const wxString &Prompt); void AddPrompt(const wxString &Prompt, int wrapWidth = 0);
void AddUnits(const wxString &Prompt); void AddUnits(const wxString &Prompt, int wrapWidth = 0);
void AddTitle(const wxString &Prompt); void AddTitle(const wxString &Prompt, int wrapWidth = 0);
wxWindow * AddWindow(wxWindow * pWindow); wxWindow * AddWindow(wxWindow * pWindow);
wxSlider * AddSlider(const wxString &Prompt, int pos, int Max, int Min = 0); wxSlider * AddSlider(const wxString &Prompt, int pos, int Max, int Min = 0);
wxSlider * AddVSlider(const wxString &Prompt, int pos, int Max); wxSlider * AddVSlider(const wxString &Prompt, int pos, int Max);
wxSpinCtrl * AddSpinCtrl(const wxString &Prompt, int Value, int Max, int Min); wxSpinCtrl * AddSpinCtrl(const wxString &Prompt, int Value, int Max, int Min);
@ -300,7 +299,9 @@ public:
bool setDefault = false ); bool setDefault = false );
// When PositionFlags is 0, applies wxALL (which affects borders), // When PositionFlags is 0, applies wxALL (which affects borders),
// and either wxALIGN_CENTER (if bCenter) or else wxEXPAND // and either wxALIGN_CENTER (if bCenter) or else wxEXPAND
wxStaticText * AddVariableText(const wxString &Str, bool bCenter = false, int PositionFlags = 0); wxStaticText * AddVariableText(
const wxString &Str, bool bCenter = false,
int PositionFlags = 0, int wrapWidth = 0);
wxTextCtrl * AddTextBox(const wxString &Caption, const wxString &Value, const int nChars); wxTextCtrl * AddTextBox(const wxString &Caption, const wxString &Value, const int nChars);
wxTextCtrl * AddNumericTextBox(const wxString &Caption, const wxString &Value, const int nChars); wxTextCtrl * AddNumericTextBox(const wxString &Caption, const wxString &Value, const int nChars);
wxTextCtrl * AddTextWindow(const wxString &Value); wxTextCtrl * AddTextWindow(const wxString &Value);
@ -337,7 +338,7 @@ public:
wxMenu * AddMenu( const wxString & Title ); wxMenu * AddMenu( const wxString & Title );
void AddIcon( wxBitmap * pBmp); void AddIcon( wxBitmap * pBmp);
void AddIconButton( const wxString & Command, const wxString & Params,wxBitmap * pBmp ); void AddIconButton( const wxString & Command, const wxString & Params,wxBitmap * pBmp );
void AddFixedText( const wxString & Str, bool bCenter = false ); void AddFixedText( const wxString & Str, bool bCenter = false, int wrapWidth = 0 );
void AddConstTextBox( const wxString &Caption, const wxString & Value ); void AddConstTextBox( const wxString &Caption, const wxString & Value );
//-- Start and end functions. These are used for sizer, or other window containers //-- Start and end functions. These are used for sizer, or other window containers

View File

@ -816,7 +816,8 @@ void VSTEffectOptionsDialog::PopulateOrExchange(ShuttleGui & S)
_("on each iteration. Smaller values will cause slower processing and ") + _("on each iteration. Smaller values will cause slower processing and ") +
_("some effects require 8192 samples or less to work properly. However ") + _("some effects require 8192 samples or less to work properly. However ") +
_("most effects can accept large buffers and using them will greatly ") + _("most effects can accept large buffers and using them will greatly ") +
_("reduce processing time."))->Wrap(650); _("reduce processing time."),
false, 0, 650);
S.StartHorizontalLay(wxALIGN_LEFT); S.StartHorizontalLay(wxALIGN_LEFT);
{ {
@ -839,7 +840,8 @@ void VSTEffectOptionsDialog::PopulateOrExchange(ShuttleGui & S)
_("audio to Audacity. When not compensating for this delay, you will ") + _("audio to Audacity. When not compensating for this delay, you will ") +
_("notice that small silences have been inserted into the audio. ") + _("notice that small silences have been inserted into the audio. ") +
_("Enabling this option will provide that compensation, but it may ") + _("Enabling this option will provide that compensation, but it may ") +
_("not work for all VST effects."))->Wrap(650); _("not work for all VST effects."),
false, 0, 650);
S.StartHorizontalLay(wxALIGN_LEFT); S.StartHorizontalLay(wxALIGN_LEFT);
{ {
@ -855,7 +857,8 @@ void VSTEffectOptionsDialog::PopulateOrExchange(ShuttleGui & S)
S.AddVariableText(wxString() + S.AddVariableText(wxString() +
_("Most VST effects have a graphical interface for setting parameter values.") + _("Most VST effects have a graphical interface for setting parameter values.") +
_(" A basic text-only method is also available. ") + _(" A basic text-only method is also available. ") +
_(" Reopen the effect for this to take effect."))->Wrap(650); _(" Reopen the effect for this to take effect."),
false, 0, 650);
S.TieCheckBox(_("Enable &graphical interface"), S.TieCheckBox(_("Enable &graphical interface"),
mUseGUI); mUseGUI);
} }

View File

@ -386,7 +386,8 @@ void AudioUnitEffectOptionsDialog::PopulateOrExchange(ShuttleGui & S)
_("audio to Audacity. When not compensating for this delay, you will ") + _("audio to Audacity. When not compensating for this delay, you will ") +
_("notice that small silences have been inserted into the audio. ") + _("notice that small silences have been inserted into the audio. ") +
_("Enabling this option will provide that compensation, but it may ") + _("Enabling this option will provide that compensation, but it may ") +
_("not work for all Audio Unit effects."))->Wrap(650); _("not work for all Audio Unit effects."),
false, 0, 650 );
S.StartHorizontalLay(wxALIGN_LEFT); S.StartHorizontalLay(wxALIGN_LEFT);
{ {
@ -403,7 +404,8 @@ void AudioUnitEffectOptionsDialog::PopulateOrExchange(ShuttleGui & S)
_("Select \"Full\" to use the graphical interface if supplied by the Audio Unit.") + _("Select \"Full\" to use the graphical interface if supplied by the Audio Unit.") +
_(" Select \"Generic\" to use the system supplied generic interface.") + _(" Select \"Generic\" to use the system supplied generic interface.") +
_(" Select \"Basic\" for a basic text-only interface.") + _(" Select \"Basic\" for a basic text-only interface.") +
_(" Reopen the effect for this to take effect."))->Wrap(650); _(" Reopen the effect for this to take effect."),
false, 0, 650);
S.StartHorizontalLay(wxALIGN_LEFT); S.StartHorizontalLay(wxALIGN_LEFT);
{ {

View File

@ -456,7 +456,8 @@ void LadspaEffectOptionsDialog::PopulateOrExchange(ShuttleGui & S)
_("audio to Audacity. When not compensating for this delay, you will ") + _("audio to Audacity. When not compensating for this delay, you will ") +
_("notice that small silences have been inserted into the audio. ") + _("notice that small silences have been inserted into the audio. ") +
_("Enabling this option will provide that compensation, but it may ") + _("Enabling this option will provide that compensation, but it may ") +
_("not work for all LADSPA effects."))->Wrap(650); _("not work for all LADSPA effects."),
false, 0, 650);
S.StartHorizontalLay(wxALIGN_LEFT); S.StartHorizontalLay(wxALIGN_LEFT);
{ {

View File

@ -253,7 +253,8 @@ void LV2EffectSettingsDialog::PopulateOrExchange(ShuttleGui &S)
_("on each iteration. Smaller values will cause slower processing and ") + _("on each iteration. Smaller values will cause slower processing and ") +
_("some effects require 8192 samples or less to work properly. However ") + _("some effects require 8192 samples or less to work properly. However ") +
_("most effects can accept large buffers and using them will greatly ") + _("most effects can accept large buffers and using them will greatly ") +
_("reduce processing time."))->Wrap(650); _("reduce processing time."),
false, 0, 650);
S.StartHorizontalLay(wxALIGN_LEFT); S.StartHorizontalLay(wxALIGN_LEFT);
{ {
@ -275,7 +276,8 @@ void LV2EffectSettingsDialog::PopulateOrExchange(ShuttleGui &S)
_("audio to Audacity. When not compensating for this delay, you will ") + _("audio to Audacity. When not compensating for this delay, you will ") +
_("notice that small silences have been inserted into the audio. ") + _("notice that small silences have been inserted into the audio. ") +
_("Enabling this setting will provide that compensation, but it may ") + _("Enabling this setting will provide that compensation, but it may ") +
_("not work for all LV2 effects."))->Wrap(650); _("not work for all LV2 effects."),
false, 0, 650);
S.StartHorizontalLay(wxALIGN_LEFT); S.StartHorizontalLay(wxALIGN_LEFT);
{ {
@ -291,7 +293,8 @@ void LV2EffectSettingsDialog::PopulateOrExchange(ShuttleGui &S)
S.AddVariableText(wxString() + S.AddVariableText(wxString() +
_("LV2 effects can have a graphical interface for setting parameter values.") + _("LV2 effects can have a graphical interface for setting parameter values.") +
_(" A basic text-only method is also available. ") + _(" A basic text-only method is also available. ") +
_(" Reopen the effect for this to take effect."))->Wrap(650); _(" Reopen the effect for this to take effect."),
false, 0, 650);
S.TieCheckBox(_("Enable &graphical interface"), S.TieCheckBox(_("Enable &graphical interface"),
mUseGUI); mUseGUI);
} }

View File

@ -137,7 +137,8 @@ void DirectoriesPrefs::PopulateOrExchange(ShuttleGui & S)
} }
S.EndTwoColumn(); S.EndTwoColumn();
S.AddVariableText(_("If the available system memory falls below this value, audio will no longer\nbe cached in memory and will be written to disk."))->Wrap(600); S.AddVariableText(_("If the available system memory falls below this value, audio will no longer\nbe cached in memory and will be written to disk."),
false, 0, 600);
} }
S.EndStatic(); S.EndStatic();
#endif // DEPRECATED_AUDIO_CACHE #endif // DEPRECATED_AUDIO_CACHE