Audacity 3.2.0
Public Member Functions | Static Public Member Functions | Public Attributes | List of all members
anonymous_namespace{SpectrumView.cpp}::SpectrogramSettingsHandler Struct Reference
Inheritance diagram for anonymous_namespace{SpectrumView.cpp}::SpectrogramSettingsHandler:
[legend]
Collaboration diagram for anonymous_namespace{SpectrumView.cpp}::SpectrogramSettingsHandler:
[legend]

Public Member Functions

void OnSpectrogramSettings (wxCommandEvent &)
 
void InitUserData (void *pUserData) override
 Called before the menu items are appended. More...
 
- Public Member Functions inherited from PopupMenuHandler
 PopupMenuHandler ()=default
 
 PopupMenuHandler (const PopupMenuHandler &)=delete
 
PopupMenuHandleroperator= (const PopupMenuHandler &)=delete
 
virtual void InitUserData (void *pUserData)=0
 Called before the menu items are appended. More...
 

Static Public Member Functions

static SpectrogramSettingsHandlerInstance ()
 

Public Attributes

PlayableTrackControls::InitMenuDatampData {}
 

Detailed Description

Definition at line 931 of file SpectrumView.cpp.

Member Function Documentation

◆ InitUserData()

void anonymous_namespace{SpectrumView.cpp}::SpectrogramSettingsHandler::InitUserData ( void *  pUserData)
inlineoverridevirtual

Called before the menu items are appended.

Store context data, if needed. May be called more than once before the menu opens. Pointer remains valid for the duration of any callback, if PopupMenuTable::BuildMenu() is called and the result's Popup() is called before any other menus are built.

Implements PopupMenuHandler.

Definition at line 942 of file SpectrumView.cpp.

◆ Instance()

static SpectrogramSettingsHandler & anonymous_namespace{SpectrumView.cpp}::SpectrogramSettingsHandler::Instance ( )
inlinestatic

Definition at line 934 of file SpectrumView.cpp.

935 {
936 static SpectrogramSettingsHandler instance;
937 return instance;
938 }

◆ OnSpectrogramSettings()

void anonymous_namespace{SpectrumView.cpp}::SpectrogramSettingsHandler::OnSpectrogramSettings ( wxCommandEvent &  )

Definition at line 948 of file SpectrumView.cpp.

949{
950 class ViewSettingsDialog final : public PrefsDialog
951 {
952 public:
953 ViewSettingsDialog(wxWindow *parent, AudacityProject &project,
955 int page)
956 : PrefsDialog(parent, &project, title, factories)
957 , mPage(page)
958 {
959 }
960
961 long GetPreferredPage() override
962 {
963 return mPage;
964 }
965
966 void SavePreferredPage() override
967 {
968 }
969
970 private:
971 const int mPage;
972 };
973
974 auto gAudioIO = AudioIOBase::Get();
975 if (gAudioIO->IsBusy()){
977 XO(
978"To change Spectrogram Settings, stop any\n playing or recording first."),
979 XO("Stop the Audio First"),
980 wxOK | wxICON_EXCLAMATION | wxCENTRE);
981 return;
982 }
983
984 auto &wc = **static_cast<WaveTrack&>(mpData->track).Channels().begin();
985
986 PrefsPanel::Factories factories;
987 // factories.push_back(WaveformPrefsFactory(&track));
988 factories.push_back(SpectrumPrefsFactory(&wc));
989 const int page =
990 // (pTrack->GetDisplay() == WaveChannelViewConstants::Spectrum) ? 1 :
991 0;
992
993 auto title = XO("%s:").Format(wc.GetTrack().GetName());
994 ViewSettingsDialog dialog(
995 mpData->pParent, mpData->project, title, factories, page);
996
997 if (0 != dialog.ShowModal()) {
998 // Redraw
1000 ProjectHistory::Get( *project ).ModifyState(true);
1001 //Bug 1725 Toolbar was left greyed out.
1002 //This solution is overkill, but does fix the problem and is what the
1003 //prefs dialog normally does.
1006 }
1007}
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
XO("Cut/Copy/Paste")
static const auto title
PrefsPanel::Factory SpectrumPrefsFactory(WaveChannel *wc)
const auto project
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:90
static AudioIOBase * Get()
Definition: AudioIOBase.cpp:94
static void RebuildAllMenuBars()
Dialog that shows the current PrefsPanel in a tabbed divider.
Definition: PrefsDialog.h:29
std::vector< PrefsPanel::PrefsNode > Factories
Definition: PrefsPanel.h:72
void ModifyState(bool bWantsAutoSave)
static ProjectHistory & Get(AudacityProject &project)
Holds a msgid for the translation catalog; may also bind format arguments.
A Track that contains audio waveform data.
Definition: WaveTrack.h:203

References AudacityMessageBox(), AudioIOBase::Get(), ProjectHistory::Get(), PrefsDialog::GetPreferredPage(), ProjectHistory::ModifyState(), PrefsDialog::PrefsDialog(), project, MenuCreator::RebuildAllMenuBars(), RefreshCode::RefreshAll, PrefsDialog::SavePreferredPage(), SpectrumPrefsFactory(), title, and XO().

Here is the call graph for this function:

Member Data Documentation

◆ mpData

PlayableTrackControls::InitMenuData* anonymous_namespace{SpectrumView.cpp}::SpectrogramSettingsHandler::mpData {}

Definition at line 933 of file SpectrumView.cpp.


The documentation for this struct was generated from the following file: