gui_actions.cpp

Wed, 08 May 2013 04:10:31 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Wed, 08 May 2013 04:10:31 +0300
changeset 180
16306e69a895
parent 177
4cdd408f2863
permissions
-rw-r--r--

Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.

79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
104
6e29bb0e83c5 GL picking stuff
Santeri Piippo <crimsondusk64@gmail.com>
parents: 100
diff changeset
3 * Copyright (C) 2013 Santeri Piippo
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #include <qfiledialog.h>
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #include <qmessagebox.h>
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include "gui.h"
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include "file.h"
123
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
23 #include "history.h"
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 #include "zz_newPartDialog.h"
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 #include "zz_configDialog.h"
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26 #include "zz_addObjectDialog.h"
123
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
27 #include "zz_aboutDialog.h"
125
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
28 #include "misc.h"
180
16306e69a895 Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 177
diff changeset
29 #include "zz_ldrawPathDialog.h"
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 // =============================================================================
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 // =============================================================================
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
34 MAKE_ACTION (newFile, "&New", "brick", "Create a new part model.", CTRL (N)) {
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 NewPartDialog::StaticDialog ();
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 }
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38 // =============================================================================
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
40 // =============================================================================
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
41 MAKE_ACTION (open, "&Open", "file-open", "Load a part model from a file.", CTRL (O)) {
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
42 str zName;
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
43 zName += QFileDialog::getOpenFileName (g_win, "Open File",
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
44 "", "LDraw files (*.dat *.ldr)");
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
46 if (~zName)
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
47 openMainFile (zName);
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
48 }
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
49
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
50 // =============================================================================
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
51 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
52 // =============================================================================
128
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
53 void doSave (bool saveAs) {
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
54 str path = g_curfile->m_filename;
128
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
55
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
56 if (~path == 0 || saveAs) {
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
57 path = QFileDialog::getSaveFileName (g_win, "Save As",
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 "", "LDraw files (*.dat *.ldr)");
128
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
59
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
60 if (~path == 0) {
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
61 // User didn't give a file name. This happens if the user cancelled
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
62 // saving in the save file dialog. Abort.
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
63 return;
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
64 }
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
65 }
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
67 if (g_curfile->save (path)) {
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
68 g_curfile->m_filename = path;
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
69 g_win->setTitle ();
128
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
70
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
71 logf ("Saved successfully to %s\n", path.chars ());
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
72 } else {
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
73 setlocale (LC_ALL, "C");
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
74
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
75 // Tell the user the save failed, and give the option for saving as with it.
129
9cf313447c8f A saving failure is a critical error, not a warning and should be drawn as such
Santeri Piippo <crimsondusk64@gmail.com>
parents: 128
diff changeset
76 QMessageBox dlg (QMessageBox::Critical, "Save Failure",
161
c9fba92c4e35 Further tweaking
Santeri Piippo <crimsondusk64@gmail.com>
parents: 160
diff changeset
77 fmt ("Failed to save to %s\nReason: %s", path.chars(), strerror (g_curfile->lastError)),
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
78 QMessageBox::Close, g_win);
128
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
79
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
80 QPushButton* saveAsBtn = new QPushButton ("Save As");
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
81 saveAsBtn->setIcon (getIcon ("file-save-as"));
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
82 dlg.addButton (saveAsBtn, QMessageBox::ActionRole);
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
83 dlg.setDefaultButton (QMessageBox::Close);
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
84 dlg.exec ();
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
85
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
86 if (dlg.clickedButton () == saveAsBtn)
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
87 doSave (true); // yay recursion!
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
88 }
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
89 }
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
90
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
91 // =============================================================================
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
92 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93 // =============================================================================
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
94 MAKE_ACTION (save, "&Save", "file-save", "Save the part model.", CTRL (S)) {
128
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
95 doSave (false);
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
96 }
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
97
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
98 // =============================================================================
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
99 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
100 // =============================================================================
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
101 MAKE_ACTION (saveAs, "Save &As", "file-save-as", "Save the part model to a specific file.", CTRL_SHIFT (S)) {
128
73a7edf82ca9 Warn for save failures with the save and save as actions, also provide with a button to save the file under a different name.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 125
diff changeset
102 doSave (true);
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
103 }
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
105 // =============================================================================
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
106 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
107 // =============================================================================
161
c9fba92c4e35 Further tweaking
Santeri Piippo <crimsondusk64@gmail.com>
parents: 160
diff changeset
108 MAKE_ACTION (settings, "Settin&gs", "settings", "Edit the settings of " APPNAME ".", (0)) {
100
e40358266290 Added user-configurable quick-coloring toolbar for.. quick coloring.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 99
diff changeset
109 ConfigDialog::staticDialog ();
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
110 }
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
111
180
16306e69a895 Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 177
diff changeset
112 MAKE_ACTION (setLDrawPath, "Set LDraw Path", "settings", "Change the LDraw directory path.", (0)) {
16306e69a895 Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 177
diff changeset
113 LDrawPathDialog dlg (true);
16306e69a895 Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 177
diff changeset
114 dlg.exec ();
16306e69a895 Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 177
diff changeset
115 }
16306e69a895 Moved LDraw path setting out of the configuration dialog to the LDraw path dialog, it does the job better.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 177
diff changeset
116
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
117 // =============================================================================
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
118 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
119 // =============================================================================
161
c9fba92c4e35 Further tweaking
Santeri Piippo <crimsondusk64@gmail.com>
parents: 160
diff changeset
120 MAKE_ACTION (exit, "&Exit", "exit", "Close " APPNAME ".", CTRL (Q)) {
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
121 exit (0);
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
122 }
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
123
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
124 // =============================================================================
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
125 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
126 // =============================================================================
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
127 MAKE_ACTION (newSubfile, "New Subfile", "add-subfile", "Creates a new subfile reference.", 0) {
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 163
diff changeset
128 AddObjectDialog::staticDialog (LDObject::Subfile, null);
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
129 }
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
130
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
131 MAKE_ACTION (newLine, "New Line", "add-line", "Creates a new line.", 0) {
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 163
diff changeset
132 AddObjectDialog::staticDialog (LDObject::Line, null);
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
133 }
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
134
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
135 MAKE_ACTION (newTriangle, "New Triangle", "add-triangle", "Creates a new triangle.", 0) {
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 163
diff changeset
136 AddObjectDialog::staticDialog (LDObject::Triangle, null);
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
137 }
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
138
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
139 MAKE_ACTION (newQuad, "New Quadrilateral", "add-quad", "Creates a new quadrilateral.", 0) {
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 163
diff changeset
140 AddObjectDialog::staticDialog (LDObject::Quad, null);
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
141 }
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
142
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
143 MAKE_ACTION (newCondLine, "New Conditional Line", "add-condline", "Creates a new conditional line.", 0) {
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 163
diff changeset
144 AddObjectDialog::staticDialog (LDObject::CondLine, null);
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
145 }
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
146
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
147 MAKE_ACTION (newComment, "New Comment", "add-comment", "Creates a new comment.", 0) {
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 163
diff changeset
148 AddObjectDialog::staticDialog (LDObject::Comment, null);
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
149 }
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 110
diff changeset
150
150
bcbbdc5454e6 Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 149
diff changeset
151 MAKE_ACTION (newBFC, "New BFC Statement", "add-bfc", "Creates a new BFC statement.", 0) {
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 163
diff changeset
152 AddObjectDialog::staticDialog (LDObject::BFC, null);
150
bcbbdc5454e6 Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 149
diff changeset
153 }
bcbbdc5454e6 Added new BFC dialog
Santeri Piippo <crimsondusk64@gmail.com>
parents: 149
diff changeset
154
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
155 MAKE_ACTION (newVertex, "New Vertex", "add-vertex", "Creates a new vertex.", 0) {
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 163
diff changeset
156 AddObjectDialog::staticDialog (LDObject::Vertex, null);
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
157 }
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
158
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
159 MAKE_ACTION (newRadial, "New Radial", "add-radial", "Creates a new radial.", 0) {
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 163
diff changeset
160 AddObjectDialog::staticDialog (LDObject::Radial, null);
111
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 110
diff changeset
161 }
125e8031dbf1 Added the radial type, this one sure has been on my wishlist for a while. :)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 110
diff changeset
162
154
cc53e5cbad54 Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 153
diff changeset
163 MAKE_ACTION (editObject, "Edit Object", "edit-object", "Edits this object.", 0) {
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
164 if (g_win->sel ().size () != 1)
154
cc53e5cbad54 Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 153
diff changeset
165 return;
cc53e5cbad54 Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 153
diff changeset
166
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
167 LDObject* obj = g_win->sel ()[0];
154
cc53e5cbad54 Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 153
diff changeset
168 AddObjectDialog::staticDialog (obj->getType (), obj);
cc53e5cbad54 Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 153
diff changeset
169 }
cc53e5cbad54 Added context menu and uncolorize action
Santeri Piippo <crimsondusk64@gmail.com>
parents: 153
diff changeset
170
161
c9fba92c4e35 Further tweaking
Santeri Piippo <crimsondusk64@gmail.com>
parents: 160
diff changeset
171 MAKE_ACTION (help, "Help", "help", "Shows the " APPNAME " help manual.", KEY (F1)) {
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
172
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
173 }
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
174
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
175 // =============================================================================
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
176 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
177 // =============================================================================
161
c9fba92c4e35 Further tweaking
Santeri Piippo <crimsondusk64@gmail.com>
parents: 160
diff changeset
178 MAKE_ACTION (about, "About " APPNAME, "ldforge",
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
179 "Shows information about " APPNAME ".", (0))
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
180 {
123
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
181 AboutDialog dlg;
a54d9d5c0c1f Added the about dialog.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 111
diff changeset
182 dlg.exec ();
79
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
183 }
f8917e9d07f6 Extracted actions from ForgeWindow into their own files. The ACTION macro now manages meta, instances and callback definitions all in one. Too bad I still need to extern these actions in gui.cpp... maybe someday I'll find a way around it :)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
184
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
185 MAKE_ACTION (aboutQt, "About Qt", "qt", "Shows information about Qt.", (0)) {
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
186 QMessageBox::aboutQt (g_win);
97
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 80
diff changeset
187 }
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 80
diff changeset
188
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 80
diff changeset
189 // =============================================================================
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 80
diff changeset
190 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
52bcca21579e Fleshed out the history dialog further
Santeri Piippo <crimsondusk64@gmail.com>
parents: 80
diff changeset
191 // =============================================================================
155
e21c24bfcdf3 Added select all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 154
diff changeset
192 MAKE_ACTION (selectAll, "Select All", "select-all", "Selects all objects.", CTRL (A)) {
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
193 g_win->sel ().clear ();
155
e21c24bfcdf3 Added select all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 154
diff changeset
194
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
195 for (LDObject* obj : g_curfile->m_objs)
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
196 g_win->sel ().push_back (obj);
155
e21c24bfcdf3 Added select all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 154
diff changeset
197
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
198 g_win->updateSelection ();
155
e21c24bfcdf3 Added select all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 154
diff changeset
199 }
e21c24bfcdf3 Added select all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 154
diff changeset
200
e21c24bfcdf3 Added select all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 154
diff changeset
201 // =============================================================================
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
202 MAKE_ACTION (selectByColor, "Select by Color", "select-color",
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
203 "Select all objects by the given color.", CTRL_SHIFT (A))
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
204 {
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
205 short dColor = g_win->getSelectedColor ();
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
206
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
207 if (dColor == -1)
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
208 return; // no consensus on color
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
209
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
210 g_win->sel ().clear ();
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
211 for (LDObject* obj : g_curfile->m_objs)
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
212 if (obj->dColor == dColor)
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
213 g_win->sel ().push_back (obj);
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
214
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
215 g_win->updateSelection ();
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
216 }
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
217
155
e21c24bfcdf3 Added select all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 154
diff changeset
218 // =============================================================================
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
219 MAKE_ACTION (selectByType, "Select by Type", "select-type",
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
220 "Select all objects by the given type.", (0))
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
221 {
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
222 if (g_win->sel ().size () == 0)
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
223 return;
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
224
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 163
diff changeset
225 LDObject::Type eType = g_win->uniformSelectedType ();
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
226
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 163
diff changeset
227 if (eType == LDObject::Unidentified)
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
228 return;
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
229
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
230 // If we're selecting subfile references, the reference filename must also
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
231 // be uniform.
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
232 str zRefName;
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
233
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 163
diff changeset
234 if (eType == LDObject::Subfile) {
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
235 zRefName = static_cast<LDSubfile*> (g_win->sel ()[0])->zFileName;
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
236
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
237 for (LDObject* pObj : g_win->sel ())
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
238 if (static_cast<LDSubfile*> (pObj)->zFileName != zRefName)
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
239 return;
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
240 }
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
241
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
242 g_win->sel ().clear ();
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
243 for (LDObject* obj : g_curfile->m_objs) {
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
244 if (obj->getType() != eType)
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
245 continue;
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
246
168
96691a009dff Further work on ext programs, LDObjectType_e integrated into LDObject
Santeri Piippo <crimsondusk64@gmail.com>
parents: 163
diff changeset
247 if (eType == LDObject::Subfile && static_cast<LDSubfile*> (obj)->zFileName != zRefName)
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
248 continue;
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
249
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
250 g_win->sel ().push_back (obj);
110
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
251 }
a62ab18d1b80 Added select by type. Selection is now preserved over operations.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 109
diff changeset
252
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
253 g_win->updateSelection ();
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
254 }
125
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
255
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
256 // =============================================================================
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
257 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
258 // =============================================================================
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
259 MAKE_ACTION (gridCoarse, "Coarse Grid", "grid-coarse", "Set the grid to Coarse", CTRL (1)) {
125
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
260 grid = Grid::Coarse;
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
261 g_win->updateGridToolBar ();
125
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
262 }
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
263
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
264 MAKE_ACTION (gridMedium, "Medium Grid", "grid-medium", "Set the grid to Medium", CTRL (2)) {
125
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
265 grid = Grid::Medium;
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
266 g_win->updateGridToolBar ();
125
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
267 }
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
268
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
269 MAKE_ACTION (gridFine, "Fine Grid", "grid-fine", "Set the grid to Fine", CTRL (3)) {
125
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
270 grid = Grid::Fine;
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
271 g_win->updateGridToolBar ();
125
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
272 }
7ee7aa5e28be Make grid actions regular actions rather than auto-generated, this way they can have keyboard shortcuts
Santeri Piippo <crimsondusk64@gmail.com>
parents: 124
diff changeset
273
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
274 // =============================================================================
142
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
275 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
276 // =============================================================================
135
c243df39913e Cleanup and some restructuring
Santeri Piippo <crimsondusk64@gmail.com>
parents: 132
diff changeset
277 MAKE_ACTION (resetView, "Reset View", "reset-view", "Reset view angles, pan and zoom", CTRL (0)) {
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
278 g_win->R ()->resetAngles ();
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
279 g_win->R ()->update ();
132
577e8e89d8de Added panning to GL view, added action for resetting angles, zoom and pan
Santeri Piippo <crimsondusk64@gmail.com>
parents: 129
diff changeset
280 }
577e8e89d8de Added panning to GL view, added action for resetting angles, zoom and pan
Santeri Piippo <crimsondusk64@gmail.com>
parents: 129
diff changeset
281
577e8e89d8de Added panning to GL view, added action for resetting angles, zoom and pan
Santeri Piippo <crimsondusk64@gmail.com>
parents: 129
diff changeset
282 // =============================================================================
142
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
283 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
284 // =============================================================================
140
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
285 MAKE_ACTION (insertFrom, "Insert from File", "insert-from", "Insert LDraw data from a file.", (0)) {
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
286 str fname = QFileDialog::getOpenFileName ();
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
287 ulong idx = g_win->getInsertionPoint ();
140
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
288
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
289 if (!~fname)
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
290 return;
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
291
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
292 FILE* fp = fopen (fname, "r");
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
293 if (!fp) {
161
c9fba92c4e35 Further tweaking
Santeri Piippo <crimsondusk64@gmail.com>
parents: 160
diff changeset
294 critical (fmt ("Couldn't open %s\n%s", fname.chars(), strerror (errno)));
140
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
295 return;
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
296 }
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
297
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
298 std::vector<LDObject*> historyCopies;
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
299 std::vector<ulong> historyIndices;
141
184d117e1b12 corrections to inserting from file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 140
diff changeset
300 std::vector<LDObject*> objs = loadFileContents (fp, null);
184d117e1b12 corrections to inserting from file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 140
diff changeset
301
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
302 g_win->sel ().clear ();
140
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
303
141
184d117e1b12 corrections to inserting from file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 140
diff changeset
304 for (LDObject* obj : objs) {
184d117e1b12 corrections to inserting from file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 140
diff changeset
305 historyCopies.push_back (obj->clone ());
184d117e1b12 corrections to inserting from file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 140
diff changeset
306 historyIndices.push_back (idx);
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
307 g_curfile->insertObj (idx, obj);
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
308 g_win->sel ().push_back (obj);
141
184d117e1b12 corrections to inserting from file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 140
diff changeset
309
184d117e1b12 corrections to inserting from file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 140
diff changeset
310 idx++;
184d117e1b12 corrections to inserting from file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 140
diff changeset
311 }
140
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
312
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
313 if (historyCopies.size() > 0) {
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
314 History::addEntry (new AddHistory (historyIndices, historyCopies));
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
315 g_win->refresh ();
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
316 g_win->scrollToSelection ();
140
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
317 }
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
318 }
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
319
2e8c1626aef7 Added insert from action to import file contents from another file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 138
diff changeset
320 // =============================================================================
109
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
321 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
f40b35142586 Improved shared selection handling; added select by color
Santeri Piippo <crimsondusk64@gmail.com>
parents: 104
diff changeset
322 // =============================================================================
142
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
323 MAKE_ACTION (insertRaw, "Insert Raw", "insert-raw", "Type in LDraw code to insert.", (0)) {
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
324 ulong idx = g_win->getInsertionPoint ();
142
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
325
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
326 QDialog* const dlg = new QDialog;
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
327 QVBoxLayout* const layout = new QVBoxLayout;
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
328 QTextEdit* const te_edit = new QTextEdit;
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
329 QDialogButtonBox* const bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
330 std::vector<LDObject*> historyCopies;
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
331 std::vector<ulong> historyIndices;
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
332
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
333 layout->addWidget (te_edit);
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
334 layout->addWidget (bbx_buttons);
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
335 dlg->setLayout (layout);
161
c9fba92c4e35 Further tweaking
Santeri Piippo <crimsondusk64@gmail.com>
parents: 160
diff changeset
336 dlg->setWindowTitle (APPNAME ": Insert Raw");
142
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
337 dlg->connect (bbx_buttons, SIGNAL (accepted ()), dlg, SLOT (accept ()));
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
338 dlg->connect (bbx_buttons, SIGNAL (rejected ()), dlg, SLOT (reject ()));
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
339
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
340 if (dlg->exec () == false)
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
341 return;
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
342
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
343 g_win->sel ().clear ();
142
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
344
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
345 for (str line : str (te_edit->toPlainText ()).split ("\n")) {
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
346 LDObject* obj = parseLine (line);
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
347
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
348 g_curfile->insertObj (idx, obj);
142
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
349 historyIndices.push_back (idx);
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
350 historyCopies.push_back (obj->clone ());
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
351 g_win->sel ().push_back (obj);
142
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
352 idx++;
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
353 }
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
354
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
355 if (historyCopies.size () > 0) {
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
356 History::addEntry (new AddHistory (historyIndices, historyCopies));
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
357 g_win->refresh ();
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
358 g_win->scrollToSelection ();
142
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
359 }
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
360 }
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
361
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
362 // =============================================================================
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
363 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
6e8aee653dab Added action from inserting raw LDraw data into the part.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 141
diff changeset
364 // =============================================================================
143
e3c37b950a68 Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents: 142
diff changeset
365 MAKE_ACTION (screencap, "Screencap Part", "screencap", "Save a picture of the model", (0)) {
144
b2b8b45f6f5f Fixed view going blank after resize
Santeri Piippo <crimsondusk64@gmail.com>
parents: 143
diff changeset
366 setlocale (LC_ALL, "C");
b2b8b45f6f5f Fixed view going blank after resize
Santeri Piippo <crimsondusk64@gmail.com>
parents: 143
diff changeset
367
143
e3c37b950a68 Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents: 142
diff changeset
368 ushort w, h;
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
369 uchar* imagedata = g_win->R ()->screencap (w, h);
143
e3c37b950a68 Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents: 142
diff changeset
370
e3c37b950a68 Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents: 142
diff changeset
371 // GL and Qt formats have R and B swapped. Also, GL flips Y - correct it as well.
e3c37b950a68 Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents: 142
diff changeset
372 QImage img = QImage (imagedata, w, h, QImage::Format_ARGB32).rgbSwapped ().mirrored ();
e3c37b950a68 Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents: 142
diff changeset
373
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
374 str root = basename (g_curfile->m_filename.chars ());
145
ddf24c380be6 Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents: 144
diff changeset
375 if (root.substr (~root - 4, -1) == ".dat")
ddf24c380be6 Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents: 144
diff changeset
376 root -= 4;
ddf24c380be6 Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents: 144
diff changeset
377
161
c9fba92c4e35 Further tweaking
Santeri Piippo <crimsondusk64@gmail.com>
parents: 160
diff changeset
378 str defaultname = (~root > 0) ? fmt ("%s.png", root.chars ()) : "";
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
379 str fname = QFileDialog::getSaveFileName (g_win, "Save Screencap", defaultname,
145
ddf24c380be6 Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents: 144
diff changeset
380 "PNG images (*.png);;JPG images (*.jpg);;BMP images (*.bmp);;All Files (*.*)");
ddf24c380be6 Base work regarding constrained cameras
Santeri Piippo <crimsondusk64@gmail.com>
parents: 144
diff changeset
381
143
e3c37b950a68 Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents: 142
diff changeset
382 if (~fname > 0 && !img.save (fname))
161
c9fba92c4e35 Further tweaking
Santeri Piippo <crimsondusk64@gmail.com>
parents: 160
diff changeset
383 critical (fmt ("Couldn't open %s for writing to save screencap: %s", fname.chars(), strerror (errno)));
143
e3c37b950a68 Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents: 142
diff changeset
384
e3c37b950a68 Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents: 142
diff changeset
385 delete[] imagedata;
e3c37b950a68 Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents: 142
diff changeset
386 }
e3c37b950a68 Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents: 142
diff changeset
387
e3c37b950a68 Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents: 142
diff changeset
388 // =============================================================================
e3c37b950a68 Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents: 142
diff changeset
389 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
e3c37b950a68 Added screencapping
Santeri Piippo <crimsondusk64@gmail.com>
parents: 142
diff changeset
390 // =============================================================================
156
d35b7e440585 Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents: 155
diff changeset
391 extern_cfg (bool, gl_axes);
d35b7e440585 Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents: 155
diff changeset
392 MAKE_ACTION (axes, "Draw Axes", "axes", "Toggles drawing of axes", (0)) {
d35b7e440585 Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents: 155
diff changeset
393 gl_axes = !gl_axes;
d35b7e440585 Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents: 155
diff changeset
394 ACTION (axes)->setChecked (gl_axes);
160
edcb03f3ef75 Mass renaming and cleanup. GLRenderer's and ForgeWindow's members made private. Names of common identifiers shortened, moved logVA to ForgeWindow since it's a GUI-related function (though logf remains under main.cpp for ubiquitous usage)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 156
diff changeset
395 g_win->R ()->update ();
156
d35b7e440585 Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents: 155
diff changeset
396 }
d35b7e440585 Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents: 155
diff changeset
397
d35b7e440585 Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents: 155
diff changeset
398 // =============================================================================
163
46955613626d Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 162
diff changeset
399 MAKE_ACTION (beginDraw, "Begin Drawing", "draw", "Begin drawing geometry", KEY (Insert)) {
162
b7d65e89861a matrix is now templated with N=int (usually 3)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 161
diff changeset
400 g_win->R ()->beginPlaneDraw ();
b7d65e89861a matrix is now templated with N=int (usually 3)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 161
diff changeset
401 }
b7d65e89861a matrix is now templated with N=int (usually 3)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 161
diff changeset
402
163
46955613626d Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 162
diff changeset
403 MAKE_ACTION (cancelDraw, "Cancel Drawing", "draw-cancel", "Cancel drawing geometry", KEY (Escape)) {
46955613626d Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 162
diff changeset
404 g_win->R ()->endPlaneDraw (false);
46955613626d Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 162
diff changeset
405 }
46955613626d Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 162
diff changeset
406
46955613626d Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 162
diff changeset
407 MAKE_ACTION (doneDraw, "Done Drawing", "draw-done", "Done drawing geometry", KEY (Enter)) {
46955613626d Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 162
diff changeset
408 g_win->R ()->endPlaneDraw (true);
46955613626d Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 162
diff changeset
409 }
46955613626d Plane drawing is functional at last!!!11 Also added meta function findAction to find an action by name so I don't have to extern all of them manually in gui.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 162
diff changeset
410
162
b7d65e89861a matrix is now templated with N=int (usually 3)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 161
diff changeset
411 // =============================================================================
156
d35b7e440585 Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents: 155
diff changeset
412 // * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
d35b7e440585 Added axes rendering
Santeri Piippo <crimsondusk64@gmail.com>
parents: 155
diff changeset
413 // =============================================================================
170
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
414 MAKE_ACTION (visibility, "Toggle Visibility", "visibility", "Toggles visibility/hiding on objects.", (0)) {
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
415 for (LDObject* obj : g_win->sel ())
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
416 obj->setHidden (!obj->hidden ());
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
417
2247a32e63a8 Added visibility toggling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 168
diff changeset
418 g_win->refresh ();
175
b094d5e9d6e0 Added Intersector interface. I'm beginning to think that groups were a bad idea...
Santeri Piippo <crimsondusk64@gmail.com>
parents: 172
diff changeset
419 }

mercurial