Index: cmdmani.cpp
===================================================================
RCS file: /cvs/Scribus/scribus/plugins/scriptplugin/cmdmani.cpp,v
retrieving revision 1.7.2.16
diff -u -r1.7.2.16 cmdmani.cpp
--- cmdmani.cpp	1 Feb 2005 10:41:40 -0000	1.7.2.16
+++ cmdmani.cpp	1 Feb 2005 16:01:37 -0000
@@ -57,10 +57,23 @@
 	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item==NULL)
 		return NULL;
-	if (Carrier->view->GroupSel)
+	// Grab the old selection
+	QPtrList<PageItem> oldSelection = Carrier->view->SelItem;
+	// Clear the selection
+	Carrier->view->Deselect();
+	// Select the item, which will also select its group if
+	// there is one.
+	Carrier->view->SelectItemNr(item->ItemNr);
+	// Move the item, or items
+	if (Carrier->view->SelItem.count() > 1)
 		Carrier->view->moveGroup(ValueToPoint(x), ValueToPoint(y));
 	else
 		Carrier->view->MoveItem(ValueToPoint(x), ValueToPoint(y), item);
+	// Now restore the selection. We just have to go through and select
+	// each and every item, unfortunately.
+	Carrier->view->Deselect();
+	for ( oldSelection.first(); oldSelection.current(); oldSelection.next() )
+		Carrier->view->SelectItemNr(oldSelection.current()->ItemNr);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
@@ -76,19 +89,27 @@
 	PageItem *item = GetUniqueItem(QString::fromUtf8(Name));
 	if (item == NULL)
 		return NULL;
-	if (Carrier->view->GroupSel)
+	// Grab the old selection
+	QPtrList<PageItem> oldSelection = Carrier->view->SelItem;
+	// Clear the selection
+	Carrier->view->Deselect();
+	// Select the item, which will also select its group if
+	// there is one.
+	Carrier->view->SelectItemNr(item->ItemNr);
+	// Move the item, or items
+	if (Carrier->view->SelItem.count() > 1)
 	{
-		if (Carrier->view->GroupSel)
-		{
-			double x2, y2, w, h;
-			Carrier->view->getGroupRect(&x2, &y2, &w, &h);
-			Carrier->view->moveGroup(pageUnitXToDocX(x) - x2, pageUnitYToDocY(y) - y2);
-		}
-		else
-			Carrier->view->MoveItem(pageUnitXToDocX(x) - item->Xpos, pageUnitYToDocY(y) - item->Ypos, item);
+		double x2, y2, w, h;
+		Carrier->view->getGroupRect(&x2, &y2, &w, &h);
+		Carrier->view->moveGroup(pageUnitXToDocX(x) - x2, pageUnitYToDocY(y) - y2);
 	}
 	else
 		Carrier->view->MoveItem(pageUnitXToDocX(x) - item->Xpos, pageUnitYToDocY(y) - item->Ypos, item);
+	// Now restore the selection. We just have to go through and select
+	// each and every item, unfortunately.
+	Carrier->view->Deselect();
+	for ( oldSelection.first(); oldSelection.current(); oldSelection.next() )
+		Carrier->view->SelectItemNr(oldSelection.current()->ItemNr);
 	Py_INCREF(Py_None);
 	return Py_None;
 }
