Ejemplo n.º 1
0
void DeleteSelectedNodeCommand::DecrementUnsavedChanges()
{
	switch (type)
	{
		case TYPE_PLATFORM:
		case TYPE_SCREEN:
			HierarchyTreeController::Instance()->GetTree().GetNode((parentId))->DecrementUnsavedChanges();
			break;

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

		case TYPE_CONTROLS:
		default:
			BaseCommand::DecrementUnsavedChanges();
			break;
	}
}
Ejemplo n.º 2
0
void ChangeNodeHeirarchy::DecrementUnsavedChanges()
{
	HierarchyTreeNode* sourceNode = 0;
	HierarchyTreeNode* targetNode = HierarchyTreeController::Instance()->GetTree().GetNode(targetNodeID);

	switch (this->type)
	{
		case TYPE_PLATFORM:
			targetNode->DecrementUnsavedChanges();
			break;

		case TYPE_SCREEN:
		case TYPE_AGGREGATOR:
			targetNode->DecrementUnsavedChanges();

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

			// Restore mark state. See comments in IncrementUnsavedChanges()
			for (HierarchyTreeNode::HIERARCHYTREENODESIDLIST::iterator it = items.begin(); it != items.end(); ++it)
			{
				HierarchyTreeNode* node = HierarchyTreeController::Instance()->GetTree().GetNode(*it);

				if (storedMarks.find(*it) != storedMarks.end())
				{
					node->SetMarked(storedMarks[*it]);
				}
			}
			break;

		case TYPE_CONTROLS:
			targetNode->DecrementUnsavedChanges();

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

		default:
			break;
	}
}