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 419 of file EffectManager.cpp.

Constructor & Destructor Documentation

◆ EffectPresetsDialog()

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

Definition at line 459 of file EffectManager.cpp.

461: wxDialogWrapper(parent, wxID_ANY, XO("Select Preset"))
462{
463 ShuttleGui S(this, eIsCreating);
464 S.StartVerticalLay();
465 {
466 S.StartTwoColumn();
467 S.SetStretchyCol(1);
468 {
469 S.AddPrompt(XXO("Type:"));
470 mType = S.Id(ID_Type).AddChoice( {}, {}, 0 );
471
472 S.AddPrompt(XXO("&Preset:"));
473 mPresets = S
474 .Style( wxLB_SINGLE | wxLB_NEEDED_SB )
475 .AddListBox( {} );
476 }
477 S.EndTwoColumn();
478
479 S.AddStandardButtons();
480 }
481 S.EndVerticalLay();
482
483 mUserPresets = GetUserPresets(*effect);
485
486 if (mUserPresets.size() > 0)
487 {
488 mType->Append(_("User Presets"));
489 }
490
491 if (mFactoryPresets.size() > 0)
492 {
493 mType->Append(_("Factory Presets"));
494 }
495
496 if (HasCurrentSettings(*effect))
497 {
498 mType->Append(_("Current Settings"));
499 }
500
501 if (HasFactoryDefaults(*effect))
502 {
503 mType->Append(_("Factory Defaults"));
504 }
505
506 UpdateUI();
507}
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:75
@ eIsCreating
Definition: ShuttleGui.h:39
#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:628

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 509 of file EffectManager.cpp.

510{
511}

Member Function Documentation

◆ GetSelected()

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

Definition at line 513 of file EffectManager.cpp.

◆ OnCancel()

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

Definition at line 670 of file EffectManager.cpp.

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

◆ OnOk()

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

Definition at line 663 of file EffectManager.cpp.

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

◆ OnType()

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

Definition at line 658 of file EffectManager.cpp.

659{
660 UpdateUI();
661}

◆ SetPrefix()

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

Definition at line 541 of file EffectManager.cpp.

543{
544 mType->SetStringSelection(type.Translation());
545
546 if (type == XO("User Presets"))
547 {
548 mPresets->Clear();
549 for (const auto &preset : mUserPresets)
550 mPresets->Append(preset);
551 mPresets->Enable(true);
552 mPresets->SetStringSelection(prefix);
553 if (mPresets->GetSelection() == wxNOT_FOUND)
554 {
555 mPresets->SetSelection(0);
556 }
558 + mPresets->GetStringSelection();
559 }
560 else if (type == XO("Factory Presets"))
561 {
562 mPresets->Clear();
563 for (size_t i = 0, cnt = mFactoryPresets.size(); i < cnt; i++)
564 {
565 auto label = mFactoryPresets[i];
566 if (label.empty())
567 {
568 label = _("None");
569 }
570 mPresets->Append(label);
571 }
572 mPresets->Enable(true);
573 mPresets->SetStringSelection(prefix);
574 if (mPresets->GetSelection() == wxNOT_FOUND)
575 {
576 mPresets->SetSelection(0);
577 }
579 + mPresets->GetStringSelection();
580 }
581 else if (type == XO("Current Settings"))
582 {
583 mPresets->Clear();
584 mPresets->Enable(false);
586 }
587 else if (type == XO("Factory Defaults"))
588 {
589 mPresets->Clear();
590 mPresets->Enable(false);
592 }
593}
EffectReverbSettings preset
Definition: Reverb.cpp:45
TranslatableString label
Definition: TagsEditor.cpp:164
static const wxString kUserPresetIdent
Definition: EffectPlugin.h:59
static const wxString kFactoryPresetIdent
Definition: EffectPlugin.h:60
static const wxString kCurrentSettingsIdent
Definition: EffectPlugin.h:61
static const wxString kFactoryDefaultsIdent
Definition: EffectPlugin.h:62
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 518 of file EffectManager.cpp.

519{
520 wxString preset = parms;
522 {
523 preset.Replace(EffectPlugin::kUserPresetIdent, wxEmptyString, false);
524 SetPrefix(XO("User Presets"), preset);
525 }
526 else if (preset.StartsWith(EffectPlugin::kFactoryPresetIdent))
527 {
528 preset.Replace(EffectPlugin::kFactoryPresetIdent, wxEmptyString, false);
529 SetPrefix(XO("Factory Presets"), preset);
530 }
531 else if (preset.StartsWith(EffectPlugin::kCurrentSettingsIdent))
532 {
533 SetPrefix(XO("Current Settings"), wxEmptyString);
534 }
535 else if (preset.StartsWith(EffectPlugin::kFactoryDefaultsIdent))
536 {
537 SetPrefix(XO("Factory Defaults"), wxEmptyString);
538 }
539}
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 595 of file EffectManager.cpp.

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

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 440 of file EffectManager.cpp.

◆ mPresets

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

Definition at line 438 of file EffectManager.cpp.

◆ mSelection

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

Definition at line 442 of file EffectManager.cpp.

◆ mType

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

Definition at line 437 of file EffectManager.cpp.

◆ mUserPresets

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

Definition at line 441 of file EffectManager.cpp.


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