View Issue Details

IDProjectCategoryView StatusLast Update
0016622ScribusGeneralpublic2023-09-11 20:34
Reportercyberlizard Assigned Tonitramr  
PrioritynormalSeverityfeatureReproducibilityhave not tried
Status closedResolutionfixed 
Product Version1.5.7 
Target Version1.7.0Fixed in Version1.7.0.svn 
Summary0016622: arrange pages > page previews
DescriptionWhen displaying page previews, the ability to actually see the preview does not work for document pages (it does work for master pages, though the thumbnails are extremely small)
TagsNo tags attached.
PatchNo

Relationships

has duplicate 0014847 closednitramr Thumbnails of Pages in Arrange Pages Palette 

Activities

nitramr

2023-07-04 19:39

developer   ~0050259

The patch file contains a new page arrange widget with page previews.
arrange_pages_2023-07-04_01.patch (119,688 bytes)   
Index: resources/iconsets/1_7_0/1_7_0.xml
===================================================================
--- resources/iconsets/1_7_0/1_7_0.xml	(Revision 25541)
+++ resources/iconsets/1_7_0/1_7_0.xml	(Arbeitskopie)
@@ -365,6 +365,10 @@
 		<icon id="/16/list-remove.png" file="16/action-remove.svg" />
 		<icon id="16/list-remove.png" file="16/action-remove.svg" />
 		<icon id="22/list-remove.png" file="16/action-remove.svg" />
+		<icon id="page-move" file="16/page-move.svg" />
+		<icon id="page-insert" file="16/page-insert.svg" />
+		<icon id="page-duplicate" file="16/page-duplicate.svg" />
+		<icon id="page-import" file="16/page-import.svg" />
     
 		<!-- PDF Tools -->
 		<icon id="16/insert-button.png" file="16/pdf-button.svg" />
Index: scribus/appmodehelper.cpp
===================================================================
--- scribus/appmodehelper.cpp	(Revision 25541)
+++ scribus/appmodehelper.cpp	(Arbeitskopie)
@@ -283,7 +283,6 @@
 					a_actMgr->saveActionShortcutsPreEditMode();
 				if (currItem != nullptr)
 				{
-					currItem->itemText.setCursorPosition(0);
 					scmw->setTBvals(currItem);
 				}
 				(*a_scrActions)["editPaste"]->setEnabled(false);
Index: scribus/canvasgesture_resize.cpp
===================================================================
--- scribus/canvasgesture_resize.cpp	(Revision 25541)
+++ scribus/canvasgesture_resize.cpp	(Arbeitskopie)
@@ -231,6 +231,7 @@
 			m_doc->invalidateRegion(m_mousePressBounds.united(m_bounds));
 			m_doc->regionsChanged()->update(m_mousePressBounds.united(m_bounds));
 			m_doc->changed();
+			m_doc->changedPagePreview();
 		}
 	}
 	if (m_transaction.isStarted())
Index: scribus/canvasmode.cpp
===================================================================
--- scribus/canvasmode.cpp	(Revision 25541)
+++ scribus/canvasmode.cpp	(Arbeitskopie)
@@ -202,6 +202,7 @@
 			result = new CanvasMode_Normal(view);
 			break;
 	}
+
 	return result;
 }
 
@@ -1745,12 +1746,13 @@
 						currItem->ContourLine.translate(xposOrig - currItem->xPos(),yposOrig - currItem->yPos());
 					m_doc->nodeEdit.finishTransaction(currItem);
 					currItem->update();
-					m_doc->regionsChanged()->update(currItem->getVisualBoundingRect());
+					m_doc->regionsChanged()->update(currItem->getVisualBoundingRect());					
 				}
 				for (int i = 0; i < docSelectionCount; ++i)
 					m_doc->m_Selection->itemAt(i)->checkChanges(true);
 				if (docSelectionCount > 1 && m_view->groupTransactionStarted())
 					m_view->endGroupTransaction();
+				m_doc->changedPagePreview();
 			}
 			break;
 	}
Index: scribus/canvasmode.h
===================================================================
--- scribus/canvasmode.h	(Revision 25541)
+++ scribus/canvasmode.h	(Arbeitskopie)
@@ -19,6 +19,7 @@
 #define CANVAS_MODE_H
 
 #include "scribusapi.h"
+#include "scribusdoc.h"
 
 #include <QBrush>
 #include <QCursor>
Index: scribus/canvasmode_copyproperties.cpp
===================================================================
--- scribus/canvasmode_copyproperties.cpp	(Revision 25541)
+++ scribus/canvasmode_copyproperties.cpp	(Arbeitskopie)
@@ -203,6 +203,7 @@
 		// Update Item
 		m_doc->ElemToLink = currItem;
 		currItem->update();
+		m_doc->changedPagePreview();
 //		emit DocChanged();
 //		m_view->updateContents();
 	}
Index: scribus/canvasmode_create.cpp
===================================================================
--- scribus/canvasmode_create.cpp	(Revision 25541)
+++ scribus/canvasmode_create.cpp	(Arbeitskopie)
@@ -403,6 +403,7 @@
 									Um::Create + " " + currItem->getUName(),  "", Um::ICreate);
 		m_createTransaction.reset();
 		m_doc->changed();
+		m_doc->changedPagePreview();
 		/*currItem->update();
 		currItem->emitAllToGUI();*/
 	}
Index: scribus/canvasmode_drawbezier.cpp
===================================================================
--- scribus/canvasmode_drawbezier.cpp	(Revision 25541)
+++ scribus/canvasmode_drawbezier.cpp	(Arbeitskopie)
@@ -198,6 +198,7 @@
 		else
 			m_view->requestMode(m_doc->appMode);
 		m_doc->changed();
+		m_doc->changedPagePreview();
 		m_firstPoly = true;
 		m_inItemCreation = false;
 		m_canvas->setRenderModeUseBuffer(false);
@@ -426,6 +427,7 @@
 		else
 			m_view->requestMode(m_doc->appMode);
 		m_doc->changed();
+		m_doc->changedPagePreview();
 //		emit DocChanged();
 		m_firstPoly = true;
 		m_inItemCreation = false;
Index: scribus/canvasmode_drawcalligraphic.cpp
===================================================================
--- scribus/canvasmode_drawcalligraphic.cpp	(Revision 25541)
+++ scribus/canvasmode_drawcalligraphic.cpp	(Arbeitskopie)
@@ -276,6 +276,7 @@
 			//FIXME	
 			m_canvas->m_viewMode.operItemResizing = false;
 			m_doc->changed();
+			m_doc->changedPagePreview();
 		}
 		if (!PrefsManager::instance().appPrefs.uiPrefs.stickyTools)
 		{
Index: scribus/canvasmode_drawfreehand.cpp
===================================================================
--- scribus/canvasmode_drawfreehand.cpp	(Revision 25541)
+++ scribus/canvasmode_drawfreehand.cpp	(Arbeitskopie)
@@ -262,6 +262,7 @@
 			//FIXME	
 			m_canvas->m_viewMode.operItemResizing = false;
 			m_doc->changed();
+			m_doc->changedPagePreview();
 		}
 		if (!PrefsManager::instance().appPrefs.uiPrefs.stickyTools)
 		{
Index: scribus/canvasmode_edit.cpp
===================================================================
--- scribus/canvasmode_edit.cpp	(Revision 25541)
+++ scribus/canvasmode_edit.cpp	(Arbeitskopie)
@@ -144,8 +144,38 @@
 	m_keyRepeat = false;
 }
 
+void CanvasMode_Edit::keyReleaseEvent(QKeyEvent *e)
+{
+	PageItem* currItem;
+	if (!GetItem(&currItem))
+	{
+		return;
+	}
 
+	if (currItem->isImageFrame() && !currItem->locked())
+	{
+		switch (e->key())
+		{
+			case Qt::Key_Up:
+			case Qt::Key_Down:
+			case Qt::Key_Left:
+			case Qt::Key_Right:
+				m_doc->changedPagePreview();
+				break;
+			default:
+				break;
+		}
+	}
 
+	if (currItem->isTextFrame())
+	{
+		m_doc->changedPagePreview();
+	}
+
+}
+
+
+
 void CanvasMode_Edit::rulerPreview(double base, double xp)
 {
 	PageItem* currItem;
@@ -284,8 +314,8 @@
 			{
 				m_blinker->start(200);
 				m_blinkTime.start();
-				m_cursorVisible = true;
-				blinkTextCursor();
+				m_cursorVisible = true;				
+				blinkTextCursor();				
 			}
 		}
 	}
@@ -742,6 +772,8 @@
 			m_canvas->m_viewMode.operItemResizing = false;
 			if (currItem->isLine())
 				m_view->updateContents();
+			if (currItem->isImageFrame())
+				m_doc->changedPagePreview();
 		}
 		if (m_canvas->m_viewMode.operItemMoving)
 		{
@@ -828,6 +860,7 @@
 			//currItem->emitAllToGUI();
 			m_view->updatesOn(true);
 			m_view->updateContents();
+			m_doc->changedPagePreview();
 		}
 	}
 	//CB Drag selection performed here
@@ -892,6 +925,7 @@
 			m_canvas->m_viewMode.operItemMoving = false;
 			m_canvas->m_viewMode.operItemResizing = false;
 			m_view->updateContents(QRect(static_cast<int>(x-5), static_cast<int>(y-5), static_cast<int>(w+10), static_cast<int>(h+10)));
+
 		}
 		/*else
 			currItem->emitAllToGUI();*/
Index: scribus/canvasmode_edit.h
===================================================================
--- scribus/canvasmode_edit.h	(Revision 25541)
+++ scribus/canvasmode_edit.h	(Arbeitskopie)
@@ -52,6 +52,7 @@
 	void mousePressEvent(QMouseEvent *m) override;
 	
 	void keyPressEvent(QKeyEvent *e) override;
+	void keyReleaseEvent(QKeyEvent *e) override;
 
 	void drawControls(QPainter* p) override;
 
Index: scribus/canvasmode_normal.cpp
===================================================================
--- scribus/canvasmode_normal.cpp	(Revision 25541)
+++ scribus/canvasmode_normal.cpp	(Arbeitskopie)
@@ -1101,6 +1101,7 @@
 			m_view->updatesOn(true);
 			m_view->updateContents();
 			m_doc->changed();
+			m_doc->changedPagePreview();
 		}
 	}
 
Index: scribus/gtaction.cpp
===================================================================
--- scribus/gtaction.cpp	(Revision 25541)
+++ scribus/gtaction.cpp	(Arbeitskopie)
@@ -840,6 +840,7 @@
 		m_textFrame->doc()->docHyphenator->slotHyphenate(m_textFrame);
 	m_textFrame->doc()->regionsChanged()->update(QRectF());
 	m_textFrame->doc()->changed();
+	m_textFrame->doc()->changedPagePreview();
 }
 
 gtAction::~gtAction()
Index: scribus/pageitem_textframe.cpp
===================================================================
--- scribus/pageitem_textframe.cpp	(Revision 25541)
+++ scribus/pageitem_textframe.cpp	(Arbeitskopie)
@@ -5880,4 +5880,5 @@
 	invalid = true;
 	m_Doc->changed();
 	m_Doc->regionsChanged()->update(QRect());
+	m_Doc->changedPagePreview();
 }
Index: scribus/plugins/short-words/shortwords.cpp
===================================================================
--- scribus/plugins/short-words/shortwords.cpp	(Revision 25541)
+++ scribus/plugins/short-words/shortwords.cpp	(Arbeitskopie)
@@ -142,7 +142,10 @@
 		} // switch
 		// enable "Save" icon
 		if (parse->modify > 0)
+		{
 			doc->changed();
+			doc->changedPagePreview();
+		}
 		delete parse;
 		// redraw document
 		doc->view()->DrawNew();
Index: scribus/plugins/tools/2geomtools/meshdistortion/meshdistortion.cpp
===================================================================
--- scribus/plugins/tools/2geomtools/meshdistortion/meshdistortion.cpp	(Revision 25541)
+++ scribus/plugins/tools/2geomtools/meshdistortion/meshdistortion.cpp	(Arbeitskopie)
@@ -132,6 +132,7 @@
 			}
 			m_doc->changed();
 			m_doc->view()->DrawNew();
+			m_doc->changedPagePreview();
 		}
 		delete dia;
 	}
Index: scribus/plugins/tools/2geomtools/pathalongpath/pathalongpath.cpp
===================================================================
--- scribus/plugins/tools/2geomtools/pathalongpath/pathalongpath.cpp	(Revision 25541)
+++ scribus/plugins/tools/2geomtools/pathalongpath/pathalongpath.cpp	(Arbeitskopie)
@@ -228,6 +228,7 @@
 			{
 				updateEffectG(dia->effectType, dia->offset, dia->offsetY, dia->gap, dia->rotate);
 				m_doc->changed();
+				m_doc->changedPagePreview();
 				if (bxi->isGroup())
 				{
 					m_doc->resizeGroupToContents(bxi);
@@ -267,6 +268,7 @@
 				updateEffect(dia->effectType, dia->offset, dia->offsetY, dia->gap, dia->rotate);
 				patternItem->ContourLine = patternItem->PoLine.copy();
 				m_doc->changed();
+				m_doc->changedPagePreview();
 			}
 			else
 			{
Index: scribus/scribus.cpp
===================================================================
--- scribus/scribus.cpp	(Revision 25541)
+++ scribus/scribus.cpp	(Arbeitskopie)
@@ -2761,6 +2761,11 @@
 	}
 }
 
+void ScribusMainWindow::slotPreviewCh()
+{
+	pagePalette->updatePagePreviews();
+}
+
 void ScribusMainWindow::updateRecent(const QString& fn)
 {
 	if (m_recentDocsList.indexOf(fn) != -1)
@@ -2945,6 +2950,7 @@
 			pasteAction.commit();
 	}
 	slotDocCh(false);
+	slotPreviewCh();
 	doc->regionsChanged()->update(QRectF());
 	view->dragX = 0;
 	view->dragY = 0;
@@ -4453,6 +4459,7 @@
 		doc->itemSelection_DeleteItem();
 	}
 	slotDocCh();
+	slotPreviewCh();
 	scrActions["editPaste"]->setEnabled(true);
 	scrMenuMgr->setMenuEnabled("EditPasteRecent", scrapbookPalette->tempBView->objectMap.count() != 0);
 	if (activeTransaction)
@@ -4811,6 +4818,7 @@
 
 	view->DrawNew();
 	slotDocCh(false);
+	slotPreviewCh();
 }
 
 //CB-->Doc ?????
@@ -7124,18 +7132,24 @@
 		doc->cmsSettings().GamutCheck = false;
 		doc->enableCMS(true);
 	}
-	pageNumbersSize = pageNs.size();
-	for (uint i = 0; i < pageNumbersSize; ++i)
-	{
-		QImage thumb(10, 10, QImage::Format_ARGB32_Premultiplied);
-		if (doc->pdfOptions().Thumbnails)
-		{
-			// No need to load full res images for drawing small thumbnail
-			PageToPixmapFlags flags = Pixmap_DontReloadImages | Pixmap_DrawWhiteBackground;
-			thumb = view->PageToPixmap(pageNs[i] - 1, 100, flags);
-		}
-		allThumbs.insert(pageNs[i], thumb);
-	}
+
+// MR: The following code has been replaced by view->PagesToPixmap(100, -1, flags);
+//	pageNumbersSize = pageNs.size();
+//	for (uint i = 0; i < pageNumbersSize; ++i)
+//	{
+//		QImage thumb(10, 10, QImage::Format_ARGB32_Premultiplied);
+//		if (doc->pdfOptions().Thumbnails)
+//		{
+//			// No need to load full res images for drawing small thumbnail
+//			PageToPixmapFlags flags = Pixmap_DontReloadImages | Pixmap_DrawWhiteBackground;
+//			thumb = view->PageToPixmap(pageNs[i] - 1, 100, flags);
+//		}
+//		allThumbs.insert(pageNs[i], thumb);
+//	}
+
+	PageToPixmapFlags flags = Pixmap_DontReloadImages | Pixmap_DrawWhiteBackground;
+	allThumbs = view->PagesToPixmap(100, -1, flags);
+
 	if (cmsCorr)
 	{
 		doc->cmsSettings().GamutCheck = true;
Index: scribus/scribus.h
===================================================================
--- scribus/scribus.h	(Revision 25541)
+++ scribus/scribus.h	(Arbeitskopie)
@@ -465,6 +465,8 @@
 	void HaveNewSel();
 	/** Dokument ist geaendert worden */
 	void slotDocCh(bool reb = true);
+	/** Page preview changed */
+	void slotPreviewCh();
 	/** Setzt die Abstufung */
 	//void setItemShade(int id);
 	/** Setz die Zeichensatzgroesse */
Index: scribus/scribusdoc.cpp
===================================================================
--- scribus/scribusdoc.cpp	(Revision 25541)
+++ scribus/scribusdoc.cpp	(Arbeitskopie)
@@ -1590,6 +1590,7 @@
 	--m_undoRedoOngoing;
 	m_Selection->delaySignalsOff();
 	m_docUpdater->endUpdate();
+	changedPagePreview();
 }
 
 void ScribusDoc::restore(UndoState* state, bool isUndo)
@@ -2508,7 +2509,10 @@
 	MasterPages.insert(pgN, addedPage);
 	assert(MasterPages.at(pgN) != nullptr);
 	if (!isLoading())
+	{
 		changed();
+		changedPagePreview();
+	}
 	if (UndoManager::undoEnabled())
 	{
 		auto *ss = new SimpleState(Um::NewMasterPage, "", Um::IDocument);
@@ -2830,6 +2834,7 @@
 	}
 	sourceSelection.clear();
 	changed();
+	changedPagePreview();
 }
 
 
@@ -2867,6 +2872,7 @@
 	}
 
 	changed();
+	changedPagePreview();
 	return true;
 }
 
@@ -2958,7 +2964,10 @@
 		}
 	}
 	if (found)
+	{
 		changed();
+		changedPagePreview();
+	}
 	return found;
 }
 
@@ -3076,6 +3085,7 @@
 			invalidateLayer(it->ID);
 		}
 		changed();
+		changedPagePreview();
 	}
 	return found;
 }
