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

Barth Netterfield netterfield at astro.utoronto.ca
Mon Feb 27 15:24:02 UTC 2012


SVN commit 1282576 by netterfield:

-Remove unused variable
-Add script interface properties for lock pos to data
-Add lock pos to data to contect menus


 M  +1 -0      dimensionstab.cpp  
 M  +0 -2      lineitem.cpp  
 M  +10 -0     viewitem.cpp  
 M  +2 -1      viewitem.h  


--- branches/work/kst/portto4/kst/src/libkstapp/dimensionstab.cpp #1282575:1282576
@@ -26,6 +26,7 @@
   label->setProperty("si","pos X");
   label_2->setProperty("si","pos Y");
   _fixAspectRatio->setProperty("si","&Fix aspect ratio");
+  _lockPosToData->setProperty("si", "Lock Position To Data");
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/lineitem.cpp #1282575:1282576
@@ -189,8 +189,6 @@
   if (activeGrip() == NoGrip)
     return QGraphicsRectItem::mouseMoveEvent(event);
 
-  QPointF p = event->pos();
-
   double width = 0;
   double height = 0;
   double theta = 0;
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #1282575:1282576
@@ -126,6 +126,10 @@
   _customLayoutAction = new QAction(tr("Columns"), this);
   connect(_customLayoutAction, SIGNAL(triggered()), this, SLOT(createCustomLayout()));
 
+  _lockPosToDataAction = new QAction(tr("&Lock Position to Data"),this);
+  _lockPosToDataAction->setCheckable(true);
+  connect(_lockPosToDataAction, SIGNAL(toggled(bool)), this, SLOT(setLockPosToData(bool)));
+
   // only drop plots onto TabBar
   setAcceptDrops(false);
 
@@ -246,6 +250,11 @@
   setLockPosToData(dialogDefaultsLockPosToData(defaultsGroupName()));
 }
 
+void ViewItem::setLockPosToData(bool lockPosToData) {
+  _lockPosToData = lockPosToData;
+  _lockPosToDataAction->setChecked(lockPosToData);
+}
+
 void ViewItem::applyDataLockedDimensions() {
   PlotRenderItem *render_item = qgraphicsitem_cast<PlotRenderItem *>(parentViewItem());
   if (render_item) {
@@ -1109,6 +1118,7 @@
   addTitle(&menu);
 
   menu.addAction(_editAction);
+  menu.addAction(_lockPosToDataAction);
 
   QMenu layoutMenu;
   if (!(lockParent() || (parentViewItem() && parentViewItem()->lockParent()))) {
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.h #1282575:1282576
@@ -147,7 +147,6 @@
     void setHighlighted(bool highlighted ) { _highlighted = highlighted; }
 
     bool lockPosToData() const {return _lockPosToData; }
-    void setLockPosToData(bool lockPosToData) { _lockPosToData = lockPosToData; }
 
     //NOTE This should be used in place of QGraphicsRectItem::setRect()...
     QRectF viewRect() const;
@@ -271,6 +270,7 @@
     void setBottom(qreal y);
     void setLeft(qreal x);
     void setRight(qreal x);
+    void setLockPosToData(bool lockPosToData);
 
   protected:
     virtual QPainterPath topLeftGrip() const;
@@ -318,6 +318,7 @@
     QAction *_autoLayoutAction;
     QAction *_protectedLayoutAction;
     QAction *_customLayoutAction;
+    QAction *_lockPosToDataAction;
 
     bool _isXTiedZoom;
     bool _isYTiedZoom;


More information about the Kst mailing list