1 /**************************************************************************
3 ** This file is part of Qt Creator
5 ** Copyright (c) 2011 Nokia Corporation and/or its subsidiary(-ies).
7 ** Contact: Nokia Corporation (qt-info@nokia.com)
11 ** This file contains pre-release code and may not be distributed.
12 ** You may use this file in accordance with the terms and conditions
13 ** contained in the Technology Preview License Agreement accompanying
16 ** GNU Lesser General Public License Usage
18 ** Alternatively, this file may be used under the terms of the GNU Lesser
19 ** General Public License version 2.1 as published by the Free Software
20 ** Foundation and appearing in the file LICENSE.LGPL included in the
21 ** packaging of this file. Please review the following information to
22 ** ensure the GNU Lesser General Public License version 2.1 requirements
23 ** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
25 ** In addition, as a special exception, Nokia gives you certain additional
26 ** rights. These rights are described in the Nokia Qt LGPL Exception
27 ** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
29 ** If you have questions regarding the use of this file, please contact
30 ** Nokia at qt-info@nokia.com.
32 **************************************************************************/
37 #include "glsleditor_global.h"
38 #include "glsleditoreditable.h"
40 #include <glsl/glsl.h>
42 #include <texteditor/basetexteditor.h>
43 #include <texteditor/quickfix.h>
45 #include <QtCore/QSharedPointer>
46 #include <QtCore/QSet>
57 namespace GLSLEditor {
60 class GLSLEDITOR_EXPORT Document
63 typedef QSharedPointer<Document> Ptr;
68 GLSL::Engine *engine() const { return _engine; }
69 GLSL::TranslationUnitAST *ast() const { return _ast; }
70 GLSL::Scope *globalScope() const { return _globalScope; }
72 GLSL::Scope *scopeAt(int position) const;
73 void addRange(const QTextCursor &cursor, GLSL::Scope *scope);
81 GLSL::Engine *_engine;
82 GLSL::TranslationUnitAST *_ast;
83 GLSL::Scope *_globalScope;
84 QList<Range> _cursors;
86 friend class GLSLTextEditor;
89 class GLSLEDITOR_EXPORT GLSLTextEditor : public TextEditor::BaseTextEditor
94 GLSLTextEditor(QWidget *parent = 0);
97 virtual void unCommentSelection();
99 int editorRevision() const;
100 bool isOutdated() const;
102 QSet<QString> identifiers() const;
104 int languageVariant() const;
106 Document::Ptr glslDocument() const;
109 virtual void setFontSettings(const TextEditor::FontSettings &);
112 void updateDocument();
113 void updateDocumentNow();
116 bool event(QEvent *e);
117 TextEditor::BaseTextEditorEditable *createEditableInterface();
118 void createToolBar(Internal::GLSLEditorEditable *editable);
121 void setSelectedElements();
122 QString wordUnderCursor() const;
124 const Core::Context m_context;
126 QTimer *m_updateDocumentTimer;
127 QComboBox *m_outlineCombo;
128 Document::Ptr m_glslDocument;
131 } // namespace GLSLEditor
133 #endif // GLSLEDITOR_H