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 390 of file Equalization.h.

Member Enumeration Documentation

◆ EQCurvesDialogControls

Enumerator
CurvesListID 
UpButtonID 
DownButtonID 
RenameButtonID 
DeleteButtonID 
ImportButtonID 
ExportButtonID 
LibraryButtonID 
DefaultsButtonID 

Definition at line 398 of file Equalization.h.

Constructor & Destructor Documentation

◆ EditCurvesDialog()

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

Definition at line 3259 of file Equalization.cpp.

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

References XO.

◆ ~EditCurvesDialog()

EditCurvesDialog::~EditCurvesDialog ( )

Definition at line 3281 of file Equalization.cpp.

3282{
3283}

Member Function Documentation

◆ GetPreviousItem()

long EditCurvesDialog::GetPreviousItem ( long  item)
private

Definition at line 3416 of file Equalization.cpp.

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

References mList.

Referenced by OnDown().

Here is the caller graph for this function:

◆ OnDefaults()

void EditCurvesDialog::OnDefaults ( wxCommandEvent &  event)
private

Definition at line 3726 of file Equalization.cpp.

3727{
3728 EQCurveArray temp;
3729 temp = mEffect->mCurves;
3730 // we expect this to fail in LoadCurves (due to a lack of path) and handle that there
3731 mEffect->LoadCurves( wxT("EQDefaultCurves.xml") );
3733 mEffect->mCurves = temp;
3734 PopulateList(0); // update the EditCurvesDialog dialog
3735}
wxT("CloseDown"))
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, PopulateList(), and wxT().

Here is the call graph for this function:

◆ OnDelete()

void EditCurvesDialog::OnDelete ( wxCommandEvent &  event)
private

Definition at line 3546 of file Equalization.cpp.

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

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

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

Here is the call graph for this function:

◆ OnExport()

void EditCurvesDialog::OnExport ( wxCommandEvent &  event)
private

Definition at line 3668 of file Equalization.cpp.

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

Here is the call graph for this function:

◆ OnImport()

void EditCurvesDialog::OnImport ( wxCommandEvent &  event)
private

Definition at line 3645 of file Equalization.cpp.

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

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

Here is the call graph for this function:

◆ OnLibrary()

void EditCurvesDialog::OnLibrary ( wxCommandEvent &  event)
private

Definition at line 3720 of file Equalization.cpp.

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

References wxT().

Here is the call graph for this function:

◆ OnListSelectionChange()

void EditCurvesDialog::OnListSelectionChange ( wxListEvent &  event)
private

Definition at line 3765 of file Equalization.cpp.

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

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

◆ OnOK()

void EditCurvesDialog::OnOK ( wxCommandEvent &  event)
private

Definition at line 3737 of file Equalization.cpp.

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

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

Here is the call graph for this function:

◆ OnRename()

void EditCurvesDialog::OnRename ( wxCommandEvent &  event)
private

Definition at line 3430 of file Equalization.cpp.

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

Here is the call graph for this function:

◆ OnUp()

void EditCurvesDialog::OnUp ( wxCommandEvent &  event)
private

Definition at line 3347 of file Equalization.cpp.

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

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

Here is the call graph for this function:

◆ Populate()

void EditCurvesDialog::Populate ( )
private

Creates the dialog and its contents.

Definition at line 3286 of file Equalization.cpp.

3287{
3288 //------------------------- Main section --------------------
3289 ShuttleGui S(this, eIsCreating);
3291 // ----------------------- End of main section --------------
3292}
@ 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 3332 of file Equalization.cpp.

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

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

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

◆ mPosition

int EditCurvesDialog::mPosition
private

Definition at line 415 of file Equalization.h.

Referenced by PopulateOrExchange().


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