From: drowe67 Date: Tue, 23 Oct 2012 10:05:13 +0000 (+0000) Subject: added some code to handle resizing better, and fact OnSize can't be relied upon to... X-Git-Url: http://git.whiteaudio.com/gitweb/?a=commitdiff_plain;h=2ae5d018ccab5179b3a2098b128a6e5826fbab2f;p=freetel-svn-tracking.git added some code to handle resizing better, and fact OnSize can't be relied upon to be called for bit map allocation git-svn-id: https://svn.code.sf.net/p/freetel/code@797 01035d8c-6547-0410-b346-abe4f91aad63 --- diff --git a/fdmdv2/src/fdmdv2_plot_waterfall_linux.cpp b/fdmdv2/src/fdmdv2_plot_waterfall_linux.cpp index 760ad8f2..bd14c932 100644 --- a/fdmdv2/src/fdmdv2_plot_waterfall_linux.cpp +++ b/fdmdv2/src/fdmdv2_plot_waterfall_linux.cpp @@ -61,13 +61,20 @@ PlotWaterfall::PlotWaterfall(wxFrame* parent): PlotPanel(parent) m_firstPass = true; m_line_color = 0; SetLabelSize(10.0); + + m_pBmp = NULL; } // When the window size gets set we can work outthe size of the window // we plot in and allocate a bit map of the correct size void PlotWaterfall::OnSize(wxSizeEvent& event) { + printf("PlotWaterfall::OnSize\n"); + + // resize bit map + delete m_pBmp; + m_rCtrl = GetClientRect(); // m_rGrid is coords of inner window we actually plot to. We deflate it a bit @@ -96,6 +103,7 @@ void PlotWaterfall::OnSize(wxSizeEvent& event) { //---------------------------------------------------------------- void PlotWaterfall::OnPaint(wxPaintEvent & evt) { + printf("PlotWaterfall::OnPaint\n"); wxAutoBufferedPaintDC dc(this); draw(dc); } @@ -155,6 +163,19 @@ unsigned PlotWaterfall::heatmap(float val, float min, float max) //---------------------------------------------------------------- void PlotWaterfall::draw(wxAutoBufferedPaintDC& dc) { + m_rCtrl = GetClientRect(); + + // m_rGrid is coords of inner window we actually plot to. We deflate it a bit + // to leave room for axis labels. + + m_rGrid = m_rCtrl; + m_rGrid = m_rGrid.Deflate(PLOT_BORDER + (XLEFT_OFFSET/2), (PLOT_BORDER + (YBOTTOM_OFFSET/2))); + + if (m_pBmp == NULL) { + // we want a bit map the size of m_rGrid + + m_pBmp = new wxBitmap(m_rGrid.GetWidth(), m_rGrid.GetHeight(), 24); + } if(m_newdata) {