1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68
|
/**********************************************************************
Audacity: A Digital Audio Editor
@file ProjectNumericFormats.cpp
Paul Licameli split from ProjectSettings.cpp
**********************************************************************/
#ifndef __AUDACITY_PROJECT_NUMERIC_FORMATS__
#define __AUDACITY_PROJECT_NUMERIC_FORMATS__
#include "ClientData.h"
#include "ComponentInterfaceSymbol.h"
#include "NumericConverterType.h"
#include "Observer.h"
class AudacityProject;
struct ProjectNumericFormatsEvent {
const enum Type : int {
ChangedSelectionFormat,
ChangedAudioTimeFormat,
ChangedFrequencyFormat,
ChangedBandwidthFormat,
} type;
const NumericFormatID oldValue;
const NumericFormatID newValue;
};
class NUMERIC_FORMATS_API ProjectNumericFormats final
: public ClientData::Base
, public Observer::Publisher<ProjectNumericFormatsEvent>
{
public:
static ProjectNumericFormats &Get(AudacityProject &project);
static const ProjectNumericFormats &Get(const AudacityProject &project);
explicit ProjectNumericFormats(const AudacityProject& project);
~ProjectNumericFormats() override;
// Selection Format
void SetSelectionFormat(const NumericFormatID & format);
NumericFormatID GetSelectionFormat() const;
// AudioTime format
void SetAudioTimeFormat(const NumericFormatID & format);
NumericFormatID GetAudioTimeFormat() const;
// Spectral Selection Formats
void SetFrequencySelectionFormatName(const NumericFormatID & format);
NumericFormatID GetFrequencySelectionFormatName() const;
void SetBandwidthSelectionFormatName(const NumericFormatID & format);
NumericFormatID GetBandwidthSelectionFormatName() const;
NumericFormatSymbol LookupFormat(const NumericConverterType& type, const wxString& identifier);
private:
const AudacityProject& mProject;
NumericFormatID mSelectionFormat;
NumericFormatID mFrequencySelectionFormatName;
NumericFormatID mBandwidthSelectionFormatName;
NumericFormatID mAudioTimeFormat;
};
#endif
|