[Kst] branches/work/kst/portto4/kst/src
Peter Kümmel
syntheticpp at gmx.net
Wed Jan 5 16:51:04 CET 2011
SVN commit 1212050 by kuemmel:
remove c&p code
M +1 -0 libkst/plotiteminterface.h
M +31 -33 libkstapp/plotitem.cpp
M +4 -0 libkstapp/plotitem.h
--- branches/work/kst/portto4/kst/src/libkst/plotiteminterface.h #1212049:1212050
@@ -32,6 +32,7 @@
virtual bool handleChangedInputs(qint64 serial) = 0;
void registerChange() {_serialOfLastChange = Forced;}
+
protected:
qint64 _serialOfLastChange;
};
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.cpp #1212049:1212050
@@ -582,6 +582,20 @@
}
+CurveList PlotItem::curveList() const
+{
+ CurveList list;
+ foreach (PlotRenderItem *renderer, renderItems()) {
+ foreach (RelationPtr relation, renderer->relationList()) {
+ if (CurvePtr curve = kst_cast<Curve>(relation)) {
+ list << curve;
+ }
+ }
+ }
+ return list;
+}
+
+
void PlotItem::createFilterMenu() {
if (_filterMenu) {
delete _filterMenu;
@@ -590,15 +604,10 @@
_filterMenu = new QMenu;
_filterMenu->setTitle(tr("Filter"));
- QAction *action;
- foreach (PlotRenderItem *renderer, renderItems()) {
- foreach (RelationPtr relation, renderer->relationList()) {
- if (CurvePtr curve = kst_cast<Curve>(relation)) {
- action = new QAction(relation->Name(), this);
- _filterMenu->addAction(action);
+ CurveList curves = curveList();
+ foreach (const CurvePtr& curve, curves) {
+ _filterMenu->addAction(new QAction(curve->Name(), this));
}
- }
- }
connect(_filterMenu, SIGNAL(triggered(QAction*)), this, SLOT(showFilterDialog(QAction*)));
}
@@ -611,15 +620,11 @@
_fitMenu = new QMenu;
_fitMenu->setTitle(tr("Fit"));
- QAction *action;
- foreach (PlotRenderItem *renderer, renderItems()) {
- foreach (RelationPtr relation, renderer->relationList()) {
- if (CurvePtr curve = kst_cast<Curve>(relation)) {
- action = new QAction(relation->Name(), this);
- _fitMenu->addAction(action);
+ CurveList curves = curveList();
+ foreach (const CurvePtr& curve, curves) {
+ _fitMenu->addAction(new QAction(curve->Name(), this));
}
- }
- }
+
connect(_fitMenu, SIGNAL(triggered(QAction*)), this, SLOT(showFitDialog(QAction*)));
}
@@ -677,30 +682,23 @@
}
-void PlotItem::showFilterDialog(QAction* action) {
- foreach (PlotRenderItem *renderer, renderItems()) {
- foreach (RelationPtr relation, renderer->relationList()) {
- if (relation->Name() == action->text()) {
- if (CurvePtr curve = kst_cast<Curve>(relation)) {
- DialogLauncher::self()->showBasicPluginDialog(DataObject::filterPluginList().first(), 0, curve->xVector(), curve->yVector(), this);
+void PlotItem::showFitFilterDialog(QAction* action, const QString& plugin) {
+ CurveList curves = curveList();
+ foreach (const CurvePtr& curve, curves) {
+ if (curve->Name() == action->text()) {
+ DialogLauncher::self()->showBasicPluginDialog(plugin, 0, curve->xVector(), curve->yVector(), this);
}
}
}
- }
-}
+void PlotItem::showFilterDialog(QAction* action) {
+ showFitFilterDialog(action, DataObject::filterPluginList().first());
+}
+
void PlotItem::showFitDialog(QAction* action) {
- foreach (PlotRenderItem *renderer, renderItems()) {
- foreach (RelationPtr relation, renderer->relationList()) {
- if (relation->Name() == action->text()) {
- if (CurvePtr curve = kst_cast<Curve>(relation)) {
- DialogLauncher::self()->showBasicPluginDialog(DataObject::fitsPluginList().first(), 0, curve->xVector(), curve->yVector(), this);
+ showFitFilterDialog(action, DataObject::fitsPluginList().first());
}
- }
- }
- }
-}
void PlotItem::redrawPlot() {
--- branches/work/kst/portto4/kst/src/libkstapp/plotitem.h #1212049:1212050
@@ -252,6 +252,7 @@
void applyDefaults();
bool maskedByMaximization() {return (view()->childMaximized() && !_plotMaximized);}
+
protected:
virtual QString _automaticDescriptiveName() const;
virtual void _initializeShortName();
@@ -394,6 +395,9 @@
void setCurrentZoomState(ZoomState zoomState);
+ void showFitFilterDialog(QAction* action, const QString& plugin);
+ CurveList curveList() const;
+
private:
QHash<PlotRenderItem::RenderType, PlotRenderItem*> _renderers;
bool _isInSharedAxisBox;
More information about the Kst
mailing list