mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-25 16:48:44 +02:00
Rearrange Selection Toolbar fields, and fix spacings.
The layout of SelectionToolbar and SpectralSelction Tollbar now match, and they can be placed nicely side by side. The borders around controls have been tweaked. Extra vertical spacer lines have been added into the title row.
This commit is contained in:
parent
c43a6408d9
commit
f418de2f60
@ -224,10 +224,17 @@ NumericTextCtrl * SelectionBar::AddTime( const wxString Name, int id, wxSizer *
|
|||||||
pCtrl->SetName(Name);
|
pCtrl->SetName(Name);
|
||||||
pCtrl->SetForegroundColour( theTheme.Colour( clrTrackPanelText ) );
|
pCtrl->SetForegroundColour( theTheme.Colour( clrTrackPanelText ) );
|
||||||
pCtrl->EnableMenu();
|
pCtrl->EnableMenu();
|
||||||
pSizer->Add(pCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
pSizer->Add(pCtrl, 0, wxALIGN_TOP | wxRIGHT, 5);
|
||||||
return pCtrl;
|
return pCtrl;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SelectionBar::AddVLine( wxSizer * pSizer ){
|
||||||
|
pSizer->Add(safenew wxStaticLine(this, -1, wxDefaultPosition,
|
||||||
|
wxSize(1, toolbarSingle-10),
|
||||||
|
wxLI_VERTICAL),
|
||||||
|
0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
||||||
|
}
|
||||||
|
|
||||||
void SelectionBar::Populate()
|
void SelectionBar::Populate()
|
||||||
{
|
{
|
||||||
SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
SetBackgroundColour( theTheme.Colour( clrMedium ) );
|
||||||
@ -254,7 +261,11 @@ 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(SIZER_COLS, 1, 1)), 0, wxALIGN_CENTER_VERTICAL);
|
// Outer sizer has space top and left.
|
||||||
|
// Inner sizers have space on right only.
|
||||||
|
// This choice makes for a nice border and internal spacing and places clear responsibility
|
||||||
|
// on each sizer as to what spacings it creates.
|
||||||
|
Add((mainSizer = safenew wxFlexGridSizer(SIZER_COLS, 1, 1)), 0, wxALIGN_TOP | wxLEFT | wxTOP, 5);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Top row (mostly labels)
|
// Top row (mostly labels)
|
||||||
@ -272,17 +283,17 @@ void SelectionBar::Populate()
|
|||||||
#endif
|
#endif
|
||||||
pProjRate->SetForegroundColour( clrText );
|
pProjRate->SetForegroundColour( clrText );
|
||||||
mainSizer->Add(pProjRate,0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
mainSizer->Add(pProjRate,0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
||||||
mainSizer->Add(5, 1);
|
AddVLine( mainSizer );
|
||||||
|
|
||||||
AddTitle( _("Snap-To"), -1, mainSizer );
|
AddTitle( _("Snap-To"), -1, mainSizer );
|
||||||
|
|
||||||
#ifdef OPTIONS_BUTTON
|
#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
|
#endif
|
||||||
|
AddVLine( mainSizer );
|
||||||
|
|
||||||
// This is for the vertical line.
|
AddTitle( _("Audio Position"), -1, mainSizer );
|
||||||
AddTitle( wxT(""), -1, mainSizer );
|
AddVLine( mainSizer );
|
||||||
|
|
||||||
{
|
{
|
||||||
#ifdef SEL_RADIO_TITLE
|
#ifdef SEL_RADIO_TITLE
|
||||||
@ -299,7 +310,7 @@ void SelectionBar::Populate()
|
|||||||
(mLengthCenterRadBtn = AddRadioButton( _("Length-Center"), LengthCenterRadioID, hSizer.get(), 0))
|
(mLengthCenterRadBtn = AddRadioButton( _("Length-Center"), LengthCenterRadioID, hSizer.get(), 0))
|
||||||
->SetValue( mSelectionMode == 3 );
|
->SetValue( mSelectionMode == 3 );
|
||||||
mLengthCenterProxy = mProxy;
|
mLengthCenterProxy = mProxy;
|
||||||
mainSizer->Add(hSizer.release(), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
|
mainSizer->Add(hSizer.release(), 0, wxALIGN_TOP| wxRIGHT, 0);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SEL_BUTTON_TITLES
|
#ifdef SEL_BUTTON_TITLES
|
||||||
@ -326,7 +337,7 @@ void SelectionBar::Populate()
|
|||||||
(this, ChoiceID, wxDefaultPosition, wxDefaultSize, 4, choices,
|
(this, ChoiceID, wxDefaultPosition, wxDefaultSize, 4, choices,
|
||||||
0, wxDefaultValidator, "");
|
0, wxDefaultValidator, "");
|
||||||
mChoice->SetSelection(0);
|
mChoice->SetSelection(0);
|
||||||
mainSizer->Add(mChoice, 0, wxALIGN_CENTER_VERTICAL | wxEXPAND, 5);
|
mainSizer->Add(mChoice, 0, wxALIGN_TOP | wxEXPAND | wxRIGHT, 6);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -343,12 +354,8 @@ void SelectionBar::Populate()
|
|||||||
mEndTitle->Bind( wxEVT_LEFT_DOWN,&SelectionBar::OnEndTitleClicked,this );
|
mEndTitle->Bind( wxEVT_LEFT_DOWN,&SelectionBar::OnEndTitleClicked,this );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
mainSizer->Add(5, 1);
|
|
||||||
AddTitle( _("Audio Position"), -1, mainSizer );
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Middle row (mostly time controls)
|
// Botton row, (mostly time controls)
|
||||||
//
|
//
|
||||||
|
|
||||||
mRateBox = safenew wxComboBox(this, RateID,
|
mRateBox = safenew wxComboBox(this, RateID,
|
||||||
@ -390,18 +397,14 @@ void SelectionBar::Populate()
|
|||||||
NULL,
|
NULL,
|
||||||
this);
|
this);
|
||||||
|
|
||||||
mainSizer->Add(mRateBox, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
mainSizer->Add(mRateBox, 0, wxALIGN_TOP | wxRIGHT, 5);
|
||||||
|
AddVLine( mainSizer );
|
||||||
mainSizer->Add(safenew wxStaticLine(this, -1, wxDefaultPosition,
|
|
||||||
wxSize(1, toolbarSingle),
|
|
||||||
wxLI_VERTICAL),
|
|
||||||
0, wxRIGHT, 5);
|
|
||||||
|
|
||||||
mSnapTo = safenew wxChoice(this, SnapToID,
|
mSnapTo = safenew wxChoice(this, SnapToID,
|
||||||
wxDefaultPosition, wxDefaultSize,
|
wxDefaultPosition, wxDefaultSize,
|
||||||
SnapManager::GetSnapLabels());
|
SnapManager::GetSnapLabels());
|
||||||
mainSizer->Add(mSnapTo,
|
mainSizer->Add(mSnapTo,
|
||||||
0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
0, wxALIGN_TOP | wxRIGHT, 5);
|
||||||
mSnapTo->SetName(_("Snap To"));
|
mSnapTo->SetName(_("Snap To"));
|
||||||
//mSnapTo->SetForegroundColour( clrText2 );
|
//mSnapTo->SetForegroundColour( clrText2 );
|
||||||
mSnapTo->SetSelection(mListener ? mListener->AS_GetSnapTo() : SNAP_OFF);
|
mSnapTo->SetSelection(mListener ? mListener->AS_GetSnapTo() : SNAP_OFF);
|
||||||
@ -430,10 +433,11 @@ void SelectionBar::Populate()
|
|||||||
pBtn->SetLabel(_("Selection options"));
|
pBtn->SetLabel(_("Selection options"));
|
||||||
pBtn->SetToolTip(_("Selection options"));
|
pBtn->SetToolTip(_("Selection options"));
|
||||||
//pBtn->Disable();
|
//pBtn->Disable();
|
||||||
mainSizer->Add( pBtn, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
mainSizer->Add( pBtn, 0, wxALIGN_TOP | wxRIGHT, 5);
|
||||||
#endif
|
#endif
|
||||||
|
AddVLine( mainSizer );
|
||||||
|
|
||||||
|
mAudioTime = AddTime(_("Audio Position"), AudioTimeID, mainSizer );
|
||||||
// This vertical line is NOT just for decoration!
|
// This vertical line is NOT just for decoration!
|
||||||
// It works around a wxWidgets-on-Windows RadioButton bug, where tabbing
|
// It works around a wxWidgets-on-Windows RadioButton bug, where tabbing
|
||||||
// into the radiobutton group jumps to selecting the first item in the
|
// into the radiobutton group jumps to selecting the first item in the
|
||||||
@ -442,10 +446,7 @@ void SelectionBar::Populate()
|
|||||||
// a lot in navigation.
|
// a lot in navigation.
|
||||||
// More about the bug here:
|
// More about the bug here:
|
||||||
// https://forums.wxwidgets.org/viewtopic.php?t=41120
|
// https://forums.wxwidgets.org/viewtopic.php?t=41120
|
||||||
mainSizer->Add(safenew wxStaticLine(this, id2, wxDefaultPosition,
|
AddVLine( mainSizer );
|
||||||
wxSize(1, toolbarSingle),
|
|
||||||
wxLI_VERTICAL),
|
|
||||||
0, wxRIGHT, 5);
|
|
||||||
|
|
||||||
{
|
{
|
||||||
auto hSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
auto hSizer = std::make_unique<wxBoxSizer>(wxHORIZONTAL);
|
||||||
@ -463,7 +464,7 @@ void SelectionBar::Populate()
|
|||||||
mHyphen[2] = AddTitle( "-", -1, hSizer.get() );
|
mHyphen[2] = AddTitle( "-", -1, hSizer.get() );
|
||||||
#endif
|
#endif
|
||||||
mEndTime = AddTime(_("End"), EndTimeID, hSizer.get() );
|
mEndTime = AddTime(_("End"), EndTimeID, hSizer.get() );
|
||||||
mainSizer->Add(hSizer.release(), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
|
mainSizer->Add(hSizer.release(), 0, wxALIGN_TOP | wxRIGHT, 0);
|
||||||
|
|
||||||
#ifdef SEL_RADIO_TITLES
|
#ifdef SEL_RADIO_TITLES
|
||||||
// Put choice of what fields to show immediately before the fields.
|
// Put choice of what fields to show immediately before the fields.
|
||||||
@ -477,22 +478,11 @@ void SelectionBar::Populate()
|
|||||||
#ifdef SEL_CHOICE
|
#ifdef SEL_CHOICE
|
||||||
mChoice->MoveBeforeInTabOrder( mStartTime );
|
mChoice->MoveBeforeInTabOrder( mStartTime );
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
mainSizer->Add(safenew wxStaticLine(this, -1, wxDefaultPosition,
|
|
||||||
wxSize(1, toolbarSingle),
|
|
||||||
wxLI_VERTICAL),
|
|
||||||
0, wxRIGHT, 5);
|
|
||||||
|
|
||||||
mAudioTime = AddTime(_("Audio Position"), AudioTimeID, mainSizer );
|
|
||||||
|
|
||||||
// This shows/hides controls.
|
// This shows/hides controls.
|
||||||
// Do this before layout so that we are sized right.
|
// Do this before layout so that we are sized right.
|
||||||
SetSelectionMode(mSelectionMode);
|
SetSelectionMode(mSelectionMode);
|
||||||
|
|
||||||
mainSizer->Layout();
|
mainSizer->Layout();
|
||||||
|
|
||||||
RegenerateTooltips();
|
RegenerateTooltips();
|
||||||
|
|
||||||
Layout();
|
Layout();
|
||||||
|
|
||||||
SetMinSize( GetSizer()->GetMinSize() );
|
SetMinSize( GetSizer()->GetMinSize() );
|
||||||
|
@ -86,6 +86,7 @@ class SelectionBar final : public ToolBar {
|
|||||||
wxStaticText * AddTitle( const wxString & Title, int id,
|
wxStaticText * AddTitle( const wxString & Title, int id,
|
||||||
wxSizer * pSizer );
|
wxSizer * pSizer );
|
||||||
NumericTextCtrl * AddTime( const wxString Name, int id, wxSizer * pSizer );
|
NumericTextCtrl * AddTime( const wxString Name, int id, wxSizer * pSizer );
|
||||||
|
void AddVLine( wxSizer * pSizer );
|
||||||
|
|
||||||
void SetSelectionMode(int mode);
|
void SetSelectionMode(int mode);
|
||||||
void ShowHideControls(int mode);
|
void ShowHideControls(int mode);
|
||||||
|
@ -133,7 +133,7 @@ void SpectralSelectionBar::Populate()
|
|||||||
: wxString(wxEmptyString);
|
: wxString(wxEmptyString);
|
||||||
|
|
||||||
wxFlexGridSizer *mainSizer;
|
wxFlexGridSizer *mainSizer;
|
||||||
Add((mainSizer = safenew wxFlexGridSizer(1, 1, 1)), 0, wxALIGN_CENTER_VERTICAL);
|
Add((mainSizer = safenew wxFlexGridSizer(1, 1, 1)), 0,wxALIGN_TOP | wxLEFT | wxTOP, 5);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Top row, choice box
|
// Top row, choice box
|
||||||
@ -147,7 +147,7 @@ void SpectralSelectionBar::Populate()
|
|||||||
(this, OnChoiceID, wxDefaultPosition, wxDefaultSize, 2, choices,
|
(this, OnChoiceID, wxDefaultPosition, wxDefaultSize, 2, choices,
|
||||||
0, wxDefaultValidator, _("Spectral Selection"));
|
0, wxDefaultValidator, _("Spectral Selection"));
|
||||||
mChoice->SetSelection(mbCenterAndWidth ? 0 : 1);
|
mChoice->SetSelection(mbCenterAndWidth ? 0 : 1);
|
||||||
mainSizer->Add(mChoice, 0, wxALIGN_CENTER_VERTICAL | wxEXPAND, 5);
|
mainSizer->Add(mChoice, 0, wxALIGN_TOP | wxEXPAND |wxRIGHT, 6);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Bottom row, split into two columns, each with one control
|
// Bottom row, split into two columns, each with one control
|
||||||
@ -168,7 +168,7 @@ void SpectralSelectionBar::Populate()
|
|||||||
mWidthCtrl->SetInvalidValue(-1.0);
|
mWidthCtrl->SetInvalidValue(-1.0);
|
||||||
mWidthCtrl->SetName(wxString(_("Bandwidth:")));
|
mWidthCtrl->SetName(wxString(_("Bandwidth:")));
|
||||||
mWidthCtrl->EnableMenu();
|
mWidthCtrl->EnableMenu();
|
||||||
subSizer->Add(mWidthCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
|
subSizer->Add(mWidthCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
||||||
|
|
||||||
mLowCtrl = safenew NumericTextCtrl(
|
mLowCtrl = safenew NumericTextCtrl(
|
||||||
NumericConverter::FREQUENCY, this, OnLowID, frequencyFormatName, 0.0);
|
NumericConverter::FREQUENCY, this, OnLowID, frequencyFormatName, 0.0);
|
||||||
@ -182,14 +182,14 @@ void SpectralSelectionBar::Populate()
|
|||||||
mHighCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency);
|
mHighCtrl->SetInvalidValue(SelectedRegion::UndefinedFrequency);
|
||||||
mHighCtrl->SetName(wxString(_("High Frequency:")));
|
mHighCtrl->SetName(wxString(_("High Frequency:")));
|
||||||
mHighCtrl->EnableMenu();
|
mHighCtrl->EnableMenu();
|
||||||
subSizer->Add(mHighCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
|
subSizer->Add(mHighCtrl, 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 5);
|
||||||
|
|
||||||
mCenterCtrl->Show(mbCenterAndWidth);
|
mCenterCtrl->Show(mbCenterAndWidth);
|
||||||
mWidthCtrl->Show(mbCenterAndWidth);
|
mWidthCtrl->Show(mbCenterAndWidth);
|
||||||
mLowCtrl->Show(!mbCenterAndWidth);
|
mLowCtrl->Show(!mbCenterAndWidth);
|
||||||
mHighCtrl->Show(!mbCenterAndWidth);
|
mHighCtrl->Show(!mbCenterAndWidth);
|
||||||
|
|
||||||
mainSizer->Add(subSizer.release(), 0, wxALIGN_CENTER_VERTICAL | wxRIGHT, 0);
|
mainSizer->Add(subSizer.release(), 0, wxALIGN_CENTER_VERTICAL, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
mainSizer->Layout();
|
mainSizer->Layout();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user