r16844 by jghali - merge trunk revisions up to r16839

scribus-commit scribus-commit at lists.scribus.net
Mon Sep 19 06:42:03 UTC 2011


Author: jghali
Date: Mon Sep 19 06:42:02 2011
New Revision: 16844

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16844
Log:
merge trunk revisions up to r16839

Modified:
    branches/ScribusOIF/scribus/canvasmode_edit.cpp
    branches/ScribusOIF/scribus/pageitem.cpp
    branches/ScribusOIF/scribus/pageitem.h
    branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
    branches/ScribusOIF/scribus/scstreamfilter_jpeg.cpp
    branches/ScribusOIF/scribus/ui/about.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette_image.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette_line.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp
    branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp
    branches/ScribusOIF/scribus/ui/propertywidget_advanced.cpp
    branches/ScribusOIF/scribus/ui/propertywidget_distance.cpp
    branches/ScribusOIF/scribus/ui/propertywidget_pathtext.cpp
    branches/ScribusOIF/scribus/ui/propertywidget_textcolor.cpp
    branches/ScribusOIF/scribus/units.cpp

Modified: branches/ScribusOIF/scribus/canvasmode_edit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16844&path=/branches/ScribusOIF/scribus/canvasmode_edit.cpp
==============================================================================
--- branches/ScribusOIF/scribus/canvasmode_edit.cpp (original)
+++ branches/ScribusOIF/scribus/canvasmode_edit.cpp Mon Sep 19 06:42:02 2011
@@ -205,10 +205,6 @@
 
 void CanvasMode_Edit::drawTextCursor ( QPainter *p, PageItem_TextFrame* textframe )
 {
-	//CB: If we have this test in we get no initial cursor placed for a new text frame
-	// but if we do, we crash when we resize.. #9886
-	if(textframe->lastInFrame() < 0)
-		return;
 	if ((!m_longCursorTime && m_blinkTime.elapsed() > qApp->cursorFlashTime() / 2 ) ||
 		(m_longCursorTime && m_blinkTime.elapsed() > qApp->cursorFlashTime() )
 		)
@@ -260,7 +256,7 @@
 		{
 			// Happens often when typing directly into frame.
 			// And the cursor curses nothing, vertigo.
-			textCursorPos = textframe->lastInFrame();
+			textCursorPos = qMax(0, textframe->lastInFrame());
 			QChar textCursorChar = textframe->itemText.text(textCursorPos);
 			cursorDirection = !textframe->itemText.charAttributes(textCursorPos).testFlag(TextFlag_RightToLeft);
 			if (textCursorChar == SpecialChars::PARSEP || textCursorChar == SpecialChars::LINEBREAK)

Modified: branches/ScribusOIF/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16844&path=/branches/ScribusOIF/scribus/pageitem.cpp
==============================================================================
--- branches/ScribusOIF/scribus/pageitem.cpp (original)
+++ branches/ScribusOIF/scribus/pageitem.cpp Mon Sep 19 06:42:02 2011
@@ -1311,6 +1311,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: branches/ScribusOIF/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16844&path=/branches/ScribusOIF/scribus/pageitem.h
==============================================================================
--- branches/ScribusOIF/scribus/pageitem.h (original)
+++ branches/ScribusOIF/scribus/pageitem.h Mon Sep 19 06:42:02 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: branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16844&path=/branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format.cpp
==============================================================================
--- branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format.cpp (original)
+++ branches/ScribusOIF/scribus/plugins/fileloader/scribus150format/scribus150format.cpp Mon Sep 19 06:42:02 2011
@@ -2730,7 +2730,6 @@
 		{
 			newItem->itemText.insertChars(newItem->itemText.length(), SpecialChars::PARSEP);
 			ParagraphStyle newStyle;
-			PrefsManager* prefsManager = PrefsManager::instance();
 			readParagraphStyle(doc, reader, newStyle);
 			newItem->itemText.setStyle(newItem->itemText.length()-1, newStyle);
 			newItem->itemText.setCharStyle(newItem->itemText.length()-1, 1, lastStyle->Style);
@@ -2738,7 +2737,6 @@
 		else if (tName == "trail")
 		{
 			ParagraphStyle newStyle;
-			PrefsManager* prefsManager = PrefsManager::instance();
 			readParagraphStyle(doc, reader, newStyle);
 			newItem->itemText.setStyle(newItem->itemText.length(), newStyle);
 		}

Modified: branches/ScribusOIF/scribus/scstreamfilter_jpeg.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16844&path=/branches/ScribusOIF/scribus/scstreamfilter_jpeg.cpp
==============================================================================
--- branches/ScribusOIF/scribus/scstreamfilter_jpeg.cpp (original)
+++ branches/ScribusOIF/scribus/scstreamfilter_jpeg.cpp Mon Sep 19 06:42:02 2011
@@ -128,7 +128,7 @@
 
 ScJpegEncodeFilter::ScJpegEncodeFilter(ScStreamFilter* filter, unsigned int imgWidth, unsigned int imgHeight, 
 					ScJpegEncodeFilter::Color color) : ScStreamFilter(filter), m_width(imgWidth), m_height(imgHeight),
-					m_color(color), m_quality(75)
+					m_quality(75), m_color(color)
 {
 	m_filterData = NULL;
 	m_openedFilter = false;

Modified: branches/ScribusOIF/scribus/ui/about.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16844&path=/branches/ScribusOIF/scribus/ui/about.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/about.cpp (original)
+++ branches/ScribusOIF/scribus/ui/about.cpp Mon Sep 19 06:42:02 2011
@@ -112,8 +112,8 @@
 	buildID = new QLabel( tab );
 	buildID->setAlignment(Qt::AlignCenter);
 	buildID->setTextInteractionFlags(Qt::TextSelectableByMouse);
-	QString BUILD_DAY = "15";
-	QString BUILD_MONTH = CommonStrings::august;
+	QString BUILD_DAY = "16";
+	QString BUILD_MONTH = CommonStrings::september;
 	QString BUILD_YEAR = "2011";
 	QString BUILD_TIME = "";
 	QString BUILD_TZ = "";

Modified: branches/ScribusOIF/scribus/ui/propertiespalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16844&path=/branches/ScribusOIF/scribus/ui/propertiespalette.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette.cpp Mon Sep 19 06:42:02 2011
@@ -281,12 +281,9 @@
 	Tpal->setDocument(m_doc);
 	Tpal->setCurrentItem(NULL);
 
-	m_unitRatio=m_doc->unitRatio();
-	m_unitIndex=m_doc->unitIndex();
-	int precision = unitGetPrecisionFromIndex(m_unitIndex);
+	m_unitRatio = m_doc->unitRatio();
+	m_unitIndex = m_doc->unitIndex();
 //qt4 FIXME here
-	double maxXYWHVal= 16777215 * m_unitRatio;
-	double minXYVal= -16777215 * m_unitRatio;
 	m_haveDoc = true;
 	m_haveItem = false;
 

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16844&path=/branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_group.cpp Mon Sep 19 06:42:02 2011
@@ -151,9 +151,6 @@
 	m_item = NULL;
 	m_unitRatio   = m_doc->unitRatio();
 	m_unitIndex   = m_doc->unitIndex();
-	int precision = unitGetPrecisionFromIndex(m_unitIndex);
-	double maxXYWHVal =  16777215 * m_unitRatio;
-	double minXYVal   = -16777215 * m_unitRatio;
 
 	transPalWidget->setDocument(m_doc);
 	transPalWidget->setCurrentItem(NULL);

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_image.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16844&path=/branches/ScribusOIF/scribus/ui/propertiespalette_image.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_image.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_image.cpp Mon Sep 19 06:42:02 2011
@@ -142,7 +142,6 @@
 	m_unitIndex   = m_doc->unitIndex();
 	int precision = unitGetPrecisionFromIndex(m_unitIndex);
 	double maxXYWHVal =  16777215 * m_unitRatio;
-	double minXYVal   = -16777215 * m_unitRatio;
 
 	m_haveDoc  = true;
 	m_haveItem = false;
@@ -801,7 +800,6 @@
 	if (!m_doc)
 		return;
 
-	double oldRatio = m_unitRatio;
 	m_unitRatio = m_doc->unitRatio();
 	m_unitIndex = m_doc->unitIndex();
 

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_line.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16844&path=/branches/ScribusOIF/scribus/ui/propertiespalette_line.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_line.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_line.cpp Mon Sep 19 06:42:02 2011
@@ -141,7 +141,6 @@
 	m_item = NULL;
 	m_unitRatio   = m_doc->unitRatio();
 	m_unitIndex   = m_doc->unitIndex();
-	int precision = unitGetPrecisionFromIndex(m_unitIndex);
 
 	m_haveDoc  = true;
 	m_haveItem = false;
@@ -757,7 +756,6 @@
 	if (!m_doc)
 		return;
 
-	double oldRatio = m_unitRatio;
 	m_unitRatio = m_doc->unitRatio();
 	m_unitIndex = m_doc->unitIndex();
 

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16844&path=/branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_shape.cpp Mon Sep 19 06:42:02 2011
@@ -105,7 +105,6 @@
 	m_item = NULL;
 	m_unitRatio   = m_doc->unitRatio();
 	m_unitIndex   = m_doc->unitIndex();
-	int precision = unitGetPrecisionFromIndex(m_unitIndex);
 
 	m_haveDoc  = true;
 	m_haveItem = false;
@@ -551,7 +550,6 @@
 	if (!m_doc)
 		return;
 
-	double oldRatio = m_unitRatio;
 	m_unitRatio = m_doc->unitRatio();
 	m_unitIndex = m_doc->unitIndex();
 

Modified: branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16844&path=/branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_text.cpp Mon Sep 19 06:42:02 2011
@@ -157,9 +157,6 @@
 
 	m_unitRatio   = m_doc->unitRatio();
 	m_unitIndex   = m_doc->unitIndex();
-	int precision = unitGetPrecisionFromIndex(m_unitIndex);
-	double maxXYWHVal =  16777215 * m_unitRatio;
-	double minXYVal   = -16777215 * m_unitRatio;
 
 	m_haveDoc  = true;
 	m_haveItem = false;
@@ -393,7 +390,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: branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16844&path=/branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertiespalette_xyz.cpp Mon Sep 19 06:42:02 2011
@@ -546,7 +546,6 @@
 		return;
 	bool tmp = m_haveItem;
 	m_haveItem = false;
-	double oldRatio = m_unitRatio;
 	m_unitRatio = m_doc->unitRatio();
 	m_unitIndex = m_doc->unitIndex();
 	xposSpin->setNewUnit( m_unitIndex );

Modified: branches/ScribusOIF/scribus/ui/propertywidget_advanced.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16844&path=/branches/ScribusOIF/scribus/ui/propertywidget_advanced.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertywidget_advanced.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertywidget_advanced.cpp Mon Sep 19 06:42:02 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: branches/ScribusOIF/scribus/ui/propertywidget_distance.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16844&path=/branches/ScribusOIF/scribus/ui/propertywidget_distance.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertywidget_distance.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertywidget_distance.cpp Mon Sep 19 06:42:02 2011
@@ -83,7 +83,6 @@
 	if (!m_doc)
 		return;
 
-	double oldRatio = m_unitRatio;
 	m_unitRatio = m_doc->unitRatio();
 	m_unitIndex = m_doc->unitIndex();
 

Modified: branches/ScribusOIF/scribus/ui/propertywidget_pathtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16844&path=/branches/ScribusOIF/scribus/ui/propertywidget_pathtext.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertywidget_pathtext.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertywidget_pathtext.cpp Mon Sep 19 06:42:02 2011
@@ -64,7 +64,6 @@
 	if (!m_doc)
 		return;
 
-	double oldRatio = m_unitRatio;
 	m_unitRatio = m_doc->unitRatio();
 	m_unitIndex = m_doc->unitIndex();
 

Modified: branches/ScribusOIF/scribus/ui/propertywidget_textcolor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16844&path=/branches/ScribusOIF/scribus/ui/propertywidget_textcolor.cpp
==============================================================================
--- branches/ScribusOIF/scribus/ui/propertywidget_textcolor.cpp (original)
+++ branches/ScribusOIF/scribus/ui/propertywidget_textcolor.cpp Mon Sep 19 06:42:02 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();
 	}

Modified: branches/ScribusOIF/scribus/units.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16844&path=/branches/ScribusOIF/scribus/units.cpp
==============================================================================
--- branches/ScribusOIF/scribus/units.cpp (original)
+++ branches/ScribusOIF/scribus/units.cpp Mon Sep 19 06:42:02 2011
@@ -19,6 +19,7 @@
  *                                                                         *
  ***************************************************************************/
 
+#include <cmath>
 #include <QString>
 #include <QObject>
 #include "units.h"
@@ -364,12 +365,26 @@
 QString value2String(double unitValue, int unitIndex, bool round2Precision, bool appendSuffix)
 {
 	QString s;
-	if (round2Precision)
-		s=QString::number(pts2value(unitValue, unitIndex), 'f', unitGetPrecisionFromIndex(unitIndex));
+
+	if (unitIndex==SC_PICAS)
+	{
+		int a=(static_cast<int>(unitValue))/12;
+		double b=fabs(fmod(unitValue, 12));
+		QString prefix((a==0 && unitValue < 0.0) ? "-" : "");
+//		if (round2Precision)
+//			s=QString("%1%2%3%4").arg(prefix).arg(a).arg(unitGetStrFromIndex(unitIndex)).arg(QString::number(b, 'f', unitGetPrecisionFromIndex(unitIndex)));
+//		else
+			s=QString("%1%2%3%4").arg(prefix).arg(a).arg(unitGetStrFromIndex(unitIndex)).arg(b);
+	}
 	else
-		s=QString::number(pts2value(unitValue, unitIndex));
-	if (appendSuffix)
-		s += " "+unitGetStrFromIndex(unitIndex);
+	{
+		if (round2Precision)
+			s=QString::number(pts2value(unitValue, unitIndex), 'f', unitGetPrecisionFromIndex(unitIndex));
+		else
+			s=QString::number(pts2value(unitValue, unitIndex));
+		if (appendSuffix)
+			s += " "+unitGetStrFromIndex(unitIndex);
+	}
 	return s;
 }
 




More information about the scribus-commit mailing list