00001
00002
00003
00004
00005
00006
00007
00008
00009
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00028
00030
00031 #define YASAGUI_TIMING_PAINTER_INCLUDE
00032
00034 #include <yasagui/yasagui.h>
00035 #include "datatypes.h"
00036 #include <qpainter.h>
00037 #include "timingsettings.h"
00038
00039
00041 class YLogFileFigures;
00042 class YLogAction;
00043
00044
00046 class YPainterLogFileArgs
00047 {
00048 public:
00049 YASA_TIME cxtime;
00050 YASA_TIME crtime;
00051 int xroot;
00052 int yroot;
00053 bool drawsystemrange;
00054 bool drawtaskrange;
00055 bool drawtaskexcludedrange;
00056 bool drawtaskidlerange;
00057 bool drawmutexrange;
00058 bool drawjitterrange;
00059 YPainterLogFileArgs() : cxtime(0), crtime(0), xroot(0), yroot(0), drawtaskrange(false),
00060 drawtaskexcludedrange(false), drawmutexrange(false), drawjitterrange(false)
00061 { }
00062 void ResetRangeDrawModes() { drawsystemrange =false;
00063 drawtaskrange =false;
00064 drawtaskidlerange =false;
00065 drawtaskexcludedrange =false;
00066 drawmutexrange =false;
00067 drawjitterrange =false; }
00068
00069 };
00070
00074 class YPainter
00075 { QPainter *painter;
00076 QPoint root;
00077 YLogFileFigures & logfilepixmaps;
00078
00079 const QBrush & windowbackground;
00080 const QBrush & systemtaskbrush;
00081 const QBrush & taskbrush;
00082 const QBrush & taskidlebrush;
00083 const QBrush & taskexcludedbrush;
00084 const QBrush & mutexbrush;
00085 const QBrush & jitterbrush;
00086 public:
00087 YPainterLogFileArgs painterlogfileargs;
00088 int cx;
00089 int cy;
00090 int cw;
00091 int ch;
00092
00093
00094 YASA_TIME zoomfactorx;
00095 YASA_TIME legendfactorx;
00096 public: YPainter();
00097 void DrawText(int x, int y, const QString &text) { painter->drawText( root.x()+x, root.y()+y, text ); }
00098 void DrawLine(const QPoint &p1, const QPoint &p2){ painter->drawLine( p1.x()+root.x(), p1.y()+root.y(), p2.x()+root.x(), p2.y()+root.y() ); }
00099 void DrawRect(const QRect &r, const QColor &color=QColor(240,222,208) )
00100 { painter->fillRect( r.x()+root.x(), r.y()+root.y(), r.width(), r.height(), color ); }
00101 void DrawRect(int x,int y,int w,int h, const QColor &color=QColor(240,222,208) )
00102 { painter->fillRect( x+root.x(), y+root.y(), w, h, color ); }
00103 void DrawPixmap(int x,int y, const QPixmap &p) const
00104 { painter->drawPixmap(x+root.x(),y+root.y(),p); }
00105 void DrawLoggingAction(YLogAction *action, int row);
00106
00107 void SetZoomFactor(YASA_TIME maxtime, int z);
00108 int GetZoomFactor() const { return zoomfactorx; }
00109 int GetLegendFactor() const { return legendfactorx; }
00110 void SetPainter(QPainter *p) { painter=p; }
00111 void SetRoot(const QPoint &r) { root=r; }
00112 int GetRootX() const { return root.x(); }
00113 int GetRootY() const { return root.y(); }
00114 void SetUpdateArea(int x, int y, int w, int h) { cx=x; cy=y; cw=w; ch=h; }
00115 QPainter* GetPainter() const { return painter; }
00116 const QBrush & GetWindowBackgroundBrush() const { return windowbackground; }
00117 };
00118
00119
00120
00122 #endif // ifndef YASAGUI_TIMING_PAINTER_INCLUDE