Audacity  3.0.3
Public Member Functions | Private Types | Private Member Functions | Private Attributes | List of all members
EditCurvesDialog Class Referencefinal

#include <Equalization.h>

Inheritance diagram for EditCurvesDialog:
[legend]
Collaboration diagram for EditCurvesDialog:
[legend]

Public Member Functions

 EditCurvesDialog (wxWindow *parent, EffectEqualization *effect, int position)
 
 ~EditCurvesDialog ()
 
- 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 Types

enum  EQCurvesDialogControls {
  CurvesListID = 11000, UpButtonID, DownButtonID, RenameButtonID,
  DeleteButtonID, ImportButtonID, ExportButtonID, LibraryButtonID,
  DefaultsButtonID
}
 

Private Member Functions

void Populate ()
 Creates the dialog and its contents. More...
 
void PopulateOrExchange (ShuttleGui &S)
 Defines the dialog and does data exchange with it. More...
 
void PopulateList (int position)
 
void OnUp (wxCommandEvent &event)
 
void OnDown (wxCommandEvent &event)
 
long GetPreviousItem (long item)
 
void OnRename (wxCommandEvent &event)
 
void OnDelete (wxCommandEvent &event)
 
void OnImport (wxCommandEvent &event)
 
void OnExport (wxCommandEvent &event)
 
void OnLibrary (wxCommandEvent &event)
 
void OnDefaults (wxCommandEvent &event)
 
void OnOK (wxCommandEvent &event)
 
void OnListSelectionChange (wxListEvent &event)
 

Private Attributes

wxListCtrl * mList
 
EQCurveArray mEditCurves
 
wxWindow * mParent
 
EffectEqualizationmEffect
 
int mPosition
 

Detailed Description

Definition at line 352 of file Equalization.h.

Member Enumeration Documentation

◆ EQCurvesDialogControls

Enumerator
CurvesListID 
UpButtonID 
DownButtonID 
RenameButtonID 
DeleteButtonID 
ImportButtonID 
ExportButtonID 
LibraryButtonID 
DefaultsButtonID 

Definition at line 360 of file Equalization.h.

361  {
362  CurvesListID = 11000,
363  UpButtonID,
364  DownButtonID,
371  };

Constructor & Destructor Documentation

◆ EditCurvesDialog()

EditCurvesDialog::OnListSelectionChange EditCurvesDialog::EditCurvesDialog ( wxWindow *  parent,
EffectEqualization effect,
int  position 
)

Definition at line 3359 of file Equalization.cpp.

