|
@@ -19,6 +19,7 @@
|
19
|
19
|
#include "config.h"
|
20
|
20
|
#include "log.h"
|
21
|
21
|
#include "lcd.h"
|
|
22
|
+#include "menu.h"
|
22
|
23
|
#include "text.h"
|
23
|
24
|
|
24
|
25
|
typedef struct {
|
|
@@ -50,8 +51,10 @@ static void pixel_callback(int16_t x, int16_t y, uint8_t count, uint8_t alpha,
|
50
|
51
|
void *state) {
|
51
|
52
|
state_t *s = (state_t*)state;
|
52
|
53
|
|
53
|
|
- if (y < 0 || y >= s->options->height) return;
|
54
|
|
- if (x < 0 || x + count >= s->options->width) return;
|
|
54
|
+ if ((y < 0) || (y >= (s->options->y + s->options->height))
|
|
55
|
+ || (x < 0) || ((x + count) >= (s->options->x + s->options->width))) {
|
|
56
|
+ return;
|
|
57
|
+ }
|
55
|
58
|
|
56
|
59
|
while (count--) {
|
57
|
60
|
lcd_write_point(x, y,
|
|
@@ -167,7 +170,7 @@ void text_box(const char *s, bool centered) {
|
167
|
170
|
int width = 240;
|
168
|
171
|
|
169
|
172
|
int y = 50;
|
170
|
|
- int height = 120;
|
|
173
|
+ int height = MENU_MAX_LINES * (20 + 2);
|
171
|
174
|
|
172
|
175
|
struct text_conf text = {
|
173
|
176
|
.text = "",
|
|
@@ -175,11 +178,11 @@ void text_box(const char *s, bool centered) {
|
175
|
178
|
.y = y,
|
176
|
179
|
.justify = false,
|
177
|
180
|
.alignment = centered ? MF_ALIGN_CENTER : MF_ALIGN_LEFT,
|
178
|
|
- .width = width - 4,
|
179
|
|
- .height = height - 4,
|
|
181
|
+ .width = width,
|
|
182
|
+ .height = height,
|
180
|
183
|
.margin = 2,
|
181
|
184
|
.fg = RGB_565(0xFF, 0xFF, 0xFF),
|
182
|
|
- .bg = RGB_565(0x00, 0x00, 0x00),
|
|
185
|
+ .bg = TEXT_BG_NONE,
|
183
|
186
|
.font = &font,
|
184
|
187
|
};
|
185
|
188
|
|
|
@@ -187,7 +190,7 @@ void text_box(const char *s, bool centered) {
|
187
|
190
|
y,
|
188
|
191
|
x + width - 1,
|
189
|
192
|
y + height - 1,
|
190
|
|
- text.bg);
|
|
193
|
+ RGB_565(0x00, 0x00, 0x00));
|
191
|
194
|
|
192
|
195
|
text.text = s;
|
193
|
196
|
text_draw(&text);
|