r19288 by jghali - #12443: "Multiple Duplicate" should not be clickable if no item is selected

scribus-commit scribus-commit at lists.scribus.net
Thu Jun 26 22:07:56 UTC 2014


Author: jghali
Date: Thu Jun 26 22:07:56 2014
New Revision: 19288

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19288
Log:
#12443: "Multiple Duplicate" should not be clickable if no item is selected
#12444: "Search/Replace..." should not be clickable if no Text Frame is selected

Modified:
    trunk/Scribus/scribus/canvasmode.cpp
    trunk/Scribus/scribus/canvasmode_drawbezier.cpp
    trunk/Scribus/scribus/canvasmode_edit.cpp
    trunk/Scribus/scribus/canvasmode_normal.cpp
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp
    trunk/Scribus/scribus/scribus.cpp
    trunk/Scribus/scribus/scribus.h
    trunk/Scribus/scribus/scribusdoc.cpp
    trunk/Scribus/scribus/scribusview.cpp
    trunk/Scribus/scribus/scribusview.h

Modified: trunk/Scribus/scribus/canvasmode.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19288&path=/trunk/Scribus/scribus/canvasmode.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode.cpp (original)
+++ trunk/Scribus/scribus/canvasmode.cpp Thu Jun 26 22:07:56 2014
@@ -1182,7 +1182,7 @@
 		m_doc->ElemToLink = NULL;
 		mainWindow->slotSelect();
 		if (m_doc->m_Selection->count() == 0)
-			mainWindow->HaveNewSel(-1);
+			mainWindow->HaveNewSel();
 		prefsManager->appPrefs.uiPrefs.stickyTools = false;
 		scrActions["stickyTools"]->setChecked(false);
 		return;

Modified: trunk/Scribus/scribus/canvasmode_drawbezier.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19288&path=/trunk/Scribus/scribus/canvasmode_drawbezier.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_drawbezier.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_drawbezier.cpp Thu Jun 26 22:07:56 2014
@@ -91,7 +91,7 @@
 //		emit DelObj(m_doc->currentPage->pageNr(), currItem->ItemNr);
 		m_doc->Items->removeOne(currItem);
 		m_doc->m_Selection->removeFirst();
-		//emit HaveSel(-1);
+		//emit HaveSel();
 	}
 	else
 	{

Modified: trunk/Scribus/scribus/canvasmode_edit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19288&path=/trunk/Scribus/scribus/canvasmode_edit.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_edit.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_edit.cpp Thu Jun 26 22:07:56 2014
@@ -836,7 +836,7 @@
 				m_view->m_ScMW->slotSetCurrentPage(currItem->OwnPage);
 			}
 			//CB done with emitAllToGUI
-			//emit HaveSel(currItem->itemType());
+			//emit HaveSel();
 			//EmitValues(currItem);
 			//CB need this for? a moved item will send its new data with the new xpos/ypos emits
 			//CB TODO And what if we have dragged to a new page. Items X&Y are not updated anyway now

Modified: trunk/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19288&path=/trunk/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- trunk/Scribus/scribus/canvasmode_normal.cpp (original)
+++ trunk/Scribus/scribus/canvasmode_normal.cpp Thu Jun 26 22:07:56 2014
@@ -1164,7 +1164,7 @@
 				m_view->m_ScMW->slotSetCurrentPage(currItem->OwnPage);
 			}
 			//CB done with emitAllToGUI
-			//emit HaveSel(currItem->itemType());
+			//emit HaveSel();
 			//EmitValues(currItem);
 			//CB need this for? a moved item will send its new data with the new xpos/ypos emits
 			//CB TODO And what if we have dragged to a new page. Items X&Y are not updated anyway now
@@ -1902,7 +1902,7 @@
 		if (m_doc->m_Selection->count() > 0)
 		{
 			m_doc->m_Selection->connectItemToGUI();
-			m_ScMW->HaveNewSel(m_doc->m_Selection->itemAt(0)->itemType());
+			m_ScMW->HaveNewSel();
 		}
 	}
 }

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19288&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Thu Jun 26 22:07:56 2014
@@ -9912,7 +9912,7 @@
 	if (!m_Doc->m_Selection->primarySelectionIs(this))
 		return false;
 
-	connect(this, SIGNAL(frameType(int)), m_Doc->scMW(), SLOT(HaveNewSel(int)));
+	connect(this, SIGNAL(frameType(int)), m_Doc->scMW(), SLOT(HaveNewSel()));
 	connect(this, SIGNAL(frameType(int)), m_Doc, SLOT(selectionChanged()));
 	connect(this, SIGNAL(textStyle(int)), m_Doc->scMW(), SLOT(setStyleEffects(int)));
 

