mirror of
https://github.com/portapack-mayhem/mayhem-firmware.git
synced 2024-12-13 03:34:35 +00:00
Yellow coloration for truncated freqman files (#1086)
This commit is contained in:
parent
0dcf2af50d
commit
23c24355ab
@ -65,8 +65,13 @@ void FreqManUIList::paint(Painter& painter) {
|
||||
painter.fill_rectangle(
|
||||
r_widget_screen,
|
||||
Color::black());
|
||||
// only return after clearing the screen so previous entries are not shown anymore
|
||||
if (freqlist_db.size() == 0)
|
||||
return;
|
||||
// coloration if file is too big
|
||||
Style* text_color = &style_default;
|
||||
if (freqlist_db.size() > FREQMAN_MAX_PER_FILE)
|
||||
text_color = &style_yellow;
|
||||
uint8_t nb_lines = 0;
|
||||
for (uint8_t it = current_index; it < freqlist_db.size(); it++) {
|
||||
uint8_t line_height = (int)nb_lines * char_height;
|
||||
@ -75,7 +80,7 @@ void FreqManUIList::paint(Painter& painter) {
|
||||
// line is within the widget
|
||||
painter.draw_string(
|
||||
{0, r.location().y() + (int)nb_lines * char_height},
|
||||
style_default, description);
|
||||
*text_color, description);
|
||||
if (nb_lines == highlighted_index) {
|
||||
const Rect r_highlighted_freq{0, r.location().y() + (int)nb_lines * char_height, 240, char_height};
|
||||
painter.draw_rectangle(
|
||||
|
@ -61,12 +61,16 @@ class FreqManUIList : public Widget {
|
||||
void set_db(freqman_db& db);
|
||||
|
||||
private:
|
||||
static constexpr Style style_default{
|
||||
Style style_default{
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::white(),
|
||||
};
|
||||
|
||||
Style style_yellow{
|
||||
.font = font::fixed_8x16,
|
||||
.background = Color::black(),
|
||||
.foreground = Color::yellow(),
|
||||
};
|
||||
static constexpr int8_t char_height = 16;
|
||||
bool instant_exec_{false};
|
||||
freqman_db freqlist_db{};
|
||||
|
Loading…
Reference in New Issue
Block a user