Author: janderwald
Date: Thu Dec 13 19:15:43 2007
New Revision: 31200
URL:
http://svn.reactos.org/svn/reactos?rev=31200&view=rev
Log:
- implement displaying and showing language dialog
- rename all translated entries in de-DE.h because gcc doesnt understand the scope of
static
- add basic language dialog - feel free to improve design, layout etc
Modified:
trunk/reactos/base/setup/usetup/interface/usetup.c
trunk/reactos/base/setup/usetup/lang/de-DE.h
trunk/reactos/base/setup/usetup/lang/en-US.h
trunk/reactos/base/setup/usetup/mui.c
trunk/reactos/base/setup/usetup/mui.h
trunk/reactos/base/setup/usetup/usetup.h
Modified: trunk/reactos/base/setup/usetup/interface/usetup.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/interfac…
==============================================================================
--- trunk/reactos/base/setup/usetup/interface/usetup.c (original)
+++ trunk/reactos/base/setup/usetup/interface/usetup.c Thu Dec 13 19:15:43 2007
@@ -73,7 +73,7 @@
static PGENERIC_LIST DisplayList = NULL;
static PGENERIC_LIST KeyboardList = NULL;
static PGENERIC_LIST LayoutList = NULL;
-
+static PGENERIC_LIST LanguageList = NULL;
/* FUNCTIONS ****************************************************************/
@@ -548,6 +548,56 @@
SetupCloseInfFile(UnattendInf);
DPRINT("Running unattended setup\n");
+}
+
+static PAGE_NUMBER
+LanguagePage(PINPUT_RECORD Ir)
+{
+ if (LanguageList == NULL)
+ {
+ LanguageList = MUICreateLanguageList();
+ if (LanguageList == NULL)
+ {
+ PopupError("Setup failed to initialize available translations",
NULL, NULL, POPUP_WAIT_NONE);
+ return START_PAGE;
+ }
+ }
+
+ DrawGenericList(LanguageList,
+ 7,
+ 15,
+ xScreen - 10,
+ yScreen - 10);
+
+ MUIDisplayPage(LANGUAGE_PAGE);
+
+ while(TRUE)
+ {
+ CONSOLE_ConInKey(Ir);
+
+ if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
+ (Ir->Event.KeyEvent.wVirtualKeyCode == VK_DOWN)) /* DOWN */
+ {
+ ScrollDownGenericList (LanguageList);
+ }
+ else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
+ (Ir->Event.KeyEvent.wVirtualKeyCode == VK_UP)) /* UP */
+ {
+ ScrollUpGenericList (LanguageList);
+ }
+ else if ((Ir->Event.KeyEvent.uChar.AsciiChar == 0x00) &&
+ (Ir->Event.KeyEvent.wVirtualKeyCode == VK_F3)) /* F3 */
+ {
+ if (ConfirmQuit(Ir) == TRUE)
+ return QUIT_PAGE;
+ }
+ else if (Ir->Event.KeyEvent.uChar.AsciiChar == 0x0D) /* ENTER */
+ {
+ MUISelectLanguage((ULONG)LanguageList->CurrentEntry->UserData);
+ return START_PAGE;
+ }
+ }
+ return START_PAGE;
}
@@ -3425,6 +3475,12 @@
LayoutList = NULL;
}
+ if (LanguageList != NULL)
+ {
+ DestroyGenericList(LanguageList, FALSE);
+ LanguageList = NULL;
+ }
+
CONSOLE_SetStatusText(" ENTER = Reboot computer");
while(TRUE)
@@ -3509,7 +3565,7 @@
/* Hide the cursor */
CONSOLE_SetCursorType(TRUE, FALSE);
- Page = START_PAGE;
+ Page = LANGUAGE_PAGE;
while (Page != REBOOT_PAGE)
{
CONSOLE_ClearScreen();
@@ -3520,6 +3576,10 @@
switch (Page)
{
+ /* Language page */
+ case LANGUAGE_PAGE:
+ Page = LanguagePage(&Ir);
+ break;
/* Start page */
case START_PAGE:
Page = SetupStartPage(&Ir);
Modified: trunk/reactos/base/setup/usetup/lang/de-DE.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/lang/de-…
==============================================================================
--- trunk/reactos/base/setup/usetup/lang/de-DE.h (original)
+++ trunk/reactos/base/setup/usetup/lang/de-DE.h Thu Dec 13 19:15:43 2007
@@ -1,7 +1,7 @@
#ifndef LANG_DE_DE_H__
#define LANG_DE_DE_H__
-static MUI_ENTRY WelcomePageEntries[] =
+static MUI_ENTRY deDEWelcomePageEntries[] =
{
{
6,
@@ -71,7 +71,7 @@
}
};
-static MUI_ENTRY IntroPageEntries[] =
+static MUI_ENTRY deDEIntroPageEntries[] =
{
{
4,
@@ -165,7 +165,7 @@
}
};
-static MUI_ENTRY LicensePageEntries[] =
+static MUI_ENTRY deDELicensePageEntries[] =
{
{
6,
@@ -283,7 +283,7 @@
}
};
-static MUI_ENTRY DevicePageEntries[] =
+static MUI_ENTRY deDEDevicePageEntries[] =
{
{
6,
@@ -370,7 +370,7 @@
}
};
-static MUI_ENTRY RepairPageEntries[] =
+static MUI_ENTRY deDERepairPageEntries[] =
{
{
6,
@@ -427,7 +427,7 @@
0
}
};
-static MUI_ENTRY ComputerPageEntries[] =
+static MUI_ENTRY deDEComputerPageEntries[] =
{
{
6,
@@ -473,7 +473,7 @@
}
};
-static MUI_ENTRY FlushPageEntries[] =
+static MUI_ENTRY deDEFlushPageEntries[] =
{
{
10,
@@ -507,7 +507,7 @@
}
};
-static MUI_ENTRY QuitPageEntries[] =
+static MUI_ENTRY deDEQuitPageEntries[] =
{
{
10,
@@ -547,7 +547,7 @@
}
};
-static MUI_ENTRY DisplayPageEntries[] =
+static MUI_ENTRY deDEDisplayPageEntries[] =
{
{
6,
@@ -592,7 +592,7 @@
}
};
-static MUI_ENTRY SuccessPageEntries[] =
+static MUI_ENTRY deDESuccessPageEntries[] =
{
{
10,
@@ -632,7 +632,7 @@
}
};
-static MUI_ENTRY BootPageEntries[] =
+static MUI_ENTRY deDEBootPageEntries[] =
{
{
6,
@@ -677,47 +677,47 @@
{
{
START_PAGE,
- WelcomePageEntries
+ deDEWelcomePageEntries
},
{
INTRO_PAGE,
- IntroPageEntries
+ deDEIntroPageEntries
},
{
LICENSE_PAGE,
- LicensePageEntries
+ deDELicensePageEntries
},
{
DEVICE_SETTINGS_PAGE,
- DevicePageEntries
+ deDEDevicePageEntries
},
{
REPAIR_INTRO_PAGE,
- RepairPageEntries
+ deDERepairPageEntries
},
{
COMPUTER_SETTINGS_PAGE,
- ComputerPageEntries
+ deDEComputerPageEntries
},
{
DISPLAY_SETTINGS_PAGE,
- DisplayPageEntries
+ deDEDisplayPageEntries
},
{
FLUSH_PAGE,
- FlushPageEntries
+ deDEFlushPageEntries
},
{
QUIT_PAGE,
- QuitPageEntries
+ deDEQuitPageEntries
},
{
SUCCESS_PAGE,
- SuccessPageEntries
+ deDESuccessPageEntries
},
{
BOOT_LOADER_FLOPPY_PAGE,
- BootPageEntries
+ deDEBootPageEntries
},
{
-1,
Modified: trunk/reactos/base/setup/usetup/lang/en-US.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/lang/en-…
==============================================================================
--- trunk/reactos/base/setup/usetup/lang/en-US.h (original)
+++ trunk/reactos/base/setup/usetup/lang/en-US.h Thu Dec 13 19:15:43 2007
@@ -1,7 +1,30 @@
#ifndef LANG_EN_US_H__
#define LANG_EN_US_H__
-static MUI_ENTRY WelcomePageEntries[] =
+// do not translate these
+static MUI_ENTRY LanguagePageEntries[] =
+{
+ {
+ 6,
+ 8,
+ "Select your language:",
+ TEXT_NORMAL
+ },
+ {
+ 0,
+ 0,
+ " ENTER = Continue F3 = Quit",
+ TEXT_STATUS
+ },
+ {
+ 0,
+ 0,
+ NULL,
+ 0
+ }
+};
+
+static MUI_ENTRY enUSWelcomePageEntries[] =
{
{
6,
@@ -71,7 +94,7 @@
}
};
-static MUI_ENTRY IntroPageEntries[] =
+static MUI_ENTRY enUSIntroPageEntries[] =
{
{
4,
@@ -165,7 +188,7 @@
}
};
-static MUI_ENTRY LicensePageEntries[] =
+static MUI_ENTRY enUSLicensePageEntries[] =
{
{
6,
@@ -283,7 +306,7 @@
}
};
-static MUI_ENTRY DevicePageEntries[] =
+static MUI_ENTRY enUSDevicePageEntries[] =
{
{
6,
@@ -370,7 +393,7 @@
}
};
-static MUI_ENTRY RepairPageEntries[] =
+static MUI_ENTRY enUSRepairPageEntries[] =
{
{
6,
@@ -427,7 +450,7 @@
0
}
};
-static MUI_ENTRY ComputerPageEntries[] =
+static MUI_ENTRY enUSComputerPageEntries[] =
{
{
6,
@@ -473,7 +496,7 @@
}
};
-static MUI_ENTRY FlushPageEntries[] =
+static MUI_ENTRY enUSFlushPageEntries[] =
{
{
10,
@@ -507,7 +530,7 @@
}
};
-static MUI_ENTRY QuitPageEntries[] =
+static MUI_ENTRY enUSQuitPageEntries[] =
{
{
10,
@@ -547,7 +570,7 @@
}
};
-static MUI_ENTRY DisplayPageEntries[] =
+static MUI_ENTRY enUSDisplayPageEntries[] =
{
{
6,
@@ -592,7 +615,7 @@
}
};
-static MUI_ENTRY SuccessPageEntries[] =
+static MUI_ENTRY enUSSuccessPageEntries[] =
{
{
10,
@@ -632,7 +655,7 @@
}
};
-static MUI_ENTRY BootPageEntries[] =
+static MUI_ENTRY enUSBootPageEntries[] =
{
{
6,
@@ -676,48 +699,52 @@
MUI_PAGE enUSPages[] =
{
{
+ LANGUAGE_PAGE,
+ LanguagePageEntries
+ },
+ {
START_PAGE,
- WelcomePageEntries
+ enUSWelcomePageEntries
},
{
INTRO_PAGE,
- IntroPageEntries
+ enUSIntroPageEntries
},
{
LICENSE_PAGE,
- LicensePageEntries
+ enUSLicensePageEntries
},
{
DEVICE_SETTINGS_PAGE,
- DevicePageEntries
+ enUSDevicePageEntries
},
{
REPAIR_INTRO_PAGE,
- RepairPageEntries
+ enUSRepairPageEntries
},
{
COMPUTER_SETTINGS_PAGE,
- ComputerPageEntries
+ enUSComputerPageEntries
},
{
DISPLAY_SETTINGS_PAGE,
- DisplayPageEntries
+ enUSDisplayPageEntries
},
{
FLUSH_PAGE,
- FlushPageEntries
+ enUSFlushPageEntries
},
{
QUIT_PAGE,
- QuitPageEntries
+ enUSQuitPageEntries
},
{
SUCCESS_PAGE,
- SuccessPageEntries
+ enUSSuccessPageEntries
},
{
BOOT_LOADER_FLOPPY_PAGE,
- BootPageEntries
+ enUSBootPageEntries
},
{
-1,
Modified: trunk/reactos/base/setup/usetup/mui.c
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/mui.c?re…
==============================================================================
--- trunk/reactos/base/setup/usetup/mui.c (original)
+++ trunk/reactos/base/setup/usetup/mui.c Thu Dec 13 19:15:43 2007
@@ -2,12 +2,17 @@
#include "mui.h"
#include "lang/en-US.h"
+#include "lang/de-DE.h"
-static MUI_LANGUAGE lang[] =
+static MUI_LANGUAGE LanguageList[] =
{
{
"English (USA)",
enUSPages
+ },
+ {
+ "German",
+ deDEPages
},
{
NULL,
@@ -15,7 +20,7 @@
}
};
-static unsigned sel_lang = 0;
+static ULONG SelectedLanguage = 0;
extern
VOID
@@ -25,29 +30,61 @@
ULONG WaitEvent);
+PGENERIC_LIST
+MUICreateLanguageList()
+{
+ PGENERIC_LIST List;
+ ULONG Index;
+
+ List = CreateGenericList();
+ if (List == NULL)
+ {
+ return NULL;
+ }
+
+ Index = 0;
+
+ do
+ {
+ AppendGenericListEntry(List, LanguageList[Index].LanguageDescriptor,
(PVOID)Index, (Index == 0 ? TRUE : FALSE));
+ Index++;
+ }while(LanguageList[Index].MuiPages &&
LanguageList[Index].LanguageDescriptor);
+
+ return List;
+}
+
+BOOLEAN
+MUISelectLanguage(ULONG LanguageIndex)
+{
+ SelectedLanguage = LanguageIndex;
+ return TRUE;
+}
+
+
static
MUI_ENTRY *
-findMUIEntriesOfPage(int pg, MUI_PAGE * pages)
+findMUIEntriesOfPage(ULONG PageNumber, MUI_PAGE * Pages)
{
- int index = 0;
+ ULONG Index = 0;
do
{
- if (pages[index].Number == pg)
+ if (Pages[Index].Number == PageNumber)
{
- return pages[index].MuiEntry;
+ return Pages[Index].MuiEntry;
}
- index++;
- }while(pages[index].MuiEntry != NULL);
+ Index++;
+ }while(Pages[Index].MuiEntry != NULL);
return NULL;
}
-void MUIDisplayPage(int pg)
+VOID
+MUIDisplayPage(ULONG pg)
{
MUI_ENTRY * entry;
int index;
int flags;
- entry = findMUIEntriesOfPage(pg, lang[sel_lang].MuiPages);
+ entry = findMUIEntriesOfPage(pg, LanguageList[SelectedLanguage].MuiPages);
if (!entry)
{
PopupError("Error: Failed to find translated page",
Modified: trunk/reactos/base/setup/usetup/mui.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/mui.h?re…
==============================================================================
--- trunk/reactos/base/setup/usetup/mui.h (original)
+++ trunk/reactos/base/setup/usetup/mui.h Thu Dec 13 19:15:43 2007
@@ -27,8 +27,14 @@
#define TEXT_UNDERLINE 2
#define TEXT_STATUS 4
+VOID
+MUIDisplayPage(ULONG PageNumber);
-void MUIDisplayPage(int pg);
+PGENERIC_LIST
+MUICreateLanguageList();
+
+BOOLEAN
+MUISelectLanguage(ULONG LanguageIndex);
#endif
Modified: trunk/reactos/base/setup/usetup/usetup.h
URL:
http://svn.reactos.org/svn/reactos/trunk/reactos/base/setup/usetup/usetup.h…
==============================================================================
--- trunk/reactos/base/setup/usetup/usetup.h (original)
+++ trunk/reactos/base/setup/usetup/usetup.h Thu Dec 13 19:15:43 2007
@@ -82,7 +82,8 @@
typedef enum _PAGE_NUMBER
{
- START_PAGE = 0,
+ LANGUAGE_PAGE = 0,
+ START_PAGE,
INTRO_PAGE,
LICENSE_PAGE,
INSTALL_INTRO_PAGE,