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)
 
 wxTabTraversalWrapper (const wxTabTraversalWrapper &)=delete
 
 wxTabTraversalWrapper (wxTabTraversalWrapper &&)=delete
 
wxTabTraversalWrapperoperator= (const wxTabTraversalWrapper &)=delete
 
wxTabTraversalWrapperoperator= (wxTabTraversalWrapper &&)=delete
 

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 692 of file Effect.h.

Constructor & Destructor Documentation

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

Definition at line 3928 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().

3929 : wxDialogWrapper(parent, wxID_ANY, wxString(_("Select Preset")))
3930 {
3931  ShuttleGui S(this, eIsCreating);
3932  S.StartVerticalLay();
3933  {
3934  S.StartTwoColumn();
3935  S.SetStretchyCol(1);
3936  {
3937  wxArrayString empty;
3938 
3939  S.AddPrompt(_("Type:"));
3940  mType = S.Id(ID_Type).AddChoice( {}, wxT(""), &empty);
3941  mType->SetSelection(0);
3942 
3943  S.AddPrompt(_("&Preset:"));
3944  mPresets = S.AddListBox(&empty, wxLB_SINGLE | wxLB_NEEDED_SB );
3945  }
3946  S.EndTwoColumn();
3947 
3948  S.AddStandardButtons();
3949  }
3950  S.EndVerticalLay();
3951 
3952  mUserPresets = effect->GetUserPresets();
3953  mFactoryPresets = effect->GetFactoryPresets();
3954 
3955  if (mUserPresets.GetCount() > 0)
3956  {
3957  mType->Append(_("User Presets"));
3958  }
3959 
3960  if (mFactoryPresets.GetCount() > 0)
3961  {
3962  mType->Append(_("Factory Presets"));
3963  }
3964 
3965  if (effect->HasCurrentSettings())
3966  {
3967  mType->Append(_("Current Settings"));
3968  }
3969 
3970  if (effect->HasFactoryDefaults())
3971  {
3972  mType->Append(_("Factory Defaults"));
3973  }
3974 
3975  UpdateUI();
3976 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
wxListBox * mPresets
Definition: Effect.h:711
virtual bool HasCurrentSettings()
Definition: Effect.cpp:1104
wxArrayString mFactoryPresets
Definition: Effect.h:713
virtual bool HasFactoryDefaults()
Definition: Effect.cpp:1109
wxArrayString GetFactoryPresets() override
Definition: Effect.cpp:619
wxChoice * mType
Definition: Effect.h:710
_("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:714
virtual wxArrayString GetUserPresets()
Definition: Effect.cpp:1093
EffectPresetsDialog::~EffectPresetsDialog ( )
virtual

Definition at line 3978 of file Effect.cpp.

3979 {
3980 }

Member Function Documentation

wxString EffectPresetsDialog::GetSelected ( ) const

Definition at line 3982 of file Effect.cpp.

References mSelection.

Referenced by Effect::GetPreset().

3983 {
3984  return mSelection;
3985 }
wxString mSelection
Definition: Effect.h:715
void EffectPresetsDialog::OnCancel ( wxCommandEvent &  evt)
private

Definition at line 4132 of file Effect.cpp.

References mSelection.

4133 {
4134  mSelection = wxEmptyString;
4135 
4136  EndModal(false);
4137 }
wxString mSelection
Definition: Effect.h:715
void EffectPresetsDialog::OnOk ( wxCommandEvent &  evt)
private

Definition at line 4125 of file Effect.cpp.

References UpdateUI().

4126 {
4127  UpdateUI();
4128 
4129  EndModal(true);
4130 }
void EffectPresetsDialog::OnType ( wxCommandEvent &  evt)
private

Definition at line 4120 of file Effect.cpp.

References UpdateUI().

4121 {
4122  UpdateUI();
4123 }
void EffectPresetsDialog::SetPrefix ( const wxString &  type,
const wxString &  prefix 
)
private

Definition at line 4010 of file Effect.cpp.

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

Referenced by SetSelected().

4011 {
4012  mType->SetStringSelection(type);
4013 
4014  if (type.IsSameAs(_("User Presets")))
4015  {
4016  mPresets->Clear();
4017  mPresets->Append(mUserPresets);
4018  mPresets->Enable(true);
4019  mPresets->SetStringSelection(prefix);
4020  if (mPresets->GetSelection() == wxNOT_FOUND)
4021  {
4022  mPresets->SetSelection(0);
4023  }
4024  mSelection = Effect::kUserPresetIdent + mPresets->GetStringSelection();
4025  }
4026  else if (type.IsSameAs(_("Factory Presets")))
4027  {
4028  mPresets->Clear();
4029  for (size_t i = 0, cnt = mFactoryPresets.GetCount(); i < cnt; i++)
4030  {
4031  wxString label = mFactoryPresets[i];
4032  if (label.IsEmpty())
4033  {
4034  label = _("None");
4035  }
4036  mPresets->Append(label);
4037  }
4038  mPresets->Enable(true);
4039  mPresets->SetStringSelection(prefix);
4040  if (mPresets->GetSelection() == wxNOT_FOUND)
4041  {
4042  mPresets->SetSelection(0);
4043  }
4044  mSelection = Effect::kFactoryPresetIdent + mPresets->GetStringSelection();
4045  }
4046  else if (type.IsSameAs(_("Current Settings")))
4047  {
4048  mPresets->Clear();
4049  mPresets->Enable(false);
4051  }
4052  else if (type.IsSameAs(_("Factory Defaults")))
4053  {
4054  mPresets->Clear();
4055  mPresets->Enable(false);
4057  }
4058 }
wxString label
Definition: Tags.cpp:733
wxListBox * mPresets
Definition: Effect.h:711
wxArrayString mFactoryPresets
Definition: Effect.h:713
static const wxString kUserPresetIdent
Definition: Effect.h:545
wxChoice * mType
Definition: Effect.h:710
wxString mSelection
Definition: Effect.h:715
_("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:714
static const wxString kFactoryPresetIdent
Definition: Effect.h:546
static const wxString kCurrentSettingsIdent
Definition: Effect.h:547
static const wxString kFactoryDefaultsIdent
Definition: Effect.h:548
void EffectPresetsDialog::SetSelected ( const wxString &  parms)

Definition at line 3987 of file Effect.cpp.

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

Referenced by Effect::GetPreset().

3988 {
3989  wxString preset = parms;
3990  if (preset.StartsWith(Effect::kUserPresetIdent))
3991  {
3992  preset.Replace(Effect::kUserPresetIdent, wxEmptyString, false);
3993  SetPrefix(_("User Presets"), preset);
3994  }
3995  else if (preset.StartsWith(Effect::kFactoryPresetIdent))
3996  {
3997  preset.Replace(Effect::kFactoryPresetIdent, wxEmptyString, false);
3998  SetPrefix(_("Factory Presets"), preset);
3999  }
4000  else if (preset.StartsWith(Effect::kCurrentSettingsIdent))
4001  {
4002  SetPrefix(_("Current Settings"), wxEmptyString);
4003  }
4004  else if (preset.StartsWith(Effect::kFactoryDefaultsIdent))
4005  {
4006  SetPrefix(_("Factory Defaults"), wxEmptyString);
4007  }
4008 }
void SetPrefix(const wxString &type, const wxString &prefix)
Definition: Effect.cpp:4010
static const wxString kUserPresetIdent
Definition: Effect.h:545
_("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:546
static const wxString kCurrentSettingsIdent
Definition: Effect.h:547
static const wxString kFactoryDefaultsIdent
Definition: Effect.h:548
void EffectPresetsDialog::UpdateUI ( void  )
private

Definition at line 4060 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().

4061 {
4062  int selected = mType->GetSelection();
4063  if (selected == wxNOT_FOUND)
4064  {
4065  selected = 0;
4066  mType->SetSelection(selected);
4067  }
4068  wxString type = mType->GetString(selected);
4069 
4070  if (type.IsSameAs(_("User Presets")))
4071  {
4072  selected = mPresets->GetSelection();
4073  if (selected == wxNOT_FOUND)
4074  {
4075  selected = 0;
4076  }
4077 
4078  mPresets->Clear();
4079  mPresets->Append(mUserPresets);
4080  mPresets->Enable(true);
4081  mPresets->SetSelection(selected);
4082  mSelection = Effect::kUserPresetIdent + mPresets->GetString(selected);
4083  }
4084  else if (type.IsSameAs(_("Factory Presets")))
4085  {
4086  selected = mPresets->GetSelection();
4087  if (selected == wxNOT_FOUND)
4088  {
4089  selected = 0;
4090  }
4091 
4092  mPresets->Clear();
4093  for (size_t i = 0, cnt = mFactoryPresets.GetCount(); i < cnt; i++)
4094  {
4095  wxString label = mFactoryPresets[i];
4096  if (label.IsEmpty())
4097  {
4098  label = _("None");
4099  }
4100  mPresets->Append(label);
4101  }
4102  mPresets->Enable(true);
4103  mPresets->SetSelection(selected);
4104  mSelection = Effect::kFactoryPresetIdent + mPresets->GetString(selected);
4105  }
4106  else if (type.IsSameAs(_("Current Settings")))
4107  {
4108  mPresets->Clear();
4109  mPresets->Enable(false);
4111  }
4112  else if (type.IsSameAs(_("Factory Defaults")))
4113  {
4114  mPresets->Clear();
4115  mPresets->Enable(false);
4117  }
4118 }
wxString label
Definition: Tags.cpp:733
wxListBox * mPresets
Definition: Effect.h:711
wxArrayString mFactoryPresets
Definition: Effect.h:713
static const wxString kUserPresetIdent
Definition: Effect.h:545
wxChoice * mType
Definition: Effect.h:710
wxString mSelection
Definition: Effect.h:715
_("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:714
static const wxString kFactoryPresetIdent
Definition: Effect.h:546
static const wxString kCurrentSettingsIdent
Definition: Effect.h:547
static const wxString kFactoryDefaultsIdent
Definition: Effect.h:548

Member Data Documentation

wxArrayString EffectPresetsDialog::mFactoryPresets
private

Definition at line 713 of file Effect.h.

Referenced by SetPrefix(), and UpdateUI().

wxListBox* EffectPresetsDialog::mPresets
private

Definition at line 711 of file Effect.h.

Referenced by SetPrefix(), and UpdateUI().

wxString EffectPresetsDialog::mSelection
private

Definition at line 715 of file Effect.h.

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

wxChoice* EffectPresetsDialog::mType
private

Definition at line 710 of file Effect.h.

Referenced by SetPrefix(), and UpdateUI().

wxArrayString EffectPresetsDialog::mUserPresets
private

Definition at line 714 of file Effect.h.

Referenced by SetPrefix(), and UpdateUI().


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