[Kst] kdeextragear-2/kst/kst (silent)

Andrew Walker arwalker at sumusltd.com
Fri Mar 4 00:00:29 CET 2005


CVS commit by arwalker: 

Previously the min/max values for the histogram properties would be incorrectly reported as they did not account for the width of a bar. Thus, if you opened the Edit Histogram dialog and hit OK the min/max values would change even though you hadn't modified any values. This has been fixed.

CVS_SILENT


  M +3 -2      ksthistogram.cpp   1.49
  M +1 -0      ksthistogram.h   1.31
  M +14 -15    ksthsdialog_i.cpp   1.81


--- kdeextragear-2/kst/kst/ksthistogram.cpp  #1.48:1.49
@@ -400,7 +400,8 @@ void KstHistogram::AutoBin(KstVectorPtr 
     *min = m;
   }
+  
   if (*max == *min) {
-    *max += 1;
-    *min -= 1;
+    *max += 1.0;
+    *min -= 1.0;
   }
 

--- kdeextragear-2/kst/kst/ksthistogram.h  #1.30:1.31
@@ -84,4 +84,5 @@ public:
   double xMin() const { return _MinX; }
   double xMax() const { return _MaxX; }
+  double width() const { return _W; }
 
 private:

--- kdeextragear-2/kst/kst/ksthsdialog_i.cpp  #1.80:1.81
@@ -95,6 +95,6 @@ void KstHsDialogI::_fillFieldsForEdit() 
 
   N->setValue(DP->nBins());
-  Min->setText(QString::number(DP->vX()->min()));
-  Max->setText(QString::number(DP->vX()->max()));
+  Min->setText(QString::number(DP->vX()->min() - (DP->width()/2.0)));
+  Max->setText(QString::number(DP->vX()->max() + (DP->width()/2.0)));
   _realTimeAutoBin->setChecked(DP->realTimeAutoBin());
 
@@ -124,11 +124,11 @@ void KstHsDialogI::_fillFieldsForEdit() 
 
 void KstHsDialogI::_fillFieldsForNew() {
-  /* set tag name */
+  // set tag name
   _tagName->setText(defaultTag);
 
-  /* set the curve placement window  */
+  // set the curve placement window
   _curvePlacement->update();
 
-  //for some reason the lower widget needs to be shown first to prevent overlapping?
+  // for some reason the lower widget needs to be shown first to prevent overlapping?
   _curveAppearance->hide();
   _curvePlacement->show();
@@ -158,5 +158,5 @@ bool KstHsDialogI::new_I() {
   }
 
-  /* verify that the curve name is unique */
+  // verify that the curve name is unique
   if (KST::dataTagNameNotUnique(tag_name)) {
     _tagName->setFocus();
@@ -170,5 +170,5 @@ bool KstHsDialogI::new_I() {
   }
 
-  /* find max and min */
+  // find max and min
   double new_min = Min->text().toDouble();
   double new_max = Max->text().toDouble();
@@ -274,5 +274,5 @@ bool KstHsDialogI::new_I() {
 
 bool KstHsDialogI::edit_I() {
-  /* verify that the curve name is unique */
+  // verify that the curve name is unique
   QString tag_name = _tagName->text();
   if (tag_name != DP->tagName() && KST::dataTagNameNotUnique(tag_name)) {
@@ -281,8 +281,8 @@ bool KstHsDialogI::edit_I() {
   }
 
-  /* find max and min */
+  // find max and min
   double new_min = Min->text().toDouble();
   double new_max = Max->text().toDouble();
-  if (new_max<new_min) {
+  if (new_max < new_min) {
     double m = new_max;
     new_max = new_min;
@@ -298,6 +298,5 @@ bool KstHsDialogI::edit_I() {
   int new_n_bins = N->text().toInt();
   if (new_n_bins < 1) {
-    KMessageBox::sorry(this, i18n("You must have one or more bins "
-                                "in a histogram."));
+    KMessageBox::sorry(this, i18n("You must have one or more bins in a histogram."));
     N->setFocus();
     return false;
@@ -339,6 +338,8 @@ void KstHsDialogI::autoBin() {
 
   if (!KST::vectorList.isEmpty()) {
-    /* find *V */
     KstVectorList::Iterator i = KST::vectorList.findTag(_vector->selectedVector());
+    double max, min;
+    int n;
+    
     if (i == KST::vectorList.end()) {
       kdFatal() << "Bug in kst: the Vector field in hsdialog refers to "
@@ -346,6 +347,4 @@ void KstHsDialogI::autoBin() {
     }
     (*i)->readLock(); // Hmm should we really lock here?  AutoBin should I think
-    double max, min;
-    int n;
     KstHistogram::AutoBin(KstVectorPtr(*i), &n, &max, &min);
     (*i)->readUnlock();




More information about the Kst mailing list