1
0
Fork 0
mirror of https://github.com/OpenMW/openmw.git synced 2025-01-21 08:23:53 +00:00

Cleanup and slight change to pathgrid editing controls.

Now that there is a drag indicator, it is easy to tell if an
operation is active or not.
This commit is contained in:
Aesylwinn 2016-05-24 18:19:05 -04:00
parent 5eaaed05fc
commit cc4655e9c7
4 changed files with 8 additions and 9 deletions

View file

@ -36,6 +36,7 @@ CSMWorld::ModifyCommand::ModifyCommand (QAbstractItemModel& model, const QModelI
{ {
IdTree& tree = static_cast<CSMWorld::IdTree&>(*mModel); IdTree& tree = static_cast<CSMWorld::IdTree&>(*mModel);
// ModifyNestedCommand will add its own command to change the modify status if needed
mModifyNestedCommand = new ModifyNestedCommand(tree, mIndex, new_, this); mModifyNestedCommand = new ModifyNestedCommand(tree, mIndex, new_, this);
setText(mModifyNestedCommand->text()); setText(mModifyNestedCommand->text());
} }
@ -48,12 +49,7 @@ CSMWorld::ModifyCommand::ModifyCommand (QAbstractItemModel& model, const QModelI
{ {
mHasRecordState = true; mHasRecordState = true;
int stateColumnIndex = table->findColumnIndex(Columns::ColumnId_Modification); int stateColumnIndex = table->findColumnIndex(Columns::ColumnId_Modification);
int rowIndex = mIndex.row(); int rowIndex = mIndex.row();
if (mIndex.parent().isValid())
{
rowIndex = mIndex.parent().row();
}
mRecordStateIndex = table->index(rowIndex, stateColumnIndex); mRecordStateIndex = table->index(rowIndex, stateColumnIndex);
mOldRecordState = static_cast<CSMWorld::RecordBase::State>(table->data(mRecordStateIndex).toInt()); mOldRecordState = static_cast<CSMWorld::RecordBase::State>(table->data(mRecordStateIndex).toInt());

View file

@ -265,6 +265,7 @@ namespace CSMWorld
case 0: return; // return without saving case 0: return; // return without saving
case 1: case 1:
{ {
// Remove current and add new while adjusting each points connection count
edges.erase(edges.begin()+subRowIndex); edges.erase(edges.begin()+subRowIndex);
if (static_cast<size_t>(edge.mV0) < points.size()) if (static_cast<size_t>(edge.mV0) < points.size())
@ -272,10 +273,10 @@ namespace CSMWorld
edge.mV0 = value.toInt(); edge.mV0 = value.toInt();
// Place in correct order
if (static_cast<size_t>(edge.mV0) < points.size()) if (static_cast<size_t>(edge.mV0) < points.size())
++points[edge.mV0].mConnectionNum; ++points[edge.mV0].mConnectionNum;
// Place in correct order
ESM::Pathgrid::EdgeList::iterator it = edges.begin(); ESM::Pathgrid::EdgeList::iterator it = edges.begin();
for (; it != edges.end(); ++it) for (; it != edges.end(); ++it)
{ {

View file

@ -332,7 +332,7 @@ void CSVRender::PagedWorldspaceWidget::pathgridAboutToBeRemoved (const QModelInd
void CSVRender::PagedWorldspaceWidget::pathgridAdded(const QModelIndex& parent, int start, int end) void CSVRender::PagedWorldspaceWidget::pathgridAdded(const QModelIndex& parent, int start, int end)
{ {
const CSMWorld::SubCellCollection<CSMWorld::Pathgrid>& pathgrids = mDocument.getData().getPathgrids(); const CSMWorld::SubCellCollection<CSMWorld::Pathgrid>& pathgrids = mDocument.getData().getPathgrids();
if (!parent.isValid()) if (!parent.isValid())
{ {

View file

@ -131,9 +131,10 @@ namespace CSVRender
if (!selection.empty()) if (!selection.empty())
{ {
mDragMode = DragMode_Move; mDragMode = DragMode_Move;
return true;
} }
return true; return false;
} }
bool PathgridMode::secondaryEditStartDrag(const QPoint& pos) bool PathgridMode::secondaryEditStartDrag(const QPoint& pos)
@ -148,10 +149,11 @@ namespace CSVRender
mFromNode = SceneUtil::getPathgridNode(static_cast<unsigned short>(hit.index0)); mFromNode = SceneUtil::getPathgridNode(static_cast<unsigned short>(hit.index0));
tag->getPathgrid()->setupConnectionIndicator(mFromNode); tag->getPathgrid()->setupConnectionIndicator(mFromNode);
return true;
} }
} }
return true; return false;
} }
void PathgridMode::drag(const QPoint& pos, int diffX, int diffY, double speedFactor) void PathgridMode::drag(const QPoint& pos, int diffX, int diffY, double speedFactor)