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

Barth Netterfield netterfield at astro.utoronto.ca
Tue Sep 15 23:10:00 CEST 2009


SVN commit 1024048 by netterfield:

Fix broken short names.


 M  +1 -1      libkst/math_kst.h  
 M  +1 -0      libkst/matrix.cpp  
 M  +3 -1      libkst/namedobject.cpp  
 M  +2 -0      libkst/scalar.cpp  
 M  +2 -0      libkst/string_kst.cpp  
 M  +2 -0      libkst/vector.cpp  
 M  +4 -1      libkstapp/legenditem.cpp  
 M  +1 -1      libkstapp/legenditem.h  
 M  +9 -5      libkstapp/plotitem.cpp  
 M  +2 -0      libkstapp/plotitem.h  
 M  +1 -2      libkstapp/plotitemdialog.cpp  
 M  +2 -2      libkstapp/viewitem.cpp  
 M  +9 -6      libkstapp/viewitemdialog.cpp  
 M  +2 -0      libkstmath/csd.cpp  
 M  +1 -0      libkstmath/curve.cpp  
 M  +1 -0      libkstmath/equation.cpp  
 M  +3 -0      libkstmath/eventmonitorentry.cpp  
 M  +2 -1      libkstmath/eventmonitorentry.h  
 M  +1 -0      libkstmath/histogram.cpp  
 M  +2 -0      libkstmath/image.cpp  
 M  +1 -0      libkstmath/psd.cpp  


--- branches/work/kst/portto4/kst/src/libkst/math_kst.h #1024047:1024048
@@ -1,7 +1,7 @@
 /***************************************************************************
  *                                                                         *
  *   copyright : (C) 2004 The University of Toronto                        *
-*                                                                         *
+ *                                                                         *
  *   This program is free software; you can redistribute it and/or modify  *
  *   it under the terms of the GNU General Public License as published by  *
  *   the Free Software Foundation; either version 2 of the License, or     *
--- branches/work/kst/portto4/kst/src/libkst/matrix.cpp #1024047:1024048
@@ -45,6 +45,7 @@
     : Primitive(store, 0L), _NS(0), _NRealS(0), _nX(1), _nY(0), _minX(0), _minY(0), _stepX(1), _stepY(1),
       _editable(false), _saveable(false), _z(0L), _zSize(0) {
 
+  _initializeShortName();
   createScalars(store);
 
 }
--- branches/work/kst/portto4/kst/src/libkst/namedobject.cpp #1024047:1024048
@@ -35,7 +35,6 @@
   _initial_lnum = _lnum; // legend
   _initial_dnum = _dnum; // view image
 
-  _initializeShortName();
 }
 
 NamedObject::~NamedObject() {
@@ -207,6 +206,9 @@
   max_dnum = 0;
 }
 
+//void NamedObject::_initializeShortName() {
+//}
+
 // QString NamedObject::descriptionTip() const {
 //   return Name();
 // }
--- branches/work/kst/portto4/kst/src/libkst/scalar.cpp #1024047:1024048
@@ -46,6 +46,8 @@
 Scalar::Scalar(ObjectStore *store)
     : Primitive(store, 0L), _value(0.0), _orphan(false), _displayable(true), _editable(false) {
 
+  _initializeShortName();
+
 }
 
 void Scalar::_initializeShortName() {
--- branches/work/kst/portto4/kst/src/libkst/string_kst.cpp #1024047:1024048
@@ -30,6 +30,8 @@
 String::String(ObjectStore *store)
     : Primitive(store, 0L), _value(QString::null), _orphan(false), _editable(false) {
 
+  _initializeShortName();
+
 }
 
 void String::_initializeShortName() {
--- branches/work/kst/portto4/kst/src/libkst/vector.cpp #1024047:1024048
@@ -44,6 +44,8 @@
 Vector::Vector(ObjectStore *store)
     : Primitive(store, 0L), _nsum(0) {
 
+  _initializeShortName();
+
   _editable = false;
   NumShifted = 0;
   NumNew = 0;
--- branches/work/kst/portto4/kst/src/libkstapp/legenditem.cpp #1024047:1024048
@@ -38,6 +38,8 @@
   : ViewItem(parent->parentView()), _plotItem(parent), _auto(true), _fontScale(0.0), _verticalDisplay(true) {
   setTypeName("Legend");
 
+  _initializeShortName();
+
   setAllowedGripModes(Move /*| Resize*/ /*| Rotate*/ /*| Scale*/);
 
   setViewRect(0.0, 0.0, 0.0, 0.0);
