[Kst] branches/work/kst/portto4/kst/src
Mike Fenton
mike at staikos.net
Mon Nov 26 23:37:59 CET 2007
SVN commit 742019 by fenton:
Add Editing of Curves to PlotRenderItemDialog.
M +10 -6 libkstapp/curvedialog.cpp
M +0 -2 libkstapp/curvedialog.h
M +12 -0 libkstapp/dialog.cpp
M +1 -0 libkstapp/dialog.h
M +89 -0 libkstapp/plotrenderitemdialog.cpp
M +4 -0 libkstapp/plotrenderitemdialog.h
M +9 -0 widgets/curveappearance.cpp
M +3 -0 widgets/curveappearance.h
--- branches/work/kst/portto4/kst/src/libkstapp/curvedialog.cpp #742018:742019
@@ -46,8 +46,16 @@
_curvePlacement->setExistingPlots(Data::self()->plotList());
- connect(_xVector, SIGNAL(selectionChanged(QString)), this, SLOT(selectionChanged()));
- connect(_yVector, SIGNAL(selectionChanged(QString)), this, SLOT(selectionChanged()));
+ connect(_xVector, SIGNAL(selectionChanged(QString)), this, SIGNAL(vectorsChanged()));
+ connect(_yVector, SIGNAL(selectionChanged(QString)), this, SIGNAL(vectorsChanged()));
+
+ connect(_xVector, SIGNAL(selectionChanged(QString)), this, SIGNAL(modified()));
+ connect(_yVector, SIGNAL(selectionChanged(QString)), this, SIGNAL(modified()));
+ connect(_xError, SIGNAL(selectionChanged(QString)), this, SIGNAL(modified()));
+ connect(_yError, SIGNAL(selectionChanged(QString)), this, SIGNAL(modified()));
+ connect(_xMinusError, SIGNAL(selectionChanged(QString)), this, SIGNAL(modified()));
+ connect(_yMinusError, SIGNAL(selectionChanged(QString)), this, SIGNAL(modified()));
+ connect(_curveAppearance, SIGNAL(modified()), this, SIGNAL(modified()));
}
@@ -55,10 +63,6 @@
}
-void CurveTab::selectionChanged() {
- emit vectorsChanged();
-}
-
VectorPtr CurveTab::xVector() const {
return _xVector->selectedVector();
}
--- branches/work/kst/portto4/kst/src/libkstapp/curvedialog.h #742018:742019
@@ -57,8 +57,6 @@
Q_SIGNALS:
void vectorsChanged();
- private Q_SLOTS:
- void selectionChanged();
};
class KST_EXPORT CurveDialog : public DataDialog {
--- branches/work/kst/portto4/kst/src/libkstapp/dialog.cpp #742018:742019
@@ -50,6 +50,18 @@
}
+void Dialog::removeDialogPage(DialogPage *page) {
+ disconnect(page, SIGNAL(modified()), this, SLOT(modified()));
+ disconnect(this, SIGNAL(apply()), page, SIGNAL(apply()));
+ QList<QListWidgetItem*> items = _listWidget->findItems(page->pageTitle(), Qt::MatchExactly);
+ foreach (QListWidgetItem* item, items) {
+ _itemHash.remove(item);
+ _listWidget->takeItem(_listWidget->row(item));
+ _stackedWidget->removeWidget(page);
+ }
+}
+
+
void Dialog::setVisible(bool visible) {
_listWidget->setVisible(_itemHash.count() > 1);
--- branches/work/kst/portto4/kst/src/libkstapp/dialog.h #742018:742019
@@ -33,6 +33,7 @@
virtual ~Dialog();
void addDialogPage(DialogPage *page);
+ void removeDialogPage(DialogPage *page);
Q_SIGNALS:
void ok();
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitemdialog.cpp #742018:742019
@@ -19,6 +19,7 @@
#include "document.h"
#include "curve.h"
+#include "curvedialog.h"
#include "plotrenderitem.h"
#include "plotitem.h"
@@ -37,6 +38,8 @@
page->addDialogTab(_contentTab);
addDialogPage(page);
+ addCurves();
+
setupContent();
}
@@ -66,7 +69,61 @@
}
+void PlotRenderItemDialog::addCurves() {
+ foreach (RelationPtr relation, _plotItem->relationList()) {
+ CurvePtr curve = kst_cast<Curve>(relation);
+ if (curve) {
+ CurveTab* curveTab = new CurveTab(this);
+
+ curveTab->setObjectStore(_store);
+ curveTab->setXVector(curve->xVector());
+ curveTab->setYVector(curve->yVector());
+ if (curve->hasXError()) {
+ curveTab->setXError(curve->xErrorVector());
+ }
+ if (curve->hasYError()) {
+ curveTab->setYError(curve->yErrorVector());
+ }
+ if (curve->hasXMinusError()) {
+ curveTab->setXMinusError(curve->xMinusErrorVector());
+ }
+ if (curve->hasYMinusError()) {
+ curveTab->setYMinusError(curve->yMinusErrorVector());
+ }
+ curveTab->curveAppearance()->setColor(curve->color());
+ curveTab->curveAppearance()->setShowPoints(curve->hasPoints());
+ curveTab->curveAppearance()->setShowLines(curve->hasLines());
+ curveTab->curveAppearance()->setShowBars(curve->hasBars());
+ curveTab->curveAppearance()->setLineWidth(curve->lineWidth());
+ curveTab->curveAppearance()->setLineStyle(curve->lineStyle());
+ curveTab->curveAppearance()->setPointType(curve->pointType());
+ curveTab->curveAppearance()->setPointDensity(curve->pointDensity());
+ curveTab->curveAppearance()->setBarStyle(curve->barStyle());
+ curveTab->hidePlacementOptions();
+
+ DialogPage *curvePage = new DialogPage(this);
+ curvePage->setPageTitle(curve->tag().displayString());
+ curvePage->addDialogTab(curveTab);
+ addDialogPage(curvePage);
+ _curvePages.append(curvePage);
+ }
+ }
+}
+
+
+void PlotRenderItemDialog::updateCurves() {
+ foreach(DialogPage* page, _curvePages) {
+ removeDialogPage(page);
+ }
+ _curvePages.clear();
+
+ addCurves();
+}
+
+
void PlotRenderItemDialog::contentChanged() {
+ curveChanged();
+
QStringList currentCurves;
foreach (RelationPtr relation, _plotItem->relationList()) {
currentCurves.append(relation->tag().displayString());
@@ -83,8 +140,40 @@
}
}
}
+ updateCurves();
}
+
+void PlotRenderItemDialog::curveChanged() {
+ foreach(DialogPage* page, _curvePages) {
+ CurvePtr curve = kst_cast<Curve>(_store->retrieveObject(ObjectTag::fromString(page->pageTitle())));
+ if (curve) {
+ CurveTab* curveTab = static_cast<CurveTab*>(page->currentWidget());
+ if (curveTab) {
+ curve->writeLock();
+ curve->setXVector(curveTab->xVector());
+ curve->setYVector(curveTab->yVector());
+ curve->setXError(curveTab->xError());
+ curve->setYError(curveTab->yError());
+ curve->setXMinusError(curveTab->xMinusError());
+ curve->setYMinusError(curveTab->yMinusError());
+ curve->setColor(curveTab->curveAppearance()->color());
+ curve->setHasPoints(curveTab->curveAppearance()->showPoints());
+ curve->setHasLines(curveTab->curveAppearance()->showLines());
+ curve->setHasBars(curveTab->curveAppearance()->showBars());
+ curve->setLineWidth(curveTab->curveAppearance()->lineWidth());
+ curve->setLineStyle(curveTab->curveAppearance()->lineStyle());
+ curve->setPointType(curveTab->curveAppearance()->pointType());
+ curve->setPointDensity(curveTab->curveAppearance()->pointDensity());
+ curve->setBarStyle(curveTab->curveAppearance()->barStyle());
+
+ curve->update(0);
+ curve->unlock();
+ }
+ }
+ }
}
+}
+
// vim: ts=2 sw=2 et
--- branches/work/kst/portto4/kst/src/libkstapp/plotrenderitemdialog.h #742018:742019
@@ -31,13 +31,17 @@
private Q_SLOTS:
void contentChanged();
+ void curveChanged();
private:
void setupContent();
+ void addCurves();
+ void updateCurves();
private:
ContentTab *_contentTab;
PlotRenderItem* _plotItem;
+ QList<DialogPage*> _curvePages;
ObjectStore* _store;
};
--- branches/work/kst/portto4/kst/src/widgets/curveappearance.cpp #742018:742019
@@ -39,6 +39,15 @@
connect(_spinBoxLineWidth, SIGNAL(valueChanged(int)), this, SLOT(drawSampleLine()));
connect(_barStyle, SIGNAL(activated(int)), this, SLOT(drawSampleLine()));
connect(_showBars, SIGNAL(clicked()), this, SLOT(drawSampleLine()));
+
+ connect(_color, SIGNAL(changed(const QColor&)), this, SIGNAL(modified()));
+ connect(_showLines, SIGNAL(clicked()), this, SIGNAL(modified()));
+ connect(_showPoints, SIGNAL(clicked()), this, SIGNAL(modified()));
+ connect(_comboPointSymbol, SIGNAL(activated(int)), this, SIGNAL(modified()));
+ connect(_comboLineStyle, SIGNAL(activated(int)), this, SIGNAL(modified()));
+ connect(_spinBoxLineWidth, SIGNAL(valueChanged(int)), this, SIGNAL(modified()));
+ connect(_barStyle, SIGNAL(activated(int)), this, SIGNAL(modified()));
+ connect(_showBars, SIGNAL(clicked()), this, SIGNAL(modified()));
}
--- branches/work/kst/portto4/kst/src/widgets/curveappearance.h #742018:742019
@@ -49,6 +49,9 @@
void drawSampleLine();
void populatePointSymbolCombo();
void populateLineStyleCombo();
+
+ Q_SIGNALS:
+ void modified();
};
}
More information about the Kst
mailing list