r15741 by jghali - simplify notifications of object modifications to PP : remove the newSelection() and setMultipleSelection() functions in PP components, all must be now handled in the handleSelectionChange() functions

scribus-commit scribus-commit at lists.scribus.net
Wed Nov 3 16:43:00 CET 2010


Author: jghali
Date: Wed Nov  3 15:42:59 2010
New Revision: 15741

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15741
Log:
simplify notifications of object modifications to PP : remove the newSelection() and setMultipleSelection() functions in PP components, all must be now handled in the handleSelectionChange() functions

Modified:
    branches/ScribusOIF/scribus/pageitem.cpp
    branches/ScribusOIF/scribus/scribus.cpp
    branches/ScribusOIF/scribus/ui/outlinepalette.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette.h
    branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette_group.h
    branches/ScribusOIF/scribus/ui/propertiespalette_image.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette_image.h
    branches/ScribusOIF/scribus/ui/propertiespalette_line.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette_line.h
    branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette_shape.h
    branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette_text.h
    branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette_xyz.h

Modified: branches/ScribusOIF/scribus/pageitem.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15741&path=/branches/ScribusOIF/scribus/pageitem.cpp
==============================================================================
--- branches/ScribusOIF/scribus/pageitem.cpp (original)
+++ branches/ScribusOIF/scribus/pageitem.cpp Wed Nov  3 15:42:59 2010
@@ -6794,10 +6794,10 @@
 	if (!m_Doc->m_Selection->primarySelectionIs(this))
 		return false;
 	PropertiesPalette* pp=m_Doc->scMW()->propertiesPalette;
-	connect(this, SIGNAL(myself(PageItem *)), pp, SLOT(SetCurItem(PageItem *)));
+	connect(this, SIGNAL(myself(PageItem *)), pp, SLOT(setCurrentItem(PageItem *)));
 	connect(this, SIGNAL(frameType(int)), m_Doc->scMW(), SLOT(HaveNewSel(int)));
 	connect(this, SIGNAL(frameType(int)), m_Doc->view(), SLOT(selectionChanged()));
-	connect(this, SIGNAL(frameType(int)), pp, SLOT(NewSel(int)));
+	connect(this, SIGNAL(frameType(int)), pp, SLOT(handleSelectionChanged()));
 	connect(this, SIGNAL(frameLocked(bool)), pp, SLOT(setLocked(bool)));
 	connect(this, SIGNAL(frameSizeLocked(bool)), pp, SLOT(setSizeLocked(bool)));
 	//Shape signals

Modified: branches/ScribusOIF/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15741&path=/branches/ScribusOIF/scribus/scribus.cpp
==============================================================================
--- branches/ScribusOIF/scribus/scribus.cpp (original)
+++ branches/ScribusOIF/scribus/scribus.cpp Wed Nov  3 15:42:59 2010
@@ -2108,7 +2108,7 @@
 	connect(view, SIGNAL(signalGuideInformation(int, qreal)), alignDistributePalette, SLOT(setGuide(int, qreal)));
 	if (ScCore->usingGUI())
 	{
-		connect(doc->m_Selection, SIGNAL(selectionIsMultiple(bool)), propertiesPalette, SLOT( setMultipleSelection(bool)));
+		//connect(doc->m_Selection, SIGNAL(selectionIsMultiple(bool)), propertiesPalette, SLOT( setMultipleSelection(bool)));
 		connect(doc->m_Selection, SIGNAL(selectionIsMultiple(bool)), actionManager, SLOT( handleMultipleSelections(bool)));
 		//connect(doc->m_Selection, SIGNAL(empty()), propertiesPalette, SLOT( unsetItem()));
 	}
@@ -3017,16 +3017,15 @@
 		scrActions["itemPrintingEnabled"]->setChecked(currItem->printEnabled());
 	}
 
-	//propertiesPalette->NewSel(SelectedType);
 	if (SelectedType != -1)
 	{
-		//propertiesPalette->SetCurItem(currItem);
+		//propertiesPalette->setCurrentItem(currItem);
 		outlinePalette->slotShowSelect(currItem->OwnPage, currItem->ItemNr);
 		actionManager->connectNewSelectionActions(view, doc);
-// 		propertiesPalette->NewSel(SelectedType);
+// 		propertiesPalette->handleSelectionChanged();
 	}
 	else
-		propertiesPalette->NewSel(SelectedType);
+		propertiesPalette->handleSelectionChanged();
 
 	PluginManager& pluginManager(PluginManager::instance());
 	QStringList pluginNames(pluginManager.pluginNames(false));
@@ -4388,7 +4387,6 @@
 	if (ScCore->haveCMS())
 		doc->CloseCMSProfiles();
 	//<<Palettes
-//	propertiesPalette->NewSel(-1);
 	propertiesPalette->unsetDoc();
 	symbolPalette->unsetDoc();
 	pagePalette->setView(0);
@@ -7326,7 +7324,7 @@
 		currItem->FrameType = f+2;
 		break;
 	}
-	//propertiesPalette->SetCurItem(currItem);
+	//propertiesPalette->setCurrentItem(currItem);
 	currItem->update();
 	slotDocCh();
 }

Modified: branches/ScribusOIF/scribus/ui/outlinepalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15741&path=/branches/ScribusOIF/scribus/ui/outlinepalette.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/outlinepalette.cpp (original)
+++ branches/ScribusOIF/scribus/ui/outlinepalette.cpp Wed Nov  3 15:42:59 2010
@@ -313,7 +313,7 @@
 					{
 						item->PageItemObject->setItemName(NameNew);
 						item->PageItemObject->AutoName = false;
-						m_MainWindow->propertiesPalette->SetCurItem(item->PageItemObject);
+						m_MainWindow->propertiesPalette->setCurrentItem(item->PageItemObject);
 						currDoc->setModified(true);
 					}
 				}

Modified: branches/ScribusOIF/scribus/ui/propertiespalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15741&path=/branches/ScribusOIF/scribus/ui/propertiespalette.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette.cpp Wed Nov  3 15:42:59 2010
@@ -86,9 +86,9 @@
 PropertiesPalette::PropertiesPalette( QWidget* parent) : ScrPaletteBase( parent, "PropertiesPalette", false, 0)
 {
 	m_ScMW=0;
-	doc=0;
-	HaveDoc = false;
-	HaveItem = false;
+	m_doc=0;
+	m_haveDoc = false;
+	m_haveItem = false;
 	m_unitRatio = 1.0;
 
 	setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum));
@@ -205,7 +205,7 @@
 	connect(Tpal, SIGNAL(NewSpecial(double, double, double, double, double, double, double, double, double, double)), this, SLOT(NewSpGradientM(double, double, double, double, double, double, double, double )));
 	connect(Tpal, SIGNAL(editGradient()), this, SLOT(toggleGradientEditM()));
 
-	HaveItem = false;
+	m_haveItem = false;
 	for (int ws = 1; ws < 8; ++ws)
 		TabStack->setItemEnabled(ws, false);
 	TabStack->setCurrentIndex(0);
