View Issue Details

IDProjectCategoryView StatusLast Update
0017339ScribusGeneralpublic2024-12-16 21:12
Reporternitramr Assigned Tonitramr  
PrioritynormalSeverityminorReproducibilityalways
Status closedResolutionfixed 
PlatformDesktop PCOSUbuntuOS Version24.10 64-bit
Product Version1.6.3.svn 
Target Version1.6.3.svnFixed in Version1.6.3.svn 
Summary0017339: Scribus never read preferences of guide color and baseline color
DescriptionScribus never read preferences of guide color and baseline color.

The patch fixes the read properties. It looks like that Scribus tries to read some very old properties from prefs file.
Steps To Reproduce1. When no document is open, go to Preferences -> Guides -> Colors
2. Change color of guides to any color, e.g. #ffff00 (yellow)
3. Close preference dialog (your changes are saved correctly to the prefs file)
4. Restart Scribus create a document and drag a guide to the canvas (you will see a dark blue guide instead of a yellow one)

Same steps for baseline color
TagsNo tags attached.
PatchYes

Relationships

related to 0017336 new All options disabled in "Document Settings > Display > Colors" 

Activities

nitramr

2024-12-15 12:57

developer  

colors_2024-12-15_01.patch (1,360 bytes)   
Index: scribus/prefsmanager.cpp
===================================================================
--- scribus/prefsmanager.cpp	(Revision 26493)
+++ scribus/prefsmanager.cpp	(Arbeitskopie)
@@ -2173,12 +2173,9 @@
 			}
 			appPrefs.guidesPrefs.gridType = dc.attribute("GridType", "0").toInt();
 			appPrefs.guidesPrefs.gridShown = static_cast<bool>(dc.attribute("ShowGrid", "0").toInt());
-			if (dc.hasAttribute("GuideC"))
-				appPrefs.guidesPrefs.guideColor = QColor(dc.attribute("GuideC"));
-			if (dc.hasAttribute("GuideZ"))
-				appPrefs.guidesPrefs.guideRad = ScCLocale::toDoubleC(dc.attribute("ObjectToGuideSnapRadius"), 10.0);
-			if (dc.hasAttribute("BaseC"))
-				appPrefs.guidesPrefs.baselineGridColor = QColor(dc.attribute("BaselineGridColor"));
+			appPrefs.guidesPrefs.guideColor = QColor(dc.attribute("GuidesColor", "#000080"));
+			appPrefs.guidesPrefs.guideRad = ScCLocale::toDoubleC(dc.attribute("ObjectToGuideSnapRadius"), 10.0);
+			appPrefs.guidesPrefs.baselineGridColor = QColor(dc.attribute("BaselineGridColor", "#c0c0c0"));
 			appPrefs.guidesPrefs.marginColor = QColor(dc.attribute("MarginColor", "#0000ff"));
 			appPrefs.guidesPrefs.valueBaselineGrid   = ScCLocale::toDoubleC(dc.attribute("BaselineGridDistance"), 12.0);
 			appPrefs.guidesPrefs.offsetBaselineGrid  = ScCLocale::toDoubleC(dc.attribute("BaselineGridOffset"), 0.0);

colors_2024-12-15_01.patch (1,360 bytes)   

nitramr

2024-12-15 13:11

developer   ~0051730

My fault. The "legacy" properties are still in use in sla files.
The second patch support both values, e.g. BaseC and BaselineGridColor.
colors_2024-12-15_02.patch (1,553 bytes)   
Index: scribus/prefsmanager.cpp
===================================================================
--- scribus/prefsmanager.cpp	(Revision 26493)
+++ scribus/prefsmanager.cpp	(Arbeitskopie)
@@ -2173,12 +2173,12 @@
 			}
 			appPrefs.guidesPrefs.gridType = dc.attribute("GridType", "0").toInt();
 			appPrefs.guidesPrefs.gridShown = static_cast<bool>(dc.attribute("ShowGrid", "0").toInt());
