2 Defines BufferImage - the view of the file that is visible at any point,
3 as well as the event handlers for editing the file
5 Copyright (c) 2005 - 2018, Intel Corporation. All rights reserved. <BR>
6 SPDX-License-Identifier: BSD-2-Clause-Patent
10 #ifndef _LIB_BUFFER_IMAGE_H_
11 #define _LIB_BUFFER_IMAGE_H_
13 #include "HexEditor.h"
16 Initialization function for HBufferImage
18 @retval EFI_SUCCESS The operation was successful.
19 @retval EFI_LOAD_ERROR A load error occurred.
27 Cleanup function for HBufferImage
29 @retval EFI_SUCCESS The operation was successful.
37 Refresh function for HBufferImage.
39 @retval EFI_SUCCESS The operation was successful.
40 @retval EFI_LOAD_ERROR A Load error occurred.
49 Dispatch input to different handler
51 @param[in] Key The input key:
55 Direction key: up/down/left/right/pgup/pgdn
59 @retval EFI_SUCCESS The operation was successful.
60 @retval EFI_LOAD_ERROR A load error occurred.
61 @retval EFI_OUT_OF_RESOURCES A Memory allocation failed.
64 HBufferImageHandleInput (
69 Backup function for HBufferImage. Only a few fields need to be backup.
70 This is for making the file buffer refresh as few as possible.
72 @retval EFI_SUCCESS The operation was successful.
80 Read an image into a buffer friom a source.
82 @param[in] FileName Pointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer.
83 @param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.
84 @param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.
85 @param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.
86 @param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.
87 @param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.
88 @param[in] BufferType The type of buffer to save. IGNORED.
89 @param[in] Recover TRUE for recovermode, FALSE otherwise.
91 @return EFI_SUCCESS The operation was successful.
95 IN CONST CHAR16
*FileName
,
96 IN CONST CHAR16
*DiskName
,
101 IN EDIT_FILE_TYPE BufferType
,
106 Save the current image.
108 @param[in] FileName Pointer to the file name. OPTIONAL and ignored if not FileTypeFileBuffer.
109 @param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.
110 @param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.
111 @param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.
112 @param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.
113 @param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.
114 @param[in] BufferType The type of buffer to save. IGNORED.
116 @return EFI_SUCCESS The operation was successful.
126 IN EDIT_FILE_TYPE BufferType
130 According to cursor's file position, adjust screen display.
132 @param[in] NewFilePosRow Row of file position ( start from 1 ).
133 @param[in] NewFilePosCol Column of file position ( start from 1 ).
134 @param[in] HighBits Cursor will on high4 bits or low4 bits.
137 HBufferImageMovePosition (
138 IN UINTN NewFilePosRow
,
139 IN UINTN NewFilePosCol
,
144 Create a new line and append it to the line list.
149 @retval NULL create line failed.
150 @return the line created.
154 HBufferImageCreateLine (
159 Free the current image.
161 @retval EFI_SUCCESS The operation was successful.
169 Delete character from buffer.
171 @param[in] Pos Position, Pos starting from 0.
172 @param[in] Count The Count of characters to delete.
173 @param[out] DeleteBuffer The DeleteBuffer.
175 @retval EFI_SUCCESS Success
178 HBufferImageDeleteCharacterFromBuffer (
181 OUT UINT8
*DeleteBuffer
185 Add character to buffer, add before pos.
187 @param[in] Pos Position, Pos starting from 0.
188 @param[in] Count Count of characters to add.
189 @param[in] AddBuffer Add buffer.
191 @retval EFI_SUCCESS Success.
194 HBufferImageAddCharacterToBuffer (
201 Change the raw buffer to a list of lines for the UI.
203 @param[in] Buffer The pointer to the buffer to fill.
204 @param[in] Bytes The size of the buffer in bytes.
206 @retval EFI_SUCCESS The operation was successful.
207 @retval EFI_OUT_OF_RESOURCES A memory allocation failed.
210 HBufferImageBufferToList (
216 Change the list of lines from the UI to a raw buffer.
218 @param[in] Buffer The pointer to the buffer to fill.
219 @param[in] Bytes The size of the buffer in bytes.
221 @retval EFI_SUCCESS The operation was successful.
224 HBufferImageListToBuffer (
230 Move the mouse in the image buffer.
232 @param[in] TextX The x-coordinate.
233 @param[in] TextY The y-coordinate.
236 HBufferImageAdjustMousePosition (
242 Function to decide if a column number is stored in the high bits.
244 @param[in] Column The column to examine.
245 @param[out] FCol The actual column number.
247 @retval TRUE The actual column was in high bits and is now in FCol.
248 @retval FALSE There was not a column number in the high bits.
251 HBufferImageIsAtHighBits (
257 Get the size of the open buffer.
259 @retval The size in bytes.
262 HBufferImageGetTotalSize (