TMPHexEditor v 09-09-2003
credits to :
- John Hamm, http://users.snapjax.com/john/
- Christophe Le Corfec for introducing the EBCDIC format and the nice idea about half byte insert/delete
- Philippe Chessa for his suggestions about AsText, AsHex and better support for the french keyboard layout
- Daniel Jensen for octal offset display and the INS-key recognition stuff
- Shmuel Zeigerman for introducing more flexible offset display formats
- Vaf, http://carradio.al.ru for reporting missing delver.inc and suggesting OnChange
- Eugene Tarasov for reporting that setting the BytesPerColumn value to 4 at design time didn't work
- FuseBurner for BytesPerUnit/RulerBytesPerUnit related suggestions
- Motzi for SyncView/ShowPositionIfNotFocused related suggestions
- Martin Hsiao for bcb compatibility and reporting some bugs when moving cursor beyond eof
- Miyu for delphi 7 defines
- Nils Hoyer, http://www.star-tools.de for bcb testing and packaging
MPHCustomCharConvBytesPerBlock and SeparateBlocksInCharField properties addedDataSize property is writeable nowOnGetOffsetText propertyAddSelectionUndo procedureFindWithWildcard)SeekToEOFGotoBookmark method to set cursor to a bookmarked positionOnBookmarkChanged propertyReplace method addedTMPHexEditorExTMPHexEditorExOnDrawCell)UnicodeChars and UnicodeBigEndian)DisplayStart and DisplayEnd functions to retrieve the data bounds currently displayedBytesPerUnit and RulerBytesPerUnit properties to treat words/dwords/qwords as a unitSyncView procedure and OnSelectionChanged property to synchronize position and selection with another editorShowPositionIfNotFocused property to show the current position if the editor is not focusedShowRuler, DrawGutter3D| Name | Description |
|---|---|
Class EMPHexEditor |
|
Class TCustomMPHexEditor |
|
Class TMPHColors |
|
Class TMPHexEditor |
function CheckRadixToInt(Value: string): integer; |
function CheckRadixToInt64(Value: string): int64; |
function ConvertBinToHex(aFrom, aTo: PChar; const aCount: integer; const SwapNibbles: boolean): PChar; |
function ConvertHexToBin(aFrom, aTo: PChar; const aCount: integer; const SwapNibbles: boolean; var BytesTranslated: integer): PChar; |
function GetTempName: string; |
function GridCoord(aX, aY: longint): TGridCoord; |
function IntToOctal(const Value: integer): string; |
function IntToRadix(Value: integer; Radix: byte): string; |
function IntToRadix64(Value: int64; Radix: byte): string; |
function IntToRadixLen(Value: integer; Radix, Len: byte): string; |
function IntToRadixLen64(Value: int64; Radix, Len: byte): string; |
function IsKeyDown(aKey: integer): boolean; |
function Max(a1, a2: integer): integer; |
function Min(a1, a2: integer): integer; |
function OctalToInt(const Value: string): integer; |
function RadixToInt(Value: string; Radix: byte): integer; |
function RadixToInt64(Value: string; Radix: byte): int64; |
procedure SwapWideChar(var WChar: WideChar); |
procedure TranslateBufferFromAnsi(const TType: TMPHTranslationKind; aBuffer, bBuffer: PChar; const aCount: integer); |
procedure TranslateBufferToAnsi(const TType: TMPHTranslationKind; aBuffer, bBuffer: PChar; const aCount: integer); |
function CheckRadixToInt(Value: string): integer; |
try to find the correct radix (based on prefix/suffix) and return the number, known prefixes/suffixes are:
0x<number>, 0X<number>, $<number>, <number>h, <number>H: radix 16
o<number>, O<number>, 0<number>, <number>o, <number>O: radix 8
%<number>, <number>%: radix 2
otherwise: radix 10
function CheckRadixToInt64(Value: string): int64; |
function ConvertBinToHex(aFrom, aTo: PChar; const aCount: integer; const SwapNibbles: boolean): PChar; |
translate binary data to its hex representation (see ConvertHexToBin), (see SwapNibbles for the meaning of the SwapNibbles value)
function ConvertHexToBin(aFrom, aTo: PChar; const aCount: integer; const SwapNibbles: boolean; var BytesTranslated: integer): PChar; |
translate a hexadecimal data representation ("a000 cc45 d3 42"...) to binary data (see SwapNibbles for the meaning of the SwapNibbles value)
function GetTempName: string; |
get a unique filename in the temporary directory
function GridCoord(aX, aY: longint): TGridCoord; |
convert X and Y into a TGridCoord record
function IntToOctal(const Value: integer): string; |
translate an integer to an octal string (see also IntToRadix)
function IntToRadix(Value: integer; Radix: byte): string; |
translate an integer to a radix (base) coded string, e.g.
- IntToRadix(100,16) converts into a hexadecimal (number) string
- IntToRadix(100,2) converts into a string consisting only of 0 and 1
- IntToRadix(100,8) means IntToOctal
hint: Radix must be in the range of 2..16
function IntToRadix64(Value: int64; Radix: byte): string; |
function IntToRadixLen(Value: integer; Radix, Len: byte): string; |
translate an integer to a radix coded string and left fill with 0 (see also IntToRadix)
function IntToRadixLen64(Value: int64; Radix, Len: byte): string; |
function IsKeyDown(aKey: integer): boolean; |
check whether the given key (VK_...) is currently down
function Max(a1, a2: integer): integer; |
returns the higer of the two numbers
function Min(a1, a2: integer): integer; |
returns the lower of the two numbers
function OctalToInt(const Value: string): integer; |
translate an number string built on radix 8 into an integer (see also RadixToInt)
function RadixToInt(Value: string; Radix: byte): integer; |
translate a radix coded number string into an integer, e.g.
- RadixToInt('0f', 16) => 15
- RadixToInt('755', 8) => 493
function RadixToInt64(Value: string; Radix: byte): int64; |
procedure SwapWideChar(var WChar: WideChar); |
swap lo and high byte of a widechar
procedure TranslateBufferFromAnsi(const TType: TMPHTranslationKind; aBuffer, bBuffer: PChar; const aCount: integer); |
translate data from Ansi to a different character set (see also TMPHTranslationKind)
- TType: translate to this character set
- aBuffer: pointer to source data
- bBuffer: pointer to target data, must be allocated (may equal to aBuffer)
- aCount: number of bytes to translate
procedure TranslateBufferToAnsi(const TType: TMPHTranslationKind; aBuffer, bBuffer: PChar; const aCount: integer); |
translate data from a different character set to Ansi (see also TranslateBufferFromAnsi)
| Name | Description |
|---|---|
| TMPHBookmark | bookmark record: defined by pressing SHIFT+CTRL+[0..9], goto bookmark by pressing CTRL+[0..9] - mPosition: file position - mInCharField: cursor in character pane (True) or hex number pane |
| TMPHBookmarks | array of bookmarks, representing keys 0..9 |
| TMPHCaretKind | look of the editor's caret: - ckFull: full block - ckLeft: left line - ckBottom: bottom line - ckAuto: left line if InsertMode, full block otherwise |
| TMPHCharConv | character conversion data storage |
| TMPHCharConvTable | character conversion table |
| TMPHCharConvType | character conversion type |
| TMPHDrawCellEvent | owner draw event type. parameters: - Sender: the hex editor - ACanvas: the editor's canvas - ACol, ARow: the position to be drawn - AWideText: the text to be drawn - ARect: the cell rectangle - ADefaultDraw: if set to True (default), default drawing isperformed after the event handler returns. if set to false, the event handler must do all cell painting. |
| TMPHGetOffsetTextEvent | retrieve the "line number" to display by the application - Number: the number to convert to text - OffsetText: the resulting text output |
| TMPHProgressEvent | progress event handler, used in OnLoadSaveProgress- ProgressType: am i loading or saving? (see TMPHProgressKind)- aName: name of file to be load from/saved to - Percent: current progress (0..100) - Cancel: if set to true, the load/save procedure will abort |
| TMPHProgressKind | action indicator used in OnLoadSaveProgress event handler:- pkLoad: loading data - pkSave: saving data |
| TMPHTranslationKind | how to show a file's content in the character pane of the editor: - tkAsIs: leave as is (current windows code page) - tkDos8: current dos codepage - tkASCII: 7 bit ascii - tkMac: macintosh charset (translation always from/to ms cp 1252 (ms latin1)!! - tkBCD: ibm ebcdic codepage 38 (translation always from/to ms cp 1252 (ms latin1)!! - tkCustom: custom codepage stored in MPHCustomCharConv |
| Name | Description |
|---|---|
| CM_INTUPDATECARET | this message is posted to the hex editor when it should update the caret position |
| CM_SELECTIONCHANGED | this message is posted when an OnSelectionChange event is to be fired |
| MPHOffsetDec | standard offset format: decimal |
| MPHOffsetHex | standard offset format: hex, auto min width, prefixed by 0x |
| MPHOffsetOct | standard offset format: octal, suffixed by a small "o" |
| MPHTranslationDesc | long descriptions of the different translations (e.g. for menues) |
| MPHTranslationDescShort | short descriptions of the different translations (e.g. for status bars) |
| MPH_CCONV_BCD38 | ebcdic cp38..ms ansi conversion |
| MPH_CCONV_MAC | macintosh..ms ansi conversion |
| MPH_FILEIO_BLOCKSIZE | block size in file i/o |
| MPH_TK_ASCII7 | tkASCII |
| MPH_TK_ASCII7_S | tkASCII |
| MPH_TK_ASIS | tkAsIs |
| MPH_TK_ASIS_S | tkAsIs |
| MPH_TK_BCD38 | tkBCD |
| MPH_TK_BCD38_S | tkBCD |
| MPH_TK_CUSTOM | tkCustom |
| MPH_TK_CUSTOM_S | tkCustom |
| MPH_TK_DOS8 | tkDos8 |
| MPH_TK_DOS8_S | tkDos8 |
| MPH_TK_MAC | tkMac |
| MPH_TK_MAC_S | tkMac |
| MPH_UC | unicode |
| MPH_UC_BE | unicode be |
| MPH_UC_BE_S | unicode be |
| MPH_UC_S | unicode |
| Name | Description |
|---|---|
| MPHCustomCharConv | this character conversion is used in translations from tkAsIs to tkCustom (see TMPHTranslationKind) |
(C)1997-2003 markus stephany, merkes@mirkes.de, all rights reserved.
09-09-2003