@@ -3116,7 +3126,10 @@
 		}
 	}
 	if (found)
+	{
 		changed();
+		changedPagePreview();
+	}
 	return found;
 }
 
@@ -3156,7 +3169,10 @@
 		}
 	}
 	if (found)
+	{
 		changed();
+		changedPagePreview();
+	}
 	return found;
 }
 
@@ -3187,7 +3203,10 @@
 		}
 	}
 	if (found)
+	{
 		changed();
+		changedPagePreview();
+	}
 	return found;
 }
 
@@ -4664,7 +4683,10 @@
 	}
 	//TODO make a return false if not possible to apply the master page
 	if (!isLoading())
+	{
 		changed();
+		changedPagePreview();
+	}
 	return true;
 }
 
@@ -4802,6 +4824,7 @@
 	invalidateRegion(pagebox);
 	regionsChanged()->update(pagebox);
 	changed();
+	changedPagePreview();
 
 	return true;
 }
@@ -5436,8 +5459,9 @@
 	if (transaction)
 		transaction.commit();
 	setCurrentPage(oldCurrentPage);
-	changed();
+	changed();	
 	regionsChanged()->update(QRectF());
+	changedPagePreview();
 	return z;
 }
 
@@ -5659,6 +5683,7 @@
 	{
 		pageItem->update();
 		changed();
+		changedPagePreview();
 	}
 	return true;
 }
@@ -6156,6 +6181,7 @@
 		FPoint maxSize(qMax(maxXPos, maxPoint.x() + scratch.right()), qMax(maxYPos, maxPoint.y() + scratch.bottom()));
 		adjustCanvas(FPoint(qMin(0.0, minPoint.x() - scratch.left()), qMin(0.0, minPoint.y() - scratch.top())), maxSize, true);
 		changed();
+		changedPagePreview();
 	}
 	else
 	{
@@ -7415,6 +7441,7 @@
 		}
 	}
 	changed();
+	changedPagePreview();
 	invalidateRegion(selRect);
 	regionsChanged()->update(QRectF());
 }
@@ -7482,6 +7509,7 @@
 		}
 	}
 	changed();
+	changedPagePreview();
 	invalidateRegion(selRect);
 	regionsChanged()->update(QRectF());
 }
@@ -7554,6 +7582,7 @@
 	*m_Selection = tempSelection;
 	m_Selection->delaySignalsOff();
 	changed();
+	changedPagePreview();
 	invalidateRegion(selRect);
 	regionsChanged()->update(QRectF());
 }
@@ -7628,6 +7657,7 @@
 	*m_Selection = tempSelection;
 	m_Selection->delaySignalsOff();
 	changed();
+	changedPagePreview();
 	invalidateRegion(selRect);
 	regionsChanged()->update(QRectF());
 }
@@ -7665,6 +7695,7 @@
 		activeTransaction.commit();
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 
 }
 
@@ -7700,6 +7731,7 @@
 		activeTransaction.commit();
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 
@@ -7724,6 +7756,7 @@
 		activeTransaction.commit();
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 
@@ -7749,6 +7782,7 @@
 		activeTransaction.commit();
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 
@@ -7774,6 +7808,7 @@
 		activeTransaction.commit();
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetLineSpacing(double w, Selection* customSelection)
@@ -7877,6 +7912,7 @@
 		activeTransaction.commit();
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetNamedCellStyle(const QString & name, Selection* customSelection)
@@ -7903,6 +7939,7 @@
 		activeTransaction.commit();
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetNamedTableStyle(const QString & name, Selection* customSelection)
@@ -7929,6 +7966,7 @@
 		activeTransaction.commit();
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetItemPen(QString color, Selection* customSelection)
@@ -7959,6 +7997,7 @@
 		activeTransaction.commit();
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetParBackgroundColor(QString farbe, Selection* customSelection)
@@ -8103,6 +8142,7 @@
 		activeTransaction.commit();
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetItemBrushShade(int sha, Selection* customSelection)
@@ -8129,6 +8169,7 @@
 		activeTransaction.commit();
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetItemPenShade(int sha, Selection* customSelection)
@@ -8154,6 +8195,7 @@
 		activeTransaction.commit();
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetItemGradMask(int typ, Selection* customSelection)
@@ -8180,6 +8222,7 @@
 		activeTransaction.commit();
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetItemGradStroke(int typ, Selection* customSelection)
@@ -8232,6 +8275,7 @@
 		activeTransaction.commit();
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetItemGradFill(int typ, Selection* customSelection)
@@ -8317,6 +8361,7 @@
 		trans.commit();
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetItemPatternFill(const QString& pattern, Selection* customSelection)
@@ -8336,6 +8381,7 @@
 	}
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetItemPatternProps(double imageScaleX, double imageScaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY)
@@ -8354,6 +8400,7 @@
 	}
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetItemStrokePattern(const QString& pattern, Selection* customSelection)
@@ -8373,6 +8420,7 @@
 	}
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetItemStrokePatternProps(double imageScaleX, double imageScaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, double space, bool mirrorX, bool mirrorY, Selection* customSelection)
@@ -8393,6 +8441,7 @@
 	}
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetItemStrokePatternType(bool type, Selection* customSelection)
@@ -8412,6 +8461,7 @@
 	}
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetItemPatternMask(const QString& pattern, Selection* customSelection)
@@ -8431,6 +8481,7 @@
 	}
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetItemPatternMaskProps(double imageScaleX, double imageScaleY, double offsetX, double offsetY, double rotation, double skewX, double skewY, bool mirrorX, bool mirrorY, Selection* customSelection)
@@ -8451,6 +8502,7 @@
 	}
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_InsertTableRows()
@@ -8486,6 +8538,7 @@
 
 		m_ScMW->updateTableMenuActions();
 		changed();
+		changedPagePreview();
 	}
 }
 
@@ -8522,6 +8575,7 @@
 
 		m_ScMW->updateTableMenuActions();
 		changed();
+		changedPagePreview();
 	}
 
 	delete dialog;
@@ -8582,6 +8636,7 @@
 
 	m_ScMW->updateTableMenuActions();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_DeleteTableColumns()
@@ -8639,6 +8694,7 @@
 
 	m_ScMW->updateTableMenuActions();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_MergeTableCells()
@@ -8676,6 +8732,7 @@
 
 	m_ScMW->updateTableMenuActions();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetTableRowHeights()
@@ -8730,6 +8787,7 @@
 		activeTransaction.commit();
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetTableColumnWidths()
@@ -8787,6 +8845,7 @@
 		activeTransaction.commit();
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_DistributeTableRowsEvenly()
@@ -8830,6 +8889,7 @@
 	table->adjustTable();
 	table->update();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_DistributeTableColumnsEvenly()
@@ -8873,6 +8933,7 @@
 	table->adjustTable();
 	table->update();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetEffects(int s, Selection* customSelection)
@@ -9058,6 +9119,7 @@
 		activeTransaction.commit();
 	changed();
 	regionsChanged()->update(QRectF());
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_EraseParagraphStyle(Selection* customSelection)
@@ -9150,6 +9212,7 @@
 		activeTransaction.commit();
 	changed();
 	regionsChanged()->update(QRectF());
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_ClearBulNumStrings(Selection* customSelection)
@@ -9309,6 +9372,7 @@
 		activeTransaction.commit();
 	changed();
 	regionsChanged()->update(QRectF());
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_ApplyCharStyle(const CharStyle & newStyle, Selection* customSelection, const QString& ETEA)
@@ -9447,6 +9511,7 @@
 		activeTransaction.commit();
 	changed();
 	regionsChanged()->update(QRectF());
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetCharStyle(const CharStyle & newStyle, Selection* customSelection)
@@ -9527,6 +9592,7 @@
 		activeTransaction.commit();
 	changed();
 	regionsChanged()->update(QRectF());
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_EraseCharStyle(Selection* customSelection)
@@ -9632,6 +9698,7 @@
 		activeTransaction.commit();
 	changed();
 	regionsChanged()->update(QRectF());
+	changedPagePreview();
 }
 
 //AV -> NodeEditContext
@@ -9816,6 +9883,7 @@
 		if (m_hasGUI)
 		{
 			connect(this, SIGNAL(docChanged()), m_ScMW, SLOT(slotDocCh()));
+			connect(this, SIGNAL(pagePreviewChanged()), m_ScMW, SLOT(slotPreviewCh()));
 			connect(this, SIGNAL(firstSelectedItemType(int)), m_ScMW, SLOT(HaveNewSel()));
 			connect(this->m_Selection, SIGNAL(selectionChanged()), m_ScMW, SLOT(HaveNewSel()));
 			connect(autoSaveTimer, SIGNAL(timeout()), this, SLOT(slotAutoSave()));
@@ -9830,6 +9898,7 @@
 		if (m_hasGUI)
 		{
 			disconnect(this, SIGNAL(docChanged()), m_ScMW, SLOT(slotDocCh()));
+			disconnect(this, SIGNAL(pagePreviewChanged()), m_ScMW, SLOT(slotPreviewCh()));
 			disconnect(this, SIGNAL(firstSelectedItemType(int)), m_ScMW, SLOT(HaveNewSel()));
 			disconnect(this->m_Selection, SIGNAL(selectionChanged()), m_ScMW, SLOT(HaveNewSel()));
 			disconnect(autoSaveTimer, SIGNAL(timeout()), this, SLOT(slotAutoSave()));
@@ -9908,6 +9977,7 @@
 	{
 		regionsChanged()->update(QRectF());
 		changed();
+		changedPagePreview();
 	}
 }
 
@@ -9989,6 +10059,7 @@
 	{
 		regionsChanged()->update(QRectF());
 		changed();
+		changedPagePreview();
 	}
 }
 
@@ -10268,6 +10339,7 @@
 	{
 		regionsChanged()->update(QRectF());
 		changed();
+		changedPagePreview();
 	}
 }
 
@@ -10734,6 +10806,7 @@
 	m_updateManager.setUpdatesEnabled();
 	regionsChanged()->update(QRectF());
 	changed();
+	changedPagePreview();
 }
 
 
@@ -10854,7 +10927,8 @@
 	if (trans)
 		trans.commit();
 	regionsChanged()->update(QRectF());
-	changed();
+	changed();	
+	changedPagePreview();
 	emit firstSelectedItemType(itemSelection->itemAt(0)->itemType());
 }
 
@@ -10970,6 +11044,7 @@
 	if (trans)
 		trans.commit();
 	changed();
+	changedPagePreview();
 	emit firstSelectedItemType(m_Selection->itemAt(0)->itemType());
 }
 
@@ -10986,6 +11061,7 @@
 	else if (itemSelection->count() == 1)
 		rotateItem(angle, itemSelection->itemAt(0));
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_ChangePreviewResolution(int id)
@@ -11161,6 +11237,7 @@
 	}
 	item->update();
 	changed();
+	changedPagePreview();
 	if (activeTransaction)
 		activeTransaction.commit();
 }
@@ -11194,6 +11271,7 @@
 	}
 	regionsChanged()->update(QRectF());
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_TruncateItem(Selection* customSelection)
@@ -11220,6 +11298,7 @@
 
 	regionsChanged()->update(QRectF());
 	changed();
+	changedPagePreview();
 }
 
 QList<PageItem*>* ScribusDoc::groupOfItem(QList<PageItem*>* itemList, PageItem* item)
@@ -11399,6 +11478,7 @@
 			itemSelection->itemAt(0)->emitAllToGUI();
 	}
 	changed();
+	changedPagePreview();
 }
 
 
@@ -11418,6 +11498,7 @@
 	}
 	regionsChanged()->update(QRectF());
 	changed();
+	changedPagePreview();
 }
 
 
@@ -11435,6 +11516,7 @@
 	}
 	regionsChanged()->update(QRectF());
 	changed();
+	changedPagePreview();
 }
 
 
@@ -11455,6 +11537,7 @@
 	}
 	regionsChanged()->update(QRectF());
 	changed();
+	changedPagePreview();
 	if (activeTransaction)
 	{
 		activeTransaction.commit(Um::Selection,
@@ -11481,6 +11564,7 @@
 	}
 	regionsChanged()->update(QRectF());
 	changed();
+	changedPagePreview();
 	if (activeTransaction)
 		activeTransaction.commit(Um::Selection, Um::IGroup, Um::BlendMode, "", Um::IGroup);
 }
@@ -11503,6 +11587,7 @@
 	}
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetFillGradient(VGradient& newGradient, Selection* customSelection)
@@ -11524,6 +11609,7 @@
 	}
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetMaskGradient(VGradient& newGradient, Selection* customSelection)
@@ -11543,6 +11629,7 @@
 	}
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 
@@ -11567,6 +11654,7 @@
 		activeTransaction.commit(Um::Selection, Um::IGroup, Um::Overprint, "", Um::IGroup);
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_DoHyphenate()
@@ -11582,6 +11670,7 @@
 	//FIXME: stop using m_View
 	m_View->DrawNew(); //CB draw new until NLS for redraw through text chains
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_DoDeHyphenate()
@@ -11597,6 +11686,7 @@
 	//FIXME: stop using m_View
 	m_View->DrawNew(); //CB draw new until NLS for redraw through text chains
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SendToLayer(int layerID)
@@ -11629,6 +11719,7 @@
 	m_View->deselectItems(true);
 	regionsChanged()->update(QRectF());
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetAlignment(int s, Selection* customSelection)
@@ -11681,6 +11772,7 @@
 		activeTransaction.commit(Um::Selection, Um::IGroup, Um::ImageOffset, tooltip, Um::IImageScaling);
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetImageScale(double x, double y, Selection* customSelection)
@@ -11719,6 +11811,7 @@
 		activeTransaction.commit(Um::Selection, Um::IGroup, Um::ImageScale, tooltip, Um::IImageScaling);
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetImageScaleAndOffset(double sx, double sy, double ox, double oy, Selection* customSelection)
@@ -11763,6 +11856,7 @@
 		outerTransaction.commit(Um::Selection, Um::IGroup, Um::ImageScale, tooltip, Um::IImageScaling);
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetImageRotation(double rot, Selection* customSelection)
@@ -11794,6 +11888,7 @@
 	if (trans)
 		trans.commit();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::buildAlignItemList(Selection* customSelection)
@@ -11882,6 +11977,7 @@
 void ScribusDoc::endAlign()
 {
 	changed();
+	changedPagePreview();
 	m_ScMW->HaveNewSel();
 	for (int i = 0; i < m_Selection->count(); ++i)
 	{
@@ -13100,6 +13196,11 @@
 	emit docChanged();
 }
 
+void ScribusDoc::changedPagePreview()
+{
+	emit pagePreviewChanged();
+}
+
 void ScribusDoc::invalidateAll()
 {
 	QList<PageItem*> allItems;
@@ -13543,6 +13644,7 @@
 
 	regionsChanged()->update(QRectF());
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::multipleDuplicateByPage(const ItemMultipleDuplicateData& dialogData, Selection& selection, QString& tooltip)
@@ -13673,6 +13775,7 @@
 		m_undoManager->action(currItem, state);
 	}
 	changed();
+	changedPagePreview();
 }
 
 
@@ -13730,6 +13833,7 @@
 	}
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_ApplyArrowScale(int startArrowSc, int endArrowSc, Selection* customSelection)
@@ -13775,6 +13879,7 @@
 	}
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 
@@ -15220,7 +15325,8 @@
 	if (needTextInteractionCheck)
 		invalidateRegion(regionToUpdate);
 	regionsChanged()->update(needTextInteractionCheck ? QRectF() : regionToUpdate);
-	emit docChanged();
+	//emit docChanged();
+	changed();
 
 	if (m_ScMW && ScCore->usingGUI())
 	{
@@ -15320,7 +15426,8 @@
 	double x, y, w, h;
 	itemSelection->connectItemToGUI();
 	itemSelection->getGroupRect(&x, &y, &w, &h);
-	emit docChanged();
+	//emit docChanged();
+	changed();
 	if (itemSelection->count() > 0)
 		m_ScMW->HaveNewSel();
 
@@ -15972,6 +16079,7 @@
 		activeTransaction.commit();
 	regionsChanged()->update(QRectF());
 	changed();
+	changedPagePreview();
 	itemSelection->itemAt(0)->emitAllToGUI();
 }
 void ScribusDoc::itemSelection_AdjustImagetoFrameSize( Selection *customSelection)
@@ -15993,6 +16101,7 @@
 	}
 	regionsChanged()->update(QRectF());
 	changed();
+	changedPagePreview();
 	itemSelection->itemAt(0)->emitAllToGUI();
 }
 
@@ -16043,6 +16152,7 @@
 
 	regionsChanged()->update(QRectF());
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_AdjustTableToFrame()
@@ -16065,6 +16175,7 @@
 
 	regionsChanged()->update(QRectF());
 	changed();
+	changedPagePreview();
 }
 
 
@@ -16091,6 +16202,7 @@
 	}
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
 
 void ScribusDoc::itemSelection_SetRenderIntent(int intentIndex, Selection * customSelection)
@@ -16114,6 +16226,7 @@
 	}
 	m_updateManager.setUpdatesEnabled();
 	changed();
+	changedPagePreview();
 }
  
 void ScribusDoc::itemSelection_SetCompressionMethod(int cmIndex, Selection * customSelection)
@@ -16507,6 +16620,7 @@
 
 	changed();
 	regionsChanged()->update(QRect());
+	changedPagePreview();
 }
 
 
@@ -16585,6 +16699,7 @@
 	item->invalid = true;
 	changed();
 	regionsChanged()->update(QRect());
+	changedPagePreview();
 }
 
 void ScribusDoc::restartAutoSaveTimer()
Index: scribus/scribusdoc.h
===================================================================
--- scribus/scribusdoc.h	(Revision 25541)
+++ scribus/scribusdoc.h	(Arbeitskopie)
@@ -1214,6 +1214,7 @@
 	 * certain operations.
 	 */
 	void changed();
+	void changedPagePreview();
 	/*! \brief Get pointer to the current page
 	\retval Page* current page object */
 	ScPage* currentPage();
@@ -1493,8 +1494,9 @@
 	 * @brief Let the document tell whatever is listening that it has changed
 	 */
 	void docChanged();