@@ -46,12 +48,13 @@
 
   QPointF origin = QPointF(parent->width() / 10, parent->height() / 5);
   setPos(origin);
+}
 
+void LegendItem::_initializeShortName() {
   _shortName = "L"+QString::number(_lnum);
   if (_lnum>max_lnum)
     max_lnum = _lnum;
   _lnum++;
-
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/legenditem.h #1024047:1024048
@@ -62,7 +62,7 @@
 
   protected:
     virtual QString _automaticDescriptiveName() const;
-
+    virtual void _initializeShortName();
   private:
     QSize paintRelation(RelationPtr relation, QPixmap *pixmap, const QFont &font);
 
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #1024047:1024048
@@ -95,6 +95,8 @@
   _i_per(0)
 {
   setTypeName("Plot");
+  _initializeShortName();
+
   setBrush(Qt::white);
 
   setSupportsTiedZoom(true);
@@ -135,11 +137,6 @@
   setProjectionRect(QRectF(QPointF(-0.1, -0.1), QPointF(0.1, 0.1)));
   renderItem(PlotRenderItem::Cartesian);
 
-  _shortName = "P"+QString::number(_plotnum);
-  if (_plotnum>max_plotnum)
-    max_plotnum = _plotnum;
-  _plotnum++;
-
   setPlotBordersDirty(true);
   connect(this, SIGNAL(triggerRedraw()), this, SLOT(redrawPlot()));
   connect(this, SIGNAL(geometryChanged()), this, SLOT(setLabelsDirty()));
@@ -160,7 +157,14 @@
   PlotItemManager::self()->removePlot(this);
 }
 
+void PlotItem::_initializeShortName() {
+  _shortName = "P"+QString::number(_plotnum);
+  if (_plotnum>max_plotnum)
+    max_plotnum = _plotnum;
+  _plotnum++;
 
+}
+
 QString PlotItem::plotName() const {
   return Name();
 }
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.h #1024047:1024048
@@ -248,6 +248,8 @@
 
   protected:
     virtual QString _automaticDescriptiveName() const;
+    virtual void _initializeShortName();
+
     virtual void mousePressEvent(QGraphicsSceneMouseEvent *event);
     virtual void updateChildGeometry(const QRectF &oldParentRect, const QRectF &newParentRect);
 
--- branches/work/kst/portto4/kst/src/libkstapp/plotitemdialog.cpp #1024047:1024048
@@ -22,7 +22,6 @@
 #include "objectstore.h"
 #include "mainwindow.h"
 #include "document.h"
-#include "plotitemmanager.h"
 
 #include "curve.h"
 #include "curvedialog.h"
@@ -134,7 +133,7 @@
     setTagString(_defaultTagString);
   }
 
