src/openedmodel.cpp

changeset 383
530d23cd4e97
equal deleted inserted replaced
382:94d5587bb0c4 383:530d23cd4e97
1 #include "openedmodel.h"
2 #include "settings.h"
3 #include "ldrawsyntaxhighlighter.h"
4
5 EditableModel::EditableModel(QTextDocument* model, DocumentManager* documents, ColorTable* colorTable)
6 : QObject{documents}, model{model}
7 {
8 this->tools = std::make_unique<EditTools>();
9 this->canvas = std::make_unique<PartRenderer>(model, documents, *colorTable);
10 this->axesLayer = std::make_unique<AxesLayer>();
11 this->gridLayer = std::make_unique<GridLayer>();
12 this->gridLayer->setGridMatrix(DEFAULT_GRID_MATRIX);
13 this->tools->setGridMatrix(DEFAULT_GRID_MATRIX);
14 this->canvas->addRenderLayer(this->axesLayer.get());
15 this->canvas->setLayerEnabled(this->axesLayer.get(), setting<Setting::DrawAxes>());
16 this->canvas->addRenderLayer(this->gridLayer.get());
17 this->canvas->addRenderLayer(this->tools.get());
18 new LDrawSyntaxHighlighter{model};
19 this->textcursor = std::make_unique<QTextCursor>(model);
20 QObject::connect(
21 this->tools.get(),
22 &EditTools::modelAction,
23 this,
24 &EditableModel::modelAction);
25 QObject::connect(
26 this->tools.get(),
27 &EditTools::newStatusText,
28 this,
29 &EditableModel::newStatusText);
30 QObject::connect(
31 this->tools.get(),
32 &EditTools::select,
33 this,
34 &EditableModel::select);
35 }

mercurial