удалено: build/.qt/QtDeploySupport.cmake

удалено:       build/.qt/QtDeployTargets.cmake
	удалено:       build/CMakeCache.txt
	удалено:       build/CMakeFiles/4.1.2/CMakeCXXCompiler.cmake
	удалено:       build/CMakeFiles/4.1.2/CMakeDetermineCompilerABI_CXX.bin
	удалено:       build/CMakeFiles/4.1.2/CMakeSystem.cmake
	удалено:       build/CMakeFiles/4.1.2/CompilerIdCXX/CMakeCXXCompilerId.cpp
	удалено:       build/CMakeFiles/4.1.2/CompilerIdCXX/a.out
	удалено:       build/CMakeFiles/CMakeConfigureLog.yaml
	удалено:       build/CMakeFiles/CMakeDirectoryInformation.cmake
	удалено:       build/CMakeFiles/CMakeRuleHashes.txt
	удалено:       build/CMakeFiles/InstallScripts.json
	удалено:       build/CMakeFiles/Makefile.cmake
	удалено:       build/CMakeFiles/Makefile2
	удалено:       build/CMakeFiles/TargetDirectories.txt
	удалено:       build/CMakeFiles/cmake.check_cache
	удалено:       build/CMakeFiles/idef0_editor.dir/DependInfo.cmake
	удалено:       build/CMakeFiles/idef0_editor.dir/build.make
	удалено:       build/CMakeFiles/idef0_editor.dir/cmake_clean.cmake
	удалено:       build/CMakeFiles/idef0_editor.dir/compiler_depend.internal
	удалено:       build/CMakeFiles/idef0_editor.dir/compiler_depend.make
	удалено:       build/CMakeFiles/idef0_editor.dir/compiler_depend.ts
	удалено:       build/CMakeFiles/idef0_editor.dir/depend.make
	удалено:       build/CMakeFiles/idef0_editor.dir/flags.make
	удалено:       build/CMakeFiles/idef0_editor.dir/idef0_editor_autogen/mocs_compilation.cpp.o
	удалено:       build/CMakeFiles/idef0_editor.dir/idef0_editor_autogen/mocs_compilation.cpp.o.d
	удалено:       build/CMakeFiles/idef0_editor.dir/link.d
	удалено:       build/CMakeFiles/idef0_editor.dir/link.txt
	удалено:       build/CMakeFiles/idef0_editor.dir/progress.make
	удалено:       build/CMakeFiles/idef0_editor.dir/src/MainWindow.cpp.o
	удалено:       build/CMakeFiles/idef0_editor.dir/src/MainWindow.cpp.o.d
	удалено:       build/CMakeFiles/idef0_editor.dir/src/items/ArrowItem.cpp.o
	удалено:       build/CMakeFiles/idef0_editor.dir/src/items/ArrowItem.cpp.o.d
	удалено:       build/CMakeFiles/idef0_editor.dir/src/items/BlockItem.cpp.o
	удалено:       build/CMakeFiles/idef0_editor.dir/src/items/BlockItem.cpp.o.d
	удалено:       build/CMakeFiles/idef0_editor.dir/src/items/DiagramScene.cpp.o
	удалено:       build/CMakeFiles/idef0_editor.dir/src/items/DiagramScene.cpp.o.d
	удалено:       build/CMakeFiles/idef0_editor.dir/src/items/JunctionItem.cpp.o
	удалено:       build/CMakeFiles/idef0_editor.dir/src/items/JunctionItem.cpp.o.d
	удалено:       build/CMakeFiles/idef0_editor.dir/src/main.cpp.o
	удалено:       build/CMakeFiles/idef0_editor.dir/src/main.cpp.o.d
	удалено:       build/CMakeFiles/idef0_editor_autogen.dir/AutogenInfo.json
	удалено:       build/CMakeFiles/idef0_editor_autogen.dir/AutogenUsed.txt
	удалено:       build/CMakeFiles/idef0_editor_autogen.dir/DependInfo.cmake
	удалено:       build/CMakeFiles/idef0_editor_autogen.dir/ParseCache.txt
	удалено:       build/CMakeFiles/idef0_editor_autogen.dir/build.make
	удалено:       build/CMakeFiles/idef0_editor_autogen.dir/cmake_clean.cmake
	удалено:       build/CMakeFiles/idef0_editor_autogen.dir/compiler_depend.internal
