Thu, 15 Jun 2023 16:18:03 +0300
Refactor, make selecting elements from the model select the corresponding line from the editor as well
383
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
1 | #ifndef OPENEDMODEL_H |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
2 | #define OPENEDMODEL_H |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
3 | |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
4 | #include <QObject> |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
5 | #include "basics.h" |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
6 | #include "gl/partrenderer.h" |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
7 | #include "layers/edittools.h" |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
8 | #include "layers/axeslayer.h" |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
9 | #include "layers/gridlayer.h" |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
10 | |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
11 | class EditableModel : public QObject |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
12 | { |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
13 | Q_OBJECT |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
14 | public: |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
15 | explicit EditableModel(QTextDocument* model, DocumentManager* documents, ColorTable* colorTable); |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
16 | std::unique_ptr<PartRenderer> canvas; |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
17 | std::unique_ptr<EditTools> tools; |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
18 | std::unique_ptr<AxesLayer> axesLayer; |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
19 | std::unique_ptr<GridLayer> gridLayer; |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
20 | std::unique_ptr<QTextCursor> textcursor; |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
21 | QTextDocument* const model; |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
22 | |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
23 | Q_SIGNALS: |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
24 | void modelAction(const ModelAction& action); |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
25 | void select(std::int32_t linenumber); |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
26 | void newStatusText(const QString& newStatusText); |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
27 | }; |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
28 | |
530d23cd4e97
Refactor, make selecting elements from the model select the corresponding line from the editor as well
Teemu Piippo <teemu.s.piippo@gmail.com>
parents:
diff
changeset
|
29 | #endif // OPENEDMODEL_H |