View Issue Details

IDProjectCategoryView StatusLast Update
0005609ScribusStory Editor / Text Framespublic2014-10-24 23:00
Reportermkoren Assigned Tosubik  
PrioritynormalSeverityminorReproducibilityalways
Status feedbackResolutionopen 
Platformx86OSDebian LinuxOS VersionSarge/Etch
Product Version1.3.3.8 
Summary0005609: Story Editor does not display correct properties on first open [patch]
DescriptionOne more story editor patch for a long-standing issue. When first opening the SE, the style and properties displayed in the toolbars, and applied to any text typed right away, are always the defaults from the frame, not the values from the applicable style or the current text.

Moving the cursor with the arrow keys back and forth causes it to refresh to the correct values.

With the patch, it now

a) if there is no text, uses the values taken from the frame's default style, if one is set, rather than from the frame itself (don't ask me why these can be different anyway, but an empty parargaph in this style is created, so the style's attributes should apply); or

b) if a paragraph exists, takes the properties from that, although I just used a simple hack to make that work.
TagsNo tags attached.
PatchYes

Activities

2007-04-29 21:17

 

story.cpp.patch7_storyinit.1338.diff (3,016 bytes)   
--- story.cpp	2007-04-29 14:54:45.000000000 -0500
+++ story.cpp.storyinit.cpp	2007-04-29 14:55:08.000000000 -0500
@@ -2789,11 +2789,15 @@
 		{
 			Editor->currentParaStyle = currItem->textAlignment;
 			//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);
-			QString b = currItem->TxtFill;
+			//Added test to initialize values from style instead of frame when appropriate
+			if ((Editor->currentParaStyle > 4) && (!currDoc->docParagraphStyles[Editor->currentParaStyle].Font.isEmpty()))
+				setEditorPropsFromStyle();
+			else
+				setEditorPropsFromFrame();
+			//Draw these from editor rather than frame to catch both cases above - taken from below
+			StrokeTools->SetShade(Editor->CurrTextStrokeSh);
+			FillTools->SetShade(Editor->CurrTextFillSh);
+			QString b = Editor->CurrTextFill;
 			if ((b != CommonStrings::None) && (!b.isEmpty()))
 			{
 				c++;
@@ -2806,7 +2810,7 @@
 			}
 			FillTools->SetColor(c);
 			c = 0;
-			b = currItem->TxtStroke;
+			b = Editor->CurrTextStroke;
 			if ((b != CommonStrings::None) && (!b.isEmpty()))
 			{
 				c++;
@@ -2818,17 +2822,17 @@
 				}
 			}
 			StrokeTools->SetColor(c);
-			AlignTools->SetAlign(currItem->textAlignment);
-			StyleTools->SetKern(currItem->ExtraV);
-			StyleTools->SetStyle(currItem->TxTStyle);
-			StyleTools->SetShadow(currItem->TxtShadowX, currItem->TxtShadowY);
-			StyleTools->setOutline(currItem->TxtOutline);
-			StyleTools->setUnderline(currItem->TxtUnderPos, currItem->TxtUnderWidth);
-			StyleTools->setStrike(currItem->TxtStrikePos, currItem->TxtStrikeWidth);
-			FontTools->SetSize(currItem->fontSize());
-			FontTools->SetFont(currItem->font());
-			FontTools->SetScale(currItem->TxtScale);
-			FontTools->SetScaleV(currItem->TxtScaleV);
+			StyleTools->SetKern(Editor->CurrTextKern);
+			StyleTools->SetStyle(Editor->CurrentStyle);
+			StyleTools->SetShadow(Editor->CurrTextShadowX, Editor->CurrTextShadowY);
+			StyleTools->setOutline(Editor->CurrTextOutline);
+			StyleTools->setUnderline(Editor->CurrTextUnderPos, Editor->CurrTextUnderWidth);
+			StyleTools->setStrike(Editor->CurrTextStrikePos, Editor->CurrTextStrikeWidth);
+			FontTools->SetSize(Editor->CurrFontSize);
+			FontTools->SetFont(Editor->CurrFont);
+			FontTools->SetScale(Editor->CurrTextScale);
+			FontTools->SetScaleV(Editor->CurrTextScaleV);
+			AlignTools->SetAlign(Editor->currentParaStyle);
 		}
 		if (Editor->CurrentStyle & 4)
 		{
@@ -2843,7 +2847,10 @@
 		Editor->setStyle(Editor->CurrentStyle);
 		firstSet = true;
 		updateUnicodeActions();
-		return;
+		//Continue to next part if a paragraph exists - hack to correctly initialize properties from first paragraph
+		if ((p >= static_cast<int>(Editor->StyledText.count())) || (Editor->StyledText.count() == 0))
+			return;
+		c = 0;
 	}
 	chars = Editor->StyledText.at(p);
 	Editor->currentParaStyle = Editor->ParagStyles[p];

mkoren

2007-05-03 00:22

reporter   ~0016086

I forgot to mention that the first lines of this patch call the new methods that I created in my patches for 0005484.

You could do it without them by duplicating the code to set properties from a style yet again, but that's the code that was incomplete and needed updating for that bug, so then it would have needed fixing in one more place (which is why I made the new methods in the first place... :).

subik

2008-04-05 18:11

manager   ~0019374

at first - I do appologise for long delay of this issue. I forgot it simply.

Can you review this against 1.3.3.x svn tree once more, please?

Issue History

Date Modified Username Field Change
2007-04-29 21:17 mkoren New Issue
2007-04-29 21:17 mkoren File Added: story.cpp.patch7_storyinit.1338.diff
2007-04-30 06:05 subik Status new => assigned
2007-04-30 06:05 subik Assigned To => subik
2007-05-03 00:22 mkoren Note Added: 0016086
2008-04-05 18:11 subik Note Added: 0019374
2008-04-05 18:11 subik Status assigned => feedback
2014-10-24 23:00 Kunda Patch => Yes
2015-09-17 20:08 Kunda Category Story Editor / Text Frames => Story Ed/Txt Frames
2015-09-17 20:12 Kunda Category Story Ed/Txt Frames => Story Editor / Text Frames