Пример #1
0
void ChangeNodeHeirarchy::IncrementUnsavedChanges()
{
	HierarchyTreeNode* sourceNode = 0;
	HierarchyTreeNode* targetNode = HierarchyTreeController::Instance()->GetTree().GetNode(targetNodeID);

	switch (this->type)
	{
		case TYPE_PLATFORM:
			// The Platform nodes could only be moved within root node
			targetNode->IncrementUnsavedChanges();
			break;

		case TYPE_SCREEN:
		case TYPE_AGGREGATOR:
			// If Screen nodes are moved within one platform, it's enough to increment unsaved changes only in this platform...
			targetNode->IncrementUnsavedChanges();

			// ...Otherwise we need more complicated handling
			sourceNode = HierarchyTreeController::Instance()->GetTree().GetNode(items.front());
			if (sourceNode != targetNode)
			{
				sourceNode->IncrementUnsavedChanges();

				// Need to mark all screens which being moved to other platform.
				// Otherwise they won't be saved to files at the new location
				// Before mark, need to store current mark state for correct rollback.
				storedMarks.clear();
				for (HierarchyTreeNode::HIERARCHYTREENODESIDLIST::iterator it = items.begin(); it != items.end(); ++it)
				{
					HierarchyTreeNode* node = HierarchyTreeController::Instance()->GetTree().GetNode(*it);
					storedMarks[*it] = node->IsMarked();

					node->SetMarked(true);
				}
			}

			break;

		case TYPE_CONTROLS:
			targetNode->IncrementUnsavedChanges();

			sourceNode = HierarchyTreeController::Instance()->GetScreenNodeForNode(HierarchyTreeController::Instance()->GetTree().GetNode(items.front()));
			if (sourceNode != targetNode)
			{
				sourceNode->IncrementUnsavedChanges();
			}
			break;

		default:
			break;
	}
}
Пример #2
0
void DeleteSelectedNodeCommand::IncrementUnsavedChanges()
{
	switch (type)
	{
		case TYPE_PLATFORM:
		case TYPE_SCREEN:
			HierarchyTreeController::Instance()->GetTree().GetNode((parentId))->IncrementUnsavedChanges();
			break;

		case TYPE_AGGREGATOR:
			HierarchyTreeController::Instance()->GetTree().GetNode((parentId))->IncrementUnsavedChanges();
			for (Set<HierarchyTreeNode::HIERARCHYTREENODEID>::iterator it = parentsOfRemovingAggregatorControls.begin();
				 it != parentsOfRemovingAggregatorControls.end();
				 ++it)
			{
				HierarchyTreeNode* node = HierarchyTreeController::Instance()->GetTree().GetNode(*it);
				if (node)
				{
					node->IncrementUnsavedChanges();
				}
			}
			break;

		case TYPE_CONTROLS:
		default:
			BaseCommand::IncrementUnsavedChanges();
			break;
	}
}