1
0
Fork 0
mirror of https://github.com/opentx/opentx.git synced 2025-07-16 12:55:12 +03:00

FIXEDWIDTH flag

Editing fields are now in FIXED mode to show its real width on LCD.
TODO: font bitmaps have to be altered to center shorter characters to the center of the field.
This commit is contained in:
mhotar 2014-01-05 10:56:17 +01:00
parent b90a621db8
commit 32c16f9f28
4 changed files with 17 additions and 6 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 636 B

After

Width:  |  Height:  |  Size: 636 B

Before After
Before After

View file

@ -768,7 +768,12 @@ void editName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, uin
lcd_putsLeft(y, STR_NAME);
#endif
lcd_putsnAtt(x, y, name, size, ZCHAR | ((active && s_editMode <= 0) ? INVERS : 0));
uint8_t mode = 0;
if (active) {
if (s_editMode <= 0) mode = INVERS+FIXEDWIDTH;
else mode = FIXEDWIDTH;
}
lcd_putsnAtt(x, y, name, size, ZCHAR | mode);
if (active) {
uint8_t cur = editNameCursorPos;
@ -831,8 +836,9 @@ void editName(uint8_t x, uint8_t y, char *name, uint8_t size, uint8_t event, uin
name[cur] = v;
eeDirty(EE_MODEL);
}
lcd_putsnAtt(x, y, name, editNameCursorPos, ZCHAR | ((active && s_editMode <= 0) ? INVERS : 0));
lcd_putcAtt(lcdLastPos, y, idx2char(v), INVERS);
lcd_putcAtt(x+editNameCursorPos*FW, y, idx2char(v), INVERS+FIXEDWIDTH);
// lcd_putsnAtt(x, y, name, editNameCursorPos, ZCHAR);
// lcd_putcAtt(lcdLastPos, y, idx2char(v), INVERS);
}
else {
cur = 0;

View file

@ -287,7 +287,10 @@ void lcd_putcAtt(xcoord_t x, uint8_t y, const unsigned char c, LcdFlags flags)
}
}
else if (i <= 5) b = pgm_read_byte(q++);
if (b == 0xff) continue;
if (b == 0xff) {
if (flags & FIXEDWIDTH) b = 0;
else continue;
}
if (inv) b = ~b;
#if !defined(CPUM64) || defined(EXTSTD)
if (!(flags & BOLD) && (i == 7)) continue;
@ -459,6 +462,7 @@ void lcd_outdezNAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags flags, uint8_t
{
uint8_t fw = FWNUM;
int8_t mode = MODE(flags);
flags &= ~LEADING0;
bool dblsize = flags & DBLSIZE;
#if defined(CPUARM)
bool midsize = flags & MIDSIZE;
@ -490,6 +494,7 @@ void lcd_outdezNAtt(xcoord_t x, uint8_t y, lcdint_t val, LcdFlags flags, uint8_t
len = mode + 1;
}
if (dblsize) {
fw += FWNUM;
}
@ -933,7 +938,7 @@ void putsVBat(xcoord_t x, uint8_t y, LcdFlags att)
void putsStrIdx(xcoord_t x, uint8_t y, const pm_char *str, uint8_t idx, LcdFlags att)
{
lcd_putsAtt(x, y, str, att);
lcd_putsAtt(x, y, str, att & ~LEADING0);
lcd_outdezNAtt(lcdNextPos, y, idx, att|LEFT, 2);
}

View file

@ -78,7 +78,7 @@
/* lcd putc flags */
#define CONDENSED 0x08
#define FIXEDWIDTH 0x10
/* lcd puts flags */
/* no 0x80 here because of "GV"1 which is aligned LEFT */
/* no 0x10 here because of "MODEL"01 which uses LEADING0 */