[Kst] kdeextragear-2/kst/kst
Andrew Walker
arwalker at sumusltd.com
Wed May 12 21:36:11 CEST 2004
CVS commit by arwalker:
Added menu items for Fit and Edit of curves in plot... not yet connected.
M +42 -2 kst2dplot.cpp 1.14
M +3 -0 kst2dplot.h 1.7
--- kdeextragear-2/kst/kst/kst2dplot.cpp #1.13:1.14
@@ -24,4 +24,5 @@
#include <qnamespace.h>
#include <qstringlist.h>
+#include <qmessagebox.h>
#include <kdebug.h>
@@ -219,4 +220,7 @@ void Kst2DPlot::commonConstructor(const
setBackgroundColor("white");
+ _pMenuEditCurve = NULL;
+ _pMenuFitCurve = NULL;
+
labelList.setAutoDelete(true);
}
@@ -234,5 +238,9 @@ Kst2DPlot::~Kst2DPlot() {
delete Legend;
Legend = 0L;
+
+ delete _pMenuEditCurve;
+ delete _pMenuFitCurve;
}
+
/*** initialize the fonts in a plot: boost size by font_size ***/
void Kst2DPlot::initFonts(const QFont &in_font, int font_size) {
@@ -1618,6 +1626,38 @@ void Kst2DPlot::setTied(bool in_tied) {
bool Kst2DPlot::popupMenu(KPopupMenu *menu, const QPoint& pos, KstViewObjectPtr topLevelParent) {
_standardActions |= Delete;
+ int n_curves = Curves.count();
+ int i;
KstViewObject::popupMenu(menu, pos, topLevelParent);
+
+ n_curves = Curves.count();
+ if( n_curves > 0 ) {
+ if( _pMenuEditCurve == NULL ) {
+ _pMenuEditCurve = new KPopupMenu( );
+ }
+ if( _pMenuEditCurve ) {
+ if( _pMenuEditCurve->count() > 0 ) {
+ _pMenuEditCurve->clear();
+ }
+ for (i = 0; i < n_curves; i++) {
+ _pMenuEditCurve->insertItem( Curves[i]->tagLabel() );
+ }
+ menu->insertItem( i18n("Edit"), _pMenuEditCurve );
+ }
+
+ if( _pMenuFitCurve == NULL ) {
+ _pMenuFitCurve = new KPopupMenu( );
+ }
+ if( _pMenuFitCurve ) {
+ if( _pMenuFitCurve->count() > 0 ) {
+ _pMenuFitCurve->clear();
+ }
+ for (i = 0; i < n_curves; i++) {
+ _pMenuFitCurve->insertItem( Curves[i]->tagLabel() );
+ }
+ menu->insertItem( i18n("Fit"), _pMenuFitCurve );
+ }
+ }
+
return true;
}
--- kdeextragear-2/kst/kst/kst2dplot.h #1.6:1.7
@@ -131,4 +131,7 @@ public:
QColor foregroundColor() const { return ForegroundColor; }
+ KPopupMenu* _pMenuEditCurve;
+ KPopupMenu* _pMenuFitCurve;
+
public slots:
virtual void paint(QPainter& p);
More information about the Kst
mailing list