Main Page   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members   Examples  

timingpainter.h

Go to the documentation of this file.
00001 
00002 //
00003 // YASA timing painter declarations
00004 //
00005 // Project: Yasa 2
00006 // Author : Jan Blumenthal
00007 // Start  : 2002/02/28
00008 // $Header: /sources/yasa/yasagui/timingpainter.h,v 1.5 2003/01/24 15:47:43 bj Exp $
00009 //
00011 //
00012 // This program is free software; you can redistribute it and/or modify
00013 // it under the terms of the GNU General Public License as published by
00014 // the Free Software Foundation; either version 2 of the License, or
00015 // (at your option) any later version.
00016 //
00017 // This program is distributed in the hope that it will be useful,
00018 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00019 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00020 // GNU General Public License for more details.
00021 //
00022 // You should have received a copy of the GNU General Public License
00023 // along with this program (See the included file COPYING);
00024 // if not, write to the Free Software Foundation, Inc.,
00025 // 675 Mass Ave, Cambridge, MA 02139, USA.
00026 //
00028 // This file contains all information about timing diagram frames
00030 #ifndef YASAGUI_TIMING_PAINTER_INCLUDE
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;                 // time value at position cx
00050     YASA_TIME           crtime;                 // time value at position cw+cx
00051     int                 xroot;                  // y-position left lower edge in current timing widget diagram
00052     int                 yroot;                  // y-position left lower edge in current timing widget diagram
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     // ptr to brushes stored here to improve speed and to avoid traversing pixmap list
00079     const QBrush &      windowbackground;       // ptr to brush of YApplicationFigures::FIGURE_BACKGROUND_TIMINGWINDOWS
00080     const QBrush &      systemtaskbrush;        // ptr to brush of YLogFileFigures::SYSTEM_TASK_BRUSH
00081     const QBrush &      taskbrush;              // ptr to brush of YLogFileFigures::TASK_BRUSH
00082     const QBrush &      taskidlebrush;          // ptr to brush of YLogFileFigures::TASK_IDLE_BRUSH
00083     const QBrush &      taskexcludedbrush;      // ptr to brush of YLogFileFigures::TASK_EXCLUDED_BRUSH
00084     const QBrush &      mutexbrush;             // ptr to brush of YApplicationFigures::FIGURE_MUTEX_BRUSH
00085     const QBrush &      jitterbrush;            // ptr to brush of YApplicationFigures::FIGURE_JITTER_BRUSH
00086 public:
00087     YPainterLogFileArgs painterlogfileargs;
00088     int                 cx;
00089     int                 cy;
00090     int                 cw;
00091     int                 ch;
00092     //fast hack: int                    zoomfactorx;
00093     //fast hack: int                    legendfactorx;          // every x times we draw a time message under the horizontal legend line
00094     YASA_TIME           zoomfactorx;
00095     YASA_TIME           legendfactorx;          // every x times we draw a time message under the horizontal legend line
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     //void              SetZoomFactor(int z=0);
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

Generated on Thu Feb 13 23:43:56 2003 for Yasa by doxygen1.3-rc3