View Issue Details

IDProjectCategoryView StatusLast Update
0010192ScribusGeneralpublic2016-04-05 07:24
Reporterbopscm Assigned Tocezaryece  
PrioritynormalSeverityfeatureReproducibilityalways
Status assignedResolutionopen 
PlatformWindowsOS2000OS Version
Product Version1.5.0svn 
Target Version1.7 milestoneFixed in Version 
Summary0010192: [Patch] Virtual page number in addition to strict page number
DescriptionIt would be a good feature if the page numbers would match the page numbers needed by the user
Eg. file page number starts from 1 to 10, but user page number is from 21 to 30 it is not displayed as of now. It would be really helpful in multiple file documents.

A small screen shot is also uploaded.

Thank you
TagsNo tags attached.
PatchYes

Relationships

related to 0012550 new Display printed page number too wherever internal page number is displayed 

Activities

ale

2011-08-17 09:48

manager  

scribus.png (5,619 bytes)
scribus.png (5,619 bytes)

ale

2011-08-17 09:53

manager   ~0026733

Last edited: 2011-08-17 09:53

View 2 revisions

i think it would be useful to let the user choose if the page number shown in the status bar, and generally in the page management, is the one counting the pages in the document or if it should take into account the page numbers defined in the sections.

depending on the project one may prefer "virtual" or the "physical" one.

it's clear that the "virtual" page numbers can't always represent all the pages in a document, since you could have several page "1" in one document.
on the other side, if you're tweaking a document, based on a print out, you will know that the picture is on page 256, which is in the 6th file, but you would not know that it's the 27th page of that document!

cezaryece

2012-06-22 13:49

developer   ~0028263

In origin/virtpagenums branch you can review solution for that feature.
Comments please...

ale

2012-06-22 22:33

manager   ~0028268

- if there is only one section starting from 1 and using cardinal numbers, i would prefer only to see the page number as is (and this is what most people will see)

- i think i would prefer a view like "2 / 1". i think that the [] are ok for programmers but not as current for most people and a / is slightly shorter.

- and i noticed that the tooltip seems to be slightly wrong. i think it should say "go to page". in my eyes, "select current page" means that i will be selecting the page which is currently active (and this does not make much sens)
but this has nothing to do with your patch...

cezaryece

2012-06-25 07:29

developer  

PageSelector.diff (6,311 bytes)
diff --git a/Scribus/scribus/scribusview.cpp b/Scribus/scribus/scribusview.cpp
index fa328ae..214e252 100644
--- a/Scribus/scribus/scribusview.cpp
+++ b/Scribus/scribus/scribusview.cpp
@@ -273,7 +273,7 @@ ScribusView::ScribusView(QWidget* win, ScribusMainWindow* mw, ScribusDoc *doc) :
 	zoomDefaultToolbarButton->setIcon(QIcon(loadIcon("16/zoom-original.png")));
 	zoomOutToolbarButton->setIcon(QIcon(loadIcon("16/zoom-out.png")));
 	zoomInToolbarButton->setIcon(QIcon(loadIcon("16/zoom-in.png")));
-	pageSelector = new PageSelector(this, Doc->Pages->count());
+	pageSelector = new PageSelector(this, Doc);
 	pageSelector->setFont(fo);
 	pageSelector->setFocusPolicy(Qt::ClickFocus);
 	layerMenu = new QComboBox( this );
diff --git a/Scribus/scribus/ui/pageselector.cpp b/Scribus/scribus/ui/pageselector.cpp
index ebc7d60..4814f4f 100644
--- a/Scribus/scribus/ui/pageselector.cpp
+++ b/Scribus/scribus/ui/pageselector.cpp
@@ -19,6 +19,7 @@ for which a new license (GPL+exception) is in place.
 #include <QPixmap>
 #include <QHBoxLayout>
 #include <QValidator>
+#include "scribusdoc.h"
 #include "sccombobox.h"
 #include "util_icon.h"
 #include "util.h"
@@ -57,10 +58,16 @@ for which a new license (GPL+exception) is in place.
 // }
 // 	
 