-			if (dc.hasAttribute("GuideC"))
-				appPrefs.guidesPrefs.guideColor = QColor(dc.attribute("GuideC"));
-			if (dc.hasAttribute("GuideZ"))
+			if (dc.hasAttribute("GuideC") || dc.hasAttribute("GuidesColor")) // GuideC from sla file
+				appPrefs.guidesPrefs.guideColor = QColor(dc.attribute("GuidesColor", "#000080"));
+			if (dc.hasAttribute("GuideZ") || dc.hasAttribute("ObjectToGuideSnapRadius")) // GuideZ from sla file
 				appPrefs.guidesPrefs.guideRad = ScCLocale::toDoubleC(dc.attribute("ObjectToGuideSnapRadius"), 10.0);
-			if (dc.hasAttribute("BaseC"))
-				appPrefs.guidesPrefs.baselineGridColor = QColor(dc.attribute("BaselineGridColor"));
+			if (dc.hasAttribute("BaseC") || dc.hasAttribute("BaselineGridColor")) // BaseC from sla file
+				appPrefs.guidesPrefs.baselineGridColor = QColor(dc.attribute("BaselineGridColor", "#c0c0c0"));
 			appPrefs.guidesPrefs.marginColor = QColor(dc.attribute("MarginColor", "#0000ff"));
 			appPrefs.guidesPrefs.valueBaselineGrid   = ScCLocale::toDoubleC(dc.attribute("BaselineGridDistance"), 12.0);
 			appPrefs.guidesPrefs.offsetBaselineGrid  = ScCLocale::toDoubleC(dc.attribute("BaselineGridOffset"), 0.0);

colors_2024-12-15_02.patch (1,553 bytes)   

cbradney

2024-12-15 15:40

administrator   ~0051731

I think this won't work...

if (dc.hasAttribute("GuideC") || dc.hasAttribute("GuidesColor")) // GuideC from sla file
                appPrefs.guidesPrefs.guideColor = QColor(dc.attribute("GuidesColor", "0000080"));

