r15776 by jghali - - remove more signals from PageItem

scribus-commit scribus-commit at lists.scribus.net
Sat Nov 6 01:08:49 CET 2010


Author: jghali
Date: Sat Nov  6 00:08:49 2010
New Revision: 15776

URL: http://scribus.info/websvn/listing.php?repname=Scribus&sc=1&rev=15776
Log:
- remove more signals from PageItem
- reduce dependency between properties palette and its tabs
- some refactoring

Modified:
    branches/ScribusOIF/scribus/canvasmode_normal.cpp
    branches/ScribusOIF/scribus/pageitem.cpp
    branches/ScribusOIF/scribus/pageitem.h
    branches/ScribusOIF/scribus/scribus.cpp
    branches/ScribusOIF/scribus/scribus.h
    branches/ScribusOIF/scribus/scribusview.cpp
    branches/ScribusOIF/scribus/scribusview.h
    branches/ScribusOIF/scribus/ui/propertiespalette.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp

Modified: branches/ScribusOIF/scribus/canvasmode_normal.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15776&path=/branches/ScribusOIF/scribus/canvasmode_normal.cpp
==============================================================================
--- branches/ScribusOIF/scribus/canvasmode_normal.cpp (original)
+++ branches/ScribusOIF/scribus/canvasmode_normal.cpp Sat Nov  6 00:08:49 2010
@@ -997,7 +997,8 @@
 			m_canvas->m_viewMode.operItemMoving = false;
 			m_canvas->m_viewMode.operItemResizing = false;
 			m_view->updateContents(QRect(static_cast<int>(x-5), static_cast<int>(y-5), static_cast<int>(w+10), static_cast<int>(h+10)));
