r20446 by jghali -

scribus-commit scribus-commit at lists.scribus.net
Tue Oct 6 21:48:56 UTC 2015


Author: jghali
Date: Tue Oct  6 21:48:56 2015
New Revision: 20446

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=20446
Log:
#13390: change of character style propagates to rendered page one "apply"-click too late

Modified:
    trunk/Scribus/scribus/ui/smtextstyles.cpp
    trunk/Scribus/scribus/ui/stylemanager.cpp
    trunk/Scribus/scribus/ui/stylemanager.h

Modified: trunk/Scribus/scribus/ui/smtextstyles.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20446&path=/trunk/Scribus/scribus/ui/smtextstyles.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/smtextstyles.cpp	(original)
+++ trunk/Scribus/scribus/ui/smtextstyles.cpp	Tue Oct  6 21:48:56 2015
@@ -296,6 +296,7 @@
 {
 	if (!m_doc)
 		return;
+
 	QMap<QString, QString> replacement;
 	for (int i = 0; i < m_deleted.count(); ++i)
 	{

Modified: trunk/Scribus/scribus/ui/stylemanager.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20446&path=/trunk/Scribus/scribus/ui/stylemanager.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/stylemanager.cpp	(original)
+++ trunk/Scribus/scribus/ui/stylemanager.cpp	Tue Oct  6 21:48:56 2015
@@ -20,10 +20,12 @@
 #include "scribusview.h"
 #include "selection.h"
 #include "shortcutwidget.h"
+#include "smcellstyle.h"
 #include "smlinestyle.h"
 #include "smlinestylewidget.h"
 #include "smreplacedia.h"
 #include "smstyleimport.h"
+#include "smtablestyle.h"
 #include "smtextstyles.h"
 #include "styleitem.h"
 #include "stylemanager.h"
@@ -180,6 +182,19 @@
 	}
 }
 
+template<class ItemType> 
+ItemType* StyleManager::item()
+{
+	for (int i = 0; i < m_items.count(); ++i)
+	{
+		StyleItem* item = m_items[i];
+		ItemType*  typedItem = dynamic_cast<ItemType*>(item);
+		if (typedItem)
+			return typedItem;
+	}
+	return 0;
+}
+
 void StyleManager::setOkButtonText()
 {
 	if (!m_isStoryEditMode)
@@ -243,8 +258,29 @@
 {
 	if (applyButton->isEnabled())
 	{
+		// #13390 : we have to proceed with some order here
+		SMCharacterStyle* charStyleItem = this->item<SMCharacterStyle>();
+		if (charStyleItem)
+			charStyleItem->apply();
+		SMParagraphStyle* paraStyleItem = this->item<SMParagraphStyle>();
+		if (paraStyleItem)
+			paraStyleItem->apply();
+		SMCellStyle* cellStyleItem = this->item<SMCellStyle>();
+		if (cellStyleItem)
+			cellStyleItem->apply();
+		SMTableStyle* tableStyleItem = this->item<SMTableStyle>();
+		if (tableStyleItem)
+			tableStyleItem->apply();
+
 		for (int i = 0; i < m_items.count(); ++i)
+		{
+			StyleItem* item = m_items.at(i);
+			if (item == charStyleItem || item == paraStyleItem)
+				continue;
+			if (item == cellStyleItem || item == tableStyleItem)
+				continue;
 			m_items.at(i)->apply();
+		}
 		if (m_doc)
 			m_doc->view()->DrawNew();
 	}

Modified: trunk/Scribus/scribus/ui/stylemanager.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=20446&path=/trunk/Scribus/scribus/ui/stylemanager.h
==============================================================================
--- trunk/Scribus/scribus/ui/stylemanager.h	(original)
+++ trunk/Scribus/scribus/ui/stylemanager.h	Tue Oct  6 21:48:56 2015
@@ -106,6 +106,8 @@
 	void setSelection(const QList<QPair<QString, QString> > &selected);
 	void setOkButtonText();
 
+	template<class ItemType> ItemType* item();
+
 private slots:
 	void slotOk();
 	void slotApply();




More information about the scribus-commit mailing list