[Kst] extragear/graphics/kst/kst

Barth Netterfield netterfield at astro.utoronto.ca
Wed Nov 2 03:00:35 CET 2005


SVN commit 476785 by netterfield:

ViewLegend starts to exist... but doesn't do anything yet.



 M  +2 -0      Makefile.am  
 M  +23 -0     kst2dplot.cpp  
 M  +4 -0      kst2dplot.h  
 A             kstviewlegend.cpp   [License: GPL (v2+)]
 A             kstviewlegend.h   [License: GPL (v2+)]


--- trunk/extragear/graphics/kst/kst/Makefile.am #476784:476785
@@ -154,6 +154,7 @@
 	kstviewlabel.cpp \
 	kstplotlabel.cpp \
 	kst2dplot.cpp \
+	kstviewlegend.cpp \
 	kstviewbox.cpp \
 	kstviewline.cpp \
 	kstviewellipse.cpp \
@@ -298,6 +299,7 @@
 kstpsddialog_i.lo: psddialogwidget.h
 kstsettingsdlg.lo: kstsettingsdlg.ui.h kstsettingsdlg.ui
 kstviewbox.cpp: editviewobjectdialog.h
+kstviewlegend.cpp: editviewobjectdialog.h
 kstwidgets.lo: comboboxselection.h curveappearancewidget.h curveplacementwidget.h datarangewidget.h editmultiplewidget.h fftoptionswidget.h matrixselector.h scalarselector.h stringselector.h vectorselector.h
 matrixselector.lo: matrixselector.ui.h matrixselector.ui
 plugindialogwidget.lo: curveappearancewidget.h
--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #476784:476785
@@ -59,6 +59,8 @@
 #include "kstviewwindow.h"
 #include "kstviewlabel.h"
 #include "kstvcurve.h"
+#include "kstviewlabel.h"
+#include "kstviewlegend.h"
 #include "plotmimesource.h"
 
 #define INVALIDPLOTPOINT        -1
@@ -577,6 +579,17 @@
   Legend = new KstLegend;
   Legend->setJustification(CxBy);
 
+#if 0
+  KstViewLegendPtr vlp = new KstViewLegend();
+  appendChild(KstViewObjectPtr(vlp), true);
+  
+  KstViewLegend *vl = legend();
+  if (vl != NULL) {
+    vl->resizeFromAspect(0.1, 0.1, 0.2, 0.1);
+    vl->setBorderWidth(2);
+  }
+#endif
+
   // let this Kst2DPlot register doc changes.
   connect(this, SIGNAL(modified()), KstApp::inst(), SLOT(registerDocChange()));
 }
@@ -6575,6 +6588,16 @@
   return _fullTickLabel;
 }
 
+KstViewLegendPtr Kst2DPlot::legend() {
+  for (KstViewObjectList::Iterator i = children().begin(); i != children().end(); ++i) {
+    //KstViewObjectPtr j = *i;
+    KstViewLegendPtr vw = kst_cast<KstViewLegend>(*i);
+    if (vw != NULL) {
+      return vw;
+    }
+  }
+  return NULL;
+}
 
 #undef LABEL_PRECISION
 #include "kst2dplot.moc"
--- trunk/extragear/graphics/kst/kst/kst2dplot.h #476784:476785
@@ -26,6 +26,7 @@
 #include "kstplotbase.h"
 #include "kstplotdefines.h"
 #include "kstviewwidget.h"
+#include "kstviewlegend.h"
 #include "kst_export.h"
 
 #include <qvaluestack.h>
@@ -343,6 +344,9 @@
   //      passed to changeToMonochrome (otherwise behaviour is not as expected)
   bool undoChangeToMonochrome(int pointStylePriority, int lineStylePriority, int lineWidthPriority);
   
+  //convenience routines for working with viewLegends
+  KstViewLegendPtr legend();
+  
 signals:
   void modified();
 


More information about the Kst mailing list