Audacity  3.0.3
Public Member Functions | Static Public Member Functions | Private Member Functions | Private Attributes | List of all members
NyqBench Class Reference

#include <NyqBench.h>

Inheritance diagram for NyqBench:
[legend]
Collaboration diagram for NyqBench:
[legend]

Public Member Functions

 NyqBench (wxWindow *parent)
 
virtual ~NyqBench ()
 
virtual bool Validate ()
 
void ShowNyqBench (const CommandContext &)
 
void SavePrefs ()
 

Static Public Member Functions

static NyqBenchGetBench ()
 

Private Member Functions

void PopulateOrExchange (ShuttleGui &S)
 
void OnClose (wxCloseEvent &e)
 
void OnMove (wxMoveEvent &e)
 
void OnSize (wxSizeEvent &e)
 
void OnNew (wxCommandEvent &e)
 
void OnOpen (wxCommandEvent &e)
 
void OnSave (wxCommandEvent &e)
 
void OnSaveAs (wxCommandEvent &e)
 
void OnRevert (wxCommandEvent &e)
 
void OnAutoLoad (wxCommandEvent &e)
 
void OnCloseWindow (wxCommandEvent &e)
 
void OnUndo (wxCommandEvent &e)
 
void OnRedo (wxCommandEvent &e)
 
void OnCut (wxCommandEvent &e)
 
void OnCopy (wxCommandEvent &e)
 
void OnPaste (wxCommandEvent &e)
 
void OnClear (wxCommandEvent &e)
 
void OnSelectAll (wxCommandEvent &e)
 
void OnFind (wxCommandEvent &e)
 
void OnGoMatch (wxCommandEvent &e)
 
void OnGoTop (wxCommandEvent &e)
 
void OnGoUp (wxCommandEvent &e)
 
void OnGoPrev (wxCommandEvent &e)
 
void OnGoNext (wxCommandEvent &e)
 
void OnAutoWrap (wxCommandEvent &e)
 
void OnFont (wxCommandEvent &e)
 
void OnSplitV (wxCommandEvent &e)
 
void OnSplitH (wxCommandEvent &e)
 
void OnToggleCode (wxCommandEvent &e)
 
void OnToggleOutput (wxCommandEvent &e)
 
void OnSmallIcons (wxCommandEvent &e)
 
void OnLargeIcons (wxCommandEvent &e)
 
void OnGo (wxCommandEvent &e)
 
void OnStop (wxCommandEvent &e)
 
void OnAbout (wxCommandEvent &e)
 
void OnFindDialog (wxFindDialogEvent &e)
 
void OnTextUpdate (wxCommandEvent &e)
 
void OnMenuUpdate (wxUpdateUIEvent &e)
 
void OnUndoUpdate (wxUpdateUIEvent &e)
 
void OnRedoUpdate (wxUpdateUIEvent &e)
 
void OnCutUpdate (wxUpdateUIEvent &e)
 
void OnCopyUpdate (wxUpdateUIEvent &e)
 
void OnPasteUpdate (wxUpdateUIEvent &e)
 
void OnClearUpdate (wxUpdateUIEvent &e)
 
void OnViewUpdate (wxUpdateUIEvent &e)
 
void OnRunUpdate (wxUpdateUIEvent &e)
 
void OnScriptUpdate (wxUpdateUIEvent &e)
 
void OnOutputUpdate (wxUpdateUIEvent &e)
 
void SetWindowTitle ()
 
void RecreateToolbar (bool large=false)
 
void LoadFile ()
 
 DECLARE_EVENT_TABLE ()
 

Private Attributes

wxStaticBox * mScriptBox
 
wxStaticBox * mOutputBox
 
NyqTextCtrlmScript
 
NyqTextCtrlmOutput
 
wxSplitterWindow * mSplitter
 
wxFindReplaceDialog * mFindDlg
 
wxFindReplaceData mFindData
 
NyqTextCtrlmFindText
 
NyquistEffectmEffect
 
wxFont mScriptFont
 
wxFont mOutputFont
 
wxBitmap mPics [20]
 
int mSplitMode
 
bool mShowCode
 
bool mShowOutput
 
bool mLargeIcons
 
bool mRunning
 
wxFileName mPath
 
bool mAutoLoad
 
bool mAutoWrap
 
wxRect mLastSize
 

Detailed Description

Definition at line 99 of file NyqBench.h.

Constructor & Destructor Documentation

◆ NyqBench()

NyqBench::NyqBench ( wxWindow *  parent)

Definition at line 649 of file NyqBench.cpp.

650 : wxFrame(NULL,
651  wxID_ANY,
652  wxEmptyString,
653  wxDefaultPosition,
654  wxDefaultSize,
655  wxDEFAULT_FRAME_STYLE |
656  wxMINIMIZE_BOX |
657  wxMAXIMIZE_BOX |
658  wxRESIZE_BORDER)
659 {
660  mFindDlg = NULL;
661  mRunning = false;
662  mScriptBox = NULL;
663  mOutputBox = NULL;
664  mScript = NULL;
665  mOutput = NULL;
666 
667  mPath = gPrefs->Read(wxT("NyqBench/Path"), wxEmptyString);
668  mAutoLoad = (gPrefs->Read(wxT("NyqBench/AutoLoad"), 0L) != 0);
669  mAutoWrap = (gPrefs->Read(wxT("NyqBench/AutoWrap"), true) != 0);
670  mLargeIcons = (gPrefs->Read(wxT("NyqBench/LargeIcons"), 0L) != 0);
671  mSplitMode = gPrefs->Read(wxT("NyqBench/SplitMode"), wxSPLIT_VERTICAL);
672  mShowCode = (gPrefs->Read(wxT("NyqBench/ShowScript"), true) != 0);
673  mShowOutput = (gPrefs->Read(wxT("NyqBench/ShowOutput"), true) != 0);
674 
675  SetIcon(wxICON(AudacityLogo));
676  SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
677  ShuttleGui S(this, eIsCreating);
679  wxMenuBar *bar = new wxMenuBar();
680 
681  wxMenu *menu = new wxMenu();
682  menu->Append(wxID_NEW, wxT("&New\tCtrl+N"));
683  menu->Append(wxID_OPEN, wxT("&Open...\tCtrl+O"));
684  menu->Append(wxID_SAVE, wxT("&Save...\tCtrl+S"));
685  menu->Append(wxID_SAVEAS, wxT("Save &As...\tCtrl+Shift+S"));
686  menu->AppendSeparator();
687  menu->Append(wxID_REVERT_TO_SAVED, _T("&Revert to Saved"));
688  menu->AppendSeparator();
689  menu->AppendCheckItem(ID_AUTOLOAD, _T("Auto &Load Last File"))->Check(mAutoLoad);
690  menu->AppendSeparator();
691  menu->Append(wxID_CLOSE, wxT("&Close Window\tCtrl+W"));
692  bar->Append(menu, wxT("&File"));
693 
694  menu = new wxMenu();
695  menu->Append(wxID_UNDO, _("&Undo\tCtrl+Z"));
696  menu->Append(wxID_REDO, _("&Redo\tCtrl+Y"));
697  menu->AppendSeparator();
698  menu->Append(wxID_CUT, _("Cu&t\tCtrl+X"));
699  menu->Append(wxID_COPY, _("&Copy\tCtrl+C"));
700  menu->Append(wxID_PASTE, _("&Paste\tCtrl+V"));
701  menu->Append(wxID_CLEAR, _("Cle&ar\tCtrl+L"));
702  menu->AppendSeparator();
703  menu->Append(wxID_SELECTALL, _("Select A&ll\tCtrl+A"));
704  menu->AppendSeparator();
705  menu->Append(wxID_FIND, _("&Find...\tCtrl+F"));
706  menu->AppendSeparator();
707  wxMenu *sub = new wxMenu();
708  sub->Append(ID_MATCH, _("&Matching Paren\tF8"));
709  sub->Append(ID_TOP, _("&Top S-expr\tF9"));
710  sub->Append(ID_UP, _("&Higher S-expr\tF10"));
711  sub->Append(ID_PREVIOUS, _("&Previous S-expr\tF11"));
712  sub->Append(ID_NEXT, _("&Next S-expr\tF12"));
713  menu->AppendSubMenu(sub, _("&Go to"));
714  menu->AppendSeparator();
715  menu->AppendCheckItem(ID_AUTOWRAP, _T("Auto &Wrap"))->Check(mAutoWrap);
716  bar->Append(menu, wxT("&Edit"));
717 
718  menu = new wxMenu();
719  menu->Append(ID_FONT, _("Select &Font..."));
720  menu->AppendSeparator();
721  menu->Append(ID_SPLITV, _("Split &Vertically"));
722  menu->Append(ID_SPLITH, _("Split &Horizontally"));
723  menu->AppendSeparator();
724  menu->AppendCheckItem(ID_TOGGLECODE, _("Show S&cript"));
725  menu->AppendCheckItem(ID_TOGGLEOUTPUT, _("Show &Output"));
726  menu->AppendSeparator();
727  sub = new wxMenu();
728  sub->AppendRadioItem(ID_LARGEICONS, _("&Large Icons"));
729  sub->AppendRadioItem(ID_SMALLICONS, _("&Small Icons"));
730  menu->AppendSubMenu(sub, _("Toolbar"));
731  bar->Append(menu, wxT("&View"));
732 
733  menu = new wxMenu();
734  menu->Append(ID_GO, _("&Go\tF5"));
735  menu->Append(ID_STOP, _("&Stop\tF6"));
736  bar->Append(menu, wxT("&Run"));
737 
738 #if defined(__WXMAC__)
739  menu->Append(wxID_ABOUT, _("&About"));
740 #else
741  menu = new wxMenu();
742  menu->Append(wxID_ABOUT, _("&About"));
743  bar->Append(menu, wxT("Help"));
744 #endif
745 
746  SetMenuBar(bar);
747 
749 
750  wxRect r;
751  r.SetX(gPrefs->Read(wxT("NyqBench/Window/X"), -1));
752  r.SetY(gPrefs->Read(wxT("NyqBench/Window/Y"), -1));
753  r.SetWidth(gPrefs->Read(wxT("NyqBench/Window/Width"), -1));
754  r.SetHeight(gPrefs->Read(wxT("NyqBench/Window/Height"), -1));
755  if (r == wxRect(-1, -1, -1, -1)) {
756  Center();
757  }
758  else {
759  SetSize(r);
760  }
761 
762  bool maximized = false;
763  gPrefs->Read(wxT("NyqBench/Window/Maximized"), maximized);
764  if (maximized) {
765  Maximize();
766  }
767 
768  long sashpos;
769  sashpos = gPrefs->Read(wxT("NyqBench/SplitX"), 0l);
770  if (sashpos > 0) {
771  mSplitter->SetSashPosition(sashpos);
772  }
773 
774  wxString dflt = wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT).GetNativeFontInfoDesc();
775  wxString desc;
776  wxTextAttr attr;
777 
778  desc = gPrefs->Read(wxT("NyqBench/ScriptFont"), dflt);
779  mScriptFont.SetNativeFontInfo(desc);
780 #if defined(__WXMSW__)
781  // Force SYSTEM encoding to prevent conversion to Unicode in wxTextCtrl::DoWriteText().
782  // I don't know if this is something I'm doing wrong, but I'll have to look at this
783  // later if I get bored.
784  mScriptFont.SetEncoding(wxFONTENCODING_SYSTEM);
785 #endif
786  attr.SetFont(mScriptFont);
787  mScript->SetDefaultStyle(attr);
788 
789  desc = gPrefs->Read(wxT("NyqBench/OutputFont"), dflt);
790  mOutputFont.SetNativeFontInfo(desc);
791 #if defined(__WXMSW__)
792  // Force SYSTEM encoding to prevent conversion to Unicode in wxTextCtrl::DoWriteText().
793  // I don't know if this is something I'm doing wrong, but I'll have to look at this
794  // later if I get bored.
795  mOutputFont.SetEncoding(wxFONTENCODING_SYSTEM);
796 #endif
797  attr.SetFont(mOutputFont);
798  mOutput->SetDefaultStyle(attr);
799 
800  if (mAutoLoad && !mPath.GetFullPath().IsEmpty()) {
801  LoadFile();
802  }
803 
804  SetWindowTitle();
805 }

