1.1 --- a/frameobj.cpp Sat Mar 31 09:28:27 2007 +0000
1.2 +++ b/frameobj.cpp Wed Jan 16 15:45:19 2008 +0000
1.3 @@ -25,7 +25,8 @@
1.4 void FrameObj::init()
1.5 {
1.6 type=NoFrame;
1.7 - border=0;
1.8 + padding=10;
1.9 + borderWidth=1;
1.10 penColor=QColor (Qt::black);
1.11 brushColor=QColor (Qt::white);
1.12 }
1.13 @@ -44,7 +45,7 @@
1.14 break;
1.15 }
1.16 type=NoFrame;
1.17 - border=0;
1.18 + padding=0;
1.19 }
1.20
1.21 void FrameObj::move(double x, double y)
1.22 @@ -93,12 +94,32 @@
1.23 }
1.24 }
1.25
1.26 -int FrameObj::getBorder()
1.27 +void FrameObj::setPadding (const int &i)
1.28 {
1.29 - return border;
1.30 + padding=i;
1.31 + repaint();
1.32 }
1.33
1.34 -FrameType FrameObj::getFrameType()
1.35 +int FrameObj::getPadding()
1.36 +{
1.37 + if (type==NoFrame)
1.38 + return 0;
1.39 + else
1.40 + return padding;
1.41 +}
1.42 +
1.43 +void FrameObj::setBorderWidth (const int &i)
1.44 +{
1.45 + borderWidth=i;
1.46 + repaint();
1.47 +}
1.48 +
1.49 +int FrameObj::getBorderWidth()
1.50 +{
1.51 + return borderWidth;
1.52 +}
1.53 +
1.54 +FrameObj::FrameType FrameObj::getFrameType()
1.55 {
1.56 return type;
1.57 }
1.58 @@ -127,16 +148,13 @@
1.59 switch (type)
1.60 {
1.61 case NoFrame:
1.62 - border=0;
1.63 break;
1.64 case Rectangle:
1.65 - border=10;
1.66 rectFrame = scene->addRect(QRectF(0,0,0,0), QPen(penColor), brushColor);
1.67 rectFrame->setZValue(Z_FRAME);
1.68 rectFrame->show();
1.69 break;
1.70 case Ellipse:
1.71 - border=10;
1.72 ellipseFrame = scene->addEllipse(QRectF(0,0,0,0), QPen(penColor), brushColor);
1.73 ellipseFrame->setZValue(Z_FRAME);
1.74 ellipseFrame->show();
1.75 @@ -180,15 +198,19 @@
1.76
1.77 void FrameObj::repaint()
1.78 {
1.79 + QPen pen;
1.80 + pen.setColor (penColor);
1.81 + pen.setWidth (borderWidth);
1.82 + QBrush brush (brushColor);
1.83 switch (type)
1.84 {
1.85 case Rectangle:
1.86 - rectFrame->setPen (penColor);
1.87 - rectFrame->setBrush (brushColor);
1.88 + rectFrame->setPen (pen);
1.89 + rectFrame->setBrush (brush);
1.90 break;
1.91 case Ellipse:
1.92 - ellipseFrame->setPen (penColor);
1.93 - ellipseFrame->setBrush (brushColor);
1.94 + ellipseFrame->setPen (pen);
1.95 + ellipseFrame->setBrush (brush);
1.96 break;
1.97 default:
1.98 break;
1.99 @@ -220,9 +242,17 @@
1.100
1.101 QString FrameObj::saveToDir ()
1.102 {
1.103 + if (type==NoFrame) return QString();
1.104 QString frameTypeAttr=attribut ("frameType",getFrameTypeName());
1.105 QString penColAttr=attribut ("penColor",penColor.name() );
1.106 QString brushColAttr=attribut ("brushColor",brushColor.name() );
1.107 - return singleElement ("frame",frameTypeAttr + penColAttr + brushColAttr);
1.108 + QString paddingAttr=attribut ("padding",QString::number (padding) );
1.109 + QString borderWidthAttr=attribut ("borderWidth",QString::number (borderWidth) );
1.110 + return singleElement (
1.111 + "frame",frameTypeAttr +
1.112 + penColAttr +
1.113 + brushColAttr +
1.114 + paddingAttr +
1.115 + borderWidthAttr);
1.116 }
1.117