Modified: trunk/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19288&path=/trunk/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp (original)
+++ trunk/Scribus/scribus/plugins/scriptplugin/scriptercore.cpp Thu Jun 26 22:07:56 2014
@@ -165,12 +165,8 @@
 		ScMW->doc->RePos = true;
 		ScMW->doc->RePos = false;
 		if (ScMW->doc->m_Selection->count() != 0)
-		{
 			ScMW->doc->m_Selection->itemAt(0)->emitAllToGUI();
-			ScMW->HaveNewSel(ScMW->doc->m_Selection->itemAt(0)->itemType());
-		}
-		else
-			ScMW->HaveNewSel(-1);
+		ScMW->HaveNewSel();
 		ScMW->view->DrawNew();
 		//CB Really only need (want?) this for new docs, but we need it after a call to ScMW doFileNew.
 		//We don't want it in cmddoc calls as itll interact with the GUI before a script may be finished.

Modified: trunk/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19288&path=/trunk/Scribus/scribus/scribus.cpp
==============================================================================
--- trunk/Scribus/scribus/scribus.cpp (original)
+++ trunk/Scribus/scribus/scribus.cpp Thu Jun 26 22:07:56 2014
@@ -1616,7 +1616,7 @@
 		doc->ElemToLink = NULL;
 		slotSelect();
 		if (doc->m_Selection->isEmpty())
-			HaveNewSel(-1);
+			HaveNewSel();
 		prefsManager->appPrefs.uiPrefs.stickyTools = false;
 		scrActions["stickyTools"]->setChecked(false);
 		return;
@@ -2437,13 +2437,9 @@
 	RestoreBookMarks();
 	if (!doc->isLoading())
 	{
+		HaveNewSel();
 		if (!doc->m_Selection->isEmpty())
-		{
-			HaveNewSel(doc->m_Selection->itemAt(0)->itemType());
 			doc->m_Selection->itemAt(0)->emitAllToGUI();
-		}
-		else
-			HaveNewSel(-1);
 	}
 	docCheckerPalette->setDoc(doc);
 	tocGenerator->setDoc(doc);
@@ -2557,7 +2553,7 @@
 	connect(view, SIGNAL(PStatus(int, uint)), nodePalette, SLOT(PolyStatus(int, uint)), Qt::UniqueConnection);
 	connect(view, SIGNAL(ItemGeom()), propertiesPalette->xyzPal, SLOT(handleSelectionChanged()), Qt::UniqueConnection);
 	connect(view, SIGNAL(ChBMText(PageItem *)), this, SLOT(BookMarkTxT(PageItem *)), Qt::UniqueConnection);
-	connect(view, SIGNAL(HaveSel(int)), this, SLOT(HaveNewSel(int)), Qt::UniqueConnection);
+	connect(view, SIGNAL(HaveSel()), this, SLOT(HaveNewSel()), Qt::UniqueConnection);
 	connect(view, SIGNAL(PaintingDone()), this, SLOT(slotSelect()), Qt::UniqueConnection);
 	connect(view, SIGNAL(DocChanged()), this, SLOT(slotDocCh()), Qt::UniqueConnection);
 	connect(view, SIGNAL(MousePos(double, double)), this, SLOT(setStatusBarMousePosition(double, double)), Qt::UniqueConnection);
@@ -2579,22 +2575,21 @@
 	connect(view, SIGNAL(callGimp()), this, SLOT(callImageEditor()), Qt::UniqueConnection);
 }
 
-void ScribusMainWindow::HaveNewSel(int SelectedType)
-{
+void ScribusMainWindow::HaveNewSel()
+{
+	int SelectedType = -1;
 	PageItem *currItem = NULL;
 	if (doc == NULL)
 		return;
-	const uint docSelectionCount=doc->m_Selection->count();
-	if (SelectedType != -1)
-	{
-		if (docSelectionCount != 0)
-			currItem = doc->m_Selection->itemAt(0);
-		else
-			SelectedType = -1;
-	}
-	else if (docSelectionCount > 0)
+	const uint docSelectionCount = doc->m_Selection->count();
+	if (docSelectionCount > 0)
 	{
 		currItem = doc->m_Selection->itemAt(0);
+		SelectedType = currItem->itemType();
+	}
+	else
+	{
+		SelectedType = -1;
 	}
 	assert (docSelectionCount == 0 || currItem != NULL); // help coverity analysis
 	if (docSelectionCount == 0)
@@ -5336,7 +5331,7 @@
 					//propertiesPalette->setBH(w, h);
 				}
 				if (docSelectionCount > 0)
-					HaveNewSel(doc->m_Selection->itemAt(0)->itemType());
+					HaveNewSel();
 			}
 			view->DrawNew();
 		}
