Changeset 99404 in vbox for trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c
- Timestamp:
- Apr 14, 2023 3:17:44 PM (21 months ago)
- Location:
- trunk/src/VBox/Devices/EFI/FirmwareNew
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Devices/EFI/FirmwareNew
-
Property svn:mergeinfo
changed from (toggle deleted branches)
to (toggle deleted branches)/vendor/edk2/current 103735-103757,103769-103776,129194-145445 /vendor/edk2/current 103735-103757,103769-103776,129194-156846
-
Property svn:mergeinfo
changed from (toggle deleted branches)
-
trunk/src/VBox/Devices/EFI/FirmwareNew/ShellPkg/Library/UefiShellDebug1CommandsLib/EditMenuBar.c
r80721 r99404 11 11 #include "EditStatusBar.h" 12 12 13 EDITOR_MENU_ITEM *MenuItems;14 MENU_ITEM_FUNCTION *ControlBasedMenuFunctions;15 UINTN 13 EDITOR_MENU_ITEM *MenuItems; 14 MENU_ITEM_FUNCTION *ControlBasedMenuFunctions; 15 UINTN NumItems; 16 16 17 17 /** … … 23 23 ) 24 24 { 25 SHELL_FREE_NON_NULL (MenuItems);25 SHELL_FREE_NON_NULL (MenuItems); 26 26 } 27 27 … … 41 41 CONST EDITOR_MENU_ITEM *ItemsWalker; 42 42 43 for (NumItems = 0, ItemsWalker = Items ; ItemsWalker != NULL && ItemsWalker->Function != NULL ; ItemsWalker++,NumItems++); 44 45 MenuItems = AllocateZeroPool((NumItems+1) * sizeof(EDITOR_MENU_ITEM)); 43 for (NumItems = 0, ItemsWalker = Items; ItemsWalker != NULL && ItemsWalker->Function != NULL; ItemsWalker++, NumItems++) { 44 } 45 46 MenuItems = AllocateZeroPool ((NumItems+1) * sizeof (EDITOR_MENU_ITEM)); 46 47 if (MenuItems == NULL) { 47 48 return EFI_OUT_OF_RESOURCES; 48 49 } 49 CopyMem(MenuItems, Items, (NumItems+1) * sizeof(EDITOR_MENU_ITEM)); 50 51 CopyMem (MenuItems, Items, (NumItems+1) * sizeof (EDITOR_MENU_ITEM)); 50 52 return EFI_SUCCESS; 51 53 } … … 66 68 return EFI_SUCCESS; 67 69 } 70 68 71 /** 69 72 Refresh function for the menu bar. … … 76 79 EFI_STATUS 77 80 MenuBarRefresh ( 78 IN CONST UINTN LastRow,79 IN CONST UINTN LastCol81 IN CONST UINTN LastRow, 82 IN CONST UINTN LastCol 80 83 ) 81 84 { 82 85 EDITOR_MENU_ITEM *Item; 83 UINTN 84 UINTN 85 UINTN 86 CHAR16 87 CHAR16 86 UINTN Col; 87 UINTN Row; 88 UINTN Width; 89 CHAR16 *NameString; 90 CHAR16 *FunctionKeyString; 88 91 89 92 // … … 98 101 EditorClearLine (LastRow - 2, LastCol, LastRow); 99 102 EditorClearLine (LastRow - 1, LastCol, LastRow); 100 EditorClearLine (LastRow , LastCol, LastRow); 101 103 EditorClearLine (LastRow, LastCol, LastRow); 102 104 103 105 // … … 105 107 // 106 108 for (Item = MenuItems; Item != NULL && Item->Function != NULL; Item++) { 107 108 109 NameString = HiiGetString(gShellDebug1HiiHandle, Item->NameToken, NULL); 110 111 112 Width = MAX ((StrLen (NameString) + 6), 20); 109 NameString = HiiGetString (gShellDebug1HiiHandle, Item->NameToken, NULL); 110 111 Width = MAX ((StrLen (NameString) + 6), 20); 113 112 if (((Col + Width) > LastCol)) { 114 113 Row++; … … 116 115 } 117 116 118 FunctionKeyString = HiiGetString (gShellDebug1HiiHandle, Item->FunctionKeyToken, NULL);117 FunctionKeyString = HiiGetString (gShellDebug1HiiHandle, Item->FunctionKeyToken, NULL); 119 118 120 119 ShellPrintEx ((INT32)(Col) - 1, (INT32)(Row) - 1, L"%E%s%N %H%s%N ", FunctionKeyString, NameString); … … 139 138 EFI_STATUS 140 139 MenuBarDispatchFunctionKey ( 141 IN CONST EFI_INPUT_KEY 142 ) 143 { 144 UINTN 145 146 Index 140 IN CONST EFI_INPUT_KEY *Key 141 ) 142 { 143 UINTN Index; 144 145 Index = Key->ScanCode - SCAN_F1; 147 146 148 147 // … … 168 167 EFI_STATUS 169 168 MenuBarDispatchControlHotKey ( 170 IN CONST EFI_KEY_DATA 171 ) 172 { 173 UINT16 169 IN CONST EFI_KEY_DATA *KeyData 170 ) 171 { 172 UINT16 ControlIndex; 174 173 175 174 // … … 179 178 180 179 if (((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) == 0) || 181 (KeyData->KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID)) { 180 (KeyData->KeyState.KeyShiftState == EFI_SHIFT_STATE_VALID)) 181 { 182 182 // 183 183 // For consoles that don't support/report shift state, … … 187 187 } else if (((KeyData->KeyState.KeyShiftState & EFI_SHIFT_STATE_VALID) != 0) && 188 188 ((KeyData->KeyState.KeyShiftState & (EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)) != 0) && 189 ((KeyData->KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)) == 0)) { 189 ((KeyData->KeyState.KeyShiftState & ~(EFI_SHIFT_STATE_VALID | EFI_RIGHT_CONTROL_PRESSED | EFI_LEFT_CONTROL_PRESSED)) == 0)) 190 { 190 191 // 191 192 // For consoles that supports/reports shift state, … … 198 199 } 199 200 } 200 if ((SCAN_CONTROL_Z < ControlIndex) 201 ||(NULL == ControlBasedMenuFunctions[ControlIndex])) 201 202 if ( (SCAN_CONTROL_Z < ControlIndex) 203 || (NULL == ControlBasedMenuFunctions[ControlIndex])) 202 204 { 203 205 return EFI_NOT_FOUND; 204 206 } 205 207 … … 207 209 return EFI_SUCCESS; 208 210 } 209 210
Note:
See TracChangeset
for help on using the changeset viewer.