View Issue Details

IDProjectCategoryView StatusLast Update
0010038ScribusCanvaspublic2016-05-09 16:31
Reporterale Assigned To 
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status newResolutionopen 
Summary0010038: allow horizontal flatpans on Canvas / Arrange Pages
Descriptionallow horizontal flatpans on canvas (+ on arrange pages)

this is the way many people want to see their documents...
TagsNo tags attached.
PatchNo

Relationships

related to 0013927 assignednitramr Make better use of available horizontal space for document pages in "Arrange Pages" (display master page names on the sides) 
related to 0009948 assignedjghali Arrange pages dialog: no visual link between page and master page (1.4.03rc) 
related to 0013297 assignednitramr [Feature] Color Code Master Pages like in Layers dialog (mockup included) 

Activities

cbradney

2011-06-10 19:30

administrator   ~0026349

whats a flatpan?

ale

2011-06-11 09:51

manager   ~0026356

chemin de fer?

http://en.wikipedia.org/wiki/Flatplan

avox

2011-06-13 11:00

administrator   ~0026379

picture of a flatplan?

cezaryece

2011-06-13 11:20

updater   ~0026380

"allow horizontal" - do you mean we have vertical flatplans already?

cbradney

2011-06-13 11:35

administrator   ~0026381

Sounds like a feature request to get in the way of fixes. Bottom of the pile IMO

ale

2011-06-13 17:49

manager   ~0026389

well, we have vertical flatplans... as you can zoom out and see the pages in a vertical flow...

@cbradney: this is a common way of working for really many people in DTP...
i don't need it myself, but the wish has been expressed in an OIF-workshop in africa... it seems to be useful for them.

if it's not too much work to, i'd suggest to implement it...

ale

2011-06-13 17:54

manager   ~0026390

and on this page you can see a flatplan...
http://www.maned.com/products/classifiedlayoutsystems

cbradney

2011-06-13 18:14

administrator   ~0026391

Last edited: 2011-06-13 18:15

I believe it would be a lot of work to do on the canvas at least, given the history of working vertically, plus all the layout assumptions based on the 4 page placement types.

ale

2011-06-16 08:58

manager   ~0026410

so, let's do it only for the page management dialog...

... and maybe add a page preview in there...

would that be easier?

ale

2011-06-30 16:50

manager   ~0026503

and add a page preview to the page management?

ale

2011-08-19 20:50

manager   ~0026757

if we want previews, should we do it with multithreading?

cezaryece

2011-08-20 16:24

updater   ~0026760

Last edited: 2011-08-20 16:26

ale: I am voting for multithreading in Scribus by both hands and both legs (4 votes!), not only in this case!
But I don’t have right to vote, I am afraid.

ale

2011-08-21 09:40

manager   ~0026761

reminder to myself: http://wiki.scribus.net/canvas/Multitherad_%28Project%29

ale

2011-09-22 11:04

manager  

pagepalette_20110922.patch (11,766 bytes)   
Index: ui/pagepalette.cpp
===================================================================
--- ui/pagepalette.cpp	(revision 16845)
+++ ui/pagepalette.cpp	(working copy)
@@ -153,22 +153,35 @@
 	QTableWidget::mousePressEvent(e);
 }
 
-void SeView::mouseReleaseEvent(QMouseEvent* e)
+void SeView::mouseReleaseEvent(QMouseEvent* m)
 {
-	e->accept();
+	m->accept();
 	Mpressed = false;
-/*	if (e->button() == RightButton)
+	if (m->button() == Qt::RightButton)
 	{
-		QPopupMenu *pmen = new QPopupMenu();
-		qApp->setOverrideCursor(QCursor(Qt::ArrowCursor), true);
-		int px = pmen->insertItem( tr("Show Master Page Names"), this, SLOT(ToggleNam()));
+		QMenu *pmen = new QMenu();
+		// QPopupMenu *pmen = new QPopupMenu();
+		qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
+    QAction *px = pmen->addAction( tr("Show Master Page Names"), this, SLOT(ToggleNam()));
+		px->setCheckable(true);
 		if (Namen)
-			pmen->setItemChecked(px, true);
+			px->setChecked(true);
+
+        px = pmen->addAction( tr("Show Page Previews"), this, SLOT(toggleThumbnail()));
+		px->setCheckable(true);
+		if (Thumb)
+			px->setChecked(true);
+
+        px = pmen->addAction( tr("Horizontal view"), this, SLOT(toggleViewDirection()));
+		px->setCheckable(true);
+		if (Horizontal)
+			px->setChecked(true);
+
 		pmen->exec(QCursor::pos());
 		delete pmen;
-	} */
-	emit Click(rowAt(e->pos().y()), columnAt(e->pos().x()), e->button());
-	QTableWidget::mouseReleaseEvent(e);
+	}
+	emit Click(rowAt(m->pos().y()), columnAt(m->pos().x()), m->button());
+	QTableWidget::mouseReleaseEvent(m);
 }
 
 void SeView::ToggleNam()