@@ -5431,10 +5426,7 @@
 			//propertiesPalette->setBH(w, h);
 		}
 		if (docSelectionCount > 0)
-		{
-			currItem = doc->m_Selection->itemAt(0);
-			HaveNewSel(currItem->itemType());
-		}
+			HaveNewSel();
 		view->DrawNew();
 	}
 	delete dia;
@@ -5501,10 +5493,7 @@
 			//propertiesPalette->setBH(w, h);
 		}
 		if (docSelectionCount > 0)
-		{
-			currItem = doc->m_Selection->itemAt(0);
-			HaveNewSel(currItem->itemType());
-		}
+			HaveNewSel();
 	}
 	view->DrawNew();
 }
@@ -6359,14 +6348,12 @@
 	{
 // done elsewhere now:		doc->appMode = modeNormal;
 		doc->nodeEdit.reset();
+		HaveNewSel();
 		if (!doc->m_Selection->isEmpty())
 		{
-			HaveNewSel(doc->m_Selection->itemAt(0)->itemType());
 			doc->m_Selection->itemAt(0)->emitAllToGUI();
 			view->DrawNew();
 		}
-		else
-			HaveNewSel(-1);
 	}
 	actionManager->connectModeActions();
 // 	if (tmpClip)
@@ -8586,7 +8573,6 @@
 	pagePalette->rebuildPages();
 	if (outlinePalette->isVisible())
 		outlinePalette->BuildTree();
-
 }
 
 void ScribusMainWindow::restoreAddPage(SimpleState *state, bool isUndo)
@@ -8908,7 +8894,7 @@
 		return;
 	slotSetCurrentPage(p0);
 	doc->view()->SetCPo(doc->currentPage()->xOffset() - 10, doc->currentPage()->yOffset() - 10);
-	HaveNewSel(-1);
+	HaveNewSel();
 	doc->view()->setFocus();
 }
 
@@ -10849,7 +10835,7 @@
 	scrMenuMgr->setMenuEnabled("Insert", !doc->drawAsPreview);
 	scrMenuMgr->setMenuEnabled("Page", !doc->drawAsPreview);
 	scrMenuMgr->setMenuEnabled("Extras", !doc->drawAsPreview);
-	HaveNewSel(-1);
+	HaveNewSel();
 }
 
 

Modified: trunk/Scribus/scribus/scribus.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19288&path=/trunk/Scribus/scribus/scribus.h
==============================================================================
--- trunk/Scribus/scribus/scribus.h (original)
+++ trunk/Scribus/scribus/scribus.h Thu Jun 26 22:07:56 2014
@@ -454,7 +454,7 @@
 	void setAppModeByToggle(bool isOn, int newMode);
 	/** \brief Neues Dokument erzeugt */
 	void HaveNewDoc();
-	void HaveNewSel(int Nr);
+	void HaveNewSel();
 	/** Dokument ist geaendert worden */
 	void slotDocCh(bool reb = true);
 	/** Setzt die Abstufung */

Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19288&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Thu Jun 26 22:07:56 2014
@@ -10130,8 +10130,9 @@
 		if (m_hasGUI)
 		{
 			connect(this, SIGNAL(docChanged()), m_ScMW, SLOT(slotDocCh()));
-			connect(this, SIGNAL(firstSelectedItemType(int)), m_ScMW, SLOT(HaveNewSel(int)));
+			connect(this, SIGNAL(firstSelectedItemType(int)), m_ScMW, SLOT(HaveNewSel()));
 			connect(this, SIGNAL(saved(QString)), WinHan, SLOT(slotSaved(QString)));
+			connect(this->m_Selection, SIGNAL(selectionChanged()), m_ScMW, SLOT(HaveNewSel()));
 			connect(autoSaveTimer, SIGNAL(timeout()), this, SLOT(slotAutoSave()));
 		}
 	}
@@ -10144,8 +10145,9 @@
 		if (m_hasGUI)
 		{
 			disconnect(this, SIGNAL(docChanged()), m_ScMW, SLOT(slotDocCh()));
-			disconnect(this, SIGNAL(firstSelectedItemType(int)), m_ScMW, SLOT(HaveNewSel(int)));
+			disconnect(this, SIGNAL(firstSelectedItemType(int)), m_ScMW, SLOT(HaveNewSel()));
 			disconnect(this, SIGNAL(saved(QString)), WinHan, SLOT(slotSaved(QString)));
+			disconnect(this->m_Selection, SIGNAL(selectionChanged()), m_ScMW, SLOT(HaveNewSel()));
 			disconnect(autoSaveTimer, SIGNAL(timeout()), this, SLOT(slotAutoSave()));
 		}
 	}