-PageSelector::PageSelector( QWidget* parent, int maxPg ) : QWidget( parent, 0 )
+PageSelector::PageSelector( QWidget* parent, ScribusDoc* doc ) : QWidget( parent, 0 )
 {
 	PageCountString = "%1" ;
-	LastPG = maxPg;
+	LastPG = -1;
+	m_Doc = NULL;
+	if (doc != NULL)
+	{
+		LastPG = doc->DocPages.count();
+		m_Doc = doc;
+	}
 	APage = 1;
 	PageSelectorLayout = new QHBoxLayout( this );
 	PageSelectorLayout->setMargin(0);
@@ -109,9 +116,7 @@ PageSelector::PageSelector( QWidget* parent, int maxPg ) : QWidget( parent, 0 )
 	PageCombo->setDuplicatesEnabled( false );
 	PageCombo->lineEdit()->setAlignment(Qt::AlignHCenter);
 	for (int a = 0; a < LastPG; ++a)
-	{
-		PageCombo->addItem(QString::number(a+1));
-	}
+		PageCombo->addItem(QString::number(a+1) + virtualPN(a));
 	PageCombo->setValidator(m_validator);
 	PageCombo->setMinimumSize(fontMetrics().width( "999" )+20, 20);
 	PageCombo->setFocusPolicy(Qt::ClickFocus);
@@ -189,7 +194,7 @@ void PageSelector::GotoPg(int a)
 {
 	disconnect( PageCombo, SIGNAL( activated(int) ), this, SLOT( GotoPgE(int) ) );
 	PageCombo->setCurrentIndex(a);
-	setCurrentComboItem(PageCombo, QString::number(a+1));
+	setCurrentComboItem(PageCombo, QString::number(a+1) + virtualPN(a));
 	APage = a+1;
 	Back->setEnabled(true);
 	Start->setEnabled(true);
@@ -216,10 +221,8 @@ void PageSelector::setMaximum(int a)
 //	v->setTop(LastPG);
 	m_validator->setRange(1, LastPG);
 	for (int b = 0; b < LastPG; ++b)
-	{
-		PageCombo->addItem(QString::number(b+1));
-	}
-	setCurrentComboItem(PageCombo, QString::number(APage));
+		PageCombo->addItem(QString::number(b+1) + virtualPN(b));
+	setCurrentComboItem(PageCombo, QString::number(APage) + virtualPN(APage));
 	PageCount->setText(PageCountString.arg(LastPG));
 	connect( PageCombo, SIGNAL( activated(int) ), this, SLOT( GotoPgE(int) ) );
 }
@@ -268,11 +271,12 @@ void PageSelector::languageChange()
 	Back->setToolTip( tr("Go to the previous page") );
 	Forward->setToolTip( tr("Go to the next page") );
 	Last->setToolTip( tr("Go to the last page") );
-	PageCombo->setToolTip( tr("Select the current page") );
+	PageCombo->setToolTip( tr("Go to page") );
 	PageCountString =  tr(" of %1", "number of pages in document");
 	PageCount->setText(PageCountString.arg(LastPG));
 	disconnect( PageCombo, SIGNAL( activated(int) ), this, SLOT( GotoPgE(int) ) );
-	setCurrentComboItem(PageCombo, QString::number(APage));
+
+	setCurrentComboItem(PageCombo, QString::number(APage) + virtualPN(APage));
 	connect( PageCombo, SIGNAL( activated(int) ), this, SLOT( GotoPgE(int) ) );
 }
 
@@ -280,3 +284,26 @@ void PageSelector::clearFocus()
 {
 	PageCombo->clearFocus();	
 }
+
+QString PageSelector::virtualPN(int page)
+{
+	QString res = QString();
+	if (m_Doc != NULL)
+	{
+		bool show = false;
+		DocumentSection section = m_Doc->sections().value(m_Doc->getSectionKeyForPageIndex(page));
+		if (section.active)
+		{
+			if (section.type != Type_1_2_3)
+				show = true;
+			else if (QString::number(page+1) != m_Doc->getSectionPageNumberForPageIndex(page))
+				show = true;
+		}
+		
+		if (show)
+			res = " / " + QString("%1").arg(m_Doc->getSectionPageNumberForPageIndex(page),
+											 m_Doc->getSectionPageNumberWidthForPageIndex(page),
+											 m_Doc->getSectionPageNumberFillCharForPageIndex(page));
+	}
+	return res;
+}
diff --git a/Scribus/scribus/ui/pageselector.h b/Scribus/scribus/ui/pageselector.h
index 841ceb5..b75a876 100644
--- a/Scribus/scribus/ui/pageselector.h
+++ b/Scribus/scribus/ui/pageselector.h
@@ -21,13 +21,14 @@ class QIntValidator;
 #include "styleoptions.h"
 
 class ScComboBox;
+class ScribusDoc;
 
 class SCRIBUS_API PageSelector : public QWidget
 {
 	Q_OBJECT
 
 public:
-	PageSelector( QWidget* parent, int maxPg );
+	PageSelector( QWidget* parent, ScribusDoc* doc );
 	~PageSelector() {};
 	
 	virtual void changeEvent(QEvent *e);
@@ -52,7 +53,8 @@ public:
 	QIntValidator *m_validator;
 	int LastPG;
 	int APage;
-
+	ScribusDoc* m_Doc;
+	
 public slots:
 	virtual void GotoPg(int);
 	virtual void setMaximum(int);
@@ -71,10 +73,13 @@ protected:
 	QHBoxLayout* PageSelectorLayout;
 	QLabel *PageCount;
 	QString PageCountString;
-
+	
 signals:
 	void GotoPage(int);
 
+private:
+	//returns string with "virtual" page number if it is different than "normal" page number
+	QString virtualPN(int page);
 };
 
 #endif // PAGESELECTOR_H
