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

Barth Netterfield netterfield at astro.utoronto.ca
Fri Jan 20 16:49:51 UTC 2012


SVN commit 1274953 by netterfield:

Some fixes to shared axis boxes.


 M  +0 -4      devel-docs/Kst2Specs/Bugs  
 M  +0 -10     devel-docs/Kst2Specs/Wishlist  
 M  +11 -5     src/libkstapp/dimensionstab.cpp  
 M  +4 -1      src/libkstapp/plotitem.cpp  
 M  +2 -3      src/libkstapp/scriptserver.cpp  
 M  +28 -8     src/libkstapp/sharedaxisboxitem.cpp  
 M  +1 -1      src/libkstapp/sharedaxisboxitem.h  
 M  +5 -4      src/widgets/vectorselector.cpp  


--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Bugs #1274952:1274953
@@ -4,7 +4,3 @@
 
 More than one shared axis group.  Tied zoom doesn't work right.
 
---------------------
-
-points don't always appear centered on the line.
-
--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Wishlist #1274952:1274953
@@ -17,12 +17,6 @@
 
 Edit multiple for other view objects (arrow, line, label...)
 
---------
-
-data source text box doesn't recognise initial ~ as a euphemism for
-   the user's home directory (QDirModel doesn't handle this...)
-   (nor QDir, though QDir seems to know about $HOME).
-
 ------------
 
 1.x kst file read compatibility...
@@ -43,9 +37,5 @@
 
 --------------------
 
-Legends can get larger than the plot if there are enought things in them.  This should not be. 
-
--------
-
 Some automagic way of deciding if plugin dialogs can make plots.
 
--- branches/work/kst/portto4/kst/src/libkstapp/dimensionstab.cpp #1274952:1274953
@@ -34,12 +34,18 @@
 
 
 void DimensionsTab::setupDimensions() {
-  _x->setValue(_viewItem->relativeCenter().x());
-  _y->setValue(_viewItem->relativeCenter().y());
-  _width->setValue(_viewItem->relativeWidth());
-  _height->setValue(_viewItem->relativeHeight());
-  _rotation->setValue(_viewItem->rotationAngle());
+  double x0 = _viewItem->relativeCenter().x();
+  double y0 = _viewItem->relativeCenter().y();
+  double w = _viewItem->relativeWidth();
+  double h = _viewItem->relativeHeight();
+  double theta = _viewItem->rotationAngle();
 
+  _x->setValue(x0);
+  _y->setValue(y0);
+  _width->setValue(w);
+  _height->setValue(h);
+  _rotation->setValue(theta);
+
   _fixAspectRatio->setChecked(_viewItem->lockAspectRatio());
   _fixAspectRatio->setEnabled(!_viewItem->lockAspectRatioFixed());
   _fixAspectRatio->setTristate(false);
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #1274952:1274953
@@ -2877,6 +2877,9 @@
 void PlotItem::zoomFixedExpression(const QRectF &projection, bool force) {
   if (projection.isValid()) {
     if (isInSharedAxisBox()) {
+      ZoomCommand *cmd = new ZoomFixedExpressionCommand(this, projection, force);
+      _undoStack->push(cmd);
+      cmd->redo();
       if (!force) {
         sharedAxisBox()->zoomFixedExpression(projection, this);
       } else {
@@ -4360,7 +4363,7 @@
     item->setProjectionRect(QRectF(item->projectionRect().x(),
           compute.y(),
           item->projectionRect().width(),
-          compute.height()));
+          compute.height()));
   }
 }
 
--- branches/work/kst/portto4/kst/src/libkstapp/scriptserver.cpp #1274952:1274953
@@ -786,12 +786,11 @@
 }
 
 
-
 QByteArray ScriptServer::getBasicPluginTypeList(QByteArray&, QLocalSocket* s,ObjectStore*,const int&ifMode,
                                                 const QByteArray&ifEqual,IfSI*& _if,VarSI*var) {
     QString a;
     for(int i=0;i<DataObject::dataObjectPluginList().size();i++) {
-        a.push_back(DataObject::dataObjectPluginList()[i].toAscii()%"\n");
+        a.push_back(DataObject::dataObjectPluginList()[i].toAscii()+"\n");
     }
     return handleResponse(a.toAscii(),s,ifMode,ifEqual,_if,var);
 }
@@ -1320,7 +1319,7 @@
         }
         return handleResponse((join(v,'\n')+builtIns+"\n"),s,ifMode,ifEqual,_if,var);
     } else {
-        QString a="endEdit()\n"%join(_interface->commands(),'\n');
+        QString a="endEdit()\n"+join(_interface->commands(),'\n');
         return handleResponse(a.toAscii(),s,ifMode,ifEqual,_if,var);
     }
 }
