Audacity  2.2.2
Public Member Functions | Private Member Functions | Private Attributes | List of all members
EffectPresetsDialog Class Referencefinal

#include <Effect.h>

Inheritance diagram for EffectPresetsDialog:
wxDialogWrapper wxTabTraversalWrapper< wxDialog >

Public Member Functions

 EffectPresetsDialog (wxWindow *parent, Effect *effect)
 
virtual ~EffectPresetsDialog ()
 
wxString GetSelected () const
 
void SetSelected (const wxString &parms)
 
- Public Member Functions inherited from wxDialogWrapper
 wxDialogWrapper ()
 
 wxDialogWrapper (wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const wxString &name=_("Dialog"))
 
bool Create (wxWindow *parent, wxWindowID id, const wxString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const wxString &name=_("Dialog"))
 
- Public Member Functions inherited from wxTabTraversalWrapper< wxDialog >
 wxTabTraversalWrapper (Args &&...args)
 

Private Member Functions

void SetPrefix (const wxString &type, const wxString &prefix)
 
void UpdateUI ()
 
void OnType (wxCommandEvent &evt)
 
void OnOk (wxCommandEvent &evt)
 
void OnCancel (wxCommandEvent &evt)
 

Private Attributes

wxChoice * mType
 
wxListBox * mPresets
 
wxArrayString mFactoryPresets
 
wxArrayString mUserPresets
 
wxString mSelection
 

Detailed Description

Definition at line 688 of file Effect.h.

Constructor & Destructor Documentation

EffectPresetsDialog::EffectPresetsDialog ( wxWindow *  parent,
Effect effect 
)

Definition at line 3935 of file Effect.cpp.

References _(), ShuttleGuiBase::AddChoice(), ShuttleGuiBase::AddListBox(), ShuttleGuiBase::AddPrompt(), ShuttleGui::AddStandardButtons(), eIsCreating, ShuttleGuiBase::EndTwoColumn(), ShuttleGuiBase::EndVerticalLay(), ShuttleGui::Id(), ShuttleGuiBase::SetStretchyCol(), ShuttleGuiBase::StartTwoColumn(), and ShuttleGuiBase::StartVerticalLay().