удалено:       build/CMakeFiles/idef0_editor_autogen.dir/compiler_depend.make
	удалено:       build/CMakeFiles/idef0_editor_autogen.dir/compiler_depend.ts
	удалено:       build/CMakeFiles/idef0_editor_autogen.dir/progress.make
	удалено:       build/CMakeFiles/idef0_editor_autogen_timestamp_deps.dir/DependInfo.cmake
	удалено:       build/CMakeFiles/idef0_editor_autogen_timestamp_deps.dir/build.make
	удалено:       build/CMakeFiles/idef0_editor_autogen_timestamp_deps.dir/cmake_clean.cmake
	удалено:       build/CMakeFiles/idef0_editor_autogen_timestamp_deps.dir/compiler_depend.make
	удалено:       build/CMakeFiles/idef0_editor_autogen_timestamp_deps.dir/compiler_depend.ts
	удалено:       build/CMakeFiles/idef0_editor_autogen_timestamp_deps.dir/progress.make
	удалено:       build/CMakeFiles/progress.marks
	удалено:       build/Makefile
	удалено:       build/cmake_install.cmake
	удалено:       build/idef0_editor
	удалено:       build/idef0_editor_autogen/DWIBBXP2LJ/moc_BlockItem.cpp
	удалено:       build/idef0_editor_autogen/DWIBBXP2LJ/moc_BlockItem.cpp.d
	удалено:       build/idef0_editor_autogen/DWIBBXP2LJ/moc_DiagramScene.cpp
	удалено:       build/idef0_editor_autogen/DWIBBXP2LJ/moc_DiagramScene.cpp.d
	удалено:       build/idef0_editor_autogen/DWIBBXP2LJ/moc_JunctionItem.cpp
	удалено:       build/idef0_editor_autogen/DWIBBXP2LJ/moc_JunctionItem.cpp.d
	удалено:       build/idef0_editor_autogen/UVLADIE3JM/moc_MainWindow.cpp
	удалено:       build/idef0_editor_autogen/UVLADIE3JM/moc_MainWindow.cpp.d
	удалено:       build/idef0_editor_autogen/deps
	удалено:       build/idef0_editor_autogen/moc_predefs.h
	удалено:       build/idef0_editor_autogen/mocs_compilation.cpp
	удалено:       build/idef0_editor_autogen/timestamp
	удалено:       codex
	изменено:      src/items/ArrowItem.cpp
	изменено:      src/items/ArrowItem.h
	изменено:      src/items/BlockItem.h
	изменено:      src/items/DiagramScene.cpp
	изменено:      src/items/DiagramScene.h
This commit is contained in:
Gregory Bednov 2026-02-23 00:23:03 +03:00
commit abdbae5a11
79 changed files with 218 additions and 46399 deletions

View file

