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