From 0f23736253e46c6cf7eceb95e2a255b90928fb25 Mon Sep 17 00:00:00 2001 From: Jared Boone Date: Sat, 5 Dec 2015 20:25:05 -0800 Subject: [PATCH] Whoops, don't match selected_key inside draw_entry. --- firmware/application/app_ais.cpp | 16 +++++----------- firmware/application/app_ais.hpp | 2 +- 2 files changed, 6 insertions(+), 12 deletions(-) diff --git a/firmware/application/app_ais.cpp b/firmware/application/app_ais.cpp index a0b5e204..1b2df09f 100644 --- a/firmware/application/app_ais.cpp +++ b/firmware/application/app_ais.cpp @@ -424,7 +424,7 @@ bool AISView::on_encoder(const EncoderEvent event) { return true; } -bool AISView::draw_entry( +void AISView::draw_entry( const RecentEntry& entry, const Rect& target_rect, Painter& painter, @@ -438,15 +438,7 @@ bool AISView::draw_entry( } line.resize(target_rect.width() / 8, ' '); - - const bool is_selected_key = (selected_key == entry.mmsi); - if( has_focus && is_selected_key ) { - painter.draw_string(target_rect.pos, s.invert(), line); - } else { - painter.draw_string(target_rect.pos, s, line); - } - - return is_selected_key; + painter.draw_string(target_rect.pos, s, line); } void AISView::paint(Painter& painter) { @@ -455,7 +447,9 @@ void AISView::paint(Painter& painter) { Rect target_rect { r.pos, { r.width(), s.font.line_height() }}; for(const auto entry : recent) { - draw_entry(entry, target_rect, painter, s); + const auto is_selected_key = (selected_key == entry.mmsi); + const auto& draw_style = (has_focus && is_selected_key) ? s.invert() : s; + draw_entry(entry, target_rect, painter, draw_style); target_rect.pos.y += target_rect.height(); diff --git a/firmware/application/app_ais.hpp b/firmware/application/app_ais.hpp index 48cb49f8..3f5c096f 100644 --- a/firmware/application/app_ais.hpp +++ b/firmware/application/app_ais.hpp @@ -173,7 +173,7 @@ private: void on_packet(const baseband::ais::Packet& packet); - bool draw_entry( + void draw_entry( const RecentEntry& entry, const Rect& target_rect, Painter& painter,