should be:
if (dc.hasAttribute("GuideC") // GuideC from sla file
                appPrefs.guidesPrefs.guideColor = QColor(dc.attribute("GuidesC", "0000080"));
if (dc.hasAttribute("GuidesColor"))
                appPrefs.guidesPrefs.guideColor = QColor(dc.attribute("GuidesColor", "0000080"));


Where are we using an old naming scheme? Let's change that.

nitramr

2024-12-15 16:06

developer   ~0051732

The new patch applies your changes and I add the new namings to 1.7.0 file format too.

BTW: I could not find "GuideZ" anywhere else. It looks like it was never used?
colors_2024-12-15_03.patch (4,034 bytes)   
Index: scribus/plugins/fileloader/scribus170format/scribus170format.cpp
===================================================================
--- scribus/plugins/fileloader/scribus170format/scribus170format.cpp	(Revision 26493)
+++ scribus/plugins/fileloader/scribus170format/scribus170format.cpp	(Arbeitskopie)
@@ -2579,10 +2579,14 @@
 		doc->guidesPrefs().minorGridColor = QColor(attrs.valueAsString("MINORC"));
 	if (attrs.hasAttribute("MAJORC"))
 		doc->guidesPrefs().majorGridColor = QColor(attrs.valueAsString("MAJORC"));
-	if (attrs.hasAttribute("GuideC"))
+	if (attrs.hasAttribute("GuideC")) //legacy < 1.7.x
 		doc->guidesPrefs().guideColor = QColor(attrs.valueAsString("GuideC"));
-	if (attrs.hasAttribute("BaseC"))
+	if (attrs.hasAttribute("GuidesColor"))
+		doc->guidesPrefs().guideColor = QColor(attrs.valueAsString("GuidesColor"));
+	if (attrs.hasAttribute("BaseC")) //legacy < 1.7.x
 		doc->guidesPrefs().baselineGridColor  = QColor(attrs.valueAsString("BaseC"));
+	if (attrs.hasAttribute("BaselineGridColor"))
+		doc->guidesPrefs().baselineGridColor  = QColor(attrs.valueAsString("BaselineGridColor"));
 	if (attrs.hasAttribute("BACKG"))
 	{
 		doc->guidesPrefs().renderStackOrder.clear();
Index: scribus/plugins/fileloader/scribus170format/scribus170format_save.cpp
===================================================================
--- scribus/plugins/fileloader/scribus170format/scribus170format_save.cpp	(Revision 26493)
+++ scribus/plugins/fileloader/scribus170format/scribus170format_save.cpp	(Arbeitskopie)
@@ -497,8 +497,8 @@
 	docu.writeAttribute("constrain", m_Doc->opToolPrefs().constrain);
 	docu.writeAttribute("MINORC",m_Doc->guidesPrefs().minorGridColor.name());
 	docu.writeAttribute("MAJORC",m_Doc->guidesPrefs().majorGridColor.name());
-	docu.writeAttribute("GuideC", m_Doc->guidesPrefs().guideColor.name());
-	docu.writeAttribute("BaseC", m_Doc->guidesPrefs().baselineGridColor.name());
+	docu.writeAttribute("GuidesColor", m_Doc->guidesPrefs().guideColor.name());
+	docu.writeAttribute("BaselineGridColor", m_Doc->guidesPrefs().baselineGridColor.name());
 	QString renderStack;
 	int renderStackCount = m_Doc->guidesPrefs().renderStackOrder.count();
 	for (int r = 0; r < renderStackCount; r++)
Index: scribus/prefsmanager.cpp
===================================================================
--- scribus/prefsmanager.cpp	(Revision 26493)
+++ scribus/prefsmanager.cpp	(Arbeitskopie)
@@ -2173,12 +2173,18 @@
 			}
 			appPrefs.guidesPrefs.gridType = dc.attribute("GridType", "0").toInt();
 			appPrefs.guidesPrefs.gridShown = static_cast<bool>(dc.attribute("ShowGrid", "0").toInt());
-			if (dc.hasAttribute("GuideC"))
-				appPrefs.guidesPrefs.guideColor = QColor(dc.attribute("GuideC"));
-			if (dc.hasAttribute("GuideZ"))
+			if (dc.hasAttribute("GuideC")) // legacy < 1.7.x
+				appPrefs.guidesPrefs.guideColor = QColor(dc.attribute("GuideC", "#000080"));
+			if (dc.hasAttribute("GuidesColor"))
+				appPrefs.guidesPrefs.guideColor = QColor(dc.attribute("GuidesColor", "#000080"));
+			if (dc.hasAttribute("GuideZ")) // legacy
+				appPrefs.guidesPrefs.guideRad = ScCLocale::toDoubleC(dc.attribute("GuideZ"), 10.0);
+			if (dc.hasAttribute("ObjectToGuideSnapRadius"))
 				appPrefs.guidesPrefs.guideRad = ScCLocale::toDoubleC(dc.attribute("ObjectToGuideSnapRadius"), 10.0);
-			if (dc.hasAttribute("BaseC"))
-				appPrefs.guidesPrefs.baselineGridColor = QColor(dc.attribute("BaselineGridColor"));
+			if (dc.hasAttribute("BaseC")) // legacy < 1.7.x
+				appPrefs.guidesPrefs.baselineGridColor = QColor(dc.attribute("BaseC", "#c0c0c0"));
+			if (dc.hasAttribute("BaselineGridColor"))
+				appPrefs.guidesPrefs.baselineGridColor = QColor(dc.attribute("BaselineGridColor", "#c0c0c0"));
 			appPrefs.guidesPrefs.marginColor = QColor(dc.attribute("MarginColor", "#0000ff"));
 			appPrefs.guidesPrefs.valueBaselineGrid   = ScCLocale::toDoubleC(dc.attribute("BaselineGridDistance"), 12.0);
 			appPrefs.guidesPrefs.offsetBaselineGrid  = ScCLocale::toDoubleC(dc.attribute("BaselineGridOffset"), 0.0);
colors_2024-12-15_03.patch (4,034 bytes)   

cbradney

2024-12-15 20:39

administrator   ~0051733

Applied to 1.7.0.svn. Do you have another patch for 1.6.3?

nitramr

2024-12-15 20:45

developer   ~0051734

For 1.6.3 we need only the changes of the prefsmanager.cpp
colors_2024-12-15_04.patch (1,804 bytes)   
Index: scribus/prefsmanager.cpp
===================================================================
--- scribus/prefsmanager.cpp	(Revision 26493)
+++ scribus/prefsmanager.cpp	(Arbeitskopie)
@@ -2173,12 +2173,18 @@
 			}
 			appPrefs.guidesPrefs.gridType = dc.attribute("GridType", "0").toInt();
 			appPrefs.guidesPrefs.gridShown = static_cast<bool>(dc.attribute("ShowGrid", "0").toInt());