3359  :
3360 wxDialogWrapper(parent, wxID_ANY, XO("Manage Curves List"),
3361  wxDefaultPosition, wxDefaultSize,
3362  wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
3363 {
3364  SetLabel(XO("Manage Curves")); // Provide visual label
3365  SetName(XO("Manage Curves List")); // Provide audible label
3366  mParent = parent;
3367  mEffect = effect;
3368  mPosition = position;
3369  // make a copy of mEffect->mCurves here to muck about with.
3370  mEditCurves.clear();
3371  for (unsigned int i = 0; i < mEffect->mCurves.size(); i++)
3372  {
3373  mEditCurves.push_back(mEffect->mCurves[i].Name);
3374  mEditCurves[i].points = mEffect->mCurves[i].points;
3375  }
3376 
3377  Populate();
3378  SetMinSize(GetSize());
3379 }

References XO.

◆ ~EditCurvesDialog()

EditCurvesDialog::~EditCurvesDialog ( )

Definition at line 3381 of file Equalization.cpp.

3382 {
3383 }

Member Function Documentation

◆ GetPreviousItem()

long EditCurvesDialog::GetPreviousItem ( long  item)
private

Definition at line 3516 of file Equalization.cpp.

3517 {
3518  long lastItem = -1;
3519  long itemTemp = mList->GetNextItem(-1, wxLIST_NEXT_ALL,
3520  wxLIST_STATE_SELECTED);
3521  while( (itemTemp != -1) && (itemTemp < item) )
3522  {
3523  lastItem = itemTemp;
3524  itemTemp = mList->GetNextItem(itemTemp, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3525  }
3526  return lastItem;
3527 }

References mList.

Referenced by OnDown().

Here is the caller graph for this function:

◆ OnDefaults()

void EditCurvesDialog::OnDefaults ( wxCommandEvent &  event)
private

Definition at line 3826 of file Equalization.cpp.

3827 {
3828  EQCurveArray temp;
3829  temp = mEffect->mCurves;
3830  // we expect this to fail in LoadCurves (due to a lack of path) and handle that there
3831  mEffect->LoadCurves( wxT("EQDefaultCurves.xml") );
3833  mEffect->mCurves = temp;
3834  PopulateList(0); // update the EditCurvesDialog dialog
3835 }

References EffectEqualization::LoadCurves(), EffectEqualization::mCurves, mEditCurves, mEffect, and PopulateList().

Here is the call graph for this function:

◆ OnDelete()

void EditCurvesDialog::OnDelete ( wxCommandEvent &  event)
private

Definition at line 3646 of file Equalization.cpp.

3647 {
3648  // We could count them here
3649  // And then put in a 'Delete N items?' prompt.
3650 
3651 #if 0 // 'one at a time' prompt code
3652  // Get the first one to be deleted
3653  long item = mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3654  // Take care, mList and mEditCurves will get out of sync as curves are deleted
3655  int deleted = 0;
3656  long highlight = -1;
3657 
3658  while(item >= 0)
3659  {
3660  if(item == mList->GetItemCount()-1) //unnamed
3661  {
3662  mEffect->Effect::MessageBox(
3663  XO("You cannot delete the 'unnamed' curve."),
3664  wxOK | wxCENTRE,
3665  XO("Can't delete 'unnamed'") );
3666  }
3667  else
3668  {
3669  // Create the prompt
3670  auto quest = XO("Delete '%s'?")
3671  .Format(mEditCurves[ item-deleted ].Name));
3672 
3673  // Ask for confirmation before removal
3674  int ans = mEffect->Effect::MessageBox(
3675  quest,
3676  wxYES_NO | wxCENTRE,
3677  XO("Confirm Deletion") );
3678  if( ans == wxYES )
3679  { // Remove the curve from the array
3680  mEditCurves.RemoveAt( item-deleted );
3681  deleted++;
3682  }
3683  else
3684  highlight = item-deleted; // if user presses 'No', select that curve
3685  }
3686  // get next selected item
3687  item = mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3688  }
3689 
3690  if(highlight == -1)
3691  PopulateList(mEditCurves.size()-1); // set 'unnamed' as the selected curve
3692  else
3693  PopulateList(highlight); // user said 'No' to deletion
3694 #else // 'DELETE all N' code
3695  int count = mList->GetSelectedItemCount();
3696  long item = mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3697  // Create the prompt
3698  TranslatableString quest;
3699  if( count > 1 )
3700  quest = XO("Delete %d items?").Format( count );
3701  else
3702  if( count == 1 )
3703  quest = XO("Delete '%s'?").Format( mEditCurves[ item ].Name );
3704  else
3705  return;
3706  // Ask for confirmation before removal
3707  int ans = mEffect->Effect::MessageBox(
3708  quest,
3709  wxYES_NO | wxCENTRE,
3710  XO("Confirm Deletion") );
3711  if( ans == wxYES )
3712  { // Remove the curve(s) from the array
3713  // Take care, mList and mEditCurves will get out of sync as curves are deleted
3714  int deleted = 0;
3715  while(item >= 0)
3716  {
3717  // TODO: Migrate to the standard "Manage" dialog.
3718  if(item == mList->GetItemCount()-1) //unnamed
3719  {
3720  mEffect->Effect::MessageBox(
3721  XO("You cannot delete the 'unnamed' curve, it is special."),
3723  XO("Can't delete 'unnamed'") );
3724  }
3725  else
3726  {
3727  mEditCurves.erase( mEditCurves.begin() + item - deleted );
3728  deleted++;
3729  }
3730  item = mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3731  }
3732  PopulateList(mEditCurves.size() - 1); // set 'unnamed' as the selected curve
3733  }
3734 #endif
3735 }

References Effect::DefaultMessageBoxStyle, mEditCurves, mEffect, mList, PopulateList(), and XO.

Here is the call graph for this function:

◆ OnDown()

void EditCurvesDialog::OnDown ( wxCommandEvent &  event)
private

Definition at line 3485 of file Equalization.cpp.

3486 { // looks harder than OnUp as we need to seek backwards up the list, hence GetPreviousItem
3487  long item = GetPreviousItem(mList->GetItemCount());
3488  if( item == -1 )
3489  return; // nothing selected
3490  int state;
3491  while( item != -1 )
3492  {
3493  if( (item != mList->GetItemCount()-1) && (item != mList->GetItemCount()-2) )
3494  { // can't move 'unnamed' down, or the one above it
3495  state = mList->GetItemState(item+1, wxLIST_STATE_SELECTED);
3496  if ( state != wxLIST_STATE_SELECTED )
3497  { // swap this with one below but only if it isn't selected
3498  EQCurve temp(wxT("temp"));
3499  temp.Name = mEditCurves[item].Name;
3500  temp.points = mEditCurves[item].points;
3501  mEditCurves[item].Name = mEditCurves[item+1].Name;
3502  mEditCurves[item].points = mEditCurves[item+1].points;
3503  mEditCurves[item+1].Name = temp.Name;
3504  mEditCurves[item+1].points = temp.points;
3505  wxString sTemp = mList->GetItemText(item);
3506  mList->SetItem(item, 0, mList->GetItemText(item+1));
3507  mList->SetItem(item+1, 0, sTemp);
3508  mList->SetItemState(item, 0, wxLIST_STATE_SELECTED);
3509  mList->SetItemState(item+1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
3510  }
3511  }
3512  item = GetPreviousItem(item);
3513  }
3514 }

References GetPreviousItem(), mEditCurves, mList, EQCurve::Name, and EQCurve::points.

Here is the call graph for this function:

◆ OnExport()

void EditCurvesDialog::OnExport ( wxCommandEvent &  event)
private

Definition at line 3768 of file Equalization.cpp.

3769 {
3770  FileDialogWrapper filePicker(this, XO("Export EQ curves as..."),
3771  FileNames::DataDir(), wxT(""),
3772  XMLtypes(),
3773  wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER); // wxFD_CHANGE_DIR?
3774  wxString fileName;
3775  if( filePicker.ShowModal() == wxID_CANCEL)
3776  return;
3777  else
3778  fileName = filePicker.GetPath();
3779 
3780  EQCurveArray temp;
3781  temp = mEffect->mCurves; // backup the parent's curves
3782  EQCurveArray exportCurves; // Copy selected curves to export
3783  exportCurves.clear();
3784  long item = mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3785  int i=0;
3786  while(item >= 0)
3787  {
3788  if(item != mList->GetItemCount()-1) // not 'unnamed'
3789  {
3790  exportCurves.push_back(mEditCurves[item].Name);
3791  exportCurves[i].points = mEditCurves[item].points;
3792  i++;
3793  }
3794  else
3795  mEffect->Effect::MessageBox(
3796  XO("You cannot export 'unnamed' curve, it is special."),
3798  XO("Cannot Export 'unnamed'") );
3799  // get next selected item
3800  item = mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3801  }
3802  if(i>0)
3803  {
3804  mEffect->mCurves = exportCurves;
3805  mEffect->SaveCurves(fileName);
3806  mEffect->mCurves = temp;
3807  auto message = XO("%d curves exported to %s").Format( i, fileName );
3808  mEffect->Effect::MessageBox(
3809  message,
3811  XO("Curves exported") );
3812  }
3813  else
3814  mEffect->Effect::MessageBox(
3815  XO("No curves exported"),
3817  XO("No curves exported") );
3818 }

References FileNames::DataDir(), Effect::DefaultMessageBoxStyle, FileDialog::GetPath(), EffectEqualization::mCurves, mEditCurves, mEffect, mList, EffectEqualization::SaveCurves(), FileDialog::ShowModal(), XMLtypes(), and XO.

Here is the call graph for this function:

◆ OnImport()

void EditCurvesDialog::OnImport ( wxCommandEvent &  event)
private

Definition at line 3745 of file Equalization.cpp.

3746 {
3747  FileDialogWrapper filePicker(
3748  this,
3749  XO("Choose an EQ curve file"), FileNames::DataDir(), wxT(""),
3750  XMLtypes() );
3751  wxString fileName;
3752  if( filePicker.ShowModal() == wxID_CANCEL)
3753  return;
3754  else
3755  fileName = filePicker.GetPath();
3756  // Use EqualizationDialog::LoadCurves to read into (temporary) mEditCurves
3757  // This may not be the best OOP way of doing it, but I don't know better (MJS)
3758  EQCurveArray temp;
3759  temp = mEffect->mCurves; // temp copy of the main dialog curves
3760  mEffect->mCurves = mEditCurves; // copy EditCurvesDialog to main interface
3761  mEffect->LoadCurves(fileName, true); // use main interface to load imported curves
3762  mEditCurves = mEffect->mCurves; // copy back to this interface
3763  mEffect->mCurves = temp; // and reset the main interface how it was
3764  PopulateList(0); // update the EditCurvesDialog dialog
3765  return;
3766 }

References FileNames::DataDir(), FileDialog::GetPath(), EffectEqualization::LoadCurves(), EffectEqualization::mCurves, mEditCurves, mEffect, PopulateList(), FileDialog::ShowModal(), XMLtypes(), and XO.

Here is the call graph for this function:

◆ OnLibrary()

void EditCurvesDialog::OnLibrary ( wxCommandEvent &  event)
private

Definition at line 3820 of file Equalization.cpp.

3821 {
3822  // full path to wiki.
3823  wxLaunchDefaultBrowser(wxT("https://wiki.audacityteam.org/wiki/EQCurvesDownload"));
3824 }

◆ OnListSelectionChange()

void EditCurvesDialog::OnListSelectionChange ( wxListEvent &  event)
private

Definition at line 3865 of file Equalization.cpp.

3866 {
3867  const bool enable = mList->GetSelectedItemCount() > 0;
3868  static const int ids[] = {
3869  UpButtonID,
3870  DownButtonID,
3873  };
3874  for (auto id : ids)
3875  FindWindowById(id, this)->Enable(enable);
3876 }

References DeleteButtonID, DownButtonID, mList, RenameButtonID, and UpButtonID.

◆ OnOK()

void EditCurvesDialog::OnOK ( wxCommandEvent &  event)
private

Definition at line 3837 of file Equalization.cpp.

3838 {
3839  // Make a backup of the current curves
3840  wxString backupPlace = wxFileName( FileNames::DataDir(), wxT("EQBackup.xml") ).GetFullPath();
3841  mEffect->SaveCurves(backupPlace);
3842  // Load back into the main dialog
3843  mEffect->mCurves.clear();
3844  for (unsigned int i = 0; i < mEditCurves.size(); i++)
3845  {
3846  mEffect->mCurves.push_back(mEditCurves[i].Name);
3847  mEffect->mCurves[i].points = mEditCurves[i].points;
3848  }
3849  mEffect->SaveCurves();
3850  mEffect->LoadCurves();
3851 // mEffect->CreateChoice();
3852  wxGetTopLevelParent(mEffect->mUIParent)->Layout();
3853 // mEffect->mUIParent->Layout();
3854 
3855  // Select something sensible
3856  long item = mList->GetNextItem(-1,
3857  wxLIST_NEXT_ALL,
3858  wxLIST_STATE_SELECTED);
3859  if (item == -1)
3860  item = mList->GetItemCount()-1; // nothing selected, default to 'unnamed'
3861  mEffect->setCurve(item);
3862  EndModal(true);
3863 }

References FileNames::DataDir(), EffectEqualization::LoadCurves(), EffectEqualization::mCurves, mEditCurves, mEffect, mList, Effect::mUIParent, EffectEqualization::SaveCurves(), and EffectEqualization::setCurve().

Here is the call graph for this function:

◆ OnRename()

void EditCurvesDialog::OnRename ( wxCommandEvent &  event)
private

Definition at line 3530 of file Equalization.cpp.

3531 {
3532  wxString name;
3533  int numCurves = mEditCurves.size();
3534  int curve = 0;
3535 
3536  // Setup list of characters that aren't allowed
3537  wxArrayStringEx exclude{
3538  wxT("<") ,
3539  wxT(">") ,
3540  wxT("'") ,
3541  wxT("\"") ,
3542  };
3543 
3544  // Get the first one to be renamed
3545  long item = mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3546  long firstItem = item; // for reselection with PopulateList
3547  while(item >= 0)
3548  {
3549  // Prompt the user until a valid name is enter or cancelled
3550  bool overwrite = false;
3551  bool bad = true;
3552  while( bad ) // Check for an unacceptable duplicate
3553  { // Show the dialog and bail if the user cancels
3554  bad = false;
3555  // build the dialog
3556  AudacityTextEntryDialog dlg( this,
3557  XO("Rename '%s' to...").Format( mEditCurves[ item ].Name ),
3558  XO("Rename...") );
3559  dlg.SetTextValidator( wxFILTER_EXCLUDE_CHAR_LIST );
3560  dlg.SetName(
3561  wxString::Format( _("Rename '%s'"), mEditCurves[ item ].Name ) );
3562  wxTextValidator *tv = dlg.GetTextValidator();
3563  tv->SetExcludes( exclude ); // Tell the validator about excluded chars
3564  if( dlg.ShowModal() == wxID_CANCEL )
3565  {
3566  bad = true;
3567  break;
3568  }
3569 
3570  // Extract the name from the dialog
3571  name = dlg.GetValue();
3572 
3573  // Search list of curves for a duplicate name
3574  for( curve = 0; curve < numCurves; curve++ )
3575  {
3576  wxString temp = mEditCurves[ curve ].Name;
3577  if( name == mEditCurves[ curve ].Name ) // case sensitive
3578  {
3579  bad = true;
3580  if( curve == item ) // trying to rename a curve with the same name
3581  {
3582  mEffect->Effect::MessageBox(
3583  XO("Name is the same as the original one"),
3584  wxOK,
3585  XO("Same name") );
3586  break;
3587  }
3588  int answer = mEffect->Effect::MessageBox(
3589  XO("Overwrite existing curve '%s'?").Format( name ),
3590  wxYES_NO,
3591  XO("Curve exists") );
3592  if (answer == wxYES)
3593  {
3594  bad = false;
3595  overwrite = true; // we are going to overwrite the one with this name
3596  break;
3597  }
3598  }
3599  }
3600  if( name.empty() || name == wxT("unnamed") )
3601  bad = true;
3602  }
3603 
3604  // if bad, we cancelled the rename dialog, so nothing to do.
3605  if( bad == true )
3606  ;
3607  else if(overwrite){
3608  // Overwrite another curve.
3609  // JKC: because 'overwrite' is true, 'curve' is the number of the curve that
3610  // we are about to overwrite.
3611  mEditCurves[ curve ].Name = name;
3612  mEditCurves[ curve ].points = mEditCurves[ item ].points;
3613  // if renaming the unnamed item, then select it,
3614  // otherwise get rid of the item we've renamed.
3615  if( item == (numCurves-1) )
3616  mList->SetItem(curve, 0, name);
3617  else
3618  {
3619  mEditCurves.erase( mEditCurves.begin() + item );
3620  numCurves--;
3621  }
3622  }
3623  else if( item == (numCurves-1) ) // renaming 'unnamed'
3624  { // Create a NEW entry
3625  mEditCurves.push_back( EQCurve( wxT("unnamed") ) );
3626  // Copy over the points
3627  mEditCurves[ numCurves ].points = mEditCurves[ numCurves - 1 ].points;
3628  // Give the original unnamed entry the NEW name
3629  mEditCurves[ numCurves - 1 ].Name = name;
3630  numCurves++;
3631  }
3632  else // just rename (the 'normal' case)
3633  {
3634  mEditCurves[ item ].Name = name;
3635  mList->SetItem(item, 0, name);
3636  }
3637  // get next selected item
3638  item = mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3639  }
3640 
3641  PopulateList(firstItem); // Note: only saved to file when you OK out of the dialog
3642  return;
3643 }

References _, TranslatableString::empty(), mEditCurves, mEffect, mList, name, PopulateList(), and XO.

Here is the call graph for this function:

◆ OnUp()

void EditCurvesDialog::OnUp ( wxCommandEvent &  event)
private

Definition at line 3447 of file Equalization.cpp.

3448 {
3449  long item = mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3450  if ( item == -1 )
3451  return; // no items selected
3452  if( item == 0 )
3453  item = mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); // top item selected, can't move up
3454  int state;
3455  while( item != -1 )
3456  {
3457  if ( item == mList->GetItemCount()-1)
3458  { // 'unnamed' always stays at the bottom
3459  mEffect->Effect::MessageBox(
3460  XO("'unnamed' always stays at the bottom of the list"),
3462  XO("'unnamed' is special") ); // these could get tedious!
3463  return;
3464  }
3465  state = mList->GetItemState(item-1, wxLIST_STATE_SELECTED);
3466  if ( state != wxLIST_STATE_SELECTED )
3467  { // swap this with one above but only if it isn't selected
3468  EQCurve temp(wxT("temp"));
3469  temp.Name = mEditCurves[item].Name;
3470  temp.points = mEditCurves[item].points;
3471  mEditCurves[item].Name = mEditCurves[item-1].Name;
3472  mEditCurves[item].points = mEditCurves[item-1].points;
3473  mEditCurves[item-1].Name = temp.Name;
3474  mEditCurves[item-1].points = temp.points;
3475  wxString sTemp = mList->GetItemText(item);
3476  mList->SetItem(item, 0, mList->GetItemText(item-1));
3477  mList->SetItem(item-1, 0, sTemp);
3478  mList->SetItemState(item, 0, wxLIST_STATE_SELECTED);
3479  mList->SetItemState(item-1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
3480  }
3481  item = mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3482  }
3483 }

References Effect::DefaultMessageBoxStyle, mEditCurves, mEffect, mList, EQCurve::Name, EQCurve::points, and XO.

◆ Populate()

void EditCurvesDialog::Populate ( )
private

Creates the dialog and its contents.

Definition at line 3386 of file Equalization.cpp.

3387 {
3388  //------------------------- Main section --------------------
3389  ShuttleGui S(this, eIsCreating);
3390  PopulateOrExchange(S);
3391  // ----------------------- End of main section --------------
3392 }

References eIsCreating, and PopulateOrExchange().

Here is the call graph for this function:

◆ PopulateList()

void EditCurvesDialog::PopulateList ( int  position)
private

Definition at line 3432 of file Equalization.cpp.

3433 {
3434  mList->DeleteAllItems();
3435  for (unsigned int i = 0; i < mEditCurves.size(); i++)
3436  mList->InsertItem(i, mEditCurves[i].Name);
3437  mList->SetColumnWidth(0, wxLIST_AUTOSIZE);
3438  int curvesWidth = mList->GetColumnWidth(0);
3439  mList->SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER);
3440  int headerWidth = mList->GetColumnWidth(0);
3441  mList->SetColumnWidth(0, wxMax(headerWidth, curvesWidth));
3442  // use 'position' to set focus
3443  mList->EnsureVisible(position);
3444  mList->SetItemState(position, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
3445 }

References mEditCurves, and mList.

Referenced by OnDefaults(), OnDelete(), OnImport(), OnRename(), and PopulateOrExchange().

Here is the caller graph for this function:

◆ PopulateOrExchange()

void EditCurvesDialog::PopulateOrExchange ( ShuttleGui S)
private

Defines the dialog and does data exchange with it.

Definition at line 3395 of file Equalization.cpp.

3396 {
3397  S.StartHorizontalLay(wxEXPAND);
3398  {
3399  S.StartStatic(XO("&Curves"), 1);
3400  {
3401  mList = S.Id(CurvesListID)
3402  .Style(wxSUNKEN_BORDER | wxLC_REPORT | wxLC_HRULES | wxLC_VRULES )
3404  { XO("Curve Name"), wxLIST_FORMAT_RIGHT }
3405  });
3406  }
3407  S.EndStatic();
3408  S.StartVerticalLay(0);
3409  {
3410  S.Id(UpButtonID).AddButton(XXO("Move &Up"), wxALIGN_LEFT);
3411  S.Id(DownButtonID).AddButton(XXO("Move &Down"), wxALIGN_LEFT);
3412  S.Id(RenameButtonID).AddButton(XXO("&Rename..."), wxALIGN_LEFT);
3413  S.Id(DeleteButtonID).AddButton(XXO("D&elete..."), wxALIGN_LEFT);
3414  S.Id(ImportButtonID).AddButton(XXO("I&mport..."), wxALIGN_LEFT);
3415  S.Id(ExportButtonID).AddButton(XXO("E&xport..."), wxALIGN_LEFT);
3416  S.Id(LibraryButtonID).AddButton(XXO("&Get More..."), wxALIGN_LEFT);
3417  S.Id(DefaultsButtonID).AddButton(XXO("De&faults"), wxALIGN_LEFT);
3418  }
3419  S.EndVerticalLay();
3420  }
3421  S.EndHorizontalLay();
3422  S.AddStandardButtons();
3423  S.StartStatic(XO("Help"));
3424  S.AddConstTextBox( {}, XO("Rename 'unnamed' to save a new entry.\n'OK' saves all changes, 'Cancel' doesn't."));
3425  S.EndStatic();
3427  Fit();
3428 
3429  return;
3430 }

