src/main.cpp

changeset 262
dc33f8a707c4
parent 259
c27612f0eac0
child 263
59b6027b9843
--- a/src/main.cpp	Sun Jun 26 20:27:04 2022 +0300
+++ b/src/main.cpp	Sun Jun 26 20:54:09 2022 +0300
@@ -18,6 +18,7 @@
 #include "ui/circletooloptionswidget.h"
 #include "messagelog.h"
 #include "ui/objecteditor.h"
+#include "ldrawalgorithm.h"
 
 static const QDir LOCALE_DIR {":/locale"};
 
@@ -416,7 +417,10 @@
 				model->append(action.newElement);
 			},
 			[model](const DeleteFromModel& action){
-				model->remove(action.position);
+					model->remove(action.position);
+			},
+			[model](const ModifyModel& action){
+				model->assignAt(action.position, action.newElement);
 			},
 		}, action);
 	};
@@ -694,6 +698,17 @@
 				data->tools->setCircleToolOptions(options);
 			}
 		});
+	QObject::connect(
+		ui.actionMakeUnofficial,
+		&QAction::triggered,
+		[&]{
+			if (ModelData* data = currentModelData(&ui, &documents)) {
+				Model* const model = data->model;
+				for (const ModelAction& action : ldraw::makeUnofficial(model)) {
+					executeAction(model, action);
+				}
+			}
+		});
 	mainWindow.setWindowTitle(title());
 	mainWindow.tabifyDockWidget(ui.messageLogDock, ui.toolOptionsDock);
 	mainWindow.restoreGeometry(setting<Setting::MainWindowGeometry>());

mercurial