View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0016881 | Scribus | User Interface | public | 2023-01-04 16:14 | 2023-05-29 18:56 |
Reporter | pmjdebruijn | Assigned To | jghali | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Product Version | 1.6.0.svn | ||||
Fixed in Version | 1.6.0.svn | ||||
Summary | 0016881: Section Default Numbering | ||||
Description | In Document Setup / Sections, the default section is named by default "0", but regular people don't count from 0, but 1 :) The attached patch does three things: The default section is named "Main Matter", effectively Section 1 (as opposed to 0, see below) Additional section are now named "Section #" And the section numbers are offset by +1 While minor, this seem like slightly friendlier default behavior to me. | ||||
Tags | No tags attached. | ||||
Patch | Yes | ||||
|
sections.patch (1,389 bytes)
diff --git a/scribus/scribusdoc.cpp b/scribus/scribusdoc.cpp index 55a37845f..327283a15 100644 --- a/scribus/scribusdoc.cpp +++ b/scribus/scribusdoc.cpp @@ -6778,7 +6778,7 @@ void ScribusDoc::addSection(int number, const QString& name, const uint frominde if (empty) { newSection.number = 0; - newSection.name = "0"; + newSection.name = tr("Main Matter"); newSection.fromindex = 0; newSection.toindex = docPageCount-1; newSection.type = Type_1_2_3; diff --git a/scribus/ui/prefs_documentsections.cpp b/scribus/ui/prefs_documentsections.cpp index 78ecfdb17..8626758c0 100644 --- a/scribus/ui/prefs_documentsections.cpp +++ b/scribus/ui/prefs_documentsections.cpp @@ -198,7 +198,7 @@ void Prefs_DocumentSections::addEntry() struct DocumentSection blank; uint count = m_localSections.count(); blank.number = count; - blank.name = QString::number(count); + blank.name = tr("Section") + " " + QString::number(count + 1); blank.fromindex = m_maxPageIndex + 1; blank.toindex = m_maxPageIndex + 1; blank.type = Type_1_2_3; @@ -224,7 +224,7 @@ void Prefs_DocumentSections::addEntry() { struct DocumentSection blank; blank.number = ++i; - blank.name = QString::number(i); + blank.name = tr("Section") + " " + QString::number(i + 1); blank.fromindex = it->toindex + 1; blank.toindex = it->toindex + 2; blank.type = Type_1_2_3; |
|
If you don't don't like using "Main Matter" as a default first section, here's modified patch that just uses the updated numbering scheme. onlysections.patch (1,412 bytes)
diff --git a/scribus/scribusdoc.cpp b/scribus/scribusdoc.cpp index 55a37845f..327283a15 100644 --- a/scribus/scribusdoc.cpp +++ b/scribus/scribusdoc.cpp @@ -6778,7 +6778,7 @@ void ScribusDoc::addSection(int number, const QString& name, const uint frominde if (empty) { newSection.number = 0; - newSection.name = "0"; + newSection.name = tr("Section") + " " + QString::number(1); newSection.fromindex = 0; newSection.toindex = docPageCount-1; newSection.type = Type_1_2_3; diff --git a/scribus/ui/prefs_documentsections.cpp b/scribus/ui/prefs_documentsections.cpp index 78ecfdb17..8626758c0 100644 --- a/scribus/ui/prefs_documentsections.cpp +++ b/scribus/ui/prefs_documentsections.cpp @@ -198,7 +198,7 @@ void Prefs_DocumentSections::addEntry() struct DocumentSection blank; uint count = m_localSections.count(); blank.number = count; - blank.name = QString::number(count); + blank.name = tr("Section") + " " + QString::number(count + 1); blank.fromindex = m_maxPageIndex + 1; blank.toindex = m_maxPageIndex + 1; blank.type = Type_1_2_3; @@ -224,7 +224,7 @@ void Prefs_DocumentSections::addEntry() { struct DocumentSection blank; blank.number = ++i; - blank.name = QString::number(i); + blank.name = tr("Section") + " " + QString::number(i + 1); blank.fromindex = it->toindex + 1; blank.toindex = it->toindex + 2; blank.type = Type_1_2_3; |
|
A tip related to translations : when including numbers in translations it is better to do something like this: blank.name = tr("Section %1").arg(count + 1); The reason for this is that word order can change depending on language and the translated "Section %1" value could well be something like "%1 Gloubibouga". To avoid potential translation inconsistencies between ScribusDoc and Prefs_DocumentSections contexts, it will be probably better to put tr("Section %1") in CommonStrings with a variable name such as trSectionName or something better if you can find a better one. |
|
Updated patch attached. onlysections_v2.patch (1,400 bytes)
diff -Nurpd a/scribus/scribusdoc.cpp b/scribus/scribusdoc.cpp --- a/scribus/scribusdoc.cpp 2023-01-08 12:29:49.000000000 +0100 +++ b/scribus/scribusdoc.cpp 2023-01-08 12:56:42.950867627 +0100 @@ -6780,7 +6780,7 @@ void ScribusDoc::addSection(int number, if (empty) { newSection.number = 0; - newSection.name = "0"; + newSection.name = tr("Section %1").arg(1); newSection.fromindex = 0; newSection.toindex = docPageCount - 1; newSection.type = Type_1_2_3; diff -Nurpd a/scribus/ui/prefs_documentsections.cpp b/scribus/ui/prefs_documentsections.cpp --- a/scribus/ui/prefs_documentsections.cpp 2023-01-08 12:29:49.000000000 +0100 +++ b/scribus/ui/prefs_documentsections.cpp 2023-01-08 12:56:42.958867663 +0100 @@ -198,7 +198,7 @@ void Prefs_DocumentSections::addEntry() struct DocumentSection blank; uint count = m_localSections.count(); blank.number = count; - blank.name = QString::number(count); + blank.name = tr("Section %1").arg(count + 1); blank.fromindex = m_maxPageIndex + 1; blank.toindex = m_maxPageIndex + 1; blank.type = Type_1_2_3; @@ -224,7 +224,7 @@ void Prefs_DocumentSections::addEntry() { struct DocumentSection blank; blank.number = ++i; - blank.name = QString::number(i); + blank.name = tr("Section %1").arg(i + 1); blank.fromindex = it->toindex + 1; blank.toindex = it->toindex + 2; blank.type = Type_1_2_3; |
|
And now with CommonStrings onlysections_v3_commonstrings.patch (2,710 bytes)
diff -Nurpd a/scribus/commonstrings.cpp b/scribus/commonstrings.cpp --- a/scribus/commonstrings.cpp 2023-01-08 12:29:51.000000000 +0100 +++ b/scribus/commonstrings.cpp 2023-01-08 13:48:41.428775966 +0100 @@ -184,6 +184,8 @@ QString CommonStrings::trPostScript3 = " QString CommonStrings::WindowsGDI = ""; QString CommonStrings::trWindowsGDI = ""; +QString CommonStrings::trSectionName = ""; + QString CommonStrings::trStrPT = ""; QString CommonStrings::trStrMM = ""; QString CommonStrings::trStrIN = ""; @@ -456,6 +458,9 @@ void CommonStrings::languageChange() CommonStrings::WindowsGDI = "Windows GDI"; CommonStrings::trWindowsGDI = tr( "Windows GDI" ); + //Section Name + CommonStrings::trSectionName = tr("Section %1"); + //Units CommonStrings::trStrPT = unitGetStrFromIndex(SC_PT); CommonStrings::trStrMM = unitGetStrFromIndex(SC_MM); diff -Nurpd a/scribus/commonstrings.h b/scribus/commonstrings.h --- a/scribus/commonstrings.h 2023-01-08 12:29:51.000000000 +0100 +++ b/scribus/commonstrings.h 2023-01-08 13:47:35.364600655 +0100 @@ -272,6 +272,7 @@ public: static QString trPostScript3; static QString WindowsGDI; static QString trWindowsGDI; + static QString trSectionName; //Units strings static QString trStrPT; diff -Nurpd a/scribus/scribusdoc.cpp b/scribus/scribusdoc.cpp --- a/scribus/scribusdoc.cpp 2023-01-08 12:29:49.000000000 +0100 +++ b/scribus/scribusdoc.cpp 2023-01-08 13:47:35.368600665 +0100 @@ -6780,7 +6780,7 @@ void ScribusDoc::addSection(int number, if (empty) { newSection.number = 0; - newSection.name = "0"; + newSection.name = CommonStrings::trSectionName.arg(1); newSection.fromindex = 0; newSection.toindex = docPageCount - 1; newSection.type = Type_1_2_3; diff -Nurpd a/scribus/ui/prefs_documentsections.cpp b/scribus/ui/prefs_documentsections.cpp --- a/scribus/ui/prefs_documentsections.cpp 2023-01-08 12:29:49.000000000 +0100 +++ b/scribus/ui/prefs_documentsections.cpp 2023-01-08 13:47:35.368600665 +0100 @@ -198,7 +198,7 @@ void Prefs_DocumentSections::addEntry() struct DocumentSection blank; uint count = m_localSections.count(); blank.number = count; - blank.name = QString::number(count); + blank.name = CommonStrings::trSectionName.arg(count + 1); blank.fromindex = m_maxPageIndex + 1; blank.toindex = m_maxPageIndex + 1; blank.type = Type_1_2_3; @@ -224,7 +224,7 @@ void Prefs_DocumentSections::addEntry() { struct DocumentSection blank; blank.number = ++i; - blank.name = QString::number(i); + blank.name = CommonStrings::trSectionName.arg(i + 1); blank.fromindex = it->toindex + 1; blank.toindex = it->toindex + 2; blank.type = Type_1_2_3; |
|
Thanks! I've now applied your patch. |
Date Modified | Username | Field | Change |
---|---|---|---|
2023-01-04 16:14 | pmjdebruijn | New Issue | |
2023-01-04 16:14 | pmjdebruijn | File Added: sections.patch | |
2023-01-07 17:27 | pmjdebruijn | Note Added: 0049859 | |
2023-01-07 17:27 | pmjdebruijn | File Added: onlysections.patch | |
2023-01-07 22:49 | jghali | Note Added: 0049862 | |
2023-01-08 12:22 | pmjdebruijn | Note Added: 0049863 | |
2023-01-08 12:22 | pmjdebruijn | File Added: onlysections_v2.patch | |
2023-01-08 12:59 | pmjdebruijn | Note Added: 0049864 | |
2023-01-08 12:59 | pmjdebruijn | File Added: onlysections_v3_commonstrings.patch | |
2023-01-08 17:58 | jghali | Assigned To | => jghali |
2023-01-08 17:58 | jghali | Status | new => resolved |
2023-01-08 17:58 | jghali | Resolution | open => fixed |
2023-01-08 17:58 | jghali | Fixed in Version | => 1.6.0.svn |
2023-01-08 17:58 | jghali | Note Added: 0049868 | |
2023-05-29 18:56 | cbradney | Status | resolved => closed |