diff --git a/Scribus/scribus/ui/preview.cpp b/Scribus/scribus/ui/preview.cpp
index b788214..3f2cd39 100644
--- a/Scribus/scribus/ui/preview.cpp
+++ b/Scribus/scribus/ui/preview.cpp
@@ -319,7 +319,7 @@ PPreview::PPreview( QWidget* parent, ScribusView *vin, ScribusDoc *docu, QString
 	Layout6->addWidget(scaleBox);
 	QSpacerItem* spacer = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum );
 	Layout6->addItem( spacer );
-	PGSel = new PageSelector(this, doc->DocPages.count());
+	PGSel = new PageSelector(this, doc);
 	PGSel->setSizePolicy(QSizePolicy::Minimum, QSizePolicy::Minimum);
 	Layout6->addWidget(PGSel);
 	QSpacerItem* spacer2 = new QSpacerItem( 2, 2, QSizePolicy::Expanding, QSizePolicy::Minimum );
PageSelector.diff (6,311 bytes)

cezaryece

2012-06-25 07:30

developer   ~0028299

Patch attached. Provides changes with ale comments.

cbradney

2012-06-26 18:57

administrator   ~0028306

I think virtualPN is applicable elsewhere, no? Eg, exposed to scripter, perhaps in other areas.. if so please push it to ScribusDoc, what do you think?

cbradney

2012-06-26 19:00

administrator   ~0028307

ale.. the go to page tooltip is because you can type in the page you want to go to

ale

2012-06-29 15:58

manager   ~0028324

... ok, yes... never noticed it!

still, most people will be selecting the page, not typing in a number.

nut a huge issue, though...

cbradney

2012-06-29 20:50

administrator   ~0028325

That's why you should *read* the tooltip :) however, yes, it could be worded differently to indicate you can do that :)

cezaryece

2012-07-09 18:59

developer   ~0028408

Craig, usualy you are not for pushing into ScribusDoc class anything what has GUI impact. And I think in other areas there are functions for get "virtual" page number (for example for insert page number in text).

JLuc

2016-04-05 07:24

developer   ~0039805

This issue is closely related to 0012550 that proposes to keep using internal page numbers as main page identifiers, but have the displayed page number be displayed next to it, so as to improve ease of understanding and usability.

The issue with totally replacing internal page numbers with displayed page numbers (as is proposed on current page 0010192) is that different pages can have the same displayed page numbers (when in different section), or the page numbers can displayed with weird looking as iii or ABC or * ... In both of these cases it can be confusing to use displayed page numbers as page identifiers.

Issue History

Date Modified Username Field Change
2011-08-17 09:44 bopscm New Issue
2011-08-17 09:44 bopscm File Added: scribus.bmp
2011-08-17 09:48 ale File Added: scribus.png
2011-08-17 09:48 ale File Deleted: scribus.bmp
2011-08-17 09:53 ale Note Added: 0026733
2011-08-17 09:53 ale Note Edited: 0026733 View Revisions
2012-06-22 13:49 cezaryece Note Added: 0028263
2012-06-22 13:50 cezaryece Assigned To => cezaryece
2012-06-22 13:50 cezaryece Status new => assigned
2012-06-22 22:33 ale Note Added: 0028268
2012-06-25 07:29 cezaryece File Added: PageSelector.diff
2012-06-25 07:30 cezaryece Note Added: 0028299
2012-06-26 18:57 cbradney Note Added: 0028306
2012-06-26 19:00 cbradney Note Added: 0028307
2012-06-29 15:58 ale Note Added: 0028324
2012-06-29 20:50 cbradney Note Added: 0028325
2012-07-09 18:59 cezaryece Note Added: 0028408
2016-03-21 22:04 Kunda Patch => No
2016-03-21 22:04 Kunda Summary Page number => Virtual page number in addition to strict page number
2016-03-21 22:05 Kunda Patch No => Yes
2016-03-21 22:05 Kunda Summary Virtual page number in addition to strict page number => [Patch] Virtual page number in addition to strict page number
2016-03-21 22:07 Kunda Target Version => 1.7 milestone
2016-04-05 00:39 Kunda Relationship added related to 0012550
2016-04-05 00:40 Kunda Relationship replaced has duplicate 0012550
2016-04-05 07:22 JLuc Relationship replaced related to 0012550
2016-04-05 07:24 JLuc Note Added: 0039805