-	void updateContents();
-	void updateContents(const QRect &r);
+	void pagePreviewChanged();
+//	void updateContents();
+//	void updateContents(const QRect &r);
 	void firstSelectedItemType(int);
 
 	void updateEditItem();
Index: scribus/scribusview.cpp
===================================================================
--- scribus/scribusview.cpp	(Revision 25541)
+++ scribus/scribusview.cpp	(Arbeitskopie)
@@ -2388,6 +2388,7 @@
 	resizeContents(qRound((m_doc->maxCanvasCoordinate.x() - m_doc->minCanvasCoordinate.x()) * m_canvas->scale()), qRound((m_doc->maxCanvasCoordinate.y() - m_doc->minCanvasCoordinate.y()) * m_canvas->scale()));
 }
 
+
 QImage ScribusView::MPageToPixmap(const QString& name, int maxGr, bool drawFrame)
 {
 	ScLayer layer;
@@ -2460,20 +2461,27 @@
 
 QImage ScribusView::PageToPixmap(int Nr, int maxGr, PageToPixmapFlags flags)
 {
-	QImage im;
-	double sx = maxGr / m_doc->DocPages.at(Nr)->width();
-	double sy = maxGr / m_doc->DocPages.at(Nr)->height();
-	double sc = qMin(sx, sy);
-	int clipx = static_cast<int>(m_doc->DocPages.at(Nr)->xOffset() * sc);
-	int clipy = static_cast<int>(m_doc->DocPages.at(Nr)->yOffset() * sc);
-	int clipw = qRound(m_doc->DocPages.at(Nr)->width() * sc);
-	int cliph = qRound(m_doc->DocPages.at(Nr)->height() * sc);
-	if ((clipw <=0) || (cliph <= 0))
-		return im;
-	im = QImage(clipw, cliph, QImage::Format_ARGB32_Premultiplied);
-	if (im.isNull())
-		return im;
-	im.fill( qRgba(0, 0, 0, 0) );
+	QImage img;
+	QMap<int, QImage> m_previews = PagesToPixmap(maxGr, Nr, flags);
+
+	if(!m_previews.isEmpty())
+		img = m_previews.first();
+
+	return img;
+}
+
+QMap<int, QImage> ScribusView::PagesToPixmap(int maxGr, int Nr, PageToPixmapFlags flags)
+{
+	QMap<int, QImage> m_previews;
+
+	if(m_doc == nullptr || maxGr <= 0)
+		return m_previews;
+
+	if(m_doc->DocPages.count() == 0)
+		return m_previews;
+
+	// Preserve old settings
+
 	int oldAppMode = m_doc->appMode;
 	requestMode(modeNormal);
 	double oldScale = m_canvas->scale();
@@ -2483,8 +2491,9 @@
 	bool oldFramesShown  = m_doc->guidesPrefs().framesShown;
 	bool oldShowControls = m_doc->guidesPrefs().showControls;
 	bool oldDrawAsPreview = m_doc->drawAsPreview;
-	m_doc->guidesPrefs().framesShown = false;
-	m_doc->guidesPrefs().showControls = false;
+	ScPage* act = m_doc->currentPage();
+	bool mMode = m_doc->masterPageMode();
+
 	bool cmsCorr = false;
 	if ((m_doc->cmsSettings().CMSinUse) && (m_doc->cmsSettings().GamutCheck))
 	{
@@ -2492,15 +2501,86 @@
 		m_doc->cmsSettings().GamutCheck = false;
 		m_doc->enableCMS(true);
 	}
+
+
+	// Optimize settings for rendering
+
+	m_doc->guidesPrefs().framesShown = false;
+	m_doc->guidesPrefs().showControls = false;
 	m_doc->drawAsPreview = true;
-	m_canvas->setScale(sc);
 	m_canvas->setPreviewMode(true);
 	m_canvas->setForcedRedraw(true);
-	ScPage* act = m_doc->currentPage();
-	bool mMode = m_doc->masterPageMode();
 	m_doc->setMasterPageMode(false);
 	m_doc->setLoading(true);
-	m_doc->setCurrentPage(m_doc->DocPages.at(Nr));
+
+//	QElapsedTimer timer;
+//	timer.start();
+
+	// Draw all pages
+	if(Nr == -1)
+	{
+		foreach(ScPage *page, m_doc->DocPages){
+
+			QImage im = drawPageToPixmap(maxGr, page, flags);
+			m_previews.insert(page->pageNr(), im);
+
+		}
+	}
+	// Draw single page by number
+	else
+	{
+		if(inRange(0, Nr, m_doc->DocPages.count() - 1))
+		{
+			ScPage *page = m_doc->DocPages.at(Nr);
+			QImage im = drawPageToPixmap(maxGr, page, flags);
+			m_previews.insert(page->pageNr(), im);
+
+		}
+
+	}
+
+//	qDebug() << Q_FUNC_INFO << "- draw preview in" << timer.elapsed() << "milliseconds";
+
+	// Reset settings
+
+	if (cmsCorr)
+	{
+		m_doc->cmsSettings().GamutCheck = true;
+		m_doc->enableCMS(true);
+	}
+	m_doc->drawAsPreview = oldDrawAsPreview;
+	m_doc->guidesPrefs().framesShown  = oldFramesShown;
+	m_doc->guidesPrefs().showControls = oldShowControls;
+	m_canvas->setScale(oldScale);
+	m_doc->setMasterPageMode(mMode);
+	m_doc->setCurrentPage(act);
+	m_doc->setLoading(false);
+	m_canvas->setPreviewMode(m_doc->drawAsPreview);
+	m_canvas->setForcedRedraw(false);
+	m_doc->minCanvasCoordinate = FPoint(cx, cy);
+	requestMode(oldAppMode);
+
+	return m_previews;
+}
+
+QImage ScribusView::drawPageToPixmap(int maxGr, ScPage *page, PageToPixmapFlags flags)
+{
+	QImage im;
+	double sc = maxGr / page->height();
+	int clipx = static_cast<int>(page->xOffset() * sc);
+	int clipy = static_cast<int>(page->yOffset() * sc);
+	int clipw = qRound(page->width() * sc);
+	int cliph = qRound(page->height() * sc);
+
+	m_canvas->setScale(sc);
+
+	if ((clipw <=0) || (cliph <= 0))
+		return im;
+	im = QImage(clipw, cliph, QImage::Format_ARGB32_Premultiplied);
+	if (im.isNull())
+		return im;
+	im.fill( qRgba(0, 0, 0, 0) );
+
 	ScPainter *painter = new ScPainter(&im, im.width(), im.height(), 1.0, 0);
 	if (flags & Pixmap_DrawBackground)
 		painter->clear(m_doc->paperColor());
@@ -2518,7 +2598,6 @@
 	painter->setZoomFactor(m_canvas->scale());
 
 	QList<QPair<PageItem*, int> > changedList;
-	ScPage* page = m_doc->DocPages.at(Nr);
 	PageItem* currItem;
 	if ((page->FromMaster.count() != 0) && !flags.testFlag(Pixmap_DontReloadImages))
 	{
@@ -2592,7 +2671,7 @@
 	for (int layerLevel = 0; layerLevel < layerCount; ++layerLevel)
 	{
 		m_doc->Layers.levelToLayer(layer, layerLevel);
-		m_canvas->DrawMasterItems(painter, m_doc->DocPages.at(Nr), layer, QRect(clipx, clipy, clipw, cliph));
+		m_canvas->DrawMasterItems(painter, page, layer, QRect(clipx, clipy, clipw, cliph));
 		m_canvas->DrawPageItems(painter, layer, QRect(clipx, clipy, clipw, cliph), false);
 		m_canvas->DrawPageItems(painter, layer, QRect(clipx, clipy, clipw, cliph), true);
 	}
@@ -2620,22 +2699,7 @@
 			currItem->setImageYOffset(imgY);
 		}
 	}
-	if (cmsCorr)
-	{
-		m_doc->cmsSettings().GamutCheck = true;
-		m_doc->enableCMS(true);
-	}
-	m_doc->drawAsPreview = oldDrawAsPreview;
-	m_doc->guidesPrefs().framesShown  = oldFramesShown;
-	m_doc->guidesPrefs().showControls = oldShowControls;
-	m_canvas->setScale(oldScale);
-	m_doc->setMasterPageMode(mMode);
-	m_doc->setCurrentPage(act);
-	m_doc->setLoading(false);
-	m_canvas->setPreviewMode(m_doc->drawAsPreview);
-	m_canvas->setForcedRedraw(false);
-	m_doc->minCanvasCoordinate = FPoint(cx, cy);
-	requestMode(oldAppMode);
+
 	return im;
 }
 
Index: scribus/scribusview.h
===================================================================
--- scribus/scribusview.h	(Revision 25541)
+++ scribus/scribusview.h	(Arbeitskopie)
@@ -172,8 +172,10 @@
 	void showInlinePage(int id);
 	void hideInlinePage();
 
+	QMap<int, QImage> PagesToPixmap(int maxGr, int Nr = -1, PageToPixmapFlags flags = Pixmap_DrawFrame | Pixmap_DrawBackground);
 	QImage PageToPixmap(int Nr, int maxGr, PageToPixmapFlags flags = Pixmap_DrawFrame | Pixmap_DrawBackground);
 	QImage MPageToPixmap(const QString& name, int maxGr, bool drawFrame = true);
+	QImage drawPageToPixmap(int maxGr, ScPage *page, PageToPixmapFlags flags = Pixmap_DrawFrame | Pixmap_DrawBackground);
 
 	/**
 	 * Called when the ruler origin is dragged
Index: scribus/ui/charselect.cpp
===================================================================
--- scribus/ui/charselect.cpp	(Revision 25541)
+++ scribus/ui/charselect.cpp	(Arbeitskopie)
@@ -134,6 +134,7 @@
 	}
 	m_doc->view()->DrawNew();
 	m_doc->changed();
+	m_doc->changedPagePreview();
 // 	delEdit();
 }
 
@@ -161,6 +162,7 @@
 	cItem->itemText.applyCharStyle(pot, 1, nstyle);
 	m_doc->view()->DrawNew();
 	m_doc->changed();
+	m_doc->changedPagePreview();
 }
 
 void CharSelect::slot_selectionChanged( const QItemSelection& sel, const QItemSelection& )
Index: scribus/ui/layers.cpp
===================================================================
--- scribus/ui/layers.cpp	(Revision 25541)
+++ scribus/ui/layers.cpp	(Arbeitskopie)
@@ -394,6 +394,7 @@
 	m_Doc->scMW()->changeLayer(m_Doc->activeLayer());
 	emit LayerChanged();
 	m_Doc->changed();
+	m_Doc->changedPagePreview();
 }
 
 void LayerPalette::downLayer()
@@ -410,6 +411,7 @@
 	emit LayerChanged();
 	markActiveLayer();
 	m_Doc->changed();
+	m_Doc->changedPagePreview();
 }
 
 void LayerPalette::changeName(int row, int col)
Index: scribus/ui/loremipsum.cpp
===================================================================
--- scribus/ui/loremipsum.cpp	(Revision 25541)
+++ scribus/ui/loremipsum.cpp	(Arbeitskopie)
@@ -343,6 +343,7 @@
 	}
 	m_Doc->regionsChanged()->update(QRectF());
 	m_Doc->changed();
+	m_Doc->changedPagePreview();
 }
 
 QString LoremManager::loremIpsum()
Index: scribus/ui/pagepalette.cpp
===================================================================
--- scribus/ui/pagepalette.cpp	(Revision 25541)
+++ scribus/ui/pagepalette.cpp	(Arbeitskopie)
@@ -150,6 +150,14 @@
 	}
 }
 
+void PagePalette::updatePagePreviews()
+{
+	PagePalette_Pages* pageWidget = dynamic_cast<PagePalette_Pages*>(this->currentWidget());
+	if (pageWidget)
+		pageWidget->updatePagePreview();
+
+}
+
 bool PagePalette::masterPageMode()
 {
 	PagePalette_MasterPages* mpWidget = dynamic_cast<PagePalette_MasterPages*>(this->currentWidget());
@@ -185,7 +193,7 @@
 	}
 	else
 	{
-		ScribusDoc* doc = m_view->m_doc;
+		//ScribusDoc* doc = m_view->m_doc;
 		PagePalette_MasterPages* mpWidget = this->masterpageWidget();
 		if (mpWidget->m_view != m_view)
 			mpWidget->setView(m_view, masterPage);
Index: scribus/ui/pagepalette.h
===================================================================
--- scribus/ui/pagepalette.h	(Revision 25541)
+++ scribus/ui/pagepalette.h	(Arbeitskopie)
@@ -61,6 +61,7 @@
 	void rebuildPages();
 	void markPage(uint nr);
 	void updateMasterPageList();
+	void updatePagePreviews();
 
 	void languageChange();
 
Index: scribus/ui/pagepalette_pages.cpp
===================================================================
--- scribus/ui/pagepalette_pages.cpp	(Revision 25541)
+++ scribus/ui/pagepalette_pages.cpp	(Arbeitskopie)
@@ -5,7 +5,6 @@
 for which a new license (GPL+exception) is in place.
 */
 
-
 #include <QApplication>
 #include <QBitmap>
 #include <QComboBox>
@@ -16,8 +15,8 @@
 #include <QLabel>
 #include <QList>
 #include <QMenu>
+#include <QMessageBox>
 #include <QMimeData>
-#include <QMessageBox>
 #include <QPainter>
 #include <QRegularExpression>
 
@@ -26,6 +25,7 @@
 #include "pagelayout.h"
 #include "pagepalette_pages.h"
 #include "pagepalette_widgets.h"
+#include "qobjectdefs.h"
 #include "scpage.h"
 #include "scribusapp.h"
 #include "scribuscore.h"
@@ -32,81 +32,78 @@
 #include "scribusdoc.h"
 #include "scribusview.h"
 
-PagePalette_Pages::PagePalette_Pages(QWidget* parent) : QWidget(parent)
+PagePalette_Pages::PagePalette_Pages(QWidget *parent)
+	: QWidget(parent)
 {
 	m_scMW = ScCore->primaryMainWindow();
-	
+
 	setupUi(this);
-	
-	setSizePolicy( QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding));
 
+	setSizePolicy(QSizePolicy(QSizePolicy::Minimum, QSizePolicy::Expanding));
+
 	masterPageList->setMinimumSize(QSize(200, 40));
-	masterPageList->m_thumb = false;
+	masterPageList->m_thumb = true;
 	masterPageList->setIconSize(QSize(60, 60));
 
-	QHeaderView *Header = pageView->verticalHeader();
-	Header->setSectionsMovable(false);
-	Header->setSectionResizeMode(QHeaderView::Fixed);
-	Header->hide();
-	Header = pageView->horizontalHeader();
-	Header->setSectionsMovable(false);
-	Header->setSectionResizeMode(QHeaderView::Fixed);
-	Header->hide();
-	pageView->setSortingEnabled(false);
-	pageView->setSelectionMode( QAbstractItemView::NoSelection );
-	pageView->setRowCount(1);
-	pageView->setColumnCount(1);
-	pageView->setIconSize(QSize(60, 60));
+	trash->setMinimumSize(QSize(32, 32));
+	trash->setMaximumSize(QSize(32, 32));
 
-	trash->setMinimumSize(QSize(32,32));
-	trash->setMaximumSize(QSize(32,32));
+	PageGrid *pageGrid = pageViewWidget->pageGrid();
 
-	pix = IconManager::instance().loadPixmap("32/page-simple.png");
-
 	rebuild();
+	iconSetChange();
 	languageChange();
 
 	connect(ScQApp, SIGNAL(iconSetChanged()), this, SLOT(iconSetChange()));
 
-	connect(masterPageList, SIGNAL(itemDoubleClicked(QListWidgetItem*)), this, SLOT(selMasterPage()));
+	connect(masterPageList, SIGNAL(itemDoubleClicked(QListWidgetItem *)), this, SLOT(selMasterPage()));
 	connect(masterPageList, SIGNAL(thumbnailChanged()), this, SLOT(rebuildMasters()));
 	connect(masterPageList, SIGNAL(delMasterRequest(QString)), this, SLOT(deleteMasterPage(QString)));
 
-	connect(pageLayout, SIGNAL(selectedLayout(int))   , this, SLOT(handlePageLayout(int)));
+	connect(pageLayout, SIGNAL(selectedLayout(int)), this, SLOT(handlePageLayout(int)));
 	connect(pageLayout, SIGNAL(selectedFirstPage(int)), this, SLOT(handleFirstPage(int)));
-	connect(pageView  , SIGNAL(Click(int,int,int))    , this, SLOT(pageView_gotoPage(int,int,int)));
-	connect(pageView  , SIGNAL(movePage(int,int))     , this, SLOT(pageView_movePage(int,int)));
-	connect(pageView  , SIGNAL(delPageRequest(int))   , this, SLOT(pageView_deletePage(int)));
-	connect(pageView  , SIGNAL(UseTemp(QString,int))  , this, SLOT(pageView_applyMasterPage(QString,int)));
-	connect(pageView  , SIGNAL(NewPage(int,QString))  , m_scMW, SLOT(slotNewPageP(int,QString)));
-	connect(trash     , SIGNAL(delPageRequest(int))   , m_scMW, SLOT(deletePage2(int)));
-	connect(trash     , SIGNAL(delMasterRequest(QString))    , this, SLOT(deleteMasterPage(QString)));
-	
-	connect(this, SIGNAL(gotoPage(int))          , m_scMW, SLOT(selectPagesFromOutlines(int)));
+
+	connect(pageGrid, SIGNAL(click(int, int)), this, SLOT(pageView_gotoPage(int, int)));
+	connect(pageGrid, SIGNAL(movePage(int, int)), this, SLOT(pageView_movePage(int, int)));
+	connect(pageGrid, SIGNAL(delPageRequest(int)), this, SLOT(pageView_deletePage(int)));
+	connect(pageGrid, SIGNAL(useTemplate(QString, int)), this, SLOT(pageView_applyMasterPage(QString, int)));
+	connect(pageGrid, SIGNAL(newPage(int, QString)), m_scMW, SLOT(slotNewPageP(int, QString)));
+	connect(pageGrid, SIGNAL(previewSizeChanged()), this, SLOT(updatePagePreview()));
+
+	connect(trash, SIGNAL(delPageRequest(int)), m_scMW, SLOT(deletePage2(int)));
+	connect(trash, SIGNAL(delMasterRequest(QString)), this, SLOT(deleteMasterPage(QString)));
+
+	connect( buttonPageInsert, SIGNAL(clicked()), this, SLOT(newPage()) );
+	connect( buttonPageImport, SIGNAL(clicked()), this, SLOT(importPage()) );
+	connect( buttonPageDuplicate, SIGNAL(clicked()), this, SLOT(duplicatePage()) );
+	connect( buttonPageMove, SIGNAL(clicked()), this, SLOT(movePage()) );
+
+	connect(this, SIGNAL(gotoPage(int)), m_scMW, SLOT(selectPagesFromOutlines(int)));
 }
 
