Audacity  3.0.3
Public Member Functions | Private Member Functions | Private Attributes | List of all members
anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog Class Referencefinal
Inheritance diagram for anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog:
[legend]
Collaboration diagram for anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog:
[legend]

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 TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
bool Create (wxWindow *parent, wxWindowID id, const TranslatableString &title, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=wxDEFAULT_DIALOG_STYLE, const TranslatableString &name=XO("Dialog"))
 
void SetTitle (const TranslatableString &title)
 
void SetLabel (const TranslatableString &title)
 
void SetName (const TranslatableString &title)
 
void SetName ()
 
- 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 TranslatableString &type, const wxString &prefix)
 
void UpdateUI ()
 
void OnType (wxCommandEvent &evt)
 
void OnOk (wxCommandEvent &evt)
 
void OnCancel (wxCommandEvent &evt)
 

Private Attributes

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

Detailed Description

Definition at line 360 of file EffectManager.cpp.

Constructor & Destructor Documentation

◆ EffectPresetsDialog()

anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::EffectPresetsDialog ( wxWindow *  parent,
Effect effect 
)

Definition at line 400 of file EffectManager.cpp.

401 : wxDialogWrapper(parent, wxID_ANY, XO("Select Preset"))
402 {
403  ShuttleGui S(this, eIsCreating);
404  S.StartVerticalLay();
405  {
406  S.StartTwoColumn();
407  S.SetStretchyCol(1);
408  {
409  S.AddPrompt(XXO("Type:"));
410  mType = S.Id(ID_Type).AddChoice( {}, {}, 0 );
411 
412  S.AddPrompt(XXO("&Preset:"));
413  mPresets = S
414  .Style( wxLB_SINGLE | wxLB_NEEDED_SB )
415  .AddListBox( {} );
416  }
417  S.EndTwoColumn();
418 
419  S.AddStandardButtons();
420  }
421  S.EndVerticalLay();
422 
423  mUserPresets = effect->GetUserPresets();
425 
426  if (mUserPresets.size() > 0)
427  {
428  mType->Append(_("User Presets"));
429  }
430 
431  if (mFactoryPresets.size() > 0)
432  {
433  mType->Append(_("Factory Presets"));
434  }
435 
436  if (effect->HasCurrentSettings())
437  {
438  mType->Append(_("Current Settings"));
439  }
440 
441  if (effect->HasFactoryDefaults())
442  {
443  mType->Append(_("Factory Defaults"));
444  }
445 
446  UpdateUI();
447 }

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

Here is the call graph for this function:

◆ ~EffectPresetsDialog()

anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::~EffectPresetsDialog ( )
virtual

Definition at line 449 of file EffectManager.cpp.

450 {
451 }

Member Function Documentation

◆ GetSelected()

wxString anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::GetSelected ( ) const

Definition at line 453 of file EffectManager.cpp.

454 {
455  return mSelection;
456 }

◆ OnCancel()

void anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::OnCancel ( wxCommandEvent &  evt)
private

Definition at line 606 of file EffectManager.cpp.

607 {
608  mSelection = wxEmptyString;
609 
610  EndModal(false);
611 }

◆ OnOk()

void anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::OnOk ( wxCommandEvent &  evt)
private

Definition at line 599 of file EffectManager.cpp.

600 {
601  UpdateUI();
602 
603  EndModal(true);
604 }

◆ OnType()

void anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::OnType ( wxCommandEvent &  evt)
private

Definition at line 594 of file EffectManager.cpp.

595 {
596  UpdateUI();
597 }

◆ SetPrefix()

void anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::SetPrefix ( const TranslatableString type,
const wxString &  prefix 
)
private

Definition at line 481 of file EffectManager.cpp.

483 {
484  mType->SetStringSelection(type.Translation());
485 
486  if (type == XO("User Presets"))
487  {
488  mPresets->Clear();
489  for (const auto &preset : mUserPresets)
490  mPresets->Append(preset);
491  mPresets->Enable(true);
492  mPresets->SetStringSelection(prefix);
493  if (mPresets->GetSelection() == wxNOT_FOUND)
494  {
495  mPresets->SetSelection(0);
496  }
497  mSelection = Effect::kUserPresetIdent + mPresets->GetStringSelection();
498  }
499  else if (type == XO("Factory Presets"))
500  {
501  mPresets->Clear();
502  for (size_t i = 0, cnt = mFactoryPresets.size(); i < cnt; i++)
503  {
504  auto label = mFactoryPresets[i];
505  if (label.empty())
506  {
507  label = _("None");
508  }
509  mPresets->Append(label);
510  }
511  mPresets->Enable(true);
512  mPresets->SetStringSelection(prefix);
513  if (mPresets->GetSelection() == wxNOT_FOUND)
514  {
515  mPresets->SetSelection(0);
516  }
517  mSelection = Effect::kFactoryPresetIdent + mPresets->GetStringSelection();
518  }
519  else if (type == XO("Current Settings"))
520  {
521  mPresets->Clear();
522  mPresets->Enable(false);
524  }
525  else if (type == XO("Factory Defaults"))
526  {
527  mPresets->Clear();
528  mPresets->Enable(false);
530  }
531 }

References _, TranslatableString::empty(), Effect::kCurrentSettingsIdent, Effect::kFactoryDefaultsIdent, Effect::kFactoryPresetIdent, Effect::kUserPresetIdent, label, TranslatableString::Translation(), and XO.

Here is the call graph for this function:

◆ SetSelected()

void anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::SetSelected ( const wxString &  parms)

Definition at line 458 of file EffectManager.cpp.

