From f8917522e4e42566353b9703ceec548bd5fb6ef3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herm=C3=A8s=20B=C3=A9lusca-Ma=C3=AFto?= Date: Mon, 24 Dec 2012 23:03:11 +0000 Subject: [PATCH] [FREELDR] - Menu titles --> Menu headers (see r57842). - In the same way we introduced menu headers, introduce menu footers, therefore we add the possibility, in mini-tui, of showing or hiding the "For troubleshooting and advanced startup options for ReactOS, press F8." message, only useful for the main menu (the one which shows the list of available OSes installed on the system). svn path=/trunk/; revision=58001 --- .../boot/freeldr/freeldr/arch/i386/custom.c | 2 +- reactos/boot/freeldr/freeldr/bootmgr.c | 3 ++- reactos/boot/freeldr/freeldr/include/ui.h | 21 +++++++++++++++---- reactos/boot/freeldr/freeldr/include/ui/gui.h | 2 +- .../boot/freeldr/freeldr/include/ui/noui.h | 2 +- reactos/boot/freeldr/freeldr/include/ui/tui.h | 17 +-------------- reactos/boot/freeldr/freeldr/options.c | 2 +- reactos/boot/freeldr/freeldr/ui/directui.c | 17 ++++++++------- reactos/boot/freeldr/freeldr/ui/minitui.c | 12 +++++------ reactos/boot/freeldr/freeldr/ui/noui.c | 2 +- reactos/boot/freeldr/freeldr/ui/tuimenu.c | 6 ++++-- reactos/boot/freeldr/freeldr/ui/ui.c | 4 ++-- 12 files changed, 45 insertions(+), 45 deletions(-) diff --git a/reactos/boot/freeldr/freeldr/arch/i386/custom.c b/reactos/boot/freeldr/freeldr/arch/i386/custom.c index b9d1c0d7fa1..10fe4e4ff68 100644 --- a/reactos/boot/freeldr/freeldr/arch/i386/custom.c +++ b/reactos/boot/freeldr/freeldr/arch/i386/custom.c @@ -43,7 +43,7 @@ VOID OptionMenuCustomBoot(VOID) ULONG CustomBootMenuCount = sizeof(CustomBootMenuList) / sizeof(CustomBootMenuList[0]); ULONG SelectedMenuItem; - if (!UiDisplayMenu("Please choose a boot method:", + if (!UiDisplayMenu("Please choose a boot method:", "", CustomBootMenuList, CustomBootMenuCount, 0, -1, diff --git a/reactos/boot/freeldr/freeldr/bootmgr.c b/reactos/boot/freeldr/freeldr/bootmgr.c index bfd6c3587a8..001a32095b3 100644 --- a/reactos/boot/freeldr/freeldr/bootmgr.c +++ b/reactos/boot/freeldr/freeldr/bootmgr.c @@ -266,12 +266,13 @@ VOID RunLoader(VOID) for (;;) { - // Redraw the backdrop UiDrawBackdrop(); // Show the operating system list menu if (!UiDisplayMenu("Please select the operating system to start:", + "For troubleshooting and advanced startup options for " + "ReactOS, press F8.", OperatingSystemDisplayNames, OperatingSystemCount, DefaultOperatingSystem, diff --git a/reactos/boot/freeldr/freeldr/include/ui.h b/reactos/boot/freeldr/freeldr/include/ui.h index 3bd94605ff3..cc379612d29 100644 --- a/reactos/boot/freeldr/freeldr/include/ui.h +++ b/reactos/boot/freeldr/freeldr/include/ui.h @@ -87,12 +87,25 @@ VOID UiFadeOut(VOID); // Fades the screen out // /////////////////////////////////////////////////////////////////////////////////////// -struct tagUI_MENU_INFO; -typedef struct tagUI_MENU_INFO UI_MENU_INFO, *PUI_MENU_INFO; +typedef struct tagUI_MENU_INFO +{ + PCSTR MenuHeader; + PCSTR MenuFooter; + + PCSTR *MenuItemList; + ULONG MenuItemCount; + LONG MenuTimeRemaining; + ULONG SelectedMenuItem; + + ULONG Left; + ULONG Top; + ULONG Right; + ULONG Bottom; +} UI_MENU_INFO, *PUI_MENU_INFO; typedef BOOLEAN (*UiMenuKeyPressFilterCallback)(ULONG KeyPress); -BOOLEAN UiDisplayMenu(PCSTR MenuTitle, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter); +BOOLEAN UiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter); /////////////////////////////////////////////////////////////////////////////////////// // @@ -122,7 +135,7 @@ typedef struct tagUIVTBL VOID (*FadeInBackdrop)(VOID); VOID (*FadeOut)(VOID); - BOOLEAN (*DisplayMenu)(PCSTR MenuTitle, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter); + BOOLEAN (*DisplayMenu)(PCSTR MenuHeader, PCSTR MenuFooter, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter); VOID (*DrawMenu)(PUI_MENU_INFO MenuInfo); } UIVTBL, *PUIVTBL; diff --git a/reactos/boot/freeldr/freeldr/include/ui/gui.h b/reactos/boot/freeldr/freeldr/include/ui/gui.h index 77a983a5eb9..f2412f11bfb 100644 --- a/reactos/boot/freeldr/freeldr/include/ui/gui.h +++ b/reactos/boot/freeldr/freeldr/include/ui/gui.h @@ -48,6 +48,6 @@ UCHAR GuiTextToFillStyle(PCSTR FillStyleText); // Converts the text fill into // Menu Functions // /////////////////////////////////////////////////////////////////////////////////////// -BOOLEAN GuiDisplayMenu(PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem); +BOOLEAN GuiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem); extern const UIVTBL GuiVtbl; diff --git a/reactos/boot/freeldr/freeldr/include/ui/noui.h b/reactos/boot/freeldr/freeldr/include/ui/noui.h index f779db121c0..8342504f14b 100644 --- a/reactos/boot/freeldr/freeldr/include/ui/noui.h +++ b/reactos/boot/freeldr/freeldr/include/ui/noui.h @@ -41,5 +41,5 @@ VOID NoUiFadeOut(VOID); // /////////////////////////////////////////////////////////////////////////////////////// -BOOLEAN NoUiDisplayMenu(PCSTR MenuTitle, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter); +BOOLEAN NoUiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter); VOID NoUiDrawMenu(PUI_MENU_INFO MenuInfo); diff --git a/reactos/boot/freeldr/freeldr/include/ui/tui.h b/reactos/boot/freeldr/freeldr/include/ui/tui.h index 3262c1210cb..da808851457 100644 --- a/reactos/boot/freeldr/freeldr/include/ui/tui.h +++ b/reactos/boot/freeldr/freeldr/include/ui/tui.h @@ -58,27 +58,12 @@ VOID TuiFadeOut(VOID); // Fades the screen out // /////////////////////////////////////////////////////////////////////////////////////// -struct tagUI_MENU_INFO -{ - PCSTR MenuTitle; - - PCSTR *MenuItemList; - ULONG MenuItemCount; - LONG MenuTimeRemaining; - ULONG SelectedMenuItem; - - ULONG Left; - ULONG Top; - ULONG Right; - ULONG Bottom; -}; - VOID NTAPI TuiCalcMenuBoxSize(PUI_MENU_INFO MenuInfo); VOID TuiDrawMenu(PUI_MENU_INFO MenuInfo); VOID NTAPI TuiDrawMenuBox(PUI_MENU_INFO MenuInfo); VOID NTAPI TuiDrawMenuItem(PUI_MENU_INFO MenuInfo, ULONG MenuItemNumber); ULONG NTAPI TuiProcessMenuKeyboardEvent(PUI_MENU_INFO MenuInfo, UiMenuKeyPressFilterCallback KeyPressFilter); -BOOLEAN TuiDisplayMenu(PCSTR MenuTitle, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter); +BOOLEAN TuiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter); /* Definitions for corners, depending on HORIZ and VERT */ #define UL (0xda) diff --git a/reactos/boot/freeldr/freeldr/options.c b/reactos/boot/freeldr/freeldr/options.c index 86b45dcbd82..adeb8b45b9d 100644 --- a/reactos/boot/freeldr/freeldr/options.c +++ b/reactos/boot/freeldr/freeldr/options.c @@ -101,7 +101,7 @@ VOID DoOptionsMenu(VOID) ULONG SelectedMenuItem; CHAR DebugChannelString[100]; - if (!UiDisplayMenu("Select an option:", + if (!UiDisplayMenu("Select an option:", "", OptionsMenuList, OptionsMenuItemCount, 0, -1, diff --git a/reactos/boot/freeldr/freeldr/ui/directui.c b/reactos/boot/freeldr/freeldr/ui/directui.c index 5bc90bb50cf..371cc67afd5 100644 --- a/reactos/boot/freeldr/freeldr/ui/directui.c +++ b/reactos/boot/freeldr/freeldr/ui/directui.c @@ -353,13 +353,13 @@ UiDrawMenu(IN PUI_MENU_INFO MenuInfo) { ULONG i; - /* No GUI status bar text, just minimal text. first to tell the user to choose */ + /* No GUI status bar text, just minimal text. Show the menu header. */ UiDrawText(0, MenuInfo->Top - 2, - MenuInfo->MenuTitle, + MenuInfo->MenuHeader, ATTR(UiMenuFgColor, UiMenuBgColor)); - /* Now tell him how to choose */ + /* Now tell the user how to choose */ UiDrawText(0, MenuInfo->Bottom + 1, "Use \x18 and \x19 to move the highlight to your choice.", @@ -369,11 +369,10 @@ UiDrawMenu(IN PUI_MENU_INFO MenuInfo) "Press ENTER to choose.", ATTR(UiMenuFgColor, UiMenuBgColor)); - /* And offer F8 options */ + /* And show the menu footer */ UiDrawText(0, UiScreenHeight - 4, - "For troubleshooting and advanced startup options for " - "ReactOS, press F8.", + MenuInfo->MenuFooter, ATTR(UiMenuFgColor, UiMenuBgColor)); /* Draw the menu box */ @@ -497,7 +496,8 @@ UiCalcMenuBoxSize(IN PUI_MENU_INFO MenuInfo) } BOOLEAN -UiDisplayMenu(IN PCSTR MenuTitle, +UiDisplayMenu(IN PCSTR MenuHeader, + IN PCSTR MenuFooter, IN PCSTR MenuItemList[], IN ULONG MenuItemCount, IN ULONG DefaultMenuItem, @@ -520,7 +520,8 @@ UiDisplayMenu(IN PCSTR MenuTitle, } /* Setup the MENU_INFO structure */ - MenuInformation.MenuTitle = MenuTitle; + MenuInformation.MenuHeader = MenuHeader; + MenuInformation.MenuFooter = MenuFooter; MenuInformation.MenuItemList = MenuItemList; MenuInformation.MenuItemCount = MenuItemCount; MenuInformation.MenuTimeRemaining = MenuTimeOut; diff --git a/reactos/boot/freeldr/freeldr/ui/minitui.c b/reactos/boot/freeldr/freeldr/ui/minitui.c index e5103047948..f33860f56ab 100644 --- a/reactos/boot/freeldr/freeldr/ui/minitui.c +++ b/reactos/boot/freeldr/freeldr/ui/minitui.c @@ -83,16 +83,15 @@ MiniTuiDrawMenu(PUI_MENU_INFO MenuInfo) UiDrawBackdrop(); // - // No GUI status bar text, just minimal text. first to tell the user to - // choose. + // No GUI status bar text, just minimal text. Show the menu header. // UiVtbl.DrawText(0, MenuInfo->Top - 2, - MenuInfo->MenuTitle, + MenuInfo->MenuHeader, ATTR(UiMenuFgColor, UiMenuBgColor)); // - // Now tell him how to choose + // Now tell the user how to choose // UiVtbl.DrawText(0, MenuInfo->Bottom + 1, @@ -104,12 +103,11 @@ MiniTuiDrawMenu(PUI_MENU_INFO MenuInfo) ATTR(UiMenuFgColor, UiMenuBgColor)); // - // And offer F8 options + // And show the menu footer // UiVtbl.DrawText(0, UiScreenHeight - 4, - "For troubleshooting and advanced startup options for " - "ReactOS, press F8.", + MenuInfo->MenuFooter, ATTR(UiMenuFgColor, UiMenuBgColor)); // diff --git a/reactos/boot/freeldr/freeldr/ui/noui.c b/reactos/boot/freeldr/freeldr/ui/noui.c index a8ee95268de..f705ed968a5 100644 --- a/reactos/boot/freeldr/freeldr/ui/noui.c +++ b/reactos/boot/freeldr/freeldr/ui/noui.c @@ -109,7 +109,7 @@ VOID NoUiFadeOut(VOID) // /////////////////////////////////////////////////////////////////////////////////////// -BOOLEAN NoUiDisplayMenu(PCSTR MenuTitle, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter) +BOOLEAN NoUiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter) { *SelectedMenuItem = DefaultMenuItem; return TRUE; diff --git a/reactos/boot/freeldr/freeldr/ui/tuimenu.c b/reactos/boot/freeldr/freeldr/ui/tuimenu.c index 861dd2075a0..4ccd13b780e 100644 --- a/reactos/boot/freeldr/freeldr/ui/tuimenu.c +++ b/reactos/boot/freeldr/freeldr/ui/tuimenu.c @@ -14,7 +14,8 @@ /* FUNCTIONS *****************************************************************/ BOOLEAN -TuiDisplayMenu(PCSTR MenuTitle, +TuiDisplayMenu(PCSTR MenuHeader, + PCSTR MenuFooter, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, @@ -42,7 +43,8 @@ TuiDisplayMenu(PCSTR MenuTitle, // // Setup the MENU_INFO structure // - MenuInformation.MenuTitle = MenuTitle; + MenuInformation.MenuHeader = MenuHeader; + MenuInformation.MenuFooter = MenuFooter; MenuInformation.MenuItemList = MenuItemList; MenuInformation.MenuItemCount = MenuItemCount; MenuInformation.MenuTimeRemaining = MenuTimeOut; diff --git a/reactos/boot/freeldr/freeldr/ui/ui.c b/reactos/boot/freeldr/freeldr/ui/ui.c index 015491d8bef..03de23c4a3e 100644 --- a/reactos/boot/freeldr/freeldr/ui/ui.c +++ b/reactos/boot/freeldr/freeldr/ui/ui.c @@ -442,9 +442,9 @@ VOID UiTruncateStringEllipsis(PCHAR StringText, ULONG MaxChars) } } -BOOLEAN UiDisplayMenu(PCSTR MenuTitle, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter) +BOOLEAN UiDisplayMenu(PCSTR MenuHeader, PCSTR MenuFooter, PCSTR MenuItemList[], ULONG MenuItemCount, ULONG DefaultMenuItem, LONG MenuTimeOut, ULONG* SelectedMenuItem, BOOLEAN CanEscape, UiMenuKeyPressFilterCallback KeyPressFilter) { - return UiVtbl.DisplayMenu(MenuTitle, MenuItemList, MenuItemCount, DefaultMenuItem, MenuTimeOut, SelectedMenuItem, CanEscape, KeyPressFilter); + return UiVtbl.DisplayMenu(MenuHeader, MenuFooter, MenuItemList, MenuItemCount, DefaultMenuItem, MenuTimeOut, SelectedMenuItem, CanEscape, KeyPressFilter); } VOID UiFadeInBackdrop(VOID)