@@ -11875,7 +11877,7 @@
 			emit firstSelectedItemType(-1);
 		else
 		{
-			//emit HaveSel(Doc->m_Selection->itemAt(0)->itemType());
+			//emit HaveSel();
 			itemSelection->itemAt(0)->emitAllToGUI();
 		}
 	}
@@ -12447,7 +12449,7 @@
 void ScribusDoc::endAlign()
 {
 	changed();
-	m_ScMW->HaveNewSel(m_Selection->itemAt(0)->itemType());
+	m_ScMW->HaveNewSel();
 	for (int i = 0; i < m_Selection->count(); ++i)
 	{
 		setRedrawBounding(m_Selection->itemAt(i));
@@ -15481,7 +15483,7 @@
 	itemSelection->getGroupRect(&x, &y, &w, &h);
 	emit docChanged();
 	if (itemSelection->count() > 0)
-		m_ScMW->HaveNewSel(itemSelection->itemAt(0)->itemType());
+		m_ScMW->HaveNewSel();
 	regionsChanged()->update(QRectF(x-5, y-5, w+10, h+10));
 }
 

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19288&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Thu Jun 26 22:07:56 2014
@@ -418,7 +418,7 @@
 		{
 			m_canvas->setForcedRedraw(true);
 //			Doc->m_Selection->clear();
-//			emit HaveSel(-1);
+//			emit HaveSel();
 			m_canvas->resetRenderMode();
 			updateContents();
 		}
@@ -1656,7 +1656,7 @@
 	//		updateContents(QRect(static_cast<int>(x-5), static_cast<int>(y-5), static_cast<int>(w+10), static_cast<int>(h+10)));
 			//CB move in here as the emitAllToGUI will do it otherwise
 			emit ItemGeom();
-			emit HaveSel(currItem->itemType());
+			emit HaveSel();
 		}
 		//CB done by addItem for single selection or the frame data is already there
 		//else
@@ -1666,7 +1666,7 @@
 }
 
 //CB Remove bookmark interaction here, item/doc should do it
-void ScribusView::Deselect(bool prop)
+void ScribusView::Deselect(bool /*prop*/)
 {
 	if (!Doc->m_Selection->isEmpty())
 	{
@@ -1698,8 +1698,6 @@
 				updateContents(currItem->getRedrawBounding(scale));
 		}
 	}
-	if (prop && !Doc->m_Selection->signalsDelayed())
-		emit HaveSel(-1);
 }
 
  // FIXME:av -> CanvasMode_legacy / Doc
@@ -1766,7 +1764,7 @@
 		newObjects.setGroupRect();
 		newObjects.getGroupRect(&gx, &gy, &gw, &gh);
 		emit ItemGeom();
-		emit HaveSel(newObjects.itemAt(0)->itemType());
+		emit HaveSel();
 	}
 	else if (newObjects.count() == 1)
 	{
@@ -2382,7 +2380,7 @@
 		return;
 	m_ScMW->slotSetCurrentPage(Seite);
 	SetCPo(Doc->currentPage()->xOffset() - 10, Doc->currentPage()->yOffset() - 10);
-	m_ScMW->HaveNewSel(-1);
+	m_ScMW->HaveNewSel();
 }
 
 void ScribusView::showMasterPage(int nr)
@@ -3826,7 +3824,7 @@
 				tmpSelection.addItem(delItems.takeAt(0)); //yes, 0, remove the first
 			Doc->itemSelection_DeleteItem(&tmpSelection);
 		}
-		m_ScMW->HaveNewSel(-1);
+		m_ScMW->HaveNewSel();
 		Deselect(true);
 		trans.commit();
 	}

Modified: trunk/Scribus/scribus/scribusview.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19288&path=/trunk/Scribus/scribus/scribusview.h
==============================================================================
--- trunk/Scribus/scribus/scribusview.h (original)
+++ trunk/Scribus/scribus/scribusview.h Thu Jun 26 22:07:56 2014
@@ -343,7 +343,7 @@
 signals:
 	void changeUN(int);
 	void changeLA(int);
-	void HaveSel(int);
+	void HaveSel();
 	void DocChanged();
 	void ItemGeom();
 	void PolyOpen();




More information about the scribus-commit mailing list