View Issue Details

IDProjectCategoryView StatusLast Update
0005603ScribusStory Editor / Text Framespublic2016-09-03 00:45
Reportermkoren Assigned To 
PrioritynormalSeverityminorReproducibilityalways
Status newResolutionopen 
Platformx86OSDebian LinuxOS VersionSarge/Etch
Product Version1.3.3.8 
Summary0005603: "No Style" quirkiness in Story Editor [patch]
DescriptionProperty updating in the story editor for paragraphs with no style isn't consistent with styled paragraphs.

1) Current properties aren't set at all for empty paragraphs with no style, either when changing the style to no style or when scrolling or clicking into them. They keep whatever happened to be the last displayed properties. (Try it and notice the properties in the toolbars don't change.) This makes it hard to know that new text you type is really in the frame's default style.

2) Reselecting "No style" in the style comboboxes doesn't remove custom formatting and restore the defaults like it does for real styles, as fixed by avox in 1.3.4 in 0002091. I included this here because it's similar and fixing it avoided a patch to changeAlignSB otherwise needed for (1).

The patch makes the behavior of no style the same as for real styles in these regards.
Additional InformationThe patch applies against and makes use of my other patches through 0005484.
Tags#please_test
PatchYes

Relationships

related to 0010132 new New Paragraphs Have No Style 

Activities

2007-04-29 00:35

 

story.cpp.patch5_nostylefix.1338.diff (4,430 bytes)   
--- story.cpp	2007-04-25 16:59:00.000000000 -0500
+++ story.cpp.nostylefix	2007-04-28 15:13:32.000000000 -0500
@@ -2434,7 +2434,7 @@
 	connect(Editor, SIGNAL(doubleClicked(int, int)), this, SLOT(doubleClick(int, int)));
 	connect(EditorBar, SIGNAL(ChangeStyle(int, int )), this, SLOT(changeAlignSB(int, int )));
 	connect(EditorBar, SIGNAL(sigEditStyles()), this, SLOT(slotEditStyles()));
-	connect(AlignTools, SIGNAL(newStyle(int)), this, SLOT(newAlign(int)));
+	connect(AlignTools, SIGNAL(newStyle(int)), this, SLOT(newParaStyle(int)));
 	connect(AlignTools, SIGNAL(NewAlign(int)), this, SLOT(newAlign(int)));
 	connect(FillTools, SIGNAL(NewColor(int, int)), this, SLOT(newTxFill(int, int)));
 	connect(StrokeTools, SIGNAL(NewColor(int, int)), this, SLOT(newTxStroke(int, int)));
@@ -2775,7 +2775,7 @@
 	Editor->setFocus();
 }
 
-void StoryEditor::updateProps(int p, int ch)
+void StoryEditor::updateProps(int p, int ch, bool preserveNoStyle)
 {
 	ColorList::Iterator it;
 	int c = 0;
@@ -2854,6 +2854,13 @@
 			//Moved to separate method to ensure consistency for #5484 - Michael Koren 2007-4-21
 			setEditorPropsFromStyle();
 		}
+		//Added to correctly update properties for empty unstyled paragraphs - Michael Koren 2007-4-26
+		//preserveNoStyle is set when changing alignment with no paragraph style to keep properties intact
+		else
+		{
+			if (!preserveNoStyle)
+				setEditorPropsFromFrame();
+		}
 		Editor->setAlign(Editor->currentParaStyle);
 		Editor->setStyle(Editor->CurrentStyle);
 	}
@@ -3284,8 +3291,21 @@
 	changeAlign(st);
 }
 
+//This is called when changing the style from the combobox, as opposed to the alignment buttons
+void StoryEditor::newParaStyle(int st)
+{
+	//If "No Style" was selected get default alignment from frame if there is one
+	if ((st < 5) && (currItem->textAlignment < 5))
+		st = currItem->textAlignment;
+	Editor->currentParaStyle = st;
+	changeAlign(st, true);
+}
+
 void StoryEditor::changeAlignSB(int pa, int align)
 {
+	//If "No Style" was selected get default alignment from frame if there is one
+	if ((align < 5) && (currItem->textAlignment < 5))
+		align = currItem->textAlignment;
 	Editor->currentParaStyle = align;
 	(*Editor->ParagStyles.at(pa)) = Editor->currentParaStyle;
 	if (Editor->StyledText.count() != 0)
@@ -3355,7 +3375,7 @@
 	Editor->setFocus();
 }
 
-void StoryEditor::changeAlign(int )
+void StoryEditor::changeAlign(int , bool isStyleChange)
 {
 	int p, i;
 	bool sel = false;
@@ -3382,6 +3402,10 @@
 			PStart = p;
 			PEnd = p;
 		}
+		//Avoid resetting current attributes for empty paragraphs when only changing alignment.
+		//The second part of the condition is because the alignment buttons can sometimes be active for styled
+		//paragraphs. The first part allows reselecting "No Style" to reset properties like for other styles.
+		bool preserveNoStyle = (isStyleChange || (*Editor->ParagStyles.at(p) > 4)) ? false : true;
 		for (int pa = PStart; pa < QMIN(PEnd+1, static_cast<int>(Editor->StyledText.count())); ++pa)
 		{
 			(*Editor->ParagStyles.at(pa)) = Editor->currentParaStyle;
@@ -3396,7 +3420,7 @@
 				else
 				{
 					//Moved to separate method to ensure consistency for #5484 - Michael Koren 2007-4-21
-					setParPropsFromFrame(pa);
+					setParPropsFromFrame(pa, !isStyleChange);
 				}
 			Editor->updateFromChars(pa);
 			}
