View Issue Details
ID | Project | Category | View Status | Date Submitted | Last Update |
---|---|---|---|---|---|
0017350 | Scribus | Canvas | public | 2024-12-22 23:14 | 2024-12-23 23:18 |
Reporter | nitramr | Assigned To | jghali | ||
Priority | normal | Severity | minor | Reproducibility | always |
Status | closed | Resolution | fixed | ||
Platform | Desktop PC | OS | Ubuntu | OS Version | 24.10 64-bit |
Product Version | 1.6.2 | ||||
Target Version | 1.6.3.svn | Fixed in Version | 1.6.3.svn | ||
Summary | 0017350: Auto guide grid messed up when changing document measurement unit | ||||
Description | When you create an auto guide grid with gaps and change the document measure unit afterward, you get a different grid, because the new unit calculation is not applied the gap. | ||||
Steps To Reproduce | 1. Create a new document (create with mm) 2. Open guide manager: Page -> Manage Guides... 3. Select Column/Row 4. Add 3 horizontal and 3 vertical guides 5. Active "use gap" for both and set, e.g. 5 mm 6. Change the document unit e.g. via status bar to inch Bug: In Guides Manager, you still can see the gap size of 5, but in inch. The calculation is not applied and the guides grid is totally different on canvas. | ||||
Tags | No tags attached. | ||||
Patch | Yes | ||||
|
I tested the patch by changing document units and by switching between different documents with the same and different units. guidesmanager_2024-12-23_01.patch (1,430 bytes)
Index: scribus/ui/guidemanager.cpp =================================================================== --- scribus/ui/guidemanager.cpp (Revision 26509) +++ scribus/ui/guidemanager.cpp (Arbeitskopie) @@ -206,14 +206,16 @@ if (!page || !m_Doc) return; + // 17350: nitramr: using "docUnitIndex" works when you switch the document too + // Handle case where page to store values from does not belong // to current doc, eg. when switching between documents - const ScribusDoc* doc = page->doc(); - int unitIndex = doc->unitIndex(); + // const ScribusDoc* doc = page->doc(); + // int unitIndex = doc->unitIndex(); double gapValue = 0.0; if (horizontalAutoGapCheck->isChecked()) - gapValue = value2pts(horizontalAutoGapSpin->value(), unitIndex); + gapValue = value2pts(horizontalAutoGapSpin->value(), docUnitIndex); page->guides.setHorizontalAutoGap(gapValue); page->guides.setHorizontalAutoCount(static_cast<int>(horizontalAutoCountSpin->value())); page->guides.setHorizontalAutoRefer(horizontalRefer()); @@ -221,7 +223,7 @@ gapValue = 0.0; if (verticalAutoGapCheck->isChecked()) - gapValue = value2pts(verticalAutoGapSpin->value(), unitIndex); + gapValue = value2pts(verticalAutoGapSpin->value(), docUnitIndex); page->guides.setVerticalAutoGap(gapValue); page->guides.setVerticalAutoCount(static_cast<int>(verticalAutoCountSpin->value())); page->guides.setVerticalAutoRefer(verticalRefer()); |
|
I'm not sure how that can produce a different value? Is unitChange() not being called when the unit is changed? |
|
Each time storePageValues(ScPage *page) is called, the values of the spinboxes (“horizontalAutoGapSpin” and “verticalAutoGapSpin”) and the new unit from the document are used for the calculations. However, the unit of the two spinboxes “horizontalAutoGapSpin” and “verticalAutoGapSpin” is only updated when unitChange() is called, which happens after storePageValues(ScPage *page). By the way, setDoc() has a unitChange() call that never fires: int oldUnitIndex = docUnitIndex; if (oldUnitIndex != docUnitIndex) unitChange(); I think it should be: if (m_Doc->unitIndex() != docUnitIndex) unitChange(); |
|
martin wrote: "The calculation is not applied and the guides grid is totally different on canvas." yes, the unit conversion is not calculated for the gaps. but the rest of the calculation works. as the columns between those huge gaps becomes a negative value, it's a bit hard to see, that the rest of the calculation is correct. |
|
good catch utnik! |
|
It seems the issue occur because storePageValues() is called when doc has already got its new unit, but the unitChange() has not been executed yet in guidemanager so horizontalAutoGapSpin and verticalAutoGapSpin are still using old unit. So instead of doing this: gapValue = value2pts(horizontalAutoGapSpin->value(), unitIndex); we can do just this: gapValue = horizontalAutoGapSpin->getValue(SC_PT); |
|
Fix committed |
Date Modified | Username | Field | Change |
---|---|---|---|
2024-12-22 23:14 | nitramr | New Issue | |
2024-12-22 23:17 | nitramr | Patch | No => Yes |
2024-12-22 23:20 | nitramr | Note Added: 0051765 | |
2024-12-22 23:20 | nitramr | File Added: guidesmanager_2024-12-23_01.patch | |
2024-12-23 15:18 | cbradney | Note Added: 0051770 | |
2024-12-23 16:13 | nitramr | Note Added: 0051773 | |
2024-12-23 18:09 | utnik | Note Added: 0051775 | |
2024-12-23 21:59 | ale | Note Added: 0051776 | |
2024-12-23 22:18 | jghali | Note Added: 0051778 | |
2024-12-23 22:18 | jghali | Summary | Auto guide grid mess up when you change the document measure unit => Auto guide grid messed up when changing document measurement unit |
2024-12-23 22:21 | jghali | Assigned To | => jghali |
2024-12-23 22:21 | jghali | Status | new => resolved |
2024-12-23 22:21 | jghali | Resolution | open => fixed |
2024-12-23 22:21 | jghali | Fixed in Version | => 1.6.3.svn |
2024-12-23 22:21 | jghali | Note Added: 0051779 | |
2024-12-23 23:18 | cbradney | Status | resolved => closed |