[Kst] branches/work/kst/portto4/kst/src/libkstapp
Mike Fenton
mike at staikos.net
Wed Nov 14 23:15:41 CET 2007
SVN commit 736816 by fenton:
Add Edit Capabilities to EquationDialog and connection in DataManager.
M +8 -0 datamanager.cpp
M +32 -3 equationdialog.cpp
M +4 -1 equationdialog.h
--- branches/work/kst/portto4/kst/src/libkstapp/datamanager.cpp #736815:736816
@@ -21,6 +21,8 @@
#include "objectstore.h"
#include "dataobject.h"
#include "curve.h"
+#include "equation.h"
+#include "vector.h"
#include <QHeaderView>
#include <QToolBar>
@@ -145,6 +147,12 @@
if (CurvePtr curve = kst_cast<Curve>(_currentObject)) {
DialogLauncher::self()->showCurveDialog(curve);
}
+ if (EquationPtr equation = kst_cast<Equation>(_currentObject)) {
+ DialogLauncher::self()->showEquationDialog(equation);
+ }
+ if (VectorPtr vector = kst_cast<Vector>(_currentObject)) {
+ DialogLauncher::self()->showVectorDialog(vector);
+ }
}
}
--- branches/work/kst/portto4/kst/src/libkstapp/equationdialog.cpp #736815:736816
@@ -159,6 +159,13 @@
}
+void EquationTab::hideCurveOptions() {
+ _curvePlacement->setVisible(false);
+ _curveAppearance->setVisible(false);
+ setMaximumHeight(250);
+}
+
+
EquationDialog::EquationDialog(ObjectPtr dataObject, QWidget *parent)
: DataDialog(dataObject, parent) {
@@ -170,10 +177,15 @@
_equationTab = new EquationTab(this);
addDataTab(_equationTab);
+ _equationTab->setEquation("");
+
+ if (editMode() == Edit) {
+ configureTab(dataObject);
+ }
+
connect(_equationTab, SIGNAL(optionsChanged()), this, SLOT(updateButtons()));
updateButtons();
- _equationTab->setEquation("");
}
@@ -191,6 +203,16 @@
}
+void EquationDialog::configureTab(ObjectPtr object) {
+ if (EquationPtr equation = kst_cast<Equation>(object)) {
+ _equationTab->setXVector(equation->vXIn());
+ _equationTab->setEquation(equation->equation());
+ _equationTab->setDoInterpolation(equation->doInterp());
+ _equationTab->hideCurveOptions();
+ }
+}
+
+
ObjectPtr EquationDialog::createNewDataObject() const {
Q_ASSERT(_document && _document->objectStore());
@@ -260,8 +282,15 @@
ObjectPtr EquationDialog::editExistingDataObject() const {
- qDebug() << "editExistingDataObject" << endl;
- return 0;
+ if (EquationPtr equation = kst_cast<Equation>(dataObject())) {
+ equation->writeLock();
+ equation->setEquation(_equationTab->equation());
+ equation->setExistingXVector(_equationTab->xVector(), _equationTab->doInterpolation());
+
+ equation->update(0);
+ equation->unlock();
+ }
+ return dataObject();
}
}
--- branches/work/kst/portto4/kst/src/libkstapp/equationdialog.h #736815:736816
@@ -39,9 +39,10 @@
void setDoInterpolation(bool doInterpolation);
CurveAppearance *curveAppearance() const;
-
CurvePlacement *curvePlacement() const;
+ void hideCurveOptions();
+
Q_SIGNALS:
void optionsChanged();
@@ -69,6 +70,8 @@
void updateButtons();
private:
+ void configureTab(ObjectPtr curve);
+
EquationTab *_equationTab;
};
More information about the Kst
mailing list