[Kst] branches/work/kst/portto4/kst

Barth Netterfield netterfield at astro.utoronto.ca
Sat May 2 20:57:42 CEST 2009


SVN commit 962627 by netterfield:

Fix arrow bug;
update bug list.



 M  +3 -8      devel-docs/Kst2Specs/Bugs  
 M  +4 -0      devel-docs/Kst2Specs/FixedBugs  
 M  +2 -0      devel-docs/Kst2Specs/Wishlist  
 M  +1 -1      src/libkstapp/arrowitem.cpp  
 M  +22 -13    src/libkstapp/lineitem.cpp  
 M  +2 -2      src/libkstapp/lineitem.h  


--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Bugs #962626:962627
@@ -41,17 +41,12 @@
 
 ------------
 
-Drawing problems in resizing arrow
-draw an arrow.  In layout mode, grab one end and drag it around.  The grab point
-gradually drifts away from the mouse cursor.
+Drawing problems in resizing view items (eg, arrow)
+draw an arrow.  In layout mode, grab one end and drag it around quickly.  The grab point
+gradually drifts away from the mouse cursor.  It is much less pronounced if you move slowly.
 
 ------------
 
-'ok' in arrow dialog moves the arrow.
-draw an arrow. Open the edit dialog.  change something and hit apply.  The arrow moves.
-
-------------
-
 Image dialog 'smart' range calculations seem to be... odd.
 
 ------------
--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/FixedBugs #962626:962627
@@ -569,3 +569,7 @@
 
 Accelerators everywhere.
 
+------------
+
+'ok' in arrow dialog moves the arrow.
+draw an arrow. Open the edit dialog.  change something and hit apply.  The arrow moves.
--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Wishlist #962626:962627
@@ -40,6 +40,8 @@
 Default X vector should be remembered.
   -A default X vector, which is the last vector to have been used as an X vector, should be remembered. 
 
+*cbn*
+
 ---------
 
 'I' key in a plot with an image should adjust the image color scale; see 1.x for correct behavior.  Consider <shift>I as doing smaller steps.
--- branches/work/kst/portto4/kst/src/libkstapp/arrowitem.cpp #962626:962627
@@ -88,7 +88,7 @@
   if (isVisible()) {
     xml.writeStartElement("arrow");
     xml.writeAttribute("startarrowhead", QVariant(_startArrowHead).toString());
-    xml.writeAttribute("endarrowhead", QVariant(_startArrowHead).toString());
+    xml.writeAttribute("endarrowhead", QVariant(_endArrowHead).toString());
     xml.writeAttribute("startarrowheadscale", QVariant(_startArrowScale).toString());
     xml.writeAttribute("endarrowheadscale", QVariant(_endArrowScale).toString());
     ViewItem::save(xml);
--- branches/work/kst/portto4/kst/src/libkstapp/lineitem.cpp #962626:962627
@@ -23,6 +23,7 @@
 
 LineItem::LineItem(View *parent)
   : ViewItem(parent) {
+  _created = false;
   setTypeName("Line");
   setAllowedGrips(RightMidGrip | LeftMidGrip);
   setAllowedGripModes(Resize);
@@ -56,20 +57,20 @@
 }
 
 
-void LineItem::setLine(const QLineF &line_) {
-  setPos(line_.p1());
-  setViewRect(QRectF(0.0, 0.0, 0.0, sizeOfGrip().height()));
+//void LineItem::setLine(const QLineF &line_) {
+//  setPos(line_.p1());
+//  setViewRect(QRectF(0.0, 0.0, 0.0, sizeOfGrip().height()));
+//
+//  if (!rect().isEmpty()) {
+//    rotateTowards(line().p2(), line_.p2());
+//  }
+//
+//  QRectF r = rect();
+//  r.setSize(QSizeF(QLineF(line().p1(), line_.p2()).length(), r.height()));
+//  setViewRect(r);
+//}
 
-  if (!rect().isEmpty()) {
-    rotateTowards(line().p2(), line_.p2());
-  }
 
-  QRectF r = rect();
-  r.setSize(QSizeF(QLineF(line().p1(), line_.p2()).length(), r.height()));
-  setViewRect(r);
-}
-
-
 QPainterPath LineItem::leftMidGrip() const {
   QRectF bound = gripBoundingRect();
   QRectF grip = QRectF(bound.topLeft(), sizeOfGrip());
@@ -105,7 +106,14 @@
     return line().p1();
   else if (activeGrip() == LeftMidGrip)
     return line().p2();
-  return line().p1();
+
+  // when creating the object with the mouse, use p1 as the rotation point.
+  // otherwise, use the center
+  if (_created) {
+      return QPointF((line().x1()+line().x2())*0.5, (line().y1()+line().y2())*0.5);
+  } else {
+      return QPointF(line().p1());
+  }
 }
 
 
@@ -140,6 +148,7 @@
     parentView()->disconnect(this, SLOT(creationPolygonChanged(View::CreationEvent)));
     parentView()->setMouseMode(View::Default);
     maybeReparent();
+    _created = true;
     emit creationComplete();
     return;
   }
--- branches/work/kst/portto4/kst/src/libkstapp/lineitem.h #962626:962627
@@ -25,7 +25,7 @@
     virtual ~LineItem();
 
     QLineF line() const;
-    void setLine(const QLineF &line);
+    //void setLine(const QLineF &line);
 
     virtual void save(QXmlStreamWriter &xml);
     virtual void paint(QPainter *painter);
@@ -49,7 +49,7 @@
 
   private:
     virtual void updateChildGeometry(const QRectF &oldParentRect, const QRectF &newParentRect);
-
+    bool _created;
 };
 
 class KST_EXPORT CreateLineCommand : public CreateCommand


More information about the Kst mailing list