mirror of
https://github.com/cookiengineer/audacity
synced 2025-07-11 22:27:42 +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;
|
wxPen AColor::sparePen;
|
||||||
wxBrush AColor::spareBrush;
|
wxBrush AColor::spareBrush;
|
||||||
|
|
||||||
|
wxPen AColor::uglyPen;
|
||||||
|
wxBrush AColor::uglyBrush;
|
||||||
|
|
||||||
//
|
//
|
||||||
// Draw an upward or downward pointing arrow.
|
// Draw an upward or downward pointing arrow.
|
||||||
//
|
//
|
||||||
@ -262,7 +265,7 @@ wxColour AColor::Blend( const wxColour & c1, const wxColour & c2 )
|
|||||||
return c3;
|
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
|
#ifndef EXPERIMENTAL_THEMING
|
||||||
Bevel( dc, up, r );
|
Bevel( dc, up, r );
|
||||||
@ -270,7 +273,7 @@ void AColor::BevelTrackInfo(wxDC & dc, bool up, const wxRect & r)
|
|||||||
wxColour col;
|
wxColour col;
|
||||||
col = Blend( theTheme.Colour( clrTrackInfo ), up ? wxColour( 255,255,255):wxColour(0,0,0));
|
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.SetPen( pen );
|
||||||
|
|
||||||
dc.DrawLine(r.x, r.y, r.x + r.width, r.y);
|
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));
|
col = Blend( theTheme.Colour( clrTrackInfo ), up ? wxColour(0,0,0): wxColour(255,255,255));
|
||||||
|
|
||||||
pen.SetColour( col );
|
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.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);
|
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 );
|
dc->SetPen( sparePen );
|
||||||
}
|
}
|
||||||
|
|
||||||
void AColor::Light(wxDC * dc, bool selected)
|
void AColor::Light(wxDC * dc, bool selected, bool highlight)
|
||||||
{
|
{
|
||||||
if (!inited)
|
if (!inited)
|
||||||
Init();
|
Init();
|
||||||
int index = (int) selected;
|
int index = (int) selected;
|
||||||
dc->SetBrush(lightBrush[index]);
|
auto &brush = highlight ? AColor::uglyBrush : lightBrush[index];
|
||||||
dc->SetPen(lightPen[index]);
|
dc->SetBrush( brush );
|
||||||
|
auto &pen = highlight ? AColor::uglyPen : lightPen[index];
|
||||||
|
dc->SetPen( pen );
|
||||||
}
|
}
|
||||||
|
|
||||||
void AColor::Medium(wxDC * dc, bool selected)
|
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)
|
if (!inited)
|
||||||
Init();
|
Init();
|
||||||
int index = (int) selected;
|
int index = (int) selected;
|
||||||
dc->SetBrush(darkBrush[index]);
|
auto &brush = highlight ? AColor::uglyBrush : darkBrush[index];
|
||||||
dc->SetPen(darkPen[index]);
|
dc->SetBrush( brush );
|
||||||
|
auto &pen = highlight ? AColor::uglyPen : darkPen[index];
|
||||||
|
dc->SetPen( pen );
|
||||||
}
|
}
|
||||||
|
|
||||||
void AColor::TrackPanelBackground(wxDC * dc, bool selected)
|
void AColor::TrackPanelBackground(wxDC * dc, bool selected)
|
||||||
@ -503,6 +510,9 @@ void AColor::Init()
|
|||||||
tooltipPen.SetColour( wxSystemSettingsNative::GetColour(wxSYS_COLOUR_INFOTEXT) );
|
tooltipPen.SetColour( wxSystemSettingsNative::GetColour(wxSYS_COLOUR_INFOTEXT) );
|
||||||
tooltipBrush.SetColour( wxSystemSettingsNative::GetColour(wxSYS_COLOUR_INFOBK) );
|
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
|
// A tiny gradient of yellow surrounding the current focused track
|
||||||
theTheme.SetPenColour( trackFocusPens[0], clrTrackFocus0);
|
theTheme.SetPenColour( trackFocusPens[0], clrTrackFocus0);
|
||||||
theTheme.SetPenColour( trackFocusPens[1], clrTrackFocus1);
|
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 Bevel(wxDC & dc, bool up, const wxRect & r);
|
||||||
static void Bevel2
|
static void Bevel2
|
||||||
(wxDC & dc, bool up, const wxRect & r, bool bSel=false, bool bHighlight = false);
|
(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 wxColour Blend(const wxColour & c1, const wxColour & c2);
|
||||||
|
|
||||||
static void UseThemeColour( wxDC * dc, int iIndex, int index2 =-1 );
|
static void UseThemeColour( wxDC * dc, int iIndex, int index2 =-1 );
|
||||||
static void TrackPanelBackground(wxDC * dc, bool selected);
|
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 Medium(wxDC * dc, bool selected);
|
||||||
static void MediumTrackInfo(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 CursorColor(wxDC * dc);
|
||||||
static void IndicatorColor(wxDC * dc, bool bIsNotRecording);
|
static void IndicatorColor(wxDC * dc, bool bIsNotRecording);
|
||||||
@ -139,6 +139,10 @@ class AColor {
|
|||||||
static const int gradientSteps = 512;
|
static const int gradientSteps = 512;
|
||||||
static unsigned char gradient_pre[ColorGradientTotal][2][gradientSteps][3];
|
static unsigned char gradient_pre[ColorGradientTotal][2][gradientSteps][3];
|
||||||
|
|
||||||
|
// For experiments in mouse-over highlighting only
|
||||||
|
static wxPen uglyPen;
|
||||||
|
static wxBrush uglyBrush;
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static wxPen sparePen;
|
static wxPen sparePen;
|
||||||
static wxBrush spareBrush;
|
static wxBrush spareBrush;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user