Thu, 04 Jan 2018 21:41:17 +0200
happy new year 2018
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 |
1222 | 3 | * Copyright (C) 2013 - 2018 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 | |
1217 | 32 | ViewToolset::ViewToolset(MainWindow *parent) : |
33 | Toolset(parent) {} | |
969
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 | |
1217 | 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 | { |
1217 | 59 | if (colors.contains(obj->color())) |
969
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) |
1217 | 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 | |
1217 | 80 | removeDuplicates(types); |
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 | |
1217 | 88 | if (not types.contains(type)) |
969
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. |
1217 | 92 | if (type == OBJ_SubfileReference and not subfilenames.contains(static_cast<LDSubfileReference*>(obj)->fileInfo()->name())) |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
93 | continue; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
94 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | obj->select(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
96 | } |
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 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
99 | void ViewToolset::resetView() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
100 | { |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
101 | m_window->renderer()->resetAngles(); |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
102 | m_window->renderer()->update(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
104 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
105 | void ViewToolset::screenshot() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
106 | { |
1217 | 107 | const char* imageformats = "PNG images(*.png);;JPG images(*.jpg);;BMP images(*.bmp);;" |
108 | "PPM images(*.ppm);;X11 Bitmaps(*.xbm);;X11 Pixmaps(*.xpm);;All Files(*.*)"; | |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
109 | int width = m_window->renderer()->width(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
110 | int height = m_window->renderer()->height(); |
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
111 | QByteArray capture = m_window->renderer()->capturePixels(); |
1217 | 112 | const uchar* imagedata = reinterpret_cast<const uchar*>(capture.constData()); |
986
525921eae58c
Refactor GLRenderer and GLCompiler
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
113 | // GL and Qt formats have R and B swapped. Also, GL flips Y - correct it as well. |
1217 | 114 | QImage image = QImage(imagedata, width, height, QImage::Format_ARGB32).rgbSwapped().mirrored(); |
115 | QString root = Basename(currentDocument()->name()); | |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
116 | |
1217 | 117 | if (root.right(4) == ".dat") |
118 | root.chop(4); | |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | |
1217 | 120 | QString defaultname = (root.length() > 0) ? format("%1.png", root) : ""; |
121 | 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
|
122 | |
1217 | 123 | if (not filename.isEmpty() and not image.save(filename)) |
124 | 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
|
125 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
126 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
127 | void ViewToolset::axes() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
128 | { |
1217 | 129 | config.setDrawAxes(not config.drawAxes()); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | m_window->updateActions(); |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
131 | m_window->renderer()->update(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
132 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
133 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
134 | void ViewToolset::visibilityToggle() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
135 | { |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
136 | for (LDObject* obj : selectedObjects()) |
1217 | 137 | obj->setHidden(not obj->isHidden()); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
138 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
139 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
140 | void ViewToolset::visibilityHide() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
141 | { |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
142 | for (LDObject* obj : selectedObjects()) |
1217 | 143 | obj->setHidden(true); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
144 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
145 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
146 | void ViewToolset::visibilityReveal() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
147 | { |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
148 | for (LDObject* obj : selectedObjects()) |
1217 | 149 | obj->setHidden(false); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
150 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
151 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
152 | void ViewToolset::wireframe() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
153 | { |
1217 | 154 | config.setDrawWireframe(not config.drawWireframe()); |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
155 | m_window->renderer()->refresh(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
156 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
157 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
158 | void ViewToolset::setOverlay() |
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 | OverlayDialog dlg; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
161 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
162 | if (not dlg.exec()) |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
163 | return; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
164 | |
1217 | 165 | 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
|
166 | dlg.ofsy(), dlg.lwidth(), dlg.lheight()); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
167 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
168 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
169 | void ViewToolset::clearOverlay() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
170 | { |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
171 | m_window->renderer()->clearOverlay(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
172 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
173 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
174 | void ViewToolset::drawAngles() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
175 | { |
1217 | 176 | config.setDrawAngles(not config.drawAngles()); |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
177 | m_window->renderer()->refresh(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
178 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
179 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
180 | void ViewToolset::setDrawDepth() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
181 | { |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
182 | if (m_window->renderer()->camera() == EFreeCamera) |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
183 | return; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
184 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
185 | bool ok; |
1217 | 186 | double depth = QInputDialog::getDouble(m_window, "Set Draw Depth", |
187 | format("Depth value for %1:", m_window->renderer()->currentCameraName()), | |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
188 | 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
|
189 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
190 | if (ok) |
1217 | 191 | m_window->renderer()->setDepthValue(depth); |
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 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
194 | #if 0 |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
195 | // 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
|
196 | // 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
|
197 | // these is an immense pain. |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
198 | void ViewToolset::testpic() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
199 | { |
1217 | 200 | LDDocument* file = getFile("axle.dat"); |
201 | setlocale(LC_ALL, "C"); | |
969
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 | if (not file) |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
204 | { |
1217 | 205 | critical("couldn't load axle.dat"); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
206 | return; |
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 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
209 | int w, h; |
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 | GLRenderer* rend = new GLRenderer; |
1217 | 212 | rend->resize(64, 64); |
213 | rend->setAttribute(Qt::WA_DontShowOnScreen); | |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
214 | rend->show(); |
1217 | 215 | rend->setFile(file); |
216 | rend->setDrawOnly(true); | |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
217 | rend->compileAllObjects(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
218 | rend->initGLData(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
219 | rend->drawGLScene(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
220 | |
1217 | 221 | uchar* imgdata = rend->screencap(w, h); |
222 | QImage img = imageFromScreencap(imgdata, w, h); | |
969
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 | if (img.isNull()) |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
225 | { |
1217 | 226 | critical("Failed to create the image!\n"); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
227 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
228 | else |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
229 | { |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
230 | QLabel* label = new QLabel; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
231 | QDialog* dlg = new QDialog; |
1217 | 232 | label->setPixmap(QPixmap::fromImage(img)); |
233 | QVBoxLayout* layout = new QVBoxLayout(dlg); | |
234 | layout->addWidget(label); | |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
235 | dlg->exec(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
236 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
237 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
238 | delete[] imgdata; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
239 | rend->deleteLater(); |
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 | #endif |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
242 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
243 | void ViewToolset::bfcView() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
244 | { |
1217 | 245 | config.setBfcRedGreenView(not config.bfcRedGreenView()); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
246 | |
1215 | 247 | if (config.bfcRedGreenView()) |
1217 | 248 | config.setRandomColors(false); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
249 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
250 | m_window->updateActions(); |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
251 | m_window->renderer()->refresh(); |
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 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
254 | void ViewToolset::jumpTo() |
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 | bool ok; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
257 | int defval = 0; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
258 | LDObject* obj; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
259 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
260 | if (selectedObjects().size() == 1) |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
261 | defval = selectedObjects()[0]->lineNumber(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
262 | |
1217 | 263 | 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
|
264 | 1, currentDocument()->getObjectCount(), 1, &ok); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
265 | |
1217 | 266 | 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
|
267 | return; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
268 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
269 | currentDocument()->clearSelection(); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
270 | obj->select(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
271 | m_window->updateSelection(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
272 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
273 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
274 | void ViewToolset::randomColors() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
275 | { |
1217 | 276 | config.setRandomColors(not config.randomColors()); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
277 | |
1215 | 278 | if (config.randomColors()) |
1217 | 279 | config.setBfcRedGreenView(false); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
280 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
281 | m_window->updateActions(); |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
282 | m_window->renderer()->refresh(); |
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 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
285 | void ViewToolset::drawSurfaces() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
286 | { |
1217 | 287 | config.setDrawSurfaces(not config.drawSurfaces()); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
288 | m_window->updateActions(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
289 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
290 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
291 | void ViewToolset::drawEdgeLines() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
292 | { |
1217 | 293 | config.setDrawEdgeLines(not config.drawEdgeLines()); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
294 | m_window->updateActions(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
295 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
296 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
297 | void ViewToolset::drawConditionalLines() |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
298 | { |
1217 | 299 | config.setDrawConditionalLines(not config.drawConditionalLines()); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
300 | m_window->updateActions(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
301 | } |