r16942 by avox - more Canvas::scale() encapsulation, remove redrawMarker()
scribus-commit
scribus-commit at lists.scribus.net
Sat Oct 29 17:32:40 UTC 2011
Author: avox
Date: Sat Oct 29 17:32:40 2011
New Revision: 16942
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=16942
Log:
more Canvas::scale() encapsulation, remove redrawMarker()
Modified:
branches/Version135scrollfix/Scribus/scribus/canvas.cpp
branches/Version135scrollfix/Scribus/scribus/canvas.h
branches/Version135scrollfix/Scribus/scribus/canvasmode_copyproperties.cpp
branches/Version135scrollfix/Scribus/scribus/canvasmode_create.cpp
branches/Version135scrollfix/Scribus/scribus/canvasmode_create.h
branches/Version135scrollfix/Scribus/scribus/canvasmode_drawbezier.cpp
branches/Version135scrollfix/Scribus/scribus/canvasmode_drawfreehand.cpp
branches/Version135scrollfix/Scribus/scribus/canvasmode_edit.cpp
branches/Version135scrollfix/Scribus/scribus/canvasmode_editgradient.cpp
branches/Version135scrollfix/Scribus/scribus/canvasmode_eyedropper.cpp
branches/Version135scrollfix/Scribus/scribus/canvasmode_framelinks.cpp
branches/Version135scrollfix/Scribus/scribus/canvasmode_magnifier.cpp
branches/Version135scrollfix/Scribus/scribus/canvasmode_nodeedit.cpp
branches/Version135scrollfix/Scribus/scribus/canvasmode_normal.cpp
branches/Version135scrollfix/Scribus/scribus/canvasmode_objimport.cpp
branches/Version135scrollfix/Scribus/scribus/canvasmode_panning.cpp
branches/Version135scrollfix/Scribus/scribus/canvasmode_rotate.cpp
branches/Version135scrollfix/Scribus/scribus/scribusview.cpp
branches/Version135scrollfix/Scribus/scribus/scribusview.h
Modified: branches/Version135scrollfix/Scribus/scribus/canvas.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/canvas.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvas.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvas.cpp Sat Oct 29 17:32:40 2011
@@ -45,7 +45,7 @@
void CanvasViewMode::init()
{
- scale = 1;
+ m_scale = 1;
previewMode = false;
viewAsPreview = false;
@@ -66,7 +66,7 @@
QDataStream &operator<< ( QDataStream & ds, const CanvasViewMode & vm )
{
- ds << vm.scale
+ ds << vm.m_scale
<< vm.previewMode
<< vm.viewAsPreview
<< vm.previewVisual
@@ -84,7 +84,7 @@
QDataStream &operator>> ( QDataStream & ds, CanvasViewMode & vm )
{
- ds >> vm.scale
+ ds >> vm.m_scale
>> vm.previewMode
>> vm.viewAsPreview
>> vm.previewVisual
@@ -111,6 +111,7 @@
m_viewMode.init();
m_renderMode = RENDER_NORMAL;
m_oldMinCanvasCoordinate = canvasToLocal(QPointF(0.0, 0.0));
+ m_rectangleSelection = new QRubberBand(QRubberBand::Rectangle, parent);
}
@@ -143,7 +144,7 @@
double xsp = m_doc->view()->horizRuler->ruleSpacing();
double ysp = m_doc->view()->vertRuler->ruleSpacing();
- double sc = m_viewMode.scale;
+ double sc = m_viewMode.m_scale;
// number of ruler divisions from ruler origin to ruler mark closest to the
// selected mouse coordinate
@@ -170,32 +171,32 @@
/*
FPoint Canvas::localToCanvas(QPointF p) const
{
- return FPoint(p.x() / m_viewMode.scale + m_doc->minCanvasCoordinate.x() ,
- p.y() / m_viewMode.scale + m_doc->minCanvasCoordinate.y());
+ return FPoint(p.x() / m_viewMode.m_scale + m_doc->minCanvasCoordinate.x() ,
+ p.y() / m_viewMode.m_scale + m_doc->minCanvasCoordinate.y());
}
*/
QPoint Canvas::canvasToLocal(FPoint p) const
{
- return QPoint(qRound((p.x() - m_doc->minCanvasCoordinate.x()) * m_viewMode.scale),
- qRound((p.y() - m_doc->minCanvasCoordinate.y()) * m_viewMode.scale));
+ return QPoint(qRound((p.x() - m_doc->minCanvasCoordinate.x()) * m_viewMode.m_scale),
+ qRound((p.y() - m_doc->minCanvasCoordinate.y()) * m_viewMode.m_scale));
}
QPoint Canvas::canvasToLocal(QPointF p) const
{
- return QPoint(qRound((p.x() - m_doc->minCanvasCoordinate.x()) * m_viewMode.scale),
- qRound((p.y() - m_doc->minCanvasCoordinate.y()) * m_viewMode.scale));
+ return QPoint(qRound((p.x() - m_doc->minCanvasCoordinate.x()) * m_viewMode.m_scale),
+ qRound((p.y() - m_doc->minCanvasCoordinate.y()) * m_viewMode.m_scale));
}
QRect Canvas::canvasToLocal(QRectF p) const
{
- return QRect(qRound((p.x() - m_doc->minCanvasCoordinate.x()) * m_viewMode.scale),
- qRound((p.y() - m_doc->minCanvasCoordinate.y()) * m_viewMode.scale),
- qRound(p.width() * m_viewMode.scale),
- qRound(p.height() * m_viewMode.scale));
+ return QRect(qRound((p.x() - m_doc->minCanvasCoordinate.x()) * m_viewMode.m_scale),
+ qRound((p.y() - m_doc->minCanvasCoordinate.y()) * m_viewMode.m_scale),
+ qRound(p.width() * m_viewMode.m_scale),
+ qRound(p.height() * m_viewMode.m_scale));
}
@@ -214,7 +215,7 @@
QRect Canvas::canvasToGlobal(QRectF p) const
{
return QRect(mapToParent(QPoint(0,0) + canvasToLocal(p.topLeft())) + parentWidget()->mapToGlobal(QPoint(0, 0)),
- QSize(qRound(p.width() * m_viewMode.scale), qRound(p.height() * m_viewMode.scale)));
+ QSize(qRound(p.width() * m_viewMode.m_scale), qRound(p.height() * m_viewMode.m_scale)));
}
@@ -235,7 +236,7 @@
QRectF Canvas::globalToCanvas(QRect p) const
{
FPoint org = globalToCanvas(p.topLeft());
- return QRectF(org.x(), org.y(), p.width() / m_viewMode.scale, p.height() / m_viewMode.scale);
+ return QRectF(org.x(), org.y(), p.width() / m_viewMode.m_scale, p.height() / m_viewMode.m_scale);
}
@@ -243,9 +244,50 @@
QRectF Canvas::globalToCanvas(QRectF p) const
{
FPoint org = globalToCanvas(p.topLeft());
- return QRectF(org.x(), org.y(), p.width() / m_viewMode.scale, p.height() / m_viewMode.scale);
+ return QRectF(org.x(), org.y(), p.width() / m_viewMode.m_scale, p.height() / m_viewMode.m_scale);
}
*/
+
+
+//Canvas rebuild
+
+qreal Canvas::scaledLineWidth() const
+{
+ return 1.0 / m_viewMode.m_scale;
+}
+
+QSizeF Canvas::scaledQSizeF(QSizeF size) const
+{
+ return size*m_viewMode.m_scale;
+}
+
+qreal Canvas::scaledGrabRadius() const
+{
+ return m_doc->guidesSettings.grabRad / m_viewMode.m_scale;
+}
+
+qreal Canvas::scaledGuideRadius() const
+{
+ return m_doc->guidesSettings.guideRad / m_viewMode.m_scale;
+}
+
+void Canvas::scaleAndTranslateQPainter(QPainter *p)
+{
+ p->scale(m_viewMode.m_scale, m_viewMode.m_scale);
+ p->translate(-m_doc->minCanvasCoordinate.x(), -m_doc->minCanvasCoordinate.y());
+}
+
+void Canvas::mouseMoveScrollDeltas(qreal* dx, qreal *dy, QPointF& referencePoint, QMouseEvent* m)
+{
+ FPoint canvasPoint(globalToCanvas(m->globalPos()));
+ *dx = (referencePoint.x() - canvasPoint.x()) * m_viewMode.m_scale;
+ *dy = (referencePoint.y() - canvasPoint.y()) * m_viewMode.m_scale;
+}
+
+qreal Canvas::zoomLevel() const
+{
+ return 100.0*m_viewMode.m_scale/PrefsManager::instance()->appPrefs.DisScale;
+}
// ________________________
@@ -273,10 +315,10 @@
QRect Canvas::exposedRect() const
{
- int ex ( -(x() / m_viewMode.scale) + m_doc->minCanvasCoordinate.x() );
- int ey ( -(y() / m_viewMode.scale) + m_doc->minCanvasCoordinate.y() );
- int ew ( (m_view->visibleWidth() * 1.2) / m_viewMode.scale );
- int eh ( (m_view->visibleHeight() * 1.2) / m_viewMode.scale );
+ 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 );
return QRect( ex, ey, ew, eh );
}
@@ -318,7 +360,7 @@
Canvas::FrameHandle Canvas::frameHitTest(QPointF canvasPoint, QRectF frame) const
{
FrameHandle result = INSIDE;
- const double radius = m_doc->guidesSettings.grabRad / m_viewMode.scale;
+ const double radius = m_doc->guidesSettings.grabRad / m_viewMode.m_scale;
const double radius2 = radius * radius;
double resultDistance = radius2 * 10.0; // far off
@@ -824,8 +866,8 @@
if (m_doc->appMode != modeNormal)
{
qp.save();
- qp.scale(m_viewMode.scale, m_viewMode.scale);
- qp.translate(-m_doc->minCanvasCoordinate.x() * m_viewMode.scale, -m_doc->minCanvasCoordinate.y() * m_viewMode.scale);
+ qp.scale(m_viewMode.m_scale, m_viewMode.m_scale);
+ qp.translate(-m_doc->minCanvasCoordinate.x() * m_viewMode.m_scale, -m_doc->minCanvasCoordinate.y() * m_viewMode.m_scale);
drawControls( &qp );
qp.restore();
}
@@ -878,7 +920,7 @@
if (m_doc->appMode != modeNormal)
{
qp.save();
- qp.scale(m_viewMode.scale, m_viewMode.scale);
+ qp.scale(m_viewMode.m_scale, m_viewMode.m_scale);
qp.translate(-m_doc->minCanvasCoordinate.x(), -m_doc->minCanvasCoordinate.y());
drawControls( &qp );
qp.restore();
@@ -936,7 +978,7 @@
painter->closePath();
painter->setClipPath();
painter->translate(-clipx, -clipy);
- painter->setZoomFactor(m_viewMode.scale);
+ painter->setZoomFactor(m_viewMode.m_scale);
painter->translate(-m_doc->minCanvasCoordinate.x(), -m_doc->minCanvasCoordinate.y());
painter->setLineWidth(1);
painter->setFillMode(ScPainter::Solid);
@@ -981,12 +1023,12 @@
painter->endLayer();
// Tcontents = tim.elapsed();
- double x = m_doc->scratch.Left * m_viewMode.scale;
- double y = m_doc->scratch.Top * m_viewMode.scale;
- double w = m_doc->currentPage()->width() * m_viewMode.scale;
- double h = m_doc->currentPage()->height() * m_viewMode.scale;
+ double x = m_doc->scratch.Left * m_viewMode.m_scale;
+ double y = m_doc->scratch.Top * m_viewMode.m_scale;
+ double w = m_doc->currentPage()->width() * m_viewMode.m_scale;
+ double h = m_doc->currentPage()->height() * m_viewMode.m_scale;
QRectF drawRect = QRectF(x, y, w+5, h+5);
- drawRect.translate(-m_doc->minCanvasCoordinate.x() * m_viewMode.scale, -m_doc->minCanvasCoordinate.y() * m_viewMode.scale);
+ drawRect.translate(-m_doc->minCanvasCoordinate.x() * m_viewMode.m_scale, -m_doc->minCanvasCoordinate.y() * m_viewMode.m_scale);
if ((!m_doc->guidesSettings.before) && (drawRect.intersects(QRect(clipx, clipy, clipw, cliph))))
DrawPageMarks(painter, m_doc->currentPage(), QRect(clipx, clipy, clipw, cliph));
}
@@ -1092,13 +1134,13 @@
// pp->resetMatrix();
// QPoint out = contentsToViewport(QPoint(0, 0));
// pp->translate(out.x(), out.y());
-// pp->translate(-qRound(m_doc->minCanvasCoordinate.x()*m_viewMode.scale), -qRound(m_doc->minCanvasCoordinate.y()*m_viewMode.scale));
+// pp->translate(-qRound(m_doc->minCanvasCoordinate.x()*m_viewMode.m_scale), -qRound(m_doc->minCanvasCoordinate.y()*m_viewMode.m_scale));
pp->save();
// Transform(currItem, pp);
pp->translate(currItem->xPos(), currItem->yPos());
pp->rotate(currItem->rotation());
pp->setBrush(Qt::NoBrush);
- pp->setPen(QPen(Qt::black, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
+ pp->setPen(QPen(Qt::black, 1.0 / m_viewMode.m_scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
if (selectedItemCount < moveWithFullOutlinesThreshold)
{
if (!(currItem->asLine()))
@@ -1146,8 +1188,8 @@
QPoint out = contentsToViewport(QPoint(0, 0));
// pp->resetMatrix();
// pp->translate(out.x(), out.y());
-// pp->translate(-qRound(m_doc->minCanvasCoordinate.x()*m_viewMode.scale), -qRound(m_doc->minCanvasCoordinate.y()*m_viewMode.scale));
-// pp->scale(m_viewMode.scale, m_viewMode.scale);
+// pp->translate(-qRound(m_doc->minCanvasCoordinate.x()*m_viewMode.m_scale), -qRound(m_doc->minCanvasCoordinate.y()*m_viewMode.m_scale));
+// pp->scale(m_viewMode.m_scale, m_viewMode.m_scale);
pp->translate(gx, gy);
pp->drawRect(QRectF(0.0, 0.0, gw, gh));
}
@@ -1165,7 +1207,7 @@
// pp->resetMatrix();
// QPoint out = contentsToViewport(QPoint(0, 0));
// pp->translate(out.x(), out.y());
-// pp->translate(-qRound(m_doc->minCanvasCoordinate.x()*m_viewMode.scale), -qRound(m_doc->minCanvasCoordinate.y()*m_viewMode.scale));
+// pp->translate(-qRound(m_doc->minCanvasCoordinate.x()*m_viewMode.m_scale), -qRound(m_doc->minCanvasCoordinate.y()*m_viewMode.m_scale));
pp->setBrush(drawColor);
pp->drawPolygon(m_viewMode.redrawPolygon);
m_viewMode.redrawPolygon.clear();
@@ -1180,14 +1222,14 @@
// psx->resetMatrix();
// QPoint out = contentsToViewport(QPoint(0, 0));
// psx->translate(out.x(), out.y());
-// psx->translate(-qRound(m_doc->minCanvasCoordinate.x()*m_viewMode.scale), -qRound(m_doc->minCanvasCoordinate.y()*m_viewMode.scale));
+// psx->translate(-qRound(m_doc->minCanvasCoordinate.x()*m_viewMode.m_scale), -qRound(m_doc->minCanvasCoordinate.y()*m_viewMode.m_scale));
//Transform(currItem, psx);
psx->translate(static_cast<int>(currItem->xPos()), static_cast<int>(currItem->yPos()));
psx->rotate(currItem->rotation());
- psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
+ psx->setPen(QPen(Qt::blue, 1.0 / m_viewMode.m_scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
psx->setBrush(Qt::NoBrush);
psx->drawLine(QPointF(currItem->GrStartX, currItem->GrStartY), QPointF(currItem->GrEndX, currItem->GrEndY));
- psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
+ psx->setPen(QPen(Qt::magenta, 8.0 / m_viewMode.m_scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
psx->drawPoint(QPointF(currItem->GrStartX, currItem->GrStartY));
psx->drawPoint(QPointF(currItem->GrEndX, currItem->GrEndY));
}
@@ -1199,7 +1241,7 @@
void Canvas::drawControlsBezierCurve(QPainter* pp, PageItem* currItem)
{
pp->setBrush(Qt::NoBrush);
- pp->setPen(QPen(Qt::black, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
+ pp->setPen(QPen(Qt::black, 1.0 / m_viewMode.m_scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
pp->translate(static_cast<int>(currItem->xPos()), static_cast<int>(currItem->yPos()));
pp->rotate(currItem->rotation());
QPainterPath Bez;
@@ -1263,10 +1305,10 @@
// QPoint out = contentsToViewport(QPoint(0, 0));
// pp->resetMatrix();
// pp->translate(out.x(), out.y());
-// pp->translate(-qRound(m_doc->minCanvasCoordinate.x()*m_viewMode.scale), -qRound(m_doc->minCanvasCoordinate.y()*m_viewMode.scale));
-// pp->scale(m_viewMode.scale, m_viewMode.scale);
+// pp->translate(-qRound(m_doc->minCanvasCoordinate.x()*m_viewMode.m_scale), -qRound(m_doc->minCanvasCoordinate.y()*m_viewMode.m_scale));
+// pp->scale(m_viewMode.m_scale, m_viewMode.m_scale);
pp->setBrush(Qt::NoBrush);
- pp->setPen(QPen(Qt::black, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
+ pp->setPen(QPen(Qt::black, 1.0 / m_viewMode.m_scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
pp->drawPolyline(m_viewMode.redrawPolygon);
m_viewMode.redrawPolygon.clear();
}
@@ -1280,10 +1322,10 @@
// pp->resetMatrix();
// QPoint out = contentsToViewport(QPoint(0, 0));
// pp->translate(out.x(), out.y());
-// pp->translate(-qRound(m_doc->minCanvasCoordinate.x()*m_viewMode.scale), -qRound(m_doc->minCanvasCoordinate.y()*m_viewMode.scale));
-// pp->scale(m_viewMode.scale, m_viewMode.scale);
+// pp->translate(-qRound(m_doc->minCanvasCoordinate.x()*m_viewMode.m_scale), -qRound(m_doc->minCanvasCoordinate.y()*m_viewMode.m_scale));
+// pp->scale(m_viewMode.m_scale, m_viewMode.m_scale);
pp->setBrush(Qt::NoBrush);
- pp->setPen(QPen(Qt::black, 1.0 / m_viewMode.scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
+ pp->setPen(QPen(Qt::black, 1.0 / m_viewMode.m_scale, Qt::DotLine, Qt::FlatCap, Qt::MiterJoin));
pp->drawPolyline(m_viewMode.redrawPolygon);
m_viewMode.redrawPolygon.clear();
}
@@ -1296,7 +1338,7 @@
{
FPoint orig = localToCanvas(clip.topLeft());
QRectF cullingArea = QRectF(static_cast<int>(orig.x()), static_cast<int>(orig.y()),
- qRound(clip.width() / m_viewMode.scale + 0.5), qRound(clip.height() / m_viewMode.scale + 0.5));
+ qRound(clip.width() / m_viewMode.m_scale + 0.5), qRound(clip.height() / m_viewMode.m_scale + 0.5));
QStack<PageItem*> groupStack;
QStack<PageItem*> groupStack2;
if (!page->MPageNam.isEmpty())
@@ -1505,7 +1547,7 @@
m_viewMode.linkedFramesToShow.clear();
FPoint orig = localToCanvas(clip.topLeft());
QRectF cullingArea = QRectF(static_cast<int>(orig.x()), static_cast<int>(orig.y()),
- qRound(clip.width() / m_viewMode.scale + 0.5), qRound(clip.height() / m_viewMode.scale + 0.5));
+ qRound(clip.width() / m_viewMode.m_scale + 0.5), qRound(clip.height() / m_viewMode.m_scale + 0.5));
QStack<PageItem*> groupStack;
QStack<PageItem*> groupStack2;
if (m_doc->Items->count() != 0)
@@ -1668,10 +1710,10 @@
*/
void Canvas::drawBackgroundMasterpage(ScPainter* painter, int clipx, int clipy, int clipw, int cliph)
{
- double x = m_doc->scratch.Left * m_viewMode.scale;
- double y = m_doc->scratch.Top * m_viewMode.scale;
- double w = m_doc->currentPage()->width() * m_viewMode.scale;
- double h = m_doc->currentPage()->height() * m_viewMode.scale;
+ double x = m_doc->scratch.Left * m_viewMode.m_scale;
+ double y = m_doc->scratch.Top * m_viewMode.m_scale;
+ double w = m_doc->currentPage()->width() * m_viewMode.m_scale;
+ double h = m_doc->currentPage()->height() * m_viewMode.m_scale;
QRectF drawRect = QRectF(x, y, w+5, h+5);
drawRect.translate(-m_doc->minCanvasCoordinate.x(), -m_doc->minCanvasCoordinate.y());
if (drawRect.intersects(QRectF(clipx, clipy, clipw, cliph)))
@@ -1682,10 +1724,10 @@
m_doc->getBleeds(m_doc->currentPage(), pageBleeds);
// painter->beginLayer(1.0, 0);
painter->setAntialiasing(false);
- painter->setPen(Qt::black, 1 / m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+ painter->setPen(Qt::black, 1 / m_viewMode.m_scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
if (m_doc->bleeds.hasNonZeroValue() && m_doc->guidesSettings.showBleed)
{
-// painter->drawRect(m_doc->scratch.Left - bleedLeft+5 / m_viewMode.scale, m_doc->scratch.Top - bleedTop+5 / m_viewMode.scale, m_doc->currentPage()->width() + bleedLeft + bleedRight, m_doc->currentPage()->height() + bleedBottom + bleedTop);
+// painter->drawRect(m_doc->scratch.Left - bleedLeft+5 / m_viewMode.m_scale, m_doc->scratch.Top - bleedTop+5 / m_viewMode.m_scale, m_doc->currentPage()->width() + bleedLeft + bleedRight, m_doc->currentPage()->height() + bleedBottom + bleedTop);
if (PrefsManager::instance()->appPrefs.showPageShadow)
painter->drawRect(m_doc->scratch.Left - pageBleeds.Left+5, m_doc->scratch.Top - pageBleeds.Top+5, m_doc->currentPage()->width() + pageBleeds.Left + pageBleeds.Right, m_doc->currentPage()->height() + pageBleeds.Bottom + pageBleeds.Top);
painter->setBrush(m_doc->papColor);
@@ -1693,7 +1735,7 @@
}
else
{
-// painter->drawRect(m_doc->scratch.Left+5 / m_viewMode.scale, m_doc->scratch.Top+5 / m_viewMode.scale, m_doc->currentPage()->width(), m_doc->currentPage()->height());
+// painter->drawRect(m_doc->scratch.Left+5 / m_viewMode.m_scale, m_doc->scratch.Top+5 / m_viewMode.m_scale, m_doc->currentPage()->width(), m_doc->currentPage()->height());
if (PrefsManager::instance()->appPrefs.showPageShadow)
painter->drawRect(m_doc->scratch.Left+5, m_doc->scratch.Top+5, m_doc->currentPage()->width(), m_doc->currentPage()->height());
painter->setBrush(m_doc->papColor);
@@ -1720,20 +1762,20 @@
painter->setBrush(QColor(128,128,128));
painter->setAntialiasing(false);
// painter->beginLayer(1.0, 0);
- painter->setPen(Qt::black, 1.0 / m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+ painter->setPen(Qt::black, 1.0 / m_viewMode.m_scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
Page *actPg;
MarginStruct pageBleeds;
for (int a = 0; a < static_cast<int>(docPagesCount); ++a)
{
actPg = m_doc->Pages->at(a);
m_doc->getBleeds(actPg, pageBleeds);
- double blx = (actPg->xOffset() - pageBleeds.Left) * m_viewMode.scale;
- double bly = (actPg->yOffset() - pageBleeds.Top) * m_viewMode.scale;
- double blw = (actPg->width() + pageBleeds.Left + pageBleeds.Right) * m_viewMode.scale;
- double blh = (actPg->height() + pageBleeds.Bottom + pageBleeds.Top) * m_viewMode.scale;
+ double blx = (actPg->xOffset() - pageBleeds.Left) * m_viewMode.m_scale;
+ double bly = (actPg->yOffset() - pageBleeds.Top) * m_viewMode.m_scale;
+ double blw = (actPg->width() + pageBleeds.Left + pageBleeds.Right) * m_viewMode.m_scale;
+ double blh = (actPg->height() + pageBleeds.Bottom + pageBleeds.Top) * m_viewMode.m_scale;
QRectF drawRect = QRectF(blx-1, bly-1, blw+6, blh+6);
- drawRect.translate(-m_doc->minCanvasCoordinate.x() * m_viewMode.scale, -m_doc->minCanvasCoordinate.y() * m_viewMode.scale);
+ drawRect.translate(-m_doc->minCanvasCoordinate.x() * m_viewMode.m_scale, -m_doc->minCanvasCoordinate.y() * m_viewMode.m_scale);
if (drawRect.intersects(QRectF(clipx, clipy, clipw, cliph)))
{
painter->setFillMode(ScPainter::Solid);
@@ -1748,13 +1790,13 @@
blw2 += pageBleeds.Left + pageBleeds.Right;
blh2 += pageBleeds.Bottom + pageBleeds.Top;
}
-// painter->drawRect(blx2 + 5 /* m_viewMode.scale */, bly2 + 5 /* m_viewMode.scale */, blw2, blh2);
+// painter->drawRect(blx2 + 5 /* m_viewMode.m_scale */, bly2 + 5 /* m_viewMode.m_scale */, blw2, blh2);
painter->drawRect(blx2 + 5, bly2 + 5, blw2, blh2);
if (m_doc->bleeds.hasNonZeroValue() && m_doc->guidesSettings.showBleed)
{
painter->setFillMode(ScPainter::None);
- painter->setPen(Qt::black, 1.0 / m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
- painter->drawRect(blx2 - 1 / m_viewMode.scale, bly2 - 1 / m_viewMode.scale, blw2 + 2 / m_viewMode.scale, blh2 + 2 / m_viewMode.scale);
+ painter->setPen(Qt::black, 1.0 / m_viewMode.m_scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+ painter->drawRect(blx2 - 1 / m_viewMode.m_scale, bly2 - 1 / m_viewMode.m_scale, blw2 + 2 / m_viewMode.m_scale, blh2 + 2 / m_viewMode.m_scale);
}
}
}
@@ -1779,13 +1821,13 @@
}
else
pageBleeds.resetToZero();
- double blx = (actPg->xOffset() - pageBleeds.Left) * m_viewMode.scale;
- double bly = (actPg->yOffset() - pageBleeds.Top) * m_viewMode.scale;
- double blw = (actPg->width() + pageBleeds.Left + pageBleeds.Right) * m_viewMode.scale;
- double blh = (actPg->height() + pageBleeds.Bottom + pageBleeds.Top) * m_viewMode.scale;
+ double blx = (actPg->xOffset() - pageBleeds.Left) * m_viewMode.m_scale;
+ double bly = (actPg->yOffset() - pageBleeds.Top) * m_viewMode.m_scale;
+ double blw = (actPg->width() + pageBleeds.Left + pageBleeds.Right) * m_viewMode.m_scale;
+ double blh = (actPg->height() + pageBleeds.Bottom + pageBleeds.Top) * m_viewMode.m_scale;
QRectF drawRect = QRectF(blx, bly, blw+5, blh+5);
- drawRect.translate(-m_doc->minCanvasCoordinate.x() * m_viewMode.scale, -m_doc->minCanvasCoordinate.y() * m_viewMode.scale);
+ drawRect.translate(-m_doc->minCanvasCoordinate.x() * m_viewMode.m_scale, -m_doc->minCanvasCoordinate.y() * m_viewMode.m_scale);
if (drawRect.intersects(QRectF(clipx, clipy, clipw, cliph)))
{
painter->setFillMode(ScPainter::Solid);
@@ -1850,12 +1892,12 @@
for (uint a = 0; a < docPagesCount; ++a)
{
actPg = m_doc->Pages->at(a);
- double x = actPg->xOffset() * m_viewMode.scale;
- double y = actPg->yOffset() * m_viewMode.scale;
- double w = actPg->width() * m_viewMode.scale;
- double h = actPg->height() * m_viewMode.scale;
+ double x = actPg->xOffset() * m_viewMode.m_scale;
+ double y = actPg->yOffset() * m_viewMode.m_scale;
+ double w = actPg->width() * m_viewMode.m_scale;
+ double h = actPg->height() * m_viewMode.m_scale;
QRectF drawRect = QRectF(x, y, w+5, h+5);
- drawRect.translate(-m_doc->minCanvasCoordinate.x() * m_viewMode.scale, -m_doc->minCanvasCoordinate.y() * m_viewMode.scale);
+ drawRect.translate(-m_doc->minCanvasCoordinate.x() * m_viewMode.m_scale, -m_doc->minCanvasCoordinate.y() * m_viewMode.m_scale);
if (drawRect.intersects(QRectF(clipx, clipy, clipw, cliph)))
DrawPageMarks(painter, m_doc->Pages->at(a), QRect(clipx, clipy, clipw, cliph));
}
@@ -1870,7 +1912,7 @@
p->save();
p->setAntialiasing(false);
p->translate(page->xOffset(), page->yOffset());
- double lineWidth = 1.0 / m_viewMode.scale;
+ double lineWidth = 1.0 / m_viewMode.m_scale;
double pageHeight=page->height();
double pageWidth=page->width();
p->setFillMode(ScPainter::None);
@@ -1908,11 +1950,11 @@
//Draw the grid lines
if (m_doc->guidesSettings.gridShown)
{
- double lowerBx = qMax(clip.x() / m_viewMode.scale + m_doc->minCanvasCoordinate.x() - page->xOffset(), 0.0);
- double lowerBy = qMax(clip.y() / m_viewMode.scale + m_doc->minCanvasCoordinate.y() - page->yOffset(), 0.0);
- double highBx = qMin(lowerBx + clip.width() / m_viewMode.scale, pageWidth);
- double highBy = qMin(lowerBy + clip.height() / m_viewMode.scale, pageHeight);
- if (m_viewMode.scale > 0.49)
+ double lowerBx = qMax(clip.x() / m_viewMode.m_scale + m_doc->minCanvasCoordinate.x() - page->xOffset(), 0.0);
+ double lowerBy = qMax(clip.y() / m_viewMode.m_scale + m_doc->minCanvasCoordinate.y() - page->yOffset(), 0.0);
+ double highBx = qMin(lowerBx + clip.width() / m_viewMode.m_scale, pageWidth);
+ double highBy = qMin(lowerBy + clip.height() / m_viewMode.m_scale, pageHeight);
+ if (m_viewMode.m_scale > 0.49)
{
double i,start;
i = m_doc->guidesSettings.majorGrid;
@@ -1950,7 +1992,7 @@
page->guides.drawPage(p, m_doc, lineWidth);
if (m_doc->currentPage() == page)
{
- p->setPen(PrefsManager::instance()->appPrefs.DPageBorderColor, 1 / m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+ p->setPen(PrefsManager::instance()->appPrefs.DPageBorderColor, 1 / m_viewMode.m_scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
p->drawRect(0, 0, pageWidth, pageHeight);
}
p->setAntialiasing(true);
@@ -2033,14 +2075,14 @@
{
//CB FIXME Add some checking that the painter is setup?
Q_ASSERT(painter!=NULL);
- painter->setPen(Qt::black, 1.0 / m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
+ painter->setPen(Qt::black, 1.0 / m_viewMode.m_scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin);
painter->setPenOpacity(1.0);
painter->drawLine(start, end);
QMatrix arrowTrans;
arrowTrans.translate(end.x(), end.y());
double r = atan2(end.y()-start.y(), end.x()-start.x())*(180.0/M_PI);
arrowTrans.rotate(r);
- double sc = 0.8 / m_viewMode.scale;
+ double sc = 0.8 / m_viewMode.m_scale;
arrowTrans.scale(sc, sc);
FPointArray arrow;
arrow.addQuadPoint(-12, 0, -12, 0, -12, 0, -12, 0);
@@ -2084,9 +2126,9 @@
{
if (!oldRect.isNull())
newR.unite(oldRect);
-// newR.moveBy(qRound(-m_doc->minCanvasCoordinate.x() * m_viewMode.scale), qRound(-m_doc->minCanvasCoordinate.y() * m_viewMode.scale));
+// newR.moveBy(qRound(-m_doc->minCanvasCoordinate.x() * m_viewMode.m_scale), qRound(-m_doc->minCanvasCoordinate.y() * m_viewMode.m_scale));
m_viewMode.redrawPolygon = newRect;
-// m_viewMode.redrawPolygon.translate(qRound(-m_doc->minCanvasCoordinate.x() * m_viewMode.scale), qRound(-m_doc->minCanvasCoordinate.y() * m_viewMode.scale));
+// m_viewMode.redrawPolygon.translate(qRound(-m_doc->minCanvasCoordinate.x() * m_viewMode.m_scale), qRound(-m_doc->minCanvasCoordinate.y() * m_viewMode.m_scale));
repaint(newR.adjusted(-20, -20, 40, 40));
}
oldRect = newR;
@@ -2096,27 +2138,27 @@
{
double gx, gy, gh, gw;
m_doc->m_Selection->getGroupRect(&gx, &gy, &gw, &gh);
- QPoint in(qRound(gx* m_viewMode.scale), qRound(gy* m_viewMode.scale));
-// in -= QPoint(qRound(m_doc->minCanvasCoordinate.x() * m_viewMode.scale), qRound(m_doc->minCanvasCoordinate.y() * m_viewMode.scale));
+ QPoint in(qRound(gx* m_viewMode.m_scale), qRound(gy* m_viewMode.m_scale));
+// in -= QPoint(qRound(m_doc->minCanvasCoordinate.x() * m_viewMode.m_scale), qRound(m_doc->minCanvasCoordinate.y() * m_viewMode.m_scale));
QPoint out = contentsToViewport(in);
*x = static_cast<double>(out.x());
*y = static_cast<double>(out.y());
- *w = gw* m_viewMode.scale;
- *h = gh* m_viewMode.scale;
+ *w = gw* m_viewMode.m_scale;
+ *h = gh* m_viewMode.m_scale;
}
void Canvas::Transform(PageItem *currItem, QPainter *p)
{
- p->translate(currItem->xPos()*m_viewMode.scale, currItem->yPos()*m_viewMode.scale);
- p->scale(m_viewMode.scale, m_viewMode.scale);
+ p->translate(currItem->xPos()*m_viewMode.m_scale, currItem->yPos()*m_viewMode.m_scale);
+ p->scale(m_viewMode.m_scale, m_viewMode.m_scale);
p->rotate(currItem->rotation());
}
void Canvas::Transform(PageItem *currItem, QMatrix& m)
{
- m.translate(currItem->xPos()*m_viewMode.scale, currItem->yPos()*m_viewMode.scale);
- m.scale(m_viewMode.scale, m_viewMode.scale);
+ m.translate(currItem->xPos()*m_viewMode.m_scale, currItem->yPos()*m_viewMode.m_scale);
+ m.scale(m_viewMode.m_scale, m_viewMode.m_scale);
m.rotate(currItem->rotation());
}
@@ -2316,6 +2358,34 @@
QToolTip::showText(m + QPoint(5, 5), tr("Angle: %1").arg(value2String(r, SC_DEGREES, true, true)), this);
}
+
+void Canvas::displayRectangleSelection(QPoint start, QPoint end)
+{
+ m_rectangleSelection->setGeometry(QRect(start, end).normalized());
+ if (!m_rectangleSelection->isVisible())
+ m_rectangleSelection->show();
+ m_haveRectangleSelection = true;
+}
+
+
+void Canvas::hideRectangleSelection()
+{
+ m_rectangleSelection->hide();
+ m_haveRectangleSelection = false;
+}
+
+
+bool Canvas::haveRectangleSelection() const
+{
+ return m_haveRectangleSelection;
+}
+
+
+QRect Canvas::getRectangleSelection() const
+{
+ return m_rectangleSelection->geometry().normalized();
+}
+
void Canvas::setupEditHRuler(PageItem * item, bool forceAndReset)
{
static QString rulerItemRef;
@@ -2354,42 +2424,3 @@
m_view->horizRuler->update();
}
-//Canvas rebuild
-
-qreal Canvas::scaledLineWidth() const
-{
- return 1.0 / m_viewMode.scale;
-}
-
-QSizeF Canvas::scaledQSizeF(QSizeF size) const
-{
- return size*m_viewMode.scale;
-}
-
-qreal Canvas::scaledGrabRadius() const
-{
- return m_doc->guidesSettings.grabRad / m_viewMode.scale;
-}
-
-qreal Canvas::scaledGuideRadius() const
-{
- return m_doc->guidesSettings.guideRad / m_viewMode.scale;
-}
-
-void Canvas::scaleAndTranslateQPainter(QPainter *p)
-{
- p->scale(m_viewMode.scale, m_viewMode.scale);
- p->translate(-m_doc->minCanvasCoordinate.x(), -m_doc->minCanvasCoordinate.y());
-}
-
-void Canvas::mouseMoveScrollDeltas(qreal* dx, qreal *dy, QPointF& referencePoint, QMouseEvent* m)
-{
- FPoint canvasPoint(globalToCanvas(m->globalPos()));
- *dx = (referencePoint.x() - canvasPoint.x()) * m_viewMode.scale;
- *dy = (referencePoint.y() - canvasPoint.y()) * m_viewMode.scale;
-}
-
-qreal Canvas::zoomLevel() const
-{
- return 100.0*m_viewMode.scale/PrefsManager::instance()->appPrefs.DisScale;
-}
Modified: branches/Version135scrollfix/Scribus/scribus/canvas.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/canvas.h
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvas.h (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvas.h Sat Oct 29 17:32:40 2011
@@ -29,6 +29,7 @@
#include <QPolygon>
#include <QRect>
#include <QWidget>
+#include <QRubberBand>
#include "scribusapi.h"
@@ -48,7 +49,7 @@
{
void init();
- double scale;
+ double m_scale;
bool previewMode;
bool viewAsPreview;
@@ -87,20 +88,19 @@
friend class ScribusView; // for now...
friend class CanvasMode;
- friend class LegacyMode;
friend class CanvasMode_CopyProperties;
+ friend class CanvasMode_EyeDropper;
+ friend class CanvasMode_FrameLinks;
+ friend class FreehandMode;
friend class CanvasMode_Edit;
friend class CanvasMode_EditGradient;
- friend class CanvasMode_EyeDropper;
- friend class CanvasMode_FrameLinks;
friend class CanvasMode_Magnifier;
friend class CanvasMode_NodeEdit;
friend class CanvasMode_ObjImport;
friend class CanvasMode_Panning;
friend class CanvasMode_Normal;
friend class CanvasMode_Rotate;
- friend class FreehandMode;
-
+
/* Dont rely on these codes!
* 283
* 7 6
@@ -138,8 +138,8 @@
void setRenderModeFillBuffer() { m_renderMode = RENDER_BUFFERED; }
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(); } }
+public:
+ void setScale(double scale) { if (m_viewMode.m_scale != scale) { m_viewMode.m_scale = scale; clearBuffers(); update(); } }
QPoint canvasToLocal(FPoint p) const;
QPoint canvasToGlobal(FPoint p) const;
QPoint canvasToLocal(QPointF p) const;
@@ -191,6 +191,10 @@
void displayXYHUD(QPoint m, double x, double y);
void displaySizeHUD(QPoint m, double x, double y, bool isLine = false);
void displayRotHUD(QPoint m, double rot);
+ void displayRectangleSelection(QPoint start, QPoint end);
+ void hideRectangleSelection();
+ bool haveRectangleSelection() const;
+ QRect getRectangleSelection() const;
void setupEditHRuler(PageItem * item, bool forceAndReset = false);
//Canvas rebuild
@@ -203,7 +207,7 @@
qreal zoomLevel() const;
private:
- //double scale() const { return m_viewMode.scale; }
+ double scale() const { return m_viewMode.m_scale; }
void DrawPageMarks(ScPainter *p, Page* page, QRect clip);
void drawLinkFrameLine(ScPainter* painter, FPoint &start, FPoint &end);
void PaintSizeRect(QRect neu);
@@ -249,6 +253,10 @@
QPixmap m_selectionBuffer;
QRect m_selectionRect;
QPoint m_oldMinCanvasCoordinate;
+
+ QRubberBand *m_rectangleSelection;
+ bool m_haveRectangleSelection;
+
};
Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_copyproperties.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_copyproperties.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_copyproperties.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_copyproperties.cpp Sat Oct 29 17:32:40 2011
@@ -1,3 +1,4 @@
+
/*
For general Scribus (>=1.3.2) copyright and licensing information please refer
to the COPYING file provided with the program. Following this notice may exist
@@ -92,7 +93,7 @@
void CanvasMode_CopyProperties::deactivate(bool forGesture)
{
// qDebug() << "CanvasMode_CopyProperties::deactivate" << forGesture;
- m_view->redrawMarker->hide();
+ m_canvas->hideRectangleSelection();
}
void CanvasMode_CopyProperties::mouseDoubleClickEvent(QMouseEvent *m)
@@ -112,10 +113,7 @@
if ((m_canvas->m_viewMode.m_MouseButtonPressed) && (m->buttons() & Qt::LeftButton))
{
QPoint startP = m_canvas->canvasToGlobal(QPointF(Mxp, Myp));
- m_view->redrawMarker->setGeometry(QRect(startP, m->globalPos()).normalized());
- if (!m_view->redrawMarker->isVisible())
- m_view->redrawMarker->show();
- m_view->HaveSelRect = true;
+ m_canvas->displayRectangleSelection(startP, m->globalPos());
return;
}
}
@@ -131,7 +129,7 @@
m_canvas->PaintSizeRect(QRect());
m_canvas->m_viewMode.m_MouseButtonPressed = true;
m_canvas->m_viewMode.operItemMoving = false;
- m_view->HaveSelRect = false;
+ m_canvas->hideRectangleSelection();
m_doc->DragP = false;
m_doc->leaveDrag = false;
m->accept();
Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_create.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_create.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_create.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_create.cpp Sat Oct 29 17:32:40 2011
@@ -187,7 +187,8 @@
canvasPressCoord.setXY(-1.0, -1.0);
mouseGlobalCoord.setXY(-1.0, -1.0);
inItemCreation = false;
- }
+ }
+ haveCurrCoord = false;
setModeCursor();
}
@@ -276,7 +277,7 @@
newY = /*qRound(*/ny/*)*/;
//}
canvasCurrCoord.setXY(newX, newY);
- m_view->HaveSelRect = true;
+ haveCurrCoord = true;
double wSize = canvasCurrCoord.x() - createObjectPos.x();
double hSize = canvasCurrCoord.y() - createObjectPos.y();
@@ -308,7 +309,7 @@
double Rxp = 0, Ryp = 0;
m_MouseButtonPressed = true;
- m_view->HaveSelRect = false;
+ haveCurrCoord = false;
m_doc->DragP = false;
m_doc->leaveDrag = false;
inItemCreation = false;
@@ -754,10 +755,10 @@
m_view->redrawMarker->setGeometry(m->globalPos().x(), m->globalPos().y(), 1, 1);
m_view->redrawMarker->show();*/
- if ((m_doc->m_Selection->count() == 0) && (m_view->HaveSelRect) && (!m_view->MidButt))
+ if ((m_doc->m_Selection->count() == 0) && (haveCurrCoord) && (!m_view->MidButt))
{
UndoTransaction * activeTransaction = NULL;
- m_view->HaveSelRect = false;
+ haveCurrCoord = false;
double Tx, Ty, Tw, Th;
FPoint np2 = m_doc->ApplyGridF(canvasPressCoord);
Tx = np2.x();
Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_create.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_create.h
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_create.h (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_create.h Sat Oct 29 17:32:40 2011
@@ -65,6 +65,7 @@
FPoint mouseGlobalCoord;
FPoint canvasPressCoord;
FPoint canvasCurrCoord;
+ bool haveCurrCoord;
FPoint createObjectPos;
int createObjectMode;
int createObjectSubMode;
Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_drawbezier.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_drawbezier.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_drawbezier.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_drawbezier.cpp Sat Oct 29 17:32:40 2011
@@ -172,7 +172,7 @@
delete m_createTransaction;
m_createTransaction = NULL;
}
- m_view->redrawMarker->hide();
+ m_canvas->hideRectangleSelection();
}
void BezierMode::mouseDoubleClickEvent(QMouseEvent *m)
@@ -255,10 +255,7 @@
m_view->redrawMarker->setGeometry(QRect(Mxp, Myp, m->globalPos().x() - Mxp, m->globalPos().y() - Myp).normalized());
*/
QPoint startP = m_canvas->canvasToGlobal(QPointF(Mxp, Myp));
- m_view->redrawMarker->setGeometry(QRect(startP, m->globalPos()).normalized());
- if (!m_view->redrawMarker->isVisible())
- m_view->redrawMarker->show();
- m_view->HaveSelRect = true;
+ m_canvas->displayRectangleSelection(startP, m->globalPos());
return;
}
}
@@ -280,7 +277,7 @@
QRect tx;
QMatrix pm;
m_MouseButtonPressed = true;
- m_view->HaveSelRect = false;
+ m_canvas->hideRectangleSelection();
m_doc->DragP = false;
m_doc->leaveDrag = false;
MoveGX = MoveGY = false;
Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_drawfreehand.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_drawfreehand.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_drawfreehand.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_drawfreehand.cpp Sat Oct 29 17:32:40 2011
@@ -119,7 +119,7 @@
void FreehandMode::deactivate(bool flag)
{
// qDebug() << "FreehandMode::deactivate" << flag;
- m_view->redrawMarker->hide();
+ m_canvas->hideRectangleSelection();
}
void FreehandMode::mouseDoubleClickEvent(QMouseEvent *m)
@@ -232,10 +232,7 @@
m_view->redrawMarker->setGeometry(QRect(Mxp, Myp, m->globalPos().x() - Mxp, m->globalPos().y() - Myp).normalized());
*/
QPoint startP = m_canvas->canvasToGlobal(m_doc->appMode == modeDrawTable? QPointF(Dxp, Dyp) : QPointF(Mxp, Myp));
- m_view->redrawMarker->setGeometry(QRect(startP, m->globalPos()).normalized());
- if (!m_view->redrawMarker->isVisible())
- m_view->redrawMarker->show();
- m_view->HaveSelRect = true;
+ m_canvas->displayRectangleSelection(startP, m->globalPos());
return;
}
}
@@ -253,7 +250,7 @@
QRect tx;
QMatrix pm;
m_MouseButtonPressed = true;
- m_view->HaveSelRect = false;
+ m_canvas->hideRectangleSelection();
m_doc->DragP = false;
m_doc->leaveDrag = false;
MoveGX = MoveGY = false;
@@ -839,7 +836,7 @@
}
}
//CB Drag selection performed here
- if (((m_doc->m_Selection->count() == 0) && (m_view->HaveSelRect) && (!m_view->MidButt)) || ((shiftSelItems) && (m_view->HaveSelRect) && (!m_view->MidButt)))
+ if (((m_doc->m_Selection->count() == 0) && (m_canvas->haveRectangleSelection()) && (!m_view->MidButt)) || ((shiftSelItems) && (m_canvas->haveRectangleSelection()) && (!m_view->MidButt)))
{
QRectF Sele = QRectF(Dxp, Dyp, SeRx-Dxp, SeRy-Dyp).normalized();
if (!m_doc->masterPageMode())
@@ -899,9 +896,8 @@
// emit HaveSel(m_doc->m_Selection->itemAt(0)->itemType());
}*/
- m_view->HaveSelRect = false;
+ m_canvas->hideRectangleSelection();
shiftSelItems = false;
- m_view->redrawMarker->hide();
m_view->updateCanvas();
}
if (m_doc->appMode != modeEdit)
Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_edit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_edit.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_edit.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_edit.cpp Sat Oct 29 17:32:40 2011
@@ -397,7 +397,7 @@
void CanvasMode_Edit::deactivate(bool forGesture)
{
// qDebug() << "CanvasMode_Edit::deactivate" << forGesture;
- m_view->redrawMarker->hide();
+ m_canvas->hideRectangleSelection();
if (!forGesture)
{
m_RulerGuide = -1;
@@ -587,10 +587,7 @@
m_view->redrawMarker->setGeometry(QRect(Mxp, Myp, m->globalPos().x() - Mxp, m->globalPos().y() - Myp).normalized());
*/
QPoint startP = m_canvas->canvasToGlobal(QPointF(Mxp, Myp));
- m_view->redrawMarker->setGeometry(QRect(startP, m->globalPos()).normalized());
- if (!m_view->redrawMarker->isVisible())
- m_view->redrawMarker->show();
- m_view->HaveSelRect = true;
+ m_canvas->displayRectangleSelection(startP, m->globalPos());
return;
}
}
@@ -609,7 +606,7 @@
QMatrix pm;
m_canvas->m_viewMode.m_MouseButtonPressed = true;
m_canvas->m_viewMode.operItemMoving = false;
- m_view->HaveSelRect = false;
+ m_canvas->hideRectangleSelection();
m_doc->DragP = false;
m_doc->leaveDrag = false;
m->accept();
@@ -914,7 +911,7 @@
}
}
//CB Drag selection performed here
- if ((m_doc->m_Selection->count() == 0) && (m_view->HaveSelRect) && (!m_view->MidButt))
+ if ((m_doc->m_Selection->count() == 0) && m_canvas->haveRectangleSelection() && (!m_view->MidButt))
{
QRectF Sele = QRectF(Dxp, Dyp, SeRx-Dxp, SeRy-Dyp).normalized();
if (!m_doc->masterPageMode())
@@ -963,8 +960,7 @@
m_view->getGroupRectScreen(&x, &y, &w, &h);
}
}
- m_view->HaveSelRect = false;
- m_view->redrawMarker->hide();
+ m_canvas->hideRectangleSelection();
m_view->updateContents();
}
if (GetItem(&currItem))
Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_editgradient.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_editgradient.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_editgradient.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_editgradient.cpp Sat Oct 29 17:32:40 2011
@@ -118,7 +118,6 @@
void CanvasMode_EditGradient::deactivate(bool forGesture)
{
// qDebug() << "CanvasMode_EditGradient::deactivate" << forGesture;
- m_view->redrawMarker->hide();
}
void CanvasMode_EditGradient::mouseDoubleClickEvent(QMouseEvent *m)
@@ -203,7 +202,6 @@
m_canvas->PaintSizeRect(QRect());
m_canvas->m_viewMode.m_MouseButtonPressed = true;
m_canvas->m_viewMode.operItemMoving = false;
- m_view->HaveSelRect = false;
m_doc->DragP = false;
m_doc->leaveDrag = false;
m->accept();
Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_eyedropper.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_eyedropper.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_eyedropper.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_eyedropper.cpp Sat Oct 29 17:32:40 2011
@@ -100,7 +100,6 @@
void CanvasMode_EyeDropper::deactivate(bool forGesture)
{
// qDebug() << "CanvasMode_EyeDropper::deactivate" << forGesture;
- m_view->redrawMarker->hide();
releaseMouse();
}
@@ -124,7 +123,6 @@
{
m_canvas->m_viewMode.m_MouseButtonPressed = true;
m_canvas->m_viewMode.operItemMoving = false;
- m_view->HaveSelRect = false;
m_doc->DragP = false;
m_doc->leaveDrag = false;
m->accept();
Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_framelinks.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_framelinks.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_framelinks.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_framelinks.cpp Sat Oct 29 17:32:40 2011
@@ -107,7 +107,7 @@
void CanvasMode_FrameLinks::deactivate(bool forGesture)
{
// qDebug() << "CanvasMode_FrameLinks::deactivate" << forGesture;
- m_view->redrawMarker->hide();
+ m_canvas->hideRectangleSelection();
}
void CanvasMode_FrameLinks::mouseDoubleClickEvent(QMouseEvent *m)
@@ -134,10 +134,7 @@
m_view->redrawMarker->setGeometry(QRect(Mxp, Myp, m->globalPos().x() - Mxp, m->globalPos().y() - Myp).normalized());
*/
QPoint startP = m_canvas->canvasToGlobal(m_doc->appMode == modeDrawTable? QPointF(Dxp, Dyp) : QPointF(Mxp, Myp));
- m_view->redrawMarker->setGeometry(QRect(startP, m->globalPos()).normalized());
- if (!m_view->redrawMarker->isVisible())
- m_view->redrawMarker->show();
- m_view->HaveSelRect = true;
+ m_canvas->displayRectangleSelection(startP, m->globalPos());
return;
}
}
@@ -154,7 +151,7 @@
m_canvas->PaintSizeRect(QRect());
m_canvas->m_viewMode.m_MouseButtonPressed = true;
m_canvas->m_viewMode.operItemMoving = false;
- m_view->HaveSelRect = false;
+ m_canvas->hideRectangleSelection();
m_doc->DragP = false;
m_doc->leaveDrag = false;
// oldClip = 0;
Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_magnifier.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_magnifier.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_magnifier.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_magnifier.cpp Sat Oct 29 17:32:40 2011
@@ -100,7 +100,7 @@
void CanvasMode_Magnifier::deactivate(bool forGesture)
{
// qDebug() << "CanvasMode_Magnifier::deactivate" << forGesture;
- m_view->redrawMarker->hide();
+ m_canvas->hideRectangleSelection();
}
void CanvasMode_Magnifier::mouseDoubleClickEvent(QMouseEvent *m)
@@ -133,10 +133,7 @@
m_view->redrawMarker->setGeometry(QRect(Mxp, Myp, m->globalPos().x() - Mxp, m->globalPos().y() - Myp).normalized());
*/
QPoint startP = m_canvas->canvasToGlobal(m_doc->appMode == modeDrawTable? QPointF(Dxp, Dyp) : QPointF(Mxp, Myp));
- m_view->redrawMarker->setGeometry(QRect(startP, m->globalPos()).normalized());
- if (!m_view->redrawMarker->isVisible())
- m_view->redrawMarker->show();
- m_view->HaveSelRect = true;
+ m_canvas->displayRectangleSelection(startP, m->globalPos());
}
}
@@ -148,7 +145,7 @@
m_canvas->PaintSizeRect(QRect());
m_canvas->m_viewMode.m_MouseButtonPressed = true;
m_canvas->m_viewMode.operItemMoving = false;
- m_view->HaveSelRect = false;
+ m_canvas->hideRectangleSelection();
m_doc->DragP = false;
m_doc->leaveDrag = false;
m->accept();
@@ -183,7 +180,7 @@
Myp = mousePointDoc.y(); //m->globalPos().y();
SeRx = Mxp;
SeRy = Myp;
- m_view->redrawMarker->setGeometry(m->globalPos().x(), m->globalPos().y(), 1, 1);
+ m_canvas->displayRectangleSelection(m->globalPos(), m->globalPos() + QPoint(1, 1));
}
@@ -200,39 +197,32 @@
// m_view->stopDragTimer();
if (m_doc->appMode == modeMagnifier)
{
- double sc = m_canvas->scale();
- if (m_view->HaveSelRect)
+ if (m_canvas->haveRectangleSelection())
{
- QRect geom = m_view->redrawMarker->geometry().normalized();
+ 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));
- m_view->zoom(nx.x(), nx.y(), m_canvas->scale() * scaleAdjust, false);
- if (sc == m_canvas->scale())
+ m_view->zoomRelative(nx.x(), nx.y(), scaleAdjust, false);
+ m_canvas->hideRectangleSelection();
+ if (qAbs(scaleAdjust - 1) < 0.001)
{
- m_view->HaveSelRect = false;
- m_view->redrawMarker->hide();
m_view->requestMode(submodePaintingDone);
}
- m_view->redrawMarker->hide();
}
else
{
FPoint nx = mousePointDoc;
int mx = qRound(nx.x());
int my = qRound(nx.y());
- m_view->Magnify ? m_view->slotZoomIn(mx,my) : m_view->slotZoomOut(mx,my);
- if (sc == m_canvas->scale())
- {
- m_view->HaveSelRect = false;
- m_view->requestMode(submodePaintingDone);
- }
+ if (m_view->Magnify)
+ m_view->slotZoomIn(mx,my);
else
- {
- if (m->modifiers() & Qt::ShiftModifier)
- qApp->changeOverrideCursor(QCursor(loadIcon("LupeZm.xpm")));
- else
- qApp->changeOverrideCursor(QCursor(loadIcon("LupeZ.xpm")));
- }
+ m_view->slotZoomOut(mx,my);
+
+ if (m->modifiers() & Qt::ShiftModifier)
+ qApp->changeOverrideCursor(QCursor(loadIcon("LupeZm.xpm")));
+ else
+ qApp->changeOverrideCursor(QCursor(loadIcon("LupeZ.xpm")));
}
}
m_canvas->setRenderModeUseBuffer(false);
Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_nodeedit.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_nodeedit.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_nodeedit.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_nodeedit.cpp Sat Oct 29 17:32:40 2011
@@ -65,7 +65,7 @@
m_canvas->scaleAndTranslateQPainter(p);
p->translate(currItem->xPos(), currItem->yPos());
p->rotate(currItem->rotation());
- p->setPen(QPen(Qt::blue, 1 / m_canvas->m_viewMode.scale, Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
+ p->setPen(QPen(Qt::blue, m_canvas->scaledLineWidth(), Qt::SolidLine, Qt::FlatCap, Qt::MiterJoin));
p->setBrush(Qt::NoBrush);
if ((m_doc->nodeEdit.isContourLine) && (currItem->ContourLine.size() != 0))
@@ -73,8 +73,8 @@
else
cli = currItem->PoLine;
// draw curve
- const double scale = m_canvas->m_viewMode.scale;
- const double onePerScale = 1 / scale;
+ //const double scale = m_canvas->m_viewMode.scale;
+ const double onePerScale = m_canvas->scaledLineWidth();
if (cli.size() > 3)
{
for (uint poi=0; poi<cli.size()-3; poi += 4)
@@ -103,30 +103,30 @@
if (m_doc->nodeEdit.EdPoints)
{
if (m_doc->nodeEdit.ClRe == static_cast<int>(a+1))
- p->setPen(QPen(Qt::red, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
+ p->setPen(QPen(Qt::red, 8 * onePerScale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
else
- p->setPen(QPen(Qt::magenta, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
+ p->setPen(QPen(Qt::magenta, 8 * onePerScale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
cli.point(a+1, &x, &y);
p->drawPoint(QPointF(x, y));
if (m_doc->nodeEdit.ClRe == static_cast<int>(a))
- p->setPen(QPen(Qt::red, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
+ p->setPen(QPen(Qt::red, 8 * onePerScale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
else
- p->setPen(QPen(Qt::blue, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
+ p->setPen(QPen(Qt::blue, 8 * onePerScale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
cli.point(a, &x, &y);
p->drawPoint(QPointF(x, y));
}
else
{
if (m_doc->nodeEdit.ClRe == static_cast<int>(a))
- p->setPen(QPen(Qt::red, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
+ p->setPen(QPen(Qt::red, 8 * onePerScale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
else
- p->setPen(QPen(Qt::blue, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
+ p->setPen(QPen(Qt::blue, 8 * onePerScale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
cli.point(a, &x, &y);
p->drawPoint(QPointF(x, y));
if (m_doc->nodeEdit.ClRe == static_cast<int>(a+1))
- p->setPen(QPen(Qt::red, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
+ p->setPen(QPen(Qt::red, 8 * onePerScale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
else
- p->setPen(QPen(Qt::magenta, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
+ p->setPen(QPen(Qt::magenta, 8 * onePerScale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
cli.point(a+1, &x, &y);
p->drawPoint(QPointF(x, y));
}
@@ -134,7 +134,7 @@
if (m_doc->nodeEdit.ClRe != -1)
{
- p->setPen(QPen(Qt::red, 8 / scale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
+ p->setPen(QPen(Qt::red, 8 * onePerScale, Qt::SolidLine, Qt::RoundCap, Qt::MiterJoin));
cli.point(m_doc->nodeEdit.ClRe, &x, &y);
p->drawPoint(QPointF(x, y));
QList<int>::Iterator itm;
Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_normal.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_normal.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_normal.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_normal.cpp Sat Oct 29 17:32:40 2011
@@ -140,7 +140,7 @@
void CanvasMode_Normal::deactivate(bool forGesture)
{
// qDebug() << "CanvasMode_Normal::deactivate" << forGesture;
- m_view->redrawMarker->hide();
+ m_canvas->hideRectangleSelection();
}
void CanvasMode_Normal::mouseDoubleClickEvent(QMouseEvent *m)
@@ -591,10 +591,7 @@
newY = qRound(mousePointDoc.y()); //m_view->translateToDoc(m->x(), m->y()).y());
m_mouseSavedPoint.setXY(newX, newY);
QPoint startP = m_canvas->canvasToGlobal(m_mousePressPoint);
- m_view->redrawMarker->setGeometry(QRect(startP, m->globalPos()).normalized());
- if (!m_view->redrawMarker->isVisible())
- m_view->redrawMarker->show();
- m_view->HaveSelRect = true;
+ m_canvas->displayRectangleSelection(startP, m->globalPos());
return;
}
}
@@ -611,7 +608,7 @@
m_mouseSavedPoint = mousePointDoc;
m_canvas->m_viewMode.m_MouseButtonPressed = true;
m_canvas->m_viewMode.operItemMoving = false;
- m_view->HaveSelRect = false;
+ m_canvas->hideRectangleSelection();
m_doc->DragP = false;
m_doc->leaveDrag = false;
@@ -723,8 +720,7 @@
if (m_doc->m_Selection->count() == 0)
{
m_mouseCurrentPoint = m_mousePressPoint = m_mouseSavedPoint = mousePointDoc;
- m_view->redrawMarker->setGeometry(m->globalPos().x(), m->globalPos().y(), 1, 1);
- m_view->redrawMarker->show();
+ m_canvas->displayRectangleSelection(m->globalPos(), m->globalPos() + QPoint(1,1));
}
else
{
@@ -764,7 +760,7 @@
m_canvas->m_viewMode.m_MouseButtonPressed = false;
m_canvas->resetRenderMode();
m->accept();
- m_view->redrawMarker->hide();
+ m_canvas->hideRectangleSelection();
// m_view->stopDragTimer();
//m_canvas->update(); //ugly in a mouseReleaseEvent!!!!!!!
if ((!GetItem(&currItem)) && (m->button() == Qt::RightButton) && (!m_doc->DragP))
@@ -901,7 +897,8 @@
}
}
//CB Drag selection performed here
- if (((m_doc->m_Selection->count() == 0) && (m_view->HaveSelRect) && (!m_view->MidButt)) || ((shiftSelItems) && (m_view->HaveSelRect) && (!m_view->MidButt)))
+ 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();
@@ -952,9 +949,8 @@
m_view->getGroupRectScreen(&x, &y, &w, &h);
}
}
- m_view->HaveSelRect = false;
+ m_canvas->hideRectangleSelection();
shiftSelItems = false;
-// m_view->redrawMarker->hide();
m_view->updateContents();
}
if (m_doc->appMode != modeEdit)
Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_objimport.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_objimport.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_objimport.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_objimport.cpp Sat Oct 29 17:32:40 2011
@@ -114,7 +114,6 @@
// qDebug() << "CanvasMode_ObjImport::deactivate" << forGesture;
setMimeData(NULL);
setTransactionSettings(NULL);
- m_view->redrawMarker->hide();
}
void CanvasMode_ObjImport::mouseDoubleClickEvent(QMouseEvent *m)
@@ -145,7 +144,6 @@
m_canvas->PaintSizeRect(QRect());
m_canvas->m_viewMode.m_MouseButtonPressed = true;
m_canvas->m_viewMode.operItemMoving = false;
- m_view->HaveSelRect = false;
m_doc->DragP = false;
m_doc->leaveDrag = false;
// oldClip = 0;
Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_panning.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_panning.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_panning.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_panning.cpp Sat Oct 29 17:32:40 2011
@@ -75,7 +75,6 @@
void CanvasMode_Panning::deactivate(bool forGesture)
{
- m_view->redrawMarker->hide();
}
void CanvasMode_Panning::mouseDoubleClickEvent(QMouseEvent *m)
Modified: branches/Version135scrollfix/Scribus/scribus/canvasmode_rotate.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/canvasmode_rotate.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/canvasmode_rotate.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/canvasmode_rotate.cpp Sat Oct 29 17:32:40 2011
@@ -169,7 +169,7 @@
void CanvasMode_Rotate::deactivate(bool)
{
- m_view->redrawMarker->hide();
+ m_canvas->hideRectangleSelection();
m_inItemRotation = false;
}
@@ -200,7 +200,7 @@
QMatrix pm;
m_canvas->m_viewMode.m_MouseButtonPressed = true;
m_canvas->m_viewMode.operItemMoving = false;
- m_view->HaveSelRect = false;
+ m_canvas->hideRectangleSelection();
m_doc->leaveDrag = false;
m->accept();
m_view->registerMousePress(m->globalPos());
@@ -455,10 +455,7 @@
newX = qRound(mousePointDoc.x()); //m_view->translateToDoc(m->x(), m->y()).x());
newY = qRound(mousePointDoc.y()); //m_view->translateToDoc(m->x(), m->y()).y());
QPoint startP = m_canvas->canvasToGlobal(m_canvasPressCoord);
- m_view->redrawMarker->setGeometry(QRect(startP, m->globalPos()).normalized());
- if (!m_view->redrawMarker->isVisible())
- m_view->redrawMarker->show();
- m_view->HaveSelRect = true;
+ m_canvas->displayRectangleSelection(startP, m->globalPos());
return;
}
}
Modified: branches/Version135scrollfix/Scribus/scribus/scribusview.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/scribusview.cpp
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/scribusview.cpp (original)
+++ branches/Version135scrollfix/Scribus/scribus/scribusview.cpp Sat Oct 29 17:32:40 2011
@@ -142,7 +142,7 @@
oldW(-1), // oldCp(-1),
RotMode(0),
DrHY(-1), DrVX(-1),
- HaveSelRect(false),
+// HaveSelRect(false),
DraggedGroup(false),
DraggedGroupFirst(false),
MidButt(false),
@@ -295,10 +295,10 @@
// shiftSelItems = false;
// inItemCreation = false;
m_previousMode = -1;
- redrawMode = 0;
- redrawCount = 0;
- redrawMarker = new QRubberBand(QRubberBand::Rectangle);
- redrawMarker->hide();
+// redrawMode = 0;
+// redrawCount = 0;
+// redrawMarker = new QRubberBand(QRubberBand::Rectangle);
+// redrawMarker->hide();
m_canvas->newRedrawPolygon();
m_canvas->resetRenderMode();
m_ScMW->scrActions["viewFitPreview"]->setChecked(m_canvas->m_viewMode.viewAsPreview);
@@ -861,7 +861,7 @@
UndoTransaction* activeTransaction = NULL;
bool img = false;
m_canvas->resetRenderMode();
- redrawMode = 0;
+// redrawMode = 0;
// redrawMarker->hide();
// struct ScText *hg;
// uint a;
@@ -2537,7 +2537,7 @@
Doc->leaveDrag = false;
m_canvas->m_viewMode.operItemMoving = false;
MidButt = false;
- HaveSelRect = false;
+// HaveSelRect = false;
Magnify = false;
FirstPoly = true;
Doc->nodeEdit.EdPoints = true;
@@ -4994,6 +4994,7 @@
setContentsPos(horizontalScrollBar()->value() + x, verticalScrollBar()->value() + y);
}
+
void ScribusView::zoom(double scale)
{
double zPointX = oldX, zPointY = oldY;
@@ -5007,6 +5008,13 @@
}
zoom( qRound(zPointX), qRound(zPointY), scale, false);
}
+
+
+void ScribusView::zoomRelative(int canvasX, int canvasY, double scaleR, bool preservePoint)
+{
+ zoom(canvasX, canvasY, scaleR * m_canvas->scale(), preservePoint);
+}
+
void ScribusView::zoom(int canvasX, int canvasY, double scale, bool preservePoint)
{
Modified: branches/Version135scrollfix/Scribus/scribus/scribusview.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=16942&path=/branches/Version135scrollfix/Scribus/scribus/scribusview.h
==============================================================================
--- branches/Version135scrollfix/Scribus/scribus/scribusview.h (original)
+++ branches/Version135scrollfix/Scribus/scribus/scribusview.h Sat Oct 29 17:32:40 2011
@@ -146,7 +146,6 @@
int RotMode;
int DrHY;
int DrVX;
- bool HaveSelRect;
//bool GroupSel;
bool DraggedGroup;
bool DraggedGroupFirst;
@@ -156,10 +155,9 @@
bool Magnify;
bool storedFramesShown;
bool storedShowControls;
- int redrawMode;
- int redrawCount;
- PageItem *redrawItem;
- QRubberBand *redrawMarker;
+// int redrawMode;
+// int redrawCount;
+// PageItem *redrawItem;
FPoint RCenter;
void updatesOn(bool on);
//CB This MUST now be called AFTER a call to doc->addPage or doc->addMasterPage as it
@@ -266,6 +264,7 @@
void stopAllDrags();
void scrollBy(int x, int y);
void zoom(double scale = 0.0);
+ void zoomRelative(int canvasX, int canvasY, double scaleR, bool preservePoint);
void zoom(int canvasX, int canvasY, double scale, bool preservePoint);
public slots: // Public slots
More information about the scribus-commit
mailing list