src/gui_actions.cpp

Sat, 24 Aug 2013 16:52:45 +0300

author
Santeri Piippo <crimsondusk64@gmail.com>
date
Sat, 24 Aug 2013 16:52:45 +0300
changeset 484
5b5c77c7f3dd
parent 472
8986414c6ad5
child 485
543a6696096f
permissions
-rw-r--r--

made LDFile interfacing a bit clearer

183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
3 * Copyright (C) 2013 Santeri Piippo
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
4 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
9 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
14 *
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
199
10dd5909a50e Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 198
diff changeset
19 #include <QFileDialog>
10dd5909a50e Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 198
diff changeset
20 #include <QMessageBox>
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 195
diff changeset
21 #include <QTextEdit>
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 195
diff changeset
22 #include <QBoxLayout>
202
a027f6fc6141 Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 200
diff changeset
23 #include <QDialogButtonBox>
a027f6fc6141 Un-templated CheckBoxGroup, moved it and RadioButton into widgets.cpp/widgets.h; removed license text tab because I think LICENSE is enough.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 200
diff changeset
24 #include <QPushButton>
219
70eb948a2b02 Added ability to set the depth value to something else than 0.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 212
diff changeset
25 #include <QInputDialog>
199
10dd5909a50e Made Qt file includes more proper (<QLineEdit> instead of <qlineedit.h>), merged setContentsDialog.cpp into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 198
diff changeset
26
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 #include "gui.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 #include "file.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 #include "history.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 #include "configDialog.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 #include "addObjectDialog.h"
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 #include "misc.h"
198
f246725199dc Split some stuff into separate files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 195
diff changeset
33 #include "gldraw.h"
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
34 #include "dialogs.h"
292
4779ca562d5e Moved primitive handling to new code files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 291
diff changeset
35 #include "primitives.h"
315
cb0c23f35e2b UI-ified the new part prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 310
diff changeset
36 #include "ui_newpart.h"
317
e41ab239ed28 Added ability to load the overlay meta
Santeri Piippo <crimsondusk64@gmail.com>
parents: 315
diff changeset
37 #include "widgets.h"
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
38
461
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
39 extern_cfg (Bool, gl_wireframe);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
40 extern_cfg (Bool, gl_colorbfc);
464
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
41 extern_cfg (String, ld_defaultname);
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
42 extern_cfg (String, ld_defaultuser);
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
43 extern_cfg (Int, ld_defaultlicense);
193
ce8e25ccbaf6 Added wireframe mode
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
44
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
45 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
46 // -----------------------------------------------------------------------------
416
be1824f53c48 Added an action for creating a new, blank file, improved multi-file stability
Santeri Piippo <crimsondusk64@gmail.com>
parents: 415
diff changeset
47 DEFINE_ACTION (New, CTRL_SHIFT (N)) {
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
48 QDialog* dlg = new QDialog (g_win);
315
cb0c23f35e2b UI-ified the new part prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 310
diff changeset
49 Ui::NewPartUI ui;
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
50 ui.setupUi (dlg);
315
cb0c23f35e2b UI-ified the new part prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 310
diff changeset
51
464
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
52 str authortext = ld_defaultname;
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
53
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
54 if (!ld_defaultuser.value.isEmpty())
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
55 authortext.append (fmt (" [%1]", ld_defaultuser));
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
56
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
57 ui.le_author->setText (authortext);
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
58
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
59 switch (ld_defaultlicense) {
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
60 case 0:
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
61 ui.rb_license_ca->setChecked (true);
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
62 break;
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
63
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
64 case 1:
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
65 ui.rb_license_nonca->setChecked (true);
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
66 break;
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
67
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
68 case 2:
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
69 ui.rb_license_none->setChecked (true);
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
70 break;
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
71
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
72 default:
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
73 QMessageBox::warning (null, "Warning",
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
74 fmt ("Unknown ld_defaultlicense value %1!", ld_defaultlicense));
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
75 break;
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
76 }
3779a14d597c added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents: 461
diff changeset
77
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
78 if (dlg->exec() == false)
315
cb0c23f35e2b UI-ified the new part prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 310
diff changeset
79 return;
cb0c23f35e2b UI-ified the new part prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 310
diff changeset
80
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
81 newFile();
315
cb0c23f35e2b UI-ified the new part prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 310
diff changeset
82
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 455
diff changeset
83 const LDBFC::Type BFCType =
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 455
diff changeset
84 ui.rb_bfc_ccw->isChecked() ? LDBFC::CertifyCCW :
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 455
diff changeset
85 ui.rb_bfc_cw->isChecked() ? LDBFC::CertifyCW : LDBFC::NoCertify;
315
cb0c23f35e2b UI-ified the new part prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 310
diff changeset
86
cb0c23f35e2b UI-ified the new part prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 310
diff changeset
87 const str license =
cb0c23f35e2b UI-ified the new part prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 310
diff changeset
88 ui.rb_license_ca->isChecked() ? CALicense :
391
beef61ce962a Finalized multi-file behavior. The future is here! :P
Santeri Piippo <crimsondusk64@gmail.com>
parents: 389
diff changeset
89 ui.rb_license_nonca->isChecked() ? NonCALicense : "";
315
cb0c23f35e2b UI-ified the new part prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 310
diff changeset
90
484
5b5c77c7f3dd made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents: 472
diff changeset
91 LDFile::current()->addObjects ({new LDComment (ui.le_title->text()),
5b5c77c7f3dd made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents: 472
diff changeset
92 new LDComment ("Name: <untitled>.dat" ),
5b5c77c7f3dd made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents: 472
diff changeset
93 new LDComment (fmt ("Author: %1", ui.le_author->text())),
5b5c77c7f3dd made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents: 472
diff changeset
94 new LDComment (fmt ("!LDRAW_ORG Unofficial_Part")),
5b5c77c7f3dd made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents: 472
diff changeset
95 (license != "" ?
5b5c77c7f3dd made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents: 472
diff changeset
96 new LDComment (license) :
5b5c77c7f3dd made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents: 472
diff changeset
97 null),
5b5c77c7f3dd made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents: 472
diff changeset
98 new LDEmpty,
5b5c77c7f3dd made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents: 472
diff changeset
99 new LDBFC (BFCType),
5b5c77c7f3dd made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents: 472
diff changeset
100 new LDEmpty,
5b5c77c7f3dd made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents: 472
diff changeset
101 });
315
cb0c23f35e2b UI-ified the new part prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 310
diff changeset
102
cb0c23f35e2b UI-ified the new part prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 310
diff changeset
103 g_win->fullRefresh();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
105
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
106 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
107 // -----------------------------------------------------------------------------
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 416
diff changeset
108 DEFINE_ACTION (NewFile, CTRL (N)) {
416
be1824f53c48 Added an action for creating a new, blank file, improved multi-file stability
Santeri Piippo <crimsondusk64@gmail.com>
parents: 415
diff changeset
109 newFile();
be1824f53c48 Added an action for creating a new, blank file, improved multi-file stability
Santeri Piippo <crimsondusk64@gmail.com>
parents: 415
diff changeset
110 }
be1824f53c48 Added an action for creating a new, blank file, improved multi-file stability
Santeri Piippo <crimsondusk64@gmail.com>
parents: 415
diff changeset
111
be1824f53c48 Added an action for creating a new, blank file, improved multi-file stability
Santeri Piippo <crimsondusk64@gmail.com>
parents: 415
diff changeset
112 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
113 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
114 DEFINE_ACTION (Open, CTRL (O)) {
200
5583af82087e Merged new part and LDraw path dialogs into dialogs.cpp
Santeri Piippo <crimsondusk64@gmail.com>
parents: 199
diff changeset
115 str name = QFileDialog::getOpenFileName (g_win, "Open File", "", "LDraw files (*.dat *.ldr)");
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
116
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
117 if (name.length() == 0)
226
3dd9e63698cd Prompt for unsaved changes before loading or creating a new file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 224
diff changeset
118 return;
3dd9e63698cd Prompt for unsaved changes before loading or creating a new file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 224
diff changeset
119
3dd9e63698cd Prompt for unsaved changes before loading or creating a new file
Santeri Piippo <crimsondusk64@gmail.com>
parents: 224
diff changeset
120 openMainFile (name);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
121 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
122
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
123 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
124 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
125 DEFINE_ACTION (Save, CTRL (S)) {
409
8da2563c645a Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
126 g_win->save (LDFile::current(), false);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
127 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
128
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
129 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
130 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
131 DEFINE_ACTION (SaveAs, CTRL_SHIFT (S)) {
409
8da2563c645a Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
132 g_win->save (LDFile::current(), true);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
133 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
134
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
135 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
136 // -----------------------------------------------------------------------------
389
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
137 DEFINE_ACTION (SaveAll, CTRL (L)) {
409
8da2563c645a Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
138 for (LDFile* file : g_loadedFiles) {
389
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
139 if (file->implicit())
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
140 continue;
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
141
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
142 g_win->save (file, false);
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
143 }
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
144 }
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
145
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
146 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
147 // -----------------------------------------------------------------------------
389
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
148 DEFINE_ACTION (Close, CTRL (W)) {
409
8da2563c645a Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
149 if (!LDFile::current()->safeToClose())
389
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
150 return;
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
151
409
8da2563c645a Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
152 delete LDFile::current();
389
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
153 }
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
154
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
155 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
156 // -----------------------------------------------------------------------------
389
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
157 DEFINE_ACTION (CloseAll, 0) {
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
158 if (!safeToCloseAll())
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
159 return;
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
160
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
161 closeAll();
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
162 }
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
163
ccb763dbe98e Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents: 388
diff changeset
164 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
165 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
166 DEFINE_ACTION (Settings, 0) {
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 464
diff changeset
167 (new ConfigDialog)->exec();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
168 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
169
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
170 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
171 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
172 DEFINE_ACTION (SetLDrawPath, 0) {
469
f2faed654633 more changes. Spawn the config prompt on first start, on the profile tab. gl_colorbfc and gl_blackedges now default to false.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 464
diff changeset
173 (new LDrawPathDialog (true))->exec();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
174 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
175
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
176 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
177 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
178 DEFINE_ACTION (Exit, CTRL (Q)) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
179 exit (0);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
180 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
181
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
182 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
183 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
184 DEFINE_ACTION (NewSubfile, 0) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
185 AddObjectDialog::staticDialog (LDObject::Subfile, null);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
186 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
187
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
188 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
189 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
190 DEFINE_ACTION (NewLine, 0) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
191 AddObjectDialog::staticDialog (LDObject::Line, null);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
192 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
193
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
194 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
195 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
196 DEFINE_ACTION (NewTriangle, 0) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
197 AddObjectDialog::staticDialog (LDObject::Triangle, null);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
198 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
199
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
200 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
201 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
202 DEFINE_ACTION (NewQuad, 0) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
203 AddObjectDialog::staticDialog (LDObject::Quad, null);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
204 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
205
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
206 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
207 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
208 DEFINE_ACTION (NewCLine, 0) {
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 455
diff changeset
209 AddObjectDialog::staticDialog (LDObject::CndLine, null);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
210 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
211
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
212 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
213 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
214 DEFINE_ACTION (NewComment, 0) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
215 AddObjectDialog::staticDialog (LDObject::Comment, null);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
216 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
217
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
218 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
219 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
220 DEFINE_ACTION (NewBFC, 0) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
221 AddObjectDialog::staticDialog (LDObject::BFC, null);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
222 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
223
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
224 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
225 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
226 DEFINE_ACTION (NewVertex, 0) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
227 AddObjectDialog::staticDialog (LDObject::Vertex, null);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
228 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
229
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
230 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
231 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
232 DEFINE_ACTION (MakePrimitive, 0) {
310
c62edce5668c Begin converting the radial type into a primitive generator
Santeri Piippo <crimsondusk64@gmail.com>
parents: 292
diff changeset
233 generatePrimitive();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
234 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
235
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
236 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
237 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
238 DEFINE_ACTION (Edit, 0) {
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
239 if (g_win->sel().size() != 1)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
240 return;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
241
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
242 LDObject* obj = g_win->sel()[0];
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
243 AddObjectDialog::staticDialog (obj->getType(), obj);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
244 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
245
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
246 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
247 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
248 DEFINE_ACTION (Help, KEY (F1)) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
249
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
250 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
251
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
252 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
253 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
254 DEFINE_ACTION (About, 0) {
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
255 AboutDialog().exec();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
256 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
257
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
258 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
259 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
260 DEFINE_ACTION (AboutQt, 0) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
261 QMessageBox::aboutQt (g_win);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
262 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
263
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
264 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
265 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
266 DEFINE_ACTION (SelectAll, CTRL (A)) {
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
267 g_win->sel().clear();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
268
484
5b5c77c7f3dd made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents: 472
diff changeset
269 for (LDObject* obj : LDFile::current()->objects())
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
270 g_win->sel() << obj;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
271
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
272 g_win->updateSelection();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
273 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
274
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
275 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
276 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
277 DEFINE_ACTION (SelectByColor, CTRL_SHIFT (A)) {
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
278 short colnum = g_win->getSelectedColor();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
279
266
12e7302f14e9 Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents: 265
diff changeset
280 if (colnum == -1)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
281 return; // no consensus on color
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
282
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
283 g_win->sel().clear();
484
5b5c77c7f3dd made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents: 472
diff changeset
284 for (LDObject* obj : LDFile::current()->objects())
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
285 if (obj->color() == colnum)
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
286 g_win->sel() << obj;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
287
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
288 g_win->updateSelection();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
289 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
290
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
291 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
292 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
293 DEFINE_ACTION (SelectByType, 0) {
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
294 if (g_win->sel().size() == 0)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
295 return;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
296
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
297 LDObject::Type type = g_win->uniformSelectedType();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
298
250
6e80f038e8df Make LDOpenFile's members PROPERTIES
Santeri Piippo <crimsondusk64@gmail.com>
parents: 240
diff changeset
299 if (type == LDObject::Unidentified)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
300 return;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
301
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
302 // If we're selecting subfile references, the reference filename must also
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
303 // be uniform.
250
6e80f038e8df Make LDOpenFile's members PROPERTIES
Santeri Piippo <crimsondusk64@gmail.com>
parents: 240
diff changeset
304 str refName;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
305
250
6e80f038e8df Make LDOpenFile's members PROPERTIES
Santeri Piippo <crimsondusk64@gmail.com>
parents: 240
diff changeset
306 if (type == LDObject::Subfile) {
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 455
diff changeset
307 refName = static_cast<LDSubfile*> (g_win->sel()[0])->fileInfo()->name();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
308
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
309 for (LDObject* obj : g_win->sel())
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 455
diff changeset
310 if (static_cast<LDSubfile*> (obj)->fileInfo()->name() != refName)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
311 return;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
312 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
313
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
314 g_win->sel().clear();
484
5b5c77c7f3dd made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents: 472
diff changeset
315 for (LDObject* obj : LDFile::current()->objects()) {
250
6e80f038e8df Make LDOpenFile's members PROPERTIES
Santeri Piippo <crimsondusk64@gmail.com>
parents: 240
diff changeset
316 if (obj->getType() != type)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
317 continue;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
318
460
b230ae09c8e5 Cut the Object-suffix from LDObject types, it doesn't help things at all
Santeri Piippo <crimsondusk64@gmail.com>
parents: 455
diff changeset
319 if (type == LDObject::Subfile && static_cast<LDSubfile*> (obj)->fileInfo()->name() != refName)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
320 continue;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
321
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
322 g_win->sel() << obj;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
323 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
324
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
325 g_win->updateSelection();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
326 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
327
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
328 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
329 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
330 DEFINE_ACTION (GridCoarse, 0) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
331 grid = Grid::Coarse;
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
332 g_win->updateGridToolBar();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
333 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
334
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
335 DEFINE_ACTION (GridMedium, 0) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
336 grid = Grid::Medium;
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
337 g_win->updateGridToolBar();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
338 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
339
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
340 DEFINE_ACTION (GridFine, 0) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
341 grid = Grid::Fine;
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
342 g_win->updateGridToolBar();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
343 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
344
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
345 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
346 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
347 DEFINE_ACTION (ResetView, CTRL (0)) {
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
348 g_win->R()->resetAngles();
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
349 g_win->R()->update();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
350 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
351
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
352 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
353 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
354 DEFINE_ACTION (InsertFrom, 0) {
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
355 str fname = QFileDialog::getOpenFileName();
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
356 ulong idx = g_win->getInsertionPoint();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
357
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
358 if (!fname.length())
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
359 return;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
360
288
2980d7fd948e Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
361 File f (fname, File::Read);
2980d7fd948e Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents: 286
diff changeset
362 if (!f) {
286
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
363 critical (fmt ("Couldn't open %1 (%2)", fname, strerror (errno)));
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
364 return;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
365 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
366
402
ec95fc95e5f3 Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 391
diff changeset
367 List<LDObject*> objs = loadFileContents (&f, null);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
368
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
369 g_win->sel().clear();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
370
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
371 for (LDObject* obj : objs) {
409
8da2563c645a Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
372 LDFile::current()->insertObj (idx, obj);
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
373 g_win->sel() << obj;
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 416
diff changeset
374 g_win->R()->compileObject (obj);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
375
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
376 idx++;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
377 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
378
414
0f40c56fde23 some further little optimization
Santeri Piippo <crimsondusk64@gmail.com>
parents: 409
diff changeset
379 g_win->refresh();
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
380 g_win->scrollToSelection();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
381 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
382
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
383 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
384 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
385 DEFINE_ACTION (ExportTo, 0) {
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
386 if (g_win->sel().size() == 0)
257
481566b60ecd Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 255
diff changeset
387 return;
481566b60ecd Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 255
diff changeset
388
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
389 str fname = QFileDialog::getSaveFileName();
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
390 if (fname.length() == 0)
257
481566b60ecd Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 255
diff changeset
391 return;
481566b60ecd Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 255
diff changeset
392
481566b60ecd Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 255
diff changeset
393 QFile file (fname);
481566b60ecd Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 255
diff changeset
394 if (!file.open (QIODevice::WriteOnly | QIODevice::Text)) {
286
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
395 critical (fmt ("Unable to open %1 for writing (%2)", fname, strerror (errno)));
257
481566b60ecd Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 255
diff changeset
396 return;
481566b60ecd Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 255
diff changeset
397 }
481566b60ecd Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 255
diff changeset
398
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
399 for (LDObject* obj : g_win->sel()) {
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
400 str contents = obj->raw();
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
401 QByteArray data = contents.toUtf8();
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
402 file.write (data, data.size());
257
481566b60ecd Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 255
diff changeset
403 file.write ("\r\n", 2);
481566b60ecd Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 255
diff changeset
404 }
481566b60ecd Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 255
diff changeset
405 }
481566b60ecd Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 255
diff changeset
406
481566b60ecd Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents: 255
diff changeset
407 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
408 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
409 DEFINE_ACTION (InsertRaw, 0) {
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
410 ulong idx = g_win->getInsertionPoint();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
411
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
412 QDialog* const dlg = new QDialog;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
413 QVBoxLayout* const layout = new QVBoxLayout;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
414 QTextEdit* const te_edit = new QTextEdit;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
415 QDialogButtonBox* const bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
416
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
417 layout->addWidget (te_edit);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
418 layout->addWidget (bbx_buttons);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
419 dlg->setLayout (layout);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
420 dlg->setWindowTitle (APPNAME ": Insert Raw");
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
421 dlg->connect (bbx_buttons, SIGNAL (accepted()), dlg, SLOT (accept()));
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
422 dlg->connect (bbx_buttons, SIGNAL (rejected()), dlg, SLOT (reject()));
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
423
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
424 if (dlg->exec() == false)
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
425 return;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
426
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
427 g_win->sel().clear();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
428
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
429 for (str line : str (te_edit->toPlainText()).split ("\n")) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
430 LDObject* obj = parseLine (line);
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
431
409
8da2563c645a Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
432 LDFile::current()->insertObj (idx, obj);
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
433 g_win->sel() << obj;
421
7d26db0be944 style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents: 416
diff changeset
434 g_win->R()->compileObject (obj);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
435 idx++;
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
436 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
437
414
0f40c56fde23 some further little optimization
Santeri Piippo <crimsondusk64@gmail.com>
parents: 409
diff changeset
438 g_win->refresh();
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
439 g_win->scrollToSelection();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
440 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
441
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
442 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
443 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
444 DEFINE_ACTION (Screenshot, 0) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
445 setlocale (LC_ALL, "C");
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
446
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
447 ushort w, h;
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
448 uchar* imgdata = g_win->R()->screencap (w, h);
255
67d4aedf1041 Added method for zooming to fit, fixed zoom being inappropriate when parts are first loaded
Santeri Piippo <crimsondusk64@gmail.com>
parents: 254
diff changeset
449 QImage img = imageFromScreencap (imgdata, w, h);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
450
409
8da2563c645a Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
451 str root = basename (LDFile::current()->name());
286
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
452 if (root.right (4) == ".dat")
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
453 root.chop (4);
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
454
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
455 str defaultname = (root.length() > 0) ? fmt ("%1.png", root) : "";
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
456 str fname = QFileDialog::getSaveFileName (g_win, "Save Screencap", defaultname,
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
457 "PNG images (*.png);;JPG images (*.jpg);;BMP images (*.bmp);;All Files (*.*)");
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
458
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
459 if (fname.length() > 0 && !img.save (fname))
286
7a562bf3d829 Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents: 270
diff changeset
460 critical (fmt ("Couldn't open %1 for writing to save screencap: %2", fname, strerror (errno)));
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
461
255
67d4aedf1041 Added method for zooming to fit, fixed zoom being inappropriate when parts are first loaded
Santeri Piippo <crimsondusk64@gmail.com>
parents: 254
diff changeset
462 delete[] imgdata;
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
463 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
464
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
465 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
466 // -----------------------------------------------------------------------------
461
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
467 extern_cfg (Bool, gl_axes);
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
468 DEFINE_ACTION (Axes, 0) {
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
469 gl_axes = !gl_axes;
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
470 ACTION (Axes)->setChecked (gl_axes);
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
471 g_win->R()->update();
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
472 }
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
473
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
474 // =============================================================================
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
475 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
476 DEFINE_ACTION (Visibility, 0) {
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
477 for (LDObject* obj : g_win->sel())
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
478 obj->setHidden (!obj->hidden());
183
f1b8cb53d2a2 Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
479
414
0f40c56fde23 some further little optimization
Santeri Piippo <crimsondusk64@gmail.com>
parents: 409
diff changeset
480 g_win->refresh();
193
ce8e25ccbaf6 Added wireframe mode
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
481 }
ce8e25ccbaf6 Added wireframe mode
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
482
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
483 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
484 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
485 DEFINE_ACTION (Wireframe, 0) {
193
ce8e25ccbaf6 Added wireframe mode
Santeri Piippo <crimsondusk64@gmail.com>
parents: 192
diff changeset
486 gl_wireframe = !gl_wireframe;
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
487 g_win->R()->refresh();
195
7a776f6b0d2a Added image overlays, these are offset and scaled photos drawn on top of the part model to help getting part data from pictures.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 193
diff changeset
488 }
7a776f6b0d2a Added image overlays, these are offset and scaled photos drawn on top of the part model to help getting part data from pictures.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 193
diff changeset
489
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
490 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
491 // -----------------------------------------------------------------------------
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
492 DEFINE_ACTION (SetOverlay, 0) {
317
e41ab239ed28 Added ability to load the overlay meta
Santeri Piippo <crimsondusk64@gmail.com>
parents: 315
diff changeset
493 OverlayDialog dlg;
e41ab239ed28 Added ability to load the overlay meta
Santeri Piippo <crimsondusk64@gmail.com>
parents: 315
diff changeset
494
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
495 if (!dlg.exec())
317
e41ab239ed28 Added ability to load the overlay meta
Santeri Piippo <crimsondusk64@gmail.com>
parents: 315
diff changeset
496 return;
e41ab239ed28 Added ability to load the overlay meta
Santeri Piippo <crimsondusk64@gmail.com>
parents: 315
diff changeset
497
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
498 g_win->R()->setupOverlay ((GL::Camera) dlg.camera(), dlg.fpath(), dlg.ofsx(),
335
30c11cff511d Converted overlay prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents: 322
diff changeset
499 dlg.ofsy(), dlg.lwidth(), dlg.lheight() );
195
7a776f6b0d2a Added image overlays, these are offset and scaled photos drawn on top of the part model to help getting part data from pictures.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 193
diff changeset
500 }
7a776f6b0d2a Added image overlays, these are offset and scaled photos drawn on top of the part model to help getting part data from pictures.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 193
diff changeset
501
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
502 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
503 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
504 DEFINE_ACTION (ClearOverlay, 0) {
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
505 g_win->R()->clearOverlay();
207
e8c47e51e03d Made drawing an edit mode, allowing me to add more modes in the future
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
506 }
e8c47e51e03d Made drawing an edit mode, allowing me to add more modes in the future
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
507
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
508 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
509 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
510 DEFINE_ACTION (ModeSelect, CTRL (1)) {
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
511 g_win->R()->setEditMode (Select);
207
e8c47e51e03d Made drawing an edit mode, allowing me to add more modes in the future
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
512 }
e8c47e51e03d Made drawing an edit mode, allowing me to add more modes in the future
Santeri Piippo <crimsondusk64@gmail.com>
parents: 202
diff changeset
513
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
514 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
515 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
516 DEFINE_ACTION (ModeDraw, CTRL (2)) {
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
517 g_win->R()->setEditMode (Draw);
219
70eb948a2b02 Added ability to set the depth value to something else than 0.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 212
diff changeset
518 }
70eb948a2b02 Added ability to set the depth value to something else than 0.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 212
diff changeset
519
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
520 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
521 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
522 DEFINE_ACTION (SetDrawDepth, 0) {
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
523 if (g_win->R()->camera() == GL::Free)
219
70eb948a2b02 Added ability to set the depth value to something else than 0.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 212
diff changeset
524 return;
70eb948a2b02 Added ability to set the depth value to something else than 0.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 212
diff changeset
525
70eb948a2b02 Added ability to set the depth value to something else than 0.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 212
diff changeset
526 bool ok;
70eb948a2b02 Added ability to set the depth value to something else than 0.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 212
diff changeset
527 double depth = QInputDialog::getDouble (g_win, "Set Draw Depth",
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
528 fmt ("Depth value for %1 Camera:", g_win->R()->cameraName()),
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
529 g_win->R()->depthValue(), -10000.0f, 10000.0f, 3, &ok);
219
70eb948a2b02 Added ability to set the depth value to something else than 0.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 212
diff changeset
530
70eb948a2b02 Added ability to set the depth value to something else than 0.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 212
diff changeset
531 if (ok)
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
532 g_win->R()->setDepthValue (depth);
253
0737c217a54d Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
533 }
0737c217a54d Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
534
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
535 #if 0
344
55fcf67230fd Further verbosity, #ifdef the test axle pic out of release builds
Santeri Piippo <crimsondusk64@gmail.com>
parents: 335
diff changeset
536 // This is a test to draw a dummy axle. Meant to be used as a primitive gallery,
55fcf67230fd Further verbosity, #ifdef the test axle pic out of release builds
Santeri Piippo <crimsondusk64@gmail.com>
parents: 335
diff changeset
537 // but I can't figure how to generate these pictures properly. Multi-threading
55fcf67230fd Further verbosity, #ifdef the test axle pic out of release builds
Santeri Piippo <crimsondusk64@gmail.com>
parents: 335
diff changeset
538 // these is an immense pain.
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
539 DEFINE_ACTION (testpic, "Test picture", "", "", (0)) {
409
8da2563c645a Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents: 402
diff changeset
540 LDFile* file = getFile ("axle.dat");
254
434c9844e45d Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
541 setlocale (LC_ALL, "C");
253
0737c217a54d Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
542
0737c217a54d Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
543 if (!file) {
0737c217a54d Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
544 critical ("couldn't load axle.dat");
0737c217a54d Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
545 return;
0737c217a54d Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
546 }
0737c217a54d Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
547
254
434c9844e45d Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
548 ushort w, h;
434c9844e45d Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
549
253
0737c217a54d Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
550 GLRenderer* rend = new GLRenderer;
291
c8547f780861 Make camera icons a member of GLRenderer so multiple renderers won't conflict about them
Santeri Piippo <crimsondusk64@gmail.com>
parents: 290
diff changeset
551 rend->resize (64, 64);
254
434c9844e45d Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
552 rend->setAttribute (Qt::WA_DontShowOnScreen);
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
553 rend->show();
253
0737c217a54d Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
554 rend->setFile (file);
0737c217a54d Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 252
diff changeset
555 rend->setDrawOnly (true);
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
556 rend->compileAllObjects();
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
557 rend->initGLData();
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
558 rend->drawGLScene();
254
434c9844e45d Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
559
255
67d4aedf1041 Added method for zooming to fit, fixed zoom being inappropriate when parts are first loaded
Santeri Piippo <crimsondusk64@gmail.com>
parents: 254
diff changeset
560 uchar* imgdata = rend->screencap (w, h);
67d4aedf1041 Added method for zooming to fit, fixed zoom being inappropriate when parts are first loaded
Santeri Piippo <crimsondusk64@gmail.com>
parents: 254
diff changeset
561 QImage img = imageFromScreencap (imgdata, w, h);
67d4aedf1041 Added method for zooming to fit, fixed zoom being inappropriate when parts are first loaded
Santeri Piippo <crimsondusk64@gmail.com>
parents: 254
diff changeset
562
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
563 if (img.isNull()) {
254
434c9844e45d Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
564 critical ("Failed to create the image!\n");
434c9844e45d Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
565 } else {
434c9844e45d Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
566 QLabel* label = new QLabel;
434c9844e45d Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
567 QDialog* dlg = new QDialog;
434c9844e45d Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
568 label->setPixmap (QPixmap::fromImage (img));
434c9844e45d Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
569 QVBoxLayout* layout = new QVBoxLayout (dlg);
434c9844e45d Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
570 layout->addWidget (label);
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
571 dlg->exec();
254
434c9844e45d Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
572 }
434c9844e45d Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents: 253
diff changeset
573
255
67d4aedf1041 Added method for zooming to fit, fixed zoom being inappropriate when parts are first loaded
Santeri Piippo <crimsondusk64@gmail.com>
parents: 254
diff changeset
574 delete[] imgdata;
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
575 rend->deleteLater();
290
be0c367e7420 Added primitive scanning, replaced parts list in subfile add dialog with it
Santeri Piippo <crimsondusk64@gmail.com>
parents: 288
diff changeset
576 }
344
55fcf67230fd Further verbosity, #ifdef the test axle pic out of release builds
Santeri Piippo <crimsondusk64@gmail.com>
parents: 335
diff changeset
577 #endif
290
be0c367e7420 Added primitive scanning, replaced parts list in subfile add dialog with it
Santeri Piippo <crimsondusk64@gmail.com>
parents: 288
diff changeset
578
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
579 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
580 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
581 DEFINE_ACTION (ScanPrimitives, 0) {
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
582 PrimitiveLister::start();
353
07b3753baedc dded an action to quickly toggle BFC red/green view.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 344
diff changeset
583 }
07b3753baedc dded an action to quickly toggle BFC red/green view.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 344
diff changeset
584
455
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
585 // =============================================================================
c5d14d112034 Code formatting: use same separators everywhere, remove extra spaces from license headers, simplified message manager api a bit
Santeri Piippo <crimsondusk64@gmail.com>
parents: 421
diff changeset
586 // -----------------------------------------------------------------------------
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
587 DEFINE_ACTION (BFCView, SHIFT (B)) {
353
07b3753baedc dded an action to quickly toggle BFC red/green view.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 344
diff changeset
588 gl_colorbfc = !gl_colorbfc;
382
c1642530ea35 Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents: 379
diff changeset
589 ACTION (BFCView)->setChecked (gl_colorbfc);
376
4a89dd47535f Reformatting..
Santeri Piippo <crimsondusk64@gmail.com>
parents: 353
diff changeset
590 g_win->R()->refresh();
461
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
591 }
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
592
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
593 // =============================================================================
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
594 // -----------------------------------------------------------------------------
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
595 DEFINE_ACTION (JumpTo, CTRL (G)) {
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
596 bool ok;
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
597 int defval = 0;
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
598 LDObject* obj;
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
599
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
600 if (g_win->sel().size() == 1)
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
601 defval = g_win->sel()[0]->getIndex();
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
602
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
603 int idx = QInputDialog::getInt (null, "Go to line", "Go to line:", defval,
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
604 1, LDFile::current()->numObjs(), 1, &ok);
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
605
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
606 if (!ok || (obj = LDFile::current()->object (idx - 1)) == null)
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
607 return;
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
608
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
609 g_win->clearSelection();
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
610 g_win->sel() << obj;
fbcc91ae1dd2 - added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents: 460
diff changeset
611 g_win->updateSelection();
240
bdc9d429cdc2 License graphical assets under CC BY-SA 3.0 Unported
Santeri Piippo <crimsondusk64@gmail.com>
parents: 230
diff changeset
612 }

mercurial