-  QList<PlotItem*> list = PlotItemManager::plotsForView(_plotItem->parentView());
+  QList<PlotItem*> list = ViewItem::getItems<PlotItem>();
   clearMultipleEditOptions();
   foreach(PlotItem* plot, list) {
     addMultipleEditOption(plot->plotName(), plot->descriptionTip(), plot->shortName());
--- branches/work/kst/portto4/kst/src/libkstapp/viewitem.cpp #1024047:1024048
@@ -44,7 +44,7 @@
 namespace Kst {
 
 ViewItem::ViewItem(View *parent)
-  : QObject(parent),
+  : QObject(parent), NamedObject(),
     _isXTiedZoom(false),
     _isYTiedZoom(false),
     _gripMode(Move),
@@ -70,7 +70,7 @@
     _parentRelativeHeight(0),
     _parentRelativeWidth(0)
  {
-
+  _initializeShortName();
   setZValue(DRAWING_ZORDER);
   setAcceptsHoverEvents(true);
   setFlags(ItemIsMovable | ItemIsSelectable | ItemIsFocusable);
--- branches/work/kst/portto4/kst/src/libkstapp/viewitemdialog.cpp #1024047:1024048
@@ -147,6 +147,9 @@
     if (_multiNameShortName.contains(name)) {
       QString shortName = _multiNameShortName[name];
       foreach (ViewItem *item, allItiems) {
+        if (item->shortName() == shortName) {
+          selectedItems.append(item);
+        }
       }
     //  selectedItems.append(multiItems[name]);
     }
@@ -327,9 +330,11 @@
 void ViewItemDialog::dimensionsChanged() {
   Q_ASSERT(_item);
   if (_mode == Multiple) {
-    foreach(ViewItem* item, selectedMultipleEditObjects()) {
-      saveDimensions(item);
-    }
+    // FIXME: what makes sense for edit multiple in here?
+    // decide, then make it work.  Probably rotation.  Maybe size.
+    //foreach(ViewItem* item, selectedMultipleEditObjects()) {
+    //  saveDimensions(item);
+    //}
   } else {
     saveDimensions(_item);
   }
@@ -380,9 +385,7 @@
     item->setLockAspectRatio(false);
   }
 
-  if (_mode != Multiple) {
-    item->setPos(parentX + _dimensionsTab->x()*parentWidth, parentY + _dimensionsTab->y()*parentHeight);
-  }
+  item->setPos(parentX + _dimensionsTab->x()*parentWidth, parentY + _dimensionsTab->y()*parentHeight);
   item->setViewRect(-width/2, -height/2, width, height);
 
   qreal rotation = _dimensionsTab->rotationDirty() ? _dimensionsTab->rotation() :item->rotationAngle();
--- branches/work/kst/portto4/kst/src/libkstmath/csd.cpp #1024047:1024048
@@ -44,6 +44,8 @@
   _typeString = staticTypeString;
   _type = "Cumulative Spectral Decay";
 
+  _initializeShortName();
+
   Q_ASSERT(store);
   MatrixPtr outMatrix = store->createObject<Matrix>();
   outMatrix->setProvider(this);
--- branches/work/kst/portto4/kst/src/libkstmath/curve.cpp #1024047:1024048
@@ -79,6 +79,7 @@
   NS = 0;
   _typeString = i18n("Curve");
   _type = "Curve";
+  _initializeShortName();
   Color = QColor();
 }
 
--- branches/work/kst/portto4/kst/src/libkstmath/equation.cpp #1024047:1024048
@@ -57,6 +57,7 @@
   _pe = 0L;
   _typeString = i18n("Equation");
   _type = "Equation";
+  _initializeShortName();
 
   Q_ASSERT(store);
   _xOutVector = store->createObject<Vector>();
--- branches/work/kst/portto4/kst/src/libkstmath/eventmonitorentry.cpp #1024047:1024048
@@ -72,6 +72,7 @@
 
   _typeString = staticTypeString;
   _type = "Event";
+  _initializeShortName();
 
   VectorPtr xv = store->createObject<Vector>();
   xv->resize(NS);
@@ -84,6 +85,8 @@
   _yVector = _outputVectors.insert(OUTYVECTOR, yv);
 }
 
+void EventMonitorEntry::_initializeShortName() {
+}
 
 bool EventMonitorEntry::reparse() {
   _isValid = false;
--- branches/work/kst/portto4/kst/src/libkstmath/eventmonitorentry.h #1024047:1024048
@@ -81,7 +81,8 @@
 
     friend class ObjectStore;
 
-    QString _automaticDescriptiveName() const;
+    virtual QString _automaticDescriptiveName() const;
+    virtual void _initializeShortName();
 
     bool event(QEvent *e);
 
--- branches/work/kst/portto4/kst/src/libkstmath/histogram.cpp #1024047:1024048
@@ -42,6 +42,7 @@
   setRealTimeAutoBin(false);
   _typeString = staticTypeString;
   _type = "Histogram";
+  _initializeShortName();
 
   // _Bins, _bVector and _hVector need to be valid, 
   // so initialize them as size 2 (where 2 is a small valid number)
--- branches/work/kst/portto4/kst/src/libkstmath/image.cpp #1024047:1024048
@@ -38,6 +38,8 @@
 Image::Image(ObjectStore *store) : Relation(store) {
   _typeString = staticTypeString;
   _type = "Image";
+  _initializeShortName();
+
   _hasContourMap = false;
   _hasColorMap = false;
   setColorDefaults();
--- branches/work/kst/portto4/kst/src/libkstmath/psd.cpp #1024047:1024048
@@ -51,6 +51,7 @@
 : DataObject(store) {
   _typeString = staticTypeString;
   _type = "PowerSpectrum";
+  _initializeShortName();
 
   Q_ASSERT(store);
   VectorPtr ov = store->createObject<Vector>();


More information about the Kst mailing list