459 {
460  wxString preset = parms;
461  if (preset.StartsWith(Effect::kUserPresetIdent))
462  {
463  preset.Replace(Effect::kUserPresetIdent, wxEmptyString, false);
464  SetPrefix(XO("User Presets"), preset);
465  }
466  else if (preset.StartsWith(Effect::kFactoryPresetIdent))
467  {
468  preset.Replace(Effect::kFactoryPresetIdent, wxEmptyString, false);
469  SetPrefix(XO("Factory Presets"), preset);
470  }
471  else if (preset.StartsWith(Effect::kCurrentSettingsIdent))
472  {
473  SetPrefix(XO("Current Settings"), wxEmptyString);
474  }
475  else if (preset.StartsWith(Effect::kFactoryDefaultsIdent))
476  {
477  SetPrefix(XO("Factory Defaults"), wxEmptyString);
478  }
479 }

References Effect::kCurrentSettingsIdent, Effect::kFactoryDefaultsIdent, Effect::kFactoryPresetIdent, Effect::kUserPresetIdent, and XO.

◆ UpdateUI()

void anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::UpdateUI ( void  )
private

Definition at line 533 of file EffectManager.cpp.

534 {
535  int selected = mType->GetSelection();
536  if (selected == wxNOT_FOUND)
537  {
538  selected = 0;
539  mType->SetSelection(selected);
540  }
541  wxString type = mType->GetString(selected);
542 
543  if (type == _("User Presets"))
544  {
545  selected = mPresets->GetSelection();
546  if (selected == wxNOT_FOUND)
547  {
548  selected = 0;
549  }
550 
551  mPresets->Clear();
552  for (const auto &preset : mUserPresets)
553  mPresets->Append(preset);
554  mPresets->Enable(true);
555  mPresets->SetSelection(selected);
556  mSelection = Effect::kUserPresetIdent + mPresets->GetString(selected);
557  }
558  else if (type == _("Factory Presets"))
559  {
560  selected = mPresets->GetSelection();
561  if (selected == wxNOT_FOUND)
562  {
563  selected = 0;
564  }
565 
566  mPresets->Clear();
567  for (size_t i = 0, cnt = mFactoryPresets.size(); i < cnt; i++)
568  {
569  auto label = mFactoryPresets[i];
570  if (label.empty())
571  {
572  label = _("None");
573  }
574  mPresets->Append(label);
575  }
576  mPresets->Enable(true);
577  mPresets->SetSelection(selected);
578  mSelection = Effect::kFactoryPresetIdent + mPresets->GetString(selected);
579  }
580  else if (type == _("Current Settings"))
581  {
582  mPresets->Clear();
583  mPresets->Enable(false);
585  }
586  else if (type == _("Factory Defaults"))
587  {
588  mPresets->Clear();
589  mPresets->Enable(false);
591  }
592 }

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

Here is the call graph for this function:

Member Data Documentation

◆ mFactoryPresets

RegistryPaths anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::mFactoryPresets
private

Definition at line 381 of file EffectManager.cpp.

◆ mPresets

wxListBox* anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::mPresets
private

Definition at line 379 of file EffectManager.cpp.

◆ mSelection

wxString anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::mSelection
private

Definition at line 383 of file EffectManager.cpp.

◆ mType

wxChoice* anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::mType
private

Definition at line 378 of file EffectManager.cpp.

◆ mUserPresets

RegistryPaths anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::mUserPresets
private

Definition at line 382 of file EffectManager.cpp.


The documentation for this class was generated from the following file:
anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::mFactoryPresets
RegistryPaths mFactoryPresets
Definition: EffectManager.cpp:381
anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::mPresets
wxListBox * mPresets
Definition: EffectManager.cpp:379
eIsCreating
@ eIsCreating
Definition: ShuttleGui.h:38
TranslatableString::empty
bool empty() const
Definition: TranslatableString.h:72
Effect::HasFactoryDefaults
virtual bool HasFactoryDefaults()
Definition: Effect.cpp:1167
Effect::GetUserPresets
virtual RegistryPaths GetUserPresets()
Definition: Effect.cpp:1151
anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::mType
wxChoice * mType
Definition: EffectManager.cpp:378
anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::mUserPresets
RegistryPaths mUserPresets
Definition: EffectManager.cpp:382
anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::UpdateUI
void UpdateUI()
Definition: EffectManager.cpp:533
anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::SetPrefix
void SetPrefix(const TranslatableString &type, const wxString &prefix)
Definition: EffectManager.cpp:481
XO
#define XO(s)
Definition: Internat.h:31
XXO
#define XXO(s)
Definition: Internat.h:44
label
TranslatableString label
Definition: Tags.cpp:756
Effect::GetFactoryPresets
RegistryPaths GetFactoryPresets() override
Definition: Effect.cpp:586
anonymous_namespace{EffectManager.cpp}::ID_Type
@ ID_Type
Definition: EffectManager.cpp:390
anonymous_namespace{EffectManager.cpp}::EffectPresetsDialog::mSelection
wxString mSelection
Definition: EffectManager.cpp:383
Effect::kCurrentSettingsIdent
static const wxString kCurrentSettingsIdent
Definition: Effect.h:539
Effect::kUserPresetIdent
static const wxString kUserPresetIdent
Definition: Effect.h:537
_
#define _(s)
Definition: Internat.h:75
Effect::HasCurrentSettings
virtual bool HasCurrentSettings()
Definition: Effect.cpp:1162
wxDialogWrapper::wxDialogWrapper
wxDialogWrapper()
Definition: wxPanelWrapper.h:84
TranslatableString::Translation
wxString Translation() const
Definition: TranslatableString.h:79
Effect::kFactoryDefaultsIdent
static const wxString kFactoryDefaultsIdent
Definition: Effect.h:540
Effect::kFactoryPresetIdent
static const wxString kFactoryPresetIdent
Definition: Effect.h:538
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631