]>
Commit | Line | Data |
---|---|---|
632820d1 | 1 | /** @file\r |
ba0014b9 | 2 | Defines BufferImage - the view of the file that is visible at any point,\r |
632820d1 | 3 | as well as the event handlers for editing the file\r |
ba0014b9 LG |
4 | \r |
5 | Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved. <BR>\r | |
56ba3746 | 6 | SPDX-License-Identifier: BSD-2-Clause-Patent\r |
632820d1 | 7 | \r |
8 | **/\r | |
9 | \r | |
10 | #ifndef _LIB_BUFFER_IMAGE_H_\r | |
11 | #define _LIB_BUFFER_IMAGE_H_\r | |
12 | \r | |
13 | #include "HexEditor.h"\r | |
14 | \r | |
a1d4bfcc | 15 | /**\r |
16 | Initialization function for HBufferImage\r | |
17 | \r | |
18 | @retval EFI_SUCCESS The operation was successful.\r | |
19 | @retval EFI_LOAD_ERROR A load error occured.\r | |
20 | **/\r | |
632820d1 | 21 | EFI_STATUS\r |
22 | HBufferImageInit (\r | |
23 | VOID\r | |
24 | );\r | |
a1d4bfcc | 25 | \r |
26 | /**\r | |
27 | Cleanup function for HBufferImage\r | |
28 | \r | |
29 | @retval EFI_SUCCESS The operation was successful.\r | |
30 | **/\r | |
632820d1 | 31 | EFI_STATUS\r |
32 | HBufferImageCleanup (\r | |
33 | VOID\r | |
34 | );\r | |
a1d4bfcc | 35 | \r |
36 | /**\r | |
37 | Refresh function for HBufferImage.\r | |
38 | \r | |
39 | @retval EFI_SUCCESS The operation was successful.\r | |
40 | @retval EFI_LOAD_ERROR A Load error occured.\r | |
41 | \r | |
42 | **/\r | |
632820d1 | 43 | EFI_STATUS\r |
44 | HBufferImageRefresh (\r | |
45 | VOID\r | |
46 | );\r | |
a1d4bfcc | 47 | \r |
48 | /**\r | |
49 | Dispatch input to different handler\r | |
50 | \r | |
51 | @param[in] Key The input key:\r | |
52 | the keys can be:\r | |
53 | ASCII KEY\r | |
54 | Backspace/Delete\r | |
55 | Direction key: up/down/left/right/pgup/pgdn\r | |
56 | Home/End\r | |
57 | INS\r | |
58 | \r | |
59 | @retval EFI_SUCCESS The operation was successful.\r | |
60 | @retval EFI_LOAD_ERROR A load error occured.\r | |
61 | @retval EFI_OUT_OF_RESOURCES A Memory allocation failed.\r | |
62 | **/\r | |
632820d1 | 63 | EFI_STATUS\r |
64 | HBufferImageHandleInput (\r | |
a1d4bfcc | 65 | IN EFI_INPUT_KEY *Key\r |
632820d1 | 66 | );\r |
a1d4bfcc | 67 | \r |
68 | /**\r | |
ba0014b9 | 69 | Backup function for HBufferImage. Only a few fields need to be backup.\r |
a1d4bfcc | 70 | This is for making the file buffer refresh as few as possible.\r |
71 | \r | |
72 | @retval EFI_SUCCESS The operation was successful.\r | |
73 | **/\r | |
632820d1 | 74 | EFI_STATUS\r |
75 | HBufferImageBackup (\r | |
76 | VOID\r | |
77 | );\r | |
78 | \r | |
a1d4bfcc | 79 | /**\r |
80 | Read an image into a buffer friom a source.\r | |
81 | \r | |
82 | @param[in] FileName Pointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer.\r | |
83 | @param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.\r | |
84 | @param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.\r | |
85 | @param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.\r | |
86 | @param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.\r | |
87 | @param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.\r | |
88 | @param[in] BufferType The type of buffer to save. IGNORED.\r | |
89 | @param[in] Recover TRUE for recovermode, FALSE otherwise.\r | |
90 | \r | |
91 | @return EFI_SUCCESS The operation was successful.\r | |
92 | **/\r | |
632820d1 | 93 | EFI_STATUS\r |
94 | HBufferImageRead (\r | |
a1d4bfcc | 95 | IN CONST CHAR16 *FileName,\r |
96 | IN CONST CHAR16 *DiskName,\r | |
97 | IN UINTN DiskOffset,\r | |
98 | IN UINTN DiskSize,\r | |
99 | IN UINTN MemOffset,\r | |
100 | IN UINTN MemSize,\r | |
101 | IN EDIT_FILE_TYPE BufferType,\r | |
102 | IN BOOLEAN Recover\r | |
632820d1 | 103 | );\r |
104 | \r | |
a1d4bfcc | 105 | /**\r |
106 | Save the current image.\r | |
632820d1 | 107 | \r |
a1d4bfcc | 108 | @param[in] FileName Pointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer.\r |
109 | @param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.\r | |
110 | @param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.\r | |
111 | @param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.\r | |
112 | @param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.\r | |
113 | @param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.\r | |
114 | @param[in] BufferType The type of buffer to save. IGNORED.\r | |
632820d1 | 115 | \r |
a1d4bfcc | 116 | @return EFI_SUCCESS The operation was successful.\r |
117 | **/\r | |
632820d1 | 118 | EFI_STATUS\r |
a1d4bfcc | 119 | HBufferImageSave (\r |
120 | IN CHAR16 *FileName,\r | |
121 | IN CHAR16 *DiskName,\r | |
122 | IN UINTN DiskOffset,\r | |
123 | IN UINTN DiskSize,\r | |
124 | IN UINTN MemOffset,\r | |
125 | IN UINTN MemSize,\r | |
126 | IN EDIT_FILE_TYPE BufferType\r | |
632820d1 | 127 | );\r |
128 | \r | |
a1d4bfcc | 129 | /**\r |
130 | According to cursor's file position, adjust screen display.\r | |
131 | \r | |
132 | @param[in] NewFilePosRow Row of file position ( start from 1 ).\r | |
133 | @param[in] NewFilePosCol Column of file position ( start from 1 ).\r | |
134 | @param[in] HighBits Cursor will on high4 bits or low4 bits.\r | |
135 | **/\r | |
632820d1 | 136 | VOID\r |
137 | HBufferImageMovePosition (\r | |
a1d4bfcc | 138 | IN UINTN NewFilePosRow,\r |
139 | IN UINTN NewFilePosCol,\r | |
140 | IN BOOLEAN HighBits\r | |
632820d1 | 141 | );\r |
142 | \r | |
632820d1 | 143 | \r |
a1d4bfcc | 144 | /**\r |
145 | Create a new line and append it to the line list.\r | |
146 | Fields affected:\r | |
147 | NumLines\r | |
ba0014b9 | 148 | Lines\r |
632820d1 | 149 | \r |
a1d4bfcc | 150 | @retval NULL create line failed.\r |
151 | @return the line created.\r | |
632820d1 | 152 | \r |
a1d4bfcc | 153 | **/\r |
154 | HEFI_EDITOR_LINE *\r | |
155 | HBufferImageCreateLine (\r | |
632820d1 | 156 | VOID\r |
157 | );\r | |
158 | \r | |
a1d4bfcc | 159 | /**\r |
ae724571 | 160 | Free the current image.\r |
161 | \r | |
162 | @retval EFI_SUCCESS The operation was successful.\r | |
163 | **/\r | |
632820d1 | 164 | EFI_STATUS\r |
165 | HBufferImageFree (\r | |
166 | VOID\r | |
ae724571 | 167 | );\r |
632820d1 | 168 | \r |
a1d4bfcc | 169 | /**\r |
170 | Delete character from buffer.\r | |
ba0014b9 | 171 | \r |
a1d4bfcc | 172 | @param[in] Pos Position, Pos starting from 0.\r |
173 | @param[in] Count The Count of characters to delete.\r | |
174 | @param[out] DeleteBuffer The DeleteBuffer.\r | |
175 | \r | |
ba0014b9 | 176 | @retval EFI_SUCCESS Success\r |
a1d4bfcc | 177 | **/\r |
632820d1 | 178 | EFI_STATUS\r |
179 | HBufferImageDeleteCharacterFromBuffer (\r | |
a1d4bfcc | 180 | IN UINTN Pos,\r |
181 | IN UINTN Count,\r | |
182 | OUT UINT8 *DeleteBuffer\r | |
632820d1 | 183 | );\r |
184 | \r | |
a1d4bfcc | 185 | /**\r |
186 | Add character to buffer, add before pos.\r | |
187 | \r | |
188 | @param[in] Pos Position, Pos starting from 0.\r | |
189 | @param[in] Count Count of characters to add.\r | |
190 | @param[in] AddBuffer Add buffer.\r | |
191 | \r | |
ba0014b9 | 192 | @retval EFI_SUCCESS Success.\r |
a1d4bfcc | 193 | **/\r |
632820d1 | 194 | EFI_STATUS\r |
195 | HBufferImageAddCharacterToBuffer (\r | |
a1d4bfcc | 196 | IN UINTN Pos,\r |
197 | IN UINTN Count,\r | |
198 | IN UINT8 *AddBuffer\r | |
632820d1 | 199 | );\r |
200 | \r | |
a1d4bfcc | 201 | /**\r |
202 | Change the raw buffer to a list of lines for the UI.\r | |
ba0014b9 | 203 | \r |
a1d4bfcc | 204 | @param[in] Buffer The pointer to the buffer to fill.\r |
205 | @param[in] Bytes The size of the buffer in bytes.\r | |
206 | \r | |
207 | @retval EFI_SUCCESS The operation was successful.\r | |
208 | @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r | |
209 | **/\r | |
632820d1 | 210 | EFI_STATUS\r |
211 | HBufferImageBufferToList (\r | |
a1d4bfcc | 212 | IN VOID *Buffer,\r |
213 | IN UINTN Bytes\r | |
632820d1 | 214 | );\r |
215 | \r | |
a1d4bfcc | 216 | /**\r |
217 | Change the list of lines from the UI to a raw buffer.\r | |
ba0014b9 | 218 | \r |
a1d4bfcc | 219 | @param[in] Buffer The pointer to the buffer to fill.\r |
220 | @param[in] Bytes The size of the buffer in bytes.\r | |
221 | \r | |
222 | @retval EFI_SUCCESS The operation was successful.\r | |
223 | **/\r | |
632820d1 | 224 | EFI_STATUS\r |
225 | HBufferImageListToBuffer (\r | |
a1d4bfcc | 226 | IN VOID *Buffer,\r |
227 | IN UINTN Bytes\r | |
632820d1 | 228 | );\r |
229 | \r | |
a1d4bfcc | 230 | /**\r |
231 | Move the mouse in the image buffer.\r | |
232 | \r | |
233 | @param[in] TextX The x-coordinate.\r | |
234 | @param[in] TextY The y-coordinate.\r | |
235 | **/\r | |
632820d1 | 236 | VOID\r |
237 | HBufferImageAdjustMousePosition (\r | |
a1d4bfcc | 238 | IN INT32 TextX,\r |
239 | IN INT32 TextY\r | |
632820d1 | 240 | );\r |
241 | \r | |
a1d4bfcc | 242 | /**\r |
243 | Function to decide if a column number is stored in the high bits.\r | |
244 | \r | |
245 | @param[in] Column The column to examine.\r | |
246 | @param[out] FCol The actual column number.\r | |
247 | \r | |
248 | @retval TRUE The actual column was in high bits and is now in FCol.\r | |
249 | @retval FALSE There was not a column number in the high bits.\r | |
250 | **/\r | |
632820d1 | 251 | BOOLEAN\r |
252 | HBufferImageIsAtHighBits (\r | |
a1d4bfcc | 253 | IN UINTN Column,\r |
254 | OUT UINTN *FCol\r | |
632820d1 | 255 | );\r |
256 | \r | |
a1d4bfcc | 257 | /**\r |
258 | Get the size of the open buffer.\r | |
259 | \r | |
260 | @retval The size in bytes.\r | |
261 | **/\r | |
632820d1 | 262 | UINTN\r |
263 | HBufferImageGetTotalSize (\r | |
264 | VOID\r | |
265 | );\r | |
266 | \r | |
632820d1 | 267 | #endif\r |