1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-02-16 07:47:58 +01:00

Make SelectionBar end/length radio buttons behave normally

They had lost the focus/voice-over functionality because I added code to draw them in the
theme colour.  Now I disable that code, IF recolouring is both set and active.  This will happen
for example, if Hi-Contrast is used with the Hi-Contrast system theme.
This commit is contained in:
James Crook
2017-04-26 15:35:57 +01:00
parent 2cc39d791f
commit 6bcbe417e9
3 changed files with 29 additions and 13 deletions

View File

@@ -164,13 +164,18 @@ void SelectionBar::Populate()
gPrefs->Read(wxT("/ShowSelectionLength"), &showSelectionLength);
{
bool bCustomRadioLabels = !theTheme.RecolouringIsActive();
// Can't set textcolour of radio buttons.
// so instead we make the text empty and add in two wxStaticTexts
// and we can set the colour of those.
// Slight regression relative ot Audacity in that this text is not
// Slight regression relative ot Audacity, in that this text is not
// clickable/active. You have to click on the actual button.
// And can't tab between and hear the labels with voice over.
// So VI users should use blend themes (which is the default).
// Should not be a hardship for them, as themes make little difference
// for them, except Hi-Contrast, which should be used with recolouring.
auto hSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
mRightEndButton = safenew wxRadioButton(this, OnEndRadioID, wxT(""),
mRightEndButton = safenew wxRadioButton(this, OnEndRadioID, bCustomRadioLabels ? wxT("") : _("End"),
wxDefaultPosition, wxDefaultSize,
wxRB_GROUP);
mRightEndButton->SetName(_("End"));
@@ -178,21 +183,27 @@ void SelectionBar::Populate()
mRightEndButton->SetValue(!showSelectionLength);
hSizer->Add(mRightEndButton,
0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
wxStaticText * pEndText = safenew wxStaticText(this, -1, _("End"));
pEndText->SetForegroundColour( clrText );
hSizer->Add(pEndText,
0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
if( bCustomRadioLabels )
{
wxStaticText * pEndText = safenew wxStaticText(this, -1, _("End"));
pEndText->SetForegroundColour( clrText );
hSizer->Add(pEndText,
0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
}
mRightLengthButton = safenew wxRadioButton(this, OnLengthRadioID, wxT(""));
mRightLengthButton = safenew wxRadioButton(this, OnLengthRadioID, bCustomRadioLabels ? wxT(""): _("Length"));
mRightLengthButton->SetName(_("Length"));
mRightLengthButton->SetForegroundColour( clrText );
mRightLengthButton->SetValue(showSelectionLength);
hSizer->Add(mRightLengthButton,
0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
wxStaticText * pLengthText = safenew wxStaticText(this, -1, _("Length"));
pLengthText->SetForegroundColour( clrText );
hSizer->Add(pLengthText,
0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
if( bCustomRadioLabels )
{
wxStaticText * pLengthText = safenew wxStaticText(this, -1, _("Length"));
pLengthText->SetForegroundColour( clrText );
hSizer->Add(pLengthText,
0, wxRIGHT | wxALIGN_CENTER_VERTICAL, 5);
}
#if defined(__WXMSW__)
// Refer to Microsoft KB article 261192 for an explanation as