src/actions.cpp

Wed, 04 Mar 2015 15:37:21 +0200

author
Teemu Piippo <crimsondusk64@gmail.com>
date
Wed, 04 Mar 2015 15:37:21 +0200
branch
projects
changeset 936
aee883858c90
parent 931
85080f7a1c20
child 941
f895379d7fab
permissions
-rw-r--r--

- commit work done on projects

655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
1 /*
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
2 * LDForge: LDraw parts authoring CAD
927
409b82a4765e - bump copyright year
Teemu Piippo <crimsondusk64@gmail.com>
parents: 892
diff changeset
3 * Copyright (C) 2013 - 2015 Teemu Piippo
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
4 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
5 * This program is free software: you can redistribute it and/or modify
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
6 * it under the terms of the GNU General Public License as published by
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
7 * the Free Software Foundation, either version 3 of the License, or
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
8 * (at your option) any later version.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
9 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
10 * This program is distributed in the hope that it will be useful,
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
13 * GNU General Public License for more details.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
14 *
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
16 * along with this program. If not, see <http://www.gnu.org/licenses/>.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
17 */
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
18
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
19 #include <QFileDialog>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
20 #include <QMessageBox>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
21 #include <QTextEdit>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
22 #include <QBoxLayout>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
23 #include <QDialogButtonBox>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
24 #include <QPushButton>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
25 #include <QInputDialog>
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
26
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
27 #include "mainWindow.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
28 #include "ldDocument.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
29 #include "editHistory.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
30 #include "configDialog.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
31 #include "addObjectDialog.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
32 #include "miscallenous.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
33 #include "glRenderer.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
34 #include "dialogs.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
35 #include "primitives.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
36 #include "radioGroup.h"
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
37 #include "colors.h"
706
d79083b9f74d Merge ../ldforge into gl
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
38 #include "glCompiler.h"
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
39 #include "ui_newpart.h"
830
a741a0b9df49 - updated filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents: 827
diff changeset
40 #include "editmodes/abstractEditMode.h"
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
41
852
cbd89b33f70d - down with all these unnecessary semicolons!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 851
diff changeset
42 EXTERN_CFGENTRY (Bool, DrawWireframe)
cbd89b33f70d - down with all these unnecessary semicolons!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 851
diff changeset
43 EXTERN_CFGENTRY (Bool, BFCRedGreenView)
cbd89b33f70d - down with all these unnecessary semicolons!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 851
diff changeset
44 EXTERN_CFGENTRY (String, DefaultName)
cbd89b33f70d - down with all these unnecessary semicolons!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 851
diff changeset
45 EXTERN_CFGENTRY (String, DefaultUser)
cbd89b33f70d - down with all these unnecessary semicolons!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 851
diff changeset
46 EXTERN_CFGENTRY (Bool, UseCALicense)
cbd89b33f70d - down with all these unnecessary semicolons!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 851
diff changeset
47 EXTERN_CFGENTRY (Bool, DrawAngles)
850
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
48 EXTERN_CFGENTRY (Bool, RandomColors)
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
49 EXTERN_CFGENTRY (Bool, DrawSurfaces)
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
50 EXTERN_CFGENTRY (Bool, DrawEdgeLines)
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
51 EXTERN_CFGENTRY (Bool, DrawConditionalLines)
852
cbd89b33f70d - down with all these unnecessary semicolons!
Teemu Piippo <crimsondusk64@gmail.com>
parents: 851
diff changeset
52 EXTERN_CFGENTRY (Bool, DrawAxes)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
53
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
54 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
55 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
56 void MainWindow::actionNew()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
57 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
58 QDialog* dlg = new QDialog (g_win);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
59 Ui::NewPartUI ui;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
60 ui.setupUi (dlg);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
61
850
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
62 QString authortext = cfg::DefaultName;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
63
850
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
64 if (not cfg::DefaultUser.isEmpty())
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
65 authortext.append (format (" [%1]", cfg::DefaultUser));
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
66
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
67 ui.le_author->setText (authortext);
848
68410477c8bb - refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents: 847
diff changeset
68 ui.caLicense->setChecked (cfg::UseCALicense);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
69
662
2f1bd9112408 - use the keyword 'not' in place of the exclamation mark for operator!, this is clearer. also converted uses of '== false' to this.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
70 if (dlg->exec() == QDialog::Rejected)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
71 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
72
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
73 newFile();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
74
847
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
75 BFCStatement const bfctype = ui.rb_bfc_ccw->isChecked() ? BFCStatement::CertifyCCW
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
76 : ui.rb_bfc_cw->isChecked() ? BFCStatement::CertifyCW
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
77 : BFCStatement::NoCertify;
848
68410477c8bb - refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents: 847
diff changeset
78 QString const license = ui.caLicense->isChecked() ? CALicenseText : "";
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
79
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
80 LDObjectList objs;
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
81 objs << LDSpawn<LDComment> (ui.le_title->text());
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
82 objs << LDSpawn<LDComment> ("Name: <untitled>.dat");
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
83 objs << LDSpawn<LDComment> (format ("Author: %1", ui.le_author->text()));
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
84 objs << LDSpawn<LDComment> (format ("!LDRAW_ORG Unofficial_Part"));
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
85
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
86 if (not license.isEmpty())
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
87 objs << LDSpawn<LDComment> (license);
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
88
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
89 objs << LDSpawn<LDEmpty>();
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
90 objs << LDSpawn<LDBFC> (bfctype);
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
91 objs << LDSpawn<LDEmpty>();
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
92 CurrentDocument()->addObjects (objs);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
93 doFullRefresh();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
94 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
95
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
96 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
97 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
98 void MainWindow::actionNewFile()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
99 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
100 newFile();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
101 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
102
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
103 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
104 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
105 void MainWindow::actionOpen()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
106 {
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
107 QString name = QFileDialog::getOpenFileName (g_win, "Open File", "", "LDraw files (*.dat *.ldr)");
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
108
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
109 if (name.isEmpty())
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
110 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
111
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
112 OpenMainModel (name);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
113 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
114
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
115 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
116 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
117 void MainWindow::actionSave()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
118 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
119 save (CurrentDocument(), false);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
120 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
121
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
122 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
123 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
124 void MainWindow::actionSaveAs()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
125 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
126 save (CurrentDocument(), true);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
127 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
128
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
129 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
130 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
131 void MainWindow::actionSaveAll()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
132 {
784
f82ab4d3c7b4 - made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents: 773
diff changeset
133 for (LDDocumentPtr file : LDDocument::explicitDocuments())
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
134 save (file, false);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
135 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
136
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
137 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
138 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
139 void MainWindow::actionClose()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
140 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
141 if (not CurrentDocument()->isSafeToClose())
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
142 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
143
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
144 CurrentDocument()->dismiss();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
145 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
146
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
147 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
148 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
149 void MainWindow::actionCloseAll()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
150 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
151 if (not IsSafeToCloseAll())
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
152 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
153
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
154 CloseAllDocuments();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
155 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
156
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
157 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
158 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
159 void MainWindow::actionSettings()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
160 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
161 (new ConfigDialog)->exec();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
162 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
163
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
164 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
165 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
166 void MainWindow::actionSetLDrawPath()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
167 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
168 (new LDrawPathDialog (true))->exec();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
169 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
170
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
171 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
172 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
173 void MainWindow::actionExit()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
174 {
857
e62983881460 - fixed crash-on-exit (simply by not running full destruction processing during program termination)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 852
diff changeset
175 Exit();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
176 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
177
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
178 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
179 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
180 void MainWindow::actionNewSubfile()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
181 {
786
71d786ce0dcc - LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 784
diff changeset
182 AddObjectDialog::staticDialog (OBJ_Subfile, LDObjectPtr());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
183 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
184
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
185 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
186 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
187 void MainWindow::actionNewLine()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
188 {
786
71d786ce0dcc - LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 784
diff changeset
189 AddObjectDialog::staticDialog (OBJ_Line, LDObjectPtr());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
190 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
191
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
192 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
193 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
194 void MainWindow::actionNewTriangle()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
195 {
786
71d786ce0dcc - LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 784
diff changeset
196 AddObjectDialog::staticDialog (OBJ_Triangle, LDObjectPtr());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
197 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
198
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
199 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
200 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
201 void MainWindow::actionNewQuad()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
202 {
786
71d786ce0dcc - LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 784
diff changeset
203 AddObjectDialog::staticDialog (OBJ_Quad, LDObjectPtr());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
204 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
205
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
206 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
207 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
208 void MainWindow::actionNewCLine()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
209 {
786
71d786ce0dcc - LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 784
diff changeset
210 AddObjectDialog::staticDialog (OBJ_CondLine, LDObjectPtr());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
211 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
212
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
213 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
214 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
215 void MainWindow::actionNewComment()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
216 {
786
71d786ce0dcc - LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 784
diff changeset
217 AddObjectDialog::staticDialog (OBJ_Comment, LDObjectPtr());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
218 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
219
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
220 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
221 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
222 void MainWindow::actionNewBFC()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
223 {
786
71d786ce0dcc - LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents: 784
diff changeset
224 AddObjectDialog::staticDialog (OBJ_BFC, LDObjectPtr());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
225 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
226
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
227 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
228 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
229 void MainWindow::actionEdit()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
230 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
231 if (Selection().size() != 1)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
232 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
233
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
234 LDObjectPtr obj = Selection() [0];
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
235 AddObjectDialog::staticDialog (obj->type(), obj);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
236 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
237
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
238 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
239 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
240 void MainWindow::actionHelp()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
241 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
242 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
243
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
244 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
245 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
246 void MainWindow::actionAbout()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
247 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
248 AboutDialog().exec();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
249 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
250
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
251 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
252 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
253 void MainWindow::actionAboutQt()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
254 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
255 QMessageBox::aboutQt (g_win);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
256 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
257
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
258 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
259 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
260 void MainWindow::actionSelectAll()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
261 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
262 for (LDObjectPtr obj : CurrentDocument()->objects())
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
263 obj->select();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
264 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
265
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
266 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
267 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
268 void MainWindow::actionSelectByColor()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
269 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
270 if (Selection().isEmpty())
787
67cc5b47bbff - made select by color/type no longer require uniform selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 786
diff changeset
271 return;
67cc5b47bbff - made select by color/type no longer require uniform selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 786
diff changeset
272
795
195fa1fff9c3 - changed all color usage to use LDColor classes instead of color indices. Added support for direct colors.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 789
diff changeset
273 QList<LDColor> colors;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
274
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
275 for (LDObjectPtr obj : Selection())
787
67cc5b47bbff - made select by color/type no longer require uniform selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 786
diff changeset
276 {
67cc5b47bbff - made select by color/type no longer require uniform selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 786
diff changeset
277 if (obj->isColored())
67cc5b47bbff - made select by color/type no longer require uniform selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 786
diff changeset
278 colors << obj->color();
67cc5b47bbff - made select by color/type no longer require uniform selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 786
diff changeset
279 }
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
280
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
281 RemoveDuplicates (colors);
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
282 CurrentDocument()->clearSelection();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
283
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
284 for (LDObjectPtr obj : CurrentDocument()->objects())
787
67cc5b47bbff - made select by color/type no longer require uniform selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 786
diff changeset
285 {
67cc5b47bbff - made select by color/type no longer require uniform selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 786
diff changeset
286 if (colors.contains (obj->color()))
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
287 obj->select();
787
67cc5b47bbff - made select by color/type no longer require uniform selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 786
diff changeset
288 }
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
289 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
290
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
291 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
292 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
293 void MainWindow::actionSelectByType()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
294 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
295 if (Selection().isEmpty())
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
296 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
297
787
67cc5b47bbff - made select by color/type no longer require uniform selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 786
diff changeset
298 QList<LDObjectType> types;
67cc5b47bbff - made select by color/type no longer require uniform selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 786
diff changeset
299 QStringList subfilenames;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
300
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
301 for (LDObjectPtr obj : Selection())
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
302 {
787
67cc5b47bbff - made select by color/type no longer require uniform selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 786
diff changeset
303 types << obj->type();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
304
787
67cc5b47bbff - made select by color/type no longer require uniform selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 786
diff changeset
305 if (types.last() == OBJ_Subfile)
67cc5b47bbff - made select by color/type no longer require uniform selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 786
diff changeset
306 subfilenames << obj.staticCast<LDSubfile>()->fileInfo()->name();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
307 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
308
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
309 RemoveDuplicates (types);
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
310 RemoveDuplicates (subfilenames);
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
311 CurrentDocument()->clearSelection();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
312
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
313 for (LDObjectPtr obj : CurrentDocument()->objects())
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
314 {
787
67cc5b47bbff - made select by color/type no longer require uniform selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 786
diff changeset
315 LDObjectType type = obj->type();
67cc5b47bbff - made select by color/type no longer require uniform selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 786
diff changeset
316
67cc5b47bbff - made select by color/type no longer require uniform selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 786
diff changeset
317 if (not types.contains (type))
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
318 continue;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
319
787
67cc5b47bbff - made select by color/type no longer require uniform selection
Santeri Piippo <crimsondusk64@gmail.com>
parents: 786
diff changeset
320 // For subfiles, type check is not enough, we check the name of the document as well.
840
d077dd19bf9a - changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents: 830
diff changeset
321 if (type == OBJ_Subfile and not subfilenames.contains (obj.staticCast<LDSubfile>()->fileInfo()->name()))
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
322 continue;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
323
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
324 obj->select();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
325 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
326 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
327
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
328 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
329 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
330 void MainWindow::actionGridCoarse()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
331 {
850
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
332 cfg::Grid = Grid::Coarse;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
333 updateGridToolBar();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
334 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
335
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
336 void MainWindow::actionGridMedium()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
337 {
850
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
338 cfg::Grid = Grid::Medium;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
339 updateGridToolBar();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
340 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
341
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
342 void MainWindow::actionGridFine()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
343 {
850
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
344 cfg::Grid = Grid::Fine;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
345 updateGridToolBar();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
346 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
347
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
348 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
349 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
350 void MainWindow::actionResetView()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
351 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
352 R()->resetAngles();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
353 R()->update();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
354 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
355
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
356 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
357 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
358 void MainWindow::actionInsertFrom()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
359 {
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
360 QString fname = QFileDialog::getOpenFileName();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
361 int idx = getInsertionPoint();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
362
662
2f1bd9112408 - use the keyword 'not' in place of the exclamation mark for operator!, this is clearer. also converted uses of '== false' to this.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
363 if (not fname.length())
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
364 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
365
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
366 QFile f (fname);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
367
662
2f1bd9112408 - use the keyword 'not' in place of the exclamation mark for operator!, this is clearer. also converted uses of '== false' to this.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
368 if (not f.open (QIODevice::ReadOnly))
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
369 {
882
2f3cc8e045d5 - fixed compilation on windows
Teemu Piippo <crimsondusk64@gmail.com>
parents: 876
diff changeset
370 Critical (format ("Couldn't open %1 (%2)", fname, f.errorString()));
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
371 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
372 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
373
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
374 LDObjectList objs = LoadFileContents (&f, null);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
375
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
376 CurrentDocument()->clearSelection();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
377
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
378 for (LDObjectPtr obj : objs)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
379 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
380 CurrentDocument()->insertObj (idx, obj);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
381 obj->select();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
382 R()->compileObject (obj);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
383
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
384 idx++;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
385 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
386
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
387 refresh();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
388 scrollToSelection();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
389 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
390
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
391 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
392 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
393 void MainWindow::actionExportTo()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
394 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
395 if (Selection().isEmpty())
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
396 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
397
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
398 QString fname = QFileDialog::getSaveFileName();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
399
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
400 if (fname.length() == 0)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
401 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
402
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
403 QFile file (fname);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
404
662
2f1bd9112408 - use the keyword 'not' in place of the exclamation mark for operator!, this is clearer. also converted uses of '== false' to this.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
405 if (not file.open (QIODevice::WriteOnly | QIODevice::Text))
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
406 {
882
2f3cc8e045d5 - fixed compilation on windows
Teemu Piippo <crimsondusk64@gmail.com>
parents: 876
diff changeset
407 Critical (format ("Unable to open %1 for writing (%2)", fname, file.errorString()));
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
408 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
409 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
410
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
411 for (LDObjectPtr obj : Selection())
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
412 {
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
413 QString contents = obj->asText();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
414 QByteArray data = contents.toUtf8();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
415 file.write (data, data.size());
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
416 file.write ("\r\n", 2);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
417 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
418 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
419
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
420 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
421 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
422 void MainWindow::actionInsertRaw()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
423 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
424 int idx = getInsertionPoint();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
425
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
426 QDialog* const dlg = new QDialog;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
427 QVBoxLayout* const layout = new QVBoxLayout;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
428 QTextEdit* const te_edit = new QTextEdit;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
429 QDialogButtonBox* const bbx_buttons = new QDialogButtonBox (QDialogButtonBox::Ok | QDialogButtonBox::Cancel);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
430
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
431 layout->addWidget (te_edit);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
432 layout->addWidget (bbx_buttons);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
433 dlg->setLayout (layout);
662
2f1bd9112408 - use the keyword 'not' in place of the exclamation mark for operator!, this is clearer. also converted uses of '== false' to this.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
434 dlg->setWindowTitle (APPNAME " - Insert Raw");
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
435 dlg->connect (bbx_buttons, SIGNAL (accepted()), dlg, SLOT (accept()));
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
436 dlg->connect (bbx_buttons, SIGNAL (rejected()), dlg, SLOT (reject()));
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
437
662
2f1bd9112408 - use the keyword 'not' in place of the exclamation mark for operator!, this is clearer. also converted uses of '== false' to this.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
438 if (dlg->exec() == QDialog::Rejected)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
439 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
440
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
441 CurrentDocument()->clearSelection();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
442
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
443 for (QString line : QString (te_edit->toPlainText()).split ("\n"))
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
444 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
445 LDObjectPtr obj = ParseLine (line);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
446
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
447 CurrentDocument()->insertObj (idx, obj);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
448 obj->select();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
449 idx++;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
450 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
451
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
452 refresh();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
453 scrollToSelection();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
454 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
455
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
456 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
457 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
458 void MainWindow::actionScreenshot()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
459 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
460 setlocale (LC_ALL, "C");
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
461
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
462 int w, h;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
463 uchar* imgdata = R()->getScreencap (w, h);
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
464 QImage img = GetImageFromScreencap (imgdata, w, h);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
465
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
466 QString root = Basename (CurrentDocument()->name());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
467
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
468 if (root.right (4) == ".dat")
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
469 root.chop (4);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
470
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
471 QString defaultname = (root.length() > 0) ? format ("%1.png", root) : "";
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
472 QString fname = QFileDialog::getSaveFileName (g_win, "Save Screencap", defaultname,
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
473 "PNG images (*.png);;JPG images (*.jpg);;BMP images (*.bmp);;All Files (*.*)");
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
474
840
d077dd19bf9a - changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents: 830
diff changeset
475 if (not fname.isEmpty() and not img.save (fname))
882
2f3cc8e045d5 - fixed compilation on windows
Teemu Piippo <crimsondusk64@gmail.com>
parents: 876
diff changeset
476 Critical (format ("Couldn't open %1 for writing to save screencap: %2", fname, strerror (errno)));
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
477
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
478 delete[] imgdata;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
479 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
480
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
481 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
482 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
483 void MainWindow::actionAxes()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
484 {
850
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
485 cfg::DrawAxes = not cfg::DrawAxes;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
486 updateActions();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
487 R()->update();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
488 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
489
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
490 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
491 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
492 void MainWindow::actionVisibilityToggle()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
493 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
494 for (LDObjectPtr obj : Selection())
662
2f1bd9112408 - use the keyword 'not' in place of the exclamation mark for operator!, this is clearer. also converted uses of '== false' to this.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
495 obj->setHidden (not obj->isHidden());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
496
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
497 refresh();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
498 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
499
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
500 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
501 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
502 void MainWindow::actionVisibilityHide()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
503 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
504 for (LDObjectPtr obj : Selection())
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
505 obj->setHidden (true);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
506
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
507 refresh();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
508 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
509
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
510 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
511 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
512 void MainWindow::actionVisibilityReveal()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
513 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
514 for (LDObjectPtr obj : Selection())
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
515 obj->setHidden (false);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
516 refresh();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
517 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
518
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
519 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
520 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
521 void MainWindow::actionWireframe()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
522 {
850
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
523 cfg::DrawWireframe = not cfg::DrawWireframe;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
524 R()->refresh();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
525 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
526
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
527 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
528 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
529 void MainWindow::actionSetOverlay()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
530 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
531 OverlayDialog dlg;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
532
662
2f1bd9112408 - use the keyword 'not' in place of the exclamation mark for operator!, this is clearer. also converted uses of '== false' to this.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
533 if (not dlg.exec())
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
534 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
535
762
d259256e1394 - added a macro for adding operator++ and operator-- to enums, less cast hell this way
Santeri Piippo <crimsondusk64@gmail.com>
parents: 761
diff changeset
536 R()->setupOverlay ((ECamera) dlg.camera(), dlg.fpath(), dlg.ofsx(),
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
537 dlg.ofsy(), dlg.lwidth(), dlg.lheight());
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
538 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
539
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
540 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
541 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
542 void MainWindow::actionClearOverlay()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
543 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
544 R()->clearOverlay();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
545 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
546
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
547 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
548 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
549 void MainWindow::actionModeSelect()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
550 {
827
82469b40567e - now compiles
Santeri Piippo <crimsondusk64@gmail.com>
parents: 818
diff changeset
551 R()->setEditMode (EditModeType::Select);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
552 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
553
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
554 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
555 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
556 void MainWindow::actionModeDraw()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
557 {
827
82469b40567e - now compiles
Santeri Piippo <crimsondusk64@gmail.com>
parents: 818
diff changeset
558 R()->setEditMode (EditModeType::Draw);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
559 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
560
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
561 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
562 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
563 void MainWindow::actionModeRectangle()
841
1243abd47381 - split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents: 840
diff changeset
564 {
1243abd47381 - split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents: 840
diff changeset
565 R()->setEditMode (EditModeType::Rectangle);
1243abd47381 - split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents: 840
diff changeset
566 }
1243abd47381 - split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents: 840
diff changeset
567
1243abd47381 - split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents: 840
diff changeset
568 // =============================================================================
1243abd47381 - split the rectangle ability out of the draw mode into its own edit mode
Teemu Piippo <crimsondusk64@gmail.com>
parents: 840
diff changeset
569 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
570 void MainWindow::actionModeCircle()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
571 {
827
82469b40567e - now compiles
Santeri Piippo <crimsondusk64@gmail.com>
parents: 818
diff changeset
572 R()->setEditMode (EditModeType::Circle);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
573 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
574
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
575 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
576 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
577 void MainWindow::actionModeMagicWand()
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents: 815
diff changeset
578 {
827
82469b40567e - now compiles
Santeri Piippo <crimsondusk64@gmail.com>
parents: 818
diff changeset
579 R()->setEditMode (EditModeType::MagicWand);
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents: 815
diff changeset
580 }
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents: 815
diff changeset
581
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
582 void MainWindow::actionModeLinePath()
874
ba75c789667e - added line loop mode (doesn't actually create anything yet)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 861
diff changeset
583 {
876
f040f0fb3795 - renamed line loop to line path, updated changelog
Teemu Piippo <crimsondusk64@gmail.com>
parents: 874
diff changeset
584 R()->setEditMode (EditModeType::LinePath);
874
ba75c789667e - added line loop mode (doesn't actually create anything yet)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 861
diff changeset
585 }
ba75c789667e - added line loop mode (doesn't actually create anything yet)
Teemu Piippo <crimsondusk64@gmail.com>
parents: 861
diff changeset
586
818
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents: 815
diff changeset
587 // =============================================================================
748ba8818af8 - added the magic wand tool
Santeri Piippo <crimsondusk64@gmail.com>
parents: 815
diff changeset
588 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
589 void MainWindow::actionDrawAngles()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
590 {
850
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
591 cfg::DrawAngles = not cfg::DrawAngles;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
592 R()->refresh();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
593 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
594
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
595 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
596 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
597 void MainWindow::actionSetDrawDepth()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
598 {
762
d259256e1394 - added a macro for adding operator++ and operator-- to enums, less cast hell this way
Santeri Piippo <crimsondusk64@gmail.com>
parents: 761
diff changeset
599 if (R()->camera() == EFreeCamera)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
600 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
601
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
602 bool ok;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
603 double depth = QInputDialog::getDouble (g_win, "Set Draw Depth",
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
604 format ("Depth value for %1 Camera:", R()->getCameraName()),
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
605 R()->getDepthValue(), -10000.0f, 10000.0f, 3, &ok);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
606
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
607 if (ok)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
608 R()->setDepthValue (depth);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
609 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
610
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
611 #if 0
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
612 // This is a test to draw a dummy axle. Meant to be used as a primitive gallery,
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
613 // but I can't figure how to generate these pictures properly. Multi-threading
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
614 // these is an immense pain.
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
615 void MainWindow::actiontestpic()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
616 {
784
f82ab4d3c7b4 - made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents: 773
diff changeset
617 LDDocumentPtr file = getFile ("axle.dat");
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
618 setlocale (LC_ALL, "C");
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
619
662
2f1bd9112408 - use the keyword 'not' in place of the exclamation mark for operator!, this is clearer. also converted uses of '== false' to this.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
620 if (not file)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
621 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
622 critical ("couldn't load axle.dat");
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
623 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
624 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
625
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
626 int w, h;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
627
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
628 GLRenderer* rend = new GLRenderer;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
629 rend->resize (64, 64);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
630 rend->setAttribute (Qt::WA_DontShowOnScreen);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
631 rend->show();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
632 rend->setFile (file);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
633 rend->setDrawOnly (true);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
634 rend->compileAllObjects();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
635 rend->initGLData();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
636 rend->drawGLScene();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
637
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
638 uchar* imgdata = rend->screencap (w, h);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
639 QImage img = imageFromScreencap (imgdata, w, h);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
640
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
641 if (img.isNull())
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
642 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
643 critical ("Failed to create the image!\n");
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
644 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
645 else
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
646 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
647 QLabel* label = new QLabel;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
648 QDialog* dlg = new QDialog;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
649 label->setPixmap (QPixmap::fromImage (img));
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
650 QVBoxLayout* layout = new QVBoxLayout (dlg);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
651 layout->addWidget (label);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
652 dlg->exec();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
653 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
654
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
655 delete[] imgdata;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
656 rend->deleteLater();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
657 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
658 #endif
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
659
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
660 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
661 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
662 void MainWindow::actionScanPrimitives()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
663 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
664 PrimitiveScanner::start();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
665 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
666
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
667 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
668 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
669 void MainWindow::actionBFCView()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
670 {
851
dbed6938238c - refactored up the configuration dialog. Instead of setting all configuration values one-by-one, dynamically fill in the values and save them into config based on widget names and data
Teemu Piippo <crimsondusk64@gmail.com>
parents: 850
diff changeset
671 cfg::BFCRedGreenView = not cfg::BFCRedGreenView;
773
6eb3c88982ac - bfc red/green view and random colors are now mutually exclusive, enabling one disables the other.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 768
diff changeset
672
851
dbed6938238c - refactored up the configuration dialog. Instead of setting all configuration values one-by-one, dynamically fill in the values and save them into config based on widget names and data
Teemu Piippo <crimsondusk64@gmail.com>
parents: 850
diff changeset
673 if (cfg::BFCRedGreenView)
850
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
674 cfg::RandomColors = false;
773
6eb3c88982ac - bfc red/green view and random colors are now mutually exclusive, enabling one disables the other.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 768
diff changeset
675
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
676 updateActions();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
677 R()->refresh();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
678 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
679
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
680 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
681 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
682 void MainWindow::actionJumpTo()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
683 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
684 bool ok;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
685 int defval = 0;
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
686 LDObjectPtr obj;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
687
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
688 if (Selection().size() == 1)
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
689 defval = Selection()[0]->lineNumber();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
690
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
691 int idx = QInputDialog::getInt (null, "Go to line", "Go to line:", defval,
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
692 1, CurrentDocument()->getObjectCount(), 1, &ok);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
693
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
694 if (not ok or (obj = CurrentDocument()->getObject (idx - 1)) == null)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
695 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
696
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
697 CurrentDocument()->clearSelection();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
698 obj->select();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
699 updateSelection();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
700 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
701
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
702 // =============================================================================
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
703 //
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
704 void MainWindow::actionSubfileSelection()
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
705 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
706 if (Selection().size() == 0)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
707 return;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
708
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
709 QString parentpath (CurrentDocument()->fullPath());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
710
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
711 // BFC type of the new subfile - it shall inherit the BFC type of the parent document
847
274a7fac44fc - refactor
Teemu Piippo <crimsondusk64@gmail.com>
parents: 844
diff changeset
712 BFCStatement bfctype (BFCStatement::NoCertify);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
713
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
714 // Dirname of the new subfile
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
715 QString subdirname (Dirname (parentpath));
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
716
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
717 // Title of the new subfile
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
718 QString subtitle;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
719
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
720 // Comment containing the title of the parent document
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
721 LDCommentPtr titleobj (CurrentDocument()->getObject (0).dynamicCast<LDComment>());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
722
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
723 // License text for the subfile
848
68410477c8bb - refactoring
Teemu Piippo <crimsondusk64@gmail.com>
parents: 847
diff changeset
724 QString license (PreferredLicenseText());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
725
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
726 // LDraw code body of the new subfile (i.e. code of the selection)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
727 QStringList code;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
728
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
729 // Full path of the subfile to be
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
730 QString fullsubname;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
731
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
732 // Where to insert the subfile reference?
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
733 int refidx (Selection()[0]->lineNumber());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
734
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
735 // Determine title of subfile
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
736 if (titleobj != null)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
737 subtitle = "~" + titleobj->text();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
738 else
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
739 subtitle = "~subfile";
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
740
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
741 // Remove duplicate tildes
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
742 while (subtitle.startsWith ("~~"))
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
743 subtitle.remove (0, 1);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
744
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
745 // If this the parent document isn't already in s/, we need to stuff it into
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
746 // a subdirectory named s/. Ensure it exists!
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
747 QString topdirname = Basename (Dirname (CurrentDocument()->fullPath()));
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
748
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
749 if (topdirname != "s")
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
750 {
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
751 QString desiredPath = subdirname + "/s";
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
752 QString title = tr ("Create subfile directory?");
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
753 QString text = format (tr ("The directory <b>%1</b> is suggested for "
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
754 "subfiles. This directory does not exist, create it?"), desiredPath);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
755
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
756 if (QDir (desiredPath).exists() or Confirm (title, text))
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
757 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
758 subdirname = desiredPath;
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
759 QDir().mkpath (subdirname);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
760 }
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
761 else
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
762 return;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
763 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
764
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
765 // Determine the body of the name of the subfile
662
2f1bd9112408 - use the keyword 'not' in place of the exclamation mark for operator!, this is clearer. also converted uses of '== false' to this.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 655
diff changeset
766 if (not parentpath.isEmpty())
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
767 {
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
768 // Chop existing '.dat' suffix
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
769 if (parentpath.endsWith (".dat"))
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
770 parentpath.chop (4);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
771
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
772 // Remove the s?? suffix if it's there, otherwise we'll get filenames
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
773 // like s01s01.dat when subfiling subfiles.
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
774 QRegExp subfilesuffix ("s[0-9][0-9]$");
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
775 if (subfilesuffix.indexIn (parentpath) != -1)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
776 parentpath.chop (subfilesuffix.matchedLength());
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
777
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
778 int subidx = 1;
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
779 QString digits;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
780 QFile f;
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
781 QString testfname;
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
782
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
783 // Now find the appropriate filename. Increase the number of the subfile
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
784 // until we find a name which isn't already taken.
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
785 do
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
786 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
787 digits.setNum (subidx++);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
788
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
789 // pad it with a zero
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
790 if (digits.length() == 1)
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
791 digits.prepend ("0");
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
792
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
793 fullsubname = subdirname + "/" + Basename (parentpath) + "s" + digits + ".dat";
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
794 } while (FindDocument ("s\\" + Basename (fullsubname)) != null or QFile (fullsubname).exists());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
795 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
796
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
797 // Determine the BFC winding type used in the main document - it is to
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
798 // be carried over to the subfile.
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
799 LDIterate<LDBFC> (CurrentDocument()->objects(), [&] (LDBFCPtr const& bfc)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
800 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
801 if (Eq (bfc->statement(), BFCStatement::CertifyCCW, BFCStatement::CertifyCW,
860
a496e72af069 - more refactor, updated .hgignore
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
802 BFCStatement::NoCertify))
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
803 {
860
a496e72af069 - more refactor, updated .hgignore
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
804 bfctype = bfc->statement();
a496e72af069 - more refactor, updated .hgignore
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
805 Break();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
806 }
860
a496e72af069 - more refactor, updated .hgignore
Teemu Piippo <crimsondusk64@gmail.com>
parents: 857
diff changeset
807 });
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
808
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
809 // Get the body of the document in LDraw code
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
810 for (LDObjectPtr obj : Selection())
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
811 code << obj->asText();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
812
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
813 // Create the new subfile document
784
f82ab4d3c7b4 - made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents: 773
diff changeset
814 LDDocumentPtr doc = LDDocument::createNew();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
815 doc->setImplicit (false);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
816 doc->setFullPath (fullsubname);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
817 doc->setName (LDDocument::shortenName (fullsubname));
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
818
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
819 LDObjectList objs;
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
820 objs << LDSpawn<LDComment> (subtitle);
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
821 objs << LDSpawn<LDComment> ("Name: "); // This gets filled in when the subfile is saved
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
822 objs << LDSpawn<LDComment> (format ("Author: %1 [%2]", cfg::DefaultName, cfg::DefaultUser));
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
823 objs << LDSpawn<LDComment> ("!LDRAW_ORG Unofficial_Subpart");
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
824
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
825 if (not license.isEmpty())
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
826 objs << LDSpawn<LDComment> (license);
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
827
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
828 objs << LDSpawn<LDEmpty>();
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
829 objs << LDSpawn<LDBFC> (bfctype);
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
830 objs << LDSpawn<LDEmpty>();
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
831
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
832 doc->addObjects (objs);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
833
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
834 // Add the actual subfile code to the new document
789
4b7306f52bb5 - String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents: 788
diff changeset
835 for (QString line : code)
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
836 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
837 LDObjectPtr obj = ParseLine (line);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
838 doc->addObject (obj);
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
839 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
840
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
841 // Try save it
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
842 if (save (doc, true))
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
843 {
768
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
844 // Save was successful. Delete the original selection now from the
29e6c5552388 - initial overhaul with smart pointers
Santeri Piippo <crimsondusk64@gmail.com>
parents: 762
diff changeset
845 // main document.
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
846 for (LDObjectPtr obj : Selection())
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
847 obj->destroy();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
848
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
849 // Add a reference to the new subfile to where the selection was
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
850 LDSubfilePtr ref (LDSpawn<LDSubfile>());
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
851 ref->setColor (MainColor());
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
852 ref->setFileInfo (doc);
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
853 ref->setPosition (Origin);
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
854 ref->setTransform (IdentityMatrix);
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
855 CurrentDocument()->insertObj (refidx, ref);
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
856
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
857 // Refresh stuff
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
858 updateDocumentList();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
859 doFullRefresh();
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
860 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
861 else
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
862 {
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
863 // Failed to save.
784
f82ab4d3c7b4 - made LDDocument use shared pointers, this eliminates a lot of document-related crashes
Santeri Piippo <crimsondusk64@gmail.com>
parents: 773
diff changeset
864 doc->dismiss();
655
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
865 }
b376645315ab - renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff changeset
866 }
725
37b71daf4cb5 - added ability to draw with random colors
Santeri Piippo <crimsondusk64@gmail.com>
parents: 721
diff changeset
867
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
868 void MainWindow::actionRandomColors()
725
37b71daf4cb5 - added ability to draw with random colors
Santeri Piippo <crimsondusk64@gmail.com>
parents: 721
diff changeset
869 {
850
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
870 cfg::RandomColors = not cfg::RandomColors;
773
6eb3c88982ac - bfc red/green view and random colors are now mutually exclusive, enabling one disables the other.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 768
diff changeset
871
850
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
872 if (cfg::RandomColors)
851
dbed6938238c - refactored up the configuration dialog. Instead of setting all configuration values one-by-one, dynamically fill in the values and save them into config based on widget names and data
Teemu Piippo <crimsondusk64@gmail.com>
parents: 850
diff changeset
873 cfg::BFCRedGreenView = false;
773
6eb3c88982ac - bfc red/green view and random colors are now mutually exclusive, enabling one disables the other.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 768
diff changeset
874
6eb3c88982ac - bfc red/green view and random colors are now mutually exclusive, enabling one disables the other.
Santeri Piippo <crimsondusk64@gmail.com>
parents: 768
diff changeset
875 updateActions();
725
37b71daf4cb5 - added ability to draw with random colors
Santeri Piippo <crimsondusk64@gmail.com>
parents: 721
diff changeset
876 R()->refresh();
788
c9d1dad83ad0 - added an action for opening the subfiles pointed to by selected references as editable documents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 787
diff changeset
877 }
c9d1dad83ad0 - added an action for opening the subfiles pointed to by selected references as editable documents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 787
diff changeset
878
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
879 void MainWindow::actionOpenSubfiles()
788
c9d1dad83ad0 - added an action for opening the subfiles pointed to by selected references as editable documents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 787
diff changeset
880 {
861
83426c5fa732 - major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents: 860
diff changeset
881 for (LDObjectPtr obj : Selection())
788
c9d1dad83ad0 - added an action for opening the subfiles pointed to by selected references as editable documents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 787
diff changeset
882 {
c9d1dad83ad0 - added an action for opening the subfiles pointed to by selected references as editable documents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 787
diff changeset
883 LDSubfilePtr ref = obj.dynamicCast<LDSubfile>();
c9d1dad83ad0 - added an action for opening the subfiles pointed to by selected references as editable documents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 787
diff changeset
884
840
d077dd19bf9a - changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents: 830
diff changeset
885 if (ref == null or not ref->fileInfo()->isImplicit())
788
c9d1dad83ad0 - added an action for opening the subfiles pointed to by selected references as editable documents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 787
diff changeset
886 continue;
c9d1dad83ad0 - added an action for opening the subfiles pointed to by selected references as editable documents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 787
diff changeset
887
c9d1dad83ad0 - added an action for opening the subfiles pointed to by selected references as editable documents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 787
diff changeset
888 ref->fileInfo()->setImplicit (false);
c9d1dad83ad0 - added an action for opening the subfiles pointed to by selected references as editable documents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 787
diff changeset
889 }
c9d1dad83ad0 - added an action for opening the subfiles pointed to by selected references as editable documents
Santeri Piippo <crimsondusk64@gmail.com>
parents: 787
diff changeset
890 }
815
efe34366e56a - added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents: 806
diff changeset
891
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
892 void MainWindow::actionDrawSurfaces()
815
efe34366e56a - added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents: 806
diff changeset
893 {
850
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
894 cfg::DrawSurfaces = not cfg::DrawSurfaces;
815
efe34366e56a - added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents: 806
diff changeset
895 updateActions();
efe34366e56a - added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents: 806
diff changeset
896 update();
efe34366e56a - added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents: 806
diff changeset
897 }
efe34366e56a - added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents: 806
diff changeset
898
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
899 void MainWindow::actionDrawEdgeLines()
815
efe34366e56a - added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents: 806
diff changeset
900 {
850
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
901 cfg::DrawEdgeLines = not cfg::DrawEdgeLines;
815
efe34366e56a - added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents: 806
diff changeset
902 updateActions();
efe34366e56a - added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents: 806
diff changeset
903 update();
efe34366e56a - added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents: 806
diff changeset
904 }
efe34366e56a - added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents: 806
diff changeset
905
929
66e8453e1768 - refactor MainWindow a tad
Teemu Piippo <crimsondusk64@gmail.com>
parents: 928
diff changeset
906 void MainWindow::actionDrawConditionalLines()
815
efe34366e56a - added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents: 806
diff changeset
907 {
850
a3d72b0e916d - changed configuration entry name from minuscule camelCase to majuscule CamelCase. reasoning for this being that these variables are globals.
Teemu Piippo <crimsondusk64@gmail.com>
parents: 848
diff changeset
908 cfg::DrawConditionalLines = not cfg::DrawConditionalLines;
815
efe34366e56a - added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents: 806
diff changeset
909 updateActions();
efe34366e56a - added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents: 806
diff changeset
910 update();
efe34366e56a - added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents: 806
diff changeset
911 }

mercurial