Merge master.
[dcpomatic.git] / src / wx / audio_plot.cc
index 2539a93d9b4d64f96500598007797107d3247146..0868d931a8be1d38dc7b95e0c154afce4e544a51 100644 (file)
@@ -61,7 +61,7 @@ AudioPlot::AudioPlot (wxWindow* parent)
        _colours.push_back (wxColour (  0,   0, 255));
        _colours.push_back (wxColour (100, 100, 100));
        
-       Connect (wxID_ANY, wxEVT_PAINT, wxPaintEventHandler (AudioPlot::paint), 0, this);
+       Bind (wxEVT_PAINT, boost::bind (&AudioPlot::paint, this));
        
        SetMinSize (wxSize (640, 512));
 }
@@ -104,7 +104,7 @@ AudioPlot::set_message (wxString s)
 }
 
 void
-AudioPlot::paint (wxPaintEvent &)
+AudioPlot::paint ()
 {
        wxPaintDC dc (this);
 
@@ -145,8 +145,7 @@ AudioPlot::paint (wxPaintEvent &)
        gc->SetPen (*wxLIGHT_GREY_PEN);
        gc->StrokePath (grid);
 
-       gc->DrawText (_("Time"), data_width, _height - _y_origin + db_label_height / 2);
-
+       gc->DrawText (_("DCPTime"), data_width, _height - _y_origin + db_label_height / 2);
        
        if (_type_visible[AudioPoint::PEAK]) {
                for (int c = 0; c < MAX_AUDIO_CHANNELS; ++c) {
@@ -260,7 +259,9 @@ AudioPlot::plot_rms (wxGraphicsPath& path, int channel) const
                        p += pow (*j, 2);
                }
 
-               p = sqrt (p / smoothing.size ());
+               if (smoothing.size() > 0) {
+                       p = sqrt (p / smoothing.size ());
+               }
 
                path.AddLineToPoint (_db_label_width + i * _x_scale, y_for_linear (p));
        }