Move arrow number into unicode characters array

This commit is contained in:
Vladimir 'phcoder' Serbinenko 2010-05-09 12:56:32 +02:00
parent 7dcef22cd3
commit b764bff263
5 changed files with 48 additions and 52 deletions

View file

@ -90,20 +90,6 @@ grub_term_color_state;
#define GRUB_TERM_STATUS_CTRL (1 << 1)
#define GRUB_TERM_STATUS_ALT (1 << 2)
/* Unicode characters for fancy graphics. */
#define GRUB_TERM_DISP_LEFT 0x2190
#define GRUB_TERM_DISP_UP 0x2191
#define GRUB_TERM_DISP_RIGHT 0x2192
#define GRUB_TERM_DISP_DOWN 0x2193
#define GRUB_TERM_DISP_HLINE 0x2501
#define GRUB_TERM_DISP_VLINE 0x2503
#define GRUB_TERM_DISP_UL 0x250F
#define GRUB_TERM_DISP_UR 0x2513
#define GRUB_TERM_DISP_LL 0x2517
#define GRUB_TERM_DISP_LR 0x251B
/* Menu-related geometrical constants. */
/* The number of lines of "GRUB version..." at the top. */

View file

@ -184,6 +184,16 @@ enum
GRUB_UNICODE_THAANA_SUKUN = 0x07b0,
GRUB_UNICODE_ZWNJ = 0x200c,
GRUB_UNICODE_ZWJ = 0x200d,
GRUB_UNICODE_LEFTARROW = 0x2190,
GRUB_UNICODE_UPARROW = 0x2191,
GRUB_UNICODE_RIGHTARROW = 0x2192,
GRUB_UNICODE_DOWNARROW = 0x2193,
GRUB_UNICODE_HLINE = 0x2501,
GRUB_UNICODE_VLINE = 0x2503,
GRUB_UNICODE_CORNER_UL = 0x250f,
GRUB_UNICODE_CORNER_UR = 0x2513,
GRUB_UNICODE_CORNER_LL = 0x2517,
GRUB_UNICODE_CORNER_LR = 0x251b,
GRUB_UNICODE_VARIATION_SELECTOR_1 = 0xfe00,
GRUB_UNICODE_VARIATION_SELECTOR_16 = 0xfe0f,
GRUB_UNICODE_VARIATION_SELECTOR_17 = 0xe0100,

View file

@ -173,7 +173,7 @@ print_up (int flag, struct per_term_screen *term_screen)
GRUB_TERM_FIRST_ENTRY_Y);
if (flag)
grub_putcode (GRUB_TERM_DISP_UP, term_screen->term);
grub_putcode (GRUB_UNICODE_UPARROW, term_screen->term);
else
grub_putcode (' ', term_screen->term);
}
@ -188,7 +188,7 @@ print_down (int flag, struct per_term_screen *term_screen)
+ grub_term_num_entries (term_screen->term));
if (flag)
grub_putcode (GRUB_TERM_DISP_DOWN, term_screen->term);
grub_putcode (GRUB_UNICODE_DOWNARROW, term_screen->term);
else
grub_putcode (' ', term_screen->term);
}
@ -1097,7 +1097,7 @@ complete (struct screen *screen, int continuous, int update)
endp = p + (grub_term_width (screen->terms[i].term) - 8);
if (p != ucs4)
grub_putcode (GRUB_TERM_DISP_LEFT, screen->terms[i].term);
grub_putcode (GRUB_UNICODE_LEFTARROW, screen->terms[i].term);
else
grub_putcode (' ', screen->terms[i].term);
@ -1105,7 +1105,7 @@ complete (struct screen *screen, int continuous, int update)
0, 0, screen->terms[i].term);
if (ucs4 + ucs4len > endp)
grub_putcode (GRUB_TERM_DISP_RIGHT, screen->terms[i].term);
grub_putcode (GRUB_UNICODE_RIGHTARROW, screen->terms[i].term);
grub_term_gotoxy (screen->terms[i].term, pos >> 8, pos & 0xFF);
}
}

View file