@ -19,11 +19,7 @@ DiagramScene::DiagramScene(QObject* parent)
const qreal w = 1122;
const qreal h = 793;
setSceneRect(-w * 0.5, -h * 0.5, w, h);
auto* frame = addRect(sceneRect(), QPen(QColor(80, 80, 80), 1.5, Qt::DashLine), Qt::NoBrush);
frame->setZValue(-5);
frame->setEnabled(false);
frame->setAcceptedMouseButtons(Qt::NoButton);
frame->setData(0, QVariant(QStringLiteral("static-frame")));
ensureFrame();
pushSnapshot();
}
@ -362,16 +358,8 @@ DiagramScene::Snapshot DiagramScene::captureSnapshot() const {
void DiagramScene::restoreSnapshot(const Snapshot& snap) {
m_restoringSnapshot = true;
cancelCurrentDrag();
// Clear dynamic items but keep the static frame.
QList<QGraphicsItem*> toRemove;
for (QGraphicsItem* it : items()) {
if (it->data(0).toString() == QStringLiteral("static-frame")) continue;
toRemove.append(it);
}
for (QGraphicsItem* it : toRemove) {
removeItem(it);
delete it;
}
clear();
ensureFrame();
m_nextBlockId = 1;
m_nextJunctionId = 1;
@ -425,6 +413,7 @@ void DiagramScene::restoreSnapshot(const Snapshot& snap) {
}
m_restoringSnapshot = false;
resetHistory(captureSnapshot());
}
void DiagramScene::pushSnapshot() {
@ -452,7 +441,52 @@ void DiagramScene::undo() {
restoreSnapshot(m_history[m_historyIndex]);
}
bool DiagramScene::goDownIntoSelected() {
const auto sel = selectedItems();
if (sel.size() != 1) return false;
auto* b = qgraphicsitem_cast<BlockItem*>(sel.first());
if (!b) return false;
return goDownIntoBlock(b);
}
bool DiagramScene::goUp() {
if (m_hierarchy.isEmpty()) return false;
Snapshot child = captureSnapshot();
m_children[m_currentBlockId] = child;
const HierNode parent = m_hierarchy.takeLast();
m_currentBlockId = parent.blockId;
restoreSnapshot(parent.snapshot);
return true;
}
bool DiagramScene::goDownIntoBlock(BlockItem* b) {
if (!b) return false;
Snapshot current = captureSnapshot();
m_hierarchy.push_back({m_currentBlockId, current});
m_currentBlockId = b->id();
Snapshot child = m_children.value(m_currentBlockId, Snapshot{});
restoreSnapshot(child);
return true;
}
void DiagramScene::mousePressEvent(QGraphicsSceneMouseEvent* e) {
if (e->button() == Qt::MiddleButton) {
const auto itemsUnder = items(e->scenePos());
for (QGraphicsItem* it : itemsUnder) {
if (auto* b = qgraphicsitem_cast<BlockItem*>(it)) {
if (goDownIntoBlock(b)) {
e->accept();
return;
}
}
}
if (goUp()) {
e->accept();
return;
}
}
if (e->button() == Qt::LeftButton) {
if (e->modifiers().testFlag(Qt::ControlModifier)) {
if (tryBranchAtArrow(e->scenePos())) {
@ -526,6 +560,18 @@ void DiagramScene::keyPressEvent(QKeyEvent* e) {
e->accept();
return;
}
if ((e->key() == Qt::Key_Down || e->key() == Qt::Key_PageDown) && e->modifiers().testFlag(Qt::ControlModifier)) {
if (goDownIntoSelected()) {
e->accept();
return;
}
}
if ((e->key() == Qt::Key_Up || e->key() == Qt::Key_PageUp) && e->modifiers().testFlag(Qt::ControlModifier)) {
if (goUp()) {
e->accept();
return;
}
}
QGraphicsScene::keyPressEvent(e);
}
@ -567,18 +613,20 @@ void DiagramScene::deleteSelection() {
}
}
// delete arrows first to avoid dangling removal from deleted blocks/junctions
QVector<ArrowItem*> arrowsToDelete;
QVector<QGraphicsItem*> othersToDelete;
for (QGraphicsItem* it : toDelete) {
if (qgraphicsitem_cast<ArrowItem*>(it)) {
removeItem(it);
delete it;
if (it->type() == ArrowItem::Type) {
if (auto* a = static_cast<ArrowItem*>(it)) arrowsToDelete.push_back(a);
} else {
othersToDelete.push_back(it);
}
}
for (QGraphicsItem* it : toDelete) {
if (!qgraphicsitem_cast<ArrowItem*>(it)) {
removeItem(it);
delete it;
}
for (ArrowItem* a : arrowsToDelete) {
delete a;
}
for (QGraphicsItem* it : othersToDelete) {
delete it;
}
if (!toDelete.isEmpty()) pushSnapshot();
@ -602,3 +650,26 @@ void DiagramScene::maybeSnapshotMovedItems() {
m_pressPositions.clear();
if (moved) pushSnapshot();
}
void DiagramScene::resetHistory(const Snapshot& base) {
m_history.clear();
m_history.push_back(base);
m_historyIndex = 0;
}
void DiagramScene::ensureFrame() {
bool exists = false;
for (QGraphicsItem* it : items()) {
if (it->data(0).toString() == QStringLiteral("static-frame")) {
exists = true;
break;
}
}
if (!exists) {
auto* frame = addRect(sceneRect(), QPen(QColor(80, 80, 80), 1.5, Qt::DashLine), Qt::NoBrush);
frame->setZValue(-5);
frame->setEnabled(false);
frame->setAcceptedMouseButtons(Qt::NoButton);
frame->setData(0, QVariant(QStringLiteral("static-frame")));
}
}