/** @file\r
Implements titlebar interface functions.\r
\r
- Copyright (c) 2005 - 2011, Intel Corporation. All rights reserved. <BR>\r
- This program and the accompanying materials\r
- are licensed and made available under the terms and conditions of the BSD License\r
- which accompanies this distribution. The full text of the license may be found at\r
- http://opensource.org/licenses/bsd-license.php\r
-\r
- THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
- WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
+ (C) Copyright 2013 Hewlett-Packard Development Company, L.P.<BR>\r
+ Copyright (c) 2005 - 2014, Intel Corporation. All rights reserved. <BR>\r
+ SPDX-License-Identifier: BSD-2-Clause-Patent\r
\r
**/\r
\r
@retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r
**/\r
EFI_STATUS\r
-EFIAPI\r
MainTitleBarInit (\r
- CONST CHAR16 *Prompt\r
+ CONST CHAR16 *Prompt\r
)\r
{\r
SHELL_FREE_NON_NULL (Title);\r
//\r
Title = CatSPrint (NULL, L"%s", Prompt);\r
}\r
+\r
if (Title == NULL) {\r
return EFI_OUT_OF_RESOURCES;\r
}\r
Clean up the memory used.\r
**/\r
VOID\r
-EFIAPI\r
MainTitleBarCleanup (\r
VOID\r
)\r
}\r
\r
typedef struct {\r
- UINT32 Foreground : 4;\r
- UINT32 Background : 4;\r
+ UINT32 Foreground : 4;\r
+ UINT32 Background : 4;\r
} TITLE_BAR_COLOR_ATTRIBUTES;\r
\r
typedef union {\r
- TITLE_BAR_COLOR_ATTRIBUTES Colors;\r
- UINTN Data;\r
+ TITLE_BAR_COLOR_ATTRIBUTES Colors;\r
+ UINTN Data;\r
} TITLE_BAR_COLOR_UNION;\r
\r
/**\r
@retval EFI_SUCCESS The operation was successful.\r
**/\r
EFI_STATUS\r
-EFIAPI\r
MainTitleBarRefresh (\r
- IN CONST CHAR16 *FileName OPTIONAL,\r
- IN CONST EDIT_FILE_TYPE FileType,\r
- IN CONST BOOLEAN ReadOnly,\r
- IN CONST BOOLEAN Modified,\r
- IN CONST UINTN LastCol,\r
- IN CONST UINTN LastRow,\r
- IN CONST UINTN Offset,\r
- IN CONST UINTN Size\r
+ IN CONST CHAR16 *FileName OPTIONAL,\r
+ IN CONST EDIT_FILE_TYPE FileType,\r
+ IN CONST BOOLEAN ReadOnly,\r
+ IN CONST BOOLEAN Modified,\r
+ IN CONST UINTN LastCol,\r
+ IN CONST UINTN LastRow,\r
+ IN CONST UINTN Offset,\r
+ IN CONST UINTN Size\r
)\r
{\r
- TITLE_BAR_COLOR_UNION Orig;\r
- TITLE_BAR_COLOR_UNION New;\r
- CONST CHAR16 *FileNameTmp;\r
- INTN TempInteger;\r
-\r
+ TITLE_BAR_COLOR_UNION Orig;\r
+ TITLE_BAR_COLOR_UNION New;\r
+ CONST CHAR16 *FileNameTmp;\r
+ INTN TempInteger;\r
\r
//\r
// backup the old screen attributes\r
//\r
Orig.Data = gST->ConOut->Mode->Attribute;\r
- New.Colors.Foreground = Orig.Colors.Background;\r
- New.Colors.Background = Orig.Colors.Foreground;\r
+ New.Data = 0;\r
+ New.Colors.Foreground = Orig.Colors.Background & 0xF;\r
+ New.Colors.Background = Orig.Colors.Foreground & 0x7;\r
\r
- gST->ConOut->SetAttribute (gST->ConOut, New.Data);\r
+ gST->ConOut->SetAttribute (gST->ConOut, New.Data & 0x7F);\r
\r
//\r
// clear the title line\r
Title\r
);\r
}\r
+\r
if (FileName == NULL) {\r
gST->ConOut->SetAttribute (gST->ConOut, Orig.Data);\r
return EFI_SUCCESS;\r
}\r
+\r
//\r
// First Extract the FileName from fullpath\r
//\r
// the space for file name is 20 characters\r
//\r
if (StrLen (FileNameTmp) <= 20) {\r
- ShellPrintEx (-1,-1, L"%s ", FileNameTmp);\r
+ ShellPrintEx (-1, -1, L"%s ", FileNameTmp);\r
for (TempInteger = StrLen (FileNameTmp); TempInteger < 20; TempInteger++) {\r
- ShellPrintEx (-1,-1, L" ");\r
+ ShellPrintEx (-1, -1, L" ");\r
}\r
-\r
} else {\r
for (TempInteger = 0; TempInteger < 17; TempInteger++) {\r
- ShellPrintEx (-1,-1, L"%c", FileNameTmp[TempInteger]);\r
+ ShellPrintEx (-1, -1, L"%c", FileNameTmp[TempInteger]);\r
}\r
+\r
//\r
// print "..."\r
//\r
- ShellPrintEx (-1,-1, L"... ");\r
+ ShellPrintEx (-1, -1, L"... ");\r
}\r
+\r
//\r
// print file type field\r
//\r
- switch (FileType){\r
+ switch (FileType) {\r
case FileTypeAscii:\r
case FileTypeUnicode:\r
- if (FileType == FileTypeAscii){\r
- ShellPrintEx (-1,-1, L" UNICODE ");\r
+ if (FileType == FileTypeAscii) {\r
+ ShellPrintEx (-1, -1, L" ASCII ");\r
+ } else {\r
+ ShellPrintEx (-1, -1, L" UNICODE ");\r
}\r
+\r
//\r
// print read-only field for text files\r
//\r
if (ReadOnly) {\r
- ShellPrintEx (-1,-1, L"ReadOnly ");\r
+ ShellPrintEx (-1, -1, L"ReadOnly ");\r
} else {\r
- ShellPrintEx (-1,-1, L" ");\r
+ ShellPrintEx (-1, -1, L" ");\r
}\r
- break;\r
+\r
+ break;\r
case FileTypeDiskBuffer:\r
case FileTypeMemBuffer:\r
//\r
// Print the offset.\r
//\r
- ShellPrintEx (-1,-1, L"Offset %X | Size %X", Offset, Size);\r
+ ShellPrintEx (-1, -1, L"Offset %X | Size %X", Offset, Size);\r
case FileTypeFileBuffer:\r
break;\r
default:\r
break;\r
}\r
+\r
//\r
// print modified field\r
//\r
if (Modified) {\r
- ShellPrintEx (-1,-1, L"Modified");\r
+ ShellPrintEx (-1, -1, L"Modified");\r
}\r
+\r
//\r
// restore the old attribute\r
//\r