Thu, 03 Oct 2013 20:56:20 +0300
last code reformatting i swear
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 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
47 | DEFINE_ACTION (New, CTRL_SHIFT (N)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
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 | 50 | ui.setupUi (dlg); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
51 | |
464
3779a14d597c
added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents:
461
diff
changeset
|
52 | str authortext = ld_defaultname; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
53 | |
464
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)); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
56 | |
464
3779a14d597c
added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents:
461
diff
changeset
|
57 | ui.le_author->setText (authortext); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
58 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
59 | switch (ld_defaultlicense) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
60 | { case 0: |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
61 | ui.rb_license_ca->setChecked (true); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
62 | break; |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
63 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
64 | case 1: |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
65 | ui.rb_license_nonca->setChecked (true); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
66 | break; |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
67 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
68 | case 2: |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
69 | ui.rb_license_none->setChecked (true); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
70 | break; |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
71 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
72 | default: |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
73 | QMessageBox::warning (null, "Warning", |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
74 | fmt ("Unknown ld_defaultlicense value %1!", ld_defaultlicense)); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
75 | break; |
464
3779a14d597c
added profile data auto-filling
Santeri Piippo <crimsondusk64@gmail.com>
parents:
461
diff
changeset
|
76 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
77 | |
376 | 78 | if (dlg->exec() == false) |
315
cb0c23f35e2b
UI-ified the new part prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents:
310
diff
changeset
|
79 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
80 | |
376 | 81 | newFile(); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
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; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
86 | |
315
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 : ""; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
90 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
91 | LDFile::current()->addObjects ( |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
92 | { new LDComment (ui.le_title->text()), |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
93 | new LDComment ("Name: <untitled>.dat"), |
484
5b5c77c7f3dd
made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents:
472
diff
changeset
|
94 | 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
|
95 | new LDComment (fmt ("!LDRAW_ORG Unofficial_Part")), |
5b5c77c7f3dd
made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents:
472
diff
changeset
|
96 | (license != "" ? |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
97 | new LDComment (license) : |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
98 | null), |
484
5b5c77c7f3dd
made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents:
472
diff
changeset
|
99 | new LDEmpty, |
5b5c77c7f3dd
made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents:
472
diff
changeset
|
100 | new LDBFC (BFCType), |
5b5c77c7f3dd
made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents:
472
diff
changeset
|
101 | new LDEmpty, |
5b5c77c7f3dd
made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents:
472
diff
changeset
|
102 | }); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
103 | |
315
cb0c23f35e2b
UI-ified the new part prompt
Santeri Piippo <crimsondusk64@gmail.com>
parents:
310
diff
changeset
|
104 | g_win->fullRefresh(); |
183
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 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
107 | // ============================================================================= |
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
|
108 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
109 | DEFINE_ACTION (NewFile, CTRL (N)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
110 | { newFile(); |
416
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 | |
be1824f53c48
Added an action for creating a new, blank file, improved multi-file stability
Santeri Piippo <crimsondusk64@gmail.com>
parents:
415
diff
changeset
|
113 | // ============================================================================= |
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
|
114 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
115 | DEFINE_ACTION (Open, CTRL (O)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
116 | { str name = QFileDialog::getOpenFileName (g_win, "Open File", "", "LDraw files (*.dat *.ldr)"); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
117 | |
376 | 118 | 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
|
119 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
120 | |
226
3dd9e63698cd
Prompt for unsaved changes before loading or creating a new file
Santeri Piippo <crimsondusk64@gmail.com>
parents:
224
diff
changeset
|
121 | openMainFile (name); |
183
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 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
124 | // ============================================================================= |
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
|
125 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
126 | DEFINE_ACTION (Save, CTRL (S)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
127 | { 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
|
128 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
129 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
130 | // ============================================================================= |
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
|
131 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
132 | DEFINE_ACTION (SaveAs, CTRL_SHIFT (S)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
133 | { 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
|
134 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
135 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
136 | // ============================================================================= |
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
|
137 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
138 | DEFINE_ACTION (SaveAll, CTRL (L)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
139 | { for (LDFile* file : g_loadedFiles) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
140 | { if (file->implicit()) |
389
ccb763dbe98e
Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
388
diff
changeset
|
141 | continue; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
142 | |
389
ccb763dbe98e
Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
388
diff
changeset
|
143 | 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
|
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 | |
ccb763dbe98e
Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
388
diff
changeset
|
147 | // ============================================================================= |
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
|
148 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
149 | DEFINE_ACTION (Close, CTRL (W)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
150 | { 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
|
151 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
152 | |
409
8da2563c645a
Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents:
402
diff
changeset
|
153 | 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
|
154 | } |
ccb763dbe98e
Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
388
diff
changeset
|
155 | |
ccb763dbe98e
Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
388
diff
changeset
|
156 | // ============================================================================= |
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
|
157 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
158 | DEFINE_ACTION (CloseAll, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
159 | { if (!safeToCloseAll()) |
389
ccb763dbe98e
Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
388
diff
changeset
|
160 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
161 | |
389
ccb763dbe98e
Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
388
diff
changeset
|
162 | closeAll(); |
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 | |
ccb763dbe98e
Added actions for saving all files, closing and closing all files
Santeri Piippo <crimsondusk64@gmail.com>
parents:
388
diff
changeset
|
165 | // ============================================================================= |
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
|
166 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
167 | DEFINE_ACTION (Settings, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
168 | { (new ConfigDialog)->exec(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
169 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
170 | |
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
|
171 | // ============================================================================= |
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
|
172 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
173 | DEFINE_ACTION (SetLDrawPath, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
174 | { (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
|
175 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
176 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
177 | // ============================================================================= |
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
|
178 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
179 | DEFINE_ACTION (Exit, CTRL (Q)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
180 | { exit (0); |
183
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 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
183 | // ============================================================================= |
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
|
184 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
185 | DEFINE_ACTION (NewSubfile, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
186 | { AddObjectDialog::staticDialog (LDObject::Subfile, null); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
187 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
188 | |
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
|
189 | // ============================================================================= |
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
|
190 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
191 | DEFINE_ACTION (NewLine, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
192 | { AddObjectDialog::staticDialog (LDObject::Line, null); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
193 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
194 | |
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
|
195 | // ============================================================================= |
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
|
196 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
197 | DEFINE_ACTION (NewTriangle, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
198 | { AddObjectDialog::staticDialog (LDObject::Triangle, null); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
199 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
200 | |
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
|
201 | // ============================================================================= |
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
|
202 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
203 | DEFINE_ACTION (NewQuad, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
204 | { AddObjectDialog::staticDialog (LDObject::Quad, null); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
205 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
206 | |
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
|
207 | // ============================================================================= |
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
|
208 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
209 | DEFINE_ACTION (NewCLine, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
210 | { 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
|
211 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
212 | |
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
|
213 | // ============================================================================= |
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
|
214 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
215 | DEFINE_ACTION (NewComment, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
216 | { AddObjectDialog::staticDialog (LDObject::Comment, null); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
217 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
218 | |
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
|
219 | // ============================================================================= |
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
|
220 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
221 | DEFINE_ACTION (NewBFC, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
222 | { AddObjectDialog::staticDialog (LDObject::BFC, null); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
223 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
224 | |
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
|
225 | // ============================================================================= |
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
|
226 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
227 | DEFINE_ACTION (NewVertex, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
228 | { AddObjectDialog::staticDialog (LDObject::Vertex, null); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
229 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
230 | |
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
|
231 | // ============================================================================= |
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
|
232 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
233 | DEFINE_ACTION (MakePrimitive, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
234 | { generatePrimitive(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
235 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
236 | |
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
|
237 | // ============================================================================= |
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
|
238 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
239 | DEFINE_ACTION (Edit, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
240 | { 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
|
241 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
242 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
243 | LDObject* obj = g_win->sel() [0]; |
376 | 244 | 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
|
245 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
246 | |
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
|
247 | // ============================================================================= |
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
|
248 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
249 | DEFINE_ACTION (Help, KEY (F1)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
250 | { |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
251 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
252 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
253 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
254 | // ============================================================================= |
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
|
255 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
256 | DEFINE_ACTION (About, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
257 | { AboutDialog().exec(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
258 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
259 | |
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
|
260 | // ============================================================================= |
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
|
261 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
262 | DEFINE_ACTION (AboutQt, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
263 | { QMessageBox::aboutQt (g_win); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
264 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
265 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
266 | // ============================================================================= |
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
|
267 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
268 | DEFINE_ACTION (SelectAll, CTRL (A)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
269 | { g_win->sel().clear(); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
270 | |
484
5b5c77c7f3dd
made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents:
472
diff
changeset
|
271 | for (LDObject* obj : LDFile::current()->objects()) |
376 | 272 | g_win->sel() << obj; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
273 | |
376 | 274 | g_win->updateSelection(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
275 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
276 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
277 | // ============================================================================= |
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
|
278 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
279 | DEFINE_ACTION (SelectByColor, CTRL_SHIFT (A)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
280 | { short colnum = g_win->getSelectedColor(); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
281 | |
266
12e7302f14e9
Make LDObject's color and parent properties with accessors
Santeri Piippo <crimsondusk64@gmail.com>
parents:
265
diff
changeset
|
282 | if (colnum == -1) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
283 | return; // no consensus on color |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
284 | |
376 | 285 | g_win->sel().clear(); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
286 | |
484
5b5c77c7f3dd
made LDFile interfacing a bit clearer
Santeri Piippo <crimsondusk64@gmail.com>
parents:
472
diff
changeset
|
287 | for (LDObject* obj : LDFile::current()->objects()) |
376 | 288 | if (obj->color() == colnum) |
289 | g_win->sel() << obj; | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
290 | |
376 | 291 | g_win->updateSelection(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
292 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
293 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
294 | // ============================================================================= |
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
|
295 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
296 | DEFINE_ACTION (SelectByType, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
297 | { 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
|
298 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
299 | |
376 | 300 | LDObject::Type type = g_win->uniformSelectedType(); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
301 | |
250
6e80f038e8df
Make LDOpenFile's members PROPERTIES
Santeri Piippo <crimsondusk64@gmail.com>
parents:
240
diff
changeset
|
302 | 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
|
303 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
304 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
305 | // 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
|
306 | // be uniform. |
250
6e80f038e8df
Make LDOpenFile's members PROPERTIES
Santeri Piippo <crimsondusk64@gmail.com>
parents:
240
diff
changeset
|
307 | str refName; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
308 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
309 | if (type == LDObject::Subfile) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
310 | { refName = static_cast<LDSubfile*> (g_win->sel() [0])->fileInfo()->name(); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
311 | |
376 | 312 | 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
|
313 | 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
|
314 | return; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
315 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
316 | |
376 | 317 | g_win->sel().clear(); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
318 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
319 | for (LDObject* obj : LDFile::current()->objects()) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
320 | { 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
|
321 | continue; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
322 | |
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
|
323 | 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
|
324 | continue; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
325 | |
376 | 326 | 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
|
327 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
328 | |
376 | 329 | g_win->updateSelection(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
330 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
331 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
332 | // ============================================================================= |
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
|
333 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
334 | DEFINE_ACTION (GridCoarse, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
335 | { grid = Grid::Coarse; |
376 | 336 | g_win->updateGridToolBar(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
337 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
338 | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
339 | DEFINE_ACTION (GridMedium, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
340 | { grid = Grid::Medium; |
376 | 341 | g_win->updateGridToolBar(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
342 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
343 | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
344 | DEFINE_ACTION (GridFine, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
345 | { grid = Grid::Fine; |
376 | 346 | g_win->updateGridToolBar(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
347 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
348 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
349 | // ============================================================================= |
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
|
350 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
351 | DEFINE_ACTION (ResetView, CTRL (0)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
352 | { g_win->R()->resetAngles(); |
376 | 353 | 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
|
354 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
355 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
356 | // ============================================================================= |
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
|
357 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
358 | DEFINE_ACTION (InsertFrom, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
359 | { str fname = QFileDialog::getOpenFileName(); |
376 | 360 | ulong idx = g_win->getInsertionPoint(); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
361 | |
376 | 362 | if (!fname.length()) |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
363 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
364 | |
288
2980d7fd948e
Converted from C-style fopen to the new File class
Santeri Piippo <crimsondusk64@gmail.com>
parents:
286
diff
changeset
|
365 | File f (fname, File::Read); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
366 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
367 | if (!f) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
368 | { 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
|
369 | return; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
370 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
371 | |
402
ec95fc95e5f3
Renamed vector to List, changed it to wrap around std::deque.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
391
diff
changeset
|
372 | List<LDObject*> objs = loadFileContents (&f, null); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
373 | |
376 | 374 | g_win->sel().clear(); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
375 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
376 | for (LDObject* obj : objs) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
377 | { LDFile::current()->insertObj (idx, obj); |
376 | 378 | g_win->sel() << obj; |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
416
diff
changeset
|
379 | g_win->R()->compileObject (obj); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
380 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
381 | idx++; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
382 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
383 | |
414
0f40c56fde23
some further little optimization
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
384 | g_win->refresh(); |
376 | 385 | g_win->scrollToSelection(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
386 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
387 | |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
388 | // ============================================================================= |
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
|
389 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
390 | DEFINE_ACTION (ExportTo, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
391 | { 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
|
392 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
393 | |
376 | 394 | str fname = QFileDialog::getSaveFileName(); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
395 | |
376 | 396 | 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
|
397 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
398 | |
257
481566b60ecd
Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
255
diff
changeset
|
399 | QFile file (fname); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
400 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
401 | if (!file.open (QIODevice::WriteOnly | QIODevice::Text)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
402 | { 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
|
403 | return; |
481566b60ecd
Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
255
diff
changeset
|
404 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
405 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
406 | for (LDObject* obj : g_win->sel()) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
407 | { str contents = obj->raw(); |
376 | 408 | QByteArray data = contents.toUtf8(); |
409 | 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
|
410 | 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
|
411 | } |
481566b60ecd
Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
255
diff
changeset
|
412 | } |
481566b60ecd
Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
255
diff
changeset
|
413 | |
481566b60ecd
Added Export To File action, moved it + insert from to File menu
Santeri Piippo <crimsondusk64@gmail.com>
parents:
255
diff
changeset
|
414 | // ============================================================================= |
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
|
415 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
416 | DEFINE_ACTION (InsertRaw, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
417 | { ulong idx = g_win->getInsertionPoint(); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
418 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
419 | 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
|
420 | 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
|
421 | 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
|
422 | QDialogButtonBox* const bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
423 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
424 | layout->addWidget (te_edit); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
425 | layout->addWidget (bbx_buttons); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
426 | dlg->setLayout (layout); |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
427 | dlg->setWindowTitle (APPNAME ": Insert Raw"); |
376 | 428 | dlg->connect (bbx_buttons, SIGNAL (accepted()), dlg, SLOT (accept())); |
429 | dlg->connect (bbx_buttons, SIGNAL (rejected()), dlg, SLOT (reject())); | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
430 | |
376 | 431 | 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
|
432 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
433 | |
376 | 434 | g_win->sel().clear(); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
435 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
436 | for (str line : str (te_edit->toPlainText()).split ("\n")) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
437 | { LDObject* obj = parseLine (line); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
438 | |
409
8da2563c645a
Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents:
402
diff
changeset
|
439 | LDFile::current()->insertObj (idx, obj); |
376 | 440 | g_win->sel() << obj; |
421
7d26db0be944
style cleanup - it should be all unified now
Santeri Piippo <crimsondusk64@gmail.com>
parents:
416
diff
changeset
|
441 | 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
|
442 | idx++; |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
443 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
444 | |
414
0f40c56fde23
some further little optimization
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
445 | g_win->refresh(); |
376 | 446 | g_win->scrollToSelection(); |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
447 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
448 | |
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
|
449 | // ============================================================================= |
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
|
450 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
451 | DEFINE_ACTION (Screenshot, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
452 | { setlocale (LC_ALL, "C"); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
453 | |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
454 | ushort w, h; |
376 | 455 | 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
|
456 | QImage img = imageFromScreencap (imgdata, w, h); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
457 | |
409
8da2563c645a
Renamed LDOpenFile to LDFile
Santeri Piippo <crimsondusk64@gmail.com>
parents:
402
diff
changeset
|
458 | str root = basename (LDFile::current()->name()); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
459 | |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
460 | if (root.right (4) == ".dat") |
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
461 | root.chop (4); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
462 | |
376 | 463 | 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
|
464 | str fname = QFileDialog::getSaveFileName (g_win, "Save Screencap", defaultname, |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
465 | "PNG images (*.png);;JPG images (*.jpg);;BMP images (*.bmp);;All Files (*.*)"); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
466 | |
376 | 467 | if (fname.length() > 0 && !img.save (fname)) |
286
7a562bf3d829
Converted to 16-bit strings.. again
Santeri Piippo <crimsondusk64@gmail.com>
parents:
270
diff
changeset
|
468 | critical (fmt ("Couldn't open %1 for writing to save screencap: %2", fname, strerror (errno))); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
469 | |
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
|
470 | delete[] imgdata; |
183
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
471 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
472 | |
382
c1642530ea35
Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
379
diff
changeset
|
473 | // ============================================================================= |
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
|
474 | // ----------------------------------------------------------------------------- |
461
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
475 | extern_cfg (Bool, gl_axes); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
476 | DEFINE_ACTION (Axes, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
477 | { gl_axes = !gl_axes; |
382
c1642530ea35
Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
379
diff
changeset
|
478 | ACTION (Axes)->setChecked (gl_axes); |
376 | 479 | 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
|
480 | } |
f1b8cb53d2a2
Moved source files to src/, removed zz_ prefix off dialog files.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
481 | |
382
c1642530ea35
Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
379
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 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
484 | DEFINE_ACTION (Visibility, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
485 | { for (LDObject* obj : g_win->sel()) |
376 | 486 | obj->setHidden (!obj->hidden()); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
487 | |
414
0f40c56fde23
some further little optimization
Santeri Piippo <crimsondusk64@gmail.com>
parents:
409
diff
changeset
|
488 | g_win->refresh(); |
193
ce8e25ccbaf6
Added wireframe mode
Santeri Piippo <crimsondusk64@gmail.com>
parents:
192
diff
changeset
|
489 | } |
ce8e25ccbaf6
Added wireframe mode
Santeri Piippo <crimsondusk64@gmail.com>
parents:
192
diff
changeset
|
490 | |
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
|
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 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
493 | DEFINE_ACTION (Wireframe, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
494 | { gl_wireframe = !gl_wireframe; |
376 | 495 | 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
|
496 | } |
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
|
497 | |
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
|
498 | // ============================================================================= |
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
|
499 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
500 | DEFINE_ACTION (SetOverlay, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
501 | { OverlayDialog dlg; |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
502 | |
376 | 503 | if (!dlg.exec()) |
317
e41ab239ed28
Added ability to load the overlay meta
Santeri Piippo <crimsondusk64@gmail.com>
parents:
315
diff
changeset
|
504 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
505 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
506 | g_win->R()->setupOverlay ( (GL::Camera) dlg.camera(), dlg.fpath(), dlg.ofsx(), |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
507 | 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
|
508 | } |
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
|
509 | |
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
|
510 | // ============================================================================= |
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
|
511 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
512 | DEFINE_ACTION (ClearOverlay, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
513 | { 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
|
514 | } |
e8c47e51e03d
Made drawing an edit mode, allowing me to add more modes in the future
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
515 | |
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
|
516 | // ============================================================================= |
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
|
517 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
518 | DEFINE_ACTION (ModeSelect, CTRL (1)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
519 | { 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
|
520 | } |
e8c47e51e03d
Made drawing an edit mode, allowing me to add more modes in the future
Santeri Piippo <crimsondusk64@gmail.com>
parents:
202
diff
changeset
|
521 | |
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
|
522 | // ============================================================================= |
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
|
523 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
524 | DEFINE_ACTION (ModeDraw, CTRL (2)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
525 | { 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
|
526 | } |
70eb948a2b02
Added ability to set the depth value to something else than 0.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
212
diff
changeset
|
527 | |
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
|
528 | // ============================================================================= |
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
|
529 | // ----------------------------------------------------------------------------- |
492
e964085e6913
Added a new editing mode for drawing circles.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
485
diff
changeset
|
530 | DEFINE_ACTION (ModeCircle, CTRL (3)) |
e964085e6913
Added a new editing mode for drawing circles.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
485
diff
changeset
|
531 | { g_win->R()->setEditMode (CircleMode); |
e964085e6913
Added a new editing mode for drawing circles.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
485
diff
changeset
|
532 | } |
e964085e6913
Added a new editing mode for drawing circles.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
485
diff
changeset
|
533 | |
e964085e6913
Added a new editing mode for drawing circles.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
485
diff
changeset
|
534 | // ============================================================================= |
e964085e6913
Added a new editing mode for drawing circles.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
485
diff
changeset
|
535 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
536 | DEFINE_ACTION (SetDrawDepth, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
537 | { 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
|
538 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
539 | |
219
70eb948a2b02
Added ability to set the depth value to something else than 0.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
212
diff
changeset
|
540 | bool ok; |
70eb948a2b02
Added ability to set the depth value to something else than 0.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
212
diff
changeset
|
541 | double depth = QInputDialog::getDouble (g_win, "Set Draw Depth", |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
542 | fmt ("Depth value for %1 Camera:", g_win->R()->cameraName()), |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
543 | g_win->R()->depthValue(), -10000.0f, 10000.0f, 3, &ok); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
544 | |
219
70eb948a2b02
Added ability to set the depth value to something else than 0.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
212
diff
changeset
|
545 | if (ok) |
376 | 546 | g_win->R()->setDepthValue (depth); |
253
0737c217a54d
Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
252
diff
changeset
|
547 | } |
0737c217a54d
Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
252
diff
changeset
|
548 | |
382
c1642530ea35
Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
379
diff
changeset
|
549 | #if 0 |
344
55fcf67230fd
Further verbosity, #ifdef the test axle pic out of release builds
Santeri Piippo <crimsondusk64@gmail.com>
parents:
335
diff
changeset
|
550 | // 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
|
551 | // 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
|
552 | // these is an immense pain. |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
553 | DEFINE_ACTION (testpic, "Test picture", "", "", (0)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
554 | { LDFile* file = getFile ("axle.dat"); |
254
434c9844e45d
Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
555 | setlocale (LC_ALL, "C"); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
556 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
557 | if (!file) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
558 | { critical ("couldn't load axle.dat"); |
253
0737c217a54d
Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
252
diff
changeset
|
559 | return; |
0737c217a54d
Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
252
diff
changeset
|
560 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
561 | |
254
434c9844e45d
Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
562 | ushort w, h; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
563 | |
253
0737c217a54d
Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
252
diff
changeset
|
564 | 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
|
565 | rend->resize (64, 64); |
254
434c9844e45d
Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
566 | rend->setAttribute (Qt::WA_DontShowOnScreen); |
376 | 567 | rend->show(); |
253
0737c217a54d
Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
252
diff
changeset
|
568 | rend->setFile (file); |
0737c217a54d
Added ability to have multiple GLRenderers
Santeri Piippo <crimsondusk64@gmail.com>
parents:
252
diff
changeset
|
569 | rend->setDrawOnly (true); |
376 | 570 | rend->compileAllObjects(); |
571 | rend->initGLData(); | |
572 | rend->drawGLScene(); | |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
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 | 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
|
575 | QImage img = imageFromScreencap (imgdata, w, h); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
576 | |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
577 | if (img.isNull()) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
578 | { critical ("Failed to create the image!\n"); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
579 | } |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
580 | else |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
581 | { QLabel* label = new QLabel; |
254
434c9844e45d
Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
582 | QDialog* dlg = new QDialog; |
434c9844e45d
Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
583 | label->setPixmap (QPixmap::fromImage (img)); |
434c9844e45d
Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
584 | QVBoxLayout* layout = new QVBoxLayout (dlg); |
434c9844e45d
Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
585 | layout->addWidget (label); |
376 | 586 | dlg->exec(); |
254
434c9844e45d
Further work on image generation experiment
Santeri Piippo <crimsondusk64@gmail.com>
parents:
253
diff
changeset
|
587 | } |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
588 | |
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
|
589 | delete[] imgdata; |
376 | 590 | 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
|
591 | } |
344
55fcf67230fd
Further verbosity, #ifdef the test axle pic out of release builds
Santeri Piippo <crimsondusk64@gmail.com>
parents:
335
diff
changeset
|
592 | #endif |
290
be0c367e7420
Added primitive scanning, replaced parts list in subfile add dialog with it
Santeri Piippo <crimsondusk64@gmail.com>
parents:
288
diff
changeset
|
593 | |
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
|
594 | // ============================================================================= |
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
|
595 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
596 | DEFINE_ACTION (ScanPrimitives, 0) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
597 | { PrimitiveLister::start(); |
353
07b3753baedc
dded an action to quickly toggle BFC red/green view.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
344
diff
changeset
|
598 | } |
07b3753baedc
dded an action to quickly toggle BFC red/green view.
Santeri Piippo <crimsondusk64@gmail.com>
parents:
344
diff
changeset
|
599 | |
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
|
600 | // ============================================================================= |
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
|
601 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
602 | DEFINE_ACTION (BFCView, SHIFT (B)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
603 | { gl_colorbfc = !gl_colorbfc; |
382
c1642530ea35
Converted ForgeWindow to Designer UI(!)
Santeri Piippo <crimsondusk64@gmail.com>
parents:
379
diff
changeset
|
604 | ACTION (BFCView)->setChecked (gl_colorbfc); |
376 | 605 | 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
|
606 | } |
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
607 | |
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 | // ----------------------------------------------------------------------------- |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
610 | DEFINE_ACTION (JumpTo, CTRL (G)) |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
611 | { bool ok; |
461
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
612 | 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
|
613 | LDObject* obj; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
614 | |
461
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
615 | if (g_win->sel().size() == 1) |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
616 | defval = g_win->sel() [0]->getIndex(); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
617 | |
461
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
618 | int idx = QInputDialog::getInt (null, "Go to line", "Go to line:", defval, |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
619 | 1, LDFile::current()->numObjs(), 1, &ok); |
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
620 | |
461
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
621 | 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
|
622 | return; |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
623 | |
461
fbcc91ae1dd2
- added "Go to line" action, renamed the config classes to proper camelcase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
460
diff
changeset
|
624 | 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
|
625 | 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
|
626 | g_win->updateSelection(); |
493
16766ac1bbd9
last code reformatting i swear
Santeri Piippo <crimsondusk64@gmail.com>
parents:
492
diff
changeset
|
627 | } |