@ -83,27 +83,27 @@ draw_border (struct grub_term_output *term)
grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
grub_term_gotoxy (term, GRUB_TERM_MARGIN, GRUB_TERM_TOP_BORDER_Y);
grub_putcode (GRUB_TERM_DISP_UL, term);
grub_putcode (GRUB_UNICODE_CORNER_UL, term);
for (i = 0; i < (unsigned) grub_term_border_width (term) - 2; i++)
grub_putcode (GRUB_TERM_DISP_HLINE, term);
grub_putcode (GRUB_TERM_DISP_UR, term);
grub_putcode (GRUB_UNICODE_HLINE, term);
grub_putcode (GRUB_UNICODE_CORNER_UR, term);
for (i = 0; i < (unsigned) grub_term_num_entries (term); i++)
{
grub_term_gotoxy (term, GRUB_TERM_MARGIN, GRUB_TERM_TOP_BORDER_Y + i + 1);
grub_putcode (GRUB_TERM_DISP_VLINE, term);
grub_putcode (GRUB_UNICODE_VLINE, term);
grub_term_gotoxy (term, GRUB_TERM_MARGIN + grub_term_border_width (term)
- 1,
GRUB_TERM_TOP_BORDER_Y + i + 1);
grub_putcode (GRUB_TERM_DISP_VLINE, term);
grub_putcode (GRUB_UNICODE_VLINE, term);
}
grub_term_gotoxy (term, GRUB_TERM_MARGIN,
GRUB_TERM_TOP_BORDER_Y + grub_term_num_entries (term) + 1);
grub_putcode (GRUB_TERM_DISP_LL, term);
grub_putcode (GRUB_UNICODE_CORNER_LL, term);
for (i = 0; i < (unsigned) grub_term_border_width (term) - 2; i++)
grub_putcode (GRUB_TERM_DISP_HLINE, term);
grub_putcode (GRUB_TERM_DISP_LR, term);
grub_putcode (GRUB_UNICODE_HLINE, term);
grub_putcode (GRUB_UNICODE_CORNER_LR, term);
grub_term_setcolorstate (term, GRUB_TERM_COLOR_NORMAL);
@ -138,8 +138,8 @@ command-line or ESC to discard edits and return to the GRUB menu."),
"entry is highlighted.\n");
char *msg_translated;
msg_translated = grub_xasprintf (msg, (grub_uint32_t) GRUB_TERM_DISP_UP,
(grub_uint32_t) GRUB_TERM_DISP_DOWN);
msg_translated = grub_xasprintf (msg, GRUB_UNICODE_UPARROW,
GRUB_UNICODE_DOWNARROW);
if (!msg_translated)
return;
grub_putcode ('\n', term);
@ -236,9 +236,9 @@ print_entry (int y, int highlight, grub_menu_entry_t entry,
if (last_printed != len)
{
grub_putcode (GRUB_TERM_DISP_RIGHT, term);
grub_putcode (GRUB_UNICODE_RIGHTARROW, term);
struct grub_unicode_glyph pseudo_glyph = {
.base = GRUB_TERM_DISP_RIGHT,
.base = GRUB_UNICODE_RIGHTARROW,
.variant = 0,
.attributes = 0,
.ncomb = 0,
@ -274,7 +274,7 @@ print_entries (grub_menu_t menu, int first, int offset,
GRUB_TERM_FIRST_ENTRY_Y);
if (first)
grub_putcode (GRUB_TERM_DISP_UP, term);
grub_putcode (GRUB_UNICODE_UPARROW, term);
else
grub_putcode (' ', term);
@ -292,7 +292,7 @@ print_entries (grub_menu_t menu, int first, int offset,
GRUB_TERM_TOP_BORDER_Y + grub_term_num_entries (term));
if (e)
grub_putcode (GRUB_TERM_DISP_DOWN, term);
grub_putcode (GRUB_UNICODE_DOWNARROW, term);
else
grub_putcode (' ', term);

View file

@ -128,25 +128,25 @@ map_code (grub_uint32_t in, struct grub_term_output *term)
case GRUB_TERM_CODE_TYPE_VGA:
switch (in)
{
case GRUB_TERM_DISP_LEFT:
case GRUB_UNICODE_LEFTARROW:
return 0x1b;
case GRUB_TERM_DISP_UP:
case GRUB_UNICODE_UPARROW:
return 0x18;
case GRUB_TERM_DISP_RIGHT:
case GRUB_UNICODE_RIGHTARROW:
return 0x1a;
case GRUB_TERM_DISP_DOWN:
case GRUB_UNICODE_DOWNARROW:
return 0x19;
case GRUB_TERM_DISP_HLINE:
case GRUB_UNICODE_HLINE:
return 0xc4;
case GRUB_TERM_DISP_VLINE:
case GRUB_UNICODE_VLINE:
return 0xb3;
case GRUB_TERM_DISP_UL:
case GRUB_UNICODE_CORNER_UL:
return 0xda;
case GRUB_TERM_DISP_UR:
case GRUB_UNICODE_CORNER_UR:
return 0xbf;
case GRUB_TERM_DISP_LL:
case GRUB_UNICODE_CORNER_LL:
return 0xc0;
case GRUB_TERM_DISP_LR:
case GRUB_UNICODE_CORNER_LR:
return 0xd9;
}
return '?';
@ -154,28 +154,28 @@ map_code (grub_uint32_t in, struct grub_term_output *term)
/* Better than nothing. */
switch (in)
{
case GRUB_TERM_DISP_LEFT:
case GRUB_UNICODE_LEFTARROW:
return '<';
case GRUB_TERM_DISP_UP:
case GRUB_UNICODE_UPARROW:
return '^';
case GRUB_TERM_DISP_RIGHT:
case GRUB_UNICODE_RIGHTARROW:
return '>';
case GRUB_TERM_DISP_DOWN:
case GRUB_UNICODE_DOWNARROW:
return 'v';
case GRUB_TERM_DISP_HLINE:
case GRUB_UNICODE_HLINE:
return '-';
case GRUB_TERM_DISP_VLINE:
case GRUB_UNICODE_VLINE:
return '|';
case GRUB_TERM_DISP_UL:
case GRUB_TERM_DISP_UR:
case GRUB_TERM_DISP_LL:
case GRUB_TERM_DISP_LR:
case GRUB_UNICODE_CORNER_UL:
case GRUB_UNICODE_CORNER_UR:
case GRUB_UNICODE_CORNER_LL:
case GRUB_UNICODE_CORNER_LR:
return '+';
}