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 935 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 946 of file SpectrumView.cpp.

◆ Instance()

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

Definition at line 938 of file SpectrumView.cpp.

939 {
940 static SpectrogramSettingsHandler instance;
941 return instance;
942 }

◆ OnSpectrogramSettings()

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

Definition at line 952 of file SpectrumView.cpp.

953{
954 class ViewSettingsDialog final : public PrefsDialog
955 {
956 public:
957 ViewSettingsDialog(wxWindow *parent, AudacityProject &project,
959 int page)
960 : PrefsDialog(parent, &project, title, factories)
961 , mPage(page)
962 {
963 }
964
965 long GetPreferredPage() override
966 {
967 return mPage;
968 }
969
970 void SavePreferredPage() override
971 {
972 }
973
974 private:
975 const int mPage;
976 };
977
978 auto gAudioIO = AudioIOBase::Get();
979 if (gAudioIO->IsBusy()){
981 XO(
982"To change Spectrogram Settings, stop any\n playing or recording first."),
983 XO("Stop the Audio First"),
984 wxOK | wxICON_EXCLAMATION | wxCENTRE);
985 return;
986 }
987
988 auto &wc = **static_cast<WaveTrack&>(mpData->track).Channels().begin();
989
990 PrefsPanel::Factories factories;
991 // factories.push_back(WaveformPrefsFactory(&track));
992 factories.push_back(SpectrumPrefsFactory(&wc));
993 const int page =
994 // (pTrack->GetDisplay() == WaveChannelViewConstants::Spectrum) ? 1 :
995 0;
996
997 auto title = XO("%s:").Format(wc.GetTrack().GetName());
998 ViewSettingsDialog dialog(
999 mpData->pParent, mpData->project, title, factories, page);
1000
1001 if (0 != dialog.ShowModal()) {
1002 // Redraw
1004 ProjectHistory::Get( *project ).ModifyState(true);
1005 //Bug 1725 Toolbar was left greyed out.
1006 //This solution is overkill, but does fix the problem and is what the
1007 //prefs dialog normally does.
1010 }
1011}
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 937 of file SpectrumView.cpp.


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