Debian Codegraph @

src/console.h

raw symbols SCIP
1 /*
2 Copyright (C) 2008, 2009 Andres Cabrera
3 [email protected]
4
5 This file is part of CsoundQt.
6
7 CsoundQt is free software; you can redistribute it
8 and/or modify it under the terms of the GNU Lesser General Public
9 License as published by the Free Software Foundation; either
10 version 2.1 of the License, or (at your option) any later version.
11
12 CsoundQt is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU Lesser General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public
18 License along with Csound; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
20 02111-1307 USA
21 */
22
23 #ifndef CONSOLE_H
24 #define CONSOLE_H
25
26 #include <QTextEdit>
27 #include <QDockWidget>
28 #include <QtGui>
29
30
31 class Console : public QTextEdit
32 {
33 Q_OBJECT
34 public:
35 Console(QWidget *parent = 0);
36
37 virtual ~Console();
38
39 virtual void setDefaultFont(QFont font);
40 virtual void setColors(QColor textColor, QColor bgColor);
41 void scrollToEnd();
42 void setKeyRepeatMode(bool repeat);
43 // void refresh();
44
45 QList<int> errorLines;
46 QStringList errorTexts;
47
48 public slots:
49 virtual void appendMessage(QString msg);
50 void reset();
51
52 protected:
53 virtual void contextMenuEvent(QContextMenuEvent *event);
54 virtual void keyPressEvent(QKeyEvent *event);
55 virtual void keyReleaseEvent(QKeyEvent *event);
56
57 bool error;
58 bool errorLine;
59 QString errorLineText;
60 QString messageLine;
61 QColor m_textColor;
62 QColor m_bgColor;
63 QColor m_warningColor;
64 QColor m_errorColor;
65
66 bool m_repeatKeys;
67 QMutex consoleLock;
68
69 QRegularExpression rxerr;
70
71 signals:
72 void keyPressed(int key);
73 void keyReleased(int key);
74 void logMessage(QString msg);
75 };
76
77 class DockConsole : public QDockWidget
78 {
79 Q_OBJECT
80 public:
81 DockConsole(QWidget * parent);
82 ~DockConsole();
83 void copy();
84 bool widgetHasFocus();
85 void appendMessage(QString msg);
86
87 public slots:
88
89 protected:
90 virtual void closeEvent(QCloseEvent * event);
91
92 private:
93 Console *text;
94 signals:
95 void Close(bool visible);
96 };
97
98 class ConsoleWidget : public Console
99 {
100 Q_OBJECT
101 public:
102 ConsoleWidget(QWidget * parent = 0): Console(parent)
103 {
104 setReadOnly(true);
105 setFontItalic(false);
106 #ifdef Q_OS_MACOS
107 document()->setDefaultFont(QFont("Courier New", 10));
108 #else
109 document()->setDefaultFont(QFont("Courier New", 7));
110 #endif
111 // connect(text, SIGNAL(popUpMenu(QPoint)), this, SLOT(emitPopUpMenu(QPoint)));
112 }
113
114 ~ConsoleWidget() {;}
115
116 virtual void setWidgetGeometry(int x,int y,int width,int height);
117 protected:
118 // private slots:
119 // void emitPopUpMenu(QPoint point) {emit(popUpMenu(point));}
120 signals:
121 // void popUpMenu(QPoint pos);
122
123 };
124
125 #endif