r16806 by jghali - #10222: current paragraph style not displayed in story editor (+ some refactoring)

scribus-commit scribus-commit at lists.scribus.net
Sat Aug 27 20:18:33 UTC 2011


Author: jghali
Date: Sat Aug 27 20:18:33 2011
New Revision: 16806

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16806
Log:
#10222: current paragraph style not displayed in story editor (+ some refactoring)

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

Modified: branches/Version135/Scribus/scribus/search.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16806&path=/branches/Version135/Scribus/scribus/search.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/search.cpp (original)
+++ branches/Version135/Scribus/scribus/search.cpp Sat Aug 27 20:18:33 2011
@@ -759,7 +759,7 @@
 				se->Editor->textCursor().setPosition(SelStart);
 				se->Editor->textCursor().setPosition(SelEnd, QTextCursor::KeepAnchor);
 				se->Editor->textCursor().removeSelectedText();
-//FIXME				se->Editor->setStyle(se->Editor->CurrentStyle);
+//FIXME				se->Editor->setEffects(se->Editor->CurrentEffects);
 				QString newText = RTextVal->text();
 				se->Editor->insertPlainText(newText);
 				if (newText.length() > 0)

Modified: branches/Version135/Scribus/scribus/storyeditor.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16806&path=/branches/Version135/Scribus/scribus/storyeditor.cpp
==============================================================================
--- branches/Version135/Scribus/scribus/storyeditor.cpp (original)
+++ branches/Version135/Scribus/scribus/storyeditor.cpp Sat Aug 27 20:18:33 2011
@@ -679,7 +679,7 @@
 	int cSty = StyledText.charStyle(position).effects();
 	int pAli = StyledText.paragraphStyle(position).alignment();
 	setAlign(pAli);
-	setStyle(cSty);
+	setEffects(cSty);
 	for (int pos = position; pos < end; ++pos)
 	{
 		const CharStyle& cstyle(StyledText.charStyle(pos));
@@ -690,7 +690,7 @@
 			const ParagraphStyle& pstyle(StyledText.paragraphStyle(pos));
 			pAli = pstyle.alignment();
 			setAlign(pAli);
-			setStyle(cSty);
+			setEffects(cSty);
 			insertPlainText(text);
 			cSty = cstyle.effects();
 			text = "";
@@ -707,7 +707,7 @@
 				ch == SpecialChars::LINEBREAK)
 		{
 			setAlign(pAli);
-			setStyle(cSty);
+			setEffects(cSty);
 			insertPlainText(text);
 			cSty = cstyle.effects();
 			text = "";
@@ -768,7 +768,7 @@
 		const ParagraphStyle& pstyle(StyledText.paragraphStyle(end - 1));
 		setAlign(pstyle.alignment());
 	}
-	setStyle(cSty);
+	setEffects(cSty);
 	insertPlainText(text);
 	QTextCursor tCursor = textCursor();
 	tCursor.setPosition(cursorPos);
@@ -803,7 +803,7 @@
 		{
 			textCursor().setPosition(SelStart);
 			textCursor().setPosition(SelEnd, QTextCursor::KeepAnchor);
-			setStyle(Csty);
+			setEffects(Csty);
 			textCursor().clearSelection();
 			Csty = StyledText.charStyle(a).effects();
 			SelStart = SelEnd;
@@ -812,7 +812,7 @@
 	}
 	textCursor().setPosition(SelStart);
 	textCursor().setPosition(SelEnd, QTextCursor::KeepAnchor);
-	setStyle(Csty);
+	setEffects(Csty);
 	textCursor().clearSelection();
 	setAlign(StyledText.paragraphStyle(start).alignment());
 	setUpdatesEnabled(true);
@@ -867,7 +867,7 @@
 	StoredSel = false;
 }
 
