mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-02 08:39:46 +02:00
Bug2105: Enable TAB to sliders on Mac...
... I think this is a defect in wxWidgets, but one we can work around with a simple wrapper class around wxSlider overriding one method. To make the fix complete, change all occurrences of "safenew wxSlider" but the one in ShuttleGui.cpp covers most cases
This commit is contained in:
parent
3f6b5be500
commit
c8d95e1117
@ -338,7 +338,7 @@ FreqWindow::FreqWindow(wxWindow * parent, wxWindowID id,
|
||||
|
||||
S.AddSpace(5);
|
||||
|
||||
mZoomSlider = safenew wxSlider(this, FreqZoomSliderID, 100, 1, 100,
|
||||
mZoomSlider = safenew wxSliderWrapper(this, FreqZoomSliderID, 100, 1, 100,
|
||||
wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL);
|
||||
S.Prop(1);
|
||||
S.AddWindow(mZoomSlider, wxALIGN_CENTER_HORIZONTAL);
|
||||
|
@ -515,6 +515,15 @@ wxRadioButton * ShuttleGuiBase::AddRadioButtonToGroup(const wxString &Prompt)
|
||||
return pRad;
|
||||
}
|
||||
|
||||
#ifdef __WXMAC__
|
||||
void wxSliderWrapper::SetFocus()
|
||||
{
|
||||
// bypassing the override in wxCompositeWindow<wxSliderBase> which ends up
|
||||
// doing nothing
|
||||
return wxSliderBase::SetFocus();
|
||||
}
|
||||
#endif
|
||||
|
||||
wxSlider * ShuttleGuiBase::AddSlider(const wxString &Prompt, int pos, int Max, int Min)
|
||||
{
|
||||
HandleOptionality( Prompt );
|
||||
@ -523,7 +532,7 @@ wxSlider * ShuttleGuiBase::AddSlider(const wxString &Prompt, int pos, int Max, i
|
||||
if( mShuttleMode != eIsCreating )
|
||||
return wxDynamicCast(wxWindow::FindWindowById( miId, mpDlg), wxSlider);
|
||||
wxSlider * pSlider;
|
||||
mpWind = pSlider = safenew wxSlider(GetParent(), miId,
|
||||
mpWind = pSlider = safenew wxSliderWrapper(GetParent(), miId,
|
||||
pos, Min, Max,
|
||||
wxDefaultPosition, wxDefaultSize,
|
||||
Style( wxSL_HORIZONTAL | wxSL_LABELS | wxSL_AUTOTICKS )
|
||||
|
@ -17,6 +17,7 @@
|
||||
#include "Audacity.h"
|
||||
|
||||
#include <vector>
|
||||
#include <wx/slider.h> // to inherit
|
||||
#include "MemoryX.h"
|
||||
|
||||
#include "WrappedType.h"
|
||||
@ -76,6 +77,19 @@ class Shuttle;
|
||||
|
||||
class WrappedType;
|
||||
|
||||
#ifdef __WXMAC__
|
||||
/// Fix a defect in TAB key navigation to sliders, known to happen in wxWidgets
|
||||
/// 3.1.1 and maybe in earlier versions
|
||||
class wxSliderWrapper : public wxSlider
|
||||
{
|
||||
public:
|
||||
using wxSlider::wxSlider;
|
||||
void SetFocus() override;
|
||||
};
|
||||
#else
|
||||
using wxSliderWrapper = wxSlider;
|
||||
#endif
|
||||
|
||||
class AUDACITY_DLL_API ShuttleGuiBase /* not final */
|
||||
{
|
||||
public:
|
||||
|
@ -737,7 +737,7 @@ void EffectEqualization::PopulateOrExchange(ShuttleGui & S)
|
||||
|
||||
for (int i = 0; (i < NUMBER_OF_BANDS) && (kThirdOct[i] <= mHiFreq); ++i)
|
||||
{
|
||||
mSliders[i] = safenew wxSlider(mGraphicPanel, ID_Slider + i, 0, -20, +20,
|
||||
mSliders[i] = safenew wxSliderWrapper(mGraphicPanel, ID_Slider + i, 0, -20, +20,
|
||||
wxDefaultPosition, wxDefaultSize, wxSL_VERTICAL | wxSL_INVERSE);
|
||||
|
||||
mSliders[i]->Bind(wxEVT_ERASE_BACKGROUND,
|
||||
|
@ -83,7 +83,7 @@ ScoreAlignDialog::ScoreAlignDialog(ScoreAlignParams ¶ms)
|
||||
|
||||
//wxButton *ok = safenew wxButton(this, wxID_OK, _("OK"));
|
||||
//wxButton *cancel = safenew wxButton(this, wxID_CANCEL, _("Cancel"));
|
||||
//wxSlider *sl = safenew wxSlider(this, ID_SLIDER, 0, 0, 100,
|
||||
//wxSlider *sl = safenew wxSliderWrapper(this, ID_SLIDER, 0, 0, 100,
|
||||
// wxDefaultPosition, wxSize(20, 124),
|
||||
// wxSL_HORIZONTAL);
|
||||
|
||||
|
@ -2909,7 +2909,7 @@ void VSTEffect::BuildPlain()
|
||||
wxALIGN_RIGHT | wxST_NO_AUTORESIZE);
|
||||
gridSizer->Add(mNames[i], 0, wxALIGN_CENTER_VERTICAL | wxALIGN_RIGHT | wxALL, 5);
|
||||
|
||||
mSliders[i] = safenew wxSlider(scroller,
|
||||
mSliders[i] = safenew wxSliderWrapper(scroller,
|
||||
ID_Sliders + i,
|
||||
0,
|
||||
0,
|
||||
|
@ -1313,7 +1313,7 @@ bool LadspaEffect::PopulateUI(wxWindow *parent)
|
||||
gridSizer->Add(1, 1, 0);
|
||||
}
|
||||
|
||||
mSliders[p] = safenew wxSlider(w, ID_Sliders + p,
|
||||
mSliders[p] = safenew wxSliderWrapper(w, ID_Sliders + p,
|
||||
0, 0, 1000,
|
||||
wxDefaultPosition,
|
||||
wxSize(200, -1));
|
||||
|
@ -1714,7 +1714,7 @@ bool LV2Effect::BuildPlain()
|
||||
gridSizer->Add(1, 1, 0);
|
||||
}
|
||||
|
||||
mSliders[p] = safenew wxSlider(w, ID_Sliders + p,
|
||||
mSliders[p] = safenew wxSliderWrapper(w, ID_Sliders + p,
|
||||
0, 0, 1000,
|
||||
wxDefaultPosition,
|
||||
wxSize(150, -1));
|
||||
|
@ -1356,7 +1356,7 @@ ExportMixerDialog::ExportMixerDialog( const TrackList *tracks, bool selectedOnly
|
||||
mChannelsText = safenew wxStaticText(this, -1, label);
|
||||
horSizer->Add(mChannelsText, 0, wxALIGN_LEFT | wxALL, 5);
|
||||
|
||||
wxSlider *channels = safenew wxSlider(this, ID_SLIDER_CHANNEL,
|
||||
wxSlider *channels = safenew wxSliderWrapper(this, ID_SLIDER_CHANNEL,
|
||||
mMixerSpec->GetNumChannels(), 1, mMixerSpec->GetMaxNumChannels(),
|
||||
wxDefaultPosition, wxSize(300, -1));
|
||||
channels->SetName(label);
|
||||
|
Loading…
x
Reference in New Issue
Block a user