- Allow multiple combination of style flags for usetup translations

- Added right & center text align , no more space counting :). All localization can now share X,Y cordinates

Note: only the en-US localization currently takes advantage of it , other localizations should be updated

svn path=/trunk/; revision=32722
This commit is contained in:
Marc Piulachs 2008-03-19 04:43:40 +00:00
parent 3a8626a802
commit c0b2fad1c3
18 changed files with 2494 additions and 2413 deletions

View file

@ -520,4 +520,82 @@ CONSOLE_PrintTextXYN(
}
}
VOID
CONSOLE_SetStyledText(
IN SHORT x,
IN SHORT y,
IN INT Flags,
IN LPCSTR Text)
{
COORD coPos;
DWORD Length;
coPos.X = x;
coPos.Y = y;
Length = (ULONG)strlen(Text);
if (Flags & TEXT_TYPE_STATUS)
{
coPos.Y = yScreen - 1;
coPos.X = 0;
}
else /* TEXT_TYPE_REGULAR (Default) */
{
coPos.X = x;
coPos.Y = y;
}
if (Flags & TEXT_ALIGN_LEFT)
{
coPos.X = 0;
if (Flags & TEXT_PADDING_SMALL)
{
coPos.X += 1;
}
else if (Flags & TEXT_PADDING_BIG)
{
coPos.X += 2;
}
}
else if (Flags & TEXT_ALIGN_RIGHT)
{
coPos.X = coPos.X - Length;
if (Flags & TEXT_PADDING_SMALL)
{
coPos.X -= 1;
}
else if (Flags & TEXT_PADDING_BIG)
{
coPos.X -= 2;
}
}
else if (Flags & TEXT_ALIGN_CENTER)
{
coPos.X = (xScreen - Length) /2;
}
if (Flags & TEXT_TYPE_STATUS)
{
CONSOLE_SetStatusText(Text);
}
else /* TEXT_TYPE_REGULAR (Default) */
{
if (Flags & TEXT_STYLE_HIGHLIGHT)
{
CONSOLE_SetHighlightedTextXY(coPos.X, coPos.Y, Text);
}
else if (Flags & TEXT_STYLE_UNDERLINE)
{
CONSOLE_SetUnderlinedTextXY(coPos.X, coPos.Y, Text);
}
else /* TEXT_STYLE_NORMAL (Default) */
{
CONSOLE_SetTextXY(coPos.X, coPos.Y, Text);
}
}
}
/* EOF */

View file

@ -31,6 +31,25 @@
#define FOREGROUND_YELLOW (FOREGROUND_INTENSITY | FOREGROUND_RED | FOREGROUND_GREEN)
#define BACKGROUND_WHITE (BACKGROUND_RED | BACKGROUND_GREEN | BACKGROUND_BLUE)
/* Text style */
#define TEXT_STYLE_NORMAL 0x00000001
#define TEXT_STYLE_HIGHLIGHT 0x00000002
#define TEXT_STYLE_UNDERLINE 0x00000004
/* Text type */
#define TEXT_TYPE_REGULAR 0x00000008
#define TEXT_TYPE_STATUS 0x00000010
/* Text align */
#define TEXT_ALIGN_DEFAULT 0x00000020
#define TEXT_ALIGN_RIGHT 0x00000040
#define TEXT_ALIGN_LEFT 0x00000080
#define TEXT_ALIGN_CENTER 0x00000100
/* Text padding */
#define TEXT_PADDING_SMALL 0x00000200
#define TEXT_PADDING_BIG 0x00000400
extern HANDLE StdInput, StdOutput;
extern SHORT xScreen, yScreen;
@ -150,6 +169,13 @@ CONSOLE_SetUnderlinedTextXY(
IN SHORT y,
IN LPCSTR Text);
VOID
CONSOLE_SetStyledText(
IN SHORT x,
IN SHORT y,
IN INT Flags,
IN LPCSTR Text);
#endif /* __CONSOLE_H__*/
/* EOF */

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -25,6 +25,7 @@
*/
#include "usetup.h"
#include "interface/consup.h"
#include "errorcode.h"
#include "mui.h"
@ -162,7 +163,6 @@ MUIDisplayPage(IN ULONG page)
{
const MUI_ENTRY * entry;
int index;
int flags;
entry = FindMUIEntriesOfPage(page);
if (!entry)
@ -177,24 +177,12 @@ MUIDisplayPage(IN ULONG page)
index = 0;
do
{
flags = entry[index].Flags;
switch(flags)
{
case TEXT_NORMAL:
CONSOLE_SetTextXY(entry[index].X, entry[index].Y, entry[index].Buffer);
break;
case TEXT_HIGHLIGHT:
CONSOLE_SetHighlightedTextXY(entry[index].X, entry[index].Y, entry[index].Buffer);
break;
case TEXT_UNDERLINE:
CONSOLE_SetUnderlinedTextXY(entry[index].X, entry[index].Y, entry[index].Buffer);
break;
case TEXT_STATUS:
CONSOLE_SetStatusText(entry[index].Buffer);
break;
default:
break;
}
CONSOLE_SetStyledText (
entry[index].X,
entry[index].Y,
entry[index].Flags,
entry[index].Buffer);
index++;
}
while (entry[index].Buffer != NULL);

View file

@ -6,7 +6,7 @@ typedef struct
BYTE X;
BYTE Y;
LPCSTR Buffer;
BYTE Flags;
DWORD Flags;
}MUI_ENTRY, *PMUI_ENTRY;
typedef struct
@ -40,17 +40,6 @@ typedef struct
const MUI_STRING * MuiStrings;
}MUI_LANGUAGE;
#define TEXT_NORMAL 0
#define TEXT_HIGHLIGHT 1
#define TEXT_UNDERLINE 2
#define TEXT_STATUS 4
#define TEXT_ALIGN_DEFAULT 8
#define TEXT_ALIGN_RIGHT 16
#define TEXT_ALIGN_LEFT 32
#define TEXT_ALIGN_CENTER 64
VOID
MUIDisplayPage (ULONG PageNumber);