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:
hjk
2014-08-22 17:16:02 +02:00
parent 44f0f4dc95
commit 3430514eff
10 changed files with 134 additions and 296 deletions

View File

@@ -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
};