mirror of
https://github.com/eried/portapack-mayhem.git
synced 2025-02-02 09:35:20 -05: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(
|
painter.fill_rectangle(
|
||||||
r_widget_screen,
|
r_widget_screen,
|
||||||
Color::black());
|
Color::black());
|
||||||
|
// only return after clearing the screen so previous entries are not shown anymore
|
||||||
if (freqlist_db.size() == 0)
|
if (freqlist_db.size() == 0)
|
||||||
return;
|
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;
|
uint8_t nb_lines = 0;
|
||||||
for (uint8_t it = current_index; it < freqlist_db.size(); it++) {
|
for (uint8_t it = current_index; it < freqlist_db.size(); it++) {
|
||||||
uint8_t line_height = (int)nb_lines * char_height;
|
uint8_t line_height = (int)nb_lines * char_height;
|
||||||
@ -75,7 +80,7 @@ void FreqManUIList::paint(Painter& painter) {
|
|||||||
// line is within the widget
|
// line is within the widget
|
||||||
painter.draw_string(
|
painter.draw_string(
|
||||||
{0, r.location().y() + (int)nb_lines * char_height},
|
{0, r.location().y() + (int)nb_lines * char_height},
|
||||||
style_default, description);
|
*text_color, description);
|
||||||
if (nb_lines == highlighted_index) {
|
if (nb_lines == highlighted_index) {
|
||||||
const Rect r_highlighted_freq{0, r.location().y() + (int)nb_lines * char_height, 240, char_height};
|
const Rect r_highlighted_freq{0, r.location().y() + (int)nb_lines * char_height, 240, char_height};
|
||||||
painter.draw_rectangle(
|
painter.draw_rectangle(
|
||||||
|
@ -61,12 +61,16 @@ class FreqManUIList : public Widget {
|
|||||||
void set_db(freqman_db& db);
|
void set_db(freqman_db& db);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
static constexpr Style style_default{
|
Style style_default{
|
||||||
.font = font::fixed_8x16,
|
.font = font::fixed_8x16,
|
||||||
.background = Color::black(),
|
.background = Color::black(),
|
||||||
.foreground = Color::white(),
|
.foreground = Color::white(),
|
||||||
};
|
};
|
||||||
|
Style style_yellow{
|
||||||
|
.font = font::fixed_8x16,
|
||||||
|
.background = Color::black(),
|
||||||
|
.foreground = Color::yellow(),
|
||||||
|
};
|
||||||
static constexpr int8_t char_height = 16;
|
static constexpr int8_t char_height = 16;
|
||||||
bool instant_exec_{false};
|
bool instant_exec_{false};
|
||||||
freqman_db freqlist_db{};
|
freqman_db freqlist_db{};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user