| 23 | class wxPaintDC; |
| 24 | |
| 25 | class CompressionMeterPanel final : public wxPanelWrapper |
| 26 | { |
| 27 | public: |
| 28 | CompressionMeterPanel( |
| 29 | wxWindow* parent, int id, CompressorInstance& instance, float dbRange, |
| 30 | std::function<void()> onClipped); |
| 31 | |
| 32 | void SetDbRange(float dbRange); |
| 33 | void Reset(); |
| 34 | void ResetClipped(); |
| 35 | |
| 36 | protected: |
| 37 | DECLARE_EVENT_TABLE(); |
| 38 | |
| 39 | private: |
| 40 | void PaintMeter( |
| 41 | wxPaintDC& dc, const wxColor& color, const wxRect& rect, |
| 42 | const MeterValueProvider& provider); |
| 43 | |
| 44 | void OnPaint(wxPaintEvent& evt); |
| 45 | void OnTimer(wxTimerEvent& evt); |
| 46 | |
| 47 | bool AcceptsFocus() const override; |
| 48 | // So that wxPanel is not included in Tab traversal - see wxWidgets bug 15581 |
| 49 | bool AcceptsFocusFromKeyboard() const override; |
| 50 | |
| 51 | const std::shared_ptr<DynamicRangeProcessorMeterValuesQueue> |
| 52 | mMeterValuesQueue; |
| 53 | const Observer::Subscription mPlaybackStartStopSubscription; |
| 54 | const Observer::Subscription mPlaybackPausedSubscription; |
| 55 | const std::function<void()> mOnClipped; |
| 56 | std::unique_ptr<MeterValueProvider> mCompressionMeter; |
| 57 | std::unique_ptr<MeterValueProvider> mOutputMeter; |
| 58 | float mDbBottomEdgeValue; |
| 59 | |
| 60 | wxTimer mTimer; |
| 61 | bool mStopWhenZero = false; |
| 62 | bool mClipped = false; |
| 63 | }; |