From 7d968586afa1a69623611df7e662672f7561af67 Mon Sep 17 00:00:00 2001 From: James Crook Date: Sun, 9 Jul 2017 14:33:24 +0100 Subject: [PATCH] Back to a dark colour for cursor on Light and Classic. This could also have been achieved by tweaking the colours in each of the themes. --- src/AColor.cpp | 20 ++++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/src/AColor.cpp b/src/AColor.cpp index 84dbe3d3b..7a16c7a84 100644 --- a/src/AColor.cpp +++ b/src/AColor.cpp @@ -430,6 +430,23 @@ wxColour InvertOfColour( const wxColour & c ) return wxColour( 255-c.Red(), 255-c.Green(), 255-c.Blue() ); } +// Fix up the cursor colour, if it is 'unacceptable'. +// Unacceptable if it is too close to the background colour. +wxColour CursorColour( ) +{ + wxColour cCursor = theTheme.Colour( clrCursorPen ); + wxColour cBack = theTheme.Colour( clrMedium ); + + int d = theTheme.ColourDistance( cCursor, cBack ); + + // Pen colour is fine, if there is plenty of contrast. + if( d > 200 ) + return clrCursorPen; + + // otherwise return same colour as a selection. + return theTheme.Colour( clrSelected ); +} + void AColor::Init() { if (inited) @@ -471,8 +488,7 @@ void AColor::Init() theTheme.SetBrushColour( muteBrush[1], clrMuteButtonVetoed); theTheme.SetBrushColour( soloBrush, clrMuteButtonActive); - theTheme.SetPenColour( cursorPen, clrCursorPen); - cursorPen.SetColour( InvertOfColour( cursorPen.GetColour()) ); + cursorPen.SetColour( CursorColour() ); theTheme.SetPenColour( indicatorPen[0], clrRecordingPen); theTheme.SetPenColour( indicatorPen[1], clrPlaybackPen); theTheme.SetBrushColour( indicatorBrush[0], clrRecordingBrush);