From b944572204b614587d868bb7ad6ff17ba9c03c79 Mon Sep 17 00:00:00 2001
From: karlis <2995621482@qq.com>
Date: Mon, 20 Mar 2023 21:12:23 +0800
Subject: [PATCH 1/3] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E9=A1=B9=E7=9B=AE?=
=?UTF-8?q?=E4=BF=A1=E6=81=AF=E7=AE=A1=E7=90=86=E5=99=A8?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.../ArchitectureColoredPainting.vcxproj | 2 +
...rchitectureColoredPainting.vcxproj.filters | 6 +++
.../Editor/DataManager/ProjectDataManager.cpp | 38 +++++++++++++++++++
.../Editor/DataManager/ProjectDataManager.h | 30 +++++++++++++++
.../src/Editor/EditorWidgetItem.cpp | 11 +++++-
.../src/Editor/EditorWidgetItem.h | 2 +-
.../src/Editor/PreviewWindow.cpp | 21 ++++++++++
.../src/Editor/PreviewWindow.h | 9 +++++
8 files changed, 117 insertions(+), 2 deletions(-)
create mode 100644 ArchitectureColoredPainting/src/Editor/DataManager/ProjectDataManager.cpp
create mode 100644 ArchitectureColoredPainting/src/Editor/DataManager/ProjectDataManager.h
diff --git a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj
index 7414c08..4041213 100644
--- a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj
+++ b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj
@@ -104,6 +104,7 @@
+
@@ -202,6 +203,7 @@
+
diff --git a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters
index 835a354..b43e857 100644
--- a/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters
+++ b/ArchitectureColoredPainting/ArchitectureColoredPainting.vcxproj.filters
@@ -258,6 +258,9 @@
Source Files
+
+ Source Files
+
@@ -522,6 +525,9 @@
Header Files
+
+ Header Files
+
diff --git a/ArchitectureColoredPainting/src/Editor/DataManager/ProjectDataManager.cpp b/ArchitectureColoredPainting/src/Editor/DataManager/ProjectDataManager.cpp
new file mode 100644
index 0000000..1bddf5a
--- /dev/null
+++ b/ArchitectureColoredPainting/src/Editor/DataManager/ProjectDataManager.cpp
@@ -0,0 +1,38 @@
+#include "ProjectDataManager.h"
+
+using namespace std;
+
+ProjectDataManager* ProjectDataManager::instance = nullptr;
+
+ProjectDataManager* ProjectDataManager::Instance()
+{
+ if (instance == nullptr)
+ instance = new ProjectDataManager();
+ return instance;
+}
+
+void ProjectDataManager::addProjectData(ProjectData data)
+{
+ projectDataList.push_back(data);
+}
+
+void ProjectDataManager::setZoom(double x, double y, EditorWidgetItem* item)
+{
+ for (auto& data : projectDataList) {
+ if (data.item == item) {
+ data.zoomX = x;
+ data.zoomY = y;
+ return;
+ }
+ }
+}
+
+QPointF ProjectDataManager::getZoomByPainterDeivce(QPaintDevice* device)
+{
+ for (auto& data : projectDataList) {
+ if (data.item->previewWindow == device) {
+ return QPointF(data.zoomX, data.zoomY);
+ }
+ }
+ return QPointF(1, 1);
+}
diff --git a/ArchitectureColoredPainting/src/Editor/DataManager/ProjectDataManager.h b/ArchitectureColoredPainting/src/Editor/DataManager/ProjectDataManager.h
new file mode 100644
index 0000000..8c5ffbf
--- /dev/null
+++ b/ArchitectureColoredPainting/src/Editor/DataManager/ProjectDataManager.h
@@ -0,0 +1,30 @@
+#pragma once
+#include