From 040a227d300033f8a103dc6eb67847286131d9b7 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Mon, 25 Feb 2013 00:11:49 +0000 Subject: Some tidying up, add channel selector to Audio dialog. --- src/wx/audio_plot.cc | 44 +++++++++++++++++++++++++++++++++++++++++--- 1 file changed, 41 insertions(+), 3 deletions(-) (limited to 'src/wx/audio_plot.cc') diff --git a/src/wx/audio_plot.cc b/src/wx/audio_plot.cc index 4fda3227d..cc2d8f6b4 100644 --- a/src/wx/audio_plot.cc +++ b/src/wx/audio_plot.cc @@ -1,3 +1,22 @@ +/* + Copyright (C) 2013 Carl Hetherington + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. + +*/ + #include #include #include @@ -14,20 +33,39 @@ using std::min; using boost::bind; using boost::shared_ptr; -AudioPlot::AudioPlot (wxWindow* parent, shared_ptr a, int c) +AudioPlot::AudioPlot (wxWindow* parent) : wxPanel (parent) - , _analysis (a) - , _channel (c) + , _channel (0) { Connect (wxID_ANY, wxEVT_PAINT, wxPaintEventHandler (AudioPlot::paint), 0, this); SetMinSize (wxSize (640, 512)); } +void +AudioPlot::set_analysis (shared_ptr a) +{ + _analysis = a; + _channel = 0; + Refresh (); +} + +void +AudioPlot::set_channel (int c) +{ + _channel = c; + Refresh (); +} + void AudioPlot::paint (wxPaintEvent &) { wxPaintDC dc (this); + + if (!_analysis) { + return; + } + wxGraphicsContext* gc = wxGraphicsContext::Create (dc); if (!gc) { return; -- cgit v1.2.3