-void PagePalette_Pages::deleteMasterPage(const QString& tmp)
+void PagePalette_Pages::deleteMasterPage(const QString &tmp)
 {
 	if (tmp == CommonStrings::trMasterPageNormal)
 		return;
 	QString extraWarn;
-	for (int i=0; i < currView->m_doc->DocPages.count(); ++i )
+	for (int i = 0; i < currView->m_doc->DocPages.count(); ++i)
 	{
 		if (currView->m_doc->DocPages[i]->masterPageName() == tmp)
 			extraWarn = tr("This master page is used at least once in the document.");
 	}
 	int exit = ScMessageBox::warning(this,
-									  CommonStrings::trWarning,
-									  tr("Do you really want to delete this master page?")+"\n"+extraWarn,
-									  QMessageBox::Yes | QMessageBox::No,
-									  QMessageBox::NoButton,	// GUI default
-									  QMessageBox::Yes);	// batch default
+									 CommonStrings::trWarning,
+									 tr("Do you really want to delete this master page?") + "\n"
+									 + extraWarn,
+									 QMessageBox::Yes | QMessageBox::No,
+									 QMessageBox::NoButton, // GUI default
+									 QMessageBox::Yes);     // batch default
 	if (exit == QMessageBox::Yes)
 	{
 		bool oldMPMode = currView->m_doc->masterPageMode();
-		int  storedPageNum = currView->m_doc->currentPageNumber();
-		int  storedViewXCoor = currView->horizontalScrollBar()->value();
-		int  storedViewYCoor = currView->verticalScrollBar()->value();
+		int storedPageNum = currView->m_doc->currentPageNumber();
+		int storedViewXCoor = currView->horizontalScrollBar()->value();
+		int storedViewYCoor = currView->verticalScrollBar()->value();
 
 		currView->m_doc->setMasterPageMode(true);
 		currView->m_doc->scMW()->deletePage2(currView->m_doc->MasterNames[tmp]);
@@ -125,55 +122,161 @@
 	}
 }
 
-void PagePalette_Pages::pageView_applyMasterPage(const QString& masterpageName, int pageIndex)
+void PagePalette_Pages::pageView_applyMasterPage(const QString &masterpageName, int pageIndex)
 {
 	m_scMW->Apply_MasterPage(masterpageName, pageIndex, false);
 	currView->reformPages();
 	currView->DrawNew();
-	SeItem* pageItem = pageView->getPageItem(pageIndex);
-	if (pageItem)
-		pageItem->setIcon(createIcon(pageIndex, masterpageName, pix));
+
+	if(pageIndex < 0 && pageIndex >= currView->m_doc->DocPages.count()) return;
+
+	ScPage page = *currView->m_doc->DocPages.at(pageIndex);
+	double pageRatio = page.width() / page.height();
+
+	PageCell *pc = pageViewWidget->pageGrid()->getPageItem(pageIndex);
+	pc->setPageName(masterpageName);
+	pc->setPageRatio(pageRatio);
+
 }
 
 void PagePalette_Pages::pageView_movePage(int r, int c)
 {
-	if ((r == c) || (r >= pageView->m_pageCount))
+	if ((r == c) || (r >= pageViewWidget->pageGrid()->pageCount()))
 		return;
-	if (c >= pageView->m_pageCount)
+	if (c >= pageViewWidget->pageGrid()->pageCount())
 		currView->m_doc->movePage(r, r + 1, c, 2);
 	else
 		currView->m_doc->movePage(r, r + 1, c, 0);
+
 	currView->reformPages();
 	rebuildPages();
 	currView->DrawNew();
 }
 
-void PagePalette_Pages::pageView_gotoPage(int r, int c, int b)
+void PagePalette_Pages::pageView_gotoPage(int pageID, int b)
 {
-	if ((b == Qt::LeftButton) && (r != -1) && (c != -1))
+	if (b == Qt::LeftButton)
 	{
-		int p;
-		bool dummy;
-		p = pageView->getPage(r, c, &dummy);
-		emit gotoPage(p);
+		emit gotoPage(pageID);
 	}
 }
 
 void PagePalette_Pages::pageView_deletePage(int pageIndex)
 {
-	int exit = ScMessageBox::question(this, tr("Delete Page?"),
-			                          "<qt>" + tr("Are you sure you want to delete this page?") + "</qt>",
-			                          QMessageBox::Yes | QMessageBox::No, QMessageBox::Yes);
+	int exit = ScMessageBox::question(this,
+									  tr("Delete Page?"),
+									  "<qt>" + tr("Are you sure you want to delete this page?")
+									  + "</qt>",
+									  QMessageBox::Yes | QMessageBox::No,
+									  QMessageBox::Yes);
 	if (exit != QMessageBox::Yes)
 		return;
 	m_scMW->deletePage2(pageIndex);
 }
 
+void PagePalette_Pages::pageView_updatePagePreview()
+{
+	if (currView == nullptr)
+	{
+		m_pagePreviewUpdatePending = true;
+		return;
+	}
+
+	if (currView->m_doc == nullptr)
+	{
+		m_pagePreviewUpdatePending = true;
+		return;
+	}
+
+	qDebug() << Q_FUNC_INFO << "- start page preview update";
+
+	PageToPixmapFlags flags = Pixmap_DrawFrame | Pixmap_DrawBackground | Pixmap_DontReloadImages;
+	QMap<int, QImage> previews = currView->PagesToPixmap(pageViewWidget->pageGrid()->pageHeight(), -1, flags);
+
+	for (int i = 0; i < currView->m_doc->DocPages.count(); ++i)
+	{
+		if(previews.contains(i) && i < pageViewWidget->pageGrid()->pageList.count())
+		{
+			ScPage page = *currView->m_doc->DocPages.at(i);
+			double pageRatio = page.width() / page.height();
+			QPixmap pix = ( previews.contains(i) ) ? QPixmap::fromImage( previews.value(i) ) : QPixmap();
+
+			PageCell *pc = pageViewWidget->pageGrid()->pageList.at(i);
+			pc->setPagePreview( pix );
+			pc->setPageRatio( pageRatio );
+		}
+	}
+
+	pageViewWidget->pageGrid()->update();
+
+	m_pagePreviewUpdatePending = true;
+
+}
+
+void PagePalette_Pages::updatePagePreview()
+{
+	if (currView == nullptr || pageViewWidget->pageGrid()->pageList.empty())
+	{
+		m_pagePreviewUpdatePending = true;
+		return;
+	}
+
+	if (currView->m_doc == nullptr)
+	{
+		m_pagePreviewUpdatePending = true;
+		return;
+	}
+
+	if (m_pagePreviewUpdatePending && currView->m_doc->DocPages.count() == pageViewWidget->pageGrid()->pageList.count())
+	{
+		m_pagePreviewUpdatePending = false;
+
+		// limit preview update to 1 refresh event each 500ms
+		QTimer::singleShot(500, this, [this]()
+		{
+			pageView_updatePagePreview();
+		});
+
+	}
+
+}
+
+
+void PagePalette_Pages::newPage()
+{
+	m_scMW->slotNewPageM();
+}
+
+void PagePalette_Pages::duplicatePage()
+{
+	m_scMW->copyPage();
+}
+
+void PagePalette_Pages::importPage()
+{
+	m_scMW->slotPageImport();
+}
+
+void PagePalette_Pages::movePage()
+{
+	m_scMW->movePage();
+}
+
+void PagePalette_Pages::deletePage()
+{
+	int selectedPage = currView->m_doc->currentPageNumber();
+	pageView_deletePage(selectedPage);
+}
+
 void PagePalette_Pages::enablePalette(const bool enabled)
 {
-	pageView->setEnabled(enabled);
+	pageViewWidget->setEnabled(enabled);
 	masterPageList->setEnabled(enabled);
 	pageLayout->setEnabled(enabled);
+	buttonPageDuplicate->setEnabled(enabled);
+	buttonPageImport->setEnabled(enabled);
+	buttonPageInsert->setEnabled(enabled);
+	buttonPageMove->setEnabled(enabled);
 }
 
 void PagePalette_Pages::handlePageLayout(int layout)
@@ -205,18 +308,20 @@
 		return;
 
 	QPixmap pm;
-	QListWidgetItem* item;
+	QListWidgetItem *item;
 	for (auto it = currView->m_doc->MasterNames.cbegin(); it != currView->m_doc->MasterNames.cend(); ++it)
 	{
-		const QString& pageName = it.key();
-		QString pageLabel = (pageName == CommonStrings::masterPageNormal) ? CommonStrings::trMasterPageNormal : pageName;
+		const QString &pageName = it.key();
+		QString pageLabel = (pageName == CommonStrings::masterPageNormal)
+				? CommonStrings::trMasterPageNormal
+				: pageName;
 		if (masterPageList->m_thumb)
 		{
 			pm = QPixmap::fromImage(currView->MPageToPixmap(pageName, 60));
 			item = new QListWidgetItem(QIcon(pm), pageLabel, masterPageList);
-		}
-		else
+		} else
 			item = new QListWidgetItem(pageLabel, masterPageList);
+
 		item->setData(Qt::UserRole, pageName);
 	}
 }
@@ -229,9 +334,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->setColumnCount(1);
+	pageViewWidget->pageGrid()->clear();
 	if (currView == nullptr)
 	{
 		connect(pageLayout, SIGNAL(selectedLayout(int)), this, SLOT(handlePageLayout(int)));
@@ -239,98 +342,54 @@
 		return;
 	}
 
-	const PageSet& currentPageSet = currView->m_doc->pageSets()[currView->m_doc->pagePositioning()];
+	const PageSet &currentPageSet = currView->m_doc->pageSets()[currView->m_doc->pagePositioning()];
 	pageLayout->updateLayoutSelector(currView->m_doc->pageSets());
 	pageLayout->selectItem(currView->m_doc->pagePositioning());
 	pageLayout->firstPage->setCurrentIndex(currentPageSet.FirstPage);
-	pageView->m_pageCount = currView->m_doc->DocPages.count();
 
 	int counter = currentPageSet.FirstPage;
 	int cols = currentPageSet.Columns;
-	int rows = (currView->m_doc->DocPages.count()+counter) / currentPageSet.Columns;
-	if (((currView->m_doc->DocPages.count()+counter) % currentPageSet.Columns) != 0)
-		rows++;
-	int rowcounter = 0;
-	int colmult, rowmult, coladd, rowadd;
-	if (cols == 1)
-	{
-		pageView->setColumnCount(cols);
-		pageView->setRowCount(rows * 2 + 1);
-		colmult = 1;
-		coladd = 0;
-		rowmult = 2;
-		rowadd = 1;
-	}
-	else
-	{
-		pageView->setColumnCount(cols * 2);
-		pageView->setRowCount(rows + 1);
-		colmult = 2;
-		coladd = 1;
-		rowmult = 1;
-		rowadd = 0;
-	}
 
-	for (int row = 0; row < pageView->rowCount(); ++row)
-	{
-		for (int column = 0; column < pageView->columnCount(); ++column)
-		{
-			QTableWidgetItem *tW = new QTableWidgetItem(1001);
-			tW->setFlags(Qt::ItemIsEnabled);
-			pageView->setItem(row, column, tW);
-		}
-	}
+	pageViewWidget->pageGrid()->setDocumentPageSize(QSize(currView->m_doc->pageWidth(), currView->m_doc->pageHeight()));
+	pageViewWidget->pageGrid()->setPageInGroup(cols);
+	pageViewWidget->pageGrid()->setPageOffset(counter);
 
-	pageView->m_coladd = coladd;
-	pageView->m_colmult = colmult;
-	pageView->m_rowadd = rowadd;
-	pageView->m_rowmult = rowmult;
-	pageView->m_firstPage = counter;
-	pageView->m_cols = currentPageSet.Columns;
+	m_pagePreviewUpdatePending = false;
 
-	int columnWidth = pix.width() * pageView->devicePixelRatioF();
-	int rowHeight = pix.height() * pageView->devicePixelRatioF();
-	int rowHeight5 = 5 * pageView->devicePixelRatioF();
-	int rowHeight10 = 10 * pageView->devicePixelRatioF();
+//	QElapsedTimer timer;
+//	timer.start();
 
-	pageList.clear();
+	// Create all page previews
+	PageToPixmapFlags flags = Pixmap_DrawFrame | Pixmap_DrawBackground | Pixmap_DontReloadImages;
+	QMap<int, QImage> previews = currView->PagesToPixmap(pageViewWidget->pageGrid()->pageHeight(), -1, flags);
+
 	for (int i = 0; i < currView->m_doc->DocPages.count(); ++i)
 	{
-		QString str = currView->m_doc->DocPages.at(i)->masterPageName();
-		SeItem *it = new SeItem(str, i, createIcon(i, str, pix));
-		pageList.append(it);
-		pageView->setItem(rowcounter * rowmult + rowadd, counter * colmult + coladd, it);
-		pageView->setColumnWidth(counter * colmult + coladd, columnWidth);
-		if (cols == 1)
-		{
-			pageView->setRowHeight(rowcounter * rowmult, 10);
-			pageView->setRowHeight(rowcounter * rowmult + rowadd, rowHeight);
-		}
-		else
-			pageView->setRowHeight(rowcounter * rowmult + rowadd, rowHeight + rowHeight5);
-		counter++;
-		if (counter > currentPageSet.Columns - 1)
-		{
-			counter = 0;
-			rowcounter++;
-		}
+		ScPage page = *currView->m_doc->DocPages.at(i);
+
+		QString str = page.masterPageName();
+		double pageRatio = page.width() / page.height();
+		QPixmap pix = (previews.contains(i)) ? QPixmap::fromImage(previews.value(i)) : QPixmap();
+
+		// empty page
+		PageCell *pc = new PageCell(str, i,
+									pix,// QPixmap can replace with real page preview
+									pageRatio);
+		pageViewWidget->pageGrid()->pageList.append(pc);	
+
 	}
-	pageView->setRowHeight(pageView->rowCount() - 1, rowHeight10);
 
-	if (cols != 1)
+//	qDebug() << Q_FUNC_INFO << "- Pages rebuilt in" << timer.elapsed() << "milliseconds";
+
+	pageViewWidget->pageGrid()->calculateSize();
+	pageViewWidget->pageGrid()->update();
+
+	m_pagePreviewUpdatePending = true;
+
+	if (currView != nullptr)
 	{
-		for (int i = 0; i < pageView->columnCount(); ++i)
-		{
-			if ((i % 2) == 0)
-				pageView->setColumnWidth(i, rowHeight10);
-			else
-				pageView->setColumnWidth(i, columnWidth);
-		}
+		markPage(currView->m_doc->currentPageNumber());		
 	}
-
-	pageView->update();
-	if (currView != nullptr)
-		markPage(currView->m_doc->currentPageNumber());
 	connect(pageLayout, SIGNAL(selectedLayout(int)), this, SLOT(handlePageLayout(int)));
 	connect(pageLayout, SIGNAL(selectedFirstPage(int)), this, SLOT(handleFirstPage(int)));
 }
@@ -347,18 +406,8 @@
 	if (currView == nullptr)
 		return;
 
-	SeItem *it;
-	for (int i = 0; i < pageList.count(); i++)
-	{
-		it = pageList.at(i);
-		if (it->pageNumber == nr)
-		{
-			pageView->clearSelection();
-			pageView->item(it->row(), it->column())->setSelected(true);
-			pageView->scrollToItem(pageView->item(it->row(), it->column()), QAbstractItemView::EnsureVisible);
-			break;
-		}
-	}
+	pageViewWidget->pageGrid()->setSelectedPage(nr);
+	pageViewWidget->scrollToPage(nr);
 }
 
 void PagePalette_Pages::setView(ScribusView *view)
@@ -365,7 +414,12 @@
 {
 	if (m_scMW->scriptIsRunning())
 		return;
+
 	currView = view;
+
+//	if(currView)
+//		connect(currView->m_doc, SIGNAL(pagePreviewChanged()), this, SLOT(updatePagePreview()));
+
 }
 
 void PagePalette_Pages::selMasterPage()
@@ -376,39 +430,20 @@
 	emit gotoMasterPage(pageVar.toString());
 }
 
