View Issue Details

IDProjectCategoryView StatusLast Update
0005484ScribusStylespublic2007-04-26 00:55
Reportermkoren Assigned To 
PrioritynormalSeveritymajorReproducibilityalways
Status newResolutionopen 
Platformx86OSDebian LinuxOS VersionSarge/Etch
Product Version1.3.3.8 
Summary0005484: baseline offset and other new text attributes in parstyles are not applied from SE or text importer
DescriptionApplying a paragraph style via the SE or get text plugin does not apply baseline offset, tracking, or character scaling values from the style.

Only applying the style manually from the PP seems to work, making these attributes nearly useless in styles for long texts.

[Workaround: Creating and applying the style without these attributes, then editing the style to contain them later seems to work, though I wish I had noticed that a few weeks ago.... :( ]
Steps To ReproduceCreate a parstyle with a baseline offset.
Text frame->enter some text.
SE->apply the style->exit.
Enter text edit mode on canvas and observe from PP that offset is 0 (wrong).
Reapply style from PP and note offset is now ok for that paragraph.
Additional InformationThe SE, PP, etc. all seem to have their own way of applying styles, and dealing with text attribues in general. Will this be unified in the future? How much work would it be to group all the attributes in one struct or class used by all objects that need them, even in 133x, to avoid more problems like this? I could try if there's not a major snag I'm missing....

------

Looking in story.cpp, at least the following look suspicious:

* SEditor::updateProps() - in "if (Editor->currentParaStyle > 4)" block - fails to set

   Editor->CurrTextKern
   Editor->CurrTextScale
   Editor->CurrTextScaleV
   Editor->CurrTextBase

* StoryEditor::changeAlignSB() and changeAlign() - missing the same kind of thing in the "chars->at(s)" stuff (?), plus same as above in the toplevel else blocks
TagsNo tags attached.
Patch

Activities

mkoren

2007-03-25 21:42

reporter   ~0015618

I guess a better approach, if this were to be cleaned up for the stable series, would be to leave the attributes alone but define a struct (or use PtiSmall) that can be used by getter and setter methods in each relevant class.

That way the existing methods that set a single attribute can be left alone, but all the blocks of

   Editor->CurrTextKern = currItem->ExtraV;

type lines can be replaced by a single

   Editor.setAttributes(currItem.getAttributes);

I can try this next week on my spring break if you want.... :)

avox

2007-03-26 13:16

updater   ~0015624

This has been done in 1.3.4 and I doubt we'll do the same again for 1.3.3.8.

1.3.3.x is a stable release which will only take small fixes, no large refactoring.

mkoren

2007-04-26 00:50

reporter   ~0016013

I split off the text importer part to 0005595, and the story editor part seems to be a duplicate of 0002436, but here's a set of patches to fix it in 1.3.3.8. They fix the problem of not setting these attributes when applying a style, as well as a similar problem updating the current attributes when scrolling to an empty styled paragraph.

I didn't refactor across classes, but I moved all the common style-setting code blocks to separate methods in the StoryEditor class so it was possible to clearly see what needed fixing and only fix it once. This also makes it easier to read the code, and will make it easier to fix at least one additional bug I want to fix.

I split the fix into three patches so it's clearer to see that the behavior didn't change except for the bugfix. The first just moves a loop inside an if/else block to make the next part work. The second consolidates all the style-setting code into separate methods, and the third is the actual fix to three of those methods that needed it.

Is this acceptable? I tried it and it works here.

2007-04-26 00:51

 

story.cpp.patch2_loopinvert.1338.diff (5,369 bytes)   
--- story.cpp	2007-04-23 16:18:26.000000000 -0500
+++ story.cpp.loopinvert.cpp	2007-04-24 16:27:23.000000000 -0500
@@ -3346,9 +3346,9 @@
 		if (Editor->StyledText.at(pa)->count() > 0)
 		{
 			chars = Editor->StyledText.at(pa);
-			for (uint s = 0; s < chars->count(); ++s)
+			if (Editor->currentParaStyle > 4)
 			{
-				if (Editor->currentParaStyle > 4)
+				for (uint s = 0; s < chars->count(); ++s)
 				{
 					if (!currDoc->docParagraphStyles[Editor->currentParaStyle].Font.isEmpty())
 					{
@@ -3368,26 +3368,33 @@
 						chars->at(s)->cstrikepos = currDoc->docParagraphStyles[Editor->currentParaStyle].txtStrikePos;
 						chars->at(s)->cstrikewidth = currDoc->docParagraphStyles[Editor->currentParaStyle].txtStrikeWidth;
 					}
+					chars->at(s)->cab = Editor->currentParaStyle;
 				}
-				if ((Editor->currentParaStyle < 5) && (chars->at(s)->cab > 4))
+			}
+			else
+			{
+				for (uint s = 0; s < chars->count(); ++s)
 				{
-					chars->at(s)->ccolor = currItem->TxtFill;
-					chars->at(s)->cshade = currItem->ShTxtFill;
-					chars->at(s)->cstroke = currItem->TxtStroke;
-					chars->at(s)->cshade2 = currItem->ShTxtStroke;
-					chars->at(s)->cfont = currItem->font();
-					chars->at(s)->csize = currItem->fontSize();
-					chars->at(s)->cstyle &= ~1919;
-					chars->at(s)->cstyle |= currItem->TxTStyle;
-					chars->at(s)->cshadowx = currItem->TxtShadowX;
-					chars->at(s)->cshadowy = currItem->TxtShadowY;
-					chars->at(s)->coutline = currItem->TxtOutline;
-					chars->at(s)->cunderpos = currItem->TxtUnderPos;
-					chars->at(s)->cunderwidth = currItem->TxtUnderWidth;
-					chars->at(s)->cstrikepos = currItem->TxtStrikePos;
-					chars->at(s)->cstrikewidth = currItem->TxtStrikeWidth;
+					if (chars->at(s)->cab > 4)
+					{
+						chars->at(s)->ccolor = currItem->TxtFill;
+						chars->at(s)->cshade = currItem->ShTxtFill;
+						chars->at(s)->cstroke = currItem->TxtStroke;
+						chars->at(s)->cshade2 = currItem->ShTxtStroke;
+						chars->at(s)->cfont = currItem->font();
+						chars->at(s)->csize = currItem->fontSize();
+						chars->at(s)->cstyle &= ~1919;
+						chars->at(s)->cstyle |= currItem->TxTStyle;
+						chars->at(s)->cshadowx = currItem->TxtShadowX;
+						chars->at(s)->cshadowy = currItem->TxtShadowY;
+						chars->at(s)->coutline = currItem->TxtOutline;
+						chars->at(s)->cunderpos = currItem->TxtUnderPos;
+						chars->at(s)->cunderwidth = currItem->TxtUnderWidth;
+						chars->at(s)->cstrikepos = currItem->TxtStrikePos;
+						chars->at(s)->cstrikewidth = currItem->TxtStrikeWidth;
+					}
+					chars->at(s)->cab = Editor->currentParaStyle;
 				}
-				chars->at(s)->cab = Editor->currentParaStyle;
 			}
 			Editor->updateFromChars(pa);
 		}
