Skip to content

Commit

Permalink
The external window now respects colour settings when no lyrics are f…
Browse files Browse the repository at this point in the history
…ound

Fixes #380
  • Loading branch information
jacquesh committed Aug 26, 2024
1 parent 3f7cbb6 commit e423985
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
1 change: 1 addition & 0 deletions src/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ void OpenLyricsVersion::get_about_message(pfc::string_base & out)
"- Fix debug logs going missing if printed early on during fb2k startup\n"
"- Fix the search-avoidance tracker counting local-only searches\n"
"- Fix possibly selecting the worse match of two lyrics provided by a source\n"
"- The external window now respects colour settings when no lyrics are found\n"
"- Many, many minor non-functional internal code improvements\n"
"\n";
out += "Version 1.9 (2024-06-12):\n"
Expand Down
17 changes: 8 additions & 9 deletions src/ui_lyrics_externalwindow.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -602,10 +602,6 @@ void ExternalLyricWindow::DrawUntimedLyrics(LyricData& lyrics, D2DTextRenderCont
}

const D2D1_SIZE_F canvas_size = render.device->GetSize();

COLORREF text_color = preferences::display::main_text_colour();
render.brush->SetColor(colour_gdi2dx(text_color));

const int total_height = std::accumulate(lyrics.lines.begin(), lyrics.lines.end(), 0,
[&render, canvas_size](int x, const LyricDataLine& line)
{
Expand Down Expand Up @@ -657,9 +653,9 @@ void ExternalLyricWindow::DrawTimestampedLyrics(D2DTextRenderContext& render)
{
const D2D1_SIZE_F canvas_size = render.device->GetSize();

t_ui_color past_text_colour = preferences::display::past_text_colour();
t_ui_color main_text_colour = preferences::display::main_text_colour();
t_ui_color hl_colour = preferences::display::highlight_colour();
const t_ui_color past_text_colour = preferences::display::past_text_colour();
const t_ui_color main_text_colour = preferences::display::main_text_colour();
const t_ui_color hl_colour = preferences::display::highlight_colour();

const PlaybackTimeInfo playback_time = get_playback_time();
const double scroll_time = preferences::display::scroll_time_seconds();
Expand Down Expand Up @@ -689,12 +685,12 @@ void ExternalLyricWindow::DrawTimestampedLyrics(D2DTextRenderContext& render)
const LyricDataLine& line = m_lyrics.lines[line_index];
if(line_index == scroll.active_line_index)
{
t_ui_color colour = lerp(hl_colour, past_text_colour, fade.next_line_scroll_factor);
const t_ui_color colour = lerp(hl_colour, past_text_colour, fade.next_line_scroll_factor);
render.brush->SetColor(colour_gdi2dx(colour));
}
else if(line_index == scroll.active_line_index+1)
{
t_ui_color colour = lerp(main_text_colour, hl_colour, fade.next_line_scroll_factor);
const t_ui_color colour = lerp(main_text_colour, hl_colour, fade.next_line_scroll_factor);
render.brush->SetColor(colour_gdi2dx(colour));
}
else if(line_index < scroll.active_line_index)
Expand Down Expand Up @@ -1151,6 +1147,9 @@ void ExternalLyricWindow::OnPaint(CDCHandle)
render.device->DrawLine(x_topright, x_botleft, render.brush, stroke_width, nullptr);
}

const COLORREF text_color = preferences::display::main_text_colour();
render.brush->SetColor(colour_gdi2dx(text_color));

if(m_lyrics.IsEmpty())
{
DrawNoLyrics(render);
Expand Down

0 comments on commit e423985

Please sign in to comment.