-QPixmap PagePalette_Pages::createIcon(int number, QString masterPage, const QPixmap& pixin)
-{
-	// Necessary on windows to ensure the pixmap is drawable
-	QPixmap ret(pixin.width() * devicePixelRatioF(), pixin.height() * devicePixelRatioF());
-	ret.setDevicePixelRatio(devicePixelRatioF());
+//QPixmap PagePalette_Pages::createPagePreview(const QPixmap &pixin, QSize size)
+//{
+//	QRect pageRect(0, 0, size.width(), size.height());
+//	QPixmap tile(size);
 
-	QPainter p;
-	if (!p.begin(&ret))
-		return ret;
+//	QPainter painter;
+//	painter.begin(&tile);
+//	painter.fillRect(pageRect, Qt::white);
+//	painter.drawPixmap(pageRect, pixin);
+//	painter.end();
 
-	p.drawPixmap(0, 0, pixin);
-	p.setBrush(Qt::white);
-	p.setBackground(Qt::white);
-	p.setBackgroundMode(Qt::OpaqueMode);
-	p.setPen(QPen(Qt::black, 0, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
-	QString tmp(currView->m_doc->getSectionPageNumberForPageIndex(number));
-	if (tmp.isEmpty())
-		tmp.setNum(number + 1);
-	QRegularExpression regExp ("([A-Z]*[0-9]*)( *[\\.|\\-|_] *)(.*)");
-	QRegularExpressionMatch match = regExp.match(masterPage);
-	if (match.hasMatch())
-		masterPage = match.captured(1);
-	QRect rect(0, 0, pixin.width(), pixin.height());
-	p.setRenderHint(QPainter::TextAntialiasing, true);
-	p.setFont(QFont("Helvetica", 7, QFont::Normal));
-	p.drawText(rect, Qt::AlignCenter, tmp + "\n" + masterPage);
-	p.end();
+//	return tile;
+//}
 
-	if (!pixin.mask().isNull())
-		ret.setMask( pixin.mask() );
-	return ret;
-}
-
 void PagePalette_Pages::changeEvent(QEvent *e)
 {
 	if (e->type() == QEvent::LanguageChange)
@@ -416,18 +451,28 @@
 		languageChange();
 		return;
 	}
-	
+
 	QWidget::changeEvent(e);
 }
 
 void PagePalette_Pages::iconSetChange()
 {
-	pix = IconManager::instance().loadPixmap("32/page-simple.png");
-	if (currView != nullptr)
-		rebuild();
+	IconManager& iconManager = IconManager::instance();
+
+	// Pages
+	buttonPageImport->setIcon(iconManager.loadIcon("page-import"));
+	buttonPageInsert->setIcon(iconManager.loadIcon("page-insert"));
+	buttonPageDuplicate->setIcon(iconManager.loadIcon("page-duplicate"));
+	buttonPageMove->setIcon(iconManager.loadIcon("page-move"));
 }
 
 void PagePalette_Pages::languageChange()
 {
+	// Pages
+	buttonPageDuplicate->setToolTip( tr( "Duplicate the selected page" ) );
+	buttonPageMove->setToolTip( tr( "Move the selected page" ) );
+	buttonPageInsert->setToolTip( tr( "Add a new page" ) );
+	buttonPageImport->setToolTip( tr( "Import pages from another document" ) );
+
 	retranslateUi(this);
 }
Index: scribus/ui/pagepalette_pages.h
===================================================================
--- scribus/ui/pagepalette_pages.h	(Revision 25541)
+++ scribus/ui/pagepalette_pages.h	(Arbeitskopie)
@@ -25,6 +25,8 @@
 class SeItem;
 class SeList;
 class SeView;
+class PageViewer;
+class PageCell;
 
 class SCRIBUS_API PagePalette_Pages : public QWidget, Ui::PagePalette_PagesBase
 {
@@ -34,9 +36,6 @@
 	PagePalette_Pages(QWidget* parent);
 	~PagePalette_Pages() {};
 
-protected:
-	void changeEvent(QEvent *e) override;
-
 public slots:
 	void setView(ScribusView *view);
 	void deleteMasterPage(const QString& tmp);
@@ -51,14 +50,22 @@
 	void markPage(uint nr);
 	void selMasterPage();
 	void languageChange();
+	void updatePagePreview();
 
 private slots:
 	void iconSetChange();
 	void pageView_applyMasterPage(const QString& masterpageName, int pageIndex);
 	void pageView_movePage(int r, int c);
-	void pageView_gotoPage(int r, int c, int b);
+	void pageView_gotoPage(int pageID, int b);
 	void pageView_deletePage(int pageIndex);
+	void pageView_updatePagePreview();
 
+	void newPage();
+	void duplicatePage();
+	void importPage();
+	void movePage();
+	void deletePage();
+
 signals:
 	void gotoMasterPage(QString);
 	void gotoPage(int);
@@ -66,11 +73,11 @@
 protected:
 	ScribusView       *currView { nullptr};
 	ScribusMainWindow *m_scMW { nullptr};
+	bool m_pagePreviewUpdatePending {true};
 
-	QList<SeItem*>    pageList;
-	QPixmap pix;
+//	QPixmap createPagePreview(const QPixmap& pixin, QSize size);
 
-	QPixmap createIcon(int number, QString masterPage, const QPixmap& pixin);
+	void changeEvent(QEvent *e) override;
 };
 
 #endif // SEITENPAL_H
Index: scribus/ui/pagepalette_pagesbase.ui
===================================================================
--- scribus/ui/pagepalette_pagesbase.ui	(Revision 25541)
+++ scribus/ui/pagepalette_pagesbase.ui	(Arbeitskopie)
@@ -7,7 +7,7 @@
     <x>0</x>
     <y>0</y>
     <width>220</width>
-    <height>286</height>
+    <height>419</height>
    </rect>
   </property>
   <property name="windowTitle">
@@ -28,6 +28,12 @@
    </property>
    <item>
     <widget class="QSplitter" name="splitter">
+     <property name="sizePolicy">
+      <sizepolicy hsizetype="Preferred" vsizetype="Expanding">
+       <horstretch>0</horstretch>
+       <verstretch>0</verstretch>
+      </sizepolicy>
+     </property>
      <property name="orientation">
       <enum>Qt::Vertical</enum>
      </property>
@@ -35,6 +41,12 @@
       <bool>false</bool>
      </property>
      <widget class="QWidget" name="widget" native="true">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="Preferred" vsizetype="Maximum">
+        <horstretch>0</horstretch>
+        <verstretch>0</verstretch>
+       </sizepolicy>
+      </property>
       <layout class="QVBoxLayout" name="verticalLayout_3">
        <property name="spacing">
         <number>5</number>
@@ -74,6 +86,12 @@
       </layout>
      </widget>
      <widget class="QWidget" name="widget_2" native="true">
+      <property name="sizePolicy">
+       <sizepolicy hsizetype="MinimumExpanding" vsizetype="Expanding">
+        <horstretch>0</horstretch>
+        <verstretch>1</verstretch>
+       </sizepolicy>
+      </property>
       <layout class="QVBoxLayout" name="verticalLayout_4">
        <property name="spacing">
         <number>5</number>
@@ -98,33 +116,61 @@
         </widget>
        </item>
        <item>
-        <widget class="SeView" name="pageView">
-         <property name="toolTip">
-          <string>&lt;qt&gt;List of normal pages in the document, shown with the document layout. Pages may be dragged to rearrange or delete them.&lt;/qt&gt;</string>
+        <layout class="QHBoxLayout" name="horizontalLayout_2">
+         <property name="spacing">
+          <number>4</number>
          </property>
-         <property name="selectionMode">
-          <enum>QAbstractItemView::NoSelection</enum>
+         <item>
+          <widget class="QToolButton" name="buttonPageInsert">
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QToolButton" name="buttonPageImport">
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QToolButton" name="buttonPageDuplicate">
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <widget class="QToolButton" name="buttonPageMove">
+           <property name="text">
+            <string/>
+           </property>
+          </widget>
+         </item>
+         <item>
+          <spacer name="horizontalSpacer">
+           <property name="orientation">
+            <enum>Qt::Horizontal</enum>
+           </property>
+           <property name="sizeHint" stdset="0">
+            <size>
+             <width>40</width>
+             <height>20</height>
+            </size>
+           </property>
+          </spacer>
+         </item>
+        </layout>
+       </item>
+       <item>
+        <widget class="PageViewer" name="pageViewWidget" native="true">
+         <property name="sizePolicy">
+          <sizepolicy hsizetype="Expanding" vsizetype="Expanding">
+           <horstretch>0</horstretch>
+           <verstretch>0</verstretch>
+          </sizepolicy>
          </property>
-         <property name="iconSize">
-          <size>
-           <width>60</width>
-           <height>60</height>
-          </size>
-         </property>
-         <property name="rowCount">
-          <number>1</number>
-         </property>
-         <property name="columnCount">
-          <number>1</number>
-         </property>
-         <attribute name="horizontalHeaderVisible">
-          <bool>false</bool>
-         </attribute>
-         <attribute name="verticalHeaderVisible">
-          <bool>false</bool>
-         </attribute>
-         <row/>
-         <column/>
         </widget>
        </item>
       </layout>
@@ -173,11 +219,6 @@
    <header>ui/pagepalette_widgets.h</header>
   </customwidget>
   <customwidget>
-   <class>SeView</class>
-   <extends>QTableWidget</extends>
-   <header>ui/pagepalette_widgets.h</header>
-  </customwidget>
-  <customwidget>
    <class>PageLayouts</class>
    <extends>QGroupBox</extends>
    <header>ui/pagelayout.h</header>
@@ -188,6 +229,12 @@
    <extends>QLabel</extends>
    <header>ui/pagepalette_widgets.h</header>
   </customwidget>
+  <customwidget>
+   <class>PageViewer</class>
+   <extends>QWidget</extends>
+   <header>ui/pagepalette_widgets.h</header>
+   <container>1</container>
+  </customwidget>
  </customwidgets>
  <resources/>
  <connections/>
Index: scribus/ui/pagepalette_widgets.cpp
===================================================================
--- scribus/ui/pagepalette_widgets.cpp	(Revision 25541)
+++ scribus/ui/pagepalette_widgets.cpp	(Arbeitskopie)
@@ -9,6 +9,7 @@
 #include <QBitmap>
 #include <QCursor>
 #include <QDrag>
+#include <QElapsedTimer>
 #include <QEvent>
 #include <QHeaderView>
 #include <QLabel>
@@ -17,6 +18,7 @@
 #include <QMimeData>
 #include <QMessageBox>
 #include <QPainter>
+#include <QScrollArea>
 #include <QStringView>
 
 #include "iconmanager.h"
@@ -23,22 +25,15 @@
 #include "pagepalette_widgets.h"
 #include "scribusapp.h"
 
+const QString MIMETYPE = "page/magic";
 
-/* IconItems Code */
-SeItem::SeItem(const QString& text, uint nr, const QPixmap& pix)
-	: QTableWidgetItem(QIcon(pix), "", 1002),
-	  pageNumber(nr),
-	  pageName(text)
-{
-	setFlags(Qt::ItemIsSelectable | Qt::ItemIsEnabled);
-}
-
-const QString& SeItem::getPageName()
-{
-	return pageName;
-}
-
-/* ListBox Subclass */
+/* ********************************************************************************* *
+ *
+ *
+ * Master Page List
+ *
+ *
+ * ********************************************************************************* */
 SeList::SeList(QWidget* parent) : QListWidget(parent)
 {
 	setAcceptDrops(true);
@@ -50,7 +45,7 @@
 	if (m->button() == Qt::RightButton)
 	{
 		QMenu *pmen = new QMenu();
-//		qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
+		//		qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
 		QAction *px = pmen->addAction( tr("Show Page Previews"), this, SLOT(toggleThumbnail()));
 		px->setCheckable(true);
 		if (m_thumb)
@@ -91,16 +86,14 @@
 			return;
 		QMimeData *mimeData = new QMimeData;
 		QString pageName = item->data(Qt::UserRole).toString();
-		mimeData->setData("page/magic", "1" + pageName.toLocal8Bit());
+		mimeData->setData(MIMETYPE, "1" + pageName.toLocal8Bit());
 		mimeData->setText("1" + pageName);
 		QDrag *dr = new QDrag(this);
 		dr->setMimeData(mimeData);
-		const QPixmap& pm = IconManager::instance().loadPixmap("doc.png");
+		//		const QPixmap& pm = IconManager::instance().loadPixmap("doc.png");
+		const QPixmap& pm = item->icon().pixmap(60);
 		dr->setPixmap(pm);
-	//	dr->setDragCursor(pm, Qt::CopyAction);
-	//	dr->setDragCursor(pm, Qt::MoveAction);
 		dr->exec(Qt::CopyAction | Qt::MoveAction);
-		QApplication::setOverrideCursor(Qt::ArrowCursor);
 	}
 }
 
@@ -116,356 +109,1119 @@
 			return;
 		}
 	}
-	
+
 	QListWidget::keyPressEvent(e);
 }
 
 
-/* QTable Subclass */
-SeView::SeView(QWidget* parent) : QTableWidget(parent)
+
+
+/* ********************************************************************************* *
+ *
+ *
+ * Page Cell
+ *
+ *
+ * ********************************************************************************* */
+PageCell::PageCell(const QString& text, uint nr, const QPixmap& pix, double pageSize, const QColor color) :
+	m_pageNumber(nr),
+	m_pagePreview(pix),
+	m_pageName(text),
+	m_masterPageColor(color),
+	m_pageRatio(pageSize)
 {
-	setDragEnabled(true);
+
+}
+
+/* ********************************************************************************* *
+ *
+ *
+ * Page Viewer
+ *
+ *
+ * ********************************************************************************* */
+
+PageViewer::PageViewer(QWidget *parent) : QWidget(parent)
+{
+	m_pageGrid = new PageGrid(this);
+
+	m_scroll = new QScrollArea;
+	m_scroll->setWidget(m_pageGrid);
+
+	m_scroll->setWidgetResizable(true);
+	m_scroll->setHorizontalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+	m_scroll->setVerticalScrollBarPolicy(Qt::ScrollBarAsNeeded);
+	m_scroll->setFrameShape(QFrame::NoFrame);
+
+	QVBoxLayout* layout = new QVBoxLayout;
+	layout->addWidget(m_scroll);
+	layout->setContentsMargins(0,0,0,0);
+
+	setLayout(layout);
+
+}
+
+PageGrid *PageViewer::pageGrid()
+{
+	return m_pageGrid;
+}
+
+void PageViewer::scrollToPage(int pageId)
+{
+	QPoint posOfSelection = pageGrid()->pagePosition(pageId);
+
+	m_scroll->ensureVisible(
+				posOfSelection.x(),
+				posOfSelection.y(),
+				pageGrid()->rowHeight(),
+				pageGrid()->rowHeight()
+				);
+
+}
+
+void PageViewer::keyPressEvent(QKeyEvent *event)
+{
+	int k = event->key();
+	if (k == Qt::Key_Delete)
+	{
+		event->accept();
+
+		m_pageGrid->deleteSelectedPage();
+		return;
+	}
+
+	QWidget::keyPressEvent(event);
+}
+
+
+
+/* ********************************************************************************* *
+ *
+ *
+ * Page Grid
+ *
+ *
+ * *********************************************************************************
+ *
+ * Grid Scheme for Double Page
+ *
+ *        Column 1       Column 2              Column 3       Column 4
+ *     ------------------------------       ------------------------------
+ *  R  | Group                      |       | Group                      |
+ *  o  | ----------      ---------- | Group | ----------      ---------- |
+ *  w  | | Cell   | Cell | Cell   | | Space | | Cell   | Cell | Cell   | |
+ *     | |        | Gap  |        | |       | |        | Gap  |        | |
+ *  1  | ----------      ---------- |       | ----------      ---------- |
+ *     ------------------------------       ------------------------------
+ *                Row Space                             Row Space
+ *     ------------------------------       ------------------------------
+ *  R  | Group                      |       | Group                      |
+ *  o  | ----------      ---------- | Group | ----------      ---------- |
+ *  w  | | Cell   | Cell | Cell   | | Space | | Cell   | Cell | Cell   | |
+ *     | |        | Gap  |        | |       | |        | Gap  |        | |
+ *  2  | ----------      ---------- |       | ----------      ---------- |
+ *     ------------------------------       ------------------------------
+ *
+ * A group can have minimum 1 cell or maximum 4 cells
+ *
+ * ********************************************************************************* */
+
+
+
+PageGrid::PageGrid(QWidget *parent)
+	: QWidget{parent}
+{
+	pageList = QList<PageCell*>();
+	m_rowHeight = 96;
+	m_cellGap = 1;
+	m_groupSpace = 16;
+	m_rowSpace = 12;
+	m_fontSize = 7; // font size of number label and masterpage label
+	m_labelGap = 8; // gap between page and number label
+	m_colorSelection = QColor(255, 51, 51);
+	m_pageOffset = 0;
+	m_pageLayout = PageLayout::singlePage;
+	m_cellsInGroup = 1; // single page
+	m_selectedPage = -1;
+	m_hoveredPage = -1;
+	m_rectInsert = QRect();
+	m_rectSelection = QRect();
+	m_documentPageSize = QSize(m_rowHeight, m_rowHeight);
+	m_enableSelection = false;
+	m_contextMenu = new QMenu(this);
+
+
+	setContextMenuPolicy(Qt::CustomContextMenu);
 	setAcceptDrops(true);
-	setDropIndicatorShown(true);
-	setShowGrid(false);
-	setWordWrap(true);
+	calculateSize();
+	initContextMenu();
+
+	connect(this, &PageGrid::customContextMenuRequested, this, &PageGrid::showContextMenu);
+
 }
 
-void SeView::mousePressEvent(QMouseEvent* e)
+/* ********************************************************************************* *
+ *
+ * Public Members
+ *
+ * ********************************************************************************* */
+
+void PageGrid::setPageInGroup(int amount)
 {
-	e->accept();
-	m_mousePos = e->position().toPoint();
-	m_mousePressed = true;
-	QTableWidget::mousePressEvent(e);
+	m_cellsInGroup = amount;
 }
 
-void SeView::mouseReleaseEvent(QMouseEvent* e)
+void PageGrid::setDocumentPageSize(QSizeF pageSize)
 {
-	e->accept();
-	m_mousePressed = false;
+	m_documentPageSize = pageSize;
+}
 
-	QPoint mouseEventPos = e->position().toPoint();
-	emit Click(rowAt(mouseEventPos.y()), columnAt(mouseEventPos.x()), e->button());
-	QTableWidget::mouseReleaseEvent(e);
+void PageGrid::setRowHeight(int size)
+{
+	// clamp size from 48 to 256)
+	m_rowHeight = qBound(48, size, 256);
+	//	updateTileSize();
+	calculateSize();
+	update();
 }
 
