View Issue Details

IDProjectCategoryView StatusLast Update
0011812ScribusStory Editor / Text Framespublic2016-12-19 13:38
ReporterJLuc Assigned Tocbradney  
PrioritynormalSeverityminorReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.5.0svn 
Fixed in Version1.5.1svn 
Summary0011812: reference to item marks dont respect the secttion's defined offset for page numbers
Description"Reference to item" marks display the page number of the choosen item
but they dont take into account the section's in-the-preferences-defined offset for page numbers.

Displayed page number should be computed using the section's user defined preference for the offset in page #

Same for "references to mark" marks.
Tags#easyhack, HOST-Oman, marks, patch_tested_ok
PatchYes

Relationships

related to 0014175 confirmed Error in page number (“Reference to Mark”) when anchors are in linked text frames 
child of 0012496 acknowledged Metabug: Marks & Footnotes & Weld (1.5.0.svn) 

Activities

JLuc

2013-10-26 14:15

developer  

marks = reference to.sla (17,675 bytes)

cezaryece

2013-10-26 16:29

updater   ~0030787

Sure, I forgot.

JLuc

2013-10-26 18:22

developer   ~0030788

Last edited: 2014-12-15 12:03

now fixed in footnotes_fix git branch
See https://github.com/AlterScribus/contributors/tree/footnotes_fix
for detailed logs

logs : https://github.com/AlterScribus/contributors/compare/footnotes_fix?expand=1

anood

2015-10-22 09:21

reporter   ~0036809

I'll try to fix it

anood

anood

2015-10-26 21:19

reporter   ~0036954

hi,
I noticed that this problem happened because of marks item does not update pages , it uses the previous pages , so I tried to use the getSectionPageNumberForPageIndex in the updateMarks function as you can see in the patch file, and I noticed that updateMarks does not call when section is updated, so I tried to call it in createIcon function .
There is one problem , when I use textframe and marks (refrence to item ) in a page and I try to refer to another item in another page , it takes the first page number not the other page number .
I don't know where I can update marks item pages , and which function is responsible for that!

JLuc

2015-10-26 21:55

developer   ~0036956

I'm afraid i dont understand. Maybe somebody else will.

"marks item does not update pages" -> when should it update pages ? what pages ?

What do you mean with "previous page" ?

Why did you use createIcon specifically ?????

As for "it takes the first page number not the other page number" : it's likely that you call the getSectionPageNumberForPageIndex function with the first page index instead of the other...

« int page = destMark->OwnPage +getSectionPageNumberForPageIndex(mItem->OwnPage).toInt(); » is unpossible math adding first and other pages.
I suggest changing it into
« int page = getSectionPageNumberForPageIndex(destMark->OwnPage).toInt(); »
but i havent tried yet.

You have achieved something but more requires to be done. Marks are a powerfull feature and are worth your efforts :-)

anood

2015-10-27 05:12

reporter   ~0036966

1- What do you mean with "previous page" ?
I mean each mark saves page number , when pages are updated marks does not update their pages number .
for example if I update page number offset to 5
each marks still saves the old page number not the new one!
int page = mrk->getItemPtr()->OwnPage +1;
return the old page number .
I don't know from where I can update them.


<hr/>
2-Why did you use createIcon specifically ?????
I used backtrace for GDB to show what happened when Document Section is updated , and it shows that updateMarks() does not called after Changed page number offset, I tried to trace which functions called after Document Section
changed, I found createIcon one of them .




"marks item does not update pages" -> when should it update pages ? what pages ?
see marks.sla

I hope it's clear now :)

JLuc

2015-10-27 08:23

developer   ~0036974

OK. I think you should not call updateMarks in createIcon, because marks are not related to Icons, afaik, but call it at the same place in the code where createIcon is called, if that's a hint.
+ correct the issue you described "it takes the first page number not the other page number"

anood

2015-10-27 08:34

reporter   ~0036976

int page = mrk->getItemPtr()->OwnPage +1;

^
it returns the page number which has mark?
is this correct?

JLuc

2015-10-27 17:03

developer   ~0036993

I dont know.
Have you tried ?
What about getSectionPageNumberForPageIndex(destMark->OwnPage).toInt() ?

anood

2015-11-03 10:07

reporter  

anood

2015-11-03 10:29

reporter   ~0037173

Hello
I have uploaded new patch and a screenshot that shows my patch works fine .It seems that updateMarks() doesn't called after the changes in section's page offset. So I called it in rebuildPages() and mark page's number always get page number from section's offset number.

Regards,
Anood Almuharbi

JLuc

2015-11-03 21:28

developer   ~0037201

Last edited: 2015-11-04 15:17

Well done, it works fine !
Tested OK.
[EDIT] : works fine only when page number of type 1.2.3...

JLuc

2015-11-03 22:17

developer  

cbradney

2015-11-03 22:18

administrator   ~0037204

Unfortunately getSectionPageNumberForPageIndex is incorrect. Reviewing this with jluc

JLuc

2015-11-03 22:24

developer   ~0037206

Hmmm it's ok when page numbering uses numerals
but its not ok when page numbering uses other styles as
i,ii,iii
or a,b,c
or A,B,C
etc

toInt() is at fault since it converts all these to 0

anood

2015-11-04 04:19

reporter   ~0037210

this is another bug!, because Marks always display int value
I'll try to fix that
thanks cbradney and JLuc

JLuc

2015-11-04 15:18

developer   ~0037220

dont call toInt() so as to get i,ii,iii or a,b,c etc

anood

2015-11-04 15:50

