Audacity 3.2.0
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 647 of file NyqBench.cpp.

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

References _, anonymous_namespace{ExportPCM.cpp}::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(), audacity::BasicSettings::Read(), RecreateToolbar(), S, SetWindowTitle(), and wxT().

Here is the call graph for this function:

◆ ~NyqBench()

NyqBench::~NyqBench ( )
virtual

Definition at line 805 of file NyqBench.cpp.

806{
807}

Member Function Documentation

◆ DECLARE_EVENT_TABLE()

NyqBench::DECLARE_EVENT_TABLE ( )
private

◆ GetBench()

NyqBench * NyqBench::GetBench ( )
static

Definition at line 637 of file NyqBench.cpp.

638{
639 if (gBench == nullptr)
640 {
641 gBench = new NyqBench(NULL);
642 }
643
644 return gBench;
645}
static DEFINE_VERSION_CHECK NyqBench * gBench
Definition: NyqBench.cpp:120
NyqBench(wxWindow *parent)
Definition: NyqBench.cpp: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 1695 of file NyqBench.cpp.

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

References mPath, mScript, and wxT().

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

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

◆ OnAbout()

void NyqBench::OnAbout ( wxCommandEvent &  e)
private

Definition at line 1365 of file NyqBench.cpp.

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

References _.

◆ OnAutoLoad()

void NyqBench::OnAutoLoad ( wxCommandEvent &  e)
private

Definition at line 1074 of file NyqBench.cpp.

1075{
1076 mAutoLoad = e.IsChecked();
1077}

References mAutoLoad.

◆ OnAutoWrap()

void NyqBench::OnAutoWrap ( wxCommandEvent &  e)
private

Definition at line 1180 of file NyqBench.cpp.

1181{
1182 mAutoWrap = e.IsChecked();
1183
1184 wxWindow *parent = mScript->GetParent();
1185 wxString text = mScript->GetValue();
1186 bool focused = wxWindow::FindFocus() == mScript;
1187 long pos = mScript->GetInsertionPoint();
1188 long from;
1189 long to;
1190 mScript->GetSelection(&from, &to);
1191
1192 wxSizer *s = mScript->GetContainingSizer();
1193 s->Detach(mScript);
1194 delete mScript;
1195
1196 mScript = new NyqTextCtrl(parent,
1197 ID_SCRIPT,
1198 wxEmptyString,
1199 wxDefaultPosition,
1200 wxDefaultSize,
1201 (mAutoWrap ? wxTE_BESTWRAP : wxTE_DONTWRAP) |
1202 wxTE_NOHIDESEL | wxTE_RICH2 |
1203 wxTE_MULTILINE);
1204 s->Add(mScript, 1, wxEXPAND);
1205 s->Layout();
1206
1207 mScript->ChangeValue(text);
1208 mScript->SetInsertionPoint(pos);
1209 mScript->SetSelection(from, to);
1210
1211 if (focused) {
1212 mScript->SetFocus();
1213 }
1214}
@ ID_SCRIPT
Definition: NyqBench.cpp:562
std::unique_ptr< WindowPlacement > FindFocus()
Find the window that is accepting keyboard input, if any.
Definition: BasicUI.h:383

References BasicUI::FindFocus(), ID_SCRIPT, mAutoWrap, and mScript.

Here is the call graph for this function:

◆ OnClear()

void NyqBench::OnClear ( wxCommandEvent &  e)
private

Definition at line 1117 of file NyqBench.cpp.

1118{
1119 (FindFocus() == mScript ? mScript : mOutput)->Clear();
1120}

References BasicUI::FindFocus(), mOutput, and mScript.

Here is the call graph for this function:

◆ OnClearUpdate()

void NyqBench::OnClearUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1512 of file NyqBench.cpp.

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

References BasicUI::FindFocus(), and mOutput.

Here is the call graph for this function:

◆ OnClose()

void NyqBench::OnClose ( wxCloseEvent &  e)
private

Definition at line 947 of file NyqBench.cpp.

948{
949 if (!Validate()) {
950 e.Veto();
951 }
952 else {
953 Show(false);
954 }
955}
virtual bool Validate()
Definition: NyqBench.cpp:1575
IMPORT_EXPORT_API ExportResult Show(ExportTask exportTask)

References ExportProgressUI::Show(), and Validate().

Here is the call graph for this function:

◆ OnCloseWindow()

void NyqBench::OnCloseWindow ( wxCommandEvent &  e)
private

Definition at line 973 of file NyqBench.cpp.

974{
975 Close();
976}

◆ OnCopy()

void NyqBench::OnCopy ( wxCommandEvent &  e)
private

