[Kst] extragear/graphics/kst/kst
Barth Netterfield
netterfield at astro.utoronto.ca
Tue Sep 13 09:34:48 CEST 2005
SVN commit 460255 by netterfield:
Make it so the fit label generator can find all the parameters,
even thought the newly created fit plugin has never been updated.
There are a few debugging printfs in here for tracking down labels
never being updated which will deleted soon...
M +10 -2 kst2dplot.cpp
M +8 -3 kstfitdialog_i.cpp
M +3 -2 kstplugin.cpp
M +9 -4 kstviewobject.cpp
M +5 -0 kstviewobject.h
M +3 -3 plugin.cpp
--- trunk/extragear/graphics/kst/kst/kst2dplot.cpp #460254:460255
@@ -19,6 +19,7 @@
#include <time.h>
#include <float.h>
#include <stdlib.h>
+#include <stdio.h>
#ifdef __sun
#include <ieeefp.h>
#endif
@@ -2445,7 +2446,7 @@
}
// only attempt to draw if plot is big enough
- kdDebug () << tagName() << ": x_px = " << x_px << " xright_bdr_px = " << xright_bdr_px << " xleft_bdr_px = " << xleft_bdr_px << " y_px = " << y_px << " ybot_bdr_px = " << ybot_bdr_px << " ytop_bdr_px = " << ytop_bdr_px << endl;
+ //kdDebug () << tagName() << ": x_px = " << x_px << " xright_bdr_px = " << xright_bdr_px << " xleft_bdr_px = " << xleft_bdr_px << " y_px = " << y_px << " ybot_bdr_px = " << ybot_bdr_px << " ytop_bdr_px = " << ytop_bdr_px << endl;
if (x_px - xright_bdr_px - xleft_bdr_px >= 10.0 &&
y_px - ybot_bdr_px - ytop_bdr_px + 1.0 - ytop_bdr_px >= 10.0) {
Lx = RelPlotRegion.left();
@@ -2649,7 +2650,9 @@
KstObject::UpdateType Kst2DPlot::update(int update_counter) {
bool force = dirty();
setDirty(false);
+ KstObject::UpdateType update_state;
+ printf("-----------------------updating 2dplot: %d\n", update_counter);
if (KstObject::checkUpdateCounter(update_counter) && !force) {
return lastUpdateResult();
}
@@ -2664,8 +2667,13 @@
cp->writeUnlock();
}
+ printf("------------------------updating children: %d\n", update_counter);
+ update_state = updateChildren(update_counter);
+
updated = (UPDATE == KstPlotBase::update(update_counter)) || updated;
- return setLastUpdateResult(updated ? UPDATE : NO_CHANGE);
+ if (update_state==NO_CHANGE)
+ update_state = updated ? UPDATE : NO_CHANGE;
+ return setLastUpdateResult(update_state);
}
--- trunk/extragear/graphics/kst/kst/kstfitdialog_i.cpp #460254:460255
@@ -18,6 +18,8 @@
#include <assert.h>
+#include <stdio.h>
+
// include files for Qt
#include <qlineedit.h>
#include <qtooltip.h>
@@ -157,8 +159,9 @@
KstVectorPtr vectorParam = plugin->outputVectors()["Parameters"];
if (vectorParam) {
plugin->createFitScalars();
- for (int i = 0; i < vectorParam->length(); i++) {
- QString strParamName = plugin->plugin()->parameterName(i);
+ int i;
+ QString strParamName;
+ for (i = 0, strParamName = plugin->plugin()->parameterName(0); !strParamName.isEmpty(); strParamName = plugin->plugin()->parameterName(++i)) {
if (!strParamName.isEmpty()) {
if (plugin->outputScalars().contains(strParamName)) {
KstScalarPtr scalar = plugin->outputScalars()[strParamName];
@@ -174,6 +177,7 @@
//
// add the label and the curve to the plot...
//
+ printf("label: %s\n", strLabel.latin1());
KstViewWindow *w = dynamic_cast<KstViewWindow*>(KstApp::inst()->findWindow(_strWindow));
if (w && w->view()->findChild(_strPlotName)) {
Kst2DPlotPtr plot = kst_cast<Kst2DPlot>(w->view()->findChild(_strPlotName));
@@ -181,7 +185,8 @@
KstViewLabelPtr label = new KstViewLabel(strLabel, KST_JUSTIFY_H_LEFT | KST_JUSTIFY_V_TOP, 0.0);
label->setTransparent(true);
plot->appendChild(KstViewObjectPtr(label), true);
- label->resizeFromAspect(0.05, 0.05, 0.05, 0.05);
+ label->resizeFromAspect(0.1, 0.1, 0.05, 0.05);
+ label->setJustification(SET_KST_JUSTIFY(KST_JUSTIFY_H_CENTER, KST_JUSTIFY_V_BOTTOM));
label->setAutoResize(true);
label->adjustSizeForText();
--- trunk/extragear/graphics/kst/kst/kstplugin.cpp #460254:460255
@@ -615,8 +615,9 @@
if (_plugin->data()._isFit && _outputVectors.contains("Parameters")) {
KstVectorPtr vectorParam = _outputVectors["Parameters"];
if (vectorParam) {
- for (int i = 0; i < vectorParam->length(); i++) {
- const QString& paramName = _plugin->parameterName(i);
+ QString paramName;
+ int i;
+ for (i = 0, paramName = _plugin->parameterName(i); !paramName.isEmpty(); paramName = _plugin->parameterName(++i)) {
if (!paramName.isEmpty()) {
QString scalarName = i18n("%1-%2").arg(tagName()).arg(paramName);
double scalarValue = vectorParam->value(i);
--- trunk/extragear/graphics/kst/kst/kstviewobject.cpp #460254:460255
@@ -207,7 +207,13 @@
if (checkUpdateCounter(counter)) {
return lastUpdateResult();
}
+
+ KstObject::UpdateType rc = updateChildren(counter);
+ return setLastUpdateResult(rc);
+}
+
+KstObject::UpdateType KstViewObject::updateChildren(int counter) {
KstObject::UpdateType rc = NO_CHANGE;
for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
if (rc == NO_CHANGE) {
@@ -216,11 +222,9 @@
(*i)->update(counter);
}
}
+ return rc;
+}
- return setLastUpdateResult(rc);
-}
-
-
void KstViewObject::save(QTextStream& ts, const QString& indent) {
KstAspectRatio aspect;
@@ -287,6 +291,7 @@
QRegion oldRegion = p.clipRegion();
bool maximized = false;
+ //update();
// handle the case where we have maximized plots
for (KstViewObjectList::Iterator i = _children.begin(); i != _children.end(); ++i) {
if ((*i)->_maximized) {
--- trunk/extragear/graphics/kst/kst/kstviewobject.h #460254:460255
@@ -254,6 +254,11 @@
// id=0 v1.2.0 setDirty() was called. data == 0 means false, else true
virtual void virtual_hook(int id, void *data);
+ KstObject::UpdateType KstViewObject::updateChildren(int counter);
+
+ // for checking hotpoints
+ bool pointsCloseEnough(const QPoint& point1, const QPoint& point2);
+
KstViewObjectList _children;
QRect _geom;
QRect _geomOld;
--- trunk/extragear/graphics/kst/kst/plugin.cpp #460254:460255
@@ -129,9 +129,9 @@
}
}
- if (parameter.isEmpty()) {
- parameter = i18n("Param%1").arg(idx);
- }
+// if (parameter.isEmpty()) {
+// parameter = i18n("Param%1").arg(idx);
+// }
return parameter;
}
More information about the Kst
mailing list