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 ()
 

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

Constructor & Destructor Documentation

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

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

3883 : wxDialogWrapper(parent, wxID_ANY, wxString(_("Select Preset")))
3884 {
3885  ShuttleGui S(this, eIsCreating);
3886  S.StartVerticalLay();
3887  {
3888  S.StartTwoColumn();
3889  S.SetStretchyCol(1);
3890  {
3891  wxArrayString empty;
3892 
3893  S.AddPrompt(_("Type:"));
3894  mType = S.Id(ID_Type).AddChoice( {}, wxT(""), &empty);
3895  mType->SetSelection(0);
3896 
3897  S.AddPrompt(_("&Preset:"));
3898  mPresets = S.AddListBox(&empty, wxLB_SINGLE | wxLB_NEEDED_SB );
3899  }
3900  S.EndTwoColumn();
3901 
3902  S.AddStandardButtons();
3903  }
3904  S.EndVerticalLay();
3905 
3906  mUserPresets = effect->GetUserPresets();
3907  mFactoryPresets = effect->GetFactoryPresets();
3908 
3909  if (mUserPresets.GetCount() > 0)
3910  {
3911  mType->Append(_("User Presets"));
3912  }
3913 
3914  if (mFactoryPresets.GetCount() > 0)
3915  {
3916  mType->Append(_("Factory Presets"));
3917  }
3918 
3919  if (effect->HasCurrentSettings())
3920  {
3921  mType->Append(_("Current Settings"));
3922  }
3923 
3924  if (effect->HasFactoryDefaults())
3925  {
3926  mType->Append(_("Factory Defaults"));
3927  }
3928 
3929  UpdateUI();
3930 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:366
wxListBox * mPresets
Definition: Effect.h:702
virtual bool HasCurrentSettings()
Definition: Effect.cpp:1095
wxArrayString mFactoryPresets
Definition: Effect.h:704
virtual bool HasFactoryDefaults()
Definition: Effect.cpp:1100
wxArrayString GetFactoryPresets() override
Definition: Effect.cpp:631
wxChoice * mType
Definition: Effect.h:701
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
wxArrayString mUserPresets
Definition: Effect.h:705
virtual wxArrayString GetUserPresets()
Definition: Effect.cpp:1084
EffectPresetsDialog::~EffectPresetsDialog ( )
virtual

Definition at line 3932 of file Effect.cpp.

3933 {
3934 }

Member Function Documentation

wxString EffectPresetsDialog::GetSelected ( ) const

Definition at line 3936 of file Effect.cpp.

Referenced by Effect::GetPreset().

3937 {
3938  return mSelection;
3939 }
wxString mSelection
Definition: Effect.h:706
void EffectPresetsDialog::OnCancel ( wxCommandEvent &  evt)
private

Definition at line 4086 of file Effect.cpp.

4087 {
4088  mSelection = wxEmptyString;
4089 
4090  EndModal(false);
4091 }
wxString mSelection
Definition: Effect.h:706
void EffectPresetsDialog::OnOk ( wxCommandEvent &  evt)
private

Definition at line 4079 of file Effect.cpp.

4080 {
4081  UpdateUI();
4082 
4083  EndModal(true);
4084 }
void EffectPresetsDialog::OnType ( wxCommandEvent &  evt)
private

Definition at line 4074 of file Effect.cpp.

4075 {
4076  UpdateUI();
4077 }
void EffectPresetsDialog::SetPrefix ( const wxString &  type,
const wxString &  prefix 
)
private

Definition at line 3964 of file Effect.cpp.

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

3965 {
3966  mType->SetStringSelection(type);
3967 
3968  if (type.IsSameAs(_("User Presets")))
3969  {
3970  mPresets->Clear();
3971  mPresets->Append(mUserPresets);
3972  mPresets->Enable(true);
3973  mPresets->SetStringSelection(prefix);
3974  if (mPresets->GetSelection() == wxNOT_FOUND)
3975  {
3976  mPresets->SetSelection(0);
3977  }
3978  mSelection = Effect::kUserPresetIdent + mPresets->GetStringSelection();
3979  }
3980  else if (type.IsSameAs(_("Factory Presets")))
3981  {
3982  mPresets->Clear();
3983  for (size_t i = 0, cnt = mFactoryPresets.GetCount(); i < cnt; i++)
3984  {
3985  wxString label = mFactoryPresets[i];
3986  if (label.IsEmpty())
3987  {
3988  label = _("None");
3989  }
3990  mPresets->Append(label);
3991  }
3992  mPresets->Enable(true);
3993  mPresets->SetStringSelection(prefix);
3994  if (mPresets->GetSelection() == wxNOT_FOUND)
3995  {
3996  mPresets->SetSelection(0);
3997  }
3998  mSelection = Effect::kFactoryPresetIdent + mPresets->GetStringSelection();
3999  }
4000  else if (type.IsSameAs(_("Current Settings")))
4001  {
4002  mPresets->Clear();
4003  mPresets->Enable(false);
4005  }
4006  else if (type.IsSameAs(_("Factory Defaults")))
4007  {
4008  mPresets->Clear();
4009  mPresets->Enable(false);
4011  }
4012 }
wxString label
Definition: Tags.cpp:727
wxListBox * mPresets
Definition: Effect.h:702
wxArrayString mFactoryPresets
Definition: Effect.h:704
static const wxString kUserPresetIdent
Definition: Effect.h:540
wxChoice * mType
Definition: Effect.h:701
wxString mSelection
Definition: Effect.h:706
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
wxArrayString mUserPresets
Definition: Effect.h:705
static const wxString kFactoryPresetIdent
Definition: Effect.h:541
static const wxString kCurrentSettingsIdent
Definition: Effect.h:542
static const wxString kFactoryDefaultsIdent
Definition: Effect.h:543
void EffectPresetsDialog::SetSelected ( const wxString &  parms)

Definition at line 3941 of file Effect.cpp.

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

Referenced by Effect::GetPreset().

3942 {
3943  wxString preset = parms;
3944  if (preset.StartsWith(Effect::kUserPresetIdent))
3945  {
3946  preset.Replace(Effect::kUserPresetIdent, wxEmptyString, false);
3947  SetPrefix(_("User Presets"), preset);
3948  }
3949  else if (preset.StartsWith(Effect::kFactoryPresetIdent))
3950  {
3951  preset.Replace(Effect::kFactoryPresetIdent, wxEmptyString, false);
3952  SetPrefix(_("Factory Presets"), preset);
3953  }
3954  else if (preset.StartsWith(Effect::kCurrentSettingsIdent))
3955  {
3956  SetPrefix(_("Current Settings"), wxEmptyString);
3957  }
3958  else if (preset.StartsWith(Effect::kFactoryDefaultsIdent))
3959  {
3960  SetPrefix(_("Factory Defaults"), wxEmptyString);
3961  }
3962 }
void SetPrefix(const wxString &type, const wxString &prefix)
Definition: Effect.cpp:3964
static const wxString kUserPresetIdent
Definition: Effect.h:540
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
static const wxString kFactoryPresetIdent
Definition: Effect.h:541
static const wxString kCurrentSettingsIdent
Definition: Effect.h:542
static const wxString kFactoryDefaultsIdent
Definition: Effect.h:543
void EffectPresetsDialog::UpdateUI ( void  )
private

Definition at line 4014 of file Effect.cpp.

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

4015 {
4016  int selected = mType->GetSelection();
4017  if (selected == wxNOT_FOUND)
4018  {
4019  selected = 0;
4020  mType->SetSelection(selected);
4021  }
4022  wxString type = mType->GetString(selected);
4023 
4024  if (type.IsSameAs(_("User Presets")))
4025  {
4026  selected = mPresets->GetSelection();
4027  if (selected == wxNOT_FOUND)
4028  {
4029  selected = 0;
4030  }
4031 
4032  mPresets->Clear();
4033  mPresets->Append(mUserPresets);
4034  mPresets->Enable(true);
4035  mPresets->SetSelection(selected);
4036  mSelection = Effect::kUserPresetIdent + mPresets->GetString(selected);
4037  }
4038  else if (type.IsSameAs(_("Factory Presets")))
4039  {
4040  selected = mPresets->GetSelection();
4041  if (selected == wxNOT_FOUND)
4042  {
4043  selected = 0;
4044  }
4045 
4046  mPresets->Clear();
4047  for (size_t i = 0, cnt = mFactoryPresets.GetCount(); i < cnt; i++)
4048  {
4049  wxString label = mFactoryPresets[i];
4050  if (label.IsEmpty())
4051  {
4052  label = _("None");
4053  }
4054  mPresets->Append(label);
4055  }
4056  mPresets->Enable(true);
4057  mPresets->SetSelection(selected);
4058  mSelection = Effect::kFactoryPresetIdent + mPresets->GetString(selected);
4059  }
4060  else if (type.IsSameAs(_("Current Settings")))
4061  {
4062  mPresets->Clear();
4063  mPresets->Enable(false);
4065  }
4066  else if (type.IsSameAs(_("Factory Defaults")))
4067  {
4068  mPresets->Clear();
4069  mPresets->Enable(false);
4071  }
4072 }
wxString label
Definition: Tags.cpp:727
wxListBox * mPresets
Definition: Effect.h:702
wxArrayString mFactoryPresets
Definition: Effect.h:704
static const wxString kUserPresetIdent
Definition: Effect.h:540
wxChoice * mType
Definition: Effect.h:701
wxString mSelection
Definition: Effect.h:706
_("Move Track &Down")+wxT("\t")+(GetActiveProject() -> GetCommandManager() ->GetKeyFromName(wxT("TrackMoveDown"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveTopID, _("Move Track to &Top")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveTop"))), OnMoveTrack) POPUP_MENU_ITEM(OnMoveBottomID, _("Move Track to &Bottom")+wxT("\t")+(GetActiveProject() ->GetCommandManager() ->GetKeyFromName(wxT("TrackMoveBottom"))), OnMoveTrack) void TrackMenuTable::OnSetName(wxCommandEvent &)
wxArrayString mUserPresets
Definition: Effect.h:705
static const wxString kFactoryPresetIdent
Definition: Effect.h:541
static const wxString kCurrentSettingsIdent
Definition: Effect.h:542
static const wxString kFactoryDefaultsIdent
Definition: Effect.h:543

Member Data Documentation

wxArrayString EffectPresetsDialog::mFactoryPresets
private

Definition at line 704 of file Effect.h.

wxListBox* EffectPresetsDialog::mPresets
private

Definition at line 702 of file Effect.h.

wxString EffectPresetsDialog::mSelection
private

Definition at line 706 of file Effect.h.

wxChoice* EffectPresetsDialog::mType
private

Definition at line 701 of file Effect.h.

wxArrayString EffectPresetsDialog::mUserPresets
private

Definition at line 705 of file Effect.h.


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