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

Barth Netterfield netterfield at astro.utoronto.ca
Tue Jan 19 02:11:49 CET 2010


SVN commit 1076882 by netterfield:

Improve selection behavior of change file and change data sample range dialogs,
as per request by MT.



 M  +9 -0      devel-docs/Kst2Specs/FixedBugs  
 M  +17 -4     devel-docs/Kst2Specs/Wishlist  
 M  +56 -11    src/libkstapp/changedatasampledialog.cpp  
 M  +85 -13    src/libkstapp/changefiledialog.cpp  


--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/FixedBugs #1076881:1076882
@@ -1163,3 +1163,12 @@
 increase size as the plot expands.  This doesn't look proportioned
 correctly.  
 
+--------------------
+
+Change data samples range is clumsy to use.  I don't think that it
+should default to having none of the vectors selected.  Rather, I think
+it should default to all preselected (or better, all preselected if
+you've never used the dialog before, but to remember which were selected
+from before and default to those).  Certainly, when you make some
+changes and hit apply (without closing the dialog box), the vectors you
+have selected shouldn't become unselected; they should remain.  
--- branches/work/kst/portto4/kst/devel-docs/Kst2Specs/Wishlist #1076881:1076882
@@ -32,6 +32,10 @@
 
 --------
 
+Edit multiple for vectors
+
+--------
+
 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).
@@ -63,11 +67,20 @@
 
 --------------------
 
-Perhaps unrelated to kst, but the new symbolic link name in defile
-(replacing the defile.cur indirect file) is retarded.  It slows me down
-and the double extension is pointless.  
+Thread kst2
 
 --------------------
 
-Thread kst2
+When you have many plots on a window (like 35), and the numbers in
+the axis labels are large, they often overwrite each other (so you can't
+tell any of the numbers apart).  
 
+--------------------
+
+Plot widths with live data are variable depending on the axis numbers
+position.  If, for example, you're plotting live data as a function of
+INDEX and INDEX is in the hundreds of thousands, when the major tick for
+INDEX is near the edge of the plot, the plot will get narrower so that
+the axis number can fit in the window.  I don't think that plots should
+change size at all when data is live.  
+
--- branches/work/kst/portto4/kst/src/libkstapp/changedatasampledialog.cpp #1076881:1076882
@@ -118,22 +118,67 @@
   updateButtons();
 }
 
