Tue, 19 Mar 2013 21:52:38 +0200
Begin work on dialogs for adding objects. Comments functional!
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
1 | /* |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
2 | * LDForge: LDraw parts authoring CAD |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
3 | * Copyright (C) 2013 Santeri `arezey` Piippo |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
4 | * |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
5 | * This program is free software: you can redistribute it and/or modify |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
6 | * it under the terms of the GNU General Public License as published by |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
7 | * the Free Software Foundation, either version 3 of the License, or |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
8 | * (at your option) any later version. |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
9 | * |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
10 | * This program is distributed in the hope that it will be useful, |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
13 | * GNU General Public License for more details. |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
14 | * |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
15 | * You should have received a copy of the GNU General Public License |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
17 | */ |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
18 | |
0 | 19 | #include <QtGui> |
20 | ||
21 | #include "common.h" | |
26
83184d9407c7
Renamed io.cpp to file.cpp, draw.cpp to gldraw.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
22 | #include "gldraw.h" |
0 | 23 | #include "gui.h" |
26
83184d9407c7
Renamed io.cpp to file.cpp, draw.cpp to gldraw.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents:
25
diff
changeset
|
24 | #include "file.h" |
0 | 25 | |
14
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
26 | #include "zz_setContentsDialog.h" |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
27 | #include "zz_configDialog.h" |
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
38
diff
changeset
|
28 | #include "zz_addObjectDialog.h" |
14
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
29 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
30 | #define MAKE_ACTION(OBJECT, DISPLAYNAME, IMAGENAME, DESCR) \ |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
31 | qAct_##OBJECT = new QAction (QIcon ("./icons/" IMAGENAME ".png"), tr (DISPLAYNAME), this); \ |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
32 | qAct_##OBJECT->setStatusTip (tr (DESCR)); \ |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
33 | connect (qAct_##OBJECT, SIGNAL (triggered ()), this, SLOT (slot_##OBJECT ())); |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
34 | |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
35 | // ============================================================================= |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
36 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
37 | // ============================================================================= |
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
38 | ForgeWindow::ForgeWindow () { |
0 | 39 | R = new renderer; |
40 | ||
41 | qObjList = new QTreeWidget; | |
42 | qObjList->setHeaderHidden (true); | |
43 | qObjList->setMaximumWidth (256); | |
14
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
44 | qObjList->setSelectionMode (QTreeWidget::MultiSelection); |
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
45 | connect (qObjList, SIGNAL (itemSelectionChanged ()), this, SLOT (slot_selectionChanged ())); |
0 | 46 | |
47 | qMessageLog = new QTextEdit; | |
48 | qMessageLog->setReadOnly (true); | |
49 | qMessageLog->setMaximumHeight (96); | |
50 | ||
51 | QWidget* w = new QWidget; | |
52 | QGridLayout* layout = new QGridLayout; | |
53 | layout->setColumnMinimumWidth (0, 192); | |
54 | layout->setColumnStretch (0, 1); | |
55 | layout->addWidget (R, 0, 0); | |
56 | layout->addWidget (qObjList, 0, 1); | |
57 | layout->addWidget (qMessageLog, 1, 0, 1, 2); | |
58 | w->setLayout (layout); | |
59 | setCentralWidget (w); | |
60 | ||
61 | createMenuActions (); | |
62 | createMenus (); | |
63 | createToolbars (); | |
64 | ||
22
335e430a6b4f
So much for that pointer class, caused more problems than it solved. For instance splitting a second quad after a first one had been split would trigger a peculiar crash...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
21
diff
changeset
|
65 | slot_selectionChanged (); |
335e430a6b4f
So much for that pointer class, caused more problems than it solved. For instance splitting a second quad after a first one had been split would trigger a peculiar crash...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
21
diff
changeset
|
66 | |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
67 | setWindowIcon (QIcon ("icons/ldforge.png")); |
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
68 | setTitle (); |
0 | 69 | setMinimumSize (320, 200); |
70 | resize (800, 600); | |
71 | } | |
72 | ||
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
73 | // ============================================================================= |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
74 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
75 | // ============================================================================= |
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
76 | void ForgeWindow::createMenuActions () { |
0 | 77 | // Long menu names go here so my cool action definition table doesn't get out of proportions |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
78 | char const* sNewCdLineText = "New Conditional Line", |
0 | 79 | *sNewQuadText = "New Quadrilateral", |
80 | *sAboutText = "About " APPNAME_DISPLAY; | |
81 | ||
82 | MAKE_ACTION (new, "&New", "file-new", "Create a new part model.") | |
5
727e02d6b87a
rename file-specific icons to file-*
Santeri Piippo <crimsondusk64@gmail.com>
parents:
4
diff
changeset
|
83 | MAKE_ACTION (open, "&Open", "file-open", "Load a part model from a file.") |
727e02d6b87a
rename file-specific icons to file-*
Santeri Piippo <crimsondusk64@gmail.com>
parents:
4
diff
changeset
|
84 | MAKE_ACTION (save, "&Save", "file-save", "Save the part model.") |
727e02d6b87a
rename file-specific icons to file-*
Santeri Piippo <crimsondusk64@gmail.com>
parents:
4
diff
changeset
|
85 | MAKE_ACTION (saveAs, "Save &As", "file-save-as", "Save the part to a specific file.") |
0 | 86 | MAKE_ACTION (exit, "&Exit", "exit", "Close " APPNAME_DISPLAY ".") |
87 | ||
88 | MAKE_ACTION (cut, "Cut", "cut", "Cut the current selection to clipboard.") | |
89 | MAKE_ACTION (copy, "Copy", "copy", "Copy the current selection to clipboard.") | |
90 | MAKE_ACTION (paste, "Paste", "paste", "Paste clipboard contents.") | |
91 | ||
24
d2d4d0154338
added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
23
diff
changeset
|
92 | MAKE_ACTION (inline, "Inline", "inline", "Inline selected subfiles.") |
21
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
93 | MAKE_ACTION (splitQuads, "Split Quads", "quad-split", "Split quads into triangles.") |
14
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
94 | MAKE_ACTION (setContents, "Set Contents", "set-contents", "Set the raw code of this object.") |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
95 | |
0 | 96 | MAKE_ACTION (newSubfile, "New Subfile", "add-subfile", "Creates a new subfile reference.") |
97 | MAKE_ACTION (newLine, "New Line", "add-line", "Creates a new line.") | |
98 | MAKE_ACTION (newTriangle, "New Triangle", "add-triangle", "Creates a new triangle.") | |
99 | MAKE_ACTION (newQuad, sNewQuadText, "add-quad", "Creates a new quadrilateral.") | |
100 | MAKE_ACTION (newCondLine, sNewCdLineText, "add-condline", "Creates a new conditional line."); | |
101 | MAKE_ACTION (newComment, "New Comment", "add-comment", "Creates a new comment."); | |
102 | MAKE_ACTION (newVector, "New Vector", "add-vector", "Creates a new vector.") | |
103 | MAKE_ACTION (newVertex, "New Vertex", "add-vertex", "Creates a new vertex.") | |
104 | ||
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
105 | MAKE_ACTION (settings, "Settings", "settings", "Edit the settings of " APPNAME_DISPLAY ".") |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
106 | |
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
107 | MAKE_ACTION (help, "Help", "help", "Shows the " APPNAME_DISPLAY " help manual.") |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
108 | MAKE_ACTION (about, sAboutText, "ldforge", "Shows information about " APPNAME_DISPLAY ".") |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
109 | MAKE_ACTION (aboutQt, "About Qt", "aboutQt", "Shows information about Qt.") |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
110 | |
0 | 111 | // Keyboard shortcuts |
112 | qAct_new->setShortcut (Qt::CTRL | Qt::Key_N); | |
113 | qAct_open->setShortcut (Qt::CTRL | Qt::Key_O); | |
114 | qAct_save->setShortcut (Qt::CTRL | Qt::Key_S); | |
115 | qAct_saveAs->setShortcut (Qt::CTRL | Qt::SHIFT | Qt::Key_S); | |
116 | ||
117 | qAct_cut->setShortcut (Qt::CTRL | Qt::Key_X); | |
118 | qAct_copy->setShortcut (Qt::CTRL | Qt::Key_C); | |
119 | qAct_paste->setShortcut (Qt::CTRL | Qt::Key_V); | |
120 | ||
121 | // things not implemented yet | |
122 | QAction* qaDisabledActions[] = { | |
123 | qAct_newSubfile, | |
124 | qAct_newVector, | |
125 | qAct_newVertex, | |
126 | qAct_cut, | |
127 | qAct_copy, | |
128 | qAct_paste, | |
24
d2d4d0154338
added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
23
diff
changeset
|
129 | qAct_about, |
d2d4d0154338
added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
23
diff
changeset
|
130 | qAct_inline, |
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
131 | qAct_help, |
0 | 132 | }; |
133 | ||
134 | for (ushort i = 0; i < sizeof qaDisabledActions / sizeof *qaDisabledActions; ++i) | |
135 | qaDisabledActions[i]->setEnabled (false); | |
136 | } | |
137 | ||
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
138 | // ============================================================================= |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
139 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
140 | // ============================================================================= |
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
141 | void ForgeWindow::createMenus () { |
0 | 142 | // File menu |
143 | qFileMenu = menuBar ()->addMenu (tr ("&File")); | |
144 | qFileMenu->addAction (qAct_new); // New | |
145 | qFileMenu->addAction (qAct_open); // Open | |
146 | qFileMenu->addAction (qAct_save); // Save | |
147 | qFileMenu->addAction (qAct_saveAs); // Save As | |
148 | qFileMenu->addSeparator (); // ------- | |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
149 | qFileMenu->addAction (qAct_settings); // Settings |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
150 | qFileMenu->addSeparator (); // ------- |
0 | 151 | qFileMenu->addAction (qAct_exit); // Exit |
152 | ||
153 | // Edit menu | |
154 | qInsertMenu = menuBar ()->addMenu (tr ("&Insert")); | |
155 | qInsertMenu->addAction (qAct_newSubfile); // New Subfile | |
156 | qInsertMenu->addAction (qAct_newLine); // New Line | |
157 | qInsertMenu->addAction (qAct_newTriangle); // New Triangle | |
158 | qInsertMenu->addAction (qAct_newQuad); // New Quad | |
159 | qInsertMenu->addAction (qAct_newCondLine); // New Conditional Line | |
160 | qInsertMenu->addAction (qAct_newComment); // New Comment | |
161 | qInsertMenu->addAction (qAct_newVector); // New Vector | |
162 | qInsertMenu->addAction (qAct_newVertex); // New Vertex | |
163 | ||
164 | qEditMenu = menuBar ()->addMenu (tr ("&Edit")); | |
165 | qEditMenu->addAction (qAct_cut); // Cut | |
166 | qEditMenu->addAction (qAct_copy); // Copy | |
167 | qEditMenu->addAction (qAct_paste); // Paste | |
14
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
168 | qEditMenu->addSeparator (); // ----- |
24
d2d4d0154338
added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
23
diff
changeset
|
169 | qEditMenu->addAction (qAct_inline); // Inline |
21
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
170 | qEditMenu->addAction (qAct_splitQuads); // Split Quads |
14
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
171 | qEditMenu->addAction (qAct_setContents); // Set Contents |
0 | 172 | |
173 | // Help menu | |
174 | qHelpMenu = menuBar ()->addMenu (tr ("&Help")); | |
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
175 | qHelpMenu->addAction (qAct_help); // Help |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
176 | qHelpMenu->addSeparator (); // ----- |
0 | 177 | qHelpMenu->addAction (qAct_about); // About |
178 | qHelpMenu->addAction (qAct_aboutQt); // About Qt | |
179 | } | |
180 | ||
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
181 | // ============================================================================= |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
182 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
183 | // ============================================================================= |
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
184 | void ForgeWindow::createToolbars () { |
0 | 185 | qFileToolBar = new QToolBar ("File"); |
186 | qFileToolBar->addAction (qAct_new); | |
187 | qFileToolBar->addAction (qAct_open); | |
188 | qFileToolBar->addAction (qAct_save); | |
189 | qFileToolBar->addAction (qAct_saveAs); | |
190 | addToolBar (qFileToolBar); | |
191 | ||
192 | qInsertToolBar = new QToolBar ("Insert"); | |
193 | qInsertToolBar->addAction (qAct_newSubfile); | |
194 | qInsertToolBar->addAction (qAct_newLine); | |
195 | qInsertToolBar->addAction (qAct_newTriangle); | |
196 | qInsertToolBar->addAction (qAct_newQuad); | |
197 | qInsertToolBar->addAction (qAct_newCondLine); | |
198 | qInsertToolBar->addAction (qAct_newComment); | |
199 | qInsertToolBar->addAction (qAct_newVector); | |
200 | qInsertToolBar->addAction (qAct_newVertex); | |
201 | addToolBar (qInsertToolBar); | |
202 | ||
203 | qEditToolBar = new QToolBar ("Edit"); | |
204 | qEditToolBar->addAction (qAct_cut); | |
205 | qEditToolBar->addAction (qAct_copy); | |
206 | qEditToolBar->addAction (qAct_paste); | |
24
d2d4d0154338
added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
23
diff
changeset
|
207 | qEditToolBar->addAction (qAct_inline); |
21
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
208 | qEditToolBar->addAction (qAct_splitQuads); |
14
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
209 | qEditToolBar->addAction (qAct_setContents); |
0 | 210 | addToolBar (qEditToolBar); |
211 | } | |
212 | ||
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
213 | // ============================================================================= |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
214 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
215 | // ============================================================================= |
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
216 | void ForgeWindow::setTitle () { |
7
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
217 | str zTitle = APPNAME_DISPLAY " v" VERSION_STRING; |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
218 | |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
219 | // Append our current file if we have one |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
220 | if (g_CurrentFile) { |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
221 | zTitle.appendformat (": %s", basename (g_CurrentFile->zFileName.chars())); |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
222 | |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
223 | if (g_CurrentFile->objects.size() > 0 && |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
224 | g_CurrentFile->objects[0]->getType() == OBJ_Comment) |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
225 | { |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
226 | // Append title |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
227 | LDComment* comm = static_cast<LDComment*> (g_CurrentFile->objects[0]); |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
228 | zTitle.appendformat (":%s", comm->zText.chars()); |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
229 | } |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
230 | } |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
231 | |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
232 | setWindowTitle (zTitle.chars()); |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
233 | } |
098e3c4949c6
Set window title dynamically based on filename
Santeri Piippo <crimsondusk64@gmail.com>
parents:
5
diff
changeset
|
234 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
235 | // ============================================================================= |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
236 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
237 | // ============================================================================= |
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
238 | void ForgeWindow::slot_new () { |
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
239 | newFile (); |
0 | 240 | } |
241 | ||
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
242 | void ForgeWindow::slot_open () { |
28
208adc847377
added Save As function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
243 | str zName; |
208adc847377
added Save As function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
244 | zName += QFileDialog::getOpenFileName (this, "Open File", |
208adc847377
added Save As function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
245 | "", "LDraw files (*.dat *.ldr)"); |
0 | 246 | |
28
208adc847377
added Save As function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
247 | if (~zName) |
208adc847377
added Save As function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
248 | openMainFile (zName); |
0 | 249 | } |
250 | ||
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
251 | void ForgeWindow::slot_save () { |
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
252 | g_CurrentFile->save (); |
0 | 253 | } |
254 | ||
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
255 | void ForgeWindow::slot_saveAs () { |
28
208adc847377
added Save As function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
256 | str zName; |
208adc847377
added Save As function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
257 | zName += QFileDialog::getSaveFileName (this, "Save As", |
208adc847377
added Save As function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
258 | "", "LDraw files (*.dat *.ldr)"); |
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
259 | |
28
208adc847377
added Save As function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
260 | if (~zName && g_CurrentFile->save (zName)) |
208adc847377
added Save As function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
26
diff
changeset
|
261 | g_CurrentFile->zFileName = zName; |
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
262 | } |
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
263 | |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
264 | void ForgeWindow::slot_settings () { |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
265 | ConfigDialog::staticDialog (this); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
266 | } |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
267 | |
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
268 | void ForgeWindow::slot_exit () { |
0 | 269 | exit (0); |
270 | } | |
271 | ||
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
272 | void ForgeWindow::slot_newSubfile () { |
0 | 273 | |
274 | } | |
275 | ||
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
276 | void ForgeWindow::slot_newLine () { |
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
277 | LDLine* line = new LDLine; |
0 | 278 | |
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
279 | memset (line->vaCoords, 0, sizeof line->vaCoords); |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
280 | line->dColor = 24; |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
281 | |
38
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
282 | g_CurrentFile->addObject (line); |
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
283 | refresh (); |
0 | 284 | } |
285 | ||
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
286 | void ForgeWindow::slot_newTriangle () { |
38
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
287 | LDTriangle* tri = new LDTriangle; |
0 | 288 | |
38
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
289 | memset (tri->vaCoords, 0, sizeof tri->vaCoords); |
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
290 | tri->dColor = 16; |
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
291 | |
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
292 | g_CurrentFile->addObject (tri); |
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
293 | refresh (); |
0 | 294 | } |
295 | ||
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
296 | void ForgeWindow::slot_newQuad () { |
38
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
297 | LDQuad* quad = new LDQuad; |
0 | 298 | |
38
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
299 | memset (quad->vaCoords, 0, sizeof quad->vaCoords); |
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
300 | quad->dColor = 16; |
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
301 | |
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
302 | g_CurrentFile->addObject (quad); |
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
303 | refresh (); |
0 | 304 | } |
305 | ||
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
306 | void ForgeWindow::slot_newCondLine () { |
38
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
307 | LDCondLine* line = new LDCondLine; |
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
308 | |
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
309 | memset (line->vaCoords, 0, sizeof line->vaCoords); |
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
310 | memset (line->vaControl, 0, sizeof line->vaControl); |
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
311 | line->dColor = 24; |
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
312 | |
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
313 | g_CurrentFile->addObject (line); |
20f5eaae8425
Implemented insertion of triangles, quads, condlines and comments
Santeri Piippo <crimsondusk64@gmail.com>
parents:
32
diff
changeset
|
314 | refresh (); |
0 | 315 | } |
316 | ||
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
317 | void ForgeWindow::slot_newComment () { |
39
110669124caf
Begin work on dialogs for adding objects. Comments functional!
Santeri Piippo <crimsondusk64@gmail.com>
parents:
38
diff
changeset
|
318 | AddObjectDialog::staticDialog (OBJ_Comment, this); |
0 | 319 | } |
320 | ||
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
321 | void ForgeWindow::slot_help () { |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
322 | |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
323 | } |
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
324 | |
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
325 | void ForgeWindow::slot_about () { |
0 | 326 | |
327 | } | |
328 | ||
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
329 | void ForgeWindow::slot_aboutQt () { |
0 | 330 | QMessageBox::aboutQt (this); |
331 | } | |
332 | ||
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
333 | void ForgeWindow::slot_cut () { |
0 | 334 | |
335 | } | |
336 | ||
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
337 | void ForgeWindow::slot_copy () { |
0 | 338 | |
339 | } | |
340 | ||
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
341 | void ForgeWindow::slot_paste () { |
0 | 342 | |
343 | } | |
344 | ||
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
345 | void ForgeWindow::slot_newVector () { |
0 | 346 | |
347 | } | |
348 | ||
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
349 | void ForgeWindow::slot_newVertex () { |
0 | 350 | |
351 | } | |
352 | ||
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
353 | void ForgeWindow::slot_inline () { |
24
d2d4d0154338
added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
23
diff
changeset
|
354 | |
d2d4d0154338
added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
23
diff
changeset
|
355 | } |
d2d4d0154338
added dummy action for future inlining command. Also GCC says that deleting instances of classes with virtual members but no virtual destructors is bad.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
23
diff
changeset
|
356 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
357 | // ============================================================================= |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
358 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
359 | // ============================================================================= |
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
360 | void ForgeWindow::slot_splitQuads () { |
21
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
361 | if (qObjList->selectedItems().size() == 0) |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
362 | return; |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
363 | |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
364 | QList<QTreeWidgetItem*> const qaItems = qObjList->selectedItems(); |
21
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
365 | |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
366 | for (ulong i = 0; i < g_CurrentFile->objects.size(); ++i) { |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
367 | LDObject* obj = g_CurrentFile->objects[i]; |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
368 | |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
369 | // Don't even consider non-quads |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
370 | if (obj->getType() != OBJ_Quad) |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
371 | continue; |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
372 | |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
373 | bool bIsSelected = false; |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
374 | |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
375 | for (long j = 0; j < qaItems.size(); ++j) { |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
376 | if (qaItems[j] == obj->qObjListEntry) { |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
377 | bIsSelected = true; |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
378 | break; |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
379 | } |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
380 | } |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
381 | |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
382 | if (!bIsSelected) |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
383 | continue; // Was not selected |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
384 | |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
385 | static_cast<LDQuad*> (obj)->splitToTriangles (); |
22
335e430a6b4f
So much for that pointer class, caused more problems than it solved. For instance splitting a second quad after a first one had been split would trigger a peculiar crash...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
21
diff
changeset
|
386 | i++;// Skip past the second triangle |
21
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
387 | } |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
388 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
389 | refresh (); |
21
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
390 | } |
9aebaaafa5da
Added split-quads-to-triangles function
Santeri Piippo <crimsondusk64@gmail.com>
parents:
20
diff
changeset
|
391 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
392 | // ============================================================================= |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
393 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
394 | // ============================================================================= |
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
395 | void ForgeWindow::slot_setContents () { |
14
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
396 | if (qObjList->selectedItems().size() != 1) |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
397 | return; |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
398 | |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
399 | ulong ulIndex; |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
400 | LDObject* obj = nullptr; |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
401 | |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
402 | QTreeWidgetItem* item = qObjList->selectedItems()[0]; |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
403 | for (ulIndex = 0; ulIndex < g_CurrentFile->objects.size(); ++ulIndex) { |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
404 | obj = g_CurrentFile->objects[ulIndex]; |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
405 | |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
406 | if (obj->qObjListEntry == item) |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
407 | break; |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
408 | } |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
409 | |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
410 | if (ulIndex >= g_CurrentFile->objects.size()) |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
411 | return; |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
412 | |
30
31ff9aabd506
Licensed LDForge GPL3, added some more icons
Santeri Piippo <crimsondusk64@gmail.com>
parents:
29
diff
changeset
|
413 | SetContentsDialog::staticDialog (obj, this); |
14
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
414 | } |
0 | 415 | |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
416 | // ============================================================================= |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
417 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
418 | // ============================================================================= |
0 | 419 | static QIcon IconForObjectType (LDObject* obj) { |
420 | switch (obj->getType ()) { | |
421 | case OBJ_Empty: | |
422 | return QIcon ("icons/empty.png"); | |
423 | ||
424 | case OBJ_Line: | |
425 | return QIcon ("icons/line.png"); | |
426 | ||
427 | case OBJ_Quad: | |
428 | return QIcon ("icons/quad.png"); | |
429 | ||
430 | case OBJ_Subfile: | |
431 | return QIcon ("icons/subfile.png"); | |
432 | ||
433 | case OBJ_Triangle: | |
434 | return QIcon ("icons/triangle.png"); | |
435 | ||
436 | case OBJ_CondLine: | |
437 | return QIcon ("icons/condline.png"); | |
438 | ||
439 | case OBJ_Comment: | |
440 | return QIcon ("icons/comment.png"); | |
441 | ||
442 | case OBJ_Vector: | |
443 | return QIcon ("icons/vector.png"); | |
444 | ||
445 | case OBJ_Vertex: | |
446 | return QIcon ("icons/vertex.png"); | |
447 | ||
448 | case OBJ_Gibberish: | |
449 | case OBJ_Unidentified: | |
450 | return QIcon ("icons/error.png"); | |
451 | } | |
452 | ||
453 | return QIcon (); | |
454 | } | |
455 | ||
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
456 | // ============================================================================= |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
457 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
458 | // ============================================================================= |
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
459 | void ForgeWindow::buildObjList () { |
3
2b78cf8634c3
don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
460 | if (!g_CurrentFile) |
2b78cf8634c3
don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
461 | return; |
2b78cf8634c3
don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
462 | |
0 | 463 | QList<QTreeWidgetItem*> qaItems; |
3
2b78cf8634c3
don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
464 | |
2b78cf8634c3
don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
465 | qObjList->clear (); |
2b78cf8634c3
don't crash if g_CurrentFile is null
Santeri Piippo <crimsondusk64@gmail.com>
parents:
0
diff
changeset
|
466 | |
22
335e430a6b4f
So much for that pointer class, caused more problems than it solved. For instance splitting a second quad after a first one had been split would trigger a peculiar crash...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
21
diff
changeset
|
467 | for (ulong i = 0; i < g_CurrentFile->objects.size(); ++i) { |
0 | 468 | LDObject* obj = g_CurrentFile->objects[i]; |
469 | ||
470 | str zText; | |
471 | switch (obj->getType ()) { | |
472 | case OBJ_Comment: | |
14
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
473 | zText = static_cast<LDComment*> (obj)->zText.chars(); |
10
5b0579997e9b
remove leading whitespace from comments when drawing them in the list
Santeri Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
474 | |
5b0579997e9b
remove leading whitespace from comments when drawing them in the list
Santeri Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
475 | // Remove leading whitespace |
5b0579997e9b
remove leading whitespace from comments when drawing them in the list
Santeri Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
476 | while (~zText && zText[0] == ' ') |
5b0579997e9b
remove leading whitespace from comments when drawing them in the list
Santeri Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
477 | zText -= -1; |
0 | 478 | break; |
479 | ||
480 | case OBJ_Empty: | |
481 | break; // leave it empty | |
482 | ||
483 | case OBJ_Line: | |
484 | case OBJ_CondLine: | |
485 | { | |
486 | LDLine* line = static_cast<LDLine*> (obj); | |
487 | zText.format ("%s, %s", | |
18
a6732098fed8
Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
17
diff
changeset
|
488 | line->vaCoords[0].getStringRep (true).chars(), |
a6732098fed8
Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
17
diff
changeset
|
489 | line->vaCoords[1].getStringRep (true).chars()); |
0 | 490 | } |
491 | break; | |
492 | ||
493 | case OBJ_Triangle: | |
494 | { | |
495 | LDTriangle* triangle = static_cast<LDTriangle*> (obj); | |
496 | zText.format ("%s, %s, %s", | |
18
a6732098fed8
Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
17
diff
changeset
|
497 | triangle->vaCoords[0].getStringRep (true).chars(), |
a6732098fed8
Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
17
diff
changeset
|
498 | triangle->vaCoords[1].getStringRep (true).chars(), |
a6732098fed8
Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
17
diff
changeset
|
499 | triangle->vaCoords[2].getStringRep (true).chars()); |
0 | 500 | } |
501 | break; | |
502 | ||
503 | case OBJ_Quad: | |
504 | { | |
505 | LDQuad* quad = static_cast<LDQuad*> (obj); | |
10
5b0579997e9b
remove leading whitespace from comments when drawing them in the list
Santeri Piippo <crimsondusk64@gmail.com>
parents:
7
diff
changeset
|
506 | zText.format ("%s, %s, %s, %s", |
18
a6732098fed8
Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
17
diff
changeset
|
507 | quad->vaCoords[0].getStringRep (true).chars(), |
a6732098fed8
Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
17
diff
changeset
|
508 | quad->vaCoords[1].getStringRep (true).chars(), |
a6732098fed8
Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
17
diff
changeset
|
509 | quad->vaCoords[2].getStringRep (true).chars(), |
a6732098fed8
Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
17
diff
changeset
|
510 | quad->vaCoords[3].getStringRep (true).chars()); |
0 | 511 | } |
512 | break; | |
513 | ||
514 | case OBJ_Gibberish: | |
515 | zText.format ("ERROR: %s", | |
14
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
516 | static_cast<LDGibberish*> (obj)->zContents.chars()); |
0 | 517 | break; |
518 | ||
519 | case OBJ_Vector: | |
18
a6732098fed8
Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
17
diff
changeset
|
520 | zText.format ("%s", static_cast<LDVector*> (obj)->vPos.getStringRep(true).chars()); |
0 | 521 | break; |
522 | ||
523 | case OBJ_Vertex: | |
18
a6732098fed8
Convert the static getCoordinateRep to a common ftoa, use this function to get proper coordinate representation when converting objects to LDraw code
Santeri Piippo <crimsondusk64@gmail.com>
parents:
17
diff
changeset
|
524 | zText.format ("%s", static_cast<LDVertex*> (obj)->vPosition.getStringRep(true).chars()); |
0 | 525 | break; |
526 | ||
527 | default: | |
528 | zText = g_saObjTypeNames[obj->getType ()]; | |
529 | break; | |
530 | } | |
531 | ||
14
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
532 | QTreeWidgetItem* item = new QTreeWidgetItem ((QTreeWidget*) (nullptr), |
0 | 533 | QStringList (zText.chars()), 0); |
534 | item->setIcon (0, IconForObjectType (obj)); | |
535 | ||
11
323390a03294
Color gibberish red. Check for line code length for gibberish (must be 1 to be valid)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
536 | // Color gibberish red |
323390a03294
Color gibberish red. Check for line code length for gibberish (must be 1 to be valid)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
537 | if (obj->getType() == OBJ_Gibberish) { |
323390a03294
Color gibberish red. Check for line code length for gibberish (must be 1 to be valid)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
538 | item->setBackgroundColor (0, "#AA0000"); |
323390a03294
Color gibberish red. Check for line code length for gibberish (must be 1 to be valid)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
539 | item->setForeground (0, QColor ("#FFAA00")); |
323390a03294
Color gibberish red. Check for line code length for gibberish (must be 1 to be valid)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
540 | } |
323390a03294
Color gibberish red. Check for line code length for gibberish (must be 1 to be valid)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
10
diff
changeset
|
541 | |
14
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
542 | obj->qObjListEntry = item; |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
543 | |
0 | 544 | qaItems.append (item); |
545 | } | |
546 | ||
547 | qObjList->insertTopLevelItems (0, qaItems); | |
14
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
548 | } |
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
549 | |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
550 | // ============================================================================= |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
551 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
552 | // ============================================================================= |
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
553 | void ForgeWindow::slot_selectionChanged () { |
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
554 | // If the selection isn't 1 exact, disable setting contents |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
555 | qAct_setContents->setEnabled (qObjList->selectedItems().size() == 1); |
22
335e430a6b4f
So much for that pointer class, caused more problems than it solved. For instance splitting a second quad after a first one had been split would trigger a peculiar crash...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
21
diff
changeset
|
556 | |
335e430a6b4f
So much for that pointer class, caused more problems than it solved. For instance splitting a second quad after a first one had been split would trigger a peculiar crash...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
21
diff
changeset
|
557 | // If we have no selection, disable splitting quads |
335e430a6b4f
So much for that pointer class, caused more problems than it solved. For instance splitting a second quad after a first one had been split would trigger a peculiar crash...
Santeri Piippo <crimsondusk64@gmail.com>
parents:
21
diff
changeset
|
558 | qAct_splitQuads->setEnabled (qObjList->selectedItems().size() > 0); |
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
559 | } |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
560 | |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
561 | // ============================================================================= |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
562 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
563 | // ============================================================================= |
25
c74bb88f537d
Deleted scanner.cpp (don't need it), merged model.cpp into io.cpp. Renamed LDForgeWindow to just ForgeWindow since I want the LD* prefix only be given to LDObject derivatives.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
24
diff
changeset
|
564 | ulong ForgeWindow::getInsertionPoint () { |
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
565 | ulong ulIndex; |
14
6d9d8efae2f8
this thing got its own reinterpret_cast now. :P Added SetContents action for altering an object by contents and reinterpreting it.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
11
diff
changeset
|
566 | |
17
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
567 | if (qObjList->selectedItems().size() == 1) { |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
568 | // If we have a selection, put the item after it. |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
569 | for (ulIndex = 0; ulIndex < g_CurrentFile->objects.size(); ++ulIndex) |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
570 | if (g_CurrentFile->objects[ulIndex]->qObjListEntry == qObjList->selectedItems()[0]) |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
571 | break; |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
572 | |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
573 | if (ulIndex >= g_CurrentFile->objects.size()) |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
574 | return ulIndex + 1; |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
575 | } |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
576 | |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
577 | // Otherwise place the object at the end. |
5606eebd0b90
Allow addition of dummy lines..
Santeri Piippo <crimsondusk64@gmail.com>
parents:
14
diff
changeset
|
578 | return g_CurrentFile->objects.size(); |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
579 | } |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
580 | |
32
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
581 | // ============================================================================= |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
582 | // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |
5d22b7ecf110
Made the GL renderer background color configurable
Santeri Piippo <crimsondusk64@gmail.com>
parents:
30
diff
changeset
|
583 | // ============================================================================= |
29
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
584 | void ForgeWindow::refresh () { |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
585 | buildObjList (); |
55406ce7446e
Added LDraw path setting dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents:
28
diff
changeset
|
586 | R->hardRefresh (); |
0 | 587 | } |