r19995 by craig - Just some cleanup

scribus-commit scribus-commit at lists.scribus.net
Sat Apr 11 19:55:14 UTC 2015


Author: craig
Date: Sat Apr 11 19:55:14 2015
New Revision: 19995

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=19995
Log:
Just some cleanup

Modified:
    trunk/Scribus/scribus/canvas.cpp
    trunk/Scribus/scribus/canvas.h
    trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp
    trunk/Scribus/scribus/scribusview.cpp

Modified: trunk/Scribus/scribus/canvas.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19995&path=/trunk/Scribus/scribus/canvas.cpp
==============================================================================
--- trunk/Scribus/scribus/canvas.cpp (original)
+++ trunk/Scribus/scribus/canvas.cpp Sat Apr 11 19:55:14 2015
@@ -628,10 +628,19 @@
 
 void Canvas::clearBuffers()
 {
-	m_buffer = /*QImage()*/QPixmap();
+	m_buffer = QPixmap();
 	m_bufferRect = QRect();
 	m_selectionBuffer = QPixmap();
 	m_selectionRect = QRect();
+}
+
+void Canvas::setScale(double scale)
+{
+	if (m_viewMode.scale == scale)
+		return;
+	m_viewMode.scale = scale;
+	clearBuffers();
+	update();
 }
 
 

Modified: trunk/Scribus/scribus/canvas.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19995&path=/trunk/Scribus/scribus/canvas.h
==============================================================================
--- trunk/Scribus/scribus/canvas.h (original)
+++ trunk/Scribus/scribus/canvas.h Sat Apr 11 19:55:14 2015
@@ -149,7 +149,7 @@
 	void setRenderModeUseBuffer(bool use) { m_renderMode = (use ? RENDER_BUFFERED : RENDER_NORMAL) ; }
 
 	double scale() const { return m_viewMode.scale; }
-	void setScale(double scale) { if (m_viewMode.scale != scale) { m_viewMode.scale = scale; clearBuffers(); update(); } }
+	void setScale(double scale);
 	QPoint canvasToLocal(FPoint p) const;
 	QPoint canvasToGlobal(FPoint p) const;
 	QPoint canvasToLocal(QPointF p) const;
@@ -265,7 +265,7 @@
 	CanvasViewMode m_viewMode;
 	
 	RenderMode m_renderMode;
-	/*QImage*/QPixmap m_buffer;
+	QPixmap m_buffer;
 	QRect   m_bufferRect;
 	QPixmap m_selectionBuffer;
 	QRect   m_selectionRect;

Modified: trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19995&path=/trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp
==============================================================================
--- trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp (original)
+++ trunk/Scribus/scribus/plugins/picbrowser/picturebrowser.cpp Sat Apr 11 19:55:14 2015
@@ -27,8 +27,8 @@
 
 PictureBrowser::PictureBrowser ( ScribusDoc* doc, QWidget *parent ) :
 	QDialog ( parent ),
-	pImages(0),
-	pModel(0)
+	pModel(0),
+	pImages(0)
 {
 	setupUi ( this );
 

Modified: trunk/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=19995&path=/trunk/Scribus/scribus/scribusview.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusview.cpp (original)
+++ trunk/Scribus/scribus/scribusview.cpp Sat Apr 11 19:55:14 2015
@@ -2315,7 +2315,6 @@
 	int w = qRound(qMin(visibleWidth() / m_canvas->scale(), Doc->currentPage()->width()));
 	int h = qRound(qMin(visibleHeight() / m_canvas->scale(), Doc->currentPage()->height()));
 	rememberOldZoomLocation(w / 2 + x,h / 2 + y);
-	//zoom(oldX, oldY, zoomSpinBox->value() / 100.0 * Prefs->displayPrefs.displayScale, false);
 	zoom(oldX, oldY, m_ScMW->zoomSpinBox->value() / 100.0 * Prefs->displayPrefs.displayScale, false);
 	setFocus();
 }
@@ -4316,9 +4315,8 @@
 
 void ScribusView::zoom(int canvasX, int canvasY, double scale, bool preservePoint)
 {
-	QPoint canvasPoint;
 	QPoint globalPoint = m_canvas->canvasToGlobal(QPointF(canvasX, canvasY));
-	double newScale    = (scale > (Prefs->opToolPrefs.magMax / 100) * Prefs->displayPrefs.displayScale) ? ((Prefs->opToolPrefs.magMax / 100) * Prefs->displayPrefs.displayScale) : scale;
+	double newScale = (scale > (Prefs->opToolPrefs.magMax / 100) * Prefs->displayPrefs.displayScale) ? ((Prefs->opToolPrefs.magMax / 100) * Prefs->displayPrefs.displayScale) : scale;
 	undoManager->setUndoEnabled(false);
 	updatesOn(false);
 	setScale(newScale);
@@ -4326,13 +4324,11 @@
 	int nw = qMax(qRound((Doc->maxCanvasCoordinate.x() - Doc->minCanvasCoordinate.x()) * m_canvas->scale()), visibleWidth());
 	int nh = qMax(qRound((Doc->maxCanvasCoordinate.y() - Doc->minCanvasCoordinate.y()) * m_canvas->scale()), visibleHeight());
 	resizeContents(nw, nh); // FIXME : should be avoided here, cause an unnecessary paintEvent despite updates disabled
+	QPoint canvasPoint;
 	if (preservePoint)
 		canvasPoint = viewport()->mapFromGlobal(globalPoint);
 	else
-	{
-		QSize viewsize = viewport()->size();
-		canvasPoint = QPoint(viewsize.width() / 2, viewsize.height() / 2);
-	}
+		canvasPoint = QPoint(viewport()->width() / 2, viewport()->height() / 2);
 	setContentsPos(localPoint.x() - canvasPoint.x(), localPoint.y() - canvasPoint.y());
 	updatesOn(true);
 	undoManager->setUndoEnabled(true);




More information about the scribus-commit mailing list