mirror of
https://github.com/cookiengineer/audacity
synced 2026-04-22 06:01:31 +02:00
Split class ProjectSelectionManager from ProjectManager...
... handling the callbacks from the selection toolbars. Next ProjectFileManager will be split out of ProjectManager, and ProjectSelectionManager will be used by it during file opening, so separating files for it avoids a cycle.
This commit is contained in:
@@ -34,14 +34,50 @@ namespace ProjectFileIORegistry{ struct Entry; }
|
||||
|
||||
using WaveTrackArray = std::vector < std::shared_ptr < WaveTrack > >;
|
||||
|
||||
class ProjectSelectionManager final
|
||||
: public ClientData::Base
|
||||
, public SelectionBarListener
|
||||
, public SpectralSelectionBarListener
|
||||
{
|
||||
public:
|
||||
static ProjectSelectionManager &Get( AudacityProject &project );
|
||||
static const ProjectSelectionManager &Get( const AudacityProject &project );
|
||||
|
||||
explicit ProjectSelectionManager( AudacityProject &project );
|
||||
~ProjectSelectionManager() override;
|
||||
|
||||
// SelectionBarListener callback methods
|
||||
double AS_GetRate() override;
|
||||
void AS_SetRate(double rate) override;
|
||||
int AS_GetSnapTo() override;
|
||||
void AS_SetSnapTo(int snap) override;
|
||||
const NumericFormatSymbol & AS_GetSelectionFormat() override;
|
||||
void AS_SetSelectionFormat(const NumericFormatSymbol & format) override;
|
||||
void AS_ModifySelection(double &start, double &end, bool done) override;
|
||||
|
||||
// SpectralSelectionBarListener callback methods
|
||||
double SSBL_GetRate() const override;
|
||||
const NumericFormatSymbol & SSBL_GetFrequencySelectionFormatName() override;
|
||||
void SSBL_SetFrequencySelectionFormatName(
|
||||
const NumericFormatSymbol & formatName) override;
|
||||
const NumericFormatSymbol & SSBL_GetBandwidthSelectionFormatName() override;
|
||||
void SSBL_SetBandwidthSelectionFormatName(
|
||||
const NumericFormatSymbol & formatName) override;
|
||||
void SSBL_ModifySpectralSelection(
|
||||
double &bottom, double &top, bool done) override;
|
||||
|
||||
private:
|
||||
bool SnapSelection();
|
||||
|
||||
AudacityProject &mProject;
|
||||
};
|
||||
|
||||
///\brief Object associated with a project for high-level management of the
|
||||
/// project's lifetime, including creation, destruction, opening from file,
|
||||
/// importing, pushing undo states, and reverting to saved states
|
||||
class ProjectManager final
|
||||
: public wxEvtHandler
|
||||
, public ClientData::Base
|
||||
, private SelectionBarListener
|
||||
, private SpectralSelectionBarListener
|
||||
{
|
||||
public:
|
||||
static ProjectManager &Get( AudacityProject &project );
|
||||
@@ -119,34 +155,12 @@ public:
|
||||
|
||||
void SetMenuClose(bool value) { mMenuClose = value; }
|
||||
|
||||
// SelectionBarListener callback methods
|
||||
double AS_GetRate() override;
|
||||
void AS_SetRate(double rate) override;
|
||||
int AS_GetSnapTo() override;
|
||||
void AS_SetSnapTo(int snap) override;
|
||||
const NumericFormatSymbol & AS_GetSelectionFormat() override;
|
||||
void AS_SetSelectionFormat(const NumericFormatSymbol & format) override;
|
||||
void AS_ModifySelection(double &start, double &end, bool done) override;
|
||||
|
||||
// SpectralSelectionBarListener callback methods
|
||||
double SSBL_GetRate() const override;
|
||||
const NumericFormatSymbol & SSBL_GetFrequencySelectionFormatName() override;
|
||||
void SSBL_SetFrequencySelectionFormatName(
|
||||
const NumericFormatSymbol & formatName) override;
|
||||
const NumericFormatSymbol & SSBL_GetBandwidthSelectionFormatName() override;
|
||||
void SSBL_SetBandwidthSelectionFormatName(
|
||||
const NumericFormatSymbol & formatName) override;
|
||||
void SSBL_ModifySpectralSelection(
|
||||
double &bottom, double &top, bool done) override;
|
||||
|
||||
private:
|
||||
void OnCloseWindow(wxCloseEvent & event);
|
||||
void OnTimer(wxTimerEvent & event);
|
||||
void OnOpenAudioFile(wxCommandEvent & event);
|
||||
void OnStatusChange( wxCommandEvent& );
|
||||
|
||||
bool SnapSelection();
|
||||
|
||||
void RestartTimer();
|
||||
|
||||
// Declared in this class so that they can have access to private members
|
||||
|
||||
Reference in New Issue
Block a user