Audacity 3.2.0
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, EffectPlugin *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 420 of file EffectManager.cpp.

Constructor & Destructor Documentation

◆ EffectPresetsDialog()

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

Definition at line 460 of file EffectManager.cpp.

462: wxDialogWrapper(parent, wxID_ANY, XO("Select Preset"))
463{
464 ShuttleGui S(this, eIsCreating);
465 S.StartVerticalLay();
466 {
467 S.StartTwoColumn();
468 S.SetStretchyCol(1);
469 {
470 S.AddPrompt(XXO("Type:"));
471 mType = S.Id(ID_Type).AddChoice( {}, {}, 0 );
472
473 S.AddPrompt(XXO("&Preset:"));
474 mPresets = S
475 .Style( wxLB_SINGLE | wxLB_NEEDED_SB )
476 .AddListBox( {} );
477 }
478 S.EndTwoColumn();
479
480 S.AddStandardButtons();
481 }
482 S.EndVerticalLay();
483
484 mUserPresets = GetUserPresets(*effect);
486
487 if (mUserPresets.size() > 0)
488 {
489 mType->Append(_("User Presets"));
490 }
491
492 if (mFactoryPresets.size() > 0)
493 {
494 mType->Append(_("Factory Presets"));
495 }
496
497 if (HasCurrentSettings(*effect))
498 {
499 mType->Append(_("Current Settings"));
500 }
501
502 if (HasFactoryDefaults(*effect))
503 {
504 mType->Append(_("Factory Defaults"));
505 }
506
507 UpdateUI();
508}
static bool HasFactoryDefaults(EffectPlugin &host)
static bool HasCurrentSettings(EffectPlugin &host)
static RegistryPaths GetUserPresets(EffectPlugin &host)
XO("Cut/Copy/Paste")
XXO("&Cut/Copy/Paste Toolbar")
#define _(s)
Definition: Internat.h:73
@ eIsCreating
Definition: ShuttleGui.h:37
#define S(N)
Definition: ToChars.cpp:64
virtual const EffectSettingsManager & GetDefinition() const =0
virtual RegistryPaths GetFactoryPresets() const =0
Report names of factory presets.
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:630

References _, eIsCreating, GetUserPresets(), HasCurrentSettings(), HasFactoryDefaults(), ID_Type, S, and XXO().

Here is the call graph for this function:

◆ ~EffectPresetsDialog()

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

Definition at line 510 of file EffectManager.cpp.

511{
512}

Member Function Documentation

◆ GetSelected()

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

Definition at line 514 of file EffectManager.cpp.

◆ OnCancel()

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

Definition at line 671 of file EffectManager.cpp.

672{
673 mSelection = wxEmptyString;
674
675 EndModal(false);
676}

◆ OnOk()

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

Definition at line 664 of file EffectManager.cpp.

665{
666 UpdateUI();
667
668 EndModal(true);
669}

◆ OnType()

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

Definition at line 659 of file EffectManager.cpp.

660{
661 UpdateUI();
662}

◆ SetPrefix()

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

Definition at line 542 of file EffectManager.cpp.

544{
545 mType->SetStringSelection(type.Translation());
546
547 if (type == XO("User Presets"))
548 {
549 mPresets->Clear();
550 for (const auto &preset : mUserPresets)
551 mPresets->Append(preset);
552 mPresets->Enable(true);
553 mPresets->SetStringSelection(prefix);
554 if (mPresets->GetSelection() == wxNOT_FOUND)
555 {
556 mPresets->SetSelection(0);
557 }
559 + mPresets->GetStringSelection();
560 }
561 else if (type == XO("Factory Presets"))
562 {
563 mPresets->Clear();
564 for (size_t i = 0, cnt = mFactoryPresets.size(); i < cnt; i++)
565 {
566 auto label = mFactoryPresets[i];
567 if (label.empty())
568 {
569 label = _("None");
570 }
571 mPresets->Append(label);
572 }
573 mPresets->Enable(true);
574 mPresets->SetStringSelection(prefix);
575 if (mPresets->GetSelection() == wxNOT_FOUND)
576 {
577 mPresets->SetSelection(0);
578 }
580 + mPresets->GetStringSelection();
581 }
582 else if (type == XO("Current Settings"))
583 {
584 mPresets->Clear();
585 mPresets->Enable(false);
587 }
588 else if (type == XO("Factory Defaults"))
589 {
590 mPresets->Clear();
591 mPresets->Enable(false);
593 }
594}
EffectReverbSettings preset
Definition: Reverb.cpp:44
TranslatableString label
Definition: TagsEditor.cpp:165
static const wxString kUserPresetIdent
Definition: EffectPlugin.h:40
static const wxString kFactoryPresetIdent
Definition: EffectPlugin.h:41
static const wxString kCurrentSettingsIdent
Definition: EffectPlugin.h:42
static const wxString kFactoryDefaultsIdent
Definition: EffectPlugin.h:43
wxString Translation() const

