r16838 by jghali - fix update problem of text properties in PP

scribus-commit scribus-commit at lists.scribus.net
Fri Sep 16 06:31:20 UTC 2011


Author: jghali
Date: Fri Sep 16 06:31:19 2011
New Revision: 16838

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16838
Log:
fix update problem of text properties in PP

Modified:
    trunk/Scribus/scribus/pageitem.cpp
    trunk/Scribus/scribus/pageitem.h
    trunk/Scribus/scribus/ui/propertiespalette_text.cpp
    trunk/Scribus/scribus/ui/propertywidget_advanced.cpp
    trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp

Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16838&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Fri Sep 16 06:31:19 2011
@@ -1300,6 +1300,19 @@
 		return itemText.charStyle(itemText.cursorPosition());
 	else
 		return itemText.defaultStyle().charStyle();
+}
+
+void PageItem::currentTextProps(ParagraphStyle& parStyle) const
+{
+	parStyle = this->currentStyle();
+	int position = itemText.cursorPosition();
+	if (itemText.lengthOfSelection() > 0)
+		position = qMin(qMax(itemText.endOfSelection() - 1, 0), qMax(position, itemText.startOfSelection()));
+
+	if (frameDisplays(position))
+		parStyle.charStyle().setStyle( itemText.charStyle(position) );
+	else
+		parStyle.charStyle().setStyle( itemText.defaultStyle().charStyle() );
 }
 
 void PageItem::setTextToFrameDistLeft(double newLeft)

Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16838&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Fri Sep 16 06:31:19 2011
@@ -363,6 +363,8 @@
 	ParagraphStyle& changeCurrentStyle();
 	/// returns the style at the current charpos
 	const CharStyle& currentCharStyle() const;
+	/// Return current text properties (current char + paragraph properties)
+	void currentTextProps(ParagraphStyle& parStyle) const;
 	// deprecated:
 	double layoutGlyphs(const CharStyle& style, const QString& chars, GlyphLayout& layout);
 	void SetQColor(QColor *tmp, QString farbe, double shad);

Modified: trunk/Scribus/scribus/ui/propertiespalette_text.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16838&path=/trunk/Scribus/scribus/ui/propertiespalette_text.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertiespalette_text.cpp (original)
+++ trunk/Scribus/scribus/ui/propertiespalette_text.cpp Fri Sep 16 06:31:19 2011
@@ -387,7 +387,10 @@
 
 	if (m_item->asTextFrame() || m_item->asPathText())
 	{
-		updateStyle(m_doc->appMode == modeEdit? m_item->currentStyle() : m_item->itemText.defaultStyle());
+		ParagraphStyle parStyle =  m_item->itemText.defaultStyle();
+		if (m_doc->appMode == modeEdit)
+			m_item->currentTextProps(parStyle);
+		updateStyle(parStyle);
 	}
 	if (m_item->asOSGFrame())
 	{

Modified: trunk/Scribus/scribus/ui/propertywidget_advanced.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16838&path=/trunk/Scribus/scribus/ui/propertywidget_advanced.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertywidget_advanced.cpp (original)
+++ trunk/Scribus/scribus/ui/propertywidget_advanced.cpp Fri Sep 16 06:31:19 2011
@@ -104,7 +104,10 @@
 	{
 		if (m_item->asTextFrame() || m_item->asPathText())
 		{
-			updateStyle(m_doc->appMode == modeEdit? m_item->currentStyle() : m_item->itemText.defaultStyle());
+			ParagraphStyle parStyle =  m_item->itemText.defaultStyle();
+			if (m_doc->appMode == modeEdit)
+				m_item->currentTextProps(parStyle);
+			updateStyle(parStyle);
 		}
 		connectSignals();
 	}

Modified: trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16838&path=/trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp
==============================================================================
--- trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp (original)
+++ trunk/Scribus/scribus/ui/propertywidget_textcolor.cpp Fri Sep 16 06:31:19 2011
@@ -101,7 +101,10 @@
 		revertButton->setChecked(m_item->reversed());
 		if (m_item->asTextFrame() || m_item->asPathText())
 		{
-			updateStyle(m_doc->appMode == modeEdit? m_item->currentStyle() : m_item->itemText.defaultStyle());
+			ParagraphStyle parStyle =  m_item->itemText.defaultStyle();
+			if (m_doc->appMode == modeEdit)
+				m_item->currentTextProps(parStyle);
+			updateStyle(parStyle);
 		}
 		connectSignals();
 	}




More information about the scribus-commit mailing list