forked from bruderstein/PythonScript
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathConsoleDialog.h
More file actions
125 lines (97 loc) · 3.1 KB
/
ConsoleDialog.h
File metadata and controls
125 lines (97 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
#ifndef _CONSOLEDIALOG_H
#define _CONSOLEDIALOG_H
#ifndef DOCKINGDLGINTERFACE_H
#include "DockingDlgInterface.h"
#endif
struct SCNotification;
struct NppData;
namespace NppPythonScript
{
class ConsoleInterface;
struct LineDetails;
class ConsoleDialog : public DockingDlgInterface
{
public:
ConsoleDialog();
ConsoleDialog(const ConsoleDialog& other) = delete;
~ConsoleDialog();
void initDialog(HINSTANCE hInst, NppData& nppData, ConsoleInterface *console);
void doDialog();
void hide();
void writeCmdText(size_t length, const char *text);
void writeText(size_t length, const char *text);
void writeColoredText(size_t length, const char *text);
void writeError(size_t length, const char *text);
void clearText();
void setPrompt(std::string prompt);
std::string getStandardPrompt();
std::string getContinuePrompt();
HWND getScintillaHwnd() { return m_scintilla; }
void giveInputFocus() { SetFocus(m_hCombo); }
void runEnabled(bool enabled);
NppData m_nppData;
protected:
virtual INT_PTR CALLBACK run_dlgProc(UINT Message, WPARAM wParam, LPARAM lParam);
private:
ConsoleDialog& operator = (const ConsoleDialog&); // assignment operator disabled
void createOutputWindow(HWND hParentWindow);
void runStatement();
void stopStatement();
LRESULT run_inputWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static LRESULT inputWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
static LRESULT scintillaWndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam);
void historyNext();
void historyPrevious();
void historyAdd(const TCHAR *line);
void historyEnd();
void selectComboboxItem();
LRESULT callScintilla(UINT message, WPARAM wParam = 0, LPARAM lParam = 0)
{ return ::SendMessage(m_scintilla, message, wParam, lParam); }
/* Styler functions */
void onStyleNeeded(SCNotification* notification);
bool parsePythonErrorLine(LineDetails *lineDetails);
bool parseVSErrorLine(LineDetails *lineDetails);
bool parseGCCErrorLine(LineDetails *lineDetails);
//void styleDefaultLine(int lineNumber, int lineLength, const char *line);
void onHotspotClick(SCNotification* notification);
bool parseLine(LineDetails *lineDetails);
bool isValidFilenameChar(char ch)
{ return (ch != '<' && ch != '>' && ch != ':' && ch != '|' && ch != '\"' && ch != '?'); };
//HWND m_hNpp;
tTbData* m_data;
HWND m_scintilla;
static WNDPROC s_originalScintillaWndProc;
HWND m_hCombo; // ComboBox
HWND m_hInput; // Input ComboBox
ConsoleInterface *m_console;
std::string m_standardPrompt;
std::string m_continuePrompt;
std::string m_currentPrompt;
WNDPROC m_originalInputWndProc;
HICON m_hTabIcon;
bool m_runButtonIsRun;
HMENU m_hContext;
bool m_colorOutput;
int m_user_color;
bool m_customizeConsoleErrorColor;
int m_customConsoleErrorColor;
};
enum ErrorLevel
{
EL_UNSET,
EL_INFO,
EL_WARNING,
EL_ERROR
};
struct LineDetails
{
public:
char *line;
size_t lineLength;
idx_t errorLineNo;
idx_t filenameStart;
idx_t filenameEnd;
ErrorLevel errorLevel;
};
}
#endif