References _, TranslatableString::empty(), EffectPlugin::kCurrentSettingsIdent, EffectPlugin::kFactoryDefaultsIdent, EffectPlugin::kFactoryPresetIdent, EffectPlugin::kUserPresetIdent, label, preset, 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 519 of file EffectManager.cpp.

520{
521 wxString preset = parms;
523 {
524 preset.Replace(EffectPlugin::kUserPresetIdent, wxEmptyString, false);
525 SetPrefix(XO("User Presets"), preset);
526 }
527 else if (preset.StartsWith(EffectPlugin::kFactoryPresetIdent))
528 {
529 preset.Replace(EffectPlugin::kFactoryPresetIdent, wxEmptyString, false);
530 SetPrefix(XO("Factory Presets"), preset);
531 }
532 else if (preset.StartsWith(EffectPlugin::kCurrentSettingsIdent))
533 {
534 SetPrefix(XO("Current Settings"), wxEmptyString);
535 }
536 else if (preset.StartsWith(EffectPlugin::kFactoryDefaultsIdent))
537 {
538 SetPrefix(XO("Factory Defaults"), wxEmptyString);
539 }
540}
void SetPrefix(const TranslatableString &type, const wxString &prefix)

References EffectPlugin::kCurrentSettingsIdent, EffectPlugin::kFactoryDefaultsIdent, EffectPlugin::kFactoryPresetIdent, EffectPlugin::kUserPresetIdent, preset, and XO().

Here is the call graph for this function:

◆ UpdateUI()

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

Definition at line 596 of file EffectManager.cpp.

597{
598 int selected = mType->GetSelection();
599 if (selected == wxNOT_FOUND)
600 {
601 selected = 0;
602 mType->SetSelection(selected);
603 }
604 wxString type = mType->GetString(selected);
605
606 if (type == _("User Presets"))
607 {
608 selected = mPresets->GetSelection();
609 if (selected == wxNOT_FOUND)
610 {
611 selected = 0;
612 }
613
614 mPresets->Clear();
615 for (const auto &preset : mUserPresets)
616 mPresets->Append(preset);
617 mPresets->Enable(true);
618 mPresets->SetSelection(selected);
620 + mPresets->GetString(selected);
621 }
622 else if (type == _("Factory Presets"))
623 {
624 selected = mPresets->GetSelection();
625 if (selected == wxNOT_FOUND)
626 {
627 selected = 0;
628 }
629
630 mPresets->Clear();
631 for (size_t i = 0, cnt = mFactoryPresets.size(); i < cnt; i++)
632 {
633 auto label = mFactoryPresets[i];
634 if (label.empty())
635 {
636 label = _("None");
637 }
638 mPresets->Append(label);
639 }
640 mPresets->Enable(true);
641 mPresets->SetSelection(selected);
643 + mPresets->GetString(selected);
644 }
645 else if (type == _("Current Settings"))
646 {
647 mPresets->Clear();
648 mPresets->Enable(false);
650 }
651 else if (type == _("Factory Defaults"))
652 {
653 mPresets->Clear();
654 mPresets->Enable(false);
656 }
657}

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

Here is the call graph for this function:

Member Data Documentation

◆ mFactoryPresets

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

Definition at line 441 of file EffectManager.cpp.

◆ mPresets

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

Definition at line 439 of file EffectManager.cpp.

◆ mSelection

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

Definition at line 443 of file EffectManager.cpp.

◆ mType

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

Definition at line 438 of file EffectManager.cpp.

◆ mUserPresets

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

Definition at line 442 of file EffectManager.cpp.


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