References _, desc, eIsCreating, gPrefs, ID_AUTOLOAD, ID_AUTOWRAP, ID_FONT, ID_GO, ID_LARGEICONS, ID_MATCH, ID_NEXT, ID_PREVIOUS, ID_SMALLICONS, ID_SPLITH, ID_SPLITV, ID_STOP, ID_TOGGLECODE, ID_TOGGLEOUTPUT, ID_TOP, ID_UP, LoadFile(), mAutoLoad, mAutoWrap, mFindDlg, mLargeIcons, mOutput, mOutputBox, mOutputFont, mPath, mRunning, mScript, mScriptBox, mScriptFont, mShowCode, mShowOutput, mSplitMode, mSplitter, PopulateOrExchange(), RecreateToolbar(), S, and SetWindowTitle().

Here is the call graph for this function:

◆ ~NyqBench()

NyqBench::~NyqBench ( )
virtual

Definition at line 807 of file NyqBench.cpp.

808 {
809 }

Member Function Documentation

◆ DECLARE_EVENT_TABLE()

NyqBench::DECLARE_EVENT_TABLE ( )
private

◆ GetBench()

NyqBench * NyqBench::GetBench ( )
static

Definition at line 639 of file NyqBench.cpp.

640 {
641  if (gBench == nullptr)
642  {
643  gBench = new NyqBench(NULL);
644  }
645 
646  return gBench;
647 }

References gBench.

Referenced by anonymous_namespace{NyqBench.cpp}::findme().

Here is the caller graph for this function:

◆ LoadFile()

void NyqBench::LoadFile ( )
private

Definition at line 1697 of file NyqBench.cpp.

1698 {
1699  wxString path = mPath.GetFullPath();
1700 
1701  if (path.IsEmpty()) {
1702  return;
1703  }
1704 
1705  wxFFile f(path);
1706  if (f.IsOpened()) {
1707  wxString t;
1708  if (f.ReadAll(&t)) {
1709 //#if defined(__WXGTK__) || defined(__WXMAC__)
1710  t.Replace(wxT("\r\n"), wxT("\n"));
1711  t.Replace(wxT("\r"), wxT("\n"));
1712 //#elif defined(__WXMSW__)
1713 // t.Replace("\r\n", "\n");
1714 //#endif
1715  mScript->SetValue(t);
1716  mScript->DiscardEdits();
1717  }
1718  }
1719 
1720 // mScript->LoadFile(mPath.GetFullPath());
1721 }

References mPath, and mScript.

Referenced by NyqBench(), OnOpen(), and OnRevert().

Here is the caller graph for this function:

◆ OnAbout()

void NyqBench::OnAbout ( wxCommandEvent &  e)
private

Definition at line 1367 of file NyqBench.cpp.

1368 {
1369  wxAboutDialogInfo i;
1370 
1371  i.AddArtist(_("Harvey Lubin (logo)"));
1372  i.AddArtist(_("Tango Icon Gallery (toolbar icons)"));
1373  i.AddDeveloper(_("Leland Lucius"));
1374  i.SetCopyright(_("(C) 2009 by Leland Lucius"));
1375  i.SetDescription(_("External Audacity module which provides a simple IDE for writing effects."));
1376  i.SetName(_("Nyquist Effect Workbench"));
1377  i.SetVersion(__TDATE__);
1378 
1379  wxAboutBox(i);
1380 }

References _.

◆ OnAutoLoad()

void NyqBench::OnAutoLoad ( wxCommandEvent &  e)
private

Definition at line 1076 of file NyqBench.cpp.

1077 {
1078  mAutoLoad = e.IsChecked();
1079 }

References mAutoLoad.

◆ OnAutoWrap()

void NyqBench::OnAutoWrap ( wxCommandEvent &  e)
private

Definition at line 1182 of file NyqBench.cpp.

1183 {
1184  mAutoWrap = e.IsChecked();
1185 
1186  wxWindow *parent = mScript->GetParent();
1187  wxString text = mScript->GetValue();
1188  bool focused = wxWindow::FindFocus() == mScript;
1189  long pos = mScript->GetInsertionPoint();
1190  long from;
1191  long to;
1192  mScript->GetSelection(&from, &to);
1193 
1194  wxSizer *s = mScript->GetContainingSizer();
1195  s->Detach(mScript);
1196  delete mScript;
1197 
1198  mScript = new NyqTextCtrl(parent,
1199  ID_SCRIPT,
1200  wxEmptyString,
1201  wxDefaultPosition,
1202  wxDefaultSize,
1203  (mAutoWrap ? wxTE_BESTWRAP : wxTE_DONTWRAP) |
1204  wxTE_NOHIDESEL | wxTE_RICH2 |
1205  wxTE_MULTILINE);
1206  s->Add(mScript, 1, wxEXPAND);
1207  s->Layout();
1208 
1209  mScript->ChangeValue(text);
1210  mScript->SetInsertionPoint(pos);
1211  mScript->SetSelection(from, to);
1212 
1213  if (focused) {
1214  mScript->SetFocus();
1215  }
1216 }

