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

Barth Netterfield netterfield at astro.utoronto.ca
Wed Dec 12 07:17:15 CET 2007


SVN commit 747502 by netterfield:

Some tagname work.

Add color sequence to color appearance widget.



 M  +1 -1      libkstapp/curvedialog.cpp  
 M  +0 -1      libkstapp/databutton.cpp  
 M  +2 -1      libkstapp/datadialog.cpp  
 M  +5 -2      libkstapp/vectordialog.cpp  
 M  +15 -0     libkstmath/colorsequence.cpp  
 M  +1 -0      libkstmath/colorsequence.h  
 M  +7 -3      widgets/curveappearance.cpp  
 M  +1 -1      widgets/curveappearance.h  


--- branches/work/kst/portto4/kst/src/libkstapp/curvedialog.cpp #747501:747502
@@ -503,7 +503,7 @@
       curve->update(0);
       curve->unlock();
 
-      _curveTab->curveAppearance()->setWidgetDefaults();
+      _curveTab->curveAppearance()->setWidgetDefaults(false);
     }
   }
   return dataObject();
--- branches/work/kst/portto4/kst/src/libkstapp/databutton.cpp #747501:747502
@@ -24,7 +24,6 @@
   setStyleSheet("QPushButton {"
                   "border: 0px solid;"
                   "background-color: white;"
-                  "text-align: left;"
                   "margin: 5;"
                 "}"
 
--- branches/work/kst/portto4/kst/src/libkstapp/datadialog.cpp #747501:747502
@@ -83,7 +83,8 @@
   connect(button, SIGNAL(clicked()), this, SLOT(slotEditMultiple()));
 
   if (_dataObject) {
-    setTagString(_dataObject->tag().tagString()); // FIXME: should this be displayString()?
+    //setTagString(_dataObject->tag().tagString()); // FIXME: should this be displayString()?
+    setTagString(_dataObject->tag().name());
   } else {
     setTagString(_defaultTagString);
     button->setVisible(false);
--- branches/work/kst/portto4/kst/src/libkstapp/vectordialog.cpp #747501:747502
@@ -480,9 +480,12 @@
         dataRange->skip(),
         dataRange->doSkip(),
         dataRange->doFilter());
-      
-      // FIXME update the data vector tag, if it changed!
 
+      if (dataVector->tag().name()!=tagString()) {
+	//FIXME: needs a gaurd against being not unique
+	dataVector->tag().setName(tagString()); 
+      }
+
       dataVector->update(0);
       dataVector->unlock();
 
--- branches/work/kst/portto4/kst/src/libkstmath/colorsequence.cpp #747501:747502
@@ -159,7 +159,22 @@
   return _self->_pal.value( _self->_ptr++ % _self->_count).dark(dark_factor);
 }
 
+QColor ColorSequence::current() {
+  if (!_self) {
+    _self = new ColorSequence;
+    qAddPostRoutine(ColorSequence::cleanup);
+  }
+  _self->createPalette();
 
+  if (_self->_ptr >= _self->_count * 2) {
+    _self->_ptr = 0;
+  }
+
+  int dark_factor = 100 + ( 50 * ( _self->_ptr / _self->_count ) );
+  return _self->_pal.value( _self->_ptr % _self->_count).dark(dark_factor);
+}
+
+
 QColor ColorSequence::next(const QColor& badColor) {
   QColor color;
   int dark_factor;
--- branches/work/kst/portto4/kst/src/libkstmath/colorsequence.h #747501:747502
@@ -25,6 +25,7 @@
     enum ColorMode { MonoChrome, GrayScale, Color };
     KST_EXPORT void createPalette();
     static KST_EXPORT QColor next();
+    static KST_EXPORT QColor current();
     static KST_EXPORT QColor next(const QColor& badColor);
     static KST_EXPORT QColor next(const CurveList& Curves, const QColor& badColor);
     static KST_EXPORT bool colorsTooClose(const QColor& color, const QColor& badColor);
--- branches/work/kst/portto4/kst/src/widgets/curveappearance.cpp #747501:747502
@@ -15,6 +15,7 @@
 #include "linestyle.h"
 #include <QPainter>
 #include "dialogdefaults.h"
+#include "colorsequence.h"
 
 namespace Kst {
 
@@ -384,9 +385,11 @@
   _label->setPixmap(pix);
 }
 
-// store the current state of the widget as the default
-void CurveAppearance::setWidgetDefaults() {
-  //color();
+// store the current state of the widget as the default 
+void CurveAppearance::setWidgetDefaults(bool nextColor) {
+  if (nextColor) {
+    ColorSequence::next();
+  }
   _dialogDefaults->setValue("curves/showPoints",showPoints());
   _dialogDefaults->setValue("curves/showLines", showLines());
   _dialogDefaults->setValue("curves/showBars",showBars());
@@ -399,6 +402,7 @@
 
 // set the widget to the stored default values
 void CurveAppearance::loadWidgetDefaults() {
+  setColor(ColorSequence::current());
   setShowPoints(_dialogDefaults->value("curves/showPoints",false).toBool());
   setShowLines(_dialogDefaults->value("curves/showLines",true).toBool());
   setShowBars(_dialogDefaults->value("curves/showBars",false).toBool());
--- branches/work/kst/portto4/kst/src/widgets/curveappearance.h #747501:747502
@@ -63,7 +63,7 @@
 
     void clearValues();
 
-    void setWidgetDefaults();
+    void setWidgetDefaults(bool nextColor = true);
     void loadWidgetDefaults();
 
   private slots:


More information about the Kst mailing list