00001
00002 #include <qwidget.h>
00003 #include <qwt_plot.h>
00004 #include <qwt_math.h>
00005 #include <stdlib.h>
00006 #include "midobasic.h"
00007 #include "midotrigger.h"
00008
00009
00010 class QPushButton;
00011 class InputFrameOsc;
00012 class QwtThermo;
00013 class QLabel;
00014
00015 class plotOscilloscope : public QWidget
00016 {
00017 Q_OBJECT
00018
00019 public:
00020 plotOscilloscope(QWidget *parent, const char *name);
00021 ~plotOscilloscope() { delete plot; }
00022
00023 void resizeEvent(QResizeEvent *e);
00024 void setAxisTime(double max);
00025
00026 void setAxisCh1(bool on);
00027 void setScaleCh1(double scaleValue);
00028 void setSliderCh1(double value);
00029
00030 void setAxisCh2(bool on);
00031 void setScaleCh2(double scaleValue);
00032 void setSliderCh2(double value);
00033
00034 void updateDateCh1(DValueList v);
00035 void updateDateCh2(DValueList v);
00036
00037 void setAcCh1(double midValue);
00038 void setDcCh1();
00039 void setGndCh1();
00040
00041 void setAcCh2(double midValue);
00042 void setDcCh2();
00043 void setGndCh2();
00044
00045 void setEnableBuff(bool enable);
00046 void interpolationSin(bool sin);
00047
00048 void clear();
00049 void loadDefaults();
00050
00051 void setThermoBuffer(double value, double maxValue);
00052 bool activeCh1,activeCh2;
00053
00054
00055
00056 public slots:
00057 void enableAxisX(bool enabled);
00058 void enableAxisY(bool enabled );
00059 void setSizePlot(double td);
00060
00061
00062 private:
00063 QwtPlot *plot;
00064 InputFrameOsc *frmInp;
00065 int d_zoom,d_points,d_zoomActive;
00066 QPoint p1;
00067 int stateCh1, stateCh2;
00068
00069
00070
00071 long Curve1, Curve2, CurveComb, CurveLine, markerTrigger, markerSr;
00072 double lastSetTime;
00073 double xL[POINTS_FOR_WIN], yL[POINTS_FOR_WIN];
00074 double xR[POINTS_FOR_WIN], yR[POINTS_FOR_WIN];
00075
00076 double yAppL[POINTS_FOR_WIN];
00077 double yAppR[POINTS_FOR_WIN];
00078
00079 double yCh[POINTS_FOR_WIN];
00080 double xCh[POINTS_FOR_WIN];
00081 double yAppCh[POINTS_FOR_WIN];
00082
00083
00084 int sizePlot;
00085
00086
00087 double scaleCh1,scaleCh2, sliderCh1, sliderCh2, levelTrigger;
00088 static bool Ch1addCh2, Ch1menusCh2, Ch1xyCh2, Ch1prodCh2, invCh1, invCh2;
00089
00090
00091 void insertCurveCh1(bool lastValue);
00092 void insertCurveCh2(bool lastValue);
00093 void insertCurveComb(bool lastValue);
00094
00095 bool existCurve(long key);
00096
00097 void insertMarkTrigger(double x, double y);
00098 void removeMarkTrigger();
00099
00100
00101 private slots:
00102 void plotMouseMoved(const QMouseEvent &e);
00103 void plotMouseReleased(const QMouseEvent &e);
00104 void plotMousePressed(const QMouseEvent &e);
00105 void zoom();
00106 void points();
00107 void print();
00108 void changeCh1Ch2(int,bool);
00109 void changeInvertCh(int,bool);
00110
00111 void setSliderTrigger(double value);
00112 void setChannelTrigger(int value);
00113 void setTrigger(bool on);
00114
00115
00116 void setMarkSr(bool enable, double value);
00117 void changeMarkSr(double newValue);
00118
00119 void doPrintPlot(QString fileName);
00120
00121 };
00122
00123 class InputFrameOsc : public QFrame
00124 {
00125 Q_OBJECT
00126
00127 public:
00128 InputFrameOsc(QWidget *p = 0, const char *name = 0);
00129 ~InputFrameOsc() {}
00130
00131 QwtThermo *tBuffer;
00132 QLabel *lBuf;
00133
00134 signals:
00135 void zoomClicked();
00136 void pointsClicked();
00137 void printClicked();
00138
00139 private:
00140 QPushButton *btnZoom, *btnIndex, *btnPrint;
00141
00142 private slots:
00143 void zoom();
00144 void points();
00145 void print();
00146
00147 };
00148