3936 : wxDialogWrapper(parent, wxID_ANY, wxString(_("Select Preset")))
3937 {
3938  ShuttleGui S(this, eIsCreating);
3939  S.StartVerticalLay();
3940  {
3941  S.StartTwoColumn();
3942  S.SetStretchyCol(1);
3943  {
3944  wxArrayString empty;
3945 
3946  S.AddPrompt(_("Type:"));
3947  mType = S.Id(ID_Type).AddChoice( {}, wxT(""), &empty);
3948  mType->SetSelection(0);
3949 
3950  S.AddPrompt(_("&Preset:"));
3951  mPresets = S.AddListBox(&empty, wxLB_SINGLE | wxLB_NEEDED_SB );
3952  }
3953  S.EndTwoColumn();
3954 
3955  S.AddStandardButtons();
3956  }
3957  S.EndVerticalLay();
3958 
3959  mUserPresets = effect->GetUserPresets();
3960  mFactoryPresets = effect->GetFactoryPresets();
3961 
3962  if (mUserPresets.GetCount() > 0)
3963  {
3964  mType->Append(_("User Presets"));
3965  }
3966 
3967  if (mFactoryPresets.GetCount() > 0)
3968  {
3969  mType->Append(_("Factory Presets"));
3970  }
3971 
3972  if (effect->HasCurrentSettings())
3973  {
3974  mType->Append(_("Current Settings"));
3975  }
3976 
3977  if (effect->HasFactoryDefaults())
3978  {
3979  mType->Append(_("Factory Defaults"));
3980  }
3981 
3982  UpdateUI();
3983 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
wxListBox * mPresets
Definition: Effect.h:707
virtual bool HasCurrentSettings()
Definition: Effect.cpp:1102
wxArrayString mFactoryPresets
Definition: Effect.h:709
virtual bool HasFactoryDefaults()
Definition: Effect.cpp:1107
wxArrayString GetFactoryPresets() override
Definition: Effect.cpp:618
wxChoice * mType
Definition: Effect.h:706
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxArrayString mUserPresets
Definition: Effect.h:710
virtual wxArrayString GetUserPresets()
Definition: Effect.cpp:1091
EffectPresetsDialog::~EffectPresetsDialog ( )
virtual

Definition at line 3985 of file Effect.cpp.

3986 {
3987 }

Member Function Documentation

wxString EffectPresetsDialog::GetSelected ( ) const

Definition at line 3989 of file Effect.cpp.

References mSelection.

Referenced by Effect::GetPreset().

3990 {
3991  return mSelection;
3992 }
wxString mSelection
Definition: Effect.h:711
void EffectPresetsDialog::OnCancel ( wxCommandEvent &  evt)
private

Definition at line 4139 of file Effect.cpp.

References mSelection.

4140 {
4141  mSelection = wxEmptyString;
4142 
4143  EndModal(false);
4144 }
wxString mSelection
Definition: Effect.h:711
void EffectPresetsDialog::OnOk ( wxCommandEvent &  evt)
private

Definition at line 4132 of file Effect.cpp.

References UpdateUI().

4133 {
4134  UpdateUI();
4135 
4136  EndModal(true);
4137 }
void EffectPresetsDialog::OnType ( wxCommandEvent &  evt)
private

Definition at line 4127 of file Effect.cpp.

References UpdateUI().

4128 {
4129  UpdateUI();
4130 }
void EffectPresetsDialog::SetPrefix ( const wxString &  type,
const wxString &  prefix 
)
private

Definition at line 4017 of file Effect.cpp.

References _(), Effect::kCurrentSettingsIdent, Effect::kFactoryDefaultsIdent, Effect::kFactoryPresetIdent, Effect::kUserPresetIdent, label, mFactoryPresets, mPresets, mSelection, mType, and mUserPresets.

Referenced by SetSelected().

4018 {
4019  mType->SetStringSelection(type);
4020 
4021  if (type.IsSameAs(_("User Presets")))
4022  {
4023  mPresets->Clear();
4024  mPresets->Append(mUserPresets);
4025  mPresets->Enable(true);
4026  mPresets->SetStringSelection(prefix);
4027  if (mPresets->GetSelection() == wxNOT_FOUND)
4028  {
4029  mPresets->SetSelection(0);
4030  }
4031  mSelection = Effect::kUserPresetIdent + mPresets->GetStringSelection();
4032  }
4033  else if (type.IsSameAs(_("Factory Presets")))
4034  {
4035  mPresets->Clear();
4036  for (size_t i = 0, cnt = mFactoryPresets.GetCount(); i < cnt; i++)
4037  {
4038  wxString label = mFactoryPresets[i];
4039  if (label.IsEmpty())
4040  {
4041  label = _("None");
4042  }
4043  mPresets->Append(label);
4044  }
4045  mPresets->Enable(true);
4046  mPresets->SetStringSelection(prefix);
4047  if (mPresets->GetSelection() == wxNOT_FOUND)
4048  {
4049  mPresets->SetSelection(0);
4050  }
4051  mSelection = Effect::kFactoryPresetIdent + mPresets->GetStringSelection();
4052  }
4053  else if (type.IsSameAs(_("Current Settings")))
4054  {
4055  mPresets->Clear();
4056  mPresets->Enable(false);
4058  }
4059  else if (type.IsSameAs(_("Factory Defaults")))
4060  {
4061  mPresets->Clear();
4062  mPresets->Enable(false);
4064  }
4065 }
wxString label
Definition: Tags.cpp:727
wxListBox * mPresets
Definition: Effect.h:707
wxArrayString mFactoryPresets
Definition: Effect.h:709
static const wxString kUserPresetIdent
Definition: Effect.h:541
wxChoice * mType
Definition: Effect.h:706
wxString mSelection
Definition: Effect.h:711
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxArrayString mUserPresets
Definition: Effect.h:710
static const wxString kFactoryPresetIdent
Definition: Effect.h:542
static const wxString kCurrentSettingsIdent
Definition: Effect.h:543
static const wxString kFactoryDefaultsIdent
Definition: Effect.h:544
void EffectPresetsDialog::SetSelected ( const wxString &  parms)

Definition at line 3994 of file Effect.cpp.

References _(), Effect::kCurrentSettingsIdent, Effect::kFactoryDefaultsIdent, Effect::kFactoryPresetIdent, Effect::kUserPresetIdent, and SetPrefix().

Referenced by Effect::GetPreset().

3995 {
3996  wxString preset = parms;
3997  if (preset.StartsWith(Effect::kUserPresetIdent))
3998  {
3999  preset.Replace(Effect::kUserPresetIdent, wxEmptyString, false);
4000  SetPrefix(_("User Presets"), preset);
4001  }
4002  else if (preset.StartsWith(Effect::kFactoryPresetIdent))
4003  {
4004  preset.Replace(Effect::kFactoryPresetIdent, wxEmptyString, false);
4005  SetPrefix(_("Factory Presets"), preset);
4006  }
4007  else if (preset.StartsWith(Effect::kCurrentSettingsIdent))
4008  {
4009  SetPrefix(_("Current Settings"), wxEmptyString);
4010  }
4011  else if (preset.StartsWith(Effect::kFactoryDefaultsIdent))
4012  {
4013  SetPrefix(_("Factory Defaults"), wxEmptyString);
4014  }
4015 }
void SetPrefix(const wxString &type, const wxString &prefix)
Definition: Effect.cpp:4017
static const wxString kUserPresetIdent
Definition: Effect.h:541
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
static const wxString kFactoryPresetIdent
Definition: Effect.h:542
static const wxString kCurrentSettingsIdent
Definition: Effect.h:543
static const wxString kFactoryDefaultsIdent
Definition: Effect.h:544
void EffectPresetsDialog::UpdateUI ( void  )
private

Definition at line 4067 of file Effect.cpp.

References _(), Effect::kCurrentSettingsIdent, Effect::kFactoryDefaultsIdent, Effect::kFactoryPresetIdent, Effect::kUserPresetIdent, label, mFactoryPresets, mPresets, mSelection, mType, and mUserPresets.

Referenced by OnOk(), and OnType().

4068 {
4069  int selected = mType->GetSelection();
4070  if (selected == wxNOT_FOUND)
4071  {
4072  selected = 0;
4073  mType->SetSelection(selected);
4074  }
4075  wxString type = mType->GetString(selected);
4076 
4077  if (type.IsSameAs(_("User Presets")))
4078  {
4079  selected = mPresets->GetSelection();
4080  if (selected == wxNOT_FOUND)
4081  {
4082  selected = 0;
4083  }
4084 
4085  mPresets->Clear();
4086  mPresets->Append(mUserPresets);
4087  mPresets->Enable(true);
4088  mPresets->SetSelection(selected);
4089  mSelection = Effect::kUserPresetIdent + mPresets->GetString(selected);
4090  }
4091  else if (type.IsSameAs(_("Factory Presets")))
4092  {
4093  selected = mPresets->GetSelection();
4094  if (selected == wxNOT_FOUND)
4095  {
4096  selected = 0;
4097  }
4098 
4099  mPresets->Clear();
4100  for (size_t i = 0, cnt = mFactoryPresets.GetCount(); i < cnt; i++)
4101  {
4102  wxString label = mFactoryPresets[i];
4103  if (label.IsEmpty())
4104  {
4105  label = _("None");
4106  }
4107  mPresets->Append(label);
4108  }
4109  mPresets->Enable(true);
4110  mPresets->SetSelection(selected);
4111  mSelection = Effect::kFactoryPresetIdent + mPresets->GetString(selected);
4112  }
4113  else if (type.IsSameAs(_("Current Settings")))
4114  {
4115  mPresets->Clear();
4116  mPresets->Enable(false);
4118  }
4119  else if (type.IsSameAs(_("Factory Defaults")))
4120  {
4121  mPresets->Clear();
4122  mPresets->Enable(false);
4124  }
4125 }
wxString label
Definition: Tags.cpp:727
wxListBox * mPresets
Definition: Effect.h:707
wxArrayString mFactoryPresets
Definition: Effect.h:709
static const wxString kUserPresetIdent
Definition: Effect.h:541
wxChoice * mType
Definition: Effect.h:706
wxString mSelection
Definition: Effect.h:711
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop")).Raw()), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom")).Raw()), OnMoveTrack)#define SET_TRACK_NAME_PLUGIN_SYMBOLclass SetTrackNameCommand:public AudacityCommand
wxArrayString mUserPresets
Definition: Effect.h:710
static const wxString kFactoryPresetIdent
Definition: Effect.h:542
static const wxString kCurrentSettingsIdent
Definition: Effect.h:543
static const wxString kFactoryDefaultsIdent
Definition: Effect.h:544

Member Data Documentation

wxArrayString EffectPresetsDialog::mFactoryPresets
private

Definition at line 709 of file Effect.h.

Referenced by SetPrefix(), and UpdateUI().

wxListBox* EffectPresetsDialog::mPresets
private

Definition at line 707 of file Effect.h.

Referenced by SetPrefix(), and UpdateUI().

wxString EffectPresetsDialog::mSelection
private

Definition at line 711 of file Effect.h.

Referenced by GetSelected(), OnCancel(), SetPrefix(), and UpdateUI().

wxChoice* EffectPresetsDialog::mType
private

Definition at line 706 of file Effect.h.

Referenced by SetPrefix(), and UpdateUI().

wxArrayString EffectPresetsDialog::mUserPresets
private

Definition at line 710 of file Effect.h.

Referenced by SetPrefix(), and UpdateUI().


The documentation for this class was generated from the following files: