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

Barth Netterfield netterfield at astro.utoronto.ca
Thu Sep 17 16:05:10 CEST 2009


SVN commit 1024901 by netterfield:

Fix names in basicplugin.
Get rid of inf() warning.
Fix legend placement.
Basic multi-edit functionality for legends.



 M  +0 -1      devel-docs/Kst2Specs/Bugs  
 M  +1 -0      src/datasources/ascii/ascii.cpp  
 M  +3 -10     src/datasources/ascii/ascii.pro  
 A             src/libkst/kst_inf.h   [License: UNKNOWN]
 M  +0 -22     src/libkst/math_kst.h  
 M  +3 -0      src/libkstapp/datawizard.cpp  
 M  +4 -2      src/libkstapp/legenditem.cpp  
 M  +6 -0      src/libkstapp/legenditemdialog.cpp  
 M  +2 -0      src/libkstapp/plotitem.cpp  
 M  +10 -6     src/libkstapp/viewitemdialog.cpp  
 M  +9 -5      src/libkstmath/basicplugin.cpp  
 M  +1 -1      src/libkstmath/basicplugin.h  
 M  +2 -0      tests/testdatasource.cpp  
 M  +1 -0      tests/testeqparser.cpp  
 M  +2 -0      tests/testscalar.cpp  


--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Bugs #1024900:1024901
@@ -9,4 +9,3 @@
 
 Artifacts when resizing large arrowheads.
 
-
--- branches/work/kst/portto4/kst/src/datasources/ascii/ascii.cpp #1024900:1024901
@@ -35,6 +35,7 @@
 #include <QXmlStreamAttributes>
 
 #include <math_kst.h>
+#include <kst_inf.h>
 #include "ascii.h"
 #include "ui_asciiconfig.h"
 #include "kst_i18n.h"
--- branches/work/kst/portto4/kst/src/datasources/ascii/ascii.pro #1024900:1024901
@@ -1,15 +1,8 @@
 include($$PWD/../../../kst.pri)
 include($$PWD/../../../datasourceplugin.pri)
-
 TARGET = kstdata_ascii
-
 INCLUDEPATH += $$OUTPUT_DIR/src/datasources/ascii/tmp
-
-
-SOURCES += \
-    ascii.cpp
-
-HEADERS += \
-    ascii.h
-
+SOURCES += ascii.cpp
+HEADERS += ascii.h \
+    ../../libkst/kst_inf.h
 FORMS += asciiconfig.ui
--- branches/work/kst/portto4/kst/src/libkst/math_kst.h #1024900:1024901
@@ -25,28 +25,6 @@
 
 #include "kst_export.h"
 
-
-#if !defined(INF)
-#include <qconfig.h>
-static double inf__()
-{
-  /* work around some strict alignment requirements
-     for double variables on some architectures (e.g. PA-RISC) */
-  typedef union { unsigned char b[8]; double d; } kjs_double_t;
-#if Q_BYTE_ORDER == Q_BIG_ENDIAN
-  static const kjs_double_t Inf_Bytes = { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } };
-#elif defined(arm)
-  static const kjs_double_t Inf_Bytes = { { 0, 0, 0xf0, 0x7f, 0, 0, 0, 0 } };
-#else
-  static const kjs_double_t Inf_Bytes = { { 0, 0, 0, 0, 0, 0, 0xf0, 0x7f } };
-#endif
-
-  const double Inf = Inf_Bytes.d;
-  return Inf;
-}
-#define INF (::inf__())
-#endif
-
 namespace Kst {
 /*
 ** For systems without NAN, this is a NAN in IEEE double format.
--- branches/work/kst/portto4/kst/src/libkstapp/datawizard.cpp #1024900:1024901
@@ -957,6 +957,9 @@
     plot->update();
     plot->parentView()->appendToLayout(_pagePlot->layout(), plot, _pagePlot->gridColumns());
 
+  }
+
+  foreach (PlotItem* plot, plotList) {
     if (_pagePlot->legendsOn()) {
       plot->setShowLegend(true);
       plot->legend()->setFontScale(fontScale);
--- branches/work/kst/portto4/kst/src/libkstapp/legenditem.cpp #1024900:1024901
@@ -46,8 +46,9 @@
   parentView()->scene()->addItem(this);
   setParent(_plotItem);
 
-  QPointF origin = QPointF(parent->width() / 10, parent->height() / 5);
+  QPointF origin = QPointF(parent->width() * 0.15, parent->height() * 0.15);
   setPos(origin);
+
 }
 
 void LegendItem::_initializeShortName() {
@@ -96,7 +97,8 @@
     legendPixmaps.append(item);
   }
 
-  int x = 0, y = 0;
+  int x = rect().left();
+  int y = rect().top();
 
   painter->save();
 
--- branches/work/kst/portto4/kst/src/libkstapp/legenditemdialog.cpp #1024900:1024901
@@ -45,6 +45,12 @@
   setSupportsMultipleEdit(true);
 
   QList<LegendItem *> legends = ViewItem::getItems<LegendItem>();
+
+  clearMultipleEditOptions();
+  foreach(LegendItem* legend, legends) {
+    addMultipleEditOption(legend->Name(), legend->descriptionTip(), legend->shortName());
+  }
+
 }
 
 
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #1024900:1024901
@@ -2328,6 +2328,8 @@
   if (!_legend) {
     _legend = new LegendItem(this);
     _legend->setVisible(false);
+    _legend->setPos(rect().x() + width()*0.15, rect().y() + height()*0.15);
+    _legend->updateRelativeSize();
   }
   return _legend;
 }
--- branches/work/kst/portto4/kst/src/libkstapp/viewitemdialog.cpp #1024900:1024901
@@ -330,11 +330,9 @@
 void ViewItemDialog::dimensionsChanged() {
   Q_ASSERT(_item);
   if (_mode == Multiple) {
-    // FIXME: what makes sense for edit multiple in here?
-    // decide, then make it work.  Probably rotation.  Maybe size.
-    //foreach(ViewItem* item, selectedMultipleEditObjects()) {
-    //  saveDimensions(item);
-    //}
+    foreach(ViewItem* item, selectedMultipleEditObjects()) {
+      saveDimensions(item);
+    }
   } else {
     saveDimensions(_item);
   }
@@ -385,7 +383,13 @@
     item->setLockAspectRatio(false);
   }
 
-  item->setPos(parentX + _dimensionsTab->x()*parentWidth, parentY + _dimensionsTab->y()*parentHeight);
+
+  if (_mode == Multiple) {
+    item->setPos(parentX + item->relativeCenter().x()*parentWidth,
+                 parentY + item->relativeCenter().y()*parentHeight);
+  } else {
+    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/basicplugin.cpp #1024900:1024901
@@ -36,18 +36,22 @@
   _typeString = i18n("Plugin");
   _type = "Plugin";
 
+  _initializeShortName();
+}
+
+
+BasicPlugin::~BasicPlugin() {
+}
+
+void BasicPlugin::_initializeShortName() {
   _shortName = "P"+QString::number(_pnum);
-  if (_pnum>max_pnum) 
+  if (_pnum>max_pnum)
     max_pnum = _pnum;
   _pnum++;
 
 }
 
 
-BasicPlugin::~BasicPlugin() {
-}
-
-
 void BasicPlugin::setPluginName(const QString &pluginName) {
   _pluginName = pluginName;
 }
--- branches/work/kst/portto4/kst/src/libkstmath/basicplugin.h #1024900:1024901
@@ -101,7 +101,7 @@
 
     virtual QString parameterName(int index) const;
     QString _errorString;
-
+    virtual void _initializeShortName();
   private:
     bool inputsExist() const;
     void updateOutput() const;
--- branches/work/kst/portto4/kst/tests/testdatasource.cpp #1024900:1024901
@@ -19,6 +19,8 @@
 #include <QTemporaryFile>
 
 #include <math_kst.h>
+#include <kst_inf.h>
+
 #include <datacollection.h>
 #include <objectstore.h>
 
--- branches/work/kst/portto4/kst/tests/testeqparser.cpp #1024900:1024901
@@ -14,6 +14,7 @@
 #include <QtTest>
 
 #include <math_kst.h>
+#include <kst_inf.h>
 #include <enodes.h>
 #include <eparse-eh.h>
 #include <objectstore.h>
--- branches/work/kst/portto4/kst/tests/testscalar.cpp #1024900:1024901
@@ -20,6 +20,8 @@
 #undef protected
 
 #include <math_kst.h>
+#include <kst_inf.h>
+
 #include <datacollection.h>
 #include <objectstore.h>
 


More information about the Kst mailing list