# HG changeset patch # User Teemu Piippo # Date 1656883430 -10800 # Node ID edb6c09cdd3c0063abf29172390d5c81f2e571cf # Parent 6d75fa09cc0c27d1f4b30a872f7cb87af21a7cbd Delete object editor diff -r 6d75fa09cc0c -r edb6c09cdd3c CMakeLists.txt --- a/CMakeLists.txt Mon Jul 04 00:19:18 2022 +0300 +++ b/CMakeLists.txt Mon Jul 04 00:23:50 2022 +0300 @@ -90,7 +90,6 @@ src/settingseditor/settingseditor.cpp src/types/boundingbox.cpp src/ui/circletooloptionswidget.cpp - src/ui/objecteditor.cpp src/widgets/colorindexinput.cpp src/widgets/colorselectdialog.cpp ) @@ -126,7 +125,6 @@ src/settingseditor/settingseditor.h src/types/boundingbox.h src/ui/circletooloptionswidget.h - src/ui/objecteditor.h src/widgets/colorindexinput.h src/widgets/colorselectdialog.h thirdparty/earcut.h @@ -137,7 +135,6 @@ src/settingseditor/librarieseditor.ui src/settingseditor/settingseditor.ui src/ui/circletool.ui - src/ui/objecteditor.ui src/widgets/colorselectdialog.ui src/widgets/colorindexinput.ui ) diff -r 6d75fa09cc0c -r edb6c09cdd3c src/layers/edittools.cpp --- a/src/layers/edittools.cpp Mon Jul 04 00:19:18 2022 +0300 +++ b/src/layers/edittools.cpp Mon Jul 04 00:23:50 2022 +0300 @@ -19,7 +19,6 @@ #include #include #include "src/model.h" -#include "src/ui/objecteditor.h" #include "src/gl/partrenderer.h" #include "src/circularprimitive.h" #include "src/layers/edittools.h" diff -r 6d75fa09cc0c -r edb6c09cdd3c src/main.cpp --- a/src/main.cpp Mon Jul 04 00:19:18 2022 +0300 +++ b/src/main.cpp Mon Jul 04 00:23:50 2022 +0300 @@ -18,7 +18,6 @@ #include "src/settings.h" #include "src/settingseditor/settingseditor.h" #include "src/ui/circletooloptionswidget.h" -#include "src/ui/objecteditor.h" #include "src/version.h" #include "src/widgets/colorselectdialog.h" #include "src/parser.h" @@ -283,7 +282,6 @@ struct ToolWidgets { CircleToolOptionsWidget* circleToolOptions; - ObjectEditor* objectEditor; }; void initializeTools(Ui_MainWindow* ui, ToolWidgets* toolWidgets, QWidget* parent) @@ -298,7 +296,7 @@ .name = QObject::tr("Select"), .tooltip = QObject::tr("Select elements from the model."), .icon = {":/icons/navigate-outline.png"}, - .widget = toolWidgets->objectEditor, + .widget = nullptr, }, { .name = QObject::tr("Draw"), @@ -440,7 +438,6 @@ ui.setupUi(&mainWindow); ToolWidgets toolWidgets{ .circleToolOptions = new CircleToolOptionsWidget{&mainWindow}, - .objectEditor = new ObjectEditor{&mainWindow}, }; const auto updateTitle = [&ui, &mainWindow]{ mainWindow.setWindowTitle(title(&ui)); diff -r 6d75fa09cc0c -r edb6c09cdd3c src/ui/objecteditor.cpp --- a/src/ui/objecteditor.cpp Mon Jul 04 00:19:18 2022 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,120 +0,0 @@ -#include -#include -#include -#include "src/ui/objecteditor.h" -#include "src/widgets/colorindexinput.h" -#include "widgets/colorbutton.h" -#include "widgets/vec3editor.h" - -using PropertyPointer = std::variant< - glm::vec3*, - glm::mat4*, - QString*, - ldraw::Color*, - CircularFraction*>; - -enum class PropertyKey -{ - Point1, - Point2, - Point3, - Point4, - Control1, - Control2, - Color, - Transformation, - Name, - Text, - Code, - Fraction, -}; - -constexpr std::size_t NUM_PROPERTIES = static_cast(PropertyKey::Fraction) + 1; - -static QString propertyName(PropertyKey key) -{ - switch (key) { - case PropertyKey::Point1: - return ObjectEditor::tr("Vertex 1"); - case PropertyKey::Point2: - return ObjectEditor::tr("Vertex 2"); - case PropertyKey::Point3: - return ObjectEditor::tr("Vertex 3"); - case PropertyKey::Point4: - return ObjectEditor::tr("Vertex 4"); - case PropertyKey::Control1: - return ObjectEditor::tr("Control point 1"); - case PropertyKey::Control2: - return ObjectEditor::tr("Control point 2"); - case PropertyKey::Color: - return ObjectEditor::tr("Colour"); - case PropertyKey::Transformation: - return ObjectEditor::tr("Transformation"); - case PropertyKey::Name: - return ObjectEditor::tr("Name"); - case PropertyKey::Text: - return ObjectEditor::tr("Text"); - case PropertyKey::Code: - return ObjectEditor::tr("Code"); - case PropertyKey::Fraction: - return ObjectEditor::tr("Fraction"); - } - return ""; -} - -static std::map collectProperties(ModelElement& element) -{ - std::map result; - std::visit(overloaded{ - [&](Colored& edge) { - result[PropertyKey::Point1] = &edge.p1; - result[PropertyKey::Point2] = &edge.p2; - result[PropertyKey::Color] = &edge.color; - }, - [&](Colored& tri) { - result[PropertyKey::Point1] = &tri.p1; - result[PropertyKey::Point2] = &tri.p2; - result[PropertyKey::Point3] = &tri.p3; - result[PropertyKey::Color] = &tri.color; - }, - [&](Colored& quad) { - result[PropertyKey::Point1] = &quad.p1; - result[PropertyKey::Point2] = &quad.p2; - result[PropertyKey::Point3] = &quad.p3; - result[PropertyKey::Point4] = &quad.p4; - result[PropertyKey::Color] = &quad.color; - }, - [&](Colored& cedge) { - result[PropertyKey::Point1] = &cedge.p1; - result[PropertyKey::Point2] = &cedge.p2; - result[PropertyKey::Control1] = &cedge.c1; - result[PropertyKey::Control2] = &cedge.c2; - result[PropertyKey::Color] = &cedge.color; - }, - [&](Colored& ref) { - result[PropertyKey::Transformation] = &ref.transformation; - result[PropertyKey::Name] = &ref.name; - result[PropertyKey::Color] = &ref.color; - }, - [&](Colored& circ) { - result[PropertyKey::Transformation] = &circ.transformation; - result[PropertyKey::Fraction] = &circ.fraction; - result[PropertyKey::Color] = &circ.color; - }, - [&](Empty) {}, - [&](Comment& comment) { - result[PropertyKey::Text] = &comment.text; - }, - [&](ParseError& parseError) { - result[PropertyKey::Code] = &parseError.code; - }, - }, element); - return result; -} - - -ObjectEditor::ObjectEditor(QWidget* parent) : - QWidget{parent} -{ - this->ui.setupUi(this); -} diff -r 6d75fa09cc0c -r edb6c09cdd3c src/ui/objecteditor.h --- a/src/ui/objecteditor.h Mon Jul 04 00:19:18 2022 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,14 +0,0 @@ -#pragma once -#include -#include -#include "src/basics.h" -#include "src/model.h" - -class ObjectEditor final : public QWidget -{ - Q_OBJECT - Ui_ObjectEditor ui; - std::vector editorwidgets; -public: - ObjectEditor(QWidget* parent); -}; diff -r 6d75fa09cc0c -r edb6c09cdd3c src/ui/objecteditor.ui --- a/src/ui/objecteditor.ui Mon Jul 04 00:19:18 2022 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,257 +0,0 @@ - - - ObjectEditor - - - - 0 - 0 - 941 - 400 - - - - Form - - - - - - true - - - - - 0 - 0 - 907 - 481 - - - - - - - - - - - - - <icon> - - - - - - - font-weight: bold - - - Object - - - - - - - - - Properties - - - - - - Point 1 - - - point1Label - - - - - - - - - - Point 2 - - - point2Label - - - - - - - - - - Point 3 - - - - - - - - - - Point 4 - - - - - - - - - - Control 1 - - - - - - - - - - Control 2 - - - - - - - - - - Transform - - - - - - - - - - Name - - - name - - - - - - - Text - - - text - - - - - - - Code - - - code - - - - - - - Fraction - - - - - - - - - - - - - - - - Colour - - - color - - - - - - - - - - - - - - - Qt::Vertical - - - - 20 - 40 - - - - - - - - - - Qt::Horizontal - - - - 508 - 20 - - - - - - - - - - - - - VectorInput - QWidget -
widgets/vec3editor.h
-
- - MatrixEditor - QWidget -
widgets/matrixeditor.h
-
- - ColorIndexInput - QWidget -
src/widgets/colorindexinput.h
- 1 -
-
- - -