17#include <wx/listctrl.h>
33 EVT_LIST_ITEM_DESELECTED(CurvesListID,
41 wxDefaultPosition, wxDefaultSize,
42 wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER)
47 SetLabel(
XO(
"Manage Curves"));
48 SetName(
XO(
"Manage Curves List"));
55 SetMinSize(GetSize());
74 S.StartHorizontalLay(wxEXPAND);
76 S.StartStatic(
XO(
"&Curves"), 1);
79 .Style(wxSUNKEN_BORDER | wxLC_REPORT | wxLC_HRULES | wxLC_VRULES )
80 .AddListControlReportMode({
81 {
XO(
"Curve Name"), wxLIST_FORMAT_RIGHT }
85 S.StartVerticalLay(0);
99 S.AddStandardButtons();
100 S.StartStatic(
XO(
"Help"));
101 S.AddConstTextBox( {},
XO(
"Rename 'unnamed' to save a new entry.\n'OK' saves all changes, 'Cancel' doesn't."));
111 mList->DeleteAllItems();
112 for (
unsigned int i = 0; i <
mEditCurves.size(); i++)
114 mList->SetColumnWidth(0, wxLIST_AUTOSIZE);
115 int curvesWidth =
mList->GetColumnWidth(0);
116 mList->SetColumnWidth(0, wxLIST_AUTOSIZE_USEHEADER);
117 int headerWidth =
mList->GetColumnWidth(0);
118 mList->SetColumnWidth(0, wxMax(headerWidth, curvesWidth));
120 mList->EnsureVisible(position);
121 mList->SetItemState(position, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED, wxLIST_STATE_SELECTED|wxLIST_STATE_FOCUSED);
126 long item =
mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
130 item =
mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
134 if ( item ==
mList->GetItemCount()-1)
137 XO(
"'unnamed' always stays at the bottom of the list"),
138 XO(
"'unnamed' is special") );
141 state =
mList->GetItemState(item-1, wxLIST_STATE_SELECTED);
142 if ( state != wxLIST_STATE_SELECTED )
151 wxString sTemp =
mList->GetItemText(item);
152 mList->SetItem(item, 0,
mList->GetItemText(item-1));
153 mList->SetItem(item-1, 0, sTemp);
154 mList->SetItemState(item, 0, wxLIST_STATE_SELECTED);
155 mList->SetItemState(item-1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
157 item =
mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
169 if( (item !=
mList->GetItemCount()-1) && (item !=
mList->GetItemCount()-2) )
171 state =
mList->GetItemState(item+1, wxLIST_STATE_SELECTED);
172 if ( state != wxLIST_STATE_SELECTED )
181 wxString sTemp =
mList->GetItemText(item);
182 mList->SetItem(item, 0,
mList->GetItemText(item+1));
183 mList->SetItem(item+1, 0, sTemp);
184 mList->SetItemState(item, 0, wxLIST_STATE_SELECTED);
185 mList->SetItemState(item+1, wxLIST_STATE_SELECTED, wxLIST_STATE_SELECTED);
195 long itemTemp =
mList->GetNextItem(-1, wxLIST_NEXT_ALL,
196 wxLIST_STATE_SELECTED);
197 while( (itemTemp != -1) && (itemTemp < item) )
200 itemTemp =
mList->GetNextItem(itemTemp, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
221 long item =
mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
222 long firstItem = item;
226 bool overwrite =
false;
235 dlg.SetTextValidator( wxFILTER_EXCLUDE_CHAR_LIST );
237 wxString::Format(
_(
"Rename '%s'"),
mEditCurves[ item ].Name ) );
238 wxTextValidator *tv = dlg.GetTextValidator();
239 tv->SetExcludes( exclude );
240 if( dlg.ShowModal() == wxID_CANCEL )
247 name = dlg.GetValue();
250 for( curve = 0; curve < numCurves; curve++ )
259 XO(
"Name is the same as the original one"),
291 if( item == (numCurves-1) )
299 else if( item == (numCurves-1) )
314 item =
mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
329 long item =
mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
336 if(item ==
mList->GetItemCount()-1)
339 XO(
"You cannot delete the 'unnamed' curve."),
340 XO(
"Can't delete 'unnamed'") );
345 auto quest =
XO(
"Delete '%s'?")
351 XO(
"Confirm Deletion") );
358 highlight = item-deleted;
361 item =
mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
369 int count =
mList->GetSelectedItemCount();
370 long item =
mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
374 quest =
XO(
"Delete %d items?").Format( count );
377 quest =
XO(
"Delete '%s'?").Format(
mEditCurves[ item ].Name );
383 XO(
"Confirm Deletion"),
384 wxYES_NO | wxCENTRE );
392 if(item ==
mList->GetItemCount()-1)
395 XO(
"You cannot delete the 'unnamed' curve, it is special."),
396 XO(
"Can't delete 'unnamed'"));
403 item =
mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
425 if( filePicker.
ShowModal() == wxID_CANCEL)
428 fileName = filePicker.
GetPath();
430 .LoadCurves(fileName,
true);
440 wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER);
442 if( filePicker.
ShowModal() == wxID_CANCEL)
445 fileName = filePicker.
GetPath();
448 exportCurves.clear();
449 long item =
mList->GetNextItem(-1, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
453 if(item !=
mList->GetItemCount()-1)
461 XO(
"You cannot export 'unnamed' curve, it is special."),
462 XO(
"Cannot Export 'unnamed'") );
464 item =
mList->GetNextItem(item, wxLIST_NEXT_ALL, wxLIST_STATE_SELECTED);
469 auto message =
XO(
"%d curves exported to %s").Format( i, fileName );
472 XO(
"Curves exported") );
476 XO(
"No curves exported"),
477 XO(
"No curves exported") );
483 wxLaunchDefaultBrowser(
wxT(
"https://wiki.audacityteam.org/wiki/EQCurvesDownload"));
490 .LoadCurves(
wxT(
"EQDefaultCurves.xml") );
498 wxString backupPlace =
501 writer.SaveCurves(backupPlace);
510 long item =
mList->GetNextItem(-1,
512 wxLIST_STATE_SELECTED);
514 item =
mList->GetItemCount()-1;
521 const bool enable =
mList->GetSelectedItemCount() > 0;
522 static const int ids[] = {
529 FindWindowById(
id,
this)->Enable(enable);
EVT_BUTTON(wxID_NO, DependencyDialog::OnNo) EVT_BUTTON(wxID_YES
const TranslatableString name
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.