View Issue Details
| ID | Project | Category | View Status | Date Submitted | Last Update |
|---|---|---|---|---|---|
| 0017900 | Scribus | General | public | 2026-07-29 17:38 | 2026-08-26 01:58 |
| Reporter | ale | Assigned To | |||
| Priority | normal | Severity | feature | Reproducibility | N/A |
| Status | new | Resolution | open | ||
| Summary | 0017900: Setup Wizard should choose "good" page margins and gap for automatic text frames | ||||
| Description | Currently, the margins are 14.111 and the gap for automatic text frames 3.881 mm. Depending on the default page format and maybe the unit we could choose meaningful margins. For A4 and mm (probably, the most common choice in continental Europe and the default that was presented to me), the margins should be 10 mm or 15 mm. The gap for automatic text frames could be twice the margins. | ||||
| Tags | #patch_to_be_reviewed, #please_test | ||||
| Patch | No | ||||
|
|
Those are unrelated to the setup wizard as such. same defaults as always - 40 pt |
|
|
I guess that if the default unit is mm, then 10 or 15 mm are a good default values. If the default unit is inch, 1' or some simple fraction of it is a good one. If somebody picks pt as the default unit, 40 pt might be Ok. But not if the default is mm. |
|
|
Attached patch makes the default page margins follow the selected measurement unit instead of converting a single hard-coded point value. * Uses round native defaults such as 10 mm, 1 cm, 0.5 in, 36 pt, 3p0, and 3c0. * Centralises calculation of the factory margin for each unit. * When changing units, the native default is substituted only while margins still match the previous factory default. * Once margins have been edited by the user, changing units preserves their physical size and only converts the displayed values. * Existing documents are unaffected apart from normal unit conversion. * Bleeds remain unchanged at zero. unit-aware-margins-v1.02.patch (6,764 bytes)
Index: scribus/prefsmanager.cpp
===================================================================
--- scribus/prefsmanager.cpp (revision 27777)
+++ scribus/prefsmanager.cpp (working copy)
@@ -118,6 +118,41 @@
//>>CB
}
+MarginStruct PrefsManager::defaultPageMarginsForUnit(int unitIndex)
+{
+ double margin = 36.0;
+ switch (unitIndex)
+ {
+ case SC_PT:
+ case SC_P:
+ break;
+ case SC_MM:
+ margin = mm2pts(10.0);
+ break;
+ case SC_IN:
+ margin = in2pts(0.5);
+ break;
+ case SC_CM:
+ margin = cm2pts(1.0);
+ break;
+ case SC_C:
+ margin = c2pts(3.0);
+ break;
+ default:
+ break;
+ }
+ return MarginStruct(margin, margin, margin, margin);
+}
+
+bool PrefsManager::hasDefaultPageMarginsForUnit(const MarginStruct& margins, int unitIndex)
+{
+ const MarginStruct defaults = defaultPageMarginsForUnit(unitIndex);
+ return qFuzzyCompare(margins.top(), defaults.top())
+ && qFuzzyCompare(margins.left(), defaults.left())
+ && qFuzzyCompare(margins.bottom(), defaults.bottom())
+ && qFuzzyCompare(margins.right(), defaults.right());
+}
+
void PrefsManager::initDefaults()
{
/** Default font and size **/
@@ -332,7 +367,7 @@
PageSizeInfo psi = PagePresetManager::instance().pageInfoByName(appPrefs.docSetupPrefs.pageSize);
appPrefs.docSetupPrefs.pageWidth = psi.width;
appPrefs.docSetupPrefs.pageHeight = psi.height;
- appPrefs.docSetupPrefs.margins.set(40, 40, 40, 40);
+ appPrefs.docSetupPrefs.margins = defaultPageMarginsForUnit(appPrefs.docSetupPrefs.docUnitIndex);
appPrefs.docSetupPrefs.marginPreset = 0;
appPrefs.docSetupPrefs.bleeds.set(0, 0, 0, 0);
appPrefs.hyphPrefs.specialWords.clear();
Index: scribus/prefsmanager.h
===================================================================
--- scribus/prefsmanager.h (revision 27777)
+++ scribus/prefsmanager.h (working copy)
@@ -60,6 +60,8 @@
Must be run after: PrefsManager::GetAllFonts()
*/
void initDefaults();
+ static MarginStruct defaultPageMarginsForUnit(int unitIndex);
+ static bool hasDefaultPageMarginsForUnit(const MarginStruct& margins, int unitIndex);
void initDefaultGUIFont(const QFont&);
void initDefaultCheckerPrefs(CheckerPrefsList& cp);
void initDefaultActionKeys();
Index: scribus/ui/fsw/firststartwizard.cpp
===================================================================
--- scribus/ui/fsw/firststartwizard.cpp (revision 27777)
+++ scribus/ui/fsw/firststartwizard.cpp (working copy)
@@ -168,7 +168,11 @@
// --- Language (FSW_Language) ---
p.uiPrefs.language = m_language->uiLanguage(); // priAbbrev
p.docSetupPrefs.language = m_language->documentLanguage(); // normalised short abbrev
- p.docSetupPrefs.docUnitIndex = m_language->unitIndex();
+ const int oldUnitIndex = p.docSetupPrefs.docUnitIndex;
+ const int newUnitIndex = m_language->unitIndex();
+ if (PrefsManager::hasDefaultPageMarginsForUnit(p.docSetupPrefs.margins, oldUnitIndex))
+ p.docSetupPrefs.margins = PrefsManager::defaultPageMarginsForUnit(newUnitIndex);
+ p.docSetupPrefs.docUnitIndex = newUnitIndex;
// --- Appearance (FSW_Appearance) ---
switch (m_appearance->themeMode())
Index: scribus/ui/newdocdialog.cpp
===================================================================
--- scribus/ui/newdocdialog.cpp (revision 27777)
+++ scribus/ui/newdocdialog.cpp (working copy)
@@ -45,6 +45,7 @@
#include "scpaths.h"
#include "scrspinbox.h"
#include "units.h"
+#include "ui/marginpresetlayout.h"
#include "ui/widgets/pagesizelist.h"
@@ -570,6 +571,9 @@
void NewDocDialog::setUnit(int newUnitIndex)
{
+ const bool useDefaultMargins = marginGroup->marginPreset() == PresetLayout::none
+ && PrefsManager::hasDefaultPageMarginsForUnit(marginGroup->margins(), m_unitIndex);
+
QSignalBlocker sig(unitOfMeasureComboBox);
unitOfMeasureComboBox->setCurrentIndex(newUnitIndex);
@@ -584,6 +588,8 @@
heightSpinBox->setValue(m_pageHeight * m_unitRatio);
marginGroup->setNewUnit(m_unitIndex);
+ if (useDefaultMargins)
+ marginGroup->setNewValues(PrefsManager::defaultPageMarginsForUnit(m_unitIndex));
marginGroup->setPageHeight(m_pageHeight);
marginGroup->setPageWidth(m_pageWidth);
bleedGroup->setNewUnit(m_unitIndex);
Index: scribus/ui/preferences/prefs_documentsetup.cpp
===================================================================
--- scribus/ui/preferences/prefs_documentsetup.cpp (revision 27777)
+++ scribus/ui/preferences/prefs_documentsetup.cpp (working copy)
@@ -15,6 +15,7 @@
#include "prefsfile.h"
#include "prefsmanager.h"
#include "prefsstructs.h"
+#include "ui/marginpresetlayout.h"
#include "ui/newmarginwidget.h"
#include "ui/preferences/prefs_documentsetup.h"
#include "undomanager.h"
@@ -83,16 +84,21 @@
void Prefs_DocumentSetup::unitChange()
{
+ const int docUnitIndex = pageUnitsComboBox->currentIndex();
+ const bool useDefaultMargins = !m_doc && marginsWidget->marginPreset() == PresetLayout::none
+ && PrefsManager::hasDefaultPageMarginsForUnit(marginsWidget->margins(), m_unitIndex);
+
pageWidthSpinBox->blockSignals(true);
pageHeightSpinBox->blockSignals(true);
- int docUnitIndex = pageUnitsComboBox->currentIndex();
pageWidthSpinBox->setNewUnit(docUnitIndex);
pageHeightSpinBox->setNewUnit(docUnitIndex);
unitRatio = unitGetRatioFromIndex(docUnitIndex);
pageWidthSpinBox->setValue(pageW * unitRatio);
pageHeightSpinBox->setValue(pageH * unitRatio);
marginsWidget->setNewUnit(docUnitIndex);
+ if (useDefaultMargins)
+ marginsWidget->setNewValues(PrefsManager::defaultPageMarginsForUnit(docUnitIndex));
marginsWidget->setPageHeight(pageH);
marginsWidget->setPageWidth(pageW);
bleedsWidget->setNewUnit(docUnitIndex);
@@ -102,6 +108,7 @@
pageWidthSpinBox->blockSignals(false);
pageHeightSpinBox->blockSignals(false);
+ m_unitIndex = docUnitIndex;
emit prefsChangeUnits(docUnitIndex);
}
@@ -145,7 +152,8 @@
setCurrentComboItem(languageComboBox, LanguageManager::instance()->getLangFromAbbrev(prefsData->docSetupPrefs.language, true));
- unitRatio = unitGetRatioFromIndex(prefsData->docSetupPrefs.docUnitIndex);
+ m_unitIndex = prefsData->docSetupPrefs.docUnitIndex;
+ unitRatio = unitGetRatioFromIndex(m_unitIndex);
setupPageSizes(prefsData);
pageOrientationComboBox->setCurrentIndex(prefsData->docSetupPrefs.pageOrientation);
Index: scribus/ui/preferences/prefs_documentsetup.h
===================================================================
--- scribus/ui/preferences/prefs_documentsetup.h (revision 27777)
+++ scribus/ui/preferences/prefs_documentsetup.h (working copy)
@@ -64,6 +64,7 @@
ScribusDoc* m_doc { nullptr };
double unitRatio { 1.0 };
+ int m_unitIndex { 0 };
double pageW { 1.0 };
double pageH { 1.0 };
QString prefsPageSizeName;
|
| Date Modified | Username | Field | Change |
|---|---|---|---|
| 2026-07-29 17:38 | ale | New Issue | |
| 2026-07-29 19:42 | cbradney | Note Added: 0054100 | |
| 2026-07-30 07:21 | ale | Note Added: 0054103 | |
| 2026-08-26 01:58 | buttar | Note Added: 0054301 | |
| 2026-08-26 01:58 | buttar | File Added: unit-aware-margins-v1.02.patch | |
| 2026-08-26 01:58 | buttar | Tag Attached: #patchtobereviewed | |
| 2026-08-26 01:58 | buttar | Tag Attached: #please_test | |
| 2026-08-27 08:05 | ale | Tag Renamed | #patchtobereviewed => #patch_to_be_reviewed |