r23031 by jghali - #15718: Text layout not updated when flow around shape stop overlapping text frame
scribus-commit
scribus-commit at lists.scribus.net
Wed Jun 19 19:53:24 UTC 2019
Author: jghali
Date: Wed Jun 19 19:53:24 2019
New Revision: 23031
URL: http://scribus.net/websvn/listing.php?repname=Scribus&sc=1&rev=23031
Log:
#15718: Text layout not updated when flow around shape stop overlapping text frame
Modified:
trunk/Scribus/scribus/pageitem.cpp
trunk/Scribus/scribus/pageitem.h
trunk/Scribus/scribus/pageitem_line.cpp
trunk/Scribus/scribus/pageitem_line.h
trunk/Scribus/scribus/pageitem_polyline.cpp
trunk/Scribus/scribus/pageitem_polyline.h
trunk/Scribus/scribus/pageitem_spiral.cpp
trunk/Scribus/scribus/pageitem_spiral.h
trunk/Scribus/scribus/scribusdoc.cpp
Modified: trunk/Scribus/scribus/pageitem.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23031&path=/trunk/Scribus/scribus/pageitem.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem.cpp (original)
+++ trunk/Scribus/scribus/pageitem.cpp Wed Jun 19 19:53:24 2019
@@ -248,7 +248,7 @@
m_annotation(other.m_annotation),
m_imageVisible(other.m_imageVisible),
m_lineWidth(other.m_lineWidth),
- Oldm_lineWidth(other.Oldm_lineWidth),
+ m_oldLineWidth(other.m_oldLineWidth),
patternStrokeVal(other.patternStrokeVal),
patternStrokeScaleX(other.patternStrokeScaleX),
patternStrokeScaleY(other.patternStrokeScaleY),
@@ -505,7 +505,7 @@
patternStrokeMirrorY = false;
patternStrokePath = false;
m_lineWidth = w2;
- Oldm_lineWidth = w2;
+ m_oldLineWidth = w2;
PLineArt = Qt::PenStyle(m_Doc->itemToolPrefs().shapeLineStyle);
PLineEnd = Qt::FlatCap;
PLineJoin = Qt::MiterJoin;
@@ -4073,7 +4073,7 @@
ss->set("NEW_LINEWIDTH", newWidth);
undoManager->action(this, ss);
}
- Oldm_lineWidth=m_lineWidth;
+ m_oldLineWidth=m_lineWidth;
m_lineWidth = newWidth;
}
@@ -4537,42 +4537,29 @@
void PageItem::checkTextFlowInteractions(bool allItems)
{
- if (!m_Doc->isLoading())
- {
- QRectF baseRect(getBoundingRect());
- QList<PageItem*>* items = OnMasterPage.isEmpty() ? &m_Doc->DocItems : &m_Doc->MasterItems;
- if (!allItems)
- {
- int ids = items->indexOf(this) - 1;
- for (int idx = ids; idx >= 0 ; --idx)
- {
- if (items->at(idx)->asTextFrame()) // do not bother with no text frames
- {
- QRectF uRect(items->at(idx)->getBoundingRect());
- if (baseRect.intersects(uRect))
- {
- items->at(idx)->update();
- }
- }
- }
- }
- else
- {
- for (int idx = items->count() - 1; idx >= 0 ; --idx)
- {
- if (items->at(idx) != this) // avoids itself
- {
- if (items->at(idx)->asTextFrame()) // do not bother with no text frames
- {
- QRectF uRect(items->at(idx)->getBoundingRect());
- if (baseRect.intersects(uRect))
- {
- items->at(idx)->update();
- }
- }
- }
- }
- }
+ if (m_Doc->isLoading())
+ return;
+
+ QRectF baseRect(getBoundingRect());
+ checkTextFlowInteractions(baseRect, allItems);
+}
+
+void PageItem::checkTextFlowInteractions(const QRectF& baseRect, bool allItems)
+{
+ if (m_Doc->isLoading())
+ return;
+
+ QList<PageItem*>* items = OnMasterPage.isEmpty() ? &m_Doc->DocItems : &m_Doc->MasterItems;
+
+ int ids = allItems ? items->count() : items->indexOf(this);
+ for (int idx = ids - 1; idx >= 0 ; --idx)
+ {
+ PageItem* item = items->at(idx);
+ if (!item->isTextFrame() || (item == this)) // do not bother with no text frames
+ continue;
+ QRectF uRect(item->getBoundingRect());
+ if (baseRect.intersects(uRect))
+ item->update();
}
}
@@ -4670,23 +4657,35 @@
if (m_Doc->view() == nullptr)
return;
bool spreadChanges(false);
+
+ QRectF textFlowCheckRect;
+ if (force || ((textFlowMode() != TextFlowDisabled) && shouldCheck()))
+ {
+ if ((oldXpos != m_xPos || oldYpos != m_yPos) ||
+ (oldWidth != m_width || oldHeight != m_height) ||
+ (oldRot != m_rotation))
+ {
+ textFlowCheckRect = getOldBoundingRect();
+ }
+ }
+
// has the item been resized
if (force || ((oldWidth != m_width || oldHeight != m_height) && shouldCheck()))
{
resizeUndoAction();
- spreadChanges = (textFlowMode() != TextFlowDisabled );
+ spreadChanges = (textFlowMode() != TextFlowDisabled);
}
// has the item been rotated
if (force || ((oldRot != m_rotation) && (shouldCheck())))
{
rotateUndoAction();
- spreadChanges = (textFlowMode() != TextFlowDisabled );
+ spreadChanges = (textFlowMode() != TextFlowDisabled);
}
// has the item been moved
if (force || ((oldXpos != m_xPos || oldYpos != m_yPos) && shouldCheck()))
{
moveUndoAction();
- spreadChanges = (textFlowMode() != TextFlowDisabled );
+ spreadChanges = (textFlowMode() != TextFlowDisabled);
}
// has the item's image been moved
if (force || ((oldLocalX != m_imageXOffset || oldLocalY != m_imageYOffset) && shouldCheck()))
@@ -4697,7 +4696,8 @@
if (spreadChanges)
{
- checkTextFlowInteractions();
+ textFlowCheckRect = textFlowCheckRect.united(getBoundingRect());
+ checkTextFlowInteractions(textFlowCheckRect);
}
}
@@ -8945,6 +8945,13 @@
return ret;
}
+QRectF PageItem::getOldBoundingRect() const
+{
+ double x,y,x2,y2;
+ getOldBoundingRect(&x, &y, &x2, &y2);
+ return QRectF(x, y, x2 - x, y2 - y);
+}
+
QRectF PageItem::getVisualBoundingRect() const
{
double x,y,x2,y2;
@@ -8984,6 +8991,41 @@
*y1 = m_yPos;
*x2 = m_xPos + qMax(1.0, qMax(m_width, m_lineWidth));
*y2 = m_yPos + qMax(1.0, qMax(m_height, m_lineWidth));
+ }
+}
+
+void PageItem::getOldBoundingRect(double *x1, double *y1, double *x2, double *y2) const
+{
+ double minx = std::numeric_limits<double>::max();
+ double miny = std::numeric_limits<double>::max();
+ double maxx = -std::numeric_limits<double>::max();
+ double maxy = -std::numeric_limits<double>::max();
+ if (oldRot != 0)
+ {
+ FPointArray pb;
+ pb.resize(0);
+ pb.addPoint(FPoint(oldXpos, oldYpos));
+ pb.addPoint(FPoint(oldWidth, 0.0, oldXpos, oldYpos, oldRot, 1.0, 1.0));
+ pb.addPoint(FPoint(oldWidth, oldHeight, oldXpos, oldYpos, oldRot, 1.0, 1.0));
+ pb.addPoint(FPoint( 0.0, oldHeight, oldXpos, oldYpos, oldRot, 1.0, 1.0));
+ for (uint pc = 0; pc < 4; ++pc)
+ {
+ minx = qMin(minx, pb.point(pc).x());
+ miny = qMin(miny, pb.point(pc).y());
+ maxx = qMax(maxx, pb.point(pc).x());
+ maxy = qMax(maxy, pb.point(pc).y());
+ }
+ *x1 = minx;
+ *y1 = miny;
+ *x2 = maxx;
+ *y2 = maxy;
+ }
+ else
+ {
+ *x1 = oldXpos;
+ *y1 = oldYpos;
+ *x2 = oldXpos + qMax(1.0, qMax(oldWidth, m_lineWidth));
+ *y2 = oldYpos + qMax(1.0, qMax(oldHeight, m_lineWidth));
}
}
@@ -9250,6 +9292,174 @@
}
}
return extraSpace;
+}
+
+QRectF PageItem::getStartArrowBoundingRect() const
+{
+ QRectF arrowRect;
+ if (m_startArrowIndex != 0 && !PoLine.empty())
+ {
+ QTransform arrowTrans;
+ FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex - 1).points.copy();
+ arrowTrans.translate(m_xPos, m_yPos);
+ arrowTrans.rotate(m_rotation);
+ const FPoint& Start = PoLine.point(0);
+ for (int xx = 1; xx < PoLine.size(); xx += 2)
+ {
+ const FPoint& Vector = PoLine.point(xx);
+ if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
+ {
+ arrowTrans.translate(Start.x(), Start.y());
+ arrowTrans.rotate(atan2(Start.y() - Vector.y(), Start.x() - Vector.x()) * (180.0 / M_PI));
+ arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
+ if (NamedLStyle.isEmpty())
+ {
+ if (m_lineWidth != 0.0)
+ arrowTrans.scale(m_lineWidth, m_lineWidth);
+ }
+ else
+ {
+ const multiLine ml = m_Doc->MLineStyles[NamedLStyle];
+ const SingleLine& sl = ml.last();
+ if (sl.Width != 0.0)
+ arrowTrans.scale(sl.Width, sl.Width);
+ }
+ arrow.map(arrowTrans);
+ break;
+ }
+ }
+ FPoint minAr = getMinClipF(&arrow);
+ FPoint maxAr = getMaxClipF(&arrow);
+ arrowRect = QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y()));
+ }
+
+ return arrowRect;
+}
+
+QRectF PageItem::getStartArrowOldBoundingRect() const
+{
+ QRectF arrowRect;
+ if (m_startArrowIndex != 0 && !PoLine.empty())
+ {
+ QTransform arrowTrans;
+ FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex - 1).points.copy();
+ arrowTrans.translate(oldXpos, oldYpos);
+ arrowTrans.rotate(oldRot);
+ FPoint Start = PoLine.point(0);
+ for (int xx = 1; xx < PoLine.size(); xx += 2)
+ {
+ FPoint Vector = PoLine.point(xx);
+ if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
+ {
+ arrowTrans.translate(Start.x(), Start.y());
+ arrowTrans.rotate(atan2(Start.y() - Vector.y(), Start.x() - Vector.x()) * (180.0 / M_PI));
+ arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
+ if (NamedLStyle.isEmpty())
+ {
+ if (m_oldLineWidth != 0.0)
+ arrowTrans.scale(m_oldLineWidth, m_oldLineWidth);
+ }
+ else
+ {
+ const multiLine ml = m_Doc->MLineStyles[NamedLStyle];
+ const SingleLine& sl = ml.last();
+ if (sl.Width != 0.0)
+ arrowTrans.scale(sl.Width, sl.Width);
+ }
+ arrow.map(arrowTrans);
+ break;
+ }
+ }
+ FPoint minAr = getMinClipF(&arrow);
+ FPoint maxAr = getMaxClipF(&arrow);
+ arrowRect = QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y()));
+ }
+
+ return arrowRect;
+}
+
+QRectF PageItem::getEndArrowBoundingRect() const
+{
+ QRectF arrowRect;
+ if (m_endArrowIndex != 0 && PoLine.size() >= 2)
+ {
+ QTransform arrowTrans;
+ FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex - 1).points.copy();
+ arrowTrans.translate(m_xPos, m_yPos);
+ arrowTrans.rotate(m_rotation);
+ FPoint End = PoLine.point(PoLine.size() - 2);
+ for (uint xx = PoLine.size() - 1; xx > 0; xx -= 2)
+ {
+ FPoint Vector = PoLine.point(xx);
+ if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
+ {
+ arrowTrans.translate(End.x(), End.y());
+ arrowTrans.rotate(atan2(End.y() - Vector.y(), End.x() - Vector.x()) * (180.0 / M_PI));
+ arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
+ if (NamedLStyle.isEmpty())
+ {
+ if (m_lineWidth != 0.0)
+ arrowTrans.scale(m_lineWidth, m_lineWidth);
+ }
+ else
+ {
+ const multiLine ml = m_Doc->MLineStyles[NamedLStyle];
+ const SingleLine& sl = ml.last();
+ if (sl.Width != 0.0)
+ arrowTrans.scale(sl.Width, sl.Width);
+ }
+ arrow.map(arrowTrans);
+ break;
+ }
+ }
+ FPoint minAr = getMinClipF(&arrow);
+ FPoint maxAr = getMaxClipF(&arrow);
+ arrowRect = QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y()));
+ }
+
+ return arrowRect;
+}
+
+QRectF PageItem::getEndArrowOldBoundingRect() const
+{
+ QRectF arrowRect;
+ if (m_endArrowIndex != 0 && PoLine.size() >= 2)
+ {
+ QTransform arrowTrans;
+ FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex - 1).points.copy();
+ arrowTrans.translate(oldXpos, oldYpos);
+ arrowTrans.rotate(oldRot);
+ FPoint End = PoLine.point(PoLine.size() - 2);
+ for (uint xx = PoLine.size()-1; xx > 0; xx -= 2)
+ {
+ FPoint Vector = PoLine.point(xx);
+ if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
+ {
+ arrowTrans.translate(End.x(), End.y());
+ arrowTrans.rotate(atan2(End.y() - Vector.y(), End.x() - Vector.x()) * (180.0 / M_PI));
+ arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
+ if (NamedLStyle.isEmpty())
+ {
+ if (m_oldLineWidth != 0.0)
+ arrowTrans.scale(m_oldLineWidth, m_oldLineWidth);
+ }
+ else
+ {
+ const multiLine ml = m_Doc->MLineStyles[NamedLStyle];
+ const SingleLine& sl = ml.last();
+ if (sl.Width != 0.0)
+ arrowTrans.scale(sl.Width, sl.Width);
+ }
+ arrow.map(arrowTrans);
+ break;
+ }
+ }
+ FPoint minAr = getMinClipF(&arrow);
+ FPoint maxAr = getMaxClipF(&arrow);
+ arrowRect = QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y()));
+ }
+
+ return arrowRect;
}
bool PageItem::pointWithinItem(int x, const int y) const
@@ -9891,10 +10101,10 @@
QRect PageItem::getRedrawBounding(double viewScale) const
{
- int x = qRound(floor(BoundingX - Oldm_lineWidth / 2.0 - 5) * viewScale);
- int y = qRound(floor(BoundingY - Oldm_lineWidth / 2.0 - 5) * viewScale);
- int w = qRound(ceil(BoundingW + Oldm_lineWidth + 10) * viewScale);
- int h = qRound(ceil(BoundingH + Oldm_lineWidth + 10) * viewScale);
+ int x = qRound(floor(BoundingX - m_oldLineWidth / 2.0 - 5) * viewScale);
+ int y = qRound(floor(BoundingY - m_oldLineWidth / 2.0 - 5) * viewScale);
+ int w = qRound(ceil(BoundingW + m_oldLineWidth + 10) * viewScale);
+ int h = qRound(ceil(BoundingH + m_oldLineWidth + 10) * viewScale);
QRect ret = QRect(0, 0, w - x, h - y);
QTransform t = getTransform();
ret = t.mapRect(ret);
Modified: trunk/Scribus/scribus/pageitem.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23031&path=/trunk/Scribus/scribus/pageitem.h
==============================================================================
--- trunk/Scribus/scribus/pageitem.h (original)
+++ trunk/Scribus/scribus/pageitem.h Wed Jun 19 19:53:24 2019
@@ -302,10 +302,18 @@
QRectF getBoundingRect() const;
QRectF getCurrentBoundingRect(double moreSpace = 0.0) const;
+ QRectF getOldBoundingRect() const;
QRectF getVisualBoundingRect() const;
virtual void getBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
+ virtual void getOldBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
virtual void getVisualBoundingRect(double *x1, double *y1, double *x2, double *y2) const;
+
+ virtual QRectF getStartArrowBoundingRect() const;
+ virtual QRectF getStartArrowOldBoundingRect() const;
+
+ virtual QRectF getEndArrowBoundingRect() const;
+ virtual QRectF getEndArrowOldBoundingRect() const;
//>> ********* Functions related to drawing the item *********
@@ -1096,6 +1104,13 @@
* @param allItems While you generally want to check for items below, it can happen that you want to update full range of text frames (e.g. when shuffle items order). Default to false.
*/
void checkTextFlowInteractions(bool allItems = false);
+
+ /**
+ * @brief To be called carefully because it eventually triggers a relayout of long text frames strings, but necessarily when you change the document.
+ * @param baseRect The area over which text flow interactions should be checked
+ * @param allItems While you generally want to check for items below, it can happen that you want to update full range of text frames (e.g. when shuffle items order). Default to false.
+ */
+ void checkTextFlowInteractions(const QRectF& baseRect, bool allItems = false);
/** @brief Get the frame type
*
@@ -1412,7 +1427,7 @@
bool m_imageVisible; ///< Darstellungsart Bild/Titel
double m_lineWidth; //< Line width
- double Oldm_lineWidth;
+ double m_oldLineWidth;
/**
* @brief Stroke pattern name
Modified: trunk/Scribus/scribus/pageitem_line.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23031&path=/trunk/Scribus/scribus/pageitem_line.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_line.cpp (original)
+++ trunk/Scribus/scribus/pageitem_line.cpp Wed Jun 19 19:53:24 2019
@@ -184,10 +184,10 @@
{
FPointArray pb;
pb.resize(0);
- pb.addPoint(FPoint(0, -m_lineWidth / 2.0, m_xPos, m_yPos, m_rotation, 1.0, 1.0));
- pb.addPoint(FPoint(m_width, -m_lineWidth / 2.0, m_xPos, m_yPos, m_rotation, 1.0, 1.0));
- pb.addPoint(FPoint(m_width, +m_lineWidth / 2.0, m_xPos, m_yPos, m_rotation, 1.0, 1.0));
- pb.addPoint(FPoint(0, +m_lineWidth / 2.0, m_xPos, m_yPos, m_rotation, 1.0, 1.0));
+ pb.addPoint(FPoint(0, - m_lineWidth / 2.0, m_xPos, m_yPos, m_rotation, 1.0, 1.0));
+ pb.addPoint(FPoint(m_width, - m_lineWidth / 2.0, m_xPos, m_yPos, m_rotation, 1.0, 1.0));
+ pb.addPoint(FPoint(m_width, + m_lineWidth / 2.0, m_xPos, m_yPos, m_rotation, 1.0, 1.0));
+ pb.addPoint(FPoint(0, + m_lineWidth / 2.0, m_xPos, m_yPos, m_rotation, 1.0, 1.0));
for (uint pc = 0; pc < 4; ++pc)
{
minx = qMin(minx, pb.point(pc).x());
@@ -211,52 +211,61 @@
QRectF totalRect = QRectF(QPointF(*x1, *y1), QPointF(*x2, *y2));
if (m_startArrowIndex != 0)
{
- QTransform arrowTrans;
- FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex-1).points.copy();
- arrowTrans.translate(m_xPos, m_yPos);
- arrowTrans.rotate(m_rotation);
- arrowTrans.translate(0, 0);
- arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
- if (NamedLStyle.isEmpty())
- {
- if (m_lineWidth != 0.0)
- arrowTrans.scale(m_lineWidth, m_lineWidth);
- }
- else
- {
- multiLine ml = m_Doc->MLineStyles[NamedLStyle];
- if (ml[ml.size()-1].Width != 0.0)
- arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
- }
- arrowTrans.scale(-1,1);
- arrow.map(arrowTrans);
- FPoint minAr = getMinClipF(&arrow);
- FPoint maxAr = getMaxClipF(&arrow);
- totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
- }
- if (m_endArrowIndex != 0)
- {
- QTransform arrowTrans;
- FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex-1).points.copy();
- arrowTrans.translate(m_xPos, m_yPos);
- arrowTrans.rotate(m_rotation);
- arrowTrans.translate(m_width, 0);
- arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
- if (NamedLStyle.isEmpty())
- {
- if (m_lineWidth != 0.0)
- arrowTrans.scale(m_lineWidth, m_lineWidth);
- }
- else
- {
- multiLine ml = m_Doc->MLineStyles[NamedLStyle];
- if (ml[ml.size()-1].Width != 0.0)
- arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
- }
- arrow.map(arrowTrans);
- FPoint minAr = getMinClipF(&arrow);
- FPoint maxAr = getMaxClipF(&arrow);
- totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
+ QRectF arrowRect = getStartArrowBoundingRect();
+ totalRect = totalRect.united(arrowRect);
+ }
+ if (m_endArrowIndex != 0)
+ {
+ QRectF arrowRect = getEndArrowBoundingRect();
+ totalRect = totalRect.united(arrowRect);
+ }
+ totalRect.getCoords(x1, y1, x2, y2);
+}
+
+void PageItem_Line::getOldBoundingRect(double *x1, double *y1, double *x2, double *y2) const
+{
+ double minx = std::numeric_limits<double>::max();
+ double miny = std::numeric_limits<double>::max();
+ double maxx = -std::numeric_limits<double>::max();
+ double maxy = -std::numeric_limits<double>::max();
+ if (oldRot != 0)
+ {
+ FPointArray pb;
+ pb.resize(0);
+ pb.addPoint(FPoint(0, - m_oldLineWidth / 2.0, oldXpos, oldYpos, oldRot, 1.0, 1.0));
+ pb.addPoint(FPoint(oldWidth, - m_oldLineWidth / 2.0, oldXpos, oldYpos, oldRot, 1.0, 1.0));
+ pb.addPoint(FPoint(oldWidth, + m_oldLineWidth / 2.0, oldXpos, oldYpos, oldRot, 1.0, 1.0));
+ pb.addPoint(FPoint(0, + m_oldLineWidth / 2.0, oldXpos, oldYpos, oldRot, 1.0, 1.0));
+ for (uint pc = 0; pc < 4; ++pc)
+ {
+ minx = qMin(minx, pb.point(pc).x());
+ miny = qMin(miny, pb.point(pc).y());
+ maxx = qMax(maxx, pb.point(pc).x());
+ maxy = qMax(maxy, pb.point(pc).y());
+ }
+ *x1 = minx;
+ *y1 = miny;
+ *x2 = maxx;
+ *y2 = maxy;
+ }
+ else
+ {
+ *x1 = oldXpos;
+ *y1 = oldYpos - qMax(1.0, m_oldLineWidth) / 2.0;
+ *x2 = oldXpos + oldWidth;
+ *y2 = oldYpos + qMax(1.0, m_oldLineWidth) / 2.0;
+ }
+
+ QRectF totalRect = QRectF(QPointF(*x1, *y1), QPointF(*x2, *y2));
+ if (m_startArrowIndex != 0)
+ {
+ QRectF arrowRect = getStartArrowOldBoundingRect();
+ totalRect = totalRect.united(arrowRect);
+ }
+ if (m_endArrowIndex != 0)
+ {
+ QRectF arrowRect = getEndArrowOldBoundingRect();
+ totalRect = totalRect.united(arrowRect);
}
totalRect.getCoords(x1, y1, x2, y2);
}
@@ -329,8 +338,24 @@
QRectF totalRect(QPointF(*x1, *y1), QPointF(*x2, *y2));
if (m_startArrowIndex != 0)
{
- QTransform arrowTrans;
- FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex-1).points.copy();
+ QRectF arrowRect = getStartArrowBoundingRect();
+ totalRect = totalRect.united(arrowRect);
+ }
+ if (m_endArrowIndex != 0)
+ {
+ QRectF arrowRect = getEndArrowBoundingRect();
+ totalRect = totalRect.united(arrowRect);
+ }
+ totalRect.getCoords(x1, y1, x2, y2);
+}
+
+QRectF PageItem_Line::getStartArrowBoundingRect() const
+{
+ QRectF arrowRect;
+ if (m_startArrowIndex != 0)
+ {
+ QTransform arrowTrans;
+ FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex - 1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
arrowTrans.translate(0, 0);
@@ -342,20 +367,61 @@
}
else
{
- multiLine ml = m_Doc->MLineStyles[NamedLStyle];
- if (ml[ml.size()-1].Width != 0.0)
- arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
- }
- arrowTrans.scale(-1,1);
+ const multiLine ml = m_Doc->MLineStyles[NamedLStyle];
+ const SingleLine& sl = ml.last();
+ if (sl.Width != 0.0)
+ arrowTrans.scale(sl.Width, sl.Width);
+ }
+ arrowTrans.scale(-1, 1);
arrow.map(arrowTrans);
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
- totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
- }
- if (m_endArrowIndex != 0)
- {
- QTransform arrowTrans;
- FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex-1).points.copy();
+ arrowRect = QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y()));
+ }
+
+ return arrowRect;
+}
+
+QRectF PageItem_Line::getStartArrowOldBoundingRect() const
+{
+ QRectF arrowRect;
+ if (m_startArrowIndex != 0)
+ {
+ QTransform arrowTrans;
+ FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex - 1).points.copy();
+ arrowTrans.translate(oldXpos, oldYpos);
+ arrowTrans.rotate(oldRot);
+ arrowTrans.translate(0, 0);
+ arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
+ if (NamedLStyle.isEmpty())
+ {
+ if (m_oldLineWidth != 0.0)
+ arrowTrans.scale(m_oldLineWidth, m_oldLineWidth);
+ }
+ else
+ {
+ const multiLine ml = m_Doc->MLineStyles[NamedLStyle];
+ const SingleLine& sl = ml.last();
+ if (sl.Width != 0.0)
+ arrowTrans.scale(sl.Width, sl.Width);
+ }
+ arrowTrans.scale(-1, 1);
+ arrow.map(arrowTrans);
+ FPoint minAr = getMinClipF(&arrow);
+ FPoint maxAr = getMaxClipF(&arrow);
+ arrowRect = QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y()));
+ }
+
+ return arrowRect;
+}
+
+QRectF PageItem_Line::getEndArrowBoundingRect() const
+{
+ QRectF arrowRect;
+ if (m_endArrowIndex != 0)
+ {
+ QTransform arrowTrans;
+ FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex - 1).points.copy();
arrowTrans.translate(m_xPos, m_yPos);
arrowTrans.rotate(m_rotation);
arrowTrans.translate(m_width, 0);
@@ -367,14 +433,48 @@
}
else
{
- multiLine ml = m_Doc->MLineStyles[NamedLStyle];
- if (ml[ml.size()-1].Width != 0.0)
- arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
+ const multiLine ml = m_Doc->MLineStyles[NamedLStyle];
+ const SingleLine& sl = ml.last();
+ if (sl.Width != 0.0)
+ arrowTrans.scale(sl.Width, sl.Width);
}
arrow.map(arrowTrans);
FPoint minAr = getMinClipF(&arrow);
FPoint maxAr = getMaxClipF(&arrow);
- totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
- }
- totalRect.getCoords(x1, y1, x2, y2);
-}
+ arrowRect = QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y()));
+ }
+
+ return arrowRect;
+}
+
+QRectF PageItem_Line::getEndArrowOldBoundingRect() const
+{
+ QRectF arrowRect;
+ if (m_endArrowIndex != 0)
+ {
+ QTransform arrowTrans;
+ FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex - 1).points.copy();
+ arrowTrans.translate(oldXpos, oldYpos);
+ arrowTrans.rotate(oldRot);
+ arrowTrans.translate(oldWidth, 0);
+ arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
+ if (NamedLStyle.isEmpty())
+ {
+ if (m_oldLineWidth != 0.0)
+ arrowTrans.scale(m_oldLineWidth, m_oldLineWidth);
+ }
+ else
+ {
+ const multiLine ml = m_Doc->MLineStyles[NamedLStyle];
+ const SingleLine& sl = ml.last();
+ if (sl.Width != 0.0)
+ arrowTrans.scale(sl.Width, sl.Width);
+ }
+ arrow.map(arrowTrans);
+ FPoint minAr = getMinClipF(&arrow);
+ FPoint maxAr = getMaxClipF(&arrow);
+ arrowRect = QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y()));
+ }
+
+ return arrowRect;
+}
Modified: trunk/Scribus/scribus/pageitem_line.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23031&path=/trunk/Scribus/scribus/pageitem_line.h
==============================================================================
--- trunk/Scribus/scribus/pageitem_line.h (original)
+++ trunk/Scribus/scribus/pageitem_line.h Wed Jun 19 19:53:24 2019
@@ -50,7 +50,14 @@
QPointF endPoint();
void getBoundingRect(double *x1, double *y1, double *x2, double *y2) const override;
+ void getOldBoundingRect(double *x1, double *y1, double *x2, double *y2) const override;
void getVisualBoundingRect(double *x1, double *y1, double *x2, double *y2) const override;
+
+ QRectF getStartArrowBoundingRect() const override;
+ QRectF getStartArrowOldBoundingRect() const override;
+
+ QRectF getEndArrowBoundingRect() const override;
+ QRectF getEndArrowOldBoundingRect() const override;
protected:
void DrawObj_Item(ScPainter *p, QRectF e) override;
Modified: trunk/Scribus/scribus/pageitem_polyline.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23031&path=/trunk/Scribus/scribus/pageitem_polyline.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_polyline.cpp (original)
+++ trunk/Scribus/scribus/pageitem_polyline.cpp Wed Jun 19 19:53:24 2019
@@ -221,149 +221,53 @@
void PageItem_PolyLine::getBoundingRect(double *x1, double *y1, double *x2, double *y2) const
{
PageItem::getBoundingRect(x1, y1, x2, y2);
+
QRectF totalRect = QRectF(QPointF(*x1, *y1), QPointF(*x2, *y2));
if (m_startArrowIndex != 0 && !PoLine.empty())
{
- QTransform arrowTrans;
- FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex-1).points.copy();
- arrowTrans.translate(m_xPos, m_yPos);
- arrowTrans.rotate(m_rotation);
- FPoint Start = PoLine.point(0);
- for (int xx = 1; xx < PoLine.size(); xx += 2)
- {
- FPoint Vector = PoLine.point(xx);
- if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
- {
- arrowTrans.translate(Start.x(), Start.y());
- arrowTrans.rotate(atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI));
- arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
- if (NamedLStyle.isEmpty())
- {
- if (m_lineWidth != 0.0)
- arrowTrans.scale(m_lineWidth, m_lineWidth);
- }
- else
- {
- multiLine ml = m_Doc->MLineStyles[NamedLStyle];
- if (ml[ml.size()-1].Width != 0.0)
- arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
- }
- arrow.map(arrowTrans);
- break;
- }
- }
- FPoint minAr = getMinClipF(&arrow);
- FPoint maxAr = getMaxClipF(&arrow);
- totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
+ QRectF arrowRect = getStartArrowBoundingRect();
+ totalRect = totalRect.united(arrowRect);
}
if (m_endArrowIndex != 0 && PoLine.size() >= 2)
{
- QTransform arrowTrans;
- FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex-1).points.copy();
- arrowTrans.translate(m_xPos, m_yPos);
- arrowTrans.rotate(m_rotation);
- FPoint End = PoLine.point(PoLine.size()-2);
- for (uint xx = PoLine.size()-1; xx > 0; xx -= 2)
- {
- FPoint Vector = PoLine.point(xx);
- if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
- {
- arrowTrans.translate(End.x(), End.y());
- arrowTrans.rotate(atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI));
- arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
- if (NamedLStyle.isEmpty())
- {
- if (m_lineWidth != 0.0)
- arrowTrans.scale(m_lineWidth, m_lineWidth);
- }
- else
- {
- multiLine ml = m_Doc->MLineStyles[NamedLStyle];
- if (ml[ml.size()-1].Width != 0.0)
- arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
- }
- arrow.map(arrowTrans);
- break;
- }
- }
- FPoint minAr = getMinClipF(&arrow);
- FPoint maxAr = getMaxClipF(&arrow);
- totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
+ QRectF arrowRect = getEndArrowBoundingRect();
+ totalRect = totalRect.united(arrowRect);
}
totalRect.getCoords(x1, y1, x2, y2);
}
+void PageItem_PolyLine::getOldBoundingRect(double *x1, double *y1, double *x2, double *y2) const
+{
+ PageItem::getOldBoundingRect(x1, y1, x2, y2);
+
+ QRectF totalRect = QRectF(QPointF(*x1, *y1), QPointF(*x2, *y2));
+ if (m_startArrowIndex != 0 && !PoLine.empty())
+ {
+ QRectF arrowRect = getStartArrowOldBoundingRect();
+ totalRect = totalRect.united(arrowRect);
+ }
+ if (m_endArrowIndex != 0 && PoLine.size() >= 2)
+ {
+ QRectF arrowRect = getEndArrowOldBoundingRect();
+ totalRect = totalRect.united(arrowRect);
+ }
+ totalRect.getCoords(x1, y1, x2, y2);
+}
+
void PageItem_PolyLine::getVisualBoundingRect(double * x1, double * y1, double * x2, double * y2) const
{
PageItem::getVisualBoundingRect(x1, y1, x2, y2);
+
QRectF totalRect(QPointF(*x1, *y1), QPointF(*x2, *y2));
if (m_startArrowIndex != 0 && !PoLine.empty())
{
- QTransform arrowTrans;
- FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex-1).points.copy();
- arrowTrans.translate(m_xPos, m_yPos);
- arrowTrans.rotate(m_rotation);
- FPoint Start = PoLine.point(0);
- for (int xx = 1; xx < PoLine.size(); xx += 2)
- {
- FPoint Vector = PoLine.point(xx);
- if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
- {
- arrowTrans.translate(Start.x(), Start.y());
- arrowTrans.rotate(atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI));
- arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
- if (NamedLStyle.isEmpty())
- {
- if (m_lineWidth != 0.0)
- arrowTrans.scale(m_lineWidth, m_lineWidth);
- }
- else
- {
- multiLine ml = m_Doc->MLineStyles[NamedLStyle];
- if (ml[ml.size()-1].Width != 0.0)
- arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
- }
- arrow.map(arrowTrans);
- break;
- }
- }
- FPoint minAr = getMinClipF(&arrow);
- FPoint maxAr = getMaxClipF(&arrow);
- totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
+ QRectF arrowRect = getStartArrowBoundingRect();
+ totalRect = totalRect.united(arrowRect);
}
if (m_endArrowIndex != 0 && PoLine.size() >= 2)
{
- QTransform arrowTrans;
- FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex-1).points.copy();
- arrowTrans.translate(m_xPos, m_yPos);
- arrowTrans.rotate(m_rotation);
- FPoint End = PoLine.point(PoLine.size()-2);
- for (uint xx = PoLine.size()-1; xx > 0; xx -= 2)
- {
- FPoint Vector = PoLine.point(xx);
- if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
- {
- arrowTrans.translate(End.x(), End.y());
- arrowTrans.rotate(atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI));
- arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
- if (NamedLStyle.isEmpty())
- {
- if (m_lineWidth != 0.0)
- arrowTrans.scale(m_lineWidth, m_lineWidth);
- }
- else
- {
- multiLine ml = m_Doc->MLineStyles[NamedLStyle];
- if (ml[ml.size()-1].Width != 0.0)
- arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
- }
- arrow.map(arrowTrans);
- break;
- }
- }
- FPoint minAr = getMinClipF(&arrow);
- FPoint maxAr = getMaxClipF(&arrow);
- totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
+ QRectF arrowRect = getEndArrowBoundingRect();
+ totalRect = totalRect.united(arrowRect);
}
totalRect.getCoords(x1, y1, x2, y2);
}
Modified: trunk/Scribus/scribus/pageitem_polyline.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23031&path=/trunk/Scribus/scribus/pageitem_polyline.h
==============================================================================
--- trunk/Scribus/scribus/pageitem_polyline.h (original)
+++ trunk/Scribus/scribus/pageitem_polyline.h Wed Jun 19 19:53:24 2019
@@ -46,6 +46,7 @@
QString infoDescription() const override;
void getBoundingRect(double *x1, double *y1, double *x2, double *y2) const override;
+ void getOldBoundingRect(double *x1, double *y1, double *x2, double *y2) const override;
void getVisualBoundingRect(double *x1, double *y1, double *x2, double *y2) const override;
protected:
Modified: trunk/Scribus/scribus/pageitem_spiral.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23031&path=/trunk/Scribus/scribus/pageitem_spiral.cpp
==============================================================================
--- trunk/Scribus/scribus/pageitem_spiral.cpp (original)
+++ trunk/Scribus/scribus/pageitem_spiral.cpp Wed Jun 19 19:53:24 2019
@@ -353,149 +353,53 @@
void PageItem_Spiral::getBoundingRect(double *x1, double *y1, double *x2, double *y2) const
{
PageItem::getBoundingRect(x1, y1, x2, y2);
+
QRectF totalRect = QRectF(QPointF(*x1, *y1), QPointF(*x2, *y2));
- if (m_startArrowIndex != 0 && !PoLine.empty())
- {
- QTransform arrowTrans;
- FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex-1).points.copy();
- arrowTrans.translate(m_xPos, m_yPos);
- arrowTrans.rotate(m_rotation);
- FPoint Start = PoLine.point(0);
- for (int xx = 1; xx < PoLine.size(); xx += 2)
- {
- FPoint Vector = PoLine.point(xx);
- if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
- {
- arrowTrans.translate(Start.x(), Start.y());
- arrowTrans.rotate(atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI));
- arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
- if (NamedLStyle.isEmpty())
- {
- if (m_lineWidth != 0.0)
- arrowTrans.scale(m_lineWidth, m_lineWidth);
- }
- else
- {
- multiLine ml = m_Doc->MLineStyles[NamedLStyle];
- if (ml[ml.size()-1].Width != 0.0)
- arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
- }
- arrow.map(arrowTrans);
- break;
- }
- }
- FPoint minAr = getMinClipF(&arrow);
- FPoint maxAr = getMaxClipF(&arrow);
- totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
- }
- if (m_endArrowIndex != 0 && PoLine.size() >= 2)
- {
- QTransform arrowTrans;
- FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex-1).points.copy();
- arrowTrans.translate(m_xPos, m_yPos);
- arrowTrans.rotate(m_rotation);
- FPoint End = PoLine.point(PoLine.size()-2);
- for (uint xx = PoLine.size()-1; xx > 0; xx -= 2)
- {
- FPoint Vector = PoLine.point(xx);
- if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
- {
- arrowTrans.translate(End.x(), End.y());
- arrowTrans.rotate(atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI));
- arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
- if (NamedLStyle.isEmpty())
- {
- if (m_lineWidth != 0.0)
- arrowTrans.scale(m_lineWidth, m_lineWidth);
- }
- else
- {
- multiLine ml = m_Doc->MLineStyles[NamedLStyle];
- if (ml[ml.size()-1].Width != 0.0)
- arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
- }
- arrow.map(arrowTrans);
- break;
- }
- }
- FPoint minAr = getMinClipF(&arrow);
- FPoint maxAr = getMaxClipF(&arrow);
- totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
+ if (m_startArrowIndex != 0 && !PoLine.empty())
+ {
+ QRectF arrowRect = getStartArrowBoundingRect();
+ totalRect = totalRect.united(arrowRect);
+ }
+ if (m_endArrowIndex != 0 && PoLine.size() >= 2)
+ {
+ QRectF arrowRect = getEndArrowBoundingRect();
+ totalRect = totalRect.united(arrowRect);
}
totalRect.getCoords(x1, y1, x2, y2);
}
+void PageItem_Spiral::getOldBoundingRect(double *x1, double *y1, double *x2, double *y2) const
+{
+ PageItem::getOldBoundingRect(x1, y1, x2, y2);
+
+ QRectF totalRect = QRectF(QPointF(*x1, *y1), QPointF(*x2, *y2));
+ if (m_startArrowIndex != 0 && !PoLine.empty())
+ {
+ QRectF arrowRect = getStartArrowOldBoundingRect();
+ totalRect = totalRect.united(arrowRect);
+ }
+ if (m_endArrowIndex != 0 && PoLine.size() >= 2)
+ {
+ QRectF arrowRect = getEndArrowOldBoundingRect();
+ totalRect = totalRect.united(arrowRect);
+ }
+ totalRect.getCoords(x1, y1, x2, y2);
+}
+
void PageItem_Spiral::getVisualBoundingRect(double * x1, double * y1, double * x2, double * y2) const
{
PageItem::getVisualBoundingRect(x1, y1, x2, y2);
+
QRectF totalRect(QPointF(*x1, *y1), QPointF(*x2, *y2));
- if (m_startArrowIndex != 0 && !PoLine.empty())
- {
- QTransform arrowTrans;
- FPointArray arrow = m_Doc->arrowStyles().at(m_startArrowIndex-1).points.copy();
- arrowTrans.translate(m_xPos, m_yPos);
- arrowTrans.rotate(m_rotation);
- FPoint Start = PoLine.point(0);
- for (int xx = 1; xx < PoLine.size(); xx += 2)
- {
- FPoint Vector = PoLine.point(xx);
- if ((Start.x() != Vector.x()) || (Start.y() != Vector.y()))
- {
- arrowTrans.translate(Start.x(), Start.y());
- arrowTrans.rotate(atan2(Start.y()-Vector.y(),Start.x()-Vector.x())*(180.0/M_PI));
- arrowTrans.scale(m_startArrowScale / 100.0, m_startArrowScale / 100.0);
- if (NamedLStyle.isEmpty())
- {
- if (m_lineWidth != 0.0)
- arrowTrans.scale(m_lineWidth, m_lineWidth);
- }
- else
- {
- multiLine ml = m_Doc->MLineStyles[NamedLStyle];
- if (ml[ml.size()-1].Width != 0.0)
- arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
- }
- arrow.map(arrowTrans);
- break;
- }
- }
- FPoint minAr = getMinClipF(&arrow);
- FPoint maxAr = getMaxClipF(&arrow);
- totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
- }
- if (m_endArrowIndex != 0 && PoLine.size() >= 2)
- {
- QTransform arrowTrans;
- FPointArray arrow = m_Doc->arrowStyles().at(m_endArrowIndex-1).points.copy();
- arrowTrans.translate(m_xPos, m_yPos);
- arrowTrans.rotate(m_rotation);
- FPoint End = PoLine.point(PoLine.size()-2);
- for (uint xx = PoLine.size()-1; xx > 0; xx -= 2)
- {
- FPoint Vector = PoLine.point(xx);
- if ((End.x() != Vector.x()) || (End.y() != Vector.y()))
- {
- arrowTrans.translate(End.x(), End.y());
- arrowTrans.rotate(atan2(End.y()-Vector.y(),End.x()-Vector.x())*(180.0/M_PI));
- arrowTrans.scale(m_endArrowScale / 100.0, m_endArrowScale / 100.0);
- if (NamedLStyle.isEmpty())
- {
- if (m_lineWidth != 0.0)
- arrowTrans.scale(m_lineWidth, m_lineWidth);
- }
- else
- {
- multiLine ml = m_Doc->MLineStyles[NamedLStyle];
- if (ml[ml.size()-1].Width != 0.0)
- arrowTrans.scale(ml[ml.size()-1].Width, ml[ml.size()-1].Width);
- }
- arrow.map(arrowTrans);
- break;
- }
- }
- FPoint minAr = getMinClipF(&arrow);
- FPoint maxAr = getMaxClipF(&arrow);
- totalRect = totalRect.united(QRectF(QPointF(minAr.x(), minAr.y()), QPointF(maxAr.x(), maxAr.y())));
+ if (m_startArrowIndex != 0 && !PoLine.empty())
+ {
+ QRectF arrowRect = getStartArrowBoundingRect();
+ totalRect = totalRect.united(arrowRect);
+ }
+ if (m_endArrowIndex != 0 && PoLine.size() >= 2)
+ {
+ QRectF arrowRect = getEndArrowBoundingRect();
+ totalRect = totalRect.united(arrowRect);
}
totalRect.getCoords(x1, y1, x2, y2);
}
Modified: trunk/Scribus/scribus/pageitem_spiral.h
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23031&path=/trunk/Scribus/scribus/pageitem_spiral.h
==============================================================================
--- trunk/Scribus/scribus/pageitem_spiral.h (original)
+++ trunk/Scribus/scribus/pageitem_spiral.h Wed Jun 19 19:53:24 2019
@@ -51,6 +51,7 @@
double spiralFactor; //! factor the spiral gets smaller
void getBoundingRect(double *x1, double *y1, double *x2, double *y2) const override;
+ void getOldBoundingRect(double *x1, double *y1, double *x2, double *y2) const override;
void getVisualBoundingRect(double *x1, double *y1, double *x2, double *y2) const override;
protected:
Modified: trunk/Scribus/scribus/scribusdoc.cpp
URL: http://scribus.net/websvn/diff.php?repname=Scribus&rev=23031&path=/trunk/Scribus/scribus/scribusdoc.cpp
==============================================================================
--- trunk/Scribus/scribus/scribusdoc.cpp (original)
+++ trunk/Scribus/scribus/scribusdoc.cpp Wed Jun 19 19:53:24 2019
@@ -7809,7 +7809,7 @@
PageItem *currItem = m_Selection->itemAt(i);
QRectF oldRect = currItem->getVisualBoundingRect();
//cb moved to setlinewidth
- //currItem->Oldm_lineWidth = currItem->lineWidth();
+ //currItem->m_oldLineWidth = currItem->lineWidth();
currItem->setLineWidth(w);
if (currItem->asPolyLine() || currItem->asSpiral())
currItem->setPolyClip(qRound(qMax(currItem->lineWidth() / 2, 1.0)));
@@ -14525,7 +14525,6 @@
void ScribusDoc::moveGroup(double x, double y, Selection* customSelection)
{
- double Scale = 1; //FIXME:av should all be in doc coordinates
Selection* itemSelection = (customSelection!=nullptr) ? customSelection : m_Selection;
Q_ASSERT(itemSelection != nullptr);
int selectedItemCount = itemSelection->count();
@@ -14538,7 +14537,7 @@
double gx, gy, gw, gh;
itemSelection->setGroupRect();
itemSelection->getGroupRect(&gx, &gy, &gw, &gh);
- QRectF OldRect = QRectF(gx, gy, gw, gh);
+ QRectF oldRect = QRectF(gx, gy, gw, gh);
QList<PageItem*> weldL;
for (int i = 0; i < selectedItemCount; ++i)
{
@@ -14558,9 +14557,8 @@
currItem = itemSelection->itemAt(0);
GroupOnPage(currItem);
}
- QPoint in2(qRound(gx*Scale), qRound(gy*Scale));
- OldRect = OldRect.united(QRectF(in2.x()/*+contentsX()*/, in2.y()/*+contentsY()*/, qRound(gw*Scale), qRound(gh*Scale))); //FIXME:av
- regionsChanged()->update(OldRect.adjusted(-10, -10, 20, 20));
+ oldRect = oldRect.united(QRectF(gx, gy, gw, gh));
+ regionsChanged()->update(oldRect.adjusted(-10, -10, 20, 20));
}
void ScribusDoc::rotateGroup(double angle, Selection* customSelection)
More information about the scribus-commit
mailing list