r15921 by jghali - - remove m_hasGroupSelection member from selection, is only a replacement for m_selList (m_SelList.count() > 1)

scribus-commit scribus-commit at lists.scribus.net
Fri Nov 19 11:25:56 CET 2010


Author: jghali
Date: Fri Nov 19 10:25:56 2010
New Revision: 15921

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15921
Log:
- remove m_hasGroupSelection member from selection, is only a replacement for m_selList (m_SelList.count() > 1)
- #9500, palette does not get disabled when undoing an object creation leading to multiple crashes : selection change was not properly notified when last item from selection

Modified:
    branches/ScribusOIF/scribus/selection.cpp
    branches/ScribusOIF/scribus/selection.h

Modified: branches/ScribusOIF/scribus/selection.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15921&path=/branches/ScribusOIF/scribus/selection.cpp
==============================================================================
--- branches/ScribusOIF/scribus/selection.cpp (original)
+++ branches/ScribusOIF/scribus/selection.cpp Fri Nov 19 10:25:56 2010
@@ -25,7 +25,6 @@
 
 Selection::Selection(QObject* parent)
 	: QObject(parent),
-	m_hasGroupSelection(false),
 	m_isGUISelection(false),
 	m_delaySignals(0),
 	m_sigSelectionChanged(false),
@@ -37,7 +36,6 @@
 
 Selection::Selection(QObject* parent, bool guiSelection) 
 	: QObject(parent),
-	m_hasGroupSelection(false),
 	m_isGUISelection(guiSelection),
 	m_delaySignals(0),
 	m_sigSelectionChanged(false),
@@ -50,7 +48,6 @@
 Selection::Selection(const Selection& other) :
 	QObject(other.parent()),
 	m_SelList(other.m_SelList),
-	m_hasGroupSelection(other.m_hasGroupSelection),
 	// We do not copy m_isGUISelection as :
 	// 1) copy ctor is used for temporary selections
 	// 2) having two GUI selections for same doc should really be avoided
@@ -66,7 +63,7 @@
 		m_SelList[0]->connectToGUI();
 		m_SelList[0]->emitAllToGUI();
 		m_SelList[0]->setSelected(true);
-		emit selectionIsMultiple(m_hasGroupSelection);
+		emit selectionIsMultiple(m_SelList.count() > 1);
 	}
 	groupX = other.groupX;
 	groupY = other.groupY;
@@ -89,7 +86,6 @@
 			(*it)->setSelected(false);
 	}
 	m_SelList=other.m_SelList;
-	m_hasGroupSelection=other.m_hasGroupSelection;
 	// Do not copy m_isGUISelection for consistency with cpy ctor
 	/* m_isGUISelection = other.m_isGUISelection; */
 	// We do not copy m_delaySignals as that can potentially
@@ -101,7 +97,7 @@
 		m_SelList[0]->connectToGUI();
 		m_SelList[0]->emitAllToGUI();
 		m_SelList[0]->setSelected(true);
-		emit selectionIsMultiple(m_hasGroupSelection);
+		emit selectionIsMultiple(m_SelList.count() > 1);
 	}
 	return *this;
 }
@@ -117,7 +113,6 @@
 			(*it)->setSelected(false);
 	}
 	m_SelList=other.m_SelList;
-	m_hasGroupSelection=other.m_hasGroupSelection;
 	if (m_isGUISelection && !m_SelList.isEmpty())
 		m_sigSelectionIsMultiple = true;
 	if (emptyOther)
@@ -147,7 +142,6 @@
 		}
 	}
 	m_SelList.clear();
-	m_hasGroupSelection   = false;
 	m_sigSelectionChanged = true;
 	sendSignals();
 	return true;
@@ -158,7 +152,7 @@
 	bool ret = false;
 	if (!m_isGUISelection || m_SelList.isEmpty())
 		return ret;
-	if (m_hasGroupSelection==false)
+	if (m_SelList.count() == 1)
 	{
 		QPointer<PageItem> pi=m_SelList.first();
 		//Quick check to see if the pointer is NULL, if its NULL, we should remove it from the list now
@@ -210,7 +204,6 @@
 			m_sigSelectionChanged = true;
 			m_sigSelectionIsMultiple = true;
 		}
-		m_hasGroupSelection = (m_SelList.count()>1);	
 		sendSignals();
 		return true;
 	}
@@ -231,8 +224,7 @@
 			item->setSelected(true);
 			m_sigSelectionChanged = true;
 			m_sigSelectionIsMultiple = true;
-		}
-		m_hasGroupSelection = (m_SelList.count()>1);	
+		}	
 		sendSignals();
 		return true;
 	}
@@ -314,10 +306,7 @@
 			}
 		}
 
-
-		if (m_SelList.isEmpty())
-			m_hasGroupSelection=false;
-		else if (m_isGUISelection)
+		if (m_isGUISelection)
 		{
 			m_sigSelectionChanged = true;
 			sendSignals();
@@ -343,8 +332,6 @@
 				if (itemIndex == 0)
 					item->disconnectFromGUI();
 			}
-			if (m_SelList.isEmpty())
-				m_hasGroupSelection=false;
 			sendSignals();
 			return item;
 		}
@@ -575,7 +562,7 @@
 		if (m_sigSelectionChanged)
 			emit selectionChanged();
 		if (m_sigSelectionIsMultiple)
-			emit selectionIsMultiple(m_hasGroupSelection);
+			emit selectionIsMultiple(m_SelList.count() > 1);
 		m_sigSelectionChanged = false;
 		m_sigSelectionIsMultiple = false;
 	}

Modified: branches/ScribusOIF/scribus/selection.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15921&path=/branches/ScribusOIF/scribus/selection.h
==============================================================================
--- branches/ScribusOIF/scribus/selection.h (original)
+++ branches/ScribusOIF/scribus/selection.h Fri Nov 19 10:25:56 2010
@@ -139,7 +139,7 @@
 		PageItem *itemAt(int index=0) { return itemAt_(index); }
 		const PageItem *itemAt(int index=0) const { return const_cast<Selection*>(this)->itemAt_(index); }
 		QStringList getSelectedItemsByName() const;
-		bool isMultipleSelection() const { return m_hasGroupSelection; }
+		bool isMultipleSelection() const { return (m_SelList.count() > 1); }
 		bool isGUISelection() const { return m_isGUISelection; }
 		double width() const;
 		double height() const;
@@ -165,7 +165,6 @@
 	protected:
 		PageItem *itemAt_(int index=0);
 		SelectionList m_SelList;
-		bool m_hasGroupSelection;
 		bool m_isGUISelection;
 		double groupX;
 		double groupY;




More information about the scribus-commit mailing list