References ID_SCRIPT, mAutoWrap, and mScript.

◆ OnClear()

void NyqBench::OnClear ( wxCommandEvent &  e)
private

Definition at line 1119 of file NyqBench.cpp.

1120 {
1121  (FindFocus() == mScript ? mScript : mOutput)->Clear();
1122 }

References mOutput, and mScript.

◆ OnClearUpdate()

void NyqBench::OnClearUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1514 of file NyqBench.cpp.

1515 {
1516  e.Enable(FindFocus() == mOutput ? true : false);
1517 }

References mOutput.

◆ OnClose()

void NyqBench::OnClose ( wxCloseEvent &  e)
private

Definition at line 949 of file NyqBench.cpp.

950 {
951  if (!Validate()) {
952  e.Veto();
953  }
954  else {
955  Show(false);
956  }
957 }

References Validate().

Here is the call graph for this function:

◆ OnCloseWindow()

void NyqBench::OnCloseWindow ( wxCommandEvent &  e)
private

Definition at line 975 of file NyqBench.cpp.

976 {
977  Close();
978 }

◆ OnCopy()

void NyqBench::OnCopy ( wxCommandEvent &  e)
private

Definition at line 1109 of file NyqBench.cpp.

1110 {
1111  (FindFocus() == mScript ? mScript : mOutput)->Copy();
1112 }

References mOutput, and mScript.

◆ OnCopyUpdate()

void NyqBench::OnCopyUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1504 of file NyqBench.cpp.

1505 {
1506  e.Enable((FindFocus() == mScript ? mScript : mOutput)->CanCopy());
1507 }

References mOutput, and mScript.

◆ OnCut()

void NyqBench::OnCut ( wxCommandEvent &  e)
private

Definition at line 1104 of file NyqBench.cpp.

1105 {
1106  (FindFocus() == mScript ? mScript : mOutput)->Cut();
1107 }

References mOutput, and mScript.

◆ OnCutUpdate()

void NyqBench::OnCutUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1499 of file NyqBench.cpp.

1500 {
1501  e.Enable((FindFocus() == mScript ? mScript : mOutput)->CanCut());
1502 }

References mOutput, and mScript.

◆ OnFind()

void NyqBench::OnFind ( wxCommandEvent &  e)
private

Definition at line 1129 of file NyqBench.cpp.

1130 {
1131  if (mFindDlg ) {
1132  delete mFindDlg;
1133  mFindDlg = NULL;
1134  }
1135  else {
1136  NyqTextCtrl *w = (NyqTextCtrl *) FindFocus();
1137  if (w == mScript || w == mOutput) {
1138  mFindText = w;
1139 
1140  int flags = 0;
1141 
1142  flags |= (gPrefs->Read(wxT("NyqBench/Find/Down"), 0L) ? wxFR_DOWN : 0);
1143  flags |= (gPrefs->Read(wxT("NyqBench/Find/Word"), 0L) ? wxFR_WHOLEWORD : 0);
1144  flags |= (gPrefs->Read(wxT("NyqBench/Find/Case"), 0L) ? wxFR_MATCHCASE : 0);
1145 
1146  mFindData.SetFlags(flags);
1147 
1148  mFindDlg = new wxFindReplaceDialog(this,
1149  &mFindData,
1150  _("Find dialog"),
1151  wxFR_NOWHOLEWORD);
1152  mFindDlg->Show(true);
1153  }
1154  }
1155 }

References _, gPrefs, mFindData, mFindDlg, mFindText, mOutput, and mScript.

◆ OnFindDialog()

void NyqBench::OnFindDialog ( wxFindDialogEvent &  e)
private

Definition at line 1382 of file NyqBench.cpp.

1383 {
1384  wxEventType type = e.GetEventType();
1385 
1386  if (type == wxEVT_COMMAND_FIND_CLOSE) {
1387  wxFindReplaceDialog *dlg = e.GetDialog();
1388 
1389  dlg->Destroy();
1390 
1391  int flags = mFindData.GetFlags();
1392 
1393  gPrefs->Write(wxT("NyqBench/Find/Down"), (flags & wxFR_DOWN) != 0);
1394  gPrefs->Write(wxT("NyqBench/Find/Word"), (flags & wxFR_WHOLEWORD) != 0);
1395  gPrefs->Write(wxT("NyqBench/Find/Case"), (flags & wxFR_MATCHCASE) != 0);
1396 
1397  mFindDlg = NULL;
1398  mFindText = NULL;
1399 
1400  return;
1401  }
1402 
1403  wxString text = mFindText->GetValue();
1404 
1405 #if defined(__WXMSW__)
1406  // We cheat on Windows. We know that the Windows text control
1407  // uses CRLF for line endings and if we don't account for that,
1408  // the selection positions will be off.
1409  //
1410  // Not sure why I thought I needed this, but it appears not to
1411  // be. Leaving just in case.
1412  //
1413  // text.Replace(wxT("\n"), wxT("\r\n"));
1414 #endif
1415 
1416  size_t startpos = mFindText->GetInsertionPoint();
1417  size_t len = mFindText->GetLastPosition();
1418  size_t pos;
1419 
1420  wxString find = e.GetFindString();
1421  bool down = (e.GetFlags() & wxFR_DOWN) != 0;
1422  bool mixed = (e.GetFlags() & wxFR_MATCHCASE) != 0;
1423 
1424  if (!mixed) {
1425  text.MakeUpper();
1426  find.MakeUpper();
1427  }
1428 
1429  if (down) {
1430  pos = text.find(find, startpos);
1431  if (type == wxEVT_COMMAND_FIND_NEXT && pos == startpos && pos < len) {
1432  pos = text.find(find, startpos + 1);
1433  }
1434  }
1435  else {
1436  pos = text.rfind(find, startpos);
1437  if (type == wxEVT_COMMAND_FIND_NEXT && pos == startpos && pos > 0) {
1438  pos = text.rfind(find, startpos - 1);
1439  }
1440  }
1441 
1442  if (pos == wxString::npos) {
1443  AudacityMessageBox(XO("No matches found"),
1444  XO("Nyquist Effect Workbench"),
1445  wxOK | wxCENTER,
1446  e.GetDialog());
1447 
1448  return;
1449  }
1450 
1451  mFindText->SetInsertionPoint((long)pos);
1452 
1453 #if defined(__WXGTK__)
1454  // GTK's selection and intertion pointer interact where the insertion
1455  // pointer winds up after the second parameter, so we reverse them to
1456  // force the pointer at the beginning of the selection. Doing so
1457  // allows reverse find to work properly.
1458  mFindText->SetSelection((long)(pos + find.Length()), (long)pos);
1459 #else
1460  mFindText->SetSelection((long)pos, (long)(pos + find.Length()));
1461 #endif
1462 
1463 #if defined(__WXMAC__)
1464  // Doing this coaxes the text control to update the selection. Without
1465  // it the selection doesn't appear to change if the found string is within
1466  // the currently displayed text, i.e., no reposition is needed.
1467  mFindText->Show(false);
1468  mFindText->Show(true);
1469 #endif
1470 }

References AudacityMessageBox(), gPrefs, mFindData, mFindDlg, mFindText, and XO.

Here is the call graph for this function:

◆ OnFont()

void NyqBench::OnFont ( wxCommandEvent &  e)
private

Definition at line 1218 of file NyqBench.cpp.

1219 {
1220  wxWindow *w = FindFocus();
1221  wxFontData data;
1222  wxFontDialog dlg(this, data);
1223 
1224  if (w != mScript && w != mOutput) {
1225  return;
1226  }
1227 
1228  data.SetInitialFont(w == mScript ? mScriptFont : mOutputFont);
1229 
1230  if (dlg.ShowModal() == wxID_OK) {
1231  wxFontData retData = dlg.GetFontData();
1232  wxFont font = retData.GetChosenFont();
1233  wxTextAttr attr;
1234  attr.SetFont(font);
1235 
1236  if (w == mScript) {
1237  mScriptFont = font;
1238  }
1239  else {
1240  mOutputFont = font;
1241  }
1242 
1243  ((wxTextCtrl *)w)->SetDefaultStyle(attr);
1244  ((wxTextCtrl *)w)->SetStyle(0, ((wxTextCtrl *)w)->GetLastPosition(), attr);
1245  w->Refresh();
1246  }
1247 }

