Thu, 04 Jan 2018 22:52:04 +0200
undo config change
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 |
1222 | 3 | * Copyright (C) 2013 - 2018 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 <QGridLayout> |
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 <QEvent> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
22 | #include <QContextMenuEvent> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
23 | #include <QMenuBar> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
24 | #include <QStatusBar> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
25 | #include <QSplitter> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
26 | #include <QListWidget> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
27 | #include <QToolButton> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
28 | #include <QComboBox> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
29 | #include <QDialogButtonBox> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
30 | #include <QToolBar> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
31 | #include <QProgressBar> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
32 | #include <QLabel> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
33 | #include <QFileDialog> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
34 | #include <QPushButton> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
35 | #include <QCoreApplication> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
36 | #include <QTimer> |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
37 | #include <QMetaMethod> |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
38 | #include <QSettings> |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
39 | #include "main.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
40 | #include "glRenderer.h" |
962
a4b463a7ee82
Rename MainWindow files
Teemu Piippo <crimsondusk64@gmail.com>
parents:
959
diff
changeset
|
41 | #include "mainwindow.h" |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
42 | #include "ldDocument.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
43 | #include "miscallenous.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
44 | #include "colors.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
45 | #include "editHistory.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
46 | #include "radioGroup.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
47 | #include "addObjectDialog.h" |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
48 | #include "messageLog.h" |
963
c1526d1877d7
More through removal of the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents:
962
diff
changeset
|
49 | #include "ui_mainwindow.h" |
790
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
50 | #include "primitives.h" |
830
a741a0b9df49
- updated filenames
Santeri Piippo <crimsondusk64@gmail.com>
parents:
823
diff
changeset
|
51 | #include "editmodes/abstractEditMode.h" |
970
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
969
diff
changeset
|
52 | #include "toolsets/extprogramtoolset.h" |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
53 | #include "toolsets/toolset.h" |
975
24ba5aa3393f
Move ConfigDialog into src/dialogs/ subfolder
Teemu Piippo <crimsondusk64@gmail.com>
parents:
974
diff
changeset
|
54 | #include "dialogs/configdialog.h" |
974
b2fa5f89798a
Added a GuiUtilities class to contain useful non-MainWindow-related GUI functions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
972
diff
changeset
|
55 | #include "guiutilities.h" |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
56 | #include "glCompiler.h" |
997
1b49f34e533d
Commit work done on document manager. Happy 3rd birthday LDForge!
Teemu Piippo <crimsondusk64@gmail.com>
parents:
988
diff
changeset
|
57 | #include "documentmanager.h" |
1005
a88cf5a32246
Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1004
diff
changeset
|
58 | #include "ldobjectiterator.h" |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
59 | |
1217 | 60 | ConfigOption(bool ColorizeObjectsList = true) |
61 | ConfigOption(QString QuickColorToolbar = "4:25:14:27:2:3:11:1:22:|:0:72:71:15") | |
62 | ConfigOption(bool ListImplicitFiles = false) | |
63 | ConfigOption(QStringList HiddenToolbars) | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
64 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
65 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
66 | // |
1217 | 67 | MainWindow::MainWindow(QWidget* parent, Qt::WindowFlags flags) : |
68 | QMainWindow(parent, flags), | |
69 | m_guiUtilities(new GuiUtilities(this)), | |
70 | ui(*new Ui_MainWindow), | |
71 | m_externalPrograms(nullptr), | |
72 | m_settings(makeSettings(this)), | |
73 | m_documents(new DocumentManager(this)), | |
74 | m_currentDocument(nullptr), | |
75 | m_isSelectionLocked(false) | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
76 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
77 | g_win = this; |
1217 | 78 | ui.setupUi(this); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
79 | m_updatingTabs = false; |
1217 | 80 | m_renderer = new GLRenderer(this); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
81 | m_tabs = new QTabBar; |
1217 | 82 | m_tabs->setTabsClosable(true); |
83 | ui.verticalLayout->insertWidget(0, m_tabs); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
84 | |
1005
a88cf5a32246
Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1004
diff
changeset
|
85 | createBlankDocument(); |
1217 | 86 | m_renderer->setDocument(m_currentDocument); |
1005
a88cf5a32246
Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1004
diff
changeset
|
87 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
88 | // Stuff the renderer into its frame |
1217 | 89 | QVBoxLayout* rendererLayout = new QVBoxLayout(ui.rendererFrame); |
90 | rendererLayout->addWidget(renderer()); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
91 | |
1217 | 92 | connect(ui.objectList, SIGNAL(itemSelectionChanged()), this, SLOT(selectionChanged())); |
93 | connect(ui.objectList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(objectListDoubleClicked(QListWidgetItem*))); | |
94 | connect(m_tabs, SIGNAL(currentChanged(int)), this, SLOT(tabSelected())); | |
95 | connect(m_tabs, SIGNAL(tabCloseRequested(int)), this, SLOT(closeTab(int))); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
96 | |
985
ed7b31b9f904
Remove "!= nullptr" expressions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
97 | if (ActivePrimitiveScanner()) |
1217 | 98 | connect(ActivePrimitiveScanner(), SIGNAL(workDone()), this, SLOT(updatePrimitives())); |
790
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
99 | else |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
100 | updatePrimitives(); |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
101 | |
861
83426c5fa732
- major identifier renaming
Teemu Piippo <crimsondusk64@gmail.com>
parents:
859
diff
changeset
|
102 | m_quickColors = LoadQuickColorList(); |
1217 | 103 | setStatusBar(new QStatusBar); |
815
efe34366e56a
- added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
808
diff
changeset
|
104 | updateActions(); |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
105 | |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
106 | // Connect all actions and save default sequences |
1217 | 107 | applyToActions([&](QAction* act) |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
108 | { |
1217 | 109 | connect(act, SIGNAL(triggered()), this, SLOT(actionTriggered())); |
998 | 110 | m_defaultShortcuts[act] = act->shortcut(); |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
111 | }); |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
112 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
113 | updateGridToolBar(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
114 | updateEditModeActions(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
115 | updateRecentFilesMenu(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
116 | updateColorToolbar(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
117 | updateTitle(); |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
118 | loadShortcuts(); |
1217 | 119 | setMinimumSize(300, 200); |
120 | connect(qApp, SIGNAL(aboutToQuit()), this, SLOT(doLastSecondCleanup())); | |
121 | connect(ui.ringToolHiRes, SIGNAL(clicked(bool)), this, SLOT(ringToolHiResClicked(bool))); | |
122 | connect(ui.ringToolSegments, SIGNAL(valueChanged(int)), | |
123 | this, SLOT(circleToolSegmentsChanged())); | |
871
a860edb4210b
- display a label next to the spinbox showing the fraction
Teemu Piippo <crimsondusk64@gmail.com>
parents:
869
diff
changeset
|
124 | circleToolSegmentsChanged(); // invoke it manually for initial label text |
896
4988666b5e3c
- now remembers what toolbars are enabled and what are disabled in config
Teemu Piippo <crimsondusk64@gmail.com>
parents:
893
diff
changeset
|
125 | |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
126 | // Examine the toolsets and make a dictionary of tools |
1217 | 127 | m_toolsets = Toolset::createToolsets(this); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
128 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
129 | QStringList ignore; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
130 | for (int i = 0; i < Toolset::staticMetaObject.methodCount(); ++i) |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
131 | { |
1217 | 132 | QMetaMethod method = Toolset::staticMetaObject.method(i); |
133 | ignore.append(QString::fromUtf8(method.name())); | |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
134 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
135 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
136 | for (Toolset* toolset : m_toolsets) |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
137 | { |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
138 | const QMetaObject* meta = toolset->metaObject(); |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
139 | |
1217 | 140 | if (qobject_cast<ExtProgramToolset*>(toolset)) |
141 | m_externalPrograms = static_cast<ExtProgramToolset*>(toolset); | |
970
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
969
diff
changeset
|
142 | |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
143 | for (int i = 0; i < meta->methodCount(); ++i) |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
144 | { |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
145 | ToolInfo info; |
1217 | 146 | info.method = meta->method(i); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
147 | info.object = toolset; |
1217 | 148 | QString methodName = QString::fromUtf8(info.method.name()); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
149 | |
1217 | 150 | if (ignore.contains(methodName)) |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
151 | continue; // The method was inherited from base classes |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
152 | |
1217 | 153 | QString actionName = "action" + methodName.left(1).toUpper() + methodName.mid(1); |
154 | QAction* action = findChild<QAction*>(actionName); | |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
155 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
156 | if (action == nullptr) |
1217 | 157 | print("No action for %1::%2(looked for %3)\n", meta->className(), methodName, actionName); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
158 | else |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
159 | m_toolmap[action] = info; |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
160 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
161 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
162 | |
1224 | 163 | for (QVariant const& toolbarname : config->hiddenToolbars()) |
896
4988666b5e3c
- now remembers what toolbars are enabled and what are disabled in config
Teemu Piippo <crimsondusk64@gmail.com>
parents:
893
diff
changeset
|
164 | { |
1217 | 165 | QToolBar* toolbar = findChild<QToolBar*>(toolbarname.toString()); |
896
4988666b5e3c
- now remembers what toolbars are enabled and what are disabled in config
Teemu Piippo <crimsondusk64@gmail.com>
parents:
893
diff
changeset
|
166 | |
985
ed7b31b9f904
Remove "!= nullptr" expressions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
167 | if (toolbar) |
896
4988666b5e3c
- now remembers what toolbars are enabled and what are disabled in config
Teemu Piippo <crimsondusk64@gmail.com>
parents:
893
diff
changeset
|
168 | toolbar->hide(); |
4988666b5e3c
- now remembers what toolbars are enabled and what are disabled in config
Teemu Piippo <crimsondusk64@gmail.com>
parents:
893
diff
changeset
|
169 | } |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
170 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
171 | // If this is the first start, get the user to configuration. Especially point |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
172 | // them to the profile tab, it's the most important form to fill in. |
1224 | 173 | if (config->firstStart()) |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
174 | { |
1217 | 175 | ConfigDialog* dialog = new ConfigDialog(this, ConfigDialog::ProfileTab); |
972
a34b73114823
Now doesn't crash anymore
Teemu Piippo <crimsondusk64@gmail.com>
parents:
971
diff
changeset
|
176 | dialog->show(); |
1224 | 177 | config->setFirstStart(false); |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
178 | } |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
179 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
180 | |
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
|
181 | MainWindow::~MainWindow() |
e62983881460
- fixed crash-on-exit (simply by not running full destruction processing during program termination)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
852
diff
changeset
|
182 | { |
984 | 183 | g_win = nullptr; |
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
|
184 | } |
e62983881460
- fixed crash-on-exit (simply by not running full destruction processing during program termination)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
852
diff
changeset
|
185 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
186 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
187 | // |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
188 | void MainWindow::actionTriggered() |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
189 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
190 | // Get the name of the sender object and use it to compose the slot name, |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
191 | // then invoke this slot to call the action. |
1217 | 192 | QAction* action = qobject_cast<QAction*>(sender()); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
193 | |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
194 | if (action) |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
195 | { |
1217 | 196 | if (m_toolmap.contains(action)) |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
197 | { |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
198 | const ToolInfo& info = m_toolmap[action]; |
1217 | 199 | info.method.invoke(info.object, Qt::DirectConnection); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
200 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
201 | else |
1217 | 202 | print("No tool info for %1!\n", action->objectName()); |
969
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
203 | } |
b1742ee91d5b
Split actions.cpp and actionsEdit.cpp into toolsets.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
968
diff
changeset
|
204 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
205 | endAction(); |
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 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
208 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
209 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
210 | void MainWindow::endAction() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
211 | { |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
212 | m_currentDocument->addHistoryStep(); |
1217 | 213 | updateDocumentListItem(m_currentDocument); |
869
7184f3bae695
- circle tool is now able to rotate the partial circular primitives spawned
Teemu Piippo <crimsondusk64@gmail.com>
parents:
866
diff
changeset
|
214 | refresh(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
215 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
216 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
217 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
218 | // |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
219 | void MainWindow::doLastSecondCleanup() |
655
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 | delete m_renderer; |
965
d1b0aa40db91
MainWindow: "ui->" -> "ui."
Teemu Piippo <crimsondusk64@gmail.com>
parents:
963
diff
changeset
|
222 | delete &ui; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
223 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
224 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
225 | // --------------------------------------------------------------------------------------------------------------------- |
655
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 | void MainWindow::updateRecentFilesMenu() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
228 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
229 | // First, clear any items in the recent files menu |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
230 | for (QAction* recent : m_recentFiles) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
231 | delete recent; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
232 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
233 | m_recentFiles.clear(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
234 | |
984 | 235 | QAction* first = nullptr; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
236 | |
1224 | 237 | for (const QVariant& it : config->recentFiles()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
238 | { |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
788
diff
changeset
|
239 | QString file = it.toString(); |
1217 | 240 | QAction* recent = new QAction(GetIcon("open-recent"), file, this); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
241 | |
1217 | 242 | connect(recent, SIGNAL(triggered()), this, SLOT(recentFileClicked())); |
243 | ui.menuOpenRecent->insertAction(first, recent); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
244 | m_recentFiles << recent; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
245 | first = recent; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
246 | } |
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 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
249 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
250 | // |
1010
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
251 | QList<ColorToolbarItem> LoadQuickColorList() |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
252 | { |
1010
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
253 | QList<ColorToolbarItem> colors; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
254 | |
1224 | 255 | for (QString colorname : config->quickColorToolbar().split(":")) |
655
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 | if (colorname == "|") |
1010
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
258 | colors << ColorToolbarItem::makeSeparator(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
259 | else |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
260 | { |
946 | 261 | LDColor color = colorname.toInt(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
262 | |
946 | 263 | if (color.isValid()) |
1217 | 264 | colors << ColorToolbarItem(color, nullptr); |
655
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 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
268 | return colors; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
269 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
270 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
271 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
272 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
273 | void MainWindow::updateColorToolbar() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
274 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
275 | m_colorButtons.clear(); |
965
d1b0aa40db91
MainWindow: "ui->" -> "ui."
Teemu Piippo <crimsondusk64@gmail.com>
parents:
963
diff
changeset
|
276 | ui.toolBarColors->clear(); |
1217 | 277 | ui.toolBarColors->addAction(ui.actionUncolor); |
965
d1b0aa40db91
MainWindow: "ui->" -> "ui."
Teemu Piippo <crimsondusk64@gmail.com>
parents:
963
diff
changeset
|
278 | ui.toolBarColors->addSeparator(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
279 | |
1010
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
280 | for (ColorToolbarItem& entry : m_quickColors) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
281 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
282 | if (entry.isSeparator()) |
888
7ad8fb667084
- improved part downloader: now asks for the path instead of just directing the user to settings. auto-fix download now configurable and opt-in
Teemu Piippo <crimsondusk64@gmail.com>
parents:
882
diff
changeset
|
283 | { |
965
d1b0aa40db91
MainWindow: "ui->" -> "ui."
Teemu Piippo <crimsondusk64@gmail.com>
parents:
963
diff
changeset
|
284 | ui.toolBarColors->addSeparator(); |
888
7ad8fb667084
- improved part downloader: now asks for the path instead of just directing the user to settings. auto-fix download now configurable and opt-in
Teemu Piippo <crimsondusk64@gmail.com>
parents:
882
diff
changeset
|
285 | } |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
286 | else |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
287 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
288 | QToolButton* colorButton = new QToolButton; |
1217 | 289 | colorButton->setIcon(m_guiUtilities->makeColorIcon(entry.color(), 16)); |
290 | colorButton->setIconSize(QSize(16, 16)); | |
291 | colorButton->setToolTip(entry.color().name()); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
292 | |
1217 | 293 | connect(colorButton, SIGNAL(clicked()), this, SLOT(quickColorClicked())); |
294 | ui.toolBarColors->addWidget(colorButton); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
295 | m_colorButtons << colorButton; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
296 | |
1217 | 297 | entry.setToolButton(colorButton); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
298 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
299 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
300 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
301 | updateGridToolBar(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
302 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
303 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
304 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
305 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
306 | void MainWindow::updateGridToolBar() |
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 | // Ensure that the current grid - and only the current grid - is selected. |
1224 | 309 | int grid = config->grid(); |
1217 | 310 | ui.actionGridCoarse->setChecked(grid == Grid::Coarse); |
311 | ui.actionGridMedium->setChecked(grid == Grid::Medium); | |
312 | ui.actionGridFine->setChecked(grid == Grid::Fine); | |
1005
a88cf5a32246
Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1004
diff
changeset
|
313 | |
a88cf5a32246
Subject Bézier curve fineness to the grid. By default, the coarse grid uses 8 segments, medium 16 and fine 32. Moved rasterization from demoting to inlining, it feels more sensible for it to be there.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1004
diff
changeset
|
314 | // Recompile all Bézier curves, the changing grid affects their precision. |
1217 | 315 | for (LDObjectIterator<LDBezierCurve> it(m_currentDocument); it.isValid(); ++it) |
316 | renderer()->compileObject(it); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
317 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
318 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
319 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
320 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
321 | void MainWindow::updateTitle() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
322 | { |
1217 | 323 | QString title = format(APPNAME " " VERSION_STRING); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
324 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
325 | // Append our current file if we have one |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
326 | if (m_currentDocument) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
327 | { |
744
bbe0e1834065
- removed rest of the uses of <anonymous>
Santeri Piippo <crimsondusk64@gmail.com>
parents:
739
diff
changeset
|
328 | title += ": "; |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
329 | title += m_currentDocument->getDisplayName(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
330 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
331 | if (m_currentDocument->getObjectCount() > 0 and |
1217 | 332 | m_currentDocument->getObject(0)->type() == OBJ_Comment) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
333 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
334 | // Append title |
1217 | 335 | LDComment* comm = static_cast <LDComment*>(m_currentDocument->getObject(0)); |
336 | title += format(": %1", comm->text()); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
337 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
338 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
339 | if (m_currentDocument->hasUnsavedChanges()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
340 | title += '*'; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
341 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
342 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
343 | #ifdef DEBUG |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
344 | title += " [debug build]"; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
345 | #elif BUILD_ID != BUILD_RELEASE |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
346 | title += " [pre-release build]"; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
347 | #endif // DEBUG |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
348 | |
1217 | 349 | if (strlen(commitTimeString())) |
350 | title += format("(%1)", QString::fromUtf8(commitTimeString())); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
351 | |
1217 | 352 | setWindowTitle(title); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
353 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
354 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
355 | // --------------------------------------------------------------------------------------------------------------------- |
655
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 | int MainWindow::deleteSelection() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
358 | { |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
359 | if (selectedObjects().isEmpty()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
360 | return 0; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
361 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
362 | LDObjectList selCopy = selectedObjects(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
363 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
364 | // Delete the objects that were being selected |
944 | 365 | for (LDObject* obj : selCopy) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
366 | obj->destroy(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
367 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
368 | refresh(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
369 | return selCopy.size(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
370 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
371 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
372 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
373 | // |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
374 | void MainWindow::buildObjectList() |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
375 | { |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
376 | if (not m_currentDocument) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
377 | return; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
378 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
379 | // Lock the selection while we do this so that refreshing the object list |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
380 | // doesn't trigger selection updating so that the selection doesn't get lost |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
381 | // while this is done. |
998 | 382 | m_isSelectionLocked = true; |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
986
diff
changeset
|
383 | m_objectsInList.clear(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
384 | |
965
d1b0aa40db91
MainWindow: "ui->" -> "ui."
Teemu Piippo <crimsondusk64@gmail.com>
parents:
963
diff
changeset
|
385 | for (int i = 0; i < ui.objectList->count(); ++i) |
1217 | 386 | delete ui.objectList->item(i); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
387 | |
965
d1b0aa40db91
MainWindow: "ui->" -> "ui."
Teemu Piippo <crimsondusk64@gmail.com>
parents:
963
diff
changeset
|
388 | ui.objectList->clear(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
389 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
390 | for (LDObject* obj : m_currentDocument->objects()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
391 | { |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
788
diff
changeset
|
392 | QString descr; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
393 | |
1217 | 394 | switch(obj->type()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
395 | { |
786
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
396 | case OBJ_Comment: |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
397 | { |
1217 | 398 | descr = static_cast<LDComment*>(obj)->text(); |
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 | // Remove leading whitespace |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
401 | while (descr[0] == ' ') |
1217 | 402 | descr.remove(0, 1); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
403 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
404 | break; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
405 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
406 | |
786
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
407 | case OBJ_Empty: |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
408 | break; // leave it empty |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
409 | |
786
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
410 | case OBJ_Line: |
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
411 | case OBJ_Triangle: |
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
412 | case OBJ_Quad: |
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
413 | case OBJ_CondLine: |
1004
ba4200437179
Bézier curves now render in 3D
Teemu Piippo <crimsondusk64@gmail.com>
parents:
998
diff
changeset
|
414 | case OBJ_BezierCurve: |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
415 | { |
767
44f0d5322628
- slight refactor in ldobject methods
Santeri Piippo <crimsondusk64@gmail.com>
parents:
762
diff
changeset
|
416 | for (int i = 0; i < obj->numVertices(); ++i) |
655
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 | if (i != 0) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
419 | descr += ", "; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
420 | |
1217 | 421 | descr += obj->vertex(i).toString(true); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
422 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
423 | break; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
424 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
425 | |
786
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
426 | case OBJ_Error: |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
427 | { |
1217 | 428 | descr = format("ERROR: %1", obj->asText()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
429 | break; |
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 | |
1011
4fdd74a04790
Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1010
diff
changeset
|
432 | case OBJ_SubfileReference: |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
433 | { |
1217 | 434 | LDSubfileReference* ref = static_cast<LDSubfileReference*>(obj); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
435 | |
1217 | 436 | descr = format("%1 %2,(", ref->fileInfo()->getDisplayName(), ref->position().toString(true)); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
437 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
438 | for (int i = 0; i < 9; ++i) |
1217 | 439 | descr += format("%1%2", ref->transform()[i],(i != 8) ? " " : ""); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
440 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
441 | descr += ')'; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
442 | break; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
443 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
444 | |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
986
diff
changeset
|
445 | case OBJ_Bfc: |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
446 | { |
1217 | 447 | descr = static_cast<LDBfc*>(obj)->statementToString(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
448 | break; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
449 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
450 | |
786
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
451 | case OBJ_Overlay: |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
452 | { |
1217 | 453 | LDOverlay* ovl = static_cast<LDOverlay*>(obj); |
454 | descr = format("[%1] %2(%3, %4), %5 x %6", renderer()->cameraName((ECamera) ovl->camera()), | |
455 | Basename(ovl->fileName()), ovl->x(), ovl->y(), | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
456 | ovl->width(), ovl->height()); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
457 | break; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
458 | } |
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 | default: |
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 | descr = obj->typeName(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
463 | break; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
464 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
465 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
466 | |
1217 | 467 | QListWidgetItem* item = new QListWidgetItem(descr); |
468 | item->setIcon(GetIcon(obj->typeName())); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
469 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
470 | // Use italic font if hidden |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
471 | if (obj->isHidden()) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
472 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
473 | QFont font = item->font(); |
1217 | 474 | font.setItalic(true); |
475 | item->setFont(font); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
476 | } |
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 | // Color gibberish orange on red so it stands out. |
786
71d786ce0dcc
- LDObject::Type moved back to global namespace
Santeri Piippo <crimsondusk64@gmail.com>
parents:
784
diff
changeset
|
479 | if (obj->type() == OBJ_Error) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
480 | { |
1217 | 481 | item->setBackground(QColor("#AA0000")); |
482 | item->setForeground(QColor("#FFAA00")); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
483 | } |
1224 | 484 | else if (config->colorizeObjectsList() |
970
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
969
diff
changeset
|
485 | and obj->isColored() |
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
969
diff
changeset
|
486 | and obj->color().isValid() |
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
969
diff
changeset
|
487 | and obj->color() != MainColor |
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
969
diff
changeset
|
488 | and obj->color() != EdgeColor) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
489 | { |
946 | 490 | // If the object isn't in the main or edge color, draw this list entry in that color. |
1217 | 491 | item->setForeground(obj->color().faceColor()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
492 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
493 | |
1217 | 494 | m_objectsInList.insert(obj, item); |
495 | ui.objectList->insertItem(ui.objectList->count(), item); | |
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 | |
998 | 498 | m_isSelectionLocked = false; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
499 | updateSelection(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
500 | scrollToSelection(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
501 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
502 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
503 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
504 | // |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
505 | // Scrolls the object list so that it points to the first selected object. |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
506 | // |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
507 | void MainWindow::scrollToSelection() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
508 | { |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
509 | if (selectedObjects().isEmpty()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
510 | return; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
511 | |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
512 | LDObject* obj = selectedObjects().first(); |
1217 | 513 | ui.objectList->scrollToItem(m_objectsInList[obj]); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
514 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
515 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
516 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
517 | // |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
518 | void MainWindow::selectionChanged() |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
519 | { |
998 | 520 | if (m_isSelectionLocked == true or m_currentDocument == nullptr) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
521 | return; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
522 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
523 | LDObjectList priorSelection = selectedObjects(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
524 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
525 | // Get the objects from the object list selection |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
526 | m_currentDocument->clearSelection(); |
965
d1b0aa40db91
MainWindow: "ui->" -> "ui."
Teemu Piippo <crimsondusk64@gmail.com>
parents:
963
diff
changeset
|
527 | const QList<QListWidgetItem*> items = ui.objectList->selectedItems(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
528 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
529 | for (LDObject* obj : m_currentDocument->objects()) |
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 | for (QListWidgetItem* item : items) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
532 | { |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
986
diff
changeset
|
533 | if (item == m_objectsInList[obj]) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
534 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
535 | obj->select(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
536 | break; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
537 | } |
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 | |
1217 | 541 | // The select() method calls may have selected additional items(i.e. invertnexts) |
776
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
774
diff
changeset
|
542 | // Update it all now. |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
774
diff
changeset
|
543 | updateSelection(); |
624131d0163d
- selecting an invertnext'd object now also selects the invertnext
Santeri Piippo <crimsondusk64@gmail.com>
parents:
774
diff
changeset
|
544 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
545 | // Update the GL renderer |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
546 | LDObjectList compound = priorSelection + selectedObjects(); |
1217 | 547 | removeDuplicates(compound); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
548 | |
944 | 549 | for (LDObject* obj : compound) |
1217 | 550 | renderer()->compileObject(obj); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
551 | |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
552 | renderer()->update(); |
655
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 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
555 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
556 | // |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
557 | void MainWindow::recentFileClicked() |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
558 | { |
1217 | 559 | QAction* qAct = static_cast<QAction*>(sender()); |
560 | documents()->openMainModel(qAct->text()); | |
655
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 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
563 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
564 | // |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
565 | void MainWindow::quickColorClicked() |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
566 | { |
1217 | 567 | QToolButton* button = static_cast<QToolButton*>(sender()); |
946 | 568 | LDColor color = LDColor::nullColor(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
569 | |
1010
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
570 | for (const ColorToolbarItem& entry : m_quickColors) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
571 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
572 | if (entry.toolButton() == button) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
573 | { |
946 | 574 | color = entry.color(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
575 | break; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
576 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
577 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
578 | |
946 | 579 | if (not color.isValid()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
580 | return; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
581 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
582 | for (LDObject* obj : selectedObjects()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
583 | { |
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
|
584 | if (not obj->isColored()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
585 | continue; // uncolored object |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
586 | |
1217 | 587 | obj->setColor(color); |
588 | renderer()->compileObject(obj); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
589 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
590 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
591 | endAction(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
592 | 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 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
595 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
596 | // |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
597 | // Returns the suggested position to place a new object at. |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
598 | // |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
599 | int MainWindow::suggestInsertPoint() |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
600 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
601 | // If we have a selection, put the item after it. |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
602 | if (not selectedObjects().isEmpty()) |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
603 | return selectedObjects().last()->lineNumber() + 1; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
604 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
605 | // Otherwise place the object at the end. |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
606 | return m_currentDocument->getObjectCount(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
607 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
608 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
609 | // --------------------------------------------------------------------------------------------------------------------- |
655
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 | void MainWindow::doFullRefresh() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
612 | { |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
613 | buildObjectList(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
614 | m_renderer->hardRefresh(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
615 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
616 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
617 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
618 | // |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
619 | // Builds the object list and tells the GL renderer to do a soft update. |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
620 | // |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
621 | void MainWindow::refresh() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
622 | { |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
623 | buildObjectList(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
624 | m_renderer->update(); |
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 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
627 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
628 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
629 | void MainWindow::updateSelection() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
630 | { |
998 | 631 | m_isSelectionLocked = true; |
892
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
632 | QItemSelection itemselect; |
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
633 | int top = -1; |
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
634 | int bottom = -1; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
635 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
636 | for (LDObject* obj : selectedObjects()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
637 | { |
1217 | 638 | QListWidgetItem** itempointer = m_objectsInList.find(obj); |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
986
diff
changeset
|
639 | |
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
986
diff
changeset
|
640 | if (not itempointer) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
641 | continue; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
642 | |
1217 | 643 | int row = ui.objectList->row(*itempointer); |
892
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
644 | |
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
645 | if (top == -1) |
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
646 | { |
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
647 | top = bottom = row; |
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
648 | } |
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
649 | else |
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
650 | { |
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
651 | if (row != bottom + 1) |
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
652 | { |
1217 | 653 | itemselect.select(ui.objectList->model()->index(top, 0), |
654 | ui.objectList->model()->index(bottom, 0)); | |
892
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
655 | top = -1; |
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
656 | } |
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
657 | |
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
658 | bottom = row; |
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
659 | } |
655
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 | |
892
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
662 | if (top != -1) |
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
663 | { |
1217 | 664 | itemselect.select(ui.objectList->model()->index(top, 0), |
665 | ui.objectList->model()->index(bottom, 0)); | |
892
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
666 | } |
49afb6b98253
- rewritten updateSelection() core loop, a new algorithm there makes selection updating a ton lot faster than before
Teemu Piippo <crimsondusk64@gmail.com>
parents:
888
diff
changeset
|
667 | |
988
ac4a2ae54f76
Refactor LDObject API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
986
diff
changeset
|
668 | // Select multiple objects at once for performance reasons |
1217 | 669 | ui.objectList->selectionModel()->select(itemselect, QItemSelectionModel::ClearAndSelect); |
998 | 670 | m_isSelectionLocked = false; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
671 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
672 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
673 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
674 | // |
1217 | 675 | // Returns the uniform selected color(i.e. 4 if everything selected is red), -1 if there is no such consensus. |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
676 | // |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
677 | LDColor MainWindow::getUniformSelectedColor() |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
678 | { |
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:
790
diff
changeset
|
679 | LDColor result; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
680 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
681 | for (LDObject* obj : selectedObjects()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
682 | { |
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
|
683 | if (not obj->isColored()) |
946 | 684 | continue; // This one doesn't use color so it doesn't have a say |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
685 | |
946 | 686 | if (result.isValid() and obj->color() != result) |
687 | return LDColor::nullColor(); // No consensus in object color | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
688 | |
946 | 689 | if (not result.isValid()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
690 | result = obj->color(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
691 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
692 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
693 | return result; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
694 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
695 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
696 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
697 | // |
1217 | 698 | void MainWindow::closeEvent(QCloseEvent* ev) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
699 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
700 | // Check whether it's safe to close all files. |
998 | 701 | if (not m_documents->isSafeToCloseAll()) |
655
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 | ev->ignore(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
704 | return; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
705 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
706 | |
896
4988666b5e3c
- now remembers what toolbars are enabled and what are disabled in config
Teemu Piippo <crimsondusk64@gmail.com>
parents:
893
diff
changeset
|
707 | // Save the toolbar set |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
708 | QStringList hiddenToolbars; |
896
4988666b5e3c
- now remembers what toolbars are enabled and what are disabled in config
Teemu Piippo <crimsondusk64@gmail.com>
parents:
893
diff
changeset
|
709 | |
4988666b5e3c
- now remembers what toolbars are enabled and what are disabled in config
Teemu Piippo <crimsondusk64@gmail.com>
parents:
893
diff
changeset
|
710 | for (QToolBar* toolbar : findChildren<QToolBar*>()) |
4988666b5e3c
- now remembers what toolbars are enabled and what are disabled in config
Teemu Piippo <crimsondusk64@gmail.com>
parents:
893
diff
changeset
|
711 | { |
4988666b5e3c
- now remembers what toolbars are enabled and what are disabled in config
Teemu Piippo <crimsondusk64@gmail.com>
parents:
893
diff
changeset
|
712 | if (toolbar->isHidden()) |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
713 | hiddenToolbars << toolbar->objectName(); |
896
4988666b5e3c
- now remembers what toolbars are enabled and what are disabled in config
Teemu Piippo <crimsondusk64@gmail.com>
parents:
893
diff
changeset
|
714 | } |
4988666b5e3c
- now remembers what toolbars are enabled and what are disabled in config
Teemu Piippo <crimsondusk64@gmail.com>
parents:
893
diff
changeset
|
715 | |
4988666b5e3c
- now remembers what toolbars are enabled and what are disabled in config
Teemu Piippo <crimsondusk64@gmail.com>
parents:
893
diff
changeset
|
716 | // Save the configuration before leaving. |
1224 | 717 | config->setHiddenToolbars(hiddenToolbars); |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
718 | syncSettings(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
719 | ev->accept(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
720 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
721 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
722 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
723 | // |
1217 | 724 | void MainWindow::spawnContextMenu(const QPoint pos) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
725 | { |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
726 | const bool single = (selectedObjects().size() == 1); |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
727 | LDObject* singleObj = single ? selectedObjects().first() : nullptr; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
728 | |
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
|
729 | bool hasSubfiles = 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
|
730 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
731 | for (LDObject* obj : selectedObjects()) |
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
|
732 | { |
1011
4fdd74a04790
Rename LDSubfile to LDSubfileReference
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1010
diff
changeset
|
733 | if (obj->type() == OBJ_SubfileReference) |
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
|
734 | { |
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
|
735 | hasSubfiles = true; |
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
|
736 | break; |
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
|
737 | } |
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
|
738 | } |
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
|
739 | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
740 | QMenu* contextMenu = new QMenu; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
741 | |
840
d077dd19bf9a
- changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents:
834
diff
changeset
|
742 | if (single and singleObj->type() != OBJ_Empty) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
743 | { |
1217 | 744 | contextMenu->addAction(ui.actionEdit); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
745 | contextMenu->addSeparator(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
746 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
747 | |
1217 | 748 | contextMenu->addAction(ui.actionCut); |
749 | contextMenu->addAction(ui.actionCopy); | |
750 | contextMenu->addAction(ui.actionPaste); | |
751 | contextMenu->addAction(ui.actionRemove); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
752 | contextMenu->addSeparator(); |
1217 | 753 | contextMenu->addAction(ui.actionSetColor); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
754 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
755 | if (single) |
1217 | 756 | contextMenu->addAction(ui.actionEditRaw); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
757 | |
1217 | 758 | contextMenu->addAction(ui.actionMakeBorders); |
759 | contextMenu->addAction(ui.actionSetOverlay); | |
760 | contextMenu->addAction(ui.actionClearOverlay); | |
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
|
761 | |
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
|
762 | if (hasSubfiles) |
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
|
763 | { |
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
|
764 | contextMenu->addSeparator(); |
1217 | 765 | contextMenu->addAction(ui.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
|
766 | } |
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
|
767 | |
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
|
768 | contextMenu->addSeparator(); |
1217 | 769 | contextMenu->addAction(ui.actionModeSelect); |
770 | contextMenu->addAction(ui.actionModeDraw); | |
771 | contextMenu->addAction(ui.actionModeCircle); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
772 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
773 | if (not selectedObjects().isEmpty()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
774 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
775 | contextMenu->addSeparator(); |
1217 | 776 | contextMenu->addAction(ui.actionSubfileSelection); |
655
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 | |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
779 | if (renderer()->camera() != EFreeCamera) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
780 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
781 | contextMenu->addSeparator(); |
1217 | 782 | contextMenu->addAction(ui.actionSetDrawDepth); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
783 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
784 | |
1217 | 785 | contextMenu->exec(pos); |
655
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 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
788 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
789 | // |
1217 | 790 | void MainWindow::deleteByColor(LDColor color) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
791 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
792 | LDObjectList objs; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
793 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
794 | for (LDObject* obj : m_currentDocument->objects()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
795 | { |
840
d077dd19bf9a
- changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents:
834
diff
changeset
|
796 | if (not obj->isColored() or obj->color() != color) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
797 | continue; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
798 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
799 | objs << obj; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
800 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
801 | |
944 | 802 | for (LDObject* obj : objs) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
803 | obj->destroy(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
804 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
805 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
806 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
807 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
808 | void MainWindow::updateEditModeActions() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
809 | { |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
810 | const EditModeType mode = renderer()->currentEditModeType(); |
1217 | 811 | ui.actionModeSelect->setChecked(mode == EditModeType::Select); |
812 | ui.actionModeDraw->setChecked(mode == EditModeType::Draw); | |
813 | ui.actionModeRectangle->setChecked(mode == EditModeType::Rectangle); | |
814 | ui.actionModeCircle->setChecked(mode == EditModeType::Circle); | |
815 | ui.actionModeMagicWand->setChecked(mode == EditModeType::MagicWand); | |
816 | ui.actionModeLinePath->setChecked(mode == EditModeType::LinePath); | |
817 | ui.actionModeCurve->setChecked(mode == EditModeType::Curve); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
818 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
819 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
820 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
821 | // |
1217 | 822 | void MainWindow::objectListDoubleClicked(QListWidgetItem* listitem) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
823 | { |
1217 | 824 | LDObject* object = m_objectsInList.reverseLookup(listitem); |
825 | AddObjectDialog::staticDialog(object->type(), object); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
826 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
827 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
828 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
829 | // |
1217 | 830 | bool MainWindow::save(LDDocument* doc, bool saveAs) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
831 | { |
979
880d3fe9ac7c
Refactor LDDocument's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
832 | if (doc->isCache()) |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
833 | return false; |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
834 | |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
788
diff
changeset
|
835 | QString path = doc->fullPath(); |
834
3e697ba996e8
- now prints the filesize upon successful save
Santeri Piippo <crimsondusk64@gmail.com>
parents:
830
diff
changeset
|
836 | int64 savesize; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
837 | |
840
d077dd19bf9a
- changed `&&` and `||` operators to their named variants `and` and `or`
Teemu Piippo <crimsondusk64@gmail.com>
parents:
834
diff
changeset
|
838 | if (saveAs or path.isEmpty()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
839 | { |
789
4b7306f52bb5
- String -> QString
Santeri Piippo <crimsondusk64@gmail.com>
parents:
788
diff
changeset
|
840 | QString name = doc->defaultName(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
841 | |
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
|
842 | if (not doc->fullPath().isEmpty()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
843 | name = doc->fullPath(); |
967 | 844 | else if (not doc->name().isEmpty()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
845 | name = doc->name(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
846 | |
1217 | 847 | name.replace("\\", "/"); |
848 | path = QFileDialog::getSaveFileName(this, tr("Save As"), | |
849 | name, tr("LDraw files(*.dat *.ldr)")); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
850 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
851 | if (path.isEmpty()) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
852 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
853 | // User didn't give a file name, abort. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
854 | return false; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
855 | } |
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 | |
1217 | 858 | if (doc->save(path, &savesize)) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
859 | { |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
860 | if (doc == m_currentDocument) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
861 | updateTitle(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
862 | |
1217 | 863 | print("Saved to %1(%2)", path, MakePrettyFileSize(savesize)); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
864 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
865 | // Add it to recent files |
1217 | 866 | m_documents->addRecentFile(path); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
867 | return true; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
868 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
869 | |
1217 | 870 | QString message = format(tr("Failed to save to %1: %2"), path, strerror(errno)); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
871 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
872 | // Tell the user the save failed, and give the option for saving as with it. |
1217 | 873 | QMessageBox dlg(QMessageBox::Critical, tr("Save Failure"), message, QMessageBox::Close, this); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
874 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
875 | // Add a save-as button |
1217 | 876 | QPushButton* saveAsBtn = new QPushButton(tr("Save As")); |
877 | saveAsBtn->setIcon(GetIcon("file-save-as")); | |
878 | dlg.addButton(saveAsBtn, QMessageBox::ActionRole); | |
879 | dlg.setDefaultButton(QMessageBox::Close); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
880 | dlg.exec(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
881 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
882 | if (dlg.clickedButton() == saveAsBtn) |
1217 | 883 | return save(doc, true); // yay recursion! |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
884 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
885 | return false; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
886 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
887 | |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
888 | // Adds a message to the renderer's message manager. |
1217 | 889 | void MainWindow::addMessage(QString msg) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
890 | { |
1217 | 891 | m_renderer->messageLog()->addLine(msg); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
892 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
893 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
894 | // ============================================================================ |
1217 | 895 | void ObjectList::contextMenuEvent(QContextMenuEvent* ev) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
896 | { |
1217 | 897 | g_win->spawnContextMenu(ev->globalPos()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
898 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
899 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
900 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
901 | // |
1217 | 902 | QPixmap GetIcon(QString iconName) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
903 | { |
1217 | 904 | return (QPixmap(format(":/icons/%1.png", iconName))); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
905 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
906 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
907 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
908 | // |
1217 | 909 | bool Confirm(const QString& message) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
910 | { |
1217 | 911 | return Confirm(MainWindow::tr("Confirm"), message); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
912 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
913 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
914 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
915 | // |
1217 | 916 | bool Confirm(const QString& title, const QString& message) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
917 | { |
1217 | 918 | return QMessageBox::question(g_win, title, message, |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
919 | (QMessageBox::Yes | QMessageBox::No), QMessageBox::No) == QMessageBox::Yes; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
920 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
921 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
922 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
923 | // |
1217 | 924 | void Critical(const QString& message) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
925 | { |
1217 | 926 | QMessageBox::critical(g_win, MainWindow::tr("Error"), message, |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
927 | (QMessageBox::Close), QMessageBox::Close); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
928 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
929 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
930 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
931 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
932 | void MainWindow::updateDocumentList() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
933 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
934 | m_updatingTabs = true; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
935 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
936 | while (m_tabs->count() > 0) |
1217 | 937 | m_tabs->removeTab(0); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
938 | |
998 | 939 | for (LDDocument* document : m_documents->allDocuments()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
940 | { |
979
880d3fe9ac7c
Refactor LDDocument's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
941 | if (not document->isCache()) |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
942 | { |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
943 | // Add an item to the list for this file and store the tab index |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
944 | // in the document so we can find documents by tab index. |
1217 | 945 | document->setTabIndex(m_tabs->addTab("")); |
946 | updateDocumentListItem(document); | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
947 | } |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
948 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
949 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
950 | m_updatingTabs = false; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
951 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
952 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
953 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
954 | // |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
955 | // Update the given document's tab. If no such tab exists, the document list is rebuilt. |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
956 | // |
1217 | 957 | void MainWindow::updateDocumentListItem(LDDocument* doc) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
958 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
959 | bool oldUpdatingTabs = m_updatingTabs; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
960 | m_updatingTabs = true; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
961 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
962 | if (doc->tabIndex() == -1) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
963 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
964 | // We don't have a list item for this file, so the list either doesn't |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
965 | // exist yet or is out of date. Build the list now. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
966 | updateDocumentList(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
967 | return; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
968 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
969 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
970 | // If this is the current file, it also needs to be the selected item on |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
971 | // the list. |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
972 | if (doc == m_currentDocument) |
1217 | 973 | m_tabs->setCurrentIndex(doc->tabIndex()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
974 | |
1217 | 975 | m_tabs->setTabText(doc->tabIndex(), doc->getDisplayName()); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
976 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
977 | // If the document.has unsaved changes, draw a little icon next to it to mark that. |
1217 | 978 | m_tabs->setTabIcon(doc->tabIndex(), doc->hasUnsavedChanges() ? GetIcon("file-save") : QIcon()); |
979 | m_tabs->setTabData(doc->tabIndex(), doc->name()); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
980 | m_updatingTabs = oldUpdatingTabs; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
981 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
982 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
983 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
984 | // |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
985 | // A file is selected from the list of files on the left of the screen. Find out |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
986 | // which file was picked and change to it. |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
987 | // |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
988 | void MainWindow::tabSelected() |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
989 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
990 | if (m_updatingTabs) |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
991 | return; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
992 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
993 | LDDocument* switchee = nullptr; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
994 | int tabIndex = m_tabs->currentIndex(); |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
995 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
996 | // Find the file pointer of the item that was selected. |
998 | 997 | for (LDDocument* document : m_documents->allDocuments()) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
998 | { |
979
880d3fe9ac7c
Refactor LDDocument's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
999 | if (not document->isCache() and document->tabIndex() == tabIndex) |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1000 | { |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1001 | switchee = document; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1002 | break; |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1003 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1004 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1005 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1006 | if (switchee and switchee != m_currentDocument) |
1217 | 1007 | changeDocument(switchee); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1008 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1009 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1010 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1011 | // |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1012 | // Updates the object list. Right now this just rebuilds it. |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1013 | // |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1014 | void MainWindow::refreshObjectList() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1015 | { |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1016 | #if 0 |
965
d1b0aa40db91
MainWindow: "ui->" -> "ui."
Teemu Piippo <crimsondusk64@gmail.com>
parents:
963
diff
changeset
|
1017 | ui.objectList->clear(); |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1018 | LDDocument* f = getm_currentDocument; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1019 | |
944 | 1020 | for (LDObject* obj : *f) |
1217 | 1021 | ui.objectList->addItem(obj->qObjListEntry); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1022 | |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1023 | #endif |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1024 | |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1025 | buildObjectList(); |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1026 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1027 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1028 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1029 | // |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1030 | // Updates various actions, undo/redo are set enabled/disabled where appropriate, togglable actions are updated based |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1031 | // on configuration, etc. |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1032 | // |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1033 | void MainWindow::updateActions() |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1034 | { |
985
ed7b31b9f904
Remove "!= nullptr" expressions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
1035 | if (m_currentDocument and m_currentDocument->history()) |
815
efe34366e56a
- added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
808
diff
changeset
|
1036 | { |
983
05ba93066194
Refactor edit history
Teemu Piippo <crimsondusk64@gmail.com>
parents:
981
diff
changeset
|
1037 | EditHistory* his = m_currentDocument->history(); |
815
efe34366e56a
- added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
808
diff
changeset
|
1038 | int pos = his->position(); |
1217 | 1039 | ui.actionUndo->setEnabled(pos != -1); |
1040 | ui.actionRedo->setEnabled(pos <(long) his->size() - 1); | |
815
efe34366e56a
- added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
808
diff
changeset
|
1041 | } |
efe34366e56a
- added ability to filter out surfaces/edgelines/condlines from the viewport
Santeri Piippo <crimsondusk64@gmail.com>
parents:
808
diff
changeset
|
1042 | |
1224 | 1043 | ui.actionWireframe->setChecked(config->drawWireframe()); |
1044 | ui.actionAxes->setChecked(config->drawAxes()); | |
1045 | ui.actionBfcView->setChecked(config->bfcRedGreenView()); | |
1046 | ui.actionRandomColors->setChecked(config->randomColors()); | |
1047 | ui.actionDrawAngles->setChecked(config->drawAngles()); | |
1048 | ui.actionDrawSurfaces->setChecked(config->drawSurfaces()); | |
1049 | ui.actionDrawEdgeLines->setChecked(config->drawEdgeLines()); | |
1050 | ui.actionDrawConditionalLines->setChecked(config->drawConditionalLines()); | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1051 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1052 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1053 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1054 | // |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1055 | GLRenderer* MainWindow::renderer() |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1056 | { |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1057 | return m_renderer; |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1058 | } |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1059 | |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1060 | // --------------------------------------------------------------------------------------------------------------------- |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1061 | // |
1217 | 1062 | void MainWindow::setQuickColors(const QList<ColorToolbarItem>& colors) |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1063 | { |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1064 | m_quickColors = colors; |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1065 | updateColorToolbar(); |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1066 | } |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1067 | |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1068 | // --------------------------------------------------------------------------------------------------------------------- |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1069 | // |
790
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1070 | void MainWindow::updatePrimitives() |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1071 | { |
1217 | 1072 | populatePrimitivesTree(ui.primitives); |
790
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1073 | } |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1074 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1075 | // --------------------------------------------------------------------------------------------------------------------- |
790
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1076 | // |
1217 | 1077 | void MainWindow::closeTab(int tabindex) |
798
88d4973cfe1a
- added close buttons to tabs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
1078 | { |
1217 | 1079 | LDDocument* doc = m_documents->findDocumentByName(m_tabs->tabData(tabindex).toString()); |
798
88d4973cfe1a
- added close buttons to tabs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
1080 | |
998 | 1081 | if (doc) |
1082 | doc->close(); | |
798
88d4973cfe1a
- added close buttons to tabs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
1083 | } |
88d4973cfe1a
- added close buttons to tabs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
1084 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1085 | // --------------------------------------------------------------------------------------------------------------------- |
798
88d4973cfe1a
- added close buttons to tabs
Santeri Piippo <crimsondusk64@gmail.com>
parents:
795
diff
changeset
|
1086 | // |
983
05ba93066194
Refactor edit history
Teemu Piippo <crimsondusk64@gmail.com>
parents:
981
diff
changeset
|
1087 | void MainWindow::historyTraversed() |
05ba93066194
Refactor edit history
Teemu Piippo <crimsondusk64@gmail.com>
parents:
981
diff
changeset
|
1088 | { |
05ba93066194
Refactor edit history
Teemu Piippo <crimsondusk64@gmail.com>
parents:
981
diff
changeset
|
1089 | updateActions(); |
05ba93066194
Refactor edit history
Teemu Piippo <crimsondusk64@gmail.com>
parents:
981
diff
changeset
|
1090 | refresh(); |
05ba93066194
Refactor edit history
Teemu Piippo <crimsondusk64@gmail.com>
parents:
981
diff
changeset
|
1091 | } |
05ba93066194
Refactor edit history
Teemu Piippo <crimsondusk64@gmail.com>
parents:
981
diff
changeset
|
1092 | |
05ba93066194
Refactor edit history
Teemu Piippo <crimsondusk64@gmail.com>
parents:
981
diff
changeset
|
1093 | // --------------------------------------------------------------------------------------------------------------------- |
05ba93066194
Refactor edit history
Teemu Piippo <crimsondusk64@gmail.com>
parents:
981
diff
changeset
|
1094 | // |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1095 | void MainWindow::loadShortcuts() |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1096 | { |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1097 | for (QAction* act : findChildren<QAction*>()) |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1098 | { |
1217 | 1099 | QKeySequence seq = m_settings->value("shortcut_" + act->objectName(), act->shortcut()).value<QKeySequence>(); |
1100 | act->setShortcut(seq); | |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1101 | } |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1102 | } |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1103 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1104 | // --------------------------------------------------------------------------------------------------------------------- |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1105 | // |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1106 | void MainWindow::saveShortcuts() |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1107 | { |
1217 | 1108 | applyToActions([&](QAction* act) |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1109 | { |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1110 | QString const key = "shortcut_" + act->objectName(); |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1111 | |
998 | 1112 | if (m_defaultShortcuts[act] != act->shortcut()) |
1217 | 1113 | m_settings->setValue(key, act->shortcut()); |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1114 | else |
1217 | 1115 | m_settings->remove(key); |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1116 | }); |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1117 | } |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1118 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1119 | // --------------------------------------------------------------------------------------------------------------------- |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1120 | // |
1217 | 1121 | void MainWindow::applyToActions(std::function<void(QAction*)> function) |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1122 | { |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1123 | for (QAction* act : findChildren<QAction*>()) |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1124 | { |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1125 | if (not act->objectName().isEmpty()) |
1217 | 1126 | function(act); |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1127 | } |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1128 | } |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1129 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1130 | // --------------------------------------------------------------------------------------------------------------------- |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1131 | // |
963
c1526d1877d7
More through removal of the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents:
962
diff
changeset
|
1132 | QTreeWidget* MainWindow::getPrimitivesTree() const |
c1526d1877d7
More through removal of the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents:
962
diff
changeset
|
1133 | { |
965
d1b0aa40db91
MainWindow: "ui->" -> "ui."
Teemu Piippo <crimsondusk64@gmail.com>
parents:
963
diff
changeset
|
1134 | return ui.primitives; |
963
c1526d1877d7
More through removal of the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents:
962
diff
changeset
|
1135 | } |
c1526d1877d7
More through removal of the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents:
962
diff
changeset
|
1136 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1137 | // --------------------------------------------------------------------------------------------------------------------- |
963
c1526d1877d7
More through removal of the vertex object
Teemu Piippo <crimsondusk64@gmail.com>
parents:
962
diff
changeset
|
1138 | // |
1217 | 1139 | QKeySequence MainWindow::defaultShortcut(QAction* act) |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1140 | { |
998 | 1141 | return m_defaultShortcuts[act]; |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1142 | } |
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1143 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1144 | // --------------------------------------------------------------------------------------------------------------------- |
806
4240f47aa2d4
- moved most of LDColorData API into LDColor
Santeri Piippo <crimsondusk64@gmail.com>
parents:
798
diff
changeset
|
1145 | // |
865
6d68840fcb26
- circle mode can now do hi-res
Teemu Piippo <crimsondusk64@gmail.com>
parents:
861
diff
changeset
|
1146 | bool MainWindow::ringToolHiRes() const |
6d68840fcb26
- circle mode can now do hi-res
Teemu Piippo <crimsondusk64@gmail.com>
parents:
861
diff
changeset
|
1147 | { |
965
d1b0aa40db91
MainWindow: "ui->" -> "ui."
Teemu Piippo <crimsondusk64@gmail.com>
parents:
963
diff
changeset
|
1148 | return ui.ringToolHiRes->isChecked(); |
865
6d68840fcb26
- circle mode can now do hi-res
Teemu Piippo <crimsondusk64@gmail.com>
parents:
861
diff
changeset
|
1149 | } |
6d68840fcb26
- circle mode can now do hi-res
Teemu Piippo <crimsondusk64@gmail.com>
parents:
861
diff
changeset
|
1150 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1151 | // --------------------------------------------------------------------------------------------------------------------- |
865
6d68840fcb26
- circle mode can now do hi-res
Teemu Piippo <crimsondusk64@gmail.com>
parents:
861
diff
changeset
|
1152 | // |
6d68840fcb26
- circle mode can now do hi-res
Teemu Piippo <crimsondusk64@gmail.com>
parents:
861
diff
changeset
|
1153 | int MainWindow::ringToolSegments() const |
6d68840fcb26
- circle mode can now do hi-res
Teemu Piippo <crimsondusk64@gmail.com>
parents:
861
diff
changeset
|
1154 | { |
965
d1b0aa40db91
MainWindow: "ui->" -> "ui."
Teemu Piippo <crimsondusk64@gmail.com>
parents:
963
diff
changeset
|
1155 | return ui.ringToolSegments->value(); |
865
6d68840fcb26
- circle mode can now do hi-res
Teemu Piippo <crimsondusk64@gmail.com>
parents:
861
diff
changeset
|
1156 | } |
6d68840fcb26
- circle mode can now do hi-res
Teemu Piippo <crimsondusk64@gmail.com>
parents:
861
diff
changeset
|
1157 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1158 | // --------------------------------------------------------------------------------------------------------------------- |
865
6d68840fcb26
- circle mode can now do hi-res
Teemu Piippo <crimsondusk64@gmail.com>
parents:
861
diff
changeset
|
1159 | // |
1217 | 1160 | void MainWindow::ringToolHiResClicked(bool checked) |
866
4951b737f8cb
- now able to spawn partial circular primitives
Teemu Piippo <crimsondusk64@gmail.com>
parents:
865
diff
changeset
|
1161 | { |
4951b737f8cb
- now able to spawn partial circular primitives
Teemu Piippo <crimsondusk64@gmail.com>
parents:
865
diff
changeset
|
1162 | if (checked) |
4951b737f8cb
- now able to spawn partial circular primitives
Teemu Piippo <crimsondusk64@gmail.com>
parents:
865
diff
changeset
|
1163 | { |
1217 | 1164 | ui.ringToolSegments->setMaximum(HighResolution); |
1165 | ui.ringToolSegments->setValue(ui.ringToolSegments->value() * 3); | |
866
4951b737f8cb
- now able to spawn partial circular primitives
Teemu Piippo <crimsondusk64@gmail.com>
parents:
865
diff
changeset
|
1166 | } |
4951b737f8cb
- now able to spawn partial circular primitives
Teemu Piippo <crimsondusk64@gmail.com>
parents:
865
diff
changeset
|
1167 | else |
4951b737f8cb
- now able to spawn partial circular primitives
Teemu Piippo <crimsondusk64@gmail.com>
parents:
865
diff
changeset
|
1168 | { |
1217 | 1169 | ui.ringToolSegments->setValue(ui.ringToolSegments->value() / 3); |
1170 | ui.ringToolSegments->setMaximum(LowResolution); | |
866
4951b737f8cb
- now able to spawn partial circular primitives
Teemu Piippo <crimsondusk64@gmail.com>
parents:
865
diff
changeset
|
1171 | } |
4951b737f8cb
- now able to spawn partial circular primitives
Teemu Piippo <crimsondusk64@gmail.com>
parents:
865
diff
changeset
|
1172 | } |
4951b737f8cb
- now able to spawn partial circular primitives
Teemu Piippo <crimsondusk64@gmail.com>
parents:
865
diff
changeset
|
1173 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1174 | // --------------------------------------------------------------------------------------------------------------------- |
871
a860edb4210b
- display a label next to the spinbox showing the fraction
Teemu Piippo <crimsondusk64@gmail.com>
parents:
869
diff
changeset
|
1175 | // |
a860edb4210b
- display a label next to the spinbox showing the fraction
Teemu Piippo <crimsondusk64@gmail.com>
parents:
869
diff
changeset
|
1176 | void MainWindow::circleToolSegmentsChanged() |
a860edb4210b
- display a label next to the spinbox showing the fraction
Teemu Piippo <crimsondusk64@gmail.com>
parents:
869
diff
changeset
|
1177 | { |
1217 | 1178 | int numerator(ui.ringToolSegments->value()); |
1179 | int denominator(ui.ringToolHiRes->isChecked() ? HighResolution : LowResolution); | |
1180 | Simplify(numerator, denominator); | |
1181 | ui.ringToolSegmentsLabel->setText(format("%1 / %2", numerator, denominator)); | |
871
a860edb4210b
- display a label next to the spinbox showing the fraction
Teemu Piippo <crimsondusk64@gmail.com>
parents:
869
diff
changeset
|
1182 | } |
866
4951b737f8cb
- now able to spawn partial circular primitives
Teemu Piippo <crimsondusk64@gmail.com>
parents:
865
diff
changeset
|
1183 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1184 | // --------------------------------------------------------------------------------------------------------------------- |
970
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
969
diff
changeset
|
1185 | // |
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
969
diff
changeset
|
1186 | // Accessor to the settings object |
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
969
diff
changeset
|
1187 | // |
1217 | 1188 | QSettings* makeSettings(QObject* parent) |
970
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
969
diff
changeset
|
1189 | { |
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
969
diff
changeset
|
1190 | QString path = qApp->applicationDirPath() + "/" UNIXNAME ".ini"; |
1217 | 1191 | return new QSettings(path, QSettings::IniFormat, parent); |
970
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
969
diff
changeset
|
1192 | } |
c8aae45afd85
Commit configuration rework (doesn't work yet, more than most probably doesn't compile either)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
969
diff
changeset
|
1193 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1194 | // --------------------------------------------------------------------------------------------------------------------- |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1195 | // |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1196 | void MainWindow::syncSettings() |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1197 | { |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1198 | m_settings->sync(); |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1199 | } |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1200 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1201 | // --------------------------------------------------------------------------------------------------------------------- |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1202 | // |
1217 | 1203 | QVariant MainWindow::getConfigValue(QString name) |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1204 | { |
1224 | 1205 | QVariant value = m_settings->value(name, config->defaultValueByName(name)); |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1206 | return value; |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1207 | } |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1208 | |
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1209 | // --------------------------------------------------------------------------------------------------------------------- |
866
4951b737f8cb
- now able to spawn partial circular primitives
Teemu Piippo <crimsondusk64@gmail.com>
parents:
865
diff
changeset
|
1210 | // |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1211 | void MainWindow::createBlankDocument() |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1212 | { |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1213 | // Create a new anonymous file and set it to our current |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1214 | LDDocument* f = newDocument(); |
1217 | 1215 | f->setName(""); |
1216 | changeDocument(f); | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1217 | closeInitialDocument(); |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1218 | doFullRefresh(); |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1219 | updateActions(); |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1220 | } |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1221 | |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1222 | // --------------------------------------------------------------------------------------------------------------------- |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1223 | // |
1217 | 1224 | LDDocument* MainWindow::newDocument(bool cache) |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1225 | { |
998 | 1226 | LDDocument* document = m_documents->createNew(); |
1217 | 1227 | connect(document->history(), SIGNAL(undone()), this, SLOT(historyTraversed())); |
1228 | connect(document->history(), SIGNAL(redone()), this, SLOT(historyTraversed())); | |
1229 | connect(document->history(), SIGNAL(stepAdded()), this, SLOT(updateActions())); | |
979
880d3fe9ac7c
Refactor LDDocument's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
1230 | |
880d3fe9ac7c
Refactor LDDocument's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
1231 | if (not cache) |
983
05ba93066194
Refactor edit history
Teemu Piippo <crimsondusk64@gmail.com>
parents:
981
diff
changeset
|
1232 | document->openForEditing(); |
979
880d3fe9ac7c
Refactor LDDocument's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
1233 | |
983
05ba93066194
Refactor edit history
Teemu Piippo <crimsondusk64@gmail.com>
parents:
981
diff
changeset
|
1234 | return document; |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1235 | } |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1236 | |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1237 | // --------------------------------------------------------------------------------------------------------------------- |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1238 | // |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1239 | LDDocument* MainWindow::currentDocument() |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1240 | { |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1241 | return m_currentDocument; |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1242 | } |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1243 | |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1244 | // --------------------------------------------------------------------------------------------------------------------- |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1245 | // |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1246 | // TODO: document may be null, this shouldn't be the case |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1247 | // |
1217 | 1248 | void MainWindow::changeDocument(LDDocument* document) |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1249 | { |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1250 | // Implicit files were loaded for caching purposes and may never be switched to. |
985
ed7b31b9f904
Remove "!= nullptr" expressions
Teemu Piippo <crimsondusk64@gmail.com>
parents:
984
diff
changeset
|
1251 | if (document and document->isCache()) |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1252 | return; |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1253 | |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1254 | m_currentDocument = document; |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1255 | |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1256 | if (document) |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1257 | { |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1258 | // A ton of stuff needs to be updated |
1217 | 1259 | updateDocumentListItem(document); |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1260 | buildObjectList(); |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1261 | updateTitle(); |
1217 | 1262 | m_renderer->setDocument(document); |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1263 | m_renderer->compiler()->needMerge(); |
1217 | 1264 | print("Changed document to %1", document->getDisplayName()); |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1265 | } |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1266 | } |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1267 | |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1268 | // --------------------------------------------------------------------------------------------------------------------- |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1269 | // |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1270 | // This little beauty closes the initial file that was open at first when opening a new file over it. |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1271 | // |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1272 | void MainWindow::closeInitialDocument() |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1273 | { |
998 | 1274 | /* |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1275 | if (m_documents.size() == 2 and |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1276 | m_documents[0]->name().isEmpty() and |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1277 | not m_documents[1]->name().isEmpty() and |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1278 | not m_documents[0]->hasUnsavedChanges()) |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1279 | { |
979
880d3fe9ac7c
Refactor LDDocument's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
1280 | m_documents.first()->close(); |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1281 | } |
998 | 1282 | */ |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1283 | } |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1284 | |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1285 | // --------------------------------------------------------------------------------------------------------------------- |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1286 | // |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1287 | const LDObjectList& MainWindow::selectedObjects() |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1288 | { |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1289 | return m_currentDocument->getSelection(); |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1290 | } |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1291 | |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1292 | // --------------------------------------------------------------------------------------------------------------------- |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1293 | // |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1294 | void MainWindow::currentDocumentClosed() |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1295 | { |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1296 | LDDocument* old = currentDocument(); |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1297 | |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1298 | // Find a replacement document to use |
998 | 1299 | for (LDDocument* doc : m_documents->allDocuments()) |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1300 | { |
979
880d3fe9ac7c
Refactor LDDocument's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
978
diff
changeset
|
1301 | if (doc != old and not doc->isCache()) |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1302 | { |
1217 | 1303 | changeDocument(doc); |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1304 | break; |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1305 | } |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1306 | } |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1307 | |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1308 | if (currentDocument() == old) |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1309 | { |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1310 | // Failed to change to a suitable document, open a new one. |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1311 | createBlankDocument(); |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1312 | } |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1313 | } |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1314 | |
981
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1315 | ExtProgramToolset* MainWindow::externalPrograms() |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1316 | { |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1317 | return m_externalPrograms; |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1318 | } |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1319 | |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1320 | GuiUtilities* MainWindow::guiUtilities() |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1321 | { |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1322 | return m_guiUtilities; |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1323 | } |
5d5d84ab2c48
Refactor MainWindow's API
Teemu Piippo <crimsondusk64@gmail.com>
parents:
979
diff
changeset
|
1324 | |
978
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1325 | // --------------------------------------------------------------------------------------------------------------------- |
4603d8fd063e
Make documents members of the main window
Teemu Piippo <crimsondusk64@gmail.com>
parents:
975
diff
changeset
|
1326 | // |
1217 | 1327 | ColorToolbarItem::ColorToolbarItem(LDColor color, QToolButton* toolButton) : |
1328 | m_color(color), | |
1329 | m_toolButton(toolButton) {} | |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1330 | |
1010
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1331 | ColorToolbarItem ColorToolbarItem::makeSeparator() |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1332 | { |
1217 | 1333 | return ColorToolbarItem(LDColor::nullColor(), nullptr); |
1010
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1334 | } |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1335 | |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1336 | bool ColorToolbarItem::isSeparator() const |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1337 | { |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1338 | return color() == LDColor::nullColor(); |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1339 | } |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1340 | |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1341 | LDColor ColorToolbarItem::color() const |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1342 | { |
1010
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1343 | return m_color; |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1344 | } |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1345 | |
1217 | 1346 | void ColorToolbarItem::setColor(LDColor color) |
1010
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1347 | { |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1348 | m_color = color; |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1349 | } |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1350 | |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1351 | QToolButton* ColorToolbarItem::toolButton() const |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1352 | { |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1353 | return m_toolButton; |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1354 | } |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1355 | |
1217 | 1356 | void ColorToolbarItem::setToolButton(QToolButton* value) |
1010
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1357 | { |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1358 | m_toolButton = value; |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1359 | } |
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1360 | |
971
c00f9665a9f8
Now compiles and links but crashes shortly after startup.
Teemu Piippo <crimsondusk64@gmail.com>
parents:
970
diff
changeset
|
1361 | // --------------------------------------------------------------------------------------------------------------------- |
655
b376645315ab
- renamed files to camelCase
Santeri Piippo <crimsondusk64@gmail.com>
parents:
diff
changeset
|
1362 | // |
1217 | 1363 | void populatePrimitivesTree(QTreeWidget* tw, QString const& selectByDefault) |
790
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1364 | { |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1365 | tw->clear(); |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1366 | |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1367 | for (PrimitiveCategory* cat : g_PrimitiveCategories) |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1368 | { |
1217 | 1369 | PrimitiveTreeItem* parentItem = new PrimitiveTreeItem(tw, nullptr); |
1370 | parentItem->setText(0, cat->name()); | |
790
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1371 | QList<QTreeWidgetItem*> subfileItems; |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1372 | |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1373 | for (Primitive& prim : cat->prims) |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1374 | { |
1217 | 1375 | PrimitiveTreeItem* item = new PrimitiveTreeItem(parentItem, &prim); |
1376 | item->setText(0, format("%1 - %2", prim.name, prim.title)); | |
790
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1377 | subfileItems << item; |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1378 | |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1379 | // If this primitive is the one the current object points to, |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1380 | // select it by default |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1381 | if (selectByDefault == prim.name) |
1217 | 1382 | tw->setCurrentItem(item); |
790
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1383 | } |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1384 | |
1217 | 1385 | tw->addTopLevelItem(parentItem); |
790
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1386 | } |
fe1b83f6ba82
- added primitives toolbox
Santeri Piippo <crimsondusk64@gmail.com>
parents:
789
diff
changeset
|
1387 | } |
1010
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1388 | |
1217 | 1389 | PrimitiveTreeItem::PrimitiveTreeItem(QTreeWidgetItem* parent, Primitive* info) : |
1390 | QTreeWidgetItem(parent), | |
1391 | m_primitive(info) {} | |
1010
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1392 | |
1217 | 1393 | PrimitiveTreeItem::PrimitiveTreeItem(QTreeWidget* parent, Primitive* info) : |
1394 | QTreeWidgetItem(parent), | |
1395 | m_primitive(info) {} | |
1010
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1396 | |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1397 | Primitive* PrimitiveTreeItem::primitive() const |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1398 | { |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1399 | return m_primitive; |
969b48eddd6b
A bit more cleanup. Finally removed the PROPERTY macro. (now let's see about making a new one sometime that isn't so terrible?)
Teemu Piippo <crimsondusk64@gmail.com>
parents:
1005
diff
changeset
|
1400 | } |