r14518 by jghali - #8701 : Resize line no longer works at high zoom level
scribus-commit
scribus-commit at lists.scribus.net
Tue Jan 12 23:46:34 CET 2010
Revision: 14518
Author: jghali
Date: 2010-01-12T09:16:02.552692Z
Commit message: #8701 : Resize line no longer works at high zoom level
Changeset:
M /trunk/Scribus/scribus/pageitem_latexframe.h
M /trunk/Scribus/scribus/pageitem.cpp
M /trunk/Scribus/scribus/pageitem_polyline.h
M /trunk/Scribus/scribus/pageitem_imageframe.h
M /trunk/Scribus/scribus/pageitem_textframe.h
M /trunk/Scribus/scribus/canvasmode.cpp
M /trunk/Scribus/scribus/pageitem.h
M /trunk/Scribus/scribus/pageitem_pathtext.h
M /trunk/Scribus/scribus/pageitem_osgframe.h
M /trunk/Scribus/scribus/pageitem_line.h
M /trunk/Scribus/scribus/pageitem_polygon.h
Diffs:
Index: scribus/pageitem_polyline.h
===================================================================
--- scribus/pageitem_polyline.h (revision 14517)
+++ scribus/pageitem_polyline.h (revision 14518)
@@ -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_imageframe.h
===================================================================
--- scribus/pageitem_imageframe.h (revision 14517)
+++ scribus/pageitem_imageframe.h (revision 14518)
@@ -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 14517)
+++ scribus/canvasmode.cpp (revision 14518)
@@ -255,22 +255,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));
@@ -299,22 +299,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));
@@ -326,9 +326,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->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+w-markWidth, y+h/2.0-markWidth, 2* markWidth,2* markWidth));
+// psx->setBrush(Qt::blue); // sometimes we forget which is what :)
+ 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 14517)
+++ scribus/pageitem_line.h (revision 14518)
@@ -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 14517)
+++ scribus/pageitem_pathtext.h (revision 14518)
@@ -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 14517)
+++ scribus/pageitem.h (revision 14518)
@@ -191,6 +191,14 @@
virtual PageItem_OSGFrame * asOSGFrame() { return NULL; }
#endif
+ 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; }
+ virtual bool isOSGFrame() const { return false; }
/** @brief Frame Type
*
Index: scribus/pageitem.cpp
===================================================================
--- scribus/pageitem.cpp (revision 14517)
+++ scribus/pageitem.cpp (revision 14518)
@@ -5152,25 +5152,28 @@
double PageItem::visualXPos() const
{
double extraSpace = 0.0;
- if (NamedLStyle.isEmpty())
+ if (!isLine())
{
- if ((lineColor() != CommonStrings::None) || (!patternStrokeVal.isEmpty()) || (GrTypeStroke > 0))
- extraSpace = m_lineWidth / 2.0;
- if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)) && (patternStrokePath))
+ if (NamedLStyle.isEmpty())
{
- ScPattern *pat = &m_Doc->docPatterns[patternStrokeVal];
- double ww = (pat->width * patternStrokeScaleX / 100.0) / 2.0;
- double hh = (pat->height * patternStrokeScaleY / 100.0) / 2.0;
- extraSpace = sqrt(ww*ww + hh*hh);
+ if ((lineColor() != CommonStrings::None) || (!patternStrokeVal.isEmpty()) || (GrTypeStroke > 0))
+ extraSpace = m_lineWidth / 2.0;
+ if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)) && (patternStrokePath))
+ {
+ ScPattern *pat = &m_Doc->docPatterns[patternStrokeVal];
+ double ww = (pat->width * patternStrokeScaleX / 100.0) / 2.0;
+ double hh = (pat->height * patternStrokeScaleY / 100.0) / 2.0;
+ extraSpace = sqrt(ww*ww + hh*hh);
+ }
}
+ 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;
}
@@ -5202,25 +5205,28 @@
double PageItem::visualWidth() const
{
double extraSpace = 0.0;
- if (NamedLStyle.isEmpty())
+ if (!isLine())
{
- if ((lineColor() != CommonStrings::None) || (!patternStrokeVal.isEmpty()) || (GrTypeStroke > 0))
- extraSpace = m_lineWidth;
- if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)) && (patternStrokePath))
+ if (NamedLStyle.isEmpty())
{
- ScPattern *pat = &m_Doc->docPatterns[patternStrokeVal];
- double ww = (pat->width * patternStrokeScaleX / 100.0) / 2.0;
- double hh = (pat->height * patternStrokeScaleY / 100.0) / 2.0;
- extraSpace = sqrt(ww*ww + hh*hh);
+ if ((lineColor() != CommonStrings::None) || (!patternStrokeVal.isEmpty()) || (GrTypeStroke > 0))
+ extraSpace = m_lineWidth;
+ if ((!patternStrokeVal.isEmpty()) && (m_Doc->docPatterns.contains(patternStrokeVal)) && (patternStrokePath))
+ {
+ ScPattern *pat = &m_Doc->docPatterns[patternStrokeVal];
+ double ww = (pat->width * patternStrokeScaleX / 100.0) / 2.0;
+ double hh = (pat->height * patternStrokeScaleY / 100.0) / 2.0;
+ extraSpace = sqrt(ww*ww + hh*hh);
+ }
}
+ 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;
}
@@ -5246,7 +5252,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_latexframe.h
===================================================================
--- scribus/pageitem_latexframe.h (revision 14517)
+++ scribus/pageitem_latexframe.h (revision 14518)
@@ -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 14517)
+++ scribus/pageitem_textframe.h (revision 14518)
@@ -53,6 +53,7 @@
~PageItem_TextFrame() {};
virtual PageItem_TextFrame * asTextFrame() { return this; }
+ virtual bool isTextFrame() const { return true; }
virtual void clearContents();
Index: scribus/pageitem_osgframe.h
===================================================================
--- scribus/pageitem_osgframe.h (revision 14517)
+++ scribus/pageitem_osgframe.h (revision 14518)
@@ -77,6 +77,8 @@
~PageItem_OSGFrame();
virtual PageItem_OSGFrame * asOSGFrame() { return this; }
+ virtual bool isOSGFrame() const { return true; }
+
virtual ItemType realItemType() const { return PageItem::OSGFrame; }
virtual void clearContents();
void setImage(QImage &image);
Index: scribus/pageitem_polygon.h
===================================================================
--- scribus/pageitem_polygon.h (revision 14517)
+++ scribus/pageitem_polygon.h (revision 14518)
@@ -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