NumeRe v1.1.4
NumeRe: Framework für Numerische Rechnungen
editor.h
Go to the documentation of this file.
1/*****************************************************************************
2 NumeRe: Framework fuer Numerische Rechnungen
3 Copyright (C) 2019 Erik Haenel et al.
4
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (at your option) any later version.
9
10 This program is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 GNU General Public License for more details.
14
15 You should have received a copy of the GNU General Public License
16 along with this program. If not, see <http://www.gnu.org/licenses/>.
17******************************************************************************/
18
19
20
21#include "../terminal/terminal.hpp"
22#include "../../common/datastructures.h"
23#include "../../kernel/syntax.hpp"
24#include "../dialogs/duplicatecodedialog.hpp"
25
26#ifndef EDITOR_H
27#define EDITOR_H
28
29#include <wx/wx.h>
30#include <wx/stc/stc.h>
31#include <wx/menu.h>
32#include <wx/dynarray.h>
33#include <wx/thread.h>
34#include <wx/buffer.h>
35
36#define RM_WS_BOTH 0
37#define RM_WS_FRONT 1
38#define RM_WS_BACK 2
39
40class NumeReWindow;
41class EditorNotebook;
42class wxFileName;
43class Options;
44class DebugManager;
45class ProcedureViewer;
46class CodeAnalyzer;
48class CodeFormatter;
49
52class NumeReEditor : public wxStyledTextCtrl, public wxThreadHelper
53{
54 public:
55 friend class CodeAnalyzer;
56 friend class SearchController;
57 friend class CodeFormatter;
58
59 NumeReEditor(NumeReWindow* mframe, Options* options,
60 wxWindow* parent, wxWindowID id, NumeReSyntax* __syntax, NumeReTerminal* __terminal, const wxPoint& pos = wxDefaultPosition,
61 const wxSize& size = wxDefaultSize, long style = 0,
62 const wxString& name = wxSTCNameStr);
64
68 {
75 };
77
78
79 bool LoadLocalFile (const wxString& filename);
80 bool LoadFileText(wxString fileContents);
81 bool SaveFile(const wxString& filename);
82 bool SaveNumeReFile(const wxString& filename);
83 bool SaveGeneralFile(const wxString& filename);
84 bool SaveFileLocal();
85
91 bool Modified();
92 bool HasBeenSaved();
94
95 void OnChar(wxStyledTextEvent& event);
96 void OnRightClick(wxMouseEvent& event);
97 void OnMarginClick(wxStyledTextEvent& event);
98 void OnKeyDn(wxKeyEvent& event);
99 void OnKeyRel(wxKeyEvent& event);
100 void OnMouseUp(wxMouseEvent& event);
101 void OnMouseDn(wxMouseEvent& event);
102 void OnMouseDblClk(wxMouseEvent& event);
103 void OnMouseCaptureLost(wxMouseCaptureLostEvent& event);
104 void OnEnter(wxMouseEvent& event);
105 void OnLeave(wxMouseEvent& event);
106 void OnLoseFocus(wxFocusEvent& event);
107 void OnMouseDwell(wxStyledTextEvent& event);
108 void OnSavePointReached(wxStyledTextEvent& event);
109 void OnSavePointLeft(wxStyledTextEvent& event);
110 void OnAutoCompletion(wxStyledTextEvent& event);
111 void OnIdle(wxIdleEvent& event);
112
113 int isBlockStart(const wxString& sWord, bool allowIntermediate = false);
114 int isBlockEnd(const wxString& sWord);
115 int isBlockMiddle(const wxString& sWord);
116 bool hasBlockMiddle(const wxString& sWord);
117 int getBlockID(const wxString& word);
118 wxString getBlockAutoCompletion(const wxString& sWord);
119 wxString getBlockEnd(const wxString& sWord);
120 wxString getBlockStart(const wxString& sWord);
122 void MakeBraceCheck();
123 void MakeBlockCheck();
124 bool isWrappedLine(int line);
125
126 // asynch update calls
129 std::string GetCurrentFunctionContext(int& nStartingBrace);
130 std::string GetCurrentArgument(const std::string& sCallTip, int nStartingBrace, int& nArgStartPos);
131
132 int CallTipStartPos();
133 void AdvCallTipShow(int pos, const wxString& definition);
134 void AdvCallTipCancel();
135
136 void getMatchingBrace(int nPos);
137 void getMatchingBlock(int nPos);
138 std::vector<int> BlockMatch(int nPos);
139 std::vector<int> BlockMatchNSCR(int nPos);
140 std::vector<int> BlockMatchMATLAB(int nPos);
141 void UpdateSyntaxHighlighting(bool forceUpdate = false);
142 void UpdateIndicators();
143 void FocusOnLine(int linenumber, bool showMarker = true);
144 void EnsureLineVisibility(int line);
145
146 FileFilterType GetFileType(const wxString& filename);
147
148 wxString GetFileNameAndPath();
149 wxString GetFilenameString();
150 wxFileName GetFileName(); // capital N
152 {
154 }
155 wxString GetFilePath();
156 wxArrayInt GetBreakpoints();
157
158 void SetFilename(wxFileName filename, bool fileIsRemote);
159 void SetExecutableFilename(wxFileName filename);
160 void ResetEditor();
162 {
164 }
165
166 void GotoPipe(int nStartPos = 0);
167 void OnAddBreakpoint(wxCommandEvent& event);
168 void OnRemoveBreakpoint(wxCommandEvent& event);
169 void OnClearBreakpoints(wxCommandEvent& event);
170 void OnAddBookmark(wxCommandEvent& event);
171 void OnRemoveBookmark(wxCommandEvent& event);
172 void OnClearBookmarks(wxCommandEvent& event);
173 //void OnAddWatch(wxCommandEvent &event);
174 void OnDisplayVariable(wxCommandEvent& event);
175 void OnHelpOnSelection(wxCommandEvent& event);
176 void OnFindProcedure(wxCommandEvent& event);
178 void OnFindInclude(wxCommandEvent& event);
180 void OnChangeCase(wxCommandEvent& event);
181 void OnFoldCurrentBlock(wxCommandEvent& event);
182 void OnHideSelection(wxCommandEvent& event);
183 void OnUnhideAllFromMenu();
184 void OnRenameSymbols(wxCommandEvent& event);
186 void OnFixTypes(wxCommandEvent& event);
187 void OnAbstrahizeSection(wxCommandEvent& event);
189 void OnMenuEvent(wxCommandEvent& event);
190 void OnTranspose();
191 void OnExtractAsHTML();
192 void OnExtractFormatted();
193
194 void OnAnalyzerTimer(wxTimerEvent& event);
195 bool InitDuplicateCode();
196 void OnFindDuplicateCode(int nDuplicateFlag = 1, int nNumDuplicatedLines = 6); // 0 = direct comparison, 1 = use var semanticals, 2 = use string semanticals,
197 void IndicateDuplicatedLine(int nStart1, int nEnd1, int nStart2, int nEnd2, int nSelectionLine);
198
199 // for the duplicate code analysis
200 virtual wxThread::ExitCode Entry();
201 void OnThreadUpdate(wxThreadEvent& event);
202
203 void AddBreakpoint( int linenum );
204 void RemoveBreakpoint( int linenum );
206
208
209 void SetSyntax(NumeReSyntax* __syntax)
210 {
211 if (!_syntax)
212 {
213 _syntax = __syntax;
214 }
215 }
217 {
218 if (!m_terminal)
219 {
220 m_terminal = _terminal;
221 }
222 }
223 void SetUnsaved();
224
225 void ApplyAutoIndentation(int nFirstLine = 0, int nLastLine = -1);
226 void ApplyAutoFormat(int nFirstLine = 0, int nLastLine = -1);
227 void Transpose(int nFirstLine = 0, int nLastLine = -1);
228 wxString ExtractAsHTML(int nFirstLine = 0, int nLastLine = -1);
229
230 void ToggleSettings(int _setting);
231 bool getEditorSetting(EditorSettings _setting);
233 {
234 return m_nEditorSetting;
235 }
236
237 void ToggleCommentLine();
244 void FoldAll();
250 void UnfoldAll();
251 void MoveSelection(bool down = true)
252 {
253 if (down)
254 MoveSelectedLinesDown();
255 else
256 MoveSelectedLinesUp();
257 }
264 void JumpToBookmark(bool down = true);
265 std::vector<int> getBookmarks();
266 void setBookmarks(const std::vector<int>& vBookmarks);
276 void removeWhiteSpaces(int nType = RM_WS_BOTH);
277 void toggleBookmark();
278 void clearBookmarks();
287 void sortSelection(bool ascending = true);
288 void fixSymbolName(int pos);
289
291 {
292 return m_fileType;
293 }
294
295 void notifyDialogClose();
296 void SetEditorFont(const wxFont& font);
298 {
300 }
302 {
304 }
305
306 void AnalyseCode();
307
308 void FindAndOpenProcedure(const wxString& procedurename);
309 void FindAndOpenInclude(const wxString& includename);
310 std::vector<wxString> getProceduresInFile();
311
312 protected:
314
315 private:
317 {
334 };
335
336
337 void FoldCurrentBlock(int nLine);
338
339 void markSections(bool bForceRefresh = false);
340 void markLocalVariables(bool bForceRefresh = false);
341 void markLocalVariableOfType(const wxString& command, bool bForceRefresh);
342 bool isNoAutoIndentionKey(int keycode);
343 void AsynchActions();
344 void AsynchEvaluations();
345
347 void applyStrikeThrough();
348
349 bool isStyleType(StyleType _type, int nPos);
350
351 int countUmlauts(const std::string& sStr);
352 std::string realignLangString(std::string sLine, size_t& lastpos);
353 std::string addLinebreaks(const std::string& sLine, bool onlyDocumentation = false);
354
355 void markModified(int nLine);
356 void markSaved();
357
358 void OnEditorModified(wxStyledTextEvent& event);
359 void OnStartDrag(wxStyledTextEvent& event);
360 void OnDragOver(wxStyledTextEvent& event);
361 void OnDrop(wxStyledTextEvent& event);
362 void OnMouseMotion(wxMouseEvent& event);
363
366 void ReplaceMatches(const std::vector<int>& vMatches, const wxString& sSymbol, const wxString& sNewSymbol);
367 void RenameSymbols(int nPos);
368 void AbstrahizeSection();
369 void CreateProcedureFromSection(int nStartPos, int nEndPos, const wxString& sInputList, const wxString sOutputList);
370 bool IsModifiedInSection(int nSectionStart, int nSectionEnd, const wxString& sToken, const std::vector<int>& vMatch);
371 wxString getFunctionArgumentList(int nFunctionStartLine);
372 wxString getMatlabReturnList(int nMatlabFunctionStartLine);
373 wxString getTemplateContent(const wxString& sFileName);
374
375 bool isValidAutoCompMatch(int nPos, bool findAll, bool searchMethod);
376 wxString generateAutoCompList(int wordstartpos, int currpos, std::string sPreDefList);
377
378 bool MarkerOnLine(int linenum, int nMarker);
379
380 void detectCodeDuplicates(int startline, int endline, int nDuplicateFlags, int nNumDuplicatedLines);
381 double compareCodeLines(int nLine1, int nLine2, int nDuplicateFlags);
382 std::string getSemanticLine(int nLine, int nDuplicateFlags);
383 std::string getSemanticLineNSCR(int nLine, int nDuplicateFlags);
384 std::string getSemanticLineMATLAB(int nLine, int nDuplicateFlags);
385 std::string getSemanticLineCPP(int nLine, int nDuplicateFlags);
386 std::map<int, int> getDifferences(int nStart1, int nEnd1, int nStart2, int nEnd2);
387 wxString getNextToken(int& nPos);
388 std::pair<int,int> getCurrentContext(int line);
389
395
401 wxDateTime m_filetime;
402
403 wxArrayInt m_breakpoints;
409 wxMenuItem* m_menuAddWatch;
410 wxMenuItem* m_menuShowValue;
413 wxMenuItem* m_menuFindInclude;
414 wxMenuItem* m_menuRefactoring;
415
418
420 wxCriticalSection m_editorCS;
421 std::vector<std::string> vDuplicateCodeResults;
422 std::vector<std::string> vParsedSemanticCode;
423 std::vector<wxString> vRenameSymbolsChangeLog;
424 std::vector<SyntaxBlockDefinition> vBlockDefs;
432 std::string m_sCallTipContent;
433
444
447
448
452
453
454 DECLARE_EVENT_TABLE()
455};
456
457
458//BEGIN_EVENT_TABLE(ChameleonEditor, wxStyledTextCtrl)
459
460#endif
This class analyzes the code handled by the editor by accessing it with friends rights.
This class handles all formatting features of the editor.
This class represents the notebook containing all editors of one main pane.
The class of the editor window.
Definition: editor.h:53
void sortSelection(bool ascending=true)
Sorts the lines de- or ascending.
Definition: editor.cpp:2425
void AddProcedureDocumentation()
This member function handles the creation of documentation blocks in front of procedure heads.
Definition: editor.cpp:7529
wxString getMatlabReturnList(int nMatlabFunctionStartLine)
Gets the return list of a MATLAB function.
Definition: editor.cpp:6314
void SynchronizeBreakpoints()
Synchronizes all breakpoints between editor and kernel.
Definition: editor.cpp:7506
int m_nLastReleasedKey
Definition: editor.h:430
void OnTranspose()
On MenuEvent handler for the transpose functionality of the editor.
Definition: editor.cpp:6871
bool SaveNumeReFile(const wxString &filename)
Saves a NumeRe-specific file and tries to stick to ASCII encoding.
Definition: editor.cpp:509
void SetEditorFont(const wxFont &font)
Changes the editor's font face.
Definition: editor.cpp:2802
wxMenu m_popupMenu
Definition: editor.h:449
wxFileName GetExecutableFileName()
Definition: editor.h:151
void SetUnsaved()
Marks the editor as modified.
Definition: editor.cpp:3556
int getSettings()
Definition: editor.h:232
wxMenuItem * m_menuRefactoring
Definition: editor.h:414
void ToggleSettings(int _setting)
Enables or disables an editor setting.
Definition: editor.cpp:2835
std::string getSemanticLine(int nLine, int nDuplicateFlags)
Returns the selected line as semantic code.
Definition: editor.cpp:7794
wxArrayInt m_breakpoints
Definition: editor.h:403
void OnRightClick(wxMouseEvent &event)
Definition: editor.cpp:4391
void OnClearBreakpoints(wxCommandEvent &event)
Definition: editor.cpp:5219
std::string addLinebreaks(const std::string &sLine, bool onlyDocumentation=false)
Adds linebreaks to the call tip language strings.
Definition: editor.cpp:8483
std::string getSemanticLineMATLAB(int nLine, int nDuplicateFlags)
Returns the selected line as semantic code.
Definition: editor.cpp:7921
wxString getTemplateContent(const wxString &sFileName)
Returns the contents of a template file.
Definition: editor.cpp:6353
bool m_dragging
Definition: editor.h:440
void ApplyAutoIndentation(int nFirstLine=0, int nLastLine=-1)
Wrapper for CodeFormatter.
Definition: editor.cpp:8230
std::string m_sCallTipContent
Definition: editor.h:432
wxString GetFilePath()
Definition: editor.cpp:4342
int GetLineForMarkerOperation()
Gets the line belonging to the last right mouse click or the current line of the caret.
Definition: editor.cpp:5407
bool isStyleType(StyleType _type, int nPos)
Determine the syntax style type at the selected position.
Definition: editor.cpp:8249
bool LoadLocalFile(const wxString &filename)
void OnFindProcedure(wxCommandEvent &event)
Private event handler function for finding the procedure definition.
Definition: editor.cpp:6634
bool LastSavedRemotely()
Definition: editor.h:161
std::vector< int > BlockMatchMATLAB(int nPos)
Finds all matching flow control statements for MATLAB command syntax.
Definition: editor.cpp:3200
void registerProcedureViewer(ProcedureViewer *viewer)
Registers the passed procedure viewer.
Definition: editor.cpp:5326
void FindAndOpenProcedure(const wxString &procedurename)
Finds the procedure definition and displays it in the editor.
Definition: editor.cpp:5461
wxString getNextToken(int &nPos)
Returns the next syntax token starting from the selected position.
Definition: editor.cpp:8149
wxString GetFilenameString()
Definition: editor.cpp:4314
void Transpose(int nFirstLine=0, int nLastLine=-1)
This method transposes tabular data in between (including) starting and last line....
Definition: editor.cpp:8599
CodeFormatter * m_formatter
Definition: editor.h:394
bool LoadFileText(wxString fileContents)
Definition: editor.cpp:576
void OnMarginClick(wxStyledTextEvent &event)
Event handler called when clicking on the editor margin.
Definition: editor.cpp:7392
void markLocalVariableOfType(const wxString &command, bool bForceRefresh)
This method finds all local variables of the selected type and highlights their definitions.
Definition: editor.cpp:4833
wxString m_clickedInclude
Definition: editor.h:407
bool SaveFile(const wxString &filename)
Definition: editor.cpp:396
int getBlockID(const wxString &word)
This function returns the block ID.
Definition: editor.cpp:7235
int isBlockStart(const wxString &sWord, bool allowIntermediate=false)
This function returns true, if a passed word corresponds to a control flow statement block start.
Definition: editor.cpp:7109
wxString generateAutoCompList(int wordstartpos, int currpos, std::string sPreDefList)
Generates an autocompletion list based upon the file's contents.
Definition: editor.cpp:6426
bool InitDuplicateCode()
Displays the duplicated code dialog.
Definition: editor.cpp:6965
void ResetEditor()
Definition: editor.cpp:4356
void MoveSelection(bool down=true)
Definition: editor.h:251
void markModified(int nLine)
Marks the selected line as modified.
Definition: editor.cpp:4546
void OnRemoveBreakpoint(wxCommandEvent &event)
Definition: editor.cpp:5201
void getMatchingBrace(int nPos)
Finds and highlights the matching brace.
Definition: editor.cpp:2904
void notifyDialogClose()
Notifies the editor that the duplicated code dialog had been closed.
Definition: editor.cpp:2786
bool getEditorSetting(EditorSettings _setting)
Returns true, if the selected setting is active.
Definition: editor.cpp:2819
void OnChangeCase(wxCommandEvent &event)
Changes the letters in the selection.
Definition: editor.cpp:6702
SearchController * m_search
Definition: editor.h:393
wxString getBlockEnd(const wxString &sWord)
This member function returns the control flow statement block end, which corresponds to the passed wo...
Definition: editor.cpp:7324
void UpdateProcedureViewer()
Update the assigned procedure viewer.
Definition: editor.cpp:1079
virtual wxThread::ExitCode Entry()
Main thread loop for the duplicated code analysis.
Definition: editor.cpp:7604
void ClearDblClkIndicator()
Removes the double-click occurence indicators from the document.
Definition: editor.cpp:7368
bool Modified()
Returns whether the current file was modified after the last time saved.
Definition: editor.cpp:634
int m_nProcessValue
Definition: editor.h:425
void OnAbstrahizeSection(wxCommandEvent &event)
Private event handler for extracting the selected section.
Definition: editor.cpp:6820
void OnLeave(wxMouseEvent &event)
Called, when the mouse leaves the editor window.
Definition: editor.cpp:1633
void FoldAll()
Folds all fold markers.
Definition: editor.cpp:2207
std::vector< wxString > getProceduresInFile()
Wrapper for the search controller.
Definition: editor.cpp:5631
wxMenu * m_refactoringMenu
Definition: editor.h:450
void OnLoseFocus(wxFocusEvent &event)
Called, when the editor loses focus.
Definition: editor.cpp:1650
Options * m_options
Definition: editor.h:313
void OnExtractFormatted()
On MenuEvent handler for the extract as formatted text functionality of the editor.
Definition: editor.cpp:6929
bool MarkerOnLine(int linenum, int nMarker)
Checks, whether the passed marker is set on the passed line.
Definition: editor.cpp:7590
void OnMouseUp(wxMouseEvent &event)
Called, when the user releases the mouse key.
Definition: editor.cpp:1495
wxFileName GetFileName()
Definition: editor.cpp:4328
void OnFindIncludeFromMenu()
Global event handler function for finding the included script.
Definition: editor.cpp:6684
void ResetRightClickLocation()
Invalidates the latest mouse right click position.
Definition: editor.cpp:5430
void OnAutoCompletion(wxStyledTextEvent &event)
This event handler fires, if the user selects an entry in the autocompletion list or if he presses e....
Definition: editor.cpp:1896
FileFilterType GetFileType(const wxString &filename)
Returns the FileFilterType which corresponds to the passed file name.
Definition: editor.cpp:4261
int m_nLastLine
Definition: editor.h:429
void OnHideSelection(wxCommandEvent &event)
Private event handling function for hiding the selection.
Definition: editor.cpp:6740
void OnIdle(wxIdleEvent &event)
Called, when the editor idles, i.e. the user is not using it.
Definition: editor.cpp:1826
wxMenuItem * m_menuFindProcedure
Definition: editor.h:411
bool m_blockIndicatorActive
Definition: editor.h:443
wxString m_clickedProcedure
Definition: editor.h:406
wxString getBlockStart(const wxString &sWord)
This member function returns the control flow statement block start, which corresponds to the passed ...
Definition: editor.cpp:7347
int m_nDuplicateCodeLines
Definition: editor.h:427
DuplicateCodeDialog * m_duplicateCode
Definition: editor.h:419
void toggleBookmark()
Toggles a bookmark marker on the current line.
Definition: editor.cpp:2391
bool m_bHasBeenCompiled
Definition: editor.h:436
void ApplyAutoFormat(int nFirstLine=0, int nLastLine=-1)
Wrapper for CodeFormatter.
Definition: editor.cpp:8579
void JumpToBookmark(bool down=true)
Jumps the cursor to the next bookmark in the current file.
Definition: editor.cpp:2242
void AdvCallTipCancel()
Simply closes the calltip and resets its associated variables.
Definition: editor.cpp:1282
void OnMouseMotion(wxMouseEvent &event)
Event handler for moving while performing a drag 'n drop operation.
Definition: editor.cpp:5124
bool isCodeFile()
Definition: editor.h:301
bool SaveGeneralFile(const wxString &filename)
Saves a general file without touching the encoding.
Definition: editor.cpp:539
void OnFindDuplicateCode(int nDuplicateFlag=1, int nNumDuplicatedLines=6)
Wrapper for detectCodeDuplicates.
Definition: editor.cpp:6989
wxString getBlockAutoCompletion(const wxString &sWord)
This member function returns a the complete autocompletion block for the passed control flow statemen...
Definition: editor.cpp:7281
bool m_bLastSavedRemotely
Definition: editor.h:435
void FoldCurrentBlock(int nLine)
Folds the block, to which the current line belongs.
Definition: editor.cpp:4627
void MakeBraceCheck()
Checks for corresponding braces.
Definition: editor.cpp:897
ProcedureViewer * m_procedureViewer
Definition: editor.h:391
EditorSettings
The possible per-editor settings.
Definition: editor.h:68
@ SETTING_DISPCTRLCHARS
Definition: editor.h:70
@ SETTING_WRAPEOL
Definition: editor.h:69
@ SETTING_USETXTADV
Definition: editor.h:71
@ SETTING_USESECTIONS
Definition: editor.h:74
@ SETTING_USEANALYZER
Definition: editor.h:72
@ SETTING_INDENTONTYPE
Definition: editor.h:73
bool m_bNewFile
Definition: editor.h:437
bool isNoAutoIndentionKey(int keycode)
This method is a simple helper for AsynchActions to determine, which key should not trigger the autoi...
Definition: editor.cpp:4952
wxFileName m_fileNameAndPath
Definition: editor.h:396
void OnFixTypes(wxCommandEvent &event)
Event wrapper for fixSymbolName.
Definition: editor.cpp:6806
bool HasBeenSaved()
Definition: editor.cpp:3543
void updateDefaultHighlightSettings()
Performs all general default syntax highlightings.
Definition: editor.cpp:4127
void SetSyntax(NumeReSyntax *__syntax)
Definition: editor.h:209
int isBlockMiddle(const wxString &sWord)
This function returns, whether a word matches to a block middle statement (e.g. elseif).
Definition: editor.cpp:7180
void markSections(bool bForceRefresh=false)
Adds markers to section headlines.
Definition: editor.cpp:4663
void OnAddBookmark(wxCommandEvent &event)
Adds a bookmark at the selected line.
Definition: editor.cpp:5243
void OnFindProcedureFromMenu()
Global event handler function for finding the procedure definition.
Definition: editor.cpp:6650
std::vector< int > BlockMatch(int nPos)
Finds all matching flow control statements.
Definition: editor.cpp:2994
void SetTerminal(NumeReTerminal *_terminal)
Definition: editor.h:216
wxMenuItem * m_menuFindInclude
Definition: editor.h:413
void AbstrahizeSection()
Extracts the marked selection into a new procedure.
Definition: editor.cpp:5783
bool m_modificationHappened
Definition: editor.h:441
void OnHelpOnSelection(wxCommandEvent &event)
Triggers the main frame to show the documentation viewer concerning the selected command.
Definition: editor.cpp:6620
void OnExtractAsHTML()
On MenuEvent handler for the extract as HTML functionality of the editor.
Definition: editor.cpp:6897
wxString m_watchedString
Definition: editor.h:399
wxDateTime m_filetime
Definition: editor.h:401
NumeReWindow * m_mainFrame
Definition: editor.h:390
void OnSavePointLeft(wxStyledTextEvent &event)
Called, when the editor leaves the latest save point.
Definition: editor.cpp:1881
std::vector< int > BlockMatchNSCR(int nPos)
Finds all matching flow control statements for NumeRe command syntax.
Definition: editor.cpp:3042
wxCriticalSection m_editorCS
Definition: editor.h:420
std::pair< int, int > getCurrentContext(int line)
Returns the start and end line of the current code context (i.e. the first and the last line of the c...
Definition: editor.cpp:8199
std::string getSemanticLineCPP(int nLine, int nDuplicateFlags)
Returns the selected line as semantic code.
Definition: editor.cpp:8004
wxFileName m_executableFilename
Definition: editor.h:397
wxTimer * m_analyzerTimer
Definition: editor.h:451
FileFilterType m_fileType
Definition: editor.h:446
void OnChar(wxStyledTextEvent &event)
Definition: editor.cpp:658
size_t m_clickedWordLength
Definition: editor.h:408
void OnAddBreakpoint(wxCommandEvent &event)
Definition: editor.cpp:5179
void OnRenameSymbols(wxCommandEvent &event)
Event wrapper for RenameSymbols.
Definition: editor.cpp:6778
void removeWhiteSpaces(int nType=RM_WS_BOTH)
Removes whitespaces depending on the passed type.
Definition: editor.cpp:2335
int m_nEditorSetting
Definition: editor.h:445
void OnRemoveBookmark(wxCommandEvent &event)
Removes a bookmark from the selected line.
Definition: editor.cpp:5258
std::vector< std::string > vDuplicateCodeResults
Definition: editor.h:421
void AsynchEvaluations()
Performs asynchronous evaluations and is called automatically.
Definition: editor.cpp:5057
bool isWrappedLine(int line)
This member function checks, whether a line has been syntactically wrapped around.
Definition: editor.cpp:4979
@ STYLE_STRINGPARSER
Definition: editor.h:332
@ STYLE_NUMBER
Definition: editor.h:331
@ STYLE_STRING
Definition: editor.h:333
@ STYLE_OPERATOR
Definition: editor.h:327
@ STYLE_COMMENT_SECTION_BLOCK
Definition: editor.h:323
@ STYLE_DATAOBJECT
Definition: editor.h:330
@ STYLE_COMMAND
Definition: editor.h:324
@ STYLE_IDENTIFIER
Definition: editor.h:329
@ STYLE_PROCEDURE
Definition: editor.h:328
@ STYLE_COMMENT
Definition: editor.h:319
@ STYLE_CUSTOMFUNCTION
Definition: editor.h:326
@ STYLE_DEFAULT
Definition: editor.h:318
@ STYLE_COMMENT_SECTION_LINE
Definition: editor.h:322
@ STYLE_COMMENT_LINE
Definition: editor.h:320
@ STYLE_COMMENT_BLOCK
Definition: editor.h:321
@ STYLE_FUNCTION
Definition: editor.h:325
int isBlockEnd(const wxString &sWord)
This function returns true, if a passed word corresponds to a control flow statement block end.
Definition: editor.cpp:7152
wxArrayInt GetBreakpoints()
Definition: editor.cpp:5287
void OnKeyDn(wxKeyEvent &event)
Checks key input events, before they are typed into the editor.
Definition: editor.cpp:1305
int countUmlauts(const std::string &sStr)
Counts the german umlauts in the current string.
Definition: editor.cpp:8401
bool IsModifiedInSection(int nSectionStart, int nSectionEnd, const wxString &sToken, const std::vector< int > &vMatch)
Determines, whether sToken is modified in the section.
Definition: editor.cpp:6178
void UnfoldAll()
Unfolds all fold markers.
Definition: editor.cpp:2223
void OnEditorModified(wxStyledTextEvent &event)
Definition: editor.cpp:4596
void HandleFunctionCallTip()
This function handles the descriptive function call tip.
Definition: editor.cpp:985
void markSaved()
Marks the complete document as saved.
Definition: editor.cpp:4568
int m_nDuplicateCodeFlag
Definition: editor.h:426
void CreateProcedureFromSection(int nStartPos, int nEndPos, const wxString &sInputList, const wxString sOutputList)
Creates a new procedure from the analysed code section.
Definition: editor.cpp:6062
std::string realignLangString(std::string sLine, size_t &lastpos)
Re-alignes the passed language string to fit into a call tip.
Definition: editor.cpp:8440
std::vector< wxString > vRenameSymbolsChangeLog
Definition: editor.h:423
void OnDrop(wxStyledTextEvent &event)
Event handler for stopping drag 'n drop. (Actually does nothing)
Definition: editor.cpp:5110
void OnKeyRel(wxKeyEvent &event)
Called, when the user releases a key.
Definition: editor.cpp:1473
int CallTipStartPos()
Returns the starting position of the currently displayed calltip.
Definition: editor.cpp:1243
CodeAnalyzer * m_analyzer
Definition: editor.h:392
wxString getFunctionArgumentList(int nFunctionStartLine)
Gets the argument list of a procedure.
Definition: editor.cpp:6279
NumeReTerminal * m_terminal
Definition: editor.h:417
void OnMouseCaptureLost(wxMouseCaptureLostEvent &event)
Called, when the mouse leaves the editor screen, but the user keeps the mouse pressed.
Definition: editor.cpp:1593
std::string GetCurrentArgument(const std::string &sCallTip, int nStartingBrace, int &nArgStartPos)
Finds the current argument below the cursor.
Definition: editor.cpp:1141
void AdvCallTipShow(int pos, const wxString &definition)
A more advanced calltip display routine.
Definition: editor.cpp:1259
void MakeBlockCheck()
Checks for corresponding flow control statements.
Definition: editor.cpp:942
FileFilterType getFileType()
Definition: editor.h:290
void ToggleCommentLine()
Toggles a line comment.
Definition: editor.cpp:1968
void OnClearBookmarks(wxCommandEvent &event)
Removes all bookmarks from the whole file.
Definition: editor.cpp:5273
wxMenuItem * m_menuAddWatch
Definition: editor.h:409
void OnAnalyzerTimer(wxTimerEvent &event)
This event handler fires, once the analyzer timer is finished and calls the time consuming analysis t...
Definition: editor.cpp:1845
wxString m_clickedWord
Definition: editor.h:405
void SetFilename(wxFileName filename, bool fileIsRemote)
Definition: editor.cpp:4246
int m_nFirstLine
Definition: editor.h:428
void AsynchActions()
Performs asynchronous actions and is called automatically.
Definition: editor.cpp:5007
void OnAbstrahizeSectionFromMenu()
Global event handler for extracting the selected section.
Definition: editor.cpp:6833
wxPoint m_lastRightClick
Definition: editor.h:404
void setBookmarks(const std::vector< int > &vBookmarks)
Set the bookmarks in the editor.
Definition: editor.cpp:2311
bool defaultPage
Definition: editor.h:76
void ToggleCommentSelection()
Toggles block comments in a selection.
Definition: editor.cpp:2096
void AnalyseCode()
Wrapper for the static code analyzer.
Definition: editor.cpp:5443
bool SaveFileLocal()
Definition: editor.cpp:380
void OnMouseDwell(wxStyledTextEvent &event)
Called, when the mouse dwells for some time.
Definition: editor.cpp:1670
void EnsureLineVisibility(int line)
Ensures that the selected line is visible and not hidden bei either a code fold or a explicit line hi...
Definition: editor.cpp:5367
void OnStartDrag(wxStyledTextEvent &event)
Event handler for starting drag 'n drop.
Definition: editor.cpp:5082
wxString ExtractAsHTML(int nFirstLine=0, int nLastLine=-1)
Extracts the selected lines as pre- formatted HTML and returns it.
Definition: editor.cpp:8686
void markLocalVariables(bool bForceRefresh=false)
This method wraps the detection of local variables.
Definition: editor.cpp:4797
bool isNumeReFileType()
Definition: editor.h:297
void SetExecutableFilename(wxFileName filename)
void OnEnter(wxMouseEvent &event)
Called, when the mouse enters the editor window.
Definition: editor.cpp:1612
void OnRenameSymbolsFromMenu()
Global wrapper for RenameSymbols.
Definition: editor.cpp:6790
void UpdateIndicators()
Defines and applies styles to all needed indicators.
Definition: editor.cpp:4068
wxString m_dblclkString
Definition: editor.h:400
NumeReSyntax * _syntax
Definition: editor.h:416
void clearBookmarks()
Removes all bookmark markers from the current document.
Definition: editor.cpp:2409
bool m_bSetUnsaved
Definition: editor.h:438
void OnDragOver(wxStyledTextEvent &event)
Event handler for stopping drag 'n drop.
Definition: editor.cpp:5095
int m_nCallTipStart
Definition: editor.h:431
bool m_PopUpActive
Definition: editor.h:439
void FindAndOpenInclude(const wxString &includename)
Finds the included script and displays it in the editor.
Definition: editor.cpp:5601
std::map< int, int > getDifferences(int nStart1, int nEnd1, int nStart2, int nEnd2)
Returns the actual word-wise differences in the selected lines.
Definition: editor.cpp:8087
void FocusOnLine(int linenumber, bool showMarker=true)
Definition: editor.cpp:5343
void UpdateSyntaxHighlighting(bool forceUpdate=false)
Definition: editor.cpp:3573
void AddBreakpoint(int linenum)
Adds a breakpoint to the selected line.
Definition: editor.cpp:7450
void IndicateDuplicatedLine(int nStart1, int nEnd1, int nStart2, int nEnd2, int nSelectionLine)
Highlights differences between two blocks of code.
Definition: editor.cpp:7050
wxMenuItem * m_menuHelpOnSelection
Definition: editor.h:412
wxString GetFileNameAndPath()
Definition: editor.cpp:4299
std::vector< SyntaxBlockDefinition > vBlockDefs
Definition: editor.h:424
bool m_braceIndicatorActive
Definition: editor.h:442
std::string getSemanticLineNSCR(int nLine, int nDuplicateFlags)
Returns the selected line as semantic code.
Definition: editor.cpp:7827
void ReplaceMatches(const std::vector< int > &vMatches, const wxString &sSymbol, const wxString &sNewSymbol)
Replaces the matches with a new symbol.
Definition: editor.cpp:5648
bool m_bLoadingFile
Definition: editor.h:434
bool hasBlockMiddle(const wxString &sWord)
This function returns, whether a block has block middle statements.
Definition: editor.cpp:7205
void OnMouseDn(wxMouseEvent &event)
Called, when the user presses the left mouse key.
Definition: editor.cpp:1515
void GotoPipe(int nStartPos=0)
Jumps to the predefined template caret position.
Definition: editor.cpp:5144
NumeReEditor(NumeReWindow *mframe, Options *options, wxWindow *parent, wxWindowID id, NumeReSyntax *__syntax, NumeReTerminal *__terminal, const wxPoint &pos=wxDefaultPosition, const wxSize &size=wxDefaultSize, long style=0, const wxString &name=wxSTCNameStr)
Editor constructor.
Definition: editor.cpp:146
wxMenuItem * m_menuShowValue
Definition: editor.h:410
void OnFoldCurrentBlock(wxCommandEvent &event)
Event wrapper for FoldCurrentBlock.
Definition: editor.cpp:6726
void applyStrikeThrough()
Applies the strike-through effect.
Definition: editor.cpp:4203
bool isValidAutoCompMatch(int nPos, bool findAll, bool searchMethod)
Ensures that the current position follows all rules to be a valid autocompletion match.
Definition: editor.cpp:6389
void fixSymbolName(int pos)
Fixes the symbol's type depending on either the declaration point or the first assigned value.
Definition: editor.cpp:2637
void OnDisplayVariable(wxCommandEvent &event)
Highlights all word occurences permanently.
Definition: editor.cpp:6571
std::vector< int > getBookmarks()
Returns the line positions of the bookmarks.
Definition: editor.cpp:2287
void OnSavePointReached(wxStyledTextEvent &event)
Called, when the editor reaches the latest save point.
Definition: editor.cpp:1862
void RenameSymbols(int nPos)
Asks the user to supply a new name for the symbol at the passed position and replaces all occurences.
Definition: editor.cpp:5679
void OnMenuEvent(wxCommandEvent &event)
OnMenu event handler.
Definition: editor.cpp:6847
void OnMouseDblClk(wxMouseEvent &event)
Called, when the user double clicks.
Definition: editor.cpp:1535
std::vector< std::string > vParsedSemanticCode
Definition: editor.h:422
void OnFindInclude(wxCommandEvent &event)
Private event handler function for finding the included script.
Definition: editor.cpp:6668
void RemoveBreakpoint(int linenum)
Removes a breakpoint from the selected line.
Definition: editor.cpp:7487
wxString m_simpleFileName
Definition: editor.h:398
void OnThreadUpdate(wxThreadEvent &event)
Thread event handler function for the duplicated code detection functionality.
Definition: editor.cpp:7006
double compareCodeLines(int nLine1, int nLine2, int nDuplicateFlags)
Performs a semantic code comparsion of the two selected lines.
Definition: editor.cpp:7751
void detectCodeDuplicates(int startline, int endline, int nDuplicateFlags, int nNumDuplicatedLines)
Starts the duplicated code analysis.
Definition: editor.cpp:7720
void getMatchingBlock(int nPos)
Finds and highlights the matching flow control statements.
Definition: editor.cpp:2948
std::string GetCurrentFunctionContext(int &nStartingBrace)
Find the function, whose braces the cursor is currently located in.
Definition: editor.cpp:1096
void OnUnhideAllFromMenu()
Global event handling function to unhide all lines from the main frame's menu.
Definition: editor.cpp:6759
This class contains all needed keywords to highlight their occurences correspondingly....
Definition: syntax.hpp:55
The terminal class for the GUI. It's a specialisation of the GenericTerminal.
Definition: terminal.hpp:46
This class is the actual NumeRe main frame. The application's logic is implemented here.
Definition: NumeReWindow.h:177
This class implements an interface of the internal Settings object adapted to be usable from the GUI.
Definition: Options.h:178
This class handles all specialized search requests of the assigned editor.
FileFilterType
@ FILE_CPP
@ FILE_NPRC
@ FILE_NSCR
@ FILE_MATLAB
#define RM_WS_BOTH
Definition: editor.h:36
char name[32]
Definition: resampler.cpp:371