Thu, 04 Jul 2013 18:41:24 +0300
Designerified the replace coordinates action
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1 | /* |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
3 | * Copyright (C) 2013 Santeri Piippo |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
4 | * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
8 | * (at your option) any later version. |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
9 | * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
13 | * GNU General Public License for more details. |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
14 | * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
17 | */ |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
18 | |
199
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
19 | #include <QSpinBox> |
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
20 | #include <QCheckBox> |
202
a027f6fc6141
Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
199
diff
changeset
|
21 | #include <QBoxLayout> |
199
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
22 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include "gui.h" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | #include "common.h" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | #include "file.h" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | #include "colorSelectDialog.h" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | #include "historyDialog.h" |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | #include "misc.h" |
202
a027f6fc6141
Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
199
diff
changeset
|
29 | #include "widgets.h" |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | #include "extprogs.h" |
198
f246725199dc
Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
194
diff
changeset
|
31 | #include "gldraw.h" |
199
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
32 | #include "dialogs.h" |
220
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
33 | #include "colors.h" |
329
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
34 | #include "ui_replcoords.h" |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | |
277
246ca26620ce
Clipboard now stores LDraw code rather than object clones, this seems much less prone to problems
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
36 | vector<str> g_Clipboard; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
38 | cfg (bool, edit_schemanticinline, false); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
41 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | // ============================================================================= |
279
86a325a6b7c7
Renamed Set Contents into Edit LDraw Code; made the add object dialog's comment line box wider
Santeri Piippo <crimsondusk64@gmail.com>
parents:
277
diff
changeset
|
43 | static void copyToClipboard () { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | vector<LDObject*> objs = g_win->sel (); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | // Clear the clipboard first. |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | g_Clipboard.clear (); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | |
277
246ca26620ce
Clipboard now stores LDraw code rather than object clones, this seems much less prone to problems
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
49 | // Now, copy the contents into the clipboard. |
246ca26620ce
Clipboard now stores LDraw code rather than object clones, this seems much less prone to problems
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
50 | for (LDObject* obj : objs) |
246ca26620ce
Clipboard now stores LDraw code rather than object clones, this seems much less prone to problems
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
51 | g_Clipboard << obj->raw (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
52 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
53 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
54 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
55 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
56 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
57 | MAKE_ACTION (cut, "Cut", "cut", "Cut the current selection to clipboard.", CTRL (X)) { |
277
246ca26620ce
Clipboard now stores LDraw code rather than object clones, this seems much less prone to problems
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
58 | copyToClipboard (); |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
59 | g_win->deleteSelection (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
60 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
61 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
62 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
63 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
64 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
65 | MAKE_ACTION (copy, "Copy", "copy", "Copy the current selection to clipboard.", CTRL (C)) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
66 | copyToClipboard (); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
67 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
68 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
69 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
70 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
71 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
72 | MAKE_ACTION (paste, "Paste", "paste", "Paste clipboard contents.", CTRL (V)) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
73 | ulong idx = g_win->getInsertionPoint (); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
74 | g_win->sel ().clear (); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
75 | |
277
246ca26620ce
Clipboard now stores LDraw code rather than object clones, this seems much less prone to problems
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
76 | for (str line : g_Clipboard) { |
246ca26620ce
Clipboard now stores LDraw code rather than object clones, this seems much less prone to problems
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
77 | LDObject* pasted = parseLine (line); |
246ca26620ce
Clipboard now stores LDraw code rather than object clones, this seems much less prone to problems
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
78 | g_curfile->insertObj (idx++, pasted); |
246ca26620ce
Clipboard now stores LDraw code rather than object clones, this seems much less prone to problems
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
79 | g_win->sel () << pasted; |
246ca26620ce
Clipboard now stores LDraw code rather than object clones, this seems much less prone to problems
Santeri Piippo <crimsondusk64@gmail.com>
parents:
276
diff
changeset
|
80 | g_win->R ()->compileObject (pasted); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
81 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
82 | |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
83 | g_win->refresh (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
84 | g_win->scrollToSelection (); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
85 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
86 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
87 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
88 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
89 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
90 | MAKE_ACTION (del, "Delete", "delete", "Delete the selection", KEY (Delete)) { |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
91 | g_win->deleteSelection (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
92 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
93 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
94 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
95 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
96 | // ============================================================================= |
202
a027f6fc6141
Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
199
diff
changeset
|
97 | static void doInline (bool deep) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
98 | vector<LDObject*> sel = g_win->sel (); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
99 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
100 | for (LDObject* obj : sel) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
101 | // Get the index of the subfile so we know where to insert the |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
102 | // inlined contents. |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
103 | long idx = obj->getIndex (g_curfile); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
104 | if (idx == -1) |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
105 | continue; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
106 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
107 | vector<LDObject*> objs; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
108 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
109 | if (obj->getType() == LDObject::Subfile) |
202
a027f6fc6141
Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
199
diff
changeset
|
110 | objs = static_cast<LDSubfile*> (obj)->inlineContents (deep, true); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
111 | else |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
112 | continue; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
113 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
114 | // Merge in the inlined objects |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
115 | for (LDObject* inlineobj : objs) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
116 | // This object is now inlined so it has no parent anymore. |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
117 | inlineobj->setParent (null); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
118 | g_curfile->insertObj (idx++, inlineobj); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
119 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
120 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
121 | // Delete the subfile now as it's been inlined. |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
122 | g_curfile->forgetObject (obj); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
123 | delete obj; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
124 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
125 | |
192
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
126 | g_win->fullRefresh (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
127 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
128 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
129 | MAKE_ACTION (inlineContents, "Inline", "inline", "Inline selected subfiles.", CTRL (I)) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | doInline (false); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
131 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
132 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
133 | MAKE_ACTION (deepInline, "Deep Inline", "inline-deep", "Recursively inline selected subfiles " |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
134 | "down to polygons only.", CTRL_SHIFT (I)) |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
135 | { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
136 | doInline (true); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
137 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
138 | |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
139 | // =============================================================================================== |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
140 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
141 | // =============================================================================================== |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
142 | MAKE_ACTION (splitQuads, "Split Quads", "quad-split", "Split quads into triangles.", (0)) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
143 | vector<LDObject*> objs = g_win->sel (); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
144 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
145 | for (LDObject* obj : objs) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
146 | if (obj->getType() != LDObject::Quad) |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
147 | continue; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
148 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
149 | // Find the index of this quad |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
150 | long index = obj->getIndex (g_curfile); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
151 | |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
152 | if (index == -1) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
153 | return; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
154 | |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
250
diff
changeset
|
155 | vector<LDTriangle*> triangles = static_cast<LDQuad*> (obj)->splitToTriangles (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
156 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
157 | // Replace the quad with the first triangle and add the second triangle |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
158 | // after the first one. |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
159 | g_curfile->setObject (index, triangles[0]); |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
160 | g_curfile->insertObj (index + 1, triangles[1]); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
161 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
162 | // Delete this quad now, it has been split. |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
163 | delete obj; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
164 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
165 | |
192
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
166 | g_win->fullRefresh (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
167 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
168 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
169 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
170 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
171 | // ============================================================================= |
279
86a325a6b7c7
Renamed Set Contents into Edit LDraw Code; made the add object dialog's comment line box wider
Santeri Piippo <crimsondusk64@gmail.com>
parents:
277
diff
changeset
|
172 | MAKE_ACTION (setContents, "Edit LDraw Code", "set-contents", "Edit the LDraw code of this object.", KEY (F9)) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
173 | if (g_win->sel ().size() != 1) |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
174 | return; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
175 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
176 | LDObject* obj = g_win->sel ()[0]; |
199
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
177 | |
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
178 | SetContentsDialog dlg; |
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
179 | dlg.setObject (obj); |
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
180 | if (!dlg.exec ()) |
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
181 | return; |
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
182 | |
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
183 | LDObject* oldobj = obj; |
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
184 | |
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
185 | // Reinterpret it from the text of the input field |
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
186 | obj = parseLine (dlg.text ()); |
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
187 | |
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
188 | oldobj->replace (obj); |
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
189 | |
279
86a325a6b7c7
Renamed Set Contents into Edit LDraw Code; made the add object dialog's comment line box wider
Santeri Piippo <crimsondusk64@gmail.com>
parents:
277
diff
changeset
|
190 | // Refresh |
199
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
191 | g_win->R ()->compileObject (obj); |
10dd5909a50e
Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
198
diff
changeset
|
192 | g_win->refresh (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
193 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
194 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
195 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
196 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
197 | // ============================================================================= |
243
a7c72c847634
Changed shortcut of Set Color to C, like MLCAD
Santeri Piippo <crimsondusk64@gmail.com>
parents:
232
diff
changeset
|
198 | MAKE_ACTION (setColor, "Set Color", "palette", "Set the color on given objects.", KEY (C)) { |
a7c72c847634
Changed shortcut of Set Color to C, like MLCAD
Santeri Piippo <crimsondusk64@gmail.com>
parents:
232
diff
changeset
|
199 | if (g_win->sel ().size () <= 0) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
200 | return; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
201 | |
221
1dd18eea7c84
Add some missing icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
220
diff
changeset
|
202 | short colnum; |
1dd18eea7c84
Add some missing icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
220
diff
changeset
|
203 | short defcol = -1; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
204 | |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
250
diff
changeset
|
205 | vector<LDObject*> objs = g_win->sel (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
206 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
207 | // If all selected objects have the same color, said color is our default |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
208 | // value to the color selection dialog. |
221
1dd18eea7c84
Add some missing icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
220
diff
changeset
|
209 | defcol = g_win->getSelectedColor (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
210 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
211 | // Show the dialog to the user now and ask for a color. |
327
9ea604af1319
Largely reworked the color selector. Still not perfect but is better
Santeri Piippo <crimsondusk64@gmail.com>
parents:
326
diff
changeset
|
212 | if (ColorSelector::getColor (colnum, defcol, g_win)) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
213 | for (LDObject* obj : objs) { |
221
1dd18eea7c84
Add some missing icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
220
diff
changeset
|
214 | if (obj->isColored () == false) |
1dd18eea7c84
Add some missing icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
220
diff
changeset
|
215 | continue; |
1dd18eea7c84
Add some missing icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
220
diff
changeset
|
216 | |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
217 | obj->setColor (colnum); |
221
1dd18eea7c84
Add some missing icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
220
diff
changeset
|
218 | g_win->R ()->compileObject (obj); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
219 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
220 | |
194
cfe9ae5f1124
Fixed coordconv3_2 algorithm, plane drawing works on any of the fixed cameras now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
192
diff
changeset
|
221 | g_win->refresh (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
222 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
223 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
224 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
225 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
226 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
227 | // ============================================================================= |
194
cfe9ae5f1124
Fixed coordconv3_2 algorithm, plane drawing works on any of the fixed cameras now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
192
diff
changeset
|
228 | MAKE_ACTION (makeBorders, "Make Borders", "make-borders", "Add borders around given polygons.", CTRL_SHIFT (B)) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
229 | vector<LDObject*> objs = g_win->sel (); |
326
469bf1fe26e8
applied message log to some actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
230 | int num = 0; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
231 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
232 | for (LDObject* obj : objs) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
233 | if (obj->getType() != LDObject::Quad && obj->getType() != LDObject::Triangle) |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
234 | continue; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
235 | |
194
cfe9ae5f1124
Fixed coordconv3_2 algorithm, plane drawing works on any of the fixed cameras now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
192
diff
changeset
|
236 | short numLines; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
237 | LDLine* lines[4]; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
238 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
239 | if (obj->getType() == LDObject::Quad) { |
194
cfe9ae5f1124
Fixed coordconv3_2 algorithm, plane drawing works on any of the fixed cameras now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
192
diff
changeset
|
240 | numLines = 4; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
241 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
242 | LDQuad* quad = static_cast<LDQuad*> (obj); |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
243 | lines[0] = new LDLine (quad->getVertex (0), quad->getVertex (1)); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
244 | lines[1] = new LDLine (quad->getVertex (1), quad->getVertex (2)); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
245 | lines[2] = new LDLine (quad->getVertex (2), quad->getVertex (3)); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
246 | lines[3] = new LDLine (quad->getVertex (3), quad->getVertex (0)); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
247 | } else { |
194
cfe9ae5f1124
Fixed coordconv3_2 algorithm, plane drawing works on any of the fixed cameras now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
192
diff
changeset
|
248 | numLines = 3; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
249 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
250 | LDTriangle* tri = static_cast<LDTriangle*> (obj); |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
251 | lines[0] = new LDLine (tri->getVertex (0), tri->getVertex (1)); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
252 | lines[1] = new LDLine (tri->getVertex (1), tri->getVertex (2)); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
253 | lines[2] = new LDLine (tri->getVertex (2), tri->getVertex (0)); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
254 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
255 | |
194
cfe9ae5f1124
Fixed coordconv3_2 algorithm, plane drawing works on any of the fixed cameras now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
192
diff
changeset
|
256 | for (short i = 0; i < numLines; ++i) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
257 | ulong idx = obj->getIndex (g_curfile) + i + 1; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
258 | |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
259 | lines[i]->setColor (edgecolor); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
260 | g_curfile->insertObj (idx, lines[i]); |
194
cfe9ae5f1124
Fixed coordconv3_2 algorithm, plane drawing works on any of the fixed cameras now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
192
diff
changeset
|
261 | g_win->R ()->compileObject (lines[i]); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
262 | } |
326
469bf1fe26e8
applied message log to some actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
263 | |
469bf1fe26e8
applied message log to some actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
264 | num += numLines; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
265 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
266 | |
326
469bf1fe26e8
applied message log to some actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
267 | log( ForgeWindow::tr( "Added %1 border lines" ), num ); |
194
cfe9ae5f1124
Fixed coordconv3_2 algorithm, plane drawing works on any of the fixed cameras now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
192
diff
changeset
|
268 | g_win->refresh (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
269 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
270 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
271 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
272 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
273 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
274 | MAKE_ACTION (makeCornerVerts, "Make Corner Vertices", "corner-verts", |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
275 | "Adds vertex objects to the corners of the given polygons", (0)) |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
276 | { |
326
469bf1fe26e8
applied message log to some actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
277 | int num = 0; |
469bf1fe26e8
applied message log to some actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
278 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
279 | for (LDObject* obj : g_win->sel ()) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
280 | if (obj->vertices () < 2) |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
281 | continue; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
282 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
283 | ulong idx = obj->getIndex (g_curfile); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
284 | for (short i = 0; i < obj->vertices(); ++i) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
285 | LDVertex* vert = new LDVertex; |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
286 | vert->pos = obj->getVertex (i); |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
287 | vert->setColor (obj->color ()); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
288 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
289 | g_curfile->insertObj (++idx, vert); |
194
cfe9ae5f1124
Fixed coordconv3_2 algorithm, plane drawing works on any of the fixed cameras now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
192
diff
changeset
|
290 | g_win->R ()->compileObject (vert); |
326
469bf1fe26e8
applied message log to some actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
291 | ++num; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
292 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
293 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
294 | |
326
469bf1fe26e8
applied message log to some actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
295 | log( ForgeWindow::tr( "Added %1 vertices" ), num ); |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
296 | g_win->refresh (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
297 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
298 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
299 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
300 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
301 | // ============================================================================= |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
302 | static void doMoveSelection (const bool up) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
303 | vector<LDObject*> objs = g_win->sel (); |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
304 | LDObject::moveObjects (objs, up); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
305 | g_win->buildObjList (); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
306 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
307 | |
283
c5401af41685
Objects can now be edited by double-clicking on them in the object list view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
279
diff
changeset
|
308 | MAKE_ACTION (moveUp, "Move Up", "arrow-up", "Move the current selection up.", KEY (PageUp)) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
309 | doMoveSelection (true); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
310 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
311 | |
283
c5401af41685
Objects can now be edited by double-clicking on them in the object list view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
279
diff
changeset
|
312 | MAKE_ACTION (moveDown, "Move Down", "arrow-down", "Move the current selection down.", KEY (PageDown)) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
313 | doMoveSelection (false); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
314 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
315 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
316 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
317 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
318 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
319 | MAKE_ACTION (undo, "Undo", "undo", "Undo a step.", CTRL (Z)) { |
274
d232fe4d88a6
Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
271
diff
changeset
|
320 | g_curfile->undo (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
321 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
322 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
323 | MAKE_ACTION (redo, "Redo", "redo", "Redo a step.", CTRL_SHIFT (Z)) { |
274
d232fe4d88a6
Reworked properties a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents:
271
diff
changeset
|
324 | g_curfile->redo (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
325 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
326 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
327 | MAKE_ACTION (showHistory, "Edit History", "history", "Show the history dialog.", (0)) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
328 | HistoryDialog dlg; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
329 | dlg.exec (); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
330 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
331 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
332 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
333 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
334 | // ============================================================================= |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
335 | void doMoveObjects (vertex vect) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
336 | // Apply the grid values |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
337 | vect[X] *= currentGrid ().confs[Grid::X]->value; |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
338 | vect[Y] *= currentGrid ().confs[Grid::Y]->value; |
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
339 | vect[Z] *= currentGrid ().confs[Grid::Z]->value; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
340 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
341 | for (LDObject* obj : g_win->sel ()) { |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
342 | obj->move (vect); |
194
cfe9ae5f1124
Fixed coordconv3_2 algorithm, plane drawing works on any of the fixed cameras now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
192
diff
changeset
|
343 | g_win->R ()->compileObject (obj); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
344 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
345 | |
194
cfe9ae5f1124
Fixed coordconv3_2 algorithm, plane drawing works on any of the fixed cameras now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
192
diff
changeset
|
346 | g_win->refresh (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
347 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
348 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
349 | MAKE_ACTION (moveXNeg, "Move -X", "move-x-neg", "Move selected objects negative on the X axis.", KEY (Left)) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
350 | doMoveObjects ({-1, 0, 0}); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
351 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
352 | |
283
c5401af41685
Objects can now be edited by double-clicking on them in the object list view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
279
diff
changeset
|
353 | MAKE_ACTION (moveYNeg, "Move -Y", "move-y-neg", "Move selected objects negative on the Y axis.", KEY (Home)) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
354 | doMoveObjects ({0, -1, 0}); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
355 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
356 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
357 | MAKE_ACTION (moveZNeg, "Move -Z", "move-z-neg", "Move selected objects negative on the Z axis.", KEY (Down)) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
358 | doMoveObjects ({0, 0, -1}); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
359 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
360 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
361 | MAKE_ACTION (moveXPos, "Move +X", "move-x-pos", "Move selected objects positive on the X axis.", KEY (Right)) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
362 | doMoveObjects ({1, 0, 0}); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
363 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
364 | |
283
c5401af41685
Objects can now be edited by double-clicking on them in the object list view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
279
diff
changeset
|
365 | MAKE_ACTION (moveYPos, "Move +Y", "move-y-pos", "Move selected objects positive on the Y axis.", KEY (End)) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
366 | doMoveObjects ({0, 1, 0}); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
367 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
368 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
369 | MAKE_ACTION (moveZPos, "Move +Z", "move-z-pos", "Move selected objects positive on the Z axis.", KEY (Up)) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
370 | doMoveObjects ({0, 0, 1}); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
371 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
372 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
373 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
374 | MAKE_ACTION (invert, "Invert", "invert", "Reverse the winding of given objects.", CTRL_SHIFT (W)) { |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
250
diff
changeset
|
375 | vector<LDObject*> sel = g_win->sel (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
376 | |
192
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
377 | for (LDObject* obj : sel) { |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
378 | obj->invert (); |
192
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
379 | g_win->R ()->compileObject (obj); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
380 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
381 | |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
382 | g_win->refresh (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
383 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
384 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
385 | // ============================================================================= |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
386 | static void rotateVertex (vertex& v, const vertex& rotpoint, const matrix& transform) { |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
387 | v.move (-rotpoint); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
388 | v.transform (transform, g_origin); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
389 | v.move (rotpoint); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
390 | } |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
391 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
392 | static void doRotate (const short l, const short m, const short n) { |
251
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
250
diff
changeset
|
393 | vector<LDObject*> sel = g_win->sel (); |
c4b96bc41298
Made a vector class which wraps around std::vector... finally I have an operator<< for the thing.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
250
diff
changeset
|
394 | vector<vertex*> queue; |
268
778eed342ee4
Make LDMatrixObject's transform and pos members properties
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
395 | const vertex rotpoint = rotPoint (sel); |
212
79c5205b807c
Fixed: rotation point dialog didn't accept negative custom coords; objects were rotated by the grid angle's half
Santeri Piippo <crimsondusk64@gmail.com>
parents:
211
diff
changeset
|
396 | const double angle = (pi * currentGrid ().confs[Grid::Angle]->value) / 180; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
397 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
398 | // ref: http://en.wikipedia.org/wiki/Transformation_matrix#Rotation_2 |
211
8d35e631bef3
Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
399 | const double cosangle = cos (angle), |
8d35e631bef3
Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
400 | sinangle = sin (angle); |
8d35e631bef3
Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
401 | |
191
9bb6a17305ad
Readded BFC red-green view, although determining inversion isn't always correct and it cannot handle CW-certified files...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
190
diff
changeset
|
402 | matrix transform ({ |
211
8d35e631bef3
Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
403 | (l * l * (1 - cosangle)) + cosangle, |
8d35e631bef3
Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
404 | (m * l * (1 - cosangle)) - (n * sinangle), |
8d35e631bef3
Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
405 | (n * l * (1 - cosangle)) + (m * sinangle), |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
406 | |
211
8d35e631bef3
Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
407 | (l * m * (1 - cosangle)) + (n * sinangle), |
8d35e631bef3
Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
408 | (m * m * (1 - cosangle)) + cosangle, |
8d35e631bef3
Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
409 | (n * m * (1 - cosangle)) - (l * sinangle), |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
410 | |
211
8d35e631bef3
Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
411 | (l * n * (1 - cosangle)) - (m * sinangle), |
8d35e631bef3
Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
412 | (m * n * (1 - cosangle)) + (l * sinangle), |
8d35e631bef3
Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
413 | (n * n * (1 - cosangle)) + cosangle |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
414 | }); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
415 | |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
416 | // Apply the above matrix to everything |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
417 | for (LDObject* obj : sel) { |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
418 | if (obj->vertices ()) { |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
419 | for (short i = 0; i < obj->vertices (); ++i) { |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
420 | vertex v = obj->getVertex (i); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
421 | rotateVertex (v, rotpoint, transform); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
422 | obj->setVertex (i, v); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
423 | } |
319
d0f41342ef51
Show values in file opening prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
424 | } elif (obj->hasMatrix ()) { |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
425 | LDMatrixObject* mo = dynamic_cast<LDMatrixObject*> (obj); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
426 | vertex v = mo->position (); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
427 | rotateVertex (v, rotpoint, transform); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
428 | mo->setPosition (v); |
268
778eed342ee4
Make LDMatrixObject's transform and pos members properties
Santeri Piippo <crimsondusk64@gmail.com>
parents:
266
diff
changeset
|
429 | mo->setTransform (mo->transform () * transform); |
319
d0f41342ef51
Show values in file opening prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents:
312
diff
changeset
|
430 | } elif (obj->getType () == LDObject::Vertex) { |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
431 | LDVertex* vert = static_cast<LDVertex*> (obj); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
432 | vertex v = vert->pos; |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
433 | rotateVertex (v, rotpoint, transform); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
434 | vert->pos = v; |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
435 | } |
194
cfe9ae5f1124
Fixed coordconv3_2 algorithm, plane drawing works on any of the fixed cameras now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
192
diff
changeset
|
436 | |
cfe9ae5f1124
Fixed coordconv3_2 algorithm, plane drawing works on any of the fixed cameras now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
192
diff
changeset
|
437 | g_win->R ()->compileObject (obj); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
438 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
439 | |
194
cfe9ae5f1124
Fixed coordconv3_2 algorithm, plane drawing works on any of the fixed cameras now.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
192
diff
changeset
|
440 | g_win->refresh (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
441 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
442 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
443 | MAKE_ACTION (rotateXPos, "Rotate +X", "rotate-x-pos", "Rotate objects around X axis", CTRL (Right)) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
444 | doRotate (1, 0, 0); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
445 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
446 | |
283
c5401af41685
Objects can now be edited by double-clicking on them in the object list view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
279
diff
changeset
|
447 | MAKE_ACTION (rotateYPos, "Rotate +Y", "rotate-y-pos", "Rotate objects around Y axis", CTRL (End)) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
448 | doRotate (0, 1, 0); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
449 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
450 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
451 | MAKE_ACTION (rotateZPos, "Rotate +Z", "rotate-z-pos", "Rotate objects around Z axis", CTRL (Up)) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
452 | doRotate (0, 0, 1); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
453 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
454 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
455 | MAKE_ACTION (rotateXNeg, "Rotate -X", "rotate-x-neg", "Rotate objects around X axis", CTRL (Left)) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
456 | doRotate (-1, 0, 0); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
457 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
458 | |
283
c5401af41685
Objects can now be edited by double-clicking on them in the object list view
Santeri Piippo <crimsondusk64@gmail.com>
parents:
279
diff
changeset
|
459 | MAKE_ACTION (rotateYNeg, "Rotate -Y", "rotate-y-neg", "Rotate objects around Y axis", CTRL (Home)) { |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
460 | doRotate (0, -1, 0); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
461 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
462 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
463 | MAKE_ACTION (rotateZNeg, "Rotate -Z", "rotate-z-neg", "Rotate objects around Z axis", CTRL (Down)) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
464 | doRotate (0, 0, -1); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
465 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
466 | |
211
8d35e631bef3
Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
467 | // ========================================================================================================================================= |
8d35e631bef3
Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
468 | MAKE_ACTION (rotpoint, "Set Rotation Point", "rotpoint", "Configure the rotation point.", (0)) { |
8d35e631bef3
Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
469 | configRotationPoint (); |
8d35e631bef3
Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
470 | } |
8d35e631bef3
Added dialog for rotation points
Santeri Piippo <crimsondusk64@gmail.com>
parents:
205
diff
changeset
|
471 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
472 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
473 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
474 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
475 | MAKE_ACTION (roundCoords, "Round Coordinates", "round-coords", "Round coordinates down to 3/4 decimals", (0)) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
476 | setlocale (LC_ALL, "C"); |
326
469bf1fe26e8
applied message log to some actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
477 | int num = 0; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
478 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
479 | for (LDObject* obj : g_win->sel ()) |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
480 | for (short i = 0; i < obj->vertices (); ++i) { |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
481 | vertex v = obj->getVertex (i); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
482 | |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
283
diff
changeset
|
483 | for (const Axis ax : g_Axes) { |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
283
diff
changeset
|
484 | // HACK: :p |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
283
diff
changeset
|
485 | char valstr[64]; |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
283
diff
changeset
|
486 | sprintf (valstr, "%.3f", v[ax]); |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
283
diff
changeset
|
487 | v[ax] = atof (valstr); |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
283
diff
changeset
|
488 | } |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
489 | |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
490 | obj->setVertex (i, v); |
326
469bf1fe26e8
applied message log to some actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
491 | num += 3; |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
492 | } |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
493 | |
326
469bf1fe26e8
applied message log to some actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
494 | log( ForgeWindow::tr( "Rounded %1 coordinates" ), num ); |
192
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
495 | g_win->fullRefresh (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
496 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
497 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
498 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
499 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
500 | // ============================================================================= |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
501 | MAKE_ACTION (uncolorize, "Uncolorize", "uncolorize", "Reduce colors of everything selected to main and edge colors", (0)) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
502 | for (LDObject* obj : g_win->sel ()) { |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
503 | if (obj->isColored () == false) |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
504 | continue; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
505 | |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
506 | obj->setColor ((obj->getType () == LDObject::Line || obj->getType () == LDObject::CondLine) ? edgecolor : maincolor); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
507 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
508 | |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
509 | g_win->fullRefresh (); |
184
fae3bc9ce319
Move external prog actions into gui_actions.cpp because linking order changed
Santeri Piippo <crimsondusk64@gmail.com>
parents:
183
diff
changeset
|
510 | } |
fae3bc9ce319
Move external prog actions into gui_actions.cpp because linking order changed
Santeri Piippo <crimsondusk64@gmail.com>
parents:
183
diff
changeset
|
511 | |
fae3bc9ce319
Move external prog actions into gui_actions.cpp because linking order changed
Santeri Piippo <crimsondusk64@gmail.com>
parents:
183
diff
changeset
|
512 | // ============================================================================= |
fae3bc9ce319
Move external prog actions into gui_actions.cpp because linking order changed
Santeri Piippo <crimsondusk64@gmail.com>
parents:
183
diff
changeset
|
513 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
fae3bc9ce319
Move external prog actions into gui_actions.cpp because linking order changed
Santeri Piippo <crimsondusk64@gmail.com>
parents:
183
diff
changeset
|
514 | // ============================================================================= |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
515 | MAKE_ACTION (ytruder, "Ytruder", "ytruder", "Extrude selected lines to a given plane", (0)) { |
184
fae3bc9ce319
Move external prog actions into gui_actions.cpp because linking order changed
Santeri Piippo <crimsondusk64@gmail.com>
parents:
183
diff
changeset
|
516 | runYtruder (); |
fae3bc9ce319
Move external prog actions into gui_actions.cpp because linking order changed
Santeri Piippo <crimsondusk64@gmail.com>
parents:
183
diff
changeset
|
517 | } |
fae3bc9ce319
Move external prog actions into gui_actions.cpp because linking order changed
Santeri Piippo <crimsondusk64@gmail.com>
parents:
183
diff
changeset
|
518 | |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
519 | MAKE_ACTION (rectifier, "Rectifier", "rectifier", "Optimizes quads into rect primitives.", (0)) { |
184
fae3bc9ce319
Move external prog actions into gui_actions.cpp because linking order changed
Santeri Piippo <crimsondusk64@gmail.com>
parents:
183
diff
changeset
|
520 | runRectifier (); |
fae3bc9ce319
Move external prog actions into gui_actions.cpp because linking order changed
Santeri Piippo <crimsondusk64@gmail.com>
parents:
183
diff
changeset
|
521 | } |
fae3bc9ce319
Move external prog actions into gui_actions.cpp because linking order changed
Santeri Piippo <crimsondusk64@gmail.com>
parents:
183
diff
changeset
|
522 | |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
523 | MAKE_ACTION (intersector, "Intersector", "intersector", "Perform clipping between two input groups.", (0)) { |
184
fae3bc9ce319
Move external prog actions into gui_actions.cpp because linking order changed
Santeri Piippo <crimsondusk64@gmail.com>
parents:
183
diff
changeset
|
524 | runIntersector (); |
189
ac2d3e8dd110
Rewrote the string class with a simpler version. The old one was more than probably leaking water like a boat with an elephant on board...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
188
diff
changeset
|
525 | } |
ac2d3e8dd110
Rewrote the string class with a simpler version. The old one was more than probably leaking water like a boat with an elephant on board...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
188
diff
changeset
|
526 | |
203
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
527 | MAKE_ACTION (coverer, "Coverer", "coverer", "Fill the space between two line shapes", (0)) { |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
528 | runCoverer (); |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
529 | } |
ccde5e88f0b6
Added Coverer interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
530 | |
205
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
531 | MAKE_ACTION (isecalc, "Isecalc", "isecalc", "Compute intersection between objects", (0)) { |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
532 | runIsecalc (); |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
533 | } |
d60cf73fb164
Added Isecalc interface
Santeri Piippo <crimsondusk64@gmail.com>
parents:
203
diff
changeset
|
534 | |
262
56f8987f4c7c
Fixed behavior of mid-button vertex selector, add ability to all-replace and relative moving to replace coords
Santeri Piippo <crimsondusk64@gmail.com>
parents:
254
diff
changeset
|
535 | // ============================================================================= |
329
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
536 | MAKE_ACTION( replaceCoords, "Replace Coordinates", "replace-coords", "Find and replace coordinate values", CTRL( R )) |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
537 | { |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
538 | QDialog* dlg = new QDialog( g_win ); |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
539 | Ui::ReplaceCoordsUI ui; |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
540 | ui.setupUi( dlg ); |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
541 | |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
542 | if( !dlg->exec() ) |
190
82f784cf2ce5
Added tool for replacing coordinate values
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
543 | return; |
329
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
544 | |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
545 | const double search = ui.search->value(), |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
546 | replacement = ui.replacement->value(); |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
547 | const bool any = ui.any->isChecked(), |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
548 | rel = ui.relative->isChecked(); |
190
82f784cf2ce5
Added tool for replacing coordinate values
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
549 | |
329
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
550 | vector<Axis> sel; |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
551 | int num = 0; |
262
56f8987f4c7c
Fixed behavior of mid-button vertex selector, add ability to all-replace and relative moving to replace coords
Santeri Piippo <crimsondusk64@gmail.com>
parents:
254
diff
changeset
|
552 | |
329
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
553 | if( ui.x->isChecked() ) sel << X; |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
554 | if( ui.y->isChecked() ) sel << Y; |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
555 | if( ui.z->isChecked() ) sel << Z; |
190
82f784cf2ce5
Added tool for replacing coordinate values
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
556 | |
329
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
557 | for( LDObject * obj : g_win->sel() ) |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
558 | for( short i = 0; i < obj->vertices(); ++i ) |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
559 | { |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
560 | vertex v = obj->getVertex( i ); |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
561 | |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
562 | for( Axis ax : sel ) |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
563 | { |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
564 | double& coord = v[ax]; |
202
a027f6fc6141
Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
199
diff
changeset
|
565 | |
329
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
566 | if( any || coord == search ) |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
567 | { |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
568 | if( !rel ) |
262
56f8987f4c7c
Fixed behavior of mid-button vertex selector, add ability to all-replace and relative moving to replace coords
Santeri Piippo <crimsondusk64@gmail.com>
parents:
254
diff
changeset
|
569 | coord = 0; |
56f8987f4c7c
Fixed behavior of mid-button vertex selector, add ability to all-replace and relative moving to replace coords
Santeri Piippo <crimsondusk64@gmail.com>
parents:
254
diff
changeset
|
570 | |
56f8987f4c7c
Fixed behavior of mid-button vertex selector, add ability to all-replace and relative moving to replace coords
Santeri Piippo <crimsondusk64@gmail.com>
parents:
254
diff
changeset
|
571 | coord += replacement; |
329
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
572 | num++; |
262
56f8987f4c7c
Fixed behavior of mid-button vertex selector, add ability to all-replace and relative moving to replace coords
Santeri Piippo <crimsondusk64@gmail.com>
parents:
254
diff
changeset
|
573 | } |
190
82f784cf2ce5
Added tool for replacing coordinate values
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
574 | } |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
575 | |
329
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
576 | obj->setVertex( i, v ); |
192
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
577 | } |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
578 | |
329
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
579 | log( ForgeWindow::tr( "Altered %1 values" ), num ); |
76db02dc7f60
Designerified the replace coordinates action
Santeri Piippo <crimsondusk64@gmail.com>
parents:
327
diff
changeset
|
580 | g_win->fullRefresh(); |
192
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
581 | } |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
582 | |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
583 | // ================================================================================================= |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
584 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
585 | // ================================================================================================= |
192
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
586 | class FlipDialog : public QDialog { |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
587 | public: |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
588 | explicit FlipDialog (QWidget* parent = 0, Qt::WindowFlags f = 0) : QDialog (parent, f) { |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
589 | cbg_axes = makeAxesBox (); |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
590 | |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
591 | QVBoxLayout* layout = new QVBoxLayout; |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
592 | layout->addWidget (cbg_axes); |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
593 | layout->addWidget (makeButtonBox (*this)); |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
594 | setLayout (layout); |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
595 | } |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
596 | |
202
a027f6fc6141
Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
199
diff
changeset
|
597 | vector<int> axes () { return cbg_axes->checkedValues (); } |
192
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
598 | |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
599 | private: |
202
a027f6fc6141
Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
199
diff
changeset
|
600 | CheckBoxGroup* cbg_axes; |
192
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
601 | }; |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
602 | |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
603 | // ================================================================================================ |
192
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
604 | MAKE_ACTION (flip, "Flip", "flip", "Flip coordinates", CTRL_SHIFT (F)) { |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
605 | FlipDialog dlg; |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
606 | |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
607 | if (!dlg.exec ()) |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
608 | return; |
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
609 | |
202
a027f6fc6141
Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
199
diff
changeset
|
610 | vector<int> sel = dlg.axes (); |
192
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
611 | |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
612 | for (LDObject* obj : g_win->sel ()) |
276
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
613 | for (short i = 0; i < obj->vertices (); ++i) { |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
614 | vertex v = obj->getVertex (i); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
615 | |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
616 | for (int ax : sel) |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
617 | v[(Axis) ax] *= -1; |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
618 | |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
619 | obj->setVertex (i, v); |
a21e49914264
Made history work with most things
Santeri Piippo <crimsondusk64@gmail.com>
parents:
274
diff
changeset
|
620 | } |
190
82f784cf2ce5
Added tool for replacing coordinate values
Santeri Piippo <crimsondusk64@gmail.com>
parents:
189
diff
changeset
|
621 | |
192
c414924a647c
Split inverting into methods into LDObject and its subclasses, fixed a rather severe memory leak issue (GL display lists weren't being removed properly)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
191
diff
changeset
|
622 | g_win->fullRefresh (); |
214
28e0b37156be
Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
212
diff
changeset
|
623 | } |
28e0b37156be
Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
212
diff
changeset
|
624 | |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
625 | // ================================================================================================ |
214
28e0b37156be
Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
212
diff
changeset
|
626 | MAKE_ACTION (demote, "Demote conditional lines", "demote", "Demote conditional lines down to normal lines.", (0)) { |
28e0b37156be
Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
212
diff
changeset
|
627 | vector<LDObject*> sel = g_win->sel (); |
326
469bf1fe26e8
applied message log to some actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
628 | int num = 0; |
469bf1fe26e8
applied message log to some actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
629 | |
214
28e0b37156be
Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
212
diff
changeset
|
630 | for (LDObject* obj : sel) { |
28e0b37156be
Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
212
diff
changeset
|
631 | if (obj->getType () != LDObject::CondLine) |
28e0b37156be
Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
212
diff
changeset
|
632 | continue; |
28e0b37156be
Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
212
diff
changeset
|
633 | |
28e0b37156be
Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
212
diff
changeset
|
634 | LDLine* repl = static_cast<LDCondLine*> (obj)->demote (); |
28e0b37156be
Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
212
diff
changeset
|
635 | g_win->R ()->compileObject (repl); |
326
469bf1fe26e8
applied message log to some actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
636 | ++num; |
214
28e0b37156be
Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
212
diff
changeset
|
637 | } |
28e0b37156be
Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
212
diff
changeset
|
638 | |
326
469bf1fe26e8
applied message log to some actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
639 | log( ForgeWindow::tr( "Demoted %1 conditional lines" ), num ); |
214
28e0b37156be
Added demote function for making conditional lines normal lines
Santeri Piippo <crimsondusk64@gmail.com>
parents:
212
diff
changeset
|
640 | g_win->refresh (); |
220
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
641 | } |
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
642 | |
265
955c0aabfebf
Purged out the old history code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
262
diff
changeset
|
643 | // ================================================================================================= |
220
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
644 | static bool isColorUsed (short colnum) { |
250
6e80f038e8df
Make LDOpenFile's members PROPERTIES
Santeri Piippo <crimsondusk64@gmail.com>
parents:
243
diff
changeset
|
645 | for (LDObject* obj : g_curfile->objs ()) |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
646 | if (obj->isColored () && obj->color () == colnum) |
220
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
647 | return true; |
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
648 | |
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
649 | return false; |
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
650 | } |
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
651 | |
221
1dd18eea7c84
Add some missing icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
220
diff
changeset
|
652 | MAKE_ACTION (autoColor, "Autocolor", "autocolor", "Set the color of the given object to the first found unused color.", (0)) { |
220
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
653 | short colnum = 0; |
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
654 | |
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
655 | while (colnum < 512 && (getColor (colnum) == null || isColorUsed (colnum))) |
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
656 | colnum++; |
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
657 | |
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
658 | if (colnum >= 512) { |
321
48e429bfd58c
Apply tr() for possible future translations
Santeri Piippo <crimsondusk64@gmail.com>
parents:
319
diff
changeset
|
659 | //: Auto-colorer error message |
326
469bf1fe26e8
applied message log to some actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
660 | critical( ForgeWindow::tr( "Out of unused colors! What are you doing?!" )); |
220
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
661 | return; |
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
662 | } |
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
663 | |
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
664 | for (LDObject* obj : g_win->sel ()) { |
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
665 | if (obj->isColored () == false) |
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
666 | continue; |
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
667 | |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
668 | obj->setColor (colnum); |
220
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
669 | g_win->R ()->compileObject (obj); |
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
670 | } |
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
671 | |
326
469bf1fe26e8
applied message log to some actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
672 | log( ForgeWindow::tr( "Auto-colored: new color is [%1] %2" ), colnum, getColor( colnum )->name ); |
469bf1fe26e8
applied message log to some actions
Santeri Piippo <crimsondusk64@gmail.com>
parents:
321
diff
changeset
|
673 | |
220
1f368f0a323b
Added auto-coloring, this colors objects with the first found unused color
Santeri Piippo <crimsondusk64@gmail.com>
parents:
215
diff
changeset
|
674 | g_win->refresh (); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
675 | } |