-			//m_ScMW->propertiesPalette->setXY(x,y); CHECKME
+			//Now unuseful as PropertiesPalette_XYZ::setCurrentItem() handles multiple selection
+			//m_ScMW->propertiesPalette->setXY(x,y);
 			//m_ScMW->propertiesPalette->setBH(w,h);
 		}
 		/*else

Modified: branches/ScribusOIF/scribus/pageitem.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15776&path=/branches/ScribusOIF/scribus/pageitem.cpp
==============================================================================
--- branches/ScribusOIF/scribus/pageitem.cpp (original)
+++ branches/ScribusOIF/scribus/pageitem.cpp Sat Nov  6 00:08:49 2010
@@ -1276,7 +1276,7 @@
 void PageItem::setCornerRadius(double newRadius)
 {
 	RadRect=newRadius;
-	emit cornerRadius(RadRect);
+	//emit cornerRadius(RadRect);
 }
 
 
@@ -6797,23 +6797,23 @@
 	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(handleSelectionChanged()));
+	//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
-	connect(this, SIGNAL(cornerRadius(double)), pp, SLOT(setRR(double)));
+	//connect(this, SIGNAL(cornerRadius(double)), pp, SLOT(setRR(double)));
 	//	connect(view, SIGNAL(ItemTextCols(int, double)), propertiesPalette, SLOT(setCols(int, double)));
 	//Line signals
 	//connect(this, SIGNAL(lineWidth(double)), pp, SLOT(setLineWidth(double)));
 	//connect(this, SIGNAL(lineStyleCapJoin(Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle)), pp, SLOT( setLIvalue(Qt::PenStyle, Qt::PenCapStyle, Qt::PenJoinStyle)));
 	//Frame text signals
-	connect(this, SIGNAL(lineSpacing(double)), pp, SLOT(setLsp(double)));
+	//connect(this, SIGNAL(lineSpacing(double)), pp, SLOT(setLsp(double)));
 	//connect(this, SIGNAL(textToFrameDistances(double, double, double, double)), pp, SLOT(setTextToFrameDistances(double, double, double, double)));
-	connect(this, SIGNAL(textKerning(double)), pp, SLOT(setExtra(double)));
-	connect(this, SIGNAL(textStyle(int)), pp, SLOT(setStil(int)));
-	connect(this, SIGNAL(textStyle(int)), m_Doc->scMW(), SLOT(setStilvalue(int)));
-	connect(this, SIGNAL(textFont(const QString&)), pp, SLOT(setFontFace(const QString&)));
-	connect(this, SIGNAL(textSize(double)), pp, SLOT(setSize(double)));
+	//connect(this, SIGNAL(textKerning(double)), pp, SLOT(setExtra(double)));
+	//connect(this, SIGNAL(textStyle(int)), pp, SLOT(setStil(int)));
+	connect(this, SIGNAL(textStyle(int)), m_Doc->scMW(), SLOT(setStyleEffects(int)));
+	//connect(this, SIGNAL(textFont(const QString&)), pp, SLOT(setFontFace(const QString&)));
+	//connect(this, SIGNAL(textSize(double)), pp, SLOT(setSize(double)));
 
 	return true;
 }
@@ -6846,11 +6846,11 @@
 	if (m_Doc->appMode != modeEdit)
 	{
 //TODO remove and use the emit myself
-		emit lineSpacing(itemText.defaultStyle().lineSpacing());
-		emit textKerning(itemText.defaultStyle().charStyle().tracking());
+		//emit lineSpacing(itemText.defaultStyle().lineSpacing());
+		//emit textKerning(itemText.defaultStyle().charStyle().tracking());
 		emit textStyle(itemText.defaultStyle().charStyle().effects());
-		emit textFont(itemText.defaultStyle().charStyle().font().scName());
-		emit textSize(itemText.defaultStyle().charStyle().fontSize());
+		//emit textFont(itemText.defaultStyle().charStyle().font().scName());
+		//emit textSize(itemText.defaultStyle().charStyle().fontSize());
 //		emit textFormatting(itemText.defaultStyle().alignment());
 	}
 }

Modified: branches/ScribusOIF/scribus/pageitem.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15776&path=/branches/ScribusOIF/scribus/pageitem.h
==============================================================================
--- branches/ScribusOIF/scribus/pageitem.h (original)
+++ branches/ScribusOIF/scribus/pageitem.h Sat Nov  6 00:08:49 2010
@@ -1534,13 +1534,13 @@
 	void frameLocked(bool); //Frame lock
 	void frameSizeLocked(bool); //Frame size lock
 	//Shape signals
-	void cornerRadius(double); //Corner radius of the shape
+	//void cornerRadius(double); //Corner radius of the shape
 	//Frame text signals
-	void lineSpacing(double);
-	void textKerning(double);
+	//void lineSpacing(double);
+	//void textKerning(double);
 	void textStyle(int);
-	void textFont(const QString&);
-	void textSize(double);
+	//void textFont(const QString&);
+	//void textSize(double);
 	//void textToFrameDistances(double, double, double, double); //left, top, bottom, right: Extra, TExtra, BExtra, RExtra
 	//FIXME: columns, grid ?
 };

Modified: branches/ScribusOIF/scribus/scribus.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15776&path=/branches/ScribusOIF/scribus/scribus.cpp
==============================================================================
--- branches/ScribusOIF/scribus/scribus.cpp (original)
+++ branches/ScribusOIF/scribus/scribus.cpp Sat Nov  6 00:08:49 2010
@@ -1070,7 +1070,7 @@
 	{
 //		int ChPos = qMin(currItem->CPos, static_cast<int>(currItem->itemText.length()-1));
 		const ParagraphStyle& currPStyle( (doc->appMode == modeEdit) ? currItem->currentStyle() : currItem->itemText.defaultStyle());
-		setAbsValue(currPStyle.alignment());
+		setAlignmentValue(currPStyle.alignment());
 		propertiesPalette->textPal->displayParStyle(currPStyle.parent());
 		propertiesPalette->textPal->displayCharStyle(currItem->currentCharStyle().parent());
 		doc->currentStyle = currItem->currentStyle();
@@ -2440,9 +2440,9 @@
 	connect(view, SIGNAL(MousePos(double, double)), this, SLOT(setStatusBarMousePosition(double, double)), Qt::UniqueConnection);
 	//connect(view, SIGNAL(ItemRadius(double)), propertiesPalette, SLOT(setRR(double)), Qt::UniqueConnection);
 	connect(view, SIGNAL(ItemCharStyle(const CharStyle&)), propertiesPalette->textPal, SLOT(updateCharStyle(const CharStyle&)), Qt::UniqueConnection);
-	connect(view, SIGNAL(ItemTextStil(int)), propertiesPalette, SLOT(setStil(int)), Qt::UniqueConnection);
-	connect(view, SIGNAL(ItemTextStil(int)), this, SLOT(setStilvalue(int)), Qt::UniqueConnection);
-	connect(view, SIGNAL(ItemTextAbs(int)), this, SLOT(setAbsValue(int)), Qt::UniqueConnection);
+	connect(view, SIGNAL(ItemTextEffects(int)), propertiesPalette, SLOT(setStil(int)), Qt::UniqueConnection);
+	connect(view, SIGNAL(ItemTextEffects(int)), this, SLOT(setStyleEffects(int)), Qt::UniqueConnection);
+	connect(view, SIGNAL(ItemTextAlign(int))  , this, SLOT(setAlignmentValue(int)), Qt::UniqueConnection);
 	connect(view, SIGNAL(HasTextSel()), this, SLOT(EnableTxEdit()), Qt::UniqueConnection);
 	connect(view, SIGNAL(HasNoTextSel()), this, SLOT(DisableTxEdit()), Qt::UniqueConnection);
 	connect(view, SIGNAL(CopyItem()), this, SLOT(slotEditCopy()), Qt::UniqueConnection);
@@ -2738,7 +2738,7 @@
 			emit TextStyle(doc->currentStyle);
 			// to go: (av)
 			propertiesPalette->textPal->updateCharStyle(doc->currentStyle.charStyle());
-			setStilvalue(doc->currentStyle.charStyle().effects());
+			setStyleEffects(doc->currentStyle.charStyle().effects());
 		}
 
 //		doc->docParagraphStyles[0].setLineSpacingMode(static_cast<ParagraphStyle::LineSpacingMode>(currItem->lineSpacingMode()));
@@ -2805,7 +2805,7 @@
 			emit TextStyle(doc->currentStyle);
 			// to go: (av)
 			propertiesPalette->textPal->updateCharStyle(doc->currentStyle.charStyle());
-			setStilvalue(doc->currentStyle.charStyle().effects());
+			setStyleEffects(doc->currentStyle.charStyle().effects());
 		}
 		break;
 	default:
@@ -5197,7 +5197,8 @@
 			double x, y, w, h;
 			doc->m_Selection->setGroupRect();
 			doc->m_Selection->getGroupRect(&x, &y, &w, &h);
-			//propertiesPalette->setXY(x, y); CHECKME
+			//Now unuseful as PropertiesPalette_XYZ::setCurrentItem() handles multiple selection
+			//propertiesPalette->setXY(x, y);
 			//propertiesPalette->setBH(w, h);
 		}
 		if (docSelectionCount > 0)
@@ -5264,6 +5265,7 @@
 			//double x, y, w, h; //CHECKME
 			doc->m_Selection->setGroupRect();
 			//doc->m_Selection->getGroupRect(&x, &y, &w, &h);
+			//Now unuseful as PropertiesPalette_XYZ::setCurrentItem() handles multiple selection
 			//propertiesPalette->setXY(x, y);
 			//propertiesPalette->setBH(w, h);
 		}
@@ -6570,7 +6572,7 @@
 	setItemEffects(b);
 }
 
-void ScribusMainWindow::setStilvalue(int s)
+void ScribusMainWindow::setStyleEffects(int s)
 {
 	int c = s & 1919;
 //	doc->currentStyle.charStyle().setFeatures(static_cast<StyleFlag>(c).featureList());
@@ -6592,7 +6594,7 @@
 	if (doc->m_Selection->count() != 0)
 	{
 //		doc->currentStyle.charStyle().setFeatures(static_cast<StyleFlag>(h).featureList());
-		setStilvalue(h);
+		setStyleEffects(h);
 		doc->itemSelection_SetEffects(h);
 	}
 }
@@ -7247,7 +7249,7 @@
 	}
 }
 
-void ScribusMainWindow::setAbsValue(int a)
+void ScribusMainWindow::setAlignmentValue(int a)
 {
 //	doc->currentStyle = doc->docParagraphStyles[a];
 //	doc->currentStyle.setAlignment(static_cast<ParagraphStyle::AlignmentType>(a<5 ? a : 0));
@@ -9245,10 +9247,10 @@
 	currItem->CPos = 0;
 	SearchReplace* dia = new SearchReplace(this, doc, currItem);
 	connect(dia, SIGNAL(NewFont(const QString&)), this, SLOT(SetNewFont(const QString&)));
-	connect(dia, SIGNAL(NewAbs(int)), this, SLOT(setAbsValue(int)));
+	connect(dia, SIGNAL(NewAbs(int)), this, SLOT(setAlignmentValue(int)));
 	dia->exec();
 	disconnect(dia, SIGNAL(NewFont(const QString&)), this, SLOT(SetNewFont(const QString&)));
-	disconnect(dia, SIGNAL(NewAbs(int)), this, SLOT(setAbsValue(int)));
+	disconnect(dia, SIGNAL(NewAbs(int)), this, SLOT(setAlignmentValue(int)));
 	delete dia;
 	slotSelect();
 }

Modified: branches/ScribusOIF/scribus/scribus.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15776&path=/branches/ScribusOIF/scribus/scribus.h
==============================================================================
--- branches/ScribusOIF/scribus/scribus.h (original)
+++ branches/ScribusOIF/scribus/scribus.h Sat Nov  6 00:08:49 2010
@@ -489,7 +489,7 @@
 	void setNewAlignment(int a);
 	void setNewParStyle(const QString& name);
 	void setNewCharStyle(const QString& name);
-	void setAbsValue(int a);
+	void setAlignmentValue(int a);
 	void selectItemsFromOutlines(PageItem *ite);
 	void selectItemsFromOutlines(int Page, int Item, bool single = false);
 	void selectPagesFromOutlines(int Page);
@@ -501,7 +501,7 @@
 	void doSaveAsPDF();
 	void setMainWindowActive();
 	void setItemEffects(int h);
-	void setStilvalue(int s);
+	void setStyleEffects(int s);
 	void setItemTypeStyle(int id);
 	void slotElemRead(QString Name, double x, double y, bool art, bool loca, ScribusDoc* docc, ScribusView* vie);
 	void slotChangeUnit(int art, bool draw = true);

Modified: branches/ScribusOIF/scribus/scribusview.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15776&path=/branches/ScribusOIF/scribus/scribusview.cpp
==============================================================================
--- branches/ScribusOIF/scribus/scribusview.cpp (original)
+++ branches/ScribusOIF/scribus/scribusview.cpp Sat Nov  6 00:08:49 2010
@@ -1691,16 +1691,16 @@
 					b=0;
 				Doc->currentStyle.charStyle() = currItem->itemText.charStyle(b);
 				emit ItemCharStyle(Doc->currentStyle.charStyle());
-				emit ItemTextStil(Doc->currentStyle.charStyle().effects());
-				emit ItemTextAbs(currItem->itemText.paragraphStyle(b).alignment());
+				emit ItemTextEffects(Doc->currentStyle.charStyle().effects());
+				emit ItemTextAlign(currItem->itemText.paragraphStyle(b).alignment());
 				return true;
 			}
 			else
 			{
 				Doc->currentStyle.charStyle() = currItem->itemText.defaultStyle().charStyle();
 				emit ItemCharStyle(currItem->itemText.defaultStyle().charStyle());
-				emit ItemTextStil(currItem->itemText.defaultStyle().charStyle().effects());
-				emit ItemTextAbs( 0 );
+				emit ItemTextEffects(currItem->itemText.defaultStyle().charStyle().effects());
+				emit ItemTextAlign( 0 );
 				return true;
 			}
 		}

Modified: branches/ScribusOIF/scribus/scribusview.h
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15776&path=/branches/ScribusOIF/scribus/scribusview.h
==============================================================================
--- branches/ScribusOIF/scribus/scribusview.h (original)
+++ branches/ScribusOIF/scribus/scribusview.h Sat Nov  6 00:08:49 2010
@@ -379,8 +379,8 @@
 	void ItemTextCols(int, double);
 	void SetDistValues(double, double, double, double);
 	void ItemCharStyle(const CharStyle&);
-	void ItemTextAbs(int);
-	void ItemTextStil(int);
+	void ItemTextAlign(int);
+	void ItemTextEffects(int);
 	void HasTextSel();
 	void HasNoTextSel();
 	void MVals(double, double, double, double, double, double, int);

Modified: branches/ScribusOIF/scribus/ui/propertiespalette.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15776&path=/branches/ScribusOIF/scribus/ui/propertiespalette.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette.cpp Sat Nov  6 00:08:49 2010
@@ -281,6 +281,12 @@
 	if((d == (ScribusDoc*) m_doc) || (m_ScMW && m_ScMW->scriptIsRunning()))
 		return;
 
+	if (m_doc)
+	{
+		disconnect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
+		disconnect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
+	}
+
 	m_doc = d;
 	m_item = NULL;
 	Cpal->setDocument(m_doc);
@@ -305,10 +311,19 @@
 	textPal->setDoc(m_doc);
 
 	updateColorList();
+
+	connect(m_doc->m_Selection, SIGNAL(selectionChanged()), this, SLOT(handleSelectionChanged()));
+	connect(m_doc             , SIGNAL(docChanged())      , this, SLOT(handleSelectionChanged()));
 }
 
 void PropertiesPalette::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;
@@ -503,12 +518,12 @@
 
 	qDebug() << "PropertiesPalette::handleSelectionChanged()";
 
-	xyzPal->handleSelectionChanged();
+	/*xyzPal->handleSelectionChanged();
 	shapePal->handleSelectionChanged();
 	groupPal->handleSelectionChanged();
 	imagePal->handleSelectionChanged();
 	linePal->handleSelectionChanged();
-	textPal->handleSelectionChanged();
+	textPal->handleSelectionChanged();*/
 
 	PageItem* currItem = currentItemFromSelection();
 	if (m_doc->m_Selection->count() > 1)

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp
URL: http://scribus.info/websvn/diff.php?repname=Scribus&rev=15776&path=/branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp Sat Nov  6 00:08:49 2010
@@ -432,8 +432,15 @@
 	disconnect(FlipH, SIGNAL(clicked()), this, SLOT(handleFlipH()));
 	disconnect(FlipV, SIGNAL(clicked()), this, SLOT(handleFlipV()));
 	disconnect(Rotation, SIGNAL(valueChanged(double)), this, SLOT(handleRotation()));
-	displayXY(i->xPos(), i->yPos());
-	displayWH(i->width(), i->height());
+
+	double selX = m_item->xPos();
+	double selY = m_item->yPos();
+	double selW = m_item->width();
+	double selH = m_item->height();
+	if (m_doc->m_Selection->count() > 1)
+		m_doc->m_Selection->getGroupRect(&selX, &selY, &selW, &selH);
+	displayXY(selX, selY);
+	displayWH(selW, selH);
 	NoPrint->setChecked(!i->printEnabled());
 	displayLocked(i->locked());
 	displaySizeLocked(i->sizeLocked());
@@ -501,7 +508,8 @@
 		Height->setEnabled(true);
 		keepFrameWHRatioButton->setEnabled(true);
 	}
-	displayXY(m_item->xPos(), m_item->yPos());
+	displayXY(selX, selY);
+	displayWH(selW, selH);
 	double rrR = i->imageRotation();
 	if (i->imageRotation() > 0)
 		rrR = 360 - rrR;




More information about the scribus-commit mailing list