r16808 by jghali - #10152 related : correctly select style of current paragraph when clicking story editor sidebar

scribus-commit scribus-commit at lists.scribus.net
Sat Aug 27 21:50:21 UTC 2011


Author: jghali
Date: Sat Aug 27 21:50:20 2011
New Revision: 16808

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16808
Log:
#10152 related : correctly select style of current paragraph when clicking story editor sidebar

Modified:
    branches/Version135/Scribus/scribus/storyeditor.cpp

Modified: branches/Version135/Scribus/scribus/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16808&path=/branches/Version135/Scribus/scribus/storyeditor.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/storyeditor.cpp (original)
+++ branches/Version135/Scribus/scribus/storyeditor.cpp Sat Aug 27 21:50:20 2011
@@ -124,20 +124,18 @@
 	QPoint viewPos   = editor->viewport()->mapFromGlobal(globalPos);
 	int p = editor->cursorForPosition(QPoint(2, viewPos.y())).position();
 	CurrentPar = editor->StyledText.nrOfParagraph(p);
-	int pos = editor->StyledText.startOfParagraph(p);
-
+	int pos = editor->StyledText.startOfParagraph( editor->StyledText.nrOfParagraph(p) );
+
+	QString styleName = "";
 	ParaStyleComboBox* paraStyleCombo = new ParaStyleComboBox(this);
 	paraStyleCombo->setDoc(editor->doc);
 	if ((CurrentPar < static_cast<int>(editor->StyledText.nrOfParagraphs())) && (editor->StyledText.length() != 0))
 	{
 		int len = editor->StyledText.endOfParagraph(CurrentPar) - editor->StyledText.startOfParagraph(CurrentPar);
 		if (len > 0)
-			paraStyleCombo->setFormat(editor->StyledText.paragraphStyle(pos).displayName());
-		else
-			paraStyleCombo->setFormat("");
-	}
-	else
-		paraStyleCombo->setFormat("");
+			styleName = editor->StyledText.paragraphStyle(pos).parent(); //FIXME ParaStyleComboBox and use localized style name
+	}
+	paraStyleCombo->setFormat(styleName);
 	connect(paraStyleCombo, SIGNAL(newStyle(const QString&)), this, SLOT(setPStyle(const QString&)));
 	pmen->clear();
 	paraStyleAct = new QWidgetAction(this);
@@ -2463,7 +2461,7 @@
 	}
 	int parStart = Editor->StyledText.startOfParagraph(p);
 	const ParagraphStyle& parStyle(Editor->StyledText.paragraphStyle(parStart));
-	Editor->currentParaStyle = parStyle.parent();
+	Editor->currentParaStyle = parStyle.parent(); //FIXME ParaStyleComboBox and use localized style name
 	if (Editor->StyledText.endOfParagraph(p) <= parStart)
 	{
 		Editor->prevFont = Editor->CurrFont;




More information about the scribus-commit mailing list