r14517 by jghali - #8701 : Resize line no longer works at high zoom level
scribus-commit
scribus-commit at lists.scribus.net
Tue Jan 12 23:45:56 CET 2010
Revision: 14517
Author: jghali
Date: 2010-01-12T09:15:09.911075Z
Commit message: #8701 : Resize line no longer works at high zoom level
Changeset:
M /branches/Version135/Scribus/scribus/pageitem_latexframe.h
M /branches/Version135/Scribus/scribus/pageitem.cpp
M /branches/Version135/Scribus/scribus/pageitem_polyline.h
M /branches/Version135/Scribus/scribus/pageitem_imageframe.h
M /branches/Version135/Scribus/scribus/pageitem_textframe.h
M /branches/Version135/Scribus/scribus/canvasmode.cpp
M /branches/Version135/Scribus/scribus/pageitem.h
M /branches/Version135/Scribus/scribus/pageitem_pathtext.h
M /branches/Version135/Scribus/scribus/pageitem_line.h
M /branches/Version135/Scribus/scribus/pageitem_polygon.h
Diffs:
Index: scribus/pageitem_polyline.h
===================================================================
--- scribus/pageitem_polyline.h (revision 14516)
+++ scribus/pageitem_polyline.h (revision 14517)
@@ -40,6 +40,7 @@
~PageItem_PolyLine() {};
virtual PageItem_PolyLine * asPolyLine() { return this; }
+ virtual bool isPolyLine() const { return true; }
virtual void applicableActions(QStringList& actionList);
virtual QString infoDescription();
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp (revision 14516)
+++ scribus/pageitem.cpp (revision 14517)
@@ -4578,18 +4578,21 @@
double PageItem::visualXPos() const
{
double extraSpace = 0.0;
- if (NamedLStyle.isEmpty())
+ if (!isLine())
{
- if (lineColor() != CommonStrings::None)
- extraSpace = m_lineWidth / 2.0;
+ if (NamedLStyle.isEmpty())
+ {
+ if (lineColor() != CommonStrings::None)
+ extraSpace = m_lineWidth / 2.0;
+ }
+ else
+ {
+ multiLine ml = m_Doc->MLineStyles[NamedLStyle];
+ struct SingleLine& sl = ml[ml.size()-1];
+ if ((sl.Color != CommonStrings::None) && (sl.Width != 0))
+ extraSpace = sl.Width / 2.0;
+ }
}
- else
- {
- multiLine ml = m_Doc->MLineStyles[NamedLStyle];
- struct SingleLine& sl = ml[ml.size()-1];
- if ((sl.Color != CommonStrings::None) && (sl.Width != 0))
- extraSpace = sl.Width / 2.0;
- }
return Xpos - extraSpace;
}
@@ -4614,18 +4617,21 @@
double PageItem::visualWidth() const
{
double extraSpace = 0.0;
- if (NamedLStyle.isEmpty())
+ if (!isLine())
{
- if (lineColor() != CommonStrings::None)
- extraSpace = m_lineWidth;
+ if (NamedLStyle.isEmpty())
+ {
+ if (lineColor() != CommonStrings::None)
+ extraSpace = m_lineWidth;
+ }
+ else
+ {
+ multiLine ml = m_Doc->MLineStyles[NamedLStyle];
+ struct SingleLine& sl = ml[ml.size()-1];
+ if ((sl.Color != CommonStrings::None) && (sl.Width != 0))
+ extraSpace = sl.Width;
+ }
}
- else
- {
- multiLine ml = m_Doc->MLineStyles[NamedLStyle];
- struct SingleLine& sl = ml[ml.size()-1];
- if ((sl.Color != CommonStrings::None) && (sl.Width != 0))
- extraSpace = sl.Width;
- }
return Width + extraSpace;
}
@@ -4644,7 +4650,7 @@
if ((sl.Color != CommonStrings::None) && (sl.Width != 0))
extraSpace = sl.Width;
}
- return Height + extraSpace;
+ return isLine() ? extraSpace : Height + extraSpace;
}
bool PageItem::pointWithinItem(const int x, const int y) const
Index: scribus/pageitem_imageframe.h
===================================================================
--- scribus/pageitem_imageframe.h (revision 14516)
+++ scribus/pageitem_imageframe.h (revision 14517)
@@ -41,6 +41,8 @@
~PageItem_ImageFrame() {};
virtual PageItem_ImageFrame * asImageFrame() { return this; }
+ virtual bool isImageFrame() const { return true; }
+
virtual void handleModeEditKey(QKeyEvent *k, bool& keyRepeat);
virtual void clearContents();
Index: scribus/canvasmode.cpp
===================================================================
--- scribus/canvasmode.cpp (revision 14516)
+++ scribus/canvasmode.cpp (revision 14517)
@@ -241,22 +241,22 @@
psx->setBrush(m_brush["selection-group-inside"]);
double lineAdjust(psx->pen().width()/m_canvas->scale());
double x, y, w, h;
+ w = currItem->visualWidth() ;
+ h = currItem->visualHeight() ;
if (currItem->rotation() != 0)
{
psx->setRenderHint(QPainter::Antialiasing);
psx->translate(currItem->xPos(), currItem->yPos());
psx->rotate(currItem->rotation());
- x = currItem->lineWidth()/-2.0;
- y = currItem->lineWidth()/-2.0;
+ x = currItem->asLine() ? 0 : (currItem->lineWidth() / -2.0);
+ y = currItem->asLine() ? (h / -2.0) : (currItem->lineWidth() / -2.0);
}
else
{
psx->translate(currItem->visualXPos(), currItem->visualYPos());
- x = -lineAdjust;
- y = -lineAdjust;
+ x = currItem->asLine() ? 0 : -lineAdjust;
+ y = currItem->asLine() ? 0 : -lineAdjust;
}
- w = currItem->visualWidth() ;
- h = (currItem->asLine()) ? currItem->visualHeight() - 1.0 : currItem->visualHeight() ;
psx->drawRect(QRectF(x, y, w, h));
@@ -285,22 +285,22 @@
psx->setBrush(m_brush["selection"]);
double lineAdjust(psx->pen().width()/m_canvas->scale());
double x, y, w, h;
+ w = currItem->visualWidth();
+ h = currItem->visualHeight();
if (currItem->rotation() != 0)
{
psx->setRenderHint(QPainter::Antialiasing);
psx->translate(currItem->xPos(), currItem->yPos());
psx->rotate(currItem->rotation());
- x = currItem->lineWidth()/-2.0;
- y = currItem->lineWidth()/-2.0;
+ x = currItem->asLine() ? 0 : (currItem->lineWidth() / -2.0);
+ y = currItem->asLine() ? (h / -2.0) : (currItem->lineWidth( ) / -2.0);
}
else
{
psx->translate(currItem->visualXPos(), currItem->visualYPos());
- x = -lineAdjust;
- y = -lineAdjust;
+ x = currItem->asLine() ? 0 : -lineAdjust;
+ y = currItem->asLine() ? 0 : -lineAdjust;
}
- w = currItem->visualWidth() ;
- h = (currItem->asLine()) ? currItem->visualHeight() - 1.0 : currItem->visualHeight() ;
tt.start();
psx->drawRect(QRectF(x, y, w, h));
@@ -312,9 +312,9 @@
if(currItem->asLine())
{
psx->setRenderHint(QPainter::Antialiasing);
- psx->drawPie(QRectF(x+w-markWidth, y+h-markWidth,2* markWidth,2* markWidth), 180 * 16, 270 * 16);
+ psx->drawEllipse(QRectF(x+w-markWidth, y+h/2.0-markWidth, 2* markWidth,2* markWidth));
// psx->setBrush(Qt::blue); // sometimes we forget which is what :)
- psx->drawPie(QRectF(x-markWidth, y-markWidth, 2* markWidth, 2* markWidth), 0 * 16, 270 * 16);
+ psx->drawEllipse(QRectF(x-markWidth, y+h/2.0-markWidth, 2* markWidth, 2* markWidth));
}
else
{
Index: scribus/pageitem_line.h
===================================================================
--- scribus/pageitem_line.h (revision 14516)
+++ scribus/pageitem_line.h (revision 14517)
@@ -40,6 +40,7 @@
~PageItem_Line() {};
virtual PageItem_Line * asLine() { return this; }
+ virtual bool isLine() const { return true; }
virtual void applicableActions(QStringList& actionList);
virtual QString infoDescription();
Index: scribus/pageitem_pathtext.h
===================================================================
--- scribus/pageitem_pathtext.h (revision 14516)
+++ scribus/pageitem_pathtext.h (revision 14517)
@@ -40,6 +40,8 @@
~PageItem_PathText() {};
virtual PageItem_PathText * asPathText() { return this; }
+ virtual bool isPathText() const { return true; }
+
virtual void layout();
virtual bool createInfoGroup(QFrame *, QGridLayout *);
// virtual bool createContextMenu(QMenu *, int);
Index: scribus/pageitem.h
===================================================================
--- scribus/pageitem.h (revision 14516)
+++ scribus/pageitem.h (revision 14517)
@@ -176,7 +176,15 @@
virtual PageItem_TextFrame * asTextFrame() { return NULL; }
virtual PageItem_LatexFrame * asLatexFrame() { return NULL; }
+ virtual bool isImageFrame() const { return false; }
+ virtual bool isLine() const { return false; }
+ virtual bool isPathText() const { return false; }
+ virtual bool isPolygon() const { return false; }
+ virtual bool isPolyLine() const { return false; }
+ virtual bool isTextFrame() const { return false; }
+ virtual bool isLatexFrame() const { return false; }
+
/** @brief Frame Type
*
*
Index: scribus/pageitem_latexframe.h
===================================================================
--- scribus/pageitem_latexframe.h (revision 14516)
+++ scribus/pageitem_latexframe.h (revision 14517)
@@ -49,6 +49,8 @@
~PageItem_LatexFrame();
virtual PageItem_LatexFrame * asLatexFrame() { return this; }
+ virtual bool isLatexFrame() const { return true; }
+
virtual void clearContents();
virtual ItemType realItemType() const { return PageItem::LatexFrame; }
virtual void applicableActions(QStringList& actionList);
Index: scribus/pageitem_textframe.h
===================================================================
--- scribus/pageitem_textframe.h (revision 14516)
+++ scribus/pageitem_textframe.h (revision 14517)
@@ -53,6 +53,7 @@
~PageItem_TextFrame() {};
virtual PageItem_TextFrame * asTextFrame() { return this; }
+ virtual bool isTextFrame() const { return true; }
virtual void clearContents();
Index: scribus/pageitem_polygon.h
===================================================================
--- scribus/pageitem_polygon.h (revision 14516)
+++ scribus/pageitem_polygon.h (revision 14517)
@@ -41,6 +41,8 @@
~PageItem_Polygon() {};
virtual PageItem_Polygon * asPolygon() { return this; }
+ virtual bool isPolygon() const { return true; }
+
// virtual bool createContextMenu(QMenu *, int);
virtual void applicableActions(QStringList& actionList);
virtual QString infoDescription();
More information about the scribus-commit
mailing list