mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-30 07:29:29 +02:00
Finish the job of commit 7638dd0, for i18n of file dialog masks...
... Work reamained for effect presets, and for file dialogs made from Nyquist scripts. The four Nyquist scripts using file dialogs were rewritten in a new format. This keeps strange characters like | and * out of the strings given to translators. Instead there are only descriptions of file types. Also fixed a bug in static initialization of tables of file types, and removes inclusions of wx/filedlg.h, and the last uses of class wxFileDialog.
This commit is contained in:
commit
928f3c8788
@ -20,7 +20,8 @@ $copyright (_ "Released under terms of the GNU General Public License version 2"
|
|||||||
$control fxname (_ "Select target EQ effect") choice (("Graphic" (_ "Graphic EQ"))
|
$control fxname (_ "Select target EQ effect") choice (("Graphic" (_ "Graphic EQ"))
|
||||||
("FilterCurve" (_ "Filter Curve EQ"))) 0
|
("FilterCurve" (_ "Filter Curve EQ"))) 0
|
||||||
|
|
||||||
$control infile (_ "Equalization XML file") file "" "*default*/EQCurves.xml" "XML file|*.xml;*.XML|All files|*.*;*" "open,exists"
|
$control infile (_ "Equalization XML file") file "" "*default*/EQCurves.xml" (((_ "XML file") (xml XML))
|
||||||
|
((_ "All files") (""))) "open,exists"
|
||||||
|
|
||||||
$control overwrite (_ "If output text file exists") choice (("Append" (_ "Append number"))
|
$control overwrite (_ "If output text file exists") choice (("Append" (_ "Append number"))
|
||||||
("Overwrite" (_ "Overwrite"))
|
("Overwrite" (_ "Overwrite"))
|
||||||
|
@ -17,7 +17,12 @@ $copyright (_ "Released under terms of the GNU General Public License version 2"
|
|||||||
|
|
||||||
|
|
||||||
;i18n-hint: "Browse..." is text on a button that launches a file browser.
|
;i18n-hint: "Browse..." is text on a button that launches a file browser.
|
||||||
$control files (_ "Select file(s) to install") file (_ "Browse...") "~/Desktop/" "Plug-in|*.ny;*.NY|Lisp file|*.lsp;*.LSP|HTML file|*.htm;*.HTM;*.html;*.HTML|Text file|*.txt;*.TXT|All supported|*.ny;*.NY;*.lsp;*.LSP;*.htm;*.HTM;*.html;*.HTML;*.txt;*.TXT|All files|*.*;*" "open,exists,multiple"
|
$control files (_ "Select file(s) to install") file (_ "Browse...") "~/Desktop/" (((_ "Plug-in") (ny NY))
|
||||||
|
((_ "Lisp file") (lsp LSP))
|
||||||
|
((_ "HTML file") (htm HTM html HTML))
|
||||||
|
((_ "Text file") (txt TXT))
|
||||||
|
((_ "All supported") (ny NY lsp LSP htm HTM html HTML txt TXT))
|
||||||
|
((_ "All files") (""))) "open,exists,multiple"
|
||||||
$control overwrite (_ "Allow overwriting") choice ((_ "Disallow") (_ "Allow")) 0
|
$control overwrite (_ "Allow overwriting") choice ((_ "Disallow") (_ "Allow")) 0
|
||||||
|
|
||||||
|
|
||||||
|
@ -12,7 +12,10 @@ $copyright (_ "Released under terms of the GNU General Public License version 2"
|
|||||||
|
|
||||||
$control number (_ "Limit output to first") int-text (_ "samples") 100 1 1000000
|
$control number (_ "Limit output to first") int-text (_ "samples") 100 1 1000000
|
||||||
$control units (_ "Measurement scale") choice ((_ "dB") (_ "Linear")) 0
|
$control units (_ "Measurement scale") choice ((_ "dB") (_ "Linear")) 0
|
||||||
$control filename (_ "Export data to") file (_ "Select a file") "*default*/sample-data.txt" "Text file|*.txt;*.TXT|CSV files|*.csv;*.CSV|HTML files|*.html;*.HTML;*.htm;*.HTM|All files|*.*;*" "save,overwrite"
|
$control filename (_ "Export data to") file (_ "Select a file") "*default*/sample-data.txt" (((_ "Text file") (txt TXT))
|
||||||
|
((_ "CSV files") (csv CSV))
|
||||||
|
((_ "HTML files") (html HTML htm HTM))
|
||||||
|
((_ "All files") (""))) "save,overwrite"
|
||||||
$control fileformat (_ "Index (text files only)") choice ((_ "None")
|
$control fileformat (_ "Index (text files only)") choice ((_ "None")
|
||||||
("Count" (_ "Sample Count"))
|
("Count" (_ "Sample Count"))
|
||||||
("Time" (_ "Time Indexed")))
|
("Time" (_ "Time Indexed")))
|
||||||
|
@ -8,7 +8,8 @@ $author (_ "Steve Daulton")
|
|||||||
$release 2.3.0
|
$release 2.3.0
|
||||||
$copyright (_ "Released under terms of the GNU General Public License version 2")
|
$copyright (_ "Released under terms of the GNU General Public License version 2")
|
||||||
|
|
||||||
$control filename (_ "Select file") file "" "*default*/sample-data.txt" "Text file|*.txt;*.TXT|All files|*.*;*" "open,exists"
|
$control filename (_ "Select file") file "" "*default*/sample-data.txt" (((_ "Text file") (txt TXT))
|
||||||
|
((_ "All files") (""))) "open,exists"
|
||||||
$control bad-data (_ "Invalid data handling") choice (("ThrowError" (_ "Throw Error"))
|
$control bad-data (_ "Invalid data handling") choice (("ThrowError" (_ "Throw Error"))
|
||||||
("ReadAsZero" (_ "Read as Zero"))) 0
|
("ReadAsZero" (_ "Read as Zero"))) 0
|
||||||
|
|
||||||
|
@ -31,7 +31,6 @@
|
|||||||
|
|
||||||
#include <wx/wx.h>
|
#include <wx/wx.h>
|
||||||
#include <wx/bitmap.h>
|
#include <wx/bitmap.h>
|
||||||
#include <wx/filedlg.h>
|
|
||||||
#include <wx/filefn.h>
|
#include <wx/filefn.h>
|
||||||
#include <wx/image.h>
|
#include <wx/image.h>
|
||||||
#include <wx/ffile.h>
|
#include <wx/ffile.h>
|
||||||
|
@ -21,7 +21,6 @@ processing. See also MacrosWindow and ApplyMacroDialog.
|
|||||||
|
|
||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
#include <wx/dir.h>
|
#include <wx/dir.h>
|
||||||
#include <wx/filedlg.h>
|
|
||||||
#include <wx/textfile.h>
|
#include <wx/textfile.h>
|
||||||
|
|
||||||
#include "Project.h"
|
#include "Project.h"
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
#include <wx/checkbox.h>
|
#include <wx/checkbox.h>
|
||||||
#include <wx/choice.h>
|
#include <wx/choice.h>
|
||||||
#include <wx/filedlg.h>
|
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
#include <wx/statbox.h>
|
#include <wx/statbox.h>
|
||||||
|
@ -25,7 +25,6 @@ of the BlockFile system.
|
|||||||
#include <wx/checkbox.h>
|
#include <wx/checkbox.h>
|
||||||
#include <wx/choice.h>
|
#include <wx/choice.h>
|
||||||
#include <wx/dialog.h>
|
#include <wx/dialog.h>
|
||||||
#include <wx/filedlg.h>
|
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
#include <wx/stattext.h>
|
#include <wx/stattext.h>
|
||||||
#include <wx/timer.h>
|
#include <wx/timer.h>
|
||||||
|
@ -27,7 +27,6 @@ License: GPL v2. See License.txt.
|
|||||||
#include <wx/checkbox.h>
|
#include <wx/checkbox.h>
|
||||||
#include <wx/dynlib.h>
|
#include <wx/dynlib.h>
|
||||||
#include <wx/file.h>
|
#include <wx/file.h>
|
||||||
#include <wx/filedlg.h>
|
|
||||||
#include <wx/log.h>
|
#include <wx/log.h>
|
||||||
#include <wx/textctrl.h>
|
#include <wx/textctrl.h>
|
||||||
|
|
||||||
|
@ -48,7 +48,6 @@ the mouse around.
|
|||||||
#include <wx/font.h>
|
#include <wx/font.h>
|
||||||
#include <wx/image.h>
|
#include <wx/image.h>
|
||||||
#include <wx/file.h>
|
#include <wx/file.h>
|
||||||
#include <wx/filedlg.h>
|
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#include <wx/scrolbar.h>
|
#include <wx/scrolbar.h>
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
|
@ -21,7 +21,6 @@
|
|||||||
#include <wx/choice.h>
|
#include <wx/choice.h>
|
||||||
#include <wx/dc.h>
|
#include <wx/dc.h>
|
||||||
#include <wx/dialog.h>
|
#include <wx/dialog.h>
|
||||||
#include <wx/filedlg.h>
|
|
||||||
#include <wx/grid.h>
|
#include <wx/grid.h>
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#include <wx/scrolbar.h>
|
#include <wx/scrolbar.h>
|
||||||
|
@ -55,7 +55,6 @@
|
|||||||
|
|
||||||
#include <wx/button.h>
|
#include <wx/button.h>
|
||||||
#include <wx/choice.h>
|
#include <wx/choice.h>
|
||||||
#include <wx/filedlg.h>
|
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#include <wx/listctrl.h>
|
#include <wx/listctrl.h>
|
||||||
|
@ -34,7 +34,6 @@
|
|||||||
#include <wx/dir.h>
|
#include <wx/dir.h>
|
||||||
#include <wx/datectrl.h>
|
#include <wx/datectrl.h>
|
||||||
#include <wx/datetime.h>
|
#include <wx/datetime.h>
|
||||||
#include <wx/filedlg.h>
|
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#include <wx/progdlg.h>
|
#include <wx/progdlg.h>
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
|
@ -25,7 +25,6 @@ or "OFF" point
|
|||||||
#include <math.h>
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
|
|
||||||
#include <wx/filedlg.h>
|
|
||||||
#include <wx/textfile.h>
|
#include <wx/textfile.h>
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
@ -35,7 +35,6 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#include <wx/button.h>
|
#include <wx/button.h>
|
||||||
#include <wx/filedlg.h>
|
|
||||||
#include <wx/valtext.h>
|
#include <wx/valtext.h>
|
||||||
#include <wx/log.h>
|
#include <wx/log.h>
|
||||||
#include <wx/wfstream.h>
|
#include <wx/wfstream.h>
|
||||||
|
@ -663,6 +663,15 @@ bool Effect::CanExportPresets()
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static const FileNames::FileTypes &PresetTypes()
|
||||||
|
{
|
||||||
|
static const FileNames::FileTypes result {
|
||||||
|
{ XO("Presets"), { wxT("txt") }, true },
|
||||||
|
FileNames::AllFiles
|
||||||
|
};
|
||||||
|
return result;
|
||||||
|
};
|
||||||
|
|
||||||
void Effect::ExportPresets()
|
void Effect::ExportPresets()
|
||||||
{
|
{
|
||||||
wxString params;
|
wxString params;
|
||||||
@ -672,11 +681,11 @@ void Effect::ExportPresets()
|
|||||||
|
|
||||||
auto path = FileNames::DefaultToDocumentsFolder(wxT("Presets/Path"));
|
auto path = FileNames::DefaultToDocumentsFolder(wxT("Presets/Path"));
|
||||||
|
|
||||||
wxFileDialog dlog(NULL,
|
FileDialogWrapper dlog(nullptr,
|
||||||
_("Export Effect Parameters"),
|
XO("Export Effect Parameters"),
|
||||||
path.GetFullPath(),
|
path.GetFullPath(),
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
_("Presets (*.txt)|*.txt|All files|*"),
|
PresetTypes(),
|
||||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER);
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER);
|
||||||
|
|
||||||
if (dlog.ShowModal() != wxID_OK) {
|
if (dlog.ShowModal() != wxID_OK) {
|
||||||
@ -721,11 +730,11 @@ void Effect::ImportPresets()
|
|||||||
|
|
||||||
auto path = FileNames::DefaultToDocumentsFolder(wxT("Presets/Path"));
|
auto path = FileNames::DefaultToDocumentsFolder(wxT("Presets/Path"));
|
||||||
|
|
||||||
wxFileDialog dlog(NULL,
|
FileDialogWrapper dlog(nullptr,
|
||||||
_("Import Effect Parameters"),
|
XO("Import Effect Parameters"),
|
||||||
path.GetPath(),
|
path.GetPath(),
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
_("Presets (*.txt)|*.txt|All files|*"),
|
PresetTypes(),
|
||||||
wxFD_OPEN | wxRESIZE_BORDER);
|
wxFD_OPEN | wxRESIZE_BORDER);
|
||||||
|
|
||||||
if (dlog.ShowModal() != wxID_OK) {
|
if (dlog.ShowModal() != wxID_OK) {
|
||||||
|
@ -3721,16 +3721,20 @@ void EditCurvesDialog::OnDelete(wxCommandEvent & WXUNUSED(event))
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
static const auto XMLtypes = FileNames::FileTypes{
|
static const FileNames::FileTypes &XMLtypes()
|
||||||
FileNames::XMLFiles
|
{
|
||||||
};
|
static const FileNames::FileTypes results{
|
||||||
|
FileNames::XMLFiles
|
||||||
|
};
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
void EditCurvesDialog::OnImport( wxCommandEvent & WXUNUSED(event))
|
void EditCurvesDialog::OnImport( wxCommandEvent & WXUNUSED(event))
|
||||||
{
|
{
|
||||||
FileDialogWrapper filePicker(
|
FileDialogWrapper filePicker(
|
||||||
this,
|
this,
|
||||||
XO("Choose an EQ curve file"), FileNames::DataDir(), wxT(""),
|
XO("Choose an EQ curve file"), FileNames::DataDir(), wxT(""),
|
||||||
XMLtypes );
|
XMLtypes() );
|
||||||
wxString fileName;
|
wxString fileName;
|
||||||
if( filePicker.ShowModal() == wxID_CANCEL)
|
if( filePicker.ShowModal() == wxID_CANCEL)
|
||||||
return;
|
return;
|
||||||
@ -3752,7 +3756,7 @@ void EditCurvesDialog::OnExport( wxCommandEvent & WXUNUSED(event))
|
|||||||
{
|
{
|
||||||
FileDialogWrapper filePicker(this, XO("Export EQ curves as..."),
|
FileDialogWrapper filePicker(this, XO("Export EQ curves as..."),
|
||||||
FileNames::DataDir(), wxT(""),
|
FileNames::DataDir(), wxT(""),
|
||||||
XMLtypes,
|
XMLtypes(),
|
||||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER); // wxFD_CHANGE_DIR?
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER); // wxFD_CHANGE_DIR?
|
||||||
wxString fileName;
|
wxString fileName;
|
||||||
if( filePicker.ShowModal() == wxID_CANCEL)
|
if( filePicker.ShowModal() == wxID_CANCEL)
|
||||||
|
@ -37,7 +37,6 @@ It \TODO: description
|
|||||||
#include <wx/image.h>
|
#include <wx/image.h>
|
||||||
#include <wx/dcmemory.h>
|
#include <wx/dcmemory.h>
|
||||||
#include <wx/file.h>
|
#include <wx/file.h>
|
||||||
#include <wx/filedlg.h>
|
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
#include <wx/stattext.h>
|
#include <wx/stattext.h>
|
||||||
|
@ -1657,6 +1657,48 @@ std::vector<EnumValueSymbol> NyquistEffect::ParseChoice(const wxString & text)
|
|||||||
return results;
|
return results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
FileExtensions NyquistEffect::ParseFileExtensions(const wxString & text)
|
||||||
|
{
|
||||||
|
// todo: error handling
|
||||||
|
FileExtensions results;
|
||||||
|
if (text[0] == wxT('(')) {
|
||||||
|
Tokenizer tzer;
|
||||||
|
tzer.Tokenize(text, true, 1, 1);
|
||||||
|
for (const auto &token : tzer.tokens)
|
||||||
|
results.push_back( UnQuote( token ) );
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileNames::FileType NyquistEffect::ParseFileType(const wxString & text)
|
||||||
|
{
|
||||||
|
// todo: error handling
|
||||||
|
FileNames::FileType result;
|
||||||
|
if (text[0] == wxT('(')) {
|
||||||
|
Tokenizer tzer;
|
||||||
|
tzer.Tokenize(text, true, 1, 1);
|
||||||
|
auto &tokens = tzer.tokens;
|
||||||
|
if ( tokens.size() == 2 )
|
||||||
|
result =
|
||||||
|
{ UnQuoteMsgid( tokens[0] ), ParseFileExtensions( tokens[1] ) };
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
}
|
||||||
|
|
||||||
|
FileNames::FileTypes NyquistEffect::ParseFileTypes(const wxString & text)
|
||||||
|
{
|
||||||
|
// todo: error handling
|
||||||
|
FileNames::FileTypes results;
|
||||||
|
if (text[0] == wxT('(')) {
|
||||||
|
Tokenizer tzer;
|
||||||
|
tzer.Tokenize(text, true, 1, 1);
|
||||||
|
auto &types = tzer.tokens;
|
||||||
|
for (auto &type : types)
|
||||||
|
results.push_back( ParseFileType( type ) );
|
||||||
|
}
|
||||||
|
return results;
|
||||||
|
}
|
||||||
|
|
||||||
void NyquistEffect::RedirectOutput()
|
void NyquistEffect::RedirectOutput()
|
||||||
{
|
{
|
||||||
mRedirectOutput = true;
|
mRedirectOutput = true;
|
||||||
@ -1686,7 +1728,7 @@ void NyquistEffect::Stop()
|
|||||||
mStop = true;
|
mStop = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString NyquistEffect::UnQuote(const wxString &s, bool allowParens,
|
TranslatableString NyquistEffect::UnQuoteMsgid(const wxString &s, bool allowParens,
|
||||||
wxString *pExtraString)
|
wxString *pExtraString)
|
||||||
{
|
{
|
||||||
if (pExtraString)
|
if (pExtraString)
|
||||||
@ -1695,7 +1737,8 @@ wxString NyquistEffect::UnQuote(const wxString &s, bool allowParens,
|
|||||||
int len = s.length();
|
int len = s.length();
|
||||||
if (len >= 2 && s[0] == wxT('\"') && s[len - 1] == wxT('\"')) {
|
if (len >= 2 && s[0] == wxT('\"') && s[len - 1] == wxT('\"')) {
|
||||||
auto unquoted = s.Mid(1, len - 2);
|
auto unquoted = s.Mid(1, len - 2);
|
||||||
return wxGetTranslation( unquoted );
|
// Sorry, no context strings, yet
|
||||||
|
return TranslatableString{ unquoted, {} };
|
||||||
}
|
}
|
||||||
else if (allowParens &&
|
else if (allowParens &&
|
||||||
len >= 2 && s[0] == wxT('(') && s[len - 1] == wxT(')')) {
|
len >= 2 && s[0] == wxT('(') && s[len - 1] == wxT(')')) {
|
||||||
@ -1708,12 +1751,13 @@ wxString NyquistEffect::UnQuote(const wxString &s, bool allowParens,
|
|||||||
// ("InternalString" (_ "Visible string"))
|
// ("InternalString" (_ "Visible string"))
|
||||||
// Recur to find the two strings
|
// Recur to find the two strings
|
||||||
*pExtraString = UnQuote(tokens[0], false);
|
*pExtraString = UnQuote(tokens[0], false);
|
||||||
return UnQuote(tokens[1]);
|
return UnQuoteMsgid(tokens[1]);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
// Assume the first token was _ -- we don't check that
|
// Assume the first token was _ -- we don't check that
|
||||||
// And the second is the string, which is internationalized
|
// And the second is the string, which is internationalized
|
||||||
return UnQuote( tokens[1], false );
|
// Sorry, no context strings, yet
|
||||||
|
return UnQuoteMsgid( tokens[1], false );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -1721,7 +1765,13 @@ wxString NyquistEffect::UnQuote(const wxString &s, bool allowParens,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
// If string was not quoted, assume no translation exists
|
// If string was not quoted, assume no translation exists
|
||||||
return s;
|
return Verbatim( s );
|
||||||
|
}
|
||||||
|
|
||||||
|
wxString NyquistEffect::UnQuote(const wxString &s, bool allowParens,
|
||||||
|
wxString *pExtraString)
|
||||||
|
{
|
||||||
|
return UnQuoteMsgid( s, allowParens, pExtraString ).Translation();
|
||||||
}
|
}
|
||||||
|
|
||||||
double NyquistEffect::GetCtrlValue(const wxString &s)
|
double NyquistEffect::GetCtrlValue(const wxString &s)
|
||||||
@ -2088,6 +2138,13 @@ bool NyquistEffect::Parse(
|
|||||||
ctrl.choices = ParseChoice(ctrl.label);
|
ctrl.choices = ParseChoice(ctrl.label);
|
||||||
ctrl.label = wxT("");
|
ctrl.label = wxT("");
|
||||||
}
|
}
|
||||||
|
else if (tokens[3] == wxT("file")) {
|
||||||
|
ctrl.type = NYQ_CTRL_FILE;
|
||||||
|
ctrl.fileTypes = ParseFileTypes(tokens[6]);
|
||||||
|
// will determine file dialog styles:
|
||||||
|
ctrl.highStr = UnQuote( tokens[7] );
|
||||||
|
ctrl.label = wxT("");
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
ctrl.label = UnQuote( ctrl.label );
|
ctrl.label = UnQuote( ctrl.label );
|
||||||
|
|
||||||
@ -2106,8 +2163,6 @@ bool NyquistEffect::Parse(
|
|||||||
ctrl.type = NYQ_CTRL_INT_TEXT;
|
ctrl.type = NYQ_CTRL_INT_TEXT;
|
||||||
else if (tokens[3] == wxT("time"))
|
else if (tokens[3] == wxT("time"))
|
||||||
ctrl.type = NYQ_CTRL_TIME;
|
ctrl.type = NYQ_CTRL_TIME;
|
||||||
else if (tokens[3] == wxT("file"))
|
|
||||||
ctrl.type = NYQ_CTRL_FILE;
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
wxString str;
|
wxString str;
|
||||||
@ -2767,18 +2822,11 @@ void NyquistEffect::BuildEffectWindow(ShuttleGui & S)
|
|||||||
S.AddSpace(10, 10);
|
S.AddSpace(10, 10);
|
||||||
|
|
||||||
// Get default file extension if specified in wildcards
|
// Get default file extension if specified in wildcards
|
||||||
wxString defaultExtension;
|
FileExtension defaultExtension;
|
||||||
size_t len = ctrl.lowStr.length();
|
if (!ctrl.fileTypes.empty()) {
|
||||||
int characters = ctrl.lowStr.Find("*");
|
const auto &type = ctrl.fileTypes[0];
|
||||||
|
if ( !type.extensions.empty() )
|
||||||
if (characters != wxNOT_FOUND)
|
defaultExtension = type.extensions[0];
|
||||||
{
|
|
||||||
if (static_cast<int>(ctrl.lowStr.find("|", characters)) != wxNOT_FOUND)
|
|
||||||
len = ctrl.lowStr.find("|", characters) - 1;
|
|
||||||
if (static_cast<int>(ctrl.lowStr.find(";", characters)) != wxNOT_FOUND)
|
|
||||||
len = std::min(static_cast<int>(len), static_cast<int>(ctrl.lowStr.find(";", characters)) - 1);
|
|
||||||
|
|
||||||
defaultExtension = ctrl.lowStr.wxString::Mid(characters + 1, len - characters);
|
|
||||||
}
|
}
|
||||||
resolveFilePath(ctrl.valStr, defaultExtension);
|
resolveFilePath(ctrl.valStr, defaultExtension);
|
||||||
|
|
||||||
@ -3014,36 +3062,6 @@ void NyquistEffect::OnFileButton(wxCommandEvent& evt)
|
|||||||
{
|
{
|
||||||
int i = evt.GetId() - ID_FILE;
|
int i = evt.GetId() - ID_FILE;
|
||||||
NyqControl & ctrl = mControls[i];
|
NyqControl & ctrl = mControls[i];
|
||||||
ctrl.lowStr.Trim(true).Trim(false); // Wildcard filter.
|
|
||||||
|
|
||||||
// Basic sanity check of wildcard flags so that we
|
|
||||||
// don't show scary wxFAIL_MSG from wxParseCommonDialogsFilter.
|
|
||||||
if (!ctrl.lowStr.empty())
|
|
||||||
{
|
|
||||||
bool validWildcards = true;
|
|
||||||
size_t wildcards = 0;
|
|
||||||
wxStringTokenizer tokenizer(ctrl.lowStr, "|");
|
|
||||||
while (tokenizer.HasMoreTokens())
|
|
||||||
{
|
|
||||||
wxString token = tokenizer.GetNextToken().Trim(true).Trim(false);
|
|
||||||
if (token.empty())
|
|
||||||
{
|
|
||||||
validWildcards = false;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
wildcards += 1;
|
|
||||||
}
|
|
||||||
// Users should not normally see this, unless they are writing Nyquist plug-ins.
|
|
||||||
if (wildcards % 2 != 0 || !validWildcards || ctrl.lowStr.EndsWith("|"))
|
|
||||||
{
|
|
||||||
Effect::MessageBox(
|
|
||||||
XO("Invalid wildcard string in 'path' control.'\n"
|
|
||||||
"Using empty string instead."),
|
|
||||||
wxOK | wxICON_EXCLAMATION | wxCENTRE,
|
|
||||||
XO("Error") );
|
|
||||||
ctrl.lowStr = "";
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Get style flags:
|
// Get style flags:
|
||||||
// Ensure legal combinations so that wxWidgets does not throw an assert error.
|
// Ensure legal combinations so that wxWidgets does not throw an assert error.
|
||||||
@ -3087,18 +3105,18 @@ void NyquistEffect::OnFileButton(wxCommandEvent& evt)
|
|||||||
wxFileName fname = ctrl.valStr;
|
wxFileName fname = ctrl.valStr;
|
||||||
wxString defaultDir = fname.GetPath();
|
wxString defaultDir = fname.GetPath();
|
||||||
wxString defaultFile = fname.GetName();
|
wxString defaultFile = fname.GetName();
|
||||||
wxString message = _("Select a file");
|
auto message = XO("Select a file");
|
||||||
|
|
||||||
if (flags & wxFD_MULTIPLE)
|
if (flags & wxFD_MULTIPLE)
|
||||||
message = _("Select one or more files");
|
message = XO("Select one or more files");
|
||||||
else if (flags & wxFD_SAVE)
|
else if (flags & wxFD_SAVE)
|
||||||
message = _("Save file as");
|
message = XO("Save file as");
|
||||||
|
|
||||||
wxFileDialog openFileDialog(mUIParent->FindWindow(ID_FILE + i),
|
FileDialogWrapper openFileDialog(mUIParent->FindWindow(ID_FILE + i),
|
||||||
message,
|
message,
|
||||||
defaultDir,
|
defaultDir,
|
||||||
defaultFile,
|
defaultFile,
|
||||||
ctrl.lowStr, // wildcard filter
|
ctrl.fileTypes,
|
||||||
flags); // styles
|
flags); // styles
|
||||||
|
|
||||||
if (openFileDialog.ShowModal() == wxID_CANCEL)
|
if (openFileDialog.ShowModal() == wxID_CANCEL)
|
||||||
@ -3128,7 +3146,7 @@ void NyquistEffect::OnFileButton(wxCommandEvent& evt)
|
|||||||
mUIParent->FindWindow(ID_Text + i)->GetValidator()->TransferToWindow();
|
mUIParent->FindWindow(ID_Text + i)->GetValidator()->TransferToWindow();
|
||||||
}
|
}
|
||||||
|
|
||||||
void NyquistEffect::resolveFilePath(wxString& path, wxString extension /* empty string */)
|
void NyquistEffect::resolveFilePath(wxString& path, FileExtension extension /* empty string */)
|
||||||
{
|
{
|
||||||
#if defined(__WXMSW__)
|
#if defined(__WXMSW__)
|
||||||
path.Replace("/", wxFileName::GetPathSeparator());
|
path.Replace("/", wxFileName::GetPathSeparator());
|
||||||
@ -3181,7 +3199,7 @@ void NyquistEffect::resolveFilePath(wxString& path, wxString extension /* empty
|
|||||||
{
|
{
|
||||||
path = fname.GetPathWithSep() + _("untitled");
|
path = fname.GetPathWithSep() + _("untitled");
|
||||||
if (!extension.empty())
|
if (!extension.empty())
|
||||||
path = path + extension;
|
path = path + '.' + extension;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -12,6 +12,7 @@
|
|||||||
#define __AUDACITY_EFFECT_NYQUIST__
|
#define __AUDACITY_EFFECT_NYQUIST__
|
||||||
|
|
||||||
#include "../Effect.h"
|
#include "../Effect.h"
|
||||||
|
#include "../../FileNames.h"
|
||||||
|
|
||||||
#include "nyx.h"
|
#include "nyx.h"
|
||||||
|
|
||||||
@ -49,6 +50,7 @@ public:
|
|||||||
wxString name;
|
wxString name;
|
||||||
wxString label;
|
wxString label;
|
||||||
std::vector<EnumValueSymbol> choices;
|
std::vector<EnumValueSymbol> choices;
|
||||||
|
FileNames::FileTypes fileTypes;
|
||||||
wxString valStr;
|
wxString valStr;
|
||||||
wxString lowStr;
|
wxString lowStr;
|
||||||
wxString highStr;
|
wxString highStr;
|
||||||
@ -137,6 +139,10 @@ private:
|
|||||||
wxString EscapeString(const wxString & inStr);
|
wxString EscapeString(const wxString & inStr);
|
||||||
static std::vector<EnumValueSymbol> ParseChoice(const wxString & text);
|
static std::vector<EnumValueSymbol> ParseChoice(const wxString & text);
|
||||||
|
|
||||||
|
FileExtensions ParseFileExtensions(const wxString & text);
|
||||||
|
FileNames::FileType ParseFileType(const wxString & text);
|
||||||
|
FileNames::FileTypes ParseFileTypes(const wxString & text);
|
||||||
|
|
||||||
static int StaticGetCallback(float *buffer, int channel,
|
static int StaticGetCallback(float *buffer, int channel,
|
||||||
long start, long len, long totlen,
|
long start, long len, long totlen,
|
||||||
void *userdata);
|
void *userdata);
|
||||||
@ -161,7 +167,7 @@ private:
|
|||||||
bool q { false };
|
bool q { false };
|
||||||
int paren{ 0 };
|
int paren{ 0 };
|
||||||
wxString tok;
|
wxString tok;
|
||||||
wxArrayString tokens;
|
wxArrayStringEx tokens;
|
||||||
|
|
||||||
bool Tokenize(
|
bool Tokenize(
|
||||||
const wxString &line, bool eof,
|
const wxString &line, bool eof,
|
||||||
@ -169,6 +175,8 @@ private:
|
|||||||
};
|
};
|
||||||
bool Parse(Tokenizer &tokenizer, const wxString &line, bool eof, bool first);
|
bool Parse(Tokenizer &tokenizer, const wxString &line, bool eof, bool first);
|
||||||
|
|
||||||
|
static TranslatableString UnQuoteMsgid(const wxString &s, bool allowParens = true,
|
||||||
|
wxString *pExtraString = nullptr);
|
||||||
static wxString UnQuote(const wxString &s, bool allowParens = true,
|
static wxString UnQuote(const wxString &s, bool allowParens = true,
|
||||||
wxString *pExtraString = nullptr);
|
wxString *pExtraString = nullptr);
|
||||||
double GetCtrlValue(const wxString &s);
|
double GetCtrlValue(const wxString &s);
|
||||||
@ -183,7 +191,7 @@ private:
|
|||||||
void OnTime(wxCommandEvent & evt);
|
void OnTime(wxCommandEvent & evt);
|
||||||
void OnFileButton(wxCommandEvent & evt);
|
void OnFileButton(wxCommandEvent & evt);
|
||||||
|
|
||||||
void resolveFilePath(wxString & path, wxString extension = {});
|
void resolveFilePath(wxString & path, FileExtension extension = {});
|
||||||
bool validatePath(wxString path);
|
bool validatePath(wxString path);
|
||||||
wxString ToTimeFormat(double t);
|
wxString ToTimeFormat(double t);
|
||||||
|
|
||||||
|
@ -19,7 +19,6 @@
|
|||||||
#include <wx/button.h>
|
#include <wx/button.h>
|
||||||
#include <wx/cmdline.h>
|
#include <wx/cmdline.h>
|
||||||
#include <wx/combobox.h>
|
#include <wx/combobox.h>
|
||||||
#include <wx/filedlg.h>
|
|
||||||
#include <wx/log.h>
|
#include <wx/log.h>
|
||||||
#include <wx/process.h>
|
#include <wx/process.h>
|
||||||
#include <wx/sizer.h>
|
#include <wx/sizer.h>
|
||||||
|
@ -2278,8 +2278,11 @@ void ExportFFmpegOptions::OnLoadPreset(wxCommandEvent& WXUNUSED(event))
|
|||||||
DoOnCodecList();
|
DoOnCodecList();
|
||||||
}
|
}
|
||||||
|
|
||||||
static const FileNames::FileTypes FileTypes{
|
static const FileNames::FileTypes &FileTypes()
|
||||||
FileNames::XMLFiles, FileNames::AllFiles
|
{
|
||||||
|
static const FileNames::FileTypes result{
|
||||||
|
FileNames::XMLFiles, FileNames::AllFiles };
|
||||||
|
return result;
|
||||||
};
|
};
|
||||||
|
|
||||||
///
|
///
|
||||||
@ -2291,7 +2294,7 @@ void ExportFFmpegOptions::OnImportPresets(wxCommandEvent& WXUNUSED(event))
|
|||||||
XO("Select xml file with presets to import"),
|
XO("Select xml file with presets to import"),
|
||||||
gPrefs->Read(wxT("/FileFormats/FFmpegPresetDir")),
|
gPrefs->Read(wxT("/FileFormats/FFmpegPresetDir")),
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
FileTypes,
|
FileTypes(),
|
||||||
wxFD_OPEN);
|
wxFD_OPEN);
|
||||||
if (dlg.ShowModal() == wxID_CANCEL) return;
|
if (dlg.ShowModal() == wxID_CANCEL) return;
|
||||||
path = dlg.GetPath();
|
path = dlg.GetPath();
|
||||||
@ -2324,7 +2327,7 @@ void ExportFFmpegOptions::OnExportPresets(wxCommandEvent& WXUNUSED(event))
|
|||||||
XO("Select xml file to export presets into"),
|
XO("Select xml file to export presets into"),
|
||||||
gPrefs->Read(wxT("/FileFormats/FFmpegPresetDir")),
|
gPrefs->Read(wxT("/FileFormats/FFmpegPresetDir")),
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
FileTypes,
|
FileTypes(),
|
||||||
wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
|
wxFD_SAVE|wxFD_OVERWRITE_PROMPT);
|
||||||
if (dlg.ShowModal() == wxID_CANCEL) return;
|
if (dlg.ShowModal() == wxID_CANCEL) return;
|
||||||
path = dlg.GetPath();
|
path = dlg.GetPath();
|
||||||
|
@ -69,7 +69,6 @@
|
|||||||
#include <wx/checkbox.h>
|
#include <wx/checkbox.h>
|
||||||
#include <wx/dynlib.h>
|
#include <wx/dynlib.h>
|
||||||
#include <wx/ffile.h>
|
#include <wx/ffile.h>
|
||||||
#include <wx/filedlg.h>
|
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#include <wx/log.h>
|
#include <wx/log.h>
|
||||||
#include <wx/mimetype.h>
|
#include <wx/mimetype.h>
|
||||||
|
@ -26,7 +26,6 @@
|
|||||||
#include <wx/dirdlg.h>
|
#include <wx/dirdlg.h>
|
||||||
#include <wx/event.h>
|
#include <wx/event.h>
|
||||||
#include <wx/listbase.h>
|
#include <wx/listbase.h>
|
||||||
#include <wx/filedlg.h>
|
|
||||||
#include <wx/filefn.h>
|
#include <wx/filefn.h>
|
||||||
#include <wx/filename.h>
|
#include <wx/filename.h>
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
|
@ -27,7 +27,6 @@ KeyConfigPrefs and MousePrefs use.
|
|||||||
#include <wx/defs.h>
|
#include <wx/defs.h>
|
||||||
#include <wx/ffile.h>
|
#include <wx/ffile.h>
|
||||||
#include <wx/intl.h>
|
#include <wx/intl.h>
|
||||||
#include <wx/filedlg.h>
|
|
||||||
#include <wx/menu.h>
|
#include <wx/menu.h>
|
||||||
#include <wx/button.h>
|
#include <wx/button.h>
|
||||||
#include <wx/radiobut.h>
|
#include <wx/radiobut.h>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user