Definition at line 1107 of file NyqBench.cpp.

1108{
1109 (FindFocus() == mScript ? mScript : mOutput)->Copy();
1110}

References BasicUI::FindFocus(), mOutput, and mScript.

Here is the call graph for this function:

◆ OnCopyUpdate()

void NyqBench::OnCopyUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1502 of file NyqBench.cpp.

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

References BasicUI::FindFocus(), mOutput, and mScript.

Here is the call graph for this function:

◆ OnCut()

void NyqBench::OnCut ( wxCommandEvent &  e)
private

Definition at line 1102 of file NyqBench.cpp.

1103{
1104 (FindFocus() == mScript ? mScript : mOutput)->Cut();
1105}

References BasicUI::FindFocus(), mOutput, and mScript.

Here is the call graph for this function:

◆ OnCutUpdate()

void NyqBench::OnCutUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1497 of file NyqBench.cpp.

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

References BasicUI::FindFocus(), mOutput, and mScript.

Here is the call graph for this function:

◆ OnFind()

void NyqBench::OnFind ( wxCommandEvent &  e)
private

Definition at line 1127 of file NyqBench.cpp.

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

References _, BasicUI::FindFocus(), gPrefs, mFindData, mFindDlg, mFindText, mOutput, mScript, audacity::BasicSettings::Read(), and wxT().

Here is the call graph for this function:

◆ OnFindDialog()

void NyqBench::OnFindDialog ( wxFindDialogEvent &  e)
private

Definition at line 1380 of file NyqBench.cpp.

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

References AudacityMessageBox(), gPrefs, mFindData, mFindDlg, mFindText, Tuple::detail::npos(), audacity::BasicSettings::Write(), wxT(), and XO().

Here is the call graph for this function:

◆ OnFont()

void NyqBench::OnFont ( wxCommandEvent &  e)
private

Definition at line 1216 of file NyqBench.cpp.

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

References BasicUI::FindFocus(), mOutput, mOutputFont, mScript, and mScriptFont.

Here is the call graph for this function:

◆ OnGo()

void NyqBench::OnGo ( wxCommandEvent &  e)
private

Definition at line 1327 of file NyqBench.cpp.

1328{
1329 auto pEffect =
1330 std::make_unique<NyquistEffect>(L"Nyquist Effect Workbench");
1331 mEffect = pEffect.get();
1332 const PluginID & ID =
1333 EffectManager::Get().RegisterEffect(std::move(pEffect));
1334
1335 mEffect->SetCommand(mScript->GetValue());
1337
1338 auto p = GetActiveProject().lock();
1339 wxASSERT(p);
1340
1341 if (p) {
1342 wxWindowDisabler disable(this);
1344
1345 mRunning = true;
1346 UpdateWindowUI();
1347
1349
1350 mRunning = false;
1351 UpdateWindowUI();
1352 }
1353
1354 Raise();
1355
1357}
AUDACITY_DLL_API std::weak_ptr< AudacityProject > GetActiveProject()
wxString PluginID
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
static EffectManager & Get()
const PluginID & RegisterEffect(std::unique_ptr< EffectPlugin > uEffect)
Here solely for the purpose of Nyquist Workbench until a better solution is devised.
void UnregisterEffect(const PluginID &ID)
Used only by Nyquist Workbench module.
NyquistEffect * mEffect
Definition: NyqBench.h:192
void SetCommand(const wxString &cmd)
void RedirectOutput()
bool DoEffect(const PluginID &ID, AudacityProject &project, unsigned flags)
Definition: DoEffect.cpp:30

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

Here is the call graph for this function:

◆ OnGoMatch()

void NyqBench::OnGoMatch ( wxCommandEvent &  e)
private

Definition at line 1155 of file NyqBench.cpp.

1156{
1157 mScript->GoMatch();
1158}
void GoMatch()
Definition: NyqBench.cpp:291

References NyqTextCtrl::GoMatch(), and mScript.

Here is the call graph for this function:

◆ OnGoNext()

void NyqBench::OnGoNext ( wxCommandEvent &  e)
private

Definition at line 1175 of file NyqBench.cpp.

1176{
1177 mScript->GoNext();
1178}
void GoNext()
Definition: NyqBench.cpp:360

References NyqTextCtrl::GoNext(), and mScript.

Here is the call graph for this function:

◆ OnGoPrev()

void NyqBench::OnGoPrev ( wxCommandEvent &  e)
private

Definition at line 1170 of file NyqBench.cpp.

1171{
1172 mScript->GoPrev();
1173}
void GoPrev()
Definition: NyqBench.cpp:340

