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

The ruler cursor (short vertical stroke at selection) should not change color...

... during play or record.

That bug was introduced at b19ed258e963c9342f0a573a3f054d9a8336f7fa
This commit is contained in:
Paul Licameli 2016-05-03 09:57:06 -04:00
parent 0bdc3b3bc5
commit 9649e0bfe2
3 changed files with 45 additions and 1 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:

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 );