00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "definitions.h"
00026 #include "packet.h"
00027
00028
00029 #include <qwidget.h>
00030 #include <qpainter.h>
00031 #include <qlist.h>
00032 #include <qlabel.h>
00033 #include <qmenubar.h>
00034 #include <qcolor.h>
00035 #include <qlineedit.h>
00036 #include <qpushbutton.h>
00037 #include <qtoolbar.h>
00038 #include <qprinter.h>
00039
00040
00041 #include <vector>
00042
00043 #ifndef _PLOT_H_
00044 #define _PLOT_H_
00045
00046
00047
00048 class ScaleW : public QWidget{
00049 Q_OBJECT
00050 public:
00051 ScaleW(char *,double, double);
00052 signals :
00053 void SIG_setlimits(double,double);
00054 public slots :
00055 void okpressed();
00056 void cancelpressed();
00057 private :
00058 QLineEdit *limEdit;
00059 QLineEdit *limEdit2;
00060 QLabel *label1;
00061 QLabel *label2;
00062 QLabel *headline;
00063 QPushButton *ok;
00064 QPushButton *cancel;
00065 };
00066
00067
00068 #define PWidget_X 200
00069 #define PWidget_Y 300
00070
00071
00072
00073 typedef struct {
00074 int x;
00075 double y;
00076 } point;
00077
00078
00079 class Plot : public QMainWindow {
00080 Q_OBJECT;
00081 public :
00082 Plot(QWidget *parent = 0, const char *name =0,char *devname =0,char *varname =0,int chan=1000 ,int m = FALSE);
00083 ~Plot();
00084 void plotPoint(int ,int );
00085 void plotPoint(int, double);
00086 void plotPoint(int ,int *,int);
00087 void plotPoint(int, double *,int);
00088 void plotPoint(int, vector<int>* ,int );
00089 void plotPoint(int, vector<double> *,int);
00090 void setYAxis(int ,int ,int);
00091 void setXAxis(int, int, int);
00092 void setXText(char *);
00093 void setYText(char *);
00094 void totalScalingOn();
00095 void totalScalingOff();
00096 void setLinestyle(int );
00097 void setTitle(char *);
00098 void setColors(QColor, QColor,QColor );
00099 void SetAllOptions(PlotSettings *);
00100 void refresh(void);
00101 public slots:
00102 void SLOT_set_scales( double, double );
00103 void setscales();
00104 void updateOn();
00105 void updateOff();
00106 void autoscaleOn();
00107 void autoscaleOff();
00108 void toggleAS();
00109 void hgridOff();
00110 void hgridOn();
00111 void vgridOn();
00112 void vgridOff();
00113
00114
00115 private slots:
00116 void save();
00117 void print();
00118 void kill();
00119
00120 protected:
00121 void resizeEvent( QResizeEvent * );
00122 void paintEvent( QPaintEvent *);
00123 void mouseMoveEvent( QMouseEvent *);
00124 void DrawPlot( QPainter *);
00125 void DrawAxes( QPainter *);
00126
00127 private slots :
00128 void del();
00129
00130 private :
00131
00132 QPrinter *printer;
00133 QToolBar *fileTools;
00134
00135 QMenuBar *menu;
00136 QLabel *Title;
00137 QLabel *XLabel;
00138 QLabel *YTitle;
00139 QLabel *RightSpace;
00140 QLabel *PlotLabel;
00141 QLabel *XAxisLabel;
00142 QLabel *YAxisLabel;
00143 QLabel *xval;
00144 QLabel *yval;
00145 QLabel *as;
00146
00147
00148 QColor axiscolor;
00149 QColor linecolor;
00150 QColor background;
00151 QColor labelcolor;
00152 QColor arraylinecolor;
00153 QColor datacolor;
00154 ScaleW *SW;
00155
00156
00157 bool draw_axis;
00158 bool autoscale;
00159 bool hgrid;
00160 bool vgrid;
00161 int type;
00162 int l_plimit;
00163 int as_interval;
00164 int as_counter;
00165 int las_counter;
00166 int pXsize,pYsize;
00167 int pXpos,pYpos;
00168 int xticks;
00169 int yticks;
00170 double ylow,yhigh;
00171 double xlow,xhigh;
00172 double xscale,yscale;
00173 double scale;
00174 double offset;
00175 int PLeftBorder,PUpperBorder;
00176 int ticksize;
00177 int tickpos,tickposx;
00178 int monitor_mode;
00179 bool upd;
00180 int arrays;
00181 vector<int> *iVecPtr;
00182 vector<double> *dVecPtr;
00183 int array_length;
00184
00185 int deviceIndex;
00186 int varIndex;
00187 int linestyle;
00188 char *devName;
00189 char *varName;
00190 double dmax,dmin;
00191 int max,min;
00192 int pminsizex;
00193 int pminsizey;
00194 int last_x;
00195 int new_x;
00196 int l_plotlim;
00197 char *va_name;
00198 vector<point> plotVec;
00199 };
00200
00201 #endif