1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-07-16 16:47:41 +02:00

Merge branch 'master' into scrubbing2

This commit is contained in:
Paul Licameli 2016-05-03 11:03:45 -04:00
commit 8431a34524
5 changed files with 4218 additions and 4150 deletions

View File

@ -17,16 +17,32 @@ It is also a place to document colour usage policy in Audacity
*//********************************************************************/
#include "Audacity.h"
#include "AColor.h"
#include <wx/colour.h>
#include <wx/dc.h>
#include <wx/settings.h>
#include <wx/utils.h>
#include "AColor.h"
#include "Theme.h"
#include "Experimental.h"
#include "AllThemeResources.h"
void DCUnchanger::operator () (wxDC *pDC) const
{
if (pDC) {
pDC->SetPen(pen);
pDC->SetBrush(brush);
pDC->SetLogicalFunction(wxRasterOperationMode(logicalOperation));
}
}
ADCChanger::ADCChanger(wxDC *pDC)
: Base{ pDC, ::DCUnchanger{ pDC->GetBrush(), pDC->GetPen(),
long(pDC->GetLogicalFunction()) } }
{}
bool AColor::inited = false;
wxBrush AColor::lightBrush[2];
wxBrush AColor::mediumBrush[2];

View File

@ -14,12 +14,39 @@
#ifndef __AUDACITY_COLOR__
#define __AUDACITY_COLOR__
#include "MemoryX.h"
#include <wx/brush.h>
#include <wx/pen.h>
class wxDC;
class wxRect;
struct DCUnchanger {
public:
DCUnchanger() {}
DCUnchanger(const wxBrush &brush_, const wxPen &pen_, long logicalOperation_)
: brush(brush_), pen(pen_), logicalOperation(logicalOperation_)
{}
void operator () (wxDC *pDC) const;
wxBrush brush {};
wxPen pen {};
long logicalOperation {};
};
// Like wxDCPenChanger, etc., but simple and general
// Make temporary drawing context changes that you back out of, RAII style
class ADCChanger : public std::unique_ptr<wxDC, ::DCUnchanger>
{
using Base = std::unique_ptr<wxDC, ::DCUnchanger>;
public:
ADCChanger() : Base{} {}
ADCChanger(wxDC *pDC);
};
class AColor {
public:

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@ Paul Licameli split from TrackPanel.cpp
**********************************************************************/
#include "../../Audacity.h"
#include "PlayIndicatorOverlay.h"
#include "../../AColor.h"

View File

@ -3234,6 +3234,7 @@ void AdornedRulerPanel::DrawIndicator( double time, bool rec )
void AdornedRulerPanel::DoDrawIndicator
(wxDC * dc, double time, bool playing, int width, bool scrub)
{
ADCChanger changer(dc); // Undo pen and brush changes at function exit
const int x = Time2Pos(time);
AColor::IndicatorColor( dc, playing );