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