References NyqTextCtrl::GoPrev(), and mScript.

Here is the call graph for this function:

◆ OnGoTop()

void NyqBench::OnGoTop ( wxCommandEvent &  e)
private

Definition at line 1160 of file NyqBench.cpp.

1161{
1162 mScript->GoTop();
1163}
void GoTop()
Definition: NyqBench.cpp:296

References NyqTextCtrl::GoTop(), and mScript.

Here is the call graph for this function:

◆ OnGoUp()

void NyqBench::OnGoUp ( wxCommandEvent &  e)
private

Definition at line 1165 of file NyqBench.cpp.

1166{
1167 mScript->GoUp();
1168}
void GoUp()
Definition: NyqBench.cpp:318

References NyqTextCtrl::GoUp(), and mScript.

Here is the call graph for this function:

◆ OnLargeIcons()

void NyqBench::OnLargeIcons ( wxCommandEvent &  e)
private

Definition at line 1322 of file NyqBench.cpp.

1323{
1324 RecreateToolbar(true);
1325}

References RecreateToolbar().

Here is the call graph for this function:

◆ OnMenuUpdate()

void NyqBench::OnMenuUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1477 of file NyqBench.cpp.

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

References mScript.

◆ OnMove()

void NyqBench::OnMove ( wxMoveEvent &  e)
private

Definition at line 957 of file NyqBench.cpp.

958{
959 e.Skip();
960 if (!IsIconized() && !IsMaximized()) {
961 mLastSize.SetPosition(e.GetPosition());
962 }
963}
wxRect mLastSize
Definition: NyqBench.h:211

References mLastSize.

◆ OnNew()

void NyqBench::OnNew ( wxCommandEvent &  e)
private

Definition at line 978 of file NyqBench.cpp.

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

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

Here is the call graph for this function:

◆ OnOpen()

void NyqBench::OnOpen ( wxCommandEvent &  e)
private

Definition at line 996 of file NyqBench.cpp.

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

References _, gPrefs, LoadFile(), mPath, mScript, SetWindowTitle(), Validate(), audacity::BasicSettings::Write(), and wxT().

Here is the call graph for this function:

◆ OnOutputUpdate()

void NyqBench::OnOutputUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1563 of file NyqBench.cpp.

1564{
1565 if (mOutputBox && mOutput && FindFocus() == mOutput) {
1566 wxString label = mOutputBox->GetLabel();
1567 if (label == _("Output")) {
1568 label += wxT("*");
1569 mOutputBox->SetLabel(label);
1570 mScriptBox->SetLabel(_("Script"));
1571 }
1572 }
1573}
TranslatableString label
Definition: TagsEditor.cpp:165

References _, BasicUI::FindFocus(), label, mOutput, mOutputBox, mScriptBox, and wxT().

Here is the call graph for this function:

◆ OnPaste()

void NyqBench::OnPaste ( wxCommandEvent &  e)
private

Definition at line 1112 of file NyqBench.cpp.

1113{
1114 (FindFocus() == mScript ? mScript : mOutput)->Paste();
1115}

References BasicUI::FindFocus(), mOutput, and mScript.

Here is the call graph for this function:

◆ OnPasteUpdate()

void NyqBench::OnPasteUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1507 of file NyqBench.cpp.

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

References BasicUI::FindFocus(), mOutput, and mScript.

Here is the call graph for this function:

◆ OnRedo()

void NyqBench::OnRedo ( wxCommandEvent &  e)
private

Definition at line 1097 of file NyqBench.cpp.

1098{
1099 (FindFocus() == mScript ? mScript : mOutput)->Redo();
1100}

References BasicUI::FindFocus(), mOutput, and mScript.

Here is the call graph for this function:

◆ OnRedoUpdate()

void NyqBench::OnRedoUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1492 of file NyqBench.cpp.

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

References BasicUI::FindFocus(), mOutput, and mScript.

Here is the call graph for this function:

◆ OnRevert()

void NyqBench::OnRevert ( wxCommandEvent &  e)
private

Definition at line 1079 of file NyqBench.cpp.

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

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

Here is the call graph for this function:

◆ OnRunUpdate()

void NyqBench::OnRunUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1528 of file NyqBench.cpp.

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

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 1021 of file NyqBench.cpp.