-void SeView::mouseMoveEvent(QMouseEvent* e)
+int PageGrid::rowHeight()
 {
-	QPoint mouseEventPos = e->position().toPoint();
-	if ((m_mousePressed) && ((m_mousePos - mouseEventPos).manhattanLength() > 4))
+	return m_rowHeight;
+}
+
+void PageGrid::setFontSize(int size)
+{
+	m_fontSize = size;
+	//	updateTileSize();
+	update();
+}
+
+int PageGrid::fontSize()
+{
+	return m_fontSize;
+}
+
+void PageGrid::setSelectionColor(QColor color)
+{
+	m_colorSelection = color;
+	update();
+}
+
+QColor PageGrid::selectionColor()
+{
+	return m_colorSelection;
+}
+
+void PageGrid::setPageLayout(PageLayout layout)
+{
+	m_pageLayout = layout;
+
+	switch(m_pageLayout)
 	{
-		m_mousePressed = false;
-		int a = rowAt(mouseEventPos.y());
-		int b = columnAt(mouseEventPos.x());
-		if ((a != -1) && (b != -1))
+	default:
+	case PageLayout::singlePage:
+		m_cellsInGroup = 1;
+		break;
+	case PageLayout::doublePage:
+		m_cellsInGroup = 2;
+		break;
+	case PageLayout::triplePage:
+		m_cellsInGroup = 3;
+		break;
+	case PageLayout::quadroPage:
+		m_cellsInGroup = 4;
+		break;
+	}
+
+	update();
+}
+
+PageLayout PageGrid::pageLayout()
+{
+	return m_pageLayout;
+}
+
+void PageGrid::setPageOffset(int pageCount)
+{
+	m_pageOffset = pageCount;
+	calculateSize();
+	update();
+}
+
+int PageGrid::pageOffset()
+{
+	return m_pageOffset;
+}
+
+//void PageGrid::setPageList(const QList<PageCell *> list)
+//{
+//	m_pageList = list;
+//	calculateSize();
+//	//	update();
+//}
+
+//QList<PageCell *> PageGrid::pageList() const
+//{
+//	return m_pageList;
+//}
+
+int PageGrid::pageId(int r, int c, bool clampId)
+{
+
+	if ( r == -1 || c == -1) return -1;
+
+	int id = (r == 0) ? c : r * columns() + c;
+	id -= m_pageOffset;
+
+	// Important: The page id can be equal to pageCount to have an extra cell after the last one.
+	return (clampId) ? clampPageId(id, true) : id;
+
+}
+
+int PageGrid::pageId(QPoint pos, bool clampId)
+{
+	int row = rowAt(pos);
+	int col = columnAt(pos);
+
+	return pageId(row, col, clampId);
+}
+
+PageCell *PageGrid::getPageItem(int pageIndex)
+{
+	if(pageCount() == 0 || pageIndex >= pageCount() || pageIndex < 0)
+		return nullptr;
+
+	return pageList.at( clampPageId(pageIndex) );
+
+}
+
+
+int PageGrid::pageCount()
+{
+	return pageList.count();
+}
+
+int PageGrid::pageHeight()
+{
+	return m_rowHeight - m_fontSize - m_labelGap;
+}
+
+
+void PageGrid::setSelectedPage(int pageID)
+{
+	m_selectedPage = clampPageId(pageID);
+	update();
+}
+
+
+int PageGrid::selectedPage()
+{
+	return m_selectedPage;
+}
+
+void PageGrid::deleteSelectedPage()
+{
+	emit delPageRequest( clampPageId(m_selectedPage) );
+}
+
+void PageGrid::clear()
+{
+	pageList.clear();
+	clearUi();
+	calculateSize();
+}
+
+/* ********************************************************************************* *
+ *
+ * Private Members
+ *
+ * ********************************************************************************* */
+
+int PageGrid::columns()
+{
+	return m_cellsInGroup ;
+}
+
+int PageGrid::rows()
+{
+	// total page count + offset pages
+	return qCeil( (double)(pageCount() + m_pageOffset + 1) / (double)columns() );
+}
+
+int PageGrid::columnAt(QPoint pos)
+{
+	if(pageCount() == 0) return -1;
+
+	int row = rowAt(pos);
+	if ( row == -1) return row;
+
+	int m_col = -1;
+
+	int cellId = row * m_cellsInGroup;
+	int pageId = cellId - m_pageOffset;
+	QRect cellRect(m_groupSpace, m_rowSpace + row * (rowHeight() + m_rowSpace), dummyPageSize().width(), rowHeight());
+	int width = 0;
+
+	for (int i = 0; i < m_cellsInGroup; ++i)
+	{
+
+		int id = cellId + i;
+
+		// skip empty cells
+		if (id < m_pageOffset || id >= pageCount() + m_pageOffset)
 		{
-			QTableWidgetItem* ite = item(a, b);
-			if (ite != nullptr)
-			{
-				if (ite->type() == 1002)
-				{
-					SeItem* it = (SeItem*)ite;
-					QString str(it->pageName);
-					bool dummy;
-					int p = getPage(a, b, &dummy);
-					QString tmp;
-					QMimeData *mimeData = new QMimeData;
-					mimeData->setData("page/magic", "2 " + tmp.setNum(p).toLocal8Bit() + " " + str.toLocal8Bit());
-					mimeData->setText("2 " + tmp.setNum(p) + " " + str);
-					QDrag *dr = new QDrag(this);
-					dr->setMimeData(mimeData);
-					const QPixmap& pm = IconManager::instance().loadPixmap("doc.png");
-					dr->setPixmap(pm);
-				//	dr->setDragCursor(pm, Qt::CopyAction);
-				//	dr->setDragCursor(pm, Qt::MoveAction);
-					dr->exec(Qt::CopyAction | Qt::MoveAction);
-					QApplication::setOverrideCursor(Qt::ArrowCursor);
-				}
-			}
+			//qDebug() << "Cell" << id << "is Empty";
+			width = dummyPageSize().width();
 		}
-	}
-	QTableWidget::mouseMoveEvent(e);
+		else
+		{
+			//qDebug() << "Cell" << id << "is Page" << "PageId" << pageId + i;
+			PageCell *pc = pageList.at(pageId + i);
+			width = pc->pageWidthByHeight(pageHeight());
+		}
+
+		cellRect.setWidth( width );
+
+		if(cellRect.contains(pos))
+		{
+			m_col = i;
+			//qDebug() << "Page" << pageId + i << "at" << pos << "in column"<< i;
+			break;
+		}
+
+		cellRect.setX(cellRect.x() + width + m_cellGap);
+	};
+
+	int m_columns = columns();
+
+	return (m_col < m_columns) ? m_col : m_columns -1;
 }
 
-void SeView::dropEvent(QDropEvent * e)
+int PageGrid::rowAt(QPoint pos)
 {
-	
-	bool lastPage = false;
-	if (!e->mimeData()->hasFormat("page/magic"))
-		return;
+	if(pageCount() == 0) return -1;
 
-	QPoint dropEventPos = e->position().toPoint();
-	e->setDropAction(Qt::MoveAction);
-	e->accept();
-	// HACK to prevent strange Qt4 cursor behaviour after dropping. It's examined by Trolltech now - PV.
-	// It's the one and only reason why to include QApplication here.
-	// But sadly this destroys our normal Cursors
-	// Fixed at least in Qt-4.4.2
-//	QApplication::restoreOverrideCursor();
-	clearPix();
+	int gridHeight = m_rowSpace + rowHeight();
+	int m_rows = rows();
+	int m_row = pos.y() / gridHeight;
 
-	QString tmp;
-	QString str = e->mimeData()->text();
-	if (str.startsWith("1"))
+	return (m_row < m_rows) ? m_row : m_rows -1;
+}
+
+int PageGrid::rowWidth(int rowId)
+{
+	if(pageCount() == 0 || rowId < 0) return -1;
+
+	int cellId = rowId * m_cellsInGroup;
+	int pageId = cellId - m_pageOffset;
+	int width = 0;
+
+	for (int i = 0; i < m_cellsInGroup; ++i)
 	{
-		int a = rowAt(dropEventPos.y());
-		int b = columnAt(dropEventPos.x());
-		int p;
-		tmp = str.remove(0,1);
-		if ((a == -1) || (b == -1))
-			return;
-		if (a == rowCount() - 1)
+		int id = cellId + i;
+
+		if (id < m_pageOffset || id >= pageCount() + m_pageOffset)
 		{
-			emit NewPage(m_pageCount, tmp);
-			return;
+			width += dummyPageSize().width();
 		}
-		p = getPage(a, b, &lastPage);
-		if (columnCount() == 1)
+		else
 		{
-			if ((a % 2) == 0)
-				emit NewPage(p, tmp);
-			else
-			{
-				emit UseTemp(tmp, p);
-				QTableWidgetItem* ite = item(a, b);
-				if (ite == nullptr)
-					return;
-				if (ite->type() == 1002)
-				{
-					SeItem* it = (SeItem*)ite;
-					it->pageName = tmp;
-				}
-			}
-			return;
+			PageCell *pc = pageList.at(pageId + i);
+			width += pc->pageWidthByHeight(pageHeight());
 		}
-		if ((b % 2) == 0)
+
+		width += m_cellGap;
+
+	};
+
+	width += m_groupSpace * 2;
+
+	return width;
+
+}
+
+QRect PageGrid::rectAt(int row, int col)
+{
+	if ( row == -1 || col == -1) return QRect();
+
+	int cellId = row * m_cellsInGroup;
+	int pageId = cellId - m_pageOffset;
+	QRect cellRect(m_groupSpace, m_rowSpace + row * (rowHeight() + m_rowSpace), dummyPageSize().width(), rowHeight());
+	int width = 0;
+
+	for (int i = 0; i < m_cellsInGroup; ++i)
+	{
+
+		int id = cellId + i;
+
+		// skip empty cells
+		if (id < m_pageOffset || id >= pageCount() + m_pageOffset)
 		{
-			if (lastPage)
-				emit NewPage(p + 1, tmp);
-			else
-				emit NewPage(p, tmp);
+			width = dummyPageSize().width();
 		}
 		else
 		{
-			emit UseTemp(tmp, p);
-			QTableWidgetItem* ite = item(a, b);
-			if (ite == nullptr)
-				return;
-			if (ite->type() == 1002)
-			{
-				SeItem* it = (SeItem*)ite;
-				it->pageName = tmp;
-			}
+			PageCell *pc = pageList.at(pageId + i);
+			width = pc->pageWidthByHeight(pageHeight());
 		}
-		return;
+
+		cellRect.setWidth( width );
+
+		if(i == col)
+		{
+			return cellRect;
+		}
+
+		cellRect.setX(cellRect.x() + width + m_cellGap);
+	};
+
+	return QRect();
+
+}
+
+QSize PageGrid::dummyPageSize()
+{
+	double ratio = m_documentPageSize.width() / m_documentPageSize.height();
+	QSize dummySize(pageHeight() * ratio, pageHeight());
+
+	//qDebug() << dummySize << ratio << m_documentPageSize.width() << m_documentPageSize.height();
+
+	return dummySize;
+}
+
+QPoint PageGrid::mapPosToCell(QPoint pos, Mode &mode)
+{
+	int col = columnAt(pos);
+	int row = rowAt(pos);
+
+	// return if there is no row or column
+	if(col == -1 || row == -1)
+	{
+		mode = Mode::Invalid;
+		return QPoint();
 	}
-	if (str.startsWith("2"))
+
+	int id = pageId(row, col, false);
+	QRect cellRect = rectAt(row, col);
+	int x = cellRect.x();
+	int y = cellRect.y();
+
+	// cell doesn't have a page
+	if(id < 0 || id >= pageCount()){
+		mode = Mode::Add;
+	}
+	else
 	{
-		int st = str.indexOf(" ");
-		int en = str.indexOf(" ", st + 1);
-		tmp = str.mid(en + 1);
-		int dr = QStringView(str).sliced(st, en - st).toInt();
-		int a = rowAt(dropEventPos.y());
-		int b = columnAt(dropEventPos.x());
-		if ((a == -1) || (b == -1))
-			return;
-		QTableWidgetItem* ite = item(a, b);
-		int p = getPage(a, b, &lastPage);
-		if (a == rowCount() - 1)
+		// check if mouse is on "insert area"
+		QRect insertArea(x, y, 8, rowHeight());
+		if(insertArea.contains(pos))
 		{
-			emit movePage(dr, p+1);
-			return;
+			mode = Mode::Insert;
 		}
-		if (columnCount() == 1)
-		{
-			if ((a % 2) == 0)
-				emit movePage(dr, p);
-			else
-			{
-				emit UseTemp(tmp, p);
-				if (ite == nullptr)
-					return;
-				SeItem* it = (SeItem*)ite;
-				it->pageName = tmp;
-			}
-			return;
-		}
-		if ((b % 2) == 0)
-			emit movePage(dr, lastPage ? p+1 : p);
 		else
 		{
-			emit UseTemp(tmp, p);
-			if (ite == nullptr)
-				return;
-			if (ite->type() == 1002)
-			{
-				SeItem* it = (SeItem*)ite;
-				it->pageName = tmp;
-			}
+			mode = Mode::Hover;
 		}
-		return;
 	}
+
+	return QPoint(x,y);
 }
 
-void SeView::dragEnterEvent(QDragEnterEvent *e)
+QPoint PageGrid::pagePosition(int pageId)
 {
-	if (e->mimeData()->hasFormat("page/magic"))
-		e->acceptProposedAction();
+	if(pageId < 0 || pageId >= pageCount()) return QPoint();
+
+	int row = qCeil( (pageId + m_pageOffset) / m_cellsInGroup );
+	int col = 0;
+
+	return rectAt(row, col).topLeft();
 }
 
-void SeView::dragLeaveEvent(QDragLeaveEvent *)
+int PageGrid::clampPageId(int pageID, bool allowPlusOne)
 {
-	clearPix();
+	int max = (allowPlusOne) ? pageCount() : pageCount() -1;
+	return qBound( 0, pageID, max);
 }
 
