1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-06-16 16:10:06 +02:00

Nyquist prompt updates

Based on Robert's and Steve's suggestions, I removed the "Clear"
button, replaced FileDialog usage with wxFileDialog to restore
extension suffixing, and escaped newlines in save settings so
that chains work properly.

I also attempted to locate the issue where code isn't being
parsed and made a couple of changes, but I doubt I got it.
This commit is contained in:
Leland Lucius 2015-04-19 22:17:40 -05:00
parent 79b7caac07
commit 0f3358248b
3 changed files with 40 additions and 43 deletions

View File

@ -61,26 +61,26 @@ public:
virtual ~EffectAutomationParameters()
{
}
virtual bool DoReadString(const wxString & key, wxString *pStr) const
{
return wxFileConfig::DoReadString(NormalizeName(key), pStr);
}
virtual bool DoReadLong(const wxString & key, long *pl) const
{
return wxFileConfig::DoReadLong(NormalizeName(key), pl);
}
virtual bool DoWriteString(const wxString & key, const wxString & szValue)
{
return wxFileConfig::DoWriteString(NormalizeName(key), szValue);
}
virtual bool DoWriteLong(const wxString & key, long lValue)
{
return wxFileConfig::DoWriteLong(NormalizeName(key), lValue);
}
virtual bool DoReadString(const wxString & key, wxString *pStr) const
{
return wxFileConfig::DoReadString(NormalizeName(key), pStr);
}
virtual bool DoReadLong(const wxString & key, long *pl) const
{
return wxFileConfig::DoReadLong(NormalizeName(key), pl);
}
virtual bool DoWriteString(const wxString & key, const wxString & szValue)
{
return wxFileConfig::DoWriteString(NormalizeName(key), szValue);
}
virtual bool DoWriteLong(const wxString & key, long lValue)
{
return wxFileConfig::DoWriteLong(NormalizeName(key), lValue);
}
bool ReadFloat(const wxString & key, float *pf) const
{
@ -259,12 +259,14 @@ public:
{
val.Replace(wxT("\\"), wxT("\\\\"), true);
val.Replace(wxT("\""), wxT("\\\""), true);
val.Replace(wxT("\n"), wxT("\\n"), true);
return val;
}
wxString Unescape(wxString val)
{
val.Replace(wxT("\\n"), wxT("\n"), true);
val.Replace(wxT("\\\""), wxT("\""), true);
val.Replace(wxT("\\\\"), wxT("\\"), true);

View File

@ -71,7 +71,6 @@ enum
ID_Version,
ID_Load,
ID_Save,
ID_Clear,
ID_Debug,
ID_Slider = 11000,
@ -96,7 +95,6 @@ WX_DEFINE_OBJARRAY(NyqControlArray);
BEGIN_EVENT_TABLE(NyquistEffect, wxEvtHandler)
EVT_BUTTON(ID_Load, NyquistEffect::OnLoad)
EVT_BUTTON(ID_Save, NyquistEffect::OnSave)
EVT_BUTTON(ID_Clear, NyquistEffect::OnClear)
EVT_BUTTON(ID_Debug, NyquistEffect::OnDebug)
EVT_COMMAND_RANGE(ID_Slider, ID_Slider+99,
@ -626,7 +624,7 @@ bool NyquistEffect::ShowInterface(wxWindow *parent, bool forceModal)
{
// Show the normal (prompt or effect) interface
bool res = Effect::ShowInterface(parent, forceModal);
printf("res = %d %d %d\n", res, mIsPrompt, (int)mControls.GetCount());
// We're done if the user clicked "Close", we are not the Nyquist Prompt,
// or the program currently loaded into the prompt doesn't have a UI.
if (!res || !mIsPrompt || mControls.GetCount() == 0)
@ -1787,7 +1785,6 @@ void NyquistEffect::BuildPromptWindow(ShuttleGui & S)
{
S.Id(ID_Load).AddButton(_("&Load"));
S.Id(ID_Save).AddButton(_("&Save"));
S.Id(ID_Clear).AddButton(_("&Clear"));
S.AddSpace(10, 1);
S.Id(ID_Debug).AddButton(_("&Debug"));
}
@ -1901,12 +1898,12 @@ void NyquistEffect::OnLoad(wxCommandEvent & WXUNUSED(evt))
}
}
FileDialog dlog(mUIParent,
_("Load Nyquist script"),
mFileName.GetPath(),
wxEmptyString,
_("Nyquist scripts (*.ny)|*.ny|Lisp scripts (*.lsp)|*.lsp|All files|*"),
wxFD_OPEN | wxRESIZE_BORDER);
wxFileDialog dlog(mUIParent,
_("Load Nyquist script"),
mFileName.GetPath(),
wxEmptyString,
_("Nyquist scripts (*.ny)|*.ny|Lisp scripts (*.lsp)|*.lsp|Text files (*.txt)|*.txt|All files|*"),
wxFD_OPEN | wxRESIZE_BORDER);
if (dlog.ShowModal() != wxID_OK)
{
@ -1923,12 +1920,12 @@ void NyquistEffect::OnLoad(wxCommandEvent & WXUNUSED(evt))
void NyquistEffect::OnSave(wxCommandEvent & WXUNUSED(evt))
{
FileDialog dlog(mUIParent,
_("Save Nyquist script"),
mFileName.GetPath(),
mFileName.GetFullName(),
_("Nyquist scripts (*.ny)|*.ny|Lisp scripts (*.lsp)|*.lsp|All files|*"),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER);
wxFileDialog dlog(mUIParent,
_("Save Nyquist script"),
mFileName.GetPath(),
mFileName.GetFullName(),
_("Nyquist scripts (*.ny)|*.ny|Lisp scripts (*.lsp)|*.lsp|All files|*"),
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER);
if (dlog.ShowModal() != wxID_OK)
{
@ -1943,16 +1940,13 @@ void NyquistEffect::OnSave(wxCommandEvent & WXUNUSED(evt))
}
}
void NyquistEffect::OnClear(wxCommandEvent & WXUNUSED(evt))
{
mCommandText->Clear();
}
void NyquistEffect::OnDebug(wxCommandEvent & WXUNUSED(evt))
{
TransferDataFromPromptWindow();
NyquistEffect effect(NYQUIST_WORKER_ID);
effect.SetCommand(mCommandText->GetValue());
effect.SetCommand(mInputCmd);
effect.mDebug = true;
SelectedRegion region(mT0, mT1);
@ -1971,6 +1965,8 @@ void NyquistEffect::OnDebug(wxCommandEvent & WXUNUSED(evt))
dlog.CentreOnParent();
dlog.ShowModal();
SaveUserPreset(GetCurrentSettingsGroup());
return;
}

View File

@ -155,7 +155,6 @@ private:
void OnLoad(wxCommandEvent & evt);
void OnSave(wxCommandEvent & evt);
void OnClear(wxCommandEvent & evt);
void OnDebug(wxCommandEvent & evt);
void OnText(wxCommandEvent & evt);