1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-25 16:48:44 +02:00
audacity/src/prefs/PrefsDialog.h
Paul Licameli ae9aca8177 Implement member functions of classes in corresponding .cpp files...
... in four cases; not in some other .cpp file.

This is another move that causes the generated graph to reflect dependencies
correctly.

This fixes other large, hidden cycles that involved PrefsDialog.cpp: there was
link dependency on that when PrefsPanel.h was used for the base class.  No
longer.

Also cycles involving TrackPanel.cpp, which contained the default
implementations for TrackPanelCell and related abstract base classes.
2020-05-28 05:50:22 -04:00

96 lines
2.5 KiB
C++

/**********************************************************************
Audacity: A Digital Audio Editor
PrefsDialog.h
Joshua Haberman
James Crook
**********************************************************************/
#ifndef __AUDACITY_PREFS_DIALOG__
#define __AUDACITY_PREFS_DIALOG__
#include <functional>
#include <vector>
#include "../widgets/wxPanelWrapper.h" // to inherit
#include "PrefsPanel.h"
class AudacityProject;
class wxTreebook;
class wxTreeEvent;
class ShuttleGui;
#ifdef __GNUC__
#define CONST
#else
#define CONST const
#endif
class AudacityProject;
class PrefsDialog /* not final */ : public wxDialogWrapper
{
public:
PrefsDialog(wxWindow * parent,
AudacityProject *pProject, // may be null
const TranslatableString &titlePrefix = XO("Preferences:"),
PrefsPanel::Factories &factories =
PrefsPanel::DefaultFactories());
virtual ~PrefsDialog();
// Defined this so a protected virtual can be invoked after the constructor
int ShowModal() override;
void ShuttleAll( ShuttleGui & S);
void OnCategoryChange(wxCommandEvent & e);
void OnOK(wxCommandEvent & e);
void OnCancel(wxCommandEvent & e);
void OnPreview(wxCommandEvent & e);
void OnHelp(wxCommandEvent & e);
void OnTreeKeyDown(wxTreeEvent & e); // Used to dismiss the dialog when enter is pressed with focus on tree
void SelectPageByName(const wxString &pageName);
// Accessor to help implementations of SavePreferredPage(),
// such as by saving a preference after DoModal() returns
int GetSelectedPage() const;
protected:
// Decide which page to open first; return -1 for undecided
virtual long GetPreferredPage() = 0;
// Called after OK is clicked and all pages validate
virtual void SavePreferredPage() = 0;
private:
void RecordExpansionState();
PrefsPanel * GetCurrentPanel();
wxTreebook *mCategories{};
PrefsPanel *mUniquePage{};
PrefsPanel::Factories &mFactories;
const TranslatableString mTitlePrefix;
DECLARE_EVENT_TABLE()
};
// This adds code appropriate only to the original use of PrefsDialog for
// global settings -- not its reuses elsewhere as in View Settings
class GlobalPrefsDialog final : public PrefsDialog
{
public:
GlobalPrefsDialog(
wxWindow * parent, AudacityProject *pProject,
PrefsPanel::Factories &factories =
PrefsPanel::DefaultFactories());
virtual ~GlobalPrefsDialog();
long GetPreferredPage() override;
void SavePreferredPage() override;
};
class AudacityProject;
void DoReloadPreferences( AudacityProject &project );
#endif