Cut selected elements
From TaskDepender
Line 10: | Line 10: | ||
* For all selected deliverables, delete links to non-selected tasks. | * For all selected deliverables, delete links to non-selected tasks. | ||
* For all selected tasks, delete links to non-selected deliverables. | * For all selected tasks, delete links to non-selected deliverables. | ||
+ | |||
+ | The ''paste'' action is now straightforward. It simply finds the elements with <tt>ContainerId</tt> equal to <tt>MaxInt</tt> and sets their <tt>ContainerId</tt> to the <tt>Id</tt> of the current container. | ||
== Implementation == | == Implementation == | ||
Line 83: | Line 85: | ||
SelectedDeliverablesIds->Clear(); | SelectedDeliverablesIds->Clear(); | ||
SelectedTasksIds->Clear(); | SelectedTasksIds->Clear(); | ||
+ | } | ||
+ | </syntaxhighlight> | ||
+ | |||
+ | <syntaxhighlight lang="cpp"> | ||
+ | void Admin::Paste(void) | ||
+ | { | ||
+ | // Find all elements with container MaxInt and place at the current level. | ||
+ | |||
+ | SelectedTasksIds->Clear(); | ||
+ | SelectedDeliverablesIds->Clear(); | ||
+ | |||
+ | TaskC *containerTask = TasksAdmin->FindTask(SelectedContainerTaskId); | ||
+ | |||
+ | TaskC* task = Admin->TasksAdmin->First(); | ||
+ | while( task != NULL ) | ||
+ | { | ||
+ | if( task->Container == MaxInt ) | ||
+ | { | ||
+ | task->Container = SelectedContainerTaskId; | ||
+ | |||
+ | if( containerTask != NULL ) | ||
+ | { | ||
+ | containerTask->NumContainedElements++; | ||
+ | } | ||
+ | |||
+ | SelectedTasksIds->Add(task->Id); | ||
+ | } | ||
+ | task = task->next(); | ||
+ | } | ||
+ | |||
+ | DeliverableC* deliverable = DeliverablesAdmin->First(); | ||
+ | while( deliverable != NULL ) | ||
+ | { | ||
+ | if( deliverable->Container == MaxInt ) | ||
+ | { | ||
+ | deliverable->Container = SelectedContainerTaskId; | ||
+ | if( containerTask != NULL ) | ||
+ | { | ||
+ | containerTask->NumContainedElements++; | ||
+ | } | ||
+ | |||
+ | SelectedDeliverablesIds->Add(deliverable->Id); | ||
+ | } | ||
+ | deliverable = deliverable->next(); | ||
+ | } | ||
+ | |||
} | } | ||
</syntaxhighlight> | </syntaxhighlight> |