References mOutput, mOutputFont, mScript, and mScriptFont.

◆ OnGo()

void NyqBench::OnGo ( wxCommandEvent &  e)
private

Definition at line 1329 of file NyqBench.cpp.

1330 {
1331  auto pEffect =
1332  std::make_unique<NyquistEffect>(L"Nyquist Effect Workbench");
1333  mEffect = pEffect.get();
1334  const PluginID & ID =
1335  EffectManager::Get().RegisterEffect(std::move(pEffect));
1336 
1337  mEffect->SetCommand(mScript->GetValue());
1339 
1340  auto p = GetActiveProject().lock();
1341  wxASSERT(p);
1342 
1343  if (p) {
1344  wxWindowDisabler disable(this);
1345  NyqRedirector redir((NyqTextCtrl *)mOutput);
1346 
1347  mRunning = true;
1348  UpdateWindowUI();
1349 
1350  EffectUI::DoEffect(ID, CommandContext(*p), 0);
1351 
1352  mRunning = false;
1353  UpdateWindowUI();
1354  }
1355 
1356  Raise();
1357 
1359 }

References EffectUI::DoEffect(), EffectManager::Get(), GetActiveProject(), mEffect, mOutput, mRunning, mScript, NyquistEffect::RedirectOutput(), EffectManager::RegisterEffect(), NyquistEffect::SetCommand(), and EffectManager::UnregisterEffect().

Here is the call graph for this function:

◆ OnGoMatch()

void NyqBench::OnGoMatch ( wxCommandEvent &  e)
private

Definition at line 1157 of file NyqBench.cpp.

1158 {
1159  mScript->GoMatch();
1160 }

References NyqTextCtrl::GoMatch(), and mScript.

Here is the call graph for this function:

◆ OnGoNext()

void NyqBench::OnGoNext ( wxCommandEvent &  e)
private

Definition at line 1177 of file NyqBench.cpp.

1178 {
1179  mScript->GoNext();
1180 }

References NyqTextCtrl::GoNext(), and mScript.

Here is the call graph for this function:

◆ OnGoPrev()

void NyqBench::OnGoPrev ( wxCommandEvent &  e)
private

Definition at line 1172 of file NyqBench.cpp.

1173 {
1174  mScript->GoPrev();
1175 }

References NyqTextCtrl::GoPrev(), and mScript.

Here is the call graph for this function:

◆ OnGoTop()

void NyqBench::OnGoTop ( wxCommandEvent &  e)
private

Definition at line 1162 of file NyqBench.cpp.

1163 {
1164  mScript->GoTop();
1165 }

References NyqTextCtrl::GoTop(), and mScript.

Here is the call graph for this function:

◆ OnGoUp()

void NyqBench::OnGoUp ( wxCommandEvent &  e)
private

Definition at line 1167 of file NyqBench.cpp.

1168 {
1169  mScript->GoUp();
1170 }

References NyqTextCtrl::GoUp(), and mScript.

Here is the call graph for this function:

◆ OnLargeIcons()

void NyqBench::OnLargeIcons ( wxCommandEvent &  e)
private

Definition at line 1324 of file NyqBench.cpp.

1325 {
1326  RecreateToolbar(true);
1327 }

References RecreateToolbar().

Here is the call graph for this function:

◆ OnMenuUpdate()

void NyqBench::OnMenuUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1479 of file NyqBench.cpp.

1480 {
1481  if (e.GetId() != wxID_REVERT_TO_SAVED) {
1482  e.Enable((mScript->GetLastPosition() > 0) || mScript->IsModified());
1483  }
1484  else {
1485  e.Enable(mScript->IsModified());
1486  }
1487 }

References mScript.

◆ OnMove()

void NyqBench::OnMove ( wxMoveEvent &  e)
private

Definition at line 959 of file NyqBench.cpp.

960 {
961  e.Skip();
962  if (!IsIconized() && !IsMaximized()) {
963  mLastSize.SetPosition(e.GetPosition());
964  }
965 }

References mLastSize.

◆ OnNew()

void NyqBench::OnNew ( wxCommandEvent &  e)
private

Definition at line 980 of file NyqBench.cpp.

981 {
982  if (!Validate()) {
983  return;
984  }
985 
986  mPath.SetFullName(wxEmptyString);
987 
988  while (mScript->CanUndo()) {
989  mScript->Undo();
990  }
991 
992  mScript->Clear();
993  mScript->DiscardEdits();
994 
995  SetWindowTitle();
996 }

References mPath, mScript, SetWindowTitle(), and Validate().

Here is the call graph for this function:

◆ OnOpen()

void NyqBench::OnOpen ( wxCommandEvent &  e)
private

Definition at line 998 of file NyqBench.cpp.

999 {
1000  if (mScript->IsModified() && !Validate()) {
1001  return;
1002  }
1003 
1004  wxFileDialog dlog(this,
1005  _("Load Nyquist script"),
1006  mPath.GetPath(),
1007  wxEmptyString,
1008  _("Nyquist scripts (*.ny)|*.ny|Lisp scripts (*.lsp)|*.lsp|All files|*"),
1009  wxFD_OPEN | wxRESIZE_BORDER);
1010 
1011  if (dlog.ShowModal() != wxID_OK) {
1012  return;
1013  }
1014 
1015  mPath = dlog.GetPath();
1016  gPrefs->Write(wxT("NyqBench/Path"), mPath.GetFullPath());
1017 
1018  LoadFile();
1019 
1020  SetWindowTitle();
1021 }

References _, gPrefs, LoadFile(), mPath, mScript, SetWindowTitle(), and Validate().

Here is the call graph for this function:

◆ OnOutputUpdate()

void NyqBench::OnOutputUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1565 of file NyqBench.cpp.

1566 {
1567  if (mOutputBox && mOutput && FindFocus() == mOutput) {
1568  wxString label = mOutputBox->GetLabel();
1569  if (label == _("Output")) {
1570  label += wxT("*");
1571  mOutputBox->SetLabel(label);
1572  mScriptBox->SetLabel(_("Script"));
1573  }
1574  }
1575 }

References _, label, mOutput, mOutputBox, and mScriptBox.

◆ OnPaste()

void NyqBench::OnPaste ( wxCommandEvent &  e)
private

Definition at line 1114 of file NyqBench.cpp.

1115 {
1116  (FindFocus() == mScript ? mScript : mOutput)->Paste();
1117 }

References mOutput, and mScript.

◆ OnPasteUpdate()

void NyqBench::OnPasteUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1509 of file NyqBench.cpp.

1510 {
1511  e.Enable((FindFocus() == mScript ? mScript : mOutput)->CanPaste());
1512 }

References mOutput, and mScript.

◆ OnRedo()

void NyqBench::OnRedo ( wxCommandEvent &  e)
private

Definition at line 1099 of file NyqBench.cpp.

1100 {
1101  (FindFocus() == mScript ? mScript : mOutput)->Redo();
1102 }

References mOutput, and mScript.

◆ OnRedoUpdate()

void NyqBench::OnRedoUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1494 of file NyqBench.cpp.

1495 {
1496  e.Enable((FindFocus() == mScript ? mScript : mOutput)->CanRedo());
1497 }

References mOutput, and mScript.

◆ OnRevert()

void NyqBench::OnRevert ( wxCommandEvent &  e)
private

Definition at line 1081 of file NyqBench.cpp.

1082 {
1083  if (mPath.GetFullPath().IsEmpty()) {
1084  return;
1085  }
1086 
1087  if (!Validate()) {
1088  return;
1089  }
1090 
1091  LoadFile();
1092 }

References LoadFile(), mPath, and Validate().

Here is the call graph for this function:

◆ OnRunUpdate()

void NyqBench::OnRunUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1530 of file NyqBench.cpp.

1531 {
1532  auto p = GetActiveProject().lock();
1533  wxToolBar *tbar = GetToolBar();
1534  wxMenuBar *mbar = GetMenuBar();
1535 
1536  auto gAudioIO = AudioIOBase::Get();
1537  if (p && gAudioIO->IsBusy()) {
1538  mbar->Enable(ID_GO, false);
1539  mbar->Enable(ID_STOP, false);
1540 
1541  tbar->EnableTool(ID_GO, false);
1542  tbar->EnableTool(ID_STOP, false);
1543  }
1544  else {
1545  mbar->Enable(ID_GO, (mScript->GetLastPosition() > 0) && !mRunning);
1546  mbar->Enable(ID_STOP, (mScript->GetLastPosition() > 0) && mRunning);
1547 
1548  tbar->EnableTool(ID_GO, (mScript->GetLastPosition() > 0) && !mRunning);
1549  tbar->EnableTool(ID_STOP, (mScript->GetLastPosition() > 0) && mRunning);
1550  }
1551 }

