mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-04 17:49:45 +02:00
Use same format for choice in Selection Toolbar as in SpectralSelection Toolbar
I've deliberately not given the choice a title, and deliberately put the word 'selection' at the end, so as to be better/faster for Screen Reader users. The look of Selection Toolbar and Spectral Selection Toolbar is now consistent. In dark themes both could have better looking choice boxes.
This commit is contained in:
parent
29df7e1ce3
commit
1c6c608c13
@ -71,6 +71,7 @@ enum {
|
|||||||
SnapToID,
|
SnapToID,
|
||||||
OnMenuID,
|
OnMenuID,
|
||||||
|
|
||||||
|
ChoiceID,
|
||||||
|
|
||||||
StartTitleID,
|
StartTitleID,
|
||||||
LengthTitleID,
|
LengthTitleID,
|
||||||
@ -105,6 +106,7 @@ BEGIN_EVENT_TABLE(SelectionBar, ToolBar)
|
|||||||
EVT_TEXT(CenterTimeID, SelectionBar::OnChangedTime)
|
EVT_TEXT(CenterTimeID, SelectionBar::OnChangedTime)
|
||||||
EVT_TEXT(EndTimeID, SelectionBar::OnChangedTime)
|
EVT_TEXT(EndTimeID, SelectionBar::OnChangedTime)
|
||||||
EVT_CHOICE(SnapToID, SelectionBar::OnSnapTo)
|
EVT_CHOICE(SnapToID, SelectionBar::OnSnapTo)
|
||||||
|
EVT_CHOICE(ChoiceID, SelectionBar::OnChoice )
|
||||||
EVT_COMBOBOX(RateID, SelectionBar::OnRate)
|
EVT_COMBOBOX(RateID, SelectionBar::OnRate)
|
||||||
EVT_TEXT(RateID, SelectionBar::OnRate)
|
EVT_TEXT(RateID, SelectionBar::OnRate)
|
||||||
EVT_RADIOBUTTON(StartEndRadioID, SelectionBar::OnFieldChoice )
|
EVT_RADIOBUTTON(StartEndRadioID, SelectionBar::OnFieldChoice )
|
||||||
@ -130,6 +132,9 @@ SelectionBar::SelectionBar()
|
|||||||
#ifdef SEL_RADIO_TITLES
|
#ifdef SEL_RADIO_TITLES
|
||||||
mStartTitle(NULL), mCenterTitle(NULL), mLengthTitle(NULL), mEndTitle(NULL),
|
mStartTitle(NULL), mCenterTitle(NULL), mLengthTitle(NULL), mEndTitle(NULL),
|
||||||
mStartEndProxy(NULL), mStartLengthProxy(NULL), mLengthEndProxy(NULL), mLengthCenterProxy(NULL),
|
mStartEndProxy(NULL), mStartLengthProxy(NULL), mLengthEndProxy(NULL), mLengthCenterProxy(NULL),
|
||||||
|
#endif
|
||||||
|
#ifdef SEL_CHOICE
|
||||||
|
mChoice(NULL),
|
||||||
#endif
|
#endif
|
||||||
mDrive1( StartTimeID), mDrive2( EndTimeID ),
|
mDrive1( StartTimeID), mDrive2( EndTimeID ),
|
||||||
mSelectionMode(0)
|
mSelectionMode(0)
|
||||||
@ -249,7 +254,7 @@ void SelectionBar::Populate()
|
|||||||
* look-ups static because they depend on translations which are done at
|
* look-ups static because they depend on translations which are done at
|
||||||
* runtime */
|
* runtime */
|
||||||
|
|
||||||
Add((mainSizer = safenew wxFlexGridSizer(8, 1, 1)), 0, wxALIGN_CENTER_VERTICAL);
|
Add((mainSizer = safenew wxFlexGridSizer(SIZER_COLS, 1, 1)), 0, wxALIGN_CENTER_VERTICAL);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Top row (mostly labels)
|
// Top row (mostly labels)
|
||||||
@ -270,8 +275,12 @@ void SelectionBar::Populate()
|
|||||||
mainSizer->Add(5, 1);
|
mainSizer->Add(5, 1);
|
||||||
|
|
||||||
AddTitle( _("Snap-To"), -1, mainSizer );
|
AddTitle( _("Snap-To"), -1, mainSizer );
|
||||||
|
|
||||||
|
#ifdef OPTIONS_BUTTON
|
||||||
// Not enough room to say 'Selection Options". There is a tooltip instead.
|
// Not enough room to say 'Selection Options". There is a tooltip instead.
|
||||||
AddTitle( wxT(""), -1, mainSizer );
|
AddTitle( wxT(""), -1, mainSizer );
|
||||||
|
#endif
|
||||||
|
|
||||||
// This is for the vertical line.
|
// This is for the vertical line.
|
||||||
AddTitle( wxT(""), -1, mainSizer );
|
AddTitle( wxT(""), -1, mainSizer );
|
||||||
|
|
||||||
@ -305,6 +314,21 @@ void SelectionBar::Populate()
|
|||||||
vSizer->Add( hSizer.release(), 0, wxALIGN_CENTER, 0);
|
vSizer->Add( hSizer.release(), 0, wxALIGN_CENTER, 0);
|
||||||
mainSizer->Add(vSizer.release(), 0, wxALIGN_CENTER, 0 );
|
mainSizer->Add(vSizer.release(), 0, wxALIGN_CENTER, 0 );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifdef SEL_CHOICE
|
||||||
|
const wxString choices[4] = {
|
||||||
|
_("Start and End of Selection"),
|
||||||
|
_("Start and Length of Selection"),
|
||||||
|
_("Length and End of Selection"),
|
||||||
|
_("Length and Center of Selection"),
|
||||||
|
};
|
||||||
|
mChoice = safenew wxChoice
|
||||||
|
(this, ChoiceID, wxDefaultPosition, wxDefaultSize, 4, choices,
|
||||||
|
0, wxDefaultValidator, "");
|
||||||
|
mChoice->SetSelection(0);
|
||||||
|
mainSizer->Add(mChoice, 0, wxALIGN_CENTER_VERTICAL | wxEXPAND, 5);
|
||||||
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#ifdef SEL_PLAIN_TITLES
|
#ifdef SEL_PLAIN_TITLES
|
||||||
@ -391,7 +415,7 @@ void SelectionBar::Populate()
|
|||||||
NULL,
|
NULL,
|
||||||
this);
|
this);
|
||||||
|
|
||||||
#if 1
|
#ifdef OPTION_BUTTON
|
||||||
// Old code which placed a button from which to select options.
|
// Old code which placed a button from which to select options.
|
||||||
// Retained in case we want a button for selection-toolbar options at a future date.
|
// Retained in case we want a button for selection-toolbar options at a future date.
|
||||||
AButton *& pBtn = mButtons[ SelTBMenuID - SelTBFirstButton];
|
AButton *& pBtn = mButtons[ SelTBMenuID - SelTBFirstButton];
|
||||||
@ -444,6 +468,10 @@ void SelectionBar::Populate()
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#ifdef SEL_CHOICE
|
||||||
|
mChoice->MoveBeforeInTabOrder( mStartTime );
|
||||||
|
#endif
|
||||||
|
|
||||||
mainSizer->Add(safenew wxStaticLine(this, -1, wxDefaultPosition,
|
mainSizer->Add(safenew wxStaticLine(this, -1, wxDefaultPosition,
|
||||||
wxSize(1, toolbarSingle),
|
wxSize(1, toolbarSingle),
|
||||||
wxLI_VERTICAL),
|
wxLI_VERTICAL),
|
||||||
@ -744,6 +772,13 @@ void SelectionBar::OnFieldChoice(wxCommandEvent &event)
|
|||||||
SelectionModeUpdated();
|
SelectionModeUpdated();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SelectionBar::OnChoice(wxCommandEvent & WXUNUSED(event))
|
||||||
|
{
|
||||||
|
int mode = mChoice->GetSelection();
|
||||||
|
SetSelectionMode( mode );
|
||||||
|
SelectionModeUpdated();
|
||||||
|
}
|
||||||
|
|
||||||
void SelectionBar::SelectionModeUpdated()
|
void SelectionBar::SelectionModeUpdated()
|
||||||
{
|
{
|
||||||
// We just changed the mode. Remember it.
|
// We just changed the mode. Remember it.
|
||||||
@ -761,7 +796,7 @@ void SelectionBar::SelectionModeUpdated()
|
|||||||
|
|
||||||
void SelectionBar::SetSelectionMode(int mode)
|
void SelectionBar::SetSelectionMode(int mode)
|
||||||
{
|
{
|
||||||
#ifdef SEL_BUTTON_TITLES
|
#if defined(SEL_BUTTON_TITLES) || defined( SEL_CHOICE)
|
||||||
// With SEL_BUTTON_TITLES only modes 0 to 3 are supported,
|
// With SEL_BUTTON_TITLES only modes 0 to 3 are supported,
|
||||||
// so fix up a mode that could have come from the config.
|
// so fix up a mode that could have come from the config.
|
||||||
const int maxMode = 3;
|
const int maxMode = 3;
|
||||||
@ -811,6 +846,9 @@ void SelectionBar::SetSelectionMode(int mode)
|
|||||||
wxString CenterNames[] = { " Start - End ", " Start - Length ", " Length - End ", " Length - Center " };
|
wxString CenterNames[] = { " Start - End ", " Start - Length ", " Length - End ", " Length - Center " };
|
||||||
mButtonTitles[1]->SetLabel( CenterNames[mode] );
|
mButtonTitles[1]->SetLabel( CenterNames[mode] );
|
||||||
#endif
|
#endif
|
||||||
|
#ifdef SEL_CHOICE
|
||||||
|
mChoice->SetSelection( mode );
|
||||||
|
#endif
|
||||||
|
|
||||||
// First decide which two controls drive the others...
|
// First decide which two controls drive the others...
|
||||||
// For example the last option is with all controls shown, and in that mode we
|
// For example the last option is with all controls shown, and in that mode we
|
||||||
|
@ -18,8 +18,27 @@
|
|||||||
// PLAIN_TITLES give Start Length Center End above each field.
|
// PLAIN_TITLES give Start Length Center End above each field.
|
||||||
// RADIO_TITLES give ()SE (*)Start-Length ()LE ()LC style.
|
// RADIO_TITLES give ()SE (*)Start-Length ()LE ()LC style.
|
||||||
// BUTTON_TITLES give < Start - Length > style.
|
// BUTTON_TITLES give < Start - Length > style.
|
||||||
|
// CHOICE gives a choice control
|
||||||
//#define SEL_RADIO_TITLES
|
//#define SEL_RADIO_TITLES
|
||||||
#define SEL_BUTTON_TITLES
|
//#define SEL_BUTTON_TITLES
|
||||||
|
#define SEL_CHOICE
|
||||||
|
|
||||||
|
// OPTIONS_BUTTON gives a button with three dots to select the option.
|
||||||
|
|
||||||
|
// Column for
|
||||||
|
// Project rate
|
||||||
|
// Snap To
|
||||||
|
// Option Button
|
||||||
|
// Vertical Line
|
||||||
|
// Selection fields
|
||||||
|
// Vertical Line
|
||||||
|
// Cursor position
|
||||||
|
|
||||||
|
#ifdef OPTIONS_BUTTON
|
||||||
|
#define SIZER_COLS 8
|
||||||
|
#else
|
||||||
|
#define SIZER_COLS 7
|
||||||
|
#endif
|
||||||
|
|
||||||
class wxBitmap;
|
class wxBitmap;
|
||||||
class wxCheckBox;
|
class wxCheckBox;
|
||||||
@ -86,6 +105,7 @@ class SelectionBar final : public ToolBar {
|
|||||||
|
|
||||||
void OnRate(wxCommandEvent & event);
|
void OnRate(wxCommandEvent & event);
|
||||||
void OnSnapTo(wxCommandEvent & event);
|
void OnSnapTo(wxCommandEvent & event);
|
||||||
|
void OnChoice(wxCommandEvent & event);
|
||||||
void OnFocus(wxFocusEvent &event);
|
void OnFocus(wxFocusEvent &event);
|
||||||
void OnCaptureKey(wxCommandEvent &event);
|
void OnCaptureKey(wxCommandEvent &event);
|
||||||
void OnSize(wxSizeEvent &evt);
|
void OnSize(wxSizeEvent &evt);
|
||||||
@ -116,6 +136,10 @@ class SelectionBar final : public ToolBar {
|
|||||||
NumericTextCtrl *mEndTime;
|
NumericTextCtrl *mEndTime;
|
||||||
NumericTextCtrl *mAudioTime;
|
NumericTextCtrl *mAudioTime;
|
||||||
|
|
||||||
|
#ifdef SEL_CHOICE
|
||||||
|
wxChoice * mChoice;
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef PLAIN_TITLES
|
#ifdef PLAIN_TITLES
|
||||||
wxStaticText * mStartTitle;
|
wxStaticText * mStartTitle;
|
||||||
wxStaticText * mCenterTitle;
|
wxStaticText * mCenterTitle;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user