reporter  

issue11812.patch (1,647 bytes)   
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(revision 20483)
+++ scribus/scribusdoc.cpp	(working copy)
@@ -17477,10 +17477,12 @@
 		{
 			if (mrk->getItemPtr() != NULL)
 			{
-				int page = mrk->getItemPtr()->OwnPage +1;
-				if (mrk->getString().toInt() != page)
+				QString page = getSectionPageNumberForPageIndex( mrk->getItemPtr()->OwnPage );
+				if(page.isEmpty())
+					page=QString::number(mrk->getItemPtr()->OwnPage +1);
+				if (mrk->getString() != page)
 				{
-					mrk->setString(QString("%1").arg(page));
+					mrk->setString(page);
 					if (mItem != NULL)
 					{
 						mItem->asTextFrame()->invalidateLayout(false);
@@ -17509,10 +17511,12 @@
 				else
 				{
 					destMark->OwnPage = dItem->OwnPage;
-					int page = destMark->OwnPage +1;
-					if (mrk->getString().toInt() != page)
+					QString page = getSectionPageNumberForPageIndex( destMark->OwnPage );
+					if(page.isEmpty())
+						page=QString::number(mrk->getItemPtr()->OwnPage +1);
+					if (mrk->getString() != page)
 					{
-						mrk->setString(QString("%1").arg(page));
+						mrk->setString(page);
 						if (mItem != NULL)
 						{
 							mItem->asTextFrame()->invalidateLayout(false);
Index: scribus/ui/pagepalette_pages.cpp
===================================================================
--- scribus/ui/pagepalette_pages.cpp	(revision 20483)
+++ scribus/ui/pagepalette_pages.cpp	(working copy)
@@ -290,6 +290,7 @@
 			rowcounter++;
 		}
 	}
+	currView->Doc->updateMarks(true);
 	pageView->setRowHeight(pageView->rowCount()-1, 10);
 	counter = 0;
 	if (cols != 1)
issue11812.patch (1,647 bytes)   

anood

2015-11-04 15:52

reporter   ~0037221

I have uploaded a new patch
I think it will work fine :D
thanks JLuc

Issue History

Date Modified Username Field Change
2013-10-26 14:15 JLuc New Issue
2013-10-26 14:15 JLuc File Added: marks = reference to.sla
2013-10-26 16:29 cezaryece Note Added: 0030787
2013-10-26 16:29 cezaryece Assigned To => cezaryece
2013-10-26 16:29 cezaryece Status new => confirmed
2013-10-26 16:29 cezaryece Status confirmed => assigned
2013-10-26 16:31 cezaryece Status assigned => confirmed
2013-10-26 18:22 JLuc Note Added: 0030788
2013-11-14 14:31 cezaryece Status confirmed => acknowledged
2014-01-10 17:42 JLuc Tag Attached: easyhack
2014-10-15 17:07 Kunda Tag Renamed easyhack => #easyhack
2014-12-15 11:28 JLuc Relationship added child of 0012496
2014-12-15 11:32 JLuc Assigned To cezaryece =>
2014-12-15 11:49 JLuc Note Edited: 0030788
2014-12-15 12:03 JLuc Note Edited: 0030788
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
2015-10-22 09:21 anood Note Added: 0036809
2015-10-26 21:19 anood Note Added: 0036954
2015-10-26 21:19 anood File Added: issue.patch
2015-10-26 21:55 JLuc Note Added: 0036956
2015-10-27 05:12 anood Note Added: 0036966
2015-10-27 05:13 anood File Deleted: issue.patch
2015-10-27 05:13 anood File Added: issue.patch
2015-10-27 05:14 anood File Added: marks.sla
2015-10-27 08:23 JLuc Note Added: 0036974
2015-10-27 08:34 anood Note Added: 0036976
2015-10-27 17:03 JLuc Note Added: 0036993
2015-11-03 10:07 anood File Added: Screenshot from 2015-11-03 14:05:20.png
2015-11-03 10:08 anood File Deleted: marks.sla
2015-11-03 10:08 anood File Deleted: issue.patch
2015-11-03 10:29 anood Note Added: 0037173
2015-11-03 10:30 anood File Added: issue11812.patch
2015-11-03 10:48 anood Tag Attached: HOST-Oman
2015-11-03 21:28 JLuc Note Added: 0037201
2015-11-03 21:29 JLuc Tag Attached: patch_tested_ok
2015-11-03 22:17 JLuc File Added: reference to item with offset.sla
2015-11-03 22:18 cbradney Note Added: 0037204
2015-11-03 22:24 JLuc Note Added: 0037206
2015-11-04 04:19 anood Note Added: 0037210
2015-11-04 15:17 JLuc Note Edited: 0037201
2015-11-04 15:18 JLuc Note Added: 0037220
2015-11-04 15:50 anood File Deleted: issue11812.patch
2015-11-04 15:50 anood File Added: issue11812.patch
2015-11-04 15:52 anood Note Added: 0037221
2015-11-04 18:14 Kunda Patch => Yes
2015-11-04 18:38 cbradney Assigned To => cbradney
2015-11-04 18:38 cbradney Status acknowledged => assigned
2015-11-04 22:57 cbradney Status assigned => resolved
2015-11-04 22:57 cbradney Fixed in Version => 1.5.1svn
2015-11-04 22:57 cbradney Resolution open => fixed
2016-02-13 19:51 cbradney Status resolved => closed
2016-12-19 13:33 Kunda Relationship added related to 0014175
2016-12-19 13:38 Kunda Tag Attached: marks