[go: up one dir, main page]

Menu

[d56ae5]: / sourcewindow.h  Maximize  Restore  History

Download this file

202 lines (172 with data), 4.3 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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
#ifndef SOURCEWINDOW_H
#define SOURCEWINDOW_H
#include <QtGui>
#include <QPlainTextEdit>
#include <QCompleter>
#include <QAction>
#include "variable.h"
#include "highlighter.h"
#include "file.h"
class SourceEdit;
class SourceWindow;
class FindReplaceDialog: public QDialog
{
Q_OBJECT
public:
FindReplaceDialog();
QLineEdit *findEdit;
QLineEdit *replaceEdit;
QPushButton *findButton;
QPushButton *replaceButton;
QPushButton *cancelButton;
SourceEdit *textEdit;
public slots:
void find();
void replace();
private:
};
class LineNumberDialog: public QDialog
{
Q_OBJECT
public:
LineNumberDialog();
QSpinBox *lineSpin;
void setMax(int max);
int line;
QPushButton *okButton;
QPushButton *cancelButton;
public slots:
void setLine();
};
class SourceEdit: public QPlainTextEdit
{
Q_OBJECT
public:
SourceEdit(QWidget *parent = 0);
int heightInPixels;
int tab_width;
void setCompleter(QCompleter *c);
QCompleter *completer() const;
QStringListModel model;
void addWords(QString t);
QSet<QString> wordsInList;
int complete_minimum;
Highlighter *highlighter;
bool autoIndent;
void newLine();
void indentNewLine(int k = 0);
private slots:
void printScroll();
void defineVariable();
void insertCompletion(const QString &completion);
//void receiveVariableDefinition(bool,QStringList);
signals:
void newHeight(int height);
void sendVariableDefinition(QStringList);
private:
void keyPressEvent(QKeyEvent *e);
void focusInEvent(QFocusEvent *e);
void resizeEvent(QResizeEvent *e);
void scrollContentsBy(int dx, int dy);
//bool event ( QEvent *e );
//void wheelEvent ( QWheelEvent *e );
void contextMenuEvent(QContextMenuEvent *event);
QString textUnderCursor() const;
private:
int top;
QScrollBar *scrollBar;
QCompleter *c;
};
class LineNumberEdit: public QPlainTextEdit
{
Q_OBJECT
public:
LineNumberEdit(QWidget *parent = 0);
void wheelEvent(QWheelEvent *e);
QScrollBar *scrollBar;
QTextBlockFormat normalFormat;
QTextBlockFormat breakFormat;
private:
QSet<int> *breakpoints;
void mouseReleaseEvent(QMouseEvent *event);
void contextMenuEvent(QContextMenuEvent *event);
QPoint eventPosition;
SourceWindow *myParent;
private slots:
void setBreakpoint();
void dropBreakpoint();
void dropAllBreakpoints();
void ignore();
signals:
void sendBreakpoint(QString,QString);
void deleteBreakpoint(QString, QString);
};
typedef QSet<int> IntSet;
class SourceWindow: public QFrame
{
Q_OBJECT
public:
SourceWindow(QWidget *parent = 0);
void setFontHeightAndWidth(int height, int width);
void setLineNumbers(int nLines);
void saveCursor();
void restoreCursor();
bool fileChanged();
void saveBeforeQuit();
File file;
bool changed;
bool saved;
bool opened;
void open(QString name);
SourceEdit *textEdit;
QTextDocument *textDoc;
int numLines;
int textHeight;
int heightInPixels;
int fontWidth;
int fontHeight;
int topNumber;
int bottomNumber;
int lastLineNumber;
int tab_width;
IntSet *breakpoints;
void setNextLine(int line);
void clearNextLine(int line);
QTextBlockFormat normalFormat;
QTextBlockFormat breakFormat;
void comment();
void unComment();
void indent();
void unIndent();
void find();
void pageForward();
void pageBackward();
void center();
void gotoFirstLine();
void gotoLastLine();
void gotoTop();
void gotoBottom();
void gotoLine();
void prettify();
void doTemplate(QAction *a);
void insertFile(QString f);
void clear();
public slots:
void open();
void save();
void saveAs();
void textChanged();
void newHeight(int heightInPixels);
void scrollBarChanged(int value);
void scrollBarRangeChanged(int min, int max);
void sliderChanged(int value);
private:
void createLineNumberEdit();
void createTextEdit();
void createButtons();
void createCommandLineEdit();
LineNumberEdit *lineNumberEdit;
QScrollBar *scrollBar;
signals:
};
#endif