ShellPkg/[hex]edit: use SimpleTextInEx to read console
[mirror_edk2.git] / ShellPkg / Library / UefiShellDebug1CommandsLib / HexEdit / HexEditorTypes.h
CommitLineData
632820d1 1/** @file\r
2 data types that are used by editor\r
3 \r
5563281f 4 Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved. <BR>\r
632820d1 5 This program and the accompanying materials\r
6 are licensed and made available under the terms and conditions of the BSD License\r
7 which accompanies this distribution. The full text of the license may be found at\r
8 http://opensource.org/licenses/bsd-license.php\r
9\r
10 THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,\r
11 WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.\r
12\r
13**/\r
14\r
15#ifndef _HEDITOR_TYPE_H_\r
16#define _HEDITOR_TYPE_H_\r
17\r
18#include "UefiShellDebug1CommandsLib.h"\r
19#include "EditTitleBar.h"\r
20\r
2b578de0 21#define EFI_EDITOR_LINE_LIST SIGNATURE_32 ('e', 'e', 'l', 'l')\r
632820d1 22\r
23#define ASCII_POSITION ((0x10 * 3) + 12)\r
24\r
25\r
26typedef struct {\r
27 UINTN Row;\r
28 UINTN Column;\r
29} HEFI_EDITOR_POSITION;\r
30\r
31typedef\r
32EFI_STATUS\r
33(*HEFI_MENU_ITEM_FUNCTION) (\r
34 VOID\r
35 );\r
36\r
37typedef struct {\r
38 CHAR16 Name[50];\r
39 CHAR16 Key[3];\r
40 HEFI_MENU_ITEM_FUNCTION Function;\r
41} HMENU_ITEMS;\r
42\r
43typedef struct _HEFI_EDITOR_LINE {\r
44 UINTN Signature;\r
45 UINT8 Buffer[0x10];\r
46 UINTN Size; // unit is Unicode\r
47 LIST_ENTRY Link;\r
48} HEFI_EDITOR_LINE;\r
49\r
50typedef struct _HEFI_EDITOR_MENU_ITEM {\r
51 CHAR16 NameToken;\r
52 CHAR16 FunctionKeyToken;\r
53 HEFI_MENU_ITEM_FUNCTION Function;\r
54} HEFI_EDITOR_MENU_ITEM;\r
55\r
56typedef struct {\r
57 UINT32 Foreground : 4;\r
58 UINT32 Background : 4;\r
59} HEFI_EDITOR_COLOR_ATTRIBUTES;\r
60\r
61typedef union {\r
62 HEFI_EDITOR_COLOR_ATTRIBUTES Colors;\r
28981267 63 UINTN Data;\r
632820d1 64} HEFI_EDITOR_COLOR_UNION;\r
65\r
66typedef struct {\r
67 UINTN Columns;\r
68 UINTN Rows;\r
69} HEFI_EDITOR_TEXT_MODE;\r
70\r
71\r
72typedef struct {\r
73 CHAR16 *Name;\r
74\r
75 UINTN BlockSize;\r
76 UINTN Size;\r
77 UINTN Offset;\r
78} HEFI_EDITOR_DISK_IMAGE;\r
79\r
80typedef struct {\r
e90153cb
RN
81 EFI_CPU_IO2_PROTOCOL *IoFncs;\r
82 UINTN Offset;\r
83 UINTN Size;\r
632820d1 84} HEFI_EDITOR_MEM_IMAGE;\r
85\r
86typedef struct {\r
87 CHAR16 *FileName;\r
88 UINTN Size; // file size\r
89 BOOLEAN ReadOnly; // file is read-only or not\r
90} HEFI_EDITOR_FILE_IMAGE;\r
91\r
92typedef struct {\r
93 LIST_ENTRY *ListHead; // list head of lines\r
94 HEFI_EDITOR_LINE *Lines; // lines of current file\r
95 UINTN NumLines; // number of lines\r
96 HEFI_EDITOR_LINE *CurrentLine; // current line cursor is at\r
97 HEFI_EDITOR_POSITION DisplayPosition; // cursor position in screen\r
98 HEFI_EDITOR_POSITION MousePosition; // mouse position in screen\r
99 HEFI_EDITOR_POSITION BufferPosition; // cursor position in buffer\r
100 UINTN LowVisibleRow; // the lowest visible row of file position\r
101 BOOLEAN HighBits; // cursor is at the high4 bits or low4 bits\r
102 BOOLEAN Modified; // BUFFER is modified or not\r
103 EDIT_FILE_TYPE BufferType;\r
104\r
105 HEFI_EDITOR_FILE_IMAGE *FileImage;\r
106 HEFI_EDITOR_DISK_IMAGE *DiskImage;\r
107 HEFI_EDITOR_MEM_IMAGE *MemImage;\r
108\r
109} HEFI_EDITOR_BUFFER_IMAGE;\r
110\r
632820d1 111typedef struct {\r
5563281f
RN
112 HEFI_EDITOR_BUFFER_IMAGE *BufferImage;\r
113\r
114 HEFI_EDITOR_COLOR_UNION ColorAttributes;\r
115 HEFI_EDITOR_POSITION ScreenSize; // row number and column number\r
116 EFI_SIMPLE_TEXT_INPUT_EX_PROTOCOL *TextInputEx;\r
117 BOOLEAN MouseSupported;\r
118 EFI_SIMPLE_POINTER_PROTOCOL *MouseInterface;\r
119 INT32 MouseAccumulatorX;\r
120 INT32 MouseAccumulatorY;\r
121\r
122 UINTN SelectStart; // starting from 1\r
123 UINTN SelectEnd; // starting from 1\r
632820d1 124} HEFI_EDITOR_GLOBAL_EDITOR;\r
125\r
126#endif\r