mirror of
https://github.com/cookiengineer/audacity
synced 2025-08-05 06:39:26 +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:
parent
79b7caac07
commit
0f3358248b
@ -259,12 +259,14 @@ public:
|
|||||||
{
|
{
|
||||||
val.Replace(wxT("\\"), wxT("\\\\"), true);
|
val.Replace(wxT("\\"), wxT("\\\\"), true);
|
||||||
val.Replace(wxT("\""), wxT("\\\""), true);
|
val.Replace(wxT("\""), wxT("\\\""), true);
|
||||||
|
val.Replace(wxT("\n"), wxT("\\n"), true);
|
||||||
|
|
||||||
return val;
|
return val;
|
||||||
}
|
}
|
||||||
|
|
||||||
wxString Unescape(wxString val)
|
wxString Unescape(wxString val)
|
||||||
{
|
{
|
||||||
|
val.Replace(wxT("\\n"), wxT("\n"), true);
|
||||||
val.Replace(wxT("\\\""), wxT("\""), true);
|
val.Replace(wxT("\\\""), wxT("\""), true);
|
||||||
val.Replace(wxT("\\\\"), wxT("\\"), true);
|
val.Replace(wxT("\\\\"), wxT("\\"), true);
|
||||||
|
|
||||||
|
@ -71,7 +71,6 @@ enum
|
|||||||
ID_Version,
|
ID_Version,
|
||||||
ID_Load,
|
ID_Load,
|
||||||
ID_Save,
|
ID_Save,
|
||||||
ID_Clear,
|
|
||||||
ID_Debug,
|
ID_Debug,
|
||||||
|
|
||||||
ID_Slider = 11000,
|
ID_Slider = 11000,
|
||||||
@ -96,7 +95,6 @@ WX_DEFINE_OBJARRAY(NyqControlArray);
|
|||||||
BEGIN_EVENT_TABLE(NyquistEffect, wxEvtHandler)
|
BEGIN_EVENT_TABLE(NyquistEffect, wxEvtHandler)
|
||||||
EVT_BUTTON(ID_Load, NyquistEffect::OnLoad)
|
EVT_BUTTON(ID_Load, NyquistEffect::OnLoad)
|
||||||
EVT_BUTTON(ID_Save, NyquistEffect::OnSave)
|
EVT_BUTTON(ID_Save, NyquistEffect::OnSave)
|
||||||
EVT_BUTTON(ID_Clear, NyquistEffect::OnClear)
|
|
||||||
EVT_BUTTON(ID_Debug, NyquistEffect::OnDebug)
|
EVT_BUTTON(ID_Debug, NyquistEffect::OnDebug)
|
||||||
|
|
||||||
EVT_COMMAND_RANGE(ID_Slider, ID_Slider+99,
|
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
|
// Show the normal (prompt or effect) interface
|
||||||
bool res = Effect::ShowInterface(parent, forceModal);
|
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,
|
// 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.
|
// or the program currently loaded into the prompt doesn't have a UI.
|
||||||
if (!res || !mIsPrompt || mControls.GetCount() == 0)
|
if (!res || !mIsPrompt || mControls.GetCount() == 0)
|
||||||
@ -1787,7 +1785,6 @@ void NyquistEffect::BuildPromptWindow(ShuttleGui & S)
|
|||||||
{
|
{
|
||||||
S.Id(ID_Load).AddButton(_("&Load"));
|
S.Id(ID_Load).AddButton(_("&Load"));
|
||||||
S.Id(ID_Save).AddButton(_("&Save"));
|
S.Id(ID_Save).AddButton(_("&Save"));
|
||||||
S.Id(ID_Clear).AddButton(_("&Clear"));
|
|
||||||
S.AddSpace(10, 1);
|
S.AddSpace(10, 1);
|
||||||
S.Id(ID_Debug).AddButton(_("&Debug"));
|
S.Id(ID_Debug).AddButton(_("&Debug"));
|
||||||
}
|
}
|
||||||
@ -1901,12 +1898,12 @@ void NyquistEffect::OnLoad(wxCommandEvent & WXUNUSED(evt))
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
FileDialog dlog(mUIParent,
|
wxFileDialog dlog(mUIParent,
|
||||||
_("Load Nyquist script"),
|
_("Load Nyquist script"),
|
||||||
mFileName.GetPath(),
|
mFileName.GetPath(),
|
||||||
wxEmptyString,
|
wxEmptyString,
|
||||||
_("Nyquist scripts (*.ny)|*.ny|Lisp scripts (*.lsp)|*.lsp|All files|*"),
|
_("Nyquist scripts (*.ny)|*.ny|Lisp scripts (*.lsp)|*.lsp|Text files (*.txt)|*.txt|All files|*"),
|
||||||
wxFD_OPEN | wxRESIZE_BORDER);
|
wxFD_OPEN | wxRESIZE_BORDER);
|
||||||
|
|
||||||
if (dlog.ShowModal() != wxID_OK)
|
if (dlog.ShowModal() != wxID_OK)
|
||||||
{
|
{
|
||||||
@ -1923,12 +1920,12 @@ void NyquistEffect::OnLoad(wxCommandEvent & WXUNUSED(evt))
|
|||||||
|
|
||||||
void NyquistEffect::OnSave(wxCommandEvent & WXUNUSED(evt))
|
void NyquistEffect::OnSave(wxCommandEvent & WXUNUSED(evt))
|
||||||
{
|
{
|
||||||
FileDialog dlog(mUIParent,
|
wxFileDialog dlog(mUIParent,
|
||||||
_("Save Nyquist script"),
|
_("Save Nyquist script"),
|
||||||
mFileName.GetPath(),
|
mFileName.GetPath(),
|
||||||
mFileName.GetFullName(),
|
mFileName.GetFullName(),
|
||||||
_("Nyquist scripts (*.ny)|*.ny|Lisp scripts (*.lsp)|*.lsp|All files|*"),
|
_("Nyquist scripts (*.ny)|*.ny|Lisp scripts (*.lsp)|*.lsp|All files|*"),
|
||||||
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER);
|
wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER);
|
||||||
|
|
||||||
if (dlog.ShowModal() != wxID_OK)
|
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))
|
void NyquistEffect::OnDebug(wxCommandEvent & WXUNUSED(evt))
|
||||||
{
|
{
|
||||||
|
TransferDataFromPromptWindow();
|
||||||
|
|
||||||
NyquistEffect effect(NYQUIST_WORKER_ID);
|
NyquistEffect effect(NYQUIST_WORKER_ID);
|
||||||
|
|
||||||
effect.SetCommand(mCommandText->GetValue());
|
effect.SetCommand(mInputCmd);
|
||||||
effect.mDebug = true;
|
effect.mDebug = true;
|
||||||
|
|
||||||
SelectedRegion region(mT0, mT1);
|
SelectedRegion region(mT0, mT1);
|
||||||
@ -1971,6 +1965,8 @@ void NyquistEffect::OnDebug(wxCommandEvent & WXUNUSED(evt))
|
|||||||
dlog.CentreOnParent();
|
dlog.CentreOnParent();
|
||||||
dlog.ShowModal();
|
dlog.ShowModal();
|
||||||
|
|
||||||
|
SaveUserPreset(GetCurrentSettingsGroup());
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -155,7 +155,6 @@ private:
|
|||||||
|
|
||||||
void OnLoad(wxCommandEvent & evt);
|
void OnLoad(wxCommandEvent & evt);
|
||||||
void OnSave(wxCommandEvent & evt);
|
void OnSave(wxCommandEvent & evt);
|
||||||
void OnClear(wxCommandEvent & evt);
|
|
||||||
void OnDebug(wxCommandEvent & evt);
|
void OnDebug(wxCommandEvent & evt);
|
||||||
|
|
||||||
void OnText(wxCommandEvent & evt);
|
void OnText(wxCommandEvent & evt);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user