\r
BOOLEAN HBufferImageMouseNeedRefresh;\r
\r
+/**\r
+ Initialization function for HBufferImage\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_LOAD_ERROR A load error occured.\r
+**/\r
EFI_STATUS\r
HBufferImageInit (\r
VOID\r
)\r
-/**
- Initialization function for HBufferImage\r
-\r
- \r
-\r
- None\r
-\r
- \r
-\r
- EFI_SUCCESS\r
- EFI_LOAD_ERROR\r
-\r
-**/\r
{\r
EFI_STATUS Status;\r
\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Backup function for HBufferImage. Only a few fields need to be backup. \r
+ This is for making the file buffer refresh as few as possible.\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+**/\r
EFI_STATUS\r
HBufferImageBackup (\r
VOID\r
)\r
-/**
- Backup function for HBufferImage\r
- Only a few fields need to be backup. \r
- This is for making the file buffer refresh \r
- as few as possible.\r
-\r
- \r
-\r
- None\r
-\r
- \r
-\r
- EFI_SUCCESS\r
-\r
-**/\r
{\r
HBufferImageBackupVar.MousePosition = HBufferImage.MousePosition;\r
\r
return EFI_SUCCESS;\r
}\r
\r
-EFI_STATUS\r
-HBufferImageFreeLines (\r
- VOID\r
- )\r
-/**
- Free all the lines in HBufferImage\r
+/**\r
+ Free all the lines in HBufferImage.\r
Fields affected:\r
Lines\r
CurrentLine\r
NumLines\r
ListHead \r
\r
- \r
-\r
- None\r
-\r
- \r
-\r
- EFI_SUCCESS\r
-\r
+ @retval EFI_SUCCESS The operation was successful.\r
**/\r
+EFI_STATUS\r
+HBufferImageFreeLines (\r
+ VOID\r
+ )\r
{\r
HFreeLines (HBufferImage.ListHead, HBufferImage.Lines);\r
\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Cleanup function for HBufferImage\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+**/\r
EFI_STATUS\r
HBufferImageCleanup (\r
VOID\r
)\r
-/**
- Cleanup function for HBufferImage\r
-\r
- \r
-\r
- None\r
-\r
- \r
-\r
- EFI_SUCCESS\r
-\r
-**/\r
{\r
EFI_STATUS Status;\r
\r
\r
HFileImageCleanup ();\r
HDiskImageCleanup ();\r
- HMemImageCleanup ();\r
\r
return Status;\r
\r
}\r
\r
+/**\r
+ Print Line on Row\r
+\r
+ @param[in] Line The lline to print.\r
+ @param[in] Row The row on screen ( begin from 1 ).\r
+ @param[in] FRow The FRow.\r
+ @param[in] Orig The original color.\r
+ @param[in] New The color to print with.\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+**/\r
EFI_STATUS\r
HBufferImagePrintLine (\r
IN HEFI_EDITOR_LINE *Line,\r
IN HEFI_EDITOR_COLOR_UNION New\r
\r
)\r
-/**
- Print Line on Row\r
-\r
- \r
-\r
- Line - Line to print\r
- Row - Row on screen ( begin from 1 )\r
- FRow - FRow\r
- Orig - Orig\r
- New - Light display\r
-\r
- \r
-\r
- EFI_SUCCESS\r
-\r
-**/\r
{\r
\r
UINTN Index;\r
\r
}\r
\r
- if (HEditorMouseAction == FALSE) {\r
+ if (!HEditorMouseAction) {\r
ShellPrintEx (\r
0,\r
(INT32)Row - 1,\r
//\r
// PRINT the buffer content\r
//\r
- if (HEditorMouseAction == FALSE) {\r
+ if (!HEditorMouseAction) {\r
for (Index = 0; Index < 0x10 && Index < Line->Size; Index++) {\r
Pos = ASCII_POSITION + Index;\r
\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Function to decide if a column number is stored in the high bits.\r
+\r
+ @param[in] Column The column to examine.\r
+ @param[out] FCol The actual column number.\r
+\r
+ @retval TRUE The actual column was in high bits and is now in FCol.\r
+ @retval FALSE There was not a column number in the high bits.\r
+**/\r
BOOLEAN\r
HBufferImageIsAtHighBits (\r
IN UINTN Column,\r
\r
*FCol = (Column / 3) + 1;\r
\r
- if (!(Column % 3)) {\r
+ if (Column % 3 == 0) {\r
return TRUE;\r
}\r
\r
return FALSE;\r
}\r
\r
+/**\r
+ Decide if a point is in the already selected area.\r
+\r
+ @param[in] MouseRow The row of the point to test.\r
+ @param[in] MouseCol The col of the point to test.\r
+\r
+ @retval TRUE The point is in the selected area.\r
+ @retval FALSE The point is not in the selected area.\r
+**/\r
BOOLEAN\r
HBufferImageIsInSelectedArea (\r
IN UINTN MouseRow,\r
return TRUE;\r
}\r
\r
+/**\r
+ Set mouse position according to HBufferImage.MousePosition.\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+**/\r
EFI_STATUS\r
HBufferImageRestoreMousePosition (\r
VOID\r
return EFI_SUCCESS;\r
}\r
\r
+/**\r
+ Set cursor position according to HBufferImage.DisplayPosition.\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+**/\r
EFI_STATUS\r
HBufferImageRestorePosition (\r
VOID\r
)\r
-/**
- Set cursor position according to HBufferImage.DisplayPosition.\r
-\r
- \r
-\r
- None\r
-\r
- \r
-\r
- EFI_SUCCESS\r
-\r
-**/\r
{\r
//\r
// set cursor position\r
return EFI_SUCCESS;\r
}\r
\r
-/**
+/**\r
Refresh function for HBufferImage.\r
\r
@retval EFI_SUCCESS The operation was successful.\r
} while (Link != HBufferImage.ListHead && Row <= EndRow);\r
\r
while (Row <= EndRow) {\r
- HEditorClearLine (Row);\r
+ EditorClearLine (Row, HMainEditor.ScreenSize.Column, HMainEditor.ScreenSize.Row);\r
Row++;\r
}\r
//\r
@param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
@param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
@param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
- @param[in] MemoryOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.\r
- @param[in] MemorySize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.\r
+ @param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.\r
+ @param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.\r
@param[in] BufferType The type of buffer to save. IGNORED.\r
@param[in] Recover TRUE for recovermode, FALSE otherwise.\r
\r
@param[in] DiskName Pointer to the disk name. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
@param[in] DiskOffset Offset into the disk. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
@param[in] DiskSize Size of the disk buffer. OPTIONAL and ignored if not FileTypeDiskBuffer.\r
- @param[in] MemoryOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.\r
- @param[in] MemorySize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.\r
+ @param[in] MemOffset Offset into the Memory. OPTIONAL and ignored if not FileTypeMemBuffer.\r
+ @param[in] MemSize Size of the Memory buffer. OPTIONAL and ignored if not FileTypeMemBuffer.\r
@param[in] BufferType The type of buffer to save. IGNORED.\r
\r
@return EFI_SUCCESS The operation was successful.\r
return Status;\r
}\r
\r
-/**
+/**\r
Create a new line and append it to the line list.\r
Fields affected:\r
NumLines\r
return Line;\r
}\r
\r
-/**
+/**\r
Free the current image.\r
\r
@retval EFI_SUCCESS The operation was successful.\r
return EFI_SUCCESS;\r
}\r
\r
-/**
- Dispatch input to different handler\r
-\r
- @param[in] Key The input key:\r
- the keys can be:\r
- ASCII KEY\r
- Backspace/Delete\r
- Direction key: up/down/left/right/pgup/pgdn\r
- Home/End\r
- INS\r
-\r
- @retval EFI_SUCCESS The operation was successful.\r
- @retval EFI_LOAD_ERROR A load error occured.\r
- @retval EFI_OUT_OF_RESOURCES A Memory allocation failed.\r
-**/\r
-EFI_STATUS\r
-HBufferImageHandleInput (\r
- IN EFI_INPUT_KEY *Key\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- Status = EFI_SUCCESS;\r
-\r
- switch (Key->ScanCode) {\r
- //\r
- // ordinary key\r
- //\r
- case SCAN_NULL:\r
- Status = HBufferImageDoCharInput (Key->UnicodeChar);\r
- break;\r
-\r
- //\r
- // up arrow\r
- //\r
- case SCAN_UP:\r
- Status = HBufferImageScrollUp ();\r
- break;\r
-\r
- //\r
- // down arrow\r
- //\r
- case SCAN_DOWN:\r
- Status = HBufferImageScrollDown ();\r
- break;\r
-\r
- //\r
- // right arrow\r
- //\r
- case SCAN_RIGHT:\r
- Status = HBufferImageScrollRight ();\r
- break;\r
-\r
- //\r
- // left arrow\r
- //\r
- case SCAN_LEFT:\r
- Status = HBufferImageScrollLeft ();\r
- break;\r
-\r
- //\r
- // page up\r
- //\r
- case SCAN_PAGE_UP:\r
- Status = HBufferImagePageUp ();\r
- break;\r
-\r
- //\r
- // page down\r
- //\r
- case SCAN_PAGE_DOWN:\r
- Status = HBufferImagePageDown ();\r
- break;\r
-\r
- //\r
- // delete\r
- //\r
- case SCAN_DELETE:\r
- Status = HBufferImageDoDelete ();\r
- break;\r
-\r
- //\r
- // home\r
- //\r
- case SCAN_HOME:\r
- Status = HBufferImageHome ();\r
- break;\r
-\r
- //\r
- // end\r
- //\r
- case SCAN_END:\r
- Status = HBufferImageEnd ();\r
- break;\r
-\r
- default:\r
- Status = StatusBarSetStatusString (L"Unknown Command");\r
- break;\r
- }\r
-\r
- return Status;\r
-}\r
-\r
-/**
- ASCII key + Backspace + return.\r
-\r
- @param[in] Char The input char.\r
-\r
- @retval EFI_SUCCESS The operation was successful.\r
- @retval EFI_LOAD_ERROR A load error occured.\r
- @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-HBufferImageDoCharInput (\r
- IN CHAR16 Char\r
- )\r
-{\r
- EFI_STATUS Status;\r
-\r
- Status = EFI_SUCCESS;\r
-\r
- switch (Char) {\r
- case 0:\r
- break;\r
-\r
- case 0x08:\r
- Status = HBufferImageDoBackspace ();\r
- break;\r
-\r
- case 0x09:\r
- case 0x0a:\r
- case 0x0d:\r
- //\r
- // Tabs, Returns are thought as nothing\r
- //\r
- break;\r
-\r
- default:\r
- //\r
- // DEAL WITH ASCII CHAR, filter out thing like ctrl+f\r
- //\r
- if (Char > 127 || Char < 32) {\r
- Status = StatusBarSetStatusString (L"Unknown Command");\r
- } else {\r
- Status = HBufferImageAddChar (Char);\r
- }\r
-\r
- break;\r
- }\r
-\r
- return Status;\r
-}\r
-\r
/**\r
change char to int value based on Hex.\r
\r
}\r
\r
/**\r
- Check user specified FileRow and FileCol is in current screen.\r
-\r
- @param[in] FileRow Row of file position ( start from 1 ).\r
+ Delete the previous character.\r
\r
- @retval TRUE It's on the current screen.\r
- @retval FALSE It's not on the current screen.\r
+ @retval EFI_SUCCESS The operationw as successful.\r
**/\r
-BOOLEAN\r
-HInCurrentScreen (\r
- IN UINTN FileRow\r
+EFI_STATUS\r
+EFIAPI\r
+HBufferImageDoBackspace (\r
+ VOID\r
)\r
{\r
- if (FileRow >= HBufferImage.LowVisibleRow && FileRow <= HBufferImage.LowVisibleRow + (HMainEditor.ScreenSize.Row - 5) - 1) {\r
- return TRUE;\r
- }\r
+ HEFI_EDITOR_LINE *Line;\r
\r
- return FALSE;\r
+ UINTN FileColumn;\r
+ UINTN FPos;\r
+ BOOLEAN LastLine;\r
+\r
+ //\r
+ // variable initialization\r
+ //\r
+ LastLine = FALSE;\r
+\r
+ //\r
+ // already the first character\r
+ //\r
+ if (HBufferImage.BufferPosition.Row == 1 && HBufferImage.BufferPosition.Column == 1) {\r
+ return EFI_SUCCESS;\r
+ }\r
+\r
+ FPos = (HBufferImage.BufferPosition.Row - 1) * 0x10 + HBufferImage.BufferPosition.Column - 1;\r
+\r
+ FileColumn = HBufferImage.BufferPosition.Column;\r
+\r
+ Line = HBufferImage.CurrentLine;\r
+ LastLine = FALSE;\r
+ if (Line->Link.ForwardLink == HBufferImage.ListHead && FileColumn > 1) {\r
+ LastLine = TRUE;\r
+ }\r
+\r
+ HBufferImageDeleteCharacterFromBuffer (FPos - 1, 1, NULL);\r
+\r
+ //\r
+ // if is the last line\r
+ // then only this line need to be refreshed\r
+ //\r
+ if (LastLine) {\r
+ HBufferImageNeedRefresh = FALSE;\r
+ HBufferImageOnlyLineNeedRefresh = TRUE;\r
+ } else {\r
+ HBufferImageNeedRefresh = TRUE;\r
+ HBufferImageOnlyLineNeedRefresh = FALSE;\r
+ }\r
+\r
+ if (!HBufferImage.Modified) {\r
+ HBufferImage.Modified = TRUE;\r
+ }\r
+\r
+ return EFI_SUCCESS;\r
+}\r
+\r
+/**\r
+ ASCII key + Backspace + return.\r
+\r
+ @param[in] Char The input char.\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_LOAD_ERROR A load error occured.\r
+ @retval EFI_OUT_OF_RESOURCES A memory allocation failed.\r
+**/\r
+EFI_STATUS\r
+EFIAPI\r
+HBufferImageDoCharInput (\r
+ IN CHAR16 Char\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ Status = EFI_SUCCESS;\r
+\r
+ switch (Char) {\r
+ case 0:\r
+ break;\r
+\r
+ case 0x08:\r
+ Status = HBufferImageDoBackspace ();\r
+ break;\r
+\r
+ case 0x09:\r
+ case 0x0a:\r
+ case 0x0d:\r
+ //\r
+ // Tabs, Returns are thought as nothing\r
+ //\r
+ break;\r
+\r
+ default:\r
+ //\r
+ // DEAL WITH ASCII CHAR, filter out thing like ctrl+f\r
+ //\r
+ if (Char > 127 || Char < 32) {\r
+ Status = StatusBarSetStatusString (L"Unknown Command");\r
+ } else {\r
+ Status = HBufferImageAddChar (Char);\r
+ }\r
+\r
+ break;\r
+ }\r
+\r
+ return Status;\r
}\r
\r
/**\r
IN UINTN NewFilePosCol,\r
IN BOOLEAN HighBits\r
)\r
-\r
{\r
INTN RowGap;\r
UINTN Abs;\r
\r
@param[in] Pos Position, Pos starting from 0.\r
@param[in] Count The Count of characters to delete.\r
- @param[OUT] DeleteBuffer The DeleteBuffer.\r
+ @param[out] DeleteBuffer The DeleteBuffer.\r
\r
@retval EFI_SUCCESS Success \r
**/\r
return EFI_SUCCESS;\r
}\r
\r
-/**\r
- Delete the previous character.\r
-\r
- @retval EFI_SUCCESS The operationw as successful.\r
-**/\r
-EFI_STATUS\r
-EFIAPI\r
-HBufferImageDoBackspace (\r
- VOID\r
- )\r
-{\r
- HEFI_EDITOR_LINE *Line;\r
-\r
- UINTN FileColumn;\r
- UINTN FPos;\r
- BOOLEAN LastLine;\r
-\r
- //\r
- // variable initialization\r
- //\r
- LastLine = FALSE;\r
-\r
- //\r
- // already the first character\r
- //\r
- if (HBufferImage.BufferPosition.Row == 1 && HBufferImage.BufferPosition.Column == 1) {\r
- return EFI_SUCCESS;\r
- }\r
-\r
- FPos = (HBufferImage.BufferPosition.Row - 1) * 0x10 + HBufferImage.BufferPosition.Column - 1;\r
-\r
- FileColumn = HBufferImage.BufferPosition.Column;\r
-\r
- Line = HBufferImage.CurrentLine;\r
- LastLine = FALSE;\r
- if (Line->Link.ForwardLink == HBufferImage.ListHead && FileColumn > 1) {\r
- LastLine = TRUE;\r
- }\r
-\r
- HBufferImageDeleteCharacterFromBuffer (FPos - 1, 1, NULL);\r
-\r
- //\r
- // if is the last line\r
- // then only this line need to be refreshed\r
- //\r
- if (LastLine) {\r
- HBufferImageNeedRefresh = FALSE;\r
- HBufferImageOnlyLineNeedRefresh = TRUE;\r
- } else {\r
- HBufferImageNeedRefresh = TRUE;\r
- HBufferImageOnlyLineNeedRefresh = FALSE;\r
- }\r
-\r
- if (!HBufferImage.Modified) {\r
- HBufferImage.Modified = TRUE;\r
- }\r
-\r
- return EFI_SUCCESS;\r
-}\r
-\r
/**\r
Delete current character from line.\r
\r
}\r
\r
}\r
+\r
+/**\r
+ Dispatch input to different handler\r
+\r
+ @param[in] Key The input key:\r
+ the keys can be:\r
+ ASCII KEY\r
+ Backspace/Delete\r
+ Direction key: up/down/left/right/pgup/pgdn\r
+ Home/End\r
+ INS\r
+\r
+ @retval EFI_SUCCESS The operation was successful.\r
+ @retval EFI_LOAD_ERROR A load error occured.\r
+ @retval EFI_OUT_OF_RESOURCES A Memory allocation failed.\r
+**/\r
+EFI_STATUS\r
+HBufferImageHandleInput (\r
+ IN EFI_INPUT_KEY *Key\r
+ )\r
+{\r
+ EFI_STATUS Status;\r
+\r
+ Status = EFI_SUCCESS;\r
+\r
+ switch (Key->ScanCode) {\r
+ //\r
+ // ordinary key\r
+ //\r
+ case SCAN_NULL:\r
+ Status = HBufferImageDoCharInput (Key->UnicodeChar);\r
+ break;\r
+\r
+ //\r
+ // up arrow\r
+ //\r
+ case SCAN_UP:\r
+ Status = HBufferImageScrollUp ();\r
+ break;\r
+\r
+ //\r
+ // down arrow\r
+ //\r
+ case SCAN_DOWN:\r
+ Status = HBufferImageScrollDown ();\r
+ break;\r
+\r
+ //\r
+ // right arrow\r
+ //\r
+ case SCAN_RIGHT:\r
+ Status = HBufferImageScrollRight ();\r
+ break;\r
+\r
+ //\r
+ // left arrow\r
+ //\r
+ case SCAN_LEFT:\r
+ Status = HBufferImageScrollLeft ();\r
+ break;\r
+\r
+ //\r
+ // page up\r
+ //\r
+ case SCAN_PAGE_UP:\r
+ Status = HBufferImagePageUp ();\r
+ break;\r
+\r
+ //\r
+ // page down\r
+ //\r
+ case SCAN_PAGE_DOWN:\r
+ Status = HBufferImagePageDown ();\r
+ break;\r
+\r
+ //\r
+ // delete\r
+ //\r
+ case SCAN_DELETE:\r
+ Status = HBufferImageDoDelete ();\r
+ break;\r
+\r
+ //\r
+ // home\r
+ //\r
+ case SCAN_HOME:\r
+ Status = HBufferImageHome ();\r
+ break;\r
+\r
+ //\r
+ // end\r
+ //\r
+ case SCAN_END:\r
+ Status = HBufferImageEnd ();\r
+ break;\r
+\r
+ default:\r
+ Status = StatusBarSetStatusString (L"Unknown Command");\r
+ break;\r
+ }\r
+\r
+ return Status;\r
+}\r
+\r