text
stringlengths 367
5.14M
| id
stringlengths 19
24
| metadata
dict |
|---|---|---|
const uint8_t FreeSerifBoldItalic24pt7bBitmaps[] PROGMEM = {
0x00, 0x3C, 0x00, 0xFC, 0x01, 0xF8, 0x07, 0xF0, 0x0F, 0xE0, 0x1F, 0xC0,
0x3F, 0x00, 0x7E, 0x00, 0xF8, 0x01, 0xF0, 0x07, 0xC0, 0x0F, 0x80, 0x1E,
0x00, 0x3C, 0x00, 0x70, 0x00, 0xE0, 0x01, 0xC0, 0x03, 0x00, 0x0E, 0x00,
0x18, 0x00, 0x30, 0x00, 0x40, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xF0, 0x03, 0xF0, 0x0F, 0xF0, 0x1F, 0xE0, 0x3F, 0xC0, 0x3F, 0x00,
0x3C, 0x00, 0x1C, 0x01, 0xC7, 0xC0, 0x7D, 0xF8, 0x1F, 0xBF, 0x03, 0xF7,
0xC0, 0x7C, 0xF8, 0x0F, 0x9E, 0x01, 0xE3, 0xC0, 0x3C, 0x70, 0x07, 0x1E,
0x00, 0xE3, 0x80, 0x38, 0x70, 0x07, 0x0C, 0x00, 0xC0, 0x00, 0x03, 0xC1,
0xE0, 0x00, 0x70, 0x38, 0x00, 0x1E, 0x0F, 0x00, 0x03, 0xC1, 0xE0, 0x00,
0x70, 0x38, 0x00, 0x1E, 0x0F, 0x00, 0x03, 0x81, 0xC0, 0x00, 0xF0, 0x78,
0x00, 0x1E, 0x0F, 0x00, 0x07, 0x83, 0xC0, 0x1F, 0xFF, 0xFF, 0x83, 0xFF,
0xFF, 0xF0, 0x7F, 0xFF, 0xFC, 0x00, 0xE0, 0x70, 0x00, 0x3C, 0x1E, 0x00,
0x07, 0x83, 0xC0, 0x00, 0xE0, 0x70, 0x00, 0x3C, 0x1E, 0x00, 0x07, 0x83,
0xC0, 0x00, 0xE0, 0x70, 0x07, 0xFF, 0xFF, 0xE0, 0xFF, 0xFF, 0xFC, 0x1F,
0xFF, 0xFF, 0x00, 0x38, 0x1C, 0x00, 0x0F, 0x07, 0x80, 0x01, 0xE0, 0xF0,
0x00, 0x38, 0x1C, 0x00, 0x0F, 0x07, 0x80, 0x01, 0xC0, 0xE0, 0x00, 0x78,
0x3C, 0x00, 0x0F, 0x07, 0x80, 0x01, 0xC0, 0xE0, 0x00, 0x78, 0x3C, 0x00,
0x00, 0x00, 0x00, 0xE0, 0x00, 0x00, 0xC0, 0x00, 0x00, 0xC0, 0x00, 0x1F,
0xE0, 0x00, 0x7F, 0xF8, 0x01, 0xF1, 0x9E, 0x01, 0xC1, 0x8F, 0x03, 0x83,
0x8F, 0x03, 0x83, 0x06, 0x07, 0x83, 0x06, 0x07, 0x87, 0x06, 0x07, 0xC7,
0x04, 0x07, 0xE6, 0x04, 0x07, 0xFE, 0x00, 0x03, 0xFE, 0x00, 0x03, 0xFF,
0x00, 0x01, 0xFF, 0x80, 0x00, 0xFF, 0xC0, 0x00, 0x7F, 0xE0, 0x00, 0x1F,
0xE0, 0x00, 0x1F, 0xF0, 0x00, 0x3F, 0xF0, 0x00, 0x3B, 0xF8, 0x20, 0x31,
0xF8, 0x20, 0x30, 0xF8, 0x60, 0x70, 0xF8, 0x60, 0x60, 0xF8, 0x60, 0x60,
0xF8, 0xF0, 0xE0, 0xF0, 0xF0, 0xE1, 0xE0, 0x78, 0xC3, 0xE0, 0x3C, 0xC7,
0xC0, 0x0F, 0xFF, 0x00, 0x03, 0xFC, 0x00, 0x01, 0x80, 0x00, 0x03, 0x80,
0x00, 0x03, 0x80, 0x00, 0x03, 0x00, 0x00, 0x03, 0x00, 0x00, 0x01, 0xF0,
0x00, 0x70, 0x00, 0xFF, 0x80, 0x1C, 0x00, 0x3F, 0x38, 0x1F, 0x00, 0x0F,
0xC7, 0xFF, 0xE0, 0x03, 0xF0, 0x3F, 0xB8, 0x00, 0x7E, 0x04, 0x07, 0x00,
0x1F, 0x80, 0x81, 0xC0, 0x03, 0xF0, 0x10, 0x38, 0x00, 0xFC, 0x02, 0x0E,
0x00, 0x1F, 0x80, 0x81, 0x80, 0x03, 0xF0, 0x10, 0x70, 0x00, 0x7C, 0x06,
0x1C, 0x00, 0x0F, 0x80, 0x83, 0x80, 0x01, 0xF0, 0x30, 0xE0, 0x00, 0x1E,
0x0C, 0x1C, 0x07, 0xC3, 0xE3, 0x07, 0x03, 0xFC, 0x3F, 0xC0, 0xC0, 0xFC,
0x43, 0xE0, 0x38, 0x3E, 0x0C, 0x00, 0x0E, 0x0F, 0xC0, 0x80, 0x01, 0xC3,
0xF0, 0x10, 0x00, 0x70, 0xFC, 0x02, 0x00, 0x0C, 0x1F, 0x80, 0x40, 0x03,
0x83, 0xE0, 0x08, 0x00, 0x60, 0xFC, 0x02, 0x00, 0x1C, 0x1F, 0x80, 0x40,
0x07, 0x03, 0xE0, 0x10, 0x00, 0xE0, 0x7C, 0x02, 0x00, 0x38, 0x0F, 0x80,
0xC0, 0x06, 0x01, 0xF0, 0x30, 0x01, 0xC0, 0x1F, 0x0C, 0x00, 0x30, 0x01,
0xFF, 0x00, 0x0E, 0x00, 0x1F, 0x80, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x00,
0xFF, 0x80, 0x00, 0x01, 0xF1, 0xE0, 0x00, 0x00, 0xF0, 0x78, 0x00, 0x00,
0xF0, 0x3C, 0x00, 0x00, 0x78, 0x1E, 0x00, 0x00, 0x7C, 0x0F, 0x00, 0x00,
0x3E, 0x0F, 0x80, 0x00, 0x1F, 0x07, 0x80, 0x00, 0x0F, 0x87, 0x80, 0x00,
0x07, 0xC7, 0x80, 0x00, 0x03, 0xFF, 0x00, 0x00, 0x01, 0xFE, 0x00, 0x00,
0x00, 0xFC, 0x00, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x01, 0xFF, 0x07, 0xFE,
0x03, 0xCF, 0xC0, 0xFE, 0x03, 0xC7, 0xE0, 0x3C, 0x07, 0xC3, 0xF0, 0x1C,
0x07, 0xC0, 0xFC, 0x0C, 0x03, 0xC0, 0x7E, 0x0E,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 0x00, 0x03,
0xF0, 0x00, 0x0F, 0xC0, 0x00, 0x3F, 0x00, 0x00, 0xFC, 0x00, 0x03, 0xE0,
0x00, 0x0F, 0x80, 0x00, 0x3C, 0x1C, 0x01, 0xF0, 0xF8, 0x07, 0x83, 0xF0,
0x3C, 0x0F, 0xE1, 0xE0, 0x1F, 0xFE, 0x00, 0x1F, 0xC0, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x07, 0x80, 0x00, 0x07, 0xC0, 0x00, 0x07, 0xE0, 0x00,
0x07, 0xE0, 0x00, 0x07, 0xF0, 0x00, 0x07, 0xF8, 0x00, 0x07, 0xFC, 0x00,
0x06, 0xFC, 0x00, 0x06, 0x7E, 0x00, 0x06, 0x3F, 0x00, 0x06, 0x3F, 0x00,
0x06, 0x1F, 0x80, 0x06, 0x0F, 0xC0, 0x06, 0x07, 0xE0, 0x03, 0x07, 0xE0,
0x03, 0x03, 0xF0, 0x03, 0x01, 0xF8, 0x03, 0x01, 0xFC, 0x03, 0x00, 0xFC,
0x03, 0x00, 0x7E, 0x03, 0xFF, 0xFF, 0xE1, 0xFF, 0xFF, 0xF0, 0xFF, 0xFF,
0xF0, 0xFF, 0xFF, 0xF8, 0x00, 0x07, 0xE0, 0x00, 0x07, 0xE0, 0x00, 0x03,
0xF0, 0x00, 0x01, 0xF8, 0x00, 0x01, 0xFC, 0x00, 0x00, 0xFC, 0x00, 0x00,
0x7E, 0x00, 0x00, 0x3F, 0xFE, 0x00, 0x7F, 0xFE, 0x00, 0x7F, 0xFE, 0x00,
0x7F, 0xFC, 0x00, 0xFF, 0xFC, 0x00, 0xC0, 0x00, 0x01, 0x80, 0x00, 0x01,
0x80, 0x00, 0x03, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x07, 0xFE, 0x00, 0x07,
0xFF, 0x00, 0x07, 0xFF, 0x80, 0x0F, 0xFF, 0xC0, 0x00, 0xFF, 0xE0, 0x00,
0x1F, 0xE0, 0x00, 0x0F, 0xF0, 0x00, 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x1F, 0xFF, 0xC0, 0x1F, 0xFF, 0x00, 0x00, 0xFE, 0x00, 0x03,
0xF8, 0x00, 0x0F, 0xE0, 0x00, 0x1F, 0x80, 0x00, 0x7E, 0x00, 0x01, 0xF8,
0x00, 0x07, 0xE0, 0x00, 0x1F, 0x80, 0x00, 0x7C, 0x00, 0x03, 0xE0, 0x00,
0x1F, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x01, 0xE0, 0x1F, 0x81, 0xFE, 0x0F,
0xF0, 0x7F, 0x81, 0xF8, 0x07, 0x80, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80, 0x7E, 0x07, 0xF8, 0x3F,
0xC1, 0xFE, 0x07, 0xE0, 0x1E, 0x00, 0x00, 0x78, 0x01, 0xF8, 0x07, 0xF8,
0x0F, 0xF0, 0x1F, 0xE0, 0x1F, 0x80, 0x1E, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x80,
0x1F, 0x80, 0x3F, 0x80, 0x7F, 0x00, 0xFE, 0x00, 0xFC, 0x00, 0xF8, 0x00,
0xE0, 0x01, 0xC0, 0x07, 0x00, 0x0C, 0x00, 0x30, 0x01, 0xC0, 0x0E, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00, 0x07, 0x00, 0x00, 0x1F,
0x00, 0x00, 0x7F, 0x00, 0x03, 0xFF, 0x00, 0x0F, 0xFC, 0x00, 0x3F, 0xF0,
0x01, 0xFF, 0xC0, 0x07, 0xFE, 0x00, 0x1F, 0xF8, 0x00, 0x7F, 0xE0, 0x00,
0xFF, 0x80, 0x00, 0xFC, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFF, 0xE0, 0x00,
0x1F, 0xF8, 0x00, 0x07, 0xFE, 0x00, 0x01, 0xFF, 0xC0, 0x00, 0x3F, 0xF0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FF, 0xE7, 0xFF, 0xFF, 0xFC, 0xFE, 0x3F, 0x8F, 0x9E,
0x07, 0xF0, 0xF3, 0x81, 0xFC, 0x0E, 0x60, 0x3F, 0x81, 0x98, 0x07, 0xF0,
0x13, 0x00, 0xFC, 0x02, 0x00, 0x3F, 0x80, 0x40, 0x07, 0xF0, 0x00, 0x00,
0xFE, 0x00, 0x00, 0x3F, 0x80, 0x00, 0x07, 0xF0, 0x00, 0x00, 0xFE, 0x00,
0x00, 0x1F, 0x80, 0x00, 0x07, 0xF0, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x1F,
0xC0, 0x00, 0x03, 0xF0, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x1F, 0xC0, 0x00,
0x03, 0xF8, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x1F, 0xC0, 0x00, 0x03, 0xF8,
0x00, 0x00, 0x7E, 0x00, 0x00, 0x1F, 0xC0, 0x00, 0x03, 0xF8, 0x00, 0x00,
0xFF, 0x00, 0x00, 0x3F, 0xF0, 0x00, 0x3F, 0xFF, 0xC0, 0x00, 0x7F, 0xFF,
0x03, 0xFF, 0x0F, 0xFC, 0x00, 0xFC, 0x07, 0xF0, 0x00, 0x38, 0x07, 0xF0,
0x00, 0x38, 0x07, 0xF0, 0x00, 0x30, 0x0F, 0xE0, 0x00, 0x30, 0x0F, 0xE0,
0x00, 0x70, 0x0F, 0xE0, 0x00, 0x60, 0x0F, 0xE0, 0x00, 0x60, 0x1F, 0xC0,
0x00, 0xE0, 0x1F, 0xC0, 0x00, 0xC0, 0x1F, 0xC0, 0x00, 0xC0, 0x3F, 0x80,
0x00, 0xC0, 0x3F, 0x80, 0x01, 0x80, 0x3F, 0x80, 0x01, 0x80, 0x3F, 0x80,
0x01, 0x80, 0x7F, 0x00, 0x01, 0x80, 0x7F, 0x00, 0x03, 0x00, 0x7F, 0x00,
0x03, 0x00, 0x7E, 0x00, 0x03, 0x00, 0xFE, 0x00, 0x06, 0x00, 0xFE, 0x00,
0x06, 0x00, 0xFC, 0x00, 0x06, 0x00, 0xFC, 0x00, 0x0E, 0x00, 0xFC, 0x00,
0x0C, 0x00, 0xFC, 0x00, 0x1C, 0x00, 0xFC, 0x00, 0x18, 0x00, 0x7E, 0x00,
0x38, 0x00, 0x7E, 0x00, 0x70, 0x00, 0x3F, 0x81, 0xE0, 0x00, 0x0F, 0xFF,
0x80, 0x00, 0x03, 0xFE, 0x00, 0x00, 0xFF, 0xFC, 0x03, 0xFE, 0x7F, 0xE0,
0x01, 0xF8, 0x7F, 0x80, 0x01, 0xC0, 0xFF, 0x00, 0x03, 0x80, 0xFE, 0x00,
0x0E, 0x01, 0xFC, 0x00, 0x18, 0x03, 0xF8, 0x00, 0x70, 0x07, 0xF0, 0x00,
0xC0, 0x0F, 0xF0, 0x03, 0x80, 0x1F, 0xE0, 0x0E, 0x00, 0x1F, 0xC0, 0x18,
0x00, 0x3F, 0x80, 0x70, 0x00, 0x7F, 0x00, 0xC0, 0x00, 0xFE, 0x03, 0x00,
0x01, 0xFC, 0x0E, 0x00, 0x03, 0xF8, 0x18, 0x00, 0x07, 0xF8, 0x60, 0x00,
0x07, 0xF1, 0xC0, 0x00, 0x0F, 0xE3, 0x00, 0x00, 0x1F, 0xCC, 0x00, 0x00,
0x3F, 0xB8, 0x00, 0x00, 0x7F, 0x60, 0x00, 0x00, 0xFF, 0xC0, 0x00, 0x00,
0xFF, 0x00, 0x00, 0x01, 0xFC, 0x00, 0x00, 0x03, 0xF8, 0x00, 0x00, 0x07,
0xE0, 0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x00, 0x3C,
0x00, 0x00, 0x00, 0x30, 0x00, 0x00, 0x00, 0x60, 0x00, 0x00, 0xFF, 0xF8,
0xFF, 0xF0, 0xFF, 0x9F, 0xF8, 0x1F, 0xE0, 0x0F, 0x87, 0xF8, 0x07, 0xE0,
0x07, 0x03, 0xF8, 0x03, 0xF0, 0x03, 0x80, 0xFE, 0x01,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, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x00, 0x07, 0xF8,
0x00, 0x00, 0x01, 0xFC, 0x00, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x00, 0x0F,
0xC0, 0x00, 0x00, 0x03, 0xF8, 0x00, 0x00, 0x01, 0xFE, 0x00, 0x00, 0x00,
0xFF, 0x80, 0x00, 0x00, 0x77, 0xF0, 0x00, 0x00, 0x39, 0xFC, 0x00, 0x00,
0x1C, 0x3F, 0x00, 0x00, 0x06, 0x0F, 0xE0, 0x00, 0x03, 0x03, 0xF8, 0x00,
0x01, 0x80, 0x7E, 0x00, 0x00, 0xE0, 0x1F, 0xC0, 0x00, 0x70, 0x07, 0xF0,
0x00, 0x38, 0x01, 0xFC, 0x00, 0x1E, 0x00, 0x7F, 0x80, 0x1F, 0xC0, 0x1F,
0xF0, 0x0F, 0xFC, 0x3F, 0xFF, 0x80, 0xFF, 0xF8, 0x3F, 0xF3, 0xFC, 0x00,
0xFC, 0x1F, 0xC0, 0x07, 0x81, 0xFC, 0x00, 0x70, 0x0F, 0xC0, 0x0E, 0x00,
0xFE, 0x00, 0xC0, 0x0F, 0xE0, 0x1C, 0x00, 0x7E, 0x03, 0x80, 0x07, 0xF0,
0x30, 0x00, 0x7F, 0x06, 0x00, 0x03, 0xF0, 0xE0, 0x00, 0x3F, 0x8C, 0x00,
0x03, 0xF9, 0x80, 0x00, 0x1F, 0xB0, 0x00, 0x01, 0xFF, 0x00, 0x00, 0x1F,
0xE0, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x1F, 0xC0, 0x00, 0x01, 0xFC, 0x00,
0x00, 0x1F, 0x80, 0x00, 0x03, 0xF8, 0x00, 0x00, 0x3F, 0x80, 0x00, 0x03,
0xF8, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x07, 0xF0, 0x00, 0x00, 0x7F, 0x00,
0x00, 0x07, 0xF0, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x0F, 0xF0, 0x00, 0x01,
0xFF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, 0x80, 0x01, 0xE0, 0x00,
0x3C, 0x00, 0x0F, 0x80, 0x01, 0xF0, 0x00, 0x3E, 0x00, 0x07, 0xFE, 0x01,
0xFF, 0xC0, 0x00, 0xF0, 0x07, 0x80, 0x1E, 0x00, 0xF0, 0x07, 0x80, 0x1C,
0x00, 0xF0, 0x07, 0x80, 0x3C, 0x00, 0xF0, 0x07, 0x80, 0x3C, 0x01, 0xE0,
0x07, 0x80, 0x3C, 0x01, 0xE0, 0x07, 0x00, 0x3C, 0x01, 0xE0, 0x0F, 0x00,
0x3C, 0x01, 0xE0, 0x0F, 0x00, 0x78, 0x01, 0xE0, 0x0F, 0x00, 0x78, 0x01,
0xC0, 0x0F, 0x00, 0x78, 0x03, 0xC0, 0x0F, 0x00, 0x78, 0x00, 0x7F, 0xE0,
0x0F, 0xFC, 0x00, 0x0F, 0x80, 0x01, 0xE0, 0x00, 0x7C, 0x00, 0x0F, 0x80,
0x01, 0xF0, 0x00, 0x3C, 0x00, 0x0F, 0x80, 0x01, 0xF0, 0x00, 0x3E, 0x00,
0x07, 0x80, 0x01, 0xF0, 0x00, 0x3E, 0x00, 0x07, 0xC0, 0x00, 0xF0, 0x00,
0x3E, 0x00, 0x07, 0xC0, 0x00, 0xF8, 0x00, 0x1E, 0x00, 0x07, 0xC0, 0x00,
0xF8, 0x00, 0x1F, 0x00, 0x03, 0xC0, 0x00, 0xF8, 0x00, 0x1F, 0x00, 0x03,
0xE0, 0x00, 0x78, 0x00, 0x1F, 0x00, 0x03, 0xE0, 0x00, 0x7C, 0x00, 0x0F,
0x00, 0x01, 0xE0, 0x00, 0x7C, 0x00, 0x0F, 0x80, 0x01, 0xE0, 0x07, 0xFC,
0x01, 0xFF, 0x80, 0x00, 0x00, 0xF8, 0x00, 0x07, 0xC0, 0x00, 0x7F, 0x00,
0x03, 0xF8, 0x00, 0x3F, 0xC0, 0x01, 0xEF, 0x00, 0x1E, 0x78, 0x00, 0xF1,
0xE0, 0x0F, 0x0F, 0x00, 0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 0x3C, 0x0F, 0x0F, 0x07, 0x83, 0xC3,
0xE0, 0xF1, 0xF0, 0x3C, 0xFC, 0x1E, 0x3F, 0x0F, 0x9F, 0x83, 0xC7, 0xE3,
0xE1, 0xFB, 0xE0, 0xFF, 0xE0, 0x3F, 0xC0, 0x0F, 0xC0, 0x03, 0xF0, 0x00,
0xFC, 0x03, 0x3F, 0x01, 0x8F, 0xC0, 0xC1, 0xF8, 0x70, 0x7F, 0xF8, 0x07,
0xFC, 0x00, 0xFC, 0x00, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x03, 0xCE, 0x00,
0x00, 0x78, 0xF0, 0x00, 0x0F, 0x8F, 0x00, 0x00, 0xF0, 0xF0, 0x00, 0x1F,
0x06, 0x00, 0x01, 0xF0, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x03, 0xE0, 0x00,
0x00, 0x3E, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x03, 0xFF, 0xC0, 0x00, 0x3F,
0xFC, 0x00, 0x00, 0xFC, 0x00, 0x00, 0x0F, 0xC0, 0x00, 0x00, 0xF8, 0x00,
0x00, 0x0F, 0x80, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x1F, 0x80, 0x00, 0x01,
0xF8, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x3F, 0x00,
0x00, 0x03, 0xF0, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x03, 0xE0, 0x00, 0x00,
0x7E, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x07, 0xC0,
0x00, 0x00, 0xFC, 0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0xF8, 0x00, 0x00,
0x0F, 0x80, 0x00, 0x01, 0xF0, 0x00, 0x06, 0x1F, 0x00, 0x00, 0xF1, 0xE0,
0x00, 0x0F, 0x3E, 0x00, 0x00, 0xF3, 0xC0, 0x00, 0x07, 0xF8, 0x00, 0x00,
0x3E, 0x00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x00, 0xF0, 0x1E, 0x0F,
0xF0, 0x3E, 0x01, 0xF8, 0x7F, 0x01, 0xF8, 0xFF, 0x00, 0xF9, 0x8E, 0x00,
0xFB, 0x00, 0x00, 0xFF, 0x00, 0x00, 0xFE, 0x00, 0x00, 0x7C, 0x00, 0x00,
0x7C, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x7E, 0x00, 0x00, 0x7E, 0x00, 0x00,
0x7E, 0x00, 0x00, 0x7E, 0x00, 0x00, 0xFE, 0x00, 0x01, 0xBF, 0x00, 0x01,
0xBF, 0x08, 0x73, 0x1F, 0x18, 0xFF, 0x1F, 0x30, 0xFE, 0x1F, 0xE0, 0xFC,
0x0F, 0xC0, 0x78, 0x07, 0x80, 0x00, 0x30, 0x1C, 0x0F, 0xF0, 0x7C, 0x07,
0xE0, 0xF8, 0x0F, 0xC1, 0xF0, 0x0F, 0xC1, 0xE0, 0x1F, 0x81, 0xC0, 0x3F,
0x03, 0x00, 0x3E, 0x06, 0x00, 0x7E, 0x08, 0x00, 0xFC, 0x30, 0x01, 0xF8,
0x60, 0x01, 0xF1, 0x80, 0x03, 0xE3, 0x00, 0x07, 0xCC, 0x00, 0x0F, 0xD8,
0x00, 0x1F, 0xE0, 0x00, 0x1F, 0xC0, 0x00, 0x3F, 0x00, 0x00, 0x7E, 0x00,
0x00, 0xF8, 0x00, 0x01, 0xE0, 0x00, 0x03, 0xC0, 0x00, 0x07, 0x00, 0x00,
0x0C, 0x00, 0x00, 0x18, 0x00, 0x00, 0x60, 0x01, 0xC1, 0x80, 0x07, 0xE6,
0x00, 0x0F, 0xF8, 0x00, 0x1F, 0xC0, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x07,
0xFF, 0xE1, 0xFF, 0xF8, 0x3F, 0xFF, 0x07, 0xFF, 0xC0, 0x80, 0x70, 0x30,
0x1C, 0x04, 0x07, 0x00, 0x00, 0xC0, 0x00, 0x38, 0x00, 0x0E, 0x00, 0x03,
0x80, 0x00, 0x60, 0x00, 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F,
0x80, 0x01, 0xF0, 0x00, 0x1F, 0x00, 0x01, 0xF0, 0x00, 0x1F, 0x00, 0x00,
0xF8, 0x00, 0x03, 0xE0, 0x00, 0x78, 0x00, 0x1E, 0x00, 0x03, 0xE0, 0x00,
0x7C, 0x00, 0x07, 0xC0, 0x00, 0xF8, 0x00, 0x0F, 0x80, 0x00, 0xF8, 0x00,
0x0F, 0x80, 0x01, 0xF0, 0x00, 0x1F, 0x00, 0x01, 0xF0, 0x00, 0x1F, 0x00,
0x03, 0xE0, 0x00, 0x3E, 0x00, 0x07, 0xC0, 0x00, 0x7C, 0x00, 0x0F, 0x80,
0x03, 0xF0, 0x00, 0xF8, 0x00, 0x00, 0x1F, 0x00, 0x03, 0xFF, 0x01, 0x3F,
0xFE, 0x1D, 0xFF, 0xFF, 0xFE, 0x0F, 0xFF, 0x00, 0x1F, 0xF0, 0x00, 0x1F,
0x00 };
const GFXglyph FreeSerifBoldItalic24pt7bGlyphs[] PROGMEM = {
{ 0, 0, 0, 12, 0, 1 }, // 0x20 ' '
{ 0, 15, 33, 18, 3, -31 }, // 0x21 '!'
{ 62, 19, 13, 26, 6, -31 }, // 0x22 '"'
{ 93, 27, 33, 23, -2, -32 }, // 0x23 '#'
{ 205, 24, 39, 24, -1, -33 }, // 0x24 '$'
{ 322, 35, 32, 39, 2, -30 }, // 0x25 '%'
{ 462, 33, 33, 37, 0, -31 }, // 0x26 '&'
{ 599, 7, 13, 13, 6, -31 }, // 0x27 '''
{ 611, 14, 41, 16, 1, -31 }, // 0x28 '('
{ 683, 14, 41, 16, -2, -31 }, // 0x29 ')'
{ 755, 19, 20, 23, 3, -31 }, // 0x2A '*'
{ 803, 22, 23, 27, 2, -22 }, // 0x2B '+'
{ 867, 10, 15, 12, -3, -5 }, // 0x2C ','
{ 886, 12, 5, 16, 0, -12 }, // 0x2D '-'
{ 894, 8, 7, 12, 0, -5 }, // 0x2E '.'
{ 901, 19, 33, 16, 0, -31 }, // 0x2F '/'
{ 980, 22, 33, 23, 1, -31 }, // 0x30 '0'
{ 1071, 20, 32, 23, 0, -31 }, // 0x31 '1'
{ 1151, 22, 32, 23, 1, -31 }, // 0x32 '2'
{ 1239, 22, 33, 24, 0, -31 }, // 0x33 '3'
{ 1330, 25, 32, 23, 0, -31 }, // 0x34 '4'
{ 1430, 24, 32, 24, 0, -30 }, // 0x35 '5'
{ 1526, 23, 32, 24, 1, -30 }, // 0x36 '6'
{ 1618, 23, 31, 23, 3, -30 }, // 0x37 '7'
{ 1708, 21, 33, 23, 1, -31 }, // 0x38 '8'
{ 1795, 23, 33, 23, 0, -31 }, // 0x39 '9'
{ 1890, 13, 22, 12, 0, -20 }, // 0x3A ':'
{ 1926, 15, 30, 12, -2, -20 }, // 0x3B ';'
{ 1983, 24, 25, 27, 1, -23 }, // 0x3C '<'
{ 2058, 24, 14, 27, 3, -18 }, // 0x3D '='
{ 2100, 24, 25, 27, 3, -23 }, // 0x3E '>'
{ 2175, 18, 33, 24, 4, -31 }, // 0x3F '?'
{ 2250, 33, 33, 39, 3, -31 }, // 0x40 '@'
{ 2387, 31, 32, 33, 0, -31 }, // 0x41 'A'
{ 2511, 31, 31, 30, 0, -30 }, // 0x42 'B'
{ 2632, 29, 33, 29, 2, -31 }, // 0x43 'C'
{ 2752, 35, 31, 34, 0, -30 }, // 0x44 'D'
{ 2888, 32, 31, 30, 0, -30 }, // 0x45 'E'
{ 3012, 31, 31, 29, 0, -30 }, // 0x46 'F'
{ 3133, 32, 33, 33, 2, -31 }, // 0x47 'G'
{ 3265, 39, 31, 35, 0, -30 }, // 0x48 'H'
{ 3417, 21, 31, 18, 0, -30 }, // 0x49 'I'
{ 3499, 27, 36, 23, 0, -30 }, // 0x4A 'J'
{ 3621, 34, 31, 31, 0, -30 }, // 0x4B 'K'
{ 3753, 29, 31, 29, 0, -30 }, // 0x4C 'L'
{ 3866, 44, 32, 41, 0, -30 }, // 0x4D 'M'
{ 4042, 37, 32, 33, 0, -30 }, // 0x4E 'N'
{ 4190, 31, 33, 32, 2, -31 }, // 0x4F 'O'
{ 4318, 31, 31, 28, 0, -30 }, // 0x50 'P'
{ 4439, 31, 42, 32, 2, -31 }, // 0x51 'Q'
{ 4602, 32, 31, 31, 0, -30 }, // 0x52 'R'
{ 4726, 24, 33, 24, 0, -31 }, // 0x53 'S'
{ 4825, 27, 31, 28, 4, -30 }, // 0x54 'T'
{ 4930, 32, 32, 34, 5, -30 }, // 0x55 'U'
{ 5058, 31, 32, 33, 6, -30 }, // 0x56 'V'
{ 5182, 41, 32, 44, 6, -30 }, // 0x57 'W'
{ 5346, 34, 31, 33, 0, -30 }, // 0x58 'X'
{ 5478, 28, 31, 30, 6, -30 }, // 0x59 'Y'
{ 5587, 28, 31, 26, 0, -30 }, // 0x5A 'Z'
{ 5696, 19, 38, 16, -2, -30 }, // 0x5B '['
{ 5787, 13, 33, 19, 6, -31 }, // 0x5C '\'
{ 5841, 19, 38, 16, -3, -30 }, // 0x5D ']'
{ 5932, 21, 17, 27, 3, -30 }, // 0x5E '^'
{ 5977, 24, 3, 23, 0, 5 }, // 0x5F '_'
{ 5986, 10, 9, 16, 4, -32 }, // 0x60 '`'
{ 5998, 22, 23, 24, 1, -21 }, // 0x61 'a'
{ 6062, 22, 33, 23, 1, -31 }, // 0x62 'b'
{ 6153, 18, 23, 20, 1, -21 }, // 0x63 'c'
{ 6205, 25, 34, 24, 1, -32 }, // 0x64 'd'
{ 6312, 18, 23, 20, 1, -21 }, // 0x65 'e'
{ 6364, 28, 41, 23, -4, -31 }, // 0x66 'f'
{ 6508, 25, 31, 23, -1, -21 }, // 0x67 'g'
{ 6605, 23, 34, 26, 1, -32 }, // 0x68 'h'
{ 6703, 12, 33, 14, 2, -31 }, // 0x69 'i'
{ 6753, 22, 42, 16, -4, -31 }, // 0x6A 'j'
{ 6869, 24, 34, 24, 1, -32 }, // 0x6B 'k'
{ 6971, 13, 34, 14, 2, -32 }, // 0x6C 'l'
{ 7027, 35, 23, 36, 0, -21 }, // 0x6D 'm'
{ 7128, 23, 23, 25, 0, -21 }, // 0x6E 'n'
{ 7195, 20, 23, 22, 1, -21 }, // 0x6F 'o'
{ 7253, 27, 31, 23, -4, -21 }, // 0x70 'p'
{ 7358, 22, 31, 23, 1, -21 }, // 0x71 'q'
{ 7444, 20, 22, 19, 0, -21 }, // 0x72 'r'
{ 7499, 16, 23, 17, 0, -21 }, // 0x73 's'
{ 7545, 13, 29, 13, 2, -27 }, // 0x74 't'
{ 7593, 22, 23, 25, 2, -21 }, // 0x75 'u'
{ 7657, 17, 23, 21, 3, -21 }, // 0x76 'v'
{ 7706, 27, 23, 31, 3, -21 }, // 0x77 'w'
{ 7784, 24, 23, 22, -1, -21 }, // 0x78 'x'
{ 7853, 23, 31, 20, -3, -21 }, // 0x79 'y'
{ 7943, 19, 25, 19, 0, -20 }, // 0x7A 'z'
{ 8003, 20, 41, 16, 0, -31 }, // 0x7B '{'
{ 8106, 4, 33, 13, 5, -31 }, // 0x7C '|'
{ 8123, 20, 41, 16, -6, -31 }, // 0x7D '}'
{ 8226, 21, 7, 27, 3, -14 } }; // 0x7E '~'
const GFXfont FreeSerifBoldItalic24pt7b PROGMEM = {
(uint8_t *)FreeSerifBoldItalic24pt7bBitmaps,
(GFXglyph *)FreeSerifBoldItalic24pt7bGlyphs,
0x20, 0x7E, 56 };
// Approx. 8917 bytes
|
train_000.parquet/900
|
{
"file_path": "esp32/examples/color_code/components/lcd/Adafruit-GFX-Library/Fonts/FreeSerifBoldItalic24pt7b.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 56292,
"token_count": 53228
}
|
const uint8_t FreeSansBoldOblique9pt7bBitmaps[] PROGMEM = {
0x21, 0x8E, 0x73, 0x18, 0xC6, 0x21, 0x19, 0xCE, 0x00, 0xEF, 0xDF, 0xBE,
0x68, 0x80, 0x06, 0xC1, 0x99, 0xFF, 0xBF, 0xF1, 0xB0, 0x66, 0x0C, 0xC7,
0xFC, 0xFF, 0x8C, 0x83, 0x30, 0x64, 0x00, 0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 0x00,
0x38, 0xCF, 0xFE, 0x71, 0x86, 0x38, 0xE3, 0x8F, 0x3C, 0x31, 0xDC, 0x77,
0x19, 0x86, 0x63, 0xB8, 0xEE, 0x33, 0x9C, 0xFF, 0x1F, 0xC0, 0xE1, 0x98,
0xE6, 0x31, 0x9C, 0x66, 0x1B, 0x86, 0xC1, 0xF0, 0x78, 0x0E, 0x00, 0xE7,
0x1B, 0x9C, 0xEE, 0x73, 0x3B, 0xDC, 0xEB, 0x63, 0xAD, 0x8F, 0xBC, 0x1C,
0xF0, 0x73, 0xC1, 0xCE, 0x00, 0x1C, 0xE1, 0xCC, 0x0D, 0x80, 0xF8, 0x0F,
0x00, 0xF0, 0x1F, 0x03, 0xB8, 0x33, 0x87, 0x38, 0x70, 0xCE, 0x38, 0xC6,
0x19, 0xC3, 0x30, 0x66, 0x0F, 0x81, 0xF0, 0x3C, 0x03, 0x80, 0x60, 0x18,
0x0F, 0x01, 0xC0, 0x00, 0x1F, 0xCF, 0xF0, 0x38, 0x1C, 0x0E, 0x07, 0x03,
0x81, 0xC0, 0x7F, 0xBF, 0xE0, 0x0E, 0x38, 0x61, 0x83, 0x06, 0x0C, 0x78,
0xF0, 0xC1, 0x83, 0x0E, 0x1C, 0x38, 0x78, 0x70, 0x18, 0xC4, 0x21, 0x18,
0xC4, 0x21, 0x18, 0xC4, 0x23, 0x18, 0x80, 0x1C, 0x3C, 0x38, 0x70, 0xE1,
0x83, 0x06, 0x1E, 0x5C, 0x60, 0xC1, 0x83, 0x0C, 0x38, 0xE0, 0x71, 0x8E };
const GFXglyph FreeSansBoldOblique9pt7bGlyphs[] PROGMEM = {
{ 0, 0, 0, 5, 0, 1 }, // 0x20 ' '
{ 0, 5, 13, 6, 2, -12 }, // 0x21 '!'
{ 9, 7, 5, 9, 3, -12 }, // 0x22 '"'
{ 14, 11, 12, 10, 1, -11 }, // 0x23 '#'
{ 31, 11, 16, 10, 1, -13 }, // 0x24 '$'
{ 53, 14, 13, 16, 2, -12 }, // 0x25 '%'
{ 76, 12, 13, 13, 2, -12 }, // 0x26 '&'
{ 96, 3, 5, 4, 3, -12 }, // 0x27 '''
{ 98, 8, 17, 6, 2, -12 }, // 0x28 '('
{ 115, 8, 17, 6, -2, -13 }, // 0x29 ')'
{ 132, 6, 6, 7, 3, -12 }, // 0x2A '*'
{ 137, 9, 8, 11, 2, -7 }, // 0x2B '+'
{ 146, 4, 6, 5, 0, -2 }, // 0x2C ','
{ 149, 5, 2, 6, 1, -5 }, // 0x2D '-'
{ 151, 3, 2, 5, 1, -1 }, // 0x2E '.'
{ 152, 8, 13, 5, 0, -12 }, // 0x2F '/'
{ 165, 10, 13, 10, 1, -12 }, // 0x30 '0'
{ 182, 7, 13, 10, 3, -12 }, // 0x31 '1'
{ 194, 11, 13, 10, 1, -12 }, // 0x32 '2'
{ 212, 11, 13, 10, 1, -12 }, // 0x33 '3'
{ 230, 10, 12, 10, 1, -11 }, // 0x34 '4'
{ 245, 11, 13, 10, 1, -12 }, // 0x35 '5'
{ 263, 10, 13, 10, 2, -12 }, // 0x36 '6'
{ 280, 10, 13, 10, 2, -12 }, // 0x37 '7'
{ 297, 11, 13, 10, 1, -12 }, // 0x38 '8'
{ 315, 11, 13, 10, 1, -12 }, // 0x39 '9'
{ 333, 4, 9, 6, 2, -8 }, // 0x3A ':'
{ 338, 5, 12, 6, 1, -8 }, // 0x3B ';'
{ 346, 10, 9, 11, 1, -8 }, // 0x3C '<'
{ 358, 10, 6, 11, 1, -6 }, // 0x3D '='
{ 366, 10, 9, 11, 1, -7 }, // 0x3E '>'
{ 378, 10, 13, 11, 3, -12 }, // 0x3F '?'
{ 395, 18, 16, 18, 1, -13 }, // 0x40 '@'
{ 431, 13, 13, 13, 0, -12 }, // 0x41 'A'
{ 453, 13, 13, 13, 1, -12 }, // 0x42 'B'
{ 475, 13, 13, 13, 2, -12 }, // 0x43 'C'
{ 497, 13, 13, 13, 1, -12 }, // 0x44 'D'
{ 519, 13, 13, 12, 1, -12 }, // 0x45 'E'
{ 541, 12, 13, 11, 1, -12 }, // 0x46 'F'
{ 561, 12, 13, 14, 2, -12 }, // 0x47 'G'
{ 581, 14, 13, 13, 1, -12 }, // 0x48 'H'
{ 604, 5, 13, 5, 1, -12 }, // 0x49 'I'
{ 613, 11, 13, 10, 1, -12 }, // 0x4A 'J'
{ 631, 14, 13, 13, 1, -12 }, // 0x4B 'K'
{ 654, 10, 13, 11, 1, -12 }, // 0x4C 'L'
{ 671, 16, 13, 15, 1, -12 }, // 0x4D 'M'
{ 697, 14, 13, 13, 1, -12 }, // 0x4E 'N'
{ 720, 13, 13, 14, 2, -12 }, // 0x4F 'O'
{ 742, 13, 13, 12, 1, -12 }, // 0x50 'P'
{ 764, 13, 14, 14, 2, -12 }, // 0x51 'Q'
{ 787, 13, 13, 13, 1, -12 }, // 0x52 'R'
{ 809, 13, 13, 12, 1, -12 }, // 0x53 'S'
{ 831, 11, 13, 11, 3, -12 }, // 0x54 'T'
{ 849, 13, 13, 13, 2, -12 }, // 0x55 'U'
{ 871, 11, 13, 12, 3, -12 }, // 0x56 'V'
{ 889, 17, 13, 17, 3, -12 }, // 0x57 'W'
{ 917, 14, 13, 12, 0, -12 }, // 0x58 'X'
{ 940, 11, 13, 12, 3, -12 }, // 0x59 'Y'
{ 958, 12, 13, 11, 1, -12 }, // 0x5A 'Z'
{ 978, 8, 17, 6, 0, -12 }, // 0x5B '['
{ 995, 3, 17, 5, 2, -16 }, // 0x5C '\'
{ 1002, 8, 17, 6, 0, -13 }, // 0x5D ']'
{ 1019, 8, 8, 11, 2, -12 }, // 0x5E '^'
{ 1027, 11, 1, 10, -1, 4 }, // 0x5F '_'
{ 1029, 3, 2, 6, 3, -12 }, // 0x60 '`'
{ 1030, 10, 10, 10, 1, -9 }, // 0x61 'a'
{ 1043, 11, 13, 11, 1, -12 }, // 0x62 'b'
{ 1061, 10, 10, 10, 1, -9 }, // 0x63 'c'
{ 1074, 12, 13, 11, 1, -12 }, // 0x64 'd'
{ 1094, 10, 10, 10, 1, -9 }, // 0x65 'e'
{ 1107, 6, 13, 6, 2, -12 }, // 0x66 'f'
{ 1117, 12, 14, 11, 0, -9 }, // 0x67 'g'
{ 1138, 11, 13, 11, 1, -12 }, // 0x68 'h'
{ 1156, 5, 13, 5, 1, -12 }, // 0x69 'i'
{ 1165, 8, 17, 5, -1, -12 }, // 0x6A 'j'
{ 1182, 11, 13, 10, 1, -12 }, // 0x6B 'k'
{ 1200, 5, 13, 5, 1, -12 }, // 0x6C 'l'
{ 1209, 16, 10, 16, 1, -9 }, // 0x6D 'm'
{ 1229, 11, 10, 11, 1, -9 }, // 0x6E 'n'
{ 1243, 11, 10, 11, 1, -9 }, // 0x6F 'o'
{ 1257, 12, 14, 11, 0, -9 }, // 0x70 'p'
{ 1278, 11, 14, 11, 1, -9 }, // 0x71 'q'
{ 1298, 8, 10, 7, 1, -9 }, // 0x72 'r'
{ 1308, 9, 10, 10, 2, -9 }, // 0x73 's'
{ 1320, 6, 12, 6, 2, -11 }, // 0x74 't'
{ 1329, 10, 10, 11, 2, -9 }, // 0x75 'u'
{ 1342, 10, 10, 10, 2, -9 }, // 0x76 'v'
{ 1355, 14, 10, 14, 2, -9 }, // 0x77 'w'
{ 1373, 12, 10, 10, 0, -9 }, // 0x78 'x'
{ 1388, 11, 14, 10, 1, -9 }, // 0x79 'y'
{ 1408, 10, 10, 9, 0, -9 }, // 0x7A 'z'
{ 1421, 7, 17, 7, 2, -12 }, // 0x7B '{'
{ 1436, 5, 17, 5, 1, -12 }, // 0x7C '|'
{ 1447, 7, 17, 7, 0, -13 }, // 0x7D '}'
{ 1462, 8, 2, 11, 2, -4 } }; // 0x7E '~'
const GFXfont FreeSansBoldOblique9pt7b PROGMEM = {
(uint8_t *)FreeSansBoldOblique9pt7bBitmaps,
(GFXglyph *)FreeSansBoldOblique9pt7bGlyphs,
0x20, 0x7E, 22 };
// Approx. 2136 bytes
|
train_000.parquet/901
|
{
"file_path": "esp32/examples/color_code/components/lcd/Adafruit-GFX-Library/Fonts/FreeSansBoldOblique9pt7b.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 14469,
"token_count": 12517
}
|
const uint8_t FreeSans9pt7bBitmaps[] PROGMEM = {
0xFF, 0xFF, 0xF8, 0xC0, 0xDE, 0xF7, 0x20, 0x09, 0x86, 0x41, 0x91, 0xFF,
0x13, 0x04, 0xC3, 0x20, 0xC8, 0xFF, 0x89, 0x82, 0x61, 0x90, 0x10, 0x1F,
0x14, 0xDA, 0x3D, 0x1E, 0x83, 0x40, 0x78, 0x17, 0x08, 0xF4, 0x7A, 0x35,
0x33, 0xF0, 0x40, 0x20, 0x38, 0x10, 0xEC, 0x20, 0xC6, 0x20, 0xC6, 0x40,
0xC6, 0x40, 0x6C, 0x80, 0x39, 0x00, 0x01, 0x3C, 0x02, 0x77, 0x02, 0x63,
0x04, 0x63, 0x04, 0x77, 0x08, 0x3C, 0x0E, 0x06, 0x60, 0xCC, 0x19, 0x81,
0xE0, 0x18, 0x0F, 0x03, 0x36, 0xC2, 0xD8, 0x73, 0x06, 0x31, 0xE3, 0xC4,
0xFE, 0x13, 0x26, 0x6C, 0xCC, 0xCC, 0xC4, 0x66, 0x23, 0x10, 0x8C, 0x46,
0x63, 0x33, 0x33, 0x32, 0x66, 0x4C, 0x80, 0x25, 0x7E, 0xA5, 0x00, 0x30,
0xC3, 0x3F, 0x30, 0xC3, 0x0C, 0xD6, 0xF0, 0xC0, 0x08, 0x44, 0x21, 0x10,
0x84, 0x42, 0x11, 0x08, 0x00, 0x3C, 0x66, 0x42, 0xC3, 0xC3, 0xC3, 0xC3,
0xC3, 0xC3, 0xC3, 0x42, 0x66, 0x3C, 0x11, 0x3F, 0x33, 0x33, 0x33, 0x33,
0x30, 0x3E, 0x31, 0xB0, 0x78, 0x30, 0x18, 0x1C, 0x1C, 0x1C, 0x18, 0x18,
0x10, 0x08, 0x07, 0xF8, 0x3C, 0x66, 0xC3, 0xC3, 0x03, 0x06, 0x1C, 0x07,
0x03, 0xC3, 0xC3, 0x66, 0x3C, 0x0C, 0x18, 0x71, 0x62, 0xC9, 0xA3, 0x46,
0xFE, 0x18, 0x30, 0x60, 0xC0, 0x7F, 0x20, 0x10, 0x08, 0x08, 0x07, 0xF3,
0x8C, 0x03, 0x01, 0x80, 0xF0, 0x6C, 0x63, 0xE0, 0x1E, 0x31, 0x98, 0x78,
0x0C, 0x06, 0xF3, 0x8D, 0x83, 0xC1, 0xE0, 0xD0, 0x6C, 0x63, 0xE0, 0xFF,
0x03, 0x02, 0x06, 0x04, 0x0C, 0x08, 0x18, 0x18, 0x18, 0x10, 0x30, 0x30,
0x3E, 0x31, 0xB0, 0x78, 0x3C, 0x1B, 0x18, 0xF8, 0xC6, 0xC1, 0xE0, 0xF0,
0x6C, 0x63, 0xE0, 0x3C, 0x66, 0xC2, 0xC3, 0xC3, 0xC3, 0x67, 0x3B, 0x03,
0x03, 0xC2, 0x66, 0x3C, 0xC0, 0x00, 0x30, 0xC0, 0x00, 0x00, 0x64, 0xA0,
0x00, 0x81, 0xC7, 0x8E, 0x0C, 0x07, 0x80, 0x70, 0x0E, 0x01, 0x80, 0xFF,
0x80, 0x00, 0x1F, 0xF0, 0x00, 0x70, 0x0E, 0x01, 0xC0, 0x18, 0x38, 0x71,
0xC0, 0x80, 0x00, 0x3E, 0x31, 0xB0, 0x78, 0x30, 0x18, 0x18, 0x38, 0x18,
0x18, 0x0C, 0x00, 0x00, 0x01, 0x80, 0x03, 0xF0, 0x06, 0x0E, 0x06, 0x01,
0x86, 0x00, 0x66, 0x1D, 0xBB, 0x31, 0xCF, 0x18, 0xC7, 0x98, 0x63, 0xCC,
0x31, 0xE6, 0x11, 0xB3, 0x99, 0xCC, 0xF7, 0x86, 0x00, 0x01, 0x80, 0x00,
0x70, 0x40, 0x0F, 0xE0, 0x06, 0x00, 0xF0, 0x0F, 0x00, 0x90, 0x19, 0x81,
0x98, 0x10, 0x83, 0x0C, 0x3F, 0xC2, 0x04, 0x60, 0x66, 0x06, 0xC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 0x3C, 0x26, 0x62, 0x43, 0xC1, 0x21, 0x98, 0xCC, 0x42,
0x61, 0xB0, 0xD0, 0x38, 0x1C, 0x0C, 0x06, 0x03, 0x01, 0x03, 0x00, 0xFE,
0x0C, 0x30, 0xC1, 0x86, 0x18, 0x20, 0xC1, 0xFC, 0x36, 0x66, 0x66, 0x6E,
0xCE, 0x66, 0x66, 0x66, 0x30, 0xFF, 0xFF, 0xFF, 0xFF, 0xC0, 0xC6, 0x66,
0x66, 0x67, 0x37, 0x66, 0x66, 0x66, 0xC0, 0x61, 0x24, 0x38 };
const GFXglyph FreeSans9pt7bGlyphs[] PROGMEM = {
{ 0, 0, 0, 5, 0, 1 }, // 0x20 ' '
{ 0, 2, 13, 6, 2, -12 }, // 0x21 '!'
{ 4, 5, 4, 6, 1, -12 }, // 0x22 '"'
{ 7, 10, 12, 10, 0, -11 }, // 0x23 '#'
{ 22, 9, 16, 10, 1, -13 }, // 0x24 '$'
{ 40, 16, 13, 16, 1, -12 }, // 0x25 '%'
{ 66, 11, 13, 12, 1, -12 }, // 0x26 '&'
{ 84, 2, 4, 4, 1, -12 }, // 0x27 '''
{ 85, 4, 17, 6, 1, -12 }, // 0x28 '('
{ 94, 4, 17, 6, 1, -12 }, // 0x29 ')'
{ 103, 5, 5, 7, 1, -12 }, // 0x2A '*'
{ 107, 6, 8, 11, 3, -7 }, // 0x2B '+'
{ 113, 2, 4, 5, 2, 0 }, // 0x2C ','
{ 114, 4, 1, 6, 1, -4 }, // 0x2D '-'
{ 115, 2, 1, 5, 1, 0 }, // 0x2E '.'
{ 116, 5, 13, 5, 0, -12 }, // 0x2F '/'
{ 125, 8, 13, 10, 1, -12 }, // 0x30 '0'
{ 138, 4, 13, 10, 3, -12 }, // 0x31 '1'
{ 145, 9, 13, 10, 1, -12 }, // 0x32 '2'
{ 160, 8, 13, 10, 1, -12 }, // 0x33 '3'
{ 173, 7, 13, 10, 2, -12 }, // 0x34 '4'
{ 185, 9, 13, 10, 1, -12 }, // 0x35 '5'
{ 200, 9, 13, 10, 1, -12 }, // 0x36 '6'
{ 215, 8, 13, 10, 0, -12 }, // 0x37 '7'
{ 228, 9, 13, 10, 1, -12 }, // 0x38 '8'
{ 243, 8, 13, 10, 1, -12 }, // 0x39 '9'
{ 256, 2, 10, 5, 1, -9 }, // 0x3A ':'
{ 259, 3, 12, 5, 1, -8 }, // 0x3B ';'
{ 264, 9, 9, 11, 1, -8 }, // 0x3C '<'
{ 275, 9, 4, 11, 1, -5 }, // 0x3D '='
{ 280, 9, 9, 11, 1, -8 }, // 0x3E '>'
{ 291, 9, 13, 10, 1, -12 }, // 0x3F '?'
{ 306, 17, 16, 18, 1, -12 }, // 0x40 '@'
{ 340, 12, 13, 12, 0, -12 }, // 0x41 'A'
{ 360, 11, 13, 12, 1, -12 }, // 0x42 'B'
{ 378, 11, 13, 13, 1, -12 }, // 0x43 'C'
{ 396, 11, 13, 13, 1, -12 }, // 0x44 'D'
{ 414, 9, 13, 11, 1, -12 }, // 0x45 'E'
{ 429, 8, 13, 11, 1, -12 }, // 0x46 'F'
{ 442, 12, 13, 14, 1, -12 }, // 0x47 'G'
{ 462, 11, 13, 13, 1, -12 }, // 0x48 'H'
{ 480, 2, 13, 5, 2, -12 }, // 0x49 'I'
{ 484, 7, 13, 10, 1, -12 }, // 0x4A 'J'
{ 496, 11, 13, 12, 1, -12 }, // 0x4B 'K'
{ 514, 8, 13, 10, 1, -12 }, // 0x4C 'L'
{ 527, 13, 13, 15, 1, -12 }, // 0x4D 'M'
{ 549, 11, 13, 13, 1, -12 }, // 0x4E 'N'
{ 567, 13, 13, 14, 1, -12 }, // 0x4F 'O'
{ 589, 10, 13, 12, 1, -12 }, // 0x50 'P'
{ 606, 13, 14, 14, 1, -12 }, // 0x51 'Q'
{ 629, 12, 13, 13, 1, -12 }, // 0x52 'R'
{ 649, 10, 13, 12, 1, -12 }, // 0x53 'S'
{ 666, 9, 13, 11, 1, -12 }, // 0x54 'T'
{ 681, 11, 13, 13, 1, -12 }, // 0x55 'U'
{ 699, 11, 13, 12, 0, -12 }, // 0x56 'V'
{ 717, 17, 13, 17, 0, -12 }, // 0x57 'W'
{ 745, 12, 13, 12, 0, -12 }, // 0x58 'X'
{ 765, 12, 13, 12, 0, -12 }, // 0x59 'Y'
{ 785, 10, 13, 11, 1, -12 }, // 0x5A 'Z'
{ 802, 3, 17, 5, 1, -12 }, // 0x5B '['
{ 809, 5, 13, 5, 0, -12 }, // 0x5C '\'
{ 818, 3, 17, 5, 0, -12 }, // 0x5D ']'
{ 825, 7, 7, 8, 1, -12 }, // 0x5E '^'
{ 832, 10, 1, 10, 0, 3 }, // 0x5F '_'
{ 834, 4, 3, 5, 0, -12 }, // 0x60 '`'
{ 836, 9, 10, 10, 1, -9 }, // 0x61 'a'
{ 848, 9, 13, 10, 1, -12 }, // 0x62 'b'
{ 863, 8, 10, 9, 1, -9 }, // 0x63 'c'
{ 873, 8, 13, 10, 1, -12 }, // 0x64 'd'
{ 886, 8, 10, 10, 1, -9 }, // 0x65 'e'
{ 896, 4, 13, 5, 1, -12 }, // 0x66 'f'
{ 903, 8, 14, 10, 1, -9 }, // 0x67 'g'
{ 917, 8, 13, 10, 1, -12 }, // 0x68 'h'
{ 930, 2, 13, 4, 1, -12 }, // 0x69 'i'
{ 934, 4, 17, 4, 0, -12 }, // 0x6A 'j'
{ 943, 9, 13, 9, 1, -12 }, // 0x6B 'k'
{ 958, 2, 13, 4, 1, -12 }, // 0x6C 'l'
{ 962, 13, 10, 15, 1, -9 }, // 0x6D 'm'
{ 979, 8, 10, 10, 1, -9 }, // 0x6E 'n'
{ 989, 8, 10, 10, 1, -9 }, // 0x6F 'o'
{ 999, 9, 13, 10, 1, -9 }, // 0x70 'p'
{ 1014, 8, 13, 10, 1, -9 }, // 0x71 'q'
{ 1027, 5, 10, 6, 1, -9 }, // 0x72 'r'
{ 1034, 8, 10, 9, 1, -9 }, // 0x73 's'
{ 1044, 4, 12, 5, 1, -11 }, // 0x74 't'
{ 1050, 8, 10, 10, 1, -9 }, // 0x75 'u'
{ 1060, 9, 10, 9, 0, -9 }, // 0x76 'v'
{ 1072, 13, 10, 13, 0, -9 }, // 0x77 'w'
{ 1089, 8, 10, 9, 0, -9 }, // 0x78 'x'
{ 1099, 9, 14, 9, 0, -9 }, // 0x79 'y'
{ 1115, 7, 10, 9, 1, -9 }, // 0x7A 'z'
{ 1124, 4, 17, 6, 1, -12 }, // 0x7B '{'
{ 1133, 2, 17, 4, 2, -12 }, // 0x7C '|'
{ 1138, 4, 17, 6, 1, -12 }, // 0x7D '}'
{ 1147, 7, 3, 9, 1, -7 } }; // 0x7E '~'
const GFXfont FreeSans9pt7b PROGMEM = {
(uint8_t *)FreeSans9pt7bBitmaps,
(GFXglyph *)FreeSans9pt7bGlyphs,
0x20, 0x7E, 22 };
// Approx. 1822 bytes
|
train_000.parquet/902
|
{
"file_path": "esp32/examples/color_code/components/lcd/Adafruit-GFX-Library/Fonts/FreeSans9pt7b.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 12478,
"token_count": 10601
}
|
const uint8_t FreeMonoOblique9pt7bBitmaps[] PROGMEM = {
0x11, 0x22, 0x24, 0x40, 0x00, 0xC0, 0xDE, 0xE5, 0x29, 0x00, 0x09, 0x05,
0x02, 0x82, 0x47, 0xF8, 0xA0, 0x51, 0xFE, 0x28, 0x14, 0x0A, 0x09, 0x00,
0x08, 0x1D, 0x23, 0x40, 0x70, 0x1C, 0x02, 0x82, 0x84, 0x78, 0x20, 0x20,
0x1C, 0x11, 0x08, 0x83, 0x80, 0x18, 0x71, 0xC0, 0x1C, 0x11, 0x08, 0x83,
0x80, 0x1E, 0x60, 0x81, 0x03, 0x0A, 0x65, 0x46, 0x88, 0xE8, 0xFA, 0x80,
0x12, 0x24, 0x48, 0x88, 0x88, 0x88, 0x80, 0x01, 0x11, 0x11, 0x11, 0x22,
0x44, 0x80, 0x10, 0x22, 0x5B, 0xC3, 0x0A, 0x22, 0x00, 0x04, 0x02, 0x02,
0x1F, 0xF0, 0x80, 0x40, 0x20, 0x00, 0x36, 0x4C, 0x80, 0xFF, 0x80, 0xF0,
0x00, 0x80, 0x80, 0x40, 0x40, 0x40, 0x20, 0x20, 0x20, 0x10, 0x10, 0x10,
0x08, 0x08, 0x00, 0x1C, 0x45, 0x0A, 0x18, 0x30, 0x61, 0x42, 0x85, 0x11,
0xC0, 0x04, 0x38, 0x90, 0x20, 0x81, 0x02, 0x04, 0x08, 0x23, 0xF8, 0x07,
0x04, 0xC4, 0x20, 0x10, 0x10, 0x30, 0x20, 0x20, 0x60, 0x40, 0x3F, 0x80,
0x0F, 0x00, 0x40, 0x20, 0x20, 0x60, 0x18, 0x04, 0x02, 0x01, 0x43, 0x1E,
0x00, 0x03, 0x05, 0x0A, 0x12, 0x22, 0x22, 0x42, 0x7F, 0x04, 0x04, 0x1E,
0x1F, 0x88, 0x08, 0x05, 0xC3, 0x30, 0x08, 0x04, 0x02, 0x02, 0x42, 0x1E,
0x00, 0x07, 0x18, 0x20, 0x40, 0x5C, 0xA6, 0xC2, 0x82, 0x82, 0xC4, 0x78,
0xFF, 0x04, 0x10, 0x20, 0x82, 0x04, 0x10, 0x20, 0x81, 0x00, 0x1E, 0x23,
0x41, 0x41, 0x62, 0x1C, 0x66, 0x82, 0x82, 0x84, 0x78, 0x1E, 0x23, 0x41,
0x41, 0x43, 0x65, 0x3A, 0x02, 0x04, 0x18, 0xE0, 0x6C, 0x00, 0x36, 0x18,
0xC0, 0x00, 0x19, 0x8C, 0xC4, 0x00, 0x01, 0x83, 0x06, 0x0C, 0x06, 0x00,
0x80, 0x30, 0x04, 0xFF, 0x80, 0x00, 0x1F, 0xF0, 0x20, 0x0C, 0x01, 0x00,
0x60, 0x20, 0x60, 0xC1, 0x80, 0x3D, 0x8E, 0x08, 0x10, 0xC6, 0x08, 0x00,
0x01, 0x80, 0x1C, 0x45, 0x0A, 0x79, 0x34, 0x69, 0x4E, 0x81, 0x03, 0x03,
0xC0, 0x0F, 0x00, 0x60, 0x12, 0x02, 0x40, 0x88, 0x21, 0x07, 0xE1, 0x04,
0x20, 0x5E, 0x3C, 0x3F, 0x84, 0x11, 0x04, 0x82, 0x3F, 0x88, 0x32, 0x04,
0x81, 0x60, 0xBF, 0xC0, 0x1E, 0x98, 0xD0, 0x28, 0x08, 0x04, 0x02, 0x01,
0x00, 0x41, 0x1F, 0x00, 0x3F, 0x0C, 0x22, 0x04, 0x81, 0x20, 0x48, 0x12,
0x09, 0x02, 0x43, 0x3F, 0x00, 0x3F, 0xC4, 0x11, 0x00, 0x88, 0x3E, 0x08,
0x82, 0x00, 0x82, 0x60, 0xBF, 0xE0, 0x3F, 0xE2, 0x08, 0x40, 0x11, 0x03,
0xE0, 0x44, 0x08, 0x01, 0x00, 0x60, 0x1F, 0x00, 0x1E, 0x98, 0xD0, 0x08,
0x08, 0x04, 0x7A, 0x05, 0x02, 0x41, 0x1F, 0x00, 0x3D, 0xE2, 0x18, 0x42,
0x08, 0x43, 0xF8, 0x41, 0x08, 0x21, 0x08, 0x21, 0x1E, 0xF0, 0x3F, 0x82,
0x02, 0x01, 0x00, 0x80, 0x40, 0x20, 0x20, 0x10, 0x7F, 0x00, 0x0F, 0xE0,
0x20, 0x04, 0x00, 0x80, 0x10, 0x02, 0x20, 0x84, 0x10, 0x84, 0x0F, 0x00,
0x3C, 0xE2, 0x10, 0x44, 0x11, 0x02, 0xC0, 0x64, 0x08, 0x81, 0x08, 0x61,
0x1E, 0x38, 0x3E, 0x02, 0x00, 0x80, 0x20, 0x10, 0x04, 0x01, 0x04, 0x42,
0x10, 0xBF, 0xE0, 0x38, 0x38, 0xC3, 0x05, 0x28, 0x29, 0x42, 0x52, 0x13,
0x10, 0x99, 0x84, 0x08, 0x20, 0x47, 0x8F, 0x00, 0x70, 0xE6, 0x08, 0xA1,
0x14, 0x22, 0x48, 0x49, 0x11, 0x22, 0x14, 0x43, 0x1E, 0x20, 0x1E, 0x18,
0x90, 0x28, 0x18, 0x0C, 0x06, 0x05, 0x02, 0x46, 0x1E, 0x00, 0x3F, 0x84,
0x31, 0x04, 0x81, 0x20, 0x8F, 0xC2, 0x00, 0x80, 0x60, 0x3E, 0x00, 0x1E,
0x18, 0x90, 0x28, 0x18, 0x0C, 0x06, 0x05, 0x02, 0x46, 0x1E, 0x08, 0x0F,
0x44, 0x60, 0x3F, 0x84, 0x31, 0x04, 0x81, 0x20, 0x8F, 0xC2, 0x10, 0x84,
0x60, 0xBC, 0x10, 0x0F, 0x88, 0xC8, 0x24, 0x01, 0x80, 0x38, 0x05, 0x02,
0xC2, 0x5E, 0x00, 0xFF, 0xC4, 0x44, 0x02, 0x01, 0x00, 0x80, 0x40, 0x60,
0x20, 0x7E, 0x00, 0xF1, 0xD0, 0x24, 0x09, 0x02, 0x41, 0xA0, 0x48, 0x12,
0x04, 0xC6, 0x1F, 0x00, 0xF1, 0xE8, 0x11, 0x02, 0x20, 0x82, 0x20, 0x44,
0x09, 0x01, 0x40, 0x28, 0x02, 0x00, 0xF1, 0xE8, 0x09, 0x12, 0x26, 0x45,
0x48, 0xAA, 0x29, 0x45, 0x28, 0xC6, 0x18, 0xC0, 0x38, 0xE2, 0x08, 0x26,
0x05, 0x00, 0x40, 0x18, 0x04, 0x81, 0x08, 0x41, 0x1C, 0x70, 0xE3, 0xA0,
0x90, 0x84, 0x81, 0x80, 0x80, 0x40, 0x20, 0x20, 0x7E, 0x00, 0x3F, 0x90,
0x88, 0x80, 0x80, 0x80, 0x80, 0x80, 0x82, 0x82, 0x7F, 0x00, 0x39, 0x08,
0x44, 0x21, 0x08, 0x42, 0x21, 0x0E, 0x00, 0x88, 0x44, 0x44, 0x22, 0x22,
0x11, 0x11, 0x38, 0x42, 0x11, 0x08, 0x42, 0x10, 0x84, 0x2E, 0x00, 0x08,
0x28, 0x92, 0x18, 0x20, 0xFF, 0xC0, 0xA4, 0x3E, 0x00, 0x80, 0x47, 0xA4,
0x34, 0x12, 0x18, 0xF7, 0x38, 0x01, 0x00, 0x40, 0x09, 0xE1, 0xC6, 0x20,
0x44, 0x09, 0x01, 0x30, 0x46, 0x13, 0xBC, 0x00, 0x1F, 0x48, 0x74, 0x0A,
0x00, 0x80, 0x20, 0x0C, 0x18, 0xF8, 0x01, 0x80, 0x40, 0x23, 0x96, 0x32,
0x0A, 0x05, 0x02, 0x81, 0x61, 0x1F, 0xE0, 0x1F, 0x30, 0xD0, 0x3F, 0xF8,
0x04, 0x01, 0x00, 0x7C, 0x07, 0xC3, 0x00, 0x80, 0xFE, 0x10, 0x04, 0x01,
0x00, 0x40, 0x10, 0x08, 0x0F, 0xE0, 0x1D, 0xD8, 0xC4, 0x12, 0x04, 0x82,
0x20, 0x8C, 0x61, 0xE8, 0x02, 0x01, 0x07, 0x80, 0x30, 0x04, 0x01, 0x00,
0x5C, 0x38, 0x88, 0x22, 0x08, 0x82, 0x21, 0x18, 0x4F, 0x3C, 0x04, 0x04,
0x00, 0x38, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10, 0xFF, 0x01, 0x00, 0x80,
0x03, 0xF0, 0x10, 0x08, 0x04, 0x02, 0x02, 0x01, 0x00, 0x80, 0x40, 0x47,
0xC0, 0x38, 0x08, 0x04, 0x02, 0x71, 0x20, 0xA0, 0xA0, 0x68, 0x24, 0x11,
0x38, 0xE0, 0x3C, 0x04, 0x04, 0x08, 0x08, 0x08, 0x08, 0x08, 0x10, 0x10,
0xFF, 0x3E, 0xE2, 0x64, 0x88, 0x91, 0x12, 0x24, 0x48, 0x91, 0x17, 0x33,
0x37, 0x14, 0x4C, 0x24, 0x12, 0x09, 0x08, 0x85, 0xE3, 0x1E, 0x10, 0x90,
0x30, 0x18, 0x0C, 0x0B, 0x08, 0x78, 0x33, 0xC3, 0x8C, 0x40, 0x88, 0x12,
0x02, 0x60, 0x8C, 0x31, 0x78, 0x20, 0x08, 0x03, 0xE0, 0x00, 0x1C, 0xD8,
0xC4, 0x12, 0x04, 0x81, 0x20, 0x4C, 0x21, 0xF8, 0x02, 0x00, 0x81, 0xF0,
0x73, 0x8E, 0x04, 0x04, 0x02, 0x01, 0x00, 0x81, 0xFC, 0x1F, 0x61, 0x40,
0x3C, 0x03, 0x81, 0x82, 0xFC, 0x10, 0x63, 0xF9, 0x02, 0x04, 0x10, 0x20,
0x40, 0x7C, 0xE3, 0x10, 0x90, 0x48, 0x24, 0x22, 0x11, 0x18, 0xF6, 0xF3,
0xD0, 0x44, 0x10, 0x88, 0x24, 0x09, 0x02, 0x80, 0x40, 0xE1, 0xD0, 0x24,
0x91, 0x24, 0x55, 0x19, 0x86, 0x61, 0x10, 0x39, 0xC4, 0x20, 0xB0, 0x30,
0x0C, 0x04, 0x86, 0x13, 0x8E, 0x3C, 0x71, 0x04, 0x10, 0x40, 0x88, 0x09,
0x00, 0xA0, 0x06, 0x00, 0x40, 0x08, 0x01, 0x00, 0xFC, 0x00, 0x7F, 0x42,
0x04, 0x08, 0x10, 0x20, 0x42, 0xFE, 0x0C, 0x41, 0x04, 0x30, 0x8C, 0x08,
0x21, 0x04, 0x10, 0x60, 0x24, 0x94, 0x92, 0x52, 0x40, 0x18, 0x20, 0x82,
0x10, 0x40, 0xC4, 0x10, 0x82, 0x08, 0xC0, 0x61, 0x24, 0x30 };
const GFXglyph FreeMonoOblique9pt7bGlyphs[] PROGMEM = {
{ 0, 0, 0, 11, 0, 1 }, // 0x20 ' '
{ 0, 4, 11, 11, 4, -10 }, // 0x21 '!'
{ 6, 5, 5, 11, 4, -10 }, // 0x22 '"'
{ 10, 9, 12, 11, 2, -10 }, // 0x23 '#'
{ 24, 8, 12, 11, 3, -10 }, // 0x24 '$'
{ 36, 9, 11, 11, 2, -10 }, // 0x25 '%'
{ 49, 7, 10, 11, 2, -9 }, // 0x26 '&'
{ 58, 2, 5, 11, 6, -10 }, // 0x27 '''
{ 60, 4, 13, 11, 6, -10 }, // 0x28 '('
{ 67, 4, 13, 11, 3, -10 }, // 0x29 ')'
{ 74, 7, 7, 11, 4, -10 }, // 0x2A '*'
{ 81, 9, 8, 11, 2, -8 }, // 0x2B '+'
{ 90, 4, 5, 11, 2, -1 }, // 0x2C ','
{ 93, 9, 1, 11, 2, -5 }, // 0x2D '-'
{ 95, 2, 2, 11, 4, -1 }, // 0x2E '.'
{ 96, 9, 13, 11, 2, -11 }, // 0x2F '/'
{ 111, 7, 11, 11, 3, -10 }, // 0x30 '0'
{ 121, 7, 11, 11, 2, -10 }, // 0x31 '1'
{ 131, 9, 11, 11, 2, -10 }, // 0x32 '2'
{ 144, 9, 11, 11, 2, -10 }, // 0x33 '3'
{ 157, 8, 11, 11, 2, -10 }, // 0x34 '4'
{ 168, 9, 11, 11, 2, -10 }, // 0x35 '5'
{ 181, 8, 11, 11, 3, -10 }, // 0x36 '6'
{ 192, 7, 11, 11, 4, -10 }, // 0x37 '7'
{ 202, 8, 11, 11, 3, -10 }, // 0x38 '8'
{ 213, 8, 11, 11, 3, -10 }, // 0x39 '9'
{ 224, 3, 8, 11, 4, -7 }, // 0x3A ':'
{ 227, 5, 11, 11, 2, -7 }, // 0x3B ';'
{ 234, 9, 8, 11, 2, -8 }, // 0x3C '<'
{ 243, 9, 4, 11, 2, -6 }, // 0x3D '='
{ 248, 9, 8, 11, 2, -8 }, // 0x3E '>'
{ 257, 7, 10, 11, 4, -9 }, // 0x3F '?'
{ 266, 7, 12, 11, 3, -10 }, // 0x40 '@'
{ 277, 11, 10, 11, 0, -9 }, // 0x41 'A'
{ 291, 10, 10, 11, 1, -9 }, // 0x42 'B'
{ 304, 9, 10, 11, 2, -9 }, // 0x43 'C'
{ 316, 10, 10, 11, 1, -9 }, // 0x44 'D'
{ 329, 10, 10, 11, 1, -9 }, // 0x45 'E'
{ 342, 11, 10, 11, 1, -9 }, // 0x46 'F'
{ 356, 9, 10, 11, 2, -9 }, // 0x47 'G'
{ 368, 11, 10, 11, 1, -9 }, // 0x48 'H'
{ 382, 9, 10, 11, 2, -9 }, // 0x49 'I'
{ 394, 11, 10, 11, 2, -9 }, // 0x4A 'J'
{ 408, 11, 10, 11, 1, -9 }, // 0x4B 'K'
{ 422, 10, 10, 11, 1, -9 }, // 0x4C 'L'
{ 435, 13, 10, 11, 0, -9 }, // 0x4D 'M'
{ 452, 11, 10, 11, 1, -9 }, // 0x4E 'N'
{ 466, 9, 10, 11, 2, -9 }, // 0x4F 'O'
{ 478, 10, 10, 11, 1, -9 }, // 0x50 'P'
{ 491, 9, 13, 11, 2, -9 }, // 0x51 'Q'
{ 506, 10, 10, 11, 1, -9 }, // 0x52 'R'
{ 519, 9, 10, 11, 2, -9 }, // 0x53 'S'
{ 531, 9, 10, 11, 3, -9 }, // 0x54 'T'
{ 543, 10, 10, 11, 2, -9 }, // 0x55 'U'
{ 556, 11, 10, 11, 2, -9 }, // 0x56 'V'
{ 570, 11, 10, 11, 2, -9 }, // 0x57 'W'
{ 584, 11, 10, 11, 1, -9 }, // 0x58 'X'
{ 598, 9, 10, 11, 3, -9 }, // 0x59 'Y'
{ 610, 9, 10, 11, 2, -9 }, // 0x5A 'Z'
{ 622, 5, 13, 11, 5, -10 }, // 0x5B '['
{ 631, 4, 14, 11, 4, -11 }, // 0x5C '\'
{ 638, 5, 13, 11, 2, -10 }, // 0x5D ']'
{ 647, 7, 5, 11, 3, -10 }, // 0x5E '^'
{ 652, 11, 1, 11, 0, 2 }, // 0x5F '_'
{ 654, 2, 3, 11, 5, -11 }, // 0x60 '`'
{ 655, 9, 8, 11, 2, -7 }, // 0x61 'a'
{ 664, 11, 11, 11, 0, -10 }, // 0x62 'b'
{ 680, 10, 8, 11, 2, -7 }, // 0x63 'c'
{ 690, 9, 11, 11, 2, -10 }, // 0x64 'd'
{ 703, 9, 8, 11, 2, -7 }, // 0x65 'e'
{ 712, 10, 11, 11, 2, -10 }, // 0x66 'f'
{ 726, 10, 11, 11, 2, -7 }, // 0x67 'g'
{ 740, 10, 11, 11, 1, -10 }, // 0x68 'h'
{ 754, 8, 11, 11, 2, -10 }, // 0x69 'i'
{ 765, 9, 14, 11, 1, -10 }, // 0x6A 'j'
{ 781, 9, 11, 11, 1, -10 }, // 0x6B 'k'
{ 794, 8, 11, 11, 2, -10 }, // 0x6C 'l'
{ 805, 11, 8, 11, 0, -7 }, // 0x6D 'm'
{ 816, 9, 8, 11, 1, -7 }, // 0x6E 'n'
{ 825, 9, 8, 11, 2, -7 }, // 0x6F 'o'
{ 834, 11, 11, 11, 0, -7 }, // 0x70 'p'
{ 850, 10, 11, 11, 2, -7 }, // 0x71 'q'
{ 864, 9, 8, 11, 2, -7 }, // 0x72 'r'
{ 873, 8, 8, 11, 2, -7 }, // 0x73 's'
{ 881, 7, 10, 11, 2, -9 }, // 0x74 't'
{ 890, 9, 8, 11, 2, -7 }, // 0x75 'u'
{ 899, 10, 8, 11, 2, -7 }, // 0x76 'v'
{ 909, 10, 8, 11, 2, -7 }, // 0x77 'w'
{ 919, 10, 8, 11, 1, -7 }, // 0x78 'x'
{ 929, 12, 11, 11, 0, -7 }, // 0x79 'y'
{ 946, 8, 8, 11, 2, -7 }, // 0x7A 'z'
{ 954, 6, 13, 11, 4, -10 }, // 0x7B '{'
{ 964, 3, 12, 11, 5, -9 }, // 0x7C '|'
{ 969, 6, 13, 11, 3, -10 }, // 0x7D '}'
{ 979, 7, 3, 11, 3, -6 } }; // 0x7E '~'
const GFXfont FreeMonoOblique9pt7b PROGMEM = {
(uint8_t *)FreeMonoOblique9pt7bBitmaps,
(GFXglyph *)FreeMonoOblique9pt7bGlyphs,
0x20, 0x7E, 18 };
// Approx. 1654 bytes
|
train_000.parquet/903
|
{
"file_path": "esp32/examples/color_code/components/lcd/Adafruit-GFX-Library/Fonts/FreeMonoOblique9pt7b.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 11477,
"token_count": 9619
}
|
const uint8_t FreeSerif24pt7bBitmaps[] PROGMEM = {
0x77, 0xBF, 0xFF, 0xFF, 0xFF, 0xFB, 0x9C, 0xE7, 0x39, 0xCE, 0x61, 0x08,
0x42, 0x10, 0x84, 0x00, 0x00, 0xEF, 0xFF, 0xEE, 0x60, 0x6F, 0x0F, 0xF0,
0xFF, 0x0F, 0xF0, 0xFF, 0x0F, 0x60, 0x66, 0x06, 0x60, 0x66, 0x06, 0x60,
0x66, 0x06, 0x00, 0xE0, 0x70, 0x01, 0xC0, 0xE0, 0x03, 0x81, 0xC0, 0x07,
0x03, 0x80, 0x0E, 0x06, 0x00, 0x18, 0x0C, 0x00, 0x30, 0x38, 0x00, 0xE0,
0x70, 0x01, 0xC0, 0xE0, 0x03, 0x81, 0xC1, 0xFF, 0xFF, 0xFB, 0xFF, 0xFF,
0xF0, 0x18, 0x0C, 0x00, 0x70, 0x38, 0x00, 0xE0, 0x70, 0x01, 0xC0, 0xE0,
0x03, 0x81, 0xC0, 0x07, 0x03, 0x80, 0x0C, 0x06, 0x07, 0xFF, 0xFF, 0xEF,
0xFF, 0xFF, 0xC0, 0xE0, 0x70, 0x01, 0xC0, 0xE0, 0x03, 0x81, 0xC0, 0x06,
0x03, 0x80, 0x0C, 0x06, 0x00, 0x38, 0x1C, 0x00, 0x70, 0x38, 0x00, 0xE0,
0x70, 0x01, 0xC0, 0xE0, 0x03, 0x81, 0xC0, 0x00, 0x00, 0x40, 0x00, 0x08,
0x00, 0x01, 0x00, 0x01, 0xFC, 0x01, 0xE4, 0xF8, 0x70, 0x87, 0x9C, 0x10,
0x77, 0x02, 0x06, 0xE0, 0x40, 0xDC, 0x08, 0x0B, 0x81, 0x00, 0x78, 0x20,
0x07, 0x84, 0x00, 0xFC, 0x80, 0x0F, 0xF0, 0x00, 0xFE, 0x00, 0x07, 0xF0,
0x00, 0x7F, 0x80, 0x03, 0xFC, 0x00, 0x3F, 0xC0, 0x05, 0xFC, 0x00, 0x8F,
0x80, 0x10, 0xF8, 0x02, 0x0F, 0x00, 0x40, 0xF0, 0x08, 0x1E, 0x01, 0x03,
0xE0, 0x20, 0x7C, 0x04, 0x0F, 0xC0, 0x83, 0xBC, 0x10, 0xE3, 0xE2, 0x78,
0x3F, 0xFE, 0x00, 0xFE, 0x00, 0x01, 0x00, 0x00, 0x20, 0x00, 0x04, 0x00,
0x01, 0xF0, 0x00, 0xC0, 0x03, 0xFC, 0x01, 0xE0, 0x03, 0xC7, 0x81, 0xE0,
0x03, 0xC0, 0x7F, 0x60, 0x03, 0xC0, 0x20, 0x70, 0x01, 0xE0, 0x10, 0x30,
0x01, 0xE0, 0x08, 0x38, 0x00, 0xE0, 0x04, 0x18, 0x00, 0xF0, 0x02, 0x1C,
0x00, 0x78, 0x02, 0x0C, 0x00, 0x38, 0x01, 0x0E, 0x00, 0x1C, 0x01, 0x86,
0x00, 0x0E, 0x00, 0x86, 0x00, 0x07, 0x00, 0x87, 0x03, 0xE1, 0x80, 0xC3,
0x07, 0xFC, 0xE1, 0xC3, 0x87, 0xC6, 0x3F, 0xC1, 0x87, 0x81, 0x8F, 0x81,
0xC7, 0x80, 0x40, 0x00, 0xC3, 0xC0, 0x20, 0x00, 0xE3, 0xC0, 0x10, 0x00,
0x61, 0xC0, 0x08, 0x00, 0x61, 0xE0, 0x04, 0x00, 0x70, 0xF0, 0x06, 0x00,
0x30, 0x70, 0x02, 0x00, 0x38, 0x38, 0x03, 0x00, 0x18, 0x1C, 0x01, 0x00,
0x1C, 0x0E, 0x01, 0x80, 0x0C, 0x07, 0x01, 0x80, 0x0E, 0x01, 0xC3, 0x80,
0x06, 0x00, 0x7F, 0x80, 0x06, 0x00, 0x1F, 0x00, 0x07, 0x00, 0x00, 0x00,
0x00, 0x1F, 0x00, 0x00, 0x00, 0x3F, 0xC0, 0x00, 0x00, 0x70, 0xE0, 0x00,
0x00, 0xE0, 0x60, 0x00, 0x00, 0xC0, 0x30, 0x00, 0x01, 0xC0, 0x30, 0x00,
0x01, 0xC0, 0x30, 0x00, 0x01, 0xC0, 0x30, 0x00, 0x01, 0xC0, 0x70, 0x00,
0x01, 0xE0, 0xE0, 0x00, 0x01, 0xE1, 0xC0, 0x00, 0x00, 0xF3, 0x80, 0x00,
0x00, 0xFF, 0x0F, 0xFC, 0x00, 0xFC, 0x03, 0xF0, 0x00, 0xF8, 0x01, 0xE0,
0x01, 0xFC, 0x01, 0xC0, 0x07, 0x7C, 0x01, 0xC0, 0x0F, 0x3E, 0x01, 0x80,
0x1E, 0x3E, 0x03, 0x00, 0x3C, 0x1F, 0x03, 0x00, 0x7C, 0x1F, 0x06, 0x00,
0x78, 0x0F, 0x86, 0x00, 0x78, 0x07, 0xCC, 0x00, 0xF8, 0x07, 0xE8, 0x00,
0xF8, 0x03, 0xF8, 0x00, 0xF8, 0x01, 0xF0, 0x00, 0xF8, 0x01, 0xF8, 0x00,
0xFC, 0x00, 0xFC, 0x01, 0xFC, 0x01, 0xFE, 0x01, 0x7E, 0x03, 0xBF, 0x86,
0x7F, 0x0F, 0x1F, 0xFE, 0x3F, 0xFC, 0x0F, 0xF8, 0x0F, 0xE0, 0x03, 0xF0,
0x6F, 0xFF, 0xFF, 0x66, 0x66, 0x66, 0x00, 0x10, 0x02, 0x00, 0xC0, 0x18,
0x03, 0x00, 0x60, 0x0E, 0x00, 0xC0, 0x1C, 0x03, 0x80, 0x38, 0x03, 0x80,
0x78, 0x07, 0x00, 0x70, 0x0F, 0x00, 0xF0, 0x0F, 0x00, 0xF0, 0x0F, 0x00,
0xF0, 0x0F, 0x00, 0xF0, 0x0F, 0x00, 0xF0, 0x07, 0x00, 0x70, 0x07, 0x80,
0x38, 0x03, 0x80, 0x38, 0x01, 0xC0, 0x0C, 0x00, 0xC0, 0x06, 0x00, 0x30,
0x01, 0x80, 0x0C, 0x00, 0x60, 0x03, 0xC0, 0x06, 0x00, 0x30, 0x01, 0x80,
0x0C, 0x00, 0x60, 0x07, 0x00, 0x30, 0x03, 0x80, 0x1C, 0x01, 0xC0, 0x1C,
0x01, 0xE0, 0x0E, 0x00, 0xE0, 0x0F, 0x00, 0xF0, 0x0F, 0x00, 0xF0, 0x0F,
0x00, 0xF0, 0x0F, 0x00, 0xF0, 0x0F, 0x00, 0xF0, 0x0E, 0x00, 0xE0, 0x1E,
0x01, 0xC0, 0x1C, 0x01, 0xC0, 0x38, 0x03, 0x00, 0x70, 0x0E, 0x00, 0xC0,
0x18, 0x03, 0x00, 0x40, 0x08, 0x00, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80,
0x43, 0x86, 0xE1, 0x0F, 0xF1, 0x1F, 0xF9, 0x3E, 0x3D, 0x78, 0x07, 0xC0,
0x01, 0x00, 0x07, 0xC0, 0x19, 0x30, 0xF9, 0x1E, 0xF1, 0x0F, 0xE1, 0x07,
0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x03, 0x80, 0x00, 0x38, 0x00, 0x00,
0x70, 0x00, 0x00, 0xE0, 0x00, 0x01, 0xC0, 0x00, 0x03, 0x80, 0x00, 0x07,
0x00, 0x00, 0x0E, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x38, 0x00, 0x00, 0x70,
0x00, 0x00, 0xE0, 0x07, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xE0, 0x07, 0x00,
0x00, 0x0E, 0x00, 0x00, 0x1C, 0x00, 0x00, 0x38, 0x00, 0x00, 0x70, 0x00,
0x00, 0xE0, 0x00, 0x01, 0xC0, 0x00, 0x03, 0x80, 0x00, 0x07, 0x00, 0x00,
0x0E, 0x00, 0x00, 0x73, 0xEF, 0xFF, 0x7C, 0x10, 0x42, 0x08, 0xC6, 0x00,
0xFF, 0xFF, 0xFC, 0x77, 0xFF, 0xF7, 0x00, 0x00, 0x1C, 0x00, 0xE0, 0x03,
0x80, 0x0E, 0x00, 0x70, 0x01, 0xC0, 0x07, 0x00, 0x38, 0x00, 0xE0, 0x03,
0x80, 0x1C, 0x00, 0x70, 0x01, 0xC0, 0x0E, 0x00, 0x38, 0x01, 0xE0, 0x07,
0x00, 0x1C, 0x00, 0xF0, 0x03, 0x80, 0x0E, 0x00, 0x78, 0x01, 0xC0, 0x07,
0x00, 0x3C, 0x00, 0xE0, 0x03, 0x80, 0x1E, 0x00, 0x70, 0x01, 0xC0, 0x0F,
0x00, 0x38, 0x00, 0x00, 0x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
0x70, 0x00, 0x03, 0x00, 0x00, 0x30, 0x00, 0x03, 0x00, 0x00, 0x30, 0x00,
0x03, 0x00, 0x00, 0x30, 0x00, 0x03, 0x00, 0x00, 0x30, 0x00, 0x43, 0x00,
0x02, 0x30, 0x00, 0x23, 0xFF, 0xFF, 0x3F, 0xFF, 0xF3, 0xFF, 0xFF, 0x80,
0x03, 0xF8, 0x03, 0xFF, 0x01, 0x83, 0xE0, 0x80, 0x3C, 0x40, 0x0F, 0x10,
0x01, 0xC8, 0x00, 0x70, 0x00, 0x1C, 0x00, 0x06, 0x00, 0x03, 0x00, 0x00,
0x80, 0x00, 0xC0, 0x00, 0x78, 0x00, 0x7F, 0x80, 0x7F, 0xF0, 0x01, 0xFE,
0x00, 0x0F, 0x80, 0x01, 0xF0, 0x00, 0x3C, 0x00, 0x0F, 0x00, 0x01, 0xC0,
0x00, 0x70, 0x00, 0x1C, 0x00, 0x07, 0x00, 0x01, 0x80, 0x00, 0x60, 0x00,
0x30, 0x00, 0x0C, 0x70, 0x06, 0x3F, 0x07, 0x0F, 0xFF, 0x00, 0xFF, 0x00,
0x00, 0x03, 0x00, 0x00, 0x38, 0x00, 0x01, 0xC0, 0x00, 0x1E, 0x00, 0x01,
0xF0, 0x00, 0x0F, 0x80, 0x00, 0xDC, 0x00, 0x0C, 0xE0, 0x00, 0x47, 0x00,
0x06, 0x38, 0x00, 0x61, 0xC0, 0x06, 0x0E, 0x00, 0x30, 0x70, 0x03, 0x03,
0x80, 0x30, 0x1C, 0x01, 0x80, 0xE0, 0x18, 0x07, 0x01, 0x80, 0x38, 0x08,
0x01, 0xC0, 0xC0, 0x0E, 0x0C, 0x00, 0x70, 0x7F, 0xFF, 0xFF, 0xFF, 0xFF,
0xE0, 0x00, 0xE0, 0x00, 0x07, 0x00, 0x00, 0x38, 0x00, 0x01, 0xC0, 0x00,
0x0E, 0x00, 0x00, 0x70, 0x00, 0x03, 0x80, 0x00, 0x1C, 0x00, 0x00, 0x00,
0x40, 0x7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xF0, 0x00, 0x0F, 0x80, 0x00, 0x78, 0x00, 0x07, 0xC0, 0x00,
0x7C, 0x00, 0x03, 0xC0, 0x00, 0x3C, 0x00, 0x07, 0xC0, 0x00, 0x7C, 0x00,
0x0F, 0x80, 0x01, 0xE0, 0x00, 0x78, 0x00, 0x00, 0x77, 0xFF, 0xF7, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x03, 0xBF, 0xFF, 0xB8, 0x39, 0xF7,
0xDF, 0x38, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x73, 0xEF,
0xFF, 0x7C, 0x10, 0x42, 0x08, 0xC6, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x07, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x7F, 0x00, 0x01, 0xFC, 0x00, 0x07,
0xF0, 0x00, 0x3F, 0xC0, 0x00, 0xFF, 0x00, 0x03, 0xFC, 0x00, 0x0F, 0xE0,
0x00, 0x3F, 0x80, 0x00, 0xFE, 0x00, 0x00, 0xF8, 0x00, 0x00, 0xFC, 0x00,
0x00, 0x7F, 0x80, 0x00, 0x1F, 0xE0, 0x00, 0x07, 0xF8, 0x00, 0x00, 0xFE,
0x00, 0x00, 0x3F, 0x80, 0x00, 0x0F, 0xF0, 0x00, 0x03, 0xFC, 0x00, 0x00,
0xFF, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x07, 0x00, 0x00, 0x01, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
0x00, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0x80, 0x00, 0x00, 0xE0, 0x00,
0x00, 0xF8, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x3F, 0xC0, 0x00, 0x0F, 0xF0,
0x00, 0x01, 0xFC, 0x00, 0x00, 0x7F, 0x00, 0x00, 0x1F, 0xE0, 0x00, 0x07,
0xF8, 0x00, 0x01, 0xFE, 0x00, 0x00, 0x3F, 0x00, 0x00, 0x1F, 0x00, 0x00,
0x7F, 0x00, 0x01, 0xFC, 0x00, 0x07, 0xF0, 0x00, 0x3F, 0xC0, 0x00, 0xFF,
0x00, 0x03, 0xFC, 0x00, 0x0F, 0xE0, 0x00, 0x3F, 0x80, 0x00, 0xFE, 0x00,
0x00, 0xF8, 0x00, 0x00, 0xE0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0xE0,
0x0F, 0xFE, 0x0C, 0x1F, 0x88, 0x03, 0xEC, 0x01, 0xF7, 0x00, 0x7F, 0xC0,
0x3F, 0xE0, 0x1F, 0x70, 0x0F, 0x80, 0x07, 0xC0, 0x03, 0xC0, 0x01, 0xE0,
0x01, 0xE0, 0x00, 0xF0, 0x00, 0x70, 0x00, 0x70, 0x00, 0x30, 0x00, 0x10,
0x00, 0x18, 0x00, 0x08, 0x00, 0x04, 0x00, 0x06, 0x00, 0x02, 0x00, 0x01,
0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x38, 0x00, 0x3E, 0x00,
0x1F, 0x00, 0x0F, 0x80, 0x03, 0x80, 0x00, 0x07, 0xF8, 0x00, 0x00, 0x3F,
0xFF, 0x00, 0x00, 0xFC, 0x07, 0xC0, 0x01, 0xE0, 0x00, 0xE0, 0x07, 0xC0,
0x00, 0x30, 0x0F, 0x00, 0x00, 0x18, 0x1E, 0x00, 0x00, 0x0C, 0x1E, 0x00,
0x00, 0x04, 0x3C, 0x00, 0xF8, 0x06, 0x3C, 0x01, 0xFD, 0xC2, 0x78, 0x03,
0xC7, 0xC3, 0x78, 0x07, 0x07, 0x81, 0xF0, 0x0E, 0x03, 0x81, 0xF0, 0x0E,
0x03, 0x81, 0xF0, 0x1C, 0x07, 0x81, 0xF0, 0x1C, 0x07, 0x01, 0xF0, 0x38,
0x07, 0x01, 0xF0, 0x38, 0x07, 0x03, 0xF0, 0x38, 0x0F, 0x02, 0xF0, 0x38,
0x0E, 0x02, 0xF0, 0x38, 0x1E, 0x04, 0x78, 0x38, 0x1E, 0x0C, 0x78, 0x1C,
0x6E, 0x18, 0x38, 0x1F, 0xC7, 0xF0, 0x3C, 0x0F, 0x03, 0xE0, 0x1E, 0x00,
0x00, 0x00, 0x1E, 0x00, 0x00, 0x00, 0x0F, 0x00, 0x00, 0x00, 0x07, 0xC0,
0x00, 0x00, 0x03, 0xE0, 0x00, 0x60, 0x00, 0xFC, 0x03, 0xE0, 0x00, 0x3F,
0xFF, 0x80, 0x00, 0x07, 0xFC, 0x00, 0x00, 0x01, 0x00, 0x00, 0x00, 0x01,
0x80, 0x00, 0x00, 0x03, 0x80, 0x00, 0x00, 0x03, 0xC0, 0x00, 0x00, 0x07,
0xC0, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x0D,
0xF0, 0x00, 0x00, 0x0D, 0xF0, 0x00, 0x00, 0x18, 0xF0, 0x00, 0x00, 0x18,
0xF8, 0x00, 0x00, 0x38, 0x78, 0x00, 0x00, 0x30, 0x7C, 0x00, 0x00, 0x30,
0x7C, 0x00, 0x00, 0x60, 0x3E, 0x00, 0x00, 0x60, 0x3E, 0x00, 0x00, 0xE0,
0x1E, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x00, 0xC0, 0x1F, 0x00, 0x01, 0x80,
0x0F, 0x80, 0x01, 0xFF, 0xFF, 0x80, 0x03, 0xFF, 0xFF, 0xC0, 0x03, 0x00,
0x07, 0xC0, 0x07, 0x00, 0x07, 0xC0, 0x06, 0x00, 0x03, 0xE0, 0x06, 0x00,
0x03, 0xE0, 0x0E, 0x00, 0x01, 0xF0, 0x0C, 0x00, 0x01, 0xF0, 0x1C, 0x00,
0x01, 0xF8, 0x3C, 0x00, 0x01, 0xF8, 0x7E, 0x00, 0x01, 0xFC, 0xFF, 0x80,
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x1F,
0x00, 0x00, 0x03, 0xE0, 0x00, 0x00, 0x7C, 0x00, 0x20, 0x0F, 0x80, 0x04,
0x01, 0xF0, 0x01, 0x80, 0x3E, 0x00, 0x70, 0x07, 0xFF, 0xFE, 0x00, 0xFF,
0xFF, 0xC0, 0x1F, 0x00, 0x38, 0x03, 0xE0, 0x03, 0x00, 0x7C, 0x00, 0x20,
0x0F, 0x80, 0x04, 0x01, 0xF0, 0x00, 0x00, 0x3E, 0x00, 0x00, 0x07, 0xC0,
0x00, 0x00, 0xF8, 0x00, 0x03, 0x1F, 0x00, 0x00, 0x43, 0xE0, 0x00, 0x18,
0x7C, 0x00, 0x07, 0x0F, 0x80, 0x01, 0xC1, 0xF0, 0x00, 0xF8, 0x7F, 0xFF,
0xFF, 0x3F, 0xFF, 0xFF, 0xE0, 0xFF, 0xFF, 0xFF, 0x3F, 0xFF, 0xFF, 0x1F,
0x00, 0x07, 0x1F, 0x00, 0x03, 0x1F, 0x00, 0x03, 0x1F, 0x00, 0x01, 0x1F,
0x00, 0x00, 0x1F, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x1F,
0x00, 0x08, 0x1F, 0x00, 0x08, 0x1F, 0x00, 0x18, 0x1F, 0x00, 0x38, 0x1F,
0xFF, 0xF8, 0x1F, 0xFF, 0xF8, 0x1F, 0x00, 0x38, 0x1F, 0x00, 0x18, 0x1F,
0x00, 0x08, 0x1F, 0x00, 0x08, 0x1F, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x1F,
0x00, 0x00, 0x1F, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x1F,
0x00, 0x00, 0x1F, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x3F, 0x80, 0x00, 0xFF,
0xF0, 0x00, 0x00, 0x0F, 0xF0, 0x08, 0x00, 0xFF, 0xFE, 0x70, 0x07, 0xE0,
0x1F, 0xE0, 0x1F, 0x00, 0x0F, 0xC0, 0x78, 0x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x00, 0x0F, 0x80, 0x38, 0x00, 0x0F, 0x80,
0x70, 0x00, 0x0F, 0x80, 0xE0, 0x00, 0x0F, 0x81, 0xC0, 0x00, 0x0F, 0x83,
0x80, 0x00, 0x0F, 0x87, 0x00, 0x00, 0x0F, 0x9E, 0x00, 0x00, 0x0F, 0xBC,
0x00, 0x00, 0x0F, 0xFE, 0x00, 0x00, 0x0F, 0xFF, 0x00, 0x00, 0x0F, 0xDF,
0x80, 0x00, 0x0F, 0x8F, 0xC0, 0x00, 0x0F, 0x87, 0xE0, 0x00, 0x0F, 0x83,
0xF0, 0x00, 0x0F, 0x81, 0xF8, 0x00, 0x0F, 0x80, 0xFC, 0x00, 0x0F, 0x80,
0x7E, 0x00, 0x0F, 0x80, 0x3F, 0x00, 0x0F, 0x80, 0x3F, 0x80, 0x0F, 0x80,
0x1F, 0x80, 0x0F, 0x80, 0x0F, 0xC0, 0x0F, 0x80, 0x07, 0xE0, 0x0F, 0x80,
0x07, 0xF0, 0x1F, 0xC0, 0x07, 0xFC, 0xFF, 0xF8, 0x3F, 0xFF, 0xFF, 0xF0,
0x00, 0x0F, 0xF0, 0x00, 0x01, 0xF0, 0x00, 0x00, 0x7C, 0x00, 0x00, 0x1F,
0x00, 0x00, 0x07, 0xC0, 0x00, 0x01, 0xF0, 0x00, 0x00, 0x7C, 0x00, 0x00,
0x1F, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x01, 0xF0, 0x00, 0x00, 0x7C, 0x00,
0x00, 0x1F, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x01, 0xF0, 0x00, 0x00, 0x7C,
0x00, 0x00, 0x1F, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x01, 0xF0, 0x00, 0x00,
0x7C, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x01, 0xF0, 0x00,
0x00, 0x7C, 0x00, 0x01, 0x1F, 0x00, 0x00, 0xC7, 0xC0, 0x00, 0x21, 0xF0,
0x00, 0x18,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x00, 0x3E, 0x00, 0x00, 0x07,
0xC0, 0x00, 0x00, 0xF8, 0x00, 0x00, 0x1F, 0x00, 0x00, 0x03, 0xE0, 0x00,
0x00, 0x7C, 0x00, 0x00, 0x0F, 0x80, 0x00, 0x01, 0xF0, 0x00, 0x00, 0x7F,
0x00, 0x00, 0x7F, 0xFC, 0x00, 0xFF, 0xF8, 0x03, 0xFF, 0x3F, 0xE0, 0x00,
0xFC, 0x0F, 0x80, 0x00, 0x78, 0x0F, 0x80, 0x00, 0x30, 0x0F, 0x80, 0x00,
0x30, 0x0F, 0x80, 0x00, 0x30, 0x0F, 0x80, 0x00, 0x30, 0x0F, 0x80, 0x00,
0x30, 0x0F, 0x80, 0x00, 0x30, 0x0F, 0x80, 0x00, 0x30, 0x0F, 0x80, 0x00,
0x30, 0x0F, 0x80, 0x00, 0x30, 0x0F, 0x80, 0x00, 0x30, 0x0F, 0x80, 0x00,
0x30, 0x0F, 0x80, 0x00, 0x30, 0x0F, 0x80, 0x00, 0x30, 0x0F, 0x80, 0x00,
0x30, 0x0F, 0x80, 0x00, 0x30, 0x0F, 0x80, 0x00, 0x30, 0x0F, 0x80, 0x00,
0x30, 0x0F, 0x80, 0x00, 0x30, 0x0F, 0x80, 0x00, 0x30, 0x0F, 0x80, 0x00,
0x30, 0x0F, 0x80, 0x00, 0x30, 0x0F, 0x80, 0x00, 0x20, 0x07, 0xC0, 0x00,
0x60, 0x07, 0xC0, 0x00, 0x60, 0x03, 0xE0, 0x00, 0xC0, 0x03, 0xF0, 0x01,
0xC0, 0x01, 0xFC, 0x07, 0x80, 0x00, 0x7F, 0xFE, 0x00, 0x00, 0x0F, 0xF8,
0x00, 0xFF, 0xF8, 0x01, 0xFF, 0x3F, 0xC0, 0x00, 0x7E, 0x0F, 0x80, 0x00,
0x3C, 0x0F, 0xC0, 0x00, 0x38, 0x07, 0xC0, 0x00, 0x38, 0x07, 0xC0, 0x00,
0x30, 0x03, 0xE0, 0x00, 0x70, 0x03, 0xE0, 0x00, 0x60, 0x01, 0xF0, 0x00,
0x60, 0x01, 0xF0, 0x00, 0xE0, 0x01, 0xF8, 0x00, 0xC0, 0x00, 0xF8, 0x01,
0xC0, 0x00, 0xF8, 0x01, 0x80, 0x00, 0x7C, 0x01, 0x80, 0x00, 0x7C, 0x03,
0x80, 0x00, 0x3E, 0x03, 0x00, 0x00, 0x3E, 0x07, 0x00, 0x00, 0x1F, 0x06,
0x00, 0x00, 0x1F, 0x06, 0x00, 0x00, 0x1F, 0x8E, 0x00, 0x00, 0x0F, 0x8C,
0x00, 0x00, 0x0F, 0x9C, 0x00, 0x00, 0x07, 0xD8, 0x00, 0x00, 0x07, 0xD8,
0x00, 0x00, 0x03, 0xF8, 0x00, 0x00, 0x03, 0xF0, 0x00, 0x00, 0x01, 0xF0,
0x00, 0x00, 0x01, 0xF0, 0x00, 0x00, 0x01, 0xE0, 0x00, 0x00, 0x00, 0xE0,
0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x40, 0x00, 0xFF, 0xF1, 0xFF,
0xF0, 0x1F, 0xF3, 0xF8, 0x07, 0xF8, 0x00, 0x7C, 0x1F, 0x80, 0x3F, 0x00,
0x03, 0x80, 0xF8, 0x01, 0xF0, 0x00, 0x30, 0x0F, 0x80, 0x1F, 0x00, 0x03,
0x00, 0x7C, 0x00, 0xF8, 0x00, 0x30, 0x07, 0xC0, 0x0F, 0x80, 0x06, 0x00,
0x3E, 0x00, 0x7C, 0x00, 0x60, 0x03, 0xE0, 0x07, 0xC0, 0x06, 0x00, 0x3E,
0x00, 0x7C, 0x00, 0xC0, 0x01, 0xF0, 0x07, 0xE0, 0x0C, 0x00, 0x1F, 0x00,
0xFE, 0x01, 0xC0, 0x01, 0xF0, 0x0D, 0xE0, 0x18, 0x00, 0x0F, 0x80, 0xDF,
0x01, 0x80, 0x00, 0xF8, 0x19, 0xF0, 0x30, 0x00, 0x07, 0xC1, 0x8F, 0x83,
0x00, 0x00, 0x7C, 0x38, 0xF8, 0x30, 0x00, 0x07, 0xC3, 0x0F, 0x86, 0x00,
0x00, 0x3E, 0x30, 0x7C, 0x60, 0x00, 0x03, 0xE7, 0x07, 0xCE, 0x00, 0x00,
0x3E, 0x60, 0x3E, 0xC0, 0x00, 0x01, 0xF6, 0x03, 0xEC, 0x00, 0x00, 0x1F,
0xE0, 0x3F, 0xC0, 0x00, 0x01, 0xFC, 0x01, 0xF8, 0x00, 0x00, 0x0F, 0xC0,
0x1F, 0x80, 0x00, 0x00, 0xF8, 0x01, 0xF8, 0x00, 0x00, 0x0F, 0x80, 0x0F,
0x00, 0x00, 0x00, 0x78, 0x00, 0xF0, 0x00, 0x00, 0x07, 0x00, 0x07, 0x00,
0x00, 0x00, 0x70, 0x00, 0x60, 0x00, 0x00, 0x03, 0x00, 0x06, 0x00, 0x00,
0x00, 0x20, 0x00, 0x20, 0x00, 0x7F, 0xFE, 0x03, 0xFF, 0x8F, 0xF8, 0x00,
0x7E, 0x01, 0xFC, 0x00, 0x1C, 0x00, 0x7E, 0x00, 0x1C, 0x00, 0x1F, 0x00,
0x0C, 0x00, 0x07, 0xC0, 0x0E, 0x00, 0x03, 0xF0, 0x0E, 0x00, 0x00, 0xF8,
0x0E, 0x00, 0x00, 0x3E, 0x06, 0x00, 0x00, 0x1F, 0x86, 0x00, 0x00, 0x07,
0xC7, 0x00, 0x00, 0x01, 0xF7, 0x00, 0x00, 0x00, 0xFF, 0x00, 0x00, 0x00,
0x3F, 0x00, 0x00, 0x00, 0x0F, 0x80, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00,
0x03, 0xF8, 0x00, 0x00, 0x03, 0xFC, 0x00, 0x00, 0x03, 0x9F, 0x00, 0x00,
0x01, 0x8F, 0xC0, 0x00, 0x01, 0x83, 0xF0, 0x00, 0x01, 0xC0, 0xF8, 0x00,
0x01, 0xC0, 0x7E, 0x00, 0x01, 0xC0, 0x1F, 0x80, 0x01, 0xC0, 0x07, 0xC0,
0x00, 0xC0, 0x03, 0xF0, 0x00, 0xE0, 0x00, 0xFC, 0x00, 0xE0, 0x00, 0x7F,
0x00, 0xF0, 0x00, 0x1F, 0x80, 0xFC, 0x00, 0x1F, 0xF3, 0xFF, 0x80, 0x7F,
0xFE, 0xFF, 0xF8, 0x03, 0xFF, 0x3F, 0xE0, 0x00, 0x7C, 0x1F, 0xC0, 0x00,
0x78, 0x0F, 0xC0, 0x00, 0x70, 0x07, 0xE0, 0x00, 0x60, 0x03, 0xF0, 0x00,
0xE0, 0x01, 0xF0, 0x01, 0xC0, 0x01, 0xF8, 0x01, 0x80, 0x00, 0xFC, 0x03,
0x80, 0x00, 0x7C, 0x07, 0x00, 0x00, 0x7E, 0x06, 0x00, 0x00, 0x3F, 0x0E,
0x00, 0x00, 0x1F, 0x1C, 0x00, 0x00, 0x1F, 0x98, 0x00, 0x00, 0x0F, 0xF8,
0x00, 0x00, 0x07, 0xF0, 0x00, 0x00, 0x07, 0xE0, 0x00, 0x00, 0x03, 0xE0,
0x00, 0x00, 0x03, 0xE0, 0x00, 0x00, 0x03, 0xE0, 0x00, 0x00, 0x03, 0xE0,
0x00, 0x00, 0x03, 0xE0, 0x00, 0x00, 0x03, 0xE0, 0x00, 0x00, 0x03, 0xE0,
0x00, 0x00, 0x03, 0xE0, 0x00, 0x00, 0x03, 0xE0, 0x00, 0x00, 0x03, 0xE0,
0x00, 0x00, 0x03, 0xE0, 0x00, 0x00, 0x03, 0xE0, 0x00, 0x00, 0x07, 0xF0,
0x00, 0x00, 0x3F, 0xFE, 0x00, 0x3F, 0xFF, 0xFF, 0xC7, 0xFF, 0xFF, 0xF8,
0xF0, 0x00, 0x3E, 0x38, 0x00, 0x0F, 0x86, 0x00, 0x03, 0xF0, 0xC0, 0x00,
0x7C, 0x10, 0x00, 0x1F, 0x02, 0x00, 0x07, 0xC0, 0x00, 0x01, 0xF8, 0x00,
0x00, 0x3E, 0x00, 0x00, 0x0F, 0x80, 0x00, 0x03, 0xF0, 0x00, 0x00, 0xFC,
0x00, 0x00, 0x1F, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x01, 0xF8, 0x00, 0x00,
0x7E, 0x00, 0x00, 0x0F, 0x80, 0x00, 0x03, 0xF0, 0x00, 0x00, 0xFC, 0x00,
0x00, 0x1F, 0x00, 0x00, 0x07, 0xC0, 0x00, 0x01, 0xF8, 0x00, 0x00, 0x7E,
0x00, 0x01, 0x0F, 0x80, 0x00, 0x63, 0xF0, 0x00, 0x0C, 0xFC, 0x00, 0x03,
0xBF, 0x00, 0x00, 0xE7, 0xC0, 0x00, 0x7D, 0xFF, 0xFF, 0xFF, 0xBF, 0xFF,
0xFF, 0xF0, 0xFF, 0xF0, 0x38, 0x1C, 0x0E, 0x07, 0x03, 0x81, 0xC0, 0xE0,
0x70, 0x38, 0x1C, 0x0E, 0x07, 0x03, 0x81, 0xC0, 0xE0, 0x70, 0x38, 0x1C,
0x0E, 0x07, 0x03, 0x81, 0xC0, 0xE0, 0x70, 0x38, 0x1C, 0x0E, 0x07, 0x03,
0x81, 0xC0, 0xE0, 0x70, 0x38, 0x1C, 0x0F, 0x07, 0xFC, 0xE0, 0x01, 0xC0,
0x07, 0x00, 0x1C, 0x00, 0x38, 0x00, 0xE0, 0x03, 0x80, 0x07, 0x00, 0x1C,
0x00, 0x70, 0x00, 0xE0, 0x03, 0x80, 0x0E, 0x00, 0x1C, 0x00, 0x70, 0x01,
0xC0, 0x03, 0x80, 0x0E, 0x00, 0x38, 0x00, 0x70, 0x01, 0xC0, 0x07, 0x00,
0x0E, 0x00, 0x38, 0x00, 0xE0, 0x01, 0xC0, 0x07, 0x00, 0x1E, 0x00, 0x38,
0x00, 0xE0, 0x03, 0xC0, 0x07, 0xFF, 0x83, 0xC0, 0xE0, 0x70, 0x38, 0x1C,
0x0E, 0x07, 0x03, 0x81, 0xC0, 0xE0, 0x70, 0x38, 0x1C, 0x0E, 0x07, 0x03,
0x81, 0xC0, 0xE0, 0x70, 0x38, 0x1C, 0x0E, 0x07, 0x03, 0x81, 0xC0, 0xE0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x00, 0x05, 0xE0, 0x02, 0x7C, 0x01, 0x8F, 0xC1, 0xC3, 0xFF, 0xE0,
0x7F, 0xF0, 0x07, 0xF0, 0x00, 0x00, 0x7E, 0x00, 0xFF, 0xC0, 0xE3, 0xE0,
0x60, 0x70, 0x70, 0x00, 0x38, 0x00, 0x1C, 0x00, 0x1E, 0x00, 0x0F, 0x00,
0x07, 0x80, 0x03, 0xC0, 0x01, 0xE0, 0x07, 0xFF, 0x83, 0xFF, 0xC0, 0x3C,
0x00, 0x1E, 0x00, 0x0F, 0x00, 0x07, 0x80, 0x03, 0xC0, 0x01, 0xE0, 0x00,
0xF0, 0x00, 0x78, 0x00, 0x3C, 0x00, 0x1E, 0x00, 0x0F, 0x00, 0x07, 0x80,
0x03, 0xC0, 0x01, 0xE0, 0x00, 0xF0, 0x00, 0x78, 0x00, 0x3C, 0x00, 0x3F,
0x00, 0xFF, 0xF0, 0x00, 0x01, 0xF8, 0x00, 0x3F, 0xF0, 0x03, 0xC7, 0xFE,
0x3C, 0x1F, 0xF1, 0xC0, 0x70, 0x1E, 0x03, 0xC0, 0xF0, 0x0E, 0x07, 0x80,
0x70, 0x3C, 0x03, 0x81, 0xE0, 0x1C, 0x07, 0x80, 0xC0, 0x3E, 0x0E, 0x00,
0x78, 0xE0, 0x01, 0xFC, 0x00, 0x18, 0x00, 0x01, 0x80, 0x00, 0x18, 0x00,
0x01, 0xE0, 0x00, 0x0F, 0xFF, 0xC0, 0x3F, 0xFF, 0x80, 0xFF, 0xFE, 0x0C,
0x00, 0x38, 0xC0, 0x00, 0x4C, 0x00, 0x02, 0x60, 0x00, 0x17, 0x00, 0x01,
0x38, 0x00, 0x09, 0xE0, 0x00, 0x87, 0xC0, 0x38, 0x1F, 0xFF, 0x00, 0x3F,
0xC0, 0x00, 0x06, 0x00, 0x00, 0xF8, 0x00, 0x0F, 0xE0, 0x00, 0x07, 0x80,
0x00, 0x1E, 0x00, 0x00, 0x78, 0x00, 0x01, 0xE0, 0x00, 0x07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x0E, 0x3E, 0x03,
0xC0, 0x0C, 0x1E, 0x03, 0xE0, 0x0C, 0x1E, 0x01, 0xE0, 0x0C, 0x1E, 0x01,
0xE0, 0x18, 0x0F, 0x00, 0xF0, 0x18, 0x0F, 0x01, 0xF0, 0x10, 0x07, 0x81,
0xF0, 0x30, 0x07, 0x81, 0x78, 0x30, 0x07, 0x83, 0x78, 0x60, 0x03, 0xC3,
0x38, 0x60, 0x03, 0xC6, 0x3C, 0x40, 0x01, 0xC6, 0x3C, 0xC0, 0x01, 0xEC,
0x1E, 0xC0, 0x01, 0xEC, 0x1F, 0x80, 0x00, 0xF8, 0x0F, 0x80, 0x00, 0xF8,
0x0F, 0x00, 0x00, 0x70, 0x0F, 0x00, 0x00, 0x70, 0x07, 0x00, 0x00, 0x60,
0x06, 0x00, 0x00, 0x20, 0x02, 0x00, 0x7F, 0xE7, 0xF0, 0x7E, 0x0F, 0x00,
0xF8, 0x38, 0x01, 0xE0, 0xC0, 0x07, 0xC6, 0x00, 0x0F, 0x30, 0x00, 0x1E,
0xC0, 0x00, 0x7E, 0x00, 0x00, 0xF0, 0x00, 0x01, 0xE0, 0x00, 0x07, 0xC0,
0x00, 0x3F, 0x00, 0x00, 0xDE, 0x00, 0x06, 0x7C, 0x00, 0x30, 0xF0, 0x01,
0xC1, 0xE0, 0x06, 0x07, 0xC0, 0x30, 0x0F, 0x01, 0xC0, 0x1E, 0x0F, 0x00,
0xFC, 0xFE, 0x07, 0xFC, 0xFF, 0xC0, 0xFC, 0xFC, 0x01, 0xE1, 0xE0, 0x03,
0x07, 0x80, 0x18, 0x0F, 0x00, 0x60, 0x3C, 0x01, 0x80, 0x78, 0x0C, 0x01,
0xE0, 0x30, 0x03, 0xC0, 0xC0, 0x0F, 0x06, 0x00, 0x3E, 0x18, 0x00, 0x78,
0x40, 0x01, 0xF3, 0x00, 0x03, 0xCC, 0x00, 0x0F, 0xE0, 0x00, 0x1F, 0x80,
0x00, 0x7C, 0x00, 0x00, 0xF0, 0x00, 0x03, 0xC0, 0x00, 0x06, 0x00, 0x00,
0x18, 0x00, 0x00, 0x40, 0x00, 0x03, 0x00, 0x00, 0x0C, 0x00, 0x00, 0x60,
0x00, 0x01, 0x80, 0x00, 0x0C, 0x00, 0x0F, 0xF0, 0x00, 0x7F, 0x80, 0x01,
0xFC, 0x00, 0x03, 0xE0, 0x00, 0x00, 0x7F, 0xFF, 0x9F, 0xFF, 0xE6, 0x00,
0xF1, 0x00, 0x78, 0x40, 0x3E, 0x00, 0x0F, 0x00, 0x07, 0x80, 0x03, 0xE0,
0x00, 0xF0, 0x00, 0x78, 0x00, 0x3E, 0x00, 0x0F, 0x00, 0x07, 0x80, 0x03,
0xE0, 0x01, 0xF0, 0x04, 0x78, 0x01, 0x3E, 0x00, 0xDF, 0x00, 0x37, 0x80,
0x1F, 0xFF, 0xFE, 0xFF, 0xFF, 0x80, 0x01, 0xE0, 0x78, 0x1C, 0x07, 0x80,
0xE0, 0x1C, 0x03, 0x80, 0x70, 0x0E, 0x01, 0xC0, 0x38, 0x07, 0x00, 0xE0,
0x1C, 0x03, 0x80, 0x70, 0x0E, 0x01, 0xC0, 0x70, 0x1C, 0x0E, 0x00, 0x70,
0x07, 0x00, 0x70, 0x0E, 0x01, 0xC0, 0x38, 0x07, 0x00, 0xE0, 0x1C, 0x03,
0x80, 0x70, 0x0E, 0x01, 0xC0, 0x38, 0x07, 0x00, 0xE0, 0x1C, 0x01, 0xC0,
0x1E, 0x00, 0xE0, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
0xFF, 0xFF, 0xFF, 0xE0, 0x0F, 0x00, 0x70, 0x0F, 0x00, 0xE0, 0x1C, 0x03,
0x80, 0x70, 0x0E, 0x01, 0xC0, 0x38, 0x07, 0x00, 0xE0, 0x1C, 0x03, 0x80,
0x70, 0x0E, 0x01, 0xC0, 0x1C, 0x01, 0xC0, 0x0E, 0x07, 0x01, 0xC0, 0x70,
0x0E, 0x01, 0xC0, 0x38, 0x07, 0x00, 0xE0, 0x1C, 0x03, 0x80, 0x70, 0x0E,
0x01, 0xC0, 0x38, 0x07, 0x00, 0xE0, 0x3C, 0x07, 0x03, 0xC0, 0xF0, 0x00,
0x1F, 0x80, 0x00, 0xFF, 0x80, 0xC7, 0x0F, 0x87, 0xB8, 0x0F, 0xFC, 0x00,
0x07, 0xC0 };
const GFXglyph FreeSerif24pt7bGlyphs[] PROGMEM = {
{ 0, 0, 0, 12, 0, 1 }, // 0x20 ' '
{ 0, 5, 32, 16, 6, -31 }, // 0x21 '!'
{ 20, 12, 12, 19, 4, -31 }, // 0x22 '"'
{ 38, 23, 31, 23, 0, -30 }, // 0x23 '#'
{ 128, 19, 37, 24, 2, -33 }, // 0x24 '$'
{ 216, 33, 32, 39, 3, -30 }, // 0x25 '%'
{ 348, 32, 33, 37, 2, -31 }, // 0x26 '&'
{ 480, 4, 12, 9, 3, -31 }, // 0x27 '''
{ 486, 12, 40, 16, 2, -31 }, // 0x28 '('
{ 546, 12, 40, 16, 2, -30 }, // 0x29 ')'
{ 606, 16, 19, 24, 4, -30 }, // 0x2A '*'
{ 644, 23, 23, 27, 2, -22 }, // 0x2B '+'
{ 711, 6, 11, 12, 2, -4 }, // 0x2C ','
{ 720, 11, 2, 16, 2, -10 }, // 0x2D '-'
{ 723, 5, 5, 12, 3, -3 }, // 0x2E '.'
{ 727, 14, 32, 14, 0, -30 }, // 0x2F '/'
{ 783, 22, 33, 23, 1, -31 }, // 0x30 '0'
{ 874, 13, 32, 24, 5, -31 }, // 0x31 '1'
{ 926, 21, 31, 23, 1, -30 }, // 0x32 '2'
{ 1008, 18, 32, 23, 2, -30 }, // 0x33 '3'
{ 1080, 21, 31, 24, 1, -30 }, // 0x34 '4'
{ 1162, 19, 33, 24, 2, -31 }, // 0x35 '5'
{ 1241, 21, 33, 23, 2, -31 }, // 0x36 '6'
{ 1328, 20, 31, 24, 1, -30 }, // 0x37 '7'
{ 1406, 18, 33, 23, 3, -31 }, // 0x38 '8'
{ 1481, 21, 33, 24, 1, -31 }, // 0x39 '9'
{ 1568, 5, 22, 12, 4, -20 }, // 0x3A ':'
{ 1582, 6, 27, 12, 3, -20 }, // 0x3B ';'
{ 1603, 24, 25, 27, 1, -24 }, // 0x3C '<'
{ 1678, 24, 11, 27, 1, -16 }, // 0x3D '='
{ 1711, 24, 25, 27, 2, -23 }, // 0x3E '>'
{ 1786, 17, 32, 21, 3, -31 }, // 0x3F '?'
{ 1854, 32, 33, 41, 4, -31 }, // 0x40 '@'
{ 1986, 32, 32, 34, 1, -31 }, // 0x41 'A'
{ 2114, 27, 31, 30, 0, -30 }, // 0x42 'B'
{ 2219, 28, 33, 31, 2, -31 }, // 0x43 'C'
{ 2335, 31, 31, 34, 1, -30 }, // 0x44 'D'
{ 2456, 27, 31, 29, 2, -30 }, // 0x45 'E'
{ 2561, 24, 31, 27, 2, -30 }, // 0x46 'F'
{ 2654, 31, 33, 35, 2, -31 }, // 0x47 'G'
{ 2782, 30, 31, 34, 2, -30 }, // 0x48 'H'
{ 2899, 13, 31, 15, 1, -30 }, // 0x49 'I'
{ 2950, 17, 32, 18, 0, -30 }, // 0x4A 'J'
{ 3018, 32, 31, 33, 1, -30 }, // 0x4B 'K'
{ 3142, 26, 31, 29, 2, -30 }, // 0x4C 'L'
{ 3243, 39, 31, 41, 1, -30 }, // 0x4D 'M'
{ 3395, 32, 32, 34, 1, -30 }, // 0x4E 'N'
{ 3523, 30, 33, 34, 2, -31 }, // 0x4F 'O'
{ 3647, 23, 31, 27, 2, -30 }, // 0x50 'P'
{ 3737, 31, 40, 34, 2, -31 }, // 0x51 'Q'
{ 3892, 28, 31, 31, 2, -30 }, // 0x52 'R'
{ 4001, 21, 33, 25, 2, -31 }, // 0x53 'S'
{ 4088, 27, 31, 28, 1, -30 }, // 0x54 'T'
{ 4193, 32, 32, 34, 1, -30 }, // 0x55 'U'
{ 4321, 32, 32, 33, 0, -30 }, // 0x56 'V'
{ 4449, 44, 32, 45, 0, -30 }, // 0x57 'W'
{ 4625, 33, 31, 34, 0, -30 }, // 0x58 'X'
{ 4753, 32, 31, 33, 0, -30 }, // 0x59 'Y'
{ 4877, 27, 31, 29, 1, -30 }, // 0x5A 'Z'
{ 4982, 9, 38, 16, 4, -30 }, // 0x5B '['
{ 5025, 14, 32, 14, 0, -30 }, // 0x5C '\'
{ 5081, 9, 38, 16, 3, -30 }, // 0x5D ']'
{ 5124, 20, 17, 22, 1, -30 }, // 0x5E '^'
{ 5167, 24, 2, 23, 0, 5 }, // 0x5F '_'
{ 5173, 10, 8, 12, 1, -31 }, // 0x60 '`'
{ 5183, 18, 21, 20, 1, -20 }, // 0x61 'a'
{ 5231, 21, 32, 24, 1, -31 }, // 0x62 'b'
{ 5315, 19, 21, 21, 1, -20 }, // 0x63 'c'
{ 5365, 22, 32, 23, 1, -31 }, // 0x64 'd'
{ 5453, 18, 21, 21, 1, -20 }, // 0x65 'e'
{ 5501, 17, 33, 18, 0, -32 }, // 0x66 'f'
{ 5572, 21, 31, 22, 1, -20 }, // 0x67 'g'
{ 5654, 22, 32, 23, 0, -31 }, // 0x68 'h'
{ 5742, 11, 32, 13, 0, -31 }, // 0x69 'i'
{ 5786, 12, 42, 16, 0, -31 }, // 0x6A 'j'
{ 5849, 23, 32, 24, 1, -31 }, // 0x6B 'k'
{ 5941, 11, 32, 12, 0, -31 }, // 0x6C 'l'
{ 5985, 35, 21, 37, 1, -20 }, // 0x6D 'm'
{ 6077, 22, 21, 23, 0, -20 }, // 0x6E 'n'
{ 6135, 22, 21, 23, 1, -20 }, // 0x6F 'o'
{ 6193, 21, 31, 24, 1, -20 }, // 0x70 'p'
{ 6275, 21, 31, 23, 1, -20 }, // 0x71 'q'
{ 6357, 15, 21, 16, 1, -20 }, // 0x72 'r'
{ 6397, 13, 21, 17, 2, -20 }, // 0x73 's'
{ 6432, 12, 26, 13, 1, -25 }, // 0x74 't'
{ 6471, 22, 21, 23, 1, -20 }, // 0x75 'u'
{ 6529, 22, 22, 22, 0, -20 }, // 0x76 'v'
{ 6590, 32, 22, 32, 0, -20 }, // 0x77 'w'
{ 6678, 22, 21, 23, 0, -20 }, // 0x78 'x'
{ 6736, 22, 31, 22, 0, -20 }, // 0x79 'y'
{ 6822, 18, 21, 20, 1, -20 }, // 0x7A 'z'
{ 6870, 11, 41, 23, 5, -31 }, // 0x7B '{'
{ 6927, 3, 32, 9, 3, -30 }, // 0x7C '|'
{ 6939, 11, 41, 23, 7, -31 }, // 0x7D '}'
{ 6996, 22, 5, 23, 1, -13 } }; // 0x7E '~'
const GFXfont FreeSerif24pt7b PROGMEM = {
(uint8_t *)FreeSerif24pt7bBitmaps,
(GFXglyph *)FreeSerif24pt7bGlyphs,
0x20, 0x7E, 56 };
// Approx. 7682 bytes
|
train_000.parquet/904
|
{
"file_path": "esp32/examples/color_code/components/lcd/Adafruit-GFX-Library/Fonts/FreeSerif24pt7b.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 48626,
"token_count": 46054
}
|
const uint8_t FreeSerifBold18pt7bBitmaps[] PROGMEM = {
0x7B, 0xEF, 0xFF, 0xFF, 0xF7, 0x9E, 0x71, 0xC7, 0x0C, 0x20, 0x82, 0x00,
0x00, 0x07, 0x3E, 0xFF, 0xFF, 0xDC, 0x60, 0x37, 0x83, 0xFC, 0x1F, 0xE0,
0xFF, 0x07, 0xB8, 0x3D, 0xC0, 0xCC, 0x06, 0x20, 0x31, 0x01, 0x80, 0x03,
0x8E, 0x00, 0xC3, 0x80, 0x30, 0xE0, 0x1C, 0x38, 0x07, 0x0E, 0x01, 0xC3,
0x87, 0xFF, 0xFD, 0xFF, 0xFF, 0x7F, 0xFF, 0xC1, 0x87, 0x00, 0xE1, 0xC0,
0x38, 0x70, 0x0E, 0x1C, 0x03, 0x86, 0x0F, 0xFF, 0xF3, 0xFF, 0xFC, 0xFF,
0xFF, 0x07, 0x0E, 0x01, 0xC3, 0x80, 0x70, 0xE0, 0x1C, 0x30, 0x07, 0x0C,
0x01, 0x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GFXglyph FreeSerifBold18pt7bGlyphs[] PROGMEM = {
{ 0, 0, 0, 9, 0, 1 }, // 0x20 ' '
{ 0, 6, 24, 12, 3, -23 }, // 0x21 '!'
{ 18, 13, 10, 19, 3, -23 }, // 0x22 '"'
{ 35, 18, 24, 17, 0, -23 }, // 0x23 '#'
{ 89, 15, 28, 17, 1, -25 }, // 0x24 '$'
{ 142, 27, 24, 35, 4, -23 }, // 0x25 '%'
{ 223, 26, 25, 29, 2, -23 }, // 0x26 '&'
{ 305, 4, 10, 10, 3, -23 }, // 0x27 '''
{ 310, 9, 30, 12, 2, -23 }, // 0x28 '('
{ 344, 9, 30, 12, 1, -23 }, // 0x29 ')'
{ 378, 14, 15, 18, 2, -23 }, // 0x2A '*'
{ 405, 19, 19, 24, 2, -17 }, // 0x2B '+'
{ 451, 6, 12, 9, 1, -5 }, // 0x2C ','
{ 460, 8, 4, 12, 2, -9 }, // 0x2D '-'
{ 464, 6, 6, 9, 1, -5 }, // 0x2E '.'
{ 469, 11, 25, 10, -1, -23 }, // 0x2F '/'
{ 504, 16, 24, 18, 1, -23 }, // 0x30 '0'
{ 552, 12, 24, 18, 3, -23 }, // 0x31 '1'
{ 588, 16, 24, 17, 1, -23 }, // 0x32 '2'
{ 636, 16, 24, 18, 0, -23 }, // 0x33 '3'
{ 684, 15, 24, 18, 1, -23 }, // 0x34 '4'
{ 729, 15, 24, 18, 1, -23 }, // 0x35 '5'
{ 774, 16, 24, 18, 1, -23 }, // 0x36 '6'
{ 822, 16, 24, 17, 1, -23 }, // 0x37 '7'
{ 870, 16, 24, 17, 1, -23 }, // 0x38 '8'
{ 918, 16, 24, 18, 1, -23 }, // 0x39 '9'
{ 966, 6, 16, 12, 3, -15 }, // 0x3A ':'
{ 978, 7, 22, 12, 2, -15 }, // 0x3B ';'
{ 998, 19, 20, 24, 2, -18 }, // 0x3C '<'
{ 1046, 19, 12, 24, 2, -14 }, // 0x3D '='
{ 1075, 19, 20, 24, 3, -18 }, // 0x3E '>'
{ 1123, 14, 24, 18, 2, -23 }, // 0x3F '?'
{ 1165, 24, 25, 33, 4, -23 }, // 0x40 '@'
{ 1240, 24, 24, 25, 1, -23 }, // 0x41 'A'
{ 1312, 21, 24, 23, 1, -23 }, // 0x42 'B'
{ 1375, 23, 25, 25, 1, -23 }, // 0x43 'C'
{ 1447, 23, 24, 26, 1, -23 }, // 0x44 'D'
{ 1516, 21, 24, 23, 2, -23 }, // 0x45 'E'
{ 1579, 19, 24, 22, 2, -23 }, // 0x46 'F'
{ 1636, 25, 25, 27, 1, -23 }, // 0x47 'G'
{ 1715, 24, 24, 27, 2, -23 }, // 0x48 'H'
{ 1787, 11, 24, 14, 2, -23 }, // 0x49 'I'
{ 1820, 16, 27, 18, 0, -23 }, // 0x4A 'J'
{ 1874, 25, 24, 27, 2, -23 }, // 0x4B 'K'
{ 1949, 21, 24, 23, 2, -23 }, // 0x4C 'L'
{ 2012, 31, 24, 33, 1, -23 }, // 0x4D 'M'
{ 2105, 23, 24, 25, 1, -23 }, // 0x4E 'N'
{ 2174, 25, 25, 27, 1, -23 }, // 0x4F 'O'
{ 2253, 19, 24, 22, 2, -23 }, // 0x50 'P'
{ 2310, 25, 30, 27, 1, -23 }, // 0x51 'Q'
{ 2404, 23, 24, 25, 2, -23 }, // 0x52 'R'
{ 2473, 16, 25, 20, 2, -23 }, // 0x53 'S'
{ 2523, 21, 24, 23, 1, -23 }, // 0x54 'T'
{ 2586, 22, 25, 25, 2, -23 }, // 0x55 'U'
{ 2655, 24, 24, 25, 0, -23 }, // 0x56 'V'
{ 2727, 34, 25, 34, 0, -23 }, // 0x57 'W'
{ 2834, 24, 24, 25, 1, -23 }, // 0x58 'X'
{ 2906, 24, 24, 25, 1, -23 }, // 0x59 'Y'
{ 2978, 21, 24, 23, 1, -23 }, // 0x5A 'Z'
{ 3041, 8, 29, 12, 2, -23 }, // 0x5B '['
{ 3070, 11, 25, 10, -1, -23 }, // 0x5C '\'
{ 3105, 8, 29, 12, 2, -23 }, // 0x5D ']'
{ 3134, 15, 13, 20, 3, -23 }, // 0x5E '^'
{ 3159, 18, 3, 17, 0, 3 }, // 0x5F '_'
{ 3166, 8, 6, 12, 0, -23 }, // 0x60 '`'
{ 3172, 16, 16, 18, 1, -15 }, // 0x61 'a'
{ 3204, 18, 24, 19, 1, -23 }, // 0x62 'b'
{ 3258, 14, 16, 15, 1, -15 }, // 0x63 'c'
{ 3286, 18, 24, 19, 1, -23 }, // 0x64 'd'
{ 3340, 14, 16, 16, 1, -15 }, // 0x65 'e'
{ 3368, 11, 24, 14, 2, -23 }, // 0x66 'f'
{ 3401, 17, 23, 17, 1, -15 }, // 0x67 'g'
{ 3450, 17, 24, 19, 1, -23 }, // 0x68 'h'
{ 3501, 7, 24, 10, 2, -23 }, // 0x69 'i'
{ 3522, 11, 31, 14, 0, -23 }, // 0x6A 'j'
{ 3565, 18, 24, 19, 1, -23 }, // 0x6B 'k'
{ 3619, 7, 24, 10, 1, -23 }, // 0x6C 'l'
{ 3640, 27, 16, 29, 1, -15 }, // 0x6D 'm'
{ 3694, 17, 16, 19, 1, -15 }, // 0x6E 'n'
{ 3728, 17, 16, 18, 1, -15 }, // 0x6F 'o'
{ 3762, 19, 23, 19, 0, -15 }, // 0x70 'p'
{ 3817, 17, 23, 19, 1, -15 }, // 0x71 'q'
{ 3866, 13, 16, 15, 1, -15 }, // 0x72 'r'
{ 3892, 12, 16, 14, 1, -15 }, // 0x73 's'
{ 3916, 10, 21, 12, 1, -20 }, // 0x74 't'
{ 3943, 18, 16, 20, 1, -15 }, // 0x75 'u'
{ 3979, 17, 16, 17, 0, -15 }, // 0x76 'v'
{ 4013, 24, 16, 25, 0, -15 }, // 0x77 'w'
{ 4061, 16, 16, 18, 1, -15 }, // 0x78 'x'
{ 4093, 16, 23, 17, 0, -15 }, // 0x79 'y'
{ 4139, 14, 16, 16, 0, -15 }, // 0x7A 'z'
{ 4167, 11, 31, 14, 1, -24 }, // 0x7B '{'
{ 4210, 3, 25, 8, 2, -23 }, // 0x7C '|'
{ 4220, 11, 31, 14, 3, -24 }, // 0x7D '}'
{ 4263, 16, 5, 18, 1, -11 } }; // 0x7E '~'
const GFXfont FreeSerifBold18pt7b PROGMEM = {
(uint8_t *)FreeSerifBold18pt7bBitmaps,
(GFXglyph *)FreeSerifBold18pt7bGlyphs,
0x20, 0x7E, 42 };
// Approx. 4945 bytes
|
train_000.parquet/905
|
{
"file_path": "esp32/examples/color_code/components/lcd/Adafruit-GFX-Library/Fonts/FreeSerifBold18pt7b.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 31768,
"token_count": 29265
}
|
/*
TrueType to Adafruit_GFX font converter. Derived from Peter Jakobs'
Adafruit_ftGFX fork & makefont tool, and Paul Kourany's Adafruit_mfGFX.
NOT AN ARDUINO SKETCH. This is a command-line tool for preprocessing
fonts to be used with the Adafruit_GFX Arduino library.
For UNIX-like systems. Outputs to stdout; redirect to header file, e.g.:
./fontconvert ~/Library/Fonts/FreeSans.ttf 18 > FreeSans18pt7b.h
REQUIRES FREETYPE LIBRARY. www.freetype.org
Currently this only extracts the printable 7-bit ASCII chars of a font.
Will eventually extend with some int'l chars a la ftGFX, not there yet.
Keep 7-bit fonts around as an option in that case, more compact.
See notes at end for glyph nomenclature & other tidbits.
*/
#include <stdio.h>
#include <ctype.h>
#include <stdint.h>
#include <ft2build.h>
#include FT_GLYPH_H
#include "../gfxfont.h" // Adafruit_GFX font structures
#define DPI 141 // Approximate res. of Adafruit 2.8" TFT
// Accumulate bits for output, with periodic hexadecimal byte write
void enbit(uint8_t value) {
static uint8_t row = 0, sum = 0, bit = 0x80, firstCall = 1;
if(value) sum |= bit; // Set bit if needed
if(!(bit >>= 1)) { // Advance to next bit, end of byte reached?
if(!firstCall) { // Format output table nicely
if(++row >= 12) { // Last entry on line?
printf(",\n "); // Newline format output
row = 0; // Reset row counter
} else { // Not end of line
printf(", "); // Simple comma delim
}
}
printf("0x%02X", sum); // Write byte value
sum = 0; // Clear for next byte
bit = 0x80; // Reset bit counter
firstCall = 0; // Formatting flag
}
}
int main(int argc, char *argv[]) {
int i, j, err, size, first=' ', last='~',
bitmapOffset = 0, x, y, byte;
char *fontName, c, *ptr;
FT_Library library;
FT_Face face;
FT_Glyph glyph;
FT_Bitmap *bitmap;
FT_BitmapGlyphRec *g;
GFXglyph *table;
uint8_t bit;
// Parse command line. Valid syntaxes are:
// fontconvert [filename] [size]
// fontconvert [filename] [size] [last char]
// fontconvert [filename] [size] [first char] [last char]
// Unless overridden, default first and last chars are
// ' ' (space) and '~', respectively
if(argc < 3) {
fprintf(stderr, "Usage: %s fontfile size [first] [last]\n",
argv[0]);
return 1;
}
size = atoi(argv[2]);
if(argc == 4) {
last = atoi(argv[3]);
} else if(argc == 5) {
first = atoi(argv[3]);
last = atoi(argv[4]);
}
if(last < first) {
i = first;
first = last;
last = i;
}
ptr = strrchr(argv[1], '/'); // Find last slash in filename
if(ptr) ptr++; // First character of filename (path stripped)
else ptr = argv[1]; // No path; font in local dir.
// Allocate space for font name and glyph table
if((!(fontName = malloc(strlen(ptr) + 20))) ||
(!(table = (GFXglyph *)malloc((last - first + 1) *
sizeof(GFXglyph))))) {
fprintf(stderr, "Malloc error\n");
return 1;
}
// Derive font table names from filename. Period (filename
// extension) is truncated and replaced with the font size & bits.
strcpy(fontName, ptr);
ptr = strrchr(fontName, '.'); // Find last period (file ext)
if(!ptr) ptr = &fontName[strlen(fontName)]; // If none, append
// Insert font size and 7/8 bit. fontName was alloc'd w/extra
// space to allow this, we're not sprintfing into Forbidden Zone.
sprintf(ptr, "%dpt%db", size, (last > 127) ? 8 : 7);
// Space and punctuation chars in name replaced w/ underscores.
for(i=0; (c=fontName[i]); i++) {
if(isspace(c) || ispunct(c)) fontName[i] = '_';
}
// Init FreeType lib, load font
if((err = FT_Init_FreeType(&library))) {
fprintf(stderr, "FreeType init error: %d", err);
return err;
}
if((err = FT_New_Face(library, argv[1], 0, &face))) {
fprintf(stderr, "Font load error: %d", err);
FT_Done_FreeType(library);
return err;
}
// << 6 because '26dot6' fixed-point format
FT_Set_Char_Size(face, size << 6, 0, DPI, 0);
// Currently all symbols from 'first' to 'last' are processed.
// Fonts may contain WAY more glyphs than that, but this code
// will need to handle encoding stuff to deal with extracting
// the right symbols, and that's not done yet.
// fprintf(stderr, "%ld glyphs\n", face->num_glyphs);
printf("const uint8_t %sBitmaps[] PROGMEM = {\n ", fontName);
// Process glyphs and output huge bitmap data array
for(i=first, j=0; i<=last; i++, j++) {
// MONO renderer provides clean image with perfect crop
// (no wasted pixels) via bitmap struct.
if((err = FT_Load_Char(face, i, FT_LOAD_TARGET_MONO))) {
fprintf(stderr, "Error %d loading char '%c'\n",
err, i);
continue;
}
if((err = FT_Render_Glyph(face->glyph,
FT_RENDER_MODE_MONO))) {
fprintf(stderr, "Error %d rendering char '%c'\n",
err, i);
continue;
}
if((err = FT_Get_Glyph(face->glyph, &glyph))) {
fprintf(stderr, "Error %d getting glyph '%c'\n",
err, i);
continue;
}
bitmap = &face->glyph->bitmap;
g = (FT_BitmapGlyphRec *)glyph;
// Minimal font and per-glyph information is stored to
// reduce flash space requirements. Glyph bitmaps are
// fully bit-packed; no per-scanline pad, though end of
// each character may be padded to next byte boundary
// when needed. 16-bit offset means 64K max for bitmaps,
// code currently doesn't check for overflow. (Doesn't
// check that size & offsets are within bounds either for
// that matter...please convert fonts responsibly.)
table[j].bitmapOffset = bitmapOffset;
table[j].width = bitmap->width;
table[j].height = bitmap->rows;
table[j].xAdvance = face->glyph->advance.x >> 6;
table[j].xOffset = g->left;
table[j].yOffset = 1 - g->top;
for(y=0; y < bitmap->rows; y++) {
for(x=0;x < bitmap->width; x++) {
byte = x / 8;
bit = 0x80 >> (x & 7);
enbit(bitmap->buffer[
y * bitmap->pitch + byte] & bit);
}
}
// Pad end of char bitmap to next byte boundary if needed
int n = (bitmap->width * bitmap->rows) & 7;
if(n) { // Pixel count not an even multiple of 8?
n = 8 - n; // # bits to next multiple
while(n--) enbit(0);
}
bitmapOffset += (bitmap->width * bitmap->rows + 7) / 8;
FT_Done_Glyph(glyph);
}
printf(" };\n\n"); // End bitmap array
// Output glyph attributes table (one per character)
printf("const GFXglyph %sGlyphs[] PROGMEM = {\n", fontName);
for(i=first, j=0; i<=last; i++, j++) {
printf(" { %5d, %3d, %3d, %3d, %4d, %4d }",
table[j].bitmapOffset,
table[j].width,
table[j].height,
table[j].xAdvance,
table[j].xOffset,
table[j].yOffset);
if(i < last) {
printf(", // 0x%02X", i);
if((i >= ' ') && (i <= '~')) {
printf(" '%c'", i);
}
putchar('\n');
}
}
printf(" }; // 0x%02X", last);
if((last >= ' ') && (last <= '~')) printf(" '%c'", last);
printf("\n\n");
// Output font structure
printf("const GFXfont %s PROGMEM = {\n", fontName);
printf(" (uint8_t *)%sBitmaps,\n", fontName);
printf(" (GFXglyph *)%sGlyphs,\n", fontName);
if (face->size->metrics.height == 0) {
// No face height info, assume fixed width and get from a glyph.
printf(" 0x%02X, 0x%02X, %d };\n\n",
first, last, table[0].height);
} else {
printf(" 0x%02X, 0x%02X, %ld };\n\n",
first, last, face->size->metrics.height >> 6);
}
printf("// Approx. %d bytes\n",
bitmapOffset + (last - first + 1) * 7 + 7);
// Size estimate is based on AVR struct and pointer sizes;
// actual size may vary.
FT_Done_FreeType(library);
return 0;
}
/* -------------------------------------------------------------------------
Character metrics are slightly different from classic GFX & ftGFX.
In classic GFX: cursor position is the upper-left pixel of each 5x7
character; lower extent of most glyphs (except those w/descenders)
is +6 pixels in Y direction.
W/new GFX fonts: cursor position is on baseline, where baseline is
'inclusive' (containing the bottom-most row of pixels in most symbols,
except those with descenders; ftGFX is one pixel lower).
Cursor Y will be moved automatically when switching between classic
and new fonts. If you switch fonts, any print() calls will continue
along the same baseline.
...........#####.. -- yOffset
..........######..
..........######..
.........#######..
........#########.
* = Cursor pos. ........#########.
.......##########.
......#####..####.
......#####..####.
*.#.. .....#####...####.
.#.#. ....##############
#...# ...###############
#...# ...###############
##### ..#####......#####
#...# .#####.......#####
====== #...# ====== #*###.........#### ======= Baseline
|| xOffset
glyph->xOffset and yOffset are pixel offsets, in GFX coordinate space
(+Y is down), from the cursor position to the top-left pixel of the
glyph bitmap. i.e. yOffset is typically negative, xOffset is typically
zero but a few glyphs will have other values (even negative xOffsets
sometimes, totally normal). glyph->xAdvance is the distance to move
the cursor on the X axis after drawing the corresponding symbol.
There's also some changes with regard to 'background' color and new GFX
fonts (classic fonts unchanged). See Adafruit_GFX.cpp for explanation.
*/
|
train_000.parquet/906
|
{
"file_path": "esp32/examples/color_code/components/lcd/Adafruit-GFX-Library/fontconvert/fontconvert.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 9592,
"token_count": 3760
}
|
#!/bin/bash
# Ugly little Bash script, generates a set of .h files for GFX using
# GNU FreeFont sources. There are three fonts: 'Mono' (Courier-like),
# 'Sans' (Helvetica-like) and 'Serif' (Times-like); four styles: regular,
# bold, oblique or italic, and bold+oblique or bold+italic; and four
# sizes: 9, 12, 18 and 24 point. No real error checking or anything,
# this just powers through all the combinations, calling the fontconvert
# utility and redirecting the output to a .h file for each combo.
# Adafruit_GFX repository does not include the source outline fonts
# (huge zipfile, different license) but they're easily acquired:
# http://savannah.gnu.org/projects/freefont/
convert=./fontconvert
inpath=~/Desktop/freefont/
outpath=../Fonts/
fonts=(FreeMono FreeSans FreeSerif)
styles=("" Bold Italic BoldItalic Oblique BoldOblique)
sizes=(9 12 18 24)
for f in ${fonts[*]}
do
for index in ${!styles[*]}
do
st=${styles[$index]}
for si in ${sizes[*]}
do
infile=$inpath$f$st".ttf"
if [ -f $infile ] # Does source combination exist?
then
outfile=$outpath$f$st$si"pt7b.h"
# printf "%s %s %s > %s\n" $convert $infile $si $outfile
$convert $infile $si > $outfile
fi
done
done
done
|
train_000.parquet/907
|
{
"file_path": "esp32/examples/color_code/components/lcd/Adafruit-GFX-Library/fontconvert/makefonts.sh",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 1221,
"token_count": 490
}
|
### A short guide to use fontconvert.c to create your own fonts using MinGW.
#### STEP 1: INSTALL MinGW
Install MinGW (Minimalist GNU for Windows) from [MinGW.org](http://www.mingw.org/).
Please read carefully the instructions found on [Getting started page](http://www.mingw.org/wiki/Getting_Started).
I suggest installing with the "Graphical User Interface Installer".
To complete your initial installation you should further install some "packages".
For our purpose you should only install the "Basic Setup" packages.
To do that:
1. Open the MinGW Installation Manager
2. From the left panel click "Basic Setup".
3. On the right panel choose "mingw32-base", "mingw-gcc-g++", "mingw-gcc-objc" and "msys-base"
and click "Mark for installation"
4. From the Menu click "Installation" and then "Apply changes". In the pop-up window select "Apply".
#### STEP 2: INSTALL Freetype Library
To read about the freetype project visit [freetype.org](https://www.freetype.org/).
To Download the latest version of freetype go to [download page](http://download.savannah.gnu.org/releases/freetype/)
and choose "freetype-2.7.tar.gz" file (or a newer version if available).
To avoid long cd commands later in the command prompt, I suggest you unzip the file in the C:\ directory.
(I also renamed the folder to "ft27")
Before you build the library it's good to read these articles:
* [Using MSYS with MinGW](http://www.mingw.org/wiki/MSYS)
* [Installation and Use of Supplementary Libraries with MinGW](http://www.mingw.org/wiki/LibraryPathHOWTO)
* [Include Path](http://www.mingw.org/wiki/IncludePathHOWTO)
Inside the unzipped folder there is another folder named "docs". Open it and read the INSTALL.UNIX (using notepad).
Pay attention to paragraph 3 (Build and Install the Library). So, let's begin the installation.
To give the appropriate commands we will use the MSYS command prompt (not cmd.exe of windows) which is UNIX like.
Follow the path C:\MinGW\msys\1.0 and double click "msys.bat". The command prompt environment appears.
Enter "ft27" directory using the cd commands:
```
cd /c
cd ft27
```
and then type one by one the commands:
```
./configure --prefix=/mingw
make
make install
```
Once you're finished, go inside "C:\MinGW\include" and there should be a new folder named "freetype2".
That, hopefully, means that you have installed the library correctly !!
#### STEP 3: Build fontconvert.c
Before proceeding I suggest you make a copy of Adafruit_GFX_library folder in C:\ directory.
Then, inside "fontconvert" folder open the "makefile" with an editor ( I used notepad++).
Change the commands so in the end the program looks like :
```
all: fontconvert
CC = gcc
CFLAGS = -Wall -I c:/mingw/include/freetype2
LIBS = -lfreetype
fontconvert: fontconvert.c
$(CC) $(CFLAGS) $< $(LIBS) -o $@
clean:
rm -f fontconvert
```
Go back in the command prompt and with a cd command enter the fontconvert directory.
```
cd /c/adafruit_gfx_library\fontconvert
```
Give the command:
```
make
```
This command will, eventually, create a "fontconvert.exe" file inside fontconvert directory.
#### STEP 4: Create your own font header files
Now that you have an executable file, you can use it to create your own fonts to work with Adafruit GFX lib.
So, if we suppose that you already have a .ttf file with your favorite fonts, jump to the command prompt and type:
```
./fontconvert yourfonts.ttf 9 > yourfonts9pt7b.h
```
You can read more details at: [learn.adafruit](https://learn.adafruit.com/adafruit-gfx-graphics-library/using-fonts).
Taraaaaaammm !! you've just created your new font header file. Put it inside the "Fonts" folder, grab a cup of coffee
and start playing with your Arduino (or whatever else ....)+ display module project.
|
train_000.parquet/908
|
{
"file_path": "esp32/examples/color_code/components/lcd/Adafruit-GFX-Library/fontconvert/fontconvert_win.md",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 3743,
"token_count": 1186
}
|
/**
* @file lv_conf.h
* Configuration file for v7.3.1
*/
/*
* COPY THIS FILE AS `lv_conf.h` NEXT TO the `lvgl` FOLDER
*/
#if 0 /*Set it to "1" to enable content*/
#ifndef LV_CONF_H
#define LV_CONF_H
/* clang-format off */
#include <stdint.h>
/*====================
Graphical settings
*====================*/
/* Maximal horizontal and vertical resolution to support by the library.*/
#define LV_HOR_RES_MAX (480)
#define LV_VER_RES_MAX (320)
/* Color depth:
* - 1: 1 byte per pixel
* - 8: RGB332
* - 16: RGB565
* - 32: ARGB8888
*/
#define LV_COLOR_DEPTH 16
/* Swap the 2 bytes of RGB565 color.
* Useful if the display has a 8 bit interface (e.g. SPI)*/
#define LV_COLOR_16_SWAP 0
/* 1: Enable screen transparency.
* Useful for OSD or other overlapping GUIs.
* Requires `LV_COLOR_DEPTH = 32` colors and the screen's style should be modified: `style.body.opa = ...`*/
#define LV_COLOR_SCREEN_TRANSP 0
/*Images pixels with this color will not be drawn (with chroma keying)*/
#define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/
/* Enable anti-aliasing (lines, and radiuses will be smoothed) */
#define LV_ANTIALIAS 1
/* Default display refresh period.
* Can be changed in the display driver (`lv_disp_drv_t`).*/
#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/
/* Dot Per Inch: used to initialize default sizes.
* E.g. a button with width = LV_DPI / 2 -> half inch wide
* (Not so important, you can adjust it to modify default sizes and spaces)*/
#define LV_DPI 130 /*[px]*/
/* The the real width of the display changes some default values:
* default object sizes, layout of examples, etc.
* According to the width of the display (hor. res. / dpi)
* the displays fall in 4 categories.
* The 4th is extra large which has no upper limit so not listed here
* The upper limit of the categories are set below in 0.1 inch unit.
*/
#define LV_DISP_SMALL_LIMIT 30
#define LV_DISP_MEDIUM_LIMIT 50
#define LV_DISP_LARGE_LIMIT 70
/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */
typedef int16_t lv_coord_t;
/*=========================
Memory manager settings
*=========================*/
/* LittelvGL's internal memory manager's settings.
* The graphical objects and other related data are stored here. */
/* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc` and `lv_mem_free` */
#define LV_MEM_CUSTOM 0
#if LV_MEM_CUSTOM == 0
/* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/
# define LV_MEM_SIZE (32U * 1024U)
/* Complier prefix for a big array declaration */
# define LV_MEM_ATTR
/* Set an address for the memory pool instead of allocating it as an array.
* Can be in external SRAM too. */
# define LV_MEM_ADR 0
/* Automatically defrag. on free. Defrag. means joining the adjacent free cells. */
# define LV_MEM_AUTO_DEFRAG 1
#else /*LV_MEM_CUSTOM*/
# define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
# define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/
# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
#endif /*LV_MEM_CUSTOM*/
/* Use the standard memcpy and memset instead of LVGL's own functions.
* The standard functions might or might not be faster depending on their implementation. */
#define LV_MEMCPY_MEMSET_STD 0
/* Garbage Collector settings
* Used if lvgl is binded to higher level language and the memory is managed by that language */
#define LV_ENABLE_GC 0
#if LV_ENABLE_GC != 0
# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/
# define LV_MEM_CUSTOM_REALLOC your_realloc /*Wrapper to realloc*/
# define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_get_size*/
#endif /* LV_ENABLE_GC */
/*=======================
Input device settings
*=======================*/
/* Input device default settings.
* Can be changed in the Input device driver (`lv_indev_drv_t`)*/
/* Input device read period in milliseconds */
#define LV_INDEV_DEF_READ_PERIOD 30
/* Drag threshold in pixels */
#define LV_INDEV_DEF_DRAG_LIMIT 10
/* Drag throw slow-down in [%]. Greater value -> faster slow-down */
#define LV_INDEV_DEF_DRAG_THROW 10
/* Long press time in milliseconds.
* Time to send `LV_EVENT_LONG_PRESSSED`) */
#define LV_INDEV_DEF_LONG_PRESS_TIME 400
/* Repeated trigger period in long press [ms]
* Time between `LV_EVENT_LONG_PRESSED_REPEAT */
#define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100
/* Gesture threshold in pixels */
#define LV_INDEV_DEF_GESTURE_LIMIT 50
/* Gesture min velocity at release before swipe (pixels)*/
#define LV_INDEV_DEF_GESTURE_MIN_VELOCITY 3
/*==================
* Feature usage
*==================*/
/*1: Enable the Animations */
#define LV_USE_ANIMATION 1
#if LV_USE_ANIMATION
/*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/
typedef void * lv_anim_user_data_t;
#endif
/* 1: Enable shadow drawing on rectangles*/
#define LV_USE_SHADOW 1
#if LV_USE_SHADOW
/* Allow buffering some shadow calculation
* LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer,
* where shadow size is `shadow_width + radius`
* Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/
#define LV_SHADOW_CACHE_SIZE 0
#endif
/*1: enable outline drawing on rectangles*/
#define LV_USE_OUTLINE 1
/*1: enable pattern drawing on rectangles*/
#define LV_USE_PATTERN 1
/*1: enable value string drawing on rectangles*/
#define LV_USE_VALUE_STR 1
/* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/
#define LV_USE_BLEND_MODES 1
/* 1: Use the `opa_scale` style property to set the opacity of an object and its children at once*/
#define LV_USE_OPA_SCALE 1
/* 1: Use image zoom and rotation*/
#define LV_USE_IMG_TRANSFORM 1
/* 1: Enable object groups (for keyboard/encoder navigation) */
#define LV_USE_GROUP 1
#if LV_USE_GROUP
typedef void * lv_group_user_data_t;
#endif /*LV_USE_GROUP*/
/* 1: Enable GPU interface*/
#define LV_USE_GPU 1 /*Only enables `gpu_fill_cb` and `gpu_blend_cb` in the disp. drv- */
#define LV_USE_GPU_STM32_DMA2D 0
/*If enabling LV_USE_GPU_STM32_DMA2D, LV_GPU_DMA2D_CMSIS_INCLUDE must be defined to include path of CMSIS header of target processor
e.g. "stm32f769xx.h" or "stm32f429xx.h" */
#define LV_GPU_DMA2D_CMSIS_INCLUDE
/* 1: Enable file system (might be required for images */
#define LV_USE_FILESYSTEM 1
#if LV_USE_FILESYSTEM
/*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/
typedef void * lv_fs_drv_user_data_t;
#endif
/*1: Add a `user_data` to drivers and objects*/
#define LV_USE_USER_DATA 0
/*1: Show CPU usage and FPS count in the right bottom corner*/
#define LV_USE_PERF_MONITOR 0
/*1: Use the functions and types from the older API if possible */
#define LV_USE_API_EXTENSION_V6 1
#define LV_USE_API_EXTENSION_V7 1
/*========================
* Image decoder and cache
*========================*/
/* 1: Enable indexed (palette) images */
#define LV_IMG_CF_INDEXED 1
/* 1: Enable alpha indexed images */
#define LV_IMG_CF_ALPHA 1
/* Default image cache size. Image caching keeps the images opened.
* If only the built-in image formats are used there is no real advantage of caching.
* (I.e. no new image decoder is added)
* With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
* However the opened images might consume additional RAM.
* LV_IMG_CACHE_DEF_SIZE must be >= 1 */
#define LV_IMG_CACHE_DEF_SIZE 1
/*Declare the type of the user data of image decoder (can be e.g. `void *`, `int`, `struct`)*/
typedef void * lv_img_decoder_user_data_t;
/*=====================
* Compiler settings
*====================*/
/* For big endian systems set to 1 */
#define LV_BIG_ENDIAN_SYSTEM 0
/* Define a custom attribute to `lv_tick_inc` function */
#define LV_ATTRIBUTE_TICK_INC
/* Define a custom attribute to `lv_task_handler` function */
#define LV_ATTRIBUTE_TASK_HANDLER
/* Define a custom attribute to `lv_disp_flush_ready` function */
#define LV_ATTRIBUTE_FLUSH_READY
/* With size optimization (-Os) the compiler might not align data to
* 4 or 8 byte boundary. This alignment will be explicitly applied where needed.
* E.g. __attribute__((aligned(4))) */
#define LV_ATTRIBUTE_MEM_ALIGN
/* Attribute to mark large constant arrays for example
* font's bitmaps */
#define LV_ATTRIBUTE_LARGE_CONST
/* Prefix performance critical functions to place them into a faster memory (e.g RAM)
* Uses 15-20 kB extra memory */
#define LV_ATTRIBUTE_FAST_MEM
/* Export integer constant to binding.
* This macro is used with constants in the form of LV_<CONST> that
* should also appear on lvgl binding API such as Micropython
*
* The default value just prevents a GCC warning.
*/
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning
/* Prefix variables that are used in GPU accelerated operations, often these need to be
* placed in RAM sections that are DMA accessible */
#define LV_ATTRIBUTE_DMA
/*===================
* HAL settings
*==================*/
/* 1: use a custom tick source.
* It removes the need to manually update the tick with `lv_tick_inc`) */
#define LV_TICK_CUSTOM 0
#if LV_TICK_CUSTOM == 1
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
#endif /*LV_TICK_CUSTOM*/
typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/
typedef void * lv_indev_drv_user_data_t; /*Type of user data in the input device driver*/
/*================
* Log settings
*===============*/
/*1: Enable the log module*/
#define LV_USE_LOG 0
#if LV_USE_LOG
/* How important log should be added:
* LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
* LV_LOG_LEVEL_INFO Log important events
* LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
* LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
* LV_LOG_LEVEL_NONE Do not log anything
*/
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
/* 1: Print the log with 'printf';
* 0: user need to register a callback with `lv_log_register_print_cb`*/
# define LV_LOG_PRINTF 0
#endif /*LV_USE_LOG*/
/*=================
* Debug settings
*================*/
/* If Debug is enabled LittelvGL validates the parameters of the functions.
* If an invalid parameter is found an error log message is printed and
* the MCU halts at the error. (`LV_USE_LOG` should be enabled)
* If you are debugging the MCU you can pause
* the debugger to see exactly where the issue is.
*
* The behavior of asserts can be overwritten by redefining them here.
* E.g. #define LV_ASSERT_MEM(p) <my_assert_code>
*/
#define LV_USE_DEBUG 1
#if LV_USE_DEBUG
/*Check if the parameter is NULL. (Quite fast) */
#define LV_USE_ASSERT_NULL 1
/*Checks is the memory is successfully allocated or no. (Quite fast)*/
#define LV_USE_ASSERT_MEM 1
/*Check the integrity of `lv_mem` after critical operations. (Slow)*/
#define LV_USE_ASSERT_MEM_INTEGRITY 0
/* Check the strings.
* Search for NULL, very long strings, invalid characters, and unnatural repetitions. (Slow)
* If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */
#define LV_USE_ASSERT_STR 0
/* Check NULL, the object's type and existence (e.g. not deleted). (Quite slow)
* If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */
#define LV_USE_ASSERT_OBJ 0
/*Check if the styles are properly initialized. (Fast)*/
#define LV_USE_ASSERT_STYLE 0
#endif /*LV_USE_DEBUG*/
/*==================
* FONT USAGE
*===================*/
/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
* The symbols are available via `LV_SYMBOL_...` defines
* More info about fonts: https://docs.lvgl.io/v7/en/html/overview/font.html
* To create a new font go to: https://lvgl.com/ttf-font-to-c-array
*/
/* Montserrat fonts with bpp = 4
* https://fonts.google.com/specimen/Montserrat */
#define LV_FONT_MONTSERRAT_12 0
#define LV_FONT_MONTSERRAT_14 1
#define LV_FONT_MONTSERRAT_16 0
#define LV_FONT_MONTSERRAT_18 0
#define LV_FONT_MONTSERRAT_20 0
#define LV_FONT_MONTSERRAT_22 0
#define LV_FONT_MONTSERRAT_24 0
#define LV_FONT_MONTSERRAT_26 0
#define LV_FONT_MONTSERRAT_28 0
#define LV_FONT_MONTSERRAT_30 0
#define LV_FONT_MONTSERRAT_32 0
#define LV_FONT_MONTSERRAT_34 0
#define LV_FONT_MONTSERRAT_36 0
#define LV_FONT_MONTSERRAT_38 0
#define LV_FONT_MONTSERRAT_40 0
#define LV_FONT_MONTSERRAT_42 0
#define LV_FONT_MONTSERRAT_44 0
#define LV_FONT_MONTSERRAT_46 0
#define LV_FONT_MONTSERRAT_48 0
/* Demonstrate special features */
#define LV_FONT_MONTSERRAT_12_SUBPX 0
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, PErisan letters and all their forms*/
#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/
/*Pixel perfect monospace font
* http://pelulamu.net/unscii/ */
#define LV_FONT_UNSCII_8 0
/* Optionally declare your custom fonts here.
* You can use these fonts as default font too
* and they will be available globally. E.g.
* #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \
* LV_FONT_DECLARE(my_font_2)
*/
#define LV_FONT_CUSTOM_DECLARE
/* Enable it if you have fonts with a lot of characters.
* The limit depends on the font size, font face and bpp
* but with > 10,000 characters if you see issues probably you need to enable it.*/
#define LV_FONT_FMT_TXT_LARGE 0
/* Enables/disables support for compressed fonts. If it's disabled, compressed
* glyphs cannot be processed by the library and won't be rendered.
*/
#define LV_USE_FONT_COMPRESSED 1
/* Enable subpixel rendering */
#define LV_USE_FONT_SUBPX 1
#if LV_USE_FONT_SUBPX
/* Set the pixel order of the display.
* Important only if "subpx fonts" are used.
* With "normal" font it doesn't matter.
*/
#define LV_FONT_SUBPX_BGR 0
#endif
/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
typedef void * lv_font_user_data_t;
/*================
* THEME USAGE
*================*/
/*Always enable at least on theme*/
/* No theme, you can apply your styles as you need
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
#define LV_USE_THEME_EMPTY 1
/*Simple to the create your theme based on it
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
#define LV_USE_THEME_TEMPLATE 1
/* A fast and impressive theme.
* Flags:
* LV_THEME_MATERIAL_FLAG_LIGHT: light theme
* LV_THEME_MATERIAL_FLAG_DARK: dark theme
* LV_THEME_MATERIAL_FLAG_NO_TRANSITION: disable transitions (state change animations)
* LV_THEME_MATERIAL_FLAG_NO_FOCUS: disable indication of focused state)
* */
#define LV_USE_THEME_MATERIAL 1
/* Mono-color theme for monochrome displays.
* If LV_THEME_DEFAULT_COLOR_PRIMARY is LV_COLOR_BLACK the
* texts and borders will be black and the background will be
* white. Else the colors are inverted.
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
#define LV_USE_THEME_MONO 1
#define LV_THEME_DEFAULT_INCLUDE <stdint.h> /*Include a header for the init. function*/
#define LV_THEME_DEFAULT_INIT lv_theme_material_init
#define LV_THEME_DEFAULT_COLOR_PRIMARY lv_color_hex(0x01a2b1)
#define LV_THEME_DEFAULT_COLOR_SECONDARY lv_color_hex(0x44d1b6)
#define LV_THEME_DEFAULT_FLAG LV_THEME_MATERIAL_FLAG_LIGHT
#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_14
#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_14
#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_14
#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_14
/*=================
* Text settings
*=================*/
/* Select a character encoding for strings.
* Your IDE or editor should have the same character encoding
* - LV_TXT_ENC_UTF8
* - LV_TXT_ENC_ASCII
* */
#define LV_TXT_ENC LV_TXT_ENC_UTF8
/*Can break (wrap) texts on these chars*/
#define LV_TXT_BREAK_CHARS " ,.;:-_"
/* If a word is at least this long, will break wherever "prettiest"
* To disable, set to a value <= 0 */
#define LV_TXT_LINE_BREAK_LONG_LEN 0
/* Minimum number of characters in a long word to put on a line before a break.
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3
/* Minimum number of characters in a long word to put on a line after a break.
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
/* The control character to use for signalling text recoloring. */
#define LV_TXT_COLOR_CMD "#"
/* Support bidirectional texts.
* Allows mixing Left-to-Right and Right-to-Left texts.
* The direction will be processed according to the Unicode Bidirectioanl Algorithm:
* https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
#define LV_USE_BIDI 0
#if LV_USE_BIDI
/* Set the default direction. Supported values:
* `LV_BIDI_DIR_LTR` Left-to-Right
* `LV_BIDI_DIR_RTL` Right-to-Left
* `LV_BIDI_DIR_AUTO` detect texts base direction */
#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO
#endif
/* Enable Arabic/Persian processing
* In these languages characters should be replaced with
* an other form based on their position in the text */
#define LV_USE_ARABIC_PERSIAN_CHARS 0
/*Change the built in (v)snprintf functions*/
#define LV_SPRINTF_CUSTOM 0
#if LV_SPRINTF_CUSTOM
# define LV_SPRINTF_INCLUDE <stdio.h>
# define lv_snprintf snprintf
# define lv_vsnprintf vsnprintf
#else /*!LV_SPRINTF_CUSTOM*/
# define LV_SPRINTF_DISABLE_FLOAT 1
#endif /*LV_SPRINTF_CUSTOM*/
/*===================
* LV_OBJ SETTINGS
*==================*/
#if LV_USE_USER_DATA
/*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/
typedef void * lv_obj_user_data_t;
/*Provide a function to free user data*/
#define LV_USE_USER_DATA_FREE 0
#if LV_USE_USER_DATA_FREE
# define LV_USER_DATA_FREE_INCLUDE "something.h" /*Header for user data free function*/
/* Function prototype : void user_data_free(lv_obj_t * obj); */
# define LV_USER_DATA_FREE (user_data_free) /*Invoking for user data free function*/
#endif
#endif
/*1: enable `lv_obj_realign()` based on `lv_obj_align()` parameters*/
#define LV_USE_OBJ_REALIGN 1
/* Enable to make the object clickable on a larger area.
* LV_EXT_CLICK_AREA_OFF or 0: Disable this feature
* LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px)
* LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px)
*/
#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_TINY
/*==================
* LV OBJ X USAGE
*================*/
/*
* Documentation of the object types: https://docs.lvgl.com/#Object-types
*/
/*Arc (dependencies: -)*/
#define LV_USE_ARC 1
/*Bar (dependencies: -)*/
#define LV_USE_BAR 1
/*Button (dependencies: lv_cont*/
#define LV_USE_BTN 1
/*Button matrix (dependencies: -)*/
#define LV_USE_BTNMATRIX 1
/*Calendar (dependencies: -)*/
#define LV_USE_CALENDAR 1
#if LV_USE_CALENDAR
# define LV_CALENDAR_WEEK_STARTS_MONDAY 0
#endif
/*Canvas (dependencies: lv_img)*/
#define LV_USE_CANVAS 1
/*Check box (dependencies: lv_btn, lv_label)*/
#define LV_USE_CHECKBOX 1
/*Chart (dependencies: -)*/
#define LV_USE_CHART 1
#if LV_USE_CHART
# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 256
#endif
/*Container (dependencies: -*/
#define LV_USE_CONT 1
/*Color picker (dependencies: -*/
#define LV_USE_CPICKER 1
/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/
#define LV_USE_DROPDOWN 1
#if LV_USE_DROPDOWN != 0
/*Open and close default animation time [ms] (0: no animation)*/
# define LV_DROPDOWN_DEF_ANIM_TIME 200
#endif
/*Gauge (dependencies:lv_bar, lv_linemeter)*/
#define LV_USE_GAUGE 1
/*Image (dependencies: lv_label*/
#define LV_USE_IMG 1
/*Image Button (dependencies: lv_btn*/
#define LV_USE_IMGBTN 1
#if LV_USE_IMGBTN
/*1: The imgbtn requires left, mid and right parts and the width can be set freely*/
# define LV_IMGBTN_TILED 0
#endif
/*Keyboard (dependencies: lv_btnm)*/
#define LV_USE_KEYBOARD 1
/*Label (dependencies: -*/
#define LV_USE_LABEL 1
#if LV_USE_LABEL != 0
/*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_ROLL/ROLL_CIRC' mode*/
# define LV_LABEL_DEF_SCROLL_SPEED 25
/* Waiting period at beginning/end of animation cycle */
# define LV_LABEL_WAIT_CHAR_COUNT 3
/*Enable selecting text of the label */
# define LV_LABEL_TEXT_SEL 0
/*Store extra some info in labels (12 bytes) to speed up drawing of very long texts*/
# define LV_LABEL_LONG_TXT_HINT 0
#endif
/*LED (dependencies: -)*/
#define LV_USE_LED 1
#if LV_USE_LED
# define LV_LED_BRIGHT_MIN 120 /*Minimal brightness*/
# define LV_LED_BRIGHT_MAX 255 /*Maximal brightness*/
#endif
/*Line (dependencies: -*/
#define LV_USE_LINE 1
/*List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for icons ))*/
#define LV_USE_LIST 1
#if LV_USE_LIST != 0
/*Default animation time of focusing to a list element [ms] (0: no animation) */
# define LV_LIST_DEF_ANIM_TIME 100
#endif
/*Line meter (dependencies: *;)*/
#define LV_USE_LINEMETER 1
#if LV_USE_LINEMETER
/* Draw line more precisely at cost of performance.
* Useful if there are lot of lines any minor are visible
* 0: No extra precision
* 1: Some extra precision
* 2: Best precision
*/
# define LV_LINEMETER_PRECISE 0
#endif
/*Mask (dependencies: -)*/
#define LV_USE_OBJMASK 1
/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/
#define LV_USE_MSGBOX 1
/*Page (dependencies: lv_cont)*/
#define LV_USE_PAGE 1
#if LV_USE_PAGE != 0
/*Focus default animation time [ms] (0: no animation)*/
# define LV_PAGE_DEF_ANIM_TIME 400
#endif
/*Preload (dependencies: lv_arc, lv_anim)*/
#define LV_USE_SPINNER 1
#if LV_USE_SPINNER != 0
# define LV_SPINNER_DEF_ARC_LENGTH 60 /*[deg]*/
# define LV_SPINNER_DEF_SPIN_TIME 1000 /*[ms]*/
# define LV_SPINNER_DEF_ANIM LV_SPINNER_TYPE_SPINNING_ARC
#endif
/*Roller (dependencies: lv_ddlist)*/
#define LV_USE_ROLLER 1
#if LV_USE_ROLLER != 0
/*Focus animation time [ms] (0: no animation)*/
# define LV_ROLLER_DEF_ANIM_TIME 200
/*Number of extra "pages" when the roller is infinite*/
# define LV_ROLLER_INF_PAGES 7
#endif
/*Slider (dependencies: lv_bar)*/
#define LV_USE_SLIDER 1
/*Spinbox (dependencies: lv_ta)*/
#define LV_USE_SPINBOX 1
/*Switch (dependencies: lv_slider)*/
#define LV_USE_SWITCH 1
/*Text area (dependencies: lv_label, lv_page)*/
#define LV_USE_TEXTAREA 1
#if LV_USE_TEXTAREA != 0
# define LV_TEXTAREA_DEF_CURSOR_BLINK_TIME 400 /*ms*/
# define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/
#endif
/*Table (dependencies: lv_label)*/
#define LV_USE_TABLE 1
#if LV_USE_TABLE
# define LV_TABLE_COL_MAX 12
#endif
/*Tab (dependencies: lv_page, lv_btnm)*/
#define LV_USE_TABVIEW 1
# if LV_USE_TABVIEW != 0
/*Time of slide animation [ms] (0: no animation)*/
# define LV_TABVIEW_DEF_ANIM_TIME 300
#endif
/*Tileview (dependencies: lv_page) */
#define LV_USE_TILEVIEW 1
#if LV_USE_TILEVIEW
/*Time of slide animation [ms] (0: no animation)*/
# define LV_TILEVIEW_DEF_ANIM_TIME 300
#endif
/*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/
#define LV_USE_WIN 1
/*==================
* Non-user section
*==================*/
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/
# define _CRT_SECURE_NO_WARNINGS
#endif
/*--END OF LV_CONF_H--*/
#endif /*LV_CONF_H*/
#endif /*End of "Content enable"*/
|
train_000.parquet/909
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/lv_conf_template.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 24356,
"token_count": 9381
}
|
# Changelog
## v7.4.0 (planned on 01.09.2020)
*Available in the `dev` branch*
## v7.3.1 (18.08.2020)
### Bugfixes
- Fix drawing value string twice
- Rename `lv_chart_clear_serie` to `lv_chart_clear_series` and `lv_obj_align_origo` to `lv_obj_align_mid`
- Add linemeter's mirror feature again
- Fix text decor (udnerline strikethrough) with older versions of font converter
- Fix setting local style property multiple times
- Add missing background drawing and radius handling to image button
- Allow adding extra label to list buttons
- Fix crash if `lv_table_set_col_cnt` is called before `lv_table_set_row_cnt` for the first time
- Fix overflow in large image transformations
- Limit extra button click area of button matrix's buttons. With large paddings it was counter intuitive. (Gaps are mapped to button when clicked).
- Fix color picker invalidation in rectangle mode
- Init disabled days to gray color in calendar
## v7.3.0 (04.08.2020)
### New features
- Add `lv_task_get_next`
- Add `lv_event_send_refresh`, `lv_event_send_refresh_recursive` to easily send `LV_EVENT_REFRESH` to object
- Add `lv_tabview_set_tab_name()` function - used to change a tab's name
- Add `LV_THEME_MATERIAL_FLAG_NO_TRANSITION` and `LV_THEME_MATERIAL_FLAG_NO_FOCUS` flags
- Reduce code size by adding: `LV_USE_FONT_COMPRESSED`, `LV_FONT_USE_SUBPX`, `LV_USE_OUTLINE`, `LV_USE_PATTERN`, `LV_USE_VALUE_STR` and applying some optimization
- Add `LV_MEMCPY_MEMSET_STD` to use standard `memcpy` and `memset`
### Bugfixes
- Do not print warning for missing glyph if its height OR width is zero.
- Prevent duplicated sending of `LV_EVENT_INSERT` from text area
- Tidy outer edges of cpicker widget.
- Remove duplicated lines from `lv_tabview_add_tab`
- btnmatrix: hadle combined states of buttons (e.g. chacked + disabled)
- textarea: fix typo in lv_textarea_set_sscrollbar_mode
- gauge: fix image needle drawing
- fix using freed memory in _lv_style_list_remove_style
## v7.2.0 (21.07.2020)
### New features
- Add screen transitions with `lv_scr_load_anim()`
- Add display background color, wallpaper and opacity. Shown when the screen is transparent. Can be used with `lv_disp_set_bg_opa/color/image()`.
- Add `LV_CALENDAR_WEEK_STARTS_MONDAY`
- Add `lv_chart_set_x_start_point()` function - Set the index of the x-axis start point in the data array
- Add `lv_chart_set_ext_array()` function - Set an external array of data points to use for the chart
- Add `lv_chart_set_point_id()` function - Set an individual point value in the chart series directly based on index
- Add `lv_chart_get_x_start_point()` function - Get the current index of the x-axis start point in the data array
- Add `lv_chart_get_point_id()` function - Get an individual point value in the chart series directly based on index
- Add `ext_buf_assigned` bit field to `lv_chart_series_t` structure - it's true if external buffer is assigned to series
- Add `lv_chart_set_series_axis()` to assign series to primary or secondary axis
- Add `lv_chart_set_y_range()` to allow setting range of secondary y axis (based on `lv_chart_set_range` but extended with an axis parameter)
- Allow setting different font for the selected text in `lv_roller`
- Add `theme->apply_cb` to replace `theme->apply_xcb` to make it compatible with the MicroPython binding
- Add `lv_theme_set_base()` to allow easy extension of built-in (or any) themes
- Add `lv_obj_align_x()` and `lv_obj_align_y()` functions
- Add `lv_obj_align_origo_x()` and `lv_obj_align_origo_y()` functions
### Bugfixes
- `tileview` fix navigation when not screen sized
- Use 14px font by default to for better compatibility with smaller displays
- `linemeter` fix conversation of current value to "level"
- Fix drawing on right border
- Set the cursor image non clickable by default
- Improve mono theme when used with keyboard or encoder
## v7.1.0 (07.07.2020)
### New features
- Add `focus_parent` attribute to `lv_obj`
- Allow using buttons in encoder input device
- Add lv_btnmatrix_set/get_align capability
- DMA2D: Remove dependency on ST CubeMX HAL
- Added `max_used` propriety to `lv_mem_monitor_t` struct
- In `lv_init` test if the the strings are UTF-8 encoded.
- Add `user_data` to themes
- Add LV_BIG_ENDIAN_SYSTEM flag to lv_conf.h in order to fix displaying images on big endian systems.
- Add inline function lv_checkbox_get_state(const lv_obj_t * cb) to extend the checkbox functionality.
- Add inline function lv_checkbox_set_state(const lv_obj_t * cb, lv_btn_state_t state ) to extend the checkbox functionality.
### Bugfixes
- `lv_img` fix invalidation area when angle or zoom changes
- Update the style handling to support Big endian MCUs
- Change some methods to support big endian hardware.
- remove use of c++ keyword 'new' in parameter of function lv_theme_set_base().
- Add LV_BIG_ENDIAN_SYSTEM flag to lv_conf.h in order to fix displaying images on big endian systems.
- Fix inserting chars in text area in big endian hardware.
## v7.0.2 (16.06.2020)
### Bugfixes
- `lv_textarea` fix wrong cursor position when clicked after the last character
- Change all text related indices from 16-bit to 32-bit integers throughout whole library. #1545
- Fix gestures
- Do not call `set_px_cb` for transparent pixel
- Fix list button focus in material theme
- Fix crash when the a text area is cleared with the backspace of a keyboard
- Add version number to `lv_conf_template.h`
- Add log in true double buffering mode with `set_px_cb`
- `lv_dropdown`: fix missing `LV_EVENT_VALUE_CHANGED` event when used with encoder
- `lv_tileview`: fix if not the {0;0} tile is created first
- `lv_debug`: restructure to allow asserting in from `lv_misc` too
- add assert if `_lv_mem_buf_get()` fails
- `lv_textarea`: fix character delete in password mode
- Update `LV_OPA_MIN` and `LV_OPA_MAX` to widen the opacity processed range
- `lv_btnm` fix sending events for hidden buttons
- `lv_gaguge` make `lv_gauge_set_angle_offset` offset the labels and needles too
- Fix typo in the API `scrllable` -> `scrollable`
- `tabview` by default allow auto expanding the page only to right and bottom (#1573)
- fix crash when drawing gradient to the same color
- chart: fix memory leak
- `img`: improve hit test for transformed images
## v7.0.1 (01.06.2020)
### Bugfixes
- Make the Microptyhon working by adding the required variables as GC_ROOT
- Prefix some internal API functions with `_` to reduce the API of LVGL
- Fix built-in SimSun CJK font
- Fix UTF-8 encoding when `LV_USE_ARABIC_PERSIAN_CHARS` is enabled
- Fix DMA2D usage when 32 bit images directly blended
- Fix lv_roller in infinite mode when used with encoder
- Add `lv_theme_get_color_secondary()`
- Add `LV_COLOR_MIX_ROUND_OFS` to adjust color mixing to make it compatible with the GPU
- Improve DMA2D blending
- Remove memcpy from `lv_ll` (caused issues with some optimization settings)
- `lv_chart` fix X tick drawing
- Fix vertical dashed line drawing
- Some additonal minor fixes and formattings
## v7.0.0 (18.05.2020)
### Documentation
The docs for v7 is available at https://docs.littlevgl.com/v7/en/html/index.html
### Legal changes
The name of the project is changed to LVGL and the new website is on https://lvgl.io
LVGL remains free under the same conditions (MIT license) and a company is created to manage LVGL and offer services.
### New drawing system
Complete rework of LVGL's draw engine to use "masks" for more advanced and higher quality graphical effects.
A possible use-case of this system is to remove the overflowing content from the rounded edges.
It also allows drawing perfectly anti-aliased circles, lines, and arcs.
Internally, the drawings happen by defining masks (such as rounded rectangle, line, angle).
When something is drawn the currently active masks can make some pixels transparent.
For example, rectangle borders are drawn by using 2 rectangle masks: one mask removes the inner part and another the outer part.
The API in this regard remained the same but some new functions were added:
- `lv_img_set_zoom`: set image object's zoom factor
- `lv_img_set_angle`: set image object's angle without using canvas
- `lv_img_set_pivot`: set the pivot point of rotation
The new drawing engine brought new drawing features too. They are highlighted in the "style" section.
### New style system
The old style system is replaced with a new more flexible and lightweighted one.
It uses an approach similar to CSS: support cascading styles, inheriting properties and local style properties per object.
As part of these updates, a lot of objects were reworked and the APIs have been changed.
- more shadows options: *offset* and *spread*
- gradient stop position to shift the gradient area and horizontal gradient
- `LV_BLEND_MODE_NORMAL/ADDITIVE/SUBTRACTIVE` blending modes
- *clip corner*: crop the content on the rounded corners
- *text underline* and *strikethrough*
- dashed vertical and horizontal lines (*dash gap*, *dash_width*)
- *outline*: a border-like part drawn out of the background. Can have spacing to the background.
- *pattern*: display and image in the middle of the background or repeat it
- *value* display a text which is stored in the style. It can be used e.g. as a lighweighted text on buttons too.
- *margin*: similar to *padding* but used to keep space outside of the object
Read the [Style](https://docs.littlevgl.com/v7/en/html/overview/style.html) section of the documentation to learn how the new styles system works.
### GPU integration
To better utilize GPUs, from this version GPU usage can be integrated into LVGL. In `lv_conf.h` any supported GPUs can be enabled with a single configuration option.
Right now, only ST's DMA2D (Chrom-ART) is integrated. More will in the upcoming releases.
### Renames
The following object types are renamed:
- sw -> switch
- ta -> textarea
- cb -> checkbox
- lmeter -> linemeter
- mbox -> msgbox
- ddlist -> dropdown
- btnm -> btnmatrix
- kb -> keyboard
- preload -> spinner
- lv_objx folder -> lv_widgets
- LV_FIT_FILL -> LV_FIT_PARENT
- LV_FIT_FLOOD -> LV_FLOOD_MAX
- LV_LAYOUT_COL_L/M/R -> LV_LAYOUT_COLUMN_LEFT/MID/RIGHT
- LV_LAYOUT_ROW_T/M/B -> LV_LAYOUT_ROW_TOP/MID/BOTTOM
### Reworked and improved object
- `dropdown`: Completely reworked. Now creates a separate list when opened and can be dropped to down/up/left/right.
- `label`: `body_draw` is removed, instead, if its style has a visible background/border/shadow etc it will be drawn. Padding really makes the object larger (not just virtually as before)
- `arc`: can draw bacground too.
- `btn`: doesn't store styles for each state because it's done naturally in the new style system.
- `calendar`: highlight the pressed datum. The used styles are changed: use `LV_CALENDAR_PART_DATE` normal for normal dates, checked for highlighted, focused for today, pressed for the being pressed. (checked+pressed, focused+pressed also work)
- `chart`: only has `LINE` and `COLUMN` types because with new styles all the others can be described. LV_CHART_PART_SERIES sets the style of the series. bg_opa > 0 draws an area in LINE mode. `LV_CHART_PART_SERIES_BG` also added to set a different style for the series area. Padding in `LV_CHART_PART_BG` makes the series area smaller, and it ensures space for axis labels/numbers.
- `linemeter`, `gauge`: can have background if the related style properties are set. Padding makes the scale/lines smaller. scale_border_width and scale_end_border_width allow to draw an arc on the outer part of the scale lines.
- `gauge`: `lv_gauge_set_needle_img` allows use image as needle
- `canvas`: allow drawing to true color alpha and alpha only canvas, add `lv_canvas_blur_hor/ver` and rename `lv_canvas_rotate` to `lv_canvas_transform`
- `textarea`: If available in the font use bullet (`U+2022`) character in text area password
### New object types
- `lv_objmask`: masks can be added to it. The children will be masked accordingly.
### Others
- Change the built-in fonts to [Montserrat](https://fonts.google.com/specimen/Montserrat) and add built-in fonts from 12 px to 48 px for every 2nd size.
- Add example CJK and Arabic/Persian/Hebrew built-in font
- Add ° and "bullet" to the built-in fonts
- Add Arabic/Persian script support: change the character according to its position in the text.
- Add `playback_time` to animations.
- Add `repeat_count` to animations instead of the current "repeat forever".
- Replace `LV_LAYOUT_PRETTY` with `LV_LAYOUT_PRETTY_TOP/MID/BOTTOM`
### Demos
- [lv_examples](https://github.com/littlevgl/lv_examples) was reworked and new examples and demos were added
### New release policy
- Maintain this Changelog for every release
- Save old major version in new branches. E.g. `release/v6`
- Merge new features and fixes directly into `master` and release a patch or minor releases every 2 weeks.
### Migrating from v6 to v7
- First and foremost, create a new `lv_conf.h` based on `lv_conf_templ.h`.
- To try the new version it suggested using a simulator project and see the examples.
- If you have a running project, the most difficult part of the migration is updating to the new style system. Unfortunately, there is no better way than manually updating to the new format.
- The other parts are mainly minor renames and refactoring as described above.
|
train_000.parquet/910
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/CHANGELOG.md",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 13282,
"token_count": 4244
}
|
<h1 align="center"> LVGL - Light and Versatile Graphics Library</h1>
<p align="center">
<img src="https://lvgl.io/assets/images/img_1.png">
</p>
<p align="center">
LVGL provides everything you need to create embedded GUI with easy-to-use graphical elements, beautiful visual effects and low memory footprint.
</p>
<h4 align="center">
<a href="https://lvgl.io">Website </a> ·
<a href="https://lvgl.io/demos">Online demo</a> ·
<a href="https://docs.lvgl.io/">Docs</a> ·
<a href="https://forum.lvgl.io">Forum</a>
</h4>
---
## Features
* Powerful [building blocks](https://docs.lvgl.io/latest/en/html/widgets/index.html): buttons, charts, lists, sliders, images, etc.
* Advanced graphics: animations, anti-aliasing, opacity, smooth scrolling
* Use [various input devices](https://docs.lvgl.io/latest/en/html/overview/indev.html): touchscreen, mouse, keyboard, encoder, buttons, etc.
* Use [multiple displays](https://docs.lvgl.io/latest/en/html/overview/display.html): e.g. monochrome and color display
* Hardware independent to use with any microcontroller or display
* Scalable to operate with little memory (64 kB Flash, 10 kB RAM)
* Multi-language support with UTF-8 handling, Bidirectional and Arabic script support
* Fully customizable graphical elements via [CSS-like styles](https://docs.lvgl.io/latest/en/html/overview/style.html)
* OS, External memory and GPU are supported but not required
* Smooth rendering even with a [single frame buffer](https://docs.lvgl.io/latest/en/html/porting/display.html)
* Written in C for maximal compatibility (C++ compatible)
* Micropython Binding exposes [LVGL API in Micropython](https://blog.lvgl.io/2019-02-20/micropython-bindings)
* [Simulator](https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html) to develop on PC without embedded hardware
* [Examples](lv_examples) and tutorials for rapid development
* [Documentation](http://docs.lvgl.io/) and API references
## Requirements
Basically, every modern controller (which is able to drive a display) is suitable to run LVGL. The minimal requirements are:
<table>
<tr>
<td> <strong>Name</strong> </td>
<td><strong>Minimal</strong></td>
<td><strong>Recommended</strong></td>
</tr>
<tr>
<td><strong>Architecture</strong></td>
<td colspan="2">16, 32 or 64 bit microcontroller or processor</td>
</tr>
<tr>
<td> <strong>Clock</strong></td>
<td> > 16 MHz </td>
<td> > 48 MHz</td>
</tr>
<tr>
<td> <strong>Flash/ROM</strong></td>
<td> > 64 kB </td>
<td> > 180 kB</td>
</tr>
<tr>
<td> <strong>Static RAM</strong></td>
<td> > 2 kB </td>
<td> > 4 kB</td>
</tr>
<tr>
<td> <strong>Stack</strong></td>
<td> > 2 kB </td>
<td> > 8 kB</td>
</tr>
<tr>
<td> <strong>Heap</strong></td>
<td> > 2 kB </td>
<td> > 8 kB</td>
</tr>
<tr>
<td> <strong>Display buffer</strong></td>
<td> > 1 × <em>hor. res.</em> pixels </td>
<td> > 10 × <em>hor. res.</em> pixels </td>
</tr>
<tr>
<td> <strong>Compiler</strong></td>
<td colspan="2"> C99 or newer </td>
</tr>
</table>
*Note that the memory usage might vary depending on the architecture, compiler and build options.*
Just to mention some platforms:
- STM32F1, STM32F3, STM32F4, STM32F7, STM32L4, STM32L5, STM32H7
- Microchip dsPIC33, PIC24, PIC32MX, PIC32MZ
- NXP: Kinetis, LPC, iMX, iMX RT
- [Linux frame buffer](https://blog.lvgl.io/2018-01-03/linux_fb) (/dev/fb)
- [Raspberry Pi](http://www.vk3erw.com/index.php/16-software/63-raspberry-pi-official-7-touchscreen-and-littlevgl)
- [Espressif ESP32](https://github.com/lvgl/lv_port_esp32)
- [Infineon Aurix](https://github.com/lvgl/lv_port_aurix)
- Nordic NRF52 Bluetooth modules
- Quectel modems
## Get started
This list shows the recommended way of learning the library:
1. Check the [Online demos](https://lvgl.io/demos) to see LVGL in action (3 minutes)
2. Read the [Introduction](https://docs.lvgl.io/latest/en/html/intro/index.html) page of the documentation (5 minutes)
3. Get familiar with the basics on the [Quick overview](https://docs.lvgl.io/latest/en/html/get-started/quick-overview.html) page (15 minutes)
4. Set up a [Simulator](https://docs.lvgl.io/latest/en/html/get-started/pc-simulator.html) (10 minutes)
5. Try out some [Examples](https://github.com/lvgl/lv_examples/)
6. Port LVGL to a board. See the [Porting](https://docs.lvgl.io/latest/en/html/porting/index.html) guide or check the ready to use [Projects](https://github.com/lvgl?q=lv_port_&type=&language=)
7. Read the [Overview](https://docs.lvgl.io/latest/en/html/overview/index.html) page to get a better understanding of the library (2-3 hours)
8. Check the documentation of the [Widgets](https://docs.lvgl.io/latest/en/html/widgets/index.html) to see their features and usage
9. If you have questions go to the [Forum](http://forum.lvgl.io/)
10. Read the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) guide to see how you can help to improve LVGL (15 minutes)
## Examples
For more examples see the [lv_examples](https://github.com/lvgl/lv_examples) repository.
### Button with label
```c
lv_obj_t * btn = lv_btn_create(lv_scr_act(), NULL); /*Add a button the current screen*/
lv_obj_set_pos(btn, 10, 10); /*Set its position*/
lv_obj_set_size(btn, 100, 50); /*Set its size*/
lv_obj_set_event_cb(btn, btn_event_cb); /*Assign a callback to the button*/
lv_obj_t * label = lv_label_create(btn, NULL); /*Add a label to the button*/
lv_label_set_text(label, "Button"); /*Set the labels text*/
...
void btn_event_cb(lv_obj_t * btn, lv_event_t event)
{
if(event == LV_EVENT_CLICKED) {
printf("Clicked\n");
}
}
```

### LVGL from Micropython
Learn more about [Micropython](https://docs.lvgl.io/latest/en/html/get-started/micropython.html).
```python
# Create a Button and a Label
scr = lv.obj()
btn = lv.btn(scr)
btn.align(lv.scr_act(), lv.ALIGN.CENTER, 0, 0)
label = lv.label(btn)
label.set_text("Button")
# Load the screen
lv.scr_load(scr)
```
## Contributing
LVGL is an open project and contribution is very welcome. There are many ways to contribute from simply speaking about your project, through writing examples, improving the documentation, fixing bugs to hosing your own project under in LVGL.
For a detailed description of contribution opportunities visit the [Contributing](https://docs.lvgl.io/latest/en/html/contributing/index.html) section of the documentation.
|
train_000.parquet/911
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/README.md",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 6739,
"token_count": 2517
}
|
/**
* @file lvgl.h
* Include all LittleV GL related headers
*/
#ifndef LVGL_H
#define LVGL_H
#ifdef __cplusplus
extern "C" {
#endif
/***************************
* CURRENT VERSION OF LVGL
***************************/
#define LVGL_VERSION_MAJOR 7
#define LVGL_VERSION_MINOR 3
#define LVGL_VERSION_PATCH 1
#define LVGL_VERSION_INFO ""
/*********************
* INCLUDES
*********************/
#include "src/lv_misc/lv_log.h"
#include "src/lv_misc/lv_task.h"
#include "src/lv_misc/lv_math.h"
#include "src/lv_misc/lv_async.h"
#include "src/lv_hal/lv_hal.h"
#include "src/lv_core/lv_obj.h"
#include "src/lv_core/lv_group.h"
#include "src/lv_core/lv_indev.h"
#include "src/lv_core/lv_refr.h"
#include "src/lv_core/lv_disp.h"
#include "src/lv_themes/lv_theme.h"
#include "src/lv_font/lv_font.h"
#include "src/lv_font/lv_font_fmt_txt.h"
#include "src/lv_misc/lv_printf.h"
#include "src/lv_widgets/lv_btn.h"
#include "src/lv_widgets/lv_imgbtn.h"
#include "src/lv_widgets/lv_img.h"
#include "src/lv_widgets/lv_label.h"
#include "src/lv_widgets/lv_line.h"
#include "src/lv_widgets/lv_page.h"
#include "src/lv_widgets/lv_cont.h"
#include "src/lv_widgets/lv_list.h"
#include "src/lv_widgets/lv_chart.h"
#include "src/lv_widgets/lv_table.h"
#include "src/lv_widgets/lv_checkbox.h"
#include "src/lv_widgets/lv_cpicker.h"
#include "src/lv_widgets/lv_bar.h"
#include "src/lv_widgets/lv_slider.h"
#include "src/lv_widgets/lv_led.h"
#include "src/lv_widgets/lv_btnmatrix.h"
#include "src/lv_widgets/lv_keyboard.h"
#include "src/lv_widgets/lv_dropdown.h"
#include "src/lv_widgets/lv_roller.h"
#include "src/lv_widgets/lv_textarea.h"
#include "src/lv_widgets/lv_canvas.h"
#include "src/lv_widgets/lv_win.h"
#include "src/lv_widgets/lv_tabview.h"
#include "src/lv_widgets/lv_tileview.h"
#include "src/lv_widgets/lv_msgbox.h"
#include "src/lv_widgets/lv_objmask.h"
#include "src/lv_widgets/lv_gauge.h"
#include "src/lv_widgets/lv_linemeter.h"
#include "src/lv_widgets/lv_switch.h"
#include "src/lv_widgets/lv_arc.h"
#include "src/lv_widgets/lv_spinner.h"
#include "src/lv_widgets/lv_calendar.h"
#include "src/lv_widgets/lv_spinbox.h"
#include "src/lv_draw/lv_img_cache.h"
#include "src/lv_api_map.h"
/**********************
* MACROS
**********************/
/** Gives 1 if the x.y.z version is supported in the current version
* Usage:
*
* - Require v6
* #if LV_VERSION_CHECK(6,0,0)
* new_func_in_v6();
* #endif
*
*
* - Require at least v5.3
* #if LV_VERSION_CHECK(5,3,0)
* new_feature_from_v5_3();
* #endif
*
*
* - Require v5.3.2 bugfixes
* #if LV_VERSION_CHECK(5,3,2)
* bugfix_in_v5_3_2();
* #endif
*
* */
#define LV_VERSION_CHECK(x,y,z) (x == LVGL_VERSION_MAJOR && (y < LVGL_VERSION_MINOR || (y == LVGL_VERSION_MINOR && z <= LVGL_VERSION_PATCH)))
#ifdef __cplusplus
}
#endif
#endif /*LVGL_H*/
|
train_000.parquet/912
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/lvgl.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 2842,
"token_count": 1340
}
|
--style=kr
--indent=spaces=4
--indent-classes
--indent-switches
--indent-cases
--indent-preproc-block
--indent-preproc-define
--indent-col1-comments
--pad-oper
--unpad-paren
--align-pointer=middle
--align-reference=middle
--convert-tabs
--max-code-length=120
--break-after-logical
--break-closing-braces
--attach-closing-while
--min-conditional-indent=0
--max-continuation-indent=120
--mode=c
--lineend=linux
--recursive
--suffix=none
--preserve-date
--formatted
--exclude=lv_conf_internal.h
--exclude=../src/lv_font/lv_font_montserrat_12.c
--exclude=../src/lv_font/lv_font_montserrat_14.c
--exclude=../src/lv_font/lv_font_montserrat_16.c
--exclude=../src/lv_font/lv_font_montserrat_18.c
--exclude=../src/lv_font/lv_font_montserrat_20.c
--exclude=../src/lv_font/lv_font_montserrat_22.c
--exclude=../src/lv_font/lv_font_montserrat_24.c
--exclude=../src/lv_font/lv_font_montserrat_26.c
--exclude=../src/lv_font/lv_font_montserrat_28.c
--exclude=../src/lv_font/lv_font_montserrat_30.c
--exclude=../src/lv_font/lv_font_montserrat_32.c
--exclude=../src/lv_font/lv_font_montserrat_34.c
--exclude=../src/lv_font/lv_font_montserrat_36.c
--exclude=../src/lv_font/lv_font_montserrat_38.c
--exclude=../src/lv_font/lv_font_montserrat_40.c
--exclude=../src/lv_font/lv_font_montserrat_42.c
--exclude=../src/lv_font/lv_font_montserrat_44.c
--exclude=../src/lv_font/lv_font_montserrat_46.c
--exclude=../src/lv_font/lv_font_montserrat_48.c
--exclude=../src/lv_font/lv_font_montserrat_12_subpx.c
--exclude=../src/lv_font/lv_font_montserrat_28_compressed.c
--exclude=../src/lv_font/lv_font_simsun_16_cjk.c
--exclude=../src/lv_font/lv_font_dejavu_16_persian_hebrew.c
|
train_000.parquet/913
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/scripts/code-format.cfg",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 1649,
"token_count": 791
}
|
#!/usr/bin/env python3
'''
Generates a checker file for lv_conf.h from lv_conf_templ.h define all the not defined values
'''
import sys
import re
if sys.version_info < (3,6,0):
print("Python >=3.6 is required", file=sys.stderr)
exit(1)
fin = open("../lv_conf_template.h", "r")
fout = open("../src/lv_conf_internal.h", "w")
fout.write(
'''/**
* GENERATED FILE, DO NOT EDIT IT!
* @file lv_conf_internal.h
* Make sure all the defines of lv_conf.h have a default value
**/
#ifndef LV_CONF_INTERNAL_H
#define LV_CONF_INTERNAL_H
/* clang-format off */
#include <stdint.h>
#if defined(LV_CONF_PATH)
#define __LV_TO_STR_AUX(x) #x
#define __LV_TO_STR(x) __LV_TO_STR_AUX(x)
#include __LV_TO_STR(LV_CONF_PATH)
#undef __LV_TO_STR_AUX
#undef __LV_TO_STR
#elif defined(LV_CONF_INCLUDE_SIMPLE)
#include "lv_conf.h"
#else
#include "../../lv_conf.h"
#endif
'''
)
started = 0
for i in fin.read().splitlines():
if not started:
if '#define LV_CONF_H' in i:
started = 1
continue
else:
continue
if '/*--END OF LV_CONF_H--*/' in i: break
r = re.search(r'^ *# *define ([^\s]+).*$', i)
if r:
line = re.sub('\(.*?\)', '', r[1], 1) #remove parentheses from macros
fout.write(
f'#ifndef {line}\n'
f'{i}\n'
'#endif\n'
)
elif re.search('^ *typedef .*;.*$', i):
continue #ignore typedefs to avoide redeclaration
else:
fout.write(f'{i}\n')
fout.write(
'''
#endif /*LV_CONF_CHECKER_H*/
'''
)
fin.close()
fout.close()
|
train_000.parquet/914
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/scripts/lv_conf_checker.py",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 1494,
"token_count": 694
}
|
#!/usr/bin/env python
# Release lvgl, lv_examples, lv_drivers. docs, blog and prepare the development of the next major, minoror bugfix release
# Usage: ./release,py bugfix | minor | major
# The option means what type of versin to prepare for development after release
#
# STEPS:
# - clone all 5 repos
# - get the version numnber from lvgl.h
# - set release branch (e.g. "release/v7")
# - prepare lvgl
# - run lv_conf_internal.py
# - run code formatter
# - clear LVGL_VERSION_INFO (set to "")
# - run Doxygen
# - update the version in lvgl's library.json, library.properties, lv_conf_template.h
# - update CHANGELOG.md
# - commit changes
# - prepare lv_examples
# - upadte the required LVGL version in lv_examples.h (LV_VERSION_CHECK)
# - update the version in lv_ex_conf_template.h
# - prepare lv_drivers
# - update the version in library.json, lv_drv_conf_template.h
# - prepare docs
# - update API XML
# - clear the versiopn info (should be plain vx.y.z)
# - tag all repos with the new version
# - merge to release branches
# - blog: add release post
# - push tags and commits
# - docs: run ./updade.py release/vX
#
# If --patch
# - merge master to dev branches
# - increment patch version by 1 and append "-dev". E.g. "vX.Y.(Z+1)-dev"
# - update version numbers in lvgl and docs
# - commit and push
# - docs: run ./updade.py latest dev
#
# Else (not --patch)
# - merge master to dev
# - merge the dev to master
# - increment version number like "vX.(Y+1).0-dev"
# - apply the new version in dev branches of lvgl, lv_examples, lv_drivers, docs
# - commit and push to dev branches
# - docs: run ./updade.py latest dev
import re
import os, fnmatch
import os.path
from os import path
from datetime import date
import sys
upstream_org_url = "https://github.com/lvgl/"
workdir = "./release_tmp"
ver_major = -1
ver_minor = -1
ver_patch = -1
ver_str = ""
dev_ver_str = ""
release_br = ""
release_note = ""
prepare_type = ['major', 'minor', 'bugfix']
dev_prepare = 'minor'
def upstream(repo):
return upstream_org_url + repo + ".git"
def cmd(c, exit_on_err = True):
print("\n" + c)
r = os.system(c)
if r:
print("### Error: " + str(r))
if exit_on_err: exit(int(r))
def define_set(fn, name, value):
print("In " + fn + " set " + name + " to " + value)
new_content = ""
f = open(fn, "r")
for i in f.read().splitlines():
r = re.search(r'^ *# *define +' + name, i)
if r:
d = i.split("define")
i = d[0] + "define " + name + " " + value
new_content += i + '\n'
f.close()
f = open(fn, "w")
f.write(new_content)
f.close()
def clone_repos():
cmd("rm -fr " + workdir)
cmd("mkdir " + workdir)
os.chdir(workdir)
#For debuging just copy the repos
#cmd("cp -a ../repos/. .")
#return
cmd("git clone " + upstream("lvgl") + " lvgl; cd lvgl; git checkout master")
cmd("git clone " + upstream("lv_examples") + "; cd lv_examples; git checkout master")
cmd("git clone " + upstream("lv_drivers") + "; cd lv_drivers; git checkout master")
cmd("git clone --recurse-submodules " + upstream("docs") + "; cd docs; git checkout master")
cmd("git clone " + upstream("blog") + "; cd lv_drivers; git checkout blog")
def get_lvgl_version(br):
print("Get LVGL's version")
global ver_str, ver_major, ver_minor, ver_patch, release_br
os.chdir("./lvgl")
cmd("git checkout " + br)
f = open("./lvgl.h", "r")
lastNum = re.compile(r'(?:[^\d]*(\d+)[^\d]*)+')
for i in f.read().splitlines():
r = re.search(r'^#define LVGL_VERSION_MAJOR ', i)
if r:
m = lastNum.search(i)
if m: ver_major = m.group(1)
r = re.search(r'^#define LVGL_VERSION_MINOR ', i)
if r:
m = lastNum.search(i)
if m: ver_minor = m.group(1)
r = re.search(r'^#define LVGL_VERSION_PATCH ', i)
if r:
m = lastNum.search(i)
if m: ver_patch = m.group(1)
f.close()
cmd("git checkout master")
ver_str = "v" + str(ver_major) + "." + str(ver_minor) + "." + str(ver_patch)
print("New version:" + ver_str)
release_br = "release/v" + ver_major
os.chdir("../")
def update_version():
templ = fnmatch.filter(os.listdir('.'), '*templ*')
if templ[0]:
print("Updating version in " + templ[0])
cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+/"+ ver_str +"/' " + templ[0])
if os.path.exists("library.json"):
print("Updating version in library.json")
cmd("sed -i -r 's/[0-9]+\.[0-9]+\.[0-9]+/"+ ver_str[1:] +"/' library.json")
if path.exists("library.properties"):
print("Updating version in library.properties")
cmd("sed -i -r 's/version=[0-9]+\.[0-9]+\.[0-9]+/"+ "version=" + ver_str[1:] + "/' library.properties")
def lvgl_prepare():
print("Prepare lvgl")
global ver_str, ver_major, ver_minor, ver_patch
os.chdir("./lvgl")
define_set("./lvgl.h", "LVGL_VERSION_INFO", '\"\"')
# Run some scripts
os.chdir("./scripts")
cmd("./code-format.sh")
cmd("./lv_conf_checker.py")
cmd("doxygen")
os.chdir("../")
update_version()
#update CHANGLELOG
new_content = ""
f = open("./CHANGELOG.md", "r")
global release_note
release_note = ""
note_state = 0
for i in f.read().splitlines():
if note_state == 0:
r = re.search(r'^## ' + ver_str, i)
if r:
i = i.replace("planned on ", "")
note_state+=1
elif note_state == 1:
r = re.search(r'^## ', i)
if r:
note_state+=1
else:
release_note += i + '\n'
new_content += i + '\n'
f.close()
f = open("./CHANGELOG.md", "w")
f.write(new_content)
f.close()
cmd('git commit -am "prepare to release ' + ver_str + '"')
os.chdir("../")
def lv_examples_prepare():
print("Prepare lv_examples")
global ver_str, ver_major, ver_minor, ver_patch
os.chdir("./lv_examples")
update_version()
cmd("sed -i -r 's/LV_VERSION_CHECK\([0-9]+, *[0-9]+, *[0-9]+\)/"+ "LV_VERSION_CHECK(" + ver_major + ", " + ver_minor + ", " + ver_patch + ")/' lv_examples.h")
cmd('git commit -am "prepare to release ' + ver_str + '"')
os.chdir("../")
def lv_drivers_prepare():
print("Prepare lv_drivers")
global ver_str, ver_major, ver_minor, ver_patch
os.chdir("./lv_drivers")
update_version()
cmd('git commit -am "prepare to release ' + ver_str + '"')
os.chdir("../")
def docs_prepare():
print("Prepare docs")
global ver_str, ver_major, ver_minor, ver_patch
os.chdir("./docs")
cmd("git co latest --")
cmd("rm -rf xml");
cmd("cp -r ../lvgl/docs/api_doc/xml .");
cmd("git add xml");
cmd("sed -i -r \"s/'v[0-9]+\.[0-9]+\.[0-9]+.*'/\'" + ver_str + "'/\" conf.py")
cmd('git commit -am "prepare to release ' + ver_str + '"')
os.chdir("../")
def blog_add_post():
global ver_str, release_note
os.chdir("./blog/_posts")
post = "---\nlayout: post\ntitle: " + ver_str + " is released\nauthor: \"kisvegabor\"\ncover: /assets/release_cover.png\n---\n\n"
post += release_note
today = date.today()
d = today.strftime("%Y-%m-%d")
f = open(d + "_release_" + ver_str + ".md", "w")
f.write(post)
f.close()
cmd("git add .")
cmd("git commit -am 'Add " + ver_str + " release post'")
os.chdir("../../")
def add_tags():
global ver_str
tag_cmd = " git tag -a " + ver_str + " -m 'Release " + ver_str + "' "
cmd("cd lvgl; " + tag_cmd)
cmd("cd lv_examples; " + tag_cmd)
cmd("cd lv_drivers; " + tag_cmd)
cmd("cd docs; " + tag_cmd)
def update_release_branches():
global release_br
merge_cmd = " git checkout " + release_br + "; git pull origin " + release_br + "; git merge master -X ours; git push origin " + release_br + "; git checkout master"
cmd("cd lvgl; " + merge_cmd)
cmd("cd lv_examples; " + merge_cmd)
cmd("cd lv_drivers; " + merge_cmd)
merge_cmd = " git checkout " + release_br + "; git pull origin " + release_br + "; git merge latest -X ours; git push origin " + release_br + "; git checkout latest"
cmd("cd docs; " + merge_cmd)
def publish_master():
pub_cmd = "git push origin master; git push origin " + ver_str
cmd("cd lvgl; " + pub_cmd)
cmd("cd lv_examples; " + pub_cmd)
cmd("cd lv_drivers; " + pub_cmd)
pub_cmd = "git push origin latest; git push origin " + ver_str
cmd("cd docs; " + pub_cmd)
cmd("cd docs; git checkout master; ./update.py " + release_br)
pub_cmd = "git push origin master"
cmd("cd blog; " + pub_cmd)
def merge_to_dev():
merge_cmd = "git checkout dev; git merge master -X ours; git checkout master"
cmd("cd lvgl; " + merge_cmd)
merge_cmd = "git checkout dev; git merge latest -X ours; git checkout master"
cmd("cd docs; " + merge_cmd)
def merge_from_dev():
merge_cmd = "git checkout master; git merge dev;"
cmd("cd lvgl; " + merge_cmd)
merge_cmd = "git checkout latest; git merge dev;"
cmd("cd docs; " + merge_cmd)
def lvgl_update_master_version():
global ver_major, ver_minor, ver_patch, ver_str
os.chdir("./lvgl")
cmd("git checkout master")
define_set("./lvgl.h", "LVGL_VERSION_MAJOR", ver_major)
define_set("./lvgl.h", "LVGL_VERSION_MINOR", ver_minor)
define_set("./lvgl.h", "LVGL_VERSION_PATCH", ver_patch)
define_set("./lvgl.h", "LVGL_VERSION_INFO", "dev")
templ = fnmatch.filter(os.listdir('.'), '*templ*')
if templ[0]:
print("Updating version in " + templ[0])
cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+/"+ ver_str +"/' " + templ[0])
cmd("git commit -am 'Update version'")
os.chdir("../")
def docs_update_latest_version():
global ver_str
os.chdir("./docs")
cmd("git checkout latest --")
cmd("sed -i -r \"s/'v[0-9]+\.[0-9]+\.[0-9]+.*'/\'" + ver_str + "'/\" conf.py")
cmd("git commit -am 'Update version'")
cmd("git checkout master --")
os.chdir("../")
def lvgl_update_dev_version():
global ver_major, ver_minor, ver_patch, dev_ver_str
os.chdir("./lvgl")
cmd("git checkout dev")
define_set("./lvgl.h", "LVGL_VERSION_MAJOR", ver_major)
define_set("./lvgl.h", "LVGL_VERSION_MINOR", ver_minor)
define_set("./lvgl.h", "LVGL_VERSION_PATCH", ver_patch)
define_set("./lvgl.h", "LVGL_VERSION_INFO", "\"dev\"")
templ = fnmatch.filter(os.listdir('.'), '*templ*')
if templ[0]:
print("Updating version in " + templ[0])
cmd("sed -i -r 's/v[0-9]+\.[0-9]+\.[0-9]+/"+ dev_ver_str +"/' " + templ[0])
cmd("git commit -am 'Update dev version'")
cmd("git checkout master")
os.chdir("../")
def docs_update_dev_version():
global dev_ver_str
os.chdir("./docs")
cmd("git checkout dev --")
cmd("sed -i -r \"s/'v[0-9]+\.[0-9]+\.[0-9]+.*'/\'" + dev_ver_str + "'/\" conf.py")
cmd("git commit -am 'Update dev version'")
cmd("git checkout master --")
os.chdir("../")
def publish_dev():
pub_cmd = "git checkout dev; git push origin dev"
cmd("cd lvgl; " + pub_cmd)
pub_cmd = "git checkout dev; git push origin dev"
cmd("cd docs; " + pub_cmd)
cmd("cd docs; git checkout master; ./update.py latest dev")
def cleanup():
os.chdir("../")
cmd("rm -fr " + workdir)
if __name__ == '__main__':
if(len(sys.argv) != 2):
print("Argument error. Usage ./release.py bugfix | minor | major")
exit(1)
dev_prepare = sys.argv[1]
if not (dev_prepare in prepare_type):
print("Invalid argument. Usage ./release.py bugfix | minor | major")
exit(1)
clone_repos()
get_lvgl_version("master")
lvgl_prepare()
lv_examples_prepare()
lv_drivers_prepare()
docs_prepare()
blog_add_post()
add_tags()
update_release_branches()
publish_master()
if dev_prepare == 'bugfix':
ver_patch = str(int(ver_patch) + 1)
ver_str = "v" + ver_major + "." + ver_minor + "." + ver_patch + "-dev"
print("Prepare bugfix version " + ver_str)
lvgl_update_master_version()
docs_update_latest_version()
get_lvgl_version("dev")
dev_ver_str = "v" + ver_major + "." + ver_minor + "." + ver_patch + "-dev"
merge_to_dev()
lvgl_update_dev_version()
docs_update_dev_version()
publish_dev()
else:
get_lvgl_version("dev")
if dev_prepare == 'minor':
ver_minor = str(int(ver_minor) + 1)
ver_patch = "0"
else:
ver_major = str(int(ver_major) + 1)
ver_minor = "0"
ver_patch = "0"
dev_ver_str = "v" + ver_major + "." + ver_minor + "." + ver_patch + "-dev"
print("Prepare minor version " + ver_str)
merge_to_dev()
merge_from_dev()
lvgl_update_dev_version()
docs_update_dev_version()
publish_dev()
cleanup()
|
train_000.parquet/915
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/scripts/release.py",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 13699,
"token_count": 5513
}
|
# Doxyfile 1.8.13
# This file describes the settings to be used by the documentation system
# doxygen (www.doxygen.org) for a project.
#
# All text after a double hash (##) is considered a comment and is placed in
# front of the TAG it is preceding.
#
# All text after a single hash (#) is considered a comment and will be ignored.
# The format is:
# TAG = value [value, ...]
# For lists, items can also be appended using:
# TAG += value [value, ...]
# Values that contain spaces should be placed between quotes (\" \").
#---------------------------------------------------------------------------
# Project related configuration options
#---------------------------------------------------------------------------
# This tag specifies the encoding used for all characters in the config file
# that follow. The default is UTF-8 which is also the encoding used for all text
# before the first occurrence of this tag. Doxygen uses libiconv (or the iconv
# built into libc) for the transcoding. See http://www.gnu.org/software/libiconv
# for the list of possible encodings.
# The default value is: UTF-8.
DOXYFILE_ENCODING = UTF-8
# The PROJECT_NAME tag is a single word (or a sequence of words surrounded by
# double-quotes, unless you are using Doxywizard) that should identify the
# project for which the documentation is generated. This name is used in the
# title of most generated pages and in a few other places.
# The default value is: My Project.
PROJECT_NAME = "LittlevGL"
# The PROJECT_NUMBER tag can be used to enter a project or revision number. This
# could be handy for archiving the generated documentation or if some version
# control system is used.
PROJECT_NUMBER =
# Using the PROJECT_BRIEF tag one can provide an optional one line description
# for a project that appears at the top of each page and should give viewer a
# quick idea about the purpose of the project. Keep the description short.
PROJECT_BRIEF =
# With the PROJECT_LOGO tag one can specify a logo or an icon that is included
# in the documentation. The maximum height of the logo should not exceed 55
# pixels and the maximum width should not exceed 200 pixels. Doxygen will copy
# the logo to the output directory.
PROJECT_LOGO =
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) path
# into which the generated documentation will be written. If a relative path is
# entered, it will be relative to the location where doxygen was started. If
# left blank the current directory will be used.
OUTPUT_DIRECTORY = ../docs/api_doc
# If the CREATE_SUBDIRS tag is set to YES then doxygen will create 4096 sub-
# directories (in 2 levels) under the output directory of each output format and
# will distribute the generated files over these directories. Enabling this
# option can be useful when feeding doxygen a huge amount of source files, where
# putting all generated files in the same directory would otherwise causes
# performance problems for the file system.
# The default value is: NO.
CREATE_SUBDIRS = NO
# If the ALLOW_UNICODE_NAMES tag is set to YES, doxygen will allow non-ASCII
# characters to appear in the names of generated files. If set to NO, non-ASCII
# characters will be escaped, for example _xE3_x81_x84 will be used for Unicode
# U+3044.
# The default value is: NO.
ALLOW_UNICODE_NAMES = NO
# The OUTPUT_LANGUAGE tag is used to specify the language in which all
# documentation generated by doxygen is written. Doxygen will use this
# information to generate all constant output in the proper language.
# Possible values are: Afrikaans, Arabic, Armenian, Brazilian, Catalan, Chinese,
# Chinese-Traditional, Croatian, Czech, Danish, Dutch, English (United States),
# Esperanto, Farsi (Persian), Finnish, French, German, Greek, Hungarian,
# Indonesian, Italian, Japanese, Japanese-en (Japanese with English messages),
# Korean, Korean-en (Korean with English messages), Latvian, Lithuanian,
# Macedonian, Norwegian, Persian (Farsi), Polish, Portuguese, Romanian, Russian,
# Serbian, Serbian-Cyrillic, Slovak, Slovene, Spanish, Swedish, Turkish,
# Ukrainian and Vietnamese.
# The default value is: English.
OUTPUT_LANGUAGE = English
# If the BRIEF_MEMBER_DESC tag is set to YES, doxygen will include brief member
# descriptions after the members that are listed in the file and class
# documentation (similar to Javadoc). Set to NO to disable this.
# The default value is: YES.
BRIEF_MEMBER_DESC = YES
# If the REPEAT_BRIEF tag is set to YES, doxygen will prepend the brief
# description of a member or function before the detailed description
#
# Note: If both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the
# brief descriptions will be completely suppressed.
# The default value is: YES.
REPEAT_BRIEF = YES
# This tag implements a quasi-intelligent brief description abbreviator that is
# used to form the text in various listings. Each string in this list, if found
# as the leading text of the brief description, will be stripped from the text
# and the result, after processing the whole list, is used as the annotated
# text. Otherwise, the brief description is used as-is. If left blank, the
# following values are used ($name is automatically replaced with the name of
# the entity):The $name class, The $name widget, The $name file, is, provides,
# specifies, contains, represents, a, an and the.
ABBREVIATE_BRIEF = "The $name class" \
"The $name widget" \
"The $name file" \
is \
provides \
specifies \
contains \
represents \
a \
an \
the
# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then
# doxygen will generate a detailed section even if there is only a brief
# description.
# The default value is: NO.
ALWAYS_DETAILED_SEC = NO
# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all
# inherited members of a class in the documentation of that class as if those
# members were ordinary class members. Constructors, destructors and assignment
# operators of the base classes will not be shown.
# The default value is: NO.
INLINE_INHERITED_MEMB = NO
# If the FULL_PATH_NAMES tag is set to YES, doxygen will prepend the full path
# before files name in the file list and in the header files. If set to NO the
# shortest path that makes the file name unique will be used
# The default value is: YES.
FULL_PATH_NAMES = YES
# The STRIP_FROM_PATH tag can be used to strip a user-defined part of the path.
# Stripping is only done if one of the specified strings matches the left-hand
# part of the path. The tag can be used to show relative paths in the file list.
# If left blank the directory from which doxygen is run is used as the path to
# strip.
#
# Note that you can specify absolute paths here, but also relative paths, which
# will be relative from the directory where doxygen is started.
# This tag requires that the tag FULL_PATH_NAMES is set to YES.
STRIP_FROM_PATH =
# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of the
# path mentioned in the documentation of a class, which tells the reader which
# header file to include in order to use a class. If left blank only the name of
# the header file containing the class definition is used. Otherwise one should
# specify the list of include paths that are normally passed to the compiler
# using the -I flag.
STRIP_FROM_INC_PATH =
# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter (but
# less readable) file names. This can be useful is your file systems doesn't
# support long names like on DOS, Mac, or CD-ROM.
# The default value is: NO.
SHORT_NAMES = NO
# If the JAVADOC_AUTOBRIEF tag is set to YES then doxygen will interpret the
# first line (until the first dot) of a Javadoc-style comment as the brief
# description. If set to NO, the Javadoc-style will behave just like regular Qt-
# style comments (thus requiring an explicit @brief command for a brief
# description.)
# The default value is: NO.
JAVADOC_AUTOBRIEF = NO
# If the QT_AUTOBRIEF tag is set to YES then doxygen will interpret the first
# line (until the first dot) of a Qt-style comment as the brief description. If
# set to NO, the Qt-style will behave just like regular Qt-style comments (thus
# requiring an explicit \brief command for a brief description.)
# The default value is: NO.
QT_AUTOBRIEF = NO
# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make doxygen treat a
# multi-line C++ special comment block (i.e. a block of //! or /// comments) as
# a brief description. This used to be the default behavior. The new default is
# to treat a multi-line C++ comment block as a detailed description. Set this
# tag to YES if you prefer the old behavior instead.
#
# Note that setting this tag to YES also means that rational rose comments are
# not recognized any more.
# The default value is: NO.
MULTILINE_CPP_IS_BRIEF = NO
# If the INHERIT_DOCS tag is set to YES then an undocumented member inherits the
# documentation from any documented member that it re-implements.
# The default value is: YES.
INHERIT_DOCS = YES
# If the SEPARATE_MEMBER_PAGES tag is set to YES then doxygen will produce a new
# page for each member. If set to NO, the documentation of a member will be part
# of the file/class/namespace that contains it.
# The default value is: NO.
SEPARATE_MEMBER_PAGES = NO
# The TAB_SIZE tag can be used to set the number of spaces in a tab. Doxygen
# uses this value to replace tabs by spaces in code fragments.
# Minimum value: 1, maximum value: 16, default value: 4.
TAB_SIZE = 4
# This tag can be used to specify a number of aliases that act as commands in
# the documentation. An alias has the form:
# name=value
# For example adding
# "sideeffect=@par Side Effects:\n"
# will allow you to put the command \sideeffect (or @sideeffect) in the
# documentation, which will result in a user-defined paragraph with heading
# "Side Effects:". You can put \n's in the value part of an alias to insert
# newlines.
ALIASES =
# This tag can be used to specify a number of word-keyword mappings (TCL only).
# A mapping has the form "name=value". For example adding "class=itcl::class"
# will allow you to use the command class in the itcl::class meaning.
TCL_SUBST =
# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C sources
# only. Doxygen will then generate output that is more tailored for C. For
# instance, some of the names that are used will be different. The list of all
# members will be omitted, etc.
# The default value is: NO.
OPTIMIZE_OUTPUT_FOR_C = YES
# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java or
# Python sources only. Doxygen will then generate output that is more tailored
# for that language. For instance, namespaces will be presented as packages,
# qualified scopes will look different, etc.
# The default value is: NO.
OPTIMIZE_OUTPUT_JAVA = NO
# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran
# sources. Doxygen will then generate output that is tailored for Fortran.
# The default value is: NO.
OPTIMIZE_FOR_FORTRAN = NO
# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL
# sources. Doxygen will then generate output that is tailored for VHDL.
# The default value is: NO.
OPTIMIZE_OUTPUT_VHDL = NO
# Doxygen selects the parser to use depending on the extension of the files it
# parses. With this tag you can assign which parser to use for a given
# extension. Doxygen has a built-in mapping, but you can override or extend it
# using this tag. The format is ext=language, where ext is a file extension, and
# language is one of the parsers supported by doxygen: IDL, Java, Javascript,
# C#, C, C++, D, PHP, Objective-C, Python, Fortran (fixed format Fortran:
# FortranFixed, free formatted Fortran: FortranFree, unknown formatted Fortran:
# Fortran. In the later case the parser tries to guess whether the code is fixed
# or free formatted code, this is the default for Fortran type files), VHDL. For
# instance to make doxygen treat .inc files as Fortran files (default is PHP),
# and .f files as C (default is Fortran), use: inc=Fortran f=C.
#
# Note: For files without extension you can use no_extension as a placeholder.
#
# Note that for custom extensions you also need to set FILE_PATTERNS otherwise
# the files are not read by doxygen.
EXTENSION_MAPPING =
# If the MARKDOWN_SUPPORT tag is enabled then doxygen pre-processes all comments
# according to the Markdown format, which allows for more readable
# documentation. See http://daringfireball.net/projects/markdown/ for details.
# The output of markdown processing is further processed by doxygen, so you can
# mix doxygen, HTML, and XML commands with Markdown formatting. Disable only in
# case of backward compatibilities issues.
# The default value is: YES.
MARKDOWN_SUPPORT = YES
# When the TOC_INCLUDE_HEADINGS tag is set to a non-zero value, all headings up
# to that level are automatically included in the table of contents, even if
# they do not have an id attribute.
# Note: This feature currently applies only to Markdown headings.
# Minimum value: 0, maximum value: 99, default value: 0.
# This tag requires that the tag MARKDOWN_SUPPORT is set to YES.
TOC_INCLUDE_HEADINGS = 0
# When enabled doxygen tries to link words that correspond to documented
# classes, or namespaces to their corresponding documentation. Such a link can
# be prevented in individual cases by putting a % sign in front of the word or
# globally by setting AUTOLINK_SUPPORT to NO.
# The default value is: YES.
AUTOLINK_SUPPORT = YES
# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want
# to include (a tag file for) the STL sources as input, then you should set this
# tag to YES in order to let doxygen match functions declarations and
# definitions whose arguments contain STL classes (e.g. func(std::string);
# versus func(std::string) {}). This also make the inheritance and collaboration
# diagrams that involve STL classes more complete and accurate.
# The default value is: NO.
BUILTIN_STL_SUPPORT = NO
# If you use Microsoft's C++/CLI language, you should set this option to YES to
# enable parsing support.
# The default value is: NO.
CPP_CLI_SUPPORT = NO
# Set the SIP_SUPPORT tag to YES if your project consists of sip (see:
# http://www.riverbankcomputing.co.uk/software/sip/intro) sources only. Doxygen
# will parse them like normal C++ but will assume all classes use public instead
# of private inheritance when no explicit protection keyword is present.
# The default value is: NO.
SIP_SUPPORT = NO
# For Microsoft's IDL there are propget and propput attributes to indicate
# getter and setter methods for a property. Setting this option to YES will make
# doxygen to replace the get and set methods by a property in the documentation.
# This will only work if the methods are indeed getting or setting a simple
# type. If this is not the case, or you want to show the methods anyway, you
# should set this option to NO.
# The default value is: YES.
IDL_PROPERTY_SUPPORT = YES
# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC
# tag is set to YES then doxygen will reuse the documentation of the first
# member in the group (if any) for the other members of the group. By default
# all members of a group must be documented explicitly.
# The default value is: NO.
DISTRIBUTE_GROUP_DOC = NO
# If one adds a struct or class to a group and this option is enabled, then also
# any nested class or struct is added to the same group. By default this option
# is disabled and one has to add nested compounds explicitly via \ingroup.
# The default value is: NO.
GROUP_NESTED_COMPOUNDS = NO
# Set the SUBGROUPING tag to YES to allow class member groups of the same type
# (for instance a group of public functions) to be put as a subgroup of that
# type (e.g. under the Public Functions section). Set it to NO to prevent
# subgrouping. Alternatively, this can be done per class using the
# \nosubgrouping command.
# The default value is: YES.
SUBGROUPING = YES
# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and unions
# are shown inside the group in which they are included (e.g. using \ingroup)
# instead of on a separate page (for HTML and Man pages) or section (for LaTeX
# and RTF).
#
# Note that this feature does not work in combination with
# SEPARATE_MEMBER_PAGES.
# The default value is: NO.
INLINE_GROUPED_CLASSES = NO
# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and unions
# with only public data fields or simple typedef fields will be shown inline in
# the documentation of the scope in which they are defined (i.e. file,
# namespace, or group documentation), provided this scope is documented. If set
# to NO, structs, classes, and unions are shown on a separate page (for HTML and
# Man pages) or section (for LaTeX and RTF).
# The default value is: NO.
INLINE_SIMPLE_STRUCTS = NO
# When TYPEDEF_HIDES_STRUCT tag is enabled, a typedef of a struct, union, or
# enum is documented as struct, union, or enum with the name of the typedef. So
# typedef struct TypeS {} TypeT, will appear in the documentation as a struct
# with name TypeT. When disabled the typedef will appear as a member of a file,
# namespace, or class. And the struct will be named TypeS. This can typically be
# useful for C code in case the coding convention dictates that all compound
# types are typedef'ed and only the typedef is referenced, never the tag name.
# The default value is: NO.
TYPEDEF_HIDES_STRUCT = NO
# The size of the symbol lookup cache can be set using LOOKUP_CACHE_SIZE. This
# cache is used to resolve symbols given their name and scope. Since this can be
# an expensive process and often the same symbol appears multiple times in the
# code, doxygen keeps a cache of pre-resolved symbols. If the cache is too small
# doxygen will become slower. If the cache is too large, memory is wasted. The
# cache size is given by this formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range
# is 0..9, the default is 0, corresponding to a cache size of 2^16=65536
# symbols. At the end of a run doxygen will report the cache usage and suggest
# the optimal cache size from a speed point of view.
# Minimum value: 0, maximum value: 9, default value: 0.
LOOKUP_CACHE_SIZE = 0
#---------------------------------------------------------------------------
# Build related configuration options
#---------------------------------------------------------------------------
# If the EXTRACT_ALL tag is set to YES, doxygen will assume all entities in
# documentation are documented, even if no documentation was available. Private
# class members and static file members will be hidden unless the
# EXTRACT_PRIVATE respectively EXTRACT_STATIC tags are set to YES.
# Note: This will also disable the warnings about undocumented members that are
# normally produced when WARNINGS is set to YES.
# The default value is: NO.
EXTRACT_ALL = NO
# If the EXTRACT_PRIVATE tag is set to YES, all private members of a class will
# be included in the documentation.
# The default value is: NO.
EXTRACT_PRIVATE = NO
# If the EXTRACT_PACKAGE tag is set to YES, all members with package or internal
# scope will be included in the documentation.
# The default value is: NO.
EXTRACT_PACKAGE = NO
# If the EXTRACT_STATIC tag is set to YES, all static members of a file will be
# included in the documentation.
# The default value is: NO.
EXTRACT_STATIC = NO
# If the EXTRACT_LOCAL_CLASSES tag is set to YES, classes (and structs) defined
# locally in source files will be included in the documentation. If set to NO,
# only classes defined in header files are included. Does not have any effect
# for Java sources.
# The default value is: YES.
EXTRACT_LOCAL_CLASSES = YES
# This flag is only useful for Objective-C code. If set to YES, local methods,
# which are defined in the implementation section but not in the interface are
# included in the documentation. If set to NO, only methods in the interface are
# included.
# The default value is: NO.
EXTRACT_LOCAL_METHODS = NO
# If this flag is set to YES, the members of anonymous namespaces will be
# extracted and appear in the documentation as a namespace called
# 'anonymous_namespace{file}', where file will be replaced with the base name of
# the file that contains the anonymous namespace. By default anonymous namespace
# are hidden.
# The default value is: NO.
EXTRACT_ANON_NSPACES = NO
# If the HIDE_UNDOC_MEMBERS tag is set to YES, doxygen will hide all
# undocumented members inside documented classes or files. If set to NO these
# members will be included in the various overviews, but no documentation
# section is generated. This option has no effect if EXTRACT_ALL is enabled.
# The default value is: NO.
HIDE_UNDOC_MEMBERS = NO
# If the HIDE_UNDOC_CLASSES tag is set to YES, doxygen will hide all
# undocumented classes that are normally visible in the class hierarchy. If set
# to NO, these classes will be included in the various overviews. This option
# has no effect if EXTRACT_ALL is enabled.
# The default value is: NO.
HIDE_UNDOC_CLASSES = NO
# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, doxygen will hide all friend
# (class|struct|union) declarations. If set to NO, these declarations will be
# included in the documentation.
# The default value is: NO.
HIDE_FRIEND_COMPOUNDS = NO
# If the HIDE_IN_BODY_DOCS tag is set to YES, doxygen will hide any
# documentation blocks found inside the body of a function. If set to NO, these
# blocks will be appended to the function's detailed documentation block.
# The default value is: NO.
HIDE_IN_BODY_DOCS = NO
# The INTERNAL_DOCS tag determines if documentation that is typed after a
# \internal command is included. If the tag is set to NO then the documentation
# will be excluded. Set it to YES to include the internal documentation.
# The default value is: NO.
INTERNAL_DOCS = YES
# If the CASE_SENSE_NAMES tag is set to NO then doxygen will only generate file
# names in lower-case letters. If set to YES, upper-case letters are also
# allowed. This is useful if you have classes or files whose names only differ
# in case and if your file system supports case sensitive file names. Windows
# and Mac users are advised to set this option to NO.
# The default value is: system dependent.
CASE_SENSE_NAMES = YES
# If the HIDE_SCOPE_NAMES tag is set to NO then doxygen will show members with
# their full class and namespace scopes in the documentation. If set to YES, the
# scope will be hidden.
# The default value is: NO.
HIDE_SCOPE_NAMES = NO
# If the HIDE_COMPOUND_REFERENCE tag is set to NO (default) then doxygen will
# append additional text to a page's title, such as Class Reference. If set to
# YES the compound reference will be hidden.
# The default value is: NO.
HIDE_COMPOUND_REFERENCE= NO
# If the SHOW_INCLUDE_FILES tag is set to YES then doxygen will put a list of
# the files that are included by a file in the documentation of that file.
# The default value is: YES.
SHOW_INCLUDE_FILES = YES
# If the SHOW_GROUPED_MEMB_INC tag is set to YES then Doxygen will add for each
# grouped member an include statement to the documentation, telling the reader
# which file to include in order to use the member.
# The default value is: NO.
SHOW_GROUPED_MEMB_INC = NO
# If the FORCE_LOCAL_INCLUDES tag is set to YES then doxygen will list include
# files with double quotes in the documentation rather than with sharp brackets.
# The default value is: NO.
FORCE_LOCAL_INCLUDES = NO
# If the INLINE_INFO tag is set to YES then a tag [inline] is inserted in the
# documentation for inline members.
# The default value is: YES.
INLINE_INFO = YES
# If the SORT_MEMBER_DOCS tag is set to YES then doxygen will sort the
# (detailed) documentation of file and class members alphabetically by member
# name. If set to NO, the members will appear in declaration order.
# The default value is: YES.
SORT_MEMBER_DOCS = YES
# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the brief
# descriptions of file, namespace and class members alphabetically by member
# name. If set to NO, the members will appear in declaration order. Note that
# this will also influence the order of the classes in the class list.
# The default value is: NO.
SORT_BRIEF_DOCS = NO
# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen will sort the
# (brief and detailed) documentation of class members so that constructors and
# destructors are listed first. If set to NO the constructors will appear in the
# respective orders defined by SORT_BRIEF_DOCS and SORT_MEMBER_DOCS.
# Note: If SORT_BRIEF_DOCS is set to NO this option is ignored for sorting brief
# member documentation.
# Note: If SORT_MEMBER_DOCS is set to NO this option is ignored for sorting
# detailed member documentation.
# The default value is: NO.
SORT_MEMBERS_CTORS_1ST = NO
# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the hierarchy
# of group names into alphabetical order. If set to NO the group names will
# appear in their defined order.
# The default value is: NO.
SORT_GROUP_NAMES = NO
# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be sorted by
# fully-qualified names, including namespaces. If set to NO, the class list will
# be sorted only by class name, not including the namespace part.
# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES.
# Note: This option applies only to the class list, not to the alphabetical
# list.
# The default value is: NO.
SORT_BY_SCOPE_NAME = NO
# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to do proper
# type resolution of all parameters of a function it will reject a match between
# the prototype and the implementation of a member function even if there is
# only one candidate or it is obvious which candidate to choose by doing a
# simple string match. By disabling STRICT_PROTO_MATCHING doxygen will still
# accept a match between prototype and implementation in such cases.
# The default value is: NO.
STRICT_PROTO_MATCHING = NO
# The GENERATE_TODOLIST tag can be used to enable (YES) or disable (NO) the todo
# list. This list is created by putting \todo commands in the documentation.
# The default value is: YES.
GENERATE_TODOLIST = YES
# The GENERATE_TESTLIST tag can be used to enable (YES) or disable (NO) the test
# list. This list is created by putting \test commands in the documentation.
# The default value is: YES.
GENERATE_TESTLIST = YES
# The GENERATE_BUGLIST tag can be used to enable (YES) or disable (NO) the bug
# list. This list is created by putting \bug commands in the documentation.
# The default value is: YES.
GENERATE_BUGLIST = YES
# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or disable (NO)
# the deprecated list. This list is created by putting \deprecated commands in
# the documentation.
# The default value is: YES.
GENERATE_DEPRECATEDLIST= YES
# The ENABLED_SECTIONS tag can be used to enable conditional documentation
# sections, marked by \if <section_label> ... \endif and \cond <section_label>
# ... \endcond blocks.
ENABLED_SECTIONS =
# The MAX_INITIALIZER_LINES tag determines the maximum number of lines that the
# initial value of a variable or macro / define can have for it to appear in the
# documentation. If the initializer consists of more lines than specified here
# it will be hidden. Use a value of 0 to hide initializers completely. The
# appearance of the value of individual variables and macros / defines can be
# controlled using \showinitializer or \hideinitializer command in the
# documentation regardless of this setting.
# Minimum value: 0, maximum value: 10000, default value: 30.
MAX_INITIALIZER_LINES = 30
# Set the SHOW_USED_FILES tag to NO to disable the list of files generated at
# the bottom of the documentation of classes and structs. If set to YES, the
# list will mention the files that were used to generate the documentation.
# The default value is: YES.
SHOW_USED_FILES = YES
# Set the SHOW_FILES tag to NO to disable the generation of the Files page. This
# will remove the Files entry from the Quick Index and from the Folder Tree View
# (if specified).
# The default value is: YES.
SHOW_FILES = YES
# Set the SHOW_NAMESPACES tag to NO to disable the generation of the Namespaces
# page. This will remove the Namespaces entry from the Quick Index and from the
# Folder Tree View (if specified).
# The default value is: YES.
SHOW_NAMESPACES = YES
# The FILE_VERSION_FILTER tag can be used to specify a program or script that
# doxygen should invoke to get the current version for each file (typically from
# the version control system). Doxygen will invoke the program by executing (via
# popen()) the command command input-file, where command is the value of the
# FILE_VERSION_FILTER tag, and input-file is the name of an input file provided
# by doxygen. Whatever the program writes to standard output is used as the file
# version. For an example see the documentation.
FILE_VERSION_FILTER =
# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed
# by doxygen. The layout file controls the global structure of the generated
# output files in an output format independent way. To create the layout file
# that represents doxygen's defaults, run doxygen with the -l option. You can
# optionally specify a file name after the option, if omitted DoxygenLayout.xml
# will be used as the name of the layout file.
#
# Note that if you run doxygen from a directory containing a file called
# DoxygenLayout.xml, doxygen will parse it automatically even if the LAYOUT_FILE
# tag is left empty.
LAYOUT_FILE =
# The CITE_BIB_FILES tag can be used to specify one or more bib files containing
# the reference definitions. This must be a list of .bib files. The .bib
# extension is automatically appended if omitted. This requires the bibtex tool
# to be installed. See also http://en.wikipedia.org/wiki/BibTeX for more info.
# For LaTeX the style of the bibliography can be controlled using
# LATEX_BIB_STYLE. To use this feature you need bibtex and perl available in the
# search path. See also \cite for info how to create references.
CITE_BIB_FILES =
#---------------------------------------------------------------------------
# Configuration options related to warning and progress messages
#---------------------------------------------------------------------------
# The QUIET tag can be used to turn on/off the messages that are generated to
# standard output by doxygen. If QUIET is set to YES this implies that the
# messages are off.
# The default value is: NO.
QUIET = YES
# The WARNINGS tag can be used to turn on/off the warning messages that are
# generated to standard error (stderr) by doxygen. If WARNINGS is set to YES
# this implies that the warnings are on.
#
# Tip: Turn warnings on while writing the documentation.
# The default value is: YES.
WARNINGS = NO
# If the WARN_IF_UNDOCUMENTED tag is set to YES then doxygen will generate
# warnings for undocumented members. If EXTRACT_ALL is set to YES then this flag
# will automatically be disabled.
# The default value is: YES.
WARN_IF_UNDOCUMENTED = NO
# If the WARN_IF_DOC_ERROR tag is set to YES, doxygen will generate warnings for
# potential errors in the documentation, such as not documenting some parameters
# in a documented function, or documenting parameters that don't exist or using
# markup commands wrongly.
# The default value is: YES.
WARN_IF_DOC_ERROR = NO
# This WARN_NO_PARAMDOC option can be enabled to get warnings for functions that
# are documented, but have no documentation for their parameters or return
# value. If set to NO, doxygen will only warn about wrong or incomplete
# parameter documentation, but not about the absence of documentation.
# The default value is: NO.
WARN_NO_PARAMDOC = NO
# If the WARN_AS_ERROR tag is set to YES then doxygen will immediately stop when
# a warning is encountered.
# The default value is: NO.
WARN_AS_ERROR = NO
# The WARN_FORMAT tag determines the format of the warning messages that doxygen
# can produce. The string should contain the $file, $line, and $text tags, which
# will be replaced by the file and line number from which the warning originated
# and the warning text. Optionally the format may contain $version, which will
# be replaced by the version of the file (if it could be obtained via
# FILE_VERSION_FILTER)
# The default value is: $file:$line: $text.
WARN_FORMAT = "WARNING: $file:$line: $text"
# The WARN_LOGFILE tag can be used to specify a file to which warning and error
# messages should be written. If left blank the output is written to standard
# error (stderr).
WARN_LOGFILE =
#---------------------------------------------------------------------------
# Configuration options related to the input files
#---------------------------------------------------------------------------
# The INPUT tag is used to specify the files and/or directories that contain
# documented source files. You may enter file names like myfile.cpp or
# directories like /usr/src/myproject. Separate the files or directories with
# spaces. See also FILE_PATTERNS and EXTENSION_MAPPING
# Note: If this tag is empty the current directory is searched.
INPUT = ../src
# This tag can be used to specify the character encoding of the source files
# that doxygen parses. Internally doxygen uses the UTF-8 encoding. Doxygen uses
# libiconv (or the iconv built into libc) for the transcoding. See the libiconv
# documentation (see: http://www.gnu.org/software/libiconv) for the list of
# possible encodings.
# The default value is: UTF-8.
INPUT_ENCODING = UTF-8
# If the value of the INPUT tag contains directories, you can use the
# FILE_PATTERNS tag to specify one or more wildcard patterns (like *.cpp and
# *.h) to filter out the source-files in the directories.
#
# Note that for custom extensions or not directly supported extensions you also
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# read by doxygen.
#
# If left blank the following patterns are tested:*.c, *.cc, *.cxx, *.cpp,
# *.c++, *.java, *.ii, *.ixx, *.ipp, *.i++, *.inl, *.idl, *.ddl, *.odl, *.h,
# *.hh, *.hxx, *.hpp, *.h++, *.cs, *.d, *.php, *.php4, *.php5, *.phtml, *.inc,
# *.m, *.markdown, *.md, *.mm, *.dox, *.py, *.pyw, *.f90, *.f95, *.f03, *.f08,
# *.f, *.for, *.tcl, *.vhd, *.vhdl, *.ucf and *.qsf.
FILE_PATTERNS = *.h \
*.hh \
*.hxx \
*.hpp \
*.h++ \
# The RECURSIVE tag can be used to specify whether or not subdirectories should
# be searched for input files as well.
# The default value is: NO.
RECURSIVE = YES
# The EXCLUDE tag can be used to specify files and/or directories that should be
# excluded from the INPUT source files. This way you can easily exclude a
# subdirectory from a directory tree whose root is specified with the INPUT tag.
#
# Note that relative paths are relative to the directory from which doxygen is
# run.
EXCLUDE =
# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or
# directories that are symbolic links (a Unix file system feature) are excluded
# from the input.
# The default value is: NO.
EXCLUDE_SYMLINKS = NO
# If the value of the INPUT tag contains directories, you can use the
# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude
# certain files from those directories.
#
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories for example use the pattern */test/*
EXCLUDE_PATTERNS =
# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names
# (namespaces, classes, functions, etc.) that should be excluded from the
# output. The symbol name can be a fully qualified name, a word, or if the
# wildcard * is used, a substring. Examples: ANamespace, AClass,
# AClass::ANamespace, ANamespace::*Test
#
# Note that the wildcards are matched against the file with absolute path, so to
# exclude all test directories use the pattern */test/*
EXCLUDE_SYMBOLS =
# The EXAMPLE_PATH tag can be used to specify one or more files or directories
# that contain example code fragments that are included (see the \include
# command).
EXAMPLE_PATH =
# If the value of the EXAMPLE_PATH tag contains directories, you can use the
# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp and
# *.h) to filter out the source-files in the directories. If left blank all
# files are included.
EXAMPLE_PATTERNS = *
# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be
# searched for input files to be used with the \include or \dontinclude commands
# irrespective of the value of the RECURSIVE tag.
# The default value is: NO.
EXAMPLE_RECURSIVE = NO
# The IMAGE_PATH tag can be used to specify one or more files or directories
# that contain images that are to be included in the documentation (see the
# \image command).
IMAGE_PATH =
# The INPUT_FILTER tag can be used to specify a program that doxygen should
# invoke to filter for each input file. Doxygen will invoke the filter program
# by executing (via popen()) the command:
#
# <filter> <input-file>
#
# where <filter> is the value of the INPUT_FILTER tag, and <input-file> is the
# name of an input file. Doxygen will then use the output that the filter
# program writes to standard output. If FILTER_PATTERNS is specified, this tag
# will be ignored.
#
# Note that the filter must not add or remove lines; it is applied before the
# code is scanned, but not when the output code is generated. If lines are added
# or removed, the anchors will not be placed correctly.
#
# Note that for custom extensions or not directly supported extensions you also
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# properly processed by doxygen.
INPUT_FILTER =
# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern
# basis. Doxygen will compare the file name with each pattern and apply the
# filter if there is a match. The filters are a list of the form: pattern=filter
# (like *.cpp=my_cpp_filter). See INPUT_FILTER for further information on how
# filters are used. If the FILTER_PATTERNS tag is empty or if none of the
# patterns match the file name, INPUT_FILTER is applied.
#
# Note that for custom extensions or not directly supported extensions you also
# need to set EXTENSION_MAPPING for the extension otherwise the files are not
# properly processed by doxygen.
FILTER_PATTERNS =
# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using
# INPUT_FILTER) will also be used to filter the input files that are used for
# producing the source files to browse (i.e. when SOURCE_BROWSER is set to YES).
# The default value is: NO.
FILTER_SOURCE_FILES = NO
# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file
# pattern. A pattern will override the setting for FILTER_PATTERN (if any) and
# it is also possible to disable source filtering for a specific pattern using
# *.ext= (so without naming a filter).
# This tag requires that the tag FILTER_SOURCE_FILES is set to YES.
FILTER_SOURCE_PATTERNS =
# If the USE_MDFILE_AS_MAINPAGE tag refers to the name of a markdown file that
# is part of the input, its contents will be placed on the main page
# (index.html). This can be useful if you have a project on for instance GitHub
# and want to reuse the introduction page also for the doxygen output.
USE_MDFILE_AS_MAINPAGE =
#---------------------------------------------------------------------------
# Configuration options related to source browsing
#---------------------------------------------------------------------------
# If the SOURCE_BROWSER tag is set to YES then a list of source files will be
# generated. Documented entities will be cross-referenced with these sources.
#
# Note: To get rid of all source code in the generated output, make sure that
# also VERBATIM_HEADERS is set to NO.
# The default value is: NO.
SOURCE_BROWSER = NO
# Setting the INLINE_SOURCES tag to YES will include the body of functions,
# classes and enums directly into the documentation.
# The default value is: NO.
INLINE_SOURCES = NO
# Setting the STRIP_CODE_COMMENTS tag to YES will instruct doxygen to hide any
# special comment blocks from generated source code fragments. Normal C, C++ and
# Fortran comments will always remain visible.
# The default value is: YES.
STRIP_CODE_COMMENTS = YES
# If the REFERENCED_BY_RELATION tag is set to YES then for each documented
# function all documented functions referencing it will be listed.
# The default value is: NO.
REFERENCED_BY_RELATION = NO
# If the REFERENCES_RELATION tag is set to YES then for each documented function
# all documented entities called/used by that function will be listed.
# The default value is: NO.
REFERENCES_RELATION = NO
# If the REFERENCES_LINK_SOURCE tag is set to YES and SOURCE_BROWSER tag is set
# to YES then the hyperlinks from functions in REFERENCES_RELATION and
# REFERENCED_BY_RELATION lists will link to the source code. Otherwise they will
# link to the documentation.
# The default value is: YES.
REFERENCES_LINK_SOURCE = YES
# If SOURCE_TOOLTIPS is enabled (the default) then hovering a hyperlink in the
# source code will show a tooltip with additional information such as prototype,
# brief description and links to the definition and documentation. Since this
# will make the HTML file larger and loading of large files a bit slower, you
# can opt to disable this feature.
# The default value is: YES.
# This tag requires that the tag SOURCE_BROWSER is set to YES.
SOURCE_TOOLTIPS = YES
# If the USE_HTAGS tag is set to YES then the references to source code will
# point to the HTML generated by the htags(1) tool instead of doxygen built-in
# source browser. The htags tool is part of GNU's global source tagging system
# (see http://www.gnu.org/software/global/global.html). You will need version
# 4.8.6 or higher.
#
# To use it do the following:
# - Install the latest version of global
# - Enable SOURCE_BROWSER and USE_HTAGS in the config file
# - Make sure the INPUT points to the root of the source tree
# - Run doxygen as normal
#
# Doxygen will invoke htags (and that will in turn invoke gtags), so these
# tools must be available from the command line (i.e. in the search path).
#
# The result: instead of the source browser generated by doxygen, the links to
# source code will now point to the output of htags.
# The default value is: NO.
# This tag requires that the tag SOURCE_BROWSER is set to YES.
USE_HTAGS = NO
# If the VERBATIM_HEADERS tag is set the YES then doxygen will generate a
# verbatim copy of the header file for each class for which an include is
# specified. Set to NO to disable this.
# See also: Section \class.
# The default value is: YES.
VERBATIM_HEADERS = YES
# If the CLANG_ASSISTED_PARSING tag is set to YES then doxygen will use the
# clang parser (see: http://clang.llvm.org/) for more accurate parsing at the
# cost of reduced performance. This can be particularly helpful with template
# rich C++ code for which doxygen's built-in parser lacks the necessary type
# information.
# Note: The availability of this option depends on whether or not doxygen was
# generated with the -Duse-libclang=ON option for CMake.
# The default value is: NO.
CLANG_ASSISTED_PARSING = NO
# If clang assisted parsing is enabled you can provide the compiler with command
# line options that you would normally use when invoking the compiler. Note that
# the include paths will already be set by doxygen for the files and directories
# specified with INPUT and INCLUDE_PATH.
# This tag requires that the tag CLANG_ASSISTED_PARSING is set to YES.
CLANG_OPTIONS =
#---------------------------------------------------------------------------
# Configuration options related to the alphabetical class index
#---------------------------------------------------------------------------
# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index of all
# compounds will be generated. Enable this if the project contains a lot of
# classes, structs, unions or interfaces.
# The default value is: YES.
ALPHABETICAL_INDEX = YES
# The COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns in
# which the alphabetical index list will be split.
# Minimum value: 1, maximum value: 20, default value: 5.
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
COLS_IN_ALPHA_INDEX = 5
# In case all classes in a project start with a common prefix, all classes will
# be put under the same header in the alphabetical index. The IGNORE_PREFIX tag
# can be used to specify a prefix (or a list of prefixes) that should be ignored
# while generating the index headers.
# This tag requires that the tag ALPHABETICAL_INDEX is set to YES.
IGNORE_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the HTML output
#---------------------------------------------------------------------------
# If the GENERATE_HTML tag is set to YES, doxygen will generate HTML output
# The default value is: YES.
GENERATE_HTML = YES
# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
# it.
# The default directory is: html.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_OUTPUT = html
# The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
# generated HTML page (for example: .htm, .php, .asp).
# The default value is: .html.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_FILE_EXTENSION = .html
# The HTML_HEADER tag can be used to specify a user-defined HTML header file for
# each generated HTML page. If the tag is left blank doxygen will generate a
# standard header.
#
# To get valid HTML the header file that includes any scripts and style sheets
# that doxygen needs, which is dependent on the configuration options used (e.g.
# the setting GENERATE_TREEVIEW). It is highly recommended to start with a
# default header using
# doxygen -w html new_header.html new_footer.html new_stylesheet.css
# YourConfigFile
# and then modify the file new_header.html. See also section "Doxygen usage"
# for information on how to generate the default header that doxygen normally
# uses.
# Note: The header is subject to change so you typically have to regenerate the
# default header when upgrading to a newer version of doxygen. For a description
# of the possible markers and block names see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_HEADER =
# The HTML_FOOTER tag can be used to specify a user-defined HTML footer for each
# generated HTML page. If the tag is left blank doxygen will generate a standard
# footer. See HTML_HEADER for more information on how to generate a default
# footer and what special commands can be used inside the footer. See also
# section "Doxygen usage" for information on how to generate the default footer
# that doxygen normally uses.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_FOOTER =
# The HTML_STYLESHEET tag can be used to specify a user-defined cascading style
# sheet that is used by each HTML page. It can be used to fine-tune the look of
# the HTML output. If left blank doxygen will generate a default style sheet.
# See also section "Doxygen usage" for information on how to generate the style
# sheet that doxygen normally uses.
# Note: It is recommended to use HTML_EXTRA_STYLESHEET instead of this tag, as
# it is more robust and this tag (HTML_STYLESHEET) will in the future become
# obsolete.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_STYLESHEET =
# The HTML_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# cascading style sheets that are included after the standard style sheets
# created by doxygen. Using this option one can overrule certain style aspects.
# This is preferred over using HTML_STYLESHEET since it does not replace the
# standard style sheet and is therefore more robust against future updates.
# Doxygen will copy the style sheet files to the output directory.
# Note: The order of the extra style sheet files is of importance (e.g. the last
# style sheet in the list overrules the setting of the previous ones in the
# list). For an example see the documentation.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_STYLESHEET =
# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the HTML output directory. Note
# that these files will be copied to the base HTML output directory. Use the
# $relpath^ marker in the HTML_HEADER and/or HTML_FOOTER files to load these
# files. In the HTML_STYLESHEET file, use the file name only. Also note that the
# files will be copied as-is; there are no commands or markers available.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_EXTRA_FILES =
# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. Doxygen
# will adjust the colors in the style sheet and background images according to
# this color. Hue is specified as an angle on a colorwheel, see
# http://en.wikipedia.org/wiki/Hue for more information. For instance the value
# 0 represents red, 60 is yellow, 120 is green, 180 is cyan, 240 is blue, 300
# purple, and 360 is red again.
# Minimum value: 0, maximum value: 359, default value: 220.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_COLORSTYLE_HUE = 220
# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of the colors
# in the HTML output. For a value of 0 the output will use grayscales only. A
# value of 255 will produce the most vivid colors.
# Minimum value: 0, maximum value: 255, default value: 100.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_COLORSTYLE_SAT = 100
# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to the
# luminance component of the colors in the HTML output. Values below 100
# gradually make the output lighter, whereas values above 100 make the output
# darker. The value divided by 100 is the actual gamma applied, so 80 represents
# a gamma of 0.8, The value 220 represents a gamma of 2.2, and 100 does not
# change the gamma.
# Minimum value: 40, maximum value: 240, default value: 80.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_COLORSTYLE_GAMMA = 80
# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML
# page will contain the date and time when the page was generated. Setting this
# to YES can help to show when doxygen was last run and thus if the
# documentation is up to date.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_TIMESTAMP = NO
# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML
# documentation will contain sections that can be hidden and shown after the
# page has loaded.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_DYNAMIC_SECTIONS = NO
# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of entries
# shown in the various tree structured indices initially; the user can expand
# and collapse entries dynamically later on. Doxygen will expand the tree to
# such a level that at most the specified number of entries are visible (unless
# a fully collapsed tree already exceeds this amount). So setting the number of
# entries 1 will produce a full collapsed tree by default. 0 is a special value
# representing an infinite number of entries and will result in a full expanded
# tree by default.
# Minimum value: 0, maximum value: 9999, default value: 100.
# This tag requires that the tag GENERATE_HTML is set to YES.
HTML_INDEX_NUM_ENTRIES = 100
# If the GENERATE_DOCSET tag is set to YES, additional index files will be
# generated that can be used as input for Apple's Xcode 3 integrated development
# environment (see: http://developer.apple.com/tools/xcode/), introduced with
# OSX 10.5 (Leopard). To create a documentation set, doxygen will generate a
# Makefile in the HTML output directory. Running make will produce the docset in
# that directory and running make install will install the docset in
# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find it at
# startup. See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html
# for more information.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_DOCSET = NO
# This tag determines the name of the docset feed. A documentation feed provides
# an umbrella under which multiple documentation sets from a single provider
# (such as a company or product suite) can be grouped.
# The default value is: Doxygen generated docs.
# This tag requires that the tag GENERATE_DOCSET is set to YES.
DOCSET_FEEDNAME = "Doxygen generated docs"
# This tag specifies a string that should uniquely identify the documentation
# set bundle. This should be a reverse domain-name style string, e.g.
# com.mycompany.MyDocSet. Doxygen will append .docset to the name.
# The default value is: org.doxygen.Project.
# This tag requires that the tag GENERATE_DOCSET is set to YES.
DOCSET_BUNDLE_ID = org.doxygen.Project
# The DOCSET_PUBLISHER_ID tag specifies a string that should uniquely identify
# the documentation publisher. This should be a reverse domain-name style
# string, e.g. com.mycompany.MyDocSet.documentation.
# The default value is: org.doxygen.Publisher.
# This tag requires that the tag GENERATE_DOCSET is set to YES.
DOCSET_PUBLISHER_ID = org.doxygen.Publisher
# The DOCSET_PUBLISHER_NAME tag identifies the documentation publisher.
# The default value is: Publisher.
# This tag requires that the tag GENERATE_DOCSET is set to YES.
DOCSET_PUBLISHER_NAME = Publisher
# If the GENERATE_HTMLHELP tag is set to YES then doxygen generates three
# additional HTML index files: index.hhp, index.hhc, and index.hhk. The
# index.hhp is a project file that can be read by Microsoft's HTML Help Workshop
# (see: http://www.microsoft.com/en-us/download/details.aspx?id=21138) on
# Windows.
#
# The HTML Help Workshop contains a compiler that can convert all HTML output
# generated by doxygen into a single compiled HTML file (.chm). Compiled HTML
# files are now used as the Windows 98 help format, and will replace the old
# Windows help format (.hlp) on all Windows platforms in the future. Compressed
# HTML files also contain an index, a table of contents, and you can search for
# words in the documentation. The HTML workshop also contains a viewer for
# compressed HTML files.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_HTMLHELP = NO
# The CHM_FILE tag can be used to specify the file name of the resulting .chm
# file. You can add a path in front of the file if the result should not be
# written to the html output directory.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
CHM_FILE =
# The HHC_LOCATION tag can be used to specify the location (absolute path
# including file name) of the HTML help compiler (hhc.exe). If non-empty,
# doxygen will try to run the HTML help compiler on the generated index.hhp.
# The file has to be specified with full path.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
HHC_LOCATION =
# The GENERATE_CHI flag controls if a separate .chi index file is generated
# (YES) or that it should be included in the master .chm file (NO).
# The default value is: NO.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
GENERATE_CHI = NO
# The CHM_INDEX_ENCODING is used to encode HtmlHelp index (hhk), content (hhc)
# and project file content.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
CHM_INDEX_ENCODING =
# The BINARY_TOC flag controls whether a binary table of contents is generated
# (YES) or a normal table of contents (NO) in the .chm file. Furthermore it
# enables the Previous and Next buttons.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
BINARY_TOC = NO
# The TOC_EXPAND flag can be set to YES to add extra items for group members to
# the table of contents of the HTML help documentation and to the tree view.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTMLHELP is set to YES.
TOC_EXPAND = NO
# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and
# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated that
# can be used as input for Qt's qhelpgenerator to generate a Qt Compressed Help
# (.qch) of the generated HTML documentation.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_QHP = NO
# If the QHG_LOCATION tag is specified, the QCH_FILE tag can be used to specify
# the file name of the resulting .qch file. The path specified is relative to
# the HTML output folder.
# This tag requires that the tag GENERATE_QHP is set to YES.
QCH_FILE =
# The QHP_NAMESPACE tag specifies the namespace to use when generating Qt Help
# Project output. For more information please see Qt Help Project / Namespace
# (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#namespace).
# The default value is: org.doxygen.Project.
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_NAMESPACE = org.doxygen.Project
# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating Qt
# Help Project output. For more information please see Qt Help Project / Virtual
# Folders (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#virtual-
# folders).
# The default value is: doc.
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_VIRTUAL_FOLDER = doc
# If the QHP_CUST_FILTER_NAME tag is set, it specifies the name of a custom
# filter to add. For more information please see Qt Help Project / Custom
# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_CUST_FILTER_NAME =
# The QHP_CUST_FILTER_ATTRS tag specifies the list of the attributes of the
# custom filter to add. For more information please see Qt Help Project / Custom
# Filters (see: http://qt-project.org/doc/qt-4.8/qthelpproject.html#custom-
# filters).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_CUST_FILTER_ATTRS =
# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this
# project's filter section matches. Qt Help Project / Filter Attributes (see:
# http://qt-project.org/doc/qt-4.8/qthelpproject.html#filter-attributes).
# This tag requires that the tag GENERATE_QHP is set to YES.
QHP_SECT_FILTER_ATTRS =
# The QHG_LOCATION tag can be used to specify the location of Qt's
# qhelpgenerator. If non-empty doxygen will try to run qhelpgenerator on the
# generated .qhp file.
# This tag requires that the tag GENERATE_QHP is set to YES.
QHG_LOCATION =
# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files will be
# generated, together with the HTML files, they form an Eclipse help plugin. To
# install this plugin and make it available under the help contents menu in
# Eclipse, the contents of the directory containing the HTML and XML files needs
# to be copied into the plugins directory of eclipse. The name of the directory
# within the plugins directory should be the same as the ECLIPSE_DOC_ID value.
# After copying Eclipse needs to be restarted before the help appears.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_ECLIPSEHELP = NO
# A unique identifier for the Eclipse help plugin. When installing the plugin
# the directory name containing the HTML and XML files should also have this
# name. Each documentation set should have its own identifier.
# The default value is: org.doxygen.Project.
# This tag requires that the tag GENERATE_ECLIPSEHELP is set to YES.
ECLIPSE_DOC_ID = org.doxygen.Project
# If you want full control over the layout of the generated HTML pages it might
# be necessary to disable the index and replace it with your own. The
# DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) at top
# of each HTML page. A value of NO enables the index and the value YES disables
# it. Since the tabs in the index contain the same information as the navigation
# tree, you can set this option to YES if you also set GENERATE_TREEVIEW to YES.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
DISABLE_INDEX = NO
# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index
# structure should be generated to display hierarchical information. If the tag
# value is set to YES, a side panel will be generated containing a tree-like
# index structure (just like the one that is generated for HTML Help). For this
# to work a browser that supports JavaScript, DHTML, CSS and frames is required
# (i.e. any modern browser). Windows users are probably better off using the
# HTML help feature. Via custom style sheets (see HTML_EXTRA_STYLESHEET) one can
# further fine-tune the look of the index. As an example, the default style
# sheet generated by doxygen has an example that shows how to put an image at
# the root of the tree instead of the PROJECT_NAME. Since the tree basically has
# the same information as the tab index, you could consider setting
# DISABLE_INDEX to YES when enabling this option.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
GENERATE_TREEVIEW = YES
# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values that
# doxygen will group on one line in the generated HTML documentation.
#
# Note that a value of 0 will completely suppress the enum values from appearing
# in the overview section.
# Minimum value: 0, maximum value: 20, default value: 4.
# This tag requires that the tag GENERATE_HTML is set to YES.
ENUM_VALUES_PER_LINE = 4
# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be used
# to set the initial width (in pixels) of the frame in which the tree is shown.
# Minimum value: 0, maximum value: 1500, default value: 250.
# This tag requires that the tag GENERATE_HTML is set to YES.
TREEVIEW_WIDTH = 250
# If the EXT_LINKS_IN_WINDOW option is set to YES, doxygen will open links to
# external symbols imported via tag files in a separate window.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
EXT_LINKS_IN_WINDOW = NO
# Use this tag to change the font size of LaTeX formulas included as images in
# the HTML documentation. When you change the font size after a successful
# doxygen run you need to manually remove any form_*.png images from the HTML
# output directory to force them to be regenerated.
# Minimum value: 8, maximum value: 50, default value: 10.
# This tag requires that the tag GENERATE_HTML is set to YES.
FORMULA_FONTSIZE = 10
# Use the FORMULA_TRANPARENT tag to determine whether or not the images
# generated for formulas are transparent PNGs. Transparent PNGs are not
# supported properly for IE 6.0, but are supported on all modern browsers.
#
# Note that when changing this option you need to delete any form_*.png files in
# the HTML output directory before the changes have effect.
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.
FORMULA_TRANSPARENT = YES
# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax (see
# http://www.mathjax.org) which uses client side Javascript for the rendering
# instead of using pre-rendered bitmaps. Use this if you do not have LaTeX
# installed or if you want to formulas look prettier in the HTML output. When
# enabled you may also need to install MathJax separately and configure the path
# to it using the MATHJAX_RELPATH option.
# The default value is: NO.
# This tag requires that the tag GENERATE_HTML is set to YES.
USE_MATHJAX = NO
# When MathJax is enabled you can set the default output format to be used for
# the MathJax output. See the MathJax site (see:
# http://docs.mathjax.org/en/latest/output.html) for more details.
# Possible values are: HTML-CSS (which is slower, but has the best
# compatibility), NativeMML (i.e. MathML) and SVG.
# The default value is: HTML-CSS.
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_FORMAT = HTML-CSS
# When MathJax is enabled you need to specify the location relative to the HTML
# output directory using the MATHJAX_RELPATH option. The destination directory
# should contain the MathJax.js script. For instance, if the mathjax directory
# is located at the same level as the HTML output directory, then
# MATHJAX_RELPATH should be ../mathjax. The default value points to the MathJax
# Content Delivery Network so you can quickly see the result without installing
# MathJax. However, it is strongly recommended to install a local copy of
# MathJax from http://www.mathjax.org before deployment.
# The default value is: http://cdn.mathjax.org/mathjax/latest.
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest
# The MATHJAX_EXTENSIONS tag can be used to specify one or more MathJax
# extension names that should be enabled during MathJax rendering. For example
# MATHJAX_EXTENSIONS = TeX/AMSmath TeX/AMSsymbols
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_EXTENSIONS =
# The MATHJAX_CODEFILE tag can be used to specify a file with javascript pieces
# of code that will be used on startup of the MathJax code. See the MathJax site
# (see: http://docs.mathjax.org/en/latest/output.html) for more details. For an
# example see the documentation.
# This tag requires that the tag USE_MATHJAX is set to YES.
MATHJAX_CODEFILE =
# When the SEARCHENGINE tag is enabled doxygen will generate a search box for
# the HTML output. The underlying search engine uses javascript and DHTML and
# should work on any modern browser. Note that when using HTML help
# (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets (GENERATE_DOCSET)
# there is already a search function so this one should typically be disabled.
# For large projects the javascript based search engine can be slow, then
# enabling SERVER_BASED_SEARCH may provide a better solution. It is possible to
# search using the keyboard; to jump to the search box use <access key> + S
# (what the <access key> is depends on the OS and browser, but it is typically
# <CTRL>, <ALT>/<option>, or both). Inside the search box use the <cursor down
# key> to jump into the search results window, the results can be navigated
# using the <cursor keys>. Press <Enter> to select an item or <escape> to cancel
# the search. The filter options can be selected when the cursor is inside the
# search box by pressing <Shift>+<cursor down>. Also here use the <cursor keys>
# to select a filter and <Enter> or <escape> to activate or cancel the filter
# option.
# The default value is: YES.
# This tag requires that the tag GENERATE_HTML is set to YES.
SEARCHENGINE = YES
# When the SERVER_BASED_SEARCH tag is enabled the search engine will be
# implemented using a web server instead of a web client using Javascript. There
# are two flavors of web server based searching depending on the EXTERNAL_SEARCH
# setting. When disabled, doxygen will generate a PHP script for searching and
# an index file used by the script. When EXTERNAL_SEARCH is enabled the indexing
# and searching needs to be provided by external tools. See the section
# "External Indexing and Searching" for details.
# The default value is: NO.
# This tag requires that the tag SEARCHENGINE is set to YES.
SERVER_BASED_SEARCH = NO
# When EXTERNAL_SEARCH tag is enabled doxygen will no longer generate the PHP
# script for searching. Instead the search results are written to an XML file
# which needs to be processed by an external indexer. Doxygen will invoke an
# external search engine pointed to by the SEARCHENGINE_URL option to obtain the
# search results.
#
# Doxygen ships with an example indexer (doxyindexer) and search engine
# (doxysearch.cgi) which are based on the open source search engine library
# Xapian (see: http://xapian.org/).
#
# See the section "External Indexing and Searching" for details.
# The default value is: NO.
# This tag requires that the tag SEARCHENGINE is set to YES.
EXTERNAL_SEARCH = NO
# The SEARCHENGINE_URL should point to a search engine hosted by a web server
# which will return the search results when EXTERNAL_SEARCH is enabled.
#
# Doxygen ships with an example indexer (doxyindexer) and search engine
# (doxysearch.cgi) which are based on the open source search engine library
# Xapian (see: http://xapian.org/). See the section "External Indexing and
# Searching" for details.
# This tag requires that the tag SEARCHENGINE is set to YES.
SEARCHENGINE_URL =
# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed
# search data is written to a file for indexing by an external tool. With the
# SEARCHDATA_FILE tag the name of this file can be specified.
# The default file is: searchdata.xml.
# This tag requires that the tag SEARCHENGINE is set to YES.
SEARCHDATA_FILE = searchdata.xml
# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the
# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is
# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple
# projects and redirect the results back to the right project.
# This tag requires that the tag SEARCHENGINE is set to YES.
EXTERNAL_SEARCH_ID =
# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen
# projects other than the one defined by this configuration file, but that are
# all added to the same external search index. Each project needs to have a
# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id of
# to a relative location where the documentation can be found. The format is:
# EXTRA_SEARCH_MAPPINGS = tagname1=loc1 tagname2=loc2 ...
# This tag requires that the tag SEARCHENGINE is set to YES.
EXTRA_SEARCH_MAPPINGS =
#---------------------------------------------------------------------------
# Configuration options related to the LaTeX output
#---------------------------------------------------------------------------
# If the GENERATE_LATEX tag is set to YES, doxygen will generate LaTeX output.
# The default value is: YES.
GENERATE_LATEX = NO
# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
# it.
# The default directory is: latex.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_OUTPUT = latex
# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be
# invoked.
#
# Note that when enabling USE_PDFLATEX this option is only used for generating
# bitmaps for formulas in the HTML output, but not in the Makefile that is
# written to the output directory.
# The default file is: latex.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_CMD_NAME = latex
# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to generate
# index for LaTeX.
# The default file is: makeindex.
# This tag requires that the tag GENERATE_LATEX is set to YES.
MAKEINDEX_CMD_NAME = makeindex
# If the COMPACT_LATEX tag is set to YES, doxygen generates more compact LaTeX
# documents. This may be useful for small projects and may help to save some
# trees in general.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
COMPACT_LATEX = NO
# The PAPER_TYPE tag can be used to set the paper type that is used by the
# printer.
# Possible values are: a4 (210 x 297 mm), letter (8.5 x 11 inches), legal (8.5 x
# 14 inches) and executive (7.25 x 10.5 inches).
# The default value is: a4.
# This tag requires that the tag GENERATE_LATEX is set to YES.
PAPER_TYPE = a4
# The EXTRA_PACKAGES tag can be used to specify one or more LaTeX package names
# that should be included in the LaTeX output. The package can be specified just
# by its name or with the correct syntax as to be used with the LaTeX
# \usepackage command. To get the times font for instance you can specify :
# EXTRA_PACKAGES=times or EXTRA_PACKAGES={times}
# To use the option intlimits with the amsmath package you can specify:
# EXTRA_PACKAGES=[intlimits]{amsmath}
# If left blank no extra packages will be included.
# This tag requires that the tag GENERATE_LATEX is set to YES.
EXTRA_PACKAGES =
# The LATEX_HEADER tag can be used to specify a personal LaTeX header for the
# generated LaTeX document. The header should contain everything until the first
# chapter. If it is left blank doxygen will generate a standard header. See
# section "Doxygen usage" for information on how to let doxygen write the
# default header to a separate file.
#
# Note: Only use a user-defined header if you know what you are doing! The
# following commands have a special meaning inside the header: $title,
# $datetime, $date, $doxygenversion, $projectname, $projectnumber,
# $projectbrief, $projectlogo. Doxygen will replace $title with the empty
# string, for the replacement values of the other commands the user is referred
# to HTML_HEADER.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_HEADER =
# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for the
# generated LaTeX document. The footer should contain everything after the last
# chapter. If it is left blank doxygen will generate a standard footer. See
# LATEX_HEADER for more information on how to generate a default footer and what
# special commands can be used inside the footer.
#
# Note: Only use a user-defined footer if you know what you are doing!
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_FOOTER =
# The LATEX_EXTRA_STYLESHEET tag can be used to specify additional user-defined
# LaTeX style sheets that are included after the standard style sheets created
# by doxygen. Using this option one can overrule certain style aspects. Doxygen
# will copy the style sheet files to the output directory.
# Note: The order of the extra style sheet files is of importance (e.g. the last
# style sheet in the list overrules the setting of the previous ones in the
# list).
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_EXTRA_STYLESHEET =
# The LATEX_EXTRA_FILES tag can be used to specify one or more extra images or
# other source files which should be copied to the LATEX_OUTPUT output
# directory. Note that the files will be copied as-is; there are no commands or
# markers available.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_EXTRA_FILES =
# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated is
# prepared for conversion to PDF (using ps2pdf or pdflatex). The PDF file will
# contain links (just like the HTML output) instead of page references. This
# makes the output suitable for online browsing using a PDF viewer.
# The default value is: YES.
# This tag requires that the tag GENERATE_LATEX is set to YES.
PDF_HYPERLINKS = YES
# If the USE_PDFLATEX tag is set to YES, doxygen will use pdflatex to generate
# the PDF file directly from the LaTeX files. Set this option to YES, to get a
# higher quality PDF documentation.
# The default value is: YES.
# This tag requires that the tag GENERATE_LATEX is set to YES.
USE_PDFLATEX = YES
# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \batchmode
# command to the generated LaTeX files. This will instruct LaTeX to keep running
# if errors occur, instead of asking the user for help. This option is also used
# when generating formulas in HTML.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_BATCHMODE = NO
# If the LATEX_HIDE_INDICES tag is set to YES then doxygen will not include the
# index chapters (such as File Index, Compound Index, etc.) in the output.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_HIDE_INDICES = NO
# If the LATEX_SOURCE_CODE tag is set to YES then doxygen will include source
# code with syntax highlighting in the LaTeX output.
#
# Note that which sources are shown also depends on other settings such as
# SOURCE_BROWSER.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_SOURCE_CODE = NO
# The LATEX_BIB_STYLE tag can be used to specify the style to use for the
# bibliography, e.g. plainnat, or ieeetr. See
# http://en.wikipedia.org/wiki/BibTeX and \cite for more info.
# The default value is: plain.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_BIB_STYLE = plain
# If the LATEX_TIMESTAMP tag is set to YES then the footer of each generated
# page will contain the date and time when the page was generated. Setting this
# to NO can help when comparing the output of multiple runs.
# The default value is: NO.
# This tag requires that the tag GENERATE_LATEX is set to YES.
LATEX_TIMESTAMP = NO
#---------------------------------------------------------------------------
# Configuration options related to the RTF output
#---------------------------------------------------------------------------
# If the GENERATE_RTF tag is set to YES, doxygen will generate RTF output. The
# RTF output is optimized for Word 97 and may not look too pretty with other RTF
# readers/editors.
# The default value is: NO.
GENERATE_RTF = NO
# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
# it.
# The default directory is: rtf.
# This tag requires that the tag GENERATE_RTF is set to YES.
RTF_OUTPUT = rtf
# If the COMPACT_RTF tag is set to YES, doxygen generates more compact RTF
# documents. This may be useful for small projects and may help to save some
# trees in general.
# The default value is: NO.
# This tag requires that the tag GENERATE_RTF is set to YES.
COMPACT_RTF = NO
# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated will
# contain hyperlink fields. The RTF file will contain links (just like the HTML
# output) instead of page references. This makes the output suitable for online
# browsing using Word or some other Word compatible readers that support those
# fields.
#
# Note: WordPad (write) and others do not support links.
# The default value is: NO.
# This tag requires that the tag GENERATE_RTF is set to YES.
RTF_HYPERLINKS = NO
# Load stylesheet definitions from file. Syntax is similar to doxygen's config
# file, i.e. a series of assignments. You only have to provide replacements,
# missing definitions are set to their default value.
#
# See also section "Doxygen usage" for information on how to generate the
# default style sheet that doxygen normally uses.
# This tag requires that the tag GENERATE_RTF is set to YES.
RTF_STYLESHEET_FILE =
# Set optional variables used in the generation of an RTF document. Syntax is
# similar to doxygen's config file. A template extensions file can be generated
# using doxygen -e rtf extensionFile.
# This tag requires that the tag GENERATE_RTF is set to YES.
RTF_EXTENSIONS_FILE =
# If the RTF_SOURCE_CODE tag is set to YES then doxygen will include source code
# with syntax highlighting in the RTF output.
#
# Note that which sources are shown also depends on other settings such as
# SOURCE_BROWSER.
# The default value is: NO.
# This tag requires that the tag GENERATE_RTF is set to YES.
RTF_SOURCE_CODE = NO
#---------------------------------------------------------------------------
# Configuration options related to the man page output
#---------------------------------------------------------------------------
# If the GENERATE_MAN tag is set to YES, doxygen will generate man pages for
# classes and files.
# The default value is: NO.
GENERATE_MAN = NO
# The MAN_OUTPUT tag is used to specify where the man pages will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
# it. A directory man3 will be created inside the directory specified by
# MAN_OUTPUT.
# The default directory is: man.
# This tag requires that the tag GENERATE_MAN is set to YES.
MAN_OUTPUT = man
# The MAN_EXTENSION tag determines the extension that is added to the generated
# man pages. In case the manual section does not start with a number, the number
# 3 is prepended. The dot (.) at the beginning of the MAN_EXTENSION tag is
# optional.
# The default value is: .3.
# This tag requires that the tag GENERATE_MAN is set to YES.
MAN_EXTENSION = .3
# The MAN_SUBDIR tag determines the name of the directory created within
# MAN_OUTPUT in which the man pages are placed. If defaults to man followed by
# MAN_EXTENSION with the initial . removed.
# This tag requires that the tag GENERATE_MAN is set to YES.
MAN_SUBDIR =
# If the MAN_LINKS tag is set to YES and doxygen generates man output, then it
# will generate one additional man file for each entity documented in the real
# man page(s). These additional files only source the real man page, but without
# them the man command would be unable to find the correct page.
# The default value is: NO.
# This tag requires that the tag GENERATE_MAN is set to YES.
MAN_LINKS = NO
#---------------------------------------------------------------------------
# Configuration options related to the XML output
#---------------------------------------------------------------------------
# If the GENERATE_XML tag is set to YES, doxygen will generate an XML file that
# captures the structure of the code including all documentation.
# The default value is: NO.
GENERATE_XML = YES
# The XML_OUTPUT tag is used to specify where the XML pages will be put. If a
# relative path is entered the value of OUTPUT_DIRECTORY will be put in front of
# it.
# The default directory is: xml.
# This tag requires that the tag GENERATE_XML is set to YES.
XML_OUTPUT = xml
# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
# listings (including syntax highlighting and cross-referencing information) to
# the XML output. Note that enabling this will significantly increase the size
# of the XML output.
# The default value is: YES.
# This tag requires that the tag GENERATE_XML is set to YES.
XML_PROGRAMLISTING = YES
#---------------------------------------------------------------------------
# Configuration options related to the DOCBOOK output
#---------------------------------------------------------------------------
# If the GENERATE_DOCBOOK tag is set to YES, doxygen will generate Docbook files
# that can be used to generate PDF.
# The default value is: NO.
GENERATE_DOCBOOK = NO
# The DOCBOOK_OUTPUT tag is used to specify where the Docbook pages will be put.
# If a relative path is entered the value of OUTPUT_DIRECTORY will be put in
# front of it.
# The default directory is: docbook.
# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
DOCBOOK_OUTPUT = docbook
# If the DOCBOOK_PROGRAMLISTING tag is set to YES, doxygen will include the
# program listings (including syntax highlighting and cross-referencing
# information) to the DOCBOOK output. Note that enabling this will significantly
# increase the size of the DOCBOOK output.
# The default value is: NO.
# This tag requires that the tag GENERATE_DOCBOOK is set to YES.
DOCBOOK_PROGRAMLISTING = NO
#---------------------------------------------------------------------------
# Configuration options for the AutoGen Definitions output
#---------------------------------------------------------------------------
# If the GENERATE_AUTOGEN_DEF tag is set to YES, doxygen will generate an
# AutoGen Definitions (see http://autogen.sf.net) file that captures the
# structure of the code including all documentation. Note that this feature is
# still experimental and incomplete at the moment.
# The default value is: NO.
GENERATE_AUTOGEN_DEF = NO
#---------------------------------------------------------------------------
# Configuration options related to the Perl module output
#---------------------------------------------------------------------------
# If the GENERATE_PERLMOD tag is set to YES, doxygen will generate a Perl module
# file that captures the structure of the code including all documentation.
#
# Note that this feature is still experimental and incomplete at the moment.
# The default value is: NO.
GENERATE_PERLMOD = NO
# If the PERLMOD_LATEX tag is set to YES, doxygen will generate the necessary
# Makefile rules, Perl scripts and LaTeX code to be able to generate PDF and DVI
# output from the Perl module output.
# The default value is: NO.
# This tag requires that the tag GENERATE_PERLMOD is set to YES.
PERLMOD_LATEX = NO
# If the PERLMOD_PRETTY tag is set to YES, the Perl module output will be nicely
# formatted so it can be parsed by a human reader. This is useful if you want to
# understand what is going on. On the other hand, if this tag is set to NO, the
# size of the Perl module output will be much smaller and Perl will parse it
# just the same.
# The default value is: YES.
# This tag requires that the tag GENERATE_PERLMOD is set to YES.
PERLMOD_PRETTY = YES
# The names of the make variables in the generated doxyrules.make file are
# prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. This is useful
# so different doxyrules.make files included by the same Makefile don't
# overwrite each other's variables.
# This tag requires that the tag GENERATE_PERLMOD is set to YES.
PERLMOD_MAKEVAR_PREFIX =
#---------------------------------------------------------------------------
# Configuration options related to the preprocessor
#---------------------------------------------------------------------------
# If the ENABLE_PREPROCESSING tag is set to YES, doxygen will evaluate all
# C-preprocessor directives found in the sources and include files.
# The default value is: YES.
ENABLE_PREPROCESSING = NO
# If the MACRO_EXPANSION tag is set to YES, doxygen will expand all macro names
# in the source code. If set to NO, only conditional compilation will be
# performed. Macro expansion can be done in a controlled way by setting
# EXPAND_ONLY_PREDEF to YES.
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
MACRO_EXPANSION = NO
# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES then
# the macro expansion is limited to the macros specified with the PREDEFINED and
# EXPAND_AS_DEFINED tags.
# The default value is: NO.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
EXPAND_ONLY_PREDEF = NO
# If the SEARCH_INCLUDES tag is set to YES, the include files in the
# INCLUDE_PATH will be searched if a #include is found.
# The default value is: YES.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
SEARCH_INCLUDES = YES
# The INCLUDE_PATH tag can be used to specify one or more directories that
# contain include files that are not input files but should be processed by the
# preprocessor.
# This tag requires that the tag SEARCH_INCLUDES is set to YES.
INCLUDE_PATH =
# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard
# patterns (like *.h and *.hpp) to filter out the header-files in the
# directories. If left blank, the patterns specified with FILE_PATTERNS will be
# used.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
INCLUDE_FILE_PATTERNS =
# The PREDEFINED tag can be used to specify one or more macro names that are
# defined before the preprocessor is started (similar to the -D option of e.g.
# gcc). The argument of the tag is a list of macros of the form: name or
# name=definition (no spaces). If the definition and the "=" are omitted, "=1"
# is assumed. To prevent a macro definition from being undefined via #undef or
# recursively expanded use the := operator instead of the = operator.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
PREDEFINED =
# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then this
# tag can be used to specify a list of macro names that should be expanded. The
# macro definition that is found in the sources will be used. Use the PREDEFINED
# tag if you want to use a different macro definition that overrules the
# definition found in the source code.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
EXPAND_AS_DEFINED =
# If the SKIP_FUNCTION_MACROS tag is set to YES then doxygen's preprocessor will
# remove all references to function-like macros that are alone on a line, have
# an all uppercase name, and do not end with a semicolon. Such function macros
# are typically used for boiler-plate code, and will confuse the parser if not
# removed.
# The default value is: YES.
# This tag requires that the tag ENABLE_PREPROCESSING is set to YES.
SKIP_FUNCTION_MACROS = YES
#---------------------------------------------------------------------------
# Configuration options related to external references
#---------------------------------------------------------------------------
# The TAGFILES tag can be used to specify one or more tag files. For each tag
# file the location of the external documentation should be added. The format of
# a tag file without this location is as follows:
# TAGFILES = file1 file2 ...
# Adding location for the tag files is done as follows:
# TAGFILES = file1=loc1 "file2 = loc2" ...
# where loc1 and loc2 can be relative or absolute paths or URLs. See the
# section "Linking to external documentation" for more information about the use
# of tag files.
# Note: Each tag file must have a unique name (where the name does NOT include
# the path). If a tag file is not located in the directory in which doxygen is
# run, you must also specify the path to the tagfile here.
TAGFILES =
# When a file name is specified after GENERATE_TAGFILE, doxygen will create a
# tag file that is based on the input files it reads. See section "Linking to
# external documentation" for more information about the usage of tag files.
GENERATE_TAGFILE =
# If the ALLEXTERNALS tag is set to YES, all external class will be listed in
# the class index. If set to NO, only the inherited external classes will be
# listed.
# The default value is: NO.
ALLEXTERNALS = NO
# If the EXTERNAL_GROUPS tag is set to YES, all external groups will be listed
# in the modules index. If set to NO, only the current project's groups will be
# listed.
# The default value is: YES.
EXTERNAL_GROUPS = YES
# If the EXTERNAL_PAGES tag is set to YES, all external pages will be listed in
# the related pages index. If set to NO, only the current project's pages will
# be listed.
# The default value is: YES.
EXTERNAL_PAGES = YES
# The PERL_PATH should be the absolute path and name of the perl script
# interpreter (i.e. the result of 'which perl').
# The default file (with absolute path) is: /usr/bin/perl.
PERL_PATH = /usr/bin/perl
#---------------------------------------------------------------------------
# Configuration options related to the dot tool
#---------------------------------------------------------------------------
# If the CLASS_DIAGRAMS tag is set to YES, doxygen will generate a class diagram
# (in HTML and LaTeX) for classes with base or super classes. Setting the tag to
# NO turns the diagrams off. Note that this option also works with HAVE_DOT
# disabled, but it is recommended to install and use dot, since it yields more
# powerful graphs.
# The default value is: YES.
CLASS_DIAGRAMS = YES
# You can define message sequence charts within doxygen comments using the \msc
# command. Doxygen will then run the mscgen tool (see:
# http://www.mcternan.me.uk/mscgen/)) to produce the chart and insert it in the
# documentation. The MSCGEN_PATH tag allows you to specify the directory where
# the mscgen tool resides. If left empty the tool is assumed to be found in the
# default search path.
MSCGEN_PATH =
# You can include diagrams made with dia in doxygen documentation. Doxygen will
# then run dia to produce the diagram and insert it in the documentation. The
# DIA_PATH tag allows you to specify the directory where the dia binary resides.
# If left empty dia is assumed to be found in the default search path.
DIA_PATH =
# If set to YES the inheritance and collaboration graphs will hide inheritance
# and usage relations if the target is undocumented or is not a class.
# The default value is: YES.
HIDE_UNDOC_RELATIONS = YES
# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is
# available from the path. This tool is part of Graphviz (see:
# http://www.graphviz.org/), a graph visualization toolkit from AT&T and Lucent
# Bell Labs. The other options in this section have no effect if this option is
# set to NO
# The default value is: YES.
HAVE_DOT = NO
# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is allowed
# to run in parallel. When set to 0 doxygen will base this on the number of
# processors available in the system. You can set it explicitly to a value
# larger than 0 to get control over the balance between CPU load and processing
# speed.
# Minimum value: 0, maximum value: 32, default value: 0.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_NUM_THREADS = 0
# When you want a differently looking font in the dot files that doxygen
# generates you can specify the font name using DOT_FONTNAME. You need to make
# sure dot is able to find the font, which can be done by putting it in a
# standard location or by setting the DOTFONTPATH environment variable or by
# setting DOT_FONTPATH to the directory containing the font.
# The default value is: Helvetica.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_FONTNAME = Helvetica
# The DOT_FONTSIZE tag can be used to set the size (in points) of the font of
# dot graphs.
# Minimum value: 4, maximum value: 24, default value: 10.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_FONTSIZE = 10
# By default doxygen will tell dot to use the default font as specified with
# DOT_FONTNAME. If you specify a different font using DOT_FONTNAME you can set
# the path where dot can find it using this tag.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_FONTPATH =
# If the CLASS_GRAPH tag is set to YES then doxygen will generate a graph for
# each documented class showing the direct and indirect inheritance relations.
# Setting this tag to YES will force the CLASS_DIAGRAMS tag to NO.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
CLASS_GRAPH = YES
# If the COLLABORATION_GRAPH tag is set to YES then doxygen will generate a
# graph for each documented class showing the direct and indirect implementation
# dependencies (inheritance, containment, and class references variables) of the
# class with other documented classes.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
COLLABORATION_GRAPH = YES
# If the GROUP_GRAPHS tag is set to YES then doxygen will generate a graph for
# groups, showing the direct groups dependencies.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
GROUP_GRAPHS = YES
# If the UML_LOOK tag is set to YES, doxygen will generate inheritance and
# collaboration diagrams in a style similar to the OMG's Unified Modeling
# Language.
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
UML_LOOK = NO
# If the UML_LOOK tag is enabled, the fields and methods are shown inside the
# class node. If there are many fields or methods and many nodes the graph may
# become too big to be useful. The UML_LIMIT_NUM_FIELDS threshold limits the
# number of items for each type to make the size more manageable. Set this to 0
# for no limit. Note that the threshold may be exceeded by 50% before the limit
# is enforced. So when you set the threshold to 10, up to 15 fields may appear,
# but if the number exceeds 15, the total amount of fields shown is limited to
# 10.
# Minimum value: 0, maximum value: 100, default value: 10.
# This tag requires that the tag HAVE_DOT is set to YES.
UML_LIMIT_NUM_FIELDS = 10
# If the TEMPLATE_RELATIONS tag is set to YES then the inheritance and
# collaboration graphs will show the relations between templates and their
# instances.
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
TEMPLATE_RELATIONS = NO
# If the INCLUDE_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are set to
# YES then doxygen will generate a graph for each documented file showing the
# direct and indirect include dependencies of the file with other documented
# files.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
INCLUDE_GRAPH = YES
# If the INCLUDED_BY_GRAPH, ENABLE_PREPROCESSING and SEARCH_INCLUDES tags are
# set to YES then doxygen will generate a graph for each documented file showing
# the direct and indirect include dependencies of the file with other documented
# files.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
INCLUDED_BY_GRAPH = YES
# If the CALL_GRAPH tag is set to YES then doxygen will generate a call
# dependency graph for every global function or class method.
#
# Note that enabling this option will significantly increase the time of a run.
# So in most cases it will be better to enable call graphs for selected
# functions only using the \callgraph command. Disabling a call graph can be
# accomplished by means of the command \hidecallgraph.
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
CALL_GRAPH = NO
# If the CALLER_GRAPH tag is set to YES then doxygen will generate a caller
# dependency graph for every global function or class method.
#
# Note that enabling this option will significantly increase the time of a run.
# So in most cases it will be better to enable caller graphs for selected
# functions only using the \callergraph command. Disabling a caller graph can be
# accomplished by means of the command \hidecallergraph.
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
CALLER_GRAPH = NO
# If the GRAPHICAL_HIERARCHY tag is set to YES then doxygen will graphical
# hierarchy of all classes instead of a textual one.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
GRAPHICAL_HIERARCHY = YES
# If the DIRECTORY_GRAPH tag is set to YES then doxygen will show the
# dependencies a directory has on other directories in a graphical way. The
# dependency relations are determined by the #include relations between the
# files in the directories.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
DIRECTORY_GRAPH = YES
# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images
# generated by dot. For an explanation of the image formats see the section
# output formats in the documentation of the dot tool (Graphviz (see:
# http://www.graphviz.org/)).
# Note: If you choose svg you need to set HTML_FILE_EXTENSION to xhtml in order
# to make the SVG files visible in IE 9+ (other browsers do not have this
# requirement).
# Possible values are: png, png:cairo, png:cairo:cairo, png:cairo:gd, png:gd,
# png:gd:gd, jpg, jpg:cairo, jpg:cairo:gd, jpg:gd, jpg:gd:gd, gif, gif:cairo,
# gif:cairo:gd, gif:gd, gif:gd:gd, svg, png:gd, png:gd:gd, png:cairo,
# png:cairo:gd, png:cairo:cairo, png:cairo:gdiplus, png:gdiplus and
# png:gdiplus:gdiplus.
# The default value is: png.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_IMAGE_FORMAT = png
# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to
# enable generation of interactive SVG images that allow zooming and panning.
#
# Note that this requires a modern browser other than Internet Explorer. Tested
# and working are Firefox, Chrome, Safari, and Opera.
# Note: For IE 9+ you need to set HTML_FILE_EXTENSION to xhtml in order to make
# the SVG files visible. Older versions of IE do not have SVG support.
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
INTERACTIVE_SVG = NO
# The DOT_PATH tag can be used to specify the path where the dot tool can be
# found. If left blank, it is assumed the dot tool can be found in the path.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_PATH =
# The DOTFILE_DIRS tag can be used to specify one or more directories that
# contain dot files that are included in the documentation (see the \dotfile
# command).
# This tag requires that the tag HAVE_DOT is set to YES.
DOTFILE_DIRS =
# The MSCFILE_DIRS tag can be used to specify one or more directories that
# contain msc files that are included in the documentation (see the \mscfile
# command).
MSCFILE_DIRS =
# The DIAFILE_DIRS tag can be used to specify one or more directories that
# contain dia files that are included in the documentation (see the \diafile
# command).
DIAFILE_DIRS =
# When using plantuml, the PLANTUML_JAR_PATH tag should be used to specify the
# path where java can find the plantuml.jar file. If left blank, it is assumed
# PlantUML is not used or called during a preprocessing step. Doxygen will
# generate a warning when it encounters a \startuml command in this case and
# will not generate output for the diagram.
PLANTUML_JAR_PATH =
# When using plantuml, the PLANTUML_CFG_FILE tag can be used to specify a
# configuration file for plantuml.
PLANTUML_CFG_FILE =
# When using plantuml, the specified paths are searched for files specified by
# the !include statement in a plantuml block.
PLANTUML_INCLUDE_PATH =
# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of nodes
# that will be shown in the graph. If the number of nodes in a graph becomes
# larger than this value, doxygen will truncate the graph, which is visualized
# by representing a node as a red box. Note that doxygen if the number of direct
# children of the root node in a graph is already larger than
# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note that
# the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH.
# Minimum value: 0, maximum value: 10000, default value: 50.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_GRAPH_MAX_NODES = 50
# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the graphs
# generated by dot. A depth value of 3 means that only nodes reachable from the
# root by following a path via at most 3 edges will be shown. Nodes that lay
# further from the root node will be omitted. Note that setting this option to 1
# or 2 may greatly reduce the computation time needed for large code bases. Also
# note that the size of a graph can be further restricted by
# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction.
# Minimum value: 0, maximum value: 1000, default value: 0.
# This tag requires that the tag HAVE_DOT is set to YES.
MAX_DOT_GRAPH_DEPTH = 0
# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent
# background. This is disabled by default, because dot on Windows does not seem
# to support this out of the box.
#
# Warning: Depending on the platform used, enabling this option may lead to
# badly anti-aliased labels on the edges of a graph (i.e. they become hard to
# read).
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_TRANSPARENT = NO
# Set the DOT_MULTI_TARGETS tag to YES to allow dot to generate multiple output
# files in one run (i.e. multiple -o and -T options on the command line). This
# makes dot run faster, but since only newer versions of dot (>1.8.10) support
# this, this feature is disabled by default.
# The default value is: NO.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_MULTI_TARGETS = NO
# If the GENERATE_LEGEND tag is set to YES doxygen will generate a legend page
# explaining the meaning of the various boxes and arrows in the dot generated
# graphs.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
GENERATE_LEGEND = YES
# If the DOT_CLEANUP tag is set to YES, doxygen will remove the intermediate dot
# files that are used to generate the various graphs.
# The default value is: YES.
# This tag requires that the tag HAVE_DOT is set to YES.
DOT_CLEANUP = YES
|
train_000.parquet/916
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/scripts/Doxyfile",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 107265,
"token_count": 31830
}
|
# Contributor Covenant Code of Conduct
## Our Pledge
In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation.
## Our Standards
Examples of behavior that contributes to creating a positive environment include:
* Using welcoming and inclusive language
* Being respectful of differing viewpoints and experiences
* Gracefully accepting constructive criticism
* Focusing on what is best for the community
* Showing empathy towards other community members
Examples of unacceptable behavior by participants include:
* The use of sexualized language or imagery and unwelcome sexual attention or advances
* Trolling, insulting/derogatory comments, and personal or political attacks
* Public or private harassment
* Publishing others' private information, such as a physical or electronic address, without explicit permission
* Other conduct which could reasonably be considered inappropriate in a professional setting
## Our Responsibilities
Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior.
Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful.
## Scope
This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers.
## Enforcement
Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at [atom@github.com](mailto:atom@github.com). All complaints will be reviewed and investigated and will result in a response that is deemed necessary and appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately.
Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership.
## Attribution
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version]
[homepage]: http://contributor-covenant.org
[version]: http://contributor-covenant.org/version/1/4/
|
train_000.parquet/917
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/docs/CODE_OF_CONDUCT.md",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 3245,
"token_count": 691
}
|
# Coding style
## File format
Use [lv_misc/lv_templ.c](https://github.com/lvgl/lvgl/blob/master/src/lv_misc/lv_templ.c) and [lv_misc/lv_templ.h](https://github.com/lvgl/lvgl/blob/master/src/lv_misc/lv_templ.h)
## Naming conventions
* Words are separated by '_'
* In variable and function names use only lower case letters (e.g. *height_tmp*)
* In enums and defines use only upper case letters (e.g. *e.g. MAX_LINE_NUM*)
* Global names (API):
* starts with *lv*
* followed by module name: *btn*, *label*, *style* etc.
* followed by the action (for functions): *set*, *get*, *refr* etc.
* closed with the subject: *name*, *size*, *state* etc.
* Typedefs
* prefer `typedef struct` and `typedef enum` instead of `struct name` and `enum name`
* always end `typedef struct` and `typedef enum` type names with `_t`
* Abbreviations:
* Only words longer or equal than 6 characters can be abbreviated.
* Abbreviate only if it makes the word at least half as long
* Use only very straightforward and well-known abbreviations (e.g. pos: position, def: default, btn: button)
## Coding guide
* Functions:
* Try to write function shorter than is 50 lines
* Always shorter than 200 lines (except very straightforwards)
* Variables:
* One line, one declaration (BAD: char x, y;)
* Use `<stdint.h>` (*uint8_t*, *int32_t* etc)
* Declare variables where needed (not all at function start)
* Use the smallest required scope
* Variables in a file (outside functions) are always *static*
* Do not use global variables (use functions to set/get static variables)
## Comments
Before every function have a comment like this:
```c
/**
* Return with the screen of an object
* @param obj pointer to an object
* @return pointer to a screen
*/
lv_obj_t * lv_obj_get_scr(lv_obj_t * obj);
```
Always use `/* Something */` format and NOT `//Something`
Write readable code to avoid descriptive comments like:
`x++; /* Add 1 to x */`.
The code should show clearly what you are doing.
You should write **why** have you done this:
`x++; /*Because of closing '\0' of the string */`
Short "code summaries" of a few lines are accepted. E.g. `/*Calculate the new coordinates*/`
In comments use \` \` when referring to a variable. E.g. ``/*Update the value of `x_act`*/``
### Formatting
Here is example to show bracket placing and using of white spaces:
```c
/**
* Set a new text for a label. Memory will be allocated to store the text by the label.
* @param label pointer to a label object
* @param text '\0' terminated character string. NULL to refresh with the current text.
*/
void lv_label_set_text(lv_obj_t * label, const char * text)
{ /* Main brackets of functions in new line*/
if(label == NULL) return; /*No bracket only if the command is inline with the if statement*/
lv_obj_inv(label);
lv_label_ext_t * ext = lv_obj_get_ext(label);
/*Comment before a section */
if(text == ext->txt || text == NULL) { /*Bracket of statements start inline*/
lv_label_refr_text(label);
return;
}
...
}
```
Use 4 spaces indentation instead of tab.
You can use **astyle** to format the code. Run `code-formatter.sh` from the `scrips` folder.
|
train_000.parquet/918
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/docs/CODING_STYLE.md",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 3227,
"token_count": 1073
}
|
# Roadmap
This is a summary for thenew fatures of the major releases and a collection of ideas.
This list indicates only the current intention and can be changed.
## v8
Planned to September/October 2020
- New scrolling:
- See [feat/new-scroll](https://github.com/lvgl/lvgl/tree/feat/new-scroll) branch and [#1614](https://github.com/lvgl/lvgl/issues/1614)) issue.
- Remove `lv_page` and support scrolling on `lv_obj`
- Support "elastic" scrolling when scrolled in
- Support scroll chaining among any objects types (not only `lv_pages`s)
- Remove `lv_drag`. Similar effect can be achieved by setting the position in `LV_EVENT_PRESSING`
- Add snapping?
- Already working
- New layouts:
- See [#1615](https://github.com/lvgl/lvgl/issues/1615) issue
- [CSS Flexbox](https://css-tricks.com/snippets/css/a-guide-to-flexbox/)-like layout support
- Besides setting width/height in `px` add support to `partent percentage` and `screen percentage`.
- Work in progress
- Simplified File system interface ([feat/new_fs_api](https://github.com/lvgl/lvgl/tree/feat/new-fs-api) branch) to make porting easier
- Work in progress
- Add new label alignment modes
- See [#1656](https://github.com/lvgl/lvgl/issues/1656)
- Remove the align parameter from `lv_canvas_draw_text`
## v9
- Simplify `group`s. Discussion is [here](https://forum.lvgl.io/t/lv-group-tabindex/2927/3).
## Ideas
- Unit testing (gtest?). See [#1658](https://github.com/lvgl/lvgl/issues/1658)
- Benchmarking (gem5?). See [#1660](https://github.com/lvgl/lvgl/issues/1660)
- CPP binding. See [Forum](https://forum.lvgl.io/t/is-it-possible-to-officially-support-optional-cpp-api/2736)
- Optmize font decompression
- Switch to RGBA colors in styles
- Need coverage report for tests
- Need static analize (via coverity.io or somehing else)
- Support dot_begin and dot_middle long modes for labels
|
train_000.parquet/919
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/docs/ROADMAP.md",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 1876,
"token_count": 680
}
|
/**
* @file lv_api_map.h
*
*/
#ifndef LV_API_MAP_H
#define LV_API_MAP_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lvgl.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/*---------------------
* V6.0 COMPATIBILITY
*--------------------*/
#if LV_USE_API_EXTENSION_V6
static inline void lv_task_once(lv_task_t * task)
{
lv_task_set_repeat_count(task, 1);
}
#if LV_USE_CHECKBOX
#define lv_checkbox_set_static_text lv_checkbox_set_text_static
#endif
#if LV_USE_CHART
#define lv_chart_get_point_cnt lv_chart_get_point_count
#endif
#if LV_USE_DROPDOWN
static inline void lv_dropdown_set_draw_arrow(lv_obj_t * ddlist, bool en)
{
if(en) lv_dropdown_set_symbol(ddlist, LV_SYMBOL_DOWN);
else lv_dropdown_set_symbol(ddlist, NULL);
}
static inline bool lv_dropdown_get_draw_arrow(lv_obj_t * ddlist)
{
if(lv_dropdown_get_symbol(ddlist)) return true;
else return false;
}
#define lv_dropdown_set_static_options lv_dropdown_set_options_static
#endif
#if LV_USE_BAR
/**
* Make the bar symmetric to zero. The indicator will grow from zero instead of the minimum
* position.
* @param bar pointer to a bar object
* @param en true: enable disable symmetric behavior; false: disable
* @deprecated As of v7.0, you should use `lv_bar_set_type` instead.
*/
static inline void lv_bar_set_sym(lv_obj_t * bar, bool en)
{
if(en)
lv_bar_set_type(bar, LV_BAR_TYPE_SYMMETRICAL);
else
lv_bar_set_type(bar, LV_BAR_TYPE_NORMAL);
}
/**
* Get whether the bar is symmetric or not.
* @param bar pointer to a bar object
* @return true: symmetric is enabled; false: disable
* @deprecated As of v7.0, you should use `lv_bar_get_type` instead.
*/
static inline bool lv_bar_get_sym(lv_obj_t * bar)
{
return lv_bar_get_type(bar) == LV_BAR_TYPE_SYMMETRICAL;
}
#endif
#if LV_USE_LABEL
#define lv_label_set_static_text lv_label_set_text_static
#endif
#if LV_USE_SLIDER
/**
* Make the slider symmetric to zero. The indicator will grow from zero instead of the minimum
* position.
* @param slider pointer to a bar object
* @param en true: enable disable symmetric behavior; false: disable
* @deprecated As of v7.0, you should use `lv_slider_set_type` instead.
*/
static inline void lv_slider_set_sym(lv_obj_t * slider, bool en)
{
lv_bar_set_sym(slider, en);
}
/**
* Get whether the slider is symmetric or not.
* @param slider pointer to a slider object
* @return true: symmetric is enabled; false: disable
* @deprecated As of v7.0, you should use `lv_slider_get_type` instead.
*/
static inline bool lv_slider_get_sym(lv_obj_t * slider)
{
return lv_bar_get_sym(slider);
}
#endif
#if LV_USE_ROLLER
/**
* Set a fixed width for the roller.
* @param roller pointer to a roller object
* @param w width
* @deprecated As of v7.0, you should use `lv_roller_set_auto_fit` and set the width normally instead.
*/
static inline void lv_roller_set_fix_width(lv_obj_t * roller, lv_coord_t w)
{
lv_roller_set_auto_fit(roller, false);
lv_obj_set_width(roller, w);
}
#endif
#if LV_USE_PAGE
#define lv_scrlbar_mode_t lv_scrollbar_mode_t
#define LV_SCRLBAR_MODE_OFF LV_SCROLLBAR_MODE_OFF
#define LV_SCRLBAR_MODE_ON LV_SCROLLBAR_MODE_ON
#define LV_SCRLBAR_MODE_DRAG LV_SCROLLBAR_MODE_DRAG
#define LV_SCRLBAR_MODE_AUTO LV_SCROLLBAR_MODE_AUTO
#define LV_SCRLBAR_MODE_HIDE LV_SCROLLBAR_MODE_HIDE
#define LV_SCRLBAR_MODE_UNHIDE LV_SCROLLBAR_MODE_UNHIDE
static inline void lv_page_set_scrlbar_mode(lv_obj_t * page, lv_scrlbar_mode_t sb_mode)
{
lv_page_set_scrollbar_mode(page, sb_mode);
}
static inline lv_scrollbar_mode_t lv_page_get_scrlbar_mode(lv_obj_t * page)
{
return lv_page_get_scrollbar_mode(page);
}
static inline lv_obj_t * lv_page_get_scrl(lv_obj_t * page)
{
return lv_page_get_scrollable(page);
}
#endif
#endif /*LV_USE_API_EXTENSION_V6*/
/*---------------------
* V7.0 COMPATIBILITY
*--------------------*/
#if LV_USE_API_EXTENSION_V7
#if LV_USE_WIN
static inline lv_obj_t * lv_win_add_btn(lv_obj_t * win, const void * img_src)
{
return lv_win_add_btn_right(win, img_src);
}
#endif
#if LV_USE_CHART
static inline void lv_chart_set_range(lv_obj_t * chart, lv_coord_t ymin, lv_coord_t ymax)
{
lv_chart_set_y_range(chart, LV_CHART_AXIS_PRIMARY_Y, ymin, ymax);
}
static inline void lv_chart_clear_serie(lv_obj_t * chart, lv_chart_series_t * series)
{
lv_chart_clear_series(chart, series);
}
#endif
static inline void lv_obj_align_origo(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs,
lv_coord_t y_ofs)
{
lv_obj_align_mid(obj, base, align, x_ofs, y_ofs);
}
static inline void lv_obj_align_origo_x(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t x_ofs)
{
lv_obj_align_mid_y(obj, base, align, x_ofs);
}
static inline void lv_obj_align_origo_y(lv_obj_t * obj, const lv_obj_t * base, lv_align_t align, lv_coord_t y_ofs)
{
lv_obj_align_mid_y(obj, base, align, y_ofs);
}
#endif /*LV_USE_API_EXTENSION_V6*/
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_API_MAP_H*/
|
train_000.parquet/920
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_api_map.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 5386,
"token_count": 2299
}
|
/**
* GENERATED FILE, DO NOT EDIT IT!
* @file lv_conf_internal.h
* Make sure all the defines of lv_conf.h have a default value
**/
#ifndef LV_CONF_INTERNAL_H
#define LV_CONF_INTERNAL_H
/* clang-format off */
#include <stdint.h>
#if defined(LV_CONF_PATH)
#define __LV_TO_STR_AUX(x) #x
#define __LV_TO_STR(x) __LV_TO_STR_AUX(x)
#include __LV_TO_STR(LV_CONF_PATH)
#undef __LV_TO_STR_AUX
#undef __LV_TO_STR
#elif defined(LV_CONF_INCLUDE_SIMPLE)
#include "lv_conf.h"
#else
#include "../../lv_conf.h"
#endif
/* clang-format off */
#include <stdint.h>
/*====================
Graphical settings
*====================*/
/* Maximal horizontal and vertical resolution to support by the library.*/
#ifndef LV_HOR_RES_MAX
#define LV_HOR_RES_MAX (480)
#endif
#ifndef LV_VER_RES_MAX
#define LV_VER_RES_MAX (320)
#endif
/* Color depth:
* - 1: 1 byte per pixel
* - 8: RGB332
* - 16: RGB565
* - 32: ARGB8888
*/
#ifndef LV_COLOR_DEPTH
#define LV_COLOR_DEPTH 16
#endif
/* Swap the 2 bytes of RGB565 color.
* Useful if the display has a 8 bit interface (e.g. SPI)*/
#ifndef LV_COLOR_16_SWAP
#define LV_COLOR_16_SWAP 0
#endif
/* 1: Enable screen transparency.
* Useful for OSD or other overlapping GUIs.
* Requires `LV_COLOR_DEPTH = 32` colors and the screen's style should be modified: `style.body.opa = ...`*/
#ifndef LV_COLOR_SCREEN_TRANSP
#define LV_COLOR_SCREEN_TRANSP 0
#endif
/*Images pixels with this color will not be drawn (with chroma keying)*/
#ifndef LV_COLOR_TRANSP
#define LV_COLOR_TRANSP LV_COLOR_LIME /*LV_COLOR_LIME: pure green*/
#endif
/* Enable anti-aliasing (lines, and radiuses will be smoothed) */
#ifndef LV_ANTIALIAS
#define LV_ANTIALIAS 1
#endif
/* Default display refresh period.
* Can be changed in the display driver (`lv_disp_drv_t`).*/
#ifndef LV_DISP_DEF_REFR_PERIOD
#define LV_DISP_DEF_REFR_PERIOD 30 /*[ms]*/
#endif
/* Dot Per Inch: used to initialize default sizes.
* E.g. a button with width = LV_DPI / 2 -> half inch wide
* (Not so important, you can adjust it to modify default sizes and spaces)*/
#ifndef LV_DPI
#define LV_DPI 130 /*[px]*/
#endif
/* The the real width of the display changes some default values:
* default object sizes, layout of examples, etc.
* According to the width of the display (hor. res. / dpi)
* the displays fall in 4 categories.
* The 4th is extra large which has no upper limit so not listed here
* The upper limit of the categories are set below in 0.1 inch unit.
*/
#ifndef LV_DISP_SMALL_LIMIT
#define LV_DISP_SMALL_LIMIT 30
#endif
#ifndef LV_DISP_MEDIUM_LIMIT
#define LV_DISP_MEDIUM_LIMIT 50
#endif
#ifndef LV_DISP_LARGE_LIMIT
#define LV_DISP_LARGE_LIMIT 70
#endif
/* Type of coordinates. Should be `int16_t` (or `int32_t` for extreme cases) */
/*=========================
Memory manager settings
*=========================*/
/* LittelvGL's internal memory manager's settings.
* The graphical objects and other related data are stored here. */
/* 1: use custom malloc/free, 0: use the built-in `lv_mem_alloc` and `lv_mem_free` */
#ifndef LV_MEM_CUSTOM
#define LV_MEM_CUSTOM 0
#endif
#if LV_MEM_CUSTOM == 0
/* Size of the memory used by `lv_mem_alloc` in bytes (>= 2kB)*/
#ifndef LV_MEM_SIZE
# define LV_MEM_SIZE (32U * 1024U)
#endif
/* Complier prefix for a big array declaration */
#ifndef LV_MEM_ATTR
# define LV_MEM_ATTR
#endif
/* Set an address for the memory pool instead of allocating it as an array.
* Can be in external SRAM too. */
#ifndef LV_MEM_ADR
# define LV_MEM_ADR 0
#endif
/* Automatically defrag. on free. Defrag. means joining the adjacent free cells. */
#ifndef LV_MEM_AUTO_DEFRAG
# define LV_MEM_AUTO_DEFRAG 1
#endif
#else /*LV_MEM_CUSTOM*/
#ifndef LV_MEM_CUSTOM_INCLUDE
# define LV_MEM_CUSTOM_INCLUDE <stdlib.h> /*Header for the dynamic memory function*/
#endif
#ifndef LV_MEM_CUSTOM_ALLOC
# define LV_MEM_CUSTOM_ALLOC malloc /*Wrapper to malloc*/
#endif
#ifndef LV_MEM_CUSTOM_FREE
# define LV_MEM_CUSTOM_FREE free /*Wrapper to free*/
#endif
#endif /*LV_MEM_CUSTOM*/
/* Use the standard memcpy and memset instead of LVGL's own functions.
* The standard functions might or might not be faster depending on their implementation. */
#ifndef LV_MEMCPY_MEMSET_STD
#define LV_MEMCPY_MEMSET_STD 0
#endif
/* Garbage Collector settings
* Used if lvgl is binded to higher level language and the memory is managed by that language */
#ifndef LV_ENABLE_GC
#define LV_ENABLE_GC 0
#endif
#if LV_ENABLE_GC != 0
#ifndef LV_GC_INCLUDE
# define LV_GC_INCLUDE "gc.h" /*Include Garbage Collector related things*/
#endif
#ifndef LV_MEM_CUSTOM_REALLOC
# define LV_MEM_CUSTOM_REALLOC your_realloc /*Wrapper to realloc*/
#endif
#ifndef LV_MEM_CUSTOM_GET_SIZE
# define LV_MEM_CUSTOM_GET_SIZE your_mem_get_size /*Wrapper to lv_mem_get_size*/
#endif
#endif /* LV_ENABLE_GC */
/*=======================
Input device settings
*=======================*/
/* Input device default settings.
* Can be changed in the Input device driver (`lv_indev_drv_t`)*/
/* Input device read period in milliseconds */
#ifndef LV_INDEV_DEF_READ_PERIOD
#define LV_INDEV_DEF_READ_PERIOD 30
#endif
/* Drag threshold in pixels */
#ifndef LV_INDEV_DEF_DRAG_LIMIT
#define LV_INDEV_DEF_DRAG_LIMIT 10
#endif
/* Drag throw slow-down in [%]. Greater value -> faster slow-down */
#ifndef LV_INDEV_DEF_DRAG_THROW
#define LV_INDEV_DEF_DRAG_THROW 10
#endif
/* Long press time in milliseconds.
* Time to send `LV_EVENT_LONG_PRESSSED`) */
#ifndef LV_INDEV_DEF_LONG_PRESS_TIME
#define LV_INDEV_DEF_LONG_PRESS_TIME 400
#endif
/* Repeated trigger period in long press [ms]
* Time between `LV_EVENT_LONG_PRESSED_REPEAT */
#ifndef LV_INDEV_DEF_LONG_PRESS_REP_TIME
#define LV_INDEV_DEF_LONG_PRESS_REP_TIME 100
#endif
/* Gesture threshold in pixels */
#ifndef LV_INDEV_DEF_GESTURE_LIMIT
#define LV_INDEV_DEF_GESTURE_LIMIT 50
#endif
/* Gesture min velocity at release before swipe (pixels)*/
#ifndef LV_INDEV_DEF_GESTURE_MIN_VELOCITY
#define LV_INDEV_DEF_GESTURE_MIN_VELOCITY 3
#endif
/*==================
* Feature usage
*==================*/
/*1: Enable the Animations */
#ifndef LV_USE_ANIMATION
#define LV_USE_ANIMATION 1
#endif
#if LV_USE_ANIMATION
/*Declare the type of the user data of animations (can be e.g. `void *`, `int`, `struct`)*/
#endif
/* 1: Enable shadow drawing on rectangles*/
#ifndef LV_USE_SHADOW
#define LV_USE_SHADOW 1
#endif
#if LV_USE_SHADOW
/* Allow buffering some shadow calculation
* LV_SHADOW_CACHE_SIZE is the max. shadow size to buffer,
* where shadow size is `shadow_width + radius`
* Caching has LV_SHADOW_CACHE_SIZE^2 RAM cost*/
#ifndef LV_SHADOW_CACHE_SIZE
#define LV_SHADOW_CACHE_SIZE 0
#endif
#endif
/*1: enable outline drawing on rectangles*/
#ifndef LV_USE_OUTLINE
#define LV_USE_OUTLINE 1
#endif
/*1: enable pattern drawing on rectangles*/
#ifndef LV_USE_PATTERN
#define LV_USE_PATTERN 1
#endif
/*1: enable value string drawing on rectangles*/
#ifndef LV_USE_VALUE_STR
#define LV_USE_VALUE_STR 1
#endif
/* 1: Use other blend modes than normal (`LV_BLEND_MODE_...`)*/
#ifndef LV_USE_BLEND_MODES
#define LV_USE_BLEND_MODES 1
#endif
/* 1: Use the `opa_scale` style property to set the opacity of an object and its children at once*/
#ifndef LV_USE_OPA_SCALE
#define LV_USE_OPA_SCALE 1
#endif
/* 1: Use image zoom and rotation*/
#ifndef LV_USE_IMG_TRANSFORM
#define LV_USE_IMG_TRANSFORM 1
#endif
/* 1: Enable object groups (for keyboard/encoder navigation) */
#ifndef LV_USE_GROUP
#define LV_USE_GROUP 1
#endif
#if LV_USE_GROUP
#endif /*LV_USE_GROUP*/
/* 1: Enable GPU interface*/
#ifndef LV_USE_GPU
#define LV_USE_GPU 1 /*Only enables `gpu_fill_cb` and `gpu_blend_cb` in the disp. drv- */
#endif
#ifndef LV_USE_GPU_STM32_DMA2D
#define LV_USE_GPU_STM32_DMA2D 0
#endif
/*If enabling LV_USE_GPU_STM32_DMA2D, LV_GPU_DMA2D_CMSIS_INCLUDE must be defined to include path of CMSIS header of target processor
e.g. "stm32f769xx.h" or "stm32f429xx.h" */
#ifndef LV_GPU_DMA2D_CMSIS_INCLUDE
#define LV_GPU_DMA2D_CMSIS_INCLUDE
#endif
/* 1: Enable file system (might be required for images */
#ifndef LV_USE_FILESYSTEM
#define LV_USE_FILESYSTEM 1
#endif
#if LV_USE_FILESYSTEM
/*Declare the type of the user data of file system drivers (can be e.g. `void *`, `int`, `struct`)*/
#endif
/*1: Add a `user_data` to drivers and objects*/
#ifndef LV_USE_USER_DATA
#define LV_USE_USER_DATA 0
#endif
/*1: Show CPU usage and FPS count in the right bottom corner*/
#ifndef LV_USE_PERF_MONITOR
#define LV_USE_PERF_MONITOR 0
#endif
/*1: Use the functions and types from the older API if possible */
#ifndef LV_USE_API_EXTENSION_V6
#define LV_USE_API_EXTENSION_V6 1
#endif
#ifndef LV_USE_API_EXTENSION_V7
#define LV_USE_API_EXTENSION_V7 1
#endif
/*========================
* Image decoder and cache
*========================*/
/* 1: Enable indexed (palette) images */
#ifndef LV_IMG_CF_INDEXED
#define LV_IMG_CF_INDEXED 1
#endif
/* 1: Enable alpha indexed images */
#ifndef LV_IMG_CF_ALPHA
#define LV_IMG_CF_ALPHA 1
#endif
/* Default image cache size. Image caching keeps the images opened.
* If only the built-in image formats are used there is no real advantage of caching.
* (I.e. no new image decoder is added)
* With complex image decoders (e.g. PNG or JPG) caching can save the continuous open/decode of images.
* However the opened images might consume additional RAM.
* LV_IMG_CACHE_DEF_SIZE must be >= 1 */
#ifndef LV_IMG_CACHE_DEF_SIZE
#define LV_IMG_CACHE_DEF_SIZE 1
#endif
/*Declare the type of the user data of image decoder (can be e.g. `void *`, `int`, `struct`)*/
/*=====================
* Compiler settings
*====================*/
/* For big endian systems set to 1 */
#ifndef LV_BIG_ENDIAN_SYSTEM
#define LV_BIG_ENDIAN_SYSTEM 0
#endif
/* Define a custom attribute to `lv_tick_inc` function */
#ifndef LV_ATTRIBUTE_TICK_INC
#define LV_ATTRIBUTE_TICK_INC
#endif
/* Define a custom attribute to `lv_task_handler` function */
#ifndef LV_ATTRIBUTE_TASK_HANDLER
#define LV_ATTRIBUTE_TASK_HANDLER
#endif
/* Define a custom attribute to `lv_disp_flush_ready` function */
#ifndef LV_ATTRIBUTE_FLUSH_READY
#define LV_ATTRIBUTE_FLUSH_READY
#endif
/* With size optimization (-Os) the compiler might not align data to
* 4 or 8 byte boundary. This alignment will be explicitly applied where needed.
* E.g. __attribute__((aligned(4))) */
#ifndef LV_ATTRIBUTE_MEM_ALIGN
#define LV_ATTRIBUTE_MEM_ALIGN
#endif
/* Attribute to mark large constant arrays for example
* font's bitmaps */
#ifndef LV_ATTRIBUTE_LARGE_CONST
#define LV_ATTRIBUTE_LARGE_CONST
#endif
/* Prefix performance critical functions to place them into a faster memory (e.g RAM)
* Uses 15-20 kB extra memory */
#ifndef LV_ATTRIBUTE_FAST_MEM
#define LV_ATTRIBUTE_FAST_MEM
#endif
/* Export integer constant to binding.
* This macro is used with constants in the form of LV_<CONST> that
* should also appear on lvgl binding API such as Micropython
*
* The default value just prevents a GCC warning.
*/
#ifndef LV_EXPORT_CONST_INT
#define LV_EXPORT_CONST_INT(int_value) struct _silence_gcc_warning
#endif
/* Prefix variables that are used in GPU accelerated operations, often these need to be
* placed in RAM sections that are DMA accessible */
#ifndef LV_ATTRIBUTE_DMA
#define LV_ATTRIBUTE_DMA
#endif
/*===================
* HAL settings
*==================*/
/* 1: use a custom tick source.
* It removes the need to manually update the tick with `lv_tick_inc`) */
#ifndef LV_TICK_CUSTOM
#define LV_TICK_CUSTOM 0
#endif
#if LV_TICK_CUSTOM == 1
#ifndef LV_TICK_CUSTOM_INCLUDE
#define LV_TICK_CUSTOM_INCLUDE "Arduino.h" /*Header for the system time function*/
#endif
#ifndef LV_TICK_CUSTOM_SYS_TIME_EXPR
#define LV_TICK_CUSTOM_SYS_TIME_EXPR (millis()) /*Expression evaluating to current system time in ms*/
#endif
#endif /*LV_TICK_CUSTOM*/
/*================
* Log settings
*===============*/
/*1: Enable the log module*/
#ifndef LV_USE_LOG
#define LV_USE_LOG 0
#endif
#if LV_USE_LOG
/* How important log should be added:
* LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
* LV_LOG_LEVEL_INFO Log important events
* LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
* LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
* LV_LOG_LEVEL_NONE Do not log anything
*/
#ifndef LV_LOG_LEVEL
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
#endif
/* 1: Print the log with 'printf';
* 0: user need to register a callback with `lv_log_register_print_cb`*/
#ifndef LV_LOG_PRINTF
# define LV_LOG_PRINTF 0
#endif
#endif /*LV_USE_LOG*/
/*=================
* Debug settings
*================*/
/* If Debug is enabled LittelvGL validates the parameters of the functions.
* If an invalid parameter is found an error log message is printed and
* the MCU halts at the error. (`LV_USE_LOG` should be enabled)
* If you are debugging the MCU you can pause
* the debugger to see exactly where the issue is.
*
* The behavior of asserts can be overwritten by redefining them here.
* E.g. #define LV_ASSERT_MEM(p) <my_assert_code>
*/
#ifndef LV_USE_DEBUG
#define LV_USE_DEBUG 1
#endif
#if LV_USE_DEBUG
/*Check if the parameter is NULL. (Quite fast) */
#ifndef LV_USE_ASSERT_NULL
#define LV_USE_ASSERT_NULL 1
#endif
/*Checks is the memory is successfully allocated or no. (Quite fast)*/
#ifndef LV_USE_ASSERT_MEM
#define LV_USE_ASSERT_MEM 1
#endif
/*Check the integrity of `lv_mem` after critical operations. (Slow)*/
#ifndef LV_USE_ASSERT_MEM_INTEGRITY
#define LV_USE_ASSERT_MEM_INTEGRITY 0
#endif
/* Check the strings.
* Search for NULL, very long strings, invalid characters, and unnatural repetitions. (Slow)
* If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */
#ifndef LV_USE_ASSERT_STR
#define LV_USE_ASSERT_STR 0
#endif
/* Check NULL, the object's type and existence (e.g. not deleted). (Quite slow)
* If disabled `LV_USE_ASSERT_NULL` will be performed instead (if it's enabled) */
#ifndef LV_USE_ASSERT_OBJ
#define LV_USE_ASSERT_OBJ 0
#endif
/*Check if the styles are properly initialized. (Fast)*/
#ifndef LV_USE_ASSERT_STYLE
#define LV_USE_ASSERT_STYLE 0
#endif
#endif /*LV_USE_DEBUG*/
/*==================
* FONT USAGE
*===================*/
/* The built-in fonts contains the ASCII range and some Symbols with 4 bit-per-pixel.
* The symbols are available via `LV_SYMBOL_...` defines
* More info about fonts: https://docs.lvgl.io/v7/en/html/overview/font.html
* To create a new font go to: https://lvgl.com/ttf-font-to-c-array
*/
/* Montserrat fonts with bpp = 4
* https://fonts.google.com/specimen/Montserrat */
#ifndef LV_FONT_MONTSERRAT_12
#define LV_FONT_MONTSERRAT_12 0
#endif
#ifndef LV_FONT_MONTSERRAT_14
#define LV_FONT_MONTSERRAT_14 1
#endif
#ifndef LV_FONT_MONTSERRAT_16
#define LV_FONT_MONTSERRAT_16 0
#endif
#ifndef LV_FONT_MONTSERRAT_18
#define LV_FONT_MONTSERRAT_18 0
#endif
#ifndef LV_FONT_MONTSERRAT_20
#define LV_FONT_MONTSERRAT_20 0
#endif
#ifndef LV_FONT_MONTSERRAT_22
#define LV_FONT_MONTSERRAT_22 0
#endif
#ifndef LV_FONT_MONTSERRAT_24
#define LV_FONT_MONTSERRAT_24 0
#endif
#ifndef LV_FONT_MONTSERRAT_26
#define LV_FONT_MONTSERRAT_26 0
#endif
#ifndef LV_FONT_MONTSERRAT_28
#define LV_FONT_MONTSERRAT_28 0
#endif
#ifndef LV_FONT_MONTSERRAT_30
#define LV_FONT_MONTSERRAT_30 0
#endif
#ifndef LV_FONT_MONTSERRAT_32
#define LV_FONT_MONTSERRAT_32 0
#endif
#ifndef LV_FONT_MONTSERRAT_34
#define LV_FONT_MONTSERRAT_34 0
#endif
#ifndef LV_FONT_MONTSERRAT_36
#define LV_FONT_MONTSERRAT_36 0
#endif
#ifndef LV_FONT_MONTSERRAT_38
#define LV_FONT_MONTSERRAT_38 0
#endif
#ifndef LV_FONT_MONTSERRAT_40
#define LV_FONT_MONTSERRAT_40 0
#endif
#ifndef LV_FONT_MONTSERRAT_42
#define LV_FONT_MONTSERRAT_42 0
#endif
#ifndef LV_FONT_MONTSERRAT_44
#define LV_FONT_MONTSERRAT_44 0
#endif
#ifndef LV_FONT_MONTSERRAT_46
#define LV_FONT_MONTSERRAT_46 0
#endif
#ifndef LV_FONT_MONTSERRAT_48
#define LV_FONT_MONTSERRAT_48 0
#endif
/* Demonstrate special features */
#ifndef LV_FONT_MONTSERRAT_12_SUBPX
#define LV_FONT_MONTSERRAT_12_SUBPX 0
#endif
#ifndef LV_FONT_MONTSERRAT_28_COMPRESSED
#define LV_FONT_MONTSERRAT_28_COMPRESSED 0 /*bpp = 3*/
#endif
#ifndef LV_FONT_DEJAVU_16_PERSIAN_HEBREW
#define LV_FONT_DEJAVU_16_PERSIAN_HEBREW 0 /*Hebrew, Arabic, PErisan letters and all their forms*/
#endif
#ifndef LV_FONT_SIMSUN_16_CJK
#define LV_FONT_SIMSUN_16_CJK 0 /*1000 most common CJK radicals*/
#endif
/*Pixel perfect monospace font
* http://pelulamu.net/unscii/ */
#ifndef LV_FONT_UNSCII_8
#define LV_FONT_UNSCII_8 0
#endif
/* Optionally declare your custom fonts here.
* You can use these fonts as default font too
* and they will be available globally. E.g.
* #define LV_FONT_CUSTOM_DECLARE LV_FONT_DECLARE(my_font_1) \
* LV_FONT_DECLARE(my_font_2)
*/
#ifndef LV_FONT_CUSTOM_DECLARE
#define LV_FONT_CUSTOM_DECLARE
#endif
/* Enable it if you have fonts with a lot of characters.
* The limit depends on the font size, font face and bpp
* but with > 10,000 characters if you see issues probably you need to enable it.*/
#ifndef LV_FONT_FMT_TXT_LARGE
#define LV_FONT_FMT_TXT_LARGE 0
#endif
/* Enables/disables support for compressed fonts. If it's disabled, compressed
* glyphs cannot be processed by the library and won't be rendered.
*/
#ifndef LV_USE_FONT_COMPRESSED
#define LV_USE_FONT_COMPRESSED 1
#endif
/* Enable subpixel rendering */
#ifndef LV_USE_FONT_SUBPX
#define LV_USE_FONT_SUBPX 1
#endif
#if LV_USE_FONT_SUBPX
/* Set the pixel order of the display.
* Important only if "subpx fonts" are used.
* With "normal" font it doesn't matter.
*/
#ifndef LV_FONT_SUBPX_BGR
#define LV_FONT_SUBPX_BGR 0
#endif
#endif
/*Declare the type of the user data of fonts (can be e.g. `void *`, `int`, `struct`)*/
/*================
* THEME USAGE
*================*/
/*Always enable at least on theme*/
/* No theme, you can apply your styles as you need
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
#ifndef LV_USE_THEME_EMPTY
#define LV_USE_THEME_EMPTY 1
#endif
/*Simple to the create your theme based on it
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
#ifndef LV_USE_THEME_TEMPLATE
#define LV_USE_THEME_TEMPLATE 1
#endif
/* A fast and impressive theme.
* Flags:
* LV_THEME_MATERIAL_FLAG_LIGHT: light theme
* LV_THEME_MATERIAL_FLAG_DARK: dark theme
* LV_THEME_MATERIAL_FLAG_NO_TRANSITION: disable transitions (state change animations)
* LV_THEME_MATERIAL_FLAG_NO_FOCUS: disable indication of focused state)
* */
#ifndef LV_USE_THEME_MATERIAL
#define LV_USE_THEME_MATERIAL 1
#endif
/* Mono-color theme for monochrome displays.
* If LV_THEME_DEFAULT_COLOR_PRIMARY is LV_COLOR_BLACK the
* texts and borders will be black and the background will be
* white. Else the colors are inverted.
* No flags. Set LV_THEME_DEFAULT_FLAG 0 */
#ifndef LV_USE_THEME_MONO
#define LV_USE_THEME_MONO 1
#endif
#ifndef LV_THEME_DEFAULT_INCLUDE
#define LV_THEME_DEFAULT_INCLUDE <stdint.h> /*Include a header for the init. function*/
#endif
#ifndef LV_THEME_DEFAULT_INIT
#define LV_THEME_DEFAULT_INIT lv_theme_material_init
#endif
#ifndef LV_THEME_DEFAULT_COLOR_PRIMARY
#define LV_THEME_DEFAULT_COLOR_PRIMARY lv_color_hex(0x01a2b1)
#endif
#ifndef LV_THEME_DEFAULT_COLOR_SECONDARY
#define LV_THEME_DEFAULT_COLOR_SECONDARY lv_color_hex(0x44d1b6)
#endif
#ifndef LV_THEME_DEFAULT_FLAG
#define LV_THEME_DEFAULT_FLAG LV_THEME_MATERIAL_FLAG_LIGHT
#endif
#ifndef LV_THEME_DEFAULT_FONT_SMALL
#define LV_THEME_DEFAULT_FONT_SMALL &lv_font_montserrat_14
#endif
#ifndef LV_THEME_DEFAULT_FONT_NORMAL
#define LV_THEME_DEFAULT_FONT_NORMAL &lv_font_montserrat_14
#endif
#ifndef LV_THEME_DEFAULT_FONT_SUBTITLE
#define LV_THEME_DEFAULT_FONT_SUBTITLE &lv_font_montserrat_14
#endif
#ifndef LV_THEME_DEFAULT_FONT_TITLE
#define LV_THEME_DEFAULT_FONT_TITLE &lv_font_montserrat_14
#endif
/*=================
* Text settings
*=================*/
/* Select a character encoding for strings.
* Your IDE or editor should have the same character encoding
* - LV_TXT_ENC_UTF8
* - LV_TXT_ENC_ASCII
* */
#ifndef LV_TXT_ENC
#define LV_TXT_ENC LV_TXT_ENC_UTF8
#endif
/*Can break (wrap) texts on these chars*/
#ifndef LV_TXT_BREAK_CHARS
#define LV_TXT_BREAK_CHARS " ,.;:-_"
#endif
/* If a word is at least this long, will break wherever "prettiest"
* To disable, set to a value <= 0 */
#ifndef LV_TXT_LINE_BREAK_LONG_LEN
#define LV_TXT_LINE_BREAK_LONG_LEN 0
#endif
/* Minimum number of characters in a long word to put on a line before a break.
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
#ifndef LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN
#define LV_TXT_LINE_BREAK_LONG_PRE_MIN_LEN 3
#endif
/* Minimum number of characters in a long word to put on a line after a break.
* Depends on LV_TXT_LINE_BREAK_LONG_LEN. */
#ifndef LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN
#define LV_TXT_LINE_BREAK_LONG_POST_MIN_LEN 3
#endif
/* The control character to use for signalling text recoloring. */
#ifndef LV_TXT_COLOR_CMD
#define LV_TXT_COLOR_CMD "#"
#endif
/* Support bidirectional texts.
* Allows mixing Left-to-Right and Right-to-Left texts.
* The direction will be processed according to the Unicode Bidirectioanl Algorithm:
* https://www.w3.org/International/articles/inline-bidi-markup/uba-basics*/
#ifndef LV_USE_BIDI
#define LV_USE_BIDI 0
#endif
#if LV_USE_BIDI
/* Set the default direction. Supported values:
* `LV_BIDI_DIR_LTR` Left-to-Right
* `LV_BIDI_DIR_RTL` Right-to-Left
* `LV_BIDI_DIR_AUTO` detect texts base direction */
#ifndef LV_BIDI_BASE_DIR_DEF
#define LV_BIDI_BASE_DIR_DEF LV_BIDI_DIR_AUTO
#endif
#endif
/* Enable Arabic/Persian processing
* In these languages characters should be replaced with
* an other form based on their position in the text */
#ifndef LV_USE_ARABIC_PERSIAN_CHARS
#define LV_USE_ARABIC_PERSIAN_CHARS 0
#endif
/*Change the built in (v)snprintf functions*/
#ifndef LV_SPRINTF_CUSTOM
#define LV_SPRINTF_CUSTOM 0
#endif
#if LV_SPRINTF_CUSTOM
#ifndef LV_SPRINTF_INCLUDE
# define LV_SPRINTF_INCLUDE <stdio.h>
#endif
#ifndef lv_snprintf
# define lv_snprintf snprintf
#endif
#ifndef lv_vsnprintf
# define lv_vsnprintf vsnprintf
#endif
#else /*!LV_SPRINTF_CUSTOM*/
#ifndef LV_SPRINTF_DISABLE_FLOAT
# define LV_SPRINTF_DISABLE_FLOAT 1
#endif
#endif /*LV_SPRINTF_CUSTOM*/
/*===================
* LV_OBJ SETTINGS
*==================*/
#if LV_USE_USER_DATA
/*Declare the type of the user data of object (can be e.g. `void *`, `int`, `struct`)*/
/*Provide a function to free user data*/
#ifndef LV_USE_USER_DATA_FREE
#define LV_USE_USER_DATA_FREE 0
#endif
#if LV_USE_USER_DATA_FREE
#ifndef LV_USER_DATA_FREE_INCLUDE
# define LV_USER_DATA_FREE_INCLUDE "something.h" /*Header for user data free function*/
#endif
/* Function prototype : void user_data_free(lv_obj_t * obj); */
#ifndef LV_USER_DATA_FREE
# define LV_USER_DATA_FREE (user_data_free) /*Invoking for user data free function*/
#endif
#endif
#endif
/*1: enable `lv_obj_realign()` based on `lv_obj_align()` parameters*/
#ifndef LV_USE_OBJ_REALIGN
#define LV_USE_OBJ_REALIGN 1
#endif
/* Enable to make the object clickable on a larger area.
* LV_EXT_CLICK_AREA_OFF or 0: Disable this feature
* LV_EXT_CLICK_AREA_TINY: The extra area can be adjusted horizontally and vertically (0..255 px)
* LV_EXT_CLICK_AREA_FULL: The extra area can be adjusted in all 4 directions (-32k..+32k px)
*/
#ifndef LV_USE_EXT_CLICK_AREA
#define LV_USE_EXT_CLICK_AREA LV_EXT_CLICK_AREA_TINY
#endif
/*==================
* LV OBJ X USAGE
*================*/
/*
* Documentation of the object types: https://docs.lvgl.com/#Object-types
*/
/*Arc (dependencies: -)*/
#ifndef LV_USE_ARC
#define LV_USE_ARC 1
#endif
/*Bar (dependencies: -)*/
#ifndef LV_USE_BAR
#define LV_USE_BAR 1
#endif
/*Button (dependencies: lv_cont*/
#ifndef LV_USE_BTN
#define LV_USE_BTN 1
#endif
/*Button matrix (dependencies: -)*/
#ifndef LV_USE_BTNMATRIX
#define LV_USE_BTNMATRIX 1
#endif
/*Calendar (dependencies: -)*/
#ifndef LV_USE_CALENDAR
#define LV_USE_CALENDAR 1
#endif
#if LV_USE_CALENDAR
#ifndef LV_CALENDAR_WEEK_STARTS_MONDAY
# define LV_CALENDAR_WEEK_STARTS_MONDAY 0
#endif
#endif
/*Canvas (dependencies: lv_img)*/
#ifndef LV_USE_CANVAS
#define LV_USE_CANVAS 1
#endif
/*Check box (dependencies: lv_btn, lv_label)*/
#ifndef LV_USE_CHECKBOX
#define LV_USE_CHECKBOX 1
#endif
/*Chart (dependencies: -)*/
#ifndef LV_USE_CHART
#define LV_USE_CHART 1
#endif
#if LV_USE_CHART
#ifndef LV_CHART_AXIS_TICK_LABEL_MAX_LEN
# define LV_CHART_AXIS_TICK_LABEL_MAX_LEN 256
#endif
#endif
/*Container (dependencies: -*/
#ifndef LV_USE_CONT
#define LV_USE_CONT 1
#endif
/*Color picker (dependencies: -*/
#ifndef LV_USE_CPICKER
#define LV_USE_CPICKER 1
#endif
/*Drop down list (dependencies: lv_page, lv_label, lv_symbol_def.h)*/
#ifndef LV_USE_DROPDOWN
#define LV_USE_DROPDOWN 1
#endif
#if LV_USE_DROPDOWN != 0
/*Open and close default animation time [ms] (0: no animation)*/
#ifndef LV_DROPDOWN_DEF_ANIM_TIME
# define LV_DROPDOWN_DEF_ANIM_TIME 200
#endif
#endif
/*Gauge (dependencies:lv_bar, lv_linemeter)*/
#ifndef LV_USE_GAUGE
#define LV_USE_GAUGE 1
#endif
/*Image (dependencies: lv_label*/
#ifndef LV_USE_IMG
#define LV_USE_IMG 1
#endif
/*Image Button (dependencies: lv_btn*/
#ifndef LV_USE_IMGBTN
#define LV_USE_IMGBTN 1
#endif
#if LV_USE_IMGBTN
/*1: The imgbtn requires left, mid and right parts and the width can be set freely*/
#ifndef LV_IMGBTN_TILED
# define LV_IMGBTN_TILED 0
#endif
#endif
/*Keyboard (dependencies: lv_btnm)*/
#ifndef LV_USE_KEYBOARD
#define LV_USE_KEYBOARD 1
#endif
/*Label (dependencies: -*/
#ifndef LV_USE_LABEL
#define LV_USE_LABEL 1
#endif
#if LV_USE_LABEL != 0
/*Hor, or ver. scroll speed [px/sec] in 'LV_LABEL_LONG_ROLL/ROLL_CIRC' mode*/
#ifndef LV_LABEL_DEF_SCROLL_SPEED
# define LV_LABEL_DEF_SCROLL_SPEED 25
#endif
/* Waiting period at beginning/end of animation cycle */
#ifndef LV_LABEL_WAIT_CHAR_COUNT
# define LV_LABEL_WAIT_CHAR_COUNT 3
#endif
/*Enable selecting text of the label */
#ifndef LV_LABEL_TEXT_SEL
# define LV_LABEL_TEXT_SEL 0
#endif
/*Store extra some info in labels (12 bytes) to speed up drawing of very long texts*/
#ifndef LV_LABEL_LONG_TXT_HINT
# define LV_LABEL_LONG_TXT_HINT 0
#endif
#endif
/*LED (dependencies: -)*/
#ifndef LV_USE_LED
#define LV_USE_LED 1
#endif
#if LV_USE_LED
#ifndef LV_LED_BRIGHT_MIN
# define LV_LED_BRIGHT_MIN 120 /*Minimal brightness*/
#endif
#ifndef LV_LED_BRIGHT_MAX
# define LV_LED_BRIGHT_MAX 255 /*Maximal brightness*/
#endif
#endif
/*Line (dependencies: -*/
#ifndef LV_USE_LINE
#define LV_USE_LINE 1
#endif
/*List (dependencies: lv_page, lv_btn, lv_label, (lv_img optionally for icons ))*/
#ifndef LV_USE_LIST
#define LV_USE_LIST 1
#endif
#if LV_USE_LIST != 0
/*Default animation time of focusing to a list element [ms] (0: no animation) */
#ifndef LV_LIST_DEF_ANIM_TIME
# define LV_LIST_DEF_ANIM_TIME 100
#endif
#endif
/*Line meter (dependencies: *;)*/
#ifndef LV_USE_LINEMETER
#define LV_USE_LINEMETER 1
#endif
#if LV_USE_LINEMETER
/* Draw line more precisely at cost of performance.
* Useful if there are lot of lines any minor are visible
* 0: No extra precision
* 1: Some extra precision
* 2: Best precision
*/
#ifndef LV_LINEMETER_PRECISE
# define LV_LINEMETER_PRECISE 0
#endif
#endif
/*Mask (dependencies: -)*/
#ifndef LV_USE_OBJMASK
#define LV_USE_OBJMASK 1
#endif
/*Message box (dependencies: lv_rect, lv_btnm, lv_label)*/
#ifndef LV_USE_MSGBOX
#define LV_USE_MSGBOX 1
#endif
/*Page (dependencies: lv_cont)*/
#ifndef LV_USE_PAGE
#define LV_USE_PAGE 1
#endif
#if LV_USE_PAGE != 0
/*Focus default animation time [ms] (0: no animation)*/
#ifndef LV_PAGE_DEF_ANIM_TIME
# define LV_PAGE_DEF_ANIM_TIME 400
#endif
#endif
/*Preload (dependencies: lv_arc, lv_anim)*/
#ifndef LV_USE_SPINNER
#define LV_USE_SPINNER 1
#endif
#if LV_USE_SPINNER != 0
#ifndef LV_SPINNER_DEF_ARC_LENGTH
# define LV_SPINNER_DEF_ARC_LENGTH 60 /*[deg]*/
#endif
#ifndef LV_SPINNER_DEF_SPIN_TIME
# define LV_SPINNER_DEF_SPIN_TIME 1000 /*[ms]*/
#endif
#ifndef LV_SPINNER_DEF_ANIM
# define LV_SPINNER_DEF_ANIM LV_SPINNER_TYPE_SPINNING_ARC
#endif
#endif
/*Roller (dependencies: lv_ddlist)*/
#ifndef LV_USE_ROLLER
#define LV_USE_ROLLER 1
#endif
#if LV_USE_ROLLER != 0
/*Focus animation time [ms] (0: no animation)*/
#ifndef LV_ROLLER_DEF_ANIM_TIME
# define LV_ROLLER_DEF_ANIM_TIME 200
#endif
/*Number of extra "pages" when the roller is infinite*/
#ifndef LV_ROLLER_INF_PAGES
# define LV_ROLLER_INF_PAGES 7
#endif
#endif
/*Slider (dependencies: lv_bar)*/
#ifndef LV_USE_SLIDER
#define LV_USE_SLIDER 1
#endif
/*Spinbox (dependencies: lv_ta)*/
#ifndef LV_USE_SPINBOX
#define LV_USE_SPINBOX 1
#endif
/*Switch (dependencies: lv_slider)*/
#ifndef LV_USE_SWITCH
#define LV_USE_SWITCH 1
#endif
/*Text area (dependencies: lv_label, lv_page)*/
#ifndef LV_USE_TEXTAREA
#define LV_USE_TEXTAREA 1
#endif
#if LV_USE_TEXTAREA != 0
#ifndef LV_TEXTAREA_DEF_CURSOR_BLINK_TIME
# define LV_TEXTAREA_DEF_CURSOR_BLINK_TIME 400 /*ms*/
#endif
#ifndef LV_TEXTAREA_DEF_PWD_SHOW_TIME
# define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/
#endif
#endif
/*Table (dependencies: lv_label)*/
#ifndef LV_USE_TABLE
#define LV_USE_TABLE 1
#endif
#if LV_USE_TABLE
#ifndef LV_TABLE_COL_MAX
# define LV_TABLE_COL_MAX 12
#endif
#endif
/*Tab (dependencies: lv_page, lv_btnm)*/
#ifndef LV_USE_TABVIEW
#define LV_USE_TABVIEW 1
#endif
# if LV_USE_TABVIEW != 0
/*Time of slide animation [ms] (0: no animation)*/
#ifndef LV_TABVIEW_DEF_ANIM_TIME
# define LV_TABVIEW_DEF_ANIM_TIME 300
#endif
#endif
/*Tileview (dependencies: lv_page) */
#ifndef LV_USE_TILEVIEW
#define LV_USE_TILEVIEW 1
#endif
#if LV_USE_TILEVIEW
/*Time of slide animation [ms] (0: no animation)*/
#ifndef LV_TILEVIEW_DEF_ANIM_TIME
# define LV_TILEVIEW_DEF_ANIM_TIME 300
#endif
#endif
/*Window (dependencies: lv_cont, lv_btn, lv_label, lv_img, lv_page)*/
#ifndef LV_USE_WIN
#define LV_USE_WIN 1
#endif
/*==================
* Non-user section
*==================*/
#if defined(_MSC_VER) && !defined(_CRT_SECURE_NO_WARNINGS) /* Disable warnings for Visual Studio*/
#ifndef _CRT_SECURE_NO_WARNINGS
# define _CRT_SECURE_NO_WARNINGS
#endif
#endif
#endif /*LV_CONF_CHECKER_H*/
|
train_000.parquet/921
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_conf_internal.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 30914,
"token_count": 13233
}
|
/**
* @file lv_test_assert.h
*
*/
#ifndef LV_TEST_ASSERT_H
#define LV_TEST_ASSERT_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include <stdbool.h>
#include <stdint.h>
#include "../lvgl.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
void lv_test_print(const char * s, ...);
void lv_test_exit(const char * s, ...);
void lv_test_error(const char * s, ...);
void lv_test_assert_int_eq(int32_t n1, int32_t n2, const char * s);
void lv_test_assert_int_gt(int32_t n_ref, int32_t n_act, const char * s);
void lv_test_assert_int_lt(int32_t n_ref, int32_t n_act, const char * s);
void lv_test_assert_str_eq(const char * str1, const char * str2, const char * s);
void lv_test_assert_ptr_eq(const void * p_ref, const void * p_act, const char * s);
void lv_test_assert_color_eq(lv_color_t c_ref, lv_color_t c_act, const char * s);
void lv_test_assert_img_eq(const char * ref_img_fn, const char * s);
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_TEST_ASSERT_H*/
|
train_000.parquet/922
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/tests/lv_test_assert.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 1253,
"token_count": 512
}
|
#!/usr/bin/env python3
import os
lvgldirname = os.path.abspath('..')
lvgldirname = os.path.basename(lvgldirname)
lvgldirname = '"' + lvgldirname + '"'
base_defines = '"-DLV_CONF_PATH=' + lvgldirname +'/tests/lv_test_conf.h -DLV_BUILD_TEST"'
optimization = '"-O3 -g0"'
def build(name, defines):
global base_defines, optimization
print("=============================")
print(name)
print("=============================")
d_all = base_defines[:-1] + " ";
for d in defines:
d_all += " -D" + d + "=" + str(defines[d])
d_all += '"'
cmd = "make -j8 BIN=test.bin LVGL_DIR_NAME=" + lvgldirname + " DEFINES=" + d_all + " OPTIMIZATION=" + optimization
print("---------------------------")
print("Clean")
print("---------------------------")
os.system("make clean LVGL_DIR_NAME=" + lvgldirname)
os.system("rm -f ./test.bin")
print("---------------------------")
print("Build")
print("---------------------------")
ret = os.system(cmd)
if(ret != 0):
print("BUILD ERROR! (error code " + str(ret) + ")")
exit(1)
print("---------------------------")
print("Run")
print("---------------------------")
ret = os.system("./test.bin")
if(ret != 0):
print("RUN ERROR! (error code " + str(ret) + ")")
exit(1)
print("---------------------------")
print("Finished")
print("---------------------------")
minimal_monochrome = {
"LV_DPI":40,
"LV_MEM_SIZE":4*1024,
"LV_HOR_RES_MAX":128,
"LV_VER_RES_MAX":64,
"LV_COLOR_DEPTH":1,
"LV_USE_GROUP":0,
"LV_USE_ANIMATION":0,
"LV_ANTIALIAS":0,
"LV_GPU":0,
"LV_USE_FILESYSTEM":0,
"LV_USE_IMG_TRANSFORM":0,
"LV_USE_API_EXTENSION_V6":0,
"LV_USE_USER_DATA":0,
"LV_USE_USER_DATA_FREE":0,
"LV_USE_LOG":0,
"LV_USE_THEME_EMPTY":0,
"LV_USE_THEME_MATERIAL":0,
"LV_USE_THEME_MONO":1,
"LV_USE_THEME_TEMPLATE":0,
"LV_THEME_DEFAULT_INIT": "\\\"lv_theme_mono_init\\\"",
"LV_THEME_DEFAULT_COLOR_PRIMARY": "\\\"LV_COLOR_RED\\\"",
"LV_THEME_DEFAULT_COLOR_SECONDARY": "\\\"LV_COLOR_BLUE\\\"",
"LV_THEME_DEFAULT_FLAG" : "0",
"LV_THEME_DEFAULT_FONT_SMALL" : "\\\"&lv_font_unscii_8\\\"",
"LV_THEME_DEFAULT_FONT_NORMAL" : "\\\"&lv_font_unscii_8\\\"",
"LV_THEME_DEFAULT_FONT_SUBTITLE" : "\\\"&lv_font_unscii_8\\\"",
"LV_THEME_DEFAULT_FONT_TITLE" : "\\\"&lv_font_unscii_8\\\"",
"LV_LOG_PRINTF":0,
"LV_USE_DEBUG":0,
"LV_USE_ASSERT_NULL":0,
"LV_USE_ASSERT_MEM":0,
"LV_USE_ASSERT_STR":0,
"LV_USE_ASSERT_OBJ":0,
"LV_USE_ASSERT_STYLE":0,
"LV_FONT_MONTSERRAT_12":0,
"LV_FONT_MONTSERRAT_16":0,
"LV_FONT_MONTSERRAT_22":0,
"LV_FONT_MONTSERRAT_28":0,
"LV_FONT_MONTSERRAT_12_SUBPX":0,
"LV_FONT_MONTSERRAT_28_COMPRESSED":0,
"LV_FONT_UNSCII_8":1,
"LV_USE_BIDI": 0,
"LV_USE_OBJ_REALIGN": 0,
"LV_USE_ARC":0,
"LV_USE_BAR":1,
"LV_USE_BTN":1,
"LV_USE_BTNM":0,
"LV_USE_CALENDAR":0,
"LV_USE_CANVAS":0,
"LV_USE_CHECKBOX":0,
"LV_USE_CHART":0,
"LV_USE_CONT":1,
"LV_USE_CPICKER":0,
"LV_USE_DROPDOWN":0,
"LV_USE_GAUGE":0,
"LV_USE_IMG":1,
"LV_USE_IMGBTN":0,
"LV_USE_KEYBOARD":0,
"LV_USE_LABEL":1,
"LV_USE_LED":0,
"LV_USE_LINE":0,
"LV_USE_LIST":0,
"LV_USE_LINEMETER":0,
"LV_USE_OBJMASK":0,
"LV_USE_MBOX":0,
"LV_USE_PAGE":0,
"LV_USE_SPINNER":0,
"LV_USE_ROLLER":0,
"LV_USE_SLIDER":0,
"LV_USE_SPINBOX":0,
"LV_USE_SWITCH":0,
"LV_USE_TEXTAREA":0,
"LV_USE_TABLE":0,
"LV_USE_TABVIEW":0,
"LV_USE_TILEVIEW":0,
"LV_USE_WIN":0
}
all_obj_minimal_features = {
"LV_DPI":60,
"LV_MEM_SIZE":12*1024,
"LV_HOR_RES_MAX":320,
"LV_VER_RES_MAX":240,
"LV_COLOR_DEPTH":8,
"LV_USE_GROUP":0,
"LV_USE_ANIMATION":0,
"LV_ANTIALIAS":0,
"LV_GPU":0,
"LV_USE_FILESYSTEM":0,
"LV_USE_IMG_TRANSFORM":0,
"LV_USE_API_EXTENSION_V6":0,
"LV_USE_USER_DATA":0,
"LV_USE_USER_DATA_FREE":0,
"LV_USE_LOG":0,
"LV_USE_THEME_MATERIAL":1,
"LV_THEME_DEFAULT_INIT": "\\\"lv_theme_material_init\\\"",
"LV_THEME_DEFAULT_COLOR_PRIMARY": "\\\"LV_COLOR_RED\\\"",
"LV_THEME_DEFAULT_COLOR_SECONDARY": "\\\"LV_COLOR_BLUE\\\"",
"LV_THEME_DEFAULT_FLAG" : "\\\"LV_THEME_MATERIAL_FLAG_LIGHT\\\"",
"LV_THEME_DEFAULT_FONT_SMALL" : "\\\"&lv_font_montserrat_16\\\"",
"LV_THEME_DEFAULT_FONT_NORMAL" : "\\\"&lv_font_montserrat_16\\\"",
"LV_THEME_DEFAULT_FONT_SUBTITLE" : "\\\"&lv_font_montserrat_16\\\"",
"LV_THEME_DEFAULT_FONT_TITLE" : "\\\"&lv_font_montserrat_16\\\"",
"LV_USE_DEBUG":0,
"LV_USE_ASSERT_NULL":0,
"LV_USE_ASSERT_MEM":0,
"LV_USE_ASSERT_STR":0,
"LV_USE_ASSERT_OBJ":0,
"LV_USE_ASSERT_STYLE":0,
"LV_FONT_MONTSERRAT_12":0,
"LV_FONT_MONTSERRAT_16":1,
"LV_FONT_MONTSERRAT_22":0,
"LV_FONT_MONTSERRAT_28":0,
"LV_FONT_MONTSERRAT_12_SUBPX":0,
"LV_FONT_MONTSERRAT_28_COMPRESSED":0,
"LV_FONT_UNSCII_8":0,
"LV_USE_BIDI": 0,
"LV_USE_OBJ_REALIGN": 0,
"LV_USE_EXT_CLICK_AREA":"LV_EXT_CLICK_AREA_TINY",
"LV_USE_ARC":1,
"LV_USE_BAR":1,
"LV_USE_BTN":1,
"LV_USE_BTNM":1,
"LV_USE_CALENDAR":1,
"LV_USE_CANVAS":1,
"LV_USE_CHECKBOX":1,
"LV_USE_CHART":1,
"LV_USE_CONT":1,
"LV_USE_CPICKER":1,
"LV_USE_DROPDOWN":1,
"LV_USE_GAUGE":1,
"LV_USE_IMG":1,
"LV_USE_IMGBTN":1,
"LV_USE_KEYBOARD":1,
"LV_USE_LABEL":1,
"LV_USE_LED":1,
"LV_USE_LINE":1,
"LV_USE_LIST":1,
"LV_USE_LINEMETER":1,
"LV_USE_OBJMASK":1,
"LV_USE_MBOX":1,
"LV_USE_PAGE":1,
"LV_USE_SPINNER":0, #Disabled beacsue needs anim
"LV_USE_ROLLER":1,
"LV_USE_SLIDER":1,
"LV_USE_SPINBOX":1,
"LV_USE_SWITCH":1,
"LV_USE_TEXTAREA":1,
"LV_USE_TABLE":1,
"LV_USE_TABVIEW":1,
"LV_USE_TILEVIEW":1,
"LV_USE_WIN":1
}
all_obj_all_features = {
"LV_DPI":100,
"LV_MEM_SIZE":32*1024,
"LV_HOR_RES_MAX":480,
"LV_VER_RES_MAX":320,
"LV_COLOR_DEPTH":32,
"LV_COLOR_SCREEN_TRANSP":1,
"LV_USE_GROUP":1,
"LV_USE_ANIMATION":1,
"LV_ANTIALIAS":1,
"LV_GPU":1,
"LV_USE_FILESYSTEM":1,
"LV_USE_IMG_TRANSFORM":1,
"LV_USE_API_EXTENSION_V6":1,
"LV_USE_USER_DATA":1,
"LV_USE_USER_DATA_FREE":0,
"LV_USE_LOG":1,
"LV_USE_THEME_MATERIAL":1,
"LV_USE_THEME_EMPTY":1,
"LV_USE_THEME_MONO":1,
"LV_USE_THEME_TEMPLATE":1,
"LV_THEME_DEFAULT_INIT": "\\\"lv_theme_material_init\\\"",
"LV_THEME_DEFAULT_COLOR_PRIMARY": "\\\"LV_COLOR_RED\\\"",
"LV_THEME_DEFAULT_COLOR_SECONDARY": "\\\"LV_COLOR_BLUE\\\"",
"LV_THEME_DEFAULT_FLAG" : "\\\"LV_THEME_MATERIAL_FLAG_LIGHT\\\"",
"LV_THEME_DEFAULT_FONT_SMALL" : "\\\"&lv_font_montserrat_12\\\"",
"LV_THEME_DEFAULT_FONT_NORMAL" : "\\\"&lv_font_montserrat_16\\\"",
"LV_THEME_DEFAULT_FONT_SUBTITLE" : "\\\"&lv_font_montserrat_22\\\"",
"LV_THEME_DEFAULT_FONT_TITLE" : "\\\"&lv_font_montserrat_28\\\"",
"LV_LOG_PRINTF":0,
"LV_USE_DEBUG":0,
"LV_USE_ASSERT_NULL":0,
"LV_USE_ASSERT_MEM":0,
"LV_USE_ASSERT_STR":0,
"LV_USE_ASSERT_OBJ":0,
"LV_USE_ASSERT_STYLE":0,
"LV_FONT_MONTSERRAT_12":1,
"LV_FONT_MONTSERRAT_16":1,
"LV_FONT_MONTSERRAT_22":1,
"LV_FONT_MONTSERRAT_28":1,
"LV_FONT_MONTSERRAT_12_SUBPX":1,
"LV_FONT_MONTSERRAT_28_COMPRESSED":1,
"LV_FONT_UNSCII_8":1,
"LV_USE_ARC":1,
"LV_USE_BAR":1,
"LV_USE_BTN":1,
"LV_USE_BTNM":1,
"LV_USE_CALENDAR":1,
"LV_USE_CANVAS":1,
"LV_USE_CHECKBOX":1,
"LV_USE_CHART":1,
"LV_USE_CONT":1,
"LV_USE_CPICKER":1,
"LV_USE_DROPDOWN":1,
"LV_USE_GAUGE":1,
"LV_USE_IMG":1,
"LV_USE_IMGBTN":1,
"LV_USE_KEYBOARD":1,
"LV_USE_LABEL":1,
"LV_USE_LED":1,
"LV_USE_LINE":1,
"LV_USE_LIST":1,
"LV_USE_LINEMETER":1,
"LV_USE_OBJMASK":1,
"LV_USE_MBOX":1,
"LV_USE_PAGE":1,
"LV_USE_SPINNER":1,
"LV_USE_ROLLER":1,
"LV_USE_SLIDER":1,
"LV_USE_SPINBOX":1,
"LV_USE_SWITCH":1,
"LV_USE_TEXTAREA":1,
"LV_USE_TABLE":1,
"LV_USE_TABVIEW":1,
"LV_USE_TILEVIEW":1,
"LV_USE_WIN":1
}
advanced_features = {
"LV_DPI":100,
"LV_MEM_SIZE":4*1024*1024,
"LV_MEM_CUSTOM":1,
"LV_HOR_RES_MAX":800,
"LV_VER_RES_MAX":480,
"LV_COLOR_DEPTH":16,
"LV_COLOR_16_SWAP":1,
"LV_COLOR_SCREEN_TRANSP":1,
"LV_USE_GROUP":1,
"LV_USE_ANIMATION":1,
"LV_ANTIALIAS":1,
"LV_GPU":1,
"LV_USE_FILESYSTEM":1,
"LV_USE_IMG_TRANSFORM":1,
"LV_USE_API_EXTENSION_V6":1,
"LV_USE_USER_DATA":1,
"LV_USE_USER_DATA_FREE":1,
"LV_USER_DATA_FREE_INCLUDE":"\\\"<stdio.h>\\\"",
"LV_USER_DATA_FREE": "\\\"free\\\"",
"LV_IMG_CACHE_DEF_SIZE":32,
"LV_USE_LOG":1,
"LV_USE_THEME_MATERIAL":1,
"LV_USE_THEME_EMPTY":1,
"LV_USE_THEME_TEMPLATE":1,
"LV_THEME_DEFAULT_INIT": "\\\"lv_theme_material_init\\\"",
"LV_THEME_DEFAULT_COLOR_PRIMARY": "\\\"LV_COLOR_RED\\\"",
"LV_THEME_DEFAULT_COLOR_SECONDARY": "\\\"LV_COLOR_BLUE\\\"",
"LV_THEME_DEFAULT_FLAG" : "\\\"LV_THEME_MATERIAL_FLAG_LIGHT\\\"",
"LV_THEME_DEFAULT_FONT_SMALL" : "\\\"&lv_font_montserrat_12\\\"",
"LV_THEME_DEFAULT_FONT_NORMAL" : "\\\"&lv_font_montserrat_16\\\"",
"LV_THEME_DEFAULT_FONT_SUBTITLE" : "\\\"&lv_font_montserrat_22\\\"",
"LV_THEME_DEFAULT_FONT_TITLE" : "\\\"&lv_font_montserrat_28\\\"",
"LV_LOG_PRINTF":1,
"LV_USE_DEBUG":1,
"LV_USE_ASSERT_NULL":1,
"LV_USE_ASSERT_MEM":1,
"LV_USE_ASSERT_STR":1,
"LV_USE_ASSERT_OBJ":1,
"LV_USE_ASSERT_STYLE":1,
"LV_FONT_MONTSERRAT_12":1,
"LV_FONT_MONTSERRAT_16":1,
"LV_FONT_MONTSERRAT_22":1,
"LV_FONT_MONTSERRAT_28":1,
"LV_FONT_MONTSERRAT_12_SUBPX":1,
"LV_FONT_MONTSERRAT_28_COMPRESSED":1,
"LV_FONT_UNSCII_8":1,
"LV_USE_BIDI": 1,
"LV_USE_REVERSE_ARABIC_PERSIAN_CHARS":1,
"LV_USE_OBJ_REALIGN": 1,
"LV_FONT_FMT_TXT_LARGE":1,
"LV_FONT_SUBPX_BGR":1,
"LV_USE_BIDI": 1,
"LV_USE_OBJ_REALIGN": 1,
"LV_USE_EXT_CLICK_AREA":"LV_EXT_CLICK_AREA_FULL",
"LV_USE_ARC":1,
"LV_USE_BAR":1,
"LV_USE_BTN":1,
"LV_USE_BTNM":1,
"LV_USE_CALENDAR":1,
"LV_USE_CANVAS":1,
"LV_USE_CHECKBOX":1,
"LV_USE_CHART":1,
"LV_USE_CONT":1,
"LV_USE_CPICKER":1,
"LV_USE_DROPDOWN":1,
"LV_USE_GAUGE":1,
"LV_USE_IMG":1,
"LV_USE_IMGBTN":1,
"LV_USE_KEYBOARD":1,
"LV_USE_LABEL":1,
"LV_USE_LED":1,
"LV_USE_LINE":1,
"LV_USE_LIST":1,
"LV_USE_LINEMETER":1,
"LV_USE_OBJMASK":1,
"LV_USE_MBOX":1,
"LV_USE_PAGE":1,
"LV_USE_SPINNER":1,
"LV_USE_ROLLER":1,
"LV_USE_SLIDER":1,
"LV_USE_SPINBOX":1,
"LV_USE_SWITCH":1,
"LV_USE_TEXTAREA":1,
"LV_USE_TABLE":1,
"LV_USE_TABVIEW":1,
"LV_USE_TILEVIEW":1,
"LV_USE_WIN":1
}
build("Minimal monochrome", minimal_monochrome)
build("All objects, minimal features", all_obj_minimal_features)
build("All objects, all features", all_obj_all_features)
|
train_000.parquet/923
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/tests/build.py",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 10512,
"token_count": 5975
}
|
/**
* @file lv_test_conf.h
*
*/
#ifndef LV_TEST_CONF_H
#define LV_TEST_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
uint32_t custom_tick_get(void);
#define LV_TICK_CUSTOM_SYS_TIME_EXPR custom_tick_get()
typedef int16_t lv_coord_t;
typedef void * lv_disp_drv_user_data_t; /*Type of user data in the display driver*/
typedef void * lv_indev_drv_user_data_t; /*Type of user data in the input device driver*/
typedef void * lv_font_user_data_t;
typedef void * lv_obj_user_data_t;
typedef void * lv_anim_user_data_t;
typedef void * lv_group_user_data_t;
typedef void * lv_fs_drv_user_data_t;
typedef void * lv_img_decoder_user_data_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_TEST_CONF_H*/
|
train_000.parquet/924
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/tests/lv_test_conf.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 1066,
"token_count": 433
}
|
/**
* @file lv_test_assert.c
*
* Copyright 2002-2010 Guillaume Cottenceau.
*
* This software may be freely redistributed under the terms
* of the X11 license.
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_test_assert.h"
#include "../lvgl.h"
#if LV_BUILD_TEST
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <stdarg.h>
#define PNG_DEBUG 3
#include <png.h>
/*********************
* DEFINES
*********************/
#define REF_IMGS_PATH "lvgl/tests/lv_test_ref_imgs/"
/**********************
* TYPEDEFS
**********************/
typedef struct {
int width, height;
png_byte color_type;
png_byte bit_depth;
png_structp png_ptr;
png_infop info_ptr;
int number_of_passes;
png_bytep * row_pointers;
}png_img_t;
/**********************
* STATIC PROTOTYPES
**********************/
static void read_png_file(png_img_t * p, const char* file_name);
//static void write_png_file(png_img_t * p, const char* file_name);
static void png_release(png_img_t * p);
//static void process_file(png_img_t * p);
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
void lv_test_print(const char * s, ...)
{
va_list args;
va_start(args, s);
vfprintf(stdout, s, args);
fprintf(stdout, "\n");
va_end(args);
}
void lv_test_exit(const char * s, ...)
{
va_list args;
va_start(args, s);
vfprintf(stderr, s, args);
fprintf(stderr, "\n");
va_end(args);
exit(1);
}
void lv_test_error(const char * s, ...)
{
va_list args;
va_start(args, s);
vfprintf(stderr, s, args);
fprintf(stderr, "\n");
va_end(args);
exit(1);
}
void lv_test_assert_int_eq(int32_t n_ref, int32_t n_act, const char * s)
{
if(n_ref != n_act) {
lv_test_error(" FAIL: %s. (Expected: %d, Actual: %d)", s, n_ref, n_act);
} else {
lv_test_print(" PASS: %s. (Expected: %d)", s, n_ref);
}
}
void lv_test_assert_int_gt(int32_t n_ref, int32_t n_act, const char * s)
{
if(n_act <= n_ref) {
lv_test_error(" FAIL: %s. (Expected: > %d, Actual: %d)", s, n_ref, n_act);
} else {
lv_test_print(" PASS: %s. (Expected: > %d, , Actual: %d)", s, n_ref, n_act);
}
}
void lv_test_assert_int_lt(int32_t n_ref, int32_t n_act, const char * s)
{
if(n_act >= n_ref) {
lv_test_error(" FAIL: %s. (Expected: < %d, Actual: %d)", s, n_ref, n_act);
} else {
lv_test_print(" PASS: %s. (Expected: < %d, , Actual: %d)", s, n_ref, n_act);
}
}
void lv_test_assert_str_eq(const char * s_ref, const char * s_act, const char * s)
{
if(strcmp(s_ref, s_act) != 0) {
lv_test_error(" FAIL: %s. (Expected: %s, Actual: %s)", s, s_ref, s_act);
} else {
lv_test_print(" PASS: %s. (Expected: %s)", s, s_ref);
}
}
void lv_test_assert_ptr_eq(const void * p_ref, const void * p_act, const char * s)
{
if(p_ref != p_act) {
lv_test_error(" FAIL: %s. (Expected: 0x%lx, Actual: 0x%lx)", s, p_ref, p_act);
} else {
lv_test_print(" PASS: %s. (Expected: 0x%lx)", s, p_ref);
}
}
void lv_test_assert_color_eq(lv_color_t c_ref, lv_color_t c_act, const char * s)
{
if(c_ref.full != c_act.full) {
lv_test_error(" FAIL: %s. (Expected: R:%02x, G:%02x, B:%02x, Actual: R:%02x, G:%02x, B:%02x)", s,
c_ref.ch.red, c_ref.ch.green, c_ref.ch.blue,
c_act.ch.red, c_act.ch.green, c_act.ch.blue);
} else {
lv_test_print(" PASS: %s. (Expected: R:%02x, G:%02x, B:%02x)", s,
c_ref.ch.red, c_ref.ch.green, c_ref.ch.blue);
}
}
void lv_test_assert_img_eq(const char * fn_ref, const char * s)
{
char fn_ref_full[512];
sprintf(fn_ref_full, "%s%s", REF_IMGS_PATH, fn_ref);
png_img_t p;
read_png_file(&p, fn_ref_full);
uint8_t * screen_buf;
lv_disp_t * disp = lv_disp_get_default();
lv_refr_now(disp);
screen_buf = disp->driver.buffer->buf1;
bool err = false;
int x, y, i_buf = 0;
for (y=0; y<p.height; y++) {
png_byte* row = p.row_pointers[y];
for (x=0; x<p.width; x++) {
const png_byte* ptr_ref = &(row[x*3]);
uint8_t * ptr_act = &(screen_buf[i_buf*4]);
uint8_t tmp = ptr_act[0];
ptr_act[0] = ptr_act[2];
ptr_act[2] = tmp;
if(memcmp(ptr_act, ptr_ref, 3) != 0) {
err = true;
break;
}
i_buf++;
}
if(err) break;
}
png_release(&p);
if(err) {
lv_test_error(" FAIL: %s. (Expected: %s)", s, fn_ref);
} else {
lv_test_print(" PASS: %s. (Expected: %s)", s, fn_ref);
}
}
/**********************
* STATIC FUNCTIONS
**********************/
static void read_png_file(png_img_t * p, const char* file_name)
{
char header[8]; // 8 is the maximum size that can be checked
/* open file and test for it being a png */
FILE *fp = fopen(file_name, "rb");
if (!fp)
lv_test_exit("[read_png_file] File %s could not be opened for reading", file_name);
size_t rcnt = fread(header, 1, 8, fp);
if (rcnt != 8 || png_sig_cmp((png_const_bytep)header, 0, 8))
lv_test_exit("[read_png_file] File %s is not recognized as a PNG file", file_name);
/* initialize stuff */
p->png_ptr = png_create_read_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
if (!p->png_ptr)
lv_test_exit("[read_png_file] png_create_read_struct failed");
p->info_ptr = png_create_info_struct(p->png_ptr);
if (!p->info_ptr)
lv_test_exit("[read_png_file] png_create_info_struct failed");
if (setjmp(png_jmpbuf(p->png_ptr)))
lv_test_exit("[read_png_file] Error during init_io");
png_init_io(p->png_ptr, fp);
png_set_sig_bytes(p->png_ptr, 8);
png_read_info(p->png_ptr, p->info_ptr);
p->width = png_get_image_width(p->png_ptr, p->info_ptr);
p->height = png_get_image_height(p->png_ptr, p->info_ptr);
p->color_type = png_get_color_type(p->png_ptr, p->info_ptr);
p->bit_depth = png_get_bit_depth(p->png_ptr, p->info_ptr);
p->number_of_passes = png_set_interlace_handling(p->png_ptr);
png_read_update_info(p->png_ptr, p->info_ptr);
/* read file */
if (setjmp(png_jmpbuf(p->png_ptr)))
lv_test_exit("[read_png_file] Error during read_image");
p->row_pointers = (png_bytep*) malloc(sizeof(png_bytep) * p->height);
int y;
for (y=0; y<p->height; y++)
p->row_pointers[y] = (png_byte*) malloc(png_get_rowbytes(p->png_ptr,p->info_ptr));
png_read_image(p->png_ptr, p->row_pointers);
fclose(fp);
}
//
//
//static void write_png_file(png_img_t * p, const char* file_name)
//{
// /* create file */
// FILE *fp = fopen(file_name, "wb");
// if (!fp)
// lv_test_exit("[write_png_file] File %s could not be opened for writing", file_name);
//
//
// /* initialize stuff */
// p->png_ptr = png_create_write_struct(PNG_LIBPNG_VER_STRING, NULL, NULL, NULL);
//
// if (!p->png_ptr)
// lv_test_exit("[write_png_file] png_create_write_struct failed");
//
// p->info_ptr = png_create_info_struct(p->png_ptr);
// if (!p->info_ptr)
// lv_test_exit("[write_png_file] png_create_info_struct failed");
//
// if (setjmp(png_jmpbuf(p->png_ptr)))
// lv_test_exit("[write_png_file] Error during init_io");
//
// png_init_io(p->png_ptr, fp);
//
//
// /* write header */
// if (setjmp(png_jmpbuf(p->png_ptr)))
// lv_test_exit("[write_png_file] Error during writing header");
//
// png_set_IHDR(p->png_ptr, p->info_ptr, p->width, p->height,
// p->bit_depth, p->color_type, PNG_INTERLACE_NONE,
// PNG_COMPRESSION_TYPE_BASE, PNG_FILTER_TYPE_BASE);
//
// png_write_info(p->png_ptr, p->info_ptr);
//
//
// /* write bytes */
// if (setjmp(png_jmpbuf(p->png_ptr)))
// lv_test_exit("[write_png_file] Error during writing bytes");
//
// png_write_image(p->png_ptr, p->row_pointers);
//
//
// /* end write */
// if (setjmp(png_jmpbuf(p->png_ptr)))
// lv_test_exit("[write_png_file] Error during end of write");
//
// png_write_end(p->png_ptr, NULL);
//
// fclose(fp);
//}
//
static void png_release(png_img_t * p)
{
int y;
for (y=0; y<p->height; y++)
free(p->row_pointers[y]);
free(p->row_pointers);
}
//
//static void process_file(png_img_t * p)
//{
// if (png_get_color_type(p->png_ptr, p->info_ptr) == PNG_COLOR_TYPE_RGB)
// lv_test_exit("[process_file] input file is PNG_COLOR_TYPE_RGB but must be PNG_COLOR_TYPE_RGBA "
// "(lacks the alpha channel)");
//
// if (png_get_color_type(p->png_ptr, p->info_ptr) != PNG_COLOR_TYPE_RGBA)
// lv_test_exit("[process_file] color_type of input file must be PNG_COLOR_TYPE_RGBA (%d) (is %d)",
// PNG_COLOR_TYPE_RGBA, png_get_color_type(p->png_ptr, p->info_ptr));
//
// int x, y;
// for (y=0; y<p->height; y++) {
// png_byte* row = p->row_pointers[y];
// for (x=0; x<p->width; x++) {
// png_byte* ptr = &(row[x*4]);
// printf("Pixel at position [ %d - %d ] has RGBA values: %d - %d - %d - %d\n",
// x, y, ptr[0], ptr[1], ptr[2], ptr[3]);
//
// /* set red value to 0 and green value to the blue one */
// ptr[0] = 0;
// ptr[1] = ptr[2];
// }
// }
//}
#endif
|
train_000.parquet/925
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/tests/lv_test_assert.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 9608,
"token_count": 4168
}
|
#include "../lvgl.h"
#include <stdio.h>
#include <stdlib.h>
#include <sys/time.h>
#include "lv_test_core/lv_test_core.h"
#if LV_BUILD_TEST
static void hal_init(void);
static void dummy_flush_cb(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p);
int main(void)
{
printf("Call lv_init...\n");
lv_init();
hal_init();
lv_test_core();
printf("Exit with success!\n");
return 0;
}
static void hal_init(void)
{
static lv_disp_buf_t disp_buf;
lv_color_t * disp_buf1 = (lv_color_t *)malloc(LV_HOR_RES * LV_VER_RES * sizeof(lv_color_t));
lv_disp_buf_init(&disp_buf, disp_buf1, NULL, LV_HOR_RES* LV_VER_RES);
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.buffer = &disp_buf;
disp_drv.flush_cb = dummy_flush_cb;
lv_disp_drv_register(&disp_drv);
}
static void dummy_flush_cb(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{
LV_UNUSED(area);
LV_UNUSED(color_p);
lv_disp_flush_ready(disp_drv);
}
uint32_t custom_tick_get(void)
{
static uint64_t start_ms = 0;
if(start_ms == 0) {
struct timeval tv_start;
gettimeofday(&tv_start, NULL);
start_ms = (tv_start.tv_sec * 1000000 + tv_start.tv_usec) / 1000;
}
struct timeval tv_now;
gettimeofday(&tv_now, NULL);
uint64_t now_ms;
now_ms = (tv_now.tv_sec * 1000000 + tv_now.tv_usec) / 1000;
uint32_t time_ms = now_ms - start_ms;
return time_ms;
}
#endif
|
train_000.parquet/926
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/tests/lv_test_main.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 1487,
"token_count": 699
}
|
#!/usr/bin/env python3.6
import os
print("\nGenerating 16 px CJK")
os.system(u"./built_in_font_gen.py --size 16 -o lv_font_simsun_16_cjk.c --bpp 4 --font SimSun.woff -r 0x20-0x7f --symbols 一在有個我不這了他也就人都說而我們你了要會對及和與以很種的大能著她那上但年還可以最自己為來所他們兩各可為或好等又將因為於由從更被才已者每次把三什麼問題其讓此做再所以只與則台灣卻並位想去呢學生表示到公司將如果社會看小天因此新但是它中使工作全覺得使用這些裡並由於時候知道這樣一認為時間事過向可能中國美國到和幾系統政府大家國家許多生活跟已經大學研究因本二活動該世界應四希望方式內項啊下環境一些必須文化高孩子沒有不能如開始元不同仍網路日本用中心來對雖然重要地方進行關係市場太老師提供學校應該指出經濟其他家發展教育成為多非常便方面很多吃然後未發現電腦一樣而且心不過無法企業正服務較不會臺灣曾嗎空間看到五如何國內們無對於以及之後可是當人員比先產品資訊資料比較先生地除了大陸需要像在給歲請月些名另若亦地區技術至特別其實國際不要發生參加一定其中問台北包括講造成看像常即喜歡去沒出現政治話走單位一直吧是否當然整處理歷史了解那怎麼機會家聽所有只要朋友令甚至用真六呀情況還是錢方法點任何經驗藝術你們十主要媽媽增加提出為什麼以您計畫作利用東西在條設計找之間成長能夠決定學習誰見半時代完成帶相當同學件能力別人生命下來場會議容易開發民眾事情書事實有關自組織言多愛建立相關均產生多業者解決完全的話接受知約一般推動過程管理功能手打水要求小朋友教授難我國告訴內容結果調查家庭成立選擇經營然而父母寫人類至於買尤其配合進入例如得討論依作品情形資源原因啦妳運動觀念給軟體品質經過如此嗯精神影響之過好像成參與以後於是部分另外公園透過訓練努力研究具有共同所謂下行為合作經合作目標起來考慮長意見辦法音樂連受廠商隻受到一切或是中央某女性教學極獲得真的路來快國小部份工程女人舉行句只是段根據現象人民土地面對注意這裡新聞繼續相信政策變成計劃強調學人士前前存在制度意義代表課程該沒至需求人生那些成功爸爸產業負責民間雖影響直接幾乎分實際團體價值使得類形成科技這麼當七不但往本身標準似乎應用或者動物電話態度建設事業老那麼常常字坐舉辦自我有的具目的塊條件即使好十分多少放又電影科學執行邊委員會溝通開一起張針對員工引起自然那麼安全總統此外擁有並且事件設計研究所語言嚴重故事學術片設備之外車基本實在久套達到改善死結構住皆改變拿小組支持座醫院既僅值得學者八交通階段就是申請主管申請同感覺電視母親嘛香港記者壓力快樂喝敢院也許人們談生產怕就身體規定程度積極知識作為機構而是鼓勵角色狀況專家據清楚不僅比賽玩效果越保護共開放附近上父親專業經費曾經工作願意分別重視不少歡迎小孩小時中國人顯示中共出男人避免屬於實施聲音主義行動不可只有校園興趣山表現得回來主任裡面經常不再電子受思想頭終於謝謝協助除當地正式真正低性份因素推出上價格去認識方向責任說明工業大量做逐漸心理一點供須簡單運用觀察往往規劃減少重新業務報導仍然感到開放領域有效女要從事發揮人才反而行政銀行公共媒體提高代自然社區力量啊教育部愈超過維持家長結合校長通常缺乏委員特色結果有時教師之前遠控制本否則法少原則要臉通過建議工具作業達節目智慧來自而變化同樣形式站以為健康擔任人口規劃剛特殊原來道分傳統總是前往投資加強不斷對象追求加上比思考製作台北市取得出來加入台安排兒童國中範圍老人雙方牠北京年輕結束教程式婦女找到彼此全球成本回到部而已之下等變期間非小姐整體採用根本叫歐洲正在加以充滿系列隨著早等等頗不足總分析深報告不錯在於旁笑故消費者意識公尺民族為主大眾到底願度大概對方官員發表進一步自由正確豐富國民黨戰爭怎麼樣只好明顯改革表達肯定強高興哪樹適合茶別國外關心蘇聯成績人物聽到創造不必不論尚居民不管美麗伊拉克帶來有般永遠感情兒子這樣子起全部".encode('utf-8'))
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_simsun_16_cjk.c')
exit()
print("Generating 12 px")
os.system("./built_in_font_gen.py --size 12 -o lv_font_montserrat_12.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_12.c')
print("\nGenerating 14 px")
os.system("./built_in_font_gen.py --size 14 -o lv_font_montserrat_14.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_14.c')
print("\nGenerating 16 px")
os.system("./built_in_font_gen.py --size 16 -o lv_font_montserrat_16.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_16.c')
print("\nGenerating 18 px")
os.system("./built_in_font_gen.py --size 18 -o lv_font_montserrat_18.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_18.c')
print("\nGenerating 20 px")
os.system("./built_in_font_gen.py --size 20 -o lv_font_montserrat_20.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_20.c')
print("\nGenerating 22 px")
os.system("./built_in_font_gen.py --size 22 -o lv_font_montserrat_22.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_22.c')
print("\nGenerating 24 px")
os.system("./built_in_font_gen.py --size 24 -o lv_font_montserrat_24.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_24.c')
print("\nGenerating 26 px")
os.system("./built_in_font_gen.py --size 26 -o lv_font_montserrat_26.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_26.c')
print("\nGenerating 28 px")
os.system("./built_in_font_gen.py --size 28 -o lv_font_montserrat_28.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_28.c')
print("\nGenerating 30 px")
os.system("./built_in_font_gen.py --size 30 -o lv_font_montserrat_30.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_30.c')
print("\nGenerating 32 px")
os.system("./built_in_font_gen.py --size 32 -o lv_font_montserrat_32.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_32.c')
print("\nGenerating 34 px")
os.system("./built_in_font_gen.py --size 34 -o lv_font_montserrat_34.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_34.c')
print("\nGenerating 36 px")
os.system("./built_in_font_gen.py --size 36 -o lv_font_montserrat_36.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_36.c')
print("\nGenerating 38 px")
os.system("./built_in_font_gen.py --size 38 -o lv_font_montserrat_38.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_38.c')
print("\nGenerating 40 px")
os.system("./built_in_font_gen.py --size 40 -o lv_font_montserrat_40.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_40.c')
print("\nGenerating 42 px")
os.system("./built_in_font_gen.py --size 42 -o lv_font_montserrat_42.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_42.c')
print("\nGenerating 44 px")
os.system("./built_in_font_gen.py --size 44 -o lv_font_montserrat_44.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_44.c')
print("\nGenerating 46 px")
os.system("./built_in_font_gen.py --size 46 -o lv_font_montserrat_46.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_46.c')
print("\nGenerating 48 px")
os.system("./built_in_font_gen.py --size 48 -o lv_font_montserrat_48.c --bpp 4")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_48.c')
print("\nGenerating 12 px subpx")
os.system("./built_in_font_gen.py --size 12 -o lv_font_montserrat_12_subpx.c --bpp 4 --subpx")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_12_subpx.c')
print("\nGenerating 28 px compressed")
os.system("./built_in_font_gen.py --size 28 -o lv_font_montserrat_28_compressed.c --bpp 4 --compressed")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_montserrat_28_compressed.c')
print("\nGenerating 16 px CJK")
os.system(u"./built_in_font_gen.py --size 16 -o lv_font_simsun_16_cjk.c --bpp 4 --font SimSun.woff -r 0x20-0x7f --symbols 一在有個我不這了他也就人都說而我們你了要會對及和與以很種的大能著她那上但年還可以最自己為來所他們兩各可為或好等又將因為於由從更被才已者每次把三什麼問題其讓此做再所以只與則台灣卻並位想去呢學生表示到公司將如果社會看小天因此新但是它中使工作全覺得使用這些裡並由於時候知道這樣一認為時間事過向可能中國美國到和幾系統政府大家國家許多生活跟已經大學研究因本二活動該世界應四希望方式內項啊下環境一些必須文化高孩子沒有不能如開始元不同仍網路日本用中心來對雖然重要地方進行關係市場太老師提供學校應該指出經濟其他家發展教育成為多非常便方面很多吃然後未發現電腦一樣而且心不過無法企業正服務較不會臺灣曾嗎空間看到五如何國內們無對於以及之後可是當人員比先產品資訊資料比較先生地除了大陸需要像在給歲請月些名另若亦地區技術至特別其實國際不要發生參加一定其中問台北包括講造成看像常即喜歡去沒出現政治話走單位一直吧是否當然整處理歷史了解那怎麼機會家聽所有只要朋友令甚至用真六呀情況還是錢方法點任何經驗藝術你們十主要媽媽增加提出為什麼以您計畫作利用東西在條設計找之間成長能夠決定學習誰見半時代完成帶相當同學件能力別人生命下來場會議容易開發民眾事情書事實有關自組織言多愛建立相關均產生多業者解決完全的話接受知約一般推動過程管理功能手打水要求小朋友教授難我國告訴內容結果調查家庭成立選擇經營然而父母寫人類至於買尤其配合進入例如得討論依作品情形資源原因啦妳運動觀念給軟體品質經過如此嗯精神影響之過好像成參與以後於是部分另外公園透過訓練努力研究具有共同所謂下行為合作經合作目標起來考慮長意見辦法音樂連受廠商隻受到一切或是中央某女性教學極獲得真的路來快國小部份工程女人舉行句只是段根據現象人民土地面對注意這裡新聞繼續相信政策變成計劃強調學人士前前存在制度意義代表課程該沒至需求人生那些成功爸爸產業負責民間雖影響直接幾乎分實際團體價值使得類形成科技這麼當七不但往本身標準似乎應用或者動物電話態度建設事業老那麼常常字坐舉辦自我有的具目的塊條件即使好十分多少放又電影科學執行邊委員會溝通開一起張針對員工引起自然那麼安全總統此外擁有並且事件設計研究所語言嚴重故事學術片設備之外車基本實在久套達到改善死結構住皆改變拿小組支持座醫院既僅值得學者八交通階段就是申請主管申請同感覺電視母親嘛香港記者壓力快樂喝敢院也許人們談生產怕就身體規定程度積極知識作為機構而是鼓勵角色狀況專家據清楚不僅比賽玩效果越保護共開放附近上父親專業經費曾經工作願意分別重視不少歡迎小孩小時中國人顯示中共出男人避免屬於實施聲音主義行動不可只有校園興趣山表現得回來主任裡面經常不再電子受思想頭終於謝謝協助除當地正式真正低性份因素推出上價格去認識方向責任說明工業大量做逐漸心理一點供須簡單運用觀察往往規劃減少重新業務報導仍然感到開放領域有效女要從事發揮人才反而行政銀行公共媒體提高代自然社區力量啊教育部愈超過維持家長結合校長通常缺乏委員特色結果有時教師之前遠控制本否則法少原則要臉通過建議工具作業達節目智慧來自而變化同樣形式站以為健康擔任人口規劃剛特殊原來道分傳統總是前往投資加強不斷對象追求加上比思考製作台北市取得出來加入台安排兒童國中範圍老人雙方牠北京年輕結束教程式婦女找到彼此全球成本回到部而已之下等變期間非小姐整體採用根本叫歐洲正在加以充滿系列隨著早等等頗不足總分析深報告不錯在於旁笑故消費者意識公尺民族為主大眾到底願度大概對方官員發表進一步自由正確豐富國民黨戰爭怎麼樣只好明顯改革表達肯定強高興哪樹適合茶別國外關心蘇聯成績人物聽到創造不必不論尚居民不管美麗伊拉克帶來有般永遠感情兒子這樣子起全部".encode('utf-8'))
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_simsun_16_cjk.c')
print("Generating 16 px Hebrew, Persian")
os.system("./built_in_font_gen.py --size 16 -o lv_font_dejavu_16_persian_hebrew.c --bpp 4 --font DejaVuSans.ttf -r 0x20-0x7f,0x5d0-0x5ea,0x600-0x6FF,0xFB50-0xFDFF,0xFE70-0xFEFF")
os.system('sed -i \'s|#include "lvgl/lvgl.h"|#include "../../lvgl.h"|\' lv_font_dejavu_16_persian_hebrew.c')
|
train_000.parquet/927
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/scripts/built_in_font/generate_all.py",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 8373,
"token_count": 4859
}
|
#!/usr/bin/env python3.6
import argparse
from argparse import RawTextHelpFormatter
import os
import sys
parser = argparse.ArgumentParser(description="""Create fonts for LittelvGL including the built-in symbols. lv_font_conv needs to be installed. See https://github.com/littlevgl/lv_font_conv
Example: python built_in_font_gen.py --size 16 -o lv_font_roboto_16.c --bpp 4 -r 0x20-0x7F""", formatter_class=RawTextHelpFormatter)
parser.add_argument('-s', '--size',
type=int,
metavar = 'px',
nargs='?',
help='Size of the font in px')
parser.add_argument('--bpp',
type=int,
metavar = '1,2,4',
nargs='?',
help='Bit per pixel')
parser.add_argument('-r', '--range',
nargs='+',
metavar = 'start-end',
default=['0x20-0x7F,0xB0,0x2022'],
help='Ranges and/or characters to include. Default is 0x20-7F (ASCII). E.g. -r 0x20-0x7F, 0x200, 324')
parser.add_argument('--symbols',
nargs='+',
metavar = 'sym',
default=[''],
help=u'Symbols to include. E.g. -s ÁÉŐ'.encode('utf-8'))
parser.add_argument('--font',
metavar = 'file',
nargs='?',
default='Montserrat-Medium.ttf',
help='A TTF or WOFF file')
parser.add_argument('-o', '--output',
nargs='?',
metavar='file',
help='Output file name. E.g. my_font_20.c')
parser.add_argument('--compressed', action='store_true',
help='Compress the bitmaps')
parser.add_argument('--subpx', action='store_true',
help='3 times wider letters for sub pixel rendering')
args = parser.parse_args()
if args.compressed == False:
compr = "--no-compress --no-prefilter"
else:
compr = ""
if len(args.symbols[0]) != 0:
args.symbols[0] = "--symbols " + args.symbols[0]
#Built in symbols
syms = "61441,61448,61451,61452,61452,61453,61457,61459,61461,61465,61468,61473,61478,61479,61480,61502,61512,61515,61516,61517,61521,61522,61523,61524,61543,61544,61550,61552,61553,61556,61559,61560,61561,61563,61587,61589,61636,61637,61639,61671,61674,61683,61724,61732,61787,61931,62016,62017,62018,62019,62020,62087,62099,62212,62189,62810,63426,63650"
#Run the command (Add degree and bbullet symbol)
cmd = "lv_font_conv {} --bpp {} --size {} --font {} -r {} {} --font FontAwesome5-Solid+Brands+Regular.woff -r {} --format lvgl -o {} --force-fast-kern-format".format(compr, args.bpp, args.size, args.font, args.range[0], args.symbols[0], syms, args.output)
os.system(cmd)
|
train_000.parquet/928
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/scripts/built_in_font/built_in_font_gen.py",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 2477,
"token_count": 1308
}
|
/**
* @file lv_port_indev_templ.c
*
*/
/*Copy this file as "lv_port_indev.c" and set this value to "1" to enable content*/
#if 0
/*********************
* INCLUDES
*********************/
#include "lv_port_indev_template.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static void touchpad_init(void);
static bool touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
static bool touchpad_is_pressed(void);
static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y);
static void mouse_init(void);
static bool mouse_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
static bool mouse_is_pressed(void);
static void mouse_get_xy(lv_coord_t * x, lv_coord_t * y);
static void keypad_init(void);
static bool keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
static uint32_t keypad_get_key(void);
static void encoder_init(void);
static bool encoder_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
static void encoder_handler(void);
static void button_init(void);
static bool button_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data);
static int8_t button_get_pressed_id(void);
static bool button_is_pressed(uint8_t id);
/**********************
* STATIC VARIABLES
**********************/
lv_indev_t * indev_touchpad;
lv_indev_t * indev_mouse;
lv_indev_t * indev_keypad;
lv_indev_t * indev_encoder;
lv_indev_t * indev_button;
static int32_t encoder_diff;
static lv_indev_state_t encoder_state;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
void lv_port_indev_init(void)
{
/* Here you will find example implementation of input devices supported by LittelvGL:
* - Touchpad
* - Mouse (with cursor support)
* - Keypad (supports GUI usage only with key)
* - Encoder (supports GUI usage only with: left, right, push)
* - Button (external buttons to press points on the screen)
*
* The `..._read()` function are only examples.
* You should shape them according to your hardware
*/
lv_indev_drv_t indev_drv;
/*------------------
* Touchpad
* -----------------*/
/*Initialize your touchpad if you have*/
touchpad_init();
/*Register a touchpad input device*/
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = touchpad_read;
indev_touchpad = lv_indev_drv_register(&indev_drv);
/*------------------
* Mouse
* -----------------*/
/*Initialize your touchpad if you have*/
mouse_init();
/*Register a mouse input device*/
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = mouse_read;
indev_mouse = lv_indev_drv_register(&indev_drv);
/*Set cursor. For simplicity set a HOME symbol now.*/
lv_obj_t * mouse_cursor = lv_img_create(lv_disp_get_scr_act(NULL), NULL);
lv_img_set_src(mouse_cursor, LV_SYMBOL_HOME);
lv_indev_set_cursor(indev_mouse, mouse_cursor);
/*------------------
* Keypad
* -----------------*/
/*Initialize your keypad or keyboard if you have*/
keypad_init();
/*Register a keypad input device*/
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_KEYPAD;
indev_drv.read_cb = keypad_read;
indev_keypad = lv_indev_drv_register(&indev_drv);
/* Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
* add objects to the group with `lv_group_add_obj(group, obj)`
* and assign this input device to group to navigate in it:
* `lv_indev_set_group(indev_keypad, group);` */
/*------------------
* Encoder
* -----------------*/
/*Initialize your encoder if you have*/
encoder_init();
/*Register a encoder input device*/
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_ENCODER;
indev_drv.read_cb = encoder_read;
indev_encoder = lv_indev_drv_register(&indev_drv);
/* Later you should create group(s) with `lv_group_t * group = lv_group_create()`,
* add objects to the group with `lv_group_add_obj(group, obj)`
* and assign this input device to group to navigate in it:
* `lv_indev_set_group(indev_encoder, group);` */
/*------------------
* Button
* -----------------*/
/*Initialize your button if you have*/
button_init();
/*Register a button input device*/
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_BUTTON;
indev_drv.read_cb = button_read;
indev_button = lv_indev_drv_register(&indev_drv);
/*Assign buttons to points on the screen*/
static const lv_point_t btn_points[2] = {
{10, 10}, /*Button 0 -> x:10; y:10*/
{40, 100}, /*Button 1 -> x:40; y:100*/
};
lv_indev_set_button_points(indev_button, btn_points);
}
/**********************
* STATIC FUNCTIONS
**********************/
/*------------------
* Touchpad
* -----------------*/
/*Initialize your touchpad*/
static void touchpad_init(void)
{
/*Your code comes here*/
}
/* Will be called by the library to read the touchpad */
static bool touchpad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static lv_coord_t last_x = 0;
static lv_coord_t last_y = 0;
/*Save the pressed coordinates and the state*/
if(touchpad_is_pressed()) {
touchpad_get_xy(&last_x, &last_y);
data->state = LV_INDEV_STATE_PR;
} else {
data->state = LV_INDEV_STATE_REL;
}
/*Set the last pressed coordinates*/
data->point.x = last_x;
data->point.y = last_y;
/*Return `false` because we are not buffering and no more data to read*/
return false;
}
/*Return true is the touchpad is pressed*/
static bool touchpad_is_pressed(void)
{
/*Your code comes here*/
return false;
}
/*Get the x and y coordinates if the touchpad is pressed*/
static void touchpad_get_xy(lv_coord_t * x, lv_coord_t * y)
{
/*Your code comes here*/
(*x) = 0;
(*y) = 0;
}
/*------------------
* Mouse
* -----------------*/
/* Initialize your mouse */
static void mouse_init(void)
{
/*Your code comes here*/
}
/* Will be called by the library to read the mouse */
static bool mouse_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
/*Get the current x and y coordinates*/
mouse_get_xy(&data->point.x, &data->point.y);
/*Get whether the mouse button is pressed or released*/
if(mouse_is_pressed()) {
data->state = LV_INDEV_STATE_PR;
} else {
data->state = LV_INDEV_STATE_REL;
}
/*Return `false` because we are not buffering and no more data to read*/
return false;
}
/*Return true is the mouse button is pressed*/
static bool mouse_is_pressed(void)
{
/*Your code comes here*/
return false;
}
/*Get the x and y coordinates if the mouse is pressed*/
static void mouse_get_xy(lv_coord_t * x, lv_coord_t * y)
{
/*Your code comes here*/
(*x) = 0;
(*y) = 0;
}
/*------------------
* Keypad
* -----------------*/
/* Initialize your keypad */
static void keypad_init(void)
{
/*Your code comes here*/
}
/* Will be called by the library to read the mouse */
static bool keypad_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint32_t last_key = 0;
/*Get the current x and y coordinates*/
mouse_get_xy(&data->point.x, &data->point.y);
/*Get whether the a key is pressed and save the pressed key*/
uint32_t act_key = keypad_get_key();
if(act_key != 0) {
data->state = LV_INDEV_STATE_PR;
/*Translate the keys to LVGL control characters according to your key definitions*/
switch(act_key) {
case 1:
act_key = LV_KEY_NEXT;
break;
case 2:
act_key = LV_KEY_PREV;
break;
case 3:
act_key = LV_KEY_LEFT;
break;
case 4:
act_key = LV_KEY_RIGHT;
break;
case 5:
act_key = LV_KEY_ENTER;
break;
}
last_key = act_key;
} else {
data->state = LV_INDEV_STATE_REL;
}
data->key = last_key;
/*Return `false` because we are not buffering and no more data to read*/
return false;
}
/*Get the currently being pressed key. 0 if no key is pressed*/
static uint32_t keypad_get_key(void)
{
/*Your code comes here*/
return 0;
}
/*------------------
* Encoder
* -----------------*/
/* Initialize your keypad */
static void encoder_init(void)
{
/*Your code comes here*/
}
/* Will be called by the library to read the encoder */
static bool encoder_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
data->enc_diff = encoder_diff;
data->state = encoder_state;
/*Return `false` because we are not buffering and no more data to read*/
return false;
}
/*Call this function in an interrupt to process encoder events (turn, press)*/
static void encoder_handler(void)
{
/*Your code comes here*/
encoder_diff += 0;
encoder_state = LV_INDEV_STATE_REL;
}
/*------------------
* Button
* -----------------*/
/* Initialize your buttons */
static void button_init(void)
{
/*Your code comes here*/
}
/* Will be called by the library to read the button */
static bool button_read(lv_indev_drv_t * indev_drv, lv_indev_data_t * data)
{
static uint8_t last_btn = 0;
/*Get the pressed button's ID*/
int8_t btn_act = button_get_pressed_id();
if(btn_act >= 0) {
data->state = LV_INDEV_STATE_PR;
last_btn = btn_act;
} else {
data->state = LV_INDEV_STATE_REL;
}
/*Save the last pressed button's ID*/
data->btn_id = last_btn;
/*Return `false` because we are not buffering and no more data to read*/
return false;
}
/*Get ID (0, 1, 2 ..) of the pressed button*/
static int8_t button_get_pressed_id(void)
{
uint8_t i;
/*Check to buttons see which is being pressed (assume there are 2 buttons)*/
for(i = 0; i < 2; i++) {
/*Return the pressed button's ID*/
if(button_is_pressed(i)) {
return i;
}
}
/*No button pressed*/
return -1;
}
/*Test if `id` button is pressed or not*/
static bool button_is_pressed(uint8_t id)
{
/*Your code comes here*/
return false;
}
#else /* Enable this file at the top */
/* This dummy typedef exists purely to silence -Wpedantic. */
typedef int keep_pedantic_happy;
#endif
|
train_000.parquet/929
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/examples/porting/lv_port_indev_template.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 10676,
"token_count": 3901
}
|
/**
* @file lv_port_disp_templ.c
*
*/
/*Copy this file as "lv_port_disp.c" and set this value to "1" to enable content*/
#if 0
/*********************
* INCLUDES
*********************/
#include "lv_port_disp_template.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static void disp_init(void);
static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p);
#if LV_USE_GPU
static void gpu_blend(lv_disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa);
static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width,
const lv_area_t * fill_area, lv_color_t color);
#endif
/**********************
* STATIC VARIABLES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
void lv_port_disp_init(void)
{
/*-------------------------
* Initialize your display
* -----------------------*/
disp_init();
/*-----------------------------
* Create a buffer for drawing
*----------------------------*/
/* LVGL requires a buffer where it draws the objects. The buffer's has to be greater than 1 display row
*
* There are three buffering configurations:
* 1. Create ONE buffer with some rows:
* LVGL will draw the display's content here and writes it to your display
*
* 2. Create TWO buffer with some rows:
* LVGL will draw the display's content to a buffer and writes it your display.
* You should use DMA to write the buffer's content to the display.
* It will enable LVGL to draw the next part of the screen to the other buffer while
* the data is being sent form the first buffer. It makes rendering and flushing parallel.
*
* 3. Create TWO screen-sized buffer:
* Similar to 2) but the buffer have to be screen sized. When LVGL is ready it will give the
* whole frame to display. This way you only need to change the frame buffer's address instead of
* copying the pixels.
* */
/* Example for 1) */
static lv_disp_buf_t disp_buf_1;
static lv_color_t buf1_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/
lv_disp_buf_init(&disp_buf_1, buf1_1, NULL, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
/* Example for 2) */
static lv_disp_buf_t disp_buf_2;
static lv_color_t buf2_1[LV_HOR_RES_MAX * 10]; /*A buffer for 10 rows*/
static lv_color_t buf2_2[LV_HOR_RES_MAX * 10]; /*An other buffer for 10 rows*/
lv_disp_buf_init(&disp_buf_2, buf2_1, buf2_2, LV_HOR_RES_MAX * 10); /*Initialize the display buffer*/
/* Example for 3) */
static lv_disp_buf_t disp_buf_3;
static lv_color_t buf3_1[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*A screen sized buffer*/
static lv_color_t buf3_2[LV_HOR_RES_MAX * LV_VER_RES_MAX]; /*An other screen sized buffer*/
lv_disp_buf_init(&disp_buf_3, buf3_1, buf3_2, LV_HOR_RES_MAX * LV_VER_RES_MAX); /*Initialize the display buffer*/
/*-----------------------------------
* Register the display in LVGL
*----------------------------------*/
lv_disp_drv_t disp_drv; /*Descriptor of a display driver*/
lv_disp_drv_init(&disp_drv); /*Basic initialization*/
/*Set up the functions to access to your display*/
/*Set the resolution of the display*/
disp_drv.hor_res = 480;
disp_drv.ver_res = 320;
/*Used to copy the buffer's content to the display*/
disp_drv.flush_cb = disp_flush;
/*Set a display buffer*/
disp_drv.buffer = &disp_buf_2;
#if LV_USE_GPU
/*Optionally add functions to access the GPU. (Only in buffered mode, LV_VDB_SIZE != 0)*/
/*Blend two color array using opacity*/
disp_drv.gpu_blend_cb = gpu_blend;
/*Fill a memory array with a color*/
disp_drv.gpu_fill_cb = gpu_fill;
#endif
/*Finally register the driver*/
lv_disp_drv_register(&disp_drv);
}
/**********************
* STATIC FUNCTIONS
**********************/
/* Initialize your display and the required peripherals. */
static void disp_init(void)
{
/*You code here*/
}
/* Flush the content of the internal buffer the specific area on the display
* You can use DMA or any hardware acceleration to do this operation in the background but
* 'lv_disp_flush_ready()' has to be called when finished. */
static void disp_flush(lv_disp_drv_t * disp_drv, const lv_area_t * area, lv_color_t * color_p)
{
/*The most simple case (but also the slowest) to put all pixels to the screen one-by-one*/
int32_t x;
int32_t y;
for(y = area->y1; y <= area->y2; y++) {
for(x = area->x1; x <= area->x2; x++) {
/* Put a pixel to the display. For example: */
/* put_px(x, y, *color_p)*/
color_p++;
}
}
/* IMPORTANT!!!
* Inform the graphics library that you are ready with the flushing*/
lv_disp_flush_ready(disp_drv);
}
/*OPTIONAL: GPU INTERFACE*/
#if LV_USE_GPU
/* If your MCU has hardware accelerator (GPU) then you can use it to blend to memories using opacity
* It can be used only in buffered mode (LV_VDB_SIZE != 0 in lv_conf.h)*/
static void gpu_blend(lv_disp_drv_t * disp_drv, lv_color_t * dest, const lv_color_t * src, uint32_t length, lv_opa_t opa)
{
/*It's an example code which should be done by your GPU*/
uint32_t i;
for(i = 0; i < length; i++) {
dest[i] = lv_color_mix(dest[i], src[i], opa);
}
}
/* If your MCU has hardware accelerator (GPU) then you can use it to fill a memory with a color
* It can be used only in buffered mode (LV_VDB_SIZE != 0 in lv_conf.h)*/
static void gpu_fill(lv_disp_drv_t * disp_drv, lv_color_t * dest_buf, lv_coord_t dest_width,
const lv_area_t * fill_area, lv_color_t color)
{
/*It's an example code which should be done by your GPU*/
int32_t x, y;
dest_buf += dest_width * fill_area->y1; /*Go to the first line*/
for(y = fill_area->y1; y <= fill_area->y2; y++) {
for(x = fill_area->x1; x <= fill_area->x2; x++) {
dest_buf[x] = color;
}
dest_buf+=dest_width; /*Go to the next line*/
}
}
#endif /*LV_USE_GPU*/
#else /* Enable this file at the top */
/* This dummy typedef exists purely to silence -Wpedantic. */
typedef int keep_pedantic_happy;
#endif
|
train_000.parquet/930
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/examples/porting/lv_port_disp_template.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 6709,
"token_count": 2366
}
|
/**
* @file lv_port_fs_templ.c
*
*/
/*Copy this file as "lv_port_fs.c" and set this value to "1" to enable content*/
#if 0
/*********************
* INCLUDES
*********************/
#include "lv_port_fs_template.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/* Create a type to store the required data about your file.
* If you are using a File System library
* it already should have a File type.
* For example FatFS has `FIL`. In this case use `typedef FIL file_t`*/
typedef struct {
/*Add the data you need to store about a file*/
uint32_t dummy1;
uint32_t dummy2;
}file_t;
/*Similarly to `file_t` create a type for directory reading too */
typedef struct {
/*Add the data you need to store about directory reading*/
uint32_t dummy1;
uint32_t dummy2;
}dir_t;
/**********************
* STATIC PROTOTYPES
**********************/
static void fs_init(void);
static lv_fs_res_t fs_open (lv_fs_drv_t * drv, void * file_p, const char * path, lv_fs_mode_t mode);
static lv_fs_res_t fs_close (lv_fs_drv_t * drv, void * file_p);
static lv_fs_res_t fs_read (lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br);
static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf, uint32_t btw, uint32_t * bw);
static lv_fs_res_t fs_seek (lv_fs_drv_t * drv, void * file_p, uint32_t pos);
static lv_fs_res_t fs_size (lv_fs_drv_t * drv, void * file_p, uint32_t * size_p);
static lv_fs_res_t fs_tell (lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p);
static lv_fs_res_t fs_remove (lv_fs_drv_t * drv, const char *path);
static lv_fs_res_t fs_trunc (lv_fs_drv_t * drv, void * file_p);
static lv_fs_res_t fs_rename (lv_fs_drv_t * drv, const char * oldname, const char * newname);
static lv_fs_res_t fs_free (lv_fs_drv_t * drv, uint32_t * total_p, uint32_t * free_p);
static lv_fs_res_t fs_dir_open (lv_fs_drv_t * drv, void * rddir_p, const char *path);
static lv_fs_res_t fs_dir_read (lv_fs_drv_t * drv, void * rddir_p, char *fn);
static lv_fs_res_t fs_dir_close (lv_fs_drv_t * drv, void * rddir_p);
/**********************
* STATIC VARIABLES
**********************/
/**********************
* GLOBAL PROTOTYPES
**********************/
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
void lv_port_fs_init(void)
{
/*----------------------------------------------------
* Initialize your storage device and File System
* -------------------------------------------------*/
fs_init();
/*---------------------------------------------------
* Register the file system interface in LVGL
*--------------------------------------------------*/
/* Add a simple drive to open images */
lv_fs_drv_t fs_drv;
lv_fs_drv_init(&fs_drv);
/*Set up fields...*/
fs_drv.file_size = sizeof(file_t);
fs_drv.letter = 'P';
fs_drv.open_cb = fs_open;
fs_drv.close_cb = fs_close;
fs_drv.read_cb = fs_read;
fs_drv.write_cb = fs_write;
fs_drv.seek_cb = fs_seek;
fs_drv.tell_cb = fs_tell;
fs_drv.free_space_cb = fs_free;
fs_drv.size_cb = fs_size;
fs_drv.remove_cb = fs_remove;
fs_drv.rename_cb = fs_rename;
fs_drv.trunc_cb = fs_trunc;
fs_drv.rddir_size = sizeof(dir_t);
fs_drv.dir_close_cb = fs_dir_close;
fs_drv.dir_open_cb = fs_dir_open;
fs_drv.dir_read_cb = fs_dir_read;
lv_fs_drv_register(&fs_drv);
}
/**********************
* STATIC FUNCTIONS
**********************/
/* Initialize your Storage device and File system. */
static void fs_init(void)
{
/*E.g. for FatFS initalize the SD card and FatFS itself*/
/*You code here*/
}
/**
* Open a file
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_t variable
* @param path path to the file beginning with the driver letter (e.g. S:/folder/file.txt)
* @param mode read: FS_MODE_RD, write: FS_MODE_WR, both: FS_MODE_RD | FS_MODE_WR
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_open (lv_fs_drv_t * drv, void * file_p, const char * path, lv_fs_mode_t mode)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
if(mode == LV_FS_MODE_WR)
{
/*Open a file for write*/
/* Add your code here*/
}
else if(mode == LV_FS_MODE_RD)
{
/*Open a file for read*/
/* Add your code here*/
}
else if(mode == (LV_FS_MODE_WR | LV_FS_MODE_RD))
{
/*Open a file for read and write*/
/* Add your code here*/
}
return res;
}
/**
* Close an opened file
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_t variable. (opened with lv_ufs_open)
* @return LV_FS_RES_OK: no error, the file is read
* any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_close (lv_fs_drv_t * drv, void * file_p)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
return res;
}
/**
* Read data from an opened file
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_t variable.
* @param buf pointer to a memory block where to store the read data
* @param btr number of Bytes To Read
* @param br the real number of read bytes (Byte Read)
* @return LV_FS_RES_OK: no error, the file is read
* any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_read (lv_fs_drv_t * drv, void * file_p, void * buf, uint32_t btr, uint32_t * br)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
return res;
}
/**
* Write into a file
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_t variable
* @param buf pointer to a buffer with the bytes to write
* @param btr Bytes To Write
* @param br the number of real written bytes (Bytes Written). NULL if unused.
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_write(lv_fs_drv_t * drv, void * file_p, const void * buf, uint32_t btw, uint32_t * bw)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
return res;
}
/**
* Set the read write pointer. Also expand the file size if necessary.
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_t variable. (opened with lv_ufs_open )
* @param pos the new position of read write pointer
* @return LV_FS_RES_OK: no error, the file is read
* any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_seek (lv_fs_drv_t * drv, void * file_p, uint32_t pos)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
return res;
}
/**
* Give the size of a file bytes
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_t variable
* @param size pointer to a variable to store the size
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_size (lv_fs_drv_t * drv, void * file_p, uint32_t * size_p)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
return res;
}
/**
* Give the position of the read write pointer
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to a file_t variable.
* @param pos_p pointer to to store the result
* @return LV_FS_RES_OK: no error, the file is read
* any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_tell (lv_fs_drv_t * drv, void * file_p, uint32_t * pos_p)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
return res;
}
/**
* Delete a file
* @param drv pointer to a driver where this function belongs
* @param path path of the file to delete
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_remove (lv_fs_drv_t * drv, const char *path)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
return res;
}
/**
* Truncate the file size to the current position of the read write pointer
* @param drv pointer to a driver where this function belongs
* @param file_p pointer to an 'ufs_file_t' variable. (opened with lv_fs_open )
* @return LV_FS_RES_OK: no error, the file is read
* any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_trunc (lv_fs_drv_t * drv, void * file_p)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
return res;
}
/**
* Rename a file
* @param drv pointer to a driver where this function belongs
* @param oldname path to the file
* @param newname path with the new name
* @return LV_FS_RES_OK or any error from 'fs_res_t'
*/
static lv_fs_res_t fs_rename (lv_fs_drv_t * drv, const char * oldname, const char * newname)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
return res;
}
/**
* Get the free and total size of a driver in kB
* @param drv pointer to a driver where this function belongs
* @param letter the driver letter
* @param total_p pointer to store the total size [kB]
* @param free_p pointer to store the free size [kB]
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_free (lv_fs_drv_t * drv, uint32_t * total_p, uint32_t * free_p)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
return res;
}
/**
* Initialize a 'fs_read_dir_t' variable for directory reading
* @param drv pointer to a driver where this function belongs
* @param rddir_p pointer to a 'fs_read_dir_t' variable
* @param path path to a directory
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_dir_open (lv_fs_drv_t * drv, void * rddir_p, const char *path)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
return res;
}
/**
* Read the next filename form a directory.
* The name of the directories will begin with '/'
* @param drv pointer to a driver where this function belongs
* @param rddir_p pointer to an initialized 'fs_read_dir_t' variable
* @param fn pointer to a buffer to store the filename
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_dir_read (lv_fs_drv_t * drv, void * rddir_p, char *fn)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
return res;
}
/**
* Close the directory reading
* @param drv pointer to a driver where this function belongs
* @param rddir_p pointer to an initialized 'fs_read_dir_t' variable
* @return LV_FS_RES_OK or any error from lv_fs_res_t enum
*/
static lv_fs_res_t fs_dir_close (lv_fs_drv_t * drv, void * rddir_p)
{
lv_fs_res_t res = LV_FS_RES_NOT_IMP;
/* Add your code here*/
return res;
}
#else /* Enable this file at the top */
/* This dummy typedef exists purely to silence -Wpedantic. */
typedef int keep_pedantic_happy;
#endif
|
train_000.parquet/931
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/examples/porting/lv_port_fs_template.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 10944,
"token_count": 4216
}
|
# LVGL Arduino examples
LVGL can be installed via Arduino IDE Library Manager or as an .ZIP library.
It will install [lv_exmaples](https://github.com/lvgl/lv_examples) which contains a lot of examples and demos to try LVGL.
## Example
There are simple examples which use the [TFT_eSPI](https://github.com/Bodmer/TFT_eSPI) library as a TFT driver to simplify testing.
To get all this to work you have to setup TFT_eSPI to work with your TFT display type via editing the `User_Setup.h` file in TFT_eSPI library folder, or by selecting your own configurtion in the `User_Setup_Select.h` file in TFT_eSPI library folder.
LVGL library has its own configuration file called `lv_conf.h`. When LVGL is installed to followings needs to be done to configure it:
1. Go to directory of the installed Arduno libraries
2. Go to `lvgl` and copy `lv_conf_template.h` as `lv_conf.h` next to the `src` folder.
3. Open `lv_conf.h` and change the first `#if 0` to `#if 1`
4. Set the resolution of your display in `LV_HOR_RES_MAX` and `LV_VER_RES_MAX`
5. Set the color depth of you display in `LV_COLOR_DEPTH`
6. Set `LV_TICK_CUSTOM 1`
## Debugging
In case of trouble there are debug informations inside LVGL. In the `ESP32_TFT_eSPI` example there is `my_print` method, which allow to send this debug informations to the serial interface. To enable this feature you have to edit `lv_conf.h` file and enable logging in section `log settings`:
```c
/*Log settings*/
#define USE_LV_LOG 1 /*Enable/disable the log module*/
#if LV_USE_LOG
/* How important log should be added:
* LV_LOG_LEVEL_TRACE A lot of logs to give detailed information
* LV_LOG_LEVEL_INFO Log important events
* LV_LOG_LEVEL_WARN Log if something unwanted happened but didn't cause a problem
* LV_LOG_LEVEL_ERROR Only critical issue, when the system may fail
* LV_LOG_LEVEL_NONE Do not log anything
*/
# define LV_LOG_LEVEL LV_LOG_LEVEL_WARN
```
After enabling log module and setting LV_LOG_LEVEL accordingly the output log is sent to the `Serial` port @ 115200 Bd.
|
train_000.parquet/932
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/examples/arduino/README.md",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 2071,
"token_count": 694
}
|
#include <lvgl.h>
#include <TFT_eSPI.h>
TFT_eSPI tft = TFT_eSPI(); /* TFT instance */
static lv_disp_buf_t disp_buf;
static lv_color_t buf[LV_HOR_RES_MAX * 10];
#if USE_LV_LOG != 0
/* Serial debugging */
void my_print(lv_log_level_t level, const char * file, uint32_t line, const char * dsc)
{
Serial.printf("%s@%d->%s\r\n", file, line, dsc);
Serial.flush();
}
#endif
/* Display flushing */
void my_disp_flush(lv_disp_drv_t *disp, const lv_area_t *area, lv_color_t *color_p)
{
uint32_t w = (area->x2 - area->x1 + 1);
uint32_t h = (area->y2 - area->y1 + 1);
tft.startWrite();
tft.setAddrWindow(area->x1, area->y1, w, h);
tft.pushColors(&color_p->full, w * h, true);
tft.endWrite();
lv_disp_flush_ready(disp);
}
/*Read the touchpad*/
bool my_touchpad_read(lv_indev_drv_t * indev_driver, lv_indev_data_t * data)
{
uint16_t touchX, touchY;
bool touched = tft.getTouch(&touchX, &touchY, 600);
if(!touched)
{
data->state = LV_INDEV_STATE_REL;
return false;
}
else
{
data->state = LV_INDEV_STATE_PR;
}
if(touchX>screenWidth || touchY > screenHeight)
{
Serial.println("Y or y outside of expected parameters..");
Serial.print("y:");
Serial.print(touchX);
Serial.print(" x:");
Serial.print(touchY);
}
else
{
/*Set the coordinates*/
data->point.x = touchX;
data->point.y = touchY;
Serial.print("Data x");
Serial.println(touchX);
Serial.print("Data y");
Serial.println(touchY);
}
return false; /*Return `false` because we are not buffering and no more data to read*/
}
void setup()
{
Serial.begin(115200); /* prepare for possible serial debug */
lv_init();
#if USE_LV_LOG != 0
lv_log_register_print_cb(my_print); /* register print function for debugging */
#endif
tft.begin(); /* TFT init */
tft.setRotation(1); /* Landscape orientation */
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
tft.setTouch(calData);
lv_disp_buf_init(&disp_buf, buf, NULL, LV_HOR_RES_MAX * 10);
/*Initialize the display*/
lv_disp_drv_t disp_drv;
lv_disp_drv_init(&disp_drv);
disp_drv.hor_res = 320;
disp_drv.ver_res = 240;
disp_drv.flush_cb = my_disp_flush;
disp_drv.buffer = &disp_buf;
lv_disp_drv_register(&disp_drv);
/*Initialize the (dummy) input device driver*/
lv_indev_drv_t indev_drv;
lv_indev_drv_init(&indev_drv);
indev_drv.type = LV_INDEV_TYPE_POINTER;
indev_drv.read_cb = my_touchpad_read;
lv_indev_drv_register(&indev_drv);
/* Try an example from the lv_examples repository
* https://github.com/lvgl/lv_examples*/
lv_ex_btn_1();
}
void loop()
{
lv_task_handler(); /* let the GUI do its work */
delay(5);
}
|
train_000.parquet/933
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/examples/arduino/ESP32_TFT_eSPI/ESP32_TFT_eSPI.ino",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 2812,
"token_count": 1224
}
|
# Example for lv_arduino using a slider
This example has the screen set to 320x480 (ILI9488), change this by altering the following lines in the main ino file:
```C
int screenWidth = 480;
int screenHeight = 320;
```
## Backlight
Change pin 32 to your preferred backlight pin using a PNP transistor (2N3906) or remove the following code and connect directly to +ve:
```C
ledcSetup(10, 5000/*freq*/, 10 /*resolution*/);
ledcAttachPin(32, 10);
analogReadResolution(10);
ledcWrite(10,768);
```
## Theme selection
Change the following to change the theme:
```C
lv_theme_t * th = lv_theme_night_init(210, NULL); //Set a HUE value and a Font for the Night Theme
lv_theme_set_current(th);
```
## Calibration
This is using the bodmer tft_espi driver for touch. To correctly set the calibration load the calibration sketch and replace the following with your values:
```C
uint16_t calData[5] = { 275, 3620, 264, 3532, 1 };
```
## Screen rotation
Check the following if you need to alter your screen rotation:
```C
tft.setRotation(3);
```
|
train_000.parquet/934
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/examples/arduino/ESP32_TFT_eSPI/README.md",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 1060,
"token_count": 410
}
|
/**
* @file lv_slider.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_slider.h"
#if LV_USE_SLIDER != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_group.h"
#include "../lv_core/lv_indev.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_math.h"
#include "lv_img.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_slider"
#define LV_SLIDER_KNOB_COORD(hor, is_rtl, area) (hor ? (is_rtl ? area.x1 : area.x2) : (is_rtl ? area.y1 : area.y2))
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_design_res_t lv_slider_design(lv_obj_t * slider, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * param);
static lv_style_list_t * lv_slider_get_style(lv_obj_t * slider, uint8_t part);
static void lv_slider_position_knob(lv_obj_t * slider, lv_area_t * knob_area, lv_coord_t knob_size, bool hor);
static void lv_slider_draw_knob(lv_obj_t * slider, const lv_area_t * knob_area, const lv_area_t * clip_area);
/**********************
* STATIC VARIABLES
**********************/
static lv_design_cb_t ancestor_design_f;
static lv_signal_cb_t ancestor_signal;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a slider objects
* @param par pointer to an object, it will be the parent of the new slider
* @param copy pointer to a slider object, if not NULL then the new object will be copied from it
* @return pointer to the created slider
*/
lv_obj_t * lv_slider_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("slider create started");
/*Create the ancestor slider*/
lv_obj_t * slider = lv_bar_create(par, copy);
LV_ASSERT_MEM(slider);
if(slider == NULL) return NULL;
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_cb(slider);
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(slider);
/*Allocate the slider type specific extended data*/
lv_slider_ext_t * ext = lv_obj_allocate_ext_attr(slider, sizeof(lv_slider_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(slider);
return NULL;
}
/*Initialize the allocated 'ext' */
ext->value_to_set = NULL;
ext->dragging = 0;
lv_style_list_init(&ext->style_knob);
/*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(slider, lv_slider_signal);
lv_obj_set_design_cb(slider, lv_slider_design);
/*Init the new slider slider*/
if(copy == NULL) {
lv_obj_set_click(slider, true);
lv_obj_add_protect(slider, LV_PROTECT_PRESS_LOST);
lv_obj_set_ext_click_area(slider, 0, 0, LV_DPI / 10, LV_DPI / 10);
lv_theme_apply(slider, LV_THEME_SLIDER);
lv_obj_set_height(slider, LV_DPI / 15);
}
/*Copy an existing slider*/
else {
lv_slider_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
lv_style_list_copy(&ext->style_knob, ©_ext->style_knob);
lv_area_copy(&ext->left_knob_area, ©_ext->left_knob_area);
lv_area_copy(&ext->right_knob_area, ©_ext->right_knob_area);
lv_obj_refresh_style(slider, LV_OBJ_PART_ALL);
}
LV_LOG_INFO("slider created");
return slider;
}
/*=====================
* Setter functions
*====================*/
/*=====================
* Getter functions
*====================*/
/**
* Get the value of a slider
* @param slider pointer to a slider object
* @return the value of the slider
*/
int16_t lv_slider_get_value(const lv_obj_t * slider)
{
LV_ASSERT_OBJ(slider, LV_OBJX_NAME);
return lv_bar_get_value(slider);
}
/**
* Give the slider is being dragged or not
* @param slider pointer to a slider object
* @return true: drag in progress false: not dragged
*/
bool lv_slider_is_dragged(const lv_obj_t * slider)
{
LV_ASSERT_OBJ(slider, LV_OBJX_NAME);
lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider);
return ext->dragging ? true : false;
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the sliders
* @param slider pointer to an object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_slider_design(lv_obj_t * slider, const lv_area_t * clip_area, lv_design_mode_t mode)
{
/*Return false if the object is not covers the mask_p area*/
if(mode == LV_DESIGN_COVER_CHK) {
return LV_DESIGN_RES_NOT_COVER;
}
/*Draw the object*/
else if(mode == LV_DESIGN_DRAW_MAIN) {
/*The ancestor design function will draw the background and the indicator.
* It also sets ext->bar.indic_area*/
ancestor_design_f(slider, clip_area, mode);
lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider);
lv_bidi_dir_t base_dir = lv_obj_get_base_dir(slider);
lv_coord_t objw = lv_obj_get_width(slider);
lv_coord_t objh = lv_obj_get_height(slider);
bool hor = objw >= objh ? true : false;
lv_coord_t knob_size = hor ? objh : objw;
bool sym = false;
if(ext->bar.type == LV_BAR_TYPE_SYMMETRICAL && ext->bar.min_value < 0 && ext->bar.max_value > 0) sym = true;
lv_area_t knob_area;
/*Horizontal*/
if(hor) {
if(!sym) {
knob_area.x1 = LV_SLIDER_KNOB_COORD(hor, base_dir == LV_BIDI_DIR_RTL, ext->bar.indic_area);
}
else {
if(ext->bar.cur_value >= 0) {
knob_area.x1 = LV_SLIDER_KNOB_COORD(hor, base_dir == LV_BIDI_DIR_RTL, ext->bar.indic_area);
}
else {
knob_area.x1 = LV_SLIDER_KNOB_COORD(hor, base_dir != LV_BIDI_DIR_RTL, ext->bar.indic_area);
}
}
}
/*Vertical*/
else {
if(!sym) {
knob_area.y1 = ext->bar.indic_area.y1;
}
else {
if(ext->bar.cur_value >= 0) {
knob_area.y1 = ext->bar.indic_area.y1;
}
else {
knob_area.y1 = ext->bar.indic_area.y2;
}
}
}
lv_slider_position_knob(slider, &knob_area, knob_size, hor);
lv_area_copy(&ext->right_knob_area, &knob_area);
lv_slider_draw_knob(slider, &knob_area, clip_area);
if(lv_slider_get_type(slider) == LV_SLIDER_TYPE_RANGE) {
/* Draw a second knob for the start_value side */
if(hor) {
knob_area.x1 = LV_SLIDER_KNOB_COORD(hor, base_dir != LV_BIDI_DIR_RTL, ext->bar.indic_area);
}
else {
knob_area.y1 = ext->bar.indic_area.y2;
}
lv_slider_position_knob(slider, &knob_area, knob_size, hor);
lv_area_copy(&ext->left_knob_area, &knob_area);
lv_slider_draw_knob(slider, &knob_area, clip_area);
}
}
/*Post draw when the children are drawn*/
else if(mode == LV_DESIGN_DRAW_POST) {
return ancestor_design_f(slider, clip_area, mode);
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the slider
* @param slider pointer to a slider object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_slider_signal(lv_obj_t * slider, lv_signal_t sign, void * param)
{
lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_slider_get_style(slider, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(slider, sign, param);
}
/* Include the ancient signal function */
res = ancestor_signal(slider, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
lv_slider_type_t type = lv_slider_get_type(slider);
lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider);
/* Advanced hit testing: react only on dragging the knob(s) */
if(sign == LV_SIGNAL_HIT_TEST) {
lv_hit_test_info_t * info = param;
/* Ordinary slider: was the knob area hit? */
info->result = _lv_area_is_point_on(&ext->right_knob_area, info->point, 0);
/* There's still a change we have a hit, if we have another knob */
if((info->result == false) && (type == LV_SLIDER_TYPE_RANGE)) {
info->result = _lv_area_is_point_on(&ext->left_knob_area, info->point, 0);
}
}
lv_point_t p;
if(sign == LV_SIGNAL_PRESSED) {
ext->dragging = true;
if(type == LV_SLIDER_TYPE_NORMAL || type == LV_SLIDER_TYPE_SYMMETRICAL) {
ext->value_to_set = &ext->bar.cur_value;
}
else if(type == LV_SLIDER_TYPE_RANGE) {
lv_indev_get_point(param, &p);
bool hor = lv_obj_get_width(slider) >= lv_obj_get_height(slider);
lv_bidi_dir_t base_dir = lv_obj_get_base_dir(slider);
lv_coord_t dist_left, dist_right;
if(hor) {
if((base_dir != LV_BIDI_DIR_RTL && p.x > ext->right_knob_area.x2) || (base_dir == LV_BIDI_DIR_RTL &&
p.x < ext->right_knob_area.x1)) {
ext->value_to_set = &ext->bar.cur_value;
}
else if((base_dir != LV_BIDI_DIR_RTL && p.x < ext->left_knob_area.x1) || (base_dir == LV_BIDI_DIR_RTL &&
p.x > ext->left_knob_area.x2)) {
ext->value_to_set = &ext->bar.start_value;
}
else {
/* Calculate the distance from each knob */
dist_left = LV_MATH_ABS((ext->left_knob_area.x1 + (ext->left_knob_area.x2 - ext->left_knob_area.x1) / 2) - p.x);
dist_right = LV_MATH_ABS((ext->right_knob_area.x1 + (ext->right_knob_area.x2 - ext->right_knob_area.x1) / 2) - p.x);
/* Use whichever one is closer */
if(dist_right < dist_left)ext->value_to_set = &ext->bar.cur_value;
else ext->value_to_set = &ext->bar.start_value;
}
}
else {
if(p.y < ext->right_knob_area.y1) {
ext->value_to_set = &ext->bar.cur_value;
}
else if(p.y > ext->left_knob_area.y2) {
ext->value_to_set = &ext->bar.start_value;
}
else {
/* Calculate the distance from each knob */
dist_left = LV_MATH_ABS((ext->left_knob_area.y1 + (ext->left_knob_area.y2 - ext->left_knob_area.y1) / 2) - p.y);
dist_right = LV_MATH_ABS((ext->right_knob_area.y1 + (ext->right_knob_area.y2 - ext->right_knob_area.y1) / 2) - p.y);
/* Use whichever one is closer */
if(dist_right < dist_left)ext->value_to_set = &ext->bar.cur_value;
else ext->value_to_set = &ext->bar.start_value;
}
}
}
}
else if(sign == LV_SIGNAL_PRESSING && ext->value_to_set != NULL) {
lv_indev_get_point(param, &p);
lv_bidi_dir_t base_dir = lv_obj_get_base_dir(slider);
lv_coord_t w = lv_obj_get_width(slider);
lv_coord_t h = lv_obj_get_height(slider);
lv_style_int_t bg_left = lv_obj_get_style_pad_left(slider, LV_SLIDER_PART_BG);
lv_style_int_t bg_right = lv_obj_get_style_pad_right(slider, LV_SLIDER_PART_BG);
lv_style_int_t bg_top = lv_obj_get_style_pad_top(slider, LV_SLIDER_PART_BG);
lv_style_int_t bg_bottom = lv_obj_get_style_pad_bottom(slider, LV_SLIDER_PART_BG);
int32_t range = ext->bar.max_value - ext->bar.min_value;
int16_t new_value = 0;
int16_t real_max_value = ext->bar.max_value;
int16_t real_min_value = ext->bar.min_value;
if(w >= h) {
lv_coord_t indic_w = w - bg_left - bg_right;
if(base_dir == LV_BIDI_DIR_RTL) {
new_value = (slider->coords.x2 - bg_right) - p.x; /*Make the point relative to the indicator*/
}
else {
new_value = p.x - (slider->coords.x1 + bg_left); /*Make the point relative to the indicator*/
}
new_value = (new_value * range) / indic_w;
new_value += ext->bar.min_value;
}
else {
lv_coord_t indic_h = h - bg_bottom - bg_top;
new_value = p.y - (slider->coords.y2 + bg_bottom); /*Make the point relative to the indicator*/
new_value = (-new_value * range) / indic_h;
new_value += ext->bar.min_value;
}
/* Figure out the min. and max. for this mode */
if(ext->value_to_set == &ext->bar.start_value) {
real_max_value = ext->bar.cur_value;
}
else {
real_min_value = ext->bar.start_value;
}
if(new_value < real_min_value) new_value = real_min_value;
else if(new_value > real_max_value) new_value = real_max_value;
if(*ext->value_to_set != new_value) {
*ext->value_to_set = new_value;
lv_obj_invalidate(slider);
res = lv_event_send(slider, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RES_OK) return res;
}
}
else if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST) {
ext->dragging = false;
ext->value_to_set = NULL;
#if LV_USE_GROUP
/*Leave edit mode if released. (No need to wait for LONG_PRESS) */
lv_group_t * g = lv_obj_get_group(slider);
bool editing = lv_group_get_editing(g);
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
if(indev_type == LV_INDEV_TYPE_ENCODER) {
if(editing) lv_group_set_editing(g, false);
}
#endif
}
else if(sign == LV_SIGNAL_COORD_CHG) {
/* The knob size depends on slider size.
* During the drawing method the ext. size is used by the knob so refresh the ext. size.*/
if(lv_obj_get_width(slider) != lv_area_get_width(param) ||
lv_obj_get_height(slider) != lv_area_get_height(param)) {
slider->signal_cb(slider, LV_SIGNAL_REFR_EXT_DRAW_PAD, NULL);
}
}
else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
lv_style_int_t knob_left = lv_obj_get_style_pad_left(slider, LV_SLIDER_PART_KNOB);
lv_style_int_t knob_right = lv_obj_get_style_pad_right(slider, LV_SLIDER_PART_KNOB);
lv_style_int_t knob_top = lv_obj_get_style_pad_top(slider, LV_SLIDER_PART_KNOB);
lv_style_int_t knob_bottom = lv_obj_get_style_pad_bottom(slider, LV_SLIDER_PART_KNOB);
/* The smaller size is the knob diameter*/
lv_coord_t knob_size = LV_MATH_MIN(lv_obj_get_width(slider), lv_obj_get_height(slider)) >> 1;
knob_size += LV_MATH_MAX(LV_MATH_MAX(knob_left, knob_right), LV_MATH_MAX(knob_bottom, knob_top));
knob_size += 2; /*For rounding error*/
knob_size += lv_obj_get_draw_rect_ext_pad_size(slider, LV_SLIDER_PART_KNOB);
/*Indic. size is handled by bar*/
slider->ext_draw_pad = LV_MATH_MAX(slider->ext_draw_pad, knob_size);
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
char c = *((char *)param);
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
lv_slider_set_value(slider, lv_slider_get_value(slider) + 1, LV_ANIM_ON);
res = lv_event_send(slider, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RES_OK) return res;
}
else if(c == LV_KEY_LEFT || c == LV_KEY_DOWN) {
lv_slider_set_value(slider, lv_slider_get_value(slider) - 1, LV_ANIM_ON);
res = lv_event_send(slider, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RES_OK) return res;
}
#endif
}
else if(sign == LV_SIGNAL_CLEANUP) {
lv_obj_clean_style_list(slider, LV_SLIDER_PART_KNOB);
}
else if(sign == LV_SIGNAL_GET_EDITABLE) {
#if LV_USE_GROUP
bool * editable = (bool *)param;
*editable = true;
#endif
}
return res;
}
static lv_style_list_t * lv_slider_get_style(lv_obj_t * slider, uint8_t part)
{
LV_ASSERT_OBJ(slider, LV_OBJX_NAME);
lv_slider_ext_t * ext = lv_obj_get_ext_attr(slider);
lv_style_list_t * style_dsc_p;
switch(part) {
case LV_SLIDER_PART_BG:
style_dsc_p = &slider->style_list;
break;
case LV_SLIDER_PART_INDIC:
style_dsc_p = &ext->bar.style_indic;
break;
case LV_SLIDER_PART_KNOB:
style_dsc_p = &ext->style_knob;
break;
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
static void lv_slider_position_knob(lv_obj_t * slider, lv_area_t * knob_area, lv_coord_t knob_size, bool hor)
{
if(hor) {
knob_area->x1 -= (knob_size >> 1);
knob_area->x2 = knob_area->x1 + knob_size - 1;
knob_area->y1 = slider->coords.y1;
knob_area->y2 = slider->coords.y2;
}
else {
knob_area->y1 -= (knob_size >> 1);
knob_area->y2 = knob_area->y1 + knob_size - 1;
knob_area->x1 = slider->coords.x1;
knob_area->x2 = slider->coords.x2;
}
lv_style_int_t knob_left = lv_obj_get_style_pad_left(slider, LV_SLIDER_PART_KNOB);
lv_style_int_t knob_right = lv_obj_get_style_pad_right(slider, LV_SLIDER_PART_KNOB);
lv_style_int_t knob_top = lv_obj_get_style_pad_top(slider, LV_SLIDER_PART_KNOB);
lv_style_int_t knob_bottom = lv_obj_get_style_pad_bottom(slider, LV_SLIDER_PART_KNOB);
/*Apply the paddings on the knob area*/
knob_area->x1 -= knob_left;
knob_area->x2 += knob_right;
knob_area->y1 -= knob_top;
knob_area->y2 += knob_bottom;
}
static void lv_slider_draw_knob(lv_obj_t * slider, const lv_area_t * knob_area, const lv_area_t * clip_area)
{
lv_draw_rect_dsc_t knob_rect_dsc;
lv_draw_rect_dsc_init(&knob_rect_dsc);
lv_obj_init_draw_rect_dsc(slider, LV_SLIDER_PART_KNOB, &knob_rect_dsc);
lv_draw_rect(knob_area, clip_area, &knob_rect_dsc);
}
#endif
|
train_000.parquet/935
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_slider.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 19085,
"token_count": 7387
}
|
/**
* @file lv_img.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_img.h"
#if LV_USE_IMG != 0
/*Testing of dependencies*/
#if LV_USE_LABEL == 0
#error "lv_img: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
#endif
#include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_draw/lv_img_decoder.h"
#include "../lv_misc/lv_fs.h"
#include "../lv_misc/lv_txt.h"
#include "../lv_misc/lv_math.h"
#include "../lv_misc/lv_log.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_img"
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param);
static lv_style_list_t * lv_img_get_style(lv_obj_t * img, uint8_t type);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create an image objects
* @param par pointer to an object, it will be the parent of the new button
* @param copy pointer to a image object, if not NULL then the new object will be copied from it
* @return pointer to the created image
*/
lv_obj_t * lv_img_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("image create started");
/*Create a basic object*/
lv_obj_t * img = lv_obj_create(par, copy);
LV_ASSERT_MEM(img);
if(img == NULL) return NULL;
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(img);
/*Extend the basic object to image object*/
lv_img_ext_t * ext = lv_obj_allocate_ext_attr(img, sizeof(lv_img_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(img);
return NULL;
}
ext->src = NULL;
ext->src_type = LV_IMG_SRC_UNKNOWN;
ext->cf = LV_IMG_CF_UNKNOWN;
ext->w = lv_obj_get_width(img);
ext->h = lv_obj_get_height(img);
ext->angle = 0;
ext->zoom = LV_IMG_ZOOM_NONE;
ext->antialias = LV_ANTIALIAS ? 1 : 0;
ext->auto_size = 1;
ext->offset.x = 0;
ext->offset.y = 0;
ext->pivot.x = 0;
ext->pivot.y = 0;
/*Init the new object*/
lv_obj_set_signal_cb(img, lv_img_signal);
lv_obj_set_design_cb(img, lv_img_design);
if(copy == NULL) {
lv_theme_apply(img, LV_THEME_IMAGE);
lv_obj_set_click(img, false);
lv_obj_set_adv_hittest(img, true); /*Images have fast hit-testing*/
/* Enable auto size for non screens
* because image screens are wallpapers
* and must be screen sized*/
if(par != NULL) {
ext->auto_size = 1;
}
else {
ext->auto_size = 0;
}
}
else {
lv_img_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->auto_size = copy_ext->auto_size;
ext->zoom = copy_ext->zoom;
ext->angle = copy_ext->angle;
ext->antialias = copy_ext->antialias;
ext->offset.x = copy_ext->offset.x;
ext->offset.y = copy_ext->offset.y;
ext->pivot.x = copy_ext->pivot.x;
ext->pivot.y = copy_ext->pivot.y;
lv_img_set_src(img, copy_ext->src);
/*Refresh the style with new signal function*/
lv_obj_refresh_style(img, LV_STYLE_PROP_ALL);
}
LV_LOG_INFO("image created");
return img;
}
/*=====================
* Setter functions
*====================*/
/**
* Set the pixel map to display by the image
* @param img pointer to an image object
* @param data the image data
*/
void lv_img_set_src(lv_obj_t * img, const void * src_img)
{
LV_ASSERT_OBJ(img, LV_OBJX_NAME);
lv_img_src_t src_type = lv_img_src_get_type(src_img);
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
#if LV_USE_LOG && LV_LOG_LEVEL >= LV_LOG_LEVEL_INFO
switch(src_type) {
case LV_IMG_SRC_FILE:
LV_LOG_TRACE("lv_img_set_src: `LV_IMG_SRC_FILE` type found");
break;
case LV_IMG_SRC_VARIABLE:
LV_LOG_TRACE("lv_img_set_src: `LV_IMG_SRC_VARIABLE` type found");
break;
case LV_IMG_SRC_SYMBOL:
LV_LOG_TRACE("lv_img_set_src: `LV_IMG_SRC_SYMBOL` type found");
break;
default:
LV_LOG_WARN("lv_img_set_src: unknown type");
}
#endif
/*If the new source type is unknown free the memories of the old source*/
if(src_type == LV_IMG_SRC_UNKNOWN) {
LV_LOG_WARN("lv_img_set_src: unknown image type");
if(ext->src_type == LV_IMG_SRC_SYMBOL || ext->src_type == LV_IMG_SRC_FILE) {
lv_mem_free(ext->src);
}
ext->src = NULL;
ext->src_type = LV_IMG_SRC_UNKNOWN;
return;
}
lv_img_header_t header;
lv_img_decoder_get_info(src_img, &header);
/*Save the source*/
if(src_type == LV_IMG_SRC_VARIABLE) {
LV_LOG_INFO("lv_img_set_src: `LV_IMG_SRC_VARIABLE` type found");
/*If memory was allocated because of the previous `src_type` then free it*/
if(ext->src_type == LV_IMG_SRC_FILE || ext->src_type == LV_IMG_SRC_SYMBOL) {
lv_mem_free(ext->src);
}
ext->src = src_img;
}
else if(src_type == LV_IMG_SRC_FILE || src_type == LV_IMG_SRC_SYMBOL) {
/* If the new and the old src are the same then it was only a refresh.*/
if(ext->src != src_img) {
const void * old_src = NULL;
/* If memory was allocated because of the previous `src_type` then save its pointer and free after allocation.
* It's important to allocate first to be sure the new data will be on a new address.
* Else `img_cache` wouldn't see the change in source.*/
if(ext->src_type == LV_IMG_SRC_FILE || ext->src_type == LV_IMG_SRC_SYMBOL) {
old_src = ext->src;
}
char * new_str = lv_mem_alloc(strlen(src_img) + 1);
LV_ASSERT_MEM(new_str);
if(new_str == NULL) return;
strcpy(new_str, src_img);
ext->src = new_str;
if(old_src) lv_mem_free(old_src);
}
}
if(src_type == LV_IMG_SRC_SYMBOL) {
/*`lv_img_dsc_get_info` couldn't set the with and height of a font so set it here*/
const lv_font_t * font = lv_obj_get_style_text_font(img, LV_IMG_PART_MAIN);
lv_style_int_t letter_space = lv_obj_get_style_text_letter_space(img, LV_IMG_PART_MAIN);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(img, LV_IMG_PART_MAIN);
lv_point_t size;
_lv_txt_get_size(&size, src_img, font, letter_space, line_space,
LV_COORD_MAX, LV_TXT_FLAG_NONE);
header.w = size.x;
header.h = size.y;
}
ext->src_type = src_type;
ext->w = header.w;
ext->h = header.h;
ext->cf = header.cf;
ext->pivot.x = header.w / 2;
ext->pivot.y = header.h / 2;
if(lv_img_get_auto_size(img) != false) {
lv_obj_set_size(img, ext->w, ext->h);
}
/*Provide enough room for the rotated corners*/
if(ext->angle || ext->zoom != LV_IMG_ZOOM_NONE) lv_obj_refresh_ext_draw_pad(img);
lv_obj_invalidate(img);
}
/**
* Enable the auto size feature.
* If enabled the object size will be same as the picture size.
* @param img pointer to an image
* @param en true: auto size enable, false: auto size disable
*/
void lv_img_set_auto_size(lv_obj_t * img, bool en)
{
LV_ASSERT_OBJ(img, LV_OBJX_NAME);
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
ext->auto_size = (en == false ? 0 : 1);
}
/**
* Set an offset for the source of an image.
* so the image will be displayed from the new origin.
* @param img pointer to an image
* @param x: the new offset along x axis.
*/
void lv_img_set_offset_x(lv_obj_t * img, lv_coord_t x)
{
LV_ASSERT_OBJ(img, LV_OBJX_NAME);
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
x = x % ext->w;
ext->offset.x = x;
lv_obj_invalidate(img);
}
/**
* Set an offset for the source of an image.
* so the image will be displayed from the new origin.
* @param img pointer to an image
* @param y: the new offset along y axis.
*/
void lv_img_set_offset_y(lv_obj_t * img, lv_coord_t y)
{
LV_ASSERT_OBJ(img, LV_OBJX_NAME);
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
y = y % ext->h;
ext->offset.y = y;
lv_obj_invalidate(img);
}
/**
* Set the rotation center of the image.
* The image will be rotated around this point
* @param img pointer to an image object
* @param pivot_x rotation center x of the image
* @param pivot_y rotation center y of the image
*/
void lv_img_set_pivot(lv_obj_t * img, lv_coord_t pivot_x, lv_coord_t pivot_y)
{
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
if(ext->pivot.x == pivot_x && ext->pivot.y == pivot_y) return;
lv_style_int_t transf_zoom = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
transf_zoom = (transf_zoom * ext->zoom) >> 8;
lv_style_int_t transf_angle = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
transf_angle += ext->angle;
lv_area_t a;
_lv_img_buf_get_transformed_area(&a, ext->w, ext->h, transf_angle, transf_zoom, &ext->pivot);
a.x1 += img->coords.x1;
a.y1 += img->coords.y1;
a.x2 += img->coords.x1;
a.y2 += img->coords.y1;
lv_obj_invalidate_area(img, &a);
ext->pivot.x = pivot_x;
ext->pivot.y = pivot_y;
lv_obj_refresh_ext_draw_pad(img);
_lv_img_buf_get_transformed_area(&a, ext->w, ext->h, transf_angle, transf_zoom, &ext->pivot);
a.x1 += img->coords.x1;
a.y1 += img->coords.y1;
a.x2 += img->coords.x1;
a.y2 += img->coords.y1;
lv_obj_invalidate_area(img, &a);
}
/**
* Set the rotation angle of the image.
* The image will be rotated around the set pivot set by `lv_img_set_pivot()`
* @param img pointer to an image object
* @param angle rotation angle in degree with 0.1 degree resolution (0..3600: clock wise)
*/
void lv_img_set_angle(lv_obj_t * img, int16_t angle)
{
if(angle < 0 || angle >= 3600) angle = angle % 3600;
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
if(angle == ext->angle) return;
lv_style_int_t transf_zoom = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
transf_zoom = (transf_zoom * ext->zoom) >> 8;
lv_style_int_t transf_angle = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
lv_area_t a;
_lv_img_buf_get_transformed_area(&a, ext->w, ext->h, transf_angle + ext->angle, transf_zoom, &ext->pivot);
a.x1 += img->coords.x1;
a.y1 += img->coords.y1;
a.x2 += img->coords.x1;
a.y2 += img->coords.y1;
lv_obj_invalidate_area(img, &a);
ext->angle = angle;
lv_obj_refresh_ext_draw_pad(img);
_lv_img_buf_get_transformed_area(&a, ext->w, ext->h, transf_angle + ext->angle, transf_zoom, &ext->pivot);
a.x1 += img->coords.x1;
a.y1 += img->coords.y1;
a.x2 += img->coords.x1;
a.y2 += img->coords.y1;
lv_obj_invalidate_area(img, &a);
}
/**
* Set the zoom factor of the image.
* @param img pointer to an image object
* @param zoom the zoom factor.
* - 256 or LV_ZOOM_IMG_NONE for no zoom
* - <256: scale down
* - >256 scale up
* - 128 half size
* - 512 double size
*/
void lv_img_set_zoom(lv_obj_t * img, uint16_t zoom)
{
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
if(zoom == ext->zoom) return;
if(zoom == 0) zoom = 1;
lv_style_int_t transf_zoom = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
lv_style_int_t transf_angle = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
transf_angle += ext->angle;
lv_area_t a;
_lv_img_buf_get_transformed_area(&a, ext->w, ext->h, transf_angle, (transf_zoom * ext->zoom) >> 8, &ext->pivot);
a.x1 += img->coords.x1;
a.y1 += img->coords.y1;
a.x2 += img->coords.x1;
a.y2 += img->coords.y1;
lv_obj_invalidate_area(img, &a);
ext->zoom = zoom;
lv_obj_refresh_ext_draw_pad(img);
_lv_img_buf_get_transformed_area(&a, ext->w, ext->h, transf_angle, (transf_zoom * ext->zoom) >> 8, &ext->pivot);
a.x1 += img->coords.x1;
a.y1 += img->coords.y1;
a.x2 += img->coords.x1;
a.y2 += img->coords.y1;
lv_obj_invalidate_area(img, &a);
}
/**
* Enable/disable anti-aliasing for the transformations (rotate, zoom) or not
* @param img pointer to an image object
* @param antialias true: anti-aliased; false: not anti-aliased
*/
void lv_img_set_antialias(lv_obj_t * img, bool antialias)
{
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
if(antialias == ext->antialias) return;
ext->antialias = antialias;
lv_obj_invalidate(img);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the source of the image
* @param img pointer to an image object
* @return the image source (symbol, file name or C array)
*/
const void * lv_img_get_src(lv_obj_t * img)
{
LV_ASSERT_OBJ(img, LV_OBJX_NAME);
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
return ext->src;
}
/**
* Get the name of the file set for an image
* @param img pointer to an image
* @return file name
*/
const char * lv_img_get_file_name(const lv_obj_t * img)
{
LV_ASSERT_OBJ(img, LV_OBJX_NAME);
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
if(ext->src_type == LV_IMG_SRC_FILE)
return ext->src;
else
return "";
}
/**
* Get the auto size enable attribute
* @param img pointer to an image
* @return true: auto size is enabled, false: auto size is disabled
*/
bool lv_img_get_auto_size(const lv_obj_t * img)
{
LV_ASSERT_OBJ(img, LV_OBJX_NAME);
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
return ext->auto_size == 0 ? false : true;
}
/**
* Get the offset.x attribute of the img object.
* @param img pointer to an image
* @return offset.x value.
*/
lv_coord_t lv_img_get_offset_x(lv_obj_t * img)
{
LV_ASSERT_OBJ(img, LV_OBJX_NAME);
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
return ext->offset.x;
}
/**
* Get the offset.y attribute of the img object.
* @param img pointer to an image
* @return offset.y value.
*/
lv_coord_t lv_img_get_offset_y(lv_obj_t * img)
{
LV_ASSERT_OBJ(img, LV_OBJX_NAME);
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
return ext->offset.y;
}
/**
* Get the rotation center of the image.
* @param img pointer to an image object
* @param center rotation center of the image
*/
void lv_img_get_pivot(lv_obj_t * img, lv_point_t * pivot)
{
LV_ASSERT_OBJ(img, LV_OBJX_NAME);
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
*pivot = ext->pivot;
}
/**
* Get the rotation angle of the image.
* @param img pointer to an image object
* @return rotation angle in degree (0..359)
*/
uint16_t lv_img_get_angle(lv_obj_t * img)
{
LV_ASSERT_OBJ(img, LV_OBJX_NAME);
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
return ext->angle;
}
/**
* Get the zoom factor of the image.
* @param img pointer to an image object
* @return zoom factor (256: no zoom)
*/
uint16_t lv_img_get_zoom(lv_obj_t * img)
{
LV_ASSERT_OBJ(img, LV_OBJX_NAME);
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
return ext->zoom;
}
/**
* Get whether the transformations (rotate, zoom) are anti-aliased or not
* @param img pointer to an image object
* @return true: anti-aliased; false: not anti-aliased
*/
bool lv_img_get_antialias(lv_obj_t * img)
{
LV_ASSERT_OBJ(img, LV_OBJX_NAME);
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
return ext->antialias ? true : false;
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the images
* @param img pointer to an object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_img_design(lv_obj_t * img, const lv_area_t * clip_area, lv_design_mode_t mode)
{
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
if(mode == LV_DESIGN_COVER_CHK) {
if(lv_obj_get_style_clip_corner(img, LV_IMG_PART_MAIN)) return LV_DESIGN_RES_MASKED;
if(ext->src_type == LV_IMG_SRC_UNKNOWN || ext->src_type == LV_IMG_SRC_SYMBOL) return LV_DESIGN_RES_NOT_COVER;
/*Non true color format might have "holes"*/
if(ext->cf != LV_IMG_CF_TRUE_COLOR && ext->cf != LV_IMG_CF_RAW) return LV_DESIGN_RES_NOT_COVER;
int32_t angle_final = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
angle_final += ext->angle;
if(angle_final != 0) return LV_DESIGN_RES_NOT_COVER;
int32_t zoom_final = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
zoom_final = (zoom_final * ext->zoom) >> 8;
if(zoom_final != LV_IMG_ZOOM_NONE) {
if(_lv_area_is_in(clip_area, &img->coords, 0) == false) return LV_DESIGN_RES_NOT_COVER;
}
else {
lv_area_t a;
_lv_img_buf_get_transformed_area(&a, lv_obj_get_width(img), lv_obj_get_height(img), 0, zoom_final, &ext->pivot);
a.x1 += img->coords.x1;
a.y1 += img->coords.y1;
a.x2 += img->coords.x1;
a.y2 += img->coords.y1;
if(_lv_area_is_in(clip_area, &a, 0) == false) return LV_DESIGN_RES_NOT_COVER;
}
if(lv_obj_get_style_image_opa(img, LV_IMG_PART_MAIN) != LV_OPA_COVER) return LV_DESIGN_RES_NOT_COVER;
return LV_DESIGN_RES_COVER;
}
else if(mode == LV_DESIGN_DRAW_MAIN) {
if(ext->h == 0 || ext->w == 0) return true;
lv_area_t img_coords;
lv_obj_get_coords(img, &img_coords);
lv_draw_rect_dsc_t bg_dsc;
lv_draw_rect_dsc_init(&bg_dsc);
lv_obj_init_draw_rect_dsc(img, LV_IMG_PART_MAIN, &bg_dsc);
/*If the border is drawn later disable loading its properties*/
if(lv_obj_get_style_border_post(img, LV_OBJ_PART_MAIN)) {
bg_dsc.border_opa = LV_OPA_TRANSP;
}
int32_t zoom_final = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
zoom_final = (zoom_final * ext->zoom) >> 8;
int32_t angle_final = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
angle_final += ext->angle;
lv_area_t bg_coords;
_lv_img_buf_get_transformed_area(&bg_coords, lv_area_get_width(&img_coords), lv_area_get_height(&img_coords),
angle_final, zoom_final, &ext->pivot);
bg_coords.x1 += img_coords.x1;
bg_coords.y1 += img_coords.y1;
bg_coords.x2 += img_coords.x1;
bg_coords.y2 += img_coords.y1;
bg_coords.x1 -= lv_obj_get_style_pad_left(img, LV_IMG_PART_MAIN);
bg_coords.x2 += lv_obj_get_style_pad_right(img, LV_IMG_PART_MAIN);
bg_coords.y1 -= lv_obj_get_style_pad_top(img, LV_IMG_PART_MAIN);
bg_coords.y2 += lv_obj_get_style_pad_bottom(img, LV_IMG_PART_MAIN);
lv_draw_rect(&bg_coords, clip_area, &bg_dsc);
if(zoom_final == 0) return LV_DESIGN_RES_OK;
if(lv_obj_get_style_clip_corner(img, LV_OBJ_PART_MAIN)) {
lv_draw_mask_radius_param_t * mp = _lv_mem_buf_get(sizeof(lv_draw_mask_radius_param_t));
lv_coord_t r = lv_obj_get_style_radius(img, LV_OBJ_PART_MAIN);
lv_draw_mask_radius_init(mp, &bg_coords, r, false);
/*Add the mask and use `img+8` as custom id. Don't use `obj` directly because it might be used by the user*/
lv_draw_mask_add(mp, img + 8);
}
if(ext->src_type == LV_IMG_SRC_FILE || ext->src_type == LV_IMG_SRC_VARIABLE) {
img_coords.x1 += ext->offset.x;
img_coords.y1 += ext->offset.y;
if(img_coords.x1 > img->coords.x1) img_coords.x1 -= ext->w;
if(img_coords.y1 > img->coords.y1) img_coords.y1 -= ext->h;
LV_LOG_TRACE("lv_img_design: start to draw image");
lv_draw_img_dsc_t img_dsc;
lv_draw_img_dsc_init(&img_dsc);
lv_obj_init_draw_img_dsc(img, LV_IMG_PART_MAIN, &img_dsc);
img_dsc.zoom = zoom_final;
if(img_dsc.zoom == 0) return LV_DESIGN_RES_OK;
img_dsc.angle = angle_final;
img_dsc.pivot.x = ext->pivot.x;
img_dsc.pivot.y = ext->pivot.y;
img_dsc.antialias = ext->antialias;
lv_area_t cords_tmp;
cords_tmp.y1 = img_coords.y1;
cords_tmp.y2 = img_coords.y1 + ext->h - 1;
for(; cords_tmp.y1 <= img_coords.y2; cords_tmp.y1 += ext->h, cords_tmp.y2 += ext->h) {
cords_tmp.x1 = img_coords.x1;
cords_tmp.x2 = img_coords.x1 + ext->w - 1;
for(; cords_tmp.x1 <= img_coords.x2; cords_tmp.x1 += ext->w, cords_tmp.x2 += ext->w) {
lv_draw_img(&cords_tmp, clip_area, ext->src, &img_dsc);
}
}
}
else if(ext->src_type == LV_IMG_SRC_SYMBOL) {
LV_LOG_TRACE("lv_img_design: start to draw symbol");
lv_draw_label_dsc_t label_dsc;
lv_draw_label_dsc_init(&label_dsc);
lv_obj_init_draw_label_dsc(img, LV_IMG_PART_MAIN, &label_dsc);
label_dsc.color = lv_obj_get_style_image_recolor(img, LV_IMG_PART_MAIN);
lv_draw_label(&img_coords, clip_area, &label_dsc, ext->src, NULL);
}
else {
/*Trigger the error handler of image drawer*/
LV_LOG_WARN("lv_img_design: image source type is unknown");
lv_draw_img(&img->coords, clip_area, NULL, NULL);
}
}
else if(mode == LV_DESIGN_DRAW_POST) {
if(lv_obj_get_style_clip_corner(img, LV_OBJ_PART_MAIN)) {
lv_draw_mask_radius_param_t * param = lv_draw_mask_remove_custom(img + 8);
_lv_mem_buf_release(param);
}
/*If the border is drawn later disable loading other properties*/
if(lv_obj_get_style_border_post(img, LV_OBJ_PART_MAIN)) {
lv_draw_rect_dsc_t draw_dsc;
lv_draw_rect_dsc_init(&draw_dsc);
draw_dsc.bg_opa = LV_OPA_TRANSP;
draw_dsc.pattern_opa = LV_OPA_TRANSP;
draw_dsc.shadow_opa = LV_OPA_TRANSP;
lv_obj_init_draw_rect_dsc(img, LV_OBJ_PART_MAIN, &draw_dsc);
int32_t zoom_final = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
zoom_final = (zoom_final * ext->zoom) >> 8;
int32_t angle_final = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
angle_final += ext->angle;
lv_area_t bg_coords;
_lv_img_buf_get_transformed_area(&bg_coords, lv_area_get_width(&img->coords), lv_area_get_height(&img->coords),
angle_final, zoom_final, &ext->pivot);
bg_coords.x1 += img->coords.x1;
bg_coords.y1 += img->coords.y1;
bg_coords.x2 += img->coords.x1;
bg_coords.y2 += img->coords.y1;
bg_coords.x1 -= lv_obj_get_style_pad_left(img, LV_IMG_PART_MAIN);
bg_coords.x2 += lv_obj_get_style_pad_right(img, LV_IMG_PART_MAIN);
bg_coords.y1 -= lv_obj_get_style_pad_top(img, LV_IMG_PART_MAIN);
bg_coords.y2 += lv_obj_get_style_pad_bottom(img, LV_IMG_PART_MAIN);
lv_draw_rect(&img->coords, clip_area, &draw_dsc);
}
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the image
* @param img pointer to an image object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_img_signal(lv_obj_t * img, lv_signal_t sign, void * param)
{
lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_img_get_style(img, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(img, sign, param);
}
/* Include the ancient signal function */
res = ancestor_signal(img, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
lv_img_ext_t * ext = lv_obj_get_ext_attr(img);
if(sign == LV_SIGNAL_CLEANUP) {
if(ext->src_type == LV_IMG_SRC_FILE || ext->src_type == LV_IMG_SRC_SYMBOL) {
lv_mem_free(ext->src);
ext->src = NULL;
ext->src_type = LV_IMG_SRC_UNKNOWN;
}
}
else if(sign == LV_SIGNAL_STYLE_CHG) {
/*Refresh the file name to refresh the symbol text size*/
if(ext->src_type == LV_IMG_SRC_SYMBOL) {
lv_img_set_src(img, ext->src);
}
}
else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
lv_style_int_t transf_zoom = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
transf_zoom = (transf_zoom * ext->zoom) >> 8;
lv_style_int_t transf_angle = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
transf_angle += ext->angle;
/*If the image has angle provide enough room for the rotated corners */
if(transf_angle || transf_zoom != LV_IMG_ZOOM_NONE) {
lv_area_t a;
_lv_img_buf_get_transformed_area(&a, ext->w, ext->h, transf_angle, transf_zoom, &ext->pivot);
lv_coord_t pad_ori = img->ext_draw_pad;
img->ext_draw_pad = LV_MATH_MAX(img->ext_draw_pad, pad_ori - a.x1);
img->ext_draw_pad = LV_MATH_MAX(img->ext_draw_pad, pad_ori - a.y1);
img->ext_draw_pad = LV_MATH_MAX(img->ext_draw_pad, pad_ori + a.x2 - ext->w);
img->ext_draw_pad = LV_MATH_MAX(img->ext_draw_pad, pad_ori + a.y2 - ext->h);
}
/*Handle the padding of the background*/
lv_style_int_t left = lv_obj_get_style_pad_left(img, LV_IMG_PART_MAIN);
lv_style_int_t right = lv_obj_get_style_pad_right(img, LV_IMG_PART_MAIN);
lv_style_int_t top = lv_obj_get_style_pad_top(img, LV_IMG_PART_MAIN);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(img, LV_IMG_PART_MAIN);
img->ext_draw_pad = LV_MATH_MAX(img->ext_draw_pad, left);
img->ext_draw_pad = LV_MATH_MAX(img->ext_draw_pad, right);
img->ext_draw_pad = LV_MATH_MAX(img->ext_draw_pad, top);
img->ext_draw_pad = LV_MATH_MAX(img->ext_draw_pad, bottom);
}
else if(sign == LV_SIGNAL_HIT_TEST) {
lv_hit_test_info_t * info = param;
lv_style_int_t zoom = lv_obj_get_style_transform_zoom(img, LV_IMG_PART_MAIN);
zoom = (zoom * ext->zoom) >> 8;
lv_style_int_t angle = lv_obj_get_style_transform_angle(img, LV_IMG_PART_MAIN);
angle += ext->angle;
/* If the object is exactly image sized (not cropped, not mosaic) and transformed
* perform hit test on it's transformed area */
if(ext->w == lv_obj_get_width(img) && ext->h == lv_obj_get_height(img) &&
(zoom != LV_IMG_ZOOM_NONE || angle != 0 || ext->pivot.x != ext->w / 2 || ext->pivot.y != ext->h / 2)) {
lv_area_t coords;
_lv_img_buf_get_transformed_area(&coords, ext->w, ext->h, angle, zoom, &ext->pivot);
coords.x1 += img->coords.x1;
coords.y1 += img->coords.y1;
coords.x2 += img->coords.x1;
coords.y2 += img->coords.y1;
info->result = _lv_area_is_point_on(&coords, info->point, 0);
}
else
info->result = lv_obj_is_point_on_coords(img, info->point);
}
return res;
}
static lv_style_list_t * lv_img_get_style(lv_obj_t * img, uint8_t type)
{
lv_style_list_t * style_dsc_p;
switch(type) {
case LV_IMG_PART_MAIN:
style_dsc_p = &img->style_list;
break;
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
#endif
|
train_000.parquet/936
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_img.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 28480,
"token_count": 11704
}
|
/**
* @file lv_gauge.h
*
*/
#ifndef LV_GAUGE_H
#define LV_GAUGE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_GAUGE != 0
/*Testing of dependencies*/
#if LV_USE_LINEMETER == 0
#error "lv_gauge: lv_linemeter is required. Enable it in lv_conf.h (LV_USE_LINEMETER 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "lv_linemeter.h"
#include "lv_label.h"
#include "lv_line.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef void (*lv_gauge_format_cb_t)(lv_obj_t * gauge, char * buf, int bufsize, int32_t value);
/*Data of gauge*/
typedef struct {
lv_linemeter_ext_t lmeter; /*Ext. of ancestor*/
/*New data for this type */
int32_t * values; /*Array of the set values (for needles) */
const lv_color_t * needle_colors; /*Color of the needles (lv_color_t my_colors[needle_num])*/
const void * needle_img;
lv_point_t needle_img_pivot;
lv_style_list_t style_needle;
lv_style_list_t style_strong;
uint8_t needle_count; /*Number of needles*/
uint8_t label_count; /*Number of labels on the scale*/
lv_gauge_format_cb_t format_cb;
} lv_gauge_ext_t;
/*Styles*/
enum {
LV_GAUGE_PART_MAIN = LV_LINEMETER_PART_MAIN,
LV_GAUGE_PART_MAJOR = _LV_LINEMETER_PART_VIRTUAL_LAST,
LV_GAUGE_PART_NEEDLE,
_LV_GAUGE_PART_VIRTUAL_LAST = _LV_LINEMETER_PART_VIRTUAL_LAST,
_LV_GAUGE_PART_REAL_LAST = _LV_LINEMETER_PART_REAL_LAST,
};
typedef uint8_t lv_gauge_style_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a gauge objects
* @param par pointer to an object, it will be the parent of the new gauge
* @param copy pointer to a gauge object, if not NULL then the new object will be copied from it
* @return pointer to the created gauge
*/
lv_obj_t * lv_gauge_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
*====================*/
/**
* Set the number of needles
* @param gauge pointer to gauge object
* @param needle_cnt new count of needles
* @param colors an array of colors for needles (with 'num' elements)
*/
void lv_gauge_set_needle_count(lv_obj_t * gauge, uint8_t needle_cnt, const lv_color_t colors[]);
/**
* Set the value of a needle
* @param gauge pointer to a gauge
* @param needle_id the id of the needle
* @param value the new value
*/
void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int32_t value);
/**
* Set minimum and the maximum values of a gauge
* @param gauge pointer to he gauge object
* @param min minimum value
* @param max maximum value
*/
static inline void lv_gauge_set_range(lv_obj_t * gauge, int32_t min, int32_t max)
{
lv_linemeter_set_range(gauge, min, max);
}
/**
* Set a critical value on the scale. After this value 'line.color' scale lines will be drawn
* @param gauge pointer to a gauge object
* @param value the critical value
*/
static inline void lv_gauge_set_critical_value(lv_obj_t * gauge, int32_t value)
{
lv_linemeter_set_value(gauge, value);
}
/**
* Set the scale settings of a gauge
* @param gauge pointer to a gauge object
* @param angle angle of the scale (0..360)
* @param line_cnt count of scale lines.
* To get a given "subdivision" lines between labels:
* `line_cnt = (sub_div + 1) * (label_cnt - 1) + 1 `
* @param label_cnt count of scale labels.
*/
void lv_gauge_set_scale(lv_obj_t * gauge, uint16_t angle, uint8_t line_cnt, uint8_t label_cnt);
/**
* Set the set an offset for the gauge's angles to rotate it.
* @param gauge pointer to a line meter object
* @param angle angle offset (0..360), rotates clockwise
*/
static inline void lv_gauge_set_angle_offset(lv_obj_t * gauge, uint16_t angle)
{
lv_linemeter_set_angle_offset(gauge, angle);
}
/**
* Set an image to display as needle(s).
* The needle image should be horizontal and pointing to the right (`--->`).
* @param gauge pointer to a gauge object
* @param img_src pointer to an `lv_img_dsc_t` variable or a path to an image
* (not an `lv_img` object)
* @param pivot_x the X coordinate of rotation center of the image
* @param pivot_y the Y coordinate of rotation center of the image
*/
void lv_gauge_set_needle_img(lv_obj_t * gauge, const void * img, lv_coord_t pivot_x, lv_coord_t pivot_y);
/**
* Assign a function to format gauge values
* @param gauge pointer to a gauge object
* @param format_cb pointer to function of lv_gauge_format_cb_t
*/
void lv_gauge_set_formatter_cb(lv_obj_t * gauge, lv_gauge_format_cb_t format_cb);
/*=====================
* Getter functions
*====================*/
/**
* Get the value of a needle
* @param gauge pointer to gauge object
* @param needle the id of the needle
* @return the value of the needle [min,max]
*/
int32_t lv_gauge_get_value(const lv_obj_t * gauge, uint8_t needle);
/**
* Get the count of needles on a gauge
* @param gauge pointer to gauge
* @return count of needles
*/
uint8_t lv_gauge_get_needle_count(const lv_obj_t * gauge);
/**
* Get the minimum value of a gauge
* @param gauge pointer to a gauge object
* @return the minimum value of the gauge
*/
static inline int32_t lv_gauge_get_min_value(const lv_obj_t * lmeter)
{
return lv_linemeter_get_min_value(lmeter);
}
/**
* Get the maximum value of a gauge
* @param gauge pointer to a gauge object
* @return the maximum value of the gauge
*/
static inline int32_t lv_gauge_get_max_value(const lv_obj_t * lmeter)
{
return lv_linemeter_get_max_value(lmeter);
}
/**
* Get a critical value on the scale.
* @param gauge pointer to a gauge object
* @return the critical value
*/
static inline int32_t lv_gauge_get_critical_value(const lv_obj_t * gauge)
{
return lv_linemeter_get_value(gauge);
}
/**
* Set the number of labels (and the thicker lines too)
* @param gauge pointer to a gauge object
* @return count of labels
*/
uint8_t lv_gauge_get_label_count(const lv_obj_t * gauge);
/**
* Get the scale number of a gauge
* @param gauge pointer to a gauge object
* @return number of the scale units
*/
static inline uint16_t lv_gauge_get_line_count(const lv_obj_t * gauge)
{
return lv_linemeter_get_line_count(gauge);
}
/**
* Get the scale angle of a gauge
* @param gauge pointer to a gauge object
* @return angle of the scale
*/
static inline uint16_t lv_gauge_get_scale_angle(const lv_obj_t * gauge)
{
return lv_linemeter_get_scale_angle(gauge);
}
/**
* Get the offset for the gauge.
* @param gauge pointer to a gauge object
* @return angle offset (0..360)
*/
static inline uint16_t lv_gauge_get_angle_offset(lv_obj_t * gauge)
{
return lv_linemeter_get_angle_offset(gauge);
}
/**
* Get an image to display as needle(s).
* @param gauge pointer to a gauge object
* @return pointer to an `lv_img_dsc_t` variable or a path to an image
* (not an `lv_img` object). `NULL` if not used.
*/
const void * lv_gauge_get_needle_img(lv_obj_t * gauge);
/**
* Get the X coordinate of the rotation center of the needle image
* @param gauge pointer to a gauge object
* @return the X coordinate of rotation center of the image
*/
lv_coord_t lv_gauge_get_needle_img_pivot_x(lv_obj_t * gauge);
/**
* Get the Y coordinate of the rotation center of the needle image
* @param gauge pointer to a gauge object
* @return the X coordinate of rotation center of the image
*/
lv_coord_t lv_gauge_get_needle_img_pivot_y(lv_obj_t * gauge);
/**********************
* MACROS
**********************/
#endif /*LV_USE_GAUGE*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_GAUGE_H*/
|
train_000.parquet/937
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_gauge.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 7716,
"token_count": 2818
}
|
/**
* @file lv_arc.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_arc.h"
#if LV_USE_ARC != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_misc/lv_math.h"
#include "../lv_draw/lv_draw_arc.h"
#include "../lv_themes/lv_theme.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_arc"
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param);
static lv_style_list_t * lv_arc_get_style(lv_obj_t * arc, uint8_t part);
static void inv_arc_area(lv_obj_t * arc, uint16_t start_angle, uint16_t end_angle);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
static lv_design_cb_t ancestor_design;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a arc object
* @param par pointer to an object, it will be the parent of the new arc
* @param copy pointer to a arc object, if not NULL then the new object will be copied from it
* @return pointer to the created arc
*/
lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("arc create started");
/*Create the ancestor of arc*/
lv_obj_t * arc = lv_obj_create(par, copy);
LV_ASSERT_MEM(arc);
if(arc == NULL) return NULL;
/*Allocate the arc type specific extended data*/
lv_arc_ext_t * ext = lv_obj_allocate_ext_attr(arc, sizeof(lv_arc_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(arc);
return NULL;
}
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(arc);
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(arc);
/*Initialize the allocated 'ext' */
ext->rotation_angle = 0;
ext->bg_angle_start = 135;
ext->bg_angle_end = 45;
ext->arc_angle_start = 135;
ext->arc_angle_end = 270;
lv_style_list_init(&ext->style_arc);
lv_obj_set_size(arc, LV_DPI, LV_DPI);
/*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(arc, lv_arc_signal);
lv_obj_set_design_cb(arc, lv_arc_design);
/*Init the new arc arc*/
if(copy == NULL) {
lv_theme_apply(arc, LV_THEME_ARC);
}
/*Copy an existing arc*/
else {
lv_arc_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->arc_angle_start = copy_ext->arc_angle_start;
ext->arc_angle_end = copy_ext->arc_angle_end;
ext->bg_angle_start = copy_ext->bg_angle_start;
ext->bg_angle_end = copy_ext->bg_angle_end;
lv_style_list_copy(&ext->style_arc, ©_ext->style_arc);
/*Refresh the style with new signal function*/
lv_obj_refresh_style(arc, LV_STYLE_PROP_ALL);
}
LV_LOG_INFO("arc created");
return arc;
}
/*======================
* Add/remove functions
*=====================*/
/*
* New object specific "add" or "remove" functions come here
*/
/*=====================
* Setter functions
*====================*/
/**
* Set the start angle of an arc. 0 deg: right, 90 bottom, etc.
* @param arc pointer to an arc object
* @param start the start angle [0..360]
*/
void lv_arc_set_start_angle(lv_obj_t * arc, uint16_t start)
{
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
if(start > 360) start -= 360;
/*Too large move, the whole arc need to be invalidated anyway*/
if(LV_MATH_ABS(start - ext->arc_angle_start) >= 180) {
lv_obj_invalidate(arc);
}
/*Only a smaller incremental move*/
else if(ext->arc_angle_start > ext->arc_angle_end && start > ext->arc_angle_end) {
inv_arc_area(arc, LV_MATH_MIN(ext->arc_angle_start, start), LV_MATH_MAX(ext->arc_angle_start, start));
}
/*Only a smaller incremental move*/
else if(ext->arc_angle_start < ext->arc_angle_end && start < ext->arc_angle_end) {
inv_arc_area(arc, LV_MATH_MIN(ext->arc_angle_start, start), LV_MATH_MAX(ext->arc_angle_start, start));
}
/*Crossing the start angle makes the whole arc change*/
else {
lv_obj_invalidate(arc);
}
ext->arc_angle_start = start;
}
/**
* Set the start angle of an arc. 0 deg: right, 90 bottom, etc.
* @param arc pointer to an arc object
* @param start the start angle [0..360]
*/
void lv_arc_set_end_angle(lv_obj_t * arc, uint16_t end)
{
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
if(end > (ext->arc_angle_start + 360)) end = ext->arc_angle_start + 360;
/*Too large move, the whole arc need to be invalidated anyway*/
if(LV_MATH_ABS(end - ext->arc_angle_end) >= 180) {
lv_obj_invalidate(arc);
}
/*Only a smaller incremental move*/
else if(ext->arc_angle_end > ext->arc_angle_start && end > ext->arc_angle_start) {
inv_arc_area(arc, LV_MATH_MIN(ext->arc_angle_end, end), LV_MATH_MAX(ext->arc_angle_end, end));
}
/*Only a smaller incremental move*/
else if(ext->arc_angle_end < ext->arc_angle_start && end < ext->arc_angle_start) {
inv_arc_area(arc, LV_MATH_MIN(ext->arc_angle_end, end), LV_MATH_MAX(ext->arc_angle_end, end));
}
/*Crossing the end angle makes the whole arc change*/
else {
lv_obj_invalidate(arc);
}
ext->arc_angle_end = end;
}
/**
* Set the start and end angles
* @param arc pointer to an arc object
* @param start the start angle
* @param end the end angle
*/
void lv_arc_set_angles(lv_obj_t * arc, uint16_t start, uint16_t end)
{
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
if(start > 360) start -= 360;
if(end > (start + 360)) end = start + 360;
inv_arc_area(arc, ext->arc_angle_start, ext->arc_angle_end);
ext->arc_angle_start = start;
ext->arc_angle_end = end;
inv_arc_area(arc, ext->arc_angle_start, ext->arc_angle_end);
}
/**
* Set the start angle of an arc background. 0 deg: right, 90 bottom, etc.
* @param arc pointer to an arc object
* @param start the start angle
*/
void lv_arc_set_bg_start_angle(lv_obj_t * arc, uint16_t start)
{
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
if(start > 360) start -= 360;
/*Too large move, the whole arc need to be invalidated anyway*/
if(LV_MATH_ABS(start - ext->bg_angle_start) >= 180) {
lv_obj_invalidate(arc);
}
/*Only a smaller incremental move*/
else if(ext->bg_angle_start > ext->bg_angle_end && start > ext->bg_angle_end) {
inv_arc_area(arc, LV_MATH_MIN(ext->bg_angle_start, start), LV_MATH_MAX(ext->bg_angle_start, start));
}
/*Only a smaller incremental move*/
else if(ext->bg_angle_start < ext->bg_angle_end && start < ext->bg_angle_end) {
inv_arc_area(arc, LV_MATH_MIN(ext->bg_angle_start, start), LV_MATH_MAX(ext->bg_angle_start, start));
}
/*Crossing the start angle makes the whole arc change*/
else {
lv_obj_invalidate(arc);
}
ext->bg_angle_start = start;
}
/**
* Set the start angle of an arc background. 0 deg: right, 90 bottom etc.
* @param arc pointer to an arc object
* @param end the end angle
*/
void lv_arc_set_bg_end_angle(lv_obj_t * arc, uint16_t end)
{
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
if(end > (ext->bg_angle_start + 360)) end = ext->bg_angle_start + 360;
/*Too large move, the whole arc need to be invalidated anyway*/
if(LV_MATH_ABS(end - ext->bg_angle_end) >= 180) {
lv_obj_invalidate(arc);
}
/*Only a smaller incremental move*/
else if(ext->bg_angle_end > ext->bg_angle_start && end > ext->bg_angle_start) {
inv_arc_area(arc, LV_MATH_MIN(ext->bg_angle_end, end), LV_MATH_MAX(ext->bg_angle_end, end));
}
/*Only a smaller incremental move*/
else if(ext->bg_angle_end < ext->bg_angle_start && end < ext->bg_angle_start) {
inv_arc_area(arc, LV_MATH_MIN(ext->bg_angle_end, end), LV_MATH_MAX(ext->bg_angle_end, end));
}
/*Crossing the end angle makes the whole arc change*/
else {
lv_obj_invalidate(arc);
}
ext->bg_angle_end = end;
}
/**
* Set the start and end angles of the arc background
* @param arc pointer to an arc object
* @param start the start angle
* @param end the end angle
*/
void lv_arc_set_bg_angles(lv_obj_t * arc, uint16_t start, uint16_t end)
{
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
if(start > 360) start -= 360;
if(end > (start + 360)) end = start + 360;
inv_arc_area(arc, ext->bg_angle_start, ext->bg_angle_end);
ext->bg_angle_start = start;
ext->bg_angle_end = end;
inv_arc_area(arc, ext->bg_angle_start, ext->bg_angle_end);
}
/**
* Set the rotation for the whole arc
* @param arc pointer to an arc object
* @param rotation_angle rotation angle
*/
void lv_arc_set_rotation(lv_obj_t * arc, uint16_t rotation_angle)
{
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
ext->rotation_angle = rotation_angle;
lv_obj_invalidate(arc);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the start angle of an arc.
* @param arc pointer to an arc object
* @return the start angle [0..360]
*/
uint16_t lv_arc_get_angle_start(lv_obj_t * arc)
{
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
return ext->arc_angle_start;
}
/**
* Get the end angle of an arc.
* @param arc pointer to an arc object
* @return the end angle [0..360]
*/
uint16_t lv_arc_get_angle_end(lv_obj_t * arc)
{
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
return ext->arc_angle_end;
}
/**
* Get the start angle of an arc background.
* @param arc pointer to an arc object
* @return the start angle [0..360]
*/
uint16_t lv_arc_get_bg_angle_start(lv_obj_t * arc)
{
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
return ext->bg_angle_start;
}
/**
* Get the end angle of an arc background.
* @param arc pointer to an arc object
* @return the end angle [0..360]
*/
uint16_t lv_arc_get_bg_angle_end(lv_obj_t * arc)
{
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
return ext->bg_angle_end;
}
/*=====================
* Other functions
*====================*/
/*
* New object specific "other" functions come here
*/
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the arcs
* @param arc pointer to an object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_arc_design(lv_obj_t * arc, const lv_area_t * clip_area, lv_design_mode_t mode)
{
/*Return false if the object is not covers the mask_p area*/
if(mode == LV_DESIGN_COVER_CHK) {
return LV_DESIGN_RES_NOT_COVER;
}
/*Draw the object*/
else if(mode == LV_DESIGN_DRAW_MAIN) {
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
lv_draw_rect_dsc_t bg_dsc;
lv_draw_rect_dsc_init(&bg_dsc);
lv_obj_init_draw_rect_dsc(arc, LV_ARC_PART_BG, &bg_dsc);
lv_draw_rect(&arc->coords, clip_area, &bg_dsc);
lv_coord_t left_bg = lv_obj_get_style_pad_left(arc, LV_ARC_PART_BG);
lv_coord_t right_bg = lv_obj_get_style_pad_right(arc, LV_ARC_PART_BG);
lv_coord_t top_bg = lv_obj_get_style_pad_top(arc, LV_ARC_PART_BG);
lv_coord_t bottom_bg = lv_obj_get_style_pad_bottom(arc, LV_ARC_PART_BG);
lv_coord_t r = (LV_MATH_MIN(lv_obj_get_width(arc) - left_bg - right_bg,
lv_obj_get_height(arc) - top_bg - bottom_bg)) / 2;
lv_draw_line_dsc_t arc_dsc;
lv_coord_t x = arc->coords.x1 + r + left_bg;
lv_coord_t y = arc->coords.y1 + r + top_bg;
if(r > 0) {
lv_draw_line_dsc_init(&arc_dsc);
lv_obj_init_draw_line_dsc(arc, LV_ARC_PART_BG, &arc_dsc);
lv_draw_arc(x, y, r, ext->bg_angle_start + ext->rotation_angle, ext->bg_angle_end + ext->rotation_angle, clip_area,
&arc_dsc);
}
/*make the indicator arc smaller or larger according to its greatest padding value*/
lv_coord_t left_indic = lv_obj_get_style_pad_left(arc, LV_ARC_PART_INDIC);
lv_coord_t right_indic = lv_obj_get_style_pad_right(arc, LV_ARC_PART_INDIC);
lv_coord_t top_indic = lv_obj_get_style_pad_top(arc, LV_ARC_PART_INDIC);
lv_coord_t bottom_indic = lv_obj_get_style_pad_bottom(arc, LV_ARC_PART_INDIC);
r -= LV_MATH_MAX4(left_indic, right_indic, top_indic, bottom_indic);
if(r > 0) {
lv_draw_line_dsc_init(&arc_dsc);
lv_obj_init_draw_line_dsc(arc, LV_ARC_PART_INDIC, &arc_dsc);
lv_draw_arc(x, y, r, ext->arc_angle_start + ext->rotation_angle, ext->arc_angle_end + ext->rotation_angle, clip_area,
&arc_dsc);
}
}
/*Post draw when the children are drawn*/
else if(mode == LV_DESIGN_DRAW_POST) {
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the arc
* @param arc pointer to a arc object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_arc_signal(lv_obj_t * arc, lv_signal_t sign, void * param)
{
lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_arc_get_style(arc, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(arc, sign, param);
}
/* Include the ancient signal function */
res = ancestor_signal(arc, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
if(sign == LV_SIGNAL_CLEANUP) {
lv_obj_clean_style_list(arc, LV_ARC_PART_INDIC);
}
return res;
}
/**
* Get the style descriptor of a part of the object
* @param arc pointer the object
* @param part the part of the object. (LV_ARC_PART_...)
* @return pointer to the style descriptor of the specified part
*/
static lv_style_list_t * lv_arc_get_style(lv_obj_t * arc, uint8_t part)
{
LV_ASSERT_OBJ(arc, LV_OBJX_NAME);
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
lv_style_list_t * style_dsc_p;
switch(part) {
case LV_ARC_PART_BG:
style_dsc_p = &arc->style_list;
break;
case LV_ARC_PART_INDIC:
style_dsc_p = &ext->style_arc;
break;
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
static void inv_arc_area(lv_obj_t * arc, uint16_t start_angle, uint16_t end_angle)
{
lv_arc_ext_t * ext = lv_obj_get_ext_attr(arc);
start_angle += ext->rotation_angle;
end_angle += ext->rotation_angle;
if(start_angle >= 360) start_angle -= 360;
if(end_angle >= 360) end_angle -= 360;
uint8_t start_quarter = start_angle / 90;
uint8_t end_quarter = end_angle / 90;
lv_coord_t left = lv_obj_get_style_pad_left(arc, LV_ARC_PART_BG);
lv_coord_t right = lv_obj_get_style_pad_right(arc, LV_ARC_PART_BG);
lv_coord_t top = lv_obj_get_style_pad_top(arc, LV_ARC_PART_BG);
lv_coord_t bottom = lv_obj_get_style_pad_bottom(arc, LV_ARC_PART_BG);
lv_coord_t rout = (LV_MATH_MIN(lv_obj_get_width(arc) - left - right, lv_obj_get_height(arc) - top - bottom)) / 2;
lv_coord_t x = arc->coords.x1 + rout + left;
lv_coord_t y = arc->coords.y1 + rout + top;
lv_style_int_t w = lv_obj_get_style_line_width(arc, LV_ARC_PART_INDIC);
lv_style_int_t rounded = lv_obj_get_style_line_rounded(arc, LV_ARC_PART_INDIC);
lv_coord_t rin = rout - w;
lv_coord_t extra_area = rounded ? w / 2 + 2 : 0;
lv_area_t inv_area;
if(start_quarter == end_quarter && start_angle <= end_angle) {
if(start_quarter == 0) {
inv_area.y1 = y + ((_lv_trigo_sin(start_angle) * rin) >> LV_TRIGO_SHIFT) - extra_area;
inv_area.x2 = x + ((_lv_trigo_sin(start_angle + 90) * rout) >> LV_TRIGO_SHIFT) + extra_area;
inv_area.y2 = y + ((_lv_trigo_sin(end_angle) * rout) >> LV_TRIGO_SHIFT) + extra_area;
inv_area.x1 = x + ((_lv_trigo_sin(end_angle + 90) * rin) >> LV_TRIGO_SHIFT) - extra_area;
lv_obj_invalidate_area(arc, &inv_area);
}
else if(start_quarter == 1) {
inv_area.y2 = y + ((_lv_trigo_sin(start_angle) * rout) >> LV_TRIGO_SHIFT) + extra_area;
inv_area.x2 = x + ((_lv_trigo_sin(start_angle + 90) * rin) >> LV_TRIGO_SHIFT) + extra_area;
inv_area.y1 = y + ((_lv_trigo_sin(end_angle) * rin) >> LV_TRIGO_SHIFT) - extra_area;
inv_area.x1 = x + ((_lv_trigo_sin(end_angle + 90) * rout) >> LV_TRIGO_SHIFT) - extra_area;
lv_obj_invalidate_area(arc, &inv_area);
}
else if(start_quarter == 2) {
inv_area.x1 = x + ((_lv_trigo_sin(start_angle + 90) * rout) >> LV_TRIGO_SHIFT) - extra_area;
inv_area.y2 = y + ((_lv_trigo_sin(start_angle) * rin) >> LV_TRIGO_SHIFT) + extra_area;
inv_area.y1 = y + ((_lv_trigo_sin(end_angle) * rout) >> LV_TRIGO_SHIFT) - extra_area;
inv_area.x2 = x + ((_lv_trigo_sin(end_angle + 90) * rin) >> LV_TRIGO_SHIFT) + extra_area;
lv_obj_invalidate_area(arc, &inv_area);
}
else if(start_quarter == 3) {
/*Small arc here*/
inv_area.x1 = x + ((_lv_trigo_sin(start_angle + 90) * rin) >> LV_TRIGO_SHIFT) - extra_area;
inv_area.y1 = y + ((_lv_trigo_sin(start_angle) * rout) >> LV_TRIGO_SHIFT) - extra_area;
inv_area.x2 = x + ((_lv_trigo_sin(end_angle + 90) * rout) >> LV_TRIGO_SHIFT) + extra_area;
inv_area.y2 = y + ((_lv_trigo_sin(end_angle) * rin) >> LV_TRIGO_SHIFT) + extra_area;
lv_obj_invalidate_area(arc, &inv_area);
}
}
else if(start_quarter == 0 && end_quarter == 1) {
inv_area.x1 = x + ((_lv_trigo_sin(end_angle + 90) * rout) >> LV_TRIGO_SHIFT) - extra_area;
inv_area.y1 = y + ((LV_MATH_MIN(_lv_trigo_sin(end_angle),
_lv_trigo_sin(start_angle)) * rin) >> LV_TRIGO_SHIFT) - extra_area;
inv_area.x2 = x + ((_lv_trigo_sin(start_angle + 90) * rout) >> LV_TRIGO_SHIFT) + extra_area;
inv_area.y2 = y + rout + extra_area;
lv_obj_invalidate_area(arc, &inv_area);
}
else if(start_quarter == 1 && end_quarter == 2) {
inv_area.x1 = x - rout - extra_area;
inv_area.y1 = y + ((_lv_trigo_sin(end_angle) * rout) >> LV_TRIGO_SHIFT) - extra_area;
inv_area.x2 = x + ((LV_MATH_MAX(_lv_trigo_sin(start_angle + 90),
_lv_trigo_sin(end_angle + 90)) * rin) >> LV_TRIGO_SHIFT) + extra_area;
inv_area.y2 = y + ((_lv_trigo_sin(start_angle) * rout) >> LV_TRIGO_SHIFT) + extra_area;
lv_obj_invalidate_area(arc, &inv_area);
}
else if(start_quarter == 2 && end_quarter == 3) {
inv_area.x1 = x + ((_lv_trigo_sin(start_angle + 90) * rout) >> LV_TRIGO_SHIFT) - extra_area;
inv_area.y1 = y - rout - extra_area;
inv_area.x2 = x + ((_lv_trigo_sin(end_angle + 90) * rout) >> LV_TRIGO_SHIFT) + extra_area;
inv_area.y2 = y + (LV_MATH_MAX(_lv_trigo_sin(end_angle) * rin,
_lv_trigo_sin(start_angle) * rin) >> LV_TRIGO_SHIFT) + extra_area;
lv_obj_invalidate_area(arc, &inv_area);
}
else if(start_quarter == 3 && end_quarter == 0) {
inv_area.x1 = x + ((LV_MATH_MIN(_lv_trigo_sin(end_angle + 90),
_lv_trigo_sin(start_angle + 90)) * rin) >> LV_TRIGO_SHIFT) - extra_area;
inv_area.y1 = y + ((_lv_trigo_sin(start_angle) * rout) >> LV_TRIGO_SHIFT) - extra_area;
inv_area.x2 = x + rout + extra_area;
inv_area.y2 = y + ((_lv_trigo_sin(end_angle) * rout) >> LV_TRIGO_SHIFT) + extra_area;
lv_obj_invalidate_area(arc, &inv_area);
}
else {
lv_obj_invalidate(arc);
}
}
#endif
|
train_000.parquet/938
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_arc.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 21049,
"token_count": 8414
}
|
/**
* @file lv_cb.h
*
*/
#ifndef LV_CHECKBOX_H
#define LV_CHECKBOX_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_CHECKBOX != 0
/*Testing of dependencies*/
#if LV_USE_BTN == 0
#error "lv_cb: lv_btn is required. Enable it in lv_conf.h (LV_USE_BTN 1) "
#endif
#if LV_USE_LABEL == 0
#error "lv_cb: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "lv_btn.h"
#include "lv_label.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of check box*/
typedef struct {
lv_btn_ext_t bg_btn; /*Ext. of ancestor*/
/*New data for this type */
lv_obj_t * bullet; /*Pointer to button*/
lv_obj_t * label; /*Pointer to label*/
} lv_checkbox_ext_t;
/** Checkbox styles. */
enum {
LV_CHECKBOX_PART_BG = LV_BTN_PART_MAIN, /**< Style of object background. */
_LV_CHECKBOX_PART_VIRTUAL_LAST,
LV_CHECKBOX_PART_BULLET = _LV_BTN_PART_REAL_LAST, /**< Style of box (released). */
_LV_CHECKBOX_PART_REAL_LAST
};
typedef uint8_t lv_checkbox_style_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a check box objects
* @param par pointer to an object, it will be the parent of the new check box
* @param copy pointer to a check box object, if not NULL then the new object will be copied from it
* @return pointer to the created check box
*/
lv_obj_t * lv_checkbox_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
*====================*/
/**
* Set the text of a check box. `txt` will be copied and may be deallocated
* after this function returns.
* @param cb pointer to a check box
* @param txt the text of the check box. NULL to refresh with the current text.
*/
void lv_checkbox_set_text(lv_obj_t * cb, const char * txt);
/**
* Set the text of a check box. `txt` must not be deallocated during the life
* of this checkbox.
* @param cb pointer to a check box
* @param txt the text of the check box. NULL to refresh with the current text.
*/
void lv_checkbox_set_text_static(lv_obj_t * cb, const char * txt);
/**
* Set the state of the check box
* @param cb pointer to a check box object
* @param checked true: make the check box checked; false: make it unchecked
*/
static inline void lv_checkbox_set_checked(lv_obj_t * cb, bool checked)
{
lv_btn_set_state(cb, checked ? LV_BTN_STATE_CHECKED_RELEASED : LV_BTN_STATE_RELEASED);
}
/**
* Make the check box inactive (disabled)
* @param cb pointer to a check box object
*/
static inline void lv_checkbox_set_disabled(lv_obj_t * cb)
{
lv_btn_set_state(cb, LV_BTN_STATE_DISABLED);
}
/**
* Set the state of a check box
* @param cb pointer to a check box object
* @param state the new state of the check box (from lv_btn_state_t enum)
*/
static inline void lv_checkbox_set_state(lv_obj_t * cb, lv_btn_state_t state)
{
lv_btn_set_state(cb, state);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the text of a check box
* @param cb pointer to check box object
* @return pointer to the text of the check box
*/
const char * lv_checkbox_get_text(const lv_obj_t * cb);
/**
* Get the current state of the check box
* @param cb pointer to a check box object
* @return true: checked; false: not checked
*/
static inline bool lv_checkbox_is_checked(const lv_obj_t * cb)
{
return lv_btn_get_state(cb) == LV_BTN_STATE_RELEASED ? false : true;
}
/**
* Get whether the check box is inactive or not.
* @param cb pointer to a check box object
* @return true: inactive; false: not inactive
*/
static inline bool lv_checkbox_is_inactive(const lv_obj_t * cb)
{
return lv_btn_get_state(cb) == LV_BTN_STATE_DISABLED ? true : false;
}
/**
* Get the current state of a check box
* @param cb pointer to a check box object
* @return the state of the check box (from lv_btn_state_t enum)
*/
static inline lv_btn_state_t lv_checkbox_get_state(const lv_obj_t * cb)
{
return lv_btn_get_state(cb);
}
/**********************
* MACROS
**********************/
#endif /*LV_USE_CHECKBOX*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_CHECKBOX_H*/
|
train_000.parquet/939
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_checkbox.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 4340,
"token_count": 1657
}
|
/**
* @file lv_imgbtn.c
*
*/
/*********************
* INCLUDES
*********************/
#include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h"
#include "lv_imgbtn.h"
#include "lv_label.h"
#if LV_USE_IMGBTN != 0
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_imgbtn"
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_imgbtn_signal(lv_obj_t * imgbtn, lv_signal_t sign, void * param);
static void refr_img(lv_obj_t * imgbtn);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
static lv_design_cb_t ancestor_design;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a image button object
* @param par pointer to an object, it will be the parent of the new image button
* @param copy pointer to a image button object, if not NULL then the new object will be copied from
* it
* @return pointer to the created image button
*/
lv_obj_t * lv_imgbtn_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("image button create started");
/*Create the ancestor of image button*/
lv_obj_t * imgbtn = lv_btn_create(par, copy);
LV_ASSERT_MEM(imgbtn);
if(imgbtn == NULL) return NULL;
/*Allocate the image button type specific extended data*/
lv_imgbtn_ext_t * ext = lv_obj_allocate_ext_attr(imgbtn, sizeof(lv_imgbtn_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(imgbtn);
return NULL;
}
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(imgbtn);
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(imgbtn);
/*Initialize the allocated 'ext' */
_lv_memset_00((void *)ext->img_src_mid, sizeof(ext->img_src_mid));
#if LV_IMGBTN_TILED
_lv_memset_00(ext->img_src_left, sizeof(ext->img_src_left));
_lv_memset_00(ext->img_src_right, sizeof(ext->img_src_right));
#endif
ext->tiled = 0;
ext->act_cf = LV_IMG_CF_UNKNOWN;
/*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(imgbtn, lv_imgbtn_signal);
lv_obj_set_design_cb(imgbtn, lv_imgbtn_design);
/*Init the new image button image button*/
if(copy == NULL) {
lv_theme_apply(imgbtn, LV_THEME_IMGBTN);
}
/*Copy an existing image button*/
else {
lv_imgbtn_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
_lv_memcpy((void *)ext->img_src_mid, copy_ext->img_src_mid, sizeof(ext->img_src_mid));
#if LV_IMGBTN_TILED
_lv_memcpy((void *)ext->img_src_left, copy_ext->img_src_left, sizeof(ext->img_src_left));
_lv_memcpy((void *)ext->img_src_right, copy_ext->img_src_right, sizeof(ext->img_src_right));
#endif
ext->tiled = copy_ext->tiled;
/*Refresh the style with new signal function*/
lv_obj_refresh_style(imgbtn, LV_STYLE_PROP_ALL);
}
LV_LOG_INFO("image button created");
return imgbtn;
}
/*=====================
* Setter functions
*====================*/
/**
* Set images for a state of the image button
* @param imgbtn pointer to an image button object
* @param state for which state set the new image (from `lv_btn_state_t`) `
* @param src pointer to an image source (a C array or path to a file)
*/
void lv_imgbtn_set_src(lv_obj_t * imgbtn, lv_btn_state_t state, const void * src)
{
LV_ASSERT_OBJ(imgbtn, LV_OBJX_NAME);
lv_imgbtn_ext_t * ext = lv_obj_get_ext_attr(imgbtn);
ext->img_src_mid[state] = src;
#if LV_IMGBTN_TILED
ext->img_src_left[state] = NULL;
ext->img_src_right[state] = NULL;
#endif
ext->tiled = 0;
refr_img(imgbtn);
}
#if LV_IMGBTN_TILED
/**
* Set images for a state of the image button
* @param imgbtn pointer to an image button object
* @param state for which state set the new image (from `lv_btn_state_t`) `
* @param src_left pointer to an image source for the left side of the button (a C array or path to
* a file)
* @param src_mid pointer to an image source for the middle of the button (ideally 1px wide) (a C
* array or path to a file)
* @param src_right pointer to an image source for the right side of the button (a C array or path
* to a file)
*/
void lv_imgbtn_set_src_tiled(lv_obj_t * imgbtn, lv_btn_state_t state, const void * src_left, const void * src_mid,
const void * src_right)
{
LV_ASSERT_OBJ(imgbtn, LV_OBJX_NAME);
if(lv_img_src_get_type(src_left) == LV_IMG_SRC_SYMBOL ||
lv_img_src_get_type(src_mid) == LV_IMG_SRC_SYMBOL ||
lv_img_src_get_type(src_right) == LV_IMG_SRC_SYMBOL) {
LV_LOG_WARN("lv_imgbtn_set_src: symbols are not supported in tiled mode");
return;
}
lv_imgbtn_ext_t * ext = lv_obj_get_ext_attr(imgbtn);
ext->img_src_left[state] = src_left;
ext->img_src_mid[state] = src_mid;
ext->img_src_right[state] = src_right;
ext->tiled = 1;
refr_img(imgbtn);
}
#endif
/*=====================
* Getter functions
*====================*/
/**
* Get the images in a given state
* @param imgbtn pointer to an image button object
* @param state the state where to get the image (from `lv_btn_state_t`) `
* @return pointer to an image source (a C array or path to a file)
*/
const void * lv_imgbtn_get_src(lv_obj_t * imgbtn, lv_btn_state_t state)
{
LV_ASSERT_OBJ(imgbtn, LV_OBJX_NAME);
lv_imgbtn_ext_t * ext = lv_obj_get_ext_attr(imgbtn);
return ext->img_src_mid[state];
}
#if LV_IMGBTN_TILED
/**
* Get the left image in a given state
* @param imgbtn pointer to an image button object
* @param state the state where to get the image (from `lv_btn_state_t`) `
* @return pointer to the left image source (a C array or path to a file)
*/
const void * lv_imgbtn_get_src_left(lv_obj_t * imgbtn, lv_btn_state_t state)
{
LV_ASSERT_OBJ(imgbtn, LV_OBJX_NAME);
lv_imgbtn_ext_t * ext = lv_obj_get_ext_attr(imgbtn);
return ext->img_src_left[state];
}
/**
* Get the middle image in a given state
* @param imgbtn pointer to an image button object
* @param state the state where to get the image (from `lv_btn_state_t`) `
* @return pointer to the middle image source (a C array or path to a file)
*/
const void * lv_imgbtn_get_src_middle(lv_obj_t * imgbtn, lv_btn_state_t state)
{
LV_ASSERT_OBJ(imgbtn, LV_OBJX_NAME);
lv_imgbtn_ext_t * ext = lv_obj_get_ext_attr(imgbtn);
return ext->img_src_mid[state];
}
/**
* Get the right image in a given state
* @param imgbtn pointer to an image button object
* @param state the state where to get the image (from `lv_btn_state_t`) `
* @return pointer to the left image source (a C array or path to a file)
*/
const void * lv_imgbtn_get_src_right(lv_obj_t * imgbtn, lv_btn_state_t state)
{
LV_ASSERT_OBJ(imgbtn, LV_OBJX_NAME);
lv_imgbtn_ext_t * ext = lv_obj_get_ext_attr(imgbtn);
return ext->img_src_right[state];
}
#endif
/*=====================
* Other functions
*====================*/
/*
* New object specific "other" functions come here
*/
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the image buttons
* @param imgbtn pointer to an object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_imgbtn_design(lv_obj_t * imgbtn, const lv_area_t * clip_area, lv_design_mode_t mode)
{
/*Return false if the object is not covers the mask_p area*/
if(mode == LV_DESIGN_COVER_CHK) {
lv_imgbtn_ext_t * ext = lv_obj_get_ext_attr(imgbtn);
lv_design_res_t cover = LV_DESIGN_RES_NOT_COVER;
if(ext->act_cf == LV_IMG_CF_TRUE_COLOR || ext->act_cf == LV_IMG_CF_RAW) {
cover = _lv_area_is_in(clip_area, &imgbtn->coords, 0) ? LV_DESIGN_RES_COVER : LV_DESIGN_RES_NOT_COVER;
}
return cover;
}
/*Draw the object*/
else if(mode == LV_DESIGN_DRAW_MAIN) {
lv_area_t img_coords;
lv_obj_get_coords(imgbtn, &img_coords);
lv_draw_rect_dsc_t bg_dsc;
lv_draw_rect_dsc_init(&bg_dsc);
lv_obj_init_draw_rect_dsc(imgbtn, LV_IMGBTN_PART_MAIN, &bg_dsc);
/*If the border is drawn later disable loading its properties*/
if(lv_obj_get_style_border_post(imgbtn, LV_OBJ_PART_MAIN)) {
bg_dsc.border_opa = LV_OPA_TRANSP;
}
lv_area_t bg_coords;
lv_area_copy(&bg_coords, &img_coords);
bg_coords.x1 -= lv_obj_get_style_pad_left(imgbtn, LV_IMGBTN_PART_MAIN);
bg_coords.x2 += lv_obj_get_style_pad_right(imgbtn, LV_IMGBTN_PART_MAIN);
bg_coords.y1 -= lv_obj_get_style_pad_top(imgbtn, LV_IMGBTN_PART_MAIN);
bg_coords.y2 += lv_obj_get_style_pad_bottom(imgbtn, LV_IMGBTN_PART_MAIN);
lv_draw_rect(&bg_coords, clip_area, &bg_dsc);
if(lv_obj_get_style_clip_corner(imgbtn, LV_OBJ_PART_MAIN)) {
lv_draw_mask_radius_param_t * mp = _lv_mem_buf_get(sizeof(lv_draw_mask_radius_param_t));
lv_coord_t r = lv_obj_get_style_radius(imgbtn, LV_OBJ_PART_MAIN);
lv_draw_mask_radius_init(mp, &bg_coords, r, false);
/*Add the mask and use `img+8` as custom id. Don't use `obj` directly because it might be used by the user*/
lv_draw_mask_add(mp, imgbtn + 8);
}
/*Just draw an image*/
lv_imgbtn_ext_t * ext = lv_obj_get_ext_attr(imgbtn);
lv_btn_state_t state = lv_imgbtn_get_state(imgbtn);
/*Simply draw the middle src if no tiled*/
if(!ext->tiled) {
const void * src = ext->img_src_mid[state];
if(lv_img_src_get_type(src) == LV_IMG_SRC_SYMBOL) {
lv_draw_label_dsc_t label_dsc;
lv_draw_label_dsc_init(&label_dsc);
lv_obj_init_draw_label_dsc(imgbtn, LV_IMGBTN_PART_MAIN, &label_dsc);
lv_draw_label(&imgbtn->coords, clip_area, &label_dsc, src, NULL);
}
else {
lv_draw_img_dsc_t img_dsc;
lv_draw_img_dsc_init(&img_dsc);
lv_obj_init_draw_img_dsc(imgbtn, LV_IMGBTN_PART_MAIN, &img_dsc);
lv_draw_img(&imgbtn->coords, clip_area, src, &img_dsc);
}
}
else {
#if LV_IMGBTN_TILED
const void * src = ext->img_src_left[state];
if(lv_img_src_get_type(src) == LV_IMG_SRC_SYMBOL) {
LV_LOG_WARN("lv_imgbtn_design: SYMBOLS are not supported in tiled mode")
return LV_DESIGN_RES_OK;
}
lv_coord_t w = lv_obj_get_style_transform_width(imgbtn, LV_OBJ_PART_MAIN);
lv_coord_t h = lv_obj_get_style_transform_height(imgbtn, LV_OBJ_PART_MAIN);
lv_area_t coords;
lv_area_copy(&coords, &imgbtn->coords);
coords.x1 -= w;
coords.x2 += w;
coords.y1 -= h;
coords.y2 += h;
lv_draw_img_dsc_t img_dsc;
lv_draw_img_dsc_init(&img_dsc);
lv_obj_init_draw_img_dsc(imgbtn, LV_IMGBTN_PART_MAIN, &img_dsc);
lv_img_header_t header;
lv_area_t coords_part;
lv_coord_t left_w = 0;
lv_coord_t right_w = 0;
if(src) {
lv_img_decoder_get_info(src, &header);
left_w = header.w;
coords_part.x1 = coords.x1;
coords_part.y1 = coords.y1;
coords_part.x2 = coords.x1 + header.w - 1;
coords_part.y2 = coords.y1 + header.h - 1;
lv_draw_img(&coords_part, clip_area, src, &img_dsc);
}
src = ext->img_src_right[state];
if(src) {
lv_img_decoder_get_info(src, &header);
right_w = header.w;
coords_part.x1 = coords.x2 - header.w + 1;
coords_part.y1 = coords.y1;
coords_part.x2 = coords.x2;
coords_part.y2 = coords.y1 + header.h - 1;
lv_draw_img(&coords_part, clip_area, src, &img_dsc);
}
src = ext->img_src_mid[state];
if(src) {
lv_area_t clip_center_area;
clip_center_area.x1 = coords.x1 + left_w;
clip_center_area.x2 = coords.x2 - right_w;
clip_center_area.y1 = coords.y1;
clip_center_area.y2 = coords.y2;
bool comm_res;
comm_res = _lv_area_intersect(&clip_center_area, &clip_center_area, clip_area);
if(comm_res) {
lv_coord_t obj_w = lv_obj_get_width(imgbtn);
lv_coord_t i;
lv_img_decoder_get_info(src, &header);
coords_part.x1 = coords.x1 + left_w;
coords_part.y1 = coords.y1;
coords_part.x2 = coords_part.x1 + header.w - 1;
coords_part.y2 = coords_part.y1 + header.h - 1;
for(i = 0; i < obj_w - right_w - left_w; i += header.w) {
lv_draw_img(&coords_part, &clip_center_area, src, &img_dsc);
coords_part.x1 = coords_part.x2 + 1;
coords_part.x2 += header.w;
}
}
}
#endif
}
}
/*Post draw when the children are drawn*/
else if(mode == LV_DESIGN_DRAW_POST) {
if(lv_obj_get_style_clip_corner(imgbtn, LV_OBJ_PART_MAIN)) {
lv_draw_mask_radius_param_t * param = lv_draw_mask_remove_custom(imgbtn + 8);
_lv_mem_buf_release(param);
}
lv_draw_rect_dsc_t draw_dsc;
lv_draw_rect_dsc_init(&draw_dsc);
/*If the border is drawn later disable loading other properties*/
if(lv_obj_get_style_border_post(imgbtn, LV_OBJ_PART_MAIN)) {
draw_dsc.bg_opa = LV_OPA_TRANSP;
draw_dsc.pattern_opa = LV_OPA_TRANSP;
draw_dsc.shadow_opa = LV_OPA_TRANSP;
lv_obj_init_draw_rect_dsc(imgbtn, LV_OBJ_PART_MAIN, &draw_dsc);
lv_area_t bg_coords;
lv_area_copy(&bg_coords, &imgbtn->coords);
bg_coords.x1 -= lv_obj_get_style_pad_left(imgbtn, LV_IMGBTN_PART_MAIN);
bg_coords.x2 += lv_obj_get_style_pad_right(imgbtn, LV_IMGBTN_PART_MAIN);
bg_coords.y1 -= lv_obj_get_style_pad_top(imgbtn, LV_IMGBTN_PART_MAIN);
bg_coords.y2 += lv_obj_get_style_pad_bottom(imgbtn, LV_IMGBTN_PART_MAIN);
lv_draw_rect(&bg_coords, clip_area, &draw_dsc);
}
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the image button
* @param imgbtn pointer to a image button object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_imgbtn_signal(lv_obj_t * imgbtn, lv_signal_t sign, void * param)
{
lv_res_t res;
/* Include the ancient signal function */
res = ancestor_signal(imgbtn, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
if(sign == LV_SIGNAL_STYLE_CHG) {
/* If the style changed then the button was clicked, released etc. so probably the state was
* changed as well Set the new image for the new state.*/
refr_img(imgbtn);
}
else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
/*Handle the padding of the background*/
lv_style_int_t left = lv_obj_get_style_pad_left(imgbtn, LV_IMGBTN_PART_MAIN);
lv_style_int_t right = lv_obj_get_style_pad_right(imgbtn, LV_IMGBTN_PART_MAIN);
lv_style_int_t top = lv_obj_get_style_pad_top(imgbtn, LV_IMGBTN_PART_MAIN);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(imgbtn, LV_IMGBTN_PART_MAIN);
imgbtn->ext_draw_pad = LV_MATH_MAX(imgbtn->ext_draw_pad, left);
imgbtn->ext_draw_pad = LV_MATH_MAX(imgbtn->ext_draw_pad, right);
imgbtn->ext_draw_pad = LV_MATH_MAX(imgbtn->ext_draw_pad, top);
imgbtn->ext_draw_pad = LV_MATH_MAX(imgbtn->ext_draw_pad, bottom);
}
else if(sign == LV_SIGNAL_CLEANUP) {
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
}
return res;
}
static void refr_img(lv_obj_t * imgbtn)
{
lv_imgbtn_ext_t * ext = lv_obj_get_ext_attr(imgbtn);
lv_btn_state_t state = lv_imgbtn_get_state(imgbtn);
lv_img_header_t header;
const void * src = ext->img_src_mid[state];
if(src == NULL) return;
lv_res_t info_res = LV_RES_OK;
if(lv_img_src_get_type(src) == LV_IMG_SRC_SYMBOL) {
const lv_font_t * font = lv_obj_get_style_text_font(imgbtn, LV_IMGBTN_PART_MAIN);
header.h = lv_font_get_line_height(font);
header.w = _lv_txt_get_width(src, (uint16_t)strlen(src), font, 0, LV_TXT_FLAG_NONE);
header.always_zero = 0;
header.cf = LV_IMG_CF_ALPHA_1BIT;
}
else {
info_res = lv_img_decoder_get_info(src, &header);
}
if(info_res == LV_RES_OK) {
ext->act_cf = header.cf;
if(ext->tiled) lv_obj_set_height(imgbtn, header.h); /*Keep the sure defined width*/
else lv_obj_set_size(imgbtn, header.w, header.h);
}
else {
ext->act_cf = LV_IMG_CF_UNKNOWN;
}
lv_obj_invalidate(imgbtn);
}
#endif
|
train_000.parquet/940
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_imgbtn.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 17988,
"token_count": 7133
}
|
/**
* @file lv_tabview.h
*
*/
#ifndef LV_TABVIEW_H
#define LV_TABVIEW_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_TABVIEW != 0
/*Testing of dependencies*/
#if LV_USE_BTNMATRIX == 0
#error "lv_tabview: lv_btnm is required. Enable it in lv_conf.h (LV_USE_BTNMATRIX 1) "
#endif
#if LV_USE_PAGE == 0
#error "lv_tabview: lv_page is required. Enable it in lv_conf.h (LV_USE_PAGE 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "../lv_widgets/lv_win.h"
#include "../lv_widgets/lv_page.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Position of tabview buttons. */
enum {
LV_TABVIEW_TAB_POS_NONE,
LV_TABVIEW_TAB_POS_TOP,
LV_TABVIEW_TAB_POS_BOTTOM,
LV_TABVIEW_TAB_POS_LEFT,
LV_TABVIEW_TAB_POS_RIGHT
};
typedef uint8_t lv_tabview_btns_pos_t;
/*Data of tab*/
typedef struct {
/*Ext. of ancestor*/
/*New data for this type */
lv_obj_t * btns;
lv_obj_t * indic;
lv_obj_t * content; /*A background page which holds tab's pages*/
const char ** tab_name_ptr;
lv_point_t point_last;
uint16_t tab_cur;
uint16_t tab_cnt;
#if LV_USE_ANIMATION
uint16_t anim_time;
#endif
lv_tabview_btns_pos_t btns_pos : 3;
} lv_tabview_ext_t;
enum {
LV_TABVIEW_PART_BG = LV_OBJ_PART_MAIN,
_LV_TABVIEW_PART_VIRTUAL_LAST = _LV_OBJ_PART_VIRTUAL_LAST,
LV_TABVIEW_PART_BG_SCRLLABLE = _LV_OBJ_PART_REAL_LAST,
LV_TABVIEW_PART_TAB_BG,
LV_TABVIEW_PART_TAB_BTN,
LV_TABVIEW_PART_INDIC,
_LV_TABVIEW_PART_REAL_LAST,
};
typedef uint8_t lv_tabview_part_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a Tab view object
* @param par pointer to an object, it will be the parent of the new tab
* @param copy pointer to a tab object, if not NULL then the new object will be copied from it
* @return pointer to the created tab
*/
lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
*=====================*/
/**
* Add a new tab with the given name
* @param tabview pointer to Tab view object where to ass the new tab
* @param name the text on the tab button
* @return pointer to the created page object (lv_page). You can create your content here
*/
lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name);
/**
* Delete all children of a tab created by `lv_tabview_add_tab`.
* @param tab pointer to a tab
*/
void lv_tabview_clean_tab(lv_obj_t * tab);
/*=====================
* Setter functions
*====================*/
/**
* Set a new tab
* @param tabview pointer to Tab view object
* @param id index of a tab to load
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t anim);
/**
* Set the name of a tab.
* @param tabview pointer to Tab view object
* @param id index of the tab the name should be set
* @param name new tab name
*/
void lv_tabview_set_tab_name(lv_obj_t * tabview, uint16_t id, char * name);
/**
* Set the animation time of tab view when a new tab is loaded
* @param tabview pointer to Tab view object
* @param anim_time time of animation in milliseconds
*/
void lv_tabview_set_anim_time(lv_obj_t * tabview, uint16_t anim_time);
/**
* Set the position of tab select buttons
* @param tabview pointer to a tab view object
* @param btns_pos which button position
*/
void lv_tabview_set_btns_pos(lv_obj_t * tabview, lv_tabview_btns_pos_t btns_pos);
/*=====================
* Getter functions
*====================*/
/**
* Get the index of the currently active tab
* @param tabview pointer to Tab view object
* @return the active tab index
*/
uint16_t lv_tabview_get_tab_act(const lv_obj_t * tabview);
/**
* Get the number of tabs
* @param tabview pointer to Tab view object
* @return tab count
*/
uint16_t lv_tabview_get_tab_count(const lv_obj_t * tabview);
/**
* Get the page (content area) of a tab
* @param tabview pointer to Tab view object
* @param id index of the tab (>= 0)
* @return pointer to page (lv_page) object
*/
lv_obj_t * lv_tabview_get_tab(const lv_obj_t * tabview, uint16_t id);
/**
* Get the animation time of tab view when a new tab is loaded
* @param tabview pointer to Tab view object
* @return time of animation in milliseconds
*/
uint16_t lv_tabview_get_anim_time(const lv_obj_t * tabview);
/**
* Get position of tab select buttons
* @param tabview pointer to a ab view object
*/
lv_tabview_btns_pos_t lv_tabview_get_btns_pos(const lv_obj_t * tabview);
/**********************
* MACROS
**********************/
#endif /*LV_USE_TABVIEW*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_TABVIEW_H*/
|
train_000.parquet/941
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_tabview.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 4919,
"token_count": 1907
}
|
/**
* @file lv_keyboard.h
*
*/
#ifndef LV_KEYBOARD_H
#define LV_KEYBOARD_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_KEYBOARD != 0
/*Testing of dependencies*/
#if LV_USE_BTNMATRIX == 0
#error "lv_kb: lv_btnm is required. Enable it in lv_conf.h (LV_USE_BTNMATRIX 1) "
#endif
#if LV_USE_TEXTAREA == 0
#error "lv_kb: lv_ta is required. Enable it in lv_conf.h (LV_USE_TEXTAREA 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "lv_btnmatrix.h"
/*********************
* DEFINES
*********************/
#define LV_KEYBOARD_CTRL_BTN_FLAGS (LV_BTNMATRIX_CTRL_NO_REPEAT | LV_BTNMATRIX_CTRL_CLICK_TRIG)
/**********************
* TYPEDEFS
**********************/
/** Current keyboard mode. */
enum {
LV_KEYBOARD_MODE_TEXT_LOWER,
LV_KEYBOARD_MODE_TEXT_UPPER,
LV_KEYBOARD_MODE_SPECIAL,
LV_KEYBOARD_MODE_NUM,
};
typedef uint8_t lv_keyboard_mode_t;
/*Data of keyboard*/
typedef struct {
lv_btnmatrix_ext_t btnm; /*Ext. of ancestor*/
/*New data for this type */
lv_obj_t * ta; /*Pointer to the assigned text area*/
lv_keyboard_mode_t mode; /*Key map type*/
uint8_t cursor_mng : 1; /*1: automatically show/hide cursor when a text area is assigned or left*/
} lv_keyboard_ext_t;
enum {
LV_KEYBOARD_PART_BG,
LV_KEYBOARD_PART_BTN,
};
typedef uint8_t lv_keyboard_style_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a keyboard objects
* @param par pointer to an object, it will be the parent of the new keyboard
* @param copy pointer to a keyboard object, if not NULL then the new object will be copied from it
* @return pointer to the created keyboard
*/
lv_obj_t * lv_keyboard_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
*====================*/
/**
* Assign a Text Area to the Keyboard. The pressed characters will be put there.
* @param kb pointer to a Keyboard object
* @param ta pointer to a Text Area object to write there
*/
void lv_keyboard_set_textarea(lv_obj_t * kb, lv_obj_t * ta);
/**
* Set a new a mode (text or number map)
* @param kb pointer to a Keyboard object
* @param mode the mode from 'lv_keyboard_mode_t'
*/
void lv_keyboard_set_mode(lv_obj_t * kb, lv_keyboard_mode_t mode);
/**
* Automatically hide or show the cursor of the current Text Area
* @param kb pointer to a Keyboard object
* @param en true: show cursor on the current text area, false: hide cursor
*/
void lv_keyboard_set_cursor_manage(lv_obj_t * kb, bool en);
/**
* Set a new map for the keyboard
* @param kb pointer to a Keyboard object
* @param mode keyboard map to alter 'lv_keyboard_mode_t'
* @param map pointer to a string array to describe the map.
* See 'lv_btnmatrix_set_map()' for more info.
*/
void lv_keyboard_set_map(lv_obj_t * kb, lv_keyboard_mode_t mode, const char * map[]);
/**
* Set the button control map (hidden, disabled etc.) for the keyboard. The
* control map array will be copied and so may be deallocated after this
* function returns.
* @param kb pointer to a keyboard object
* @param mode keyboard ctrl map to alter 'lv_keyboard_mode_t'
* @param ctrl_map pointer to an array of `lv_btn_ctrl_t` control bytes.
* See: `lv_btnmatrix_set_ctrl_map` for more details.
*/
void lv_keyboard_set_ctrl_map(lv_obj_t * kb, lv_keyboard_mode_t mode, const lv_btnmatrix_ctrl_t ctrl_map[]);
/*=====================
* Getter functions
*====================*/
/**
* Assign a Text Area to the Keyboard. The pressed characters will be put there.
* @param kb pointer to a Keyboard object
* @return pointer to the assigned Text Area object
*/
lv_obj_t * lv_keyboard_get_textarea(const lv_obj_t * kb);
/**
* Set a new a mode (text or number map)
* @param kb pointer to a Keyboard object
* @return the current mode from 'lv_keyboard_mode_t'
*/
lv_keyboard_mode_t lv_keyboard_get_mode(const lv_obj_t * kb);
/**
* Get the current cursor manage mode.
* @param kb pointer to a Keyboard object
* @return true: show cursor on the current text area, false: hide cursor
*/
bool lv_keyboard_get_cursor_manage(const lv_obj_t * kb);
/**
* Get the current map of a keyboard
* @param kb pointer to a keyboard object
* @return the current map
*/
static inline const char ** lv_keyboard_get_map_array(const lv_obj_t * kb)
{
return lv_btnmatrix_get_map_array(kb);
}
/*=====================
* Other functions
*====================*/
/**
* Default keyboard event to add characters to the Text area and change the map.
* If a custom `event_cb` is added to the keyboard this function be called from it to handle the
* button clicks
* @param kb pointer to a keyboard
* @param event the triggering event
*/
void lv_keyboard_def_event_cb(lv_obj_t * kb, lv_event_t event);
/**********************
* MACROS
**********************/
#endif /*LV_USE_KEYBOARD*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_KEYBOARD_H*/
|
train_000.parquet/942
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_keyboard.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 5066,
"token_count": 1824
}
|
/**
* @file lv_win.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_win.h"
#if LV_USE_WIN != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_core/lv_disp.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_win"
#define DEF_TITLE "Window"
/**********************
* TYPEDEFS
**********************/
/** Extended data of win_btn*/
typedef struct {
/** Ext. of ancestor*/
lv_btn_ext_t btn;
/** Which side of the header should the button be aligned to.
* 0: Align to right (default), 1: Align to left */
uint8_t alignment_in_header : 1;
} lv_win_btn_ext_t;
enum {
LV_WIN_BTN_ALIGN_RIGHT = 0, /**< Align button to right of the header */
LV_WIN_BTN_ALIGN_LEFT /**< Align button to left of the header */
};
typedef uint8_t lv_win_btn_align_t;
/**********************
* STATIC PROTOTYPES
**********************/
static lv_res_t lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param);
static lv_design_res_t lv_win_header_design(lv_obj_t * header, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_style_list_t * lv_win_get_style(lv_obj_t * win, uint8_t part);
static void lv_win_realign(lv_obj_t * win);
static lv_obj_t * lv_win_btn_create(lv_obj_t * par, const void * img_src);
static void lv_win_btn_set_alignment(lv_obj_t * par, const lv_win_btn_align_t alignment);
static lv_win_btn_align_t lv_win_btn_get_alignment(const lv_obj_t * par);
/**********************
* STATIC VARIABLES
**********************/
static lv_design_cb_t ancestor_header_design;
static lv_signal_cb_t ancestor_signal;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a window objects
* @param par pointer to an object, it will be the parent of the new window
* @param copy pointer to a window object, if not NULL then the new object will be copied from it
* @return pointer to the created window
*/
lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("window create started");
/*Create the ancestor object*/
lv_obj_t * new_win = lv_obj_create(par, copy);
LV_ASSERT_MEM(new_win);
if(new_win == NULL) return NULL;
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_win);
/*Allocate the object type specific extended data*/
lv_win_ext_t * ext = lv_obj_allocate_ext_attr(new_win, sizeof(lv_win_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(new_win);
return NULL;
}
ext->page = NULL;
ext->header = NULL;
ext->title_txt = lv_mem_alloc(strlen(DEF_TITLE) + 1);
strcpy(ext->title_txt, DEF_TITLE);
/*Init the new window object*/
if(copy == NULL) {
/* Set a size which fits into the parent.
* Don't use `par` directly because if the window is created on a page it is moved to the
* scrollable so the parent has changed */
lv_coord_t w;
lv_coord_t h;
if(par) {
w = lv_obj_get_width_fit(lv_obj_get_parent(new_win));
h = lv_obj_get_height_fit(lv_obj_get_parent(new_win));
}
else {
w = lv_disp_get_hor_res(NULL);
h = lv_disp_get_ver_res(NULL);
}
lv_obj_set_size(new_win, w, h);
ext->btn_w = LV_DPX(65);
ext->page = lv_page_create(new_win, NULL);
lv_obj_add_protect(ext->page, LV_PROTECT_PARENT);
lv_page_set_scrollbar_mode(ext->page, LV_SCROLLBAR_MODE_AUTO);
lv_obj_clean_style_list(ext->page, LV_PAGE_PART_BG);
/*Create a holder for the header*/
ext->header = lv_obj_create(new_win, NULL);
/*Move back to window background because it's automatically moved to the content page*/
lv_obj_add_protect(ext->header, LV_PROTECT_PARENT);
lv_obj_set_parent(ext->header, new_win);
if(ancestor_header_design == NULL) ancestor_header_design = lv_obj_get_design_cb(ext->header);
lv_obj_set_height(ext->header, LV_DPX(65));
lv_obj_set_design_cb(ext->header, lv_win_header_design);
lv_obj_set_signal_cb(new_win, lv_win_signal);
lv_theme_apply(new_win, LV_THEME_WIN);
}
/*Copy an existing object*/
else {
lv_win_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
/*Create the objects*/
ext->header = lv_obj_create(new_win, copy_ext->header);
ext->title_txt = lv_mem_alloc(strlen(copy_ext->title_txt) + 1);
strcpy(ext->title_txt, copy_ext->title_txt);
ext->page = lv_page_create(new_win, copy_ext->page);
ext->btn_w = copy_ext->btn_w;
/*Copy the buttons*/
lv_obj_t * child;
child = lv_obj_get_child_back(copy_ext->header, NULL);
child = lv_obj_get_child_back(copy_ext->header, child); /*Sip the title*/
while(child != NULL) {
lv_obj_t * btn = lv_btn_create(ext->header, child);
lv_img_create(btn, lv_obj_get_child(child, NULL));
child = lv_obj_get_child_back(copy_ext->header, child);
}
lv_obj_set_signal_cb(new_win, lv_win_signal);
}
/*Refresh the style with new signal function*/
lv_obj_refresh_style(new_win, LV_STYLE_PROP_ALL);
lv_win_realign(new_win);
LV_LOG_INFO("window created");
return new_win;
}
/**
* Delete all children of the scrl object, without deleting scrl child.
* @param win pointer to an object
*/
void lv_win_clean(lv_obj_t * win)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
lv_obj_t * scrl = lv_page_get_scrollable(win);
lv_obj_clean(scrl);
}
/*======================
* Add/remove functions
*=====================*/
/**
* Add control button to the header of the window
* @param win pointer to a window object
* @param img_src an image source ('lv_img_t' variable, path to file or a symbol)
* @param alignment button alignment on the header
* @return pointer to the created button object
*/
lv_obj_t * lv_win_add_btn_right(lv_obj_t * win, const void * img_src)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
LV_ASSERT_NULL(img_src);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_obj_t * btn = lv_win_btn_create(ext->header, img_src);
lv_win_btn_set_alignment(btn, LV_WIN_BTN_ALIGN_RIGHT);
lv_win_realign(win);
return btn;
}
/**
* Add control button on the left side of the window header
* @param win pointer to a window object
* @param img_src an image source ('lv_img_t' variable, path to file or a symbol)
* @return pointer to the created button object
*/
lv_obj_t * lv_win_add_btn_left(lv_obj_t * win, const void * img_src)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
LV_ASSERT_NULL(img_src);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_obj_t * btn = lv_win_btn_create(ext->header, img_src);
lv_win_btn_set_alignment(btn, LV_WIN_BTN_ALIGN_LEFT);
lv_win_realign(win);
return btn;
}
/*=====================
* Setter functions
*====================*/
/**
* Can be assigned to a window control button to close the window
* @param btn pointer to the control button on the widows header
* @param evet the event type
*/
void lv_win_close_event_cb(lv_obj_t * btn, lv_event_t event)
{
LV_ASSERT_OBJ(btn, "lv_btn");
if(event == LV_EVENT_RELEASED) {
lv_obj_t * win = lv_win_get_from_btn(btn);
lv_obj_del(win);
}
}
/**
* Set the title of a window
* @param win pointer to a window object
* @param title string of the new title
*/
void lv_win_set_title(lv_obj_t * win, const char * title)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
LV_ASSERT_STR(title);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
ext->title_txt = lv_mem_realloc(ext->title_txt, strlen(title) + 1);
LV_ASSERT_MEM(ext->title_txt);
if(ext->title_txt == NULL) return;
strcpy(ext->title_txt, title);
lv_obj_invalidate(ext->header);
}
/**
* Set the height of the header
* @param win pointer to a window object
* @param height height of the header
*/
void lv_win_set_header_height(lv_obj_t * win, lv_coord_t height)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_obj_set_height(ext->header, height);
lv_win_realign(win);
}
/**
* Set the width of the control buttons on the header
* @param win pointer to a window object
* @param width width of the control button. 0: to make them square automatically.
*/
void lv_win_set_btn_width(lv_obj_t * win, lv_coord_t width)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
ext->btn_w = width;
lv_win_realign(win);
}
/**
* Set the size of the content area.
* It's the effective area where object can be placed.
* @param win pointer to a window object
* @param w width
* @param h height (the window will be higher with the height of the header)
*/
void lv_win_set_content_size(lv_obj_t * win, lv_coord_t w, lv_coord_t h)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
h += lv_obj_get_height(ext->header);
lv_obj_set_size(win, w, h);
}
/**
* Set the layout of the window
* @param win pointer to a window object
* @param layout the layout from 'lv_layout_t'
*/
void lv_win_set_layout(lv_obj_t * win, lv_layout_t layout)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_page_set_scrl_layout(ext->page, layout);
}
/**
* Set the scroll bar mode of a window
* @param win pointer to a window object
* @param sb_mode the new scroll bar mode from 'lv_sb_mode_t'
*/
void lv_win_set_scrollbar_mode(lv_obj_t * win, lv_scrollbar_mode_t sb_mode)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_page_set_scrollbar_mode(ext->page, sb_mode);
}
/**
* Set focus animation duration on `lv_win_focus()`
* @param win pointer to a window object
* @param anim_time duration of animation [ms]
*/
void lv_win_set_anim_time(lv_obj_t * win, uint16_t anim_time)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
lv_page_set_anim_time(lv_win_get_content(win), anim_time);
}
/**
* Set drag status of a window. If set to 'true' window can be dragged like on a PC.
* @param win pointer to a window object
* @param en whether dragging is enabled
*/
void lv_win_set_drag(lv_obj_t * win, bool en)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_obj_t * win_header = ext->header;
lv_obj_set_drag_parent(win_header, en);
lv_obj_set_drag(win, en);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the title of a window
* @param win pointer to a window object
* @return title string of the window
*/
const char * lv_win_get_title(const lv_obj_t * win)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
return ext->title_txt;
}
/**
* Get the content holder object of window (`lv_page`) to allow additional customization
* @param win pointer to a window object
* @return the Page object where the window's content is
*/
lv_obj_t * lv_win_get_content(const lv_obj_t * win)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
return ext->page;
}
/**
* Get the header height
* @param win pointer to a window object
* @return header height
*/
lv_coord_t lv_win_get_header_height(const lv_obj_t * win)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
return lv_obj_get_height(ext->header);
}
/**
* Get the width of the control buttons on the header
* @param win pointer to a window object
* @return width of the control button. 0: square.
*/
lv_coord_t lv_win_get_btn_width(lv_obj_t * win)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
return ext->btn_w;
}
/**
* Get the pointer of a widow from one of its control button.
* It is useful in the action of the control buttons where only button is known.
* @param ctrl_btn pointer to a control button of a window
* @return pointer to the window of 'ctrl_btn'
*/
lv_obj_t * lv_win_get_from_btn(const lv_obj_t * ctrl_btn)
{
LV_ASSERT_OBJ(ctrl_btn, "lv_btn");
lv_obj_t * header = lv_obj_get_parent(ctrl_btn);
lv_obj_t * win = lv_obj_get_parent(header);
return win;
}
/**
* Get the layout of a window
* @param win pointer to a window object
* @return the layout of the window (from 'lv_layout_t')
*/
lv_layout_t lv_win_get_layout(lv_obj_t * win)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
return lv_page_get_scrl_layout(ext->page);
}
/**
* Get the scroll bar mode of a window
* @param win pointer to a window object
* @return the scroll bar mode of the window (from 'lv_sb_mode_t')
*/
lv_scrollbar_mode_t lv_win_get_sb_mode(lv_obj_t * win)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
return lv_page_get_scrollbar_mode(ext->page);
}
/**
* Get focus animation duration
* @param win pointer to a window object
* @return duration of animation [ms]
*/
uint16_t lv_win_get_anim_time(const lv_obj_t * win)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
return lv_page_get_anim_time(lv_win_get_content(win));
}
/**
* Get width of the content area (page scrollable) of the window
* @param win pointer to a window object
* @return the width of the content_bg area
*/
lv_coord_t lv_win_get_width(lv_obj_t * win)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_obj_t * scrl = lv_page_get_scrollable(ext->page);
lv_coord_t left = lv_obj_get_style_pad_left(win, LV_WIN_PART_BG);
lv_coord_t right = lv_obj_get_style_pad_left(win, LV_WIN_PART_BG);
return lv_obj_get_width_fit(scrl) - left - right;
}
/*=====================
* Other functions
*====================*/
/**
* Focus on an object. It ensures that the object will be visible in the window.
* @param win pointer to a window object
* @param obj pointer to an object to focus (must be in the window)
* @param anim_en LV_ANIM_ON focus with an animation; LV_ANIM_OFF focus without animation
*/
void lv_win_focus(lv_obj_t * win, lv_obj_t * obj, lv_anim_enable_t anim_en)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
LV_ASSERT_OBJ(obj, "");
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_page_focus(ext->page, obj, anim_en);
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the window header
* @param header pointer to an object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_win_header_design(lv_obj_t * header, const lv_area_t * clip_area, lv_design_mode_t mode)
{
/*Return false if the object is not covers the mask_p area*/
if(mode == LV_DESIGN_COVER_CHK) {
return ancestor_header_design(header, clip_area, mode);
}
/*Draw the object*/
else if(mode == LV_DESIGN_DRAW_MAIN) {
ancestor_header_design(header, clip_area, mode);
lv_obj_t * win = lv_obj_get_parent(header);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_style_int_t header_left = lv_obj_get_style_pad_left(win, LV_WIN_PART_HEADER);
lv_style_int_t header_inner = lv_obj_get_style_pad_inner(win, LV_WIN_PART_HEADER);
lv_draw_label_dsc_t label_dsc;
lv_draw_label_dsc_init(&label_dsc);
lv_obj_init_draw_label_dsc(header, LV_OBJ_PART_MAIN, &label_dsc);
lv_area_t txt_area;
lv_point_t txt_size;
_lv_txt_get_size(&txt_size, ext->title_txt, label_dsc.font, label_dsc.letter_space, label_dsc.line_space, LV_COORD_MAX,
label_dsc.flag);
lv_obj_t * btn = NULL;
lv_coord_t btn_h = lv_obj_get_height_fit(header);
lv_coord_t btn_w = ext->btn_w != 0 ? ext->btn_w : btn_h;
/*Get x position of the title (should be on the right of the buttons on the left)*/
lv_coord_t left_btn_offset = 0;
btn = lv_obj_get_child_back(ext->header, NULL);
while(btn != NULL) {
if(LV_WIN_BTN_ALIGN_LEFT == lv_win_btn_get_alignment(btn)) {
left_btn_offset += btn_w + header_inner;
}
btn = lv_obj_get_child_back(header, btn);
}
txt_area.x1 = header->coords.x1 + header_left + left_btn_offset;
txt_area.y1 = header->coords.y1 + (lv_obj_get_height(header) - txt_size.y) / 2;
txt_area.x2 = txt_area.x1 + txt_size.x + left_btn_offset;
txt_area.y2 = txt_area.y1 + txt_size.y;
lv_draw_label(&txt_area, clip_area, &label_dsc, ext->title_txt, NULL);
}
else if(mode == LV_DESIGN_DRAW_POST) {
ancestor_header_design(header, clip_area, mode);
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the window
* @param win pointer to a window object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_win_signal(lv_obj_t * win, lv_signal_t sign, void * param)
{
lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_win_get_style(win, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(win, sign, param);
}
else if(sign == LV_SIGNAL_GET_STATE_DSC) {
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_get_state_info_t * info = param;
if(info->part == LV_WIN_PART_CONTENT_SCROLLABLE) info->result = lv_obj_get_state(lv_page_get_scrollable(ext->page),
LV_CONT_PART_MAIN);
else if(info->part == LV_WIN_PART_SCROLLBAR) info->result = lv_obj_get_state(ext->page, LV_PAGE_PART_SCROLLBAR);
else if(info->part == LV_WIN_PART_HEADER) info->result = lv_obj_get_state(ext->header, LV_OBJ_PART_MAIN);
return LV_RES_OK;
}
/* Include the ancient signal function */
res = ancestor_signal(win, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
if(sign == LV_SIGNAL_CHILD_CHG) { /*Move children to the page*/
lv_obj_t * page = ext->page;
if(page != NULL) {
lv_obj_t * child;
child = lv_obj_get_child(win, NULL);
while(child != NULL) {
if(lv_obj_is_protected(child, LV_PROTECT_PARENT) == false) {
lv_obj_t * tmp = child;
child = lv_obj_get_child(win, child); /*Get the next child before move this*/
lv_obj_set_parent(tmp, page);
}
else {
child = lv_obj_get_child(win, child);
}
}
}
}
else if(sign == LV_SIGNAL_STYLE_CHG) {
lv_win_realign(win);
}
else if(sign == LV_SIGNAL_COORD_CHG) {
/*If the size is changed refresh the window*/
if(lv_area_get_width(param) != lv_obj_get_width(win) || lv_area_get_height(param) != lv_obj_get_height(win)) {
lv_win_realign(win);
}
}
else if(sign == LV_SIGNAL_CLEANUP) {
ext->header = NULL; /*These objects were children so they are already invalid*/
ext->page = NULL;
lv_mem_free(ext->title_txt);
ext->title_txt = NULL;
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
/*Forward all the control signals to the page*/
ext->page->signal_cb(ext->page, sign, param);
#endif
}
return res;
}
/**
* Get the style descriptor of a part of the object
* @param win pointer the object
* @param part the part of the win. (LV_PAGE_WIN_...)
* @return pointer to the style descriptor of the specified part
*/
static lv_style_list_t * lv_win_get_style(lv_obj_t * win, uint8_t part)
{
LV_ASSERT_OBJ(win, LV_OBJX_NAME);
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
lv_style_list_t * style_dsc_p;
switch(part) {
case LV_WIN_PART_BG:
style_dsc_p = &win->style_list;
break;
case LV_WIN_PART_HEADER:
style_dsc_p = lv_obj_get_style_list(ext->header, LV_OBJ_PART_MAIN);
break;
case LV_WIN_PART_SCROLLBAR:
style_dsc_p = lv_obj_get_style_list(ext->page, LV_PAGE_PART_SCROLLBAR);
break;
case LV_WIN_PART_CONTENT_SCROLLABLE:
style_dsc_p = lv_obj_get_style_list(ext->page, LV_PAGE_PART_SCROLLABLE);
break;
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
/**
* Realign the building elements of a window
* @param win pointer to a window object
*/
static void lv_win_realign(lv_obj_t * win)
{
lv_win_ext_t * ext = lv_obj_get_ext_attr(win);
if(ext->page == NULL || ext->header == NULL) return;
lv_obj_set_width(ext->header, lv_obj_get_width(win));
lv_obj_t * btn;
lv_obj_t * btn_prev_at_left = NULL;
lv_obj_t * btn_prev_at_right = NULL;
bool is_header_right_side_empty = true;
bool is_header_left_side_empty = true;
lv_coord_t btn_h = lv_obj_get_height_fit(ext->header);
lv_coord_t btn_w = ext->btn_w != 0 ? ext->btn_w : btn_h;
lv_style_int_t header_inner = lv_obj_get_style_pad_inner(win, LV_WIN_PART_HEADER);
lv_style_int_t header_right = lv_obj_get_style_pad_right(win, LV_WIN_PART_HEADER);
lv_style_int_t header_left = lv_obj_get_style_pad_left(win, LV_WIN_PART_HEADER);
/*Refresh the size of all control buttons*/
btn = lv_obj_get_child_back(ext->header, NULL);
while(btn != NULL) {
lv_obj_set_size(btn, btn_w, btn_h);
uint8_t btn_alignment = lv_win_btn_get_alignment(btn);
if(LV_WIN_BTN_ALIGN_RIGHT == btn_alignment) {
if(is_header_right_side_empty) {
/* Align the button to the right of the header */
lv_obj_align(btn, ext->header, LV_ALIGN_IN_RIGHT_MID, -header_right, 0);
is_header_right_side_empty = false;
}
else {
/* Align the button to the left of the previous button */
lv_obj_align(btn, btn_prev_at_right, LV_ALIGN_OUT_LEFT_MID, -header_inner, 0);
}
btn_prev_at_right = btn;
}
else if(LV_WIN_BTN_ALIGN_LEFT == btn_alignment) {
if(is_header_left_side_empty) {
/* Align the button to the right of the header */
lv_obj_align(btn, ext->header, LV_ALIGN_IN_LEFT_MID, header_left, 0);
is_header_left_side_empty = false;
}
else {
/* Align the button to the right of the previous button */
lv_obj_align(btn, btn_prev_at_left, LV_ALIGN_OUT_RIGHT_MID, header_inner, 0);
}
btn_prev_at_left = btn;
}
btn = lv_obj_get_child_back(ext->header, btn);
}
lv_obj_set_pos(ext->header, 0, 0);
lv_obj_set_size(ext->page, lv_obj_get_width(win), lv_obj_get_height(win) - lv_obj_get_height(ext->header));
lv_obj_align(ext->page, ext->header, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
}
static lv_obj_t * lv_win_btn_create(lv_obj_t * par, const void * img_src)
{
LV_LOG_TRACE("win btn create started");
lv_obj_t * win_btn;
win_btn = lv_btn_create(par, NULL);
LV_ASSERT_MEM(win_btn);
if(win_btn == NULL) return NULL;
/*Allocate the extended data*/
lv_win_btn_ext_t * ext = lv_obj_allocate_ext_attr(win_btn, sizeof(lv_win_btn_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(win_btn);
return NULL;
}
ext->alignment_in_header = LV_WIN_BTN_ALIGN_RIGHT;
lv_obj_set_click(win_btn, true);
lv_win_btn_set_alignment(win_btn, LV_WIN_BTN_ALIGN_RIGHT);
lv_theme_apply(win_btn, LV_THEME_WIN_BTN);
lv_coord_t btn_size = lv_obj_get_height_fit(par);
lv_obj_set_size(win_btn, btn_size, btn_size);
lv_obj_t * img = lv_img_create(win_btn, NULL);
lv_obj_set_click(img, false);
lv_img_set_src(img, img_src);
LV_LOG_INFO("win btn created");
return win_btn;
}
static void lv_win_btn_set_alignment(lv_obj_t * win_btn, const uint8_t alignment)
{
lv_win_btn_ext_t * ext = lv_obj_get_ext_attr(win_btn);
ext->alignment_in_header = alignment;
}
static uint8_t lv_win_btn_get_alignment(const lv_obj_t * win_btn)
{
lv_win_btn_ext_t * ext = lv_obj_get_ext_attr(win_btn);
return ext->alignment_in_header;
}
#endif
|
train_000.parquet/943
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_win.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 25310,
"token_count": 10072
}
|
/**
* @file lv_page.c
*
*/
/*********************
* INCLUDES
*********************/
#include "../lv_widgets/lv_page.h"
#if LV_USE_PAGE != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_group.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_core/lv_refr.h"
#include "../lv_misc/lv_anim.h"
#include "../lv_misc/lv_math.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_page"
#define LV_PAGE_SB_MIN_SIZE (LV_DPI / 8)
/*[ms] Scroll anim time on `lv_page_scroll_up/down/left/rigth`*/
#define LV_PAGE_SCROLL_ANIM_TIME 200
#define LV_PAGE_END_FLASH_SIZE (LV_DPI / 4)
#define LV_PAGE_END_ANIM_TIME 300
#define LV_PAGE_END_ANIM_WAIT_TIME 300
#if LV_USE_ANIMATION == 0
#undef LV_PAGE_DEF_ANIM_TIME
#define LV_PAGE_DEF_ANIM_TIME 0 /*No animation*/
#endif
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static void scrlbar_refresh(lv_obj_t * page);
static void scrl_reposition(lv_obj_t * page);
static lv_design_res_t lv_page_design(lv_obj_t * page, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param);
static lv_style_list_t * lv_page_get_style(lv_obj_t * page, uint8_t part);
static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
static void scrl_def_event_cb(lv_obj_t * scrl, lv_event_t event);
static void refr_ext_draw_pad(lv_obj_t * page);
#if LV_USE_ANIMATION
static void edge_flash_anim(void * page, lv_anim_value_t v);
static void edge_flash_anim_end(lv_anim_t * a);
static void get_edge_flash_area(lv_obj_t * page, lv_area_t * area, lv_coord_t state);
#endif
/**********************
* STATIC VARIABLES
**********************/
static lv_design_cb_t ancestor_design;
static lv_signal_cb_t ancestor_signal;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a page objects
* @param par pointer to an object, it will be the parent of the new page
* @param copy pointer to a page object, if not NULL then the new object will be copied from it
* @return pointer to the created page
*/
lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("page create started");
/*Create the ancestor object*/
lv_obj_t * page = lv_cont_create(par, copy);
LV_ASSERT_MEM(page);
if(page == NULL) return NULL;
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(page);
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(page);
/*Allocate the object type specific extended data*/
lv_page_ext_t * ext = lv_obj_allocate_ext_attr(page, sizeof(lv_page_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(page);
return NULL;
}
ext->scrl = NULL;
lv_style_list_init(&ext->scrlbar.style);
ext->scrlbar.hor_draw = 0;
ext->scrlbar.ver_draw = 0;
ext->scrlbar.mode = LV_SCROLLBAR_MODE_AUTO;
#if LV_USE_ANIMATION
lv_style_list_init(&ext->edge_flash.style);
ext->edge_flash.enabled = 0;
ext->edge_flash.bottom_ip = 0;
ext->edge_flash.top_ip = 0;
ext->edge_flash.left_ip = 0;
ext->edge_flash.right_ip = 0;
ext->edge_flash.state = 0;
ext->anim_time = LV_PAGE_DEF_ANIM_TIME;
#endif
ext->scroll_prop = 0;
ext->scroll_prop_obj = NULL;
/*Init the new page object*/
if(copy == NULL) {
ext->scrl = lv_cont_create(page, NULL);
lv_obj_set_drag(ext->scrl, true);
lv_obj_set_drag_throw(ext->scrl, true);
lv_obj_add_protect(ext->scrl, LV_PROTECT_PARENT | LV_PROTECT_PRESS_LOST);
lv_cont_set_fit(ext->scrl, LV_FIT_MAX);
lv_obj_set_event_cb(ext->scrl, scrl_def_event_cb); /*Propagate some event to the background
object by default for convenience */
lv_obj_set_signal_cb(ext->scrl, lv_page_scrollable_signal);
/* Add the signal function only if 'scrolling' is created
+ * because everything has to be ready before any signal is received*/
lv_obj_set_signal_cb(page, lv_page_signal);
lv_obj_set_design_cb(page, lv_page_design);
lv_page_set_scrollbar_mode(page, ext->scrlbar.mode);
lv_theme_apply(page, LV_THEME_PAGE);
}
else {
lv_page_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->scrl = lv_cont_create(page, copy_ext->scrl);
lv_obj_set_signal_cb(ext->scrl, lv_page_scrollable_signal);
lv_style_list_copy(&ext->scrlbar.style, ©_ext->scrlbar.style);
#if LV_USE_ANIMATION
lv_style_list_copy(&ext->edge_flash.style, ©_ext->edge_flash.style);
#endif
/* Add the signal function only if 'scrolling' is created
* because everything has to be ready before any signal is received*/
lv_obj_set_signal_cb(page, lv_page_signal);
lv_obj_set_design_cb(page, lv_page_design);
lv_page_set_scrollbar_mode(page, copy_ext->scrlbar.mode);
}
scrlbar_refresh(page);
LV_LOG_INFO("page created");
return page;
}
/**
* Delete all children of the scrl object, without deleting scrl child.
* @param page pointer to an object
*/
void lv_page_clean(lv_obj_t * page)
{
LV_ASSERT_OBJ(page, LV_OBJX_NAME);
lv_obj_t * scrl = lv_page_get_scrollable(page);
lv_obj_clean(scrl);
}
/*=====================
* Setter functions
*====================*/
/**
* Set the scroll bar mode on a page
* @param page pointer to a page object
* @param sb_mode the new mode from 'lv_page_sb.mode_t' enum
*/
void lv_page_set_scrollbar_mode(lv_obj_t * page, lv_scrollbar_mode_t sb_mode)
{
LV_ASSERT_OBJ(page, LV_OBJX_NAME);
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
if(ext->scrlbar.mode == sb_mode) return;
if(sb_mode == LV_SCROLLBAR_MODE_HIDE)
ext->scrlbar.mode |= LV_SCROLLBAR_MODE_HIDE; /*Set the hidden flag*/
else if(sb_mode == LV_SCROLLBAR_MODE_UNHIDE)
ext->scrlbar.mode &= (~LV_SCROLLBAR_MODE_HIDE); /*Clear the hidden flag*/
else {
if(ext->scrlbar.mode & LV_SCROLLBAR_MODE_HIDE) sb_mode |= LV_SCROLLBAR_MODE_HIDE;
ext->scrlbar.mode = sb_mode;
}
ext->scrlbar.hor_draw = 0;
ext->scrlbar.ver_draw = 0;
scrlbar_refresh(page);
lv_obj_invalidate(page);
}
/**
* Set the animation time for the page
* @param page pointer to a page object
* @param anim_time animation time in milliseconds
*/
void lv_page_set_anim_time(lv_obj_t * page, uint16_t anim_time)
{
LV_ASSERT_OBJ(page, LV_OBJX_NAME);
#if LV_USE_ANIMATION
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
ext->anim_time = anim_time;
#else
(void)page; /*Unused*/
(void)anim_time; /*Unused*/
#endif
}
/**
* Enable the scroll propagation feature. If enabled then the page will move its parent if there is
* no more space to scroll.
* The page needs to have a page-like parent (e.g. `lv_page`, `lv_tabview` tab, `lv_win` content area etc)
* If enabled drag direction will be changed `LV_DRAG_DIR_ONE` automatically to allow scrolling only in one direction at one time.
* @param page pointer to a Page
* @param en true or false to enable/disable scroll propagation
*/
void lv_page_set_scroll_propagation(lv_obj_t * page, bool en)
{
LV_ASSERT_OBJ(page, LV_OBJX_NAME);
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
if(en) lv_obj_set_drag_dir(ext->scrl, LV_DRAG_DIR_ONE);
else lv_obj_set_drag_dir(ext->scrl, LV_DRAG_DIR_BOTH);
ext->scroll_prop = en ? 1 : 0;
}
/**
* Enable the edge flash effect. (Show an arc when the an edge is reached)
* @param page pointer to a Page
* @param en true or false to enable/disable end flash
*/
void lv_page_set_edge_flash(lv_obj_t * page, bool en)
{
LV_ASSERT_OBJ(page, LV_OBJX_NAME);
#if LV_USE_ANIMATION
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
ext->edge_flash.enabled = en ? 1 : 0;
#else
(void)page;
(void)en;
#endif
}
/*=====================
* Getter functions
*====================*/
/**
* Get the scrollable object of a page
* @param page pointer to a page object
* @return pointer to a container which is the scrollable part of the page
*/
lv_obj_t * lv_page_get_scrollable(const lv_obj_t * page)
{
LV_ASSERT_OBJ(page, LV_OBJX_NAME);
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
return ext->scrl;
}
/**
* Get the animation time
* @param page pointer to a page object
* @return the animation time in milliseconds
*/
uint16_t lv_page_get_anim_time(const lv_obj_t * page)
{
LV_ASSERT_OBJ(page, LV_OBJX_NAME);
#if LV_USE_ANIMATION
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
return ext->anim_time;
#else
(void)page; /*Unused*/
return 0;
#endif
}
/**
* Set the scroll bar mode on a page
* @param page pointer to a page object
* @return the mode from 'lv_page_sb.mode_t' enum
*/
lv_scrollbar_mode_t lv_page_get_scrollbar_mode(const lv_obj_t * page)
{
LV_ASSERT_OBJ(page, LV_OBJX_NAME);
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
return ext->scrlbar.mode;
}
/**
* Get the scroll propagation property
* @param page pointer to a Page
* @return true or false
*/
bool lv_page_get_scroll_propagation(lv_obj_t * page)
{
LV_ASSERT_OBJ(page, LV_OBJX_NAME);
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
return ext->scroll_prop ? true : false;
}
/**
* Get the edge flash effect property.
* @param page pointer to a Page
* return true or false
*/
bool lv_page_get_edge_flash(lv_obj_t * page)
{
LV_ASSERT_OBJ(page, LV_OBJX_NAME);
#if LV_USE_ANIMATION
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
return ext->edge_flash.enabled == 0 ? false : true;
#else
(void)page;
return false;
#endif
}
/**
* Get that width which can be set to the children to still not cause overflow (show scrollbars)
* @param page pointer to a page object
* @return the width which still fits into the page
*/
lv_coord_t lv_page_get_width_fit(lv_obj_t * page)
{
LV_ASSERT_OBJ(page, LV_OBJX_NAME);
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
lv_style_int_t bg_left = lv_obj_get_style_pad_left(page, LV_PAGE_PART_BG);
lv_style_int_t bg_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_BG);
lv_style_int_t scrl_left = lv_obj_get_style_pad_left(ext->scrl, LV_CONT_PART_MAIN);
lv_style_int_t scrl_right = lv_obj_get_style_pad_right(ext->scrl, LV_CONT_PART_MAIN);
return lv_obj_get_width(page) - bg_left - bg_right - scrl_left - scrl_right;
}
/**
* Get that height which can be set to the children to still not cause overflow (show scrollbars)
* @param page pointer to a page object
* @return the height which still fits into the page
*/
lv_coord_t lv_page_get_height_fit(lv_obj_t * page)
{
LV_ASSERT_OBJ(page, LV_OBJX_NAME);
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
lv_style_int_t bg_top = lv_obj_get_style_pad_top(page, LV_PAGE_PART_BG);
lv_style_int_t bg_bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_BG);
lv_style_int_t scrl_top = lv_obj_get_style_pad_top(ext->scrl, LV_CONT_PART_MAIN);
lv_style_int_t scrl_bottom = lv_obj_get_style_pad_bottom(ext->scrl, LV_CONT_PART_MAIN);
return lv_obj_get_height(page) - bg_top - bg_bottom - scrl_top - scrl_bottom;
}
/**
* Divide the width of the object and get the width of a given number of columns.
* Take into account the paddings of the background and scrollable too.
* @param page pointer to an object
* @param div indicates how many columns are assumed.
* If 1 the width will be set the the parent's width
* If 2 only half parent width - inner padding of the parent
* If 3 only third parent width - 2 * inner padding of the parent
* @param span how many columns are combined
* @return the width according to the given parameters
*/
lv_coord_t lv_page_get_width_grid(lv_obj_t * page, uint8_t div, uint8_t span)
{
lv_coord_t obj_w = lv_page_get_width_fit(page);
lv_style_int_t pinner = lv_obj_get_style_pad_inner(page, LV_PAGE_PART_SCROLLABLE);
lv_coord_t r = (obj_w - (div - 1) * pinner) / div;
r = r * span + (span - 1) * pinner;
return r;
}
/**
* Divide the height of the object and get the height of a given number of rows.
* Take into account the paddings of the background and scrollable too.
* @param obj pointer to an object
* @param div indicates how many rows are assumed.
* If 1 the height will be set the the parent's height
* If 2 only half parent height - inner padding of the parent
* If 3 only third parent height - 2 * inner padding of the parent
* @param span how many rows are combined
* @return the height according to the given parameters
*/
lv_coord_t lv_page_get_height_grid(lv_obj_t * page, uint8_t div, uint8_t span)
{
lv_coord_t obj_h = lv_page_get_height_fit(page);
lv_style_int_t pinner = lv_obj_get_style_pad_inner(page, LV_PAGE_PART_SCROLLABLE);
lv_coord_t r = (obj_h - (div - 1) * pinner) / div;
r = r * span + (span - 1) * pinner;
return r;
}
/*=====================
* Other functions
*====================*/
/**
* Find whether the page has been scrolled to a certain edge.
* @param page Page object
* @param edge Edge to check
* @return true if the page is on the specified edge
*/
bool lv_page_on_edge(lv_obj_t * page, lv_page_edge_t edge)
{
lv_obj_t * scrl = lv_page_get_scrollable(page);
lv_area_t page_coords;
lv_area_t scrl_coords;
lv_obj_get_coords(scrl, &scrl_coords);
lv_obj_get_coords(page, &page_coords);
lv_style_int_t left = lv_obj_get_style_pad_left(page, LV_PAGE_PART_BG);
lv_style_int_t right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_BG);
lv_style_int_t top = lv_obj_get_style_pad_top(page, LV_PAGE_PART_BG);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_BG);
if((edge & LV_PAGE_EDGE_TOP) && scrl_coords.y1 == page_coords.y1 + top) return true;
if((edge & LV_PAGE_EDGE_BOTTOM) && scrl_coords.y2 == page_coords.y2 - bottom) return true;
if((edge & LV_PAGE_EDGE_LEFT) && scrl_coords.x1 == page_coords.x1 + left) return true;
if((edge & LV_PAGE_EDGE_RIGHT) && scrl_coords.x2 == page_coords.x2 - right) return true;
return false;
}
/**
* Glue the object to the page. After it the page can be moved (dragged) with this object too.
* @param obj pointer to an object on a page
* @param glue true: enable glue, false: disable glue
*/
void lv_page_glue_obj(lv_obj_t * obj, bool glue)
{
lv_obj_set_drag_parent(obj, glue);
lv_obj_set_drag(obj, glue);
}
/**
* Focus on an object. It ensures that the object will be visible on the page.
* @param page pointer to a page object
* @param obj pointer to an object to focus (must be on the page)
* @param anim_en LV_ANIM_ON to focus with animation; LV_ANIM_OFF to focus without animation
*/
void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, lv_anim_enable_t anim_en)
{
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
#if LV_USE_ANIMATION
/* Be sure there is no position changing animation in progress
* because it can override the current changes*/
lv_anim_del(page, (lv_anim_exec_xcb_t)lv_obj_set_x);
lv_anim_del(page, (lv_anim_exec_xcb_t)lv_obj_set_y);
lv_anim_del(ext->scrl, (lv_anim_exec_xcb_t)lv_obj_set_x);
lv_anim_del(ext->scrl, (lv_anim_exec_xcb_t)lv_obj_set_y);
#endif
/*if using focus mode, change target to parent*/
obj = lv_obj_get_focused_obj(obj);
/*If obj is higher then the page focus where the "error" is smaller*/
lv_coord_t obj_y = obj->coords.y1 - ext->scrl->coords.y1;
lv_coord_t obj_h = lv_obj_get_height(obj);
lv_coord_t scrlable_y = lv_obj_get_y(ext->scrl);
lv_coord_t page_h = lv_obj_get_height(page);
lv_style_int_t bg_top = lv_obj_get_style_pad_top(page, LV_PAGE_PART_BG);
lv_style_int_t bg_bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_BG);
lv_style_int_t scrl_top = lv_obj_get_style_pad_top(ext->scrl, LV_CONT_PART_MAIN);
lv_style_int_t scrl_bottom = lv_obj_get_style_pad_bottom(ext->scrl, LV_CONT_PART_MAIN);
lv_coord_t top_err = -((scrlable_y + obj_y) - bg_top);
lv_coord_t bot_err = scrlable_y + obj_y + obj_h - (page_h - bg_bottom);
/*Out of the page on the top*/
if((obj_h <= page_h && top_err > 0) || (obj_h > page_h && top_err < bot_err)) {
/*Calculate a new position and let some space above*/
scrlable_y = -(obj_y - scrl_top - bg_top);
scrlable_y += scrl_top;
}
/*Out of the page on the bottom*/
else if((obj_h <= page_h && bot_err > 0) || (obj_h > page_h && top_err >= bot_err)) {
/*Calculate a new position and let some space below*/
scrlable_y = -(obj_y + scrl_bottom + bg_bottom);
scrlable_y -= scrl_bottom;
scrlable_y += page_h - obj_h;
}
/*If obj is wider then the page focus where the "error" is smaller*/
lv_coord_t obj_x = obj->coords.x1 - ext->scrl->coords.x1;
lv_coord_t obj_w = lv_obj_get_width(obj);
lv_coord_t scrlable_x = lv_obj_get_x(ext->scrl);
lv_coord_t page_w = lv_obj_get_width(page);
lv_style_int_t bg_left = lv_obj_get_style_pad_left(page, LV_PAGE_PART_BG);
lv_style_int_t bg_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_BG);
lv_style_int_t scrl_left = lv_obj_get_style_pad_top(ext->scrl, LV_CONT_PART_MAIN);
lv_style_int_t scrl_right = lv_obj_get_style_pad_bottom(ext->scrl, LV_CONT_PART_MAIN);
lv_coord_t left_err = -((scrlable_x + obj_x) - bg_left);
lv_coord_t right_err = scrlable_x + obj_x + obj_w - (page_w - bg_right);
/*Out of the page on the left*/
if((obj_w <= page_w && left_err > 0) || (obj_w > page_w && left_err < right_err)) {
/*Calculate a new position and let some space on the side*/
scrlable_x = -(obj_x - scrl_left - bg_left);
scrlable_x += scrl_left;
}
/*Out of the page on the rigth*/
else if((obj_w <= page_w && right_err > 0) || (obj_w > page_w && left_err >= right_err)) {
/*Calculate a new position and let some space on the side*/
scrlable_x = -(obj_x + scrl_right + bg_right);
scrlable_x -= scrl_right;
scrlable_x += page_w - obj_w;
}
if(anim_en == LV_ANIM_OFF || lv_page_get_anim_time(page) == 0) {
lv_obj_set_y(ext->scrl, scrlable_y);
lv_obj_set_x(ext->scrl, scrlable_x);
}
else {
#if LV_USE_ANIMATION
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, ext->scrl);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_y);
lv_anim_set_values(&a, lv_obj_get_y(ext->scrl), scrlable_y);
lv_anim_set_time(&a, lv_page_get_anim_time(page));
lv_anim_start(&a);
lv_anim_set_values(&a, lv_obj_get_x(ext->scrl), scrlable_x);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_x);
lv_anim_start(&a);
#endif
}
}
/**
* Scroll the page horizontally
* @param page pointer to a page object
* @param dist the distance to scroll (< 0: scroll right; > 0 scroll left)
*/
void lv_page_scroll_hor(lv_obj_t * page, lv_coord_t dist)
{
lv_obj_t * scrl = lv_page_get_scrollable(page);
#if LV_USE_ANIMATION
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, scrl);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_x);
lv_anim_set_values(&a, lv_obj_get_x(scrl), lv_obj_get_x(scrl) + dist);
lv_anim_set_time(&a, lv_page_get_anim_time(page));
lv_anim_start(&a);
#else
lv_obj_set_x(scrl, lv_obj_get_x(scrl) + dist);
#endif
}
/**
* Scroll the page vertically
* @param page pointer to a page object
* @param dist the distance to scroll (< 0: scroll down; > 0 scroll up)
*/
void lv_page_scroll_ver(lv_obj_t * page, lv_coord_t dist)
{
lv_obj_t * scrl = lv_page_get_scrollable(page);
#if LV_USE_ANIMATION
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, scrl);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_y);
lv_anim_set_values(&a, lv_obj_get_y(scrl), lv_obj_get_y(scrl) + dist);
lv_anim_set_time(&a, lv_page_get_anim_time(page));
lv_anim_start(&a);
#else
lv_obj_set_y(scrl, lv_obj_get_y(scrl) + dist);
#endif
}
/**
* Not intended to use directly by the user but by other object types internally.
* Start an edge flash animation.
* @param page
* @param edge the edge to flash. Can be `LV_PAGE_EDGE_LEFT/RIGHT/TOP/BOTTOM`
*/
void lv_page_start_edge_flash(lv_obj_t * page, lv_page_edge_t edge)
{
#if LV_USE_ANIMATION
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
if(ext->edge_flash.enabled == 0) return;
if(ext->edge_flash.left_ip ||
ext->edge_flash.right_ip ||
ext->edge_flash.top_ip ||
ext->edge_flash.bottom_ip) {
return;
}
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, page);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)edge_flash_anim);
lv_anim_set_values(&a, 0, LV_PAGE_END_FLASH_SIZE);
lv_anim_set_time(&a, lv_page_get_anim_time(page));
lv_anim_set_playback_time(&a, lv_page_get_anim_time(page));
lv_anim_set_playback_delay(&a, LV_PAGE_END_ANIM_WAIT_TIME);
lv_anim_set_ready_cb(&a, edge_flash_anim_end);
lv_anim_start(&a);
switch(edge) {
case LV_PAGE_EDGE_BOTTOM:
ext->edge_flash.bottom_ip = 1;
break;
case LV_PAGE_EDGE_TOP:
ext->edge_flash.top_ip = 1;
break;
case LV_PAGE_EDGE_LEFT:
ext->edge_flash.left_ip = 1;
break;
case LV_PAGE_EDGE_RIGHT:
ext->edge_flash.right_ip = 1;
break;
}
#else
LV_UNUSED(page);
LV_UNUSED(edge);
#endif
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the pages
* @param page pointer to an object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_page_design(lv_obj_t * page, const lv_area_t * clip_area, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
return ancestor_design(page, clip_area, mode);
}
if(mode == LV_DESIGN_DRAW_MAIN) {
return ancestor_design(page, clip_area, mode);
}
else if(mode == LV_DESIGN_DRAW_POST) {
ancestor_design(page, clip_area, mode);
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
lv_area_t sb_hor_area;
lv_area_t sb_ver_area;
/*Convert the relative coordinates to absolute*/
lv_area_copy(&sb_hor_area, &ext->scrlbar.hor_area);
sb_hor_area.x1 += page->coords.x1;
sb_hor_area.y1 += page->coords.y1;
sb_hor_area.x2 += page->coords.x1;
sb_hor_area.y2 += page->coords.y1;
/*Convert the relative coordinates to absolute*/
lv_area_copy(&sb_ver_area, &ext->scrlbar.ver_area);
sb_ver_area.x1 += page->coords.x1;
sb_ver_area.y1 += page->coords.y1;
sb_ver_area.x2 += page->coords.x1;
sb_ver_area.y2 += page->coords.y1;
if((ext->scrlbar.hor_draw && _lv_area_is_on(&sb_hor_area, clip_area)) ||
(ext->scrlbar.ver_draw && _lv_area_is_on(&sb_ver_area, clip_area))) {
/*Draw the scrollbars*/
lv_draw_rect_dsc_t rect_dsc;
lv_draw_rect_dsc_init(&rect_dsc);
lv_obj_init_draw_rect_dsc(page, LV_PAGE_PART_SCROLLBAR, &rect_dsc);
if(ext->scrlbar.hor_draw && (ext->scrlbar.mode & LV_SCROLLBAR_MODE_HIDE) == 0) {
lv_draw_rect(&sb_hor_area, clip_area, &rect_dsc);
}
if(ext->scrlbar.ver_draw && (ext->scrlbar.mode & LV_SCROLLBAR_MODE_HIDE) == 0) {
lv_draw_rect(&sb_ver_area, clip_area, &rect_dsc);
}
}
#if LV_USE_ANIMATION
{
if(ext->edge_flash.left_ip || ext->edge_flash.right_ip || ext->edge_flash.top_ip ||
ext->edge_flash.bottom_ip) {
lv_area_t flash_area;
get_edge_flash_area(page, &flash_area, ext->edge_flash.state);
lv_draw_rect_dsc_t edge_draw_dsc;
lv_draw_rect_dsc_init(&edge_draw_dsc);
lv_obj_init_draw_rect_dsc(page, LV_PAGE_PART_EDGE_FLASH, &edge_draw_dsc);
edge_draw_dsc.radius = LV_RADIUS_CIRCLE;
uint32_t opa = (edge_draw_dsc.bg_opa * ext->edge_flash.state) / LV_PAGE_END_FLASH_SIZE;
edge_draw_dsc.bg_opa = opa;
lv_draw_rect(&flash_area, clip_area, &edge_draw_dsc);
}
}
#endif
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the page
* @param page pointer to a page object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_page_signal(lv_obj_t * page, lv_signal_t sign, void * param)
{
lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_page_get_style(page, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(page, sign, param);
}
else if(sign == LV_SIGNAL_GET_STATE_DSC) {
lv_get_state_info_t * info = param;
if(info->part == LV_PAGE_PART_SCROLLABLE) info->result = lv_obj_get_state(lv_page_get_scrollable(page),
LV_CONT_PART_MAIN);
else info->result = lv_obj_get_state(page, info->part);
return LV_RES_OK;
}
/* Include the ancient signal function */
res = ancestor_signal(page, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
if(sign == LV_SIGNAL_CLEANUP) {
/*Check whether the object being deleted is propagating scroll to the parent */
if(ext->scroll_prop) {
lv_obj_t * parent_page = lv_obj_get_parent(lv_obj_get_parent(page));
lv_page_ext_t * parent_ext = lv_obj_get_ext_attr(parent_page);
if(parent_ext->scroll_prop_obj == page) {
parent_ext->scroll_prop_obj = NULL;
}
}
lv_obj_clean_style_list(page, LV_PAGE_PART_SCROLLBAR);
#if LV_USE_ANIMATION
lv_obj_clean_style_list(page, LV_PAGE_PART_EDGE_FLASH);
#endif
}
/*Automatically move children to the scrollable object*/
else if(sign == LV_SIGNAL_CHILD_CHG) {
lv_obj_t * child;
if(ext->scrl == NULL) return LV_RES_OK;
lv_fit_t fit_left = lv_page_get_scrl_fit_left(page);
lv_fit_t fit_right = lv_page_get_scrl_fit_right(page);
lv_fit_t fit_top = lv_page_get_scrl_fit_top(page);
lv_bidi_dir_t base_dir = lv_obj_get_base_dir(page);
lv_style_int_t scrl_left = lv_obj_get_style_pad_left(ext->scrl, LV_CONT_PART_MAIN);
lv_style_int_t scrl_right = lv_obj_get_style_pad_right(ext->scrl, LV_CONT_PART_MAIN);
lv_style_int_t scrl_top = lv_obj_get_style_pad_top(ext->scrl, LV_CONT_PART_MAIN);
child = lv_obj_get_child(page, NULL);
while(child != NULL) {
if(lv_obj_is_protected(child, LV_PROTECT_PARENT) == false) {
lv_obj_t * tmp = child;
child = lv_obj_get_child(page, child); /*Get the next child before move this*/
/* Reposition the child to take padding into account
* It's required to keep new the object on the same coordinate if FIT is enabled.*/
if((tmp->coords.x1 == page->coords.x1) &&
(fit_left == LV_FIT_TIGHT || fit_left == LV_FIT_MAX) &&
base_dir != LV_BIDI_DIR_RTL) {
tmp->coords.x1 += scrl_left;
tmp->coords.x2 += scrl_left;
}
else if((tmp->coords.x2 == page->coords.x2) &&
(fit_right == LV_FIT_TIGHT || fit_right == LV_FIT_MAX)
&& base_dir == LV_BIDI_DIR_RTL) {
tmp->coords.x1 -= scrl_right;
tmp->coords.x2 -= scrl_right;
}
if((tmp->coords.y1 == page->coords.y1) && (fit_top == LV_FIT_TIGHT || fit_top == LV_FIT_MAX)) {
tmp->coords.y1 += scrl_top;
tmp->coords.y2 += scrl_top;
}
lv_obj_set_parent(tmp, ext->scrl);
}
else {
child = lv_obj_get_child(page, child);
}
}
}
else if(sign == LV_SIGNAL_STYLE_CHG) {
lv_style_int_t sb_width = lv_obj_get_style_size(page, LV_PAGE_PART_SCROLLBAR);
lv_area_set_height(&ext->scrlbar.hor_area, sb_width);
lv_area_set_width(&ext->scrlbar.ver_area, sb_width);
/*The scrollbars are important only if they are visible now*/
if(ext->scrlbar.hor_draw || ext->scrlbar.ver_draw) scrlbar_refresh(page);
/*Refresh the ext. size because the scrollbars might be positioned out of the page*/
refr_ext_draw_pad(page);
}
else if(sign == LV_SIGNAL_COORD_CHG) {
/*Refresh the scrollbar and notify the scrl if the size is changed*/
if(ext->scrl != NULL && (lv_obj_get_width(page) != lv_area_get_width(param) ||
lv_obj_get_height(page) != lv_area_get_height(param))) {
ext->scrl->signal_cb(ext->scrl, LV_SIGNAL_COORD_CHG, &ext->scrl->coords);
/*The scrollbars are important only if they are visible now*/
if(ext->scrlbar.hor_draw || ext->scrlbar.ver_draw) scrlbar_refresh(page);
}
}
else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
refr_ext_draw_pad(page);
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
uint32_t c = *((uint32_t *)param);
if(c == LV_KEY_DOWN) {
lv_page_scroll_ver(page, -lv_obj_get_height(page) / 4);
}
else if(c == LV_KEY_UP) {
lv_page_scroll_ver(page, lv_obj_get_height(page) / 4);
}
else if(c == LV_KEY_RIGHT) {
/*If the page can't be scrolled horizontally because it's not wide enough then scroll it
* vertically*/
if(lv_page_get_scrl_width(page) <= lv_obj_get_width(page))
lv_page_scroll_ver(page, -lv_obj_get_height(page) / 4);
else
lv_page_scroll_hor(page, -lv_obj_get_width(page) / 4);
}
else if(c == LV_KEY_LEFT) {
/*If the page can't be scrolled horizontally because it's not wide enough then scroll it
* vertically*/
if(lv_page_get_scrl_width(page) <= lv_obj_get_width(page))
lv_page_scroll_ver(page, lv_obj_get_height(page) / 4);
else
lv_page_scroll_hor(page, lv_obj_get_width(page) / 4);
}
#endif
}
else if(sign == LV_SIGNAL_GET_EDITABLE) {
#if LV_USE_GROUP
bool * editable = (bool *)param;
*editable = true;
#endif
}
return res;
}
/**
* Signal function of the scrollable part of a page
* @param scrl pointer to the scrollable object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_page_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
{
if(sign == LV_SIGNAL_GET_STYLE) {
return ancestor_signal(scrl, sign, param);
}
lv_res_t res;
/* Include the ancient signal function */
res = ancestor_signal(scrl, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, "");
lv_obj_t * page = lv_obj_get_parent(scrl);
lv_page_ext_t * page_ext = lv_obj_get_ext_attr(page);
if(sign == LV_SIGNAL_COORD_CHG) {
lv_obj_t * page_parent = lv_obj_get_parent(page);
/*Handle scroll propagation*/
lv_indev_t * indev = lv_indev_get_act();
if(page_ext->scroll_prop && indev) {
lv_point_t * drag_sum = &indev->proc.types.pointer.drag_sum;
lv_page_ext_t * parent_ext = lv_obj_get_ext_attr(lv_obj_get_parent(page_parent));
if(parent_ext->scroll_prop_obj == NULL) {
/*If the dragging just started or scroll is already propagated to this object
* enable the scroll propagation if the conditions are met*/
if((lv_indev_is_dragging(indev) == false || page_ext->scroll_prop_obj) && (drag_sum->y || drag_sum->x)) {
/*Propagate vertically?*/
if((drag_sum->y > 0 && lv_page_on_edge(page, LV_PAGE_EDGE_TOP)) ||
(drag_sum->y < 0 && lv_page_on_edge(page, LV_PAGE_EDGE_BOTTOM))) {
lv_obj_set_drag_parent(page, true);
lv_obj_set_drag_parent(scrl, true);
parent_ext->scroll_prop_obj = page;
}
/*Propagate horizontally?*/
if((drag_sum->x > 0 && lv_page_on_edge(page, LV_PAGE_EDGE_LEFT)) ||
(drag_sum->x < 0 && lv_page_on_edge(page, LV_PAGE_EDGE_RIGHT))) {
lv_obj_set_drag_parent(page, true);
lv_obj_set_drag_parent(scrl, true);
parent_ext->scroll_prop_obj = page;
}
}
}
}
scrl_reposition(page);
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
/*The scrollbars are important only if they are visible now or the scrollable's size has changed*/
if((ext->scrlbar.hor_draw || ext->scrlbar.ver_draw) ||
(lv_obj_get_width(scrl) != lv_area_get_width(param) || lv_obj_get_height(scrl) != lv_area_get_height(param))) {
scrlbar_refresh(page);
}
}
else if(sign == LV_SIGNAL_STYLE_CHG) {
scrl_reposition(page);
scrlbar_refresh(page);
}
else if(sign == LV_SIGNAL_DRAG_BEGIN) {
if(page_ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) {
scrlbar_refresh(page);
}
}
else if(sign == LV_SIGNAL_DRAG_END) {
/*Scroll propagation is finished on drag end*/
if(page_ext->scroll_prop_obj) {
lv_obj_t * scroller_page = page_ext->scroll_prop_obj;
lv_page_ext_t * scroller_page_ext = lv_obj_get_ext_attr(scroller_page);
page_ext->scroll_prop_obj = NULL;
lv_obj_set_drag_parent(scroller_page, false);
lv_obj_set_drag_parent(lv_page_get_scrollable(scroller_page), false);
/*Hide scrollbars if required*/
if(scroller_page_ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) {
lv_area_t sb_area_tmp;
if(scroller_page_ext->scrlbar.hor_draw) {
lv_area_copy(&sb_area_tmp, &scroller_page_ext->scrlbar.hor_area);
sb_area_tmp.x1 += scroller_page->coords.x1;
sb_area_tmp.y1 += scroller_page->coords.y1;
sb_area_tmp.x2 += scroller_page->coords.x1;
sb_area_tmp.y2 += scroller_page->coords.y1;
lv_obj_invalidate_area(scroller_page, &sb_area_tmp);
scroller_page_ext->scrlbar.hor_draw = 0;
}
if(scroller_page_ext->scrlbar.ver_draw) {
lv_area_copy(&sb_area_tmp, &scroller_page_ext->scrlbar.ver_area);
sb_area_tmp.x1 += scroller_page->coords.x1;
sb_area_tmp.y1 += scroller_page->coords.y1;
sb_area_tmp.x2 += scroller_page->coords.x1;
sb_area_tmp.y2 += scroller_page->coords.y1;
lv_obj_invalidate_area(scroller_page, &sb_area_tmp);
scroller_page_ext->scrlbar.ver_draw = 0;
}
}
/*The scrolling can be chained so stop all of them*/
lv_page_ext_t * scroller_ext = lv_obj_get_ext_attr(scroller_page);
while(scroller_ext->scroll_prop_obj) {
scroller_page = scroller_ext->scroll_prop_obj;
scroller_ext->scroll_prop_obj = NULL;
lv_obj_set_drag_parent(scroller_page, false);
lv_obj_set_drag_parent(lv_page_get_scrollable(scroller_page), false);
/*Hide scrollbars if required*/
if(scroller_page_ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) {
scroller_page_ext->scrlbar.hor_draw = 0;
scroller_page_ext->scrlbar.ver_draw = 0;
lv_obj_invalidate(scroller_page);
}
scroller_ext = lv_obj_get_ext_attr(scroller_page);
}
}
/*Hide scrollbars if required*/
if(page_ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) {
lv_area_t sb_area_tmp;
if(page_ext->scrlbar.hor_draw) {
lv_area_copy(&sb_area_tmp, &page_ext->scrlbar.hor_area);
sb_area_tmp.x1 += page->coords.x1;
sb_area_tmp.y1 += page->coords.y1;
sb_area_tmp.x2 += page->coords.x1;
sb_area_tmp.y2 += page->coords.y1;
lv_obj_invalidate_area(page, &sb_area_tmp);
page_ext->scrlbar.hor_draw = 0;
}
if(page_ext->scrlbar.ver_draw) {
lv_area_copy(&sb_area_tmp, &page_ext->scrlbar.ver_area);
sb_area_tmp.x1 += page->coords.x1;
sb_area_tmp.y1 += page->coords.y1;
sb_area_tmp.x2 += page->coords.x1;
sb_area_tmp.y2 += page->coords.y1;
lv_obj_invalidate_area(page, &sb_area_tmp);
page_ext->scrlbar.ver_draw = 0;
}
}
}
else if(sign == LV_SIGNAL_FOCUS) {
#if LV_USE_GROUP
if(lv_obj_get_group(page)) {
lv_group_focus_obj(page);
}
else
#endif
{
res = lv_signal_send(page, LV_SIGNAL_FOCUS, NULL);
if(res != LV_RES_OK) return res;
res = lv_event_send(page, LV_EVENT_FOCUSED, NULL);
if(res != LV_RES_OK) return res;
}
}
else if(sign == LV_SIGNAL_DEFOCUS) {
bool in_group = false;
#if LV_USE_GROUP
in_group = lv_obj_get_group(page) ? true : false;
#endif
if(in_group == false) {
res = lv_signal_send(page, LV_SIGNAL_DEFOCUS, NULL);
if(res != LV_RES_OK) return res;
res = lv_event_send(page, LV_EVENT_DEFOCUSED, NULL);
if(res != LV_RES_OK) return res;
}
}
else if(sign == LV_SIGNAL_CLEANUP) {
page_ext->scrl = NULL;
}
return res;
}
/**
* Propagate the input device related event of the scrollable to the parent page background
* It is used by default if the scrollable's event is not specified
* @param scrl pointer to the page's scrollable object
* @param event type of the event
* @param data data of the event
*/
static void scrl_def_event_cb(lv_obj_t * scrl, lv_event_t event)
{
lv_obj_t * page = lv_obj_get_parent(scrl);
/*clang-format off*/
if(event == LV_EVENT_PRESSED || event == LV_EVENT_PRESSING || event == LV_EVENT_PRESS_LOST ||
event == LV_EVENT_RELEASED || event == LV_EVENT_SHORT_CLICKED || event == LV_EVENT_CLICKED ||
event == LV_EVENT_LONG_PRESSED || event == LV_EVENT_LONG_PRESSED_REPEAT ||
event == LV_EVENT_DRAG_BEGIN || event == LV_EVENT_DRAG_END || event == LV_EVENT_DRAG_THROW_BEGIN) {
lv_event_send(page, event, lv_event_get_data());
}
/*clang-format on*/
}
/**
* Get the style descriptor of a part of the object
* @param page pointer the object
* @param part the part of the page. (LV_PAGE_PART_...)
* @return pointer to the style descriptor of the specified part
*/
static lv_style_list_t * lv_page_get_style(lv_obj_t * page, uint8_t part)
{
LV_ASSERT_OBJ(page, LV_OBJX_NAME);
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
lv_style_list_t * style_dsc_p;
switch(part) {
case LV_PAGE_PART_BG:
style_dsc_p = &page->style_list;
break;
case LV_PAGE_PART_SCROLLABLE:
style_dsc_p = lv_obj_get_style_list(ext->scrl, LV_CONT_PART_MAIN);
break;
case LV_PAGE_PART_SCROLLBAR:
style_dsc_p = &ext->scrlbar.style;
break;
#if LV_USE_ANIMATION
case LV_PAGE_PART_EDGE_FLASH:
style_dsc_p = &ext->edge_flash.style;
break;
#endif
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
static void scrl_reposition(lv_obj_t * page)
{
/*Limit the position of the scrollable object to be always visible
* (Do not let its edge inner then its parent respective edge)*/
lv_obj_t * scrl = lv_page_get_scrollable(page);
lv_coord_t new_x = lv_obj_get_x(scrl);
lv_coord_t new_y = lv_obj_get_y(scrl);
bool refr_x = false;
bool refr_y = false;
lv_area_t page_coords;
lv_area_t scrl_coords;
lv_obj_get_coords(scrl, &scrl_coords);
lv_obj_get_coords(page, &page_coords);
lv_style_int_t left = lv_obj_get_style_pad_left(page, LV_PAGE_PART_BG);
lv_style_int_t right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_BG);
lv_style_int_t top = lv_obj_get_style_pad_top(page, LV_PAGE_PART_BG);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_BG);
/*scrollable width smaller then page width? -> align to left*/
if(lv_area_get_width(&scrl_coords) + left + right <= lv_area_get_width(&page_coords)) {
if(scrl_coords.x1 != page_coords.x1 + left) {
new_x = left;
refr_x = true;
}
}
else {
/*The edges of the scrollable can not be in the page (minus hpad) */
if(scrl_coords.x2 < page_coords.x2 - right) {
new_x = lv_area_get_width(&page_coords) - lv_area_get_width(&scrl_coords) - right; /* Right align */
refr_x = true;
lv_page_start_edge_flash(page, LV_PAGE_EDGE_RIGHT);
}
else if(scrl_coords.x1 > page_coords.x1 + left) {
new_x = left; /*Left align*/
refr_x = true;
lv_page_start_edge_flash(page, LV_PAGE_EDGE_LEFT);
}
}
/*scrollable height smaller then page height? -> align to top*/
if(lv_area_get_height(&scrl_coords) + top + bottom <= lv_area_get_height(&page_coords)) {
if(scrl_coords.y1 != page_coords.y1 + top) {
new_y = top;
refr_y = true;
}
}
else {
/*The edges of the scrollable can not be in the page (minus vpad) */
if(scrl_coords.y2 < page_coords.y2 - bottom) {
new_y = lv_area_get_height(&page_coords) - lv_area_get_height(&scrl_coords) - bottom; /* Bottom align */
refr_y = true;
lv_page_start_edge_flash(page, LV_PAGE_EDGE_BOTTOM);
}
else if(scrl_coords.y1 > page_coords.y1 + top) {
new_y = top; /*Top align*/
refr_y = true;
lv_page_start_edge_flash(page, LV_PAGE_EDGE_TOP);
}
}
if(refr_x || refr_y) {
lv_obj_set_pos(scrl, new_x, new_y);
}
}
/**
* Refresh the position and size of the scroll bars.
* @param page pointer to a page object
*/
static void scrlbar_refresh(lv_obj_t * page)
{
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
lv_obj_t * scrl = ext->scrl;
lv_coord_t size_tmp;
lv_coord_t scrl_w = lv_obj_get_width(scrl);
lv_coord_t scrl_h = lv_obj_get_height(scrl);
lv_coord_t obj_w = lv_obj_get_width(page);
lv_coord_t obj_h = lv_obj_get_height(page);
lv_style_int_t sb_width = lv_obj_get_style_size(page, LV_PAGE_PART_SCROLLBAR);
lv_style_int_t sb_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_SCROLLBAR);
lv_style_int_t sb_bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_SCROLLBAR);
lv_style_int_t bg_left = lv_obj_get_style_pad_left(page, LV_PAGE_PART_BG);
lv_style_int_t bg_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_BG);
lv_style_int_t bg_top = lv_obj_get_style_pad_top(page, LV_PAGE_PART_BG);
lv_style_int_t bg_bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_BG);
/*Always let 'scrollbar width' padding above, under, left and right to the scrollbars
* else:
* - horizontal and vertical scrollbars can overlap on the corners
* - if the page has radius the scrollbar can be out of the radius */
lv_coord_t sb_hor_pad = LV_MATH_MAX(sb_width, sb_right);
lv_coord_t sb_ver_pad = LV_MATH_MAX(sb_width, sb_bottom);
if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_OFF) return;
if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_ON) {
ext->scrlbar.hor_draw = 1;
ext->scrlbar.ver_draw = 1;
}
/*Invalidate the current (old) scrollbar areas*/
lv_area_t sb_area_tmp;
if(ext->scrlbar.hor_draw != 0) {
lv_area_copy(&sb_area_tmp, &ext->scrlbar.hor_area);
sb_area_tmp.x1 += page->coords.x1;
sb_area_tmp.y1 += page->coords.y1;
sb_area_tmp.x2 += page->coords.x1;
sb_area_tmp.y2 += page->coords.y1;
lv_obj_invalidate_area(page, &sb_area_tmp);
}
if(ext->scrlbar.ver_draw != 0) {
lv_area_copy(&sb_area_tmp, &ext->scrlbar.ver_area);
sb_area_tmp.x1 += page->coords.x1;
sb_area_tmp.y1 += page->coords.y1;
sb_area_tmp.x2 += page->coords.x1;
sb_area_tmp.y2 += page->coords.y1;
lv_obj_invalidate_area(page, &sb_area_tmp);
}
/*Full sized horizontal scrollbar*/
if(scrl_w <= obj_w - bg_left - bg_right) {
lv_area_set_width(&ext->scrlbar.hor_area, obj_w - 2 * sb_hor_pad);
_lv_area_set_pos(&ext->scrlbar.hor_area, sb_hor_pad,
obj_h - sb_width - sb_bottom);
if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_AUTO ||
ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) ext->scrlbar.hor_draw = 0;
}
/*Smaller horizontal scrollbar*/
else {
size_tmp =
(obj_w * (obj_w - (2 * sb_hor_pad))) / (scrl_w + bg_left + bg_right);
if(size_tmp < LV_PAGE_SB_MIN_SIZE) size_tmp = LV_PAGE_SB_MIN_SIZE;
lv_area_set_width(&ext->scrlbar.hor_area, size_tmp);
_lv_area_set_pos(&ext->scrlbar.hor_area,
sb_hor_pad +
(-(lv_obj_get_x(scrl) - bg_left) * (obj_w - size_tmp - 2 * sb_hor_pad)) /
(scrl_w + bg_left + bg_right - obj_w),
obj_h - sb_width - sb_bottom);
if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_AUTO ||
ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) ext->scrlbar.hor_draw = 1;
}
/*Full sized vertical scroll bar*/
if(scrl_h <= obj_h - bg_top - bg_bottom) {
lv_area_set_height(&ext->scrlbar.ver_area, obj_h - 2 * sb_ver_pad);
_lv_area_set_pos(&ext->scrlbar.ver_area,
obj_w - sb_width - sb_right, sb_ver_pad);
if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_AUTO ||
ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) ext->scrlbar.ver_draw = 0;
}
/*Smaller vertical scroll bar*/
else {
size_tmp =
(obj_h * (obj_h - (2 * sb_ver_pad))) / (scrl_h + bg_top + bg_bottom);
if(size_tmp < LV_PAGE_SB_MIN_SIZE) size_tmp = LV_PAGE_SB_MIN_SIZE;
lv_area_set_height(&ext->scrlbar.ver_area, size_tmp);
_lv_area_set_pos(&ext->scrlbar.ver_area,
obj_w - sb_width - sb_right,
sb_ver_pad + (-(lv_obj_get_y(scrl) - bg_left) *
(obj_h - size_tmp - 2 * sb_ver_pad)) /
(scrl_h + bg_top + bg_bottom - obj_h));
if(ext->scrlbar.mode == LV_SCROLLBAR_MODE_AUTO ||
ext->scrlbar.mode == LV_SCROLLBAR_MODE_DRAG) ext->scrlbar.ver_draw = 1;
}
/*Invalidate the new scrollbar areas*/
if(ext->scrlbar.hor_draw != 0) {
lv_area_copy(&sb_area_tmp, &ext->scrlbar.hor_area);
sb_area_tmp.x1 += page->coords.x1;
sb_area_tmp.y1 += page->coords.y1;
sb_area_tmp.x2 += page->coords.x1;
sb_area_tmp.y2 += page->coords.y1;
lv_obj_invalidate_area(page, &sb_area_tmp);
}
if(ext->scrlbar.ver_draw != 0) {
lv_area_copy(&sb_area_tmp, &ext->scrlbar.ver_area);
sb_area_tmp.x1 += page->coords.x1;
sb_area_tmp.y1 += page->coords.y1;
sb_area_tmp.x2 += page->coords.x1;
sb_area_tmp.y2 += page->coords.y1;
lv_obj_invalidate_area(page, &sb_area_tmp);
}
}
static void refr_ext_draw_pad(lv_obj_t * page)
{
lv_style_int_t sb_bottom = lv_obj_get_style_pad_bottom(page, LV_PAGE_PART_SCROLLBAR);
lv_style_int_t sb_right = lv_obj_get_style_pad_right(page, LV_PAGE_PART_SCROLLBAR);
/*Ensure ext. size for the scrollbars if they are out of the page*/
if(page->ext_draw_pad < (-sb_right)) page->ext_draw_pad = -sb_right;
if(page->ext_draw_pad < (-sb_bottom)) page->ext_draw_pad = -sb_bottom;
}
#if LV_USE_ANIMATION
static void edge_flash_anim(void * page, lv_anim_value_t v)
{
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
ext->edge_flash.state = v;
lv_area_t flash_area;
get_edge_flash_area(page, &flash_area, LV_PAGE_END_FLASH_SIZE);
lv_obj_invalidate_area(page, &flash_area);
}
static void edge_flash_anim_end(lv_anim_t * a)
{
lv_area_t flash_area;
get_edge_flash_area(a->var, &flash_area, LV_PAGE_END_FLASH_SIZE);
lv_obj_invalidate_area(a->var, &flash_area);
lv_page_ext_t * ext = lv_obj_get_ext_attr(a->var);
ext->edge_flash.top_ip = 0;
ext->edge_flash.bottom_ip = 0;
ext->edge_flash.left_ip = 0;
ext->edge_flash.right_ip = 0;
}
static void get_edge_flash_area(lv_obj_t * page, lv_area_t * flash_area, lv_coord_t state)
{
lv_coord_t page_w = lv_obj_get_width(page);
lv_coord_t page_h = lv_obj_get_height(page);
lv_page_ext_t * ext = lv_obj_get_ext_attr(page);
if(ext->edge_flash.top_ip) {
flash_area->x1 = page->coords.x1 - page_w;
flash_area->x2 = page->coords.x2 + page_w;
flash_area->y1 = page->coords.y1 - 3 * page_w + state;
flash_area->y2 = page->coords.y1 + state;
}
else if(ext->edge_flash.bottom_ip) {
flash_area->x1 = page->coords.x1 - page_w;
flash_area->x2 = page->coords.x2 + page_w;
flash_area->y1 = page->coords.y2 - state;
flash_area->y2 = page->coords.y2 + 3 * page_w - state;
}
else if(ext->edge_flash.right_ip) {
flash_area->x1 = page->coords.x2 - state;
flash_area->x2 = page->coords.x2 + 3 * page_h - state;
flash_area->y1 = page->coords.y1 - page_h;
flash_area->y2 = page->coords.y2 + page_h;
}
else if(ext->edge_flash.left_ip) {
flash_area->x1 = page->coords.x1 - 3 * page_h + state;
flash_area->x2 = page->coords.x1 + state;
flash_area->y1 = page->coords.y1 - page_h;
flash_area->y2 = page->coords.y2 + page_h;
}
else {
lv_area_set(flash_area, 0, 0, -1, -1);
}
}
#endif
#endif
|
train_000.parquet/944
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_page.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 52029,
"token_count": 20686
}
|
/**
* @file lv_page.h
*
*/
#ifndef LV_PAGE_H
#define LV_PAGE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_PAGE != 0
/*Testing of dependencies*/
#if LV_USE_CONT == 0
#error "lv_page: lv_cont is required. Enable it in lv_conf.h (LV_USE_CONT 1) "
#endif
#include "lv_cont.h"
#include "../lv_core/lv_indev.h"
#include "../lv_misc/lv_anim.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Scrollbar modes: shows when should the scrollbars be visible*/
enum {
LV_SCROLLBAR_MODE_OFF = 0x0, /**< Never show scroll bars*/
LV_SCROLLBAR_MODE_ON = 0x1, /**< Always show scroll bars*/
LV_SCROLLBAR_MODE_DRAG = 0x2, /**< Show scroll bars when page is being dragged*/
LV_SCROLLBAR_MODE_AUTO = 0x3, /**< Show scroll bars when the scrollable container is large enough to be scrolled*/
LV_SCROLLBAR_MODE_HIDE = 0x4, /**< Hide the scroll bar temporally*/
LV_SCROLLBAR_MODE_UNHIDE = 0x5, /**< Unhide the previously hidden scroll bar. Recover original mode too*/
};
typedef uint8_t lv_scrollbar_mode_t;
/** Edges: describes the four edges of the page*/
enum { LV_PAGE_EDGE_LEFT = 0x1, LV_PAGE_EDGE_TOP = 0x2, LV_PAGE_EDGE_RIGHT = 0x4, LV_PAGE_EDGE_BOTTOM = 0x8 };
typedef uint8_t lv_page_edge_t;
/*Data of page*/
typedef struct {
lv_cont_ext_t bg; /*Ext. of ancestor*/
/*New data for this type */
lv_obj_t * scrl; /*The scrollable object on the background*/
struct {
lv_style_list_t style; /*Style of scrollbars*/
lv_area_t hor_area; /*Horizontal scrollbar area relative to the page. (Handled by the library) */
lv_area_t ver_area; /*Vertical scrollbar area relative to the page (Handled by the library)*/
uint8_t hor_draw : 1; /*1: horizontal scrollbar is visible now (Handled by the library)*/
uint8_t ver_draw : 1; /*1: vertical scrollbar is visible now (Handled by the library)*/
lv_scrollbar_mode_t mode : 3; /*Scrollbar visibility from 'lv_scrollbar_mode_t'*/
} scrlbar;
#if LV_USE_ANIMATION
struct {
lv_anim_value_t state; /*Store the current size of the edge flash effect*/
lv_style_list_t style; /*Style of edge flash effect (usually homogeneous circle)*/
uint8_t enabled : 1; /*1: Show a flash animation on the edge*/
uint8_t top_ip : 1; /*Used internally to show that top most position is reached (flash is In
Progress)*/
uint8_t bottom_ip : 1; /*Used internally to show that bottom most position is reached (flash
is In Progress)*/
uint8_t right_ip : 1; /*Used internally to show that right most position is reached (flash
is In Progress)*/
uint8_t left_ip : 1; /*Used internally to show that left most position is reached (flash is
In Progress)*/
} edge_flash;
uint16_t anim_time; /*Scroll animation time*/
#endif
lv_obj_t * scroll_prop_obj; /*Pointer to child page from where the scroll is being propagated */
uint8_t scroll_prop : 1; /*The direction of the scroll propagation*/
} lv_page_ext_t;
enum {
LV_PAGE_PART_BG = LV_CONT_PART_MAIN,
LV_PAGE_PART_SCROLLBAR = _LV_OBJ_PART_VIRTUAL_LAST,
LV_PAGE_PART_EDGE_FLASH,
_LV_PAGE_PART_VIRTUAL_LAST,
LV_PAGE_PART_SCROLLABLE = _LV_OBJ_PART_REAL_LAST,
_LV_PAGE_PART_REAL_LAST,
};
typedef uint8_t lv_part_style_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a page objects
* @param par pointer to an object, it will be the parent of the new page
* @param copy pointer to a page object, if not NULL then the new object will be copied from it
* @return pointer to the created page
*/
lv_obj_t * lv_page_create(lv_obj_t * par, const lv_obj_t * copy);
/**
* Delete all children of the scrl object, without deleting scrl child.
* @param page pointer to an object
*/
void lv_page_clean(lv_obj_t * page);
/**
* Get the scrollable object of a page
* @param page pointer to a page object
* @return pointer to a container which is the scrollable part of the page
*/
lv_obj_t * lv_page_get_scrollable(const lv_obj_t * page);
/**
* Get the animation time
* @param page pointer to a page object
* @return the animation time in milliseconds
*/
uint16_t lv_page_get_anim_time(const lv_obj_t * page);
/*=====================
* Setter functions
*====================*/
/**
* Set the scroll bar mode on a page
* @param page pointer to a page object
* @param sb_mode the new mode from 'lv_page_sb.mode_t' enum
*/
void lv_page_set_scrollbar_mode(lv_obj_t * page, lv_scrollbar_mode_t sb_mode);
/**
* Set the animation time for the page
* @param page pointer to a page object
* @param anim_time animation time in milliseconds
*/
void lv_page_set_anim_time(lv_obj_t * page, uint16_t anim_time);
/**
* Enable the scroll propagation feature. If enabled then the page will move its parent if there is
* no more space to scroll.
* The page needs to have a page-like parent (e.g. `lv_page`, `lv_tabview` tab, `lv_win` content area etc)
* If enabled drag direction will be changed `LV_DRAG_DIR_ONE` automatically to allow scrolling only in one direction at one time.
* @param page pointer to a Page
* @param en true or false to enable/disable scroll propagation
*/
void lv_page_set_scroll_propagation(lv_obj_t * page, bool en);
/**
* Enable the edge flash effect. (Show an arc when the an edge is reached)
* @param page pointer to a Page
* @param en true or false to enable/disable end flash
*/
void lv_page_set_edge_flash(lv_obj_t * page, bool en);
/**
* Set the fit policy in all 4 directions separately.
* It tell how to change the page size automatically.
* @param page pointer to a page object
* @param left left fit policy from `lv_fit_t`
* @param right right fit policy from `lv_fit_t`
* @param top bottom fit policy from `lv_fit_t`
* @param bottom bottom fit policy from `lv_fit_t`
*/
static inline void lv_page_set_scrollable_fit4(lv_obj_t * page, lv_fit_t left, lv_fit_t right, lv_fit_t top,
lv_fit_t bottom)
{
lv_cont_set_fit4(lv_page_get_scrollable(page), left, right, top, bottom);
}
/**
* Set the fit policy horizontally and vertically separately.
* It tell how to change the page size automatically.
* @param page pointer to a page object
* @param hot horizontal fit policy from `lv_fit_t`
* @param ver vertical fit policy from `lv_fit_t`
*/
static inline void lv_page_set_scrollable_fit2(lv_obj_t * page, lv_fit_t hor, lv_fit_t ver)
{
lv_cont_set_fit2(lv_page_get_scrollable(page), hor, ver);
}
/**
* Set the fit policy in all 4 direction at once.
* It tell how to change the page size automatically.
* @param page pointer to a button object
* @param fit fit policy from `lv_fit_t`
*/
static inline void lv_page_set_scrollable_fit(lv_obj_t * page, lv_fit_t fit)
{
lv_cont_set_fit(lv_page_get_scrollable(page), fit);
}
/**
* Set width of the scrollable part of a page
* @param page pointer to a page object
* @param w the new width of the scrollable (it ha no effect is horizontal fit is enabled)
*/
static inline void lv_page_set_scrl_width(lv_obj_t * page, lv_coord_t w)
{
lv_obj_set_width(lv_page_get_scrollable(page), w);
}
/**
* Set height of the scrollable part of a page
* @param page pointer to a page object
* @param h the new height of the scrollable (it ha no effect is vertical fit is enabled)
*/
static inline void lv_page_set_scrl_height(lv_obj_t * page, lv_coord_t h)
{
lv_obj_set_height(lv_page_get_scrollable(page), h);
}
/**
* Set the layout of the scrollable part of the page
* @param page pointer to a page object
* @param layout a layout from 'lv_cont_layout_t'
*/
static inline void lv_page_set_scrl_layout(lv_obj_t * page, lv_layout_t layout)
{
lv_cont_set_layout(lv_page_get_scrollable(page), layout);
}
/*=====================
* Getter functions
*====================*/
/**
* Set the scroll bar mode on a page
* @param page pointer to a page object
* @return the mode from 'lv_page_sb.mode_t' enum
*/
lv_scrollbar_mode_t lv_page_get_scrollbar_mode(const lv_obj_t * page);
/**
* Get the scroll propagation property
* @param page pointer to a Page
* @return true or false
*/
bool lv_page_get_scroll_propagation(lv_obj_t * page);
/**
* Get the edge flash effect property.
* @param page pointer to a Page
* return true or false
*/
bool lv_page_get_edge_flash(lv_obj_t * page);
/**
* Get that width which can be set to the children to still not cause overflow (show scrollbars)
* @param page pointer to a page object
* @return the width which still fits into the page
*/
lv_coord_t lv_page_get_width_fit(lv_obj_t * page);
/**
* Get that height which can be set to the children to still not cause overflow (show scrollbars)
* @param page pointer to a page object
* @return the height which still fits into the page
*/
lv_coord_t lv_page_get_height_fit(lv_obj_t * page);
/**
* Divide the width of the object and get the width of a given number of columns.
* Take into account the paddings of the background and scrollable too.
* @param page pointer to an object
* @param div indicates how many columns are assumed.
* If 1 the width will be set the the parent's width
* If 2 only half parent width - inner padding of the parent
* If 3 only third parent width - 2 * inner padding of the parent
* @param span how many columns are combined
* @return the width according to the given parameters
*/
lv_coord_t lv_page_get_width_grid(lv_obj_t * page, uint8_t div, uint8_t span);
/**
* Divide the height of the object and get the width of a given number of columns.
* Take into account the paddings of the background and scrollable too.
* @param page pointer to an object
* @param div indicates how many rows are assumed.
* If 1 the height will be set the the parent's height
* If 2 only half parent height - inner padding of the parent
* If 3 only third parent height - 2 * inner padding of the parent
* @param span how many rows are combined
* @return the height according to the given parameters
*/
lv_coord_t lv_page_get_height_grid(lv_obj_t * page, uint8_t div, uint8_t span);
/**
* Get width of the scrollable part of a page
* @param page pointer to a page object
* @return the width of the scrollable
*/
static inline lv_coord_t lv_page_get_scrl_width(const lv_obj_t * page)
{
return lv_obj_get_width(lv_page_get_scrollable(page));
}
/**
* Get height of the scrollable part of a page
* @param page pointer to a page object
* @return the height of the scrollable
*/
static inline lv_coord_t lv_page_get_scrl_height(const lv_obj_t * page)
{
return lv_obj_get_height(lv_page_get_scrollable(page));
}
/**
* Get the layout of the scrollable part of a page
* @param page pointer to page object
* @return the layout from 'lv_cont_layout_t'
*/
static inline lv_layout_t lv_page_get_scrl_layout(const lv_obj_t * page)
{
return lv_cont_get_layout(lv_page_get_scrollable(page));
}
/**
* Get the left fit mode
* @param page pointer to a page object
* @return an element of `lv_fit_t`
*/
static inline lv_fit_t lv_page_get_scrl_fit_left(const lv_obj_t * page)
{
return lv_cont_get_fit_left(lv_page_get_scrollable(page));
}
/**
* Get the right fit mode
* @param page pointer to a page object
* @return an element of `lv_fit_t`
*/
static inline lv_fit_t lv_page_get_scrl_fit_right(const lv_obj_t * page)
{
return lv_cont_get_fit_right(lv_page_get_scrollable(page));
}
/**
* Get the top fit mode
* @param page pointer to a page object
* @return an element of `lv_fit_t`
*/
static inline lv_fit_t lv_page_get_scrl_fit_top(const lv_obj_t * page)
{
return lv_cont_get_fit_top(lv_page_get_scrollable(page));
}
/**
* Get the bottom fit mode
* @param page pointer to a page object
* @return an element of `lv_fit_t`
*/
static inline lv_fit_t lv_page_get_scrl_fit_bottom(const lv_obj_t * page)
{
return lv_cont_get_fit_bottom(lv_page_get_scrollable(page));
}
/*=====================
* Other functions
*====================*/
/**
* Find whether the page has been scrolled to a certain edge.
* @param page Page object
* @param edge Edge to check
* @return true if the page is on the specified edge
*/
bool lv_page_on_edge(lv_obj_t * page, lv_page_edge_t edge);
/**
* Glue the object to the page. After it the page can be moved (dragged) with this object too.
* @param obj pointer to an object on a page
* @param glue true: enable glue, false: disable glue
*/
void lv_page_glue_obj(lv_obj_t * obj, bool glue);
/**
* Focus on an object. It ensures that the object will be visible on the page.
* @param page pointer to a page object
* @param obj pointer to an object to focus (must be on the page)
* @param anim_en LV_ANIM_ON to focus with animation; LV_ANIM_OFF to focus without animation
*/
void lv_page_focus(lv_obj_t * page, const lv_obj_t * obj, lv_anim_enable_t anim_en);
/**
* Scroll the page horizontally
* @param page pointer to a page object
* @param dist the distance to scroll (< 0: scroll left; > 0 scroll right)
*/
void lv_page_scroll_hor(lv_obj_t * page, lv_coord_t dist);
/**
* Scroll the page vertically
* @param page pointer to a page object
* @param dist the distance to scroll (< 0: scroll down; > 0 scroll up)
*/
void lv_page_scroll_ver(lv_obj_t * page, lv_coord_t dist);
/**
* Not intended to use directly by the user but by other object types internally.
* Start an edge flash animation.
* @param page
* @param edge the edge to flash. Can be `LV_PAGE_EDGE_LEFT/RIGHT/TOP/BOTTOM`
*/
void lv_page_start_edge_flash(lv_obj_t * page, lv_page_edge_t edge);
/**********************
* MACROS
**********************/
#endif /*LV_USE_PAGE*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_PAGE_H*/
|
train_000.parquet/945
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_page.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 14105,
"token_count": 4937
}
|
/**
* @file lv_kb.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_keyboard.h"
#if LV_USE_KEYBOARD != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h"
#include "lv_textarea.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_keyboard"
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_res_t lv_keyboard_signal(lv_obj_t * kb, lv_signal_t sign, void * param);
static void lv_keyboard_update_map(lv_obj_t * kb);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
/* clang-format off */
static const char * const default_kb_map_lc[] = {"1#", "q", "w", "e", "r", "t", "y", "u", "i", "o", "p", LV_SYMBOL_BACKSPACE, "\n",
"ABC", "a", "s", "d", "f", "g", "h", "j", "k", "l", LV_SYMBOL_NEW_LINE, "\n",
"_", "-", "z", "x", "c", "v", "b", "n", "m", ".", ",", ":", "\n",
LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""
};
static const lv_btnmatrix_ctrl_t default_kb_ctrl_lc_map[] = {
LV_KEYBOARD_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
LV_KEYBOARD_CTRL_BTN_FLAGS | 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
};
static const char * const default_kb_map_uc[] = {"1#", "Q", "W", "E", "R", "T", "Y", "U", "I", "O", "P", LV_SYMBOL_BACKSPACE, "\n",
"abc", "A", "S", "D", "F", "G", "H", "J", "K", "L", LV_SYMBOL_NEW_LINE, "\n",
"_", "-", "Z", "X", "C", "V", "B", "N", "M", ".", ",", ":", "\n",
LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""
};
static const lv_btnmatrix_ctrl_t default_kb_ctrl_uc_map[] = {
LV_KEYBOARD_CTRL_BTN_FLAGS | 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 7,
LV_KEYBOARD_CTRL_BTN_FLAGS | 6, 3, 3, 3, 3, 3, 3, 3, 3, 3, 7,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
};
static const char * const default_kb_map_spec[] = {"0", "1", "2", "3", "4", "5", "6", "7", "8", "9", LV_SYMBOL_BACKSPACE, "\n",
"abc", "+", "-", "/", "*", "=", "%", "!", "?", "#", "<", ">", "\n",
"\\", "@", "$", "(", ")", "{", "}", "[", "]", ";", "\"", "'", "\n",
LV_SYMBOL_CLOSE, LV_SYMBOL_LEFT, " ", LV_SYMBOL_RIGHT, LV_SYMBOL_OK, ""
};
static const lv_btnmatrix_ctrl_t default_kb_ctrl_spec_map[] = {
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 2,
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
LV_KEYBOARD_CTRL_BTN_FLAGS | 2, 2, 6, 2, LV_KEYBOARD_CTRL_BTN_FLAGS | 2
};
static const char * const default_kb_map_num[] = {"1", "2", "3", LV_SYMBOL_CLOSE, "\n",
"4", "5", "6", LV_SYMBOL_OK, "\n",
"7", "8", "9", LV_SYMBOL_BACKSPACE, "\n",
"+/-", "0", ".", LV_SYMBOL_LEFT, LV_SYMBOL_RIGHT, ""
};
static const lv_btnmatrix_ctrl_t default_kb_ctrl_num_map[] = {
1, 1, 1, LV_KEYBOARD_CTRL_BTN_FLAGS | 2,
1, 1, 1, LV_KEYBOARD_CTRL_BTN_FLAGS | 2,
1, 1, 1, 2,
1, 1, 1, 1, 1
};
/* clang-format on */
static const char * * kb_map[4] = {
(const char * *)default_kb_map_lc,
(const char * *)default_kb_map_uc,
(const char * *)default_kb_map_spec,
(const char * *)default_kb_map_num
};
static const lv_btnmatrix_ctrl_t * kb_ctrl[4] = {
default_kb_ctrl_lc_map,
default_kb_ctrl_uc_map,
default_kb_ctrl_spec_map,
default_kb_ctrl_num_map
};
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a keyboard objects
* @param par pointer to an object, it will be the parent of the new keyboard
* @param copy pointer to a keyboard object, if not NULL then the new object will be copied from it
* @return pointer to the created keyboard
*/
lv_obj_t * lv_keyboard_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("keyboard create started");
/*Create the ancestor of keyboard*/
lv_obj_t * kb = lv_btnmatrix_create(par, copy);
LV_ASSERT_MEM(kb);
if(kb == NULL) return NULL;
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(kb);
/*Allocate the keyboard type specific extended data*/
lv_keyboard_ext_t * ext = lv_obj_allocate_ext_attr(kb, sizeof(lv_keyboard_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(kb);
return NULL;
}
/*Initialize the allocated 'ext' */
ext->ta = NULL;
ext->mode = LV_KEYBOARD_MODE_TEXT_LOWER;
ext->cursor_mng = 0;
/*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(kb, lv_keyboard_signal);
/*Init the new keyboard keyboard*/
if(copy == NULL) {
/* Set a size which fits into the parent.
* Don't use `par` directly because if the window is created on a page it is moved to the
* scrollable so the parent has changed */
lv_obj_set_size(kb, lv_obj_get_width_fit(lv_obj_get_parent(kb)),
lv_obj_get_height_fit(lv_obj_get_parent(kb)) / 2);
lv_obj_align(kb, NULL, LV_ALIGN_IN_BOTTOM_MID, 0, 0);
lv_obj_set_event_cb(kb, lv_keyboard_def_event_cb);
lv_obj_set_base_dir(kb, LV_BIDI_DIR_LTR);
lv_obj_add_protect(kb, LV_PROTECT_CLICK_FOCUS);
lv_btnmatrix_set_map(kb, kb_map[ext->mode]);
lv_btnmatrix_set_ctrl_map(kb, kb_ctrl[ext->mode]);
lv_theme_apply(kb, LV_THEME_KEYBOARD);
}
/*Copy an existing keyboard*/
else {
lv_keyboard_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->ta = copy_ext->ta;
ext->mode = copy_ext->mode;
ext->cursor_mng = copy_ext->cursor_mng;
lv_btnmatrix_set_map(kb, kb_map[ext->mode]);
lv_btnmatrix_set_ctrl_map(kb, kb_ctrl[ext->mode]);
/*Refresh the style with new signal function*/
// lv_obj_refresh_style(new_kb);
}
LV_LOG_INFO("keyboard created");
return kb;
}
/*=====================
* Setter functions
*====================*/
/**
* Assign a Text Area to the Keyboard. The pressed characters will be put there.
* @param kb pointer to a Keyboard object
* @param ta pointer to a Text Area object to write there
*/
void lv_keyboard_set_textarea(lv_obj_t * kb, lv_obj_t * ta)
{
LV_ASSERT_OBJ(kb, LV_OBJX_NAME);
if(ta) LV_ASSERT_OBJ(ta, "lv_textarea");
lv_keyboard_ext_t * ext = lv_obj_get_ext_attr(kb);
/*Hide the cursor of the old Text area if cursor management is enabled*/
if(ext->ta && ext->cursor_mng) {
lv_textarea_set_cursor_hidden(ext->ta, true);
}
ext->ta = ta;
/*Show the cursor of the new Text area if cursor management is enabled*/
if(ext->ta && ext->cursor_mng) {
lv_textarea_set_cursor_hidden(ext->ta, false);
}
}
/**
* Set a new a mode (text or number map)
* @param kb pointer to a Keyboard object
* @param mode the mode from 'lv_keyboard_mode_t'
*/
void lv_keyboard_set_mode(lv_obj_t * kb, lv_keyboard_mode_t mode)
{
LV_ASSERT_OBJ(kb, LV_OBJX_NAME);
lv_keyboard_ext_t * ext = lv_obj_get_ext_attr(kb);
if(ext->mode == mode) return;
ext->mode = mode;
lv_btnmatrix_set_map(kb, kb_map[mode]);
lv_btnmatrix_set_ctrl_map(kb, kb_ctrl[mode]);
}
/**
* Automatically hide or show the cursor of Text Area
* @param kb pointer to a Keyboard object
* @param en true: show cursor on the current text area, false: hide cursor
*/
void lv_keyboard_set_cursor_manage(lv_obj_t * kb, bool en)
{
LV_ASSERT_OBJ(kb, LV_OBJX_NAME);
lv_keyboard_ext_t * ext = lv_obj_get_ext_attr(kb);
if(ext->cursor_mng == en) return;
ext->cursor_mng = en == false ? 0 : 1;
if(ext->ta) {
if(ext->cursor_mng) {
lv_textarea_set_cursor_hidden(ext->ta, false);
}
else {
lv_textarea_set_cursor_hidden(ext->ta, true);
}
}
}
/**
* Set a new map for the keyboard
* @param kb pointer to a Keyboard object
* @param mode keyboard map to alter 'lv_keyboard_mode_t'
* @param map pointer to a string array to describe the map.
* See 'lv_btnmatrix_set_map()' for more info.
*/
void lv_keyboard_set_map(lv_obj_t * kb, lv_keyboard_mode_t mode, const char * map[])
{
kb_map[mode] = map;
lv_keyboard_update_map(kb);
}
/**
* Set the button control map (hidden, disabled etc.) for the keyboard. The
* control map array will be copied and so may be deallocated after this
* function returns.
* @param kb pointer to a keyboard object
* @param mode keyboard ctrl map to alter 'lv_keyboard_mode_t'
* @param ctrl_map pointer to an array of `lv_btn_ctrl_t` control bytes.
* See: `lv_btnmatrix_set_ctrl_map` for more details.
*/
void lv_keyboard_set_ctrl_map(lv_obj_t * kb, lv_keyboard_mode_t mode, const lv_btnmatrix_ctrl_t ctrl_map[])
{
kb_ctrl[mode] = ctrl_map;
lv_keyboard_update_map(kb);
}
/*=====================
* Getter functions
*====================*/
/**
* Assign a Text Area to the Keyboard. The pressed characters will be put there.
* @param kb pointer to a Keyboard object
* @return pointer to the assigned Text Area object
*/
lv_obj_t * lv_keyboard_get_textarea(const lv_obj_t * kb)
{
LV_ASSERT_OBJ(kb, LV_OBJX_NAME);
lv_keyboard_ext_t * ext = lv_obj_get_ext_attr(kb);
return ext->ta;
}
/**
* Set a new a mode (text or number map)
* @param kb pointer to a Keyboard object
* @return the current mode from 'lv_keyboard_mode_t'
*/
lv_keyboard_mode_t lv_keyboard_get_mode(const lv_obj_t * kb)
{
LV_ASSERT_OBJ(kb, LV_OBJX_NAME);
lv_keyboard_ext_t * ext = lv_obj_get_ext_attr(kb);
return ext->mode;
}
/**
* Get the current cursor manage mode.
* @param kb pointer to a Keyboard object
* @return true: show cursor on the current text area, false: hide cursor
*/
bool lv_keyboard_get_cursor_manage(const lv_obj_t * kb)
{
LV_ASSERT_OBJ(kb, LV_OBJX_NAME);
lv_keyboard_ext_t * ext = lv_obj_get_ext_attr(kb);
return ext->cursor_mng == 0 ? false : true;
}
/*=====================
* Other functions
*====================*/
/**
* Default keyboard event to add characters to the Text area and change the map.
* If a custom `event_cb` is added to the keyboard this function be called from it to handle the
* button clicks
* @param kb pointer to a keyboard
* @param event the triggering event
*/
void lv_keyboard_def_event_cb(lv_obj_t * kb, lv_event_t event)
{
LV_ASSERT_OBJ(kb, LV_OBJX_NAME);
if(event != LV_EVENT_VALUE_CHANGED) return;
lv_keyboard_ext_t * ext = lv_obj_get_ext_attr(kb);
uint16_t btn_id = lv_btnmatrix_get_active_btn(kb);
if(btn_id == LV_BTNMATRIX_BTN_NONE) return;
if(lv_btnmatrix_get_btn_ctrl(kb, btn_id, LV_BTNMATRIX_CTRL_HIDDEN | LV_BTNMATRIX_CTRL_DISABLED)) return;
if(lv_btnmatrix_get_btn_ctrl(kb, btn_id, LV_BTNMATRIX_CTRL_NO_REPEAT) && event == LV_EVENT_LONG_PRESSED_REPEAT) return;
const char * txt = lv_btnmatrix_get_active_btn_text(kb);
if(txt == NULL) return;
/*Do the corresponding action according to the text of the button*/
if(strcmp(txt, "abc") == 0) {
ext->mode = LV_KEYBOARD_MODE_TEXT_LOWER;
lv_btnmatrix_set_map(kb, kb_map[LV_KEYBOARD_MODE_TEXT_LOWER]);
lv_btnmatrix_set_ctrl_map(kb, kb_ctrl[LV_KEYBOARD_MODE_TEXT_LOWER]);
return;
}
else if(strcmp(txt, "ABC") == 0) {
ext->mode = LV_KEYBOARD_MODE_TEXT_UPPER;
lv_btnmatrix_set_map(kb, kb_map[LV_KEYBOARD_MODE_TEXT_UPPER]);
lv_btnmatrix_set_ctrl_map(kb, kb_ctrl[LV_KEYBOARD_MODE_TEXT_UPPER]);
return;
}
else if(strcmp(txt, "1#") == 0) {
ext->mode = LV_KEYBOARD_MODE_SPECIAL;
lv_btnmatrix_set_map(kb, kb_map[LV_KEYBOARD_MODE_SPECIAL]);
lv_btnmatrix_set_ctrl_map(kb, kb_ctrl[LV_KEYBOARD_MODE_SPECIAL]);
return;
}
else if(strcmp(txt, LV_SYMBOL_CLOSE) == 0) {
if(kb->event_cb != lv_keyboard_def_event_cb) {
lv_res_t res = lv_event_send(kb, LV_EVENT_CANCEL, NULL);
if(res != LV_RES_OK) return;
}
else {
lv_keyboard_set_textarea(kb, NULL); /*De-assign the text area to hide it cursor if needed*/
lv_obj_del(kb);
return;
}
return;
}
else if(strcmp(txt, LV_SYMBOL_OK) == 0) {
if(kb->event_cb != lv_keyboard_def_event_cb) {
lv_res_t res = lv_event_send(kb, LV_EVENT_APPLY, NULL);
if(res != LV_RES_OK) return;
}
else {
lv_keyboard_set_textarea(kb, NULL); /*De-assign the text area to hide it cursor if needed*/
}
return;
}
/*Add the characters to the text area if set*/
if(ext->ta == NULL) return;
if(strcmp(txt, "Enter") == 0 || strcmp(txt, LV_SYMBOL_NEW_LINE) == 0)
lv_textarea_add_char(ext->ta, '\n');
else if(strcmp(txt, LV_SYMBOL_LEFT) == 0)
lv_textarea_cursor_left(ext->ta);
else if(strcmp(txt, LV_SYMBOL_RIGHT) == 0)
lv_textarea_cursor_right(ext->ta);
else if(strcmp(txt, LV_SYMBOL_BACKSPACE) == 0)
lv_textarea_del_char(ext->ta);
else if(strcmp(txt, "+/-") == 0) {
uint16_t cur = lv_textarea_get_cursor_pos(ext->ta);
const char * ta_txt = lv_textarea_get_text(ext->ta);
if(ta_txt[0] == '-') {
lv_textarea_set_cursor_pos(ext->ta, 1);
lv_textarea_del_char(ext->ta);
lv_textarea_add_char(ext->ta, '+');
lv_textarea_set_cursor_pos(ext->ta, cur);
}
else if(ta_txt[0] == '+') {
lv_textarea_set_cursor_pos(ext->ta, 1);
lv_textarea_del_char(ext->ta);
lv_textarea_add_char(ext->ta, '-');
lv_textarea_set_cursor_pos(ext->ta, cur);
}
else {
lv_textarea_set_cursor_pos(ext->ta, 0);
lv_textarea_add_char(ext->ta, '-');
lv_textarea_set_cursor_pos(ext->ta, cur + 1);
}
}
else {
lv_textarea_add_text(ext->ta, txt);
}
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Signal function of the keyboard
* @param kb pointer to a keyboard object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_keyboard_signal(lv_obj_t * kb, lv_signal_t sign, void * param)
{
lv_res_t res;
/* Include the ancient signal function */
res = ancestor_signal(kb, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
if(sign == LV_SIGNAL_CLEANUP) {
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
}
else if(sign == LV_SIGNAL_FOCUS) {
lv_keyboard_ext_t * ext = lv_obj_get_ext_attr(kb);
/*Show the cursor of the Text area if cursor management is enabled*/
if(ext->ta && ext->cursor_mng) {
lv_textarea_set_cursor_hidden(ext->ta, false);
}
}
else if(sign == LV_SIGNAL_DEFOCUS) {
lv_keyboard_ext_t * ext = lv_obj_get_ext_attr(kb);
/*Show the cursor of the Text area if cursor management is enabled*/
if(ext->ta && ext->cursor_mng) {
lv_textarea_set_cursor_hidden(ext->ta, true);
}
}
return res;
}
/**
* Update the key map for the current mode
* @param kb pointer to a keyboard object
*/
static void lv_keyboard_update_map(lv_obj_t * kb)
{
lv_keyboard_ext_t * ext = lv_obj_get_ext_attr(kb);
lv_btnmatrix_set_map(kb, kb_map[ext->mode]);
lv_btnmatrix_set_ctrl_map(kb, kb_ctrl[ext->mode]);
}
#endif
|
train_000.parquet/946
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_keyboard.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 16639,
"token_count": 6773
}
|
/**
* @file lv_sw.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_switch.h"
#if LV_USE_SWITCH != 0
/*Testing of dependencies*/
#if LV_USE_SLIDER == 0
#error "lv_sw: lv_slider is required. Enable it in lv_conf.h (LV_USE_SLIDER 1) "
#endif
#include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_math.h"
#include "../lv_core/lv_indev.h"
#include "../lv_core/lv_disp.h"
#include "lv_img.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_switch"
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_res_t lv_switch_signal(lv_obj_t * sw, lv_signal_t sign, void * param);
static lv_design_res_t lv_switch_design(lv_obj_t * sw, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_style_list_t * lv_switch_get_style(lv_obj_t * sw, uint8_t part);
static lv_style_list_t * lv_switch_get_style(lv_obj_t * sw, uint8_t part);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
static lv_design_cb_t ancestor_design;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a switch objects
* @param par pointer to an object, it will be the parent of the new switch
* @param copy pointer to a switch object, if not NULL then the new object will be copied from it
* @return pointer to the created switch
*/
lv_obj_t * lv_switch_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("switch create started");
/*Create the ancestor of switch*/
lv_obj_t * sw = lv_bar_create(par, copy);
LV_ASSERT_MEM(sw);
if(sw == NULL) return NULL;
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(sw);
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(sw);
/*Allocate the switch type specific extended data*/
lv_switch_ext_t * ext = lv_obj_allocate_ext_attr(sw, sizeof(lv_switch_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(sw);
return NULL;
}
lv_style_list_init(&ext->style_knob);
/*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(sw, lv_switch_signal);
lv_obj_set_design_cb(sw, lv_switch_design);
/*Init the new switch switch*/
if(copy == NULL) {
lv_obj_set_click(sw, true);
lv_obj_add_protect(sw, LV_PROTECT_PRESS_LOST);
lv_obj_set_size(sw, LV_DPX(60), LV_DPX(35));
lv_bar_set_range(sw, 0, 1);
lv_theme_apply(sw, LV_THEME_SWITCH);
}
/*Copy an existing switch*/
else {
lv_switch_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
lv_style_list_copy(&ext->style_knob, ©_ext->style_knob);
lv_obj_refresh_style(sw, LV_STYLE_PROP_ALL);
}
/*Refresh the style with new signal function*/
LV_LOG_INFO("switch created");
return sw;
}
/*=====================
* Setter functions
*====================*/
/**
* Turn ON the switch
* @param sw pointer to a switch object
* @param anim LV_ANOM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
void lv_switch_on(lv_obj_t * sw, lv_anim_enable_t anim)
{
LV_ASSERT_OBJ(sw, LV_OBJX_NAME);
#if LV_USE_ANIMATION == 0
anim = LV_ANIM_OFF;
#endif
lv_switch_ext_t * ext = lv_obj_get_ext_attr(sw);
ext->state = 1;
lv_bar_set_value(sw, 1, anim);
lv_obj_add_state(sw, LV_STATE_CHECKED);
}
/**
* Turn OFF the switch
* @param sw pointer to a switch object
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
void lv_switch_off(lv_obj_t * sw, lv_anim_enable_t anim)
{
LV_ASSERT_OBJ(sw, LV_OBJX_NAME);
#if LV_USE_ANIMATION == 0
anim = LV_ANIM_OFF;
#endif
lv_switch_ext_t * ext = lv_obj_get_ext_attr(sw);
ext->state = 0;
lv_bar_set_value(sw, 0, anim);
lv_obj_clear_state(sw, LV_STATE_CHECKED);
}
/**
* Toggle the position of the switch
* @param sw pointer to a switch object
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
* @return resulting state of the switch.
*/
bool lv_switch_toggle(lv_obj_t * sw, lv_anim_enable_t anim)
{
LV_ASSERT_OBJ(sw, LV_OBJX_NAME);
#if LV_USE_ANIMATION == 0
anim = LV_ANIM_OFF;
#endif
bool state = lv_switch_get_state(sw);
if(state)
lv_switch_off(sw, anim);
else
lv_switch_on(sw, anim);
return !state;
}
/*=====================
* Getter functions
*====================*/
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the sliders
* @param slider pointer to an object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_switch_design(lv_obj_t * sw, const lv_area_t * clip_area, lv_design_mode_t mode)
{
/*Return false if the object is not covers the mask_p area*/
if(mode == LV_DESIGN_COVER_CHK) {
return LV_DESIGN_RES_NOT_COVER;
}
/*Draw the object*/
else if(mode == LV_DESIGN_DRAW_MAIN) {
lv_bidi_dir_t base_dir = lv_obj_get_base_dir(sw);
/*The ancestor design function will draw the background and the indicator.
* It also sets ext->bar.indic_area*/
ancestor_design(sw, clip_area, mode);
lv_switch_ext_t * ext = lv_obj_get_ext_attr(sw);
lv_coord_t objw = lv_obj_get_width(sw);
lv_coord_t objh = lv_obj_get_height(sw);
lv_coord_t knob_size = objh;
lv_area_t knob_area;
lv_style_int_t bg_left = lv_obj_get_style_pad_left(sw, LV_SWITCH_PART_BG);
lv_style_int_t bg_right = lv_obj_get_style_pad_right(sw, LV_SWITCH_PART_BG);
lv_coord_t max_indic_w = objw - bg_left - bg_right;
lv_coord_t act_indic_w = lv_area_get_width(&ext->bar.indic_area);
if(base_dir != LV_BIDI_DIR_RTL) {
knob_area.x1 = ext->bar.indic_area.x2 - ((act_indic_w * knob_size) / max_indic_w);
knob_area.x2 = knob_area.x1 + knob_size;
}
else {
knob_area.x2 = ext->bar.indic_area.x1 + ((act_indic_w * knob_size) / max_indic_w);
knob_area.x1 = knob_area.x2 - knob_size;
}
knob_area.y1 = sw->coords.y1;
knob_area.y2 = sw->coords.y2;
lv_style_int_t knob_left = lv_obj_get_style_pad_left(sw, LV_SWITCH_PART_KNOB);
lv_style_int_t knob_right = lv_obj_get_style_pad_right(sw, LV_SWITCH_PART_KNOB);
lv_style_int_t knob_top = lv_obj_get_style_pad_top(sw, LV_SWITCH_PART_KNOB);
lv_style_int_t knob_bottom = lv_obj_get_style_pad_bottom(sw, LV_SWITCH_PART_KNOB);
/*Apply the paddings on the knob area*/
knob_area.x1 -= knob_left;
knob_area.x2 += knob_right;
knob_area.y1 -= knob_top;
knob_area.y2 += knob_bottom;
lv_draw_rect_dsc_t knob_rect_dsc;
lv_draw_rect_dsc_init(&knob_rect_dsc);
lv_obj_init_draw_rect_dsc(sw, LV_SWITCH_PART_KNOB, &knob_rect_dsc);
lv_draw_rect(&knob_area, clip_area, &knob_rect_dsc);
}
/*Post draw when the children are drawn*/
else if(mode == LV_DESIGN_DRAW_POST) {
return ancestor_design(sw, clip_area, mode);
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the switch
* @param sw pointer to a switch object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_switch_signal(lv_obj_t * sw, lv_signal_t sign, void * param)
{
lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_switch_get_style(sw, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(sw, sign, param);
}
if(sign == LV_SIGNAL_GET_TYPE) {
res = ancestor_signal(sw, sign, param);
if(res != LV_RES_OK) return res;
return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
}
/* Include the ancient signal function */
res = ancestor_signal(sw, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_CLEANUP) {
lv_obj_clean_style_list(sw, LV_SWITCH_PART_KNOB);
}
else if(sign == LV_SIGNAL_RELEASED) {
if(lv_switch_get_state(sw)) lv_switch_off(sw, LV_ANIM_ON);
else lv_switch_on(sw, LV_ANIM_ON);
res = lv_event_send(sw, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RES_OK) return res;
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
char c = *((char *)param);
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) lv_switch_on(sw, LV_ANIM_ON);
else if(c == LV_KEY_LEFT || c == LV_KEY_DOWN) lv_switch_off(sw, LV_ANIM_ON);
res = lv_event_send(sw, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RES_OK) return res;
#endif
}
else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
lv_style_int_t knob_left = lv_obj_get_style_pad_left(sw, LV_SWITCH_PART_KNOB);
lv_style_int_t knob_right = lv_obj_get_style_pad_right(sw, LV_SWITCH_PART_KNOB);
lv_style_int_t knob_top = lv_obj_get_style_pad_top(sw, LV_SWITCH_PART_KNOB);
lv_style_int_t knob_bottom = lv_obj_get_style_pad_bottom(sw, LV_SWITCH_PART_KNOB);
/* The smaller size is the knob diameter*/
lv_coord_t knob_size = LV_MATH_MIN(lv_obj_get_width(sw), lv_obj_get_height(sw)) >> 1;
knob_size += LV_MATH_MAX(LV_MATH_MAX(knob_left, knob_right), LV_MATH_MAX(knob_bottom, knob_top));
knob_size += 2; /*For rounding error*/
knob_size += lv_obj_get_draw_rect_ext_pad_size(sw, LV_SWITCH_PART_KNOB);
/*Indic. size is handled by bar*/
sw->ext_draw_pad = LV_MATH_MAX(sw->ext_draw_pad, knob_size);
}
else if(sign == LV_SIGNAL_GET_EDITABLE) {
#if LV_USE_GROUP
bool * editable = (bool *)param;
*editable = false; /*The ancestor slider is editable the switch is not*/
#endif
}
return res;
}
static lv_style_list_t * lv_switch_get_style(lv_obj_t * sw, uint8_t part)
{
LV_ASSERT_OBJ(sw, LV_OBJX_NAME);
lv_switch_ext_t * ext = lv_obj_get_ext_attr(sw);
lv_style_list_t * style_dsc_p;
switch(part) {
case LV_SWITCH_PART_BG:
style_dsc_p = &sw->style_list;
break;
case LV_SWITCH_PART_INDIC:
style_dsc_p = &ext->bar.style_indic;
break;
case LV_SWITCH_PART_KNOB:
style_dsc_p = &ext->style_knob;
break;
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
#endif
|
train_000.parquet/947
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_switch.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 11251,
"token_count": 4555
}
|
/**
* @file lv_label.h
*
*/
#ifndef LV_LABEL_H
#define LV_LABEL_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_LABEL != 0
#include <stdarg.h>
#include "../lv_core/lv_obj.h"
#include "../lv_font/lv_font.h"
#include "../lv_font/lv_symbol_def.h"
#include "../lv_misc/lv_txt.h"
#include "../lv_draw/lv_draw.h"
/*********************
* DEFINES
*********************/
#define LV_LABEL_DOT_NUM 3
#define LV_LABEL_POS_LAST 0xFFFF
#define LV_LABEL_TEXT_SEL_OFF LV_DRAW_LABEL_NO_TXT_SEL
LV_EXPORT_CONST_INT(LV_LABEL_DOT_NUM);
LV_EXPORT_CONST_INT(LV_LABEL_POS_LAST);
LV_EXPORT_CONST_INT(LV_LABEL_TEXT_SEL_OFF);
/**********************
* TYPEDEFS
**********************/
/** Long mode behaviors. Used in 'lv_label_ext_t' */
enum {
LV_LABEL_LONG_EXPAND, /**< Expand the object size to the text size*/
LV_LABEL_LONG_BREAK, /**< Keep the object width, break the too long lines and expand the object
height*/
LV_LABEL_LONG_DOT, /**< Keep the size and write dots at the end if the text is too long*/
LV_LABEL_LONG_SROLL, /**< Keep the size and roll the text back and forth*/
LV_LABEL_LONG_SROLL_CIRC, /**< Keep the size and roll the text circularly*/
LV_LABEL_LONG_CROP, /**< Keep the size and crop the text out of it*/
};
typedef uint8_t lv_label_long_mode_t;
/** Label align policy*/
enum {
LV_LABEL_ALIGN_LEFT, /**< Align text to left */
LV_LABEL_ALIGN_CENTER, /**< Align text to center */
LV_LABEL_ALIGN_RIGHT, /**< Align text to right */
LV_LABEL_ALIGN_AUTO, /**< Use LEFT or RIGHT depending on the direction of the text (LTR/RTL)*/
};
typedef uint8_t lv_label_align_t;
/** Data of label*/
typedef struct {
/*Inherited from 'base_obj' so no inherited ext.*/ /*Ext. of ancestor*/
/*New data for this type */
char * text; /*Text of the label*/
union {
char * tmp_ptr; /* Pointer to the allocated memory containing the character which are replaced by dots (Handled
by the library)*/
char tmp[LV_LABEL_DOT_NUM + 1]; /* Directly store the characters if <=4 characters */
} dot;
uint32_t dot_end; /*The text end position in dot mode (Handled by the library)*/
#if LV_USE_ANIMATION
uint16_t anim_speed; /*Speed of scroll and roll animation in px/sec unit*/
#endif
lv_point_t offset; /*Text draw position offset*/
#if LV_LABEL_LONG_TXT_HINT
lv_draw_label_hint_t hint; /*Used to buffer info about large text*/
#endif
#if LV_LABEL_TEXT_SEL
uint32_t sel_start;
uint32_t sel_end;
#endif
lv_label_long_mode_t long_mode : 3; /*Determinate what to do with the long texts*/
uint8_t static_txt : 1; /*Flag to indicate the text is static*/
uint8_t align : 2; /*Align type from 'lv_label_align_t'*/
uint8_t recolor : 1; /*Enable in-line letter re-coloring*/
uint8_t expand : 1; /*Ignore real width (used by the library with LV_LABEL_LONG_SROLL)*/
uint8_t dot_tmp_alloc : 1; /*True if dot_tmp has been allocated. False if dot_tmp directly holds up to 4 bytes of
characters */
} lv_label_ext_t;
/** Label styles*/
enum {
LV_LABEL_PART_MAIN,
};
typedef uint8_t lv_label_part_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a label objects
* @param par pointer to an object, it will be the parent of the new label
* @param copy pointer to a button object, if not NULL then the new object will be copied from it
* @return pointer to the created button
*/
lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
*====================*/
/**
* Set a new text for a label. Memory will be allocated to store the text by the label.
* @param label pointer to a label object
* @param text '\0' terminated character string. NULL to refresh with the current text.
*/
void lv_label_set_text(lv_obj_t * label, const char * text);
/**
* Set a new formatted text for a label. Memory will be allocated to store the text by the label.
* @param label pointer to a label object
* @param fmt `printf`-like format
*/
void lv_label_set_text_fmt(lv_obj_t * label, const char * fmt, ...);
/**
* Set a static text. It will not be saved by the label so the 'text' variable
* has to be 'alive' while the label exist.
* @param label pointer to a label object
* @param text pointer to a text. NULL to refresh with the current text.
*/
void lv_label_set_text_static(lv_obj_t * label, const char * text);
/**
* Set the behavior of the label with longer text then the object size
* @param label pointer to a label object
* @param long_mode the new mode from 'lv_label_long_mode' enum.
* In LV_LONG_BREAK/LONG/ROLL the size of the label should be set AFTER this
* function
*/
void lv_label_set_long_mode(lv_obj_t * label, lv_label_long_mode_t long_mode);
/**
* Set the align of the label (left or center)
* @param label pointer to a label object
* @param align 'LV_LABEL_ALIGN_LEFT' or 'LV_LABEL_ALIGN_LEFT'
*/
void lv_label_set_align(lv_obj_t * label, lv_label_align_t align);
/**
* Enable the recoloring by in-line commands
* @param label pointer to a label object
* @param en true: enable recoloring, false: disable
*/
void lv_label_set_recolor(lv_obj_t * label, bool en);
/**
* Set the label's animation speed in LV_LABEL_LONG_SROLL/SCROLL_CIRC modes
* @param label pointer to a label object
* @param anim_speed speed of animation in px/sec unit
*/
void lv_label_set_anim_speed(lv_obj_t * label, uint16_t anim_speed);
/**
* @brief Set the selection start index.
* @param label pointer to a label object.
* @param index index to set. `LV_LABEL_TXT_SEL_OFF` to select nothing.
*/
void lv_label_set_text_sel_start(lv_obj_t * label, uint32_t index);
/**
* @brief Set the selection end index.
* @param label pointer to a label object.
* @param index index to set. `LV_LABEL_TXT_SEL_OFF` to select nothing.
*/
void lv_label_set_text_sel_end(lv_obj_t * label, uint32_t index);
/*=====================
* Getter functions
*====================*/
/**
* Get the text of a label
* @param label pointer to a label object
* @return the text of the label
*/
char * lv_label_get_text(const lv_obj_t * label);
/**
* Get the long mode of a label
* @param label pointer to a label object
* @return the long mode
*/
lv_label_long_mode_t lv_label_get_long_mode(const lv_obj_t * label);
/**
* Get the align attribute
* @param label pointer to a label object
* @return LV_LABEL_ALIGN_LEFT or LV_LABEL_ALIGN_CENTER
*/
lv_label_align_t lv_label_get_align(const lv_obj_t * label);
/**
* Get the recoloring attribute
* @param label pointer to a label object
* @return true: recoloring is enabled, false: disable
*/
bool lv_label_get_recolor(const lv_obj_t * label);
/**
* Get the label's animation speed in LV_LABEL_LONG_ROLL and SCROLL modes
* @param label pointer to a label object
* @return speed of animation in px/sec unit
*/
uint16_t lv_label_get_anim_speed(const lv_obj_t * label);
/**
* Get the relative x and y coordinates of a letter
* @param label pointer to a label object
* @param index index of the letter [0 ... text length]. Expressed in character index, not byte
* index (different in UTF-8)
* @param pos store the result here (E.g. index = 0 gives 0;0 coordinates)
*/
void lv_label_get_letter_pos(const lv_obj_t * label, uint32_t index, lv_point_t * pos);
/**
* Get the index of letter on a relative point of a label
* @param label pointer to label object
* @param pos pointer to point with coordinates on a the label
* @return the index of the letter on the 'pos_p' point (E.g. on 0;0 is the 0. letter)
* Expressed in character index and not byte index (different in UTF-8)
*/
uint32_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos);
/**
* Check if a character is drawn under a point.
* @param label Label object
* @param pos Point to check for character under
* @return whether a character is drawn under the point
*/
bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos);
/**
* @brief Get the selection start index.
* @param label pointer to a label object.
* @return selection start index. `LV_LABEL_TXT_SEL_OFF` if nothing is selected.
*/
uint32_t lv_label_get_text_sel_start(const lv_obj_t * label);
/**
* @brief Get the selection end index.
* @param label pointer to a label object.
* @return selection end index. `LV_LABEL_TXT_SEL_OFF` if nothing is selected.
*/
uint32_t lv_label_get_text_sel_end(const lv_obj_t * label);
lv_style_list_t * lv_label_get_style(lv_obj_t * label, uint8_t type);
/*=====================
* Other functions
*====================*/
/**
* Insert a text to the label. The label text can not be static.
* @param label pointer to a label object
* @param pos character index to insert. Expressed in character index and not byte index (Different
* in UTF-8) 0: before first char. LV_LABEL_POS_LAST: after last char.
* @param txt pointer to the text to insert
*/
void lv_label_ins_text(lv_obj_t * label, uint32_t pos, const char * txt);
/**
* Delete characters from a label. The label text can not be static.
* @param label pointer to a label object
* @param pos character index to insert. Expressed in character index and not byte index (Different
* in UTF-8) 0: before first char.
* @param cnt number of characters to cut
*/
void lv_label_cut_text(lv_obj_t * label, uint32_t pos, uint32_t cnt);
/**********************
* MACROS
**********************/
#endif /*LV_USE_LABEL*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_LABEL_H*/
|
train_000.parquet/948
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_label.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 9844,
"token_count": 3481
}
|
/**
* @file lv_cont.h
*
*/
#ifndef LV_CONT_H
#define LV_CONT_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_CONT != 0
#include "../lv_core/lv_obj.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Container layout options*/
enum {
LV_LAYOUT_OFF = 0, /**< No layout */
LV_LAYOUT_CENTER, /**< Center objects */
/**
* COULMN:
* - Place the object below each other
* - Keep `pad_top` space on the top
* - Keep `pad_inner` space between the objects
*/
LV_LAYOUT_COLUMN_LEFT, /**< Column left align*/
LV_LAYOUT_COLUMN_MID, /**< Column middle align*/
LV_LAYOUT_COLUMN_RIGHT, /**< Column right align*/
/**
* ROW:
* - Place the object next to each other
* - Keep `pad_left` space on the left
* - Keep `pad_inner` space between the objects
* - If the object which applies the layout has `base_dir == LV_BIDI_DIR_RTL`
* the row will start from the right applying `pad.right` space
*/
LV_LAYOUT_ROW_TOP, /**< Row top align*/
LV_LAYOUT_ROW_MID, /**< Row middle align*/
LV_LAYOUT_ROW_BOTTOM, /**< Row bottom align*/
/**
* PRETTY:
* - Place the object next to each other
* - If there is no more space start a new row
* - Respect `pad_left` and `pad_right` when determining the available space in a row
* - Keep `pad_inner` space between the objects in the same row
* - Keep `pad_inner` space between the objects in rows
* - Divide the remaining horizontal space equally
*/
LV_LAYOUT_PRETTY_TOP, /**< Row top align*/
LV_LAYOUT_PRETTY_MID, /**< Row middle align*/
LV_LAYOUT_PRETTY_BOTTOM, /**< Row bottom align*/
/**
* GRID
* - Place the object next to each other
* - If there is no more space start a new row
* - Respect `pad_left` and `pad_right` when determining the available space in a row
* - Keep `pad_inner` space between the objects in the same row
* - Keep `pad_inner` space between the objects in rows
* - Unlike `PRETTY`, `GRID` always keep `pad_inner` space horizontally between objects
* so it doesn't divide the remaining horizontal space equally
*/
LV_LAYOUT_GRID, /**< Align same-sized object into a grid*/
_LV_LAYOUT_LAST
};
typedef uint8_t lv_layout_t;
/**
* How to resize the container around the children.
*/
enum {
LV_FIT_NONE, /**< Do not change the size automatically*/
LV_FIT_TIGHT, /**< Shrink wrap around the children */
LV_FIT_PARENT, /**< Align the size to the parent's edge*/
LV_FIT_MAX, /**< Align the size to the parent's edge first but if there is an object out of it
then get larger */
_LV_FIT_LAST
};
typedef uint8_t lv_fit_t;
typedef struct {
/*Inherited from 'base_obj' so no inherited ext. */ /*Ext. of ancestor*/
/*New data for this type */
lv_layout_t layout : 4; /*A layout from 'lv_layout_t' enum*/
lv_fit_t fit_left : 2; /*A fit type from `lv_fit_t` enum */
lv_fit_t fit_right : 2; /*A fit type from `lv_fit_t` enum */
lv_fit_t fit_top : 2; /*A fit type from `lv_fit_t` enum */
lv_fit_t fit_bottom : 2; /*A fit type from `lv_fit_t` enum */
} lv_cont_ext_t;
/*Part of the container*/
enum {
LV_CONT_PART_MAIN = LV_OBJ_PART_MAIN,
_LV_CONT_PART_VIRTUAL_LAST = _LV_OBJ_PART_VIRTUAL_LAST,
_LV_CONT_PART_REAL_LAST = _LV_OBJ_PART_REAL_LAST,
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a container objects
* @param par pointer to an object, it will be the parent of the new container
* @param copy pointer to a container object, if not NULL then the new object will be copied from it
* @return pointer to the created container
*/
lv_obj_t * lv_cont_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
*====================*/
/**
* Set a layout on a container
* @param cont pointer to a container object
* @param layout a layout from 'lv_cont_layout_t'
*/
void lv_cont_set_layout(lv_obj_t * cont, lv_layout_t layout);
/**
* Set the fit policy in all 4 directions separately.
* It tell how to change the container's size automatically.
* @param cont pointer to a container object
* @param left left fit policy from `lv_fit_t`
* @param right right fit policy from `lv_fit_t`
* @param top top fit policy from `lv_fit_t`
* @param bottom bottom fit policy from `lv_fit_t`
*/
void lv_cont_set_fit4(lv_obj_t * cont, lv_fit_t left, lv_fit_t right, lv_fit_t top, lv_fit_t bottom);
/**
* Set the fit policy horizontally and vertically separately.
* It tells how to change the container's size automatically.
* @param cont pointer to a container object
* @param hor horizontal fit policy from `lv_fit_t`
* @param ver vertical fit policy from `lv_fit_t`
*/
static inline void lv_cont_set_fit2(lv_obj_t * cont, lv_fit_t hor, lv_fit_t ver)
{
lv_cont_set_fit4(cont, hor, hor, ver, ver);
}
/**
* Set the fit policy in all 4 direction at once.
* It tells how to change the container's size automatically.
* @param cont pointer to a container object
* @param fit fit policy from `lv_fit_t`
*/
static inline void lv_cont_set_fit(lv_obj_t * cont, lv_fit_t fit)
{
lv_cont_set_fit4(cont, fit, fit, fit, fit);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the layout of a container
* @param cont pointer to container object
* @return the layout from 'lv_cont_layout_t'
*/
lv_layout_t lv_cont_get_layout(const lv_obj_t * cont);
/**
* Get left fit mode of a container
* @param cont pointer to a container object
* @return an element of `lv_fit_t`
*/
lv_fit_t lv_cont_get_fit_left(const lv_obj_t * cont);
/**
* Get right fit mode of a container
* @param cont pointer to a container object
* @return an element of `lv_fit_t`
*/
lv_fit_t lv_cont_get_fit_right(const lv_obj_t * cont);
/**
* Get top fit mode of a container
* @param cont pointer to a container object
* @return an element of `lv_fit_t`
*/
lv_fit_t lv_cont_get_fit_top(const lv_obj_t * cont);
/**
* Get bottom fit mode of a container
* @param cont pointer to a container object
* @return an element of `lv_fit_t`
*/
lv_fit_t lv_cont_get_fit_bottom(const lv_obj_t * cont);
/**********************
* MACROS
**********************/
#endif /*LV_USE_CONT*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_CONT_H*/
|
train_000.parquet/949
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_cont.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 6643,
"token_count": 2374
}
|
/**
* @file lv_tab.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_tabview.h"
#if LV_USE_TABVIEW != 0
#include "lv_btnmatrix.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_anim.h"
#include "../lv_core/lv_disp.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_tabview"
#if LV_USE_ANIMATION
#ifndef LV_TABVIEW_DEF_ANIM_TIME
#define LV_TABVIEW_DEF_ANIM_TIME 300 /*Animation time of focusing to the a list element [ms] (0: no animation) */
#endif
#else
#undef LV_TABVIEW_DEF_ANIM_TIME
#define LV_TABVIEW_DEF_ANIM_TIME 0 /*No animations*/
#endif
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * param);
static lv_res_t tabview_scrl_signal(lv_obj_t * tabview_scrl, lv_signal_t sign, void * param);
static lv_style_list_t * lv_tabview_get_style(lv_obj_t * tabview, uint8_t part);
static void tab_btnm_event_cb(lv_obj_t * tab_btnm, lv_event_t event);
static void tabview_realign(lv_obj_t * tabview);
static void refr_indic_size(lv_obj_t * tabview);
static void refr_btns_size(lv_obj_t * tabview);
static void refr_content_size(lv_obj_t * tabview);
static void refr_align(lv_obj_t * tabview);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
static lv_signal_cb_t ancestor_scrl_signal;
static lv_signal_cb_t page_signal;
static const char * tab_def[] = {""};
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a Tab view object
* @param par pointer to an object, it will be the parent of the new tab
* @param copy pointer to a tab object, if not NULL then the new object will be copied from it
* @return pointer to the created tab
*/
lv_obj_t * lv_tabview_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("tab view create started");
/*Create the ancestor of tab*/
lv_obj_t * tabview = lv_obj_create(par, copy);
LV_ASSERT_MEM(tabview);
if(tabview == NULL) return NULL;
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(tabview);
/*Allocate the tab type specific extended data*/
lv_tabview_ext_t * ext = lv_obj_allocate_ext_attr(tabview, sizeof(lv_tabview_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(tabview);
return NULL;
}
/*Initialize the allocated 'ext' */
ext->tab_cur = 0;
ext->tab_cnt = 0;
ext->point_last.x = 0;
ext->point_last.y = 0;
ext->content = NULL;
ext->indic = NULL;
ext->btns = NULL;
ext->btns_pos = LV_TABVIEW_TAB_POS_TOP;
#if LV_USE_ANIMATION
ext->anim_time = LV_TABVIEW_DEF_ANIM_TIME;
#endif
/*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(tabview, lv_tabview_signal);
/*Init the new tab tab*/
if(copy == NULL) {
ext->tab_name_ptr = lv_mem_alloc(sizeof(char *));
LV_ASSERT_MEM(ext->tab_name_ptr);
if(ext->tab_name_ptr == NULL) return NULL;
ext->tab_name_ptr[0] = "";
/* Set a size which fits into the parent.
* Don't use `par` directly because if the tabview is created on a page it is moved to the
* scrollable so the parent has changed */
lv_coord_t w;
lv_coord_t h;
if(par) {
w = lv_obj_get_width_fit(lv_obj_get_parent(tabview));
h = lv_obj_get_height_fit(lv_obj_get_parent(tabview));
}
else {
w = lv_disp_get_hor_res(NULL);
h = lv_disp_get_ver_res(NULL);
}
lv_obj_set_size(tabview, w, h);
ext->content = lv_page_create(tabview, NULL);
ext->btns = lv_btnmatrix_create(tabview, NULL);
ext->indic = lv_obj_create(ext->btns, NULL);
if(ancestor_scrl_signal == NULL) ancestor_scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrollable(ext->content));
lv_obj_set_signal_cb(lv_page_get_scrollable(ext->content), tabview_scrl_signal);
lv_btnmatrix_set_map(ext->btns, tab_def);
lv_obj_set_event_cb(ext->btns, tab_btnm_event_cb);
lv_obj_set_click(ext->indic, false);
lv_obj_set_drag_dir(lv_page_get_scrollable(ext->content), LV_DRAG_DIR_ONE);
lv_page_set_scrollable_fit2(ext->content, LV_FIT_TIGHT, LV_FIT_PARENT);
lv_page_set_scrl_layout(ext->content, LV_LAYOUT_ROW_TOP);
lv_page_set_scrollbar_mode(ext->content, LV_SCROLLBAR_MODE_OFF);
lv_obj_clean_style_list(ext->content, LV_PAGE_PART_BG);
lv_theme_apply(tabview, LV_THEME_TABVIEW);
}
/*Copy an existing tab view*/
else {
lv_tabview_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->point_last.x = 0;
ext->point_last.y = 0;
ext->btns = lv_btnmatrix_create(tabview, copy_ext->btns);
ext->indic = lv_obj_create(ext->btns, copy_ext->indic);
ext->content = lv_page_create(tabview, copy_ext->content);
#if LV_USE_ANIMATION
ext->anim_time = copy_ext->anim_time;
#endif
ext->tab_name_ptr = lv_mem_alloc(sizeof(char *));
LV_ASSERT_MEM(ext->tab_name_ptr);
if(ext->tab_name_ptr == NULL) return NULL;
ext->tab_name_ptr[0] = "";
lv_btnmatrix_set_map(ext->btns, ext->tab_name_ptr);
lv_style_list_copy(lv_obj_get_style_list(tabview, LV_TABVIEW_PART_BG_SCRLLABLE), lv_obj_get_style_list(copy,
LV_TABVIEW_PART_BG_SCRLLABLE));
lv_style_list_copy(lv_obj_get_style_list(tabview, LV_TABVIEW_PART_TAB_BG), lv_obj_get_style_list(copy,
LV_TABVIEW_PART_TAB_BG));
lv_style_list_copy(lv_obj_get_style_list(tabview, LV_TABVIEW_PART_TAB_BTN), lv_obj_get_style_list(copy,
LV_TABVIEW_PART_TAB_BTN));
uint16_t i;
for(i = 0; i < copy_ext->tab_cnt; i++) {
lv_obj_t * new_tab = lv_tabview_add_tab(tabview, copy_ext->tab_name_ptr[i]);
lv_obj_t * copy_tab = lv_tabview_get_tab(copy, i);
lv_style_list_copy(lv_obj_get_style_list(new_tab, LV_PAGE_PART_SCROLLABLE), lv_obj_get_style_list(copy_tab,
LV_PAGE_PART_SCROLLABLE));
lv_style_list_copy(lv_obj_get_style_list(new_tab, LV_PAGE_PART_SCROLLBAR), lv_obj_get_style_list(copy_tab,
LV_PAGE_PART_SCROLLBAR));
lv_obj_refresh_style(new_tab, LV_STYLE_PROP_ALL);
}
/*Refresh the style with new signal function*/
lv_obj_refresh_style(tabview, LV_STYLE_PROP_ALL);
}
tabview_realign(tabview);
LV_LOG_INFO("tab view created");
return tabview;
}
/*======================
* Add/remove functions
*=====================*/
/**
* Add a new tab with the given name
* @param tabview pointer to Tab view object where to ass the new tab
* @param name the text on the tab button
* @return pointer to the created page object (lv_page). You can create your content here
*/
lv_obj_t * lv_tabview_add_tab(lv_obj_t * tabview, const char * name)
{
LV_ASSERT_OBJ(tabview, LV_OBJX_NAME);
LV_ASSERT_STR(name);
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
/*Create the container page*/
lv_obj_t * h = lv_page_create(ext->content, NULL);
lv_obj_set_size(h, lv_obj_get_width(tabview), lv_obj_get_height(ext->content));
lv_page_set_scrollbar_mode(h, LV_SCROLLBAR_MODE_AUTO);
lv_page_set_scroll_propagation(h, true);
lv_page_set_scrollable_fit4(h, LV_FIT_NONE, LV_FIT_MAX, LV_FIT_NONE, LV_FIT_MAX);
lv_theme_apply(h, LV_THEME_TABVIEW_PAGE);
if(page_signal == NULL) page_signal = lv_obj_get_signal_cb(h);
/*Extend the button matrix map with the new name*/
char * name_dm;
name_dm = lv_mem_alloc(strlen(name) + 1); /*+1 for the the closing '\0' */
LV_ASSERT_MEM(name_dm);
if(name_dm == NULL) return NULL;
strcpy(name_dm, name);
ext->tab_cnt++;
/* FIXME: It is not possible yet to switch tab button position from/to top/bottom from/to left/right at runtime.
* Method: clean extra \n when switch from LV_TABVIEW_BTNS_POS_LEFT or LV_TABVIEW_BTNS_POS_RIGHT
* to LV_TABVIEW_BTNS_POS_TOP or LV_TABVIEW_BTNS_POS_BOTTOM.
*/
switch(ext->btns_pos) {
default: /*default case is prevented in lv_tabview_set_btns_pos(), but here for safety*/
case LV_TABVIEW_TAB_POS_NONE:
case LV_TABVIEW_TAB_POS_TOP:
case LV_TABVIEW_TAB_POS_BOTTOM:
ext->tab_name_ptr = lv_mem_realloc(ext->tab_name_ptr, sizeof(char *) * (ext->tab_cnt + 1));
LV_ASSERT_MEM(ext->tab_name_ptr);
if(ext->tab_name_ptr == NULL) return NULL;
ext->tab_name_ptr[ext->tab_cnt - 1] = name_dm;
ext->tab_name_ptr[ext->tab_cnt] = "";
break;
case LV_TABVIEW_TAB_POS_LEFT:
case LV_TABVIEW_TAB_POS_RIGHT:
ext->tab_name_ptr = lv_mem_realloc(ext->tab_name_ptr, sizeof(char *) * (ext->tab_cnt * 2));
LV_ASSERT_MEM(ext->tab_name_ptr);
if(ext->tab_name_ptr == NULL) return NULL;
if(ext->tab_cnt == 1) {
ext->tab_name_ptr[0] = name_dm;
ext->tab_name_ptr[1] = "";
}
else {
ext->tab_name_ptr[ext->tab_cnt * 2 - 3] = "\n";
ext->tab_name_ptr[ext->tab_cnt * 2 - 2] = name_dm;
ext->tab_name_ptr[ext->tab_cnt * 2 - 1] = "";
}
break;
}
/* The button matrix's map still points to the old `tab_name_ptr` which might be freed by
* `lv_mem_realloc`. So make its current map invalid*/
lv_btnmatrix_ext_t * btnm_ext = lv_obj_get_ext_attr(ext->btns);
btnm_ext->map_p = NULL;
lv_btnmatrix_set_map(ext->btns, ext->tab_name_ptr);
lv_btnmatrix_set_btn_ctrl(ext->btns, ext->tab_cur, LV_BTNMATRIX_CTRL_NO_REPEAT);
/*Set the first btn as active*/
if(ext->tab_cnt == 1) ext->tab_cur = 0;
tabview_realign(tabview); /*Set the size of the pages, tab buttons and indicator*/
lv_tabview_set_tab_act(tabview, ext->tab_cur, false);
return h;
}
/**
* Delete all children of a tab created by `lv_tabview_add_tab`.
* @param tab pointer to a tab
*/
void lv_tabview_clean_tab(lv_obj_t * tab)
{
LV_ASSERT_OBJ(tab, "lv_page");
lv_obj_t * scrl = lv_page_get_scrollable(tab);
lv_obj_clean(scrl);
}
/*=====================
* Setter functions
*====================*/
/**
* Set a new tab
* @param tabview pointer to Tab view object
* @param id index of a tab to load
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
void lv_tabview_set_tab_act(lv_obj_t * tabview, uint16_t id, lv_anim_enable_t anim)
{
LV_ASSERT_OBJ(tabview, LV_OBJX_NAME);
#if LV_USE_ANIMATION == 0
anim = LV_ANIM_OFF;
#endif
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
if(id >= ext->tab_cnt) id = ext->tab_cnt - 1;
lv_btnmatrix_clear_btn_ctrl(ext->btns, ext->tab_cur, LV_BTNMATRIX_CTRL_CHECK_STATE);
ext->tab_cur = id;
if(lv_obj_get_base_dir(tabview) == LV_BIDI_DIR_RTL) {
id = (ext->tab_cnt - (id + 1));
}
lv_coord_t cont_x;
lv_style_int_t scrl_inner = lv_obj_get_style_pad_inner(ext->content, LV_PAGE_PART_SCROLLABLE);
lv_style_int_t scrl_left = lv_obj_get_style_pad_left(ext->content, LV_PAGE_PART_SCROLLABLE);
switch(ext->btns_pos) {
default: /*default case is prevented in lv_tabview_set_btns_pos(), but here for safety*/
case LV_TABVIEW_TAB_POS_NONE:
case LV_TABVIEW_TAB_POS_TOP:
case LV_TABVIEW_TAB_POS_BOTTOM:
cont_x = -(lv_obj_get_width(tabview) * id + scrl_inner * id + scrl_left);
break;
case LV_TABVIEW_TAB_POS_LEFT:
case LV_TABVIEW_TAB_POS_RIGHT:
cont_x = -((lv_obj_get_width(tabview) - lv_obj_get_width(ext->btns)) * id + scrl_inner * id + scrl_left);
break;
}
if(anim == LV_ANIM_OFF || lv_tabview_get_anim_time(tabview) == 0) {
lv_obj_set_x(lv_page_get_scrollable(ext->content), cont_x);
}
#if LV_USE_ANIMATION
else {
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, lv_page_get_scrollable(ext->content));
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_x);
lv_anim_set_values(&a, lv_obj_get_x(lv_page_get_scrollable(ext->content)), cont_x);
lv_anim_set_time(&a, ext->anim_time);
lv_anim_start(&a);
}
#endif
/*Move the indicator*/
lv_coord_t indic_size;
lv_coord_t indic_pos = 0; /*silence uninitialized variable warning*/;
lv_style_int_t btns_bg_inner = 0;
lv_style_int_t btns_bg_left = 0;
lv_style_int_t btns_bg_top = 0;
switch(ext->btns_pos) {
default: /*default case is prevented in lv_tabview_set_btns_pos(), but here for safety*/
case LV_TABVIEW_TAB_POS_NONE:
break;
case LV_TABVIEW_TAB_POS_TOP:
case LV_TABVIEW_TAB_POS_BOTTOM:
btns_bg_inner = lv_obj_get_style_pad_inner(tabview, LV_TABVIEW_PART_TAB_BG);
btns_bg_left = lv_obj_get_style_pad_left(tabview, LV_TABVIEW_PART_TAB_BG);
indic_size = lv_obj_get_width(ext->indic);
indic_pos = indic_size * id + btns_bg_inner * id + btns_bg_left;
break;
case LV_TABVIEW_TAB_POS_LEFT:
case LV_TABVIEW_TAB_POS_RIGHT:
btns_bg_inner = lv_obj_get_style_pad_inner(tabview, LV_TABVIEW_PART_TAB_BG);
btns_bg_top = lv_obj_get_style_pad_top(tabview, LV_TABVIEW_PART_TAB_BG);
indic_size = lv_obj_get_height(ext->indic);
indic_pos = btns_bg_top + id * (indic_size + btns_bg_inner);
break;
}
#if LV_USE_ANIMATION
if(anim == LV_ANIM_OFF || ext->anim_time == 0)
#endif
{
switch(ext->btns_pos) {
default: /*default case is prevented in lv_tabview_set_btns_pos(), but here for safety*/
case LV_TABVIEW_TAB_POS_NONE:
break;
case LV_TABVIEW_TAB_POS_TOP:
case LV_TABVIEW_TAB_POS_BOTTOM:
lv_obj_set_x(ext->indic, indic_pos);
break;
case LV_TABVIEW_TAB_POS_LEFT:
case LV_TABVIEW_TAB_POS_RIGHT:
lv_obj_set_y(ext->indic, indic_pos);
break;
}
}
#if LV_USE_ANIMATION
else {
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, ext->indic);
lv_anim_set_time(&a, ext->anim_time);
switch(ext->btns_pos) {
default: /*default case is prevented in lv_tabview_set_btns_pos(), but here for safety*/
case LV_TABVIEW_TAB_POS_NONE:
break;
case LV_TABVIEW_TAB_POS_TOP:
case LV_TABVIEW_TAB_POS_BOTTOM:
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_x);
lv_anim_set_values(&a, lv_obj_get_x(ext->indic), indic_pos);
break;
case LV_TABVIEW_TAB_POS_LEFT:
case LV_TABVIEW_TAB_POS_RIGHT:
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_y);
lv_anim_set_values(&a, lv_obj_get_y(ext->indic), indic_pos);
break;
}
lv_anim_start(&a);
}
#endif
lv_btnmatrix_set_btn_ctrl(ext->btns, ext->tab_cur, LV_BTNMATRIX_CTRL_CHECK_STATE);
}
/**
* Set the name of a tab.
* @param tabview pointer to Tab view object
* @param id index of the tab the name should be set
* @param name new tab name
*/
void lv_tabview_set_tab_name(lv_obj_t * tabview, uint16_t id, char * name)
{
LV_ASSERT_OBJ(tabview, LV_OBJX_NAME);
/* get tabview's ext pointer which contains the tab name pointer list */
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
/* check for valid tab index */
if(ext->tab_cnt > id) {
/* reallocate memory for new tab name (use reallocate due to mostly the size didn't change much) */
char * str = lv_mem_realloc((void *)ext->tab_name_ptr[id], strlen(name) + 1);
LV_ASSERT_MEM(str);
/* store new tab name at allocated memory */
strcpy(str, name);
/* update pointer */
ext->tab_name_ptr[id] = str;
/* force redrawing of the tab headers */
lv_obj_invalidate(ext->btns);
}
}
/**
* Set the animation time of tab view when a new tab is loaded
* @param tabview pointer to Tab view object
* @param anim_time_ms time of animation in milliseconds
*/
void lv_tabview_set_anim_time(lv_obj_t * tabview, uint16_t anim_time)
{
LV_ASSERT_OBJ(tabview, LV_OBJX_NAME);
#if LV_USE_ANIMATION
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
ext->anim_time = anim_time;
#else
(void)tabview;
(void)anim_time;
#endif
}
/**
* Set the position of tab select buttons
* @param tabview pointer to a tan view object
* @param btns_pos which button position
*/
void lv_tabview_set_btns_pos(lv_obj_t * tabview, lv_tabview_btns_pos_t btns_pos)
{
if(btns_pos != LV_TABVIEW_TAB_POS_NONE &&
btns_pos != LV_TABVIEW_TAB_POS_TOP &&
btns_pos != LV_TABVIEW_TAB_POS_BOTTOM &&
btns_pos != LV_TABVIEW_TAB_POS_LEFT &&
btns_pos != LV_TABVIEW_TAB_POS_RIGHT) {
LV_LOG_WARN("lv_tabview_set_btns_pos: unexpected button position");
return;
}
LV_ASSERT_OBJ(tabview, LV_OBJX_NAME);
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
ext->btns_pos = btns_pos;
tabview_realign(tabview);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the index of the currently active tab
* @param tabview pointer to Tab view object
* @return the active btn index
*/
uint16_t lv_tabview_get_tab_act(const lv_obj_t * tabview)
{
LV_ASSERT_OBJ(tabview, LV_OBJX_NAME);
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
return ext->tab_cur;
}
/**
* Get the number of tabs
* @param tabview pointer to Tab view object
* @return btn count
*/
uint16_t lv_tabview_get_tab_count(const lv_obj_t * tabview)
{
LV_ASSERT_OBJ(tabview, LV_OBJX_NAME);
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
return ext->tab_cnt;
}
/**
* Get the page (content area) of a tab
* @param tabview pointer to Tab view object
* @param id index of the btn (>= 0)
* @return pointer to page (lv_page) object
*/
lv_obj_t * lv_tabview_get_tab(const lv_obj_t * tabview, uint16_t id)
{
LV_ASSERT_OBJ(tabview, LV_OBJX_NAME);
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
lv_obj_t * content_scrl = lv_page_get_scrollable(ext->content);
uint16_t i = 0;
lv_obj_t * page = lv_obj_get_child_back(content_scrl, NULL);
while(page != NULL && i != id) {
if(lv_obj_get_signal_cb(page) == page_signal) i++;
page = lv_obj_get_child_back(content_scrl, page);
}
if(i == id) return page;
return NULL;
}
/**
* Get the animation time of tab view when a new tab is loaded
* @param tabview pointer to Tab view object
* @return time of animation in milliseconds
*/
uint16_t lv_tabview_get_anim_time(const lv_obj_t * tabview)
{
LV_ASSERT_OBJ(tabview, LV_OBJX_NAME);
#if LV_USE_ANIMATION
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
return ext->anim_time;
#else
(void)tabview;
return 0;
#endif
}
/**
* Get position of tab select buttons
* @param tabview pointer to a ab view object
*/
lv_tabview_btns_pos_t lv_tabview_get_btns_pos(const lv_obj_t * tabview)
{
LV_ASSERT_OBJ(tabview, LV_OBJX_NAME);
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
return ext->btns_pos;
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Signal function of the Tab view
* @param tabview pointer to a Tab view object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_tabview_signal(lv_obj_t * tabview, lv_signal_t sign, void * param)
{
lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_tabview_get_style(tabview, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(tabview, sign, param);
}
else if(sign == LV_SIGNAL_GET_STATE_DSC) {
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
lv_get_state_info_t * info = param;
if(info->part == LV_TABVIEW_PART_TAB_BG) info->result = lv_obj_get_state(ext->btns, LV_BTNMATRIX_PART_BG);
else if(info->part == LV_TABVIEW_PART_TAB_BTN) info->result = lv_obj_get_state(ext->btns, LV_BTNMATRIX_PART_BTN);
else if(info->part == LV_TABVIEW_PART_INDIC) info->result = lv_obj_get_state(ext->indic, LV_OBJ_PART_MAIN);
else if(info->part == LV_TABVIEW_PART_BG_SCRLLABLE) info->result = lv_obj_get_state(ext->content,
LV_PAGE_PART_SCROLLABLE);
return LV_RES_OK;
}
/* Include the ancient signal function */
res = ancestor_signal(tabview, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
if(sign == LV_SIGNAL_CLEANUP) {
uint8_t i;
for(i = 0; ext->tab_name_ptr[i][0] != '\0'; i++) lv_mem_free(ext->tab_name_ptr[i]);
lv_mem_free(ext->tab_name_ptr);
ext->tab_name_ptr = NULL;
ext->btns = NULL; /*These objects were children so they are already invalid*/
ext->content = NULL;
}
else if(sign == LV_SIGNAL_STYLE_CHG) {
/*Be sure the buttons are updated because correct button size is required in `tabview_realign`*/
lv_signal_send(ext->btns, LV_SIGNAL_STYLE_CHG, NULL);
tabview_realign(tabview);
}
else if(sign == LV_SIGNAL_COORD_CHG) {
if(ext->content != NULL && (lv_obj_get_width(tabview) != lv_area_get_width(param) ||
lv_obj_get_height(tabview) != lv_area_get_height(param))) {
tabview_realign(tabview);
}
}
else if(sign == LV_SIGNAL_RELEASED) {
#if LV_USE_GROUP
/*If released by a KEYPAD or ENCODER then really the tab buttons should be released.
* So simulate a CLICK on the tab buttons*/
lv_indev_t * indev = lv_indev_get_act();
lv_indev_type_t indev_type = lv_indev_get_type(indev);
if(indev_type == LV_INDEV_TYPE_KEYPAD ||
(indev_type == LV_INDEV_TYPE_ENCODER && lv_group_get_editing(lv_obj_get_group(tabview)))) {
lv_event_send(ext->btns, LV_EVENT_CLICKED, lv_event_get_data());
}
#endif
}
else if(sign == LV_SIGNAL_GET_EDITABLE) {
#if LV_USE_GROUP
bool * editable = (bool *)param;
*editable = true;
#endif
}
if(sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS ||
#if LV_USE_GROUP
sign == LV_SIGNAL_CONTROL ||
#endif
sign == LV_SIGNAL_PRESSED || sign == LV_SIGNAL_RELEASED) {
/* The button matrix is not in a group (the tab view is in it) but it should handle the
* group signals. So propagate the related signals to the button matrix manually*/
ext->btns->signal_cb(ext->btns, sign, param);
/*Make the active tab's button focused*/
if(sign == LV_SIGNAL_FOCUS) {
lv_btnmatrix_set_focused_btn(ext->btns, ext->tab_cur);
}
if(sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS) {
lv_state_t state = lv_obj_get_state(tabview, LV_TABVIEW_PART_BG);
if(state & LV_STATE_FOCUSED) {
lv_obj_set_state(ext->btns, LV_STATE_FOCUSED);
lv_obj_set_state(ext->indic, LV_STATE_FOCUSED);
}
else {
lv_obj_clear_state(ext->btns, LV_STATE_FOCUSED);
lv_obj_clear_state(ext->indic, LV_STATE_FOCUSED);
}
if(state & LV_STATE_EDITED) {
lv_obj_set_state(ext->btns, LV_STATE_EDITED);
lv_obj_set_state(ext->indic, LV_STATE_EDITED);
}
else {
lv_obj_clear_state(ext->btns, LV_STATE_EDITED);
lv_obj_clear_state(ext->indic, LV_STATE_EDITED);
}
}
}
return res;
}
/**
* Signal function of a tab views main scrollable area
* @param tab pointer to a tab page object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t tabview_scrl_signal(lv_obj_t * tabview_scrl, lv_signal_t sign, void * param)
{
lv_res_t res;
/* Include the ancient signal function */
res = ancestor_scrl_signal(tabview_scrl, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, "");
lv_obj_t * cont = lv_obj_get_parent(tabview_scrl);
lv_obj_t * tabview = lv_obj_get_parent(cont);
if(sign == LV_SIGNAL_DRAG_THROW_BEGIN) {
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
lv_indev_t * indev = lv_indev_get_act();
lv_point_t point_act;
lv_indev_get_point(indev, &point_act);
lv_point_t vect;
lv_indev_get_vect(indev, &vect);
lv_coord_t x_predict = 0;
while(vect.x != 0) {
x_predict += vect.x;
vect.x = vect.x * (100 - LV_INDEV_DEF_DRAG_THROW) / 100;
}
res = lv_indev_finish_drag(indev);
if(res != LV_RES_OK) return res;
lv_obj_t * tab_page = lv_tabview_get_tab(tabview, ext->tab_cur);
if(tab_page == NULL) return LV_RES_OK;
lv_coord_t page_x1 = tab_page->coords.x1 - tabview->coords.x1 + x_predict;
lv_coord_t page_x2 = page_x1 + lv_obj_get_width(tabview);
lv_coord_t treshold = lv_obj_get_width(tabview) / 2;
lv_bidi_dir_t base_dir = lv_obj_get_base_dir(tabview);
int16_t tab_cur = ext->tab_cur;
if(page_x1 > treshold) {
if(base_dir != LV_BIDI_DIR_RTL) tab_cur--;
else tab_cur ++;
}
else if(page_x2 < treshold) {
if(base_dir != LV_BIDI_DIR_RTL) tab_cur++;
else tab_cur --;
}
if(tab_cur > ext->tab_cnt - 1) tab_cur = ext->tab_cnt - 1;
if(tab_cur < 0) tab_cur = 0;
uint32_t id_prev = lv_tabview_get_tab_act(tabview);
lv_tabview_set_tab_act(tabview, tab_cur, LV_ANIM_ON);
uint32_t id_new = lv_tabview_get_tab_act(tabview);
if(id_prev != id_new) res = lv_event_send(tabview, LV_EVENT_VALUE_CHANGED, &id_prev);
if(res != LV_RES_OK) return res;
}
return res;
}
/**
* Get the style descriptor of a part of the object
* @param page pointer the object
* @param part the part from `lv_tabview_part_t`. (LV_TABVIEW_PART_...)
* @return pointer to the style descriptor of the specified part
*/
static lv_style_list_t * lv_tabview_get_style(lv_obj_t * tabview, uint8_t part)
{
LV_ASSERT_OBJ(tabview, LV_OBJX_NAME);
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
lv_style_list_t * style_dsc_p;
switch(part) {
case LV_TABVIEW_PART_BG:
style_dsc_p = &tabview->style_list;
break;
case LV_TABVIEW_PART_BG_SCRLLABLE:
style_dsc_p = lv_obj_get_style_list(ext->content, LV_PAGE_PART_SCROLLABLE);
break;
case LV_TABVIEW_PART_TAB_BG:
style_dsc_p = lv_obj_get_style_list(ext->btns, LV_BTNMATRIX_PART_BG);
break;
case LV_TABVIEW_PART_TAB_BTN:
style_dsc_p = lv_obj_get_style_list(ext->btns, LV_BTNMATRIX_PART_BTN);
break;
case LV_TABVIEW_PART_INDIC:
style_dsc_p = lv_obj_get_style_list(ext->indic, LV_OBJ_PART_MAIN);
break;
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
/**
* Called when a tab button is clicked
* @param tab_btnm pointer to the tab's button matrix object
* @param event type of the event
*/
static void tab_btnm_event_cb(lv_obj_t * tab_btnm, lv_event_t event)
{
if(event != LV_EVENT_CLICKED) return;
uint16_t btn_id = lv_btnmatrix_get_active_btn(tab_btnm);
if(btn_id == LV_BTNMATRIX_BTN_NONE) return;
if(lv_btnmatrix_get_btn_ctrl(tab_btnm, btn_id, LV_BTNMATRIX_CTRL_DISABLED)) return;
lv_btnmatrix_clear_btn_ctrl_all(tab_btnm, LV_BTNMATRIX_CTRL_CHECK_STATE);
lv_btnmatrix_set_btn_ctrl(tab_btnm, btn_id, LV_BTNMATRIX_CTRL_CHECK_STATE);
lv_obj_t * tabview = lv_obj_get_parent(tab_btnm);
uint32_t id_prev = lv_tabview_get_tab_act(tabview);
lv_tabview_set_tab_act(tabview, btn_id, LV_ANIM_ON);
uint32_t id_new = lv_tabview_get_tab_act(tabview);
lv_res_t res = LV_RES_OK;
if(id_prev != id_new) res = lv_event_send(tabview, LV_EVENT_VALUE_CHANGED, &id_new);
#if LV_USE_GROUP
if(lv_indev_get_type(lv_indev_get_act()) == LV_INDEV_TYPE_ENCODER) {
lv_group_set_editing(lv_obj_get_group(tabview), false);
}
#endif
if(res != LV_RES_OK) return;
}
/**
* Realign and resize the elements of Tab view
* @param tabview pointer to a Tab view object
*/
static void tabview_realign(lv_obj_t * tabview)
{
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
refr_btns_size(tabview);
refr_content_size(tabview);
refr_indic_size(tabview);
refr_align(tabview);
lv_tabview_set_tab_act(tabview, ext->tab_cur, LV_ANIM_OFF);
}
static void refr_indic_size(lv_obj_t * tabview)
{
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
lv_btnmatrix_ext_t * btnm_ext = lv_obj_get_ext_attr(ext->btns);
lv_coord_t indic_size = lv_obj_get_style_size(tabview, LV_TABVIEW_PART_INDIC);
/*Set the indicator width/height*/
lv_coord_t indic_w;
lv_coord_t indic_h;
switch(ext->btns_pos) {
default: /*default case is prevented in lv_tabview_set_btns_pos(), but here for safety*/
case LV_TABVIEW_TAB_POS_NONE:
lv_obj_set_hidden(ext->indic, true);
indic_w = 0;
indic_h = 0;
break;
case LV_TABVIEW_TAB_POS_TOP:
case LV_TABVIEW_TAB_POS_BOTTOM:
lv_obj_set_hidden(ext->indic, false);
if(ext->tab_cnt) {
indic_h = indic_size;
indic_w = lv_area_get_width(&btnm_ext->button_areas[0]);
}
else {
indic_w = 0;
indic_h = 0;
}
break;
case LV_TABVIEW_TAB_POS_LEFT:
case LV_TABVIEW_TAB_POS_RIGHT:
lv_obj_set_hidden(ext->indic, false);
if(ext->tab_cnt) {
indic_w = indic_size;
indic_h = lv_area_get_height(&btnm_ext->button_areas[0]);
}
else {
indic_w = 0;
indic_h = 0;
}
break;
}
lv_obj_set_width(ext->indic, indic_w);
lv_obj_set_height(ext->indic, indic_h);
}
static void refr_btns_size(lv_obj_t * tabview)
{
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
lv_style_int_t tab_bg_left = lv_obj_get_style_pad_left(tabview, LV_TABVIEW_PART_TAB_BG);
lv_style_int_t tab_bg_right = lv_obj_get_style_pad_right(tabview, LV_TABVIEW_PART_TAB_BG);
lv_style_int_t tab_bg_top = lv_obj_get_style_pad_top(tabview, LV_TABVIEW_PART_TAB_BG);
lv_style_int_t tab_bg_bottom = lv_obj_get_style_pad_bottom(tabview, LV_TABVIEW_PART_TAB_BG);
lv_style_int_t tab_left = lv_obj_get_style_pad_left(tabview, LV_TABVIEW_PART_TAB_BTN);
lv_style_int_t tab_right = lv_obj_get_style_pad_right(tabview, LV_TABVIEW_PART_TAB_BTN);
lv_style_int_t tab_top = lv_obj_get_style_pad_top(tabview, LV_TABVIEW_PART_TAB_BTN);
lv_style_int_t tab_bottom = lv_obj_get_style_pad_bottom(tabview, LV_TABVIEW_PART_TAB_BTN);
const lv_font_t * font = lv_obj_get_style_text_font(tabview, LV_TABVIEW_PART_TAB_BTN);
/*Set the tabs height/width*/
lv_coord_t btns_w;
lv_coord_t btns_h;
switch(ext->btns_pos) {
default: /*default case is prevented in lv_tabview_set_btns_pos(), but here for safety*/
case LV_TABVIEW_TAB_POS_NONE:
btns_w = 0;
btns_h = 0;
lv_obj_set_hidden(ext->btns, true);
break;
case LV_TABVIEW_TAB_POS_TOP:
case LV_TABVIEW_TAB_POS_BOTTOM:
lv_obj_set_hidden(ext->btns, false);
btns_h = lv_font_get_line_height(font) + tab_top + tab_bottom + tab_bg_top + tab_bg_bottom;
btns_w = lv_obj_get_width(tabview);
break;
case LV_TABVIEW_TAB_POS_LEFT:
case LV_TABVIEW_TAB_POS_RIGHT:
lv_obj_set_hidden(ext->btns, false);
btns_w = lv_font_get_glyph_width(font, 'A', '\0') +
tab_left + tab_right + tab_bg_left + tab_bg_right;
btns_h = lv_obj_get_height(tabview);
break;
}
lv_obj_set_size(ext->btns, btns_w, btns_h);
}
static void refr_content_size(lv_obj_t * tabview)
{
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
lv_coord_t cont_w;
lv_coord_t cont_h;
switch(ext->btns_pos) {
default: /*default case is prevented in lv_tabview_set_btns_pos(), but here for safety*/
case LV_TABVIEW_TAB_POS_NONE:
cont_w = lv_obj_get_width(tabview);
cont_h = lv_obj_get_height(tabview);
break;
case LV_TABVIEW_TAB_POS_TOP:
case LV_TABVIEW_TAB_POS_BOTTOM:
cont_w = lv_obj_get_width(tabview);
cont_h = lv_obj_get_height(tabview) - lv_obj_get_height(ext->btns);
break;
case LV_TABVIEW_TAB_POS_LEFT:
case LV_TABVIEW_TAB_POS_RIGHT:
cont_w = lv_obj_get_width(tabview) - lv_obj_get_width(ext->btns);
cont_h = lv_obj_get_height(tabview);
break;
}
lv_obj_set_size(ext->content, cont_w, cont_h);
/*Refresh the size of the tab pages too. `ext->content` has a layout to align the pages*/
lv_style_int_t bg_top = lv_obj_get_style_pad_top(tabview, LV_TABVIEW_PART_BG_SCRLLABLE);
lv_style_int_t bg_bottom = lv_obj_get_style_pad_bottom(tabview, LV_TABVIEW_PART_BG_SCRLLABLE);
cont_h -= bg_top + bg_bottom;
lv_obj_t * content_scrl = lv_page_get_scrollable(ext->content);
lv_obj_t * pages = lv_obj_get_child(content_scrl, NULL);
while(pages != NULL) {
/*Be sure adjust only the pages (user can other things)*/
if(lv_obj_get_signal_cb(pages) == page_signal) {
lv_obj_set_size(pages, cont_w, cont_h);
}
pages = lv_obj_get_child(content_scrl, pages);
}
}
static void refr_align(lv_obj_t * tabview)
{
lv_tabview_ext_t * ext = lv_obj_get_ext_attr(tabview);
switch(ext->btns_pos) {
default: /*default case is prevented in lv_tabview_set_btns_pos(), but here for safety*/
case LV_TABVIEW_TAB_POS_NONE:
lv_obj_align(ext->content, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
break;
case LV_TABVIEW_TAB_POS_TOP:
lv_obj_align(ext->btns, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
lv_obj_align(ext->content, ext->btns, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_BOTTOM_LEFT, 0, 0);
break;
case LV_TABVIEW_TAB_POS_BOTTOM:
lv_obj_align(ext->content, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
lv_obj_align(ext->btns, ext->content, LV_ALIGN_OUT_BOTTOM_LEFT, 0, 0);
lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_TOP_LEFT, 0, 0);
break;
case LV_TABVIEW_TAB_POS_LEFT:
lv_obj_align(ext->btns, NULL, LV_ALIGN_IN_TOP_LEFT, 0, 0);
lv_obj_align(ext->content, tabview, LV_ALIGN_IN_TOP_LEFT, lv_obj_get_width(ext->btns), 0);
lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
break;
case LV_TABVIEW_TAB_POS_RIGHT:
lv_obj_align(ext->btns, NULL, LV_ALIGN_IN_TOP_RIGHT, 0, 0);
lv_obj_align(ext->content, tabview, LV_ALIGN_IN_TOP_LEFT, 0, 0);
lv_obj_align(ext->indic, ext->btns, LV_ALIGN_IN_TOP_LEFT, 0, 0);
break;
}
}
#endif
|
train_000.parquet/950
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_tabview.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 37226,
"token_count": 14825
}
|
/**
* @file lv_ddlist.h
*
*/
#ifndef LV_DROPDOWN_H
#define LV_DROPDOWN_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_DROPDOWN != 0
/*Testing of dependencies*/
#if LV_USE_PAGE == 0
#error "lv_ddlist: lv_page is required. Enable it in lv_conf.h (LV_USE_PAGE 1) "
#endif
#if LV_USE_LABEL == 0
#error "lv_ddlist: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
#endif
#include "../lv_widgets/lv_page.h"
#include "../lv_widgets/lv_label.h"
/*********************
* DEFINES
*********************/
#define LV_DROPDOWN_POS_LAST 0xFFFF
/**********************
* TYPEDEFS
**********************/
enum {
LV_DROPDOWN_DIR_DOWN,
LV_DROPDOWN_DIR_UP,
LV_DROPDOWN_DIR_LEFT,
LV_DROPDOWN_DIR_RIGHT,
};
typedef uint8_t lv_dropdown_dir_t;
/*Data of drop down list*/
typedef struct {
/*New data for this type */
lv_obj_t * page; /*The dropped down list*/
const char * text; /*Text to display on the ddlist's button*/
const char * symbol; /*Arrow or other icon when the drop-down list is closed*/
char * options;
lv_style_list_t style_selected; /*Style of the selected option*/
lv_style_list_t style_page; /*Style of the dropped down list*/
lv_style_list_t style_scrlbar; /*Style of the scroll bar*/
lv_coord_t max_height; /*Height of the ddlist when opened. (0: auto-size)*/
uint16_t option_cnt; /*Number of options*/
uint16_t sel_opt_id; /*Index of the currently selected option*/
uint16_t sel_opt_id_orig; /*Store the original index on focus*/
uint16_t pr_opt_id; /*Index of the currently pressed option*/
lv_dropdown_dir_t dir : 2;
uint8_t show_selected : 1;
uint8_t static_txt : 1;
} lv_dropdown_ext_t;
enum {
LV_DROPDOWN_PART_MAIN = LV_OBJ_PART_MAIN,
LV_DROPDOWN_PART_LIST = _LV_OBJ_PART_REAL_LAST,
LV_DROPDOWN_PART_SCROLLBAR,
LV_DROPDOWN_PART_SELECTED,
};
typedef uint8_t lv_dropdown_part_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a drop down list objects
* @param par pointer to an object, it will be the parent of the new drop down list
* @param copy pointer to a drop down list object, if not NULL then the new object will be copied
* from it
* @return pointer to the created drop down list
*/
lv_obj_t * lv_dropdown_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
*====================*/
/**
* Set text of the ddlist (Displayed on the button if `show_selected = false`)
* @param ddlist pointer to a drop down list object
* @param txt the text as a string (Only it's pointer is saved)
*/
void lv_dropdown_set_text(lv_obj_t * ddlist, const char * txt);
/**
* Clear any options in a drop down list. Static or dynamic.
* @param ddlist pointer to drop down list object
*/
void lv_dropdown_clear_options(lv_obj_t * ddlist);
/**
* Set the options in a drop down list from a string
* @param ddlist pointer to drop down list object
* @param options a string with '\n' separated options. E.g. "One\nTwo\nThree"
* The options string can be destroyed after calling this function
*/
void lv_dropdown_set_options(lv_obj_t * ddlist, const char * options);
/**
* Set the options in a drop down list from a string
* @param ddlist pointer to drop down list object
* @param options a static string with '\n' separated options. E.g. "One\nTwo\nThree"
*/
void lv_dropdown_set_options_static(lv_obj_t * ddlist, const char * options);
/**
* Add an options to a drop down list from a string. Only works for dynamic options.
* @param ddlist pointer to drop down list object
* @param option a string without '\n'. E.g. "Four"
* @param pos the insert position, indexed from 0, LV_DROPDOWN_POS_LAST = end of string
*/
void lv_dropdown_add_option(lv_obj_t * ddlist, const char * option, uint32_t pos);
/**
* Set the selected option
* @param ddlist pointer to drop down list object
* @param sel_opt id of the selected option (0 ... number of option - 1);
*/
void lv_dropdown_set_selected(lv_obj_t * ddlist, uint16_t sel_opt);
/**
* Set the direction of the a drop down list
* @param ddlist pointer to a drop down list object
* @param dir LV_DROPDOWN_DIR_LEF/RIGHT/TOP/BOTTOM
*/
void lv_dropdown_set_dir(lv_obj_t * ddlist, lv_dropdown_dir_t dir);
/**
* Set the maximal height for the drop down list
* @param ddlist pointer to a drop down list
* @param h the maximal height
*/
void lv_dropdown_set_max_height(lv_obj_t * ddlist, lv_coord_t h);
/**
* Set an arrow or other symbol to display when the drop-down list is closed.
* @param ddlist pointer to drop down list object
* @param symbol a text like `LV_SYMBOL_DOWN` or NULL to not draw icon
*/
void lv_dropdown_set_symbol(lv_obj_t * ddlist, const char * symbol);
/**
* Set whether the ddlist highlight the last selected option and display its text or not
* @param ddlist pointer to a drop down list object
* @param show true/false
*/
void lv_dropdown_set_show_selected(lv_obj_t * ddlist, bool show);
/*=====================
* Getter functions
*====================*/
/**
* Get text of the ddlist (Displayed on the button if `show_selected = false`)
* @param ddlist pointer to a drop down list object
* @return the text string
*/
const char * lv_dropdown_get_text(lv_obj_t * ddlist);
/**
* Get the options of a drop down list
* @param ddlist pointer to drop down list object
* @return the options separated by '\n'-s (E.g. "Option1\nOption2\nOption3")
*/
const char * lv_dropdown_get_options(const lv_obj_t * ddlist);
/**
* Get the selected option
* @param ddlist pointer to drop down list object
* @return id of the selected option (0 ... number of option - 1);
*/
uint16_t lv_dropdown_get_selected(const lv_obj_t * ddlist);
/**
* Get the total number of options
* @param ddlist pointer to drop down list object
* @return the total number of options in the list
*/
uint16_t lv_dropdown_get_option_cnt(const lv_obj_t * ddlist);
/**
* Get the current selected option as a string
* @param ddlist pointer to ddlist object
* @param buf pointer to an array to store the string
* @param buf_size size of `buf` in bytes. 0: to ignore it.
*/
void lv_dropdown_get_selected_str(const lv_obj_t * ddlist, char * buf, uint32_t buf_size);
/**
* Get the fix height value.
* @param ddlist pointer to a drop down list object
* @return the height if the ddlist is opened (0: auto size)
*/
lv_coord_t lv_dropdown_get_max_height(const lv_obj_t * ddlist);
/**
* Get the symbol to draw when the drop-down list is closed
* @param ddlist pointer to drop down list object
* @return the symbol or NULL if not enabled
*/
const char * lv_dropdown_get_symbol(lv_obj_t * ddlist);
/**
* Get the symbol to draw when the drop-down list is closed
* @param ddlist pointer to drop down list object
* @return the symbol or NULL if not enabled
*/
lv_dropdown_dir_t lv_dropdown_get_dir(const lv_obj_t * ddlist);
/**
* Get whether the ddlist highlight the last selected option and display its text or not
* @param ddlist pointer to a drop down list object
* @return true/false
*/
bool lv_dropdown_get_show_selected(lv_obj_t * ddlist);
/*=====================
* Other functions
*====================*/
/**
* Open the drop down list with or without animation
* @param ddlist pointer to drop down list object
*/
void lv_dropdown_open(lv_obj_t * ddlist);
/**
* Close (Collapse) the drop down list
* @param ddlist pointer to drop down list object
* @param anim_en LV_ANIM_ON: use animation; LV_ANOM_OFF: not use animations
*/
void lv_dropdown_close(lv_obj_t * ddlist);
/**********************
* MACROS
**********************/
#endif /*LV_USE_DROPDOWN*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_DROPDOWN_H*/
|
train_000.parquet/951
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_dropdown.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 7939,
"token_count": 2810
}
|
/**
* @file lv_spinbox.h
*
*/
#ifndef LV_SPINBOX_H
#define LV_SPINBOX_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_SPINBOX != 0
/*Testing of dependencies*/
#if LV_USE_TEXTAREA == 0
#error "lv_spinbox: lv_ta is required. Enable it in lv_conf.h (LV_USE_TEXTAREA 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "../lv_widgets/lv_textarea.h"
/*********************
* DEFINES
*********************/
#define LV_SPINBOX_MAX_DIGIT_COUNT 10
/**********************
* TYPEDEFS
**********************/
/*Data of spinbox*/
typedef struct {
lv_textarea_ext_t ta; /*Ext. of ancestor*/
/*New data for this type */
int32_t value;
int32_t range_max;
int32_t range_min;
int32_t step;
uint8_t rollover : 1; // Set to true for rollover functionality
uint16_t digit_count : 4;
uint16_t dec_point_pos : 4; /*if 0, there is no separator and the number is an integer*/
uint16_t digit_padding_left : 4;
} lv_spinbox_ext_t;
/*Styles*/
enum {
LV_SPINBOX_PART_BG = LV_TEXTAREA_PART_BG,
LV_SPINBOX_PART_CURSOR = LV_TEXTAREA_PART_CURSOR,
_LV_SPINBOX_PART_VIRTUAL_LAST = _LV_TEXTAREA_PART_VIRTUAL_LAST,
_LV_SPINBOX_PART_REAL_LAST = _LV_TEXTAREA_PART_REAL_LAST,
};
typedef uint8_t lv_spinbox_part_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a spinbox objects
* @param par pointer to an object, it will be the parent of the new spinbox
* @param copy pointer to a spinbox object, if not NULL then the new object will be copied from it
* @return pointer to the created spinbox
*/
lv_obj_t * lv_spinbox_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
*====================*/
/**
* Set spinbox rollover function
* @param spinbox pointer to spinbox
* @param b true or false to enable or disable (default)
*/
void lv_spinbox_set_rollover(lv_obj_t * spinbox, bool b);
/**
* Set spinbox value
* @param spinbox pointer to spinbox
* @param i value to be set
*/
void lv_spinbox_set_value(lv_obj_t * spinbox, int32_t i);
/**
* Set spinbox digit format (digit count and decimal format)
* @param spinbox pointer to spinbox
* @param digit_count number of digit excluding the decimal separator and the sign
* @param separator_position number of digit before the decimal point. If 0, decimal point is not
* shown
*/
void lv_spinbox_set_digit_format(lv_obj_t * spinbox, uint8_t digit_count, uint8_t separator_position);
/**
* Set spinbox step
* @param spinbox pointer to spinbox
* @param step steps on increment/decrement
*/
void lv_spinbox_set_step(lv_obj_t * spinbox, uint32_t step);
/**
* Set spinbox value range
* @param spinbox pointer to spinbox
* @param range_min maximum value, inclusive
* @param range_max minimum value, inclusive
*/
void lv_spinbox_set_range(lv_obj_t * spinbox, int32_t range_min, int32_t range_max);
/**
* Set spinbox left padding in digits count (added between sign and first digit)
* @param spinbox pointer to spinbox
* @param cb Callback function called on value change event
*/
void lv_spinbox_set_padding_left(lv_obj_t * spinbox, uint8_t padding);
/*=====================
* Getter functions
*====================*/
/**
* Get spinbox rollover function status
* @param spinbox pointer to spinbox
*/
bool lv_spinbox_get_rollover(lv_obj_t * spinbox);
/**
* Get the spinbox numeral value (user has to convert to float according to its digit format)
* @param spinbox pointer to spinbox
* @return value integer value of the spinbox
*/
int32_t lv_spinbox_get_value(lv_obj_t * spinbox);
/*=====================
* Other functions
*====================*/
/**
* Select next lower digit for edition by dividing the step by 10
* @param spinbox pointer to spinbox
*/
void lv_spinbox_step_next(lv_obj_t * spinbox);
/**
* Select next higher digit for edition by multiplying the step by 10
* @param spinbox pointer to spinbox
*/
void lv_spinbox_step_prev(lv_obj_t * spinbox);
/**
* Increment spinbox value by one step
* @param spinbox pointer to spinbox
*/
void lv_spinbox_increment(lv_obj_t * spinbox);
/**
* Decrement spinbox value by one step
* @param spinbox pointer to spinbox
*/
void lv_spinbox_decrement(lv_obj_t * spinbox);
/**********************
* MACROS
**********************/
#endif /*LV_USE_SPINBOX*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_SPINBOX_H*/
|
train_000.parquet/952
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_spinbox.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 4511,
"token_count": 1641
}
|
/**
* @file lv_cpicker.c
*
* From @AloyseTech and @paulpv.
*/
/*********************
* INCLUDES
*********************/
#include "lv_cpicker.h"
#if LV_USE_CPICKER != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw_arc.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_core/lv_indev.h"
#include "../lv_core/lv_refr.h"
#include "../lv_misc/lv_math.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_cpicker"
#ifndef LV_CPICKER_DEF_TYPE
#define LV_CPICKER_DEF_TYPE LV_CPICKER_TYPE_DISC
#endif
#ifndef LV_CPICKER_DEF_HUE
#define LV_CPICKER_DEF_HUE 0
#endif
#ifndef LV_CPICKER_DEF_SATURATION
#define LV_CPICKER_DEF_SATURATION 100
#endif
#ifndef LV_CPICKER_DEF_VALUE
#define LV_CPICKER_DEF_VALUE 100
#endif
#ifndef LV_CPICKER_DEF_HSV
#define LV_CPICKER_DEF_HSV ((lv_color_hsv_t){LV_CPICKER_DEF_HUE, LV_CPICKER_DEF_SATURATION, LV_CPICKER_DEF_VALUE})
#endif
#ifndef LV_CPICKER_DEF_QF /*quantization factor*/
#define LV_CPICKER_DEF_QF 3
#endif
#define TRI_OFFSET 2
/* The OUTER_MASK_WIDTH define is required to assist with the placing of a mask over the outer ring of the widget as when the
* multicoloured radial lines are calculated for the outer ring of the widget their lengths are jittering because of the
* integer based arithmetic. From tests the maximum delta was found to be 2 so the current value is set to 3 to achieve
* appropriate masking.
*/
#define OUTER_MASK_WIDTH 3
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_design_res_t lv_cpicker_design(lv_obj_t * cpicker, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_cpicker_signal(lv_obj_t * cpicker, lv_signal_t sign, void * param);
static lv_style_list_t * lv_cpicker_get_style(lv_obj_t * cpicker, uint8_t part);
static bool lv_cpicker_hit(lv_obj_t * cpicker, const lv_point_t * p);
static void draw_rect_grad(lv_obj_t * cpicker, const lv_area_t * mask);
static void draw_disc_grad(lv_obj_t * cpicker, const lv_area_t * mask);
static void draw_knob(lv_obj_t * cpicker, const lv_area_t * mask);
static void invalidate_knob(lv_obj_t * cpicker);
static lv_area_t get_knob_area(lv_obj_t * cpicker);
static void next_color_mode(lv_obj_t * cpicker);
static lv_res_t double_click_reset(lv_obj_t * cpicker);
static void refr_knob_pos(lv_obj_t * cpicker);
static lv_color_t angle_to_mode_color(lv_obj_t * cpicker, uint16_t angle);
static uint16_t get_angle(lv_obj_t * cpicker);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
static lv_design_cb_t ancestor_design;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a color_picker object
* @param par pointer to an object, it will be the parent of the new color_picker
* @param copy pointer to a color_picker object, if not NULL then the new object will be copied from it
* @return pointer to the created color_picker
*/
lv_obj_t * lv_cpicker_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("color_picker create started");
lv_obj_t * cpicker = lv_obj_create(par, copy);
LV_ASSERT_MEM(cpicker);
if(cpicker == NULL) return NULL;
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(cpicker);
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(cpicker);
/*Allocate the extended data*/
lv_cpicker_ext_t * ext = lv_obj_allocate_ext_attr(cpicker, sizeof(lv_cpicker_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(cpicker);
return NULL;
}
/*Initialize the allocated 'ext' */
ext->type = LV_CPICKER_DEF_TYPE;
ext->hsv = LV_CPICKER_DEF_HSV;
ext->knob.colored = 1;
ext->color_mode = LV_CPICKER_COLOR_MODE_HUE;
ext->color_mode_fixed = 0;
ext->last_click_time = 0;
ext->last_change_time = 0;
lv_style_list_init(&ext->knob.style_list);
/*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(cpicker, lv_cpicker_signal);
lv_obj_set_design_cb(cpicker, lv_cpicker_design);
/*If no copy do the basic initialization*/
if(copy == NULL) {
lv_obj_set_size(cpicker, LV_DPI * 2, LV_DPI * 2);
lv_obj_add_protect(cpicker, LV_PROTECT_PRESS_LOST);
lv_obj_set_adv_hittest(cpicker, true);
lv_theme_apply(cpicker, LV_THEME_CPICKER);
}
/*Copy 'copy'*/
else {
lv_cpicker_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->type = copy_ext->type;
ext->color_mode = copy_ext->color_mode;
ext->color_mode_fixed = copy_ext->color_mode_fixed;
ext->hsv = copy_ext->hsv;
ext->knob.colored = copy_ext->knob.colored;
lv_style_list_copy(&ext->knob.style_list, ©_ext->knob.style_list);
/*Refresh the style with new signal function*/
lv_obj_refresh_style(cpicker, LV_STYLE_PROP_ALL);
}
refr_knob_pos(cpicker);
LV_LOG_INFO("color_picker created");
return cpicker;
}
/*=====================
* Setter functions
*====================*/
/**
* Set a new type for a cpicker
* @param cpicker pointer to a cpicker object
* @param type new type of the cpicker (from 'lv_cpicker_type_t' enum)
*/
void lv_cpicker_set_type(lv_obj_t * cpicker, lv_cpicker_type_t type)
{
LV_ASSERT_OBJ(cpicker, LV_OBJX_NAME);
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
if(ext->type == type) return;
ext->type = type;
lv_obj_refresh_ext_draw_pad(cpicker);
refr_knob_pos(cpicker);
lv_obj_invalidate(cpicker);
}
/**
* Set the current hue of a colorpicker.
* @param cpicker pointer to colorpicker object
* @param hue current selected hue [0..360]
* @return true if changed, otherwise false
*/
bool lv_cpicker_set_hue(lv_obj_t * cpicker, uint16_t hue)
{
lv_color_hsv_t hsv = lv_cpicker_get_hsv(cpicker);
hsv.h = hue;
return lv_cpicker_set_hsv(cpicker, hsv);
}
/**
* Set the current saturation of a colorpicker.
* @param cpicker pointer to colorpicker object
* @param saturation current selected saturation [0..100]
* @return true if changed, otherwise false
*/
bool lv_cpicker_set_saturation(lv_obj_t * cpicker, uint8_t saturation)
{
lv_color_hsv_t hsv = lv_cpicker_get_hsv(cpicker);
hsv.s = saturation;
return lv_cpicker_set_hsv(cpicker, hsv);
}
/**
* Set the current value of a colorpicker.
* @param cpicker pointer to colorpicker object
* @param val current selected value [0..100]
* @return true if changed, otherwise false
*/
bool lv_cpicker_set_value(lv_obj_t * cpicker, uint8_t val)
{
lv_color_hsv_t hsv = lv_cpicker_get_hsv(cpicker);
hsv.v = val;
return lv_cpicker_set_hsv(cpicker, hsv);
}
/**
* Set the current hsv of a colorpicker.
* @param cpicker pointer to colorpicker object
* @param color current selected hsv
* @return true if changed, otherwise false
*/
bool lv_cpicker_set_hsv(lv_obj_t * cpicker, lv_color_hsv_t hsv)
{
LV_ASSERT_OBJ(cpicker, LV_OBJX_NAME);
if(hsv.h > 360) hsv.h %= 360;
if(hsv.s > 100) hsv.s = 100;
if(hsv.v > 100) hsv.v = 100;
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
if(ext->hsv.h == hsv.h && ext->hsv.s == hsv.s && ext->hsv.v == hsv.v) return false;
ext->hsv = hsv;
refr_knob_pos(cpicker);
lv_obj_invalidate(cpicker);
return true;
}
/**
* Set the current color of a colorpicker.
* @param cpicker pointer to colorpicker object
* @param color current selected color
* @return true if changed, otherwise false
*/
bool lv_cpicker_set_color(lv_obj_t * cpicker, lv_color_t color)
{
LV_ASSERT_OBJ(cpicker, LV_OBJX_NAME);
lv_color32_t c32;
c32.full = lv_color_to32(color);
return lv_cpicker_set_hsv(cpicker,
lv_color_rgb_to_hsv(c32.ch.red, c32.ch.green, c32.ch.blue));
}
/**
* Set the current color mode.
* @param cpicker pointer to colorpicker object
* @param mode color mode (hue/sat/val)
*/
void lv_cpicker_set_color_mode(lv_obj_t * cpicker, lv_cpicker_color_mode_t mode)
{
LV_ASSERT_OBJ(cpicker, LV_OBJX_NAME);
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
ext->color_mode = mode;
refr_knob_pos(cpicker);
lv_obj_invalidate(cpicker);
}
/**
* Set if the color mode is changed on long press on center
* @param cpicker pointer to colorpicker object
* @param fixed color mode cannot be changed on long press
*/
void lv_cpicker_set_color_mode_fixed(lv_obj_t * cpicker, bool fixed)
{
LV_ASSERT_OBJ(cpicker, LV_OBJX_NAME);
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
ext->color_mode_fixed = fixed;
}
/**
* Make the knob to be colored to the current color
* @param cpicker pointer to colorpicker object
* @param en true: color the knob; false: not color the knob
*/
void lv_cpicker_set_knob_colored(lv_obj_t * cpicker, bool en)
{
LV_ASSERT_OBJ(cpicker, LV_OBJX_NAME);
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
ext->knob.colored = en ? 1 : 0;
invalidate_knob(cpicker);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the current color mode.
* @param cpicker pointer to colorpicker object
* @return color mode (hue/sat/val)
*/
lv_cpicker_color_mode_t lv_cpicker_get_color_mode(lv_obj_t * cpicker)
{
LV_ASSERT_OBJ(cpicker, LV_OBJX_NAME);
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
return ext->color_mode;
}
/**
* Get if the color mode is changed on long press on center
* @param cpicker pointer to colorpicker object
* @return mode cannot be changed on long press
*/
bool lv_cpicker_get_color_mode_fixed(lv_obj_t * cpicker)
{
LV_ASSERT_OBJ(cpicker, LV_OBJX_NAME);
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
return ext->color_mode_fixed;
}
/**
* Get the current selected hue of a colorpicker.
* @param cpicker pointer to colorpicker object
* @return hue current selected hue
*/
uint16_t lv_cpicker_get_hue(lv_obj_t * cpicker)
{
LV_ASSERT_OBJ(cpicker, LV_OBJX_NAME);
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
return ext->hsv.h;
}
/**
* Get the current selected saturation of a colorpicker.
* @param cpicker pointer to colorpicker object
* @return current selected saturation
*/
uint8_t lv_cpicker_get_saturation(lv_obj_t * cpicker)
{
LV_ASSERT_OBJ(cpicker, LV_OBJX_NAME);
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
return ext->hsv.s;
}
/**
* Get the current selected hue of a colorpicker.
* @param cpicker pointer to colorpicker object
* @return current selected value
*/
uint8_t lv_cpicker_get_value(lv_obj_t * cpicker)
{
LV_ASSERT_OBJ(cpicker, LV_OBJX_NAME);
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
return ext->hsv.v;
}
/**
* Get the current selected hsv of a colorpicker.
* @param cpicker pointer to colorpicker object
* @return current selected hsv
*/
lv_color_hsv_t lv_cpicker_get_hsv(lv_obj_t * cpicker)
{
LV_ASSERT_OBJ(cpicker, LV_OBJX_NAME);
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
return ext->hsv;
}
/**
* Get the current selected color of a colorpicker.
* @param cpicker pointer to colorpicker object
* @return color current selected color
*/
lv_color_t lv_cpicker_get_color(lv_obj_t * cpicker)
{
LV_ASSERT_OBJ(cpicker, LV_OBJX_NAME);
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
return lv_color_hsv_to_rgb(ext->hsv.h, ext->hsv.s, ext->hsv.v);
}
/**
* Whether the knob is colored to the current color or not
* @param cpicker pointer to color picker object
* @return true: color the knob; false: not color the knob
*/
bool lv_cpicker_get_knob_colored(lv_obj_t * cpicker)
{
LV_ASSERT_OBJ(cpicker, LV_OBJX_NAME);
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
return ext->knob.colored ? true : false;
}
/*=====================
* Other functions
*====================*/
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the color_picker
* @param cpicker pointer to an object
* @param mask the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @return return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_cpicker_design(lv_obj_t * cpicker, const lv_area_t * clip_area, lv_design_mode_t mode)
{
/*Return false if the object is not covers the mask_p area*/
if(mode == LV_DESIGN_COVER_CHK) {
return LV_DESIGN_RES_NOT_COVER;
}
/*Draw the object*/
else if(mode == LV_DESIGN_DRAW_MAIN) {
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
if(ext->type == LV_CPICKER_TYPE_DISC) {
draw_disc_grad(cpicker, clip_area);
}
else if(ext->type == LV_CPICKER_TYPE_RECT) {
draw_rect_grad(cpicker, clip_area);
}
draw_knob(cpicker, clip_area);
}
/*Post draw when the children are drawn*/
else if(mode == LV_DESIGN_DRAW_POST) {
}
return LV_DESIGN_RES_OK;
}
static void draw_disc_grad(lv_obj_t * cpicker, const lv_area_t * mask)
{
lv_coord_t w = lv_obj_get_width(cpicker);
lv_coord_t h = lv_obj_get_height(cpicker);
lv_coord_t cx = cpicker->coords.x1 + w / 2;
lv_coord_t cy = cpicker->coords.y1 + h / 2;
lv_coord_t r = w / 2;
lv_draw_line_dsc_t line_dsc;
lv_draw_line_dsc_init(&line_dsc);
lv_obj_init_draw_line_dsc(cpicker, LV_CPICKER_PART_MAIN, &line_dsc);
line_dsc.width = (r * 628 / (360 / LV_CPICKER_DEF_QF)) / 100;
line_dsc.width += 2;
uint16_t i;
lv_coord_t cir_w = lv_obj_get_style_scale_width(cpicker, LV_CPICKER_PART_MAIN);
/* Mask outer ring of widget to tidy up ragged edges of lines while drawing outer ring */
lv_area_t mask_area_out;
lv_area_copy(&mask_area_out, &cpicker->coords);
mask_area_out.x1 += OUTER_MASK_WIDTH;
mask_area_out.x2 -= OUTER_MASK_WIDTH;
mask_area_out.y1 += OUTER_MASK_WIDTH;
mask_area_out.y2 -= OUTER_MASK_WIDTH;
lv_draw_mask_radius_param_t mask_out_param;
lv_draw_mask_radius_init(&mask_out_param, &mask_area_out, LV_RADIUS_CIRCLE, false);
int16_t mask_out_id = lv_draw_mask_add(&mask_out_param, 0);
/* The inner line ends will be masked out.
* So make lines a little bit longer because the masking makes a more even result */
lv_coord_t cir_w_extra = cir_w + line_dsc.width;
for(i = 0; i <= 360; i += LV_CPICKER_DEF_QF) {
line_dsc.color = angle_to_mode_color(cpicker, i);
lv_point_t p[2];
p[0].x = cx + (r * _lv_trigo_sin(i) >> LV_TRIGO_SHIFT);
p[0].y = cy + (r * _lv_trigo_sin(i + 90) >> LV_TRIGO_SHIFT);
p[1].x = cx + ((r - cir_w_extra) * _lv_trigo_sin(i) >> LV_TRIGO_SHIFT);
p[1].y = cy + ((r - cir_w_extra) * _lv_trigo_sin(i + 90) >> LV_TRIGO_SHIFT);
lv_draw_line(&p[0], &p[1], mask, &line_dsc);
}
/* Now remove mask to continue with inner part */
lv_draw_mask_remove_id(mask_out_id);
/*Mask out the inner area*/
lv_draw_rect_dsc_t bg_dsc;
lv_draw_rect_dsc_init(&bg_dsc);
lv_obj_init_draw_rect_dsc(cpicker, LV_CPICKER_PART_MAIN, &bg_dsc);
bg_dsc.radius = LV_RADIUS_CIRCLE;
lv_area_t area_mid;
lv_area_copy(&area_mid, &cpicker->coords);
area_mid.x1 += cir_w;
area_mid.y1 += cir_w;
area_mid.x2 -= cir_w;
area_mid.y2 -= cir_w;
lv_draw_rect(&area_mid, mask, &bg_dsc);
lv_style_int_t inner = lv_obj_get_style_pad_inner(cpicker, LV_CPICKER_PART_MAIN);
lv_color_t color = lv_cpicker_get_color(cpicker);
bg_dsc.bg_color = color;
area_mid.x1 += inner;
area_mid.y1 += inner;
area_mid.x2 -= inner;
area_mid.y2 -= inner;
lv_draw_rect(&area_mid, mask, &bg_dsc);
}
static void draw_rect_grad(lv_obj_t * cpicker, const lv_area_t * mask)
{
lv_draw_rect_dsc_t bg_dsc;
lv_draw_rect_dsc_init(&bg_dsc);
lv_obj_init_draw_rect_dsc(cpicker, LV_CPICKER_PART_MAIN, &bg_dsc);
lv_area_t grad_area;
lv_obj_get_coords(cpicker, &grad_area);
if(bg_dsc.radius) {
lv_coord_t h = lv_obj_get_height(cpicker);
lv_coord_t r = bg_dsc.radius;
if(r > h / 2) r = h / 2;
/*Make the gradient area smaller with a half circle on both ends*/
grad_area.x1 += r;
grad_area.x2 -= r;
/*Draw the left rounded end*/
lv_area_t rounded_edge_area;
lv_obj_get_coords(cpicker, &rounded_edge_area);
rounded_edge_area.x2 = rounded_edge_area.x1 + 2 * r;
bg_dsc.bg_color = angle_to_mode_color(cpicker, 0);
lv_draw_rect(&rounded_edge_area, mask, &bg_dsc);
/*Draw the right rounded end*/
lv_obj_get_coords(cpicker, &rounded_edge_area);
rounded_edge_area.x1 = rounded_edge_area.x2 - 2 * r;
bg_dsc.bg_color = angle_to_mode_color(cpicker, 359);
lv_draw_rect(&rounded_edge_area, mask, &bg_dsc);
}
lv_coord_t grad_w = lv_area_get_width(&grad_area);
uint16_t i_step = LV_MATH_MAX(LV_CPICKER_DEF_QF, 360 / grad_w);
bg_dsc.radius = 0;
bg_dsc.border_width = 0;
bg_dsc.shadow_width = 0;
uint16_t i;
for(i = 0; i < 360; i += i_step) {
bg_dsc.bg_color = angle_to_mode_color(cpicker, i);
/*the following attribute might need changing between index to add border, shadow, radius etc*/
lv_area_t rect_area;
/*scale angle (hue/sat/val) to linear coordinate*/
lv_coord_t xi = (i * grad_w) / 360;
lv_coord_t xi2 = ((i + i_step) * grad_w) / 360;
rect_area.x1 = LV_MATH_MIN(grad_area.x1 + xi, grad_area.x1 + grad_w - i_step);
rect_area.y1 = grad_area.y1;
rect_area.x2 = LV_MATH_MIN(grad_area.x1 + xi2, grad_area.x1 + grad_w - i_step);
rect_area.y2 = grad_area.y2;
lv_draw_rect(&rect_area, mask, &bg_dsc);
}
}
static void draw_knob(lv_obj_t * cpicker, const lv_area_t * mask)
{
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
lv_draw_rect_dsc_t cir_dsc;
lv_draw_rect_dsc_init(&cir_dsc);
lv_obj_init_draw_rect_dsc(cpicker, LV_CPICKER_PART_KNOB, &cir_dsc);
cir_dsc.radius = LV_RADIUS_CIRCLE;
if(ext->knob.colored) {
cir_dsc.bg_color = lv_cpicker_get_color(cpicker);
}
lv_area_t knob_area = get_knob_area(cpicker);
lv_draw_rect(&knob_area, mask, &cir_dsc);
}
static void invalidate_knob(lv_obj_t * cpicker)
{
lv_area_t knob_area = get_knob_area(cpicker);
lv_obj_invalidate_area(cpicker, &knob_area);
}
static lv_area_t get_knob_area(lv_obj_t * cpicker)
{
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
/*Get knob's radius*/
uint16_t r = 0;
if(ext->type == LV_CPICKER_TYPE_DISC) {
r = lv_obj_get_style_scale_width(cpicker, LV_CPICKER_PART_MAIN) / 2;
}
else if(ext->type == LV_CPICKER_TYPE_RECT) {
lv_coord_t h = lv_obj_get_height(cpicker);
r = h / 2;
}
lv_style_int_t left = lv_obj_get_style_pad_left(cpicker, LV_CPICKER_PART_KNOB);
lv_style_int_t right = lv_obj_get_style_pad_right(cpicker, LV_CPICKER_PART_KNOB);
lv_style_int_t top = lv_obj_get_style_pad_top(cpicker, LV_CPICKER_PART_KNOB);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(cpicker, LV_CPICKER_PART_KNOB);
lv_area_t knob_area;
knob_area.x1 = cpicker->coords.x1 + ext->knob.pos.x - r - left;
knob_area.y1 = cpicker->coords.y1 + ext->knob.pos.y - r - right;
knob_area.x2 = cpicker->coords.x1 + ext->knob.pos.x + r + top;
knob_area.y2 = cpicker->coords.y1 + ext->knob.pos.y + r + bottom;
return knob_area;
}
/**
* Signal function of the color_picker
* @param cpicker pointer to a color_picker object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_cpicker_signal(lv_obj_t * cpicker, lv_signal_t sign, void * param)
{
/* Include the ancient signal function */
lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_cpicker_get_style(cpicker, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(cpicker, sign, param);
}
res = ancestor_signal(cpicker, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
if(sign == LV_SIGNAL_CLEANUP) {
lv_obj_clean_style_list(cpicker, LV_CPICKER_PART_KNOB);
}
else if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
lv_style_int_t left = lv_obj_get_style_pad_left(cpicker, LV_CPICKER_PART_KNOB);
lv_style_int_t right = lv_obj_get_style_pad_right(cpicker, LV_CPICKER_PART_KNOB);
lv_style_int_t top = lv_obj_get_style_pad_top(cpicker, LV_CPICKER_PART_KNOB);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(cpicker, LV_CPICKER_PART_KNOB);
lv_coord_t knob_pad = LV_MATH_MAX4(left, right, top, bottom) + 2;
if(ext->type == LV_CPICKER_TYPE_DISC) {
cpicker->ext_draw_pad = LV_MATH_MAX(cpicker->ext_draw_pad, knob_pad);
}
else {
knob_pad += lv_obj_get_height(cpicker) / 2;
cpicker->ext_draw_pad = LV_MATH_MAX(cpicker->ext_draw_pad, knob_pad);
}
}
else if(sign == LV_SIGNAL_COORD_CHG) {
/*Refresh extended draw area to make knob visible*/
if(lv_obj_get_width(cpicker) != lv_area_get_width(param) ||
lv_obj_get_height(cpicker) != lv_area_get_height(param)) {
lv_obj_refresh_ext_draw_pad(cpicker);
refr_knob_pos(cpicker);
lv_obj_invalidate(cpicker);
}
}
else if(sign == LV_SIGNAL_STYLE_CHG) {
/*Refresh extended draw area to make knob visible*/
lv_obj_refresh_ext_draw_pad(cpicker);
refr_knob_pos(cpicker);
lv_obj_invalidate(cpicker);
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
uint32_t c = *((uint32_t *)param); /*uint32_t because can be UTF-8*/
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
lv_color_hsv_t hsv_cur;
hsv_cur = ext->hsv;
switch(ext->color_mode) {
case LV_CPICKER_COLOR_MODE_HUE:
hsv_cur.h = (ext->hsv.h + 1) % 360;
break;
case LV_CPICKER_COLOR_MODE_SATURATION:
hsv_cur.s = (ext->hsv.s + 1) % 100;
break;
case LV_CPICKER_COLOR_MODE_VALUE:
hsv_cur.v = (ext->hsv.v + 1) % 100;
break;
}
if(lv_cpicker_set_hsv(cpicker, hsv_cur)) {
res = lv_event_send(cpicker, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RES_OK) return res;
}
}
else if(c == LV_KEY_LEFT || c == LV_KEY_DOWN) {
lv_color_hsv_t hsv_cur;
hsv_cur = ext->hsv;
switch(ext->color_mode) {
case LV_CPICKER_COLOR_MODE_HUE:
hsv_cur.h = ext->hsv.h > 0 ? (ext->hsv.h - 1) : 360;
break;
case LV_CPICKER_COLOR_MODE_SATURATION:
hsv_cur.s = ext->hsv.s > 0 ? (ext->hsv.s - 1) : 100;
break;
case LV_CPICKER_COLOR_MODE_VALUE:
hsv_cur.v = ext->hsv.v > 0 ? (ext->hsv.v - 1) : 100;
break;
}
if(lv_cpicker_set_hsv(cpicker, hsv_cur)) {
res = lv_event_send(cpicker, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RES_OK) return res;
}
}
#endif
}
else if(sign == LV_SIGNAL_PRESSED) {
ext->last_change_time = lv_tick_get();
lv_indev_get_point(lv_indev_get_act(), &ext->last_press_point);
res = double_click_reset(cpicker);
if(res != LV_RES_OK) return res;
}
else if(sign == LV_SIGNAL_PRESSING) {
lv_indev_t * indev = lv_indev_get_act();
if(indev == NULL) return res;
lv_indev_type_t indev_type = lv_indev_get_type(indev);
lv_point_t p;
if(indev_type == LV_INDEV_TYPE_ENCODER || indev_type == LV_INDEV_TYPE_KEYPAD) {
p.x = cpicker->coords.x1 + lv_obj_get_width(cpicker) / 2;
p.y = cpicker->coords.y1 + lv_obj_get_height(cpicker) / 2;
}
else {
lv_indev_get_point(indev, &p);
}
if((LV_MATH_ABS(p.x - ext->last_press_point.x) > indev->driver.drag_limit / 2) ||
(LV_MATH_ABS(p.y - ext->last_press_point.y) > indev->driver.drag_limit / 2)) {
ext->last_change_time = lv_tick_get();
ext->last_press_point.x = p.x;
ext->last_press_point.y = p.y;
}
p.x -= cpicker->coords.x1;
p.y -= cpicker->coords.y1;
/*Ignore pressing in the inner area*/
uint16_t w = lv_obj_get_width(cpicker);
int16_t angle = 0;
if(ext->type == LV_CPICKER_TYPE_RECT) {
/*If pressed long enough without change go to next color mode*/
uint32_t diff = lv_tick_elaps(ext->last_change_time);
if(diff > (uint32_t)indev->driver.long_press_time * 2 && !ext->color_mode_fixed) {
next_color_mode(cpicker);
lv_indev_wait_release(lv_indev_get_act());
return res;
}
angle = (p.x * 360) / w;
if(angle < 0) angle = 0;
if(angle >= 360) angle = 359;
}
else if(ext->type == LV_CPICKER_TYPE_DISC) {
lv_style_int_t scale_w = lv_obj_get_style_scale_width(cpicker, LV_CPICKER_PART_MAIN);
lv_coord_t r_in = w / 2;
p.x -= r_in;
p.y -= r_in;
bool on_ring = true;
r_in -= scale_w;
if(r_in > LV_DPI / 2) {
lv_style_int_t inner = lv_obj_get_style_pad_inner(cpicker, LV_CPICKER_PART_MAIN);
r_in -= inner;
if(r_in < LV_DPI / 2) r_in = LV_DPI / 2;
}
if(p.x * p.x + p.y * p.y < r_in * r_in) {
on_ring = false;
}
/*If the inner area is being pressed, go to the next color mode on long press*/
uint32_t diff = lv_tick_elaps(ext->last_change_time);
if(!on_ring && diff > indev->driver.long_press_time && !ext->color_mode_fixed) {
next_color_mode(cpicker);
lv_indev_wait_release(lv_indev_get_act());
return res;
}
/*Set the angle only if pressed on the ring*/
if(!on_ring) return res;
angle = _lv_atan2(p.x, p.y) % 360;
}
lv_color_hsv_t hsv_cur;
hsv_cur = ext->hsv;
switch(ext->color_mode) {
case LV_CPICKER_COLOR_MODE_HUE:
hsv_cur.h = angle;
break;
case LV_CPICKER_COLOR_MODE_SATURATION:
hsv_cur.s = (angle * 100) / 360;
break;
case LV_CPICKER_COLOR_MODE_VALUE:
hsv_cur.v = (angle * 100) / 360;
break;
}
if(lv_cpicker_set_hsv(cpicker, hsv_cur)) {
res = lv_event_send(cpicker, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RES_OK) return res;
}
}
else if(sign == LV_SIGNAL_HIT_TEST) {
lv_hit_test_info_t * info = param;
info->result = lv_cpicker_hit(cpicker, info->point);
}
return res;
}
/**
* Get the style_list descriptor of a part of the object
* @param cpicker pointer the object
* @param part the part of the cpicker. (LV_PAGE_CPICKER_...)
* @return pointer to the style_list descriptor of the specified part
*/
static lv_style_list_t * lv_cpicker_get_style(lv_obj_t * cpicker, uint8_t part)
{
LV_ASSERT_OBJ(cpicker, LV_OBJX_NAME);
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
lv_style_list_t * style_dsc_p;
switch(part) {
case LV_CPICKER_PART_MAIN :
style_dsc_p = &cpicker->style_list;
break;
case LV_CPICKER_PART_KNOB:
style_dsc_p = &ext->knob.style_list;
break;
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
static bool lv_cpicker_hit(lv_obj_t * cpicker, const lv_point_t * p)
{
bool is_point_on_coords = lv_obj_is_point_on_coords(cpicker, p);
if(!is_point_on_coords)
return false;
lv_cpicker_ext_t * ext = (lv_cpicker_ext_t *)lv_obj_get_ext_attr(cpicker);
if(ext->type == LV_CPICKER_TYPE_RECT)
return true;
/*Valid clicks can be only in the circle*/
if(_lv_area_is_point_on(&cpicker->coords, p, LV_RADIUS_CIRCLE)) return true;
else return false;
}
static void next_color_mode(lv_obj_t * cpicker)
{
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
ext->color_mode = (ext->color_mode + 1) % 3;
refr_knob_pos(cpicker);
lv_obj_invalidate(cpicker);
}
static void refr_knob_pos(lv_obj_t * cpicker)
{
invalidate_knob(cpicker);
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
lv_coord_t w = lv_obj_get_width(cpicker);
lv_coord_t h = lv_obj_get_height(cpicker);
if(ext->type == LV_CPICKER_TYPE_RECT) {
lv_coord_t ind_pos = 0;
switch(ext->color_mode) {
case LV_CPICKER_COLOR_MODE_HUE:
ind_pos += (ext->hsv.h * w) / 360;
break;
case LV_CPICKER_COLOR_MODE_SATURATION:
ind_pos += (ext->hsv.s * w) / 100;
break;
case LV_CPICKER_COLOR_MODE_VALUE:
ind_pos += (ext->hsv.v * w) / 100;
break;
}
ext->knob.pos.x = ind_pos;
ext->knob.pos.y = h / 2;
}
else if(ext->type == LV_CPICKER_TYPE_DISC) {
lv_style_int_t scale_w = lv_obj_get_style_scale_width(cpicker, LV_CPICKER_PART_MAIN);
lv_coord_t r = (w - scale_w) / 2;
uint16_t angle = get_angle(cpicker);
ext->knob.pos.x = (((int32_t)r * _lv_trigo_sin(angle)) >> LV_TRIGO_SHIFT);
ext->knob.pos.y = (((int32_t)r * _lv_trigo_sin(angle + 90)) >> LV_TRIGO_SHIFT);
ext->knob.pos.x = ext->knob.pos.x + w / 2;
ext->knob.pos.y = ext->knob.pos.y + h / 2;
}
invalidate_knob(cpicker);
}
static lv_res_t double_click_reset(lv_obj_t * cpicker)
{
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
lv_indev_t * indev = lv_indev_get_act();
/*Double clicked? Use long press time as double click time out*/
if(lv_tick_elaps(ext->last_click_time) < indev->driver.long_press_time) {
lv_color_hsv_t hsv_cur;
hsv_cur = ext->hsv;
switch(ext->color_mode) {
case LV_CPICKER_COLOR_MODE_HUE:
hsv_cur.h = LV_CPICKER_DEF_HUE;
break;
case LV_CPICKER_COLOR_MODE_SATURATION:
hsv_cur.s = LV_CPICKER_DEF_SATURATION;
break;
case LV_CPICKER_COLOR_MODE_VALUE:
hsv_cur.v = LV_CPICKER_DEF_VALUE;
break;
}
lv_indev_wait_release(indev);
if(lv_cpicker_set_hsv(cpicker, hsv_cur)) {
lv_res_t res = lv_event_send(cpicker, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RES_OK) return res;
}
}
ext->last_click_time = lv_tick_get();
return LV_RES_OK;
}
static lv_color_t angle_to_mode_color(lv_obj_t * cpicker, uint16_t angle)
{
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
lv_color_t color;
switch(ext->color_mode) {
default:
case LV_CPICKER_COLOR_MODE_HUE:
color = lv_color_hsv_to_rgb(angle % 360, ext->hsv.s, ext->hsv.v);
break;
case LV_CPICKER_COLOR_MODE_SATURATION:
color = lv_color_hsv_to_rgb(ext->hsv.h, ((angle % 360) * 100) / 360, ext->hsv.v);
break;
case LV_CPICKER_COLOR_MODE_VALUE:
color = lv_color_hsv_to_rgb(ext->hsv.h, ext->hsv.s, ((angle % 360) * 100) / 360);
break;
}
return color;
}
static uint16_t get_angle(lv_obj_t * cpicker)
{
lv_cpicker_ext_t * ext = lv_obj_get_ext_attr(cpicker);
uint16_t angle;
switch(ext->color_mode) {
default:
case LV_CPICKER_COLOR_MODE_HUE:
angle = ext->hsv.h;
break;
case LV_CPICKER_COLOR_MODE_SATURATION:
angle = (ext->hsv.s * 360) / 100;
break;
case LV_CPICKER_COLOR_MODE_VALUE:
angle = (ext->hsv.v * 360) / 100 ;
break;
}
return angle;
}
#endif /* LV_USE_CPICKER != 0 */
|
train_000.parquet/953
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_cpicker.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 33137,
"token_count": 13594
}
|
/**
* @file lv_calendar.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_calendar.h"
#if LV_USE_CALENDAR != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_hal/lv_hal_indev.h"
#include "../lv_misc/lv_utils.h"
#include "../lv_core/lv_indev.h"
#include "../lv_themes/lv_theme.h"
#include <string.h>
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_calendar"
/**********************
* TYPEDEFS
**********************/
enum {
DAY_DRAW_PREV_MONTH,
DAY_DRAW_ACT_MONTH,
DAY_DRAW_NEXT_MONTH,
};
typedef uint8_t day_draw_state_t;
/**********************
* STATIC PROTOTYPES
**********************/
static lv_design_res_t lv_calendar_design(lv_obj_t * calendar, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void * param);
static lv_style_list_t * lv_calendar_get_style(lv_obj_t * calendar, uint8_t part);
static bool calculate_touched_day(lv_obj_t * calendar, const lv_point_t * touched_point);
static lv_coord_t get_header_height(lv_obj_t * calendar);
static lv_coord_t get_day_names_height(lv_obj_t * calendar);
static void draw_header(lv_obj_t * calendar, const lv_area_t * mask);
static void draw_day_names(lv_obj_t * calendar, const lv_area_t * mask);
static void draw_dates(lv_obj_t * calendar, const lv_area_t * clip_area);
static uint8_t get_day_of_week(uint32_t year, uint32_t month, uint32_t day);
static bool is_highlighted(lv_obj_t * calendar, day_draw_state_t draw_state, int32_t year, int32_t month, int32_t day);
static bool is_pressed(lv_obj_t * calendar, day_draw_state_t draw_state, int32_t year, int32_t month, int32_t day);
static const char * get_day_name(lv_obj_t * calendar, uint8_t day);
static const char * get_month_name(lv_obj_t * calendar, int32_t month);
static uint8_t get_month_length(int32_t year, int32_t month);
static uint8_t is_leap_year(uint32_t year);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
static lv_design_cb_t ancestor_design;
#if LV_CALENDAR_WEEK_STARTS_MONDAY != 0
static const char * day_name[7] = {"Mo", "Tu", "We", "Th", "Fr", "Sa", "Su"};
#else
static const char * day_name[7] = {"Su", "Mo", "Tu", "We", "Th", "Fr", "Sa"};
#endif
static const char * month_name[12] = {"January", "February", "March", "April", "May", "June",
"July", "August", "September", "October", "November", "December"
};
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a calendar object
* @param par pointer to an object, it will be the parent of the new calendar
* @param copy pointer to a calendar object, if not NULL then the new object will be copied from it
* @return pointer to the created calendar
*/
lv_obj_t * lv_calendar_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("calendar create started");
/*Create the ancestor of calendar*/
lv_obj_t * calendar = lv_obj_create(par, copy);
LV_ASSERT_MEM(calendar);
if(calendar == NULL) return NULL;
/*Allocate the calendar type specific extended data*/
lv_calendar_ext_t * ext = lv_obj_allocate_ext_attr(calendar, sizeof(lv_calendar_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(calendar);
return NULL;
}
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(calendar);
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(calendar);
/*Initialize the allocated 'ext' */
ext->today.year = 2020;
ext->today.month = 1;
ext->today.day = 1;
ext->showed_date.year = 2020;
ext->showed_date.month = 1;
ext->showed_date.day = 1;
ext->pressed_date.year = 0;
ext->pressed_date.month = 0;
ext->pressed_date.day = 0;
ext->highlighted_dates = NULL;
ext->highlighted_dates_num = 0;
ext->day_names = NULL;
ext->month_names = NULL;
ext->btn_pressing = 0;
lv_style_list_init(&ext->style_date_nums);
lv_style_list_init(&ext->style_day_names);
lv_style_list_init(&ext->style_header);
ext->style_date_nums.skip_trans = 1;
ext->style_day_names.skip_trans = 1;
ext->style_header.skip_trans = 1;
/*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(calendar, lv_calendar_signal);
lv_obj_set_design_cb(calendar, lv_calendar_design);
/*Init the new calendar calendar*/
if(copy == NULL) {
lv_theme_apply(calendar, LV_THEME_CALENDAR);
lv_obj_set_size(calendar, 5 * LV_DPI / 2, 5 * LV_DPI / 2);
}
/*Copy an existing calendar*/
else {
lv_calendar_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->today.year = copy_ext->today.year;
ext->today.month = copy_ext->today.month;
ext->today.day = copy_ext->today.day;
ext->showed_date.year = copy_ext->showed_date.year;
ext->showed_date.month = copy_ext->showed_date.month;
ext->showed_date.day = copy_ext->showed_date.day;
ext->highlighted_dates = copy_ext->highlighted_dates;
ext->highlighted_dates_num = copy_ext->highlighted_dates_num;
ext->day_names = copy_ext->day_names;
ext->month_names = copy_ext->month_names;
ext->style_header = copy_ext->style_header;
ext->style_day_names = copy_ext->style_day_names;
/*Refresh the style with new signal function*/
// lv_obj_refresh_style(new_calendar);
}
LV_LOG_INFO("calendar created");
return calendar;
}
/*======================
* Add/remove functions
*=====================*/
/*
* New object specific "add" or "remove" functions come here
*/
/*=====================
* Setter functions
*====================*/
/**
* Set the today's date
* @param calendar pointer to a calendar object
* @param today pointer to an `lv_calendar_date_t` variable containing the date of today. The value
* will be saved it can be local variable too.
*/
void lv_calendar_set_today_date(lv_obj_t * calendar, lv_calendar_date_t * today)
{
LV_ASSERT_OBJ(calendar, LV_OBJX_NAME);
LV_ASSERT_NULL(today);
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
ext->today.year = today->year;
ext->today.month = today->month;
ext->today.day = today->day;
lv_obj_invalidate(calendar);
}
/**
* Set the currently showed
* @param calendar pointer to a calendar object
* @param showed pointer to an `lv_calendar_date_t` variable containing the date to show. The value
* will be saved it can be local variable too.
*/
void lv_calendar_set_showed_date(lv_obj_t * calendar, lv_calendar_date_t * showed)
{
LV_ASSERT_OBJ(calendar, LV_OBJX_NAME);
LV_ASSERT_NULL(showed);
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
ext->showed_date.year = showed->year;
ext->showed_date.month = showed->month;
ext->showed_date.day = showed->day;
lv_obj_invalidate(calendar);
}
/**
* Set the the highlighted dates
* @param calendar pointer to a calendar object
* @param highlighted pointer to an `lv_calendar_date_t` array containing the dates. ONLY A POINTER
* WILL BE SAVED! CAN'T BE LOCAL ARRAY.
* @param date_num number of dates in the array
*/
void lv_calendar_set_highlighted_dates(lv_obj_t * calendar, lv_calendar_date_t highlighted[], uint16_t date_num)
{
LV_ASSERT_OBJ(calendar, LV_OBJX_NAME);
LV_ASSERT_NULL(highlighted);
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
ext->highlighted_dates = highlighted;
ext->highlighted_dates_num = date_num;
lv_obj_invalidate(calendar);
}
/**
* Set the name of the days
* @param calendar pointer to a calendar object
* @param day_names pointer to an array with the names. E.g. `const char * days[7] = {"Sun", "Mon",
* ...}` Only the pointer will be saved so this variable can't be local which will be destroyed
* later.
*/
void lv_calendar_set_day_names(lv_obj_t * calendar, const char ** day_names)
{
LV_ASSERT_OBJ(calendar, LV_OBJX_NAME);
LV_ASSERT_NULL(day_names);
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
ext->day_names = day_names;
lv_obj_invalidate(calendar);
}
/**
* Set the name of the month
* @param calendar pointer to a calendar object
* @param month_names pointer to an array with the names. E.g. `const char * days[12] = {"Jan", "Feb",
* ...}` Only the pointer will be saved so this variable can't be local which will be destroyed
* later.
*/
void lv_calendar_set_month_names(lv_obj_t * calendar, const char ** month_names)
{
LV_ASSERT_OBJ(calendar, LV_OBJX_NAME);
LV_ASSERT_NULL(month_names);
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
ext->month_names = month_names;
lv_obj_invalidate(calendar);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the today's date
* @param calendar pointer to a calendar object
* @return return pointer to an `lv_calendar_date_t` variable containing the date of today.
*/
lv_calendar_date_t * lv_calendar_get_today_date(const lv_obj_t * calendar)
{
LV_ASSERT_OBJ(calendar, LV_OBJX_NAME);
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
return &ext->today;
}
/**
* Get the currently showed
* @param calendar pointer to a calendar object
* @return pointer to an `lv_calendar_date_t` variable containing the date is being shown.
*/
lv_calendar_date_t * lv_calendar_get_showed_date(const lv_obj_t * calendar)
{
LV_ASSERT_OBJ(calendar, LV_OBJX_NAME);
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
return &ext->showed_date;
}
/**
* Get the the pressed date.
* @param calendar pointer to a calendar object
* @return pointer to an `lv_calendar_date_t` variable containing the pressed date.
* `NULL` if not date pressed (e.g. the header)
*/
lv_calendar_date_t * lv_calendar_get_pressed_date(const lv_obj_t * calendar)
{
LV_ASSERT_OBJ(calendar, LV_OBJX_NAME);
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
return ext->pressed_date.year != 0 ? &ext->pressed_date : NULL;
}
/**
* Get the the highlighted dates
* @param calendar pointer to a calendar object
* @return pointer to an `lv_calendar_date_t` array containing the dates.
*/
lv_calendar_date_t * lv_calendar_get_highlighted_dates(const lv_obj_t * calendar)
{
LV_ASSERT_OBJ(calendar, LV_OBJX_NAME);
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
return ext->highlighted_dates;
}
/**
* Get the number of the highlighted dates
* @param calendar pointer to a calendar object
* @return number of highlighted days
*/
uint16_t lv_calendar_get_highlighted_dates_num(const lv_obj_t * calendar)
{
LV_ASSERT_OBJ(calendar, LV_OBJX_NAME);
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
return ext->highlighted_dates_num;
}
/**
* Get the name of the days
* @param calendar pointer to a calendar object
* @return pointer to the array of day names
*/
const char ** lv_calendar_get_day_names(const lv_obj_t * calendar)
{
LV_ASSERT_OBJ(calendar, LV_OBJX_NAME);
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
return ext->day_names;
}
/**
* Get the name of the month
* @param calendar pointer to a calendar object
* @return pointer to the array of month names
*/
const char ** lv_calendar_get_month_names(const lv_obj_t * calendar)
{
LV_ASSERT_OBJ(calendar, LV_OBJX_NAME);
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
return ext->month_names;
}
/*=====================
* Other functions
*====================*/
/*
* New object specific "other" functions come here
*/
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the calendars
* @param calendar pointer to an object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_calendar_design(lv_obj_t * calendar, const lv_area_t * clip_area, lv_design_mode_t mode)
{
/*Return false if the object is not covers the mask_p area*/
if(mode == LV_DESIGN_COVER_CHK) {
return ancestor_design(calendar, clip_area, mode);
}
/*Draw the object*/
else if(mode == LV_DESIGN_DRAW_MAIN) {
ancestor_design(calendar, clip_area, mode);
draw_header(calendar, clip_area);
draw_day_names(calendar, clip_area);
draw_dates(calendar, clip_area);
}
/*Post draw when the children are drawn*/
else if(mode == LV_DESIGN_DRAW_POST) {
ancestor_design(calendar, clip_area, mode);
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the calendar
* @param calendar pointer to a calendar object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_calendar_signal(lv_obj_t * calendar, lv_signal_t sign, void * param)
{
lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_calendar_get_style(calendar, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(calendar, sign, param);
return LV_RES_OK;
}
/* Include the ancient signal function */
res = ancestor_signal(calendar, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
if(sign == LV_SIGNAL_CLEANUP) {
lv_obj_clean_style_list(calendar, LV_CALENDAR_PART_HEADER);
lv_obj_clean_style_list(calendar, LV_CALENDAR_PART_DAY_NAMES);
lv_obj_clean_style_list(calendar, LV_CALENDAR_PART_DATE);
}
else if(sign == LV_SIGNAL_PRESSING) {
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
lv_area_t header_area;
lv_area_copy(&header_area, &calendar->coords);
header_area.y2 = header_area.y1 + get_header_height(calendar);
lv_indev_t * indev = lv_indev_get_act();
lv_point_t p;
lv_indev_get_point(indev, &p);
/*If the header is pressed mark an arrow as pressed*/
if(_lv_area_is_point_on(&header_area, &p, 0)) {
if(p.x < header_area.x1 + lv_area_get_width(&header_area) / 2) {
if(ext->btn_pressing != -1) lv_obj_invalidate(calendar);
ext->btn_pressing = -1;
}
else {
if(ext->btn_pressing != 1) lv_obj_invalidate(calendar);
ext->btn_pressing = 1;
}
ext->pressed_date.year = 0;
ext->pressed_date.month = 0;
ext->pressed_date.day = 0;
}
/*If a day is pressed save it*/
else if(calculate_touched_day(calendar, &p)) {
ext->btn_pressing = 0;
lv_obj_invalidate(calendar);
}
/*Else set a default state*/
else {
if(ext->btn_pressing != 0) lv_obj_invalidate(calendar);
ext->btn_pressing = 0;
ext->pressed_date.year = 0;
ext->pressed_date.month = 0;
ext->pressed_date.day = 0;
}
}
else if(sign == LV_SIGNAL_PRESS_LOST) {
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
ext->btn_pressing = 0;
ext->pressed_date.year = 0;
ext->pressed_date.month = 0;
ext->pressed_date.day = 0;
lv_obj_invalidate(calendar);
}
else if(sign == LV_SIGNAL_RELEASED) {
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
if(ext->btn_pressing < 0) {
if(ext->showed_date.month <= 1) {
ext->showed_date.month = 12;
ext->showed_date.year--;
}
else {
ext->showed_date.month--;
}
}
else if(ext->btn_pressing > 0) {
if(ext->showed_date.month >= 12) {
ext->showed_date.month = 1;
ext->showed_date.year++;
}
else {
ext->showed_date.month++;
}
}
else if(ext->pressed_date.year != 0) {
res = lv_event_send(calendar, LV_EVENT_VALUE_CHANGED, NULL);
if(res != LV_RES_OK) return res;
}
ext->btn_pressing = 0;
ext->pressed_date.year = 0;
ext->pressed_date.month = 0;
ext->pressed_date.day = 0;
lv_obj_invalidate(calendar);
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
uint8_t c = *((uint8_t *)param);
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
if(ext->showed_date.month >= 12) {
ext->showed_date.month = 1;
ext->showed_date.year++;
}
else {
ext->showed_date.month++;
}
lv_obj_invalidate(calendar);
}
else if(c == LV_KEY_LEFT || c == LV_KEY_DOWN) {
if(ext->showed_date.month <= 1) {
ext->showed_date.month = 12;
ext->showed_date.year--;
}
else {
ext->showed_date.month--;
}
lv_obj_invalidate(calendar);
}
#endif
}
return res;
}
/**
* Get the style descriptor of a part of the object
* @param page pointer the object
* @param part the part from `lv_calendar_part_t`. (LV_CALENDAR_PART_...)
* @return pointer to the style descriptor of the specified part
*/
static lv_style_list_t * lv_calendar_get_style(lv_obj_t * calendar, uint8_t part)
{
LV_ASSERT_OBJ(calendar, LV_OBJX_NAME);
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
lv_style_list_t * style_dsc_p;
switch(part) {
case LV_CALENDAR_PART_BG:
style_dsc_p = &calendar->style_list;
break;
case LV_CALENDAR_PART_HEADER:
style_dsc_p = &ext->style_header;
break;
case LV_CALENDAR_PART_DAY_NAMES:
style_dsc_p = &ext->style_day_names;
break;
case LV_CALENDAR_PART_DATE:
style_dsc_p = &ext->style_date_nums;
break;
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
/**
* It will check if the days part of calendar is touched
* and if it is, it will calculate the day and put it in pressed_date of calendar object.
* @param calendar pointer to a calendar object
* @param pointer to a point
* @return true: days part of calendar is touched and its related date is put in pressed date
* false: the point is out of days part area.
*/
static bool calculate_touched_day(lv_obj_t * calendar, const lv_point_t * touched_point)
{
lv_area_t days_area;
lv_area_copy(&days_area, &calendar->coords);
lv_style_int_t left = lv_obj_get_style_pad_left(calendar, LV_CALENDAR_PART_DATE);
lv_style_int_t right = lv_obj_get_style_pad_right(calendar, LV_CALENDAR_PART_DATE);
lv_style_int_t top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_DATE);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_DATE);
days_area.x1 += left;
days_area.x2 -= right;
days_area.y1 = calendar->coords.y1 + get_header_height(calendar) + get_day_names_height(calendar) + top;
days_area.y2 -= bottom;
if(_lv_area_is_point_on(&days_area, touched_point, 0)) {
lv_coord_t w = (days_area.x2 - days_area.x1 + 1) / 7;
lv_coord_t h = (days_area.y2 - days_area.y1 + 1) / 6;
uint8_t x_pos = 0;
x_pos = (touched_point->x - days_area.x1) / w;
if(x_pos > 6) x_pos = 6;
uint8_t y_pos = 0;
y_pos = (touched_point->y - days_area.y1) / h;
if(y_pos > 5) y_pos = 5;
uint8_t i_pos = 0;
i_pos = (y_pos * 7) + x_pos;
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
if(i_pos < get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1)) {
ext->pressed_date.year = ext->showed_date.year - (ext->showed_date.month == 1 ? 1 : 0);
ext->pressed_date.month = ext->showed_date.month == 1 ? 12 : (ext->showed_date.month - 1);
ext->pressed_date.day = get_month_length(ext->pressed_date.year, ext->pressed_date.month) -
get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1) + 1 + i_pos;
}
else if(i_pos < (get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1) +
get_month_length(ext->showed_date.year, ext->showed_date.month))) {
ext->pressed_date.year = ext->showed_date.year;
ext->pressed_date.month = ext->showed_date.month;
ext->pressed_date.day = i_pos + 1 - get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1);
}
else if(i_pos < 42) {
ext->pressed_date.year = ext->showed_date.year + (ext->showed_date.month == 12 ? 1 : 0);
ext->pressed_date.month = ext->showed_date.month == 12 ? 1 : (ext->showed_date.month + 1);
ext->pressed_date.day = i_pos + 1 - get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1) -
get_month_length(ext->showed_date.year, ext->showed_date.month);
}
return true;
}
else {
return false;
}
}
/**
* Get the height of a calendar's header based on it's style
* @param calendar point to a calendar
* @return the header's height
*/
static lv_coord_t get_header_height(lv_obj_t * calendar)
{
const lv_font_t * font = lv_obj_get_style_text_font(calendar, LV_CALENDAR_PART_HEADER);
lv_style_int_t top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_HEADER);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_HEADER);
return lv_font_get_line_height(font) + top + bottom;
}
/**
* Get the height of a calendar's day_names based on it's style
* @param calendar point to a calendar
* @return the day_names's height
*/
static lv_coord_t get_day_names_height(lv_obj_t * calendar)
{
const lv_font_t * font = lv_obj_get_style_text_font(calendar, LV_CALENDAR_PART_DAY_NAMES);
lv_style_int_t top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_DAY_NAMES);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_DAY_NAMES);
return lv_font_get_line_height(font) + top + bottom;
}
/**
* Draw the calendar header with month name and arrows
* @param calendar point to a calendar
* @param mask a mask for drawing
*/
static void draw_header(lv_obj_t * calendar, const lv_area_t * mask)
{
lv_style_int_t header_top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_HEADER);
lv_style_int_t header_left = lv_obj_get_style_pad_left(calendar, LV_CALENDAR_PART_HEADER);
lv_style_int_t header_right = lv_obj_get_style_pad_right(calendar, LV_CALENDAR_PART_HEADER);
const lv_font_t * font = lv_obj_get_style_text_font(calendar, LV_CALENDAR_PART_HEADER);
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
lv_area_t header_area;
header_area.x1 = calendar->coords.x1;
header_area.x2 = calendar->coords.x2;
header_area.y1 = calendar->coords.y1 + header_top;
header_area.y2 = header_area.y1 + lv_font_get_line_height(font);
lv_draw_rect_dsc_t header_rect_dsc;
lv_draw_rect_dsc_init(&header_rect_dsc);
lv_obj_init_draw_rect_dsc(calendar, LV_CALENDAR_PART_HEADER, &header_rect_dsc);
lv_draw_rect(&header_area, mask, &header_rect_dsc);
lv_state_t state_ori = calendar->state;
/*Add the year + month name*/
char txt_buf[64];
_lv_utils_num_to_str(ext->showed_date.year, txt_buf);
txt_buf[4] = ' ';
txt_buf[5] = '\0';
strcpy(&txt_buf[5], get_month_name(calendar, ext->showed_date.month));
calendar->state = LV_STATE_DEFAULT;
lv_draw_label_dsc_t label_dsc;
lv_draw_label_dsc_init(&label_dsc);
lv_obj_init_draw_label_dsc(calendar, LV_CALENDAR_PART_HEADER, &label_dsc);
label_dsc.flag = LV_TXT_FLAG_CENTER;
lv_draw_label(&header_area, mask, &label_dsc, txt_buf, NULL);
calendar->state = state_ori; /*Restore the state*/
/*Add the left arrow*/
if(ext->btn_pressing < 0) calendar->state |= LV_STATE_PRESSED;
else calendar->state &= ~(LV_STATE_PRESSED);
header_area.x1 += header_left;
lv_draw_label_dsc_init(&label_dsc);
lv_obj_init_draw_label_dsc(calendar, LV_CALENDAR_PART_HEADER, &label_dsc);
lv_draw_label(&header_area, mask, &label_dsc, LV_SYMBOL_LEFT, NULL);
calendar->state = state_ori; /*Restore the state*/
/*Add the right arrow*/
if(ext->btn_pressing > 0) calendar->state |= LV_STATE_PRESSED;
else calendar->state &= ~(LV_STATE_PRESSED);
header_area.x1 = header_area.x2 - header_right - _lv_txt_get_width(LV_SYMBOL_RIGHT, (uint16_t)strlen(LV_SYMBOL_RIGHT),
font, 0, LV_TXT_FLAG_NONE);
lv_draw_label_dsc_init(&label_dsc);
lv_obj_init_draw_label_dsc(calendar, LV_CALENDAR_PART_HEADER, &label_dsc);
lv_draw_label(&header_area, mask, &label_dsc, LV_SYMBOL_RIGHT, NULL);
calendar->state = state_ori; /*Restore the state*/
}
/**
* Draw the day's name below the header
* @param calendar point to a calendar
* @param mask a mask for drawing
*/
static void draw_day_names(lv_obj_t * calendar, const lv_area_t * mask)
{
lv_style_int_t date_top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_DATE);
lv_style_int_t date_bottom = lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_DATE);
lv_style_int_t date_left = lv_obj_get_style_pad_left(calendar, LV_CALENDAR_PART_DATE);
lv_style_int_t date_right = lv_obj_get_style_pad_right(calendar, LV_CALENDAR_PART_DATE);
lv_style_int_t date_inner = lv_obj_get_style_pad_inner(calendar, LV_CALENDAR_PART_DATE);
lv_coord_t days_w = lv_obj_get_width(calendar) - date_left - date_right;
lv_coord_t box_w = (days_w - date_inner * 6) / 7;
lv_coord_t days_y1 = calendar->coords.y1 + date_top + get_header_height(calendar) + get_day_names_height(calendar);
lv_coord_t days_h = calendar->coords.y2 - days_y1 - date_bottom;
lv_coord_t box_h = (days_h - 5 * date_inner) / 6;
lv_coord_t box_size = LV_MATH_MIN(box_w, box_h);
lv_style_int_t left = lv_obj_get_style_pad_left(calendar, LV_CALENDAR_PART_DAY_NAMES);
lv_style_int_t right = lv_obj_get_style_pad_right(calendar, LV_CALENDAR_PART_DAY_NAMES);
lv_style_int_t top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_DAY_NAMES);
const lv_font_t * font = lv_obj_get_style_text_font(calendar, LV_CALENDAR_PART_DAY_NAMES);
lv_coord_t w = lv_obj_get_width(calendar) - left - right;
lv_coord_t label_w = w / 6;
lv_area_t label_area;
label_area.y1 = calendar->coords.y1 + get_header_height(calendar) + top;
label_area.y2 = label_area.y1 + lv_font_get_line_height(font);
lv_draw_label_dsc_t label_dsc;
lv_draw_label_dsc_init(&label_dsc);
lv_obj_init_draw_label_dsc(calendar, LV_CALENDAR_PART_DAY_NAMES, &label_dsc);
label_dsc.flag = LV_TXT_FLAG_CENTER;
uint32_t i;
for(i = 0; i < 7; i++) {
label_area.x1 = calendar->coords.x1 + ((w - box_size) * i) / 6 + box_size / 2 - label_w / 2 + left;
label_area.x2 = label_area.x1 + label_w - 1;
lv_draw_label(&label_area, mask, &label_dsc, get_day_name(calendar, i), NULL);
}
}
/**
* Draw the date numbers in a matrix
* @param calendar point to a calendar
* @param mask a mask for drawing
*/
static void draw_dates(lv_obj_t * calendar, const lv_area_t * clip_area)
{
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
const lv_font_t * nums_font = lv_obj_get_style_text_font(calendar, LV_CALENDAR_PART_DATE);
lv_style_int_t date_top = lv_obj_get_style_pad_top(calendar, LV_CALENDAR_PART_DATE);
lv_style_int_t date_bottom = lv_obj_get_style_pad_bottom(calendar, LV_CALENDAR_PART_DATE);
lv_style_int_t date_left = lv_obj_get_style_pad_left(calendar, LV_CALENDAR_PART_DATE);
lv_style_int_t date_right = lv_obj_get_style_pad_right(calendar, LV_CALENDAR_PART_DATE);
lv_style_int_t date_inner = lv_obj_get_style_pad_inner(calendar, LV_CALENDAR_PART_DATE);
lv_coord_t days_y1 = calendar->coords.y1 + date_top + get_header_height(calendar) + get_day_names_height(calendar);
lv_coord_t days_h = calendar->coords.y2 - days_y1 - date_bottom;
/*The state changes without re-caching the styles, disable the use of cache*/
lv_state_t state_ori = calendar->state;
calendar->state = LV_STATE_DEFAULT;
lv_state_t month_state = LV_STATE_DISABLED;
uint8_t day_cnt;
lv_coord_t days_w = lv_obj_get_width(calendar) - date_left - date_right;
lv_coord_t box_w = (days_w - date_inner * 6) / 7;
lv_coord_t box_h = (days_h - 5 * date_inner) / 6;
lv_coord_t box_size = LV_MATH_MIN(box_w, box_h);
uint8_t month_start_day = get_day_of_week(ext->showed_date.year, ext->showed_date.month, 1);
day_draw_state_t draw_state;
/*If starting with the first day of the week then the previous month is not visible*/
if(month_start_day == 0) {
day_cnt = 1;
draw_state = DAY_DRAW_ACT_MONTH;
month_state = 0;
}
else {
draw_state = DAY_DRAW_PREV_MONTH;
day_cnt = get_month_length(ext->showed_date.year, ext->showed_date.month - 1); /*Length of the previous month*/
day_cnt -= month_start_day - 1; /*First visible number of the previous month*/
month_state = LV_STATE_DISABLED;
}
bool month_of_today_shown = false;
if(ext->showed_date.year == ext->today.year && ext->showed_date.month == ext->today.month) {
month_of_today_shown = true;
}
char buf[3];
/*Draw 6 weeks*/
lv_draw_rect_dsc_t rect_dsc;
lv_draw_label_dsc_t label_dsc;
lv_state_t prev_state = 0xFF;
uint32_t week;
for(week = 0; week < 6; week++) {
lv_area_t box_area;
box_area.y1 = days_y1 + ((days_h - box_size) * week) / 5;
box_area.y2 = box_area.y1 + box_size - 1;
if(box_area.y1 > clip_area->y2) {
calendar->state = state_ori;
return;
}
lv_area_t label_area;
label_area.y1 = box_area.y1 + (lv_area_get_height(&box_area) - lv_font_get_line_height(nums_font)) / 2;
label_area.y2 = label_area.y1 + lv_font_get_line_height(nums_font);
/*Draw the 7 days of a week*/
uint32_t day;
for(day = 0; day < 7; day++) {
/*The previous month is over*/
if(draw_state == DAY_DRAW_PREV_MONTH && day == month_start_day) {
draw_state = DAY_DRAW_ACT_MONTH;
day_cnt = 1;
month_state = 0;
}
/*The current month is over*/
else if(draw_state == DAY_DRAW_ACT_MONTH &&
day_cnt > get_month_length(ext->showed_date.year, ext->showed_date.month)) {
draw_state = DAY_DRAW_NEXT_MONTH;
day_cnt = 1;
month_state = LV_STATE_DISABLED;
}
if(box_area.y2 < clip_area->y1) {
day_cnt++;
continue;
}
lv_state_t day_state = month_state;
if(is_pressed(calendar, draw_state, ext->showed_date.year, ext->showed_date.month, day_cnt)) {
day_state |= LV_STATE_PRESSED;
}
if(is_highlighted(calendar, draw_state, ext->showed_date.year, ext->showed_date.month, day_cnt)) {
day_state |= LV_STATE_CHECKED;
}
if(month_of_today_shown && day_cnt == ext->today.day && draw_state == DAY_DRAW_ACT_MONTH) {
day_state |= LV_STATE_FOCUSED;
}
if(prev_state != day_state) {
lv_draw_rect_dsc_init(&rect_dsc);
lv_draw_label_dsc_init(&label_dsc);
label_dsc.flag = LV_TXT_FLAG_CENTER;
calendar->state = day_state;
lv_obj_init_draw_label_dsc(calendar, LV_CALENDAR_PART_DATE, &label_dsc);
lv_obj_init_draw_rect_dsc(calendar, LV_CALENDAR_PART_DATE, &rect_dsc);
prev_state = day_state;
}
label_area.x1 = calendar->coords.x1 + ((days_w - box_size) * day) / 6 + date_left;
label_area.x2 = label_area.x1 + box_size - 1;
box_area.x1 = label_area.x1;
box_area.x2 = label_area.x2;
lv_draw_rect(&box_area, clip_area, &rect_dsc);
/*Write the day's number*/
_lv_utils_num_to_str(day_cnt, buf);
lv_draw_label(&label_area, clip_area, &label_dsc, buf, NULL);
/*Go to the next day*/
day_cnt++;
}
}
calendar->state = state_ori;
}
/**
* Check weather a date is highlighted or not
* @param calendar pointer to a calendar object
* @param draw_state which month is drawn (previous, active, next)
* @param year a year
* @param month a month [1..12]
* @param day a day [1..31]
* @return true: highlighted
*/
static bool is_highlighted(lv_obj_t * calendar, day_draw_state_t draw_state, int32_t year, int32_t month, int32_t day)
{
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
if(draw_state == DAY_DRAW_PREV_MONTH) {
year -= month == 1 ? 1 : 0;
month = month == 1 ? 12 : month - 1;
}
else if(draw_state == DAY_DRAW_NEXT_MONTH) {
year += month == 12 ? 1 : 0;
month = month == 12 ? 1 : month + 1;
}
uint32_t i;
for(i = 0; i < ext->highlighted_dates_num; i++) {
if(ext->highlighted_dates[i].year == year && ext->highlighted_dates[i].month == month &&
ext->highlighted_dates[i].day == day) {
return true;
}
}
return false;
}
/**
* Check weather a date is highlighted or not
* @param calendar pointer to a calendar object
* @param draw_state which month is drawn (previous, active, next)
* @param year a year
* @param month a month [1..12]
* @param day a day [1..31]
* @return true: highlighted
*/
static bool is_pressed(lv_obj_t * calendar, day_draw_state_t draw_state, int32_t year, int32_t month, int32_t day)
{
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
if(draw_state == DAY_DRAW_PREV_MONTH) {
year -= month == 1 ? 1 : 0;
month = month == 1 ? 12 : month - 1;
}
else if(draw_state == DAY_DRAW_NEXT_MONTH) {
year += month == 12 ? 1 : 0;
month = month == 12 ? 1 : month + 1;
}
if(year == ext->pressed_date.year && month == ext->pressed_date.month && day == ext->pressed_date.day) return true;
else return false;
}
/**
* Get the day name
* @param calendar pointer to a calendar object
* @param day a day in [0..6]
* @return
*/
static const char * get_day_name(lv_obj_t * calendar, uint8_t day)
{
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
if(ext->day_names)
return ext->day_names[day];
else
return day_name[day];
}
/**
* Get the month name
* @param calendar pointer to a calendar object
* @param month a month. The range is basically [1..12] but [-11..1] is also supported to handle
* previous year
* @return
*/
static const char * get_month_name(lv_obj_t * calendar, int32_t month)
{
month--; /*Range of months id [1..12] but range of indexes is [0..11]*/
if(month < 0) month = 12 + month;
lv_calendar_ext_t * ext = lv_obj_get_ext_attr(calendar);
if(ext->month_names)
return ext->month_names[month];
else
return month_name[month];
}
/**
* Get the number of days in a month
* @param year a year
* @param month a month. The range is basically [1..12] but [-11..1] is also supported to handle
* previous year
* @return [28..31]
*/
static uint8_t get_month_length(int32_t year, int32_t month)
{
month--; /*Range of months id [1..12] but range of indexes is [0..11]*/
if(month < 0) {
year--; /*Already in the previous year (won't be less then -12 to skip a whole year)*/
month = 12 + month; /*`month` is negative, the result will be < 12*/
}
if(month >= 12) {
year++;
month -= 12;
}
/*month == 1 is february*/
return (month == 1) ? (28 + is_leap_year(year)) : 31 - month % 7 % 2;
}
/**
* Tells whether a year is leap year or not
* @param year a year
* @return 0: not leap year; 1: leap year
*/
static uint8_t is_leap_year(uint32_t year)
{
return (year % 4) || ((year % 100 == 0) && (year % 400)) ? 0 : 1;
}
/**
* Get the day of the week
* @param year a year
* @param month a month
* @param day a day
* @return [0..6] which means [Sun..Sat] or [Mon..Sun] depending on LV_CALENDAR_WEEK_STARTS_MONDAY
*/
static uint8_t get_day_of_week(uint32_t year, uint32_t month, uint32_t day)
{
uint32_t a = month < 3 ? 1 : 0;
uint32_t b = year - a;
#if LV_CALENDAR_WEEK_STARTS_MONDAY
uint32_t day_of_week = (day + (31 * (month - 2 + 12 * a) / 12) + b + (b / 4) - (b / 100) + (b / 400) - 1) % 7;
#else
uint32_t day_of_week = (day + (31 * (month - 2 + 12 * a) / 12) + b + (b / 4) - (b / 100) + (b / 400)) % 7;
#endif
return day_of_week;
}
#endif
|
train_000.parquet/954
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_calendar.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 38229,
"token_count": 14747
}
|
/**
* @file lv_btn.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_btn.h"
#if LV_USE_BTN != 0
#include <string.h>
#include "../lv_core/lv_group.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_area.h"
#include "../lv_misc/lv_color.h"
#include "../lv_misc/lv_math.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_btn"
#define LV_BTN_INK_VALUE_MAX 256
#define LV_BTN_INK_VALUE_MAX_SHIFT 8
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_design_res_t lv_btn_design(lv_obj_t * btn, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
static lv_design_cb_t ancestor_design;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a button object
* @param par pointer to an object, it will be the parent of the new button
* @param copy pointer to a button object, if not NULL then the new object will be copied from it
* @return pointer to the created button
*/
lv_obj_t * lv_btn_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("button create started");
lv_obj_t * btn;
btn = lv_cont_create(par, copy);
LV_ASSERT_MEM(btn);
if(btn == NULL) return NULL;
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(btn);
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(btn);
/*Allocate the extended data*/
lv_btn_ext_t * ext = lv_obj_allocate_ext_attr(btn, sizeof(lv_btn_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(btn);
return NULL;
}
ext->checkable = 0;
lv_obj_set_signal_cb(btn, lv_btn_signal);
lv_obj_set_design_cb(btn, lv_btn_design);
/*If no copy do the basic initialization*/
if(copy == NULL) {
/*Set layout if the button is not a screen*/
if(par) {
lv_obj_set_size(btn, LV_DPI, LV_DPI / 3);
lv_btn_set_layout(btn, LV_LAYOUT_CENTER);
}
lv_obj_set_click(btn, true); /*Be sure the button is clickable*/
lv_theme_apply(btn, LV_THEME_BTN);
}
/*Copy 'copy'*/
else {
lv_btn_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->checkable = copy_ext->checkable;
/*Refresh the style with new signal function*/
lv_obj_refresh_style(btn, LV_STYLE_PROP_ALL);
}
LV_LOG_INFO("button created");
return btn;
}
/*=====================
* Setter functions
*====================*/
/**
* Enable the toggled states
* @param btn pointer to a button object
* @param tgl true: enable toggled states, false: disable
*/
void lv_btn_set_checkable(lv_obj_t * btn, bool tgl)
{
LV_ASSERT_OBJ(btn, LV_OBJX_NAME);
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
ext->checkable = tgl != false ? 1 : 0;
}
/**
* Set the state of the button
* @param btn pointer to a button object
* @param state the new state of the button (from lv_btn_state_t enum)
*/
void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t state)
{
LV_ASSERT_OBJ(btn, LV_OBJX_NAME);
switch(state) {
case LV_BTN_STATE_RELEASED:
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED | LV_STATE_DISABLED);
break;
case LV_BTN_STATE_PRESSED:
lv_obj_clear_state(btn, LV_STATE_CHECKED | LV_STATE_DISABLED);
lv_obj_add_state(btn, LV_STATE_PRESSED);
break;
case LV_BTN_STATE_CHECKED_RELEASED:
lv_obj_add_state(btn, LV_STATE_CHECKED);
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_DISABLED);
break;
case LV_BTN_STATE_CHECKED_PRESSED:
lv_obj_add_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED);
lv_obj_clear_state(btn, LV_STATE_DISABLED);
break;
case LV_BTN_STATE_DISABLED:
lv_obj_clear_state(btn, LV_STATE_PRESSED | LV_STATE_CHECKED);
lv_obj_add_state(btn, LV_STATE_DISABLED);
break;
case LV_BTN_STATE_CHECKED_DISABLED:
lv_obj_clear_state(btn, LV_STATE_PRESSED);
lv_obj_add_state(btn, LV_STATE_DISABLED | LV_STATE_CHECKED);
break;
}
}
/**
* Toggle the state of the button (ON->OFF, OFF->ON)
* @param btn pointer to a button object
*/
void lv_btn_toggle(lv_obj_t * btn)
{
LV_ASSERT_OBJ(btn, LV_OBJX_NAME);
if(lv_obj_get_state(btn, LV_BTN_PART_MAIN) & LV_STATE_CHECKED) {
lv_obj_clear_state(btn, LV_STATE_CHECKED);
}
else {
lv_obj_add_state(btn, LV_STATE_CHECKED);
}
}
/*=====================
* Getter functions
*====================*/
/**
* Get the current state of the button
* @param btn pointer to a button object
* @return the state of the button (from lv_btn_state_t enum).
* If the button is in disabled state `LV_BTN_STATE_DISABLED` will be ORed to the other button states.
*/
lv_btn_state_t lv_btn_get_state(const lv_obj_t * btn)
{
LV_ASSERT_OBJ(btn, LV_OBJX_NAME);
lv_state_t obj_state = lv_obj_get_state(btn, LV_BTN_PART_MAIN);
if(obj_state & LV_STATE_DISABLED) {
if(obj_state & LV_STATE_CHECKED) return LV_BTN_STATE_CHECKED_DISABLED;
else return LV_BTN_STATE_DISABLED;
}
if(obj_state & LV_STATE_CHECKED) {
if(obj_state & LV_STATE_PRESSED) return LV_BTN_STATE_CHECKED_PRESSED;
else return LV_BTN_STATE_CHECKED_RELEASED;
}
else {
if(obj_state & LV_STATE_PRESSED) return LV_BTN_STATE_PRESSED;
else return LV_BTN_STATE_RELEASED;
}
}
/**
* Get the toggle enable attribute of the button
* @param btn pointer to a button object
* @return true: toggle enabled, false: disabled
*/
bool lv_btn_get_checkable(const lv_obj_t * btn)
{
LV_ASSERT_OBJ(btn, LV_OBJX_NAME);
lv_btn_ext_t * ext = lv_obj_get_ext_attr(btn);
return ext->checkable != 0 ? true : false;
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the drop down lists
* @param btn pointer to an object
* @param mask the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_btn_design(lv_obj_t * btn, const lv_area_t * clip_area, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
return ancestor_design(btn, clip_area, mode);
}
else if(mode == LV_DESIGN_DRAW_MAIN) {
ancestor_design(btn, clip_area, mode);
}
else if(mode == LV_DESIGN_DRAW_POST) {
ancestor_design(btn, clip_area, mode);
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the button
* @param btn pointer to a button object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
{
lv_res_t res;
/* Include the ancient signal function */
res = ancestor_signal(btn, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
bool tgl = lv_btn_get_checkable(btn);
if(sign == LV_SIGNAL_RELEASED) {
/*If not dragged and it was not long press action then
*change state and run the action*/
if(lv_indev_is_dragging(param) == false && tgl) {
uint32_t toggled = 0;
if(lv_obj_get_state(btn, LV_BTN_PART_MAIN) & LV_STATE_CHECKED) {
lv_btn_set_state(btn, LV_BTN_STATE_RELEASED);
toggled = 0;
}
else {
lv_btn_set_state(btn, LV_BTN_STATE_CHECKED_RELEASED);
toggled = 1;
}
res = lv_event_send(btn, LV_EVENT_VALUE_CHANGED, &toggled);
if(res != LV_RES_OK) return res;
}
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
char c = *((char *)param);
if(c == LV_KEY_RIGHT || c == LV_KEY_UP) {
if(lv_btn_get_checkable(btn)) {
lv_btn_set_state(btn, LV_BTN_STATE_CHECKED_RELEASED);
uint32_t state = 1;
res = lv_event_send(btn, LV_EVENT_VALUE_CHANGED, &state);
if(res != LV_RES_OK) return res;
}
}
else if(c == LV_KEY_LEFT || c == LV_KEY_DOWN) {
if(lv_btn_get_checkable(btn)) {
lv_btn_set_state(btn, LV_BTN_STATE_RELEASED);
uint32_t state = 0;
res = lv_event_send(btn, LV_EVENT_VALUE_CHANGED, &state);
if(res != LV_RES_OK) return res;
}
}
#endif
}
return res;
}
#endif
|
train_000.parquet/955
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_btn.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 9467,
"token_count": 3728
}
|
/**
* @file lv_btn.h
*
*/
#ifndef LV_BTN_H
#define LV_BTN_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_BTN != 0
/*Testing of dependencies*/
#if LV_USE_CONT == 0
#error "lv_btn: lv_cont is required. Enable it in lv_conf.h (LV_USE_CONT 1) "
#endif
#include "lv_cont.h"
#include "../lv_core/lv_indev.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Possible states of a button.
* It can be used not only by buttons but other button-like objects too*/
enum {
LV_BTN_STATE_RELEASED,
LV_BTN_STATE_PRESSED,
LV_BTN_STATE_DISABLED,
LV_BTN_STATE_CHECKED_RELEASED,
LV_BTN_STATE_CHECKED_PRESSED,
LV_BTN_STATE_CHECKED_DISABLED,
_LV_BTN_STATE_LAST, /* Number of states*/
};
typedef uint8_t lv_btn_state_t;
/** Extended data of button*/
typedef struct {
/** Ext. of ancestor*/
lv_cont_ext_t cont;
/** 1: Toggle enabled*/
uint8_t checkable : 1;
} lv_btn_ext_t;
/**Styles*/
enum {
LV_BTN_PART_MAIN = LV_OBJ_PART_MAIN,
_LV_BTN_PART_VIRTUAL_LAST,
_LV_BTN_PART_REAL_LAST = _LV_OBJ_PART_REAL_LAST,
};
typedef uint8_t lv_btn_part_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a button object
* @param par pointer to an object, it will be the parent of the new button
* @param copy pointer to a button object, if not NULL then the new object will be copied from it
* @return pointer to the created button
*/
lv_obj_t * lv_btn_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
*====================*/
/**
* Enable the toggled states. On release the button will change from/to toggled state.
* @param btn pointer to a button object
* @param tgl true: enable toggled states, false: disable
*/
void lv_btn_set_checkable(lv_obj_t * btn, bool tgl);
/**
* Set the state of the button
* @param btn pointer to a button object
* @param state the new state of the button (from lv_btn_state_t enum)
*/
void lv_btn_set_state(lv_obj_t * btn, lv_btn_state_t state);
/**
* Toggle the state of the button (ON->OFF, OFF->ON)
* @param btn pointer to a button object
*/
void lv_btn_toggle(lv_obj_t * btn);
/**
* Set the layout on a button
* @param btn pointer to a button object
* @param layout a layout from 'lv_cont_layout_t'
*/
static inline void lv_btn_set_layout(lv_obj_t * btn, lv_layout_t layout)
{
lv_cont_set_layout(btn, layout);
}
/**
* Set the fit policy in all 4 directions separately.
* It tells how to change the button size automatically.
* @param btn pointer to a button object
* @param left left fit policy from `lv_fit_t`
* @param right right fit policy from `lv_fit_t`
* @param top top fit policy from `lv_fit_t`
* @param bottom bottom fit policy from `lv_fit_t`
*/
static inline void lv_btn_set_fit4(lv_obj_t * btn, lv_fit_t left, lv_fit_t right, lv_fit_t top, lv_fit_t bottom)
{
lv_cont_set_fit4(btn, left, right, top, bottom);
}
/**
* Set the fit policy horizontally and vertically separately.
* It tells how to change the button size automatically.
* @param btn pointer to a button object
* @param hor horizontal fit policy from `lv_fit_t`
* @param ver vertical fit policy from `lv_fit_t`
*/
static inline void lv_btn_set_fit2(lv_obj_t * btn, lv_fit_t hor, lv_fit_t ver)
{
lv_cont_set_fit2(btn, hor, ver);
}
/**
* Set the fit policy in all 4 direction at once.
* It tells how to change the button size automatically.
* @param btn pointer to a button object
* @param fit fit policy from `lv_fit_t`
*/
static inline void lv_btn_set_fit(lv_obj_t * btn, lv_fit_t fit)
{
lv_cont_set_fit(btn, fit);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the current state of the button
* @param btn pointer to a button object
* @return the state of the button (from lv_btn_state_t enum)
* If the button is in disabled state `LV_BTN_STATE_DISABLED` will be ORed to the other button states.
*/
lv_btn_state_t lv_btn_get_state(const lv_obj_t * btn);
/**
* Get the toggle enable attribute of the button
* @param btn pointer to a button object
* @return true: checkable enabled, false: disabled
*/
bool lv_btn_get_checkable(const lv_obj_t * btn);
/**
* Get the layout of a button
* @param btn pointer to button object
* @return the layout from 'lv_cont_layout_t'
*/
static inline lv_layout_t lv_btn_get_layout(const lv_obj_t * btn)
{
return lv_cont_get_layout(btn);
}
/**
* Get the left fit mode
* @param btn pointer to a button object
* @return an element of `lv_fit_t`
*/
static inline lv_fit_t lv_btn_get_fit_left(const lv_obj_t * btn)
{
return lv_cont_get_fit_left(btn);
}
/**
* Get the right fit mode
* @param btn pointer to a button object
* @return an element of `lv_fit_t`
*/
static inline lv_fit_t lv_btn_get_fit_right(const lv_obj_t * btn)
{
return lv_cont_get_fit_right(btn);
}
/**
* Get the top fit mode
* @param btn pointer to a button object
* @return an element of `lv_fit_t`
*/
static inline lv_fit_t lv_btn_get_fit_top(const lv_obj_t * btn)
{
return lv_cont_get_fit_top(btn);
}
/**
* Get the bottom fit mode
* @param btn pointer to a button object
* @return an element of `lv_fit_t`
*/
static inline lv_fit_t lv_btn_get_fit_bottom(const lv_obj_t * btn)
{
return lv_cont_get_fit_bottom(btn);
}
/**********************
* MACROS
**********************/
#endif /*LV_USE_BUTTON*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_BTN_H*/
|
train_000.parquet/956
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_btn.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 5631,
"token_count": 2190
}
|
/**
* @file lv_btnm.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_btnmatrix.h"
#if LV_USE_BTNMATRIX != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_group.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_core/lv_refr.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_txt.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_btnmatrix"
#define BTN_EXTRA_CLICK_AREA_MAX (LV_DPI / 4)
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * param);
static lv_design_res_t lv_btnmatrix_design(lv_obj_t * btnm, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_style_list_t * lv_btnmatrix_get_style(lv_obj_t * btnm, uint8_t part);
static uint8_t get_button_width(lv_btnmatrix_ctrl_t ctrl_bits);
static bool button_is_hidden(lv_btnmatrix_ctrl_t ctrl_bits);
static bool button_is_repeat_disabled(lv_btnmatrix_ctrl_t ctrl_bits);
static bool button_is_inactive(lv_btnmatrix_ctrl_t ctrl_bits);
static bool button_is_click_trig(lv_btnmatrix_ctrl_t ctrl_bits);
static bool button_is_tgl_enabled(lv_btnmatrix_ctrl_t ctrl_bits);
static bool button_get_tgl_state(lv_btnmatrix_ctrl_t ctrl_bits);
static uint16_t get_button_from_point(lv_obj_t * btnm, lv_point_t * p);
static void allocate_btn_areas_and_controls(const lv_obj_t * btnm, const char ** map);
static void invalidate_button_area(const lv_obj_t * btnm, uint16_t btn_idx);
static bool maps_are_identical(const char ** map1, const char ** map2);
static void make_one_button_toggled(lv_obj_t * btnm, uint16_t btn_idx);
/**********************
* STATIC VARIABLES
**********************/
static const char * lv_btnmatrix_def_map[] = {"Btn1", "Btn2", "Btn3", "\n", "Btn4", "Btn5", ""};
static lv_design_cb_t ancestor_design_f;
static lv_signal_cb_t ancestor_signal;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a button matrix objects
* @param par pointer to an object, it will be the parent of the new button matrix
* @param copy pointer to a button matrix object, if not NULL then the new object will be copied
* from it
* @return pointer to the created button matrix
*/
lv_obj_t * lv_btnmatrix_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("button matrix create started");
/*Create the ancestor object*/
lv_obj_t * btnm = lv_obj_create(par, copy);
LV_ASSERT_MEM(btnm);
if(btnm == NULL) return NULL;
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(btnm);
/*Allocate the object type specific extended data*/
lv_btnmatrix_ext_t * ext = lv_obj_allocate_ext_attr(btnm, sizeof(lv_btnmatrix_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(btnm);
return NULL;
}
ext->btn_cnt = 0;
ext->btn_id_pr = LV_BTNMATRIX_BTN_NONE;
ext->btn_id_focused = LV_BTNMATRIX_BTN_NONE;
ext->btn_id_act = LV_BTNMATRIX_BTN_NONE;
ext->button_areas = NULL;
ext->ctrl_bits = NULL;
ext->map_p = NULL;
ext->recolor = 0;
ext->one_check = 0;
lv_style_list_init(&ext->style_btn);
ext->style_btn.ignore_trans = 1;
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_cb(btnm);
lv_obj_set_signal_cb(btnm, lv_btnmatrix_signal);
lv_obj_set_design_cb(btnm, lv_btnmatrix_design);
/*Init the new button matrix object*/
if(copy == NULL) {
lv_btnmatrix_set_map(btnm, lv_btnmatrix_def_map);
lv_obj_set_size(btnm, LV_DPI * 2, LV_DPI * 1);
lv_theme_apply(btnm, LV_THEME_BTNMATRIX);
}
/*Copy an existing object*/
else {
lv_btnmatrix_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
lv_btnmatrix_set_map(btnm, copy_ext->map_p);
lv_btnmatrix_set_ctrl_map(btnm, copy_ext->ctrl_bits);
lv_style_list_copy(&ext->style_btn, ©_ext->style_btn);
}
LV_LOG_INFO("button matrix created");
return btnm;
}
/*=====================
* Setter functions
*====================*/
/**
* Set a new map. Buttons will be created/deleted according to the map. The
* button matrix keeps a reference to the map and so the string array must not
* be deallocated during the life of the matrix.
* @param btnm pointer to a button matrix object
* @param map pointer a string array. The last string has to be: "". Use "\n" to make a line break.
*/
void lv_btnmatrix_set_map(lv_obj_t * btnm, const char * map[])
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
LV_ASSERT_NULL(map);
/*
* lv_btnmatrix_set_map is called on receipt of signals such as
* LV_SIGNAL_CORD_CHG regardless of whether the map has changed (e.g.
* calling lv_obj_align on the map will trigger this).
*
* We check if the map has changed here to avoid overwriting changes made
* to hidden/longpress/disabled states after the map was originally set.
*
* TODO: separate all map set/allocation from layout code below and skip
* set/allocation when map hasn't changed.
*/
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
if(!maps_are_identical(ext->map_p, map)) {
/*Analyze the map and create the required number of buttons*/
allocate_btn_areas_and_controls(btnm, map);
}
ext->map_p = map;
/*Set size and positions of the buttons*/
lv_style_int_t left = lv_obj_get_style_pad_left(btnm, LV_BTNMATRIX_PART_BG);
lv_style_int_t right = lv_obj_get_style_pad_right(btnm, LV_BTNMATRIX_PART_BG);
lv_style_int_t top = lv_obj_get_style_pad_top(btnm, LV_BTNMATRIX_PART_BG);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(btnm, LV_BTNMATRIX_PART_BG);
lv_style_int_t inner = lv_obj_get_style_pad_inner(btnm, LV_BTNMATRIX_PART_BG);
lv_coord_t max_w = lv_obj_get_width(btnm) - left - right;
lv_coord_t max_h = lv_obj_get_height(btnm) - top - bottom;
lv_coord_t act_y = top;
/*Count the lines to calculate button height*/
uint8_t line_cnt = 1;
uint8_t li;
for(li = 0; strlen(map[li]) != 0; li++) {
if(strcmp(map[li], "\n") == 0) line_cnt++;
}
lv_coord_t btn_h = max_h - ((line_cnt - 1) * inner);
btn_h = btn_h / line_cnt;
btn_h--; /*-1 because e.g. height = 100 means 101 pixels (0..100)*/
/* Count the units and the buttons in a line
* (A button can be 1,2,3... unit wide)*/
uint16_t unit_act_cnt; /*Number of units currently put in a row*/
uint16_t i_tot = 0; /*Act. index in the str map*/
uint16_t btn_i = 0; /*Act. index of button areas*/
const char ** map_p_tmp = map;
/*Count the units and the buttons in a line*/
while(1) {
uint16_t unit_cnt = 0; /*Number of units in a row*/
uint16_t btn_cnt = 0; /*Number of buttons in a row*/
/*Count the buttons in a line*/
while(strcmp(map_p_tmp[btn_cnt], "\n") != 0 && strlen(map_p_tmp[btn_cnt]) != 0) { /*Check a line*/
unit_cnt += get_button_width(ext->ctrl_bits[btn_i + btn_cnt]);
btn_cnt++;
}
/*Make sure the last row is at the bottom of 'btnm'*/
if(map_p_tmp[btn_cnt][0] == '\0') { /*Last row?*/
btn_h = lv_obj_get_height(btnm) - act_y - bottom - 1;
}
lv_bidi_dir_t base_dir = lv_obj_get_base_dir(btnm);
/*Only deal with the non empty lines*/
if(btn_cnt != 0) {
/*Calculate the width of all units*/
lv_coord_t all_unit_w = max_w - ((btn_cnt - 1) * inner);
/*Set the button size and positions and set the texts*/
uint16_t i;
lv_coord_t act_x;
unit_act_cnt = 0;
for(i = 0; i < btn_cnt; i++) {
/* one_unit_w = all_unit_w / unit_cnt
* act_unit_w = one_unit_w * button_width
* do this two operations but the multiply first to divide a greater number */
lv_coord_t act_unit_w = (all_unit_w * get_button_width(ext->ctrl_bits[btn_i])) / unit_cnt;
act_unit_w--; /*-1 because e.g. width = 100 means 101 pixels (0..100)*/
/*Always recalculate act_x because of rounding errors */
if(base_dir == LV_BIDI_DIR_RTL) {
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * inner;
act_x = lv_obj_get_width(btnm) - right - act_x - act_unit_w - 1;
}
else {
act_x = (unit_act_cnt * all_unit_w) / unit_cnt + i * inner +
left;
}
/* Set the button's area.
* If inner padding is zero then use the prev. button x2 as x1 to avoid rounding
* errors*/
if(btn_i != 0 && inner == 0 && ((act_x != left && base_dir != LV_BIDI_DIR_RTL) ||
(act_x + act_unit_w == max_w - right && base_dir == LV_BIDI_DIR_RTL))) {
lv_area_set(&ext->button_areas[btn_i], ext->button_areas[btn_i - 1].x2, act_y, act_x + act_unit_w,
act_y + btn_h);
}
else {
lv_area_set(&ext->button_areas[btn_i], act_x, act_y, act_x + act_unit_w, act_y + btn_h);
}
unit_act_cnt += get_button_width(ext->ctrl_bits[btn_i]);
i_tot++;
btn_i++;
}
}
act_y += btn_h + inner + 1;
if(strlen(map_p_tmp[btn_cnt]) == 0) break; /*Break on end of map*/
map_p_tmp = &map_p_tmp[btn_cnt + 1]; /*Set the map to the next line*/
i_tot++; /*Skip the '\n'*/
}
lv_obj_invalidate(btnm);
}
/**
* Set the button control map (hidden, disabled etc.) for a button matrix. The
* control map array will be copied and so may be deallocated after this
* function returns.
* @param btnm pointer to a button matrix object
* @param ctrl_map pointer to an array of `lv_btn_ctrl_t` control bytes. The
* length of the array and position of the elements must match
* the number and order of the individual buttons (i.e. excludes
* newline entries).
* An element of the map should look like e.g.:
* `ctrl_map[0] = width | LV_BTNMATRIX_CTRL_NO_REPEAT | LV_BTNMATRIX_CTRL_TGL_ENABLE`
*/
void lv_btnmatrix_set_ctrl_map(lv_obj_t * btnm, const lv_btnmatrix_ctrl_t ctrl_map[])
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
_lv_memcpy(ext->ctrl_bits, ctrl_map, sizeof(lv_btnmatrix_ctrl_t) * ext->btn_cnt);
lv_btnmatrix_set_map(btnm, ext->map_p);
}
/**
* Set the focused button i.e. visually highlight it.
* @param btnm pointer to button matrix object
* @param id index of the button to focus(`LV_BTNMATRIX_BTN_NONE` to remove focus)
*/
void lv_btnmatrix_set_focused_btn(lv_obj_t * btnm, uint16_t id)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
if(id >= ext->btn_cnt && id != LV_BTNMATRIX_BTN_NONE) return;
if(id == ext->btn_id_focused) return;
ext->btn_id_focused = id;
lv_obj_invalidate(btnm);
}
/**
* Enable recoloring of button's texts
* @param btnm pointer to button matrix object
* @param en true: enable recoloring; false: disable
*/
void lv_btnmatrix_set_recolor(const lv_obj_t * btnm, bool en)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
ext->recolor = en;
lv_obj_invalidate(btnm);
}
/**
* Set the attributes of a button of the button matrix
* @param btnm pointer to button matrix object
* @param btn_id 0 based index of the button to modify. (Not counting new lines)
*/
void lv_btnmatrix_set_btn_ctrl(const lv_obj_t * btnm, uint16_t btn_id, lv_btnmatrix_ctrl_t ctrl)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
if(btn_id >= ext->btn_cnt) return;
ext->ctrl_bits[btn_id] |= ctrl;
invalidate_button_area(btnm, btn_id);
}
/**
* Clear the attributes of a button of the button matrix
* @param btnm pointer to button matrix object
* @param btn_id 0 based index of the button to modify. (Not counting new lines)
*/
void lv_btnmatrix_clear_btn_ctrl(const lv_obj_t * btnm, uint16_t btn_id, lv_btnmatrix_ctrl_t ctrl)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
if(btn_id >= ext->btn_cnt) return;
ext->ctrl_bits[btn_id] &= (~ctrl);
invalidate_button_area(btnm, btn_id);
}
/**
* Set the attributes of all buttons of a button matrix
* @param btnm pointer to a button matrix object
* @param ctrl attribute(s) to set from `lv_btnmatrix_ctrl_t`. Values can be ORed.
*/
void lv_btnmatrix_set_btn_ctrl_all(lv_obj_t * btnm, lv_btnmatrix_ctrl_t ctrl)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
uint16_t i;
for(i = 0; i < ext->btn_cnt; i++) {
lv_btnmatrix_set_btn_ctrl(btnm, i, ctrl);
}
}
/**
* Clear the attributes of all buttons of a button matrix
* @param btnm pointer to a button matrix object
* @param ctrl attribute(s) to set from `lv_btnmatrix_ctrl_t`. Values can be ORed.
* @param en true: set the attributes; false: clear the attributes
*/
void lv_btnmatrix_clear_btn_ctrl_all(lv_obj_t * btnm, lv_btnmatrix_ctrl_t ctrl)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
uint16_t i;
for(i = 0; i < ext->btn_cnt; i++) {
lv_btnmatrix_clear_btn_ctrl(btnm, i, ctrl);
}
}
/**
* Set a single buttons relative width.
* This method will cause the matrix be regenerated and is a relatively
* expensive operation. It is recommended that initial width be specified using
* `lv_btnmatrix_set_ctrl_map` and this method only be used for dynamic changes.
* @param btnm pointer to button matrix object
* @param btn_id 0 based index of the button to modify.
* @param width Relative width compared to the buttons in the same row. [1..7]
*/
void lv_btnmatrix_set_btn_width(lv_obj_t * btnm, uint16_t btn_id, uint8_t width)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
if(btn_id >= ext->btn_cnt) return;
ext->ctrl_bits[btn_id] &= (~LV_BTNMATRIX_WIDTH_MASK);
ext->ctrl_bits[btn_id] |= (LV_BTNMATRIX_WIDTH_MASK & width);
lv_btnmatrix_set_map(btnm, ext->map_p);
}
/**
* Make the button matrix like a selector widget (only one button may be toggled at a time).
* `Checkable` must be enabled on the buttons you want to be selected with `lv_btnmatrix_set_ctrl` or
* `lv_btnmatrix_set_btn_ctrl_all`.
* @param btnm Button matrix object
* @param one_chk Whether "one check" mode is enabled
*/
void lv_btnmatrix_set_one_check(lv_obj_t * btnm, bool one_chk)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
ext->one_check = one_chk;
/*If more than one button is toggled only the first one should be*/
make_one_button_toggled(btnm, 0);
}
/**
* Set the align of the map text (left, right or center)
* @param btnm pointer to a btnmatrix object
* @param align LV_LABEL_ALIGN_LEFT, LV_LABEL_ALIGN_RIGHT or LV_LABEL_ALIGN_CENTER
*/
void lv_btnmatrix_set_align(lv_obj_t * btnm, lv_label_align_t align)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
if(ext->align == align) return;
ext->align = align;
lv_obj_invalidate(btnm);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the current map of a button matrix
* @param btnm pointer to a button matrix object
* @return the current map
*/
const char ** lv_btnmatrix_get_map_array(const lv_obj_t * btnm)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
return ext->map_p;
}
/**
* Check whether the button's text can use recolor or not
* @param btnm pointer to button matrix object
* @return true: text recolor enable; false: disabled
*/
bool lv_btnmatrix_get_recolor(const lv_obj_t * btnm)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
return ext->recolor;
}
/**
* Get the index of the lastly "activated" button by the user (pressed, released etc)
* Useful in the the `event_cb` to get the text of the button, check if hidden etc.
* @param btnm pointer to button matrix object
* @return index of the last released button (LV_BTNMATRIX_BTN_NONE: if unset)
*/
uint16_t lv_btnmatrix_get_active_btn(const lv_obj_t * btnm)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
return ext->btn_id_act;
}
/**
* Get the text of the lastly "activated" button by the user (pressed, released etc)
* Useful in the the `event_cb`
* @param btnm pointer to button matrix object
* @return text of the last released button (NULL: if unset)
*/
const char * lv_btnmatrix_get_active_btn_text(const lv_obj_t * btnm)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
if(ext->btn_id_act != LV_BTNMATRIX_BTN_NONE) {
return lv_btnmatrix_get_btn_text(btnm, ext->btn_id_act);
}
else {
return NULL;
}
}
/**
* Get the pressed button's index.
* The button be really pressed by the user or manually set to pressed with `lv_btnmatrix_set_pressed`
* @param btnm pointer to button matrix object
* @return index of the pressed button (LV_BTNMATRIX_BTN_NONE: if unset)
*/
uint16_t lv_btnmatrix_get_focused_btn(const lv_obj_t * btnm)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
return ext->btn_id_focused;
}
/**
* Get the button's text
* @param btnm pointer to button matrix object
* @param btn_id the index a button not counting new line characters. (The return value of
* lv_btnmatrix_get_pressed/released)
* @return text of btn_index` button
*/
const char * lv_btnmatrix_get_btn_text(const lv_obj_t * btnm, uint16_t btn_id)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
if(btn_id > ext->btn_cnt) return NULL;
uint16_t txt_i = 0;
uint16_t btn_i = 0;
/* Search the text of ext->btn_pr the buttons text in the map
* Skip "\n"-s*/
while(btn_i != btn_id) {
btn_i++;
txt_i++;
if(strcmp(ext->map_p[txt_i], "\n") == 0) txt_i++;
}
if(btn_i == ext->btn_cnt) return NULL;
return ext->map_p[txt_i];
}
/**
* Get the whether a control value is enabled or disabled for button of a button matrix
* @param btnm pointer to a button matrix object
* @param btn_id the index a button not counting new line characters. (E.g. the return value of
* lv_btnmatrix_get_pressed/released)
* @param ctrl control values to check (ORed value can be used)
* @return true: long press repeat is disabled; false: long press repeat enabled
*/
bool lv_btnmatrix_get_btn_ctrl(lv_obj_t * btnm, uint16_t btn_id, lv_btnmatrix_ctrl_t ctrl)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
if(btn_id >= ext->btn_cnt) return false;
return (ext->ctrl_bits[btn_id] & ctrl) ? true : false;
}
/**
* Find whether "one check" mode is enabled.
* @param btnm Button matrix object
* @return whether "one check" mode is enabled
*/
bool lv_btnmatrix_get_one_check(const lv_obj_t * btnm)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
return ext->one_check;
}
/**
* Get the align attribute
* @param btnm pointer to a btnmatrix object
* @return LV_LABEL_ALIGN_LEFT, LV_LABEL_ALIGN_RIGHT or LV_LABEL_ALIGN_CENTER
*/
lv_label_align_t lv_btnmatrix_get_align(const lv_obj_t * btnm)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
lv_label_align_t align = ext->align;
if(align == LV_LABEL_ALIGN_AUTO) {
#if LV_USE_BIDI
lv_bidi_dir_t base_dir = lv_obj_get_base_dir(btnm);
if(base_dir == LV_BIDI_DIR_RTL) align = LV_LABEL_ALIGN_RIGHT;
else align = LV_LABEL_ALIGN_LEFT;
#else
align = LV_LABEL_ALIGN_LEFT;
#endif
}
return align;
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the button matrix
* @param btnm pointer to a button matrix object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_btnmatrix_design(lv_obj_t * btnm, const lv_area_t * clip_area, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
return ancestor_design_f(btnm, clip_area, mode);
}
/*Draw the object*/
else if(mode == LV_DESIGN_DRAW_MAIN) {
ancestor_design_f(btnm, clip_area, mode);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
if(ext->btn_cnt == 0) return LV_DESIGN_RES_OK;
lv_area_t area_btnm;
lv_obj_get_coords(btnm, &area_btnm);
lv_area_t area_tmp;
lv_coord_t btn_w;
lv_coord_t btn_h;
uint16_t btn_i = 0;
uint16_t txt_i = 0;
lv_txt_flag_t txt_flag = LV_TXT_FLAG_NONE;
if(ext->recolor) txt_flag |= LV_TXT_FLAG_RECOLOR;
lv_label_align_t align = lv_btnmatrix_get_align(btnm);
if(align == LV_LABEL_ALIGN_CENTER) txt_flag |= LV_TXT_FLAG_CENTER;
if(align == LV_LABEL_ALIGN_RIGHT) txt_flag |= LV_TXT_FLAG_RIGHT;
lv_draw_rect_dsc_t draw_rect_rel_dsc;
lv_draw_label_dsc_t draw_label_rel_dsc;
lv_draw_rect_dsc_t draw_rect_chk_dsc;
lv_draw_label_dsc_t draw_label_chk_dsc;
lv_draw_rect_dsc_t draw_rect_ina_dsc;
lv_draw_label_dsc_t draw_label_ina_dsc;
lv_draw_rect_dsc_t draw_rect_tmp_dsc;
lv_draw_label_dsc_t draw_label_tmp_dsc;
lv_state_t state_ori = btnm->state;
btnm->state = LV_STATE_DEFAULT;
lv_draw_rect_dsc_init(&draw_rect_rel_dsc);
lv_draw_label_dsc_init(&draw_label_rel_dsc);
lv_obj_init_draw_rect_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_rect_rel_dsc);
lv_obj_init_draw_label_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_label_rel_dsc);
draw_label_rel_dsc.flag = txt_flag;
btnm->state = state_ori;
bool chk_inited = false;
bool disabled_inited = false;
lv_style_int_t padding_top = lv_obj_get_style_pad_top(btnm, LV_BTNMATRIX_PART_BG);
lv_style_int_t padding_bottom = lv_obj_get_style_pad_bottom(btnm, LV_BTNMATRIX_PART_BG);
for(btn_i = 0; btn_i < ext->btn_cnt; btn_i++, txt_i++) {
/*Search the next valid text in the map*/
while(strcmp(ext->map_p[txt_i], "\n") == 0) {
txt_i++;
}
/*Skip hidden buttons*/
if(button_is_hidden(ext->ctrl_bits[btn_i])) continue;
lv_area_copy(&area_tmp, &ext->button_areas[btn_i]);
area_tmp.x1 += area_btnm.x1;
area_tmp.y1 += area_btnm.y1;
area_tmp.x2 += area_btnm.x1;
area_tmp.y2 += area_btnm.y1;
btn_w = lv_area_get_width(&area_tmp);
btn_h = lv_area_get_height(&area_tmp);
/*Choose the style*/
lv_draw_rect_dsc_t * draw_rect_dsc_act;
lv_draw_label_dsc_t * draw_label_dsc_act;
lv_state_t btn_state = LV_STATE_DEFAULT;
if(button_get_tgl_state(ext->ctrl_bits[btn_i])) btn_state |= LV_STATE_CHECKED;
if(button_is_inactive(ext->ctrl_bits[btn_i])) btn_state |= LV_STATE_DISABLED;
if(btn_i == ext->btn_id_pr) btn_state |= LV_STATE_PRESSED;
if(btn_i == ext->btn_id_focused) {
btn_state |= LV_STATE_FOCUSED;
if(state_ori & LV_STATE_EDITED) btn_state |= LV_STATE_EDITED;
}
if(btn_state == LV_STATE_DEFAULT) {
draw_rect_dsc_act = &draw_rect_rel_dsc;
draw_label_dsc_act = &draw_label_rel_dsc;
}
else if(btn_state == LV_STATE_CHECKED) {
if(!chk_inited) {
btnm->state = LV_STATE_CHECKED;
lv_draw_rect_dsc_init(&draw_rect_chk_dsc);
lv_draw_label_dsc_init(&draw_label_chk_dsc);
lv_obj_init_draw_rect_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_rect_chk_dsc);
lv_obj_init_draw_label_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_label_chk_dsc);
draw_label_chk_dsc.flag = txt_flag;
btnm->state = state_ori;
chk_inited = true;
}
draw_rect_dsc_act = &draw_rect_chk_dsc;
draw_label_dsc_act = &draw_label_chk_dsc;
}
else if(btn_state == LV_STATE_CHECKED) {
if(!disabled_inited) {
btnm->state = LV_STATE_DISABLED;
lv_draw_rect_dsc_init(&draw_rect_ina_dsc);
lv_draw_label_dsc_init(&draw_label_ina_dsc);
lv_obj_init_draw_rect_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_rect_ina_dsc);
lv_obj_init_draw_label_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_label_ina_dsc);
draw_label_ina_dsc.flag = txt_flag;
btnm->state = state_ori;
disabled_inited = true;
}
draw_rect_dsc_act = &draw_rect_ina_dsc;
draw_label_dsc_act = &draw_label_ina_dsc;
}
/*In other cases get the styles directly without caching them*/
else {
btnm->state = btn_state;
lv_draw_rect_dsc_init(&draw_rect_tmp_dsc);
lv_draw_label_dsc_init(&draw_label_tmp_dsc);
lv_obj_init_draw_rect_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_rect_tmp_dsc);
lv_obj_init_draw_label_dsc(btnm, LV_BTNMATRIX_PART_BTN, &draw_label_tmp_dsc);
draw_label_tmp_dsc.flag = txt_flag;
draw_rect_dsc_act = &draw_rect_tmp_dsc;
draw_label_dsc_act = &draw_label_tmp_dsc;
btnm->state = state_ori;
}
lv_style_int_t border_part_ori = draw_rect_dsc_act->border_side;
/*Remove borders on the edges if `LV_BORDER_INTERNAL`*/
if(border_part_ori & LV_BORDER_SIDE_INTERNAL) {
/*Top/Bottom lines*/
if(area_tmp.y1 == btnm->coords.y1 + padding_top) {
draw_rect_dsc_act->border_side &= ~LV_BORDER_SIDE_TOP;
}
if(area_tmp.y2 == btnm->coords.y2 - padding_bottom) {
draw_rect_dsc_act->border_side &= ~LV_BORDER_SIDE_BOTTOM;
}
/*Left/right columns*/
if(txt_i == 0) { /*First button*/
draw_rect_dsc_act->border_side &= ~LV_BORDER_SIDE_LEFT;
}
else if(strcmp(ext->map_p[txt_i - 1], "\n") == 0) {
draw_rect_dsc_act->border_side &= ~LV_BORDER_SIDE_LEFT;
}
if(ext->map_p[txt_i + 1][0] == '\0' || strcmp(ext->map_p[txt_i + 1], "\n") == 0) {
draw_rect_dsc_act->border_side &= ~LV_BORDER_SIDE_RIGHT;
}
}
lv_draw_rect(&area_tmp, clip_area, draw_rect_dsc_act);
draw_rect_dsc_act->border_side = border_part_ori;
/*Calculate the size of the text*/
const lv_font_t * font = draw_label_dsc_act->font;
lv_style_int_t letter_space = draw_label_dsc_act->letter_space;
lv_style_int_t line_space = draw_label_dsc_act->line_space;
const char * txt = ext->map_p[txt_i];
lv_point_t txt_size;
_lv_txt_get_size(&txt_size, txt, font, letter_space,
line_space, lv_area_get_width(&area_btnm), txt_flag);
area_tmp.x1 += (btn_w - txt_size.x) / 2;
area_tmp.y1 += (btn_h - txt_size.y) / 2;
area_tmp.x2 = area_tmp.x1 + txt_size.x;
area_tmp.y2 = area_tmp.y1 + txt_size.y;
lv_draw_label(&area_tmp, clip_area, draw_label_dsc_act, txt, NULL);
}
}
else if(mode == LV_DESIGN_DRAW_POST) {
ancestor_design_f(btnm, clip_area, mode);
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the button matrix
* @param btnm pointer to a button matrix object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_btnmatrix_signal(lv_obj_t * btnm, lv_signal_t sign, void * param)
{
lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_btnmatrix_get_style(btnm, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(btnm, sign, param);
}
/* Include the ancient signal function */
res = ancestor_signal(btnm, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
lv_point_t p;
if(sign == LV_SIGNAL_CLEANUP) {
lv_obj_clean_style_list(btnm, LV_BTNMATRIX_PART_BTN);
lv_mem_free(ext->button_areas);
lv_mem_free(ext->ctrl_bits);
}
else if(sign == LV_SIGNAL_STYLE_CHG) {
lv_btnmatrix_set_map(btnm, ext->map_p);
}
else if(sign == LV_SIGNAL_COORD_CHG) {
if(lv_obj_get_width(btnm) != lv_area_get_width(param) || lv_obj_get_height(btnm) != lv_area_get_height(param)) {
lv_btnmatrix_set_map(btnm, ext->map_p);
}
}
else if(sign == LV_SIGNAL_PRESSED) {
invalidate_button_area(btnm, ext->btn_id_pr);
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
if(indev_type == LV_INDEV_TYPE_POINTER || indev_type == LV_INDEV_TYPE_BUTTON) {
uint16_t btn_pr;
/*Search the pressed area*/
lv_indev_get_point(param, &p);
btn_pr = get_button_from_point(btnm, &p);
/*Handle the case where there is no button there*/
if(btn_pr != LV_BTNMATRIX_BTN_NONE) {
if(button_is_inactive(ext->ctrl_bits[btn_pr]) == false &&
button_is_hidden(ext->ctrl_bits[btn_pr]) == false) {
invalidate_button_area(btnm, ext->btn_id_pr) /*Invalidate the old area*/;
ext->btn_id_pr = btn_pr;
ext->btn_id_act = btn_pr;
invalidate_button_area(btnm, ext->btn_id_pr); /*Invalidate the new area*/
}
}
}
#if LV_USE_GROUP
else if(indev_type == LV_INDEV_TYPE_KEYPAD || (indev_type == LV_INDEV_TYPE_ENCODER &&
lv_group_get_editing(lv_obj_get_group(btnm)))) {
ext->btn_id_pr = ext->btn_id_focused;
invalidate_button_area(btnm, ext->btn_id_focused);
}
#endif
if(ext->btn_id_pr != LV_BTNMATRIX_BTN_NONE) {
if(button_is_click_trig(ext->ctrl_bits[ext->btn_id_pr]) == false &&
button_is_inactive(ext->ctrl_bits[ext->btn_id_pr]) == false &&
button_is_hidden(ext->ctrl_bits[ext->btn_id_pr]) == false) {
uint32_t b = ext->btn_id_pr;
res = lv_event_send(btnm, LV_EVENT_VALUE_CHANGED, &b);
}
}
}
else if(sign == LV_SIGNAL_PRESSING) {
uint16_t btn_pr = LV_BTNMATRIX_BTN_NONE;
/*Search the pressed area*/
lv_indev_t * indev = lv_indev_get_act();
lv_indev_type_t indev_type = lv_indev_get_type(indev);
if(indev_type == LV_INDEV_TYPE_ENCODER || indev_type == LV_INDEV_TYPE_KEYPAD) return LV_RES_OK;
lv_indev_get_point(indev, &p);
btn_pr = get_button_from_point(btnm, &p);
/*Invalidate to old and the new areas*/
if(btn_pr != ext->btn_id_pr) {
if(ext->btn_id_pr != LV_BTNMATRIX_BTN_NONE) {
invalidate_button_area(btnm, ext->btn_id_pr);
}
ext->btn_id_pr = btn_pr;
ext->btn_id_act = btn_pr;
lv_indev_reset_long_press(param); /*Start the log press time again on the new button*/
if(btn_pr != LV_BTNMATRIX_BTN_NONE &&
button_is_inactive(ext->ctrl_bits[btn_pr]) == false &&
button_is_hidden(ext->ctrl_bits[btn_pr]) == false) {
/* Send VALUE_CHANGED for the newly pressed button */
uint32_t b = btn_pr;
res = lv_event_send(btnm, LV_EVENT_VALUE_CHANGED, &b);
if(res == LV_RES_OK) {
invalidate_button_area(btnm, btn_pr);
}
}
}
}
else if(sign == LV_SIGNAL_RELEASED) {
if(ext->btn_id_pr != LV_BTNMATRIX_BTN_NONE) {
/*Toggle the button if enabled*/
if(button_is_tgl_enabled(ext->ctrl_bits[ext->btn_id_pr]) &&
!button_is_inactive(ext->ctrl_bits[ext->btn_id_pr])) {
if(button_get_tgl_state(ext->ctrl_bits[ext->btn_id_pr])) {
ext->ctrl_bits[ext->btn_id_pr] &= (~LV_BTNMATRIX_CTRL_CHECK_STATE);
}
else {
ext->ctrl_bits[ext->btn_id_pr] |= LV_BTNMATRIX_CTRL_CHECK_STATE;
}
if(ext->one_check) make_one_button_toggled(btnm, ext->btn_id_pr);
}
/*Invalidate to old pressed area*/;
invalidate_button_area(btnm, ext->btn_id_pr);
invalidate_button_area(btnm, ext->btn_id_focused);
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
if(indev_type == LV_INDEV_TYPE_KEYPAD || indev_type == LV_INDEV_TYPE_ENCODER) {
ext->btn_id_focused = ext->btn_id_pr;
}
ext->btn_id_pr = LV_BTNMATRIX_BTN_NONE;
if(button_is_click_trig(ext->ctrl_bits[ext->btn_id_act]) == true &&
button_is_inactive(ext->ctrl_bits[ext->btn_id_act]) == false &&
button_is_hidden(ext->ctrl_bits[ext->btn_id_act]) == false) {
uint32_t b = ext->btn_id_act;
res = lv_event_send(btnm, LV_EVENT_VALUE_CHANGED, &b);
}
}
}
else if(sign == LV_SIGNAL_LONG_PRESS_REP) {
if(ext->btn_id_act != LV_BTNMATRIX_BTN_NONE) {
if(button_is_repeat_disabled(ext->ctrl_bits[ext->btn_id_act]) == false &&
button_is_inactive(ext->ctrl_bits[ext->btn_id_act]) == false &&
button_is_hidden(ext->ctrl_bits[ext->btn_id_act]) == false) {
uint32_t b = ext->btn_id_act;
res = lv_event_send(btnm, LV_EVENT_VALUE_CHANGED, &b);
}
}
}
else if(sign == LV_SIGNAL_PRESS_LOST) {
ext->btn_id_pr = LV_BTNMATRIX_BTN_NONE;
ext->btn_id_act = LV_BTNMATRIX_BTN_NONE;
lv_obj_invalidate(btnm);
}
else if(sign == LV_SIGNAL_FOCUS) {
#if LV_USE_GROUP
lv_indev_t * indev = lv_indev_get_act();
lv_indev_type_t indev_type = lv_indev_get_type(indev);
/*If not focused by an input device assume the last input device*/
if(indev == NULL) {
indev = lv_indev_get_next(NULL);
indev_type = lv_indev_get_type(indev);
}
if(indev_type == LV_INDEV_TYPE_ENCODER) {
/*In navigation mode don't select any button but in edit mode select the fist*/
if(lv_group_get_editing(lv_obj_get_group(btnm))) {
ext->btn_id_focused = 0;
ext->btn_id_act = ext->btn_id_focused;
}
else {
ext->btn_id_focused = LV_BTNMATRIX_BTN_NONE;
}
}
else if(indev_type == LV_INDEV_TYPE_KEYPAD) {
ext->btn_id_focused = 0;
ext->btn_id_act = ext->btn_id_focused;
}
#endif
}
else if(sign == LV_SIGNAL_DEFOCUS || sign == LV_SIGNAL_LEAVE) {
if(ext->btn_id_focused != LV_BTNMATRIX_BTN_NONE) invalidate_button_area(btnm, ext->btn_id_focused);
if(ext->btn_id_pr != LV_BTNMATRIX_BTN_NONE) invalidate_button_area(btnm, ext->btn_id_pr);
ext->btn_id_focused = LV_BTNMATRIX_BTN_NONE;
ext->btn_id_pr = LV_BTNMATRIX_BTN_NONE;
ext->btn_id_act = LV_BTNMATRIX_BTN_NONE;
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
char c = *((char *)param);
if(c == LV_KEY_RIGHT) {
if(ext->btn_id_focused == LV_BTNMATRIX_BTN_NONE)
ext->btn_id_focused = 0;
else
ext->btn_id_focused++;
if(ext->btn_id_focused >= ext->btn_cnt - 1) ext->btn_id_focused = ext->btn_cnt - 1;
ext->btn_id_act = ext->btn_id_focused;
lv_obj_invalidate(btnm);
}
else if(c == LV_KEY_LEFT) {
if(ext->btn_id_focused == LV_BTNMATRIX_BTN_NONE) ext->btn_id_focused = 0;
if(ext->btn_id_focused > 0) ext->btn_id_focused--;
ext->btn_id_act = ext->btn_id_focused;
lv_obj_invalidate(btnm);
}
else if(c == LV_KEY_DOWN) {
lv_style_int_t pad_inner = lv_obj_get_style_pad_inner(btnm, LV_BTNMATRIX_PART_BG);
/*Find the area below the the current*/
if(ext->btn_id_focused == LV_BTNMATRIX_BTN_NONE) {
ext->btn_id_focused = 0;
}
else {
uint16_t area_below;
lv_coord_t pr_center =
ext->button_areas[ext->btn_id_focused].x1 + (lv_area_get_width(&ext->button_areas[ext->btn_id_focused]) >> 1);
for(area_below = ext->btn_id_focused; area_below < ext->btn_cnt; area_below++) {
if(ext->button_areas[area_below].y1 > ext->button_areas[ext->btn_id_focused].y1 &&
pr_center >= ext->button_areas[area_below].x1 &&
pr_center <= ext->button_areas[area_below].x2 + pad_inner &&
button_is_inactive(ext->ctrl_bits[area_below]) == false &&
button_is_hidden(ext->ctrl_bits[area_below]) == false) {
break;
}
}
if(area_below < ext->btn_cnt) ext->btn_id_focused = area_below;
}
ext->btn_id_act = ext->btn_id_focused;
lv_obj_invalidate(btnm);
}
else if(c == LV_KEY_UP) {
lv_style_int_t pad_inner = lv_obj_get_style_pad_inner(btnm, LV_BTNMATRIX_PART_BG);
/*Find the area below the the current*/
if(ext->btn_id_focused == LV_BTNMATRIX_BTN_NONE) {
ext->btn_id_focused = 0;
}
else {
int16_t area_above;
lv_coord_t pr_center =
ext->button_areas[ext->btn_id_focused].x1 + (lv_area_get_width(&ext->button_areas[ext->btn_id_focused]) >> 1);
for(area_above = ext->btn_id_focused; area_above >= 0; area_above--) {
if(ext->button_areas[area_above].y1 < ext->button_areas[ext->btn_id_focused].y1 &&
pr_center >= ext->button_areas[area_above].x1 - pad_inner &&
pr_center <= ext->button_areas[area_above].x2 &&
button_is_inactive(ext->ctrl_bits[area_above]) == false &&
button_is_hidden(ext->ctrl_bits[area_above]) == false) {
break;
}
}
if(area_above >= 0) ext->btn_id_focused = area_above;
}
ext->btn_id_act = ext->btn_id_focused;
lv_obj_invalidate(btnm);
}
#endif
}
else if(sign == LV_SIGNAL_GET_EDITABLE) {
#if LV_USE_GROUP
bool * editable = (bool *)param;
*editable = true;
#endif
}
return res;
}
/**
* Get the style descriptor of a part of the object
* @param btnm pointer the object
* @param part the part of the object. (LV_BTNMATRIX_PART_...)
* @return pointer to the style descriptor of the specified part
*/
static lv_style_list_t * lv_btnmatrix_get_style(lv_obj_t * btnm, uint8_t part)
{
LV_ASSERT_OBJ(btnm, LV_OBJX_NAME);
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
lv_style_list_t * style_dsc_p;
switch(part) {
case LV_BTNMATRIX_PART_BG:
style_dsc_p = &btnm->style_list;
break;
case LV_BTNMATRIX_PART_BTN:
style_dsc_p = &ext->style_btn;
break;
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
/**
* Create the required number of buttons and control bytes according to a map
* @param btnm pointer to button matrix object
* @param map_p pointer to a string array
*/
static void allocate_btn_areas_and_controls(const lv_obj_t * btnm, const char ** map)
{
/*Count the buttons in the map*/
uint16_t btn_cnt = 0;
uint16_t i = 0;
while(strlen(map[i]) != 0) {
if(strcmp(map[i], "\n") != 0) { /*Do not count line breaks*/
btn_cnt++;
}
i++;
}
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
if(ext->button_areas != NULL) {
lv_mem_free(ext->button_areas);
ext->button_areas = NULL;
}
if(ext->ctrl_bits != NULL) {
lv_mem_free(ext->ctrl_bits);
ext->ctrl_bits = NULL;
}
ext->button_areas = lv_mem_alloc(sizeof(lv_area_t) * btn_cnt);
LV_ASSERT_MEM(ext->button_areas);
ext->ctrl_bits = lv_mem_alloc(sizeof(lv_btnmatrix_ctrl_t) * btn_cnt);
LV_ASSERT_MEM(ext->ctrl_bits);
if(ext->button_areas == NULL || ext->ctrl_bits == NULL) btn_cnt = 0;
_lv_memset_00(ext->ctrl_bits, sizeof(lv_btnmatrix_ctrl_t) * btn_cnt);
ext->btn_cnt = btn_cnt;
}
/**
* Get the width of a button in units (default is 1).
* @param ctrl_bits least significant 3 bits used (1..7 valid values)
* @return the width of the button in units
*/
static uint8_t get_button_width(lv_btnmatrix_ctrl_t ctrl_bits)
{
uint8_t w = ctrl_bits & LV_BTNMATRIX_WIDTH_MASK;
return w != 0 ? w : 1;
}
static bool button_is_hidden(lv_btnmatrix_ctrl_t ctrl_bits)
{
return (ctrl_bits & LV_BTNMATRIX_CTRL_HIDDEN) ? true : false;
}
static bool button_is_repeat_disabled(lv_btnmatrix_ctrl_t ctrl_bits)
{
return (ctrl_bits & LV_BTNMATRIX_CTRL_NO_REPEAT) ? true : false;
}
static bool button_is_inactive(lv_btnmatrix_ctrl_t ctrl_bits)
{
return (ctrl_bits & LV_BTNMATRIX_CTRL_DISABLED) ? true : false;
}
static bool button_is_click_trig(lv_btnmatrix_ctrl_t ctrl_bits)
{
return (ctrl_bits & LV_BTNMATRIX_CTRL_CLICK_TRIG) ? true : false;
}
static bool button_is_tgl_enabled(lv_btnmatrix_ctrl_t ctrl_bits)
{
return (ctrl_bits & LV_BTNMATRIX_CTRL_CHECKABLE) ? true : false;
}
static bool button_get_tgl_state(lv_btnmatrix_ctrl_t ctrl_bits)
{
return (ctrl_bits & LV_BTNMATRIX_CTRL_CHECK_STATE) ? true : false;
}
/**
* Gives the button id of a button under a given point
* @param btnm pointer to a button matrix object
* @param p a point with absolute coordinates
* @return the id of the button or LV_BTNMATRIX_BTN_NONE.
*/
static uint16_t get_button_from_point(lv_obj_t * btnm, lv_point_t * p)
{
lv_area_t btnm_cords;
lv_area_t btn_area;
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
uint16_t i;
lv_obj_get_coords(btnm, &btnm_cords);
lv_coord_t w = lv_obj_get_width(btnm);
lv_coord_t h = lv_obj_get_height(btnm);
lv_style_int_t pleft = lv_obj_get_style_pad_left(btnm, LV_BTNMATRIX_PART_BG);
lv_style_int_t pright = lv_obj_get_style_pad_right(btnm, LV_BTNMATRIX_PART_BG);
lv_style_int_t ptop = lv_obj_get_style_pad_top(btnm, LV_BTNMATRIX_PART_BG);
lv_style_int_t pbottom = lv_obj_get_style_pad_bottom(btnm, LV_BTNMATRIX_PART_BG);
lv_style_int_t pinner = lv_obj_get_style_pad_inner(btnm, LV_BTNMATRIX_PART_BG);
/*Get the half inner padding. Button look larger with this value. (+1 for rounding error)*/
pinner = (pinner / 2) + 1 + (pinner & 1);
pinner = LV_MATH_MIN(pinner, BTN_EXTRA_CLICK_AREA_MAX);
pright = LV_MATH_MIN(pright, BTN_EXTRA_CLICK_AREA_MAX);
ptop = LV_MATH_MIN(ptop, BTN_EXTRA_CLICK_AREA_MAX);
pbottom = LV_MATH_MIN(pbottom, BTN_EXTRA_CLICK_AREA_MAX);
for(i = 0; i < ext->btn_cnt; i++) {
lv_area_copy(&btn_area, &ext->button_areas[i]);
if(btn_area.x1 <= pleft) btn_area.x1 += btnm_cords.x1 - LV_MATH_MIN(pleft, BTN_EXTRA_CLICK_AREA_MAX);
else btn_area.x1 += btnm_cords.x1 - pinner;
if(btn_area.y1 <= ptop) btn_area.y1 += btnm_cords.y1 - LV_MATH_MIN(ptop, BTN_EXTRA_CLICK_AREA_MAX);
else btn_area.y1 += btnm_cords.y1 - pinner;
if(btn_area.x2 >= w - pright - 2) btn_area.x2 += btnm_cords.x1 + LV_MATH_MIN(pright,
BTN_EXTRA_CLICK_AREA_MAX); /*-2 for rounding error*/
else btn_area.x2 += btnm_cords.x1 + pinner;
if(btn_area.y2 >= h - pbottom - 2) btn_area.y2 += btnm_cords.y1 + LV_MATH_MIN(pbottom,
BTN_EXTRA_CLICK_AREA_MAX); /*-2 for rounding error*/
else btn_area.y2 += btnm_cords.y1 + pinner;
if(_lv_area_is_point_on(&btn_area, p, 0) != false) {
break;
}
}
if(i == ext->btn_cnt) i = LV_BTNMATRIX_BTN_NONE;
return i;
}
static void invalidate_button_area(const lv_obj_t * btnm, uint16_t btn_idx)
{
if(btn_idx == LV_BTNMATRIX_BTN_NONE) return;
lv_area_t btn_area;
lv_area_t btnm_area;
lv_btnmatrix_ext_t * ext = lv_obj_get_ext_attr(btnm);
lv_area_copy(&btn_area, &ext->button_areas[btn_idx]);
lv_obj_get_coords(btnm, &btnm_area);
/* Convert relative coordinates to absolute */
btn_area.x1 += btnm_area.x1;
btn_area.y1 += btnm_area.y1;
btn_area.x2 += btnm_area.x1;
btn_area.y2 += btnm_area.y1;
lv_obj_invalidate_area(btnm, &btn_area);
}
/**
* Compares two button matrix maps for equality
* @param map1 map to compare
* @param map2 map to compare
* @return true if maps are identical in length and content
*/
static bool maps_are_identical(const char ** map1, const char ** map2)
{
if(map1 == map2) return true;
if(map1 == NULL || map2 == NULL) return map1 == map2;
uint16_t i = 0;
while(map1[i][0] != '\0' && map2[i][0] != '\0') {
if(strcmp(map1[i], map2[i]) != 0) return false;
i++;
}
return map1[i][0] == '\0' && map2[i][0] == '\0';
}
/**
* Enforces a single button being toggled on the button matrix.
* It simply clears the toggle flag on other buttons.
* @param btnm Button matrix object
* @param btn_idx Button that should remain toggled
*/
static void make_one_button_toggled(lv_obj_t * btnm, uint16_t btn_idx)
{
/*Save whether the button was toggled*/
bool was_toggled = lv_btnmatrix_get_btn_ctrl(btnm, btn_idx, LV_BTNMATRIX_CTRL_CHECK_STATE);
lv_btnmatrix_clear_btn_ctrl_all(btnm, LV_BTNMATRIX_CTRL_CHECK_STATE);
if(was_toggled) lv_btnmatrix_set_btn_ctrl(btnm, btn_idx, LV_BTNMATRIX_CTRL_CHECK_STATE);
}
#endif
|
train_000.parquet/957
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_btnmatrix.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 48279,
"token_count": 19224
}
|
/**
* @file lv_arc.h
*
*/
#ifndef LV_ARC_H
#define LV_ARC_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_ARC != 0
#include "../lv_core/lv_obj.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of arc*/
typedef struct {
/*New data for this type */
uint16_t rotation_angle;
uint16_t arc_angle_start;
uint16_t arc_angle_end;
uint16_t bg_angle_start;
uint16_t bg_angle_end;
lv_style_list_t style_arc;
} lv_arc_ext_t;
/*Parts of the arc*/
enum {
LV_ARC_PART_BG = LV_OBJ_PART_MAIN,
LV_ARC_PART_INDIC,
_LV_ARC_PART_VIRTUAL_LAST,
_LV_ARC_PART_REAL_LAST = _LV_OBJ_PART_REAL_LAST,
};
typedef uint8_t lv_arc_part_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a arc objects
* @param par pointer to an object, it will be the parent of the new arc
* @param copy pointer to a arc object, if not NULL then the new object will be copied from it
* @return pointer to the created arc
*/
lv_obj_t * lv_arc_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
*=====================*/
/*=====================
* Setter functions
*====================*/
/**
* Set the start angle of an arc. 0 deg: right, 90 bottom, etc.
* @param arc pointer to an arc object
* @param start the start angle
*/
void lv_arc_set_start_angle(lv_obj_t * arc, uint16_t start);
/**
* Set the start angle of an arc. 0 deg: right, 90 bottom, etc.
* @param arc pointer to an arc object
* @param end the end angle
*/
void lv_arc_set_end_angle(lv_obj_t * arc, uint16_t end);
/**
* Set the start and end angles
* @param arc pointer to an arc object
* @param start the start angle
* @param end the end angle
*/
void lv_arc_set_angles(lv_obj_t * arc, uint16_t start, uint16_t end);
/**
* Set the start angle of an arc background. 0 deg: right, 90 bottom, etc.
* @param arc pointer to an arc object
* @param start the start angle
*/
void lv_arc_set_bg_start_angle(lv_obj_t * arc, uint16_t start);
/**
* Set the start angle of an arc background. 0 deg: right, 90 bottom etc.
* @param arc pointer to an arc object
* @param end the end angle
*/
void lv_arc_set_bg_end_angle(lv_obj_t * arc, uint16_t end);
/**
* Set the start and end angles of the arc background
* @param arc pointer to an arc object
* @param start the start angle
* @param end the end angle
*/
void lv_arc_set_bg_angles(lv_obj_t * arc, uint16_t start, uint16_t end);
/**
* Set the rotation for the whole arc
* @param arc pointer to an arc object
* @param rotation_angle rotation angle
*/
void lv_arc_set_rotation(lv_obj_t * arc, uint16_t rotation_angle);
/*=====================
* Getter functions
*====================*/
/**
* Get the start angle of an arc.
* @param arc pointer to an arc object
* @return the start angle [0..360]
*/
uint16_t lv_arc_get_angle_start(lv_obj_t * arc);
/**
* Get the end angle of an arc.
* @param arc pointer to an arc object
* @return the end angle [0..360]
*/
uint16_t lv_arc_get_angle_end(lv_obj_t * arc);
/**
* Get the start angle of an arc background.
* @param arc pointer to an arc object
* @return the start angle [0..360]
*/
uint16_t lv_arc_get_bg_angle_start(lv_obj_t * arc);
/**
* Get the end angle of an arc background.
* @param arc pointer to an arc object
* @return the end angle [0..360]
*/
uint16_t lv_arc_get_bg_angle_end(lv_obj_t * arc);
/*=====================
* Other functions
*====================*/
/**********************
* MACROS
**********************/
#endif /*LV_USE_ARC*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_ARC_H*/
|
train_000.parquet/958
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_arc.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 3819,
"token_count": 1414
}
|
# Synology SSH key setup
<!-- <a href="https://github.com/007revad/Synology_SSH_key_setup/releases"><img src="https://img.shields.io/github/release/007revad/Synology_SSH_key_setup.svg"></a> -->

<!-- [](https://www.paypal.com/paypalme/007revad) -->
<!-- [](https://github.com/sponsors/007revad) -->
<!-- [](https://user-badge.committers.top/australia/007revad) -->
<!-- [](https://user-badge.committers.top/australia_public/007revad) -->
<!-- [](https://user-badge.committers.top/australia_private/007revad) -->
<!-- [](https://github.com/007revad/Synology_HDD_db/releases) -->
### Description
How to setup SSH key authentication for your Synology
Tommes has an excellent guide [in English here](https://github.com/toafez/Tutorials/blob/main/SynologyNAS/ssh_from_os_to_nas_en.md), and [in German here](https://github.com/toafez/Tutorials/blob/main/SynologyNAS/ssh_from_os_to_nas.md) that goes with their [YouTube video in German here](https://youtu.be/VjoWjX_8E3Q).
<br>
Content below from Gudbrand Olimb's now deleted https://blog.golimb.com/2020/10/03/synology-ssh-key-authentication/
<p align="left"><img src="/images/icon.jpg" width="467" height="200"></p>
There is a lot of posts throughout the web on configuring SSH key authentication on Synology NAS many with some confusing and unnecessary steps such as:
- Modifying the RSAAuthentication and PubkeyAuthentication parameters in /etc/ssh/sshd_config
- Restarting the sshd service multiple times with sudo synoservicectl --reload sshd
- Changing permissions on various folders with chmod both root folders and user folders
- Unclear creation of ~/.ssh folder ending up under root
After reading several and many great blog posts and guides on this I've tried to summarise what is actually required to make SSH key authentication work with Synology NAS assuming you are coming from a clean setup without to much changes. Hopefully this summary will help you so you dont need to search google and go through the same x number of guides.
Now through this whole guide you will be in the **context of a specific user** who is included in the **Administrator group**.
- _You will_ ***not*** _be sudo or su to root user although sudo will be used to perform some actions_.
- The reason why you need to have a user specified in the administrator group is because it is only administrators who are allowed to login through SSH by default ref below.
<p align="center"><img src="/images/image-1.png"></p>
So lets get started with the basic steps
## 1. Prerequisite - Enable SSH on your Synology NAS
As shown in the picture above to enable SSH for your Synology NAS go to Control Panel -> Terminal & SNMP -> Terminal Tab -> Check Enable SSH Service and enter a port.
- It is highly recommended to use a custom port and not standard 22 as you then will get a lot of brute force attempts from robots and attackers scanning public IPs against port 22, this is if you are exposing your Synology NAS to the internet.
## 2. Prerequisite - Creation of SSH key pair
To use SSH key authentication we will need to generate a SSH key pair (one privateKey, one publicKey). The publicKey will be shared with and stored in the Synology NAS SSH "authorized keys" while the privateKey will be used to prove our identity as it will correspond to the publicKey.
- **Windows**
- If you are on Windows I recommend downloading puttygen to generate the keys, its very quick and user friendly, see the link below for a guide on creation of RSA key.
https://www.ssh.com/ssh/putty/windows/puttygen
- **Mac**
- Open a terminal, navigate to a folder and run below to generate a public and private key
- `ssh-keygen -t rsa -b 4096 -C "user@domain.com"`
- Go here if you want to read up some more: https://www.ssh.com/ssh/keygen/
## 3. Prerequisite - Copy the publicKey
Open the created keyname.pub and copy the content to a text editor or similar. The public key should start on ssh-rsa and look a lot like below, beware there is no new line here, it is all in one line (this is also important for later).
```
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSkT3A1j89RT/540ghIMHXIVwNlAEM3WtmqVG7YN/wYwtsJ8iCszg4/lXQsfLFxYmEVe8L9atgtMGCi5QdYPl4X/c+5YxFfm88Yjfx+2xEgUdOr864eaI22yaNMQ0AlyilmK+PcSyxKP4dzkf6B5Nsw8lhfB5n9F5md6GHLLjOGuBbHYlesKJKnt2cMzzS90BdRk73qW6wJ+MCUWo+cyBFZVGOzrjJGEcHewOCbVs+IJWBFSi6w1enbKGc+RY9KrnzeDKWWqzYnNofiHGVFAuMxrmZOasqlTIKiC2UK3RmLxZicWiQmPnpnjJRo7pL0oYM9r/sIWzD6i2S9szDy6aZ user@domain.com
```
## 4. SSH into your NAS
Now that we have a key pair, we have enabled SSH on the Synology NAS lets log in to configure the SSH authorized_keys (= our generated public key)
Open a terminal and ssh into the server with your admin-user, ip and custom port:
```
ssh {admin-user}@{nas-ip-or-host} -p {specifiedCustomPort}
```
Now run `pwd` command to verify your are in the {admin-user} user directory.
- The result should be: ***/volume1/homes/{admin-user}***
## 5. Creation of .ssh directory and authorized_keys file
Now in the {admin-user} directory create a directory named **.ssh**
```
mkdir .ssh
```
Now navigate to the .ssh folder
```
cd .ssh
```
Now run the `pwd` command to verify you are in the right location) lets create a authorized_keys file.
- The result should be ***/volume1/homes/{admin-user}/.ssh***
Next create a authorized_keys file.
```
vi authorized_keys
```
This will take you into the vi program interface for adding content.
- Press **i** to enable inserting text.
- Paste your public key from step 3.
- Ensure you paste your public key on one line only, no new line and remember the spaces.
- Press **esc** to enter the vi program interface.
- Press semicolon **:** key.
- Type **wq!** and press enter to save the file.
Now lets verify the file is created with the `ls` command.
- The result should be ***authorized_keys**
Now lets verify the public key in the file with the command `more authorized_keys`
The result should look like:
```
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDSkT3A1j89RT/540ghIMHXIVwNlAEM3WtmqVG7YN/wYwtsJ8iCszg4/lXQsfLFxYmEVe8L9atgtMGCi5QdYPl4X/c+5YxFfm88Yjfx+2xEgUdOr864eaI22yaNMQ0AlyilmK+PcSyxKP4dzkf6B5Nsw8lhfB5n9F5md6GHLLjOGuBbHYlesKJKnt2cMzzS90BdRk73qW6wJ+MCUWo+cyBFZVGOzrjJGEcHewOCbVs+IJWBFSi6w1enbKGc+RY9KrnzeDKWWqzYnNofiHGVFAuMxrmZOasqlTIKiC2UK3RmLxZicWiQmPnpnjJRo7pL0oYM9r/sIWzD6i2S9szDy6aZ user@domain.com
```
## 6. Setting correct permissions
Now often at this point this is where a lot of confusion occurs when trying to do SSH authentication with Synology NAS. A lot of this confusion occurs because the {admin-user} home directory by default allows any access which the sshd SSH daemon considers insecure and then prevents SSH key authentication from occurring.
**Default permissions of users home folders is 777 / rwxrwxrwx**
- Users home folder = /volume1/homes/{username}
- In this case home folder = /volume1/homes/{admin-user}
<p align="center"><img src="/images/image-2.png" width="500" height="266"></p>
What we need to do is to change the permissions to below:
<p align="center"><img src="/images/image-3.png" width="500" height="266"></p>
This can be done by running:
```
sudo chmod 755 /volume1/homes/{admin-user}
```
There are some comments that changing the user home permissions might not be the best solution to resolve this due to security or the fact that a Synology update might change this later.
- The first case on security should not be a worry in itself as we are actually reducing security permissions by changing from 777 to 755 permissions
- The second case of Synology updates is something to be aware of and that you might need to set this permission again in future after an update if that update resets the permissions to 777
- Based on the fact that there is a risk of permissions being reset outside of our control I would discourage the removal of username/pw authentication possibility in sshd_config (/etc/ssh/sshd_config) which some has suggested to do when correctly having SSH key authentication working.
Now if you want to be 100% sure you have the correct permissions for the user home and the .ssh directory and authorized_keys you can either
- Run the following chmod commands to set the correct permissions:
```
sudo chmod 755 /volume1/homes/{admin-user}
sudo chmod 755 /volume1/homes/{admin-user}/.ssh
sudo chmod 644 /volume1/homes/{admin-user}/.ssh/authorized_keys
```
- Or check the permissions of each of the below folders and files one by one
- Chmod calculator - https://chmod-calculator.com/
Check the permissions of the following Folders and files:
```
/volume1/homes/{admin-user} | 755
/volume1/homes/{admin-user}/.ssh | 755
/volume1/homes/{admin-user}/.ssh/authorized_keys | 644
```
To check navigate to /volume1/homes/{admin-user}/.ssh and run ls -al
```
cd /volume1/homes/{admin-user}/.ssh
ls -al
drwxr-xr-x 2 {admin-user} users 4096 Oct 3 15:58 .
drwxr-xr-x 16 {admin-user} users 4096 Oct 3 16:08 ..
-rw-r--r-- 1 {admin-user} users 747 Oct 3 16:11 authorized_keys
```
. represents /volume1/homes/{admin-user}/.ssh folder <br>.. represents /volume1/homes/{admin-user} folder <br>authorized_keys represents /volume1/homes/{admin-user}/.ssh/authorized_keys file
## 7. Ready to test
Now we should be ready to go to connect to the Synology NAS with SSH key authentication. On your PC/Mac whatever go to the folder holding your private key, to test the connection perform the following command from terminal.
```
ssh {admin-user}@{nas-ip-or-host} -p {specifiedCustomPort} -o "IdentitiesOnly=yes" -i {privateKey}
```
Now hopefully you are automatically logged in to the Synology NAS over SSH as the key pair exchange and authentication happens in the backend.
Now if you want to simply your login so you can do as below for example:
```
ssh synologyNas
```
Then checkout the following link for setting up a SSH config file with and alias (synologyNas) with preconfigured parameters for ip/host, port, privatekey, user, etc
- https://mediatemple.net/community/products/grid/204644730/using-an-ssh-config-file
## 8. Troubleshooting
Log back into the Synology NAS using username/pw as {admin-user} through terminal and run command below, this will start a debug ssh server where you can see the interaction between Synology NAS and your PC/Mac
```
sudo /bin/sshd -p {debugPort} -d
```
Now from your PC/Mac open another terminal and perform the same key authentication command as before against the debug ssh server
```
ssh {admin-user}@{nas-ip-or-host} -p {debugPort} -o "IdentitiesOnly=yes" -i {privateKey}
```
Now in the session from step 1 you should be able to see the debug console any any issues such as permission issues etc.
### Common errors
**Wrong permissions on user home folder**
Error message:
```
debug1: temporarily_use_uid: 1026/100 (e=0/0)
debug1: trying public key file /var/services/homes/{admin-user}/.ssh/authorized_keys
debug1: fd 4 clearing O_NONBLOCK
Authentication refused: bad ownership or modes for directory /volume1/homes/{admin-user}
debug1: restore_uid: 0/0
```
Resolution: Go back to step 6 and ensure you set the correct permissions on the users home directory
<br>
**Wrong permissions on .ssh folder**
Error message:
```
debug1: temporarily_use_uid: 1026/100 (e=0/0)
debug1: trying public key file /var/services/homes/{admin-user}/.ssh/authorized_keys
debug1: fd 4 clearing O_NONBLOCK
Authentication refused: bad ownership or modes for directory /volume1/homes/{admin-user}/.ssh
debug1: restore_uid: 0/0
```
Resolution: Go back to step 6 and ensure you set the correct permissions on the .ssh directory
<br>
**Wrong permissions on authorized_keys file**
Error message:
```
debug1: trying public key file /var/services/homes/{admin-user}/.ssh/authorized_keys
debug1: Could not open authorized keys '/var/services/homes/{admin-user}/.ssh/authorized_keys': Permission denied
debug1: restore_uid: 0/0
```
Resolution: Go back to step 6 and ensure you set the correct permissions on the authorized_keys file in the .ssh directory
<br>
**Wrongly created .ssh folder (usually under wrong user context like e.g. root and not user)**
Error message:
```
debug1: temporarily_use_uid: 1026/100 (e=0/0)
debug1: trying public key file /var/services/homes/{admin-user}/.ssh/authorized_keys
debug1: Could not open authorized keys '/var/services/homes/{admin-user}/.ssh/authorized_keys': No such file or directory
debug1: restore_uid: 0/0
```
Resolution: Go back to step 5 and ensure you create the .ssh directory and authorized_keys under the correct context/user {admin-user}
This error can typically happen if you ended up creating the .ssh folder under root as below:
```
command as root - ash# pwd
result - /root/.ssh
```
What it should be:
```
command as {admin-user} - {admin-user}# pwd
result - /volume1/homes/{admin-user}/.ssh
```
### A few extra handy tips
If you think/feel that the SSH daemon on the Synology NAS is not taking into effect your changes you can try to restart the daemon by running below command (requires admin access)
```
sudo synoservicectl --reload sshd
```
On Mac to set correct permissions on .ssh folder and privateKeys used for SSH key authentication if you get error as below
```
Permissions 0777 for '/Users/username/.ssh/privateKeys/id_rsa' are too open.
It is recommended that your private key files are NOT accessible by others.
This private key will be ignored.
```
To correct the permissions to be valid run below
```
sudo chmod -R 755 ~/.ssh
sudo chmod -R 600 ~/.ssh/privateKeys/*
```
|
train_000.parquet/959
|
{
"file_path": "README.md",
"repo_id": "007revad/Synology_SSH_key_setup",
"size": 14188,
"token_count": 5046
}
|
/**
* @file lv_led.h
*
*/
#ifndef LV_LED_H
#define LV_LED_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_LED != 0
#include "../lv_core/lv_obj.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of led*/
typedef struct {
/*No inherited ext.*/
/*New data for this type */
uint8_t bright; /*Current brightness of the LED (0..255)*/
} lv_led_ext_t;
/*Parts of LED*/
enum {
LV_LED_PART_MAIN = LV_OBJ_PART_MAIN,
};
typedef uint8_t lv_led_part_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a led objects
* @param par pointer to an object, it will be the parent of the new led
* @param copy pointer to a led object, if not NULL then the new object will be copied from it
* @return pointer to the created led
*/
lv_obj_t * lv_led_create(lv_obj_t * par, const lv_obj_t * copy);
/**
* Set the brightness of a LED object
* @param led pointer to a LED object
* @param bright LV_LED_BRIGHT_MIN (max. dark) ... LV_LED_BRIGHT_MAX (max. light)
*/
void lv_led_set_bright(lv_obj_t * led, uint8_t bright);
/**
* Light on a LED
* @param led pointer to a LED object
*/
void lv_led_on(lv_obj_t * led);
/**
* Light off a LED
* @param led pointer to a LED object
*/
void lv_led_off(lv_obj_t * led);
/**
* Toggle the state of a LED
* @param led pointer to a LED object
*/
void lv_led_toggle(lv_obj_t * led);
/**
* Get the brightness of a LEd object
* @param led pointer to LED object
* @return bright 0 (max. dark) ... 255 (max. light)
*/
uint8_t lv_led_get_bright(const lv_obj_t * led);
/**********************
* MACROS
**********************/
#endif /*LV_USE_LED*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_LED_H*/
|
train_000.parquet/960
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_led.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 1903,
"token_count": 729
}
|
/**
* @file lv_roller.h
*
*/
#ifndef LV_ROLLER_H
#define LV_ROLLER_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_ROLLER != 0
/*Testing of dependencies*/
#if LV_USE_PAGE == 0
#error "lv_roller: lv_page is required. Enable it in lv_conf.h (LV_USE_PAGE 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "lv_page.h"
#include "lv_label.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/** Roller mode. */
enum {
LV_ROLLER_MODE_NORMAL, /**< Normal mode (roller ends at the end of the options). */
LV_ROLLER_MODE_INIFINITE, /**< Infinite mode (roller can be scrolled forever). */
};
typedef uint8_t lv_roller_mode_t;
/*Data of roller*/
typedef struct {
lv_page_ext_t page; /*Ext. of ancestor*/
/*New data for this type */
lv_style_list_t style_sel; /*Style of the selected option*/
uint16_t option_cnt; /*Number of options*/
uint16_t sel_opt_id; /*Index of the current option*/
uint16_t sel_opt_id_ori; /*Store the original index on focus*/
lv_roller_mode_t mode : 1;
uint8_t auto_fit : 1; /*1: Automatically set the width*/
} lv_roller_ext_t;
enum {
LV_ROLLER_PART_BG = LV_PAGE_PART_BG,
LV_ROLLER_PART_SELECTED = _LV_PAGE_PART_VIRTUAL_LAST,
_LV_ROLLER_PART_VIRTUAL_LAST,
};
typedef uint8_t lv_roller_part_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a roller object
* @param par pointer to an object, it will be the parent of the new roller
* @param copy pointer to a roller object, if not NULL then the new object will be copied from it
* @return pointer to the created roller
*/
lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
*====================*/
/**
* Set the options on a roller
* @param roller pointer to roller object
* @param options a string with '\n' separated options. E.g. "One\nTwo\nThree"
* @param mode `LV_ROLLER_MODE_NORMAL` or `LV_ROLLER_MODE_INFINITE`
*/
void lv_roller_set_options(lv_obj_t * roller, const char * options, lv_roller_mode_t mode);
/**
* Set the align of the roller's options (left, right or center[default])
* @param roller - pointer to a roller object
* @param align - one of lv_label_align_t values (left, right, center)
*/
void lv_roller_set_align(lv_obj_t * roller, lv_label_align_t align);
/**
* Set the selected option
* @param roller pointer to a roller object
* @param sel_opt id of the selected option (0 ... number of option - 1);
* @param anim LV_ANOM_ON: set with animation; LV_ANIM_OFF set immediately
*/
void lv_roller_set_selected(lv_obj_t * roller, uint16_t sel_opt, lv_anim_enable_t anim);
/**
* Set the height to show the given number of rows (options)
* @param roller pointer to a roller object
* @param row_cnt number of desired visible rows
*/
void lv_roller_set_visible_row_count(lv_obj_t * roller, uint8_t row_cnt);
/**
* Allow automatically setting the width of roller according to it's content.
* @param roller pointer to a roller object
* @param auto_fit true: enable auto fit
*/
void lv_roller_set_auto_fit(lv_obj_t * roller, bool auto_fit);
/**
* Set the open/close animation time.
* @param roller pointer to a roller object
* @param anim_time: open/close animation time [ms]
*/
static inline void lv_roller_set_anim_time(lv_obj_t * roller, uint16_t anim_time)
{
lv_page_set_anim_time(roller, anim_time);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the id of the selected option
* @param roller pointer to a roller object
* @return id of the selected option (0 ... number of option - 1);
*/
uint16_t lv_roller_get_selected(const lv_obj_t * roller);
/**
* Get the total number of options
* @param roller pointer to a roller object
* @return the total number of options in the list
*/
uint16_t lv_roller_get_option_cnt(const lv_obj_t * roller);
/**
* Get the current selected option as a string
* @param roller pointer to roller object
* @param buf pointer to an array to store the string
* @param buf_size size of `buf` in bytes. 0: to ignore it.
*/
void lv_roller_get_selected_str(const lv_obj_t * roller, char * buf, uint32_t buf_size);
/**
* Get the align attribute. Default alignment after _create is LV_LABEL_ALIGN_CENTER
* @param roller pointer to a roller object
* @return LV_LABEL_ALIGN_LEFT, LV_LABEL_ALIGN_RIGHT or LV_LABEL_ALIGN_CENTER
*/
lv_label_align_t lv_roller_get_align(const lv_obj_t * roller);
/**
* Get whether the auto fit option is enabled or not.
* @param roller pointer to a roller object
* @return true: auto fit is enabled
*/
bool lv_roller_get_auto_fit(lv_obj_t * roller);
/**
* Get the options of a roller
* @param roller pointer to roller object
* @return the options separated by '\n'-s (E.g. "Option1\nOption2\nOption3")
*/
const char * lv_roller_get_options(const lv_obj_t * roller);
/**
* Get the open/close animation time.
* @param roller pointer to a roller
* @return open/close animation time [ms]
*/
static inline uint16_t lv_roller_get_anim_time(const lv_obj_t * roller)
{
return lv_page_get_anim_time(roller);
}
/**********************
* MACROS
**********************/
#endif /*LV_USE_ROLLER*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_ROLLER_H*/
|
train_000.parquet/961
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_roller.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 5487,
"token_count": 1961
}
|
/**
* @file lv_spinner.h
*
*/
#ifndef LV_SPINNER_H
#define LV_SPINNER_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_SPINNER != 0
/*Testing of dependencies*/
#if LV_USE_ARC == 0
#error "lv_spinner: lv_arc is required. Enable it in lv_conf.h (LV_USE_ARC 1) "
#endif
#if LV_USE_ANIMATION == 0
#error "lv_spinner: animations are required. Enable it in lv_conf.h (LV_USE_ANIMATION 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "../lv_misc/lv_anim.h"
#include "lv_arc.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/**
* Type of spinner.
*/
enum {
LV_SPINNER_TYPE_SPINNING_ARC,
LV_SPINNER_TYPE_FILLSPIN_ARC,
LV_SPINNER_TYPE_CONSTANT_ARC,
};
typedef uint8_t lv_spinner_type_t;
/**
* Direction the spinner should spin.
*/
enum {
LV_SPINNER_DIR_FORWARD,
LV_SPINNER_DIR_BACKWARD,
};
typedef uint8_t lv_spinner_dir_t;
/*Data of spinner*/
typedef struct {
lv_arc_ext_t arc; /*Ext. of ancestor*/
/*New data for this type */
lv_anim_value_t arc_length; /*Length of the spinning indicator in degree*/
uint16_t time; /*Time of one round*/
lv_spinner_type_t anim_type : 2; /*Type of the arc animation*/
lv_spinner_dir_t anim_dir : 1; /*Animation Direction*/
} lv_spinner_ext_t;
/*Parts of the spinner*/
enum {
LV_SPINNER_PART_BG = LV_ARC_PART_BG,
LV_SPINNER_PART_INDIC = LV_ARC_PART_INDIC,
_LV_SPINNER_PART_VIRTUAL_LAST,
_LV_SPINNER_PART_REAL_LAST = _LV_ARC_PART_REAL_LAST,
};
typedef uint8_t lv_spinner_style_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a spinner object
* @param par pointer to an object, it will be the parent of the new spinner
* @param copy pointer to a spinner object, if not NULL then the new object will be copied from
* it
* @return pointer to the created spinner
*/
lv_obj_t * lv_spinner_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
*=====================*/
/**
* Set the length of the spinning arc in degrees
* @param spinner pointer to a spinner object
* @param deg length of the arc
*/
void lv_spinner_set_arc_length(lv_obj_t * spinner, lv_anim_value_t deg);
/**
* Set the spin time of the arc
* @param spinner pointer to a spinner object
* @param time time of one round in milliseconds
*/
void lv_spinner_set_spin_time(lv_obj_t * spinner, uint16_t time);
/*=====================
* Setter functions
*====================*/
/**
* Set the animation type of a spinner.
* @param spinner pointer to spinner object
* @param type animation type of the spinner
* */
void lv_spinner_set_type(lv_obj_t * spinner, lv_spinner_type_t type);
/**
* Set the animation direction of a spinner
* @param spinner pointer to spinner object
* @param direction animation direction of the spinner
*/
void lv_spinner_set_dir(lv_obj_t * spinner, lv_spinner_dir_t dir);
/*=====================
* Getter functions
*====================*/
/**
* Get the arc length [degree] of the a spinner
* @param spinner pointer to a spinner object
*/
lv_anim_value_t lv_spinner_get_arc_length(const lv_obj_t * spinner);
/**
* Get the spin time of the arc
* @param spinner pointer to a spinner object [milliseconds]
*/
uint16_t lv_spinner_get_spin_time(const lv_obj_t * spinner);
/**
* Get the animation type of a spinner.
* @param spinner pointer to spinner object
* @return animation type
* */
lv_spinner_type_t lv_spinner_get_type(lv_obj_t * spinner);
/**
* Get the animation direction of a spinner
* @param spinner pointer to spinner object
* @return animation direction
*/
lv_spinner_dir_t lv_spinner_get_dir(lv_obj_t * spinner);
/*=====================
* Other functions
*====================*/
/**
* Animator function (exec_cb) to rotate the arc of spinner.
* @param ptr pointer to spinner
* @param val the current desired value [0..360]
*/
void lv_spinner_anim_cb(void * ptr, lv_anim_value_t val);
/**********************
* MACROS
**********************/
#endif /*LV_USE_SPINNER*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_SPINNER_H*/
|
train_000.parquet/962
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_spinner.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 4297,
"token_count": 1623
}
|
/**
* @file lv_chart.h
*
*/
#ifndef LV_CHART_H
#define LV_CHART_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_CHART != 0
#include "../lv_core/lv_obj.h"
#include "lv_line.h"
/*********************
* DEFINES
*********************/
/**Default value of points. Can be used to not draw a point*/
#define LV_CHART_POINT_DEF (LV_COORD_MIN)
/**Automatically calculate the tick length*/
#define LV_CHART_TICK_LENGTH_AUTO 255
LV_EXPORT_CONST_INT(LV_CHART_POINT_DEF);
LV_EXPORT_CONST_INT(LV_CHART_TICK_LENGTH_AUTO);
/**********************
* TYPEDEFS
**********************/
/** Chart types*/
enum {
LV_CHART_TYPE_NONE = 0x00, /**< Don't draw the series*/
LV_CHART_TYPE_LINE = 0x01, /**< Connect the points with lines*/
LV_CHART_TYPE_COLUMN = 0x02, /**< Draw columns*/
LV_CHART_TYPE_SCATTER = 0x03, /**< X/Y chart, points and/or lines*/
};
typedef uint8_t lv_chart_type_t;
/** Chart update mode for `lv_chart_set_next`*/
enum {
LV_CHART_UPDATE_MODE_SHIFT, /**< Shift old data to the left and add the new one o the right*/
LV_CHART_UPDATE_MODE_CIRCULAR, /**< Add the new data in a circular way*/
};
typedef uint8_t lv_chart_update_mode_t;
enum {
LV_CHART_AXIS_PRIMARY_Y,
LV_CHART_AXIS_SECONDARY_Y,
_LV_CHART_AXIS_LAST,
};
typedef uint8_t lv_chart_axis_t;
typedef struct {
lv_coord_t * points;
lv_color_t color;
uint16_t start_point;
uint8_t ext_buf_assigned : 1;
lv_chart_axis_t y_axis : 1;
} lv_chart_series_t;
/** Data of axis */
enum {
LV_CHART_AXIS_SKIP_LAST_TICK = 0x00, /**< don't draw the last tick */
LV_CHART_AXIS_DRAW_LAST_TICK = 0x01, /**< draw the last tick */
LV_CHART_AXIS_INVERSE_LABELS_ORDER = 0x02 /**< draw tick labels in an inverted order*/
};
typedef uint8_t lv_chart_axis_options_t;
typedef struct {
const char * list_of_values;
lv_chart_axis_options_t options;
uint8_t num_tick_marks;
uint8_t major_tick_len;
uint8_t minor_tick_len;
} lv_chart_axis_cfg_t;
/*Data of chart */
typedef struct {
/*No inherited ext*/ /*Ext. of ancestor*/
/*New data for this type */
lv_ll_t series_ll; /*Linked list for the data line pointers (stores lv_chart_series_t)*/
lv_coord_t ymin[_LV_CHART_AXIS_LAST]; /*y min values for both axis (used to scale the data)*/
lv_coord_t ymax[_LV_CHART_AXIS_LAST]; /*y max values for both axis (used to scale the data)*/
uint8_t hdiv_cnt; /*Number of horizontal division lines*/
uint8_t vdiv_cnt; /*Number of vertical division lines*/
uint16_t point_cnt; /*Point number in a data line*/
lv_style_list_t style_series_bg;
lv_style_list_t style_series;
lv_chart_type_t type; /*Line, column or point chart (from 'lv_chart_type_t')*/
lv_chart_axis_cfg_t y_axis;
lv_chart_axis_cfg_t x_axis;
lv_chart_axis_cfg_t secondary_y_axis;
uint8_t update_mode : 1;
} lv_chart_ext_t;
/*Parts of the chart*/
enum {
LV_CHART_PART_BG = LV_OBJ_PART_MAIN,
LV_CHART_PART_SERIES_BG = _LV_OBJ_PART_VIRTUAL_LAST,
LV_CHART_PART_SERIES
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a chart background objects
* @param par pointer to an object, it will be the parent of the new chart background
* @param copy pointer to a chart background object, if not NULL then the new object will be copied
* from it
* @return pointer to the created chart background
*/
lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
*=====================*/
/**
* Allocate and add a data series to the chart
* @param chart pointer to a chart object
* @param color color of the data series
* @return pointer to the allocated data series
*/
lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color);
/**
* Clear the point of a series
* @param chart pointer to a chart object
* @param series pointer to the chart's series to clear
*/
void lv_chart_clear_series(lv_obj_t * chart, lv_chart_series_t * series);
/*=====================
* Setter functions
*====================*/
/**
* Set the number of horizontal and vertical division lines
* @param chart pointer to a graph background object
* @param hdiv number of horizontal division lines
* @param vdiv number of vertical division lines
*/
void lv_chart_set_div_line_count(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv);
/**
* Set the minimal and maximal y values on an axis
* @param chart pointer to a graph background object
* @param axis `LV_CHART_AXIS_PRIMARY_Y` or `LV_CHART_AXIS_SECONDARY_Y`
* @param ymin y minimum value
* @param ymax y maximum value
*/
void lv_chart_set_y_range(lv_obj_t * chart, lv_chart_axis_t axis, lv_coord_t ymin, lv_coord_t ymax);
/**
* Set a new type for a chart
* @param chart pointer to a chart object
* @param type new type of the chart (from 'lv_chart_type_t' enum)
*/
void lv_chart_set_type(lv_obj_t * chart, lv_chart_type_t type);
/**
* Set the number of points on a data line on a chart
* @param chart pointer r to chart object
* @param point_cnt new number of points on the data lines
*/
void lv_chart_set_point_count(lv_obj_t * chart, uint16_t point_cnt);
/**
* Initialize all data points with a value
* @param chart pointer to chart object
* @param ser pointer to a data series on 'chart'
* @param y the new value for all points
*/
void lv_chart_init_points(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t y);
/**
* Set the value of points from an array
* @param chart pointer to chart object
* @param ser pointer to a data series on 'chart'
* @param y_array array of 'lv_coord_t' points (with 'points count' elements )
*/
void lv_chart_set_points(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t y_array[]);
/**
* Shift all data right and set the most right data on a data line
* @param chart pointer to chart object
* @param ser pointer to a data series on 'chart'
* @param y the new value of the most right data
*/
void lv_chart_set_next(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t y);
/**
* Set update mode of the chart object.
* @param chart pointer to a chart object
* @param update mode
*/
void lv_chart_set_update_mode(lv_obj_t * chart, lv_chart_update_mode_t update_mode);
/**
* Set the length of the tick marks on the x axis
* @param chart pointer to the chart
* @param major_tick_len the length of the major tick or `LV_CHART_TICK_LENGTH_AUTO` to set automatically
* (where labels are added)
* @param minor_tick_len the length of the minor tick, `LV_CHART_TICK_LENGTH_AUTO` to set automatically
* (where no labels are added)
*/
void lv_chart_set_x_tick_length(lv_obj_t * chart, uint8_t major_tick_len, uint8_t minor_tick_len);
/**
* Set the length of the tick marks on the y axis
* @param chart pointer to the chart
* @param major_tick_len the length of the major tick or `LV_CHART_TICK_LENGTH_AUTO` to set automatically
* (where labels are added)
* @param minor_tick_len the length of the minor tick, `LV_CHART_TICK_LENGTH_AUTO` to set automatically
* (where no labels are added)
*/
void lv_chart_set_y_tick_length(lv_obj_t * chart, uint8_t major_tick_len, uint8_t minor_tick_len);
/**
* Set the length of the tick marks on the secondary y axis
* @param chart pointer to the chart
* @param major_tick_len the length of the major tick or `LV_CHART_TICK_LENGTH_AUTO` to set automatically
* (where labels are added)
* @param minor_tick_len the length of the minor tick, `LV_CHART_TICK_LENGTH_AUTO` to set automatically
* (where no labels are added)
*/
void lv_chart_set_secondary_y_tick_length(lv_obj_t * chart, uint8_t major_tick_len, uint8_t minor_tick_len);
/**
* Set the x-axis tick count and labels of a chart
* @param chart pointer to a chart object
* @param list_of_values list of string values, terminated with \n, except the last
* @param num_tick_marks if list_of_values is NULL: total number of ticks per axis
* else number of ticks between two value labels
* @param options extra options
*/
void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks,
lv_chart_axis_options_t options);
/**
* Set the secondary y-axis tick count and labels of a chart
* @param chart pointer to a chart object
* @param list_of_values list of string values, terminated with \n, except the last
* @param num_tick_marks if list_of_values is NULL: total number of ticks per axis
* else number of ticks between two value labels
* @param options extra options
*/
void lv_chart_set_secondary_y_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks,
lv_chart_axis_options_t options);
/**
* Set the y-axis tick count and labels of a chart
* @param chart pointer to a chart object
* @param list_of_values list of string values, terminated with \n, except the last
* @param num_tick_marks if list_of_values is NULL: total number of ticks per axis
* else number of ticks between two value labels
* @param options extra options
*/
void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks,
lv_chart_axis_options_t options);
/**
* Set the index of the x-axis start point in the data array
* @param chart pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @param id the index of the x point in the data array
*/
void lv_chart_set_x_start_point(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id);
/**
* Set an external array of data points to use for the chart
* NOTE: It is the users responsibility to make sure the point_cnt matches the external array size.
* @param chart pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @param array external array of points for chart
*/
void lv_chart_set_ext_array(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t array[], uint16_t point_cnt);
/**
* Set an individual point value in the chart series directly based on index
* @param chart pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @param value value to assign to array point
* @param id the index of the x point in the array
*/
void lv_chart_set_point_id(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t value, uint16_t id);
/**
* Set the Y axis of a series
* @param chart pointer to a chart object
* @param ser pointer to series
* @param axis `LV_CHART_AXIS_PRIMARY_Y` or `LV_CHART_AXIS_SECONDARY_Y`
*/
void lv_chart_set_series_axis(lv_obj_t * chart, lv_chart_series_t * ser, lv_chart_axis_t axis);
/*=====================
* Getter functions
*====================*/
/**
* Get the type of a chart
* @param chart pointer to chart object
* @return type of the chart (from 'lv_chart_t' enum)
*/
lv_chart_type_t lv_chart_get_type(const lv_obj_t * chart);
/**
* Get the data point number per data line on chart
* @param chart pointer to chart object
* @return point number on each data line
*/
uint16_t lv_chart_get_point_count(const lv_obj_t * chart);
/**
* get the current index of the x-axis start point in the data array
* @param ser pointer to a data series on 'chart'
* @return the index of the current x start point in the data array
*/
uint16_t lv_chart_get_x_start_point(lv_chart_series_t * ser);
/**
* Get an individual point value in the chart series directly based on index
* @param chart pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @param id the index of the x point in the array
* @return value of array point at index id
*/
lv_coord_t lv_chart_get_point_id(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id);
/**
* Get the Y axis of a series
* @param chart pointer to a chart object
* @param ser pointer to series
* @return `LV_CHART_AXIS_PRIMARY_Y` or `LV_CHART_AXIS_SECONDARY_Y`
*/
lv_chart_axis_t lv_chart_get_series_axis(lv_obj_t * chart, lv_chart_series_t * ser);
/*=====================
* Other functions
*====================*/
/**
* Refresh a chart if its data line has changed
* @param chart pointer to chart object
*/
void lv_chart_refresh(lv_obj_t * chart);
/**********************
* MACROS
**********************/
#endif /*LV_USE_CHART*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_CHART_H*/
|
train_000.parquet/963
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_chart.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 13038,
"token_count": 4571
}
|
/**
* @file lv_list.h
*
*/
#ifndef LV_LIST_H
#define LV_LIST_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_LIST != 0
/*Testing of dependencies*/
#if LV_USE_PAGE == 0
#error "lv_list: lv_page is required. Enable it in lv_conf.h (LV_USE_PAGE 1) "
#endif
#if LV_USE_BTN == 0
#error "lv_list: lv_btn is required. Enable it in lv_conf.h (LV_USE_BTN 1) "
#endif
#if LV_USE_LABEL == 0
#error "lv_list: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "lv_page.h"
#include "lv_btn.h"
#include "lv_label.h"
#include "lv_img.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of list*/
typedef struct {
lv_page_ext_t page; /*Ext. of ancestor*/
/*New data for this type */
#if LV_USE_GROUP
lv_obj_t * last_sel_btn; /* The last selected button. It will be reverted when the list is focused again */
#endif
lv_obj_t * act_sel_btn; /* The button is currently being selected*/
} lv_list_ext_t;
/** List styles. */
enum {
LV_LIST_PART_BG = LV_PAGE_PART_BG, /**< List background style */
LV_LIST_PART_SCROLLBAR = LV_PAGE_PART_SCROLLBAR, /**< List scrollbar style. */
LV_LIST_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH, /**< List edge flash style. */
_LV_LIST_PART_VIRTUAL_LAST = _LV_PAGE_PART_VIRTUAL_LAST,
LV_LIST_PART_SCROLLABLE = LV_PAGE_PART_SCROLLABLE, /**< List scrollable area style. */
_LV_LIST_PART_REAL_LAST = _LV_PAGE_PART_REAL_LAST,
};
typedef uint8_t lv_list_style_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a list objects
* @param par pointer to an object, it will be the parent of the new list
* @param copy pointer to a list object, if not NULL then the new object will be copied from it
* @return pointer to the created list
*/
lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy);
/**
* Delete all children of the scrl object, without deleting scrl child.
* @param list pointer to an object
*/
void lv_list_clean(lv_obj_t * list);
/*======================
* Add/remove functions
*=====================*/
/**
* Add a list element to the list
* @param list pointer to list object
* @param img_fn file name of an image before the text (NULL if unused)
* @param txt text of the list element (NULL if unused)
* @return pointer to the new list element which can be customized (a button)
*/
lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * txt);
/**
* Remove the index of the button in the list
* @param list pointer to a list object
* @param index pointer to a the button's index in the list, index must be 0 <= index <
* lv_list_ext_t.size
* @return true: successfully deleted
*/
bool lv_list_remove(const lv_obj_t * list, uint16_t index);
/*=====================
* Setter functions
*====================*/
/**
* Make a button selected
* @param list pointer to a list object
* @param btn pointer to a button to select
* NULL to not select any buttons
*/
void lv_list_focus_btn(lv_obj_t * list, lv_obj_t * btn);
/**
* Set the scroll bar mode of a list
* @param list pointer to a list object
* @param sb_mode the new mode from 'lv_page_sb_mode_t' enum
*/
static inline void lv_list_set_scrollbar_mode(lv_obj_t * list, lv_scrollbar_mode_t mode)
{
lv_page_set_scrollbar_mode(list, mode);
}
/**
* Enable the scroll propagation feature. If enabled then the List will move its parent if there is
* no more space to scroll.
* @param list pointer to a List
* @param en true or false to enable/disable scroll propagation
*/
static inline void lv_list_set_scroll_propagation(lv_obj_t * list, bool en)
{
lv_page_set_scroll_propagation(list, en);
}
/**
* Enable the edge flash effect. (Show an arc when the an edge is reached)
* @param list pointer to a List
* @param en true or false to enable/disable end flash
*/
static inline void lv_list_set_edge_flash(lv_obj_t * list, bool en)
{
lv_page_set_edge_flash(list, en);
}
/**
* Set scroll animation duration on 'list_up()' 'list_down()' 'list_focus()'
* @param list pointer to a list object
* @param anim_time duration of animation [ms]
*/
static inline void lv_list_set_anim_time(lv_obj_t * list, uint16_t anim_time)
{
lv_page_set_anim_time(list, anim_time);
}
/**
* Set layout of a list
* @param list pointer to a list object
* @param layout which layout should be used
*/
void lv_list_set_layout(lv_obj_t * list, lv_layout_t layout);
/*=====================
* Getter functions
*====================*/
/**
* Get the text of a list element
* @param btn pointer to list element
* @return pointer to the text
*/
const char * lv_list_get_btn_text(const lv_obj_t * btn);
/**
* Get the label object from a list element
* @param btn pointer to a list element (button)
* @return pointer to the label from the list element or NULL if not found
*/
lv_obj_t * lv_list_get_btn_label(const lv_obj_t * btn);
/**
* Get the image object from a list element
* @param btn pointer to a list element (button)
* @return pointer to the image from the list element or NULL if not found
*/
lv_obj_t * lv_list_get_btn_img(const lv_obj_t * btn);
/**
* Get the next button from list. (Starts from the bottom button)
* @param list pointer to a list object
* @param prev_btn pointer to button. Search the next after it.
* @return pointer to the next button or NULL when no more buttons
*/
lv_obj_t * lv_list_get_prev_btn(const lv_obj_t * list, lv_obj_t * prev_btn);
/**
* Get the previous button from list. (Starts from the top button)
* @param list pointer to a list object
* @param prev_btn pointer to button. Search the previous before it.
* @return pointer to the previous button or NULL when no more buttons
*/
lv_obj_t * lv_list_get_next_btn(const lv_obj_t * list, lv_obj_t * prev_btn);
/**
* Get the index of the button in the list
* @param list pointer to a list object. If NULL, assumes btn is part of a list.
* @param btn pointer to a list element (button)
* @return the index of the button in the list, or -1 of the button not in this list
*/
int32_t lv_list_get_btn_index(const lv_obj_t * list, const lv_obj_t * btn);
/**
* Get the number of buttons in the list
* @param list pointer to a list object
* @return the number of buttons in the list
*/
uint16_t lv_list_get_size(const lv_obj_t * list);
#if LV_USE_GROUP
/**
* Get the currently selected button. Can be used while navigating in the list with a keypad.
* @param list pointer to a list object
* @return pointer to the selected button
*/
lv_obj_t * lv_list_get_btn_selected(const lv_obj_t * list);
#endif
/**
* Get layout of a list
* @param list pointer to a list object
* @return layout of the list object
*/
lv_layout_t lv_list_get_layout(lv_obj_t * list);
/**
* Get the scroll bar mode of a list
* @param list pointer to a list object
* @return scrollbar mode from 'lv_scrollbar_mode_t' enum
*/
static inline lv_scrollbar_mode_t lv_list_get_scrollbar_mode(const lv_obj_t * list)
{
return lv_page_get_scrollbar_mode(list);
}
/**
* Get the scroll propagation property
* @param list pointer to a List
* @return true or false
*/
static inline bool lv_list_get_scroll_propagation(lv_obj_t * list)
{
return lv_page_get_scroll_propagation(list);
}
/**
* Get the scroll propagation property
* @param list pointer to a List
* @return true or false
*/
static inline bool lv_list_get_edge_flash(lv_obj_t * list)
{
return lv_page_get_edge_flash(list);
}
/**
* Get scroll animation duration
* @param list pointer to a list object
* @return duration of animation [ms]
*/
static inline uint16_t lv_list_get_anim_time(const lv_obj_t * list)
{
return lv_page_get_anim_time(list);
}
/*=====================
* Other functions
*====================*/
/**
* Move the list elements up by one
* @param list pointer a to list object
*/
void lv_list_up(const lv_obj_t * list);
/**
* Move the list elements down by one
* @param list pointer to a list object
*/
void lv_list_down(const lv_obj_t * list);
/**
* Focus on a list button. It ensures that the button will be visible on the list.
* @param btn pointer to a list button to focus
* @param anim LV_ANOM_ON: scroll with animation, LV_ANIM_OFF: without animation
*/
void lv_list_focus(const lv_obj_t * btn, lv_anim_enable_t anim);
/**********************
* MACROS
**********************/
#endif /*LV_USE_LIST*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_LIST_H*/
|
train_000.parquet/964
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_list.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 8683,
"token_count": 3126
}
|
/**
* @file lv_objmask.h
*
*/
#ifndef LV_OBJMASK_H
#define LV_OBJMASK_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_OBJMASK != 0
#include "../lv_core/lv_obj.h"
#include "../lv_widgets/lv_cont.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
typedef struct {
void * param;
} lv_objmask_mask_t;
/*Data of object mask*/
typedef struct {
lv_cont_ext_t cont; /*Ext. of ancestor*/
/*New data for this type */
lv_ll_t mask_ll; /*Store the created masks*/
} lv_objmask_ext_t;
/*Parts of the object*/
enum {
LV_OBJMASK_PART_MAIN,
};
typedef uint8_t lv_objmask_part_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a object mask objects
* @param par pointer to an object, it will be the parent of the new object mask
* @param copy pointer to a object mask object, if not NULL then the new object will be copied from it
* @return pointer to the created object mask
*/
lv_obj_t * lv_objmask_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
*=====================*/
/**
* Add a mask
* @param objmask pointer to an Object mask object
* @param param an initialized mask parameter
* @return pointer to the added mask
*/
lv_objmask_mask_t * lv_objmask_add_mask(lv_obj_t * objmask, void * param);
/**
* Update an already created mask
* @param objmask pointer to an Object mask object
* @param mask pointer to created mask (returned by `lv_objmask_add_mask`)
* @param param an initialized mask parameter (initialized by `lv_draw_mask_line/angle/.../_init`)
*/
void lv_objmask_update_mask(lv_obj_t * objmask, lv_objmask_mask_t * mask, void * param);
/**
* Remove a mask
* @param objmask pointer to an Object mask object
* @param mask pointer to created mask (returned by `lv_objmask_add_mask`)
* If `NULL` passed all masks will be deleted.
*/
void lv_objmask_remove_mask(lv_obj_t * objmask, lv_objmask_mask_t * mask);
/*=====================
* Setter functions
*====================*/
/*=====================
* Getter functions
*====================*/
/*=====================
* Other functions
*====================*/
/**********************
* MACROS
**********************/
#endif /*LV_USE_OBJMASK*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_OBJMASK_H*/
|
train_000.parquet/965
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_objmask.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 2504,
"token_count": 872
}
|
/**
* @file lv_templ.h
*
*/
/* TODO Remove these instructions
* Search an replace: template -> object normal name with lower case (e.g. button, label etc.)
* templ -> object short name with lower case(e.g. btn, label etc)
* TEMPL -> object short name with upper case (e.g. BTN, LABEL etc.)
*
*/
#ifndef LV_TEMPL_H
#define LV_TEMPL_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_TEMPL != 0
#include "../lv_core/lv_obj.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of template*/
typedef struct {
lv_ANCESTOR_ext_t ANCESTOR; /*Ext. of ancestor*/
/*New data for this type */
} lv_templ_ext_t;
/*Styles*/
enum {
LV_TEMPL_STYLE_X,
LV_TEMPL_STYLE_Y,
};
typedef uint8_t lv_templ_style_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a template objects
* @param par pointer to an object, it will be the parent of the new template
* @param copy pointer to a template object, if not NULL then the new object will be copied from it
* @return pointer to the created template
*/
lv_obj_t * lv_templ_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
*=====================*/
/*=====================
* Setter functions
*====================*/
/**
* Set a style of a template.
* @param templ pointer to template object
* @param type which style should be set
* @param style pointer to a style
*/
void lv_templ_set_style(lv_obj_t * templ, lv_templ_style_t type, const lv_style_t * style);
/*=====================
* Getter functions
*====================*/
/**
* Get style of a template.
* @param templ pointer to template object
* @param type which style should be get
* @return style pointer to the style
*/
lv_style_t * lv_templ_get_style(const lv_obj_t * templ, lv_templ_style_t type);
/*=====================
* Other functions
*====================*/
/**********************
* MACROS
**********************/
#endif /*LV_USE_TEMPL*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_TEMPL_H*/
|
train_000.parquet/966
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_objx_templ.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 2276,
"token_count": 779
}
|
/**
* @file lv_sw.h
*
*/
#ifndef LV_SWITCH_H
#define LV_SWITCH_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_SWITCH != 0
/*Testing of dependencies*/
#if LV_USE_SLIDER == 0
#error "lv_sw: lv_slider is required. Enable it in lv_conf.h (LV_USE_SLIDER 1)"
#endif
#include "../lv_core/lv_obj.h"
#include "lv_bar.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of switch*/
typedef struct {
lv_bar_ext_t bar; /*Ext. of ancestor*/
/*New data for this type */
lv_style_list_t style_knob; /*Style of the knob*/
uint8_t state : 1; /*The current state*/
} lv_switch_ext_t;
/**
* Switch parts.
*/
enum {
LV_SWITCH_PART_BG = LV_BAR_PART_BG, /**< Switch background. */
LV_SWITCH_PART_INDIC = LV_BAR_PART_INDIC, /**< Switch fill area. */
LV_SWITCH_PART_KNOB = _LV_BAR_PART_VIRTUAL_LAST, /**< Switch knob. */
_LV_SWITCH_PART_VIRTUAL_LAST
};
typedef uint8_t lv_switch_part_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a switch objects
* @param par pointer to an object, it will be the parent of the new switch
* @param copy pointer to a switch object, if not NULL then the new object will be copied from it
* @return pointer to the created switch
*/
lv_obj_t * lv_switch_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
*====================*/
/**
* Turn ON the switch
* @param sw pointer to a switch object
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
void lv_switch_on(lv_obj_t * sw, lv_anim_enable_t anim);
/**
* Turn OFF the switch
* @param sw pointer to a switch object
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
void lv_switch_off(lv_obj_t * sw, lv_anim_enable_t anim);
/**
* Toggle the position of the switch
* @param sw pointer to a switch object
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
* @return resulting state of the switch.
*/
bool lv_switch_toggle(lv_obj_t * sw, lv_anim_enable_t anim);
/**
* Set the animation time of the switch
* @param sw pointer to a switch object
* @param anim_time animation time
* @return style pointer to a style
*/
static inline void lv_switch_set_anim_time(lv_obj_t * sw, uint16_t anim_time)
{
lv_bar_set_anim_time(sw, anim_time);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the state of a switch
* @param sw pointer to a switch object
* @return false: OFF; true: ON
*/
static inline bool lv_switch_get_state(const lv_obj_t * sw)
{
lv_switch_ext_t * ext = (lv_switch_ext_t *)lv_obj_get_ext_attr(sw);
return ext->state ? true : false;
}
/**
* Get the animation time of the switch
* @param sw pointer to a switch object
* @return style pointer to a style
*/
static inline uint16_t lv_switch_get_anim_time(const lv_obj_t * sw)
{
return lv_bar_get_anim_time(sw);
}
/**********************
* MACROS
**********************/
#endif /*LV_USE_SWITCH*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_SWITCH_H*/
|
train_000.parquet/967
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_switch.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 3378,
"token_count": 1260
}
|
/**
* @file lv_cpicker.h
*
*/
#ifndef LV_CPICKER_H
#define LV_CPICKER_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_CPICKER != 0
#include "../lv_core/lv_obj.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
enum {
LV_CPICKER_TYPE_RECT,
LV_CPICKER_TYPE_DISC,
};
typedef uint8_t lv_cpicker_type_t;
enum {
LV_CPICKER_COLOR_MODE_HUE,
LV_CPICKER_COLOR_MODE_SATURATION,
LV_CPICKER_COLOR_MODE_VALUE
};
typedef uint8_t lv_cpicker_color_mode_t;
/*Data of colorpicker*/
typedef struct {
lv_color_hsv_t hsv;
struct {
lv_style_list_t style_list;
lv_point_t pos;
uint8_t colored : 1;
} knob;
uint32_t last_click_time;
uint32_t last_change_time;
lv_point_t last_press_point;
lv_cpicker_color_mode_t color_mode : 2;
uint8_t color_mode_fixed : 1;
lv_cpicker_type_t type : 1;
} lv_cpicker_ext_t;
/*Parts*/
enum {
LV_CPICKER_PART_MAIN = LV_OBJ_PART_MAIN,
LV_CPICKER_PART_KNOB = _LV_OBJ_PART_VIRTUAL_LAST,
_LV_CPICKER_PART_VIRTUAL_LAST,
_LV_CPICKER_PART_REAL_LAST = _LV_OBJ_PART_REAL_LAST,
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a colorpicker objects
* @param par pointer to an object, it will be the parent of the new colorpicker
* @param copy pointer to a colorpicker object, if not NULL then the new object will be copied from it
* @return pointer to the created colorpicker
*/
lv_obj_t * lv_cpicker_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
*====================*/
/**
* Set a new type for a colorpicker
* @param cpicker pointer to a colorpicker object
* @param type new type of the colorpicker (from 'lv_cpicker_type_t' enum)
*/
void lv_cpicker_set_type(lv_obj_t * cpicker, lv_cpicker_type_t type);
/**
* Set the current hue of a colorpicker.
* @param cpicker pointer to colorpicker object
* @param hue current selected hue [0..360]
* @return true if changed, otherwise false
*/
bool lv_cpicker_set_hue(lv_obj_t * cpicker, uint16_t hue);
/**
* Set the current saturation of a colorpicker.
* @param cpicker pointer to colorpicker object
* @param saturation current selected saturation [0..100]
* @return true if changed, otherwise false
*/
bool lv_cpicker_set_saturation(lv_obj_t * cpicker, uint8_t saturation);
/**
* Set the current value of a colorpicker.
* @param cpicker pointer to colorpicker object
* @param val current selected value [0..100]
* @return true if changed, otherwise false
*/
bool lv_cpicker_set_value(lv_obj_t * cpicker, uint8_t val);
/**
* Set the current hsv of a colorpicker.
* @param cpicker pointer to colorpicker object
* @param hsv current selected hsv
* @return true if changed, otherwise false
*/
bool lv_cpicker_set_hsv(lv_obj_t * cpicker, lv_color_hsv_t hsv);
/**
* Set the current color of a colorpicker.
* @param cpicker pointer to colorpicker object
* @param color current selected color
* @return true if changed, otherwise false
*/
bool lv_cpicker_set_color(lv_obj_t * cpicker, lv_color_t color);
/**
* Set the current color mode.
* @param cpicker pointer to colorpicker object
* @param mode color mode (hue/sat/val)
*/
void lv_cpicker_set_color_mode(lv_obj_t * cpicker, lv_cpicker_color_mode_t mode);
/**
* Set if the color mode is changed on long press on center
* @param cpicker pointer to colorpicker object
* @param fixed color mode cannot be changed on long press
*/
void lv_cpicker_set_color_mode_fixed(lv_obj_t * cpicker, bool fixed);
/**
* Make the knob to be colored to the current color
* @param cpicker pointer to colorpicker object
* @param en true: color the knob; false: not color the knob
*/
void lv_cpicker_set_knob_colored(lv_obj_t * cpicker, bool en);
/*=====================
* Getter functions
*====================*/
/**
* Get the current color mode.
* @param cpicker pointer to colorpicker object
* @return color mode (hue/sat/val)
*/
lv_cpicker_color_mode_t lv_cpicker_get_color_mode(lv_obj_t * cpicker);
/**
* Get if the color mode is changed on long press on center
* @param cpicker pointer to colorpicker object
* @return mode cannot be changed on long press
*/
bool lv_cpicker_get_color_mode_fixed(lv_obj_t * cpicker);
/**
* Get the current hue of a colorpicker.
* @param cpicker pointer to colorpicker object
* @return current selected hue
*/
uint16_t lv_cpicker_get_hue(lv_obj_t * cpicker);
/**
* Get the current saturation of a colorpicker.
* @param cpicker pointer to colorpicker object
* @return current selected saturation
*/
uint8_t lv_cpicker_get_saturation(lv_obj_t * cpicker);
/**
* Get the current hue of a colorpicker.
* @param cpicker pointer to colorpicker object
* @return current selected value
*/
uint8_t lv_cpicker_get_value(lv_obj_t * cpicker);
/**
* Get the current selected hsv of a colorpicker.
* @param cpicker pointer to colorpicker object
* @return current selected hsv
*/
lv_color_hsv_t lv_cpicker_get_hsv(lv_obj_t * cpicker);
/**
* Get the current selected color of a colorpicker.
* @param cpicker pointer to colorpicker object
* @return current selected color
*/
lv_color_t lv_cpicker_get_color(lv_obj_t * cpicker);
/**
* Whether the knob is colored to the current color or not
* @param cpicker pointer to color picker object
* @return true: color the knob; false: not color the knob
*/
bool lv_cpicker_get_knob_colored(lv_obj_t * cpicker);
/*=====================
* Other functions
*====================*/
/**********************
* MACROS
**********************/
#endif /*LV_USE_CPICKER*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_CPICKER_H*/
|
train_000.parquet/968
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_cpicker.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 5878,
"token_count": 2142
}
|
/**
* @file lv_objmask.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_objmask.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_themes/lv_theme.h"
#if defined(LV_USE_OBJMASK) && LV_USE_OBJMASK != 0
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_objmask"
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_design_res_t lv_objmask_design(lv_obj_t * objmask, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_objmask_signal(lv_obj_t * objmask, lv_signal_t sign, void * param);
static uint16_t get_param_size(lv_draw_mask_type_t type);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
static lv_design_cb_t ancestor_design;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a object mask object
* @param par pointer to an object, it will be the parent of the new object mask
* @param copy pointer to a object mask object, if not NULL then the new object will be copied from it
* @return pointer to the created object mask
*/
lv_obj_t * lv_objmask_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("object mask create started");
/*Create the ancestor of object mask*/
lv_obj_t * objmask = lv_cont_create(par, copy);
LV_ASSERT_MEM(objmask);
if(objmask == NULL) return NULL;
/*Allocate the object mask type specific extended data*/
lv_objmask_ext_t * ext = lv_obj_allocate_ext_attr(objmask, sizeof(lv_objmask_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(objmask);
return NULL;
}
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(objmask);
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(objmask);
/*Initialize the allocated 'ext' */
_lv_ll_init(&ext->mask_ll, sizeof(lv_objmask_mask_t));
/*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(objmask, lv_objmask_signal);
lv_obj_set_design_cb(objmask, lv_objmask_design);
/*Init the new object mask object mask*/
if(copy == NULL) {
lv_theme_apply(objmask, LV_THEME_OBJMASK);
}
/*TODO: Copy an existing object mask*/
else {
/* lv_objmask_ext_t * copy_ext = lv_obj_get_ext_attr(copy); */
/*Refresh the style with new signal function*/
lv_obj_refresh_style(objmask, LV_STYLE_PROP_ALL);
}
LV_LOG_INFO("object mask created");
return objmask;
}
/*======================
* Add/remove functions
*=====================*/
/**
* Add a mask
* @param objmask pointer to an Object mask object
* @param param an initialized mask parameter
* @return pointer to the added mask
*/
lv_objmask_mask_t * lv_objmask_add_mask(lv_obj_t * objmask, void * param)
{
LV_ASSERT_OBJ(objmask, LV_OBJX_NAME);
LV_ASSERT_NULL(param);
lv_objmask_ext_t * ext = lv_obj_get_ext_attr(objmask);
lv_draw_mask_common_dsc_t * dsc = param;
uint16_t param_size = get_param_size(dsc->type);
lv_objmask_mask_t * m = _lv_ll_ins_head(&ext->mask_ll);
LV_ASSERT_MEM(m);
if(m == NULL) return NULL;
m->param = lv_mem_alloc(param_size);
LV_ASSERT_MEM(m->param);
if(m->param == NULL) return NULL;
_lv_memcpy(m->param, param, param_size);
lv_obj_invalidate(objmask);
return m;
}
/**
* Update an already created mask
* @param objmask pointer to an Object mask object
* @param mask pointer to created mask (returned by `lv_objmask_add_mask`)
* @param param an initialized mask parameter (initialized by `lv_draw_mask_line/angle/.../_init`)
*/
void lv_objmask_update_mask(lv_obj_t * objmask, lv_objmask_mask_t * mask, void * param)
{
LV_ASSERT_OBJ(objmask, LV_OBJX_NAME);
LV_ASSERT_NULL(mask);
LV_ASSERT_NULL(param);
lv_draw_mask_common_dsc_t * dsc = param;
memcpy(mask->param, param, get_param_size(dsc->type));
lv_obj_invalidate(objmask);
}
/**
* Remove a mask
* @param objmask pointer to an Object mask object
* @param mask pointer to created mask (returned by `lv_objmask_add_mask`)
* If `NULL` passed all masks will be deleted.
*/
void lv_objmask_remove_mask(lv_obj_t * objmask, lv_objmask_mask_t * mask)
{
LV_ASSERT_OBJ(objmask, LV_OBJX_NAME);
lv_objmask_ext_t * ext = lv_obj_get_ext_attr(objmask);
/*Remove all masks*/
if(mask == NULL) {
lv_objmask_mask_t * m;
_LV_LL_READ(ext->mask_ll, m) {
lv_mem_free(m->param);
}
_lv_ll_clear(&ext->mask_ll);
}
/*Remove only the specified mask*/
else {
lv_mem_free(mask->param);
_lv_ll_remove(&ext->mask_ll, mask);
lv_mem_free(mask);
}
lv_obj_invalidate(objmask);
}
/*=====================
* Setter functions
*====================*/
/*=====================
* Getter functions
*====================*/
/*=====================
* Other functions
*====================*/
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the object masks
* @param objmask pointer to an object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_objmask_design(lv_obj_t * objmask, const lv_area_t * clip_area, lv_design_mode_t mode)
{
/*Return false if the object is not covers the mask_p area*/
if(mode == LV_DESIGN_COVER_CHK) {
lv_objmask_ext_t * ext = lv_obj_get_ext_attr(objmask);
if(_lv_ll_get_len(&ext->mask_ll) > 0) return LV_DESIGN_RES_MASKED;
else return ancestor_design(objmask, clip_area, mode);
}
/*Draw the object*/
else if(mode == LV_DESIGN_DRAW_MAIN) {
ancestor_design(objmask, clip_area, mode);
lv_objmask_ext_t * ext = lv_obj_get_ext_attr(objmask);
lv_coord_t xofs = objmask->coords.x1;
lv_coord_t yofs = objmask->coords.y1;
lv_objmask_mask_t * m;
_LV_LL_READ(ext->mask_ll, m) {
lv_draw_mask_common_dsc_t * dsc = m->param;
if(dsc->type == LV_DRAW_MASK_TYPE_LINE) {
lv_draw_mask_line_param_t * p_ori = m->param;
lv_draw_mask_line_param_t * p_new = _lv_mem_buf_get(sizeof(lv_draw_mask_line_param_t));
lv_draw_mask_line_points_init(p_new, p_ori->cfg.p1.x + xofs, p_ori->cfg.p1.y + yofs,
p_ori->cfg.p2.x + xofs, p_ori->cfg.p2.y + yofs,
p_ori->cfg.side);
lv_draw_mask_add(p_new, m->param);
}
else if(dsc->type == LV_DRAW_MASK_TYPE_ANGLE) {
lv_draw_mask_angle_param_t * p_ori = m->param;
lv_draw_mask_angle_param_t * p_new = _lv_mem_buf_get(sizeof(lv_draw_mask_angle_param_t));
lv_draw_mask_angle_init(p_new, p_ori->cfg.vertex_p.x + xofs, p_ori->cfg.vertex_p.y + yofs,
p_ori->cfg.start_angle, p_ori->cfg.end_angle);
lv_draw_mask_add(p_new, m->param);
}
else if(dsc->type == LV_DRAW_MASK_TYPE_RADIUS) {
lv_draw_mask_radius_param_t * p_ori = m->param;
lv_draw_mask_radius_param_t * p_new = _lv_mem_buf_get(sizeof(lv_draw_mask_radius_param_t));
lv_area_t rect;
rect.x1 = p_ori->cfg.rect.x1 + xofs;
rect.y1 = p_ori->cfg.rect.y1 + yofs;
rect.x2 = p_ori->cfg.rect.x2 + xofs;
rect.y2 = p_ori->cfg.rect.y2 + yofs;
lv_draw_mask_radius_init(p_new, &rect, p_ori->cfg.radius, p_ori->cfg.outer);
lv_draw_mask_add(p_new, m->param);
}
else if(dsc->type == LV_DRAW_MASK_TYPE_FADE) {
lv_draw_mask_fade_param_t * p_ori = m->param;
lv_draw_mask_fade_param_t * p_new = _lv_mem_buf_get(sizeof(lv_draw_mask_fade_param_t));
lv_area_t rect;
rect.x1 = p_ori->cfg.coords.x1 + xofs;
rect.y1 = p_ori->cfg.coords.y1 + yofs;
rect.x2 = p_ori->cfg.coords.x2 + xofs;
rect.y2 = p_ori->cfg.coords.y2 + yofs;
lv_draw_mask_fade_init(p_new, &rect, p_ori->cfg.opa_top, p_ori->cfg.y_top + yofs,
p_ori->cfg.opa_bottom, p_ori->cfg.y_bottom + yofs);
lv_draw_mask_add(p_new, m->param);
}
else if(dsc->type == LV_DRAW_MASK_TYPE_MAP) {
lv_draw_mask_map_param_t * p_ori = m->param;
lv_draw_mask_map_param_t * p_new = _lv_mem_buf_get(sizeof(lv_draw_mask_map_param_t));
lv_area_t rect;
rect.x1 = p_ori->cfg.coords.x1 + xofs;
rect.y1 = p_ori->cfg.coords.y1 + yofs;
rect.x2 = p_ori->cfg.coords.x2 + xofs;
rect.y2 = p_ori->cfg.coords.y2 + yofs;
lv_draw_mask_map_init(p_new, &rect, p_ori->cfg.map);
lv_draw_mask_add(p_new, m->param);
}
}
}
/*Post draw when the children are drawn*/
else if(mode == LV_DESIGN_DRAW_POST) {
lv_objmask_ext_t * ext = lv_obj_get_ext_attr(objmask);
lv_objmask_mask_t * m;
_LV_LL_READ(ext->mask_ll, m) {
void * param;
param = lv_draw_mask_remove_custom(m->param);
_lv_mem_buf_release(param);
}
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the object mask
* @param objmask pointer to a object mask object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_objmask_signal(lv_obj_t * objmask, lv_signal_t sign, void * param)
{
lv_res_t res;
/* Include the ancient signal function */
res = ancestor_signal(objmask, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
if(sign == LV_SIGNAL_CLEANUP) {
lv_objmask_ext_t * ext = lv_obj_get_ext_attr(objmask);
lv_objmask_mask_t * i;
_LV_LL_READ(ext->mask_ll, i) {
if(i->param) {
lv_mem_free(i->param);
i->param = NULL;
}
}
_lv_ll_clear(&ext->mask_ll);
}
return res;
}
static uint16_t get_param_size(lv_draw_mask_type_t type)
{
uint16_t param_size;
switch(type) {
case LV_DRAW_MASK_TYPE_LINE:
param_size = sizeof(lv_draw_mask_line_param_t);
break;
case LV_DRAW_MASK_TYPE_ANGLE:
param_size = sizeof(lv_draw_mask_angle_param_t);
break;
case LV_DRAW_MASK_TYPE_RADIUS:
param_size = sizeof(lv_draw_mask_radius_param_t);
break;
case LV_DRAW_MASK_TYPE_FADE:
param_size = sizeof(lv_draw_mask_fade_param_t);
break;
case LV_DRAW_MASK_TYPE_MAP:
param_size = sizeof(lv_draw_mask_map_param_t);
break;
default:
param_size = 0;
}
return param_size;
}
#else /* Enable this file at the top */
#endif
|
train_000.parquet/969
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_objmask.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 11827,
"token_count": 4454
}
|
/**
* @file lv_spinner.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_spinner.h"
#if LV_USE_SPINNER != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_misc/lv_math.h"
#include "../lv_draw/lv_draw_rect.h"
#include "../lv_draw/lv_draw_arc.h"
#include "../lv_themes/lv_theme.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_spinner"
#ifndef LV_SPINNER_DEF_ARC_LENGTH
#define LV_SPINNER_DEF_ARC_LENGTH 60 /*[deg]*/
#endif
#ifndef LV_SPINNER_DEF_SPIN_TIME
#define LV_SPINNER_DEF_SPIN_TIME 1000 /*[ms]*/
#endif
#ifndef LV_SPINNER_DEF_ANIM
#define LV_SPINNER_DEF_ANIM LV_SPINNER_TYPE_SPINNING_ARC /*animation type*/
#endif
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_res_t lv_spinner_signal(lv_obj_t * spinner, lv_signal_t sign, void * param);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
static lv_design_cb_t ancestor_design;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a spinner object
* @param par pointer to an object, it will be the parent of the new spinner
* @param copy pointer to a spinner object, if not NULL then the new object will be copied from
* it
* @return pointer to the created spinner
*/
lv_obj_t * lv_spinner_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("spinner create started");
/*Create the ancestor of spinner*/
lv_obj_t * spinner = lv_arc_create(par, copy);
LV_ASSERT_MEM(spinner);
if(spinner == NULL) return NULL;
/*Allocate the spinner type specific extended data*/
lv_spinner_ext_t * ext = lv_obj_allocate_ext_attr(spinner, sizeof(lv_spinner_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(spinner);
return NULL;
}
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(spinner);
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(spinner);
/*Initialize the allocated 'ext' */
ext->arc_length = LV_SPINNER_DEF_ARC_LENGTH;
ext->anim_type = LV_SPINNER_DEF_ANIM;
ext->anim_dir = LV_SPINNER_DIR_FORWARD;
ext->time = LV_SPINNER_DEF_SPIN_TIME;
/*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(spinner, lv_spinner_signal);
/*Init the new spinner spinner*/
if(copy == NULL) {
ext->arc.bg_angle_start = 0;
ext->arc.bg_angle_end = 360;
lv_obj_set_size(spinner, LV_DPI, LV_DPI);
lv_theme_apply(spinner, LV_THEME_SPINNER);
}
/*Copy an existing spinner*/
else {
lv_spinner_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->arc_length = copy_ext->arc_length;
ext->time = copy_ext->time;
ext->anim_dir = copy_ext->anim_dir;
/*Refresh the style with new signal function*/
lv_obj_refresh_style(spinner, LV_STYLE_PROP_ALL);
}
lv_spinner_set_type(spinner, ext->anim_type);
LV_LOG_INFO("spinner created");
return spinner;
}
/*======================
* Add/remove functions
*=====================*/
/**
* Set the length of the spinning arc in degrees
* @param spinner pointer to a spinner object
* @param deg length of the arc
*/
void lv_spinner_set_arc_length(lv_obj_t * spinner, lv_anim_value_t deg)
{
LV_ASSERT_OBJ(spinner, LV_OBJX_NAME);
lv_spinner_ext_t * ext = lv_obj_get_ext_attr(spinner);
ext->arc_length = deg;
}
/**
* Set the spin time of the arc
* @param spinner pointer to a spinner object
* @param time time of one round in milliseconds
*/
void lv_spinner_set_spin_time(lv_obj_t * spinner, uint16_t time)
{
LV_ASSERT_OBJ(spinner, LV_OBJX_NAME);
lv_spinner_ext_t * ext = lv_obj_get_ext_attr(spinner);
ext->time = time;
lv_spinner_set_type(spinner, ext->anim_type);
}
/*=====================
* Setter functions
*====================*/
/**
* Set the animation type of a spinner.
* @param spinner pointer to spinner object
* @param type animation type of the spinner
* */
void lv_spinner_set_type(lv_obj_t * spinner, lv_spinner_type_t type)
{
LV_ASSERT_OBJ(spinner, LV_OBJX_NAME);
lv_spinner_ext_t * ext = lv_obj_get_ext_attr(spinner);
/*delete previous animation*/
lv_anim_del(spinner, NULL);
switch(type) {
case LV_SPINNER_TYPE_FILLSPIN_ARC: {
ext->anim_type = LV_SPINNER_TYPE_FILLSPIN_ARC;
lv_anim_path_t path;
lv_anim_path_init(&path);
lv_anim_path_set_cb(&path, lv_anim_path_ease_in_out);
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, spinner);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_spinner_anim_cb);
lv_anim_set_path(&a, &path);
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
lv_anim_set_time(&a, ext->time);
if(ext->anim_dir == LV_SPINNER_DIR_FORWARD) lv_anim_set_values(&a, 0, 360);
else lv_anim_set_values(&a, 360, 0);
lv_anim_start(&a);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_spinner_set_arc_length);
if(ext->anim_dir == LV_SPINNER_DIR_FORWARD) lv_anim_set_values(&a, ext->arc_length, 360 - ext->arc_length);
else lv_anim_set_values(&a, 360 - ext->arc_length, ext->arc_length);
lv_anim_set_playback_time(&a, ext->time);
lv_anim_start(&a);
break;
}
case LV_SPINNER_TYPE_CONSTANT_ARC:
case LV_SPINNER_TYPE_SPINNING_ARC:
default: {
ext->anim_type = type;
lv_anim_path_t path;
lv_anim_path_init(&path);
lv_anim_path_set_cb(&path, (LV_SPINNER_TYPE_CONSTANT_ARC == type ? lv_anim_path_linear : lv_anim_path_ease_in_out));
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, spinner);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_spinner_anim_cb);
lv_anim_set_time(&a, ext->time);
lv_anim_set_path(&a, &path);
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
if(ext->anim_dir == LV_SPINNER_DIR_FORWARD) lv_anim_set_values(&a, 0, 360);
else lv_anim_set_values(&a, 360, 0);
lv_anim_start(&a);
break;
}
}
}
void lv_spinner_set_dir(lv_obj_t * spinner, lv_spinner_dir_t dir)
{
LV_ASSERT_OBJ(spinner, LV_OBJX_NAME);
lv_spinner_ext_t * ext = lv_obj_get_ext_attr(spinner);
ext->anim_dir = dir;
lv_spinner_set_type(spinner, ext->anim_type);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the arc length [degree] of the a spinner
* @param spinner pointer to a spinner object
*/
lv_anim_value_t lv_spinner_get_arc_length(const lv_obj_t * spinner)
{
LV_ASSERT_OBJ(spinner, LV_OBJX_NAME);
lv_spinner_ext_t * ext = lv_obj_get_ext_attr(spinner);
return ext->arc_length;
}
/**
* Get the spin time of the arc
* @param spinner pointer to a spinner object [milliseconds]
*/
uint16_t lv_spinner_get_spin_time(const lv_obj_t * spinner)
{
LV_ASSERT_OBJ(spinner, LV_OBJX_NAME);
lv_spinner_ext_t * ext = lv_obj_get_ext_attr(spinner);
return ext->time;
}
/**
* Get the animation type of a spinner.
* @param spinner pointer to spinner object
* @return animation type
* */
lv_spinner_type_t lv_spinner_get_type(lv_obj_t * spinner)
{
LV_ASSERT_OBJ(spinner, LV_OBJX_NAME);
lv_spinner_ext_t * ext = lv_obj_get_ext_attr(spinner);
return ext->anim_type;
}
lv_spinner_dir_t lv_spinner_get_dir(lv_obj_t * spinner)
{
lv_spinner_ext_t * ext = lv_obj_get_ext_attr(spinner);
return ext->anim_dir;
}
/*=====================
* Other functions
*====================*/
/**
* Animator function (exec_cb) to rotate the arc of spinner.
* @param ptr pointer to spinner
* @param val the current desired value [0..360]
*/
void lv_spinner_anim_cb(void * ptr, lv_anim_value_t val)
{
lv_obj_t * spinner = ptr;
lv_spinner_ext_t * ext = lv_obj_get_ext_attr(spinner);
int16_t angle_start = val - ext->arc_length / 2 - 90;
if(angle_start < 0) angle_start += 360;
int16_t angle_end = angle_start + ext->arc_length;
angle_start = angle_start % 360;
angle_end = angle_end % 360;
lv_arc_set_angles(spinner, angle_start, angle_end);
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Signal function of the spinner
* @param spinner pointer to a spinner object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_spinner_signal(lv_obj_t * spinner, lv_signal_t sign, void * param)
{
lv_res_t res;
/* Include the ancient signal function */
res = ancestor_signal(spinner, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
if(sign == LV_SIGNAL_CLEANUP) {
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
}
return res;
}
#endif
|
train_000.parquet/970
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_spinner.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 9583,
"token_count": 3761
}
|
/**
* @file lv_linemeter.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_linemeter.h"
#if LV_USE_LINEMETER != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_core/lv_group.h"
#include "../lv_misc/lv_math.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_linemeter"
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_design_res_t lv_linemeter_design(lv_obj_t * lmeter, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_linemeter_signal(lv_obj_t * lmeter, lv_signal_t sign, void * param);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a line meter objects
* @param par pointer to an object, it will be the parent of the new line meter
* @param copy pointer to a line meter object, if not NULL then the new object will be copied from
* it
* @return pointer to the created line meter
*/
lv_obj_t * lv_linemeter_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("line meter create started");
/*Create the ancestor of line meter*/
lv_obj_t * linemeter = lv_obj_create(par, copy);
LV_ASSERT_MEM(linemeter);
if(linemeter == NULL) return NULL;
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(linemeter);
/*Allocate the line meter type specific extended data*/
lv_linemeter_ext_t * ext = lv_obj_allocate_ext_attr(linemeter, sizeof(lv_linemeter_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(linemeter);
return NULL;
}
/*Initialize the allocated 'ext' */
ext->min_value = 0;
ext->max_value = 100;
ext->cur_value = 0;
ext->line_cnt = 18;
ext->scale_angle = 240;
ext->angle_ofs = 0;
/*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(linemeter, lv_linemeter_signal);
lv_obj_set_design_cb(linemeter, lv_linemeter_design);
/*Init the new line meter line meter*/
if(copy == NULL) {
lv_obj_set_size(linemeter, 3 * LV_DPI / 2, 3 * LV_DPI / 2);
lv_theme_apply(linemeter, LV_THEME_LINEMETER);
}
/*Copy an existing line meter*/
else {
lv_linemeter_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->scale_angle = copy_ext->scale_angle;
ext->line_cnt = copy_ext->line_cnt;
ext->min_value = copy_ext->min_value;
ext->max_value = copy_ext->max_value;
ext->cur_value = copy_ext->cur_value;
/*Refresh the style with new signal function*/
lv_obj_refresh_style(linemeter, LV_STYLE_PROP_ALL);
}
LV_LOG_INFO("line meter created");
return linemeter;
}
/*=====================
* Setter functions
*====================*/
/**
* Set a new value on the line meter
* @param lmeter pointer to a line meter object
* @param value new value
*/
void lv_linemeter_set_value(lv_obj_t * lmeter, int32_t value)
{
LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME);
lv_linemeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
if(ext->cur_value == value) return;
int32_t old_value = ext->cur_value;
ext->cur_value = value > ext->max_value ? ext->max_value : value;
ext->cur_value = ext->cur_value < ext->min_value ? ext->min_value : ext->cur_value;
int16_t level_old =
(int32_t)((int32_t)(old_value - ext->min_value) * (ext->line_cnt - 1)) / (ext->max_value - ext->min_value);
int16_t level_new =
(int32_t)((int32_t)(ext->cur_value - ext->min_value) * (ext->line_cnt - 1)) / (ext->max_value - ext->min_value);
if(level_new == level_old) {
return;
}
lv_style_int_t left = lv_obj_get_style_pad_left(lmeter, LV_LINEMETER_PART_MAIN);
lv_style_int_t right = lv_obj_get_style_pad_right(lmeter, LV_LINEMETER_PART_MAIN);
lv_style_int_t top = lv_obj_get_style_pad_top(lmeter, LV_LINEMETER_PART_MAIN);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(lmeter, LV_LINEMETER_PART_MAIN);
lv_coord_t r_out = (lv_obj_get_width(lmeter) - left - right) / 2 ;
lv_coord_t r_in = r_out - lv_obj_get_style_scale_width(lmeter, LV_LINEMETER_PART_MAIN);
if(r_in < 1) r_in = 1;
lv_coord_t x_ofs = lmeter->coords.x1 + r_out + left;
lv_coord_t y_ofs = lmeter->coords.y1 + r_out + top;
int16_t angle_ofs = ext->angle_ofs + 90 + (360 - ext->scale_angle) / 2;
lv_style_int_t line_width = lv_obj_get_style_scale_end_line_width(lmeter, LV_LINEMETER_PART_MAIN);
lv_style_int_t end_line_width = lv_obj_get_style_scale_end_line_width(lmeter, LV_LINEMETER_PART_MAIN);
line_width = LV_MATH_MAX(line_width, end_line_width);
int32_t angle_old = (level_old * ext->scale_angle) / (ext->line_cnt - 1);
/*Use smaller clip area only around the visible line*/
int32_t y_in_old = (int32_t)((int32_t)_lv_trigo_sin(angle_old + angle_ofs) * r_in) >> LV_TRIGO_SHIFT;
int32_t x_in_old = (int32_t)((int32_t)_lv_trigo_sin(angle_old + 90 + angle_ofs) * r_in) >> LV_TRIGO_SHIFT;
int32_t y_out_old = (int32_t)((int32_t)_lv_trigo_sin(angle_old + angle_ofs) * r_out) >> LV_TRIGO_SHIFT;
int32_t x_out_old = (int32_t)((int32_t)_lv_trigo_sin(angle_old + 90 + angle_ofs) * r_out) >> LV_TRIGO_SHIFT;
int32_t angle_new = (level_new * ext->scale_angle) / (ext->line_cnt - 1);
/*Use smaller clip area only around the visible line*/
int32_t y_in_new = (int32_t)((int32_t)_lv_trigo_sin(angle_new + angle_ofs) * r_in) >> LV_TRIGO_SHIFT;
int32_t x_in_new = (int32_t)((int32_t)_lv_trigo_sin(angle_new + 90 + angle_ofs) * r_in) >> LV_TRIGO_SHIFT;
int32_t y_out_new = (int32_t)((int32_t)_lv_trigo_sin(angle_new + angle_ofs) * r_out) >> LV_TRIGO_SHIFT;
int32_t x_out_new = (int32_t)((int32_t)_lv_trigo_sin(angle_new + 90 + angle_ofs) * r_out) >> LV_TRIGO_SHIFT;
lv_area_t a;
if(x_out_old < 0 && x_out_new < 0) {
a.x1 = lmeter->coords.x1 + left - line_width;
a.y1 = LV_MATH_MIN4(y_out_old, y_out_new, y_in_old, y_in_new) + y_ofs - line_width;
a.x2 = LV_MATH_MAX(x_in_old, x_in_new) + x_ofs + line_width;
a.y2 = LV_MATH_MAX4(y_out_old, y_out_new, y_in_old, y_in_new) + y_ofs + line_width;
}
else if(x_out_old > 0 && x_out_new > 0) {
a.x1 = LV_MATH_MIN(x_in_old, x_in_new) + x_ofs - line_width;
a.y1 = LV_MATH_MIN4(y_out_old, y_out_new, y_in_old, y_in_new) + y_ofs - line_width;
a.x2 = lmeter->coords.x2 - right + line_width;
a.y2 = LV_MATH_MAX4(y_out_old, y_out_new, y_in_old, y_in_new) + y_ofs + line_width;
}
else if(y_out_old < 0 && y_out_new < 0) {
a.x1 = LV_MATH_MIN4(x_out_old, x_out_new, x_in_old, x_in_new) + x_ofs - line_width;
a.y1 = lmeter->coords.y1 + top - line_width;
a.x2 = LV_MATH_MAX4(x_out_old, x_out_new, x_in_old, x_in_new) + x_ofs + line_width;
a.y2 = LV_MATH_MAX(y_in_old, y_in_new) + y_ofs + line_width;
}
else if(y_out_old > 0 && y_out_new > 0) {
a.x1 = LV_MATH_MIN4(x_out_old, x_out_new, x_in_old, x_in_new) + x_ofs - line_width;
a.y1 = LV_MATH_MIN(y_in_old, y_in_new) + y_ofs - line_width;
a.x2 = LV_MATH_MAX4(x_out_old, x_out_new, x_in_old, x_in_new) + x_ofs + line_width;
a.y2 = lmeter->coords.y2 - bottom + line_width;
}
else {
a.x1 = lmeter->coords.x1 + left - line_width;
a.y1 = lmeter->coords.y1 + top - line_width;
a.x2 = lmeter->coords.x2 - right + line_width;
a.y2 = lmeter->coords.y2 - bottom + line_width;
}
lv_obj_invalidate_area(lmeter, &a);
}
/**
* Set minimum and the maximum values of a line meter
* @param lmeter pointer to he line meter object
* @param min minimum value
* @param max maximum value
*/
void lv_linemeter_set_range(lv_obj_t * lmeter, int32_t min, int32_t max)
{
LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME);
lv_linemeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
if(ext->min_value == min && ext->max_value == max) return;
ext->max_value = max;
ext->min_value = min;
if(ext->cur_value > max) {
ext->cur_value = max;
lv_linemeter_set_value(lmeter, ext->cur_value);
}
if(ext->cur_value < min) {
ext->cur_value = min;
lv_linemeter_set_value(lmeter, ext->cur_value);
}
lv_obj_invalidate(lmeter);
}
/**
* Set the scale settings of a line meter
* @param lmeter pointer to a line meter object
* @param angle angle of the scale (0..360)
* @param line_cnt number of lines
*/
void lv_linemeter_set_scale(lv_obj_t * lmeter, uint16_t angle, uint16_t line_cnt)
{
LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME);
lv_linemeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
if(ext->scale_angle == angle && ext->line_cnt == line_cnt) return;
ext->scale_angle = angle;
ext->line_cnt = line_cnt;
lv_obj_invalidate(lmeter);
}
/**
* Set the set an offset for the line meter's angles to rotate it.
* @param lmeter pointer to a line meter object
* @param angle angle where the meter will be facing (with its center)
*/
void lv_linemeter_set_angle_offset(lv_obj_t * lmeter, uint16_t angle)
{
lv_linemeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
if(ext->angle_ofs == angle) return;
ext->angle_ofs = angle;
lv_obj_invalidate(lmeter);
}
/**
* Set the orientation of the meter growth, clockwise or counterclockwise (mirrored)
* @param lmeter pointer to a line meter object
* @param mirror mirror setting
*/
void lv_linemeter_set_mirror(lv_obj_t * lmeter, bool mirror)
{
lv_linemeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
if(ext->mirrored == mirror) return;
ext->mirrored = mirror;
lv_obj_invalidate(lmeter);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the value of a line meter
* @param lmeter pointer to a line meter object
* @return the value of the line meter
*/
int32_t lv_linemeter_get_value(const lv_obj_t * lmeter)
{
LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME);
lv_linemeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
return ext->cur_value;
}
/**
* Get the minimum value of a line meter
* @param lmeter pointer to a line meter object
* @return the minimum value of the line meter
*/
int32_t lv_linemeter_get_min_value(const lv_obj_t * lmeter)
{
LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME);
lv_linemeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
return ext->min_value;
}
/**
* Get the maximum value of a line meter
* @param lmeter pointer to a line meter object
* @return the maximum value of the line meter
*/
int32_t lv_linemeter_get_max_value(const lv_obj_t * lmeter)
{
LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME);
lv_linemeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
return ext->max_value;
}
/**
* Get the scale number of a line meter
* @param lmeter pointer to a line meter object
* @return number of the scale units
*/
uint16_t lv_linemeter_get_line_count(const lv_obj_t * lmeter)
{
LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME);
lv_linemeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
return ext->line_cnt;
}
/**
* Get the scale angle of a line meter
* @param lmeter pointer to a line meter object
* @return angle_ofs of the scale
*/
uint16_t lv_linemeter_get_scale_angle(const lv_obj_t * lmeter)
{
LV_ASSERT_OBJ(lmeter, LV_OBJX_NAME);
lv_linemeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
return ext->scale_angle;
}
/**
* Get the offset for the line meter.
* @param lmeter pointer to a line meter object
* @return angle offset (0..360)
*/
uint16_t lv_linemeter_get_angle_offset(lv_obj_t * lmeter)
{
lv_linemeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
return ext->angle_ofs;
}
/**
* get the mirror setting for the line meter
* @param lmeter pointer to a line meter object
* @return mirror (true or false)
*/
bool lv_linemeter_get_mirror(lv_obj_t * lmeter)
{
lv_linemeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
return ext->mirrored;
}
void lv_linemeter_draw_scale(lv_obj_t * lmeter, const lv_area_t * clip_area, uint8_t part)
{
lv_linemeter_ext_t * ext = lv_obj_get_ext_attr(lmeter);
lv_style_int_t left = lv_obj_get_style_pad_left(lmeter, LV_LINEMETER_PART_MAIN);
lv_style_int_t right = lv_obj_get_style_pad_right(lmeter, LV_LINEMETER_PART_MAIN);
lv_style_int_t top = lv_obj_get_style_pad_top(lmeter, LV_LINEMETER_PART_MAIN);
lv_coord_t r_out = (lv_obj_get_width(lmeter) - left - right) / 2 ;
lv_coord_t r_in = r_out - lv_obj_get_style_scale_width(lmeter, part);
if(r_in < 1) r_in = 1;
lv_coord_t x_ofs = lmeter->coords.x1 + r_out + left;
lv_coord_t y_ofs = lmeter->coords.y1 + r_out + top;
int16_t angle_ofs = ext->angle_ofs + 90 + (360 - ext->scale_angle) / 2;
int16_t level = ext->mirrored ?
(int32_t)((int32_t)(ext->max_value - ext->cur_value) * (ext->line_cnt - 1)) / (ext->max_value - ext->min_value) :
(int32_t)((int32_t)(ext->cur_value - ext->min_value) * (ext->line_cnt - 1)) / (ext->max_value - ext->min_value);
uint8_t i;
lv_color_t main_color = lv_obj_get_style_line_color(lmeter, part);
lv_color_t grad_color = lv_obj_get_style_scale_grad_color(lmeter, part);
lv_color_t end_color = lv_obj_get_style_scale_end_color(lmeter, part);
lv_draw_line_dsc_t line_dsc;
lv_draw_line_dsc_init(&line_dsc);
lv_obj_init_draw_line_dsc(lmeter, part, &line_dsc);
#if LV_LINEMETER_PRECISE == 2
line_dsc.raw_end = 1;
#endif
lv_style_int_t end_line_width = lv_obj_get_style_scale_end_line_width(lmeter, part);
#if LV_LINEMETER_PRECISE > 0
lv_area_t mask_area;
mask_area.x1 = x_ofs - r_in;
mask_area.x2 = x_ofs + r_in - 1;
mask_area.y1 = y_ofs - r_in;
mask_area.y2 = y_ofs + r_in - 1;
lv_draw_mask_radius_param_t mask_in_param;
lv_draw_mask_radius_init(&mask_in_param, &mask_area, LV_RADIUS_CIRCLE, true);
int16_t mask_in_id = lv_draw_mask_add(&mask_in_param, 0);
#endif
#if LV_LINEMETER_PRECISE > 1
mask_area.x1 = x_ofs - r_out;
mask_area.x2 = x_ofs + r_out - 1;
mask_area.y1 = y_ofs - r_out;
mask_area.y2 = y_ofs + r_out - 1;
lv_draw_mask_radius_param_t mask_out_param;
lv_draw_mask_radius_init(&mask_out_param, &mask_area, LV_RADIUS_CIRCLE, false);
int16_t mask_out_id = lv_draw_mask_add(&mask_out_param, 0);
/*In calculation use a larger radius to avoid rounding errors */
lv_coord_t r_out_extra = r_out + LV_DPI;
#else
lv_coord_t r_out_extra = r_out;
#endif
for(i = 0; i < ext->line_cnt; i++) {
/* `* 256` for extra precision*/
int32_t angle_upscale = (i * ext->scale_angle * 256) / (ext->line_cnt - 1);
int32_t angle_normal = angle_upscale >> 8;
int32_t angle_low = (angle_upscale >> 8);
int32_t angle_high = angle_low + 1;
int32_t angle_rem = angle_upscale & 0xFF;
/*Interpolate sine and cos*/
int32_t sin_low = _lv_trigo_sin(angle_low + angle_ofs);
int32_t sin_high = _lv_trigo_sin(angle_high + angle_ofs);
int32_t sin_mid = (sin_low * (256 - angle_rem) + sin_high * angle_rem) >> 8;
int32_t cos_low = _lv_trigo_sin(angle_low + 90 + angle_ofs);
int32_t cos_high = _lv_trigo_sin(angle_high + 90 + angle_ofs);
int32_t cos_mid = (cos_low * (256 - angle_rem) + cos_high * angle_rem) >> 8;
/*Use the interpolated values to get x and y coordinates*/
int32_t y_out_extra = (int32_t)((int32_t)sin_mid * r_out_extra) >> (LV_TRIGO_SHIFT - 8);
int32_t x_out_extra = (int32_t)((int32_t)cos_mid * r_out_extra) >> (LV_TRIGO_SHIFT - 8);
/*Rounding*/
if(x_out_extra > 0) x_out_extra = (x_out_extra + 127) >> 8;
else x_out_extra = (x_out_extra - 127) >> 8;
if(y_out_extra > 0) y_out_extra = (y_out_extra + 127) >> 8;
else y_out_extra = (y_out_extra - 127) >> 8;
x_out_extra += x_ofs;
y_out_extra += y_ofs;
/*With no extra precision use the coordinates on the inner radius*/
#if LV_LINEMETER_PRECISE == 0
/*Use the interpolated values to get x and y coordinates*/
int32_t y_in_extra = (int32_t)((int32_t)sin_mid * r_in) >> (LV_TRIGO_SHIFT - 8);
int32_t x_in_extra = (int32_t)((int32_t)cos_mid * r_in) >> (LV_TRIGO_SHIFT - 8);
/*Rounding*/
if(x_in_extra > 0) x_in_extra = (x_in_extra + 127) >> 8;
else x_in_extra = (x_in_extra - 127) >> 8;
if(y_in_extra > 0) y_in_extra = (y_in_extra + 127) >> 8;
else y_in_extra = (y_in_extra - 127) >> 8;
x_in_extra += x_ofs;
y_in_extra += y_ofs;
#else
int32_t x_in_extra = x_ofs;
int32_t y_in_extra = y_ofs;
#endif
/*Use smaller clip area only around the visible line*/
int32_t y_in = (int32_t)((int32_t)_lv_trigo_sin(angle_normal + angle_ofs) * r_in) >> LV_TRIGO_SHIFT;
int32_t x_in = (int32_t)((int32_t)_lv_trigo_sin(angle_normal + 90 + angle_ofs) * r_in) >> LV_TRIGO_SHIFT;
x_in += x_ofs;
y_in += y_ofs;
int32_t y_out = (int32_t)((int32_t)_lv_trigo_sin(angle_normal + angle_ofs) * r_out) >> LV_TRIGO_SHIFT;
int32_t x_out = (int32_t)((int32_t)_lv_trigo_sin(angle_normal + 90 + angle_ofs) * r_out) >> LV_TRIGO_SHIFT;
x_out += x_ofs;
y_out += y_ofs;
lv_area_t clip_sub;
clip_sub.x1 = LV_MATH_MIN(x_in, x_out) - line_dsc.width;
clip_sub.x2 = LV_MATH_MAX(x_in, x_out) + line_dsc.width;
clip_sub.y1 = LV_MATH_MIN(y_in, y_out) - line_dsc.width;
clip_sub.y2 = LV_MATH_MAX(y_in, y_out) + line_dsc.width;
if(_lv_area_intersect(&clip_sub, &clip_sub, clip_area) == false) continue;
lv_point_t p1;
lv_point_t p2;
p2.x = x_in_extra;
p2.y = y_in_extra;
p1.x = x_out_extra;
p1.y = y_out_extra;
/* Set the color of the lines */
if((!ext->mirrored && i >= level) || (ext->mirrored && i <= level)) {
line_dsc.color = end_color;
line_dsc.width = end_line_width;
}
else {
line_dsc.color = lv_color_mix(grad_color, main_color, (255 * i) / ext->line_cnt);
}
lv_draw_line(&p1, &p2, &clip_sub, &line_dsc);
}
#if LV_LINEMETER_PRECISE > 0
lv_draw_mask_remove_id(mask_in_id);
#endif
#if LV_LINEMETER_PRECISE > 1
lv_draw_mask_remove_id(mask_out_id);
#endif
if(part == LV_LINEMETER_PART_MAIN && level + 1 < ext->line_cnt - 1) {
lv_style_int_t border_width = lv_obj_get_style_scale_border_width(lmeter, part);
lv_style_int_t end_border_width = lv_obj_get_style_scale_end_border_width(lmeter, part);
if(border_width || end_border_width) {
int16_t end_angle = ((level + 1) * ext->scale_angle) / (ext->line_cnt - 1) + angle_ofs;
lv_draw_line_dsc_t arc_dsc;
lv_draw_line_dsc_init(&arc_dsc);
lv_obj_init_draw_line_dsc(lmeter, part, &arc_dsc);
if(border_width) {
arc_dsc.width = border_width;
arc_dsc.color = main_color;
lv_draw_arc(x_ofs, y_ofs, r_out, angle_ofs, end_angle, clip_area, &arc_dsc);
}
if(end_border_width) {
arc_dsc.width = end_border_width;
arc_dsc.color = end_color;
lv_draw_arc(x_ofs, y_ofs, r_out, end_angle, (angle_ofs + ext->scale_angle) % 360, clip_area, &arc_dsc);
}
}
}
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the line meters
* @param lmeter pointer to an object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_linemeter_design(lv_obj_t * lmeter, const lv_area_t * clip_area, lv_design_mode_t mode)
{
/*Return false if the object is not covers the mask_p area*/
if(mode == LV_DESIGN_COVER_CHK) {
return LV_DESIGN_RES_NOT_COVER;
}
/*Draw the object*/
else if(mode == LV_DESIGN_DRAW_MAIN) {
lv_draw_rect_dsc_t bg_dsc;
lv_draw_rect_dsc_init(&bg_dsc);
lv_obj_init_draw_rect_dsc(lmeter, LV_LINEMETER_PART_MAIN, &bg_dsc);
lv_draw_rect(&lmeter->coords, clip_area, &bg_dsc);
lv_linemeter_draw_scale(lmeter, clip_area, LV_LINEMETER_PART_MAIN);
}
/*Post draw when the children are drawn*/
else if(mode == LV_DESIGN_DRAW_POST) {
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the line meter
* @param lmeter pointer to a line meter object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_linemeter_signal(lv_obj_t * lmeter, lv_signal_t sign, void * param)
{
lv_res_t res;
/* Include the ancient signal function */
res = ancestor_signal(lmeter, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
if(sign == LV_SIGNAL_CLEANUP) {
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
}
else if(sign == LV_SIGNAL_STYLE_CHG) {
lv_obj_refresh_ext_draw_pad(lmeter);
lv_obj_invalidate(lmeter);
}
return res;
}
#endif
|
train_000.parquet/971
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_linemeter.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 22007,
"token_count": 9289
}
|
/**
* @file lv_mbox.h
*
*/
#ifndef LV_MSGBOX_H
#define LV_MSGBOX_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_MSGBOX != 0
/*Testing of dependencies*/
#if LV_USE_CONT == 0
#error "lv_mbox: lv_cont is required. Enable it in lv_conf.h (LV_USE_CONT 1) "
#endif
#if LV_USE_BTNMATRIX == 0
#error "lv_mbox: lv_btnm is required. Enable it in lv_conf.h (LV_USE_BTNMATRIX 1) "
#endif
#if LV_USE_LABEL == 0
#error "lv_mbox: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "lv_cont.h"
#include "lv_btnmatrix.h"
#include "lv_label.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of message box*/
typedef struct {
lv_cont_ext_t bg; /*Ext. of ancestor*/
/*New data for this type */
lv_obj_t * text; /*Text of the message box*/
lv_obj_t * btnm; /*Button matrix for the buttons*/
#if LV_USE_ANIMATION
uint16_t anim_time; /*Duration of close animation [ms] (0: no animation)*/
#endif
} lv_msgbox_ext_t;
/** Message box styles. */
enum {
LV_MSGBOX_PART_BG = LV_CONT_PART_MAIN,
LV_MSGBOX_PART_BTN_BG = _LV_CONT_PART_REAL_LAST,
LV_MSGBOX_PART_BTN,
};
typedef uint8_t lv_msgbox_style_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a message box objects
* @param par pointer to an object, it will be the parent of the new message box
* @param copy pointer to a message box object, if not NULL then the new object will be copied from
* it
* @return pointer to the created message box
*/
lv_obj_t * lv_msgbox_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
*=====================*/
/**
* Add button to the message box
* @param mbox pointer to message box object
* @param btn_map button descriptor (button matrix map).
* E.g. a const char *txt[] = {"ok", "close", ""} (Can not be local variable)
*/
void lv_msgbox_add_btns(lv_obj_t * mbox, const char * btn_mapaction[]);
/*=====================
* Setter functions
*====================*/
/**
* Set the text of the message box
* @param mbox pointer to a message box
* @param txt a '\0' terminated character string which will be the message box text
*/
void lv_msgbox_set_text(lv_obj_t * mbox, const char * txt);
/**
* Set animation duration
* @param mbox pointer to a message box object
* @param anim_time animation length in milliseconds (0: no animation)
*/
void lv_msgbox_set_anim_time(lv_obj_t * mbox, uint16_t anim_time);
/**
* Automatically delete the message box after a given time
* @param mbox pointer to a message box object
* @param delay a time (in milliseconds) to wait before delete the message box
*/
void lv_msgbox_start_auto_close(lv_obj_t * mbox, uint16_t delay);
/**
* Stop the auto. closing of message box
* @param mbox pointer to a message box object
*/
void lv_msgbox_stop_auto_close(lv_obj_t * mbox);
/**
* Set whether recoloring is enabled. Must be called after `lv_msgbox_add_btns`.
* @param mbox pointer to message box object
* @param en whether recoloring is enabled
*/
void lv_msgbox_set_recolor(lv_obj_t * mbox, bool en);
/*=====================
* Getter functions
*====================*/
/**
* Get the text of the message box
* @param mbox pointer to a message box object
* @return pointer to the text of the message box
*/
const char * lv_msgbox_get_text(const lv_obj_t * mbox);
/**
* Get the index of the lastly "activated" button by the user (pressed, released etc)
* Useful in the the `event_cb`.
* @param mbox pointer to message box object
* @return index of the last released button (LV_BTNMATRIX_BTN_NONE: if unset)
*/
uint16_t lv_msgbox_get_active_btn(lv_obj_t * mbox);
/**
* Get the text of the lastly "activated" button by the user (pressed, released etc)
* Useful in the the `event_cb`.
* @param mbox pointer to message box object
* @return text of the last released button (NULL: if unset)
*/
const char * lv_msgbox_get_active_btn_text(lv_obj_t * mbox);
/**
* Get the animation duration (close animation time)
* @param mbox pointer to a message box object
* @return animation length in milliseconds (0: no animation)
*/
uint16_t lv_msgbox_get_anim_time(const lv_obj_t * mbox);
/**
* Get whether recoloring is enabled
* @param mbox pointer to a message box object
* @return whether recoloring is enabled
*/
bool lv_msgbox_get_recolor(const lv_obj_t * mbox);
/**
* Get message box button matrix
* @param mbox pointer to a message box object
* @return pointer to button matrix object
* @remarks return value will be NULL unless `lv_msgbox_add_btns` has been already called
*/
lv_obj_t * lv_msgbox_get_btnmatrix(lv_obj_t * mbox);
/**********************
* MACROS
**********************/
#endif /*LV_USE_MSGBOX*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_MSGBOX_H*/
|
train_000.parquet/972
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_msgbox.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 5046,
"token_count": 1819
}
|
/**
* @file lv_roller.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_roller.h"
#if LV_USE_ROLLER != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_core/lv_group.h"
#include "../lv_themes/lv_theme.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_roller"
#if LV_USE_ANIMATION == 0
#undef LV_ROLLER_DEF_ANIM_TIME
#define LV_ROLLER_DEF_ANIM_TIME 0 /*No animation*/
#endif
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_design_res_t lv_roller_design(lv_obj_t * roller, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_design_res_t lv_roller_label_design(lv_obj_t * label, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void * param);
static lv_style_list_t * lv_roller_get_style(lv_obj_t * roller, uint8_t part);
static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * param);
static void refr_position(lv_obj_t * roller, lv_anim_enable_t animen);
static void refr_height(lv_obj_t * roller);
static void refr_width(lv_obj_t * roller);
static lv_res_t release_handler(lv_obj_t * roller);
static void inf_normalize(void * roller_scrl);
static lv_obj_t * get_label(const lv_obj_t * roller);
#if LV_USE_ANIMATION
static void scroll_anim_ready_cb(lv_anim_t * a);
#endif
static void draw_bg(lv_obj_t * roller, const lv_area_t * clip_area);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
static lv_design_cb_t ancestor_label_design;
static lv_signal_cb_t ancestor_scrl_signal;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a roller object
* @param par pointer to an object, it will be the parent of the new roller
* @param copy pointer to a roller object, if not NULL then the new object will be copied from it
* @return pointer to the created roller
*/
lv_obj_t * lv_roller_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("roller create started");
/*Create the ancestor of roller*/
lv_obj_t * roller = lv_page_create(par, copy);
LV_ASSERT_MEM(roller);
if(roller == NULL) return NULL;
if(ancestor_scrl_signal == NULL) ancestor_scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrollable(roller));
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(roller);
/*Allocate the roller type specific extended data*/
lv_roller_ext_t * ext = lv_obj_allocate_ext_attr(roller, sizeof(lv_roller_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(roller);
return NULL;
}
ext->mode = LV_ROLLER_MODE_NORMAL;
ext->option_cnt = 0;
ext->sel_opt_id = 0;
ext->sel_opt_id_ori = 0;
ext->auto_fit = 1;
lv_style_list_init(&ext->style_sel);
/*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(roller, lv_roller_signal);
lv_obj_set_design_cb(roller, lv_roller_design);
/*Init the new roller roller*/
if(copy == NULL) {
lv_obj_t * label = lv_label_create(roller, NULL);
lv_label_set_align(label, LV_LABEL_ALIGN_CENTER);
if(ancestor_label_design == NULL) ancestor_label_design = lv_obj_get_design_cb(label);
lv_obj_set_design_cb(label, lv_roller_label_design);
lv_obj_t * scrl = lv_page_get_scrollable(roller);
lv_obj_set_drag(scrl, true);
lv_page_set_scrollable_fit2(roller, LV_FIT_PARENT, LV_FIT_NONE); /*Height is specified directly*/
lv_roller_set_anim_time(roller, LV_ROLLER_DEF_ANIM_TIME);
lv_roller_set_options(roller, "Option 1\nOption 2\nOption 3\nOption 4\nOption 5", LV_ROLLER_MODE_NORMAL);
lv_obj_set_signal_cb(scrl, lv_roller_scrl_signal);
lv_obj_clean_style_list(roller, LV_PAGE_PART_SCROLLABLE); /*Use a transparent scrollable*/
lv_theme_apply(roller, LV_THEME_ROLLER);
refr_height(roller);
lv_roller_set_visible_row_count(roller, 3);
}
/*Copy an existing roller*/
else {
lv_label_create(roller, get_label(copy));
lv_roller_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->mode = copy_ext->mode;
ext->option_cnt = copy_ext->option_cnt;
ext->sel_opt_id = copy_ext->sel_opt_id;
ext->sel_opt_id_ori = copy_ext->sel_opt_id;
ext->auto_fit = copy_ext->auto_fit;
lv_obj_t * scrl = lv_page_get_scrollable(roller);
lv_obj_set_signal_cb(scrl, lv_roller_scrl_signal);
lv_style_list_copy(&ext->style_sel, ©_ext->style_sel);
lv_obj_refresh_style(roller, LV_STYLE_PROP_ALL);
}
LV_LOG_INFO("roller created");
return roller;
}
/*=====================
* Setter functions
*====================*/
/**
* Set the options on a roller
* @param roller pointer to roller object
* @param options a string with '\n' separated options. E.g. "One\nTwo\nThree"
* @param mode `LV_ROLLER_MODE_NORMAL` or `LV_ROLLER_MODE_INFINITE`
*/
void lv_roller_set_options(lv_obj_t * roller, const char * options, lv_roller_mode_t mode)
{
LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
LV_ASSERT_STR(options);
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
lv_obj_t * label = get_label(roller);
ext->sel_opt_id = 0;
ext->sel_opt_id_ori = 0;
/*Count the '\n'-s to determine the number of options*/
ext->option_cnt = 0;
uint32_t cnt;
for(cnt = 0; options[cnt] != '\0'; cnt++) {
if(options[cnt] == '\n') ext->option_cnt++;
}
ext->option_cnt++; /*Last option has no `\n`*/
if(mode == LV_ROLLER_MODE_NORMAL) {
ext->mode = LV_ROLLER_MODE_NORMAL;
lv_label_set_text(label, options);
}
else {
ext->mode = LV_ROLLER_MODE_INIFINITE;
size_t opt_len = strlen(options) + 1; /*+1 to add '\n' after option lists*/
char * opt_extra = _lv_mem_buf_get(opt_len * LV_ROLLER_INF_PAGES);
uint8_t i;
for(i = 0; i < LV_ROLLER_INF_PAGES; i++) {
strcpy(&opt_extra[opt_len * i], options);
opt_extra[opt_len * (i + 1) - 1] = '\n';
}
opt_extra[opt_len * LV_ROLLER_INF_PAGES - 1] = '\0';
lv_label_set_text(label, opt_extra);
_lv_mem_buf_release(opt_extra);
ext->sel_opt_id = ((LV_ROLLER_INF_PAGES / 2) + 0) * ext->option_cnt;
ext->option_cnt = ext->option_cnt * LV_ROLLER_INF_PAGES;
}
ext->sel_opt_id_ori = ext->sel_opt_id;
refr_height(roller);
refr_width(roller);
}
/**
* Set the align of the roller's options (left or center)
* @param roller - pointer to a roller object
* @param align - one of lv_label_align_t values (left, right, center)
*/
void lv_roller_set_align(lv_obj_t * roller, lv_label_align_t align)
{
LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
lv_obj_t * label = get_label(roller);
if(label == NULL) return; /*Probably the roller is being deleted if the label is NULL.*/
lv_label_set_align(label, align);
refr_width(roller); /*To set the correct label position*/
}
/**
* Set the selected option
* @param roller pointer to a roller object
* @param sel_opt id of the selected option (0 ... number of option - 1);
* @param anim_en LV_ANIM_ON: set with animation; LV_ANOM_OFF set immediately
*/
void lv_roller_set_selected(lv_obj_t * roller, uint16_t sel_opt, lv_anim_enable_t anim)
{
LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
#if LV_USE_ANIMATION == 0
anim = LV_ANIM_OFF;
#endif
/* Set the value even if it's the same as the current value because
* if moving to the next option with an animation which was just deleted in the PRESS signal
* nothing will continue the animation. */
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
/*In infinite mode interpret the new ID relative to the currently visible "page"*/
if(ext->mode == LV_ROLLER_MODE_INIFINITE) {
int32_t sel_opt_signed = sel_opt;
uint16_t page = ext->sel_opt_id / LV_ROLLER_INF_PAGES;
/* `sel_opt` should be less than the number of options set by the user.
* If it's more then probably it's a reference from not the first page
* so normalize `sel_opt` */
if(page != 0) {
sel_opt_signed -= page * LV_ROLLER_INF_PAGES;
}
sel_opt = page * LV_ROLLER_INF_PAGES + sel_opt_signed;
}
ext->sel_opt_id = sel_opt < ext->option_cnt ? sel_opt : ext->option_cnt - 1;
ext->sel_opt_id_ori = ext->sel_opt_id;
refr_position(roller, anim);
}
/**
* Set the height to show the given number of rows (options)
* @param roller pointer to a roller object
* @param row_cnt number of desired visible rows
*/
void lv_roller_set_visible_row_count(lv_obj_t * roller, uint8_t row_cnt)
{
LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
const lv_font_t * font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG);
lv_obj_set_height(roller, (lv_font_get_line_height(font) + line_space) * row_cnt);
refr_height(roller);
refr_position(roller, LV_ANIM_OFF);
}
/**
* Allow automatically setting the width of roller according to it's content.
* @param roller pointer to a roller object
* @param auto_fit true: enable auto fit
*/
void lv_roller_set_auto_fit(lv_obj_t * roller, bool auto_fit)
{
LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
ext->auto_fit = auto_fit;
refr_width(roller);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the id of the selected option
* @param roller pointer to a roller object
* @return id of the selected option (0 ... number of option - 1);
*/
uint16_t lv_roller_get_selected(const lv_obj_t * roller)
{
LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
if(ext->mode == LV_ROLLER_MODE_INIFINITE) {
uint16_t real_id_cnt = ext->option_cnt / LV_ROLLER_INF_PAGES;
return ext->sel_opt_id % real_id_cnt;
}
else {
return ext->sel_opt_id;
}
}
/**
* Get the current selected option as a string
* @param ddlist pointer to ddlist object
* @param buf pointer to an array to store the string
* @param buf_size size of `buf` in bytes. 0: to ignore it.
*/
void lv_roller_get_selected_str(const lv_obj_t * roller, char * buf, uint32_t buf_size)
{
LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
lv_obj_t * label = get_label(roller);
uint32_t i;
uint16_t line = 0;
const char * opt_txt = lv_label_get_text(label);
size_t txt_len = strlen(opt_txt);
for(i = 0; i < txt_len && line != ext->sel_opt_id; i++) {
if(opt_txt[i] == '\n') line++;
}
uint32_t c;
for(c = 0; i < txt_len && opt_txt[i] != '\n'; c++, i++) {
if(buf_size && c >= buf_size - 1) {
LV_LOG_WARN("lv_dropdown_get_selected_str: the buffer was too small")
break;
}
buf[c] = opt_txt[i];
}
buf[c] = '\0';
}
/**
* Get the total number of options
* @param roller pointer to a roller object
* @return the total number of options
*/
uint16_t lv_roller_get_option_cnt(const lv_obj_t * roller)
{
LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
if(ext->mode == LV_ROLLER_MODE_INIFINITE) {
return ext->option_cnt / LV_ROLLER_INF_PAGES;
}
else {
return ext->option_cnt;
}
}
/**
* Get the align attribute. Default alignment after _create is LV_LABEL_ALIGN_CENTER
* @param roller pointer to a roller object
* @return LV_LABEL_ALIGN_LEFT, LV_LABEL_ALIGN_RIGHT or LV_LABEL_ALIGN_CENTER
*/
lv_label_align_t lv_roller_get_align(const lv_obj_t * roller)
{
LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
return lv_label_get_align(get_label(roller));
}
/**
* Get whether the auto fit option is enabled or not.
* @param roller pointer to a roller object
* @return true: auto fit is enabled
*/
bool lv_roller_get_auto_fit(lv_obj_t * roller)
{
LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
return ext->auto_fit ? true : false;
}
/**
* Get the options of a roller
* @param roller pointer to roller object
* @return the options separated by '\n'-s (E.g. "Option1\nOption2\nOption3")
*/
const char * lv_roller_get_options(const lv_obj_t * roller)
{
LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
return lv_label_get_text(get_label(roller));
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the rollers
* @param roller pointer to an object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after all children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_roller_design(lv_obj_t * roller, const lv_area_t * clip_area, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
return LV_DESIGN_RES_NOT_COVER;
}
/*Draw the object*/
else if(mode == LV_DESIGN_DRAW_MAIN) {
draw_bg(roller, clip_area);
const lv_font_t * font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG);
lv_coord_t font_h = lv_font_get_line_height(font);
lv_area_t rect_area;
rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - line_space / 2;
if((font_h & 0x1) && (line_space & 0x1)) rect_area.y1--; /*Compensate the two rounding error*/
rect_area.y2 = rect_area.y1 + font_h + line_space - 1;
lv_area_t roller_coords;
lv_obj_get_coords(roller, &roller_coords);
lv_obj_get_inner_coords(roller, &roller_coords);
rect_area.x1 = roller_coords.x1;
rect_area.x2 = roller_coords.x2;
lv_draw_rect_dsc_t sel_dsc;
lv_draw_rect_dsc_init(&sel_dsc);
lv_obj_init_draw_rect_dsc(roller, LV_ROLLER_PART_SELECTED, &sel_dsc);
lv_draw_rect(&rect_area, clip_area, &sel_dsc);
}
/*Post draw when the children are drawn*/
else if(mode == LV_DESIGN_DRAW_POST) {
lv_draw_label_dsc_t label_dsc;
lv_draw_label_dsc_init(&label_dsc);
lv_obj_init_draw_label_dsc(roller, LV_ROLLER_PART_SELECTED, &label_dsc);
lv_coord_t bg_font_h = lv_font_get_line_height(lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG));
/*Redraw the text on the selected area*/
lv_area_t rect_area;
rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - bg_font_h / 2 - label_dsc.line_space / 2;
if((bg_font_h & 0x1) && (label_dsc.line_space & 0x1)) rect_area.y1--; /*Compensate the two rounding error*/
rect_area.y2 = rect_area.y1 + bg_font_h + label_dsc.line_space - 1;
rect_area.x1 = roller->coords.x1;
rect_area.x2 = roller->coords.x2;
lv_area_t mask_sel;
bool area_ok;
area_ok = _lv_area_intersect(&mask_sel, clip_area, &rect_area);
if(area_ok) {
lv_obj_t * label = get_label(roller);
lv_label_align_t label_align = lv_roller_get_align(roller);
if(LV_LABEL_ALIGN_CENTER == label_align) {
label_dsc.flag |= LV_TXT_FLAG_CENTER;
}
else if(LV_LABEL_ALIGN_RIGHT == label_align) {
label_dsc.flag |= LV_TXT_FLAG_RIGHT;
}
/*Get the size of the "selected text"*/
lv_point_t res_p;
_lv_txt_get_size(&res_p, lv_label_get_text(label), label_dsc.font, label_dsc.letter_space, label_dsc.line_space,
lv_obj_get_width(roller), LV_TXT_FLAG_EXPAND);
/*Move the selected label proportionally with the background label*/
lv_coord_t roller_h = lv_obj_get_height(roller);
int32_t label_y_prop = label->coords.y1 - (roller_h / 2 +
roller->coords.y1); /*label offset from the middle line of the roller*/
label_y_prop = (label_y_prop << 14) / lv_obj_get_height(
label); /*Proportional position from the middle line (upscaled)*/
/*Apply a correction with different line heights*/
const lv_font_t * normal_label_font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
lv_coord_t corr = (label_dsc.font->line_height - normal_label_font->line_height) / 2;
/*Apply the proportional position to the selected text*/
res_p.y -= corr;
int32_t label_sel_y = roller_h / 2 + roller->coords.y1;
label_sel_y += (label_y_prop * res_p.y) >> 14;
label_sel_y -= corr;
/*Draw the selected text*/
lv_area_t label_sel_area;
label_sel_area.x1 = label->coords.x1;
label_sel_area.y1 = label_sel_y;
label_sel_area.x2 = label->coords.x2;
label_sel_area.y2 = label_sel_area.y1 + res_p.y;
label_dsc.flag |= LV_TXT_FLAG_EXPAND;
lv_draw_label(&label_sel_area, &mask_sel, &label_dsc, lv_label_get_text(label), NULL);
}
}
return LV_DESIGN_RES_OK;
}
/**
* Handle the drawing related tasks of the roller's label
* @param roller pointer to an object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after all children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_roller_label_design(lv_obj_t * label, const lv_area_t * clip_area, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
return ancestor_label_design(label, clip_area, mode);
}
/*Draw the object*/
else if(mode == LV_DESIGN_DRAW_MAIN) {
/* Split the drawing of the label into an upper (above the selected area)
* and a lower (below the selected area)*/
lv_obj_t * roller = lv_obj_get_parent(lv_obj_get_parent(label));
const lv_font_t * font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG);
lv_coord_t font_h = lv_font_get_line_height(font);
lv_area_t rect_area;
rect_area.y1 = roller->coords.y1 + lv_obj_get_height(roller) / 2 - font_h / 2 - line_space / 2;
if((font_h & 0x1) && (line_space & 0x1)) rect_area.y1--; /*Compensate the two rounding error*/
rect_area.y2 = rect_area.y1 + font_h + line_space - 1;
lv_area_t roller_coords;
lv_obj_get_coords(roller, &roller_coords);
lv_obj_get_inner_coords(roller, &roller_coords);
rect_area.x1 = roller_coords.x1;
rect_area.x2 = roller_coords.x2;
lv_area_t clip2;
clip2.x1 = label->coords.x1;
clip2.y1 = label->coords.y1;
clip2.x2 = label->coords.x2;
clip2.y2 = rect_area.y1;
if(_lv_area_intersect(&clip2, clip_area, &clip2)) {
ancestor_label_design(label, &clip2, mode);
}
clip2.x1 = label->coords.x1;
clip2.y1 = rect_area.y2;
clip2.x2 = label->coords.x2;
clip2.y2 = label->coords.y2;
if(_lv_area_intersect(&clip2, clip_area, &clip2)) {
ancestor_label_design(label, &clip2, mode);
}
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the roller
* @param roller pointer to a roller object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_roller_signal(lv_obj_t * roller, lv_signal_t sign, void * param)
{
lv_res_t res = LV_RES_OK;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_roller_get_style(roller, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(roller, sign, param);
}
/* Include the ancient signal function */
if(sign != LV_SIGNAL_CONTROL) { /*Don't let the page to scroll on keys*/
#if LV_USE_GROUP
res = ancestor_signal(roller, sign, param);
if(res != LV_RES_OK) return res;
#endif
}
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
LV_UNUSED(ext);
if(sign == LV_SIGNAL_STYLE_CHG) {
lv_obj_t * label = get_label(roller);
/*Be sure the label's style is updated before processing the roller*/
if(label) lv_signal_send(label, LV_SIGNAL_STYLE_CHG, NULL);
refr_height(roller);
refr_width(roller);
refr_position(roller, false);
}
else if(sign == LV_SIGNAL_COORD_CHG) {
if(lv_obj_get_width(roller) != lv_area_get_width(param) ||
lv_obj_get_height(roller) != lv_area_get_height(param)) {
#if LV_USE_ANIMATION
lv_anim_del(lv_page_get_scrollable(roller), (lv_anim_exec_xcb_t)lv_obj_set_y);
#endif
refr_position(roller, false);
refr_width(roller);
}
}
else if(sign == LV_SIGNAL_RELEASED) {
release_handler(roller);
}
else if(sign == LV_SIGNAL_FOCUS) {
#if LV_USE_GROUP
lv_group_t * g = lv_obj_get_group(roller);
bool editing = lv_group_get_editing(g);
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
/*Encoders need special handling*/
if(indev_type == LV_INDEV_TYPE_ENCODER) {
/*In navigate mode revert the original value*/
if(!editing) {
if(ext->sel_opt_id != ext->sel_opt_id_ori) {
ext->sel_opt_id = ext->sel_opt_id_ori;
refr_position(roller, true);
}
}
/*Save the current state when entered to edit mode*/
else {
ext->sel_opt_id_ori = ext->sel_opt_id;
}
}
else {
ext->sel_opt_id_ori = ext->sel_opt_id; /*Save the current value. Used to revert this state if
ENTER won't be pressed*/
}
#endif
}
else if(sign == LV_SIGNAL_DEFOCUS) {
#if LV_USE_GROUP
/*Revert the original state*/
if(ext->sel_opt_id != ext->sel_opt_id_ori) {
ext->sel_opt_id = ext->sel_opt_id_ori;
refr_position(roller, true);
}
#endif
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
char c = *((char *)param);
if(c == LV_KEY_RIGHT || c == LV_KEY_DOWN) {
if(ext->sel_opt_id + 1 < ext->option_cnt) {
uint16_t ori_id = ext->sel_opt_id_ori; /*lv_roller_set_selected will overwrite this*/
lv_roller_set_selected(roller, ext->sel_opt_id + 1, true);
ext->sel_opt_id_ori = ori_id;
}
}
else if(c == LV_KEY_LEFT || c == LV_KEY_UP) {
if(ext->sel_opt_id > 0) {
uint16_t ori_id = ext->sel_opt_id_ori; /*lv_roller_set_selected will overwrite this*/
lv_roller_set_selected(roller, ext->sel_opt_id - 1, true);
ext->sel_opt_id_ori = ori_id;
}
}
#endif
}
else if(sign == LV_SIGNAL_CLEANUP) {
lv_obj_clean_style_list(roller, LV_ROLLER_PART_SELECTED);
}
return res;
}
/**
* Get the style descriptor of a part of the object
* @param page pointer the object
* @param part the part from `lv_roller_part_t`. (LV_ROLLER_PART_...)
* @return pointer to the style descriptor of the specified part
*/
static lv_style_list_t * lv_roller_get_style(lv_obj_t * roller, uint8_t part)
{
LV_ASSERT_OBJ(roller, LV_OBJX_NAME);
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
lv_style_list_t * style_dsc_p;
switch(part) {
case LV_ROLLER_PART_BG:
style_dsc_p = &roller->style_list;
break;
case LV_ROLLER_PART_SELECTED:
style_dsc_p = &ext->style_sel;
break;
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
/**
* Signal function of the scrollable part of the roller.
* @param roller_scrl pointer to the scrollable part of roller (page)
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_roller_scrl_signal(lv_obj_t * roller_scrl, lv_signal_t sign, void * param)
{
lv_res_t res;
/* Include the ancient signal function */
res = ancestor_scrl_signal(roller_scrl, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
lv_obj_t * roller = lv_obj_get_parent(roller_scrl);
/*On delete the ddlist signal deletes the label so nothing left to do here*/
lv_obj_t * label = get_label(roller);
if(label == NULL) return LV_RES_INV;
int32_t id = -1;
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
const lv_font_t * font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG);
lv_coord_t font_h = lv_font_get_line_height(font);
if(sign == LV_SIGNAL_DRAG_END) {
/*If dragged then align the list to have an element in the middle*/
lv_coord_t label_y1 = label->coords.y1 - roller->coords.y1;
lv_coord_t label_unit = font_h + line_space;
lv_coord_t mid = (roller->coords.y2 - roller->coords.y1) / 2;
id = (mid - label_y1 + line_space / 2) / label_unit;
if(id < 0) id = 0;
if(id >= ext->option_cnt) id = ext->option_cnt - 1;
ext->sel_opt_id = id;
ext->sel_opt_id_ori = id;
res = lv_event_send(roller, LV_EVENT_VALUE_CHANGED, &id);
if(res != LV_RES_OK) return res;
}
/*If picked an option by clicking then set it*/
else if(sign == LV_SIGNAL_RELEASED) {
release_handler(roller);
}
else if(sign == LV_SIGNAL_PRESSED) {
#if LV_USE_ANIMATION
lv_anim_del(roller_scrl, (lv_anim_exec_xcb_t)lv_obj_set_y);
#endif
}
else if(sign == LV_SIGNAL_PARENT_SIZE_CHG) {
#if LV_USE_ANIMATION
lv_anim_del(lv_page_get_scrollable(roller), (lv_anim_exec_xcb_t)lv_obj_set_y);
#endif
refr_position(roller, false);
refr_width(roller);
}
/*Position the scrollable according to the new selected option*/
if(id != -1) {
refr_position(roller, LV_ANIM_ON);
}
return res;
}
/**
* Draw a rectangle which has gradient on its top and bottom
* @param roller pointer to a roller object
* @param clip_area pointer to the current mask (from the design function)
*/
static void draw_bg(lv_obj_t * roller, const lv_area_t * clip_area)
{
lv_draw_rect_dsc_t bg_dsc;
lv_draw_rect_dsc_init(&bg_dsc);
lv_obj_init_draw_rect_dsc(roller, LV_ROLLER_PART_BG, &bg_dsc);
/*With non-vertical gradient simply draw the background*/
if(bg_dsc.bg_grad_dir == LV_GRAD_DIR_NONE) {
lv_draw_rect(&roller->coords, clip_area, &bg_dsc);
return;
}
/*With vertical gradient mirror it*/
lv_area_t half_mask;
lv_coord_t h = lv_obj_get_height(roller);
bool union_ok;
lv_area_copy(&half_mask, &roller->coords);
half_mask.x1 -= roller->ext_draw_pad; /*Add ext size too (e.g. because of shadow draw) */
half_mask.x2 += roller->ext_draw_pad;
half_mask.y1 -= roller->ext_draw_pad;
half_mask.y2 = roller->coords.y1 + h / 2;
union_ok = _lv_area_intersect(&half_mask, &half_mask, clip_area);
bg_dsc.bg_main_color_stop = bg_dsc.bg_main_color_stop / 2;
bg_dsc.bg_grad_color_stop = 128 - (255 - bg_dsc.bg_grad_color_stop) / 2;
if(union_ok) {
lv_draw_rect(&roller->coords, &half_mask, &bg_dsc);
}
lv_area_copy(&half_mask, &roller->coords);
half_mask.x1 -= roller->ext_draw_pad; /*Revert ext. size adding*/
half_mask.x2 += roller->ext_draw_pad;
half_mask.y1 = roller->coords.y1 + h / 2;
half_mask.y2 += roller->ext_draw_pad;
union_ok = _lv_area_intersect(&half_mask, &half_mask, clip_area);
if(union_ok) {
lv_color_t c = bg_dsc.bg_color;
bg_dsc.bg_color = bg_dsc.bg_grad_color;
bg_dsc.bg_grad_color = c;
bg_dsc.bg_main_color_stop += 127;
bg_dsc.bg_grad_color_stop += 127;
lv_draw_rect(&roller->coords, &half_mask, &bg_dsc);
}
}
/**
* Refresh the position of the roller. It uses the id stored in: ext->ddlist.selected_option_id
* @param roller pointer to a roller object
* @param anim_en LV_ANIM_ON: refresh with animation; LV_ANOM_OFF: without animation
*/
static void refr_position(lv_obj_t * roller, lv_anim_enable_t anim_en)
{
#if LV_USE_ANIMATION == 0
anim_en = LV_ANIM_OFF;
#endif
lv_obj_t * roller_scrl = lv_page_get_scrollable(roller);
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
const lv_font_t * font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG);
lv_coord_t font_h = lv_font_get_line_height(font);
lv_coord_t h = lv_obj_get_height(roller);
uint16_t anim_time = lv_roller_get_anim_time(roller);
/* Normally the animation's `end_cb` sets correct position of the roller if infinite.
* But without animations do it manually*/
if(anim_en == LV_ANIM_OFF || anim_time == 0) {
inf_normalize(roller_scrl);
}
lv_obj_t * label = get_label(roller);
int32_t id = ext->sel_opt_id;
lv_coord_t line_y1 = id * (font_h + line_space) + label->coords.y1 - roller_scrl->coords.y1;
lv_coord_t new_y = -line_y1 + (h - font_h) / 2;
if(anim_en == LV_ANIM_OFF || anim_time == 0) {
#if LV_USE_ANIMATION
lv_anim_del(roller_scrl, (lv_anim_exec_xcb_t)lv_obj_set_y);
#endif
lv_obj_set_y(roller_scrl, new_y);
}
else {
#if LV_USE_ANIMATION
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, roller_scrl);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_y);
lv_anim_set_values(&a, lv_obj_get_y(roller_scrl), new_y);
lv_anim_set_time(&a, anim_time);
lv_anim_set_ready_cb(&a, scroll_anim_ready_cb);
lv_anim_start(&a);
#endif
}
}
static lv_res_t release_handler(lv_obj_t * roller)
{
/*If there was dragging `DRAG_END` signal will refresh the position and update the selected option*/
if(lv_indev_is_dragging(lv_indev_get_act())) return LV_RES_OK;
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
lv_indev_t * indev = lv_indev_get_act();
#if LV_USE_GROUP
/*Leave edit mode once a new option is selected*/
lv_indev_type_t indev_type = lv_indev_get_type(indev);
if(indev_type == LV_INDEV_TYPE_ENCODER || indev_type == LV_INDEV_TYPE_KEYPAD) {
ext->sel_opt_id_ori = ext->sel_opt_id;
if(indev_type == LV_INDEV_TYPE_ENCODER) {
lv_group_t * g = lv_obj_get_group(roller);
if(lv_group_get_editing(g)) {
lv_group_set_editing(g, false);
}
}
}
#endif
lv_obj_t * label = get_label(roller);
if(label == NULL) return LV_RES_OK;
if(lv_indev_get_type(indev) == LV_INDEV_TYPE_POINTER || lv_indev_get_type(indev) == LV_INDEV_TYPE_BUTTON) {
/*Search the clicked option (For KEYPAD and ENCODER the new value should be already set)*/
uint16_t new_opt = 0;
lv_point_t p;
lv_indev_get_point(indev, &p);
p.y -= label->coords.y1;
p.x -= label->coords.x1;
uint32_t letter_i;
letter_i = lv_label_get_letter_on(label, &p);
const char * txt = lv_label_get_text(label);
uint32_t i = 0;
uint32_t i_prev = 0;
uint32_t letter_cnt = 0;
for(letter_cnt = 0; letter_cnt < letter_i; letter_cnt++) {
uint32_t letter = _lv_txt_encoded_next(txt, &i);
/*Count he lines to reach the clicked letter. But ignore the last '\n' because it
* still belongs to the clicked line*/
if(letter == '\n' && i_prev != letter_i) new_opt++;
i_prev = i;
}
lv_roller_set_selected(roller, new_opt, LV_ANIM_ON);
}
uint32_t id = ext->sel_opt_id; /*Just to use uint32_t in event data*/
lv_res_t res = lv_event_send(roller, LV_EVENT_VALUE_CHANGED, &id);
return res;
}
static void refr_width(lv_obj_t * roller)
{
lv_obj_t * label = get_label(roller);
if(label == NULL) return;
switch(lv_label_get_align(label)) {
case LV_LABEL_ALIGN_LEFT:
lv_obj_align(label, NULL, LV_ALIGN_IN_LEFT_MID, 0, 0);
break;
case LV_LABEL_ALIGN_CENTER:
lv_obj_align(label, NULL, LV_ALIGN_CENTER, 0, 0);
break;
case LV_LABEL_ALIGN_RIGHT:
lv_obj_align(label, NULL, LV_ALIGN_IN_RIGHT_MID, 0, 0);
break;
}
if(lv_roller_get_auto_fit(roller) == false) return;
lv_coord_t label_w = lv_obj_get_width(label);
lv_style_int_t left = lv_obj_get_style_pad_left(roller, LV_ROLLER_PART_BG);
lv_style_int_t right = lv_obj_get_style_pad_right(roller, LV_ROLLER_PART_BG);
lv_obj_set_width(roller, label_w + left + right);
}
/**
* Refresh the height of the roller and the scrollable
* @param roller pointer to roller
*/
static void refr_height(lv_obj_t * roller)
{
lv_obj_t * label = get_label(roller);
if(label == NULL) return;
lv_obj_set_height(lv_page_get_scrollable(roller), lv_obj_get_height(label) + lv_obj_get_height(roller));
#if LV_USE_ANIMATION
lv_anim_del(lv_page_get_scrollable(roller), (lv_anim_exec_xcb_t)lv_obj_set_y);
#endif
refr_position(roller, LV_ANIM_OFF);
}
/**
* Set the middle page for the roller if infinite is enabled
* @param scrl pointer to the roller's scrollable (lv_obj_t *)
*/
static void inf_normalize(void * scrl)
{
lv_obj_t * roller_scrl = (lv_obj_t *)scrl;
lv_obj_t * roller = lv_obj_get_parent(roller_scrl);
lv_roller_ext_t * ext = lv_obj_get_ext_attr(roller);
if(ext->mode == LV_ROLLER_MODE_INIFINITE) {
uint16_t real_id_cnt = ext->option_cnt / LV_ROLLER_INF_PAGES;
ext->sel_opt_id = ext->sel_opt_id % real_id_cnt;
ext->sel_opt_id += (LV_ROLLER_INF_PAGES / 2) * real_id_cnt; /*Select the middle page*/
ext->sel_opt_id_ori = ext->sel_opt_id % real_id_cnt;
ext->sel_opt_id_ori += (LV_ROLLER_INF_PAGES / 2) * real_id_cnt; /*Select the middle page*/
/*Move to the new id*/
const lv_font_t * font = lv_obj_get_style_text_font(roller, LV_ROLLER_PART_BG);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(roller, LV_ROLLER_PART_BG);
lv_coord_t font_h = lv_font_get_line_height(font);
lv_coord_t h = lv_obj_get_height(roller);
lv_obj_t * label = get_label(roller);
lv_coord_t line_y1 = ext->sel_opt_id * (font_h + line_space) + label->coords.y1 - roller_scrl->coords.y1;
lv_coord_t new_y = -line_y1 + (h - font_h) / 2;
lv_obj_set_y(roller_scrl, new_y);
}
}
static lv_obj_t * get_label(const lv_obj_t * roller)
{
lv_obj_t * scrl = lv_page_get_scrollable(roller);
if(scrl == NULL) return NULL; /*The roller is being deleted, the scrollable already not exists*/
return lv_obj_get_child(scrl, NULL);
}
#if LV_USE_ANIMATION
static void scroll_anim_ready_cb(lv_anim_t * a)
{
inf_normalize(a->var);
}
#endif
#endif
|
train_000.parquet/973
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_roller.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 36713,
"token_count": 14265
}
|
/**
* @file lv_line.h
*
*/
#ifndef LV_LINE_H
#define LV_LINE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_LINE != 0
#include "../lv_core/lv_obj.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of line*/
typedef struct {
/*Inherited from 'base_obj' so no inherited ext.*/ /*Ext. of ancestor*/
const lv_point_t * point_array; /*Pointer to an array with the points of the line*/
uint16_t point_num; /*Number of points in 'point_array' */
uint8_t auto_size : 1; /*1: set obj. width to x max and obj. height to y max */
uint8_t y_inv : 1; /*1: y == 0 will be on the bottom*/
} lv_line_ext_t;
/*Styles*/
enum {
LV_LINE_PART_MAIN,
};
typedef uint8_t lv_line_style_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a line objects
* @param par pointer to an object, it will be the parent of the new line
* @return pointer to the created line
*/
lv_obj_t * lv_line_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
*====================*/
/**
* Set an array of points. The line object will connect these points.
* @param line pointer to a line object
* @param point_a an array of points. Only the address is saved,
* so the array can NOT be a local variable which will be destroyed
* @param point_num number of points in 'point_a'
*/
void lv_line_set_points(lv_obj_t * line, const lv_point_t point_a[], uint16_t point_num);
/**
* Enable (or disable) the auto-size option. The size of the object will fit to its points.
* (set width to x max and height to y max)
* @param line pointer to a line object
* @param en true: auto size is enabled, false: auto size is disabled
*/
void lv_line_set_auto_size(lv_obj_t * line, bool en);
/**
* Enable (or disable) the y coordinate inversion.
* If enabled then y will be subtracted from the height of the object,
* therefore the y=0 coordinate will be on the bottom.
* @param line pointer to a line object
* @param en true: enable the y inversion, false:disable the y inversion
*/
void lv_line_set_y_invert(lv_obj_t * line, bool en);
#define lv_line_set_y_inv \
lv_line_set_y_invert /*The name was inconsistent. In v.6.0 only `lv_line_set_y_invert`will \
work */
/*=====================
* Getter functions
*====================*/
/**
* Get the auto size attribute
* @param line pointer to a line object
* @return true: auto size is enabled, false: disabled
*/
bool lv_line_get_auto_size(const lv_obj_t * line);
/**
* Get the y inversion attribute
* @param line pointer to a line object
* @return true: y inversion is enabled, false: disabled
*/
bool lv_line_get_y_invert(const lv_obj_t * line);
/**********************
* MACROS
**********************/
#endif /*LV_USE_LINE*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_LINE_H*/
|
train_000.parquet/974
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_line.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 3261,
"token_count": 1062
}
|
/**
* @file lv_cb.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_checkbox.h"
#if LV_USE_CHECKBOX != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_group.h"
#include "../lv_themes/lv_theme.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_checkbox"
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_res_t lv_checkbox_signal(lv_obj_t * cb, lv_signal_t sign, void * param);
static lv_style_list_t * lv_checkbox_get_style(lv_obj_t * cb, uint8_t type);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a check box objects
* @param par pointer to an object, it will be the parent of the new check box
* @param copy pointer to a check box object, if not NULL then the new object will be copied from it
* @return pointer to the created check box
*/
lv_obj_t * lv_checkbox_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("check box create started");
/*Create the ancestor basic object*/
lv_obj_t * cb = lv_btn_create(par, copy);
LV_ASSERT_MEM(cb);
if(cb == NULL) return NULL;
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(cb);
lv_checkbox_ext_t * ext = lv_obj_allocate_ext_attr(cb, sizeof(lv_checkbox_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(cb);
return NULL;
}
ext->bullet = NULL;
ext->label = NULL;
lv_obj_set_signal_cb(cb, lv_checkbox_signal);
/*Init the new checkbox object*/
if(copy == NULL) {
ext->bullet = lv_obj_create(cb, NULL);
lv_obj_set_click(ext->bullet, false);
ext->label = lv_label_create(cb, NULL);
lv_checkbox_set_text(cb, "Check box");
lv_btn_set_layout(cb, LV_LAYOUT_ROW_MID);
lv_btn_set_fit(cb, LV_FIT_TIGHT);
lv_btn_set_checkable(cb, true);
lv_obj_add_protect(cb, LV_PROTECT_PRESS_LOST);
lv_theme_apply(cb, LV_THEME_CHECKBOX);
}
else {
lv_checkbox_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->bullet = lv_obj_create(cb, copy_ext->bullet);
ext->label = lv_label_create(cb, copy_ext->label);
/*Refresh the style with new signal function*/
// lv_obj_refresh_style(cb);
}
LV_LOG_INFO("check box created");
return cb;
}
/*=====================
* Setter functions
*====================*/
/**
* Set the text of a check box. `txt` will be copied and may be deallocated
* after this function returns.
* @param cb pointer to a check box
* @param txt the text of the check box. NULL to refresh with the current text.
*/
void lv_checkbox_set_text(lv_obj_t * cb, const char * txt)
{
LV_ASSERT_OBJ(cb, LV_OBJX_NAME);
lv_checkbox_ext_t * ext = lv_obj_get_ext_attr(cb);
lv_label_set_text(ext->label, txt);
}
/**
* Set the text of a check box. `txt` must not be deallocated during the life
* of this checkbox.
* @param cb pointer to a check box
* @param txt the text of the check box. NULL to refresh with the current text.
*/
void lv_checkbox_set_text_static(lv_obj_t * cb, const char * txt)
{
LV_ASSERT_OBJ(cb, LV_OBJX_NAME);
lv_checkbox_ext_t * ext = lv_obj_get_ext_attr(cb);
lv_label_set_text_static(ext->label, txt);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the text of a check box
* @param cb pointer to check box object
* @return pointer to the text of the check box
*/
const char * lv_checkbox_get_text(const lv_obj_t * cb)
{
LV_ASSERT_OBJ(cb, LV_OBJX_NAME);
lv_checkbox_ext_t * ext = lv_obj_get_ext_attr(cb);
return lv_label_get_text(ext->label);
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Signal function of the check box
* @param cb pointer to a check box object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_checkbox_signal(lv_obj_t * cb, lv_signal_t sign, void * param)
{
lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_checkbox_get_style(cb, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(cb, sign, param);
}
/* Include the ancient signal function */
res = ancestor_signal(cb, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
lv_checkbox_ext_t * ext = lv_obj_get_ext_attr(cb);
if(sign == LV_SIGNAL_STYLE_CHG) {
const lv_font_t * font = lv_obj_get_style_text_font(ext->label, LV_LABEL_PART_MAIN);
lv_coord_t line_height = lv_font_get_line_height(font);
lv_coord_t leftp = lv_obj_get_style_pad_left(cb, LV_CHECKBOX_PART_BULLET);
lv_coord_t rightp = lv_obj_get_style_pad_right(cb, LV_CHECKBOX_PART_BULLET);
lv_coord_t topp = lv_obj_get_style_pad_top(cb, LV_CHECKBOX_PART_BULLET);
lv_coord_t bottomp = lv_obj_get_style_pad_bottom(cb, LV_CHECKBOX_PART_BULLET);
lv_obj_set_size(ext->bullet, line_height + leftp + rightp, line_height + topp + bottomp);
lv_obj_set_state(ext->bullet, lv_obj_get_state(cb, LV_CHECKBOX_PART_BG));
}
else if(sign == LV_SIGNAL_PRESSED || sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESS_LOST ||
sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS) {
lv_obj_set_state(ext->bullet, lv_obj_get_state(cb, LV_CHECKBOX_PART_BG));
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
char c = *((char *)param);
if(c == LV_KEY_RIGHT || c == LV_KEY_DOWN || c == LV_KEY_LEFT || c == LV_KEY_UP) {
/*Follow the backgrounds state with the bullet*/
lv_obj_set_state(ext->bullet, lv_obj_get_state(cb, LV_CHECKBOX_PART_BG));
}
#endif
}
return res;
}
static lv_style_list_t * lv_checkbox_get_style(lv_obj_t * cb, uint8_t type)
{
lv_style_list_t * style_dsc_p;
lv_checkbox_ext_t * ext = lv_obj_get_ext_attr(cb);
switch(type) {
case LV_CHECKBOX_PART_BG:
style_dsc_p = &cb->style_list;
break;
case LV_CHECKBOX_PART_BULLET:
style_dsc_p = lv_obj_get_style_list(ext->bullet, LV_BTN_PART_MAIN);
break;
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
#endif
|
train_000.parquet/975
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_checkbox.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 6837,
"token_count": 2693
}
|
/**
* @file lv_ta.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_textarea.h"
#if LV_USE_TEXTAREA != 0
#include <string.h>
#include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_group.h"
#include "../lv_core/lv_refr.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_anim.h"
#include "../lv_misc/lv_txt.h"
#include "../lv_misc/lv_math.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_textarea"
/*Test configuration*/
#ifndef LV_TEXTAREA_DEF_CURSOR_BLINK_TIME
#define LV_TEXTAREA_DEF_CURSOR_BLINK_TIME 400 /*ms*/
#endif
#ifndef LV_TEXTAREA_DEF_PWD_SHOW_TIME
#define LV_TEXTAREA_DEF_PWD_SHOW_TIME 1500 /*ms*/
#endif
#define LV_TEXTAREA_DEF_WIDTH (2 * LV_DPI)
#define LV_TEXTAREA_DEF_HEIGHT (1 * LV_DPI)
#define LV_TEXTAREA_PWD_BULLET_UNICODE 0x2022
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_design_res_t lv_textarea_design(lv_obj_t * ta, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_design_res_t lv_textarea_scrollable_design(lv_obj_t * scrl, const lv_area_t * clip_area,
lv_design_mode_t mode);
static lv_res_t lv_textarea_signal(lv_obj_t * ta, lv_signal_t sign, void * param);
static lv_res_t lv_textarea_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
static lv_style_list_t * lv_textarea_get_style(lv_obj_t * ta, uint8_t part);
#if LV_USE_ANIMATION
static void cursor_blink_anim(lv_obj_t * ta, lv_anim_value_t show);
static void pwd_char_hider_anim(lv_obj_t * ta, lv_anim_value_t x);
static void pwd_char_hider_anim_ready(lv_anim_t * a);
#endif
static void pwd_char_hider(lv_obj_t * ta);
static bool char_is_accepted(lv_obj_t * ta, uint32_t c);
static void refr_cursor_area(lv_obj_t * ta);
static void update_cursor_position_on_click(lv_obj_t * ta, lv_signal_t sign, lv_indev_t * click_source);
static lv_res_t insert_handler(lv_obj_t * ta, const char * txt);
/**********************
* STATIC VARIABLES
**********************/
static lv_design_cb_t ancestor_design;
static lv_design_cb_t scrl_design;
static lv_signal_cb_t ancestor_signal;
static lv_signal_cb_t scrl_signal;
static const char * ta_insert_replace;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a text area objects
* @param par pointer to an object, it will be the parent of the new text area
* @param copy pointer to a text area object, if not NULL then the new object will be copied from it
* @return pointer to the created text area
*/
lv_obj_t * lv_textarea_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("text area create started");
/*Create the ancestor object*/
lv_obj_t * ta = lv_page_create(par, copy);
LV_ASSERT_MEM(ta);
if(ta == NULL) return NULL;
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(ta);
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(ta);
if(scrl_signal == NULL) scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrollable(ta));
if(scrl_design == NULL) scrl_design = lv_obj_get_design_cb(lv_page_get_scrollable(ta));
/*Allocate the object type specific extended data*/
lv_textarea_ext_t * ext = lv_obj_allocate_ext_attr(ta, sizeof(lv_textarea_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(ta);
return NULL;
}
ext->pwd_mode = 0;
ext->pwd_tmp = NULL;
ext->pwd_show_time = LV_TEXTAREA_DEF_PWD_SHOW_TIME;
ext->accapted_chars = NULL;
ext->max_length = 0;
ext->cursor.state = 1;
ext->cursor.hidden = 0;
ext->cursor.blink_time = LV_TEXTAREA_DEF_CURSOR_BLINK_TIME;
ext->cursor.pos = 0;
ext->cursor.click_pos = 1;
ext->cursor.valid_x = 0;
ext->one_line = 0;
#if LV_LABEL_TEXT_SEL
ext->text_sel_en = 0;
#endif
ext->label = NULL;
ext->placeholder_txt = NULL;
lv_style_list_init(&ext->cursor.style);
lv_style_list_init(&ext->style_placeholder);
#if LV_USE_ANIMATION == 0
ext->pwd_show_time = 0;
ext->cursor.blink_time = 0;
#endif
lv_obj_set_signal_cb(ta, lv_textarea_signal);
lv_obj_set_signal_cb(lv_page_get_scrollable(ta), lv_textarea_scrollable_signal);
lv_obj_set_design_cb(ta, lv_textarea_design);
/*Init the new text area object*/
if(copy == NULL) {
lv_page_set_scrollable_fit2(ta, LV_FIT_PARENT, LV_FIT_TIGHT);
ext->label = lv_label_create(ta, NULL);
lv_obj_set_design_cb(ext->page.scrl, lv_textarea_scrollable_design);
lv_label_set_long_mode(ext->label, LV_LABEL_LONG_BREAK);
lv_label_set_text(ext->label, "Text area");
lv_obj_set_click(ext->label, false);
lv_obj_set_size(ta, LV_TEXTAREA_DEF_WIDTH, LV_TEXTAREA_DEF_HEIGHT);
lv_textarea_set_scrollbar_mode(ta, LV_SCROLLBAR_MODE_DRAG);
lv_obj_reset_style_list(ta, LV_PAGE_PART_SCROLLABLE);
lv_theme_apply(ta, LV_THEME_TEXTAREA);
}
/*Copy an existing object*/
else {
lv_obj_set_design_cb(ext->page.scrl, lv_textarea_scrollable_design);
lv_textarea_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->label = lv_label_create(ta, copy_ext->label);
ext->pwd_mode = copy_ext->pwd_mode;
ext->accapted_chars = copy_ext->accapted_chars;
ext->max_length = copy_ext->max_length;
ext->cursor.pos = copy_ext->cursor.pos;
ext->cursor.valid_x = copy_ext->cursor.valid_x;
ext->cursor.hidden = copy_ext->cursor.hidden;
lv_style_list_copy(&ext->cursor.style, ©_ext->cursor.style);
lv_style_list_copy(&ext->style_placeholder, ©_ext->style_placeholder);
if(ext->pwd_mode != 0) pwd_char_hider(ta);
if(copy_ext->placeholder_txt) {
lv_textarea_set_placeholder_text(ta, copy_ext->placeholder_txt);
}
if(copy_ext->pwd_tmp) {
uint32_t len = _lv_mem_get_size(copy_ext->pwd_tmp);
ext->pwd_tmp = lv_mem_alloc(len);
LV_ASSERT_MEM(ext->pwd_tmp);
if(ext->pwd_tmp == NULL) return NULL;
_lv_memcpy(ext->pwd_tmp, copy_ext->pwd_tmp, len);
}
if(copy_ext->one_line) lv_textarea_set_one_line(ta, true);
/*Refresh the style with new signal function*/
lv_obj_refresh_style(ta, LV_STYLE_PROP_ALL);
}
#if LV_USE_ANIMATION
if(ext->cursor.blink_time) {
/*Create a cursor blinker animation*/
lv_anim_path_t path;
lv_anim_path_init(&path);
lv_anim_path_set_cb(&path, lv_anim_path_step);
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, ta);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)cursor_blink_anim);
lv_anim_set_time(&a, ext->cursor.blink_time);
lv_anim_set_playback_time(&a, ext->cursor.blink_time);
lv_anim_set_values(&a, 0, 1);
lv_anim_set_path(&a, &path);
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
lv_anim_start(&a);
}
#endif
LV_LOG_INFO("text area created");
return ta;
}
/*======================
* Add/remove functions
*=====================*/
/**
* Insert a character to the current cursor position.
* To add a wide char, e.g. 'Á' use `_lv_txt_encoded_conv_wc('Á')`
* @param ta pointer to a text area object
* @param c a character (e.g. 'a')
*/
void lv_textarea_add_char(lv_obj_t * ta, uint32_t c)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
const char * letter_buf;
uint32_t u32_buf[2];
u32_buf[0] = c;
u32_buf[1] = 0;
letter_buf = (char *)&u32_buf;
#if LV_BIG_ENDIAN_SYSTEM
if(c != 0) while(*letter_buf == 0) ++letter_buf;
#endif
lv_res_t res = insert_handler(ta, letter_buf);
if(res != LV_RES_OK) return;
if(ext->one_line && (c == '\n' || c == '\r')) {
LV_LOG_INFO("Text area: line break ignored in one-line mode");
return;
}
uint32_t c_uni = _lv_txt_encoded_next((const char *)&c, NULL);
if(char_is_accepted(ta, c_uni) == false) {
LV_LOG_INFO("Character is no accepted by the text area (too long text or not in the "
"accepted list)");
return;
}
/*If a new line was added it shouldn't show edge flash effect*/
bool edge_flash_en = lv_textarea_get_edge_flash(ta);
lv_textarea_set_edge_flash(ta, false);
if(ext->pwd_mode != 0) pwd_char_hider(ta); /*Make sure all the current text contains only '*'*/
/*If the textarea is empty, invalidate it to hide the placeholder*/
if(ext->placeholder_txt) {
const char * txt = lv_label_get_text(ext->label);
if(txt[0] == '\0') lv_obj_invalidate(ta);
}
lv_label_ins_text(ext->label, ext->cursor.pos, letter_buf); /*Insert the character*/
lv_textarea_clear_selection(ta); /*Clear selection*/
if(ext->pwd_mode != 0) {
ext->pwd_tmp = lv_mem_realloc(ext->pwd_tmp, strlen(ext->pwd_tmp) + 2); /*+2: the new char + \0 */
LV_ASSERT_MEM(ext->pwd_tmp);
if(ext->pwd_tmp == NULL) return;
_lv_txt_ins(ext->pwd_tmp, ext->cursor.pos, (const char *)letter_buf);
#if LV_USE_ANIMATION
/*Auto hide characters*/
lv_anim_path_t path;
lv_anim_path_init(&path);
lv_anim_path_set_cb(&path, lv_anim_path_step);
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, ta);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)pwd_char_hider_anim);
lv_anim_set_time(&a, ext->pwd_show_time);
lv_anim_set_values(&a, 0, 1);
lv_anim_set_path(&a, &path);
lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready);
lv_anim_start(&a);
#else
pwd_char_hider(ta);
#endif
}
/*Move the cursor after the new character*/
lv_textarea_set_cursor_pos(ta, lv_textarea_get_cursor_pos(ta) + 1);
/*Revert the original edge flash state*/
lv_textarea_set_edge_flash(ta, edge_flash_en);
lv_event_send(ta, LV_EVENT_VALUE_CHANGED, NULL);
}
/**
* Insert a text to the current cursor position
* @param ta pointer to a text area object
* @param txt a '\0' terminated string to insert
*/
void lv_textarea_add_text(lv_obj_t * ta, const char * txt)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
LV_ASSERT_NULL(txt);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
if(ext->pwd_mode != 0) pwd_char_hider(ta); /*Make sure all the current text contains only '*'*/
/*Add the character one-by-one if not all characters are accepted or there is character limit.*/
if(lv_textarea_get_accepted_chars(ta) || lv_textarea_get_max_length(ta)) {
uint32_t i = 0;
while(txt[i] != '\0') {
uint32_t c = _lv_txt_encoded_next(txt, &i);
lv_textarea_add_char(ta, _lv_txt_unicode_to_encoded(c));
}
return;
}
lv_res_t res = insert_handler(ta, txt);
if(res != LV_RES_OK) return;
/*If a new line was added it shouldn't show edge flash effect*/
bool edge_flash_en = lv_textarea_get_edge_flash(ta);
lv_textarea_set_edge_flash(ta, false);
/*If the textarea is empty, invalidate it to hide the placeholder*/
if(ext->placeholder_txt) {
const char * txt_act = lv_label_get_text(ext->label);
if(txt_act[0] == '\0') lv_obj_invalidate(ta);
}
/*Insert the text*/
lv_label_ins_text(ext->label, ext->cursor.pos, txt);
lv_textarea_clear_selection(ta);
if(ext->pwd_mode != 0) {
ext->pwd_tmp = lv_mem_realloc(ext->pwd_tmp, strlen(ext->pwd_tmp) + strlen(txt) + 1);
LV_ASSERT_MEM(ext->pwd_tmp);
if(ext->pwd_tmp == NULL) return;
_lv_txt_ins(ext->pwd_tmp, ext->cursor.pos, txt);
#if LV_USE_ANIMATION
/*Auto hide characters*/
lv_anim_path_t path;
lv_anim_path_init(&path);
lv_anim_path_set_cb(&path, lv_anim_path_step);
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, ta);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)pwd_char_hider_anim);
lv_anim_set_time(&a, ext->pwd_show_time);
lv_anim_set_values(&a, 0, 1);
lv_anim_set_path(&a, &path);
lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready);
lv_anim_start(&a);
#else
pwd_char_hider(ta);
#endif
}
/*Move the cursor after the new text*/
lv_textarea_set_cursor_pos(ta, lv_textarea_get_cursor_pos(ta) + _lv_txt_get_encoded_length(txt));
/*Revert the original edge flash state*/
lv_textarea_set_edge_flash(ta, edge_flash_en);
lv_event_send(ta, LV_EVENT_VALUE_CHANGED, NULL);
}
/**
* Delete a the left character from the current cursor position
* @param ta pointer to a text area object
*/
void lv_textarea_del_char(lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
uint32_t cur_pos = ext->cursor.pos;
if(cur_pos == 0) return;
char del_buf[2] = {LV_KEY_DEL, '\0'};
lv_res_t res = insert_handler(ta, del_buf);
if(res != LV_RES_OK) return;
char * label_txt = lv_label_get_text(ext->label);
/*Delete a character*/
_lv_txt_cut(label_txt, ext->cursor.pos - 1, 1);
/*Refresh the label*/
lv_label_set_text(ext->label, label_txt);
lv_textarea_clear_selection(ta);
/*If the textarea became empty, invalidate it to hide the placeholder*/
if(ext->placeholder_txt) {
const char * txt = lv_label_get_text(ext->label);
if(txt[0] == '\0') lv_obj_invalidate(ta);
}
/*Don't let 'width == 0' because cursor will not be visible*/
if(lv_obj_get_width(ext->label) == 0) {
lv_style_int_t border_width = lv_obj_get_style_border_width(ta, LV_TEXTAREA_PART_CURSOR);
lv_obj_set_width(ext->label, border_width == 0 ? 1 : border_width);
}
if(ext->pwd_mode != 0) {
uint32_t byte_pos = _lv_txt_encoded_get_byte_id(ext->pwd_tmp, ext->cursor.pos - 1);
_lv_txt_cut(ext->pwd_tmp, ext->cursor.pos - 1, _lv_txt_encoded_size(&ext->pwd_tmp[byte_pos]));
ext->pwd_tmp = lv_mem_realloc(ext->pwd_tmp, strlen(ext->pwd_tmp) + 1);
LV_ASSERT_MEM(ext->pwd_tmp);
if(ext->pwd_tmp == NULL) return;
}
/*Move the cursor to the place of the deleted character*/
lv_textarea_set_cursor_pos(ta, ext->cursor.pos - 1);
lv_event_send(ta, LV_EVENT_VALUE_CHANGED, NULL);
}
/**
* Delete the right character from the current cursor position
* @param ta pointer to a text area object
*/
void lv_textarea_del_char_forward(lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
uint32_t cp = lv_textarea_get_cursor_pos(ta);
lv_textarea_set_cursor_pos(ta, cp + 1);
if(cp != lv_textarea_get_cursor_pos(ta)) lv_textarea_del_char(ta);
}
/*=====================
* Setter functions
*====================*/
/**
* Set the text of a text area
* @param ta pointer to a text area
* @param txt pointer to the text
*/
void lv_textarea_set_text(lv_obj_t * ta, const char * txt)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
LV_ASSERT_NULL(txt);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
/*Clear the existing selection*/
lv_textarea_clear_selection(ta);
/*Add the character one-by-one if not all characters are accepted or there is character limit.*/
if(lv_textarea_get_accepted_chars(ta) || lv_textarea_get_max_length(ta)) {
lv_label_set_text(ext->label, "");
lv_textarea_set_cursor_pos(ta, LV_TEXTAREA_CURSOR_LAST);
if(ext->pwd_mode != 0) {
ext->pwd_tmp[0] = '\0'; /*Clear the password too*/
}
uint32_t i = 0;
while(txt[i] != '\0') {
uint32_t c = _lv_txt_encoded_next(txt, &i);
lv_textarea_add_char(ta, _lv_txt_unicode_to_encoded(c));
}
}
else {
lv_label_set_text(ext->label, txt);
lv_textarea_set_cursor_pos(ta, LV_TEXTAREA_CURSOR_LAST);
}
/*If the textarea is empty, invalidate it to hide the placeholder*/
if(ext->placeholder_txt) {
const char * txt_act = lv_label_get_text(ext->label);
if(txt_act[0] == '\0') lv_obj_invalidate(ta);
}
/*Don't let 'width == 0' because the cursor will not be visible*/
if(lv_obj_get_width(ext->label) == 0) {
lv_style_int_t border_width = lv_obj_get_style_border_width(ta, LV_TEXTAREA_PART_CURSOR);
lv_obj_set_width(ext->label, border_width == 0 ? 1 : border_width);
}
if(ext->pwd_mode != 0) {
ext->pwd_tmp = lv_mem_realloc(ext->pwd_tmp, strlen(txt) + 1);
LV_ASSERT_MEM(ext->pwd_tmp);
if(ext->pwd_tmp == NULL) return;
strcpy(ext->pwd_tmp, txt);
#if LV_USE_ANIMATION
/*Auto hide characters*/
lv_anim_path_t path;
lv_anim_path_init(&path);
lv_anim_path_set_cb(&path, lv_anim_path_step);
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, ta);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)pwd_char_hider_anim);
lv_anim_set_time(&a, ext->pwd_show_time);
lv_anim_set_values(&a, 0, 1);
lv_anim_set_path(&a, &path);
lv_anim_set_ready_cb(&a, pwd_char_hider_anim_ready);
lv_anim_start(&a);
#else
pwd_char_hider(ta);
#endif
}
lv_event_send(ta, LV_EVENT_VALUE_CHANGED, NULL);
}
/**
* Set the placeholder_txt text of a text area
* @param ta pointer to a text area
* @param txt pointer to the text
*/
void lv_textarea_set_placeholder_text(lv_obj_t * ta, const char * txt)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
LV_ASSERT_NULL(txt);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
size_t txt_len = strlen(txt);
if(txt_len == 0) {
if(ext->placeholder_txt) {
lv_mem_free(ext->placeholder_txt);
ext->placeholder_txt = NULL;
}
}
else {
/*Allocate memory for the placeholder_txt text*/
if(ext->placeholder_txt == NULL) {
ext->placeholder_txt = lv_mem_alloc(txt_len + 1);
}
else {
ext->placeholder_txt = lv_mem_realloc(ext->placeholder_txt, txt_len + 1);
}
LV_ASSERT_MEM(ext->placeholder_txt);
if(ext->placeholder_txt == NULL) {
LV_LOG_ERROR("lv_textarea_set_placeholder_text: couldn't allocate memory for placeholder");
return;
}
strcpy(ext->placeholder_txt, txt);
}
lv_obj_invalidate(ta);
}
/**
* Set the cursor position
* @param obj pointer to a text area object
* @param pos the new cursor position in character index
* < 0 : index from the end of the text
* LV_TEXTAREA_CURSOR_LAST: go after the last character
*/
void lv_textarea_set_cursor_pos(lv_obj_t * ta, int32_t pos)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
if((uint32_t)ext->cursor.pos == (uint32_t)pos) return;
uint32_t len = _lv_txt_get_encoded_length(lv_label_get_text(ext->label));
if(pos < 0) pos = len + pos;
if(pos > (int32_t)len || pos == LV_TEXTAREA_CURSOR_LAST) pos = len;
ext->cursor.pos = pos;
/*Position the label to make the cursor visible*/
lv_obj_t * label_par = lv_obj_get_parent(ext->label);
lv_point_t cur_pos;
const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_BG);
lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_BG);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TEXTAREA_PART_BG);
lv_area_t label_cords;
lv_area_t ta_cords;
lv_label_get_letter_pos(ext->label, pos, &cur_pos);
lv_obj_get_coords(ta, &ta_cords);
lv_obj_get_coords(ext->label, &label_cords);
/*Check the top*/
lv_coord_t font_h = lv_font_get_line_height(font);
if(lv_obj_get_y(label_par) + cur_pos.y < 0) {
lv_obj_set_y(label_par, -cur_pos.y + top);
}
/*Check the bottom*/
if(label_cords.y1 + cur_pos.y + font_h + bottom > ta_cords.y2) {
lv_obj_set_y(label_par, -(cur_pos.y - lv_obj_get_height(ta) + font_h + top + bottom));
}
/*Check the left (use the font_h as general unit)*/
if(lv_obj_get_x(label_par) + cur_pos.x < font_h) {
lv_obj_set_x(label_par, -cur_pos.x + font_h);
}
lv_style_int_t right = lv_obj_get_style_pad_right(ta, LV_TEXTAREA_PART_BG);
lv_style_int_t left = lv_obj_get_style_pad_left(ta, LV_TEXTAREA_PART_BG);
/*Check the right (use the font_h as general unit)*/
if(label_cords.x1 + cur_pos.x + font_h + right > ta_cords.x2) {
lv_obj_set_x(label_par, -(cur_pos.x - lv_obj_get_width(ta) + font_h + left + right));
}
ext->cursor.valid_x = cur_pos.x;
#if LV_USE_ANIMATION
if(ext->cursor.blink_time) {
/*Reset cursor blink animation*/
lv_anim_path_t path;
lv_anim_path_init(&path);
lv_anim_path_set_cb(&path, lv_anim_path_step);
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, ta);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)cursor_blink_anim);
lv_anim_set_time(&a, ext->cursor.blink_time);
lv_anim_set_playback_time(&a, ext->cursor.blink_time);
lv_anim_set_values(&a, 1, 0);
lv_anim_set_path(&a, &path);
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
lv_anim_start(&a);
}
#endif
refr_cursor_area(ta);
}
/**
* Hide/Unhide the cursor.
* @param ta pointer to a text area object
* @param hide: true: hide the cursor
*/
void lv_textarea_set_cursor_hidden(lv_obj_t * ta, bool hide)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
ext->cursor.hidden = hide ? 1 : 0;
refr_cursor_area(ta);
}
/**
* Enable/Disable the positioning of the the cursor by clicking the text on the text area.
* @param ta pointer to a text area object
* @param en true: enable click positions; false: disable
*/
void lv_textarea_set_cursor_click_pos(lv_obj_t * ta, bool en)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
ext->cursor.click_pos = en ? 1 : 0;
}
/**
* Enable/Disable password mode
* @param ta pointer to a text area object
* @param en true: enable, false: disable
*/
void lv_textarea_set_pwd_mode(lv_obj_t * ta, bool en)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
if(ext->pwd_mode == en) return;
/*Pwd mode is now enabled*/
if(ext->pwd_mode == 0 && en != false) {
char * txt = lv_label_get_text(ext->label);
size_t len = strlen(txt);
ext->pwd_tmp = lv_mem_alloc(len + 1);
LV_ASSERT_MEM(ext->pwd_tmp);
if(ext->pwd_tmp == NULL) return;
strcpy(ext->pwd_tmp, txt);
pwd_char_hider(ta);
lv_textarea_clear_selection(ta);
}
/*Pwd mode is now disabled*/
else if(ext->pwd_mode == 1 && en == false) {
lv_textarea_clear_selection(ta);
lv_label_set_text(ext->label, ext->pwd_tmp);
lv_mem_free(ext->pwd_tmp);
ext->pwd_tmp = NULL;
}
ext->pwd_mode = en == false ? 0 : 1;
refr_cursor_area(ta);
}
/**
* Configure the text area to one line or back to normal
* @param ta pointer to a Text area object
* @param en true: one line, false: normal
*/
void lv_textarea_set_one_line(lv_obj_t * ta, bool en)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
if(ext->one_line == en) return;
lv_label_align_t old_align = lv_label_get_align(ext->label);
if(en) {
lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_BG);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TEXTAREA_PART_BG);
lv_style_int_t left = lv_obj_get_style_pad_left(ta, LV_TEXTAREA_PART_BG);
const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_BG);
lv_coord_t font_h = lv_font_get_line_height(font);
ext->one_line = 1;
lv_page_set_scrollable_fit2(ta, LV_FIT_MAX, LV_FIT_PARENT);
lv_obj_set_height(ta, font_h + top + bottom);
lv_label_set_long_mode(ext->label, LV_LABEL_LONG_EXPAND);
lv_obj_set_pos(lv_page_get_scrollable(ta), left, top);
}
else {
lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_BG);
lv_style_int_t left = lv_obj_get_style_pad_left(ta, LV_TEXTAREA_PART_BG);
ext->one_line = 0;
lv_page_set_scrollable_fit2(ta, LV_FIT_PARENT, LV_FIT_TIGHT);
lv_label_set_long_mode(ext->label, LV_LABEL_LONG_BREAK);
lv_obj_set_height(ta, LV_TEXTAREA_DEF_HEIGHT);
lv_obj_set_pos(lv_page_get_scrollable(ta), left, top);
}
/* `refr_cursor_area` is called at the end of lv_ta_set_text_align */
lv_textarea_set_text_align(ta, old_align);
}
/**
* Set the alignment of the text area.
* In one line mode the text can be scrolled only with `LV_LABEL_ALIGN_LEFT`.
* This function should be called if the size of text area changes.
* @param ta pointer to a text are object
* @param align the desired alignment from `lv_label_align_t`. (LV_LABEL_ALIGN_LEFT/CENTER/RIGHT)
*/
void lv_textarea_set_text_align(lv_obj_t * ta, lv_label_align_t align)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
lv_obj_t * label = lv_textarea_get_label(ta);
if(!ext->one_line) {
lv_label_set_align(label, align);
}
else {
/*Normal left align. Just let the text expand*/
if(align == LV_LABEL_ALIGN_LEFT) {
lv_label_set_long_mode(label, LV_LABEL_LONG_EXPAND);
lv_page_set_scrollable_fit2(ta, LV_FIT_MAX, LV_FIT_PARENT);
lv_label_set_align(label, align);
}
/*Else use fix label width equal to the Text area width*/
else {
lv_label_set_long_mode(label, LV_LABEL_LONG_CROP);
lv_obj_set_width(label, lv_page_get_width_fit(ta));
lv_label_set_align(label, align);
lv_page_set_scrollable_fit2(ta, LV_FIT_PARENT, LV_FIT_PARENT);
}
}
refr_cursor_area(ta);
}
/**
* Set a list of characters. Only these characters will be accepted by the text area
* @param ta pointer to Text Area
* @param list list of characters. Only the pointer is saved. E.g. "+-.,0123456789"
*/
void lv_textarea_set_accepted_chars(lv_obj_t * ta, const char * list)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
ext->accapted_chars = list;
}
/**
* Set max length of a Text Area.
* @param ta pointer to Text Area
* @param num the maximal number of characters can be added (`lv_textarea_set_text` ignores it)
*/
void lv_textarea_set_max_length(lv_obj_t * ta, uint32_t num)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
ext->max_length = num;
}
/**
* In `LV_EVENT_INSERT` the text which planned to be inserted can be replaced by an other text.
* It can be used to add automatic formatting to the text area.
* @param ta pointer to a text area.
* @param txt pointer to a new string to insert. If `""` no text will be added.
* The variable must be live after the `event_cb` exists. (Should be `global` or
* `static`)
*/
void lv_textarea_set_insert_replace(lv_obj_t * ta, const char * txt)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
(void)ta; /*Unused*/
ta_insert_replace = txt;
}
/**
* Enable/disable selection mode.
* @param ta pointer to a text area object
* @param en true or false to enable/disable selection mode
*/
void lv_textarea_set_text_sel(lv_obj_t * ta, bool en)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
#if LV_LABEL_TEXT_SEL
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
ext->text_sel_en = en;
if(!en) lv_textarea_clear_selection(ta);
#else
(void)ta; /*Unused*/
(void)en; /*Unused*/
#endif
}
/**
* Set how long show the password before changing it to '*'
* @param ta pointer to Text area
* @param time show time in milliseconds. 0: hide immediately.
*/
void lv_textarea_set_pwd_show_time(lv_obj_t * ta, uint16_t time)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
#if LV_USE_ANIMATION == 0
time = 0;
#endif
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
ext->pwd_show_time = time;
}
/**
* Set cursor blink animation time
* @param ta pointer to Text area
* @param time blink period. 0: disable blinking
*/
void lv_textarea_set_cursor_blink_time(lv_obj_t * ta, uint16_t time)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
#if LV_USE_ANIMATION == 0
time = 0;
#endif
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
ext->cursor.blink_time = time;
#if LV_USE_ANIMATION
if(ext->cursor.blink_time) {
/*Reset cursor blink animation*/
lv_anim_path_t path;
lv_anim_path_init(&path);
lv_anim_path_set_cb(&path, lv_anim_path_step);
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, ta);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)cursor_blink_anim);
lv_anim_set_time(&a, ext->cursor.blink_time);
lv_anim_set_playback_time(&a, ext->cursor.blink_time);
lv_anim_set_values(&a, 1, 0);
lv_anim_set_path(&a, &path);
lv_anim_start(&a);
}
else {
lv_anim_del(ta, (lv_anim_exec_xcb_t)cursor_blink_anim);
ext->cursor.state = 1;
}
#else
ext->cursor.state = 1;
#endif
}
/*=====================
* Getter functions
*====================*/
/**
* Get the text of a text area. In password mode it gives the real text (not '*'s).
* @param ta pointer to a text area object
* @return pointer to the text
*/
const char * lv_textarea_get_text(const lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
const char * txt;
if(ext->pwd_mode == 0) {
txt = lv_label_get_text(ext->label);
}
else {
txt = ext->pwd_tmp;
}
return txt;
}
/**
* Get the placeholder_txt text of a text area
* @param ta pointer to a text area object
* @return pointer to the text
*/
const char * lv_textarea_get_placeholder_text(lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
if(ext->placeholder_txt) return ext->placeholder_txt;
else return "";
}
/**
* Get the label of a text area
* @param ta pointer to a text area object
* @return pointer to the label object
*/
lv_obj_t * lv_textarea_get_label(const lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
return ext->label;
}
/**
* Get the current cursor position in character index
* @param ta pointer to a text area object
* @return the cursor position
*/
uint32_t lv_textarea_get_cursor_pos(const lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
return ext->cursor.pos;
}
/**
* Get whether the cursor is hidden or not
* @param ta pointer to a text area object
* @return true: the cursor is hidden
*/
bool lv_textarea_get_cursor_hidden(const lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
return ext->cursor.hidden ? true : false;
}
/**
* Get whether the cursor click positioning is enabled or not.
* @param ta pointer to a text area object
* @return true: enable click positions; false: disable
*/
bool lv_textarea_get_cursor_click_pos(lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
return ext->cursor.click_pos ? true : false;
}
/**
* Get the password mode attribute
* @param ta pointer to a text area object
* @return true: password mode is enabled, false: disabled
*/
bool lv_textarea_get_pwd_mode(const lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
return ext->pwd_mode == 0 ? false : true;
}
/**
* Get the one line configuration attribute
* @param ta pointer to a text area object
* @return true: one line configuration is enabled, false: disabled
*/
bool lv_textarea_get_one_line(const lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
return ext->one_line == 0 ? false : true;
}
/**
* Get a list of accepted characters.
* @param ta pointer to Text Area
* @return list of accented characters.
*/
const char * lv_textarea_get_accepted_chars(lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
return ext->accapted_chars;
}
/**
* Set max length of a Text Area.
* @param ta pointer to Text Area
* @return the maximal number of characters to be add
*/
uint32_t lv_textarea_get_max_length(lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
return ext->max_length;
}
/**
* Find whether text is selected or not.
* @param ta Text area object
* @return whether text is selected or not
*/
bool lv_textarea_text_is_selected(const lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
#if LV_LABEL_TEXT_SEL
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
if((lv_label_get_text_sel_start(ext->label) == LV_DRAW_LABEL_NO_TXT_SEL ||
lv_label_get_text_sel_end(ext->label) == LV_DRAW_LABEL_NO_TXT_SEL)) {
return true;
}
else {
return false;
}
#else
(void)ta; /*Unused*/
return false;
#endif
}
/**
* Find whether selection mode is enabled.
* @param ta pointer to a text area object
* @return true: selection mode is enabled, false: disabled
*/
bool lv_textarea_get_text_sel_en(lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
#if LV_LABEL_TEXT_SEL
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
return ext->text_sel_en;
#else
(void)ta; /*Unused*/
return false;
#endif
}
/**
* Set how long show the password before changing it to '*'
* @param ta pointer to Text area
* @return show time in milliseconds. 0: hide immediately.
*/
uint16_t lv_textarea_get_pwd_show_time(lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
return ext->pwd_show_time;
}
/**
* Set cursor blink animation time
* @param ta pointer to Text area
* @return time blink period. 0: disable blinking
*/
uint16_t lv_textarea_get_cursor_blink_time(lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
return ext->cursor.blink_time;
}
/*=====================
* Other functions
*====================*/
/**
* Clear the selection on the text area.
* @param ta Text area object
*/
void lv_textarea_clear_selection(lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
#if LV_LABEL_TEXT_SEL
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
if(lv_label_get_text_sel_start(ext->label) != LV_DRAW_LABEL_NO_TXT_SEL ||
lv_label_get_text_sel_end(ext->label) != LV_DRAW_LABEL_NO_TXT_SEL) {
lv_label_set_text_sel_start(ext->label, LV_DRAW_LABEL_NO_TXT_SEL);
lv_label_set_text_sel_end(ext->label, LV_DRAW_LABEL_NO_TXT_SEL);
}
#else
(void)ta; /*Unused*/
#endif
}
/**
* Move the cursor one character right
* @param ta pointer to a text area object
*/
void lv_textarea_cursor_right(lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
uint32_t cp = lv_textarea_get_cursor_pos(ta);
cp++;
lv_textarea_set_cursor_pos(ta, cp);
}
/**
* Move the cursor one character left
* @param ta pointer to a text area object
*/
void lv_textarea_cursor_left(lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
uint32_t cp = lv_textarea_get_cursor_pos(ta);
if(cp > 0) {
cp--;
lv_textarea_set_cursor_pos(ta, cp);
}
}
/**
* Move the cursor one line down
* @param ta pointer to a text area object
*/
void lv_textarea_cursor_down(lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
lv_point_t pos;
/*Get the position of the current letter*/
lv_label_get_letter_pos(ext->label, lv_textarea_get_cursor_pos(ta), &pos);
/*Increment the y with one line and keep the valid x*/
lv_style_int_t line_space = lv_obj_get_style_text_line_space(ta, LV_TEXTAREA_PART_BG);
const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_BG);
lv_coord_t font_h = lv_font_get_line_height(font);
pos.y += font_h + line_space + 1;
pos.x = ext->cursor.valid_x;
/*Do not go below the last line*/
if(pos.y < lv_obj_get_height(ext->label)) {
/*Get the letter index on the new cursor position and set it*/
uint32_t new_cur_pos = lv_label_get_letter_on(ext->label, &pos);
lv_coord_t cur_valid_x_tmp = ext->cursor.valid_x; /*Cursor position set overwrites the valid position */
lv_textarea_set_cursor_pos(ta, new_cur_pos);
ext->cursor.valid_x = cur_valid_x_tmp;
}
}
/**
* Move the cursor one line up
* @param ta pointer to a text area object
*/
void lv_textarea_cursor_up(lv_obj_t * ta)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
lv_point_t pos;
/*Get the position of the current letter*/
lv_label_get_letter_pos(ext->label, lv_textarea_get_cursor_pos(ta), &pos);
/*Decrement the y with one line and keep the valid x*/
lv_style_int_t line_space = lv_obj_get_style_text_line_space(ta, LV_TEXTAREA_PART_BG);
const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_BG);
lv_coord_t font_h = lv_font_get_line_height(font);
pos.y -= font_h + line_space - 1;
pos.x = ext->cursor.valid_x;
/*Get the letter index on the new cursor position and set it*/
uint32_t new_cur_pos = lv_label_get_letter_on(ext->label, &pos);
lv_coord_t cur_valid_x_tmp = ext->cursor.valid_x; /*Cursor position set overwrites the valid position */
lv_textarea_set_cursor_pos(ta, new_cur_pos);
ext->cursor.valid_x = cur_valid_x_tmp;
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the text areas
* @param ta pointer to an object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW_MAIN: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_textarea_design(lv_obj_t * ta, const lv_area_t * clip_area, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
/*Return false if the object is not covers the mask_p area*/
return ancestor_design(ta, clip_area, mode);
}
else if(mode == LV_DESIGN_DRAW_MAIN) {
/*Draw the object*/
ancestor_design(ta, clip_area, mode);
}
else if(mode == LV_DESIGN_DRAW_POST) {
ancestor_design(ta, clip_area, mode);
}
return LV_DESIGN_RES_OK;
}
/**
* An extended scrollable design of the page. Calls the normal design function and draws a cursor.
* @param scrl pointer to the scrollable part of the Text area
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW_MAIN: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @return return true/false, depends on 'mode'
*/
static lv_design_res_t lv_textarea_scrollable_design(lv_obj_t * scrl, const lv_area_t * clip_area,
lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
/*Return false if the object is not covers the mask_p area*/
return scrl_design(scrl, clip_area, mode);
}
else if(mode == LV_DESIGN_DRAW_MAIN) {
/*Draw the object*/
scrl_design(scrl, clip_area, mode);
}
else if(mode == LV_DESIGN_DRAW_POST) {
scrl_design(scrl, clip_area, mode);
lv_obj_t * ta = lv_obj_get_parent(scrl);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
const char * txt = lv_label_get_text(ext->label);
/*Draw the place holder*/
if(txt[0] == '\0' && ext->placeholder_txt && ext->placeholder_txt[0] != 0) {
lv_draw_label_dsc_t ph_dsc;
lv_draw_label_dsc_init(&ph_dsc);
lv_obj_init_draw_label_dsc(ta, LV_TEXTAREA_PART_PLACEHOLDER, &ph_dsc);
switch(lv_label_get_align(ext->label)) {
case LV_LABEL_ALIGN_CENTER:
ph_dsc.flag |= LV_TXT_FLAG_CENTER;
break;
case LV_LABEL_ALIGN_RIGHT:
ph_dsc.flag |= LV_TXT_FLAG_RIGHT;
break;
default:
break;
}
if(ext->one_line) ph_dsc.flag |= LV_TXT_FLAG_EXPAND;
lv_draw_label(&scrl->coords, clip_area, &ph_dsc, ext->placeholder_txt, NULL);
}
/*Draw the cursor*/
if(ext->cursor.hidden || ext->cursor.state == 0) {
return LV_DESIGN_RES_OK; /*The cursor is not visible now*/
}
lv_draw_rect_dsc_t cur_dsc;
lv_draw_rect_dsc_init(&cur_dsc);
lv_obj_init_draw_rect_dsc(ta, LV_TEXTAREA_PART_CURSOR, &cur_dsc);
/*Draw he cursor according to the type*/
lv_area_t cur_area;
lv_area_copy(&cur_area, &ext->cursor.area);
cur_area.x1 += ext->label->coords.x1;
cur_area.y1 += ext->label->coords.y1;
cur_area.x2 += ext->label->coords.x1;
cur_area.y2 += ext->label->coords.y1;
lv_draw_rect(&cur_area, clip_area, &cur_dsc);
char letter_buf[8] = {0};
_lv_memcpy(letter_buf, &txt[ext->cursor.txt_byte_pos], _lv_txt_encoded_size(&txt[ext->cursor.txt_byte_pos]));
if(cur_dsc.bg_opa == LV_OPA_COVER) {
lv_style_int_t left = lv_obj_get_style_pad_left(ta, LV_TEXTAREA_PART_CURSOR);
lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_CURSOR);
cur_area.x1 += left;
cur_area.y1 += top;
lv_draw_label_dsc_t cur_label_dsc;
lv_draw_label_dsc_init(&cur_label_dsc);
lv_obj_init_draw_label_dsc(ta, LV_TEXTAREA_PART_CURSOR, &cur_label_dsc);
lv_draw_label(&cur_area, clip_area, &cur_label_dsc, letter_buf, NULL);
}
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the text area
* @param ta pointer to a text area object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_textarea_signal(lv_obj_t * ta, lv_signal_t sign, void * param)
{
lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_textarea_get_style(ta, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(ta, sign, param);
}
else if(sign == LV_SIGNAL_GET_STATE_DSC) {
return ancestor_signal(ta, sign, param);
}
/* Include the ancient signal function */
res = ancestor_signal(ta, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
if(sign == LV_SIGNAL_CLEANUP) {
if(ext->pwd_tmp != NULL) lv_mem_free(ext->pwd_tmp);
if(ext->placeholder_txt != NULL) lv_mem_free(ext->placeholder_txt);
ext->pwd_tmp = NULL;
ext->placeholder_txt = NULL;
lv_obj_clean_style_list(ta, LV_TEXTAREA_PART_CURSOR);
lv_obj_clean_style_list(ta, LV_TEXTAREA_PART_PLACEHOLDER);
/* (The created label will be deleted automatically) */
}
else if(sign == LV_SIGNAL_STYLE_CHG) {
if(ext->label) {
if(ext->one_line) {
lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_BG);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TEXTAREA_PART_BG);
const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_BG);
/*In one line mode refresh the Text Area height because 'vpad' can modify it*/
lv_coord_t font_h = lv_font_get_line_height(font);
lv_obj_set_height(ext->label, font_h);
lv_obj_set_height(ta, font_h + top + bottom);
}
else {
/*In not one line mode refresh the Label width because 'hpad' can modify it*/
lv_obj_set_width(ext->label, lv_page_get_width_fit(ta));
lv_obj_set_pos(ext->label, 0, 0); /*Be sure the Label is in the correct position*/
}
lv_label_set_text(ext->label, NULL);
refr_cursor_area(ta);
}
}
else if(sign == LV_SIGNAL_COORD_CHG) {
/*Set the label width according to the text area width*/
if(ext->label) {
if(lv_obj_get_width(ta) != lv_area_get_width(param) || lv_obj_get_height(ta) != lv_area_get_height(param)) {
lv_obj_set_width(ext->label, lv_page_get_width_fit(ta));
lv_obj_set_pos(ext->label, 0, 0);
lv_label_set_text(ext->label, NULL); /*Refresh the label*/
refr_cursor_area(ta);
}
}
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
uint32_t c = *((uint32_t *)param); /*uint32_t because can be UTF-8*/
if(c == LV_KEY_RIGHT)
lv_textarea_cursor_right(ta);
else if(c == LV_KEY_LEFT)
lv_textarea_cursor_left(ta);
else if(c == LV_KEY_UP)
lv_textarea_cursor_up(ta);
else if(c == LV_KEY_DOWN)
lv_textarea_cursor_down(ta);
else if(c == LV_KEY_BACKSPACE)
lv_textarea_del_char(ta);
else if(c == LV_KEY_DEL)
lv_textarea_del_char_forward(ta);
else if(c == LV_KEY_HOME)
lv_textarea_set_cursor_pos(ta, 0);
else if(c == LV_KEY_END)
lv_textarea_set_cursor_pos(ta, LV_TEXTAREA_CURSOR_LAST);
else {
lv_textarea_add_char(ta, c);
}
#endif
}
else if(sign == LV_SIGNAL_GET_EDITABLE) {
#if LV_USE_GROUP
bool * editable = (bool *)param;
*editable = true;
#endif
}
else if(sign == LV_SIGNAL_PRESSED || sign == LV_SIGNAL_PRESSING || sign == LV_SIGNAL_PRESS_LOST ||
sign == LV_SIGNAL_RELEASED) {
update_cursor_position_on_click(ta, sign, (lv_indev_t *)param);
}
return res;
}
/**
* Signal function of the scrollable part of the text area
* @param scrl pointer to scrollable part of a text area object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_textarea_scrollable_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
{
lv_res_t res;
/* Include the ancient signal function */
res = scrl_signal(scrl, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, "");
lv_obj_t * ta = lv_obj_get_parent(scrl);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
/*Set ext. size because the cursor might be out of this object*/
lv_style_int_t line_space = lv_obj_get_style_text_line_space(ta, LV_TEXTAREA_PART_BG);
const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_BG);
lv_coord_t font_h = lv_font_get_line_height(font);
scrl->ext_draw_pad = LV_MATH_MAX(scrl->ext_draw_pad, line_space + font_h);
}
else if(sign == LV_SIGNAL_COORD_CHG) {
/*Set the label width according to the text area width*/
if(ext->label) {
if(lv_obj_get_width(scrl) != lv_area_get_width(param) ||
lv_obj_get_height(scrl) != lv_area_get_height(param)) {
lv_obj_set_width(ext->label, lv_page_get_width_fit(ta));
lv_obj_set_pos(ext->label, 0, 0);
lv_label_set_text(ext->label, NULL); /*Refresh the label*/
refr_cursor_area(ta);
}
}
}
else if(sign == LV_SIGNAL_PRESSING || sign == LV_SIGNAL_PRESSED || sign == LV_SIGNAL_PRESS_LOST ||
sign == LV_SIGNAL_RELEASED) {
update_cursor_position_on_click(ta, sign, (lv_indev_t *)param);
}
return res;
}
/**
* Get the style descriptor of a part of the object
* @param page pointer the object
* @param part the part from `lv_textarea_part_t`. (LV_TEXTAREA_PART_...)
* @return pointer to the style descriptor of the specified part
*/
static lv_style_list_t * lv_textarea_get_style(lv_obj_t * ta, uint8_t part)
{
LV_ASSERT_OBJ(ta, LV_OBJX_NAME);
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
lv_style_list_t * style_dsc_p;
switch(part) {
case LV_TEXTAREA_PART_BG:
style_dsc_p = &ta->style_list;
break;
case LV_TEXTAREA_PART_SCROLLBAR:
style_dsc_p = &ext->page.scrlbar.style;
break;
case LV_TEXTAREA_PART_CURSOR:
style_dsc_p = &ext->cursor.style;
break;
#if LV_USE_ANIMATION
case LV_TEXTAREA_PART_EDGE_FLASH:
style_dsc_p = &ext->page.edge_flash.style;
break;
#endif
case LV_TEXTAREA_PART_PLACEHOLDER:
style_dsc_p = &ext->style_placeholder;
break;
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
#if LV_USE_ANIMATION
/**
* Called to blink the cursor
* @param ta pointer to a text area
* @param hide 1: hide the cursor, 0: show it
*/
static void cursor_blink_anim(lv_obj_t * ta, lv_anim_value_t show)
{
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
if(show != ext->cursor.state) {
ext->cursor.state = show == 0 ? 0 : 1;
if(ext->cursor.hidden == 0) {
lv_area_t area_tmp;
lv_area_copy(&area_tmp, &ext->cursor.area);
area_tmp.x1 += ext->label->coords.x1;
area_tmp.y1 += ext->label->coords.y1;
area_tmp.x2 += ext->label->coords.x1;
area_tmp.y2 += ext->label->coords.y1;
lv_obj_invalidate_area(ta, &area_tmp);
}
}
}
/**
* Dummy function to animate char hiding in pwd mode.
* Does nothing, but a function is required in car hiding anim.
* (pwd_char_hider callback do the real job)
* @param ta unused
* @param x unused
*/
static void pwd_char_hider_anim(lv_obj_t * ta, lv_anim_value_t x)
{
(void)ta;
(void)x;
}
/**
* Call when an animation is ready to convert all characters to '*'
* @param a pointer to the animation
*/
static void pwd_char_hider_anim_ready(lv_anim_t * a)
{
lv_obj_t * ta = a->var;
pwd_char_hider(ta);
}
#endif
/**
* Hide all characters (convert them to '*')
* @param ta: pointer to text area object
*/
static void pwd_char_hider(lv_obj_t * ta)
{
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
if(ext->pwd_mode != 0) {
char * txt = lv_label_get_text(ext->label);
int32_t enc_len = _lv_txt_get_encoded_length(txt);
if(enc_len == 0) return;
/*If the textarea's font has "bullet" character use it else fallback to "*"*/
const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_BG);
lv_font_glyph_dsc_t g;
bool has_bullet;
has_bullet = lv_font_get_glyph_dsc(font, &g, LV_TEXTAREA_PWD_BULLET_UNICODE, 0);
const char * bullet;
if(has_bullet) bullet = LV_SYMBOL_BULLET;
else bullet = "*";
size_t bullet_len = strlen(bullet);
char * txt_tmp = _lv_mem_buf_get(enc_len * bullet_len + 1);
int32_t i;
for(i = 0; i < enc_len; i++) {
_lv_memcpy(&txt_tmp[i * bullet_len], bullet, bullet_len);
}
txt_tmp[i * bullet_len] = '\0';
lv_label_set_text(ext->label, txt_tmp);
_lv_mem_buf_release(txt_tmp);
}
}
/**
* Test an unicode character if it is accepted or not. Checks max length and accepted char list.
* @param ta pointer to a test area object
* @param c an unicode character
* @return true: accepted; false: rejected
*/
static bool char_is_accepted(lv_obj_t * ta, uint32_t c)
{
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
/*If no restriction accept it*/
if(ext->accapted_chars == NULL && ext->max_length == 0) return true;
/*Too many characters?*/
if(ext->max_length > 0 && _lv_txt_get_encoded_length(lv_textarea_get_text(ta)) >= ext->max_length) {
return false;
}
/*Accepted character?*/
if(ext->accapted_chars) {
uint32_t i = 0;
while(ext->accapted_chars[i] != '\0') {
uint32_t a = _lv_txt_encoded_next(ext->accapted_chars, &i);
if(a == c) return true; /*Accepted*/
}
return false; /*The character wasn't in the list*/
}
else {
return true; /*If the accepted char list in not specified the accept the character*/
}
}
static void refr_cursor_area(lv_obj_t * ta)
{
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
const lv_font_t * font = lv_obj_get_style_text_font(ta, LV_TEXTAREA_PART_BG);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(ta, LV_TEXTAREA_PART_BG);
uint32_t cur_pos = lv_textarea_get_cursor_pos(ta);
const char * txt = lv_label_get_text(ext->label);
uint32_t byte_pos;
byte_pos = _lv_txt_encoded_get_byte_id(txt, cur_pos);
uint32_t letter = _lv_txt_encoded_next(&txt[byte_pos], NULL);
lv_coord_t letter_h = lv_font_get_line_height(font);
/*Set letter_w (set not 0 on non printable but valid chars)*/
lv_coord_t letter_w;
if(letter == '\0' || letter == '\n' || letter == '\r') {
letter_w = lv_font_get_glyph_width(font, ' ', '\0');
}
else {
/*`letter_next` parameter is '\0' to ignore kerning*/
letter_w = lv_font_get_glyph_width(font, letter, '\0');
}
lv_point_t letter_pos;
lv_label_get_letter_pos(ext->label, cur_pos, &letter_pos);
/*If the cursor is out of the text (most right) draw it to the next line*/
if(letter_pos.x + ext->label->coords.x1 + letter_w > ext->label->coords.x2 && ext->one_line == 0 &&
lv_label_get_align(ext->label) != LV_LABEL_ALIGN_RIGHT) {
letter_pos.x = 0;
letter_pos.y += letter_h + line_space;
if(letter != '\0') {
byte_pos += _lv_txt_encoded_size(&txt[byte_pos]);
letter = _lv_txt_encoded_next(&txt[byte_pos], NULL);
}
if(letter == '\0' || letter == '\n' || letter == '\r') {
letter_w = lv_font_get_glyph_width(font, ' ', '\0');
}
else {
letter_w = lv_font_get_glyph_width(font, letter, '\0');
}
}
/*Save the byte position. It is required to draw `LV_CURSOR_BLOCK`*/
ext->cursor.txt_byte_pos = byte_pos;
/*Calculate the cursor according to its type*/
lv_style_int_t top = lv_obj_get_style_pad_top(ta, LV_TEXTAREA_PART_CURSOR);
lv_style_int_t bottom = lv_obj_get_style_pad_bottom(ta, LV_TEXTAREA_PART_CURSOR);
lv_style_int_t left = lv_obj_get_style_pad_left(ta, LV_TEXTAREA_PART_CURSOR);
lv_style_int_t right = lv_obj_get_style_pad_right(ta, LV_TEXTAREA_PART_CURSOR);
lv_area_t cur_area;
cur_area.x1 = letter_pos.x - left;
cur_area.y1 = letter_pos.y - top;
cur_area.x2 = letter_pos.x + right + letter_w;
cur_area.y2 = letter_pos.y + bottom + letter_h;
/*Save the new area*/
lv_area_t area_tmp;
lv_area_copy(&area_tmp, &ext->cursor.area);
area_tmp.x1 += ext->label->coords.x1;
area_tmp.y1 += ext->label->coords.y1;
area_tmp.x2 += ext->label->coords.x1;
area_tmp.y2 += ext->label->coords.y1;
lv_obj_invalidate_area(ta, &area_tmp);
lv_area_copy(&ext->cursor.area, &cur_area);
lv_area_copy(&area_tmp, &ext->cursor.area);
area_tmp.x1 += ext->label->coords.x1;
area_tmp.y1 += ext->label->coords.y1;
area_tmp.x2 += ext->label->coords.x1;
area_tmp.y2 += ext->label->coords.y1;
lv_obj_invalidate_area(ta, &area_tmp);
}
static void update_cursor_position_on_click(lv_obj_t * ta, lv_signal_t sign, lv_indev_t * click_source)
{
if(click_source == NULL) return;
lv_textarea_ext_t * ext = lv_obj_get_ext_attr(ta);
if(ext->cursor.click_pos == 0) return;
if(ext->cursor.hidden) return;
if(lv_indev_get_type(click_source) == LV_INDEV_TYPE_KEYPAD ||
lv_indev_get_type(click_source) == LV_INDEV_TYPE_ENCODER) {
return;
}
lv_area_t label_coords;
lv_obj_get_coords(ext->label, &label_coords);
lv_point_t point_act, vect_act;
lv_indev_get_point(click_source, &point_act);
lv_indev_get_vect(click_source, &vect_act);
if(point_act.x < 0 || point_act.y < 0) return; /*Ignore event from keypad*/
lv_point_t rel_pos;
rel_pos.x = point_act.x - label_coords.x1;
rel_pos.y = point_act.y - label_coords.y1;
lv_coord_t label_width = lv_obj_get_width(ext->label);
uint16_t char_id_at_click;
#if LV_LABEL_TEXT_SEL
lv_label_ext_t * ext_label = lv_obj_get_ext_attr(ext->label);
bool click_outside_label;
/*Check if the click happened on the left side of the area outside the label*/
if(rel_pos.x < 0) {
char_id_at_click = 0;
click_outside_label = true;
}
/*Check if the click happened on the right side of the area outside the label*/
else if(rel_pos.x >= label_width) {
char_id_at_click = LV_TEXTAREA_CURSOR_LAST;
click_outside_label = true;
}
else {
char_id_at_click = lv_label_get_letter_on(ext->label, &rel_pos);
click_outside_label = !lv_label_is_char_under_pos(ext->label, &rel_pos);
}
if(ext->text_sel_en) {
if(!ext->text_sel_in_prog && !click_outside_label && sign == LV_SIGNAL_PRESSED) {
/*Input device just went down. Store the selection start position*/
ext->sel_start = char_id_at_click;
ext->sel_end = LV_LABEL_TEXT_SEL_OFF;
ext->text_sel_in_prog = 1;
lv_obj_set_drag(lv_page_get_scrollable(ta), false);
}
else if(ext->text_sel_in_prog && sign == LV_SIGNAL_PRESSING) {
/*Input device may be moving. Store the end position */
ext->sel_end = char_id_at_click;
}
else if(ext->text_sel_in_prog && (sign == LV_SIGNAL_PRESS_LOST || sign == LV_SIGNAL_RELEASED)) {
/*Input device is released. Check if anything was selected.*/
lv_obj_set_drag(lv_page_get_scrollable(ta), true);
}
}
if(ext->text_sel_in_prog || sign == LV_SIGNAL_PRESSED) lv_textarea_set_cursor_pos(ta, char_id_at_click);
if(ext->text_sel_in_prog) {
/*If the selected area has changed then update the real values and*/
/*Invalidate the text area.*/
if(ext->sel_start > ext->sel_end) {
if(ext_label->sel_start != ext->sel_end || ext_label->sel_end != ext->sel_start) {
ext_label->sel_start = ext->sel_end;
ext_label->sel_end = ext->sel_start;
lv_obj_invalidate(ta);
}
}
else if(ext->sel_start < ext->sel_end) {
if(ext_label->sel_start != ext->sel_start || ext_label->sel_end != ext->sel_end) {
ext_label->sel_start = ext->sel_start;
ext_label->sel_end = ext->sel_end;
lv_obj_invalidate(ta);
}
}
else {
if(ext_label->sel_start != LV_DRAW_LABEL_NO_TXT_SEL || ext_label->sel_end != LV_DRAW_LABEL_NO_TXT_SEL) {
ext_label->sel_start = LV_DRAW_LABEL_NO_TXT_SEL;
ext_label->sel_end = LV_DRAW_LABEL_NO_TXT_SEL;
lv_obj_invalidate(ta);
}
}
/*Finish selection if necessary */
if(sign == LV_SIGNAL_PRESS_LOST || sign == LV_SIGNAL_RELEASED) {
ext->text_sel_in_prog = 0;
}
}
#else
/*Check if the click happened on the left side of the area outside the label*/
if(rel_pos.x < 0) {
char_id_at_click = 0;
}
/*Check if the click happened on the right side of the area outside the label*/
else if(rel_pos.x >= label_width) {
char_id_at_click = LV_TEXTAREA_CURSOR_LAST;
}
else {
char_id_at_click = lv_label_get_letter_on(ext->label, &rel_pos);
}
if(sign == LV_SIGNAL_PRESSED) lv_textarea_set_cursor_pos(ta, char_id_at_click);
#endif
}
static lv_res_t insert_handler(lv_obj_t * ta, const char * txt)
{
ta_insert_replace = NULL;
lv_event_send(ta, LV_EVENT_INSERT, txt);
if(ta_insert_replace) {
if(ta_insert_replace[0] == '\0') return LV_RES_INV; /*Drop this text*/
/*Add the replaced text directly it's different from the original*/
if(strcmp(ta_insert_replace, txt)) {
lv_textarea_add_text(ta, ta_insert_replace);
return LV_RES_INV;
}
}
return LV_RES_OK;
}
#endif
|
train_000.parquet/976
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_textarea.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 62128,
"token_count": 25063
}
|
/**
* @file lv_imgbtn.h
*
*/
#ifndef LV_IMGBTN_H
#define LV_IMGBTN_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_IMGBTN != 0
/*Testing of dependencies*/
#if LV_USE_BTN == 0
#error "lv_imgbtn: lv_btn is required. Enable it in lv_conf.h (LV_USE_BTN 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "lv_btn.h"
#include "../lv_draw/lv_draw_img.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of image button*/
typedef struct {
lv_btn_ext_t btn; /*Ext. of ancestor*/
/*New data for this type */
const void * img_src_mid[_LV_BTN_STATE_LAST]; /*Store center images to each state*/
#if LV_IMGBTN_TILED
const void * img_src_left[_LV_BTN_STATE_LAST]; /*Store left side images to each state*/
const void * img_src_right[_LV_BTN_STATE_LAST]; /*Store right side images to each state*/
#endif
lv_img_cf_t act_cf; /*Color format of the currently active image*/
uint8_t tiled : 1; /*1: the middle src will be repeated to fill the user defined width*/
} lv_imgbtn_ext_t;
/*Parts of the image button*/
enum {
LV_IMGBTN_PART_MAIN = LV_BTN_PART_MAIN,
};
typedef uint8_t lv_imgbtn_part_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a image button objects
* @param par pointer to an object, it will be the parent of the new image button
* @param copy pointer to a image button object, if not NULL then the new object will be copied from
* it
* @return pointer to the created image button
*/
lv_obj_t * lv_imgbtn_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
*=====================*/
/*=====================
* Setter functions
*====================*/
/**
* Set images for a state of the image button
* @param imgbtn pointer to an image button object
* @param state for which state set the new image (from `lv_btn_state_t`) `
* @param src pointer to an image source (a C array or path to a file)
*/
void lv_imgbtn_set_src(lv_obj_t * imgbtn, lv_btn_state_t state, const void * src);
#if LV_IMGBTN_TILED
/**
* Set images for a state of the image button
* @param imgbtn pointer to an image button object
* @param state for which state set the new image (from `lv_btn_state_t`) `
* @param src_left pointer to an image source for the left side of the button (a C array or path to
* a file)
* @param src_mid pointer to an image source for the middle of the button (ideally 1px wide) (a C
* array or path to a file)
* @param src_right pointer to an image source for the right side of the button (a C array or path
* to a file)
*/
void lv_imgbtn_set_src_tiled(lv_obj_t * imgbtn, lv_btn_state_t state, const void * src_left, const void * src_mid,
const void * src_right);
#endif
/**
* Enable the toggled states. On release the button will change from/to toggled state.
* @param imgbtn pointer to an image button object
* @param tgl true: enable toggled states, false: disable
*/
static inline void lv_imgbtn_set_checkable(lv_obj_t * imgbtn, bool tgl)
{
lv_btn_set_checkable(imgbtn, tgl);
}
/**
* Set the state of the image button
* @param imgbtn pointer to an image button object
* @param state the new state of the button (from lv_btn_state_t enum)
*/
static inline void lv_imgbtn_set_state(lv_obj_t * imgbtn, lv_btn_state_t state)
{
lv_btn_set_state(imgbtn, state);
}
/**
* Toggle the state of the image button (ON->OFF, OFF->ON)
* @param imgbtn pointer to a image button object
*/
static inline void lv_imgbtn_toggle(lv_obj_t * imgbtn)
{
lv_btn_toggle(imgbtn);
}
/*=====================
* Getter functions
*====================*/
#if LV_IMGBTN_TILED == 0
/**
* Get the images in a given state
* @param imgbtn pointer to an image button object
* @param state the state where to get the image (from `lv_btn_state_t`) `
* @return pointer to an image source (a C array or path to a file)
*/
const void * lv_imgbtn_get_src(lv_obj_t * imgbtn, lv_btn_state_t state);
#else
/**
* Get the left image in a given state
* @param imgbtn pointer to an image button object
* @param state the state where to get the image (from `lv_btn_state_t`) `
* @return pointer to the left image source (a C array or path to a file)
*/
const void * lv_imgbtn_get_src_left(lv_obj_t * imgbtn, lv_btn_state_t state);
/**
* Get the middle image in a given state
* @param imgbtn pointer to an image button object
* @param state the state where to get the image (from `lv_btn_state_t`) `
* @return pointer to the middle image source (a C array or path to a file)
*/
const void * lv_imgbtn_get_src_middle(lv_obj_t * imgbtn, lv_btn_state_t state);
/**
* Get the right image in a given state
* @param imgbtn pointer to an image button object
* @param state the state where to get the image (from `lv_btn_state_t`) `
* @return pointer to the left image source (a C array or path to a file)
*/
const void * lv_imgbtn_get_src_right(lv_obj_t * imgbtn, lv_btn_state_t state);
#endif
/**
* Get the current state of the image button
* @param imgbtn pointer to a image button object
* @return the state of the button (from lv_btn_state_t enum)
*/
static inline lv_btn_state_t lv_imgbtn_get_state(const lv_obj_t * imgbtn)
{
return lv_btn_get_state(imgbtn);
}
/**
* Get the toggle enable attribute of the image button
* @param imgbtn pointer to a image button object
* @return true: toggle enabled, false: disabled
*/
static inline bool lv_imgbtn_get_checkable(const lv_obj_t * imgbtn)
{
return lv_btn_get_checkable(imgbtn);
}
/*=====================
* Other functions
*====================*/
/**********************
* MACROS
**********************/
#endif /*LV_USE_IMGBTN*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_IMGBTN_H*/
|
train_000.parquet/977
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_imgbtn.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 5950,
"token_count": 2161
}
|
/**
* @file lv_list.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_list.h"
#if LV_USE_LIST != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_group.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_anim.h"
#include "../lv_misc/lv_math.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_list"
#define LV_LIST_LAYOUT_DEF LV_LAYOUT_COLUMN_MID
#if LV_USE_ANIMATION == 0
#undef LV_LIST_DEF_ANIM_TIME
#define LV_LIST_DEF_ANIM_TIME 0
#endif
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param);
static lv_res_t lv_list_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param);
static lv_style_list_t * lv_list_get_style(lv_obj_t * list, uint8_t part);
static bool lv_list_is_list_btn(lv_obj_t * list_btn);
static bool lv_list_is_list_img(lv_obj_t * list_btn);
static bool lv_list_is_list_label(lv_obj_t * list_btn);
/**********************
* STATIC VARIABLES
**********************/
#if LV_USE_IMG
static lv_signal_cb_t img_signal;
#endif
static lv_signal_cb_t label_signal;
static lv_signal_cb_t ancestor_page_signal;
static lv_signal_cb_t ancestor_btn_signal;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a list objects
* @param par pointer to an object, it will be the parent of the new list
* @param copy pointer to a list object, if not NULL then the new object will be copied from it
* @return pointer to the created list
*/
lv_obj_t * lv_list_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("list create started");
/*Create the ancestor basic object*/
lv_obj_t * list = lv_page_create(par, copy);
LV_ASSERT_MEM(list);
if(list == NULL) return NULL;
if(ancestor_page_signal == NULL) ancestor_page_signal = lv_obj_get_signal_cb(list);
lv_list_ext_t * ext = lv_obj_allocate_ext_attr(list, sizeof(lv_list_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(list);
return NULL;
}
#if LV_USE_GROUP
ext->last_sel_btn = NULL;
#endif
ext->act_sel_btn = NULL;
lv_obj_set_signal_cb(list, lv_list_signal);
/*Init the new list object*/
if(copy == NULL) {
lv_page_set_anim_time(list, LV_LIST_DEF_ANIM_TIME);
lv_page_set_scrollable_fit2(list, LV_FIT_PARENT, LV_FIT_TIGHT);
lv_obj_set_size(list, 2 * LV_DPI, 3 * LV_DPI);
lv_page_set_scrl_layout(list, LV_LIST_LAYOUT_DEF);
lv_list_set_scrollbar_mode(list, LV_SCROLLBAR_MODE_DRAG);
lv_theme_apply(list, LV_THEME_LIST);
}
else {
lv_obj_t * copy_btn = lv_list_get_next_btn(copy, NULL);
while(copy_btn) {
const void * img_src = NULL;
#if LV_USE_IMG
lv_obj_t * copy_img = lv_list_get_btn_img(copy_btn);
if(copy_img) img_src = lv_img_get_src(copy_img);
#endif
lv_list_add_btn(list, img_src, lv_list_get_btn_text(copy_btn));
copy_btn = lv_list_get_next_btn(copy, copy_btn);
}
/*Refresh the style with new signal function*/
lv_obj_refresh_style(list, LV_STYLE_PROP_ALL);
}
LV_LOG_INFO("list created");
return list;
}
/**
* Delete all children of the scrl object, without deleting scrl child.
* @param list pointer to an object
*/
void lv_list_clean(lv_obj_t * list)
{
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
lv_obj_t * scrl = lv_page_get_scrollable(list);
lv_obj_clean(scrl);
}
/*======================
* Add/remove functions
*=====================*/
/**
* Add a list element to the list
* @param list pointer to list object
* @param img_fn file name of an image before the text (NULL if unused)
* @param txt text of the list element (NULL if unused)
* @return pointer to the new list element which can be customized (a button)
*/
lv_obj_t * lv_list_add_btn(lv_obj_t * list, const void * img_src, const char * txt)
{
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
lv_obj_t * last_btn = lv_list_get_prev_btn(list, NULL);
/*The coordinates may changed due to autofit so revert them at the end*/
lv_coord_t pos_x_ori = lv_obj_get_x(list);
lv_coord_t pos_y_ori = lv_obj_get_y(list);
lv_obj_t * scrl = lv_page_get_scrollable(list);
lv_obj_add_protect(scrl, LV_PROTECT_CHILD_CHG);
/*Create a list element with the image an the text*/
lv_obj_t * btn;
btn = lv_btn_create(list, NULL);
lv_obj_add_protect(btn, LV_PROTECT_CHILD_CHG);
/*Save the original signal function because it will be required in `lv_list_btn_signal`*/
if(ancestor_btn_signal == NULL) ancestor_btn_signal = lv_obj_get_signal_cb(btn);
/*Set the default styles*/
lv_theme_apply(btn, LV_THEME_LIST_BTN);
lv_page_glue_obj(btn, true);
lv_btn_set_layout(btn, LV_LAYOUT_ROW_MID);
lv_layout_t list_layout = lv_list_get_layout(list);
bool layout_ver = false;
if(list_layout == LV_LAYOUT_COLUMN_MID || list_layout == LV_LAYOUT_COLUMN_LEFT ||
list_layout == LV_LAYOUT_COLUMN_RIGHT) {
layout_ver = true;
}
if(layout_ver) {
lv_btn_set_fit2(btn, LV_FIT_PARENT, LV_FIT_TIGHT);
}
else {
lv_coord_t w = last_btn ? lv_obj_get_width(last_btn) : (LV_DPI * 3) / 2;
lv_btn_set_fit2(btn, LV_FIT_NONE, LV_FIT_TIGHT);
lv_obj_set_width(btn, w);
}
lv_obj_add_protect(btn, LV_PROTECT_PRESS_LOST);
lv_obj_set_signal_cb(btn, lv_list_btn_signal);
#if LV_USE_IMG != 0
lv_obj_t * img = NULL;
if(img_src) {
img = lv_img_create(btn, NULL);
lv_img_set_src(img, img_src);
lv_obj_set_click(img, false);
if(img_signal == NULL) img_signal = lv_obj_get_signal_cb(img);
}
#endif
if(txt != NULL) {
lv_obj_t * label = lv_label_create(btn, NULL);
lv_label_set_text(label, txt);
lv_obj_set_click(label, false);
lv_label_set_long_mode(label, LV_LABEL_LONG_SROLL_CIRC);
if(lv_obj_get_base_dir(btn) == LV_BIDI_DIR_RTL) {
lv_coord_t pad = lv_obj_get_style_pad_left(btn, LV_BTN_PART_MAIN);
lv_obj_set_width(label, label->coords.x2 - btn->coords.x1 - pad);
}
else {
lv_coord_t pad = lv_obj_get_style_pad_right(btn, LV_BTN_PART_MAIN);
lv_obj_set_width(label, btn->coords.x2 - label->coords.x1 - pad);
}
if(label_signal == NULL) label_signal = lv_obj_get_signal_cb(label);
}
#if LV_USE_GROUP
/* If this is the first item to be added to the list and the list is
* focused, select it */
{
lv_group_t * g = lv_obj_get_group(list);
if(lv_list_get_next_btn(list, NULL) == btn && lv_group_get_focused(g) == list) {
lv_list_focus_btn(list, btn);
}
}
#endif
lv_obj_clear_protect(scrl, LV_PROTECT_CHILD_CHG);
lv_obj_clear_protect(btn, LV_PROTECT_CHILD_CHG);
btn->signal_cb(btn, LV_SIGNAL_CHILD_CHG, NULL);
lv_obj_set_pos(list, pos_x_ori, pos_y_ori);
return btn;
}
/**
* Remove the index of the button in the list
* @param list pointer to a list object
* @param index pointer to a the button's index in the list, index must be 0 <= index <
* lv_list_ext_t.size
* @return true: successfully deleted
*/
bool lv_list_remove(const lv_obj_t * list, uint16_t index)
{
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
uint16_t count = 0;
lv_obj_t * e = lv_list_get_next_btn(list, NULL);
while(e != NULL) {
if(count == index) {
lv_obj_del(e);
return true;
}
e = lv_list_get_next_btn(list, e);
count++;
}
return false;
}
/*=====================
* Setter functions
*====================*/
/**
* Make a button selected
* @param list pointer to a list object
* @param btn pointer to a button to select
* NULL to not select any buttons
*/
void lv_list_focus_btn(lv_obj_t * list, lv_obj_t * btn)
{
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
if(btn) LV_ASSERT_OBJ(btn, "lv_btn");
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
/*Defocus the current button*/
if(ext->act_sel_btn) lv_obj_clear_state(ext->act_sel_btn, LV_STATE_FOCUSED);
#if LV_USE_GROUP
/*Don't forget which button was selected.
* It will be restored when the list is focused again.*/
if(btn) ext->last_sel_btn = btn;
#endif
/*Focus the new button*/
ext->act_sel_btn = btn;
if(ext->act_sel_btn) {
lv_obj_add_state(ext->act_sel_btn, LV_STATE_FOCUSED);
lv_page_focus(list, ext->act_sel_btn, LV_ANIM_ON);
}
}
/**
* Set layout of a list
* @param list pointer to a list object
* @param layout which layout should be used
*/
void lv_list_set_layout(lv_obj_t * list, lv_layout_t layout)
{
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
/* Update list layout if necessary */
if(layout == lv_list_get_layout(list)) return;
/* Get the first button on the list */
lv_obj_t * btn = lv_list_get_prev_btn(list, NULL);
/* Visit all buttons on the list and update their layout */
while(btn != NULL) {
/*If a column layout set the buttons' width to list width*/
if(layout == LV_LAYOUT_COLUMN_MID || layout == LV_LAYOUT_COLUMN_LEFT || layout == LV_LAYOUT_COLUMN_RIGHT) {
lv_btn_set_fit2(btn, LV_FIT_PARENT, LV_FIT_TIGHT);
}
/*If a row layout set the buttons' width according to the content*/
else if(layout == LV_LAYOUT_ROW_MID || layout == LV_LAYOUT_ROW_TOP || layout == LV_LAYOUT_ROW_BOTTOM) {
lv_btn_set_fit(btn, LV_FIT_TIGHT);
}
btn = lv_list_get_prev_btn(list, btn);
}
if(layout == LV_LAYOUT_COLUMN_MID || layout == LV_LAYOUT_COLUMN_LEFT || layout == LV_LAYOUT_COLUMN_RIGHT) {
lv_page_set_scrollable_fit2(list, LV_FIT_PARENT, LV_FIT_TIGHT);
}
else if(layout == LV_LAYOUT_ROW_MID || layout == LV_LAYOUT_ROW_TOP || layout == LV_LAYOUT_ROW_BOTTOM) {
lv_page_set_scrollable_fit2(list, LV_FIT_TIGHT, LV_FIT_TIGHT);
lv_cont_set_fit2(list, LV_FIT_NONE, LV_FIT_TIGHT);
}
lv_page_set_scrl_layout(list, layout);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the text of a list element
* @param btn pointer to list element
* @return pointer to the text
*/
const char * lv_list_get_btn_text(const lv_obj_t * btn)
{
LV_ASSERT_OBJ(btn, "lv_btn");
lv_obj_t * label = lv_list_get_btn_label(btn);
if(label == NULL) return "";
return lv_label_get_text(label);
}
/**
* Get the label object from a list element
* @param btn pointer to a list element (button)
* @return pointer to the label from the list element or NULL if not found
*/
lv_obj_t * lv_list_get_btn_label(const lv_obj_t * btn)
{
LV_ASSERT_OBJ(btn, "lv_btn");
lv_obj_t * label = lv_obj_get_child_back(btn, NULL);
if(label == NULL) return NULL;
while(lv_list_is_list_label(label) == false) {
label = lv_obj_get_child_back(btn, label);
if(label == NULL) break;
}
return label;
}
/**
* Get the image object from a list element
* @param btn pointer to a list element (button)
* @return pointer to the image from the list element or NULL if not found
*/
lv_obj_t * lv_list_get_btn_img(const lv_obj_t * btn)
{
LV_ASSERT_OBJ(btn, "lv_btn");
#if LV_USE_IMG != 0
lv_obj_t * img = lv_obj_get_child_back(btn, NULL);
if(img == NULL) return NULL;
while(lv_list_is_list_img(img) == false) {
img = lv_obj_get_child_back(btn, img);
if(img == NULL) break;
}
return img;
#else
return NULL;
#endif
}
/**
* Get the previous button from list. (Starts from the bottom button)
* @param list pointer to a list object
* @param prev_btn pointer to button. Search the previous before it.
* @return pointer to the previous button or NULL when no more buttons
*/
lv_obj_t * lv_list_get_prev_btn(const lv_obj_t * list, lv_obj_t * prev_btn)
{
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
/* Not a good practice but user can add/create objects to the lists manually.
* When getting the next button try to be sure that it is at least a button */
lv_obj_t * btn;
lv_obj_t * scrl = lv_page_get_scrollable(list);
btn = lv_obj_get_child(scrl, prev_btn);
if(btn == NULL) return NULL;
while(lv_list_is_list_btn(btn) == false) {
btn = lv_obj_get_child(scrl, btn);
if(btn == NULL) break;
}
return btn;
}
/**
* Get the next button from list. (Starts from the top button)
* @param list pointer to a list object
* @param prev_btn pointer to button. Search the next after it.
* @return pointer to the next button or NULL when no more buttons
*/
lv_obj_t * lv_list_get_next_btn(const lv_obj_t * list, lv_obj_t * prev_btn)
{
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
/* Not a good practice but user can add/create objects to the lists manually.
* When getting the next button try to be sure that it is at least a button */
lv_obj_t * btn;
lv_obj_t * scrl = lv_page_get_scrollable(list);
btn = lv_obj_get_child_back(scrl, prev_btn);
if(btn == NULL) return NULL;
while(lv_list_is_list_btn(btn) == false) {
btn = lv_obj_get_child_back(scrl, btn);
if(btn == NULL) break;
}
return btn;
}
/**
* Get the index of the button in the list
* @param list pointer to a list object. If NULL, assumes btn is part of a list.
* @param btn pointer to a list element (button)
* @return the index of the button in the list, or -1 of the button not in this list
*/
int32_t lv_list_get_btn_index(const lv_obj_t * list, const lv_obj_t * btn)
{
LV_ASSERT_OBJ(btn, "lv_btn");
int index = 0;
if(list == NULL) {
/* no list provided, assuming btn is part of a list */
list = lv_obj_get_parent(lv_obj_get_parent(btn));
}
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
lv_obj_t * e = lv_list_get_next_btn(list, NULL);
while(e != NULL) {
if(e == btn) {
return index;
}
index++;
e = lv_list_get_next_btn(list, e);
}
return -1;
}
/**
* Get the number of buttons in the list
* @param list pointer to a list object
* @return the number of buttons in the list
*/
uint16_t lv_list_get_size(const lv_obj_t * list)
{
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
uint16_t size = 0;
lv_obj_t * btn = lv_list_get_next_btn(list, NULL);
while(btn) {
size++;
btn = lv_list_get_next_btn(list, btn);
}
return size;
}
#if LV_USE_GROUP
/**
* Get the currently selected button
* @param list pointer to a list object
* @return pointer to the selected button
*/
lv_obj_t * lv_list_get_btn_selected(const lv_obj_t * list)
{
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
return ext->act_sel_btn;
}
#endif
/**
* Get layout of a list
* @param list pointer to a list object
* @return layout of the list object
*/
lv_layout_t lv_list_get_layout(lv_obj_t * list)
{
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
return lv_page_get_scrl_layout(list);
}
/*=====================
* Other functions
*====================*/
/**
* Move the list elements up by one
* @param list pointer a to list object
*/
void lv_list_up(const lv_obj_t * list)
{
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
/*Search the first list element which 'y' coordinate is below the parent
* and position the list to show this element on the bottom*/
lv_obj_t * scrl = lv_page_get_scrollable(list);
lv_obj_t * e;
lv_obj_t * e_prev = NULL;
e = lv_list_get_prev_btn(list, NULL);
while(e != NULL) {
if(e->coords.y2 <= list->coords.y2) {
if(e_prev != NULL) {
lv_coord_t new_y = lv_obj_get_height(list) - (lv_obj_get_y(e_prev) + lv_obj_get_height(e_prev));
if(lv_list_get_anim_time(list) == 0) {
lv_obj_set_y(scrl, new_y);
}
else {
#if LV_USE_ANIMATION
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, scrl);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_y);
lv_anim_set_values(&a, lv_obj_get_y(scrl), new_y);
lv_anim_set_time(&a, LV_LIST_DEF_ANIM_TIME);
lv_anim_start(&a);
#endif
}
}
break;
}
e_prev = e;
e = lv_list_get_prev_btn(list, e);
}
}
/**
* Move the list elements down by one
* @param list pointer to a list object
*/
void lv_list_down(const lv_obj_t * list)
{
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
/*Search the first list element which 'y' coordinate is above the parent
* and position the list to show this element on the top*/
lv_obj_t * scrl = lv_page_get_scrollable(list);
lv_obj_t * e;
e = lv_list_get_prev_btn(list, NULL);
while(e != NULL) {
if(e->coords.y1 < list->coords.y1) {
lv_coord_t new_y = -lv_obj_get_y(e);
if(lv_list_get_anim_time(list) == 0) {
lv_obj_set_y(scrl, new_y);
}
else {
#if LV_USE_ANIMATION
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, scrl);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_y);
lv_anim_set_values(&a, lv_obj_get_y(scrl), new_y);
lv_anim_set_time(&a, LV_LIST_DEF_ANIM_TIME);
lv_anim_start(&a);
#endif
}
break;
}
e = lv_list_get_prev_btn(list, e);
}
}
/**
* Focus on a list button. It ensures that the button will be visible on the list.
* @param btn pointer to a list button to focus
* @param anim_en LV_ANIM_ON: scroll with animation, LV_ANOM_OFF: without animation
*/
void lv_list_focus(const lv_obj_t * btn, lv_anim_enable_t anim)
{
LV_ASSERT_OBJ(btn, "");
#if LV_USE_ANIMATION == 0
anim = false;
#endif
lv_obj_t * list = lv_obj_get_parent(lv_obj_get_parent(btn));
lv_page_focus(list, btn, anim == LV_ANIM_OFF ? 0 : lv_list_get_anim_time(list));
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Signal function of the list
* @param list pointer to a list object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_list_signal(lv_obj_t * list, lv_signal_t sign, void * param)
{
lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_list_get_style(list, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_page_signal(list, sign, param);
}
/* Include the ancient signal function */
res = ancestor_page_signal(list, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
if(sign == LV_SIGNAL_RELEASED || sign == LV_SIGNAL_PRESSED || sign == LV_SIGNAL_PRESSING ||
sign == LV_SIGNAL_LONG_PRESS || sign == LV_SIGNAL_LONG_PRESS_REP) {
#if LV_USE_GROUP
/*If pressed/released etc by a KEYPAD or ENCODER delegate signal and events to the button*/
lv_indev_t * indev = lv_indev_get_act();
lv_indev_type_t indev_type = lv_indev_get_type(indev);
if(indev_type == LV_INDEV_TYPE_KEYPAD ||
(indev_type == LV_INDEV_TYPE_ENCODER && lv_group_get_editing(lv_obj_get_group(list)))) {
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
/*The page receives the key presses so the events should be propagated to the selected
* button*/
if(ext->act_sel_btn) {
res = lv_signal_send(ext->act_sel_btn, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_PRESSED) {
res = lv_event_send(ext->act_sel_btn, LV_EVENT_PRESSED, NULL);
if(res != LV_RES_OK) return res;
}
else if(sign == LV_SIGNAL_PRESSING) {
res = lv_event_send(ext->act_sel_btn, LV_EVENT_PRESSING, NULL);
if(res != LV_RES_OK) return res;
}
else if(sign == LV_SIGNAL_LONG_PRESS) {
res = lv_event_send(ext->act_sel_btn, LV_EVENT_LONG_PRESSED, NULL);
if(res != LV_RES_OK) return res;
}
else if(sign == LV_SIGNAL_LONG_PRESS_REP) {
res = lv_event_send(ext->act_sel_btn, LV_EVENT_LONG_PRESSED_REPEAT, NULL);
if(res != LV_RES_OK) return res;
}
else if(sign == LV_SIGNAL_RELEASED) {
if(indev->proc.long_pr_sent == 0) {
res = lv_event_send(ext->act_sel_btn, LV_EVENT_SHORT_CLICKED, NULL);
if(res != LV_RES_OK) return res;
}
if(lv_indev_is_dragging(indev) == false) {
res = lv_event_send(ext->act_sel_btn, LV_EVENT_CLICKED, NULL);
if(res != LV_RES_OK) return res;
}
res = lv_event_send(ext->act_sel_btn, LV_EVENT_RELEASED, NULL);
if(res != LV_RES_OK) return res;
}
}
}
#endif
}
else if(sign == LV_SIGNAL_FOCUS) {
#if LV_USE_GROUP
lv_indev_type_t indev_type = lv_indev_get_type(lv_indev_get_act());
/*With ENCODER focus the button only in edit mode*/
lv_group_t * g = lv_obj_get_group(list);
if((indev_type == LV_INDEV_TYPE_KEYPAD) ||
(indev_type == LV_INDEV_TYPE_ENCODER && lv_group_get_editing(g))) {
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
/* Select the last used button, or use the first no last button */
if(ext->last_sel_btn) lv_list_focus_btn(list, ext->last_sel_btn);
else lv_list_focus_btn(list, lv_list_get_next_btn(list, NULL));
}
if(indev_type == LV_INDEV_TYPE_ENCODER && lv_group_get_editing(g) == false) {
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
if(ext->act_sel_btn) lv_obj_clear_state(ext->act_sel_btn, LV_STATE_PRESSED);
if(ext->last_sel_btn) lv_obj_clear_state(ext->last_sel_btn, LV_STATE_PRESSED);
}
#endif
}
else if(sign == LV_SIGNAL_DEFOCUS) {
#if LV_USE_GROUP
/*De-select the selected btn*/
lv_list_focus_btn(list, NULL);
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
ext->act_sel_btn = NULL;
#endif
}
else if(sign == LV_SIGNAL_GET_EDITABLE) {
#if LV_USE_GROUP
bool * editable = (bool *)param;
*editable = true;
#endif
}
else if(sign == LV_SIGNAL_CONTROL) {
#if LV_USE_GROUP
char c = *((char *)param);
if(c == LV_KEY_RIGHT || c == LV_KEY_DOWN) {
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
/*If there is a valid selected button the make the previous selected*/
if(ext->act_sel_btn) {
lv_obj_t * btn_prev = lv_list_get_next_btn(list, ext->act_sel_btn);
if(btn_prev) lv_list_focus_btn(list, btn_prev);
}
/*If there is no selected button the make the first selected*/
else {
lv_obj_t * btn = lv_list_get_next_btn(list, NULL);
if(btn)
lv_list_focus_btn(list,
btn); /*If there are no buttons on the list then there is no first button*/
}
}
else if(c == LV_KEY_LEFT || c == LV_KEY_UP) {
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
/*If there is a valid selected button the make the next selected*/
if(ext->act_sel_btn != NULL) {
lv_obj_t * btn_next = lv_list_get_prev_btn(list, ext->act_sel_btn);
if(btn_next) lv_list_focus_btn(list, btn_next);
}
/*If there is no selected button the make the first selected*/
else {
lv_obj_t * btn = lv_list_get_next_btn(list, NULL);
if(btn) lv_list_focus_btn(list, btn);
}
}
else if(c == LV_KEY_ESC) {
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
/* Handle ESC/Cancel event */
res = lv_event_send(ext->act_sel_btn, LV_EVENT_CANCEL, NULL);
}
#endif
}
return res;
}
/**
* Signal function of the list buttons
* @param btn pointer to a button on the list
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_list_btn_signal(lv_obj_t * btn, lv_signal_t sign, void * param)
{
lv_res_t res;
/* Include the ancient signal function */
res = ancestor_btn_signal(btn, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, "");
if((sign == LV_SIGNAL_COORD_CHG && (lv_obj_get_width(btn) != lv_area_get_width(param) ||
lv_obj_get_height(btn) != lv_area_get_height(param))) ||
sign == LV_SIGNAL_STYLE_CHG) {
lv_obj_t * label = lv_list_get_btn_label(btn);
if(label) {
const lv_font_t * font = lv_obj_get_style_text_font(label, LV_LABEL_PART_MAIN);
lv_coord_t font_h = lv_font_get_line_height(font);
if(lv_obj_get_base_dir(btn) == LV_BIDI_DIR_RTL) {
lv_coord_t pad = lv_obj_get_style_pad_left(btn, LV_BTN_PART_MAIN);
lv_obj_set_size(label, label->coords.x2 - btn->coords.x1 - pad, font_h);
}
else {
lv_coord_t pad = lv_obj_get_style_pad_right(btn, LV_BTN_PART_MAIN);
lv_obj_set_size(label, btn->coords.x2 - label->coords.x1 - pad + 1, font_h);
}
}
}
else if(sign == LV_SIGNAL_RELEASED) {
if(lv_indev_is_dragging(lv_indev_get_act()) == false) {
lv_obj_t * list = lv_obj_get_parent(lv_obj_get_parent(btn));
lv_list_focus_btn(list, btn);
#if LV_USE_GROUP
if(lv_obj_get_group(list)) {
lv_group_focus_obj(list);
}
#endif
}
}
else if(sign == LV_SIGNAL_CLEANUP) {
#if LV_USE_GROUP
lv_obj_t * list = lv_obj_get_parent(lv_obj_get_parent(btn));
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
lv_obj_t * sel = lv_list_get_btn_selected(list);
if(sel == btn) lv_list_focus_btn(list, lv_list_get_next_btn(list, btn));
if(ext->last_sel_btn == btn) ext->last_sel_btn = NULL;
#endif
}
return res;
}
/**
* Get the style descriptor of a part of the object
* @param list pointer the object
* @param part the part from `lv_page_list_t`. (LV_LIST_PART_...)
* @return pointer to the style descriptor of the specified part
*/
static lv_style_list_t * lv_list_get_style(lv_obj_t * list, uint8_t part)
{
LV_ASSERT_OBJ(list, LV_OBJX_NAME);
lv_list_ext_t * ext = lv_obj_get_ext_attr(list);
lv_style_list_t * style_dsc_p;
switch(part) {
case LV_LIST_PART_BG:
style_dsc_p = &list->style_list;
break;
case LV_LIST_PART_SCROLLABLE:
style_dsc_p = &ext->page.scrl->style_list;
break;
case LV_LIST_PART_SCROLLBAR:
style_dsc_p = &ext->page.scrlbar.style;
break;
#if LV_USE_ANIMATION
case LV_LIST_PART_EDGE_FLASH:
style_dsc_p = &ext->page.edge_flash.style;
break;
#endif
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
/**
* Check if this is really a list button or another object.
* @param list_btn List button
*/
static bool lv_list_is_list_btn(lv_obj_t * list_btn)
{
lv_obj_type_t type;
lv_obj_get_type(list_btn, &type);
uint8_t cnt;
for(cnt = 0; cnt < LV_MAX_ANCESTOR_NUM; cnt++) {
if(type.type[cnt] == NULL) break;
if(!strcmp(type.type[cnt], "lv_btn")) return true;
}
return false;
}
/**
* Check if this is really a list label or another object.
* @param list_label List label
*/
static bool lv_list_is_list_label(lv_obj_t * list_label)
{
lv_obj_type_t type;
lv_obj_get_type(list_label, &type);
uint8_t cnt;
for(cnt = 0; cnt < LV_MAX_ANCESTOR_NUM; cnt++) {
if(type.type[cnt] == NULL) break;
if(!strcmp(type.type[cnt], "lv_label")) return true;
}
return false;
}
/**
* Check if this is really a list image or another object.
* @param list_image List image
*/
static bool lv_list_is_list_img(lv_obj_t * list_img)
{
lv_obj_type_t type;
lv_obj_get_type(list_img, &type);
uint8_t cnt;
for(cnt = 0; cnt < LV_MAX_ANCESTOR_NUM; cnt++) {
if(type.type[cnt] == NULL) break;
if(!strcmp(type.type[cnt], "lv_img")) return true;
}
return false;
}
#endif
|
train_000.parquet/978
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_list.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 29453,
"token_count": 11653
}
|
/**
* @file lv_bar.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_bar.h"
#if LV_USE_BAR != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_anim.h"
#include "../lv_misc/lv_math.h"
#include <stdio.h>
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_bar"
#define LV_BAR_SIZE_MIN 4 /*hor. pad and ver. pad cannot make the indicator smaller then this [px]*/
#if LV_USE_ANIMATION
#define LV_BAR_IS_ANIMATING(anim_struct) (((anim_struct).anim_state) != LV_BAR_ANIM_STATE_INV)
#define LV_BAR_GET_ANIM_VALUE(orig_value, anim_struct) (LV_BAR_IS_ANIMATING(anim_struct) ? ((anim_struct).anim_end) : (orig_value))
#else
#define LV_BAR_GET_ANIM_VALUE(orig_value, anim_struct) (orig_value)
#endif
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_design_res_t lv_bar_design(lv_obj_t * bar, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param);
static lv_style_list_t * lv_bar_get_style(lv_obj_t * bar, uint8_t part);
static void draw_bg(lv_obj_t * bar, const lv_area_t * clip_area);
static void draw_indic(lv_obj_t * bar, const lv_area_t * clip_area);
#if LV_USE_ANIMATION
static void lv_bar_set_value_with_anim(lv_obj_t * bar, int16_t new_value, int16_t * value_ptr,
lv_bar_anim_t * anim_info, lv_anim_enable_t en);
static void lv_bar_init_anim(lv_obj_t * bar, lv_bar_anim_t * bar_anim);
static void lv_bar_anim(lv_bar_anim_t * bar, lv_anim_value_t value);
static void lv_bar_anim_ready(lv_anim_t * a);
#endif
/**********************
* STATIC VARIABLES
**********************/
static lv_design_cb_t ancestor_design_f;
static lv_signal_cb_t ancestor_signal;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a bar objects
* @param par pointer to an object, it will be the parent of the new bar
* @param copy pointer to a bar object, if not NULL then the new object will be copied from it
* @return pointer to the created bar
*/
lv_obj_t * lv_bar_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("lv_bar create started");
/*Create the ancestor basic object*/
lv_obj_t * bar = lv_obj_create(par, copy);
LV_ASSERT_MEM(bar);
if(bar == NULL) return NULL;
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(bar);
if(ancestor_design_f == NULL) ancestor_design_f = lv_obj_get_design_cb(bar);
/*Allocate the object type specific extended data*/
lv_bar_ext_t * ext = lv_obj_allocate_ext_attr(bar, sizeof(lv_bar_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(bar);
return NULL;
}
ext->min_value = 0;
ext->start_value = 0;
ext->max_value = 100;
ext->cur_value = 0;
#if LV_USE_ANIMATION
ext->anim_time = 200;
lv_bar_init_anim(bar, &ext->cur_value_anim);
lv_bar_init_anim(bar, &ext->start_value_anim);
#endif
ext->type = LV_BAR_TYPE_NORMAL;
lv_style_list_init(&ext->style_indic);
lv_obj_set_signal_cb(bar, lv_bar_signal);
lv_obj_set_design_cb(bar, lv_bar_design);
/*Init the new bar object*/
if(copy == NULL) {
lv_obj_set_click(bar, false);
lv_obj_set_size(bar, LV_DPI * 2, LV_DPI / 10);
lv_bar_set_value(bar, ext->cur_value, false);
lv_theme_apply(bar, LV_THEME_BAR);
}
else {
lv_bar_ext_t * ext_copy = lv_obj_get_ext_attr(copy);
ext->min_value = ext_copy->min_value;
ext->start_value = ext_copy->start_value;
ext->max_value = ext_copy->max_value;
ext->cur_value = ext_copy->cur_value;
ext->type = ext_copy->type;
lv_style_list_copy(&ext->style_indic, &ext_copy->style_indic);
/*Refresh the style with new signal function*/
lv_obj_refresh_style(bar, LV_STYLE_PROP_ALL);
lv_bar_set_value(bar, ext->cur_value, LV_ANIM_OFF);
}
LV_LOG_INFO("bar created");
return bar;
}
/*=====================
* Setter functions
*====================*/
/**
* Set a new value on the bar
* @param bar pointer to a bar object
* @param value new value
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
void lv_bar_set_value(lv_obj_t * bar, int16_t value, lv_anim_enable_t anim)
{
LV_ASSERT_OBJ(bar, LV_OBJX_NAME);
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
if(ext->cur_value == value) return;
int16_t new_value;
new_value = value > ext->max_value ? ext->max_value : value;
new_value = new_value < ext->min_value ? ext->min_value : new_value;
if(ext->cur_value == new_value) return;
#if LV_USE_ANIMATION == 0
LV_UNUSED(anim);
ext->cur_value = new_value;
lv_obj_invalidate(bar);
#else
lv_bar_set_value_with_anim(bar, new_value, &ext->cur_value, &ext->cur_value_anim, anim);
#endif
}
/**
* Set a new start value on the bar
* @param bar pointer to a bar object
* @param value new start value
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
void lv_bar_set_start_value(lv_obj_t * bar, int16_t start_value, lv_anim_enable_t anim)
{
LV_ASSERT_OBJ(bar, LV_OBJX_NAME);
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
if(ext->start_value == start_value) return;
int16_t new_value;
new_value = start_value > ext->max_value ? ext->max_value : start_value;
new_value = new_value < ext->min_value ? ext->min_value : start_value;
if(ext->start_value == new_value) return;
#if LV_USE_ANIMATION == 0
LV_UNUSED(anim);
ext->start_value = new_value;
#else
lv_bar_set_value_with_anim(bar, new_value, &ext->start_value, &ext->start_value_anim, anim);
#endif
}
/**
* Set minimum and the maximum values of a bar
* @param bar pointer to the bar object
* @param min minimum value
* @param max maximum value
*/
void lv_bar_set_range(lv_obj_t * bar, int16_t min, int16_t max)
{
LV_ASSERT_OBJ(bar, LV_OBJX_NAME);
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
if(ext->min_value == min && ext->max_value == max) return;
ext->max_value = max;
ext->min_value = min;
if(lv_bar_get_type(bar) != LV_BAR_TYPE_CUSTOM)
ext->start_value = min;
if(ext->cur_value > max) {
ext->cur_value = max;
lv_bar_set_value(bar, ext->cur_value, false);
}
if(ext->cur_value < min) {
ext->cur_value = min;
lv_bar_set_value(bar, ext->cur_value, false);
}
lv_obj_invalidate(bar);
}
/**
* Set the type of bar.
* @param bar pointer to bar object
* @param type bar type
*/
void lv_bar_set_type(lv_obj_t * bar, lv_bar_type_t type)
{
LV_ASSERT_OBJ(bar, LV_OBJX_NAME);
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
ext->type = type;
if(ext->type != LV_BAR_TYPE_CUSTOM)
ext->start_value = ext->min_value;
lv_obj_invalidate(bar);
}
/**
* Set the animation time of the bar
* @param bar pointer to a bar object
* @param anim_time the animation time in milliseconds.
*/
void lv_bar_set_anim_time(lv_obj_t * bar, uint16_t anim_time)
{
LV_ASSERT_OBJ(bar, LV_OBJX_NAME);
#if LV_USE_ANIMATION
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
ext->anim_time = anim_time;
#else
(void)bar; /*Unused*/
(void)anim_time; /*Unused*/
#endif
}
/*=====================
* Getter functions
*====================*/
/**
* Get the value of a bar
* @param bar pointer to a bar object
* @return the value of the bar
*/
int16_t lv_bar_get_value(const lv_obj_t * bar)
{
LV_ASSERT_OBJ(bar, LV_OBJX_NAME);
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
return LV_BAR_GET_ANIM_VALUE(ext->cur_value, ext->cur_value_anim);
}
/**
* Get the start value of a bar
* @param bar pointer to a bar object
* @return the start value of the bar
*/
int16_t lv_bar_get_start_value(const lv_obj_t * bar)
{
LV_ASSERT_OBJ(bar, LV_OBJX_NAME);
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
if(ext->type != LV_BAR_TYPE_CUSTOM) return ext->min_value;
return LV_BAR_GET_ANIM_VALUE(ext->start_value, ext->start_value_anim);
}
/**
* Get the minimum value of a bar
* @param bar pointer to a bar object
* @return the minimum value of the bar
*/
int16_t lv_bar_get_min_value(const lv_obj_t * bar)
{
LV_ASSERT_OBJ(bar, LV_OBJX_NAME);
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
return ext->min_value;
}
/**
* Get the maximum value of a bar
* @param bar pointer to a bar object
* @return the maximum value of the bar
*/
int16_t lv_bar_get_max_value(const lv_obj_t * bar)
{
LV_ASSERT_OBJ(bar, LV_OBJX_NAME);
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
return ext->max_value;
}
/**
* Get the type of bar.
* @param bar pointer to bar object
* @return bar type
*/
lv_bar_type_t lv_bar_get_type(lv_obj_t * bar)
{
LV_ASSERT_OBJ(bar, LV_OBJX_NAME);
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
return ext->type;
}
/**
* Get the animation time of the bar
* @param bar pointer to a bar object
* @return the animation time in milliseconds.
*/
uint16_t lv_bar_get_anim_time(const lv_obj_t * bar)
{
LV_ASSERT_OBJ(bar, LV_OBJX_NAME);
#if LV_USE_ANIMATION
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
return ext->anim_time;
#else
(void)bar; /*Unused*/
return 0;
#endif
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the bars
* @param bar pointer to an object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_bar_design(lv_obj_t * bar, const lv_area_t * clip_area, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
/*Return false if the object is not covers the mask area*/
return ancestor_design_f(bar, clip_area, mode);
}
else if(mode == LV_DESIGN_DRAW_MAIN) {
draw_bg(bar, clip_area);
draw_indic(bar, clip_area);
/*Get the value and draw it after the indicator*/
lv_draw_rect_dsc_t draw_dsc;
lv_draw_rect_dsc_init(&draw_dsc);
draw_dsc.bg_opa = LV_OPA_TRANSP;
draw_dsc.border_opa = LV_OPA_TRANSP;
draw_dsc.shadow_opa = LV_OPA_TRANSP;
draw_dsc.pattern_opa = LV_OPA_TRANSP;
draw_dsc.outline_opa = LV_OPA_TRANSP;
lv_obj_init_draw_rect_dsc(bar, LV_BAR_PART_BG, &draw_dsc);
lv_draw_rect(&bar->coords, clip_area, &draw_dsc);
}
else if(mode == LV_DESIGN_DRAW_POST) {
/*If the border is drawn later disable loading other properties*/
if(lv_obj_get_style_border_post(bar, LV_OBJ_PART_MAIN)) {
lv_draw_rect_dsc_t draw_dsc;
lv_draw_rect_dsc_init(&draw_dsc);
draw_dsc.bg_opa = LV_OPA_TRANSP;
draw_dsc.pattern_opa = LV_OPA_TRANSP;
draw_dsc.outline_opa = LV_OPA_TRANSP;
draw_dsc.shadow_opa = LV_OPA_TRANSP;
draw_dsc.value_opa = LV_OPA_TRANSP;
lv_obj_init_draw_rect_dsc(bar, LV_OBJ_PART_MAIN, &draw_dsc);
lv_draw_rect(&bar->coords, clip_area, &draw_dsc);
}
}
return LV_DESIGN_RES_OK;
}
static void draw_bg(lv_obj_t * bar, const lv_area_t * clip_area)
{
/*Simply draw the background*/
lv_draw_rect_dsc_t draw_dsc;
lv_draw_rect_dsc_init(&draw_dsc);
/*If the border is drawn later disable loading its properties*/
if(lv_obj_get_style_border_post(bar, LV_BAR_PART_BG)) {
draw_dsc.border_opa = LV_OPA_TRANSP;
}
/*value will be drawn later*/
draw_dsc.value_opa = LV_OPA_TRANSP;
lv_obj_init_draw_rect_dsc(bar, LV_BAR_PART_BG, &draw_dsc);
lv_draw_rect(&bar->coords, clip_area, &draw_dsc);
}
static void draw_indic(lv_obj_t * bar, const lv_area_t * clip_area)
{
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
lv_bidi_dir_t base_dir = lv_obj_get_base_dir(bar);
lv_coord_t objw = lv_obj_get_width(bar);
lv_coord_t objh = lv_obj_get_height(bar);
int32_t range = ext->max_value - ext->min_value;
bool hor = objw >= objh ? true : false;
bool sym = false;
if(ext->type == LV_BAR_TYPE_SYMMETRICAL && ext->min_value < 0 && ext->max_value > 0 &&
ext->start_value == ext->min_value) sym = true;
/*Calculate the indicator area*/
lv_style_int_t bg_left = lv_obj_get_style_pad_left(bar, LV_BAR_PART_BG);
lv_style_int_t bg_right = lv_obj_get_style_pad_right(bar, LV_BAR_PART_BG);
lv_style_int_t bg_top = lv_obj_get_style_pad_top(bar, LV_BAR_PART_BG);
lv_style_int_t bg_bottom = lv_obj_get_style_pad_bottom(bar, LV_BAR_PART_BG);
/*Respect padding and minimum width/height too*/
lv_area_copy(&ext->indic_area, &bar->coords);
ext->indic_area.x1 += bg_left;
ext->indic_area.x2 -= bg_right;
ext->indic_area.y1 += bg_top;
ext->indic_area.y2 -= bg_bottom;
if(hor && lv_area_get_height(&ext->indic_area) < LV_BAR_SIZE_MIN) {
ext->indic_area.y1 = bar->coords.y1 + (objh / 2) - (LV_BAR_SIZE_MIN / 2);
ext->indic_area.y2 = ext->indic_area.y1 + LV_BAR_SIZE_MIN;
}
else if(!hor && lv_area_get_width(&ext->indic_area) < LV_BAR_SIZE_MIN) {
ext->indic_area.x1 = bar->coords.x1 + (objw / 2) - (LV_BAR_SIZE_MIN / 2);
ext->indic_area.x2 = ext->indic_area.x1 + LV_BAR_SIZE_MIN;
}
lv_coord_t indicw = lv_area_get_width(&ext->indic_area);
lv_coord_t indich = lv_area_get_height(&ext->indic_area);
/*Calculate the indicator length*/
lv_coord_t anim_length = hor ? indicw : indich;
lv_coord_t anim_cur_value_x, anim_start_value_x;
lv_coord_t * axis1, * axis2;
lv_coord_t (*indic_length_calc)(const lv_area_t * area);
if(hor) {
axis1 = &ext->indic_area.x1;
axis2 = &ext->indic_area.x2;
indic_length_calc = lv_area_get_width;
}
else {
axis1 = &ext->indic_area.y1;
axis2 = &ext->indic_area.y2;
indic_length_calc = lv_area_get_height;
}
#if LV_USE_ANIMATION
if(LV_BAR_IS_ANIMATING(ext->start_value_anim)) {
lv_coord_t anim_start_value_start_x =
(int32_t)((int32_t)anim_length * (ext->start_value_anim.anim_start - ext->min_value)) / range;
lv_coord_t anim_start_value_end_x =
(int32_t)((int32_t)anim_length * (ext->start_value_anim.anim_end - ext->min_value)) / range;
anim_start_value_x = (((anim_start_value_end_x - anim_start_value_start_x) * ext->start_value_anim.anim_state) /
LV_BAR_ANIM_STATE_END);
anim_start_value_x += anim_start_value_start_x;
}
else
#endif
{
anim_start_value_x = (int32_t)((int32_t)anim_length * (ext->start_value - ext->min_value)) / range;
}
#if LV_USE_ANIMATION
if(LV_BAR_IS_ANIMATING(ext->cur_value_anim)) {
lv_coord_t anim_cur_value_start_x =
(int32_t)((int32_t)anim_length * (ext->cur_value_anim.anim_start - ext->min_value)) / range;
lv_coord_t anim_cur_value_end_x =
(int32_t)((int32_t)anim_length * (ext->cur_value_anim.anim_end - ext->min_value)) / range;
anim_cur_value_x = anim_cur_value_start_x + (((anim_cur_value_end_x - anim_cur_value_start_x) *
ext->cur_value_anim.anim_state) /
LV_BAR_ANIM_STATE_END);
}
else
#endif
{
anim_cur_value_x = (int32_t)((int32_t)anim_length * (ext->cur_value - ext->min_value)) / range;
}
if(hor && base_dir == LV_BIDI_DIR_RTL) {
/* Swap axes */
lv_coord_t * tmp;
tmp = axis1;
axis1 = axis2;
axis2 = tmp;
anim_cur_value_x = -anim_cur_value_x;
anim_start_value_x = -anim_start_value_x;
}
/* Set the indicator length */
if(hor) {
*axis2 = *axis1 + anim_cur_value_x;
*axis1 += anim_start_value_x;
}
else {
*axis1 = *axis2 - anim_cur_value_x;
*axis2 -= anim_start_value_x;
}
if(sym) {
lv_coord_t zero;
zero = *axis1 + (-ext->min_value * anim_length) / range;
if(*axis2 > zero)
*axis1 = zero;
else {
*axis1 = *axis2;
*axis2 = zero;
}
}
/*Draw the indicator*/
/*Do not draw a zero length indicator*/
if(!sym && indic_length_calc(&ext->indic_area) <= 1) return;
uint16_t bg_radius = lv_obj_get_style_radius(bar, LV_BAR_PART_BG);
lv_coord_t short_side = LV_MATH_MIN(objw, objh);
if(bg_radius > short_side >> 1) bg_radius = short_side >> 1;
lv_draw_rect_dsc_t draw_indic_dsc;
lv_draw_rect_dsc_init(&draw_indic_dsc);
lv_obj_init_draw_rect_dsc(bar, LV_BAR_PART_INDIC, &draw_indic_dsc);
/* Draw only the shadow if the indicator is long enough.
* The radius of the bg and the indicator can make a strange shape where
* it'd be very difficult to draw shadow. */
if((hor && lv_area_get_width(&ext->indic_area) > bg_radius * 2) ||
(!hor && lv_area_get_height(&ext->indic_area) > bg_radius * 2)) {
lv_opa_t bg_opa = draw_indic_dsc.bg_opa;
lv_opa_t border_opa = draw_indic_dsc.border_opa;
lv_opa_t value_opa = draw_indic_dsc.value_opa;
const void * pattern_src = draw_indic_dsc.pattern_image;
draw_indic_dsc.bg_opa = LV_OPA_TRANSP;
draw_indic_dsc.border_opa = LV_OPA_TRANSP;
draw_indic_dsc.value_opa = LV_OPA_TRANSP;
draw_indic_dsc.pattern_image = NULL;
lv_draw_rect(&ext->indic_area, clip_area, &draw_indic_dsc);
draw_indic_dsc.bg_opa = bg_opa;
draw_indic_dsc.border_opa = border_opa;
draw_indic_dsc.value_opa = value_opa;
draw_indic_dsc.pattern_image = pattern_src;
}
lv_draw_mask_radius_param_t mask_bg_param;
lv_draw_mask_radius_init(&mask_bg_param, &bar->coords, bg_radius, false);
int16_t mask_bg_id = lv_draw_mask_add(&mask_bg_param, NULL);
/*Draw_only the background and the pattern*/
lv_opa_t shadow_opa = draw_indic_dsc.shadow_opa;
lv_opa_t border_opa = draw_indic_dsc.border_opa;
lv_opa_t value_opa = draw_indic_dsc.value_opa;
draw_indic_dsc.border_opa = LV_OPA_TRANSP;
draw_indic_dsc.shadow_opa = LV_OPA_TRANSP;
draw_indic_dsc.value_opa = LV_OPA_TRANSP;
/*Get the max possible indicator area. The gradient should be applied on this*/
lv_area_t mask_indic_max_area;
lv_area_copy(&mask_indic_max_area, &bar->coords);
mask_indic_max_area.x1 += bg_left;
mask_indic_max_area.y1 += bg_top;
mask_indic_max_area.x2 -= bg_right;
mask_indic_max_area.y2 -= bg_bottom;
if(hor && lv_area_get_height(&mask_indic_max_area) < LV_BAR_SIZE_MIN) {
mask_indic_max_area.y1 = bar->coords.y1 + (objh / 2) - (LV_BAR_SIZE_MIN / 2);
mask_indic_max_area.y2 = mask_indic_max_area.y1 + LV_BAR_SIZE_MIN;
}
else if(!hor && lv_area_get_width(&mask_indic_max_area) < LV_BAR_SIZE_MIN) {
mask_indic_max_area.x1 = bar->coords.x1 + (objw / 2) - (LV_BAR_SIZE_MIN / 2);
mask_indic_max_area.x2 = mask_indic_max_area.x1 + LV_BAR_SIZE_MIN;
}
/*Create a mask to the current indicator area to see only this part from the whole gradient.*/
lv_draw_mask_radius_param_t mask_indic_param;
lv_draw_mask_radius_init(&mask_indic_param, &ext->indic_area, draw_indic_dsc.radius, false);
int16_t mask_indic_id = lv_draw_mask_add(&mask_indic_param, NULL);
lv_draw_rect(&mask_indic_max_area, clip_area, &draw_indic_dsc);
draw_indic_dsc.border_opa = border_opa;
draw_indic_dsc.shadow_opa = shadow_opa;
draw_indic_dsc.value_opa = value_opa;
/*Draw the border*/
draw_indic_dsc.bg_opa = LV_OPA_TRANSP;
draw_indic_dsc.shadow_opa = LV_OPA_TRANSP;
draw_indic_dsc.value_opa = LV_OPA_TRANSP;
draw_indic_dsc.pattern_image = NULL;
lv_draw_rect(&ext->indic_area, clip_area, &draw_indic_dsc);
lv_draw_mask_remove_id(mask_indic_id);
lv_draw_mask_remove_id(mask_bg_id);
/*When not masks draw the value*/
draw_indic_dsc.value_opa = value_opa;
draw_indic_dsc.border_opa = LV_OPA_TRANSP;
lv_draw_rect(&ext->indic_area, clip_area, &draw_indic_dsc);
}
/**
* Signal function of the bar
* @param bar pointer to a bar object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_bar_signal(lv_obj_t * bar, lv_signal_t sign, void * param)
{
lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_bar_get_style(bar, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(bar, sign, param);
}
/* Include the ancient signal function */
res = ancestor_signal(bar, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
lv_coord_t indic_size;
indic_size = lv_obj_get_draw_rect_ext_pad_size(bar, LV_BAR_PART_INDIC);
/*Bg size is handled by lv_obj*/
bar->ext_draw_pad = LV_MATH_MAX(bar->ext_draw_pad, indic_size);
}
if(sign == LV_SIGNAL_CLEANUP) {
lv_obj_clean_style_list(bar, LV_BAR_PART_INDIC);
#if LV_USE_ANIMATION
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
lv_anim_del(&ext->cur_value_anim, NULL);
lv_anim_del(&ext->start_value_anim, NULL);
#endif
}
return res;
}
static lv_style_list_t * lv_bar_get_style(lv_obj_t * bar, uint8_t part)
{
LV_ASSERT_OBJ(bar, LV_OBJX_NAME);
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
lv_style_list_t * style_dsc_p;
switch(part) {
case LV_BAR_PART_BG:
style_dsc_p = &bar->style_list;
break;
case LV_BAR_PART_INDIC:
style_dsc_p = &ext->style_indic;
break;
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
#if LV_USE_ANIMATION
static void lv_bar_anim(lv_bar_anim_t * var, lv_anim_value_t value)
{
var->anim_state = value;
lv_obj_invalidate(var->bar);
}
static void lv_bar_anim_ready(lv_anim_t * a)
{
lv_bar_anim_t * var = a->var;
lv_bar_ext_t * ext = lv_obj_get_ext_attr(var->bar);
var->anim_state = LV_BAR_ANIM_STATE_INV;
if(var == &ext->cur_value_anim)
ext->cur_value = var->anim_end;
else if(var == &ext->start_value_anim)
ext->start_value = var->anim_end;
lv_obj_invalidate(var->bar);
}
static void lv_bar_set_value_with_anim(lv_obj_t * bar, int16_t new_value, int16_t * value_ptr,
lv_bar_anim_t * anim_info, lv_anim_enable_t en)
{
if(en == LV_ANIM_OFF) {
*value_ptr = new_value;
lv_obj_invalidate(bar);
}
else {
lv_bar_ext_t * ext = lv_obj_get_ext_attr(bar);
/*No animation in progress -> simply set the values*/
if(anim_info->anim_state == LV_BAR_ANIM_STATE_INV) {
anim_info->anim_start = *value_ptr;
anim_info->anim_end = new_value;
}
/*Animation in progress. Start from the animation end value*/
else {
anim_info->anim_start = anim_info->anim_end;
anim_info->anim_end = new_value;
}
/* Stop the previous animation if it exists */
lv_anim_del(anim_info, NULL);
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, anim_info);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_bar_anim);
lv_anim_set_values(&a, LV_BAR_ANIM_STATE_START, LV_BAR_ANIM_STATE_END);
lv_anim_set_ready_cb(&a, lv_bar_anim_ready);
lv_anim_set_time(&a, ext->anim_time);
lv_anim_start(&a);
}
}
static void lv_bar_init_anim(lv_obj_t * bar, lv_bar_anim_t * bar_anim)
{
bar_anim->bar = bar;
bar_anim->anim_start = 0;
bar_anim->anim_end = 0;
bar_anim->anim_state = LV_BAR_ANIM_STATE_INV;
}
#endif
#endif
|
train_000.parquet/979
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_bar.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 24729,
"token_count": 10012
}
|
/**
* @file lv_msgbox.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_msgbox.h"
#if LV_USE_MSGBOX != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_group.h"
#include "../lv_core/lv_disp.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_anim.h"
#include "../lv_misc/lv_math.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_msgbox"
#if LV_USE_ANIMATION
#ifndef LV_MSGBOX_CLOSE_ANIM_TIME
#define LV_MSGBOX_CLOSE_ANIM_TIME 200 /*List close animation time) */
#endif
#else
#undef LV_MSGBOX_CLOSE_ANIM_TIME
#define LV_MSGBOX_CLOSE_ANIM_TIME 0 /*No animations*/
#endif
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_res_t lv_msgbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param);
static void mbox_realign(lv_obj_t * mbox);
static lv_style_list_t * lv_msgbox_get_style(lv_obj_t * mbox, uint8_t part);
#if LV_USE_ANIMATION
static void lv_msgbox_close_ready_cb(lv_anim_t * a);
#endif
static void lv_msgbox_default_event_cb(lv_obj_t * mbox, lv_event_t event);
static void lv_msgbox_btnm_event_cb(lv_obj_t * btnm, lv_event_t event);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a message box objects
* @param par pointer to an object, it will be the parent of the new message box
* @param copy pointer to a message box object, if not NULL then the new object will be copied from
* it
* @return pointer to the created message box
*/
lv_obj_t * lv_msgbox_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("message box create started");
/*Create the ancestor message box*/
lv_obj_t * mbox = lv_cont_create(par, copy);
LV_ASSERT_MEM(mbox);
if(mbox == NULL) return NULL;
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(mbox);
/*Allocate the message box type specific extended data*/
lv_msgbox_ext_t * ext = lv_obj_allocate_ext_attr(mbox, sizeof(lv_msgbox_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(mbox);
return NULL;
}
ext->text = NULL;
ext->btnm = NULL;
#if LV_USE_ANIMATION
ext->anim_time = LV_MSGBOX_CLOSE_ANIM_TIME;
#endif
/*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(mbox, lv_msgbox_signal);
/*Init the new message box message box*/
if(copy == NULL) {
ext->text = lv_label_create(mbox, NULL);
lv_label_set_align(ext->text, LV_LABEL_ALIGN_CENTER);
lv_label_set_long_mode(ext->text, LV_LABEL_LONG_BREAK);
lv_label_set_text(ext->text, "Message");
lv_cont_set_layout(mbox, LV_LAYOUT_COLUMN_MID);
lv_cont_set_fit2(mbox, LV_FIT_NONE, LV_FIT_TIGHT);
lv_coord_t fit_w = lv_obj_get_width_fit(par);
if(lv_disp_get_size_category(NULL) <= LV_DISP_SIZE_SMALL) {
lv_obj_set_width(mbox, fit_w);
}
else {
lv_obj_set_width(mbox, LV_MATH_MIN(fit_w, LV_DPX(400)));
}
lv_obj_align(mbox, NULL, LV_ALIGN_CENTER, 0, 0);
lv_obj_set_event_cb(mbox, lv_msgbox_default_event_cb);
/*Set the default styles*/
lv_theme_apply(mbox, LV_THEME_MSGBOX);
}
/*Copy an existing message box*/
else {
lv_msgbox_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->text = lv_label_create(mbox, copy_ext->text);
/*Copy the buttons and the label on them*/
if(copy_ext->btnm) ext->btnm = lv_btnmatrix_create(mbox, copy_ext->btnm);
/*Refresh the style with new signal function*/
lv_obj_refresh_style(mbox, LV_STYLE_PROP_ALL);
}
LV_LOG_INFO("message box created");
return mbox;
}
/*======================
* Add/remove functions
*=====================*/
/**
* Add button to the message box
* @param mbox pointer to message box object
* @param btn_map button descriptor (button matrix map).
* E.g. a const char *txt[] = {"ok", "close", ""} (Can not be local variable)
*/
void lv_msgbox_add_btns(lv_obj_t * mbox, const char * btn_map[])
{
LV_ASSERT_OBJ(mbox, LV_OBJX_NAME);
LV_ASSERT_NULL(btn_map);
lv_msgbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
/*Create a button matrix if not exists yet*/
if(ext->btnm == NULL) {
ext->btnm = lv_btnmatrix_create(mbox, NULL);
lv_theme_apply(mbox, LV_THEME_MSGBOX_BTNS);
}
lv_btnmatrix_set_map(ext->btnm, btn_map);
lv_btnmatrix_set_btn_ctrl_all(ext->btnm, LV_BTNMATRIX_CTRL_CLICK_TRIG | LV_BTNMATRIX_CTRL_NO_REPEAT);
lv_obj_set_event_cb(ext->btnm, lv_msgbox_btnm_event_cb);
if(lv_obj_is_focused(mbox)) {
lv_state_t state = lv_obj_get_state(mbox, LV_MSGBOX_PART_BG);
if(state & LV_STATE_EDITED) {
lv_obj_set_state(ext->btnm, LV_STATE_FOCUSED | LV_STATE_EDITED);
}
else {
lv_obj_set_state(ext->btnm, LV_STATE_FOCUSED);
}
lv_btnmatrix_set_focused_btn(ext->btnm, 0);
}
mbox_realign(mbox);
}
/*=====================
* Setter functions
*====================*/
/**
* Set the text of the message box
* @param mbox pointer to a message box
* @param txt a '\0' terminated character string which will be the message box text
*/
void lv_msgbox_set_text(lv_obj_t * mbox, const char * txt)
{
LV_ASSERT_OBJ(mbox, LV_OBJX_NAME);
LV_ASSERT_STR(txt);
lv_msgbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
lv_label_set_text(ext->text, txt);
mbox_realign(mbox);
}
/**
* Set animation duration
* @param mbox pointer to a message box object
* @param anim_time animation length in milliseconds (0: no animation)
*/
void lv_msgbox_set_anim_time(lv_obj_t * mbox, uint16_t anim_time)
{
LV_ASSERT_OBJ(mbox, LV_OBJX_NAME);
#if LV_USE_ANIMATION
lv_msgbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
anim_time = 0;
ext->anim_time = anim_time;
#else
(void)mbox;
(void)anim_time;
#endif
}
/**
* Automatically delete the message box after a given time
* @param mbox pointer to a message box object
* @param delay a time (in milliseconds) to wait before delete the message box
*/
void lv_msgbox_start_auto_close(lv_obj_t * mbox, uint16_t delay)
{
LV_ASSERT_OBJ(mbox, LV_OBJX_NAME);
#if LV_USE_ANIMATION
if(lv_msgbox_get_anim_time(mbox) != 0) {
/*Add shrinking animations*/
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, mbox);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_height);
lv_anim_set_values(&a, lv_obj_get_height(mbox), 0);
lv_anim_set_time(&a, lv_msgbox_get_anim_time(mbox));
lv_anim_set_delay(&a, delay);
lv_anim_start(&a);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_width);
lv_anim_set_values(&a, lv_obj_get_width(mbox), 0);
lv_anim_set_ready_cb(&a, lv_msgbox_close_ready_cb);
lv_anim_start(&a);
/*Disable fit to let shrinking work*/
lv_cont_set_fit(mbox, LV_FIT_NONE);
}
else {
/*Create an animation to delete the mbox `delay` ms later*/
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, mbox);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)NULL);
lv_anim_set_values(&a, 0, 1);
lv_anim_set_ready_cb(&a, lv_msgbox_close_ready_cb);
lv_anim_set_time(&a, lv_msgbox_get_anim_time(mbox));
lv_anim_set_delay(&a, delay);
lv_anim_start(&a);
}
#else
(void)delay; /*Unused*/
lv_obj_del(mbox);
#endif
}
/**
* Stop the auto. closing of message box
* @param mbox pointer to a message box object
*/
void lv_msgbox_stop_auto_close(lv_obj_t * mbox)
{
LV_ASSERT_OBJ(mbox, LV_OBJX_NAME);
#if LV_USE_ANIMATION
lv_anim_del(mbox, NULL);
#else
(void)mbox; /*Unused*/
#endif
}
/**
* Set whether recoloring is enabled
* @param mbox pointer to message box object
* @param en whether recoloring is enabled
*/
void lv_msgbox_set_recolor(lv_obj_t * mbox, bool en)
{
LV_ASSERT_OBJ(mbox, LV_OBJX_NAME);
lv_msgbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
if(ext->btnm) lv_btnmatrix_set_recolor(ext->btnm, en);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the text of the message box
* @param mbox pointer to a message box object
* @return pointer to the text of the message box
*/
const char * lv_msgbox_get_text(const lv_obj_t * mbox)
{
LV_ASSERT_OBJ(mbox, LV_OBJX_NAME);
lv_msgbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
return lv_label_get_text(ext->text);
}
/**
* Get the index of the lastly "activated" button by the user (pressed, released etc)
* Useful in the the `event_cb`.
* @param mbox pointer to message box object
* @return index of the last released button (LV_BTNMATRIX_BTN_NONE: if unset)
*/
uint16_t lv_msgbox_get_active_btn(lv_obj_t * mbox)
{
LV_ASSERT_OBJ(mbox, LV_OBJX_NAME);
lv_msgbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
if(ext->btnm == NULL) return LV_BTNMATRIX_BTN_NONE;
uint16_t id = lv_btnmatrix_get_active_btn(ext->btnm);
if(id == LV_BTNMATRIX_BTN_NONE) {
id = lv_btnmatrix_get_focused_btn(ext->btnm);
}
return id;
}
/**
* Get the text of the lastly "activated" button by the user (pressed, released etc)
* Useful in the the `event_cb`.
* @param mbox pointer to message box object
* @return text of the last released button (NULL: if unset)
*/
const char * lv_msgbox_get_active_btn_text(lv_obj_t * mbox)
{
LV_ASSERT_OBJ(mbox, LV_OBJX_NAME);
lv_msgbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
if(ext->btnm)
return lv_btnmatrix_get_active_btn_text(ext->btnm);
else
return NULL;
}
/**
* Get the animation duration (close animation time)
* @param mbox pointer to a message box object
* @return animation length in milliseconds (0: no animation)
*/
uint16_t lv_msgbox_get_anim_time(const lv_obj_t * mbox)
{
LV_ASSERT_OBJ(mbox, LV_OBJX_NAME);
#if LV_USE_ANIMATION
lv_msgbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
return ext->anim_time;
#else
(void)mbox;
return 0;
#endif
}
/**
* Get whether recoloring is enabled
* @param mbox pointer to a message box object
* @return whether recoloring is enabled
*/
bool lv_msgbox_get_recolor(const lv_obj_t * mbox)
{
LV_ASSERT_OBJ(mbox, LV_OBJX_NAME);
lv_msgbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
if(!ext->btnm) return false;
return lv_btnmatrix_get_recolor(ext->btnm);
}
/**
* Get message box button matrix
* @param mbox pointer to a message box object
* @return pointer to button matrix object
* @remarks return value will be NULL unless `lv_msgbox_add_btns` has been already called
*/
lv_obj_t * lv_msgbox_get_btnmatrix(lv_obj_t * mbox)
{
LV_ASSERT_OBJ(mbox, LV_OBJX_NAME);
lv_msgbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
return ext->btnm;
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Signal function of the message box
* @param mbox pointer to a message box object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_msgbox_signal(lv_obj_t * mbox, lv_signal_t sign, void * param)
{
lv_res_t res;
#if LV_USE_GROUP
/*Translate LV_KEY_UP/DOWN to LV_KEY_LEFT/RIGHT */
char c_trans = 0;
if(sign == LV_SIGNAL_CONTROL) {
c_trans = *((char *)param);
if(c_trans == LV_KEY_DOWN) c_trans = LV_KEY_LEFT;
if(c_trans == LV_KEY_UP) c_trans = LV_KEY_RIGHT;
param = &c_trans;
}
#endif
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_msgbox_get_style(mbox, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(mbox, sign, param);
}
else if(sign == LV_SIGNAL_GET_STATE_DSC) {
lv_get_state_info_t * info = param;
lv_msgbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
if(ext->btnm && info->part == LV_MSGBOX_PART_BTN_BG) {
info->result = lv_obj_get_state(ext->btnm, LV_BTNMATRIX_PART_BG);
}
else if(ext->btnm && info->part == LV_MSGBOX_PART_BTN) {
info->result = lv_obj_get_state(ext->btnm, LV_BTNMATRIX_PART_BTN);
}
return LV_RES_OK;
}
/* Include the ancient signal function */
res = ancestor_signal(mbox, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
lv_msgbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
if(sign == LV_SIGNAL_COORD_CHG) {
if(lv_obj_get_width(mbox) != lv_area_get_width(param)) {
mbox_realign(mbox);
}
}
else if(sign == LV_SIGNAL_STYLE_CHG) {
mbox_realign(mbox);
}
else if(sign == LV_SIGNAL_RELEASED) {
if(ext->btnm) {
uint32_t btn_id = lv_btnmatrix_get_focused_btn(ext->btnm);
if(btn_id != LV_BTNMATRIX_BTN_NONE) lv_event_send(mbox, LV_EVENT_VALUE_CHANGED, &btn_id);
}
}
else if(
#if LV_USE_GROUP
sign == LV_SIGNAL_CONTROL || sign == LV_SIGNAL_GET_EDITABLE ||
#endif
sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS) {
if(ext->btnm) {
ext->btnm->signal_cb(ext->btnm, sign, param);
}
/* The button matrix with ENCODER input supposes it's in a group but in this case it isn't
* (Only the message box's container) So so some actions here instead*/
#if LV_USE_GROUP
if(sign == LV_SIGNAL_FOCUS) {
lv_indev_t * indev = lv_indev_get_act();
lv_indev_type_t indev_type = lv_indev_get_type(indev);
if(indev_type == LV_INDEV_TYPE_ENCODER) {
/*In navigation mode don't select any button but in edit mode select the fist*/
if(lv_group_get_editing(lv_obj_get_group(mbox))) lv_btnmatrix_set_focused_btn(ext->btnm, 0);
else lv_btnmatrix_set_focused_btn(ext->btnm, LV_BTNMATRIX_BTN_NONE);
}
}
if(ext->btnm && (sign == LV_SIGNAL_FOCUS || sign == LV_SIGNAL_DEFOCUS)) {
lv_state_t state = lv_obj_get_state(mbox, LV_MSGBOX_PART_BG);
if(state & LV_STATE_FOCUSED) {
lv_obj_set_state(ext->btnm, LV_STATE_FOCUSED);
}
else {
lv_obj_clear_state(ext->btnm, LV_STATE_FOCUSED);
}
if(state & LV_STATE_EDITED) {
lv_obj_set_state(ext->btnm, LV_STATE_EDITED);
}
else {
lv_obj_clear_state(ext->btnm, LV_STATE_EDITED);
}
}
#endif
}
return res;
}
/**
* Get the style descriptor of a part of the object
* @param mbox pointer the object
* @param part the part from `lv_msgbox_part_t`. (LV_MSGBOX_PART_...)
* @return pointer to the style descriptor of the specified part
*/
static lv_style_list_t * lv_msgbox_get_style(lv_obj_t * mbox, uint8_t part)
{
LV_ASSERT_OBJ(mbox, LV_OBJX_NAME);
lv_msgbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
lv_style_list_t * style_dsc_p;
switch(part) {
case LV_MSGBOX_PART_BG:
style_dsc_p = &mbox->style_list;
break;
case LV_MSGBOX_PART_BTN_BG:
style_dsc_p = ext->btnm ? lv_obj_get_style_list(ext->btnm, LV_BTNMATRIX_PART_BG) : NULL;
break;
case LV_MSGBOX_PART_BTN:
style_dsc_p = ext->btnm ? lv_obj_get_style_list(ext->btnm, LV_BTNMATRIX_PART_BTN) : NULL;
break;
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
/**
* Resize the button holder to fit
* @param mbox pointer to message box object
*/
static void mbox_realign(lv_obj_t * mbox)
{
lv_msgbox_ext_t * ext = lv_obj_get_ext_attr(mbox);
lv_coord_t w = lv_obj_get_width_fit(mbox);
if(ext->text) {
lv_obj_set_width(ext->text, w);
}
if(ext->btnm) {
lv_style_int_t bg_top = lv_obj_get_style_pad_top(mbox, LV_MSGBOX_PART_BTN_BG);
lv_style_int_t bg_bottom = lv_obj_get_style_pad_bottom(mbox, LV_MSGBOX_PART_BTN_BG);
lv_style_int_t bg_inner = lv_obj_get_style_pad_inner(mbox, LV_MSGBOX_PART_BTN_BG);
lv_style_int_t btn_top = lv_obj_get_style_pad_top(mbox, LV_MSGBOX_PART_BTN);
lv_style_int_t btn_bottom = lv_obj_get_style_pad_bottom(mbox, LV_MSGBOX_PART_BTN);
const lv_font_t * font = lv_obj_get_style_text_font(mbox, LV_MSGBOX_PART_BTN);
uint16_t btnm_lines = 1;
const char ** btnm_map = lv_btnmatrix_get_map_array(ext->btnm);
uint16_t i;
for(i = 0; btnm_map[i][0] != '\0'; i++) {
if(btnm_map[i][0] == '\n') btnm_lines++;
}
lv_coord_t font_h = lv_font_get_line_height(font);
lv_coord_t btn_h = font_h + btn_top + btn_bottom;
lv_obj_set_size(ext->btnm, w, btn_h * btnm_lines + bg_inner * (btnm_lines - 1) + bg_top + bg_bottom);
}
}
#if LV_USE_ANIMATION
static void lv_msgbox_close_ready_cb(lv_anim_t * a)
{
lv_obj_del(a->var);
}
#endif
static void lv_msgbox_default_event_cb(lv_obj_t * mbox, lv_event_t event)
{
if(event != LV_EVENT_VALUE_CHANGED) return;
uint32_t btn_id = lv_msgbox_get_active_btn(mbox);
if(btn_id == LV_BTNMATRIX_BTN_NONE) return;
lv_msgbox_start_auto_close(mbox, 0);
}
static void lv_msgbox_btnm_event_cb(lv_obj_t * btnm, lv_event_t event)
{
lv_obj_t * mbox = lv_obj_get_parent(btnm);
/*clang-format off*/
if(event == LV_EVENT_PRESSED || event == LV_EVENT_PRESSING || event == LV_EVENT_PRESS_LOST ||
event == LV_EVENT_RELEASED || event == LV_EVENT_SHORT_CLICKED || event == LV_EVENT_CLICKED ||
event == LV_EVENT_LONG_PRESSED || event == LV_EVENT_LONG_PRESSED_REPEAT ||
event == LV_EVENT_VALUE_CHANGED) {
lv_event_send(mbox, event, lv_event_get_data());
}
/*clang-format on*/
}
#endif
|
train_000.parquet/980
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_msgbox.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 18322,
"token_count": 7444
}
|
## All my scripts, tools and guides
<img src="https://hitscounter.dev/api/hit?url=https%3A%2F%2F007revad.github.io%2F&label=Visitors&icon=github&color=%23198754&message=&style=flat&tz=UTC">
#### Contents
- [Plex](#plex)
- [Synology docker](#synology-docker)
- [Synology recovery](#synology-recovery)
- [Other Synology scripts](#other-synology-scripts)
- [Synology hardware restrictions](#synology-hardware-restrictions)
- [2025 plus models](#2025-plus-models)
- [How To Guides](#how-to-guides)
- [Synology dev](#synology-dev)
***
### Plex
- **<a href="https://github.com/007revad/Synology_Plex_Backup">Synology_Plex_Backup</a>**
- A script to backup Plex to a tgz file foror DSM 7 and DSM 6.
- Works for Plex Synology package and Plex in docker.
- **<a href="https://github.com/007revad/Asustor_Plex_Backup">Asustor_Plex_Backup</a>**
- Backup your Asustor's Plex Media Server settings and database.
- **<a href="https://github.com/007revad/Linux_Plex_Backup">Linux_Plex_Backup</a>**
- Backup your Linux Plex Media Server's settings and database.
- **<a href="https://github.com/007revad/Plex_Server_Sync">Plex_Server_Sync</a>**
- Sync your main Plex server database & metadata to a backup Plex server.
- Works for Synology, Asustor, Linux and supports Plex package or Plex in docker.
[Back to Contents](#contents)
### Synology docker
- **<a href="https://github.com/007revad/Synology_Docker_Export">Synology_Docker_export</a>**
- Export all Synology Container Manager or Docker containers' settings as json files to your docker shared folder.
- **<a href="https://github.com/007revad/Synology_ContainerManager_IPv6">Synology_ContainerManager_IPv6</a>**
- Enable IPv6 for Container Manager's bridge network.
- **<a href="https://github.com/007revad/ContainerManager_for_all_armv8">ContainerManager_for_all_armv8</a>**
- Script to install Container Manager on a RS819, DS119j, DS418, DS418j, DS218, DS218play or DS118.
- **<a href="https://github.com/007revad/Docker_Autocompose">Docker_Autocompose</a>**
- Create .yml files from your docker existing containers.
- **<a href="https://github.com/007revad/Synology_docker_cleanup">Synology_docker_cleanup</a>**
- Remove orphan docker btrfs subvolumes and images in Synology DSM 7 and DSM 6.
[Back to Contents](#contents)
### Synology recovery
- **<a href="https://github.com/007revad/Synology_DSM_reinstall">Synology_DSM_reinstall</a>**
- Easily re-install the same DSM version without losing any data or settings.
- **<a href="https://github.com/007revad/Synology_Recover_Data">Synology_Recover_Data</a>**
- A script to make it easy to recover your data from your Synology's drives using a computer.
- **<a href="https://github.com/007revad/Synology_clear_drive_error">Synology clear drive error</a>**
- Clear drive critical errors so DSM will let you use the drive.
- **<a href="https://github.com/007revad/Synology_DSM_Telnet_Password">Synology_DSM_Telnet_Password</a>**
- Synology DSM Recovery Telnet Password of the Day generator.
- **<a href="https://github.com/007revad/Syno_DSM_Extractor_GUI">Syno_DSM_Extractor_GUI</a>**
- Windows GUI for extracting Synology DSM 7 pat files and spk package files.
- **<a href="https://github.com/007revad/Synoboot_backup">Synoboot_backup</a>**
- Back up synoboot after each DSM update so you can recover from a corrupt USBDOM.
[Back to Contents](#contents)
### Other Synology scripts
- **<a href="https://github.com/007revad/Synology_app_mover">Synology_app_mover</a>**
- Easily move Synology packages from one volume to another volume.
- **<a href="https://github.com/007revad/Video_Station_for_DSM_722">Video_Station_for_DSM_722</a>**
- Script to install Video Station in DSM 7.2.2
- **<a href="https://github.com/007revad/SS_Motion_Detection">SS_Motion_Detection</a>**
- Installs previous Surveillance Station and Advanced Media Extensions versions so motion detection and HEVC are supported.
- **<a href="https://github.com/007revad/Synology_Config_Backup">Synology_Config_Backup</a>**
- Backup and export your Synology DSM configuration.
- **<a href="https://github.com/007revad/Synology_CPU_temperature">Synology_CPU_temperature</a>**
- Get and log Synology NAS CPU temperature via SSH.
- **<a href="https://github.com/007revad/Synology_SMART_info">Synology_SMART_info</a>**
- Show Synology smart test progress or smart health and attributes.
- **<a href="https://github.com/007revad/Synology_Cleanup_Coredumps">Synology_Cleanup_Coredumps</a>**
- Cleanup memory core dumps from crashed processes.
- **<a href="https://github.com/007revad/Synology_toggle_reset_button">Synology_toggle_reset_button</a>**
- Script to disable or enable the reset button and show current setting.
- **<a href="https://github.com/007revad/Synology_Download_Station_Chrome_Extension">Synology_Download_Station_Chrome_Extension</a>**
- Download Station Chrome Extension.
- **<a href="https://github.com/007revad/Seagate_lowCurrentSpinup">Seagate_lowCurrentSpinup</a>**
- This script avoids the need to buy and install a higher wattage power supply when using multiple large Seagate SATA HDDs.
[Back to Contents](#contents)
### Synology hardware restrictions
- **<a href="https://github.com/007revad/Synology_HDD_db">Synology_HDD_db</a>**
- Add your SATA or SAS HDDs and SSDs plus SATA and NVMe M.2 drives to your Synology's compatible drive databases, including your Synology M.2 PCIe card and Expansion Unit databases.
- **<a href="https://github.com/007revad/Synology_enable_M2_volume">Synology_enable_M2_volume</a>**
- Enable creating volumes with non-Synology M.2 drives.
- Enable Health Info for non-Synology NVMe drives (not in DSM 7.2.1 or later).
- **<a href="https://github.com/007revad/Synology_M2_volume">Synology_M2_volume</a>**
- Easily create an M.2 volume on Synology NAS.
- **<a href="https://github.com/007revad/Synology_enable_M2_card">Synology_enable_M2_card</a>**
- Enable Synology M.2 PCIe cards in Synology NAS that don't officially support them.
- **<a href="https://github.com/007revad/Synology_enable_eunit">Synology_enable_eunit</a>**
- Enable an unsupported Synology eSATA Expansion Unit models.
- **<a href="https://github.com/007revad/Synology_enable_Deduplication">Synology_enable_Deduplication</a>**
- Enable deduplication with non-Synology SSDs and unsupported NAS models.
- **<a href="https://github.com/007revad/Synology_SHR_switch">Synology_SHR_switch</a>**
- Easily switch between SHR and RAID Groups, or enable RAID F1.
- **<a href="https://github.com/007revad/Synology_enable_sequential_IO">Synology_enable_sequential_IO</a>**
- Enables sequential I/O for your SSD caches, like DSM 6 had.
- **<a href="https://github.com/007revad/Synology_Information_Wiki">Synology_Information_Wiki</a>**
- Information about Synology hardware.
[Back to Contents](#contents)
### 2025 plus models
- **<a href="https://github.com/007revad/Transcode_for_x25">Transcode_for_x25</a>**
- Installs the modules needed for Plex or Jellyfin hardware transcoding in DS425+ and DS225+.
- **<a href="https://github.com/007revad/Synology_HDD_db/blob/main/2025_plus_models.md">2025 series or later Plus models</a>**
- Unverified 3rd party drive limitations and unofficial solutions.
- **<a href="https://github.com/007revad/Synology_HDD_db/blob/main/2025_plus_models.md#setting-up-a-new-2025-or-later-plus-model-with-only-unverified-hdds">Setup with only 3rd party drives</a>**
- Setting up a new 2025 or later plus model with only unverified HDDs.
- **<a href="https://github.com/007revad/Synology_HDD_db/blob/main/2025_plus_models.md#deleting-and-recreating-your-storage-pool-on-unverified-hdds">Recreating storage pool on migrated drives</a>**
- Deleting and recreating your storage pool on unverified HDDs.
[Back to Contents](#contents)
### How To Guides
- **<a href="https://github.com/007revad/Synology_SSH_key_setup">Synology_SSH_key_setup</a>**
- How to setup SSH key authentication for your Synology.
[Back to Contents](#contents)
### Synology dev
- **<a href="https://github.com/007revad/Download_Synology_Archive">Download_Synology_Archive</a>**
- Download all or part of the Synology archive.
- **<a href="https://github.com/007revad/Syno_DSM_Extractor_GUI">Syno_DSM_Extractor_GUI</a>**
- Windows GUI for extracting Synology DSM 7 pat files and spk package files.
- **<a href="https://github.com/007revad/ScriptNotify">ScriptNotify</a>**
- DSM 7 package to allow your scripts to send DSM notifications.
- **<a href="https://github.com/007revad/DTC_GUI_for_Windows">DTC_GUI_for_Windows</a>**
- GUI for DTC.exe for Windows.
[Back to Contents](#contents)
|
train_000.parquet/981
|
{
"file_path": "my-other-scripts.md",
"repo_id": "007revad/Synology_SMART_info",
"size": 9099,
"token_count": 3421
}
|
# Synology SMART info
<a href="https://github.com/007revad/Synology_SMART_info/releases"><img src="https://img.shields.io/github/release/007revad/Synology_SMART_info.svg"></a>

[](https://www.paypal.com/paypalme/007revad)
[](https://github.com/sponsors/007revad)
[](https://user-badge.committers.top/australia/007revad)
<!-- [](https://user-badge.committers.top/australia_public/007revad) -->
<!-- [](https://user-badge.committers.top/australia_private/007revad) -->
<!-- [](https://github.com/007revad/Synology_SMART_info/releases) -->
### Description
Show Synology smart test progress or smart health and attributes.
The script works in DSM 7, including DSM 7.2, and DSM 6.
## Download the script
1. Download the latest version _Source code (zip)_ from https://github.com/007revad/Synology_SMART_info/releases
2. Save the download zip file to a folder on the Synology.
3. Unzip the zip file.
## How to run the script
### Run the script via SSH
[How to enable SSH and login to DSM via SSH](https://kb.synology.com/en-global/DSM/tutorial/How_to_login_to_DSM_with_root_permission_via_SSH_Telnet)
Run the script:
```bash
sudo -s /volume1/scripts/syno_smart_info.sh
```
> **Note** <br>
> Replace /volume1/scripts/ with the path to where the script is located.
To see all the SMART attributes run the script with the -a or --all option:
```bash
sudo -s /volume1/scripts/syno_smart_info.sh --all
```
> **Note** <br>
> The script automatically shows all SMART attributes for any drives that don't return "SMART test passed".
### Scheduling the script in Synology's Task Scheduler
See <a href=how_to_schedule.md/>How to schedule a script in Synology Task Scheduler</a>
### Options when running the script <a name="options"></a>
There are optional flags you can use when running the script:
```YAML
-a, --all Show all SMART attributes
-e, --email Disable colored text in output scheduler emails
-h, --help Show this help message
-v, --version Show the script version
```
## Optional for Seagate drives
If you have Seagate drives you should install SynoCommunity's [SynoCli Disk Tools v4.0-13 or later](https://synocommunity.com/package/synocli-disk) package so this script can decode the values of Seagate's SMART attributes 1, 7 and 195. SynoCli Disk Tools v4.0-13 includes smartmontools v7.4
<p align="center">Seagate HDD with DSM's smartctl 6.5</p>
<p align="center"><img src="/images/seagate_smartctl_65.png"></p>
<p align="center">Seagate HDD with SynoCommunity's smartctl 7.4</p>
<p align="center"><img src="/images/seagate_smartctl_7.png"></p>
## Screenshots
<p align="center">All healthy</p>
<p align="center"><img src="/images/webber_wd.png"></p>
<p align="center">One drive marginal</p>
<p align="center"><img src="/images/oscar_seagate.png"></p>
<p align="center">UDMA CRC Errors</p>
<p align="center"><img src="/images/webber_udma_errors.png"></p>
<p align="center">NVMe drives removed while NAS was running</p>
<p align="center"><img src="/images/oscar_wd_nvme.png"></p>
<p align="center">SSD with reallocated sectors</p>
<p align="center"><img src="/images/senna.png"></p>
<p align="center">HDD and SSD when run with --all option</p>
<p align="center"><img src="/images/hdd_ssd_all.png"></p>
<p align="center">HDD and NVMe when run with --all option</p>
<p align="center"><img src="/images/hdd_nvme_all.png"></p>
|
train_000.parquet/982
|
{
"file_path": "README.md",
"repo_id": "007revad/Synology_SMART_info",
"size": 4103,
"token_count": 1585
}
|
/**
* @file lv_line.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_line.h"
#if LV_USE_LINE != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_misc/lv_math.h"
#include "../lv_themes/lv_theme.h"
#include <stdbool.h>
#include <stdint.h>
#include <string.h>
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_line"
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_design_res_t lv_line_design(lv_obj_t * line, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a line objects
* @param par pointer to an object, it will be the parent of the new line
* @return pointer to the created line
*/
lv_obj_t * lv_line_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("line create started");
/*Create a basic object*/
lv_obj_t * line = lv_obj_create(par, copy);
LV_ASSERT_MEM(line);
if(line == NULL) return NULL;
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(line);
/*Extend the basic object to line object*/
lv_line_ext_t * ext = lv_obj_allocate_ext_attr(line, sizeof(lv_line_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(line);
return NULL;
}
ext->point_num = 0;
ext->point_array = NULL;
ext->auto_size = 1;
ext->y_inv = 0;
lv_obj_set_design_cb(line, lv_line_design);
lv_obj_set_signal_cb(line, lv_line_signal);
/*Init the new line*/
if(copy == NULL) {
lv_obj_set_size(line, LV_DPI,
LV_DPI); /*Auto size is enables, but set default size until no points are added*/
lv_obj_set_click(line, false);
lv_theme_apply(line, LV_THEME_LINE);
}
/*Copy an existing object*/
else {
lv_line_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
lv_line_set_auto_size(line, lv_line_get_auto_size(copy));
lv_line_set_y_invert(line, lv_line_get_y_invert(copy));
lv_line_set_auto_size(line, lv_line_get_auto_size(copy));
lv_line_set_points(line, copy_ext->point_array, copy_ext->point_num);
/*Refresh the style with new signal function*/
lv_obj_refresh_style(line, LV_STYLE_PROP_ALL);
}
LV_LOG_INFO("line created");
return line;
}
/*=====================
* Setter functions
*====================*/
/**
* Set an array of points. The line object will connect these points.
* @param line pointer to a line object
* @param point_a an array of points. Only the address is saved,
* so the array can NOT be a local variable which will be destroyed
* @param point_num number of points in 'point_a'
*/
void lv_line_set_points(lv_obj_t * line, const lv_point_t point_a[], uint16_t point_num)
{
LV_ASSERT_OBJ(line, LV_OBJX_NAME);
lv_line_ext_t * ext = lv_obj_get_ext_attr(line);
ext->point_array = point_a;
ext->point_num = point_num;
if(point_num > 0 && ext->auto_size != 0) {
uint16_t i;
lv_coord_t xmax = LV_COORD_MIN;
lv_coord_t ymax = LV_COORD_MIN;
for(i = 0; i < point_num; i++) {
xmax = LV_MATH_MAX(point_a[i].x, xmax);
ymax = LV_MATH_MAX(point_a[i].y, ymax);
}
lv_style_int_t line_width = lv_obj_get_style_line_width(line, LV_LINE_PART_MAIN);
lv_obj_set_size(line, xmax + line_width, ymax + line_width);
}
lv_obj_invalidate(line);
}
/**
* Enable (or disable) the auto-size option. The size of the object will fit to its points.
* (set width to x max and height to y max)
* @param line pointer to a line object
* @param en true: auto size is enabled, false: auto size is disabled
*/
void lv_line_set_auto_size(lv_obj_t * line, bool en)
{
LV_ASSERT_OBJ(line, LV_OBJX_NAME);
lv_line_ext_t * ext = lv_obj_get_ext_attr(line);
if(ext->auto_size == en) return;
ext->auto_size = en == false ? 0 : 1;
/*Refresh the object*/
if(en) lv_line_set_points(line, ext->point_array, ext->point_num);
}
/**
* Enable (or disable) the y coordinate inversion.
* If enabled then y will be subtracted from the height of the object,
* therefore the y=0 coordinate will be on the bottom.
* @param line pointer to a line object
* @param en true: enable the y inversion, false:disable the y inversion
*/
void lv_line_set_y_invert(lv_obj_t * line, bool en)
{
LV_ASSERT_OBJ(line, LV_OBJX_NAME);
lv_line_ext_t * ext = lv_obj_get_ext_attr(line);
if(ext->y_inv == en) return;
ext->y_inv = en == false ? 0 : 1;
lv_obj_invalidate(line);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the auto size attribute
* @param line pointer to a line object
* @return true: auto size is enabled, false: disabled
*/
bool lv_line_get_auto_size(const lv_obj_t * line)
{
LV_ASSERT_OBJ(line, LV_OBJX_NAME);
lv_line_ext_t * ext = lv_obj_get_ext_attr(line);
return ext->auto_size == 0 ? false : true;
}
/**
* Get the y inversion attribute
* @param line pointer to a line object
* @return true: y inversion is enabled, false: disabled
*/
bool lv_line_get_y_invert(const lv_obj_t * line)
{
LV_ASSERT_OBJ(line, LV_OBJX_NAME);
lv_line_ext_t * ext = lv_obj_get_ext_attr(line);
return ext->y_inv == 0 ? false : true;
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the lines
* @param line pointer to an object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_line_design(lv_obj_t * line, const lv_area_t * clip_area, lv_design_mode_t mode)
{
/*A line never covers an area*/
if(mode == LV_DESIGN_COVER_CHK)
return LV_DESIGN_RES_NOT_COVER;
else if(mode == LV_DESIGN_DRAW_MAIN) {
lv_line_ext_t * ext = lv_obj_get_ext_attr(line);
if(ext->point_num == 0 || ext->point_array == NULL) return false;
lv_area_t area;
lv_obj_get_coords(line, &area);
lv_coord_t x_ofs = area.x1;
lv_coord_t y_ofs = area.y1;
lv_point_t p1;
lv_point_t p2;
lv_coord_t h = lv_obj_get_height(line);
uint16_t i;
lv_draw_line_dsc_t line_dsc;
lv_draw_line_dsc_init(&line_dsc);
lv_obj_init_draw_line_dsc(line, LV_LINE_PART_MAIN, &line_dsc);
/*Read all points and draw the lines*/
for(i = 0; i < ext->point_num - 1; i++) {
p1.x = ext->point_array[i].x + x_ofs;
p2.x = ext->point_array[i + 1].x + x_ofs;
if(ext->y_inv == 0) {
p1.y = ext->point_array[i].y + y_ofs;
p2.y = ext->point_array[i + 1].y + y_ofs;
}
else {
p1.y = h - ext->point_array[i].y + y_ofs;
p2.y = h - ext->point_array[i + 1].y + y_ofs;
}
lv_draw_line(&p1, &p2, clip_area, &line_dsc);
line_dsc.round_start = 0; /*Draw the rounding only on the end points after the first line*/
}
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the line
* @param line pointer to a line object
* @param sign a signal type from lv_signal_t enum
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_line_signal(lv_obj_t * line, lv_signal_t sign, void * param)
{
lv_res_t res;
/* Include the ancient signal function */
res = ancestor_signal(line, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
if(sign == LV_SIGNAL_REFR_EXT_DRAW_PAD) {
/*The corner of the skew lines is out of the intended area*/
lv_style_int_t line_width = lv_obj_get_style_line_width(line, LV_LINE_PART_MAIN);
if(line->ext_draw_pad < line_width) line->ext_draw_pad = line_width;
}
return res;
}
#endif
|
train_000.parquet/983
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_line.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 8713,
"token_count": 3309
}
|
/**
* @file lv_win.h
*
*/
#ifndef LV_WIN_H
#define LV_WIN_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_WIN != 0
/*Testing of dependencies*/
#if LV_USE_BTN == 0
#error "lv_win: lv_btn is required. Enable it in lv_conf.h (LV_USE_BTN 1) "
#endif
#if LV_USE_LABEL == 0
#error "lv_win: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
#endif
#if LV_USE_IMG == 0
#error "lv_win: lv_img is required. Enable it in lv_conf.h (LV_USE_IMG 1) "
#endif
#if LV_USE_PAGE == 0
#error "lv_win: lv_page is required. Enable it in lv_conf.h (LV_USE_PAGE 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "lv_cont.h"
#include "lv_btn.h"
#include "lv_label.h"
#include "lv_img.h"
#include "lv_page.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of window*/
typedef struct {
/*Ext. of ancestor*/
/*New data for this type */
lv_obj_t * page; /*Pointer to a page which holds the content*/
lv_obj_t * header; /*Pointer to the header container of the window*/
char * title_txt; /*Pointer to the title label of the window*/
lv_coord_t btn_w; /*Width of the control buttons*/
} lv_win_ext_t;
/** Window parts. */
enum {
LV_WIN_PART_BG = LV_OBJ_PART_MAIN, /**< Window object background style. */
_LV_WIN_PART_VIRTUAL_LAST,
LV_WIN_PART_HEADER = _LV_OBJ_PART_REAL_LAST, /**< Window titlebar background style. */
LV_WIN_PART_CONTENT_SCROLLABLE, /**< Window content style. */
LV_WIN_PART_SCROLLBAR, /**< Window scrollbar style. */
_LV_WIN_PART_REAL_LAST
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a window objects
* @param par pointer to an object, it will be the parent of the new window
* @param copy pointer to a window object, if not NULL then the new object will be copied from it
* @return pointer to the created window
*/
lv_obj_t * lv_win_create(lv_obj_t * par, const lv_obj_t * copy);
/**
* Delete all children of the scrl object, without deleting scrl child.
* @param win pointer to an object
*/
void lv_win_clean(lv_obj_t * win);
/*======================
* Add/remove functions
*=====================*/
/**
* Add control button on the right side of the window header
* @param win pointer to a window object
* @param img_src an image source ('lv_img_t' variable, path to file or a symbol)
* @return pointer to the created button object
*/
lv_obj_t * lv_win_add_btn_right(lv_obj_t * win, const void * img_src);
/**
* Add control button on the left side of the window header
* @param win pointer to a window object
* @param img_src an image source ('lv_img_t' variable, path to file or a symbol)
* @return pointer to the created button object
*/
lv_obj_t * lv_win_add_btn_left(lv_obj_t * win, const void * img_src);
/*=====================
* Setter functions
*====================*/
/**
* Can be assigned to a window control button to close the window
* @param btn pointer to the control button on the widows header
* @param evet the event type
*/
void lv_win_close_event_cb(lv_obj_t * btn, lv_event_t event);
/**
* Set the title of a window
* @param win pointer to a window object
* @param title string of the new title
*/
void lv_win_set_title(lv_obj_t * win, const char * title);
/**
* Set the control button size of a window
* @param win pointer to a window object
* @return control button size
*/
void lv_win_set_header_height(lv_obj_t * win, lv_coord_t size);
/**
* Set the width of the control buttons on the header
* @param win pointer to a window object
* @param width width of the control button. 0: to make them square automatically.
*/
void lv_win_set_btn_width(lv_obj_t * win, lv_coord_t width);
/**
* Set the size of the content area.
* @param win pointer to a window object
* @param w width
* @param h height (the window will be higher with the height of the header)
*/
void lv_win_set_content_size(lv_obj_t * win, lv_coord_t w, lv_coord_t h);
/**
* Set the layout of the window
* @param win pointer to a window object
* @param layout the layout from 'lv_layout_t'
*/
void lv_win_set_layout(lv_obj_t * win, lv_layout_t layout);
/**
* Set the scroll bar mode of a window
* @param win pointer to a window object
* @param sb_mode the new scroll bar mode from 'lv_scrollbar_mode_t'
*/
void lv_win_set_scrollbar_mode(lv_obj_t * win, lv_scrollbar_mode_t sb_mode);
/**
* Set focus animation duration on `lv_win_focus()`
* @param win pointer to a window object
* @param anim_time duration of animation [ms]
*/
void lv_win_set_anim_time(lv_obj_t * win, uint16_t anim_time);
/**
* Set drag status of a window. If set to 'true' window can be dragged like on a PC.
* @param win pointer to a window object
* @param en whether dragging is enabled
*/
void lv_win_set_drag(lv_obj_t * win, bool en);
/*=====================
* Getter functions
*====================*/
/**
* Get the title of a window
* @param win pointer to a window object
* @return title string of the window
*/
const char * lv_win_get_title(const lv_obj_t * win);
/**
* Get the content holder object of window (`lv_page`) to allow additional customization
* @param win pointer to a window object
* @return the Page object where the window's content is
*/
lv_obj_t * lv_win_get_content(const lv_obj_t * win);
/**
* Get the header height
* @param win pointer to a window object
* @return header height
*/
lv_coord_t lv_win_get_header_height(const lv_obj_t * win);
/**
* Get the width of the control buttons on the header
* @param win pointer to a window object
* @return width of the control button. 0: square.
*/
lv_coord_t lv_win_get_btn_width(lv_obj_t * win);
/**
* Get the pointer of a widow from one of its control button.
* It is useful in the action of the control buttons where only button is known.
* @param ctrl_btn pointer to a control button of a window
* @return pointer to the window of 'ctrl_btn'
*/
lv_obj_t * lv_win_get_from_btn(const lv_obj_t * ctrl_btn);
/**
* Get the layout of a window
* @param win pointer to a window object
* @return the layout of the window (from 'lv_layout_t')
*/
lv_layout_t lv_win_get_layout(lv_obj_t * win);
/**
* Get the scroll bar mode of a window
* @param win pointer to a window object
* @return the scroll bar mode of the window (from 'lv_sb_mode_t')
*/
lv_scrollbar_mode_t lv_win_get_sb_mode(lv_obj_t * win);
/**
* Get focus animation duration
* @param win pointer to a window object
* @return duration of animation [ms]
*/
uint16_t lv_win_get_anim_time(const lv_obj_t * win);
/**
* Get width of the content area (page scrollable) of the window
* @param win pointer to a window object
* @return the width of the content area
*/
lv_coord_t lv_win_get_width(lv_obj_t * win);
/**
* Get drag status of a window. If set to 'true' window can be dragged like on a PC.
* @param win pointer to a window object
* @return whether window is draggable
*/
static inline bool lv_win_get_drag(const lv_obj_t * win)
{
return lv_obj_get_drag(win);
}
/*=====================
* Other functions
*====================*/
/**
* Focus on an object. It ensures that the object will be visible in the window.
* @param win pointer to a window object
* @param obj pointer to an object to focus (must be in the window)
* @param anim_en LV_ANIM_ON focus with an animation; LV_ANIM_OFF focus without animation
*/
void lv_win_focus(lv_obj_t * win, lv_obj_t * obj, lv_anim_enable_t anim_en);
/**
* Scroll the window horizontally
* @param win pointer to a window object
* @param dist the distance to scroll (< 0: scroll right; > 0 scroll left)
*/
static inline void lv_win_scroll_hor(lv_obj_t * win, lv_coord_t dist)
{
lv_win_ext_t * ext = (lv_win_ext_t *)lv_obj_get_ext_attr(win);
lv_page_scroll_hor(ext->page, dist);
}
/**
* Scroll the window vertically
* @param win pointer to a window object
* @param dist the distance to scroll (< 0: scroll down; > 0 scroll up)
*/
static inline void lv_win_scroll_ver(lv_obj_t * win, lv_coord_t dist)
{
lv_win_ext_t * ext = (lv_win_ext_t *)lv_obj_get_ext_attr(win);
lv_page_scroll_ver(ext->page, dist);
}
/**********************
* MACROS
**********************/
#endif /*LV_USE_WIN*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_WIN_H*/
|
train_000.parquet/984
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_win.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 8511,
"token_count": 3053
}
|
## All my scripts, tools and guides
<img src="https://hitscounter.dev/api/hit?url=https%3A%2F%2F007revad.github.io%2F&label=Visitors&icon=github&color=%23198754&message=&style=flat&tz=UTC">
#### Contents
- [Plex](#plex)
- [Synology docker](#synology-docker)
- [Synology recovery](#synology-recovery)
- [Other Synology scripts](#other-synology-scripts)
- [Synology hardware restrictions](#synology-hardware-restrictions)
- [2025 plus models](#2025-plus-models)
- [How To Guides](#how-to-guides)
- [Synology dev](#synology-dev)
***
### Plex
- **<a href="https://github.com/007revad/Synology_Plex_Backup">Synology_Plex_Backup</a>**
- A script to backup Plex to a tgz file foror DSM 7 and DSM 6.
- Works for Plex Synology package and Plex in docker.
- **<a href="https://github.com/007revad/Asustor_Plex_Backup">Asustor_Plex_Backup</a>**
- Backup your Asustor's Plex Media Server settings and database.
- **<a href="https://github.com/007revad/Linux_Plex_Backup">Linux_Plex_Backup</a>**
- Backup your Linux Plex Media Server's settings and database.
- **<a href="https://github.com/007revad/Plex_Server_Sync">Plex_Server_Sync</a>**
- Sync your main Plex server database & metadata to a backup Plex server.
- Works for Synology, Asustor, Linux and supports Plex package or Plex in docker.
[Back to Contents](#contents)
### Synology docker
- **<a href="https://github.com/007revad/Synology_Docker_Export">Synology_Docker_export</a>**
- Export all Synology Container Manager or Docker containers' settings as json files to your docker shared folder.
- **<a href="https://github.com/007revad/Synology_ContainerManager_IPv6">Synology_ContainerManager_IPv6</a>**
- Enable IPv6 for Container Manager's bridge network.
- **<a href="https://github.com/007revad/ContainerManager_for_all_armv8">ContainerManager_for_all_armv8</a>**
- Script to install Container Manager on a RS819, DS119j, DS418, DS418j, DS218, DS218play or DS118.
- **<a href="https://github.com/007revad/Docker_Autocompose">Docker_Autocompose</a>**
- Create .yml files from your docker existing containers.
- **<a href="https://github.com/007revad/Synology_docker_cleanup">Synology_docker_cleanup</a>**
- Remove orphan docker btrfs subvolumes and images in Synology DSM 7 and DSM 6.
[Back to Contents](#contents)
### Synology recovery
- **<a href="https://github.com/007revad/Synology_DSM_reinstall">Synology_DSM_reinstall</a>**
- Easily re-install the same DSM version without losing any data or settings.
- **<a href="https://github.com/007revad/Synology_Recover_Data">Synology_Recover_Data</a>**
- A script to make it easy to recover your data from your Synology's drives using a computer.
- **<a href="https://github.com/007revad/Synology_clear_drive_error">Synology clear drive error</a>**
- Clear drive critical errors so DSM will let you use the drive.
- **<a href="https://github.com/007revad/Synology_DSM_Telnet_Password">Synology_DSM_Telnet_Password</a>**
- Synology DSM Recovery Telnet Password of the Day generator.
- **<a href="https://github.com/007revad/Syno_DSM_Extractor_GUI">Syno_DSM_Extractor_GUI</a>**
- Windows GUI for extracting Synology DSM 7 pat files and spk package files.
- **<a href="https://github.com/007revad/Synoboot_backup">Synoboot_backup</a>**
- Back up synoboot after each DSM update so you can recover from a corrupt USBDOM.
[Back to Contents](#contents)
### Other Synology scripts
- **<a href="https://github.com/007revad/Synology_app_mover">Synology_app_mover</a>**
- Easily move Synology packages from one volume to another volume.
- **<a href="https://github.com/007revad/Video_Station_for_DSM_722">Video_Station_for_DSM_722</a>**
- Script to install Video Station in DSM 7.2.2
- **<a href="https://github.com/007revad/SS_Motion_Detection">SS_Motion_Detection</a>**
- Installs previous Surveillance Station and Advanced Media Extensions versions so motion detection and HEVC are supported.
- **<a href="https://github.com/007revad/Synology_Config_Backup">Synology_Config_Backup</a>**
- Backup and export your Synology DSM configuration.
- **<a href="https://github.com/007revad/Synology_CPU_temperature">Synology_CPU_temperature</a>**
- Get and log Synology NAS CPU temperature via SSH.
- **<a href="https://github.com/007revad/Synology_SMART_info">Synology_SMART_info</a>**
- Show Synology smart test progress or smart health and attributes.
- **<a href="https://github.com/007revad/Synology_Cleanup_Coredumps">Synology_Cleanup_Coredumps</a>**
- Cleanup memory core dumps from crashed processes.
- **<a href="https://github.com/007revad/Synology_toggle_reset_button">Synology_toggle_reset_button</a>**
- Script to disable or enable the reset button and show current setting.
- **<a href="https://github.com/007revad/Synology_Download_Station_Chrome_Extension">Synology_Download_Station_Chrome_Extension</a>**
- Download Station Chrome Extension.
- **<a href="https://github.com/007revad/Seagate_lowCurrentSpinup">Seagate_lowCurrentSpinup</a>**
- This script avoids the need to buy and install a higher wattage power supply when using multiple large Seagate SATA HDDs.
[Back to Contents](#contents)
### Synology hardware restrictions
- **<a href="https://github.com/007revad/Synology_HDD_db">Synology_HDD_db</a>**
- Add your SATA or SAS HDDs and SSDs plus SATA and NVMe M.2 drives to your Synology's compatible drive databases, including your Synology M.2 PCIe card and Expansion Unit databases.
- **<a href="https://github.com/007revad/Synology_enable_M2_volume">Synology_enable_M2_volume</a>**
- Enable creating volumes with non-Synology M.2 drives.
- Enable Health Info for non-Synology NVMe drives (not in DSM 7.2.1 or later).
- **<a href="https://github.com/007revad/Synology_M2_volume">Synology_M2_volume</a>**
- Easily create an M.2 volume on Synology NAS.
- **<a href="https://github.com/007revad/Synology_enable_M2_card">Synology_enable_M2_card</a>**
- Enable Synology M.2 PCIe cards in Synology NAS that don't officially support them.
- **<a href="https://github.com/007revad/Synology_enable_eunit">Synology_enable_eunit</a>**
- Enable an unsupported Synology eSATA Expansion Unit models.
- **<a href="https://github.com/007revad/Synology_enable_Deduplication">Synology_enable_Deduplication</a>**
- Enable deduplication with non-Synology SSDs and unsupported NAS models.
- **<a href="https://github.com/007revad/Synology_SHR_switch">Synology_SHR_switch</a>**
- Easily switch between SHR and RAID Groups, or enable RAID F1.
- **<a href="https://github.com/007revad/Synology_enable_sequential_IO">Synology_enable_sequential_IO</a>**
- Enables sequential I/O for your SSD caches, like DSM 6 had.
- **<a href="https://github.com/007revad/Synology_Information_Wiki">Synology_Information_Wiki</a>**
- Information about Synology hardware.
[Back to Contents](#contents)
### 2025 plus models
- **<a href="https://github.com/007revad/Transcode_for_x25">Transcode_for_x25</a>**
- Installs the modules needed for Plex or Jellyfin hardware transcoding in DS425+ and DS225+.
- **<a href="https://github.com/007revad/Synology_HDD_db/blob/main/2025_plus_models.md">2025 series or later Plus models</a>**
- Unverified 3rd party drive limitations and unofficial solutions.
- **<a href="https://github.com/007revad/Synology_HDD_db/blob/main/2025_plus_models.md#setting-up-a-new-2025-or-later-plus-model-with-only-unverified-hdds">Setup with only 3rd party drives</a>**
- Setting up a new 2025 or later plus model with only unverified HDDs.
- **<a href="https://github.com/007revad/Synology_HDD_db/blob/main/2025_plus_models.md#deleting-and-recreating-your-storage-pool-on-unverified-hdds">Recreating storage pool on migrated drives</a>**
- Deleting and recreating your storage pool on unverified HDDs.
[Back to Contents](#contents)
### How To Guides
- **<a href="https://github.com/007revad/Synology_SSH_key_setup">Synology_SSH_key_setup</a>**
- How to setup SSH key authentication for your Synology.
[Back to Contents](#contents)
### Synology dev
- **<a href="https://github.com/007revad/Download_Synology_Archive">Download_Synology_Archive</a>**
- Download all or part of the Synology archive.
- **<a href="https://github.com/007revad/Syno_DSM_Extractor_GUI">Syno_DSM_Extractor_GUI</a>**
- Windows GUI for extracting Synology DSM 7 pat files and spk package files.
- **<a href="https://github.com/007revad/ScriptNotify">ScriptNotify</a>**
- DSM 7 package to allow your scripts to send DSM notifications.
- **<a href="https://github.com/007revad/DTC_GUI_for_Windows">DTC_GUI_for_Windows</a>**
- GUI for DTC.exe for Windows.
[Back to Contents](#contents)
|
train_000.parquet/985
|
{
"file_path": "my-other-scripts.md",
"repo_id": "007revad/Video_Station_for_DSM_722",
"size": 9099,
"token_count": 3421
}
|
#!/usr/bin/env bash
#------------------------------------------------------------------------------
# https://www.synology.com/en-au/releaseNote/VideoStation
# https://www.synology.com/en-au/releaseNote/CodecPack
# https://www.synology.com/en-au/releaseNote/MediaServer
# https://www.synology.com/en-au/releaseNote/DSM
#
# Video Station does not support TrueHD or DTS audio.
# Video Station does not decode AAC audio.
#------------------------------------------------------------------------------
# https://archive.synology.com/download/Package
# https://web.archive.org/web/20240825163306/https://archive.synology.com/download/Package
#------------------------------------------------------------------------------
# To get Video Station to work I needed to install an older version of AME...
# which means Drive and Surveillance Station may not work
# (unless I install older versions of them).
#------------------------------------------------------------------------------
# I've seen evidence of:
# VideoStation="3.2.0-3173" (when you try to manually install 3.1.1)
# CodecPack="4.0.0-4003"
# It looks like Synology were developing a new video station for DSM 7.2.2
# before someone decided to scrap it and cannibalise AME to save a few dollars
#------------------------------------------------------------------------------
# TODO
# Figure out how to install already downloaded package to specific volume
# Figure out where package center saves it's settings
# Figure out how to run VideoStation 3.1.1-3168 with CodecPack 3.1.0-3005
# or add OpenSubtitle changes from 3.1.1-3168 to 3.1.0-3153
#------------------------------------------------------------------------------
scriptver="v1.4.19"
script=Video_Station_for_DSM_722
repo="007revad/Video_Station_for_DSM_722"
scriptname=videostation_for_722
ding(){
printf \\a
}
# Save options used for getopt
args=("$@")
if [[ $1 == "--trace" ]] || [[ $1 == "-t" ]]; then
trace="yes"
fi
# Check script is running as root
if [[ $( whoami ) != "root" ]]; then
ding
echo -e "${Error}ERROR${Off} This script must be run as sudo or root!"
exit 1 # Not running as sudo or root
fi
# Get NAS model
model=$(cat /proc/sys/kernel/syno_hw_version)
#modelname="$model"
# Show script version
#echo -e "$script $scriptver\ngithub.com/$repo\n"
echo "$script $scriptver"
# Get DSM full version
productversion=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION productversion)
buildphase=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION buildphase)
buildnumber=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION buildnumber)
smallfixnumber=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION smallfixnumber)
# Get CPU arch and platform_name
arch="$(uname -m)"
platform_name=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/synoinfo.conf platform_name)
# Show DSM full version and model
if [[ $buildphase == GM ]]; then buildphase=""; fi
if [[ $smallfixnumber -gt "0" ]]; then smallfix="-$smallfixnumber"; fi
echo "$model DSM $productversion-$buildnumber$smallfix $buildphase"
# Show CPU arch and platform_name
echo "CPU $platform_name $arch"
# Show options used
if [[ ${#args[@]} -gt "0" ]]; then
echo -e "Using options: ${args[*]}\n"
else
echo ""
fi
usage(){
cat <<EOF
Usage: $(basename "$0") [options]
Options:
-h, --help Show this help message
-v, --version Show the script version
--install=OPTION Automatically install OPTION (for use when scheduled)
OPTION can be either:
'all' to install Video Station, Media Server and
Advanced Media Codecs
'novs' to install all except Video Station
'noms' to install all except Media Server
'onlyamc' to only install Advanced Media Codecs
Examples:
videostation_for_722.sh --install=all
videostation_for_722.sh --install=novs
videostation_for_722.sh --install=noms
videostation_for_722.sh --install=onlyamc
EOF
}
scriptversion(){
cat <<EOF
$script $scriptver - by 007revad
See https://github.com/$repo
EOF
exit 0
}
autoupdate=""
# Check for flags with getopt
if options="$(getopt -o abcdefghijklmnopqrstuvwxyz0123456789 -l \
autoupdate:,install:,help,version,log,debug -- "${args[@]}")"; then
eval set -- "$options"
while true; do
case "${1,,}" in
-h|--help) # Show usage options
usage
exit
;;
-v|--version) # Show script version
scriptversion
;;
-l|--log) # Log
log=yes
;;
-d|--debug) # Show and log debug info
debug=yes
;;
--install) # Specify pkgs to install or skip
color=no # Disable colour text in task scheduler emails
if [[ ${2,,} == "all" ]]; then
auto="yes"
choice="Installing All"
elif [[ ${2,,} == "novs" ]]; then
auto="yes"
no_vs="yes"
choice="Skipping Video Station"
elif [[ ${2,,} == "noms" ]]; then
auto="yes"
no_ms="yes"
choice="Skipping Media Server"
elif [[ ${2,,} == "onlyamc" ]]; then
auto="yes"
no_vs="yes"
no_ms="yes"
choice="Only installing Advanced Media Codecs"
else
ding
echo -e "Missing argument to auto!\n"
usage
exit 2 # Missing argument
fi
shift
;;
--autoupdate) # Auto update script
autoupdate=yes
if [[ $2 =~ ^[0-9]+$ ]]; then
delay="$2"
shift
else
delay="0"
fi
;;
--)
shift
break
;;
*) # Show usage options
ding
echo -e "Invalid option '$1'\n"
usage
exit 2 # Invalid argument
;;
esac
shift
done
else
echo
usage
exit
fi
# Shell Colors
if [[ $color != "no" ]]; then
#Black='\e[0;30m' # ${Black}
#Red='\e[0;31m' # ${Red}
#Green='\e[0;32m' # ${Green}
#Yellow='\e[0;33m' # ${Yellow}
#Blue='\e[0;34m' # ${Blue}
#Purple='\e[0;35m' # ${Purple}
Cyan='\e[0;36m' # ${Cyan}
#White='\e[0;37m' # ${White}
Error='\e[41m' # ${Error}
#Warn='\e[47;31m' # ${Warn}
Off='\e[0m' # ${Off}
fi
#------------------------------------------------------------------------------
# Check latest release with GitHub API
# Save options used
args=("$@")
# Get latest release info
# Curl timeout options:
# https://unix.stackexchange.com/questions/94604/does-curl-have-a-timeout
release=$(curl --silent --connect-timeout 30 \
"https://api.github.com/repos/$repo/releases/latest")
# Release version
tag=$(echo "$release" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
shorttag="${tag:1}"
# Get script location
# https://stackoverflow.com/questions/59895/
source=${BASH_SOURCE[0]}
while [ -L "$source" ]; do # Resolve $source until the file is no longer a symlink
scriptpath=$( cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd )
source=$(readlink "$source")
# If $source was a relative symlink, we need to resolve it
# relative to the path where the symlink file was located
[[ $source != /* ]] && source=$scriptpath/$source
done
scriptpath=$( cd -P "$( dirname "$source" )" >/dev/null 2>&1 && pwd )
scriptfile=$( basename -- "$source" )
echo "Running from: ${scriptpath}/$scriptfile"
#echo "Script location: $scriptpath" # debug
#echo "Source: $source" # debug
#echo "Script filename: $scriptfile" # debug
#echo "tag: $tag" # debug
#echo "scriptver: $scriptver" # debug
cleanup_tmp(){
# Delete downloaded .tar.gz file
if [[ -f "/tmp/$script-$shorttag.tar.gz" ]]; then
if ! rm "/tmp/$script-$shorttag.tar.gz"; then
echo -e "${Error}ERROR${Off} Failed to delete"\
"downloaded /tmp/$script-$shorttag.tar.gz!" >&2
fi
fi
# Delete extracted tmp files
if [[ -d "/tmp/$script-$shorttag" ]]; then
if ! rm -r "/tmp/$script-$shorttag"; then
echo -e "${Error}ERROR${Off} Failed to delete"\
"downloaded /tmp/$script-$shorttag!" >&2
fi
fi
}
if ! printf "%s\n%s\n" "$tag" "$scriptver" |
sort --check=quiet --version-sort >/dev/null ; then
echo -e "\n${Cyan}There is a newer version of this script available.${Off}"
echo -e "Current version: ${scriptver}\nLatest version: $tag"
scriptdl="$scriptpath/$script-$shorttag"
if [[ -f ${scriptdl}.tar.gz ]] || [[ -f ${scriptdl}.zip ]]; then
# They have the latest version tar.gz downloaded but are using older version
echo "You have the latest version downloaded but are using an older version"
sleep 10
elif [[ -d $scriptdl ]]; then
# They have the latest version extracted but are using older version
echo "You have the latest version extracted but are using an older version"
sleep 10
else
echo -e "${Cyan}Do you want to download $tag now?${Off} [y/n]"
read -r -t 30 reply
if [[ ${reply,,} == "y" ]]; then
# Delete previously downloaded .tar.gz file and extracted tmp files
cleanup_tmp
if cd /tmp; then
url="https://github.com/$repo/archive/refs/tags/$tag.tar.gz"
if ! curl -JLO -m 30 --connect-timeout 5 "$url"; then
echo -e "${Error}ERROR${Off} Failed to download"\
"$script-$shorttag.tar.gz!"
else
if [[ -f /tmp/$script-$shorttag.tar.gz ]]; then
# Extract tar file to /tmp/<script-name>
if ! tar -xf "/tmp/$script-$shorttag.tar.gz" -C "/tmp"; then
echo -e "${Error}ERROR${Off} Failed to"\
"extract $script-$shorttag.tar.gz!"
else
# Set script sh files as executable
if ! chmod a+x "/tmp/$script-$shorttag/"*.sh ; then
permerr=1
echo -e "${Error}ERROR${Off} Failed to set executable permissions"
fi
# Copy new script sh file to script location
if ! cp -p "/tmp/$script-$shorttag/${scriptname}.sh" "${scriptpath}/${scriptfile}";
then
copyerr=1
echo -e "${Error}ERROR${Off} Failed to copy"\
"$script-$shorttag sh file(s) to:\n $scriptpath/${scriptfile}"
fi
# Copy new CHANGES.txt file to script location (if script on a volume)
if [[ $scriptpath =~ /volume* ]]; then
# Set permissions on CHANGES.txt
if ! chmod 664 "/tmp/$script-$shorttag/CHANGES.txt"; then
permerr=1
echo -e "${Error}ERROR${Off} Failed to set permissions on:"
echo "$scriptpath/CHANGES.txt"
fi
# Copy new CHANGES.txt file to script location
if ! cp -p "/tmp/$script-$shorttag/CHANGES.txt"\
"${scriptpath}/${scriptname}_CHANGES.txt";
then
echo -e "${Error}ERROR${Off} Failed to copy"\
"$script-$shorttag/CHANGES.txt to:\n $scriptpath"
else
changestxt=" and changes.txt"
fi
fi
# Delete downloaded tmp files
cleanup_tmp
# Notify of success (if there were no errors)
if [[ $copyerr != 1 ]] && [[ $permerr != 1 ]]; then
echo -e "\n$tag ${scriptfile}$changestxt downloaded to: ${scriptpath}\n"
# Reload script
printf -- '-%.0s' {1..79}; echo # print 79 -
exec "${scriptpath}/$scriptfile" "${args[@]}"
fi
fi
else
echo -e "${Error}ERROR${Off}"\
"/tmp/$script-$shorttag.tar.gz not found!"
#ls /tmp | grep "$script" # debug
fi
fi
cd "$scriptpath" || echo -e "${Error}ERROR${Off} Failed to cd to script location!"
else
echo -e "${Error}ERROR${Off} Failed to cd to /tmp!"
fi
fi
fi
fi
#------------------------------------------------------------------------------
# Check script is needed
if [[ $buildnumber -lt "72803" ]]; then
echo -e "\nYour DSM version does not need this script"
exit
fi
# Check model is supported
spks_list=("armada37xx" "armada38x" "armv7" "monaco" "rtd1296" "rtd1619b" "x86_64")
if [[ ${spks_list[*]} =~ $arch ]]; then
cputype="$arch"
elif [[ ${spks_list[*]} =~ $platform_name ]]; then
cputype="$platform_name"
elif [[ $platform_name == "alpine" || $platform_name == "alpine4k" ]]; then
# DS1817, DS1517 and DS416
cputype="armv7"
else
echo -e "\nUnsupported or unknown CPU platform_name or architecture"
echo " - CPU type: $cputype"
echo " - Platform: $platform_name"
echo -e "Please create an issue at:"
echo -e "https://github.com/007revad/Video_Station_for_DSM_722/issues\n"
exit
fi
echo "Using CPU type: $cputype"
#------------------------------------------------------------------------------
cleanup(){
arg1=$?
for s in /tmp/CodecPack-"${cputype}"-*.spk; do rm -f "$s"; done
for s in /tmp/VideoStation-"${cputype}"-*.spk; do rm -f "$s"; done
for s in /tmp/MediaServer-"${cputype}"-*.spk; do rm -f "$s"; done
exit "${arg1}"
}
trap cleanup EXIT
progbar(){
# $1 is pid of process
# $2 is string to echo
string="$2"
local dots
local progress
dots=""
while [[ -d /proc/$1 ]]; do
dots="${dots}."
progress="$dots"
if [[ ${#dots} -gt "10" ]]; then
dots=""
progress=" "
fi
echo -ne " ${2}$progress\r"; sleep 0.3
done
}
progstatus(){
# $1 is return status of process
# $2 is string to echo
# $3 line number function was called from
local tracestring
local pad
tracestring="${FUNCNAME[0]} called from ${FUNCNAME[1]} $3"
pad=$(printf -- ' %.0s' {1..80})
[ "$trace" == "yes" ] && printf '%.*s' 80 "${tracestring}${pad}" && echo ""
if [[ $1 == "0" ]]; then
echo -e "$2 "
else
ding
echo -e "Line ${LINENO}: ${Error}ERROR${Off} $2 failed!"
echo "$tracestring"
if [[ $exitonerror != "no" ]]; then
exit 1 # Skip exit if exitonerror != no
fi
fi
exitonerror=""
#echo "return: $1" # debug
}
package_status(){
# $1 is package name
[ "$trace" == "yes" ] && echo "${FUNCNAME[0]} called from ${FUNCNAME[1]}"
/usr/syno/bin/synopkg status "${1}" >/dev/null
code="$?"
# DSM 7.2 0 = started, 17 = stopped, 255 = not_installed, 150 = broken
# DSM 6 to 7.1 0 = started, 3 = stopped, 4 = not_installed, 150 = broken
if [[ $code == "0" ]]; then
#echo "$1 is started" # debug
return 0
elif [[ $code == "17" ]] || [[ $code == "3" ]]; then
#echo "$1 is stopped" # debug
return 1
elif [[ $code == "255" ]] || [[ $code == "4" ]]; then
#echo "$1 is not installed" # debug
return 255
elif [[ $code == "150" ]]; then
#echo "$1 is broken" # debug
return 150
else
return "$code"
fi
}
check_pkg_installed(){
# $1 is package
[ "$trace" == "yes" ] && echo "${FUNCNAME[0]} called from ${FUNCNAME[1]}"
/usr/syno/bin/synopkg status "${1:?}" >/dev/null
code="$?"
if [[ $code == "255" ]] || [[ $code == "4" ]]; then
return 1
else
return 0
fi
}
package_is_running(){
# $1 is package name
[ "$trace" == "yes" ] && echo "${FUNCNAME[0]} called from ${FUNCNAME[1]}"
/usr/syno/bin/synopkg is_onoff "${1}" >/dev/null
code="$?"
return "$code"
}
wait_status(){
# Wait for package to finish stopping or starting
# $1 is package
# $2 is start or stop
[ "$trace" == "yes" ] && echo "${FUNCNAME[0]} called from ${FUNCNAME[1]}"
local num
if [[ $2 == "start" ]]; then
state="0"
elif [[ $2 == "stop" ]]; then
state="1"
fi
if [[ $state == "0" ]] || [[ $state == "1" ]]; then
num="0"
package_status "$1"
while [[ $? != "$state" ]]; do
sleep 1
num=$((num +1))
if [[ $num -gt "20" ]]; then
break
fi
package_status "$1"
done
fi
}
package_stop(){
# $1 is package name
# $2 is package display name
[ "$trace" == "yes" ] && echo "${FUNCNAME[0]} called from ${FUNCNAME[1]}"
timeout 5m /usr/syno/bin/synopkg stop "$1" >/dev/null &
pid=$!
#string="Stopping ${Cyan}${2}${Off}"
string="Stopping ${2}"
progbar "$pid" "$string"
wait "$pid"
progstatus "$?" "$string" "line ${LINENO}"
# Allow package processes to finish stopping
wait_status "$1" stop
}
package_start(){
# $1 is package name
# $2 is package display name
[ "$trace" == "yes" ] && echo "${FUNCNAME[0]} called from ${FUNCNAME[1]}"
timeout 5m /usr/syno/bin/synopkg start "$1" >/dev/null &
pid=$!
#string="Starting ${Cyan}${2}${Off}"
string="Starting ${2}"
progbar "$pid" "$string"
wait "$pid"
progstatus "$?" "$string" "line ${LINENO}"
# Allow package processes to finish starting
wait_status "$1" start
}
package_uninstall(){
# $1 is package name
# $2 is package display name
[ "$trace" == "yes" ] && echo "${FUNCNAME[0]} called from ${FUNCNAME[1]}"
/usr/syno/bin/synopkg uninstall "$1" >/dev/null &
pid=$!
string="Uninstalling ${Cyan}${2}${Off}"
progbar "$pid" "$string"
wait "$pid"
progstatus "$?" "$string" "line ${LINENO}"
}
package_install(){
# $1 is package filename
# $2 is package display name
# $3 is /volume2 etc
[ "$trace" == "yes" ] && echo "${FUNCNAME[0]} called from ${FUNCNAME[1]}"
#/usr/syno/bin/synopkg install_from_server "$1" "$3" >/dev/null &
/usr/syno/bin/synopkg install "/tmp/$1" "$3" >/dev/null &
pid=$!
if [[ $3 ]]; then
string="Installing ${Cyan}${2}${Off} on ${Cyan}$3${Off}"
else
string="Installing ${Cyan}${2}${Off}"
fi
progbar "$pid" "$string"
wait "$pid"
progstatus "$?" "$string" "line ${LINENO}"
}
download_pkg(){
# $1 is the package folder name
# $2 is the package version to download
# $3 is the package file to download
# https://cndl.synology.cn/download/Package/spk/VideoStation/3.1.0-3153/VideoStation-x86_64-3.1.0-3153.spk
# https://global.synologydownload.com/download/Package/spk/VideoStation/3.1.0-3153/VideoStation-x86_64-3.1.0-3153.spk
local url
language=$(synogetkeyvalue /etc/synoinfo.conf language)
if [[ $language =~ chs|cht ]] && readlink -q /etc/localtime | grep -iq china;
then
# Use China only download site
base="https://cndl.synology.cn/download/Package/spk/"
else
base="https://global.synologydownload.com/download/Package/spk/"
# base2 currently unused
base2="https://global.download.synology.com/download/Package/spk/"
fi
if [[ ! -f "/tmp/${3:?}" ]]; then
url="${base}${1:?}/${2:?}/${3:?}"
echo -e "\nDownloading ${Cyan}${3}${Off}"
if ! curl -kL --connect-timeout 30 "$url" -o "/tmp/$3"; then
ding
echo -e "${Error}ERROR 2${Off} Failed to download ${3}!"
exit 2
fi
fi
if [[ ! -f "/tmp/${3:?}" ]]; then
ding
echo -e "${Error}ERROR 3${Off} Failed to download ${3}!"
exit 3
else
echo ""
fi
}
# Only install the packages the user wants
echo ""
if [[ $auto != "yes" ]]; then
PS3="Select package(s) to install: "
options=("Install All" "Only Advanced Media Codecs" "Skip Video Station" "Skip Media Server")
TMOUT=20 # Timeout and install all if no choice made within 20 seconds (for task scheduler)
select choice in "${options[@]}"; do
case "$choice" in
"Install All")
break
;;
"Skip Video Station")
no_vs="yes"
break
;;
"Skip Media Server")
no_ms="yes"
break
;;
"Only Advanced Media Codecs")
no_vs="yes"
no_ms="yes"
break
;;
"")
echo "Invalid Choice!"
;;
*)
break
;;
esac
done
unset TMOUT
if [[ -z "$choice" ]]; then
echo "No selection made. Installing all packages."
else
echo -e "You selected: ${Cyan}$choice${Off}"
fi
else
echo "$choice"
fi
# Backup synopackageslimit.conf if needed
if [[ ! -f /etc.defaults/synopackageslimit.conf.bak ]]; then
cp -p /etc.defaults/synopackageslimit.conf /etc.defaults/synopackageslimit.conf.bak
fi
# Make DSM let us install the packages we want
/usr/syno/bin/synosetkeyvalue /etc.defaults/synopackageslimit.conf VideoStation "3.1.0-3153"
/usr/syno/bin/synosetkeyvalue /etc/synopackageslimit.conf VideoStation "3.1.0-3153"
/usr/syno/bin/synosetkeyvalue /etc.defaults/synopackageslimit.conf CodecPack "3.1.0-3005"
/usr/syno/bin/synosetkeyvalue /etc/synopackageslimit.conf CodecPack "3.1.0-3005"
/usr/syno/bin/synosetkeyvalue /etc.defaults/synopackageslimit.conf MediaServer "2.0.5-3152"
/usr/syno/bin/synosetkeyvalue /etc/synopackageslimit.conf MediaServer "2.0.5-3152"
# Get installed AME version
ame_version=$(/usr/syno/bin/synopkg version CodecPack)
if [[ ${ame_version:0:1} -gt "3" ]]; then
# Uninstall AME v4
echo ""
package_uninstall CodecPack "Advanced Media Extensions"
fi
# Get installed VideoStation version
if [[ $no_vs != "yes" ]]; then
vs_version=$(/usr/syno/bin/synopkg version VideoStation)
#if check_pkg_installed VideoStation && [[ ${vs_version:0:2} != "30" ]]; then
if check_pkg_installed VideoStation && [[ ${vs_version} != "30.1.0-3153" ]]; then
# Uninstall VideoStation (wrong version)
echo ""
package_uninstall VideoStation "Video Station"
fi
fi
# Get installed MediaServer version
if [[ $no_ms != "yes" ]]; then
ms_version=$(/usr/syno/bin/synopkg version MediaServer)
#if check_pkg_installed MediaServer && [[ ${ms_version:0:2} != "20" ]]; then
if check_pkg_installed MediaServer && [[ ${ms_version} != "20.0.5-3152" ]]; then
# Uninstall MediaServer (wrong version)
echo ""
package_uninstall MediaServer "Media Server"
fi
fi
# CodecPack (Advanced Media Extensions)
if ! check_pkg_installed CodecPack && [[ $ame_version != "30.1.0-3005" ]]; then
download_pkg CodecPack "3.1.0-3005" "CodecPack-${cputype}-3.1.0-3005.spk"
package_install "CodecPack-${cputype}-3.1.0-3005.spk" "Advanced Media Extensions"
package_stop CodecPack "Advanced Media Extensions"
# Prevent package updating and "update available" messages
echo "Preventing Advanced Media Extensions from auto updating"
/usr/syno/bin/synosetkeyvalue /var/packages/CodecPack/INFO version "30.1.0-3005"
package_start CodecPack "Advanced Media Extensions"
rm -f "/tmp/CodecPack-${cputype}-3.1.0-3005.spk"
else
echo -e "\n${Cyan}Advanced Media Extensions${Off} $ame_version already installed"
fi
# VideoStation
if [[ $no_vs != "yes" ]]; then
if ! check_pkg_installed VideoStation && [[ $vs_version != "30.1.0-3153" ]]; then
#download_pkg VideoStation "3.1.1-3168" "VideoStation-${cputype}-3.1.0-3168.spk"
download_pkg VideoStation "3.1.0-3153" "VideoStation-${cputype}-3.1.0-3153.spk"
#package_install "VideoStation-${cputype}-3.1.1-3168.spk" "Video Station"
package_install "VideoStation-${cputype}-3.1.0-3153.spk" "Video Station"
package_stop VideoStation "Video Station"
# Prevent package updating and "update available" messages
echo "Preventing Video Station from auto updating"
#/usr/syno/bin/synosetkeyvalue /var/packages/VideoStation/INFO version "30.1.1-3168"
/usr/syno/bin/synosetkeyvalue /var/packages/VideoStation/INFO version "30.1.0-3153"
package_start VideoStation "Video Station"
#rm -f "/tmp/VideoStation-${cputype}-3.1.0-3168.spk"
rm -f "/tmp/VideoStation-${cputype}-3.1.0-3153.spk"
else
echo -e "\n${Cyan}Video Station${Off} $vs_version already installed"
fi
fi
# MediaServer
if [[ $no_ms != "yes" ]]; then
if ! check_pkg_installed MediaServer && [[ $ms_version != "20.0.5-3152" ]]; then
download_pkg MediaServer "2.0.5-3152" "MediaServer-${cputype}-2.0.5-3152.spk"
package_install "MediaServer-${cputype}-2.0.5-3152.spk" "Media Server"
package_stop MediaServer "Media Server"
# Prevent package updating and "update available" messages
echo "Preventing Media Server from auto updating"
/usr/syno/bin/synosetkeyvalue /var/packages/MediaServer/INFO version "20.0.5-3152"
package_start MediaServer "Media Server"
rm -f "/tmp/MediaServer-${cputype}-2.0.5-3152.spk"
else
echo -e "\n${Cyan}Media Server${Off} $ms_version already installed"
fi
fi
# Start packages if needed (i.e. after DSM update)
if check_pkg_installed CodecPack; then
if ! package_is_running CodecPack; then
package_start CodecPack "Advanced Media Extensions"
fi
fi
if check_pkg_installed VideoStation; then
if ! package_is_running VideoStation; then
package_start VideoStation "Video Station"
fi
fi
if check_pkg_installed MediaServer; then
if ! package_is_running MediaServer; then
package_start MediaServer "Media Server"
fi
fi
echo -e "\nFinished :)"
echo -e "\nTo enable HEVC decoding:"
echo " 1. Open Package Center > Installed"
echo " 2. Click Advanced Media Extensions"
echo " 3. Click on Open"
echo -e " 4. Click on Install then OK \n"
|
train_000.parquet/986
|
{
"file_path": "videostation_for_722.sh",
"repo_id": "007revad/Video_Station_for_DSM_722",
"size": 27549,
"token_count": 9542
}
|
# <img src="images/VideoStation_64.png" width="40"> Video Station for DSM 7.2.2 and DSM 7.3
<a href="https://github.com/007revad/Video_Station_for_DSM_722/releases"><img src="https://img.shields.io/github/release/007revad/Video_Station_for_DSM_722.svg"></a>

[](https://www.paypal.com/paypalme/007revad)
[](https://github.com/sponsors/007revad)
[](https://user-badge.committers.top/australia/007revad)
The Video Station icon above is Copyright © 2004-2025 [Synology Inc.](https://kb.synology.com/en-br/DSM/help/DSM/Home/about?version=7)
### Description
Script to install Video Station in DSM 7.2.2 and DSM 7.3
Also installs the DSM 7.2.1 version of Advanced Media Codecs so that Synology Photos can create thumbnails of HEIC photos.
Synology's Video Station package has been installed more than 66 million times so there are a lot people very annoyed that Synology decided to abandon Video Station when DSM 7.2.2 was released. Many of those people are saying they will never buy another Synology NAS. So I decided to make it possible to install Video Station in DSM 7.2.2 and DSM 7.3 for people who really want Video Station.
This script installs Video Station 3.1.0-3153 and Advanced Media Extensions 3.1.0-3005
Now also installs Media Server 2.0.5-3152 which supports video and audio conversion.
**HEIC for Synology Photos:** After running this script and enabling HEVC decoding in Advanced Media Extensions Synology Photos will be able to create thumbnails for HEIC photos again (you can then uninstall Video Station and/or Media Server if you don't need them).
**UPDATE:** Version 1.3.12 and later has a menu where you can select to only install Advanced Media Codecs, or skip installing Media Server or Video Station. See
<a href="#Screenshots">Screenshots</a>
> **Warning** <br>
> Recent zero-days security exploits were found in [Synology Photos](https://www.synology.com/en-us/security/advisory/Synology_SA_24_19) and [Synology Drive Server](https://www.synology.com/en-global/security/advisory/Synology_SA_24_21) and quickly patched by Synology. <br>
> Synology has not made Video Station [End-Of-Life](https://www.synology.com/en-us/products/status?tab=software), as it is still available for DSM 7.2 and 7.2.1 which are both still getting security updates, so Synology should patch Video Station if any security exploits are found.
<br>
**<p align="center">Video Station installed in DSM 7.2.2 and DSM 7.3</p>**
<!-- <p align="center"><img src="/images/installed-1.png"></p> -->
<p align="center"><img src="/images/installed-3.png"></p>
### Download the script
1. Download the latest version _Source code (zip)_ from https://github.com/007revad/Video_Station_for_DSM_722/releases
2. Save the download zip file to a folder on the Synology.
3. Unzip the zip file.
### Options when running the script
There are optional flags you can use when running the script:
```
Options:
-h, --help Show this help message
-v, --version Show the script version
--install=OPTION Automatically install OPTION (for use when scheduled)
OPTION can be either:
'all' to install Video Station, Media Server and
Advanced Media Codecs
'novs' to install all except Video Station
'noms' to install all except Media Server
'onlyamc' to only install Advanced Media Codecs
Examples:
videostation_for_722.sh --install=all
videostation_for_722.sh --install=novs
videostation_for_722.sh --install=noms
videostation_for_722.sh --install=onlyamc
```
### To run the script via task scheduler
See [How to run from task scheduler](https://github.com/007revad/Video_Station_for_DSM_722/blob/main/how_to_run_from_scheduler.md)
### To run the script via SSH
[How to enable SSH and login to DSM via SSH](https://kb.synology.com/en-global/DSM/tutorial/How_to_login_to_DSM_with_root_permission_via_SSH_Telnet)
```YAML
sudo -s /volume1/scripts/videostation_for_722.sh
```
**Note:** Replace /volume1/scripts/ with the path to where the script is located.
<p align="center"><img src="/images/script_v1-1.png"></p>
### After running the script
Enable HEVC decoding:
1. Open Package Center > Installed.
2. Click Advanced Media Extensions.
3. Click on Open.
4. You may need to [Sign in to your Synology account](https://github.com/007revad/Video_Station_for_DSM_722/blob/main/syno_account_sign_in.md)
5. Click on Install then OK.
<p align="center"><img src="/images/enable_hevc.png"></p>
### What about DTS, EAC3 and TrueHD Audio?
You can install FFmpeg 7 from SynoCommunity. See [Easy Install](https://synocommunity.com/#easy-install) to add SynologyCommunity package repository to Package Center.
<p align="center"><img src="/images/ffmpeg7.png"></p>
Then you have a choice of two official Wrappers:
</br>
1) Download the latest release from https://github.com/AlexPresso/VideoStation-FFMPEG-Patcher and unzip it.
- Then run VideoStation-FFMPEG-Patcher with the `-v 7` option:
```YAML
sudo -s /volume1/scripts/VideoStation-FFMPEG-Patcher/patcher.sh -v 7
```
2) Check it out for more details: https://github.com/darknebular/Wrapper_VideoStation
```YAML
bash -c "$(curl "https://raw.githubusercontent.com/darknebular/Wrapper_VideoStation/main/installer.sh")"
```
### What about future DSM updates?
***With Video Station installed:***
1. You'll get a message saying Video Station needs to be uninstalled before updating DSM.
2. Uninstall Video Station (but do **not** tick the box to delete Video Station's database).
3. Update DSM.
4. Package Center will show Advanced Media Extensions and Media Server as "incompatible with your DSM".
5. Run this script again.
***Without Video Station installed:***
1. Update DSM.
2. Package Center will show Advanced Media Extensions and Media Server as "incompatible with your DSM".
3. Run this script again.
</br>
<div id="Screenshots"></div>
### Screenshots
<p align="center">Install only Advanced Media Codecs</p>
<p align="center"><img src="/images/install_ame_only.png"></p>
<p align="center">Skip installing Media Server</p>
<p align="center"><img src="/images/skip_ms.png"></p>
<p align="center">Install All</p>
<p align="center"><img src="/images/install_all.png"></p>
</br>
|
train_000.parquet/987
|
{
"file_path": "README.md",
"repo_id": "007revad/Video_Station_for_DSM_722",
"size": 6906,
"token_count": 2330
}
|
# How to run a script in Synology Task Scheduler
To run a script from Task Scheduler follow these steps:
**Note:** You can setup a schedule task and leave it disabled, so it only runs when you select the task in the Task Scheduler and click on the Run button.
1. Go to **Control Panel** > **Task Scheduler** > click **Create** > and select **Scheduled Task**.
2. Select **User-defined script**.
3. Enter a task name.
4. Select **root** as the user (The script needs to run as root).
5. Untick **Enable** so it does **not** run on a schedule.
6. Click **Task Settings**.
7. In the box under **User-defined script** type the path to the script.
- e.g. If you saved the script to a shared folder on volume 1 called "scripts" you'd type: **/volume1/scripts/videostation_for_722.sh**
8. Click **OK** to save the settings.
9. Click on the task - but **don't** enable it - then click **Run**.
10. Once the script has run you can delete the task, or keep in case you need it again.
**Note:** If you don't want the script to install all 3 packages (Video Station, Media Server and Advanced Media Codecs) you can schedule the script to run with the `install=` option to specify which package(s) to install. See [Options when running the script](https://github.com/007revad/Video_Station_for_DSM_722?tab=readme-ov-file#options-when-running-the-script) for more information.
**Here's some screenshots showing what needs to be set:**
<p align="center">Step 1</p>
<p align="center"><img src="images/schedule-1.png"></p>
<p align="center">Step 2</p>
<p align="center"><img src="images/schedule-2.png"></p>
<p align="center">Step 3</p>
<p align="center"><img src="images/schedule-3.png"></p>
<p align="center">Step 4</p>
<p align="center"><img src="images/schedule-4.png"></p>
|
train_000.parquet/988
|
{
"file_path": "how_to_run_from_scheduler.md",
"repo_id": "007revad/Video_Station_for_DSM_722",
"size": 1775,
"token_count": 583
}
|
/**
* @file lv_tileview.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_tileview.h"
#if LV_USE_TILEVIEW != 0
#include <stdbool.h>
#include "lv_cont.h"
#include "../lv_misc/lv_math.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_themes/lv_theme.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_tileview"
#if LV_USE_ANIMATION
#ifndef LV_TILEVIEW_DEF_ANIM_TIME
#define LV_TILEVIEW_DEF_ANIM_TIME 300 /*Animation time loading a tile [ms] (0: no animation) */
#endif
#else
#undef LV_TILEVIEW_DEF_ANIM_TIME
#define LV_TILEVIEW_DEF_ANIM_TIME 0 /*No animations*/
#endif
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_res_t lv_tileview_signal(lv_obj_t * tileview, lv_signal_t sign, void * param);
static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param);
static void drag_end_handler(lv_obj_t * tileview);
static bool set_valid_drag_dirs(lv_obj_t * tileview);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
static lv_signal_cb_t ancestor_scrl_signal;
static lv_design_cb_t ancestor_design;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a tileview object
* @param par pointer to an object, it will be the parent of the new tileview
* @param copy pointer to a tileview object, if not NULL then the new object will be copied from it
* @return pointer to the created tileview
*/
lv_obj_t * lv_tileview_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("tileview create started");
/*Create the ancestor of tileview*/
lv_obj_t * new_tileview = lv_page_create(par, copy);
LV_ASSERT_MEM(new_tileview);
if(new_tileview == NULL) return NULL;
/*Allocate the tileview type specific extended data*/
lv_tileview_ext_t * ext = lv_obj_allocate_ext_attr(new_tileview, sizeof(lv_tileview_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(new_tileview);
return NULL;
}
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_tileview);
if(ancestor_scrl_signal == NULL) ancestor_scrl_signal = lv_obj_get_signal_cb(lv_page_get_scrollable(new_tileview));
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(new_tileview);
/*Initialize the allocated 'ext' */
#if LV_USE_ANIMATION
ext->anim_time = LV_TILEVIEW_DEF_ANIM_TIME;
#endif
ext->act_id.x = 0;
ext->act_id.y = 0;
ext->valid_pos = NULL;
ext->valid_pos_cnt = 0;
/*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(new_tileview, lv_tileview_signal);
lv_obj_set_signal_cb(lv_page_get_scrollable(new_tileview), lv_tileview_scrl_signal);
/*Init the new tileview*/
if(copy == NULL) {
/* Set a size which fits into the parent.
* Don't use `par` directly because if the tileview is created on a page it is moved to the
* scrollable so the parent has changed */
lv_coord_t w;
lv_coord_t h;
if(par) {
w = lv_obj_get_width_fit(lv_obj_get_parent(new_tileview));
h = lv_obj_get_height_fit(lv_obj_get_parent(new_tileview));
}
else {
w = lv_disp_get_hor_res(NULL);
h = lv_disp_get_ver_res(NULL);
}
lv_obj_set_size(new_tileview, w, h);
lv_obj_set_drag_throw(lv_page_get_scrollable(new_tileview), true);
lv_obj_set_drag_dir(lv_page_get_scrollable(new_tileview), LV_DRAG_DIR_ONE);
lv_page_set_scrollable_fit(new_tileview, LV_FIT_MAX);
lv_obj_reset_style_list(new_tileview, LV_PAGE_PART_SCROLLABLE);
lv_theme_apply(new_tileview, LV_THEME_TILEVIEW);
}
/*Copy an existing tileview*/
else {
lv_tileview_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
ext->act_id.x = copy_ext->act_id.x;
ext->act_id.y = copy_ext->act_id.y;
ext->valid_pos = copy_ext->valid_pos;
ext->valid_pos_cnt = copy_ext->valid_pos_cnt;
#if LV_USE_ANIMATION
ext->anim_time = copy_ext->anim_time;
#endif
/*Refresh the style with new signal function*/
lv_obj_refresh_style(new_tileview, LV_STYLE_PROP_ALL);
}
LV_LOG_INFO("tileview created");
return new_tileview;
}
/*======================
* Add/remove functions
*=====================*/
/**
* Register an object on the tileview. The register object will able to slide the tileview
* @param tileview pointer to a Tileview object
* @param element pointer to an object
*/
void lv_tileview_add_element(lv_obj_t * tileview, lv_obj_t * element)
{
LV_UNUSED(tileview);
LV_ASSERT_OBJ(tileview, LV_OBJX_NAME);
LV_ASSERT_NULL(tileview);
lv_page_glue_obj(element, true);
}
/*=====================
* Setter functions
*====================*/
/**
* Set the valid position's indices. The scrolling will be possible only to these positions.
* @param tileview pointer to a Tileview object
* @param valid_pos array width the indices. E.g. `lv_point_t p[] = {{0,0}, {1,0}, {1,1}`.
* Only the pointer is saved so can't be a local variable.
* @param valid_pos_cnt number of elements in `valid_pos` array
*/
void lv_tileview_set_valid_positions(lv_obj_t * tileview, const lv_point_t valid_pos[], uint16_t valid_pos_cnt)
{
LV_ASSERT_OBJ(tileview, LV_OBJX_NAME);
LV_ASSERT_NULL(valid_pos);
lv_tileview_ext_t * ext = lv_obj_get_ext_attr(tileview);
ext->valid_pos = valid_pos;
ext->valid_pos_cnt = valid_pos_cnt;
set_valid_drag_dirs(tileview);
/*If valid pos. is selected do nothing*/
uint16_t i;
for(i = 0; i < valid_pos_cnt; i++) {
if(valid_pos[i].x == ext->act_id.x && valid_pos[i].y == ext->act_id.y) {
return;
}
}
/*Set a valid position if now an invalid is selected*/
if(valid_pos_cnt > 0) {
lv_tileview_set_tile_act(tileview, valid_pos[0].x, valid_pos[0].y, LV_ANIM_OFF);
}
}
/**
* Set the tile to be shown
* @param tileview pointer to a tileview object
* @param x column id (0, 1, 2...)
* @param y line id (0, 1, 2...)
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
void lv_tileview_set_tile_act(lv_obj_t * tileview, lv_coord_t x, lv_coord_t y, lv_anim_enable_t anim)
{
LV_ASSERT_OBJ(tileview, LV_OBJX_NAME);
#if LV_USE_ANIMATION == 0
anim = LV_ANIM_OFF;
#endif
lv_tileview_ext_t * ext = lv_obj_get_ext_attr(tileview);
uint32_t tile_id;
bool valid = false;
for(tile_id = 0; tile_id < ext->valid_pos_cnt; tile_id++) {
if(ext->valid_pos[tile_id].x == x && ext->valid_pos[tile_id].y == y) {
valid = true;
break;
}
}
if(valid == false) return; /*Don't load not valid tiles*/
ext->act_id.x = x;
ext->act_id.y = y;
lv_coord_t x_coord = -x * lv_obj_get_width(tileview);
lv_coord_t y_coord = -y * lv_obj_get_height(tileview);
lv_obj_t * scrl = lv_page_get_scrollable(tileview);
if(anim) {
#if LV_USE_ANIMATION
lv_coord_t x_act = lv_obj_get_x(scrl);
lv_coord_t y_act = lv_obj_get_y(scrl);
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, scrl);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_x);
lv_anim_set_time(&a, ext->anim_time);
if(x_coord != x_act) {
lv_anim_set_values(&a, x_act, x_coord);
lv_anim_start(&a);
}
if(y_coord != y_act) {
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_obj_set_y);
lv_anim_set_values(&a, y_act, y_coord);
lv_anim_start(&a);
}
#endif
}
else {
lv_obj_set_pos(scrl, x_coord, y_coord);
}
lv_res_t res;
res = lv_event_send(tileview, LV_EVENT_VALUE_CHANGED, &tile_id);
if(res != LV_RES_OK) return; /*Prevent the tile loading*/
set_valid_drag_dirs(tileview);
}
/*=====================
* Getter functions
*====================*/
/*
* New object specific "get" functions come here
*/
/**
* Get the tile to be shown
* @param tileview pointer to a tileview object
* @param x column id (0, 1, 2...)
* @param y line id (0, 1, 2...)
*/
void lv_tileview_get_tile_act(lv_obj_t * tileview, lv_coord_t * x, lv_coord_t * y)
{
lv_tileview_ext_t * ext = lv_obj_get_ext_attr(tileview);
*x = ext->act_id.x;
*y = ext->act_id.y;
}
/*=====================
* Other functions
*====================*/
/*
* New object specific "other" functions come here
*/
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Signal function of the tileview
* @param tileview pointer to a tileview object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_tileview_signal(lv_obj_t * tileview, lv_signal_t sign, void * param)
{
lv_res_t res;
/* Include the ancient signal function */
res = ancestor_signal(tileview, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
if(sign == LV_SIGNAL_CLEANUP) {
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
}
return res;
}
/**
* Signal function of the tileview scrollable
* @param tileview pointer to the scrollable part of the tileview object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_tileview_scrl_signal(lv_obj_t * scrl, lv_signal_t sign, void * param)
{
lv_res_t res;
/* Include the ancient signal function */
res = ancestor_scrl_signal(scrl, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, "");
lv_obj_t * tileview = lv_obj_get_parent(scrl);
if(sign == LV_SIGNAL_DRAG_BEGIN) {
set_valid_drag_dirs(tileview);
}
else if(sign == LV_SIGNAL_DRAG_THROW_BEGIN) {
drag_end_handler(tileview);
res = lv_indev_finish_drag(lv_indev_get_act());
if(res != LV_RES_OK) return res;
}
/*Apply constraint on moving of the tileview*/
else if(sign == LV_SIGNAL_COORD_CHG) {
lv_indev_t * indev = lv_indev_get_act();
if(indev) {
lv_tileview_ext_t * ext = lv_obj_get_ext_attr(tileview);
lv_coord_t x = lv_obj_get_x(scrl);
lv_coord_t y = lv_obj_get_y(scrl);
lv_coord_t h = lv_obj_get_height(tileview);
lv_coord_t w = lv_obj_get_width(tileview);
lv_coord_t top = lv_obj_get_style_pad_top(tileview, LV_TILEVIEW_PART_BG);
lv_coord_t left = lv_obj_get_style_pad_left(tileview, LV_TILEVIEW_PART_BG);
if(!ext->drag_top_en && y > -(ext->act_id.y * h) && indev->proc.types.pointer.vect.y > 0) {
lv_page_start_edge_flash(tileview, LV_PAGE_EDGE_TOP);
lv_obj_set_y(scrl, -ext->act_id.y * h + top);
}
if(!ext->drag_bottom_en && indev->proc.types.pointer.vect.y < 0 && y < -(ext->act_id.y * h)) {
lv_page_start_edge_flash(tileview, LV_PAGE_EDGE_BOTTOM);
lv_obj_set_y(scrl, -ext->act_id.y * h + top);
}
if(!ext->drag_left_en && x > -(ext->act_id.x * w) && indev->proc.types.pointer.vect.x > 0) {
lv_page_start_edge_flash(tileview, LV_PAGE_EDGE_LEFT);
lv_obj_set_x(scrl, -ext->act_id.x * w + left);
}
if(!ext->drag_right_en && indev->proc.types.pointer.vect.x < 0 && x < -(ext->act_id.x * w)) {
lv_page_start_edge_flash(tileview, LV_PAGE_EDGE_RIGHT);
lv_obj_set_x(scrl, -ext->act_id.x * w + left);
}
/*Apply the drag constraints*/
lv_drag_dir_t drag_dir = indev->proc.types.pointer.drag_dir;
if(drag_dir == LV_DRAG_DIR_HOR)
lv_obj_set_y(scrl, -ext->act_id.y * lv_obj_get_height(tileview) + top);
else if(drag_dir == LV_DRAG_DIR_VER)
lv_obj_set_x(scrl, -ext->act_id.x * lv_obj_get_width(tileview) + left);
}
}
return res;
}
/**
* Called when the user releases an element of the tileview after dragging it.
* @param tileview pointer to a tileview object
*/
static void drag_end_handler(lv_obj_t * tileview)
{
lv_tileview_ext_t * ext = lv_obj_get_ext_attr(tileview);
lv_indev_t * indev = lv_indev_get_act();
lv_point_t point_act;
lv_indev_get_point(indev, &point_act);
lv_obj_t * scrl = lv_page_get_scrollable(tileview);
lv_point_t p;
p.x = -(lv_obj_get_x(scrl) - lv_obj_get_width(tileview) / 2);
p.y = -(lv_obj_get_y(scrl) - lv_obj_get_height(tileview) / 2);
lv_drag_dir_t drag_dir = indev->proc.types.pointer.drag_dir;
/*From the drag vector (drag throw) predict the end position*/
if(drag_dir & LV_DRAG_DIR_HOR) {
lv_point_t vect;
lv_indev_get_vect(indev, &vect);
lv_coord_t predict = 0;
while(vect.x != 0) {
predict += vect.x;
vect.x = vect.x * (100 - LV_INDEV_DEF_DRAG_THROW) / 100;
}
p.x -= predict;
}
else if(drag_dir & LV_DRAG_DIR_VER) {
lv_point_t vect;
lv_indev_get_vect(indev, &vect);
lv_coord_t predict = 0;
while(vect.y != 0) {
predict += vect.y;
vect.y = vect.y * (100 - LV_INDEV_DEF_DRAG_THROW) / 100;
}
p.y -= predict;
}
/*Get the index of the tile*/
p.x = p.x / lv_obj_get_width(tileview);
p.y = p.y / lv_obj_get_height(tileview);
/*Max +- move*/
lv_coord_t x_move = p.x - ext->act_id.x;
lv_coord_t y_move = p.y - ext->act_id.y;
if(x_move < -1) x_move = -1;
if(x_move > 1) x_move = 1;
if(y_move < -1) y_move = -1;
if(y_move > 1) y_move = 1;
/*Set the new tile*/
lv_tileview_set_tile_act(tileview, ext->act_id.x + x_move, ext->act_id.y + y_move, true);
}
static bool set_valid_drag_dirs(lv_obj_t * tileview)
{
lv_tileview_ext_t * ext = lv_obj_get_ext_attr(tileview);
if(ext->valid_pos == NULL) return false;
ext->drag_bottom_en = 0;
ext->drag_top_en = 0;
ext->drag_left_en = 0;
ext->drag_right_en = 0;
uint16_t i;
for(i = 0; i < ext->valid_pos_cnt; i++) {
if(ext->valid_pos[i].x == ext->act_id.x && ext->valid_pos[i].y == ext->act_id.y - 1) ext->drag_top_en = 1;
if(ext->valid_pos[i].x == ext->act_id.x && ext->valid_pos[i].y == ext->act_id.y + 1) ext->drag_bottom_en = 1;
if(ext->valid_pos[i].x == ext->act_id.x - 1 && ext->valid_pos[i].y == ext->act_id.y) ext->drag_left_en = 1;
if(ext->valid_pos[i].x == ext->act_id.x + 1 && ext->valid_pos[i].y == ext->act_id.y) ext->drag_right_en = 1;
}
return true;
}
#endif
|
train_000.parquet/989
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_tileview.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 15395,
"token_count": 6319
}
|
/**
* @file lv_slider.h
*
*/
#ifndef LV_SLIDER_H
#define LV_SLIDER_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_SLIDER != 0
/*Testing of dependencies*/
#if LV_USE_BAR == 0
#error "lv_slider: lv_bar is required. Enable it in lv_conf.h (LV_USE_BAR 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "lv_bar.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
enum {
LV_SLIDER_TYPE_NORMAL,
LV_SLIDER_TYPE_SYMMETRICAL,
LV_SLIDER_TYPE_RANGE
};
typedef uint8_t lv_slider_type_t;
/*Data of slider*/
typedef struct {
lv_bar_ext_t bar; /*Ext. of ancestor*/
/*New data for this type */
lv_style_list_t style_knob; /*Style of the knob*/
lv_area_t left_knob_area;
lv_area_t right_knob_area;
int16_t * value_to_set; /* Which bar value to set */
uint8_t dragging : 1; /*1: the slider is being dragged*/
} lv_slider_ext_t;
/** Built-in styles of slider*/
enum {
LV_SLIDER_PART_BG, /** Slider background style. */
LV_SLIDER_PART_INDIC, /** Slider indicator (filled area) style. */
LV_SLIDER_PART_KNOB, /** Slider knob style. */
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a slider objects
* @param par pointer to an object, it will be the parent of the new slider
* @param copy pointer to a slider object, if not NULL then the new object will be copied from it
* @return pointer to the created slider
*/
lv_obj_t * lv_slider_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
*====================*/
/**
* Set a new value on the slider
* @param slider pointer to a slider object
* @param value new value
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
static inline void lv_slider_set_value(lv_obj_t * slider, int16_t value, lv_anim_enable_t anim)
{
lv_bar_set_value(slider, value, anim);
}
/**
* Set a new value for the left knob of a slider
* @param slider pointer to a slider object
* @param left_value new value
* @param anim LV_ANIM_ON: set the value with an animation; LV_ANIM_OFF: change the value immediately
*/
static inline void lv_slider_set_left_value(lv_obj_t * slider, int16_t left_value, lv_anim_enable_t anim)
{
lv_bar_set_start_value(slider, left_value, anim);
}
/**
* Set minimum and the maximum values of a bar
* @param slider pointer to the slider object
* @param min minimum value
* @param max maximum value
*/
static inline void lv_slider_set_range(lv_obj_t * slider, int16_t min, int16_t max)
{
lv_bar_set_range(slider, min, max);
}
/**
* Set the animation time of the slider
* @param slider pointer to a bar object
* @param anim_time the animation time in milliseconds.
*/
static inline void lv_slider_set_anim_time(lv_obj_t * slider, uint16_t anim_time)
{
lv_bar_set_anim_time(slider, anim_time);
}
/**
* Make the slider symmetric to zero. The indicator will grow from zero instead of the minimum
* position.
* @param slider pointer to a slider object
* @param en true: enable disable symmetric behavior; false: disable
*/
static inline void lv_slider_set_type(lv_obj_t * slider, lv_slider_type_t type)
{
if(type == LV_SLIDER_TYPE_NORMAL)
lv_bar_set_type(slider, LV_BAR_TYPE_NORMAL);
else if(type == LV_SLIDER_TYPE_SYMMETRICAL)
lv_bar_set_type(slider, LV_BAR_TYPE_SYMMETRICAL);
else if(type == LV_SLIDER_TYPE_RANGE)
lv_bar_set_type(slider, LV_BAR_TYPE_CUSTOM);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the value of the main knob of a slider
* @param slider pointer to a slider object
* @return the value of the main knob of the slider
*/
int16_t lv_slider_get_value(const lv_obj_t * slider);
/**
* Get the value of the left knob of a slider
* @param slider pointer to a slider object
* @return the value of the left knob of the slider
*/
static inline int16_t lv_slider_get_left_value(const lv_obj_t * slider)
{
return lv_bar_get_start_value(slider);
}
/**
* Get the minimum value of a slider
* @param slider pointer to a slider object
* @return the minimum value of the slider
*/
static inline int16_t lv_slider_get_min_value(const lv_obj_t * slider)
{
return lv_bar_get_min_value(slider);
}
/**
* Get the maximum value of a slider
* @param slider pointer to a slider object
* @return the maximum value of the slider
*/
static inline int16_t lv_slider_get_max_value(const lv_obj_t * slider)
{
return lv_bar_get_max_value(slider);
}
/**
* Give the slider is being dragged or not
* @param slider pointer to a slider object
* @return true: drag in progress false: not dragged
*/
bool lv_slider_is_dragged(const lv_obj_t * slider);
/**
* Get the animation time of the slider
* @param slider pointer to a slider object
* @return the animation time in milliseconds.
*/
static inline uint16_t lv_slider_get_anim_time(lv_obj_t * slider)
{
return lv_bar_get_anim_time(slider);
}
/**
* Get whether the slider is symmetric or not.
* @param slider pointer to a bar object
* @return true: symmetric is enabled; false: disable
*/
static inline lv_slider_type_t lv_slider_get_type(lv_obj_t * slider)
{
lv_bar_type_t type = lv_bar_get_type(slider);
if(type == LV_BAR_TYPE_SYMMETRICAL)
return LV_SLIDER_TYPE_SYMMETRICAL;
else if(type == LV_BAR_TYPE_CUSTOM)
return LV_SLIDER_TYPE_RANGE;
else
return LV_SLIDER_TYPE_NORMAL;
}
/**********************
* MACROS
**********************/
#endif /*LV_USE_SLIDER*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_SLIDER_H*/
|
train_000.parquet/990
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_slider.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 5795,
"token_count": 2180
}
|
/**
* @file lv_img.h
*
*/
#ifndef LV_IMG_H
#define LV_IMG_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_IMG != 0
#include "../lv_core/lv_obj.h"
#include "../lv_misc/lv_fs.h"
#include "lv_label.h"
#include "../lv_draw/lv_draw.h"
/*********************
* DEFINES
*********************/
/**********************
* TYPEDEFS
**********************/
/*Data of image*/
typedef struct {
/*No inherited ext. because inherited from the base object*/ /*Ext. of ancestor*/
/*New data for this type */
const void * src; /*Image source: Pointer to an array or a file or a symbol*/
lv_point_t offset;
lv_coord_t w; /*Width of the image (Handled by the library)*/
lv_coord_t h; /*Height of the image (Handled by the library)*/
uint16_t angle; /*rotation angle of the image*/
lv_point_t pivot; /*rotation center of the image*/
uint16_t zoom; /*256 means no zoom, 512 double size, 128 half size*/
uint8_t src_type : 2; /*See: lv_img_src_t*/
uint8_t auto_size : 1; /*1: automatically set the object size to the image size*/
uint8_t cf : 5; /*Color format from `lv_img_color_format_t`*/
uint8_t antialias : 1; /*Apply anti-aliasing in transformations (rotate, zoom)*/
} lv_img_ext_t;
/*Image parts*/
enum {
LV_IMG_PART_MAIN,
};
typedef uint8_t lv_img_part_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create an image objects
* @param par pointer to an object, it will be the parent of the new button
* @param copy pointer to a image object, if not NULL then the new object will be copied from it
* @return pointer to the created image
*/
lv_obj_t * lv_img_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
*====================*/
/**
* Set the pixel map to display by the image
* @param img pointer to an image object
* @param data the image data
*/
void lv_img_set_src(lv_obj_t * img, const void * src_img);
/**
* Enable the auto size feature.
* If enabled the object size will be same as the picture size.
* @param img pointer to an image
* @param en true: auto size enable, false: auto size disable
*/
void lv_img_set_auto_size(lv_obj_t * img, bool autosize_en);
/**
* Set an offset for the source of an image.
* so the image will be displayed from the new origin.
* @param img pointer to an image
* @param x: the new offset along x axis.
*/
void lv_img_set_offset_x(lv_obj_t * img, lv_coord_t x);
/**
* Set an offset for the source of an image.
* so the image will be displayed from the new origin.
* @param img pointer to an image
* @param y: the new offset along y axis.
*/
void lv_img_set_offset_y(lv_obj_t * img, lv_coord_t y);
/**
* Set the rotation center of the image.
* The image will be rotated around this point
* @param img pointer to an image object
* @param pivot_x rotation center x of the image
* @param pivot_y rotation center y of the image
*/
void lv_img_set_pivot(lv_obj_t * img, lv_coord_t pivot_x, lv_coord_t pivot_y);
/**
* Set the rotation angle of the image.
* The image will be rotated around the set pivot set by `lv_img_set_pivot()`
* @param img pointer to an image object
* @param angle rotation angle in degree with 0.1 degree resolution (0..3600: clock wise)
*/
void lv_img_set_angle(lv_obj_t * img, int16_t angle);
/**
* Set the zoom factor of the image.
* @param img pointer to an image object
* @param zoom the zoom factor.
* - 256 or LV_ZOOM_IMG_NONE for no zoom
* - <256: scale down
* - >256 scale up
* - 128 half size
* - 512 double size
*/
void lv_img_set_zoom(lv_obj_t * img, uint16_t zoom);
/**
* Enable/disable anti-aliasing for the transformations (rotate, zoom) or not
* @param img pointer to an image object
* @param antialias true: anti-aliased; false: not anti-aliased
*/
void lv_img_set_antialias(lv_obj_t * img, bool antialias);
/*=====================
* Getter functions
*====================*/
/**
* Get the source of the image
* @param img pointer to an image object
* @return the image source (symbol, file name or C array)
*/
const void * lv_img_get_src(lv_obj_t * img);
/**
* Get the name of the file set for an image
* @param img pointer to an image
* @return file name
*/
const char * lv_img_get_file_name(const lv_obj_t * img);
/**
* Get the auto size enable attribute
* @param img pointer to an image
* @return true: auto size is enabled, false: auto size is disabled
*/
bool lv_img_get_auto_size(const lv_obj_t * img);
/**
* Get the offset.x attribute of the img object.
* @param img pointer to an image
* @return offset.x value.
*/
lv_coord_t lv_img_get_offset_x(lv_obj_t * img);
/**
* Get the offset.y attribute of the img object.
* @param img pointer to an image
* @return offset.y value.
*/
lv_coord_t lv_img_get_offset_y(lv_obj_t * img);
/**
* Get the rotation angle of the image.
* @param img pointer to an image object
* @return rotation angle in degree (0..359)
*/
uint16_t lv_img_get_angle(lv_obj_t * img);
/**
* Get the rotation center of the image.
* @param img pointer to an image object
* @param center rotation center of the image
*/
void lv_img_get_pivot(lv_obj_t * img, lv_point_t * center);
/**
* Get the zoom factor of the image.
* @param img pointer to an image object
* @return zoom factor (256: no zoom)
*/
uint16_t lv_img_get_zoom(lv_obj_t * img);
/**
* Get whether the transformations (rotate, zoom) are anti-aliased or not
* @param img pointer to an image object
* @return true: anti-aliased; false: not anti-aliased
*/
bool lv_img_get_antialias(lv_obj_t * img);
/**********************
* MACROS
**********************/
/*Use this macro to declare an image in a c file*/
#define LV_IMG_DECLARE(var_name) extern const lv_img_dsc_t var_name;
#endif /*LV_USE_IMG*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_IMG_H*/
|
train_000.parquet/991
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_img.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 6012,
"token_count": 2161
}
|
#!/usr/bin/env bash
# shellcheck disable=SC2317
#------------------------------------------------------------------------------
# Show Synology smart test progress or smart health and attributes
#
# GitHub: https://github.com/007revad/Synology_SMART_info
# Script verified at https://www.shellcheck.net/
#
# To run in a shell (replace /volume1/scripts/ with path to script):
# sudo /volume1/scripts/syno_smart_info.sh
#------------------------------------------------------------------------------
# References:
# https://www.backblaze.com/blog/hard-drive-smart-stats/
# https://www.backblaze.com/blog/what-smart-stats-indicate-hard-drive-failures/
# https://www.backblaze.com/blog/making-sense-of-ssd-smart-stats/
#------------------------------------------------------------------------------
# References for converting Seagate raw values:
# https://codeberg.org/SWEETGOOD/shell-scripts#parse-raw-smart-values-seagate-sh
# https://codeberg.org/SWEETGOOD/shell-scripts/raw/branch/main/parse-raw-smart-values-seagate.sh
#
# online Seagate SMART value convertor
# https://www.disktuna.com/seagate-raw-smart-attributes-to-error-convertertest/#102465319
#
# https://github.com/Seagate/openSeaChest/wiki/Drive-Health-and-SMART
#------------------------------------------------------------------------------
scriptver="v1.3.19"
script=Synology_SMART_info
repo="007revad/Synology_SMART_info"
# Get NAS model
model=$(cat /proc/sys/kernel/syno_hw_version)
# Get NAS hostname
host_name=$(hostname)
# Get DSM full version
productversion=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION productversion)
buildphase=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION buildphase)
buildnumber=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION buildnumber)
smallfixnumber=$(/usr/syno/bin/synogetkeyvalue /etc.defaults/VERSION smallfixnumber)
# Get DSM major version
dsm=$(get_key_value /etc.defaults/VERSION majorversion)
# Get smartctl location and check if version 7
if which smartctl7 >/dev/null; then
# smartmontools 7 from SynoCli Disk Tools is installed
smartctl=$(which smartctl7)
smartversion=7
else
smartctl=$(which smartctl)
fi
ding(){
printf \\a
}
debug() {
[[ $debug == "yes" ]] && echo "DEBUG: $*"
}
usage(){
cat <<EOF
$script $scriptver - by 007revad
Usage: $(basename "$0") [options]
Options:
-a, --all Show all SMART attributes
-e, --email Disable colored text in output scheduler emails
-h, --help Show this help message
-v, --version Show the script version
EOF
exit 1
}
scriptversion(){
cat <<EOF
$script $scriptver - by 007revad
See https://github.com/$repo
EOF
exit 0
}
# Save options used
args=("$@")
# Check for flags with getopt
if options="$(getopt -o abcdefghijklmnopqrstuvwxyz0123456789 -l \
all,email,help,version,debug \
-- "$@")"; then
eval set -- "$options"
while true; do
case "${1,,}" in
-a|--all) # Show all SMART attributes
all=yes
;;
-e|--email) # Disable colour text in task scheduler emails
color=no
;;
-h|--help) # Show usage options
usage
;;
-v|--version) # Show script version
scriptversion
;;
-d|--debug) # Show and log debug info
debug=yes
;;
--)
shift
break
;;
*) # Show usage options
echo -e "Invalid option '$1'\n"
usage "$1"
;;
esac
shift
done
else
echo
usage
fi
# Shell Colors
if [[ $color != "no" ]]; then
#Black='\e[0;30m' # ${Black}
#Red='\e[0;31m' # ${Red}
LiteRed='\e[1;31m' # ${LiteRed}
#Green='\e[0;32m' # ${Green}
LiteGreen='\e[1;32m' # ${LiteGreen}
Yellow='\e[0;33m' # ${Yellow}
#Blue='\e[0;34m' # ${Blue}
#Purple='\e[0;35m' # ${Purple}
Cyan='\e[0;36m' # ${Cyan}
#White='\e[0;37m' # ${White}
Error='\e[41m' # ${Error}
Off='\e[0m' # ${Off}
else
echo "" # For task scheduler email readability
fi
# Check script is running as root
if [[ $( whoami ) != "root" ]]; then
ding
echo -e "\n${Error}ERROR${Off} This script must be run as sudo or root!\n"
exit 1 # Not running as root
fi
# Show script version
#echo -e "$script $scriptver\ngithub.com/$repo\n"
echo "$script $scriptver - by 007revad"
# Show hostname, model and DSM full version
if [[ $buildphase == GM ]]; then buildphase=""; fi
if [[ $smallfixnumber -gt "0" ]]; then smallfix="-$smallfixnumber"; fi
echo -e "$host_name $model DSM $productversion-$buildnumber$smallfix $buildphase"
echo "Using smartctl $("$smartctl" --version | head -1 | awk '{print $2}')"
# Show options used
if [[ ${#args[@]} -gt "0" ]]; then
echo "Using options: ${args[*]}"
fi
#------------------------------------------------------------------------------
# Check latest release with GitHub API
# Get latest release info
# Curl timeout options:
# https://unix.stackexchange.com/questions/94604/does-curl-have-a-timeout
#release=$(curl --silent -m 10 --connect-timeout 5 \
# "https://api.github.com/repos/$repo/releases/latest")
# Use wget to avoid installing curl in Ubuntu
release=$(wget -qO- -q --connect-timeout=5 \
"https://api.github.com/repos/$repo/releases/latest")
# Release version
tag=$(echo "$release" | grep '"tag_name":' | sed -E 's/.*"([^"]+)".*/\1/')
#shorttag="${tag:1}"
if ! printf "%s\n%s\n" "$tag" "$scriptver" |
sort --check=quiet --version-sort >/dev/null ; then
echo -e "\n${Cyan}There is a newer version of this script available.${Off}"
echo -e "Current version: ${scriptver}\nLatest version: $tag"
fi
#------------------------------------------------------------------------------
detect_dtype(){
# Default to SAT
local dtype="sat"
# If SAS appears at least once, treat as SCSI
if [ "$("$smartctl" -i /dev/"$drive" 2>/dev/null | grep -c SAS)" -gt 0 ]; then
dtype="scsi"
# Else if SATA appears at least once, treat as SAT
elif [ "$("$smartctl" -i /dev/"$drive" 2>/dev/null | grep -c SATA)" -gt 0 ]; then
dtype="sat"
fi
echo "$dtype"
}
get_drive_num(){
drive_num=""
disk_id=""
disk_cnr=""
disk_cnridx=""
eunit_num=""
eunit_model=""
eunit=""
# Get Drive number
disk_id=$(synodisk --get_location_form "/dev/$drive" | grep 'Disk id:' | awk '{print $NF}')
disk_cnr=$(synodisk --get_location_form "/dev/$drive" | grep 'Disk cnr:' | awk '{print $NF}')
disk_cnridx=$(synodisk --get_location_form "/dev/$drive" | grep 'Disk cnridx:' | awk '{print $NF}')
# Get eunit model and port number
if [[ $disk_cnridx -gt "0" ]]; then
eunit_num="$disk_cnridx"
eunit_model=$(syno_slot_mapping "/dev/$drive" | grep "Eunit port $disk_cnridx" | awk '{print $NF}')
eunit="(${eunit_model}-$eunit_num)"
fi
if [[ $disk_cnr -eq "4" ]]; then
drive_num="USB Drive "
elif [[ $eunit ]]; then
drive_num="Drive $disk_id $eunit "
else
drive_num="Drive $disk_id "
fi
}
get_nvme_num(){
# Get M.2 Drive number
drive_num=""
pcislot=""
cardslot=""
if nvme=$(synonvme --get-location "/dev/$drive"); then
if [[ ! $nvme =~ "PCI Slot: 0" ]]; then
pcislot="$(echo "$nvme" | cut -d"," -f2 | awk '{print $NF}')-"
fi
cardslot="$(echo "$nvme" | awk '{print $NF}')"
else
pcislot="$(basename -- "$drive")"
cardslot=""
fi
drive_num="M.2 Drive $pcislot$cardslot "
}
show_drive_model(){
# Get drive model
# $drive is sata1 or sda or usb1 etc
#vendor=$(cat "/sys/block/$drive/device/vendor")
#vendor=$(printf "%s" "$vendor" | xargs) # trim leading and trailing white space
model=$(cat "/sys/block/$drive/device/model")
model=$(printf "%s" "$model" | xargs) # trim leading and trailing white space
# Get drive serial number
if echo "$drive" | grep nvme >/dev/null ; then
serial=$(cat "/sys/block/$drive/device/serial")
else
serial=$(cat "/sys/block/$drive/device/syno_disk_serial")
fi
serial=$(printf "%s" "$serial" | xargs) # trim leading and trailing white space
# Get drive serial number with smartctl for USB drives
# if [[ -z "$serial" && "${drive:0:4}" != "nvme" ]]; then
if [[ -z "$serial" ]]; then
serial=$("$smartctl" -i -d sat /dev/"$drive" | grep Serial | cut -d":" -f2 | xargs)
fi
# Show drive model and serial
#echo -e "\n${Cyan}${drive_num}${Off}$model ${Yellow}$serial${Off}"
echo -e "\n${Cyan}${drive_num}${Off}$model $serial /dev/$drive"
#echo -e "\n${Cyan}${drive_num}${Off}$vendor $model $serial"
}
# Python-based SMART attribute formatting function using EOF method
print_colored_smart_attribute(){
local line="$1"
[[ -z "$line" ]] && return
# Pass color disable option to Python
local color_opt="1"
if [[ $color == "no" ]]; then
color_opt="0"
fi
# Execute Python script using HERE document
echo "$line" | python3 -c "
import sys
import re
def format_smart_line():
line = sys.stdin.read().strip()
color_enabled = bool(int('$color_opt'))
if not line:
return
YELLOW = '\033[0;33m'
OFF = '\033[0m'
COLOR_IDS = {5, 10, 187, 188, 196, 197, 198}
fields = line.split()
if len(fields) < 6:
print(line)
return
try:
id_field = fields[0]
id_num = int(id_field)
except ValueError:
print(line)
return
flags_pattern = re.compile(r'^[POSRCK-]{6}$')
flags_idx = -1
for i, field in enumerate(fields[1:], 1):
if flags_pattern.match(field):
flags_idx = i
break
if flags_idx == -1 or len(fields) < flags_idx + 5:
print(line)
return
attr_name = ' '.join(fields[1:flags_idx])
flags = fields[flags_idx]
value = fields[flags_idx + 1]
worst = fields[flags_idx + 2]
thresh = fields[flags_idx + 3]
fail = fields[flags_idx + 4]
raw_value = ' '.join(fields[flags_idx + 5:]) if len(fields) > flags_idx + 5 else ''
formatted_line = f'{id_field:<4} {attr_name:<32} {flags:<8} {value:>6} {worst:>6} {thresh:>7} {fail:>6} {raw_value}'
if color_enabled and id_num in COLOR_IDS:
print(f'{YELLOW}{formatted_line}{OFF}')
else:
print(formatted_line)
format_smart_line()
"
}
# SMART header output function
print_smart_header(){
printf "%-4s %-32s %-8s %6s %6s %7s %6s %s\n" \
"ID#" "ATTRIBUTE_NAME" "FLAGS" "VALUE" "WORST" "THRESH" "FAIL" "RAW_VALUE"
}
# SCSI SMART attribute formatting function (uses SCSI-only parsing)
format_scsi_smart(){
local drive="$1"
local output
debug "format_scsi_smart called for drive: $drive"
# Retrieve SCSI SMART output via wrapper; strip the leading header block
output=$("$smartctl" -a "/dev/$drive" | tail -n +19)
debug "SCSI output (first 20 lines):"
debug "$(echo "$output" | head -20)"
# Arrays to hold parsed items
declare -a scsi_ids=()
declare -a scsi_names=()
declare -a scsi_values=()
# Parse 5 patterns and map to standard IDs
while IFS= read -r line; do
debug "Processing line: '$line'"
if [[ "$line" == *"Current Drive Temperature:"* ]]; then
# Extract temperature number only
temp_value=$(echo "$line" | grep -o '[0-9]\+' | head -1)
debug "Found temperature: $temp_value"
scsi_ids+=(194); scsi_names+=("Current Drive Temperature"); scsi_values+=("$temp_value")
elif [[ "$line" == *"Accumulated power on time, hours:minutes"* ]]; then
time_value=$(echo "$line" | awk -F'Accumulated power on time, hours:minutes ' '{print $2}' | xargs)
debug "Found power on time: '$time_value'"
scsi_ids+=(9); scsi_names+=("Accumulated power on time"); scsi_values+=("$time_value")
elif [[ "$line" == *"Accumulated start-stop cycles:"* ]]; then
cycle_value=$(echo "$line" | awk '{print $NF}')
debug "Found start-stop cycles: $cycle_value"
scsi_ids+=(4); scsi_names+=("Accumulated start-stop cycles"); scsi_values+=("$cycle_value")
elif [[ "$line" == *"Accumulated load-unload cycles:"* ]]; then
load_value=$(echo "$line" | awk '{print $NF}')
debug "Found load-unload cycles: $load_value"
scsi_ids+=(193); scsi_names+=("Accumulated load-unload cycles"); scsi_values+=("$load_value")
elif [[ "$line" == *"Elements in grown defect list:"* ]]; then
defect_value=$(echo "$line" | awk '{print $NF}')
debug "Found defect list elements: $defect_value"
scsi_ids+=(5); scsi_names+=("Elements in grown defect list"); scsi_values+=("$defect_value")
fi
done <<< "$output"
debug "Found ${#scsi_ids[@]} attributes"
for ((i=0; i<${#scsi_ids[@]}; i++)); do
debug "ID=${scsi_ids[i]}, Name='${scsi_names[i]}', Value='${scsi_values[i]}'"
done
if [[ ${#scsi_ids[@]} -eq 0 ]]; then
debug "No SCSI attributes found, showing raw output"
echo "No SCSI attributes found in expected format"
echo "$output"
return
fi
# Sort by ID (bubble sort for simplicity)
local n=${#scsi_ids[@]}
for ((i=0; i<n-1; i++)); do
for ((j=0; j<n-i-1; j++)); do
if [[ ${scsi_ids[j]} -gt ${scsi_ids[j+1]} ]]; then
# swap id
tmp=${scsi_ids[j]}; scsi_ids[j]=${scsi_ids[j+1]}; scsi_ids[j+1]=$tmp
# swap name
tmp=${scsi_names[j]}; scsi_names[j]=${scsi_names[j+1]}; scsi_names[j+1]=$tmp
# swap value
tmp=${scsi_values[j]}; scsi_values[j]=${scsi_values[j+1]}; scsi_values[j+1]=$tmp
fi
done
done
# Output (SCSI-only summary header and rows)
printf "%-4s %-40s %s\n" "ID#" "ATTRIBUTE_NAME" "RAW_VALUE"
for ((i=0; i<${#scsi_ids[@]}; i++)); do
local id=${scsi_ids[i]} name=${scsi_names[i]} val=${scsi_values[i]}
if [[ $color != "no" && ( $id -eq 5 ) ]]; then
printf "${Yellow}%-4s %-40s %s${Off}\n" "$id" "$name" "$val"
else
printf "%-4s %-40s %s\n" "$id" "$name" "$val"
fi
done
}
smart_all(){
echo ""
# Decide device type (sat/scsi) via detect_dtype()
local drive_type
drive_type=$(detect_dtype)
if [[ "$drive_type" == "scsi" ]]; then
# SCSI path: do not print SAT header or use SAT python formatter.
# Let the dedicated SCSI formatter read and parse directly.
format_scsi_smart "$drive"
return
fi
# SAT / non-SCSI path
print_smart_header
if [[ $seagate == "yes" ]] && [[ $smartversion == 7 ]]; then
# Get all attributes, skip built-in header (first 6 lines), then drop “ID#” header
readarray -t att_array < <(
"$smartctl" -A -f brief -d sat -T permissive \
-v 1,raw48:54 -v 7,raw48:54 -v 195,raw48:54 "/dev/$drive" \
| tail -n +7 \
| grep -v '^ID#'
)
else
# Same for non-Seagate drives
readarray -t att_array < <(
"$smartctl" -A -f brief -d sat -T permissive "/dev/$drive" \
| tail -n +7 \
| grep -v '^ID#'
)
fi
for strIn in "${att_array[@]}"; do
# Remove lines containing ||||||_ to |______
if ! echo "$strIn" | grep '|_' >/dev/null ; then
# Use Python-based formatting instead of original string cutting
print_colored_smart_attribute "$strIn"
fi
done
}
short_attibutes(){
if [[ "$strIn" ]]; then
var1=$(echo "$strIn" | awk '{printf "%-28s", $2}')
var2=$(echo "$strIn" | awk '{printf $10}' | awk -F"+" '{print $1}' | cut -d"h" -f1)
if [[ ${var2:0:1} -gt "0" && $2 == "zero" ]]; then
echo -e "$1 ${Yellow}$var1${Off} ${LiteRed}$var2${Off}"
if [[ $var2 -gt "0" ]]; then
warn=$((warn +1))
fi
elif [[ ${var2:0:1} -gt "0" && $2 == "none" ]]; then
echo -e "$1 $var1 $var2"
else
echo -e "$1 ${Yellow}$var1${Off} $var2"
fi
fi
}
show_health(){
# $drive is sata1 or sda or usb1 etc
local att194
# Decide device type (sat/scsi) via detect_dtype()
local drive_type
drive_type=$(detect_dtype)
# Show drive overall health
readarray -t health_array < <("$smartctl" -H -d "$drive_type" -T permissive /dev/"$drive" | tail -n +5)
for strIn in "${health_array[@]}"; do
if echo "$strIn" | awk '{print $1}' | grep -E '[0-9]' >/dev/null ||\
echo "$strIn" | awk '{print $1}' | grep 'ID#' >/dev/null ; then
# Remove columns 36 to 78
strOut="${strIn:0:36}${strIn:78}"
# Remove columns 65 to 74
strOut="${strOut:0:65}${strOut:74}"
# Remove columns after 77
strOut="${strOut:0:77}"
echo "$strOut"
else
if [[ -n "$strIn" ]]; then # Don't echo blank line
if $(echo "$strIn" | grep -qi PASSED); then
echo -e "SMART overall-health self-assessment test result: ${LiteGreen}PASSED${Off}"
elif $(echo "$strIn" | grep -qi 'Health Status: OK'); then
echo -e "SMART Health Status: ${LiteGreen}OK${Off}"
else
echo "$strIn"
fi
fi
fi
done
# Show error counter
#"$smartctl" -l error /dev/"$drive" | grep -iE 'error.*logg'
# Retrieve Error Log and show error count
errlog="$("$smartctl" -l error -d "$drive_type" /dev/"$drive" | grep -iE 'error.*logg')"
errcount="$(echo "$errlog" | awk '{print $3}')"
if [[ -z $errlog ]]; then
errlog="$("$smartctl" -l error -d "$drive_type" /dev/"$drive" | grep -iE 'error count')"
errcount="$(echo "$errlog" | awk '{print $4}')"
fi
#echo "$errlog"
if [[ -z $errcount ]]; then
"$smartctl" -l error -d "$drive_type" /dev/"$drive" | grep -iE 'not supported'
elif [[ $errcount -gt "0" ]]; then
#elif [[ $errcount -eq "0" ]]; then # debug
errtotal=$((errtotal +errcount))
echo -e "SMART Error Counter Log: ${LiteRed}$errcount${Off}"
else
echo -e "SMART Error Counter Log: ${LiteGreen}No Errors Logged${Off}"
fi
# Show SMART attributes
health=$("$smartctl" -H -d sat -T permissive /dev/"$drive" | tail -n +5)
if ! echo "$health" | grep PASSED >/dev/null || [[ $all == "yes" ]]; then
# Show all SMART attributes if health != passed, or -a/--all option used
smart_all
else
# Show only important SMART attributes
if [[ $seagate == "yes" ]] && [[ $smartversion == 7 ]]; then
readarray -t smart_atts < <("$smartctl" -A -d sat -v 1,raw48:54 -v 7,raw48:54 -v 195,raw48:54 /dev/"$drive")
else
readarray -t smart_atts < <("$smartctl" -A -d sat /dev/"$drive")
fi
# Decide if show airflow temperature
if echo "${smart_atts[*]}" | grep -c '194 Temp' >/dev/null; then
att194=yes
fi
for strIn in "${smart_atts[@]}"; do
if [[ ${strIn:0:3} == " 1" ]]; then
# 1 Raw read error rate
if [[ $seagate == "yes" ]]; then
if [[ $smartversion == 7 ]]; then
short_attibutes " 1" zero
else
short_attibutes " 1" none
fi
else
short_attibutes " 1"
fi
elif [[ ${strIn:0:3} == " 5" ]]; then
# 5 Reallocated sectors - scrutiny and BackBlaze
short_attibutes " 5" zero
elif [[ ${strIn:0:3} == " 7" ]]; then
# 7 Seek_Error_Rate
if [[ $seagate == "yes" ]]; then
if [[ $smartversion == 7 ]]; then
short_attibutes " 7" zero
else
short_attibutes " 7" none
fi
else
short_attibutes " 7"
fi
elif [[ ${strIn:0:3} == " 9" ]]; then
# 9 Power on hours
short_attibutes " 9" none
elif [[ ${strIn:0:3} == " 10" ]]; then
# 10 Spin_Retry_Count - scrutiny
short_attibutes " 10" none
elif [[ ${strIn:0:3} == "187" ]]; then
# 187 Current pending sectors - BackBlaze
short_attibutes "187" zero
elif [[ ${strIn:0:3} == "188" ]]; then
# 188 Current pending sectors - BackBlaze
short_attibutes "188" zero
elif [[ ${strIn:0:3} == "190" && -z $att194 ]]; then
# 190 Airflow_Temperature
short_attibutes "190" none
elif [[ ${strIn:0:3} == "194" ]]; then
# 194 Temperature - scrutiny
short_attibutes "194" none
elif [[ ${strIn:0:3} == "195" ]]; then
# 195 Hardware_ECC_Recovered aka ECC_On_the_Fly_Count
if [[ $seagate == "yes" ]]; then
if [[ $smartversion == 7 ]]; then
short_attibutes "195" zero
else
short_attibutes "195" none
fi
else
short_attibutes "195"
fi
elif [[ ${strIn:0:3} == "197" ]]; then
# 197 Current pending sectors - scrutiny and BackBlaze
short_attibutes "197" zero
elif [[ ${strIn:0:3} == "198" ]]; then
# 198 Offline uncorrectable - scrutiny and BackBlaze
short_attibutes "198" zero
elif [[ ${strIn:0:3} == "199" ]]; then
# 199 UDMA_CRC_Error_Count
short_attibutes "199" zero
elif [[ ${strIn:0:3} == "200" ]]; then
# 200 Multi_Zone_Error_Rate - WD
short_attibutes "200" zero
fi
done
fi
}
smart_nvme(){
# $1 is log type: error-log, smart-log, smart-log-add or self-test-log
# $drive is nvme0 etc
if [[ $1 == "error-log" ]]; then
# Retrieve Error Log and show error count
errlog="$(nvme error-log "/dev/$drive" | grep error_count | uniq)"
errcount="$(echo "$errlog" | awk '{print $3}')"
#echo "$errlog"
if [[ $errcount -gt "0" ]]; then
#if [[ $errcount -eq "0" ]]; then # debug
errtotal=$((errtotal +errcount))
echo -e "SMART Error Counter Log: ${LiteRed}$errcount${Off}"
else
echo -e "SMART Error Counter Log: ${LiteGreen}No Errors Logged${Off}"
fi
elif [[ $1 == "smart-log" ]]; then
# Retrieve SMART Log
echo ""
if [[ $smartversion -gt "6" ]]; then
# smartctl7 is installed
#readarray -t nvme_health_array < <(smartctl7 -A /dev/"$drive" | awk '/=== START OF SMART DATA SECTION ===/{flag=1;next}flag')
readarray -t nvme_health_array < <(smartctl7 -A /dev/"$drive" | awk '/Health Information/{flag=1;next}flag')
else
# smartctl is not v7 so we need to use nvme command
readarray -t nvme_health_array < <(nvme smart-log "/dev/$drive" | awk '/Smart Log for NVME/{flag=1;next}flag')
fi
for strIn in "${nvme_health_array[@]}"; do
if [[ $smartversion -gt "6" ]]; then
# smartctl7 is installed
if echo "$strIn" | grep 'Critical Warning:' >/dev/null; then
echo -e "${Yellow}$strIn${Off}"
elif echo "$strIn" | grep 'Temperature:' >/dev/null; then
echo -e "${Yellow}$strIn${Off}"
elif echo "$strIn" | grep 'Percentage Used:' >/dev/null; then
echo -e "${Yellow}$strIn${Off}"
elif echo "$strIn" | grep 'Power On Hours:' >/dev/null; then
echo -e "${Yellow}$strIn${Off}"
elif echo "$strIn" | grep 'Unsafe Shutdowns:' >/dev/null; then
echo -e "${Yellow}$strIn${Off}"
elif echo "$strIn" | grep 'Media and Data Integrity Errors:' >/dev/null; then
echo -e "${Yellow}$strIn${Off}"
else
echo "$strIn"
fi
else
# smartctl7 not installed
if echo "$strIn" | grep 'data_units_' >/dev/null; then
# Get data_units read or written
units="$(echo "$strIn" | awk '{print $3}')"
# Remove commas and convert to TB/GB/MB
units_show="$(echo "${units//,}" | numfmt --to=si --suffix=B)"
# Show data_units read or written
echo "$strIn ($units_show)"
elif echo "$strIn" | grep 'critical_warning' >/dev/null; then
echo -e "${Yellow}$strIn${Off}"
elif echo "$strIn" | grep 'temperature' >/dev/null; then
echo -e "${Yellow}$strIn${Off}"
elif echo "$strIn" | grep 'percentage_used' >/dev/null; then
echo -e "${Yellow}$strIn${Off}"
elif echo "$strIn" | grep 'power_on_hours' >/dev/null; then
echo -e "${Yellow}$strIn${Off}"
elif echo "$strIn" | grep 'unsafe_shutdowns' >/dev/null; then
echo -e "${Yellow}$strIn${Off}"
elif echo "$strIn" | grep 'media_errors' >/dev/null; then
echo -e "${Yellow}$strIn${Off}"
else
echo "$strIn"
fi
fi
done
if [[ $smartversion -lt "7" ]]; then
echo ""
fi
elif [[ $1 == "smart-log-add" ]]; then
# Retrieve additional SMART Log
nvme smart-log-add "/dev/$drive" # Does not work
elif [[ $1 == "self-test-log" ]]; then
# Retrieve the SELF-TEST Log
nvme self-test-log "/dev/$drive" # Not used
fi
}
short_attibutes_nvme(){
if [[ "$strIn" ]]; then
var1="$3"
var2=$(echo "$strIn" | cut -d":" -f2 | xargs)
if [[ ${var2:0:1} -gt "0" && $2 == "zero" ]]; then
echo -e "${Yellow}$var1${Off} ${LiteRed}$var2${Off}"
elif [[ ${var2:0:1} -gt "0" && $2 == "none" ]]; then
echo -e "$var1 $var2"
else
echo -e "${Yellow}$var1${Off} $var2"
fi
fi
}
show_health_nvme(){
# $drive is nvme0 etc
# Show only important SMART attributes
readarray -t smart_atts < <(nvme smart-log /dev/"$drive")
for strIn in "${smart_atts[@]}"; do
nvme_att="$(echo "$strIn" | cut -d":" -f1 | xargs)"
if [[ $nvme_att == "critical_warning" ]]; then
# 1 Critical_Warning
short_attibutes_nvme "critical_warning" zero " 1 Critical_Warning "
elif [[ $nvme_att == "temperature" ]]; then
# 2 Temperature - scrutiny
short_attibutes_nvme "temperature" none " 2 Temperature "
elif [[ $nvme_att == "percentage_used" ]]; then
# 5 Percentage Used
short_attibutes_nvme "percentage_used" none " 5 Percentage Used "
elif [[ $nvme_att == "power_on_hours" ]]; then
# 12 Power On Hours
short_attibutes_nvme "power_on_hours" none " 12 Power On Hours "
elif [[ $nvme_att == "unsafe_shutdowns" ]]; then
# 13 Unsafe Shutdowns
short_attibutes_nvme "unsafe_shutdowns" zero " 13 Unsafe Shutdowns "
elif [[ $nvme_att == "media_errors" ]]; then
# 14 Media Errors
short_attibutes_nvme "media_errors" zero " 14 Media Errors "
fi
done
}
not_flash_drive(){
# $1 is /sys/block/sata1 /sys/block/usb1 etc
# Check if drive is flash drive (not supported by smartctl)
removable=$(cat "${1}/removable")
capability=$(cat "${1}/capability")
if [[ $removable == "1" ]] && [[ $capability == "51" ]]; then
return 1
fi
}
is_usb(){
# $1 is /dev/sda or /sys/block/sda etc
if realpath /sys/block/"$(basename "$1")" | grep -q usb; then
return 0
else
return 1
fi
}
is_seagate(){
# Check if drive is Seagate or Seagate based Synology HAT3300
DEVICE=$("$smartctl" -A -i /dev/"$drive" | awk -F ' ' '/Device Model/{print $3}')
if [[ -z $DEVICE ]]; then
DEVICE=$("$smartctl" -A -i /dev/"$drive" | awk -F ' ' '/Product/{print $2}')
fi
if [[ "${DEVICE:0:2}" == "ST" ]] || [[ "${DEVICE:0:7}" == "HAT3300" ]]; then
return 0
else
return 1
fi
}
# Add drives to drives array
for d in /sys/block/*; do
# $d is /sys/block/sata1 etc
case "$(basename -- "${d}")" in
sd*|hd*)
if [[ $d =~ [hs]d[a-z][a-z]?$ ]]; then
if is_usb "$d"; then # Add USB drives except flash drives
if not_flash_drive "$d"; then
drives+=("$(basename -- "${d}")")
fi
else
drives+=("$(basename -- "${d}")") # Add all other drives
fi
fi
;;
sata*|sas*)
if [[ $d =~ (sas|sata)[0-9][0-9]?[0-9]?$ ]]; then
drives+=("$(basename -- "${d}")")
fi
;;
nvme*)
if [[ $d =~ nvme[0-9][0-9]?n[0-9][0-9]?$ ]]; then
nvmes+=("$(basename -- "${d}")")
fi
;;
nvc*) # M.2 SATA drives (in PCIe card only?)
if [[ $d =~ nvc[0-9][0-9]?$ ]]; then
drives+=("$(basename -- "${d}")")
fi
;;
usb*)
if [[ $d =~ usb[0-9]?[0-9]?$ ]]; then
if not_flash_drive "$d"; then
drives+=("$(basename -- "${d}")")
fi
fi
;;
esac
done
if [[ -z "$errtotal" ]]; then errtotal=0 ; fi
# HDD and SSD
for drive in "${drives[@]}"; do
# Show drive model and serial
get_drive_num
show_drive_model
# Check if a Seagate drive
if is_seagate "$drive"; then
seagate="yes"
else
seagate=
fi
# Show SATA/SAS drive SMART info
if [[ $dsm -gt "6" ]]; then
# DSM 7 or newer
# Show SMART test status if SMART test running
percentleft=$("$smartctl" -a -d sat -T permissive /dev/"$drive" | grep " Self-test routine in progress" | cut -d " " -f9-13)
if [[ $percentleft ]]; then
hourselapsed=$("$smartctl" -a -d sat -T permissive /dev/"$drive" | grep " Self-test routine in progress" | cut -d " " -f21)
echo "Drive $model $serial $percentleft remaining, $hourselapsed hours elapsed."
else
# Show drive health
show_health
fi
else
# DSM 6 or older
# Show SMART test status if SMART test running
percentdone=$("$smartctl" -a -d sat -T permissive /dev/"$drive" | grep "ScanStatus" | cut -d " " -f3-4)
if [[ $percentdone ]]; then
hourselapsed=$("$smartctl" -a -d sat -T permissive /dev/"$drive" | grep " Self-test routine in progress" | cut -d " " -f21)
echo "Drive $model $serial ${percentdone}% done."
else
# Show drive health
show_health
fi
fi
done
# NVMe drives
for drive in "${nvmes[@]}"; do
# Show drive model and serial
get_nvme_num
show_drive_model
# Show SMART overall health if smartctl7 is installed
if [[ $smartversion -gt "6" ]]; then
strIn=$("$smartctl" -H /dev/"$drive" | grep 'health')
if $(echo "$strIn" | grep -qi PASSED); then
echo -e "SMART overall-health self-assessment test result: ${LiteGreen}PASSED${Off}"
elif $(echo "$strIn" | grep -qi 'Health Status: OK'); then
echo -e "SMART Health Status: ${LiteGreen}OK${Off}"
else
echo "$strIn"
fi
fi
smart_nvme error-log
if [[ $errcount -gt "0" ]]; then
errtotal=$((errtotal +errcount))
fi
# Show SMART attributes
if [[ $errcount -gt "0" ]] || [[ $all == "yes" ]]; then
# Show all SMART attributes if health != passed, or -a/--all option used
smart_nvme smart-log
else
# Show only important SMART attributes
show_health_nvme
fi
done
echo -e "\nFinished\n"
if [[ $warn -gt "0" ]]; then
errtotal=$((errtotal +warn))
fi
exit "$errtotal"
|
train_000.parquet/992
|
{
"file_path": "syno_smart_info.sh",
"repo_id": "007revad/Synology_SMART_info",
"size": 33144,
"token_count": 12321
}
|
/**
* @file lv_templ.c
*
*/
/* TODO Remove these instructions
* Search an replace: template -> object normal name with lower case (e.g. button, label etc.)
* templ -> object short name with lower case(e.g. btn, label etc)
* TEMPL -> object short name with upper case (e.g. BTN, LABEL etc.)
*
* You can remove the defined() clause from the #if statement below. This exists because
* LV_USE_TEMPL is not in lv_conf.h or lv_conf_templ.h by default.
*/
/*********************
* INCLUDES
*********************/
#include "../lv_misc/lv_debug.h"
//#include "lv_templ.h" /*TODO uncomment this*/
#if defined(LV_USE_TEMPL) && LV_USE_TEMPL != 0
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_templ"
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_design_res_t lv_templ_design(lv_obj_t * templ, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_templ_signal(lv_obj_t * templ, lv_signal_t sign, void * param);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
static lv_design_cb_t ancestor_design;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a template object
* @param par pointer to an object, it will be the parent of the new template
* @param copy pointer to a template object, if not NULL then the new object will be copied from it
* @return pointer to the created template
*/
lv_obj_t * lv_templ_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("template create started");
/*Create the ancestor of template*/
/*TODO modify it to the ancestor create function */
lv_obj_t * new_templ = lv_ANCESTOR_create(par, copy);
LV_ASSERT_MEM(new_templ);
if(new_templ == NULL) return NULL;
/*Allocate the template type specific extended data*/
lv_templ_ext_t * ext = lv_obj_allocate_ext_attr(new_templ, sizeof(lv_templ_ext_t));
lv_mem_assert(ext);
if(ext == NULL) {
lv_obj_del(new_templ);
return NULL;
}
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_templ);
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(new_templ);
/*Initialize the allocated 'ext' */
ext->xyz = 0;
/*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(new_templ, lv_templ_signal);
lv_obj_set_design_cb(new_templ, lv_templ_design);
/*Init the new template template*/
if(copy == NULL) {
}
/*Copy an existing template*/
else {
lv_templ_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
/*Refresh the style with new signal function*/
lv_obj_refresh_style(new_templ);
}
LV_LOG_INFO("template created");
return new_templ;
}
/*======================
* Add/remove functions
*=====================*/
/*
* New object specific "add" or "remove" functions come here
*/
/*=====================
* Setter functions
*====================*/
/*
* New object specific "set" functions come here
*/
/**
* Set a style of a template.
* @param templ pointer to template object
* @param type which style should be set
* @param style pointer to a style
*/
void lv_templ_set_style(lv_obj_t * templ, lv_templ_style_t type, const lv_style_t * style)
{
LV_ASSERT_OBJ(templ, LV_OBJX_NAME);
lv_templ_ext_t * ext = lv_obj_get_ext_attr(templ);
switch(type) {
case LV_TEMPL_STYLE_X:
break;
case LV_TEMPL_STYLE_Y:
break;
}
}
/*=====================
* Getter functions
*====================*/
/*
* New object specific "get" functions come here
*/
/**
* Get style of a template.
* @param templ pointer to template object
* @param type which style should be get
* @return style pointer to the style
*/
lv_style_t * lv_templ_get_style(const lv_obj_t * templ, lv_templ_style_t type)
{
LV_ASSERT_OBJ(templ, LV_OBJX_NAME);
lv_templ_ext_t * ext = lv_obj_get_ext_attr(templ);
lv_style_t * style = NULL;
switch(type) {
case LV_TEMPL_STYLE_X:
style = NULL; /*Replace NULL with a pointer to the style*/
case LV_TEMPL_STYLE_Y:
style = NULL; /*Replace NULL with a pointer to the style*/
default:
style = NULL;
}
return style;
}
/*=====================
* Other functions
*====================*/
/*
* New object specific "other" functions come here
*/
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the templates
* @param templ pointer to an object
* @param mask the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_templ_design(lv_obj_t * templ, const lv_area_t * clip_area, lv_design_mode_t mode)
{
/*Return false if the object is not covers the mask_p area*/
if(mode == LV_DESIGN_COVER_CHK) {
return LV_DESIGN_RES_NOT_COVER;
}
/*Draw the object*/
else if(mode == LV_DESIGN_DRAW_MAIN) {
}
/*Post draw when the children are drawn*/
else if(mode == LV_DESIGN_DRAW_POST) {
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the template
* @param templ pointer to a template object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_templ_signal(lv_obj_t * templ, lv_signal_t sign, void * param)
{
lv_res_t res;
/* Include the ancient signal function */
res = ancestor_signal(templ, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
if(sign == LV_SIGNAL_CLEANUP) {
/*Nothing to cleanup. (No dynamically allocated memory in 'ext')*/
}
return res;
}
#else /* Enable this file at the top */
/* This dummy typedef exists purely to silence -Wpedantic. */
typedef int keep_pedantic_happy;
#endif
|
train_000.parquet/993
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_objx_templ.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 6604,
"token_count": 2305
}
|
# How to schedule a script in Synology Task Scheduler
To schedule a script to run on your Synology at boot-up or shut-down follow these steps:
**Note:** You can setup a schedule task and leave it disabled, so it only runs when you select the task in the Task Scheduler and click on the Run button.
1. Go to **Control Panel** > **Task Scheduler** > click **Create** > and select **Triggered Task**.
2. Select **User-defined script**.
3. Enter a task name.
4. Select **root** as the user (The script needs to run as root).
5. Select **Boot-up** as the event that triggers the task.
6. Leave **Enable** ticked.
7. Click **Task Settings**.
8. Optionally you can tick **Send run details by email** and **Send run details only when the script terminates abnormally** then enter your email address.
9. In the box under **User-defined script** type the path to the script.
- e.g. If you saved the script to a shared folder on volume1 called "scripts" you'd type:
- **/volume1/scripts/syno_smart_info_db.sh --email**
- For information on the options see [Options](README.md#options)
11. Click **OK** to save the settings.
Here's some screenshots showing what needs to be set:
<p align="leftr"><img src="images/schedule1.png"></p>
<p align="leftr"><img src="images/schedule2.png"></p>
<p align="leftr"><img src="images/schedule3.png"></p>
|
train_000.parquet/994
|
{
"file_path": "how_to_schedule.md",
"repo_id": "007revad/Synology_SMART_info",
"size": 1349,
"token_count": 425
}
|
/**
* @file lv_chart.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_chart.h"
#if LV_USE_CHART != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_refr.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_misc/lv_math.h"
#include "../lv_themes/lv_theme.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_chart"
#define LV_CHART_YMIN_DEF 0
#define LV_CHART_YMAX_DEF 100
#define LV_CHART_HDIV_DEF 3
#define LV_CHART_VDIV_DEF 5
#define LV_CHART_PNUM_DEF 10
#define LV_CHART_AXIS_MAJOR_TICK_LEN_COE 1 / 15
#define LV_CHART_AXIS_MINOR_TICK_LEN_COE 2 / 3
#define LV_CHART_LABEL_ITERATOR_FORWARD 1
#define LV_CHART_LABEL_ITERATOR_REVERSE 0
/**********************
* TYPEDEFS
**********************/
typedef struct {
const char * list_start;
const char * current_pos;
uint8_t items_left;
uint8_t is_reverse_iter;
} lv_chart_label_iterator_t;
/**********************
* STATIC PROTOTYPES
**********************/
static lv_design_res_t lv_chart_design(lv_obj_t * chart, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param);
static lv_style_list_t * lv_chart_get_style(lv_obj_t * chart, uint8_t part);
static void draw_series_bg(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * mask);
static void draw_series_line(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * clip_area);
static void draw_series_column(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * clip_area);
static void draw_axes(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * mask);
static void invalidate_lines(lv_obj_t * chart, uint16_t i);
static void invalidate_columns(lv_obj_t * chart, uint16_t i);
static void get_series_area(lv_obj_t * chart, lv_area_t * series_area);
static void get_next_axis_label(lv_chart_label_iterator_t * iterator, char * buf);
static inline bool is_tick_with_label(uint8_t tick_num, lv_chart_axis_cfg_t * axis);
static lv_chart_label_iterator_t create_axis_label_iter(const char * list, uint8_t iterator_dir);
/**********************
* STATIC VARIABLES
**********************/
static lv_design_cb_t ancestor_design;
static lv_signal_cb_t ancestor_signal;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a chart background objects
* @param par pointer to an object, it will be the parent of the new chart background
* @param copy pointer to a chart background object, if not NULL then the new object will be copied
* from it
* @return pointer to the created chart background
*/
lv_obj_t * lv_chart_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("chart create started");
/*Create the ancestor basic object*/
lv_obj_t * chart = lv_obj_create(par, copy);
LV_ASSERT_MEM(chart);
if(chart == NULL) return NULL;
/*Allocate the object type specific extended data*/
lv_chart_ext_t * ext = lv_obj_allocate_ext_attr(chart, sizeof(lv_chart_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(chart);
return NULL;
}
_lv_ll_init(&ext->series_ll, sizeof(lv_chart_series_t));
uint8_t i;
for(i = 0; i < _LV_CHART_AXIS_LAST; i++) {
ext->ymin[i] = LV_CHART_YMIN_DEF;
ext->ymax[i] = LV_CHART_YMAX_DEF;
}
ext->hdiv_cnt = LV_CHART_HDIV_DEF;
ext->vdiv_cnt = LV_CHART_VDIV_DEF;
ext->point_cnt = LV_CHART_PNUM_DEF;
ext->type = LV_CHART_TYPE_LINE;
ext->update_mode = LV_CHART_UPDATE_MODE_SHIFT;
_lv_memset_00(&ext->x_axis, sizeof(ext->x_axis));
_lv_memset_00(&ext->y_axis, sizeof(ext->y_axis));
_lv_memset_00(&ext->secondary_y_axis, sizeof(ext->secondary_y_axis));
ext->x_axis.major_tick_len = LV_CHART_TICK_LENGTH_AUTO;
ext->x_axis.minor_tick_len = LV_CHART_TICK_LENGTH_AUTO;
ext->y_axis.major_tick_len = LV_CHART_TICK_LENGTH_AUTO;
ext->y_axis.minor_tick_len = LV_CHART_TICK_LENGTH_AUTO;
ext->secondary_y_axis.major_tick_len = LV_CHART_TICK_LENGTH_AUTO;
ext->secondary_y_axis.minor_tick_len = LV_CHART_TICK_LENGTH_AUTO;
lv_style_list_init(&ext->style_series_bg);
lv_style_list_init(&ext->style_series);
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(chart);
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(chart);
lv_obj_set_signal_cb(chart, lv_chart_signal);
lv_obj_set_design_cb(chart, lv_chart_design);
/*Init the new chart background object*/
if(copy == NULL) {
lv_obj_set_size(chart, LV_DPI * 3, LV_DPI * 2);
lv_theme_apply(chart, LV_THEME_CHART);
}
else {
lv_chart_ext_t * ext_copy = lv_obj_get_ext_attr(copy);
lv_style_list_copy(&ext->style_series, &ext_copy->style_series);
lv_style_list_copy(&ext->style_series_bg, &ext_copy->style_series_bg);
ext->type = ext_copy->type;
ext->hdiv_cnt = ext_copy->hdiv_cnt;
ext->vdiv_cnt = ext_copy->vdiv_cnt;
ext->point_cnt = ext_copy->point_cnt;
_lv_memcpy_small(ext->ymin, ext_copy->ymin, sizeof(ext->ymin));
_lv_memcpy_small(ext->ymax, ext_copy->ymax, sizeof(ext->ymax));
_lv_memcpy(&ext->x_axis, &ext_copy->x_axis, sizeof(lv_chart_axis_cfg_t));
_lv_memcpy(&ext->y_axis, &ext_copy->y_axis, sizeof(lv_chart_axis_cfg_t));
_lv_memcpy(&ext->secondary_y_axis, &ext_copy->secondary_y_axis, sizeof(lv_chart_axis_cfg_t));
/*Refresh the style with new signal function*/
lv_obj_refresh_style(chart, LV_STYLE_PROP_ALL);
}
LV_LOG_INFO("chart created");
return chart;
}
/*======================
* Add/remove functions
*=====================*/
/**
* Allocate and add a data series to the chart
* @param chart pointer to a chart object
* @param color color of the data series
* @return pointer to the allocated data series
*/
lv_chart_series_t * lv_chart_add_series(lv_obj_t * chart, lv_color_t color)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
lv_chart_series_t * ser = _lv_ll_ins_head(&ext->series_ll);
LV_ASSERT_MEM(ser);
if(ser == NULL) return NULL;
lv_coord_t def = LV_CHART_POINT_DEF;
ser->color = color;
ser->points = lv_mem_alloc(sizeof(lv_coord_t) * ext->point_cnt);
LV_ASSERT_MEM(ser->points);
if(ser->points == NULL) {
_lv_ll_remove(&ext->series_ll, ser);
lv_mem_free(ser);
return NULL;
}
ser->start_point = 0;
ser->ext_buf_assigned = false;
ser->y_axis = LV_CHART_AXIS_PRIMARY_Y;
uint16_t i;
lv_coord_t * p_tmp = ser->points;
for(i = 0; i < ext->point_cnt; i++) {
*p_tmp = def;
p_tmp++;
}
return ser;
}
/**
* Clear the point of a series
* @param chart pointer to a chart object
* @param series pointer to the chart's series to clear
*/
void lv_chart_clear_series(lv_obj_t * chart, lv_chart_series_t * series)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
LV_ASSERT_NULL(series);
if(chart == NULL || series == NULL) return;
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext == NULL) return;
uint32_t i;
for(i = 0; i < ext->point_cnt; i++) {
series->points[i] = LV_CHART_POINT_DEF;
}
series->start_point = 0;
}
/*=====================
* Setter functions
*====================*/
/**
* Set the number of horizontal and vertical division lines
* @param chart pointer to a graph background object
* @param hdiv number of horizontal division lines
* @param vdiv number of vertical division lines
*/
void lv_chart_set_div_line_count(lv_obj_t * chart, uint8_t hdiv, uint8_t vdiv)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext->hdiv_cnt == hdiv && ext->vdiv_cnt == vdiv) return;
ext->hdiv_cnt = hdiv;
ext->vdiv_cnt = vdiv;
lv_obj_invalidate(chart);
}
/**
* Set the minimal and maximal y values on an axis
* @param chart pointer to a graph background object
* @param axis `LV_CHART_AXIS_PRIMARY_Y` or `LV_CHART_AXIS_SECONDARY_Y`
* @param ymin y minimum value
* @param ymax y maximum value
*/
void lv_chart_set_y_range(lv_obj_t * chart, lv_chart_axis_t axis, lv_coord_t ymin, lv_coord_t ymax)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
if(axis >= _LV_CHART_AXIS_LAST) {
LV_LOG_WARN("Invalid axis: %d", axis);
return;
}
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext->ymin[axis] == ymin && ext->ymax[axis] == ymax) return;
ext->ymin[axis] = ymin;
ext->ymax[axis] = ymax;
lv_chart_refresh(chart);
}
/**
* Set a new type for a chart
* @param chart pointer to a chart object
* @param type new type of the chart (from 'lv_chart_type_t' enum)
*/
void lv_chart_set_type(lv_obj_t * chart, lv_chart_type_t type)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext->type == type) return;
ext->type = type;
lv_chart_refresh(chart);
}
/**
* Set the number of points on a data line on a chart
* @param chart pointer r to chart object
* @param point_cnt new number of points on the data lines
*/
void lv_chart_set_point_count(lv_obj_t * chart, uint16_t point_cnt)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext->point_cnt == point_cnt) return;
lv_chart_series_t * ser;
uint16_t point_cnt_old = ext->point_cnt;
uint16_t i;
lv_coord_t def = LV_CHART_POINT_DEF;
if(point_cnt < 1) point_cnt = 1;
_LV_LL_READ_BACK(ext->series_ll, ser) {
if(!ser->ext_buf_assigned) {
if(ser->start_point != 0) {
lv_coord_t * new_points = lv_mem_alloc(sizeof(lv_coord_t) * point_cnt);
LV_ASSERT_MEM(new_points);
if(new_points == NULL) return;
if(point_cnt >= point_cnt_old) {
for(i = 0; i < point_cnt_old; i++) {
new_points[i] =
ser->points[(i + ser->start_point) % point_cnt_old]; /*Copy old contents to new array*/
}
for(i = point_cnt_old; i < point_cnt; i++) {
new_points[i] = def; /*Fill up the rest with default value*/
}
}
else {
for(i = 0; i < point_cnt; i++) {
new_points[i] =
ser->points[(i + ser->start_point) % point_cnt_old]; /*Copy old contents to new array*/
}
}
/*Switch over pointer from old to new*/
lv_mem_free(ser->points);
ser->points = new_points;
}
else {
ser->points = lv_mem_realloc(ser->points, sizeof(lv_coord_t) * point_cnt);
LV_ASSERT_MEM(ser->points);
if(ser->points == NULL) return;
/*Initialize the new points*/
if(point_cnt > point_cnt_old) {
for(i = point_cnt_old - 1; i < point_cnt; i++) {
ser->points[i] = def;
}
}
}
}
ser->start_point = 0;
}
ext->point_cnt = point_cnt;
lv_chart_refresh(chart);
}
/**
* Initialize all data points with a value
* @param chart pointer to chart object
* @param ser pointer to a data series on 'chart'
* @param y the new value for all points
*/
void lv_chart_init_points(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t y)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
LV_ASSERT_NULL(ser);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
uint16_t i;
for(i = 0; i < ext->point_cnt; i++) {
ser->points[i] = y;
}
ser->start_point = 0;
lv_chart_refresh(chart);
}
/**
* Set the value of points from an array
* @param chart pointer to chart object
* @param ser pointer to a data series on 'chart'
* @param y_array array of 'lv_coord_t' points (with 'points count' elements )
*/
void lv_chart_set_points(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t y_array[])
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
LV_ASSERT_NULL(ser);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
memcpy(ser->points, y_array, ext->point_cnt * (sizeof(lv_coord_t)));
ser->start_point = 0;
lv_chart_refresh(chart);
}
/**
* Shift all data left and set the rightmost data on a data line
* @param chart pointer to chart object
* @param ser pointer to a data series on 'chart'
* @param y the new value of the rightmost data
*/
void lv_chart_set_next(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t y)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
LV_ASSERT_NULL(ser);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext->update_mode == LV_CHART_UPDATE_MODE_SHIFT) {
ser->points[ser->start_point] =
y; /*This was the place of the former left most value, after shifting it is the rightmost*/
ser->start_point = (ser->start_point + 1) % ext->point_cnt;
lv_chart_refresh(chart);
}
else if(ext->update_mode == LV_CHART_UPDATE_MODE_CIRCULAR) {
ser->points[ser->start_point] = y;
if(ext->type & LV_CHART_TYPE_LINE) invalidate_lines(chart, ser->start_point);
if(ext->type & LV_CHART_TYPE_COLUMN) invalidate_columns(chart, ser->start_point);
ser->start_point = (ser->start_point + 1) % ext->point_cnt; /*update the x for next incoming y*/
}
}
/**
* Set update mode of the chart object.
* @param chart pointer to a chart object
* @param update mode
*/
void lv_chart_set_update_mode(lv_obj_t * chart, lv_chart_update_mode_t update_mode)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext->update_mode == update_mode) return;
ext->update_mode = update_mode;
lv_obj_invalidate(chart);
}
/**
* Set the length of the tick marks on the x axis
* @param chart pointer to the chart
* @param major_tick_len the length of the major tick or `LV_CHART_TICK_LENGTH_AUTO` to set automatically
* (where labels are added)
* @param minor_tick_len the length of the minor tick, `LV_CHART_TICK_LENGTH_AUTO` to set automatically
* (where no labels are added)
*/
void lv_chart_set_x_tick_length(lv_obj_t * chart, uint8_t major_tick_len, uint8_t minor_tick_len)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
ext->x_axis.major_tick_len = major_tick_len;
ext->x_axis.minor_tick_len = minor_tick_len;
}
/**
* Set the length of the tick marks on the y axis
* @param chart pointer to the chart
* @param major_tick_len the length of the major tick or `LV_CHART_TICK_LENGTH_AUTO` to set automatically
* (where labels are added)
* @param minor_tick_len the length of the minor tick, `LV_CHART_TICK_LENGTH_AUTO` to set automatically
* (where no labels are added)
*/
void lv_chart_set_y_tick_length(lv_obj_t * chart, uint8_t major_tick_len, uint8_t minor_tick_len)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
ext->y_axis.major_tick_len = major_tick_len;
ext->y_axis.minor_tick_len = minor_tick_len;
}
/**
* Set the length of the tick marks on the secondary y axis
* @param chart pointer to the chart
* @param major_tick_len the length of the major tick or `LV_CHART_TICK_LENGTH_AUTO` to set automatically
* (where labels are added)
* @param minor_tick_len the length of the minor tick, `LV_CHART_TICK_LENGTH_AUTO` to set automatically
* (where no labels are added)
*/
void lv_chart_set_secondary_y_tick_length(lv_obj_t * chart, uint8_t major_tick_len, uint8_t minor_tick_len)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
ext->secondary_y_axis.major_tick_len = major_tick_len;
ext->secondary_y_axis.minor_tick_len = minor_tick_len;
}
/**
* Set the x-axis tick count and labels of a chart
* @param chart pointer to a chart object
* @param list_of_values list of string values, terminated with \n, except the last
* @param num_tick_marks if list_of_values is NULL: total number of ticks per axis
* else number of ticks between two value labels
* @param options extra options
*/
void lv_chart_set_x_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks,
lv_chart_axis_options_t options)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
LV_ASSERT_NULL(list_of_values);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
ext->x_axis.num_tick_marks = num_tick_marks;
ext->x_axis.list_of_values = list_of_values;
ext->x_axis.options = options;
}
/**
* Set the y-axis tick count and labels of a chart
* @param chart pointer to a chart object
* @param list_of_values list of string values, terminated with \n, except the last
* @param num_tick_marks if list_of_values is NULL: total number of ticks per axis
* else number of ticks between two value labels
* @param options extra options
*/
void lv_chart_set_y_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks,
lv_chart_axis_options_t options)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
LV_ASSERT_NULL(list_of_values);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
ext->y_axis.num_tick_marks = num_tick_marks;
ext->y_axis.list_of_values = list_of_values;
ext->y_axis.options = options;
}
/**
* Set the secondary y-axis tick count and labels of a chart
* @param chart pointer to a chart object
* @param list_of_values list of string values, terminated with \n, except the last
* @param num_tick_marks if list_of_values is NULL: total number of ticks per axis
* else number of ticks between two value labels
* @param options extra options
*/
void lv_chart_set_secondary_y_tick_texts(lv_obj_t * chart, const char * list_of_values, uint8_t num_tick_marks,
lv_chart_axis_options_t options)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
LV_ASSERT_NULL(list_of_values);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
ext->secondary_y_axis.num_tick_marks = num_tick_marks;
ext->secondary_y_axis.list_of_values = list_of_values;
ext->secondary_y_axis.options = options;
}
/**
* Set the index of the x-axis start point in the data array
* @param chart pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @param id the index of the x point in the data array
*/
void lv_chart_set_x_start_point(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
LV_ASSERT_NULL(ser);
if(chart == NULL || ser == NULL) return;
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext == NULL) return;
if(id >= ext->point_cnt) return;
ser->start_point = id;
}
/**
* Set an external array of data points to use for the chart
* NOTE: It is the users responsibility to make sure the point_cnt matches the external array size.
* @param chart pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @param array external array of points for chart
* @param point_cnt number of external points in the array
*/
void lv_chart_set_ext_array(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t array[], uint16_t point_cnt)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
LV_ASSERT_NULL(ser);
if(chart == NULL || ser == NULL) return;
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(!ser->ext_buf_assigned && ser->points) lv_mem_free(ser->points);
ser->ext_buf_assigned = true;
ser->points = array;
ext->point_cnt = point_cnt;
}
/**
* Set an individual point y value in the chart series directly based on index
* @param chart pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @param value value to assign to array point
* @param id the index of the x point in the array
*/
void lv_chart_set_point_id(lv_obj_t * chart, lv_chart_series_t * ser, lv_coord_t value, uint16_t id)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
LV_ASSERT_NULL(ser);
if(chart == NULL || ser == NULL) return;
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext == NULL) return;
if(id >= ext->point_cnt) return;
ser->points[id] = value;
}
/**
* Set the Y axis of a series
* @param chart pointer to a chart object
* @param ser pointer to series
* @param axis `LV_CHART_AXIS_PRIMARY_Y` or `LV_CHART_AXIS_SECONDARY_Y`
*/
void lv_chart_set_series_axis(lv_obj_t * chart, lv_chart_series_t * ser, lv_chart_axis_t axis)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
LV_ASSERT_NULL(ser);
if(axis >= _LV_CHART_AXIS_LAST) {
LV_LOG_WARN("Invalid axis: %d", axis);
return;
}
if(ser->y_axis == axis) return;
ser->y_axis = axis;
lv_chart_refresh(chart);
}
/*=====================
* Getter functions
*====================*/
/**
* Get the type of a chart
* @param chart pointer to chart object
* @return type of the chart (from 'lv_chart_t' enum)
*/
lv_chart_type_t lv_chart_get_type(const lv_obj_t * chart)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
return ext->type;
}
/**
* Get the data point number per data line on chart
* @param chart pointer to chart object
* @return point number on each data line
*/
uint16_t lv_chart_get_point_count(const lv_obj_t * chart)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
return ext->point_cnt;
}
/**
* Get the current index of the x-axis start point in the data array
* @param ser pointer to a data series on 'chart'
* @return the index of the current x start point in the data array
*/
uint16_t lv_chart_get_x_start_point(lv_chart_series_t * ser)
{
LV_ASSERT_NULL(ser);
return(ser->start_point);
}
/**
* Get an individual point y value in the chart series directly based on index
* @param chart pointer to a chart object
* @param ser pointer to a data series on 'chart'
* @param id the index of the x point in the array
* @return value of array point at index id
*/
lv_coord_t lv_chart_get_point_id(lv_obj_t * chart, lv_chart_series_t * ser, uint16_t id)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
LV_ASSERT_NULL(ser);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(id >= ext->point_cnt) id = 0;
return(ser->points[id]);
}
/**
* Get the Y axis of a series
* @param chart pointer to a chart object
* @param ser pointer to series
* @return `LV_CHART_AXIS_PRIMARY_Y` or `LV_CHART_AXIS_SECONDARY_Y`
*/
lv_chart_axis_t lv_chart_get_series_axis(lv_obj_t * chart, lv_chart_series_t * ser)
{
LV_ASSERT_NULL(ser);
LV_UNUSED(chart);
return ser->y_axis;
}
/*=====================
* Other functions
*====================*/
/**
* Refresh a chart if its data line has changed
* @param chart pointer to chart object
*/
void lv_chart_refresh(lv_obj_t * chart)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
lv_obj_invalidate(chart);
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the chart backgrounds
* @param chart pointer to an object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_chart_design(lv_obj_t * chart, const lv_area_t * clip_area, lv_design_mode_t mode)
{
if(mode == LV_DESIGN_COVER_CHK) {
return ancestor_design(chart, clip_area, mode);
}
else if(mode == LV_DESIGN_DRAW_MAIN) {
/*Draw the background*/
lv_draw_rect_dsc_t bg_dsc;
lv_draw_rect_dsc_init(&bg_dsc);
lv_obj_init_draw_rect_dsc(chart, LV_CHART_PART_BG, &bg_dsc);
lv_draw_rect(&chart->coords, clip_area, &bg_dsc);
lv_area_t series_area;
get_series_area(chart, &series_area);
draw_series_bg(chart, &series_area, clip_area);
draw_axes(chart, &series_area, clip_area);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext->type & LV_CHART_TYPE_LINE) draw_series_line(chart, &series_area, clip_area);
if(ext->type & LV_CHART_TYPE_COLUMN) draw_series_column(chart, &series_area, clip_area);
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the chart background
* @param chart pointer to a chart background object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
*/
static lv_res_t lv_chart_signal(lv_obj_t * chart, lv_signal_t sign, void * param)
{
/* Include the ancient signal function */
lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_chart_get_style(chart, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(chart, sign, param);
}
res = ancestor_signal(chart, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(sign == LV_SIGNAL_CLEANUP) {
lv_chart_series_t * ser;
while(ext->series_ll.head != NULL) {
ser = _lv_ll_get_head(&ext->series_ll);
if(!ser->ext_buf_assigned) lv_mem_free(ser->points);
_lv_ll_remove(&ext->series_ll, ser);
lv_mem_free(ser);
}
_lv_ll_clear(&ext->series_ll);
lv_obj_clean_style_list(chart, LV_CHART_PART_SERIES);
lv_obj_clean_style_list(chart, LV_CHART_PART_SERIES_BG);
}
return res;
}
/**
* Get the style descriptor of a part of the object
* @param chart pointer the object
* @param part the part of the chart. (LV_CHART_PART_...)
* @return pointer to the style descriptor of the specified part
*/
static lv_style_list_t * lv_chart_get_style(lv_obj_t * chart, uint8_t part)
{
LV_ASSERT_OBJ(chart, LV_OBJX_NAME);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
lv_style_list_t * style_dsc_p;
switch(part) {
case LV_CHART_PART_BG:
style_dsc_p = &chart->style_list;
break;
case LV_CHART_PART_SERIES_BG:
style_dsc_p = &ext->style_series_bg;
break;
case LV_CHART_PART_SERIES:
style_dsc_p = &ext->style_series;
break;
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
/**
* Draw the division lines on chart background
* @param chart pointer to chart object
* @param clip_area mask, inherited from the design function
*/
static void draw_series_bg(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * clip_area)
{
/*Draw the background of the series*/
lv_draw_rect_dsc_t bg_dsc;
lv_draw_rect_dsc_init(&bg_dsc);
lv_obj_init_draw_rect_dsc(chart, LV_CHART_PART_SERIES_BG, &bg_dsc);
lv_draw_rect(series_area, clip_area, &bg_dsc);
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
uint8_t div_i;
uint8_t div_i_end;
uint8_t div_i_start;
lv_point_t p1;
lv_point_t p2;
lv_coord_t w = lv_area_get_width(series_area);
lv_coord_t h = lv_area_get_height(series_area);
lv_coord_t x_ofs = series_area->x1;
lv_coord_t y_ofs = series_area->y1;
lv_draw_line_dsc_t line_dsc;
lv_draw_line_dsc_init(&line_dsc);
lv_obj_init_draw_line_dsc(chart, LV_CHART_PART_SERIES_BG, &line_dsc);
if(ext->hdiv_cnt != 0) {
/*Draw side lines if no border*/
if(bg_dsc.border_width != 0) {
div_i_start = 1;
div_i_end = ext->hdiv_cnt;
}
else {
div_i_start = 0;
div_i_end = ext->hdiv_cnt + 1;
}
p1.x = 0 + x_ofs;
p2.x = w - 1 + x_ofs;
for(div_i = div_i_start; div_i <= div_i_end; div_i++) {
p1.y = (int32_t)((int32_t)(h - line_dsc.width) * div_i) / (ext->hdiv_cnt + 1);
p1.y += y_ofs;
p2.y = p1.y;
lv_draw_line(&p1, &p2, clip_area, &line_dsc);
}
}
if(ext->vdiv_cnt != 0) {
/*Draw side lines if no border*/
if(bg_dsc.border_width != 0) {
div_i_start = 1;
div_i_end = ext->vdiv_cnt;
}
else {
div_i_start = 0;
div_i_end = ext->vdiv_cnt + 1;
}
p1.y = 0 + y_ofs;
p2.y = h + y_ofs - 1;
for(div_i = div_i_start; div_i <= div_i_end; div_i++) {
p1.x = (int32_t)((int32_t)(w - line_dsc.width) * div_i) / (ext->vdiv_cnt + 1);
p1.x += x_ofs;
p2.x = p1.x;
lv_draw_line(&p1, &p2, clip_area, &line_dsc);
}
}
}
/**
* Draw the data lines as lines on a chart
* @param obj pointer to chart object
*/
static void draw_series_line(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * clip_area)
{
lv_area_t com_area;
if(_lv_area_intersect(&com_area, series_area, clip_area) == false) return;
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
uint16_t i;
lv_point_t p1;
lv_point_t p2;
lv_coord_t w = lv_area_get_width(series_area);
lv_coord_t h = lv_area_get_height(series_area);
lv_coord_t x_ofs = series_area->x1;
lv_coord_t y_ofs = series_area->y1;
lv_chart_series_t * ser;
lv_area_t series_mask;
bool mask_ret = _lv_area_intersect(&series_mask, series_area, clip_area);
if(mask_ret == false) return;
lv_draw_line_dsc_t line_dsc;
lv_draw_line_dsc_init(&line_dsc);
lv_obj_init_draw_line_dsc(chart, LV_CHART_PART_SERIES, &line_dsc);
lv_draw_mask_fade_param_t mask_fade_p;
int16_t mask_fade_id = LV_MASK_ID_INV;
lv_draw_rect_dsc_t area_dsc;
bool has_area = lv_obj_get_style_bg_opa(chart, LV_CHART_PART_SERIES) > LV_OPA_MIN ? true : false;
bool has_fade = false;
if(has_area) {
lv_draw_rect_dsc_init(&area_dsc);
lv_obj_init_draw_rect_dsc(chart, LV_CHART_PART_SERIES, &area_dsc);
area_dsc.border_width = 0;
has_fade = area_dsc.bg_grad_dir == LV_GRAD_DIR_VER ? true : false;
if(has_fade) {
lv_draw_mask_fade_init(&mask_fade_p, series_area, area_dsc.bg_main_color_stop, series_area->y1,
area_dsc.bg_grad_color_stop, series_area->y2);
}
}
lv_draw_rect_dsc_t point_dsc;
lv_draw_rect_dsc_init(&point_dsc);
point_dsc.bg_opa = line_dsc.opa;
point_dsc.radius = LV_RADIUS_CIRCLE;
lv_coord_t point_radius = lv_obj_get_style_size(chart, LV_CHART_PART_SERIES);
/*Do not bother with line ending is the point will over it*/
if(point_radius > line_dsc.width / 2) line_dsc.raw_end = 1;
/*Go through all data lines*/
_LV_LL_READ_BACK(ext->series_ll, ser) {
line_dsc.color = ser->color;
point_dsc.bg_color = ser->color;
area_dsc.bg_color = ser->color;
area_dsc.bg_grad_color = ser->color;
lv_coord_t start_point = ext->update_mode == LV_CHART_UPDATE_MODE_SHIFT ? ser->start_point : 0;
p1.x = 0 + x_ofs;
p2.x = 0 + x_ofs;
lv_coord_t p_act = start_point;
lv_coord_t p_prev = start_point;
int32_t y_tmp = (int32_t)((int32_t)ser->points[p_prev] - ext->ymin[ser->y_axis]) * h;
y_tmp = y_tmp / (ext->ymax[ser->y_axis] - ext->ymin[ser->y_axis]);
p2.y = h - y_tmp + y_ofs;
for(i = 0; i < ext->point_cnt; i++) {
p1.x = p2.x;
p1.y = p2.y;
p2.x = ((w * i) / (ext->point_cnt - 1)) + x_ofs;
p_act = (start_point + i) % ext->point_cnt;
y_tmp = (int32_t)((int32_t)ser->points[p_act] - ext->ymin[ser->y_axis]) * h;
y_tmp = y_tmp / (ext->ymax[ser->y_axis] - ext->ymin[ser->y_axis]);
p2.y = h - y_tmp + y_ofs;
/*Don't draw the first point. A second point is also required to draw the line*/
if(i != 0 && ser->points[p_prev] != LV_CHART_POINT_DEF && ser->points[p_act] != LV_CHART_POINT_DEF) {
lv_draw_line(&p1, &p2, &series_mask, &line_dsc);
lv_coord_t y_top = LV_MATH_MIN(p1.y, p2.y);
if(has_area && y_top <= clip_area->y2) {
int16_t mask_line_id;
lv_draw_mask_line_param_t mask_line_p;
lv_draw_mask_line_points_init(&mask_line_p, p1.x, p1.y, p2.x, p2.y, LV_DRAW_MASK_LINE_SIDE_BOTTOM);
mask_line_id = lv_draw_mask_add(&mask_line_p, NULL);
lv_area_t a;
a.x1 = p1.x;
a.x2 = p2.x - 1;
a.y1 = y_top;
a.y2 = series_area->y2;
if(has_fade) mask_fade_id = lv_draw_mask_add(&mask_fade_p, NULL);
lv_draw_rect(&a, &series_mask, &area_dsc);
lv_draw_mask_remove_id(mask_line_id);
lv_draw_mask_remove_id(mask_fade_id);
}
}
if(point_radius) {
lv_area_t point_area;
point_area.x1 = p1.x;
point_area.x2 = point_area.x1 + point_radius;
point_area.x1 -= point_radius;
point_area.y1 = p1.y;
point_area.y2 = point_area.y1 + point_radius;
point_area.y1 -= point_radius;
if(ser->points[p_act] != LV_CHART_POINT_DEF) {
/*Don't limit to `series_mask` to get full circles on the ends*/
lv_draw_rect(&point_area, clip_area, &point_dsc);
}
}
p_prev = p_act;
}
/*Draw the last point*/
if(point_radius) {
lv_area_t point_area;
point_area.x1 = p2.x;
point_area.x2 = point_area.x1 + point_radius;
point_area.x1 -= point_radius;
point_area.y1 = p2.y;
point_area.y2 = point_area.y1 + point_radius;
point_area.y1 -= point_radius;
if(ser->points[p_act] != LV_CHART_POINT_DEF) {
/*Don't limit to `series_mask` to get full circles on the ends*/
lv_draw_rect(&point_area, clip_area, &point_dsc);
}
}
}
}
/**
* Draw the data lines as columns on a chart
* @param chart pointer to chart object
* @param mask mask, inherited from the design function
*/
static void draw_series_column(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * clip_area)
{
lv_area_t com_area;
if(_lv_area_intersect(&com_area, series_area, clip_area) == false) return;
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
uint16_t i;
lv_area_t col_a;
lv_coord_t w = lv_area_get_width(series_area);
lv_coord_t h = lv_area_get_height(series_area);
int32_t y_tmp;
lv_chart_series_t * ser;
lv_coord_t col_w = w / ((_lv_ll_get_len(&ext->series_ll) + 1) * ext->point_cnt); /* Suppose + 1 series as separator*/
lv_coord_t x_ofs = col_w / 2; /*Shift with a half col.*/
lv_style_int_t col_space = lv_obj_get_style_pad_inner(chart, LV_CHART_PART_SERIES);
lv_draw_rect_dsc_t col_dsc;
lv_draw_rect_dsc_init(&col_dsc);
lv_obj_init_draw_rect_dsc(chart, LV_CHART_PART_SERIES, &col_dsc);
col_dsc.bg_grad_dir = LV_GRAD_DIR_NONE;
col_dsc.bg_opa = LV_OPA_COVER;
/*Make the cols longer with `radius` to clip the rounding from the bottom*/
col_a.y2 = series_area->y2 + col_dsc.radius;
lv_area_t series_mask;
bool mask_ret = _lv_area_intersect(&series_mask, series_area, clip_area);
if(mask_ret == false) return;
/*Go through all points*/
for(i = 0; i < ext->point_cnt; i++) {
lv_coord_t x_act = (int32_t)((int32_t)w * i) / ext->point_cnt;
x_act += series_area->x1 + x_ofs;
/*Draw the current point of all data line*/
_LV_LL_READ_BACK(ext->series_ll, ser) {
lv_coord_t start_point = ext->update_mode == LV_CHART_UPDATE_MODE_SHIFT ? ser->start_point : 0;
col_a.x1 = x_act;
col_a.x2 = col_a.x1 + col_w - col_space;
x_act += col_w;
if(col_a.x2 < series_mask.x1) continue;
if(col_a.x1 > series_mask.x2) break;
col_dsc.bg_color = ser->color;
lv_coord_t p_act = (start_point + i) % ext->point_cnt;
y_tmp = (int32_t)((int32_t)ser->points[p_act] - ext->ymin[ser->y_axis]) * h;
y_tmp = y_tmp / (ext->ymax[ser->y_axis] - ext->ymin[ser->y_axis]);
col_a.y1 = h - y_tmp + series_area->y1;
if(ser->points[p_act] != LV_CHART_POINT_DEF) {
lv_draw_rect(&col_a, &series_mask, &col_dsc);
}
}
}
}
/**
* Create iterator for newline-separated list
* @param list pointer to newline-separated labels list
* @param iterator_dir LV_CHART_ITERATOR_FORWARD or LV_CHART_LABEL_ITERATOR_REVERSE
* @return lv_chart_label_iterator_t
*/
static lv_chart_label_iterator_t create_axis_label_iter(const char * list, uint8_t iterator_dir)
{
lv_chart_label_iterator_t iterator = {0};
uint8_t j;
iterator.list_start = list;
/* count number of list items */
for(j = 0; list[j] != '\0'; j++) {
if(list[j] == '\n')
iterator.items_left++;
}
if(iterator_dir == LV_CHART_LABEL_ITERATOR_FORWARD) {
iterator.is_reverse_iter = 0;
iterator.current_pos = list;
}
else {
iterator.is_reverse_iter = 1;
// -1 to skip '\0' at the end of the string
iterator.current_pos = list + j - 1;
}
iterator.items_left++;
return iterator;
}
/**
* Get next label from iterator created by lv_chart_create_label_iter()
* @param iterator iterator to get label from
* @param[out] buf buffer to point next label to
*/
static void get_next_axis_label(lv_chart_label_iterator_t * iterator, char * buf)
{
uint32_t label_len = 0;
if(iterator->is_reverse_iter) {
const char * label_start;
/* count the length of the current label*/
while((*iterator->current_pos != '\n') &&
(iterator->current_pos != iterator->list_start)) {
iterator->current_pos--;
label_len++;
}
label_start = iterator->current_pos;
if(*iterator->current_pos == '\n') {
/* do not copy \n symbol, +1 to skip it*/
label_start++;
/* skip newline*/
iterator->current_pos--;
}
else {
/* it is last label in list (first one from the beginning )*/
label_len++;
}
/* do not allow output buffer overflow */
if(label_len > LV_CHART_AXIS_TICK_LABEL_MAX_LEN) {
label_len = LV_CHART_AXIS_TICK_LABEL_MAX_LEN;
}
strncpy(buf, label_start, label_len);
}
else {
/* search for tick string */
while(iterator->current_pos[label_len] != '\n' &&
iterator->current_pos[label_len] != '\0') {
/* do not overflow the buffer, but move to the end of the current label */
if(label_len < LV_CHART_AXIS_TICK_LABEL_MAX_LEN) {
buf[label_len] = iterator->current_pos[label_len];
label_len++;
}
else {
label_len++;
}
}
iterator->current_pos += label_len;
/* do not allow output buffer overflow */
if(label_len > LV_CHART_AXIS_TICK_LABEL_MAX_LEN) {
label_len = LV_CHART_AXIS_TICK_LABEL_MAX_LEN;
}
if(*iterator->current_pos == '\n') iterator->current_pos++;
}
/* terminate the string */
buf[label_len] = '\0';
}
/**
* Check whether there should be a label next to tick with given
* number
* @param tick_num number of the tick to check
* @param axis pointer to struct containing info on the axis
* @return true if label should be located next to current tick
*/
static inline bool is_tick_with_label(uint8_t tick_num, lv_chart_axis_cfg_t * axis)
{
return ((tick_num == 0) || ((tick_num % axis->num_tick_marks) == 0));
}
static void draw_y_ticks(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * mask, uint8_t which_axis)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
lv_chart_axis_cfg_t * y_axis = (which_axis == LV_CHART_AXIS_PRIMARY_Y) ?
&ext->y_axis : &ext->secondary_y_axis;
if(y_axis->list_of_values == NULL && y_axis->num_tick_marks == 0) return;
uint8_t i;
uint8_t num_of_labels;
uint8_t num_scale_ticks;
int8_t major_tick_len, minor_tick_len;
uint8_t iter_dir;
lv_point_t p1;
lv_point_t p2;
lv_coord_t x_ofs;
lv_chart_label_iterator_t iter;
lv_coord_t y_ofs = series_area->y1;
lv_coord_t h = lv_area_get_height(series_area);
lv_coord_t w = lv_area_get_width(series_area);
char buf[LV_CHART_AXIS_TICK_LABEL_MAX_LEN + 1]; /* up to N symbols per label + null terminator */
/* chose correct side of the chart */
if(which_axis == LV_CHART_AXIS_PRIMARY_Y)
x_ofs = series_area->x1;
else
x_ofs = series_area->x2;
/* calculate the size of tick marks */
if(y_axis->major_tick_len == LV_CHART_TICK_LENGTH_AUTO)
major_tick_len = (int32_t)w * LV_CHART_AXIS_MAJOR_TICK_LEN_COE;
else
major_tick_len = y_axis->major_tick_len;
if(y_axis->minor_tick_len == LV_CHART_TICK_LENGTH_AUTO)
minor_tick_len = major_tick_len * LV_CHART_AXIS_MINOR_TICK_LEN_COE;
else
minor_tick_len = y_axis->minor_tick_len;
/* tick lines on secondary y axis are drawn in other direction*/
if(which_axis == LV_CHART_AXIS_SECONDARY_Y) {
major_tick_len *= -1;
minor_tick_len *= -1;
}
iter_dir = (y_axis->options & LV_CHART_AXIS_INVERSE_LABELS_ORDER) ? LV_CHART_LABEL_ITERATOR_REVERSE :
LV_CHART_LABEL_ITERATOR_FORWARD;
iter = create_axis_label_iter(y_axis->list_of_values, iter_dir);
/*determine the number of options */
num_of_labels = iter.items_left;
/* we can't have string labels without ticks step, set to 1 if not specified */
if(y_axis->num_tick_marks == 0) y_axis->num_tick_marks = 1;
/* calculate total number of ticks */
if(num_of_labels < 2)
num_scale_ticks = y_axis->num_tick_marks;
else
num_scale_ticks = (y_axis->num_tick_marks * (num_of_labels - 1));
lv_style_int_t label_dist = which_axis == LV_CHART_AXIS_PRIMARY_Y ?
lv_obj_get_style_pad_left(chart, LV_CHART_PART_SERIES_BG) : lv_obj_get_style_pad_right(chart, LV_CHART_PART_SERIES_BG);
lv_draw_line_dsc_t line_dsc;
lv_draw_line_dsc_init(&line_dsc);
lv_obj_init_draw_line_dsc(chart, LV_CHART_PART_BG, &line_dsc);
lv_draw_label_dsc_t label_dsc;
lv_draw_label_dsc_init(&label_dsc);
lv_obj_init_draw_label_dsc(chart, LV_CHART_PART_BG, &label_dsc);
for(i = 0; i < (num_scale_ticks + 1); i++) { /* one extra loop - it may not exist in the list, empty label */
/* draw a line at moving y position */
p2.y = p1.y =
y_ofs + (int32_t)((int32_t)(h - line_dsc.width) * i) / num_scale_ticks;
if(p2.y - label_dsc.font->line_height > mask->y2) return;
if(p2.y + label_dsc.font->line_height < mask->y1) {
if(is_tick_with_label(i, y_axis)) {
get_next_axis_label(&iter, buf);
}
continue;
}
/* first point of the tick */
p1.x = x_ofs;
/* move extra pixel out of chart boundary */
if(which_axis == LV_CHART_AXIS_PRIMARY_Y)
p1.x--;
else
p1.x++;
/* second point of the tick */
if((num_of_labels != 0) && (i == 0 || i % y_axis->num_tick_marks == 0))
p2.x = p1.x - major_tick_len; /* major tick */
else
p2.x = p1.x - minor_tick_len; /* minor tick */
if(y_axis->options & LV_CHART_AXIS_INVERSE_LABELS_ORDER) {
/*if label order is inversed last tick have number 0*/
if(i != 0)
lv_draw_line(&p1, &p2, mask, &line_dsc);
else if((y_axis->options & LV_CHART_AXIS_DRAW_LAST_TICK) != 0)
lv_draw_line(&p1, &p2, mask, &line_dsc);
}
else {
if(i != num_scale_ticks)
lv_draw_line(&p1, &p2, mask, &line_dsc);
else if((y_axis->options & LV_CHART_AXIS_DRAW_LAST_TICK) != 0)
lv_draw_line(&p1, &p2, mask, &line_dsc);
}
/* draw values if available */
if(num_of_labels != 0) {
/* add text only to major tick */
if(is_tick_with_label(i, y_axis)) {
get_next_axis_label(&iter, buf);
/* reserve appropriate area */
lv_point_t size;
_lv_txt_get_size(&size, buf, label_dsc.font, label_dsc.letter_space, label_dsc.line_space,
LV_COORD_MAX, LV_TXT_FLAG_CENTER);
/* set the area at some distance of the major tick len left of the tick */
lv_area_t a = {.y1 = p2.y - size.y / 2, .y2 = p2.y + size.y / 2};
if(which_axis == LV_CHART_AXIS_PRIMARY_Y) {
a.x1 = p2.x - size.x - label_dist;
a.x2 = p2.x - label_dist;
}
else {
a.x1 = p2.x + label_dist;
a.x2 = p2.x + size.x + label_dist;
}
lv_draw_label(&a, mask, &label_dsc, buf, NULL);
}
}
}
}
static void draw_x_ticks(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * mask)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(ext->x_axis.list_of_values == NULL && ext->x_axis.num_tick_marks == 0) return;
uint8_t i;
uint8_t num_of_labels;
uint8_t num_scale_ticks;
uint8_t major_tick_len, minor_tick_len;
lv_chart_label_iterator_t iter;
lv_point_t p1;
lv_point_t p2;
lv_coord_t x_ofs = series_area->x1;
lv_coord_t y_ofs = series_area->y1;
lv_coord_t h = lv_area_get_height(series_area);
lv_coord_t w = lv_area_get_width(series_area);
lv_style_int_t label_dist = lv_obj_get_style_pad_bottom(chart, LV_CHART_PART_SERIES_BG);
lv_draw_label_dsc_t label_dsc;
lv_draw_label_dsc_init(&label_dsc);
lv_obj_init_draw_label_dsc(chart, LV_CHART_PART_BG, &label_dsc);
/* calculate the size of tick marks */
if(ext->x_axis.major_tick_len == LV_CHART_TICK_LENGTH_AUTO)
major_tick_len = (int32_t)w * LV_CHART_AXIS_MAJOR_TICK_LEN_COE;
else
major_tick_len = ext->x_axis.major_tick_len;
if(ext->x_axis.minor_tick_len == LV_CHART_TICK_LENGTH_AUTO)
minor_tick_len = major_tick_len * LV_CHART_AXIS_MINOR_TICK_LEN_COE;
else
minor_tick_len = ext->x_axis.minor_tick_len;
if(h + y_ofs > mask->y2) return;
if(h + y_ofs + label_dist + label_dsc.font->line_height + major_tick_len < mask->y1) return;
lv_draw_line_dsc_t line_dsc;
lv_draw_line_dsc_init(&line_dsc);
lv_obj_init_draw_line_dsc(chart, LV_CHART_PART_BG, &line_dsc);
/* The columns don't start at the most right position
* so change the width and offset accordingly. */
if(ext->type == LV_CHART_TYPE_COLUMN) {
uint32_t ser_num = _lv_ll_get_len(&ext->series_ll);
lv_coord_t col_w = w / ((ser_num + 1) * ext->point_cnt); /* Suppose + 1 series as separator*/
x_ofs += col_w / 2 + (col_w * (ser_num) / 2);
w -= col_w * ser_num + col_w;
}
char buf[LV_CHART_AXIS_TICK_LABEL_MAX_LEN + 1]; /* up to N symbols per label + null terminator */
/*determine the number of options */
iter = create_axis_label_iter(ext->x_axis.list_of_values, LV_CHART_LABEL_ITERATOR_FORWARD);
num_of_labels = iter.items_left;
/* we can't have string labels without ticks step, set to 1 if not specified */
if(ext->x_axis.num_tick_marks == 0) ext->x_axis.num_tick_marks = 1;
/* calculate total number of marks */
if(num_of_labels < 2)
num_scale_ticks = ext->x_axis.num_tick_marks;
else
num_scale_ticks = (ext->x_axis.num_tick_marks * (num_of_labels - 1));
for(i = 0; i < (num_scale_ticks + 1); i++) { /* one extra loop - it may not exist in the list, empty label */
/* first point of the tick */
p1.y = h + y_ofs;
/* second point of the tick */
if((num_of_labels != 0) && (i == 0 || i % ext->x_axis.num_tick_marks == 0))
p2.y = p1.y + major_tick_len; /* major tick */
else
p2.y = p1.y + minor_tick_len; /* minor tick */
/* draw a line at moving x position */
p2.x = p1.x = x_ofs + (int32_t)((int32_t)(w - line_dsc.width) * i) / num_scale_ticks;
if(i != num_scale_ticks)
lv_draw_line(&p1, &p2, mask, &line_dsc);
else if((ext->x_axis.options & LV_CHART_AXIS_DRAW_LAST_TICK) != 0)
lv_draw_line(&p1, &p2, mask, &line_dsc);
/* draw values if available */
if(num_of_labels != 0) {
/* add text only to major tick */
if(is_tick_with_label(i, &(ext->x_axis))) {
get_next_axis_label(&iter, buf);
/* reserve appropriate area */
lv_point_t size;
_lv_txt_get_size(&size, buf, label_dsc.font, label_dsc.letter_space, label_dsc.line_space,
LV_COORD_MAX, LV_TXT_FLAG_CENTER);
/* set the area at some distance of the major tick len under of the tick */
lv_area_t a = {(p2.x - size.x / 2), (p2.y + label_dist), (p2.x + size.x / 2),
(p2.y + size.y + label_dist)
};
lv_draw_label(&a, mask, &label_dsc, buf, NULL);
}
}
}
}
static void draw_axes(lv_obj_t * chart, const lv_area_t * series_area, const lv_area_t * mask)
{
draw_y_ticks(chart, series_area, mask, LV_CHART_AXIS_PRIMARY_Y);
draw_y_ticks(chart, series_area, mask, LV_CHART_AXIS_SECONDARY_Y);
draw_x_ticks(chart, series_area, mask);
}
/**
* invalid area of the new line data lines on a chart
* @param obj pointer to chart object
*/
static void invalidate_lines(lv_obj_t * chart, uint16_t i)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
if(i >= ext->point_cnt) return;
lv_area_t series_area;
get_series_area(chart, &series_area);
lv_coord_t w = lv_area_get_width(&series_area);
lv_coord_t x_ofs = series_area.x1;
lv_style_int_t line_width = lv_obj_get_style_line_width(chart, LV_CHART_PART_SERIES);
lv_style_int_t point_radius = lv_obj_get_style_size(chart, LV_CHART_PART_SERIES);
lv_area_t coords;
lv_area_copy(&coords, &series_area);
coords.y1 -= line_width + point_radius;
coords.y2 += line_width + point_radius;
if(i < ext->point_cnt - 1) {
coords.x1 = ((w * i) / (ext->point_cnt - 1)) + x_ofs - line_width - point_radius;
coords.x2 = ((w * (i + 1)) / (ext->point_cnt - 1)) + x_ofs + line_width + point_radius;
lv_obj_invalidate_area(chart, &coords);
}
if(i > 0) {
coords.x1 = ((w * (i - 1)) / (ext->point_cnt - 1)) + x_ofs - line_width - point_radius;
coords.x2 = ((w * i) / (ext->point_cnt - 1)) + x_ofs + line_width + point_radius;
lv_obj_invalidate_area(chart, &coords);
}
}
/**
* invalid area of the new column data lines on a chart
* @param chart pointer to chart object
* @param mask mask, inherited from the design function
*/
static void invalidate_columns(lv_obj_t * chart, uint16_t i)
{
lv_chart_ext_t * ext = lv_obj_get_ext_attr(chart);
lv_area_t series_area;
get_series_area(chart, &series_area);
lv_area_t col_a;
lv_coord_t w = lv_area_get_width(&series_area);
lv_coord_t col_w = w / ((_lv_ll_get_len(&ext->series_ll) + 1) * ext->point_cnt); /* Suppose + 1 series as separator*/
lv_coord_t x_ofs = col_w / 2; /*Shift with a half col.*/
lv_coord_t x_act;
x_act = (int32_t)((int32_t)w * i) / ext->point_cnt;
x_act += series_area.x1 + x_ofs;
lv_obj_get_coords(chart, &col_a);
col_a.x1 = x_act;
col_a.x2 = col_a.x1 + col_w;
_lv_inv_area(lv_obj_get_disp(chart), &col_a);
}
static void get_series_area(lv_obj_t * chart, lv_area_t * series_area)
{
lv_area_copy(series_area, &chart->coords);
series_area->x1 += lv_obj_get_style_pad_left(chart, LV_CHART_PART_BG);
series_area->x2 -= lv_obj_get_style_pad_right(chart, LV_CHART_PART_BG);
series_area->y1 += lv_obj_get_style_pad_top(chart, LV_CHART_PART_BG);
series_area->y2 -= lv_obj_get_style_pad_bottom(chart, LV_CHART_PART_BG);
}
#endif
|
train_000.parquet/995
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_chart.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 54208,
"token_count": 21371
}
|
/**
* @file lv_gauge.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_gauge.h"
#if LV_USE_GAUGE != 0
#include "../lv_misc/lv_debug.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_themes/lv_theme.h"
#include "../lv_misc/lv_txt.h"
#include "../lv_misc/lv_math.h"
#include "../lv_misc/lv_utils.h"
#include "lv_img.h"
#include <stdio.h>
#include <string.h>
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_gauge"
#define LV_GAUGE_DEF_NEEDLE_COLOR LV_COLOR_RED
#define LV_GAUGE_DEF_LABEL_COUNT 6
#define LV_GAUGE_DEF_LINE_COUNT 21 /*Should be: ((label_cnt - 1) * internal_lines) + 1*/
#define LV_GAUGE_DEF_ANGLE 270
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_design_res_t lv_gauge_design(lv_obj_t * gauge, const lv_area_t * clip_area, lv_design_mode_t mode);
static lv_res_t lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param);
static lv_style_list_t * lv_gauge_get_style(lv_obj_t * gauge, uint8_t part);
static void lv_gauge_draw_labels(lv_obj_t * gauge, const lv_area_t * mask);
static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * clip_area);
/**********************
* STATIC VARIABLES
**********************/
static lv_design_cb_t ancestor_design;
static lv_signal_cb_t ancestor_signal;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a gauge objects
* @param par pointer to an object, it will be the parent of the new gauge
* @param copy pointer to a gauge object, if not NULL then the new object will be copied from it
* @return pointer to the created gauge
*/
lv_obj_t * lv_gauge_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("gauge create started");
/*Create the ancestor gauge*/
lv_obj_t * gauge = lv_linemeter_create(par, copy);
LV_ASSERT_MEM(gauge);
if(gauge == NULL) return NULL;
/*Allocate the gauge type specific extended data*/
lv_gauge_ext_t * ext = lv_obj_allocate_ext_attr(gauge, sizeof(lv_gauge_ext_t));
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(gauge);
return NULL;
}
/*Initialize the allocated 'ext' */
ext->needle_count = 0;
ext->values = NULL;
ext->needle_colors = NULL;
ext->label_count = LV_GAUGE_DEF_LABEL_COUNT;
ext->format_cb = NULL;
ext->needle_img = 0;
ext->needle_img_pivot.x = 0;
ext->needle_img_pivot.y = 0;
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(gauge);
if(ancestor_design == NULL) ancestor_design = lv_obj_get_design_cb(gauge);
lv_style_list_init(&ext->style_strong);
lv_style_list_init(&ext->style_needle);
/*The signal and design functions are not copied so set them here*/
lv_obj_set_signal_cb(gauge, lv_gauge_signal);
lv_obj_set_design_cb(gauge, lv_gauge_design);
/*Init the new gauge gauge*/
if(copy == NULL) {
lv_gauge_set_scale(gauge, LV_GAUGE_DEF_ANGLE, LV_GAUGE_DEF_LINE_COUNT, LV_GAUGE_DEF_LABEL_COUNT);
lv_gauge_set_needle_count(gauge, 1, NULL);
lv_gauge_set_critical_value(gauge, 80);
lv_theme_apply(gauge, LV_THEME_GAUGE);
}
/*Copy an existing gauge*/
else {
lv_gauge_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
lv_gauge_set_needle_count(gauge, copy_ext->needle_count, copy_ext->needle_colors);
lv_style_list_copy(&ext->style_strong, ©_ext->style_strong);
lv_style_list_copy(&ext->style_needle, ©_ext->style_needle);
uint8_t i;
for(i = 0; i < ext->needle_count; i++) {
ext->values[i] = copy_ext->values[i];
}
ext->label_count = copy_ext->label_count;
ext->format_cb = copy_ext->format_cb;
/*Refresh the style with new signal function*/
lv_obj_refresh_style(gauge, LV_STYLE_PROP_ALL);
}
LV_LOG_INFO("gauge created");
return gauge;
}
/*=====================
* Setter functions
*====================*/
/**
* Set the number of needles
* @param gauge pointer to gauge object
* @param needle_cnt new count of needles
* @param colors an array of colors for needles (with 'num' elements)
*/
void lv_gauge_set_needle_count(lv_obj_t * gauge, uint8_t needle_cnt, const lv_color_t colors[])
{
LV_ASSERT_OBJ(gauge, LV_OBJX_NAME);
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
if(ext->needle_count != needle_cnt) {
if(ext->values != NULL) {
lv_mem_free(ext->values);
ext->values = NULL;
}
ext->values = lv_mem_realloc(ext->values, needle_cnt * sizeof(ext->values[0]));
LV_ASSERT_MEM(ext->values);
if(ext->values == NULL) return;
int16_t min = lv_gauge_get_min_value(gauge);
uint8_t n;
for(n = ext->needle_count; n < needle_cnt; n++) {
ext->values[n] = min;
}
ext->needle_count = needle_cnt;
}
ext->needle_colors = colors;
lv_obj_invalidate(gauge);
}
/**
* Set the value of a needle
* @param gauge pointer to a gauge
* @param needle_id the id of the needle
* @param value the new value
*/
void lv_gauge_set_value(lv_obj_t * gauge, uint8_t needle_id, int32_t value)
{
LV_ASSERT_OBJ(gauge, LV_OBJX_NAME);
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
if(needle_id >= ext->needle_count) return;
if(ext->values[needle_id] == value) return;
int16_t min = lv_gauge_get_min_value(gauge);
int16_t max = lv_gauge_get_max_value(gauge);
if(value > max)
value = max;
else if(value < min)
value = min;
int32_t old_value = ext->values[needle_id];
ext->values[needle_id] = value;
// lv_obj_invalidate(gauge);
lv_style_int_t pad = lv_obj_get_style_pad_inner(gauge, LV_GAUGE_PART_NEEDLE);
lv_style_int_t left = lv_obj_get_style_pad_left(gauge, LV_GAUGE_PART_MAIN);
lv_style_int_t right = lv_obj_get_style_pad_right(gauge, LV_GAUGE_PART_MAIN);
lv_style_int_t top = lv_obj_get_style_pad_top(gauge, LV_GAUGE_PART_MAIN);
lv_coord_t r = (lv_obj_get_width(gauge) - left - right) / 2 - pad;
lv_coord_t x_ofs = gauge->coords.x1 + r + left + pad;
lv_coord_t y_ofs = gauge->coords.y1 + r + top + pad;
uint16_t angle = lv_linemeter_get_scale_angle(gauge);
int16_t angle_ofs = 90 + (360 - angle) / 2;
lv_point_t p_mid;
lv_point_t p_end;
lv_coord_t needle_w;
if(ext->needle_img) {
lv_img_header_t info;
lv_img_decoder_get_info(ext->needle_img, &info);
needle_w = info.h;
}
else {
needle_w = lv_obj_get_style_line_width(gauge, LV_GAUGE_PART_NEEDLE);
}
p_mid.x = x_ofs;
p_mid.y = y_ofs;
/*Calculate the end point of a needle*/
int16_t needle_angle = (old_value - min) * angle / (max - min) + angle_ofs;
p_end.y = (_lv_trigo_sin(needle_angle) * r) / LV_TRIGO_SIN_MAX + y_ofs;
p_end.x = (_lv_trigo_sin(needle_angle + 90) * r) / LV_TRIGO_SIN_MAX + x_ofs;
lv_area_t a;
a.x1 = LV_MATH_MIN(p_mid.x, p_end.x) - needle_w;
a.y1 = LV_MATH_MIN(p_mid.y, p_end.y) - needle_w;
a.x2 = LV_MATH_MAX(p_mid.x, p_end.x) + needle_w;
a.y2 = LV_MATH_MAX(p_mid.y, p_end.y) + needle_w;
lv_obj_invalidate_area(gauge, &a);
needle_angle = (value - min) * angle / (max - min) + angle_ofs;
p_end.y = (_lv_trigo_sin(needle_angle) * r) / LV_TRIGO_SIN_MAX + y_ofs;
p_end.x = (_lv_trigo_sin(needle_angle + 90) * r) / LV_TRIGO_SIN_MAX + x_ofs;
a.x1 = LV_MATH_MIN(p_mid.x, p_end.x);
a.y1 = LV_MATH_MIN(p_mid.y, p_end.y);
a.x2 = LV_MATH_MAX(p_mid.x, p_end.x);
a.y2 = LV_MATH_MAX(p_mid.y, p_end.y);
lv_obj_invalidate_area(gauge, &a);
}
/**
* Set the scale settings of a gauge
* @param gauge pointer to a gauge object
* @param angle angle of the scale (0..360)
* @param line_cnt count of scale lines.
* To get a given "subdivision" lines between labels:
* `line_cnt = (sub_div + 1) * (label_cnt - 1) + 1 `
* @param label_cnt count of scale labels.
*/
void lv_gauge_set_scale(lv_obj_t * gauge, uint16_t angle, uint8_t line_cnt, uint8_t label_cnt)
{
LV_ASSERT_OBJ(gauge, LV_OBJX_NAME);
lv_linemeter_set_scale(gauge, angle, line_cnt);
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
ext->label_count = label_cnt;
lv_obj_invalidate(gauge);
}
/**
* Set an image to display as needle(s).
* The needle image should be horizontal and pointing to the right (`--->`).
* @param gauge pointer to a gauge object
* @param img_src pointer to an `lv_img_dsc_t` variable or a path to an image
* (not an `lv_img` object)
* @param pivot_x the X coordinate of rotation center of the image
* @param pivot_y the Y coordinate of rotation center of the image
*/
void lv_gauge_set_needle_img(lv_obj_t * gauge, const void * img, lv_coord_t pivot_x, lv_coord_t pivot_y)
{
LV_ASSERT_OBJ(gauge, LV_OBJX_NAME);
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
ext->needle_img = img;
ext->needle_img_pivot.x = pivot_x;
ext->needle_img_pivot.y = pivot_y;
lv_obj_invalidate(gauge);
}
/**
* Assign a function to format gauge values
* @param gauge pointer to a gauge object
* @param format_cb pointer to function of lv_gauge_format_cb_t
*/
void lv_gauge_set_formatter_cb(lv_obj_t * gauge, lv_gauge_format_cb_t format_cb)
{
LV_ASSERT_OBJ(gauge, LV_OBJX_NAME);
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
ext->format_cb = format_cb;
}
/*=====================
* Getter functions
*====================*/
/**
* Get the value of a needle
* @param gauge pointer to gauge object
* @param needle the id of the needle
* @return the value of the needle [min,max]
*/
int32_t lv_gauge_get_value(const lv_obj_t * gauge, uint8_t needle)
{
LV_ASSERT_OBJ(gauge, LV_OBJX_NAME);
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
int16_t min = lv_gauge_get_min_value(gauge);
if(needle >= ext->needle_count) return min;
return ext->values[needle];
}
/**
* Get the count of needles on a gauge
* @param gauge pointer to gauge
* @return count of needles
*/
uint8_t lv_gauge_get_needle_count(const lv_obj_t * gauge)
{
LV_ASSERT_OBJ(gauge, LV_OBJX_NAME);
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
return ext->needle_count;
}
/**
* Set the number of labels (and the thicker lines too)
* @param gauge pointer to a gauge object
* @return count of labels
*/
uint8_t lv_gauge_get_label_count(const lv_obj_t * gauge)
{
LV_ASSERT_OBJ(gauge, LV_OBJX_NAME);
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
return ext->label_count;
}
/**
* Get an image to display as needle(s).
* @param gauge pointer to a gauge object
* @return pointer to an `lv_img_dsc_t` variable or a path to an image
* (not an `lv_img` object). `NULL` if not used.
*/
const void * lv_gauge_get_needle_img(lv_obj_t * gauge)
{
LV_ASSERT_OBJ(gauge, LV_OBJX_NAME);
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
return ext->needle_img;
}
/**
* Get the X coordinate of the rotation center of the needle image
* @param gauge pointer to a gauge object
* @return the X coordinate of rotation center of the image
*/
lv_coord_t lv_gauge_get_needle_img_pivot_x(lv_obj_t * gauge)
{
LV_ASSERT_OBJ(gauge, LV_OBJX_NAME);
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
return ext->needle_img_pivot.x;
}
/**
* Get the Y coordinate of the rotation center of the needle image
* @param gauge pointer to a gauge object
* @return the X coordinate of rotation center of the image
*/
lv_coord_t lv_gauge_get_needle_img_pivot_y(lv_obj_t * gauge)
{
LV_ASSERT_OBJ(gauge, LV_OBJX_NAME);
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
return ext->needle_img_pivot.y;
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the gauges
* @param gauge pointer to an object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_gauge_design(lv_obj_t * gauge, const lv_area_t * clip_area, lv_design_mode_t mode)
{
/*Return false if the object is not covers the mask_p area*/
if(mode == LV_DESIGN_COVER_CHK) {
return LV_DESIGN_RES_NOT_COVER;
}
/*Draw the object*/
else if(mode == LV_DESIGN_DRAW_MAIN) {
ancestor_design(gauge, clip_area, mode);
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
lv_gauge_draw_labels(gauge, clip_area);
/*Add the strong lines*/
uint16_t line_cnt_tmp = ext->lmeter.line_cnt;
ext->lmeter.line_cnt = ext->label_count; /*Only to labels*/
lv_linemeter_draw_scale(gauge, clip_area, LV_GAUGE_PART_MAJOR);
ext->lmeter.line_cnt = line_cnt_tmp; /*Restore the parameters*/
lv_gauge_draw_needle(gauge, clip_area);
}
/*Post draw when the children are drawn*/
else if(mode == LV_DESIGN_DRAW_POST) {
ancestor_design(gauge, clip_area, mode);
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the gauge
* @param gauge pointer to a gauge object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_gauge_signal(lv_obj_t * gauge, lv_signal_t sign, void * param)
{
lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_gauge_get_style(gauge, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(gauge, sign, param);
}
/* Include the ancient signal function */
res = ancestor_signal(gauge, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
if(sign == LV_SIGNAL_CLEANUP) {
lv_mem_free(ext->values);
ext->values = NULL;
lv_obj_clean_style_list(gauge, LV_GAUGE_PART_NEEDLE);
lv_obj_clean_style_list(gauge, LV_GAUGE_PART_MAJOR);
}
return res;
}
/**
* Get the style descriptor of a part of the object
* @param page pointer the object
* @param part the part from `lv_gauge_part_t`. (LV_GAUGE_PART_...)
* @return pointer to the style descriptor of the specified part
*/
static lv_style_list_t * lv_gauge_get_style(lv_obj_t * gauge, uint8_t part)
{
LV_ASSERT_OBJ(gauge, LV_OBJX_NAME);
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
lv_style_list_t * style_dsc_p;
switch(part) {
case LV_GAUGE_PART_MAIN:
style_dsc_p = &gauge->style_list;
break;
case LV_GAUGE_PART_MAJOR:
style_dsc_p = &ext->style_strong;
break;
case LV_GAUGE_PART_NEEDLE:
style_dsc_p = &ext->style_needle;
break;
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
/**
* Draw the scale on a gauge
* @param gauge pointer to gauge object
* @param mask mask of drawing
*/
static void lv_gauge_draw_labels(lv_obj_t * gauge, const lv_area_t * mask)
{
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
lv_style_int_t scale_width = lv_obj_get_style_scale_width(gauge, LV_GAUGE_PART_MAJOR);
lv_style_int_t left = lv_obj_get_style_pad_left(gauge, LV_GAUGE_PART_MAIN);
lv_style_int_t right = lv_obj_get_style_pad_right(gauge, LV_GAUGE_PART_MAIN);
lv_style_int_t top = lv_obj_get_style_pad_top(gauge, LV_GAUGE_PART_MAIN);
lv_style_int_t txt_pad = lv_obj_get_style_pad_inner(gauge, LV_GAUGE_PART_MAIN);
lv_coord_t r = (lv_obj_get_width(gauge) - left - right) / 2 - scale_width - txt_pad;
lv_coord_t x_ofs = gauge->coords.x1 + r + left + scale_width + txt_pad;
lv_coord_t y_ofs = gauge->coords.y1 + r + top + scale_width + txt_pad;
int16_t scale_angle = lv_linemeter_get_scale_angle(gauge);
uint16_t label_num = ext->label_count;
int16_t angle_ofs = 90 + (360 - scale_angle) / 2 + lv_gauge_get_angle_offset(gauge);
int32_t min = lv_gauge_get_min_value(gauge);
int32_t max = lv_gauge_get_max_value(gauge);
lv_draw_label_dsc_t label_dsc;
lv_draw_label_dsc_init(&label_dsc);
lv_obj_init_draw_label_dsc(gauge, LV_GAUGE_PART_MAJOR, &label_dsc);
uint8_t i;
for(i = 0; i < label_num; i++) {
/*Calculate the position a scale label*/
int16_t angle = (i * scale_angle) / (label_num - 1) + angle_ofs;
lv_coord_t y = (int32_t)((int32_t)_lv_trigo_sin(angle) * r) / LV_TRIGO_SIN_MAX;
y += y_ofs;
lv_coord_t x = (int32_t)((int32_t)_lv_trigo_sin(angle + 90) * r) / LV_TRIGO_SIN_MAX;
x += x_ofs;
int32_t scale_act = (int32_t)((int32_t)(max - min) * i) / (label_num - 1);
scale_act += min;
char scale_txt[16];
if(ext->format_cb == NULL)
_lv_utils_num_to_str(scale_act, scale_txt);
else
ext->format_cb(gauge, scale_txt, sizeof(scale_txt), scale_act);
lv_area_t label_cord;
lv_point_t label_size;
_lv_txt_get_size(&label_size, scale_txt, label_dsc.font, label_dsc.letter_space, label_dsc.line_space,
LV_COORD_MAX, LV_TXT_FLAG_NONE);
/*Draw the label*/
label_cord.x1 = x - label_size.x / 2;
label_cord.y1 = y - label_size.y / 2;
label_cord.x2 = label_cord.x1 + label_size.x;
label_cord.y2 = label_cord.y1 + label_size.y;
lv_draw_label(&label_cord, mask, &label_dsc, scale_txt, NULL);
}
}
/**
* Draw the needles of a gauge
* @param gauge pointer to gauge object
* @param mask mask of drawing
*/
static void lv_gauge_draw_needle(lv_obj_t * gauge, const lv_area_t * clip_area)
{
lv_gauge_ext_t * ext = lv_obj_get_ext_attr(gauge);
lv_style_int_t pad = lv_obj_get_style_pad_inner(gauge, LV_GAUGE_PART_NEEDLE);
lv_style_int_t left = lv_obj_get_style_pad_left(gauge, LV_GAUGE_PART_MAIN);
lv_style_int_t right = lv_obj_get_style_pad_right(gauge, LV_GAUGE_PART_MAIN);
lv_style_int_t top = lv_obj_get_style_pad_top(gauge, LV_GAUGE_PART_MAIN);
lv_coord_t r = (lv_obj_get_width(gauge) - left - right) / 2 - pad;
lv_coord_t x_ofs = gauge->coords.x1 + r + left + pad;
lv_coord_t y_ofs = gauge->coords.y1 + r + top + pad;
uint16_t angle = lv_linemeter_get_scale_angle(gauge);
int16_t angle_ofs = 90 + (360 - angle) / 2 + lv_gauge_get_angle_offset(gauge);
int16_t min = lv_gauge_get_min_value(gauge);
int16_t max = lv_gauge_get_max_value(gauge);
lv_point_t p_mid;
lv_point_t p_end;
uint8_t i;
lv_draw_line_dsc_t line_dsc;
lv_draw_line_dsc_init(&line_dsc);
lv_obj_init_draw_line_dsc(gauge, LV_GAUGE_PART_NEEDLE, &line_dsc);
p_mid.x = x_ofs;
p_mid.y = y_ofs;
for(i = 0; i < ext->needle_count; i++) {
/*Calculate the end point of a needle*/
int16_t needle_angle =
(ext->values[i] - min) * angle / (max - min) + angle_ofs;
/*Draw line*/
if(ext->needle_img == NULL) {
p_end.y = (_lv_trigo_sin(needle_angle) * r) / LV_TRIGO_SIN_MAX + y_ofs;
p_end.x = (_lv_trigo_sin(needle_angle + 90) * r) / LV_TRIGO_SIN_MAX + x_ofs;
/*Draw the needle with the corresponding color*/
if(ext->needle_colors != NULL) line_dsc.color = ext->needle_colors[i];
lv_draw_line(&p_mid, &p_end, clip_area, &line_dsc);
}
/*Draw image*/
else {
lv_img_header_t info;
lv_img_decoder_get_info(ext->needle_img, &info);
lv_area_t a;
a.x1 = gauge->coords.x1 + lv_area_get_width(&gauge->coords) / 2 - ext->needle_img_pivot.x;
a.y1 = gauge->coords.y1 + lv_area_get_height(&gauge->coords) / 2 - ext->needle_img_pivot.y;
a.x2 = a.x1 + info.w - 1;
a.y2 = a.y1 + info.h - 1;
lv_draw_img_dsc_t img_dsc;
lv_draw_img_dsc_init(&img_dsc);
lv_obj_init_draw_img_dsc(gauge, LV_GAUGE_PART_MAIN, &img_dsc);
img_dsc.recolor_opa = LV_OPA_COVER;
img_dsc.pivot.x = ext->needle_img_pivot.x;
img_dsc.pivot.y = ext->needle_img_pivot.y;
if(ext->needle_colors != NULL)
img_dsc.recolor = ext->needle_colors[i];
needle_angle = (needle_angle * 10);
if(needle_angle > 3600) needle_angle -= 3600;
img_dsc.angle = needle_angle;
lv_draw_img(&a, clip_area, ext->needle_img, &img_dsc);
}
}
lv_draw_rect_dsc_t mid_dsc;
lv_draw_rect_dsc_init(&mid_dsc);
lv_obj_init_draw_rect_dsc(gauge, LV_GAUGE_PART_NEEDLE, &mid_dsc);
lv_style_int_t size = lv_obj_get_style_size(gauge, LV_GAUGE_PART_NEEDLE) / 2;
lv_area_t nm_cord;
nm_cord.x1 = x_ofs - size;
nm_cord.y1 = y_ofs - size;
nm_cord.x2 = x_ofs + size;
nm_cord.y2 = y_ofs + size;
lv_draw_rect(&nm_cord, clip_area, &mid_dsc);
}
#endif
|
train_000.parquet/996
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_gauge.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 21649,
"token_count": 8962
}
|
/**
* @file lv_ta.h
*
*/
#ifndef LV_TEXTAREA_H
#define LV_TEXTAREA_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_TEXTAREA != 0
/*Testing of dependencies*/
#if LV_USE_PAGE == 0
#error "lv_ta: lv_page is required. Enable it in lv_conf.h (LV_USE_PAGE 1) "
#endif
#if LV_USE_LABEL == 0
#error "lv_ta: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "lv_page.h"
#include "lv_label.h"
/*********************
* DEFINES
*********************/
#define LV_TEXTAREA_CURSOR_LAST (0x7FFF) /*Put the cursor after the last character*/
LV_EXPORT_CONST_INT(LV_TEXTAREA_CURSOR_LAST);
/**********************
* TYPEDEFS
**********************/
/*Data of text area*/
typedef struct {
lv_page_ext_t page; /*Ext. of ancestor*/
/*New data for this type */
lv_obj_t * label; /*Label of the text area*/
char * placeholder_txt; /*Place holder label. only visible if text is an empty string*/
lv_style_list_t style_placeholder;
char * pwd_tmp; /*Used to store the original text in password mode*/
const char * accapted_chars; /*Only these characters will be accepted. NULL: accept all*/
uint32_t max_length; /*The max. number of characters. 0: no limit*/
uint16_t pwd_show_time; /*Time to show characters in password mode before change them to '*' */
struct {
lv_style_list_t style; /* Style of the cursor (NULL to use label's style)*/
lv_coord_t valid_x; /* Used when stepping up/down to a shorter line.
* (Used by the library)*/
uint32_t pos; /* The current cursor position
* (0: before 1st letter; 1: before 2nd letter ...)*/
uint16_t blink_time; /*Blink period*/
lv_area_t area; /* Cursor area relative to the Text Area*/
uint32_t txt_byte_pos; /* Byte index of the letter after (on) the cursor*/
uint8_t state : 1; /*Cursor is visible now or not (Handled by the library)*/
uint8_t hidden : 1; /*Cursor is hidden by he user */
uint8_t click_pos : 1; /*1: Enable positioning the cursor by clicking the text area*/
} cursor;
#if LV_LABEL_TEXT_SEL
uint32_t sel_start; /*Temporary values for text selection*/
uint32_t sel_end;
uint8_t text_sel_in_prog : 1; /*User is in process of selecting */
uint8_t text_sel_en : 1; /*Text can be selected on this text area*/
#endif
uint8_t pwd_mode : 1; /*Replace characters with '*' */
uint8_t one_line : 1; /*One line mode (ignore line breaks)*/
} lv_textarea_ext_t;
/** Possible text areas styles. */
enum {
LV_TEXTAREA_PART_BG = LV_PAGE_PART_BG, /**< Text area background style */
LV_TEXTAREA_PART_SCROLLBAR = LV_PAGE_PART_SCROLLBAR, /**< Scrollbar style */
LV_TEXTAREA_PART_EDGE_FLASH = LV_PAGE_PART_EDGE_FLASH, /**< Edge flash style */
LV_TEXTAREA_PART_CURSOR = _LV_PAGE_PART_VIRTUAL_LAST, /**< Cursor style */
LV_TEXTAREA_PART_PLACEHOLDER, /**< Placeholder style */
_LV_TEXTAREA_PART_VIRTUAL_LAST,
_LV_TEXTAREA_PART_REAL_LAST = _LV_PAGE_PART_REAL_LAST,
};
typedef uint8_t lv_textarea_style_t;
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a text area objects
* @param par pointer to an object, it will be the parent of the new text area
* @param copy pointer to a text area object, if not NULL then the new object will be copied from it
* @return pointer to the created text area
*/
lv_obj_t * lv_textarea_create(lv_obj_t * par, const lv_obj_t * copy);
/*======================
* Add/remove functions
*=====================*/
/**
* Insert a character to the current cursor position.
* To add a wide char, e.g. 'Á' use `_lv_txt_encoded_conv_wc('Á')`
* @param ta pointer to a text area object
* @param c a character (e.g. 'a')
*/
void lv_textarea_add_char(lv_obj_t * ta, uint32_t c);
/**
* Insert a text to the current cursor position
* @param ta pointer to a text area object
* @param txt a '\0' terminated string to insert
*/
void lv_textarea_add_text(lv_obj_t * ta, const char * txt);
/**
* Delete a the left character from the current cursor position
* @param ta pointer to a text area object
*/
void lv_textarea_del_char(lv_obj_t * ta);
/**
* Delete the right character from the current cursor position
* @param ta pointer to a text area object
*/
void lv_textarea_del_char_forward(lv_obj_t * ta);
/*=====================
* Setter functions
*====================*/
/**
* Set the text of a text area
* @param ta pointer to a text area
* @param txt pointer to the text
*/
void lv_textarea_set_text(lv_obj_t * ta, const char * txt);
/**
* Set the placeholder text of a text area
* @param ta pointer to a text area
* @param txt pointer to the text
*/
void lv_textarea_set_placeholder_text(lv_obj_t * ta, const char * txt);
/**
* Set the cursor position
* @param obj pointer to a text area object
* @param pos the new cursor position in character index
* < 0 : index from the end of the text
* LV_TEXTAREA_CURSOR_LAST: go after the last character
*/
void lv_textarea_set_cursor_pos(lv_obj_t * ta, int32_t pos);
/**
* Hide/Unhide the cursor.
* @param ta pointer to a text area object
* @param hide: true: hide the cursor
*/
void lv_textarea_set_cursor_hidden(lv_obj_t * ta, bool hide);
/**
* Enable/Disable the positioning of the the cursor by clicking the text on the text area.
* @param ta pointer to a text area object
* @param en true: enable click positions; false: disable
*/
void lv_textarea_set_cursor_click_pos(lv_obj_t * ta, bool en);
/**
* Enable/Disable password mode
* @param ta pointer to a text area object
* @param en true: enable, false: disable
*/
void lv_textarea_set_pwd_mode(lv_obj_t * ta, bool en);
/**
* Configure the text area to one line or back to normal
* @param ta pointer to a Text area object
* @param en true: one line, false: normal
*/
void lv_textarea_set_one_line(lv_obj_t * ta, bool en);
/**
* Set the alignment of the text area.
* In one line mode the text can be scrolled only with `LV_LABEL_ALIGN_LEFT`.
* This function should be called if the size of text area changes.
* @param ta pointer to a text are object
* @param align the desired alignment from `lv_label_align_t`. (LV_LABEL_ALIGN_LEFT/CENTER/RIGHT)
*/
void lv_textarea_set_text_align(lv_obj_t * ta, lv_label_align_t align);
/**
* Set a list of characters. Only these characters will be accepted by the text area
* @param ta pointer to Text Area
* @param list list of characters. Only the pointer is saved. E.g. "+-.,0123456789"
*/
void lv_textarea_set_accepted_chars(lv_obj_t * ta, const char * list);
/**
* Set max length of a Text Area.
* @param ta pointer to Text Area
* @param num the maximal number of characters can be added (`lv_textarea_set_text` ignores it)
*/
void lv_textarea_set_max_length(lv_obj_t * ta, uint32_t num);
/**
* In `LV_EVENT_INSERT` the text which planned to be inserted can be replaced by an other text.
* It can be used to add automatic formatting to the text area.
* @param ta pointer to a text area.
* @param txt pointer to a new string to insert. If `""` no text will be added.
* The variable must be live after the `event_cb` exists. (Should be `global` or
* `static`)
*/
void lv_textarea_set_insert_replace(lv_obj_t * ta, const char * txt);
/**
* Set the scroll bar mode of a text area
* @param ta pointer to a text area object
* @param sb_mode the new mode from 'lv_scrollbar_mode_t' enum
*/
static inline void lv_textarea_set_scrollbar_mode(lv_obj_t * ta, lv_scrollbar_mode_t mode)
{
lv_page_set_scrollbar_mode(ta, mode);
}
/**
* Enable the scroll propagation feature. If enabled then the Text area will move its parent if
* there is no more space to scroll.
* @param ta pointer to a Text area
* @param en true or false to enable/disable scroll propagation
*/
static inline void lv_textarea_set_scroll_propagation(lv_obj_t * ta, bool en)
{
lv_page_set_scroll_propagation(ta, en);
}
/**
* Enable the edge flash effect. (Show an arc when the an edge is reached)
* @param page pointer to a Text Area
* @param en true or false to enable/disable end flash
*/
static inline void lv_textarea_set_edge_flash(lv_obj_t * ta, bool en)
{
lv_page_set_edge_flash(ta, en);
}
/**
* Enable/disable selection mode.
* @param ta pointer to a text area object
* @param en true or false to enable/disable selection mode
*/
void lv_textarea_set_text_sel(lv_obj_t * ta, bool en);
/**
* Set how long show the password before changing it to '*'
* @param ta pointer to Text area
* @param time show time in milliseconds. 0: hide immediately.
*/
void lv_textarea_set_pwd_show_time(lv_obj_t * ta, uint16_t time);
/**
* Set cursor blink animation time
* @param ta pointer to Text area
* @param time blink period. 0: disable blinking
*/
void lv_textarea_set_cursor_blink_time(lv_obj_t * ta, uint16_t time);
/*=====================
* Getter functions
*====================*/
/**
* Get the text of a text area. In password mode it gives the real text (not '*'s).
* @param ta pointer to a text area object
* @return pointer to the text
*/
const char * lv_textarea_get_text(const lv_obj_t * ta);
/**
* Get the placeholder text of a text area
* @param ta pointer to a text area object
* @return pointer to the text
*/
const char * lv_textarea_get_placeholder_text(lv_obj_t * ta);
/**
* Get the label of a text area
* @param ta pointer to a text area object
* @return pointer to the label object
*/
lv_obj_t * lv_textarea_get_label(const lv_obj_t * ta);
/**
* Get the current cursor position in character index
* @param ta pointer to a text area object
* @return the cursor position
*/
uint32_t lv_textarea_get_cursor_pos(const lv_obj_t * ta);
/**
* Get whether the cursor is hidden or not
* @param ta pointer to a text area object
* @return true: the cursor is hidden
*/
bool lv_textarea_get_cursor_hidden(const lv_obj_t * ta);
/**
* Get whether the cursor click positioning is enabled or not.
* @param ta pointer to a text area object
* @return true: enable click positions; false: disable
*/
bool lv_textarea_get_cursor_click_pos(lv_obj_t * ta);
/**
* Get the password mode attribute
* @param ta pointer to a text area object
* @return true: password mode is enabled, false: disabled
*/
bool lv_textarea_get_pwd_mode(const lv_obj_t * ta);
/**
* Get the one line configuration attribute
* @param ta pointer to a text area object
* @return true: one line configuration is enabled, false: disabled
*/
bool lv_textarea_get_one_line(const lv_obj_t * ta);
/**
* Get a list of accepted characters.
* @param ta pointer to Text Area
* @return list of accented characters.
*/
const char * lv_textarea_get_accepted_chars(lv_obj_t * ta);
/**
* Get max length of a Text Area.
* @param ta pointer to Text Area
* @return the maximal number of characters to be add
*/
uint32_t lv_textarea_get_max_length(lv_obj_t * ta);
/**
* Get the scroll bar mode of a text area
* @param ta pointer to a text area object
* @return scrollbar mode from 'lv_scrollbar_mode_t' enum
*/
static inline lv_scrollbar_mode_t lv_textarea_get_scrollbar_mode(const lv_obj_t * ta)
{
return lv_page_get_scrollbar_mode(ta);
}
/**
* Get the scroll propagation property
* @param ta pointer to a Text area
* @return true or false
*/
static inline bool lv_textarea_get_scroll_propagation(lv_obj_t * ta)
{
return lv_page_get_scroll_propagation(ta);
}
/**
* Get the scroll propagation property
* @param ta pointer to a Text area
* @return true or false
*/
static inline bool lv_textarea_get_edge_flash(lv_obj_t * ta)
{
return lv_page_get_edge_flash(ta);
}
/**
* Find whether text is selected or not.
* @param ta Text area object
* @return whether text is selected or not
*/
bool lv_textarea_text_is_selected(const lv_obj_t * ta);
/**
* Find whether selection mode is enabled.
* @param ta pointer to a text area object
* @return true: selection mode is enabled, false: disabled
*/
bool lv_textarea_get_text_sel_en(lv_obj_t * ta);
/**
* Set how long show the password before changing it to '*'
* @param ta pointer to Text area
* @return show time in milliseconds. 0: hide immediately.
*/
uint16_t lv_textarea_get_pwd_show_time(lv_obj_t * ta);
/**
* Set cursor blink animation time
* @param ta pointer to Text area
* @return time blink period. 0: disable blinking
*/
uint16_t lv_textarea_get_cursor_blink_time(lv_obj_t * ta);
/*=====================
* Other functions
*====================*/
/**
* Clear the selection on the text area.
* @param ta Text area object
*/
void lv_textarea_clear_selection(lv_obj_t * ta);
/**
* Move the cursor one character right
* @param ta pointer to a text area object
*/
void lv_textarea_cursor_right(lv_obj_t * ta);
/**
* Move the cursor one character left
* @param ta pointer to a text area object
*/
void lv_textarea_cursor_left(lv_obj_t * ta);
/**
* Move the cursor one line down
* @param ta pointer to a text area object
*/
void lv_textarea_cursor_down(lv_obj_t * ta);
/**
* Move the cursor one line up
* @param ta pointer to a text area object
*/
void lv_textarea_cursor_up(lv_obj_t * ta);
/**********************
* MACROS
**********************/
#endif /*LV_USE_TEXTAREA_H*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_TEXTAREA_H*/
|
train_000.parquet/997
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_textarea.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 13636,
"token_count": 4774
}
|
/**
* @file lv_label.c
*
*/
/*********************
* INCLUDES
*********************/
#include "lv_label.h"
#if LV_USE_LABEL != 0
#include "../lv_core/lv_obj.h"
#include "../lv_misc/lv_debug.h"
#include "../lv_core/lv_group.h"
#include "../lv_draw/lv_draw.h"
#include "../lv_misc/lv_color.h"
#include "../lv_misc/lv_math.h"
#include "../lv_misc/lv_bidi.h"
#include "../lv_misc/lv_txt_ap.h"
#include "../lv_misc/lv_printf.h"
#include "../lv_themes/lv_theme.h"
/*********************
* DEFINES
*********************/
#define LV_OBJX_NAME "lv_label"
/*Test configurations*/
#ifndef LV_LABEL_DEF_SCROLL_SPEED
#define LV_LABEL_DEF_SCROLL_SPEED (25)
#endif
#define LV_LABEL_DOT_END_INV 0xFFFF
#define LV_LABEL_HINT_HEIGHT_LIMIT \
1024 /*Enable "hint" to buffer info about labels larger than this. (Speed up their drawing)*/
/**********************
* TYPEDEFS
**********************/
/**********************
* STATIC PROTOTYPES
**********************/
static lv_res_t lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param);
static lv_design_res_t lv_label_design(lv_obj_t * label, const lv_area_t * clip_area, lv_design_mode_t mode);
static void lv_label_refr_text(lv_obj_t * label);
static void lv_label_revert_dots(lv_obj_t * label);
#if LV_USE_ANIMATION
static void lv_label_set_offset_x(lv_obj_t * label, lv_coord_t x);
static void lv_label_set_offset_y(lv_obj_t * label, lv_coord_t y);
#endif
static bool lv_label_set_dot_tmp(lv_obj_t * label, char * data, uint32_t len);
static char * lv_label_get_dot_tmp(lv_obj_t * label);
static void lv_label_dot_tmp_free(lv_obj_t * label);
static void get_txt_coords(const lv_obj_t * label, lv_area_t * area);
/**********************
* STATIC VARIABLES
**********************/
static lv_signal_cb_t ancestor_signal;
/**********************
* MACROS
**********************/
/**********************
* GLOBAL FUNCTIONS
**********************/
/**
* Create a label objects
* @param par pointer to an object, it will be the parent of the new label
* @param copy pointer to a label object, if not NULL then the new object will be copied from it
* @return pointer to the created button
*/
lv_obj_t * lv_label_create(lv_obj_t * par, const lv_obj_t * copy)
{
LV_LOG_TRACE("label create started");
/*Create a basic object*/
lv_obj_t * new_label = lv_obj_create(par, copy);
LV_ASSERT_MEM(new_label);
if(new_label == NULL) return NULL;
if(ancestor_signal == NULL) ancestor_signal = lv_obj_get_signal_cb(new_label);
/*Extend the basic object to a label object*/
lv_obj_allocate_ext_attr(new_label, sizeof(lv_label_ext_t));
lv_label_ext_t * ext = lv_obj_get_ext_attr(new_label);
LV_ASSERT_MEM(ext);
if(ext == NULL) {
lv_obj_del(new_label);
return NULL;
}
ext->text = NULL;
ext->static_txt = 0;
ext->recolor = 0;
ext->align = LV_LABEL_ALIGN_AUTO;
ext->dot_end = LV_LABEL_DOT_END_INV;
ext->long_mode = LV_LABEL_LONG_EXPAND;
#if LV_USE_ANIMATION
ext->anim_speed = LV_LABEL_DEF_SCROLL_SPEED;
#endif
ext->offset.x = 0;
ext->offset.y = 0;
#if LV_LABEL_LONG_TXT_HINT
ext->hint.line_start = -1;
ext->hint.coord_y = 0;
ext->hint.y = 0;
#endif
#if LV_LABEL_TEXT_SEL
ext->sel_start = LV_DRAW_LABEL_NO_TXT_SEL;
ext->sel_end = LV_DRAW_LABEL_NO_TXT_SEL;
#endif
ext->dot.tmp_ptr = NULL;
ext->dot_tmp_alloc = 0;
lv_obj_set_design_cb(new_label, lv_label_design);
lv_obj_set_signal_cb(new_label, lv_label_signal);
/*Init the new label*/
if(copy == NULL) {
lv_theme_apply(new_label, LV_THEME_LABEL);
lv_obj_set_click(new_label, false);
lv_label_set_long_mode(new_label, LV_LABEL_LONG_EXPAND);
lv_label_set_text(new_label, "Text");
}
/*Copy 'copy' if not NULL*/
else {
lv_label_ext_t * copy_ext = lv_obj_get_ext_attr(copy);
lv_label_set_long_mode(new_label, lv_label_get_long_mode(copy));
lv_label_set_recolor(new_label, lv_label_get_recolor(copy));
lv_label_set_align(new_label, lv_label_get_align(copy));
if(copy_ext->static_txt == 0)
lv_label_set_text(new_label, lv_label_get_text(copy));
else
lv_label_set_text_static(new_label, lv_label_get_text(copy));
/*In DOT mode save the text byte-to-byte because a '\0' can be in the middle*/
if(copy_ext->long_mode == LV_LABEL_LONG_DOT) {
ext->text = lv_mem_realloc(ext->text, _lv_mem_get_size(copy_ext->text));
LV_ASSERT_MEM(ext->text);
if(ext->text == NULL) return NULL;
_lv_memcpy(ext->text, copy_ext->text, _lv_mem_get_size(copy_ext->text));
}
if(copy_ext->dot_tmp_alloc && copy_ext->dot.tmp_ptr) {
uint32_t len = (uint32_t)strlen(copy_ext->dot.tmp_ptr);
lv_label_set_dot_tmp(new_label, ext->dot.tmp_ptr, len);
}
else {
_lv_memcpy(ext->dot.tmp, copy_ext->dot.tmp, sizeof(ext->dot.tmp));
}
ext->dot_tmp_alloc = copy_ext->dot_tmp_alloc;
ext->dot_end = copy_ext->dot_end;
/*Refresh the style with new signal function*/
lv_obj_refresh_style(new_label, LV_STYLE_PROP_ALL);
}
LV_LOG_INFO("label created");
return new_label;
}
/*=====================
* Setter functions
*====================*/
/**
* Set a new text for a label. Memory will be allocated to store the text by the label.
* @param label pointer to a label object
* @param text '\0' terminated character string. NULL to refresh with the current text.
*/
void lv_label_set_text(lv_obj_t * label, const char * text)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
lv_obj_invalidate(label);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
/*If text is NULL then refresh */
if(text == NULL) {
lv_label_refr_text(label);
return;
}
LV_ASSERT_STR(text);
if(ext->text == text && ext->static_txt == 0) {
/*If set its own text then reallocate it (maybe its size changed)*/
#if LV_USE_ARABIC_PERSIAN_CHARS
/*Get the size of the text and process it*/
size_t len = _lv_txt_ap_calc_bytes_cnt(text);
ext->text = lv_mem_realloc(ext->text, len);
LV_ASSERT_MEM(ext->text);
if(ext->text == NULL) return;
_lv_txt_ap_proc(ext->text, ext->text);
#else
ext->text = lv_mem_realloc(ext->text, strlen(ext->text) + 1);
#endif
LV_ASSERT_MEM(ext->text);
if(ext->text == NULL) return;
}
else {
/*Free the old text*/
if(ext->text != NULL && ext->static_txt == 0) {
lv_mem_free(ext->text);
ext->text = NULL;
}
#if LV_USE_ARABIC_PERSIAN_CHARS
/*Get the size of the text and process it*/
size_t len = _lv_txt_ap_calc_bytes_cnt(text);
ext->text = lv_mem_alloc(len);
LV_ASSERT_MEM(ext->text);
if(ext->text == NULL) return;
_lv_txt_ap_proc(text, ext->text);
#else
/*Get the size of the text*/
size_t len = strlen(text) + 1;
/*Allocate space for the new text*/
ext->text = lv_mem_alloc(len);
LV_ASSERT_MEM(ext->text);
if(ext->text == NULL) return;
strcpy(ext->text, text);
#endif
/*Now the text is dynamically allocated*/
ext->static_txt = 0;
}
lv_label_refr_text(label);
}
/**
* Set a new formatted text for a label. Memory will be allocated to store the text by the label.
* @param label pointer to a label object
* @param fmt `printf`-like format
*/
void lv_label_set_text_fmt(lv_obj_t * label, const char * fmt, ...)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
LV_ASSERT_STR(fmt);
lv_obj_invalidate(label);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
/*If text is NULL then refresh */
if(fmt == NULL) {
lv_label_refr_text(label);
return;
}
if(ext->text != NULL && ext->static_txt == 0) {
lv_mem_free(ext->text);
ext->text = NULL;
}
va_list ap, ap2;
va_start(ap, fmt);
va_copy(ap2, ap);
/*Allocate space for the new text by using trick from C99 standard section 7.19.6.12 */
uint32_t len = lv_vsnprintf(NULL, 0, fmt, ap);
va_end(ap);
#if LV_USE_ARABIC_PERSIAN_CHARS
/*Put together the text according to the format string*/
char * raw_txt = _lv_mem_buf_get(len + 1);
LV_ASSERT_MEM(raw_txt);
if(raw_txt == NULL) {
va_end(ap2);
return;
}
lv_vsnprintf(raw_txt, len + 1, fmt, ap2);
/*Get the size of the Arabic text and process it*/
size_t len_ap = _lv_txt_ap_calc_bytes_cnt(raw_txt);
ext->text = lv_mem_alloc(len_ap + 1);
LV_ASSERT_MEM(ext->text);
if(ext->text == NULL) {
va_end(ap2);
return;
}
_lv_txt_ap_proc(raw_txt, ext->text);
_lv_mem_buf_release(raw_txt);
#else
ext->text = lv_mem_alloc(len + 1);
LV_ASSERT_MEM(ext->text);
if(ext->text == NULL) {
va_end(ap2);
return;
}
ext->text[len - 1] = 0; /* Ensure NULL termination */
lv_vsnprintf(ext->text, len + 1, fmt, ap2);
#endif
va_end(ap2);
ext->static_txt = 0; /*Now the text is dynamically allocated*/
lv_label_refr_text(label);
}
/**
* Set a static text. It will not be saved by the label so the 'text' variable
* has to be 'alive' while the label exist.
* @param label pointer to a label object
* @param text pointer to a text. NULL to refresh with the current text.
*/
void lv_label_set_text_static(lv_obj_t * label, const char * text)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
if(ext->static_txt == 0 && ext->text != NULL) {
lv_mem_free(ext->text);
ext->text = NULL;
}
if(text != NULL) {
ext->static_txt = 1;
ext->text = (char *)text;
}
lv_label_refr_text(label);
}
/**
* Set the behavior of the label with longer text then the object size
* @param label pointer to a label object
* @param long_mode the new mode from 'lv_label_long_mode' enum.
* In LV_LONG_BREAK/LONG/ROLL the size of the label should be set AFTER this
* function
*/
void lv_label_set_long_mode(lv_obj_t * label, lv_label_long_mode_t long_mode)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
#if LV_USE_ANIMATION
/*Delete the old animation (if exists)*/
lv_anim_del(label, (lv_anim_exec_xcb_t)lv_obj_set_x);
lv_anim_del(label, (lv_anim_exec_xcb_t)lv_obj_set_y);
lv_anim_del(label, (lv_anim_exec_xcb_t)lv_label_set_offset_x);
lv_anim_del(label, (lv_anim_exec_xcb_t)lv_label_set_offset_y);
#endif
ext->offset.x = 0;
ext->offset.y = 0;
if(long_mode == LV_LABEL_LONG_SROLL || long_mode == LV_LABEL_LONG_SROLL_CIRC || long_mode == LV_LABEL_LONG_CROP)
ext->expand = 1;
else
ext->expand = 0;
/*Restore the character under the dots*/
if(ext->long_mode == LV_LABEL_LONG_DOT && ext->dot_end != LV_LABEL_DOT_END_INV) {
lv_label_revert_dots(label);
}
ext->long_mode = long_mode;
lv_label_refr_text(label);
}
/**
* Set the align of the label (left or center)
* @param label pointer to a label object
* @param align 'LV_LABEL_ALIGN_LEFT' or 'LV_LABEL_ALIGN_LEFT'
*/
void lv_label_set_align(lv_obj_t * label, lv_label_align_t align)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
if(ext->align == align) return;
ext->align = align;
lv_obj_invalidate(label); /*Enough to invalidate because alignment is only drawing related
(lv_refr_label_text() not required)*/
}
/**
* Enable the recoloring by in-line commands
* @param label pointer to a label object
* @param en true: enable recoloring, false: disable
*/
void lv_label_set_recolor(lv_obj_t * label, bool en)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
if(ext->recolor == en) return;
ext->recolor = en == false ? 0 : 1;
lv_label_refr_text(label); /*Refresh the text because the potential color codes in text needs to
be hided or revealed*/
}
/**
* Set the label's animation speed in LV_LABEL_LONG_SROLL/SCROLL_CIRC modes
* @param label pointer to a label object
* @param anim_speed speed of animation in px/sec unit
*/
void lv_label_set_anim_speed(lv_obj_t * label, uint16_t anim_speed)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
#if LV_USE_ANIMATION
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
if(ext->anim_speed == anim_speed) return;
ext->anim_speed = anim_speed;
if(ext->long_mode == LV_LABEL_LONG_SROLL || ext->long_mode == LV_LABEL_LONG_SROLL_CIRC) {
lv_label_refr_text(label);
}
#else
(void)label; /*Unused*/
(void)anim_speed; /*Unused*/
#endif
}
void lv_label_set_text_sel_start(lv_obj_t * label, uint32_t index)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
#if LV_LABEL_TEXT_SEL
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
ext->sel_start = index;
lv_obj_invalidate(label);
#else
(void)label; /*Unused*/
(void)index; /*Unused*/
#endif
}
void lv_label_set_text_sel_end(lv_obj_t * label, uint32_t index)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
#if LV_LABEL_TEXT_SEL
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
ext->sel_end = index;
lv_obj_invalidate(label);
#else
(void)label; /*Unused*/
(void)index; /*Unused*/
#endif
}
/*=====================
* Getter functions
*====================*/
/**
* Get the text of a label
* @param label pointer to a label object
* @return the text of the label
*/
char * lv_label_get_text(const lv_obj_t * label)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
return ext->text;
}
/**
* Get the long mode of a label
* @param label pointer to a label object
* @return the long mode
*/
lv_label_long_mode_t lv_label_get_long_mode(const lv_obj_t * label)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
return ext->long_mode;
}
/**
* Get the align attribute
* @param label pointer to a label object
* @return LV_LABEL_ALIGN_LEFT or LV_LABEL_ALIGN_CENTER
*/
lv_label_align_t lv_label_get_align(const lv_obj_t * label)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
lv_label_align_t align = ext->align;
if(align == LV_LABEL_ALIGN_AUTO) {
#if LV_USE_BIDI
lv_bidi_dir_t base_dir = lv_obj_get_base_dir(label);
if(base_dir == LV_BIDI_DIR_AUTO) base_dir = _lv_bidi_detect_base_dir(ext->text);
if(base_dir == LV_BIDI_DIR_LTR) align = LV_LABEL_ALIGN_LEFT;
else if(base_dir == LV_BIDI_DIR_RTL) align = LV_LABEL_ALIGN_RIGHT;
#else
align = LV_LABEL_ALIGN_LEFT;
#endif
}
return align;
}
/**
* Get the recoloring attribute
* @param label pointer to a label object
* @return true: recoloring is enabled, false: disable
*/
bool lv_label_get_recolor(const lv_obj_t * label)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
return ext->recolor == 0 ? false : true;
}
/**
* Get the label's animation speed in LV_LABEL_LONG_ROLL and SCROLL modes
* @param label pointer to a label object
* @return speed of animation in px/sec unit
*/
uint16_t lv_label_get_anim_speed(const lv_obj_t * label)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
#if LV_USE_ANIMATION
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
return ext->anim_speed;
#else
(void)label; /*Unused*/
return 0;
#endif
}
/**
* Get the relative x and y coordinates of a letter
* @param label pointer to a label object
* @param index index of the letter [0 ... text length]. Expressed in character index, not byte
* index (different in UTF-8)
* @param pos store the result here (E.g. index = 0 gives 0;0 coordinates)
*/
void lv_label_get_letter_pos(const lv_obj_t * label, uint32_t char_id, lv_point_t * pos)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
LV_ASSERT_NULL(pos);
const char * txt = lv_label_get_text(label);
lv_label_align_t align = lv_label_get_align(label);
if(txt[0] == '\0') {
pos->y = 0;
switch(align) {
case LV_LABEL_ALIGN_LEFT:
pos->x = 0;
break;
case LV_LABEL_ALIGN_RIGHT:
pos->x = lv_obj_get_width(label);
break;
case LV_LABEL_ALIGN_CENTER:
pos->x = lv_obj_get_width(label) / 2;
break;
}
return;
}
lv_area_t txt_coords;
get_txt_coords(label, &txt_coords);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
uint32_t line_start = 0;
uint32_t new_line_start = 0;
lv_coord_t max_w = lv_area_get_width(&txt_coords);
const lv_font_t * font = lv_obj_get_style_text_font(label, LV_LABEL_PART_MAIN);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(label, LV_LABEL_PART_MAIN);
lv_style_int_t letter_space = lv_obj_get_style_text_letter_space(label, LV_LABEL_PART_MAIN);
lv_coord_t letter_height = lv_font_get_line_height(font);
lv_coord_t y = 0;
lv_txt_flag_t flag = LV_TXT_FLAG_NONE;
if(ext->recolor != 0) flag |= LV_TXT_FLAG_RECOLOR;
if(ext->expand != 0) flag |= LV_TXT_FLAG_EXPAND;
if(ext->long_mode == LV_LABEL_LONG_EXPAND) flag |= LV_TXT_FLAG_FIT;
if(align == LV_LABEL_ALIGN_CENTER) flag |= LV_TXT_FLAG_CENTER;
if(align == LV_LABEL_ALIGN_RIGHT) flag |= LV_TXT_FLAG_RIGHT;
uint32_t byte_id = _lv_txt_encoded_get_byte_id(txt, char_id);
/*Search the line of the index letter */;
while(txt[new_line_start] != '\0') {
new_line_start += _lv_txt_get_next_line(&txt[line_start], font, letter_space, max_w, flag);
if(byte_id < new_line_start || txt[new_line_start] == '\0')
break; /*The line of 'index' letter begins at 'line_start'*/
y += letter_height + line_space;
line_start = new_line_start;
}
/*If the last character is line break then go to the next line*/
if(byte_id > 0) {
if((txt[byte_id - 1] == '\n' || txt[byte_id - 1] == '\r') && txt[byte_id] == '\0') {
y += letter_height + line_space;
line_start = byte_id;
}
}
const char * bidi_txt;
uint32_t visual_byte_pos;
#if LV_USE_BIDI
char * mutable_bidi_txt = NULL;
/*Handle Bidi*/
if(new_line_start == byte_id) {
visual_byte_pos = byte_id - line_start;
bidi_txt = &txt[line_start];
}
else {
uint32_t line_char_id = _lv_txt_encoded_get_char_id(&txt[line_start], byte_id - line_start);
bool is_rtl;
uint32_t visual_char_pos = _lv_bidi_get_visual_pos(&txt[line_start], &mutable_bidi_txt, new_line_start - line_start,
lv_obj_get_base_dir(label), line_char_id, &is_rtl);
bidi_txt = mutable_bidi_txt;
if(is_rtl) visual_char_pos++;
visual_byte_pos = _lv_txt_encoded_get_byte_id(bidi_txt, visual_char_pos);
}
#else
bidi_txt = &txt[line_start];
visual_byte_pos = byte_id - line_start;
#endif
/*Calculate the x coordinate*/
lv_coord_t x = _lv_txt_get_width(bidi_txt, visual_byte_pos, font, letter_space, flag);
if(char_id != line_start) x += letter_space;
if(align == LV_LABEL_ALIGN_CENTER) {
lv_coord_t line_w;
line_w = _lv_txt_get_width(bidi_txt, new_line_start - line_start, font, letter_space, flag);
x += lv_area_get_width(&txt_coords) / 2 - line_w / 2;
}
else if(align == LV_LABEL_ALIGN_RIGHT) {
lv_coord_t line_w;
line_w = _lv_txt_get_width(bidi_txt, new_line_start - line_start, font, letter_space, flag);
x += lv_area_get_width(&txt_coords) - line_w;
}
pos->x = x;
pos->y = y;
#if LV_USE_BIDI
if(mutable_bidi_txt) _lv_mem_buf_release(mutable_bidi_txt);
#endif
}
/**
* Get the index of letter on a relative point of a label
* @param label pointer to label object
* @param pos pointer to point with coordinates on a the label
* @return the index of the letter on the 'pos_p' point (E.g. on 0;0 is the 0. letter)
* Expressed in character index and not byte index (different in UTF-8)
*/
uint32_t lv_label_get_letter_on(const lv_obj_t * label, lv_point_t * pos)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
LV_ASSERT_NULL(pos);
lv_area_t txt_coords;
get_txt_coords(label, &txt_coords);
const char * txt = lv_label_get_text(label);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
uint32_t line_start = 0;
uint32_t new_line_start = 0;
lv_coord_t max_w = lv_area_get_width(&txt_coords);
const lv_font_t * font = lv_obj_get_style_text_font(label, LV_LABEL_PART_MAIN);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(label, LV_LABEL_PART_MAIN);
lv_style_int_t letter_space = lv_obj_get_style_text_letter_space(label, LV_LABEL_PART_MAIN);
lv_coord_t letter_height = lv_font_get_line_height(font);
lv_coord_t y = 0;
lv_txt_flag_t flag = LV_TXT_FLAG_NONE;
uint32_t logical_pos;
char * bidi_txt;
if(ext->recolor != 0) flag |= LV_TXT_FLAG_RECOLOR;
if(ext->expand != 0) flag |= LV_TXT_FLAG_EXPAND;
if(ext->long_mode == LV_LABEL_LONG_EXPAND) flag |= LV_TXT_FLAG_FIT;
lv_label_align_t align = lv_label_get_align(label);
if(align == LV_LABEL_ALIGN_CENTER) flag |= LV_TXT_FLAG_CENTER;
if(align == LV_LABEL_ALIGN_RIGHT) flag |= LV_TXT_FLAG_RIGHT;
/*Search the line of the index letter */;
while(txt[line_start] != '\0') {
new_line_start += _lv_txt_get_next_line(&txt[line_start], font, letter_space, max_w, flag);
if(pos->y <= y + letter_height) {
/*The line is found (stored in 'line_start')*/
/* Include the NULL terminator in the last line */
uint32_t tmp = new_line_start;
uint32_t letter;
letter = _lv_txt_encoded_prev(txt, &tmp);
if(letter != '\n' && txt[new_line_start] == '\0') new_line_start++;
break;
}
y += letter_height + line_space;
line_start = new_line_start;
}
#if LV_USE_BIDI
bidi_txt = _lv_mem_buf_get(new_line_start - line_start + 1);
uint32_t txt_len = new_line_start - line_start;
if(new_line_start > 0 && txt[new_line_start - 1] == '\0' && txt_len > 0) txt_len--;
_lv_bidi_process_paragraph(txt + line_start, bidi_txt, txt_len, lv_obj_get_base_dir(label), NULL, 0);
#else
bidi_txt = (char *)txt + line_start;
#endif
/*Calculate the x coordinate*/
lv_coord_t x = 0;
if(align == LV_LABEL_ALIGN_CENTER) {
lv_coord_t line_w;
line_w = _lv_txt_get_width(bidi_txt, new_line_start - line_start, font, letter_space, flag);
x += lv_area_get_width(&txt_coords) / 2 - line_w / 2;
}
else if(align == LV_LABEL_ALIGN_RIGHT) {
lv_coord_t line_w;
line_w = _lv_txt_get_width(bidi_txt, new_line_start - line_start, font, letter_space, flag);
x += lv_area_get_width(&txt_coords) - line_w;
}
lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT;
uint32_t i = 0;
uint32_t i_act = i;
if(new_line_start > 0) {
while(i + line_start < new_line_start) {
/* Get the current letter.*/
uint32_t letter = _lv_txt_encoded_next(bidi_txt, &i);
/*Get the next letter too for kerning*/
uint32_t letter_next = _lv_txt_encoded_next(&bidi_txt[i], NULL);
/*Handle the recolor command*/
if((flag & LV_TXT_FLAG_RECOLOR) != 0) {
if(_lv_txt_is_cmd(&cmd_state, bidi_txt[i]) != false) {
continue; /*Skip the letter is it is part of a command*/
}
}
lv_coord_t gw = lv_font_get_glyph_width(font, letter, letter_next);
/*Finish if the x position or the last char of the next line is reached*/
if(pos->x < x + (gw >> 1) || i + line_start == new_line_start || txt[i_act + line_start] == '\0') {
i = i_act;
break;
}
x += gw;
x += letter_space;
i_act = i;
}
}
#if LV_USE_BIDI
/*Handle Bidi*/
uint32_t cid = _lv_txt_encoded_get_char_id(bidi_txt, i);
if(txt[line_start + cid] == '\0') {
logical_pos = i;
}
else {
bool is_rtl;
logical_pos = _lv_bidi_get_logical_pos(&txt[line_start], NULL,
txt_len, lv_obj_get_base_dir(label), cid, &is_rtl);
if(is_rtl) logical_pos++;
_lv_mem_buf_release(bidi_txt);
}
#else
logical_pos = _lv_txt_encoded_get_char_id(bidi_txt, i);
#endif
return logical_pos + _lv_txt_encoded_get_char_id(txt, line_start);
}
/**
* @brief Get the selection start index.
* @param label pointer to a label object.
* @return selection start index. `LV_LABEL_TXT_SEL_OFF` if nothing is selected.
*/
uint32_t lv_label_get_text_sel_start(const lv_obj_t * label)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
#if LV_LABEL_TEXT_SEL
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
return ext->sel_start;
#else
(void)label; /*Unused*/
return LV_LABEL_TEXT_SEL_OFF;
#endif
}
/**
* @brief Get the selection end index.
* @param label pointer to a label object.
* @return selection end index. `LV_LABEL_TXT_SEL_OFF` if nothing is selected.
*/
uint32_t lv_label_get_text_sel_end(const lv_obj_t * label)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
#if LV_LABEL_TEXT_SEL
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
return ext->sel_end;
#else
(void)label; /*Unused*/
return LV_LABEL_TEXT_SEL_OFF;
#endif
}
/**
* Check if a character is drawn under a point.
* @param label Label object
* @param pos Point to check for character under
* @return whether a character is drawn under the point
*/
bool lv_label_is_char_under_pos(const lv_obj_t * label, lv_point_t * pos)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
LV_ASSERT_NULL(pos);
lv_area_t txt_coords;
get_txt_coords(label, &txt_coords);
const char * txt = lv_label_get_text(label);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
uint32_t line_start = 0;
uint32_t new_line_start = 0;
lv_coord_t max_w = lv_area_get_width(&txt_coords);
const lv_font_t * font = lv_obj_get_style_text_font(label, LV_LABEL_PART_MAIN);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(label, LV_LABEL_PART_MAIN);
lv_style_int_t letter_space = lv_obj_get_style_text_letter_space(label, LV_LABEL_PART_MAIN);
lv_coord_t letter_height = lv_font_get_line_height(font);
lv_coord_t y = 0;
lv_txt_flag_t flag = LV_TXT_FLAG_NONE;
lv_label_align_t align = lv_label_get_align(label);
if(ext->recolor != 0) flag |= LV_TXT_FLAG_RECOLOR;
if(ext->expand != 0) flag |= LV_TXT_FLAG_EXPAND;
if(ext->long_mode == LV_LABEL_LONG_EXPAND) flag |= LV_TXT_FLAG_FIT;
if(align == LV_LABEL_ALIGN_CENTER) flag |= LV_TXT_FLAG_CENTER;
/*Search the line of the index letter */;
while(txt[line_start] != '\0') {
new_line_start += _lv_txt_get_next_line(&txt[line_start], font, letter_space, max_w, flag);
if(pos->y <= y + letter_height) break; /*The line is found (stored in 'line_start')*/
y += letter_height + line_space;
line_start = new_line_start;
}
/*Calculate the x coordinate*/
lv_coord_t x = 0;
lv_coord_t last_x = 0;
if(align == LV_LABEL_ALIGN_CENTER) {
lv_coord_t line_w;
line_w = _lv_txt_get_width(&txt[line_start], new_line_start - line_start, font, letter_space, flag);
x += lv_area_get_width(&txt_coords) / 2 - line_w / 2;
}
else if(align == LV_LABEL_ALIGN_RIGHT) {
lv_coord_t line_w;
line_w = _lv_txt_get_width(&txt[line_start], new_line_start - line_start, font, letter_space, flag);
x += lv_area_get_width(&txt_coords) - line_w;
}
lv_txt_cmd_state_t cmd_state = LV_TXT_CMD_STATE_WAIT;
uint32_t i = line_start;
uint32_t i_current = i;
uint32_t letter = '\0';
uint32_t letter_next = '\0';
if(new_line_start > 0) {
while(i <= new_line_start - 1) {
/* Get the current letter
* Be careful 'i' already points to the next character */
letter = _lv_txt_encoded_next(txt, &i);
/*Get the next letter for kerning*/
letter_next = _lv_txt_encoded_next(&txt[i], NULL);
/*Handle the recolor command*/
if((flag & LV_TXT_FLAG_RECOLOR) != 0) {
if(_lv_txt_is_cmd(&cmd_state, txt[i]) != false) {
continue; /*Skip the letter is it is part of a command*/
}
}
last_x = x;
x += lv_font_get_glyph_width(font, letter, letter_next);
if(pos->x < x) {
i = i_current;
break;
}
x += letter_space;
i_current = i;
}
}
int32_t max_diff = lv_font_get_glyph_width(font, letter, letter_next) + letter_space + 1;
return (pos->x >= (last_x - letter_space) && pos->x <= (last_x + max_diff));
}
lv_style_list_t * lv_label_get_style(lv_obj_t * label, uint8_t type)
{
lv_style_list_t * style_dsc_p;
switch(type) {
case LV_LABEL_PART_MAIN:
style_dsc_p = &label->style_list;
break;
default:
style_dsc_p = NULL;
}
return style_dsc_p;
}
/*=====================
* Other functions
*====================*/
/**
* Insert a text to the label. The label text can not be static.
* @param label pointer to a label object
* @param pos character index to insert. Expressed in character index and not byte index (Different
* in UTF-8) 0: before first char. LV_LABEL_POS_LAST: after last char.
* @param txt pointer to the text to insert
*/
void lv_label_ins_text(lv_obj_t * label, uint32_t pos, const char * txt)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
LV_ASSERT_STR(txt);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
/*Can not append to static text*/
if(ext->static_txt != 0) return;
lv_obj_invalidate(label);
/*Allocate space for the new text*/
size_t old_len = strlen(ext->text);
size_t ins_len = strlen(txt);
size_t new_len = ins_len + old_len;
ext->text = lv_mem_realloc(ext->text, new_len + 1);
LV_ASSERT_MEM(ext->text);
if(ext->text == NULL) return;
if(pos == LV_LABEL_POS_LAST) {
pos = _lv_txt_get_encoded_length(ext->text);
}
#if LV_USE_BIDI
char * bidi_buf = _lv_mem_buf_get(ins_len + 1);
LV_ASSERT_MEM(bidi_buf);
if(bidi_buf == NULL) return;
_lv_bidi_process(txt, bidi_buf, lv_obj_get_base_dir(label));
_lv_txt_ins(ext->text, pos, bidi_buf);
_lv_mem_buf_release(bidi_buf);
#else
_lv_txt_ins(ext->text, pos, txt);
#endif
lv_label_refr_text(label);
}
/**
* Delete characters from a label. The label text can not be static.
* @param label pointer to a label object
* @param pos character index to insert. Expressed in character index and not byte index (Different
* in UTF-8) 0: before first char.
* @param cnt number of characters to cut
*/
void lv_label_cut_text(lv_obj_t * label, uint32_t pos, uint32_t cnt)
{
LV_ASSERT_OBJ(label, LV_OBJX_NAME);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
/*Can not append to static text*/
if(ext->static_txt != 0) return;
lv_obj_invalidate(label);
char * label_txt = lv_label_get_text(label);
/*Delete the characters*/
_lv_txt_cut(label_txt, pos, cnt);
/*Refresh the label*/
lv_label_refr_text(label);
}
/**********************
* STATIC FUNCTIONS
**********************/
/**
* Handle the drawing related tasks of the labels
* @param label pointer to a label object
* @param clip_area the object will be drawn only in this area
* @param mode LV_DESIGN_COVER_CHK: only check if the object fully covers the 'mask_p' area
* (return 'true' if yes)
* LV_DESIGN_DRAW: draw the object (always return 'true')
* LV_DESIGN_DRAW_POST: drawing after every children are drawn
* @param return an element of `lv_design_res_t`
*/
static lv_design_res_t lv_label_design(lv_obj_t * label, const lv_area_t * clip_area, lv_design_mode_t mode)
{
/* A label never covers an area */
if(mode == LV_DESIGN_COVER_CHK)
return LV_DESIGN_RES_NOT_COVER;
else if(mode == LV_DESIGN_DRAW_MAIN) {
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
lv_coord_t w = lv_obj_get_style_transform_width(label, LV_LABEL_PART_MAIN);
lv_coord_t h = lv_obj_get_style_transform_height(label, LV_LABEL_PART_MAIN);
lv_area_t bg_coords;
lv_area_copy(&bg_coords, &label->coords);
bg_coords.x1 -= w;
bg_coords.x2 += w;
bg_coords.y1 -= h;
bg_coords.y2 += h;
lv_draw_rect_dsc_t draw_rect_dsc;
lv_draw_rect_dsc_init(&draw_rect_dsc);
lv_obj_init_draw_rect_dsc(label, LV_LABEL_PART_MAIN, &draw_rect_dsc);
lv_draw_rect(&bg_coords, clip_area, &draw_rect_dsc);
lv_area_t txt_coords;
get_txt_coords(label, &txt_coords);
lv_area_t txt_clip;
bool is_common = _lv_area_intersect(&txt_clip, clip_area, &txt_coords);
if(!is_common) return LV_DESIGN_RES_OK;
lv_label_align_t align = lv_label_get_align(label);
lv_txt_flag_t flag = LV_TXT_FLAG_NONE;
if(ext->recolor != 0) flag |= LV_TXT_FLAG_RECOLOR;
if(ext->expand != 0) flag |= LV_TXT_FLAG_EXPAND;
if(ext->long_mode == LV_LABEL_LONG_EXPAND) flag |= LV_TXT_FLAG_FIT;
if(align == LV_LABEL_ALIGN_CENTER) flag |= LV_TXT_FLAG_CENTER;
if(align == LV_LABEL_ALIGN_RIGHT) flag |= LV_TXT_FLAG_RIGHT;
lv_draw_label_dsc_t label_draw_dsc;
lv_draw_label_dsc_init(&label_draw_dsc);
label_draw_dsc.sel_start = lv_label_get_text_sel_start(label);
label_draw_dsc.sel_end = lv_label_get_text_sel_end(label);
label_draw_dsc.ofs_x = ext->offset.x;
label_draw_dsc.ofs_y = ext->offset.y;
label_draw_dsc.flag = flag;
lv_obj_init_draw_label_dsc(label, LV_LABEL_PART_MAIN, &label_draw_dsc);
/* In SCROLL and SCROLL_CIRC mode the CENTER and RIGHT are pointless so remove them.
* (In addition they will result misalignment is this case)*/
if((ext->long_mode == LV_LABEL_LONG_SROLL || ext->long_mode == LV_LABEL_LONG_SROLL_CIRC) &&
(ext->align == LV_LABEL_ALIGN_CENTER || ext->align == LV_LABEL_ALIGN_RIGHT)) {
lv_point_t size;
_lv_txt_get_size(&size, ext->text, label_draw_dsc.font, label_draw_dsc.letter_space, label_draw_dsc.line_space,
LV_COORD_MAX, flag);
if(size.x > lv_area_get_width(&txt_coords)) {
label_draw_dsc.flag &= ~LV_TXT_FLAG_RIGHT;
label_draw_dsc.flag &= ~LV_TXT_FLAG_CENTER;
}
}
#if LV_LABEL_LONG_TXT_HINT
lv_draw_label_hint_t * hint = &ext->hint;
if(ext->long_mode == LV_LABEL_LONG_SROLL_CIRC || lv_area_get_height(&txt_coords) < LV_LABEL_HINT_HEIGHT_LIMIT)
hint = NULL;
#else
/*Just for compatibility*/
lv_draw_label_hint_t * hint = NULL;
#endif
lv_draw_label(&txt_coords, &txt_clip, &label_draw_dsc, ext->text, hint);
if(ext->long_mode == LV_LABEL_LONG_SROLL_CIRC) {
lv_point_t size;
_lv_txt_get_size(&size, ext->text, label_draw_dsc.font, label_draw_dsc.letter_space, label_draw_dsc.line_space,
LV_COORD_MAX, flag);
/*Draw the text again next to the original to make an circular effect */
if(size.x > lv_area_get_width(&txt_coords)) {
label_draw_dsc.ofs_x = ext->offset.x + size.x +
lv_font_get_glyph_width(label_draw_dsc.font, ' ', ' ') * LV_LABEL_WAIT_CHAR_COUNT;
label_draw_dsc.ofs_y = ext->offset.y;
lv_draw_label(&txt_coords, &txt_clip, &label_draw_dsc, ext->text, hint);
}
/*Draw the text again below the original to make an circular effect */
if(size.y > lv_area_get_height(&txt_coords)) {
label_draw_dsc.ofs_x = ext->offset.x;
label_draw_dsc.ofs_y = ext->offset.y + size.y + lv_font_get_line_height(label_draw_dsc.font);
lv_draw_label(&txt_coords, &txt_clip, &label_draw_dsc, ext->text, hint);
}
}
}
return LV_DESIGN_RES_OK;
}
/**
* Signal function of the label
* @param label pointer to a label object
* @param sign a signal type from lv_signal_t enum
* @param param pointer to a signal specific variable
* @return LV_RES_OK: the object is not deleted in the function; LV_RES_INV: the object is deleted
*/
static lv_res_t lv_label_signal(lv_obj_t * label, lv_signal_t sign, void * param)
{
lv_res_t res;
if(sign == LV_SIGNAL_GET_STYLE) {
lv_get_style_info_t * info = param;
info->result = lv_label_get_style(label, info->part);
if(info->result != NULL) return LV_RES_OK;
else return ancestor_signal(label, sign, param);
}
/* Include the ancient signal function */
res = ancestor_signal(label, sign, param);
if(res != LV_RES_OK) return res;
if(sign == LV_SIGNAL_GET_TYPE) return lv_obj_handle_get_type_signal(param, LV_OBJX_NAME);
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
if(sign == LV_SIGNAL_CLEANUP) {
if(ext->static_txt == 0) {
lv_mem_free(ext->text);
ext->text = NULL;
}
lv_label_dot_tmp_free(label);
}
else if(sign == LV_SIGNAL_STYLE_CHG) {
/*Revert dots for proper refresh*/
lv_label_revert_dots(label);
lv_label_refr_text(label);
}
else if(sign == LV_SIGNAL_COORD_CHG) {
if(lv_area_get_width(&label->coords) != lv_area_get_width(param) ||
lv_area_get_height(&label->coords) != lv_area_get_height(param)) {
lv_label_revert_dots(label);
lv_label_refr_text(label);
}
}
else if(sign == LV_SIGNAL_BASE_DIR_CHG) {
#if LV_USE_BIDI
if(ext->static_txt == 0) lv_label_set_text(label, NULL);
#endif
}
else if(sign == LV_SIGNAL_GET_TYPE) {
lv_obj_type_t * buf = param;
uint8_t i;
for(i = 0; i < LV_MAX_ANCESTOR_NUM - 1; i++) { /*Find the last set data*/
if(buf->type[i] == NULL) break;
}
buf->type[i] = "lv_label";
}
return res;
}
/**
* Refresh the label with its text stored in its extended data
* @param label pointer to a label object
*/
static void lv_label_refr_text(lv_obj_t * label)
{
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
if(ext->text == NULL) return;
#if LV_LABEL_LONG_TXT_HINT
ext->hint.line_start = -1; /*The hint is invalid if the text changes*/
#endif
lv_area_t txt_coords;
get_txt_coords(label, &txt_coords);
lv_coord_t max_w = lv_area_get_width(&txt_coords);
const lv_font_t * font = lv_obj_get_style_text_font(label, LV_LABEL_PART_MAIN);
lv_style_int_t line_space = lv_obj_get_style_text_line_space(label, LV_LABEL_PART_MAIN);
lv_style_int_t letter_space = lv_obj_get_style_text_letter_space(label, LV_LABEL_PART_MAIN);
/*Calc. the height and longest line*/
lv_point_t size;
lv_txt_flag_t flag = LV_TXT_FLAG_NONE;
if(ext->recolor != 0) flag |= LV_TXT_FLAG_RECOLOR;
if(ext->expand != 0) flag |= LV_TXT_FLAG_EXPAND;
if(ext->long_mode == LV_LABEL_LONG_EXPAND) flag |= LV_TXT_FLAG_FIT;
_lv_txt_get_size(&size, ext->text, font, letter_space, line_space, max_w, flag);
/*Set the full size in expand mode*/
if(ext->long_mode == LV_LABEL_LONG_EXPAND) {
size.x += lv_obj_get_style_pad_left(label, LV_LABEL_PART_MAIN) + lv_obj_get_style_pad_right(label, LV_LABEL_PART_MAIN);
size.y += lv_obj_get_style_pad_top(label, LV_LABEL_PART_MAIN) + lv_obj_get_style_pad_bottom(label, LV_LABEL_PART_MAIN);
lv_obj_set_size(label, size.x, size.y);
}
/*In roll mode keep the size but start offset animations*/
else if(ext->long_mode == LV_LABEL_LONG_SROLL) {
#if LV_USE_ANIMATION
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, label);
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
lv_anim_set_playback_delay(&a, (((lv_font_get_glyph_width(font, ' ', ' ') + letter_space) * 1000) /
ext->anim_speed) *
LV_LABEL_WAIT_CHAR_COUNT);
lv_anim_set_repeat_delay(&a, a.playback_delay);
bool hor_anim = false;
if(size.x > lv_area_get_width(&txt_coords)) {
lv_anim_set_values(&a, 0, lv_area_get_width(&txt_coords) - size.x);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_label_set_offset_x);
lv_anim_set_time(&a, lv_anim_speed_to_time(ext->anim_speed, a.start, a.end));
lv_anim_set_playback_time(&a, a.time);
lv_anim_t * anim_cur = lv_anim_get(label, (lv_anim_exec_xcb_t)lv_label_set_offset_x);
int32_t act_time = 0;
bool playback_now = false;
if(anim_cur) {
act_time = anim_cur->act_time;
playback_now = anim_cur->playback_now;
}
if(act_time < a.time) {
a.act_time = act_time; /*To keep the old position*/
a.early_apply = 0;
if(playback_now) {
a.playback_now = 1;
/*Swap the start and end values*/
int32_t tmp;
tmp = a.start;
a.start = a.end;
a.end = tmp;
}
}
lv_anim_start(&a);
hor_anim = true;
}
else {
/*Delete the offset animation if not required*/
lv_anim_del(label, (lv_anim_exec_xcb_t)lv_label_set_offset_x);
ext->offset.x = 0;
}
if(size.y > lv_area_get_height(&txt_coords) && hor_anim == false) {
lv_anim_set_values(&a, 0, lv_area_get_height(&txt_coords) - size.y - (lv_font_get_line_height(font)));
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_label_set_offset_y);
lv_anim_set_time(&a, lv_anim_speed_to_time(ext->anim_speed, a.start, a.end));
lv_anim_set_playback_time(&a, a.time);
lv_anim_t * anim_cur = lv_anim_get(label, (lv_anim_exec_xcb_t)lv_label_set_offset_y);
int32_t act_time = 0;
bool playback_now = false;
if(anim_cur) {
act_time = anim_cur->act_time;
playback_now = anim_cur->playback_now;
}
if(act_time < a.time) {
a.act_time = act_time; /*To keep the old position*/
a.early_apply = 0;
if(playback_now) {
a.playback_now = 1;
/*Swap the start and end values*/
int32_t tmp;
tmp = a.start;
a.start = a.end;
a.end = tmp;
}
}
lv_anim_start(&a);
}
else {
/*Delete the offset animation if not required*/
lv_anim_del(label, (lv_anim_exec_xcb_t)lv_label_set_offset_y);
ext->offset.y = 0;
}
#endif
}
/*In roll inf. mode keep the size but start offset animations*/
else if(ext->long_mode == LV_LABEL_LONG_SROLL_CIRC) {
#if LV_USE_ANIMATION
lv_anim_t a;
lv_anim_init(&a);
lv_anim_set_var(&a, label);
lv_anim_set_repeat_count(&a, LV_ANIM_REPEAT_INFINITE);
bool hor_anim = false;
if(size.x > lv_area_get_width(&txt_coords)) {
lv_anim_set_values(&a, 0, -size.x - lv_font_get_glyph_width(font, ' ', ' ') * LV_LABEL_WAIT_CHAR_COUNT);
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_label_set_offset_x);
lv_anim_set_time(&a, lv_anim_speed_to_time(ext->anim_speed, a.start, a.end));
lv_anim_t * anim_cur = lv_anim_get(label, (lv_anim_exec_xcb_t)lv_label_set_offset_x);
int32_t act_time = anim_cur ? anim_cur->act_time : 0;
if(act_time < a.time) {
a.act_time = act_time; /*To keep the old position*/
a.early_apply = 0;
}
lv_anim_start(&a);
hor_anim = true;
}
else {
/*Delete the offset animation if not required*/
lv_anim_del(label, (lv_anim_exec_xcb_t)lv_label_set_offset_x);
ext->offset.x = 0;
}
if(size.y > lv_area_get_height(&txt_coords) && hor_anim == false) {
lv_anim_set_values(&a, 0, -size.y - (lv_font_get_line_height(font)));
lv_anim_set_exec_cb(&a, (lv_anim_exec_xcb_t)lv_label_set_offset_y);
lv_anim_set_time(&a, lv_anim_speed_to_time(ext->anim_speed, a.start, a.end));
lv_anim_t * anim_cur = lv_anim_get(label, (lv_anim_exec_xcb_t)lv_label_set_offset_y);
int32_t act_time = anim_cur ? anim_cur->act_time : 0;
if(act_time < a.time) {
a.act_time = act_time; /*To keep the old position*/
a.early_apply = 0;
}
lv_anim_start(&a);
}
else {
/*Delete the offset animation if not required*/
lv_anim_del(label, (lv_anim_exec_xcb_t)lv_label_set_offset_y);
ext->offset.y = 0;
}
#endif
}
else if(ext->long_mode == LV_LABEL_LONG_DOT) {
if(size.y <= lv_area_get_height(&txt_coords)) { /*No dots are required, the text is short enough*/
ext->dot_end = LV_LABEL_DOT_END_INV;
}
else if(_lv_txt_get_encoded_length(ext->text) <= LV_LABEL_DOT_NUM) { /*Don't turn to dots all the characters*/
ext->dot_end = LV_LABEL_DOT_END_INV;
}
else {
lv_point_t p;
p.x = lv_area_get_width(&txt_coords) -
(lv_font_get_glyph_width(font, '.', '.') + letter_space) *
LV_LABEL_DOT_NUM; /*Shrink with dots*/
p.y = lv_area_get_height(&txt_coords);
p.y -= p.y %
(lv_font_get_line_height(font) + line_space); /*Round down to the last line*/
p.y -= line_space; /*Trim the last line space*/
uint32_t letter_id = lv_label_get_letter_on(label, &p);
/*Be sure there is space for the dots*/
size_t txt_len = strlen(ext->text);
uint32_t byte_id = _lv_txt_encoded_get_byte_id(ext->text, letter_id);
while(byte_id + LV_LABEL_DOT_NUM > txt_len) {
byte_id -= _lv_txt_encoded_size(&ext->text[byte_id]);
letter_id--;
}
/*Save letters under the dots and replace them with dots*/
uint32_t byte_id_ori = byte_id;
uint32_t i;
uint8_t len = 0;
for(i = 0; i <= LV_LABEL_DOT_NUM; i++) {
len += _lv_txt_encoded_size(&ext->text[byte_id]);
_lv_txt_encoded_next(ext->text, &byte_id);
}
if(lv_label_set_dot_tmp(label, &ext->text[byte_id_ori], len)) {
for(i = 0; i < LV_LABEL_DOT_NUM; i++) {
ext->text[byte_id_ori + i] = '.';
}
ext->text[byte_id_ori + LV_LABEL_DOT_NUM] = '\0';
ext->dot_end = letter_id + LV_LABEL_DOT_NUM;
}
}
}
/*In break mode only the height can change*/
else if(ext->long_mode == LV_LABEL_LONG_BREAK) {
size.y += lv_obj_get_style_pad_top(label, LV_LABEL_PART_MAIN) + lv_obj_get_style_pad_bottom(label, LV_LABEL_PART_MAIN);
lv_obj_set_height(label, size.y);
}
/*Do not set the size in Clip mode*/
else if(ext->long_mode == LV_LABEL_LONG_CROP) {
/*Do nothing*/
}
lv_obj_invalidate(label);
}
static void lv_label_revert_dots(lv_obj_t * label)
{
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
if(ext->long_mode != LV_LABEL_LONG_DOT) return;
if(ext->dot_end == LV_LABEL_DOT_END_INV) return;
uint32_t letter_i = ext->dot_end - LV_LABEL_DOT_NUM;
uint32_t byte_i = _lv_txt_encoded_get_byte_id(ext->text, letter_i);
/*Restore the characters*/
uint8_t i = 0;
char * dot_tmp = lv_label_get_dot_tmp(label);
while(ext->text[byte_i + i] != '\0') {
ext->text[byte_i + i] = dot_tmp[i];
i++;
}
ext->text[byte_i + i] = dot_tmp[i];
lv_label_dot_tmp_free(label);
ext->dot_end = LV_LABEL_DOT_END_INV;
}
#if LV_USE_ANIMATION
static void lv_label_set_offset_x(lv_obj_t * label, lv_coord_t x)
{
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
ext->offset.x = x;
lv_obj_invalidate(label);
}
static void lv_label_set_offset_y(lv_obj_t * label, lv_coord_t y)
{
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
ext->offset.y = y;
lv_obj_invalidate(label);
}
#endif
/**
* Store `len` characters from `data`. Allocates space if necessary.
*
* @param label pointer to label object
* @param len Number of characters to store.
* @return true on success.
*/
static bool lv_label_set_dot_tmp(lv_obj_t * label, char * data, uint32_t len)
{
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
lv_label_dot_tmp_free(label); /* Deallocate any existing space */
if(len > sizeof(char *)) {
/* Memory needs to be allocated. Allocates an additional byte
* for a NULL-terminator so it can be copied. */
ext->dot.tmp_ptr = lv_mem_alloc(len + 1);
if(ext->dot.tmp_ptr == NULL) {
LV_LOG_ERROR("Failed to allocate memory for dot_tmp_ptr");
return false;
}
_lv_memcpy(ext->dot.tmp_ptr, data, len);
ext->dot.tmp_ptr[len] = '\0';
ext->dot_tmp_alloc = true;
}
else {
/* Characters can be directly stored in object */
ext->dot_tmp_alloc = false;
_lv_memcpy(ext->dot.tmp, data, len);
}
return true;
}
/**
* Get the stored dot_tmp characters
* @param label pointer to label object
* @return char pointer to a stored characters. Is *not* necessarily NULL-terminated.
*/
static char * lv_label_get_dot_tmp(lv_obj_t * label)
{
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
if(ext->dot_tmp_alloc) {
return ext->dot.tmp_ptr;
}
else {
return ext->dot.tmp;
}
}
/**
* Free the dot_tmp_ptr field if it was previously allocated.
* Always clears the field
* @param label pointer to label object.
*/
static void lv_label_dot_tmp_free(lv_obj_t * label)
{
lv_label_ext_t * ext = lv_obj_get_ext_attr(label);
if(ext->dot_tmp_alloc && ext->dot.tmp_ptr) {
lv_mem_free(ext->dot.tmp_ptr);
}
ext->dot_tmp_alloc = false;
ext->dot.tmp_ptr = NULL;
}
static void get_txt_coords(const lv_obj_t * label, lv_area_t * area)
{
lv_obj_get_coords(label, area);
lv_coord_t left = lv_obj_get_style_pad_left(label, LV_LABEL_PART_MAIN);
lv_coord_t right = lv_obj_get_style_pad_right(label, LV_LABEL_PART_MAIN);
lv_coord_t top = lv_obj_get_style_pad_top(label, LV_LABEL_PART_MAIN);
lv_coord_t bottom = lv_obj_get_style_pad_bottom(label, LV_LABEL_PART_MAIN);
area->x1 += left;
area->x2 -= right;
area->y1 += top;
area->y2 -= bottom;
}
#endif
|
train_000.parquet/998
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_label.c",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 52290,
"token_count": 20744
}
|
/**
* @file lv_table.h
*
*/
#ifndef LV_TABLE_H
#define LV_TABLE_H
#ifdef __cplusplus
extern "C" {
#endif
/*********************
* INCLUDES
*********************/
#include "../lv_conf_internal.h"
#if LV_USE_TABLE != 0
/*Testing of dependencies*/
#if LV_USE_LABEL == 0
#error "lv_table: lv_label is required. Enable it in lv_conf.h (LV_USE_LABEL 1) "
#endif
#include "../lv_core/lv_obj.h"
#include "lv_label.h"
/*********************
* DEFINES
*********************/
#ifndef LV_TABLE_COL_MAX
#define LV_TABLE_COL_MAX 12
#endif
#define LV_TABLE_CELL_STYLE_CNT 4
/**********************
* TYPEDEFS
**********************/
/**
* Internal table cell format structure.
*
* Use the `lv_table` APIs instead.
*/
typedef union {
struct {
uint8_t align : 2;
uint8_t right_merge : 1;
uint8_t type : 2;
uint8_t crop : 1;
} s;
uint8_t format_byte;
} lv_table_cell_format_t;
/*Data of table*/
typedef struct {
/*New data for this type */
uint16_t col_cnt;
uint16_t row_cnt;
char ** cell_data;
lv_coord_t * row_h;
lv_style_list_t cell_style[LV_TABLE_CELL_STYLE_CNT];
lv_coord_t col_w[LV_TABLE_COL_MAX];
uint8_t cell_types : 4; /*Keep track which cell types exists to avoid dealing with unused ones*/
} lv_table_ext_t;
/*Parts of the table*/
enum {
LV_TABLE_PART_BG,
LV_TABLE_PART_CELL1,
LV_TABLE_PART_CELL2,
LV_TABLE_PART_CELL3,
LV_TABLE_PART_CELL4,
};
/**********************
* GLOBAL PROTOTYPES
**********************/
/**
* Create a table object
* @param par pointer to an object, it will be the parent of the new table
* @param copy pointer to a table object, if not NULL then the new object will be copied from it
* @return pointer to the created table
*/
lv_obj_t * lv_table_create(lv_obj_t * par, const lv_obj_t * copy);
/*=====================
* Setter functions
*====================*/
/**
* Set the value of a cell.
* @param table pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
* @param txt text to display in the cell. It will be copied and saved so this variable is not
* required after this function call.
*/
void lv_table_set_cell_value(lv_obj_t * table, uint16_t row, uint16_t col, const char * txt);
/**
* Set the number of rows
* @param table table pointer to a Table object
* @param row_cnt number of rows
*/
void lv_table_set_row_cnt(lv_obj_t * table, uint16_t row_cnt);
/**
* Set the number of columns
* @param table table pointer to a Table object
* @param col_cnt number of columns. Must be < LV_TABLE_COL_MAX
*/
void lv_table_set_col_cnt(lv_obj_t * table, uint16_t col_cnt);
/**
* Set the width of a column
* @param table table pointer to a Table object
* @param col_id id of the column [0 .. LV_TABLE_COL_MAX -1]
* @param w width of the column
*/
void lv_table_set_col_width(lv_obj_t * table, uint16_t col_id, lv_coord_t w);
/**
* Set the text align in a cell
* @param table pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
* @param align LV_LABEL_ALIGN_LEFT or LV_LABEL_ALIGN_CENTER or LV_LABEL_ALIGN_RIGHT
*/
void lv_table_set_cell_align(lv_obj_t * table, uint16_t row, uint16_t col, lv_label_align_t align);
/**
* Set the type of a cell.
* @param table pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
* @param type 1,2,3 or 4. The cell style will be chosen accordingly.
*/
void lv_table_set_cell_type(lv_obj_t * table, uint16_t row, uint16_t col, uint8_t type);
/**
* Set the cell crop. (Don't adjust the height of the cell according to its content)
* @param table pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
* @param crop true: crop the cell content; false: set the cell height to the content.
*/
void lv_table_set_cell_crop(lv_obj_t * table, uint16_t row, uint16_t col, bool crop);
/**
* Merge a cell with the right neighbor. The value of the cell to the right won't be displayed.
* @param table table pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
* @param en true: merge right; false: don't merge right
*/
void lv_table_set_cell_merge_right(lv_obj_t * table, uint16_t row, uint16_t col, bool en);
/*=====================
* Getter functions
*====================*/
/**
* Get the value of a cell.
* @param table pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
* @return text in the cell
*/
const char * lv_table_get_cell_value(lv_obj_t * table, uint16_t row, uint16_t col);
/**
* Get the number of rows.
* @param table table pointer to a Table object
* @return number of rows.
*/
uint16_t lv_table_get_row_cnt(lv_obj_t * table);
/**
* Get the number of columns.
* @param table table pointer to a Table object
* @return number of columns.
*/
uint16_t lv_table_get_col_cnt(lv_obj_t * table);
/**
* Get the width of a column
* @param table table pointer to a Table object
* @param col_id id of the column [0 .. LV_TABLE_COL_MAX -1]
* @return width of the column
*/
lv_coord_t lv_table_get_col_width(lv_obj_t * table, uint16_t col_id);
/**
* Get the text align of a cell
* @param table pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
* @return LV_LABEL_ALIGN_LEFT (default in case of error) or LV_LABEL_ALIGN_CENTER or
* LV_LABEL_ALIGN_RIGHT
*/
lv_label_align_t lv_table_get_cell_align(lv_obj_t * table, uint16_t row, uint16_t col);
/**
* Get the type of a cell
* @param table pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
* @return 1,2,3 or 4
*/
lv_label_align_t lv_table_get_cell_type(lv_obj_t * table, uint16_t row, uint16_t col);
/**
* Get the crop property of a cell
* @param table pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
* @return true: text crop enabled; false: disabled
*/
lv_label_align_t lv_table_get_cell_crop(lv_obj_t * table, uint16_t row, uint16_t col);
/**
* Get the cell merge attribute.
* @param table table pointer to a Table object
* @param row id of the row [0 .. row_cnt -1]
* @param col id of the column [0 .. col_cnt -1]
* @return true: merge right; false: don't merge right
*/
bool lv_table_get_cell_merge_right(lv_obj_t * table, uint16_t row, uint16_t col);
/**
* Get the last pressed or being pressed cell
* @param table pointer to a table object
* @param row pointer to variable to store the pressed row
* @param col pointer to variable to store the pressed column
* @return LV_RES_OK: a valid pressed cell was found, LV_RES_INV: no valid cell is pressed
*/
lv_res_t lv_table_get_pressed_cell(lv_obj_t * table, uint16_t * row, uint16_t * col);
/*=====================
* Other functions
*====================*/
/**********************
* MACROS
**********************/
#endif /*LV_USE_TABLE*/
#ifdef __cplusplus
} /* extern "C" */
#endif
#endif /*LV_TABLE_H*/
|
train_000.parquet/999
|
{
"file_path": "esp32/examples/color_code/components/lvgl_gui/lvgl/src/lv_widgets/lv_table.h",
"repo_id": "0015/ESP32-OpenCV-Projects",
"size": 7323,
"token_count": 2768
}
|