@@ -3498,9 +3505,9 @@
 			if (Editor->StyledText.at(pa)->count() > 0)
 			{
 				chars = Editor->StyledText.at(pa);
-				for (uint s = 0; s < chars->count(); ++s)
+				if (Editor->currentParaStyle > 4)
 				{
-					if (Editor->currentParaStyle > 4)
+					for (uint s = 0; s < chars->count(); ++s)
 					{
 						if (!currDoc->docParagraphStyles[Editor->currentParaStyle].Font.isEmpty())
 						{
@@ -3520,26 +3527,33 @@
 							chars->at(s)->cstrikepos = currDoc->docParagraphStyles[Editor->currentParaStyle].txtStrikePos;
 							chars->at(s)->cstrikewidth = currDoc->docParagraphStyles[Editor->currentParaStyle].txtStrikeWidth;
 						}
+						chars->at(s)->cab = Editor->currentParaStyle;
 					}
-					if ((Editor->currentParaStyle < 5) && (chars->at(s)->cab > 4))
+				}
+				else
+				{
+					for (uint s = 0; s < chars->count(); ++s)
 					{
-						chars->at(s)->ccolor = currItem->TxtFill;
-						chars->at(s)->cshade = currItem->ShTxtFill;
-						chars->at(s)->cstroke = currItem->TxtStroke;
-						chars->at(s)->cshade2 = currItem->ShTxtStroke;
-						chars->at(s)->cfont = currItem->font();
-						chars->at(s)->csize = currItem->fontSize();
-						chars->at(s)->cstyle &= ~1919;
-						chars->at(s)->cstyle |= currItem->TxTStyle;
-						chars->at(s)->cshadowx = currItem->TxtShadowX;
-						chars->at(s)->cshadowy = currItem->TxtShadowY;
-						chars->at(s)->coutline = currItem->TxtOutline;
-						chars->at(s)->cunderpos = currItem->TxtUnderPos;
-						chars->at(s)->cunderwidth = currItem->TxtUnderWidth;
-						chars->at(s)->cstrikepos = currItem->TxtStrikePos;
-						chars->at(s)->cstrikewidth = currItem->TxtStrikeWidth;
+						if (chars->at(s)->cab > 4)
+						{
+							chars->at(s)->ccolor = currItem->TxtFill;
+							chars->at(s)->cshade = currItem->ShTxtFill;
+							chars->at(s)->cstroke = currItem->TxtStroke;
+							chars->at(s)->cshade2 = currItem->ShTxtStroke;
+							chars->at(s)->cfont = currItem->font();
+							chars->at(s)->csize = currItem->fontSize();
+							chars->at(s)->cstyle &= ~1919;
+							chars->at(s)->cstyle |= currItem->TxTStyle;
+							chars->at(s)->cshadowx = currItem->TxtShadowX;
+							chars->at(s)->cshadowy = currItem->TxtShadowY;
+							chars->at(s)->coutline = currItem->TxtOutline;
+							chars->at(s)->cunderpos = currItem->TxtUnderPos;
+							chars->at(s)->cunderwidth = currItem->TxtUnderWidth;
+							chars->at(s)->cstrikepos = currItem->TxtStrikePos;
+							chars->at(s)->cstrikewidth = currItem->TxtStrikeWidth;
+						}
+						chars->at(s)->cab = Editor->currentParaStyle;
 					}
-					chars->at(s)->cab = Editor->currentParaStyle;
 				}
 			Editor->updateFromChars(pa);
 			}

2007-04-26 00:51

 

