r23948 by jghali - #16189: Page Up and Down with the keyboard: the red border around page is not correctly updated
scribus-commit
scribus-commit at lists.scribus.net
Tue Jul 28 01:31:37 UTC 2020
Author: jghali
Date: Tue Jul 28 01:31:37 2020
New Revision: 23948
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23948
Log:
#16189: Page Up and Down with the keyboard: the red border around page is not correctly updated
Modified:
trunk/Scribus/scribus/scpage.cpp
trunk/Scribus/scribus/scpage.h
trunk/Scribus/scribus/scribusview.cpp
trunk/Scribus/scribus/scribusview.h
Modified: trunk/Scribus/scribus/scpage.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23948&path=/trunk/Scribus/scribus/scpage.cpp
==============================================================================
--- trunk/Scribus/scribus/scpage.cpp (original)
+++ trunk/Scribus/scribus/scpage.cpp Tue Jul 28 01:31:37 2020
@@ -64,6 +64,26 @@
// }
// }
FromMaster.clear();
+}
+
+QRectF ScPage::bleedRect() const
+{
+ QRectF pageRect(m_xOffset, m_yOffset, m_width, m_height);
+ if (m_Doc)
+ {
+ MarginStruct pageBleeds;
+ m_Doc->getBleeds(this, pageBleeds);
+ double totalWidth = m_width + pageBleeds.left() + pageBleeds.right();
+ double totalHeight = m_height + pageBleeds.bottom() + pageBleeds.top();
+ pageRect = QRectF(m_xOffset - pageBleeds.left(), m_yOffset - pageBleeds.top(), totalWidth, totalHeight);
+ }
+ return pageRect;
+}
+
+QRectF ScPage::trimRect() const
+{
+ QRectF pageRect(m_xOffset, m_yOffset, m_width, m_height);
+ return pageRect;
}
void ScPage::setDocument(ScribusDoc *doc)
Modified: trunk/Scribus/scribus/scpage.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23948&path=/trunk/Scribus/scribus/scpage.h
==============================================================================
--- trunk/Scribus/scribus/scpage.h (original)
+++ trunk/Scribus/scribus/scpage.h Tue Jul 28 01:31:37 2020
@@ -28,6 +28,7 @@
#include <QList>
#include <QPair>
+#include <QRectF>
#include <QString>
#include "scribusapi.h"
@@ -49,6 +50,7 @@
public:
ScPage(const double x, const double y, const double b, const double h);
~ScPage();
+
double xOffset() const { return m_xOffset; }
double yOffset() const { return m_yOffset; }
double width() const { return m_width; }
@@ -74,6 +76,7 @@
MarginStruct initialMargins;
int LeftPg {0};
int marginPreset {0};
+
ScribusDoc* doc() const { return m_Doc; }
void setDocument(ScribusDoc* doc);
int pageNr() const { return m_pageNr; }
@@ -93,6 +96,9 @@
const QString& size() const {return m_pageSize;}
void setSize(const QString& newSize);
void restore(UndoState* state, bool isUndo);
+
+ QRectF bleedRect() const;
+ QRectF trimRect() const;
/*! \brief As a bit of a dirty hack, we declare this mutable so it can be altered
even while the object is `const'. That's normally only for internal
Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23948&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Tue Jul 28 01:31:37 2020
@@ -2432,20 +2432,26 @@
}
-void ScribusView::GotoPa(int Seite)
+void ScribusView::GotoPa(int pageNumber)
{
deselectItems();
- GotoPage(Seite-1);
+ GotoPage(pageNumber - 1);
setFocus();
}
-void ScribusView::GotoPage(int Seite)
-{
- m_doc->setCurrentPage(m_doc->Pages->at(Seite));
+void ScribusView::GotoPage(int pageIndex)
+{
+ QRectF newTrimRect = m_doc->Pages->at(pageIndex)->trimRect();
+ QRectF oldTrimRect = m_doc->currentPage() ? m_doc->currentPage()->trimRect() : newTrimRect;
+ m_doc->setCurrentPage(m_doc->Pages->at(pageIndex));
if (m_ScMW->scriptIsRunning())
return;
- m_ScMW->slotSetCurrentPage(Seite);
+ QRect updateRect = m_canvas->canvasToLocal(oldTrimRect.united(newTrimRect));
+ m_ScMW->slotSetCurrentPage(pageIndex);
+ m_canvas->setForcedRedraw(true);
+ m_canvas->resetRenderMode();
setCanvasPos(m_doc->currentPage()->xOffset() - 10, m_doc->currentPage()->yOffset() - 10);
+ updateContents(updateRect.adjusted(-5, -5, 10, 10));
m_ScMW->HaveNewSel();
}
@@ -3538,7 +3544,7 @@
void ScribusView::updateContents(int x, int y, int w, int h)
{
- updateContents(QRect(x,y,w,h));
+ updateContents(QRect(x, y, w, h));
}
void ScribusView::repaintContents(QRect box)
Modified: trunk/Scribus/scribus/scribusview.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23948&path=/trunk/Scribus/scribus/scribusview.h
==============================================================================
--- trunk/Scribus/scribus/scribusview.h (original)
+++ trunk/Scribus/scribus/scribusview.h Tue Jul 28 01:31:37 2020
@@ -260,9 +260,9 @@
void slotZoomOut(int mx = 0, int my = 0, bool preservePoint = false);
/** Redraws everything */
void DrawNew();
- void GotoPa(int Seite);
+ void GotoPa(int pageNumber);
void GotoLa(int l);
- void GotoPage(int Seite);
+ void GotoPage(int pageIndex);
void ChgUnit(int art);
void editExtendedImageProperties();
More information about the scribus-commit
mailing list