References ShuttleGuiBase::AddButton(), ShuttleGuiBase::AddConstTextBox(), ShuttleGuiBase::AddListControlReportMode(), ShuttleGui::AddStandardButtons(), CurvesListID, DefaultsButtonID, DeleteButtonID, DownButtonID, ShuttleGuiBase::EndHorizontalLay(), ShuttleGuiBase::EndStatic(), ShuttleGuiBase::EndVerticalLay(), ExportButtonID, ShuttleGui::Id(), ImportButtonID, LibraryButtonID, mList, mPosition, PopulateList(), RenameButtonID, ShuttleGuiBase::StartHorizontalLay(), ShuttleGuiBase::StartStatic(), ShuttleGuiBase::StartVerticalLay(), ShuttleGui::Style(), UpButtonID, XO, and XXO.

Referenced by Populate().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mEditCurves

EQCurveArray EditCurvesDialog::mEditCurves
private

◆ mEffect

EffectEqualization* EditCurvesDialog::mEffect
private

Definition at line 376 of file Equalization.h.

Referenced by OnDefaults(), OnDelete(), OnExport(), OnImport(), OnOK(), OnRename(), and OnUp().

◆ mList

wxListCtrl* EditCurvesDialog::mList
private

◆ mParent

wxWindow* EditCurvesDialog::mParent
private

