From: srs5694 Date: Sat, 15 Dec 2012 04:39:21 +0000 (-0500) Subject: New "editor" option to the "hideui" configuration file token. X-Git-Url: https://code.delx.au/refind/commitdiff_plain/1ac23c87bf4bc008690a801516c48c8bc6c3426d?hp=6852cacd343b2821d6479f60bf6226355a8d9bb7 New "editor" option to the "hideui" configuration file token. --- diff --git a/NEWS.txt b/NEWS.txt index 2598bc9..7abbcc3 100644 --- a/NEWS.txt +++ b/NEWS.txt @@ -22,6 +22,9 @@ - Fixed bug that caused tools (shell, etc.) to launch when they were highlighted and F2 or Insert was pressed. +- Added "editor" option to the "hideui" token in refind.conf, which + disables the boot options editor. + - Added hints text to rEFInd main menu and sub-menus. This can be disabled by setting the new "hints" option to the "hideui" token in refind.conf. diff --git a/docs/refind/configfile.html b/docs/refind/configfile.html index 682b962..b21e833 100644 --- a/docs/refind/configfile.html +++ b/docs/refind/configfile.html @@ -145,8 +145,8 @@ timeout 20 hideui - banner, label, singleuser, hwtest, arrows, or all - Removes the specified user interface features. banner removes the banner graphic, label removes the text description of each tag and the countdown timer, singleuser removes the single-user option from the Mac OS sub-menu, hwtest removes the Mac OS hardware test option, arrows removes the arrows to the right or left of the OS tags when rEFInd finds too many OSes to display simultaneously, and all removes all of these options. You can specify multiple parameters with this option. The default is to set none of these values. + banner, label, singleuser, hwtest, arrows, hints, editor, or all + Removes the specified user interface features. banner removes the banner graphic, label removes the text description of each tag and the countdown timer, singleuser removes the single-user option from the Mac OS sub-menu, hwtest removes the Mac OS hardware test option, arrows removes the arrows to the right or left of the OS tags when rEFInd finds too many OSes to display simultaneously, hints removes the brief description of what basic keypressed do, editor disables the options editor, and all removes all of these options. You can specify multiple parameters with this option. The default is to set none of these values. icons_dir diff --git a/libeg/screen.c b/libeg/screen.c index bc097b5..2228959 100644 --- a/libeg/screen.c +++ b/libeg/screen.c @@ -176,6 +176,7 @@ BOOLEAN egSetScreenSize(IN OUT UINTN *ScreenWidth, IN OUT UINTN *ScreenHeight) { PauseForKey(); SwitchToGraphics(); } // if() + } else if (UgaDraw != NULL) { // UGA mode (EFI 1.x) // Try to use current color depth & refresh rate for new mode. Maybe not the best choice // in all cases, but I don't know how to probe for alternatives.... @@ -304,9 +305,15 @@ VOID egClearScreen(IN EG_PIXEL *Color) if (!egHasGraphics) return; - FillColor.Red = Color->r; - FillColor.Green = Color->g; - FillColor.Blue = Color->b; + if (Color != NULL) { + FillColor.Red = Color->r; + FillColor.Green = Color->g; + FillColor.Blue = Color->b; + } else { + FillColor.Red = 0x0; + FillColor.Green = 0x0; + FillColor.Blue = 0x0; + } FillColor.Reserved = 0; if (GraphicsOutput != NULL) { @@ -314,10 +321,9 @@ VOID egClearScreen(IN EG_PIXEL *Color) // layout, and the header from TianoCore actually defines them // to be the same type. refit_call10_wrapper(GraphicsOutput->Blt, GraphicsOutput, (EFI_GRAPHICS_OUTPUT_BLT_PIXEL *)&FillColor, EfiBltVideoFill, - 0, 0, 0, 0, egScreenWidth, egScreenHeight, 0); + 0, 0, 0, 0, egScreenWidth, egScreenHeight, 0); } else if (UgaDraw != NULL) { - refit_call10_wrapper(UgaDraw->Blt, UgaDraw, &FillColor, EfiUgaVideoFill, - 0, 0, 0, 0, egScreenWidth, egScreenHeight, 0); + refit_call10_wrapper(UgaDraw->Blt, UgaDraw, &FillColor, EfiUgaVideoFill, 0, 0, 0, 0, egScreenWidth, egScreenHeight, 0); } } diff --git a/refind.conf-sample b/refind.conf-sample index c15d905..7d2950a 100644 --- a/refind.conf-sample +++ b/refind.conf-sample @@ -17,7 +17,9 @@ timeout 20 # hwtest - the submenu option to run Apple's hardware test # arrows - scroll arrows on the OS selection tag line # hints - brief command summary in the menu +# editor - the options editor (+, F2, or Insert on boot options menu) # all - all of the above +# Default is none of these (all elements active) # #hideui singleuser #hideui all diff --git a/refind/config.c b/refind/config.c index 416461d..2f314e8 100644 --- a/refind/config.c +++ b/refind/config.c @@ -376,15 +376,17 @@ VOID ReadConfig(CHAR16 *FileName) } else if (StriCmp(FlagName, L"label") == 0) { GlobalConfig.HideUIFlags |= HIDEUI_FLAG_LABEL; } else if (StriCmp(FlagName, L"singleuser") == 0) { - GlobalConfig.HideUIFlags |= HIDEUI_FLAG_SINGLEUSER; + GlobalConfig.HideUIFlags |= HIDEUI_FLAG_SINGLEUSER; } else if (StriCmp(FlagName, L"hwtest") == 0) { - GlobalConfig.HideUIFlags |= HIDEUI_FLAG_HWTEST; + GlobalConfig.HideUIFlags |= HIDEUI_FLAG_HWTEST; } else if (StriCmp(FlagName, L"arrows") == 0) { GlobalConfig.HideUIFlags |= HIDEUI_FLAG_ARROWS; } else if (StriCmp(FlagName, L"hints") == 0) { GlobalConfig.HideUIFlags |= HIDEUI_FLAG_HINTS; + } else if (StriCmp(FlagName, L"editor") == 0) { + GlobalConfig.HideUIFlags |= HIDEUI_FLAG_EDITOR; } else if (StriCmp(FlagName, L"all") == 0) { - GlobalConfig.HideUIFlags = HIDEUI_ALL; + GlobalConfig.HideUIFlags = HIDEUI_FLAG_ALL; } else { Print(L" unknown hideui flag: '%s'\n", FlagName); } diff --git a/refind/config.h b/refind/config.h index 35c61e4..ce3f880 100644 --- a/refind/config.h +++ b/refind/config.h @@ -67,13 +67,15 @@ typedef struct { CHAR16 *End16Ptr; } REFIT_FILE; +#define HIDEUI_FLAG_NONE (0x0000) #define HIDEUI_FLAG_BANNER (0x0001) #define HIDEUI_FLAG_LABEL (0x0002) #define HIDEUI_FLAG_SINGLEUSER (0x0004) #define HIDEUI_FLAG_HWTEST (0x0008) #define HIDEUI_FLAG_ARROWS (0x0010) #define HIDEUI_FLAG_HINTS (0x0020) -#define HIDEUI_ALL ((0xffff)) +#define HIDEUI_FLAG_EDITOR (0x0040) +#define HIDEUI_FLAG_ALL ((0xffff)) #define CONFIG_FILE_NAME L"refind.conf" #define DONT_SCAN_FILES L"shim.efi,MokManager.efi,TextMode.efi,ebounce.efi,GraphicsConsole.efi" diff --git a/refind/main.c b/refind/main.c index 87d64ce..4a5c0cb 100644 --- a/refind/main.c +++ b/refind/main.c @@ -215,8 +215,8 @@ static EFI_STATUS StartEFIImageList(IN EFI_DEVICE_PATH **DevicePaths, // TODO: Track down the cause of this error and fix it, if possible. // ReturnStatus = Status = refit_call6_wrapper(BS->LoadImage, FALSE, SelfImageHandle, DevicePaths[DevicePathIndex], // ImageData, ImageSize, &ChildImageHandle); - ReturnStatus = Status = refit_call6_wrapper(BS->LoadImage, FALSE, SelfImageHandle, DevicePaths[DevicePathIndex], - NULL, 0, &ChildImageHandle); + ReturnStatus = Status = refit_call6_wrapper(BS->LoadImage, FALSE, SelfImageHandle, DevicePaths[DevicePathIndex], + NULL, 0, &ChildImageHandle); if ((Status == EFI_ACCESS_DENIED) && (ShimLoaded())) { FindVolumeAndFilename(DevicePaths[DevicePathIndex], &DeviceVolume, &loader); if (DeviceVolume != NULL) { diff --git a/refind/menu.c b/refind/menu.c index 8349858..7b74e51 100644 --- a/refind/menu.c +++ b/refind/menu.c @@ -358,7 +358,8 @@ static VOID IdentifyRows(IN SCROLL_STATE *State, IN REFIT_MENU_SCREEN *Screen) { // // generic menu function // -static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC StyleFunc, IN INTN DefaultEntryIndex, OUT REFIT_MENU_ENTRY **ChosenEntry) +static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC StyleFunc, IN OUT INTN *DefaultEntryIndex, + OUT REFIT_MENU_ENTRY **ChosenEntry) { SCROLL_STATE State; EFI_STATUS Status; @@ -380,8 +381,8 @@ static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC Sty StyleFunc(Screen, &State, MENU_FUNCTION_INIT, NULL); IdentifyRows(&State, Screen); // override the starting selection with the default index, if any - if (DefaultEntryIndex >= 0 && DefaultEntryIndex <= State.MaxIndex) { - State.CurrentSelection = DefaultEntryIndex; + if (*DefaultEntryIndex >= 0 && *DefaultEntryIndex <= State.MaxIndex) { + State.CurrentSelection = *DefaultEntryIndex; UpdateScroll(&State, SCROLL_NONE); } State.PaintAll = TRUE; @@ -487,6 +488,7 @@ static UINTN RunGenericMenu(IN REFIT_MENU_SCREEN *Screen, IN MENU_STYLE_FUNC Sty if (ChosenEntry) *ChosenEntry = Screen->Entries[State.CurrentSelection]; + *DefaultEntryIndex = State.CurrentSelection; return MenuExit; } /* static UINTN RunGenericMenu() */ @@ -595,7 +597,7 @@ static VOID TextMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_HINTS)) { refit_call3_wrapper(ST->ConOut->SetCursorPosition, ST->ConOut, 0, ConHeight - 1); refit_call2_wrapper(ST->ConOut->OutputString, ST->ConOut, - L"arrow keys to move cursor; Enter to boot; Insert or F2 for more options"); + L"Use arrow keys to move cursor; Enter to boot; Insert or F2 for more options"); } break; @@ -713,11 +715,16 @@ static VOID GraphicsMenuStyle(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *Sta EntriesPosX, EntriesPosY + i * TEXT_LINE_HEIGHT); } if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_HINTS)) { - DrawMenuText(L"arrow keys to move cursor; Enter to boot;", 0, - (UGAWidth - (41 * FONT_CELL_WIDTH)) / 2, UGAHeight - (FONT_CELL_HEIGHT * 3)); - DrawMenuText(L"Insert or F2 to edit options", 0, - (UGAWidth - (28 * FONT_CELL_WIDTH)) / 2, UGAHeight - (FONT_CELL_HEIGHT * 2)); - } + if (GlobalConfig.HideUIFlags & HIDEUI_FLAG_EDITOR) { + DrawMenuText(L"Use arrow keys to move cursor; Enter to boot", 0, + (UGAWidth - (45 * FONT_CELL_WIDTH)) / 2, UGAHeight - (FONT_CELL_HEIGHT * 3)); + } else { + DrawMenuText(L"Use arrow keys to move cursor; Enter to boot;", 0, + (UGAWidth - (45 * FONT_CELL_WIDTH)) / 2, UGAHeight - (FONT_CELL_HEIGHT * 3)); + DrawMenuText(L"Insert or F2 to edit options", 0, + (UGAWidth - (28 * FONT_CELL_WIDTH)) / 2, UGAHeight - (FONT_CELL_HEIGHT * 2)); + } // if/else + } // if break; case MENU_FUNCTION_PAINT_SELECTION: @@ -790,7 +797,7 @@ static VOID PaintAll(IN REFIT_MENU_SCREEN *Screen, IN SCROLL_STATE *State, UINTN (UGAWidth - LAYOUT_TEXT_WIDTH) >> 1, textPosY); if (!(GlobalConfig.HideUIFlags & HIDEUI_FLAG_HINTS)) { - DrawMainMenuText(L"arrow keys to move cursor; Enter to boot;", + DrawMainMenuText(L"Use arrow keys to move cursor; Enter to boot;", (UGAWidth - LAYOUT_TEXT_WIDTH) / 2, UGAHeight - (FONT_CELL_HEIGHT * 3)); DrawMainMenuText(L"Insert or F2 for more options", (UGAWidth - LAYOUT_TEXT_WIDTH) / 2, UGAHeight - (FONT_CELL_HEIGHT * 2)); @@ -946,6 +953,10 @@ static BOOLEAN EditOptions(LOADER_ENTRY *MenuEntry) { CHAR16 *EditedOptions; BOOLEAN retval = FALSE; + if (GlobalConfig.HideUIFlags & HIDEUI_FLAG_EDITOR) { + return FALSE; + } + refit_call4_wrapper(ST->ConOut->QueryMode, ST->ConOut, ST->ConOut->Mode->Mode, &x_max, &y_max); if (!GlobalConfig.TextOnly) @@ -967,12 +978,13 @@ static BOOLEAN EditOptions(LOADER_ENTRY *MenuEntry) { UINTN RunMenu(IN REFIT_MENU_SCREEN *Screen, OUT REFIT_MENU_ENTRY **ChosenEntry) { + INTN DefaultEntry = -1; MENU_STYLE_FUNC Style = TextMenuStyle; if (AllowGraphicsMode) Style = GraphicsMenuStyle; - return RunGenericMenu(Screen, Style, -1, ChosenEntry); + return RunGenericMenu(Screen, Style, &DefaultEntry, ChosenEntry); } UINTN RunMainMenu(IN REFIT_MENU_SCREEN *Screen, IN CHAR16* DefaultSelection, OUT REFIT_MENU_ENTRY **ChosenEntry) @@ -981,12 +993,12 @@ UINTN RunMainMenu(IN REFIT_MENU_SCREEN *Screen, IN CHAR16* DefaultSelection, OUT MENU_STYLE_FUNC MainStyle = TextMenuStyle; REFIT_MENU_ENTRY *TempChosenEntry; UINTN MenuExit = 0; - UINTN DefaultEntryIndex = -1; + INTN DefaultEntryIndex = -1; + INTN DefaultSubmenuIndex = -1; if (DefaultSelection != NULL) { // Find a menu entry that includes *DefaultSelection as a substring DefaultEntryIndex = FindMenuShortcutEntry(Screen, DefaultSelection); - // If that didn't work, should we scan more characters? For now, no. } if (AllowGraphicsMode) { @@ -995,12 +1007,12 @@ UINTN RunMainMenu(IN REFIT_MENU_SCREEN *Screen, IN CHAR16* DefaultSelection, OUT } while (!MenuExit) { - MenuExit = RunGenericMenu(Screen, MainStyle, DefaultEntryIndex, &TempChosenEntry); + MenuExit = RunGenericMenu(Screen, MainStyle, &DefaultEntryIndex, &TempChosenEntry); Screen->TimeoutSeconds = 0; if (MenuExit == MENU_EXIT_DETAILS) { if (TempChosenEntry->SubScreen != NULL) { - MenuExit = RunGenericMenu(TempChosenEntry->SubScreen, Style, -1, &TempChosenEntry); + MenuExit = RunGenericMenu(TempChosenEntry->SubScreen, Style, &DefaultSubmenuIndex, &TempChosenEntry); if (MenuExit == MENU_EXIT_ESCAPE || TempChosenEntry->Tag == TAG_RETURN) MenuExit = 0; if (MenuExit == MENU_EXIT_DETAILS) { diff --git a/refind/screen.c b/refind/screen.c index dc1f21d..4656e01 100644 --- a/refind/screen.c +++ b/refind/screen.c @@ -59,6 +59,7 @@ BOOLEAN AllowGraphicsMode; EG_PIXEL StdBackgroundPixel = { 0xbf, 0xbf, 0xbf, 0 }; EG_PIXEL MenuBackgroundPixel = { 0xbf, 0xbf, 0xbf, 0 }; +EG_PIXEL DarkBackgroundPixel = { 0x0, 0x0, 0x0, 0 }; static BOOLEAN GraphicsScreenDirty; @@ -181,8 +182,6 @@ VOID FinishTextScreen(IN BOOLEAN WaitAlways) VOID BeginExternalScreen(IN BOOLEAN UseGraphicsMode, IN CHAR16 *Title) { - EG_PIXEL DarkBackgroundPixel = { 0x0, 0x0, 0x0, 0 }; - if (!AllowGraphicsMode) UseGraphicsMode = FALSE; @@ -236,8 +235,9 @@ static VOID DrawScreenHeader(IN CHAR16 *Title) UINTN y; // clear to black background + egClearScreen(&DarkBackgroundPixel); // first clear in graphics mode refit_call2_wrapper(ST->ConOut->SetAttribute, ST->ConOut, ATTR_BASIC); - refit_call1_wrapper(ST->ConOut->ClearScreen, ST->ConOut); + refit_call1_wrapper(ST->ConOut->ClearScreen, ST->ConOut); // then clear in text mode // paint header background refit_call2_wrapper(ST->ConOut->SetAttribute, ST->ConOut, ATTR_BANNER);