1022{
1023 if (mScript->GetLastPosition() == 0) {
1024 return;
1025 }
1026
1027 if (mPath.GetFullPath().IsEmpty()) {
1028 OnSaveAs(e);
1029 return;
1030 }
1031
1032 if (!mScript->SaveFile(mPath.GetFullPath()))
1033 {
1034 AudacityMessageBox(XO("Script was not saved."),
1035 XO("Warning"),
1036 wxICON_EXCLAMATION,
1037 this);
1038 return;
1039 }
1040}
void OnSaveAs(wxCommandEvent &e)
Definition: NyqBench.cpp: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 1042 of file NyqBench.cpp.

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

References _, AudacityMessageBox(), gPrefs, mPath, mScript, SetWindowTitle(), audacity::BasicSettings::Write(), wxT(), 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 1551 of file NyqBench.cpp.

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

References _, BasicUI::FindFocus(), label, mOutputBox, mScript, mScriptBox, and wxT().

Here is the call graph for this function:

◆ OnSelectAll()

void NyqBench::OnSelectAll ( wxCommandEvent &  e)
private

Definition at line 1122 of file NyqBench.cpp.

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

References BasicUI::FindFocus(), mOutput, and mScript.

Here is the call graph for this function:

◆ OnSize()

void NyqBench::OnSize ( wxSizeEvent &  e)
private

Definition at line 965 of file NyqBench.cpp.

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

References mLastSize.

◆ OnSmallIcons()

void NyqBench::OnSmallIcons ( wxCommandEvent &  e)
private

Definition at line 1317 of file NyqBench.cpp.

1318{
1319 RecreateToolbar(false);
1320}

References RecreateToolbar().

Here is the call graph for this function:

◆ OnSplitH()

void NyqBench::OnSplitH ( wxCommandEvent &  e)
private

Definition at line 1256 of file NyqBench.cpp.

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

References mOutput, mScript, and mSplitter.

◆ OnSplitV()

void NyqBench::OnSplitV ( wxCommandEvent &  e)
private

Definition at line 1247 of file NyqBench.cpp.

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

References mOutput, mScript, and mSplitter.

◆ OnStop()

void NyqBench::OnStop ( wxCommandEvent &  e)
private

Definition at line 1359 of file NyqBench.cpp.

1360{
1361 mRunning = false;
1362 mEffect->Stop();
1363}

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

Here is the call graph for this function:

◆ OnTextUpdate()

void NyqBench::OnTextUpdate ( wxCommandEvent &  e)
private

Definition at line 1470 of file NyqBench.cpp.

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

◆ OnToggleCode()

void NyqBench::OnToggleCode ( wxCommandEvent &  e)
private

Definition at line 1265 of file NyqBench.cpp.

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

References mOutput, mScript, mSplitMode, and mSplitter.

◆ OnToggleOutput()

void NyqBench::OnToggleOutput ( wxCommandEvent &  e)
private

Definition at line 1291 of file NyqBench.cpp.

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

References mOutput, mScript, mSplitMode, and mSplitter.

◆ OnUndo()

void NyqBench::OnUndo ( wxCommandEvent &  e)
private

Definition at line 1092 of file NyqBench.cpp.

1093{
1094 (FindFocus() == mScript ? mScript : mOutput)->Undo();
1095}

References BasicUI::FindFocus(), mOutput, and mScript.

Here is the call graph for this function:

◆ OnUndoUpdate()

void NyqBench::OnUndoUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1487 of file NyqBench.cpp.

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

References BasicUI::FindFocus(), mOutput, and mScript.

Here is the call graph for this function:

◆ OnViewUpdate()

void NyqBench::OnViewUpdate ( wxUpdateUIEvent &  e)
private

Definition at line 1517 of file NyqBench.cpp.

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

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 838 of file NyqBench.cpp.

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

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 1602 of file NyqBench.cpp.

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

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 809 of file NyqBench.cpp.

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

References gPrefs, mAutoLoad, mAutoWrap, mLargeIcons, mLastSize, mOutput, mOutputFont, mScript, mScriptFont, mSplitter, audacity::BasicSettings::Write(), and wxT().

Referenced by ModuleDispatch().

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

◆ SetWindowTitle()

void NyqBench::SetWindowTitle ( )
private

Definition at line 1591 of file NyqBench.cpp.

1592{
1593 wxString name = _("Untitled");
1594
1595 if (!mPath.GetFullPath().IsEmpty()) {
1596 name = mPath.GetFullName();
1597 }
1598
1599 SetTitle(_("Nyquist Effect Workbench - ") + name);
1600}
wxString name
Definition: TagsEditor.cpp:166

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 1725 of file NyqBench.cpp.

1726{
1727 Show();
1728}

References ExportProgressUI::Show().

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

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

◆ Validate()

bool NyqBench::Validate ( )
virtual

Definition at line 1575 of file NyqBench.cpp.

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

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: