r16995 by avox - finish refactoring scale() and fix rect selection

scribus-commit scribus-commit at lists.scribus.net
Sun Nov 20 15:52:09 UTC 2011


Author: avox
Date: Sun Nov 20 15:52:08 2011
New Revision: 16995

URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16995
Log:
finish refactoring scale() and fix rect selection

Modified:
    branches/Version135scrollfix/Scribus/scribus/canvas.cpp
    branches/Version135scrollfix/Scribus/scribus/canvas.h
    branches/Version135scrollfix/Scribus/scribus/canvasgesture_rulermove.cpp
    branches/Version135scrollfix/Scribus/scribus/canvasmode_copyproperties.cpp
    branches/Version135scrollfix/Scribus/scribus/canvasmode_edit.cpp
    branches/Version135scrollfix/Scribus/scribus/canvasmode_framelinks.cpp
    branches/Version135scrollfix/Scribus/scribus/canvasmode_magnifier.cpp
    branches/Version135scrollfix/Scribus/scribus/canvasmode_normal.cpp
    branches/Version135scrollfix/Scribus/scribus/canvasmode_rotate.cpp
    branches/Version135scrollfix/Scribus/scribus/hruler.cpp
    branches/Version135scrollfix/Scribus/scribus/pageitem.cpp
    branches/Version135scrollfix/Scribus/scribus/pageitem.h
    branches/Version135scrollfix/Scribus/scribus/pageitem_imageframe.cpp
    branches/Version135scrollfix/Scribus/scribus/pageitem_imageframe.h
    branches/Version135scrollfix/Scribus/scribus/pageitem_latexframe.cpp
    branches/Version135scrollfix/Scribus/scribus/pageitem_latexframe.h
    branches/Version135scrollfix/Scribus/scribus/pageitem_line.cpp
    branches/Version135scrollfix/Scribus/scribus/pageitem_line.h
    branches/Version135scrollfix/Scribus/scribus/pageitem_pathtext.cpp
    branches/Version135scrollfix/Scribus/scribus/pageitem_pathtext.h
    branches/Version135scrollfix/Scribus/scribus/pageitem_polygon.cpp
    branches/Version135scrollfix/Scribus/scribus/pageitem_polygon.h
    branches/Version135scrollfix/Scribus/scribus/pageitem_polyline.cpp
    branches/Version135scrollfix/Scribus/scribus/pageitem_polyline.h
    branches/Version135scrollfix/Scribus/scribus/pageitem_textframe.cpp
    branches/Version135scrollfix/Scribus/scribus/pageitem_textframe.h
    branches/Version135scrollfix/Scribus/scribus/pagepalette.cpp
    branches/Version135scrollfix/Scribus/scribus/sampleitem.cpp
    branches/Version135scrollfix/Scribus/scribus/scribus.cpp
    branches/Version135scrollfix/Scribus/scribus/scribusdoc.cpp
    branches/Version135scrollfix/Scribus/scribus/scribusview.cpp
    branches/Version135scrollfix/Scribus/scribus/scribusview.h
    branches/Version135scrollfix/Scribus/scribus/util.cpp
    branches/Version135scrollfix/Scribus/scribus/vruler.cpp

Modified: branches/Version135scrollfix/Scribus/scribus/canvas.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/canvas.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvas.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvas.cpp Sun Nov 20 15:52:08 2011
@@ -317,8 +317,8 @@
 {
 	int ex ( -(x() / m_viewMode.m_scale) + m_doc->minCanvasCoordinate.x() );
 	int ey ( -(y() / m_viewMode.m_scale) + m_doc->minCanvasCoordinate.y() );
-	int ew ( (m_view->visibleWidth() * 1.2) / m_viewMode.m_scale );
-	int eh ( (m_view->visibleHeight() * 1.2) / m_viewMode.m_scale );
+	int ew ( (m_view->viewport()->size().width() * 1.2) / m_viewMode.m_scale );
+	int eh ( (m_view->viewport()->size().height() * 1.2) / m_viewMode.m_scale );
 	
 	return QRect( ex, ey, ew, eh );
 }
@@ -2361,7 +2361,7 @@
 
 void Canvas::displayRectangleSelection(QPoint start, QPoint end)
 {
-	m_rectangleSelection->setGeometry(QRect(start, end).normalized());
+	m_rectangleSelection->setGeometry(QRect(m_view->mapFromGlobal(start), m_view->mapFromGlobal(end)).normalized());
 	if (!m_rectangleSelection->isVisible())
 		m_rectangleSelection->show();
 	m_haveRectangleSelection = true;
@@ -2383,7 +2383,8 @@
 
 QRect Canvas::getRectangleSelection() const
 {
-	return m_rectangleSelection->geometry().normalized();
+	QPoint globalPos = m_view->mapToGlobal(m_rectangleSelection->pos());
+	return QRect(globalPos, m_rectangleSelection->size());
 }
 
 void Canvas::setupEditHRuler(PageItem * item, bool forceAndReset)

Modified: branches/Version135scrollfix/Scribus/scribus/canvas.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/canvas.h
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvas.h (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvas.h Sun Nov 20 15:52:08 2011
@@ -203,8 +203,9 @@
 	qreal scaledGuideRadius() const;
 	QSizeF scaledQSizeF(QSizeF size) const;
 	void scaleAndTranslateQPainter(QPainter *p);
-	void mouseMoveScrollDeltas(qreal* dx, qreal *dx, QPointF& referencePoint, QMouseEvent* m);
+	void mouseMoveScrollDeltas(qreal* dx, qreal *dy, QPointF& referencePoint, QMouseEvent* m);
 	qreal zoomLevel() const;
+	qreal getScale() const { return m_viewMode.m_scale; } // try to avoid this!
 	
 private:
 	double scale() const { return m_viewMode.m_scale; }

Modified: branches/Version135scrollfix/Scribus/scribus/canvasgesture_rulermove.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/canvasgesture_rulermove.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasgesture_rulermove.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasgesture_rulermove.cpp Sun Nov 20 15:52:08 2011
@@ -160,9 +160,9 @@
 
 void RulerGesture::movePoint(QMouseEvent* m, bool mouseRelease)
 {
-	FPoint mousePointDoc = m_canvas->globalToCanvas(m->globalPos());
+	FPoint tmp = m_canvas->globalToCanvas(m->globalPos());
+	QPointF mousePointDoc = QPointF(tmp.x(), tmp.y());
 	const int page = m_doc->OnPage(mousePointDoc.x(), mousePointDoc.y());
-	QRect viewport(m_view->viewport()->mapToGlobal(QPoint(0,0)), QSize(m_view->visibleWidth(), m_view->visibleHeight()));
 	QPoint newMousePoint = m->globalPos() - (m_canvas->mapToParent(QPoint(0, 0)) + m_canvas->parentWidget()->mapToGlobal(QPoint(0, 0)));
 	switch (m_mode)
 	{
@@ -175,7 +175,7 @@
 				break;
 			m_canvas->update(0, m_xy.y()-2, m_canvas->width(), 4);
 			m_canvas->update(0, newMousePoint.y()-2, m_canvas->width(), 4);
-			if ((page >= 0) && (viewport.contains(m->globalPos())))
+			if ((page >= 0) && (m_view->visibleCanvas().contains(mousePointDoc)))
 			{
 				if (!m_haveGuide)
 				{
@@ -231,7 +231,7 @@
 				break;
 			m_canvas->update(m_xy.x()-2, 0, 4, m_canvas->height());
 			m_canvas->update(newMousePoint.x()-2, 0, 4, m_canvas->height());
-			if ((page >= 0) && viewport.contains(m->globalPos()))
+			if ((page >= 0) && m_view->visibleCanvas().contains(mousePointDoc))
 			{
 				if (!m_haveGuide)
 				{

Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_copyproperties.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_copyproperties.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_copyproperties.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_copyproperties.cpp Sun Nov 20 15:52:08 2011
@@ -277,7 +277,7 @@
 				m_view->DrawNew();
 			}
 		}
-		m_view->setRulerPos(m_view->contentsX(), m_view->contentsY());
+		m_view->updateRulers();
 	}
 	
 	currItem = NULL;

Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_edit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_edit.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_edit.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_edit.cpp Sun Nov 20 15:52:08 2011
@@ -818,7 +818,7 @@
 			currItem->OwnPage = m_doc->OnPage(currItem);
 			m_canvas->m_viewMode.operItemResizing = false;
 			if (currItem->asLine())
-				m_view->updateContents();
+				m_view->updateCanvas();
 		}
 		if (m_canvas->m_viewMode.operItemMoving)
 		{
@@ -907,7 +907,7 @@
 			//CB TODO And what if we have dragged to a new page. Items X&Y are not updated anyway now
 			//currItem->emitAllToGUI();
 			m_view->updatesOn(true);
-			m_view->updateContents();
+			m_view->updateCanvas();
 		}
 	}
 	//CB Drag selection performed here
@@ -930,7 +930,7 @@
 					break;
 				}
 			}
-			m_view->setRulerPos(m_view->contentsX(), m_view->contentsY());
+			m_view->updateRulers();
 		}
 		int docItemCount=m_doc->Items->count();
 		if (docItemCount != 0)
@@ -961,7 +961,7 @@
 			}
 		}
 		m_canvas->hideRectangleSelection();
-		m_view->updateContents();
+		m_view->updateCanvas();
 	}
 	if (GetItem(&currItem))
 	{
@@ -972,7 +972,8 @@
 			m_doc->m_Selection->getGroupRect(&x, &y, &w, &h);
 			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)));
+			double delta = 5 * m_canvas->scaledLineWidth();
+			m_view->updateCanvas(QRectF(x-delta, y-delta, w+2*delta, h+2*delta));
 		}
 		/*else
 			currItem->emitAllToGUI();*/
@@ -1070,7 +1071,7 @@
 				m_view->DrawNew();
 			}
 		}
-		m_view->setRulerPos(m_view->contentsX(), m_view->contentsY());
+		m_view->updateRulers();
 	}
 	
 	currItem = NULL;

Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_framelinks.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_framelinks.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_framelinks.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_framelinks.cpp Sun Nov 20 15:52:08 2011
@@ -257,7 +257,7 @@
 	}
 	if ((m_doc->appMode == modeLinkFrames) || (m_doc->appMode == modeUnlinkFrames))
 	{
-		m_view->updateContents();
+		m_view->updateCanvas();
 		if (!PrefsManager::instance()->appPrefs.stickyTools || m_doc->ElemToLink == 0)
 			m_view->requestMode(submodePaintingDone);
 		return;
@@ -316,7 +316,7 @@
 				break;
 			}
 		} */
-		m_view->setRulerPos(m_view->contentsX(), m_view->contentsY());
+		m_view->updateRulers();
 	}
 }
 
@@ -381,7 +381,7 @@
 				m_view->DrawNew();
 			}
 		}
