Sat, 24 Mar 2018 16:40:12 +0200
more work on 8-primitives
841
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
1326 | 3 | * Copyright (C) 2013 - 2018 Teemu Piippo |
841
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
1006
a6b462051ae0
Copyright header fix, some minor stuff
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
8 | * (at your option) any later version. |
841
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #pragma once |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include "abstractEditMode.h" |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | class RectangleMode : public AbstractDrawMode |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | { |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | DEFINE_CLASS (RectangleMode, AbstractDrawMode) |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
844
diff
changeset
|
25 | QVector<Vertex> m_rectangleVerts; |
841
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | public: |
1104
edddb9b0db9e
Moved document editing methods from GLRenderer to Canvas
Teemu Piippo <teemu@hecknology.net>
parents:
1072
diff
changeset
|
28 | RectangleMode (Canvas* canvas); |
841
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | |
1009
85fd352bae45
Fix rectangle mode for real
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1006
diff
changeset
|
30 | void render (QPainter& painter) const override; |
85fd352bae45
Fix rectangle mode for real
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1006
diff
changeset
|
31 | EditModeType type() const override; |
85fd352bae45
Fix rectangle mode for real
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1006
diff
changeset
|
32 | void endDraw() override; |
85fd352bae45
Fix rectangle mode for real
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1006
diff
changeset
|
33 | bool mouseMoved (QMouseEvent*) override; |
85fd352bae45
Fix rectangle mode for real
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1006
diff
changeset
|
34 | int maxVertices() const override { return 2; } |
841
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | private: |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | void updateRectVerts(); |
1243abd47381
- split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | }; |