From bb81e89c08498130f5605424515d6fd99990df27 Mon Sep 17 00:00:00 2001 From: Aesylwinn Date: Wed, 25 May 2016 22:48:43 -0400 Subject: [PATCH] Revert "Cleanup and slight change to pathgrid editing controls." This reverts commit cc4655e9c7f2b54edd58a179513bd7b8f9957b91. --- apps/opencs/model/world/commands.cpp | 6 +++++- apps/opencs/model/world/nestedcoladapterimp.cpp | 3 +-- apps/opencs/view/render/pagedworldspacewidget.cpp | 2 +- apps/opencs/view/render/pathgridmode.cpp | 6 ++---- 4 files changed, 9 insertions(+), 8 deletions(-) diff --git a/apps/opencs/model/world/commands.cpp b/apps/opencs/model/world/commands.cpp index d53d3f17cd..308b5386e0 100644 --- a/apps/opencs/model/world/commands.cpp +++ b/apps/opencs/model/world/commands.cpp @@ -36,7 +36,6 @@ CSMWorld::ModifyCommand::ModifyCommand (QAbstractItemModel& model, const QModelI { IdTree& tree = static_cast(*mModel); - // ModifyNestedCommand will add its own command to change the modify status if needed mModifyNestedCommand = new ModifyNestedCommand(tree, mIndex, new_, this); setText(mModifyNestedCommand->text()); } @@ -49,7 +48,12 @@ CSMWorld::ModifyCommand::ModifyCommand (QAbstractItemModel& model, const QModelI { mHasRecordState = true; int stateColumnIndex = table->findColumnIndex(Columns::ColumnId_Modification); + int rowIndex = mIndex.row(); + if (mIndex.parent().isValid()) + { + rowIndex = mIndex.parent().row(); + } mRecordStateIndex = table->index(rowIndex, stateColumnIndex); mOldRecordState = static_cast(table->data(mRecordStateIndex).toInt()); diff --git a/apps/opencs/model/world/nestedcoladapterimp.cpp b/apps/opencs/model/world/nestedcoladapterimp.cpp index 1fad55329d..814406a7c5 100644 --- a/apps/opencs/model/world/nestedcoladapterimp.cpp +++ b/apps/opencs/model/world/nestedcoladapterimp.cpp @@ -265,7 +265,6 @@ namespace CSMWorld case 0: return; // return without saving case 1: { - // Remove current and add new while adjusting each points connection count edges.erase(edges.begin()+subRowIndex); if (static_cast(edge.mV0) < points.size()) @@ -273,10 +272,10 @@ namespace CSMWorld edge.mV0 = value.toInt(); + // Place in correct order if (static_cast(edge.mV0) < points.size()) ++points[edge.mV0].mConnectionNum; - // Place in correct order ESM::Pathgrid::EdgeList::iterator it = edges.begin(); for (; it != edges.end(); ++it) { diff --git a/apps/opencs/view/render/pagedworldspacewidget.cpp b/apps/opencs/view/render/pagedworldspacewidget.cpp index 1dba1306e4..a01df43926 100644 --- a/apps/opencs/view/render/pagedworldspacewidget.cpp +++ b/apps/opencs/view/render/pagedworldspacewidget.cpp @@ -332,7 +332,7 @@ void CSVRender::PagedWorldspaceWidget::pathgridAboutToBeRemoved (const QModelInd void CSVRender::PagedWorldspaceWidget::pathgridAdded(const QModelIndex& parent, int start, int end) { - const CSMWorld::SubCellCollection& pathgrids = mDocument.getData().getPathgrids(); + const CSMWorld::SubCellCollection& pathgrids = mDocument.getData().getPathgrids(); if (!parent.isValid()) { diff --git a/apps/opencs/view/render/pathgridmode.cpp b/apps/opencs/view/render/pathgridmode.cpp index fc16d7d993..a4ab394970 100644 --- a/apps/opencs/view/render/pathgridmode.cpp +++ b/apps/opencs/view/render/pathgridmode.cpp @@ -131,10 +131,9 @@ namespace CSVRender if (!selection.empty()) { mDragMode = DragMode_Move; - return true; } - return false; + return true; } bool PathgridMode::secondaryEditStartDrag(const QPoint& pos) @@ -149,11 +148,10 @@ namespace CSVRender mFromNode = SceneUtil::getPathgridNode(static_cast(hit.index0)); tag->getPathgrid()->setupConnectionIndicator(mFromNode); - return true; } } - return false; + return true; } void PathgridMode::drag(const QPoint& pos, int diffX, int diffY, double speedFactor)