-void SeView::dragMoveEvent(QDragMoveEvent *e)
-{
-	if (!e->mimeData()->hasFormat("page/magic"))
-		return;
 
-	e->acceptProposedAction();
-	clearPix();
+/* ********************************************************************************* *
+ *
+ * Methods
+ *
+ * ********************************************************************************* */
 
-	QPoint dragEventPos = e->position().toPoint();
-	int row = rowAt(dragEventPos.y());
-	int col = columnAt(dragEventPos.x());
-	if ((row == -1) || (col == -1))
-		return;
+void PageGrid::updateSelectedPage(QPoint pos)
+{
+	int col = columnAt(pos);
+	int row = rowAt(pos);
+	int id = pageId(row, col);
 
-	if (columnCount() == 1)
+	// check if page id is in range of an existing cell
+	if(id > -1 && id < pageCount() )
 	{
-		if ((row % 2) == 0)
+		int newSelectedPage = clampPageId( id );
+
+		// repaint only if there is a change
+		if(newSelectedPage != m_selectedPage)
 		{
-			item(row, 0)->setBackground(Qt::darkBlue);
+			m_selectedPage = newSelectedPage;
+			update();
 		}
 	}
-	else
+
+}
+
+void PageGrid::updateModeMarker(QPoint pos)
+{	
+	Mode mode;
+	QPoint mapPos = mapPosToCell(pos, mode);
+
+	// check if mouse is on "insert area"
+	switch(mode)
 	{
-		if (((col % 2) == 0) || (row == rowCount()-1))
-		{
-			item(row, col)->setBackground(Qt::darkBlue);
-		}
+	case Mode::Add:
+		m_rectInsert = QRect();
+		m_rectAdd = QRect(mapPos.x(), mapPos.y(), dummyPageSize().width(), dummyPageSize().height() );
+		m_hoveredPage = -1;
+		break;
+	case Mode::Insert:
+	{
+		int selectorWidth = 4;
+		int offsetX = mapPos.x() - selectorWidth / 2 - qRound((double)m_cellGap / 2);
+		m_rectInsert = QRect(offsetX, mapPos.y() - 4, selectorWidth, pageHeight() + 8 );
+		m_rectAdd = QRect();
+		m_hoveredPage = -1;
 	}
+		break;
+	case Mode::Hover:
+	{
+		int col = columnAt(pos);
+		int row = rowAt(pos);
+		int id = pageId(row, col);
+		m_rectInsert = QRect();
+		m_rectAdd = QRect();
+		m_hoveredPage = id;
+	}
+		break;
+	case Mode::Invalid:
+	default:
+		m_rectInsert = QRect();
+		m_rectAdd = QRect();
+		m_hoveredPage = -1;
+		break;
+	}
+
+	update();
+
 }
 
-void SeView::keyPressEvent(QKeyEvent * e)
+void PageGrid::calculateSize()
 {
-	int k = e->key();
-	if (k == Qt::Key_Delete)
+	int width = dummyPageSize().width() + m_groupSpace * 2;
+
+	for (int i = 0; i < rows(); ++i)
 	{
-		e->accept();
-		bool dummy;
-		int pageToDelete = getPage(currentRow(), currentColumn(), &dummy);
-		emit delPageRequest(pageToDelete);
-		return;
+		width = qMax(width, rowWidth(i));
 	}
 
-	QTableWidget::keyPressEvent(e);
+	setMinimumHeight(rows() * (m_rowHeight + m_rowSpace) );
+	setMinimumWidth(width);
+
 }
 
-void SeView::clearPix()
+void PageGrid::clearUi()
 {
-	int rowcounter = 0;
-	for (int i = 0; i < rowCount(); ++i)
+	m_rectInsert = QRect();
+	m_rectSelection = QRect();
+	m_rectAdd = QRect();
+	m_hoveredPage = -1;
+	update();
+}
+
+void PageGrid::drawTile(QPainter &painter, QPoint cellPosition, PageCell *tile, bool selected, bool hovered)
+{
+
+	if(tile == nullptr) return;
+
+	QFont font(this->font().family(), m_fontSize, QFont::Normal);
+	QRect rectPage(cellPosition.x(), cellPosition.y(), tile->pageWidthByHeight(pageHeight()), pageHeight());
+	QRect rectCell(cellPosition.x(), cellPosition.y(), tile->pageWidthByHeight(pageHeight()), m_rowHeight);
+	//	QRect rectMasterPageMarker(cellPosition.x(), cellPosition.y() + rectPage.height(), rectPage.width(), 4);
+
+	painter.save();
+
+	// Draw Page
+	painter.setBrush(Qt::NoBrush);
+	//	painter.setPen( QPen(Qt::black, 1) );
+	painter.drawPixmap(rectPage, tile->pagePreview(), tile->pagePreview().rect());
+	//	painter.drawRect(rectPage);
+
+	// Setup painter for text drawing
+	painter.setRenderHint(QPainter::TextAntialiasing, true);
+	painter.setFont(font);
+
+	// Draw Page Number
+	//painter.setPen(QPen(palette().windowText().color()));
+	painter.setPen(QPen( Qt::white ));
+	painter.drawText(rectCell, Qt::AlignHCenter|Qt::AlignBottom | Qt::TextWordWrap, QString::number(tile->pageNumber() + 1));
+
+	// Draw Page Name
+	painter.setBackgroundMode(Qt::OpaqueMode);
+	painter.setBackground(QColor(0,0,0,128));
+	painter.setPen(QPen(Qt::white));
+	painter.drawText(rectPage.adjusted(2,2,-2,-2), Qt::AlignTop | Qt::AlignLeft |Qt::TextWordWrap, tile->pageName());
+
+	// Draw Master Page Color
+	//	painter.setPen(Qt::NoPen);
+	//	painter.fillRect(rectMasterPageMarker, tile->masterPageColor());
+
+
+	// Draw selection
+	//	if(selected)
+	//	{
+	//		painter.setBrush(Qt::NoBrush);
+	//		painter.setPen( QPen(m_colorSelection, 2) );
+	//		painter.drawRect(rectPage);
+	//	}
+
+	// Draw hover
+	if(hovered)
 	{
-		int counter = 0;
-		if (columnCount() == 1)
+		QColor colHover = palette().highlight().color();
+		colHover.setAlphaF(0.5);
+		painter.setBackgroundMode(Qt::TransparentMode);
+		painter.setBrush(colHover);
+		painter.setPen( Qt::NoPen );
+		painter.drawRect(rectPage);
+	}
+
+	// tmp border
+	//	painter.setPen( Qt::magenta );
+	//	painter.setBrush(Qt::NoBrush);
+	//	painter.drawRect(rectCell);
+
+	painter.restore();
+
+}
+
+void PageGrid::initContextMenu()
+{
+	m_contextMenu->clear();
+
+	m_contextMenu->addAction(tr("&Small Preview"), [this]() {
+		m_rowSpace = 8;
+		setRowHeight(64);
+		emit previewSizeChanged();
+	});
+	m_contextMenu->addAction(tr("&Medium Preview"), [this]() {
+		m_rowSpace = 12;
+		setRowHeight(96);
+		emit previewSizeChanged();
+	});
+	m_contextMenu->addAction(tr("&Large Preview"), [this]() {
+		m_rowSpace = 16;
+		setRowHeight(128);
+		emit previewSizeChanged();
+	});
+//	m_contextMenu->addAction(tr("&Extra Large Preview"), [this]() {
+//		m_rowSpace = 20;
+//		setRowHeight(196);
+//		emit previewSizeChanged();
+//	});
+}
+
+void PageGrid::showContextMenu(QPoint pos)
+{
+	m_contextMenu->popup( mapToGlobal(pos) );
+}
+
+/* ********************************************************************************* *
+ *
+ * Events
+ *
+ * ********************************************************************************* */
+
+void PageGrid::paintEvent(QPaintEvent *event)
+{
+
+	int count = 0;
+	int x = m_groupSpace;
+	int y = m_rowSpace;
+	int offset = 0;
+	QRect selectedPageRect;
+
+	QPainter painter(this);
+
+	// Draw background
+	painter.fillRect(rect(), palette().dark());
+	//painter.fillRect(rect(), QColor(128,128,128));
+
+	if(pageCount() == 0) return;
+
+//	QElapsedTimer timer;
+//	timer.start();
+
+	// Draw pages
+	for(int r = 0; r < rows(); r++)
+	{
+		int groupStart = m_groupSpace;
+		int groupWidth = 0;
+		bool drawGroupRect = false;
+
+		for(int c = 0; c < columns(); c++)
 		{
-			if ((i % 2) == 0)
+
+			// cell is after last page cell
+			if(count >= pageCount() + m_pageOffset)
+				break;
+
+			// cell is a page cell
+			if(count >= m_pageOffset && count < pageCount() + m_pageOffset)
 			{
-				item(rowcounter, 0)->setBackground(Qt::white);
-				rowcounter += 2;
-			}
-		}
-		else
-		{
-			for (int j = 0; j < columnCount(); ++j)
-			{
-				if ((j % 2) == 0)
+				int id = count - m_pageOffset;
+				PageCell * cell = getPageItem(id);
+				if(id == m_selectedPage) selectedPageRect = QRect(x, y, cell->pageWidthByHeight(pageHeight()), pageHeight() );
+				QPoint pos(x,y);
+				drawTile(painter, pos, cell, (id == m_selectedPage) ? true : false, (id == m_hoveredPage) ? true : false);
+
+				// add space only between pages
+				if((c + 1) % m_cellsInGroup == 0 || count == pageCount() + m_pageOffset -1)
 				{
-					item(rowcounter, counter)->setBackground(Qt::white);
-					counter += 2;
+					offset = 0;
 				}
+				else
+					offset = m_cellGap;
+
+
+				x += cell->pageWidthByHeight(pageHeight()) + offset;
+				groupWidth += cell->pageWidthByHeight(pageHeight()) + offset;
+				drawGroupRect = true;
+
+
 			}
-			rowcounter++;
+			// cell is before first page cell
+			else
+			{
+				offset = ((c + 1) % m_cellsInGroup) == 0 ? 0 : m_cellGap;
+				x += dummyPageSize().width() + offset;
+
+				// adjust start on first row if first page has an offset
+				if(r == 0)
+					groupStart = x;
+			}
+
+			count++;
 		}
+
+		// Draw group border
+		if (drawGroupRect)
+			painter.drawRect( QRect(groupStart, y, groupWidth, pageHeight()) );
+
+		y += m_rowHeight + m_rowSpace;
+		x = m_groupSpace;
 	}
-	for (int i = 0; i < columnCount(); ++i)
+
+	// Draw selected page
+	if(!selectedPageRect.isEmpty())
 	{
-		item(rowCount()-1, i)->setBackground(Qt::white);
+		QColor colorSelection = (this->isEnabled()) ? m_colorSelection : palette().highlight().color();
+		painter.setPen( QPen(colorSelection, 2) );
+		painter.setBrush(Qt::NoBrush);
+		painter.drawRect(selectedPageRect);
 	}
+
+	// Draw insert marker
+	if(!m_rectInsert.isEmpty())
+	{
+		painter.fillRect(m_rectInsert, palette().highlight());
+	}
+
+	// Draw add page marker
+	if(!m_rectAdd.isEmpty())
+	{
+		QColor colAdd = Qt::white;
+		colAdd.setAlphaF(0.5);
+		painter.setBackgroundMode(Qt::TransparentMode);
+		painter.fillRect(m_rectAdd, colAdd);
+		painter.setBrush(Qt::NoBrush);
+		colAdd = Qt::black;
+		colAdd.setAlphaF(0.5);
+		painter.setPen( QPen(colAdd, 1, Qt::DashLine) );
+		painter.drawRect(m_rectAdd.adjusted(0, 0, -1, -1));
+	}
+
+	// Draw selection frame
+	if(!m_rectSelection.isEmpty())
+	{
+		QColor colorSelection = palette().highlight().color();
+		painter.setPen( QPen(colorSelection) );
+		colorSelection.setAlphaF(0.5);
+		painter.setBrush(colorSelection);
+		painter.drawRect(m_rectSelection);
+	}
+
+
+	painter.end();
+
+//	qDebug() << "PageGrid::paintEvent() - Render Time Page Grid:" << timer.elapsed() << "milliseconds";
+
 }
 
-int SeView::getPage(int r, int c, bool *last)
+
+void PageGrid::resizeEvent(QResizeEvent *event)
 {
-	int counter = m_firstPage;
-	int rowcounter = 0;
-	int ret = m_pageCount - 1;
-	*last = false;
-	if (r == rowCount() - 1)
+	if (event->oldSize() != event->size())
 	{
-		*last = true;
-		return ret;
+		calculateSize();
 	}
-	if ((r == 0) && (c < m_firstPage * m_colmult + m_coladd))
-		return 0;
-	for (int a = 0; a < m_pageCount; ++a)
+
+	QWidget::resizeEvent(event);
+}
+
+void PageGrid::dropEvent(QDropEvent *event)
+{
+
+	if (!event->mimeData()->hasFormat(MIMETYPE))
+		return;
+
+	QPoint dropEventPos = event->position().toPoint();
+	event->setDropAction(Qt::MoveAction);
+	event->accept();
+
+	clearUi();
+
+	QString tmp;
+	QString str = event->mimeData()->text();
+
+	// external drop
+	if (str.startsWith("1"))
 	{
-		if ((rowcounter * m_rowmult + m_rowadd == r) && (counter * m_colmult + m_coladd == c))
+		int r = rowAt(dropEventPos);
+		int c = columnAt(dropEventPos);
+		tmp = str.remove(0,1);
+
+		if ( r == -1 || c == -1 )
+			return;
+
+		int p = pageId(r, c);
+		Mode mode;
+		mapPosToCell(dropEventPos, mode);
+
+		switch(mode)
 		{
-			ret = a;
-			return ret;
+		case Mode::Add:
+		case Mode::Insert:
+			emit newPage(p, tmp);
+			break;
+		case Mode::Hover:
+			emit useTemplate(tmp, clampPageId(p));
+			break;
+		case Mode::Invalid:
+			break;
 		}
-		if (columnCount() == 1)
+
+		return;
+
+	}
+
+	// internal drop
+	if (str.startsWith("2"))
+	{
+
+		int st = str.indexOf(" ");
+		int en = str.indexOf(" ", st + 1);
+		tmp = str.mid(en + 1);
+		int dr = QStringView(str).sliced(st, en - st).toInt();
+		int r = rowAt(dropEventPos);
+		int c = columnAt(dropEventPos);
+		int id = pageId(r, c);
+
+		if ( r == -1 || c == -1 || id == -1 )
+			return;
+
+		Mode mode;
+		mapPosToCell(dropEventPos, mode);
+
+		switch(mode)
 		{
-			if ((rowcounter * m_rowmult) == r)
-			{
-				ret = a;
-				return ret;
-			}
+		case Mode::Add:
+		case Mode::Insert:
+			emit movePage(dr, id);
+			break;
+		case Mode::Hover:
+			// apply master page only if drop is on existing page
+			emit useTemplate(tmp, clampPageId(id));
+			break;
+		case Mode::Invalid:
+			break;
 		}
-		else
+
+		update();
+		return;
+
+	}
+
+}
+
+void PageGrid::dragEnterEvent(QDragEnterEvent *event)
+{
+	if (event->mimeData()->hasFormat(MIMETYPE))
+		event->acceptProposedAction();
+}
+
+void PageGrid::dragLeaveEvent(QDragLeaveEvent *event)
+{
+	clearUi();
+}
+
+void PageGrid::dragMoveEvent(QDragMoveEvent *event)
+{
+	if (!event->mimeData()->hasFormat(MIMETYPE))
+		return;
+
+	event->acceptProposedAction();
+
+	QPoint dragEventPos = event->position().toPoint();
+	updateModeMarker(dragEventPos);
+
+}
+
+void PageGrid::mouseReleaseEvent(QMouseEvent *event)
+{
+	event->accept();
+
+	QPoint mouseEventPos = event->position().toPoint();
+
+	switch(m_state)
+	{
+	case State::StartDrag:
+		if(pageCount() > 0)
 		{
-			if ((counter * m_colmult == c) && (rowcounter * m_rowmult + m_rowadd == r))
+			updateSelectedPage(mouseEventPos);
+
+			int row = rowAt(mouseEventPos);
+			int col = columnAt(mouseEventPos);
+			int pageID = pageId(row, col);
+
+			if(pageID > -1 && pageID < pageCount() )
 			{
-				ret = a;
-				return ret;
+				emit click(m_selectedPage, event->button());
 			}
 		}
-		counter++;
-		if (counter > m_cols - 1)
+		break;
+
+	case State::StartSelection:
+		break;
+
+	default:
+		break;
+
+	}
+
+	m_state = State::None;
+	clearUi();
+
+	QWidget::mouseReleaseEvent(event);
+}
+
+void PageGrid::mousePressEvent(QMouseEvent *event)
+{
+	event->accept();
+	m_mousePos = event->position().toPoint();
+
+	m_state = State::None;
+
+	if(event->button() == Qt::LeftButton)
+	{
+		int id = pageId(m_mousePos, false);
+
+		if(id == -1 && m_enableSelection == true)
 		{
-			counter = 0;
-			rowcounter++;
+			m_state = State::StartSelection;
 		}
+		else if (id > -1)
+		{
+			m_state = State::StartDrag;
+		}
 	}
-	*last = true;
-	return ret;
+
+	QWidget::mousePressEvent(event);
 }
 
-SeItem* SeView::getPageItem(int pageIndex)
+void PageGrid::mouseMoveEvent(QMouseEvent *event)
 {
-	int rows = this->rowCount();
-	int columns = this->columnCount();
-	for (int i = 0; i < rows; ++i)
+
+	QPoint mouseEventPos = event->position().toPoint();
+
+	if ((m_mousePos - mouseEventPos).manhattanLength() > 4)
 	{
-		for (int j = 0; j < columns; ++j)
+		switch(m_state)
 		{
-			QTableWidgetItem* tbItem = item(i, j);
-			SeItem* pageItem = dynamic_cast<SeItem*>(tbItem);
-			if (pageItem && pageItem->pageNumber == static_cast<uint>(pageIndex))
-				return pageItem;
+		// Drag
+		case State::StartDrag:
+		{
+			m_state = State::None;
+
+			int a = rowAt(mouseEventPos);
+			int b = columnAt(mouseEventPos);
+			if ( a != -1 && b != -1 )
+			{
+				PageCell* ite = getPageItem(pageId(a, b));
+				if (ite != nullptr)
+				{
+
+					QString str(ite->pageName());
+
+					int p = ite->pageNumber();
+					QString tmp;
+					QMimeData *mimeData = new QMimeData;
+					mimeData->setData(MIMETYPE, "2 " + tmp.setNum(p).toLocal8Bit() + " " + str.toLocal8Bit());
+					mimeData->setText("2 " + tmp.setNum(p) + " " + str);
+					QDrag *dr = new QDrag(this);
+					dr->setMimeData(mimeData);
+					//const QPixmap& pm = IconManager::instance().loadPixmap("doc.png");
+					const QPixmap& pm = ite->pagePreview();
+					dr->setPixmap(pm);
+					dr->exec(Qt::CopyAction | Qt::MoveAction);
+
+				}
+			}
+			break;
 		}
+			// Selection
+		case State::StartSelection:
+		{
+			int x = qMin(m_mousePos.x(), mouseEventPos.x());
+			int y = qMin(m_mousePos.y(), mouseEventPos.y());
+			int width = (m_mousePos.x() < mouseEventPos.x()) ? mouseEventPos.x() - m_mousePos.x() : m_mousePos.x() - mouseEventPos.x();
+			int height = (m_mousePos.y() < mouseEventPos.y()) ? mouseEventPos.y() - m_mousePos.y() : m_mousePos.y() - mouseEventPos.y();
+
+			m_rectSelection = QRect(x, y, width, height);
+
+			update();
+			break;
+		}
+		default:
+			// do nothing
+			break;
+		}
 	}
-	return nullptr;
+
+	QWidget::mouseMoveEvent(event);
 }
 
-/* Der Muelleimer */
+
+/* ********************************************************************************* *
+ *
+ *
+ * Trash Bin
+ *
+ *
+ * ********************************************************************************* */
 TrashBin::TrashBin(QWidget * parent) : QLabel(parent)
 {
-	Normal = IconManager::instance().loadPixmap("trashcan.png");
-	Offen = IconManager::instance().loadPixmap("trashcan2.png");
-	setPixmap(Normal);
+	iconSetChange();
 	setScaledContents(false);
 	setAcceptDrops(true);
 
@@ -474,23 +1230,23 @@
 
 void TrashBin::dragEnterEvent(QDragEnterEvent *e)
 {
-	if (e->mimeData()->hasFormat("page/magic"))
+	if (e->mimeData()->hasFormat(MIMETYPE))
 	{
 		e->accept();
-		setPixmap(Offen);
+		setPixmap(open);
 	}
 }
 
 void TrashBin::dragLeaveEvent(QDragLeaveEvent *)
 {
-	setPixmap(Normal);
+	setPixmap(normal);
 }
 
 void TrashBin::dropEvent(QDropEvent * e)
 {
-	setPixmap(Normal);
+	setPixmap(normal);
 	QString str, tmp;
-	if (e->mimeData()->hasFormat("page/magic"))
+	if (e->mimeData()->hasFormat(MIMETYPE))
 	{
 		e->accept();
 		str = e->mimeData()->text();
@@ -510,7 +1266,7 @@
 
 void TrashBin::iconSetChange()
 {
-	Normal = IconManager::instance().loadPixmap("trashcan.png");
-	Offen = IconManager::instance().loadPixmap("trashcan2.png");
-	setPixmap(Normal);
+	normal = IconManager::instance().loadPixmap("trashcan.png");
+	open = IconManager::instance().loadPixmap("trashcan2.png");
+	setPixmap(normal);
 }
Index: scribus/ui/pagepalette_widgets.h
===================================================================
--- scribus/ui/pagepalette_widgets.h	(Revision 25541)
+++ scribus/ui/pagepalette_widgets.h	(Arbeitskopie)
@@ -7,6 +7,7 @@
 #ifndef PAGEPALETTE_WIDGETS_H
 #define PAGEPALETTE_WIDGETS_H
 
+#include "qmenu.h"
 #include <QCheckBox>
 #include <QDialog>
 #include <QDragEnterEvent>
@@ -22,6 +23,7 @@
 #include <QMouseEvent>
 #include <QPixmap>
 #include <QPushButton>
+#include <QScrollArea>
 #include <QSplitter>
 #include <QTableWidget>
 #include <QTableWidgetItem>
@@ -31,29 +33,19 @@
 class QEvent;
 
 #include "scribusapi.h"
-#include "scdockpalette.h"
+#include "pagestructs.h"
 
 class ScribusView;
 class ScribusMainWindow;
 class PageLayouts;
 
-class SCRIBUS_API SeItem : public QTableWidgetItem
-{
-	friend class PagePalette;
-	friend class PagePalette_Pages;
-	friend class SeView;
 
-public:
-	SeItem(const QString& text, uint pgnr, const QPixmap& pix);
-	~SeItem() {};
+/* ********************************************************************************* *
+ *
+ * Master Page List
+ *
+ * ********************************************************************************* */
 
-	const QString& getPageName();
-	uint pageNumber;
-	
-protected:
-	QString pageName;
-};
-
 class SCRIBUS_API SeList : public QListWidget
 {
 	friend class PagePalette;
@@ -74,11 +66,11 @@
 	void delMasterRequest(QString);
 
 protected:
-	void mouseReleaseEvent(QMouseEvent *m) override;
-	void mousePressEvent(QMouseEvent* e) override;
-	void mouseMoveEvent(QMouseEvent* e) override;
-	void keyPressEvent(QKeyEvent* e) override;
-	
+	void mouseReleaseEvent(QMouseEvent *m);
+	void mousePressEvent(QMouseEvent* e);
+	void mouseMoveEvent(QMouseEvent* e);
+	virtual void keyPressEvent(QKeyEvent* e);
+
 	QListWidgetItem *m_currItem {nullptr};
 	QPoint m_mousePos;
 	bool m_mousePressed {false};
@@ -86,49 +78,207 @@
 
 };
 
-class SCRIBUS_API SeView : public QTableWidget
+/* ********************************************************************************* *
+ *
+ * Page Cell
+ *
+ * ********************************************************************************* */
+
+class SCRIBUS_API PageCell
 {
+	friend class PanelPages;
+	friend class PageGrid;
+
+public:
+	PageCell(const QString& text, uint pgnr, const QPixmap& pix, double pageRatio, const QColor color = Qt::black);
+	// ~PageCell() {};
+
+	const QString& pageName() {return m_pageName;}
+	QPixmap pagePreview() {return m_pagePreview;}
+	uint pageNumber() {return m_pageNumber;}
+	QColor masterPageColor() {return m_masterPageColor;}
+	int pageWidthByHeight(int height) {return qCeil(height * m_pageRatio);}
+	double pageRatio() {return m_pageRatio;}
+
+	void setPageName(const QString& name ) {m_pageName = name;}
+	void setPagePreview(QPixmap preview ) {m_pagePreview = preview;}
+	void setPageNumber(uint number ) {m_pageNumber = number;}
+	void setMasterPageColor(QColor color ) {m_masterPageColor = color;}
+	void setPageRatio(double pageRatio){m_pageRatio = pageRatio;}
+
+private:
+	uint m_pageNumber;
+	QPixmap m_pagePreview;
+	QString m_pageName;
+	QColor m_masterPageColor;
+	double m_pageRatio;
+};
+
+/* ********************************************************************************* *
+ *
+ * Page Grid
+ *
+ * ********************************************************************************* */
+
+class SCRIBUS_API PageGrid : public QWidget
+{
 	Q_OBJECT
-	
-	friend class PagePalette;
-	friend class PagePalette_Pages;
 
+	friend class PageViewer;
+
 public:
-	SeView(QWidget* parent);
-	~SeView() {};
+	explicit PageGrid(QWidget *parent = nullptr);
 
-	void clearPix();
-	int  getPage(int r, int c, bool *last);
-	SeItem* getPageItem(int pageIndex);
+	void setPageInGroup(int amount);
 
+	void setDocumentPageSize(QSizeF pageSize);
+
+	void setRowHeight(int size);
+	int rowHeight();
+
+	void setFontSize(int size);
+	int fontSize();
+
+	void setSelectionColor(QColor color);
+	QColor selectionColor();
+
+	void setPageLayout(PageLayout layout);
+	PageLayout pageLayout();
+
+	void setPageOffset(int pageCount);
+	int pageOffset();
+
+	QList<PageCell*> pageList;
+
+	int pageId(int r, int c, bool clampId = true);
+	int pageId(QPoint pos, bool clampId = true);
+
+	PageCell* getPageItem(int pageIndex);
+
+	int pageCount();
+	int pageHeight();
+
+	void setSelectedPage(int pageID);
+	int selectedPage();
+
+	void deleteSelectedPage();
+	void clear();
+	void calculateSize();
+
+private:
+
+	enum State {
+		None = 0,
+		StartDrag = 1,
+		StartSelection = 2
+	};
+
+	enum Mode {
+		Invalid = 0,
+		Insert = 1,
+		Add = 2,
+		Hover = 3
+	};
+
+	QSize m_pageSize;
+	QSizeF m_documentPageSize;
+	int m_rowHeight;
+	int m_cellGap;
+	int m_groupSpace;
+	int m_rowSpace;
+	int m_fontSize;
+	int m_labelGap;
+	QRect m_rectInsert;
+	QRect m_rectSelection;
+	QRect m_rectAdd;
+	QColor m_colorSelection;
+	int m_selectedPage;
+	int m_hoveredPage;
+	bool m_enableSelection;
+	QPoint m_mousePos;
+	State m_state {State::None};
+	PageLayout m_pageLayout;
+	int m_cellsInGroup;
+	int m_pageOffset;
+	QMenu *m_contextMenu;
+
+	int columns();
+	int rows();
+
+	int columnAt(QPoint pos);
+	int rowAt(QPoint pos);
+	int rowWidth(int rowId);
+	QRect rectAt(int row, int col);
+
+	QSize dummyPageSize();
+
+	QPoint mapPosToCell(QPoint pos, Mode &mode);
+	QPoint pagePosition(int pageId);
+
+	int clampPageId(int pageID, bool allowPlusOne = false);
+
+	void updateSelectedPage(QPoint pos);
+	void updateModeMarker(QPoint pos);
+	void clearUi();
+	void drawTile(QPainter &painter, QPoint cellPosition, PageCell * tile, bool selected, bool hovered);
+	void initContextMenu();
+
+private slots:
+	void showContextMenu(QPoint pos);
+
+protected:
+
+	void paintEvent(QPaintEvent *event);
+	void resizeEvent(QResizeEvent *event);
+
+	virtual void dropEvent(QDropEvent * event);
+	virtual void dragEnterEvent(QDragEnterEvent *event);
+	virtual void dragLeaveEvent(QDragLeaveEvent *event);
+	virtual void dragMoveEvent(QDragMoveEvent *event);
+	virtual void mouseReleaseEvent(QMouseEvent *event);
+	virtual void mousePressEvent(QMouseEvent* event);
+	virtual void mouseMoveEvent(QMouseEvent* event);
+
 signals:
-	void UseTemp(QString, int);
-	void NewPage(int, QString);
+	void useTemplate(QString, int);
+	void newPage(int, QString);
 	void movePage(int, int);
-	void Click(int, int, int);
+	void click(int, int);
 	void delPageRequest(int);
+	void previewSizeChanged();
+};
 
+/* ********************************************************************************* *
+ *
+ * Page Viewer
+ *
+ * ********************************************************************************* */
+
+class SCRIBUS_API PageViewer : public QWidget
+{
+
+public:
+	PageViewer(QWidget *parent = nullptr);
+	~PageViewer() {};
+
+	PageGrid *pageGrid();
+	void scrollToPage(int pageId);
+
+
 protected:
-	void dropEvent(QDropEvent * e) override;
-	void dragEnterEvent(QDragEnterEvent *e) override;
-	void dragLeaveEvent(QDragLeaveEvent *e) override;
-	void dragMoveEvent(QDragMoveEvent *e) override;
-	void mouseReleaseEvent(QMouseEvent *e) override;
-	void mousePressEvent(QMouseEvent* e) override;
-	void mouseMoveEvent(QMouseEvent* e) override;
-	void keyPressEvent(QKeyEvent* e) override;
-	
-	QPoint m_mousePos;
-	bool m_mousePressed {false};
-	int m_coladd {0};
-	int m_colmult {1};
-	int m_cols {1};
-	int m_firstPage {0};
-	int m_pageCount {0};
-	int m_rowadd {1};
-	int m_rowmult {2};
+	PageGrid *m_pageGrid;
+	QScrollArea* m_scroll;
+
+	virtual void keyPressEvent(QKeyEvent* event);
+
 };
 
+/* ********************************************************************************* *
+ *
+ * Trash bin
+ *
+ * ********************************************************************************* */
+
 class SCRIBUS_API TrashBin : public QLabel
 {
 	Q_OBJECT
@@ -137,17 +287,17 @@
 	TrashBin( QWidget * parent );
 	~TrashBin() {};
 
+	void dragEnterEvent( QDragEnterEvent *e );
+	void dragLeaveEvent( QDragLeaveEvent * );
+	void dropEvent( QDropEvent * e );
+
 protected:
-	QPixmap Normal;
-	QPixmap Offen;
+	QPixmap normal;
+	QPixmap open;
 
-	void dragEnterEvent(QDragEnterEvent* e) override;
-	void dragLeaveEvent(QDragLeaveEvent*) override;
-	void dropEvent(QDropEvent* e) override;
-
 protected slots:
 	void iconSetChange();
-	
+
 signals:
 	void delPageRequest(int);
 	void delMasterRequest(QString);
Index: scribus/ui/propertiespalette.cpp
===================================================================
--- scribus/ui/propertiespalette.cpp	(Revision 25541)
+++ scribus/ui/propertiespalette.cpp	(Arbeitskopie)
@@ -618,6 +618,7 @@
 		upRect.translate(m_item->xPos(), m_item->yPos());
 		m_doc->regionsChanged()->update(upRect.adjusted(-10.0, -10.0, 10.0, 10.0));
 		m_doc->changed();
+		m_doc->changedPagePreview();
 	}
 }
 
@@ -694,6 +695,7 @@
 		upRect.translate(m_item->xPos(), m_item->yPos());
 		m_doc->regionsChanged()->update(upRect.adjusted(-10.0, -10.0, 10.0, 10.0));
 		m_doc->changed();
+		m_doc->changedPagePreview();
 	}
 }
 
Index: scribus/ui/propertiespalette_image.cpp
===================================================================
--- scribus/ui/propertiespalette_image.cpp	(Revision 25541)
+++ scribus/ui/propertiespalette_image.cpp	(Arbeitskopie)
@@ -621,6 +621,7 @@
 	{
 		m_item->setImageScalingMode(freeScale->isChecked(), cbProportional->isChecked());
 		m_doc->changed();
+		m_doc->changedPagePreview();
 		emit UpdtGui(PageItem::ImageFrame);
 	}
 }
