mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-01 07:33:44 +02: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:
parent
2cc39d791f
commit
6bcbe417e9
@ -282,6 +282,7 @@ void Theme::RegisterColours()
|
||||
ThemeBase::ThemeBase(void)
|
||||
{
|
||||
bRecolourOnLoad = false;
|
||||
bRecolouringIsActive = false;
|
||||
}
|
||||
|
||||
ThemeBase::~ThemeBase(void)
|
||||
@ -321,6 +322,7 @@ void ThemeBase::LoadTheme( teThemeType Theme )
|
||||
CreateImageCache();
|
||||
#endif
|
||||
}
|
||||
bRecolouringIsActive = false;
|
||||
if( bRecolourOnLoad )
|
||||
RecolourTheme();
|
||||
bRecolourOnLoad = false;
|
||||
@ -356,9 +358,10 @@ void ThemeBase::RecolourTheme()
|
||||
+ abs( From.Green() - To.Green() )
|
||||
+ abs( From.Blue() - To.Blue() );
|
||||
|
||||
// Don't recolour if difference is too big, or no difference.
|
||||
// Don't recolour if difference is too big.
|
||||
if( d > 120 )
|
||||
return;
|
||||
bRecolouringIsActive = true;
|
||||
|
||||
// A minor tint difference from standard does not need
|
||||
// to be recouloured either. Includes case of d==0 which is nothing
|
||||
|
@ -117,6 +117,7 @@ public:
|
||||
void WriteImageDefs( );
|
||||
void WriteImageMap( );
|
||||
static bool LoadPreferredTheme();
|
||||
bool RecolouringIsActive(){ return bRecolouringIsActive;};
|
||||
void RecolourBitmap( int iIndex, wxColour From, wxColour To );
|
||||
void RecolourTheme();
|
||||
|
||||
@ -127,7 +128,8 @@ public:
|
||||
wxCursor & Cursor( int iIndex );
|
||||
wxFont & Font( int iIndex );
|
||||
wxSize ImageSize( int iIndex );
|
||||
bool bRecolourOnLoad;
|
||||
bool bRecolourOnLoad; // Request to recolour.
|
||||
bool bRecolouringIsActive; // We're actually doing it.
|
||||
|
||||
void ReplaceImage( int iIndex, wxImage * pImage );
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user