TMPHexEditor v 10-25-2002
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.
ShowRuler
, DrawGutter3D
Name | Description |
---|---|
Class EMPHException | custom Exception class |
Class TCustomMPHexEditor | protected ancestor of the hex editor components |
Class TMPHColors | persistent color storage (contains the colors in hex editors) |
Class TMPHexEditor | published hex editor component |
function CheckRadixToInt(Value: string): integer; |
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 IntToRadixLen(Value: integer; 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; |
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 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 IntToRadixLen(Value: integer; Radix, Len: byte): string; |
translate an integer to a radix coded string and left fill with 0 (see also IntToRadix
)
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
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 |
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 MPHCustTransFieldFrom [0..255] and MPHCustTransFieldTo [0..255] |
Name | Description |
---|---|
MPHCustTransFieldFrom | this table is used in translations from tkAsIs to tkCustom (see TMPHTranslationKind ) |
MPHCustTransFieldTo | this table is used in translations from tkCustom to tkAsIs (see TMPHTranslationKind ) |
(C) 1997-2002 markus stephany, merkes@mirkes.de, all rights reserved.
10-25-2002