@@ -730,6 +731,7 @@
 		return;
 	m_ScMW->view->editExtendedImageProperties();
 	m_doc->changed();
+	m_doc->changedPagePreview();
 }
 
 void PropertiesPalette_Image::handleImagePageNumber()
Index: scribus/ui/propertiespalette_shape.cpp
===================================================================
--- scribus/ui/propertiespalette_shape.cpp	(Revision 25541)
+++ scribus/ui/propertiespalette_shape.cpp	(Arbeitskopie)
@@ -395,6 +395,7 @@
 			mode = PageItem::TextFlowUsesImageClipping;
 		m_item->setTextFlowMode(mode);
 		m_doc->changed();
+		m_doc->changedPagePreview();
 		m_doc->invalidateAll();
 		m_doc->regionsChanged()->update(QRect());
 	}
@@ -429,6 +430,7 @@
 			connect(m_ScMW->nodePalette, SIGNAL(paletteClosed()), this, SLOT(handleShapeEditEnded()));
 		}
 		m_doc->changed();
+		m_doc->changedPagePreview();
 	}
 }
 
@@ -453,6 +455,7 @@
 	m_item->setCornerRadius(roundRect->value() / m_unitRatio);
 	m_doc->setFrameRounded();
 	m_doc->changed();
+	m_doc->changedPagePreview();
 	//called from setFrameRounded already!
 	m_doc->regionsChanged()->update(QRect());
 	m_item->update();
Index: scribus/ui/propertiespalette_xyz.cpp
===================================================================
--- scribus/ui/propertiespalette_xyz.cpp	(Revision 25541)
+++ scribus/ui/propertiespalette_xyz.cpp	(Arbeitskopie)
@@ -811,6 +811,7 @@
 	}
 	m_doc->regionsChanged()->update(QRect());
 	m_doc->changed();
+	m_doc->changedPagePreview();
 }
 
 void PropertiesPalette_XYZ::handleNewY()
@@ -909,6 +910,7 @@
 	}
 	m_doc->regionsChanged()->update(QRect());
 	m_doc->changed();
+	m_doc->changedPagePreview();
 }
 
 void PropertiesPalette_XYZ::handleNewW()
@@ -991,6 +993,7 @@
 	m_doc->changed();
 	m_doc->regionsChanged()->update(QRect());
 	m_ScMW->setStatusBarTextSelectedItemInfo();
+	m_doc->changedPagePreview();
 }
 
 void PropertiesPalette_XYZ::handleNewH()
@@ -1073,6 +1076,7 @@
 	m_doc->changed();
 	m_doc->regionsChanged()->update(QRect());
 	m_ScMW->setStatusBarTextSelectedItemInfo();
+	m_doc->changedPagePreview();
 }
 
 void PropertiesPalette_XYZ::handleRotation()
@@ -1099,6 +1103,7 @@
 	}
 	m_doc->changed();
 	m_doc->regionsChanged()->update(QRect());
+	m_doc->changedPagePreview();
 	m_oldRotation = rotationSpin->value();
 	basePointWidget->setAngle(m_oldRotation);
 }
@@ -1130,6 +1135,7 @@
 	}
 	m_doc->changed();
 	m_doc->regionsChanged()->update(QRect());
+	m_doc->changedPagePreview();
 	m_oldRotation = rotationSpin->value();
 	basePointWidget->setAngle(m_oldRotation);
 }
@@ -1161,6 +1167,7 @@
 	}
 	m_doc->changed();
 	m_doc->regionsChanged()->update(QRect());
+	m_doc->changedPagePreview();
 	m_oldRotation = rotationSpin->value();
 	basePointWidget->setAngle(m_oldRotation);
 }
Index: scribus/ui/smcellstyle.cpp
===================================================================
--- scribus/ui/smcellstyle.cpp	(Revision 25541)
+++ scribus/ui/smcellstyle.cpp	(Arbeitskopie)
@@ -210,6 +210,7 @@
 	//m_doc->scMW()->requestUpdate(reqTextStylesUpdate);
 
 	m_doc->changed();
+	m_doc->changedPagePreview();
 }
 
 void SMCellStyle::editMode(bool isOn)
Index: scribus/ui/smlinestyle.cpp
===================================================================
--- scribus/ui/smlinestyle.cpp	(Revision 25541)
+++ scribus/ui/smlinestyle.cpp	(Arbeitskopie)
@@ -286,6 +286,7 @@
 		}
 	}
 	m_doc->changed();
+	m_doc->changedPagePreview();
 	m_doc->scMW()->requestUpdate(reqLineStylesUpdate);
 	// Better not call DrawNew() here, as this will cause several unnecessary calls
 	// m_doc->view()->DrawNew();
Index: scribus/ui/smtablestyle.cpp
===================================================================
--- scribus/ui/smtablestyle.cpp	(Revision 25541)
+++ scribus/ui/smtablestyle.cpp	(Arbeitskopie)
@@ -210,6 +210,7 @@
 	//m_doc->scMW()->requestUpdate(reqTextStylesUpdate);
 
 	m_doc->changed();
+	m_doc->changedPagePreview();
 }
 
 void SMTableStyle::editMode(bool isOn)
Index: scribus/ui/smtextstyles.cpp
===================================================================
--- scribus/ui/smtextstyles.cpp	(Revision 25541)
+++ scribus/ui/smtextstyles.cpp	(Arbeitskopie)
@@ -285,6 +285,7 @@
 	// Better not call DrawNew() here, as this will cause several unnecessary calls
 	// m_doc->view()->DrawNew();
 	m_doc->changed();
+	m_doc->changedPagePreview();
 }
 
 void SMParagraphStyle::editMode(bool isOn)
@@ -2076,6 +2077,7 @@
 
 	m_doc->scMW()->requestUpdate(reqTextStylesUpdate);
 	m_doc->changed();
+	m_doc->changedPagePreview();
 }
 
 void SMCharacterStyle::editMode(bool isOn)
Index: scribus/util.cpp
===================================================================
--- scribus/util.cpp	(Revision 25541)
+++ scribus/util.cpp	(Arbeitskopie)
@@ -1348,3 +1348,8 @@
 	}
 	return QChar::Null;
 }
+
+bool inRange(unsigned min, unsigned value, unsigned max)
+{
+	return (min <= value && value <= max);
+}
Index: scribus/util.h
===================================================================
--- scribus/util.h	(Revision 25541)
+++ scribus/util.h	(Arbeitskopie)
@@ -204,4 +204,12 @@
 */
 void SCRIBUS_API getUniqueName(QString &name, const QStringList& list, const QString& separator = QString(), bool prepend = false);
 
+/*!
+ * \brief inRange check if value is in range of min and max
+ * \param min
+ * \param value
+ * \param max
+ */
+bool SCRIBUS_API inRange(unsigned min, unsigned value, unsigned max);
+
 #endif
arrange_pages_2023-07-04_01.patch (119,688 bytes)   

Issue History

Date Modified Username Field Change
2021-08-21 13:05 cyberlizard New Issue
2021-08-21 13:27 jghali Project Contributor Builds => Scribus
2021-08-22 14:46 jghali Product Version => 1.5.7
2023-05-27 16:20 cbradney Target Version => 1.7.0
2023-05-29 16:03 nitramr Assigned To => nitramr
2023-05-29 16:03 nitramr Status new => assigned
2023-05-29 16:04 nitramr Relationship added duplicate of 0014847
2023-07-04 19:39 nitramr Note Added: 0050259
2023-07-04 19:39 nitramr File Added: arrange_pages_2023-07-04_01.patch
2023-07-04 19:39 nitramr File Added: Bildschirmfoto vom 2023-07-02 19-55-48.png
2023-07-04 19:45 nitramr Relationship replaced has duplicate 0014847
2023-08-09 20:12 cbradney Status assigned => resolved
2023-08-09 20:12 cbradney Resolution open => fixed
2023-08-09 20:12 cbradney Fixed in Version => 1.7.0.svn
2023-09-11 20:34 cbradney Status resolved => closed