Audacity  2.3.1
Public Member Functions | Private Attributes | List of all members
AudioUnitEffectExportDialog Class Referencefinal
Inheritance diagram for AudioUnitEffectExportDialog:
wxDialogWrapper wxTabTraversalWrapper< wxDialog >

Public Member Functions

 AudioUnitEffectExportDialog (wxWindow *parent, AudioUnitEffect *effect)
 
virtual ~AudioUnitEffectExportDialog ()
 
void PopulateOrExchange (ShuttleGui &S)
 
void OnOk (wxCommandEvent &evt)
 
- 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 Attributes

wxWindow * mParent
 
AudioUnitEffectmEffect
 
wxListCtrl * mList
 

Detailed Description

Definition at line 467 of file AudioUnitEffect.cpp.

Constructor & Destructor Documentation

AudioUnitEffectExportDialog::AudioUnitEffectExportDialog ( wxWindow *  parent,
AudioUnitEffect effect 
)

Definition at line 490 of file AudioUnitEffect.cpp.

References eIsCreating.

491 : wxDialogWrapper(parent, wxID_ANY, wxString(_("Export Audio Unit Presets")))
492 {
493  mEffect = effect;
494 
495  ShuttleGui S(this, eIsCreating);
497 }
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI...
Definition: ShuttleGui.h:409
_("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
void PopulateOrExchange(ShuttleGui &S)
AudioUnitEffectExportDialog::~AudioUnitEffectExportDialog ( )
virtual

Definition at line 499 of file AudioUnitEffect.cpp.

500 {
501 }

Member Function Documentation

void AudioUnitEffectExportDialog::OnOk ( wxCommandEvent &  evt)

Definition at line 549 of file AudioUnitEffect.cpp.

References name, and PRESET_USER_PATH.

550 {
551  // Save active settings
552  wxString settingsName(wxT("Export Save"));
553  mEffect->SaveParameters(settingsName);
554 
555  // Look for selected presets
556  long sel = mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
557  while (sel >= 0)
558  {
559  wxString name = mList->GetItemText(sel);
560 
561  // Make the preset current
563 
564  // Make sure the user preset directory exists
565  wxString path;
566  path.Printf(wxT("%s/%s/%s/%s.aupreset"),
568  mEffect->mVendor,
569  mEffect->mName,
570  name);
571  wxFileName fn(path);
572  fn.Normalize();
573  fn.Mkdir(0755, wxPATH_MKDIR_FULL);
574  path = fn.GetFullPath();
575 
576  // First set the name of the preset
577  wxCFStringRef cfname(name);
578 
579  AUPreset preset;
580  preset.presetNumber = -1; // indicates user preset
581  preset.presetName = cfname;
582 
583  AudioUnitSetProperty(mEffect->mUnit,
584  kAudioUnitProperty_PresentPreset,
585  kAudioUnitScope_Global,
586  0,
587  &preset,
588  sizeof(preset));
589 
590  // Now retrieve the preset content
591  CFPropertyListRef content;
592  UInt32 size = sizeof(content);
593  AudioUnitGetProperty(mEffect->mUnit,
594  kAudioUnitProperty_ClassInfo,
595  kAudioUnitScope_Global,
596  0,
597  &content,
598  &size);
599 
600  // And convert it to XML
602  CFPropertyListCreateXMLData(kCFAllocatorDefault, content)
603  };
604  if (xml)
605  {
606  // Create the CFURL for the path
608  CFURLCreateWithFileSystemPath(kCFAllocatorDefault,
609  wxCFStringRef(path),
610  kCFURLPOSIXPathStyle,
611  false)
612  };
613  if (url)
614  {
615  SInt32 error;
616  Boolean res = CFURLWriteDataAndPropertiesToResource(url.get(),
617  xml.get(),
618  NULL,
619  &error);
620  }
621  }
622 
623  // And continue to the next selected preset
624  sel = mList->GetNextItem(sel, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
625  }
626 
627  // Restore active settings
628  mEffect->LoadParameters(settingsName);
629  mEffect->mHost->RemovePrivateConfigSubgroup(settingsName);
630 
631  EndModal(wxID_OK);
632 }
std::unique_ptr< T, CFReleaser > CFunique_ptr
bool SaveParameters(const wxString &group)
virtual bool RemovePrivateConfigSubgroup(const wxString &group)=0
bool LoadParameters(const wxString &group)
EffectHostInterface * mHost
const wxChar * name
Definition: Distortion.cpp:94
#define PRESET_USER_PATH
virtual wxString GetUserPresetsGroup(const wxString &name)=0
void AudioUnitEffectExportDialog::PopulateOrExchange ( ShuttleGui S)

Definition at line 503 of file AudioUnitEffect.cpp.

References _(), ShuttleGuiBase::AddListControlReportMode(), ShuttleGui::AddStandardButtons(), ShuttleGuiBase::EndHorizontalLay(), ShuttleGuiBase::EndStatic(), ShuttleGuiBase::EndVerticalLay(), ShuttleGuiBase::SetBorder(), ShuttleGuiBase::SetStyle(), ShuttleGuiBase::StartHorizontalLay(), ShuttleGuiBase::StartStatic(), and ShuttleGuiBase::StartVerticalLay().

504 {
505  S.SetBorder(5);
506  S.StartHorizontalLay(wxEXPAND, 1);
507  {
508  S.StartVerticalLay(true);
509  {
510  S.StartStatic(_("Presets (may select multiple)"));
511  {
512  S.SetStyle(wxLC_REPORT | wxLC_HRULES | wxLC_VRULES |
513  wxLC_NO_SORT_HEADER);
515  mList->InsertColumn(0, _("Preset"), wxLIST_FORMAT_LEFT);
516  }
517  S.EndStatic();
518  }
519  S.EndVerticalLay();
520  }
521  S.EndHorizontalLay();
522 
523  S.AddStandardButtons();
524 
525  wxArrayString presets;
526 
528 
529  presets.Sort();
530 
531  for (size_t i = 0, cnt = presets.GetCount(); i < cnt; i++)
532  {
533  mList->InsertItem(i, presets[i]);
534  }
535 
536  mList->SetColumnWidth(0, wxLIST_AUTOSIZE);
537 
538  // Set the list size...with a little extra for good measure
539  wxSize sz = mList->GetBestSize();
540  sz.x += 5;
541  sz.y += 5;
542  mList->SetMinSize(sz);
543 
544  Layout();
545  Fit();
546  Center();
547 }
virtual bool GetPrivateConfigSubgroups(const wxString &group, wxArrayString &subgroups)=0
void EndHorizontalLay()
void EndVerticalLay()
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
wxListCtrl * AddListControlReportMode()
Definition: ShuttleGui.cpp:697
void SetStyle(int Style)
Definition: ShuttleGui.h:287
EffectHostInterface * mHost
_("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
wxStaticBox * StartStatic(const wxString &Str, int iProp=0)
Definition: ShuttleGui.cpp:771
void AddStandardButtons(long buttons=eOkButton|eCancelButton, wxButton *extra=NULL)
void SetBorder(int Border)
Definition: ShuttleGui.h:286
virtual wxString GetUserPresetsGroup(const wxString &name)=0
void StartVerticalLay(int iProp=1)

Member Data Documentation

AudioUnitEffect* AudioUnitEffectExportDialog::mEffect
private

Definition at line 479 of file AudioUnitEffect.cpp.

wxListCtrl* AudioUnitEffectExportDialog::mList
private

Definition at line 481 of file AudioUnitEffect.cpp.

wxWindow* AudioUnitEffectExportDialog::mParent
private

Definition at line 478 of file AudioUnitEffect.cpp.


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