-		m_view->setRulerPos(m_view->contentsX(), m_view->contentsY());
+		m_view->updateRulers();
 	}
 	
 	currItem = NULL;

Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_magnifier.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_magnifier.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_magnifier.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_magnifier.cpp Sun Nov 20 15:52:08 2011
@@ -125,8 +125,9 @@
 		return;
 	if ((m_canvas->m_viewMode.m_MouseButtonPressed) && (m->buttons() & Qt::LeftButton))
 	{
+		QRectF visible = m_view->visibleCanvas();
 		newX = qRound(mousePointDoc.x()); //m_view->translateToDoc(m->x(), m->y()).x());
-		newY = qRound(Myp + ((SeRx - Mxp) * m_view->visibleHeight()) / m_view->visibleWidth());
+		newY = qRound(Myp + ((SeRx - Mxp) * visible.height()) / visible.width());
 		SeRx = newX;
 		SeRy = newY;
 		/*
@@ -199,9 +200,9 @@
 	{
 		if (m_canvas->haveRectangleSelection())
 		{
-			QRect geom = m_canvas->getRectangleSelection();
-			FPoint nx = m_canvas->globalToCanvas(QPoint(geom.x() + geom.width() / 2, geom.y() + geom.height() / 2));
-			double scaleAdjust = m_view->visibleWidth() / static_cast<double>(qMax(geom.width(), 1));
+			QRectF geom =  m_canvas->globalToCanvas(m_canvas->getRectangleSelection());
+			FPoint nx = FPoint(geom.x() + geom.width() / 2, geom.y() + geom.height() / 2);
+			double scaleAdjust = m_view->visibleCanvas().width() / qMax(geom.width(), m_canvas->scaledLineWidth());
 			m_view->zoomRelative(nx.x(), nx.y(), scaleAdjust, false);
 			m_canvas->hideRectangleSelection();
 			if (qAbs(scaleAdjust - 1) < 0.001)

Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_normal.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_normal.cpp Sun Nov 20 15:52:08 2011
@@ -343,7 +343,7 @@
 				m_doc->DraggedElem = 0;
 				m_doc->DragElements.clear();
 				qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
-				m_view->updateContents();
+				m_view->updateCanvas();
 			}
 			return;
 		}
@@ -760,16 +760,17 @@
 	m_canvas->m_viewMode.m_MouseButtonPressed = false;
 	m_canvas->resetRenderMode();
 	m->accept();
-	m_canvas->hideRectangleSelection();
 //	m_view->stopDragTimer();
 	//m_canvas->update(); //ugly in a mouseReleaseEvent!!!!!!!
 	if ((!GetItem(&currItem)) && (m->button() == Qt::RightButton) && (!m_doc->DragP))
 	{
+		m_canvas->hideRectangleSelection();
 		createContextMenu(NULL, mousePointDoc.x(), mousePointDoc.y());
 		return;
 	}
 	if ((GetItem(&currItem)) && (m->button() == Qt::RightButton) && (!m_doc->DragP))
 	{
+		m_canvas->hideRectangleSelection();
 		createContextMenu(currItem, mousePointDoc.x(), mousePointDoc.y());
 		return;
 	}
@@ -783,7 +784,7 @@
 			currItem->OwnPage = m_doc->OnPage(currItem);
 			m_canvas->m_viewMode.operItemResizing = false;
 			if (currItem->asLine())
-				m_view->updateContents();
+				m_view->updateCanvas();
 		}
 		if (m_canvas->m_viewMode.operItemMoving)
 		{
@@ -893,17 +894,20 @@
 			//CB TODO And what if we have dragged to a new page. Items X&Y are not updated anyway now
 			//currItem->emitAllToGUI();
 			m_view->updatesOn(true);
-			m_view->updateContents();
+			m_view->updateCanvas();
 		}
 	}
 	//CB Drag selection performed here
 	if ((m_canvas->haveRectangleSelection()) && (!m_view->MidButt) &&
 		( (m_doc->m_Selection->count() == 0) || (shiftSelItems)))
 	{
-		double dx = m_mouseSavedPoint.x() - m_mousePressPoint.x();
-		double dy = m_mouseSavedPoint.y() - m_mousePressPoint.y();
-		QRectF canvasSele = QRectF(m_mousePressPoint.x(), m_mousePressPoint.y(), dx, dy).normalized();
-		QRectF localSele  = m_canvas->canvasToLocal(canvasSele).normalized();
+		QRect globalSelection = m_canvas->getRectangleSelection();
+		QRectF canvasSele = m_canvas->globalToCanvas(globalSelection);
+		m_canvas->hideRectangleSelection();
+		//double dx = m_mouseSavedPoint.x() - m_mousePressPoint.x();
+		//double dy = m_mouseSavedPoint.y() - m_mousePressPoint.y();
+		//QRectF canvasSele = QRectF(m_mousePressPoint.x(), m_mousePressPoint.y(), dx, dy).normalized();
+		//QRectF localSele  = m_canvas->canvasToLocal(canvasSele).normalized();
 		if (!m_doc->masterPageMode())
 		{
 			uint docPagesCount=m_doc->Pages->count();
@@ -922,7 +926,7 @@
 					break;
 				}
 			}
-			m_view->setRulerPos(m_view->contentsX(), m_view->contentsY());
+			m_view->updateRulers();
 		}
 		int docItemCount=m_doc->Items->count();
 		if (docItemCount != 0)
@@ -933,8 +937,8 @@
 				PageItem* docItem = m_doc->Items->at(a);
 				if ((m_doc->masterPageMode()) && (docItem->OnMasterPage != m_doc->currentPage()->pageName()))
 					continue;
-				QRect  apr2 = m_canvas->canvasToLocal( docItem->getCurrentBoundingRect(docItem->lineWidth()) );
-				if ((localSele.contains(apr2)) && (docItem->LayerNr == m_doc->activeLayer()) && (!m_doc->layerLocked(docItem->LayerNr)))
+				//QRect  apr2 = m_canvas->canvasToLocal( docItem->getCurrentBoundingRect(docItem->lineWidth()) );
+				if ((canvasSele.contains( docItem->getCurrentBoundingRect(docItem->lineWidth()) )) && (docItem->LayerNr == m_doc->activeLayer()) && (!m_doc->layerLocked(docItem->LayerNr)))
 				{
 					bool redrawSelection=false;
 					m_view->SelectItemNr(a, redrawSelection);
@@ -949,10 +953,10 @@
 				m_view->getGroupRectScreen(&x, &y, &w, &h);
 			}
 		}
-		m_canvas->hideRectangleSelection();
 		shiftSelItems = false;
-		m_view->updateContents();
-	}
+		m_view->updateCanvas();
+	}
+	m_canvas->hideRectangleSelection();
 	if (m_doc->appMode != modeEdit)
 	{
 		if (!PrefsManager::instance()->appPrefs.stickyTools)
@@ -973,7 +977,8 @@
 			m_doc->m_Selection->getGroupRect(&x, &y, &w, &h);
 			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)));
+			double delta = 5*m_canvas->scaledLineWidth();
+			m_view->updateCanvas(QRectF(x-delta, y-delta, w+2*delta, h+2*delta));
 			m_ScMW->propertiesPalette->setXY(x,y);
 			m_ScMW->propertiesPalette->setBH(w,h);
 		}
@@ -1119,7 +1124,7 @@
 				pageChanged = true;
 			}
 		}
-		m_view->setRulerPos(m_view->contentsX(), m_view->contentsY());
+		m_view->updateRulers();
 	}
 	
 	currItem = NULL;

Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_rotate.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_rotate.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_rotate.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_rotate.cpp Sun Nov 20 15:52:08 2011
@@ -337,7 +337,7 @@
 			m_doc->setRedrawBounding(currItem);
 			currItem->OwnPage = m_doc->OnPage(currItem);
 			if (currItem->asLine())
-				m_view->updateContents();
+				m_view->updateCanvas();
 		}
 	}
 	m_doc->RotMode  = m_oldRotMode;
@@ -356,7 +356,8 @@
 			m_doc->m_Selection->setGroupRect();
 			double x, y, w, h;
 			m_doc->m_Selection->getGroupRect(&x, &y, &w, &h);
-			m_view->updateContents(QRect(static_cast<int>(x-5), static_cast<int>(y-5), static_cast<int>(w+10), static_cast<int>(h+10)));
+			double delta = 5 * m_canvas->scaledLineWidth();
+			m_view->updateCanvas(QRectF(x-delta, y-delta, w+2*delta, h+2*delta));
 		}
 		// Handled normally automatically by Selection in sendSignals()
 		/*else

Modified: branches/Version135scrollfix/Scribus/scribus/hruler.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/hruler.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/hruler.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/hruler.cpp Sun Nov 20 15:52:08 2011
@@ -113,12 +113,12 @@
  
 int Hruler::textPosToLocal(double x) const
 {
-	return qRound(textPosToCanvas(x) * Scaling) - currView->contentsX();
+	return currView->m_canvas->canvasToLocal(FPoint(textPosToCanvas(x), 0)).x();
 }
  
 double Hruler::localToTextPos(int x) const
 {
-	return ((x + currView->contentsX()) / Scaling - textBase());
+	return currView->m_canvas->localToCanvas(QPoint(x,0)).x() - textBase();
 }
  
 void Hruler::shift(double pos)
@@ -496,8 +496,7 @@
 	if (currDoc->isLoading())
 		return;
 	QString tx = "";
-	double sc = currView->scale();
-	Scaling = sc;
+	Scaling = currView->m_canvas->getScale();
 	QFont ff = font();
 	ff.setPointSize(8);
 	setFont(ff);
@@ -652,9 +651,9 @@
 	}
 	// draw pixmap
 	p.save();
-	p.translate(-currView->contentsX(), 0);
+//	p.translate(-currView->contentsX(), 0);
 	p.scale(1.0/SCALE, 1.0/(SCALE+1));
-	p.drawPixmap((where-2)*SCALE, 1, pix);
+	p.drawPixmap((whereToDraw-2)*SCALE, 1, pix);
 	p.restore();
 	// restore marks
 	p.setBrush(Qt::black);
@@ -671,7 +670,7 @@
 #else
 	// draw slim marker
 	p.resetTransform();
-	p.translate(-currView->contentsX(), 0);
+//	p.translate(-currView->contentsX(), 0);
 	p.setPen(Qt::red);
 	p.setBrush(Qt::red);
 	cr.setPoints(5, whereToDraw, 5, whereToDraw, 16, whereToDraw, 5, whereToDraw+2, 0, whereToDraw-2, 0);
@@ -855,7 +854,7 @@
 void Hruler::Draw(int where)
 {
 	// erase old marker
-	int currentCoor = where - currView->contentsX();
+	int currentCoor = where;
 	whereToDraw = where;
 	drawMark = true;
 	repaint(oldMark-3, 0, 7, 17);
@@ -924,7 +923,7 @@
 
 void Hruler::unitChange()
 {
-	double sc = currView->scale();
+	double sc = currView->m_canvas->getScale();
 	cor=1;
 	int docUnitIndex=currDoc->unitIndex();
 	switch (docUnitIndex)

Modified: branches/Version135scrollfix/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/pageitem.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/pageitem.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/pageitem.cpp Sun Nov 20 15:52:08 2011
@@ -1033,7 +1033,6 @@
 void PageItem::DrawObj(ScPainter *p, QRectF cullingArea)
 {
 // 	qDebug << "PageItem::DrawObj";
-	double sc;
 	if (!m_Doc->DoDrawing)
 	{
 //		Tinput = false;
@@ -1045,24 +1044,24 @@
 							 QPointF(m_Doc->maxCanvasCoordinate.x(), m_Doc->maxCanvasCoordinate.y())).toAlignedRect();
 	}
 	
-	DrawObj_Pre(p, sc);
+	DrawObj_Pre(p);
 	if (m_Doc->layerOutline(LayerNr))
 	{
 		if ((itemType()==TextFrame || itemType()==ImageFrame || itemType()==PathText || itemType()==Line || itemType()==PolyLine) && (!isGroupControl))
-			DrawObj_Item(p, cullingArea, sc);
+			DrawObj_Item(p, cullingArea);
 	}
 	else
 	{
 		if (!isGroupControl)
-			DrawObj_Item(p, cullingArea, sc);
+			DrawObj_Item(p, cullingArea);
 	}
 	DrawObj_Post(p);
 }
 
-void PageItem::DrawObj_Pre(ScPainter *p, double &sc)
+void PageItem::DrawObj_Pre(ScPainter *p)//, double &sc)
 {
 	ScribusView* view = m_Doc->view();
-	sc = view->scale();
+//	sc = view->scale();
 	p->save();
 	if (!isEmbedded)
 		p->translate(Xpos, Ypos);
@@ -1272,7 +1271,7 @@
 	if ((!isEmbedded) && (!m_Doc->RePos))
 	{
 		double aestheticFactor(5.0);
-		double scpInv = 1.0 / (qMax(view->scale(), 1.0) * aestheticFactor);
+		double scpInv = (qMin(view->m_canvas->scaledLineWidth(), 1.0) / aestheticFactor); // ???
 		if (!isGroupControl)
 		{
 			if ((Frame) && (m_Doc->guidesSettings.framesShown) && ((itemType() == ImageFrame) || (itemType() == LatexFrame) || (itemType() == PathText)))
@@ -1320,7 +1319,7 @@
 		}
 		if ((m_Doc->guidesSettings.framesShown) && textFlowUsesContourLine() && (ContourLine.size() != 0))
 		{
-			p->setPen(Qt::darkGray, 1.0 / qMax(view->scale(), 1.0), Qt::DotLine, Qt::FlatCap, Qt::MiterJoin);
+			p->setPen(Qt::darkGray, qMin(view->m_canvas->scaledLineWidth(), 1.0), Qt::DotLine, Qt::FlatCap, Qt::MiterJoin);
 // Ugly Hack to fix rendering problems with cairo >=1.5.10 && <1.8.0 follows
 #ifdef HAVE_CAIRO
 	#if ((CAIRO_VERSION >= CAIRO_VERSION_ENCODE(1, 5, 10)) && (CAIRO_VERSION < CAIRO_VERSION_ENCODE(1, 8, 0)))
@@ -1335,7 +1334,7 @@
 		}
 		if ((m_Doc->guidesSettings.layerMarkersShown) && (m_Doc->layerCount() > 1) && (!m_Doc->layerOutline(LayerNr)) && ((isGroupControl) || (Groups.count() == 0)) && (!view->m_canvas->isPreviewMode()))
 		{
-			p->setPen(Qt::black, 0.5/ m_Doc->view()->scale(), Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+			p->setPen(Qt::black, 0.5 * m_Doc->view()->m_canvas->scaledLineWidth(), Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
 			p->setPenOpacity(1.0);
 			p->setBrush(m_Doc->layerMarker(LayerNr));
 			p->setBrushOpacity(1.0);
@@ -1414,9 +1413,8 @@
 		p->scale(style.scaleH() / 1000.0, style.scaleV() / 1000.0);
 		embedded->Dirty = Dirty;
 		embedded->invalid = true;
-		double sc;
 		double pws = embedded->m_lineWidth;
-		embedded->DrawObj_Pre(p, sc);
+		embedded->DrawObj_Pre(p);
 		switch(embedded->itemType())
 		{
 			case ImageFrame:
@@ -1424,12 +1422,12 @@
 			case LatexFrame:
 			case Polygon:
 			case PathText:
-				embedded->DrawObj_Item(p, cullingArea, sc);
+				embedded->DrawObj_Item(p, cullingArea);
 				break;
 			case Line:
 			case PolyLine:
 				embedded->m_lineWidth = pws * qMin(style.scaleH() / 1000.0, style.scaleV() / 1000.0);
-				embedded->DrawObj_Item(p, cullingArea, sc);
+				embedded->DrawObj_Item(p, cullingArea);
 				break;
 			default:
 				break;
@@ -1504,9 +1502,9 @@
 		FrameOnly = false;
 		return;
 	}
-	double sc = m_Doc->view()->scale();
-	double handleSize = 6.0 / sc;
-	double halfSize = 3.0 / sc;
+	double scInv = m_Doc->view()->m_canvas->scaledLineWidth();
+	double handleSize = 6.0 * scInv;
+	double halfSize = 3.0 * scInv;
 	if ((!FrameOnly) && (!m_Doc->RePos))
 	{
 		if (!m_Doc->m_Selection->isEmpty())
@@ -1516,24 +1514,24 @@
 			{
 				//Locked line colour selection
 				if (m_Locked)
-					p->setPen(QPen(PrefsManager::instance()->appPrefs.DFrameLockColor, 1.0 / sc, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
+					p->setPen(QPen(PrefsManager::instance()->appPrefs.DFrameLockColor, scInv, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
 				else
-					p->setPen(QPen(PrefsManager::instance()->appPrefs.DFrameColor, 1.0 / sc, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
+					p->setPen(QPen(PrefsManager::instance()->appPrefs.DFrameColor, scInv, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
 				p->setBrush(Qt::NoBrush);
-				double lw2 = 1.0 / sc;
-				double lw = 1.0 / sc;
+				double lw2 = scInv;
+				double lw = scInv;
 				Qt::PenCapStyle le = Qt::FlatCap;
 				if (NamedLStyle.isEmpty())
 				{
-					lw2 = (m_lineWidth / 2.0)  / sc;
-					lw = qMax(m_lineWidth, 1.0)  / sc;
+					lw2 = (m_lineWidth / 2.0) * scInv;
+					lw = qMax(m_lineWidth, 1.0)  * scInv;
 					le = PLineEnd;
 				}
 				else
 				{
 					multiLine ml = m_Doc->MLineStyles[NamedLStyle];
-					lw2 = (ml[ml.size()-1].Width / 2.0) / sc;
-					lw = qMax(ml[ml.size()-1].Width, 1.0) / sc;
+					lw2 = (ml[ml.size()-1].Width / 2.0) * scInv;
+					lw = qMax(ml[ml.size()-1].Width, 1.0) * scInv;
 					le = static_cast<Qt::PenCapStyle>(ml[ml.size()-1].LineEnd);
 				}
 				//Draw our frame outline
@@ -1542,7 +1540,7 @@
 					if (le != Qt::FlatCap)
 						p->drawRect(QRectF(-lw2, -lw2, Width+lw, lw));
 					else
-						p->drawRect(QRectF(-1 / sc, -lw2, Width, lw));
+						p->drawRect(QRectF(-scInv, -lw2, Width, lw));
 				}
 				else
 					p->drawRect(QRectF(0, 0, Width, Height));
@@ -1551,7 +1549,7 @@
 				p->setPen(Qt::NoPen);
 				if ((!m_Locked) && (!m_SizeLocked))
 				{
-					if (! asLine())
+					if ( !asLine() )
 					{
 						p->drawRect(QRectF(0.0, 0.0, handleSize, handleSize));
 						p->drawRect(QRectF(Width - handleSize, Height - handleSize, handleSize, handleSize));
@@ -1577,7 +1575,7 @@
 			}
 			else
 			{
-				p->setPen(QPen(PrefsManager::instance()->appPrefs.DFrameGroupColor, 1.0 / sc, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
+				p->setPen(QPen(PrefsManager::instance()->appPrefs.DFrameGroupColor, scInv, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
 				p->setBrush(Qt::NoBrush);
 				p->drawRect(QRectF(0.0, 0.0, Width, Height));
 				if (m_Doc->m_Selection->count() == 1)
@@ -5377,7 +5375,7 @@
 	double bw= 4*scp1;
 	double bh= 2*scp1;
 	ScribusView* view = m_Doc->view();
-	p->setPen(Qt::black, 0.5 / view->scale(), Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+	p->setPen(Qt::black, 0.5 * view->m_canvas->scaledLineWidth(), Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
 	p->setPenOpacity(1.0);
 	p->setBrush(Qt::white);
 	p->setBrushOpacity(1.0);
@@ -5385,7 +5383,7 @@
 	p->drawRect(ofx, ofy, ofwh, ofwh);
 	p->setBrush(Qt::black);
 	p->drawRect(bx1, by1, bw, bh);
-	p->setPen(Qt::black, 1.5 / view->scale(), Qt::SolidLine, Qt::FlatCap, Qt::RoundJoin);
+	p->setPen(Qt::black, 1.5 * view->m_canvas->scaledLineWidth(), Qt::SolidLine, Qt::FlatCap, Qt::RoundJoin);
 	if (m_Locked)
 		p->drawLine(FPoint(bx1+scp1/2, ofy+scp1), FPoint(bx1+scp1/2, by1));
 	p->drawLine(FPoint(bx1+scp1*3.5, ofy+scp1), FPoint(bx1+scp1*3.5, by1));

Modified: branches/Version135scrollfix/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/pageitem.h
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/pageitem.h (original)
+++ branches/Version135scrollfix/Scribus/scribus/pageitem.h Sun Nov 20 15:52:08 2011
@@ -280,9 +280,9 @@
   /** Zeichnet das Item */
 	void paintObj(QPainter *p);
 	void DrawObj(ScPainter *p, QRectF e);
-	void DrawObj_Pre(ScPainter *p, double &sc);
+	void DrawObj_Pre(ScPainter *p); //eeks: , double &sc);
 	virtual void DrawObj_Post(ScPainter *p);
-	virtual void DrawObj_Item(ScPainter *p, QRectF e, double sc) = 0;
+	virtual void DrawObj_Item(ScPainter *p, QRectF e) = 0; //eeks: , double sc) = 0;
 	QImage DrawObj_toImage();
 	QImage DrawObj_toImage(QList<PageItem*> &emG);
 	
@@ -290,12 +290,12 @@
 	virtual QString infoDescription();
 			
 protected:
-	void DrawObj_ImageFrame(ScPainter *p, double sc);
+	void DrawObj_ImageFrame(ScPainter *p); //eeks: , double sc);
 	//void DrawObj_TextFrame(ScPainter *p, QRectF e, double sc);
 	//void DrawObj_Line(ScPainter *p);
 	void DrawObj_Polygon(ScPainter *p);
 	void DrawObj_PolyLine(ScPainter *p);
-	void DrawObj_PathText(ScPainter *p, double sc);
+	void DrawObj_PathText(ScPainter *p); // eeks: , double sc);
 public:
 	void DrawObj_Embedded(ScPainter *p, QRectF e, const CharStyle& style, PageItem* cembedded);
 	void SetFrameShape(int count, double *vals);

Modified: branches/Version135scrollfix/Scribus/scribus/pageitem_imageframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/pageitem_imageframe.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/pageitem_imageframe.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/pageitem_imageframe.cpp Sun Nov 20 15:52:08 2011
@@ -53,7 +53,7 @@
 {
 }
 
-void PageItem_ImageFrame::DrawObj_Item(ScPainter *p, QRectF /*e*/, double sc)
+void PageItem_ImageFrame::DrawObj_Item(ScPainter *p, QRectF /*e*/)
 {
 	if(!m_Doc->RePos)
 	{

Modified: branches/Version135scrollfix/Scribus/scribus/pageitem_imageframe.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/pageitem_imageframe.h
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/pageitem_imageframe.h (original)
+++ branches/Version135scrollfix/Scribus/scribus/pageitem_imageframe.h Sun Nov 20 15:52:08 2011
@@ -52,7 +52,7 @@
 	virtual QString infoDescription();
 	
 protected:
-	virtual void DrawObj_Item(ScPainter *p, QRectF e, double sc);
+	virtual void DrawObj_Item(ScPainter *p, QRectF e);
 
 };
 

Modified: branches/Version135scrollfix/Scribus/scribus/pageitem_latexframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/pageitem_latexframe.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/pageitem_latexframe.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/pageitem_latexframe.cpp Sun Nov 20 15:52:08 2011
@@ -118,7 +118,7 @@
 	imgValid = false;
 }
 
-void PageItem_LatexFrame::DrawObj_Item(ScPainter *p, QRectF e, double sc)
+void PageItem_LatexFrame::DrawObj_Item(ScPainter *p, QRectF e)
 {
 	layout();
 	if (!imgValid && !err)
@@ -141,7 +141,7 @@
 	else
 	{
 		//Just pass it to ImageFrame
-		PageItem_ImageFrame::DrawObj_Item(p, e, sc);
+		PageItem_ImageFrame::DrawObj_Item(p, e);
 	}
 }
 

Modified: branches/Version135scrollfix/Scribus/scribus/pageitem_latexframe.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/pageitem_latexframe.h
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/pageitem_latexframe.h (original)
+++ branches/Version135scrollfix/Scribus/scribus/pageitem_latexframe.h Sun Nov 20 15:52:08 2011
@@ -92,7 +92,7 @@
 
 		QMap<QString,QString> editorProperties;
 	protected:
-		virtual void DrawObj_Item(ScPainter *p, QRectF e, double sc);
+		virtual void DrawObj_Item(ScPainter *p, QRectF e);
 		double lastWidth, lastHeight;
 		
 		QString formulaText;

Modified: branches/Version135scrollfix/Scribus/scribus/pageitem_line.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/pageitem_line.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/pageitem_line.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/pageitem_line.cpp Sun Nov 20 15:52:08 2011
@@ -48,7 +48,7 @@
 {
 }
 
-void PageItem_Line::DrawObj_Item(ScPainter *p, QRectF /*e*/, double /*sc*/)
+void PageItem_Line::DrawObj_Item(ScPainter *p, QRectF /*e*/)
 {
 	if (!m_Doc->RePos)
 	{

Modified: branches/Version135scrollfix/Scribus/scribus/pageitem_line.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/pageitem_line.h
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/pageitem_line.h (original)
+++ branches/Version135scrollfix/Scribus/scribus/pageitem_line.h Sun Nov 20 15:52:08 2011
@@ -46,7 +46,7 @@
 	virtual QString infoDescription();
 	
 protected:
-	virtual void DrawObj_Item(ScPainter *p, QRectF e, double sc);
+	virtual void DrawObj_Item(ScPainter *p, QRectF e);
 
 };
 

Modified: branches/Version135scrollfix/Scribus/scribus/pageitem_pathtext.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/pageitem_pathtext.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/pageitem_pathtext.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/pageitem_pathtext.cpp Sun Nov 20 15:52:08 2011
@@ -71,7 +71,7 @@
 }
 
 
-void PageItem_PathText::DrawObj_Item(ScPainter *p, QRectF cullingArea, double sc)
+void PageItem_PathText::DrawObj_Item(ScPainter *p, QRectF cullingArea)
 {
 	itemText.invalidateAll();
 	firstChar = 0;

Modified: branches/Version135scrollfix/Scribus/scribus/pageitem_pathtext.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/pageitem_pathtext.h
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/pageitem_pathtext.h (original)
+++ branches/Version135scrollfix/Scribus/scribus/pageitem_pathtext.h Sun Nov 20 15:52:08 2011
@@ -49,7 +49,7 @@
 	virtual QString infoDescription();
 
 protected:
-	virtual void DrawObj_Item(ScPainter *p, QRectF e, double sc);
+	virtual void DrawObj_Item(ScPainter *p, QRectF e);
 
 };
 

Modified: branches/Version135scrollfix/Scribus/scribus/pageitem_polygon.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/pageitem_polygon.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/pageitem_polygon.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/pageitem_polygon.cpp Sun Nov 20 15:52:08 2011
@@ -48,7 +48,7 @@
 {
 }
 
-void PageItem_Polygon::DrawObj_Item(ScPainter *p, QRectF /*e*/, double /*sc*/)
+void PageItem_Polygon::DrawObj_Item(ScPainter *p, QRectF /*e*/)
 {
 	if (!m_Doc->RePos)
 	{

Modified: branches/Version135scrollfix/Scribus/scribus/pageitem_polygon.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/pageitem_polygon.h
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/pageitem_polygon.h (original)
+++ branches/Version135scrollfix/Scribus/scribus/pageitem_polygon.h Sun Nov 20 15:52:08 2011
@@ -48,7 +48,7 @@
 	virtual QString infoDescription();
 	
 protected:
-	virtual void DrawObj_Item(ScPainter *p, QRectF e, double sc);
+	virtual void DrawObj_Item(ScPainter *p, QRectF e);
 
 };
 

Modified: branches/Version135scrollfix/Scribus/scribus/pageitem_polyline.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/pageitem_polyline.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/pageitem_polyline.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/pageitem_polyline.cpp Sun Nov 20 15:52:08 2011
@@ -47,7 +47,7 @@
 {
 }
 
-void PageItem_PolyLine::DrawObj_Item(ScPainter *p, QRectF /*e*/, double /*sc*/)
+void PageItem_PolyLine::DrawObj_Item(ScPainter *p, QRectF /*e*/)
 {
 	if (!m_Doc->RePos && PoLine.size()>=4)
 	{

Modified: branches/Version135scrollfix/Scribus/scribus/pageitem_polyline.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/pageitem_polyline.h
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/pageitem_polyline.h (original)
+++ branches/Version135scrollfix/Scribus/scribus/pageitem_polyline.h Sun Nov 20 15:52:08 2011
@@ -46,7 +46,7 @@
 	virtual QString infoDescription();
 
 protected:
-	virtual void DrawObj_Item(ScPainter *p, QRectF e, double sc);
+	virtual void DrawObj_Item(ScPainter *p, QRectF e);
 
 };
 

Modified: branches/Version135scrollfix/Scribus/scribus/pageitem_textframe.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/pageitem_textframe.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/pageitem_textframe.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/pageitem_textframe.cpp Sun Nov 20 15:52:08 2011
@@ -2400,7 +2400,7 @@
 	}
 }
 
-void PageItem_TextFrame::DrawObj_Item(ScPainter *p, QRectF cullingArea, double sc)
+void PageItem_TextFrame::DrawObj_Item(ScPainter *p, QRectF cullingArea)
 {
 	if(invalid)
 		layout();
@@ -2738,7 +2738,7 @@
 	{
 		// added to prevent fat frame outline due to antialiasing and considering you can’t pass a cosmetic pen to scpainter - pm
 		double aestheticFactor(5.0);
-		double scpInv = 1.0 / (qMax(view->scale(), 1.0) * aestheticFactor);
+		double scpInv = (qMin(view->m_canvas->scaledLineWidth(), 1.0) / aestheticFactor);
 		if ((Frame) && (m_Doc->guidesSettings.framesShown))
 		{
 			p->setPen(PrefsManager::instance()->appPrefs.DFrameNormColor, scpInv, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
@@ -2788,7 +2788,7 @@
 			drawColumnBorders(p);
 		if ((m_Doc->guidesSettings.layerMarkersShown) && (m_Doc->layerCount() > 1) && (!m_Doc->layerOutline(LayerNr)) && (!view->m_canvas->isPreviewMode()))
 		{
-			p->setPen(Qt::black, 0.5/ m_Doc->view()->scale(), Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+			p->setPen(Qt::black, 0.5 * m_Doc->view()->m_canvas->scaledLineWidth(), Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
 			p->setPenOpacity(1.0);
 			p->setBrush(m_Doc->layerMarker(LayerNr));
 			p->setBrushOpacity(1.0);
@@ -3658,7 +3658,7 @@
 	if (m_Doc->m_Selection->containsItem(this))
 		color = Qt::red;
 
-	p->setPen(color, 0.5 / view->scale(), Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+	p->setPen(color, 0.5 * view->m_canvas->scaledLineWidth(), Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
 	p->setPenOpacity(1.0);
 	p->setBrush(Qt::white);
 	p->setBrushOpacity(1.0);
@@ -3671,7 +3671,7 @@
 void PageItem_TextFrame::drawColumnBorders(ScPainter *p)
 {
 	ScribusView* view = m_Doc->view();
-	p->setPen(Qt::black, 0.5/ view->scale(), Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+	p->setPen(Qt::black, 0.5 * view->m_canvas->scaledLineWidth(), Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
 	p->setPenOpacity(1.0);
 	p->setBrush(Qt::white);
 	p->setBrushOpacity(1.0);

Modified: branches/Version135scrollfix/Scribus/scribus/pageitem_textframe.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/pageitem_textframe.h
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/pageitem_textframe.h (original)
+++ branches/Version135scrollfix/Scribus/scribus/pageitem_textframe.h Sun Nov 20 15:52:08 2011
@@ -80,7 +80,7 @@
 #endif
 	
 protected:
-	virtual void DrawObj_Item(ScPainter *p, QRectF e, double sc);
+	virtual void DrawObj_Item(ScPainter *p, QRectF e);
 	virtual void DrawObj_Post(ScPainter *p);
 	void drawOverflowMarker(ScPainter *p);
 	void drawUnderflowMarker(ScPainter *p);

Modified: branches/Version135scrollfix/Scribus/scribus/pagepalette.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/pagepalette.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/pagepalette.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/pagepalette.cpp Sun Nov 20 15:52:08 2011
@@ -643,9 +643,8 @@
 	{
 		bool oldMPMode = currView->Doc->masterPageMode();
 		int  storedPageNum = currView->Doc->currentPageNumber();
-		int  storedViewXCoor = currView->horizontalScrollBar()->value();
-		int  storedViewYCoor = currView->verticalScrollBar()->value();
-
+		FPoint storedCanvasOrigin = currView->canvasOrigin();
+		
 		currView->Doc->setMasterPageMode(true);
 		currView->Doc->scMW()->DeletePage2(currView->Doc->MasterNames[tmp]);
 		//<<CB TODO Move back into ScribusDoc::deleteMasterPage();
@@ -658,7 +657,7 @@
 
 		currView->Doc->setCurrentPage(currView->Doc->DocPages.at(storedPageNum));
 		currView->reformPages(false);
-		currView->setContentsPos(storedViewXCoor, storedViewYCoor);
+		currView->setCanvasOrigin(storedCanvasOrigin.x(), storedCanvasOrigin.y());
 		currView->DrawNew();
 	}
 }

Modified: branches/Version135scrollfix/Scribus/scribus/sampleitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/sampleitem.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/sampleitem.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/sampleitem.cpp Sun Nov 20 15:52:08 2011
@@ -7,6 +7,7 @@
 #include "scribuscore.h"
 #include "sampleitem.h"
 //#include "sampleitem.moc"
+#include "canvas.h"
 #include "loremipsum.h"
 #include "scpainter.h"
 #include "scribusdoc.h"
@@ -14,6 +15,7 @@
 #include "commonstrings.h"
 #include "pageitem_textframe.h"
 #include "prefsmanager.h"
+
 #include <QColor>
 #include <QString>
 #include <QCursor>
@@ -324,10 +326,10 @@
 
 	if (m_Doc->view() != NULL)
 	{
-		sca = m_Doc->view()->scale();
-		m_Doc->view()->setScale(1.0 * PrefsManager::instance()->appPrefs.DisScale);
+		sca = m_Doc->view()->m_canvas->getScale();
+		m_Doc->view()->m_canvas->setScale(1.0 * PrefsManager::instance()->appPrefs.DisScale);
 	}
-	painter->setZoomFactor(m_Doc->view()->scale());
+	painter->setZoomFactor(m_Doc->view()->m_canvas->getScale());
 
 	if (m_Doc->UsedFonts.contains(tmpStyle.charStyle().font().scName()))
 		previouslyUsedFont = true;
@@ -360,7 +362,7 @@
 		m_Doc->UsedFonts.remove(fontName);
 	}
 	if (m_Doc->view() != NULL)
-		m_Doc->view()->setScale(sca);
+		m_Doc->view()->m_canvas->setScale(sca);
 	m_Doc->appMode = userAppMode;
 //	m_Doc->docParagraphStyles.remove(tmpIndex);
 	UndoManager::instance()->setUndoEnabled(true);

Modified: branches/Version135scrollfix/Scribus/scribus/scribus.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/scribus.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/scribus.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/scribus.cpp Sun Nov 20 15:52:08 2011
@@ -79,6 +79,7 @@
 #include "autoform.h"
 #include "basepointwidget.h"
 #include "bookmarkpalette.h"
+#include "canvas.h"
 #include "canvasmode.h"
 #include "charselect.h"
 #include "checkDocument.h"
@@ -1351,10 +1352,7 @@
 			qApp->changeOverrideCursor(QCursor(Qt::ArrowCursor));
 			if (doc->m_Selection->count() == 0)
 			{
-				//CB We should be able to get this calculated by the canvas.... it is already in m_canvas->globalToCanvas(m->globalPos());
-				QPoint p(QCursor::pos() - mapToGlobal(QPoint(0,0)));
-				FPoint fp(p.x() / view->scale() + doc->minCanvasCoordinate.x(),
-				p.y() / view->scale() + doc->minCanvasCoordinate.y());
+				FPoint fp = view->m_canvas->globalToCanvas(QCursor::pos());
 				cmen = new ContextMenu(this, doc, fp.x(), fp.y());
 			}
 			else
@@ -2270,7 +2268,7 @@
 	tempDoc->setLoading(false);
 	//run after setGUI to set up guidepalette ok
 
-	tempView->setScale(prefsManager->displayScale());
+	tempView->resetZoom();
 	if (requiresGUI)
 	{
 		actionManager->connectNewViewActions(tempView);
@@ -2346,7 +2344,7 @@
 	ScribusWin* w = new ScribusWin(wsp, doc);
 	w->setMainWindow(this);
 	view = new ScribusView(w, this, doc);
-	view->setScale(prefsManager->displayScale());
+	view->resetZoom();
 	w->setView(view);
 	ActWin = w;
 	w->setCentralWidget(view);
@@ -3928,7 +3926,7 @@
 		w->setMainWindow(this);
 		view = new ScribusView(w, this, doc);
 		doc->setGUI(true, this, view);
-		view->setScale(prefsManager->displayScale());
+		view->resetZoom();
 		w->setView(view);
 		alignDistributePalette->setDoc(doc);
 		ActWin = w;
@@ -5867,13 +5865,14 @@
 	else
 		finalZoomFactor = zoomFactor*prefsManager->displayScale()/100.0;
 
-	if (finalZoomFactor == view->scale())
+	if (finalZoomFactor == view->m_canvas->getScale())
 		return;
 
-	int x = qRound(qMax(view->contentsX() / view->scale(), 0.0));
-	int y = qRound(qMax(view->contentsY() / view->scale(), 0.0));
-	int w = qRound(qMin(view->visibleWidth() / view->scale(), doc->currentPage()->width()));
-	int h = qRound(qMin(view->visibleHeight() / view->scale(), doc->currentPage()->height()));
+	QRectF visible = view->visibleCanvas();
+	int x = qRound(qMax(visible.x(), 0.0));
+	int y = qRound(qMax(visible.y(), 0.0));
+	int w = qRound(qMin(visible.width(), doc->currentPage()->width()));
+	int h = qRound(qMin(visible.height(), doc->currentPage()->height()));
 
 	if (zoomFactor == -200.0)
 		view->rememberOldZoomLocation(qRound(doc->currentPage()->xOffset() + doc->currentPage()->width() / 2.0), h / 2 + y);
@@ -7776,12 +7775,13 @@
 			ScribusWin* scw = (ScribusWin*) w;
 			if (oldDisplayScale != prefsManager->displayScale())
 			{
-				int x = qRound(qMax(scw->view()->contentsX() / scw->view()->scale(), 0.0));
-				int y = qRound(qMax(scw->view()->contentsY() / scw->view()->scale(), 0.0));
-				int w = qRound(qMin(scw->view()->visibleWidth() / scw->view()->scale(), scw->doc()->currentPage()->width()));
-				int h = qRound(qMin(scw->view()->visibleHeight() / scw->view()->scale(), scw->doc()->currentPage()->height()));
+				QRectF visible = scw->view()->visibleCanvas();
+				int x = qRound(qMax(visible.x(), 0.0));
+				int y = qRound(qMax(visible.y(), 0.0));
+				int w = qRound(qMin(visible.width(), scw->doc()->currentPage()->width()));
+				int h = qRound(qMin(visible.height(), scw->doc()->currentPage()->height()));
 				scw->view()->rememberOldZoomLocation(w / 2 + x,h / 2 + y);
-				scw->view()->zoom((scw->view()->scale() / oldDisplayScale) * prefsManager->displayScale());
+				scw->view()->zoomRelative(prefsManager->displayScale() / oldDisplayScale);
 			}
 			if (shadowChanged)
 				scw->view()->DrawNew();
@@ -8417,9 +8417,9 @@
 		else
 		{
 			storedPageNum = doc->currentPageNumber();
-			storedViewXCoor = view->contentsX();
-			storedViewYCoor = view->contentsY();
-			storedViewScale = view->scale();
+			storedViewXCoor = view->canvasOrigin().x();
+			storedViewYCoor = view->canvasOrigin().y();
+			storedViewScale = view->m_canvas->getScale();
 			MasterPagesPalette *dia = new MasterPagesPalette(this, doc, view, temp);
 			//connect(dia, SIGNAL(createNew(int)), this, SLOT(slotNewMasterPage(int)));
 			connect(dia, SIGNAL(removePage(int )), this, SLOT(DeletePage2(int )));
@@ -8457,7 +8457,7 @@
 
 void ScribusMainWindow::manageMasterPagesEnd()
 {
-	view->setScale(storedViewScale);
+	view->m_canvas->setScale(storedViewScale);
 	view->hideMasterPage();
 	slotSelect();
 	scrActions["editMasterPages"]->setEnabled(true);
@@ -8495,7 +8495,7 @@
 	ActWin->setMasterPagesPalette(NULL);
 	doc->setCurrentPage(doc->DocPages.at(storedPageNum));
 	view->reformPages(false);
-	view->setContentsPos(static_cast<int>(storedViewXCoor * storedViewScale), static_cast<int>(storedViewYCoor * storedViewScale));
+	view->setCanvasOrigin(storedViewXCoor, storedViewYCoor);
 	view->DrawNew();
 	pagePalette->Rebuild();
 //	if (outlinePalette->isVisible())

Modified: branches/Version135scrollfix/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/scribusdoc.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/scribusdoc.cpp Sun Nov 20 15:52:08 2011
@@ -9624,10 +9624,10 @@
 	Guides::iterator it;
 	uint yg = 0;
 	uint xg = 0;
-	double viewScale=m_View->scale();
+	double guideRad=m_View->m_canvas->scaledGuideRadius();
 	for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++yg)
 	{
-		if (fabs((*it) + page->yOffset() - yin) < (guidesSettings.guideRad / viewScale))
+		if (fabs((*it) + page->yOffset() - yin) < guideRad)
 			tmpGuidesSel.insert(fabs((*it) + page->yOffset() - yin), yg);
 	}
 	if (tmpGuidesSel.count() != 0)
@@ -9639,7 +9639,7 @@
 	tmpGuides = page->guides.verticals(GuideManagerCore::Standard);
 	for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++xg)
 	{
-		if (fabs((*it) + page->xOffset() - xin) < (guidesSettings.guideRad / viewScale))
+		if (fabs((*it) + page->xOffset() - xin) < guideRad)
 			tmpGuidesSel.insert(fabs((*it) + page->xOffset() - xin), xg);
 	}
 	if (tmpGuidesSel.count() != 0)
@@ -9653,7 +9653,7 @@
 	tmpGuides = page->guides.horizontals(GuideManagerCore::Auto);
 	for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++yg)
 	{
-		if (fabs((*it) + page->yOffset() - yin) < (guidesSettings.guideRad / viewScale))
+		if (fabs((*it) + page->yOffset() - yin) < guideRad)
 			tmpGuidesSel.insert(fabs((*it) + page->yOffset() - yin), yg);
 	}
 	if (tmpGuidesSel.count() != 0)
@@ -9665,7 +9665,7 @@
 	tmpGuides = page->guides.verticals(GuideManagerCore::Auto);
 	for (it = tmpGuides.begin(); it != tmpGuides.end(); ++it, ++xg)
 	{
-		if (fabs((*it) + page->xOffset() - xin) < (guidesSettings.guideRad / viewScale))
+		if (fabs((*it) + page->xOffset() - xin) < guideRad)
 			tmpGuidesSel.insert(fabs((*it) + page->xOffset() - xin), xg);
 	}
 	if (tmpGuidesSel.count() != 0)
@@ -9755,23 +9755,23 @@
 			*y = yout+page->yOffset();
 			ret = true;
 		}
-		double invViewScale=1/m_View->scale();
-		if (fabs(page->Margins.Left + page->xOffset() - *x) < (guidesSettings.guideRad * invViewScale))
+		double guideRad = m_View->m_canvas->scaledGuideRadius();
+		if (fabs(page->Margins.Left + page->xOffset() - *x) < guideRad)
 		{
 			*x = page->Margins.Left+page->xOffset();
 			ret = true;
 		}
-		if (fabs((page->width() - page->Margins.Right) + page->xOffset() - *x) < (guidesSettings.guideRad * invViewScale))
+		if (fabs((page->width() - page->Margins.Right) + page->xOffset() - *x) < guideRad)
 		{
 			*x = page->width() - page->Margins.Right+page->xOffset();
 			ret = true;
 		}
-		if (fabs(page->Margins.Top + page->yOffset() - *y) < (guidesSettings.guideRad * invViewScale))
+		if (fabs(page->Margins.Top + page->yOffset() - *y) < guideRad)
 		{
 			*y = page->Margins.Top+page->yOffset();
 			ret = true;
 		}
-		if (fabs((page->height() - page->Margins.Bottom)+page->yOffset() - *y) < (guidesSettings.guideRad * invViewScale))
+		if (fabs((page->height() - page->Margins.Bottom)+page->yOffset() - *y) < guideRad)
 		{
 			*y = page->height() - page->Margins.Bottom+page->yOffset();
 			ret = true;
@@ -9797,7 +9797,7 @@
 	if ((currItem->xPos() != oldx) || (currItem->yPos() != oldy))
 		retw = true;
 	//FIXME: stop using m_View
-	QRect oldR(currItem->getRedrawBounding(m_View->scale()));
+	//av: hm, not used: QRect oldR(currItem->getRedrawBounding(m_View->scale()));
 	setRedrawBounding(currItem);
 	currItem->OwnPage = OnPage(currItem);
 	return retw;

Modified: branches/Version135scrollfix/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/scribusview.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/scribusview.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/scribusview.cpp Sun Nov 20 15:52:08 2011
@@ -167,6 +167,7 @@
 	setWidgetResizable(false);
 	m_canvasMode = CanvasMode::createForAppMode(this, Doc->appMode);
 	setWidget(m_canvas);
+	resetZoom();
 	//already done by QScrollArea: widget()->installEventFilter(this);
 	installEventFilter(this); // FIXME:av
 //	viewport()->setBackgroundMode(Qt::PaletteBackground);
@@ -333,6 +334,7 @@
 		m_canvasMode = m_canvasMode->delegate();
 	}
 }
+
 
 void ScribusView::changeEvent(QEvent *e)
 {
@@ -2506,13 +2508,11 @@
 		uint docPageCount=Doc->Pages->count();
 		for (uint a = 0; a < docPageCount; ++a)
 		{
-			int xs = static_cast<int>(Doc->Pages->at(a)->xOffset() / m_canvas->scaledLineWidth());
-			int ys = static_cast<int>(Doc->Pages->at(a)->yOffset() / m_canvas->scaledLineWidth());
-			int ws = static_cast<int>(Doc->Pages->at(a)->width() / m_canvas->scaledLineWidth());
-			int hs = static_cast<int>(Doc->Pages->at(a)->height() / m_canvas->scaledLineWidth());
-			QRect drawRect = QRect(x, y, visibleWidth(), visibleHeight());
+			QRectF pageRect(Doc->Pages->at(a)->xOffset(), Doc->Pages->at(a)->yOffset(),
+							Doc->Pages->at(a)->width(), Doc->Pages->at(a)->height());
+			QRectF drawRect = visibleCanvas();
 //			drawRect.moveBy(qRound(-Doc->minCanvasCoordinate.x() * m_canvas->scale()), qRound(-Doc->minCanvasCoordinate.y() * m_canvas->scale()));
-			if (drawRect.intersects(QRect(xs, ys, ws, hs)))
+			if (drawRect.intersects(pageRect))
 				pag.append(a+1);
 		}
 		if (!pag.isEmpty())
@@ -2665,7 +2665,7 @@
 
 void ScribusView::ensureVisible ( int x, int y, int xmargin, int ymargin)
 {
-	double marginScale = 2 / scale();
+	double marginScale = 2 / m_canvas->scale();
 	FPoint tl = m_canvas->localToCanvas(QPoint(x-xmargin, y-ymargin));
 	ensureCanvasVisible(QRectF(tl.x(), tl.y(), xmargin*marginScale, ymargin*marginScale));
 }
@@ -4828,7 +4828,7 @@
 
 
 
-double ScribusView::scale() const
+double ScribusView::getScale() const
 {
 	return m_canvas->scale();
 }
@@ -4845,8 +4845,8 @@
 		QMouseEvent* m = static_cast<QMouseEvent*> (event);
 		FPoint p = m_canvas->localToCanvas(QPoint(m->x(),m->y()));
 		emit MousePos(p.x(),p.y());
-		horizRuler->Draw(m->x() + qRound(Doc->minCanvasCoordinate.x() * m_canvas->scale())); //  - 2 * contentsX());
-		vertRuler->Draw(m->y() + qRound(Doc->minCanvasCoordinate.y() * m_canvas->scale()));
+		horizRuler->Draw(m->x());// + qRound(Doc->minCanvasCoordinate.x() * m_canvas->scale())); //  - 2 * contentsX());
+		vertRuler->Draw(m->y()); // + qRound(Doc->minCanvasCoordinate.y() * m_canvas->scale()));
 		m_canvasMode->mouseMoveEvent(m);
 		return true;
 	}
@@ -4940,8 +4940,8 @@
 void ScribusView::resizeContents(int w, int h)  // deprecated
 {
 //	qDebug() << "ScribusView::resizeContents(" << w << "," << h << ")";
-	int originX = qRound(Doc->minCanvasCoordinate.x() * scale());
-	int originY = qRound(Doc->minCanvasCoordinate.y() * scale());
+	int originX = qRound(Doc->minCanvasCoordinate.x() * m_canvas->scale());
+	int originY = qRound(Doc->minCanvasCoordinate.y() * m_canvas->scale());
 	widget()->resize(w - 0*originX, h - 0*originY);
 }
 
@@ -4957,13 +4957,13 @@
 
 int ScribusView::contentsX() // deprecated
 {
-	int originX = qRound(Doc->minCanvasCoordinate.x() * scale());
+	int originX = qRound(Doc->minCanvasCoordinate.x() * m_canvas->scale());
 	return horizontalScrollBar()->value() + originX;
 }
 
 int ScribusView::contentsY() // deprecated
 {
-	int originY = qRound(Doc->minCanvasCoordinate.y() * scale());
+	int originY = qRound(Doc->minCanvasCoordinate.y() * m_canvas->scale());
 	return verticalScrollBar()->value() + originY;
 }
 
@@ -4994,6 +4994,12 @@
 void ScribusView::scrollBy(int x, int y) // deprecated
 {
 	setContentsPos(horizontalScrollBar()->value() + x, verticalScrollBar()->value() + y);
+}
+
+
+void ScribusView::zoomRelative(double scaleR)
+{
+	zoom(scaleR * m_canvas->scale());
 }
 
 
@@ -5015,6 +5021,12 @@
 void ScribusView::zoomRelative(int canvasX, int canvasY, double scaleR, bool preservePoint)
 {
 	zoom(canvasX, canvasY, scaleR * m_canvas->scale(), preservePoint);
+}
+
+
+void ScribusView::resetZoom()
+{
+	m_canvas->setScale(Prefs->DisScale);
 }
 
 
@@ -5025,7 +5037,7 @@
 	double newScale    = (scale > 32*Prefs->DisScale) ? (32*Prefs->DisScale) : scale;
 	undoManager->setUndoEnabled(false);
 	updatesOn(false);
-	setScale(newScale);
+	m_canvas->setScale(newScale);
 	QPoint localPoint = m_canvas->canvasToLocal( QPointF(canvasX, canvasY) );
 	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());

Modified: branches/Version135scrollfix/Scribus/scribus/scribusview.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/scribusview.h
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/scribusview.h (original)
+++ branches/Version135scrollfix/Scribus/scribus/scribusview.h Sun Nov 20 15:52:08 2011
@@ -92,17 +92,19 @@
 public:
     ScribusView(QWidget* win=0, ScribusMainWindow* mw=0, ScribusDoc* doc=0);
     ~ScribusView();
-	
+/*	
 	friend class LegacyMode;
 	friend class CanvasMode_CopyProperties;
 	friend class CanvasMode_Edit;
 	friend class CanvasMode_EditGradient;
 	friend class CanvasMode_FrameLinks;
 	friend class CanvasMode_Magnifier;
-	friend class CanvasMode_NodeEdit;
 	friend class CanvasMode_Normal;
-	friend class CanvasMode_ObjImport;
+
 	friend class CanvasMode_Rotate;
+	*/
+	friend class CanvasMode_NodeEdit;  // uses protected slots
+	friend class CanvasMode_ObjImport; // uses ScribusView::contentsDropEvent()
 	
 	void requestMode(int appMode);
 	void startGesture(CanvasGesture*);
@@ -228,11 +230,10 @@
 							   Selection* customSelection = 0);
 	void endGroupTransaction();
 	void cancelGroupTransaction();
-	void setScale(const double newScale);
-	double scale() const;
 
 	virtual void changed(QRectF re, bool);
 
+	void updateRulers() { setRulerPos(contentsX(), contentsY()); }
 	void updateCanvas(QRectF box = QRectF());
 	void updateCanvasItem(PageItem* item);
 	void updateCanvas(double x, double y, double width, double height) { updateCanvas(QRectF(x,y,width,height)); }
@@ -253,7 +254,6 @@
 	void resizeContents(int w, int h);
 	QPoint contentsToViewport(QPoint p);
 	QPoint viewportToContents(QPoint p);
-public: // for now
 	int contentsX();
 	int contentsY();
 	int contentsWidth();
@@ -261,12 +261,17 @@
 	void setContentsPos(int x, int y);
 	int visibleWidth() { return viewport()->size().width(); } ;
 	int visibleHeight() { return viewport()->size().height(); } ;
+public:
 	void stopAllDrags();
 	void scrollBy(int x, int y);
+	void resetZoom();
 	void zoom(double scale = 0.0);
+	void zoom(int canvasX, int canvasY, double scale, bool preservePoint);
+	void zoomRelative(double scaleR);
 	void zoomRelative(int canvasX, int canvasY, double scaleR, bool preservePoint);
-	void zoom(int canvasX, int canvasY, double scale, bool preservePoint);
-
+	void setScale(double);
+	double getScale() const;
+	
 public slots: // Public slots
 	void languageChange();
 	void toggleCMS();
@@ -356,9 +361,11 @@
 	 */
 	void setRulerPos(int x, int y);
 	void selectionChanged();
+	void dragTimerTimeOut();
+
+public slots:
 	void setObjectUndoMode();
 	void setGlobalUndoMode();
-	void dragTimerTimeOut();
 
 public:
 	virtual void wheelEvent ( QWheelEvent *ev );

Modified: branches/Version135scrollfix/Scribus/scribus/util.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/util.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/util.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/util.cpp Sun Nov 20 15:52:08 2011
@@ -448,7 +448,7 @@
 
 void ReOrderText(ScribusDoc *currentDoc, ScribusView *view)
 {
-	double savScale = view->scale();
+	double savScale = view->getScale();
 	view->setScale(1.0);
 	currentDoc->RePos = true;
 	QImage pgPix(10, 10, QImage::Format_ARGB32);

Modified: branches/Version135scrollfix/Scribus/scribus/vruler.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16995&path=/branches/Version135scrollfix/Scribus/scribus/vruler.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/vruler.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/vruler.cpp Sun Nov 20 15:52:08 2011
@@ -110,7 +110,7 @@
 		return;
 	QString tx = "";
 	double xl, frac;
-	double sc = currView->scale();
+	double sc = currView->getScale();
 	QFont ff = font();
 	ff.setPointSize(8);
 	setFont(ff);
@@ -193,9 +193,9 @@
 		}
 		// draw pixmap
 		p.save();
-		p.translate(0, -currView->contentsY());
+//		p.translate(0, -currView->contentsY());
 		p.scale(1.0/(SCALE+1), 1.0/SCALE);
-		p.drawPixmap(0, (where-2)*SCALE, pix);
+		p.drawPixmap(0, (whereToDraw-2)*SCALE, pix);
 		p.restore();
 		// repaint marks
 		p.setBrush(Qt::black);
@@ -211,7 +211,7 @@
 		}
 #else
 		// draw slim marker
-		p.translate(0, -currView->contentsY());
+//		p.translate(0, -currView->contentsY());
 		p.setPen(Qt::red);
 		p.setBrush(Qt::red);
 		cr.setPoints(5,  5, whereToDraw, 16, whereToDraw, 5, whereToDraw, 0, whereToDraw+2, 0, whereToDraw-2);
@@ -239,7 +239,7 @@
 void Vruler::Draw(int where)
 {
 	// erase old marker
-	int currentCoor = where - currView->contentsY();
+	int currentCoor = where;// - currView->contentsY();
 	whereToDraw = where;
 	drawMark = true;
 	repaint(0, oldMark-3, 17, 6);
@@ -249,7 +249,7 @@
 
 void Vruler::unitChange()
 {
-	double sc = currView->scale();
+	double sc = currView->getScale();
 	cor=1;
 	int docUnitIndex=currDoc->unitIndex();
 	switch (docUnitIndex)




More information about the scribus-commit mailing list