@@ -183,6 +196,18 @@
 	show(); */
 }
 
+void SeView::toggleThumbnail()
+{
+	Thumb = !Thumb;
+	emit thumbnailChanged();
+}
+
+void SeView::toggleViewDirection()
+{
+	Horizontal = !Horizontal;
+	emit horizontalChanged();
+}
+
 void SeView::mouseMoveEvent(QMouseEvent* e)
 {
 	if ((Mpressed) && ((Mpos - e->pos()).manhattanLength() > 4))
@@ -234,8 +259,9 @@
 		// Fixed at least in Qt-4.4.2
 //		QApplication::restoreOverrideCursor();
 		str = e->mimeData()->text();
+		qDebug() << "str: " << str;
 		ClearPix();
-		if (str.startsWith("1"))
+		if (str.startsWith("1")) // apply a master page ("1Normal")
 		{
 			int a = rowAt(e->pos().y());
 			int b = columnAt(e->pos().x());
@@ -291,19 +317,24 @@
 				return;
 			}
 		}
-		if (str.startsWith("2"))
+		if (str.startsWith("2")) // move a page ("2 3 Normal" -> "2 pageno masterpagename")
 		{
 			int st = str.indexOf(" ");
 			int en = str.indexOf(" ", st+1);
 			tmp = str.mid(en+1);
-			int dr = str.mid(st, en-st).toInt();
-			int a = rowAt(e->pos().y());
-			int b = columnAt(e->pos().x());
+			int dr = str.mid(st, en-st).toInt(); // page being moved
+			int a = rowAt(e->pos().y()); // row of the target
+			int b = columnAt(e->pos().x()); // column of the target
+			qDebug() << "en: " << en;
+			qDebug() << "dr: " << dr;
+			qDebug() << "a: " << a;
+			qDebug() << "b: " << b;
 			int p;
 			if ((a == -1) || (b == -1))
 				return;
 			QTableWidgetItem* ite = item(a, b);
-			p = GetPage(a, b, &lastPage);
+			p = GetPage(a, b, &lastPage); // target page
+			qDebug() << "p: " << p;
 			if (a == rowCount()-1)
 			{
 				emit movePage(dr, p+1);
@@ -441,6 +472,32 @@
 
 int SeView::GetPage(int r, int c, bool *last)
 {
+	if (Horizontal)
+		return GetPageHorizontal(r, c, last);
+	else
+		return GetPageVertical(r, c, last);
+}
+
+int SeView::GetPageHorizontal(int r, int c, bool *last)
+{
+	int ret = MaxC;
+	*last = false;
+	// qDebug() << "c: " << c;
+	// qDebug() << "columnCount: " << columnCount();
+	// qDebug() << "ret: " << ret;
+	if (c >= columnCount() - 1)
+	{
+		*last = true;
+	} else if (c % 2 == 0)
+		ret = c / 2;
+	else 
+		ret = (c - 1) / 2;
+	// qDebug() << "ret: " << ret;
+	return ret;
+}
+
+int SeView::GetPageVertical(int r, int c, bool *last)
+{
 	int counter = firstP;
 	int rowcounter = 0;
 	int ret = MaxC;
@@ -553,6 +610,7 @@
 	Layout2->setSpacing(5);
 	TextLabel1 = new QLabel( privateLayoutWidget );
 	Layout2->addWidget( TextLabel1 );
+    // master pages
 	masterPageList = new SeList(privateLayoutWidget);
 	masterPageList->setMinimumSize(QSize(130,70));
 	masterPageList->Thumb = false;
@@ -564,6 +622,7 @@
 	Layout3->setSpacing(5);
 	TextLabel2 = new QLabel( privateLayoutWidget_2 );
 	Layout3->addWidget( TextLabel2 );
+    // pages
 	pageView = new SeView(privateLayoutWidget_2);
 	QHeaderView *Header = pageView->verticalHeader();
 	Header->setMovable(false);
@@ -579,6 +638,10 @@
 	pageView->setColumnCount(1);
 	pageView->setIconSize(QSize(60, 60));
 	pageView->setMinimumSize(QSize(130,120));
+	pageView->Namen = false;
+	pageView->Thumb = false;
+	pageView->Horizontal = true; // @xxx: only for debugging purposes; othwerise to false or prefs (ale)
+	// pageView->setShowGrid(true); // @xxx: only for debugging purposes (ale)
 	Layout3->addWidget( pageView );
 	PagePaletteLayout->addWidget( Splitter1 );
 
@@ -628,6 +691,8 @@
 	connect(Trash, SIGNAL(DelPage(int)), m_scMW, SLOT(DeletePage2(int)));
 	connect(pageView, SIGNAL(DelPage(int)), m_scMW, SLOT(DeletePage2(int)));
 	connect(this, SIGNAL(gotoPage(int)), m_scMW, SLOT(selectPagesFromOutlines(int)));
+	connect(pageView, SIGNAL(thumbnailChanged()), this, SLOT(rebuildPages()));
+	connect(pageView, SIGNAL(horizontalChanged()), this, SLOT(rebuildPages()));
 }
 
 void PagePalette::deleteMasterPage(QString tmp)
@@ -687,9 +752,12 @@
 {
 	int p;
 	bool dummy;
+	// qDebug() << "r: " << r;
+	// qDebug() << "c: " << c;
 	if ((b == Qt::LeftButton) && (r != -1) && (c != -1))
 	{
 		p = pageView->GetPage(r, c, &dummy);
+		// qDebug() << "p: " << p;
 		emit gotoPage(p);
 	}
 }
@@ -754,7 +822,7 @@
 	disconnect(pageLayout, SIGNAL(selectedLayout(int )), this, SLOT(handlePageLayout(int )));
 	disconnect(pageLayout, SIGNAL(selectedFirstPage(int )), this, SLOT(handleFirstPage(int )));
 	pageView->clearContents();
-	pageView->setRowCount(1);
+	pageView->setRowCount(1); // why not 0? (ale/20110916)
 	pageView->setColumnCount(1);
 	if (currView == 0)
 	{
@@ -766,15 +834,25 @@
 	pageLayout->selectItem(currView->Doc->pagePositioning());
 	pageLayout->firstPage->setCurrentIndex(currView->Doc->pageSets()[currView->Doc->pagePositioning()].FirstPage);
 	pageView->MaxC = currView->Doc->DocPages.count()-1;
+	// counter [0] [1|0] [0|1|2] [0|1|2|3]
 	int counter = currView->Doc->pageSets()[currView->Doc->pagePositioning()].FirstPage;
+	// in horizontal mode cols and rows will be used switched
 	int cols = currView->Doc->pageSets()[currView->Doc->pagePositioning()].Columns;
 	int rows = (currView->Doc->DocPages.count()+counter) / currView->Doc->pageSets()[currView->Doc->pagePositioning()].Columns;
 	if (((currView->Doc->DocPages.count()+counter) % currView->Doc->pageSets()[currView->Doc->pagePositioning()].Columns) != 0)
 		rows++;
 	int rowcounter = 0;
 	int colmult, rowmult, coladd, rowadd;
-	if (cols == 1)
+	if (pageView->Horizontal)
 	{
+		pageView->setColumnCount((currView->Doc->DocPages.count() * 2) + 1);
+		pageView->setRowCount(1);
+		colmult = 1;
+		coladd = 0;
+		rowmult = 2;
+		rowadd = 1;
+	} else if (cols == 1)
+	{
 		pageView->setColumnCount(cols);
 		pageView->setRowCount(rows*2+1);
 		colmult = 1;
@@ -805,41 +883,80 @@
 	pageView->rowadd = rowadd;
 	pageView->rowmult = rowmult;
 	pageView->firstP = counter;
+	// why not "pageView->cols = cols"? (ale/20110921)
 	pageView->cols = currView->Doc->pageSets()[currView->Doc->pagePositioning()].Columns;
 	pageList.clear();
-	for (int a = 0; a < currView->Doc->DocPages.count(); ++a)
+	QPixmap ppix = pix;
+	if (pageView->Horizontal)
 	{
-		str = currView->Doc->DocPages.at(a)->MPageNam;
-		SeItem *it = new SeItem(str, a, CreateIcon(a, pix));
-		pageList.append(it);
-		pageView->setItem(rowcounter*rowmult+rowadd, counter*colmult+coladd, (QTableWidgetItem *)it);
-		pageView->setColumnWidth(counter*colmult+coladd, pix.width());
-		if (cols == 1)
+		// qDebug() << "firstP: " << pageView->firstP;
+		int spread = pageView->cols;
+		for (int i = 0; i < currView->Doc->DocPages.count(); ++i)
 		{
-			pageView->setRowHeight(rowcounter*rowmult, 10);
-			pageView->setRowHeight(rowcounter*rowmult+rowadd, pix.height());
+			int j = i * 2;
+			str = currView->Doc->DocPages.at(i)->MPageNam;
+			SeItem *it;
+			// @todo: the icons must be updated when leaving the current page (ale/20110921)
+			if (pageView->Thumb)
+				ppix = QPixmap::fromImage(currView->PageToPixmap(i, 60));
+			it = new SeItem(str, i, CreateIcon(i, ppix));
+			pageList.append(it);
+			pageView->setItem(0, j + 1, (QTableWidgetItem *)it);
+			pageView->setColumnWidth(j, 10);
+			pageView->setColumnWidth(j + 1, ppix.width());
+			if (spread > 1)
+			{
+				int k = (i + pageView->firstP) % spread;
+				// qDebug() << "k: " << k;
+				if (k == 0)
+				{
+					it->setTextAlignment(Qt::AlignLeft);
+					pageView->setColumnWidth(j, 20);
+				}
+				else if (k == spread -1)
+					it->setTextAlignment(Qt::AlignRight);
+				else
+					it->setTextAlignment(Qt::AlignHCenter);
+			}
 		}
-		else
-			pageView->setRowHeight(rowcounter*rowmult+rowadd, pix.height()+5);
-		counter++;
-		if (counter > currView->Doc->pageSets()[currView->Doc->pagePositioning()].Columns-1)
+		pageView->setColumnWidth(0, 10); // the first column is always 10px wide
+		pageView->setColumnWidth(currView->Doc->DocPages.count() * 2, 10);
+		pageView->setRowHeight(0, ppix.height());
+	} else {
+		for (int a = 0; a < currView->Doc->DocPages.count(); ++a)
 		{
-			counter = 0;
-			rowcounter++;
-		}
-	}
-	pageView->setRowHeight(pageView->rowCount()-1, 10);
-	counter = 0;
-	if (cols != 1)
-	{
-		for (int c = 0; c < pageView->columnCount(); ++c)
-		{
-			if ((counter % 2) == 0)
-				pageView->setColumnWidth(counter, 10);
+			str = currView->Doc->DocPages.at(a)->MPageNam;
+			SeItem *it = new SeItem(str, a, CreateIcon(a, pix));
+			pageList.append(it);
+			pageView->setItem(rowcounter*rowmult+rowadd, counter*colmult+coladd, (QTableWidgetItem *)it);
+			pageView->setColumnWidth(counter*colmult+coladd, pix.width());
+			if (cols == 1)
+			{
+				pageView->setRowHeight(rowcounter*rowmult, 10);
+				pageView->setRowHeight(rowcounter*rowmult+rowadd, pix.height());
+			}
 			else
-				pageView->setColumnWidth(counter, pix.width());
+				pageView->setRowHeight(rowcounter*rowmult+rowadd, pix.height()+5);
 			counter++;
+			if (counter > currView->Doc->pageSets()[currView->Doc->pagePositioning()].Columns-1)
+			{
+				counter = 0;
+				rowcounter++;
+			}
 		}
+		pageView->setRowHeight(pageView->rowCount()-1, 10);
+		counter = 0;
+		if (cols != 1)
+		{
+			for (int c = 0; c < pageView->columnCount(); ++c)
+			{
+				if ((counter % 2) == 0)
+					pageView->setColumnWidth(counter, 10);
+				else
+					pageView->setColumnWidth(counter, pix.width());
+				counter++;
+			}
+		}
 	}
 	pageView->repaint();
 	if (currView != 0)
Index: ui/pagepalette.h
===================================================================
--- ui/pagepalette.h	(revision 16845)
+++ ui/pagepalette.h	(working copy)
@@ -102,6 +102,8 @@
 
 public slots:
 	void ToggleNam();
+	void toggleThumbnail();
+	void toggleViewDirection();
 
 signals:
 	void UseTemp(QString, int);
@@ -109,6 +111,8 @@
 	void movePage(int, int);
 	void Click(int, int, int);
 	void DelPage(int);
+	void thumbnailChanged();
+	void horizontalChanged();
 
 protected:
 	virtual void dropEvent(QDropEvent * e);
@@ -119,12 +123,16 @@
 	virtual void mousePressEvent(QMouseEvent* e);
 	virtual void mouseMoveEvent(QMouseEvent* e);
 	virtual void keyPressEvent(QKeyEvent* e);
+	int GetPageVertical(int r, int c, bool *last);
+	int GetPageHorizontal(int r, int c, bool *last);
 	
 	QPoint Mpos;
 	bool Mpressed;
+	bool Thumb;
+	bool Namen;
+	bool Horizontal;
 	bool Doppel;
 	bool Links;
-	bool Namen;
 	int MaxC;
 	int colmult;
 	int rowmult;
pagepalette_20110922.patch (11,766 bytes)   

ale

2011-09-22 11:08

manager   ~0026898

first version of the "arrange pages" rework with
- horizontal view
- preview of the pages
see it in action here: http://www.youtube.com/watch?v=W1UBGXALMws

now we need some brilliant ideas on how to make it awesome!

Issue History

Date Modified Username Field Change
2011-06-10 09:50 ale New Issue
2011-06-10 17:33 ale Summary allo horizontal flatpans on canvas => allow horizontal flatpans on canvas
2011-06-10 19:30 cbradney Note Added: 0026349
2011-06-11 09:51 ale Note Added: 0026356
2011-06-13 11:00 avox Note Added: 0026379
2011-06-13 11:20 cezaryece Note Added: 0026380
2011-06-13 11:35 cbradney Note Added: 0026381
2011-06-13 17:49 ale Note Added: 0026389
2011-06-13 17:54 ale Note Added: 0026390
2011-06-13 18:14 cbradney Note Added: 0026391
2011-06-13 18:15 cbradney Note Edited: 0026391
2011-06-16 08:58 ale Note Added: 0026410
2011-06-30 16:50 ale Note Added: 0026503
2011-08-19 20:50 ale Note Added: 0026757
2011-08-20 16:24 cezaryece Note Added: 0026760
2011-08-20 16:26 cezaryece Note Edited: 0026760
2011-08-21 09:40 ale Note Added: 0026761
2011-09-22 11:04 ale File Added: pagepalette_20110922.patch
2011-09-22 11:08 ale Note Added: 0026898
2016-05-09 16:29 Kunda Relationship added related to 0013927
2016-05-09 16:30 Kunda Patch => No
2016-05-09 16:30 Kunda Summary allow horizontal flatpans on canvas => allow horizontal flatpans on Canvas / Arrange Pages
2016-05-09 16:31 Kunda Relationship added related to 0009948
2016-05-09 16:31 Kunda Relationship added related to 0013297