1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-09-17 16:50:26 +02:00
audacity/src/prefs/KeyConfigPrefs.h
Paul Licameli bf5228267a Calls to Disconnect or Unbind in destructors are not needed, if...
... it's either the source of the connection that is being destroyed, or other
object (such as an ancestor window) transitively owning it and so causing it to
be destroyed too;

or, the sink is being destroyed, and that sink is a wxEvtHandler (which is
always so for Disconnect, though not for Unbind in case Bind was passed a
member function of a non-wxEvtHandler).

wxWidgets takes care of erasing the connection in such cases.

This removes most calls to Disconnect and Unbind.  Many destructors shrank to
nothing.

Notably, in case of popup menu handling, the call to Disconnect is not removable
because the object being destroyed is neither the source nor the sink.
2018-02-21 19:28:06 -05:00

107 lines
2.5 KiB
C++

/**********************************************************************
Audacity: A Digital Audio Editor
KeyConfigPrefs.h
Brian Gunlogson
Dominic Mazzoni
**********************************************************************/
#ifndef __AUDACITY_KEY_CONFIG_PREFS__
#define __AUDACITY_KEY_CONFIG_PREFS__
#include "../Experimental.h"
class ShuttleGui;
#include <wx/defs.h>
#include <wx/imaglist.h>
#include <wx/listctrl.h>
#include <wx/radiobut.h>
#include <wx/srchctrl.h>
#include <wx/string.h>
#include <wx/textctrl.h>
#include <wx/timer.h>
#include "../commands/CommandManager.h"
#include "../widgets/KeyView.h"
#include "PrefsPanel.h"
class wxStaticText;
class KeyConfigPrefs final : public PrefsPanel
{
public:
KeyConfigPrefs(wxWindow * parent, wxWindowID winid, const wxString &name);
bool Commit() override;
void Cancel() override;
wxString HelpPageName() override;
private:
void Populate();
void PopulateOrExchange(ShuttleGui & S);
void RefreshBindings(bool bSort);
void FilterKeys( wxArrayString & arr );
wxString NameFromKey(const wxString & key);
void SetKeyForSelected(const wxString & key);
void OnViewBy(wxCommandEvent & e);
void OnDefaults(wxCommandEvent & e);
void OnImportDefaults(wxCommandEvent & e);
void OnImport(wxCommandEvent & e);
void OnExport(wxCommandEvent & e);
void OnSet(wxCommandEvent & e);
void OnClear(wxCommandEvent & e);
void OnSelected(wxCommandEvent & e);
void OnHotkeyKeyDown(wxKeyEvent & e);
void OnHotkeyChar(wxKeyEvent & e);
void OnHotkeyKillFocus(wxFocusEvent & e);
void OnFilterTimer(wxTimerEvent & e);
void OnFilterKeyDown(wxKeyEvent & e);
void OnFilterChar(wxKeyEvent & e);
KeyView *mView;
wxTextCtrl *mKey;
wxButton *mSet;
wxButton *mClear;
wxTextCtrl *mFilter;
wxStaticText *mFilterLabel;
wxTimer mFilterTimer;
bool mFilterPending;
ViewByType mViewType;
wxRadioButton *mViewByTree;
wxRadioButton *mViewByName;
wxRadioButton *mViewByKey;
CommandManager *mManager;
int mCommandSelected;
wxArrayString mNames;
wxArrayString mDefaultKeys; // The full set.
wxArrayString mStandardDefaultKeys; // The reduced set.
wxArrayString mKeys;
wxArrayString mNewKeys; // Used for work in progress.
DECLARE_EVENT_TABLE()
};
class KeyConfigPrefsFactory final : public PrefsPanelFactory
{
public:
KeyConfigPrefsFactory(const wxString &name = wxString{})
: mName{ name } {}
PrefsPanel *operator () (wxWindow *parent, wxWindowID winid) override;
private:
wxString mName;
};
#endif