References AudioIOBase::Get(), GetActiveProject(), ID_GO, ID_STOP, mRunning, and mScript.

Here is the call graph for this function:

◆ OnSave()

void NyqBench::OnSave ( wxCommandEvent &  e)
private

Definition at line 1023 of file NyqBench.cpp.

1024 {
1025  if (mScript->GetLastPosition() == 0) {
1026  return;
1027  }
1028 
1029  if (mPath.GetFullPath().IsEmpty()) {
1030  OnSaveAs(e);
1031  return;
1032  }
1033 
1034  if (!mScript->SaveFile(mPath.GetFullPath()))
1035  {
1036  AudacityMessageBox(XO("Script was not saved."),
1037  XO("Warning"),
1038  wxICON_EXCLAMATION,
1039  this);
1040  return;
1041  }
1042 }

References AudacityMessageBox(), mPath, mScript, OnSaveAs(), and XO.

Here is the call graph for this function:

◆ OnSaveAs()

void NyqBench::OnSaveAs ( wxCommandEvent &  e)
private

Definition at line 1044 of file NyqBench.cpp.

1045 {
1046  if (mScript->GetLastPosition() == 0) {
1047  return;
1048  }
1049 
1050  wxFileDialog dlog(this,
1051  _("Save Nyquist script"),
1052  mPath.GetFullPath(),
1053  wxEmptyString,
1054  _("Nyquist scripts (*.ny)|*.ny|Lisp scripts (*.lsp)|*.lsp|All files|*"),
1055  wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER);
1056 
1057  if (dlog.ShowModal() != wxID_OK) {
1058  return;
1059  }
1060 
1061  mPath = dlog.GetPath();
1062  gPrefs->Write(wxT("NyqBench/Path"), mPath.GetFullPath());
1063 
1064  if (!mScript->SaveFile(mPath.GetFullPath()))
1065  {
1066  AudacityMessageBox(XO("Script was not saved."),
1067  XO("Warning"),
1068  wxICON_EXCLAMATION,
1069  this);
1070  return;
1071  }
1072 
1073  SetWindowTitle();
1074 }

References _, AudacityMessageBox(), gPrefs, mPath, mScript, SetWindowTitle(), and XO.

Referenced by OnSave().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ OnScriptUpdate()

void NyqBench::OnScriptUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1553 of file NyqBench.cpp.

1554 {
1555  if (mScriptBox && mScript && FindFocus() == mScript) {
1556  wxString label = mScriptBox->GetLabel();
1557  if (label == _("Script")) {
1558  label += wxT("*");
1559  mScriptBox->SetLabel(label);
1560  mOutputBox->SetLabel(_("Output"));
1561  }
1562  }
1563 }

References _, label, mOutputBox, mScript, and mScriptBox.

◆ OnSelectAll()

void NyqBench::OnSelectAll ( wxCommandEvent &  e)
private

Definition at line 1124 of file NyqBench.cpp.

1125 {
1126  (FindFocus() == mScript ? mScript : mOutput)->SetSelection(-1, -1);
1127 }

References mOutput, and mScript.

◆ OnSize()

void NyqBench::OnSize ( wxSizeEvent &  e)
private

Definition at line 967 of file NyqBench.cpp.

968 {
969  e.Skip();
970  if (!IsIconized() && !IsMaximized()) {
971  mLastSize.SetSize(e.GetSize());
972  }
973 }

References mLastSize.

◆ OnSmallIcons()

void NyqBench::OnSmallIcons ( wxCommandEvent &  e)
private

Definition at line 1319 of file NyqBench.cpp.

1320 {
1321  RecreateToolbar(false);
1322 }

References RecreateToolbar().

Here is the call graph for this function:

◆ OnSplitH()

void NyqBench::OnSplitH ( wxCommandEvent &  e)
private

Definition at line 1258 of file NyqBench.cpp.

1259 {
1260  if (mSplitter->IsSplit()) {
1261  mSplitter->Unsplit();
1262  }
1263 
1264  mSplitter->SplitHorizontally(mScript->GetParent(), mOutput->GetParent());
1265 }

References mOutput, mScript, and mSplitter.

◆ OnSplitV()

void NyqBench::OnSplitV ( wxCommandEvent &  e)
private

Definition at line 1249 of file NyqBench.cpp.

1250 {
1251  if (mSplitter->IsSplit()) {
1252  mSplitter->Unsplit();
1253  }
1254 
1255  mSplitter->SplitVertically(mScript->GetParent(), mOutput->GetParent());
1256 }

References mOutput, mScript, and mSplitter.

◆ OnStop()

void NyqBench::OnStop ( wxCommandEvent &  e)
private

Definition at line 1361 of file NyqBench.cpp.

1362 {
1363  mRunning = false;
1364  mEffect->Stop();
1365 }

References mEffect, mRunning, and NyquistEffect::Stop().

Here is the call graph for this function:

◆ OnTextUpdate()

void NyqBench::OnTextUpdate ( wxCommandEvent &  e)
private

Definition at line 1472 of file NyqBench.cpp.

1473 {
1474  // This really shouldn't be necessary, but Paste()ing doesn't mark the
1475  // control as dirty...at least on the Mac.
1476  ((NyqTextCtrl *) e.GetEventObject())->MarkDirty();
1477 }

◆ OnToggleCode()

void NyqBench::OnToggleCode ( wxCommandEvent &  e)
private

Definition at line 1267 of file NyqBench.cpp.

1268 {
1269  if (e.IsChecked()) {
1270  if (mSplitter->IsSplit()) {
1271  // Should never happen
1272  return;
1273  }
1274 
1275  if (mSplitMode == wxSPLIT_VERTICAL) {
1276  mSplitter->SplitVertically(mScript->GetParent(), mOutput->GetParent());
1277  }
1278  else {
1279  mSplitter->SplitHorizontally(mScript->GetParent(), mOutput->GetParent());
1280  }
1281  }
1282  else {
1283  if (!mSplitter->IsSplit()) {
1284  // Should never happen
1285  return;
1286  }
1287 
1288  mSplitMode = mSplitter->GetSplitMode();
1289  mSplitter->Unsplit(mScript->GetParent());
1290  }
1291 }

References mOutput, mScript, mSplitMode, and mSplitter.

◆ OnToggleOutput()

void NyqBench::OnToggleOutput ( wxCommandEvent &  e)
private

Definition at line 1293 of file NyqBench.cpp.

1294 {
1295  if (e.IsChecked()) {
1296  if (mSplitter->IsSplit()) {
1297  // Should never happen
1298  return;
1299  }
1300 
1301  if (mSplitMode == wxSPLIT_VERTICAL) {
1302  mSplitter->SplitVertically(mScript->GetParent(), mOutput->GetParent());
1303  }
1304  else {
1305  mSplitter->SplitHorizontally(mScript->GetParent(), mOutput->GetParent());
1306  }
1307  }
1308  else {
1309  if (!mSplitter->IsSplit()) {
1310  // Should never happen
1311  return;
1312  }
1313 
1314  mSplitMode = mSplitter->GetSplitMode();
1315  mSplitter->Unsplit(mOutput->GetParent());
1316  }
1317 }

References mOutput, mScript, mSplitMode, and mSplitter.

◆ OnUndo()

void NyqBench::OnUndo ( wxCommandEvent &  e)
private

Definition at line 1094 of file NyqBench.cpp.

1095 {
1096  (FindFocus() == mScript ? mScript : mOutput)->Undo();
1097 }

References mOutput, and mScript.

◆ OnUndoUpdate()

void NyqBench::OnUndoUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1489 of file NyqBench.cpp.

1490 {
1491  e.Enable((FindFocus() == mScript ? mScript : mOutput)->CanUndo());
1492 }

References mOutput, and mScript.

◆ OnViewUpdate()

void NyqBench::OnViewUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1519 of file NyqBench.cpp.

