Audacity 3.2.0
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 388 of file Equalization.h.

Member Enumeration Documentation

◆ EQCurvesDialogControls

Enumerator
CurvesListID 
UpButtonID 
DownButtonID 
RenameButtonID 
DeleteButtonID 
ImportButtonID 
ExportButtonID 
LibraryButtonID 
DefaultsButtonID 

Definition at line 396 of file Equalization.h.

Constructor & Destructor Documentation

◆ EditCurvesDialog()

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

Definition at line 3257 of file Equalization.cpp.

3257 :
3258wxDialogWrapper(parent, wxID_ANY, XO("Manage Curves List"),
3259 wxDefaultPosition, wxDefaultSize,
3260 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
3261{
3262 SetLabel(XO("Manage Curves")); // Provide visual label
3263 SetName(XO("Manage Curves List")); // Provide audible label
3264 mParent = parent;
3265 mEffect = effect;
3266 mPosition = position;
3267 // make a copy of mEffect->mCurves here to muck about with.
3268 mEditCurves.clear();
3269 for (unsigned int i = 0; i < mEffect->mCurves.size(); i++)
3270 {
3271 mEditCurves.push_back(mEffect->mCurves[i].Name);
3272 mEditCurves[i].points = mEffect->mCurves[i].points;
3273 }
3274
3275 Populate();
3276 SetMinSize(GetSize());
3277}
#define XO(s)
Definition: Internat.h:31
wxWindow * mParent
Definition: Equalization.h:411
EffectEqualization * mEffect
Definition: Equalization.h:412
void Populate()
Creates the dialog and its contents.
EQCurveArray mEditCurves
Definition: Equalization.h:410
EQCurveArray mCurves
Definition: Equalization.h:240
void SetLabel(const TranslatableString &title)

References XO.

◆ ~EditCurvesDialog()

EditCurvesDialog::~EditCurvesDialog ( )

Definition at line 3279 of file Equalization.cpp.

3280{
3281}

Member Function Documentation

◆ GetPreviousItem()

long EditCurvesDialog::GetPreviousItem ( long  item)
private

Definition at line 3414 of file Equalization.cpp.

3415{
3416 long lastItem = -1;
3417 long itemTemp = mList->GetNextItem(-1, wxLIST_NEXT_ALL,
3418 wxLIST_STATE_SELECTED);
3419 while( (itemTemp != -1) && (itemTemp < item) )
3420 {
3421 lastItem = itemTemp;
3422 itemTemp = mList->GetNextItem(itemTemp, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3423 }
3424 return lastItem;
3425}
wxListCtrl * mList
Definition: Equalization.h:409

References mList.

Referenced by OnDown().

Here is the caller graph for this function:

◆ OnDefaults()

void EditCurvesDialog::OnDefaults ( wxCommandEvent &  event)
private

Definition at line 3724 of file Equalization.cpp.

3725{
3726 EQCurveArray temp;
3727 temp = mEffect->mCurves;
3728 // we expect this to fail in LoadCurves (due to a lack of path) and handle that there
3729 mEffect->LoadCurves( wxT("EQDefaultCurves.xml") );
3731 mEffect->mCurves = temp;
3732 PopulateList(0); // update the EditCurvesDialog dialog
3733}
std::vector< EQCurve > EQCurveArray
Definition: Equalization.h:91
void PopulateList(int position)
void LoadCurves(const wxString &fileName={}, bool append=false)

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 3544 of file Equalization.cpp.

3545{
3546 // We could count them here
3547 // And then put in a 'Delete N items?' prompt.
3548
3549#if 0 // 'one at a time' prompt code
3550 // Get the first one to be deleted
3551 long item = mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3552 // Take care, mList and mEditCurves will get out of sync as curves are deleted
3553 int deleted = 0;
3554 long highlight = -1;
3555
3556 while(item >= 0)
3557 {
3558 if(item == mList->GetItemCount()-1) //unnamed
3559 {
3560 mEffect->Effect::MessageBox(
3561 XO("You cannot delete the 'unnamed' curve."),
3562 wxOK | wxCENTRE,
3563 XO("Can't delete 'unnamed'") );
3564 }
3565 else
3566 {
3567 // Create the prompt
3568 auto quest = XO("Delete '%s'?")
3569 .Format(mEditCurves[ item-deleted ].Name));
3570
3571 // Ask for confirmation before removal
3572 int ans = mEffect->Effect::MessageBox(
3573 quest,
3574 wxYES_NO | wxCENTRE,
3575 XO("Confirm Deletion") );
3576 if( ans == wxYES )
3577 { // Remove the curve from the array
3578 mEditCurves.RemoveAt( item-deleted );
3579 deleted++;
3580 }
3581 else
3582 highlight = item-deleted; // if user presses 'No', select that curve
3583 }
3584 // get next selected item
3585 item = mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3586 }
3587
3588 if(highlight == -1)
3589 PopulateList(mEditCurves.size()-1); // set 'unnamed' as the selected curve
3590 else
3591 PopulateList(highlight); // user said 'No' to deletion
3592#else // 'DELETE all N' code
3593 int count = mList->GetSelectedItemCount();
3594 long item = mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3595 // Create the prompt
3596 TranslatableString quest;
3597 if( count > 1 )
3598 quest = XO("Delete %d items?").Format( count );
3599 else
3600 if( count == 1 )
3601 quest = XO("Delete '%s'?").Format( mEditCurves[ item ].Name );
3602 else
3603 return;
3604 // Ask for confirmation before removal
3605 int ans = mEffect->Effect::MessageBox(
3606 quest,
3607 wxYES_NO | wxCENTRE,
3608 XO("Confirm Deletion") );
3609 if( ans == wxYES )
3610 { // Remove the curve(s) from the array
3611 // Take care, mList and mEditCurves will get out of sync as curves are deleted
3612 int deleted = 0;
3613 while(item >= 0)
3614 {
3615 // TODO: Migrate to the standard "Manage" dialog.
3616 if(item == mList->GetItemCount()-1) //unnamed
3617 {
3618 mEffect->Effect::MessageBox(
3619 XO("You cannot delete the 'unnamed' curve, it is special."),
3621 XO("Can't delete 'unnamed'") );
3622 }
3623 else
3624 {
3625 mEditCurves.erase( mEditCurves.begin() + item - deleted );
3626 deleted++;
3627 }
3628 item = mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3629 }
3630 PopulateList(mEditCurves.size() - 1); // set 'unnamed' as the selected curve
3631 }
3632#endif
3633}
@ DefaultMessageBoxStyle
Definition: Effect.h:172
Holds a msgid for the translation catalog; may also bind format arguments.

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 3383 of file Equalization.cpp.

3384{ // looks harder than OnUp as we need to seek backwards up the list, hence GetPreviousItem
3385 long item = GetPreviousItem(mList->GetItemCount());
3386 if( item == -1 )
3387 return; // nothing selected
3388 int state;
3389 while( item != -1 )
3390 {
3391 if( (item != mList->GetItemCount()-1) && (item != mList->GetItemCount()-2) )
3392 { // can't move 'unnamed' down, or the one above it
3393 state = mList->GetItemState(item+1, wxLIST_STATE_SELECTED);
3394 if ( state != wxLIST_STATE_SELECTED )
3395 { // swap this with one below but only if it isn't selected
3396 EQCurve temp(wxT("temp"));
3397 temp.Name = mEditCurves[item].Name;
3398 temp.points = mEditCurves[item].points;
3399 mEditCurves[item].Name = mEditCurves[item+1].Name;
3400 mEditCurves[item].points = mEditCurves[item+1].points;
3401 mEditCurves[item+1].Name = temp.Name;
3402 mEditCurves[item+1].points = temp.points;
3403 wxString sTemp = mList->GetItemText(item);
3404 mList->SetItem(item, 0, mList->GetItemText(item+1));
3405 mList->SetItem(item+1, 0, sTemp);
3406 mList->SetItemState(item, 0, wxLIST_STATE_SELECTED);
3407 mList->SetItemState(item+1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
3408 }
3409 }
3410 item = GetPreviousItem(item);
3411 }
3412}
EQCurve is used with EffectEqualization.
Definition: Equalization.h:77
long GetPreviousItem(long item)

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 3666 of file Equalization.cpp.

3667{
3668 FileDialogWrapper filePicker(this, XO("Export EQ curves as..."),
3669 FileNames::DataDir(), wxT(""),
3670 XMLtypes(),
3671 wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER); // wxFD_CHANGE_DIR?
3672 wxString fileName;
3673 if( filePicker.ShowModal() == wxID_CANCEL)
3674 return;
3675 else
3676 fileName = filePicker.GetPath();
3677
3678 EQCurveArray temp;
3679 temp = mEffect->mCurves; // backup the parent's curves
3680 EQCurveArray exportCurves; // Copy selected curves to export
3681 exportCurves.clear();
3682 long item = mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3683 int i=0;
3684 while(item >= 0)
3685 {
3686 if(item != mList->GetItemCount()-1) // not 'unnamed'
3687 {
3688 exportCurves.push_back(mEditCurves[item].Name);
3689 exportCurves[i].points = mEditCurves[item].points;
3690 i++;
3691 }
3692 else
3693 mEffect->Effect::MessageBox(
3694 XO("You cannot export 'unnamed' curve, it is special."),
3696 XO("Cannot Export 'unnamed'") );
3697 // get next selected item
3698 item = mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3699 }
3700 if(i>0)
3701 {
3702 mEffect->mCurves = exportCurves;
3703 mEffect->SaveCurves(fileName);
3704 mEffect->mCurves = temp;
3705 auto message = XO("%d curves exported to %s").Format( i, fileName );
3706 mEffect->Effect::MessageBox(
3707 message,
3709 XO("Curves exported") );
3710 }
3711 else
3712 mEffect->Effect::MessageBox(
3713 XO("No curves exported"),
3715 XO("No curves exported") );
3716}
static const FileNames::FileTypes & XMLtypes()
void SaveCurves(const wxString &fileName={})
FILES_API FilePath DataDir()
Audacity user data directory.

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 3643 of file Equalization.cpp.

3644{
3645 FileDialogWrapper filePicker(
3646 this,
3647 XO("Choose an EQ curve file"), FileNames::DataDir(), wxT(""),
3648 XMLtypes() );
3649 wxString fileName;
3650 if( filePicker.ShowModal() == wxID_CANCEL)
3651 return;
3652 else
3653 fileName = filePicker.GetPath();
3654 // Use EqualizationDialog::LoadCurves to read into (temporary) mEditCurves
3655 // This may not be the best OOP way of doing it, but I don't know better (MJS)
3656 EQCurveArray temp;
3657 temp = mEffect->mCurves; // temp copy of the main dialog curves
3658 mEffect->mCurves = mEditCurves; // copy EditCurvesDialog to main interface
3659 mEffect->LoadCurves(fileName, true); // use main interface to load imported curves
3660 mEditCurves = mEffect->mCurves; // copy back to this interface
3661 mEffect->mCurves = temp; // and reset the main interface how it was
3662 PopulateList(0); // update the EditCurvesDialog dialog
3663 return;
3664}

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 3718 of file Equalization.cpp.

3719{
3720 // full path to wiki.
3721 wxLaunchDefaultBrowser(wxT("https://wiki.audacityteam.org/wiki/EQCurvesDownload"));
3722}

◆ OnListSelectionChange()

void EditCurvesDialog::OnListSelectionChange ( wxListEvent &  event)
private

Definition at line 3763 of file Equalization.cpp.

3764{
3765 const bool enable = mList->GetSelectedItemCount() > 0;
3766 static const int ids[] = {
3767 UpButtonID,
3771 };
3772 for (auto id : ids)
3773 FindWindowById(id, this)->Enable(enable);
3774}

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

◆ OnOK()

void EditCurvesDialog::OnOK ( wxCommandEvent &  event)
private

Definition at line 3735 of file Equalization.cpp.

3736{
3737 // Make a backup of the current curves
3738 wxString backupPlace = wxFileName( FileNames::DataDir(), wxT("EQBackup.xml") ).GetFullPath();
3739 mEffect->SaveCurves(backupPlace);
3740 // Load back into the main dialog
3741 mEffect->mCurves.clear();
3742 for (unsigned int i = 0; i < mEditCurves.size(); i++)
3743 {
3744 mEffect->mCurves.push_back(mEditCurves[i].Name);
3745 mEffect->mCurves[i].points = mEditCurves[i].points;
3746 }
3749// mEffect->CreateChoice();
3750 wxGetTopLevelParent(mEffect->mUIParent)->Layout();
3751// mEffect->mUIParent->Layout();
3752
3753 // Select something sensible
3754 long item = mList->GetNextItem(-1,
3755 wxLIST_NEXT_ALL,
3756 wxLIST_STATE_SELECTED);
3757 if (item == -1)
3758 item = mList->GetItemCount()-1; // nothing selected, default to 'unnamed'
3759 mEffect->setCurve(item);
3760 EndModal(true);
3761}
void setCurve(int currentCurve)
wxWindow * mUIParent
Definition: Effect.h:302

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 3428 of file Equalization.cpp.

3429{
3430 wxString name;
3431 int numCurves = mEditCurves.size();
3432 int curve = 0;
3433
3434 // Setup list of characters that aren't allowed
3435 wxArrayStringEx exclude{
3436 wxT("<") ,
3437 wxT(">") ,
3438 wxT("'") ,
3439 wxT("\"") ,
3440 };
3441
3442 // Get the first one to be renamed
3443 long item = mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3444 long firstItem = item; // for reselection with PopulateList
3445 while(item >= 0)
3446 {
3447 // Prompt the user until a valid name is enter or cancelled
3448 bool overwrite = false;
3449 bool bad = true;
3450 while( bad ) // Check for an unacceptable duplicate
3451 { // Show the dialog and bail if the user cancels
3452 bad = false;
3453 // build the dialog
3454 AudacityTextEntryDialog dlg( this,
3455 XO("Rename '%s' to...").Format( mEditCurves[ item ].Name ),
3456 XO("Rename...") );
3457 dlg.SetTextValidator( wxFILTER_EXCLUDE_CHAR_LIST );
3458 dlg.SetName(
3459 wxString::Format( _("Rename '%s'"), mEditCurves[ item ].Name ) );
3460 wxTextValidator *tv = dlg.GetTextValidator();
3461 tv->SetExcludes( exclude ); // Tell the validator about excluded chars
3462 if( dlg.ShowModal() == wxID_CANCEL )
3463 {
3464 bad = true;
3465 break;
3466 }
3467
3468 // Extract the name from the dialog
3469 name = dlg.GetValue();
3470
3471 // Search list of curves for a duplicate name
3472 for( curve = 0; curve < numCurves; curve++ )
3473 {
3474 wxString temp = mEditCurves[ curve ].Name;
3475 if( name == mEditCurves[ curve ].Name ) // case sensitive
3476 {
3477 bad = true;
3478 if( curve == item ) // trying to rename a curve with the same name
3479 {
3480 mEffect->Effect::MessageBox(
3481 XO("Name is the same as the original one"),
3482 wxOK,
3483 XO("Same name") );
3484 break;
3485 }
3486 int answer = mEffect->Effect::MessageBox(
3487 XO("Overwrite existing curve '%s'?").Format( name ),
3488 wxYES_NO,
3489 XO("Curve exists") );
3490 if (answer == wxYES)
3491 {
3492 bad = false;
3493 overwrite = true; // we are going to overwrite the one with this name
3494 break;
3495 }
3496 }
3497 }
3498 if( name.empty() || name == wxT("unnamed") )
3499 bad = true;
3500 }
3501
3502 // if bad, we cancelled the rename dialog, so nothing to do.
3503 if( bad == true )
3504 ;
3505 else if(overwrite){
3506 // Overwrite another curve.
3507 // JKC: because 'overwrite' is true, 'curve' is the number of the curve that
3508 // we are about to overwrite.
3509 mEditCurves[ curve ].Name = name;
3510 mEditCurves[ curve ].points = mEditCurves[ item ].points;
3511 // if renaming the unnamed item, then select it,
3512 // otherwise get rid of the item we've renamed.
3513 if( item == (numCurves-1) )
3514 mList->SetItem(curve, 0, name);
3515 else
3516 {
3517 mEditCurves.erase( mEditCurves.begin() + item );
3518 numCurves--;
3519 }
3520 }
3521 else if( item == (numCurves-1) ) // renaming 'unnamed'
3522 { // Create a NEW entry
3523 mEditCurves.push_back( EQCurve( wxT("unnamed") ) );
3524 // Copy over the points
3525 mEditCurves[ numCurves ].points = mEditCurves[ numCurves - 1 ].points;
3526 // Give the original unnamed entry the NEW name
3527 mEditCurves[ numCurves - 1 ].Name = name;
3528 numCurves++;
3529 }
3530 else // just rename (the 'normal' case)
3531 {
3532 mEditCurves[ item ].Name = name;
3533 mList->SetItem(item, 0, name);
3534 }
3535 // get next selected item
3536 item = mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3537 }
3538
3539 PopulateList(firstItem); // Note: only saved to file when you OK out of the dialog
3540 return;
3541}
const TranslatableString name
#define _(s)
Definition: Internat.h:75
Wrap wxTextEntryDialog so that caption IS translatable.
Abstract base class used in importing a file.
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.

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 3345 of file Equalization.cpp.

3346{
3347 long item = mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3348 if ( item == -1 )
3349 return; // no items selected
3350 if( item == 0 )
3351 item = mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED); // top item selected, can't move up
3352 int state;
3353 while( item != -1 )
3354 {
3355 if ( item == mList->GetItemCount()-1)
3356 { // 'unnamed' always stays at the bottom
3357 mEffect->Effect::MessageBox(
3358 XO("'unnamed' always stays at the bottom of the list"),
3360 XO("'unnamed' is special") ); // these could get tedious!
3361 return;
3362 }
3363 state = mList->GetItemState(item-1, wxLIST_STATE_SELECTED);
3364 if ( state != wxLIST_STATE_SELECTED )
3365 { // swap this with one above but only if it isn't selected
3366 EQCurve temp(wxT("temp"));
3367 temp.Name = mEditCurves[item].Name;
3368 temp.points = mEditCurves[item].points;
3369 mEditCurves[item].Name = mEditCurves[item-1].Name;
3370 mEditCurves[item].points = mEditCurves[item-1].points;
3371 mEditCurves[item-1].Name = temp.Name;
3372 mEditCurves[item-1].points = temp.points;
3373 wxString sTemp = mList->GetItemText(item);
3374 mList->SetItem(item, 0, mList->GetItemText(item-1));
3375 mList->SetItem(item-1, 0, sTemp);
3376 mList->SetItemState(item, 0, wxLIST_STATE_SELECTED);
3377 mList->SetItemState(item-1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
3378 }
3379 item = mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
3380 }
3381}

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 3284 of file Equalization.cpp.

3285{
3286 //------------------------- Main section --------------------
3287 ShuttleGui S(this, eIsCreating);
3289 // ----------------------- End of main section --------------
3290}
@ eIsCreating
Definition: ShuttleGui.h:39
#define S(N)
Definition: ToChars.cpp:64
void PopulateOrExchange(ShuttleGui &S)
Defines the dialog and does data exchange with it.
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:628

References eIsCreating, PopulateOrExchange(), and S.

Here is the call graph for this function:

◆ PopulateList()

void EditCurvesDialog::PopulateList ( int  position)
private

Definition at line 3330 of file Equalization.cpp.

3331{
3332 mList->DeleteAllItems();
3333 for (unsigned int i = 0; i < mEditCurves.size(); i++)
3334 mList->InsertItem(i, mEditCurves[i].Name);
3335 mList->SetColumnWidth(0, wxLIST_AUTOSIZE);
3336 int curvesWidth = mList->GetColumnWidth(0);
3337 mList->SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER);
3338 int headerWidth = mList->GetColumnWidth(0);
3339 mList->SetColumnWidth(0, wxMax(headerWidth, curvesWidth));
3340 // use 'position' to set focus
3341 mList->EnsureVisible(position);
3342 mList->SetItemState(position, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
3343}

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 3293 of file Equalization.cpp.

3294{
3295 S.StartHorizontalLay(wxEXPAND);
3296 {
3297 S.StartStatic(XO("&Curves"), 1);
3298 {
3299 mList = S.Id(CurvesListID)
3300 .Style(wxSUNKEN_BORDER | wxLC_REPORT | wxLC_HRULES | wxLC_VRULES )
3301 .AddListControlReportMode({
3302 { XO("Curve Name"), wxLIST_FORMAT_RIGHT }
3303 });
3304 }
3305 S.EndStatic();
3306 S.StartVerticalLay(0);
3307 {
3308 S.Id(UpButtonID).AddButton(XXO("Move &Up"), wxALIGN_LEFT);
3309 S.Id(DownButtonID).AddButton(XXO("Move &Down"), wxALIGN_LEFT);
3310 S.Id(RenameButtonID).AddButton(XXO("&Rename..."), wxALIGN_LEFT);
3311 S.Id(DeleteButtonID).AddButton(XXO("D&elete..."), wxALIGN_LEFT);
3312 S.Id(ImportButtonID).AddButton(XXO("I&mport..."), wxALIGN_LEFT);
3313 S.Id(ExportButtonID).AddButton(XXO("E&xport..."), wxALIGN_LEFT);
3314 S.Id(LibraryButtonID).AddButton(XXO("&Get More..."), wxALIGN_LEFT);
3315 S.Id(DefaultsButtonID).AddButton(XXO("De&faults"), wxALIGN_LEFT);
3316 }
3317 S.EndVerticalLay();
3318 }
3319 S.EndHorizontalLay();
3320 S.AddStandardButtons();
3321 S.StartStatic(XO("Help"));
3322 S.AddConstTextBox( {}, XO("Rename 'unnamed' to save a new entry.\n'OK' saves all changes, 'Cancel' doesn't."));
3323 S.EndStatic();
3325 Fit();
3326
3327 return;
3328}
#define XXO(s)
Definition: Internat.h:44

References CurvesListID, DefaultsButtonID, DeleteButtonID, DownButtonID, ExportButtonID, ImportButtonID, LibraryButtonID, mList, mPosition, PopulateList(), RenameButtonID, S, 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 412 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 411 of file Equalization.h.

◆ mPosition

int EditCurvesDialog::mPosition
private

Definition at line 413 of file Equalization.h.

Referenced by PopulateOrExchange().


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