story.cpp.patch3_consolidate.1338.diff (23,099 bytes)   
--- story.cpp	2007-04-24 16:27:23.000000000 -0500
+++ story.cpp.consolidate.cpp	2007-04-24 20:27:51.000000000 -0500
@@ -2787,26 +2787,9 @@
 	{
 		if (!firstSet)
 		{
-			Editor->CurrTextFill = currItem->TxtFill;
-			Editor->CurrTextFillSh = currItem->ShTxtFill;
-			Editor->CurrTextStroke = currItem->TxtStroke;
-			Editor->CurrTextStrokeSh = currItem->ShTxtStroke;
-			Editor->prevFont = Editor->CurrFont;
-			Editor->CurrFont = currItem->font();
-			Editor->CurrFontSize = currItem->fontSize();
-			Editor->CurrentStyle = currItem->TxTStyle;
 			Editor->currentParaStyle = currItem->textAlignment;
-			Editor->CurrTextKern = currItem->ExtraV;
-			Editor->CurrTextScale = currItem->TxtScale;
-			Editor->CurrTextScaleV = currItem->TxtScaleV;
-			Editor->CurrTextBase = currItem->TxtBase;
-			Editor->CurrTextShadowX = currItem->TxtShadowX;
-			Editor->CurrTextShadowY = currItem->TxtShadowY;
-			Editor->CurrTextOutline = currItem->TxtOutline;
-			Editor->CurrTextUnderPos = currItem->TxtUnderPos;
-			Editor->CurrTextUnderWidth = currItem->TxtUnderWidth;
-			Editor->CurrTextStrikePos = currItem->TxtStrikePos;
-			Editor->CurrTextStrikeWidth = currItem->TxtStrikeWidth;
+			//Moved to separate method to ensure consistency for #5484 - Michael Koren 2007-4-21
+			setEditorPropsFromFrame();
 			c = 0;
 			StrokeTools->SetShade(currItem->ShTxtStroke);
 			FillTools->SetShade(currItem->ShTxtFill);
@@ -2868,21 +2851,8 @@
 	{
 		if (Editor->currentParaStyle > 4)
 		{
-			Editor->prevFont = Editor->CurrFont;
-			Editor->CurrFont = currDoc->docParagraphStyles[Editor->currentParaStyle].Font;
-			Editor->CurrFontSize = currDoc->docParagraphStyles[Editor->currentParaStyle].FontSize;
-			Editor->CurrentStyle = currDoc->docParagraphStyles[Editor->currentParaStyle].FontEffect;
-			Editor->CurrTextFill = currDoc->docParagraphStyles[Editor->currentParaStyle].FColor;
-			Editor->CurrTextFillSh = currDoc->docParagraphStyles[Editor->currentParaStyle].FShade;
-			Editor->CurrTextStroke = currDoc->docParagraphStyles[Editor->currentParaStyle].SColor;
-			Editor->CurrTextStrokeSh = currDoc->docParagraphStyles[Editor->currentParaStyle].SShade;
-			Editor->CurrTextShadowX = currDoc->docParagraphStyles[Editor->currentParaStyle].txtShadowX;
-			Editor->CurrTextShadowY = currDoc->docParagraphStyles[Editor->currentParaStyle].txtShadowY;
-			Editor->CurrTextOutline = currDoc->docParagraphStyles[Editor->currentParaStyle].txtOutline;
-			Editor->CurrTextUnderPos = currDoc->docParagraphStyles[Editor->currentParaStyle].txtUnderPos;
-			Editor->CurrTextUnderWidth = currDoc->docParagraphStyles[Editor->currentParaStyle].txtUnderWidth;
-			Editor->CurrTextStrikePos = currDoc->docParagraphStyles[Editor->currentParaStyle].txtStrikePos;
-			Editor->CurrTextStrikeWidth = currDoc->docParagraphStyles[Editor->currentParaStyle].txtStrikeWidth;
+			//Moved to separate method to ensure consistency for #5484 - Michael Koren 2007-4-21
+			setEditorPropsFromStyle();
 		}
 		Editor->setAlign(Editor->currentParaStyle);
 		Editor->setStyle(Editor->CurrentStyle);
@@ -2900,25 +2870,8 @@
 		}
 		else
 			hg = chars->at(QMIN(QMAX(ch-1, 0), static_cast<int>(chars->count())-1));
-		Editor->CurrTextFill = hg->ccolor;
-		Editor->CurrTextFillSh = hg->cshade;
-		Editor->CurrTextStroke = hg->cstroke;
-		Editor->CurrTextStrokeSh = hg->cshade2;
-		Editor->prevFont = Editor->CurrFont;
-		Editor->CurrFont = hg->cfont;
-		Editor->CurrFontSize = hg->csize;
-		Editor->CurrentStyle = hg->cstyle & 1919;
-		Editor->CurrTextKern = hg->cextra;
-		Editor->CurrTextScale = hg->cscale;
-		Editor->CurrTextScaleV = hg->cscalev;
-		Editor->CurrTextBase = hg->cbase;
-		Editor->CurrTextShadowX = hg->cshadowx;
-		Editor->CurrTextShadowY = hg->cshadowy;
-		Editor->CurrTextOutline = hg->coutline;
-		Editor->CurrTextUnderPos = hg->cunderpos;
-		Editor->CurrTextUnderWidth = hg->cunderwidth;
-		Editor->CurrTextStrikePos = hg->cstrikepos;
-		Editor->CurrTextStrikeWidth = hg->cstrikewidth;
+		//Moved to separate method to ensure consistency for #5484 - Michael Koren 2007-4-21
+		setEditorPropsFromChar(hg);
 	}
 	StrokeTools->SetShade(Editor->CurrTextStrokeSh);
 	FillTools->SetShade(Editor->CurrTextFillSh);
@@ -3341,60 +3294,20 @@
 		//Disconnect these too as they otherwise run for every character - Michael Koren #5577
 		disconnect(Editor, SIGNAL(textChanged()), this, SLOT(modifiedText()));
 		disconnect(Editor, SIGNAL(textChanged()), EditorBar, SLOT(doRepaint()));
-		SEditor::ChList *chars;
+		//SEditor::ChList *chars;
 		(*Editor->ParagStyles.at(pa)) = Editor->currentParaStyle;
 		if (Editor->StyledText.at(pa)->count() > 0)
 		{
-			chars = Editor->StyledText.at(pa);
+			//chars = Editor->StyledText.at(pa);
 			if (Editor->currentParaStyle > 4)
 			{
-				for (uint s = 0; s < chars->count(); ++s)
-				{
-					if (!currDoc->docParagraphStyles[Editor->currentParaStyle].Font.isEmpty())
-					{
-						chars->at(s)->cfont = currDoc->docParagraphStyles[Editor->currentParaStyle].Font;
-						chars->at(s)->csize = currDoc->docParagraphStyles[Editor->currentParaStyle].FontSize;
-						chars->at(s)->cstyle &= ~1919;
-						chars->at(s)->cstyle |= currDoc->docParagraphStyles[Editor->currentParaStyle].FontEffect;
-						chars->at(s)->ccolor = currDoc->docParagraphStyles[Editor->currentParaStyle].FColor;
-						chars->at(s)->cshade = currDoc->docParagraphStyles[Editor->currentParaStyle].FShade;
-						chars->at(s)->cstroke = currDoc->docParagraphStyles[Editor->currentParaStyle].SColor;
-						chars->at(s)->cshade2 = currDoc->docParagraphStyles[Editor->currentParaStyle].SShade;
-						chars->at(s)->cshadowx = currDoc->docParagraphStyles[Editor->currentParaStyle].txtShadowX;
-						chars->at(s)->cshadowy = currDoc->docParagraphStyles[Editor->currentParaStyle].txtShadowY;
-						chars->at(s)->coutline = currDoc->docParagraphStyles[Editor->currentParaStyle].txtOutline;
-						chars->at(s)->cunderpos = currDoc->docParagraphStyles[Editor->currentParaStyle].txtUnderPos;
-						chars->at(s)->cunderwidth = currDoc->docParagraphStyles[Editor->currentParaStyle].txtUnderWidth;
-						chars->at(s)->cstrikepos = currDoc->docParagraphStyles[Editor->currentParaStyle].txtStrikePos;
-						chars->at(s)->cstrikewidth = currDoc->docParagraphStyles[Editor->currentParaStyle].txtStrikeWidth;
-					}
-					chars->at(s)->cab = Editor->currentParaStyle;
-				}
+				//Moved to separate method to ensure consistency for #5484 - Michael Koren 2007-4-21
+				setParPropsFromStyle(pa);
 			}
 			else
 			{
-				for (uint s = 0; s < chars->count(); ++s)
-				{
-					if (chars->at(s)->cab > 4)
-					{
-						chars->at(s)->ccolor = currItem->TxtFill;
-						chars->at(s)->cshade = currItem->ShTxtFill;
-						chars->at(s)->cstroke = currItem->TxtStroke;
-						chars->at(s)->cshade2 = currItem->ShTxtStroke;
-						chars->at(s)->cfont = currItem->font();
-						chars->at(s)->csize = currItem->fontSize();
-						chars->at(s)->cstyle &= ~1919;
-						chars->at(s)->cstyle |= currItem->TxTStyle;
-						chars->at(s)->cshadowx = currItem->TxtShadowX;
-						chars->at(s)->cshadowy = currItem->TxtShadowY;
-						chars->at(s)->coutline = currItem->TxtOutline;
-						chars->at(s)->cunderpos = currItem->TxtUnderPos;
-						chars->at(s)->cunderwidth = currItem->TxtUnderWidth;
-						chars->at(s)->cstrikepos = currItem->TxtStrikePos;
-						chars->at(s)->cstrikewidth = currItem->TxtStrikeWidth;
-					}
-					chars->at(s)->cab = Editor->currentParaStyle;
-				}
+				//Moved to separate method to ensure consistency for #5484 - Michael Koren 2007-4-21
+				setParPropsFromFrame(pa);
 			}
 			Editor->updateFromChars(pa);
 		}
@@ -3413,44 +3326,14 @@
 		{
 			if (!currDoc->docParagraphStyles[Editor->currentParaStyle].Font.isEmpty())
 			{
-				Editor->prevFont = Editor->CurrFont;
-				Editor->CurrFont = currDoc->docParagraphStyles[Editor->currentParaStyle].Font;
-				Editor->CurrFontSize = currDoc->docParagraphStyles[Editor->currentParaStyle].FontSize;
-				Editor->CurrentStyle = currDoc->docParagraphStyles[Editor->currentParaStyle].FontEffect;
-				Editor->CurrTextFill = currDoc->docParagraphStyles[Editor->currentParaStyle].FColor;
-				Editor->CurrTextFillSh = currDoc->docParagraphStyles[Editor->currentParaStyle].FShade;
-				Editor->CurrTextStroke = currDoc->docParagraphStyles[Editor->currentParaStyle].SColor;
-				Editor->CurrTextStrokeSh = currDoc->docParagraphStyles[Editor->currentParaStyle].SShade;
-				Editor->CurrTextShadowX = currDoc->docParagraphStyles[Editor->currentParaStyle].txtShadowX;
-				Editor->CurrTextShadowY = currDoc->docParagraphStyles[Editor->currentParaStyle].txtShadowY;
-				Editor->CurrTextOutline = currDoc->docParagraphStyles[Editor->currentParaStyle].txtOutline;
-				Editor->CurrTextUnderPos = currDoc->docParagraphStyles[Editor->currentParaStyle].txtUnderPos;
-				Editor->CurrTextUnderWidth = currDoc->docParagraphStyles[Editor->currentParaStyle].txtUnderWidth;
-				Editor->CurrTextStrikePos = currDoc->docParagraphStyles[Editor->currentParaStyle].txtStrikePos;
-				Editor->CurrTextStrikeWidth = currDoc->docParagraphStyles[Editor->currentParaStyle].txtStrikeWidth;
+				//Moved to separate method to ensure consistency for #5484 - Michael Koren 2007-4-21
+				setEditorPropsFromStyle();
 			}
 		}
 		else
 		{
-			Editor->CurrTextFill = currItem->TxtFill;
-			Editor->CurrTextFillSh = currItem->ShTxtFill;
-			Editor->CurrTextStroke = currItem->TxtStroke;
-			Editor->CurrTextStrokeSh = currItem->ShTxtStroke;
-			Editor->prevFont = Editor->CurrFont;
-			Editor->CurrFont = currItem->font();
-			Editor->CurrFontSize = currItem->fontSize();
-			Editor->CurrentStyle = currItem->TxTStyle;
-			Editor->CurrTextKern = currItem->ExtraV;
-			Editor->CurrTextScale = currItem->TxtScale;
-			Editor->CurrTextScaleV = currItem->TxtScaleV;
-			Editor->CurrTextBase = currItem->TxtBase;
-			Editor->CurrTextShadowX = currItem->TxtShadowX;
-			Editor->CurrTextShadowY = currItem->TxtShadowY;
-			Editor->CurrTextOutline = currItem->TxtOutline;
-			Editor->CurrTextUnderPos = currItem->TxtUnderPos;
-			Editor->CurrTextUnderWidth = currItem->TxtUnderWidth;
-			Editor->CurrTextStrikePos = currItem->TxtStrikePos;
-			Editor->CurrTextStrikeWidth = currItem->TxtStrikeWidth;
+			//Moved to separate method to ensure consistency for #5484 - Michael Koren 2007-4-21
+			setEditorPropsFromFrame();
 		}
 		Editor->setStyle(Editor->CurrentStyle);
 		if (Editor->CurrentStyle & 4)
@@ -3484,7 +3367,7 @@
 		disconnect(Editor, SIGNAL(textChanged()), this, SLOT(modifiedText()));
 		disconnect(Editor, SIGNAL(textChanged()), EditorBar, SLOT(doRepaint()));
 		int PStart, PEnd, SelStart, SelEnd, PStart2, PEnd2, SelStart2, SelEnd2;
-		SEditor::ChList *chars;
+		//SEditor::ChList *chars;
 		if (Editor->hasSelectedText())
 		{
 			Editor->getSelection(&PStart, &SelStart, &PEnd, &SelEnd);
@@ -3504,56 +3387,16 @@
 			(*Editor->ParagStyles.at(pa)) = Editor->currentParaStyle;
 			if (Editor->StyledText.at(pa)->count() > 0)
 			{
-				chars = Editor->StyledText.at(pa);
+				//chars = Editor->StyledText.at(pa);
 				if (Editor->currentParaStyle > 4)
 				{
-					for (uint s = 0; s < chars->count(); ++s)
-					{
-						if (!currDoc->docParagraphStyles[Editor->currentParaStyle].Font.isEmpty())
-						{
-							chars->at(s)->cfont = currDoc->docParagraphStyles[Editor->currentParaStyle].Font;
-							chars->at(s)->csize = currDoc->docParagraphStyles[Editor->currentParaStyle].FontSize;
-							chars->at(s)->cstyle &= ~1919;
-							chars->at(s)->cstyle |= currDoc->docParagraphStyles[Editor->currentParaStyle].FontEffect;
-							chars->at(s)->ccolor = currDoc->docParagraphStyles[Editor->currentParaStyle].FColor;
-							chars->at(s)->cshade = currDoc->docParagraphStyles[Editor->currentParaStyle].FShade;
-							chars->at(s)->cstroke = currDoc->docParagraphStyles[Editor->currentParaStyle].SColor;
-							chars->at(s)->cshade2 = currDoc->docParagraphStyles[Editor->currentParaStyle].SShade;
-							chars->at(s)->cshadowx = currDoc->docParagraphStyles[Editor->currentParaStyle].txtShadowX;
-							chars->at(s)->cshadowy = currDoc->docParagraphStyles[Editor->currentParaStyle].txtShadowY;
-							chars->at(s)->coutline = currDoc->docParagraphStyles[Editor->currentParaStyle].txtOutline;
-							chars->at(s)->cunderpos = currDoc->docParagraphStyles[Editor->currentParaStyle].txtUnderPos;
-							chars->at(s)->cunderwidth = currDoc->docParagraphStyles[Editor->currentParaStyle].txtUnderWidth;
-							chars->at(s)->cstrikepos = currDoc->docParagraphStyles[Editor->currentParaStyle].txtStrikePos;
-							chars->at(s)->cstrikewidth = currDoc->docParagraphStyles[Editor->currentParaStyle].txtStrikeWidth;
-						}
-						chars->at(s)->cab = Editor->currentParaStyle;
-					}
+					//Moved to separate method to ensure consistency for #5484 - Michael Koren 2007-4-21
+					setParPropsFromStyle(pa);
 				}
 				else
 				{
-					for (uint s = 0; s < chars->count(); ++s)
-					{
-						if (chars->at(s)->cab > 4)
-						{
-							chars->at(s)->ccolor = currItem->TxtFill;
-							chars->at(s)->cshade = currItem->ShTxtFill;
-							chars->at(s)->cstroke = currItem->TxtStroke;
-							chars->at(s)->cshade2 = currItem->ShTxtStroke;
-							chars->at(s)->cfont = currItem->font();
-							chars->at(s)->csize = currItem->fontSize();
-							chars->at(s)->cstyle &= ~1919;
-							chars->at(s)->cstyle |= currItem->TxTStyle;
-							chars->at(s)->cshadowx = currItem->TxtShadowX;
-							chars->at(s)->cshadowy = currItem->TxtShadowY;
-							chars->at(s)->coutline = currItem->TxtOutline;
-							chars->at(s)->cunderpos = currItem->TxtUnderPos;
-							chars->at(s)->cunderwidth = currItem->TxtUnderWidth;
-							chars->at(s)->cstrikepos = currItem->TxtStrikePos;
-							chars->at(s)->cstrikewidth = currItem->TxtStrikeWidth;
-						}
-						chars->at(s)->cab = Editor->currentParaStyle;
-					}
+					//Moved to separate method to ensure consistency for #5484 - Michael Koren 2007-4-21
+					setParPropsFromFrame(pa);
 				}
 			Editor->updateFromChars(pa);
 			}
@@ -3575,44 +3418,14 @@
 		{
 			if (!currDoc->docParagraphStyles[Editor->currentParaStyle].Font.isEmpty())
 			{
-				Editor->prevFont = Editor->CurrFont;
-				Editor->CurrFont = currDoc->docParagraphStyles[Editor->currentParaStyle].Font;
-				Editor->CurrFontSize = currDoc->docParagraphStyles[Editor->currentParaStyle].FontSize;
-				Editor->CurrentStyle = currDoc->docParagraphStyles[Editor->currentParaStyle].FontEffect;
-				Editor->CurrTextFill = currDoc->docParagraphStyles[Editor->currentParaStyle].FColor;
-				Editor->CurrTextFillSh = currDoc->docParagraphStyles[Editor->currentParaStyle].FShade;
-				Editor->CurrTextStroke = currDoc->docParagraphStyles[Editor->currentParaStyle].SColor;
-				Editor->CurrTextStrokeSh = currDoc->docParagraphStyles[Editor->currentParaStyle].SShade;
-				Editor->CurrTextShadowX = currDoc->docParagraphStyles[Editor->currentParaStyle].txtShadowX;
-				Editor->CurrTextShadowY = currDoc->docParagraphStyles[Editor->currentParaStyle].txtShadowY;
-				Editor->CurrTextOutline = currDoc->docParagraphStyles[Editor->currentParaStyle].txtOutline;
-				Editor->CurrTextUnderPos = currDoc->docParagraphStyles[Editor->currentParaStyle].txtUnderPos;
-				Editor->CurrTextUnderWidth = currDoc->docParagraphStyles[Editor->currentParaStyle].txtUnderWidth;
-				Editor->CurrTextStrikePos = currDoc->docParagraphStyles[Editor->currentParaStyle].txtStrikePos;
-				Editor->CurrTextStrikeWidth = currDoc->docParagraphStyles[Editor->currentParaStyle].txtStrikeWidth;
+				//Moved to separate method to ensure consistency for #5484 - Michael Koren 2007-4-21
+				setEditorPropsFromStyle();
 			}
 		}
 		else
 		{
-			Editor->CurrTextFill = currItem->TxtFill;
-			Editor->CurrTextFillSh = currItem->ShTxtFill;
-			Editor->CurrTextStroke = currItem->TxtStroke;
-			Editor->CurrTextStrokeSh = currItem->ShTxtStroke;
-			Editor->prevFont = Editor->CurrFont;
-			Editor->CurrFont = currItem->font();
-			Editor->CurrFontSize = currItem->fontSize();
-			Editor->CurrentStyle = currItem->TxTStyle;
-			Editor->CurrTextKern = currItem->ExtraV;
-			Editor->CurrTextScale = currItem->TxtScale;
-			Editor->CurrTextScaleV = currItem->TxtScaleV;
-			Editor->CurrTextBase = currItem->TxtBase;
-			Editor->CurrTextShadowX = currItem->TxtShadowX;
-			Editor->CurrTextShadowY = currItem->TxtShadowY;
-			Editor->CurrTextOutline = currItem->TxtOutline;
-			Editor->CurrTextUnderPos = currItem->TxtUnderPos;
-			Editor->CurrTextUnderWidth = currItem->TxtUnderWidth;
-			Editor->CurrTextStrikePos = currItem->TxtStrikePos;
-			Editor->CurrTextStrikeWidth = currItem->TxtStrikeWidth;
+			//Moved to separate method to ensure consistency for #5484 - Michael Koren 2007-4-21
+			setEditorPropsFromFrame();
 		}
 		Editor->setStyle(Editor->CurrentStyle);
 		if (Editor->CurrentStyle & 4)
@@ -3634,6 +3447,132 @@
 	Editor->setFocus();
 }
 
+//Set current text properties to frame defaults
+//Note does not set currentParaStyle
+void StoryEditor::setEditorPropsFromFrame()
+{
+	Editor->CurrTextFill = currItem->TxtFill;
+	Editor->CurrTextFillSh = currItem->ShTxtFill;
+	Editor->CurrTextStroke = currItem->TxtStroke;
+	Editor->CurrTextStrokeSh = currItem->ShTxtStroke;
+	Editor->prevFont = Editor->CurrFont;
+	Editor->CurrFont = currItem->font();
+	Editor->CurrFontSize = currItem->fontSize();
+	Editor->CurrentStyle = currItem->TxTStyle;
+	Editor->CurrTextKern = currItem->ExtraV;
+	Editor->CurrTextScale = currItem->TxtScale;
+	Editor->CurrTextScaleV = currItem->TxtScaleV;
+	Editor->CurrTextBase = currItem->TxtBase;
+	Editor->CurrTextShadowX = currItem->TxtShadowX;
+	Editor->CurrTextShadowY = currItem->TxtShadowY;
+	Editor->CurrTextOutline = currItem->TxtOutline;
+	Editor->CurrTextUnderPos = currItem->TxtUnderPos;
+	Editor->CurrTextUnderWidth = currItem->TxtUnderWidth;
+	Editor->CurrTextStrikePos = currItem->TxtStrikePos;
+	Editor->CurrTextStrikeWidth = currItem->TxtStrikeWidth;
+}
+
+//Set current text properties from current paragraph style
+void StoryEditor::setEditorPropsFromStyle()
+{
+	Editor->prevFont = Editor->CurrFont;
+	Editor->CurrFont = currDoc->docParagraphStyles[Editor->currentParaStyle].Font;
+	Editor->CurrFontSize = currDoc->docParagraphStyles[Editor->currentParaStyle].FontSize;
+	Editor->CurrentStyle = currDoc->docParagraphStyles[Editor->currentParaStyle].FontEffect;
+	Editor->CurrTextFill = currDoc->docParagraphStyles[Editor->currentParaStyle].FColor;
+	Editor->CurrTextFillSh = currDoc->docParagraphStyles[Editor->currentParaStyle].FShade;
+	Editor->CurrTextStroke = currDoc->docParagraphStyles[Editor->currentParaStyle].SColor;
+	Editor->CurrTextStrokeSh = currDoc->docParagraphStyles[Editor->currentParaStyle].SShade;
+	Editor->CurrTextShadowX = currDoc->docParagraphStyles[Editor->currentParaStyle].txtShadowX;
+	Editor->CurrTextShadowY = currDoc->docParagraphStyles[Editor->currentParaStyle].txtShadowY;
+	Editor->CurrTextOutline = currDoc->docParagraphStyles[Editor->currentParaStyle].txtOutline;
+	Editor->CurrTextUnderPos = currDoc->docParagraphStyles[Editor->currentParaStyle].txtUnderPos;
+	Editor->CurrTextUnderWidth = currDoc->docParagraphStyles[Editor->currentParaStyle].txtUnderWidth;
+	Editor->CurrTextStrikePos = currDoc->docParagraphStyles[Editor->currentParaStyle].txtStrikePos;
+	Editor->CurrTextStrikeWidth = currDoc->docParagraphStyles[Editor->currentParaStyle].txtStrikeWidth;
+}
+
+//Set current text properties from a given character
+//Note does not set currentParaStyle
+void StoryEditor::setEditorPropsFromChar(struct PtiSmall *hg)
+{
+	Editor->CurrTextFill = hg->ccolor;
+	Editor->CurrTextFillSh = hg->cshade;
+	Editor->CurrTextStroke = hg->cstroke;
+	Editor->CurrTextStrokeSh = hg->cshade2;
+	Editor->prevFont = Editor->CurrFont;
+	Editor->CurrFont = hg->cfont;
+	Editor->CurrFontSize = hg->csize;
+	Editor->CurrentStyle = hg->cstyle & 1919;
+	Editor->CurrTextKern = hg->cextra;
+	Editor->CurrTextScale = hg->cscale;
+	Editor->CurrTextScaleV = hg->cscalev;
+	Editor->CurrTextBase = hg->cbase;
+	Editor->CurrTextShadowX = hg->cshadowx;
+	Editor->CurrTextShadowY = hg->cshadowy;
+	Editor->CurrTextOutline = hg->coutline;
+	Editor->CurrTextUnderPos = hg->cunderpos;
+	Editor->CurrTextUnderWidth = hg->cunderwidth;
+	Editor->CurrTextStrikePos = hg->cstrikepos;
+	Editor->CurrTextStrikeWidth = hg->cstrikewidth;
+}
+
+//Set text properties of a paragraph to frame defaults or change alignment
+void StoryEditor::setParPropsFromFrame(int pa)
+{
+	SEditor::ChList *chars = Editor->StyledText.at(pa);
+	for (uint s = 0; s < chars->count(); ++s)
+	{
+		if (chars->at(s)->cab > 4)
+		{
+			chars->at(s)->ccolor = currItem->TxtFill;
+			chars->at(s)->cshade = currItem->ShTxtFill;
+			chars->at(s)->cstroke = currItem->TxtStroke;
+			chars->at(s)->cshade2 = currItem->ShTxtStroke;
+			chars->at(s)->cfont = currItem->font();
+			chars->at(s)->csize = currItem->fontSize();
+			chars->at(s)->cstyle &= ~1919;
+			chars->at(s)->cstyle |= currItem->TxTStyle;
+			chars->at(s)->cshadowx = currItem->TxtShadowX;
+			chars->at(s)->cshadowy = currItem->TxtShadowY;
+			chars->at(s)->coutline = currItem->TxtOutline;
+			chars->at(s)->cunderpos = currItem->TxtUnderPos;
+			chars->at(s)->cunderwidth = currItem->TxtUnderWidth;
+			chars->at(s)->cstrikepos = currItem->TxtStrikePos;
+			chars->at(s)->cstrikewidth = currItem->TxtStrikeWidth;
+		}
+		chars->at(s)->cab = Editor->currentParaStyle;
+	}
+}
+
+//Set text properties of a paragraph from current paragraph style
+void StoryEditor::setParPropsFromStyle(int pa)
+{
+	SEditor::ChList *chars = Editor->StyledText.at(pa);
+	for (uint s = 0; s < chars->count(); ++s)
+	{
+		if (!currDoc->docParagraphStyles[Editor->currentParaStyle].Font.isEmpty())
+		{
+			chars->at(s)->cfont = currDoc->docParagraphStyles[Editor->currentParaStyle].Font;
+			chars->at(s)->csize = currDoc->docParagraphStyles[Editor->currentParaStyle].FontSize;
+			chars->at(s)->cstyle &= ~1919;
+			chars->at(s)->cstyle |= currDoc->docParagraphStyles[Editor->currentParaStyle].FontEffect;
+			chars->at(s)->ccolor = currDoc->docParagraphStyles[Editor->currentParaStyle].FColor;
+			chars->at(s)->cshade = currDoc->docParagraphStyles[Editor->currentParaStyle].FShade;
+			chars->at(s)->cstroke = currDoc->docParagraphStyles[Editor->currentParaStyle].SColor;
+			chars->at(s)->cshade2 = currDoc->docParagraphStyles[Editor->currentParaStyle].SShade;
+			chars->at(s)->cshadowx = currDoc->docParagraphStyles[Editor->currentParaStyle].txtShadowX;
+			chars->at(s)->cshadowy = currDoc->docParagraphStyles[Editor->currentParaStyle].txtShadowY;
+			chars->at(s)->coutline = currDoc->docParagraphStyles[Editor->currentParaStyle].txtOutline;
+			chars->at(s)->cunderpos = currDoc->docParagraphStyles[Editor->currentParaStyle].txtUnderPos;
+			chars->at(s)->cunderwidth = currDoc->docParagraphStyles[Editor->currentParaStyle].txtUnderWidth;
+			chars->at(s)->cstrikepos = currDoc->docParagraphStyles[Editor->currentParaStyle].txtStrikePos;
+			chars->at(s)->cstrikewidth = currDoc->docParagraphStyles[Editor->currentParaStyle].txtStrikeWidth;
+		}
+		chars->at(s)->cab = Editor->currentParaStyle;
+	}
+}
+
 void StoryEditor::modifiedText()
 {
 	textChanged = true;

2007-04-26 00:52

 

story.h.consolidate.1338.diff (583 bytes)   
--- story.h	2007-01-26 17:06:08.000000000 -0600
+++ story.h.consolidate.h	2007-04-24 20:10:33.000000000 -0500
@@ -345,6 +345,13 @@
 	PageItem* currentItem() const;
 	ScribusDoc* currentDocument() const;
 
+	//Moved duplicate code to separate methods for consistency for #5484
+	void setEditorPropsFromFrame();
+	void setEditorPropsFromStyle();
+	void setEditorPropsFromChar(struct PtiSmall *hg);
+	void setParPropsFromFrame(int pa);
+	void setParPropsFromStyle(int pa);
+
 	/*! Enables/disables the "smart" selection (#1203) - 10/16/2004 pv */
 	bool smartSelection;
 	int smartSel;

2007-04-26 00:53

 

story.cpp.patch4_attribfix.1338.diff (2,672 bytes)   
--- story.cpp	2007-04-24 20:27:51.000000000 -0500
+++ story.cpp.attribfix	2007-04-25 16:59:00.000000000 -0500
@@ -3483,6 +3483,11 @@
 	Editor->CurrTextFillSh = currDoc->docParagraphStyles[Editor->currentParaStyle].FShade;
 	Editor->CurrTextStroke = currDoc->docParagraphStyles[Editor->currentParaStyle].SColor;
 	Editor->CurrTextStrokeSh = currDoc->docParagraphStyles[Editor->currentParaStyle].SShade;
+	//Added next four for #5484 - paragraph styles have these too - Michael Koren 2007-4-25
+	Editor->CurrTextKern = currDoc->docParagraphStyles[Editor->currentParaStyle].kernVal;
+	Editor->CurrTextScale = currDoc->docParagraphStyles[Editor->currentParaStyle].scaleH;
+	Editor->CurrTextScaleV = currDoc->docParagraphStyles[Editor->currentParaStyle].scaleV;
+	Editor->CurrTextBase = currDoc->docParagraphStyles[Editor->currentParaStyle].baseOff;
 	Editor->CurrTextShadowX = currDoc->docParagraphStyles[Editor->currentParaStyle].txtShadowX;
 	Editor->CurrTextShadowY = currDoc->docParagraphStyles[Editor->currentParaStyle].txtShadowY;
 	Editor->CurrTextOutline = currDoc->docParagraphStyles[Editor->currentParaStyle].txtOutline;
@@ -3533,6 +3538,11 @@
 			chars->at(s)->csize = currItem->fontSize();
 			chars->at(s)->cstyle &= ~1919;
 			chars->at(s)->cstyle |= currItem->TxTStyle;
+			//Added next four for #5484  - Michael Koren 2007-4-25
+			chars->at(s)->cextra = currItem->ExtraV;
+			chars->at(s)->cscale = currItem->TxtScale;
+			chars->at(s)->cscalev = currItem->TxtScaleV;
+			chars->at(s)->cbase = currItem->TxtBase;
 			chars->at(s)->cshadowx = currItem->TxtShadowX;
 			chars->at(s)->cshadowy = currItem->TxtShadowY;
 			chars->at(s)->coutline = currItem->TxtOutline;
@@ -3561,6 +3571,11 @@
 			chars->at(s)->cshade = currDoc->docParagraphStyles[Editor->currentParaStyle].FShade;
 			chars->at(s)->cstroke = currDoc->docParagraphStyles[Editor->currentParaStyle].SColor;
 			chars->at(s)->cshade2 = currDoc->docParagraphStyles[Editor->currentParaStyle].SShade;
+			//Added next four for #5484 - Michael Koren 2007-4-25
+			chars->at(s)->cextra = currDoc->docParagraphStyles[Editor->currentParaStyle].kernVal;
+			chars->at(s)->cscale = currDoc->docParagraphStyles[Editor->currentParaStyle].scaleH;
+			chars->at(s)->cscalev = currDoc->docParagraphStyles[Editor->currentParaStyle].scaleV;
+			chars->at(s)->cbase = currDoc->docParagraphStyles[Editor->currentParaStyle].baseOff;
 			chars->at(s)->cshadowx = currDoc->docParagraphStyles[Editor->currentParaStyle].txtShadowX;
 			chars->at(s)->cshadowy = currDoc->docParagraphStyles[Editor->currentParaStyle].txtShadowY;
 			chars->at(s)->coutline = currDoc->docParagraphStyles[Editor->currentParaStyle].txtOutline;

mkoren

2007-04-26 00:55

reporter   ~0016014

Oh, they all apply against my patch from 0005577. The header file patch goes with the second patch here.

Issue History

Date Modified Username Field Change
2007-03-25 04:23 mkoren New Issue
2007-03-25 21:42 mkoren Note Added: 0015618
2007-03-26 13:16 avox Note Added: 0015624
2007-04-26 00:50 mkoren Note Added: 0016013
2007-04-26 00:51 mkoren File Added: story.cpp.patch2_loopinvert.1338.diff
2007-04-26 00:51 mkoren File Added: story.cpp.patch3_consolidate.1338.diff
2007-04-26 00:52 mkoren File Added: story.h.consolidate.1338.diff
2007-04-26 00:53 mkoren File Added: story.cpp.patch4_attribfix.1338.diff
2007-04-26 00:55 mkoren Note Added: 0016014