-			if (dc.hasAttribute("GuideC"))
-				appPrefs.guidesPrefs.guideColor = QColor(dc.attribute("GuideC"));
-			if (dc.hasAttribute("GuideZ"))
+			if (dc.hasAttribute("GuideC")) // legacy < 1.7.x
+				appPrefs.guidesPrefs.guideColor = QColor(dc.attribute("GuideC", "#000080"));
+			if (dc.hasAttribute("GuidesColor"))
+				appPrefs.guidesPrefs.guideColor = QColor(dc.attribute("GuidesColor", "#000080"));
+			if (dc.hasAttribute("GuideZ")) // legacy
+				appPrefs.guidesPrefs.guideRad = ScCLocale::toDoubleC(dc.attribute("GuideZ"), 10.0);
+			if (dc.hasAttribute("ObjectToGuideSnapRadius"))
 				appPrefs.guidesPrefs.guideRad = ScCLocale::toDoubleC(dc.attribute("ObjectToGuideSnapRadius"), 10.0);
-			if (dc.hasAttribute("BaseC"))
-				appPrefs.guidesPrefs.baselineGridColor = QColor(dc.attribute("BaselineGridColor"));
+			if (dc.hasAttribute("BaseC")) // legacy < 1.7.x
+				appPrefs.guidesPrefs.baselineGridColor = QColor(dc.attribute("BaseC", "#c0c0c0"));
+			if (dc.hasAttribute("BaselineGridColor"))
+				appPrefs.guidesPrefs.baselineGridColor = QColor(dc.attribute("BaselineGridColor", "#c0c0c0"));
 			appPrefs.guidesPrefs.marginColor = QColor(dc.attribute("MarginColor", "#0000ff"));
 			appPrefs.guidesPrefs.valueBaselineGrid   = ScCLocale::toDoubleC(dc.attribute("BaselineGridDistance"), 12.0);
 			appPrefs.guidesPrefs.offsetBaselineGrid  = ScCLocale::toDoubleC(dc.attribute("BaselineGridOffset"), 0.0);
colors_2024-12-15_04.patch (1,804 bytes)   

cbradney

2024-12-16 06:12

administrator   ~0051735

I'm confused by the original code...
- if (dc.hasAttribute("BaseC"))
- appPrefs.guidesPrefs.baselineGridColor = QColor(dc.attribute("BaselineGridColor"));

No idea why that would have been the case. Maybe a copy paste error. Will check tonight in the commit history.

Issue History

Date Modified Username Field Change
2024-12-15 12:57 nitramr New Issue
2024-12-15 12:57 nitramr File Added: colors_2024-12-15_01.patch
2024-12-15 13:00 nitramr Relationship added related to 0017336
2024-12-15 13:11 nitramr Note Added: 0051730
2024-12-15 13:11 nitramr File Added: colors_2024-12-15_02.patch
2024-12-15 15:40 cbradney Note Added: 0051731
2024-12-15 16:06 nitramr Note Added: 0051732
2024-12-15 16:06 nitramr File Added: colors_2024-12-15_03.patch
2024-12-15 20:39 cbradney Note Added: 0051733
2024-12-15 20:45 nitramr Note Added: 0051734
2024-12-15 20:45 nitramr File Added: colors_2024-12-15_04.patch
2024-12-16 06:12 cbradney Note Added: 0051735
2024-12-16 19:35 cbradney Assigned To => nitramr
2024-12-16 19:35 cbradney Status new => resolved
2024-12-16 19:35 cbradney Resolution open => fixed
2024-12-16 19:35 cbradney Fixed in Version => 1.6.3.svn
2024-12-16 21:12 cbradney Status resolved => closed