1
0
mirror of https://github.com/cookiengineer/audacity synced 2026-02-06 03:32:09 +01:00

ProjectWindow does not depend on selection toolbars...

... Freeing SelectionBar and SpectralSelectionBar from cycles.

Also fixing a minor problem:  if two projects are open, and one is playing or
recording, and you switch windows -- then the audio time in the selection bar
of the other project could be updated.
This commit is contained in:
Paul Licameli
2019-06-12 17:35:09 -04:00
parent c6f24d864b
commit f0ae4c3858
5 changed files with 38 additions and 15 deletions

View File

@@ -55,8 +55,10 @@ with changes in the SpectralSelectionBar.
#include <wx/statline.h>
#include "../Prefs.h"
#include "../Project.h"
#include "../AllThemeResources.h"
#include "../SelectedRegion.h"
#include "../ViewInfo.h"
#if wxUSE_ACCESSIBILITY
#include "../widgets/WindowAccessible.h"
@@ -86,6 +88,7 @@ BEGIN_EVENT_TABLE(SpectralSelectionBar, ToolBar)
EVT_CHOICE(OnChoiceID, SpectralSelectionBar::OnChoice)
EVT_COMMAND(wxID_ANY, EVT_FREQUENCYTEXTCTRL_UPDATED, SpectralSelectionBar::OnUpdate)
EVT_COMMAND(wxID_ANY, EVT_BANDWIDTHTEXTCTRL_UPDATED, SpectralSelectionBar::OnUpdate)
EVT_IDLE( SpectralSelectionBar::OnIdle )
END_EVENT_TABLE()
static const wxString preferencePath
@@ -369,6 +372,14 @@ void SpectralSelectionBar::OnChoice(wxCommandEvent &)
Updated();
}
void SpectralSelectionBar::OnIdle( wxIdleEvent &evt )
{
evt.Skip();
auto &project = mProject;
const auto &selectedRegion = ViewInfo::Get( project ).selectedRegion;
SetFrequencies( selectedRegion.f0(), selectedRegion.f1() );
}
void SpectralSelectionBar::OnUpdate(wxCommandEvent &evt)
{
int index = evt.GetInt();