mirror of
https://github.com/cookiengineer/audacity
synced 2025-06-16 08:09:32 +02:00
Enh: Allow number+name in export-multiple; patch thanks to Benjamin Drung.
This commit is contained in:
parent
db60792bb4
commit
d84bc6b212
@ -63,6 +63,7 @@ enum {
|
|||||||
FirstID,
|
FirstID,
|
||||||
FirstFileNameID,
|
FirstFileNameID,
|
||||||
TrackID,
|
TrackID,
|
||||||
|
ByNameAndNumberID,
|
||||||
ByNameID,
|
ByNameID,
|
||||||
ByNumberID,
|
ByNumberID,
|
||||||
PrefixID,
|
PrefixID,
|
||||||
@ -302,39 +303,26 @@ void ExportMultiple::PopulateOrExchange(ShuttleGui& S)
|
|||||||
S.SetBorder(5);
|
S.SetBorder(5);
|
||||||
S.StartStatic(_("Name files:"), false);
|
S.StartStatic(_("Name files:"), false);
|
||||||
{
|
{
|
||||||
S.StartMultiColumn(2, false);
|
|
||||||
S.SetStretchyCol(1);
|
mByNumberAndName = S.Id(ByNameAndNumberID)
|
||||||
|
.AddRadioButton(_("Using number AND Label/Track Name"));
|
||||||
|
|
||||||
|
mByName = S.Id(ByNameID)
|
||||||
|
.AddRadioButtonToGroup(_("Using Label/Track Name"));
|
||||||
|
|
||||||
|
mByNumber = S.Id(ByNumberID)
|
||||||
|
.AddRadioButtonToGroup(_("Numbering consecutively"));
|
||||||
|
|
||||||
|
S.StartHorizontalLay(wxEXPAND, false);
|
||||||
{
|
{
|
||||||
// Row 1
|
mPrefixLabel = S.AddVariableText(_("File name prefix:"), true);
|
||||||
S.SetBorder(1);
|
mPrefix = S.Id(PrefixID)
|
||||||
mByName = S.Id(ByNameID)
|
.TieTextBox(wxT(""),
|
||||||
.AddRadioButton(wxT(""));
|
name,
|
||||||
mByName->SetName(_("Using Label/Track Name"));
|
30);
|
||||||
S.SetBorder(3);
|
mPrefix->SetName(_("File name prefix"));
|
||||||
mByNameLabel = S.AddVariableText(_("Using Label/Track Name"), false);
|
|
||||||
|
|
||||||
// Row 2
|
|
||||||
S.SetBorder(1);
|
|
||||||
mByNumber = S.Id(ByNumberID)
|
|
||||||
.AddRadioButtonToGroup(wxT(""));
|
|
||||||
mByNumber->SetName(_("Numbering consecutively"));
|
|
||||||
S.SetBorder(3);
|
|
||||||
mByNumberLabel = S.AddVariableText(_("Numbering consecutively"), false);
|
|
||||||
|
|
||||||
// Row 3
|
|
||||||
S.AddVariableText(wxT(""), false);
|
|
||||||
S.StartHorizontalLay(wxEXPAND, false);
|
|
||||||
{
|
|
||||||
mPrefixLabel = S.AddVariableText(_("File name prefix:"), true);
|
|
||||||
mPrefix = S.Id(PrefixID)
|
|
||||||
.TieTextBox(wxT(""),
|
|
||||||
name,
|
|
||||||
30);
|
|
||||||
mPrefix->SetName(_("File name prefix"));
|
|
||||||
}
|
|
||||||
S.EndHorizontalLay();
|
|
||||||
}
|
}
|
||||||
S.EndMultiColumn();
|
S.EndHorizontalLay();
|
||||||
}
|
}
|
||||||
S.EndStatic();
|
S.EndStatic();
|
||||||
}
|
}
|
||||||
@ -364,9 +352,9 @@ void ExportMultiple::EnableControls()
|
|||||||
|
|
||||||
mFirst->Enable(mLabel->GetValue());
|
mFirst->Enable(mLabel->GetValue());
|
||||||
|
|
||||||
enable = mLabel->GetValue() &&
|
enable = mLabel->GetValue() &&
|
||||||
mByName->GetValue() &&
|
(mByName->GetValue() || mByNumberAndName->GetValue()) &&
|
||||||
mFirst->GetValue();
|
mFirst->GetValue();
|
||||||
mFirstFileLabel->Enable(enable);
|
mFirstFileLabel->Enable(enable);
|
||||||
mFirstFileName->Enable(enable);
|
mFirstFileName->Enable(enable);
|
||||||
|
|
||||||
@ -518,12 +506,14 @@ void ExportMultiple::OnExport(wxCommandEvent& event)
|
|||||||
mExported.Empty();
|
mExported.Empty();
|
||||||
|
|
||||||
if (mLabel->GetValue()) {
|
if (mLabel->GetValue()) {
|
||||||
ok = ExportMultipleByLabel(mByName->GetValue(),
|
ok = ExportMultipleByLabel(mByName->GetValue() || mByNumberAndName->GetValue(),
|
||||||
mPrefix->GetValue());
|
mPrefix->GetValue(),
|
||||||
|
mByNumberAndName->GetValue());
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
ok = ExportMultipleByTrack(mByName->GetValue(),
|
ok = ExportMultipleByTrack(mByName->GetValue() || mByNumberAndName->GetValue(),
|
||||||
mPrefix->GetValue());
|
mPrefix->GetValue(),
|
||||||
|
mByNumberAndName->GetValue());
|
||||||
}
|
}
|
||||||
|
|
||||||
// Give 'em the result
|
// Give 'em the result
|
||||||
@ -541,12 +531,13 @@ void ExportMultiple::OnExport(wxCommandEvent& event)
|
|||||||
|
|
||||||
SuccessDialog dlg(this,
|
SuccessDialog dlg(this,
|
||||||
wxID_ANY,
|
wxID_ANY,
|
||||||
wxString(_("Export Multiple")));
|
wxString(_("Export Multiple")) );
|
||||||
ShuttleGui S(&dlg, eIsCreating);
|
ShuttleGui S(&dlg, eIsCreating);
|
||||||
S.StartVerticalLay();
|
S.StartVerticalLay();
|
||||||
{
|
{
|
||||||
S.AddTitle(msg);
|
S.AddTitle(msg);
|
||||||
S.SetStyle(wxLC_LIST | wxLC_SINGLE_SEL | wxLC_HRULES | wxSUNKEN_BORDER);
|
S.SetStyle(wxLC_LIST | wxLC_SINGLE_SEL | wxLC_HRULES | wxSUNKEN_BORDER |
|
||||||
|
wxVSCROLL | wxHSCROLL);
|
||||||
wxListCtrl *l = S.AddListControl();
|
wxListCtrl *l = S.AddListControl();
|
||||||
l->SetBackgroundStyle(wxBG_STYLE_COLOUR);
|
l->SetBackgroundStyle(wxBG_STYLE_COLOUR);
|
||||||
#if defined (__WXGTK__)
|
#if defined (__WXGTK__)
|
||||||
@ -602,7 +593,8 @@ bool ExportMultiple::DirOk()
|
|||||||
return fn.Mkdir(0777, wxPATH_MKDIR_FULL);
|
return fn.Mkdir(0777, wxPATH_MKDIR_FULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
int ExportMultiple::ExportMultipleByLabel(bool byName, wxString prefix)
|
int ExportMultiple::ExportMultipleByLabel(bool byName,
|
||||||
|
wxString prefix, bool addNumber)
|
||||||
{
|
{
|
||||||
wxASSERT(mProject);
|
wxASSERT(mProject);
|
||||||
bool tagsPrompt = mProject->GetShowId3Dialog();
|
bool tagsPrompt = mProject->GetShowId3Dialog();
|
||||||
@ -669,9 +661,13 @@ int ExportMultiple::ExportMultipleByLabel(bool byName, wxString prefix)
|
|||||||
name.Printf(wxT("%s-%02d"), prefix.c_str(), l+1);
|
name.Printf(wxT("%s-%02d"), prefix.c_str(), l+1);
|
||||||
else
|
else
|
||||||
name.Printf(wxT("%s-%d"), prefix.c_str(), l+1);
|
name.Printf(wxT("%s-%d"), prefix.c_str(), l+1);
|
||||||
|
} else if (addNumber) {
|
||||||
|
// Following discussion with GA, always have 2 digits
|
||||||
|
// for easy file-name sorting (on windows)
|
||||||
|
name.Prepend(wxString::Format(wxT("%02d-"), l+1));
|
||||||
}
|
}
|
||||||
|
|
||||||
// store sanitised and user checjed name in object
|
// store sanitised and user checked name in object
|
||||||
setting.destfile.SetName(MakeFileName(name));
|
setting.destfile.SetName(MakeFileName(name));
|
||||||
|
|
||||||
wxASSERT(setting.destfile.IsOk()); // scream if file name is broke
|
wxASSERT(setting.destfile.IsOk()); // scream if file name is broke
|
||||||
@ -714,8 +710,8 @@ int ExportMultiple::ExportMultipleByLabel(bool byName, wxString prefix)
|
|||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ExportMultiple::ExportMultipleByTrack(bool byName,
|
int ExportMultiple::ExportMultipleByTrack(bool byName,
|
||||||
wxString prefix)
|
wxString prefix, bool addNumber)
|
||||||
{
|
{
|
||||||
wxASSERT(mProject);
|
wxASSERT(mProject);
|
||||||
bool tagsPrompt = mProject->GetShowId3Dialog();
|
bool tagsPrompt = mProject->GetShowId3Dialog();
|
||||||
@ -793,6 +789,9 @@ int ExportMultiple::ExportMultipleByTrack(bool byName,
|
|||||||
title = tr->GetName();
|
title = tr->GetName();
|
||||||
if (byName) {
|
if (byName) {
|
||||||
name = title;
|
name = title;
|
||||||
|
if (addNumber) {
|
||||||
|
name.Prepend(wxString::Format(wxT("%02d-"), l+1));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (numTracks > 9) {
|
if (numTracks > 9) {
|
||||||
|
@ -52,7 +52,7 @@ private:
|
|||||||
* labels that define them (true), or just numbered (false).
|
* labels that define them (true), or just numbered (false).
|
||||||
* @param prefix The string used to prefix the file number if files are being
|
* @param prefix The string used to prefix the file number if files are being
|
||||||
* numbered rather than named */
|
* numbered rather than named */
|
||||||
int ExportMultipleByLabel(bool byName, wxString prefix);
|
int ExportMultipleByLabel(bool byName, wxString prefix, bool addNumber);
|
||||||
|
|
||||||
/** \brief Export each track in the project to a separate file
|
/** \brief Export each track in the project to a separate file
|
||||||
*
|
*
|
||||||
@ -60,7 +60,7 @@ private:
|
|||||||
* (true), or just numbered (false).
|
* (true), or just numbered (false).
|
||||||
* @param prefix The string used to prefix the file number if files are being
|
* @param prefix The string used to prefix the file number if files are being
|
||||||
* numbered rather than named */
|
* numbered rather than named */
|
||||||
int ExportMultipleByTrack(bool byName, wxString prefix);
|
int ExportMultipleByTrack(bool byName, wxString prefix, bool addNumber);
|
||||||
|
|
||||||
/** Export one file of an export multiple set
|
/** Export one file of an export multiple set
|
||||||
*
|
*
|
||||||
@ -149,11 +149,9 @@ private:
|
|||||||
wxRadioButton *mTrack; /**< button to choose export based on tracks */
|
wxRadioButton *mTrack; /**< button to choose export based on tracks */
|
||||||
wxStaticText *mTrackLabel;
|
wxStaticText *mTrackLabel;
|
||||||
|
|
||||||
wxRadioButton *mByName; /**< button to choose naming exported file from label text */
|
wxRadioButton *mByNumberAndName; /**< button to choose number AND name for exported files */
|
||||||
wxStaticText *mByNameLabel;
|
wxRadioButton *mByName; /**< button to choose naming exported file from label text */
|
||||||
|
|
||||||
wxRadioButton *mByNumber; /**< button to choose numbering exported files */
|
wxRadioButton *mByNumber; /**< button to choose numbering exported files */
|
||||||
wxStaticText *mByNumberLabel;
|
|
||||||
|
|
||||||
wxStaticText *mPrefixLabel;
|
wxStaticText *mPrefixLabel;
|
||||||
wxTextCtrl *mPrefix;
|
wxTextCtrl *mPrefix;
|
||||||
@ -171,7 +169,8 @@ class SuccessDialog : public wxDialog
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
SuccessDialog(wxWindow *parent, wxWindowID id, const wxString &title) :
|
SuccessDialog(wxWindow *parent, wxWindowID id, const wxString &title) :
|
||||||
wxDialog(parent, id, title) {};
|
wxDialog(parent, id, title, wxDefaultPosition,
|
||||||
|
wxDefaultSize, wxDEFAULT_DIALOG_STYLE | wxRESIZE_BORDER) {};
|
||||||
void OnKeyDown(wxListEvent& event); // dismisses dialog when <enter> is pressed with list control having focus
|
void OnKeyDown(wxListEvent& event); // dismisses dialog when <enter> is pressed with list control having focus
|
||||||
void OnItemActivated(wxListEvent& event); // dismisses dialog when <enter> is pressed with list item having focus
|
void OnItemActivated(wxListEvent& event); // dismisses dialog when <enter> is pressed with list item having focus
|
||||||
private:
|
private:
|
||||||
|
Loading…
x
Reference in New Issue
Block a user