--- branches/work/kst/portto4/kst/src/libkstapp/sharedaxisboxitem.cpp #1274952:1274953
@@ -474,7 +474,14 @@
   _yAxisZoomMode = PlotAxis::FixedExpression;
   if (originPlotItem) {
     originPlotItem->zoomFixedExpression(projection, true);
+    if (originPlotItem->isTiedZoom() && originPlotItem->isInSharedAxisBox() && (originPlotItem->sharedAxisBox() == this)) {
+      QList<PlotItem*> plotTied = PlotItemManager::tiedZoomPlotsForView(view());
+
+      foreach(PlotItem* plotItem, plotTied) {
+        plotItem->zoomFixedExpression(projection, true);
   }
+    }
+  }
   applyZoom(projection, originPlotItem, true, true);
 }
 
@@ -483,7 +490,13 @@
   if (!_shareX) {
     if (originPlotItem) {
       originPlotItem->zoomXRange(projection, true);
+    }
+  } else {
+    _xAxisZoomMode = PlotAxis::FixedExpression;
+    applyZoom(projection, originPlotItem, true, false);
+  }
 
+  if (originPlotItem) {
       if (originPlotItem->isTiedZoom() && originPlotItem->isInSharedAxisBox() && (originPlotItem->sharedAxisBox() == this)) {
         QList<PlotItem*> plotTied = PlotItemManager::tiedZoomPlotsForView(view());
 
@@ -492,18 +505,21 @@
         }
       }
     }
-  } else {
-    _xAxisZoomMode = PlotAxis::FixedExpression;
-    applyZoom(projection, originPlotItem, true, false);
+
   }
-}
 
 
 void SharedAxisBoxItem::zoomYRange(const QRectF &projection, PlotItem* originPlotItem) {
   if (!_shareY) {
     if (originPlotItem) {
       originPlotItem->zoomYRange(projection, true);
+    }
+  } else {
+    _yAxisZoomMode = PlotAxis::FixedExpression;
+    applyZoom(projection, originPlotItem, false, true);
+  }
 
+  if (originPlotItem) {
       if (originPlotItem->isTiedZoom() && originPlotItem->isInSharedAxisBox() && (originPlotItem->sharedAxisBox() == this)) {
         QList<PlotItem*> plotTied = PlotItemManager::tiedZoomPlotsForView(view());
 
@@ -512,11 +528,8 @@
         }
       }
     }
-  } else {
-    _yAxisZoomMode = PlotAxis::FixedExpression;
-    applyZoom(projection, originPlotItem, false, true);
+
   }
-}
 
 
 void SharedAxisBoxItem::zoomMaximum(PlotItem* originPlotItem) {
@@ -528,7 +541,14 @@
   _yAxisZoomMode = PlotAxis::AutoBorder;
   if (originPlotItem) {
     originPlotItem->zoomMaximum(true);
+    if (originPlotItem->isTiedZoom() && originPlotItem->isInSharedAxisBox() && (originPlotItem->sharedAxisBox() == this)) {
+      QList<PlotItem*> plotTied = PlotItemManager::tiedZoomPlotsForView(view());
+
+      foreach(PlotItem* plotItem, plotTied) {
+        plotItem->zoomMaximum(true);
   }
+    }
+  }
   applyZoom(computeRect(PlotAxis::Auto, PlotAxis::AutoBorder), originPlotItem);
 }
 
--- branches/work/kst/portto4/kst/src/libkstapp/sharedaxisboxitem.h #1274952:1274953
@@ -94,6 +94,7 @@
     void zoomYIn(PlotItem* originPlotItem);
     void zoomNormalizeYtoX(PlotItem* originPlotItem);
     void zoomLogY(PlotItem* originPlotItem, bool autoEnable = true, bool enable = true);
+    QList<PlotItem*> getSharedPlots();
 
   protected Q_SLOTS:
     virtual void creationPolygonChanged(View::CreationEvent event);
@@ -106,7 +107,6 @@
     QRectF computeRect(PlotAxis::ZoomMode xMode, PlotAxis::ZoomMode yMode);
     void applyZoom(const QRectF &projection, PlotItem* originPlotItem, bool applyX = true, bool applyY = true);
 
-    QList<PlotItem*> getSharedPlots();
     QList<PlotItem*> getTiedPlots(PlotItem* originPlotItem);
 
     QAction *_breakAction;
--- branches/work/kst/portto4/kst/src/widgets/vectorselector.cpp #1274952:1274953
@@ -73,8 +73,9 @@
     QString shortName;
     QRegExp rx("(\\(|^)([A-Z]\\d+)(\\)$|$)");
     rx.indexIn(_vector->currentText());
-    shortName = rx.cap(2);
+    shortName = '('+rx.cap(2)+')';
 
+
     for(int i=0;i<_vector->count();i++) {
         if(_vector->itemText(i).contains(shortName)) {
             return qVariantValue<Vector*>(_vector->itemData(i));
@@ -195,6 +196,9 @@
     return;
   }
 
+  int current_index = _vector->currentIndex();
+  VectorPtr current = selectedVector();
+
   QHash<QString, VectorPtr> vectors;
 
   VectorList vectorList = _store->getObjects<Vector>();
@@ -214,9 +218,6 @@
 
   qSort(list);
 
-  int current_index = _vector->currentIndex();
-  VectorPtr current = selectedVector();
-
   _vector->clear();
   foreach (const QString &string, list) {
     VectorPtr v = vectors.value(string);


More information about the Kst mailing list