Changeset 204 for Evidence/Edd/Edd.h


Ignore:
Timestamp:
05/03/10 17:37:03 (14 years ago)
Author:
ogrimm
Message:
Improved zooming of plots
File:
1 edited

Legend:

Unmodified
Added
Removed
  • Evidence/Edd/Edd.h

    r174 r204  
    88#include <qwt_plot_grid.h>
    99#include <qwt_plot_zoomer.h>
     10#include <qwt_plot_magnifier.h>
    1011#include <qwt_plot_panner.h>
    1112#include <qwt_scale_engine.h>
     
    1617#include <qwt_legend_item.h>
    1718#include <qwt_symbol.h>
     19#include <qwt_plot_marker.h>
    1820
    1921#include <limits.h>
     
    2527#define SVN_REVISION "$Revision$"
    2628
     29const QColor EddPlotBackgroundColor(Qt::yellow);
     30
    2731QWidget *OpenHistory(char *, int);
    2832
    2933// Time scale for axis
    30 class TimeScale: public QwtScaleDraw {
    31   public:
    32     TimeScale() { }
     34class EddTimeScale: public QwtScaleDraw {
     35
     36  public:
     37    EddTimeScale() {}
     38
    3339    virtual QwtText label(double v) const {
    34       QDateTime t = QDateTime::fromTime_t((int) v);
    35       return t.toString("dMMM'\n'hh:mm:ss");
     40
     41          // Adapt text format to time span
     42          QString Format;
     43          if (scaleDiv().range() < 60*60) Format = "hh' h\n'mm:ss";
     44          else if (scaleDiv().range() < 24*60*60) Format = "hh:mm";
     45          else if (scaleDiv().range() < 30*24*60*60) Format = "h' h\n'd-MMM";
     46          else Format = "d-MMM'\n'yyyy";
     47
     48          // Generate text
     49          QwtText Text = QDateTime::fromTime_t((int) v).toString(Format);
     50          QFont Font = Text.font();
     51          Font.setPointSize(7);
     52          Text.setFont(Font);
     53
     54      return Text;
    3655    }
    3756};
     
    89108    QAction *NormAction;
    90109    QAction *StyleAction;
     110    QAction *StripAction;
    91111   
    92112    QwtPlotPanner *Panner;
    93113    QwtPlotGrid *Grid;
    94114    QwtPlotZoomer *Zoomer;
    95     QwtLegend *Legend;
    96    
     115        QwtPlotMagnifier *Magnifier;
     116    QwtPicker *Picker;
     117        QwtLegend *Legend;
     118        QwtDoubleRect BBox;
     119
    97120    void dragEnterEvent(QDragEnterEvent *);
    98121    void dropEvent(QDropEvent *);
    99 
     122        void paintEvent(QPaintEvent *);
     123               
    100124  public:
    101125    EddPlot(QString = QString(), int = 0, QWidget * = NULL);
     
    108132
    109133    void HandleZoom(const QwtDoubleRect &);
    110     void contextMenuEvent(QContextMenuEvent *);
     134        void MouseSelection(const QwtPolygon &);
     135        void contextMenuEvent(QContextMenuEvent *);
    111136        void LegendClicked(QwtPlotItem *);
    112137    void MenuZoomOut();
     
    116141    void MenuPrint();
    117142    void MenuPasteService();
     143        void MenuPlotHelp();
    118144};
    119145
Note: See TracChangeset for help on using the changeset viewer.