17#include <wx/listctrl.h>
34 EVT_LIST_ITEM_DESELECTED(CurvesListID,
42 wxDefaultPosition, wxDefaultSize,
43 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
48 SetLabel(
XO(
"Manage Curves"));
49 SetName(
XO(
"Manage Curves List"));
56 SetMinSize(GetSize());
75 S.StartHorizontalLay(wxEXPAND);
77 S.StartStatic(
XO(
"&Curves"), 1);
80 .Style( wxLC_REPORT | wxLC_HRULES | wxLC_VRULES )
81 .AddListControlReportMode({
82 {
XO(
"Curve Name"), wxLIST_FORMAT_RIGHT }
86 S.StartVerticalLay(0);
100 S.AddStandardButtons();
101 S.StartStatic(
XO(
"Help"));
102 S.AddConstTextBox( {},
XO(
"Rename 'unnamed' to save a new entry.\n'OK' saves all changes, 'Cancel' doesn't."));
112 mList->DeleteAllItems();
113 for (
unsigned int i = 0; i <
mEditCurves.size(); i++)
115 mList->SetColumnWidth(0, wxLIST_AUTOSIZE);
116 int curvesWidth =
mList->GetColumnWidth(0);
117 mList->SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER);
118 int headerWidth =
mList->GetColumnWidth(0);
119 mList->SetColumnWidth(0, wxMax(headerWidth, curvesWidth));
121 mList->EnsureVisible(position);
122 mList->SetItemState(position, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
139 long item =
mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
143 item =
mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
147 if ( item ==
mList->GetItemCount()-1)
150 XO(
"'unnamed' always stays at the bottom of the list"),
151 XO(
"'unnamed' is special") );
154 state =
mList->GetItemState(item-1, wxLIST_STATE_SELECTED);
155 if ( state != wxLIST_STATE_SELECTED )
164 wxString sTemp =
mList->GetItemText(item);
165 mList->SetItem(item, 0,
mList->GetItemText(item-1));
166 mList->SetItem(item-1, 0, sTemp);
167 mList->SetItemState(item, 0, wxLIST_STATE_SELECTED);
168 mList->SetItemState(item-1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
170 item =
mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
182 if( (item !=
mList->GetItemCount()-1) && (item !=
mList->GetItemCount()-2) )
184 state =
mList->GetItemState(item+1, wxLIST_STATE_SELECTED);
185 if ( state != wxLIST_STATE_SELECTED )
194 wxString sTemp =
mList->GetItemText(item);
195 mList->SetItem(item, 0,
mList->GetItemText(item+1));
196 mList->SetItem(item+1, 0, sTemp);
197 mList->SetItemState(item, 0, wxLIST_STATE_SELECTED);
198 mList->SetItemState(item+1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
208 long itemTemp =
mList->GetNextItem(-1, wxLIST_NEXT_ALL,
209 wxLIST_STATE_SELECTED);
210 while( (itemTemp != -1) && (itemTemp < item) )
213 itemTemp =
mList->GetNextItem(itemTemp, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
234 long item =
mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
235 long firstItem = item;
239 bool overwrite =
false;
248 dlg.SetTextValidator( wxFILTER_EXCLUDE_CHAR_LIST );
250 wxString::Format(
_(
"Rename '%s'"),
mEditCurves[ item ].Name ) );
251 wxTextValidator *tv = dlg.GetTextValidator();
252 tv->SetExcludes( exclude );
253 if( dlg.ShowModal() == wxID_CANCEL )
260 name = dlg.GetValue();
263 for( curve = 0; curve < numCurves; curve++ )
272 XO(
"Name is the same as the original one"),
304 if( item == (numCurves-1) )
312 else if( item == (numCurves-1) )
327 item =
mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
342 long item =
mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
349 if(item ==
mList->GetItemCount()-1)
352 XO(
"You cannot delete the 'unnamed' curve."),
353 XO(
"Can't delete 'unnamed'") );
358 auto quest =
XO(
"Delete '%s'?")
364 XO(
"Confirm Deletion") );
371 highlight = item-deleted;
374 item =
mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
382 int count =
mList->GetSelectedItemCount();
383 long item =
mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
387 quest =
XO(
"Delete %d items?").Format( count );
390 quest =
XO(
"Delete '%s'?").Format(
mEditCurves[ item ].Name );
396 XO(
"Confirm Deletion"),
397 wxYES_NO | wxCENTRE );
405 if(item ==
mList->GetItemCount()-1)
408 XO(
"You cannot delete the 'unnamed' curve, it is special."),
409 XO(
"Can't delete 'unnamed'"));
416 item =
mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
438 if( filePicker.
ShowModal() == wxID_CANCEL)
441 fileName = filePicker.
GetPath();
443 .LoadCurves(fileName,
true);
453 wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER);
455 if( filePicker.
ShowModal() == wxID_CANCEL)
458 fileName = filePicker.
GetPath();
461 exportCurves.clear();
462 long item =
mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
466 if(item !=
mList->GetItemCount()-1)
474 XO(
"You cannot export 'unnamed' curve, it is special."),
475 XO(
"Cannot Export 'unnamed'") );
477 item =
mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
482 auto message =
XO(
"%d curves exported to %s").Format( i, fileName );
485 XO(
"Curves exported") );
489 XO(
"No curves exported"),
490 XO(
"No curves exported") );
496 wxLaunchDefaultBrowser(
wxT(
"https://wiki.audacityteam.org/wiki/EQCurvesDownload"));
503 .LoadCurves(
wxT(
"EQDefaultCurves.xml") );
511 wxString backupPlace =
514 writer.SaveCurves(backupPlace);
523 long item =
mList->GetNextItem(-1,
525 wxLIST_STATE_SELECTED);
527 item =
mList->GetItemCount()-1;
534 const bool enable =
mList->GetSelectedItemCount() > 0;
535 static const int ids[] = {
542 FindWindowById(
id,
this)->Enable(enable);
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) EVT_BUTTON(wxID_YES
std::vector< EQCurve > EQCurveArray
static const FileNames::FileTypes & XMLtypes()
EVT_LIST_ITEM_SELECTED(CurvesListID, EqualizationCurvesDialog::OnListSelectionChange) EVT_LIST_ITEM_DESELECTED(CurvesListID
XXO("&Cut/Copy/Paste Toolbar")
Wrap wxTextEntryDialog so that caption IS translatable.
std::vector< EQPoint > points
Deserializer of curves from XML files.
Serializer of curves into XML files.
void SaveCurves(const wxString &fileName={})
EqualizationCurvesDialog manages the available preset curves.
long GetPreviousItem(long item)
void OnDown(wxCommandEvent &event)
void PopulateOrExchange(ShuttleGui &S)
Defines the dialog and does data exchange with it.
void OnDelete(wxCommandEvent &event)
void PopulateList(int position)
void OnOK(wxCommandEvent &event)
const TranslatableString & mName
void OnDefaults(wxCommandEvent &event)
void OnExport(wxCommandEvent &event)
void Populate()
Creates the dialog and its contents.
void OnImport(wxCommandEvent &event)
void OnRename(wxCommandEvent &event)
~EqualizationCurvesDialog()
void OnUp(wxCommandEvent &event)
void OnListSelectionChange(wxListEvent &event)
void OnLibrary(wxCommandEvent &event)
virtual wxString GetPath() const
FILES_API const FileType XMLFiles
std::vector< FileType > FileTypes
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Holds a msgid for the translation catalog; may also bind format arguments.
Extend wxArrayString with move operations and construction and insertion fromstd::initializer_list.
int DoMessageBox(const TranslatableString &name, const TranslatableString &msg, const TranslatableString &titleStr, long style=wxOK|wxCENTRE)
FILES_API FilePath DataDir()
Audacity user data directory.