forked from qt-creator/qt-creator
GlslEditor: Some editor creation related cleanup
Use a BaseEditorFactory derived class, move some code around. Change-Id: Id560a215102016cdbe21809f97be8fc190ed5cf5 Reviewed-by: Christian Stenger <christian.stenger@digia.com>
This commit is contained in:
@@ -30,7 +30,6 @@
|
||||
#include "glslcompletionassist.h"
|
||||
#include "glsleditorconstants.h"
|
||||
#include "glsleditorplugin.h"
|
||||
#include "reuse.h"
|
||||
|
||||
#include <glsl/glslengine.h>
|
||||
#include <glsl/glsllexer.h>
|
||||
@@ -64,6 +63,37 @@ using namespace TextEditor;
|
||||
namespace GlslEditor {
|
||||
namespace Internal {
|
||||
|
||||
Document::Document()
|
||||
: _engine(0)
|
||||
, _ast(0)
|
||||
, _globalScope(0)
|
||||
{
|
||||
}
|
||||
|
||||
Document::~Document()
|
||||
{
|
||||
delete _globalScope;
|
||||
delete _engine;
|
||||
}
|
||||
|
||||
GLSL::Scope *Document::scopeAt(int position) const
|
||||
{
|
||||
foreach (const Range &c, _cursors) {
|
||||
if (position >= c.cursor.selectionStart() && position <= c.cursor.selectionEnd())
|
||||
return c.scope;
|
||||
}
|
||||
return _globalScope;
|
||||
}
|
||||
|
||||
void Document::addRange(const QTextCursor &cursor, GLSL::Scope *scope)
|
||||
{
|
||||
Range c;
|
||||
c.cursor = cursor;
|
||||
c.scope = scope;
|
||||
_cursors.append(c);
|
||||
}
|
||||
|
||||
|
||||
enum CompletionOrder {
|
||||
SpecialMemberOrder = -5
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user