-void SEditor::setStyle(int Csty)
+void SEditor::setEffects(int Csty)
 {
 	++blockContentsChangeHook;
 	QTextCharFormat charF;
@@ -2260,11 +2260,11 @@
 
 void StoryEditor::newTxStyle(int s)
 {
-	Editor->CurrentStyle = static_cast<StyleFlag>(s);
+	Editor->CurrentEffects = static_cast<StyleFlag>(s);
 	CharStyle charStyle;
-	charStyle.setFeatures(Editor->CurrentStyle.featureList());
+	charStyle.setFeatures(Editor->CurrentEffects.featureList());
 	Editor->updateSel(charStyle);
-	Editor->setStyle(s);
+	Editor->setEffects(s);
 	if ((s & ScStyle_Outline) || (s & ScStyle_Shadowed))
 	{
 		StrokeTools->TxStroke->setEnabled(true);
@@ -2384,6 +2384,7 @@
 		{
 			const CharStyle& curstyle(pos < Editor->StyledText.length()? currItem->itemText.charStyle(pos) : currItem->itemText.defaultStyle().charStyle());
 			const ParagraphStyle parStyle(pos < Editor->StyledText.length()? currItem->itemText.paragraphStyle(pos) : currItem->itemText.defaultStyle());
+			Editor->currentParaStyle = parStyle.parent();
 			Editor->CurrAlign = parStyle.alignment();
 			Editor->CurrTextFill = curstyle.fillColor();
 			Editor->CurrTextFillSh = curstyle.fillShade();
@@ -2391,11 +2392,10 @@
 			Editor->CurrTextStrokeSh = curstyle.strokeShade();
 			Editor->prevFont = Editor->CurrFont;
 			Editor->CurrFont = curstyle.font().scName();
-			Editor->CurrFontSize = curstyle.fontSize();
-			Editor->CurrentStyle = curstyle.effects();
-			Editor->currentParaStyle = curstyle.parent();
-			Editor->CurrTextKern = curstyle.tracking();
-			Editor->CurrTextScale = curstyle.scaleH();
+			Editor->CurrFontSize   = curstyle.fontSize();
+			Editor->CurrentEffects = curstyle.effects();
+			Editor->CurrTextKern   = curstyle.tracking();
+			Editor->CurrTextScale  = curstyle.scaleH();
 			Editor->CurrTextScaleV = curstyle.scaleV();
 			Editor->CurrTextBase = curstyle.baselineOffset();
 			Editor->CurrTextShadowX = curstyle.shadowXOffset();
@@ -2436,7 +2436,7 @@
 			AlignTools->SetAlign(Editor->CurrAlign);
 			AlignTools->SetParaStyle(Editor->currentParaStyle);
 			StyleTools->SetKern(Editor->CurrTextKern);
-			StyleTools->SetStyle(Editor->CurrentStyle);
+			StyleTools->SetStyle(Editor->CurrentEffects);
 			StyleTools->SetShadow(Editor->CurrTextShadowX, Editor->CurrTextShadowY);
 			StyleTools->setOutline(Editor->CurrTextOutline);
 			StyleTools->setUnderline(Editor->CurrTextUnderPos, Editor->CurrTextUnderWidth);
@@ -2446,7 +2446,7 @@
 			FontTools->SetScale(Editor->CurrTextScale);
 			FontTools->SetScaleV(Editor->CurrTextScaleV);
 		}
-		if ((Editor->CurrentStyle & ScStyle_Outline) || (Editor->CurrentStyle & ScStyle_Shadowed))
+		if ((Editor->CurrentEffects & ScStyle_Outline) || (Editor->CurrentEffects & ScStyle_Shadowed))
 		{
 			StrokeTools->TxStroke->setEnabled(true);
 			StrokeTools->PM1->setEnabled(true);
@@ -2456,21 +2456,21 @@
 			StrokeTools->TxStroke->setEnabled(false);
 			StrokeTools->PM1->setEnabled(false);
 		}
-		Editor->setStyle(Editor->CurrentStyle);
+		Editor->setEffects(Editor->CurrentEffects);
 		firstSet = true;
 		updateUnicodeActions();
 		return;
 	}
 	int parStart = Editor->StyledText.startOfParagraph(p);
 	const ParagraphStyle& parStyle(Editor->StyledText.paragraphStyle(parStart));
-	Editor->currentParaStyle = parStyle.displayName();
+	Editor->currentParaStyle = parStyle.parent();
 	if (Editor->StyledText.endOfParagraph(p) <= parStart)
 	{
 		Editor->prevFont = Editor->CurrFont;
 		Editor->CurrFont = parStyle.charStyle().font().scName();
-		Editor->CurrFontSize = parStyle.charStyle().fontSize();
-		Editor->CurrentStyle = parStyle.charStyle().effects();
-		Editor->CurrTextFill = parStyle.charStyle().fillColor();
+		Editor->CurrFontSize   = parStyle.charStyle().fontSize();
+		Editor->CurrentEffects = parStyle.charStyle().effects();
+		Editor->CurrTextFill   = parStyle.charStyle().fillColor();
 		Editor->CurrTextFillSh = parStyle.charStyle().fillShade();
 		Editor->CurrTextStroke = parStyle.charStyle().strokeColor();
 		Editor->CurrTextStrokeSh = parStyle.charStyle().strokeShade();
@@ -2482,7 +2482,7 @@
 		Editor->CurrTextStrikePos = parStyle.charStyle().strikethruOffset();
 		Editor->CurrTextStrikeWidth = parStyle.charStyle().strikethruWidth();
 		Editor->setAlign(Editor->CurrAlign);
-		Editor->setStyle(Editor->CurrentStyle);
+		Editor->setEffects(Editor->CurrentEffects);
 	}
 	else
 	{
@@ -2514,9 +2514,9 @@
 		Editor->prevFont = Editor->CurrFont;
 		Editor->CurrFont = charStyle.font().scName();
 		Editor->CurrFontSize = charStyle.fontSize();
-		Editor->CurrentStyle = charStyle.effects() & static_cast<StyleFlag>(1919);
-		Editor->CurrTextKern = charStyle.tracking();
-		Editor->CurrTextScale = charStyle.scaleH();
+		Editor->CurrentEffects = charStyle.effects() & static_cast<StyleFlag>(1919);
+		Editor->CurrTextKern   = charStyle.tracking();
+		Editor->CurrTextScale  = charStyle.scaleH();
 		Editor->CurrTextScaleV = charStyle.scaleV();
 		Editor->CurrTextBase = charStyle.baselineOffset();
 		Editor->CurrTextShadowX = charStyle.shadowXOffset();
@@ -2554,7 +2554,7 @@
 		}
 	}
 	StrokeTools->SetColor(c);
-	if ((Editor->CurrentStyle & ScStyle_Outline) || (Editor->CurrentStyle & ScStyle_Shadowed))
+	if ((Editor->CurrentEffects & ScStyle_Outline) || (Editor->CurrentEffects & ScStyle_Shadowed))
 	{
 		StrokeTools->TxStroke->setEnabled(true);
 		StrokeTools->PM1->setEnabled(true);
@@ -2565,7 +2565,7 @@
 		StrokeTools->PM1->setEnabled(false);
 	}
 	StyleTools->SetKern(Editor->CurrTextKern);
-	StyleTools->SetStyle(Editor->CurrentStyle);
+	StyleTools->SetStyle(Editor->CurrentEffects);
 	StyleTools->SetShadow(Editor->CurrTextShadowX, Editor->CurrTextShadowY);
 	StyleTools->setOutline(Editor->CurrTextOutline);
 	StyleTools->setUnderline(Editor->CurrTextUnderPos, Editor->CurrTextUnderWidth);
@@ -2984,8 +2984,8 @@
 		Editor->prevFont = Editor->CurrFont;
 		Editor->CurrFont = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().font().scName();
 		Editor->CurrFontSize = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().fontSize();
-		Editor->CurrentStyle = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().effects();
-		Editor->CurrTextFill = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().fillColor();
+		Editor->CurrentEffects = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().effects();
+		Editor->CurrTextFill   = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().fillColor();
 		Editor->CurrTextFillSh = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().fillShade();
 		Editor->CurrTextStroke = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().strokeColor();
 		Editor->CurrTextStrokeSh = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().strokeShade();
@@ -2997,8 +2997,8 @@
 		Editor->CurrTextStrikePos = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().strikethruOffset();
 		Editor->CurrTextStrikeWidth = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().strikethruWidth();
 
-		Editor->setStyle(Editor->CurrentStyle);
-		if ((Editor->CurrentStyle & ScStyle_Outline) || (Editor->CurrentStyle & ScStyle_Shadowed))
+		Editor->setEffects(Editor->CurrentEffects);
+		if ((Editor->CurrentEffects & ScStyle_Outline) || (Editor->CurrentEffects & ScStyle_Shadowed))
 		{
 			StrokeTools->TxStroke->setEnabled(true);
 			StrokeTools->PM1->setEnabled(true);
@@ -3072,8 +3072,8 @@
 		Editor->prevFont = Editor->CurrFont;
 		Editor->CurrFont = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().font().scName();
 		Editor->CurrFontSize = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().fontSize();
-		Editor->CurrentStyle = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().effects();
-		Editor->CurrTextFill = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().fillColor();
+		Editor->CurrentEffects = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().effects();
+		Editor->CurrTextFill   = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().fillColor();
 		Editor->CurrTextFillSh = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().fillShade();
 		Editor->CurrTextStroke = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().strokeColor();
 		Editor->CurrTextStrokeSh = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().strokeShade();
@@ -3085,8 +3085,8 @@
 		Editor->CurrTextStrikePos = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().strikethruOffset();
 		Editor->CurrTextStrikeWidth = currDoc->paragraphStyles().get(Editor->currentParaStyle).charStyle().strikethruWidth();
 
-		Editor->setStyle(Editor->CurrentStyle);
-		if ((Editor->CurrentStyle & ScStyle_Outline) || (Editor->CurrentStyle & ScStyle_Shadowed))
+		Editor->setEffects(Editor->CurrentEffects);
+		if ((Editor->CurrentEffects & ScStyle_Outline) || (Editor->CurrentEffects & ScStyle_Shadowed))
 		{
 			StrokeTools->TxStroke->setEnabled(true);
 			StrokeTools->PM1->setEnabled(true);

Modified: branches/Version135/Scribus/scribus/storyeditor.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16806&path=/branches/Version135/Scribus/scribus/storyeditor.h
==============================================================================
--- branches/Version135/Scribus/scribus/storyeditor.h (original)
+++ branches/Version135/Scribus/scribus/storyeditor.h Sat Aug 27 20:18:33 2011
@@ -93,7 +93,7 @@
 	void updateSel(const CharStyle& style);
 	void updateSel(const ParagraphStyle& style);
 	void deleteSel();
-	void setStyle(int Csty);
+	void setEffects(int Csty);
 	void setColor(bool marker);
 
 	void insertChars(const QString& text);
@@ -106,7 +106,7 @@
 	bool wasMod;
 	bool ready;
 	int unicodeInputCount;
-	StyleFlag CurrentStyle;
+	StyleFlag CurrentEffects;
 	QString currentParaStyle;
 	int CurrAlign;
 	double CurrFontSize;




More information about the scribus-commit mailing list