mirror of
https://github.com/cookiengineer/audacity
synced 2025-05-07 23:32:53 +02:00
Utilities for TrackPanel highlighting
This commit is contained in:
parent
f8d9c4217c
commit
c4fe4993b3
@ -87,6 +87,9 @@ wxBrush AColor::tooltipBrush;
|
||||
wxPen AColor::sparePen;
|
||||
wxBrush AColor::spareBrush;
|
||||
|
||||
wxPen AColor::uglyPen;
|
||||
wxBrush AColor::uglyBrush;
|
||||
|
||||
//
|
||||
// Draw an upward or downward pointing arrow.
|
||||
//
|
||||
@ -262,7 +265,7 @@ wxColour AColor::Blend( const wxColour & c1, const wxColour & c2 )
|
||||
return c3;
|
||||
}
|
||||
|
||||
void AColor::BevelTrackInfo(wxDC & dc, bool up, const wxRect & r)
|
||||
void AColor::BevelTrackInfo(wxDC & dc, bool up, const wxRect & r, bool highlight)
|
||||
{
|
||||
#ifndef EXPERIMENTAL_THEMING
|
||||
Bevel( dc, up, r );
|
||||
@ -270,7 +273,7 @@ void AColor::BevelTrackInfo(wxDC & dc, bool up, const wxRect & r)
|
||||
wxColour col;
|
||||
col = Blend( theTheme.Colour( clrTrackInfo ), up ? wxColour( 255,255,255):wxColour(0,0,0));
|
||||
|
||||
wxPen pen( col );
|
||||
wxPen pen( highlight ? uglyPen : col );
|
||||
dc.SetPen( pen );
|
||||
|
||||
dc.DrawLine(r.x, r.y, r.x + r.width, r.y);
|
||||
@ -279,7 +282,7 @@ void AColor::BevelTrackInfo(wxDC & dc, bool up, const wxRect & r)
|
||||
col = Blend( theTheme.Colour( clrTrackInfo ), up ? wxColour(0,0,0): wxColour(255,255,255));
|
||||
|
||||
pen.SetColour( col );
|
||||
dc.SetPen( pen );
|
||||
dc.SetPen( highlight ? uglyPen : pen );
|
||||
|
||||
dc.DrawLine(r.x + r.width, r.y, r.x + r.width, r.y + r.height);
|
||||
dc.DrawLine(r.x, r.y + r.height, r.x + r.width + 1, r.y + r.height);
|
||||
@ -299,13 +302,15 @@ void AColor::UseThemeColour( wxDC * dc, int iIndex, int index2 )
|
||||
dc->SetPen( sparePen );
|
||||
}
|
||||
|
||||
void AColor::Light(wxDC * dc, bool selected)
|
||||
void AColor::Light(wxDC * dc, bool selected, bool highlight)
|
||||
{
|
||||
if (!inited)
|
||||
Init();
|
||||
int index = (int) selected;
|
||||
dc->SetBrush(lightBrush[index]);
|
||||
dc->SetPen(lightPen[index]);
|
||||
auto &brush = highlight ? AColor::uglyBrush : lightBrush[index];
|
||||
dc->SetBrush( brush );
|
||||
auto &pen = highlight ? AColor::uglyPen : lightPen[index];
|
||||
dc->SetPen( pen );
|
||||
}
|
||||
|
||||
void AColor::Medium(wxDC * dc, bool selected)
|
||||
@ -327,13 +332,15 @@ void AColor::MediumTrackInfo(wxDC * dc, bool selected)
|
||||
}
|
||||
|
||||
|
||||
void AColor::Dark(wxDC * dc, bool selected)
|
||||
void AColor::Dark(wxDC * dc, bool selected, bool highlight)
|
||||
{
|
||||
if (!inited)
|
||||
Init();
|
||||
int index = (int) selected;
|
||||
dc->SetBrush(darkBrush[index]);
|
||||
dc->SetPen(darkPen[index]);
|
||||
auto &brush = highlight ? AColor::uglyBrush : darkBrush[index];
|
||||
dc->SetBrush( brush );
|
||||
auto &pen = highlight ? AColor::uglyPen : darkPen[index];
|
||||
dc->SetPen( pen );
|
||||
}
|
||||
|
||||
void AColor::TrackPanelBackground(wxDC * dc, bool selected)
|
||||
@ -503,6 +510,9 @@ void AColor::Init()
|
||||
tooltipPen.SetColour( wxSystemSettingsNative::GetColour(wxSYS_COLOUR_INFOTEXT) );
|
||||
tooltipBrush.SetColour( wxSystemSettingsNative::GetColour(wxSYS_COLOUR_INFOBK) );
|
||||
|
||||
uglyPen.SetColour( wxColour{ 0, 255, 0 } ); // saturated green
|
||||
uglyBrush.SetColour( wxColour{ 255, 0, 255 } ); // saturated magenta
|
||||
|
||||
// A tiny gradient of yellow surrounding the current focused track
|
||||
theTheme.SetPenColour( trackFocusPens[0], clrTrackFocus0);
|
||||
theTheme.SetPenColour( trackFocusPens[1], clrTrackFocus1);
|
||||
|
10
src/AColor.h
10
src/AColor.h
@ -68,16 +68,16 @@ class AColor {
|
||||
static void Bevel(wxDC & dc, bool up, const wxRect & r);
|
||||
static void Bevel2
|
||||
(wxDC & dc, bool up, const wxRect & r, bool bSel=false, bool bHighlight = false);
|
||||
static void BevelTrackInfo(wxDC & dc, bool up, const wxRect & r);
|
||||
static void BevelTrackInfo(wxDC & dc, bool up, const wxRect & r, bool highlight = false);
|
||||
static wxColour Blend(const wxColour & c1, const wxColour & c2);
|
||||
|
||||
static void UseThemeColour( wxDC * dc, int iIndex, int index2 =-1 );
|
||||
static void TrackPanelBackground(wxDC * dc, bool selected);
|
||||
|
||||
static void Light(wxDC * dc, bool selected);
|
||||
static void Light(wxDC * dc, bool selected, bool highlight = false);
|
||||
static void Medium(wxDC * dc, bool selected);
|
||||
static void MediumTrackInfo(wxDC * dc, bool selected);
|
||||
static void Dark(wxDC * dc, bool selected);
|
||||
static void Dark(wxDC * dc, bool selected, bool highlight = false);
|
||||
|
||||
static void CursorColor(wxDC * dc);
|
||||
static void IndicatorColor(wxDC * dc, bool bIsNotRecording);
|
||||
@ -139,6 +139,10 @@ class AColor {
|
||||
static const int gradientSteps = 512;
|
||||
static unsigned char gradient_pre[ColorGradientTotal][2][gradientSteps][3];
|
||||
|
||||
// For experiments in mouse-over highlighting only
|
||||
static wxPen uglyPen;
|
||||
static wxBrush uglyBrush;
|
||||
|
||||
private:
|
||||
static wxPen sparePen;
|
||||
static wxBrush spareBrush;
|
||||
|
Loading…
x
Reference in New Issue
Block a user