1520 {
1521  wxMenuBar *bar = GetMenuBar();
1522  bar->Enable(ID_SPLITV, !mSplitter->IsSplit() || mSplitter->GetSplitMode() != wxSPLIT_VERTICAL);
1523  bar->Enable(ID_SPLITH, !mSplitter->IsSplit() || mSplitter->GetSplitMode() != wxSPLIT_HORIZONTAL);
1524  bar->Check(ID_TOGGLECODE, mScript->GetParent()->IsShown());
1525  bar->Check(ID_TOGGLEOUTPUT, mOutput->GetParent()->IsShown());
1526  bar->Check(ID_LARGEICONS, mLargeIcons);
1527  bar->Check(ID_SMALLICONS, !mLargeIcons);
1528 }

References ID_LARGEICONS, ID_SMALLICONS, ID_SPLITH, ID_SPLITV, ID_TOGGLECODE, ID_TOGGLEOUTPUT, mLargeIcons, mOutput, mScript, and mSplitter.

◆ PopulateOrExchange()

void NyqBench::PopulateOrExchange ( ShuttleGui S)
private

Definition at line 840 of file NyqBench.cpp.

841 {
842  S.StartHorizontalLay(wxEXPAND, true);
843  {
844  wxPanel *scriptp;
845  wxPanel *outputp;
846  wxStaticBoxSizer *scripts;
847  wxStaticBoxSizer *outputs;
848  wxBoxSizer *bs;
849 
850  mSplitter = new wxSplitterWindow(this,
851  wxID_ANY,
852  wxDefaultPosition,
853  wxDefaultSize,
854  wxSP_LIVE_UPDATE |
855  wxSP_3DSASH |
856  wxSP_NOBORDER);
857 
858  scriptp = new wxPanel(mSplitter,
859  wxID_ANY,
860  wxDefaultPosition,
861  wxDefaultSize,
862  wxNO_FULL_REPAINT_ON_RESIZE |
863  wxCLIP_CHILDREN);
864  bs = new wxBoxSizer(wxVERTICAL);
865  scriptp->SetSizer(bs);
866 
867  mScriptBox = new wxStaticBox(scriptp,
868  wxID_ANY,
869  _("Script"));
870 
871  scripts = new wxStaticBoxSizer(mScriptBox,
872  wxVERTICAL);
873  bs->Add(scripts, true, wxEXPAND);
874 
875  mScript = new NyqTextCtrl(scriptp,
876  ID_SCRIPT,
877  wxEmptyString,
878  wxDefaultPosition,
879  wxDefaultSize,
880  wxTE_RICH2 | wxTE_RICH |
881  (mAutoWrap ? wxTE_BESTWRAP : wxTE_DONTWRAP) |
882  wxTE_NOHIDESEL |
883  wxTE_MULTILINE);
884  scripts->Add(mScript, true, wxEXPAND);
885 
886  outputp = new wxPanel(mSplitter,
887  wxID_ANY,
888  wxDefaultPosition,
889  wxDefaultSize,
890  wxNO_FULL_REPAINT_ON_RESIZE |
891  wxCLIP_CHILDREN);
892  bs = new wxBoxSizer(wxVERTICAL);
893  outputp->SetSizer(bs);
894 
895  mOutputBox = new wxStaticBox(outputp,
896  wxID_ANY,
897  _("Output"));
898  outputs = new wxStaticBoxSizer(mOutputBox,
899  wxVERTICAL);
900  bs->Add(outputs, true, wxEXPAND);
901 
902  mOutput = new NyqTextCtrl(outputp,
903  ID_OUTPUT,
904  wxEmptyString,
905  wxDefaultPosition,
906  wxDefaultSize,
907  wxTE_READONLY |
908 #if !defined(__WXMAC__)
909 // I could not get the bloody horizontal scroll bar to appear on
910 // wxMac, so we can't use wxTE_DONTWRAP as you can't easily scroll
911 // left and right.
912  wxTE_DONTWRAP |
913 #endif
914  wxTE_NOHIDESEL |
915  wxTE_MULTILINE);
916  outputs->Add(mOutput, true, wxEXPAND);
917 
918  switch (mSplitMode)
919  {
920  case wxSPLIT_VERTICAL:
921  mSplitter->SplitVertically(scriptp, outputp, 300);
922  break;
923 
924  case wxSPLIT_HORIZONTAL:
925  mSplitter->SplitHorizontally(scriptp, outputp, 300);
926  break;
927 
928  default:
929  mSplitter->Initialize((mShowCode ? scriptp : outputp));
930  break;
931  }
932 
933  mSplitter->SetMinimumPaneSize(50);
934 
935  S.AddSpace(5, 1);
936  S.Prop(true);
937  S.Position(wxEXPAND).AddWindow(mSplitter);
938  S.AddSpace(5, 1);
939 
940  mSplitter->SetMinSize(wxSize(600, 400));
941  }
942  S.EndHorizontalLay();
943 
944  S.AddSpace(1, 5);
945 
946  return;
947 }

References _, ID_OUTPUT, ID_SCRIPT, mAutoWrap, mOutput, mOutputBox, mScript, mScriptBox, mShowCode, mSplitMode, mSplitter, and S.

Referenced by NyqBench().

Here is the caller graph for this function:

◆ RecreateToolbar()

void NyqBench::RecreateToolbar ( bool  large = false)
private

Definition at line 1604 of file NyqBench.cpp.

1605 {
1606  mLargeIcons = large;
1607 
1608  wxToolBar *tb = GetToolBar();
1609  if (tb) {
1610  delete tb;
1611  }
1612  tb = CreateToolBar();
1613 
1614  wxSize sz;
1615 
1616  if (!mLargeIcons) {
1617  tb->SetToolBitmapSize(wxSize(16, 16));
1618  mPics[0] = wxBitmap(document_new_small);
1619  mPics[1] = wxBitmap(document_open_small);
1620  mPics[2] = wxBitmap(document_save_as_small);
1621  mPics[3] = wxBitmap(document_save_small);
1622  mPics[4] = wxBitmap(edit_copy_small);
1623  mPics[5] = wxBitmap(edit_cut_small);
1624  mPics[6] = wxBitmap(edit_paste_small);
1625  mPics[7] = wxBitmap(edit_clear_small);
1626  mPics[8] = wxBitmap(edit_delete_small);
1627  mPics[9] = wxBitmap(edit_select_all_small);
1628  mPics[10] = wxBitmap(edit_undo_small);
1629  mPics[11] = wxBitmap(edit_redo_small);
1630  mPics[12] = wxBitmap(edit_find_small);
1631  mPics[13] = wxBitmap(system_search_small);
1632  mPics[14] = wxBitmap(go_top_small);
1633  mPics[15] = wxBitmap(go_up_small);
1634  mPics[16] = wxBitmap(go_previous_small);
1635  mPics[17] = wxBitmap(go_next_small);
1636  mPics[18] = wxBitmap(media_playback_start_small);
1637  mPics[19] = wxBitmap(media_playback_stop_small);
1638  }
1639  else {
1640  tb->SetToolBitmapSize(wxSize(32, 32));
1641  mPics[0] = wxBitmap(document_new_large);
1642  mPics[1] = wxBitmap(document_open_large);
1643  mPics[2] = wxBitmap(document_save_as_large);
1644  mPics[3] = wxBitmap(document_save_large);
1645  mPics[4] = wxBitmap(edit_copy_large);
1646  mPics[5] = wxBitmap(edit_cut_large);
1647  mPics[6] = wxBitmap(edit_paste_large);
1648  mPics[7] = wxBitmap(edit_clear_large);
1649  mPics[8] = wxBitmap(edit_delete_large);
1650  mPics[9] = wxBitmap(edit_select_all_large);
1651  mPics[10] = wxBitmap(edit_undo_large);
1652  mPics[11] = wxBitmap(edit_redo_large);
1653  mPics[12] = wxBitmap(edit_find_large);
1654  mPics[13] = wxBitmap(system_search_large);
1655  mPics[14] = wxBitmap(go_top_large);
1656  mPics[15] = wxBitmap(go_up_large);
1657  mPics[16] = wxBitmap(go_previous_large);
1658  mPics[17] = wxBitmap(go_next_large);
1659  mPics[18] = wxBitmap(media_playback_start_large);
1660  mPics[19] = wxBitmap(media_playback_stop_large);
1661  }
1662 
1663  tb->SetMargins(2, 2);
1664 
1665  tb->AddTool(wxID_NEW, _("New"), mPics[0], _("New script"));
1666  tb->AddTool(wxID_OPEN, _("Open"), mPics[1], _("Open script"));
1667  tb->AddTool(wxID_SAVE, _("Save"), mPics[2], _("Save script"));
1668  tb->AddTool(wxID_SAVEAS, _("Save As"), mPics[3], _("Save script as..."));
1669  tb->AddSeparator();
1670  tb->AddTool(wxID_COPY, _("Copy"), mPics[4], _("Copy to clipboard"));
1671  tb->AddTool(wxID_CUT, _("Cut"), mPics[5], _("Cut to clipboard"));
1672  tb->AddTool(wxID_PASTE, _("Paste"), mPics[6], _("Paste from clipboard"));
1673  tb->AddTool(wxID_CLEAR, _("Clear"), mPics[7], _("Clear selection"));
1674  tb->AddTool(wxID_SELECTALL, _("Select All"), mPics[9], _("Select all text"));
1675  tb->AddSeparator();
1676  tb->AddTool(wxID_UNDO, _("Undo"), mPics[10], _("Undo last change"));
1677  tb->AddTool(wxID_REDO, _("Redo"), mPics[11], _("Redo previous change"));
1678  tb->AddSeparator();
1679  tb->AddTool(wxID_FIND, _("Find"), mPics[12], _("Find text"));
1680  tb->AddSeparator();
1681  tb->AddTool(ID_MATCH, _("Match"), mPics[13], _("Go to matching paren"));
1682  tb->AddTool(ID_TOP, _("Top"), mPics[14], _("Go to top S-expr"));
1683  tb->AddTool(ID_UP, _("Up"), mPics[15], _("Go to higher S-expr"));
1684  tb->AddTool(ID_PREVIOUS, _("Previous"), mPics[16], _("Go to previous S-expr"));
1685  tb->AddTool(ID_NEXT, _("Next"), mPics[17], _("Go to next S-expr"));
1686  tb->AddSeparator();
1687  tb->AddTool(ID_GO, _("Start"), mPics[18], _("Start script"));
1688  tb->AddTool(ID_STOP, _("Stop"), mPics[19], _("Stop script"));
1689 
1690  tb->Realize();
1691 
1692  Layout();
1693  Fit();
1694  SetMinSize(GetSize());
1695 }