@@ -3405,7 +3429,7 @@
 			Editor->setSelection(PStart2, SelStart2, PEnd2, SelEnd2);
 		Editor->setCursorPosition(p, i);
 		Editor->ensureCursorVisible();
-		updateProps(p, i);
+		updateProps(p, i, preserveNoStyle);
 		//Add this once here to replace the signal. modifiedText() is called below already  - Michael Koren #5577
 		EditorBar->doRepaint();
 		connect(Editor, SIGNAL(cursorPositionChanged(int, int)), this, SLOT(updateProps(int, int)));
@@ -3523,12 +3547,14 @@
 }
 
 //Set text properties of a paragraph to frame defaults or change alignment
-void StoryEditor::setParPropsFromFrame(int pa)
+void StoryEditor::setParPropsFromFrame(int pa, bool preserveNoStyle)
 {
 	SEditor::ChList *chars = Editor->StyledText.at(pa);
 	for (uint s = 0; s < chars->count(); ++s)
 	{
-		if (chars->at(s)->cab > 4)
+		//Don't check the previous style unless preserveNoStyle is passed.
+		//Allows reselecting "No Style" to reset properties like for other styles.
+		if (!preserveNoStyle || (chars->at(s)->cab > 4))
 		{
 			chars->at(s)->ccolor = currItem->TxtFill;
 			chars->at(s)->cshade = currItem->ShTxtFill;

2007-04-29 00:36

 

story.h.nostylefix.1338.diff (1,149 bytes)   
--- story.h	2007-04-24 20:10:33.000000000 -0500
+++ story.h.nostylefix	2007-04-27 15:34:22.000000000 -0500
@@ -338,7 +338,7 @@
 	void keyPressEvent (QKeyEvent * e);
 	bool eventFilter( QObject* ob, QEvent* ev );
 	//int exec();
-	void changeAlign(int align);
+	void changeAlign(int align, bool isStyleChange=false);
 	int result;
 	void setCurrentDocumentAndItem(ScribusDoc *doc=NULL, PageItem *item=NULL);
 	bool textDataChanged() const;
@@ -349,7 +349,7 @@
 	void setEditorPropsFromFrame();
 	void setEditorPropsFromStyle();
 	void setEditorPropsFromChar(struct PtiSmall *hg);
-	void setParPropsFromFrame(int pa);
+	void setParPropsFromFrame(int pa, bool preserveNoStyle=false);
 	void setParPropsFromStyle(int pa);
 
 	/*! Enables/disables the "smart" selection (#1203) - 10/16/2004 pv */
@@ -381,8 +381,9 @@
 	void newTxtOutline(int o);
 	void newTxtUnderline(int p, int w);
 	void newTxtStrike(int p, int w);
-	void updateProps(int p, int ch);
+	void updateProps(int p, int ch, bool preserveNoStyle=false);
 	void newAlign(int st);
+	void newParaStyle(int st);
 	void changeAlignSB(int pa, int align);
 	void updateStatus();
 	void Do_leave();
story.h.nostylefix.1338.diff (1,149 bytes)   

Kunda

2016-04-18 16:21

updater   ~0040279

I'm sure the patch is obsolete but are the issue the patch addresses still a problem?

Kunda

2016-05-28 05:39

updater   ~0041494

Lets test this ticket as well.

silentashes

2016-08-17 09:41

reporter  

2016Summer.sla (26,081 bytes)

silentashes

2016-08-17 09:43

reporter  

2016Summer.sla.gz (5,808 bytes)

silentashes

2016-08-17 09:46

reporter   ~0041915

Last edited: 2016-08-17 09:50

Hey folks,
regular User here (sorry).
Just wanted to add that I am also running into this issue -- or at least, I think it's the same issue?

Context:
Open attached file.

1) It was all originally default-paragraph-style.
2) I created new styles (using different fonts, Source Sans Pro -- avail. from Adobe, or should be included in the compressed file (attached)).

3) Open SE and applied those styles to certain paragraphs.

4) Apply/Save, close SE
5) Re-open SE

6) ... it's now *not* matching the apparent styles -- or fonts, for that matter -- with any of the paragraphs when I select them.

As though the Style mechanism is now 'broken' within SE, and nothing I can do will fix it to reflect the actual Style of the current text, line, or paragraph.

edit:
I tried unzipped the compressed file, to see if possibly working with a compressed file was causing memory corruption somehow...
... but no, apparent same issue with an uncompressed file. (I included both, so you can play with each.)

edit2:
Am unclear (sorry for being a newb) --
-- are you saying that your attached patch *causes* the described bug?
Or are you saying that your attached patch is intended to *FIX* the described bug?

silentashes

2016-09-03 00:45

reporter   ~0041973

Hi Kunda,
Yes, this still seems to be an issue.
Can you reply here when you get a chance?
if need be, i can open a new bug w/ screenshots of the issue.
Thanks!

Issue History

Date Modified Username Field Change
2007-04-29 00:35 mkoren New Issue
2007-04-29 00:35 mkoren File Added: story.cpp.patch5_nostylefix.1338.diff
2007-04-29 00:36 mkoren File Added: story.h.nostylefix.1338.diff
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
2016-04-18 16:21 Kunda Note Added: 0040279
2016-04-18 16:21 Kunda Tag Attached: #please_test
2016-05-28 05:39 Kunda Note Added: 0041494
2016-06-19 07:43 PeterBenedek Relationship added related to 0010132
2016-08-17 09:41 silentashes File Added: 2016Summer.sla
2016-08-17 09:43 silentashes File Added: 2016Summer.sla.gz
2016-08-17 09:46 silentashes Note Added: 0041915
2016-08-17 09:48 silentashes Note Edited: 0041915
2016-08-17 09:50 silentashes Note Edited: 0041915
2016-09-03 00:45 silentashes Note Added: 0041973