1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-10-21 06:01:13 +02:00

New base classes of TrackPanel just for the bitmap backing and overlay system...

... to make it reusable by other classes.

Also, don't create a second DC when repainting TrackPanel.
This commit is contained in:
Paul Licameli
2016-05-07 13:00:48 -04:00
parent 3569851609
commit 7c2a531486
20 changed files with 419 additions and 253 deletions

40
src/widgets/Overlay.h Normal file
View File

@@ -0,0 +1,40 @@
//
// Overlay.h
// Audacity
//
// Created by Paul Licameli on 5/7/16.
//
//
#ifndef __AUDACITY_OVERLAY__
#define __AUDACITY_OVERLAY__
#include <utility>
class OverlayPanel;
class wxDC;
class wxRect;
class wxSize;
class Overlay
{
public:
virtual ~Overlay() = 0;
// nonvirtual wrapper
std::pair<wxRect, bool> GetRectangle(wxSize size);
// size passes the dimensions of the backing dc
// First member of pair is the rectangle that would be erased
// Second member of pair indicates whether the overlay is out of date
virtual std::pair<wxRect, bool> DoGetRectangle(wxSize size) = 0;
// Default implementation blits from backing store over GetRectangle().first
virtual void Erase(wxDC &dc, wxDC &src);
// Draw; dc.GetSize() tells you the total dimensions, and the panel is supplied
// as context
virtual void Draw(OverlayPanel &panel, wxDC &dc) = 0;
};
#endif