Audacity  3.0.3
NyqBench.h
Go to the documentation of this file.
1 /**********************************************************************
2 
3  NyqBench.h
4 
5  Leland Lucius
6 
7 **********************************************************************/
8 
9 #ifndef __NYQUIST_EFFECT_WORKBENCH__
10 #define __NYQUIST_EFFECT_WORKBENCH__
11 
12 #include <wx/fdrepdlg.h> // wxFindReplaceData member variable
13 #include <wx/frame.h> // to inherit
14 #include <wx/string.h>
15 
16 #include <iostream>
17 #include <ostream>
18 #include <sstream>
19 
22 
23 class wxFileName;
24 
25 //----------------------------------------------------------------------------
26 // NyqTextCtrl
27 //----------------------------------------------------------------------------
28 
29 class NyqTextCtrl:public wxTextCtrl
30 {
31  public:
32  NyqTextCtrl(wxWindow *parent,
33  wxWindowID id,
34  const wxString & value,
35  const wxPoint & pos,
36  const wxSize & size,
37  int style = 0);
38 
39  void SetFocusFromKbd();
40  void MarkDirty();
41 
42  void GoMatch();
43  void GoTop();
44  void GoUp();
45  void GoPrev();
46  void GoNext();
47 
48  private:
49 #if defined(__WXMAC__REMOVED_UNTIL_ITS_PROVEN_THAT_IT_IS_STILL_NEEDED)
50  void OnKeyDown(wxKeyEvent & e);
51 #endif
52  void OnKeyUp(wxKeyEvent & e);
53  void OnChar(wxKeyEvent & e);
54  void OnUpdate(wxUpdateUIEvent & e);
55 
56  void MoveCursor(long first, long second);
57  void Colorize(long left, long right);
58  void FindParens();
59 
60  private:
61  wxLongToLongHashMap mLeftParens;
62  wxLongToLongHashMap mRightParens;
63 
64  long mLeftParen;
66 
68 
69  wxTextAttr mOn;
70  wxTextAttr mOff;
71 
73 };
74 
75 //----------------------------------------------------------------------------
76 // NyqRedirector
77 //----------------------------------------------------------------------------
78 
79 class NyqRedirector:wxSTD streambuf
80 {
81  public:
83  virtual ~NyqRedirector();
84 
85  int overflow(int c);
86 
87  private:
88  void AppendText();
89 
90  std::string s;
91  std::streambuf *mOld;
93 };
94 
95 //----------------------------------------------------------------------------
96 // NyqBench
97 //----------------------------------------------------------------------------
98 
99 class NyqBench:public wxFrame
100 {
101  public:
102  NyqBench(wxWindow *parent);
103  virtual ~NyqBench();
104 
105  virtual bool Validate();
106 
107  void ShowNyqBench(const CommandContext&);
108 
109  static NyqBench *GetBench();
110  void SavePrefs();
111 
112  private:
114 
115  void OnClose(wxCloseEvent & e);
116  void OnMove(wxMoveEvent & e);
117  void OnSize(wxSizeEvent & e);
118 
119  void OnNew(wxCommandEvent & e);
120  void OnOpen(wxCommandEvent & e);
121  void OnSave(wxCommandEvent & e);
122  void OnSaveAs(wxCommandEvent & e);
123  void OnRevert(wxCommandEvent & e);
124  void OnAutoLoad(wxCommandEvent & e);
125  void OnCloseWindow(wxCommandEvent & e);
126 
127  void OnUndo(wxCommandEvent & e);
128  void OnRedo(wxCommandEvent & e);
129  void OnCut(wxCommandEvent & e);
130  void OnCopy(wxCommandEvent & e);
131  void OnPaste(wxCommandEvent & e);
132  void OnClear(wxCommandEvent & e);
133  void OnSelectAll(wxCommandEvent & e);
134  void OnFind(wxCommandEvent & e);
135  void OnGoMatch(wxCommandEvent & e);
136  void OnGoTop(wxCommandEvent & e);
137  void OnGoUp(wxCommandEvent & e);
138  void OnGoPrev(wxCommandEvent & e);
139  void OnGoNext(wxCommandEvent & e);
140  void OnAutoWrap(wxCommandEvent & e);
141 
142  void OnFont(wxCommandEvent & e);
143  void OnSplitV(wxCommandEvent & e);
144  void OnSplitH(wxCommandEvent & e);
145  void OnToggleCode(wxCommandEvent & e);
146  void OnToggleOutput(wxCommandEvent & e);
147  void OnSmallIcons(wxCommandEvent & e);
148  void OnLargeIcons(wxCommandEvent & e);
149 
150  void OnGo(wxCommandEvent & e);
151  void OnStop(wxCommandEvent & e);
152 
153  void OnAbout(wxCommandEvent & e);
154 
155  void OnFindDialog(wxFindDialogEvent & e);
156 
157  void OnTextUpdate(wxCommandEvent & e);
158 
159  void OnMenuUpdate(wxUpdateUIEvent & e);
160 
161  void OnUndoUpdate(wxUpdateUIEvent & e);
162  void OnRedoUpdate(wxUpdateUIEvent & e);
163  void OnCutUpdate(wxUpdateUIEvent & e);
164  void OnCopyUpdate(wxUpdateUIEvent & e);
165  void OnPasteUpdate(wxUpdateUIEvent & e);
166  void OnClearUpdate(wxUpdateUIEvent & e);
167 
168  void OnViewUpdate(wxUpdateUIEvent & e);
169 
170  void OnRunUpdate(wxUpdateUIEvent & e);
171 
172  void OnScriptUpdate(wxUpdateUIEvent & e);
173  void OnOutputUpdate(wxUpdateUIEvent & e);
174 
175  void SetWindowTitle();
176 
177  void RecreateToolbar(bool large = false);
178 
179  void LoadFile();
180 
181  private:
182  wxStaticBox *mScriptBox;
183  wxStaticBox *mOutputBox;
186  wxSplitterWindow *mSplitter;
187 
188  wxFindReplaceDialog *mFindDlg;
189  wxFindReplaceData mFindData;
191 
193 
194  wxFont mScriptFont;
195  wxFont mOutputFont;
196 
197  wxBitmap mPics[20];
198 
200  bool mShowCode;
202 
204 
205  bool mRunning;
206 
207  wxFileName mPath;
208  bool mAutoLoad;
209  bool mAutoWrap;
210 
211  wxRect mLastSize;
212 
214 };
215 
216 #endif
217 
218 // Indentation settings for Vim and Emacs and unique identifier for Arch, a
219 // version control system. Please do not modify past this point.
220 //
221 // Local Variables:
222 // c-basic-offset: 3
223 // indent-tabs-mode: nil
224 // End:
225 //
226 // vim: et sts=3 sw=3
227 // arch-tag: cad436f5-7c97-40a2-8ee9-3748e8f3e56f
size
size_t size
Definition: ffmpeg-2.3.6-single-header.h:412
NyqBench::OnMove
void OnMove(wxMoveEvent &e)
Definition: NyqBench.cpp:959
NyqTextCtrl::DECLARE_EVENT_TABLE
DECLARE_EVENT_TABLE()
NyqBench::OnRedo
void OnRedo(wxCommandEvent &e)
Definition: NyqBench.cpp:1099
NyqBench
Definition: NyqBench.h:100
NyqBench::OnLargeIcons
void OnLargeIcons(wxCommandEvent &e)
Definition: NyqBench.cpp:1324
NyqBench::mOutputFont
wxFont mOutputFont
Definition: NyqBench.h:195
NyqBench::OnGoMatch
void OnGoMatch(wxCommandEvent &e)
Definition: NyqBench.cpp:1157
NyqBench::mShowOutput
bool mShowOutput
Definition: NyqBench.h:201
NyqBench::OnRevert
void OnRevert(wxCommandEvent &e)
Definition: NyqBench.cpp:1081
S
#define S(N)
Definition: ToChars.cpp:64
NyqBench::mFindText
NyqTextCtrl * mFindText
Definition: NyqBench.h:190
NyqBench::GetBench
static NyqBench * GetBench()
Definition: NyqBench.cpp:639
NyqBench::OnSplitV
void OnSplitV(wxCommandEvent &e)
Definition: NyqBench.cpp:1249
NyqBench::mFindData
wxFindReplaceData mFindData
Definition: NyqBench.h:189
NyqBench::OnToggleCode
void OnToggleCode(wxCommandEvent &e)
Definition: NyqBench.cpp:1267
NyqBench::OnClose
void OnClose(wxCloseEvent &e)
Definition: NyqBench.cpp:949
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
NyqTextCtrl::mLeftParens
wxLongToLongHashMap mLeftParens
Definition: NyqBench.h:61
NyqBench::OnGoNext
void OnGoNext(wxCommandEvent &e)
Definition: NyqBench.cpp:1177
NyqBench::OnMenuUpdate
void OnMenuUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1479
NyqRedirector::NyqRedirector
NyqRedirector(NyqTextCtrl *text)
Definition: NyqBench.cpp:507
NyqTextCtrl::mRightParen
long mRightParen
Definition: NyqBench.h:65
CommandManager.h
NyqBench::OnFindDialog
void OnFindDialog(wxFindDialogEvent &e)
Definition: NyqBench.cpp:1382
NyqBench::OnCutUpdate
void OnCutUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1499
NyqBench::OnOpen
void OnOpen(wxCommandEvent &e)
Definition: NyqBench.cpp:998
NyqTextCtrl::MoveCursor
void MoveCursor(long first, long second)
Definition: NyqBench.cpp:382
NyqBench::mLargeIcons
bool mLargeIcons
Definition: NyqBench.h:203
NyqTextCtrl::mRightParens
wxLongToLongHashMap mRightParens
Definition: NyqBench.h:62
NyqBench::OnGoUp
void OnGoUp(wxCommandEvent &e)
Definition: NyqBench.cpp:1167
NyqBench::LoadFile
void LoadFile()
Definition: NyqBench.cpp:1697
NyqBench::OnGo
void OnGo(wxCommandEvent &e)
Definition: NyqBench.cpp:1329
NyqBench::OnFind
void OnFind(wxCommandEvent &e)
Definition: NyqBench.cpp:1129
NyqTextCtrl::mOn
wxTextAttr mOn
Definition: NyqBench.h:69
NyqRedirector::mOld
std::streambuf * mOld
Definition: NyqBench.h:91
NyqBench::NyqBench
NyqBench(wxWindow *parent)
Definition: NyqBench.cpp:649
NyqBench::OnRedoUpdate
void OnRedoUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1494
NyqBench::mLastSize
wxRect mLastSize
Definition: NyqBench.h:211
NyqBench::OnCloseWindow
void OnCloseWindow(wxCommandEvent &e)
Definition: NyqBench.cpp:975
NyqRedirector::overflow
int overflow(int c)
Definition: NyqBench.cpp:522
NyqBench::mSplitMode
int mSplitMode
Definition: NyqBench.h:199
NyqBench::OnSaveAs
void OnSaveAs(wxCommandEvent &e)
Definition: NyqBench.cpp:1044
NyqBench::mScriptBox
wxStaticBox * mScriptBox
Definition: NyqBench.h:182
NyqTextCtrl::OnUpdate
void OnUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:266
NyqRedirector
Definition: NyqBench.h:80
NyqTextCtrl::mOff
wxTextAttr mOff
Definition: NyqBench.h:70
NyqBench::OnRunUpdate
void OnRunUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1530
NyqBench::mAutoWrap
bool mAutoWrap
Definition: NyqBench.h:209
NyqBench::OnPaste
void OnPaste(wxCommandEvent &e)
Definition: NyqBench.cpp:1114
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:980
CommandContext
CommandContext provides additional information to an 'Apply()' command. It provides the project,...
Definition: CommandContext.h:34
NyqBench::OnTextUpdate
void OnTextUpdate(wxCommandEvent &e)
Definition: NyqBench.cpp:1472
NyqBench::Validate
virtual bool Validate()
Definition: NyqBench.cpp:1577
NyqBench::OnScriptUpdate
void OnScriptUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1553
NyqTextCtrl::FindParens
void FindParens()
Definition: NyqBench.cpp:429
NyqRedirector::mText
NyqTextCtrl * mText
Definition: NyqBench.h:92
NyqBench::mPath
wxFileName mPath
Definition: NyqBench.h:207
NyqBench::SavePrefs
void SavePrefs()
Definition: NyqBench.cpp:811
NyqBench::ShowNyqBench
void ShowNyqBench(const CommandContext &)
Definition: NyqBench.cpp:1727
NyqBench::PopulateOrExchange
void PopulateOrExchange(ShuttleGui &S)
Definition: NyqBench.cpp:840
NyqBench::mSplitter
wxSplitterWindow * mSplitter
Definition: NyqBench.h:186
NyqTextCtrl::mLastCaretPos
long mLastCaretPos
Definition: NyqBench.h:67
NyqTextCtrl::MarkDirty
void MarkDirty()
Definition: NyqBench.cpp:191
NyqRedirector::~NyqRedirector
virtual ~NyqRedirector()
Definition: NyqBench.cpp:513
NyqBench::OnGoTop
void OnGoTop(wxCommandEvent &e)
Definition: NyqBench.cpp:1162
NyqBench::RecreateToolbar
void RecreateToolbar(bool large=false)
Definition: NyqBench.cpp:1604
NyqBench::mScriptFont
wxFont mScriptFont
Definition: NyqBench.h:194
NyqTextCtrl::Colorize
void Colorize(long left, long right)
Definition: NyqBench.cpp:399
NyqBench::mAutoLoad
bool mAutoLoad
Definition: NyqBench.h:208
NyqBench::OnUndoUpdate
void OnUndoUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1489
NyqBench::mOutputBox
wxStaticBox * mOutputBox
Definition: NyqBench.h:183
Nyquist.h
NyqBench::OnClear
void OnClear(wxCommandEvent &e)
Definition: NyqBench.cpp:1119
NyqBench::OnPasteUpdate
void OnPasteUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1509
NyqTextCtrl::GoPrev
void GoPrev()
Definition: NyqBench.cpp:342
NyqTextCtrl
Definition: NyqBench.h:30
NyqBench::OnSave
void OnSave(wxCommandEvent &e)
Definition: NyqBench.cpp:1023
NyqBench::OnToggleOutput
void OnToggleOutput(wxCommandEvent &e)
Definition: NyqBench.cpp:1293
NyqBench::OnSelectAll
void OnSelectAll(wxCommandEvent &e)
Definition: NyqBench.cpp:1124
NyqBench::OnSmallIcons
void OnSmallIcons(wxCommandEvent &e)
Definition: NyqBench.cpp:1319
NyqTextCtrl::mLeftParen
long mLeftParen
Definition: NyqBench.h:64
NyqBench::DECLARE_EVENT_TABLE
DECLARE_EVENT_TABLE()
NyqBench::OnCopyUpdate
void OnCopyUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1504
NyqBench::OnAbout
void OnAbout(wxCommandEvent &e)
Definition: NyqBench.cpp:1367
NyqBench::SetWindowTitle
void SetWindowTitle()
Definition: NyqBench.cpp:1593
NyqTextCtrl::OnChar
void OnChar(wxKeyEvent &e)
Definition: NyqBench.cpp:197
NyqTextCtrl::GoMatch
void GoMatch()
Definition: NyqBench.cpp:293
NyqBench::OnStop
void OnStop(wxCommandEvent &e)
Definition: NyqBench.cpp:1361
NyqBench::OnViewUpdate
void OnViewUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1519
NyqBench::OnAutoLoad
void OnAutoLoad(wxCommandEvent &e)
Definition: NyqBench.cpp:1076
NyqTextCtrl::NyqTextCtrl
NyqTextCtrl(wxWindow *parent, wxWindowID id, const wxString &value, const wxPoint &pos, const wxSize &size, int style=0)
Definition: NyqBench.cpp:164
NyqBench::OnCut
void OnCut(wxCommandEvent &e)
Definition: NyqBench.cpp:1104
NyqTextCtrl::SetFocusFromKbd
void SetFocusFromKbd()
Definition: NyqBench.cpp:180
NyqTextCtrl::GoTop
void GoTop()
Definition: NyqBench.cpp:298
NyqTextCtrl::GoUp
void GoUp()
Definition: NyqBench.cpp:320
NyqBench::mScript
NyqTextCtrl * mScript
Definition: NyqBench.h:184
NyqBench::mFindDlg
wxFindReplaceDialog * mFindDlg
Definition: NyqBench.h:188
NyqBench::OnSplitH
void OnSplitH(wxCommandEvent &e)
Definition: NyqBench.cpp:1258
NyqBench::OnOutputUpdate
void OnOutputUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1565
NyqBench::OnSize
void OnSize(wxSizeEvent &e)
Definition: NyqBench.cpp:967
NyqBench::mShowCode
bool mShowCode
Definition: NyqBench.h:200
NyqBench::OnUndo
void OnUndo(wxCommandEvent &e)
Definition: NyqBench.cpp:1094
NyqBench::mOutput
NyqTextCtrl * mOutput
Definition: NyqBench.h:185
NyqBench::OnAutoWrap
void OnAutoWrap(wxCommandEvent &e)
Definition: NyqBench.cpp:1182
NyqBench::OnFont
void OnFont(wxCommandEvent &e)
Definition: NyqBench.cpp:1218
NyqBench::OnClearUpdate
void OnClearUpdate(wxUpdateUIEvent &e)
Definition: NyqBench.cpp:1514
NyqBench::mEffect
NyquistEffect * mEffect
Definition: NyqBench.h:192
NyqRedirector::AppendText
void AppendText()
Definition: NyqBench.cpp:532
NyqBench::~NyqBench
virtual ~NyqBench()
Definition: NyqBench.cpp:807
NyqTextCtrl::OnKeyUp
void OnKeyUp(wxKeyEvent &e)
Definition: NyqBench.cpp:243
ShuttleGui
Derived from ShuttleGuiBase, an Audacity specific class for shuttling data to and from GUI.
Definition: ShuttleGui.h:631
NyqBench::OnCopy
void OnCopy(wxCommandEvent &e)
Definition: NyqBench.cpp:1109
NyqTextCtrl::GoNext
void GoNext()
Definition: NyqBench.cpp:362
NyqBench::OnGoPrev
void OnGoPrev(wxCommandEvent &e)
Definition: NyqBench.cpp:1172