Sat, 13 Feb 2016 04:14:43 +0200
Fixed line length warnings
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
1014
f0a8ecb6a357
Happy new year 2016!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1012
diff
changeset
|
3 | * Copyright (C) 2013 - 2016 Teemu Piippo |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
19 | #include <QFileDialog> |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
20 | #include <QInputDialog> |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
21 | #include "../mainwindow.h" |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include "../ldDocument.h" |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include "../miscallenous.h" |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | #include "../glRenderer.h" |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | #include "../primitives.h" |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | #include "../colors.h" |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | #include "../dialogs.h" |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | #include "../glCompiler.h" |
1012 | 29 | #include "../documentmanager.h" |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | #include "viewtoolset.h" |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | ViewToolset::ViewToolset (MainWindow *parent) : |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | Toolset (parent) {} |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | void ViewToolset::selectAll() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | { |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
37 | for (LDObject* obj : currentDocument()->objects()) |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | obj->select(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | void ViewToolset::selectByColor() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | { |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
43 | if (selectedObjects().isEmpty()) |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | return; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | QList<LDColor> colors; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
48 | for (LDObject* obj : selectedObjects()) |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
49 | { |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
50 | if (obj->isColored()) |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
51 | colors << obj->color(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
53 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | removeDuplicates (colors); |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
55 | currentDocument()->clearSelection(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
56 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
57 | for (LDObject* obj : currentDocument()->objects()) |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
58 | { |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
59 | if (colors.contains (obj->color())) |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
60 | obj->select(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
61 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
62 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
63 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
64 | void ViewToolset::selectByType() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
65 | { |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
66 | if (selectedObjects().isEmpty()) |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
67 | return; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
68 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
69 | QList<LDObjectType> types; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
70 | QStringList subfilenames; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
71 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
72 | for (LDObject* obj : selectedObjects()) |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
73 | { |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
74 | types << obj->type(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
75 | |
1011
4fdd74a04790
Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents:
986
diff
changeset
|
76 | if (types.last() == OBJ_SubfileReference) |
4fdd74a04790
Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents:
986
diff
changeset
|
77 | subfilenames << static_cast<LDSubfileReference*> (obj)->fileInfo()->name(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
78 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
79 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
80 | removeDuplicates (types); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
81 | removeDuplicates (subfilenames); |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
82 | currentDocument()->clearSelection(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
83 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
84 | for (LDObject* obj : currentDocument()->objects()) |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
85 | { |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
86 | LDObjectType type = obj->type(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
87 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
88 | if (not types.contains (type)) |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
89 | continue; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
90 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
91 | // For subfiles, type check is not enough, we check the name of the document as well. |
1016
3b279b5e57d3
Fixed line length warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
92 | if (type == OBJ_SubfileReference |
3b279b5e57d3
Fixed line length warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
93 | and not subfilenames.contains (static_cast<LDSubfileReference*> (obj)->fileInfo()->name())) |
3b279b5e57d3
Fixed line length warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
94 | { |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | continue; |
1016
3b279b5e57d3
Fixed line length warnings
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1014
diff
changeset
|
96 | } |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
97 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
98 | obj->select(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
99 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
100 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
101 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | void ViewToolset::resetView() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | { |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
104 | m_window->renderer()->resetAngles(); |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
105 | m_window->renderer()->update(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
106 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
107 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
108 | void ViewToolset::screenshot() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
109 | { |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
110 | const char* imageformats = "PNG images (*.png);;JPG images (*.jpg);;BMP images (*.bmp);;" |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
111 | "PPM images (*.ppm);;X11 Bitmaps (*.xbm);;X11 Pixmaps (*.xpm);;All Files (*.*)"; |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
112 | int width = m_window->renderer()->width(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
113 | int height = m_window->renderer()->height(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
114 | QByteArray capture = m_window->renderer()->capturePixels(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
115 | const uchar* imagedata = reinterpret_cast<const uchar*> (capture.constData()); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
116 | // GL and Qt formats have R and B swapped. Also, GL flips Y - correct it as well. |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
117 | QImage image = QImage (imagedata, width, height, QImage::Format_ARGB32).rgbSwapped().mirrored(); |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
118 | QString root = Basename (currentDocument()->name()); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
120 | if (root.right (4) == ".dat") |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
121 | root.chop (4); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
122 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
123 | QString defaultname = (root.length() > 0) ? format ("%1.png", root) : ""; |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
124 | QString filename = QFileDialog::getSaveFileName (m_window, "Save Screencap", defaultname, imageformats); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
125 | |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
126 | if (not filename.isEmpty() and not image.save (filename)) |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
127 | Critical (format ("Couldn't open %1 for writing to save screencap: %2", filename, strerror (errno))); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
128 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
129 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | void ViewToolset::axes() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
131 | { |
1012 | 132 | Config->setDrawAxes (not Config->drawAxes()); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
133 | m_window->updateActions(); |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
134 | m_window->renderer()->update(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
135 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
136 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
137 | void ViewToolset::visibilityToggle() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
138 | { |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
139 | for (LDObject* obj : selectedObjects()) |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
140 | obj->setHidden (not obj->isHidden()); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
141 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
142 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
143 | void ViewToolset::visibilityHide() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
144 | { |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
145 | for (LDObject* obj : selectedObjects()) |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
146 | obj->setHidden (true); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
147 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
148 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
149 | void ViewToolset::visibilityReveal() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
150 | { |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
151 | for (LDObject* obj : selectedObjects()) |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
152 | obj->setHidden (false); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
153 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
154 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
155 | void ViewToolset::wireframe() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
156 | { |
1012 | 157 | Config->setDrawWireframe (not Config->drawWireframe()); |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
158 | m_window->renderer()->refresh(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
159 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
160 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
161 | void ViewToolset::setOverlay() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
162 | { |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
163 | OverlayDialog dlg; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
164 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
165 | if (not dlg.exec()) |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
166 | return; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
167 | |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
168 | m_window->renderer()->setupOverlay ((ECamera) dlg.camera(), dlg.fpath(), dlg.ofsx(), |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
169 | dlg.ofsy(), dlg.lwidth(), dlg.lheight()); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
170 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
171 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
172 | void ViewToolset::clearOverlay() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
173 | { |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
174 | m_window->renderer()->clearOverlay(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
175 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
176 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
177 | void ViewToolset::drawAngles() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
178 | { |
1012 | 179 | Config->setDrawAngles (not Config->drawAngles()); |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
180 | m_window->renderer()->refresh(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
181 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
182 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
183 | void ViewToolset::setDrawDepth() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
184 | { |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
185 | if (m_window->renderer()->camera() == EFreeCamera) |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
186 | return; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
187 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
188 | bool ok; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
189 | double depth = QInputDialog::getDouble (m_window, "Set Draw Depth", |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
190 | format ("Depth value for %1:", m_window->renderer()->currentCameraName()), |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
191 | m_window->renderer()->getDepthValue(), -10000.0f, 10000.0f, 3, &ok); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
192 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
193 | if (ok) |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
194 | m_window->renderer()->setDepthValue (depth); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
195 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
196 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
197 | #if 0 |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
198 | // This is a test to draw a dummy axle. Meant to be used as a primitive gallery, |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
199 | // but I can't figure how to generate these pictures properly. Multi-threading |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
200 | // these is an immense pain. |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
201 | void ViewToolset::testpic() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
202 | { |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
203 | LDDocument* file = getFile ("axle.dat"); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
204 | setlocale (LC_ALL, "C"); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
205 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
206 | if (not file) |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
207 | { |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
208 | critical ("couldn't load axle.dat"); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
209 | return; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
210 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
211 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
212 | int w, h; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
213 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
214 | GLRenderer* rend = new GLRenderer; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
215 | rend->resize (64, 64); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
216 | rend->setAttribute (Qt::WA_DontShowOnScreen); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
217 | rend->show(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
218 | rend->setFile (file); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
219 | rend->setDrawOnly (true); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
220 | rend->compileAllObjects(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
221 | rend->initGLData(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
222 | rend->drawGLScene(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
223 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
224 | uchar* imgdata = rend->screencap (w, h); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
225 | QImage img = imageFromScreencap (imgdata, w, h); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
226 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
227 | if (img.isNull()) |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
228 | { |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
229 | critical ("Failed to create the image!\n"); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
230 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
231 | else |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
232 | { |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
233 | QLabel* label = new QLabel; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
234 | QDialog* dlg = new QDialog; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
235 | label->setPixmap (QPixmap::fromImage (img)); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
236 | QVBoxLayout* layout = new QVBoxLayout (dlg); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
237 | layout->addWidget (label); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
238 | dlg->exec(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
239 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
240 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
241 | delete[] imgdata; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
242 | rend->deleteLater(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
243 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
244 | #endif |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
245 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
246 | void ViewToolset::bfcView() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
247 | { |
1012 | 248 | Config->setBfcRedGreenView (not Config->bfcRedGreenView()); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
249 | |
1012 | 250 | if (Config->bfcRedGreenView()) |
251 | Config->setRandomColors (false); | |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
252 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
253 | m_window->updateActions(); |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
254 | m_window->renderer()->refresh(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
255 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
256 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
257 | void ViewToolset::jumpTo() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
258 | { |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
259 | bool ok; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
260 | int defval = 0; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
261 | LDObject* obj; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
262 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
263 | if (selectedObjects().size() == 1) |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
264 | defval = selectedObjects()[0]->lineNumber(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
265 | |
984 | 266 | int idx = QInputDialog::getInt (nullptr, "Go to line", "Go to line:", defval, |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
267 | 1, currentDocument()->getObjectCount(), 1, &ok); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
268 | |
984 | 269 | if (not ok or (obj = currentDocument()->getObject (idx - 1)) == nullptr) |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
270 | return; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
271 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
272 | currentDocument()->clearSelection(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
273 | obj->select(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
274 | m_window->updateSelection(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
275 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
276 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
277 | void ViewToolset::randomColors() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
278 | { |
1012 | 279 | Config->setRandomColors (not Config->randomColors()); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
280 | |
1012 | 281 | if (Config->randomColors()) |
282 | Config->setBfcRedGreenView (false); | |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
283 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
284 | m_window->updateActions(); |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
285 | m_window->renderer()->refresh(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
286 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
287 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
288 | void ViewToolset::drawSurfaces() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
289 | { |
1012 | 290 | Config->setDrawSurfaces (not Config->drawSurfaces()); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
291 | m_window->updateActions(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
292 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
293 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
294 | void ViewToolset::drawEdgeLines() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
295 | { |
1012 | 296 | Config->setDrawEdgeLines (not Config->drawEdgeLines()); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
297 | m_window->updateActions(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
298 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
299 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
300 | void ViewToolset::drawConditionalLines() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
301 | { |
1012 | 302 | Config->setDrawConditionalLines (not Config->drawConditionalLines()); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
303 | m_window->updateActions(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
304 | } |