References _, ID_GO, ID_MATCH, ID_NEXT, ID_PREVIOUS, ID_STOP, ID_TOP, ID_UP, mLargeIcons, and mPics.

Referenced by NyqBench(), OnLargeIcons(), and OnSmallIcons().

Here is the caller graph for this function:

◆ SavePrefs()

void NyqBench::SavePrefs ( )

Definition at line 811 of file NyqBench.cpp.

812 {
813  gPrefs->Write(wxT("NyqBench/Window/Maximized"), IsMaximized());
814  if (!IsMaximized()) {
815  wxRect r = GetRect();
816 
817 #if !defined(__WXMAC__)
818  if (IsIconized()) {
819  r = mLastSize;
820  }
821 #endif
822 
823  gPrefs->Write(wxT("NyqBench/Window/X"), r.GetX());
824  gPrefs->Write(wxT("NyqBench/Window/Y"), r.GetY());
825  gPrefs->Write(wxT("NyqBench/Window/Width"), r.GetWidth());
826  gPrefs->Write(wxT("NyqBench/Window/Height"), r.GetHeight());
827  }
828 
829  gPrefs->Write(wxT("NyqBench/AutoLoad"), mAutoLoad);
830  gPrefs->Write(wxT("NyqBench/AutoWrap"), mAutoWrap);
831  gPrefs->Write(wxT("NyqBench/ScriptFont"), mScriptFont.GetNativeFontInfoDesc());
832  gPrefs->Write(wxT("NyqBench/OutputFont"), mOutputFont.GetNativeFontInfoDesc());
833  gPrefs->Write(wxT("NyqBench/LargeIcons"), mLargeIcons);
834  gPrefs->Write(wxT("NyqBench/SplitX"), mSplitter->IsSplit() ? mSplitter->GetSashPosition() : 0);
835  gPrefs->Write(wxT("NyqBench/SplitMode"), mSplitter->IsSplit() ? mSplitter->GetSplitMode() : 0);
836  gPrefs->Write(wxT("NyqBench/ShowCode"), mScript->IsShown());
837  gPrefs->Write(wxT("NyqBench/ShowOutput"), mOutput->IsShown());
838 }

References gPrefs, mAutoLoad, mAutoWrap, mLargeIcons, mLastSize, mOutput, mOutputFont, mScript, mScriptFont, and mSplitter.

Referenced by ModuleDispatch().

Here is the caller graph for this function:

◆ SetWindowTitle()

void NyqBench::SetWindowTitle ( )
private

Definition at line 1593 of file NyqBench.cpp.

1594 {
1595  wxString name = _("Untitled");
1596 
1597  if (!mPath.GetFullPath().IsEmpty()) {
1598  name = mPath.GetFullName();
1599  }
1600 
1601  SetTitle(_("Nyquist Effect Workbench - ") + name);
1602 }

References _, mPath, and name.

Referenced by NyqBench(), OnNew(), OnOpen(), and OnSaveAs().

Here is the caller graph for this function:

◆ ShowNyqBench()

void NyqBench::ShowNyqBench ( const CommandContext )

Definition at line 1727 of file NyqBench.cpp.

1728 {
1729  Show();
1730 }

Referenced by anonymous_namespace{NyqBench.cpp}::RegisterMenuItems().

Here is the caller graph for this function:

◆ Validate()

bool NyqBench::Validate ( )
virtual

Definition at line 1577 of file NyqBench.cpp.

1578 {
1579  if (mScript->GetLastPosition() > 0 && mScript->IsModified()) {
1580  int ans;
1581  ans = AudacityMessageBox(XO("Code has been modified. Are you sure?"),
1582  XO("Warning"),
1583  wxYES_NO | wxICON_QUESTION,
1584  this);
1585  if (ans == wxNO) {
1586  return false;
1587  }
1588  }
1589 
1590  return true;
1591 }

References AudacityMessageBox(), mScript, and XO.

Referenced by OnClose(), OnNew(), OnOpen(), and OnRevert().

Here is the call graph for this function:
Here is the caller graph for this function:

Member Data Documentation

◆ mAutoLoad

bool NyqBench::mAutoLoad
private

Definition at line 208 of file NyqBench.h.

Referenced by NyqBench(), OnAutoLoad(), and SavePrefs().

◆ mAutoWrap

bool NyqBench::mAutoWrap
private

Definition at line 209 of file NyqBench.h.

Referenced by NyqBench(), OnAutoWrap(), PopulateOrExchange(), and SavePrefs().

◆ mEffect

NyquistEffect* NyqBench::mEffect
private

Definition at line 192 of file NyqBench.h.

Referenced by OnGo(), and OnStop().

◆ mFindData

wxFindReplaceData NyqBench::mFindData
private

Definition at line 189 of file NyqBench.h.

Referenced by OnFind(), and OnFindDialog().

◆ mFindDlg

wxFindReplaceDialog* NyqBench::mFindDlg
private

Definition at line 188 of file NyqBench.h.

Referenced by NyqBench(), OnFind(), and OnFindDialog().

◆ mFindText

NyqTextCtrl* NyqBench::mFindText
private

Definition at line 190 of file NyqBench.h.

Referenced by OnFind(), and OnFindDialog().

◆ mLargeIcons

bool NyqBench::mLargeIcons
private

Definition at line 203 of file NyqBench.h.

Referenced by NyqBench(), OnViewUpdate(), RecreateToolbar(), and SavePrefs().

◆ mLastSize

wxRect NyqBench::mLastSize
private

Definition at line 211 of file NyqBench.h.

Referenced by OnMove(), OnSize(), and SavePrefs().

◆ mOutput

NyqTextCtrl* NyqBench::mOutput
private

◆ mOutputBox

wxStaticBox* NyqBench::mOutputBox
private

Definition at line 183 of file NyqBench.h.

Referenced by NyqBench(), OnOutputUpdate(), OnScriptUpdate(), and PopulateOrExchange().

◆ mOutputFont

wxFont NyqBench::mOutputFont
private

Definition at line 195 of file NyqBench.h.

Referenced by NyqBench(), OnFont(), and SavePrefs().

◆ mPath

wxFileName NyqBench::mPath
private

Definition at line 207 of file NyqBench.h.

Referenced by LoadFile(), NyqBench(), OnNew(), OnOpen(), OnRevert(), OnSave(), OnSaveAs(), and SetWindowTitle().

◆ mPics

wxBitmap NyqBench::mPics[20]
private

