[Kst] extragear/graphics/kst/kst

Andrew Walker arwalker at sumusltd.com
Tue Dec 20 22:37:09 CET 2005


SVN commit 490135 by arwalker:

no longer ignore user settings simply because there are no curves in a legend

 M  +31 -43    kstviewlegend.cpp  


--- trunk/extragear/graphics/kst/kst/kstviewlegend.cpp #490134:490135
@@ -54,14 +54,20 @@
 
 KstViewLegend::KstViewLegend()
 : KstBorderedViewObject("Legend") {
-  _container = false;
-  _rotation = 0;
-  _vertical = true;
-  _fontName = KstApp::inst()->defaultFont();
   _fontSize = 0;
+  setFontSize(_fontSize);
+  setForegroundColor(KstSettings::globalSettings()->foregroundColor);
+  setFontName(KstApp::inst()->defaultFont());
+  
+  setTransparent(false);
   setBorderWidth(2);
+  setBorderColor(KstSettings::globalSettings()->foregroundColor);
+  setBackgroundColor(KstSettings::globalSettings()->backgroundColor);
   setPadding(5);
-  _absFontSize = _fontSize+KstSettings::globalSettings()->plotFontSize;
+  setVertical(true);
+  
+  _container = false;
+  _rotation = 0;
   _layoutActions &= ~(MoveTo | Copy | CopyTo);
   _standardActions |= Delete | Edit;
   computeTextSize();
@@ -266,7 +272,7 @@
     }
     bool d = dirty();
     if (d) {
-      adjustSizeForText(p.window()); // calls computeTextSize and drawToBuffer
+      adjustSizeForText(p.window());
       drawToBuffer();
     }
 
@@ -437,46 +443,28 @@
 
   KstBaseCurveList allCurves = kstObjectSubList<KstDataObject, KstBaseCurve>(KST::dataObjectList);
 
-  if (_curves.isEmpty()) { // its probably new: set widget to defaults
-    widget->_fontSize->setValue(0);
-    widget->_fontColor->setColor(KstSettings::globalSettings()->foregroundColor);
-    widget->_font->setCurrentFont(KstApp::inst()->defaultFont());
-    widget->_margin->setValue(5);
-    widget->_boxColors->setForeground(KstSettings::globalSettings()->foregroundColor);
-    widget->_boxColors->setBackground(KstSettings::globalSettings()->backgroundColor);
-    widget->_vertical->setChecked(true);
-    widget->_transparent->setChecked(false);
-    widget->_border->setValue(2);
-    
-    for (KstBaseCurveList::ConstIterator it = allCurves.begin(); it != allCurves.end(); ++it) {
-      (*it)->readLock();
+  widget->_fontSize->setValue(int(fontSize()));
+  widget->_fontColor->setColor(foregroundColor());
+  widget->_font->setCurrentFont(fontName());
+  widget->_transparent->setChecked(transparent());
+  widget->_border->setValue(borderWidth());
+  widget->_boxColors->setForeground(borderColor());
+  widget->_boxColors->setBackground(backgroundColor());
+  widget->_margin->setValue(padding());
+  widget->_vertical->setChecked(vertical());
+  for (KstBaseCurveList::ConstIterator it = _curves.begin(); it != _curves.end(); ++it) {
+    (*it)->readLock();
+    widget->DisplayedCurveList->insertItem((*it)->tagName());
+    (*it)->readUnlock();
+  }
+  for (KstBaseCurveList::ConstIterator it = allCurves.begin(); it != allCurves.end(); ++it) {
+    (*it)->readLock();
+    if (_curves.find(*it) == _curves.end()) {
       widget->AvailableCurveList->insertItem((*it)->tagName());
-      (*it)->readUnlock();
     }
-
-  } else { // fill legend properties into widget
-    widget->_fontSize->setValue(int(fontSize()));
-    widget->_fontColor->setColor(foregroundColor());
-    widget->_font->setCurrentFont(fontName());
-    widget->_transparent->setChecked(transparent());
-    widget->_border->setValue(borderWidth());
-    widget->_boxColors->setForeground(borderColor());
-    widget->_boxColors->setBackground(backgroundColor());
-    widget->_margin->setValue(padding());
-    widget->_vertical->setChecked(vertical());
-    for (KstBaseCurveList::ConstIterator it = _curves.begin(); it != _curves.end(); ++it) {
-      (*it)->readLock();
-      widget->DisplayedCurveList->insertItem((*it)->tagName());
-      (*it)->readUnlock();
-    }
-    for (KstBaseCurveList::ConstIterator it = allCurves.begin(); it != allCurves.end(); ++it) {
-      (*it)->readLock();
-      if (_curves.find(*it) == _curves.end()) {
-        widget->AvailableCurveList->insertItem((*it)->tagName());
-      }
-      (*it)->readUnlock();
-    }
+    (*it)->readUnlock();
   }
+
   return false;
 }
 


More information about the Kst mailing list