+void ChangeDataSampleDialog::updateCurveListDialog() {
 
-void ChangeDataSampleDialog::updateCurveListDialog() {
-  _vectorList->clear();
-  _selectedVectorList->clear();
   DataVectorList dataVectors = _store->getObjects<DataVector>();
+  _vectorList->blockSignals(true);
 
-  _vectorList->blockSignals(true);
-  for (DataVectorList::ConstIterator i = dataVectors.begin(); i != dataVectors.end(); ++i) {
-    DataVectorPtr vector = *i;
-    vector->readLock();
-    QListWidgetItem *wi = new QListWidgetItem(vector->Name());
-    wi->setToolTip(vector->descriptionTip());
-    vector->unlock();
-    _vectorList->addItem(wi);
+  _vectorList->clearSelection();
+  _selectedVectorList->clearSelection();
+
+  // make sure all items in _vectorList exist in the store; remove if they don't.
+  for (int i_item = 0; i_item < _vectorList->count(); i_item++) {
+    bool exists=false;
+    for (int i_vector = 0; i_vector<dataVectors.count(); i_vector++) {
+      if (dataVectors.at(i_vector)->Name() == _vectorList->item(i_item)->text()) {
+        exists = true;
+        break;
+      }
+    }
+    if (!exists) {
+      QListWidgetItem *item = _vectorList->takeItem(i_item);
+      delete item;
+    }
   }
 
+  // make sure all items in _selectedVectorList exist in the store; remove if they don't.
+  for (int i_item = 0; i_item<_selectedVectorList->count(); i_item++) {
+    bool exists=false;
+    for (int i_vector = 0; i_vector<dataVectors.count(); i_vector++) {
+      if (dataVectors.at(i_vector)->Name() == _selectedVectorList->item(i_item)->text()) {
+        exists = true;
+        break;
+      }
+    }
+    if (!exists) {
+      QListWidgetItem *item = _selectedVectorList->takeItem(i_item);
+      delete item;
+    }
+  }
+
+  // insert into _vectorList all items in store not in one of the lists.
+  for (int i_vector = 0; i_vector<dataVectors.count(); i_vector++) {
+    bool listed = false;
+    for (int i_item = 0; i_item<_selectedVectorList->count(); i_item++) {
+      if (dataVectors.at(i_vector)->Name() == _selectedVectorList->item(i_item)->text()) {
+        _selectedVectorList->item(i_item)->setToolTip(dataVectors.at(i_vector)->descriptionTip());
+        listed = true;
+        break;
+      }
+    }
+    for (int i_item = 0; i_item<_vectorList->count(); i_item++) {
+      if (dataVectors.at(i_vector)->Name() == _vectorList->item(i_item)->text()) {
+        _vectorList->item(i_item)->setToolTip(dataVectors.at(i_vector)->descriptionTip());
+        listed = true;
+        break;
+      }
+    }
+    if (!listed) {
+      QListWidgetItem *wi = new QListWidgetItem(dataVectors.at(i_vector)->Name());
+      _vectorList->addItem(wi);
+      wi->setToolTip(dataVectors.at(i_vector)->descriptionTip());
+    }
+  }
   _vectorList->blockSignals(false);
 }
 
--- branches/work/kst/portto4/kst/src/libkstapp/changefiledialog.cpp #1076881:1076882
@@ -14,6 +14,9 @@
 #include "datacollection.h"
 #include "datavector.h"
 #include "datamatrix.h"
+#include "datascalar.h"
+#include "datastring.h"
+#include "vscalar.h"
 
 #include "plotitem.h"
 
@@ -133,28 +136,97 @@
 
 
 void ChangeFileDialog::updatePrimitiveList() {
+  /* Make list of data primitives */
   DataVectorList dataVectorList = _store->getObjects<DataVector>();
   DataMatrixList dataMatrixList = _store->getObjects<DataMatrix>();
+  DataScalarList dataScalarList = _store->getObjects<DataScalar>();
+  DataStringList dataStringList = _store->getObjects<DataString>();
+  VScalarList vScalarList = _store->getObjects<VScalar>();
   QStringList fileNameList;
-  int i;
 
-  _changeFilePrimitiveList->clear();
-  _selectedFilePrimitiveList->clear();
+  ObjectList<Primitive> primitives;
 
-  for (i = 0; i < (int)dataVectorList.count(); i++) {
-    dataVectorList[i]->readLock();
-    _changeFilePrimitiveList->addItem(dataVectorList[i]->Name());
-    fileNameList.push_back(dataVectorList[i]->filename());
-    dataVectorList[i]->unlock();
+  foreach (DataVectorPtr V, dataVectorList) {
+    PrimitivePtr P = kst_cast<Primitive>(V);
+    primitives.append(P);
+    fileNameList.append(V->filename());
   }
+  foreach (DataMatrixPtr M, dataMatrixList) {
+    PrimitivePtr P = kst_cast<Primitive>(M);
+    primitives.append(P);
+    fileNameList.append(M->filename());
+  }
+  foreach (DataScalarPtr S, dataScalarList) {
+    PrimitivePtr P = kst_cast<Primitive>(S);
+    primitives.append(P);
+    fileNameList.append(S->filename());
+  }
+  foreach (DataStringPtr S, dataStringList) {
+    PrimitivePtr P = kst_cast<Primitive>(S);
+    primitives.append(P);
+    fileNameList.append(S->filename());
+  }
+  foreach (VScalarPtr V, vScalarList) {
+    PrimitivePtr P = kst_cast<Primitive>(V);
+    primitives.append(P);
+    fileNameList.append(V->filename());
+  }
 
-  for (i = 0; i < (int)dataMatrixList.count(); i++) {
-    dataMatrixList[i]->readLock();
-    _changeFilePrimitiveList->addItem(dataMatrixList[i]->Name());
-    fileNameList.push_back(dataMatrixList[i]->filename());
-    dataMatrixList[i]->unlock();
+  // make sure all items in _changeFilePrimitiveList exist in the store; remove if they don't.
+  for (int i_item = 0; i_item < _changeFilePrimitiveList->count(); i_item++) {
+    bool exists=false;
+    for (int i_primitive = 0; i_primitive<primitives.count(); i_primitive++) {
+      if (primitives.at(i_primitive)->Name() == _changeFilePrimitiveList->item(i_item)->text()) {
+        exists = true;
+        break;
+      }
+    }
+    if (!exists) {
+      QListWidgetItem *item = _changeFilePrimitiveList->takeItem(i_item);
+      delete item;
+    }
   }
 
+  // make sure all items in _selectedFilePrimitiveList exist in the store; remove if they don't.
+  for (int i_item = 0; i_item < _selectedFilePrimitiveList->count(); i_item++) {
+    bool exists=false;
+    for (int i_primitive = 0; i_primitive<primitives.count(); i_primitive++) {
+      if (primitives.at(i_primitive)->Name() == _selectedFilePrimitiveList->item(i_item)->text()) {
+        exists = true;
+        break;
+      }
+    }
+    if (!exists) {
+      QListWidgetItem *item = _selectedFilePrimitiveList->takeItem(i_item);
+      delete item;
+    }
+  }
+
+  // insert into _changeFilePrimitiveList all items in store not in one of the lists.
+  for (int i_primitive = 0; i_primitive<primitives.count(); i_primitive++) {
+    bool listed = false;
+    for (int i_item = 0; i_item<_changeFilePrimitiveList->count(); i_item++) {
+      if (primitives.at(i_primitive)->Name() == _changeFilePrimitiveList->item(i_item)->text()) {
+        _changeFilePrimitiveList->item(i_item)->setToolTip(primitives.at(i_primitive)->descriptionTip());
+        listed = true;
+        break;
+      }
+    }
+    for (int i_item = 0; i_item<_selectedFilePrimitiveList->count(); i_item++) {
+      if (primitives.at(i_primitive)->Name() == _selectedFilePrimitiveList->item(i_item)->text()) {
+        _selectedFilePrimitiveList->item(i_item)->setToolTip(primitives.at(i_primitive)->descriptionTip());
+        listed = true;
+        break;
+      }
+    }
+    if (!listed) {
+      QListWidgetItem *wi = new QListWidgetItem(primitives.at(i_primitive)->Name());
+      _changeFilePrimitiveList->addItem(wi);
+      wi->setToolTip(primitives.at(i_primitive)->descriptionTip());
+    }
+  }
+
+  // fill _files
   QString currentFile = _files->currentText();
   _files->clear();
 


More information about the Kst mailing list