Audacity  3.0.3
NyqBench.cpp
Go to the documentation of this file.
1 /**********************************************************************
2 
3  NyqBench.cpp
4 
5  Leland Lucius
6 
7 **********************************************************************/
8 
9 
10 
11 #include <wx/defs.h>
12 
13 #include <wx/aboutdlg.h>
14 #include <wx/filedlg.h>
15 #include <wx/font.h>
16 #include <wx/fontdlg.h>
17 #include <wx/menu.h>
18 #include <wx/msgdlg.h>
19 #include <wx/settings.h>
20 #include <wx/sizer.h>
21 #include <wx/splitter.h>
22 #include <wx/statbox.h>
23 #include <wx/textctrl.h>
24 #include <wx/toolbar.h>
25 
26 #include "AudioIOBase.h"
27 #include "CommonCommandFlags.h"
28 #include "ModuleConstants.h"
29 #include "Prefs.h"
30 #include "Project.h"
31 #include "ShuttleGui.h"
32 #include "effects/EffectManager.h"
33 #include "effects/EffectUI.h"
35 #include "../images/AudacityLogo.xpm"
36 #include "../../src/commands/CommandContext.h"
37 #include "../../src/commands/CommandManager.h"
39 
40 #include "NyqBench.h"
41 
42 #include <iostream>
43 #include <ostream>
44 #include <sstream>
45 
46 //
47 // Images are from the Tango Icon Gallery
48 // http://tango.freedesktop.org/Tango_Icon_Gallery
49 //
50 #include "images/document-new-small.xpm"
51 #include "images/document-open-small.xpm"
52 #include "images/document-save-as-small.xpm"
53 #include "images/document-save-small.xpm"
54 #include "images/edit-clear-small.xpm"
55 #include "images/edit-copy-small.xpm"
56 #include "images/edit-cut-small.xpm"
57 #include "images/edit-delete-small.xpm"
58 #include "images/edit-find-small.xpm"
59 #include "images/edit-paste-small.xpm"
60 #include "images/edit-redo-small.xpm"
61 #include "images/edit-select-all-small.xpm"
62 #include "images/edit-undo-small.xpm"
63 #include "images/go-top-small.xpm"
64 #include "images/go-up-small.xpm"
65 #include "images/go-previous-small.xpm"
66 #include "images/go-next-small.xpm"
67 #include "images/system-search-small.xpm"
68 #include "images/media-playback-start-small.xpm"
69 #include "images/media-playback-stop-small.xpm"
70 
71 #include "images/document-new-large.xpm"
72 #include "images/document-open-large.xpm"
73 #include "images/document-save-as-large.xpm"
74 #include "images/document-save-large.xpm"
75 #include "images/edit-clear-large.xpm"
76 #include "images/edit-copy-large.xpm"
77 #include "images/edit-cut-large.xpm"
78 #include "images/edit-delete-large.xpm"
79 #include "images/edit-find-large.xpm"
80 #include "images/edit-paste-large.xpm"
81 #include "images/edit-redo-large.xpm"
82 #include "images/edit-select-all-large.xpm"
83 #include "images/edit-undo-large.xpm"
84 #include "images/go-top-large.xpm"
85 #include "images/go-up-large.xpm"
86 #include "images/go-previous-large.xpm"
87 #include "images/go-next-large.xpm"
88 #include "images/system-search-large.xpm"
89 #include "images/media-playback-start-large.xpm"
90 #include "images/media-playback-stop-large.xpm"
91 
92 /*
93 //#define ModuleDispatchName "ModuleDispatch"
94 See the example in this file. It has several cases/options in it.
95 */
96 
97 namespace {
99 {
100  return *NyqBench::GetBench();
101 }
102 
104 {
105  // Get here only after the module version check passes
106  using namespace MenuTable;
107  static AttachedItem sAttachment{ wxT("Tools"),
108  ( FinderScope( findme ), Section( wxT("NyquistWorkBench"),
109  Command( wxT("NyqBench"), XXO("&Nyquist Workbench..."),
112  ) )
113  };
114 }
115 }
116 
118 
119 extern "C"
120 {
121  static NyqBench *gBench = NULL;
122 
123  extern int DLL_API ModuleDispatch(ModuleDispatchTypes type);
124  // ModuleDispatch
125  // is called by Audacity to initialize/terminate the module
127  switch (type){
128  case ModuleInitialize:
130  break;
131  case AppQuiting: {
132  //It is perfectly OK for gBench to be NULL.
133  //Can happen if the menu item was never invoked.
134  //wxASSERT(gBench != NULL);
135  if (gBench) {
136  // be sure to do this while gPrefs still exists:
137  gBench->SavePrefs();
138  gBench->Destroy();
139  gBench = NULL;
140  }
141  }
142  break;
143  default:
144  break;
145  }
146  return 1;
147  }
148 };
149 
150 //----------------------------------------------------------------------------
151 // NyqTextCtrl
152 //----------------------------------------------------------------------------
153 
154 BEGIN_EVENT_TABLE(NyqTextCtrl, wxTextCtrl)
155 #if defined(__WXMAC__)
156  EVT_KEY_DOWN(NyqTextCtrl::OnKeyDown)
157 #endif
158  EVT_KEY_UP(NyqTextCtrl::OnKeyUp)
159  EVT_CHAR(NyqTextCtrl::OnChar)
160  EVT_UPDATE_UI(wxID_ANY, NyqTextCtrl::OnUpdate)
162 
163 NyqTextCtrl::NyqTextCtrl(wxWindow *parent,
164  wxWindowID id,
165  const wxString &value,
166  const wxPoint & pos,
167  const wxSize & size,
168  int style)
169 : wxTextCtrl(parent, id, value, pos, size, style)
170 {
171  mLastCaretPos = -1;
172  mLeftParen = -1;
173  mRightParen = -1;
174 
175  mOn.SetTextColour(*wxRED);
176  mOff.SetTextColour(*wxBLACK);
177 }
178 
180 {
181 #if defined(__WXMSW__)
182  // We do this to prevent wxMSW from selecting all text when the
183  // user tabs into the text controls.
184  wxWindowBase::SetFocusFromKbd();
185 #else
186  wxTextCtrl::SetFocusFromKbd();
187 #endif
188 }
189 
191 {
192  wxTextCtrl::MarkDirty();
193  FindParens();
194 }
195 
196 void NyqTextCtrl::OnChar(wxKeyEvent & e)
197 {
198  e.Skip();
199 
200  // Hide any previously highlighted parens
201  if (mLeftParen >= 0) {
202 #if defined(__WXMSW__)
203  Freeze(); // Prevents selection flashing on Windows
204 #endif
205 
206  SetStyle(mLeftParen, mLeftParen + 1, mOff);
207  SetStyle(mLeftParens[mLeftParen], mLeftParens[mLeftParen] + 1, mOff);
208  mLeftParen = -1;
209  mRightParen = -1;
210 
211 #if defined(__WXMSW__)
212  Thaw(); // Prevents selection flashing on Windows
213 #endif
214  }
215 }
216 
217 #if defined(__WXMAC__REMOVED_UNTIL_ITS_PROVEN_THAT_IT_IS_STILL_NEEDED)
218 #include <wx/mac/uma.h>
219 
220 // This is hackage to correct a problem on Leopard where the
221 // caret jumps up two lines when the up arrow is pressed and
222 // the caret is at the beginning of the line.
223 void NyqTextCtrl::OnKeyDown(wxKeyEvent & e)
224 {
225  e.Skip();
226  if (UMAGetSystemVersion() >= 0x1050) {
227  if (e.GetKeyCode() == WXK_UP && e.GetModifiers() == 0) {
228  long x;
229  long y;
230 
231  PositionToXY(GetInsertionPoint(), &x, &y);
232  if (x == 0 && y > 1) {
233  y--;
234  SetInsertionPoint(XYToPosition(x, y) - 1);
235  e.Skip(false);
236  }
237  }
238  }
239 }
240 #endif
241 
242 void NyqTextCtrl::OnKeyUp(wxKeyEvent & e)
243 {
244  e.Skip();
245 
246  int pos = GetInsertionPoint();
247  int lpos = wxMax(0, pos - 1);
248 
249  wxString text = GetRange(lpos, pos);
250 
251  if (text[0] == wxT('(')) {
252  wxLongToLongHashMap::const_iterator left = mLeftParens.find(lpos);
253  if (left != mLeftParens.end()) {
254  Colorize(lpos, left->second);
255  }
256  }
257  else if (text[0] == wxT(')')) {
258  wxLongToLongHashMap::const_iterator right = mRightParens.find(lpos);
259  if (right != mRightParens.end()) {
260  Colorize(right->second, lpos);
261  }
262  }
263 }
264 
265 void NyqTextCtrl::OnUpdate(wxUpdateUIEvent & e)
266 {
267  int pos = GetInsertionPoint();
268 
269  if (pos != mLastCaretPos) {
270  int lpos = wxMax(0, pos - 1);
271 
272  wxString text = GetRange(lpos, pos);
273  if (text.Length() > 0) {
274  if (text[0] == wxT('(')) {
275  wxLongToLongHashMap::const_iterator left = mLeftParens.find(lpos);
276  if (left != mLeftParens.end()) {
277  Colorize(lpos, left->second);
278  }
279  }
280  else if (text[0] == wxT(')')) {
281  wxLongToLongHashMap::const_iterator right = mRightParens.find(lpos);
282  if (right != mRightParens.end()) {
283  Colorize(right->second, lpos);
284  }
285  }
286  }
287 
288  mLastCaretPos = pos;
289  }
290 }
291 
293 {
294  MoveCursor(mRightParen, mLeftParen);
295 }
296 
298 {
299  wxLongToLongHashMap::const_iterator it;
300  long first = -1;
301  long second = -1;
302 
303  if (mLeftParen != -1) {
304  for (it = mLeftParens.begin(); it != mLeftParens.end(); it++) {
305  if (mLeftParen > it->first && mLeftParen < it->second) {
306  if (first == -1 || it->first < first) {
307  first = it->first;
308  second = it->second;
309  }
310  }
311  }
312  }
313 
314  if (first != -1) {
315  MoveCursor(first, second);
316  }
317 }
318 
320 {
321  wxLongToLongHashMap::const_iterator it;
322  long first = -1;
323  long second = -1;
324 
325  if (mLeftParen != -1) {
326  for (it = mLeftParens.begin(); it != mLeftParens.end(); it++) {
327  if (mLeftParen > it->first && mLeftParen < it->second) {
328  if (first == -1 || it->first > first) {
329  first = it->first;
330  second = it->second;
331  }
332  }
333  }
334  }
335 
336  if (first != -1) {
337  MoveCursor(first, second);
338  }
339 }
340 
342 {
343  wxLongToLongHashMap::const_iterator it;
344  long first = -1;
345  long second = -1;
346 
347  if (mLeftParen != -1) {
348  for (it = mLeftParens.begin(); it != mLeftParens.end(); it++) {
349  if (it->first < mLeftParen && it->first >= first) {
350  first = it->first;
351  second = it->second;
352  }
353  }
354  }
355 
356  if (first != -1) {
357  MoveCursor(first, second);
358  }
359 }
360 
362 {
363  wxLongToLongHashMap::const_iterator it;
364  long first = -1;
365  long second = -1;
366 
367  if (mLeftParen != -1) {
368  for (it = mLeftParens.begin(); it != mLeftParens.end(); it++) {
369  if (it->first > mLeftParen && (first == -1 || it->first < first)) {
370  first = it->first;
371  second = it->second;
372  }
373  }
374  }
375 
376  if (first != -1) {
377  MoveCursor(first, second);
378  }
379 }
380 
381 void NyqTextCtrl::MoveCursor(long first, long second)
382 {
383  int pos = GetInsertionPoint();
384  int lpos = wxMax(0, pos - 1);
385 
386  wxString text = GetRange(lpos, pos);
387 
388  if (text[0] == wxT('(')) {
389  SetInsertionPoint(first + 1);
390  Colorize(first, second);
391  }
392  else if (text[0] == wxT(')')) {
393  SetInsertionPoint(second + 1);
394  Colorize(first, second);
395  }
396 }
397 
398 void NyqTextCtrl::Colorize(long left, long right)
399 {
400  // Hide any previously highlighted parens
401  if (mLeftParen >= 0) {
402 #if defined(__WXMSW__)
403  Freeze(); // Prevents selection flashing on Windows
404 #endif
405 
406  SetStyle(mLeftParen, mLeftParen + 1, mOff);
407  SetStyle(mLeftParens[mLeftParen], mLeftParens[mLeftParen] + 1, mOff);
408  mLeftParen = -1;
409  mRightParen = -1;
410 
411 #if defined(__WXMSW__)
412  Thaw(); // Prevents selection flashing on Windows
413 #endif
414  }
415 
416  mLeftParen = left;
417  mRightParen = right;
418 
419  if (mLeftParen != -1) {
420  SetStyle(mLeftParen, mLeftParen + 1, mOn);
421  SetStyle(mRightParen, mRightParen + 1, mOn);
422 
423  SetStyle(mLeftParen + 1, mLeftParen + 1, mOff);
424  SetStyle(mRightParen + 1, mRightParen + 1, mOff);
425  }
426 }
427 
429 {
430  wxString text = GetValue();
431  bool inquotes = false;
432  wxArrayInt stack;
433  long len = (long) text.Length();
434  long pos;
435 
436  mLeftParens.clear();
437  mRightParens.clear();
438 
439  for (pos = 0; pos < len; pos++) {
440  wxChar c = text[pos];
441  switch (c)
442  {
443  case wxT('"'):
444  inquotes = !inquotes;
445  break;
446 
447  case wxT(';'):
448  if (!inquotes) {
449  pos = (long)text.find(wxT('\n'), pos);
450  if (pos == (long)wxString::npos) {
451  pos = len;
452  }
453  }
454  break;
455 
456  case wxT('#'):
457  if (!inquotes) {
458  long ndx = pos + 1;
459  if (ndx < len && text[(int)ndx] == wxT('|')) {
460  // Shamelessly stolen from xlread.c/pcomment()
461  wxChar lastch = -1;
462  int n = 1;
463 
464  /* look for the matching delimiter (and handle nesting) */
465  while (n > 0 && ++pos < len) {
466  wxChar ch = text[(int)pos];
467  if (lastch == '|' && ch == '#') {
468  --n;
469  ch = -1;
470  }
471  else if (lastch == '#' && ch == '|') {
472  ++n;
473  ch = -1;
474  }
475  lastch = ch;
476  }
477  }
478  }
479  break;
480 
481  case wxT('('):
482  if (!inquotes) {
483  stack.Add(pos);
484  }
485  break;
486 
487  case wxT(')'):
488  if (!inquotes) {
489  if (stack.GetCount() > 0) {
490  int left = stack.Last();
491  stack.RemoveAt(stack.GetCount() - 1);
492 
493  mLeftParens[left] = pos;
494  mRightParens[pos] = left;
495  }
496  }
497  break;
498  }
499  }
500 }
501 
502 //----------------------------------------------------------------------------
503 // NyqRedirector
504 //----------------------------------------------------------------------------
505 
507 : mText(text)
508 {
509  mOld = std::cout.rdbuf(this);
510 }
511 
513 {
514  std::cout.flush();
515  std::cout.rdbuf(mOld);
516  if (s.length() > 0) {
517  AppendText();
518  }
519 }
520 
522 {
523  s += (char)c;
524  if (c == '\n') {
525  AppendText();
526  }
527 
528  return 0;
529 }
530 
532 {
533  mText->AppendText(wxString(s.c_str(), wxConvISO8859_1));
534  s.clear();
535 }
536 
537 //----------------------------------------------------------------------------
538 // NyqBench
539 //----------------------------------------------------------------------------
540 
541 enum
542 {
543  ID_AUTOLOAD = 20000,
544 
546 
559 
562 
564  ID_OUTPUT
565 };
566 
567 BEGIN_EVENT_TABLE(NyqBench, wxFrame)
568  EVT_CLOSE(NyqBench::OnClose)
569  EVT_MOVE(NyqBench::OnMove)
570  EVT_SIZE(NyqBench::OnSize)
571 
572  EVT_MENU(wxID_NEW, NyqBench::OnNew)
573  EVT_MENU(wxID_OPEN, NyqBench::OnOpen)
574  EVT_MENU(wxID_SAVE, NyqBench::OnSave)
575  EVT_MENU(wxID_SAVEAS, NyqBench::OnSaveAs)
576  EVT_MENU(wxID_REVERT_TO_SAVED, NyqBench::OnRevert)
578  EVT_MENU(wxID_CLOSE, NyqBench::OnCloseWindow)
579 
580  EVT_MENU(wxID_UNDO, NyqBench::OnUndo)
581  EVT_MENU(wxID_REDO, NyqBench::OnRedo)
582  EVT_MENU(wxID_CUT, NyqBench::OnCut)
583  EVT_MENU(wxID_COPY, NyqBench::OnCopy)
584  EVT_MENU(wxID_PASTE, NyqBench::OnPaste)
585  EVT_MENU(wxID_CLEAR, NyqBench::OnClear)
586  EVT_MENU(wxID_SELECTALL, NyqBench::OnSelectAll)
587  EVT_MENU(wxID_FIND, NyqBench::OnFind)
588  EVT_MENU(ID_MATCH, NyqBench::OnGoMatch)
589  EVT_MENU(ID_TOP, NyqBench::OnGoTop)
590  EVT_MENU(ID_UP, NyqBench::OnGoUp)
592  EVT_MENU(ID_NEXT, NyqBench::OnGoNext)
594 
595  EVT_MENU(ID_FONT, NyqBench::OnFont)
596  EVT_MENU(ID_SPLITV, NyqBench::OnSplitV)
597  EVT_MENU(ID_SPLITH, NyqBench::OnSplitH)
602 
603  EVT_MENU(ID_GO, NyqBench::OnGo)
604  EVT_MENU(ID_STOP, NyqBench::OnStop)
605 
606  EVT_MENU(wxID_ABOUT, NyqBench::OnAbout)
607 
608  EVT_FIND(wxID_ANY, NyqBench::OnFindDialog)
609  EVT_FIND_NEXT(wxID_ANY, NyqBench::OnFindDialog)
610  EVT_FIND_REPLACE(wxID_ANY, NyqBench::OnFindDialog)
611  EVT_FIND_REPLACE_ALL(wxID_ANY, NyqBench::OnFindDialog)
612  EVT_FIND_CLOSE(wxID_ANY, NyqBench::OnFindDialog)
613 
615 
616  EVT_UPDATE_UI(wxID_SAVE, NyqBench::OnMenuUpdate)
617  EVT_UPDATE_UI(wxID_SAVEAS, NyqBench::OnMenuUpdate)
618  EVT_UPDATE_UI(wxID_REVERT_TO_SAVED, NyqBench::OnMenuUpdate)
619 
620  EVT_UPDATE_UI(wxID_UNDO, NyqBench::OnUndoUpdate)
621  EVT_UPDATE_UI(wxID_REDO, NyqBench::OnRedoUpdate)
622  EVT_UPDATE_UI(wxID_CUT, NyqBench::OnCutUpdate)
623  EVT_UPDATE_UI(wxID_COPY, NyqBench::OnCopyUpdate)
624  EVT_UPDATE_UI(wxID_PASTE, NyqBench::OnPasteUpdate)
625  EVT_UPDATE_UI(wxID_CLEAR, NyqBench::OnClearUpdate)
626 
627  EVT_UPDATE_UI(ID_SPLITH, NyqBench::OnViewUpdate)
628  EVT_UPDATE_UI(ID_SPLITV, NyqBench::OnViewUpdate)
629  EVT_UPDATE_UI(ID_TOGGLECODE, NyqBench::OnViewUpdate)
631 
632  EVT_UPDATE_UI(ID_GO, NyqBench::OnRunUpdate)
633 
634  EVT_UPDATE_UI(ID_SCRIPT, NyqBench::OnScriptUpdate)
635  EVT_UPDATE_UI(ID_OUTPUT, NyqBench::OnOutputUpdate)
637 
638 /*static*/ NyqBench *NyqBench::GetBench()
639 {
640  if (gBench == nullptr)
641  {
642  gBench = new NyqBench(NULL);
643  }
644 
645  return gBench;
646 }
647 
648 NyqBench::NyqBench(wxWindow * parent)
649 : wxFrame(NULL,
650  wxID_ANY,
651  wxEmptyString,
652  wxDefaultPosition,
653  wxDefaultSize,
654  wxDEFAULT_FRAME_STYLE |
655  wxMINIMIZE_BOX |
656  wxMAXIMIZE_BOX |
657  wxRESIZE_BORDER)
658 {
659  mFindDlg = NULL;
660  mRunning = false;
661  mScriptBox = NULL;
662  mOutputBox = NULL;
663  mScript = NULL;
664  mOutput = NULL;
665 
666  mPath = gPrefs->Read(wxT("NyqBench/Path"), wxEmptyString);
667  mAutoLoad = (gPrefs->Read(wxT("NyqBench/AutoLoad"), 0L) != 0);
668  mAutoWrap = (gPrefs->Read(wxT("NyqBench/AutoWrap"), true) != 0);
669  mLargeIcons = (gPrefs->Read(wxT("NyqBench/LargeIcons"), 0L) != 0);
670  mSplitMode = gPrefs->Read(wxT("NyqBench/SplitMode"), wxSPLIT_VERTICAL);
671  mShowCode = (gPrefs->Read(wxT("NyqBench/ShowScript"), true) != 0);
672  mShowOutput = (gPrefs->Read(wxT("NyqBench/ShowOutput"), true) != 0);
673 
674  SetIcon(wxICON(AudacityLogo));
675  SetBackgroundColour(wxSystemSettings::GetColour(wxSYS_COLOUR_3DFACE));
676  ShuttleGui S(this, eIsCreating);
678  wxMenuBar *bar = new wxMenuBar();
679 
680  wxMenu *menu = new wxMenu();
681  menu->Append(wxID_NEW, wxT("&New\tCtrl+N"));
682  menu->Append(wxID_OPEN, wxT("&Open...\tCtrl+O"));
683  menu->Append(wxID_SAVE, wxT("&Save...\tCtrl+S"));
684  menu->Append(wxID_SAVEAS, wxT("Save &As...\tCtrl+Shift+S"));
685  menu->AppendSeparator();
686  menu->Append(wxID_REVERT_TO_SAVED, _T("&Revert to Saved"));
687  menu->AppendSeparator();
688  menu->AppendCheckItem(ID_AUTOLOAD, _T("Auto &Load Last File"))->Check(mAutoLoad);
689  menu->AppendSeparator();
690  menu->Append(wxID_CLOSE, wxT("&Close Window\tCtrl+W"));
691  bar->Append(menu, wxT("&File"));
692 
693  menu = new wxMenu();
694  menu->Append(wxID_UNDO, _("&Undo\tCtrl+Z"));
695  menu->Append(wxID_REDO, _("&Redo\tCtrl+Y"));
696  menu->AppendSeparator();
697  menu->Append(wxID_CUT, _("Cu&t\tCtrl+X"));
698  menu->Append(wxID_COPY, _("&Copy\tCtrl+C"));
699  menu->Append(wxID_PASTE, _("&Paste\tCtrl+V"));
700  menu->Append(wxID_CLEAR, _("Cle&ar\tCtrl+L"));
701  menu->AppendSeparator();
702  menu->Append(wxID_SELECTALL, _("Select A&ll\tCtrl+A"));
703  menu->AppendSeparator();
704  menu->Append(wxID_FIND, _("&Find...\tCtrl+F"));
705  menu->AppendSeparator();
706  wxMenu *sub = new wxMenu();
707  sub->Append(ID_MATCH, _("&Matching Paren\tF8"));
708  sub->Append(ID_TOP, _("&Top S-expr\tF9"));
709  sub->Append(ID_UP, _("&Higher S-expr\tF10"));
710  sub->Append(ID_PREVIOUS, _("&Previous S-expr\tF11"));
711  sub->Append(ID_NEXT, _("&Next S-expr\tF12"));
712  menu->AppendSubMenu(sub, _("&Go to"));
713  menu->AppendSeparator();
714  menu->AppendCheckItem(ID_AUTOWRAP, _T("Auto &Wrap"))->Check(mAutoWrap);
715  bar->Append(menu, wxT("&Edit"));
716 
717  menu = new wxMenu();
718  menu->Append(ID_FONT, _("Select &Font..."));
719  menu->AppendSeparator();
720  menu->Append(ID_SPLITV, _("Split &Vertically"));
721  menu->Append(ID_SPLITH, _("Split &Horizontally"));
722  menu->AppendSeparator();
723  menu->AppendCheckItem(ID_TOGGLECODE, _("Show S&cript"));
724  menu->AppendCheckItem(ID_TOGGLEOUTPUT, _("Show &Output"));
725  menu->AppendSeparator();
726  sub = new wxMenu();
727  sub->AppendRadioItem(ID_LARGEICONS, _("&Large Icons"));
728  sub->AppendRadioItem(ID_SMALLICONS, _("&Small Icons"));
729  menu->AppendSubMenu(sub, _("Toolbar"));
730  bar->Append(menu, wxT("&View"));
731 
732  menu = new wxMenu();
733  menu->Append(ID_GO, _("&Go\tF5"));
734  menu->Append(ID_STOP, _("&Stop\tF6"));
735  bar->Append(menu, wxT("&Run"));
736 
737 #if defined(__WXMAC__)
738  menu->Append(wxID_ABOUT, _("&About"));
739 #else
740  menu = new wxMenu();
741  menu->Append(wxID_ABOUT, _("&About"));
742  bar->Append(menu, wxT("Help"));
743 #endif
744 
745  SetMenuBar(bar);
746 
748 
749  wxRect r;
750  r.SetX(gPrefs->Read(wxT("NyqBench/Window/X"), -1));
751  r.SetY(gPrefs->Read(wxT("NyqBench/Window/Y"), -1));
752  r.SetWidth(gPrefs->Read(wxT("NyqBench/Window/Width"), -1));
753  r.SetHeight(gPrefs->Read(wxT("NyqBench/Window/Height"), -1));
754  if (r == wxRect(-1, -1, -1, -1)) {
755  Center();
756  }
757  else {
758  SetSize(r);
759  }
760 
761  bool maximized = false;
762  gPrefs->Read(wxT("NyqBench/Window/Maximized"), maximized);
763  if (maximized) {
764  Maximize();
765  }
766 
767  long sashpos;
768  sashpos = gPrefs->Read(wxT("NyqBench/SplitX"), 0l);
769  if (sashpos > 0) {
770  mSplitter->SetSashPosition(sashpos);
771  }
772 
773  wxString dflt = wxSystemSettings::GetFont(wxSYS_SYSTEM_FONT).GetNativeFontInfoDesc();
774  wxString desc;
775  wxTextAttr attr;
776 
777  desc = gPrefs->Read(wxT("NyqBench/ScriptFont"), dflt);
778  mScriptFont.SetNativeFontInfo(desc);
779 #if defined(__WXMSW__)
780  // Force SYSTEM encoding to prevent conversion to Unicode in wxTextCtrl::DoWriteText().
781  // I don't know if this is something I'm doing wrong, but I'll have to look at this
782  // later if I get bored.
783  mScriptFont.SetEncoding(wxFONTENCODING_SYSTEM);
784 #endif
785  attr.SetFont(mScriptFont);
786  mScript->SetDefaultStyle(attr);
787 
788  desc = gPrefs->Read(wxT("NyqBench/OutputFont"), dflt);
789  mOutputFont.SetNativeFontInfo(desc);
790 #if defined(__WXMSW__)
791  // Force SYSTEM encoding to prevent conversion to Unicode in wxTextCtrl::DoWriteText().
792  // I don't know if this is something I'm doing wrong, but I'll have to look at this
793  // later if I get bored.
794  mOutputFont.SetEncoding(wxFONTENCODING_SYSTEM);
795 #endif
796  attr.SetFont(mOutputFont);
797  mOutput->SetDefaultStyle(attr);
798 
799  if (mAutoLoad && !mPath.GetFullPath().IsEmpty()) {
800  LoadFile();
801  }
802 
803  SetWindowTitle();
804 }
805 
807 {
808 }
809 
811 {
812  gPrefs->Write(wxT("NyqBench/Window/Maximized"), IsMaximized());
813  if (!IsMaximized()) {
814  wxRect r = GetRect();
815 
816 #if !defined(__WXMAC__)
817  if (IsIconized()) {
818  r = mLastSize;
819  }
820 #endif
821 
822  gPrefs->Write(wxT("NyqBench/Window/X"), r.GetX());
823  gPrefs->Write(wxT("NyqBench/Window/Y"), r.GetY());
824  gPrefs->Write(wxT("NyqBench/Window/Width"), r.GetWidth());
825  gPrefs->Write(wxT("NyqBench/Window/Height"), r.GetHeight());
826  }
827 
828  gPrefs->Write(wxT("NyqBench/AutoLoad"), mAutoLoad);
829  gPrefs->Write(wxT("NyqBench/AutoWrap"), mAutoWrap);
830  gPrefs->Write(wxT("NyqBench/ScriptFont"), mScriptFont.GetNativeFontInfoDesc());
831  gPrefs->Write(wxT("NyqBench/OutputFont"), mOutputFont.GetNativeFontInfoDesc());
832  gPrefs->Write(wxT("NyqBench/LargeIcons"), mLargeIcons);
833  gPrefs->Write(wxT("NyqBench/SplitX"), mSplitter->IsSplit() ? mSplitter->GetSashPosition() : 0);
834  gPrefs->Write(wxT("NyqBench/SplitMode"), mSplitter->IsSplit() ? mSplitter->GetSplitMode() : 0);
835  gPrefs->Write(wxT("NyqBench/ShowCode"), mScript->IsShown());
836  gPrefs->Write(wxT("NyqBench/ShowOutput"), mOutput->IsShown());
837 }
838 
840 {
841  S.StartHorizontalLay(wxEXPAND, true);
842  {
843  wxPanel *scriptp;
844  wxPanel *outputp;
845  wxStaticBoxSizer *scripts;
846  wxStaticBoxSizer *outputs;
847  wxBoxSizer *bs;
848 
849  mSplitter = new wxSplitterWindow(this,
850  wxID_ANY,
851  wxDefaultPosition,
852  wxDefaultSize,
853  wxSP_LIVE_UPDATE |
854  wxSP_3DSASH |
855  wxSP_NOBORDER);
856 
857  scriptp = new wxPanel(mSplitter,
858  wxID_ANY,
859  wxDefaultPosition,
860  wxDefaultSize,
861  wxNO_FULL_REPAINT_ON_RESIZE |
862  wxCLIP_CHILDREN);
863  bs = new wxBoxSizer(wxVERTICAL);
864  scriptp->SetSizer(bs);
865 
866  mScriptBox = new wxStaticBox(scriptp,
867  wxID_ANY,
868  _("Script"));
869 
870  scripts = new wxStaticBoxSizer(mScriptBox,
871  wxVERTICAL);
872  bs->Add(scripts, true, wxEXPAND);
873 
874  mScript = new NyqTextCtrl(scriptp,
875  ID_SCRIPT,
876  wxEmptyString,
877  wxDefaultPosition,
878  wxDefaultSize,
879  wxTE_RICH2 | wxTE_RICH |
880  (mAutoWrap ? wxTE_BESTWRAP : wxTE_DONTWRAP) |
881  wxTE_NOHIDESEL |
882  wxTE_MULTILINE);
883  scripts->Add(mScript, true, wxEXPAND);
884 
885  outputp = new wxPanel(mSplitter,
886  wxID_ANY,
887  wxDefaultPosition,
888  wxDefaultSize,
889  wxNO_FULL_REPAINT_ON_RESIZE |
890  wxCLIP_CHILDREN);
891  bs = new wxBoxSizer(wxVERTICAL);
892  outputp->SetSizer(bs);
893 
894  mOutputBox = new wxStaticBox(outputp,
895  wxID_ANY,
896  _("Output"));
897  outputs = new wxStaticBoxSizer(mOutputBox,
898  wxVERTICAL);
899  bs->Add(outputs, true, wxEXPAND);
900 
901  mOutput = new NyqTextCtrl(outputp,
902  ID_OUTPUT,
903  wxEmptyString,
904  wxDefaultPosition,
905  wxDefaultSize,
906  wxTE_READONLY |
907 #if !defined(__WXMAC__)
908 // I could not get the bloody horizontal scroll bar to appear on
909 // wxMac, so we can't use wxTE_DONTWRAP as you can't easily scroll
910 // left and right.
911  wxTE_DONTWRAP |
912 #endif
913  wxTE_NOHIDESEL |
914  wxTE_MULTILINE);
915  outputs->Add(mOutput, true, wxEXPAND);
916 
917  switch (mSplitMode)
918  {
919  case wxSPLIT_VERTICAL:
920  mSplitter->SplitVertically(scriptp, outputp, 300);
921  break;
922 
923  case wxSPLIT_HORIZONTAL:
924  mSplitter->SplitHorizontally(scriptp, outputp, 300);
925  break;
926 
927  default:
928  mSplitter->Initialize((mShowCode ? scriptp : outputp));
929  break;
930  }
931 
932  mSplitter->SetMinimumPaneSize(50);
933 
934  S.AddSpace(5, 1);
935  S.Prop(true);
936  S.Position(wxEXPAND).AddWindow(mSplitter);
937  S.AddSpace(5, 1);
938 
939  mSplitter->SetMinSize(wxSize(600, 400));
940  }
941  S.EndHorizontalLay();
942 
943  S.AddSpace(1, 5);
944 
945  return;
946 }
947 
948 void NyqBench::OnClose(wxCloseEvent & e)
949 {
950  if (!Validate()) {
951  e.Veto();
952  }
953  else {
954  Show(false);
955  }
956 }
957 
958 void NyqBench::OnMove(wxMoveEvent & e)
959 {
960  e.Skip();
961  if (!IsIconized() && !IsMaximized()) {
962  mLastSize.SetPosition(e.GetPosition());
963  }
964 }
965 
966 void NyqBench::OnSize(wxSizeEvent & e)
967 {
968  e.Skip();
969  if (!IsIconized() && !IsMaximized()) {
970  mLastSize.SetSize(e.GetSize());
971  }
972 }
973 
974 void NyqBench::OnCloseWindow(wxCommandEvent & e)
975 {
976  Close();
977 }
978 
979 void NyqBench::OnNew(wxCommandEvent & e)
980 {
981  if (!Validate()) {
982  return;
983  }
984 
985  mPath.SetFullName(wxEmptyString);
986 
987  while (mScript->CanUndo()) {
988  mScript->Undo();
989  }
990 
991  mScript->Clear();
992  mScript->DiscardEdits();
993 
994  SetWindowTitle();
995 }
996 
997 void NyqBench::OnOpen(wxCommandEvent & e)
998 {
999  if (mScript->IsModified() && !Validate()) {
1000  return;
1001  }
1002 
1003  wxFileDialog dlog(this,
1004  _("Load Nyquist script"),
1005  mPath.GetPath(),
1006  wxEmptyString,
1007  _("Nyquist scripts (*.ny)|*.ny|Lisp scripts (*.lsp)|*.lsp|All files|*"),
1008  wxFD_OPEN | wxRESIZE_BORDER);
1009 
1010  if (dlog.ShowModal() != wxID_OK) {
1011  return;
1012  }
1013 
1014  mPath = dlog.GetPath();
1015  gPrefs->Write(wxT("NyqBench/Path"), mPath.GetFullPath());
1016 
1017  LoadFile();
1018 
1019  SetWindowTitle();
1020 }
1021 
1022 void NyqBench::OnSave(wxCommandEvent & e)
1023 {
1024  if (mScript->GetLastPosition() == 0) {
1025  return;
1026  }
1027 
1028  if (mPath.GetFullPath().IsEmpty()) {
1029  OnSaveAs(e);
1030  return;
1031  }
1032 
1033  if (!mScript->SaveFile(mPath.GetFullPath()))
1034  {
1035  AudacityMessageBox(XO("Script was not saved."),
1036  XO("Warning"),
1037  wxICON_EXCLAMATION,
1038  this);
1039  return;
1040  }
1041 }
1042 
1043 void NyqBench::OnSaveAs(wxCommandEvent & e)
1044 {
1045  if (mScript->GetLastPosition() == 0) {
1046  return;
1047  }
1048 
1049  wxFileDialog dlog(this,
1050  _("Save Nyquist script"),
1051  mPath.GetFullPath(),
1052  wxEmptyString,
1053  _("Nyquist scripts (*.ny)|*.ny|Lisp scripts (*.lsp)|*.lsp|All files|*"),
1054  wxFD_SAVE | wxFD_OVERWRITE_PROMPT | wxRESIZE_BORDER);
1055 
1056  if (dlog.ShowModal() != wxID_OK) {
1057  return;
1058  }
1059 
1060  mPath = dlog.GetPath();
1061  gPrefs->Write(wxT("NyqBench/Path"), mPath.GetFullPath());
1062 
1063  if (!mScript->SaveFile(mPath.GetFullPath()))
1064  {
1065  AudacityMessageBox(XO("Script was not saved."),
1066  XO("Warning"),
1067  wxICON_EXCLAMATION,
1068  this);
1069  return;
1070  }
1071 
1072  SetWindowTitle();
1073 }
1074 
1075 void NyqBench::OnAutoLoad(wxCommandEvent & e)
1076 {
1077  mAutoLoad = e.IsChecked();
1078 }
1079 
1080 void NyqBench::OnRevert(wxCommandEvent & e)
1081 {
1082  if (mPath.GetFullPath().IsEmpty()) {
1083  return;
1084  }
1085 
1086  if (!Validate()) {
1087  return;
1088  }
1089 
1090  LoadFile();
1091 }
1092 
1093 void NyqBench::OnUndo(wxCommandEvent & e)
1094 {
1095  (FindFocus() == mScript ? mScript : mOutput)->Undo();
1096 }
1097 
1098 void NyqBench::OnRedo(wxCommandEvent & e)
1099 {
1100  (FindFocus() == mScript ? mScript : mOutput)->Redo();
1101 }
1102 
1103 void NyqBench::OnCut(wxCommandEvent & e)
1104 {
1105  (FindFocus() == mScript ? mScript : mOutput)->Cut();
1106 }
1107 
1108 void NyqBench::OnCopy(wxCommandEvent & e)
1109 {
1110  (FindFocus() == mScript ? mScript : mOutput)->Copy();
1111 }
1112 
1113 void NyqBench::OnPaste(wxCommandEvent & e)
1114 {
1115  (FindFocus() == mScript ? mScript : mOutput)->Paste();
1116 }
1117 
1118 void NyqBench::OnClear(wxCommandEvent & e)
1119 {
1120  (FindFocus() == mScript ? mScript : mOutput)->Clear();
1121 }
1122 
1123 void NyqBench::OnSelectAll(wxCommandEvent & e)
1124 {
1125  (FindFocus() == mScript ? mScript : mOutput)->SetSelection(-1, -1);
1126 }
1127 
1128 void NyqBench::OnFind(wxCommandEvent & e)
1129 {
1130  if (mFindDlg ) {
1131  delete mFindDlg;
1132  mFindDlg = NULL;
1133  }
1134  else {
1135  NyqTextCtrl *w = (NyqTextCtrl *) FindFocus();
1136  if (w == mScript || w == mOutput) {
1137  mFindText = w;
1138 
1139  int flags = 0;
1140 
1141  flags |= (gPrefs->Read(wxT("NyqBench/Find/Down"), 0L) ? wxFR_DOWN : 0);
1142  flags |= (gPrefs->Read(wxT("NyqBench/Find/Word"), 0L) ? wxFR_WHOLEWORD : 0);
1143  flags |= (gPrefs->Read(wxT("NyqBench/Find/Case"), 0L) ? wxFR_MATCHCASE : 0);
1144 
1145  mFindData.SetFlags(flags);
1146 
1147  mFindDlg = new wxFindReplaceDialog(this,
1148  &mFindData,
1149  _("Find dialog"),
1150  wxFR_NOWHOLEWORD);
1151  mFindDlg->Show(true);
1152  }
1153  }
1154 }
1155 
1156 void NyqBench::OnGoMatch(wxCommandEvent & e)
1157 {
1158  mScript->GoMatch();
1159 }
1160 
1161 void NyqBench::OnGoTop(wxCommandEvent & e)
1162 {
1163  mScript->GoTop();
1164 }
1165 
1166 void NyqBench::OnGoUp(wxCommandEvent & e)
1167 {
1168  mScript->GoUp();
1169 }
1170 
1171 void NyqBench::OnGoPrev(wxCommandEvent & e)
1172 {
1173  mScript->GoPrev();
1174 }
1175 
1176 void NyqBench::OnGoNext(wxCommandEvent & e)
1177 {
1178  mScript->GoNext();
1179 }
1180 
1181 void NyqBench::OnAutoWrap(wxCommandEvent & e)
1182 {
1183  mAutoWrap = e.IsChecked();
1184 
1185  wxWindow *parent = mScript->GetParent();
1186  wxString text = mScript->GetValue();
1187  bool focused = wxWindow::FindFocus() == mScript;
1188  long pos = mScript->GetInsertionPoint();
1189  long from;
1190  long to;
1191  mScript->GetSelection(&from, &to);
1192 
1193  wxSizer *s = mScript->GetContainingSizer();
1194  s->Detach(mScript);
1195  delete mScript;
1196 
1197  mScript = new NyqTextCtrl(parent,
1198  ID_SCRIPT,
1199  wxEmptyString,
1200  wxDefaultPosition,
1201  wxDefaultSize,
1202  (mAutoWrap ? wxTE_BESTWRAP : wxTE_DONTWRAP) |
1203  wxTE_NOHIDESEL | wxTE_RICH2 |
1204  wxTE_MULTILINE);
1205  s->Add(mScript, 1, wxEXPAND);
1206  s->Layout();
1207 
1208  mScript->ChangeValue(text);
1209  mScript->SetInsertionPoint(pos);
1210  mScript->SetSelection(from, to);
1211 
1212  if (focused) {
1213  mScript->SetFocus();
1214  }
1215 }
1216 
1217 void NyqBench::OnFont(wxCommandEvent & e)
1218 {
1219  wxWindow *w = FindFocus();
1220  wxFontData data;
1221  wxFontDialog dlg(this, data);
1222 
1223  if (w != mScript && w != mOutput) {
1224  return;
1225  }
1226 
1227  data.SetInitialFont(w == mScript ? mScriptFont : mOutputFont);
1228 
1229  if (dlg.ShowModal() == wxID_OK) {
1230  wxFontData retData = dlg.GetFontData();
1231  wxFont font = retData.GetChosenFont();
1232  wxTextAttr attr;
1233  attr.SetFont(font);
1234 
1235  if (w == mScript) {
1236  mScriptFont = font;
1237  }
1238  else {
1239  mOutputFont = font;
1240  }
1241 
1242  ((wxTextCtrl *)w)->SetDefaultStyle(attr);
1243  ((wxTextCtrl *)w)->SetStyle(0, ((wxTextCtrl *)w)->GetLastPosition(), attr);
1244  w->Refresh();
1245  }
1246 }
1247 
1248 void NyqBench::OnSplitV(wxCommandEvent & e)
1249 {
1250  if (mSplitter->IsSplit()) {
1251  mSplitter->Unsplit();
1252  }
1253 
1254  mSplitter->SplitVertically(mScript->GetParent(), mOutput->GetParent());
1255 }
1256 
1257 void NyqBench::OnSplitH(wxCommandEvent & e)
1258 {
1259  if (mSplitter->IsSplit()) {
1260  mSplitter->Unsplit();
1261  }
1262 
1263  mSplitter->SplitHorizontally(mScript->GetParent(), mOutput->GetParent());
1264 }
1265 
1266 void NyqBench::OnToggleCode(wxCommandEvent & e)
1267 {
1268  if (e.IsChecked()) {
1269  if (mSplitter->IsSplit()) {
1270  // Should never happen
1271  return;
1272  }
1273 
1274  if (mSplitMode == wxSPLIT_VERTICAL) {
1275  mSplitter->SplitVertically(mScript->GetParent(), mOutput->GetParent());
1276  }
1277  else {
1278  mSplitter->SplitHorizontally(mScript->GetParent(), mOutput->GetParent());
1279  }
1280  }
1281  else {
1282  if (!mSplitter->IsSplit()) {
1283  // Should never happen
1284  return;
1285  }
1286 
1287  mSplitMode = mSplitter->GetSplitMode();
1288  mSplitter->Unsplit(mScript->GetParent());
1289  }
1290 }
1291 
1292 void NyqBench::OnToggleOutput(wxCommandEvent & e)
1293 {
1294  if (e.IsChecked()) {
1295  if (mSplitter->IsSplit()) {
1296  // Should never happen
1297  return;
1298  }
1299 
1300  if (mSplitMode == wxSPLIT_VERTICAL) {
1301  mSplitter->SplitVertically(mScript->GetParent(), mOutput->GetParent());
1302  }
1303  else {
1304  mSplitter->SplitHorizontally(mScript->GetParent(), mOutput->GetParent());
1305  }
1306  }
1307  else {
1308  if (!mSplitter->IsSplit()) {
1309  // Should never happen
1310  return;
1311  }
1312 
1313  mSplitMode = mSplitter->GetSplitMode();
1314  mSplitter->Unsplit(mOutput->GetParent());
1315  }
1316 }
1317 
1318 void NyqBench::OnSmallIcons(wxCommandEvent & e)
1319 {
1320  RecreateToolbar(false);
1321 }
1322 
1323 void NyqBench::OnLargeIcons(wxCommandEvent & e)
1324 {
1325  RecreateToolbar(true);
1326 }
1327 
1328 void NyqBench::OnGo(wxCommandEvent & e)
1329 {
1330  // No need to delete...EffectManager will do it
1331  mEffect = new NyquistEffect(wxT("Nyquist Effect Workbench"));
1333 
1334  mEffect->SetCommand(mScript->GetValue());
1336 
1338  wxASSERT(p != NULL);
1339 
1340  if (p) {
1341  wxWindowDisabler disable(this);
1342  NyqRedirector redir((NyqTextCtrl *)mOutput);
1343 
1344  mRunning = true;
1345  UpdateWindowUI();
1346 
1347  EffectUI::DoEffect(ID, CommandContext(*p), 0);
1348 
1349  mRunning = false;
1350  UpdateWindowUI();
1351  }
1352 
1353  Raise();
1354 
1356 }
1357 
1358 void NyqBench::OnStop(wxCommandEvent & e)
1359 {
1360  mRunning = false;
1361  mEffect->Stop();
1362 }
1363 
1364 void NyqBench::OnAbout(wxCommandEvent & e)
1365 {
1366  wxAboutDialogInfo i;
1367 
1368  i.AddArtist(_("Harvey Lubin (logo)"));
1369  i.AddArtist(_("Tango Icon Gallery (toolbar icons)"));
1370  i.AddDeveloper(_("Leland Lucius"));
1371  i.SetCopyright(_("(C) 2009 by Leland Lucius"));
1372  i.SetDescription(_("External Audacity module which provides a simple IDE for writing effects."));
1373  i.SetName(_("Nyquist Effect Workbench"));
1374  i.SetVersion(__TDATE__);
1375 
1376  wxAboutBox(i);
1377 }
1378 
1379 void NyqBench::OnFindDialog(wxFindDialogEvent & e)
1380 {
1381  wxEventType type = e.GetEventType();
1382 
1383  if (type == wxEVT_COMMAND_FIND_CLOSE) {
1384  wxFindReplaceDialog *dlg = e.GetDialog();
1385 
1386  dlg->Destroy();
1387 
1388  int flags = mFindData.GetFlags();
1389 
1390  gPrefs->Write(wxT("NyqBench/Find/Down"), (flags & wxFR_DOWN) != 0);
1391  gPrefs->Write(wxT("NyqBench/Find/Word"), (flags & wxFR_WHOLEWORD) != 0);
1392  gPrefs->Write(wxT("NyqBench/Find/Case"), (flags & wxFR_MATCHCASE) != 0);
1393 
1394  mFindDlg = NULL;
1395  mFindText = NULL;
1396 
1397  return;
1398  }
1399 
1400  wxString text = mFindText->GetValue();
1401 
1402 #if defined(__WXMSW__)
1403  // We cheat on Windows. We know that the Windows text control
1404  // uses CRLF for line endings and if we don't account for that,
1405  // the selection positions will be off.
1406  //
1407  // Not sure why I thought I needed this, but it appears not to
1408  // be. Leaving just in case.
1409  //
1410  // text.Replace(wxT("\n"), wxT("\r\n"));
1411 #endif
1412 
1413  size_t startpos = mFindText->GetInsertionPoint();
1414  size_t len = mFindText->GetLastPosition();
1415  size_t pos;
1416 
1417  wxString find = e.GetFindString();
1418  bool down = (e.GetFlags() & wxFR_DOWN) != 0;
1419  bool mixed = (e.GetFlags() & wxFR_MATCHCASE) != 0;
1420 
1421  if (!mixed) {
1422  text.MakeUpper();
1423  find.MakeUpper();
1424  }
1425 
1426  if (down) {
1427  pos = text.find(find, startpos);
1428  if (type == wxEVT_COMMAND_FIND_NEXT && pos == startpos && pos < len) {
1429  pos = text.find(find, startpos + 1);
1430  }
1431  }
1432  else {
1433  pos = text.rfind(find, startpos);
1434  if (type == wxEVT_COMMAND_FIND_NEXT && pos == startpos && pos > 0) {
1435  pos = text.rfind(find, startpos - 1);
1436  }
1437  }
1438 
1439  if (pos == wxString::npos) {
1440  AudacityMessageBox(XO("No matches found"),
1441  XO("Nyquist Effect Workbench"),
1442  wxOK | wxCENTER,
1443  e.GetDialog());
1444 
1445  return;
1446  }
1447 
1448  mFindText->SetInsertionPoint((long)pos);
1449 
1450 #if defined(__WXGTK__)
1451  // GTK's selection and intertion pointer interact where the insertion
1452  // pointer winds up after the second parameter, so we reverse them to
1453  // force the pointer at the beginning of the selection. Doing so
1454  // allows reverse find to work properly.
1455  mFindText->SetSelection((long)(pos + find.Length()), (long)pos);
1456 #else
1457  mFindText->SetSelection((long)pos, (long)(pos + find.Length()));
1458 #endif
1459 
1460 #if defined(__WXMAC__)
1461  // Doing this coaxes the text control to update the selection. Without
1462  // it the selection doesn't appear to change if the found string is within
1463  // the currently displayed text, i.e., no reposition is needed.
1464  mFindText->Show(false);
1465  mFindText->Show(true);
1466 #endif
1467 }
1468 
1469 void NyqBench::OnTextUpdate(wxCommandEvent & e)
1470 {
1471  // This really shouldn't be necessary, but Paste()ing doesn't mark the
1472  // control as dirty...at least on the Mac.
1473  ((NyqTextCtrl *) e.GetEventObject())->MarkDirty();
1474 }
1475 
1476 void NyqBench::OnMenuUpdate(wxUpdateUIEvent & e)
1477 {
1478  if (e.GetId() != wxID_REVERT_TO_SAVED) {
1479  e.Enable((mScript->GetLastPosition() > 0) || mScript->IsModified());
1480  }
1481  else {
1482  e.Enable(mScript->IsModified());
1483  }
1484 }
1485 
1486 void NyqBench::OnUndoUpdate(wxUpdateUIEvent & e)
1487 {
1488  e.Enable((FindFocus() == mScript ? mScript : mOutput)->CanUndo());
1489 }
1490 
1491 void NyqBench::OnRedoUpdate(wxUpdateUIEvent & e)
1492 {
1493  e.Enable((FindFocus() == mScript ? mScript : mOutput)->CanRedo());
1494 }
1495 
1496 void NyqBench::OnCutUpdate(wxUpdateUIEvent & e)
1497 {
1498  e.Enable((FindFocus() == mScript ? mScript : mOutput)->CanCut());
1499 }
1500 
1501 void NyqBench::OnCopyUpdate(wxUpdateUIEvent & e)
1502 {
1503  e.Enable((FindFocus() == mScript ? mScript : mOutput)->CanCopy());
1504 }
1505 
1506 void NyqBench::OnPasteUpdate(wxUpdateUIEvent & e)
1507 {
1508  e.Enable((FindFocus() == mScript ? mScript : mOutput)->CanPaste());
1509 }
1510 
1511 void NyqBench::OnClearUpdate(wxUpdateUIEvent & e)
1512 {
1513  e.Enable(FindFocus() == mOutput ? true : false);
1514 }
1515 
1516 void NyqBench::OnViewUpdate(wxUpdateUIEvent & e)
1517 {
1518  wxMenuBar *bar = GetMenuBar();
1519  bar->Enable(ID_SPLITV, !mSplitter->IsSplit() || mSplitter->GetSplitMode() != wxSPLIT_VERTICAL);
1520  bar->Enable(ID_SPLITH, !mSplitter->IsSplit() || mSplitter->GetSplitMode() != wxSPLIT_HORIZONTAL);
1521  bar->Check(ID_TOGGLECODE, mScript->GetParent()->IsShown());
1522  bar->Check(ID_TOGGLEOUTPUT, mOutput->GetParent()->IsShown());
1523  bar->Check(ID_LARGEICONS, mLargeIcons);
1524  bar->Check(ID_SMALLICONS, !mLargeIcons);
1525 }
1526 
1527 void NyqBench::OnRunUpdate(wxUpdateUIEvent & e)
1528 {
1530  wxToolBar *tbar = GetToolBar();
1531  wxMenuBar *mbar = GetMenuBar();
1532 
1533  auto gAudioIO = AudioIOBase::Get();
1534  if (p && gAudioIO->IsBusy()) {
1535  mbar->Enable(ID_GO, false);
1536  mbar->Enable(ID_STOP, false);
1537 
1538  tbar->EnableTool(ID_GO, false);
1539  tbar->EnableTool(ID_STOP, false);
1540  }
1541  else {
1542  mbar->Enable(ID_GO, (mScript->GetLastPosition() > 0) && !mRunning);
1543  mbar->Enable(ID_STOP, (mScript->GetLastPosition() > 0) && mRunning);
1544 
1545  tbar->EnableTool(ID_GO, (mScript->GetLastPosition() > 0) && !mRunning);
1546  tbar->EnableTool(ID_STOP, (mScript->GetLastPosition() > 0) && mRunning);
1547  }
1548 }
1549 
1550 void NyqBench::OnScriptUpdate(wxUpdateUIEvent & e)
1551 {
1552  if (mScriptBox && mScript && FindFocus() == mScript) {
1553  wxString label = mScriptBox->GetLabel();
1554  if (label == _("Script")) {
1555  label += wxT("*");
1556  mScriptBox->SetLabel(label);
1557  mOutputBox->SetLabel(_("Output"));
1558  }
1559  }
1560 }
1561 
1562 void NyqBench::OnOutputUpdate(wxUpdateUIEvent & e)
1563 {
1564  if (mOutputBox && mOutput && FindFocus() == mOutput) {
1565  wxString label = mOutputBox->GetLabel();
1566  if (label == _("Output")) {
1567  label += wxT("*");
1568  mOutputBox->SetLabel(label);
1569  mScriptBox->SetLabel(_("Script"));
1570  }
1571  }
1572 }
1573 
1575 {
1576  if (mScript->GetLastPosition() > 0 && mScript->IsModified()) {
1577  int ans;
1578  ans = AudacityMessageBox(XO("Code has been modified. Are you sure?"),
1579  XO("Warning"),
1580  wxYES_NO | wxICON_QUESTION,
1581  this);
1582  if (ans == wxNO) {
1583  return false;
1584  }
1585  }
1586 
1587  return true;
1588 }
1589 
1591 {
1592  wxString name = _("Untitled");
1593 
1594  if (!mPath.GetFullPath().IsEmpty()) {
1595  name = mPath.GetFullName();
1596  }
1597 
1598  SetTitle(_("Nyquist Effect Workbench - ") + name);
1599 }
1600 
1602 {
1603  mLargeIcons = large;
1604 
1605  wxToolBar *tb = GetToolBar();
1606  if (tb) {
1607  delete tb;
1608  }
1609  tb = CreateToolBar();
1610 
1611  wxSize sz;
1612 
1613  if (!mLargeIcons) {
1614  tb->SetToolBitmapSize(wxSize(16, 16));
1615  mPics[0] = wxBitmap(document_new_small);
1616  mPics[1] = wxBitmap(document_open_small);
1617  mPics[2] = wxBitmap(document_save_as_small);
1618  mPics[3] = wxBitmap(document_save_small);
1619  mPics[4] = wxBitmap(edit_copy_small);
1620  mPics[5] = wxBitmap(edit_cut_small);
1621  mPics[6] = wxBitmap(edit_paste_small);
1622  mPics[7] = wxBitmap(edit_clear_small);
1623  mPics[8] = wxBitmap(edit_delete_small);
1624  mPics[9] = wxBitmap(edit_select_all_small);
1625  mPics[10] = wxBitmap(edit_undo_small);
1626  mPics[11] = wxBitmap(edit_redo_small);
1627  mPics[12] = wxBitmap(edit_find_small);
1628  mPics[13] = wxBitmap(system_search_small);
1629  mPics[14] = wxBitmap(go_top_small);
1630  mPics[15] = wxBitmap(go_up_small);
1631  mPics[16] = wxBitmap(go_previous_small);
1632  mPics[17] = wxBitmap(go_next_small);
1633  mPics[18] = wxBitmap(media_playback_start_small);
1634  mPics[19] = wxBitmap(media_playback_stop_small);
1635  }
1636  else {
1637  tb->SetToolBitmapSize(wxSize(32, 32));
1638  mPics[0] = wxBitmap(document_new_large);
1639  mPics[1] = wxBitmap(document_open_large);
1640  mPics[2] = wxBitmap(document_save_as_large);
1641  mPics[3] = wxBitmap(document_save_large);
1642  mPics[4] = wxBitmap(edit_copy_large);
1643  mPics[5] = wxBitmap(edit_cut_large);
1644  mPics[6] = wxBitmap(edit_paste_large);
1645  mPics[7] = wxBitmap(edit_clear_large);
1646  mPics[8] = wxBitmap(edit_delete_large);
1647  mPics[9] = wxBitmap(edit_select_all_large);
1648  mPics[10] = wxBitmap(edit_undo_large);
1649  mPics[11] = wxBitmap(edit_redo_large);
1650  mPics[12] = wxBitmap(edit_find_large);
1651  mPics[13] = wxBitmap(system_search_large);
1652  mPics[14] = wxBitmap(go_top_large);
1653  mPics[15] = wxBitmap(go_up_large);
1654  mPics[16] = wxBitmap(go_previous_large);
1655  mPics[17] = wxBitmap(go_next_large);
1656  mPics[18] = wxBitmap(media_playback_start_large);
1657  mPics[19] = wxBitmap(media_playback_stop_large);
1658  }
1659 
1660  tb->SetMargins(2, 2);
1661 
1662  tb->AddTool(wxID_NEW, _("New"), mPics[0], _("New script"));
1663  tb->AddTool(wxID_OPEN, _("Open"), mPics[1], _("Open script"));
1664  tb->AddTool(wxID_SAVE, _("Save"), mPics[2], _("Save script"));
1665  tb->AddTool(wxID_SAVEAS, _("Save As"), mPics[3], _("Save script as..."));
1666  tb->AddSeparator();
1667  tb->AddTool(wxID_COPY, _("Copy"), mPics[4], _("Copy to clipboard"));
1668  tb->AddTool(wxID_CUT, _("Cut"), mPics[5], _("Cut to clipboard"));
1669  tb->AddTool(wxID_PASTE, _("Paste"), mPics[6], _("Paste from clipboard"));
1670  tb->AddTool(wxID_CLEAR, _("Clear"), mPics[7], _("Clear selection"));
1671  tb->AddTool(wxID_SELECTALL, _("Select All"), mPics[9], _("Select all text"));
1672  tb->AddSeparator();
1673  tb->AddTool(wxID_UNDO, _("Undo"), mPics[10], _("Undo last change"));
1674  tb->AddTool(wxID_REDO, _("Redo"), mPics[11], _("Redo previous change"));
1675  tb->AddSeparator();
1676  tb->AddTool(wxID_FIND, _("Find"), mPics[12], _("Find text"));
1677  tb->AddSeparator();
1678  tb->AddTool(ID_MATCH, _("Match"), mPics[13], _("Go to matching paren"));
1679  tb->AddTool(ID_TOP, _("Top"), mPics[14], _("Go to top S-expr"));
1680  tb->AddTool(ID_UP, _("Up"), mPics[15], _("Go to higher S-expr"));
1681  tb->AddTool(ID_PREVIOUS, _("Previous"), mPics[16], _("Go to previous S-expr"));
1682  tb->AddTool(ID_NEXT, _("Next"), mPics[17], _("Go to next S-expr"));
1683  tb->AddSeparator();
1684  tb->AddTool(ID_GO, _("Start"), mPics[18], _("Start script"));
1685  tb->AddTool(ID_STOP, _("Stop"), mPics[19], _("Stop script"));
1686 
1687  tb->Realize();
1688 
1689  Layout();
1690  Fit();
1691  SetMinSize(GetSize());
1692 }
1693 
1695 {
1696  wxString path = mPath.GetFullPath();
1697 
1698  if (path.IsEmpty()) {
1699  return;
1700  }
1701 
1702  wxFFile f(path);
1703  if (f.IsOpened()) {
1704  wxString t;
1705  if (f.ReadAll(&t)) {
1706 //#if defined(__WXGTK__) || defined(__WXMAC__)
1707  t.Replace(wxT("\r\n"), wxT("\n"));
1708  t.Replace(wxT("\r"), wxT("\n"));
1709 //#elif defined(__WXMSW__)
1710 // t.Replace("\r\n", "\n");
1711 //#endif
1712  mScript->SetValue(t);
1713  mScript->DiscardEdits();
1714  }
1715  }
1716 
1717 // mScript->LoadFile(mPath.GetFullPath());
1718 }
1719 
1720 //----------------------------------------------------------------------------
1721 // Connects Audacity menu item to an action in this dll.
1722 // Only one action implemented so far.
1723 //----------------------------------------------------------------------------
1725 {
1726  Show();
1727 }
NyqBench::OnMove
void OnMove(wxMoveEvent &e)
Definition: NyqBench.cpp:958
ID_STOP
@ ID_STOP
Definition: NyqBench.cpp:561
AudioIOBase.h
ID_TOGGLECODE
@ ID_TOGGLECODE
Definition: NyqBench.cpp:550
NyqBench::OnRedo
void OnRedo(wxCommandEvent &e)
Definition: NyqBench.cpp:1098
NyqBench
Definition: NyqBench.h:100
eIsCreating
@ eIsCreating
Definition: ShuttleGui.h:37
ID_NEXT
@ ID_NEXT
Definition: NyqBench.cpp:558
NyqBench.h
DLL_API
#define DLL_API
Definition: ModuleConstants.h:20
NyquistEffect::Stop
void Stop()
Definition: Nyquist.cpp:1786
NyqBench::OnLargeIcons
void OnLargeIcons(wxCommandEvent &e)
Definition: NyqBench.cpp:1323
NyqBench::mOutputFont
wxFont mOutputFont
Definition: NyqBench.h:195
NyqBench::OnGoMatch
void OnGoMatch(wxCommandEvent &e)
Definition: NyqBench.cpp:1156
NyqBench::mShowOutput
bool mShowOutput
Definition: NyqBench.h:201
ID_GO
@ ID_GO
Definition: NyqBench.cpp:560
NyqBench::OnRevert
void OnRevert(wxCommandEvent &e)
Definition: NyqBench.cpp:1080
MenuTable::FinderScope
Definition: CommandManager.h:472
NyqBench::mFindText
NyqTextCtrl * mFindText
Definition: NyqBench.h:190
NyqBench::GetBench
static NyqBench * GetBench()
Definition: NyqBench.cpp:638
anonymous_namespace{NyqBench.cpp}::findme
CommandHandlerObject & findme(AudacityProject &)
Definition: NyqBench.cpp:98
NyqBench::OnSplitV
void OnSplitV(wxCommandEvent &e)
Definition: NyqBench.cpp:1248
gPrefs
FileConfig * gPrefs
Definition: Prefs.cpp:68
NyqBench::mFindData
wxFindReplaceData mFindData
Definition: NyqBench.h:189
AudacityMessageBox
int AudacityMessageBox(const TranslatableString &message, const TranslatableString &caption=AudacityMessageBoxCaptionStr(), long style=wxOK|wxCENTRE, wxWindow *parent=NULL, int x=wxDefaultCoord, int y=wxDefaultCoord)
Definition: AudacityMessageBox.h:20
NyqBench::OnToggleCode
void OnToggleCode(wxCommandEvent &e)
Definition: NyqBench.cpp:1266
NyqBench::OnClose
void OnClose(wxCloseEvent &e)
Definition: NyqBench.cpp:948
NyquistEffect
An Effect that calls up a Nyquist (XLISP) plug-in, i.e. many possible effects from this one class.
Definition: Nyquist.h:65
NyqRedirector::s
std::string s
Definition: NyqBench.h:90
Project.h
AudioIONotBusyFlag
const ReservedCommandFlag & AudioIONotBusyFlag()
Definition: CommonCommandFlags.cpp:127
NyqBench::OnGoNext
void OnGoNext(wxCommandEvent &e)
Definition: NyqBench.cpp:1176
NyqBench::OnMenuUpdate
void OnMenuUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1476
EffectManager::UnregisterEffect
void UnregisterEffect(const PluginID &ID)
Definition: EffectManager.cpp:70
NyqRedirector::NyqRedirector
NyqRedirector(NyqTextCtrl *text)
Definition: NyqBench.cpp:506
GetActiveProject
AUDACITY_DLL_API AudacityProject * GetActiveProject()
Definition: Project.cpp:107
ID_AUTOLOAD
@ ID_AUTOLOAD
Definition: NyqBench.cpp:543
ShuttleGui::AddSpace
wxSizerItem * AddSpace(int width, int height, int prop=0)
Definition: ShuttleGui.cpp:2421
NyqBench::OnFindDialog
void OnFindDialog(wxFindDialogEvent &e)
Definition: NyqBench.cpp:1379
NyqBench::OnCutUpdate
void OnCutUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1496
XO
#define XO(s)
Definition: Internat.h:31
ID_FONT
@ ID_FONT
Definition: NyqBench.cpp:547
NyqBench::OnOpen
void OnOpen(wxCommandEvent &e)
Definition: NyqBench.cpp:997
NyqTextCtrl::MoveCursor
void MoveCursor(long first, long second)
Definition: NyqBench.cpp:381
NyqBench::mLargeIcons
bool mLargeIcons
Definition: NyqBench.h:203
MenuTable::AttachedItem
Definition: CommandManager.h:695
EffectManager::Get
static EffectManager & Get()
Definition: EffectManager.cpp:42
NyqBench::OnGoUp
void OnGoUp(wxCommandEvent &e)
Definition: NyqBench.cpp:1166
NyqBench::LoadFile
void LoadFile()
Definition: NyqBench.cpp:1694
NyqBench::OnGo
void OnGo(wxCommandEvent &e)
Definition: NyqBench.cpp:1328
NyqBench::OnFind
void OnFind(wxCommandEvent &e)
Definition: NyqBench.cpp:1128
ID_SPLITH
@ ID_SPLITH
Definition: NyqBench.cpp:549
ID_OUTPUT
@ ID_OUTPUT
Definition: NyqBench.cpp:564
desc
const TranslatableString desc
Definition: ExportPCM.cpp:56
NyqRedirector::mOld
std::streambuf * mOld
Definition: NyqBench.h:91
NyqBench::NyqBench
NyqBench(wxWindow *parent)
Definition: NyqBench.cpp:648
NyqBench::OnRedoUpdate
void OnRedoUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1491
NyqBench::mLastSize
wxRect mLastSize
Definition: NyqBench.h:211
NyqBench::OnCloseWindow
void OnCloseWindow(wxCommandEvent &e)
Definition: NyqBench.cpp:974
NyqRedirector::overflow
int overflow(int c)
Definition: NyqBench.cpp:521
NyqBench::mSplitMode
int mSplitMode
Definition: NyqBench.h:199
EffectUI.h
NyqBench::OnSaveAs
void OnSaveAs(wxCommandEvent &e)
Definition: NyqBench.cpp:1043
NyqBench::mScriptBox
wxStaticBox * mScriptBox
Definition: NyqBench.h:182
EffectManager::RegisterEffect
const PluginID & RegisterEffect(Effect *f)
Definition: EffectManager.cpp:59
NyqTextCtrl::OnUpdate
void OnUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:265
AppQuiting
@ AppQuiting
Definition: ModuleConstants.h:29
NyqRedirector
Definition: NyqBench.h:80
XXO
#define XXO(s)
Definition: Internat.h:44
NyqBench::OnRunUpdate
void OnRunUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1527
ID_SMALLICONS
@ ID_SMALLICONS
Definition: NyqBench.cpp:552
NyqBench::mAutoWrap
bool mAutoWrap
Definition: NyqBench.h:209
NyqBench::OnPaste
void OnPaste(wxCommandEvent &e)
Definition: NyqBench.cpp:1113
ShuttleGuiBase::EndHorizontalLay
void EndHorizontalLay()
Definition: ShuttleGui.cpp:1170
NyqBench::mPics
wxBitmap mPics[20]
Definition: NyqBench.h:197
NyqBench::mRunning
bool mRunning
Definition: NyqBench.h:205
NyqBench::OnNew
void OnNew(wxCommandEvent &e)
Definition: NyqBench.cpp:979
CommandContext
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
Definition: CommandContext.h:22
label
TranslatableString label
Definition: Tags.cpp:755
ShuttleGuiBase::StartHorizontalLay
void StartHorizontalLay(int PositionFlags=wxALIGN_CENTRE, int iProp=1)
Definition: ShuttleGui.cpp:1160
NyqBench::OnTextUpdate
void OnTextUpdate(wxCommandEvent &e)
Definition: NyqBench.cpp:1469
NyqBench::Validate
virtual bool Validate()
Definition: NyqBench.cpp:1574
NyqBench::OnScriptUpdate
void OnScriptUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1550
NyqTextCtrl::FindParens
void FindParens()
Definition: NyqBench.cpp:428
anonymous_namespace{Contrast.cpp}::sAttachment
AttachedItem sAttachment
Definition: Contrast.cpp:696
NyqRedirector::mText
NyqTextCtrl * mText
Definition: NyqBench.h:92
NyqBench::mPath
wxFileName mPath
Definition: NyqBench.h:207
NyqBench::SavePrefs
void SavePrefs()
Definition: NyqBench.cpp:810
PluginID
wxString PluginID
Definition: EffectManager.h:30
NyqBench::ShowNyqBench
void ShowNyqBench(const CommandContext &)
Definition: NyqBench.cpp:1724
NyqBench::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S)
Definition: NyqBench.cpp:839
name
const TranslatableString name
Definition: Distortion.cpp:98
NyqBench::mSplitter
wxSplitterWindow * mSplitter
Definition: NyqBench.h:186
NyqTextCtrl::MarkDirty
void MarkDirty()
Definition: NyqBench.cpp:190
NyqRedirector::~NyqRedirector
virtual ~NyqRedirector()
Definition: NyqBench.cpp:512
NyqBench::OnGoTop
void OnGoTop(wxCommandEvent &e)
Definition: NyqBench.cpp:1161
NyqBench::RecreateToolbar
void RecreateToolbar(bool large=false)
Definition: NyqBench.cpp:1601
NyqBench::mScriptFont
wxFont mScriptFont
Definition: NyqBench.h:194
AudioIOBase::Get
static AudioIOBase * Get()
Definition: AudioIOBase.cpp:94
NyqTextCtrl::Colorize
void Colorize(long left, long right)
Definition: NyqBench.cpp:398
ID_LARGEICONS
@ ID_LARGEICONS
Definition: NyqBench.cpp:553
ID_SCRIPT
@ ID_SCRIPT
Definition: NyqBench.cpp:563
NyqBench::mAutoLoad
bool mAutoLoad
Definition: NyqBench.h:208
ShuttleGui.h
ID_TOGGLEOUTPUT
@ ID_TOGGLEOUTPUT
Definition: NyqBench.cpp:551
NyqBench::OnUndoUpdate
void OnUndoUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1486
ID_AUTOWRAP
@ ID_AUTOWRAP
Definition: NyqBench.cpp:545
ModuleConstants.h
ID_UP
@ ID_UP
Definition: NyqBench.cpp:556
NyqBench::mOutputBox
wxStaticBox * mOutputBox
Definition: NyqBench.h:183
ShuttleGui::Prop
ShuttleGui & Prop(int iProp)
Definition: ShuttleGui.h:719
Nyquist.h
NyqBench::OnClear
void OnClear(wxCommandEvent &e)
Definition: NyqBench.cpp:1118
NyqBench::OnPasteUpdate
void OnPasteUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1506
ModuleDispatchTypes
ModuleDispatchTypes
Definition: ModuleConstants.h:25
NyqTextCtrl::GoPrev
void GoPrev()
Definition: NyqBench.cpp:341
NyqTextCtrl
Definition: NyqBench.h:30
ID_PREVIOUS
@ ID_PREVIOUS
Definition: NyqBench.cpp:557
NyqBench::OnSave
void OnSave(wxCommandEvent &e)
Definition: NyqBench.cpp:1022
NyqBench::OnToggleOutput
void OnToggleOutput(wxCommandEvent &e)
Definition: NyqBench.cpp:1292
ShuttleGuiBase::AddWindow
wxWindow * AddWindow(wxWindow *pWindow)
Definition: ShuttleGui.cpp:292
NyqBench::OnSelectAll
void OnSelectAll(wxCommandEvent &e)
Definition: NyqBench.cpp:1123
NyqBench::OnSmallIcons
void OnSmallIcons(wxCommandEvent &e)
Definition: NyqBench.cpp:1318
ShuttleGui::Position
ShuttleGui & Position(int flags)
Definition: ShuttleGui.h:706
ID_SPLITV
@ ID_SPLITV
Definition: NyqBench.cpp:548
NyqBench::OnCopyUpdate
void OnCopyUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1501
NyqBench::OnAbout
void OnAbout(wxCommandEvent &e)
Definition: NyqBench.cpp:1364
NyqBench::SetWindowTitle
void SetWindowTitle()
Definition: NyqBench.cpp:1590
_
#define _(s)
Definition: Internat.h:75
gBench
static DEFINE_VERSION_CHECK NyqBench * gBench
Definition: NyqBench.cpp:121
NyqTextCtrl::OnChar
void OnChar(wxKeyEvent &e)
Definition: NyqBench.cpp:196
MenuTable::Command
std::unique_ptr< CommandItem > Command(const CommandID &name, const TranslatableString &label_in, void(Handler::*pmf)(const CommandContext &), CommandFlag flags, const CommandManager::Options &options={}, CommandHandlerFinder finder=FinderScope::DefaultFinder())
Definition: CommandManager.h:662
AudacityProject
The top-level handle to an Audacity project. It serves as a source of events that other objects can b...
Definition: Project.h:112
NyqTextCtrl::GoMatch
void GoMatch()
Definition: NyqBench.cpp:292
ID_TOP
@ ID_TOP
Definition: NyqBench.cpp:555
AudacityMessageBox.h
NyqBench::OnStop
void OnStop(wxCommandEvent &e)
Definition: NyqBench.cpp:1358
NyqBench::OnViewUpdate
void OnViewUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1516
CommandHandlerObject
wxEvtHandler CommandHandlerObject
Definition: CommandFunctors.h:28
NyqBench::OnAutoLoad
void OnAutoLoad(wxCommandEvent &e)
Definition: NyqBench.cpp:1075
NyquistEffect::SetCommand
void SetCommand(const wxString &cmd)
Definition: Nyquist.cpp:1767
NyqBench::OnCut
void OnCut(wxCommandEvent &e)
Definition: NyqBench.cpp:1103
EffectUI::DoEffect
AUDACITY_DLL_API bool DoEffect(const PluginID &ID, const CommandContext &context, unsigned flags)
'Repeat Last Effect'.
Definition: EffectUI.cpp:1859
anonymous_namespace{NyqBench.cpp}::RegisterMenuItems
void RegisterMenuItems()
Definition: NyqBench.cpp:103
NyqTextCtrl::SetFocusFromKbd
void SetFocusFromKbd()
Definition: NyqBench.cpp:179
DEFINE_VERSION_CHECK
Definition: ModNullCallback.cpp:73
NyqTextCtrl::GoTop
void GoTop()
Definition: NyqBench.cpp:297
NyqTextCtrl::GoUp
void GoUp()
Definition: NyqBench.cpp:319
MenuTable::Section
std::unique_ptr< MenuPart > Section(const Identifier &internalName, Args &&... args)
Definition: CommandManager.h:598
NyqBench::mScript
NyqTextCtrl * mScript
Definition: NyqBench.h:184
NyqBench::mFindDlg
wxFindReplaceDialog * mFindDlg
Definition: NyqBench.h:188
NyqBench::OnSplitH
void OnSplitH(wxCommandEvent &e)
Definition: NyqBench.cpp:1257
NyqBench::OnOutputUpdate
void OnOutputUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1562
NyqBench::OnSize
void OnSize(wxSizeEvent &e)
Definition: NyqBench.cpp:966
Prefs.h
NyqBench::mShowCode
bool mShowCode
Definition: NyqBench.h:200
MenuTable
Definition: CommandManager.h:403
EffectManager.h
NyqBench::OnUndo
void OnUndo(wxCommandEvent &e)
Definition: NyqBench.cpp:1093
NyqBench::mOutput
NyqTextCtrl * mOutput
Definition: NyqBench.h:185
NyqBench::OnAutoWrap
void OnAutoWrap(wxCommandEvent &e)
Definition: NyqBench.cpp:1181
NyqBench::OnFont
void OnFont(wxCommandEvent &e)
Definition: NyqBench.cpp:1217
CommonCommandFlags.h
NyqBench::OnClearUpdate
void OnClearUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1511
NyqBench::mEffect
NyquistEffect * mEffect
Definition: NyqBench.h:192
END_EVENT_TABLE
END_EVENT_TABLE()
ModuleDispatch
int DLL_API ModuleDispatch(ModuleDispatchTypes type)
Definition: NyqBench.cpp:126
NyqRedirector::AppendText
void AppendText()
Definition: NyqBench.cpp:531
CommandFunctorPointer
void(CommandHandlerObject::*)(const CommandContext &context) CommandFunctorPointer
Definition: CommandFunctors.h:38
NyqBench::~NyqBench
virtual ~NyqBench()
Definition: NyqBench.cpp:806
NyqTextCtrl::OnKeyUp
void OnKeyUp(wxKeyEvent &e)
Definition: NyqBench.cpp:242
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:625
NyqBench::OnCopy
void OnCopy(wxCommandEvent &e)
Definition: NyqBench.cpp:1108
ID_MATCH
@ ID_MATCH
Definition: NyqBench.cpp:554
NyqTextCtrl::GoNext
void GoNext()
Definition: NyqBench.cpp:361
NyqBench::OnGoPrev
void OnGoPrev(wxCommandEvent &e)
Definition: NyqBench.cpp:1171
NyquistEffect::RedirectOutput
void RedirectOutput()
Definition: Nyquist.cpp:1762
ModuleInitialize
@ ModuleInitialize
Definition: ModuleConstants.h:26