fix(gui): add missing channel IDs to mixer and output tabs. (#2464)
* fix(gui): add missing channel IDs to mixer and output tabs. Fixes #2073 * fix: input display and more space for names * made output names fit on all display variants * channe id display fine tuning * Outputs with no name are bigger ... magnifying glass was not included with tx ;) Co-authored-by: Raphael Coeffic <raphael.coeffic@frafos.com> Co-authored-by: Peter Feerick <peter.feerick@gmail.com>
This commit is contained in:
co-authored by
Raphael Coeffic
Peter Feerick
parent
59b33622b8
commit
40ae2e22a8
@@ -116,7 +116,7 @@ class ComboChannelBar : public Window
|
||||
|
||||
void paint(BitmapBuffer * dc) override
|
||||
{
|
||||
char chanString[] = "CH32 ";
|
||||
char chanString[] = TR_CH"32 ";
|
||||
int usValue = PPM_CH_CENTER(channel) + channelOutputs[channel] / 2;
|
||||
|
||||
// Channel number
|
||||
|
||||
@@ -29,7 +29,7 @@
|
||||
#include <algorithm>
|
||||
|
||||
static const lv_coord_t col_dsc[] = {
|
||||
LV_DPI_DEF / 2, LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST,
|
||||
lv_coord_t(LV_DPI_DEF * 0.65), LV_GRID_FR(1), LV_GRID_TEMPLATE_LAST,
|
||||
};
|
||||
|
||||
static const lv_coord_t row_dsc[] = {
|
||||
@@ -53,11 +53,30 @@ InputMixGroup::InputMixGroup(Window* parent, mixsrc_t idx) :
|
||||
lv_obj_add_event_cb(lvobj, InputMixGroup::value_changed,
|
||||
LV_EVENT_VALUE_CHANGED, nullptr);
|
||||
|
||||
lv_obj_t* chText = nullptr;
|
||||
if (idx >= MIXSRC_FIRST_CH && idx <= MIXSRC_LAST_CH
|
||||
&& g_model.limitData[idx - MIXSRC_CH1].name[0] != '\0') {
|
||||
chText = lv_label_create(lvobj);
|
||||
lv_label_set_text_fmt(chText, TR_CH "%u", idx - MIXSRC_CH1 + 1);
|
||||
lv_obj_set_style_text_font(chText, getFont(FONT(XS)), 0);
|
||||
#if LCD_H > LCD_W
|
||||
lv_obj_set_style_pad_bottom(chText, -2, 0);
|
||||
#endif
|
||||
lv_obj_set_grid_cell(chText,
|
||||
LV_GRID_ALIGN_START, 0, 1,
|
||||
LV_GRID_ALIGN_END, 0, 1);
|
||||
}
|
||||
|
||||
label = lv_label_create(lvobj);
|
||||
lv_obj_set_style_text_font(label, getFont(FONT(STD)), 0);
|
||||
#if LCD_H > LCD_W
|
||||
if(chText)
|
||||
lv_obj_set_style_pad_top(label, -1, 0);
|
||||
#endif
|
||||
lv_label_set_text(label, getSourceString(idx));
|
||||
lv_obj_set_grid_cell(label,
|
||||
LV_GRID_ALIGN_START, 0, 1,
|
||||
LV_GRID_ALIGN_START, 0, 1);
|
||||
chText?LV_GRID_ALIGN_START:LV_GRID_ALIGN_CENTER, 0, 1);
|
||||
|
||||
auto box = window_create(lvobj);
|
||||
lv_obj_set_size(box, lv_pct(100), LV_SIZE_CONTENT);
|
||||
|
||||
@@ -153,9 +153,16 @@ class OutputLineButton : public ListLineButton
|
||||
lv_obj_set_grid_dsc_array(lvobj, col_dsc, row_dsc);
|
||||
|
||||
source = lv_label_create(lvobj);
|
||||
lv_obj_set_style_text_font(source, getFont(FONT(BOLD)), 0);
|
||||
|
||||
#if LCD_H > LCD_W
|
||||
lv_obj_set_grid_cell(source, LV_GRID_ALIGN_START, 0, 1,
|
||||
LV_GRID_ALIGN_START, 0, 1);
|
||||
LV_GRID_ALIGN_CENTER, 0, 2);
|
||||
|
||||
#else
|
||||
lv_obj_set_style_text_font(source, getFont(FONT(XS)), 0);
|
||||
lv_obj_set_grid_cell(source, LV_GRID_ALIGN_START, 0, 1,
|
||||
LV_GRID_ALIGN_CENTER, 0, 1);
|
||||
#endif
|
||||
|
||||
lv_obj_add_event_cb(lvobj, OutputLineButton::on_draw, LV_EVENT_DRAW_MAIN, nullptr);
|
||||
}
|
||||
@@ -165,9 +172,18 @@ class OutputLineButton : public ListLineButton
|
||||
if (!init) return;
|
||||
|
||||
const LimitData* output = limitAddress(index);
|
||||
|
||||
lv_label_set_text(source, getSourceString(MIXSRC_CH1 + index));
|
||||
|
||||
if(g_model.limitData[index].name[0] != '\0')
|
||||
{
|
||||
#if LCD_W > LCD_H
|
||||
lv_obj_set_style_text_line_space(source, -3, LV_PART_MAIN);
|
||||
lv_obj_set_style_pad_top(source, -7, 0);
|
||||
lv_obj_set_style_pad_bottom(source, -7, 0);
|
||||
#endif
|
||||
lv_label_set_text_fmt(source, "%s\n" TR_CH "%u", getSourceString(MIXSRC_CH1 + index), index + 1);
|
||||
} else {
|
||||
lv_obj_set_style_text_font(source, getFont(FONT(STD)), 0);
|
||||
lv_label_set_text(source, getSourceString(MIXSRC_CH1 + index));
|
||||
}
|
||||
if (output->revert) {
|
||||
lv_obj_clear_flag(revert, LV_OBJ_FLAG_HIDDEN);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user