Definition at line 197 of file NyqBench.h.

Referenced by RecreateToolbar().

◆ mRunning

bool NyqBench::mRunning
private

Definition at line 205 of file NyqBench.h.

Referenced by NyqBench(), OnGo(), OnRunUpdate(), and OnStop().

◆ mScript

NyqTextCtrl* NyqBench::mScript
private

◆ mScriptBox

wxStaticBox* NyqBench::mScriptBox
private

Definition at line 182 of file NyqBench.h.

Referenced by NyqBench(), OnOutputUpdate(), OnScriptUpdate(), and PopulateOrExchange().

◆ mScriptFont

wxFont NyqBench::mScriptFont
private

Definition at line 194 of file NyqBench.h.

Referenced by NyqBench(), OnFont(), and SavePrefs().

◆ mShowCode

bool NyqBench::mShowCode
private

Definition at line 200 of file NyqBench.h.

Referenced by NyqBench(), and PopulateOrExchange().

◆ mShowOutput

bool NyqBench::mShowOutput
private

Definition at line 201 of file NyqBench.h.

Referenced by NyqBench().

◆ mSplitMode

int NyqBench::mSplitMode
private

Definition at line 199 of file NyqBench.h.

Referenced by NyqBench(), OnToggleCode(), OnToggleOutput(), and PopulateOrExchange().

◆ mSplitter

wxSplitterWindow* NyqBench::mSplitter
private

The documentation for this class was generated from the following files:
ID_STOP
@ ID_STOP
Definition: NyqBench.cpp:562
ID_TOGGLECODE
@ ID_TOGGLECODE
Definition: NyqBench.cpp:551
eIsCreating
@ eIsCreating
Definition: ShuttleGui.h:38
ID_NEXT
@ ID_NEXT
Definition: NyqBench.cpp:559
NyquistEffect::Stop
void Stop()
Definition: Nyquist.cpp:1790
NyqBench::mOutputFont
wxFont mOutputFont
Definition: NyqBench.h:195
NyqBench::mShowOutput
bool mShowOutput
Definition: NyqBench.h:201
ID_GO
@ ID_GO
Definition: NyqBench.cpp:561
S
#define S(N)
Definition: ToChars.cpp:64
AudacityMessageBox
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption, long style, wxWindow *parent, int x, int y)
Definition: AudacityMessageBox.cpp:17
NyqBench::mFindText
NyqTextCtrl * mFindText
Definition: NyqBench.h:190
gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:70
NyqBench::mFindData
wxFindReplaceData mFindData
Definition: NyqBench.h:189
EffectManager::UnregisterEffect
void UnregisterEffect(const PluginID &ID)
Used only by Nyquist Workbench module.
Definition: EffectManager.cpp:70
ID_AUTOLOAD
@ ID_AUTOLOAD
Definition: NyqBench.cpp:544
XO
#define XO(s)
Definition: Internat.h:31
GetActiveProject
AUDACITY_DLL_API std::weak_ptr< AudacityProject > GetActiveProject()
Definition: ActiveProject.cpp:24
ID_FONT
@ ID_FONT
Definition: NyqBench.cpp:548
NyqBench::mLargeIcons
bool mLargeIcons
Definition: NyqBench.h:203
EffectManager::Get
static EffectManager & Get()
Definition: EffectManager.cpp:42
NyqBench::LoadFile
void LoadFile()
Definition: NyqBench.cpp:1697
ID_SPLITH
@ ID_SPLITH
Definition: NyqBench.cpp:550
ID_OUTPUT
@ ID_OUTPUT
Definition: NyqBench.cpp:565
desc
const TranslatableString desc
Definition: ExportPCM.cpp:58
NyqBench::NyqBench
NyqBench(wxWindow *parent)
Definition: NyqBench.cpp:649
NyqBench::mLastSize
wxRect mLastSize
Definition: NyqBench.h:211
NyqBench::mSplitMode
int mSplitMode
Definition: NyqBench.h:199
NyqBench::OnSaveAs
void OnSaveAs(wxCommandEvent &e)
Definition: NyqBench.cpp:1044
NyqBench::mScriptBox
wxStaticBox * mScriptBox
Definition: NyqBench.h:182
NyqRedirector
Definition: NyqBench.h:80
ID_SMALLICONS
@ ID_SMALLICONS
Definition: NyqBench.cpp:553
NyqBench::mAutoWrap
bool mAutoWrap
Definition: NyqBench.h:209
NyqBench::mPics
wxBitmap mPics[20]
Definition: NyqBench.h:197
NyqBench::mRunning
bool mRunning
Definition: NyqBench.h:205
CommandContext
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
Definition: CommandContext.h:34
label
TranslatableString label
Definition: Tags.cpp:750
NyqBench::Validate
virtual bool Validate()
Definition: NyqBench.cpp:1577
NyqBench::mPath
wxFileName mPath
Definition: NyqBench.h:207
PluginID
wxString PluginID
Definition: EffectManager.h:31
NyqBench::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S)
Definition: NyqBench.cpp:840
name
const TranslatableString name
Definition: Distortion.cpp:98
NyqBench::mSplitter
wxSplitterWindow * mSplitter
Definition: NyqBench.h:186
NyqBench::RecreateToolbar
void RecreateToolbar(bool large=false)
Definition: NyqBench.cpp:1604
NyqBench::mScriptFont
wxFont mScriptFont
Definition: NyqBench.h:194
AudioIOBase::Get
static AudioIOBase * Get()
Definition: AudioIOBase.cpp:89
ID_LARGEICONS
@ ID_LARGEICONS
Definition: NyqBench.cpp:554
ID_SCRIPT
@ ID_SCRIPT
Definition: NyqBench.cpp:564
NyqBench::mAutoLoad
bool mAutoLoad
Definition: NyqBench.h:208
ID_TOGGLEOUTPUT
@ ID_TOGGLEOUTPUT
Definition: NyqBench.cpp:552
ID_AUTOWRAP
@ ID_AUTOWRAP
Definition: NyqBench.cpp:546
ID_UP
@ ID_UP
Definition: NyqBench.cpp:557
NyqBench::mOutputBox
wxStaticBox * mOutputBox
Definition: NyqBench.h:183
NyqTextCtrl::GoPrev
void GoPrev()
Definition: NyqBench.cpp:342
NyqTextCtrl
Definition: NyqBench.h:30
ID_PREVIOUS
@ ID_PREVIOUS
Definition: NyqBench.cpp:558
ID_SPLITV
@ ID_SPLITV
Definition: NyqBench.cpp:549
NyqBench::SetWindowTitle
void SetWindowTitle()
Definition: NyqBench.cpp:1593
_
#define _(s)
Definition: Internat.h:75
gBench
static DEFINE_VERSION_CHECK NyqBench * gBench
Definition: NyqBench.cpp:122
NyqTextCtrl::GoMatch
void GoMatch()
Definition: NyqBench.cpp:293
ID_TOP
@ ID_TOP
Definition: NyqBench.cpp:556
NyquistEffect::SetCommand
void SetCommand(const wxString &cmd)
Definition: Nyquist.cpp:1771
EffectUI::DoEffect
AUDACITY_DLL_API bool DoEffect(const PluginID &ID, const CommandContext &context, unsigned flags)
'Repeat Last Effect'.
Definition: EffectUI.cpp:1798
NyqTextCtrl::GoTop
void GoTop()
Definition: NyqBench.cpp:298
NyqTextCtrl::GoUp
void GoUp()
Definition: NyqBench.cpp:320
NyqBench::mScript
NyqTextCtrl * mScript
Definition: NyqBench.h:184
NyqBench::mFindDlg
wxFindReplaceDialog * mFindDlg
Definition: NyqBench.h:188
NyqBench::mShowCode
bool mShowCode
Definition: NyqBench.h:200
EffectManager::RegisterEffect
const PluginID & RegisterEffect(std::unique_ptr< Effect > uEffect)
Here solely for the purpose of Nyquist Workbench until a better solution is devised.
Definition: EffectManager.cpp:59
NyqBench::mOutput
NyqTextCtrl * mOutput
Definition: NyqBench.h:185
NyqBench::mEffect
NyquistEffect * mEffect
Definition: NyqBench.h:192
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
ID_MATCH
@ ID_MATCH
Definition: NyqBench.cpp:555
NyqTextCtrl::GoNext
void GoNext()
Definition: NyqBench.cpp:362
NyquistEffect::RedirectOutput
void RedirectOutput()
Definition: Nyquist.cpp:1766