diff options
author | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-13 14:30:06 -0500 |
---|---|---|
committer | Timothy Pearson <kb9vqf@pearsoncomputing.net> | 2012-07-13 14:30:06 -0500 |
commit | 38c51e3a29bab13192ee194e82954885c7dc8bad (patch) | |
tree | b814d7cc0dfbdbe367c6d1330f86efc81f39fe52 /clients/tde/src/widgets/tracewidget.h | |
parent | c485c0ef46c7330eba93226ac0ca09415a765d9d (diff) | |
download | ulab-38c51e3a29bab13192ee194e82954885c7dc8bad.tar.gz ulab-38c51e3a29bab13192ee194e82954885c7dc8bad.zip |
Significant enhancements to trace widget
Diffstat (limited to 'clients/tde/src/widgets/tracewidget.h')
-rw-r--r-- | clients/tde/src/widgets/tracewidget.h | 120 |
1 files changed, 114 insertions, 6 deletions
diff --git a/clients/tde/src/widgets/tracewidget.h b/clients/tde/src/widgets/tracewidget.h index b16717c..9101895 100644 --- a/clients/tde/src/widgets/tracewidget.h +++ b/clients/tde/src/widgets/tracewidget.h @@ -9,16 +9,48 @@ class TQPixmap; class TQLabel; class TQVBoxLayout; class TQGridLayout; +class TQPushButton; class TraceWidget; -class TraceData +class TQRectF { public: + TQRectF(); + TQRectF(double x, double y, double w, double h); + + double x() const; + double y() const; + double width() const; + double height() const; + bool isNull() const; + + bool operator!() const; + bool operator==(const TQRectF &r1); + bool operator!=(const TQRectF &r1); + + void setX(double); + void setY(double); + void setWidth(double); + void setHeight(double); + + private: + bool m_valid; + double m_x; + double m_y; + double m_w; + double m_h; +}; + +class TraceData : public TQObject +{ + Q_OBJECT + + public: TraceData(TQWidget* labelParent=0); ~TraceData(); void drawTrace(TQPainter* p, int graticule_width, int graticule_height); - public: + private: TQDoubleArray sampleArray; TQDoubleArray positionArray; unsigned int numberOfSamples; @@ -31,11 +63,48 @@ class TraceData TQString traceName; TQString horizontalUnits; TQString verticalUnits; - TQLabel* infoLabel; + TQLabel* paramLabel; + TQLabel* graphStatusLabel; + + friend class TraceWidget; + friend class GraticuleWidget; }; typedef TQMemArray<TraceData*> TraceList; +class CursorData : public TQObject +{ + Q_OBJECT + + public: + CursorData(TraceWidget* parent, TQWidget* labelParent=0); + ~CursorData(); + void drawCursor(TQPainter* p, int graticule_width, int graticule_height); + + public slots: + void movePosOneTick(); + void moveNegOneTick(); + void movePosMultiTicks(); + void moveNegMultiTicks(); + + private: + TQColor color; + bool enabled; + TQt::Orientation orientation; + double position; + TQString cursorName; + TQLabel* paramLabel; + TQPushButton* singleIncrBtn; + TQPushButton* singleDecrBtn; + TQPushButton* multiIncrBtn; + TQPushButton* multiDecrBtn; + TraceWidget* parentWidget; + + friend class TraceWidget; +}; + +typedef TQMemArray<CursorData*> CursorList; + class GraticuleWidget : public TQWidget { Q_OBJECT @@ -47,6 +116,12 @@ class GraticuleWidget : public TQWidget protected: virtual void paintEvent(TQPaintEvent*); virtual void resizeEvent(TQResizeEvent *); + virtual void mousePressEvent(TQMouseEvent *); + virtual void mouseReleaseEvent(TQMouseEvent *); + virtual void mouseDoubleClickEvent(TQMouseEvent *); + virtual void mouseMoveEvent(TQMouseEvent *); + virtual void enterEvent(TQEvent *); + virtual void leaveEvent(TQEvent *); private slots: void updateGraticule(); @@ -56,6 +131,7 @@ class GraticuleWidget : public TQWidget TQPixmap* m_graticulePixmap; friend class TraceWidget; + friend class CursorData; }; class TraceWidget : public TQWidget @@ -69,7 +145,10 @@ class TraceWidget : public TQWidget void setNumberOfSamples(uint traceNumber, unsigned int samples); void setNumberOfHorizontalDivisions(unsigned int divisions); void setNumberOfVerticalDivisions(unsigned int divisions); - void setDisplayLimits(uint traceNumber, double x, double y, double w, double h); + void setDisplayLimits(uint traceNumber, TQRectF limits); + TQRectF displayLimits(uint traceNumber); + void setNumberOfTraces(uint traceNumber); + void setNumberOfCursors(uint traceNumber); TQDoubleArray& samples(uint traceNumber); void setSamples(uint traceNumber, TQDoubleArray&); @@ -78,7 +157,7 @@ class TraceWidget : public TQWidget TQColor& traceColor(uint traceNumber); void setTraceColor(uint traceNumber, TQColor&); bool traceEnabled(uint traceNumber); - void setTraceEnabled(uint traceNumber, bool enabled); + void setTraceEnabled(uint traceNumber, bool enabled, bool showText=true); TQString traceName(uint traceNumber); void setTraceName(uint traceNumber, TQString name); TQString traceHorizontalUnits(uint traceNumber); @@ -86,19 +165,48 @@ class TraceWidget : public TQWidget TQString traceVerticalUnits(uint traceNumber); void setTraceVerticalUnits(uint traceNumber, TQString units); + double cursorPosition(uint cursorNumber); + void setCursorPosition(uint cursorNumber, double position); + bool cursorEnabled(uint cursorNumber); + void setCursorEnabled(uint cursorNumber, bool enabled); + TQString cursorName(uint cursorNumber); + void setCursorName(uint cursorNumber, TQString name); + TQt::Orientation cursorOrientation(uint cursorNumber); + void setCursorOrientation(uint cursorNumber, TQt::Orientation orient); + + TQRectF zoomBox(); + void setZoomBoxEnabled(bool enabled); + + static TQString prettyFormat(double value, double rangeDetectValue, TQString baseUnits, unsigned int precision=3); + private slots: void updateTraceText(); + void updateCursorText(); + + signals: + void zoomBoxChanged(const TQRectF&); private: void resizeTraceArray(uint newsize); + void resizeCursorArray(uint newsize); private: unsigned int m_horizDivs; unsigned int m_vertDivs; + unsigned int m_cursorDarkness; + unsigned int m_zoomBoxDarkness; + bool m_zoomBoxEnabled; + TQRectF m_zoomBoxPrev; TraceList m_traceArray; - TQVBoxLayout* m_primaryLayout; + CursorList m_cursorArray; + TQGridLayout* m_primaryLayout; + TQGridLayout* m_rightPaneLayout; TQGridLayout* m_traceLabelLayout; + TQGridLayout* m_infoLabelLayout; + TQGridLayout* m_cursorLabelLayout; + TQGridLayout* m_statusLabelLayout; GraticuleWidget* m_graticuleWidget; friend class GraticuleWidget; + friend class CursorData; };
\ No newline at end of file |