@@ -217,12 +217,12 @@
 {
 	if (m_ScMW && !m_ScMW->scriptIsRunning())
 	{
-		if ((HaveDoc) && (HaveItem))
+		if ((m_haveDoc) && (m_haveItem))
 		{
 			if (Cpal->gradEditButton->isChecked())
 			{
 				m_ScMW->view->requestMode(modeNormal);
-				m_ScMW->view->RefreshGradient(CurItem);
+				m_ScMW->view->RefreshGradient(m_item);
 			}
 		}
 	}
@@ -278,41 +278,41 @@
 
 void PropertiesPalette::setDoc(ScribusDoc *d)
 {
-	if(doc == d || (m_ScMW && m_ScMW->scriptIsRunning()))
-		return;
-
-	doc = d;
-	CurItem = NULL;
-	Cpal->setDocument(doc);
+	if((d == (ScribusDoc*) m_doc) || (m_ScMW && m_ScMW->scriptIsRunning()))
+		return;
+
+	m_doc = d;
+	m_item = NULL;
+	Cpal->setDocument(m_doc);
 	Cpal->setCurrentItem(NULL);
-	Tpal->setDocument(doc);
+	Tpal->setDocument(m_doc);
 	Tpal->setCurrentItem(NULL);
 
-	m_unitRatio=doc->unitRatio();
-	m_unitIndex=doc->unitIndex();
+	m_unitRatio=m_doc->unitRatio();
+	m_unitIndex=m_doc->unitIndex();
 	int precision = unitGetPrecisionFromIndex(m_unitIndex);
 //qt4 FIXME here
 	double maxXYWHVal= 16777215 * m_unitRatio;
 	double minXYVal= -16777215 * m_unitRatio;
-	HaveDoc = true;
-	HaveItem = false;
-
-	xyzPal->setDoc(doc);
-	shapePal->setDoc(doc);
-	groupPal->setDoc(doc);
-	imagePal->setDoc(doc);
-	linePal->setDoc(doc);
-	textPal->setDoc(doc);
+	m_haveDoc = true;
+	m_haveItem = false;
+
+	xyzPal->setDoc(m_doc);
+	shapePal->setDoc(m_doc);
+	groupPal->setDoc(m_doc);
+	imagePal->setDoc(m_doc);
+	linePal->setDoc(m_doc);
+	textPal->setDoc(m_doc);
 
 	updateColorList();
 }
 
 void PropertiesPalette::unsetDoc()
 {
-	HaveDoc = false;
-	HaveItem = false;
-	doc=NULL;
-	CurItem = NULL;
+	m_haveDoc = false;
+	m_haveItem = false;
+	m_doc=NULL;
+	m_item = NULL;
 
 	xyzPal->unsetItem();
 	xyzPal->unsetDoc();
@@ -332,7 +332,7 @@
 	Tpal->setCurrentItem(NULL);
 	Tpal->setDocument(NULL);
 
-	HaveItem = false;
+	m_haveItem = false;
 	for (int ws = 1; ws < 8; ++ws)
 		TabStack->setItemEnabled(ws, false);
 	TabStack->widget(0)->setEnabled(false);
@@ -342,40 +342,71 @@
 
 void PropertiesPalette::unsetItem()
 {
-	HaveItem=false;
-	CurItem = NULL;
+	m_haveItem = false;
+	m_item     = NULL;
 	Cpal->setCurrentItem(NULL);
 	Tpal->setCurrentItem(NULL);
-	NewSel(-1);
+	handleSelectionChanged();
 }
 
 void PropertiesPalette::setTextFlowMode(PageItem::TextFlowMode mode)
 {
-	if (!m_ScMW || m_ScMW->scriptIsRunning() || !HaveItem)
+	if (!m_ScMW || m_ScMW->scriptIsRunning() || !m_haveItem)
 		return;
 	shapePal->displayTextFlowMode(mode);
 	groupPal->displayTextFlowMode(mode);
 }
 
-void PropertiesPalette::SetCurItem(PageItem *i)
+PageItem* PropertiesPalette::currentItemFromSelection()
+{
+	PageItem *currentItem = NULL;
+
+	if (m_doc)
+	{
+		if (m_doc->m_Selection->count() > 1)
+		{
+			uint lowestItem = 999999;
+			for (int a=0; a<m_doc->m_Selection->count(); ++a)
+			{
+				currentItem = m_doc->m_Selection->itemAt(a);
+				lowestItem = qMin(lowestItem, currentItem->ItemNr);
+			}
+			currentItem = m_doc->Items->at(lowestItem);
+		}
+		else if (m_doc->m_Selection->count() == 1)
+		{
+			currentItem = m_doc->m_Selection->itemAt(0);
+		}
+	}
+
+	return currentItem;
+}
+
+void PropertiesPalette::setCurrentItem(PageItem *i)
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
 		return;
 	//CB We shouldnt really need to process this if our item is the same one
 	//maybe we do if the item has been changed by scripter.. but that should probably
 	//set some status if so.
-	//FIXME: This wont work until when a canvas deselect happens, CurItem must be NULL.
-	//if (CurItem == i)
+	//FIXME: This wont work until when a canvas deselect happens, m_item must be NULL.
+	//if (m_item == i)
 	//	return;
 
-	if (!doc)
+	if (!i)
+	{
+		unsetItem();
+		return;
+	}
+
+	if (!m_doc)
 		setDoc(i->doc());
 
 	disconnect(TabStack, SIGNAL(currentChanged(int)) , this, SLOT(SelTab(int)));
 	disconnect(linePal , SIGNAL(lineModeChanged(int)), this, SLOT(NewLineMode(int)));
 
-	HaveItem = false;
-	CurItem = i;
+	m_haveItem = false;
+	m_item = i;
 
 	xyzPal->handleSelectionChanged();
 	shapePal->handleSelectionChanged();
@@ -384,12 +415,12 @@
 	linePal->handleSelectionChanged();
 	textPal->handleSelectionChanged();
 
-	Cpal->setCurrentItem(CurItem);
+	Cpal->setCurrentItem(m_item);
 	Cpal->updateFromItem();
-	Tpal->setCurrentItem(CurItem);
+	Tpal->setCurrentItem(m_item);
 	Tpal->updateFromItem();
 
-	setTextFlowMode(CurItem->textFlowMode());
+	setTextFlowMode(m_item->textFlowMode());
 
 	connect(linePal , SIGNAL(lineModeChanged(int)), this, SLOT(NewLineMode(int)));
 
@@ -410,7 +441,7 @@
 	Tpal->setActPattern(i->patternMask(), patternScaleX, patternScaleY, patternOffsetX, patternOffsetY, patternRotation, patternSkewX, patternSkewY, mirrorX, mirrorY);
 
 
-	if ((CurItem->isGroupControl) || ((CurItem->Groups.count() != 0) && (!CurItem->isSingleSel)))
+	if ((m_item->isGroupControl) || ((m_item->Groups.count() != 0) && (!m_item->isSingleSel)))
 	{
 		TabStack->setItemEnabled(idXYZItem, true);
 		TabStack->setItemEnabled(idShapeItem, false);
@@ -423,12 +454,12 @@
 	else
 		TabStack->setItemEnabled(idGroupItem, false);
 
-	if (CurItem->doOverprint)
+	if (m_item->doOverprint)
 		Cpal->setActOverprint(1);
 	else
 		Cpal->setActOverprint(0);
 
-	HaveItem = true;
+	m_haveItem = true;
 	SelTab(TabStack->currentIndex());
 
 	xyzPal->handleSelectionChanged();
@@ -438,7 +469,7 @@
 	linePal->handleSelectionChanged();
 	textPal->handleSelectionChanged();
 
-	if (CurItem->asOSGFrame())
+	if (m_item->asOSGFrame())
 	{
 		TabStack->setItemEnabled(idXYZItem, true);
 		TabStack->setItemEnabled(idShapeItem, true);
@@ -449,7 +480,7 @@
 		TabStack->setItemEnabled(idTextItem, false);
 		TabStack->setItemEnabled(idImageItem, false);
 	}
-	if (CurItem->asSymbolFrame())
+	if (m_item->asSymbolFrame())
 	{
 		TabStack->setItemEnabled(idXYZItem, true);
 		TabStack->setItemEnabled(idShapeItem, false);
@@ -463,23 +494,24 @@
 	connect(TabStack, SIGNAL(currentChanged(int)), this, SLOT(SelTab(int)));
 }
 
-void PropertiesPalette::NewSel(int nr)
-{
-	if (!HaveDoc || !m_ScMW || m_ScMW->scriptIsRunning())
-		return;
-	int visID;
-	PageItem *i=0;
+void  PropertiesPalette::handleSelectionChanged()
+{
+	if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning())
+		return;
 	int currentTab = TabStack->currentIndex();
 	disconnect(TabStack, SIGNAL(currentChanged(int)), this, SLOT(SelTab(int)));
 
-	xyzPal->newSelection(nr);
-	shapePal->newSelection(nr);
-	groupPal->newSelection(nr);
-	imagePal->newSelection(nr);
-	linePal->newSelection(nr);
-	textPal->newSelection(nr);
-
-	if (doc->m_Selection->count()>1)
+	qDebug() << "PropertiesPalette::handleSelectionChanged()";
+
+	xyzPal->handleSelectionChanged();
+	shapePal->handleSelectionChanged();
+	groupPal->handleSelectionChanged();
+	imagePal->handleSelectionChanged();
+	linePal->handleSelectionChanged();
+	textPal->handleSelectionChanged();
+
+	PageItem* currItem = currentItemFromSelection();
+	if (m_doc->m_Selection->count() > 1)
 	{
 		for (int ws = 1; ws < 8; ++ws)
 			TabStack->setItemEnabled(ws, false);
@@ -488,28 +520,26 @@
 		TabStack->setItemEnabled(idLineItem, false);
 		TabStack->setItemEnabled(idColorsItem, true);
 		TabStack->setItemEnabled(idTransparencyItem, true);
-		if (HaveItem && CurItem)
-		{
-			if ((CurItem->isGroupControl) || ((CurItem->Groups.count() != 0) && (!CurItem->isSingleSel)))
+		if (m_haveItem && m_item)
+		{
+			if ((m_item->isGroupControl) || ((m_item->Groups.count() != 0) && (!m_item->isSingleSel)))
 				TabStack->setItemEnabled(idGroupItem, true);
 		}
 	}
 	else
 	{
-		if (nr != -1)
-		{
-			i=doc->m_Selection->itemAt(0);
-			HaveItem=true;
-		}
-		visID = TabStack->currentIndex();
+		int itemType = currItem ? (int) currItem->itemType() : -1;
+		m_haveItem   = (itemType != -1);
+
+		int visID = TabStack->currentIndex();
 		TabStack->widget(0)->setEnabled(true);
 		TabStack->setItemEnabled(idXYZItem, true);
 		TabStack->setItemEnabled(idColorsItem, true);
 		TabStack->setItemEnabled(idTransparencyItem, true);
-		switch (nr)
+		switch (itemType)
 		{
 		case -1:
-			HaveItem = false;
+			m_haveItem = false;
 			for (int ws = 1; ws < 8; ++ws)
 				TabStack->setItemEnabled(ws, false);
 			TabStack->widget(0)->setEnabled(false);
@@ -519,7 +549,7 @@
 		case PageItem::ImageFrame:
 		case PageItem::LatexFrame:
 		case PageItem::OSGFrame:
-			if (i->asOSGFrame())
+			if (currItem->asOSGFrame())
 			{
 				TabStack->setItemEnabled(idXYZItem, true);
 				TabStack->setItemEnabled(idShapeItem, true);
@@ -586,44 +616,22 @@
 	updateGeometry();
 	repaint();
 	connect(TabStack, SIGNAL(currentChanged(int)), this, SLOT(SelTab(int)));
-}
-
-void PropertiesPalette::setMultipleSelection(bool isMultiple)
-{
-	if (!HaveDoc)
-		return;
-	//CB Having added the selection and undo transaction to mirrorpolyh/v in doc,
-	//these can be enabled all the time
-	xyzPal->setMultipleSelection(isMultiple);
-	shapePal->setMultipleSelection(isMultiple);
-	groupPal->setMultipleSelection(isMultiple);
-	imagePal->setMultipleSelection(isMultiple);
-	linePal->setMultipleSelection(isMultiple);
-	textPal->setMultipleSelection(isMultiple);
-
-	if (doc->m_Selection->count() > 1)
-	{
-		PageItem *i;
-		uint lowestItem = 999999;
-		for (int a=0; a<doc->m_Selection->count(); ++a)
-		{
-			i = doc->m_Selection->itemAt(a);
-			lowestItem = qMin(lowestItem, i->ItemNr);
-		}
-		i = doc->Items->at(lowestItem);
-		SetCurItem(i);
+
+	if (currItem)
+	{
+		setCurrentItem(currItem);
 	}
 }
 
 void PropertiesPalette::unitChange()
 {
-	if (!HaveDoc)
-		return;
-	bool tmp = HaveItem;
-	HaveItem = false;
+	if (!m_haveDoc)
+		return;
+	bool tmp = m_haveItem;
+	m_haveItem = false;
 	double oldRatio = m_unitRatio;
-	m_unitRatio = doc->unitRatio();
-	m_unitIndex = doc->unitIndex();
+	m_unitRatio = m_doc->unitRatio();
+	m_unitIndex = m_doc->unitIndex();
 
 	xyzPal->unitChange();
 	shapePal->unitChange();
@@ -632,9 +640,9 @@
 	linePal->unitChange();
 	textPal->unitChange();
 
-	Cpal->unitChange(oldRatio, m_unitRatio, doc->unitIndex());
-	Tpal->unitChange(oldRatio, m_unitRatio, doc->unitIndex());
-	HaveItem = tmp;
+	Cpal->unitChange(oldRatio, m_unitRatio, m_doc->unitIndex());
+	Tpal->unitChange(oldRatio, m_unitRatio, m_doc->unitIndex());
+	m_haveItem = tmp;
 }
 
 void PropertiesPalette::NewLineMode(int mode)
@@ -642,34 +650,34 @@
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
 		return;
 	xyzPal->setLineMode(mode);
-	xyzPal->displayWH(CurItem->width(), CurItem->height());
+	xyzPal->displayWH(m_item->width(), m_item->height());
 	updateGeometry();
 	repaint();
 }
 
 void PropertiesPalette::NewAlignement(int a)
 {
-	if (!HaveDoc || !HaveItem || !m_ScMW || m_ScMW->scriptIsRunning())
-		return;
-	doc->itemSelection_SetAlignment(a);
+	if (!m_haveDoc || !m_haveItem || !m_ScMW || m_ScMW->scriptIsRunning())
+		return;
+	m_doc->itemSelection_SetAlignment(a);
 }
 
 void PropertiesPalette::handleNewShape(int frameType)
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	if ((HaveDoc) && (HaveItem))
-	{
-		if ((CurItem->itemType() == PageItem::PolyLine) || (CurItem->itemType() == PageItem::PathText))
+	if ((m_haveDoc) && (m_haveItem))
+	{
+		if ((m_item->itemType() == PageItem::PolyLine) || (m_item->itemType() == PageItem::PathText))
 			return;
 
-		if ((CurItem->itemType() == PageItem::ImageFrame) || (CurItem->itemType() == PageItem::TextFrame))
+		if ((m_item->itemType() == PageItem::ImageFrame) || (m_item->itemType() == PageItem::TextFrame))
 		{
 			shapePal->RoundRect->setEnabled(frameType == 0);
 			return;
 		}
-//		CurItem->convertTo(PageItem::Polygon);
-//		NewSel(6);
+//		m_item->convertTo(PageItem::Polygon);
+//		newSelection(6);
 		shapePal->RoundRect->setEnabled(frameType == 0);
 	}
 }
@@ -678,92 +686,92 @@
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	if ((HaveDoc) && (HaveItem))
+	if ((m_haveDoc) && (m_haveItem))
 	{
 		QRectF upRect;
 		if (m_ScMW->view->editStrokeGradient == 1)
 		{
-			CurItem->GrStrokeStartX = x1 / m_unitRatio;
-			CurItem->GrStrokeStartY = y1 / m_unitRatio;
-			CurItem->GrStrokeEndX = x2 / m_unitRatio;
-			CurItem->GrStrokeEndY = y2 / m_unitRatio;
-			CurItem->GrStrokeFocalX = fx / m_unitRatio;
-			CurItem->GrStrokeFocalY = fy / m_unitRatio;
-			CurItem->GrStrokeScale = sg;
-			CurItem->GrStrokeSkew = sk;
-			if (CurItem->GrTypeStroke == 6)
+			m_item->GrStrokeStartX = x1 / m_unitRatio;
+			m_item->GrStrokeStartY = y1 / m_unitRatio;
+			m_item->GrStrokeEndX = x2 / m_unitRatio;
+			m_item->GrStrokeEndY = y2 / m_unitRatio;
+			m_item->GrStrokeFocalX = fx / m_unitRatio;
+			m_item->GrStrokeFocalY = fy / m_unitRatio;
+			m_item->GrStrokeScale = sg;
+			m_item->GrStrokeSkew = sk;
+			if (m_item->GrTypeStroke == 6)
 			{
-				CurItem->GrStrokeFocalX = CurItem->GrStrokeStartX;
-				CurItem->GrStrokeFocalY = CurItem->GrStrokeStartY;
+				m_item->GrStrokeFocalX = m_item->GrStrokeStartX;
+				m_item->GrStrokeFocalY = m_item->GrStrokeStartY;
 			}
-			CurItem->update();
-			upRect = QRectF(QPointF(CurItem->GrStrokeStartX, CurItem->GrStrokeStartY), QPointF(CurItem->GrStrokeEndX, CurItem->GrStrokeEndY));
-			double radEnd = distance(CurItem->GrStrokeEndX - CurItem->GrStrokeStartX, CurItem->GrStrokeEndY - CurItem->GrStrokeStartY);
-			double rotEnd = xy2Deg(CurItem->GrStrokeEndX - CurItem->GrStrokeStartX, CurItem->GrStrokeEndY - CurItem->GrStrokeStartY);
+			m_item->update();
+			upRect = QRectF(QPointF(m_item->GrStrokeStartX, m_item->GrStrokeStartY), QPointF(m_item->GrStrokeEndX, m_item->GrStrokeEndY));
+			double radEnd = distance(m_item->GrStrokeEndX - m_item->GrStrokeStartX, m_item->GrStrokeEndY - m_item->GrStrokeStartY);
+			double rotEnd = xy2Deg(m_item->GrStrokeEndX - m_item->GrStrokeStartX, m_item->GrStrokeEndY - m_item->GrStrokeStartY);
 			QTransform m;
-			m.translate(CurItem->GrStrokeStartX, CurItem->GrStrokeStartY);
+			m.translate(m_item->GrStrokeStartX, m_item->GrStrokeStartY);
 			m.rotate(rotEnd);
 			m.rotate(-90);
-			m.rotate(CurItem->GrStrokeSkew);
-			m.translate(radEnd * CurItem->GrStrokeScale, 0);
+			m.rotate(m_item->GrStrokeSkew);
+			m.translate(radEnd * m_item->GrStrokeScale, 0);
 			QPointF shP = m.map(QPointF(0,0));
-			upRect = upRect.united(QRectF(shP, QPointF(CurItem->GrStrokeEndX, CurItem->GrStrokeEndY)).normalized());
-			upRect = upRect.united(QRectF(shP, QPointF(CurItem->GrStrokeStartX, CurItem->GrStrokeStartY)).normalized());
+			upRect = upRect.united(QRectF(shP, QPointF(m_item->GrStrokeEndX, m_item->GrStrokeEndY)).normalized());
+			upRect = upRect.united(QRectF(shP, QPointF(m_item->GrStrokeStartX, m_item->GrStrokeStartY)).normalized());
 			upRect |= QRectF(shP, QPointF(0, 0)).normalized();
-			upRect |= QRectF(shP, QPointF(CurItem->width(), CurItem->height())).normalized();
+			upRect |= QRectF(shP, QPointF(m_item->width(), m_item->height())).normalized();
 		}
 		else if (m_ScMW->view->editStrokeGradient == 3)
 		{
-			CurItem->GrControl1 = FPoint(x1 / m_unitRatio, y1 / m_unitRatio);
-			CurItem->GrControl2 = FPoint(x2 / m_unitRatio, y2 / m_unitRatio);
-			CurItem->GrControl3 = FPoint(fx / m_unitRatio, fy / m_unitRatio);
-			CurItem->GrControl4 = FPoint(sg / m_unitRatio, sk / m_unitRatio);
-			CurItem->update();
-			upRect = QRectF(QPointF(-CurItem->width(), -CurItem->height()), QPointF(CurItem->width() * 2, CurItem->height() * 2)).normalized();
+			m_item->GrControl1 = FPoint(x1 / m_unitRatio, y1 / m_unitRatio);
+			m_item->GrControl2 = FPoint(x2 / m_unitRatio, y2 / m_unitRatio);
+			m_item->GrControl3 = FPoint(fx / m_unitRatio, fy / m_unitRatio);
+			m_item->GrControl4 = FPoint(sg / m_unitRatio, sk / m_unitRatio);
+			m_item->update();
+			upRect = QRectF(QPointF(-m_item->width(), -m_item->height()), QPointF(m_item->width() * 2, m_item->height() * 2)).normalized();
 		}
 		else if (m_ScMW->view->editStrokeGradient == 4)
 		{
-			CurItem->GrControl1 = FPoint(x1 / m_unitRatio, y1 / m_unitRatio);
-			CurItem->GrControl2 = FPoint(x2 / m_unitRatio, y2 / m_unitRatio);
-			CurItem->GrControl3 = FPoint(fx / m_unitRatio, fy / m_unitRatio);
-			CurItem->GrControl4 = FPoint(sg / m_unitRatio, sk / m_unitRatio);
-			CurItem->GrControl5 = FPoint(cx / m_unitRatio, cy / m_unitRatio);
-			CurItem->update();
-			upRect = QRectF(QPointF(-CurItem->width(), -CurItem->height()), QPointF(CurItem->width() * 2, CurItem->height() * 2)).normalized();
+			m_item->GrControl1 = FPoint(x1 / m_unitRatio, y1 / m_unitRatio);
+			m_item->GrControl2 = FPoint(x2 / m_unitRatio, y2 / m_unitRatio);
+			m_item->GrControl3 = FPoint(fx / m_unitRatio, fy / m_unitRatio);
+			m_item->GrControl4 = FPoint(sg / m_unitRatio, sk / m_unitRatio);
+			m_item->GrControl5 = FPoint(cx / m_unitRatio, cy / m_unitRatio);
+			m_item->update();
+			upRect = QRectF(QPointF(-m_item->width(), -m_item->height()), QPointF(m_item->width() * 2, m_item->height() * 2)).normalized();
 		}
 		else
 		{
-			CurItem->GrStartX = x1 / m_unitRatio;
-			CurItem->GrStartY = y1 / m_unitRatio;
-			CurItem->GrEndX = x2 / m_unitRatio;
-			CurItem->GrEndY = y2 / m_unitRatio;
-			CurItem->GrFocalX = fx / m_unitRatio;
-			CurItem->GrFocalY = fy / m_unitRatio;
-			CurItem->GrScale = sg;
-			CurItem->GrSkew = sk;
-			if (CurItem->GrTypeStroke == 6)
+			m_item->GrStartX = x1 / m_unitRatio;
+			m_item->GrStartY = y1 / m_unitRatio;
+			m_item->GrEndX = x2 / m_unitRatio;
+			m_item->GrEndY = y2 / m_unitRatio;
+			m_item->GrFocalX = fx / m_unitRatio;
+			m_item->GrFocalY = fy / m_unitRatio;
+			m_item->GrScale = sg;
+			m_item->GrSkew = sk;
+			if (m_item->GrTypeStroke == 6)
 			{
-				CurItem->GrFocalX = CurItem->GrStartX;
-				CurItem->GrFocalY = CurItem->GrStartY;
+				m_item->GrFocalX = m_item->GrStartX;
+				m_item->GrFocalY = m_item->GrStartY;
 			}
-			CurItem->update();
-			upRect = QRectF(QPointF(CurItem->GrStartX, CurItem->GrStartY), QPointF(CurItem->GrEndX, CurItem->GrEndY));
-			double radEnd = distance(CurItem->GrEndX - CurItem->GrStartX, CurItem->GrEndY - CurItem->GrStartY);
-			double rotEnd = xy2Deg(CurItem->GrEndX - CurItem->GrStartX, CurItem->GrEndY - CurItem->GrStartY);
+			m_item->update();
+			upRect = QRectF(QPointF(m_item->GrStartX, m_item->GrStartY), QPointF(m_item->GrEndX, m_item->GrEndY));
+			double radEnd = distance(m_item->GrEndX - m_item->GrStartX, m_item->GrEndY - m_item->GrStartY);
+			double rotEnd = xy2Deg(m_item->GrEndX - m_item->GrStartX, m_item->GrEndY - m_item->GrStartY);
 			QTransform m;
-			m.translate(CurItem->GrStartX, CurItem->GrStartY);
+			m.translate(m_item->GrStartX, m_item->GrStartY);
 			m.rotate(rotEnd);
 			m.rotate(-90);
-			m.rotate(CurItem->GrSkew);
-			m.translate(radEnd * CurItem->GrScale, 0);
+			m.rotate(m_item->GrSkew);
+			m.translate(radEnd * m_item->GrScale, 0);
 			QPointF shP = m.map(QPointF(0,0));
-			upRect |= QRectF(shP, QPointF(CurItem->GrEndX, CurItem->GrEndY)).normalized();
-			upRect |= QRectF(shP, QPointF(CurItem->GrStartX, CurItem->GrStartY)).normalized();
+			upRect |= QRectF(shP, QPointF(m_item->GrEndX, m_item->GrEndY)).normalized();
+			upRect |= QRectF(shP, QPointF(m_item->GrStartX, m_item->GrStartY)).normalized();
 			upRect |= QRectF(shP, QPointF(0, 0)).normalized();
-			upRect |= QRectF(shP, QPointF(CurItem->width(), CurItem->height())).normalized();
-		}
-		upRect.translate(CurItem->xPos(), CurItem->yPos());
-		doc->regionsChanged()->update(upRect.adjusted(-10.0, -10.0, 10.0, 10.0));
+			upRect |= QRectF(shP, QPointF(m_item->width(), m_item->height())).normalized();
+		}
+		upRect.translate(m_item->xPos(), m_item->yPos());
+		m_doc->regionsChanged()->update(upRect.adjusted(-10.0, -10.0, 10.0, 10.0));
 		emit DocChanged();
 	}
 }
@@ -772,7 +780,7 @@
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	if ((HaveDoc) && (HaveItem))
+	if ((m_haveDoc) && (m_haveItem))
 	{
 		m_ScMW->view->editStrokeGradient = stroke;
 		if (stroke == 1)
@@ -794,7 +802,7 @@
 			else
 				m_ScMW->view->requestMode(modeNormal);
 		}
-		m_ScMW->view->RefreshGradient(CurItem);
+		m_ScMW->view->RefreshGradient(m_item);
 	}
 }
 
@@ -802,39 +810,39 @@
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	if ((HaveDoc) && (HaveItem))
+	if ((m_haveDoc) && (m_haveItem))
 	{
 		QRectF upRect;
-		CurItem->GrMaskStartX = x1 / m_unitRatio;
-		CurItem->GrMaskStartY = y1 / m_unitRatio;
-		CurItem->GrMaskEndX = x2 / m_unitRatio;
-		CurItem->GrMaskEndY = y2 / m_unitRatio;
-		CurItem->GrMaskFocalX = fx / m_unitRatio;
-		CurItem->GrMaskFocalY = fy / m_unitRatio;
-		CurItem->GrMaskScale = sg;
-		CurItem->GrMaskSkew = sk;
-		if ((CurItem->GrMask == 1) || (CurItem->GrMask == 4))
-		{
-			CurItem->GrMaskFocalX = CurItem->GrMaskStartX;
-			CurItem->GrMaskFocalY = CurItem->GrMaskStartY;
-		}
-		CurItem->update();
-		upRect = QRectF(QPointF(CurItem->GrMaskStartX, CurItem->GrMaskStartY), QPointF(CurItem->GrMaskEndX, CurItem->GrMaskEndY));
-		double radEnd = distance(CurItem->GrMaskEndX - CurItem->GrMaskStartX, CurItem->GrMaskEndY - CurItem->GrMaskStartY);
-		double rotEnd = xy2Deg(CurItem->GrMaskEndX - CurItem->GrMaskStartX, CurItem->GrMaskEndY - CurItem->GrMaskStartY);
+		m_item->GrMaskStartX = x1 / m_unitRatio;
+		m_item->GrMaskStartY = y1 / m_unitRatio;
+		m_item->GrMaskEndX = x2 / m_unitRatio;
+		m_item->GrMaskEndY = y2 / m_unitRatio;
+		m_item->GrMaskFocalX = fx / m_unitRatio;
+		m_item->GrMaskFocalY = fy / m_unitRatio;
+		m_item->GrMaskScale = sg;
+		m_item->GrMaskSkew = sk;
+		if ((m_item->GrMask == 1) || (m_item->GrMask == 4))
+		{
+			m_item->GrMaskFocalX = m_item->GrMaskStartX;
+			m_item->GrMaskFocalY = m_item->GrMaskStartY;
+		}
+		m_item->update();
+		upRect = QRectF(QPointF(m_item->GrMaskStartX, m_item->GrMaskStartY), QPointF(m_item->GrMaskEndX, m_item->GrMaskEndY));
+		double radEnd = distance(m_item->GrMaskEndX - m_item->GrMaskStartX, m_item->GrMaskEndY - m_item->GrMaskStartY);
+		double rotEnd = xy2Deg(m_item->GrMaskEndX - m_item->GrMaskStartX, m_item->GrMaskEndY - m_item->GrMaskStartY);
 		QTransform m;
-		m.translate(CurItem->GrMaskStartX, CurItem->GrMaskStartY);
+		m.translate(m_item->GrMaskStartX, m_item->GrMaskStartY);
 		m.rotate(rotEnd);
 		m.rotate(-90);
-		m.rotate(CurItem->GrMaskSkew);
-		m.translate(radEnd * CurItem->GrMaskScale, 0);
+		m.rotate(m_item->GrMaskSkew);
+		m.translate(radEnd * m_item->GrMaskScale, 0);
 		QPointF shP = m.map(QPointF(0,0));
-		upRect |= QRectF(shP, QPointF(CurItem->GrMaskEndX, CurItem->GrMaskEndY)).normalized();
-		upRect |= QRectF(shP, QPointF(CurItem->GrMaskStartX, CurItem->GrMaskStartY)).normalized();
+		upRect |= QRectF(shP, QPointF(m_item->GrMaskEndX, m_item->GrMaskEndY)).normalized();
+		upRect |= QRectF(shP, QPointF(m_item->GrMaskStartX, m_item->GrMaskStartY)).normalized();
 		upRect |= QRectF(shP, QPointF(0, 0)).normalized();
-		upRect |= QRectF(shP, QPointF(CurItem->width(), CurItem->height())).normalized();
-		upRect.translate(CurItem->xPos(), CurItem->yPos());
-		doc->regionsChanged()->update(upRect.adjusted(-10.0, -10.0, 10.0, 10.0));
+		upRect |= QRectF(shP, QPointF(m_item->width(), m_item->height())).normalized();
+		upRect.translate(m_item->xPos(), m_item->yPos());
+		m_doc->regionsChanged()->update(upRect.adjusted(-10.0, -10.0, 10.0, 10.0));
 		emit DocChanged();
 	}
 }
@@ -843,7 +851,7 @@
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	if ((HaveDoc) && (HaveItem))
+	if ((m_haveDoc) && (m_haveItem))
 	{
 		m_ScMW->view->editStrokeGradient = 2;
 		if (Tpal->gradEditButton->isChecked())
@@ -855,7 +863,7 @@
 
 void PropertiesPalette::updateColorList()
 {
-	if (!HaveDoc || !m_ScMW || m_ScMW->scriptIsRunning())
+	if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
 
 	groupPal->updateColorList();
@@ -864,7 +872,7 @@
 	Cpal->updateColorList();
 	Tpal->updateColorList();
 
-	assert (doc->PageColors.document());
+	assert (m_doc->PageColors.document());
 }
 
 bool PropertiesPalette::userActionOn()
@@ -934,15 +942,15 @@
 
 void PropertiesPalette::updateColorSpecialGradient()
 {
-	if (!HaveDoc)
-		return;
-	if(doc->m_Selection->isEmpty())
+	if (!m_haveDoc)
+		return;
+	if(m_doc->m_Selection->isEmpty())
 		return;
 
 	groupPal->updateColorSpecialGradient();
 
-	double dur=doc->unitRatio();
-	PageItem *currItem=doc->m_Selection->itemAt(0);
+	double dur=m_doc->unitRatio();
+	PageItem *currItem=m_doc->m_Selection->itemAt(0);
 	if (currItem)
 	{
 		if (m_ScMW->view->editStrokeGradient == 0)
@@ -971,7 +979,7 @@
 {
 	if (!m_ScMW || m_ScMW->scriptIsRunning())
 		return;
-	if ((HaveDoc) && (HaveItem))
+	if ((m_haveDoc) && (m_haveItem))
 	{
 		shapePal->RoundRect->setEnabled(false);
 	}

Modified: branches/ScribusOIF/scribus/ui/propertiespalette.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15741&path=/branches/ScribusOIF/scribus/ui/propertiespalette.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette.h (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette.h Wed Nov  3 15:42:59 2010
@@ -33,6 +33,7 @@
 class QWidget;
 
 #include "scribusapi.h"
+#include "scguardedptr.h"
 #include "scrpalettebase.h"
 #include "scrspinbox.h"
 #include "pageitem.h"
@@ -94,17 +95,20 @@
 	PropertiesPalette_XYZ*   xyzPal;
 	Cpalette *Cpal;
 	Tpalette *Tpal;
+
+private:
+
+	PageItem* currentItemFromSelection();
 	
 public slots:
 	void setMainWindow(ScribusMainWindow *mw);
 	
 	void setDoc(ScribusDoc *d);
+	void setCurrentItem(PageItem *i);
 	void unsetDoc();
 	void unsetItem();
-//	void setCurrentItem(PageItem *);
-	void setMultipleSelection(bool);
-	void NewSel(int nr);
-	void SetCurItem(PageItem *i);
+
+	void handleSelectionChanged();
 	
 	void unitChange();
 	void languageChange();
@@ -151,14 +155,16 @@
 	QWidget* page_7;
 	QWidget* page_group;
 
-	PageItem *CurItem;
-	bool HaveDoc;
-	bool HaveItem;
-	ScribusDoc *doc;
-	double m_unitRatio;
-	int m_unitIndex;
+	QToolBox* TabStack;
 
-	QToolBox* TabStack;
+	bool      m_haveDoc;
+	bool      m_haveItem;
+	double    m_unitRatio;
+	int       m_unitIndex;
+	PageItem* m_item;
+	
+	ScGuardedPtr<ScribusDoc> m_doc;
+	
 	
 	int idXYZItem;
 	int idShapeItem;

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15741&path=/branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp Wed Nov  3 15:42:59 2010
@@ -234,6 +234,12 @@
 
 void PropertiesPalette_Group::unsetDoc()
 {
+	if (m_doc)
+	{
+		disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
+		disconnect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
+	}
+
 	m_haveDoc  = false;
 	m_haveItem = false;
 	m_doc   = NULL;
@@ -250,29 +256,6 @@
 	m_haveItem = false;
 	m_item     = NULL;
 	TpalGroup->setCurrentItem(NULL);
-	newSelection(-1);
-}
-
-void PropertiesPalette_Group::setMultipleSelection(bool isMultiple)
-{
-	if (!m_haveDoc)
-		return;
-	if (m_doc->m_Selection->count() > 1)
-	{
-		PageItem *i;
-		uint lowestItem = 999999;
-		for (int a = 0; a < m_doc->m_Selection->count(); ++a)
-		{
-			i = m_doc->m_Selection->itemAt(a);
-			lowestItem = qMin(lowestItem, i->ItemNr);
-		}
-		i = m_doc->Items->at(lowestItem);
-		setCurrentItem(i);
-	}
-}
-
-void PropertiesPalette_Group::newSelection(int /*nr*/)
-{
 	handleSelectionChanged();
 }
 

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_group.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15741&path=/branches/ScribusOIF/scribus/ui/propertiespalette_group.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_group.h (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_group.h Wed Nov  3 15:42:59 2010
@@ -90,11 +90,9 @@
 	void setMainWindow(ScribusMainWindow *mw);
 
 	void setDoc(ScribusDoc *d);
+	void setCurrentItem(PageItem *i);
 	void unsetDoc();
 	void unsetItem();
-	void setMultipleSelection(bool);
-	void newSelection(int nr);
-	void setCurrentItem(PageItem *i);
 
 	void handleSelectionChanged();
 

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_image.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15741&path=/branches/ScribusOIF/scribus/ui/propertiespalette_image.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_image.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_image.cpp Wed Nov  3 15:42:59 2010
@@ -305,6 +305,12 @@
 
 void PropertiesPalette_Image::unsetDoc()
 {
+	if (m_doc)
+	{
+		disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
+		disconnect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
+	}
+
 	m_haveDoc  = false;
 	m_haveItem = false;
 	m_doc   = NULL;
@@ -317,7 +323,7 @@
 {
 	m_haveItem = false;
 	m_item     = NULL;
-	newSelection(-1);
+	handleSelectionChanged();
 }
 
 PageItem* PropertiesPalette_Image::currentItemFromSelection()
@@ -343,29 +349,6 @@
 	}
 
 	return currentItem;
-}
-
-void PropertiesPalette_Image::setMultipleSelection(bool isMultiple)
-{
-	if (!m_haveDoc)
-		return;
-	if (m_doc->m_Selection->count() > 1)
-	{
-		PageItem *i;
-		uint lowestItem = 999999;
-		for (int a = 0; a < m_doc->m_Selection->count(); ++a)
-		{
-			i = m_doc->m_Selection->itemAt(a);
-			lowestItem = qMin(lowestItem, i->ItemNr);
-		}
-		i = m_doc->Items->at(lowestItem);
-		setCurrentItem(i);
-	}
-}
-
-void PropertiesPalette_Image::newSelection(int /*nr*/)
-{
-	handleSelectionChanged();
 }
 
 void PropertiesPalette_Image::installSniffer(ScrSpinBox *spinBox)

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_image.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15741&path=/branches/ScribusOIF/scribus/ui/propertiespalette_image.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_image.h (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_image.h Wed Nov  3 15:42:59 2010
@@ -88,11 +88,9 @@
 	void setMainWindow(ScribusMainWindow *mw);
 
 	void setDoc(ScribusDoc *d);
+	void setCurrentItem(PageItem *i);
 	void unsetDoc();
 	void unsetItem();
-	void setMultipleSelection(bool);
-	void newSelection(int nr);
-	void setCurrentItem(PageItem *i);
 
 	void handleSelectionChanged();
 

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_line.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15741&path=/branches/ScribusOIF/scribus/ui/propertiespalette_line.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_line.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_line.cpp Wed Nov  3 15:42:59 2010
@@ -285,6 +285,12 @@
 
 void PropertiesPalette_Line::unsetDoc()
 {
+	if (m_doc)
+	{
+		disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
+		disconnect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
+	}
+
 	m_haveDoc  = false;
 	m_haveItem = false;
 	m_doc   = NULL;
@@ -300,29 +306,6 @@
 	m_haveItem = false;
 	m_item     = NULL;
 	dashEditor->hide();
-	newSelection(-1);
-}
-
-void PropertiesPalette_Line::setMultipleSelection(bool isMultiple)
-{
-	if (!m_haveDoc)
-		return;
-	if (m_doc->m_Selection->count() > 1)
-	{
-		PageItem *i;
-		uint lowestItem = 999999;
-		for (int a = 0; a < m_doc->m_Selection->count(); ++a)
-		{
-			i = m_doc->m_Selection->itemAt(a);
-			lowestItem = qMin(lowestItem, i->ItemNr);
-		}
-		i = m_doc->Items->at(lowestItem);
-		setCurrentItem(i);
-	}
-}
-
-void PropertiesPalette_Line::newSelection(int /*nr*/)
-{
 	handleSelectionChanged();
 }
 

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_line.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15741&path=/branches/ScribusOIF/scribus/ui/propertiespalette_line.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_line.h (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_line.h Wed Nov  3 15:42:59 2010
@@ -100,11 +100,9 @@
 	void setMainWindow(ScribusMainWindow *mw);
 
 	void setDoc(ScribusDoc *d);
+	void setCurrentItem(PageItem *i);
 	void unsetDoc();
 	void unsetItem();
-	void setMultipleSelection(bool);
-	void newSelection(int nr);
-	void setCurrentItem(PageItem *i);
 
 	void handleSelectionChanged();
 

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15741&path=/branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp Wed Nov  3 15:42:59 2010
@@ -255,6 +255,12 @@
 
 void PropertiesPalette_Shape::unsetDoc()
 {
+	if (m_doc)
+	{
+		disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
+		disconnect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
+	}
+
 	m_haveDoc  = false;
 	m_haveItem = false;
 	m_doc   = NULL;
@@ -270,7 +276,7 @@
 {
 	m_haveItem = false;
 	m_item     = NULL;
-	newSelection(-1);
+	handleSelectionChanged();
 }
 
 PageItem* PropertiesPalette_Shape::currentItemFromSelection()
@@ -296,29 +302,6 @@
 	}
 
 	return currentItem;
-}
-
-void PropertiesPalette_Shape::setMultipleSelection(bool isMultiple)
-{
-	if (!m_haveDoc)
-		return;
-	if (m_doc->m_Selection->count() > 1)
-	{
-		PageItem *i;
-		uint lowestItem = 999999;
-		for (int a = 0; a < m_doc->m_Selection->count(); ++a)
-		{
-			i = m_doc->m_Selection->itemAt(a);
-			lowestItem = qMin(lowestItem, i->ItemNr);
-		}
-		i = m_doc->Items->at(lowestItem);
-		setCurrentItem(i);
-	}
-}
-
-void PropertiesPalette_Shape::newSelection(int /*nr*/)
-{
-	handleSelectionChanged();
 }
 
 void PropertiesPalette_Shape::setLocked(bool isLocked)
@@ -599,7 +582,7 @@
 			return;
 		}
 //		m_item->convertTo(PageItem::Polygon);
-//		NewSel(6);
+//		newSelection(6);
 		RoundRect->setEnabled(f == 0);
 	}
 }

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_shape.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15741&path=/branches/ScribusOIF/scribus/ui/propertiespalette_shape.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_shape.h (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_shape.h Wed Nov  3 15:42:59 2010
@@ -115,11 +115,9 @@
 	void setMainWindow(ScribusMainWindow *mw);
 
 	void setDoc(ScribusDoc *d);
+	void setCurrentItem(PageItem *i);
 	void unsetDoc();
 	void unsetItem();
-	void setMultipleSelection(bool);
-	void newSelection(int nr);
-	void setCurrentItem(PageItem *i);
 
 	void handleSelectionChanged();
 

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15741&path=/branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp Wed Nov  3 15:42:59 2010
@@ -556,10 +556,16 @@
 
 void PropertiesPalette_Text::unsetDoc()
 {
-	m_haveDoc = false;
+	if (m_doc)
+	{
+		disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
+		disconnect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
+	}
+
+	m_haveDoc  = false;
 	m_haveItem = false;
-	m_doc=NULL;
-	m_item = NULL;
+	m_doc      = NULL;
+	m_item     = NULL;
 
 	paraStyleCombo->setDoc(0);
 	charStyleCombo->setDoc(0);
@@ -570,28 +576,9 @@
 
 void PropertiesPalette_Text::unsetItem()
 {
-	m_haveItem=false;
-	m_item = NULL;
-	newSelection(-1);
-}
-
-void PropertiesPalette_Text::setMultipleSelection(bool isMultiple)
-{
-	if (!m_haveDoc)
-		return;
-
-	if (m_doc->m_Selection->count() > 1)
-	{
-		PageItem *i;
-		uint lowestItem = 999999;
-		for (int a=0; a<m_doc->m_Selection->count(); ++a)
-		{
-			i = m_doc->m_Selection->itemAt(a);
-			lowestItem = qMin(lowestItem, i->ItemNr);
-		}
-		i = m_doc->Items->at(lowestItem);
-		setCurrentItem(i);
-	}
+	m_haveItem = false;
+	m_item     = NULL;
+	handleSelectionChanged();
 }
 
 PageItem* PropertiesPalette_Text::currentItemFromSelection()
@@ -617,11 +604,6 @@
 	}
 
 	return currentItem;
-}
-
-void PropertiesPalette_Text::newSelection(int /*nr*/)
-{
-	handleSelectionChanged();
 }
 
 void PropertiesPalette_Text::handleSelectionChanged()

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_text.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15741&path=/branches/ScribusOIF/scribus/ui/propertiespalette_text.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_text.h (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_text.h Wed Nov  3 15:42:59 2010
@@ -113,13 +113,9 @@
 	void setMainWindow(ScribusMainWindow *mw);
 	
 	void setDoc(ScribusDoc *d);
+	void setCurrentItem(PageItem *i);
 	void unsetDoc();
 	void unsetItem();
-//	void setCurrentItem(PageItem *);
-	void setMultipleSelection(bool);
-	void newSelection(int nr);
-
-	void setCurrentItem(PageItem *i);
 
 	void handleSelectionChanged();
 

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15741&path=/branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp Wed Nov  3 15:42:59 2010
@@ -310,6 +310,12 @@
 
 void PropertiesPalette_XYZ::unsetDoc()
 {
+	if (m_doc)
+	{
+		disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
+		disconnect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
+	}
+
 	m_haveDoc  = false;
 	m_haveItem = false;
 	m_doc   = NULL;
@@ -338,7 +344,7 @@
 {
 	m_haveItem = false;
 	m_item     = NULL;
-	newSelection(-1);
+	handleSelectionChanged();
 }
 
 void PropertiesPalette_XYZ::setLineMode(int lineMode)
@@ -540,15 +546,12 @@
 	updateSpinBoxConstants();
 }
 
-void PropertiesPalette_XYZ::newSelection(int /*nr*/)
-{
-	handleSelectionChanged();
-}
-
 void PropertiesPalette_XYZ::handleSelectionChanged()
 {
 	if (!m_haveDoc || !m_ScMW || m_ScMW->scriptIsRunning())
 		return;
+
+	NameEdit->setEnabled(m_doc->m_Selection->count() == 1);
 
 	PageItem* currItem = currentItemFromSelection();
 	if (m_doc->m_Selection->count() > 1)
@@ -590,6 +593,9 @@
 		FlipH->setChecked(false);
 		FlipV->setChecked(false);
 
+		FlipH->setEnabled(true);
+		FlipV->setEnabled(true);
+
 		setEnabled(true);
 	}
 	else
@@ -661,31 +667,6 @@
 	}
 	updateGeometry();
 	repaint();
-}
-
-void PropertiesPalette_XYZ::setMultipleSelection(bool isMultiple)
-{
-	if (!m_haveDoc)
-		return;
-	//CB Having added the selection and undo transaction to mirrorpolyh/v in m_doc,
-	//these can be enabled all the time
-	FlipH->setEnabled(true);
-	FlipV->setEnabled(true);
-	NameEdit->setEnabled(!isMultiple);
-	if (m_doc->m_Selection->count() > 1)
-	{
-		FlipH->setCheckable( false );
-		FlipV->setCheckable( false );
-		PageItem *i;
-		uint lowestItem = 999999;
-		for (int a=0; a<m_doc->m_Selection->count(); ++a)
-		{
-			i = m_doc->m_Selection->itemAt(a);
-			lowestItem = qMin(lowestItem, i->ItemNr);
-		}
-		i = m_doc->Items->at(lowestItem);
-		setCurrentItem(i);
-	}
 }
 
 void PropertiesPalette_XYZ::unitChange()

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_xyz.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15741&path=/branches/ScribusOIF/scribus/ui/propertiespalette_xyz.h
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_xyz.h (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_xyz.h Wed Nov  3 15:42:59 2010
@@ -78,14 +78,13 @@
 	
 public slots:
 	void setMainWindow(ScribusMainWindow *mw);
-	void languageChange();
+	
 	void setDoc(ScribusDoc *d);
+	void setCurrentItem(PageItem *i);
 	void unsetDoc();
 	void unsetItem();
 
-	void setMultipleSelection(bool);
-	void newSelection(int nr);
-	void setCurrentItem(PageItem *i);
+	void languageChange();
 	void unitChange();
 
 	void displayLevel(uint l);




More information about the scribus-commit mailing list