Definition at line 375 of file Equalization.h.

◆ mPosition

int EditCurvesDialog::mPosition
private

Definition at line 377 of file Equalization.h.

Referenced by PopulateOrExchange().


The documentation for this class was generated from the following files:
EditCurvesDialog::LibraryButtonID
@ LibraryButtonID
Definition: Equalization.h:369
TranslatableString
Holds a msgid for the translation catalog; may also bind format arguments.
Definition: TranslatableString.h:32
eIsCreating
@ eIsCreating
Definition: ShuttleGui.h:38
TranslatableString::empty
bool empty() const
Definition: TranslatableString.h:72
ShuttleGuiBase::StartVerticalLay
void StartVerticalLay(int iProp=1)
Definition: ShuttleGui.cpp:1184
EditCurvesDialog::GetPreviousItem
long GetPreviousItem(long item)
Definition: Equalization.cpp:3516
EditCurvesDialog::DownButtonID
@ DownButtonID
Definition: Equalization.h:364
EditCurvesDialog::RenameButtonID
@ RenameButtonID
Definition: Equalization.h:365
EditCurvesDialog::ImportButtonID
@ ImportButtonID
Definition: Equalization.h:367
EffectEqualization::LoadCurves
void LoadCurves(const wxString &fileName={}, bool append=false)
Definition: Equalization.cpp:1589
AudacityTextEntryDialog
Wrap wxTextEntryDialog so that caption IS translatable.
Definition: AudacityTextEntryDialog.h:23
Format
Abstract base class used in importing a file.
EditCurvesDialog::mEditCurves
EQCurveArray mEditCurves
Definition: Equalization.h:374
XMLtypes
static const FileNames::FileTypes & XMLtypes()
Definition: Equalization.cpp:3737
XO
#define XO(s)
Definition: Internat.h:31
EditCurvesDialog::mList
wxListCtrl * mList
Definition: Equalization.h:373
wxDialogWrapper::SetLabel
void SetLabel(const TranslatableString &title)
Definition: wxPanelWrapper.cpp:71
EditCurvesDialog::DefaultsButtonID
@ DefaultsButtonID
Definition: Equalization.h:370
Effect::DefaultMessageBoxStyle
@ DefaultMessageBoxStyle
Definition: Effect.h:274
wxArrayStringEx
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
Definition: wxArrayStringEx.h:18
EditCurvesDialog::mPosition
int mPosition
Definition: Equalization.h:377
EffectEqualization::SaveCurves
void SaveCurves(const wxString &fileName={})
Definition: Equalization.cpp:1833
ShuttleGui::Id
ShuttleGui & Id(int id)
Definition: ShuttleGui.cpp:2274
FileNames::DataDir
FILES_API FilePath DataDir()
Audacity user data directory.
ShuttleGui::Style
ShuttleGui & Style(long iStyle)
Definition: ShuttleGui.h:727
EffectEqualization::setCurve
void setCurve(int currentCurve)
Definition: Equalization.cpp:1875
EditCurvesDialog::PopulateList
void PopulateList(int position)
Definition: Equalization.cpp:3432
ShuttleGuiBase::AddConstTextBox
void AddConstTextBox(const TranslatableString &Caption, const TranslatableString &Value)
Single line text box of fixed size.
Definition: ShuttleGui.cpp:733
EditCurvesDialog::mEffect
EffectEqualization * mEffect
Definition: Equalization.h:376
XXO
#define XXO(s)
Definition: Internat.h:44
ShuttleGuiBase::EndHorizontalLay
void EndHorizontalLay()
Definition: ShuttleGui.cpp:1177
EditCurvesDialog::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S)
Defines the dialog and does data exchange with it.
Definition: Equalization.cpp:3395
name
const TranslatableString name
Definition: Equalization.cpp:471
ShuttleGuiBase::StartHorizontalLay
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
Definition: ShuttleGui.cpp:1167
EditCurvesDialog::CurvesListID
@ CurvesListID
Definition: Equalization.h:362
ShuttleGuiBase::EndVerticalLay
void EndVerticalLay()
Definition: ShuttleGui.cpp:1203
EffectEqualization::mCurves
EQCurveArray mCurves
Definition: Equalization.h:233
EditCurvesDialog::DeleteButtonID
@ DeleteButtonID
Definition: Equalization.h:366
ShuttleGuiBase::AddButton
wxButton * AddButton(const TranslatableString &Text, int PositionFlags=wxALIGN_CENTRE, bool setDefault=false)
Definition: ShuttleGui.cpp:360
EditCurvesDialog::mParent
wxWindow * mParent
Definition: Equalization.h:375
ShuttleGuiBase::StartStatic
wxStaticBox * StartStatic(const TranslatableString &Str, int iProp=0)
Definition: ShuttleGui.cpp:893
Effect::mUIParent
wxWindow * mUIParent
Definition: Effect.h:478
FileDialogWrapper
Definition: wxPanelWrapper.h:165
EditCurvesDialog::Populate
void Populate()
Creates the dialog and its contents.
Definition: Equalization.cpp:3386
_
#define _(s)
Definition: Internat.h:75
ShuttleGuiBase::AddListControlReportMode
wxListCtrl * AddListControlReportMode(std::initializer_list< const ListControlColumn > columns={}, long listControlStyles=0)
Definition: ShuttleGui.cpp:802
EQCurveArray
std::vector< EQCurve > EQCurveArray
Definition: Equalization.h:86
EditCurvesDialog::UpButtonID
@ UpButtonID
Definition: Equalization.h:363
wxDialogWrapper::wxDialogWrapper
wxDialogWrapper()
Definition: wxPanelWrapper.h:84
ShuttleGui::AddStandardButtons
void AddStandardButtons(long buttons=eOkButton|eCancelButton, wxWindow *extra=NULL)
Definition: ShuttleGui.cpp:2444
EQCurve
EQCurve is used with EffectEqualization.
Definition: Equalization.h:72
EditCurvesDialog::ExportButtonID
@ ExportButtonID
Definition: Equalization.h:368
wxDialogWrapper::SetName
void SetName()
Definition: wxPanelWrapper.cpp:81
ShuttleGuiBase::EndStatic
void EndStatic()
Definition: ShuttleGui.cpp:922
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631