|
Link Here
|
| 84 |
label_paint (void *vself, const grub_video_rect_t *region) |
84 |
label_paint (void *vself, const grub_video_rect_t *region) |
| 85 |
{ |
85 |
{ |
| 86 |
grub_gui_label_t self = vself; |
86 |
grub_gui_label_t self = vself; |
|
|
87 |
char * translated_text = _(self->text); |
| 87 |
|
88 |
|
| 88 |
if (! self->visible) |
89 |
if (! self->visible) |
| 89 |
return; |
90 |
return; |
|
Link Here
|
| 97 |
left_x = 0; |
98 |
left_x = 0; |
| 98 |
else if (self->align == align_center) |
99 |
else if (self->align == align_center) |
| 99 |
left_x = (self->bounds.width |
100 |
left_x = (self->bounds.width |
| 100 |
- grub_font_get_string_width (self->font, self->text)) / 2; |
101 |
- grub_font_get_string_width (self->font, translated_text)) / 2; |
| 101 |
else if (self->align == align_right) |
102 |
else if (self->align == align_right) |
| 102 |
left_x = (self->bounds.width |
103 |
left_x = (self->bounds.width |
| 103 |
- grub_font_get_string_width (self->font, self->text)); |
104 |
- grub_font_get_string_width (self->font, translated_text)); |
| 104 |
else |
105 |
else |
| 105 |
return; /* Invalid alignment. */ |
106 |
return; /* Invalid alignment. */ |
| 106 |
|
107 |
|
|
Link Here
|
| 109 |
|
110 |
|
| 110 |
grub_video_rect_t vpsave; |
111 |
grub_video_rect_t vpsave; |
| 111 |
grub_gui_set_viewport (&self->bounds, &vpsave); |
112 |
grub_gui_set_viewport (&self->bounds, &vpsave); |
| 112 |
grub_font_draw_string (self->text, |
113 |
grub_font_draw_string (translated_text, |
| 113 |
self->font, |
114 |
self->font, |
| 114 |
grub_video_map_rgba_color (self->color), |
115 |
grub_video_map_rgba_color (self->color), |
| 115 |
left_x, |
116 |
left_x, |
|
Link Here
|
| 149 |
label_get_minimal_size (void *vself, unsigned *width, unsigned *height) |
150 |
label_get_minimal_size (void *vself, unsigned *width, unsigned *height) |
| 150 |
{ |
151 |
{ |
| 151 |
grub_gui_label_t self = vself; |
152 |
grub_gui_label_t self = vself; |
| 152 |
*width = grub_font_get_string_width (self->font, self->text); |
153 |
*width = grub_font_get_string_width (self->font, _(self->text)); |
| 153 |
*height = (grub_font_get_ascent (self->font) |
154 |
*height = (grub_font_get_ascent (self->font) |
| 154 |
+ grub_font_get_descent (self->font)); |
155 |
+ grub_font_get_descent (self->font)); |
| 155 |
} |
156 |
} |
|
Link Here
|
| 183 |
else |
184 |
else |
| 184 |
{ |
185 |
{ |
| 185 |
if (grub_strcmp (value, "@KEYMAP_LONG@") == 0) |
186 |
if (grub_strcmp (value, "@KEYMAP_LONG@") == 0) |
| 186 |
value = _("Press enter to boot the selected OS, " |
187 |
value = "Press enter to boot the selected OS, " |
| 187 |
"`e' to edit the commands before booting " |
188 |
"`e' to edit the commands before booting " |
| 188 |
"or `c' for a command-line. ESC to return previous menu."); |
189 |
"or `c' for a command-line. ESC to return previous menu."; |
| 189 |
else if (grub_strcmp (value, "@KEYMAP_MIDDLE@") == 0) |
190 |
else if (grub_strcmp (value, "@KEYMAP_MIDDLE@") == 0) |
| 190 |
value = _("Press enter to boot the selected OS, " |
191 |
value = "Press enter to boot the selected OS, " |
| 191 |
"`e' to edit the commands before booting " |
192 |
"`e' to edit the commands before booting " |
| 192 |
"or `c' for a command-line."); |
193 |
"or `c' for a command-line."; |
| 193 |
else if (grub_strcmp (value, "@KEYMAP_SHORT@") == 0) |
194 |
else if (grub_strcmp (value, "@KEYMAP_SHORT@") == 0) |
| 194 |
value = _("enter: boot, `e': options, `c': cmd-line"); |
195 |
value = "enter: boot, `e': options, `c': cmd-line"; |
| 195 |
/* FIXME: Add more templates here if needed. */ |
196 |
/* FIXME: Add more templates here if needed. */ |
| 196 |
self->template = grub_strdup (value); |
197 |
self->template = grub_strdup (value); |
| 197 |
self->text = grub_xasprintf (value, self->value); |
198 |
self->text = grub_xasprintf (value, self->value); |
| 198 |
- |
|
|